@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,113 +1,109 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as o } from "react";
|
|
3
|
-
import { cn as
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
C[r],
|
|
40
|
-
h[e],
|
|
41
|
-
u[d],
|
|
42
|
-
a && "bear-transition-all bear-duration-200 bear-cursor-pointer hover:bear-shadow-lg hover:bear-scale-[1.02]",
|
|
43
|
-
s
|
|
44
|
-
),
|
|
45
|
-
"data-testid": l,
|
|
46
|
-
...y,
|
|
47
|
-
children: n
|
|
48
|
-
}
|
|
49
|
-
)
|
|
3
|
+
import { cn as i } from "../../utils/cn.js";
|
|
4
|
+
import { CARD_INTERACTIVE_CLASSES as D, CARD_RADIUS_CLASSES as h, CARD_PADDING_CLASSES as B, CARD_VARIANT_CLASSES as p, CARD_TITLE_CLASSES as v, CARD_SUBTITLE_CLASSES as L, CARD_HEADER_CLASSES as f, CARD_BODY_CLASSES as I, CARD_FOOTER_DIVIDER_CLASSES as b, CARD_FOOTER_CLASSES as u } from "./Card.const.js";
|
|
5
|
+
const _ = o(
|
|
6
|
+
(d, s) => {
|
|
7
|
+
const {
|
|
8
|
+
variant: e = "elevated",
|
|
9
|
+
padding: a = "none",
|
|
10
|
+
interactive: r = !1,
|
|
11
|
+
radius: C = "lg",
|
|
12
|
+
className: n,
|
|
13
|
+
children: c,
|
|
14
|
+
testId: E,
|
|
15
|
+
id: N,
|
|
16
|
+
...R
|
|
17
|
+
} = d;
|
|
18
|
+
return /* @__PURE__ */ t(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
ref: s,
|
|
22
|
+
id: N,
|
|
23
|
+
className: i(
|
|
24
|
+
"Bear-Card",
|
|
25
|
+
`Bear-Card--${e}`,
|
|
26
|
+
"bear-overflow-hidden",
|
|
27
|
+
p[e],
|
|
28
|
+
B[a],
|
|
29
|
+
h[C],
|
|
30
|
+
r && `Bear-Card--interactive ${D}`,
|
|
31
|
+
n
|
|
32
|
+
),
|
|
33
|
+
"data-testid": E,
|
|
34
|
+
...R,
|
|
35
|
+
children: c
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
50
39
|
);
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
40
|
+
_.displayName = "Card";
|
|
41
|
+
const S = o(
|
|
42
|
+
(d, s) => {
|
|
43
|
+
const { title: e, subtitle: a, action: r, className: C, children: n, ...c } = d;
|
|
44
|
+
return /* @__PURE__ */ l(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
ref: s,
|
|
48
|
+
className: i("Bear-Card__header", f, C),
|
|
49
|
+
...c,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ l("div", { className: "Bear-Card__header-content bear-flex-1 bear-min-w-0", children: [
|
|
52
|
+
e && /* @__PURE__ */ t("h3", { className: i("Bear-Card__title", v), children: e }),
|
|
53
|
+
a && /* @__PURE__ */ t("p", { className: i("Bear-Card__subtitle", L), children: a }),
|
|
54
|
+
n
|
|
55
|
+
] }),
|
|
56
|
+
r && /* @__PURE__ */ t("div", { className: "Bear-Card__header-action bear-ml-4 bear-shrink-0", children: r })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
72
61
|
);
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
62
|
+
S.displayName = "CardHeader";
|
|
63
|
+
const m = o(
|
|
64
|
+
(d, s) => {
|
|
65
|
+
const { className: e, children: a, ...r } = d;
|
|
66
|
+
return /* @__PURE__ */ t(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
ref: s,
|
|
70
|
+
className: i("Bear-Card__body", I, e),
|
|
71
|
+
...r,
|
|
72
|
+
children: a
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
84
76
|
);
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
77
|
+
m.displayName = "CardBody";
|
|
78
|
+
const A = o(
|
|
79
|
+
(d, s) => {
|
|
80
|
+
const { divider: e = !0, className: a, children: r, ...C } = d;
|
|
81
|
+
return /* @__PURE__ */ t(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
ref: s,
|
|
85
|
+
className: i(
|
|
86
|
+
"Bear-Card__footer",
|
|
87
|
+
u,
|
|
88
|
+
e && b,
|
|
89
|
+
a
|
|
90
|
+
),
|
|
91
|
+
...C,
|
|
92
|
+
children: r
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
100
96
|
);
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
Header:
|
|
104
|
-
Body:
|
|
105
|
-
Footer:
|
|
97
|
+
A.displayName = "CardFooter";
|
|
98
|
+
const x = Object.assign(_, {
|
|
99
|
+
Header: S,
|
|
100
|
+
Body: m,
|
|
101
|
+
Footer: A
|
|
106
102
|
});
|
|
107
103
|
export {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
_ as Card,
|
|
105
|
+
m as CardBody,
|
|
106
|
+
x as CardCompound,
|
|
107
|
+
A as CardFooter,
|
|
108
|
+
S as CardHeader
|
|
113
109
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { Card, CardHeader, CardBody, CardFooter, CardCompound } from './Card';
|
|
2
|
-
export
|
|
1
|
+
export { Card, CardHeader, CardBody, CardFooter, CardCompound, default } from './Card';
|
|
2
|
+
export * from './Card.types';
|
|
3
|
+
export * from './Card.const';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),d=require("../../utils/cn.cjs"),R=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444","#06b6d4","#84cc16"],w=(r,x)=>x||R[r%R.length],M=({data:r,height:x=200,showLabels:y=!0,showValues:m=!1,animated:h=!0,color:f,orientation:p="vertical",barRadius:o=4,barGap:$=.2,className:j,...v})=>{const n=Math.max(...r.map(l=>l.value));return e.jsx("div",{className:d.cn("w-full",j),style:{height:x},...v,children:p==="vertical"?e.jsx("div",{className:"flex items-end justify-between h-full gap-2",children:r.map((l,a)=>{const s=l.value/n*100,t=w(a,l.color||f);return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-full flex-1 flex items-end",children:e.jsx("div",{className:d.cn("w-full transition-all duration-500 ease-out",h&&"animate-grow-up"),style:{height:`${s}%`,backgroundColor:t,borderRadius:`${o}px ${o}px 0 0`,opacity:.9}})}),m&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:l.value}),y&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 truncate max-w-full",children:l.label})]},a)})}):e.jsx("div",{className:"flex flex-col justify-between h-full gap-2",children:r.map((l,a)=>{const s=l.value/n*100,t=w(a,l.color||f);return e.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[y&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 w-16 truncate",children:l.label}),e.jsx("div",{className:"flex-1 h-full flex items-center",children:e.jsx("div",{className:d.cn("h-3/4 transition-all duration-500 ease-out",h&&"animate-grow-right"),style:{width:`${s}%`,backgroundColor:t,borderRadius:`0 ${o}px ${o}px 0`,opacity:.9}})}),m&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400 w-10 text-right",children:l.value})]},a)})})})},L=({data:r,height:x=200,showLabels:y=!0,showDots:m=!0,smooth:h=!0,fill:f=!1,strokeWidth:p=2,color:o="#ec4899",animated:$=!0,className:j,...v})=>{const n=b.useMemo(()=>{const s=Math.max(...r.map(c=>c.value)),t=Math.min(...r.map(c=>c.value)),i=s-t||1;return r.map((c,u)=>({x:u/(r.length-1||1)*100,y:100-(c.value-t)/i*80-10,...c}))},[r]),l=b.useMemo(()=>n.length===0?"":h?n.reduce((s,t,i,c)=>{if(i===0)return`M ${t.x},${t.y}`;const u=c[i-1],g=u.x+(t.x-u.x)/3,N=t.x-(t.x-u.x)/3;return`${s} C ${g},${u.y} ${N},${t.y} ${t.x},${t.y}`},""):n.reduce((s,t,i)=>`${s} ${i===0?"M":"L"} ${t.x},${t.y}`,""),[n,h]),a=b.useMemo(()=>n.length===0?"":`${l} L 100,100 L 0,100 Z`,[l,n]);return e.jsxs("div",{className:d.cn("w-full",j),style:{height:x},...v,children:[e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"w-full h-full",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"line-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:"0"})]})}),f&&e.jsx("path",{d:a,fill:"url(#line-gradient)",className:d.cn($&&"animate-fade-in")}),e.jsx("path",{d:l,fill:"none",stroke:o,strokeWidth:p/10,strokeLinecap:"round",strokeLinejoin:"round",className:d.cn($&&"animate-draw-line")}),m&&n.map((s,t)=>e.jsx("circle",{cx:s.x,cy:s.y,r:1.5,fill:o,className:d.cn($&&"animate-scale-in"),style:{animationDelay:`${t*50}ms`}},t))]}),y&&e.jsx("div",{className:"flex justify-between mt-2",children:r.map((s,t)=>e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300",children:s.label},t))})]})},k=({data:r,height:x=200,showLabels:y=!0,innerRadius:m=0,startAngle:h=-90,padAngle:f=2,animated:p=!0,className:o,...$})=>{const j=r.reduce((a,s)=>a+s.value,0),v=b.useMemo(()=>{let a=h;return r.map((s,t)=>{const i=s.value/j*360-f,c={startAngle:a,endAngle:a+i,color:w(t,s.color),...s};return a+=i+f,c})},[r,j,h,f]),n=(a,s)=>{const t=a*Math.PI/180;return{x:50+s*Math.cos(t),y:50+s*Math.sin(t)}},l=(a,s)=>{const i=m*45,c=n(a,45),u=n(s,45),g=n(a,i),N=n(s,i),C=s-a>180?1:0;return m>0?`M ${c.x},${c.y} A 45,45 0 ${C},1 ${u.x},${u.y} L ${N.x},${N.y} A ${i},${i} 0 ${C},0 ${g.x},${g.y} Z`:`M 50,50 L ${c.x},${c.y} A 45,45 0 ${C},1 ${u.x},${u.y} Z`};return e.jsxs("div",{className:d.cn("flex items-center gap-4",o),...$,children:[e.jsx("div",{style:{width:x,height:x},children:e.jsx("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:v.map((a,s)=>e.jsx("path",{d:l(a.startAngle,a.endAngle),fill:a.color,className:d.cn("transition-opacity hover:opacity-80",p&&"animate-scale-in"),style:{animationDelay:`${s*100}ms`}},s))})}),y&&e.jsx("div",{className:"flex flex-col gap-2",children:r.map((a,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w(s,a.color)}}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-slate-300",children:a.label}),e.jsxs("span",{className:"text-sm text-gray-400 dark:text-slate-500",children:[Math.round(a.value/j*100),"%"]})]},s))})]})},A=({type:r,...x})=>{switch(r){case"bar":return e.jsx(M,{...x});case"line":case"area":return e.jsx(L,{...x,fill:r==="area"});case"pie":return e.jsx(k,{...x});case"donut":return e.jsx(k,{...x,innerRadius:.6});default:return e.jsx(M,{...x})}};exports.BarChart=M;exports.Chart=A;exports.LineChart=L;exports.PieChart=k;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const CHART: {
|
|
5
|
+
readonly DEFAULT_HEIGHT: 200;
|
|
6
|
+
readonly DEFAULT_BAR_RADIUS: 4;
|
|
7
|
+
readonly DEFAULT_BAR_GAP: 0.2;
|
|
8
|
+
readonly DEFAULT_STROKE_WIDTH: 2;
|
|
9
|
+
readonly DEFAULT_INNER_RADIUS: 0.6;
|
|
10
|
+
readonly DEFAULT_START_ANGLE: -90;
|
|
11
|
+
readonly DEFAULT_PAD_ANGLE: 2;
|
|
12
|
+
readonly OUTER_RADIUS: 45;
|
|
13
|
+
readonly CENTER: 50;
|
|
14
|
+
};
|
|
15
|
+
export declare const DEFAULT_COLORS: readonly ["#ec4899", "#8b5cf6", "#3b82f6", "#10b981", "#f59e0b", "#ef4444", "#06b6d4", "#84cc16"];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChartProps, BarChartProps, LineChartProps, PieChartProps } from './Chart.types';
|
|
3
|
+
/**
|
|
4
|
+
* BarChart Component
|
|
5
|
+
*/
|
|
6
|
+
export declare const BarChart: FC<BarChartProps>;
|
|
7
|
+
/**
|
|
8
|
+
* LineChart Component
|
|
9
|
+
*/
|
|
10
|
+
export declare const LineChart: FC<LineChartProps>;
|
|
11
|
+
/**
|
|
12
|
+
* PieChart Component
|
|
13
|
+
*/
|
|
14
|
+
export declare const PieChart: FC<PieChartProps>;
|
|
15
|
+
/**
|
|
16
|
+
* Main Chart Component
|
|
17
|
+
*/
|
|
18
|
+
export declare const Chart: FC<ChartProps>;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as C } from "react";
|
|
3
|
+
import { cn as d } from "../../utils/cn.js";
|
|
4
|
+
const L = [
|
|
5
|
+
"#ec4899",
|
|
6
|
+
// pink
|
|
7
|
+
"#8b5cf6",
|
|
8
|
+
// purple
|
|
9
|
+
"#3b82f6",
|
|
10
|
+
// blue
|
|
11
|
+
"#10b981",
|
|
12
|
+
// emerald
|
|
13
|
+
"#f59e0b",
|
|
14
|
+
// amber
|
|
15
|
+
"#ef4444",
|
|
16
|
+
// red
|
|
17
|
+
"#06b6d4",
|
|
18
|
+
// cyan
|
|
19
|
+
"#84cc16"
|
|
20
|
+
// lime
|
|
21
|
+
], k = (l, o) => o || L[l % L.length], R = ({
|
|
22
|
+
data: l,
|
|
23
|
+
height: o = 200,
|
|
24
|
+
showLabels: p = !0,
|
|
25
|
+
showValues: $ = !1,
|
|
26
|
+
animated: f = !0,
|
|
27
|
+
color: m,
|
|
28
|
+
orientation: g = "vertical",
|
|
29
|
+
barRadius: u = 4,
|
|
30
|
+
barGap: v = 0.2,
|
|
31
|
+
className: y,
|
|
32
|
+
...N
|
|
33
|
+
}) => {
|
|
34
|
+
const n = Math.max(...l.map((s) => s.value));
|
|
35
|
+
return /* @__PURE__ */ t("div", { className: d("w-full", y), style: { height: o }, ...N, children: g === "vertical" ? /* @__PURE__ */ t("div", { className: "flex items-end justify-between h-full gap-2", children: l.map((s, r) => {
|
|
36
|
+
const e = s.value / n * 100, a = k(r, s.color || m);
|
|
37
|
+
return /* @__PURE__ */ h("div", { className: "flex-1 flex flex-col items-center gap-1", children: [
|
|
38
|
+
/* @__PURE__ */ t("div", { className: "w-full flex-1 flex items-end", children: /* @__PURE__ */ t(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: d(
|
|
42
|
+
"w-full transition-all duration-500 ease-out",
|
|
43
|
+
f && "animate-grow-up"
|
|
44
|
+
),
|
|
45
|
+
style: {
|
|
46
|
+
height: `${e}%`,
|
|
47
|
+
backgroundColor: a,
|
|
48
|
+
borderRadius: `${u}px ${u}px 0 0`,
|
|
49
|
+
opacity: 0.9
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
) }),
|
|
53
|
+
$ && /* @__PURE__ */ t("span", { className: "text-xs text-gray-500 dark:text-slate-400", children: s.value }),
|
|
54
|
+
p && /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300 truncate max-w-full", children: s.label })
|
|
55
|
+
] }, r);
|
|
56
|
+
}) }) : /* @__PURE__ */ t("div", { className: "flex flex-col justify-between h-full gap-2", children: l.map((s, r) => {
|
|
57
|
+
const e = s.value / n * 100, a = k(r, s.color || m);
|
|
58
|
+
return /* @__PURE__ */ h("div", { className: "flex-1 flex items-center gap-2", children: [
|
|
59
|
+
p && /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300 w-16 truncate", children: s.label }),
|
|
60
|
+
/* @__PURE__ */ t("div", { className: "flex-1 h-full flex items-center", children: /* @__PURE__ */ t(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: d(
|
|
64
|
+
"h-3/4 transition-all duration-500 ease-out",
|
|
65
|
+
f && "animate-grow-right"
|
|
66
|
+
),
|
|
67
|
+
style: {
|
|
68
|
+
width: `${e}%`,
|
|
69
|
+
backgroundColor: a,
|
|
70
|
+
borderRadius: `0 ${u}px ${u}px 0`,
|
|
71
|
+
opacity: 0.9
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
) }),
|
|
75
|
+
$ && /* @__PURE__ */ t("span", { className: "text-xs text-gray-500 dark:text-slate-400 w-10 text-right", children: s.value })
|
|
76
|
+
] }, r);
|
|
77
|
+
}) }) });
|
|
78
|
+
}, A = ({
|
|
79
|
+
data: l,
|
|
80
|
+
height: o = 200,
|
|
81
|
+
showLabels: p = !0,
|
|
82
|
+
showDots: $ = !0,
|
|
83
|
+
smooth: f = !0,
|
|
84
|
+
fill: m = !1,
|
|
85
|
+
strokeWidth: g = 2,
|
|
86
|
+
color: u = "#ec4899",
|
|
87
|
+
animated: v = !0,
|
|
88
|
+
className: y,
|
|
89
|
+
...N
|
|
90
|
+
}) => {
|
|
91
|
+
const n = C(() => {
|
|
92
|
+
const e = Math.max(...l.map((c) => c.value)), a = Math.min(...l.map((c) => c.value)), i = e - a || 1;
|
|
93
|
+
return l.map((c, x) => ({
|
|
94
|
+
x: x / (l.length - 1 || 1) * 100,
|
|
95
|
+
y: 100 - (c.value - a) / i * 80 - 10,
|
|
96
|
+
...c
|
|
97
|
+
}));
|
|
98
|
+
}, [l]), s = C(() => n.length === 0 ? "" : f ? n.reduce((e, a, i, c) => {
|
|
99
|
+
if (i === 0) return `M ${a.x},${a.y}`;
|
|
100
|
+
const x = c[i - 1], b = x.x + (a.x - x.x) / 3, w = a.x - (a.x - x.x) / 3;
|
|
101
|
+
return `${e} C ${b},${x.y} ${w},${a.y} ${a.x},${a.y}`;
|
|
102
|
+
}, "") : n.reduce((e, a, i) => `${e} ${i === 0 ? "M" : "L"} ${a.x},${a.y}`, ""), [n, f]), r = C(() => n.length === 0 ? "" : `${s} L 100,100 L 0,100 Z`, [s, n]);
|
|
103
|
+
return /* @__PURE__ */ h("div", { className: d("w-full", y), style: { height: o }, ...N, children: [
|
|
104
|
+
/* @__PURE__ */ h("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "w-full h-full", children: [
|
|
105
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ h("linearGradient", { id: "line-gradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
|
|
106
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: u, stopOpacity: "0.3" }),
|
|
107
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: u, stopOpacity: "0" })
|
|
108
|
+
] }) }),
|
|
109
|
+
m && /* @__PURE__ */ t(
|
|
110
|
+
"path",
|
|
111
|
+
{
|
|
112
|
+
d: r,
|
|
113
|
+
fill: "url(#line-gradient)",
|
|
114
|
+
className: d(v && "animate-fade-in")
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ t(
|
|
118
|
+
"path",
|
|
119
|
+
{
|
|
120
|
+
d: s,
|
|
121
|
+
fill: "none",
|
|
122
|
+
stroke: u,
|
|
123
|
+
strokeWidth: g / 10,
|
|
124
|
+
strokeLinecap: "round",
|
|
125
|
+
strokeLinejoin: "round",
|
|
126
|
+
className: d(v && "animate-draw-line")
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
$ && n.map((e, a) => /* @__PURE__ */ t(
|
|
130
|
+
"circle",
|
|
131
|
+
{
|
|
132
|
+
cx: e.x,
|
|
133
|
+
cy: e.y,
|
|
134
|
+
r: 1.5,
|
|
135
|
+
fill: u,
|
|
136
|
+
className: d(v && "animate-scale-in"),
|
|
137
|
+
style: { animationDelay: `${a * 50}ms` }
|
|
138
|
+
},
|
|
139
|
+
a
|
|
140
|
+
))
|
|
141
|
+
] }),
|
|
142
|
+
p && /* @__PURE__ */ t("div", { className: "flex justify-between mt-2", children: l.map((e, a) => /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300", children: e.label }, a)) })
|
|
143
|
+
] });
|
|
144
|
+
}, j = ({
|
|
145
|
+
data: l,
|
|
146
|
+
height: o = 200,
|
|
147
|
+
showLabels: p = !0,
|
|
148
|
+
innerRadius: $ = 0,
|
|
149
|
+
startAngle: f = -90,
|
|
150
|
+
padAngle: m = 2,
|
|
151
|
+
animated: g = !0,
|
|
152
|
+
className: u,
|
|
153
|
+
...v
|
|
154
|
+
}) => {
|
|
155
|
+
const y = l.reduce((r, e) => r + e.value, 0), N = C(() => {
|
|
156
|
+
let r = f;
|
|
157
|
+
return l.map((e, a) => {
|
|
158
|
+
const i = e.value / y * 360 - m, c = {
|
|
159
|
+
startAngle: r,
|
|
160
|
+
endAngle: r + i,
|
|
161
|
+
color: k(a, e.color),
|
|
162
|
+
...e
|
|
163
|
+
};
|
|
164
|
+
return r += i + m, c;
|
|
165
|
+
});
|
|
166
|
+
}, [l, y, f, m]), n = (r, e) => {
|
|
167
|
+
const a = r * Math.PI / 180;
|
|
168
|
+
return {
|
|
169
|
+
x: 50 + e * Math.cos(a),
|
|
170
|
+
y: 50 + e * Math.sin(a)
|
|
171
|
+
};
|
|
172
|
+
}, s = (r, e) => {
|
|
173
|
+
const i = $ * 45, c = n(r, 45), x = n(e, 45), b = n(r, i), w = n(e, i), M = e - r > 180 ? 1 : 0;
|
|
174
|
+
return $ > 0 ? `M ${c.x},${c.y} A 45,45 0 ${M},1 ${x.x},${x.y} L ${w.x},${w.y} A ${i},${i} 0 ${M},0 ${b.x},${b.y} Z` : `M 50,50 L ${c.x},${c.y} A 45,45 0 ${M},1 ${x.x},${x.y} Z`;
|
|
175
|
+
};
|
|
176
|
+
return /* @__PURE__ */ h("div", { className: d("flex items-center gap-4", u), ...v, children: [
|
|
177
|
+
/* @__PURE__ */ t("div", { style: { width: o, height: o }, children: /* @__PURE__ */ t("svg", { viewBox: "0 0 100 100", className: "w-full h-full", children: N.map((r, e) => /* @__PURE__ */ t(
|
|
178
|
+
"path",
|
|
179
|
+
{
|
|
180
|
+
d: s(r.startAngle, r.endAngle),
|
|
181
|
+
fill: r.color,
|
|
182
|
+
className: d(
|
|
183
|
+
"transition-opacity hover:opacity-80",
|
|
184
|
+
g && "animate-scale-in"
|
|
185
|
+
),
|
|
186
|
+
style: { animationDelay: `${e * 100}ms` }
|
|
187
|
+
},
|
|
188
|
+
e
|
|
189
|
+
)) }) }),
|
|
190
|
+
p && /* @__PURE__ */ t("div", { className: "flex flex-col gap-2", children: l.map((r, e) => /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
|
|
191
|
+
/* @__PURE__ */ t(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
className: "w-3 h-3 rounded-full",
|
|
195
|
+
style: { backgroundColor: k(e, r.color) }
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ t("span", { className: "text-sm text-gray-600 dark:text-slate-300", children: r.label }),
|
|
199
|
+
/* @__PURE__ */ h("span", { className: "text-sm text-gray-400 dark:text-slate-500", children: [
|
|
200
|
+
Math.round(r.value / y * 100),
|
|
201
|
+
"%"
|
|
202
|
+
] })
|
|
203
|
+
] }, e)) })
|
|
204
|
+
] });
|
|
205
|
+
}, I = ({ type: l, ...o }) => {
|
|
206
|
+
switch (l) {
|
|
207
|
+
case "bar":
|
|
208
|
+
return /* @__PURE__ */ t(R, { ...o });
|
|
209
|
+
case "line":
|
|
210
|
+
case "area":
|
|
211
|
+
return /* @__PURE__ */ t(A, { ...o, fill: l === "area" });
|
|
212
|
+
case "pie":
|
|
213
|
+
return /* @__PURE__ */ t(j, { ...o });
|
|
214
|
+
case "donut":
|
|
215
|
+
return /* @__PURE__ */ t(j, { ...o, innerRadius: 0.6 });
|
|
216
|
+
default:
|
|
217
|
+
return /* @__PURE__ */ t(R, { ...o });
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
export {
|
|
221
|
+
R as BarChart,
|
|
222
|
+
I as Chart,
|
|
223
|
+
A as LineChart,
|
|
224
|
+
j as PieChart
|
|
225
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'donut';
|
|
3
|
+
export interface ChartDataPoint {
|
|
4
|
+
label: string;
|
|
5
|
+
value: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ChartProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
9
|
+
/** Chart type */
|
|
10
|
+
type: ChartType;
|
|
11
|
+
/** Data points */
|
|
12
|
+
data: ChartDataPoint[];
|
|
13
|
+
/** Chart height */
|
|
14
|
+
height?: number;
|
|
15
|
+
/** Show labels */
|
|
16
|
+
showLabels?: boolean;
|
|
17
|
+
/** Show values */
|
|
18
|
+
showValues?: boolean;
|
|
19
|
+
/** Animate on render */
|
|
20
|
+
animated?: boolean;
|
|
21
|
+
/** Primary color (used for single-color charts) */
|
|
22
|
+
color?: string;
|
|
23
|
+
/** Show grid lines */
|
|
24
|
+
showGrid?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface BarChartProps extends Omit<ChartProps, 'type'> {
|
|
27
|
+
/** Bar orientation */
|
|
28
|
+
orientation?: 'vertical' | 'horizontal';
|
|
29
|
+
/** Bar border radius */
|
|
30
|
+
barRadius?: number;
|
|
31
|
+
/** Gap between bars (0-1) */
|
|
32
|
+
barGap?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface LineChartProps extends Omit<ChartProps, 'type'> {
|
|
35
|
+
/** Show area fill */
|
|
36
|
+
fill?: boolean;
|
|
37
|
+
/** Line width */
|
|
38
|
+
strokeWidth?: number;
|
|
39
|
+
/** Show dots at data points */
|
|
40
|
+
showDots?: boolean;
|
|
41
|
+
/** Smooth curve */
|
|
42
|
+
smooth?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface PieChartProps extends Omit<ChartProps, 'type'> {
|
|
45
|
+
/** Inner radius for donut chart (0-1) */
|
|
46
|
+
innerRadius?: number;
|
|
47
|
+
/** Start angle in degrees */
|
|
48
|
+
startAngle?: number;
|
|
49
|
+
/** Padding between slices */
|
|
50
|
+
padAngle?: number;
|
|
51
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get color for chart element by index
|
|
3
|
+
*/
|
|
4
|
+
export declare const getChartColor: (index: number, customColor?: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Convert polar coordinates to cartesian
|
|
7
|
+
*/
|
|
8
|
+
export declare const polarToCartesian: (angle: number, radius: number) => {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Create SVG arc path for pie/donut charts
|
|
14
|
+
*/
|
|
15
|
+
export declare const createArcPath: (startAngle: number, endAngle: number, innerRadius?: number) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Generate smooth bezier line path
|
|
18
|
+
*/
|
|
19
|
+
export declare const generateLinePath: (points: Array<{
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}>, smooth?: boolean) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Calculate line chart points from data
|
|
25
|
+
*/
|
|
26
|
+
export declare const calculateLinePoints: (data: Array<{
|
|
27
|
+
value: number;
|
|
28
|
+
}>) => Array<{
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
2
|
-
`),j=r==="dark"?"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("react"),a=require("../../utils/cn.cjs"),f=require("../Typography/Typography.cjs"),K="Bear-CodeBlock bear-rounded-lg bear-overflow-hidden",S="bear-bg-white bear-text-gray-900 bear-border bear-border-gray-200",N="bear-bg-zinc-900 bear-text-gray-100",v="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",j="bear-bg-gray-50 bear-border-b bear-border-gray-200",z="bear-bg-zinc-800 bear-border-b bear-border-zinc-700",T="bear-bg-gray-50 dark:bear-bg-zinc-800 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700",m="Bear-CodeBlock__language bear-text-xs bear-px-2 bear-py-0.5 bear-rounded",w="bear-bg-gray-200 bear-text-gray-600",G="bear-bg-zinc-700 bear-text-zinc-400",U="bear-bg-gray-200 dark:bear-bg-zinc-700 bear-text-gray-600 dark:bear-text-zinc-400",I="Bear-CodeBlock__copy bear-p-1.5 bear-rounded bear-transition-colors",H="hover:bear-bg-gray-200 bear-text-gray-500 hover:bear-text-gray-700",M="hover:bear-bg-zinc-700 bear-text-zinc-400 hover:bear-text-zinc-200",P="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",q="Bear-CodeBlock__pre bear-overflow-x-auto bear-p-4 bear-m-0",Y="Bear-CodeBlock__code bear-text-sm bear-font-mono",W="Bear-CodeBlock__line bear-flex",V="Bear-CodeBlock__line-number bear-select-none bear-w-8 bear-flex-shrink-0 bear-text-right bear-pr-4",$="bear-text-gray-400",F="bear-text-zinc-600",J="bear-text-gray-400 dark:bear-text-zinc-600",l=C.forwardRef(({code:s,language:c="typescript",showLineNumbers:_=!0,title:o,copyable:b=!0,maxHeight:t,theme:r="auto",className:O="",testId:g,id:E,...x},B)=>{const[n,i]=C.useState(!1),L=async()=>{await navigator.clipboard.writeText(s),i(!0),setTimeout(()=>i(!1),2e3)},u=s.split(`
|
|
2
|
+
`),y=()=>r==="light"?S:r==="dark"?N:v,h=()=>r==="light"?j:r==="dark"?z:T,p=()=>r==="light"?w:r==="dark"?G:U,k=()=>r==="light"?H:r==="dark"?M:P,D=()=>r==="light"?$:r==="dark"?F:J;return e.jsxs("div",{id:E,"data-testid":g,className:a.cn(K,y(),O),children:[(o||b)&&e.jsxs("div",{className:a.cn(R,h()),children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-gap-2",children:[o&&e.jsx(f.Typography,{variant:"caption",className:"Bear-CodeBlock__title bear-font-medium",children:o}),c&&e.jsx("span",{className:a.cn(m,p()),children:c})]}),b&&e.jsx("button",{onClick:L,className:a.cn(I,k()),title:n?"Copied!":"Copy code","aria-label":n?"Copied!":"Copy code",children:n?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]}),e.jsx("pre",{ref:B,className:q,style:{maxHeight:t?typeof t=="number"?`${t}px`:t:void 0},...x,children:e.jsx("code",{className:Y,children:u.map((A,d)=>e.jsxs("div",{className:W,children:[_&&e.jsx("span",{className:a.cn(V,D()),children:d+1}),e.jsx("span",{className:"Bear-CodeBlock__line-content bear-flex-1",children:A||" "})]},d))})})]})});l.displayName="CodeBlock";exports.CodeBlock=l;
|