@forgedevstack/bear 1.0.2 → 1.0.4-alpha
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/components/Accordion/Accordion.cjs +1 -1
- package/dist/components/Accordion/Accordion.const.cjs +1 -0
- package/dist/components/Accordion/Accordion.const.d.ts +10 -0
- package/dist/components/Accordion/Accordion.const.js +8 -0
- package/dist/components/Accordion/Accordion.d.ts +1 -0
- package/dist/components/Accordion/Accordion.js +49 -44
- package/dist/components/Accordion/Accordion.types.d.ts +2 -0
- package/dist/components/Accordion/index.d.ts +3 -2
- package/dist/components/ActiveBar/ActiveBar.cjs +8 -0
- package/dist/components/ActiveBar/ActiveBar.d.ts +2 -0
- package/dist/components/ActiveBar/ActiveBar.js +90 -0
- package/dist/components/ActiveBar/ActiveBar.types.d.ts +16 -0
- package/dist/components/ActiveBar/index.d.ts +2 -0
- package/dist/components/ActivityItem/ActivityItem.cjs +1 -0
- package/dist/components/ActivityItem/ActivityItem.d.ts +7 -0
- package/dist/components/ActivityItem/ActivityItem.js +44 -0
- package/dist/components/ActivityItem/ActivityItem.types.d.ts +17 -0
- package/dist/components/ActivityItem/index.d.ts +2 -0
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.const.cjs +1 -0
- package/dist/components/Alert/Alert.const.d.ts +14 -0
- package/dist/components/Alert/Alert.const.js +27 -0
- package/dist/components/Alert/Alert.js +54 -63
- package/dist/components/Alert/Alert.types.d.ts +3 -1
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.const.cjs +1 -0
- package/dist/components/Avatar/Avatar.const.d.ts +28 -0
- package/dist/components/Avatar/Avatar.const.js +28 -0
- package/dist/components/Avatar/Avatar.js +49 -60
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.js +24 -22
- package/dist/components/BearLogo/EmberLogo.cjs +17 -0
- package/dist/components/BearLogo/EmberLogo.js +91 -0
- package/dist/components/BearLogo/index.d.ts +2 -0
- package/dist/components/Box/Box.cjs +1 -0
- package/dist/components/Box/Box.d.ts +2 -0
- package/dist/components/Box/Box.js +64 -0
- package/dist/components/Box/Box.types.d.ts +24 -0
- package/dist/components/Box/Box.utils.cjs +1 -0
- package/dist/components/Box/Box.utils.d.ts +3 -0
- package/dist/components/Box/Box.utils.js +21 -0
- package/dist/components/Box/index.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.const.cjs +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.const.d.ts +16 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.const.js +19 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +49 -34
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +8 -1
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +1 -1
- package/dist/components/Button/Button.constants.d.ts +2 -2
- package/dist/components/Button/Button.constants.js +2 -2
- package/dist/components/Button/Button.js +41 -46
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.const.cjs +1 -0
- package/dist/components/Calendar/Calendar.const.d.ts +18 -0
- package/dist/components/Calendar/Calendar.const.js +27 -0
- package/dist/components/Calendar/Calendar.helpers.cjs +1 -0
- package/dist/components/Calendar/Calendar.helpers.d.ts +10 -0
- package/dist/components/Calendar/Calendar.helpers.js +9 -0
- package/dist/components/Calendar/Calendar.js +132 -149
- package/dist/components/Calendar/Calendar.types.d.ts +4 -0
- package/dist/components/Calendar/Calendar.utils.cjs +1 -0
- package/dist/components/Calendar/Calendar.utils.d.ts +41 -0
- package/dist/components/Calendar/Calendar.utils.js +33 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.const.cjs +1 -0
- package/dist/components/Card/Card.const.d.ts +13 -0
- package/dist/components/Card/Card.const.js +32 -0
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Card/Card.js +101 -105
- package/dist/components/Card/index.d.ts +3 -2
- package/dist/components/Chart/Chart.cjs +1 -0
- package/dist/components/Chart/Chart.const.d.ts +15 -0
- package/dist/components/Chart/Chart.d.ts +18 -0
- package/dist/components/Chart/Chart.js +225 -0
- package/dist/components/Chart/Chart.types.d.ts +51 -0
- package/dist/components/Chart/Chart.utils.d.ts +31 -0
- package/dist/components/Chart/index.d.ts +2 -0
- package/dist/components/CodeBlock/CodeBlock.cjs +2 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +2 -0
- package/dist/components/CodeBlock/CodeBlock.js +68 -0
- package/dist/components/CodeBlock/CodeBlock.types.d.ts +21 -0
- package/dist/components/CodeBlock/index.d.ts +2 -0
- package/dist/components/Columns/Columns.cjs +1 -0
- package/dist/components/Columns/Columns.d.ts +5 -0
- package/dist/components/Columns/Columns.js +54 -0
- package/dist/components/Columns/Columns.types.d.ts +17 -0
- package/dist/components/Columns/index.d.ts +2 -0
- package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +28 -28
- package/dist/components/Editable/Editable.cjs +1 -0
- package/dist/components/Editable/Editable.d.ts +10 -0
- package/dist/components/Editable/Editable.js +194 -0
- package/dist/components/Editable/Editable.types.d.ts +39 -0
- package/dist/components/Editable/index.d.ts +2 -0
- package/dist/components/Em/Em.cjs +1 -0
- package/dist/components/Em/Em.d.ts +2 -0
- package/dist/components/Em/Em.js +24 -0
- package/dist/components/Em/Em.types.d.ts +5 -0
- package/dist/components/Em/index.d.ts +2 -0
- package/dist/components/Fab/Fab.cjs +1 -1
- package/dist/components/Fab/Fab.js +9 -9
- package/dist/components/Gauge/Gauge.cjs +1 -0
- package/dist/components/Gauge/Gauge.d.ts +3 -0
- package/dist/components/Gauge/Gauge.js +92 -0
- package/dist/components/Gauge/Gauge.types.d.ts +27 -0
- package/dist/components/Gauge/index.d.ts +2 -0
- package/dist/components/Highlight/Highlight.cjs +1 -0
- package/dist/components/Highlight/Highlight.d.ts +2 -0
- package/dist/components/Highlight/Highlight.js +28 -0
- package/dist/components/Highlight/Highlight.types.d.ts +6 -0
- package/dist/components/Highlight/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -0
- package/dist/components/HoverCard/HoverCard.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.js +68 -0
- package/dist/components/HoverCard/HoverCard.types.d.ts +13 -0
- package/dist/components/HoverCard/HoverCard.utils.cjs +1 -0
- package/dist/components/HoverCard/HoverCard.utils.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.utils.js +23 -0
- package/dist/components/HoverCard/index.d.ts +2 -0
- package/dist/components/Icon/icons/editor.cjs +1 -1
- package/dist/components/Icon/icons/editor.d.ts +1 -0
- package/dist/components/Icon/icons/editor.js +66 -61
- package/dist/components/Icon/icons/misc.cjs +1 -1
- package/dist/components/Icon/icons/misc.d.ts +13 -0
- package/dist/components/Icon/icons/misc.js +157 -88
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +27 -0
- package/dist/components/Icon/index.js +28 -21
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +36 -35
- package/dist/components/Mark/Mark.cjs +1 -0
- package/dist/components/Mark/Mark.d.ts +2 -0
- package/dist/components/Mark/Mark.js +26 -0
- package/dist/components/Mark/Mark.types.d.ts +5 -0
- package/dist/components/Mark/index.d.ts +2 -0
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -0
- package/dist/components/Modal/Modal.const.d.ts +10 -0
- package/dist/components/Modal/Modal.const.js +17 -0
- package/dist/components/Modal/Modal.d.ts +11 -0
- package/dist/components/Modal/Modal.js +80 -77
- package/dist/components/Modal/Modal.types.d.ts +6 -1
- package/dist/components/Modal/index.d.ts +3 -2
- package/dist/components/Rating/Rating.cjs +1 -1
- package/dist/components/Rating/Rating.const.cjs +1 -0
- package/dist/components/Rating/Rating.const.d.ts +14 -0
- package/dist/components/Rating/Rating.const.js +22 -0
- package/dist/components/Rating/Rating.d.ts +5 -10
- package/dist/components/Rating/Rating.js +135 -93
- package/dist/components/Rating/Rating.types.d.ts +27 -25
- package/dist/components/Rating/index.d.ts +2 -2
- package/dist/components/RichEditor/RichEditor.cjs +1 -0
- package/dist/components/RichEditor/RichEditor.const.cjs +141 -0
- package/dist/components/RichEditor/RichEditor.const.d.ts +137 -0
- package/dist/components/RichEditor/RichEditor.const.js +279 -0
- package/dist/components/RichEditor/RichEditor.d.ts +18 -0
- package/dist/components/RichEditor/RichEditor.js +363 -0
- package/dist/components/RichEditor/RichEditor.types.d.ts +57 -0
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.cjs +1 -0
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.d.ts +4 -0
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.js +25 -0
- package/dist/components/RichEditor/components/ToolbarButton/index.d.ts +1 -0
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -0
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.d.ts +4 -0
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +126 -0
- package/dist/components/RichEditor/components/ToolbarColorPicker/index.d.ts +1 -0
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -0
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts +4 -0
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.js +57 -0
- package/dist/components/RichEditor/components/ToolbarDropdown/index.d.ts +1 -0
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.cjs +1 -0
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.d.ts +7 -0
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.js +45 -0
- package/dist/components/RichEditor/components/ToolbarMore/index.d.ts +2 -0
- package/dist/components/RichEditor/components/index.d.ts +4 -0
- package/dist/components/RichEditor/helpers/formatHelpers.cjs +1 -0
- package/dist/components/RichEditor/helpers/formatHelpers.d.ts +57 -0
- package/dist/components/RichEditor/helpers/formatHelpers.js +26 -0
- package/dist/components/RichEditor/helpers/index.d.ts +1 -0
- package/dist/components/RichEditor/index.d.ts +4 -0
- package/dist/components/Sidebar/Sidebar.cjs +1 -0
- package/dist/components/Sidebar/Sidebar.const.cjs +1 -0
- package/dist/components/Sidebar/Sidebar.const.d.ts +16 -0
- package/dist/components/Sidebar/Sidebar.const.js +22 -0
- package/dist/components/Sidebar/Sidebar.d.ts +17 -0
- package/dist/components/Sidebar/Sidebar.js +70 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts +44 -0
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.cjs +1 -0
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.d.ts +4 -0
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.js +45 -0
- package/dist/components/Sidebar/components/SidebarGroup/index.d.ts +2 -0
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.cjs +1 -0
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.d.ts +4 -0
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.js +66 -0
- package/dist/components/Sidebar/components/SidebarItem/index.d.ts +2 -0
- package/dist/components/Sidebar/components/index.d.ts +2 -0
- package/dist/components/Sidebar/index.d.ts +5 -0
- package/dist/components/SignPad/SignPad.cjs +1 -0
- package/dist/components/SignPad/SignPad.const.cjs +1 -0
- package/dist/components/SignPad/SignPad.const.d.ts +19 -0
- package/dist/components/SignPad/SignPad.const.js +20 -0
- package/dist/components/SignPad/SignPad.d.ts +17 -0
- package/dist/components/SignPad/SignPad.js +161 -0
- package/dist/components/SignPad/SignPad.types.d.ts +37 -0
- package/dist/components/SignPad/index.d.ts +3 -0
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.const.cjs +36 -0
- package/dist/components/Skeleton/Skeleton.const.d.ts +12 -0
- package/dist/components/Skeleton/Skeleton.const.js +58 -0
- package/dist/components/Skeleton/Skeleton.d.ts +15 -24
- package/dist/components/Skeleton/Skeleton.js +132 -103
- package/dist/components/Skeleton/Skeleton.types.d.ts +18 -8
- package/dist/components/Skeleton/index.d.ts +2 -2
- package/dist/components/Slider/Slider.cjs +1 -1
- package/dist/components/Slider/Slider.js +8 -8
- package/dist/components/Sparkline/Sparkline.cjs +1 -0
- package/dist/components/Sparkline/Sparkline.const.cjs +1 -0
- package/dist/components/Sparkline/Sparkline.const.d.ts +16 -0
- package/dist/components/Sparkline/Sparkline.const.js +16 -0
- package/dist/components/Sparkline/Sparkline.d.ts +3 -0
- package/dist/components/Sparkline/Sparkline.js +80 -0
- package/dist/components/Sparkline/Sparkline.types.d.ts +19 -0
- package/dist/components/Sparkline/Sparkline.utils.cjs +1 -0
- package/dist/components/Sparkline/Sparkline.utils.d.ts +27 -0
- package/dist/components/Sparkline/Sparkline.utils.js +30 -0
- package/dist/components/Sparkline/index.d.ts +5 -0
- package/dist/components/SpeedDial/SpeedDial.cjs +12 -1
- package/dist/components/SpeedDial/SpeedDial.const.cjs +1 -0
- package/dist/components/SpeedDial/SpeedDial.const.d.ts +22 -0
- package/dist/components/SpeedDial/SpeedDial.const.js +26 -0
- package/dist/components/SpeedDial/SpeedDial.d.ts +5 -7
- package/dist/components/SpeedDial/SpeedDial.js +154 -144
- package/dist/components/SpeedDial/SpeedDial.types.d.ts +26 -29
- package/dist/components/SpeedDial/index.d.ts +1 -1
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.js +17 -15
- package/dist/components/StatCard/StatCard.cjs +1 -0
- package/dist/components/StatCard/StatCard.d.ts +7 -0
- package/dist/components/StatCard/StatCard.js +36 -0
- package/dist/components/StatCard/StatCard.types.d.ts +13 -0
- package/dist/components/StatCard/index.d.ts +2 -0
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -0
- package/dist/components/Stepper/Stepper.const.d.ts +29 -0
- package/dist/components/Stepper/Stepper.const.js +46 -0
- package/dist/components/Stepper/Stepper.d.ts +10 -3
- package/dist/components/Stepper/Stepper.js +143 -92
- package/dist/components/Stepper/Stepper.types.d.ts +63 -13
- package/dist/components/Stepper/index.d.ts +2 -2
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.js +74 -47
- package/dist/components/Switch/Switch.types.d.ts +11 -1
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.js +33 -29
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.d.ts +14 -0
- package/dist/components/TimePicker/TimePicker.constants.js +18 -4
- package/dist/components/TimePicker/TimePicker.js +92 -91
- package/dist/components/Timeline/Timeline.cjs +1 -1
- package/dist/components/Timeline/Timeline.const.cjs +1 -0
- package/dist/components/Timeline/Timeline.const.d.ts +40 -0
- package/dist/components/Timeline/Timeline.const.js +58 -0
- package/dist/components/Timeline/Timeline.d.ts +16 -2
- package/dist/components/Timeline/Timeline.js +131 -63
- package/dist/components/Timeline/Timeline.types.d.ts +30 -11
- package/dist/components/Timeline/index.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +37 -35
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.js +38 -36
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +38 -4
- package/dist/components/index.js +213 -168
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +24 -0
- package/dist/hooks/index.js +42 -14
- package/dist/hooks/useBounce/index.d.ts +2 -0
- package/dist/hooks/useBounce/useBounce.cjs +1 -0
- package/dist/hooks/useBounce/useBounce.d.ts +2 -0
- package/dist/hooks/useBounce/useBounce.js +36 -0
- package/dist/hooks/useBounce/useBounce.types.d.ts +27 -0
- package/dist/hooks/useClickOutside/index.d.ts +2 -0
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +22 -0
- package/dist/hooks/useClickOutside/useClickOutside.types.d.ts +10 -0
- package/dist/hooks/useClipboard/index.d.ts +2 -0
- package/dist/hooks/useClipboard/useClipboard.cjs +1 -0
- package/dist/hooks/useClipboard/useClipboard.d.ts +15 -0
- package/dist/hooks/useClipboard/useClipboard.js +22 -0
- package/dist/hooks/useClipboard/useClipboard.types.d.ts +20 -0
- package/dist/hooks/useDebounce/index.d.ts +2 -0
- package/dist/hooks/useDebounce/useDebounce.cjs +1 -0
- package/dist/hooks/useDebounce/useDebounce.d.ts +32 -0
- package/dist/hooks/useDebounce/useDebounce.js +39 -0
- package/dist/hooks/useDebounce/useDebounce.types.d.ts +20 -0
- package/dist/hooks/useFloat/index.d.ts +2 -0
- package/dist/hooks/useFloat/useFloat.cjs +1 -0
- package/dist/hooks/useFloat/useFloat.d.ts +2 -0
- package/dist/hooks/useFloat/useFloat.js +37 -0
- package/dist/hooks/useFloat/useFloat.types.d.ts +25 -0
- package/dist/hooks/useIntersectionObserver/index.d.ts +2 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.cjs +1 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +25 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.js +39 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.types.d.ts +22 -0
- package/dist/hooks/useKeyPress/index.d.ts +2 -0
- package/dist/hooks/useKeyPress/useKeyPress.cjs +1 -0
- package/dist/hooks/useKeyPress/useKeyPress.d.ts +22 -0
- package/dist/hooks/useKeyPress/useKeyPress.js +39 -0
- package/dist/hooks/useKeyPress/useKeyPress.types.d.ts +19 -0
- package/dist/hooks/useLocalStorage/index.d.ts +2 -0
- package/dist/hooks/useLocalStorage/useLocalStorage.cjs +1 -0
- package/dist/hooks/useLocalStorage/useLocalStorage.d.ts +11 -0
- package/dist/hooks/useLocalStorage/useLocalStorage.js +47 -0
- package/dist/hooks/useLocalStorage/useLocalStorage.types.d.ts +16 -0
- package/dist/hooks/useMediaQuery/index.d.ts +3 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +12 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.types.d.ts +21 -0
- package/dist/hooks/useParallax/index.d.ts +2 -0
- package/dist/hooks/useParallax/useParallax.cjs +1 -0
- package/dist/hooks/useParallax/useParallax.d.ts +2 -0
- package/dist/hooks/useParallax/useParallax.js +36 -0
- package/dist/hooks/useParallax/useParallax.types.d.ts +19 -0
- package/dist/hooks/usePulse/index.d.ts +2 -0
- package/dist/hooks/usePulse/usePulse.cjs +1 -0
- package/dist/hooks/usePulse/usePulse.d.ts +2 -0
- package/dist/hooks/usePulse/usePulse.js +38 -0
- package/dist/hooks/usePulse/usePulse.types.d.ts +29 -0
- package/dist/hooks/useShake/index.d.ts +2 -0
- package/dist/hooks/useShake/useShake.cjs +1 -0
- package/dist/hooks/useShake/useShake.d.ts +2 -0
- package/dist/hooks/useShake/useShake.js +14 -0
- package/dist/hooks/useShake/useShake.types.d.ts +19 -0
- package/dist/hooks/useSlide/index.d.ts +2 -0
- package/dist/hooks/useSlide/useSlide.cjs +1 -0
- package/dist/hooks/useSlide/useSlide.d.ts +2 -0
- package/dist/hooks/useSlide/useSlide.js +68 -0
- package/dist/hooks/useSlide/useSlide.types.d.ts +36 -0
- package/dist/hooks/useThrottle/index.d.ts +2 -0
- package/dist/hooks/useThrottle/useThrottle.cjs +1 -0
- package/dist/hooks/useThrottle/useThrottle.d.ts +26 -0
- package/dist/hooks/useThrottle/useThrottle.js +44 -0
- package/dist/hooks/useThrottle/useThrottle.types.d.ts +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +275 -202
- package/dist/styles.css +1 -1
- package/package.json +15 -22
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface RichEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
3
|
+
/** Controlled HTML content */
|
|
4
|
+
value?: string;
|
|
5
|
+
/** Initial HTML content (uncontrolled) */
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
/** Called when content changes */
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
/** Placeholder text when empty */
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
/** Completely disables the editor */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Allows viewing but not editing */
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
/** Minimum editor height in pixels */
|
|
16
|
+
minHeight?: string | number;
|
|
17
|
+
/** Maximum height (enables scroll) */
|
|
18
|
+
maxHeight?: string | number;
|
|
19
|
+
/** Toolbar buttons to display */
|
|
20
|
+
toolbar?: ToolbarOption[];
|
|
21
|
+
/** Test ID for testing purposes */
|
|
22
|
+
testId?: string;
|
|
23
|
+
/** Unique ID for accessibility */
|
|
24
|
+
id?: string;
|
|
25
|
+
/** Enable image paste support */
|
|
26
|
+
allowImagePaste?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type ToolbarOption = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'headingDropdown' | 'bulletList' | 'orderedList' | 'blockquote' | 'code' | 'link' | 'image' | 'textColor' | 'highlightColor' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'alignJustify' | 'indent' | 'outdent' | 'clearFormat' | 'table' | 'divider' | 'more';
|
|
29
|
+
export interface ToolbarButtonProps {
|
|
30
|
+
icon: ReactNode;
|
|
31
|
+
title: string;
|
|
32
|
+
active?: boolean;
|
|
33
|
+
onClick: () => void;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface DropdownOption {
|
|
37
|
+
value: string;
|
|
38
|
+
label: string;
|
|
39
|
+
preview?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
export interface ToolbarDropdownProps {
|
|
42
|
+
options: DropdownOption[];
|
|
43
|
+
value: string;
|
|
44
|
+
onChange: (value: string) => void;
|
|
45
|
+
title: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
icon?: ReactNode;
|
|
48
|
+
}
|
|
49
|
+
export interface ToolbarColorPickerProps {
|
|
50
|
+
value: string;
|
|
51
|
+
onChange: (color: string) => void;
|
|
52
|
+
title: string;
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
type?: 'text' | 'highlight';
|
|
55
|
+
recentColors?: string[];
|
|
56
|
+
onApplyLast?: (color: string) => void;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),T=require("../../../../utils/cn.cjs"),t=require("../../RichEditor.const.cjs"),E=e=>{const{icon:i,title:_,active:n,onClick:r,disabled:o}=e;return c.jsx("button",{type:"button",title:_,onClick:r,disabled:o,className:T.cn("Bear-RichEditor__button",t.RICH_EDITOR_BUTTON_BASE_CLASSES,n?`Bear-RichEditor__button--active ${t.RICH_EDITOR_BUTTON_ACTIVE_CLASSES}`:t.RICH_EDITOR_BUTTON_INACTIVE_CLASSES,o&&`Bear-RichEditor__button--disabled ${t.RICH_EDITOR_BUTTON_DISABLED_CLASSES}`),children:i})};exports.ToolbarButton=E;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import { cn as S } from "../../../../utils/cn.js";
|
|
3
|
+
import { RICH_EDITOR_BUTTON_DISABLED_CLASSES as e, RICH_EDITOR_BUTTON_ACTIVE_CLASSES as n, RICH_EDITOR_BUTTON_INACTIVE_CLASSES as c, RICH_EDITOR_BUTTON_BASE_CLASSES as I } from "../../RichEditor.const.js";
|
|
4
|
+
const B = (o) => {
|
|
5
|
+
const { icon: _, title: i, active: r, onClick: E, disabled: t } = o;
|
|
6
|
+
return /* @__PURE__ */ T(
|
|
7
|
+
"button",
|
|
8
|
+
{
|
|
9
|
+
type: "button",
|
|
10
|
+
title: i,
|
|
11
|
+
onClick: E,
|
|
12
|
+
disabled: t,
|
|
13
|
+
className: S(
|
|
14
|
+
"Bear-RichEditor__button",
|
|
15
|
+
I,
|
|
16
|
+
r ? `Bear-RichEditor__button--active ${n}` : c,
|
|
17
|
+
t && `Bear-RichEditor__button--disabled ${e}`
|
|
18
|
+
),
|
|
19
|
+
children: _
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
B as ToolbarButton
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ToolbarButton, default } from './ToolbarButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("react"),s=require("../../../../utils/cn.cjs"),i=require("../../RichEditor.const.cjs"),m=require("../../../Icon/icons/editor.cjs"),_=require("../../../Icon/icons/status.cjs"),C=p=>{const{value:r,onChange:f,title:y,disabled:o,type:n="text",recentColors:a=[],onApplyLast:h}=p,[b,c]=g.useState(!1),l=g.useRef(null);g.useEffect(()=>{const e=u=>{l.current&&!l.current.contains(u.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const d=e=>{f(e),c(!1)},k=n==="text"?m.FormatColorTextIcon:m.HighlightIcon,x=a[0]||r;return t.jsxs("div",{ref:l,className:"Bear-RichEditor__color-picker relative flex items-center",children:[t.jsxs("button",{type:"button",title:y,disabled:o,onClick:()=>c(!b),className:s.cn("Bear-RichEditor__color-trigger",i.RICH_EDITOR_BUTTON_BASE_CLASSES,i.RICH_EDITOR_BUTTON_INACTIVE_CLASSES,"flex items-center gap-0.5",o&&`Bear-RichEditor__color-trigger--disabled ${i.RICH_EDITOR_BUTTON_DISABLED_CLASSES}`),children:[t.jsx(k,{size:16}),t.jsx("span",{className:"w-3 h-1 rounded-sm mt-0.5",style:{backgroundColor:r||(n==="text"?"#000000":"#fef08a")}})]}),x&&h&&t.jsx("button",{type:"button",title:`Apply ${n==="text"?"text":"highlight"} color`,disabled:o,onClick:()=>h(x),className:s.cn("Bear-RichEditor__color-apply","p-0.5 rounded transition-colors","text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700",o&&"opacity-50 cursor-not-allowed"),children:t.jsx(_.CheckIcon,{size:12})}),b&&t.jsxs("div",{className:"Bear-RichEditor__color-menu absolute bottom-full left-0 mb-1 p-3 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl min-w-[200px]",style:{zIndex:9999},children:[a.length>0&&t.jsxs("div",{className:"mb-3",children:[t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1.5",children:"Recent"}),t.jsx("div",{className:"flex gap-1",children:a.slice(0,6).map((e,u)=>t.jsx("button",{type:"button",onClick:()=>d(e),className:s.cn("w-6 h-6 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110",r===e&&"ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"),style:{backgroundColor:e},title:e},`recent-${u}`))})]}),t.jsx("div",{className:"grid grid-cols-8 gap-1",children:i.RICH_EDITOR_COLORS.map(e=>t.jsx("button",{type:"button",onClick:()=>d(e),className:s.cn("Bear-RichEditor__color-swatch","w-5 h-5 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110",r===e&&"ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"),style:{backgroundColor:e},title:e},e))}),t.jsxs("button",{type:"button",onClick:()=>d(""),className:"w-full mt-2 px-2 py-1.5 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors",children:["Remove ",n==="text"?"color":"highlight"]})]})]})};exports.ToolbarColorPicker=C;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useRef as y, useEffect as _ } from "react";
|
|
3
|
+
import { cn as a } from "../../../../utils/cn.js";
|
|
4
|
+
import { RICH_EDITOR_BUTTON_DISABLED_CLASSES as C, RICH_EDITOR_BUTTON_INACTIVE_CLASSES as E, RICH_EDITOR_BUTTON_BASE_CLASSES as R, RICH_EDITOR_COLORS as v } from "../../RichEditor.const.js";
|
|
5
|
+
import { FormatColorTextIcon as I, HighlightIcon as N } from "../../../Icon/icons/editor.js";
|
|
6
|
+
import { CheckIcon as S } from "../../../Icon/icons/status.js";
|
|
7
|
+
const L = (p) => {
|
|
8
|
+
const {
|
|
9
|
+
value: o,
|
|
10
|
+
onChange: b,
|
|
11
|
+
title: f,
|
|
12
|
+
disabled: n,
|
|
13
|
+
type: i = "text",
|
|
14
|
+
recentColors: l = [],
|
|
15
|
+
onApplyLast: m
|
|
16
|
+
} = p, [h, s] = k(!1), c = y(null);
|
|
17
|
+
_(() => {
|
|
18
|
+
const e = (g) => {
|
|
19
|
+
c.current && !c.current.contains(g.target) && s(!1);
|
|
20
|
+
};
|
|
21
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
22
|
+
}, []);
|
|
23
|
+
const d = (e) => {
|
|
24
|
+
b(e), s(!1);
|
|
25
|
+
}, x = i === "text" ? I : N, u = l[0] || o;
|
|
26
|
+
return /* @__PURE__ */ r("div", { ref: c, className: "Bear-RichEditor__color-picker relative flex items-center", children: [
|
|
27
|
+
/* @__PURE__ */ r(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
type: "button",
|
|
31
|
+
title: f,
|
|
32
|
+
disabled: n,
|
|
33
|
+
onClick: () => s(!h),
|
|
34
|
+
className: a(
|
|
35
|
+
"Bear-RichEditor__color-trigger",
|
|
36
|
+
R,
|
|
37
|
+
E,
|
|
38
|
+
"flex items-center gap-0.5",
|
|
39
|
+
n && `Bear-RichEditor__color-trigger--disabled ${C}`
|
|
40
|
+
),
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ t(x, { size: 16 }),
|
|
43
|
+
/* @__PURE__ */ t(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
className: "w-3 h-1 rounded-sm mt-0.5",
|
|
47
|
+
style: { backgroundColor: o || (i === "text" ? "#000000" : "#fef08a") }
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
u && m && /* @__PURE__ */ t(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
title: `Apply ${i === "text" ? "text" : "highlight"} color`,
|
|
58
|
+
disabled: n,
|
|
59
|
+
onClick: () => m(u),
|
|
60
|
+
className: a(
|
|
61
|
+
"Bear-RichEditor__color-apply",
|
|
62
|
+
"p-0.5 rounded transition-colors",
|
|
63
|
+
"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700",
|
|
64
|
+
n && "opacity-50 cursor-not-allowed"
|
|
65
|
+
),
|
|
66
|
+
children: /* @__PURE__ */ t(S, { size: 12 })
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
h && /* @__PURE__ */ r(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: "Bear-RichEditor__color-menu absolute bottom-full left-0 mb-1 p-3 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl min-w-[200px]",
|
|
73
|
+
style: { zIndex: 9999 },
|
|
74
|
+
children: [
|
|
75
|
+
l.length > 0 && /* @__PURE__ */ r("div", { className: "mb-3", children: [
|
|
76
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-gray-500 dark:text-gray-400 mb-1.5", children: "Recent" }),
|
|
77
|
+
/* @__PURE__ */ t("div", { className: "flex gap-1", children: l.slice(0, 6).map((e, g) => /* @__PURE__ */ t(
|
|
78
|
+
"button",
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
onClick: () => d(e),
|
|
82
|
+
className: a(
|
|
83
|
+
"w-6 h-6 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110",
|
|
84
|
+
o === e && "ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"
|
|
85
|
+
),
|
|
86
|
+
style: { backgroundColor: e },
|
|
87
|
+
title: e
|
|
88
|
+
},
|
|
89
|
+
`recent-${g}`
|
|
90
|
+
)) })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-8 gap-1", children: v.map((e) => /* @__PURE__ */ t(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
type: "button",
|
|
96
|
+
onClick: () => d(e),
|
|
97
|
+
className: a(
|
|
98
|
+
"Bear-RichEditor__color-swatch",
|
|
99
|
+
"w-5 h-5 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110",
|
|
100
|
+
o === e && "ring-2 ring-pink-500 ring-offset-1 dark:ring-offset-zinc-800"
|
|
101
|
+
),
|
|
102
|
+
style: { backgroundColor: e },
|
|
103
|
+
title: e
|
|
104
|
+
},
|
|
105
|
+
e
|
|
106
|
+
)) }),
|
|
107
|
+
/* @__PURE__ */ r(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
onClick: () => d(""),
|
|
112
|
+
className: "w-full mt-2 px-2 py-1.5 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors",
|
|
113
|
+
children: [
|
|
114
|
+
"Remove ",
|
|
115
|
+
i === "text" ? "color" : "highlight"
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] });
|
|
123
|
+
};
|
|
124
|
+
export {
|
|
125
|
+
L as ToolbarColorPicker
|
|
126
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ToolbarColorPicker, default } from './ToolbarColorPicker';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("react"),h=require("../../../../utils/cn.cjs"),s=require("../../RichEditor.const.cjs"),m=()=>r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:r.jsx("path",{d:"M6 9l6 6 6-6"})}),w=p=>{const{options:a,value:d,onChange:_,title:b,disabled:c,icon:l}=p,[u,t]=i.useState(!1),n=i.useRef(null);i.useEffect(()=>{const e=x=>{n.current&&!n.current.contains(x.target)&&t(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const o=a.find(e=>e.value===d),g=e=>{_(e.value),t(!1)};return r.jsxs("div",{ref:n,className:"Bear-RichEditor__dropdown relative",children:[r.jsxs("button",{type:"button",title:b,disabled:c,onClick:()=>t(!u),className:h.cn("Bear-RichEditor__dropdown-trigger",s.RICH_EDITOR_BUTTON_BASE_CLASSES,s.RICH_EDITOR_BUTTON_INACTIVE_CLASSES,"flex items-center gap-1 min-w-[80px]",c&&`Bear-RichEditor__dropdown-trigger--disabled ${s.RICH_EDITOR_BUTTON_DISABLED_CLASSES}`),children:[l&&r.jsx("span",{className:"Bear-RichEditor__dropdown-icon",children:l}),r.jsx("span",{className:"Bear-RichEditor__dropdown-label text-xs truncate",children:(o==null?void 0:o.label)||"Normal"}),r.jsx(m,{})]}),u&&r.jsx("div",{className:"Bear-RichEditor__dropdown-menu absolute top-full left-0 mt-1 z-50 min-w-[140px] bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-lg py-1",children:a.map(e=>r.jsx("button",{type:"button",onClick:()=>g(e),className:h.cn("Bear-RichEditor__dropdown-option","w-full px-3 py-2 text-left text-sm transition-colors","hover:bg-gray-100 dark:hover:bg-zinc-700",e.value===d?"bg-pink-50 dark:bg-pink-900/20 text-pink-600 dark:text-pink-400":"text-gray-700 dark:text-gray-300"),children:e.preview||e.label},e.value))})]})};exports.ToolbarDropdown=w;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useRef as f, useEffect as w } from "react";
|
|
3
|
+
import { cn as p } from "../../../../utils/cn.js";
|
|
4
|
+
import { RICH_EDITOR_BUTTON_DISABLED_CLASSES as E, RICH_EDITOR_BUTTON_INACTIVE_CLASSES as v, RICH_EDITOR_BUTTON_BASE_CLASSES as x } from "../../RichEditor.const.js";
|
|
5
|
+
const k = () => /* @__PURE__ */ r("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M6 9l6 6 6-6" }) }), I = (u) => {
|
|
6
|
+
const { options: a, value: d, onChange: h, title: m, disabled: i, icon: l } = u, [s, t] = b(!1), o = f(null);
|
|
7
|
+
w(() => {
|
|
8
|
+
const e = (g) => {
|
|
9
|
+
o.current && !o.current.contains(g.target) && t(!1);
|
|
10
|
+
};
|
|
11
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
12
|
+
}, []);
|
|
13
|
+
const n = a.find((e) => e.value === d), _ = (e) => {
|
|
14
|
+
h(e.value), t(!1);
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ c("div", { ref: o, className: "Bear-RichEditor__dropdown relative", children: [
|
|
17
|
+
/* @__PURE__ */ c(
|
|
18
|
+
"button",
|
|
19
|
+
{
|
|
20
|
+
type: "button",
|
|
21
|
+
title: m,
|
|
22
|
+
disabled: i,
|
|
23
|
+
onClick: () => t(!s),
|
|
24
|
+
className: p(
|
|
25
|
+
"Bear-RichEditor__dropdown-trigger",
|
|
26
|
+
x,
|
|
27
|
+
v,
|
|
28
|
+
"flex items-center gap-1 min-w-[80px]",
|
|
29
|
+
i && `Bear-RichEditor__dropdown-trigger--disabled ${E}`
|
|
30
|
+
),
|
|
31
|
+
children: [
|
|
32
|
+
l && /* @__PURE__ */ r("span", { className: "Bear-RichEditor__dropdown-icon", children: l }),
|
|
33
|
+
/* @__PURE__ */ r("span", { className: "Bear-RichEditor__dropdown-label text-xs truncate", children: (n == null ? void 0 : n.label) || "Normal" }),
|
|
34
|
+
/* @__PURE__ */ r(k, {})
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
s && /* @__PURE__ */ r("div", { className: "Bear-RichEditor__dropdown-menu absolute top-full left-0 mt-1 z-50 min-w-[140px] bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-lg py-1", children: a.map((e) => /* @__PURE__ */ r(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: "button",
|
|
42
|
+
onClick: () => _(e),
|
|
43
|
+
className: p(
|
|
44
|
+
"Bear-RichEditor__dropdown-option",
|
|
45
|
+
"w-full px-3 py-2 text-left text-sm transition-colors",
|
|
46
|
+
"hover:bg-gray-100 dark:hover:bg-zinc-700",
|
|
47
|
+
e.value === d ? "bg-pink-50 dark:bg-pink-900/20 text-pink-600 dark:text-pink-400" : "text-gray-700 dark:text-gray-300"
|
|
48
|
+
),
|
|
49
|
+
children: e.preview || e.label
|
|
50
|
+
},
|
|
51
|
+
e.value
|
|
52
|
+
)) })
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
I as ToolbarDropdown
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ToolbarDropdown, default } from './ToolbarDropdown';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),d=require("../../../../utils/cn.cjs"),o=require("../../RichEditor.const.cjs"),u=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),_=({children:l,disabled:i})=>{const[r,s]=n.useState(!1),t=n.useRef(null);return n.useEffect(()=>{const c=a=>{t.current&&!t.current.contains(a.target)&&s(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),e.jsxs("div",{ref:t,className:"Bear-RichEditor__more relative",children:[e.jsx("button",{type:"button",title:"More options",disabled:i,onClick:()=>s(!r),className:d.cn("Bear-RichEditor__more-trigger",o.RICH_EDITOR_BUTTON_BASE_CLASSES,o.RICH_EDITOR_BUTTON_INACTIVE_CLASSES,"flex items-center justify-center",r&&"bg-pink-500 text-white",i&&`Bear-RichEditor__more-trigger--disabled ${o.RICH_EDITOR_BUTTON_DISABLED_CLASSES}`),children:e.jsx(u,{})}),r&&e.jsx("div",{className:"Bear-RichEditor__more-menu absolute top-full right-0 mt-1 p-2 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl z-50 min-w-[200px]",children:e.jsx("div",{className:"flex flex-wrap items-center gap-0.5",children:l})})]})};exports.ToolbarMore=_;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a, useRef as d, useEffect as m } from "react";
|
|
3
|
+
import { cn as u } from "../../../../utils/cn.js";
|
|
4
|
+
import { RICH_EDITOR_BUTTON_DISABLED_CLASSES as _, RICH_EDITOR_BUTTON_INACTIVE_CLASSES as f, RICH_EDITOR_BUTTON_BASE_CLASSES as h } from "../../RichEditor.const.js";
|
|
5
|
+
const E = () => /* @__PURE__ */ s("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
6
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
7
|
+
/* @__PURE__ */ e("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
8
|
+
] }), S = ({ children: c, disabled: o }) => {
|
|
9
|
+
const [r, i] = a(!1), t = d(null);
|
|
10
|
+
return m(() => {
|
|
11
|
+
const n = (l) => {
|
|
12
|
+
t.current && !t.current.contains(l.target) && i(!1);
|
|
13
|
+
};
|
|
14
|
+
return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
15
|
+
}, []), /* @__PURE__ */ s("div", { ref: t, className: "Bear-RichEditor__more relative", children: [
|
|
16
|
+
/* @__PURE__ */ e(
|
|
17
|
+
"button",
|
|
18
|
+
{
|
|
19
|
+
type: "button",
|
|
20
|
+
title: "More options",
|
|
21
|
+
disabled: o,
|
|
22
|
+
onClick: () => i(!r),
|
|
23
|
+
className: u(
|
|
24
|
+
"Bear-RichEditor__more-trigger",
|
|
25
|
+
h,
|
|
26
|
+
f,
|
|
27
|
+
"flex items-center justify-center",
|
|
28
|
+
r && "bg-pink-500 text-white",
|
|
29
|
+
o && `Bear-RichEditor__more-trigger--disabled ${_}`
|
|
30
|
+
),
|
|
31
|
+
children: /* @__PURE__ */ e(E, {})
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
r && /* @__PURE__ */ e(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: "Bear-RichEditor__more-menu absolute top-full right-0 mt-1 p-2 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl z-50 min-w-[200px]",
|
|
38
|
+
children: /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-0.5", children: c })
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
S as ToolbarMore
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(t,n)=>document.execCommand(t,!1,n),e=t=>document.queryCommandState(t),s=t=>document.queryCommandValue(t),d=t=>{if(!t)return!1;const n=t.startsWith("http://")||t.startsWith("https://")||t.startsWith("mailto:")?t:`https://${t}`;return r("createLink",n)},m=t=>t?r("foreColor",t):r("removeFormat"),l=t=>t?r("hiliteColor",t):r("removeFormat"),u=()=>{const t=new Set;return e("bold")&&t.add("bold"),e("italic")&&t.add("italic"),e("underline")&&t.add("underline"),e("strikeThrough")&&t.add("strikethrough"),e("insertUnorderedList")&&t.add("bulletList"),e("insertOrderedList")&&t.add("orderedList"),t},a=t=>r("insertHTML",t),c=(t,n)=>{const i=`<img src="${t}" alt="" style="max-width: 100%; height: auto;" />`;return a(i)},h=t=>new Promise((n,i)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=i,o.readAsDataURL(t)});exports.execCommand=r;exports.fileToDataUrl=h;exports.getActiveFormats=u;exports.insertHTML=a;exports.insertImage=c;exports.insertLink=d;exports.queryCommandState=e;exports.queryCommandValue=s;exports.setHighlightColor=l;exports.setTextColor=m;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ToolbarOption } from '../RichEditor.types';
|
|
2
|
+
/**
|
|
3
|
+
* Execute a document command for rich text editing
|
|
4
|
+
*/
|
|
5
|
+
export declare const execCommand: (command: string, value?: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Query the state of a document command
|
|
8
|
+
*/
|
|
9
|
+
export declare const queryCommandState: (command: string) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Query the value of a document command
|
|
12
|
+
*/
|
|
13
|
+
export declare const queryCommandValue: (command: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Get current block format (p, h1, h2, etc.)
|
|
16
|
+
*/
|
|
17
|
+
export declare const getCurrentBlockFormat: () => string;
|
|
18
|
+
/**
|
|
19
|
+
* Apply a format command based on toolbar option
|
|
20
|
+
*/
|
|
21
|
+
export declare const applyFormat: (format: ToolbarOption, editorRef?: React.RefObject<HTMLDivElement>) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Insert a link at current selection
|
|
24
|
+
*/
|
|
25
|
+
export declare const insertLink: (url: string) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Remove link from current selection
|
|
28
|
+
*/
|
|
29
|
+
export declare const removeLink: () => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Set text color
|
|
32
|
+
*/
|
|
33
|
+
export declare const setTextColor: (color: string) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Set background/highlight color
|
|
36
|
+
*/
|
|
37
|
+
export declare const setHighlightColor: (color: string) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get active formats from current selection
|
|
40
|
+
*/
|
|
41
|
+
export declare const getActiveFormats: () => Set<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Insert HTML at current cursor position
|
|
44
|
+
*/
|
|
45
|
+
export declare const insertHTML: (html: string) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Insert image at current cursor position
|
|
48
|
+
*/
|
|
49
|
+
export declare const insertImage: (src: string, alt?: string) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Convert file to base64 data URL
|
|
52
|
+
*/
|
|
53
|
+
export declare const fileToDataUrl: (file: File) => Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Handle paste event to process images
|
|
56
|
+
*/
|
|
57
|
+
export declare const handlePasteImages: (event: ClipboardEvent) => Promise<string[]>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const n = (t, e) => document.execCommand(t, !1, e), r = (t) => document.queryCommandState(t), a = (t) => document.queryCommandValue(t), d = (t) => {
|
|
2
|
+
if (!t) return !1;
|
|
3
|
+
const e = t.startsWith("http://") || t.startsWith("https://") || t.startsWith("mailto:") ? t : `https://${t}`;
|
|
4
|
+
return n("createLink", e);
|
|
5
|
+
}, m = (t) => t ? n("foreColor", t) : n("removeFormat"), u = (t) => t ? n("hiliteColor", t) : n("removeFormat"), c = () => {
|
|
6
|
+
const t = /* @__PURE__ */ new Set();
|
|
7
|
+
return r("bold") && t.add("bold"), r("italic") && t.add("italic"), r("underline") && t.add("underline"), r("strikeThrough") && t.add("strikethrough"), r("insertUnorderedList") && t.add("bulletList"), r("insertOrderedList") && t.add("orderedList"), t;
|
|
8
|
+
}, s = (t) => n("insertHTML", t), l = (t, e) => {
|
|
9
|
+
const i = `<img src="${t}" alt="" style="max-width: 100%; height: auto;" />`;
|
|
10
|
+
return s(i);
|
|
11
|
+
}, h = (t) => new Promise((e, i) => {
|
|
12
|
+
const o = new FileReader();
|
|
13
|
+
o.onload = () => e(o.result), o.onerror = i, o.readAsDataURL(t);
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
n as execCommand,
|
|
17
|
+
h as fileToDataUrl,
|
|
18
|
+
c as getActiveFormats,
|
|
19
|
+
s as insertHTML,
|
|
20
|
+
l as insertImage,
|
|
21
|
+
d as insertLink,
|
|
22
|
+
r as queryCommandState,
|
|
23
|
+
a as queryCommandValue,
|
|
24
|
+
u as setHighlightColor,
|
|
25
|
+
m as setTextColor
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { execCommand, queryCommandState, queryCommandValue, getCurrentBlockFormat, applyFormat, insertLink, removeLink, setTextColor, setHighlightColor, getActiveFormats, insertHTML, insertImage, fileToDataUrl, handlePasteImages, } from './formatHelpers';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../utils/cn.cjs"),s=require("../Icon/index.cjs"),R=require("./components/SidebarItem/SidebarItem.cjs"),a=require("./Sidebar.const.cjs"),D=S=>{const{items:b,collapsed:r=!1,onCollapsedChange:n,width:_=a.SIDEBAR_WIDTH,collapsedWidth:I=a.SIDEBAR_COLLAPSED_WIDTH,header:o,footer:c,activeItemId:E,onItemClick:h,variant:t="default",position:l="left",className:u,style:A,testId:C,id:f}=S,x=r?I:_,B=l==="left"?"bear-border-r":"bear-border-l";return e.jsxs("aside",{id:f,"data-testid":C,className:i.cn("Bear-Sidebar",`Bear-Sidebar--${t}`,r&&"Bear-Sidebar--collapsed","bear-flex bear-flex-col bear-h-full bear-transition-all bear-duration-300",t==="default"&&B,a.SIDEBAR_VARIANT_STYLES[t],u),style:{width:x,...A},children:[o&&e.jsxs("div",{className:i.cn("Bear-Sidebar__header",a.SIDEBAR_HEADER_CLASSES),children:[!r&&o,n&&e.jsx("button",{type:"button",onClick:()=>n(!r),className:i.cn("Bear-Sidebar__toggle",a.SIDEBAR_TOGGLE_CLASSES),"aria-label":r?"Expand sidebar":"Collapse sidebar",children:r?l==="left"?e.jsx(s.ChevronRightIcon,{size:a.SIDEBAR_TOGGLE_ICON_SIZE}):e.jsx(s.ChevronLeftIcon,{size:a.SIDEBAR_TOGGLE_ICON_SIZE}):l==="left"?e.jsx(s.ChevronLeftIcon,{size:a.SIDEBAR_TOGGLE_ICON_SIZE}):e.jsx(s.ChevronRightIcon,{size:a.SIDEBAR_TOGGLE_ICON_SIZE})})]}),e.jsx("nav",{className:"Bear-Sidebar__nav bear-flex-1 bear-overflow-y-auto bear-px-2 bear-py-3 bear-space-y-1",children:b.map(d=>e.jsx(R.SidebarItem,{item:d,isActive:d.id===E,collapsed:r,onClick:h},d.id))}),c&&e.jsx("div",{className:i.cn("Bear-Sidebar__footer",a.SIDEBAR_FOOTER_CLASSES),children:r?null:c})]})};exports.Sidebar=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=256,r=64,a=16,b=12,S=14,E=18,t={default:"bear-bg-white dark:bear-bg-zinc-900 bear-border-zinc-200 dark:bear-border-zinc-700",bordered:"bear-bg-white dark:bear-bg-zinc-900 bear-border-2 bear-border-zinc-300 dark:bear-border-zinc-600 bear-rounded-xl bear-m-2",floating:"bear-bg-white/95 dark:bear-bg-zinc-900/95 bear-backdrop-blur-sm bear-shadow-2xl bear-rounded-xl bear-m-3"},_="bear-flex bear-items-center bear-gap-3 bear-py-2.5 bear-px-3 bear-rounded-lg bear-text-sm bear-transition-all bear-duration-200 bear-cursor-pointer",A="bear-bg-pink-500 bear-text-white bear-shadow-md",I="bear-text-zinc-600 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-900 dark:hover:bear-text-zinc-100",n="bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none",o="bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-zinc-400 dark:bear-text-zinc-500",c="bear-px-3 bear-py-4 bear-border-b bear-border-zinc-100 dark:bear-border-zinc-800 bear-flex bear-items-center bear-justify-between",D="bear-px-3 bear-py-3 bear-border-t bear-border-zinc-100 dark:bear-border-zinc-800 bear-mt-auto",i="bear-p-1.5 bear-rounded-lg bear-text-zinc-400 dark:bear-text-zinc-500 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-600 dark:hover:bear-text-zinc-300 bear-transition-colors";exports.SIDEBAR_COLLAPSED_WIDTH=r;exports.SIDEBAR_DEPTH_INDENT=b;exports.SIDEBAR_FOOTER_CLASSES=D;exports.SIDEBAR_GROUP_TITLE_CLASSES=o;exports.SIDEBAR_HEADER_CLASSES=c;exports.SIDEBAR_ICON_SIZE=S;exports.SIDEBAR_ITEM_ACTIVE_CLASSES=A;exports.SIDEBAR_ITEM_BASE_CLASSES=_;exports.SIDEBAR_ITEM_DISABLED_CLASSES=n;exports.SIDEBAR_ITEM_INACTIVE_CLASSES=I;exports.SIDEBAR_PADDING_BASE=a;exports.SIDEBAR_TOGGLE_CLASSES=i;exports.SIDEBAR_TOGGLE_ICON_SIZE=E;exports.SIDEBAR_VARIANT_STYLES=t;exports.SIDEBAR_WIDTH=e;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SidebarVariant } from './Sidebar.types';
|
|
2
|
+
export declare const SIDEBAR_WIDTH = 256;
|
|
3
|
+
export declare const SIDEBAR_COLLAPSED_WIDTH = 64;
|
|
4
|
+
export declare const SIDEBAR_PADDING_BASE = 16;
|
|
5
|
+
export declare const SIDEBAR_DEPTH_INDENT = 12;
|
|
6
|
+
export declare const SIDEBAR_ICON_SIZE = 14;
|
|
7
|
+
export declare const SIDEBAR_TOGGLE_ICON_SIZE = 18;
|
|
8
|
+
export declare const SIDEBAR_VARIANT_STYLES: Record<SidebarVariant, string>;
|
|
9
|
+
export declare const SIDEBAR_ITEM_BASE_CLASSES = "bear-flex bear-items-center bear-gap-3 bear-py-2.5 bear-px-3 bear-rounded-lg bear-text-sm bear-transition-all bear-duration-200 bear-cursor-pointer";
|
|
10
|
+
export declare const SIDEBAR_ITEM_ACTIVE_CLASSES = "bear-bg-pink-500 bear-text-white bear-shadow-md";
|
|
11
|
+
export declare const SIDEBAR_ITEM_INACTIVE_CLASSES = "bear-text-zinc-600 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-900 dark:hover:bear-text-zinc-100";
|
|
12
|
+
export declare const SIDEBAR_ITEM_DISABLED_CLASSES = "bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none";
|
|
13
|
+
export declare const SIDEBAR_GROUP_TITLE_CLASSES = "bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-zinc-400 dark:bear-text-zinc-500";
|
|
14
|
+
export declare const SIDEBAR_HEADER_CLASSES = "bear-px-3 bear-py-4 bear-border-b bear-border-zinc-100 dark:bear-border-zinc-800 bear-flex bear-items-center bear-justify-between";
|
|
15
|
+
export declare const SIDEBAR_FOOTER_CLASSES = "bear-px-3 bear-py-3 bear-border-t bear-border-zinc-100 dark:bear-border-zinc-800 bear-mt-auto";
|
|
16
|
+
export declare const SIDEBAR_TOGGLE_CLASSES = "bear-p-1.5 bear-rounded-lg bear-text-zinc-400 dark:bear-text-zinc-500 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-600 dark:hover:bear-text-zinc-300 bear-transition-colors";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const e = 256, r = 64, a = 16, b = 12, t = 14, n = 18, o = {
|
|
2
|
+
default: "bear-bg-white dark:bear-bg-zinc-900 bear-border-zinc-200 dark:bear-border-zinc-700",
|
|
3
|
+
bordered: "bear-bg-white dark:bear-bg-zinc-900 bear-border-2 bear-border-zinc-300 dark:bear-border-zinc-600 bear-rounded-xl bear-m-2",
|
|
4
|
+
floating: "bear-bg-white/95 dark:bear-bg-zinc-900/95 bear-backdrop-blur-sm bear-shadow-2xl bear-rounded-xl bear-m-3"
|
|
5
|
+
}, c = "bear-flex bear-items-center bear-gap-3 bear-py-2.5 bear-px-3 bear-rounded-lg bear-text-sm bear-transition-all bear-duration-200 bear-cursor-pointer", S = "bear-bg-pink-500 bear-text-white bear-shadow-md", i = "bear-text-zinc-600 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-900 dark:hover:bear-text-zinc-100", d = "bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none", E = "bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-zinc-400 dark:bear-text-zinc-500", _ = "bear-px-3 bear-py-4 bear-border-b bear-border-zinc-100 dark:bear-border-zinc-800 bear-flex bear-items-center bear-justify-between", A = "bear-px-3 bear-py-3 bear-border-t bear-border-zinc-100 dark:bear-border-zinc-800 bear-mt-auto", I = "bear-p-1.5 bear-rounded-lg bear-text-zinc-400 dark:bear-text-zinc-500 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 hover:bear-text-zinc-600 dark:hover:bear-text-zinc-300 bear-transition-colors";
|
|
6
|
+
export {
|
|
7
|
+
r as SIDEBAR_COLLAPSED_WIDTH,
|
|
8
|
+
b as SIDEBAR_DEPTH_INDENT,
|
|
9
|
+
A as SIDEBAR_FOOTER_CLASSES,
|
|
10
|
+
E as SIDEBAR_GROUP_TITLE_CLASSES,
|
|
11
|
+
_ as SIDEBAR_HEADER_CLASSES,
|
|
12
|
+
t as SIDEBAR_ICON_SIZE,
|
|
13
|
+
S as SIDEBAR_ITEM_ACTIVE_CLASSES,
|
|
14
|
+
c as SIDEBAR_ITEM_BASE_CLASSES,
|
|
15
|
+
d as SIDEBAR_ITEM_DISABLED_CLASSES,
|
|
16
|
+
i as SIDEBAR_ITEM_INACTIVE_CLASSES,
|
|
17
|
+
a as SIDEBAR_PADDING_BASE,
|
|
18
|
+
I as SIDEBAR_TOGGLE_CLASSES,
|
|
19
|
+
n as SIDEBAR_TOGGLE_ICON_SIZE,
|
|
20
|
+
o as SIDEBAR_VARIANT_STYLES,
|
|
21
|
+
e as SIDEBAR_WIDTH
|
|
22
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { SidebarProps } from './Sidebar.types';
|
|
3
|
+
/**
|
|
4
|
+
* Sidebar - Collapsible navigation sidebar with nested items
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Sidebar
|
|
9
|
+
* items={items}
|
|
10
|
+
* activeItemId={active}
|
|
11
|
+
* onItemClick={(item) => setActive(item.id)}
|
|
12
|
+
* header={<span>My App</span>}
|
|
13
|
+
* />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const Sidebar: FC<SidebarProps>;
|
|
17
|
+
export default Sidebar;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsxs as S, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as r } from "../../utils/cn.js";
|
|
3
|
+
import { ChevronRightIcon as b, ChevronLeftIcon as c } from "../Icon/index.js";
|
|
4
|
+
import { SidebarItem as u } from "./components/SidebarItem/SidebarItem.js";
|
|
5
|
+
import { SIDEBAR_WIDTH as v, SIDEBAR_COLLAPSED_WIDTH as L, SIDEBAR_TOGGLE_ICON_SIZE as i, SIDEBAR_TOGGLE_CLASSES as x, SIDEBAR_HEADER_CLASSES as N, SIDEBAR_FOOTER_CLASSES as T, SIDEBAR_VARIANT_STYLES as y } from "./Sidebar.const.js";
|
|
6
|
+
const k = (_) => {
|
|
7
|
+
const {
|
|
8
|
+
items: f,
|
|
9
|
+
collapsed: e = !1,
|
|
10
|
+
onCollapsedChange: d,
|
|
11
|
+
width: m = v,
|
|
12
|
+
collapsedWidth: E = L,
|
|
13
|
+
header: s,
|
|
14
|
+
footer: n,
|
|
15
|
+
activeItemId: I,
|
|
16
|
+
onItemClick: p,
|
|
17
|
+
variant: t = "default",
|
|
18
|
+
position: l = "left",
|
|
19
|
+
className: h,
|
|
20
|
+
style: A,
|
|
21
|
+
testId: B,
|
|
22
|
+
id: C
|
|
23
|
+
} = _, D = e ? E : m, R = l === "left" ? "bear-border-r" : "bear-border-l";
|
|
24
|
+
return /* @__PURE__ */ S(
|
|
25
|
+
"aside",
|
|
26
|
+
{
|
|
27
|
+
id: C,
|
|
28
|
+
"data-testid": B,
|
|
29
|
+
className: r(
|
|
30
|
+
"Bear-Sidebar",
|
|
31
|
+
`Bear-Sidebar--${t}`,
|
|
32
|
+
e && "Bear-Sidebar--collapsed",
|
|
33
|
+
"bear-flex bear-flex-col bear-h-full bear-transition-all bear-duration-300",
|
|
34
|
+
t === "default" && R,
|
|
35
|
+
y[t],
|
|
36
|
+
h
|
|
37
|
+
),
|
|
38
|
+
style: { width: D, ...A },
|
|
39
|
+
children: [
|
|
40
|
+
s && /* @__PURE__ */ S("div", { className: r("Bear-Sidebar__header", N), children: [
|
|
41
|
+
!e && s,
|
|
42
|
+
d && /* @__PURE__ */ a(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
onClick: () => d(!e),
|
|
47
|
+
className: r("Bear-Sidebar__toggle", x),
|
|
48
|
+
"aria-label": e ? "Expand sidebar" : "Collapse sidebar",
|
|
49
|
+
children: e ? l === "left" ? /* @__PURE__ */ a(b, { size: i }) : /* @__PURE__ */ a(c, { size: i }) : l === "left" ? /* @__PURE__ */ a(c, { size: i }) : /* @__PURE__ */ a(b, { size: i })
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ a("nav", { className: "Bear-Sidebar__nav bear-flex-1 bear-overflow-y-auto bear-px-2 bear-py-3 bear-space-y-1", children: f.map((o) => /* @__PURE__ */ a(
|
|
54
|
+
u,
|
|
55
|
+
{
|
|
56
|
+
item: o,
|
|
57
|
+
isActive: o.id === I,
|
|
58
|
+
collapsed: e,
|
|
59
|
+
onClick: p
|
|
60
|
+
},
|
|
61
|
+
o.id
|
|
62
|
+
)) }),
|
|
63
|
+
n && /* @__PURE__ */ a("div", { className: r("Bear-Sidebar__footer", T), children: e ? null : n })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
k as Sidebar
|
|
70
|
+
};
|