@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.
Files changed (146) hide show
  1. package/README.md +19 -0
  2. package/dist/components/Anchor/Anchor.cjs +1 -1
  3. package/dist/components/Anchor/Anchor.js +37 -45
  4. package/dist/components/Anchor/Anchor.utils.cjs +1 -0
  5. package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
  6. package/dist/components/Anchor/Anchor.utils.js +12 -0
  7. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  8. package/dist/components/Autocomplete/Autocomplete.js +60 -67
  9. package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
  10. package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
  11. package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
  12. package/dist/components/BackTop/BackTop.cjs +1 -1
  13. package/dist/components/BackTop/BackTop.js +10 -11
  14. package/dist/components/Button/Button.cjs +1 -1
  15. package/dist/components/Button/Button.constants.cjs +2 -2
  16. package/dist/components/Button/Button.constants.d.ts +1 -0
  17. package/dist/components/Button/Button.constants.js +12 -5
  18. package/dist/components/Button/Button.d.ts +0 -27
  19. package/dist/components/Button/Button.js +93 -105
  20. package/dist/components/Button/Button.types.d.ts +1 -0
  21. package/dist/components/Button/Button.utils.cjs +1 -0
  22. package/dist/components/Button/Button.utils.d.ts +2 -0
  23. package/dist/components/Button/Button.utils.js +5 -0
  24. package/dist/components/Button/useSpotlight.cjs +1 -0
  25. package/dist/components/Button/useSpotlight.d.ts +21 -0
  26. package/dist/components/Button/useSpotlight.js +28 -0
  27. package/dist/components/Chart/Chart.cjs +1 -1
  28. package/dist/components/Chart/Chart.const.cjs +1 -0
  29. package/dist/components/Chart/Chart.const.js +21 -0
  30. package/dist/components/Chart/Chart.js +55 -71
  31. package/dist/components/Chart/Chart.utils.cjs +1 -0
  32. package/dist/components/Chart/Chart.utils.js +5 -0
  33. package/dist/components/Confetti/Confetti.cjs +1 -1
  34. package/dist/components/Confetti/Confetti.js +37 -34
  35. package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
  36. package/dist/components/ContextMenu/ContextMenu.js +31 -30
  37. package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
  38. package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
  39. package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
  40. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  41. package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
  42. package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
  43. package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
  44. package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
  45. package/dist/components/Dock/Dock.cjs +1 -1
  46. package/dist/components/Dock/Dock.js +38 -43
  47. package/dist/components/Dock/Dock.utils.cjs +1 -0
  48. package/dist/components/Dock/Dock.utils.d.ts +1 -0
  49. package/dist/components/Dock/Dock.utils.js +10 -0
  50. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  51. package/dist/components/Dropdown/Dropdown.js +59 -60
  52. package/dist/components/FileTree/FileTree.cjs +1 -1
  53. package/dist/components/FileTree/FileTree.js +20 -32
  54. package/dist/components/FileTree/FileTree.utils.cjs +1 -0
  55. package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
  56. package/dist/components/FileTree/FileTree.utils.js +15 -0
  57. package/dist/components/GradientText/GradientText.cjs +1 -1
  58. package/dist/components/GradientText/GradientText.js +27 -29
  59. package/dist/components/Icon/icons/bear.cjs +1 -0
  60. package/dist/components/Icon/icons/bear.d.ts +12 -0
  61. package/dist/components/Icon/icons/bear.js +47 -0
  62. package/dist/components/Icon/index.cjs +1 -1
  63. package/dist/components/Icon/index.d.ts +18 -0
  64. package/dist/components/Icon/index.js +17 -15
  65. package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
  66. package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
  67. package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
  68. package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
  69. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  70. package/dist/components/MentionsInput/MentionsInput.js +64 -68
  71. package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
  72. package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
  73. package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
  74. package/dist/components/PageNav/PageNav.cjs +1 -0
  75. package/dist/components/PageNav/PageNav.const.cjs +1 -0
  76. package/dist/components/PageNav/PageNav.const.d.ts +22 -0
  77. package/dist/components/PageNav/PageNav.const.js +42 -0
  78. package/dist/components/PageNav/PageNav.d.ts +3 -0
  79. package/dist/components/PageNav/PageNav.js +81 -0
  80. package/dist/components/PageNav/PageNav.types.d.ts +17 -0
  81. package/dist/components/PageNav/index.d.ts +2 -0
  82. package/dist/components/Progress/Progress.cjs +1 -1
  83. package/dist/components/Progress/Progress.js +6 -6
  84. package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
  85. package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
  86. package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
  87. package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
  88. package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
  89. package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
  90. package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
  91. package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
  92. package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
  93. package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
  94. package/dist/components/PropsPlayground/index.d.ts +2 -0
  95. package/dist/components/Select/Select.cjs +1 -1
  96. package/dist/components/Select/Select.js +28 -30
  97. package/dist/components/SignPad/SignPad.cjs +1 -1
  98. package/dist/components/SignPad/SignPad.js +24 -24
  99. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  100. package/dist/components/Skeleton/Skeleton.js +89 -94
  101. package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
  102. package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
  103. package/dist/components/Skeleton/Skeleton.utils.js +10 -0
  104. package/dist/components/SliderRange/SliderRange.cjs +1 -1
  105. package/dist/components/SliderRange/SliderRange.js +61 -63
  106. package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
  107. package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
  108. package/dist/components/SliderRange/SliderRange.utils.js +7 -0
  109. package/dist/components/Spotlight/Spotlight.cjs +1 -1
  110. package/dist/components/Spotlight/Spotlight.js +62 -73
  111. package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
  112. package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
  113. package/dist/components/Spotlight/Spotlight.utils.js +18 -0
  114. package/dist/components/Tabs/Tabs.cjs +1 -1
  115. package/dist/components/Tabs/Tabs.js +39 -38
  116. package/dist/components/Tabs/Tabs.types.d.ts +3 -1
  117. package/dist/components/Toast/Toast.cjs +1 -1
  118. package/dist/components/Toast/Toast.js +18 -17
  119. package/dist/components/Toast/Toast.utils.cjs +1 -0
  120. package/dist/components/Toast/Toast.utils.d.ts +1 -0
  121. package/dist/components/Toast/Toast.utils.js +4 -0
  122. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  123. package/dist/components/Tooltip/Tooltip.js +10 -11
  124. package/dist/components/Tour/Tour.cjs +1 -1
  125. package/dist/components/Tour/Tour.js +1 -2
  126. package/dist/components/VirtualList/VirtualList.cjs +1 -1
  127. package/dist/components/VirtualList/VirtualList.js +38 -43
  128. package/dist/components/index.cjs +1 -1
  129. package/dist/components/index.d.ts +4 -0
  130. package/dist/components/index.js +66 -62
  131. package/dist/hooks/index.cjs +1 -1
  132. package/dist/hooks/index.d.ts +2 -0
  133. package/dist/hooks/index.js +60 -58
  134. package/dist/hooks/useResizeObserver/index.d.ts +2 -0
  135. package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
  136. package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
  137. package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
  138. package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
  139. package/dist/icons.cjs +1 -0
  140. package/dist/icons.d.ts +2 -0
  141. package/dist/icons.js +6 -0
  142. package/dist/index.cjs +1 -1
  143. package/dist/index.js +175 -169
  144. package/dist/styles/_base.css +7 -3
  145. package/dist/styles.css +1 -1
  146. 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,3 @@
