@lucasromero/matrix-ui 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +93 -61
- package/dist/components/Accordion/Accordion.d.ts +5 -0
- package/dist/components/Accordion/Accordion.js +40 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.module.js +10 -0
- package/dist/components/Alert/Alert.d.ts +11 -0
- package/dist/components/Alert/Alert.js +66 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.module.js +15 -0
- package/dist/components/Avatar/Avatar.d.ts +6 -0
- package/dist/components/Avatar/Avatar.js +36 -0
- package/dist/components/Avatar/helpers/getInitials.d.ts +1 -0
- package/dist/components/Avatar/helpers/getInitials.js +6 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.module.js +9 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +7 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +35 -0
- package/dist/components/AvatarGroup/index.d.ts +1 -0
- package/dist/components/AvatarGroup/index.module.js +9 -0
- package/dist/components/Badge/Badge.d.ts +5 -3
- package/dist/components/Badge/Badge.js +21 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.module.js +10 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +6 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +41 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Breadcrumbs/index.module.js +11 -0
- package/dist/components/Button/Button.d.ts +6 -3
- package/dist/components/Button/Button.js +27 -0
- package/dist/components/Button/ButtonLink.d.ts +6 -0
- package/dist/components/Button/ButtonLink.js +16 -0
- package/dist/components/Button/buttonClassName.d.ts +2 -0
- package/dist/components/Button/buttonClassName.js +11 -0
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.module.js +13 -0
- package/dist/components/Card/Card.d.ts +3 -3
- package/dist/components/Card/Card.js +10 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.module.js +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.js +21 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.module.js +7 -0
- package/dist/components/Chip/Chip.d.ts +7 -0
- package/dist/components/Chip/Chip.js +34 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/Chip/index.module.js +10 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +8 -0
- package/dist/components/CodeBlock/CodeBlock.js +47 -0
- package/dist/components/CodeBlock/index.d.ts +1 -0
- package/dist/components/CodeBlock/index.module.js +9 -0
- package/dist/components/Combobox/Combobox.d.ts +11 -0
- package/dist/components/Combobox/Combobox.js +123 -0
- package/dist/components/Combobox/index.d.ts +1 -0
- package/dist/components/Combobox/index.module.js +12 -0
- package/dist/components/Container/Container.d.ts +5 -0
- package/dist/components/Container/Container.js +15 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/Container/index.module.js +21 -0
- package/dist/components/DateInput/DateInput.d.ts +4 -0
- package/dist/components/DateInput/DateInput.js +54 -0
- package/dist/components/DateInput/index.d.ts +1 -0
- package/dist/components/DateInput/index.module.js +7 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +5 -0
- package/dist/components/DescriptionList/DescriptionList.js +26 -0
- package/dist/components/DescriptionList/index.d.ts +1 -0
- package/dist/components/DescriptionList/index.module.js +10 -0
- package/dist/components/Dialog/Dialog.d.ts +14 -0
- package/dist/components/Dialog/Dialog.js +73 -0
- package/dist/components/Dialog/index.d.ts +1 -0
- package/dist/components/Dialog/index.module.js +16 -0
- package/dist/components/Divider/Divider.d.ts +5 -0
- package/dist/components/Divider/Divider.js +18 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Divider/index.module.js +19 -0
- package/dist/components/Drawer/Drawer.d.ts +3 -0
- package/dist/components/Drawer/Drawer.js +73 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.module.js +17 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +11 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +95 -0
- package/dist/components/DropdownMenu/index.d.ts +1 -0
- package/dist/components/DropdownMenu/index.module.js +11 -0
- package/dist/components/EmptyState/EmptyState.d.ts +8 -0
- package/dist/components/EmptyState/EmptyState.js +39 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EmptyState/index.module.js +10 -0
- package/dist/components/FileUpload/FileUpload.d.ts +7 -0
- package/dist/components/FileUpload/FileUpload.js +116 -0
- package/dist/components/FileUpload/helpers/formatFileSize.d.ts +1 -0
- package/dist/components/FileUpload/helpers/formatFileSize.js +12 -0
- package/dist/components/FileUpload/helpers/matchesAccept.d.ts +1 -0
- package/dist/components/FileUpload/helpers/matchesAccept.js +7 -0
- package/dist/components/FileUpload/index.d.ts +1 -0
- package/dist/components/FileUpload/index.module.js +16 -0
- package/dist/components/FormField/FormField.d.ts +11 -0
- package/dist/components/FormField/FormField.js +35 -0
- package/dist/components/FormField/index.d.ts +1 -0
- package/dist/components/FormField/index.module.js +8 -0
- package/dist/components/Heading/Heading.d.ts +4 -0
- package/dist/components/Heading/Heading.js +14 -0
- package/dist/components/Heading/index.d.ts +1 -0
- package/dist/components/Heading/index.module.js +9 -0
- package/dist/components/Inline/Inline.d.ts +7 -0
- package/dist/components/Inline/Inline.js +17 -0
- package/dist/components/Inline/index.d.ts +1 -0
- package/dist/components/Inline/index.module.js +27 -0
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.js +11 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.module.js +3 -0
- package/dist/components/Link/Link.d.ts +3 -3
- package/dist/components/Link/Link.js +11 -0
- package/dist/components/Link/index.d.ts +1 -0
- package/dist/components/Link/index.module.js +3 -0
- package/dist/components/Navigation/Navigation.d.ts +14 -0
- package/dist/components/Navigation/Navigation.js +75 -0
- package/dist/components/Navigation/NavigationMenu.d.ts +6 -0
- package/dist/components/Navigation/NavigationMenu.js +48 -0
- package/dist/components/Navigation/index.d.ts +2 -0
- package/dist/components/Navigation/index.module.js +20 -0
- package/dist/components/NumberInput/NumberInput.d.ts +10 -0
- package/dist/components/NumberInput/NumberInput.js +80 -0
- package/dist/components/NumberInput/index.d.ts +1 -0
- package/dist/components/NumberInput/index.module.js +7 -0
- package/dist/components/OtpInput/OtpInput.d.ts +8 -0
- package/dist/components/OtpInput/OtpInput.js +47 -0
- package/dist/components/OtpInput/index.d.ts +1 -0
- package/dist/components/OtpInput/index.module.js +9 -0
- package/dist/components/PageHeader/PageHeader.d.ts +8 -0
- package/dist/components/PageHeader/PageHeader.js +39 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/PageHeader/index.module.js +8 -0
- package/dist/components/Pagination/Pagination.d.ts +14 -0
- package/dist/components/Pagination/Pagination.js +81 -0
- package/dist/components/Pagination/helpers/getPaginationItems.d.ts +1 -0
- package/dist/components/Pagination/helpers/getPaginationItems.js +22 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/Pagination/index.module.js +11 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/components/PasswordInput/PasswordInput.js +42 -0
- package/dist/components/PasswordInput/index.d.ts +1 -0
- package/dist/components/PasswordInput/index.module.js +7 -0
- package/dist/components/Phone/Phone.d.ts +7 -0
- package/dist/components/Phone/Phone.js +19 -0
- package/dist/components/Phone/helpers/formatPhoneNumber.d.ts +14 -0
- package/dist/components/Phone/helpers/formatPhoneNumber.js +15 -0
- package/dist/components/Phone/index.d.ts +1 -0
- package/dist/components/Popover/Popover.d.ts +11 -0
- package/dist/components/Popover/Popover.js +51 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.module.js +7 -0
- package/dist/components/Progress/Progress.d.ts +10 -0
- package/dist/components/Progress/Progress.js +74 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Progress/index.module.js +21 -0
- package/dist/components/Radio/Radio.d.ts +3 -0
- package/dist/components/Radio/Radio.js +21 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/index.module.js +7 -0
- package/dist/components/RelatedLinks/RelatedLinks.d.ts +6 -0
- package/dist/components/RelatedLinks/RelatedLinks.js +39 -0
- package/dist/components/RelatedLinks/index.d.ts +1 -0
- package/dist/components/RelatedLinks/index.module.js +11 -0
- package/dist/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/components/SearchInput/SearchInput.js +28 -0
- package/dist/components/SearchInput/index.d.ts +1 -0
- package/dist/components/SearchInput/index.module.js +8 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.js +31 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.module.js +8 -0
- package/dist/components/SideNav/SideNav.d.ts +6 -0
- package/dist/components/SideNav/SideNav.js +38 -0
- package/dist/components/SideNav/index.d.ts +1 -0
- package/dist/components/SideNav/index.module.js +10 -0
- package/dist/components/Skeleton/Skeleton.d.ts +6 -0
- package/dist/components/Skeleton/Skeleton.js +39 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/index.module.js +11 -0
- package/dist/components/Slider/Slider.d.ts +10 -0
- package/dist/components/Slider/Slider.js +37 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.module.js +7 -0
- package/dist/components/Spinner/Spinner.d.ts +4 -0
- package/dist/components/Spinner/Spinner.js +24 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.module.js +10 -0
- package/dist/components/Stack/Stack.d.ts +5 -0
- package/dist/components/Stack/Stack.js +15 -0
- package/dist/components/Stack/index.d.ts +1 -0
- package/dist/components/Stack/index.module.js +21 -0
- package/dist/components/Stepper/Stepper.d.ts +6 -0
- package/dist/components/Stepper/Stepper.js +50 -0
- package/dist/components/Stepper/index.d.ts +1 -0
- package/dist/components/Stepper/index.module.js +15 -0
- package/dist/components/Switch/Switch.d.ts +3 -0
- package/dist/components/Switch/Switch.js +22 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/index.module.js +7 -0
- package/dist/components/Table/Table.d.ts +3 -0
- package/dist/components/Table/Table.js +34 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.module.js +9 -0
- package/dist/components/Tabs/Tabs.d.ts +8 -0
- package/dist/components/Tabs/Tabs.js +63 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.module.js +9 -0
- package/dist/components/Text/Text.d.ts +3 -3
- package/dist/components/Text/Text.js +15 -0
- package/dist/components/Text/index.d.ts +1 -0
- package/dist/components/Text/index.module.js +10 -0
- package/dist/components/TextTag/TextTag.d.ts +5 -0
- package/dist/components/TextTag/TextTag.js +19 -0
- package/dist/components/TextTag/index.d.ts +1 -0
- package/dist/components/TextTag/index.module.js +7 -0
- package/dist/components/Textarea/Textarea.d.ts +2 -0
- package/dist/components/Textarea/Textarea.js +11 -0
- package/dist/components/Textarea/index.d.ts +1 -0
- package/dist/components/Textarea/index.module.js +3 -0
- package/dist/components/TimeInput/TimeInput.d.ts +4 -0
- package/dist/components/TimeInput/TimeInput.js +54 -0
- package/dist/components/TimeInput/index.d.ts +1 -0
- package/dist/components/TimeInput/index.module.js +7 -0
- package/dist/components/Toast/Toast.d.ts +4 -0
- package/dist/components/Toast/Toast.js +26 -0
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/components/Toast/index.module.js +8 -0
- package/dist/components/Toggle/Toggle.d.ts +4 -0
- package/dist/components/Toggle/Toggle.js +20 -0
- package/dist/components/Toggle/index.d.ts +1 -0
- package/dist/components/Toggle/index.module.js +7 -0
- package/dist/components/Tooltip/Tooltip.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.js +48 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.module.js +7 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +3 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +15 -0
- package/dist/components/VisuallyHidden/index.d.ts +1 -0
- package/dist/components/VisuallyHidden/index.module.js +6 -0
- package/dist/hooks/useAnchoredPosition.d.ts +6 -0
- package/dist/hooks/useAnchoredPosition.js +40 -0
- package/dist/hooks/useDisclosure.d.ts +2 -0
- package/dist/hooks/useDisclosure.js +23 -0
- package/dist/hooks/useDismiss.d.ts +3 -0
- package/dist/hooks/useDismiss.js +22 -0
- package/dist/hooks/useMediaQuery.d.ts +2 -0
- package/dist/hooks/useMediaQuery.js +12 -0
- package/dist/hooks/useModalDialog.d.ts +9 -0
- package/dist/hooks/useModalDialog.js +54 -0
- package/dist/hooks/useOpenState.d.ts +1 -0
- package/dist/hooks/useOpenState.js +14 -0
- package/dist/index.d.ts +117 -3
- package/dist/index.js +62 -0
- package/dist/styles.css +2 -0
- package/dist/types/accordionType.d.ts +19 -0
- package/dist/types/alertType.d.ts +30 -0
- package/dist/types/avatarGroupType.d.ts +20 -0
- package/dist/types/avatarType.d.ts +15 -0
- package/dist/types/badgeType.d.ts +11 -8
- package/dist/types/breadcrumbsType.d.ts +23 -0
- package/dist/types/buttonLinkType.d.ts +19 -0
- package/dist/types/buttonType.d.ts +27 -9
- package/dist/types/cardType.d.ts +9 -43
- package/dist/types/checkboxType.d.ts +9 -0
- package/dist/types/chipType.d.ts +18 -0
- package/dist/types/codeBlockType.d.ts +19 -0
- package/dist/types/comboboxType.d.ts +27 -0
- package/dist/types/containerType.d.ts +11 -0
- package/dist/types/dateInputType.d.ts +7 -0
- package/dist/types/descriptionListType.d.ts +20 -0
- package/dist/types/dialogType.d.ts +38 -0
- package/dist/types/dividerType.d.ts +14 -0
- package/dist/types/drawerType.d.ts +7 -0
- package/dist/types/dropdownMenuType.d.ts +36 -0
- package/dist/types/emptyStateType.d.ts +16 -0
- package/dist/types/fileUploadType.d.ts +13 -0
- package/dist/types/formFieldType.d.ts +26 -0
- package/dist/types/headingType.d.ts +12 -0
- package/dist/types/index.d.ts +61 -11
- package/dist/types/inlineType.d.ts +17 -0
- package/dist/types/inputType.d.ts +8 -0
- package/dist/types/linkType.d.ts +8 -9
- package/dist/types/navigationMenuType.d.ts +14 -0
- package/dist/types/navigationType.d.ts +42 -0
- package/dist/types/numberInputType.d.ts +19 -0
- package/dist/types/otpInputType.d.ts +16 -0
- package/dist/types/pageHeaderType.d.ts +19 -0
- package/dist/types/paginationType.d.ts +37 -0
- package/dist/types/passwordInputType.d.ts +5 -0
- package/dist/types/phoneType.d.ts +19 -0
- package/dist/types/popoverType.d.ts +31 -0
- package/dist/types/progressType.d.ts +21 -0
- package/dist/types/radioType.d.ts +9 -0
- package/dist/types/relatedLinksType.d.ts +25 -0
- package/dist/types/searchInputType.d.ts +6 -0
- package/dist/types/selectType.d.ts +8 -0
- package/dist/types/sideNavType.d.ts +35 -0
- package/dist/types/skeletonType.d.ts +12 -0
- package/dist/types/sliderType.d.ts +19 -0
- package/dist/types/spaceType.d.ts +2 -0
- package/dist/types/spinnerType.d.ts +12 -0
- package/dist/types/stackType.d.ts +15 -0
- package/dist/types/stepperType.d.ts +27 -0
- package/dist/types/switchType.d.ts +9 -0
- package/dist/types/tableType.d.ts +26 -0
- package/dist/types/tabsType.d.ts +30 -0
- package/dist/types/textTagType.d.ts +9 -0
- package/dist/types/textType.d.ts +5 -15
- package/dist/types/textareaType.d.ts +8 -0
- package/dist/types/timeInputType.d.ts +7 -0
- package/dist/types/toastType.d.ts +7 -0
- package/dist/types/toggleType.d.ts +7 -0
- package/dist/types/tooltipType.d.ts +22 -0
- package/dist/types/useDisclosureType.d.ts +30 -0
- package/dist/types/useMediaQueryType.d.ts +4 -0
- package/dist/types/visuallyHiddenType.d.ts +5 -0
- package/package.json +54 -75
- package/dist/components/CardRow/CardRow.d.ts +0 -3
- package/dist/components/IconDropdown/IconDropdown.d.ts +0 -3
- package/dist/components/Image/Image.d.ts +0 -3
- package/dist/components/Navbar/Navbar.d.ts +0 -3
- package/dist/components/Rating/Rating.d.ts +0 -3
- package/dist/components/SelectDropdown/SelectDropdown.d.ts +0 -3
- package/dist/components/index.d.ts +0 -11
- package/dist/favicon.svg +0 -1
- package/dist/fonts/Inter-400.woff2 +0 -11
- package/dist/fonts/Inter-500.woff2 +0 -11
- package/dist/fonts/Inter-600.woff2 +0 -11
- package/dist/fonts/Inter-700.woff2 +0 -11
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useBreakpoint.d.ts +0 -7
- package/dist/icons.svg +0 -24
- package/dist/matrix-ui.es.js +0 -680
- package/dist/matrix-ui.umd.js +0 -2
- package/dist/types/cardRowType.d.ts +0 -34
- package/dist/types/iconDropdownType.d.ts +0 -16
- package/dist/types/imageType.d.ts +0 -11
- package/dist/types/navbarType.d.ts +0 -27
- package/dist/types/ratingType.d.ts +0 -3
- package/dist/types/selectDropdownType.d.ts +0 -15
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type CopyStatus = "idle" | "copied" | "failed";
|
|
3
|
+
export type CodeBlockProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "title"> & {
|
|
4
|
+
/** Code to display and copy. Trailing whitespace is not displayed. */
|
|
5
|
+
code: string;
|
|
6
|
+
/** Visible title above the code, such as a file name. */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** Visible text of the copy button. Defaults to "Copy". */
|
|
9
|
+
copyLabel?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Accessible name of the copy button. Defaults to "Copy" followed by the
|
|
12
|
+
* title, or "Copy code" without a title. It must include `copyLabel`.
|
|
13
|
+
*/
|
|
14
|
+
copyButtonLabel?: string;
|
|
15
|
+
/** Message announced after the code is copied. Defaults to "Copied". */
|
|
16
|
+
copiedMessage?: string;
|
|
17
|
+
/** Message announced when copying fails. Defaults to "Copy failed". */
|
|
18
|
+
copyFailedMessage?: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InputProps } from "./inputType.js";
|
|
2
|
+
export type ComboboxOption = {
|
|
3
|
+
/** Unique value of the option, passed to `onValueChange`. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Visible text. It is matched against what people type, and fills the input when chosen. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Prevents choosing the option. It stays in the list. Defaults to `false`. */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ComboboxProps = Omit<InputProps, "value" | "defaultValue" | "onChange" | "type" | "role" | "list"> & {
|
|
11
|
+
/** Options to choose from, in display order. */
|
|
12
|
+
options: ComboboxOption[];
|
|
13
|
+
/** Value of the chosen option, or `null` for none, when the consuming application controls it. Use it with `onValueChange`. */
|
|
14
|
+
value?: string | null;
|
|
15
|
+
/** Value chosen at first, when the combobox keeps its own state. Defaults to none. */
|
|
16
|
+
defaultValue?: string | null;
|
|
17
|
+
/** Called with the value of the chosen option, or `null` when the choice is cleared. */
|
|
18
|
+
onValueChange?: (value: string | null) => void;
|
|
19
|
+
/** Called with the text in the input as people type. */
|
|
20
|
+
onInputChange?: (text: string) => void;
|
|
21
|
+
/** Returns whether an option matches the typed text. Defaults to a case-insensitive match anywhere in the label. */
|
|
22
|
+
filter?: (option: ComboboxOption, query: string) => boolean;
|
|
23
|
+
/** Text shown when no option matches. Defaults to "No results". */
|
|
24
|
+
emptyMessage?: string;
|
|
25
|
+
/** Accessible name of the list of options. Defaults to "Suggestions". */
|
|
26
|
+
listboxLabel?: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
import type { SpaceToken } from "./spaceType.js";
|
|
3
|
+
export type ContainerSize = "small" | "medium" | "large" | "full";
|
|
4
|
+
export type ContainerProps = HTMLAttributes<HTMLElement> & {
|
|
5
|
+
/** Maximum width: 40, 60, or 80rem, or the full width. Defaults to `"large"`. */
|
|
6
|
+
size?: ContainerSize;
|
|
7
|
+
/** Space on the left and right, as a step of the spacing scale. Defaults to `4`. */
|
|
8
|
+
padding?: SpaceToken;
|
|
9
|
+
/** Element to render. Defaults to `"div"`. Use `"main"` or `"section"` when it holds a page region. */
|
|
10
|
+
as?: "div" | "main" | "section" | "article" | "header" | "footer";
|
|
11
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InputProps } from "./inputType.js";
|
|
2
|
+
export type DateInputProps = Omit<InputProps, "type"> & {
|
|
3
|
+
/** Class name for the calendar button. */
|
|
4
|
+
calendarButtonClassName?: string;
|
|
5
|
+
/** Accessible name of the calendar button. Defaults to "Choose date". */
|
|
6
|
+
calendarButtonLabel?: string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type DescriptionListItem = {
|
|
3
|
+
/** The name, such as "Email". */
|
|
4
|
+
term: ReactNode;
|
|
5
|
+
/** The value, such as "ana@example.com". */
|
|
6
|
+
description: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type DescriptionListLayout = "stacked" | "columns";
|
|
9
|
+
export type DescriptionListProps = Omit<HTMLAttributes<HTMLDListElement>, "children"> & {
|
|
10
|
+
/** Pairs of terms and descriptions, in display order. */
|
|
11
|
+
items: DescriptionListItem[];
|
|
12
|
+
/**
|
|
13
|
+
* `"stacked"` puts each description under its term. `"columns"` puts terms
|
|
14
|
+
* in a column beside their descriptions, and stacks them on narrow screens.
|
|
15
|
+
* Defaults to `"columns"`.
|
|
16
|
+
*/
|
|
17
|
+
layout?: DescriptionListLayout;
|
|
18
|
+
/** Draws a line between pairs. Defaults to `true`. */
|
|
19
|
+
dividers?: boolean;
|
|
20
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode, RefObject } from "react";
|
|
2
|
+
import type { HeadingLevel } from "./headingType.js";
|
|
3
|
+
export type DialogSize = "small" | "medium" | "large";
|
|
4
|
+
/** Why a dialog asked to close: the Escape key, a click on the backdrop, or its close button. */
|
|
5
|
+
export type DialogCloseReason = "escape" | "backdrop" | "close-button";
|
|
6
|
+
export type DialogProps = Omit<HTMLAttributes<HTMLDialogElement>, "children" | "title" | "open"> & {
|
|
7
|
+
/** Whether the dialog is open. The consuming application owns this state. */
|
|
8
|
+
open: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Called when the dialog asks to close, with the reason. Set `open` to
|
|
11
|
+
* `false` here; the dialog stays open until you do.
|
|
12
|
+
*/
|
|
13
|
+
onClose: (reason: DialogCloseReason) => void;
|
|
14
|
+
/** Visible title. It names the dialog. */
|
|
15
|
+
title: ReactNode;
|
|
16
|
+
/** Heading level of the title. Defaults to `2`. */
|
|
17
|
+
titleLevel?: HeadingLevel;
|
|
18
|
+
/** Short text below the title. It describes the dialog. Use phrasing content, as it renders in a paragraph. */
|
|
19
|
+
description?: ReactNode;
|
|
20
|
+
/** Main content. */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/** Content at the end of the dialog, such as its action buttons. */
|
|
23
|
+
footer?: ReactNode;
|
|
24
|
+
/** Maximum width of the dialog. Defaults to `"medium"`. */
|
|
25
|
+
size?: DialogSize;
|
|
26
|
+
/** Accessible name of the close button. Defaults to "Close". */
|
|
27
|
+
closeLabel?: string;
|
|
28
|
+
/** Hides the close button. Defaults to `false`. Keep another way to close the dialog, such as a Cancel button. */
|
|
29
|
+
hideCloseButton?: boolean;
|
|
30
|
+
/** Asks to close when the backdrop is clicked. Defaults to `true`. */
|
|
31
|
+
closeOnBackdropClick?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Element to focus when the dialog opens. Defaults to the first focusable
|
|
34
|
+
* element, which is usually the close button. Point it at the least
|
|
35
|
+
* destructive action, or at the first field of a form.
|
|
36
|
+
*/
|
|
37
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
38
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
import type { SpaceToken } from "./spaceType.js";
|
|
3
|
+
export type DividerOrientation = "horizontal" | "vertical";
|
|
4
|
+
export type DividerProps = Omit<HTMLAttributes<HTMLHRElement>, "children"> & {
|
|
5
|
+
/** Direction of the line. A vertical divider fills the height of a row, such as an `Inline`. Defaults to `"horizontal"`. */
|
|
6
|
+
orientation?: DividerOrientation;
|
|
7
|
+
/** Space on both sides of the line, as a step of the spacing scale. Defaults to `4`. */
|
|
8
|
+
spacing?: SpaceToken;
|
|
9
|
+
/**
|
|
10
|
+
* Hides the divider from assistive technology. Defaults to `false`. Use it
|
|
11
|
+
* when the line is only visual, and does not separate sections of content.
|
|
12
|
+
*/
|
|
13
|
+
decorative?: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DialogProps } from "./dialogType.js";
|
|
2
|
+
/** The edge a drawer opens from. `"start"` is the left in left-to-right languages. */
|
|
3
|
+
export type DrawerSide = "start" | "end";
|
|
4
|
+
export type DrawerProps = Omit<DialogProps, "size"> & {
|
|
5
|
+
/** Edge of the screen the drawer is attached to. Defaults to `"end"`. */
|
|
6
|
+
side?: DrawerSide;
|
|
7
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { PopoverAlign, PopoverSide, PopoverTriggerProps } from "./popoverType.js";
|
|
3
|
+
export type DropdownMenuItem = {
|
|
4
|
+
/** Visible text. It names the item, and typing its first letter moves focus to it. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Called when the item is chosen. The menu then closes and focus returns to the trigger. */
|
|
7
|
+
onSelect?: () => void;
|
|
8
|
+
/** Icon shown before the label. It is hidden from assistive technology. */
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
/** Keeps the item focusable but prevents choosing it. Defaults to `false`. */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Shows the item in the danger color, for destructive actions. Defaults to `false`. */
|
|
13
|
+
danger?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type DropdownMenuProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "role"> & {
|
|
16
|
+
/**
|
|
17
|
+
* The trigger, such as a `Button`. It receives `id`, `onClick`, `onKeyDown`,
|
|
18
|
+
* `aria-expanded`, `aria-haspopup`, and `aria-controls`, and must pass them
|
|
19
|
+
* to its element.
|
|
20
|
+
*/
|
|
21
|
+
children: ReactElement<PopoverTriggerProps>;
|
|
22
|
+
/** Actions in the menu, in display order. */
|
|
23
|
+
items: DropdownMenuItem[];
|
|
24
|
+
/** Accessible name of the menu. Defaults to the trigger's name. */
|
|
25
|
+
label?: string;
|
|
26
|
+
/** Whether the menu is open, when the consuming application controls it. Use it with `onOpenChange`. */
|
|
27
|
+
open?: boolean;
|
|
28
|
+
/** Whether the menu starts open, when it keeps its own state. Defaults to `false`. */
|
|
29
|
+
defaultOpen?: boolean;
|
|
30
|
+
/** Called when the menu opens or closes. */
|
|
31
|
+
onOpenChange?: (open: boolean) => void;
|
|
32
|
+
/** Side of the trigger the menu prefers. Defaults to `"bottom"`. */
|
|
33
|
+
side?: PopoverSide;
|
|
34
|
+
/** How the menu lines up with the trigger. Defaults to `"start"`. */
|
|
35
|
+
align?: PopoverAlign;
|
|
36
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { HeadingLevel } from "./headingType.js";
|
|
3
|
+
export type EmptyStateProps = Omit<HTMLAttributes<HTMLDivElement>, "title" | "children"> & {
|
|
4
|
+
/** Short heading that says what is empty, such as "No projects yet". */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** Heading level of the title. Defaults to `2`. Choose the level that fits the page outline. */
|
|
7
|
+
titleLevel?: HeadingLevel;
|
|
8
|
+
/** Text below the title, such as why it is empty or what to do next. Use phrasing content, as it renders in a paragraph. */
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/** Icon or illustration above the title, hidden from assistive technology. */
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
/** Actions below the description, such as a `Button`. */
|
|
13
|
+
actions?: ReactNode;
|
|
14
|
+
/** Draws a dashed border around the empty state. Defaults to `false`. */
|
|
15
|
+
bordered?: boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from "react";
|
|
2
|
+
export type FileUploadProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "children"> & {
|
|
3
|
+
/** Called with every selected file after files are chosen, dropped, or removed. */
|
|
4
|
+
onFilesChange?: (files: File[]) => void;
|
|
5
|
+
/** Text inside the drop area. Defaults to "Drag and drop files here, or choose them". */
|
|
6
|
+
dropLabel?: string;
|
|
7
|
+
/** Shows the selected files below the drop area, each with a remove button. Defaults to `true`. */
|
|
8
|
+
showFileList?: boolean;
|
|
9
|
+
/** Accessible name of the list of selected files. Defaults to "Selected files". */
|
|
10
|
+
fileListLabel?: string;
|
|
11
|
+
/** Returns the accessible name of a file's remove button. Defaults to "Remove report.pdf". */
|
|
12
|
+
getRemoveLabel?: (file: File) => string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AriaAttributes, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type FormFieldProps = Omit<HTMLAttributes<HTMLDivElement>, "id" | "children"> & {
|
|
3
|
+
/** id of the control in `children`. The label points to it, and the error id is derived from it. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Visible label text. It names the control. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Marks the field as optional in its label. Defaults to `false`. */
|
|
8
|
+
optional?: boolean;
|
|
9
|
+
/** Text shown after the label when `optional` is true. Defaults to "(Optional)". */
|
|
10
|
+
optionalText?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Error message. While set, it is shown with the id `<id>-error`, announced
|
|
13
|
+
* politely, added to the control's `aria-describedby`, and the control is
|
|
14
|
+
* marked `aria-invalid` unless it already sets that attribute.
|
|
15
|
+
*/
|
|
16
|
+
error?: string | null;
|
|
17
|
+
/** The control, such as `Input` or `Phone`, with an `id` matching `id`. */
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
/** Class name for the label. */
|
|
20
|
+
labelClassName?: string;
|
|
21
|
+
/** Class name for the optional text. */
|
|
22
|
+
optionalClassName?: string;
|
|
23
|
+
/** Class name for the error message. */
|
|
24
|
+
errorClassName?: string;
|
|
25
|
+
};
|
|
26
|
+
export type DescribableProps = Pick<AriaAttributes, "aria-describedby" | "aria-invalid">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
export type HeadingSize = "display" | "large" | "medium" | "small";
|
|
4
|
+
export type HeadingProps = HTMLAttributes<HTMLHeadingElement> & {
|
|
5
|
+
/** Heading level, which sets the element from `h1` to `h6`. Defaults to `1`. */
|
|
6
|
+
level?: HeadingLevel;
|
|
7
|
+
/**
|
|
8
|
+
* Visual size, independent of `level`. Defaults to `"display"`. Choose
|
|
9
|
+
* `level` from the document outline, not from the size you want.
|
|
10
|
+
*/
|
|
11
|
+
size?: HeadingSize;
|
|
12
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,61 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
1
|
+
export type { AccordionItem, AccordionProps } from "./accordionType.js";
|
|
2
|
+
export type { AlertProps, AlertVariant } from "./alertType.js";
|
|
3
|
+
export type { AvatarGroupItem, AvatarGroupProps } from "./avatarGroupType.js";
|
|
4
|
+
export type { AvatarProps, AvatarSize } from "./avatarType.js";
|
|
5
|
+
export type { BadgeProps, BadgeSize, BadgeVariant } from "./badgeType.js";
|
|
6
|
+
export type { BreadcrumbItem, BreadcrumbLinkProps, BreadcrumbsProps } from "./breadcrumbsType.js";
|
|
7
|
+
export type { ButtonLinkProps } from "./buttonLinkType.js";
|
|
8
|
+
export type { ButtonClassNameOptions, ButtonProps, ButtonSize, ButtonVariant, } from "./buttonType.js";
|
|
9
|
+
export type { CardProps } from "./cardType.js";
|
|
10
|
+
export type { CheckboxProps } from "./checkboxType.js";
|
|
11
|
+
export type { ChipProps, ChipSize } from "./chipType.js";
|
|
12
|
+
export type { CodeBlockProps, CopyStatus } from "./codeBlockType.js";
|
|
13
|
+
export type { ComboboxOption, ComboboxProps } from "./comboboxType.js";
|
|
14
|
+
export type { ContainerProps, ContainerSize } from "./containerType.js";
|
|
15
|
+
export type { DateInputProps } from "./dateInputType.js";
|
|
16
|
+
export type { DescriptionListItem, DescriptionListLayout, DescriptionListProps, } from "./descriptionListType.js";
|
|
17
|
+
export type { DialogCloseReason, DialogProps, DialogSize } from "./dialogType.js";
|
|
18
|
+
export type { DividerOrientation, DividerProps } from "./dividerType.js";
|
|
19
|
+
export type { DrawerProps, DrawerSide } from "./drawerType.js";
|
|
20
|
+
export type { DropdownMenuItem, DropdownMenuProps } from "./dropdownMenuType.js";
|
|
21
|
+
export type { EmptyStateProps } from "./emptyStateType.js";
|
|
22
|
+
export type { FileUploadProps } from "./fileUploadType.js";
|
|
23
|
+
export type { DescribableProps, FormFieldProps } from "./formFieldType.js";
|
|
24
|
+
export type { HeadingLevel, HeadingProps, HeadingSize } from "./headingType.js";
|
|
25
|
+
export type { InlineAlign, InlineJustify, InlineProps } from "./inlineType.js";
|
|
26
|
+
export type { InputProps } from "./inputType.js";
|
|
27
|
+
export type { LinkProps } from "./linkType.js";
|
|
28
|
+
export type { NavigationMenuProps } from "./navigationMenuType.js";
|
|
29
|
+
export type { NavigationItem, NavigationLinkProps, NavigationProps } from "./navigationType.js";
|
|
30
|
+
export type { NumberInputProps } from "./numberInputType.js";
|
|
31
|
+
export type { OtpInputMode, OtpInputProps } from "./otpInputType.js";
|
|
32
|
+
export type { PageHeaderProps } from "./pageHeaderType.js";
|
|
33
|
+
export type { PaginationLinkProps, PaginationProps } from "./paginationType.js";
|
|
34
|
+
export type { PasswordInputProps } from "./passwordInputType.js";
|
|
35
|
+
export type { PhoneCountryCode, PhoneProps } from "./phoneType.js";
|
|
36
|
+
export type { PopoverAlign, PopoverProps, PopoverSide, PopoverTriggerProps, } from "./popoverType.js";
|
|
37
|
+
export type { ProgressProps, ProgressSize, ProgressVariant } from "./progressType.js";
|
|
38
|
+
export type { RadioProps } from "./radioType.js";
|
|
39
|
+
export type { RelatedLinkItem, RelatedLinkProps, RelatedLinksProps } from "./relatedLinksType.js";
|
|
40
|
+
export type { SearchInputProps } from "./searchInputType.js";
|
|
41
|
+
export type { SelectProps } from "./selectType.js";
|
|
42
|
+
export type { SideNavItem, SideNavLinkProps, SideNavProps, SideNavSection } from "./sideNavType.js";
|
|
43
|
+
export type { SkeletonProps, SkeletonVariant } from "./skeletonType.js";
|
|
44
|
+
export type { SliderProps } from "./sliderType.js";
|
|
45
|
+
export type { SpaceToken } from "./spaceType.js";
|
|
46
|
+
export type { SpinnerProps, SpinnerSize } from "./spinnerType.js";
|
|
47
|
+
export type { LayoutElement, StackAlign, StackProps } from "./stackType.js";
|
|
48
|
+
export type { StepperOrientation, StepperProps, StepperStatusLabels, StepperStep, } from "./stepperType.js";
|
|
49
|
+
export type { SwitchProps } from "./switchType.js";
|
|
50
|
+
export type { TableColumn, TableProps } from "./tableType.js";
|
|
51
|
+
export type { TabsActivation, TabsItem, TabsProps } from "./tabsType.js";
|
|
52
|
+
export type { TextareaProps } from "./textareaType.js";
|
|
53
|
+
export type { TextTagProps } from "./textTagType.js";
|
|
54
|
+
export type { TextProps, TextVariant } from "./textType.js";
|
|
55
|
+
export type { TimeInputProps } from "./timeInputType.js";
|
|
56
|
+
export type { ToastProps } from "./toastType.js";
|
|
57
|
+
export type { ToggleProps } from "./toggleType.js";
|
|
58
|
+
export type { TooltipProps } from "./tooltipType.js";
|
|
59
|
+
export type { UseDisclosureButtonProps, UseDisclosureOptions, UseDisclosurePanelProps, UseDisclosureResult, } from "./useDisclosureType.js";
|
|
60
|
+
export type { UseMediaQueryOptions } from "./useMediaQueryType.js";
|
|
61
|
+
export type { VisuallyHiddenProps } from "./visuallyHiddenType.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
import type { SpaceToken } from "./spaceType.js";
|
|
3
|
+
import type { LayoutElement } from "./stackType.js";
|
|
4
|
+
export type InlineAlign = "start" | "center" | "end" | "baseline" | "stretch";
|
|
5
|
+
export type InlineJustify = "start" | "center" | "end" | "between";
|
|
6
|
+
export type InlineProps = HTMLAttributes<HTMLElement> & {
|
|
7
|
+
/** Space between children, as a step of the spacing scale. Defaults to `2`. */
|
|
8
|
+
gap?: SpaceToken;
|
|
9
|
+
/** How children line up vertically. Defaults to `"center"`. */
|
|
10
|
+
align?: InlineAlign;
|
|
11
|
+
/** How children are spread along the row. Defaults to `"start"`. */
|
|
12
|
+
justify?: InlineJustify;
|
|
13
|
+
/** Lets children move onto more rows when they do not fit. Defaults to `true`. */
|
|
14
|
+
wrap?: boolean;
|
|
15
|
+
/** Element to render. Defaults to `"div"`. Use `"ul"` or `"ol"` with `<li>` children for a list. */
|
|
16
|
+
as?: LayoutElement;
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Accepts every native input attribute. Give the input an accessible name with
|
|
4
|
+
* an associated `<label>`, such as through `FormField`, or with `aria-label`.
|
|
5
|
+
* Mark validation errors with `aria-invalid` and connect them with
|
|
6
|
+
* `aria-describedby`.
|
|
7
|
+
*/
|
|
8
|
+
export type InputProps = InputHTMLAttributes<HTMLInputElement>;
|
package/dist/types/linkType.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
import type { AnchorHTMLAttributes } from "react";
|
|
2
|
+
export type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
3
|
+
/**
|
|
4
|
+
* Link destination. To navigate with a router, pass the router's resolved
|
|
5
|
+
* URL here and handle `onClick`, as with `ButtonLink`.
|
|
6
|
+
*/
|
|
7
|
+
href: string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type NavigationMenuProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
3
|
+
/**
|
|
4
|
+
* Accessible name of the trigger button. If `trigger` contains visible text,
|
|
5
|
+
* this label must include that text.
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/** Links and buttons shown when the menu is open. The consuming application owns their behavior. */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/** Visible trigger content, hidden from assistive technology. Defaults to a chevron icon. */
|
|
11
|
+
trigger?: ReactNode;
|
|
12
|
+
/** Change this value on route changes to close the menu. */
|
|
13
|
+
navigationKey?: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type NavigationItem = {
|
|
3
|
+
/** Link destination, passed to `renderLink`. Also used as the item's key, so it must be unique. */
|
|
4
|
+
href: string;
|
|
5
|
+
/** Visible link content. */
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/** Marks the link as the current page with `aria-current="page"`. */
|
|
8
|
+
current?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type NavigationLinkProps = {
|
|
11
|
+
href: string;
|
|
12
|
+
className: string;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
"aria-current"?: "page";
|
|
15
|
+
};
|
|
16
|
+
export type NavigationProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
17
|
+
/** Links to display. Hide or filter items in the consuming application. */
|
|
18
|
+
items: NavigationItem[];
|
|
19
|
+
/** Brand content, such as a logo. Include a link here if the brand should navigate. */
|
|
20
|
+
brand?: ReactNode;
|
|
21
|
+
/** Content after the links on wide screens, such as a `NavigationMenu` or a sign-in button. */
|
|
22
|
+
actions?: ReactNode;
|
|
23
|
+
/** Content after the links in the narrow-screen menu. Defaults to `actions`. */
|
|
24
|
+
mobileActions?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Renders each link, which lets the consuming application use its router.
|
|
27
|
+
* Spread the received props onto the link. Defaults to a native anchor.
|
|
28
|
+
*/
|
|
29
|
+
renderLink?: (props: NavigationLinkProps) => ReactNode;
|
|
30
|
+
/** Change this value on route changes to close the narrow-screen menu. */
|
|
31
|
+
navigationKey?: string;
|
|
32
|
+
/** Accessible name of the navigation landmark. Must be unique on the page. */
|
|
33
|
+
navigationLabel?: string;
|
|
34
|
+
/** Accessible name of the menu button while the narrow-screen menu is closed. */
|
|
35
|
+
openMenuLabel?: string;
|
|
36
|
+
/** Accessible name of the menu button while the narrow-screen menu is open. */
|
|
37
|
+
closeMenuLabel?: string;
|
|
38
|
+
/** Menu button icon while the narrow-screen menu is closed. Mark it `aria-hidden`. */
|
|
39
|
+
openMenuIcon?: ReactNode;
|
|
40
|
+
/** Menu button icon while the narrow-screen menu is open. Mark it `aria-hidden`. */
|
|
41
|
+
closeMenuIcon?: ReactNode;
|
|
42
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InputProps } from "./inputType.js";
|
|
2
|
+
export type NumberInputProps = Omit<InputProps, "type" | "value" | "defaultValue" | "onChange" | "min" | "max" | "step"> & {
|
|
3
|
+
/** The number, or `null` when empty, when the consuming application controls it. Use it with `onValueChange`. */
|
|
4
|
+
value?: number | null;
|
|
5
|
+
/** The number at first, when the input keeps its own state. Defaults to empty. */
|
|
6
|
+
defaultValue?: number | null;
|
|
7
|
+
/** Called with the new number, or `null` when the input is empty or not a number. */
|
|
8
|
+
onValueChange?: (value: number | null) => void;
|
|
9
|
+
/** Smallest allowed value. Values below it are raised to it when the input loses focus. */
|
|
10
|
+
min?: number;
|
|
11
|
+
/** Largest allowed value. Values above it are lowered to it when the input loses focus. */
|
|
12
|
+
max?: number;
|
|
13
|
+
/** Amount the buttons and arrow keys change the value by. Defaults to `1`. */
|
|
14
|
+
step?: number;
|
|
15
|
+
/** Accessible name of the decrease button. Defaults to "Decrease". */
|
|
16
|
+
decrementLabel?: string;
|
|
17
|
+
/** Accessible name of the increase button. Defaults to "Increase". */
|
|
18
|
+
incrementLabel?: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InputProps } from "./inputType.js";
|
|
2
|
+
export type OtpInputMode = "numeric" | "alphanumeric";
|
|
3
|
+
export type OtpInputProps = Omit<InputProps, "type" | "value" | "defaultValue" | "onChange" | "maxLength" | "inputMode"> & {
|
|
4
|
+
/** Number of characters in the code. Longer input, such as a pasted code with spaces, is cleaned and then shortened to it. Defaults to `6`. */
|
|
5
|
+
length?: number;
|
|
6
|
+
/** Characters allowed. Others are removed as people type or paste. Defaults to `"numeric"`. */
|
|
7
|
+
mode?: OtpInputMode;
|
|
8
|
+
/** The code, when the consuming application controls it. Use it with `onValueChange`. */
|
|
9
|
+
value?: string;
|
|
10
|
+
/** The code at first, when the input keeps its own state. Defaults to empty. */
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
/** Called with the code after each change. */
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
/** Called with the code once every character has been entered. */
|
|
15
|
+
onComplete?: (value: string) => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { HeadingLevel } from "./headingType.js";
|
|
3
|
+
export type PageHeaderProps = Omit<HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
4
|
+
/** Main heading of the page. */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** Heading level of the title. Defaults to `1`. */
|
|
7
|
+
titleLevel?: HeadingLevel;
|
|
8
|
+
/**
|
|
9
|
+
* id of the title, for naming a surrounding region with `aria-labelledby`.
|
|
10
|
+
* Defaults to a generated id.
|
|
11
|
+
*/
|
|
12
|
+
titleId?: string;
|
|
13
|
+
/** Short text above the title, such as a section or category name. */
|
|
14
|
+
eyebrow?: ReactNode;
|
|
15
|
+
/** Introductory text below the title. Use phrasing content, as it renders in a paragraph. */
|
|
16
|
+
lead?: ReactNode;
|
|
17
|
+
/** Extra content below the lead, such as a notice, links, or actions. */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type PaginationLinkProps = {
|
|
3
|
+
href: string;
|
|
4
|
+
className: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
"aria-label": string;
|
|
7
|
+
"aria-current"?: "page";
|
|
8
|
+
};
|
|
9
|
+
export type PaginationProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
10
|
+
/** Current page, starting at 1. */
|
|
11
|
+
page: number;
|
|
12
|
+
/** Total number of pages. With fewer than 2 pages, nothing is shown. */
|
|
13
|
+
pageCount: number;
|
|
14
|
+
/**
|
|
15
|
+
* Called with the page to show when a page button is pressed. Use it, or
|
|
16
|
+
* `getHref` for pages with their own address, to make the controls work.
|
|
17
|
+
*/
|
|
18
|
+
onPageChange?: (page: number) => void;
|
|
19
|
+
/** Returns the address of a page. When set, the controls are links instead of buttons. */
|
|
20
|
+
getHref?: (page: number) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Renders each link when `getHref` is set, which lets the consuming
|
|
23
|
+
* application use its router. Spread the received props onto the link.
|
|
24
|
+
* Defaults to a native anchor.
|
|
25
|
+
*/
|
|
26
|
+
renderLink?: (props: PaginationLinkProps) => ReactNode;
|
|
27
|
+
/** Pages shown on each side of the current page before a gap. Defaults to `1`. */
|
|
28
|
+
siblingCount?: number;
|
|
29
|
+
/** Accessible name of the navigation landmark. Defaults to "Pagination". */
|
|
30
|
+
label?: string;
|
|
31
|
+
/** Visible text of the previous-page control. Defaults to "Previous". */
|
|
32
|
+
previousLabel?: string;
|
|
33
|
+
/** Visible text of the next-page control. Defaults to "Next". */
|
|
34
|
+
nextLabel?: string;
|
|
35
|
+
/** Returns the accessible name of a page control. Defaults to "Page 3". */
|
|
36
|
+
getPageLabel?: (page: number) => string;
|
|
37
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InputProps } from "./inputType.js";
|
|
2
|
+
export type PasswordInputProps = Omit<InputProps, "type"> & {
|
|
3
|
+
/** Accessible name of the button that shows the password. Defaults to "Show password". It is a toggle button, so it is announced as pressed while the password shows. */
|
|
4
|
+
toggleLabel?: string;
|
|
5
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CountryCode } from "libphonenumber-js/min";
|
|
2
|
+
import type { InputProps } from "./inputType.js";
|
|
3
|
+
/** An ISO 3166-1 alpha-2 country code, such as `"US"` or `"GB"`. */
|
|
4
|
+
export type PhoneCountryCode = CountryCode;
|
|
5
|
+
export type PhoneProps = Omit<InputProps, "id" | "name" | "value" | "defaultValue" | "onChange" | "type" | "inputMode"> & {
|
|
6
|
+
/** id of the input, for its label. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Name submitted with a form. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** The formatted value. Phone is controlled, so store the value passed to `onChange` and pass it back. */
|
|
11
|
+
value: string;
|
|
12
|
+
/** Called with the formatted value after each change. */
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Country used for numbers typed without a leading "+". Numbers with a "+"
|
|
16
|
+
* are formatted for their own country. Defaults to `"US"`.
|
|
17
|
+
*/
|
|
18
|
+
defaultCountry?: PhoneCountryCode;
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AriaAttributes, HTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
2
|
+
/** The side of the trigger a floating panel prefers. It flips when there is not enough room. */
|
|
3
|
+
export type PopoverSide = "top" | "bottom";
|
|
4
|
+
/** How a floating panel lines up with its trigger. `"start"` follows the reading direction. */
|
|
5
|
+
export type PopoverAlign = "start" | "center" | "end";
|
|
6
|
+
export type PopoverProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "content" | "role"> & {
|
|
7
|
+
/**
|
|
8
|
+
* The trigger, such as a `Button`. It receives `onClick`, `aria-expanded`,
|
|
9
|
+
* `aria-haspopup`, and `aria-controls`, and must pass them to its element.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactElement<PopoverTriggerProps>;
|
|
12
|
+
/** Content of the panel. */
|
|
13
|
+
content: ReactNode;
|
|
14
|
+
/** Accessible name of the panel. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Whether the panel is open, when the consuming application controls it. Use it with `onOpenChange`. */
|
|
17
|
+
open?: boolean;
|
|
18
|
+
/** Whether the panel starts open, when it keeps its own state. Defaults to `false`. */
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
/** Called when the panel opens or closes. */
|
|
21
|
+
onOpenChange?: (open: boolean) => void;
|
|
22
|
+
/** Side of the trigger the panel prefers. Defaults to `"bottom"`. */
|
|
23
|
+
side?: PopoverSide;
|
|
24
|
+
/** How the panel lines up with the trigger. Defaults to `"start"`. */
|
|
25
|
+
align?: PopoverAlign;
|
|
26
|
+
};
|
|
27
|
+
export type PopoverTriggerProps = Pick<AriaAttributes, "aria-expanded" | "aria-haspopup" | "aria-controls" | "aria-describedby"> & {
|
|
28
|
+
id?: string;
|
|
29
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
30
|
+
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
31
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type ProgressVariant = "bar" | "circle";
|
|
3
|
+
export type ProgressSize = "small" | "medium" | "large";
|
|
4
|
+
export type ProgressProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "role"> & {
|
|
5
|
+
/** Name of the task, such as "Uploading report.pdf". It names the progress bar. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Hides the label visually. It still names the progress bar. Defaults to `false`. */
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
/** Amount done, from 0 to `max`. Leave it undefined while the amount is unknown, which shows an indeterminate animation. */
|
|
10
|
+
value?: number;
|
|
11
|
+
/** Value at which the task is complete. Defaults to `100`. */
|
|
12
|
+
max?: number;
|
|
13
|
+
/** Shows the value as text. Defaults to `false`. */
|
|
14
|
+
showValue?: boolean;
|
|
15
|
+
/** Returns the text shown and announced for a value. Defaults to a percentage, such as "40%". */
|
|
16
|
+
getValueText?: (value: number, max: number) => string;
|
|
17
|
+
/** A horizontal bar or a circle. Defaults to `"bar"`. */
|
|
18
|
+
variant?: ProgressVariant;
|
|
19
|
+
/** Bar thickness, or circle diameter. Defaults to `"medium"`. */
|
|
20
|
+
size?: ProgressSize;
|
|
21
|
+
};
|