@forgedevstack/bear 1.2.0 → 1.2.1
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/README.md +4 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -1
- package/dist/components/Portal/Portal.d.ts +0 -3
- package/dist/components/Portal/Portal.js +4 -10
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +3 -2
- package/dist/components/Stepper/Stepper.const.js +15 -14
- package/dist/components/Stepper/Stepper.d.ts +0 -7
- package/dist/components/Stepper/Stepper.js +164 -117
- package/dist/components/Stepper/Stepper.types.d.ts +3 -0
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +5 -3
- package/dist/components/index.js +292 -286
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +386 -379
- package/dist/styles/_effects.css +17 -0
- package/dist/styles.css +1 -1
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -1,218 +1,181 @@
|
|
|
1
|
-
import { jsxs as h, jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as h, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E, useRef as M, useMemo as A, useEffect as g, useCallback as x } from "react";
|
|
3
3
|
import { createPortal as $ } from "react-dom";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { CASCADER_DEFAULT_TRANSLATIONS as ee, CASCADER_PATH_SEPARATOR as re, CASCADER_VARIANT_CLASSES as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
expandedPath: o,
|
|
10
|
-
onSelect: B,
|
|
11
|
-
onExpand: p,
|
|
12
|
-
expandTrigger: k,
|
|
13
|
-
level: i
|
|
14
|
-
}) => {
|
|
15
|
-
const m = (a) => {
|
|
16
|
-
var d;
|
|
17
|
-
B(a, i), (d = a.children) != null && d.length && p(a, i);
|
|
18
|
-
}, v = (a) => {
|
|
19
|
-
var d;
|
|
20
|
-
k === "hover" && ((d = a.children) != null && d.length) && p(a, i);
|
|
21
|
-
};
|
|
22
|
-
return /* @__PURE__ */ c("div", { className: "Bear-Cascader__panel bear-min-w-[180px] bear-max-h-[280px] bear-overflow-y-auto bear-border-r bear-border-zinc-200 dark:bear-border-zinc-700 last:bear-border-r-0", children: b.map((a) => {
|
|
23
|
-
const d = s[i] === a.value, C = o[i] === a.value, N = a.children && a.children.length > 0;
|
|
24
|
-
return /* @__PURE__ */ h(
|
|
25
|
-
"button",
|
|
26
|
-
{
|
|
27
|
-
type: "button",
|
|
28
|
-
disabled: a.disabled,
|
|
29
|
-
onClick: () => m(a),
|
|
30
|
-
onMouseEnter: () => v(a),
|
|
31
|
-
className: y(
|
|
32
|
-
"Bear-Cascader__option bear-w-full bear-flex bear-items-center bear-justify-between bear-px-3 bear-py-2 bear-text-sm bear-text-left bear-transition-colors",
|
|
33
|
-
d && "Bear-Cascader__option--selected bear-bg-pink-500/20 bear-text-pink-600 dark:bear-text-pink-400",
|
|
34
|
-
C && !d && "Bear-Cascader__option--expanded bear-bg-gray-100 dark:bear-bg-zinc-700",
|
|
35
|
-
!d && !C && "bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",
|
|
36
|
-
a.disabled && "Bear-Cascader__option--disabled bear-opacity-50 bear-cursor-not-allowed"
|
|
37
|
-
),
|
|
38
|
-
children: [
|
|
39
|
-
/* @__PURE__ */ h("span", { className: "bear-flex bear-items-center bear-gap-2", children: [
|
|
40
|
-
a.icon && /* @__PURE__ */ c("span", { className: "Bear-Cascader__option-icon", children: a.icon }),
|
|
41
|
-
/* @__PURE__ */ c("span", { className: "Bear-Cascader__option-label", children: a.label })
|
|
42
|
-
] }),
|
|
43
|
-
N && /* @__PURE__ */ c("svg", { className: "Bear-Cascader__arrow bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
a.value
|
|
47
|
-
);
|
|
48
|
-
}) });
|
|
49
|
-
}, be = ({
|
|
50
|
-
options: b,
|
|
4
|
+
import { cn as N } from "../../utils/cn.js";
|
|
5
|
+
import { CASCADER_DEFAULT_TRANSLATIONS as ee, CASCADER_PATH_SEPARATOR as re, CASCADER_VARIANT_CLASSES as te, CASCADER_SIZE_CLASSES as ae, CASCADER_DROPDOWN_Z_INDEX as ne } from "./Cascader.const.js";
|
|
6
|
+
import { CascaderPanel as oe } from "./components/CascaderPanel/CascaderPanel.js";
|
|
7
|
+
const fe = ({
|
|
8
|
+
options: i,
|
|
51
9
|
value: s = [],
|
|
52
|
-
onChange:
|
|
53
|
-
placeholder:
|
|
54
|
-
label:
|
|
55
|
-
helperText:
|
|
56
|
-
error:
|
|
10
|
+
onChange: c,
|
|
11
|
+
placeholder: I,
|
|
12
|
+
label: y,
|
|
13
|
+
helperText: L,
|
|
14
|
+
error: u,
|
|
57
15
|
disabled: m = !1,
|
|
58
|
-
loading:
|
|
59
|
-
clearable:
|
|
60
|
-
size:
|
|
61
|
-
variant:
|
|
62
|
-
expandTrigger:
|
|
63
|
-
showFullPath:
|
|
64
|
-
pathSeparator:
|
|
65
|
-
changeOnSelect:
|
|
66
|
-
className:
|
|
67
|
-
testId:
|
|
68
|
-
translations:
|
|
69
|
-
icon:
|
|
16
|
+
loading: W = !1,
|
|
17
|
+
clearable: T = !0,
|
|
18
|
+
size: Z = "md",
|
|
19
|
+
variant: H = "default",
|
|
20
|
+
expandTrigger: U = "click",
|
|
21
|
+
showFullPath: S = !0,
|
|
22
|
+
pathSeparator: z = re,
|
|
23
|
+
changeOnSelect: B = !1,
|
|
24
|
+
className: V,
|
|
25
|
+
testId: X,
|
|
26
|
+
translations: R,
|
|
27
|
+
icon: q
|
|
70
28
|
}) => {
|
|
71
|
-
const [
|
|
29
|
+
const [b, w] = E(!1), [f, _] = E([]), [O, F] = E({ top: 0, left: 0 }), P = M(null), k = M(null), v = A(() => ({
|
|
72
30
|
...ee,
|
|
73
|
-
...
|
|
74
|
-
}), [
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
31
|
+
...R
|
|
32
|
+
}), [R]);
|
|
33
|
+
g(() => {
|
|
34
|
+
if (!b || !k.current) return;
|
|
35
|
+
const e = () => {
|
|
36
|
+
const t = k.current.getBoundingClientRect(), r = Math.min(560, window.innerWidth - 16);
|
|
37
|
+
let a = Math.max(8, Math.min(t.left, window.innerWidth - r - 8));
|
|
38
|
+
F({
|
|
39
|
+
top: t.bottom + 8,
|
|
40
|
+
left: a
|
|
81
41
|
});
|
|
82
|
-
}
|
|
83
|
-
|
|
42
|
+
};
|
|
43
|
+
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
44
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
45
|
+
};
|
|
46
|
+
}, [b]), g(() => {
|
|
84
47
|
const e = (t) => {
|
|
85
|
-
var
|
|
48
|
+
var a, n;
|
|
86
49
|
const r = t.target;
|
|
87
|
-
(
|
|
50
|
+
(a = P.current) != null && a.contains(r) || (n = r.closest) != null && n.call(r, "[data-bear-cascader-dropdown]") || w(!1);
|
|
88
51
|
};
|
|
89
52
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
90
|
-
}, []),
|
|
91
|
-
s.length > 0 &&
|
|
53
|
+
}, []), g(() => {
|
|
54
|
+
s.length > 0 && _(s.slice(0, -1));
|
|
92
55
|
}, [s]);
|
|
93
|
-
const
|
|
56
|
+
const G = x((e, t) => {
|
|
94
57
|
for (const r of e) {
|
|
95
58
|
if (r.value === t) return r;
|
|
96
59
|
if (r.children) {
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
60
|
+
const a = G(r.children, t);
|
|
61
|
+
if (a) return a;
|
|
99
62
|
}
|
|
100
63
|
}
|
|
101
|
-
}, []),
|
|
64
|
+
}, []), D = A(() => {
|
|
102
65
|
var t;
|
|
103
66
|
if (s.length === 0) return "";
|
|
104
|
-
const e = s.map((r,
|
|
105
|
-
let
|
|
106
|
-
for (let
|
|
107
|
-
const
|
|
108
|
-
|
|
67
|
+
const e = s.map((r, a) => {
|
|
68
|
+
let n = i;
|
|
69
|
+
for (let d = 0; d < a; d++) {
|
|
70
|
+
const l = n.find((C) => C.value === s[d]);
|
|
71
|
+
l != null && l.children && (n = l.children);
|
|
109
72
|
}
|
|
110
|
-
return
|
|
73
|
+
return n.find((d) => d.value === r);
|
|
111
74
|
}).filter(Boolean);
|
|
112
|
-
return
|
|
113
|
-
}, [s,
|
|
114
|
-
const e = [
|
|
115
|
-
let t =
|
|
116
|
-
for (const r of
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
e.push(
|
|
75
|
+
return S ? e.map((r) => r.label).join(z) : ((t = e[e.length - 1]) == null ? void 0 : t.label) || "";
|
|
76
|
+
}, [s, i, S, z]), j = A(() => {
|
|
77
|
+
const e = [i];
|
|
78
|
+
let t = i;
|
|
79
|
+
for (const r of f) {
|
|
80
|
+
const a = t.find((n) => n.value === r);
|
|
81
|
+
if (a != null && a.children)
|
|
82
|
+
e.push(a.children), t = a.children;
|
|
120
83
|
else
|
|
121
84
|
break;
|
|
122
85
|
}
|
|
123
86
|
return e;
|
|
124
|
-
}, [
|
|
125
|
-
var
|
|
126
|
-
const r = [...
|
|
127
|
-
if (!((
|
|
128
|
-
const
|
|
129
|
-
let
|
|
130
|
-
for (const
|
|
131
|
-
const
|
|
132
|
-
|
|
87
|
+
}, [i, f]), J = x((e, t) => {
|
|
88
|
+
var a, n;
|
|
89
|
+
const r = [...f.slice(0, t), e.value];
|
|
90
|
+
if (!((a = e.children) != null && a.length) || B) {
|
|
91
|
+
const d = [];
|
|
92
|
+
let l = i;
|
|
93
|
+
for (const C of r) {
|
|
94
|
+
const p = l.find((Y) => Y.value === C);
|
|
95
|
+
p && (d.push(p), p.children && (l = p.children));
|
|
133
96
|
}
|
|
134
|
-
|
|
97
|
+
c == null || c(r, d), (n = e.children) != null && n.length || w(!1);
|
|
135
98
|
}
|
|
136
|
-
}, [
|
|
137
|
-
|
|
138
|
-
}, []),
|
|
139
|
-
e.stopPropagation(),
|
|
140
|
-
}, [
|
|
99
|
+
}, [f, i, c, B]), K = x((e, t) => {
|
|
100
|
+
_((r) => [...r.slice(0, t), e.value]);
|
|
101
|
+
}, []), Q = x((e) => {
|
|
102
|
+
e.stopPropagation(), c == null || c([], []), _([]);
|
|
103
|
+
}, [c]);
|
|
141
104
|
return /* @__PURE__ */ h(
|
|
142
105
|
"div",
|
|
143
106
|
{
|
|
144
|
-
ref:
|
|
145
|
-
className:
|
|
146
|
-
"data-testid":
|
|
107
|
+
ref: P,
|
|
108
|
+
className: N("Bear-Cascader bear-relative", V),
|
|
109
|
+
"data-testid": X,
|
|
147
110
|
children: [
|
|
148
|
-
|
|
111
|
+
y && /* @__PURE__ */ o("label", { className: "Bear-Cascader__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5", children: y }),
|
|
149
112
|
/* @__PURE__ */ h(
|
|
150
113
|
"button",
|
|
151
114
|
{
|
|
152
|
-
ref:
|
|
115
|
+
ref: k,
|
|
153
116
|
type: "button",
|
|
154
|
-
onClick: () => !m &&
|
|
117
|
+
onClick: () => !m && w(!b),
|
|
155
118
|
disabled: m,
|
|
156
|
-
className:
|
|
119
|
+
className: N(
|
|
157
120
|
"Bear-Cascader__trigger bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors",
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
121
|
+
ae[Z],
|
|
122
|
+
te[H],
|
|
123
|
+
u ? "bear-border-red-500" : "focus:bear-border-pink-500",
|
|
161
124
|
m && "bear-opacity-50 bear-cursor-not-allowed",
|
|
162
|
-
|
|
125
|
+
D ? "bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-500 dark:bear-text-zinc-500"
|
|
163
126
|
),
|
|
164
127
|
children: [
|
|
165
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ o("span", { className: "Bear-Cascader__value bear-truncate bear-flex-1", children: W ? v.loading : D || I || v.placeholder }),
|
|
166
129
|
/* @__PURE__ */ h("span", { className: "Bear-Cascader__icons bear-flex bear-items-center bear-gap-1", children: [
|
|
167
|
-
|
|
130
|
+
T && s.length > 0 && !m && /* @__PURE__ */ o(
|
|
168
131
|
"span",
|
|
169
132
|
{
|
|
170
|
-
onClick:
|
|
133
|
+
onClick: Q,
|
|
171
134
|
className: "Bear-Cascader__clear bear-p-0.5 bear-rounded hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-700 bear-cursor-pointer",
|
|
172
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ o("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
173
136
|
}
|
|
174
137
|
),
|
|
175
|
-
|
|
138
|
+
q ?? /* @__PURE__ */ o(
|
|
176
139
|
"svg",
|
|
177
140
|
{
|
|
178
|
-
className:
|
|
141
|
+
className: N(
|
|
179
142
|
"Bear-Cascader__chevron bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-400 bear-transition-transform",
|
|
180
|
-
|
|
143
|
+
b && "bear-rotate-180"
|
|
181
144
|
),
|
|
182
145
|
fill: "none",
|
|
183
146
|
viewBox: "0 0 24 24",
|
|
184
147
|
stroke: "currentColor",
|
|
185
|
-
children: /* @__PURE__ */
|
|
148
|
+
children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
186
149
|
}
|
|
187
150
|
)
|
|
188
151
|
] })
|
|
189
152
|
]
|
|
190
153
|
}
|
|
191
154
|
),
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
155
|
+
u && /* @__PURE__ */ o("p", { className: "Bear-Cascader__error bear-mt-1 bear-text-xs bear-text-red-400", children: u }),
|
|
156
|
+
L && !u && /* @__PURE__ */ o("p", { className: "Bear-Cascader__helper bear-mt-1 bear-text-xs bear-text-zinc-500 dark:bear-text-zinc-400", children: L }),
|
|
157
|
+
b && typeof document < "u" && $(
|
|
195
158
|
/* @__PURE__ */ h(
|
|
196
159
|
"div",
|
|
197
160
|
{
|
|
198
161
|
"data-bear-cascader-dropdown": !0,
|
|
199
|
-
className: "Bear-Cascader__dropdown bear-fixed bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-flex bear-overflow-hidden",
|
|
200
|
-
style: { top:
|
|
162
|
+
className: "Bear-Cascader__dropdown bear-fixed bear-max-w-[calc(100vw-16px)] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-flex bear-flex-col sm:bear-flex-row bear-overflow-hidden",
|
|
163
|
+
style: { top: O.top, left: O.left, zIndex: ne },
|
|
201
164
|
children: [
|
|
202
|
-
|
|
203
|
-
|
|
165
|
+
j.map((e, t) => /* @__PURE__ */ o(
|
|
166
|
+
oe,
|
|
204
167
|
{
|
|
205
168
|
options: e,
|
|
206
169
|
selectedPath: s,
|
|
207
|
-
expandedPath:
|
|
208
|
-
onSelect:
|
|
209
|
-
onExpand:
|
|
210
|
-
expandTrigger:
|
|
170
|
+
expandedPath: f,
|
|
171
|
+
onSelect: J,
|
|
172
|
+
onExpand: K,
|
|
173
|
+
expandTrigger: U,
|
|
211
174
|
level: t
|
|
212
175
|
},
|
|
213
176
|
t
|
|
214
177
|
)),
|
|
215
|
-
|
|
178
|
+
j.every((e) => e.length === 0) && /* @__PURE__ */ o("div", { className: "Bear-Cascader__empty bear-px-4 bear-py-3 bear-text-sm bear-text-gray-500 dark:bear-text-zinc-500", children: v.noOptions })
|
|
216
179
|
]
|
|
217
180
|
}
|
|
218
181
|
),
|
|
@@ -223,5 +186,5 @@ const ce = ({
|
|
|
223
186
|
);
|
|
224
187
|
};
|
|
225
188
|
export {
|
|
226
|
-
|
|
189
|
+
fe as Cascader
|
|
227
190
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),u=require("../../../../utils/cn.cjs");require("react");const g=({options:t,selectedPath:b,expandedPath:d,onSelect:l,onExpand:n,expandTrigger:i,level:s})=>{const o=e=>{var r;l(e,s),(r=e.children)!=null&&r.length&&n(e,s)},h=e=>{var r;i==="hover"&&((r=e.children)!=null&&r.length)&&n(e,s)};return a.jsx("div",{className:"Bear-Cascader__panel bear-min-w-[180px] bear-max-h-[280px] bear-overflow-y-auto bear-border-r bear-border-zinc-200 dark:bear-border-zinc-700 last:bear-border-r-0",children:t.map(e=>{const r=b[s]===e.value,c=d[s]===e.value,x=e.children&&e.children.length>0;return a.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>o(e),onMouseEnter:()=>h(e),className:u.cn("Bear-Cascader__option bear-w-full bear-flex bear-items-center bear-justify-between bear-px-3 bear-py-2 bear-text-sm bear-text-left bear-transition-colors",r&&"Bear-Cascader__option--selected bear-bg-pink-500/20 bear-text-pink-600 dark:bear-text-pink-400",c&&!r&&"Bear-Cascader__option--expanded bear-bg-gray-100 dark:bear-bg-zinc-700",!r&&!c&&"bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",e.disabled&&"Bear-Cascader__option--disabled bear-opacity-50 bear-cursor-not-allowed"),children:[a.jsxs("span",{className:"bear-flex bear-items-center bear-gap-2",children:[e.icon&&a.jsx("span",{className:"Bear-Cascader__option-icon",children:e.icon}),a.jsx("span",{className:"Bear-Cascader__option-label",children:e.label})]}),x&&a.jsx("svg",{className:"Bear-Cascader__arrow bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},e.value)})})};exports.CascaderPanel=g;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { cn as u } from "../../../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
const p = ({
|
|
5
|
+
options: t,
|
|
6
|
+
selectedPath: d,
|
|
7
|
+
expandedPath: l,
|
|
8
|
+
onSelect: i,
|
|
9
|
+
onExpand: n,
|
|
10
|
+
expandTrigger: o,
|
|
11
|
+
level: a
|
|
12
|
+
}) => {
|
|
13
|
+
const h = (e) => {
|
|
14
|
+
var r;
|
|
15
|
+
i(e, a), (r = e.children) != null && r.length && n(e, a);
|
|
16
|
+
}, x = (e) => {
|
|
17
|
+
var r;
|
|
18
|
+
o === "hover" && ((r = e.children) != null && r.length) && n(e, a);
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ s("div", { className: "Bear-Cascader__panel bear-min-w-[180px] bear-max-h-[280px] bear-overflow-y-auto bear-border-r bear-border-zinc-200 dark:bear-border-zinc-700 last:bear-border-r-0", children: t.map((e) => {
|
|
21
|
+
const r = d[a] === e.value, b = l[a] === e.value, m = e.children && e.children.length > 0;
|
|
22
|
+
return /* @__PURE__ */ c(
|
|
23
|
+
"button",
|
|
24
|
+
{
|
|
25
|
+
type: "button",
|
|
26
|
+
disabled: e.disabled,
|
|
27
|
+
onClick: () => h(e),
|
|
28
|
+
onMouseEnter: () => x(e),
|
|
29
|
+
className: u(
|
|
30
|
+
"Bear-Cascader__option bear-w-full bear-flex bear-items-center bear-justify-between bear-px-3 bear-py-2 bear-text-sm bear-text-left bear-transition-colors",
|
|
31
|
+
r && "Bear-Cascader__option--selected bear-bg-pink-500/20 bear-text-pink-600 dark:bear-text-pink-400",
|
|
32
|
+
b && !r && "Bear-Cascader__option--expanded bear-bg-gray-100 dark:bear-bg-zinc-700",
|
|
33
|
+
!r && !b && "bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",
|
|
34
|
+
e.disabled && "Bear-Cascader__option--disabled bear-opacity-50 bear-cursor-not-allowed"
|
|
35
|
+
),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ c("span", { className: "bear-flex bear-items-center bear-gap-2", children: [
|
|
38
|
+
e.icon && /* @__PURE__ */ s("span", { className: "Bear-Cascader__option-icon", children: e.icon }),
|
|
39
|
+
/* @__PURE__ */ s("span", { className: "Bear-Cascader__option-label", children: e.label })
|
|
40
|
+
] }),
|
|
41
|
+
m && /* @__PURE__ */ s("svg", { className: "Bear-Cascader__arrow bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
e.value
|
|
45
|
+
);
|
|
46
|
+
}) });
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
p as CascaderPanel
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CascaderPanel } from './CascaderPanel';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../utils/cn.cjs");require("react");const f=require("./Chart.utils.cjs"),v=({data:s,height:m=200,showLabels:x=!0,showValues:i=!1,animated:o=!0,color:u,orientation:g="vertical",barRadius:a=4,barGap:d=.2,className:p,...j})=>{const h=Math.max(...s.map(t=>t.value));return e.jsx("div",{className:n.cn("w-full",p),style:{height:m},...j,children:g==="vertical"?e.jsx("div",{className:"flex items-end justify-between h-full",style:{gap:`${d}rem`},children:s.map((t,l)=>{const r=t.value/h*100,c=f.getChartColor(l,t.color||u);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:n.cn("w-full transition-all duration-500 ease-out",o&&"animate-grow-up"),style:{height:`${r}%`,backgroundColor:c,borderRadius:`${a}px ${a}px 0 0`,opacity:.9}})}),i&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:t.value}),x&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 truncate max-w-full",children:t.label})]},l)})}):e.jsx("div",{className:"flex flex-col justify-between h-full",style:{gap:`${d}rem`},children:s.map((t,l)=>{const r=t.value/h*100,c=f.getChartColor(l,t.color||u);return e.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[x&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 w-16 truncate",children:t.label}),e.jsx("div",{className:"flex-1 h-full flex items-center",children:e.jsx("div",{className:n.cn("h-3/4 transition-all duration-500 ease-out",o&&"animate-grow-right"),style:{width:`${r}%`,backgroundColor:c,borderRadius:`0 ${a}px ${a}px 0`,opacity:.9}})}),i&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400 w-10 text-right",children:t.value})]},l)})})})};exports.BarChart=v;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as l, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { cn as n } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { getChartColor as h } from "./Chart.utils.js";
|
|
5
|
+
const C = ({
|
|
6
|
+
data: r,
|
|
7
|
+
height: p = 200,
|
|
8
|
+
showLabels: o = !0,
|
|
9
|
+
showValues: i = !1,
|
|
10
|
+
animated: x = !0,
|
|
11
|
+
color: d,
|
|
12
|
+
orientation: g = "vertical",
|
|
13
|
+
barRadius: a = 4,
|
|
14
|
+
barGap: m = 0.2,
|
|
15
|
+
className: v,
|
|
16
|
+
...y
|
|
17
|
+
}) => {
|
|
18
|
+
const u = Math.max(...r.map((e) => e.value));
|
|
19
|
+
return /* @__PURE__ */ l("div", { className: n("w-full", v), style: { height: p }, ...y, children: g === "vertical" ? /* @__PURE__ */ l("div", { className: "flex items-end justify-between h-full", style: { gap: `${m}rem` }, children: r.map((e, t) => {
|
|
20
|
+
const s = e.value / u * 100, c = h(t, e.color || d);
|
|
21
|
+
return /* @__PURE__ */ f("div", { className: "flex-1 flex flex-col items-center gap-1", children: [
|
|
22
|
+
/* @__PURE__ */ l("div", { className: "w-full flex-1 flex items-end", children: /* @__PURE__ */ l(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: n(
|
|
26
|
+
"w-full transition-all duration-500 ease-out",
|
|
27
|
+
x && "animate-grow-up"
|
|
28
|
+
),
|
|
29
|
+
style: {
|
|
30
|
+
height: `${s}%`,
|
|
31
|
+
backgroundColor: c,
|
|
32
|
+
borderRadius: `${a}px ${a}px 0 0`,
|
|
33
|
+
opacity: 0.9
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
) }),
|
|
37
|
+
i && /* @__PURE__ */ l("span", { className: "text-xs text-gray-500 dark:text-slate-400", children: e.value }),
|
|
38
|
+
o && /* @__PURE__ */ l("span", { className: "text-xs text-gray-600 dark:text-slate-300 truncate max-w-full", children: e.label })
|
|
39
|
+
] }, t);
|
|
40
|
+
}) }) : /* @__PURE__ */ l("div", { className: "flex flex-col justify-between h-full", style: { gap: `${m}rem` }, children: r.map((e, t) => {
|
|
41
|
+
const s = e.value / u * 100, c = h(t, e.color || d);
|
|
42
|
+
return /* @__PURE__ */ f("div", { className: "flex-1 flex items-center gap-2", children: [
|
|
43
|
+
o && /* @__PURE__ */ l("span", { className: "text-xs text-gray-600 dark:text-slate-300 w-16 truncate", children: e.label }),
|
|
44
|
+
/* @__PURE__ */ l("div", { className: "flex-1 h-full flex items-center", children: /* @__PURE__ */ l(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: n(
|
|
48
|
+
"h-3/4 transition-all duration-500 ease-out",
|
|
49
|
+
x && "animate-grow-right"
|
|
50
|
+
),
|
|
51
|
+
style: {
|
|
52
|
+
width: `${s}%`,
|
|
53
|
+
backgroundColor: c,
|
|
54
|
+
borderRadius: `0 ${a}px ${a}px 0`,
|
|
55
|
+
opacity: 0.9
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
) }),
|
|
59
|
+
i && /* @__PURE__ */ l("span", { className: "text-xs text-gray-500 dark:text-slate-400 w-10 text-right", children: e.value })
|
|
60
|
+
] }, t);
|
|
61
|
+
}) }) });
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
C as BarChart
|
|
65
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("./BarChart.cjs"),s=require("./LineChart.cjs"),i=require("./PieChart.cjs"),r=require("./Chart.const.cjs"),C=({type:a,...e})=>{switch(a){case r.CHART_TYPES.BAR:return t.jsx(n.BarChart,{...e});case r.CHART_TYPES.LINE:case r.CHART_TYPES.AREA:return t.jsx(s.LineChart,{...e,fill:a===r.CHART_TYPES.AREA});case r.CHART_TYPES.PIE:return t.jsx(i.PieChart,{...e});case r.CHART_TYPES.DONUT:return t.jsx(i.PieChart,{...e,innerRadius:r.CHART.DEFAULT_INNER_RADIUS});default:return t.jsx(n.BarChart,{...e})}};exports.Chart=C;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444","#06b6d4","#84cc16"];exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={DEFAULT_INNER_RADIUS:.6},A={BAR:"bar",LINE:"line",AREA:"area",PIE:"pie",DONUT:"donut"},T=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444","#06b6d4","#84cc16"];exports.CHART=e;exports.CHART_TYPES=A;exports.DEFAULT_COLORS=T;
|
|
@@ -12,4 +12,11 @@ export declare const CHART: {
|
|
|
12
12
|
readonly OUTER_RADIUS: 45;
|
|
13
13
|
readonly CENTER: 50;
|
|
14
14
|
};
|
|
15
|
+
export declare const CHART_TYPES: {
|
|
16
|
+
readonly BAR: "bar";
|
|
17
|
+
readonly LINE: "line";
|
|
18
|
+
readonly AREA: "area";
|
|
19
|
+
readonly PIE: "pie";
|
|
20
|
+
readonly DONUT: "donut";
|
|
21
|
+
};
|
|
15
22
|
export declare const DEFAULT_COLORS: readonly ["#ec4899", "#8b5cf6", "#3b82f6", "#10b981", "#f59e0b", "#ef4444", "#06b6d4", "#84cc16"];
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const A = {
|
|
2
|
+
DEFAULT_INNER_RADIUS: 0.6
|
|
3
|
+
}, c = {
|
|
4
|
+
BAR: "bar",
|
|
5
|
+
LINE: "line",
|
|
6
|
+
AREA: "area",
|
|
7
|
+
PIE: "pie",
|
|
8
|
+
DONUT: "donut"
|
|
9
|
+
}, e = [
|
|
2
10
|
"#ec4899",
|
|
3
11
|
// pink
|
|
4
12
|
"#8b5cf6",
|
|
@@ -17,5 +25,7 @@ const b = [
|
|
|
17
25
|
// lime
|
|
18
26
|
];
|
|
19
27
|
export {
|
|
20
|
-
|
|
28
|
+
A as CHART,
|
|
29
|
+
c as CHART_TYPES,
|
|
30
|
+
e as DEFAULT_COLORS
|
|
21
31
|
};
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { ChartProps
|
|
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>;
|
|
2
|
+
import { ChartProps } from './Chart.types';
|
|
15
3
|
/**
|
|
16
4
|
* Main Chart Component
|
|
17
5
|
*/
|