Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type ThemeColor,
type PolymorphicExtras,
} from './utils';
import Fade, { type FadeProps } from './Fade';
Expand All @@ -17,7 +18,7 @@ export interface AlertOwnProps {
/** Aria label for close button */
closeAriaLabel?: string;
/** Change color of alert */
color?: string;
color?: ThemeColor;
/** Change existing className with a new className */
cssModule?: CSSModule;
/** Toggle fade animation */
Expand Down
3 changes: 2 additions & 1 deletion src/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type ThemeColor,
type PolymorphicExtras,
} from './utils';

export interface BadgeOwnProps {
/** Add custom class */
className?: string;
/** Change background color of Badge */
color?: string;
color?: ThemeColor;
/** Change existing className with a new className */
cssModule?: CSSModule;
/** Renders an `<a>` when `tag` is left as `span` */
Expand Down
6 changes: 4 additions & 2 deletions src/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type Size,
type ThemeColor,
type PolymorphicExtras,
} from './utils';
import CloseButton from './CloseButton';
Expand All @@ -19,7 +21,7 @@ export interface ButtonOwnProps {
/** Use the button as a close button */
close?: boolean;
/** Change color of Button to one of the available colors */
color?: string;
color?: ThemeColor | 'link';
/** Disables the button */
disabled?: boolean;
/** Renders an `<a>` when `tag` is left as `button` */
Expand All @@ -30,7 +32,7 @@ export interface ButtonOwnProps {
/** Adds outline to the button */
outline?: boolean;
/** Make the button bigger or smaller */
size?: string;
size?: Size;
}

export type ButtonProps<T extends ElementType = 'button'> = ButtonOwnProps &
Expand Down
7 changes: 4 additions & 3 deletions src/ButtonGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { ElementType } from 'react';
import type { ElementType, AriaRole } from 'react';
import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type Size,
type PolymorphicExtras,
} from './utils';

Expand All @@ -14,9 +15,9 @@ export interface ButtonGroupOwnProps {
/** Change underlying component's CSS base class name */
cssModule?: CSSModule;
/** In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate role attribute needs to be provided. For button groups, this would be role="group", while toolbars should have a role="toolbar". */
role?: string;
role?: AriaRole;
/** Make the button bigger or smaller */
size?: string;
size?: Size;
/** Make button group vertical */
vertical?: boolean;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ButtonToolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ElementType } from 'react';
import type { ElementType, AriaRole } from 'react';
import classNames from 'classnames';
import {
mapToCssModules,
Expand All @@ -14,7 +14,7 @@ export interface ButtonToolbarOwnProps {
/** Change existing className with a new className */
cssModule?: CSSModule;
/** In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate role attribute needs to be provided. For button groups, this would be role="group", while toolbars should have a role="toolbar". */
role?: string;
role?: AriaRole;
}

export type ButtonToolbarProps<T extends ElementType = 'div'> =
Expand Down
3 changes: 2 additions & 1 deletion src/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type ThemeColor,
type PolymorphicExtras,
} from './utils';

Expand All @@ -12,7 +13,7 @@ export interface CardOwnProps {
/** Add custom class */
className?: string;
/** Change background color of component */
color?: string;
color?: ThemeColor;
/** Change underlying component's CSS base class name */
cssModule?: CSSModule;
innerRef?: Ref<any>;
Expand Down
10 changes: 6 additions & 4 deletions src/Col.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ import {

const colWidths = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];

/** Column span: a number of columns, `auto`, or a custom value. */
export type ColumnSize = number | 'auto' | (string & {});

export type ColumnProps =
| string
| ColumnSize
| boolean
| number
| {
size?: boolean | number | string;
size?: boolean | ColumnSize;
offset?: string | number;
order?: string | number;
order?: number | 'first' | 'last' | (string & {});
};

/** Breakpoint column props shared by `Col`, `Placeholder` and `PlaceholderButton`. */
Expand Down
3 changes: 2 additions & 1 deletion src/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type Breakpoint,
type PolymorphicExtras,
} from './utils';

export interface ContainerOwnProps {
/** `true` for `.container-fluid`, or a breakpoint (e.g. `md`) for `.container-md` */
fluid?: boolean | string;
fluid?: boolean | Breakpoint;
className?: string;
cssModule?: CSSModule;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
mapToCssModules,
omit,
type CSSModule,
type Size,
type PolymorphicClassExtras,
} from './utils';

