@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,279 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
const a = 150, o = [
|
|
3
|
+
"headingDropdown",
|
|
4
|
+
"divider",
|
|
5
|
+
"bold",
|
|
6
|
+
"italic",
|
|
7
|
+
"underline",
|
|
8
|
+
"strikethrough",
|
|
9
|
+
"divider",
|
|
10
|
+
"textColor",
|
|
11
|
+
"highlightColor",
|
|
12
|
+
"divider",
|
|
13
|
+
"alignLeft",
|
|
14
|
+
"alignCenter",
|
|
15
|
+
"alignRight",
|
|
16
|
+
"alignJustify",
|
|
17
|
+
"divider",
|
|
18
|
+
"bulletList",
|
|
19
|
+
"orderedList",
|
|
20
|
+
"divider",
|
|
21
|
+
"indent",
|
|
22
|
+
"outdent",
|
|
23
|
+
"divider",
|
|
24
|
+
"blockquote",
|
|
25
|
+
"code",
|
|
26
|
+
"link",
|
|
27
|
+
"image",
|
|
28
|
+
"divider",
|
|
29
|
+
"clearFormat"
|
|
30
|
+
], r = "Bear-RichEditor rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden bg-white dark:bg-zinc-900 shadow-sm", i = "flex flex-wrap items-center gap-0.5 p-2 border-b border-gray-200 dark:border-zinc-700 bg-gray-50 dark:bg-zinc-800", n = "p-4 outline-none max-w-none text-gray-900 dark:text-gray-100 bg-white dark:bg-zinc-900 min-h-[100px]", d = "w-px h-5 bg-gray-300 dark:bg-zinc-600 mx-1", l = "p-1.5 rounded transition-colors", c = "bg-pink-500 text-white", m = "text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-zinc-700", g = "opacity-50 cursor-not-allowed", s = [
|
|
31
|
+
{ value: "p", label: "Paragraph", preview: /* @__PURE__ */ e("span", { className: "bear-text-sm bear-font-normal", children: "Normal text" }) },
|
|
32
|
+
{ value: "h1", label: "Heading 1", preview: /* @__PURE__ */ e("span", { className: "bear-text-2xl bear-font-bold", children: "Heading 1" }) },
|
|
33
|
+
{ value: "h2", label: "Heading 2", preview: /* @__PURE__ */ e("span", { className: "bear-text-xl bear-font-bold", children: "Heading 2" }) },
|
|
34
|
+
{ value: "h3", label: "Heading 3", preview: /* @__PURE__ */ e("span", { className: "bear-text-lg bear-font-semibold", children: "Heading 3" }) },
|
|
35
|
+
{ value: "h4", label: "Heading 4", preview: /* @__PURE__ */ e("span", { className: "bear-text-base bear-font-semibold", children: "Heading 4" }) },
|
|
36
|
+
{ value: "h5", label: "Heading 5", preview: /* @__PURE__ */ e("span", { className: "bear-text-sm bear-font-semibold", children: "Heading 5" }) },
|
|
37
|
+
{ value: "h6", label: "Heading 6", preview: /* @__PURE__ */ e("span", { className: "bear-text-xs bear-font-semibold bear-uppercase", children: "Heading 6" }) }
|
|
38
|
+
], h = {
|
|
39
|
+
bold: { title: "Bold (Ctrl+B)", command: "bold" },
|
|
40
|
+
italic: { title: "Italic (Ctrl+I)", command: "italic" },
|
|
41
|
+
underline: { title: "Underline (Ctrl+U)", command: "underline" },
|
|
42
|
+
strikethrough: { title: "Strikethrough", command: "strikeThrough" },
|
|
43
|
+
heading1: { title: "Heading 1", command: "formatBlock", value: "h1" },
|
|
44
|
+
heading2: { title: "Heading 2", command: "formatBlock", value: "h2" },
|
|
45
|
+
heading3: { title: "Heading 3", command: "formatBlock", value: "h3" },
|
|
46
|
+
heading4: { title: "Heading 4", command: "formatBlock", value: "h4" },
|
|
47
|
+
heading5: { title: "Heading 5", command: "formatBlock", value: "h5" },
|
|
48
|
+
heading6: { title: "Heading 6", command: "formatBlock", value: "h6" },
|
|
49
|
+
paragraph: { title: "Paragraph", command: "formatBlock", value: "p" },
|
|
50
|
+
bulletList: { title: "Bullet List", command: "insertUnorderedList" },
|
|
51
|
+
orderedList: { title: "Numbered List", command: "insertOrderedList" },
|
|
52
|
+
blockquote: { title: "Quote", command: "formatBlock", value: "blockquote" },
|
|
53
|
+
code: { title: "Code Block", command: "formatBlock", value: "pre" },
|
|
54
|
+
link: { title: "Insert Link", command: "createLink" },
|
|
55
|
+
image: { title: "Insert Image", command: "insertImage" },
|
|
56
|
+
textColor: { title: "Text Color", command: "foreColor" },
|
|
57
|
+
highlightColor: { title: "Highlight Color", command: "hiliteColor" },
|
|
58
|
+
alignLeft: { title: "Align Left", command: "justifyLeft" },
|
|
59
|
+
alignCenter: { title: "Align Center", command: "justifyCenter" },
|
|
60
|
+
alignRight: { title: "Align Right", command: "justifyRight" },
|
|
61
|
+
alignJustify: { title: "Justify", command: "justifyFull" },
|
|
62
|
+
indent: { title: "Increase Indent", command: "indent" },
|
|
63
|
+
outdent: { title: "Decrease Indent", command: "outdent" },
|
|
64
|
+
clearFormat: { title: "Clear Formatting", command: "removeFormat" },
|
|
65
|
+
table: { title: "Insert Table", command: "insertTable" }
|
|
66
|
+
}, b = [
|
|
67
|
+
// Row 1: Grayscale
|
|
68
|
+
"#000000",
|
|
69
|
+
"#374151",
|
|
70
|
+
"#6b7280",
|
|
71
|
+
"#9ca3af",
|
|
72
|
+
"#d1d5db",
|
|
73
|
+
"#ffffff",
|
|
74
|
+
// Row 2: Reds
|
|
75
|
+
"#991b1b",
|
|
76
|
+
"#dc2626",
|
|
77
|
+
"#ef4444",
|
|
78
|
+
"#f87171",
|
|
79
|
+
"#fca5a5",
|
|
80
|
+
"#fee2e2",
|
|
81
|
+
// Row 3: Oranges
|
|
82
|
+
"#9a3412",
|
|
83
|
+
"#ea580c",
|
|
84
|
+
"#f97316",
|
|
85
|
+
"#fb923c",
|
|
86
|
+
"#fdba74",
|
|
87
|
+
"#fed7aa",
|
|
88
|
+
// Row 4: Yellows
|
|
89
|
+
"#854d0e",
|
|
90
|
+
"#ca8a04",
|
|
91
|
+
"#eab308",
|
|
92
|
+
"#facc15",
|
|
93
|
+
"#fde047",
|
|
94
|
+
"#fef08a",
|
|
95
|
+
// Row 5: Greens
|
|
96
|
+
"#166534",
|
|
97
|
+
"#16a34a",
|
|
98
|
+
"#22c55e",
|
|
99
|
+
"#4ade80",
|
|
100
|
+
"#86efac",
|
|
101
|
+
"#bbf7d0",
|
|
102
|
+
// Row 6: Blues
|
|
103
|
+
"#1e40af",
|
|
104
|
+
"#2563eb",
|
|
105
|
+
"#3b82f6",
|
|
106
|
+
"#60a5fa",
|
|
107
|
+
"#93c5fd",
|
|
108
|
+
"#bfdbfe",
|
|
109
|
+
// Row 7: Purples
|
|
110
|
+
"#6b21a8",
|
|
111
|
+
"#9333ea",
|
|
112
|
+
"#a855f7",
|
|
113
|
+
"#c084fc",
|
|
114
|
+
"#d8b4fe",
|
|
115
|
+
"#e9d5ff",
|
|
116
|
+
// Row 8: Pinks
|
|
117
|
+
"#9d174d",
|
|
118
|
+
"#db2777",
|
|
119
|
+
"#ec4899",
|
|
120
|
+
"#f472b6",
|
|
121
|
+
"#f9a8d4",
|
|
122
|
+
"#fbcfe8"
|
|
123
|
+
], f = `
|
|
124
|
+
.Bear-RichEditor__content {
|
|
125
|
+
line-height: 1.6;
|
|
126
|
+
}
|
|
127
|
+
.Bear-RichEditor__content h1 {
|
|
128
|
+
font-size: 2rem;
|
|
129
|
+
font-weight: bold;
|
|
130
|
+
margin: 0.67em 0;
|
|
131
|
+
line-height: 1.2;
|
|
132
|
+
}
|
|
133
|
+
.Bear-RichEditor__content h2 {
|
|
134
|
+
font-size: 1.5rem;
|
|
135
|
+
font-weight: bold;
|
|
136
|
+
margin: 0.83em 0;
|
|
137
|
+
line-height: 1.3;
|
|
138
|
+
}
|
|
139
|
+
.Bear-RichEditor__content h3 {
|
|
140
|
+
font-size: 1.25rem;
|
|
141
|
+
font-weight: 600;
|
|
142
|
+
margin: 1em 0;
|
|
143
|
+
line-height: 1.4;
|
|
144
|
+
}
|
|
145
|
+
.Bear-RichEditor__content h4 {
|
|
146
|
+
font-size: 1.125rem;
|
|
147
|
+
font-weight: 600;
|
|
148
|
+
margin: 1.33em 0;
|
|
149
|
+
}
|
|
150
|
+
.Bear-RichEditor__content h5 {
|
|
151
|
+
font-size: 1rem;
|
|
152
|
+
font-weight: 600;
|
|
153
|
+
margin: 1.67em 0;
|
|
154
|
+
}
|
|
155
|
+
.Bear-RichEditor__content h6 {
|
|
156
|
+
font-size: 0.875rem;
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
text-transform: uppercase;
|
|
159
|
+
letter-spacing: 0.05em;
|
|
160
|
+
margin: 2em 0;
|
|
161
|
+
}
|
|
162
|
+
.Bear-RichEditor__content p {
|
|
163
|
+
margin: 0.5em 0;
|
|
164
|
+
}
|
|
165
|
+
.Bear-RichEditor__content ul {
|
|
166
|
+
list-style-type: disc !important;
|
|
167
|
+
padding-left: 1.5em !important;
|
|
168
|
+
margin: 0.5em 0 !important;
|
|
169
|
+
display: block !important;
|
|
170
|
+
}
|
|
171
|
+
.Bear-RichEditor__content ol {
|
|
172
|
+
list-style-type: decimal !important;
|
|
173
|
+
padding-left: 1.5em !important;
|
|
174
|
+
margin: 0.5em 0 !important;
|
|
175
|
+
display: block !important;
|
|
176
|
+
}
|
|
177
|
+
.Bear-RichEditor__content li {
|
|
178
|
+
margin: 0.25em 0 !important;
|
|
179
|
+
display: list-item !important;
|
|
180
|
+
}
|
|
181
|
+
.Bear-RichEditor__content blockquote {
|
|
182
|
+
border-left: 4px solid #ec4899;
|
|
183
|
+
padding-left: 1em;
|
|
184
|
+
margin: 1em 0;
|
|
185
|
+
color: #6b7280;
|
|
186
|
+
font-style: italic;
|
|
187
|
+
background: rgba(236, 72, 153, 0.05);
|
|
188
|
+
padding: 0.5em 1em;
|
|
189
|
+
border-radius: 0 0.375rem 0.375rem 0;
|
|
190
|
+
}
|
|
191
|
+
.Bear-RichEditor__content pre {
|
|
192
|
+
background: #f3f4f6;
|
|
193
|
+
color: #374151;
|
|
194
|
+
padding: 1em;
|
|
195
|
+
border-radius: 0.5rem;
|
|
196
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
197
|
+
font-size: 0.875em;
|
|
198
|
+
overflow-x: auto;
|
|
199
|
+
margin: 1em 0;
|
|
200
|
+
white-space: pre-wrap;
|
|
201
|
+
word-break: break-word;
|
|
202
|
+
border: 1px solid #e5e7eb;
|
|
203
|
+
}
|
|
204
|
+
.Bear-RichEditor__content code {
|
|
205
|
+
background: #f3f4f6;
|
|
206
|
+
color: #374151;
|
|
207
|
+
padding: 0.125em 0.25em;
|
|
208
|
+
border-radius: 0.25rem;
|
|
209
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
210
|
+
font-size: 0.875em;
|
|
211
|
+
}
|
|
212
|
+
.Bear-RichEditor__content a {
|
|
213
|
+
color: #ec4899;
|
|
214
|
+
text-decoration: underline;
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
}
|
|
217
|
+
.Bear-RichEditor__content a:hover {
|
|
218
|
+
color: #db2777;
|
|
219
|
+
}
|
|
220
|
+
.Bear-RichEditor__content img {
|
|
221
|
+
max-width: 100%;
|
|
222
|
+
height: auto;
|
|
223
|
+
border-radius: 0.5rem;
|
|
224
|
+
margin: 1em 0;
|
|
225
|
+
display: block;
|
|
226
|
+
}
|
|
227
|
+
.Bear-RichEditor__content table {
|
|
228
|
+
border-collapse: collapse;
|
|
229
|
+
width: 100%;
|
|
230
|
+
margin: 1em 0;
|
|
231
|
+
}
|
|
232
|
+
.Bear-RichEditor__content th,
|
|
233
|
+
.Bear-RichEditor__content td {
|
|
234
|
+
border: 1px solid #d1d5db;
|
|
235
|
+
padding: 0.5em;
|
|
236
|
+
text-align: left;
|
|
237
|
+
}
|
|
238
|
+
.Bear-RichEditor__content th {
|
|
239
|
+
background: #f3f4f6;
|
|
240
|
+
font-weight: 600;
|
|
241
|
+
}
|
|
242
|
+
/* Dark mode styles */
|
|
243
|
+
.dark .Bear-RichEditor__content pre {
|
|
244
|
+
background: #1f2937;
|
|
245
|
+
color: #e5e7eb;
|
|
246
|
+
border-color: #374151;
|
|
247
|
+
}
|
|
248
|
+
.dark .Bear-RichEditor__content code {
|
|
249
|
+
background: #374151;
|
|
250
|
+
color: #e5e7eb;
|
|
251
|
+
}
|
|
252
|
+
.dark .Bear-RichEditor__content blockquote {
|
|
253
|
+
color: #9ca3af;
|
|
254
|
+
background: rgba(236, 72, 153, 0.1);
|
|
255
|
+
}
|
|
256
|
+
.dark .Bear-RichEditor__content th {
|
|
257
|
+
background: #374151;
|
|
258
|
+
}
|
|
259
|
+
.dark .Bear-RichEditor__content th,
|
|
260
|
+
.dark .Bear-RichEditor__content td {
|
|
261
|
+
border-color: #4b5563;
|
|
262
|
+
}
|
|
263
|
+
`;
|
|
264
|
+
export {
|
|
265
|
+
c as RICH_EDITOR_BUTTON_ACTIVE_CLASSES,
|
|
266
|
+
l as RICH_EDITOR_BUTTON_BASE_CLASSES,
|
|
267
|
+
h as RICH_EDITOR_BUTTON_CONFIG,
|
|
268
|
+
g as RICH_EDITOR_BUTTON_DISABLED_CLASSES,
|
|
269
|
+
m as RICH_EDITOR_BUTTON_INACTIVE_CLASSES,
|
|
270
|
+
b as RICH_EDITOR_COLORS,
|
|
271
|
+
n as RICH_EDITOR_CONTENT_CLASSES,
|
|
272
|
+
f as RICH_EDITOR_CONTENT_STYLES,
|
|
273
|
+
o as RICH_EDITOR_DEFAULT_TOOLBAR,
|
|
274
|
+
d as RICH_EDITOR_DIVIDER_CLASSES,
|
|
275
|
+
s as RICH_EDITOR_HEADING_OPTIONS,
|
|
276
|
+
a as RICH_EDITOR_MIN_HEIGHT,
|
|
277
|
+
r as RICH_EDITOR_ROOT_CLASSES,
|
|
278
|
+
i as RICH_EDITOR_TOOLBAR_CLASSES
|
|
279
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RichEditorProps } from './RichEditor.types';
|
|
3
|
+
/**
|
|
4
|
+
* RichEditor - WYSIWYG rich text editor with formatting toolbar
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const [value, setValue] = useState('<p>Start editing...</p>');
|
|
9
|
+
*
|
|
10
|
+
* <RichEditor
|
|
11
|
+
* value={value}
|
|
12
|
+
* onChange={setValue}
|
|
13
|
+
* placeholder="Start typing..."
|
|
14
|
+
* />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const RichEditor: FC<RichEditorProps>;
|
|
18
|
+
export default RichEditor;
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { jsxs as me, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as pe, useState as C, useEffect as _, useCallback as d } from "react";
|
|
3
|
+
import { cn as b } from "../../utils/cn.js";
|
|
4
|
+
import { getActiveFormats as be, queryCommandValue as Re, execCommand as u, insertLink as Te, setTextColor as x, setHighlightColor as S, fileToDataUrl as v, insertImage as A } from "./helpers/formatHelpers.js";
|
|
5
|
+
import { RICH_EDITOR_MIN_HEIGHT as ye, RICH_EDITOR_DEFAULT_TOOLBAR as _e, RICH_EDITOR_CONTENT_STYLES as Ee, RICH_EDITOR_BUTTON_CONFIG as O, RICH_EDITOR_TOOLBAR_CLASSES as Le, RICH_EDITOR_CONTENT_CLASSES as ze, RICH_EDITOR_ROOT_CLASSES as He, RICH_EDITOR_DIVIDER_CLASSES as ke, RICH_EDITOR_HEADING_OPTIONS as xe } from "./RichEditor.const.js";
|
|
6
|
+
import { ToolbarButton as f } from "./components/ToolbarButton/ToolbarButton.js";
|
|
7
|
+
import { ToolbarDropdown as Se } from "./components/ToolbarDropdown/ToolbarDropdown.js";
|
|
8
|
+
import { ToolbarColorPicker as D } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
|
|
9
|
+
import { ToolbarMore as ve } from "./components/ToolbarMore/ToolbarMore.js";
|
|
10
|
+
import { TextIcon as Ae, InsertLinkIcon as B, InsertPhotoIcon as F, AlignLeftIcon as N, AlignCenterIcon as w, AlignRightIcon as U, AlignJustifyIcon as M, IndentIncreaseIcon as V, IndentDecreaseIcon as j, FormatClearIcon as J, TableIcon as Oe, CodeIcon as De, QuoteIcon as Be, ListNumberedIcon as Fe, ListBulletIcon as Ne, Heading3Icon as we, Heading2Icon as Ue, Heading1Icon as Me, StrikethroughIcon as Ve, UnderlineIcon as je, ItalicIcon as Je, BoldIcon as Pe } from "../Icon/icons/editor.js";
|
|
11
|
+
const qe = 6, nt = (P) => {
|
|
12
|
+
const {
|
|
13
|
+
value: I,
|
|
14
|
+
defaultValue: E = "",
|
|
15
|
+
onChange: R,
|
|
16
|
+
placeholder: q = "Start typing...",
|
|
17
|
+
disabled: i = !1,
|
|
18
|
+
readOnly: o = !1,
|
|
19
|
+
minHeight: T = ye,
|
|
20
|
+
maxHeight: m,
|
|
21
|
+
toolbar: L = _e,
|
|
22
|
+
className: G = "",
|
|
23
|
+
testId: $,
|
|
24
|
+
id: Y,
|
|
25
|
+
allowImagePaste: z = !0,
|
|
26
|
+
...K
|
|
27
|
+
} = P, a = pe(null), [Q, W] = C(/* @__PURE__ */ new Set()), [X, H] = C("p"), [Z, ee] = C("#000000"), [te, ne] = C("#fef08a"), [ie, oe] = C([]), [re, le] = C([]);
|
|
28
|
+
_(() => {
|
|
29
|
+
const e = "bear-rich-editor-styles";
|
|
30
|
+
if (!document.getElementById(e)) {
|
|
31
|
+
const n = document.createElement("style");
|
|
32
|
+
n.id = e, n.textContent = Ee, document.head.appendChild(n);
|
|
33
|
+
}
|
|
34
|
+
}, []), _(() => {
|
|
35
|
+
a.current && I !== void 0 && a.current.innerHTML !== I && (a.current.innerHTML = I);
|
|
36
|
+
}, [I]), _(() => {
|
|
37
|
+
a.current && E && !I && (a.current.innerHTML = E);
|
|
38
|
+
}, []);
|
|
39
|
+
const h = d(() => {
|
|
40
|
+
W(be());
|
|
41
|
+
const e = Re("formatBlock");
|
|
42
|
+
e && H(e.toLowerCase().replace(/[<>]/g, ""));
|
|
43
|
+
}, []), l = d(() => {
|
|
44
|
+
a.current && R && R(a.current.innerHTML), h();
|
|
45
|
+
}, [R, h]), ae = d((e) => {
|
|
46
|
+
var s;
|
|
47
|
+
if (i || o) return;
|
|
48
|
+
(s = a.current) == null || s.focus();
|
|
49
|
+
const n = O[e];
|
|
50
|
+
if (!n) return;
|
|
51
|
+
const c = "value" in n ? n.value : void 0;
|
|
52
|
+
c ? u(n.command, c) : u(n.command), h(), l();
|
|
53
|
+
}, [i, o, h, l]), se = d((e) => {
|
|
54
|
+
var n;
|
|
55
|
+
i || o || ((n = a.current) == null || n.focus(), u("formatBlock", e), H(e), l());
|
|
56
|
+
}, [i, o, l]), ce = d(() => {
|
|
57
|
+
var s;
|
|
58
|
+
if (i || o) return;
|
|
59
|
+
const e = window.getSelection(), n = e && e.toString().length > 0, c = prompt("Enter URL:", n ? "" : "https://");
|
|
60
|
+
c && ((s = a.current) == null || s.focus(), Te(c), l());
|
|
61
|
+
}, [i, o, l]), p = d((e, n) => {
|
|
62
|
+
if (!e) return;
|
|
63
|
+
(n === "text" ? oe : le)((s) => {
|
|
64
|
+
const r = s.filter((g) => g !== e);
|
|
65
|
+
return [e, ...r].slice(0, qe);
|
|
66
|
+
});
|
|
67
|
+
}, []), de = d((e) => {
|
|
68
|
+
var n;
|
|
69
|
+
i || o || ((n = a.current) == null || n.focus(), x(e), ee(e), p(e, "text"), l());
|
|
70
|
+
}, [i, o, l, p]), ue = d((e) => {
|
|
71
|
+
var n;
|
|
72
|
+
i || o || ((n = a.current) == null || n.focus(), S(e), ne(e), p(e, "highlight"), l());
|
|
73
|
+
}, [i, o, l, p]), fe = d((e) => {
|
|
74
|
+
var n;
|
|
75
|
+
i || o || ((n = a.current) == null || n.focus(), x(e), l());
|
|
76
|
+
}, [i, o, l]), ge = d((e) => {
|
|
77
|
+
var n;
|
|
78
|
+
i || o || ((n = a.current) == null || n.focus(), S(e), l());
|
|
79
|
+
}, [i, o, l]), he = d(async (e) => {
|
|
80
|
+
var c;
|
|
81
|
+
if (!z) return;
|
|
82
|
+
const n = (c = e.clipboardData) == null ? void 0 : c.items;
|
|
83
|
+
if (n)
|
|
84
|
+
for (let s = 0; s < n.length; s++) {
|
|
85
|
+
const r = n[s];
|
|
86
|
+
if (r.type.startsWith("image/")) {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
const g = r.getAsFile();
|
|
89
|
+
if (g) {
|
|
90
|
+
const y = await v(g);
|
|
91
|
+
A(y), l();
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, [z, l]), Ce = d(() => {
|
|
97
|
+
if (i || o) return;
|
|
98
|
+
const e = document.createElement("input");
|
|
99
|
+
e.type = "file", e.accept = "image/*", e.onchange = async (n) => {
|
|
100
|
+
var s, r;
|
|
101
|
+
const c = (s = n.target.files) == null ? void 0 : s[0];
|
|
102
|
+
if (c) {
|
|
103
|
+
const g = await v(c);
|
|
104
|
+
(r = a.current) == null || r.focus(), A(g), l();
|
|
105
|
+
}
|
|
106
|
+
}, e.click();
|
|
107
|
+
}, [i, o, l]), Ie = {
|
|
108
|
+
bold: /* @__PURE__ */ t(Pe, { size: 16 }),
|
|
109
|
+
italic: /* @__PURE__ */ t(Je, { size: 16 }),
|
|
110
|
+
underline: /* @__PURE__ */ t(je, { size: 16 }),
|
|
111
|
+
strikethrough: /* @__PURE__ */ t(Ve, { size: 16 }),
|
|
112
|
+
heading1: /* @__PURE__ */ t(Me, { size: 16 }),
|
|
113
|
+
heading2: /* @__PURE__ */ t(Ue, { size: 16 }),
|
|
114
|
+
heading3: /* @__PURE__ */ t(we, { size: 16 }),
|
|
115
|
+
bulletList: /* @__PURE__ */ t(Ne, { size: 16 }),
|
|
116
|
+
orderedList: /* @__PURE__ */ t(Fe, { size: 16 }),
|
|
117
|
+
blockquote: /* @__PURE__ */ t(Be, { size: 16 }),
|
|
118
|
+
code: /* @__PURE__ */ t(De, { size: 16 }),
|
|
119
|
+
link: /* @__PURE__ */ t(B, { size: 16 }),
|
|
120
|
+
alignLeft: /* @__PURE__ */ t(N, { size: 16 }),
|
|
121
|
+
alignCenter: /* @__PURE__ */ t(w, { size: 16 }),
|
|
122
|
+
alignRight: /* @__PURE__ */ t(U, { size: 16 }),
|
|
123
|
+
alignJustify: /* @__PURE__ */ t(M, { size: 16 }),
|
|
124
|
+
image: /* @__PURE__ */ t(F, { size: 16 }),
|
|
125
|
+
indent: /* @__PURE__ */ t(V, { size: 16 }),
|
|
126
|
+
outdent: /* @__PURE__ */ t(j, { size: 16 }),
|
|
127
|
+
clearFormat: /* @__PURE__ */ t(J, { size: 16 }),
|
|
128
|
+
table: /* @__PURE__ */ t(Oe, { size: 16 })
|
|
129
|
+
}, k = (e, n) => {
|
|
130
|
+
if (e === "divider")
|
|
131
|
+
return /* @__PURE__ */ t("div", { className: b("Bear-RichEditor__divider", ke) }, `divider-${n}`);
|
|
132
|
+
if (e === "headingDropdown")
|
|
133
|
+
return /* @__PURE__ */ t(
|
|
134
|
+
Se,
|
|
135
|
+
{
|
|
136
|
+
options: xe,
|
|
137
|
+
value: X,
|
|
138
|
+
onChange: se,
|
|
139
|
+
title: "Text Style",
|
|
140
|
+
disabled: i || o,
|
|
141
|
+
icon: /* @__PURE__ */ t(Ae, { size: 16 })
|
|
142
|
+
},
|
|
143
|
+
"heading-dropdown"
|
|
144
|
+
);
|
|
145
|
+
if (e === "textColor")
|
|
146
|
+
return /* @__PURE__ */ t(
|
|
147
|
+
D,
|
|
148
|
+
{
|
|
149
|
+
value: Z,
|
|
150
|
+
onChange: de,
|
|
151
|
+
title: "Text Color",
|
|
152
|
+
disabled: i || o,
|
|
153
|
+
type: "text",
|
|
154
|
+
recentColors: ie,
|
|
155
|
+
onApplyLast: fe
|
|
156
|
+
},
|
|
157
|
+
"text-color"
|
|
158
|
+
);
|
|
159
|
+
if (e === "highlightColor")
|
|
160
|
+
return /* @__PURE__ */ t(
|
|
161
|
+
D,
|
|
162
|
+
{
|
|
163
|
+
value: te,
|
|
164
|
+
onChange: ue,
|
|
165
|
+
title: "Highlight Color",
|
|
166
|
+
disabled: i || o,
|
|
167
|
+
type: "highlight",
|
|
168
|
+
recentColors: re,
|
|
169
|
+
onApplyLast: ge
|
|
170
|
+
},
|
|
171
|
+
"highlight-color"
|
|
172
|
+
);
|
|
173
|
+
if (e === "link")
|
|
174
|
+
return /* @__PURE__ */ t(
|
|
175
|
+
f,
|
|
176
|
+
{
|
|
177
|
+
icon: /* @__PURE__ */ t(B, { size: 16 }),
|
|
178
|
+
title: "Insert Link",
|
|
179
|
+
onClick: ce,
|
|
180
|
+
disabled: i || o
|
|
181
|
+
},
|
|
182
|
+
"link"
|
|
183
|
+
);
|
|
184
|
+
if (e === "image")
|
|
185
|
+
return /* @__PURE__ */ t(
|
|
186
|
+
f,
|
|
187
|
+
{
|
|
188
|
+
icon: /* @__PURE__ */ t(F, { size: 16 }),
|
|
189
|
+
title: "Insert Image",
|
|
190
|
+
onClick: Ce,
|
|
191
|
+
disabled: i || o
|
|
192
|
+
},
|
|
193
|
+
"image"
|
|
194
|
+
);
|
|
195
|
+
if (e === "alignLeft")
|
|
196
|
+
return /* @__PURE__ */ t(
|
|
197
|
+
f,
|
|
198
|
+
{
|
|
199
|
+
icon: /* @__PURE__ */ t(N, { size: 16 }),
|
|
200
|
+
title: "Align Left",
|
|
201
|
+
onClick: () => {
|
|
202
|
+
var r;
|
|
203
|
+
(r = a.current) == null || r.focus(), u("justifyLeft"), l();
|
|
204
|
+
},
|
|
205
|
+
disabled: i || o
|
|
206
|
+
},
|
|
207
|
+
"alignLeft"
|
|
208
|
+
);
|
|
209
|
+
if (e === "alignCenter")
|
|
210
|
+
return /* @__PURE__ */ t(
|
|
211
|
+
f,
|
|
212
|
+
{
|
|
213
|
+
icon: /* @__PURE__ */ t(w, { size: 16 }),
|
|
214
|
+
title: "Align Center",
|
|
215
|
+
onClick: () => {
|
|
216
|
+
var r;
|
|
217
|
+
(r = a.current) == null || r.focus(), u("justifyCenter"), l();
|
|
218
|
+
},
|
|
219
|
+
disabled: i || o
|
|
220
|
+
},
|
|
221
|
+
"alignCenter"
|
|
222
|
+
);
|
|
223
|
+
if (e === "alignRight")
|
|
224
|
+
return /* @__PURE__ */ t(
|
|
225
|
+
f,
|
|
226
|
+
{
|
|
227
|
+
icon: /* @__PURE__ */ t(U, { size: 16 }),
|
|
228
|
+
title: "Align Right",
|
|
229
|
+
onClick: () => {
|
|
230
|
+
var r;
|
|
231
|
+
(r = a.current) == null || r.focus(), u("justifyRight"), l();
|
|
232
|
+
},
|
|
233
|
+
disabled: i || o
|
|
234
|
+
},
|
|
235
|
+
"alignRight"
|
|
236
|
+
);
|
|
237
|
+
if (e === "alignJustify")
|
|
238
|
+
return /* @__PURE__ */ t(
|
|
239
|
+
f,
|
|
240
|
+
{
|
|
241
|
+
icon: /* @__PURE__ */ t(M, { size: 16 }),
|
|
242
|
+
title: "Justify",
|
|
243
|
+
onClick: () => {
|
|
244
|
+
var r;
|
|
245
|
+
(r = a.current) == null || r.focus(), u("justifyFull"), l();
|
|
246
|
+
},
|
|
247
|
+
disabled: i || o
|
|
248
|
+
},
|
|
249
|
+
"alignJustify"
|
|
250
|
+
);
|
|
251
|
+
if (e === "indent")
|
|
252
|
+
return /* @__PURE__ */ t(
|
|
253
|
+
f,
|
|
254
|
+
{
|
|
255
|
+
icon: /* @__PURE__ */ t(V, { size: 16 }),
|
|
256
|
+
title: "Increase Indent",
|
|
257
|
+
onClick: () => {
|
|
258
|
+
var r;
|
|
259
|
+
(r = a.current) == null || r.focus(), u("indent"), l();
|
|
260
|
+
},
|
|
261
|
+
disabled: i || o
|
|
262
|
+
},
|
|
263
|
+
"indent"
|
|
264
|
+
);
|
|
265
|
+
if (e === "outdent")
|
|
266
|
+
return /* @__PURE__ */ t(
|
|
267
|
+
f,
|
|
268
|
+
{
|
|
269
|
+
icon: /* @__PURE__ */ t(j, { size: 16 }),
|
|
270
|
+
title: "Decrease Indent",
|
|
271
|
+
onClick: () => {
|
|
272
|
+
var r;
|
|
273
|
+
(r = a.current) == null || r.focus(), u("outdent"), l();
|
|
274
|
+
},
|
|
275
|
+
disabled: i || o
|
|
276
|
+
},
|
|
277
|
+
"outdent"
|
|
278
|
+
);
|
|
279
|
+
if (e === "clearFormat")
|
|
280
|
+
return /* @__PURE__ */ t(
|
|
281
|
+
f,
|
|
282
|
+
{
|
|
283
|
+
icon: /* @__PURE__ */ t(J, { size: 16 }),
|
|
284
|
+
title: "Clear Formatting",
|
|
285
|
+
onClick: () => {
|
|
286
|
+
var r;
|
|
287
|
+
(r = a.current) == null || r.focus(), u("removeFormat"), l();
|
|
288
|
+
},
|
|
289
|
+
disabled: i || o
|
|
290
|
+
},
|
|
291
|
+
"clearFormat"
|
|
292
|
+
);
|
|
293
|
+
if (e === "more")
|
|
294
|
+
return /* @__PURE__ */ t(ve, { disabled: i || o, children: [
|
|
295
|
+
"alignLeft",
|
|
296
|
+
"alignCenter",
|
|
297
|
+
"alignRight",
|
|
298
|
+
"alignJustify",
|
|
299
|
+
"indent",
|
|
300
|
+
"outdent",
|
|
301
|
+
"blockquote",
|
|
302
|
+
"code",
|
|
303
|
+
"clearFormat"
|
|
304
|
+
].map((g, y) => k(g, y + 1e3)) }, "more");
|
|
305
|
+
const c = O[e], s = Ie[e];
|
|
306
|
+
return !c || !s ? null : /* @__PURE__ */ t(
|
|
307
|
+
f,
|
|
308
|
+
{
|
|
309
|
+
icon: s,
|
|
310
|
+
title: c.title,
|
|
311
|
+
active: Q.has(e),
|
|
312
|
+
onClick: () => ae(e),
|
|
313
|
+
disabled: i || o
|
|
314
|
+
},
|
|
315
|
+
e
|
|
316
|
+
);
|
|
317
|
+
};
|
|
318
|
+
return /* @__PURE__ */ me(
|
|
319
|
+
"div",
|
|
320
|
+
{
|
|
321
|
+
id: Y,
|
|
322
|
+
"data-testid": $,
|
|
323
|
+
className: b(
|
|
324
|
+
"Bear-RichEditor",
|
|
325
|
+
He,
|
|
326
|
+
i && "Bear-RichEditor--disabled",
|
|
327
|
+
o && "Bear-RichEditor--readonly",
|
|
328
|
+
G
|
|
329
|
+
),
|
|
330
|
+
...K,
|
|
331
|
+
children: [
|
|
332
|
+
L.length > 0 && /* @__PURE__ */ t("div", { className: b("Bear-RichEditor__toolbar", Le), children: L.map((e, n) => k(e, n)) }),
|
|
333
|
+
/* @__PURE__ */ t(
|
|
334
|
+
"div",
|
|
335
|
+
{
|
|
336
|
+
ref: a,
|
|
337
|
+
contentEditable: !i && !o,
|
|
338
|
+
onInput: l,
|
|
339
|
+
onSelect: h,
|
|
340
|
+
onKeyUp: h,
|
|
341
|
+
onMouseUp: h,
|
|
342
|
+
onPaste: he,
|
|
343
|
+
"data-placeholder": q,
|
|
344
|
+
className: b(
|
|
345
|
+
"Bear-RichEditor__content",
|
|
346
|
+
ze,
|
|
347
|
+
"[&:empty]:before:bear-content-[attr(data-placeholder)] [&:empty]:before:bear-text-gray-400 [&:empty]:before:bear-pointer-events-none",
|
|
348
|
+
i && "Bear-RichEditor__content--disabled bear-opacity-50 bear-cursor-not-allowed"
|
|
349
|
+
),
|
|
350
|
+
style: {
|
|
351
|
+
minHeight: typeof T == "number" ? `${T}px` : T,
|
|
352
|
+
maxHeight: m ? typeof m == "number" ? `${m}px` : m : void 0,
|
|
353
|
+
overflowY: m ? "auto" : void 0
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
};
|
|
361
|
+
export {
|
|
362
|
+
nt as RichEditor
|
|
363
|
+
};
|