@forgedevstack/bear 1.1.4 → 1.1.8
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 +19 -0
- package/dist/components/Anchor/Anchor.cjs +1 -1
- package/dist/components/Anchor/Anchor.js +37 -45
- package/dist/components/Anchor/Anchor.utils.cjs +1 -0
- package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
- package/dist/components/Anchor/Anchor.utils.js +12 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +60 -67
- package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
- package/dist/components/BackTop/BackTop.cjs +1 -1
- package/dist/components/BackTop/BackTop.js +10 -11
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +2 -2
- package/dist/components/Button/Button.constants.d.ts +1 -0
- package/dist/components/Button/Button.constants.js +12 -5
- package/dist/components/Button/Button.d.ts +0 -27
- package/dist/components/Button/Button.js +93 -105
- package/dist/components/Button/Button.types.d.ts +1 -0
- package/dist/components/Button/Button.utils.cjs +1 -0
- package/dist/components/Button/Button.utils.d.ts +2 -0
- package/dist/components/Button/Button.utils.js +5 -0
- package/dist/components/Button/useSpotlight.cjs +1 -0
- package/dist/components/Button/useSpotlight.d.ts +21 -0
- package/dist/components/Button/useSpotlight.js +28 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -0
- package/dist/components/Chart/Chart.const.js +21 -0
- package/dist/components/Chart/Chart.js +55 -71
- package/dist/components/Chart/Chart.utils.cjs +1 -0
- package/dist/components/Chart/Chart.utils.js +5 -0
- package/dist/components/Confetti/Confetti.cjs +1 -1
- package/dist/components/Confetti/Confetti.js +37 -34
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +31 -30
- package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
- package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
- package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
- package/dist/components/Dock/Dock.cjs +1 -1
- package/dist/components/Dock/Dock.js +38 -43
- package/dist/components/Dock/Dock.utils.cjs +1 -0
- package/dist/components/Dock/Dock.utils.d.ts +1 -0
- package/dist/components/Dock/Dock.utils.js +10 -0
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +59 -60
- package/dist/components/FileTree/FileTree.cjs +1 -1
- package/dist/components/FileTree/FileTree.js +20 -32
- package/dist/components/FileTree/FileTree.utils.cjs +1 -0
- package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
- package/dist/components/FileTree/FileTree.utils.js +15 -0
- package/dist/components/GradientText/GradientText.cjs +1 -1
- package/dist/components/GradientText/GradientText.js +27 -29
- package/dist/components/Icon/icons/bear.cjs +1 -0
- package/dist/components/Icon/icons/bear.d.ts +12 -0
- package/dist/components/Icon/icons/bear.js +47 -0
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +18 -0
- package/dist/components/Icon/index.js +17 -15
- package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
- package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +64 -68
- package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
- package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
- package/dist/components/PageNav/PageNav.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.d.ts +22 -0
- package/dist/components/PageNav/PageNav.const.js +42 -0
- package/dist/components/PageNav/PageNav.d.ts +3 -0
- package/dist/components/PageNav/PageNav.js +81 -0
- package/dist/components/PageNav/PageNav.types.d.ts +17 -0
- package/dist/components/PageNav/index.d.ts +2 -0
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +6 -6
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
- package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
- package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
- package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
- package/dist/components/PropsPlayground/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +28 -30
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.js +24 -24
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.js +89 -94
- package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
- package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.utils.js +10 -0
- package/dist/components/SliderRange/SliderRange.cjs +1 -1
- package/dist/components/SliderRange/SliderRange.js +61 -63
- package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
- package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.utils.js +7 -0
- package/dist/components/Spotlight/Spotlight.cjs +1 -1
- package/dist/components/Spotlight/Spotlight.js +62 -73
- package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
- package/dist/components/Spotlight/Spotlight.utils.js +18 -0
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.js +39 -38
- package/dist/components/Tabs/Tabs.types.d.ts +3 -1
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +18 -17
- package/dist/components/Toast/Toast.utils.cjs +1 -0
- package/dist/components/Toast/Toast.utils.d.ts +1 -0
- package/dist/components/Toast/Toast.utils.js +4 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +10 -11
- package/dist/components/Tour/Tour.cjs +1 -1
- package/dist/components/Tour/Tour.js +1 -2
- package/dist/components/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/VirtualList/VirtualList.js +38 -43
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +66 -62
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +60 -58
- package/dist/hooks/useResizeObserver/index.d.ts +2 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
- package/dist/icons.cjs +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +175 -169
- package/dist/styles/_base.css +7 -3
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const e = "Bear-PropsPlayground", a = {
|
|
2
|
+
xs: { padding: "bear-p-2", text: "bear-text-[10px]", gap: "bear-gap-2", label: "bear-text-[9px]", input: "bear-px-1.5 bear-py-0.5 bear-text-[10px]" },
|
|
3
|
+
sm: { padding: "bear-p-3", text: "bear-text-xs", gap: "bear-gap-2", label: "bear-text-[10px]", input: "bear-px-2 bear-py-1 bear-text-xs" },
|
|
4
|
+
md: { padding: "bear-p-4", text: "bear-text-sm", gap: "bear-gap-3", label: "bear-text-[11px]", input: "bear-px-2.5 bear-py-1.5 bear-text-xs" },
|
|
5
|
+
lg: { padding: "bear-p-5", text: "bear-text-sm", gap: "bear-gap-3", label: "bear-text-xs", input: "bear-px-3 bear-py-2 bear-text-sm" },
|
|
6
|
+
xl: { padding: "bear-p-6", text: "bear-text-base", gap: "bear-gap-4", label: "bear-text-sm", input: "bear-px-3.5 bear-py-2.5 bear-text-base" }
|
|
7
|
+
}, t = {
|
|
8
|
+
1: "bear-grid-cols-1",
|
|
9
|
+
2: "bear-grid-cols-2",
|
|
10
|
+
3: "bear-grid-cols-3",
|
|
11
|
+
4: "bear-grid-cols-4"
|
|
12
|
+
}, r = {
|
|
13
|
+
boolean: "bool",
|
|
14
|
+
select: "select",
|
|
15
|
+
number: "num",
|
|
16
|
+
string: "str"
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
t as COLUMN_CLASSES,
|
|
20
|
+
e as ROOT_CLASS,
|
|
21
|
+
a as SIZE_CLASSES,
|
|
22
|
+
r as TYPE_LABELS
|
|
23
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { jsxs as b, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as R, useState as y, useCallback as C } from "react";
|
|
3
|
+
import { cn as n } from "../../utils/cn.js";
|
|
4
|
+
import { Icon as f } from "../Icon/Icon.js";
|
|
5
|
+
import { SIZE_CLASSES as _, TYPE_LABELS as m, COLUMN_CLASSES as F, ROOT_CLASS as I } from "./PropsPlayground.const.js";
|
|
6
|
+
import { getDefaults as V } from "./PropsPlayground.utils.js";
|
|
7
|
+
const D = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE__ */ e("polyline", { points: "6 9 12 15 18 9" }) }), M = ({ size: i }) => /* @__PURE__ */ e(f, { size: i, children: /* @__PURE__ */ e("polyline", { points: "9 18 15 12 9 6" }) }), T = ({ size: i }) => /* @__PURE__ */ b(f, { size: i, children: [
|
|
8
|
+
/* @__PURE__ */ e("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
|
|
9
|
+
/* @__PURE__ */ e("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
|
|
10
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
|
|
11
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
|
|
12
|
+
/* @__PURE__ */ e("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
|
|
13
|
+
/* @__PURE__ */ e("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
|
|
14
|
+
/* @__PURE__ */ e("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
|
|
15
|
+
/* @__PURE__ */ e("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
|
|
16
|
+
/* @__PURE__ */ e("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
|
|
17
|
+
] }), H = ({
|
|
18
|
+
config: i,
|
|
19
|
+
render: w,
|
|
20
|
+
title: S = "Props",
|
|
21
|
+
size: k = "md",
|
|
22
|
+
defaultCollapsed: j = !1,
|
|
23
|
+
showReset: $ = !0,
|
|
24
|
+
columns: A = 3,
|
|
25
|
+
className: L,
|
|
26
|
+
testId: E
|
|
27
|
+
}) => {
|
|
28
|
+
const p = R(() => V(i), [i]), [g, N] = y(p), [u, O] = y(j), o = C(
|
|
29
|
+
(r, t) => {
|
|
30
|
+
N((s) => ({ ...s, [r]: t }));
|
|
31
|
+
},
|
|
32
|
+
[]
|
|
33
|
+
), P = C(() => {
|
|
34
|
+
N(p);
|
|
35
|
+
}, [p]), l = _[k], v = Object.keys(i).length, h = n(
|
|
36
|
+
"bear-w-full bear-rounded-md bear-border bear-border-zinc-700",
|
|
37
|
+
"bear-bg-zinc-800 bear-text-zinc-100",
|
|
38
|
+
"placeholder:bear-text-zinc-500",
|
|
39
|
+
"focus:bear-outline-none focus:bear-ring-2 focus:bear-ring-pink-500/30 focus:bear-border-pink-500",
|
|
40
|
+
"bear-transition-colors",
|
|
41
|
+
l.input
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ b(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
"data-testid": E,
|
|
47
|
+
className: n(
|
|
48
|
+
I,
|
|
49
|
+
"bear-rounded-lg bear-border bear-border-zinc-700 bear-overflow-hidden",
|
|
50
|
+
L
|
|
51
|
+
),
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ b(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
onClick: () => O((r) => !r),
|
|
58
|
+
className: n(
|
|
59
|
+
"bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-font-medium bear-transition-colors",
|
|
60
|
+
"bear-bg-zinc-800/60 hover:bear-bg-zinc-800",
|
|
61
|
+
"bear-text-zinc-200 bear-border-b bear-border-zinc-700",
|
|
62
|
+
"bear-px-4 bear-py-3",
|
|
63
|
+
l.text
|
|
64
|
+
),
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ e("span", { className: "bear-text-pink-500", children: u ? /* @__PURE__ */ e(M, { size: 12 }) : /* @__PURE__ */ e(D, { size: 12 }) }),
|
|
67
|
+
/* @__PURE__ */ e("span", { className: "bear-text-pink-500", children: /* @__PURE__ */ e(T, { size: 14 }) }),
|
|
68
|
+
/* @__PURE__ */ e("span", { className: "bear-font-semibold", children: S }),
|
|
69
|
+
/* @__PURE__ */ b("span", { className: "bear-ml-auto bear-flex bear-items-center bear-gap-2", children: [
|
|
70
|
+
/* @__PURE__ */ b("span", { className: "bear-text-[10px] bear-font-medium bear-text-zinc-500", children: [
|
|
71
|
+
v,
|
|
72
|
+
" ",
|
|
73
|
+
v === 1 ? "control" : "controls"
|
|
74
|
+
] }),
|
|
75
|
+
$ && !u && /* @__PURE__ */ e(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
onClick: (r) => {
|
|
80
|
+
r.stopPropagation(), P();
|
|
81
|
+
},
|
|
82
|
+
className: "bear-text-[10px] bear-font-semibold bear-text-pink-500 hover:bear-text-pink-400 hover:bear-underline",
|
|
83
|
+
children: "Reset"
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] })
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
!u && /* @__PURE__ */ e("div", { className: n("bear-bg-zinc-900/50", l.padding), children: /* @__PURE__ */ e("div", { className: n("bear-grid", l.gap, F[A]), children: Object.entries(i).map(([r, t]) => {
|
|
91
|
+
const s = g[r], c = r.replace(/([A-Z])/g, " $1").replace(/^./, (a) => a.toUpperCase()).trim();
|
|
92
|
+
if (t.type === "boolean") {
|
|
93
|
+
const a = s === !0;
|
|
94
|
+
return /* @__PURE__ */ b(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
className: "bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ e("span", { className: n("bear-block bear-font-semibold bear-uppercase bear-tracking-wider bear-text-pink-500 bear-mb-2", l.label), children: m.boolean }),
|
|
100
|
+
/* @__PURE__ */ b("label", { className: "bear-flex bear-items-center bear-gap-2.5 bear-cursor-pointer", children: [
|
|
101
|
+
/* @__PURE__ */ e(
|
|
102
|
+
"button",
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
role: "switch",
|
|
106
|
+
"aria-checked": a,
|
|
107
|
+
onClick: () => o(r, !a),
|
|
108
|
+
className: n(
|
|
109
|
+
"bear-relative bear-inline-flex bear-h-5 bear-w-9 bear-flex-shrink-0 bear-rounded-full bear-border-2 bear-border-transparent bear-transition-colors",
|
|
110
|
+
a ? "bear-bg-pink-500" : "bear-bg-zinc-600"
|
|
111
|
+
),
|
|
112
|
+
children: /* @__PURE__ */ e(
|
|
113
|
+
"span",
|
|
114
|
+
{
|
|
115
|
+
className: n(
|
|
116
|
+
"bear-pointer-events-none bear-inline-block bear-h-4 bear-w-4 bear-transform bear-rounded-full bear-bg-white bear-shadow bear-transition",
|
|
117
|
+
a ? "bear-translate-x-4" : "bear-translate-x-0"
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ e("span", { className: n("bear-font-medium bear-text-zinc-200 bear-truncate", l.text), children: c })
|
|
124
|
+
] })
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
r
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (t.type === "select" && t.options)
|
|
131
|
+
return /* @__PURE__ */ b(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
className: "bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ b("div", { className: "bear-flex bear-items-center bear-justify-between bear-mb-1.5", children: [
|
|
137
|
+
/* @__PURE__ */ e("label", { htmlFor: `pp-${r}`, className: n("bear-font-medium bear-text-zinc-300 bear-truncate", l.label), children: c }),
|
|
138
|
+
/* @__PURE__ */ e("span", { className: n("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-pink-500", l.label), children: m.select })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ e(
|
|
141
|
+
"select",
|
|
142
|
+
{
|
|
143
|
+
id: `pp-${r}`,
|
|
144
|
+
value: String(s),
|
|
145
|
+
onChange: (a) => {
|
|
146
|
+
const d = t.options.find((x) => String(x.value) === a.target.value);
|
|
147
|
+
o(r, d ? d.value : a.target.value);
|
|
148
|
+
},
|
|
149
|
+
className: n(h, "bear-cursor-pointer bear-appearance-none"),
|
|
150
|
+
children: t.options.map((a) => /* @__PURE__ */ e("option", { value: String(a.value), children: a.label }, String(a.value)))
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
r
|
|
156
|
+
);
|
|
157
|
+
if (t.type === "number") {
|
|
158
|
+
const a = Number(s), d = Number.isNaN(a) ? t.default : a;
|
|
159
|
+
return /* @__PURE__ */ b(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
className: "bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ b("div", { className: "bear-flex bear-items-center bear-justify-between bear-mb-1.5", children: [
|
|
165
|
+
/* @__PURE__ */ e("label", { htmlFor: `pp-${r}`, className: n("bear-font-medium bear-text-zinc-300 bear-truncate", l.label), children: c }),
|
|
166
|
+
/* @__PURE__ */ e("span", { className: n("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-pink-500", l.label), children: m.number })
|
|
167
|
+
] }),
|
|
168
|
+
/* @__PURE__ */ e(
|
|
169
|
+
"input",
|
|
170
|
+
{
|
|
171
|
+
id: `pp-${r}`,
|
|
172
|
+
type: "number",
|
|
173
|
+
value: d,
|
|
174
|
+
min: t.min,
|
|
175
|
+
max: t.max,
|
|
176
|
+
step: t.step,
|
|
177
|
+
onChange: (x) => {
|
|
178
|
+
const z = x.target.valueAsNumber;
|
|
179
|
+
o(r, Number.isNaN(z) ? t.default : z);
|
|
180
|
+
},
|
|
181
|
+
className: h
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
r
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return /* @__PURE__ */ b(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
className: "bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ b("div", { className: "bear-flex bear-items-center bear-justify-between bear-mb-1.5", children: [
|
|
195
|
+
/* @__PURE__ */ e("label", { htmlFor: `pp-${r}`, className: n("bear-font-medium bear-text-zinc-300 bear-truncate", l.label), children: c }),
|
|
196
|
+
/* @__PURE__ */ e("span", { className: n("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-pink-500", l.label), children: m.string })
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ e(
|
|
199
|
+
"input",
|
|
200
|
+
{
|
|
201
|
+
id: `pp-${r}`,
|
|
202
|
+
type: "text",
|
|
203
|
+
value: String(s ?? ""),
|
|
204
|
+
onChange: (a) => o(r, a.target.value),
|
|
205
|
+
placeholder: t.placeholder,
|
|
206
|
+
className: h
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
r
|
|
212
|
+
);
|
|
213
|
+
}) }) }),
|
|
214
|
+
/* @__PURE__ */ e("div", { className: "bear-border-t bear-border-zinc-700 bear-p-6 bear-bg-zinc-900 bear-flex bear-items-center bear-justify-center bear-min-h-[180px]", children: /* @__PURE__ */ e("div", { className: "bear-w-full", children: w(g) }) })
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
export {
|
|
220
|
+
H as PropsPlayground
|
|
221
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BearSize } from '../../types';
|
|
3
|
+
export type PropControlType = 'boolean' | 'string' | 'number' | 'select';
|
|
4
|
+
export interface PropControlOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number | boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface PropControlConfig {
|
|
9
|
+
type: PropControlType;
|
|
10
|
+
default: string | number | boolean;
|
|
11
|
+
options?: PropControlOption[];
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
step?: number;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
}
|
|
17
|
+
export type PropsConfig = Record<string, PropControlConfig>;
|
|
18
|
+
export type PropValues = Record<string, string | number | boolean>;
|
|
19
|
+
export interface PropsPlaygroundProps {
|
|
20
|
+
config: PropsConfig;
|
|
21
|
+
render: (values: PropValues) => ReactNode;
|
|
22
|
+
title?: string;
|
|
23
|
+
size?: BearSize;
|
|
24
|
+
defaultCollapsed?: boolean;
|
|
25
|
+
showReset?: boolean;
|
|
26
|
+
columns?: 1 | 2 | 3 | 4;
|
|
27
|
+
className?: string;
|
|
28
|
+
testId?: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(t){const e={};for(const[o,u]of Object.entries(t))e[o]=u.default;return e}exports.getDefaults=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("react"),a=require("../../utils/cn.cjs"),j=require("../../hooks/useClickOutside.cjs");require("../../context/BearProvider.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const f=require("../Icon/index.cjs"),N={sm:"bear-h-8 bear-text-sm bear-px-3",md:"bear-h-10 bear-text-base bear-px-4",lg:"bear-h-12 bear-text-lg bear-px-5"},p=({options:i,value:t,onChange:s,placeholder:g="Select an option",label:u,error:l,disabled:c=!1,size:y="md",fullWidth:h=!1,className:m})=>{const[o,d]=n.useState(!1),x=n.useRef(null),k=!!l,b=i.find(e=>e.value===t),w=n.useCallback(()=>d(!1),[]);j.useClickOutside(x,w);const v=e=>{s==null||s(e),d(!1)};return r.jsxs("div",{ref:x,className:a.cn("bear-relative bear-flex bear-flex-col bear-gap-1.5",h&&"bear-w-full"),children:[u&&r.jsx("label",{className:"bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300",children:u}),r.jsxs("button",{type:"button",disabled:c,onClick:()=>!c&&d(!o),className:a.cn("bear-flex bear-items-center bear-justify-between bear-w-full","bear-rounded-lg bear-border bear-text-left bear-outline-none bear-transition-all bear-duration-200","bear-bg-white bear-text-gray-900 bear-border-gray-300","focus:bear-ring-2 focus:bear-ring-offset-2 focus:bear-ring-offset-white","dark:bear-bg-gray-800 dark:bear-text-white dark:bear-border-gray-600 dark:focus:bear-ring-offset-gray-900",k?"bear-border-red-500 focus:bear-ring-red-500":"focus:bear-border-bear-500 focus:bear-ring-bear-500 dark:focus:bear-border-bear-500 dark:focus:bear-ring-bear-500",c&&"bear-opacity-50 bear-cursor-not-allowed",N[y],m),children:[r.jsx("span",{className:b?"bear-text-gray-900 dark:bear-text-white":"bear-text-gray-500 dark:bear-text-gray-500",children:(b==null?void 0:b.label)||g}),r.jsx(f.ChevronDownIcon,{className:a.cn("bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-gray-400 bear-transition-transform",o&&"bear-rotate-180")})]}),o&&r.jsx("div",{className:a.cn("bear-absolute bear-z-50 bear-w-full bear-mt-1","bear-rounded-lg bear-border bear-shadow-lg bear-overflow-hidden bear-top-full","bear-bg-white bear-border-gray-200 dark:bear-bg-gray-800 dark:bear-border-gray-600"),children:r.jsx("div",{className:"bear-max-h-60 bear-overflow-y-auto",children:i.map(e=>r.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>!e.disabled&&v(e.value),className:a.cn("bear-flex bear-items-center bear-justify-between bear-w-full bear-px-4 bear-py-2","bear-text-left bear-transition-colors",e.disabled?"bear-text-gray-500 bear-cursor-not-allowed":"bear-text-gray-700 dark:bear-text-gray-300 hover:bear-bg-gray-100 hover:bear-text-gray-900 dark:hover:bear-bg-gray-700 dark:hover:bear-text-white",e.value===t&&"bear-bg-bear-100 bear-text-bear-700 dark:bear-bg-bear-600/20 dark:bear-text-bear-300"),children:[e.label,e.value===t&&r.jsx(f.CheckIcon,{className:"bear-w-4 bear-h-4 bear-text-bear-600 dark:bear-text-bear-400"})]},e.value))})}),l&&r.jsx("p",{className:"bear-text-sm bear-text-red-500",children:l})]})};exports.Select=p;
|
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useRef as v, useCallback as N } from "react";
|
|
3
3
|
import { cn as a } from "../../utils/cn.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { useClickOutside as j } from "../../hooks/useClickOutside.js";
|
|
5
|
+
import "../../context/BearProvider.js";
|
|
6
|
+
import "../../hooks/useBearComponent/useBearComponent.js";
|
|
7
|
+
import { ChevronDownIcon as S, CheckIcon as C } from "../Icon/index.js";
|
|
8
|
+
const I = {
|
|
6
9
|
sm: "bear-h-8 bear-text-sm bear-px-3",
|
|
7
10
|
md: "bear-h-10 bear-text-base bear-px-4",
|
|
8
11
|
lg: "bear-h-12 bear-text-lg bear-px-5"
|
|
9
|
-
},
|
|
10
|
-
options:
|
|
12
|
+
}, A = ({
|
|
13
|
+
options: i,
|
|
11
14
|
value: t,
|
|
12
15
|
onChange: s,
|
|
13
|
-
placeholder:
|
|
14
|
-
label:
|
|
16
|
+
placeholder: x = "Select an option",
|
|
17
|
+
label: f,
|
|
15
18
|
error: l,
|
|
16
19
|
disabled: o = !1,
|
|
17
|
-
size:
|
|
20
|
+
size: g = "md",
|
|
18
21
|
fullWidth: m = !1,
|
|
19
22
|
className: y
|
|
20
23
|
}) => {
|
|
21
|
-
const [d,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
27
|
-
}, []);
|
|
28
|
-
const k = (e) => {
|
|
29
|
-
s == null || s(e), n(!1);
|
|
24
|
+
const [d, c] = p(!1), u = v(null), h = !!l, b = i.find((e) => e.value === t), k = N(() => c(!1), []);
|
|
25
|
+
j(u, k);
|
|
26
|
+
const w = (e) => {
|
|
27
|
+
s == null || s(e), c(!1);
|
|
30
28
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ n(
|
|
32
30
|
"div",
|
|
33
31
|
{
|
|
34
|
-
ref:
|
|
32
|
+
ref: u,
|
|
35
33
|
className: a("bear-relative bear-flex bear-flex-col bear-gap-1.5", m && "bear-w-full"),
|
|
36
34
|
children: [
|
|
37
|
-
|
|
38
|
-
/* @__PURE__ */
|
|
35
|
+
f && /* @__PURE__ */ r("label", { className: "bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300", children: f }),
|
|
36
|
+
/* @__PURE__ */ n(
|
|
39
37
|
"button",
|
|
40
38
|
{
|
|
41
39
|
type: "button",
|
|
42
40
|
disabled: o,
|
|
43
|
-
onClick: () => !o &&
|
|
41
|
+
onClick: () => !o && c(!d),
|
|
44
42
|
className: a(
|
|
45
43
|
"bear-flex bear-items-center bear-justify-between bear-w-full",
|
|
46
44
|
"bear-rounded-lg bear-border bear-text-left bear-outline-none bear-transition-all bear-duration-200",
|
|
@@ -49,13 +47,13 @@ const S = {
|
|
|
49
47
|
"dark:bear-bg-gray-800 dark:bear-text-white dark:bear-border-gray-600 dark:focus:bear-ring-offset-gray-900",
|
|
50
48
|
h ? "bear-border-red-500 focus:bear-ring-red-500" : "focus:bear-border-bear-500 focus:bear-ring-bear-500 dark:focus:bear-border-bear-500 dark:focus:bear-ring-bear-500",
|
|
51
49
|
o && "bear-opacity-50 bear-cursor-not-allowed",
|
|
52
|
-
|
|
50
|
+
I[g],
|
|
53
51
|
y
|
|
54
52
|
),
|
|
55
53
|
children: [
|
|
56
|
-
/* @__PURE__ */ r("span", { className: b ? "bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-500 dark:bear-text-gray-500", children: (b == null ? void 0 : b.label) ||
|
|
54
|
+
/* @__PURE__ */ r("span", { className: b ? "bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-500 dark:bear-text-gray-500", children: (b == null ? void 0 : b.label) || x }),
|
|
57
55
|
/* @__PURE__ */ r(
|
|
58
|
-
|
|
56
|
+
S,
|
|
59
57
|
{
|
|
60
58
|
className: a(
|
|
61
59
|
"bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-gray-400 bear-transition-transform",
|
|
@@ -74,12 +72,12 @@ const S = {
|
|
|
74
72
|
"bear-rounded-lg bear-border bear-shadow-lg bear-overflow-hidden bear-top-full",
|
|
75
73
|
"bear-bg-white bear-border-gray-200 dark:bear-bg-gray-800 dark:bear-border-gray-600"
|
|
76
74
|
),
|
|
77
|
-
children: /* @__PURE__ */ r("div", { className: "bear-max-h-60 bear-overflow-y-auto", children:
|
|
75
|
+
children: /* @__PURE__ */ r("div", { className: "bear-max-h-60 bear-overflow-y-auto", children: i.map((e) => /* @__PURE__ */ n(
|
|
78
76
|
"button",
|
|
79
77
|
{
|
|
80
78
|
type: "button",
|
|
81
79
|
disabled: e.disabled,
|
|
82
|
-
onClick: () => !e.disabled &&
|
|
80
|
+
onClick: () => !e.disabled && w(e.value),
|
|
83
81
|
className: a(
|
|
84
82
|
"bear-flex bear-items-center bear-justify-between bear-w-full bear-px-4 bear-py-2",
|
|
85
83
|
"bear-text-left bear-transition-colors",
|
|
@@ -88,7 +86,7 @@ const S = {
|
|
|
88
86
|
),
|
|
89
87
|
children: [
|
|
90
88
|
e.label,
|
|
91
|
-
e.value === t && /* @__PURE__ */ r(
|
|
89
|
+
e.value === t && /* @__PURE__ */ r(C, { className: "bear-w-4 bear-h-4 bear-text-bear-600 dark:bear-text-bear-400" })
|
|
92
90
|
]
|
|
93
91
|
},
|
|
94
92
|
e.value
|
|
@@ -101,5 +99,5 @@ const S = {
|
|
|
101
99
|
);
|
|
102
100
|
};
|
|
103
101
|
export {
|
|
104
|
-
|
|
102
|
+
A as Select
|
|
105
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),r=require("react"),S=require("../../utils/cn.cjs"),y=require("../Button/Button.cjs"),s=require("./SignPad.const.cjs"),V=B=>{const{onChange:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),r=require("react"),S=require("../../utils/cn.cjs"),y=require("../Button/Button.cjs"),s=require("./SignPad.const.cjs"),V=B=>{const{onChange:o,width:p,height:D=s.SIGN_PAD_DEFAULT_HEIGHT,strokeColor:O,strokeWidth:T=s.SIGN_PAD_DEFAULT_STROKE_WIDTH,backgroundColor:M,placeholder:U=s.SIGN_PAD_DEFAULT_PLACEHOLDER,disabled:a=!1,readOnly:c=!1,showClear:N=!0,showSave:m=!1,clearText:j="Clear",saveText:F="Save",outputFormat:P=s.SIGN_PAD_DEFAULT_OUTPUT_FORMAT,outputQuality:v=s.SIGN_PAD_DEFAULT_OUTPUT_QUALITY,className:H,testId:K,id:q,...W}=B,i=r.useRef(null),w=r.useRef(null),A=r.useRef(null),g=r.useRef(!1),[h,L]=r.useState(!1),[E,z]=r.useState(!1);r.useEffect(()=>{const e=()=>{z(document.documentElement.classList.contains("dark"))};e();const t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);const k=O||(E?s.SIGN_PAD_STROKE_DARK:s.SIGN_PAD_STROKE_LIGHT),C=M||(E?s.SIGN_PAD_BG_DARK:s.SIGN_PAD_BG_LIGHT),_=r.useCallback(()=>{const e=i.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.fillStyle=C==="transparent"?"rgba(0,0,0,0)":C,t.fillRect(0,0,e.width,e.height))},[C]);r.useEffect(()=>{const e=i.current,t=w.current;if(!e||!t)return;const n=()=>{const d=t.getBoundingClientRect(),f=p??Math.round(d.width),G=D;(e.width!==f||e.height!==G)&&(e.width=f,e.height=G,_())};n();const l=new ResizeObserver(n);return l.observe(t),()=>l.disconnect()},[p,D,_]),r.useEffect(()=>{_()},[_,E]),r.useEffect(()=>{const e=i.current;if(!e||a||c)return;const t=n=>n.preventDefault();return e.addEventListener("touchstart",t,{passive:!1}),e.addEventListener("touchmove",t,{passive:!1}),()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchmove",t)}},[a,c]);const b=r.useCallback(e=>{const t=i.current;if(!t)return{x:0,y:0};const n=t.getBoundingClientRect(),l=t.width/n.width,d=t.height/n.height;if("touches"in e){const f=e.touches[0];return{x:(f.clientX-n.left)*l,y:(f.clientY-n.top)*d}}return{x:(e.clientX-n.left)*l,y:(e.clientY-n.top)*d}},[]),I=r.useCallback(e=>{if(a||c)return;const t=b(e);g.current=!0,A.current=t},[a,c,b]),x=r.useCallback(e=>{if(!g.current||a||c)return;const t=i.current,n=t==null?void 0:t.getContext("2d"),l=A.current;if(!t||!n||!l)return;const d=b(e);n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(d.x,d.y),n.strokeStyle=k,n.lineWidth=T,n.lineCap="round",n.lineJoin="round",n.stroke(),A.current=d,L(!0)},[a,c,k,T,b]),R=r.useCallback(()=>{if(g.current){const e=i.current;if(e&&o){const t=e.toDataURL(P,v);o(t)}}g.current=!1,A.current=null},[o,P,v]),X=r.useCallback(()=>{const e=i.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.clearRect(0,0,e.width,e.height),_(),L(!1),o==null||o(null))},[_,o]),Y=r.useCallback(()=>{const e=i.current;if(!e||!h)return;const t=e.toDataURL(P,v);o==null||o(t)},[h,o,P,v]);return u.jsxs("div",{id:q,"data-testid":K,className:S.cn("Bear-SignPad bear-w-full",s.SIGN_PAD_ROOT_CLASSES,a&&"Bear-SignPad--disabled bear-opacity-50",c&&"Bear-SignPad--readonly",H),...W,children:[u.jsxs("div",{ref:w,className:S.cn("Bear-SignPad__canvas-wrapper bear-w-full bear-overflow-hidden","bear-touch-none",s.SIGN_PAD_CANVAS_WRAPPER_CLASSES,!a&&!c&&s.SIGN_PAD_CANVAS_WRAPPER_HOVER,a&&"bear-cursor-not-allowed",!a&&!c&&"bear-cursor-crosshair"),children:[u.jsx("canvas",{ref:i,className:"Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full bear-touch-none",style:{height:D},onMouseDown:I,onMouseMove:x,onMouseUp:R,onMouseLeave:R,onTouchStart:I,onTouchMove:x,onTouchEnd:R}),!h&&u.jsx("div",{className:S.cn("Bear-SignPad__placeholder",s.SIGN_PAD_PLACEHOLDER_CLASSES),children:U}),u.jsx("div",{className:S.cn("Bear-SignPad__line",s.SIGN_PAD_LINE_CLASSES)}),u.jsx("span",{className:S.cn("Bear-SignPad__x-mark",s.SIGN_PAD_X_MARK_CLASSES),children:"×"})]}),(N||m)&&u.jsxs("div",{className:S.cn("Bear-SignPad__actions",s.SIGN_PAD_ACTIONS_CLASSES),children:[N&&u.jsx(y.Button,{size:"sm",variant:"ghost",onClick:X,disabled:a||!h,children:j}),m&&u.jsx(y.Button,{size:"sm",variant:"primary",onClick:Y,disabled:a||!h,children:F})]})]})};exports.SignPad=V;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as T, jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as p, useState as B, useEffect as D, useCallback as l } from "react";
|
|
3
3
|
import { cn as _ } from "../../utils/cn.js";
|
|
4
4
|
import { Button as M } from "../Button/Button.js";
|
|
@@ -19,12 +19,12 @@ const ge = (U) => {
|
|
|
19
19
|
clearText: W = "Clear",
|
|
20
20
|
saveText: z = "Save",
|
|
21
21
|
outputFormat: f = te,
|
|
22
|
-
outputQuality:
|
|
22
|
+
outputQuality: v = re,
|
|
23
23
|
className: X,
|
|
24
24
|
testId: Y,
|
|
25
25
|
id: V,
|
|
26
26
|
...j
|
|
27
|
-
} = U, a = p(null), I = p(null),
|
|
27
|
+
} = U, a = p(null), I = p(null), A = p(null), P = p(!1), [h, G] = B(!1), [E, Q] = B(!1);
|
|
28
28
|
D(() => {
|
|
29
29
|
const e = () => {
|
|
30
30
|
Q(document.documentElement.classList.contains("dark"));
|
|
@@ -33,10 +33,10 @@ const ge = (U) => {
|
|
|
33
33
|
const t = new MutationObserver(e);
|
|
34
34
|
return t.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => t.disconnect();
|
|
35
35
|
}, []);
|
|
36
|
-
const k = F || (E ? se : ae),
|
|
36
|
+
const k = F || (E ? se : ae), b = H || (E ? ne : oe), u = l(() => {
|
|
37
37
|
const e = a.current, t = e == null ? void 0 : e.getContext("2d");
|
|
38
|
-
!e || !t || (t.fillStyle =
|
|
39
|
-
}, [
|
|
38
|
+
!e || !t || (t.fillStyle = b === "transparent" ? "rgba(0,0,0,0)" : b, t.fillRect(0, 0, e.width, e.height));
|
|
39
|
+
}, [b]);
|
|
40
40
|
D(() => {
|
|
41
41
|
const e = a.current, t = I.current;
|
|
42
42
|
if (!e || !t) return;
|
|
@@ -75,32 +75,32 @@ const ge = (U) => {
|
|
|
75
75
|
}, []), x = l((e) => {
|
|
76
76
|
if (n || s) return;
|
|
77
77
|
const t = g(e);
|
|
78
|
-
P.current = !0,
|
|
78
|
+
P.current = !0, A.current = t;
|
|
79
79
|
}, [n, s, g]), O = l((e) => {
|
|
80
80
|
if (!P.current || n || s) return;
|
|
81
|
-
const t = a.current, r = t == null ? void 0 : t.getContext("2d"), c =
|
|
81
|
+
const t = a.current, r = t == null ? void 0 : t.getContext("2d"), c = A.current;
|
|
82
82
|
if (!t || !r || !c) return;
|
|
83
83
|
const i = g(e);
|
|
84
|
-
r.beginPath(), r.moveTo(c.x, c.y), r.lineTo(i.x, i.y), r.strokeStyle = k, r.lineWidth = C, r.lineCap = "round", r.lineJoin = "round", r.stroke(),
|
|
85
|
-
}, [n, s, k, C, g]),
|
|
84
|
+
r.beginPath(), r.moveTo(c.x, c.y), r.lineTo(i.x, i.y), r.strokeStyle = k, r.lineWidth = C, r.lineCap = "round", r.lineJoin = "round", r.stroke(), A.current = i, G(!0);
|
|
85
|
+
}, [n, s, k, C, g]), N = l(() => {
|
|
86
86
|
if (P.current) {
|
|
87
87
|
const e = a.current;
|
|
88
88
|
if (e && o) {
|
|
89
|
-
const t = e.toDataURL(f,
|
|
89
|
+
const t = e.toDataURL(f, v);
|
|
90
90
|
o(t);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
P.current = !1,
|
|
94
|
-
}, [o, f,
|
|
93
|
+
P.current = !1, A.current = null;
|
|
94
|
+
}, [o, f, v]), J = l(() => {
|
|
95
95
|
const e = a.current, t = e == null ? void 0 : e.getContext("2d");
|
|
96
96
|
!e || !t || (t.clearRect(0, 0, e.width, e.height), u(), G(!1), o == null || o(null));
|
|
97
97
|
}, [u, o]), q = l(() => {
|
|
98
98
|
const e = a.current;
|
|
99
99
|
if (!e || !h) return;
|
|
100
|
-
const t = e.toDataURL(f,
|
|
100
|
+
const t = e.toDataURL(f, v);
|
|
101
101
|
o == null || o(t);
|
|
102
|
-
}, [h, o, f,
|
|
103
|
-
return /* @__PURE__ */
|
|
102
|
+
}, [h, o, f, v]);
|
|
103
|
+
return /* @__PURE__ */ T(
|
|
104
104
|
"div",
|
|
105
105
|
{
|
|
106
106
|
id: V,
|
|
@@ -114,13 +114,13 @@ const ge = (U) => {
|
|
|
114
114
|
),
|
|
115
115
|
...j,
|
|
116
116
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ T(
|
|
118
118
|
"div",
|
|
119
119
|
{
|
|
120
120
|
ref: I,
|
|
121
121
|
className: _(
|
|
122
122
|
"Bear-SignPad__canvas-wrapper bear-w-full bear-overflow-hidden",
|
|
123
|
-
"touch-none",
|
|
123
|
+
"bear-touch-none",
|
|
124
124
|
de,
|
|
125
125
|
!n && !s && ue,
|
|
126
126
|
n && "bear-cursor-not-allowed",
|
|
@@ -131,15 +131,15 @@ const ge = (U) => {
|
|
|
131
131
|
"canvas",
|
|
132
132
|
{
|
|
133
133
|
ref: a,
|
|
134
|
-
className: "Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full touch-none",
|
|
135
|
-
style: { height: m
|
|
134
|
+
className: "Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full bear-touch-none",
|
|
135
|
+
style: { height: m },
|
|
136
136
|
onMouseDown: x,
|
|
137
137
|
onMouseMove: O,
|
|
138
|
-
onMouseUp:
|
|
139
|
-
onMouseLeave:
|
|
138
|
+
onMouseUp: N,
|
|
139
|
+
onMouseLeave: N,
|
|
140
140
|
onTouchStart: x,
|
|
141
141
|
onTouchMove: O,
|
|
142
|
-
onTouchEnd:
|
|
142
|
+
onTouchEnd: N
|
|
143
143
|
}
|
|
144
144
|
),
|
|
145
145
|
!h && /* @__PURE__ */ d("div", { className: _("Bear-SignPad__placeholder", ce), children: K }),
|
|
@@ -148,7 +148,7 @@ const ge = (U) => {
|
|
|
148
148
|
]
|
|
149
149
|
}
|
|
150
150
|
),
|
|
151
|
-
(L || R) && /* @__PURE__ */
|
|
151
|
+
(L || R) && /* @__PURE__ */ T("div", { className: _("Bear-SignPad__actions", _e), children: [
|
|
152
152
|
L && /* @__PURE__ */ d(M, { size: "sm", variant: "ghost", onClick: J, disabled: n || !h, children: W }),
|
|
153
153
|
R && /* @__PURE__ */ d(M, { size: "sm", variant: "primary", onClick: q, disabled: n || !h, children: z })
|
|
154
154
|
] })
|
|
@@ -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"),S=require("react"),_=require("../../utils/cn.cjs"),d=require("./Skeleton.const.cjs"),j=require("./Skeleton.utils.cjs"),a=S.forwardRef(({variant:e="text",animation:r="pulse",width:l,height:s,borderRadius:o,count:i=1,gap:u=8,className:n,style:f,testId:k,...N},m)=>{S.useEffect(()=>{r==="wave"&&j.injectStyles()},[r]);const x=c=>{if(c!==void 0)return typeof c=="number"?`${c}px`:c},p={width:x(l),height:x(s)||(e==="text"?d.SKELETON_TEXT_HEIGHT:void 0),borderRadius:o?x(o):void 0,...f},y=_.cn(d.SKELETON_BASE_CLASSES,d.SKELETON_VARIANT_CLASSES[e],d.SKELETON_ANIMATION_CLASSES[r],d.SKELETON_BG_CLASSES,n);return i>1?t.jsx("div",{className:"Bear-Skeleton__group flex flex-col",style:{gap:x(u)},"data-testid":k,children:Array.from({length:i}).map((c,g)=>t.jsx("div",{ref:g===0?m:void 0,className:y,style:p,...N},g))}):t.jsx("div",{ref:m,className:y,style:p,"data-testid":k,...N})});a.displayName="Skeleton";const E=S.forwardRef(({lines:e=3,lastLineWidth:r="80%",gap:l=8,animation:s="pulse",...o},i)=>{S.useEffect(()=>{s==="wave"&&j.injectStyles()},[s]);const u=n=>{if(n!==void 0)return typeof n=="number"?`${n}px`:n};return t.jsx("div",{ref:i,className:"Bear-SkeletonText flex flex-col",style:{gap:u(l)},children:Array.from({length:e}).map((n,f)=>t.jsx(a,{variant:"text",animation:s,width:f===e-1?r:"100%",...o},f))})});E.displayName="SkeletonText";const h=S.forwardRef(({size:e="md",animation:r="pulse",...l},s)=>{const o=typeof e=="number"?e:d.SKELETON_AVATAR_SIZES[e];return t.jsx(a,{ref:s,variant:"circular",animation:r,width:o,height:o,...l})});h.displayName="SkeletonAvatar";const A=S.forwardRef(({animation:e="pulse",className:r,...l},s)=>t.jsxs("div",{ref:s,className:_.cn("Bear-SkeletonCard p-4 rounded-lg border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",r),...l,children:[t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsx(h,{animation:e}),t.jsxs("div",{className:"flex-1",children:[t.jsx(a,{animation:e,width:"60%",height:16,className:"mb-2"}),t.jsx(a,{animation:e,width:"40%",height:12})]})]}),t.jsx(E,{animation:e,lines:3})]}));A.displayName="SkeletonCard";exports.Skeleton=a;exports.SkeletonAvatar=h;exports.SkeletonCard=A;exports.SkeletonText=E;
|