Expand All @@ -43,7 +44,7 @@ export interface DropdownOwnProps {
/** Add `.active` when `nav`. */
active?: boolean;
/** Adds `.btn-group-${size}`. */
size?: string;
size?: Size;
/** Called to open or close the menu. */
toggle?: KeyboardEventHandler<any> | MouseEventHandler<any>;
children?: ReactNode;
Expand Down
6 changes: 4 additions & 2 deletions src/DropdownToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { DropdownContext } from './DropdownContext';
import {
mapToCssModules,
type CSSModule,
type Size,
type ThemeColor,
type PolymorphicClassExtras,
} from './utils';
import Button from './Button';
Expand All @@ -20,14 +22,14 @@ export interface DropdownToggleOwnProps {
/** Render as `.dropdown-toggle` (with caret). */
caret?: boolean;
/** Button color, when rendered as the default `Button`. @default 'secondary' */
color?: string;
color?: ThemeColor | 'link';
className?: string;
cssModule?: CSSModule;
disabled?: boolean;
/** Forwarded to `Button`. */
outline?: boolean;
/** Forwarded to `Button`. */
size?: string;
size?: Size;
/** @default true */
'aria-haspopup'?: boolean;
/** Render as `.dropdown-toggle-split`. */
Expand Down
3 changes: 2 additions & 1 deletion src/FormText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type ThemeColor,
type PolymorphicExtras,
} from './utils';

Expand All @@ -11,7 +12,7 @@ export interface FormTextOwnProps {
/** Omit the `.form-text` class */
inline?: boolean;
/** Text color (`text-${color}`); empty string for none */
color?: string;
color?: ThemeColor | 'muted' | 'body' | 'white' | '';
cssModule?: CSSModule;
}

Expand Down
3 changes: 2 additions & 1 deletion src/InputGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type Size,
type PolymorphicExtras,
} from './utils';
import Dropdown, { type DropdownProps } from './Dropdown';
Expand All @@ -14,7 +15,7 @@ export interface InputGroupOwnProps {
/** Change underlying component's CSS base class name */
cssModule?: CSSModule;
/** Sets size of InputGroup */
size?: string;
size?: Size;
/** Only `'dropdown'` is meaningful (see `InputGroupDropdownProps`) */
type?: undefined;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getColumnClasses, type ColumnSizeProps } from './Col';
import {
mapToCssModules,
type CSSModule,
type Size,
type PolymorphicExtras,
} from './utils';

Expand All @@ -14,7 +15,7 @@ export interface LabelOwnProps extends ColumnSizeProps {
/** Label for a checkbox/radio (`.form-check-label`) */
check?: boolean;
/** Horizontal form label size (`col-form-label-${size}`) */
size?: string;
size?: Size;
/** Alias of `htmlFor` */
for?: string;
cssModule?: CSSModule;
Expand Down
2 changes: 1 addition & 1 deletion src/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ListOwnProps {
/** Change underlying component's CSS base class name */
cssModule?: CSSModule;
/** Type of list `unstyled` or `inline` */
type?: string;
type?: 'unstyled' | 'inline';
}

export type ListProps<T extends ElementType = 'ul'> = ListOwnProps &
Expand Down
3 changes: 2 additions & 1 deletion src/ListGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type Breakpoint,
type PolymorphicExtras,
} from './utils';

Expand All @@ -14,7 +15,7 @@ export interface ListGroupOwnProps {
/** Remove borders to make the list appear flush */
flush?: boolean;
/** Make the list horizontal instead of vertical; pass a breakpoint (e.g. `md`) to make it responsive */
horizontal?: boolean | string;
horizontal?: boolean | Breakpoint;
/** Add number to the ListItems */
numbered?: boolean;
}
Expand Down
3 changes: 2 additions & 1 deletion src/ListGroupItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type ThemeColor,
type PolymorphicExtras,
} from './utils';

