@usefragments/ui 1.0.2 → 1.2.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 +16 -16
- package/dist/assets/fragments-wordmark.cjs +30 -0
- package/dist/assets/fragments-wordmark.d.ts +13 -0
- package/dist/assets/fragments-wordmark.d.ts.map +1 -0
- package/dist/assets/fragments-wordmark.js +30 -0
- package/dist/assets/ui.css +3234 -3116
- package/dist/components/Accordion/Accordion.module.scss.cjs +8 -8
- package/dist/components/Accordion/Accordion.module.scss.js +8 -8
- package/dist/components/Accordion/index.cjs +22 -10
- package/dist/components/Accordion/index.d.ts.map +1 -1
- package/dist/components/Accordion/index.js +22 -10
- package/dist/components/Alert/Alert.module.scss.cjs +13 -13
- package/dist/components/Alert/Alert.module.scss.js +13 -13
- package/dist/components/AppShell/AppShell.module.scss.cjs +22 -10
- package/dist/components/AppShell/AppShell.module.scss.js +22 -10
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/Avatar/Avatar.module.scss.cjs +13 -13
- package/dist/components/Avatar/Avatar.module.scss.js +13 -13
- package/dist/components/Badge/Badge.module.scss.cjs +16 -16
- package/dist/components/Badge/Badge.module.scss.js +16 -16
- 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/Breadcrumbs/Breadcrumbs.module.scss.cjs +8 -8
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.js +8 -8
- package/dist/components/Button/Button.module.scss.cjs +13 -13
- package/dist/components/Button/Button.module.scss.js +13 -13
- package/dist/components/Card/Card.module.scss.cjs +17 -17
- package/dist/components/Card/Card.module.scss.js +17 -17
- package/dist/components/Card/index.d.ts +3 -3
- package/dist/components/Card/index.d.ts.map +1 -1
- package/dist/components/Chart/Chart.module.scss.cjs +15 -15
- package/dist/components/Chart/Chart.module.scss.js +15 -15
- package/dist/components/Checkbox/Checkbox.module.scss.cjs +11 -11
- package/dist/components/Checkbox/Checkbox.module.scss.js +11 -11
- package/dist/components/Chip/Chip.module.scss.cjs +15 -15
- package/dist/components/Chip/Chip.module.scss.js +15 -15
- package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +21 -21
- package/dist/components/CodeBlock/CodeBlock.module.scss.js +21 -21
- package/dist/components/Collapsible/Collapsible.module.scss.cjs +10 -10
- package/dist/components/Collapsible/Collapsible.module.scss.js +10 -10
- package/dist/components/ColorPicker/ColorPicker.module.scss.cjs +14 -14
- package/dist/components/ColorPicker/ColorPicker.module.scss.js +14 -14
- package/dist/components/Combobox/Combobox.module.scss.cjs +23 -23
- package/dist/components/Combobox/Combobox.module.scss.js +23 -23
- package/dist/components/Combobox/index.cjs +106 -9
- package/dist/components/Combobox/index.d.ts.map +1 -1
- package/dist/components/Combobox/index.js +106 -9
- package/dist/components/Command/Command.module.scss.cjs +11 -11
- package/dist/components/Command/Command.module.scss.js +11 -11
- package/dist/components/ConversationList/ConversationList.module.scss.cjs +10 -10
- package/dist/components/ConversationList/ConversationList.module.scss.js +10 -10
- package/dist/components/DataTable/DataTable.module.scss.cjs +37 -34
- package/dist/components/DataTable/DataTable.module.scss.js +37 -34
- package/dist/components/DataTable/index.d.ts +3 -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 +1 -1
- 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/Drawer/Drawer.module.scss.cjs +28 -28
- package/dist/components/Drawer/Drawer.module.scss.js +28 -28
- package/dist/components/Drawer/index.cjs +20 -3
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +20 -3
- package/dist/components/Editor/Editor.module.scss.cjs +17 -17
- package/dist/components/Editor/Editor.module.scss.js +17 -17
- package/dist/components/EmptyState/EmptyState.module.scss.cjs +8 -8
- package/dist/components/EmptyState/EmptyState.module.scss.js +8 -8
- package/dist/components/Field/Field.module.scss.cjs +4 -4
- package/dist/components/Field/Field.module.scss.js +4 -4
- package/dist/components/Field/index.cjs +10 -9
- package/dist/components/Field/index.d.ts +7 -7
- package/dist/components/Field/index.d.ts.map +1 -1
- package/dist/components/Field/index.js +10 -9
- package/dist/components/Fieldset/Fieldset.module.scss.cjs +3 -3
- package/dist/components/Fieldset/Fieldset.module.scss.js +3 -3
- package/dist/components/Header/Header.module.scss.cjs +44 -29
- package/dist/components/Header/Header.module.scss.js +44 -29
- package/dist/components/Header/index.cjs +56 -3
- package/dist/components/Header/index.d.ts +25 -3
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +56 -3
- package/dist/components/Icon/Icon.module.scss.cjs +8 -8
- package/dist/components/Icon/Icon.module.scss.js +8 -8
- package/dist/components/IconButton/IconButton.module.scss.cjs +8 -8
- package/dist/components/IconButton/IconButton.module.scss.js +8 -8
- 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 +19 -19
- package/dist/components/Input/Input.module.scss.js +19 -19
- package/dist/components/Link/Link.module.scss.cjs +10 -10
- package/dist/components/Link/Link.module.scss.js +10 -10
- package/dist/components/List/List.module.scss.cjs +19 -19
- package/dist/components/List/List.module.scss.js +19 -19
- 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 +30 -30
- package/dist/components/Loading/Loading.module.scss.js +30 -30
- package/dist/components/Main/Main.module.scss.cjs +26 -0
- package/dist/components/Main/Main.module.scss.js +26 -0
- package/dist/components/Main/index.cjs +128 -0
- package/dist/components/Main/index.d.ts +22 -0
- package/dist/components/Main/index.d.ts.map +1 -0
- package/dist/components/Main/index.js +111 -0
- package/dist/components/Markdown/Markdown.module.scss.cjs +1 -1
- package/dist/components/Markdown/Markdown.module.scss.js +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 +18 -18
- package/dist/components/Message/Message.module.scss.js +18 -18
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.cjs +28 -28
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.js +28 -28
- package/dist/components/Pagination/Pagination.module.scss.cjs +7 -7
- package/dist/components/Pagination/Pagination.module.scss.js +7 -7
- package/dist/components/Popover/Popover.module.scss.cjs +10 -10
- package/dist/components/Popover/Popover.module.scss.js +10 -10
- package/dist/components/Popover/index.cjs +27 -2
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +27 -2
- package/dist/components/Progress/Progress.module.scss.cjs +25 -25
- package/dist/components/Progress/Progress.module.scss.js +25 -25
- package/dist/components/Prompt/Prompt.module.scss.cjs +18 -18
- package/dist/components/Prompt/Prompt.module.scss.js +18 -18
- package/dist/components/RadioGroup/RadioGroup.module.scss.cjs +17 -17
- package/dist/components/RadioGroup/RadioGroup.module.scss.js +17 -17
- package/dist/components/RadioGroup/index.cjs +2 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.js +2 -0
- package/dist/components/ScrollArea/ScrollArea.module.scss.cjs +10 -10
- package/dist/components/ScrollArea/ScrollArea.module.scss.js +10 -10
- package/dist/components/Select/Select.module.scss.cjs +17 -17
- package/dist/components/Select/Select.module.scss.js +17 -17
- package/dist/components/Separator/Separator.module.scss.cjs +10 -10
- package/dist/components/Separator/Separator.module.scss.js +10 -10
- package/dist/components/Sidebar/Sidebar.module.scss.cjs +42 -42
- package/dist/components/Sidebar/Sidebar.module.scss.js +42 -42
- package/dist/components/Skeleton/Skeleton.module.scss.cjs +38 -38
- package/dist/components/Skeleton/Skeleton.module.scss.js +38 -38
- package/dist/components/Slider/Slider.module.scss.cjs +12 -12
- package/dist/components/Slider/Slider.module.scss.js +12 -12
- 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 +22 -42
- package/dist/components/TableOfContents/index.d.ts +3 -3
- package/dist/components/TableOfContents/index.d.ts.map +1 -1
- package/dist/components/TableOfContents/index.js +22 -42
- package/dist/components/Tabs/Tabs.module.scss.cjs +12 -12
- package/dist/components/Tabs/Tabs.module.scss.js +12 -12
- package/dist/components/Text/Text.module.scss.cjs +51 -51
- package/dist/components/Text/Text.module.scss.js +51 -51
- package/dist/components/Textarea/Textarea.module.scss.cjs +23 -23
- package/dist/components/Textarea/Textarea.module.scss.js +23 -23
- package/dist/components/Theme/ThemeToggle.module.scss.cjs +6 -6
- package/dist/components/Theme/ThemeToggle.module.scss.js +6 -6
- package/dist/components/ThinkingIndicator/ThinkingIndicator.module.scss.cjs +13 -13
- package/dist/components/ThinkingIndicator/ThinkingIndicator.module.scss.js +13 -13
- package/dist/components/Toast/Toast.module.scss.cjs +21 -21
- package/dist/components/Toast/Toast.module.scss.js +21 -21
- package/dist/components/Toggle/Toggle.module.scss.cjs +13 -13
- package/dist/components/Toggle/Toggle.module.scss.js +13 -13
- package/dist/components/ToggleGroup/ToggleGroup.module.scss.cjs +17 -17
- package/dist/components/ToggleGroup/ToggleGroup.module.scss.js +17 -17
- package/dist/components/Tooltip/Tooltip.module.scss.cjs +3 -3
- package/dist/components/Tooltip/Tooltip.module.scss.js +3 -3
- package/dist/data-table.cjs +58 -41
- package/dist/data-table.js +59 -41
- package/dist/datepicker.cjs +32 -72
- package/dist/datepicker.js +32 -72
- package/dist/index.cjs +89 -85
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/fragments.json +1 -1
- package/package.json +9 -8
- package/src/assets/fragments-wordmark.tsx +47 -0
- package/src/components/Accordion/index.tsx +13 -3
- package/src/components/Alert/Alert.module.scss +15 -2
- package/src/components/AppShell/AppShell.module.scss +73 -15
- package/src/components/AppShell/index.tsx +1 -1
- package/src/components/Button/Button.module.scss +19 -20
- package/src/components/Card/Card.module.scss +3 -3
- package/src/components/Card/index.tsx +3 -3
- package/src/components/Checkbox/Checkbox.contract.json +5 -24
- package/src/components/Checkbox/Checkbox.module.scss +4 -2
- package/src/components/Chip/Chip.contract.json +11 -28
- package/src/components/Chip/Chip.module.scss +21 -45
- package/src/components/CodeBlock/CodeBlock.module.scss +2 -7
- package/src/components/Combobox/Combobox.contract.json +6 -24
- package/src/components/Combobox/Combobox.module.scss +3 -2
- package/src/components/Combobox/index.tsx +132 -6
- package/src/components/DataTable/DataTable.contract.json +16 -23
- package/src/components/DataTable/DataTable.module.scss +31 -8
- package/src/components/DataTable/index.tsx +25 -4
- package/src/components/DatePicker/index.tsx +32 -84
- package/src/components/Drawer/index.tsx +38 -12
- package/src/components/Field/index.tsx +35 -35
- package/src/components/Header/Header.contract.json +41 -1
- package/src/components/Header/Header.module.scss +40 -0
- package/src/components/Header/index.tsx +88 -2
- package/src/components/IconButton/IconButton.contract.json +120 -0
- package/src/components/Listbox/Listbox.module.scss +5 -4
- package/src/components/Main/Main.contract.json +79 -0
- package/src/components/Main/Main.module.scss +31 -0
- package/src/components/Main/index.tsx +124 -0
- package/src/components/Menu/Menu.module.scss +8 -10
- package/src/components/Popover/index.tsx +34 -2
- package/src/components/RadioGroup/RadioGroup.contract.json +13 -27
- package/src/components/RadioGroup/index.tsx +4 -0
- package/src/components/Select/Select.module.scss +13 -12
- package/src/components/Table/Table.module.scss +22 -5
- package/src/components/TableOfContents/TableOfContents.contract.json +6 -16
- package/src/components/TableOfContents/TableOfContents.module.scss +20 -14
- package/src/components/TableOfContents/index.tsx +27 -38
- package/src/components/Toast/Toast.module.scss +15 -2
- package/src/components/ToggleGroup/ToggleGroup.module.scss +4 -1
- package/src/index.ts +4 -0
- package/src/styles/globals.scss +13 -10
- package/src/tokens/_component-properties.scss +26 -0
- package/src/tokens/_computed.scss +22 -4
- package/src/tokens/_derive.scss +55 -6
- package/src/tokens/_palettes.scss +24 -0
- package/src/tokens/_seeds.scss +20 -12
- package/src/tokens/_variables.scss +110 -63
- package/dist/components/Cloud/DashboardLayoutPrototypes.shared.d.ts +0 -33
- package/dist/components/Cloud/DashboardLayoutPrototypes.shared.d.ts.map +0 -1
- package/dist/components/Cloud/DashboardLayoutPrototypes.shell.d.ts +0 -11
- package/dist/components/Cloud/DashboardLayoutPrototypes.shell.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.content.d.ts +0 -5
- package/dist/components/Cloud/PullRequestsPrototypes.content.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.detail-panels.d.ts +0 -4
- package/dist/components/Cloud/PullRequestsPrototypes.detail-panels.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.detail.d.ts +0 -3
- package/dist/components/Cloud/PullRequestsPrototypes.detail.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.id-data.d.ts +0 -86
- package/dist/components/Cloud/PullRequestsPrototypes.id-data.d.ts.map +0 -1
- package/dist/components/Cloud/PullRequestsPrototypes.id-page.d.ts +0 -2
- package/dist/components/Cloud/PullRequestsPrototypes.id-page.d.ts.map +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +0 -106
- package/src/components/Alert/Alert.stories.tsx +0 -119
- package/src/components/AppShell/AppShell.stories.tsx +0 -156
- package/src/components/Avatar/Avatar.stories.tsx +0 -74
- package/src/components/Badge/Badge.stories.tsx +0 -92
- package/src/components/BentoGrid/BentoGrid.stories.tsx +0 -98
- package/src/components/Box/Box.stories.tsx +0 -150
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -87
- package/src/components/Button/Button.stories.tsx +0 -103
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -97
- package/src/components/Card/Card.stories.tsx +0 -144
- package/src/components/Chart/Chart.stories.tsx +0 -119
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -68
- package/src/components/Chip/Chip.stories.tsx +0 -70
- package/src/components/Cloud/CloudGovernanceShell.module.scss +0 -88
- package/src/components/Cloud/CloudGovernanceShell.stories.tsx +0 -446
- package/src/components/Cloud/ControlSizing.module.scss +0 -49
- package/src/components/Cloud/ControlSizing.stories.tsx +0 -238
- package/src/components/Cloud/DashboardLayoutPrototypes.module.scss +0 -462
- package/src/components/Cloud/DashboardLayoutPrototypes.shared.tsx +0 -375
- package/src/components/Cloud/DashboardLayoutPrototypes.shell.tsx +0 -147
- package/src/components/Cloud/DashboardLayoutPrototypes.stories.tsx +0 -328
- package/src/components/Cloud/PullRequestsPrototypes.content.tsx +0 -283
- package/src/components/Cloud/PullRequestsPrototypes.detail-panels.tsx +0 -381
- package/src/components/Cloud/PullRequestsPrototypes.detail.tsx +0 -204
- package/src/components/Cloud/PullRequestsPrototypes.id-data.ts +0 -395
- package/src/components/Cloud/PullRequestsPrototypes.id-page.tsx +0 -349
- package/src/components/Cloud/PullRequestsPrototypes.stories.tsx +0 -81
- package/src/components/CodeBlock/CodeBlock.stories.tsx +0 -147
- package/src/components/Collapsible/Collapsible.stories.tsx +0 -94
- package/src/components/ColorPicker/ColorPicker.stories.tsx +0 -74
- package/src/components/Combobox/Combobox.stories.tsx +0 -133
- package/src/components/Command/Command.stories.tsx +0 -102
- package/src/components/ConversationList/ConversationList.stories.tsx +0 -93
- package/src/components/DataTable/DataTable.stories.tsx +0 -129
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -129
- package/src/components/Dialog/Dialog.stories.tsx +0 -154
- package/src/components/Drawer/Drawer.stories.tsx +0 -144
- package/src/components/Editor/Editor.stories.tsx +0 -99
- package/src/components/EmptyState/EmptyState.stories.tsx +0 -97
- package/src/components/Field/Field.stories.tsx +0 -109
- package/src/components/Fieldset/Fieldset.stories.tsx +0 -116
- package/src/components/Form/Form.stories.tsx +0 -142
- package/src/components/Grid/Grid.stories.tsx +0 -125
- package/src/components/Header/Header.stories.tsx +0 -133
- package/src/components/Icon/Icon.stories.tsx +0 -80
- package/src/components/IconButton/IconButton.stories.tsx +0 -78
- package/src/components/Image/Image.stories.tsx +0 -109
- package/src/components/Input/Input.stories.tsx +0 -104
- package/src/components/Link/Link.stories.tsx +0 -67
- package/src/components/List/List.stories.tsx +0 -95
- package/src/components/Listbox/Listbox.stories.tsx +0 -81
- package/src/components/Loading/Loading.stories.tsx +0 -69
- package/src/components/Markdown/Markdown.stories.tsx +0 -75
- package/src/components/Menu/Menu.stories.tsx +0 -113
- package/src/components/Message/Message.stories.tsx +0 -85
- package/src/components/NavigationMenu/NavigationMenu.stories.tsx +0 -161
- package/src/components/Pagination/Pagination.stories.tsx +0 -81
- package/src/components/Popover/Popover.stories.tsx +0 -152
- package/src/components/Progress/Progress.stories.tsx +0 -64
- package/src/components/Prompt/Prompt.stories.tsx +0 -93
- package/src/components/RadioGroup/RadioGroup.stories.tsx +0 -107
- package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -97
- package/src/components/Select/Select.stories.tsx +0 -127
- package/src/components/Separator/Separator.stories.tsx +0 -84
- package/src/components/Sidebar/Sidebar.stories.tsx +0 -122
- package/src/components/Skeleton/Skeleton.stories.tsx +0 -80
- package/src/components/Slider/Slider.stories.tsx +0 -73
- package/src/components/Stack/Stack.stories.tsx +0 -73
- package/src/components/Switch/Switch.stories.tsx +0 -59
- package/src/components/Table/Table.stories.tsx +0 -219
- package/src/components/TableOfContents/TableOfContents.stories.tsx +0 -120
- package/src/components/Tabs/Tabs.stories.tsx +0 -136
- package/src/components/Text/Text.stories.tsx +0 -133
- package/src/components/Textarea/Textarea.stories.tsx +0 -107
- package/src/components/Theme/Theme.stories.tsx +0 -95
- package/src/components/ThinkingIndicator/ThinkingIndicator.stories.tsx +0 -85
- package/src/components/Toast/Toast.stories.tsx +0 -91
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +0 -114
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -95
- package/src/components/VisuallyHidden/VisuallyHidden.stories.tsx +0 -78
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
1
|
+
@use "../../tokens/variables" as *;
|
|
2
|
+
@use "../../tokens/mixins" as *;
|
|
3
|
+
|
|
4
|
+
@mixin selected-surface {
|
|
5
|
+
background-color: var(--fui-field-selection-bg, $fui-bg-hover);
|
|
6
|
+
color: var(--fui-field-selection-color, $fui-text-primary);
|
|
7
|
+
|
|
8
|
+
&:hover:not(:disabled) {
|
|
9
|
+
background-color: var(--fui-field-selection-bg-hover, $fui-bg-hover);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&:active:not(:disabled) {
|
|
13
|
+
background-color: var(--fui-field-selection-bg-hover, $fui-bg-hover);
|
|
14
|
+
box-shadow: inset 0 0 0 1px var(--fui-field-selection-border, $fui-border-strong);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
3
17
|
|
|
4
18
|
.chip {
|
|
5
19
|
@include button-reset;
|
|
@@ -61,16 +75,7 @@
|
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
&.selected {
|
|
64
|
-
|
|
65
|
-
color: var(--fui-color-on-accent, $fui-color-on-accent);
|
|
66
|
-
|
|
67
|
-
&:hover:not(:disabled) {
|
|
68
|
-
background-color: var(--fui-color-accent-hover, $fui-color-accent-hover);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&:active:not(:disabled) {
|
|
72
|
-
background-color: var(--fui-color-accent-active, $fui-color-accent-active);
|
|
73
|
-
}
|
|
78
|
+
@include selected-surface;
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
|
|
@@ -89,19 +94,8 @@
|
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
&.selected {
|
|
92
|
-
|
|
93
|
-
color: var(--fui-
|
|
94
|
-
border-color: var(--fui-color-accent, $fui-color-accent);
|
|
95
|
-
|
|
96
|
-
&:hover:not(:disabled) {
|
|
97
|
-
background-color: var(--fui-color-accent-hover, $fui-color-accent-hover);
|
|
98
|
-
border-color: var(--fui-color-accent-hover, $fui-color-accent-hover);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&:active:not(:disabled) {
|
|
102
|
-
background-color: var(--fui-color-accent-active, $fui-color-accent-active);
|
|
103
|
-
border-color: var(--fui-color-accent-active, $fui-color-accent-active);
|
|
104
|
-
}
|
|
97
|
+
@include selected-surface;
|
|
98
|
+
border-color: var(--fui-field-selection-border, $fui-border-strong);
|
|
105
99
|
}
|
|
106
100
|
}
|
|
107
101
|
|
|
@@ -118,16 +112,7 @@
|
|
|
118
112
|
}
|
|
119
113
|
|
|
120
114
|
&.selected {
|
|
121
|
-
|
|
122
|
-
color: var(--fui-color-on-accent, $fui-color-on-accent);
|
|
123
|
-
|
|
124
|
-
&:hover:not(:disabled) {
|
|
125
|
-
background-color: var(--fui-color-accent-hover, $fui-color-accent-hover);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&:active:not(:disabled) {
|
|
129
|
-
background-color: var(--fui-color-accent-active, $fui-color-accent-active);
|
|
130
|
-
}
|
|
115
|
+
@include selected-surface;
|
|
131
116
|
}
|
|
132
117
|
}
|
|
133
118
|
|
|
@@ -244,17 +229,8 @@
|
|
|
244
229
|
}
|
|
245
230
|
|
|
246
231
|
.selected + .remove {
|
|
247
|
-
|
|
248
|
-
color: var(--fui-color-on-accent, $fui-color-on-accent);
|
|
232
|
+
@include selected-surface;
|
|
249
233
|
border-left-color: transparent;
|
|
250
|
-
|
|
251
|
-
&:hover:not(:disabled) {
|
|
252
|
-
background-color: var(--fui-color-accent-hover, $fui-color-accent-hover);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
&:active:not(:disabled) {
|
|
256
|
-
background-color: var(--fui-color-accent-active, $fui-color-accent-active);
|
|
257
|
-
}
|
|
258
234
|
}
|
|
259
235
|
|
|
260
236
|
// Chip.Group
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
@use "../../tokens/mixins" as *;
|
|
3
3
|
|
|
4
4
|
// Local component tokens (code blocks always dark — no light variant).
|
|
5
|
-
//
|
|
5
|
+
// Background and selection stay global so apps can theme CodeBlock and
|
|
6
|
+
// Markdown consistently without replacing either component.
|
|
6
7
|
$fui-code-text: #e2e2e5 !default;
|
|
7
8
|
$fui-code-text-muted: #8a8a9a !default;
|
|
8
9
|
$fui-code-border: rgba(255, 255, 255, 0.06) !default;
|
|
@@ -11,12 +12,6 @@ $fui-code-tab-text-active: #e2e2e5 !default;
|
|
|
11
12
|
$fui-code-copy-bg: rgba(255, 255, 255, 0.06) !default;
|
|
12
13
|
$fui-code-copy-bg-hover: rgba(255, 255, 255, 0.12) !default;
|
|
13
14
|
$fui-code-highlight-bg: rgba(255, 255, 255, 0.06) !default;
|
|
14
|
-
// Selection tint derived from the primary action blue instead of semantic state colors.
|
|
15
|
-
$fui-code-selection-bg: color-mix(
|
|
16
|
-
in srgb,
|
|
17
|
-
var(--fui-button-primary-base, #0a84ff) 30%,
|
|
18
|
-
transparent
|
|
19
|
-
) !default;
|
|
20
15
|
$fui-code-scrollbar-track: transparent !default;
|
|
21
16
|
$fui-code-scrollbar-thumb: rgba(255, 255, 255, 0.1) !default;
|
|
22
17
|
$fui-code-scrollbar-thumb-hover: rgba(255, 255, 255, 0.2) !default;
|
|
@@ -3,15 +3,7 @@
|
|
|
3
3
|
"name": "Combobox",
|
|
4
4
|
"description": "Searchable select input that filters a dropdown list of options as you type. Supports single and multiple selection with chips.",
|
|
5
5
|
"category": "forms",
|
|
6
|
-
"tags": [
|
|
7
|
-
"combobox",
|
|
8
|
-
"autocomplete",
|
|
9
|
-
"search",
|
|
10
|
-
"select",
|
|
11
|
-
"typeahead",
|
|
12
|
-
"form",
|
|
13
|
-
"multiselect"
|
|
14
|
-
],
|
|
6
|
+
"tags": ["combobox", "autocomplete", "search", "select", "typeahead", "form", "multiselect"],
|
|
15
7
|
"status": "stable",
|
|
16
8
|
"sourcePath": "src/components/Combobox/index.tsx",
|
|
17
9
|
"exportName": "Combobox",
|
|
@@ -110,11 +102,7 @@
|
|
|
110
102
|
"description": "Size variant",
|
|
111
103
|
"default": "md",
|
|
112
104
|
"required": false,
|
|
113
|
-
"values": [
|
|
114
|
-
"sm",
|
|
115
|
-
"md",
|
|
116
|
-
"lg"
|
|
117
|
-
]
|
|
105
|
+
"values": ["sm", "md", "lg"]
|
|
118
106
|
},
|
|
119
107
|
"className": {
|
|
120
108
|
"type": "string",
|
|
@@ -163,6 +151,7 @@
|
|
|
163
151
|
"Use helperText for guidance and error for validation messages",
|
|
164
152
|
"Provide an empty state message when no results match",
|
|
165
153
|
"Group related options with Combobox.Group for large lists",
|
|
154
|
+
"Static items may be composed through fragments and groups; filtering preserves wrapper composition",
|
|
166
155
|
"Keep option text concise and searchable",
|
|
167
156
|
"Use multiple prop for multi-select with chip display"
|
|
168
157
|
],
|
|
@@ -198,7 +187,7 @@
|
|
|
198
187
|
{
|
|
199
188
|
"name": "With Groups",
|
|
200
189
|
"description": "Options organized into groups",
|
|
201
|
-
"code": "<StatefulCombobox placeholder=\"Search countries...\">\n <Combobox.Input />\n <Combobox.Content>\n <Combobox.Group>\n
|
|
190
|
+
"code": "<StatefulCombobox placeholder=\"Search countries...\">\n <Combobox.Input />\n <Combobox.Content>\n <>\n <Combobox.Group>\n <Combobox.GroupLabel>North America</Combobox.GroupLabel>\n <Combobox.Item value=\"us\">United States</Combobox.Item>\n <Combobox.Item value=\"ca\">Canada</Combobox.Item>\n <Combobox.Item value=\"mx\">Mexico</Combobox.Item>\n </Combobox.Group>\n <Combobox.Group>\n <Combobox.GroupLabel>Europe</Combobox.GroupLabel>\n <Combobox.Item value=\"uk\">United Kingdom</Combobox.Item>\n <Combobox.Item value=\"de\">Germany</Combobox.Item>\n <Combobox.Item value=\"fr\">France</Combobox.Item>\n </Combobox.Group>\n <Combobox.Empty>No matching country</Combobox.Empty>\n </>\n </Combobox.Content>\n</StatefulCombobox>"
|
|
202
191
|
},
|
|
203
192
|
{
|
|
204
193
|
"name": "With Empty State",
|
|
@@ -260,11 +249,7 @@
|
|
|
260
249
|
"Combobox.Input showTrigger: boolean - hide built-in trigger when using Combobox.Trigger explicitly",
|
|
261
250
|
"maxVisibleItems: number - max visible options before scrolling (default 4)"
|
|
262
251
|
],
|
|
263
|
-
"a11yRules": [
|
|
264
|
-
"A11Y_COMBOBOX_KEYBOARD",
|
|
265
|
-
"A11Y_COMBOBOX_LABEL",
|
|
266
|
-
"A11Y_TARGET_SIZE_MIN"
|
|
267
|
-
]
|
|
252
|
+
"a11yRules": ["A11Y_COMBOBOX_KEYBOARD", "A11Y_COMBOBOX_LABEL", "A11Y_TARGET_SIZE_MIN"]
|
|
268
253
|
},
|
|
269
254
|
"ai": {
|
|
270
255
|
"compositionPattern": "compound",
|
|
@@ -278,10 +263,7 @@
|
|
|
278
263
|
"Group",
|
|
279
264
|
"GroupLabel"
|
|
280
265
|
],
|
|
281
|
-
"requiredChildren": [
|
|
282
|
-
"Input",
|
|
283
|
-
"Content"
|
|
284
|
-
],
|
|
266
|
+
"requiredChildren": ["Input", "Content"],
|
|
285
267
|
"commonPatterns": [
|
|
286
268
|
"<Combobox placeholder=\"Search...\"><Combobox.Input /><Combobox.Content><Combobox.Item value=\"opt1\">{label1}</Combobox.Item><Combobox.Item value=\"opt2\">{label2}</Combobox.Item></Combobox.Content></Combobox>",
|
|
287
269
|
"<Combobox multiple placeholder=\"Select items...\"><Combobox.Input /><Combobox.Content><Combobox.Item value=\"opt1\">{label1}</Combobox.Item><Combobox.Item value=\"opt2\">{label2}</Combobox.Item></Combobox.Content></Combobox>",
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
border-color: var(--fui-form-group-border, $fui-border);
|
|
198
198
|
|
|
199
199
|
// Item height derived from text-base font + vertical padding
|
|
200
|
-
--
|
|
200
|
+
--_combobox-item-h: calc(
|
|
201
201
|
var(--fui-font-size-sm, #{$fui-font-size-sm}) *
|
|
202
202
|
var(--fui-line-height-normal, #{$fui-line-height-normal}) +
|
|
203
203
|
var(--fui-space-2, #{$fui-space-2}) * 2
|
|
@@ -207,7 +207,8 @@
|
|
|
207
207
|
// Show N items + half-peek scroll hint (default 4.5 items)
|
|
208
208
|
// !important needed to override Base UI's inline max-height: 100%
|
|
209
209
|
max-height: calc(
|
|
210
|
-
var(--
|
|
210
|
+
var(--_combobox-item-h) * var(--fui-select-max-items, 4.5) +
|
|
211
|
+
var(--fui-space-1, #{$fui-space-1}) * 2
|
|
211
212
|
) !important;
|
|
212
213
|
overflow-y: auto !important;
|
|
213
214
|
|
|
@@ -168,6 +168,7 @@ interface ComboboxContextValue {
|
|
|
168
168
|
placeholder?: string;
|
|
169
169
|
multiple?: boolean;
|
|
170
170
|
selectedValues: string[];
|
|
171
|
+
staticLabels: ReadonlyMap<string, string>;
|
|
171
172
|
itemsRef: React.MutableRefObject<Map<string, string>>;
|
|
172
173
|
itemsVersion: number;
|
|
173
174
|
incrementItemsVersion: () => void;
|
|
@@ -178,8 +179,11 @@ interface ComboboxContextValue {
|
|
|
178
179
|
inputId?: string;
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
const EMPTY_STATIC_LABELS = new Map<string, string>();
|
|
183
|
+
|
|
181
184
|
const ComboboxContext = React.createContext<ComboboxContextValue>({
|
|
182
185
|
selectedValues: [],
|
|
186
|
+
staticLabels: EMPTY_STATIC_LABELS,
|
|
183
187
|
itemsRef: { current: new Map() },
|
|
184
188
|
itemsVersion: 0,
|
|
185
189
|
incrementItemsVersion: () => {},
|
|
@@ -188,6 +192,16 @@ const ComboboxContext = React.createContext<ComboboxContextValue>({
|
|
|
188
192
|
size: "md",
|
|
189
193
|
});
|
|
190
194
|
|
|
195
|
+
const EMPTY_FILTERED_ITEM_INDICES = new Map<string, number>();
|
|
196
|
+
const ComboboxFilteredItemIndexContext = React.createContext<ReadonlyMap<string, number>>(
|
|
197
|
+
EMPTY_FILTERED_ITEM_INDICES
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
function itemIndicesFromSerializedValues(serializedValues: string): ReadonlyMap<string, number> {
|
|
201
|
+
const values = JSON.parse(serializedValues) as string[];
|
|
202
|
+
return new Map(values.map((value, index) => [value, index]));
|
|
203
|
+
}
|
|
204
|
+
|
|
191
205
|
function getNodeText(node: React.ReactNode): string {
|
|
192
206
|
if (node == null || typeof node === "boolean") return "";
|
|
193
207
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
@@ -197,6 +211,84 @@ function getNodeText(node: React.ReactNode): string {
|
|
|
197
211
|
return "";
|
|
198
212
|
}
|
|
199
213
|
|
|
214
|
+
interface ComboboxStaticItem {
|
|
215
|
+
label: string;
|
|
216
|
+
value: string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function collectStaticItems(node: React.ReactNode): ComboboxStaticItem[] {
|
|
220
|
+
const items: ComboboxStaticItem[] = [];
|
|
221
|
+
|
|
222
|
+
React.Children.forEach(node, (child) => {
|
|
223
|
+
if (!React.isValidElement(child)) return;
|
|
224
|
+
if (child.type === ComboboxItem) {
|
|
225
|
+
const props = child.props as ComboboxItemProps;
|
|
226
|
+
items.push({
|
|
227
|
+
label: getNodeText(props.children).trim() || props.value,
|
|
228
|
+
value: props.value,
|
|
229
|
+
});
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
collectStaticItems((child.props as { children?: React.ReactNode }).children).forEach((item) =>
|
|
233
|
+
items.push(item)
|
|
234
|
+
);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
return items;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface FilterStaticChildrenResult {
|
|
241
|
+
children: React.ReactNode;
|
|
242
|
+
visibleItemCount: number;
|
|
243
|
+
changed: boolean;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function filterStaticChildren(
|
|
247
|
+
node: React.ReactNode,
|
|
248
|
+
visibleValues: ReadonlySet<string>
|
|
249
|
+
): FilterStaticChildrenResult {
|
|
250
|
+
let visibleItemCount = 0;
|
|
251
|
+
let changed = false;
|
|
252
|
+
|
|
253
|
+
const filteredChildren = React.Children.map(node, (child) => {
|
|
254
|
+
if (!React.isValidElement(child)) return child;
|
|
255
|
+
if (child.type === ComboboxItem) {
|
|
256
|
+
const props = child.props as ComboboxItemProps;
|
|
257
|
+
if (visibleValues.has(props.value)) {
|
|
258
|
+
visibleItemCount += 1;
|
|
259
|
+
return child;
|
|
260
|
+
}
|
|
261
|
+
changed = true;
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const props = child.props as { children?: React.ReactNode };
|
|
266
|
+
if (props.children === undefined) return child;
|
|
267
|
+
|
|
268
|
+
const nested = filterStaticChildren(props.children, visibleValues);
|
|
269
|
+
visibleItemCount += nested.visibleItemCount;
|
|
270
|
+
|
|
271
|
+
if (child.type === ComboboxGroup && nested.visibleItemCount === 0) {
|
|
272
|
+
changed = true;
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
if (!nested.changed) return child;
|
|
276
|
+
|
|
277
|
+
changed = true;
|
|
278
|
+
return React.cloneElement(
|
|
279
|
+
child as React.ReactElement<{ children?: React.ReactNode }>,
|
|
280
|
+
undefined,
|
|
281
|
+
nested.children
|
|
282
|
+
);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
return {
|
|
286
|
+
children: changed ? filteredChildren : node,
|
|
287
|
+
visibleItemCount,
|
|
288
|
+
changed,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
200
292
|
// ============================================
|
|
201
293
|
// Components
|
|
202
294
|
// ============================================
|
|
@@ -230,6 +322,12 @@ const ComboboxRoot = React.forwardRef<HTMLDivElement, ComboboxProps>(function Co
|
|
|
230
322
|
ref
|
|
231
323
|
) {
|
|
232
324
|
const size = useResolvedControlSize(sizeProp);
|
|
325
|
+
const staticItems = React.useMemo(() => collectStaticItems(children), [children]);
|
|
326
|
+
const staticValues = React.useMemo(() => staticItems.map((item) => item.value), [staticItems]);
|
|
327
|
+
const staticLabels = React.useMemo(
|
|
328
|
+
() => new Map(staticItems.map((item) => [item.value, item.label])),
|
|
329
|
+
[staticItems]
|
|
330
|
+
);
|
|
233
331
|
// Track selected values for chip rendering
|
|
234
332
|
const [internalValue, setInternalValue] = React.useState<string | string[] | null>(
|
|
235
333
|
value ?? defaultValue ?? (multiple ? [] : null)
|
|
@@ -262,9 +360,11 @@ const ComboboxRoot = React.forwardRef<HTMLDivElement, ComboboxProps>(function Co
|
|
|
262
360
|
);
|
|
263
361
|
|
|
264
362
|
// Convert value → label for input display
|
|
265
|
-
const itemToStringLabel = React.useCallback(
|
|
266
|
-
|
|
267
|
-
|
|
363
|
+
const itemToStringLabel = React.useCallback(
|
|
364
|
+
(itemValue: string) =>
|
|
365
|
+
staticLabels.get(itemValue) ?? itemsRef.current.get(itemValue) ?? itemValue,
|
|
366
|
+
[staticLabels]
|
|
367
|
+
);
|
|
268
368
|
|
|
269
369
|
// Derive selected values array for chip rendering
|
|
270
370
|
const currentValue = value !== undefined ? value : internalValue;
|
|
@@ -292,6 +392,7 @@ const ComboboxRoot = React.forwardRef<HTMLDivElement, ComboboxProps>(function Co
|
|
|
292
392
|
placeholder,
|
|
293
393
|
multiple,
|
|
294
394
|
selectedValues,
|
|
395
|
+
staticLabels,
|
|
295
396
|
itemsRef,
|
|
296
397
|
itemsVersion,
|
|
297
398
|
incrementItemsVersion,
|
|
@@ -304,6 +405,7 @@ const ComboboxRoot = React.forwardRef<HTMLDivElement, ComboboxProps>(function Co
|
|
|
304
405
|
placeholder,
|
|
305
406
|
multiple,
|
|
306
407
|
selectedValues,
|
|
408
|
+
staticLabels,
|
|
307
409
|
itemsVersion,
|
|
308
410
|
incrementItemsVersion,
|
|
309
411
|
explicitTriggerCount,
|
|
@@ -347,6 +449,7 @@ const ComboboxRoot = React.forwardRef<HTMLDivElement, ComboboxProps>(function Co
|
|
|
347
449
|
<ComboboxContext.Provider value={contextValue}>
|
|
348
450
|
{wrapperContent(
|
|
349
451
|
<BaseCombobox.Root<string, true>
|
|
452
|
+
items={staticValues}
|
|
350
453
|
value={controlledValue}
|
|
351
454
|
defaultValue={uncontrolledValue}
|
|
352
455
|
onValueChange={handleValueChange}
|
|
@@ -391,6 +494,7 @@ const ComboboxRoot = React.forwardRef<HTMLDivElement, ComboboxProps>(function Co
|
|
|
391
494
|
<ComboboxContext.Provider value={contextValue}>
|
|
392
495
|
{wrapperContent(
|
|
393
496
|
<BaseCombobox.Root<string, false>
|
|
497
|
+
items={staticValues}
|
|
394
498
|
value={controlledValue}
|
|
395
499
|
defaultValue={uncontrolledValue ?? null}
|
|
396
500
|
onValueChange={handleValueChange}
|
|
@@ -450,7 +554,9 @@ function ComboboxInput({
|
|
|
450
554
|
{context.selectedValues.map((chipValue) => (
|
|
451
555
|
<BaseCombobox.Chip key={chipValue} className={styles.chip}>
|
|
452
556
|
<span className={styles.chipLabel}>
|
|
453
|
-
{context.
|
|
557
|
+
{context.staticLabels.get(chipValue) ??
|
|
558
|
+
context.itemsRef.current.get(chipValue) ??
|
|
559
|
+
chipValue}
|
|
454
560
|
</span>
|
|
455
561
|
<BaseCombobox.ChipRemove className={styles.chipRemove}>
|
|
456
562
|
<XIcon />
|
|
@@ -512,6 +618,17 @@ function ComboboxContent({
|
|
|
512
618
|
...htmlProps
|
|
513
619
|
}: ComboboxContentProps) {
|
|
514
620
|
const popupClasses = [styles.popup, className].filter(Boolean).join(" ");
|
|
621
|
+
const filteredItems = BaseCombobox.useFilteredItems() as string[];
|
|
622
|
+
const serializedFilteredItems = JSON.stringify(filteredItems);
|
|
623
|
+
const filteredItemIndices = React.useMemo(
|
|
624
|
+
() => itemIndicesFromSerializedValues(serializedFilteredItems),
|
|
625
|
+
[serializedFilteredItems]
|
|
626
|
+
);
|
|
627
|
+
const visibleValues = React.useMemo(() => new Set(filteredItems), [filteredItems]);
|
|
628
|
+
const filteredContent = React.useMemo(
|
|
629
|
+
() => filterStaticChildren(children, visibleValues),
|
|
630
|
+
[children, visibleValues]
|
|
631
|
+
);
|
|
515
632
|
|
|
516
633
|
const popupStyle =
|
|
517
634
|
maxVisibleItems != null
|
|
@@ -530,7 +647,9 @@ function ComboboxContent({
|
|
|
530
647
|
className={styles.positioner}
|
|
531
648
|
>
|
|
532
649
|
<BaseCombobox.Popup {...htmlProps} className={popupClasses} style={popupStyle}>
|
|
533
|
-
{
|
|
650
|
+
<ComboboxFilteredItemIndexContext.Provider value={filteredItemIndices}>
|
|
651
|
+
{filteredContent.children}
|
|
652
|
+
</ComboboxFilteredItemIndexContext.Provider>
|
|
534
653
|
</BaseCombobox.Popup>
|
|
535
654
|
</BaseCombobox.Positioner>
|
|
536
655
|
</BaseCombobox.Portal>
|
|
@@ -539,6 +658,7 @@ function ComboboxContent({
|
|
|
539
658
|
|
|
540
659
|
function ComboboxItem({ children, value, disabled, className, ...htmlProps }: ComboboxItemProps) {
|
|
541
660
|
const { itemsRef, incrementItemsVersion } = React.useContext(ComboboxContext);
|
|
661
|
+
const filteredItemIndices = React.useContext(ComboboxFilteredItemIndexContext);
|
|
542
662
|
const classes = [styles.item, className].filter(Boolean).join(" ");
|
|
543
663
|
|
|
544
664
|
// Register this item's label in the registry so the input can display it
|
|
@@ -555,7 +675,13 @@ function ComboboxItem({ children, value, disabled, className, ...htmlProps }: Co
|
|
|
555
675
|
}, [itemsRef, incrementItemsVersion, value, label]);
|
|
556
676
|
|
|
557
677
|
return (
|
|
558
|
-
<BaseCombobox.Item
|
|
678
|
+
<BaseCombobox.Item
|
|
679
|
+
{...htmlProps}
|
|
680
|
+
value={value}
|
|
681
|
+
index={filteredItemIndices.get(value)}
|
|
682
|
+
disabled={disabled}
|
|
683
|
+
className={classes}
|
|
684
|
+
>
|
|
559
685
|
{children}
|
|
560
686
|
<BaseCombobox.ItemIndicator className={styles.itemIndicator}>
|
|
561
687
|
<CheckIcon />
|
|
@@ -3,14 +3,7 @@
|
|
|
3
3
|
"name": "DataTable",
|
|
4
4
|
"description": "Data table with sorting, selection, and column management. Powered by TanStack Table.",
|
|
5
5
|
"category": "display",
|
|
6
|
-
"tags": [
|
|
7
|
-
"table",
|
|
8
|
-
"data",
|
|
9
|
-
"grid",
|
|
10
|
-
"list",
|
|
11
|
-
"sorting",
|
|
12
|
-
"tanstack"
|
|
13
|
-
],
|
|
6
|
+
"tags": ["table", "data", "grid", "list", "sorting", "tanstack"],
|
|
14
7
|
"status": "stable",
|
|
15
8
|
"sourcePath": "src/components/DataTable/index.tsx",
|
|
16
9
|
"exportName": "DataTable",
|
|
@@ -26,6 +19,7 @@
|
|
|
26
19
|
"rowSelection: object",
|
|
27
20
|
"onRowSelectionChange: function",
|
|
28
21
|
"onRowClick: function",
|
|
22
|
+
"getRowProps: function",
|
|
29
23
|
"getSubRows: function",
|
|
30
24
|
"expanded: union",
|
|
31
25
|
"onExpandedChange: function",
|
|
@@ -97,6 +91,11 @@
|
|
|
97
91
|
"description": "Handler for row clicks/keyboard activation. Called as (row, event)",
|
|
98
92
|
"required": false
|
|
99
93
|
},
|
|
94
|
+
"getRowProps": {
|
|
95
|
+
"type": "function",
|
|
96
|
+
"description": "Returns row-level HTML, ARIA, data, class, and event props for each rendered data row",
|
|
97
|
+
"required": false
|
|
98
|
+
},
|
|
100
99
|
"getSubRows": {
|
|
101
100
|
"type": "function",
|
|
102
101
|
"description": "Extract sub-rows for expandable tree tables",
|
|
@@ -123,10 +122,7 @@
|
|
|
123
122
|
"description": "Table density",
|
|
124
123
|
"default": "md",
|
|
125
124
|
"required": false,
|
|
126
|
-
"values": [
|
|
127
|
-
"sm",
|
|
128
|
-
"md"
|
|
129
|
-
]
|
|
125
|
+
"values": ["sm", "md"]
|
|
130
126
|
},
|
|
131
127
|
"caption": {
|
|
132
128
|
"type": "string",
|
|
@@ -181,13 +177,15 @@
|
|
|
181
177
|
"Use consistent alignment (numbers right, text left)",
|
|
182
178
|
"Provide meaningful empty states",
|
|
183
179
|
"Consider mobile responsiveness",
|
|
184
|
-
"Use showCheckbox for bulk selection workflows"
|
|
180
|
+
"Use showCheckbox for bulk selection workflows",
|
|
181
|
+
"Use getRowProps to provide an accessible name and intentional semantics for clickable rows"
|
|
185
182
|
],
|
|
186
183
|
"accessibility": [
|
|
187
184
|
"Proper table semantics with headers",
|
|
188
185
|
"Sortable columns are keyboard accessible",
|
|
189
186
|
"Row selection checkboxes include aria-labels",
|
|
190
|
-
"Expand/collapse buttons have aria-expanded state"
|
|
187
|
+
"Expand/collapse buttons have aria-expanded state",
|
|
188
|
+
"Clickable rows expose an accessible action label through getRowProps"
|
|
191
189
|
]
|
|
192
190
|
},
|
|
193
191
|
"examples": [
|
|
@@ -224,7 +222,7 @@
|
|
|
224
222
|
{
|
|
225
223
|
"name": "Clickable Rows",
|
|
226
224
|
"description": "Rows respond to click and keyboard activation",
|
|
227
|
-
"code": "<DataTable\n columns={endpointColumns}\n data={sampleEndpoints}\n onRowClick={(row) => alert(`${row.method} ${row.path}`)}\n size=\"sm\"\n aria-label=\"API endpoints\"\n/>"
|
|
225
|
+
"code": "<DataTable\n columns={endpointColumns}\n data={sampleEndpoints}\n getRowProps={(row) => ({\n role: 'button',\n 'aria-label': `Open ${row.method} ${row.path}`,\n })}\n onRowClick={(row) => alert(`${row.method} ${row.path}`)}\n size=\"sm\"\n aria-label=\"API endpoints\"\n/>"
|
|
228
226
|
},
|
|
229
227
|
{
|
|
230
228
|
"name": "Striped",
|
|
@@ -273,22 +271,17 @@
|
|
|
273
271
|
"showCheckbox: boolean - add checkbox column",
|
|
274
272
|
"getSubRows: (row) => T[] - enable expandable rows",
|
|
275
273
|
"onRowClick: (row, event) => void - row activation handler with event access",
|
|
274
|
+
"getRowProps: (row) => HTMLAttributes<HTMLTableRowElement> - row-level ARIA, role, data, class, and event props",
|
|
276
275
|
"size: sm|md - table density",
|
|
277
276
|
"striped: boolean - alternating row backgrounds",
|
|
278
277
|
"bordered: boolean - bordered container",
|
|
279
278
|
"wrapperClassName / wrapperProps - style and configure the outer wrapper div"
|
|
280
279
|
],
|
|
281
|
-
"a11yRules": [
|
|
282
|
-
"A11Y_TABLE_HEADERS",
|
|
283
|
-
"A11Y_TABLE_SORT"
|
|
284
|
-
]
|
|
280
|
+
"a11yRules": ["A11Y_TABLE_HEADERS", "A11Y_TABLE_SORT"]
|
|
285
281
|
},
|
|
286
282
|
"ai": {
|
|
287
283
|
"compositionPattern": "simple",
|
|
288
|
-
"subComponents": [
|
|
289
|
-
"Root",
|
|
290
|
-
"Columns"
|
|
291
|
-
],
|
|
284
|
+
"subComponents": ["Root", "Columns"],
|
|
292
285
|
"commonPatterns": [
|
|
293
286
|
"<DataTable columns={createColumns([{key:\"name\",header:\"Name\"},{key:\"status\",header:\"Status\"}])} data={[{name:\"Item 1\",status:\"Active\"}]} />"
|
|
294
287
|
]
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
.wrapper {
|
|
5
5
|
--fui-data-table-bg: var(--fui-table-bg, var(--fui-bg-elevated, #{$fui-bg-elevated}));
|
|
6
|
-
--fui-data-table-header-bg: var(
|
|
6
|
+
--fui-data-table-header-bg: var(
|
|
7
|
+
--fui-table-header-bg,
|
|
8
|
+
color-mix(in srgb, var(--fui-text-primary, #{$fui-text-primary}) 5%, transparent)
|
|
9
|
+
);
|
|
7
10
|
|
|
8
11
|
overflow-x: auto;
|
|
9
12
|
-webkit-overflow-scrolling: touch;
|
|
@@ -69,7 +72,10 @@
|
|
|
69
72
|
user-select: none;
|
|
70
73
|
// Opaque so the sticky header doesn't let rows bleed through on scroll,
|
|
71
74
|
// while inheriting the table surface instead of forcing the page background.
|
|
72
|
-
background: var(
|
|
75
|
+
background: var(
|
|
76
|
+
--fui-data-table-header-bg,
|
|
77
|
+
var(--fui-data-table-bg, var(--fui-bg-primary, #{$fui-bg-primary}))
|
|
78
|
+
);
|
|
73
79
|
|
|
74
80
|
&:first-child {
|
|
75
81
|
border-top-left-radius: var(--fui-radius-md, $fui-radius-md);
|
|
@@ -142,6 +148,10 @@
|
|
|
142
148
|
|
|
143
149
|
// Body
|
|
144
150
|
.tbody {
|
|
151
|
+
.td {
|
|
152
|
+
padding-top: var(--fui-space-2, $fui-space-2);
|
|
153
|
+
padding-bottom: var(--fui-space-2, $fui-space-2);
|
|
154
|
+
}
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
.row {
|
|
@@ -174,11 +184,18 @@
|
|
|
174
184
|
}
|
|
175
185
|
|
|
176
186
|
.selected {
|
|
177
|
-
background-color: var(
|
|
178
|
-
|
|
187
|
+
background-color: var(
|
|
188
|
+
--fui-table-row-selected-bg,
|
|
189
|
+
color-mix(in srgb, var(--fui-text-primary, #{$fui-text-primary}) 8%, transparent)
|
|
190
|
+
);
|
|
191
|
+
box-shadow: inset 1px 0 0
|
|
192
|
+
var(--fui-table-row-selected-border, var(--fui-border-strong, #{$fui-border-strong}));
|
|
179
193
|
|
|
180
194
|
&:hover {
|
|
181
|
-
background-color: var(
|
|
195
|
+
background-color: var(
|
|
196
|
+
--fui-table-row-selected-bg,
|
|
197
|
+
color-mix(in srgb, var(--fui-text-primary, #{$fui-text-primary}) 10%, transparent)
|
|
198
|
+
);
|
|
182
199
|
}
|
|
183
200
|
}
|
|
184
201
|
|
|
@@ -204,10 +221,16 @@
|
|
|
204
221
|
}
|
|
205
222
|
|
|
206
223
|
.selected {
|
|
207
|
-
background-color: var(
|
|
224
|
+
background-color: var(
|
|
225
|
+
--fui-table-row-selected-bg,
|
|
226
|
+
color-mix(in srgb, var(--fui-text-primary, #{$fui-text-primary}) 8%, transparent)
|
|
227
|
+
);
|
|
208
228
|
|
|
209
229
|
&:hover {
|
|
210
|
-
background-color: var(
|
|
230
|
+
background-color: var(
|
|
231
|
+
--fui-table-row-selected-bg,
|
|
232
|
+
color-mix(in srgb, var(--fui-text-primary, #{$fui-text-primary}) 10%, transparent)
|
|
233
|
+
);
|
|
211
234
|
}
|
|
212
235
|
}
|
|
213
236
|
}
|
|
@@ -216,7 +239,7 @@
|
|
|
216
239
|
.bordered {
|
|
217
240
|
border: 1px solid var(--fui-table-border, var(--fui-border, #{$fui-border}));
|
|
218
241
|
border-radius: var(--fui-radius-md, $fui-radius-md);
|
|
219
|
-
background: var(--fui-data-table-bg);
|
|
242
|
+
background: var(--fui-data-table-bg, var(--fui-bg-primary, #{$fui-bg-primary}));
|
|
220
243
|
overflow: hidden;
|
|
221
244
|
}
|
|
222
245
|
|