@usefragments/ui 1.6.0 → 1.7.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 +4 -4
- 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/ui.css +4720 -4159
- package/dist/chart.cjs +24 -6
- package/dist/chart.js +24 -6
- package/dist/codeblock.cjs +55 -29
- package/dist/codeblock.js +55 -29
- package/dist/colorpicker.cjs +3 -1
- package/dist/colorpicker.js +3 -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 +15 -12
- package/dist/components/Alert/Alert.module.scss.js +15 -12
- package/dist/components/Alert/index.cjs +7 -1
- package/dist/components/Alert/index.d.ts +12 -6
- package/dist/components/Alert/index.d.ts.map +1 -1
- package/dist/components/Alert/index.js +7 -1
- package/dist/components/AppShell/AppShell.module.scss.cjs +14 -14
- package/dist/components/AppShell/AppShell.module.scss.js +14 -14
- 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 +19 -19
- package/dist/components/Badge/Badge.module.scss.js +19 -19
- 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 +8 -8
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.js +8 -8
- package/dist/components/Button/Button.module.scss.cjs +14 -14
- package/dist/components/Button/Button.module.scss.js +14 -14
- package/dist/components/Card/Card.module.scss.cjs +29 -17
- package/dist/components/Card/Card.module.scss.js +30 -18
- package/dist/components/Card/index.cjs +8 -0
- package/dist/components/Card/index.d.ts +12 -2
- package/dist/components/Card/index.d.ts.map +1 -1
- package/dist/components/Card/index.js +8 -0
- 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 +9 -9
- package/dist/components/Checkbox/Checkbox.module.scss.js +9 -9
- package/dist/components/Checkbox/index.cjs +2 -2
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +2 -2
- package/dist/components/Chip/Chip.module.scss.cjs +15 -15
- package/dist/components/Chip/Chip.module.scss.js +15 -15
- package/dist/components/Chip/index.cjs +2 -1
- package/dist/components/Chip/index.d.ts.map +1 -1
- package/dist/components/Chip/index.js +2 -1
- 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 +17 -3
- 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 +17 -1
- package/dist/components/Combobox/index.d.ts.map +1 -1
- package/dist/components/Combobox/index.js +17 -1
- package/dist/components/Command/Command.module.scss.cjs +11 -11
- package/dist/components/Command/Command.module.scss.js +11 -11
- package/dist/components/Command/index.cjs +26 -15
- package/dist/components/Command/index.d.ts +2 -2
- package/dist/components/Command/index.d.ts.map +1 -1
- package/dist/components/Command/index.js +26 -15
- 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.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 +27 -27
- package/dist/components/DataTable/DataTable.module.scss.js +27 -27
- 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 +11 -14
- package/dist/components/Dialog/index.d.ts +7 -7
- package/dist/components/Dialog/index.d.ts.map +1 -1
- package/dist/components/Dialog/index.js +11 -14
- package/dist/components/Drawer/Drawer.module.scss.cjs +29 -29
- package/dist/components/Drawer/Drawer.module.scss.js +29 -29
- 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 +8 -6
- package/dist/components/EmptyState/index.d.ts +9 -4
- package/dist/components/EmptyState/index.d.ts.map +1 -1
- package/dist/components/EmptyState/index.js +8 -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/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 +15 -15
- package/dist/components/Icon/Icon.module.scss.js +15 -15
- package/dist/components/IconButton/IconButton.module.scss.cjs +8 -8
- package/dist/components/IconButton/IconButton.module.scss.js +8 -8
- package/dist/components/IconButton/index.cjs +2 -1
- 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 +17 -17
- package/dist/components/Input/Input.module.scss.js +17 -17
- package/dist/components/Link/Link.module.scss.cjs +14 -10
- package/dist/components/Link/Link.module.scss.js +14 -10
- package/dist/components/Link/index.d.ts +1 -1
- package/dist/components/Link/index.d.ts.map +1 -1
- 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 +34 -34
- package/dist/components/Loading/Loading.module.scss.js +34 -34
- package/dist/components/Loading/index.cjs +1 -1
- package/dist/components/Loading/index.js +1 -1
- 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 +18 -18
- package/dist/components/Message/Message.module.scss.js +18 -18
- 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 +25 -25
- package/dist/components/Progress/Progress.module.scss.js +25 -25
- package/dist/components/Prompt/Prompt.module.scss.cjs +28 -28
- package/dist/components/Prompt/Prompt.module.scss.js +28 -28
- package/dist/components/RadioGroup/RadioGroup.module.scss.cjs +15 -15
- package/dist/components/RadioGroup/RadioGroup.module.scss.js +15 -15
- 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/Separator/Separator.module.scss.cjs +11 -11
- package/dist/components/Separator/Separator.module.scss.js +11 -11
- 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 +12 -35
- 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 +12 -35
- package/dist/components/Skeleton/Skeleton.module.scss.cjs +50 -46
- package/dist/components/Skeleton/Skeleton.module.scss.js +50 -46
- 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 +13 -9
- 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 +13 -9
- package/dist/components/Tabs/Tabs.module.scss.cjs +12 -12
- package/dist/components/Tabs/Tabs.module.scss.js +12 -12
- package/dist/components/Tabs/index.cjs +26 -6
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +26 -6
- package/dist/components/Text/Text.module.scss.cjs +87 -75
- package/dist/components/Text/Text.module.scss.js +87 -75
- package/dist/components/Text/index.cjs +49 -41
- package/dist/components/Text/index.d.ts +12 -11
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/components/Text/index.js +49 -41
- package/dist/components/Textarea/Textarea.module.scss.cjs +24 -24
- package/dist/components/Textarea/Textarea.module.scss.js +24 -24
- package/dist/components/Theme/index.cjs +2 -1
- package/dist/components/Theme/index.d.ts.map +1 -1
- package/dist/components/Theme/index.js +2 -1
- package/dist/components/ThemeToggle/ThemeToggle.module.scss.cjs +9 -6
- package/dist/components/ThemeToggle/ThemeToggle.module.scss.js +9 -6
- package/dist/components/ThemeToggle/index.cjs +31 -6
- package/dist/components/ThemeToggle/index.d.ts +7 -2
- package/dist/components/ThemeToggle/index.d.ts.map +1 -1
- package/dist/components/ThemeToggle/index.js +32 -7
- 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 +20 -20
- package/dist/components/Toast/Toast.module.scss.js +20 -20
- 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/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/index.d.ts +2 -2
- package/dist/data-table.cjs +2 -1
- package/dist/data-table.js +2 -1
- package/dist/datepicker.cjs +3 -2
- package/dist/datepicker.js +3 -2
- package/dist/editor.cjs +68 -28
- package/dist/editor.js +68 -28
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/markdown.cjs +21 -29
- package/dist/markdown.js +21 -29
- package/dist/measurements/generated.cjs +9 -1
- package/dist/measurements/generated.d.ts +7 -0
- package/dist/measurements/generated.d.ts.map +1 -1
- package/dist/measurements/generated.js +9 -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 -6
- package/dist/utils/seed-derivation.d.ts.map +1 -1
- package/dist/utils/seed-derivation.js +10 -6
- package/fragments.json +1 -1
- package/package.json +6 -4
- package/src/assets/fragments-logo.tsx +2 -2
- package/src/assets/fragments-wordmark.tsx +4 -2
- package/src/components/Accordion/Accordion.contract.json +24 -48
- package/src/components/Alert/Alert.contract.json +37 -53
- package/src/components/Alert/Alert.module.scss +24 -0
- package/src/components/Alert/index.tsx +55 -29
- package/src/components/AppShell/AppShell.contract.json +34 -51
- package/src/components/AppShell/AppShell.module.scss +53 -40
- package/src/components/Avatar/Avatar.contract.json +31 -48
- package/src/components/Avatar/Avatar.module.scss +4 -1
- package/src/components/Badge/Badge.contract.json +37 -42
- package/src/components/Badge/Badge.module.scss +9 -2
- package/src/components/BentoGrid/BentoGrid.contract.json +21 -45
- package/src/components/Box/Box.contract.json +40 -148
- package/src/components/Box/index.tsx +92 -99
- package/src/components/Breadcrumbs/Breadcrumbs.contract.json +21 -34
- package/src/components/Breadcrumbs/Breadcrumbs.module.scss +12 -7
- package/src/components/Button/Button.module.scss +8 -7
- package/src/components/ButtonGroup/ButtonGroup.contract.json +32 -47
- package/src/components/Card/Card.module.scss +82 -1
- package/src/components/Card/index.tsx +21 -2
- package/src/components/Chart/Chart.contract.json +21 -29
- package/src/components/Chart/index.tsx +36 -6
- package/src/components/Checkbox/Checkbox.contract.json +24 -24
- package/src/components/Checkbox/Checkbox.module.scss +32 -23
- package/src/components/Checkbox/index.tsx +4 -2
- package/src/components/Chip/Chip.contract.json +33 -40
- package/src/components/Chip/Chip.module.scss +2 -2
- package/src/components/Chip/index.tsx +2 -1
- package/src/components/CodeBlock/CodeBlock.contract.json +46 -76
- package/src/components/CodeBlock/CodeBlock.module.scss +40 -15
- package/src/components/CodeBlock/css-variables-theme.ts +102 -0
- package/src/components/CodeBlock/index.tsx +91 -35
- package/src/components/Collapsible/Collapsible.contract.json +21 -36
- package/src/components/ColorPicker/ColorPicker.contract.json +29 -48
- package/src/components/ColorPicker/ColorPicker.module.scss +15 -12
- package/src/components/ColorPicker/index.tsx +5 -1
- package/src/components/Combobox/Combobox.contract.json +36 -37
- package/src/components/Combobox/Combobox.module.scss +1 -1
- package/src/components/Combobox/index.tsx +31 -5
- package/src/components/Command/Command.contract.json +21 -43
- package/src/components/Command/index.tsx +58 -47
- package/src/components/ConversationList/ConversationList.contract.json +27 -32
- package/src/components/DataTable/DataTable.icons.tsx +4 -21
- package/src/components/DataTable/DataTable.module.scss +12 -8
- package/src/components/DataTable/index.tsx +8 -7
- package/src/components/DatePicker/DatePicker.contract.json +27 -28
- package/src/components/DatePicker/DatePicker.module.scss +12 -5
- package/src/components/DatePicker/index.tsx +5 -2
- package/src/components/Dialog/Dialog.module.scss +3 -3
- package/src/components/Dialog/index.tsx +47 -37
- package/src/components/Drawer/Drawer.contract.json +22 -36
- package/src/components/Editor/Editor.contract.json +31 -48
- package/src/components/Editor/Editor.module.scss +36 -14
- package/src/components/Editor/index.tsx +240 -179
- package/src/components/EmptyState/EmptyState.contract.json +31 -43
- package/src/components/EmptyState/EmptyState.module.scss +8 -0
- package/src/components/EmptyState/index.tsx +48 -23
- package/src/components/Field/Field.contract.json +28 -46
- package/src/components/Field/index.tsx +5 -1
- package/src/components/Fieldset/Fieldset.contract.json +21 -38
- package/src/components/Fieldset/Fieldset.module.scss +10 -3
- package/src/components/Form/Form.contract.json +20 -20
- package/src/components/Grid/Grid.contract.json +28 -64
- package/src/components/Grid/index.tsx +10 -10
- package/src/components/Header/Header.contract.json +31 -67
- package/src/components/Header/Header.module.scss +36 -21
- package/src/components/Header/index.tsx +134 -122
- package/src/components/Icon/Icon.contract.json +22 -62
- package/src/components/IconButton/IconButton.contract.json +34 -18
- package/src/components/IconButton/IconButton.module.scss +6 -7
- package/src/components/IconButton/index.tsx +2 -1
- package/src/components/Image/Image.contract.json +23 -56
- package/src/components/Input/Input.contract.json +26 -32
- package/src/components/Input/Input.module.scss +3 -2
- package/src/components/Link/Link.contract.json +32 -52
- package/src/components/Link/Link.module.scss +23 -6
- package/src/components/Link/index.tsx +1 -1
- package/src/components/List/List.contract.json +23 -52
- package/src/components/List/List.module.scss +1 -1
- package/src/components/Listbox/Listbox.contract.json +21 -37
- package/src/components/Loading/Loading.contract.json +37 -61
- package/src/components/Loading/Loading.module.scss +10 -7
- package/src/components/Loading/index.tsx +2 -2
- 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 +43 -5
- package/src/components/Markdown/index.tsx +48 -49
- package/src/components/Menu/Menu.contract.json +25 -41
- package/src/components/Menu/Menu.module.scss +23 -8
- package/src/components/Message/Message.contract.json +29 -52
- package/src/components/Message/Message.module.scss +12 -5
- package/src/components/NavigationMenu/NavigationMenu.contract.json +36 -45
- package/src/components/NavigationMenu/NavigationMenu.module.scss +64 -19
- package/src/components/NavigationMenu/index.tsx +105 -81
- package/src/components/Pagination/Pagination.contract.json +22 -40
- package/src/components/Pagination/Pagination.module.scss +2 -2
- package/src/components/Popover/Popover.contract.json +24 -46
- package/src/components/Popover/Popover.module.scss +6 -5
- package/src/components/Progress/Progress.contract.json +32 -28
- package/src/components/Progress/Progress.module.scss +3 -2
- package/src/components/Prompt/Prompt.contract.json +31 -47
- package/src/components/Prompt/Prompt.module.scss +13 -5
- package/src/components/RadioGroup/RadioGroup.contract.json +23 -24
- package/src/components/RadioGroup/RadioGroup.module.scss +13 -14
- package/src/components/ScrollArea/ScrollArea.contract.json +18 -19
- package/src/components/ScrollArea/ScrollArea.module.scss +15 -15
- package/src/components/ScrollArea/index.tsx +16 -16
- package/src/components/ScrollArea/scroll-state.ts +24 -24
- package/src/components/Select/Select.module.scss +2 -2
- package/src/components/Separator/Separator.contract.json +24 -48
- package/src/components/Sidebar/Sidebar.contract.json +35 -67
- package/src/components/Sidebar/Sidebar.module.scss +22 -13
- package/src/components/Sidebar/index.tsx +164 -164
- package/src/components/Skeleton/Skeleton.contract.json +28 -54
- package/src/components/Skeleton/Skeleton.module.scss +27 -10
- package/src/components/Slider/Slider.contract.json +27 -39
- package/src/components/Slider/Slider.module.scss +3 -3
- package/src/components/Stack/Stack.contract.json +29 -56
- package/src/components/Stack/Stack.module.scss +13 -12
- package/src/components/Stack/index.tsx +3 -3
- package/src/components/Switch/Switch.contract.json +33 -46
- package/src/components/Switch/Switch.module.scss +64 -26
- package/src/components/Table/Table.contract.json +28 -46
- package/src/components/Table/Table.module.scss +15 -3
- package/src/components/TableOfContents/TableOfContents.contract.json +34 -21
- package/src/components/TableOfContents/TableOfContents.module.scss +15 -5
- package/src/components/TableOfContents/index.tsx +26 -9
- package/src/components/Tabs/Tabs.contract.json +24 -45
- package/src/components/Tabs/Tabs.module.scss +1 -1
- package/src/components/Tabs/index.tsx +15 -3
- package/src/components/Text/Text.contract.json +30 -72
- package/src/components/Text/Text.module.scss +21 -4
- package/src/components/Text/index.tsx +113 -75
- package/src/components/Textarea/Textarea.contract.json +25 -43
- package/src/components/Textarea/Textarea.module.scss +2 -4
- package/src/components/Theme/Theme.contract.json +32 -51
- package/src/components/Theme/index.tsx +2 -1
- package/src/components/ThemeToggle/ThemeToggle.module.scss +23 -7
- package/src/components/ThemeToggle/index.tsx +43 -7
- package/src/components/ThinkingIndicator/ThinkingIndicator.contract.json +23 -40
- package/src/components/Toast/Toast.contract.json +30 -40
- package/src/components/Toast/Toast.module.scss +1 -1
- package/src/components/ToggleGroup/ToggleGroup.contract.json +29 -30
- package/src/components/ToggleGroup/ToggleGroup.module.scss +38 -5
- package/src/components/Tooltip/Tooltip.contract.json +31 -52
- package/src/components/Tooltip/index.tsx +19 -24
- package/src/components/VisuallyHidden/VisuallyHidden.contract.json +22 -44
- package/src/components/VisuallyHidden/index.tsx +5 -5
- package/src/index.ts +2 -2
- package/src/measurements/generated.ts +9 -2
- package/src/measurements/measurements.json +7 -0
- package/src/recipes/_boolean-range.scss +3 -11
- package/src/recipes/_field.scss +5 -1
- package/src/recipes/_layout.scss +14 -7
- package/src/recipes/_popup.scss +12 -2
- package/src/recipes/_prose.scss +13 -5
- package/src/recipes/_table-chrome.scss +16 -2
- package/src/scss.d.ts +1 -1
- package/src/styles/globals.scss +20 -19
- package/src/tokens/_computed.scss +5 -16
- package/src/tokens/_derive.scss +112 -210
- package/src/tokens/_measurements.catalog.generated.css +6 -1
- package/src/tokens/_measurements.generated.scss +14 -1
- package/src/tokens/_mixins.scss +7 -8
- package/src/tokens/_palettes.scss +39 -167
- package/src/tokens/_seeds.scss +20 -20
- package/src/tokens/_variables.scss +183 -38
- 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 +10 -6
- 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/dist/chart.cjs
CHANGED
|
@@ -27,6 +27,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
27
27
|
const React = require("react");
|
|
28
28
|
const aria = require("./utils/aria.cjs");
|
|
29
29
|
const Chart_module = require("./components/Chart/Chart.module.scss.cjs");
|
|
30
|
+
const env = require("./utils/env.cjs");
|
|
30
31
|
function _interopNamespaceDefault(e) {
|
|
31
32
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
32
33
|
if (e) {
|
|
@@ -57,7 +58,7 @@ function loadChartDeps() {
|
|
|
57
58
|
_RechartsLegend = rc.Legend;
|
|
58
59
|
} catch {
|
|
59
60
|
_chartFailed = true;
|
|
60
|
-
if (
|
|
61
|
+
if (env.isDevelopmentBuild()) {
|
|
61
62
|
console.warn(
|
|
62
63
|
"[@usefragments/ui] Chart: recharts is not installed. Install it with: npm install recharts"
|
|
63
64
|
);
|
|
@@ -101,6 +102,24 @@ function ChartContainer({
|
|
|
101
102
|
...htmlProps
|
|
102
103
|
}) {
|
|
103
104
|
const chartId = React__namespace.useId();
|
|
105
|
+
const frameRef = React__namespace.useRef(null);
|
|
106
|
+
const [frame, setFrame] = React__namespace.useState(null);
|
|
107
|
+
React__namespace.useEffect(() => {
|
|
108
|
+
const element = frameRef.current;
|
|
109
|
+
if (!element || typeof ResizeObserver === "undefined") return;
|
|
110
|
+
const measure = () => {
|
|
111
|
+
const rect = element.getBoundingClientRect();
|
|
112
|
+
const width = Math.round(rect.width);
|
|
113
|
+
const height = Math.round(rect.height);
|
|
114
|
+
setFrame(
|
|
115
|
+
(current) => current && current.width === width && current.height === height ? current : { width, height }
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
measure();
|
|
119
|
+
const observer = new ResizeObserver(measure);
|
|
120
|
+
observer.observe(element);
|
|
121
|
+
return () => observer.disconnect();
|
|
122
|
+
}, []);
|
|
104
123
|
const summaryId = summary ? `chart-summary-${chartId}` : void 0;
|
|
105
124
|
const dataTableId = dataTable ? `chart-data-${chartId}` : void 0;
|
|
106
125
|
const cssVars = React__namespace.useMemo(() => {
|
|
@@ -111,11 +130,9 @@ function ChartContainer({
|
|
|
111
130
|
return vars;
|
|
112
131
|
}, [config]);
|
|
113
132
|
const rootClasses = [Chart_module.default.container, className].filter(Boolean).join(" ");
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
};
|
|
118
|
-
if (typeof children.type !== "string") {
|
|
133
|
+
const measured = frame !== null && frame.width > 0 && frame.height > 0;
|
|
134
|
+
const chartChildProps = measured ? { width: frame.width, height: frame.height } : { width: "100%", height: "100%" };
|
|
135
|
+
if (!measured && typeof children.type !== "string") {
|
|
119
136
|
chartChildProps.responsive = true;
|
|
120
137
|
}
|
|
121
138
|
const chartChild = React__namespace.cloneElement(
|
|
@@ -126,6 +143,7 @@ function ChartContainer({
|
|
|
126
143
|
"div",
|
|
127
144
|
{
|
|
128
145
|
...htmlProps,
|
|
146
|
+
ref: frameRef,
|
|
129
147
|
className: rootClasses,
|
|
130
148
|
style: { ...cssVars, ...style },
|
|
131
149
|
role: "img",
|
package/dist/chart.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { mergeAriaIds } from "./utils/aria.js";
|
|
5
5
|
import styles from "./components/Chart/Chart.module.scss.js";
|
|
6
|
+
import { isDevelopmentBuild } from "./utils/env.js";
|
|
6
7
|
let _RechartsTooltip = null;
|
|
7
8
|
let _RechartsLegend = null;
|
|
8
9
|
let _chartLoadPromise = null;
|
|
@@ -16,7 +17,7 @@ function loadChartDeps() {
|
|
|
16
17
|
_RechartsLegend = rc.Legend;
|
|
17
18
|
} catch {
|
|
18
19
|
_chartFailed = true;
|
|
19
|
-
if (
|
|
20
|
+
if (isDevelopmentBuild()) {
|
|
20
21
|
console.warn(
|
|
21
22
|
"[@usefragments/ui] Chart: recharts is not installed. Install it with: npm install recharts"
|
|
22
23
|
);
|
|
@@ -60,6 +61,24 @@ function ChartContainer({
|
|
|
60
61
|
...htmlProps
|
|
61
62
|
}) {
|
|
62
63
|
const chartId = React.useId();
|
|
64
|
+
const frameRef = React.useRef(null);
|
|
65
|
+
const [frame, setFrame] = React.useState(null);
|
|
66
|
+
React.useEffect(() => {
|
|
67
|
+
const element = frameRef.current;
|
|
68
|
+
if (!element || typeof ResizeObserver === "undefined") return;
|
|
69
|
+
const measure = () => {
|
|
70
|
+
const rect = element.getBoundingClientRect();
|
|
71
|
+
const width = Math.round(rect.width);
|
|
72
|
+
const height = Math.round(rect.height);
|
|
73
|
+
setFrame(
|
|
74
|
+
(current) => current && current.width === width && current.height === height ? current : { width, height }
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
measure();
|
|
78
|
+
const observer = new ResizeObserver(measure);
|
|
79
|
+
observer.observe(element);
|
|
80
|
+
return () => observer.disconnect();
|
|
81
|
+
}, []);
|
|
63
82
|
const summaryId = summary ? `chart-summary-${chartId}` : void 0;
|
|
64
83
|
const dataTableId = dataTable ? `chart-data-${chartId}` : void 0;
|
|
65
84
|
const cssVars = React.useMemo(() => {
|
|
@@ -70,11 +89,9 @@ function ChartContainer({
|
|
|
70
89
|
return vars;
|
|
71
90
|
}, [config]);
|
|
72
91
|
const rootClasses = [styles.container, className].filter(Boolean).join(" ");
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
if (typeof children.type !== "string") {
|
|
92
|
+
const measured = frame !== null && frame.width > 0 && frame.height > 0;
|
|
93
|
+
const chartChildProps = measured ? { width: frame.width, height: frame.height } : { width: "100%", height: "100%" };
|
|
94
|
+
if (!measured && typeof children.type !== "string") {
|
|
78
95
|
chartChildProps.responsive = true;
|
|
79
96
|
}
|
|
80
97
|
const chartChild = React.cloneElement(
|
|
@@ -85,6 +102,7 @@ function ChartContainer({
|
|
|
85
102
|
"div",
|
|
86
103
|
{
|
|
87
104
|
...htmlProps,
|
|
105
|
+
ref: frameRef,
|
|
88
106
|
className: rootClasses,
|
|
89
107
|
style: { ...cssVars, ...style },
|
|
90
108
|
role: "img",
|
package/dist/codeblock.cjs
CHANGED
|
@@ -26,7 +26,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
26
26
|
const jsxRuntime = require("react/jsx-runtime");
|
|
27
27
|
const React = require("react");
|
|
28
28
|
const index = require("./components/Tabs/index.cjs");
|
|
29
|
+
const cssVariablesTheme = require("./components/CodeBlock/css-variables-theme.cjs");
|
|
29
30
|
const CodeBlock_module = require("./components/CodeBlock/CodeBlock.module.scss.cjs");
|
|
31
|
+
const env = require("./utils/env.cjs");
|
|
30
32
|
function _interopNamespaceDefault(e) {
|
|
31
33
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
32
34
|
if (e) {
|
|
@@ -361,19 +363,21 @@ function processShikiHtml(html, options) {
|
|
|
361
363
|
if (isRemoved) lineClasses.push("diff-removed");
|
|
362
364
|
const lineClass = lineClasses.join(" ");
|
|
363
365
|
const diffMarker = isAdded ? "+" : isRemoved ? "-" : " ";
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
const lineNumHtml = showLineNumbers || hasDiff ? `${showLineNumbers ? `<span class="line-number">${displayLineNum}</span>` : ""}${hasDiff ? `<span class="diff-marker">${diffMarker}</span>` : ""}` : "";
|
|
367
|
+
if (/^<span class="line([^"]*)">/.test(line)) {
|
|
368
|
+
return line.replace(
|
|
369
|
+
/^<span class="line([^"]*)">/,
|
|
370
|
+
`<span class="${lineClass}$1">${lineNumHtml}`
|
|
371
|
+
);
|
|
368
372
|
}
|
|
369
|
-
return `<span class="${lineClass}">${line}</span>`;
|
|
373
|
+
return `<span class="${lineClass}">${lineNumHtml}${line}</span>`;
|
|
370
374
|
});
|
|
371
375
|
return html.replace(/<code[^>]*>[\s\S]*?<\/code>/, `<code>${processedLines.join("\n")}</code>`);
|
|
372
376
|
}
|
|
373
377
|
const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
374
378
|
code,
|
|
375
379
|
language = "tsx",
|
|
376
|
-
theme = "
|
|
380
|
+
theme = "css-variables",
|
|
377
381
|
showCopy = true,
|
|
378
382
|
title,
|
|
379
383
|
filename,
|
|
@@ -388,6 +392,7 @@ const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
|
388
392
|
collapsible = false,
|
|
389
393
|
defaultCollapsed = false,
|
|
390
394
|
collapsedLines = 5,
|
|
395
|
+
collapseAction = "lines",
|
|
391
396
|
compact = false,
|
|
392
397
|
persistentCopy = false,
|
|
393
398
|
copyPlacement = "auto",
|
|
@@ -397,7 +402,10 @@ const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
|
397
402
|
...htmlProps
|
|
398
403
|
}, ref) {
|
|
399
404
|
const [copied, setCopied] = React.useState(false);
|
|
400
|
-
const [highlight, setHighlight] = React.useState({
|
|
405
|
+
const [highlight, setHighlight] = React.useState({
|
|
406
|
+
html: "",
|
|
407
|
+
loading: true
|
|
408
|
+
});
|
|
401
409
|
const [isCollapsed, setIsCollapsed] = React.useState(defaultCollapsed);
|
|
402
410
|
const trimmedCode = React.useMemo(() => normalizeCode(code, language), [code, language]);
|
|
403
411
|
const codeLines = trimmedCode.split("\n");
|
|
@@ -419,7 +427,7 @@ const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
|
419
427
|
await loadShikiDeps();
|
|
420
428
|
const fallbackHtml = `<pre class="shiki"><code>${escapeHtml(visibleCode)}</code></pre>`;
|
|
421
429
|
if (_shikiFailed || !_codeToHtml) {
|
|
422
|
-
if (_shikiFailed &&
|
|
430
|
+
if (_shikiFailed && env.isDevelopmentBuild()) {
|
|
423
431
|
console.warn(
|
|
424
432
|
"[@usefragments/ui] CodeBlock: shiki is not installed. Install it with: npm install shiki"
|
|
425
433
|
);
|
|
@@ -428,7 +436,8 @@ const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
|
428
436
|
}
|
|
429
437
|
try {
|
|
430
438
|
const resolvedLang = LANGUAGE_ALIASES[language] || language;
|
|
431
|
-
const
|
|
439
|
+
const shikiTheme = theme === "css-variables" ? cssVariablesTheme.FUI_CSS_VARIABLES_THEME : theme;
|
|
440
|
+
const html = await _codeToHtml(visibleCode, { lang: resolvedLang, theme: shikiTheme });
|
|
432
441
|
return processShikiHtml(html, {
|
|
433
442
|
showLineNumbers,
|
|
434
443
|
startLineNumber,
|
|
@@ -437,7 +446,7 @@ const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
|
437
446
|
removedLines: removedSet
|
|
438
447
|
});
|
|
439
448
|
} catch (err) {
|
|
440
|
-
if (
|
|
449
|
+
if (!env.isProductionBuild()) {
|
|
441
450
|
console.error("Syntax highlighting failed:", err);
|
|
442
451
|
}
|
|
443
452
|
return fallbackHtml;
|
|
@@ -468,7 +477,7 @@ const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
|
468
477
|
setTimeout(() => setCopied(false), 2e3);
|
|
469
478
|
onCopy == null ? void 0 : onCopy();
|
|
470
479
|
} catch (err) {
|
|
471
|
-
if (
|
|
480
|
+
if (!env.isProductionBuild()) {
|
|
472
481
|
console.error("Failed to copy:", err);
|
|
473
482
|
}
|
|
474
483
|
}
|
|
@@ -491,9 +500,9 @@ const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
|
491
500
|
].filter(Boolean).join(" ");
|
|
492
501
|
const codeContainerStyle = maxHeight ? { maxHeight, overflow: "auto" } : {};
|
|
493
502
|
const wrapperStyle = bg ? { ["--fui-code-bg"]: bg } : void 0;
|
|
494
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, ...htmlProps, className: classNames, "data-
|
|
495
|
-
title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: CodeBlock_module.default.title, children: title }),
|
|
496
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClasses, style: wrapperStyle, children: [
|
|
503
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, ...htmlProps, className: classNames, "data-slot": "code-block", children: [
|
|
504
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: CodeBlock_module.default.title, "data-slot": "code-block-title", children: title }),
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClasses, style: wrapperStyle, "data-slot": "code-block-frame", children: [
|
|
497
506
|
shouldRenderHeader && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: CodeBlock_module.default.header, children: [
|
|
498
507
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: CodeBlock_module.default.filename, children: filename ?? "" }),
|
|
499
508
|
shouldShowHeaderCopy && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -540,10 +549,10 @@ const CodeBlockBase = React__namespace.forwardRef(function CodeBlock2({
|
|
|
540
549
|
{
|
|
541
550
|
type: "button",
|
|
542
551
|
onClick: toggleCollapsed,
|
|
543
|
-
className: CodeBlock_module.default.collapseButton,
|
|
552
|
+
className: collapseAction === "expand" ? `${CodeBlock_module.default.collapseButton} ${CodeBlock_module.default.collapseExpand}` : CodeBlock_module.default.collapseButton,
|
|
544
553
|
"aria-expanded": !isCollapsed,
|
|
545
554
|
"aria-label": isCollapsed ? "Expand code" : "Collapse code",
|
|
546
|
-
children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
555
|
+
children: collapseAction === "expand" ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: isCollapsed ? "Expand" : "Collapse" }) : isCollapsed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
547
556
|
/* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, { className: CodeBlock_module.default.icon }),
|
|
548
557
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
549
558
|
"Show ",
|
|
@@ -572,6 +581,10 @@ function TabbedCodeBlock({
|
|
|
572
581
|
tabsVariant = "pills",
|
|
573
582
|
wordWrap,
|
|
574
583
|
maxHeight,
|
|
584
|
+
collapsible,
|
|
585
|
+
defaultCollapsed,
|
|
586
|
+
collapsedLines,
|
|
587
|
+
collapseAction,
|
|
575
588
|
className,
|
|
576
589
|
onCopy
|
|
577
590
|
}) {
|
|
@@ -584,20 +597,33 @@ function TabbedCodeBlock({
|
|
|
584
597
|
}) }),
|
|
585
598
|
tabs.map((tab, index$1) => {
|
|
586
599
|
const tabValue = tab.value ?? tab.label;
|
|
587
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
588
|
-
|
|
600
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
601
|
+
index.TabsPanel,
|
|
589
602
|
{
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
603
|
+
value: tabValue,
|
|
604
|
+
flush: true,
|
|
605
|
+
className: CodeBlock_module.default.tabbedPanel,
|
|
606
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
607
|
+
CodeBlockBase,
|
|
608
|
+
{
|
|
609
|
+
code: tab.code,
|
|
610
|
+
language: tab.language,
|
|
611
|
+
theme,
|
|
612
|
+
showCopy,
|
|
613
|
+
copyPlacement,
|
|
614
|
+
showLineNumbers,
|
|
615
|
+
wordWrap,
|
|
616
|
+
maxHeight,
|
|
617
|
+
collapsible,
|
|
618
|
+
defaultCollapsed,
|
|
619
|
+
collapsedLines,
|
|
620
|
+
collapseAction,
|
|
621
|
+
onCopy: onCopy ? () => onCopy(tab.label) : void 0
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
},
|
|
625
|
+
`${tabValue}-panel-${index$1}`
|
|
626
|
+
);
|
|
601
627
|
})
|
|
602
628
|
] }) });
|
|
603
629
|
}
|
package/dist/codeblock.js
CHANGED
|
@@ -3,7 +3,9 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { useState, useMemo, useEffect, useCallback } from "react";
|
|
5
5
|
import { TabsRoot, TabsList, Tab, TabsPanel } from "./components/Tabs/index.js";
|
|
6
|
+
import { FUI_CSS_VARIABLES_THEME } from "./components/CodeBlock/css-variables-theme.js";
|
|
6
7
|
import styles from "./components/CodeBlock/CodeBlock.module.scss.js";
|
|
8
|
+
import { isProductionBuild, isDevelopmentBuild } from "./utils/env.js";
|
|
7
9
|
let _codeToHtml = null;
|
|
8
10
|
let _shikiLoadPromise = null;
|
|
9
11
|
let _shikiFailed = false;
|
|
@@ -321,19 +323,21 @@ function processShikiHtml(html, options) {
|
|
|
321
323
|
if (isRemoved) lineClasses.push("diff-removed");
|
|
322
324
|
const lineClass = lineClasses.join(" ");
|
|
323
325
|
const diffMarker = isAdded ? "+" : isRemoved ? "-" : " ";
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
326
|
+
const lineNumHtml = showLineNumbers || hasDiff ? `${showLineNumbers ? `<span class="line-number">${displayLineNum}</span>` : ""}${hasDiff ? `<span class="diff-marker">${diffMarker}</span>` : ""}` : "";
|
|
327
|
+
if (/^<span class="line([^"]*)">/.test(line)) {
|
|
328
|
+
return line.replace(
|
|
329
|
+
/^<span class="line([^"]*)">/,
|
|
330
|
+
`<span class="${lineClass}$1">${lineNumHtml}`
|
|
331
|
+
);
|
|
328
332
|
}
|
|
329
|
-
return `<span class="${lineClass}">${line}</span>`;
|
|
333
|
+
return `<span class="${lineClass}">${lineNumHtml}${line}</span>`;
|
|
330
334
|
});
|
|
331
335
|
return html.replace(/<code[^>]*>[\s\S]*?<\/code>/, `<code>${processedLines.join("\n")}</code>`);
|
|
332
336
|
}
|
|
333
337
|
const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
334
338
|
code,
|
|
335
339
|
language = "tsx",
|
|
336
|
-
theme = "
|
|
340
|
+
theme = "css-variables",
|
|
337
341
|
showCopy = true,
|
|
338
342
|
title,
|
|
339
343
|
filename,
|
|
@@ -348,6 +352,7 @@ const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
|
348
352
|
collapsible = false,
|
|
349
353
|
defaultCollapsed = false,
|
|
350
354
|
collapsedLines = 5,
|
|
355
|
+
collapseAction = "lines",
|
|
351
356
|
compact = false,
|
|
352
357
|
persistentCopy = false,
|
|
353
358
|
copyPlacement = "auto",
|
|
@@ -357,7 +362,10 @@ const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
|
357
362
|
...htmlProps
|
|
358
363
|
}, ref) {
|
|
359
364
|
const [copied, setCopied] = useState(false);
|
|
360
|
-
const [highlight, setHighlight] = useState({
|
|
365
|
+
const [highlight, setHighlight] = useState({
|
|
366
|
+
html: "",
|
|
367
|
+
loading: true
|
|
368
|
+
});
|
|
361
369
|
const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
|
|
362
370
|
const trimmedCode = useMemo(() => normalizeCode(code, language), [code, language]);
|
|
363
371
|
const codeLines = trimmedCode.split("\n");
|
|
@@ -379,7 +387,7 @@ const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
|
379
387
|
await loadShikiDeps();
|
|
380
388
|
const fallbackHtml = `<pre class="shiki"><code>${escapeHtml(visibleCode)}</code></pre>`;
|
|
381
389
|
if (_shikiFailed || !_codeToHtml) {
|
|
382
|
-
if (_shikiFailed &&
|
|
390
|
+
if (_shikiFailed && isDevelopmentBuild()) {
|
|
383
391
|
console.warn(
|
|
384
392
|
"[@usefragments/ui] CodeBlock: shiki is not installed. Install it with: npm install shiki"
|
|
385
393
|
);
|
|
@@ -388,7 +396,8 @@ const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
|
388
396
|
}
|
|
389
397
|
try {
|
|
390
398
|
const resolvedLang = LANGUAGE_ALIASES[language] || language;
|
|
391
|
-
const
|
|
399
|
+
const shikiTheme = theme === "css-variables" ? FUI_CSS_VARIABLES_THEME : theme;
|
|
400
|
+
const html = await _codeToHtml(visibleCode, { lang: resolvedLang, theme: shikiTheme });
|
|
392
401
|
return processShikiHtml(html, {
|
|
393
402
|
showLineNumbers,
|
|
394
403
|
startLineNumber,
|
|
@@ -397,7 +406,7 @@ const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
|
397
406
|
removedLines: removedSet
|
|
398
407
|
});
|
|
399
408
|
} catch (err) {
|
|
400
|
-
if (
|
|
409
|
+
if (!isProductionBuild()) {
|
|
401
410
|
console.error("Syntax highlighting failed:", err);
|
|
402
411
|
}
|
|
403
412
|
return fallbackHtml;
|
|
@@ -428,7 +437,7 @@ const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
|
428
437
|
setTimeout(() => setCopied(false), 2e3);
|
|
429
438
|
onCopy == null ? void 0 : onCopy();
|
|
430
439
|
} catch (err) {
|
|
431
|
-
if (
|
|
440
|
+
if (!isProductionBuild()) {
|
|
432
441
|
console.error("Failed to copy:", err);
|
|
433
442
|
}
|
|
434
443
|
}
|
|
@@ -451,9 +460,9 @@ const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
|
451
460
|
].filter(Boolean).join(" ");
|
|
452
461
|
const codeContainerStyle = maxHeight ? { maxHeight, overflow: "auto" } : {};
|
|
453
462
|
const wrapperStyle = bg ? { ["--fui-code-bg"]: bg } : void 0;
|
|
454
|
-
return /* @__PURE__ */ jsxs("div", { ref, ...htmlProps, className: classNames, "data-
|
|
455
|
-
title && /* @__PURE__ */ jsx("div", { className: styles.title, children: title }),
|
|
456
|
-
/* @__PURE__ */ jsxs("div", { className: wrapperClasses, style: wrapperStyle, children: [
|
|
463
|
+
return /* @__PURE__ */ jsxs("div", { ref, ...htmlProps, className: classNames, "data-slot": "code-block", children: [
|
|
464
|
+
title && /* @__PURE__ */ jsx("div", { className: styles.title, "data-slot": "code-block-title", children: title }),
|
|
465
|
+
/* @__PURE__ */ jsxs("div", { className: wrapperClasses, style: wrapperStyle, "data-slot": "code-block-frame", children: [
|
|
457
466
|
shouldRenderHeader && /* @__PURE__ */ jsxs("div", { className: styles.header, children: [
|
|
458
467
|
/* @__PURE__ */ jsx("span", { className: styles.filename, children: filename ?? "" }),
|
|
459
468
|
shouldShowHeaderCopy && /* @__PURE__ */ jsx(
|
|
@@ -500,10 +509,10 @@ const CodeBlockBase = React.forwardRef(function CodeBlock2({
|
|
|
500
509
|
{
|
|
501
510
|
type: "button",
|
|
502
511
|
onClick: toggleCollapsed,
|
|
503
|
-
className: styles.collapseButton,
|
|
512
|
+
className: collapseAction === "expand" ? `${styles.collapseButton} ${styles.collapseExpand}` : styles.collapseButton,
|
|
504
513
|
"aria-expanded": !isCollapsed,
|
|
505
514
|
"aria-label": isCollapsed ? "Expand code" : "Collapse code",
|
|
506
|
-
children: isCollapsed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
515
|
+
children: collapseAction === "expand" ? /* @__PURE__ */ jsx("span", { children: isCollapsed ? "Expand" : "Collapse" }) : isCollapsed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
507
516
|
/* @__PURE__ */ jsx(ChevronDownIcon, { className: styles.icon }),
|
|
508
517
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
509
518
|
"Show ",
|
|
@@ -532,6 +541,10 @@ function TabbedCodeBlock({
|
|
|
532
541
|
tabsVariant = "pills",
|
|
533
542
|
wordWrap,
|
|
534
543
|
maxHeight,
|
|
544
|
+
collapsible,
|
|
545
|
+
defaultCollapsed,
|
|
546
|
+
collapsedLines,
|
|
547
|
+
collapseAction,
|
|
535
548
|
className,
|
|
536
549
|
onCopy
|
|
537
550
|
}) {
|
|
@@ -544,20 +557,33 @@ function TabbedCodeBlock({
|
|
|
544
557
|
}) }),
|
|
545
558
|
tabs.map((tab, index) => {
|
|
546
559
|
const tabValue = tab.value ?? tab.label;
|
|
547
|
-
return /* @__PURE__ */ jsx(
|
|
548
|
-
|
|
560
|
+
return /* @__PURE__ */ jsx(
|
|
561
|
+
TabsPanel,
|
|
549
562
|
{
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
563
|
+
value: tabValue,
|
|
564
|
+
flush: true,
|
|
565
|
+
className: styles.tabbedPanel,
|
|
566
|
+
children: /* @__PURE__ */ jsx(
|
|
567
|
+
CodeBlockBase,
|
|
568
|
+
{
|
|
569
|
+
code: tab.code,
|
|
570
|
+
language: tab.language,
|
|
571
|
+
theme,
|
|
572
|
+
showCopy,
|
|
573
|
+
copyPlacement,
|
|
574
|
+
showLineNumbers,
|
|
575
|
+
wordWrap,
|
|
576
|
+
maxHeight,
|
|
577
|
+
collapsible,
|
|
578
|
+
defaultCollapsed,
|
|
579
|
+
collapsedLines,
|
|
580
|
+
collapseAction,
|
|
581
|
+
onCopy: onCopy ? () => onCopy(tab.label) : void 0
|
|
582
|
+
}
|
|
583
|
+
)
|
|
584
|
+
},
|
|
585
|
+
`${tabValue}-panel-${index}`
|
|
586
|
+
);
|
|
561
587
|
})
|
|
562
588
|
] }) });
|
|
563
589
|
}
|
package/dist/colorpicker.cjs
CHANGED
|
@@ -31,6 +31,7 @@ const field = require("@base-ui/react/field");
|
|
|
31
31
|
const index = require("./components/ComponentDefaults/index.cjs");
|
|
32
32
|
const index$1 = require("./components/Input/index.cjs");
|
|
33
33
|
const ColorPicker_module = require("./components/ColorPicker/ColorPicker.module.scss.cjs");
|
|
34
|
+
const env = require("./utils/env.cjs");
|
|
34
35
|
function _interopNamespaceDefault(e) {
|
|
35
36
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
36
37
|
if (e) {
|
|
@@ -59,7 +60,7 @@ function loadColorfulDeps() {
|
|
|
59
60
|
_HexColorPicker = rc.HexColorPicker;
|
|
60
61
|
} catch {
|
|
61
62
|
_colorfulFailed = true;
|
|
62
|
-
if (
|
|
63
|
+
if (env.isDevelopmentBuild()) {
|
|
63
64
|
console.warn(
|
|
64
65
|
"[@usefragments/ui] ColorPicker: react-colorful is not installed. Install it with: npm install react-colorful"
|
|
65
66
|
);
|
|
@@ -178,6 +179,7 @@ const ColorPickerRoot = React__namespace.forwardRef(function ColorPicker2({
|
|
|
178
179
|
onChange: handleInputChange,
|
|
179
180
|
onBlur: handleInputBlur,
|
|
180
181
|
disabled,
|
|
182
|
+
error,
|
|
181
183
|
size,
|
|
182
184
|
className: ColorPicker_module.default.hexInput,
|
|
183
185
|
inputClassName: ColorPicker_module.default.hexInputField,
|
package/dist/colorpicker.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Field } from "@base-ui/react/field";
|
|
|
7
7
|
import { useResolvedControlSize } from "./components/ComponentDefaults/index.js";
|
|
8
8
|
import { Input } from "./components/Input/index.js";
|
|
9
9
|
import styles from "./components/ColorPicker/ColorPicker.module.scss.js";
|
|
10
|
+
import { isDevelopmentBuild } from "./utils/env.js";
|
|
10
11
|
let _HexColorPicker = null;
|
|
11
12
|
let _colorfulLoadPromise = null;
|
|
12
13
|
let _colorfulFailed = false;
|
|
@@ -18,7 +19,7 @@ function loadColorfulDeps() {
|
|
|
18
19
|
_HexColorPicker = rc.HexColorPicker;
|
|
19
20
|
} catch {
|
|
20
21
|
_colorfulFailed = true;
|
|
21
|
-
if (
|
|
22
|
+
if (isDevelopmentBuild()) {
|
|
22
23
|
console.warn(
|
|
23
24
|
"[@usefragments/ui] ColorPicker: react-colorful is not installed. Install it with: npm install react-colorful"
|
|
24
25
|
);
|
|
@@ -137,6 +138,7 @@ const ColorPickerRoot = React.forwardRef(function ColorPicker2({
|
|
|
137
138
|
onChange: handleInputChange,
|
|
138
139
|
onBlur: handleInputBlur,
|
|
139
140
|
disabled,
|
|
141
|
+
error,
|
|
140
142
|
size,
|
|
141
143
|
className: styles.hexInput,
|
|
142
144
|
inputClassName: styles.hexInputField,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const accordion = "
|
|
4
|
-
const item = "
|
|
5
|
-
const heading = "
|
|
6
|
-
const trigger = "
|
|
7
|
-
const triggerContent = "
|
|
8
|
-
const chevron = "
|
|
9
|
-
const content = "
|
|
10
|
-
const contentInner = "
|
|
3
|
+
const accordion = "_accordion_1wl4m_1";
|
|
4
|
+
const item = "_item_1wl4m_11";
|
|
5
|
+
const heading = "_heading_1wl4m_16";
|
|
6
|
+
const trigger = "_trigger_1wl4m_21";
|
|
7
|
+
const triggerContent = "_triggerContent_1wl4m_74";
|
|
8
|
+
const chevron = "_chevron_1wl4m_79";
|
|
9
|
+
const content = "_content_1wl4m_90";
|
|
10
|
+
const contentInner = "_contentInner_1wl4m_102";
|
|
11
11
|
const styles = {
|
|
12
12
|
accordion,
|
|
13
13
|
item,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const accordion = "
|
|
2
|
-
const item = "
|
|
3
|
-
const heading = "
|
|
4
|
-
const trigger = "
|
|
5
|
-
const triggerContent = "
|
|
6
|
-
const chevron = "
|
|
7
|
-
const content = "
|
|
8
|
-
const contentInner = "
|
|
1
|
+
const accordion = "_accordion_1wl4m_1";
|
|
2
|
+
const item = "_item_1wl4m_11";
|
|
3
|
+
const heading = "_heading_1wl4m_16";
|
|
4
|
+
const trigger = "_trigger_1wl4m_21";
|
|
5
|
+
const triggerContent = "_triggerContent_1wl4m_74";
|
|
6
|
+
const chevron = "_chevron_1wl4m_79";
|
|
7
|
+
const content = "_content_1wl4m_90";
|
|
8
|
+
const contentInner = "_contentInner_1wl4m_102";
|
|
9
9
|
const styles = {
|
|
10
10
|
accordion,
|
|
11
11
|
item,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const alert = "
|
|
4
|
-
const title = "
|
|
5
|
-
const info = "
|
|
6
|
-
const success = "
|
|
7
|
-
const warning = "
|
|
8
|
-
const error = "
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
3
|
+
const alert = "_alert_1xq9x_1";
|
|
4
|
+
const title = "_title_1xq9x_14";
|
|
5
|
+
const info = "_info_1xq9x_18";
|
|
6
|
+
const success = "_success_1xq9x_24";
|
|
7
|
+
const warning = "_warning_1xq9x_30";
|
|
8
|
+
const error = "_error_1xq9x_36";
|
|
9
|
+
const surface = "_surface_1xq9x_42";
|
|
10
|
+
const icon = "_icon_1xq9x_63";
|
|
11
|
+
const body = "_body_1xq9x_95";
|
|
12
|
+
const content = "_content_1xq9x_110";
|
|
13
|
+
const actions = "_actions_1xq9x_119";
|
|
14
|
+
const close = "_close_1xq9x_125";
|
|
15
|
+
const action = "_action_1xq9x_119";
|
|
15
16
|
const styles = {
|
|
16
17
|
alert,
|
|
17
18
|
title,
|
|
@@ -19,6 +20,7 @@ const styles = {
|
|
|
19
20
|
success,
|
|
20
21
|
warning,
|
|
21
22
|
error,
|
|
23
|
+
surface,
|
|
22
24
|
icon,
|
|
23
25
|
body,
|
|
24
26
|
content,
|
|
@@ -37,5 +39,6 @@ exports.error = error;
|
|
|
37
39
|
exports.icon = icon;
|
|
38
40
|
exports.info = info;
|
|
39
41
|
exports.success = success;
|
|
42
|
+
exports.surface = surface;
|
|
40
43
|
exports.title = title;
|
|
41
44
|
exports.warning = warning;
|