@krelborn/stylesui 0.0.0-stage → 0.8.1
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/LICENSE +74 -0
- package/README.md +129 -2
- package/dist/accessibility/RequiredAccessibleName.d.ts +26 -0
- package/dist/accessibility/idSegment.d.ts +7 -0
- package/dist/accessibility/idSegment.js +6 -0
- package/dist/accessibility/index.d.ts +2 -0
- package/dist/collections/index.d.ts +4 -0
- package/dist/collections/targetIndexForKey.d.ts +45 -0
- package/dist/collections/targetIndexForKey.js +17 -0
- package/dist/collections/typeAhead.d.ts +43 -0
- package/dist/collections/typeAhead.js +19 -0
- package/dist/components/Alert/Alert.css +1 -0
- package/dist/components/Alert/Alert.d.ts +47 -0
- package/dist/components/Alert/Alert.js +28 -0
- package/dist/components/Alert/Alert.module.js +9 -0
- package/dist/components/Alert/AlertIcon.d.ts +14 -0
- package/dist/components/Alert/AlertIcon.js +43 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.css +1 -0
- package/dist/components/Avatar/Avatar.d.ts +33 -0
- package/dist/components/Avatar/Avatar.js +27 -0
- package/dist/components/Avatar/Avatar.module.js +7 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/initialsOf.d.ts +9 -0
- package/dist/components/Avatar/initialsOf.js +10 -0
- package/dist/components/AvatarGroup/AvatarGroup.css +1 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +30 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +34 -0
- package/dist/components/AvatarGroup/AvatarGroup.module.js +7 -0
- package/dist/components/AvatarGroup/index.d.ts +2 -0
- package/dist/components/Badge/Badge.css +1 -0
- package/dist/components/Badge/Badge.d.ts +36 -0
- package/dist/components/Badge/Badge.js +16 -0
- package/dist/components/Badge/Badge.module.js +4 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Box/Box.css +1 -0
- package/dist/components/Box/Box.d.ts +31 -0
- package/dist/components/Box/Box.js +18 -0
- package/dist/components/Box/Box.module.js +4 -0
- package/dist/components/Box/index.d.ts +2 -0
- package/dist/components/Button/Button.css +1 -0
- package/dist/components/Button/Button.d.ts +42 -0
- package/dist/components/Button/Button.js +29 -0
- package/dist/components/Button/Button.module.js +7 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Card/Card.css +1 -0
- package/dist/components/Card/Card.d.ts +24 -0
- package/dist/components/Card/Card.js +15 -0
- package/dist/components/Card/Card.module.js +4 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Center/Center.css +1 -0
- package/dist/components/Center/Center.d.ts +34 -0
- package/dist/components/Center/Center.js +20 -0
- package/dist/components/Center/Center.module.js +4 -0
- package/dist/components/Center/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +23 -0
- package/dist/components/Checkbox/Checkbox.js +13 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/ChoiceControl/ChoiceControl.css +1 -0
- package/dist/components/ChoiceControl/ChoiceControl.d.ts +21 -0
- package/dist/components/ChoiceControl/ChoiceControl.js +40 -0
- package/dist/components/ChoiceControl/ChoiceControl.module.js +9 -0
- package/dist/components/ChoiceControl/index.d.ts +1 -0
- package/dist/components/Cluster/Cluster.d.ts +29 -0
- package/dist/components/Cluster/Cluster.js +14 -0
- package/dist/components/Cluster/index.d.ts +2 -0
- package/dist/components/Code/Code.css +1 -0
- package/dist/components/Code/Code.d.ts +13 -0
- package/dist/components/Code/Code.js +20 -0
- package/dist/components/Code/Code.module.js +4 -0
- package/dist/components/Code/index.d.ts +2 -0
- package/dist/components/Counter/Counter.css +1 -0
- package/dist/components/Counter/Counter.d.ts +39 -0
- package/dist/components/Counter/Counter.js +19 -0
- package/dist/components/Counter/Counter.module.js +4 -0
- package/dist/components/Counter/index.d.ts +2 -0
- package/dist/components/Cover/Cover.css +1 -0
- package/dist/components/Cover/Cover.d.ts +40 -0
- package/dist/components/Cover/Cover.js +30 -0
- package/dist/components/Cover/Cover.module.js +7 -0
- package/dist/components/Cover/index.d.ts +2 -0
- package/dist/components/Divider/Divider.css +1 -0
- package/dist/components/Divider/Divider.d.ts +25 -0
- package/dist/components/Divider/Divider.js +16 -0
- package/dist/components/Divider/Divider.module.js +4 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Field/Field.css +1 -0
- package/dist/components/Field/Field.d.ts +49 -0
- package/dist/components/Field/Field.js +48 -0
- package/dist/components/Field/Field.module.js +9 -0
- package/dist/components/Field/index.d.ts +2 -0
- package/dist/components/Fieldset/Fieldset.css +1 -0
- package/dist/components/Fieldset/Fieldset.d.ts +35 -0
- package/dist/components/Fieldset/Fieldset.js +65 -0
- package/dist/components/Fieldset/Fieldset.module.js +9 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Frame/Frame.css +1 -0
- package/dist/components/Frame/Frame.d.ts +23 -0
- package/dist/components/Frame/Frame.js +17 -0
- package/dist/components/Frame/Frame.module.js +4 -0
- package/dist/components/Frame/index.d.ts +2 -0
- package/dist/components/Grid/Grid.css +1 -0
- package/dist/components/Grid/Grid.d.ts +25 -0
- package/dist/components/Grid/Grid.js +23 -0
- package/dist/components/Grid/Grid.module.js +4 -0
- package/dist/components/Grid/index.d.ts +2 -0
- package/dist/components/Heading/Heading.css +1 -0
- package/dist/components/Heading/Heading.d.ts +39 -0
- package/dist/components/Heading/Heading.js +24 -0
- package/dist/components/Heading/Heading.module.js +4 -0
- package/dist/components/Heading/index.d.ts +2 -0
- package/dist/components/HorizontalFlow/HorizontalFlow.css +1 -0
- package/dist/components/HorizontalFlow/HorizontalFlow.d.ts +30 -0
- package/dist/components/HorizontalFlow/HorizontalFlow.js +31 -0
- package/dist/components/HorizontalFlow/HorizontalFlow.module.js +4 -0
- package/dist/components/HorizontalFlow/index.d.ts +2 -0
- package/dist/components/Icon/AddIcon.d.ts +11 -0
- package/dist/components/Icon/AddIcon.js +22 -0
- package/dist/components/Icon/ChevronDownIcon.d.ts +11 -0
- package/dist/components/Icon/ChevronDownIcon.js +19 -0
- package/dist/components/Icon/CloseIcon.d.ts +12 -0
- package/dist/components/Icon/CloseIcon.js +22 -0
- package/dist/components/Icon/ColorModeIcon.d.ts +12 -0
- package/dist/components/Icon/ColorModeIcon.js +37 -0
- package/dist/components/Icon/DeleteIcon.d.ts +11 -0
- package/dist/components/Icon/DeleteIcon.js +37 -0
- package/dist/components/Icon/Icon.css +1 -0
- package/dist/components/Icon/Icon.d.ts +40 -0
- package/dist/components/Icon/Icon.js +28 -0
- package/dist/components/Icon/Icon.module.js +7 -0
- package/dist/components/Icon/InfoIcon.d.ts +11 -0
- package/dist/components/Icon/InfoIcon.js +31 -0
- package/dist/components/Icon/MoreHorizontalIcon.d.ts +11 -0
- package/dist/components/Icon/MoreHorizontalIcon.js +35 -0
- package/dist/components/Icon/MoreVerticalIcon.d.ts +11 -0
- package/dist/components/Icon/MoreVerticalIcon.js +35 -0
- package/dist/components/Icon/PaletteIcon.d.ts +12 -0
- package/dist/components/Icon/PaletteIcon.js +49 -0
- package/dist/components/Icon/RefreshIcon.d.ts +13 -0
- package/dist/components/Icon/RefreshIcon.js +33 -0
- package/dist/components/Icon/RemoveIcon.d.ts +11 -0
- package/dist/components/Icon/RemoveIcon.js +19 -0
- package/dist/components/Icon/SendIcon.d.ts +11 -0
- package/dist/components/Icon/SendIcon.js +23 -0
- package/dist/components/Icon/index.d.ts +13 -0
- package/dist/components/IconButton/IconButton.css +1 -0
- package/dist/components/IconButton/IconButton.d.ts +45 -0
- package/dist/components/IconButton/IconButton.js +41 -0
- package/dist/components/IconButton/IconButton.module.js +8 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/Kbd/Kbd.css +1 -0
- package/dist/components/Kbd/Kbd.d.ts +13 -0
- package/dist/components/Kbd/Kbd.js +20 -0
- package/dist/components/Kbd/Kbd.module.js +4 -0
- package/dist/components/Kbd/index.d.ts +2 -0
- package/dist/components/Link/Link.css +1 -0
- package/dist/components/Link/Link.d.ts +52 -0
- package/dist/components/Link/Link.js +27 -0
- package/dist/components/Link/Link.module.js +4 -0
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/Listbox/Listbox.css +1 -0
- package/dist/components/Listbox/Listbox.d.ts +46 -0
- package/dist/components/Listbox/Listbox.js +56 -0
- package/dist/components/Listbox/Listbox.module.js +7 -0
- package/dist/components/Listbox/ListboxContext.d.ts +38 -0
- package/dist/components/Listbox/ListboxContext.js +5 -0
- package/dist/components/Listbox/ListboxOption.d.ts +31 -0
- package/dist/components/Listbox/ListboxOption.js +43 -0
- package/dist/components/Listbox/index.d.ts +4 -0
- package/dist/components/Listbox/optionId.d.ts +8 -0
- package/dist/components/Listbox/optionId.js +7 -0
- package/dist/components/Listbox/renderedOptions.d.ts +30 -0
- package/dist/components/Listbox/renderedOptions.js +15 -0
- package/dist/components/Listbox/useListbox.d.ts +54 -0
- package/dist/components/Listbox/useListbox.js +104 -0
- package/dist/components/Listbox/useListboxContext.d.ts +9 -0
- package/dist/components/Listbox/useListboxContext.js +11 -0
- package/dist/components/NavList/NavList.css +1 -0
- package/dist/components/NavList/NavList.d.ts +20 -0
- package/dist/components/NavList/NavList.js +28 -0
- package/dist/components/NavList/NavList.module.js +12 -0
- package/dist/components/NavList/NavListGroup.d.ts +25 -0
- package/dist/components/NavList/NavListGroup.js +40 -0
- package/dist/components/NavList/NavListItem.d.ts +53 -0
- package/dist/components/NavList/NavListItem.js +57 -0
- package/dist/components/NavList/index.d.ts +6 -0
- package/dist/components/Overlay/Overlay.css +1 -0
- package/dist/components/Overlay/Overlay.d.ts +33 -0
- package/dist/components/Overlay/Overlay.js +36 -0
- package/dist/components/Overlay/Overlay.module.js +4 -0
- package/dist/components/Overlay/index.d.ts +1 -0
- package/dist/components/PageLayout/PageLayout.css +1 -0
- package/dist/components/PageLayout/PageLayout.d.ts +26 -0
- package/dist/components/PageLayout/PageLayout.js +18 -0
- package/dist/components/PageLayout/PageLayout.module.js +4 -0
- package/dist/components/PageLayout/index.d.ts +2 -0
- package/dist/components/Popover/Popover.css +1 -0
- package/dist/components/Popover/Popover.d.ts +52 -0
- package/dist/components/Popover/Popover.js +21 -0
- package/dist/components/Popover/Popover.module.js +4 -0
- package/dist/components/Popover/index.d.ts +4 -0
- package/dist/components/Popover/usePopover.d.ts +96 -0
- package/dist/components/Popover/usePopover.js +66 -0
- package/dist/components/Prose/Prose.css +1 -0
- package/dist/components/Prose/Prose.d.ts +50 -0
- package/dist/components/Prose/Prose.js +16 -0
- package/dist/components/Prose/Prose.module.js +4 -0
- package/dist/components/Prose/index.d.ts +2 -0
- package/dist/components/Radio/Radio.d.ts +29 -0
- package/dist/components/Radio/Radio.js +24 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/RadioGroup/RadioGroup.css +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +58 -0
- package/dist/components/RadioGroup/RadioGroup.js +37 -0
- package/dist/components/RadioGroup/RadioGroup.module.js +4 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/RequiredIndicator/RequiredIndicator.css +1 -0
- package/dist/components/RequiredIndicator/RequiredIndicator.d.ts +6 -0
- package/dist/components/RequiredIndicator/RequiredIndicator.js +16 -0
- package/dist/components/RequiredIndicator/RequiredIndicator.module.js +4 -0
- package/dist/components/RequiredIndicator/index.d.ts +1 -0
- package/dist/components/Row/Row.d.ts +29 -0
- package/dist/components/Row/Row.js +14 -0
- package/dist/components/Row/index.d.ts +2 -0
- package/dist/components/SegmentedControl/Segment.d.ts +24 -0
- package/dist/components/SegmentedControl/Segment.js +42 -0
- package/dist/components/SegmentedControl/SegmentedControl.css +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +25 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +20 -0
- package/dist/components/SegmentedControl/SegmentedControl.module.js +10 -0
- package/dist/components/SegmentedControl/index.d.ts +4 -0
- package/dist/components/Select/Select.d.ts +27 -0
- package/dist/components/Select/Select.js +12 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.css +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +42 -0
- package/dist/components/Sidebar/Sidebar.js +24 -0
- package/dist/components/Sidebar/Sidebar.module.js +4 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/SkipLink/SkipLink.css +1 -0
- package/dist/components/SkipLink/SkipLink.d.ts +20 -0
- package/dist/components/SkipLink/SkipLink.js +21 -0
- package/dist/components/SkipLink/SkipLink.module.js +4 -0
- package/dist/components/SkipLink/index.d.ts +2 -0
- package/dist/components/Spinner/Spinner.css +1 -0
- package/dist/components/Spinner/Spinner.d.ts +13 -0
- package/dist/components/Spinner/Spinner.js +33 -0
- package/dist/components/Spinner/Spinner.module.js +8 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Stack/Stack.css +1 -0
- package/dist/components/Stack/Stack.d.ts +25 -0
- package/dist/components/Stack/Stack.js +21 -0
- package/dist/components/Stack/Stack.module.js +4 -0
- package/dist/components/Stack/index.d.ts +2 -0
- package/dist/components/StatusDot/StatusDot.css +1 -0
- package/dist/components/StatusDot/StatusDot.d.ts +57 -0
- package/dist/components/StatusDot/StatusDot.js +21 -0
- package/dist/components/StatusDot/StatusDot.module.js +4 -0
- package/dist/components/StatusDot/index.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +24 -0
- package/dist/components/Switch/Switch.js +13 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switcher/Switcher.css +1 -0
- package/dist/components/Switcher/Switcher.d.ts +27 -0
- package/dist/components/Switcher/Switcher.js +23 -0
- package/dist/components/Switcher/Switcher.module.js +4 -0
- package/dist/components/Switcher/index.d.ts +2 -0
- package/dist/components/Tabs/Tab.d.ts +26 -0
- package/dist/components/Tabs/Tab.js +61 -0
- package/dist/components/Tabs/TabList.d.ts +16 -0
- package/dist/components/Tabs/TabList.js +23 -0
- package/dist/components/Tabs/TabPanel.d.ts +24 -0
- package/dist/components/Tabs/TabPanel.js +22 -0
- package/dist/components/Tabs/Tabs.css +1 -0
- package/dist/components/Tabs/Tabs.d.ts +81 -0
- package/dist/components/Tabs/Tabs.js +31 -0
- package/dist/components/Tabs/Tabs.module.js +9 -0
- package/dist/components/Tabs/TabsContext.d.ts +39 -0
- package/dist/components/Tabs/TabsContext.js +5 -0
- package/dist/components/Tabs/index.d.ts +8 -0
- package/dist/components/Tabs/tabIds.d.ts +16 -0
- package/dist/components/Tabs/tabIds.js +10 -0
- package/dist/components/Tabs/useTabsContext.d.ts +9 -0
- package/dist/components/Tabs/useTabsContext.js +11 -0
- package/dist/components/Text/Text.css +1 -0
- package/dist/components/Text/Text.d.ts +40 -0
- package/dist/components/Text/Text.js +17 -0
- package/dist/components/Text/Text.module.js +4 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/TextControl/TextControl.css +1 -0
- package/dist/components/TextControl/TextControl.d.ts +22 -0
- package/dist/components/TextControl/TextControl.js +23 -0
- package/dist/components/TextControl/TextControl.module.js +4 -0
- package/dist/components/TextControl/index.d.ts +1 -0
- package/dist/components/TextInput/TextInput.d.ts +31 -0
- package/dist/components/TextInput/TextInput.js +13 -0
- package/dist/components/TextInput/index.d.ts +2 -0
- package/dist/components/Textarea/Textarea.d.ts +24 -0
- package/dist/components/Textarea/Textarea.js +12 -0
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/Theme/Theme.d.ts +46 -0
- package/dist/components/Theme/Theme.js +18 -0
- package/dist/components/Theme/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.css +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +49 -0
- package/dist/components/Tooltip/Tooltip.js +22 -0
- package/dist/components/Tooltip/Tooltip.module.js +4 -0
- package/dist/components/Tooltip/index.d.ts +4 -0
- package/dist/components/Tooltip/tooltipCoordinator.d.ts +14 -0
- package/dist/components/Tooltip/tooltipCoordinator.js +17 -0
- package/dist/components/Tooltip/useTooltip.d.ts +119 -0
- package/dist/components/Tooltip/useTooltip.js +74 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.css +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +14 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +20 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.module.js +4 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/errors/MissingContextError.d.ts +11 -0
- package/dist/errors/MissingContextError.js +9 -0
- package/dist/errors/PopoverRefusedError.d.ts +12 -0
- package/dist/errors/PopoverRefusedError.js +9 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/forms/ControlSize.d.ts +4 -0
- package/dist/forms/FieldContext.d.ts +29 -0
- package/dist/forms/FieldContext.js +5 -0
- package/dist/forms/RadioGroupContext.d.ts +34 -0
- package/dist/forms/RadioGroupContext.js +5 -0
- package/dist/forms/hasContent.d.ts +10 -0
- package/dist/forms/hasContent.js +7 -0
- package/dist/forms/index.d.ts +8 -0
- package/dist/forms/useFieldControl.d.ts +36 -0
- package/dist/forms/useFieldControl.js +29 -0
- package/dist/forms/useRadioGroupItem.d.ts +50 -0
- package/dist/forms/useRadioGroupItem.js +27 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.js +67 -0
- package/dist/layout/Space.d.ts +4 -0
- package/dist/layout/alignment.d.ts +8 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/layout/listRole.d.ts +11 -0
- package/dist/layout/listRole.js +6 -0
- package/dist/layout/spaceValue.d.ts +8 -0
- package/dist/layout/spaceValue.js +6 -0
- package/dist/layout/withCustomProperties.d.ts +9 -0
- package/dist/layout/withCustomProperties.js +9 -0
- package/dist/overlays/OverlayDelay.d.ts +13 -0
- package/dist/overlays/OverlayPlacement.d.ts +6 -0
- package/dist/overlays/anchorNameFor.d.ts +7 -0
- package/dist/overlays/anchorNameFor.js +6 -0
- package/dist/overlays/index.d.ts +6 -0
- package/dist/overlays/mergeProps.d.ts +13 -0
- package/dist/overlays/mergeProps.js +30 -0
- package/dist/overlays/syncPopover.d.ts +11 -0
- package/dist/overlays/syncPopover.js +25 -0
- package/dist/overlays/useOverlay.d.ts +71 -0
- package/dist/overlays/useOverlay.js +56 -0
- package/dist/styles.css +1 -0
- package/fonts/playful.css +3 -0
- package/package.json +103 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { BoxProps } from "../Box";
|
|
3
|
+
/**
|
|
4
|
+
* Props for `Tab`: its own props plus every native button prop except `hidden`, `inert` and those the tab pattern sets
|
|
5
|
+
*/
|
|
6
|
+
export interface TabProps extends Omit<BoxProps<"button">, "aria-controls" | "aria-disabled" | "aria-selected" | "as" | "disabled" | "hidden" | "id" | "inert" | "role" | "tabIndex" | "type" | "value"> {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the tab cannot be selected. A disabled tab stays reachable with the arrow keys, so its label is read, but
|
|
9
|
+
* focus and clicks never select it. Defaults to `false`.
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The value this tab stands for, matching one `TabPanel`'s `value`
|
|
14
|
+
*/
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One tab in a `TabList`. The arrow keys move between tabs, wrapping at both ends, and Home and End go to the first
|
|
19
|
+
* and last. Your `onBlur`, `onClick`, `onFocus`, `onKeyDown`, `onPointerCancel` and `onPointerDown` run first;
|
|
20
|
+
* preventing a click's or key's default stops the tab handling it. A disabled tab ignores clicks, so your `onClick`
|
|
21
|
+
* does not run for it. To leave a tab out, do not render it: a hidden selected tab would leave the list no tab stop.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <Tab value="issues">Issues</Tab>
|
|
25
|
+
*/
|
|
26
|
+
export declare function Tab({ className, disabled, onBlur, onClick, onFocus, onKeyDown, onPointerCancel, onPointerDown, value, ...rest }: TabProps): JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import { targetIndexForKey as t } from "../../collections/targetIndexForKey.js";
|
|
3
|
+
import { panelId as n, tabId as r } from "./tabIds.js";
|
|
4
|
+
import i from "./Tabs.module.js";
|
|
5
|
+
import { useTabsContext as a } from "./useTabsContext.js";
|
|
6
|
+
import { clsx as o } from "clsx";
|
|
7
|
+
import { useRef as s } from "react";
|
|
8
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/Tabs/Tab.tsx
|
|
10
|
+
function l({ className: l, disabled: u = !1, onBlur: d, onClick: f, onFocus: p, onKeyDown: m, onPointerCancel: h, onPointerDown: g, value: _, ...v }) {
|
|
11
|
+
let y = a("Tab"), b = y.selectedValue === _, x = s(!1);
|
|
12
|
+
function S(e) {
|
|
13
|
+
d?.(e), x.current = !1;
|
|
14
|
+
}
|
|
15
|
+
function C(e) {
|
|
16
|
+
x.current = !1, !u && (f?.(e), e.defaultPrevented || y.select(_));
|
|
17
|
+
}
|
|
18
|
+
function w(e) {
|
|
19
|
+
p?.(e), y.activation === "automatic" && !u && !x.current && y.select(_);
|
|
20
|
+
}
|
|
21
|
+
function T(e) {
|
|
22
|
+
if (m?.(e), e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
23
|
+
let n = Array.from(e.currentTarget.closest("[role=\"tablist\"]")?.querySelectorAll("[role=\"tab\"]") ?? []).filter((e) => e.closest("[hidden], [inert]") === null), r = t({
|
|
24
|
+
count: n.length,
|
|
25
|
+
currentIndex: n.indexOf(e.currentTarget),
|
|
26
|
+
direction: e.currentTarget.matches(":dir(rtl)") ? "rtl" : "ltr",
|
|
27
|
+
key: e.key,
|
|
28
|
+
orientation: y.orientation,
|
|
29
|
+
wraps: !0
|
|
30
|
+
});
|
|
31
|
+
r !== null && (e.preventDefault(), n[r].focus());
|
|
32
|
+
}
|
|
33
|
+
function E(e) {
|
|
34
|
+
h?.(e), x.current = !1;
|
|
35
|
+
}
|
|
36
|
+
function D(e) {
|
|
37
|
+
g?.(e), x.current = !0;
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ c(e, {
|
|
40
|
+
...v,
|
|
41
|
+
as: "button",
|
|
42
|
+
className: o(i.tab, l),
|
|
43
|
+
id: r(y.baseId, _),
|
|
44
|
+
onBlur: S,
|
|
45
|
+
onClick: C,
|
|
46
|
+
onFocus: w,
|
|
47
|
+
onKeyDown: T,
|
|
48
|
+
onPointerCancel: E,
|
|
49
|
+
onPointerDown: D,
|
|
50
|
+
role: "tab",
|
|
51
|
+
tabIndex: b ? 0 : -1,
|
|
52
|
+
type: "button",
|
|
53
|
+
"aria-controls": n(y.baseId, _),
|
|
54
|
+
"aria-disabled": u ? !0 : void 0,
|
|
55
|
+
"aria-selected": b,
|
|
56
|
+
"data-size": y.size,
|
|
57
|
+
"data-variant": y.variant
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { l as Tab };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { RequiredAccessibleName } from "../../accessibility";
|
|
3
|
+
import type { BoxProps } from "../Box";
|
|
4
|
+
/**
|
|
5
|
+
* Props for `TabList`: a required `aria-label` or `aria-labelledby` and every other `div` prop except `role`
|
|
6
|
+
*/
|
|
7
|
+
export type TabListProps = RequiredAccessibleName & Omit<BoxProps<"div">, "aria-label" | "aria-labelledby" | "aria-orientation" | "as" | "role">;
|
|
8
|
+
/**
|
|
9
|
+
* The row or column of `Tab`s inside `Tabs`. Name it with `aria-label` or `aria-labelledby`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <TabList aria-label="Repository">
|
|
13
|
+
* <Tab value="code">Code</Tab>
|
|
14
|
+
* </TabList>
|
|
15
|
+
*/
|
|
16
|
+
export declare function TabList({ className, ...rest }: TabListProps): JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import t from "./Tabs.module.js";
|
|
3
|
+
import { useTabsContext as n } from "./useTabsContext.js";
|
|
4
|
+
import { clsx as r } from "clsx";
|
|
5
|
+
import { c as i } from "react/compiler-runtime";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/Tabs/TabList.tsx
|
|
8
|
+
function o(o) {
|
|
9
|
+
let s = i(10), c, l;
|
|
10
|
+
s[0] === o ? (c = s[1], l = s[2]) : ({className: c, ...l} = o, s[0] = o, s[1] = c, s[2] = l);
|
|
11
|
+
let u = n("TabList"), d;
|
|
12
|
+
s[3] === c ? d = s[4] : (d = r(t.tabList, c), s[3] = c, s[4] = d);
|
|
13
|
+
let f = u.orientation === "vertical" ? "vertical" : void 0, p;
|
|
14
|
+
return s[5] !== l || s[6] !== d || s[7] !== f || s[8] !== u.variant ? (p = /* @__PURE__ */ a(e, {
|
|
15
|
+
...l,
|
|
16
|
+
className: d,
|
|
17
|
+
role: "tablist",
|
|
18
|
+
"aria-orientation": f,
|
|
19
|
+
"data-variant": u.variant
|
|
20
|
+
}), s[5] = l, s[6] = d, s[7] = f, s[8] = u.variant, s[9] = p) : p = s[9], p;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { o as TabList };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { BoxProps } from "../Box";
|
|
3
|
+
/**
|
|
4
|
+
* Props for `TabPanel`: its own props plus every `div` prop except those the tab pattern sets
|
|
5
|
+
*/
|
|
6
|
+
export interface TabPanelProps extends Omit<BoxProps<"div">, "aria-labelledby" | "as" | "hidden" | "id" | "role"> {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the panel is in the tab order. Keep the default, 0, when the panel starts with text, and pass -1 when its
|
|
9
|
+
* first content is a control that takes focus itself.
|
|
10
|
+
*/
|
|
11
|
+
tabIndex?: number;
|
|
12
|
+
/**
|
|
13
|
+
* The value of the `Tab` that shows this panel
|
|
14
|
+
*/
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The content shown while its `Tab` is selected. It is named by its tab, and renders its children only while
|
|
19
|
+
* selected, so a panel's content mounts when its tab is selected.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <TabPanel value="issues">…</TabPanel>
|
|
23
|
+
*/
|
|
24
|
+
export declare function TabPanel({ children, className, tabIndex, value, ...rest }: TabPanelProps): JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import { panelId as t, tabId as n } from "./tabIds.js";
|
|
3
|
+
import r from "./Tabs.module.js";
|
|
4
|
+
import { useTabsContext as i } from "./useTabsContext.js";
|
|
5
|
+
import { clsx as a } from "clsx";
|
|
6
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/Tabs/TabPanel.tsx
|
|
8
|
+
function s({ children: s, className: c, tabIndex: l = 0, value: u, ...d }) {
|
|
9
|
+
let f = i("TabPanel"), p = f.selectedValue === u;
|
|
10
|
+
return /* @__PURE__ */ o(e, {
|
|
11
|
+
...d,
|
|
12
|
+
className: a(r.tabPanel, c),
|
|
13
|
+
hidden: !p,
|
|
14
|
+
id: t(f.baseId, u),
|
|
15
|
+
role: "tabpanel",
|
|
16
|
+
tabIndex: l,
|
|
17
|
+
"aria-labelledby": n(f.baseId, u),
|
|
18
|
+
children: p ? s : null
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { s as TabPanel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-tabs-QzIkz{gap:var(--sui-space-3,.75rem);flex-direction:column;display:flex}.sui-tabs-QzIkz[data-orientation=vertical]{flex-direction:row;align-items:flex-start}.sui-tabList-yw6gS{gap:var(--sui-space-1,.25rem);flex-wrap:wrap;display:flex}.sui-tabList-yw6gS[aria-orientation=vertical]{flex-flow:column;flex:none}.sui-tabList-yw6gS[data-variant=underline]{border-block-end:var(--sui-border-width,1px) solid var(--sui-color-border,#d1d5db)}.sui-tabList-yw6gS[data-variant=underline][aria-orientation=vertical]{border-block-end:0;border-inline-end:var(--sui-border-width,1px) solid var(--sui-color-border,#d1d5db)}.sui-tab-IdDYc{--sui-tab-padding-x:var(--sui-space-4,1rem);--sui-tab-padding-y:var(--sui-space-2,.5rem);--sui-tab-font-size:var(--sui-font-size-md,1rem);--sui-tab-indicator:calc(var(--sui-border-width,1px) * 2);--sui-tab-spring:var(--sui-motion-spring,.12s ease-out);padding:var(--sui-tab-padding-y) var(--sui-tab-padding-x);border:var(--sui-border-width,1px) solid transparent;color:var(--sui-color-text-muted,#4b5563);font-family:var(--sui-font-body,system-ui, sans-serif);font-size:var(--sui-tab-font-size);font-weight:var(--sui-font-weight-control,500);line-height:var(--sui-line-height-tight,1.25);cursor:pointer;background-color:#0000;justify-content:center;align-items:center;transition:background-color .12s,border-color .12s,color .12s,box-shadow .12s ease-out,transform .12s ease-out;display:inline-flex;position:relative}.sui-tab-IdDYc[data-size=sm]{--sui-tab-padding-x:var(--sui-space-3,.75rem);--sui-tab-padding-y:var(--sui-space-1,.25rem);--sui-tab-font-size:var(--sui-font-size-sm,.875rem)}.sui-tab-IdDYc[data-size=lg]{--sui-tab-padding-x:var(--sui-space-6,1.5rem);--sui-tab-padding-y:var(--sui-space-3,.75rem);--sui-tab-font-size:var(--sui-font-size-lg,1.125rem)}.sui-tab-IdDYc:hover:not([aria-disabled=true]),.sui-tab-IdDYc[aria-selected=true]{color:var(--sui-color-text,#111827)}.sui-tab-IdDYc[data-variant=underline]:after{block-size:var(--sui-tab-indicator);background-color:var(--sui-color-primary,#2563eb);content:"";transition:transform .12s ease-out;position:absolute;inset-block-end:calc(var(--sui-border-width,1px) * -2);inset-inline:0;transform:scale(0)}.sui-tabList-yw6gS[aria-orientation=vertical] .sui-tab-IdDYc[data-variant=underline]:after{inset-block:0;inset-inline:auto calc(var(--sui-border-width,1px) * -2);inline-size:var(--sui-tab-indicator);block-size:auto}.sui-tab-IdDYc[data-variant=underline][aria-selected=true]:after{transition:transform var(--sui-tab-spring);transform:scale(1)}.sui-tab-IdDYc[data-variant=pill]{border-radius:var(--sui-radius-control,4px)}.sui-tab-IdDYc[data-variant=pill]:hover:not([aria-disabled=true],[aria-selected=true]){background-color:var(--sui-color-secondary-subtle,#f3f4f6)}.sui-tab-IdDYc[data-variant=pill][aria-selected=true]{border-color:var(--sui-color-control-border,transparent);background-color:var(--sui-color-primary,#2563eb);box-shadow:0 var(--sui-control-depth,0px) 0 var(--sui-color-shadow,transparent);color:var(--sui-color-on-primary,#fff);transform:translateY(calc(var(--sui-control-depth,0px) / -2));transition:background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow var(--sui-tab-spring), transform var(--sui-tab-spring)}.sui-tab-IdDYc[aria-disabled=true]{color:color-mix(in srgb, var(--sui-color-text-muted,#4b5563) 50%, transparent);cursor:not-allowed}.sui-tab-IdDYc:focus-visible,.sui-tabPanel-eAxHF:focus-visible{outline:var(--sui-focus-ring-width,2px) solid var(--sui-color-focus-ring,#3b82f6);outline-offset:2px}.sui-tabPanel-eAxHF{flex:1;min-inline-size:0}.sui-tabPanel-eAxHF[hidden]{display:none}@media (prefers-reduced-motion:reduce){.sui-tab-IdDYc,.sui-tab-IdDYc[data-variant=pill][aria-selected=true]{transition:background-color .12s,border-color .12s,color .12s}.sui-tab-IdDYc[data-variant=underline]:after,.sui-tab-IdDYc[data-variant=underline][aria-selected=true]:after{transition:none}}@media (forced-colors:active){.sui-tab-IdDYc[data-variant=underline]:after{forced-color-adjust:none;background-color:highlight}.sui-tab-IdDYc[data-variant=pill][aria-selected=true]{box-shadow:none;color:highlighttext;forced-color-adjust:none;background-color:highlight;border-color:highlight}.sui-tab-IdDYc[data-variant=pill][aria-selected=true]:focus-visible{outline-color:highlight}.sui-tab-IdDYc[aria-disabled=true]{color:graytext}}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
|
+
import type { ControlSize } from "../../forms";
|
|
3
|
+
import type { BoxProps } from "../Box";
|
|
4
|
+
/**
|
|
5
|
+
* When a tab is selected: `automatic` as it takes focus, `manual` only when a click, Enter or Space activates it
|
|
6
|
+
*/
|
|
7
|
+
export type TabsActivation = "automatic" | "manual";
|
|
8
|
+
/**
|
|
9
|
+
* Direction the tabs run in: `horizontal` in a row above the panels, `vertical` in a column beside them
|
|
10
|
+
*/
|
|
11
|
+
export type TabsOrientation = "horizontal" | "vertical";
|
|
12
|
+
/**
|
|
13
|
+
* Tab looks: an `underline` under the selected tab, or a `pill` filled with the primary colour
|
|
14
|
+
*/
|
|
15
|
+
export type TabsVariant = "pill" | "underline";
|
|
16
|
+
interface TabsOwnProps {
|
|
17
|
+
/**
|
|
18
|
+
* When a tab is selected. Defaults to `automatic`.
|
|
19
|
+
*/
|
|
20
|
+
activation?: TabsActivation;
|
|
21
|
+
/**
|
|
22
|
+
* One `TabList` and a `TabPanel` for each `Tab`
|
|
23
|
+
*/
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Called with the value of the tab the user selects, when it differs from the selected one
|
|
27
|
+
*/
|
|
28
|
+
onValueChange?: (value: string) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Direction the tabs run in. Defaults to `horizontal`.
|
|
31
|
+
*/
|
|
32
|
+
orientation?: TabsOrientation;
|
|
33
|
+
/**
|
|
34
|
+
* Tab size, matching the `Button` sizes. Defaults to `md`.
|
|
35
|
+
*/
|
|
36
|
+
size?: ControlSize;
|
|
37
|
+
/**
|
|
38
|
+
* Look of the tabs. Defaults to `underline`.
|
|
39
|
+
*/
|
|
40
|
+
variant?: TabsVariant;
|
|
41
|
+
}
|
|
42
|
+
type TabsSelection = {
|
|
43
|
+
/**
|
|
44
|
+
* The tab selected at first. It leaves `Tabs` uncontrolled.
|
|
45
|
+
*/
|
|
46
|
+
defaultValue: string;
|
|
47
|
+
/**
|
|
48
|
+
* Not accepted with `defaultValue`
|
|
49
|
+
*/
|
|
50
|
+
value?: never;
|
|
51
|
+
} | {
|
|
52
|
+
/**
|
|
53
|
+
* Not accepted with `value`
|
|
54
|
+
*/
|
|
55
|
+
defaultValue?: never;
|
|
56
|
+
/**
|
|
57
|
+
* The selected tab, which makes `Tabs` controlled: update it from `onValueChange`
|
|
58
|
+
*/
|
|
59
|
+
value: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Props for `Tabs`: its own props, `value` or `defaultValue`, and every other `div` prop
|
|
63
|
+
*/
|
|
64
|
+
export type TabsProps = TabsOwnProps & TabsSelection & Omit<BoxProps<"div">, "as" | "defaultValue" | keyof TabsOwnProps>;
|
|
65
|
+
/**
|
|
66
|
+
* Tabs that switch between panels of content, following the WAI-ARIA tabs pattern. Give it a `TabList` of `Tab`s and
|
|
67
|
+
* a `TabPanel` for each, matched by `value`. One tab is always selected: pass `defaultValue`, or `value` with
|
|
68
|
+
* `onValueChange`, matching a `Tab`.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* <Tabs defaultValue="code" onValueChange={setTab}>
|
|
72
|
+
* <TabList aria-label="Repository">
|
|
73
|
+
* <Tab value="code">Code</Tab>
|
|
74
|
+
* <Tab value="issues">Issues</Tab>
|
|
75
|
+
* </TabList>
|
|
76
|
+
* <TabPanel value="code">…</TabPanel>
|
|
77
|
+
* <TabPanel value="issues">…</TabPanel>
|
|
78
|
+
* </Tabs>
|
|
79
|
+
*/
|
|
80
|
+
export declare function Tabs({ activation, className, defaultValue, onValueChange, orientation, size, value, variant, ...rest }: TabsProps): JSX.Element;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import t from "./Tabs.module.js";
|
|
3
|
+
import { TabsContext as n } from "./TabsContext.js";
|
|
4
|
+
import { clsx as r } from "clsx";
|
|
5
|
+
import { useId as i, useState as a } from "react";
|
|
6
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/Tabs/Tabs.tsx
|
|
8
|
+
function s({ activation: s = "automatic", className: c, defaultValue: l, onValueChange: u, orientation: d = "horizontal", size: f = "md", value: p, variant: m = "underline", ...h }) {
|
|
9
|
+
let g = i(), [_, v] = a(l), y = p ?? _;
|
|
10
|
+
function b(e) {
|
|
11
|
+
e !== y && (p === void 0 && v(e), u?.(e));
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ o(n.Provider, {
|
|
14
|
+
value: {
|
|
15
|
+
activation: s,
|
|
16
|
+
baseId: g,
|
|
17
|
+
orientation: d,
|
|
18
|
+
select: b,
|
|
19
|
+
selectedValue: y,
|
|
20
|
+
size: f,
|
|
21
|
+
variant: m
|
|
22
|
+
},
|
|
23
|
+
children: /* @__PURE__ */ o(e, {
|
|
24
|
+
...h,
|
|
25
|
+
className: r(t.tabs, c),
|
|
26
|
+
"data-orientation": d
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { s as Tabs };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './Tabs.css';//#region src/components/Tabs/Tabs.module.css
|
|
2
|
+
var e = "sui-tabs-QzIkz", t = "sui-tabList-yw6gS", n = "sui-tab-IdDYc", r = "sui-tabPanel-eAxHF", i = {
|
|
3
|
+
tabs: e,
|
|
4
|
+
tabList: t,
|
|
5
|
+
tab: n,
|
|
6
|
+
tabPanel: r
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { i as default, n as tab, t as tabList, r as tabPanel, e as tabs };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ControlSize } from "../../forms";
|
|
2
|
+
import type { TabsActivation, TabsOrientation, TabsVariant } from "./Tabs";
|
|
3
|
+
/**
|
|
4
|
+
* State a `Tabs` shares with its tab list, tabs and panels
|
|
5
|
+
*/
|
|
6
|
+
export interface TabsContextValue {
|
|
7
|
+
/**
|
|
8
|
+
* Whether a tab is selected as it takes focus, or only when it is pressed
|
|
9
|
+
*/
|
|
10
|
+
activation: TabsActivation;
|
|
11
|
+
/**
|
|
12
|
+
* The generated id every tab and panel id starts with
|
|
13
|
+
*/
|
|
14
|
+
baseId: string;
|
|
15
|
+
/**
|
|
16
|
+
* Direction the tabs run in, which decides the arrow keys
|
|
17
|
+
*/
|
|
18
|
+
orientation: TabsOrientation;
|
|
19
|
+
/**
|
|
20
|
+
* Selects the tab with the given value, reporting it to `onValueChange` when it changes
|
|
21
|
+
*/
|
|
22
|
+
select: (value: string) => void;
|
|
23
|
+
/**
|
|
24
|
+
* The selected tab's value
|
|
25
|
+
*/
|
|
26
|
+
selectedValue: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Size of every tab
|
|
29
|
+
*/
|
|
30
|
+
size: ControlSize;
|
|
31
|
+
/**
|
|
32
|
+
* Look of the tab list and its tabs
|
|
33
|
+
*/
|
|
34
|
+
variant: TabsVariant;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Carries a `Tabs`'s state to its parts; null outside a `Tabs`
|
|
38
|
+
*/
|
|
39
|
+
export declare const TabsContext: import("react").Context<TabsContextValue | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Tab } from "./Tab";
|
|
2
|
+
export type { TabProps } from "./Tab";
|
|
3
|
+
export { TabList } from "./TabList";
|
|
4
|
+
export type { TabListProps } from "./TabList";
|
|
5
|
+
export { TabPanel } from "./TabPanel";
|
|
6
|
+
export type { TabPanelProps } from "./TabPanel";
|
|
7
|
+
export { Tabs } from "./Tabs";
|
|
8
|
+
export type { TabsActivation, TabsOrientation, TabsProps, TabsVariant } from "./Tabs";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the id of the tab for a value
|
|
3
|
+
*
|
|
4
|
+
* @param baseId the `Tabs`'s generated id
|
|
5
|
+
* @param value the tab's value
|
|
6
|
+
* @returns an id unique to the value within its `Tabs`, whatever characters the value holds
|
|
7
|
+
*/
|
|
8
|
+
export declare function tabId(baseId: string, value: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Builds the id of the panel for a value
|
|
11
|
+
*
|
|
12
|
+
* @param baseId the `Tabs`'s generated id
|
|
13
|
+
* @param value the panel's value
|
|
14
|
+
* @returns an id unique to the value within its `Tabs`, whatever characters the value holds
|
|
15
|
+
*/
|
|
16
|
+
export declare function panelId(baseId: string, value: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { idSegment as e } from "../../accessibility/idSegment.js";
|
|
2
|
+
//#region src/components/Tabs/tabIds.ts
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
return `${t}-tab-${e(n)}`;
|
|
5
|
+
}
|
|
6
|
+
function n(t, n) {
|
|
7
|
+
return `${t}-panel-${e(n)}`;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as panelId, t as tabId };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TabsContextValue } from "./TabsContext";
|
|
2
|
+
/**
|
|
3
|
+
* Reads the state of the surrounding `Tabs`
|
|
4
|
+
*
|
|
5
|
+
* @param part the name of the part reading it, for the error message
|
|
6
|
+
* @returns the surrounding `Tabs`'s state
|
|
7
|
+
* @throws MissingContextError when the part is not inside a `Tabs`
|
|
8
|
+
*/
|
|
9
|
+
export declare function useTabsContext(part: string): TabsContextValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MissingContextError as e } from "../../errors/MissingContextError.js";
|
|
2
|
+
import { TabsContext as t } from "./TabsContext.js";
|
|
3
|
+
import { useContext as n } from "react";
|
|
4
|
+
//#region src/components/Tabs/useTabsContext.ts
|
|
5
|
+
function r(r) {
|
|
6
|
+
let i = n(t);
|
|
7
|
+
if (i === null) throw new e(r, "Tabs");
|
|
8
|
+
return i;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { r as useTabsContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-text-78lq0{font-family:var(--sui-font-body,system-ui, sans-serif);line-height:var(--sui-line-height-normal,1.5);margin:0}.sui-text-78lq0[data-size=xs]{font-size:var(--sui-font-size-xs,.75rem)}.sui-text-78lq0[data-size=sm]{font-size:var(--sui-font-size-sm,.875rem)}.sui-text-78lq0[data-size=md]{font-size:var(--sui-font-size-md,1rem)}.sui-text-78lq0[data-size=lg]{font-size:var(--sui-font-size-lg,1.125rem)}.sui-text-78lq0[data-size=xl]{font-size:var(--sui-font-size-xl,1.25rem)}.sui-text-78lq0[data-weight=regular]{font-weight:var(--sui-font-weight-regular,400)}.sui-text-78lq0[data-weight=medium]{font-weight:var(--sui-font-weight-medium,500)}.sui-text-78lq0[data-weight=bold]{font-weight:var(--sui-font-weight-bold,700)}.sui-text-78lq0[data-tone=muted]{color:var(--sui-color-text-muted,#4b5563)}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { BoxElement, BoxProps } from "../Box";
|
|
3
|
+
/**
|
|
4
|
+
* Body text sizes, mapped to the `--sui-font-size-*` tokens
|
|
5
|
+
*/
|
|
6
|
+
export type TextSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
7
|
+
/**
|
|
8
|
+
* Text colour; `default` inherits the surrounding text colour
|
|
9
|
+
*/
|
|
10
|
+
export type TextTone = "default" | "muted";
|
|
11
|
+
/**
|
|
12
|
+
* Font weights, mapped to the `--sui-font-weight-*` tokens
|
|
13
|
+
*/
|
|
14
|
+
export type TextWeight = "bold" | "medium" | "regular";
|
|
15
|
+
interface TextOwnProps {
|
|
16
|
+
/**
|
|
17
|
+
* Font size. Defaults to `md`.
|
|
18
|
+
*/
|
|
19
|
+
size?: TextSize;
|
|
20
|
+
/**
|
|
21
|
+
* Text colour. Defaults to `default`.
|
|
22
|
+
*/
|
|
23
|
+
tone?: TextTone;
|
|
24
|
+
/**
|
|
25
|
+
* Font weight. Defaults to `regular`.
|
|
26
|
+
*/
|
|
27
|
+
weight?: TextWeight;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Props for `Text`: its own props plus every prop supported by the element given in `as`
|
|
31
|
+
*/
|
|
32
|
+
export type TextProps<E extends BoxElement = "span"> = TextOwnProps & Omit<BoxProps<E>, keyof TextOwnProps>;
|
|
33
|
+
/**
|
|
34
|
+
* Body text in the theme's body font
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <Text as="p" size="sm" tone="muted">Last updated today</Text>
|
|
38
|
+
*/
|
|
39
|
+
export declare function Text<E extends BoxElement = "span">({ as, className, size, tone, weight, ...rest }: TextProps<E>): JSX.Element;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import t from "./Text.module.js";
|
|
3
|
+
import { clsx as n } from "clsx";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Text/Text.tsx
|
|
6
|
+
function i({ as: i, className: a, size: o = "md", tone: s = "default", weight: c = "regular", ...l }) {
|
|
7
|
+
return /* @__PURE__ */ r(e, {
|
|
8
|
+
...l,
|
|
9
|
+
as: i ?? "span",
|
|
10
|
+
className: n(t.text, a),
|
|
11
|
+
"data-size": o,
|
|
12
|
+
"data-tone": s,
|
|
13
|
+
"data-weight": c
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { i as Text };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-textControl-gGW4a{--sui-text-control-bg:var(--sui-color-field,#fff);--sui-text-control-fg:var(--sui-color-text,#111827);--sui-text-control-border:var(--sui-color-input-border,#6b7280);--sui-text-control-border-width:var(--sui-border-width,1px);--sui-text-control-radius:var(--sui-radius-control,4px);--sui-text-control-padding-x:var(--sui-space-4,1rem);--sui-text-control-padding-y:var(--sui-space-2,.5rem);--sui-text-control-font-size:var(--sui-font-size-md,1rem);padding:var(--sui-text-control-padding-y) var(--sui-text-control-padding-x);border:var(--sui-text-control-border-width) solid var(--sui-text-control-border);border-radius:var(--sui-text-control-radius);background-color:var(--sui-text-control-bg);color:var(--sui-text-control-fg);font-family:var(--sui-font-body,system-ui, sans-serif);font-size:var(--sui-text-control-font-size);line-height:var(--sui-line-height-tight,1.25);transition:border-color .12s}.sui-textControl-gGW4a[data-size=sm]{--sui-text-control-padding-x:var(--sui-space-3,.75rem);--sui-text-control-padding-y:var(--sui-space-1,.25rem);--sui-text-control-font-size:var(--sui-font-size-sm,.875rem)}.sui-textControl-gGW4a[data-size=lg]{--sui-text-control-padding-x:var(--sui-space-6,1.5rem);--sui-text-control-padding-y:var(--sui-space-3,.75rem);--sui-text-control-font-size:var(--sui-font-size-lg,1.125rem)}.sui-textControl-gGW4a:where(textarea){--sui-text-control-radius:var(--sui-radius-md,4px);line-height:var(--sui-line-height-normal,1.5);resize:vertical}.sui-textControl-gGW4a:where(select){--sui-text-control-chevron-size:.375em;background-image:linear-gradient(45deg,#0000 calc(50% - 1px),currentColor calc(50% - 1px) calc(50% + 1px),#0000 calc(50% + 1px)),linear-gradient(135deg,#0000 calc(50% - 1px),currentColor calc(50% - 1px) calc(50% + 1px),#0000 calc(50% + 1px));background-position:right calc(var(--sui-text-control-padding-x) + var(--sui-text-control-chevron-size) - 1px) center, right var(--sui-text-control-padding-x) center;background-repeat:no-repeat;background-size:var(--sui-text-control-chevron-size) var(--sui-text-control-chevron-size);appearance:none;padding-inline-end:calc(var(--sui-text-control-padding-x) + var(--sui-text-control-chevron-size) * 3)}.sui-textControl-gGW4a:where(select):dir(rtl){background-position:left var(--sui-text-control-padding-x) center, left calc(var(--sui-text-control-padding-x) + var(--sui-text-control-chevron-size) - 1px) center}@media (forced-colors:active){.sui-textControl-gGW4a:where(select){appearance:auto;padding-inline-end:var(--sui-text-control-padding-x)}}.sui-textControl-gGW4a::placeholder{color:var(--sui-color-text-muted,#4b5563);opacity:1}.sui-textControl-gGW4a:focus-visible{outline:var(--sui-focus-ring-width,2px) solid var(--sui-color-focus-ring,#3b82f6);outline-offset:2px}.sui-textControl-gGW4a[aria-invalid=true]{--sui-text-control-border:var(--sui-color-danger-text,#b91c1c)}.sui-textControl-gGW4a:disabled{cursor:not-allowed;opacity:.5}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { ControlSize } from "../../forms";
|
|
3
|
+
import type { BoxProps } from "../Box";
|
|
4
|
+
type TextControlElement = "input" | "select" | "textarea";
|
|
5
|
+
interface TextControlOwnProps<E extends TextControlElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Native element to render
|
|
8
|
+
*/
|
|
9
|
+
as: E;
|
|
10
|
+
/**
|
|
11
|
+
* Padding and font size of the control, matching the `Button` sizes. Takes the place of the native `size`
|
|
12
|
+
* attribute.
|
|
13
|
+
*/
|
|
14
|
+
size: ControlSize;
|
|
15
|
+
}
|
|
16
|
+
type TextControlProps<E extends TextControlElement> = TextControlOwnProps<E> & Omit<BoxProps<E>, keyof TextControlOwnProps<E>>;
|
|
17
|
+
/**
|
|
18
|
+
* Themed text-entry element shared by `TextInput`, `Textarea` and `Select`. Inside a `Field` it takes its id,
|
|
19
|
+
* description, and invalid, disabled and required state from the field.
|
|
20
|
+
*/
|
|
21
|
+
export declare function TextControl<E extends TextControlElement>({ as, className, size, ...rest }: TextControlProps<E>): JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useFieldControl as e } from "../../forms/useFieldControl.js";
|
|
2
|
+
import { Box as t } from "../Box/Box.js";
|
|
3
|
+
import n from "./TextControl.module.js";
|
|
4
|
+
import { clsx as r } from "clsx";
|
|
5
|
+
import { c as i } from "react/compiler-runtime";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/TextControl/TextControl.tsx
|
|
8
|
+
function o(o) {
|
|
9
|
+
let s = i(13), c, l, u, d;
|
|
10
|
+
s[0] === o ? (c = s[1], l = s[2], u = s[3], d = s[4]) : ({as: c, className: l, size: d, ...u} = o, s[0] = o, s[1] = c, s[2] = l, s[3] = u, s[4] = d);
|
|
11
|
+
let f = u, p = e(f), m = c, h;
|
|
12
|
+
s[5] === l ? h = s[6] : (h = r(n.textControl, l), s[5] = l, s[6] = h);
|
|
13
|
+
let g;
|
|
14
|
+
return s[7] !== f || s[8] !== p || s[9] !== d || s[10] !== m || s[11] !== h ? (g = /* @__PURE__ */ a(t, {
|
|
15
|
+
...f,
|
|
16
|
+
...p,
|
|
17
|
+
as: m,
|
|
18
|
+
className: h,
|
|
19
|
+
"data-size": d
|
|
20
|
+
}), s[7] = f, s[8] = p, s[9] = d, s[10] = m, s[11] = h, s[12] = g) : g = s[12], g;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { o as TextControl };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextControl } from "./TextControl";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { ControlSize } from "../../forms";
|
|
3
|
+
import type { BoxProps } from "../Box";
|
|
4
|
+
/**
|
|
5
|
+
* Input types `TextInput` supports: the ones that take a line of typed text
|
|
6
|
+
*/
|
|
7
|
+
export type TextInputType = "email" | "number" | "password" | "search" | "tel" | "text" | "url";
|
|
8
|
+
/**
|
|
9
|
+
* Props for `TextInput`: its own props plus every native input prop
|
|
10
|
+
*/
|
|
11
|
+
export interface TextInputProps extends Omit<BoxProps<"input">, "as" | "children" | "dangerouslySetInnerHTML" | "size" | "type"> {
|
|
12
|
+
/**
|
|
13
|
+
* Height of the input, matching the `Button` sizes. Takes the place of the native `size` attribute. Defaults
|
|
14
|
+
* to `md`. The `sm` text is under 16px, which makes iOS Safari zoom the page when the input takes focus.
|
|
15
|
+
*/
|
|
16
|
+
size?: ControlSize;
|
|
17
|
+
/**
|
|
18
|
+
* Kind of text the input takes. Defaults to `text`.
|
|
19
|
+
*/
|
|
20
|
+
type?: TextInputType;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Themed single-line text input. Inside a `Field` it takes its label, description, error, and required and
|
|
24
|
+
* disabled state from the field. Outside one, give it an accessible name, for example with `aria-label`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <Field label="Email">
|
|
28
|
+
* <TextInput autoComplete="email" type="email" />
|
|
29
|
+
* </Field>
|
|
30
|
+
*/
|
|
31
|
+
export declare function TextInput({ size, type, ...rest }: TextInputProps): JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TextControl as e } from "../TextControl/TextControl.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/TextInput/TextInput.tsx
|
|
4
|
+
function n({ size: n = "md", type: r = "text", ...i }) {
|
|
5
|
+
return /* @__PURE__ */ t(e, {
|
|
6
|
+
...i,
|
|
7
|
+
as: "input",
|
|
8
|
+
size: n,
|
|
9
|
+
type: r
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as TextInput };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { ControlSize } from "../../forms";
|
|
3
|
+
import type { BoxProps } from "../Box";
|
|
4
|
+
/**
|
|
5
|
+
* Props for `Textarea`: its own props plus every native textarea prop
|
|
6
|
+
*/
|
|
7
|
+
export interface TextareaProps extends Omit<BoxProps<"textarea">, "as" | "children" | "dangerouslySetInnerHTML"> {
|
|
8
|
+
/**
|
|
9
|
+
* Padding and font size of the textarea, matching the `Button` sizes. Defaults to `md`. The `sm` text is under
|
|
10
|
+
* 16px, which makes iOS Safari zoom the page when the textarea takes focus.
|
|
11
|
+
*/
|
|
12
|
+
size?: ControlSize;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Themed multi-line text input that the user can resize vertically. Set its height with `rows` and its text
|
|
16
|
+
* with `value` or `defaultValue`. Inside a `Field` it takes its label, description, error, and required and
|
|
17
|
+
* disabled state from the field. Outside one, give it an accessible name, for example with `aria-label`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Field label="Message">
|
|
21
|
+
* <Textarea rows={4} />
|
|
22
|
+
* </Field>
|
|
23
|
+
*/
|
|
24
|
+
export declare function Textarea({ size, ...rest }: TextareaProps): JSX.Element;
|