1
+ import { FC } from 'react';
2
+ import { PropsPlaygroundProps } from './PropsPlayground.types';
3
+ export declare const PropsPlayground: FC<PropsPlaygroundProps>;
@@ -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;
@@ -0,0 +1,2 @@
1
+ import { PropsConfig, PropValues } from './PropsPlayground.types';
2
+ export declare function getDefaults(config: PropsConfig): PropValues;
@@ -0,0 +1,9 @@
1
+ function c(e) {
2
+ const t = {};
3
+ for (const [o, n] of Object.entries(e))
4
+ t[o] = n.default;
5
+ return t;
6
+ }
7
+ export {
8
+ c as getDefaults
9
+ };
@@ -0,0 +1,2 @@
1
+ export { PropsPlayground } from './PropsPlayground';
2
+ export type { PropsPlaygroundProps, PropsConfig, PropValues, PropControlConfig, PropControlOption, PropControlType } from './PropsPlayground.types';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("react"),a=require("../../utils/cn.cjs"),f=require("../Icon/index.cjs"),j={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"},N=({options:u,value:t,onChange:s,placeholder:g="Select an option",label:x,error:l,disabled:n=!1,size:m="md",fullWidth:y=!1,className:h})=>{const[c,d]=i.useState(!1),o=i.useRef(null),k=!!l,b=u.find(e=>e.value===t);i.useEffect(()=>{const e=v=>{o.current&&!o.current.contains(v.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const w=e=>{s==null||s(e),d(!1)};return r.jsxs("div",{ref:o,className:a.cn("bear-relative bear-flex bear-flex-col bear-gap-1.5",y&&"bear-w-full"),children:[x&&r.jsx("label",{className:"bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300",children:x}),r.jsxs("button",{type:"button",disabled:n,onClick:()=>!n&&d(!c),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",n&&"bear-opacity-50 bear-cursor-not-allowed",j[m],h),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",c&&"bear-rotate-180")})]}),c&&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:u.map(e=>r.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>!e.disabled&&w(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=N;
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 i, jsx as r } from "react/jsx-runtime";
2
- import { useState as v, useRef as p, useEffect as N } from "react";
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 { ChevronDownIcon as j, CheckIcon as E } from "../Icon/index.js";
5
- const S = {
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
- }, O = ({
10
- options: f,
12
+ }, A = ({
13
+ options: i,
11
14
  value: t,
12
15
  onChange: s,
13
- placeholder: g = "Select an option",
14
- label: u,
16
+ placeholder: x = "Select an option",
17
+ label: f,
15
18
  error: l,
16
19
  disabled: o = !1,
17
- size: x = "md",
20
+ size: g = "md",
18
21
  fullWidth: m = !1,
19
22
  className: y
20
23
  }) => {
21
- const [d, n] = v(!1), c = p(null), h = !!l, b = f.find((e) => e.value === t);
22
- N(() => {
23
- const e = (w) => {
24
- c.current && !c.current.contains(w.target) && n(!1);
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__ */ i(
29
+ return /* @__PURE__ */ n(
32
30
  "div",
33
31
  {
34
- ref: c,
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
- u && /* @__PURE__ */ r("label", { className: "bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300", children: u }),
38
- /* @__PURE__ */ i(
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 && n(!d),
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
- S[x],
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) || g }),
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
- j,
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: f.map((e) => /* @__PURE__ */ i(
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 && k(e.value),
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(E, { className: "bear-w-4 bear-h-4 bear-text-bear-600 dark:bear-text-bear-400" })
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
- O as Select
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:a,width:p,height:b=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:o=!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=b;(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,b,_]),r.useEffect(()=>{_()},[_,E]),r.useEffect(()=>{const e=i.current;if(!e||o||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)}},[o,c]);const D=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(o||c)return;const t=D(e);g.current=!0,A.current=t},[o,c,D]),x=r.useCallback(e=>{if(!g.current||o||c)return;const t=i.current,n=t==null?void 0:t.getContext("2d"),l=A.current;if(!t||!n||!l)return;const d=D(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)},[o,c,k,T,D]),R=r.useCallback(()=>{if(g.current){const e=i.current;if(e&&a){const t=e.toDataURL(P,v);a(t)}}g.current=!1,A.current=null},[a,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),a==null||a(null))},[_,a]),Y=r.useCallback(()=>{const e=i.current;if(!e||!h)return;const t=e.toDataURL(P,v);a==null||a(t)},[h,a,P,v]);return u.jsxs("div",{id:q,"data-testid":K,className:S.cn("Bear-SignPad bear-w-full",s.SIGN_PAD_ROOT_CLASSES,o&&"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","touch-none",s.SIGN_PAD_CANVAS_WRAPPER_CLASSES,!o&&!c&&s.SIGN_PAD_CANVAS_WRAPPER_HOVER,o&&"bear-cursor-not-allowed",!o&&!c&&"bear-cursor-crosshair"),children:[u.jsx("canvas",{ref:i,className:"Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full touch-none",style:{height:b,touchAction:"none"},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:o||!h,children:j}),m&&u.jsx(y.Button,{size:"sm",variant:"primary",onClick:Y,disabled:o||!h,children:F})]})]})};exports.SignPad=V;
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 b, jsx as d } from "react/jsx-runtime";
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: A = re,
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), v = p(null), P = p(!1), [h, G] = B(!1), [E, Q] = B(!1);
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), N = H || (E ? ne : oe), u = l(() => {
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 = N === "transparent" ? "rgba(0,0,0,0)" : N, t.fillRect(0, 0, e.width, e.height));
39
- }, [N]);
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, v.current = t;
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 = v.current;
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(), v.current = i, G(!0);
85
- }, [n, s, k, C, g]), T = l(() => {
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, A);
89
+ const t = e.toDataURL(f, v);
90
90
  o(t);
91
91
  }
