@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,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as React from
|
|
4
|
-
import { createPortal } from
|
|
5
|
-
import { CaretDown, List, X } from
|
|
6
|
-
import { handleArrowNavigation, useFocusTrap } from
|
|
7
|
-
import { Collapsible } from
|
|
8
|
-
import { ScrollArea } from
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { CaretDown, List, X } from "@phosphor-icons/react";
|
|
6
|
+
import { handleArrowNavigation, useFocusTrap } from "../../utils/a11y";
|
|
7
|
+
import { Collapsible } from "../Collapsible";
|
|
8
|
+
import { ScrollArea } from "../ScrollArea";
|
|
9
9
|
import {
|
|
10
10
|
NavigationMenuContext,
|
|
11
11
|
NavigationMenuItemContext,
|
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
type NavigationMenuIcons,
|
|
16
16
|
type NavigationMenuIconRenderState,
|
|
17
17
|
type NavigationMenuIconSlot,
|
|
18
|
-
} from
|
|
19
|
-
import { useNavigationMenu } from
|
|
20
|
-
import styles from
|
|
18
|
+
} from "./NavigationMenuContext";
|
|
19
|
+
import { useNavigationMenu } from "./useNavigationMenu";
|
|
20
|
+
import styles from "./NavigationMenu.module.scss";
|
|
21
21
|
|
|
22
22
|
// ============================================
|
|
23
23
|
// Types
|
|
@@ -32,13 +32,19 @@ export interface NavigationMenuProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
32
32
|
/** Callback when open item changes */
|
|
33
33
|
onValueChange?: (value: string) => void;
|
|
34
34
|
/** Menu orientation */
|
|
35
|
-
orientation?:
|
|
35
|
+
orientation?: "horizontal" | "vertical";
|
|
36
36
|
/** Delay before opening on hover (ms) */
|
|
37
37
|
delayDuration?: number;
|
|
38
38
|
/** Duration to skip delays between triggers (ms) */
|
|
39
39
|
skipDelayDuration?: number;
|
|
40
40
|
/** Optional icon overrides for trigger chevrons and mobile drawer controls */
|
|
41
41
|
icons?: NavigationMenuIcons;
|
|
42
|
+
/**
|
|
43
|
+
* Viewport width where the canonical drawer replaces desktop navigation.
|
|
44
|
+
* `md` preserves the default 768px switch; `lg` lets rail-based shells
|
|
45
|
+
* retire their sidebar and desktop navigation together below 1024px.
|
|
46
|
+
*/
|
|
47
|
+
mobileBreakpoint?: "md" | "lg";
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
export interface NavigationMenuListProps {
|
|
@@ -65,7 +71,7 @@ export interface NavigationMenuContentProps {
|
|
|
65
71
|
|
|
66
72
|
export interface NavigationMenuLinkProps extends Omit<
|
|
67
73
|
React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
68
|
-
|
|
74
|
+
"title"
|
|
69
75
|
> {
|
|
70
76
|
/** Simple mode: children as text content */
|
|
71
77
|
children?: React.ReactNode;
|
|
@@ -120,19 +126,20 @@ export interface NavigationMenuMobileSectionProps {
|
|
|
120
126
|
// Hooks
|
|
121
127
|
// ============================================
|
|
122
128
|
|
|
123
|
-
function useIsMobile() {
|
|
129
|
+
function useIsMobile(breakpoint: "md" | "lg") {
|
|
124
130
|
const [isMobile, setIsMobile] = React.useState(false);
|
|
125
131
|
|
|
126
132
|
React.useEffect(() => {
|
|
127
|
-
if (typeof window ===
|
|
133
|
+
if (typeof window === "undefined") return;
|
|
128
134
|
|
|
129
|
-
const
|
|
135
|
+
const maxWidth = breakpoint === "lg" ? 1023 : 767;
|
|
136
|
+
const mq = window.matchMedia(`(max-width: ${maxWidth}px)`);
|
|
130
137
|
setIsMobile(mq.matches);
|
|
131
138
|
|
|
132
139
|
const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches);
|
|
133
|
-
mq.addEventListener(
|
|
134
|
-
return () => mq.removeEventListener(
|
|
135
|
-
}, []);
|
|
140
|
+
mq.addEventListener("change", handler);
|
|
141
|
+
return () => mq.removeEventListener("change", handler);
|
|
142
|
+
}, [breakpoint]);
|
|
136
143
|
|
|
137
144
|
return isMobile;
|
|
138
145
|
}
|
|
@@ -142,7 +149,7 @@ function renderNavigationMenuIcon(
|
|
|
142
149
|
state: NavigationMenuIconRenderState
|
|
143
150
|
): React.ReactNode {
|
|
144
151
|
if (slot === undefined) return undefined;
|
|
145
|
-
return typeof slot ===
|
|
152
|
+
return typeof slot === "function" ? slot(state) : slot;
|
|
146
153
|
}
|
|
147
154
|
|
|
148
155
|
// ============================================
|
|
@@ -154,16 +161,17 @@ function NavigationMenuRoot({
|
|
|
154
161
|
value: controlledValue,
|
|
155
162
|
defaultValue,
|
|
156
163
|
onValueChange,
|
|
157
|
-
orientation =
|
|
164
|
+
orientation = "horizontal",
|
|
158
165
|
delayDuration = 200,
|
|
159
166
|
skipDelayDuration = 300,
|
|
160
167
|
icons,
|
|
168
|
+
mobileBreakpoint = "md",
|
|
161
169
|
className,
|
|
162
|
-
|
|
170
|
+
"aria-label": ariaLabel = "Main navigation",
|
|
163
171
|
...htmlProps
|
|
164
172
|
}: NavigationMenuProps) {
|
|
165
173
|
const rootId = React.useId();
|
|
166
|
-
const isMobile = useIsMobile();
|
|
174
|
+
const isMobile = useIsMobile(mobileBreakpoint);
|
|
167
175
|
|
|
168
176
|
const state = useNavigationMenu({
|
|
169
177
|
value: controlledValue,
|
|
@@ -173,9 +181,9 @@ function NavigationMenuRoot({
|
|
|
173
181
|
skipDelayDuration,
|
|
174
182
|
});
|
|
175
183
|
|
|
176
|
-
const classes = [styles.root, orientation ===
|
|
184
|
+
const classes = [styles.root, orientation === "vertical" && styles.rootVertical, className]
|
|
177
185
|
.filter(Boolean)
|
|
178
|
-
.join(
|
|
186
|
+
.join(" ");
|
|
179
187
|
|
|
180
188
|
const contextValue = React.useMemo(
|
|
181
189
|
() => ({
|
|
@@ -190,7 +198,13 @@ function NavigationMenuRoot({
|
|
|
190
198
|
|
|
191
199
|
return (
|
|
192
200
|
<NavigationMenuContext.Provider value={contextValue}>
|
|
193
|
-
<nav
|
|
201
|
+
<nav
|
|
202
|
+
{...htmlProps}
|
|
203
|
+
className={classes}
|
|
204
|
+
aria-label={ariaLabel}
|
|
205
|
+
data-orientation={orientation}
|
|
206
|
+
data-mobile={isMobile || undefined}
|
|
207
|
+
>
|
|
194
208
|
{children}
|
|
195
209
|
{isMobile && <MobileHamburger />}
|
|
196
210
|
{isMobile && state.mobileOpen && <MobileDrawer />}
|
|
@@ -211,13 +225,13 @@ function NavigationMenuList({ children, className }: NavigationMenuListProps) {
|
|
|
211
225
|
const handleKeyDown = (e: React.KeyboardEvent) => {
|
|
212
226
|
const order = triggerOrder.current;
|
|
213
227
|
const focusedValue = (document.activeElement as HTMLElement | null)?.getAttribute(
|
|
214
|
-
|
|
228
|
+
"data-navmenu-value"
|
|
215
229
|
);
|
|
216
230
|
const currentValue = focusedValue || value;
|
|
217
231
|
const currentIdx = order.indexOf(currentValue);
|
|
218
232
|
|
|
219
233
|
const newIdx = handleArrowNavigation(e, order, currentIdx >= 0 ? currentIdx : 0, {
|
|
220
|
-
orientation: orientation ===
|
|
234
|
+
orientation: orientation === "horizontal" ? "horizontal" : "vertical",
|
|
221
235
|
loop: true,
|
|
222
236
|
});
|
|
223
237
|
|
|
@@ -228,9 +242,9 @@ function NavigationMenuList({ children, className }: NavigationMenuListProps) {
|
|
|
228
242
|
}
|
|
229
243
|
};
|
|
230
244
|
|
|
231
|
-
const classes = [styles.list, orientation ===
|
|
245
|
+
const classes = [styles.list, orientation === "vertical" && styles.listVertical, className]
|
|
232
246
|
.filter(Boolean)
|
|
233
|
-
.join(
|
|
247
|
+
.join(" ");
|
|
234
248
|
|
|
235
249
|
return (
|
|
236
250
|
<ul
|
|
@@ -265,7 +279,7 @@ function NavigationMenuItem({ children, value: valueProp, className }: Navigatio
|
|
|
265
279
|
if (!existing) {
|
|
266
280
|
rootCtx.itemInfoMap.current.set(autoValue, {
|
|
267
281
|
value: autoValue,
|
|
268
|
-
triggerLabel:
|
|
282
|
+
triggerLabel: "",
|
|
269
283
|
contentChildren: null,
|
|
270
284
|
});
|
|
271
285
|
}
|
|
@@ -321,12 +335,12 @@ function NavigationMenuTrigger({ children, className }: NavigationMenuTriggerPro
|
|
|
321
335
|
|
|
322
336
|
// Register item info for mobile drawer
|
|
323
337
|
React.useEffect(() => {
|
|
324
|
-
const label = typeof children ===
|
|
338
|
+
const label = typeof children === "string" ? children : "";
|
|
325
339
|
const existing = ctx.itemInfoMap.current.get(itemCtx.value);
|
|
326
340
|
ctx.itemInfoMap.current.set(itemCtx.value, {
|
|
327
341
|
...existing,
|
|
328
342
|
value: itemCtx.value,
|
|
329
|
-
triggerLabel: label || existing?.triggerLabel ||
|
|
343
|
+
triggerLabel: label || existing?.triggerLabel || "",
|
|
330
344
|
} as NavigationMenuItemInfo);
|
|
331
345
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
332
346
|
}, [itemCtx.value, children]);
|
|
@@ -340,7 +354,7 @@ function NavigationMenuTrigger({ children, className }: NavigationMenuTriggerPro
|
|
|
340
354
|
clearTimeout(ctx.closeTimerRef.current);
|
|
341
355
|
ctx.closeTimerRef.current = null;
|
|
342
356
|
}
|
|
343
|
-
ctx.setValue(isOpen ?
|
|
357
|
+
ctx.setValue(isOpen ? "" : itemCtx.value);
|
|
344
358
|
};
|
|
345
359
|
|
|
346
360
|
const handlePointerEnter = () => {
|
|
@@ -367,25 +381,25 @@ function NavigationMenuTrigger({ children, className }: NavigationMenuTriggerPro
|
|
|
367
381
|
}
|
|
368
382
|
|
|
369
383
|
ctx.closeTimerRef.current = setTimeout(() => {
|
|
370
|
-
ctx.setValue(
|
|
384
|
+
ctx.setValue("");
|
|
371
385
|
}, ctx.delayDuration);
|
|
372
386
|
};
|
|
373
387
|
|
|
374
388
|
const handleKeyDown = (e: React.KeyboardEvent) => {
|
|
375
|
-
if (e.key ===
|
|
389
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
376
390
|
e.preventDefault();
|
|
377
|
-
ctx.setValue(isOpen ?
|
|
391
|
+
ctx.setValue(isOpen ? "" : itemCtx.value);
|
|
378
392
|
}
|
|
379
|
-
if (e.key ===
|
|
393
|
+
if (e.key === "Escape" && isOpen) {
|
|
380
394
|
e.preventDefault();
|
|
381
|
-
ctx.setValue(
|
|
395
|
+
ctx.setValue("");
|
|
382
396
|
triggerRef.current?.focus();
|
|
383
397
|
}
|
|
384
398
|
};
|
|
385
399
|
|
|
386
|
-
const classes = [styles.trigger, className].filter(Boolean).join(
|
|
400
|
+
const classes = [styles.trigger, className].filter(Boolean).join(" ");
|
|
387
401
|
const chevronOverride = renderNavigationMenuIcon(ctx.icons?.triggerChevron, {
|
|
388
|
-
slot:
|
|
402
|
+
slot: "triggerChevron",
|
|
389
403
|
open: isOpen,
|
|
390
404
|
isMobile: ctx.isMobile,
|
|
391
405
|
});
|
|
@@ -399,7 +413,7 @@ function NavigationMenuTrigger({ children, className }: NavigationMenuTriggerPro
|
|
|
399
413
|
data-navmenu-value={itemCtx.value}
|
|
400
414
|
aria-expanded={isOpen}
|
|
401
415
|
aria-controls={itemCtx.contentId}
|
|
402
|
-
data-state={isOpen ?
|
|
416
|
+
data-state={isOpen ? "open" : "closed"}
|
|
403
417
|
onClick={handleClick}
|
|
404
418
|
onPointerEnter={handlePointerEnter}
|
|
405
419
|
onPointerLeave={handlePointerLeave}
|
|
@@ -433,7 +447,7 @@ function NavigationMenuContent({ children, className }: NavigationMenuContentPro
|
|
|
433
447
|
ctx.itemInfoMap.current.set(itemCtx.value, {
|
|
434
448
|
...existing,
|
|
435
449
|
value: itemCtx.value,
|
|
436
|
-
triggerLabel: existing?.triggerLabel ||
|
|
450
|
+
triggerLabel: existing?.triggerLabel || "",
|
|
437
451
|
contentChildren: children,
|
|
438
452
|
} as NavigationMenuItemInfo);
|
|
439
453
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -471,7 +485,7 @@ function NavigationMenuContent({ children, className }: NavigationMenuContentPro
|
|
|
471
485
|
const currentIdx = triggerOrder.indexOf(itemCtx.value);
|
|
472
486
|
let motion: string | undefined;
|
|
473
487
|
if (isOpen && prevValue && prevValue !== itemCtx.value) {
|
|
474
|
-
motion = currentIdx > prevIdx ?
|
|
488
|
+
motion = currentIdx > prevIdx ? "from-end" : "from-start";
|
|
475
489
|
}
|
|
476
490
|
|
|
477
491
|
// Update previousValue when this content becomes active
|
|
@@ -484,7 +498,7 @@ function NavigationMenuContent({ children, className }: NavigationMenuContentPro
|
|
|
484
498
|
|
|
485
499
|
if (!isOpen) return null;
|
|
486
500
|
|
|
487
|
-
const classes = [styles.content, className].filter(Boolean).join(
|
|
501
|
+
const classes = [styles.content, className].filter(Boolean).join(" ");
|
|
488
502
|
|
|
489
503
|
const handlePointerEnter = () => {
|
|
490
504
|
if (ctx.closeTimerRef.current) {
|
|
@@ -495,7 +509,7 @@ function NavigationMenuContent({ children, className }: NavigationMenuContentPro
|
|
|
495
509
|
|
|
496
510
|
const handlePointerLeave = () => {
|
|
497
511
|
ctx.closeTimerRef.current = setTimeout(() => {
|
|
498
|
-
ctx.setValue(
|
|
512
|
+
ctx.setValue("");
|
|
499
513
|
}, ctx.delayDuration);
|
|
500
514
|
};
|
|
501
515
|
|
|
@@ -548,22 +562,22 @@ function NavigationMenuLink({
|
|
|
548
562
|
|
|
549
563
|
const existing = ctx.itemInfoMap.current.get(itemCtx.value);
|
|
550
564
|
const fallbackLabel =
|
|
551
|
-
typeof children ===
|
|
565
|
+
typeof children === "string"
|
|
552
566
|
? children
|
|
553
|
-
: typeof title ===
|
|
567
|
+
: typeof title === "string"
|
|
554
568
|
? title
|
|
555
569
|
: React.Children.toArray(title ?? children)
|
|
556
570
|
.filter(
|
|
557
571
|
(node): node is string | number =>
|
|
558
|
-
typeof node ===
|
|
572
|
+
typeof node === "string" || typeof node === "number"
|
|
559
573
|
)
|
|
560
|
-
.join(
|
|
561
|
-
const resolvedHref = typeof href ===
|
|
574
|
+
.join("");
|
|
575
|
+
const resolvedHref = typeof href === "string" ? href : existing?.linkHref;
|
|
562
576
|
|
|
563
577
|
ctx.itemInfoMap.current.set(itemCtx.value, {
|
|
564
578
|
...existing,
|
|
565
579
|
value: itemCtx.value,
|
|
566
|
-
triggerLabel: existing?.triggerLabel || fallbackLabel ||
|
|
580
|
+
triggerLabel: existing?.triggerLabel || fallbackLabel || "",
|
|
567
581
|
contentChildren: existing?.contentChildren ?? null,
|
|
568
582
|
linkHref: resolvedHref,
|
|
569
583
|
});
|
|
@@ -578,27 +592,31 @@ function NavigationMenuLink({
|
|
|
578
592
|
}
|
|
579
593
|
// Close desktop menu
|
|
580
594
|
if (ctx) {
|
|
581
|
-
ctx.setValue(
|
|
595
|
+
ctx.setValue("");
|
|
582
596
|
}
|
|
583
597
|
};
|
|
584
598
|
|
|
599
|
+
// MobileContent portals into the drawer; use drawer geometry there instead of
|
|
600
|
+
// the desktop popup-panel link styles.
|
|
601
|
+
const inMobileDrawer = Boolean(ctx?.isMobile && ctx?.mobileOpen);
|
|
602
|
+
|
|
585
603
|
// Structured mode (title + description + icon)
|
|
586
604
|
if (isStructured) {
|
|
587
605
|
const classes = [
|
|
588
|
-
styles.link,
|
|
589
|
-
styles.linkStructured,
|
|
590
|
-
active && styles.linkActive,
|
|
591
|
-
featured && styles.linkFeatured,
|
|
606
|
+
inMobileDrawer ? styles.drawerLink : styles.link,
|
|
607
|
+
!inMobileDrawer && styles.linkStructured,
|
|
608
|
+
active && (inMobileDrawer ? styles.drawerLinkActive : styles.linkActive),
|
|
609
|
+
!inMobileDrawer && featured && styles.linkFeatured,
|
|
592
610
|
className,
|
|
593
611
|
]
|
|
594
612
|
.filter(Boolean)
|
|
595
|
-
.join(
|
|
613
|
+
.join(" ");
|
|
596
614
|
|
|
597
615
|
const linkProps = {
|
|
598
616
|
...htmlProps,
|
|
599
617
|
className: classes,
|
|
600
618
|
href,
|
|
601
|
-
|
|
619
|
+
"aria-current": active ? ("page" as const) : undefined,
|
|
602
620
|
onClick: handleClick,
|
|
603
621
|
};
|
|
604
622
|
|
|
@@ -610,7 +628,7 @@ function NavigationMenuLink({
|
|
|
610
628
|
return React.cloneElement(children, {
|
|
611
629
|
...linkProps,
|
|
612
630
|
onClick: composeNavMenuClickHandlers(childProps.onClick, handleClick),
|
|
613
|
-
className: [classes, childProps.className].filter(Boolean).join(
|
|
631
|
+
className: [classes, childProps.className].filter(Boolean).join(" "),
|
|
614
632
|
children: (
|
|
615
633
|
<>
|
|
616
634
|
{icon && <span className={styles.linkIcon}>{icon}</span>}
|
|
@@ -635,13 +653,19 @@ function NavigationMenuLink({
|
|
|
635
653
|
}
|
|
636
654
|
|
|
637
655
|
// Simple link mode
|
|
638
|
-
const classes = [
|
|
656
|
+
const classes = [
|
|
657
|
+
inMobileDrawer ? styles.drawerLink : styles.link,
|
|
658
|
+
active && (inMobileDrawer ? styles.drawerLinkActive : styles.linkActive),
|
|
659
|
+
className,
|
|
660
|
+
]
|
|
661
|
+
.filter(Boolean)
|
|
662
|
+
.join(" ");
|
|
639
663
|
|
|
640
664
|
const linkProps = {
|
|
641
665
|
...htmlProps,
|
|
642
666
|
className: classes,
|
|
643
667
|
href,
|
|
644
|
-
|
|
668
|
+
"aria-current": active ? ("page" as const) : undefined,
|
|
645
669
|
onClick: handleClick,
|
|
646
670
|
};
|
|
647
671
|
|
|
@@ -653,7 +677,7 @@ function NavigationMenuLink({
|
|
|
653
677
|
return React.cloneElement(children, {
|
|
654
678
|
...linkProps,
|
|
655
679
|
onClick: composeNavMenuClickHandlers(childProps.onClick, handleClick),
|
|
656
|
-
className: [classes, childProps.className].filter(Boolean).join(
|
|
680
|
+
className: [classes, childProps.className].filter(Boolean).join(" "),
|
|
657
681
|
} as React.HTMLAttributes<HTMLElement>);
|
|
658
682
|
}
|
|
659
683
|
|
|
@@ -675,7 +699,7 @@ function NavigationMenuIndicator({ className }: NavigationMenuIndicatorProps) {
|
|
|
675
699
|
}
|
|
676
700
|
const trigger = triggerRefs.current.get(value);
|
|
677
701
|
if (trigger) {
|
|
678
|
-
const parent = trigger.closest(
|
|
702
|
+
const parent = trigger.closest("ul");
|
|
679
703
|
if (parent) {
|
|
680
704
|
const parentRect = parent.getBoundingClientRect();
|
|
681
705
|
const triggerRect = trigger.getBoundingClientRect();
|
|
@@ -688,7 +712,7 @@ function NavigationMenuIndicator({ className }: NavigationMenuIndicatorProps) {
|
|
|
688
712
|
}
|
|
689
713
|
}, [value, triggerRefs]);
|
|
690
714
|
|
|
691
|
-
const classes = [styles.indicator, className].filter(Boolean).join(
|
|
715
|
+
const classes = [styles.indicator, className].filter(Boolean).join(" ");
|
|
692
716
|
|
|
693
717
|
return <div className={classes} style={style} aria-hidden />;
|
|
694
718
|
}
|
|
@@ -719,9 +743,9 @@ function NavigationMenuViewport({ className }: NavigationMenuViewportProps) {
|
|
|
719
743
|
}, [isOpen, value, triggerRefs, viewportRef]);
|
|
720
744
|
|
|
721
745
|
const cssVars = {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
746
|
+
"--fui-navmenu-viewport-width": isOpen ? `${viewportSize.width}px` : "0px",
|
|
747
|
+
"--fui-navmenu-viewport-height": isOpen ? `${viewportSize.height}px` : "0px",
|
|
748
|
+
"--fui-navmenu-viewport-left": `${triggerLeft}px`,
|
|
725
749
|
} as React.CSSProperties;
|
|
726
750
|
|
|
727
751
|
// Mark skip-delay state
|
|
@@ -739,14 +763,14 @@ function NavigationMenuViewport({ className }: NavigationMenuViewportProps) {
|
|
|
739
763
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
740
764
|
}, [isOpen]);
|
|
741
765
|
|
|
742
|
-
const classes = [styles.viewport, className].filter(Boolean).join(
|
|
766
|
+
const classes = [styles.viewport, className].filter(Boolean).join(" ");
|
|
743
767
|
|
|
744
768
|
return (
|
|
745
769
|
<div
|
|
746
770
|
ref={viewportRef}
|
|
747
771
|
className={classes}
|
|
748
772
|
style={cssVars}
|
|
749
|
-
data-state={isOpen ?
|
|
773
|
+
data-state={isOpen ? "open" : "closed"}
|
|
750
774
|
role="presentation"
|
|
751
775
|
/>
|
|
752
776
|
);
|
|
@@ -809,7 +833,7 @@ function MobileHamburger() {
|
|
|
809
833
|
const iconOverride = renderNavigationMenuIcon(
|
|
810
834
|
mobileOpen ? ctx.icons?.mobileClose : ctx.icons?.mobileMenu,
|
|
811
835
|
{
|
|
812
|
-
slot: mobileOpen ?
|
|
836
|
+
slot: mobileOpen ? "mobileClose" : "mobileMenu",
|
|
813
837
|
open: mobileOpen,
|
|
814
838
|
isMobile: true,
|
|
815
839
|
}
|
|
@@ -840,21 +864,21 @@ function MobileDrawer() {
|
|
|
840
864
|
|
|
841
865
|
// Lock body scroll
|
|
842
866
|
React.useEffect(() => {
|
|
843
|
-
document.body.style.overflow =
|
|
867
|
+
document.body.style.overflow = "hidden";
|
|
844
868
|
return () => {
|
|
845
|
-
document.body.style.overflow =
|
|
869
|
+
document.body.style.overflow = "";
|
|
846
870
|
};
|
|
847
871
|
}, []);
|
|
848
872
|
|
|
849
873
|
// Handle Escape
|
|
850
874
|
React.useEffect(() => {
|
|
851
875
|
const handleKeyDown = (e: KeyboardEvent) => {
|
|
852
|
-
if (e.key ===
|
|
876
|
+
if (e.key === "Escape") {
|
|
853
877
|
ctx.setMobileOpen(false);
|
|
854
878
|
}
|
|
855
879
|
};
|
|
856
|
-
document.addEventListener(
|
|
857
|
-
return () => document.removeEventListener(
|
|
880
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
881
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
858
882
|
}, [ctx]);
|
|
859
883
|
|
|
860
884
|
// Build auto-converted nav items from item info registry
|
|
@@ -887,13 +911,13 @@ function MobileDrawer() {
|
|
|
887
911
|
aria-label="Close navigation"
|
|
888
912
|
>
|
|
889
913
|
{renderNavigationMenuIcon(ctx.icons?.drawerClose, {
|
|
890
|
-
slot:
|
|
914
|
+
slot: "drawerClose",
|
|
891
915
|
open: ctx.mobileOpen,
|
|
892
916
|
isMobile: true,
|
|
893
917
|
}) ?? <X size={20} aria-hidden />}
|
|
894
918
|
</button>
|
|
895
919
|
</div>
|
|
896
|
-
<ScrollArea orientation="vertical" className={styles.drawerBody}>
|
|
920
|
+
<ScrollArea orientation="vertical" showFades className={styles.drawerBody}>
|
|
897
921
|
{/* When MobileContent is provided, it takes full control of the drawer nav.
|
|
898
922
|
Otherwise, auto-convert registered Trigger+Content items. */}
|
|
899
923
|
{ctx.mobileContentChildren ? (
|
|
@@ -927,7 +951,7 @@ function MobileDrawer() {
|
|
|
927
951
|
</>
|
|
928
952
|
);
|
|
929
953
|
|
|
930
|
-
if (typeof document ===
|
|
954
|
+
if (typeof document === "undefined") return null;
|
|
931
955
|
return createPortal(drawerContent, document.body);
|
|
932
956
|
}
|
|
933
957
|
|
|
@@ -952,7 +976,7 @@ function MobileCollapsibleSection({
|
|
|
952
976
|
className={styles.drawerCollapsibleContent}
|
|
953
977
|
onClick={onLinkClick}
|
|
954
978
|
onKeyDown={(e) => {
|
|
955
|
-
if (e.key ===
|
|
979
|
+
if (e.key === "Enter") onLinkClick();
|
|
956
980
|
}}
|
|
957
981
|
role="group"
|
|
958
982
|
>
|
|
@@ -998,4 +1022,4 @@ export type {
|
|
|
998
1022
|
NavigationMenuIcons,
|
|
999
1023
|
NavigationMenuIconSlot,
|
|
1000
1024
|
NavigationMenuIconRenderState,
|
|
1001
|
-
} from
|
|
1025
|
+
} from "./NavigationMenuContext";
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://usefragments.com/schemas/contract.v1.json",
|
|
3
3
|
"name": "Pagination",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Steps through content split across numbered pages.",
|
|
5
5
|
"category": "navigation",
|
|
6
|
-
"tags": [
|
|
7
|
-
"pagination",
|
|
8
|
-
"paging",
|
|
9
|
-
"pages",
|
|
10
|
-
"navigation"
|
|
11
|
-
],
|
|
6
|
+
"tags": ["pagination", "paging", "pages", "navigation"],
|
|
12
7
|
"status": "stable",
|
|
13
8
|
"sourcePath": "src/components/Pagination/index.tsx",
|
|
14
9
|
"exportName": "Pagination",
|
|
@@ -63,25 +58,23 @@
|
|
|
63
58
|
},
|
|
64
59
|
"usage": {
|
|
65
60
|
"when": [
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"Search results
|
|
69
|
-
"Any content split across multiple pages"
|
|
61
|
+
"Data sets served a page at a time",
|
|
62
|
+
"Tables and lists with a known total",
|
|
63
|
+
"Search results past the first screen"
|
|
70
64
|
],
|
|
71
65
|
"whenNot": [
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
66
|
+
"Everything already fits on one page",
|
|
67
|
+
"Content that loads as the user scrolls",
|
|
68
|
+
"Switching between panels (use Tabs)",
|
|
69
|
+
"Steps in an order (use Stepper)"
|
|
76
70
|
],
|
|
77
71
|
"guidelines": [
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"Previous/Next/Item buttons compose your onClick handlers; call event.preventDefault() to stop the page change"
|
|
72
|
+
"Sit it directly below what it pages",
|
|
73
|
+
"edgeCount keeps the first and last pages reachable",
|
|
74
|
+
"siblingCount sets how many neighbours show",
|
|
75
|
+
"The current page uses a neutral surface, not the brand accent",
|
|
76
|
+
"The root forwards id, aria-*, data-*, and handlers to <nav>",
|
|
77
|
+
"Your onClick runs first — call preventDefault() to stop the change"
|
|
85
78
|
],
|
|
86
79
|
"accessibility": [
|
|
87
80
|
"Uses nav element with aria-label=\"Pagination\"",
|
|
@@ -93,22 +86,22 @@
|
|
|
93
86
|
"examples": [
|
|
94
87
|
{
|
|
95
88
|
"name": "Default",
|
|
96
|
-
"description": "
|
|
89
|
+
"description": "Neighbours around the current page, ends always reachable.",
|
|
97
90
|
"code": "<Pagination totalPages={10} defaultPage={1}>\n <Pagination.Previous />\n <Pagination.Items />\n <Pagination.Next />\n</Pagination>"
|
|
98
91
|
},
|
|
99
92
|
{
|
|
100
93
|
"name": "With Edge Pages",
|
|
101
|
-
"description": "
|
|
94
|
+
"description": "Two pages pinned at each end.",
|
|
102
95
|
"code": "<Pagination totalPages={20} defaultPage={10} edgeCount={2} siblingCount={1}>\n <Pagination.Previous />\n <Pagination.Items />\n <Pagination.Next />\n</Pagination>"
|
|
103
96
|
},
|
|
104
97
|
{
|
|
105
98
|
"name": "Compact",
|
|
106
|
-
"description": "
|
|
99
|
+
"description": "Drops the neighbours when space is tight.",
|
|
107
100
|
"code": "<Pagination totalPages={20} defaultPage={10} siblingCount={0}>\n <Pagination.Previous />\n <Pagination.Items />\n <Pagination.Next />\n</Pagination>"
|
|
108
101
|
},
|
|
109
102
|
{
|
|
110
103
|
"name": "Controlled",
|
|
111
|
-
"description": "
|
|
104
|
+
"description": "You hold the page number in state.",
|
|
112
105
|
"code": "<Pagination totalPages={5} page={3}>\n <Pagination.Previous />\n <Pagination.Items />\n <Pagination.Next />\n</Pagination>"
|
|
113
106
|
}
|
|
114
107
|
],
|
|
@@ -134,23 +127,12 @@
|
|
|
134
127
|
"siblingCount: number - pages around current (default: 1)",
|
|
135
128
|
"Forwards standard HTML nav attributes to the root element"
|
|
136
129
|
],
|
|
137
|
-
"a11yRules": [
|
|
138
|
-
"A11Y_NAV_LABEL",
|
|
139
|
-
"A11Y_CURRENT_PAGE"
|
|
140
|
-
]
|
|
130
|
+
"a11yRules": ["A11Y_NAV_LABEL", "A11Y_CURRENT_PAGE"]
|
|
141
131
|
},
|
|
142
132
|
"ai": {
|
|
143
133
|
"compositionPattern": "compound",
|
|
144
|
-
"subComponents": [
|
|
145
|
-
|
|
146
|
-
"Next",
|
|
147
|
-
"Items",
|
|
148
|
-
"Item",
|
|
149
|
-
"Ellipsis"
|
|
150
|
-
],
|
|
151
|
-
"requiredChildren": [
|
|
152
|
-
"Items"
|
|
153
|
-
],
|
|
134
|
+
"subComponents": ["Previous", "Next", "Items", "Item", "Ellipsis"],
|
|
135
|
+
"requiredChildren": ["Items"],
|
|
154
136
|
"commonPatterns": [
|
|
155
137
|
"<Pagination totalPages={totalPages} page={currentPage} onPageChange={setPage}><Pagination.Previous /><Pagination.Items /><Pagination.Next /></Pagination>"
|
|
156
138
|
]
|