@usefragments/ui 1.6.0 → 2.0.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/README.md +54 -66
- package/dist/assets/fragments-wordmark.cjs +2 -2
- package/dist/assets/fragments-wordmark.d.ts.map +1 -1
- package/dist/assets/fragments-wordmark.js +2 -2
- package/dist/assets/nav-glyph.cjs +139 -0
- package/dist/assets/nav-glyph.d.ts +28 -0
- package/dist/assets/nav-glyph.d.ts.map +1 -0
- package/dist/assets/nav-glyph.js +139 -0
- package/dist/assets/nav-glyph.module.scss.cjs +71 -0
- package/dist/assets/nav-glyph.module.scss.js +71 -0
- package/dist/assets/ui.css +6885 -6308
- package/dist/blocks/components/StatsCard.d.ts +1 -1
- package/dist/blocks/components/StatsCard.d.ts.map +1 -1
- package/dist/chart.cjs +24 -6
- package/dist/chart.js +24 -6
- package/dist/codeblock.cjs +76 -43
- package/dist/codeblock.js +71 -38
- package/dist/colorpicker.cjs +4 -1
- package/dist/colorpicker.js +4 -1
- package/dist/components/Accordion/Accordion.module.scss.cjs +8 -8
- package/dist/components/Accordion/Accordion.module.scss.js +8 -8
- package/dist/components/Alert/Alert.module.scss.cjs +23 -20
- package/dist/components/Alert/Alert.module.scss.js +23 -20
- package/dist/components/Alert/index.cjs +20 -8
- package/dist/components/Alert/index.d.ts +17 -11
- package/dist/components/Alert/index.d.ts.map +1 -1
- package/dist/components/Alert/index.js +20 -8
- package/dist/components/AppShell/AppShell.module.scss.cjs +14 -14
- package/dist/components/AppShell/AppShell.module.scss.js +14 -14
- package/dist/components/AppShell/index.cjs +2 -2
- package/dist/components/AppShell/index.js +2 -2
- package/dist/components/Avatar/Avatar.module.scss.cjs +14 -14
- package/dist/components/Avatar/Avatar.module.scss.js +14 -14
- package/dist/components/Badge/Badge.module.scss.cjs +33 -31
- package/dist/components/Badge/Badge.module.scss.js +33 -31
- package/dist/components/Badge/index.cjs +13 -3
- package/dist/components/Badge/index.d.ts +18 -13
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +13 -3
- package/dist/components/BentoGrid/BentoGrid.module.scss.cjs +14 -14
- package/dist/components/BentoGrid/BentoGrid.module.scss.js +14 -14
- package/dist/components/Box/Box.module.scss.cjs +152 -152
- package/dist/components/Box/Box.module.scss.js +152 -152
- package/dist/components/Box/index.cjs +64 -75
- package/dist/components/Box/index.d.ts +16 -16
- package/dist/components/Box/index.d.ts.map +1 -1
- package/dist/components/Box/index.js +64 -75
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.cjs +11 -8
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.js +11 -8
- package/dist/components/Breadcrumbs/index.cjs +1 -1
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/index.js +1 -1
- package/dist/components/Button/Button.module.scss.cjs +36 -27
- package/dist/components/Button/Button.module.scss.js +36 -27
- package/dist/components/Button/index.cjs +20 -4
- package/dist/components/Button/index.d.ts +18 -10
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +20 -4
- package/dist/components/ButtonGroup/ButtonGroup.module.scss.cjs +15 -15
- package/dist/components/ButtonGroup/ButtonGroup.module.scss.js +15 -15
- package/dist/components/Card/Card.module.scss.cjs +31 -26
- package/dist/components/Card/Card.module.scss.js +32 -27
- package/dist/components/Card/index.cjs +16 -3
- package/dist/components/Card/index.d.ts +23 -15
- package/dist/components/Card/index.d.ts.map +1 -1
- package/dist/components/Card/index.js +16 -3
- package/dist/components/Chart/Chart.module.scss.cjs +15 -15
- package/dist/components/Chart/Chart.module.scss.js +15 -15
- package/dist/components/Chart/index.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.module.scss.cjs +11 -11
- package/dist/components/Checkbox/Checkbox.module.scss.js +11 -11
- package/dist/components/Checkbox/index.cjs +4 -4
- package/dist/components/Checkbox/index.d.ts +4 -6
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +4 -4
- package/dist/components/Chip/Chip.module.scss.cjs +19 -19
- package/dist/components/Chip/Chip.module.scss.js +19 -19
- package/dist/components/Chip/index.cjs +3 -3
- package/dist/components/Chip/index.d.ts +8 -3
- package/dist/components/Chip/index.d.ts.map +1 -1
- package/dist/components/Chip/index.js +3 -3
- package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +26 -23
- package/dist/components/CodeBlock/CodeBlock.module.scss.js +26 -23
- package/dist/components/CodeBlock/css-variables-theme.cjs +98 -0
- package/dist/components/CodeBlock/css-variables-theme.d.ts +27 -0
- package/dist/components/CodeBlock/css-variables-theme.d.ts.map +1 -0
- package/dist/components/CodeBlock/css-variables-theme.js +98 -0
- package/dist/components/CodeBlock/index.d.ts +20 -5
- package/dist/components/CodeBlock/index.d.ts.map +1 -1
- package/dist/components/Collapsible/Collapsible.module.scss.cjs +9 -9
- package/dist/components/Collapsible/Collapsible.module.scss.js +9 -9
- package/dist/components/ColorPicker/ColorPicker.module.scss.cjs +14 -14
- package/dist/components/ColorPicker/ColorPicker.module.scss.js +14 -14
- package/dist/components/ColorPicker/index.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.module.scss.cjs +21 -21
- package/dist/components/Combobox/Combobox.module.scss.js +21 -21
- package/dist/components/Combobox/index.cjs +26 -6
- package/dist/components/Combobox/index.d.ts.map +1 -1
- package/dist/components/Combobox/index.js +26 -6
- package/dist/components/Command/Command.module.scss.cjs +14 -11
- package/dist/components/Command/Command.module.scss.js +14 -11
- package/dist/components/Command/index.cjs +28 -16
- package/dist/components/Command/index.d.ts +8 -3
- package/dist/components/Command/index.d.ts.map +1 -1
- package/dist/components/Command/index.js +28 -16
- package/dist/components/ConversationList/ConversationList.module.scss.cjs +10 -10
- package/dist/components/ConversationList/ConversationList.module.scss.js +10 -10
- package/dist/components/ConversationList/index.cjs +2 -2
- package/dist/components/ConversationList/index.js +2 -2
- package/dist/components/DataTable/DataTable.icons.cjs +6 -33
- package/dist/components/DataTable/DataTable.icons.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.icons.js +6 -33
- package/dist/components/DataTable/DataTable.module.scss.cjs +31 -28
- package/dist/components/DataTable/DataTable.module.scss.js +31 -28
- package/dist/components/DataTable/DataTable.virtual.d.ts.map +1 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.module.scss.cjs +33 -33
- package/dist/components/DatePicker/DatePicker.module.scss.js +33 -33
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.module.scss.cjs +14 -14
- package/dist/components/Dialog/Dialog.module.scss.js +14 -14
- package/dist/components/Dialog/index.cjs +13 -16
- package/dist/components/Dialog/index.d.ts +11 -10
- package/dist/components/Dialog/index.d.ts.map +1 -1
- package/dist/components/Dialog/index.js +13 -16
- package/dist/components/Drawer/Drawer.module.scss.cjs +39 -39
- package/dist/components/Drawer/Drawer.module.scss.js +40 -40
- package/dist/components/Drawer/index.cjs +2 -2
- package/dist/components/Drawer/index.d.ts +5 -4
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +2 -2
- package/dist/components/Editor/Editor.module.scss.cjs +17 -17
- package/dist/components/Editor/Editor.module.scss.js +17 -17
- package/dist/components/Editor/index.d.ts +10 -10
- package/dist/components/Editor/index.d.ts.map +1 -1
- package/dist/components/EmptyState/EmptyState.module.scss.cjs +11 -8
- package/dist/components/EmptyState/EmptyState.module.scss.js +11 -8
- package/dist/components/EmptyState/index.cjs +13 -6
- package/dist/components/EmptyState/index.d.ts +13 -5
- package/dist/components/EmptyState/index.d.ts.map +1 -1
- package/dist/components/EmptyState/index.js +13 -6
- package/dist/components/Field/Field.module.scss.cjs +5 -5
- package/dist/components/Field/Field.module.scss.js +5 -5
- package/dist/components/Field/index.cjs +9 -1
- package/dist/components/Field/index.d.ts.map +1 -1
- package/dist/components/Field/index.js +9 -1
- package/dist/components/Fieldset/Fieldset.module.scss.cjs +3 -3
- package/dist/components/Fieldset/Fieldset.module.scss.js +3 -3
- package/dist/components/Grid/Grid.module.scss.cjs +54 -54
- package/dist/components/Grid/Grid.module.scss.js +54 -54
- package/dist/components/Grid/index.cjs +1 -1
- package/dist/components/Grid/index.js +1 -1
- package/dist/components/Header/Header.module.scss.cjs +33 -33
- package/dist/components/Header/Header.module.scss.js +33 -33
- package/dist/components/Header/index.cjs +17 -38
- package/dist/components/Header/index.d.ts +15 -11
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +17 -38
- package/dist/components/Icon/Icon.module.scss.cjs +30 -33
- package/dist/components/Icon/Icon.module.scss.js +30 -33
- package/dist/components/Icon/index.cjs +15 -14
- package/dist/components/Icon/index.d.ts +23 -12
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +15 -14
- package/dist/components/IconButton/IconButton.module.scss.cjs +12 -12
- package/dist/components/IconButton/IconButton.module.scss.js +12 -12
- package/dist/components/IconButton/index.cjs +2 -1
- package/dist/components/IconButton/index.d.ts +4 -4
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.js +2 -1
- package/dist/components/Image/Image.module.scss.cjs +27 -27
- package/dist/components/Image/Image.module.scss.js +27 -27
- package/dist/components/Input/Input.module.scss.cjs +15 -21
- package/dist/components/Input/Input.module.scss.js +15 -21
- package/dist/components/Input/index.cjs +2 -14
- package/dist/components/Input/index.d.ts +0 -2
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +2 -14
- package/dist/components/Link/Link.module.scss.cjs +26 -14
- package/dist/components/Link/Link.module.scss.js +26 -14
- package/dist/components/Link/index.cjs +13 -2
- package/dist/components/Link/index.d.ts +11 -4
- package/dist/components/Link/index.d.ts.map +1 -1
- package/dist/components/Link/index.js +13 -2
- package/dist/components/List/List.module.scss.cjs +23 -19
- package/dist/components/List/List.module.scss.js +23 -19
- package/dist/components/List/index.cjs +7 -7
- package/dist/components/List/index.d.ts +10 -7
- package/dist/components/List/index.d.ts.map +1 -1
- package/dist/components/List/index.js +7 -7
- package/dist/components/Listbox/Listbox.module.scss.cjs +8 -8
- package/dist/components/Listbox/Listbox.module.scss.js +8 -8
- package/dist/components/Loading/Loading.module.scss.cjs +34 -34
- package/dist/components/Loading/Loading.module.scss.js +34 -34
- package/dist/components/Loading/index.cjs +5 -5
- package/dist/components/Loading/index.d.ts +8 -7
- package/dist/components/Loading/index.d.ts.map +1 -1
- package/dist/components/Loading/index.js +5 -5
- package/dist/components/Markdown/Markdown.module.scss.cjs +1 -1
- package/dist/components/Markdown/Markdown.module.scss.js +1 -1
- package/dist/components/Markdown/index.d.ts +2 -2
- package/dist/components/Markdown/index.d.ts.map +1 -1
- package/dist/components/Menu/Menu.module.scss.cjs +14 -14
- package/dist/components/Menu/Menu.module.scss.js +14 -14
- package/dist/components/Message/Message.module.scss.cjs +20 -20
- package/dist/components/Message/Message.module.scss.js +20 -20
- package/dist/components/Message/index.cjs +1 -1
- package/dist/components/Message/index.d.ts +1 -1
- package/dist/components/Message/index.js +1 -1
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.cjs +34 -31
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.js +34 -31
- package/dist/components/NavigationMenu/index.cjs +32 -15
- package/dist/components/NavigationMenu/index.d.ts +12 -6
- package/dist/components/NavigationMenu/index.d.ts.map +1 -1
- package/dist/components/NavigationMenu/index.js +32 -15
- package/dist/components/Pagination/Pagination.module.scss.cjs +10 -10
- package/dist/components/Pagination/Pagination.module.scss.js +10 -10
- package/dist/components/Popover/Popover.module.scss.cjs +10 -10
- package/dist/components/Popover/Popover.module.scss.js +10 -10
- package/dist/components/Progress/Progress.module.scss.cjs +28 -25
- package/dist/components/Progress/Progress.module.scss.js +28 -25
- package/dist/components/Progress/index.cjs +21 -12
- package/dist/components/Progress/index.d.ts +10 -6
- package/dist/components/Progress/index.d.ts.map +1 -1
- package/dist/components/Progress/index.js +21 -12
- package/dist/components/Prompt/Prompt.module.scss.cjs +30 -30
- package/dist/components/Prompt/Prompt.module.scss.js +30 -30
- package/dist/components/Prompt/index.cjs +7 -7
- package/dist/components/Prompt/index.d.ts +11 -9
- package/dist/components/Prompt/index.d.ts.map +1 -1
- package/dist/components/Prompt/index.js +7 -7
- package/dist/components/RadioGroup/RadioGroup.module.scss.cjs +20 -17
- package/dist/components/RadioGroup/RadioGroup.module.scss.js +20 -17
- package/dist/components/RadioGroup/index.cjs +10 -5
- package/dist/components/RadioGroup/index.d.ts +11 -7
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.js +10 -5
- package/dist/components/ScrollArea/ScrollArea.module.scss.cjs +5 -5
- package/dist/components/ScrollArea/ScrollArea.module.scss.js +5 -5
- package/dist/components/ScrollArea/index.d.ts +4 -4
- package/dist/components/ScrollArea/index.d.ts.map +1 -1
- package/dist/components/ScrollArea/scroll-state.d.ts +5 -5
- package/dist/components/Select/Select.module.scss.cjs +21 -21
- package/dist/components/Select/Select.module.scss.js +21 -21
- package/dist/components/Select/index.cjs +26 -20
- package/dist/components/Select/index.d.ts +5 -5
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +26 -20
- package/dist/components/Separator/Separator.module.scss.cjs +25 -19
- package/dist/components/Separator/Separator.module.scss.js +25 -19
- package/dist/components/Separator/index.cjs +10 -8
- package/dist/components/Separator/index.d.ts +4 -2
- package/dist/components/Separator/index.d.ts.map +1 -1
- package/dist/components/Separator/index.js +10 -8
- package/dist/components/Sidebar/Sidebar.module.scss.cjs +43 -43
- package/dist/components/Sidebar/Sidebar.module.scss.js +43 -43
- package/dist/components/Sidebar/index.cjs +15 -38
- package/dist/components/Sidebar/index.d.ts +19 -19
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +15 -38
- package/dist/components/Skeleton/Skeleton.module.scss.cjs +50 -46
- package/dist/components/Skeleton/Skeleton.module.scss.js +50 -46
- package/dist/components/Skeleton/index.cjs +7 -7
- package/dist/components/Skeleton/index.d.ts +8 -7
- package/dist/components/Skeleton/index.d.ts.map +1 -1
- package/dist/components/Skeleton/index.js +7 -7
- package/dist/components/Slider/Slider.module.scss.cjs +12 -12
- package/dist/components/Slider/Slider.module.scss.js +12 -12
- package/dist/components/Stack/Stack.module.scss.cjs +25 -25
- package/dist/components/Stack/Stack.module.scss.js +25 -25
- package/dist/components/Stack/index.cjs +1 -1
- package/dist/components/Stack/index.js +1 -1
- package/dist/components/Switch/Switch.module.scss.cjs +9 -9
- package/dist/components/Switch/Switch.module.scss.js +9 -9
- package/dist/components/Table/Table.module.scss.cjs +19 -19
- package/dist/components/Table/Table.module.scss.js +19 -19
- package/dist/components/TableOfContents/TableOfContents.module.scss.cjs +15 -15
- package/dist/components/TableOfContents/TableOfContents.module.scss.js +15 -15
- package/dist/components/TableOfContents/index.cjs +14 -10
- package/dist/components/TableOfContents/index.d.ts +5 -3
- package/dist/components/TableOfContents/index.d.ts.map +1 -1
- package/dist/components/TableOfContents/index.js +14 -10
- package/dist/components/Tabs/Tabs.module.scss.cjs +18 -18
- package/dist/components/Tabs/Tabs.module.scss.js +18 -18
- package/dist/components/Tabs/index.cjs +30 -11
- package/dist/components/Tabs/index.d.ts +8 -6
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +30 -11
- package/dist/components/Text/Text.module.scss.cjs +109 -97
- package/dist/components/Text/Text.module.scss.js +109 -97
- package/dist/components/Text/index.cjs +45 -41
- package/dist/components/Text/index.d.ts +24 -19
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/components/Text/index.js +45 -41
- package/dist/components/Textarea/Textarea.module.scss.cjs +22 -28
- package/dist/components/Textarea/Textarea.module.scss.js +22 -28
- package/dist/components/Textarea/index.cjs +3 -10
- package/dist/components/Textarea/index.d.ts +0 -2
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +3 -10
- package/dist/components/Theme/index.cjs +22 -5
- package/dist/components/Theme/index.d.ts +6 -12
- package/dist/components/Theme/index.d.ts.map +1 -1
- package/dist/components/Theme/index.js +22 -5
- package/dist/components/ThemeToggle/ThemeButton.cjs +51 -0
- package/dist/components/ThemeToggle/ThemeButton.d.ts +16 -0
- package/dist/components/ThemeToggle/ThemeButton.d.ts.map +1 -0
- package/dist/components/ThemeToggle/ThemeButton.js +34 -0
- package/dist/components/ThemeToggle/ThemeToggle.module.scss.cjs +6 -6
- package/dist/components/ThemeToggle/ThemeToggle.module.scss.js +6 -6
- package/dist/components/ThemeToggle/icons.cjs +48 -0
- package/dist/components/ThemeToggle/icons.d.ts +10 -0
- package/dist/components/ThemeToggle/icons.d.ts.map +1 -0
- package/dist/components/ThemeToggle/icons.js +48 -0
- package/dist/components/ThemeToggle/index.cjs +6 -50
- package/dist/components/ThemeToggle/index.d.ts +5 -3
- package/dist/components/ThemeToggle/index.d.ts.map +1 -1
- package/dist/components/ThemeToggle/index.js +3 -47
- package/dist/components/ThinkingIndicator/ThinkingIndicator.module.scss.cjs +18 -15
- package/dist/components/ThinkingIndicator/ThinkingIndicator.module.scss.js +18 -15
- package/dist/components/ThinkingIndicator/index.cjs +7 -8
- package/dist/components/ThinkingIndicator/index.d.ts +6 -5
- package/dist/components/ThinkingIndicator/index.d.ts.map +1 -1
- package/dist/components/ThinkingIndicator/index.js +7 -8
- package/dist/components/Toast/Toast.module.scss.cjs +28 -29
- package/dist/components/Toast/Toast.module.scss.js +29 -30
- package/dist/components/Toast/index.cjs +28 -30
- package/dist/components/Toast/index.d.ts +9 -8
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +28 -30
- package/dist/components/ToggleGroup/ToggleGroup.module.scss.cjs +21 -19
- package/dist/components/ToggleGroup/ToggleGroup.module.scss.js +22 -20
- package/dist/components/ToggleGroup/index.cjs +4 -5
- package/dist/components/ToggleGroup/index.d.ts +7 -6
- package/dist/components/ToggleGroup/index.d.ts.map +1 -1
- package/dist/components/ToggleGroup/index.js +4 -5
- package/dist/components/Tooltip/Tooltip.module.scss.cjs +3 -3
- package/dist/components/Tooltip/Tooltip.module.scss.js +3 -3
- package/dist/components/Tooltip/index.cjs +24 -40
- package/dist/components/Tooltip/index.d.ts +4 -4
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/Tooltip/index.js +24 -40
- package/dist/components/VisuallyHidden/VisuallyHidden.module.scss.cjs +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.module.scss.js +1 -1
- package/dist/components/VisuallyHidden/index.d.ts +2 -2
- package/dist/data-table-virtual.cjs +3 -2
- package/dist/data-table-virtual.js +3 -2
- package/dist/data-table.cjs +3 -2
- package/dist/data-table.js +3 -2
- package/dist/datepicker.cjs +26 -13
- package/dist/datepicker.js +26 -13
- package/dist/editor.cjs +68 -28
- package/dist/editor.js +68 -28
- package/dist/index.cjs +6 -2
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/markdown.cjs +21 -29
- package/dist/markdown.js +21 -29
- package/dist/measurements/generated.cjs +46 -94
- package/dist/measurements/generated.d.ts +44 -92
- package/dist/measurements/generated.d.ts.map +1 -1
- package/dist/measurements/generated.js +46 -94
- package/dist/measurements/index.d.ts +1 -1
- package/dist/measurements/index.d.ts.map +1 -1
- package/dist/utils/a11y.cjs +5 -2
- package/dist/utils/a11y.d.ts +5 -5
- package/dist/utils/a11y.d.ts.map +1 -1
- package/dist/utils/a11y.js +5 -2
- package/dist/utils/canonical-stamp.cjs +2 -8
- package/dist/utils/canonical-stamp.d.ts.map +1 -1
- package/dist/utils/canonical-stamp.js +1 -7
- package/dist/utils/css-warning.cjs +1 -1
- package/dist/utils/css-warning.js +1 -1
- package/dist/utils/env.cjs +17 -0
- package/dist/utils/env.d.ts +3 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +17 -0
- package/dist/utils/keyboard-shortcuts.cjs +3 -10
- package/dist/utils/keyboard-shortcuts.d.ts +4 -4
- package/dist/utils/keyboard-shortcuts.d.ts.map +1 -1
- package/dist/utils/keyboard-shortcuts.js +3 -10
- package/dist/utils/seed-derivation.cjs +10 -7
- package/dist/utils/seed-derivation.d.ts +1 -3
- package/dist/utils/seed-derivation.d.ts.map +1 -1
- package/dist/utils/seed-derivation.js +10 -7
- package/dist/utils/theme-presets.cjs +5 -10
- package/dist/utils/theme-presets.d.ts +1 -2
- package/dist/utils/theme-presets.d.ts.map +1 -1
- package/dist/utils/theme-presets.js +5 -10
- package/fragments.json +1 -1
- package/package.json +9 -10
- package/src/assets/fragments-logo.tsx +2 -2
- package/src/assets/fragments-wordmark.tsx +4 -2
- package/src/assets/nav-glyph.module.scss +166 -0
- package/src/assets/nav-glyph.tsx +188 -0
- package/src/components/Accordion/Accordion.contract.json +24 -48
- package/src/components/Accordion/Accordion.module.scss +5 -3
- package/src/components/Alert/Alert.contract.json +49 -65
- package/src/components/Alert/Alert.module.scss +57 -47
- package/src/components/Alert/index.tsx +72 -39
- package/src/components/AppShell/AppShell.contract.json +34 -51
- package/src/components/AppShell/AppShell.module.scss +99 -54
- package/src/components/AppShell/index.tsx +2 -2
- package/src/components/Avatar/Avatar.contract.json +31 -48
- package/src/components/Avatar/Avatar.module.scss +4 -2
- package/src/components/Badge/Badge.contract.json +86 -55
- package/src/components/Badge/Badge.module.scss +80 -48
- package/src/components/Badge/index.tsx +34 -17
- package/src/components/BentoGrid/BentoGrid.contract.json +21 -45
- package/src/components/BentoGrid/BentoGrid.module.scss +4 -8
- package/src/components/Box/Box.contract.json +40 -148
- package/src/components/Box/Box.module.scss +7 -6
- package/src/components/Box/index.tsx +92 -99
- package/src/components/Breadcrumbs/Breadcrumbs.contract.json +21 -34
- package/src/components/Breadcrumbs/Breadcrumbs.module.scss +27 -12
- package/src/components/Breadcrumbs/index.tsx +5 -1
- package/src/components/Button/Button.module.scss +261 -185
- package/src/components/Button/index.tsx +41 -28
- package/src/components/ButtonGroup/ButtonGroup.contract.json +34 -49
- package/src/components/ButtonGroup/ButtonGroup.module.scss +8 -6
- package/src/components/Card/Card.consumer-fixture.module.scss +5 -2
- package/src/components/Card/Card.module.scss +97 -76
- package/src/components/Card/index.tsx +44 -20
- package/src/components/Chart/Chart.contract.json +21 -29
- package/src/components/Chart/Chart.module.scss +6 -5
- package/src/components/Chart/index.tsx +36 -6
- package/src/components/Checkbox/Checkbox.contract.json +28 -27
- package/src/components/Checkbox/Checkbox.module.scss +47 -54
- package/src/components/Checkbox/index.tsx +10 -10
- package/src/components/Chip/Chip.contract.json +38 -45
- package/src/components/Chip/Chip.module.scss +24 -23
- package/src/components/Chip/index.tsx +12 -7
- package/src/components/CodeBlock/CodeBlock.contract.json +46 -76
- package/src/components/CodeBlock/CodeBlock.module.scss +75 -73
- package/src/components/CodeBlock/css-variables-theme.ts +102 -0
- package/src/components/CodeBlock/index.tsx +114 -51
- package/src/components/Collapsible/Collapsible.contract.json +21 -36
- package/src/components/Collapsible/Collapsible.module.scss +1 -7
- package/src/components/ColorPicker/ColorPicker.contract.json +29 -48
- package/src/components/ColorPicker/ColorPicker.module.scss +34 -24
- package/src/components/ColorPicker/index.tsx +6 -1
- package/src/components/Combobox/Combobox.contract.json +36 -37
- package/src/components/Combobox/Combobox.module.scss +16 -19
- package/src/components/Combobox/index.tsx +41 -6
- package/src/components/Command/Command.contract.json +28 -44
- package/src/components/Command/Command.module.scss +19 -21
- package/src/components/Command/index.tsx +64 -47
- package/src/components/ComponentDefaults/ComponentDefaults.contract.json +91 -0
- package/src/components/ConversationList/ConversationList.contract.json +27 -32
- package/src/components/ConversationList/ConversationList.module.scss +2 -3
- package/src/components/ConversationList/index.tsx +2 -2
- package/src/components/DataTable/DataTable.icons.tsx +4 -21
- package/src/components/DataTable/DataTable.module.scss +24 -17
- package/src/components/DataTable/DataTable.virtual.tsx +3 -2
- package/src/components/DataTable/index.tsx +9 -8
- package/src/components/DatePicker/DatePicker.contract.json +27 -28
- package/src/components/DatePicker/DatePicker.module.scss +41 -44
- package/src/components/DatePicker/index.tsx +23 -9
- package/src/components/Dialog/Dialog.module.scss +26 -32
- package/src/components/Dialog/index.tsx +51 -39
- package/src/components/Drawer/Drawer.contract.json +28 -42
- package/src/components/Drawer/Drawer.module.scss +123 -64
- package/src/components/Drawer/index.tsx +7 -5
- package/src/components/Editor/Editor.contract.json +32 -49
- package/src/components/Editor/Editor.module.scss +60 -25
- package/src/components/Editor/index.tsx +240 -179
- package/src/components/EmptyState/EmptyState.contract.json +33 -45
- package/src/components/EmptyState/EmptyState.module.scss +37 -21
- package/src/components/EmptyState/index.tsx +56 -23
- package/src/components/Field/Field.contract.json +28 -46
- package/src/components/Field/Field.module.scss +2 -1
- package/src/components/Field/index.tsx +5 -1
- package/src/components/Fieldset/Fieldset.contract.json +21 -38
- package/src/components/Fieldset/Fieldset.module.scss +15 -7
- package/src/components/Form/Form.contract.json +23 -23
- package/src/components/Grid/Grid.contract.json +28 -64
- package/src/components/Grid/Grid.module.scss +2 -2
- package/src/components/Grid/index.tsx +10 -10
- package/src/components/Header/Header.contract.json +31 -67
- package/src/components/Header/Header.module.scss +57 -54
- package/src/components/Header/index.tsx +134 -122
- package/src/components/Icon/Icon.contract.json +37 -81
- package/src/components/Icon/Icon.module.scss +13 -12
- package/src/components/Icon/index.tsx +31 -31
- package/src/components/IconButton/IconButton.contract.json +37 -21
- package/src/components/IconButton/IconButton.module.scss +19 -11
- package/src/components/IconButton/index.tsx +6 -5
- package/src/components/Image/Image.contract.json +23 -56
- package/src/components/Input/Input.contract.json +25 -44
- package/src/components/Input/Input.module.scss +6 -55
- package/src/components/Input/index.tsx +2 -18
- package/src/components/Link/Link.contract.json +46 -58
- package/src/components/Link/Link.module.scss +41 -10
- package/src/components/Link/index.tsx +27 -6
- package/src/components/List/List.contract.json +33 -62
- package/src/components/List/List.module.scss +10 -5
- package/src/components/List/index.tsx +17 -13
- package/src/components/Listbox/Listbox.contract.json +21 -37
- package/src/components/Listbox/Listbox.module.scss +14 -20
- package/src/components/Loading/Loading.contract.json +41 -65
- package/src/components/Loading/Loading.module.scss +37 -31
- package/src/components/Loading/index.tsx +15 -14
- package/src/components/Main/Main.contract.json +17 -9
- package/src/components/Markdown/Markdown.contract.json +22 -43
- package/src/components/Markdown/Markdown.module.scss +45 -6
- package/src/components/Markdown/index.tsx +48 -49
- package/src/components/Menu/Menu.contract.json +30 -46
- package/src/components/Menu/Menu.module.scss +32 -16
- package/src/components/Message/Message.contract.json +31 -54
- package/src/components/Message/Message.module.scss +18 -9
- package/src/components/Message/index.tsx +2 -2
- package/src/components/NavigationMenu/NavigationMenu.contract.json +36 -45
- package/src/components/NavigationMenu/NavigationMenu.module.scss +66 -66
- package/src/components/NavigationMenu/index.tsx +105 -81
- package/src/components/Pagination/Pagination.contract.json +22 -40
- package/src/components/Pagination/Pagination.module.scss +9 -16
- package/src/components/Popover/Popover.contract.json +28 -50
- package/src/components/Popover/Popover.module.scss +30 -28
- package/src/components/Progress/Progress.contract.json +39 -35
- package/src/components/Progress/Progress.module.scss +16 -10
- package/src/components/Progress/index.tsx +34 -16
- package/src/components/Prompt/Prompt.contract.json +40 -56
- package/src/components/Prompt/Prompt.module.scss +49 -48
- package/src/components/Prompt/index.tsx +17 -15
- package/src/components/RadioGroup/RadioGroup.contract.json +29 -28
- package/src/components/RadioGroup/RadioGroup.module.scss +50 -45
- package/src/components/RadioGroup/index.tsx +23 -10
- package/src/components/ScrollArea/ScrollArea.contract.json +18 -19
- package/src/components/ScrollArea/ScrollArea.module.scss +45 -48
- package/src/components/ScrollArea/index.tsx +16 -16
- package/src/components/ScrollArea/scroll-state.ts +24 -24
- package/src/components/Select/Select.module.scss +20 -19
- package/src/components/Select/index.tsx +26 -24
- package/src/components/Separator/Separator.contract.json +29 -53
- package/src/components/Separator/Separator.module.scss +24 -40
- package/src/components/Separator/index.tsx +16 -11
- package/src/components/Sidebar/Sidebar.contract.json +35 -67
- package/src/components/Sidebar/Sidebar.module.scss +94 -88
- package/src/components/Sidebar/index.tsx +167 -167
- package/src/components/Skeleton/Skeleton.contract.json +34 -60
- package/src/components/Skeleton/Skeleton.module.scss +50 -26
- package/src/components/Skeleton/index.tsx +16 -15
- package/src/components/Slider/Slider.contract.json +27 -39
- package/src/components/Slider/Slider.module.scss +9 -22
- package/src/components/Stack/Stack.contract.json +30 -57
- package/src/components/Stack/Stack.module.scss +26 -24
- package/src/components/Stack/index.tsx +3 -3
- package/src/components/Switch/Switch.contract.json +33 -46
- package/src/components/Switch/Switch.module.scss +106 -59
- package/src/components/Table/Table.contract.json +28 -46
- package/src/components/Table/Table.module.scss +24 -16
- package/src/components/TableOfContents/TableOfContents.contract.json +34 -21
- package/src/components/TableOfContents/TableOfContents.module.scss +17 -13
- package/src/components/TableOfContents/index.tsx +27 -10
- package/src/components/Tabs/Tabs.contract.json +35 -56
- package/src/components/Tabs/Tabs.module.scss +27 -31
- package/src/components/Tabs/index.tsx +30 -15
- package/src/components/Text/Text.contract.json +52 -72
- package/src/components/Text/Text.module.scss +34 -18
- package/src/components/Text/index.tsx +123 -83
- package/src/components/Textarea/Textarea.contract.json +24 -55
- package/src/components/Textarea/Textarea.module.scss +22 -52
- package/src/components/Textarea/index.tsx +3 -14
- package/src/components/Theme/Theme.contract.json +35 -53
- package/src/components/Theme/index.tsx +41 -13
- package/src/components/ThemeToggle/ThemeButton.tsx +49 -0
- package/src/components/ThemeToggle/ThemeToggle.module.scss +20 -27
- package/src/components/ThemeToggle/icons.tsx +46 -0
- package/src/components/ThemeToggle/index.tsx +9 -55
- package/src/components/ThinkingIndicator/ThinkingIndicator.contract.json +34 -50
- package/src/components/ThinkingIndicator/ThinkingIndicator.module.scss +9 -7
- package/src/components/ThinkingIndicator/index.tsx +12 -14
- package/src/components/Toast/Toast.contract.json +55 -49
- package/src/components/Toast/Toast.module.scss +50 -105
- package/src/components/Toast/index.tsx +39 -34
- package/src/components/ToggleGroup/ToggleGroup.contract.json +39 -40
- package/src/components/ToggleGroup/ToggleGroup.module.scss +30 -27
- package/src/components/ToggleGroup/index.tsx +11 -11
- package/src/components/Tooltip/Tooltip.contract.json +31 -52
- package/src/components/Tooltip/Tooltip.module.scss +16 -10
- package/src/components/Tooltip/index.tsx +19 -24
- package/src/components/VisuallyHidden/VisuallyHidden.contract.json +22 -44
- package/src/components/VisuallyHidden/VisuallyHidden.module.scss +4 -14
- package/src/components/VisuallyHidden/index.tsx +5 -5
- package/src/index.ts +16 -12
- package/src/measurements/MeasurementTargets.module.scss +6 -7
- package/src/measurements/generated.ts +46 -97
- package/src/measurements/index.ts +0 -1
- package/src/measurements/measurements.json +44 -116
- package/src/recipes/_action.scss +4 -4
- package/src/recipes/_boolean-range.scss +12 -16
- package/src/recipes/_feedback.scss +17 -16
- package/src/recipes/_field.scss +28 -16
- package/src/recipes/_layout.scss +14 -7
- package/src/recipes/_navigation.scss +84 -29
- package/src/recipes/_overlay.scss +143 -43
- package/src/recipes/_popup.scss +54 -34
- package/src/recipes/_prose.scss +48 -28
- package/src/recipes/_representation.scss +10 -9
- package/src/recipes/_segmented.scss +1 -1
- package/src/recipes/_table-chrome.scss +42 -17
- package/src/recipes/_target.scss +2 -4
- package/src/recipes/_typography.scss +10 -0
- package/src/scss.d.ts +1 -1
- package/src/styles/globals.scss +31 -25
- package/src/tokens/_component-properties.scss +19 -1
- package/src/tokens/_computed.scss +32 -49
- package/src/tokens/_derive.scss +112 -210
- package/src/tokens/_measurements.catalog.generated.css +62 -44
- package/src/tokens/_measurements.generated.scss +119 -249
- package/src/tokens/_mixins.scss +49 -48
- package/src/tokens/_palettes.scss +39 -167
- package/src/tokens/_property-registrations.scss +9 -0
- package/src/tokens/_seeds.scss +20 -31
- package/src/tokens/_variables.scss +251 -94
- package/src/utils/a11y.tsx +69 -69
- package/src/utils/aria.ts +3 -3
- package/src/utils/canonical-stamp.ts +2 -12
- package/src/utils/css-warning.ts +7 -7
- package/src/utils/env.ts +25 -0
- package/src/utils/keyboard-shortcuts.ts +131 -126
- package/src/utils/seed-derivation.ts +11 -14
- package/src/utils/theme-presets.ts +5 -12
- package/dist/blocks/AccountSettings.block.d.ts +0 -3
- package/dist/blocks/AccountSettings.block.d.ts.map +0 -1
- package/dist/blocks/ActivityFeedSkeleton.block.d.ts +0 -3
- package/dist/blocks/ActivityFeedSkeleton.block.d.ts.map +0 -1
- package/dist/blocks/BlogEditor.block.d.ts +0 -3
- package/dist/blocks/BlogEditor.block.d.ts.map +0 -1
- package/dist/blocks/ChatInterface.block.d.ts +0 -3
- package/dist/blocks/ChatInterface.block.d.ts.map +0 -1
- package/dist/blocks/ChatMessages.block.d.ts +0 -3
- package/dist/blocks/ChatMessages.block.d.ts.map +0 -1
- package/dist/blocks/CheckoutForm.block.d.ts +0 -3
- package/dist/blocks/CheckoutForm.block.d.ts.map +0 -1
- package/dist/blocks/CommandPalette.block.d.ts +0 -3
- package/dist/blocks/CommandPalette.block.d.ts.map +0 -1
- package/dist/blocks/ContactForm.block.d.ts +0 -3
- package/dist/blocks/ContactForm.block.d.ts.map +0 -1
- package/dist/blocks/DashboardPage.block.d.ts +0 -3
- package/dist/blocks/DashboardPage.block.d.ts.map +0 -1
- package/dist/blocks/DashboardSkeleton.block.d.ts +0 -3
- package/dist/blocks/DashboardSkeleton.block.d.ts.map +0 -1
- package/dist/blocks/DataTable.block.d.ts +0 -3
- package/dist/blocks/DataTable.block.d.ts.map +0 -1
- package/dist/blocks/EmptyState.block.d.ts +0 -3
- package/dist/blocks/EmptyState.block.d.ts.map +0 -1
- package/dist/blocks/FAQSection.block.d.ts +0 -3
- package/dist/blocks/FAQSection.block.d.ts.map +0 -1
- package/dist/blocks/FeatureGrid.block.d.ts +0 -3
- package/dist/blocks/FeatureGrid.block.d.ts.map +0 -1
- package/dist/blocks/HeroSection.block.d.ts +0 -3
- package/dist/blocks/HeroSection.block.d.ts.map +0 -1
- package/dist/blocks/NavigationHeader.block.d.ts +0 -3
- package/dist/blocks/NavigationHeader.block.d.ts.map +0 -1
- package/dist/blocks/PaginatedTable.block.d.ts +0 -3
- package/dist/blocks/PaginatedTable.block.d.ts.map +0 -1
- package/dist/blocks/PricingComparison.block.d.ts +0 -3
- package/dist/blocks/PricingComparison.block.d.ts.map +0 -1
- package/dist/blocks/ProductCard.block.d.ts +0 -3
- package/dist/blocks/ProductCard.block.d.ts.map +0 -1
- package/dist/blocks/RegistrationForm.block.d.ts +0 -3
- package/dist/blocks/RegistrationForm.block.d.ts.map +0 -1
- package/dist/blocks/SettingsDrawer.block.d.ts +0 -3
- package/dist/blocks/SettingsDrawer.block.d.ts.map +0 -1
- package/dist/blocks/SettingsPanel.block.d.ts +0 -3
- package/dist/blocks/SettingsPanel.block.d.ts.map +0 -1
- package/dist/blocks/ShoppingCart.block.d.ts +0 -3
- package/dist/blocks/ShoppingCart.block.d.ts.map +0 -1
- package/dist/blocks/StatsCardSkeleton.block.d.ts +0 -3
- package/dist/blocks/StatsCardSkeleton.block.d.ts.map +0 -1
- package/dist/blocks/TableSkeleton.block.d.ts +0 -3
- package/dist/blocks/TableSkeleton.block.d.ts.map +0 -1
- package/dist/blocks/ThinkingStates.block.d.ts +0 -3
- package/dist/blocks/ThinkingStates.block.d.ts.map +0 -1
- package/dist/components/Toggle/index.d.ts +0 -3
- package/dist/components/Toggle/index.d.ts.map +0 -1
- package/src/components/Button/Button.contract.json +0 -218
- package/src/components/Card/Card.contract.json +0 -175
- package/src/components/DataTable/DataTable.contract.json +0 -302
- package/src/components/Dialog/Dialog.contract.json +0 -159
- package/src/components/Select/Select.contract.json +0 -259
- package/src/components/Toggle/index.ts +0 -7
- package/src/tokens/_density.scss +0 -85
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use "../../tokens/measurements.generated" as measurements;
|
|
1
2
|
@use "../../tokens/variables" as *;
|
|
2
3
|
@use "../../tokens/mixins" as *;
|
|
3
4
|
@use "../../recipes/navigation" as navigation;
|
|
@@ -10,19 +11,24 @@
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.title {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
@include navigation.properties;
|
|
15
|
+
|
|
16
|
+
margin: 0 0 var(--fui-space-2, #{$fui-space-2});
|
|
17
|
+
// Same inline inset as `.link` (navigation.row) so the label and the index
|
|
18
|
+
// share one left edge — extra title padding made "On This Page" sit inward
|
|
19
|
+
// of the items below it.
|
|
20
|
+
padding-inline: var(--fui-navigation-inline-inset, #{navigation.gutter()});
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
// The quiet index is flush; links and group headers share the title inset.
|
|
18
24
|
.list {
|
|
19
25
|
list-style: none;
|
|
20
|
-
margin: 0;
|
|
21
|
-
padding: 0;
|
|
26
|
+
margin: var(--fui-raw-space-0, #{measurements.raw-space(0)});
|
|
27
|
+
padding: var(--fui-raw-space-0, #{measurements.raw-space(0)});
|
|
22
28
|
position: relative;
|
|
23
29
|
display: flex;
|
|
24
30
|
flex-direction: column;
|
|
25
|
-
gap: var(--fui-stroke-hairline,
|
|
31
|
+
gap: var(--fui-stroke-hairline, #{$fui-stroke-hairline});
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
// ============================================
|
|
@@ -48,7 +54,7 @@
|
|
|
48
54
|
color var(--fui-transition-fast, $fui-transition-fast);
|
|
49
55
|
|
|
50
56
|
&:hover {
|
|
51
|
-
background-color: var(--fui-bg-hover, $fui-bg-hover);
|
|
57
|
+
background-color: var(--fui-bg-hover, #{$fui-bg-hover});
|
|
52
58
|
color: var(--fui-text-primary, $fui-text-primary);
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -61,7 +67,7 @@
|
|
|
61
67
|
// flush with the title and group headers.
|
|
62
68
|
[data-depth="1"] .link {
|
|
63
69
|
margin-left: var(--fui-space-2, $fui-space-2);
|
|
64
|
-
padding-inline-start: var(--fui-raw-space-16,
|
|
70
|
+
padding-inline-start: var(--fui-raw-space-16, #{measurements.raw-space(16)});
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
.linkLabel {
|
|
@@ -107,7 +113,6 @@
|
|
|
107
113
|
width: 100%;
|
|
108
114
|
border-radius: var(--fui-radius-md, $fui-radius-md);
|
|
109
115
|
color: var(--fui-text-tertiary, $fui-text-tertiary);
|
|
110
|
-
text-transform: uppercase;
|
|
111
116
|
background: transparent;
|
|
112
117
|
border: 0;
|
|
113
118
|
text-align: left;
|
|
@@ -122,7 +127,7 @@
|
|
|
122
127
|
color var(--fui-transition-fast, $fui-transition-fast);
|
|
123
128
|
|
|
124
129
|
&:hover {
|
|
125
|
-
background-color: var(--fui-bg-hover, $fui-bg-hover);
|
|
130
|
+
background-color: var(--fui-bg-hover, #{$fui-bg-hover});
|
|
126
131
|
color: var(--fui-text-secondary, $fui-text-secondary);
|
|
127
132
|
}
|
|
128
133
|
|
|
@@ -142,12 +147,12 @@
|
|
|
142
147
|
width: var(--fui-icon-xs, $fui-icon-xs);
|
|
143
148
|
height: var(--fui-icon-xs, $fui-icon-xs);
|
|
144
149
|
color: inherit;
|
|
145
|
-
opacity:
|
|
150
|
+
opacity: var(--fui-opacity-muted, #{$fui-opacity-muted});
|
|
146
151
|
transition: transform var(--fui-transition-fast, $fui-transition-fast);
|
|
147
152
|
|
|
148
153
|
svg {
|
|
149
|
-
width: var(--fui-raw-space-10,
|
|
150
|
-
height: var(--fui-raw-space-10,
|
|
154
|
+
width: var(--fui-raw-space-10, #{measurements.raw-space(10)});
|
|
155
|
+
height: var(--fui-raw-space-10, #{measurements.raw-space(10)});
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
&[data-open] {
|
|
@@ -169,5 +174,4 @@
|
|
|
169
174
|
.groupChevron {
|
|
170
175
|
transition: none;
|
|
171
176
|
}
|
|
172
|
-
|
|
173
177
|
}
|
|
@@ -16,6 +16,8 @@ export interface TableOfContentsProps extends React.HTMLAttributes<HTMLElement>
|
|
|
16
16
|
title?: string;
|
|
17
17
|
/** Hide the title */
|
|
18
18
|
hideTitle?: boolean;
|
|
19
|
+
/** Hide indented items and nested groups. Defaults to false. */
|
|
20
|
+
hideSubItems?: boolean;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export interface TableOfContentsItemProps extends Omit<
|
|
@@ -63,9 +65,10 @@ export interface TableOfContentsGroupProps {
|
|
|
63
65
|
|
|
64
66
|
interface TocContextValue {
|
|
65
67
|
depth: number;
|
|
68
|
+
hideSubItems: boolean;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
const TocContext = React.createContext<TocContextValue>({ depth: 0 });
|
|
71
|
+
const TocContext = React.createContext<TocContextValue>({ depth: 0, hideSubItems: false });
|
|
69
72
|
|
|
70
73
|
// ============================================
|
|
71
74
|
// Icons
|
|
@@ -95,6 +98,7 @@ function TableOfContentsRoot({
|
|
|
95
98
|
label = "Table of contents",
|
|
96
99
|
title = "On This Page",
|
|
97
100
|
hideTitle = false,
|
|
101
|
+
hideSubItems = false,
|
|
98
102
|
className,
|
|
99
103
|
"aria-label": ariaLabel,
|
|
100
104
|
...htmlProps
|
|
@@ -104,11 +108,11 @@ function TableOfContentsRoot({
|
|
|
104
108
|
return (
|
|
105
109
|
<nav {...htmlProps} aria-label={ariaLabel ?? label} className={classes}>
|
|
106
110
|
{!hideTitle && (
|
|
107
|
-
<Text as="p"
|
|
111
|
+
<Text as="p" role="section-label" className={styles.title}>
|
|
108
112
|
{title}
|
|
109
113
|
</Text>
|
|
110
114
|
)}
|
|
111
|
-
<TocContext.Provider value={{ depth: 0 }}>
|
|
115
|
+
<TocContext.Provider value={{ depth: 0, hideSubItems }}>
|
|
112
116
|
<ul className={styles.list}>{children}</ul>
|
|
113
117
|
</TocContext.Provider>
|
|
114
118
|
</nav>
|
|
@@ -124,22 +128,29 @@ function TableOfContentsItem({
|
|
|
124
128
|
trailing,
|
|
125
129
|
className,
|
|
126
130
|
onClick,
|
|
127
|
-
href
|
|
131
|
+
href,
|
|
128
132
|
...htmlProps
|
|
129
133
|
}: TableOfContentsItemProps) {
|
|
130
|
-
const { depth } = React.useContext(TocContext);
|
|
134
|
+
const { depth, hideSubItems } = React.useContext(TocContext);
|
|
131
135
|
const effectiveDepth = depth > 0 ? depth : indent ? 1 : 0;
|
|
132
136
|
|
|
137
|
+
if (hideSubItems && effectiveDepth > 0) return null;
|
|
138
|
+
|
|
133
139
|
const linkClasses = [styles.link, active && styles.active, className].filter(Boolean).join(" ");
|
|
134
140
|
|
|
135
141
|
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
136
142
|
onClick?.(e);
|
|
137
|
-
|
|
143
|
+
// An explicit href is a route, not an in-page anchor: let the browser
|
|
144
|
+
// (or a wrapping router link) own navigation.
|
|
145
|
+
if (e.defaultPrevented || href) return;
|
|
138
146
|
|
|
139
147
|
e.preventDefault();
|
|
140
148
|
const el = document.getElementById(id);
|
|
141
149
|
if (el) {
|
|
142
|
-
|
|
150
|
+
const prefersReducedMotion =
|
|
151
|
+
typeof window.matchMedia === "function" &&
|
|
152
|
+
window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
153
|
+
el.scrollIntoView({ behavior: prefersReducedMotion ? "auto" : "smooth" });
|
|
143
154
|
window.history.replaceState(null, "", `#${id}`);
|
|
144
155
|
}
|
|
145
156
|
};
|
|
@@ -148,7 +159,7 @@ function TableOfContentsItem({
|
|
|
148
159
|
<li className={styles.item} data-depth={effectiveDepth} data-active={active || undefined}>
|
|
149
160
|
<a
|
|
150
161
|
{...htmlProps}
|
|
151
|
-
href={`#${id}`}
|
|
162
|
+
href={href ?? `#${id}`}
|
|
152
163
|
className={linkClasses}
|
|
153
164
|
onClick={handleClick}
|
|
154
165
|
aria-current={active ? "location" : undefined}
|
|
@@ -194,9 +205,11 @@ function TableOfContentsGroup({
|
|
|
194
205
|
disabled = false,
|
|
195
206
|
active = false,
|
|
196
207
|
}: TableOfContentsGroupProps) {
|
|
197
|
-
const { depth } = React.useContext(TocContext);
|
|
208
|
+
const { depth, hideSubItems } = React.useContext(TocContext);
|
|
198
209
|
const [open, setOpen] = useControlledOpen(controlledOpen, defaultOpen, onOpenChange);
|
|
199
210
|
|
|
211
|
+
if (hideSubItems) return null;
|
|
212
|
+
|
|
200
213
|
const isToggleable = collapsible && !disabled;
|
|
201
214
|
const isOpen = isToggleable ? open : true;
|
|
202
215
|
|
|
@@ -237,7 +250,11 @@ function TableOfContentsGroup({
|
|
|
237
250
|
<div className={headerClasses}>{headerContent}</div>
|
|
238
251
|
)}
|
|
239
252
|
</li>
|
|
240
|
-
{isOpen &&
|
|
253
|
+
{isOpen && (
|
|
254
|
+
<TocContext.Provider value={{ depth: depth + 1, hideSubItems }}>
|
|
255
|
+
{children}
|
|
256
|
+
</TocContext.Provider>
|
|
257
|
+
)}
|
|
241
258
|
</>
|
|
242
259
|
);
|
|
243
260
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://usefragments.com/schemas/contract.v1.json",
|
|
3
3
|
"name": "Tabs",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Swaps between sibling panels without leaving the page.",
|
|
5
5
|
"category": "navigation",
|
|
6
|
-
"tags": [
|
|
7
|
-
"tabs",
|
|
8
|
-
"navigation",
|
|
9
|
-
"panels",
|
|
10
|
-
"content-switcher"
|
|
11
|
-
],
|
|
6
|
+
"tags": ["tabs", "navigation", "panels", "content-switcher"],
|
|
12
7
|
"status": "stable",
|
|
13
8
|
"sourcePath": "src/components/Tabs/index.tsx",
|
|
14
9
|
"exportName": "Tabs",
|
|
@@ -18,7 +13,7 @@
|
|
|
18
13
|
"value: string",
|
|
19
14
|
"onValueChange: function",
|
|
20
15
|
"orientation: horizontal|vertical (default: horizontal)",
|
|
21
|
-
"variant:
|
|
16
|
+
"variant: ghost|soft (default: ghost)"
|
|
22
17
|
],
|
|
23
18
|
"props": {
|
|
24
19
|
"children": {
|
|
@@ -46,41 +41,35 @@
|
|
|
46
41
|
"description": "Tab list orientation",
|
|
47
42
|
"default": "horizontal",
|
|
48
43
|
"required": false,
|
|
49
|
-
"values": [
|
|
50
|
-
"horizontal",
|
|
51
|
-
"vertical"
|
|
52
|
-
]
|
|
44
|
+
"values": ["horizontal", "vertical"]
|
|
53
45
|
},
|
|
54
46
|
"variant": {
|
|
55
47
|
"type": "enum",
|
|
56
|
-
"description": "Default
|
|
57
|
-
"default": "
|
|
48
|
+
"description": "Default chrome for Tabs.List (can be overridden on Tabs.List): ghost draws a rule under the active tab, soft is a filled rail with a selected segment",
|
|
49
|
+
"default": "ghost",
|
|
58
50
|
"required": false,
|
|
59
|
-
"values": [
|
|
60
|
-
"underline",
|
|
61
|
-
"pills"
|
|
62
|
-
]
|
|
51
|
+
"values": ["ghost", "soft"]
|
|
63
52
|
}
|
|
64
53
|
},
|
|
65
54
|
"usage": {
|
|
66
55
|
"when": [
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"Settings
|
|
70
|
-
"
|
|
56
|
+
"Sibling sections of equal weight",
|
|
57
|
+
"Cutting scroll on a long page",
|
|
58
|
+
"Settings split by category",
|
|
59
|
+
"One data set seen several ways"
|
|
71
60
|
],
|
|
72
61
|
"whenNot": [
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
62
|
+
"Moving between pages (use Sidebar or header navigation)",
|
|
63
|
+
"Steps in an order (use Stepper)",
|
|
64
|
+
"Content the user compares side by side",
|
|
65
|
+
"More options than fit in a row (use Select)"
|
|
77
66
|
],
|
|
78
67
|
"guidelines": [
|
|
79
|
-
"
|
|
80
|
-
"Order
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
68
|
+
"One or two words per label",
|
|
69
|
+
"Order by how often each panel is used",
|
|
70
|
+
"Past five or six tabs, split the page instead",
|
|
71
|
+
"Keep panels comparable in depth",
|
|
72
|
+
"Soft rails inside cards, ghost at page level"
|
|
84
73
|
],
|
|
85
74
|
"accessibility": [
|
|
86
75
|
"Keyboard navigation with arrow keys",
|
|
@@ -90,24 +79,24 @@
|
|
|
90
79
|
},
|
|
91
80
|
"examples": [
|
|
92
81
|
{
|
|
93
|
-
"name": "
|
|
94
|
-
"description": "
|
|
95
|
-
"code": "<Tabs defaultValue=\"overview\" variant=\"
|
|
82
|
+
"name": "Ghost",
|
|
83
|
+
"description": "A rule tracks the active panel.",
|
|
84
|
+
"code": "<Tabs defaultValue=\"overview\" variant=\"ghost\">\n <Tabs.List>\n <Tabs.Tab value=\"overview\">Overview</Tabs.Tab>\n <Tabs.Tab value=\"analytics\">Analytics</Tabs.Tab>\n <Tabs.Tab value=\"settings\">Settings</Tabs.Tab>\n </Tabs.List>\n <Tabs.Panel value=\"overview\">\n <p>Overview content goes here.</p>\n </Tabs.Panel>\n <Tabs.Panel value=\"analytics\">\n <p>Analytics content goes here.</p>\n </Tabs.Panel>\n <Tabs.Panel value=\"settings\">\n <p>Settings content goes here.</p>\n </Tabs.Panel>\n</Tabs>"
|
|
96
85
|
},
|
|
97
86
|
{
|
|
98
|
-
"name": "
|
|
99
|
-
"description": "
|
|
100
|
-
"code": "<Tabs defaultValue=\"all\" variant=\"
|
|
87
|
+
"name": "Soft",
|
|
88
|
+
"description": "A filled rail suits panels inside a card.",
|
|
89
|
+
"code": "<Tabs defaultValue=\"all\" variant=\"soft\">\n <Tabs.List>\n <Tabs.Tab value=\"all\">All</Tabs.Tab>\n <Tabs.Tab value=\"active\">Active</Tabs.Tab>\n <Tabs.Tab value=\"archived\">Archived</Tabs.Tab>\n </Tabs.List>\n <Tabs.Panel value=\"all\">\n <p>Showing all items.</p>\n </Tabs.Panel>\n <Tabs.Panel value=\"active\">\n <p>Showing active items only.</p>\n </Tabs.Panel>\n <Tabs.Panel value=\"archived\">\n <p>Showing archived items.</p>\n </Tabs.Panel>\n</Tabs>"
|
|
101
90
|
},
|
|
102
91
|
{
|
|
103
92
|
"name": "With Disabled",
|
|
104
|
-
"description": "
|
|
105
|
-
"code": "<Tabs defaultValue=\"general\" variant=\"
|
|
93
|
+
"description": "An unavailable panel stays visible but unreachable.",
|
|
94
|
+
"code": "<Tabs defaultValue=\"general\" variant=\"ghost\">\n <Tabs.List>\n <Tabs.Tab value=\"general\">General</Tabs.Tab>\n <Tabs.Tab value=\"security\">Security</Tabs.Tab>\n <Tabs.Tab value=\"billing\" disabled>Billing</Tabs.Tab>\n </Tabs.List>\n <Tabs.Panel value=\"general\">\n <p>General settings panel.</p>\n </Tabs.Panel>\n <Tabs.Panel value=\"security\">\n <p>Security settings panel.</p>\n </Tabs.Panel>\n</Tabs>"
|
|
106
95
|
},
|
|
107
96
|
{
|
|
108
97
|
"name": "List Variant Override",
|
|
109
|
-
"description": "
|
|
110
|
-
"code": "<Tabs defaultValue=\"overview\" variant=\"
|
|
98
|
+
"description": "One list can opt out of the root's style.",
|
|
99
|
+
"code": "<Tabs defaultValue=\"overview\" variant=\"soft\">\n <Tabs.List variant=\"ghost\">\n <Tabs.Tab value=\"overview\">Overview</Tabs.Tab>\n <Tabs.Tab value=\"activity\">Activity</Tabs.Tab>\n </Tabs.List>\n <Tabs.Panel value=\"overview\">\n <p>Root sets soft, but this list overrides to ghost.</p>\n </Tabs.Panel>\n <Tabs.Panel value=\"activity\">\n <p>Per-list variant override example.</p>\n </Tabs.Panel>\n</Tabs>"
|
|
111
100
|
}
|
|
112
101
|
],
|
|
113
102
|
"relations": [
|
|
@@ -127,25 +116,15 @@
|
|
|
127
116
|
"value: string - controlled active tab",
|
|
128
117
|
"defaultValue: string - initial active tab",
|
|
129
118
|
"onValueChange: (value) => void - tab change handler",
|
|
130
|
-
"variant:
|
|
131
|
-
"Tabs.List variant?:
|
|
119
|
+
"variant: ghost|soft - default chrome for Tabs.List",
|
|
120
|
+
"Tabs.List variant?: ghost|soft - optional per-list override"
|
|
132
121
|
],
|
|
133
|
-
"a11yRules": [
|
|
134
|
-
"A11Y_TABS_KEYBOARD",
|
|
135
|
-
"A11Y_TABS_LABELS"
|
|
136
|
-
]
|
|
122
|
+
"a11yRules": ["A11Y_TABS_KEYBOARD", "A11Y_TABS_LABELS"]
|
|
137
123
|
},
|
|
138
124
|
"ai": {
|
|
139
125
|
"compositionPattern": "compound",
|
|
140
|
-
"subComponents": [
|
|
141
|
-
|
|
142
|
-
"Tab",
|
|
143
|
-
"Panel"
|
|
144
|
-
],
|
|
145
|
-
"requiredChildren": [
|
|
146
|
-
"List",
|
|
147
|
-
"Panel"
|
|
148
|
-
],
|
|
126
|
+
"subComponents": ["List", "Tab", "Panel"],
|
|
127
|
+
"requiredChildren": ["List", "Panel"],
|
|
149
128
|
"commonPatterns": [
|
|
150
129
|
"<Tabs defaultValue=\"tab1\"><Tabs.List><Tabs.Tab value=\"tab1\">{label1}</Tabs.Tab><Tabs.Tab value=\"tab2\">{label2}</Tabs.Tab></Tabs.List><Tabs.Panel value=\"tab1\">{content1}</Tabs.Panel><Tabs.Panel value=\"tab2\">{content2}</Tabs.Panel></Tabs>"
|
|
151
130
|
]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use "../../tokens/variables" as *;
|
|
2
2
|
@use "../../tokens/mixins" as *;
|
|
3
|
+
@use "../../tokens/measurements.generated" as measurements;
|
|
3
4
|
@use "../../recipes/layout";
|
|
4
5
|
@use "../../recipes/segmented";
|
|
5
6
|
|
|
@@ -14,37 +15,39 @@
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
// Tab list container
|
|
18
|
+
// Tab list container (ghost: a rule under the row, the indicator tracks the active tab)
|
|
18
19
|
.list {
|
|
19
20
|
position: relative;
|
|
20
21
|
display: flex;
|
|
21
22
|
align-items: center;
|
|
22
23
|
gap: layout.gap("xs");
|
|
23
|
-
border-bottom: var(--fui-stroke-hairline,
|
|
24
|
+
border-bottom: var(--fui-stroke-hairline, #{$fui-stroke-hairline}) solid
|
|
25
|
+
var(--fui-border, $fui-border);
|
|
24
26
|
padding-inline: layout.gap("xs");
|
|
25
27
|
|
|
26
28
|
&[data-orientation="vertical"] {
|
|
27
29
|
flex-direction: column;
|
|
28
30
|
align-items: stretch;
|
|
29
31
|
border-bottom: none;
|
|
30
|
-
border-right: var(--fui-stroke-hairline,
|
|
32
|
+
border-right: var(--fui-stroke-hairline, #{$fui-stroke-hairline}) solid
|
|
33
|
+
var(--fui-border, $fui-border);
|
|
31
34
|
padding-block: layout.gap("xs");
|
|
32
|
-
padding-inline: 0;
|
|
35
|
+
padding-inline: var(--fui-raw-space-0, #{measurements.raw-space(0)});
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
// Variant:
|
|
37
|
-
.
|
|
39
|
+
// Variant: soft (filled rail with a selected segment)
|
|
40
|
+
.listSoft {
|
|
38
41
|
border-bottom: none;
|
|
39
42
|
border: 0;
|
|
40
43
|
background-color: var(
|
|
41
44
|
--fui-tabs-pills-bg,
|
|
42
45
|
color-mix(in srgb, var(--fui-text-primary, #{$fui-text-primary}) 5%, transparent)
|
|
43
46
|
);
|
|
44
|
-
border-radius: var(--fui-radius-
|
|
45
|
-
padding: 0;
|
|
46
|
-
gap: 0;
|
|
47
|
-
box-shadow: inset 0 0 0
|
|
47
|
+
border-radius: var(--fui-radius-l1, $fui-radius-l1);
|
|
48
|
+
padding: var(--fui-raw-space-0, #{measurements.raw-space(0)});
|
|
49
|
+
gap: var(--fui-raw-space-0, #{measurements.raw-space(0)});
|
|
50
|
+
box-shadow: inset 0 0 0 var(--fui-stroke-hairline, #{$fui-stroke-hairline})
|
|
48
51
|
var(
|
|
49
52
|
--fui-tabs-pills-border,
|
|
50
53
|
color-mix(in srgb, var(--fui-border, #{$fui-border}) 72%, transparent)
|
|
@@ -52,11 +55,6 @@
|
|
|
52
55
|
width: fit-content;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
// Variant: underline (default, with indicator line)
|
|
56
|
-
.listUnderline {
|
|
57
|
-
// Default styles already applied to .list
|
|
58
|
-
}
|
|
59
|
-
|
|
60
58
|
// Individual tab button
|
|
61
59
|
.tab {
|
|
62
60
|
@include button-reset;
|
|
@@ -65,7 +63,7 @@
|
|
|
65
63
|
position: relative;
|
|
66
64
|
color: var(--fui-text-secondary, $fui-text-secondary);
|
|
67
65
|
white-space: nowrap;
|
|
68
|
-
border-radius: var(--fui-radius-
|
|
66
|
+
border-radius: var(--fui-radius-l3, $fui-radius-l3);
|
|
69
67
|
|
|
70
68
|
&:hover:not([data-disabled]) {
|
|
71
69
|
color: var(--fui-text-primary, $fui-text-primary);
|
|
@@ -105,18 +103,18 @@
|
|
|
105
103
|
}
|
|
106
104
|
}
|
|
107
105
|
|
|
108
|
-
// Tab in
|
|
109
|
-
.
|
|
110
|
-
border-radius:
|
|
106
|
+
// Tab in the ghost variant: the indicator carries the selection, the tab stays flat
|
|
107
|
+
.tabGhost {
|
|
108
|
+
border-radius: var(--fui-radius-none, #{$fui-radius-none});
|
|
111
109
|
|
|
112
110
|
&:hover:not([data-disabled]) {
|
|
113
111
|
background-color: transparent;
|
|
114
112
|
}
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
// Tab in
|
|
118
|
-
.
|
|
119
|
-
border-radius: var(--fui-radius-
|
|
115
|
+
// Tab in the soft variant: a segment on the rail
|
|
116
|
+
.tabSoft {
|
|
117
|
+
border-radius: var(--fui-radius-l2, $fui-radius-l2);
|
|
120
118
|
transition:
|
|
121
119
|
background-color var(--fui-transition-fast, $fui-transition-fast),
|
|
122
120
|
color var(--fui-transition-fast, $fui-transition-fast),
|
|
@@ -128,18 +126,16 @@
|
|
|
128
126
|
}
|
|
129
127
|
|
|
130
128
|
&[data-active] {
|
|
131
|
-
|
|
132
|
-
color: var(--fui-text-primary, $fui-text-primary);
|
|
133
|
-
box-shadow: var(--fui-tabs-pill-active-shadow, none);
|
|
129
|
+
@include segmented-selection;
|
|
134
130
|
}
|
|
135
131
|
}
|
|
136
132
|
|
|
137
|
-
// Animated indicator (
|
|
133
|
+
// Animated indicator (ghost variant)
|
|
138
134
|
.indicator {
|
|
139
135
|
position: absolute;
|
|
140
136
|
bottom: 0;
|
|
141
137
|
left: 0;
|
|
142
|
-
height: var(--fui-stroke-default,
|
|
138
|
+
height: var(--fui-stroke-default, #{$fui-stroke-default});
|
|
143
139
|
background-color: var(--fui-color-accent, $fui-color-accent);
|
|
144
140
|
border-radius: var(--fui-radius-full, $fui-radius-full);
|
|
145
141
|
|
|
@@ -155,7 +151,7 @@
|
|
|
155
151
|
left: auto;
|
|
156
152
|
right: 0;
|
|
157
153
|
top: 0;
|
|
158
|
-
width: var(--fui-stroke-default,
|
|
154
|
+
width: var(--fui-stroke-default, #{$fui-stroke-default});
|
|
159
155
|
height: var(--active-tab-height);
|
|
160
156
|
transform: translateY(var(--active-tab-top));
|
|
161
157
|
}
|
|
@@ -164,7 +160,7 @@
|
|
|
164
160
|
// Tab panel content
|
|
165
161
|
.panel {
|
|
166
162
|
padding-block: layout.gap("sm");
|
|
167
|
-
padding-inline: 0;
|
|
163
|
+
padding-inline: var(--fui-raw-space-0, #{measurements.raw-space(0)});
|
|
168
164
|
outline: none;
|
|
169
165
|
|
|
170
166
|
&[data-hidden] {
|
|
@@ -174,11 +170,11 @@
|
|
|
174
170
|
// Focus visible for keyboard navigation
|
|
175
171
|
&:focus-visible {
|
|
176
172
|
@include focus-ring;
|
|
177
|
-
border-radius: var(--fui-radius-
|
|
173
|
+
border-radius: var(--fui-radius-l2, $fui-radius-l2);
|
|
178
174
|
}
|
|
179
175
|
}
|
|
180
176
|
|
|
181
177
|
// Panel with no padding (for custom layouts)
|
|
182
178
|
.panelFlush {
|
|
183
|
-
padding: 0;
|
|
179
|
+
padding: var(--fui-raw-space-0, #{measurements.raw-space(0)});
|
|
184
180
|
}
|
|
@@ -10,6 +10,7 @@ import styles from "./Tabs.module.scss";
|
|
|
10
10
|
// ============================================
|
|
11
11
|
|
|
12
12
|
export type TabValue = string;
|
|
13
|
+
export type TabsVariant = "ghost" | "soft";
|
|
13
14
|
export type TabsChangeEventDetails = Parameters<
|
|
14
15
|
NonNullable<React.ComponentProps<typeof BaseTabs.Root>["onValueChange"]>
|
|
15
16
|
>[1];
|
|
@@ -29,19 +30,20 @@ export interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "d
|
|
|
29
30
|
/** Tab layout direction.
|
|
30
31
|
* @default "horizontal" */
|
|
31
32
|
orientation?: "horizontal" | "vertical";
|
|
32
|
-
/** Tab list
|
|
33
|
-
*
|
|
34
|
-
|
|
33
|
+
/** Tab list chrome (default for Tabs.List): `ghost` draws a rule under the
|
|
34
|
+
* active tab, `soft` is a filled rail with a selected segment.
|
|
35
|
+
* @default "ghost" */
|
|
36
|
+
variant?: TabsVariant;
|
|
35
37
|
/** Tab control size. Defaults to the component-default control size. */
|
|
36
38
|
size?: ControlSize;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export interface TabsListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
40
42
|
children: React.ReactNode;
|
|
41
|
-
/** Tab list
|
|
42
|
-
* @default "
|
|
43
|
+
/** Tab list chrome.
|
|
44
|
+
* @default "ghost"
|
|
43
45
|
* @see https://usefragments.com/components/tabs#variants */
|
|
44
|
-
variant?:
|
|
46
|
+
variant?: TabsVariant;
|
|
45
47
|
/** Tab control size. Defaults to the nearest Tabs root or provider default. */
|
|
46
48
|
size?: ControlSize;
|
|
47
49
|
}
|
|
@@ -64,7 +66,7 @@ export interface TabsPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
64
66
|
// Context for variant
|
|
65
67
|
// ============================================
|
|
66
68
|
|
|
67
|
-
const TabsVariantContext = React.createContext<
|
|
69
|
+
const TabsVariantContext = React.createContext<TabsVariant>("ghost");
|
|
68
70
|
const TabsSizeContext = React.createContext<ControlSize>("md");
|
|
69
71
|
|
|
70
72
|
// ============================================
|
|
@@ -77,7 +79,7 @@ function TabsRoot({
|
|
|
77
79
|
value,
|
|
78
80
|
onValueChange,
|
|
79
81
|
orientation = "horizontal",
|
|
80
|
-
variant = "
|
|
82
|
+
variant = "ghost",
|
|
81
83
|
size: sizeProp,
|
|
82
84
|
className,
|
|
83
85
|
...htmlProps
|
|
@@ -95,6 +97,7 @@ function TabsRoot({
|
|
|
95
97
|
onValueChange={onValueChange}
|
|
96
98
|
orientation={orientation}
|
|
97
99
|
className={classes}
|
|
100
|
+
data-slot="tabs"
|
|
98
101
|
>
|
|
99
102
|
{children}
|
|
100
103
|
</BaseTabs.Root>
|
|
@@ -108,15 +111,21 @@ function TabsList({ children, variant, size: sizeProp, className, ...htmlProps }
|
|
|
108
111
|
const rootSize = React.useContext(TabsSizeContext);
|
|
109
112
|
const size = sizeProp ?? rootSize;
|
|
110
113
|
const resolvedVariant = variant ?? rootVariant;
|
|
111
|
-
const
|
|
112
|
-
|
|
114
|
+
const classes = [styles.list, resolvedVariant === "soft" && styles.listSoft, className]
|
|
115
|
+
.filter(Boolean)
|
|
116
|
+
.join(" ");
|
|
113
117
|
|
|
114
118
|
return (
|
|
115
119
|
<TabsVariantContext.Provider value={resolvedVariant}>
|
|
116
120
|
<TabsSizeContext.Provider value={size}>
|
|
117
|
-
<BaseTabs.List
|
|
121
|
+
<BaseTabs.List
|
|
122
|
+
{...htmlProps}
|
|
123
|
+
className={classes}
|
|
124
|
+
data-slot="tabs-list"
|
|
125
|
+
data-variant={resolvedVariant}
|
|
126
|
+
>
|
|
118
127
|
{children}
|
|
119
|
-
{resolvedVariant === "
|
|
128
|
+
{resolvedVariant === "ghost" && <BaseTabs.Indicator className={styles.indicator} />}
|
|
120
129
|
</BaseTabs.List>
|
|
121
130
|
</TabsSizeContext.Provider>
|
|
122
131
|
</TabsVariantContext.Provider>
|
|
@@ -126,12 +135,12 @@ function TabsList({ children, variant, size: sizeProp, className, ...htmlProps }
|
|
|
126
135
|
function Tab({ children, value, disabled, className }: TabProps) {
|
|
127
136
|
const variant = React.useContext(TabsVariantContext);
|
|
128
137
|
const size = React.useContext(TabsSizeContext);
|
|
129
|
-
const variantClass = variant === "
|
|
138
|
+
const variantClass = variant === "soft" ? styles.tabSoft : styles.tabGhost;
|
|
130
139
|
const sizeClass = size === "sm" ? styles.tabSm : size === "lg" ? styles.tabLg : styles.tabMd;
|
|
131
140
|
const classes = [styles.tab, sizeClass, variantClass, className].filter(Boolean).join(" ");
|
|
132
141
|
|
|
133
142
|
return (
|
|
134
|
-
<BaseTabs.Tab value={value} disabled={disabled} className={classes}>
|
|
143
|
+
<BaseTabs.Tab value={value} disabled={disabled} className={classes} data-slot="tabs-tab">
|
|
135
144
|
{children}
|
|
136
145
|
</BaseTabs.Tab>
|
|
137
146
|
);
|
|
@@ -148,7 +157,13 @@ function TabsPanel({
|
|
|
148
157
|
const classes = [styles.panel, flush && styles.panelFlush, className].filter(Boolean).join(" ");
|
|
149
158
|
|
|
150
159
|
return (
|
|
151
|
-
<BaseTabs.Panel
|
|
160
|
+
<BaseTabs.Panel
|
|
161
|
+
{...htmlProps}
|
|
162
|
+
value={value}
|
|
163
|
+
keepMounted={keepMounted}
|
|
164
|
+
className={classes}
|
|
165
|
+
data-slot="tabs-panel"
|
|
166
|
+
>
|
|
152
167
|
{children}
|
|
153
168
|
</BaseTabs.Panel>
|
|
154
169
|
);
|