92
92
  }
93
- P.current = !1, v.current = null;
94
- }, [o, f, A]), J = l(() => {
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, A);
100
+ const t = e.toDataURL(f, v);
101
101
  o == null || o(t);
102
- }, [h, o, f, A]);
103
- return /* @__PURE__ */ b(
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__ */ b(
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, touchAction: "none" },
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: T,
139
- onMouseLeave: T,
138
+ onMouseUp: N,
139
+ onMouseLeave: N,
140
140
  onTouchStart: x,
141
141
  onTouchMove: O,
142
- onTouchEnd: T
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__ */ b("div", { className: _("Bear-SignPad__actions", _e), children: [
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 r=require("react/jsx-runtime"),c=require("react"),T=require("../../utils/cn.cjs"),d=require("./Skeleton.const.cjs"),_=()=>{const e="bear-skeleton-styles";if(typeof document<"u"&&!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=d.SKELETON_WAVE_STYLES,document.head.appendChild(t)}},a=c.forwardRef(({variant:e="text",animation:t="pulse",width:l,height:s,borderRadius:n,count:i=1,gap:E=8,className:o,style:f,testId:y,...h},p)=>{c.useEffect(()=>{t==="wave"&&_()},[t]);const x=S=>{if(S!==void 0)return typeof S=="number"?`${S}px`:S},N={width:x(l),height:x(s)||(e==="text"?d.SKELETON_TEXT_HEIGHT:void 0),borderRadius:n?x(n):void 0,...f},k=T.cn(d.SKELETON_BASE_CLASSES,d.SKELETON_VARIANT_CLASSES[e],d.SKELETON_ANIMATION_CLASSES[t],d.SKELETON_BG_CLASSES,o);return i>1?r.jsx("div",{className:"Bear-Skeleton__group flex flex-col",style:{gap:x(E)},"data-testid":y,children:Array.from({length:i}).map((S,g)=>r.jsx("div",{ref:g===0?p:void 0,className:k,style:N,...h},g))}):r.jsx("div",{ref:p,className:k,style:N,"data-testid":y,...h})});a.displayName="Skeleton";const u=c.forwardRef(({lines:e=3,lastLineWidth:t="80%",gap:l=8,animation:s="pulse",...n},i)=>{c.useEffect(()=>{s==="wave"&&_()},[s]);const E=o=>{if(o!==void 0)return typeof o=="number"?`${o}px`:o};return r.jsx("div",{ref:i,className:"Bear-SkeletonText flex flex-col",style:{gap:E(l)},children:Array.from({length:e}).map((o,f)=>r.jsx(a,{variant:"text",animation:s,width:f===e-1?t:"100%",...n},f))})});u.displayName="SkeletonText";const m=c.forwardRef(({size:e="md",animation:t="pulse",...l},s)=>{const n=typeof e=="number"?e:d.SKELETON_AVATAR_SIZES[e];return r.jsx(a,{ref:s,variant:"circular",animation:t,width:n,height:n,...l})});m.displayName="SkeletonAvatar";const A=c.forwardRef(({animation:e="pulse",className:t,...l},s)=>r.jsxs("div",{ref:s,className:T.cn("Bear-SkeletonCard p-4 rounded-lg border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",t),...l,children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx(m,{animation:e}),r.jsxs("div",{className:"flex-1",children:[r.jsx(a,{animation:e,width:"60%",height:16,className:"mb-2"}),r.jsx(a,{animation:e,width:"40%",height:12})]})]}),r.jsx(u,{animation:e,lines:3})]}));A.displayName="SkeletonCard";exports.Skeleton=a;exports.SkeletonAvatar=m;exports.SkeletonCard=A;exports.SkeletonText=u;
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;