Expand All @@ -16,7 +17,7 @@ export interface ListGroupItemOwnProps {
/** Change underlying component's CSS base class name */
cssModule?: CSSModule;
/** Add background colour to the list item */
color?: string;
color?: ThemeColor;
/** Make the list item appear disabled (also swallows clicks) */
disabled?: boolean;
href?: string;
Expand Down
7 changes: 4 additions & 3 deletions src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
type ReactNode,
type Ref,
type SyntheticEvent,
type AriaRole,
} from 'react';
import { createPortal } from 'react-dom';
import classNames from 'classnames';
Expand Down Expand Up @@ -52,7 +53,7 @@ export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
/** Enable/Disable animation */
fade?: boolean;
/** Make the modal fullscreen, optionally only below a breakpoint */
fullscreen?: boolean | 'sm' | 'md' | 'lg' | 'xl';
fullscreen?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
/** Ref to the `.modal` element */
innerRef?: Ref<HTMLElement>;
/** The status of the modal, either open or close */
Expand All @@ -76,11 +77,11 @@ export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
/** Returns focus to the element that triggered opening of the modal */
returnFocusAfterClose?: boolean;
/** Accessibility role */
role?: string;
role?: AriaRole;
/** Make the modal scrollable */
scrollable?: boolean;
/** Two optional sizes `lg` and `sm` */
size?: string;
size?: 'sm' | 'lg' | 'xl';
/** Function to toggle modal visibility */
toggle?: KeyboardEventHandler<any> | MouseEventHandler<any>;
/** Keep focus inside the modal */
Expand Down
5 changes: 3 additions & 2 deletions src/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type Breakpoint,
type PolymorphicExtras,
} from './utils';

Expand All @@ -16,7 +17,7 @@ export interface NavOwnProps {
/** fills the nav to extend to full available width */
fill?: boolean;
/** Change the horizontal alignment of your nav (`justify-content-${horizontal}`), e.g. `center`, `end` */
horizontal?: string;
horizontal?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';
/** All horizontal space will be occupied by nav links, but unlike the `fill` above, every nav item will be the same width. */
justified?: boolean;
/** Add navbar for a full-height and lightweight navigation */
Expand All @@ -26,7 +27,7 @@ export interface NavOwnProps {
/** Make NavItems look like tabs */
tabs?: boolean;
/** Stack your navigation by changing the flex item direction; a breakpoint string makes it responsive */
vertical?: boolean | string;
vertical?: boolean | Breakpoint;
}

export type NavProps<T extends ElementType = 'ul'> = NavOwnProps &
Expand Down
10 changes: 6 additions & 4 deletions src/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import classNames from 'classnames';
import {
mapToCssModules,
type CSSModule,
type Breakpoint,
type ThemeColor,
type PolymorphicExtras,
} from './utils';

Expand All @@ -11,21 +13,21 @@ export interface NavbarOwnProps {
/** Add custom class */
className?: string;
/** Theme the navbar by adding a background color */
color?: string;
color?: ThemeColor;
/** Use any of the responsive containers to change how wide the content in your navbar is presented. */
container?: boolean | 'fluid' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
/** Change underlying component's CSS base class name */
cssModule?: CSSModule;
/** This prop is passed if the background is dark, to make the text lighter */
dark?: boolean;
/** Breakpoint from which the navbar expands (`true` = always) */
expand?: boolean | string;
expand?: boolean | Breakpoint;
/** Make the navbar fixed (`fixed-${fixed}`), e.g. `top`, `bottom` */
fixed?: string;
fixed?: 'top' | 'bottom';
/** Add `.navbar-light` class */
light?: boolean;
/** Use `position: sticky` (`sticky-${sticky}`), e.g. `top` */
sticky?: string;
sticky?: 'top' | 'bottom';
}

export type NavbarProps<T extends ElementType = 'nav'> = NavbarOwnProps &
Expand Down
3 changes: 2 additions & 1 deletion src/Offcanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
type ReactNode,
type Ref,
type SyntheticEvent,
type AriaRole,
} from 'react';
import { createPortal } from 'react-dom';
import classNames from 'classnames';
Expand Down Expand Up @@ -67,7 +68,7 @@ export interface OffcanvasProps extends HTMLAttributes<HTMLDivElement> {
/** Returns focus to the element that triggered opening of the offcanvas */
returnFocusAfterClose?: boolean;
/** Accessibility role */
role?: string;
role?: AriaRole;
/** Allow body scrolling while open */
scrollable?: boolean;
/** Function to toggle offcanvas visibility */
Expand Down
Loading
Loading