@forgedevstack/bear 1.0.3 → 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/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/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.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 +112 -115
- 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 -2
- package/dist/components/CodeBlock/CodeBlock.js +65 -52
- package/dist/components/CodeBlock/CodeBlock.types.d.ts +12 -1
- package/dist/components/Editable/Editable.cjs +1 -1
- package/dist/components/Editable/Editable.js +115 -115
- 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/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/index.d.ts +22 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +36 -35
- 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 -10
- 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 +14 -0
- package/dist/components/RichEditor/RichEditor.js +341 -129
- package/dist/components/RichEditor/RichEditor.types.d.ts +38 -1
- 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 -2
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- 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 +14 -2
- package/dist/components/Sidebar/Sidebar.js +50 -138
- package/dist/components/Sidebar/Sidebar.types.d.ts +7 -3
- 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 -2
- 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/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 +17 -5
- package/dist/components/index.js +216 -195
- 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 +273 -224
- package/dist/styles.css +1 -1
- package/package.json +16 -23
- package/dist/components/RichEditor/RichEditor.icons.cjs +0 -1
- package/dist/components/RichEditor/RichEditor.icons.d.ts +0 -16
- package/dist/components/RichEditor/RichEditor.icons.js +0 -62
- package/dist/components/RichEditor/RichEditor.utils.cjs +0 -1
- package/dist/components/RichEditor/RichEditor.utils.d.ts +0 -3
- package/dist/components/RichEditor/RichEditor.utils.js +0 -22
|
@@ -1,55 +1,68 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as f, useState as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/* @__PURE__ */ e(
|
|
32
|
-
/* @__PURE__ */ e("
|
|
33
|
-
] })
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
] },
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f, useState as A } from "react";
|
|
3
|
+
import { cn as t } from "../../utils/cn.js";
|
|
4
|
+
import { Typography as K } from "../Typography/Typography.js";
|
|
5
|
+
const N = "Bear-CodeBlock bear-rounded-lg bear-overflow-hidden", S = "bear-bg-white bear-text-gray-900 bear-border bear-border-gray-200", v = "bear-bg-zinc-900 bear-text-gray-100", m = "bear-bg-white dark:bear-bg-zinc-900 bear-text-gray-900 dark:bear-text-gray-100 bear-border bear-border-gray-200 dark:bear-border-zinc-700", R = "Bear-CodeBlock__header bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-2", z = "bear-bg-gray-50 bear-border-b bear-border-gray-200", T = "bear-bg-zinc-800 bear-border-b bear-border-zinc-700", w = "bear-bg-gray-50 dark:bear-bg-zinc-800 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700", G = "Bear-CodeBlock__language bear-text-xs bear-px-2 bear-py-0.5 bear-rounded", U = "bear-bg-gray-200 bear-text-gray-600", I = "bear-bg-zinc-700 bear-text-zinc-400", H = "bear-bg-gray-200 dark:bear-bg-zinc-700 bear-text-gray-600 dark:bear-text-zinc-400", M = "Bear-CodeBlock__copy bear-p-1.5 bear-rounded bear-transition-colors", P = "hover:bear-bg-gray-200 bear-text-gray-500 hover:bear-text-gray-700", Y = "hover:bear-bg-zinc-700 bear-text-zinc-400 hover:bear-text-zinc-200", j = "hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-700 bear-text-gray-500 dark:bear-text-zinc-400 hover:bear-text-gray-700 dark:hover:bear-text-zinc-200", W = "Bear-CodeBlock__pre bear-overflow-x-auto bear-p-4 bear-m-0", V = "Bear-CodeBlock__code bear-text-sm bear-font-mono", $ = "Bear-CodeBlock__line bear-flex", q = "Bear-CodeBlock__line-number bear-select-none bear-w-8 bear-flex-shrink-0 bear-text-right bear-pr-4", F = "bear-text-gray-400", J = "bear-text-zinc-600", Q = "bear-text-gray-400 dark:bear-text-zinc-600", X = f(({
|
|
6
|
+
code: c,
|
|
7
|
+
language: i = "typescript",
|
|
8
|
+
showLineNumbers: l = !0,
|
|
9
|
+
title: n,
|
|
10
|
+
copyable: s = !0,
|
|
11
|
+
maxHeight: o,
|
|
12
|
+
theme: r = "auto",
|
|
13
|
+
className: _ = "",
|
|
14
|
+
testId: O,
|
|
15
|
+
id: g,
|
|
16
|
+
...E
|
|
17
|
+
}, B) => {
|
|
18
|
+
const [b, d] = A(!1), L = async () => {
|
|
19
|
+
await navigator.clipboard.writeText(c), d(!0), setTimeout(() => d(!1), 2e3);
|
|
20
|
+
}, p = c.split(`
|
|
21
|
+
`), x = () => r === "light" ? S : r === "dark" ? v : m, y = () => r === "light" ? z : r === "dark" ? T : w, h = () => r === "light" ? U : r === "dark" ? I : H, u = () => r === "light" ? P : r === "dark" ? Y : j, k = () => r === "light" ? F : r === "dark" ? J : Q;
|
|
22
|
+
return /* @__PURE__ */ a(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
id: g,
|
|
26
|
+
"data-testid": O,
|
|
27
|
+
className: t(N, x(), _),
|
|
28
|
+
children: [
|
|
29
|
+
(n || s) && /* @__PURE__ */ a("div", { className: t(R, y()), children: [
|
|
30
|
+
/* @__PURE__ */ a("div", { className: "bear-flex bear-items-center bear-gap-2", children: [
|
|
31
|
+
n && /* @__PURE__ */ e(K, { variant: "caption", className: "Bear-CodeBlock__title bear-font-medium", children: n }),
|
|
32
|
+
i && /* @__PURE__ */ e("span", { className: t(G, h()), children: i })
|
|
33
|
+
] }),
|
|
34
|
+
s && /* @__PURE__ */ e(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
onClick: L,
|
|
38
|
+
className: t(M, u()),
|
|
39
|
+
title: b ? "Copied!" : "Copy code",
|
|
40
|
+
"aria-label": b ? "Copied!" : "Copy code",
|
|
41
|
+
children: b ? /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ e("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
42
|
+
/* @__PURE__ */ e("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
43
|
+
/* @__PURE__ */ e("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
|
|
44
|
+
] })
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ e(
|
|
49
|
+
"pre",
|
|
50
|
+
{
|
|
51
|
+
ref: B,
|
|
52
|
+
className: W,
|
|
53
|
+
style: { maxHeight: o ? typeof o == "number" ? `${o}px` : o : void 0 },
|
|
54
|
+
...E,
|
|
55
|
+
children: /* @__PURE__ */ e("code", { className: V, children: p.map((D, C) => /* @__PURE__ */ a("div", { className: $, children: [
|
|
56
|
+
l && /* @__PURE__ */ e("span", { className: t(q, k()), children: C + 1 }),
|
|
57
|
+
/* @__PURE__ */ e("span", { className: "Bear-CodeBlock__line-content bear-flex-1", children: D || " " })
|
|
58
|
+
] }, C)) })
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
51
64
|
});
|
|
52
|
-
|
|
65
|
+
X.displayName = "CodeBlock";
|
|
53
66
|
export {
|
|
54
|
-
|
|
67
|
+
X as CodeBlock
|
|
55
68
|
};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
export interface CodeBlockProps extends HTMLAttributes<HTMLPreElement> {
|
|
3
|
+
/** Code content to display */
|
|
3
4
|
code: string;
|
|
5
|
+
/** Programming language for display label */
|
|
4
6
|
language?: string;
|
|
7
|
+
/** Show line numbers */
|
|
5
8
|
showLineNumbers?: boolean;
|
|
9
|
+
/** Title displayed in header */
|
|
6
10
|
title?: string;
|
|
11
|
+
/** Show copy button */
|
|
7
12
|
copyable?: boolean;
|
|
13
|
+
/** Maximum height with scroll */
|
|
8
14
|
maxHeight?: number | string;
|
|
9
|
-
|
|
15
|
+
/** Theme: 'auto' follows system, 'light' or 'dark' forces theme */
|
|
16
|
+
theme?: 'auto' | 'dark' | 'light';
|
|
17
|
+
/** Test ID for testing */
|
|
18
|
+
testId?: string;
|
|
19
|
+
/** Element ID */
|
|
20
|
+
id?: string;
|
|
10
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("react"),y=require("../Button/Button.cjs"),k=require("../Icon/index.cjs"),w=e.createContext(null),d=()=>{const t=e.useContext(w);if(!t)throw new Error("Editable components must be used within Editable.Root");return t},j=e.forwardRef(({children:t,defaultValue:s="",value:a,onChange:i,onEditSubmit:r,onCancel:b,placeholder:u="Click to edit...",isDisabled:l=!1,startWithEditView:p=!1,className:c="",...f},m)=>{const[o,x]=e.useState(p),[I,T]=e.useState(s),[E,_]=e.useState(s),g=a!==void 0?a:I,v=e.useCallback(h=>{a===void 0&&T(h),i==null||i(h)},[a,i]),P=e.useCallback(()=>{l||(_(g),x(!0))},[l,g]),q=e.useCallback(()=>{x(!1)},[]),D=e.useCallback(()=>{r==null||r(g),x(!1)},[g,r]),K=e.useCallback(()=>{v(E),b==null||b(),x(!1)},[E,v,b]);return n.jsx(w.Provider,{value:{isEditing:o,value:g,startEditing:P,stopEditing:q,setValue:v,submit:D,cancel:K},children:n.jsx("div",{ref:m,className:`Bear-Editable bear-inline-block ${c}`.trim(),...f,children:t})})});j.displayName="Editable.Root";const N=e.forwardRef(({children:t,className:s="",...a},i)=>{const{isEditing:r,value:b,startEditing:u}=d();return r?null:n.jsx("span",{ref:i,className:`Bear-Editable__preview bear-cursor-pointer bear-px-2 bear-py-1 bear-rounded bear-transition-all bear-border bear-border-transparent hover:bear-border-gray-300 dark:hover:bear-border-zinc-600 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white ${s}`.trim(),onClick:u,...a,children:t||b||n.jsx("span",{className:"bear-text-gray-400 dark:bear-text-zinc-500 bear-italic",children:"Click to edit..."})})});N.displayName="Editable.Preview";const C=e.forwardRef(({asTextarea:t=!1,className:s="",...a},i)=>{const{isEditing:r,value:b,setValue:u,submit:l,cancel:p}=d(),c=e.useRef(null);e.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select())},[r]);const f=o=>{o.key==="Enter"&&!t&&(o.preventDefault(),l()),o.key==="Escape"&&p()};if(!r)return null;const m="Bear-Editable__input bear-w-full bear-px-2 bear-py-1 bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-rounded bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white focus:bear-outline-none focus:bear-ring-2 focus:bear-ring-pink-500";return t?n.jsx("textarea",{ref:i,value:b,onChange:o=>u(o.target.value),onKeyDown:f,onBlur:l,className:`${m} bear-min-h-[80px] bear-resize-y ${s}`.trim(),...a}):n.jsx("input",{ref:c,type:"text",value:b,onChange:o=>u(o.target.value),onKeyDown:f,onBlur:l,className:`${m} ${s}`.trim(),...a})});C.displayName="Editable.Input";const R=e.forwardRef(({children:t,className:s="",...a},i)=>{const{isEditing:r}=d();return r?n.jsx("div",{ref:i,className:`Bear-Editable__control bear-flex bear-items-center bear-gap-1 bear-mt-1 ${s}`.trim(),...a,children:t}):null});R.displayName="Editable.Control";const z=e.forwardRef(({children:t,className:s="",...a},i)=>{const{submit:r}=d();return n.jsx(y.Button,{ref:i,type:"button",onClick:r,variant:"ghost",size:"sm",className:`bear-editable-submit bear-text-green-600 dark:bear-text-green-400 hover:bear-bg-green-100 dark:hover:bear-bg-green-900/30 bear-p-1 bear-min-w-0 ${s}`.trim(),...a,children:t||n.jsx(k.CheckIcon,{size:16})})});z.displayName="Editable.SubmitTrigger";const B=e.forwardRef(({children:t,className:s="",...a},i)=>{const{cancel:r}=d();return n.jsx(y.Button,{ref:i,type:"button",onClick:r,variant:"ghost",size:"sm",className:`bear-editable-cancel bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-100 dark:hover:bear-bg-red-900/30 bear-p-1 bear-min-w-0 ${s}`.trim(),...a,children:t||n.jsx(k.CloseIcon,{size:16})})});B.displayName="Editable.CancelTrigger";const $=e.forwardRef(({children:t,className:s="",...a},i)=>{const{isEditing:r,startEditing:b}=d();return r?null:n.jsx(y.Button,{ref:i,type:"button",onClick:b,variant:"ghost",size:"sm",className:`bear-editable-edit bear-text-gray-600 dark:bear-text-gray-400 hover:bear-bg-gray-100 dark:hover:bear-bg-gray-800 bear-p-1 bear-min-w-0 ${s}`.trim(),...a,children:t||n.jsx(k.EditIcon,{size:16})})});$.displayName="Editable.EditTrigger";const S={Root:j,Preview:N,Input:C,Control:R,SubmitTrigger:z,CancelTrigger:B,EditTrigger:$};exports.Editable=S;
|
|
@@ -1,194 +1,194 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
2
|
+
import { createContext as A, forwardRef as o, useState as h, useCallback as m, useRef as F, useEffect as G, useContext as H } from "react";
|
|
3
3
|
import { Button as k } from "../Button/Button.js";
|
|
4
|
-
import { CheckIcon as
|
|
5
|
-
const N =
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
4
|
+
import { CheckIcon as J, CloseIcon as L, EditIcon as M } from "../Icon/index.js";
|
|
5
|
+
const N = A(null), d = () => {
|
|
6
|
+
const r = H(N);
|
|
7
|
+
if (!r)
|
|
8
8
|
throw new Error("Editable components must be used within Editable.Root");
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
children:
|
|
12
|
-
defaultValue:
|
|
13
|
-
value:
|
|
14
|
-
onChange:
|
|
9
|
+
return r;
|
|
10
|
+
}, z = o(({
|
|
11
|
+
children: r,
|
|
12
|
+
defaultValue: i = "",
|
|
13
|
+
value: t,
|
|
14
|
+
onChange: a,
|
|
15
15
|
onEditSubmit: e,
|
|
16
16
|
onCancel: s,
|
|
17
17
|
placeholder: u = "Click to edit...",
|
|
18
|
-
isDisabled:
|
|
19
|
-
startWithEditView:
|
|
20
|
-
className:
|
|
18
|
+
isDisabled: l = !1,
|
|
19
|
+
startWithEditView: y = !1,
|
|
20
|
+
className: c = "",
|
|
21
21
|
...p
|
|
22
22
|
}, f) => {
|
|
23
|
-
const [
|
|
24
|
-
|
|
25
|
-
}, [
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
}, []),
|
|
30
|
-
e == null || e(g),
|
|
31
|
-
}, [g, e]),
|
|
32
|
-
E(x), s == null || s(),
|
|
23
|
+
const [b, v] = h(y), [T, P] = h(i), [x, D] = h(i), g = t !== void 0 ? t : T, E = m((w) => {
|
|
24
|
+
t === void 0 && P(w), a == null || a(w);
|
|
25
|
+
}, [t, a]), K = m(() => {
|
|
26
|
+
l || (D(g), v(!0));
|
|
27
|
+
}, [l, g]), j = m(() => {
|
|
28
|
+
v(!1);
|
|
29
|
+
}, []), V = m(() => {
|
|
30
|
+
e == null || e(g), v(!1);
|
|
31
|
+
}, [g, e]), q = m(() => {
|
|
32
|
+
E(x), s == null || s(), v(!1);
|
|
33
33
|
}, [x, E, s]);
|
|
34
|
-
return /* @__PURE__ */ n(N.Provider, { value: { isEditing:
|
|
34
|
+
return /* @__PURE__ */ n(N.Provider, { value: { isEditing: b, value: g, startEditing: K, stopEditing: j, setValue: E, submit: V, cancel: q }, children: /* @__PURE__ */ n(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
ref: f,
|
|
38
|
-
className: `bear-
|
|
38
|
+
className: `Bear-Editable bear-inline-block ${c}`.trim(),
|
|
39
39
|
...p,
|
|
40
|
-
children:
|
|
40
|
+
children: r
|
|
41
41
|
}
|
|
42
42
|
) });
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
children:
|
|
47
|
-
className:
|
|
48
|
-
...
|
|
49
|
-
},
|
|
50
|
-
const { isEditing: e, value: s, startEditing: u } =
|
|
44
|
+
z.displayName = "Editable.Root";
|
|
45
|
+
const C = o(({
|
|
46
|
+
children: r,
|
|
47
|
+
className: i = "",
|
|
48
|
+
...t
|
|
49
|
+
}, a) => {
|
|
50
|
+
const { isEditing: e, value: s, startEditing: u } = d();
|
|
51
51
|
return e ? null : /* @__PURE__ */ n(
|
|
52
52
|
"span",
|
|
53
53
|
{
|
|
54
|
-
ref:
|
|
55
|
-
className: `bear-
|
|
54
|
+
ref: a,
|
|
55
|
+
className: `Bear-Editable__preview bear-cursor-pointer bear-px-2 bear-py-1 bear-rounded bear-transition-all bear-border bear-border-transparent hover:bear-border-gray-300 dark:hover:bear-border-zinc-600 hover:bear-bg-gray-50 dark:hover:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white ${i}`.trim(),
|
|
56
56
|
onClick: u,
|
|
57
|
-
...
|
|
58
|
-
children:
|
|
57
|
+
...t,
|
|
58
|
+
children: r || s || /* @__PURE__ */ n("span", { className: "bear-text-gray-400 dark:bear-text-zinc-500 bear-italic", children: "Click to edit..." })
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
asTextarea:
|
|
65
|
-
className:
|
|
66
|
-
...
|
|
67
|
-
},
|
|
68
|
-
const { isEditing: e, value: s, setValue: u, submit:
|
|
69
|
-
|
|
70
|
-
e &&
|
|
62
|
+
C.displayName = "Editable.Preview";
|
|
63
|
+
const $ = o(({
|
|
64
|
+
asTextarea: r = !1,
|
|
65
|
+
className: i = "",
|
|
66
|
+
...t
|
|
67
|
+
}, a) => {
|
|
68
|
+
const { isEditing: e, value: s, setValue: u, submit: l, cancel: y } = d(), c = F(null);
|
|
69
|
+
G(() => {
|
|
70
|
+
e && c.current && (c.current.focus(), c.current.select());
|
|
71
71
|
}, [e]);
|
|
72
|
-
const p = (
|
|
73
|
-
|
|
72
|
+
const p = (b) => {
|
|
73
|
+
b.key === "Enter" && !r && (b.preventDefault(), l()), b.key === "Escape" && y();
|
|
74
74
|
};
|
|
75
75
|
if (!e) return null;
|
|
76
|
-
const f = "bear-
|
|
77
|
-
return
|
|
76
|
+
const f = "Bear-Editable__input bear-w-full bear-px-2 bear-py-1 bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-rounded bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white focus:bear-outline-none focus:bear-ring-2 focus:bear-ring-pink-500";
|
|
77
|
+
return r ? /* @__PURE__ */ n(
|
|
78
78
|
"textarea",
|
|
79
79
|
{
|
|
80
|
-
ref:
|
|
80
|
+
ref: a,
|
|
81
81
|
value: s,
|
|
82
|
-
onChange: (
|
|
82
|
+
onChange: (b) => u(b.target.value),
|
|
83
83
|
onKeyDown: p,
|
|
84
|
-
onBlur:
|
|
85
|
-
className: `${f} min-h-[80px] resize-y ${
|
|
86
|
-
...
|
|
84
|
+
onBlur: l,
|
|
85
|
+
className: `${f} bear-min-h-[80px] bear-resize-y ${i}`.trim(),
|
|
86
|
+
...t
|
|
87
87
|
}
|
|
88
88
|
) : /* @__PURE__ */ n(
|
|
89
89
|
"input",
|
|
90
90
|
{
|
|
91
|
-
ref:
|
|
91
|
+
ref: c,
|
|
92
92
|
type: "text",
|
|
93
93
|
value: s,
|
|
94
|
-
onChange: (
|
|
94
|
+
onChange: (b) => u(b.target.value),
|
|
95
95
|
onKeyDown: p,
|
|
96
|
-
onBlur:
|
|
97
|
-
className: `${f} ${
|
|
98
|
-
...
|
|
96
|
+
onBlur: l,
|
|
97
|
+
className: `${f} ${i}`.trim(),
|
|
98
|
+
...t
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
});
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
children:
|
|
105
|
-
className:
|
|
106
|
-
...
|
|
107
|
-
},
|
|
108
|
-
const { isEditing: e } =
|
|
102
|
+
$.displayName = "Editable.Input";
|
|
103
|
+
const B = o(({
|
|
104
|
+
children: r,
|
|
105
|
+
className: i = "",
|
|
106
|
+
...t
|
|
107
|
+
}, a) => {
|
|
108
|
+
const { isEditing: e } = d();
|
|
109
109
|
return e ? /* @__PURE__ */ n(
|
|
110
110
|
"div",
|
|
111
111
|
{
|
|
112
|
-
ref:
|
|
113
|
-
className: `bear-
|
|
114
|
-
...
|
|
115
|
-
children:
|
|
112
|
+
ref: a,
|
|
113
|
+
className: `Bear-Editable__control bear-flex bear-items-center bear-gap-1 bear-mt-1 ${i}`.trim(),
|
|
114
|
+
...t,
|
|
115
|
+
children: r
|
|
116
116
|
}
|
|
117
117
|
) : null;
|
|
118
118
|
});
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
children:
|
|
122
|
-
className:
|
|
123
|
-
...
|
|
124
|
-
},
|
|
125
|
-
const { submit: e } =
|
|
119
|
+
B.displayName = "Editable.Control";
|
|
120
|
+
const I = o(({
|
|
121
|
+
children: r,
|
|
122
|
+
className: i = "",
|
|
123
|
+
...t
|
|
124
|
+
}, a) => {
|
|
125
|
+
const { submit: e } = d();
|
|
126
126
|
return /* @__PURE__ */ n(
|
|
127
127
|
k,
|
|
128
128
|
{
|
|
129
|
-
ref:
|
|
129
|
+
ref: a,
|
|
130
130
|
type: "button",
|
|
131
131
|
onClick: e,
|
|
132
132
|
variant: "ghost",
|
|
133
133
|
size: "sm",
|
|
134
|
-
className: `bear-editable-submit bear-text-green-600 dark:bear-text-green-400 hover:bear-bg-green-100 dark:hover:bear-bg-green-900/30 bear-p-1 bear-min-w-0 ${
|
|
135
|
-
...
|
|
136
|
-
children:
|
|
134
|
+
className: `bear-editable-submit bear-text-green-600 dark:bear-text-green-400 hover:bear-bg-green-100 dark:hover:bear-bg-green-900/30 bear-p-1 bear-min-w-0 ${i}`.trim(),
|
|
135
|
+
...t,
|
|
136
|
+
children: r || /* @__PURE__ */ n(J, { size: 16 })
|
|
137
137
|
}
|
|
138
138
|
);
|
|
139
139
|
});
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
children:
|
|
143
|
-
className:
|
|
144
|
-
...
|
|
145
|
-
},
|
|
146
|
-
const { cancel: e } =
|
|
140
|
+
I.displayName = "Editable.SubmitTrigger";
|
|
141
|
+
const R = o(({
|
|
142
|
+
children: r,
|
|
143
|
+
className: i = "",
|
|
144
|
+
...t
|
|
145
|
+
}, a) => {
|
|
146
|
+
const { cancel: e } = d();
|
|
147
147
|
return /* @__PURE__ */ n(
|
|
148
148
|
k,
|
|
149
149
|
{
|
|
150
|
-
ref:
|
|
150
|
+
ref: a,
|
|
151
151
|
type: "button",
|
|
152
152
|
onClick: e,
|
|
153
153
|
variant: "ghost",
|
|
154
154
|
size: "sm",
|
|
155
|
-
className: `bear-editable-cancel bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-100 dark:hover:bear-bg-red-900/30 bear-p-1 bear-min-w-0 ${
|
|
156
|
-
...
|
|
157
|
-
children:
|
|
155
|
+
className: `bear-editable-cancel bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-100 dark:hover:bear-bg-red-900/30 bear-p-1 bear-min-w-0 ${i}`.trim(),
|
|
156
|
+
...t,
|
|
157
|
+
children: r || /* @__PURE__ */ n(L, { size: 16 })
|
|
158
158
|
}
|
|
159
159
|
);
|
|
160
160
|
});
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
children:
|
|
164
|
-
className:
|
|
165
|
-
...
|
|
166
|
-
},
|
|
167
|
-
const { isEditing: e, startEditing: s } =
|
|
161
|
+
R.displayName = "Editable.CancelTrigger";
|
|
162
|
+
const _ = o(({
|
|
163
|
+
children: r,
|
|
164
|
+
className: i = "",
|
|
165
|
+
...t
|
|
166
|
+
}, a) => {
|
|
167
|
+
const { isEditing: e, startEditing: s } = d();
|
|
168
168
|
return e ? null : /* @__PURE__ */ n(
|
|
169
169
|
k,
|
|
170
170
|
{
|
|
171
|
-
ref:
|
|
171
|
+
ref: a,
|
|
172
172
|
type: "button",
|
|
173
173
|
onClick: s,
|
|
174
174
|
variant: "ghost",
|
|
175
175
|
size: "sm",
|
|
176
|
-
className: `bear-editable-edit bear-text-gray-600 dark:bear-text-gray-400 hover:bear-bg-gray-100 dark:hover:bear-bg-gray-800 bear-p-1 bear-min-w-0 ${
|
|
177
|
-
...
|
|
178
|
-
children:
|
|
176
|
+
className: `bear-editable-edit bear-text-gray-600 dark:bear-text-gray-400 hover:bear-bg-gray-100 dark:hover:bear-bg-gray-800 bear-p-1 bear-min-w-0 ${i}`.trim(),
|
|
177
|
+
...t,
|
|
178
|
+
children: r || /* @__PURE__ */ n(M, { size: 16 })
|
|
179
179
|
}
|
|
180
180
|
);
|
|
181
181
|
});
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
Root:
|
|
185
|
-
Preview:
|
|
186
|
-
Input:
|
|
187
|
-
Control:
|
|
188
|
-
SubmitTrigger:
|
|
189
|
-
CancelTrigger:
|
|
190
|
-
EditTrigger:
|
|
182
|
+
_.displayName = "Editable.EditTrigger";
|
|
183
|
+
const X = {
|
|
184
|
+
Root: z,
|
|
185
|
+
Preview: C,
|
|
186
|
+
Input: $,
|
|
187
|
+
Control: B,
|
|
188
|
+
SubmitTrigger: I,
|
|
189
|
+
CancelTrigger: R,
|
|
190
|
+
EditTrigger: _
|
|
191
191
|
};
|
|
192
192
|
export {
|
|
193
|
-
|
|
193
|
+
X as Editable
|
|
194
194
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),o=require("../../utils/cn.cjs"),C=({value:a,min:r=0,max:l=100,size:i=120,strokeWidth:t=10,color:y="#ec4899",trackColor:j,showLabel:g=!0,label:p,animated:k=!0,arcAngle:n=270,gradient:s,className:M,...N})=>{const f=h.useId(),{percentage:v,circumference:u,offset:b,startAngle:x}=h.useMemo(()=>{const m=Math.min(Math.max((a-r)/(l-r)*100,0),100),w=50-t/2,c=2*Math.PI*w*(n/360),D=c-m/100*c,q=90+(360-n)/2;return{percentage:m,circumference:c,offset:D,startAngle:q}},[a,r,l,n,t]),d=50-t/2;return e.jsxs("div",{className:o.cn("relative inline-flex items-center justify-center",M),style:{width:i,height:i},...N,children:[e.jsxs("svg",{viewBox:"0 0 100 100",className:"w-full h-full -rotate-90",children:[e.jsx("defs",{children:s&&e.jsxs("linearGradient",{id:f,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[e.jsx("stop",{offset:"0%",stopColor:s[0]}),e.jsx("stop",{offset:"100%",stopColor:s[1]})]})}),e.jsx("circle",{cx:"50",cy:"50",r:d,fill:"none",stroke:j||"currentColor",strokeWidth:t,strokeLinecap:"round",strokeDasharray:u,strokeDashoffset:0,className:o.cn("text-gray-200 dark:text-slate-700"),style:{transformOrigin:"center",transform:`rotate(${x}deg)`}}),e.jsx("circle",{cx:"50",cy:"50",r:d,fill:"none",stroke:s?`url(#${f})`:y,strokeWidth:t,strokeLinecap:"round",strokeDasharray:u,strokeDashoffset:b,className:o.cn(k&&"transition-all duration-1000 ease-out"),style:{transformOrigin:"center",transform:`rotate(${x}deg)`}})]}),g&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:p||e.jsxs("span",{className:"text-2xl font-semibold text-gray-800 dark:text-white",children:[Math.round(v),"%"]})})]})};exports.Gauge=C;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useId as $, useMemo as b } from "react";
|
|
3
|
+
import { cn as c } from "../../utils/cn.js";
|
|
4
|
+
const B = ({
|
|
5
|
+
value: l,
|
|
6
|
+
min: o = 0,
|
|
7
|
+
max: i = 100,
|
|
8
|
+
size: f = 120,
|
|
9
|
+
strokeWidth: t = 10,
|
|
10
|
+
color: p = "#ec4899",
|
|
11
|
+
trackColor: y,
|
|
12
|
+
showLabel: g = !0,
|
|
13
|
+
label: k,
|
|
14
|
+
animated: N = !0,
|
|
15
|
+
arcAngle: n = 270,
|
|
16
|
+
gradient: r,
|
|
17
|
+
className: M,
|
|
18
|
+
...j
|
|
19
|
+
}) => {
|
|
20
|
+
const u = $(), { percentage: v, circumference: m, offset: w, startAngle: d } = b(() => {
|
|
21
|
+
const h = Math.min(Math.max((l - o) / (i - o) * 100, 0), 100), D = 50 - t / 2, a = 2 * Math.PI * D * (n / 360), C = a - h / 100 * a, I = 90 + (360 - n) / 2;
|
|
22
|
+
return {
|
|
23
|
+
percentage: h,
|
|
24
|
+
circumference: a,
|
|
25
|
+
offset: C,
|
|
26
|
+
startAngle: I
|
|
27
|
+
};
|
|
28
|
+
}, [l, o, i, n, t]), x = 50 - t / 2;
|
|
29
|
+
return /* @__PURE__ */ s(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: c("relative inline-flex items-center justify-center", M),
|
|
33
|
+
style: { width: f, height: f },
|
|
34
|
+
...j,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ s("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90", children: [
|
|
37
|
+
/* @__PURE__ */ e("defs", { children: r && /* @__PURE__ */ s("linearGradient", { id: u, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
38
|
+
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: r[0] }),
|
|
39
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: r[1] })
|
|
40
|
+
] }) }),
|
|
41
|
+
/* @__PURE__ */ e(
|
|
42
|
+
"circle",
|
|
43
|
+
{
|
|
44
|
+
cx: "50",
|
|
45
|
+
cy: "50",
|
|
46
|
+
r: x,
|
|
47
|
+
fill: "none",
|
|
48
|
+
stroke: y || "currentColor",
|
|
49
|
+
strokeWidth: t,
|
|
50
|
+
strokeLinecap: "round",
|
|
51
|
+
strokeDasharray: m,
|
|
52
|
+
strokeDashoffset: 0,
|
|
53
|
+
className: c("text-gray-200 dark:text-slate-700"),
|
|
54
|
+
style: {
|
|
55
|
+
transformOrigin: "center",
|
|
56
|
+
transform: `rotate(${d}deg)`
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ e(
|
|
61
|
+
"circle",
|
|
62
|
+
{
|
|
63
|
+
cx: "50",
|
|
64
|
+
cy: "50",
|
|
65
|
+
r: x,
|
|
66
|
+
fill: "none",
|
|
67
|
+
stroke: r ? `url(#${u})` : p,
|
|
68
|
+
strokeWidth: t,
|
|
69
|
+
strokeLinecap: "round",
|
|
70
|
+
strokeDasharray: m,
|
|
71
|
+
strokeDashoffset: w,
|
|
72
|
+
className: c(
|
|
73
|
+
N && "transition-all duration-1000 ease-out"
|
|
74
|
+
),
|
|
75
|
+
style: {
|
|
76
|
+
transformOrigin: "center",
|
|
77
|
+
transform: `rotate(${d}deg)`
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] }),
|
|
82
|
+
g && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: k || /* @__PURE__ */ s("span", { className: "text-2xl font-semibold text-gray-800 dark:text-white", children: [
|
|
83
|
+
Math.round(v),
|
|
84
|
+
"%"
|
|
85
|
+
] }) })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
B as Gauge
|
|
92
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface GaugeProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Current value (0-100 or within min/max) */
|
|
4
|
+
value: number;
|
|
5
|
+
/** Minimum value */
|
|
6
|
+
min?: number;
|
|
7
|
+
/** Maximum value */
|
|
8
|
+
max?: number;
|
|
9
|
+
/** Size of the gauge */
|
|
10
|
+
size?: number;
|
|
11
|
+
/** Stroke width */
|
|
12
|
+
strokeWidth?: number;
|
|
13
|
+
/** Primary color */
|
|
14
|
+
color?: string;
|
|
15
|
+
/** Track color */
|
|
16
|
+
trackColor?: string;
|
|
17
|
+
/** Show percentage label */
|
|
18
|
+
showLabel?: boolean;
|
|
19
|
+
/** Custom label */
|
|
20
|
+
label?: ReactNode;
|
|
21
|
+
/** Animate on render */
|
|
22
|
+
animated?: boolean;
|
|
23
|
+
/** Arc angle (180 for half, 270 for 3/4, 360 for full) */
|
|
24
|
+
arcAngle?: number;
|
|
25
|
+
/** Gradient colors [start, end] */
|
|
26
|
+
gradient?: [string, string];
|
|
27
|
+
}
|