@fragments-sdk/ui 0.13.0 → 0.14.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/dist/assets/ui.css +1642 -1679
- package/dist/chart.cjs.map +1 -1
- package/dist/chart.js.map +1 -1
- package/dist/codeblock.cjs +26 -18
- package/dist/codeblock.cjs.map +1 -1
- package/dist/codeblock.js +26 -18
- package/dist/codeblock.js.map +1 -1
- 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 +7 -3
- package/dist/components/Accordion/index.cjs.map +1 -1
- package/dist/components/Accordion/index.d.ts +24 -11
- package/dist/components/Accordion/index.d.ts.map +1 -1
- package/dist/components/Accordion/index.js +7 -3
- package/dist/components/Accordion/index.js.map +1 -1
- package/dist/components/Alert/Alert.module.scss.cjs +12 -12
- package/dist/components/Alert/Alert.module.scss.js +12 -12
- package/dist/components/Alert/index.cjs +37 -15
- package/dist/components/Alert/index.cjs.map +1 -1
- package/dist/components/Alert/index.d.ts +15 -22
- package/dist/components/Alert/index.d.ts.map +1 -1
- package/dist/components/Alert/index.js +37 -15
- package/dist/components/Alert/index.js.map +1 -1
- package/dist/components/AppShell/AppShell.module.scss.cjs +14 -14
- package/dist/components/AppShell/AppShell.module.scss.js +14 -14
- package/dist/components/AppShell/index.cjs +3 -1
- package/dist/components/AppShell/index.cjs.map +1 -1
- package/dist/components/AppShell/index.d.ts.map +1 -1
- package/dist/components/AppShell/index.js +3 -1
- package/dist/components/AppShell/index.js.map +1 -1
- package/dist/components/Avatar/index.cjs +9 -1
- package/dist/components/Avatar/index.cjs.map +1 -1
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.d.ts.map +1 -1
- package/dist/components/Avatar/index.js +9 -1
- package/dist/components/Avatar/index.js.map +1 -1
- package/dist/components/Badge/index.cjs +4 -2
- package/dist/components/Badge/index.cjs.map +1 -1
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +4 -2
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/BentoGrid/BentoGrid.module.scss.cjs +11 -11
- package/dist/components/BentoGrid/BentoGrid.module.scss.js +11 -11
- package/dist/components/BentoGrid/index.cjs +8 -5
- package/dist/components/BentoGrid/index.cjs.map +1 -1
- package/dist/components/BentoGrid/index.d.ts +2 -8
- package/dist/components/BentoGrid/index.d.ts.map +1 -1
- package/dist/components/BentoGrid/index.js +8 -5
- package/dist/components/BentoGrid/index.js.map +1 -1
- package/dist/components/Box/index.cjs +12 -2
- package/dist/components/Box/index.cjs.map +1 -1
- package/dist/components/Box/index.d.ts +1 -1
- package/dist/components/Box/index.d.ts.map +1 -1
- package/dist/components/Box/index.js +12 -2
- package/dist/components/Box/index.js.map +1 -1
- package/dist/components/Breadcrumbs/index.cjs +3 -1
- package/dist/components/Breadcrumbs/index.cjs.map +1 -1
- package/dist/components/Breadcrumbs/index.d.ts +3 -1
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/index.js +3 -1
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Button/Button.module.scss.cjs +11 -11
- package/dist/components/Button/Button.module.scss.js +11 -11
- package/dist/components/Button/index.cjs +5 -2
- package/dist/components/Button/index.cjs.map +1 -1
- package/dist/components/Button/index.d.ts +3 -3
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +5 -2
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ButtonGroup/index.cjs +3 -2
- package/dist/components/ButtonGroup/index.cjs.map +1 -1
- package/dist/components/ButtonGroup/index.d.ts +1 -2
- package/dist/components/ButtonGroup/index.d.ts.map +1 -1
- package/dist/components/ButtonGroup/index.js +3 -2
- package/dist/components/ButtonGroup/index.js.map +1 -1
- package/dist/components/Card/Card.module.scss.cjs +14 -14
- package/dist/components/Card/Card.module.scss.js +14 -14
- package/dist/components/Card/index.cjs +3 -22
- package/dist/components/Card/index.cjs.map +1 -1
- package/dist/components/Card/index.d.ts +6 -11
- package/dist/components/Card/index.d.ts.map +1 -1
- package/dist/components/Card/index.js +3 -22
- package/dist/components/Card/index.js.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/Chart/index.d.ts +3 -3
- package/dist/components/Chart/index.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.module.scss.cjs +10 -10
- package/dist/components/Checkbox/Checkbox.module.scss.js +10 -10
- package/dist/components/Checkbox/index.cjs +11 -4
- package/dist/components/Checkbox/index.cjs.map +1 -1
- package/dist/components/Checkbox/index.d.ts +6 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +11 -4
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Chip/index.cjs +11 -3
- package/dist/components/Chip/index.cjs.map +1 -1
- package/dist/components/Chip/index.d.ts +1 -2
- package/dist/components/Chip/index.d.ts.map +1 -1
- package/dist/components/Chip/index.js +11 -3
- package/dist/components/Chip/index.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +20 -20
- package/dist/components/CodeBlock/CodeBlock.module.scss.js +20 -20
- package/dist/components/CodeBlock/index.d.ts +8 -2
- package/dist/components/CodeBlock/index.d.ts.map +1 -1
- package/dist/components/Collapsible/Collapsible.module.scss.cjs +10 -10
- package/dist/components/Collapsible/Collapsible.module.scss.js +10 -10
- package/dist/components/Combobox/Combobox.module.scss.cjs +15 -15
- package/dist/components/Combobox/Combobox.module.scss.js +15 -15
- package/dist/components/Combobox/index.cjs +68 -18
- package/dist/components/Combobox/index.cjs.map +1 -1
- package/dist/components/Combobox/index.d.ts +32 -11
- package/dist/components/Combobox/index.d.ts.map +1 -1
- package/dist/components/Combobox/index.js +68 -18
- package/dist/components/Combobox/index.js.map +1 -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 +4 -4
- package/dist/components/Command/index.cjs.map +1 -1
- package/dist/components/Command/index.d.ts +1 -1
- package/dist/components/Command/index.d.ts.map +1 -1
- package/dist/components/Command/index.js +4 -4
- package/dist/components/Command/index.js.map +1 -1
- package/dist/components/ConversationList/ConversationList.module.scss.cjs +10 -10
- package/dist/components/ConversationList/ConversationList.module.scss.js +10 -10
- package/dist/components/ConversationList/index.cjs +6 -3
- package/dist/components/ConversationList/index.cjs.map +1 -1
- package/dist/components/ConversationList/index.d.ts +1 -1
- package/dist/components/ConversationList/index.d.ts.map +1 -1
- package/dist/components/ConversationList/index.js +6 -3
- package/dist/components/ConversationList/index.js.map +1 -1
- package/dist/components/DataTable/DataTable.module.scss.cjs +26 -26
- package/dist/components/DataTable/DataTable.module.scss.js +26 -26
- package/dist/components/DataTable/index.cjs +13 -4
- package/dist/components/DataTable/index.cjs.map +1 -1
- package/dist/components/DataTable/index.d.ts +7 -2
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DataTable/index.js +13 -4
- package/dist/components/DataTable/index.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.module.scss.cjs +26 -26
- package/dist/components/DatePicker/DatePicker.module.scss.js +26 -26
- package/dist/components/DatePicker/index.d.ts +2 -2
- 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 +2 -1
- package/dist/components/Dialog/index.cjs.map +1 -1
- package/dist/components/Dialog/index.d.ts +20 -7
- package/dist/components/Dialog/index.d.ts.map +1 -1
- package/dist/components/Dialog/index.js +2 -1
- package/dist/components/Dialog/index.js.map +1 -1
- package/dist/components/Drawer/Drawer.module.scss.cjs +26 -26
- package/dist/components/Drawer/Drawer.module.scss.js +26 -26
- package/dist/components/Drawer/index.cjs +30 -3
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.d.ts +3 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +13 -3
- package/dist/components/Drawer/index.js.map +1 -1
- 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.cjs +32 -7
- package/dist/components/Editor/index.cjs.map +1 -1
- package/dist/components/Editor/index.d.ts +16 -3
- package/dist/components/Editor/index.d.ts.map +1 -1
- package/dist/components/Editor/index.js +32 -7
- package/dist/components/Editor/index.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.module.scss.cjs +8 -8
- package/dist/components/EmptyState/EmptyState.module.scss.js +8 -8
- package/dist/components/EmptyState/index.cjs +12 -8
- package/dist/components/EmptyState/index.cjs.map +1 -1
- package/dist/components/EmptyState/index.d.ts +8 -12
- package/dist/components/EmptyState/index.d.ts.map +1 -1
- package/dist/components/EmptyState/index.js +12 -8
- package/dist/components/EmptyState/index.js.map +1 -1
- package/dist/components/Fieldset/index.cjs +2 -2
- package/dist/components/Fieldset/index.cjs.map +1 -1
- package/dist/components/Fieldset/index.d.ts +2 -3
- package/dist/components/Fieldset/index.d.ts.map +1 -1
- package/dist/components/Fieldset/index.js +2 -2
- package/dist/components/Fieldset/index.js.map +1 -1
- package/dist/components/Form/index.cjs +13 -13
- package/dist/components/Form/index.cjs.map +1 -1
- package/dist/components/Form/index.d.ts +5 -2
- package/dist/components/Form/index.d.ts.map +1 -1
- package/dist/components/Form/index.js +13 -13
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Grid/Grid.module.scss.cjs +57 -57
- package/dist/components/Grid/Grid.module.scss.js +57 -57
- package/dist/components/Grid/index.cjs +7 -4
- package/dist/components/Grid/index.cjs.map +1 -1
- package/dist/components/Grid/index.d.ts +5 -3
- package/dist/components/Grid/index.d.ts.map +1 -1
- package/dist/components/Grid/index.js +7 -4
- package/dist/components/Grid/index.js.map +1 -1
- package/dist/components/Header/Header.module.scss.cjs +21 -21
- package/dist/components/Header/Header.module.scss.js +21 -21
- package/dist/components/Header/index.cjs +61 -23
- package/dist/components/Header/index.cjs.map +1 -1
- package/dist/components/Header/index.d.ts +27 -34
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +61 -23
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Icon/index.cjs +11 -1
- package/dist/components/Icon/index.cjs.map +1 -1
- package/dist/components/Icon/index.d.ts +28 -9
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +11 -1
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Image/index.cjs +15 -4
- package/dist/components/Image/index.cjs.map +1 -1
- package/dist/components/Image/index.d.ts +7 -1
- package/dist/components/Image/index.d.ts.map +1 -1
- package/dist/components/Image/index.js +15 -4
- package/dist/components/Image/index.js.map +1 -1
- package/dist/components/Input/Input.module.scss.cjs +13 -13
- package/dist/components/Input/Input.module.scss.js +13 -13
- package/dist/components/Input/index.cjs +79 -31
- package/dist/components/Input/index.cjs.map +1 -1
- package/dist/components/Input/index.d.ts +17 -3
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +79 -31
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Link/index.cjs +17 -0
- package/dist/components/Link/index.cjs.map +1 -1
- package/dist/components/Link/index.d.ts.map +1 -1
- package/dist/components/Link/index.js +17 -0
- package/dist/components/Link/index.js.map +1 -1
- package/dist/components/Listbox/Listbox.module.scss.cjs +8 -8
- package/dist/components/Listbox/Listbox.module.scss.js +8 -8
- package/dist/components/Listbox/index.cjs +10 -6
- package/dist/components/Listbox/index.cjs.map +1 -1
- package/dist/components/Listbox/index.d.ts +2 -2
- package/dist/components/Listbox/index.d.ts.map +1 -1
- package/dist/components/Listbox/index.js +10 -6
- package/dist/components/Listbox/index.js.map +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 +4 -2
- package/dist/components/Markdown/index.d.ts.map +1 -1
- package/dist/components/Menu/Menu.module.scss.cjs +13 -13
- package/dist/components/Menu/Menu.module.scss.js +13 -13
- package/dist/components/Menu/index.cjs +12 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.d.ts +9 -4
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +12 -1
- package/dist/components/Menu/index.js.map +1 -1
- 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/NavigationMenu/NavigationMenuContext.cjs.map +1 -1
- package/dist/components/NavigationMenu/NavigationMenuContext.d.ts +8 -0
- package/dist/components/NavigationMenu/NavigationMenuContext.d.ts.map +1 -1
- package/dist/components/NavigationMenu/NavigationMenuContext.js.map +1 -1
- package/dist/components/NavigationMenu/index.cjs +49 -10
- package/dist/components/NavigationMenu/index.cjs.map +1 -1
- package/dist/components/NavigationMenu/index.d.ts +5 -1
- package/dist/components/NavigationMenu/index.d.ts.map +1 -1
- package/dist/components/NavigationMenu/index.js +49 -10
- package/dist/components/NavigationMenu/index.js.map +1 -1
- package/dist/components/Pagination/index.cjs +37 -9
- package/dist/components/Pagination/index.cjs.map +1 -1
- package/dist/components/Pagination/index.d.ts +2 -3
- package/dist/components/Pagination/index.d.ts.map +1 -1
- package/dist/components/Pagination/index.js +37 -9
- package/dist/components/Pagination/index.js.map +1 -1
- 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 +43 -2
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.ts +16 -6
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +26 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Progress/index.cjs +3 -1
- package/dist/components/Progress/index.cjs.map +1 -1
- package/dist/components/Progress/index.d.ts.map +1 -1
- package/dist/components/Progress/index.js +3 -1
- package/dist/components/Progress/index.js.map +1 -1
- package/dist/components/Prompt/Prompt.module.scss.cjs +14 -14
- package/dist/components/Prompt/Prompt.module.scss.js +14 -14
- package/dist/components/Prompt/index.cjs +14 -2
- package/dist/components/Prompt/index.cjs.map +1 -1
- package/dist/components/Prompt/index.d.ts +8 -5
- package/dist/components/Prompt/index.d.ts.map +1 -1
- package/dist/components/Prompt/index.js +14 -2
- package/dist/components/Prompt/index.js.map +1 -1
- package/dist/components/RadioGroup/index.cjs +14 -6
- package/dist/components/RadioGroup/index.cjs.map +1 -1
- package/dist/components/RadioGroup/index.d.ts +12 -2
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.js +14 -6
- package/dist/components/RadioGroup/index.js.map +1 -1
- package/dist/components/Select/Select.module.scss.cjs +10 -10
- package/dist/components/Select/Select.module.scss.js +10 -10
- package/dist/components/Select/index.cjs +37 -24
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.d.ts +6 -2
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +37 -24
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Sidebar/Sidebar.module.scss.cjs +42 -42
- package/dist/components/Sidebar/Sidebar.module.scss.js +42 -42
- package/dist/components/Sidebar/index.cjs +2 -2
- package/dist/components/Sidebar/index.cjs.map +1 -1
- package/dist/components/Sidebar/index.d.ts +3 -3
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +2 -2
- package/dist/components/Sidebar/index.js.map +1 -1
- package/dist/components/Skeleton/index.cjs +6 -3
- package/dist/components/Skeleton/index.cjs.map +1 -1
- package/dist/components/Skeleton/index.d.ts +3 -7
- package/dist/components/Skeleton/index.d.ts.map +1 -1
- package/dist/components/Skeleton/index.js +6 -3
- package/dist/components/Skeleton/index.js.map +1 -1
- package/dist/components/Slider/Slider.module.scss.cjs +13 -10
- package/dist/components/Slider/Slider.module.scss.cjs.map +1 -1
- package/dist/components/Slider/Slider.module.scss.js +13 -10
- package/dist/components/Slider/Slider.module.scss.js.map +1 -1
- package/dist/components/Slider/index.cjs +33 -1
- package/dist/components/Slider/index.cjs.map +1 -1
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +33 -1
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Stack/index.cjs +12 -2
- package/dist/components/Stack/index.cjs.map +1 -1
- package/dist/components/Stack/index.d.ts +3 -2
- package/dist/components/Stack/index.d.ts.map +1 -1
- package/dist/components/Stack/index.js +12 -2
- package/dist/components/Stack/index.js.map +1 -1
- package/dist/components/Table/Table.module.scss.cjs +16 -16
- package/dist/components/Table/Table.module.scss.js +16 -16
- package/dist/components/Table/index.d.ts +10 -4
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/TableOfContents/index.cjs +8 -5
- package/dist/components/TableOfContents/index.cjs.map +1 -1
- package/dist/components/TableOfContents/index.d.ts +2 -2
- package/dist/components/TableOfContents/index.d.ts.map +1 -1
- package/dist/components/TableOfContents/index.js +8 -5
- package/dist/components/TableOfContents/index.js.map +1 -1
- package/dist/components/Tabs/Tabs.module.scss.cjs +9 -9
- package/dist/components/Tabs/Tabs.module.scss.js +9 -9
- package/dist/components/Tabs/index.cjs +9 -6
- package/dist/components/Tabs/index.cjs.map +1 -1
- package/dist/components/Tabs/index.d.ts +4 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +9 -6
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Textarea/index.cjs +61 -43
- package/dist/components/Textarea/index.cjs.map +1 -1
- package/dist/components/Textarea/index.d.ts +9 -1
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +61 -43
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/components/Theme/index.cjs +3 -1
- package/dist/components/Theme/index.cjs.map +1 -1
- package/dist/components/Theme/index.d.ts +2 -4
- package/dist/components/Theme/index.d.ts.map +1 -1
- package/dist/components/Theme/index.js +3 -1
- package/dist/components/Theme/index.js.map +1 -1
- package/dist/components/ThinkingIndicator/ThinkingIndicator.module.scss.cjs +22 -22
- package/dist/components/ThinkingIndicator/ThinkingIndicator.module.scss.js +22 -22
- package/dist/components/Toast/Toast.module.scss.cjs +20 -20
- package/dist/components/Toast/Toast.module.scss.js +20 -20
- package/dist/components/Toast/index.cjs +15 -14
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.ts +9 -5
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +15 -14
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/Toggle/Toggle.module.scss.cjs +11 -11
- package/dist/components/Toggle/Toggle.module.scss.js +11 -11
- package/dist/components/Toggle/index.cjs +1 -1
- package/dist/components/Toggle/index.cjs.map +1 -1
- package/dist/components/Toggle/index.js +1 -1
- package/dist/components/Toggle/index.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.module.scss.cjs +17 -17
- package/dist/components/ToggleGroup/ToggleGroup.module.scss.js +17 -17
- package/dist/components/ToggleGroup/index.cjs +27 -8
- package/dist/components/ToggleGroup/index.cjs.map +1 -1
- package/dist/components/ToggleGroup/index.d.ts +8 -3
- package/dist/components/ToggleGroup/index.d.ts.map +1 -1
- package/dist/components/ToggleGroup/index.js +27 -8
- package/dist/components/ToggleGroup/index.js.map +1 -1
- 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 +20 -4
- package/dist/components/Tooltip/index.cjs.map +1 -1
- package/dist/components/Tooltip/index.d.ts +3 -1
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/Tooltip/index.js +20 -4
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/VisuallyHidden/index.cjs +10 -2
- package/dist/components/VisuallyHidden/index.cjs.map +1 -1
- package/dist/components/VisuallyHidden/index.d.ts +1 -1
- package/dist/components/VisuallyHidden/index.d.ts.map +1 -1
- package/dist/components/VisuallyHidden/index.js +10 -2
- package/dist/components/VisuallyHidden/index.js.map +1 -1
- package/dist/datepicker.cjs +8 -1
- package/dist/datepicker.cjs.map +1 -1
- package/dist/datepicker.js +8 -1
- package/dist/datepicker.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/markdown.cjs +5 -5
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.js +5 -5
- package/dist/markdown.js.map +1 -1
- package/dist/table.cjs +19 -3
- package/dist/table.cjs.map +1 -1
- package/dist/table.js +19 -3
- package/dist/table.js.map +1 -1
- package/fragments.json +1 -1
- package/package.json +2 -2
- package/src/blocks/AccountSettings.block.ts +1 -1
- package/src/blocks/ActivityFeed.block.ts +1 -1
- package/src/blocks/ActivityFeedSkeleton.block.ts +1 -1
- package/src/blocks/BlogEditor.block.ts +1 -1
- package/src/blocks/ChatInterface.block.ts +1 -1
- package/src/blocks/ChatMessages.block.ts +1 -1
- package/src/blocks/CheckoutForm.block.ts +1 -1
- package/src/blocks/CommandPalette.block.ts +1 -1
- package/src/blocks/ContactForm.block.ts +1 -1
- package/src/blocks/DashboardLayout.block.ts +1 -1
- package/src/blocks/DashboardPage.block.ts +1 -1
- package/src/blocks/DashboardSkeleton.block.ts +1 -1
- package/src/blocks/DataTable.block.ts +1 -1
- package/src/blocks/EmptyState.block.ts +1 -1
- package/src/blocks/FAQSection.block.ts +1 -1
- package/src/blocks/FeatureGrid.block.ts +1 -1
- package/src/blocks/HeroSection.block.ts +1 -1
- package/src/blocks/LoginForm.block.ts +1 -1
- package/src/blocks/NavigationHeader.block.ts +1 -1
- package/src/blocks/PaginatedTable.block.ts +1 -1
- package/src/blocks/PricingComparison.block.ts +1 -1
- package/src/blocks/ProductCard.block.ts +1 -1
- package/src/blocks/RegistrationForm.block.ts +1 -1
- package/src/blocks/SettingsDrawer.block.ts +1 -1
- package/src/blocks/SettingsPanel.block.ts +1 -1
- package/src/blocks/ShoppingCart.block.ts +1 -1
- package/src/blocks/StatsCard.block.ts +1 -1
- package/src/blocks/StatsCardSkeleton.block.ts +1 -1
- package/src/blocks/TableSkeleton.block.ts +1 -1
- package/src/blocks/ThinkingStates.block.ts +1 -1
- package/src/components/Accordion/Accordion.fragment.tsx +7 -7
- package/src/components/Accordion/Accordion.module.scss +2 -2
- package/src/components/Accordion/Accordion.test.tsx +8 -5
- package/src/components/Accordion/index.tsx +33 -13
- package/src/components/Alert/Alert.fragment.tsx +5 -1
- package/src/components/Alert/Alert.module.scss +1 -1
- package/src/components/Alert/Alert.test.tsx +25 -0
- package/src/components/Alert/index.tsx +49 -30
- package/src/components/AppShell/AppShell.fragment.tsx +1 -1
- package/src/components/AppShell/AppShell.module.scss +5 -5
- package/src/components/AppShell/AppShell.test.tsx +12 -0
- package/src/components/AppShell/index.tsx +2 -0
- package/src/components/Avatar/Avatar.fragment.tsx +7 -1
- package/src/components/Avatar/Avatar.test.tsx +24 -2
- package/src/components/Avatar/index.tsx +13 -1
- package/src/components/Badge/Badge.fragment.tsx +16 -1
- package/src/components/Badge/Badge.test.tsx +8 -1
- package/src/components/Badge/index.tsx +7 -2
- package/src/components/BentoGrid/BentoGrid.fragment.tsx +3 -1
- package/src/components/BentoGrid/BentoGrid.module.scss +52 -16
- package/src/components/BentoGrid/BentoGrid.test.tsx +20 -0
- package/src/components/BentoGrid/index.tsx +9 -12
- package/src/components/Box/Box.fragment.tsx +3 -1
- package/src/components/Box/Box.test.tsx +14 -0
- package/src/components/Box/index.tsx +8 -2
- package/src/components/Breadcrumbs/Breadcrumbs.fragment.tsx +19 -1
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +13 -0
- package/src/components/Breadcrumbs/index.tsx +5 -1
- package/src/components/Button/Button.fragment.tsx +28 -6
- package/src/components/Button/Button.module.scss +3 -3
- package/src/components/Button/Button.test.tsx +11 -0
- package/src/components/Button/index.tsx +16 -6
- package/src/components/ButtonGroup/ButtonGroup.fragment.tsx +4 -2
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +10 -0
- package/src/components/ButtonGroup/index.tsx +3 -3
- package/src/components/Card/Card.fragment.tsx +24 -9
- package/src/components/Card/Card.module.scss +8 -8
- package/src/components/Card/Card.test.tsx +4 -5
- package/src/components/Card/index.tsx +8 -38
- package/src/components/Chart/Chart.fragment.tsx +5 -3
- package/src/components/Chart/Chart.module.scss +1 -1
- package/src/components/Chart/index.tsx +12 -10
- package/src/components/Checkbox/Checkbox.fragment.tsx +27 -1
- package/src/components/Checkbox/Checkbox.module.scss +3 -3
- package/src/components/Checkbox/index.tsx +16 -3
- package/src/components/Chip/Chip.fragment.tsx +20 -3
- package/src/components/Chip/Chip.test.tsx +28 -0
- package/src/components/Chip/index.tsx +14 -6
- package/src/components/CodeBlock/CodeBlock.fragment.tsx +3 -1
- package/src/components/CodeBlock/CodeBlock.module.scss +9 -9
- package/src/components/CodeBlock/CodeBlock.test.tsx +21 -0
- package/src/components/CodeBlock/index.tsx +23 -9
- package/src/components/Collapsible/Collapsible.fragment.tsx +1 -1
- package/src/components/Collapsible/Collapsible.module.scss +1 -1
- package/src/components/ColorPicker/ColorPicker.fragment.tsx +1 -1
- package/src/components/Combobox/Combobox.fragment.tsx +63 -9
- package/src/components/Combobox/Combobox.module.scss +4 -7
- package/src/components/Combobox/Combobox.test.tsx +24 -3
- package/src/components/Combobox/index.tsx +117 -34
- package/src/components/Command/Command.fragment.tsx +3 -3
- package/src/components/Command/Command.module.scss +5 -5
- package/src/components/Command/Command.test.tsx +17 -0
- package/src/components/Command/index.tsx +8 -5
- package/src/components/ConversationList/ConversationList.fragment.tsx +4 -3
- package/src/components/ConversationList/ConversationList.module.scss +5 -5
- package/src/components/ConversationList/ConversationList.test.tsx +21 -0
- package/src/components/ConversationList/index.tsx +8 -4
- package/src/components/DataTable/DataTable.fragment.tsx +12 -2
- package/src/components/DataTable/DataTable.module.scss +3 -3
- package/src/components/DataTable/DataTable.test.tsx +23 -2
- package/src/components/DataTable/index.tsx +23 -5
- package/src/components/DatePicker/DatePicker.fragment.tsx +3 -1
- package/src/components/DatePicker/DatePicker.module.scss +1 -1
- package/src/components/DatePicker/DatePicker.test.tsx +17 -0
- package/src/components/DatePicker/index.tsx +9 -2
- package/src/components/Dialog/Dialog.fragment.tsx +28 -1
- package/src/components/Dialog/Dialog.module.scss +6 -6
- package/src/components/Dialog/index.tsx +25 -7
- package/src/components/Drawer/Drawer.fragment.tsx +4 -1
- package/src/components/Drawer/Drawer.module.scss +3 -3
- package/src/components/Drawer/Drawer.test.tsx +8 -0
- package/src/components/Drawer/index.tsx +15 -3
- package/src/components/Editor/Editor.fragment.tsx +10 -3
- package/src/components/Editor/Editor.module.scss +4 -4
- package/src/components/Editor/Editor.test.tsx +68 -1
- package/src/components/Editor/index.tsx +60 -9
- package/src/components/EmptyState/EmptyState.fragment.tsx +3 -1
- package/src/components/EmptyState/EmptyState.module.scss +3 -3
- package/src/components/EmptyState/EmptyState.test.tsx +18 -0
- package/src/components/EmptyState/index.tsx +16 -16
- package/src/components/Field/Field.fragment.tsx +1 -1
- package/src/components/Fieldset/Fieldset.fragment.tsx +3 -1
- package/src/components/Fieldset/Fieldset.test.tsx +14 -0
- package/src/components/Fieldset/index.tsx +3 -4
- package/src/components/Form/Form.fragment.tsx +12 -7
- package/src/components/Form/index.tsx +13 -17
- package/src/components/Grid/Grid.fragment.tsx +4 -3
- package/src/components/Grid/Grid.module.scss +3 -3
- package/src/components/Grid/index.tsx +11 -6
- package/src/components/Header/Header.fragment.tsx +31 -1
- package/src/components/Header/Header.module.scss +6 -6
- package/src/components/Header/Header.test.tsx +95 -1
- package/src/components/Header/index.tsx +95 -46
- package/src/components/Icon/Icon.fragment.tsx +21 -8
- package/src/components/Icon/Icon.test.tsx +27 -3
- package/src/components/Icon/index.tsx +39 -15
- package/src/components/Image/Image.fragment.tsx +15 -1
- package/src/components/Image/Image.test.tsx +32 -1
- package/src/components/Image/index.tsx +24 -4
- package/src/components/Input/Input.fragment.tsx +49 -1
- package/src/components/Input/Input.module.scss +4 -2
- package/src/components/Input/Input.test.tsx +3 -3
- package/src/components/Input/index.tsx +103 -37
- package/src/components/Link/Link.fragment.tsx +7 -6
- package/src/components/Link/Link.test.tsx +17 -1
- package/src/components/Link/index.tsx +22 -0
- package/src/components/List/List.fragment.tsx +1 -1
- package/src/components/Listbox/Listbox.fragment.tsx +3 -3
- package/src/components/Listbox/Listbox.module.scss +4 -4
- package/src/components/Listbox/Listbox.test.tsx +14 -0
- package/src/components/Listbox/index.tsx +12 -2
- package/src/components/Loading/Loading.fragment.tsx +1 -1
- package/src/components/Markdown/Markdown.fragment.tsx +5 -3
- package/src/components/Markdown/Markdown.module.scss +5 -5
- package/src/components/Markdown/Markdown.test.tsx +6 -0
- package/src/components/Markdown/index.tsx +12 -9
- package/src/components/Menu/Menu.fragment.tsx +19 -1
- package/src/components/Menu/Menu.module.scss +11 -11
- package/src/components/Menu/index.tsx +19 -7
- package/src/components/Message/Message.fragment.tsx +1 -1
- package/src/components/Message/Message.module.scss +3 -3
- package/src/components/NavigationMenu/NavigationMenu.fragment.tsx +9 -1
- package/src/components/NavigationMenu/NavigationMenu.module.scss +7 -7
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +48 -0
- package/src/components/NavigationMenu/NavigationMenuContext.ts +14 -0
- package/src/components/NavigationMenu/index.tsx +70 -7
- package/src/components/Pagination/Pagination.fragment.tsx +4 -1
- package/src/components/Pagination/Pagination.test.tsx +39 -0
- package/src/components/Pagination/index.tsx +36 -10
- package/src/components/Popover/Popover.fragment.tsx +18 -1
- package/src/components/Popover/Popover.module.scss +13 -13
- package/src/components/Popover/index.tsx +33 -8
- package/src/components/Progress/Progress.fragment.tsx +3 -1
- package/src/components/Progress/Progress.test.tsx +8 -0
- package/src/components/Progress/index.tsx +9 -1
- package/src/components/Prompt/Prompt.fragment.tsx +4 -1
- package/src/components/Prompt/Prompt.module.scss +3 -3
- package/src/components/Prompt/Prompt.test.tsx +19 -0
- package/src/components/Prompt/index.tsx +24 -6
- package/src/components/RadioGroup/RadioGroup.fragment.tsx +31 -1
- package/src/components/RadioGroup/index.tsx +22 -3
- package/src/components/ScrollArea/ScrollArea.fragment.tsx +1 -1
- package/src/components/Select/Select.fragment.tsx +30 -3
- package/src/components/Select/Select.module.scss +3 -3
- package/src/components/Select/index.tsx +46 -33
- package/src/components/Separator/Separator.fragment.tsx +1 -1
- package/src/components/Sidebar/Sidebar.fragment.tsx +3 -1
- package/src/components/Sidebar/Sidebar.module.scss +20 -20
- package/src/components/Sidebar/Sidebar.test.tsx +25 -0
- package/src/components/Sidebar/index.tsx +7 -7
- package/src/components/Skeleton/Skeleton.fragment.tsx +3 -1
- package/src/components/Skeleton/Skeleton.test.tsx +12 -0
- package/src/components/Skeleton/index.tsx +6 -7
- package/src/components/Slider/Slider.fragment.tsx +21 -1
- package/src/components/Slider/Slider.module.scss +31 -0
- package/src/components/Slider/Slider.test.tsx +16 -0
- package/src/components/Slider/index.tsx +40 -1
- package/src/components/Stack/Stack.fragment.tsx +3 -1
- package/src/components/Stack/index.tsx +13 -6
- package/src/components/Table/Table.fragment.tsx +43 -2
- package/src/components/Table/Table.module.scss +2 -2
- package/src/components/Table/index.tsx +23 -5
- package/src/components/TableOfContents/TableOfContents.fragment.tsx +4 -2
- package/src/components/TableOfContents/TableOfContents.test.tsx +34 -9
- package/src/components/TableOfContents/index.tsx +9 -5
- package/src/components/Tabs/Tabs.fragment.tsx +33 -8
- package/src/components/Tabs/Tabs.module.scss +8 -8
- package/src/components/Tabs/index.tsx +22 -14
- package/src/components/Text/Text.fragment.tsx +1 -1
- package/src/components/Textarea/Textarea.fragment.tsx +27 -1
- package/src/components/Textarea/index.tsx +39 -14
- package/src/components/Theme/Theme.fragment.tsx +3 -1
- package/src/components/Theme/Theme.test.tsx +11 -0
- package/src/components/Theme/index.tsx +3 -3
- package/src/components/ThinkingIndicator/ThinkingIndicator.fragment.tsx +1 -1
- package/src/components/ThinkingIndicator/ThinkingIndicator.module.scss +1 -1
- package/src/components/Toast/Toast.fragment.tsx +6 -3
- package/src/components/Toast/Toast.module.scss +8 -6
- package/src/components/Toast/index.tsx +24 -20
- package/src/components/Toggle/Toggle.fragment.tsx +1 -1
- package/src/components/Toggle/Toggle.module.scss +61 -21
- package/src/components/Toggle/index.tsx +3 -3
- package/src/components/ToggleGroup/ToggleGroup.fragment.tsx +33 -8
- package/src/components/ToggleGroup/ToggleGroup.module.scss +3 -3
- package/src/components/ToggleGroup/index.tsx +29 -9
- package/src/components/Tooltip/Tooltip.fragment.tsx +16 -1
- package/src/components/Tooltip/Tooltip.module.scss +1 -1
- package/src/components/Tooltip/index.tsx +16 -1
- package/src/components/VisuallyHidden/VisuallyHidden.fragment.tsx +3 -1
- package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +12 -0
- package/src/components/VisuallyHidden/index.tsx +7 -3
- package/src/index.ts +3 -2
- package/src/tokens/_computed.scss +1 -19
- package/src/tokens/_density.scss +0 -42
- package/src/tokens/_mixins.scss +4 -0
- package/src/tokens/_variables.scss +12 -114
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
4
5
|
const dialog = require("@base-ui/react/dialog");
|
|
5
6
|
const Drawer_module = require("./Drawer.module.scss.cjs");
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
|
+
if (e) {
|
|
10
|
+
for (const k in e) {
|
|
11
|
+
if (k !== "default") {
|
|
12
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: () => e[k]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
24
|
+
function getAsChildElement(children, componentName) {
|
|
25
|
+
if (!React__namespace.isValidElement(children)) {
|
|
26
|
+
throw new Error(`${componentName} with asChild requires a single valid React element child.`);
|
|
27
|
+
}
|
|
28
|
+
return children;
|
|
29
|
+
}
|
|
6
30
|
function CloseIcon() {
|
|
7
31
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8
32
|
"svg",
|
|
@@ -49,7 +73,8 @@ function DrawerTrigger({
|
|
|
49
73
|
...htmlProps
|
|
50
74
|
}) {
|
|
51
75
|
if (asChild) {
|
|
52
|
-
|
|
76
|
+
const child = getAsChildElement(children, "Drawer.Trigger");
|
|
77
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Trigger, { ...htmlProps, className, render: child, children: null });
|
|
53
78
|
}
|
|
54
79
|
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Trigger, { ...htmlProps, className, children });
|
|
55
80
|
}
|
|
@@ -58,6 +83,7 @@ function DrawerContent({
|
|
|
58
83
|
side = "right",
|
|
59
84
|
size = "md",
|
|
60
85
|
backdrop = true,
|
|
86
|
+
initialFocus = true,
|
|
61
87
|
className,
|
|
62
88
|
...htmlProps
|
|
63
89
|
}) {
|
|
@@ -69,7 +95,7 @@ function DrawerContent({
|
|
|
69
95
|
].filter(Boolean).join(" ");
|
|
70
96
|
return /* @__PURE__ */ jsxRuntime.jsxs(dialog.Dialog.Portal, { children: [
|
|
71
97
|
backdrop && /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Backdrop, { className: Drawer_module.default.backdrop }),
|
|
72
|
-
/* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Popup, { initialFocus
|
|
98
|
+
/* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Popup, { initialFocus, ...htmlProps, "data-side": side, className: popupClasses, children })
|
|
73
99
|
] });
|
|
74
100
|
}
|
|
75
101
|
function DrawerHeader({ children, className, ...htmlProps }) {
|
|
@@ -106,13 +132,14 @@ function DrawerClose({ children, asChild, className, ...htmlProps }) {
|
|
|
106
132
|
);
|
|
107
133
|
}
|
|
108
134
|
if (asChild) {
|
|
135
|
+
const child = getAsChildElement(children, "Drawer.Close");
|
|
109
136
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
110
137
|
dialog.Dialog.Close,
|
|
111
138
|
{
|
|
112
139
|
...htmlProps,
|
|
113
140
|
"data-drawer-close": true,
|
|
114
141
|
className,
|
|
115
|
-
render:
|
|
142
|
+
render: child,
|
|
116
143
|
children: null
|
|
117
144
|
}
|
|
118
145
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport styles from './Drawer.module.scss';\n\n// ============================================\n// Types\n// ============================================\n\n/**\n * Slide-in panel for navigation, forms, or supplementary content.\n * @see https://usefragments.com/components/drawer\n */\nexport interface DrawerProps {\n children: React.ReactNode;\n /** Controlled open state */\n open?: boolean;\n /** Default open state */\n defaultOpen?: boolean;\n /** Called when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Whether the drawer blocks interaction with the rest of the page.\n * @default true */\n modal?: boolean;\n}\n\nexport interface DrawerContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n /** Which edge the drawer slides from.\n * @default \"right\" */\n side?: 'left' | 'right' | 'top' | 'bottom';\n /** Drawer width (for left/right) or height (for top/bottom).\n * @default \"md\"\n * @see https://usefragments.com/components/drawer#sizes */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\n /** Whether to show the backdrop overlay (default: true). Set to false for non-modal bottom panels. */\n backdrop?: boolean;\n}\n\nexport interface DrawerTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children: React.ReactNode;\n asChild?: boolean;\n}\n\nexport interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerTitleProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n children: React.ReactNode;\n}\n\nexport interface DrawerDescriptionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n children: React.ReactNode;\n}\n\nexport interface DrawerBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children?: React.ReactNode;\n asChild?: boolean;\n}\n\n// ============================================\n// Close Icon\n// ============================================\n\nfunction CloseIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n// ============================================\n// Components\n// ============================================\n\nfunction DrawerRoot({\n children,\n open,\n defaultOpen,\n onOpenChange,\n modal = true,\n}: DrawerProps) {\n return (\n <BaseDialog.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n modal={modal}\n >\n {children}\n </BaseDialog.Root>\n );\n}\n\nfunction DrawerTrigger({\n children,\n asChild,\n className,\n ...htmlProps\n}: DrawerTriggerProps) {\n if (asChild) {\n return (\n <BaseDialog.Trigger {...htmlProps} className={className} render={children as React.ReactElement}>\n {null}\n </BaseDialog.Trigger>\n );\n }\n\n return (\n <BaseDialog.Trigger {...htmlProps} className={className}>\n {children}\n </BaseDialog.Trigger>\n );\n}\n\nfunction DrawerContent({\n children,\n side = 'right',\n size = 'md',\n backdrop = true,\n className,\n ...htmlProps\n}: DrawerContentProps) {\n const popupClasses = [\n styles.popup,\n styles[`side-${side}`],\n styles[`size-${size}`],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <BaseDialog.Portal>\n {backdrop && <BaseDialog.Backdrop className={styles.backdrop} />}\n <BaseDialog.Popup initialFocus {...htmlProps} data-side={side} className={popupClasses}>\n {children}\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n );\n}\n\nfunction DrawerHeader({ children, className, ...htmlProps }: DrawerHeaderProps) {\n const classes = [styles.header, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerTitle({ children, className, ...htmlProps }: DrawerTitleProps) {\n const classes = [styles.title, className].filter(Boolean).join(' ');\n return <BaseDialog.Title {...htmlProps} className={classes}>{children}</BaseDialog.Title>;\n}\n\nfunction DrawerDescription({ children, className, ...htmlProps }: DrawerDescriptionProps) {\n const classes = [styles.description, className].filter(Boolean).join(' ');\n return (\n <BaseDialog.Description {...htmlProps} className={classes}>\n {children}\n </BaseDialog.Description>\n );\n}\n\nfunction DrawerBody({ children, className, ...htmlProps }: DrawerBodyProps) {\n const classes = [styles.body, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerFooter({ children, className, ...htmlProps }: DrawerFooterProps) {\n const classes = [styles.footer, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerClose({ children, asChild, className, ...htmlProps }: DrawerCloseProps) {\n if (!children) {\n return (\n <BaseDialog.Close\n {...htmlProps}\n data-drawer-close\n aria-label=\"Close drawer\"\n className={[styles.close, className].filter(Boolean).join(' ')}\n >\n <CloseIcon />\n </BaseDialog.Close>\n );\n }\n\n if (asChild) {\n return (\n <BaseDialog.Close\n {...htmlProps}\n data-drawer-close\n className={className}\n render={children as React.ReactElement}\n >\n {null}\n </BaseDialog.Close>\n );\n }\n\n return (\n <BaseDialog.Close {...htmlProps} data-drawer-close className={className}>\n {children}\n </BaseDialog.Close>\n );\n}\n\n// ============================================\n// Export compound component\n// ============================================\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger: DrawerTrigger,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Body: DrawerBody,\n Footer: DrawerFooter,\n Close: DrawerClose,\n});\n\n// Re-export individual components for tree-shaking\nexport {\n DrawerRoot,\n DrawerTrigger,\n DrawerContent,\n DrawerHeader,\n DrawerTitle,\n DrawerDescription,\n DrawerBody,\n DrawerFooter,\n DrawerClose,\n};\n"],"names":["jsxs","jsx","BaseDialog","styles"],"mappings":";;;;;AA0EA,SAAS,YAAY;AACnB,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,MAEZ,UAAA;AAAA,QAAAC,2BAAAA,IAAC,QAAA,EAAK,IAAG,MAAK,IAAG,KAAI,IAAG,KAAI,IAAG,KAAA,CAAK;AAAA,QACpCA,2BAAAA,IAAC,UAAK,IAAG,KAAI,IAAG,KAAI,IAAG,MAAK,IAAG,KAA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AE7D,yCAAC,WAAA,CAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGjB;AAEA,MAAI,SAAS;AACX,WACEF,2BAAAA;AAAAA,MAACC,OAAAA,OAAW;AAAA,MAAX;AAAA,QACE,GAAG;AAAA,QACJ,qBAAiB;AAAA,QACjB;AAAA,QACA,QAAQ;AAAA,QAEP,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AAEA,SACED,2BAAAA,IAACC,cAAW,OAAX,EAAkB,GAAG,WAAW,qBAAiB,MAAC,WAChD,UACH;AAEJ;AAMO,MAAM,SAAS,OAAO,OAAO,YAAY;AAAA,EAC9C,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AACT,CAAC;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport styles from './Drawer.module.scss';\n\n// ============================================\n// Types\n// ============================================\n\n/**\n * Slide-in panel for navigation, forms, or supplementary content.\n * @see https://usefragments.com/components/drawer\n */\nexport interface DrawerProps {\n children: React.ReactNode;\n /** Controlled open state */\n open?: boolean;\n /** Default open state */\n defaultOpen?: boolean;\n /** Called when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Whether the drawer blocks interaction with the rest of the page.\n * @default true */\n modal?: boolean;\n}\n\nexport interface DrawerContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n /** Which edge the drawer slides from.\n * @default \"right\" */\n side?: 'left' | 'right' | 'top' | 'bottom';\n /** Drawer width (for left/right) or height (for top/bottom).\n * @default \"md\"\n * @see https://usefragments.com/components/drawer#sizes */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\n /** Whether to show the backdrop overlay (default: true). Set to false for non-modal bottom panels. */\n backdrop?: boolean;\n /** Whether to autofocus an element on open (default: true) */\n initialFocus?: boolean;\n}\n\nexport interface DrawerTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children: React.ReactNode;\n asChild?: boolean;\n}\n\nexport interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerTitleProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n children: React.ReactNode;\n}\n\nexport interface DrawerDescriptionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n children: React.ReactNode;\n}\n\nexport interface DrawerBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children?: React.ReactNode;\n asChild?: boolean;\n}\n\nfunction getAsChildElement(children: React.ReactNode, componentName: string): React.ReactElement {\n if (!React.isValidElement(children)) {\n throw new Error(`${componentName} with asChild requires a single valid React element child.`);\n }\n return children;\n}\n\n// ============================================\n// Close Icon\n// ============================================\n\nfunction CloseIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n// ============================================\n// Components\n// ============================================\n\nfunction DrawerRoot({\n children,\n open,\n defaultOpen,\n onOpenChange,\n modal = true,\n}: DrawerProps) {\n return (\n <BaseDialog.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n modal={modal}\n >\n {children}\n </BaseDialog.Root>\n );\n}\n\nfunction DrawerTrigger({\n children,\n asChild,\n className,\n ...htmlProps\n}: DrawerTriggerProps) {\n if (asChild) {\n const child = getAsChildElement(children, 'Drawer.Trigger');\n return (\n <BaseDialog.Trigger {...htmlProps} className={className} render={child}>\n {null}\n </BaseDialog.Trigger>\n );\n }\n\n return (\n <BaseDialog.Trigger {...htmlProps} className={className}>\n {children}\n </BaseDialog.Trigger>\n );\n}\n\nfunction DrawerContent({\n children,\n side = 'right',\n size = 'md',\n backdrop = true,\n initialFocus = true,\n className,\n ...htmlProps\n}: DrawerContentProps) {\n const popupClasses = [\n styles.popup,\n styles[`side-${side}`],\n styles[`size-${size}`],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <BaseDialog.Portal>\n {backdrop && <BaseDialog.Backdrop className={styles.backdrop} />}\n <BaseDialog.Popup initialFocus={initialFocus} {...htmlProps} data-side={side} className={popupClasses}>\n {children}\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n );\n}\n\nfunction DrawerHeader({ children, className, ...htmlProps }: DrawerHeaderProps) {\n const classes = [styles.header, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerTitle({ children, className, ...htmlProps }: DrawerTitleProps) {\n const classes = [styles.title, className].filter(Boolean).join(' ');\n return <BaseDialog.Title {...htmlProps} className={classes}>{children}</BaseDialog.Title>;\n}\n\nfunction DrawerDescription({ children, className, ...htmlProps }: DrawerDescriptionProps) {\n const classes = [styles.description, className].filter(Boolean).join(' ');\n return (\n <BaseDialog.Description {...htmlProps} className={classes}>\n {children}\n </BaseDialog.Description>\n );\n}\n\nfunction DrawerBody({ children, className, ...htmlProps }: DrawerBodyProps) {\n const classes = [styles.body, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerFooter({ children, className, ...htmlProps }: DrawerFooterProps) {\n const classes = [styles.footer, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerClose({ children, asChild, className, ...htmlProps }: DrawerCloseProps) {\n if (!children) {\n return (\n <BaseDialog.Close\n {...htmlProps}\n data-drawer-close\n aria-label=\"Close drawer\"\n className={[styles.close, className].filter(Boolean).join(' ')}\n >\n <CloseIcon />\n </BaseDialog.Close>\n );\n }\n\n if (asChild) {\n const child = getAsChildElement(children, 'Drawer.Close');\n return (\n <BaseDialog.Close\n {...htmlProps}\n data-drawer-close\n className={className}\n render={child}\n >\n {null}\n </BaseDialog.Close>\n );\n }\n\n return (\n <BaseDialog.Close {...htmlProps} data-drawer-close className={className}>\n {children}\n </BaseDialog.Close>\n );\n}\n\n// ============================================\n// Export compound component\n// ============================================\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger: DrawerTrigger,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Body: DrawerBody,\n Footer: DrawerFooter,\n Close: DrawerClose,\n});\n\n// Re-export individual components for tree-shaking\nexport {\n DrawerRoot,\n DrawerTrigger,\n DrawerContent,\n DrawerHeader,\n DrawerTitle,\n DrawerDescription,\n DrawerBody,\n DrawerFooter,\n DrawerClose,\n};\n"],"names":["React","jsxs","jsx","BaseDialog","styles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwEA,SAAS,kBAAkB,UAA2B,eAA2C;AAC/F,MAAI,CAACA,iBAAM,eAAe,QAAQ,GAAG;AACnC,UAAM,IAAI,MAAM,GAAG,aAAa,4DAA4D;AAAA,EAC9F;AACA,SAAO;AACT;AAMA,SAAS,YAAY;AACnB,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,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WAAW,GAAG,aAA+B;AACrF,MAAI,CAAC,UAAU;AACb,WACEF,2BAAAA;AAAAA,MAACC,OAAAA,OAAW;AAAA,MAAX;AAAA,QACE,GAAG;AAAA,QACJ,qBAAiB;AAAA,QACjB,cAAW;AAAA,QACX,WAAW,CAACC,sBAAO,OAAO,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QAE7D,yCAAC,WAAA,CAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGjB;AAEA,MAAI,SAAS;AACX,UAAM,QAAQ,kBAAkB,UAAU,cAAc;AACxD,WACEF,2BAAAA;AAAAA,MAACC,OAAAA,OAAW;AAAA,MAAX;AAAA,QACE,GAAG;AAAA,QACJ,qBAAiB;AAAA,QACjB;AAAA,QACA,QAAQ;AAAA,QAEP,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AAEA,SACED,2BAAAA,IAACC,cAAW,OAAX,EAAkB,GAAG,WAAW,qBAAiB,MAAC,WAChD,UACH;AAEJ;AAMO,MAAM,SAAS,OAAO,OAAO,YAAY;AAAA,EAC9C,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AACT,CAAC;;;;;;;;;;;"}
|
|
@@ -26,6 +26,8 @@ export interface DrawerContentProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
26
26
|
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
27
27
|
/** Whether to show the backdrop overlay (default: true). Set to false for non-modal bottom panels. */
|
|
28
28
|
backdrop?: boolean;
|
|
29
|
+
/** Whether to autofocus an element on open (default: true) */
|
|
30
|
+
initialFocus?: boolean;
|
|
29
31
|
}
|
|
30
32
|
export interface DrawerTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
31
33
|
children: React.ReactNode;
|
|
@@ -52,7 +54,7 @@ export interface DrawerCloseProps extends React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
52
54
|
}
|
|
53
55
|
declare function DrawerRoot({ children, open, defaultOpen, onOpenChange, modal, }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
54
56
|
declare function DrawerTrigger({ children, asChild, className, ...htmlProps }: DrawerTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
-
declare function DrawerContent({ children, side, size, backdrop, className, ...htmlProps }: DrawerContentProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
declare function DrawerContent({ children, side, size, backdrop, initialFocus, className, ...htmlProps }: DrawerContentProps): import("react/jsx-runtime").JSX.Element;
|
|
56
58
|
declare function DrawerHeader({ children, className, ...htmlProps }: DrawerHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
57
59
|
declare function DrawerTitle({ children, className, ...htmlProps }: DrawerTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
58
60
|
declare function DrawerDescription({ children, className, ...htmlProps }: DrawerDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yBAAyB;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qCAAqC;IACrC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;uBACmB;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC9E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;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AC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,iBAAiB,2CAG7E;AAED,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,gBAAgB,2CAG3E;AAED,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,sBAAsB,2CAOvF;AAED,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,eAAe,2CAGzE;AAED,iBAAS,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,iBAAiB,2CAG7E;AAED,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,gBAAgB,2CAiCpF;AAMD,eAAO,MAAM,MAAM;;;;;;;;;CASjB,CAAC;AAGH,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,CAAC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import { Dialog } from "@base-ui/react/dialog";
|
|
3
4
|
import styles from "./Drawer.module.scss.js";
|
|
5
|
+
function getAsChildElement(children, componentName) {
|
|
6
|
+
if (!React.isValidElement(children)) {
|
|
7
|
+
throw new Error(`${componentName} with asChild requires a single valid React element child.`);
|
|
8
|
+
}
|
|
9
|
+
return children;
|
|
10
|
+
}
|
|
4
11
|
function CloseIcon() {
|
|
5
12
|
return /* @__PURE__ */ jsxs(
|
|
6
13
|
"svg",
|
|
@@ -47,7 +54,8 @@ function DrawerTrigger({
|
|
|
47
54
|
...htmlProps
|
|
48
55
|
}) {
|
|
49
56
|
if (asChild) {
|
|
50
|
-
|
|
57
|
+
const child = getAsChildElement(children, "Drawer.Trigger");
|
|
58
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, { ...htmlProps, className, render: child, children: null });
|
|
51
59
|
}
|
|
52
60
|
return /* @__PURE__ */ jsx(Dialog.Trigger, { ...htmlProps, className, children });
|
|
53
61
|
}
|
|
@@ -56,6 +64,7 @@ function DrawerContent({
|
|
|
56
64
|
side = "right",
|
|
57
65
|
size = "md",
|
|
58
66
|
backdrop = true,
|
|
67
|
+
initialFocus = true,
|
|
59
68
|
className,
|
|
60
69
|
...htmlProps
|
|
61
70
|
}) {
|
|
@@ -67,7 +76,7 @@ function DrawerContent({
|
|
|
67
76
|
].filter(Boolean).join(" ");
|
|
68
77
|
return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
|
|
69
78
|
backdrop && /* @__PURE__ */ jsx(Dialog.Backdrop, { className: styles.backdrop }),
|
|
70
|
-
/* @__PURE__ */ jsx(Dialog.Popup, { initialFocus
|
|
79
|
+
/* @__PURE__ */ jsx(Dialog.Popup, { initialFocus, ...htmlProps, "data-side": side, className: popupClasses, children })
|
|
71
80
|
] });
|
|
72
81
|
}
|
|
73
82
|
function DrawerHeader({ children, className, ...htmlProps }) {
|
|
@@ -104,13 +113,14 @@ function DrawerClose({ children, asChild, className, ...htmlProps }) {
|
|
|
104
113
|
);
|
|
105
114
|
}
|
|
106
115
|
if (asChild) {
|
|
116
|
+
const child = getAsChildElement(children, "Drawer.Close");
|
|
107
117
|
return /* @__PURE__ */ jsx(
|
|
108
118
|
Dialog.Close,
|
|
109
119
|
{
|
|
110
120
|
...htmlProps,
|
|
111
121
|
"data-drawer-close": true,
|
|
112
122
|
className,
|
|
113
|
-
render:
|
|
123
|
+
render: child,
|
|
114
124
|
children: null
|
|
115
125
|
}
|
|
116
126
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport styles from './Drawer.module.scss';\n\n// ============================================\n// Types\n// ============================================\n\n/**\n * Slide-in panel for navigation, forms, or supplementary content.\n * @see https://usefragments.com/components/drawer\n */\nexport interface DrawerProps {\n children: React.ReactNode;\n /** Controlled open state */\n open?: boolean;\n /** Default open state */\n defaultOpen?: boolean;\n /** Called when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Whether the drawer blocks interaction with the rest of the page.\n * @default true */\n modal?: boolean;\n}\n\nexport interface DrawerContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n /** Which edge the drawer slides from.\n * @default \"right\" */\n side?: 'left' | 'right' | 'top' | 'bottom';\n /** Drawer width (for left/right) or height (for top/bottom).\n * @default \"md\"\n * @see https://usefragments.com/components/drawer#sizes */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\n /** Whether to show the backdrop overlay (default: true). Set to false for non-modal bottom panels. */\n backdrop?: boolean;\n}\n\nexport interface DrawerTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children: React.ReactNode;\n asChild?: boolean;\n}\n\nexport interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerTitleProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n children: React.ReactNode;\n}\n\nexport interface DrawerDescriptionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n children: React.ReactNode;\n}\n\nexport interface DrawerBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children?: React.ReactNode;\n asChild?: boolean;\n}\n\n// ============================================\n// Close Icon\n// ============================================\n\nfunction CloseIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n// ============================================\n// Components\n// ============================================\n\nfunction DrawerRoot({\n children,\n open,\n defaultOpen,\n onOpenChange,\n modal = true,\n}: DrawerProps) {\n return (\n <BaseDialog.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n modal={modal}\n >\n {children}\n </BaseDialog.Root>\n );\n}\n\nfunction DrawerTrigger({\n children,\n asChild,\n className,\n ...htmlProps\n}: DrawerTriggerProps) {\n if (asChild) {\n return (\n <BaseDialog.Trigger {...htmlProps} className={className} render={children as React.ReactElement}>\n {null}\n </BaseDialog.Trigger>\n );\n }\n\n return (\n <BaseDialog.Trigger {...htmlProps} className={className}>\n {children}\n </BaseDialog.Trigger>\n );\n}\n\nfunction DrawerContent({\n children,\n side = 'right',\n size = 'md',\n backdrop = true,\n className,\n ...htmlProps\n}: DrawerContentProps) {\n const popupClasses = [\n styles.popup,\n styles[`side-${side}`],\n styles[`size-${size}`],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <BaseDialog.Portal>\n {backdrop && <BaseDialog.Backdrop className={styles.backdrop} />}\n <BaseDialog.Popup initialFocus {...htmlProps} data-side={side} className={popupClasses}>\n {children}\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n );\n}\n\nfunction DrawerHeader({ children, className, ...htmlProps }: DrawerHeaderProps) {\n const classes = [styles.header, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerTitle({ children, className, ...htmlProps }: DrawerTitleProps) {\n const classes = [styles.title, className].filter(Boolean).join(' ');\n return <BaseDialog.Title {...htmlProps} className={classes}>{children}</BaseDialog.Title>;\n}\n\nfunction DrawerDescription({ children, className, ...htmlProps }: DrawerDescriptionProps) {\n const classes = [styles.description, className].filter(Boolean).join(' ');\n return (\n <BaseDialog.Description {...htmlProps} className={classes}>\n {children}\n </BaseDialog.Description>\n );\n}\n\nfunction DrawerBody({ children, className, ...htmlProps }: DrawerBodyProps) {\n const classes = [styles.body, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerFooter({ children, className, ...htmlProps }: DrawerFooterProps) {\n const classes = [styles.footer, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerClose({ children, asChild, className, ...htmlProps }: DrawerCloseProps) {\n if (!children) {\n return (\n <BaseDialog.Close\n {...htmlProps}\n data-drawer-close\n aria-label=\"Close drawer\"\n className={[styles.close, className].filter(Boolean).join(' ')}\n >\n <CloseIcon />\n </BaseDialog.Close>\n );\n }\n\n if (asChild) {\n return (\n <BaseDialog.Close\n {...htmlProps}\n data-drawer-close\n className={className}\n render={children as React.ReactElement}\n >\n {null}\n </BaseDialog.Close>\n );\n }\n\n return (\n <BaseDialog.Close {...htmlProps} data-drawer-close className={className}>\n {children}\n </BaseDialog.Close>\n );\n}\n\n// ============================================\n// Export compound component\n// ============================================\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger: DrawerTrigger,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Body: DrawerBody,\n Footer: DrawerFooter,\n Close: DrawerClose,\n});\n\n// Re-export individual components for tree-shaking\nexport {\n DrawerRoot,\n DrawerTrigger,\n DrawerContent,\n DrawerHeader,\n DrawerTitle,\n DrawerDescription,\n DrawerBody,\n DrawerFooter,\n DrawerClose,\n};\n"],"names":["BaseDialog"],"mappings":";;;AA0EA,SAAS,YAAY;AACnB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA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A,MAACA,OAAW;AAAA,MAAX;AAAA,QACE,GAAG;AAAA,QACJ,qBAAiB;AAAA,QACjB,cAAW;AAAA,QACX,WAAW,CAAC,OAAO,OAAO,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QAE7D,8BAAC,WAAA,CAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGjB;AAEA,MAAI,SAAS;AACX,WACE;AAAA,MAACA,OAAW;AAAA,MAAX;AAAA,QACE,GAAG;AAAA,QACJ,qBAAiB;AAAA,QACjB;AAAA,QACA,QAAQ;AAAA,QAEP,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AAEA,SACE,oBAACA,OAAW,OAAX,EAAkB,GAAG,WAAW,qBAAiB,MAAC,WAChD,UACH;AAEJ;AAMO,MAAM,SAAS,OAAO,OAAO,YAAY;AAAA,EAC9C,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AACT,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport styles from './Drawer.module.scss';\n\n// ============================================\n// Types\n// ============================================\n\n/**\n * Slide-in panel for navigation, forms, or supplementary content.\n * @see https://usefragments.com/components/drawer\n */\nexport interface DrawerProps {\n children: React.ReactNode;\n /** Controlled open state */\n open?: boolean;\n /** Default open state */\n defaultOpen?: boolean;\n /** Called when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Whether the drawer blocks interaction with the rest of the page.\n * @default true */\n modal?: boolean;\n}\n\nexport interface DrawerContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n /** Which edge the drawer slides from.\n * @default \"right\" */\n side?: 'left' | 'right' | 'top' | 'bottom';\n /** Drawer width (for left/right) or height (for top/bottom).\n * @default \"md\"\n * @see https://usefragments.com/components/drawer#sizes */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\n /** Whether to show the backdrop overlay (default: true). Set to false for non-modal bottom panels. */\n backdrop?: boolean;\n /** Whether to autofocus an element on open (default: true) */\n initialFocus?: boolean;\n}\n\nexport interface DrawerTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children: React.ReactNode;\n asChild?: boolean;\n}\n\nexport interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerTitleProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n children: React.ReactNode;\n}\n\nexport interface DrawerDescriptionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n children: React.ReactNode;\n}\n\nexport interface DrawerBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport interface DrawerCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children?: React.ReactNode;\n asChild?: boolean;\n}\n\nfunction getAsChildElement(children: React.ReactNode, componentName: string): React.ReactElement {\n if (!React.isValidElement(children)) {\n throw new Error(`${componentName} with asChild requires a single valid React element child.`);\n }\n return children;\n}\n\n// ============================================\n// Close Icon\n// ============================================\n\nfunction CloseIcon() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n// ============================================\n// Components\n// ============================================\n\nfunction DrawerRoot({\n children,\n open,\n defaultOpen,\n onOpenChange,\n modal = true,\n}: DrawerProps) {\n return (\n <BaseDialog.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n modal={modal}\n >\n {children}\n </BaseDialog.Root>\n );\n}\n\nfunction DrawerTrigger({\n children,\n asChild,\n className,\n ...htmlProps\n}: DrawerTriggerProps) {\n if (asChild) {\n const child = getAsChildElement(children, 'Drawer.Trigger');\n return (\n <BaseDialog.Trigger {...htmlProps} className={className} render={child}>\n {null}\n </BaseDialog.Trigger>\n );\n }\n\n return (\n <BaseDialog.Trigger {...htmlProps} className={className}>\n {children}\n </BaseDialog.Trigger>\n );\n}\n\nfunction DrawerContent({\n children,\n side = 'right',\n size = 'md',\n backdrop = true,\n initialFocus = true,\n className,\n ...htmlProps\n}: DrawerContentProps) {\n const popupClasses = [\n styles.popup,\n styles[`side-${side}`],\n styles[`size-${size}`],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <BaseDialog.Portal>\n {backdrop && <BaseDialog.Backdrop className={styles.backdrop} />}\n <BaseDialog.Popup initialFocus={initialFocus} {...htmlProps} data-side={side} className={popupClasses}>\n {children}\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n );\n}\n\nfunction DrawerHeader({ children, className, ...htmlProps }: DrawerHeaderProps) {\n const classes = [styles.header, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerTitle({ children, className, ...htmlProps }: DrawerTitleProps) {\n const classes = [styles.title, className].filter(Boolean).join(' ');\n return <BaseDialog.Title {...htmlProps} className={classes}>{children}</BaseDialog.Title>;\n}\n\nfunction DrawerDescription({ children, className, ...htmlProps }: DrawerDescriptionProps) {\n const classes = [styles.description, className].filter(Boolean).join(' ');\n return (\n <BaseDialog.Description {...htmlProps} className={classes}>\n {children}\n </BaseDialog.Description>\n );\n}\n\nfunction DrawerBody({ children, className, ...htmlProps }: DrawerBodyProps) {\n const classes = [styles.body, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerFooter({ children, className, ...htmlProps }: DrawerFooterProps) {\n const classes = [styles.footer, className].filter(Boolean).join(' ');\n return <div {...htmlProps} className={classes}>{children}</div>;\n}\n\nfunction DrawerClose({ children, asChild, className, ...htmlProps }: DrawerCloseProps) {\n if (!children) {\n return (\n <BaseDialog.Close\n {...htmlProps}\n data-drawer-close\n aria-label=\"Close drawer\"\n className={[styles.close, className].filter(Boolean).join(' ')}\n >\n <CloseIcon />\n </BaseDialog.Close>\n );\n }\n\n if (asChild) {\n const child = getAsChildElement(children, 'Drawer.Close');\n return (\n <BaseDialog.Close\n {...htmlProps}\n data-drawer-close\n className={className}\n render={child}\n >\n {null}\n </BaseDialog.Close>\n );\n }\n\n return (\n <BaseDialog.Close {...htmlProps} data-drawer-close className={className}>\n {children}\n </BaseDialog.Close>\n );\n}\n\n// ============================================\n// Export compound component\n// ============================================\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger: DrawerTrigger,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Body: DrawerBody,\n Footer: DrawerFooter,\n Close: DrawerClose,\n});\n\n// Re-export individual components for tree-shaking\nexport {\n DrawerRoot,\n DrawerTrigger,\n DrawerContent,\n DrawerHeader,\n DrawerTitle,\n DrawerDescription,\n DrawerBody,\n DrawerFooter,\n DrawerClose,\n};\n"],"names":["BaseDialog"],"mappings":";;;;AAwEA,SAAS,kBAAkB,UAA2B,eAA2C;AAC/F,MAAI,CAAC,MAAM,eAAe,QAAQ,GAAG;AACnC,UAAM,IAAI,MAAM,GAAG,aAAa,4DAA4D;AAAA,EAC9F;AACA,SAAO;AACT;AAMA,SAAS,YAAY;AACnB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;A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AAAA,QACJ,qBAAiB;AAAA,QACjB,cAAW;AAAA,QACX,WAAW,CAAC,OAAO,OAAO,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QAE7D,8BAAC,WAAA,CAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGjB;AAEA,MAAI,SAAS;AACX,UAAM,QAAQ,kBAAkB,UAAU,cAAc;AACxD,WACE;AAAA,MAACA,OAAW;AAAA,MAAX;AAAA,QACE,GAAG;AAAA,QACJ,qBAAiB;AAAA,QACjB;AAAA,QACA,QAAQ;AAAA,QAEP,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AAEA,SACE,oBAACA,OAAW,OAAX,EAAkB,GAAG,WAAW,qBAAiB,MAAC,WAChD,UACH;AAEJ;AAMO,MAAM,SAAS,OAAO,OAAO,YAAY;AAAA,EAC9C,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AACT,CAAC;"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const editor = "
|
|
4
|
-
const contentTextarea = "
|
|
5
|
-
const content = "
|
|
6
|
-
const toolbar = "
|
|
7
|
-
const toolbarGroup = "
|
|
8
|
-
const toolbarButton = "
|
|
9
|
-
const toolbarButtonActive = "
|
|
10
|
-
const separator = "
|
|
11
|
-
const statusIndicator = "
|
|
12
|
-
const statusError = "
|
|
13
|
-
const contentRich = "
|
|
14
|
-
const statusBar = "
|
|
15
|
-
const statusBarLeft = "
|
|
16
|
-
const statusBarRight = "
|
|
17
|
-
const statusBarItem = "
|
|
18
|
-
const statusBarItemWarning = "
|
|
19
|
-
const statusBarItemError = "
|
|
3
|
+
const editor = "_editor_1duc2_1";
|
|
4
|
+
const contentTextarea = "_contentTextarea_1duc2_18";
|
|
5
|
+
const content = "_content_1duc2_18";
|
|
6
|
+
const toolbar = "_toolbar_1duc2_37";
|
|
7
|
+
const toolbarGroup = "_toolbarGroup_1duc2_48";
|
|
8
|
+
const toolbarButton = "_toolbarButton_1duc2_54";
|
|
9
|
+
const toolbarButtonActive = "_toolbarButtonActive_1duc2_105";
|
|
10
|
+
const separator = "_separator_1duc2_113";
|
|
11
|
+
const statusIndicator = "_statusIndicator_1duc2_121";
|
|
12
|
+
const statusError = "_statusError_1duc2_134";
|
|
13
|
+
const contentRich = "_contentRich_1duc2_144";
|
|
14
|
+
const statusBar = "_statusBar_1duc2_267";
|
|
15
|
+
const statusBarLeft = "_statusBarLeft_1duc2_277";
|
|
16
|
+
const statusBarRight = "_statusBarRight_1duc2_283";
|
|
17
|
+
const statusBarItem = "_statusBarItem_1duc2_290";
|
|
18
|
+
const statusBarItemWarning = "_statusBarItemWarning_1duc2_297";
|
|
19
|
+
const statusBarItemError = "_statusBarItemError_1duc2_302";
|
|
20
20
|
const styles = {
|
|
21
21
|
editor,
|
|
22
22
|
contentTextarea,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const editor = "
|
|
2
|
-
const contentTextarea = "
|
|
3
|
-
const content = "
|
|
4
|
-
const toolbar = "
|
|
5
|
-
const toolbarGroup = "
|
|
6
|
-
const toolbarButton = "
|
|
7
|
-
const toolbarButtonActive = "
|
|
8
|
-
const separator = "
|
|
9
|
-
const statusIndicator = "
|
|
10
|
-
const statusError = "
|
|
11
|
-
const contentRich = "
|
|
12
|
-
const statusBar = "
|
|
13
|
-
const statusBarLeft = "
|
|
14
|
-
const statusBarRight = "
|
|
15
|
-
const statusBarItem = "
|
|
16
|
-
const statusBarItemWarning = "
|
|
17
|
-
const statusBarItemError = "
|
|
1
|
+
const editor = "_editor_1duc2_1";
|
|
2
|
+
const contentTextarea = "_contentTextarea_1duc2_18";
|
|
3
|
+
const content = "_content_1duc2_18";
|
|
4
|
+
const toolbar = "_toolbar_1duc2_37";
|
|
5
|
+
const toolbarGroup = "_toolbarGroup_1duc2_48";
|
|
6
|
+
const toolbarButton = "_toolbarButton_1duc2_54";
|
|
7
|
+
const toolbarButtonActive = "_toolbarButtonActive_1duc2_105";
|
|
8
|
+
const separator = "_separator_1duc2_113";
|
|
9
|
+
const statusIndicator = "_statusIndicator_1duc2_121";
|
|
10
|
+
const statusError = "_statusError_1duc2_134";
|
|
11
|
+
const contentRich = "_contentRich_1duc2_144";
|
|
12
|
+
const statusBar = "_statusBar_1duc2_267";
|
|
13
|
+
const statusBarLeft = "_statusBarLeft_1duc2_277";
|
|
14
|
+
const statusBarRight = "_statusBarRight_1duc2_283";
|
|
15
|
+
const statusBarItem = "_statusBarItem_1duc2_290";
|
|
16
|
+
const statusBarItemWarning = "_statusBarItemWarning_1duc2_297";
|
|
17
|
+
const statusBarItemError = "_statusBarItemError_1duc2_302";
|
|
18
18
|
const styles = {
|
|
19
19
|
editor,
|
|
20
20
|
contentTextarea,
|
|
@@ -199,6 +199,7 @@ function EditorRoot({
|
|
|
199
199
|
autoSaveInterval = 3e4,
|
|
200
200
|
size = "md",
|
|
201
201
|
maxLength,
|
|
202
|
+
toolbarIcons,
|
|
202
203
|
className,
|
|
203
204
|
...htmlProps
|
|
204
205
|
}) {
|
|
@@ -237,7 +238,7 @@ function EditorRoot({
|
|
|
237
238
|
"aria-multiline": "true"
|
|
238
239
|
}
|
|
239
240
|
},
|
|
240
|
-
content:
|
|
241
|
+
content: controlledValue !== void 0 ? controlledValue : defaultValue,
|
|
241
242
|
editable: !disabled && !readOnly,
|
|
242
243
|
onUpdate: ({ editor: e }) => {
|
|
243
244
|
const html = e.getHTML();
|
|
@@ -260,16 +261,29 @@ function EditorRoot({
|
|
|
260
261
|
}, [tiptapEditor, disabled, readOnly]);
|
|
261
262
|
React__namespace.useEffect(() => {
|
|
262
263
|
if (!onAutoSave || !value) return;
|
|
264
|
+
let cancelled = false;
|
|
263
265
|
const timer = setTimeout(() => {
|
|
264
266
|
setSaveStatus("saving");
|
|
265
267
|
try {
|
|
266
|
-
onAutoSave(value)
|
|
267
|
-
|
|
268
|
+
Promise.resolve(onAutoSave(value)).then(() => {
|
|
269
|
+
if (!cancelled) {
|
|
270
|
+
setSaveStatus("saved");
|
|
271
|
+
}
|
|
272
|
+
}).catch(() => {
|
|
273
|
+
if (!cancelled) {
|
|
274
|
+
setSaveStatus("error");
|
|
275
|
+
}
|
|
276
|
+
});
|
|
268
277
|
} catch {
|
|
269
|
-
|
|
278
|
+
if (!cancelled) {
|
|
279
|
+
setSaveStatus("error");
|
|
280
|
+
}
|
|
270
281
|
}
|
|
271
282
|
}, autoSaveInterval);
|
|
272
|
-
return () =>
|
|
283
|
+
return () => {
|
|
284
|
+
cancelled = true;
|
|
285
|
+
clearTimeout(timer);
|
|
286
|
+
};
|
|
273
287
|
}, [value, onAutoSave, autoSaveInterval]);
|
|
274
288
|
const toggleFormat = React__namespace.useCallback(
|
|
275
289
|
(format) => {
|
|
@@ -393,6 +407,7 @@ function EditorRoot({
|
|
|
393
407
|
mode,
|
|
394
408
|
size,
|
|
395
409
|
maxLength,
|
|
410
|
+
toolbarIcons,
|
|
396
411
|
wordCount,
|
|
397
412
|
charCount,
|
|
398
413
|
toggleFormat,
|
|
@@ -432,7 +447,7 @@ function EditorToolbarGroup({ children, "aria-label": ariaLabel, className }) {
|
|
|
432
447
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, role: "group", "aria-label": ariaLabel, children });
|
|
433
448
|
}
|
|
434
449
|
function EditorToolbarButton({ format, className }) {
|
|
435
|
-
const { toggleFormat, isFormatActive, disabled, readOnly, editor, mode } = useEditorContext();
|
|
450
|
+
const { toggleFormat, isFormatActive, disabled, readOnly, editor, mode, toolbarIcons } = useEditorContext();
|
|
436
451
|
const meta = FORMAT_META[format];
|
|
437
452
|
const isAction = ACTION_FORMATS.has(format);
|
|
438
453
|
const active = isAction ? false : isFormatActive(format);
|
|
@@ -445,6 +460,16 @@ function EditorToolbarButton({ format, className }) {
|
|
|
445
460
|
isDisabled = format === "undo" ? !editor.can().undo() : !editor.can().redo();
|
|
446
461
|
}
|
|
447
462
|
}
|
|
463
|
+
const iconState = {
|
|
464
|
+
format,
|
|
465
|
+
active,
|
|
466
|
+
disabled,
|
|
467
|
+
readOnly,
|
|
468
|
+
isDisabled,
|
|
469
|
+
mode
|
|
470
|
+
};
|
|
471
|
+
const iconOverride = toolbarIcons == null ? void 0 : toolbarIcons[format];
|
|
472
|
+
const renderedOverride = typeof iconOverride === "function" ? iconOverride(iconState) : iconOverride;
|
|
448
473
|
const classes = [
|
|
449
474
|
Editor_module.default.toolbarButton,
|
|
450
475
|
active && Editor_module.default.toolbarButtonActive,
|
|
@@ -460,7 +485,7 @@ function EditorToolbarButton({ format, className }) {
|
|
|
460
485
|
"aria-label": meta.label,
|
|
461
486
|
title: `${meta.label} (${meta.shortcut})`,
|
|
462
487
|
...isAction ? {} : { "aria-pressed": active },
|
|
463
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 16, weight: active ? "bold" : "regular" })
|
|
488
|
+
children: iconOverride !== void 0 ? renderedOverride : /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 16, weight: active ? "bold" : "regular" })
|
|
464
489
|
}
|
|
465
490
|
);
|
|
466
491
|
}
|