@forgedevstack/bear 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +4 -0
  2. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  3. package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
  4. package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
  5. package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
  6. package/dist/components/Autocomplete/Autocomplete.js +110 -72
  7. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  8. package/dist/components/BottomSheet/BottomSheet.js +74 -53
  9. package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
  10. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  11. package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
  12. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
  13. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  14. package/dist/components/Cascader/Cascader.cjs +1 -1
  15. package/dist/components/Cascader/Cascader.const.cjs +1 -1
  16. package/dist/components/Cascader/Cascader.const.d.ts +1 -1
  17. package/dist/components/Cascader/Cascader.const.js +1 -1
  18. package/dist/components/Cascader/Cascader.js +109 -146
  19. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
  20. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
  21. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
  22. package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
  23. package/dist/components/Chart/BarChart.cjs +1 -0
  24. package/dist/components/Chart/BarChart.d.ts +3 -0
  25. package/dist/components/Chart/BarChart.js +65 -0
  26. package/dist/components/Chart/Chart.cjs +1 -1
  27. package/dist/components/Chart/Chart.const.cjs +1 -1
  28. package/dist/components/Chart/Chart.const.d.ts +7 -0
  29. package/dist/components/Chart/Chart.const.js +12 -2
  30. package/dist/components/Chart/Chart.d.ts +1 -13
  31. package/dist/components/Chart/Chart.js +18 -204
  32. package/dist/components/Chart/Chart.types.d.ts +7 -1
  33. package/dist/components/Chart/LineChart.cjs +1 -0
  34. package/dist/components/Chart/LineChart.d.ts +3 -0
  35. package/dist/components/Chart/LineChart.js +73 -0
  36. package/dist/components/Chart/PieChart.cjs +1 -0
  37. package/dist/components/Chart/PieChart.d.ts +3 -0
  38. package/dist/components/Chart/PieChart.js +110 -0
  39. package/dist/components/Chart/index.d.ts +4 -1
  40. package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
  41. package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
  42. package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
  43. package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
  44. package/dist/components/ColorPicker/ColorPicker.js +135 -73
  45. package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
  46. package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
  47. package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
  48. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  49. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
  50. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
  51. package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
  52. package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
  53. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
  54. package/dist/components/CreditInput/CreditInput.cjs +1 -1
  55. package/dist/components/CreditInput/CreditInput.js +80 -78
  56. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  57. package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
  58. package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
  59. package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
  60. package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
  61. package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
  62. package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
  63. package/dist/components/DiffSquares/DiffSquares.js +70 -0
  64. package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
  65. package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
  66. package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
  67. package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
  68. package/dist/components/DiffSquares/index.d.ts +2 -0
  69. package/dist/components/Drawer/Drawer.cjs +1 -1
  70. package/dist/components/Drawer/Drawer.js +41 -41
  71. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  72. package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
  73. package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
  74. package/dist/components/Dropdown/Dropdown.const.js +10 -0
  75. package/dist/components/Dropdown/Dropdown.d.ts +0 -1
  76. package/dist/components/Dropdown/Dropdown.js +102 -92
  77. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
  78. package/dist/components/Gauge/Gauge.cjs +1 -1
  79. package/dist/components/Gauge/Gauge.js +61 -50
  80. package/dist/components/Gauge/Gauge.types.d.ts +2 -0
  81. package/dist/components/HoverCard/HoverCard.cjs +6 -6
  82. package/dist/components/HoverCard/HoverCard.js +72 -54
  83. package/dist/components/Icon/icons/status.js +1 -1
  84. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  85. package/dist/components/MentionsInput/MentionsInput.js +106 -83
  86. package/dist/components/Menu/Menu.cjs +1 -1
  87. package/dist/components/Menu/Menu.js +91 -80
  88. package/dist/components/Modal/Modal.cjs +1 -1
  89. package/dist/components/Modal/Modal.const.cjs +1 -1
  90. package/dist/components/Modal/Modal.const.d.ts +1 -1
  91. package/dist/components/Modal/Modal.const.js +1 -1
  92. package/dist/components/Modal/Modal.js +50 -44
  93. package/dist/components/Modal/Modal.types.d.ts +6 -0
  94. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  95. package/dist/components/MultiSelect/MultiSelect.js +123 -78
  96. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
  97. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
  98. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
  99. package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
  100. package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
  101. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
  102. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
  103. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
  104. package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
  105. package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
  106. package/dist/components/OTPInput/OTPInput.cjs +1 -1
  107. package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
  108. package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
  109. package/dist/components/OTPInput/OTPInput.const.js +14 -0
  110. package/dist/components/OTPInput/OTPInput.js +99 -65
  111. package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
  112. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  113. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
  114. package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
  115. package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
  116. package/dist/components/PhoneInput/PhoneInput.js +88 -83
  117. package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
  118. package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
  119. package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
  120. package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
  121. package/dist/components/Popconfirm/Popconfirm.js +71 -51
  122. package/dist/components/Popover/Popover.cjs +1 -1
  123. package/dist/components/Popover/Popover.js +36 -31
  124. package/dist/components/Portal/Portal.cjs +1 -1
  125. package/dist/components/Portal/Portal.d.ts +0 -3
  126. package/dist/components/Portal/Portal.js +4 -10
  127. package/dist/components/Select/Select.cjs +1 -1
  128. package/dist/components/Select/Select.js +71 -51
  129. package/dist/components/Stepper/Stepper.cjs +1 -1
  130. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  131. package/dist/components/Stepper/Stepper.const.d.ts +3 -2
  132. package/dist/components/Stepper/Stepper.const.js +15 -14
  133. package/dist/components/Stepper/Stepper.d.ts +0 -7
  134. package/dist/components/Stepper/Stepper.js +164 -117
  135. package/dist/components/Stepper/Stepper.types.d.ts +3 -0
  136. package/dist/components/Tabs/TabList.cjs +1 -1
  137. package/dist/components/Tabs/TabList.js +72 -57
  138. package/dist/components/Tabs/Tabs.types.d.ts +4 -2
  139. package/dist/components/Tabs/index.d.ts +2 -2
  140. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
  141. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
  142. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  143. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
  144. package/dist/components/Toast/Toast.cjs +1 -1
  145. package/dist/components/Toast/Toast.js +86 -82
  146. package/dist/components/Toast/Toast.types.d.ts +2 -0
  147. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  148. package/dist/components/Tooltip/Tooltip.js +52 -44
  149. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  150. package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
  151. package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
  152. package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
  153. package/dist/components/TreeSelect/TreeSelect.js +120 -88
  154. package/dist/components/Watermark/Watermark.cjs +1 -1
  155. package/dist/components/Watermark/Watermark.const.cjs +1 -1
  156. package/dist/components/Watermark/Watermark.const.d.ts +6 -3
  157. package/dist/components/Watermark/Watermark.const.js +13 -11
  158. package/dist/components/Watermark/Watermark.js +87 -61
  159. package/dist/components/Watermark/Watermark.types.d.ts +2 -0
  160. package/dist/components/index.cjs +1 -1
  161. package/dist/components/index.d.ts +5 -3
  162. package/dist/components/index.js +292 -286
  163. package/dist/hooks/index.cjs +1 -1
  164. package/dist/hooks/index.d.ts +1 -1
  165. package/dist/hooks/index.js +55 -54
  166. package/dist/hooks/useClickOutside.cjs +1 -1
  167. package/dist/hooks/useClickOutside.d.ts +4 -11
  168. package/dist/hooks/useClickOutside.js +26 -7
  169. package/dist/index.cjs +1 -1
  170. package/dist/index.js +386 -379
  171. package/dist/styles/_effects.css +17 -0
  172. package/dist/styles.css +1 -1
  173. package/dist/utils/maxVisible.utils.cjs +1 -0
  174. package/dist/utils/maxVisible.utils.d.ts +12 -0
  175. package/dist/utils/maxVisible.utils.js +15 -0
  176. package/package.json +1 -1
  177. package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
  178. package/dist/components/HoverCard/HoverCard.utils.js +0 -23
@@ -1,209 +1,23 @@
1
- import { jsx as t, jsxs as f } from "react/jsx-runtime";
2
- import { useMemo as b } from "react";
3
- import { cn as d } from "../../utils/cn.js";
4
- import { getChartColor as k } from "./Chart.utils.js";
5
- const R = ({
6
- data: l,
7
- height: i = 200,
8
- showLabels: p = !0,
9
- showValues: $ = !1,
10
- animated: m = !0,
11
- color: h,
12
- orientation: g = "vertical",
13
- barRadius: u = 4,
14
- barGap: v = 0.2,
15
- className: y,
16
- ...N
17
- }) => {
18
- const n = Math.max(...l.map((s) => s.value));
19
- return /* @__PURE__ */ t("div", { className: d("w-full", y), style: { height: i }, ...N, children: g === "vertical" ? /* @__PURE__ */ t("div", { className: "flex items-end justify-between h-full gap-2", children: l.map((s, r) => {
20
- const e = s.value / n * 100, a = k(r, s.color || h);
21
- return /* @__PURE__ */ f("div", { className: "flex-1 flex flex-col items-center gap-1", children: [
22
- /* @__PURE__ */ t("div", { className: "w-full flex-1 flex items-end", children: /* @__PURE__ */ t(
23
- "div",
24
- {
25
- className: d(
26
- "w-full transition-all duration-500 ease-out",
27
- m && "animate-grow-up"
28
- ),
29
- style: {
30
- height: `${e}%`,
31
- backgroundColor: a,
32
- borderRadius: `${u}px ${u}px 0 0`,
33
- opacity: 0.9
34
- }
35
- }
36
- ) }),
37
- $ && /* @__PURE__ */ t("span", { className: "text-xs text-gray-500 dark:text-slate-400", children: s.value }),
38
- p && /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300 truncate max-w-full", children: s.label })
39
- ] }, r);
40
- }) }) : /* @__PURE__ */ t("div", { className: "flex flex-col justify-between h-full gap-2", children: l.map((s, r) => {
41
- const e = s.value / n * 100, a = k(r, s.color || h);
42
- return /* @__PURE__ */ f("div", { className: "flex-1 flex items-center gap-2", children: [
43
- p && /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300 w-16 truncate", children: s.label }),
44
- /* @__PURE__ */ t("div", { className: "flex-1 h-full flex items-center", children: /* @__PURE__ */ t(
45
- "div",
46
- {
47
- className: d(
48
- "h-3/4 transition-all duration-500 ease-out",
49
- m && "animate-grow-right"
50
- ),
51
- style: {
52
- width: `${e}%`,
53
- backgroundColor: a,
54
- borderRadius: `0 ${u}px ${u}px 0`,
55
- opacity: 0.9
56
- }
57
- }
58
- ) }),
59
- $ && /* @__PURE__ */ t("span", { className: "text-xs text-gray-500 dark:text-slate-400 w-10 text-right", children: s.value })
60
- ] }, r);
61
- }) }) });
62
- }, j = ({
63
- data: l,
64
- height: i = 200,
65
- showLabels: p = !0,
66
- showDots: $ = !0,
67
- smooth: m = !0,
68
- fill: h = !1,
69
- strokeWidth: g = 2,
70
- color: u = "#ec4899",
71
- animated: v = !0,
72
- className: y,
73
- ...N
74
- }) => {
75
- const n = b(() => {
76
- const e = Math.max(...l.map((c) => c.value)), a = Math.min(...l.map((c) => c.value)), o = e - a || 1;
77
- return l.map((c, x) => ({
78
- x: x / (l.length - 1 || 1) * 100,
79
- y: 100 - (c.value - a) / o * 80 - 10,
80
- ...c
81
- }));
82
- }, [l]), s = b(() => n.length === 0 ? "" : m ? n.reduce((e, a, o, c) => {
83
- if (o === 0) return `M ${a.x},${a.y}`;
84
- const x = c[o - 1], w = x.x + (a.x - x.x) / 3, C = a.x - (a.x - x.x) / 3;
85
- return `${e} C ${w},${x.y} ${C},${a.y} ${a.x},${a.y}`;
86
- }, "") : n.reduce((e, a, o) => `${e} ${o === 0 ? "M" : "L"} ${a.x},${a.y}`, ""), [n, m]), r = b(() => n.length === 0 ? "" : `${s} L 100,100 L 0,100 Z`, [s, n]);
87
- return /* @__PURE__ */ f("div", { className: d("w-full", y), style: { height: i }, ...N, children: [
88
- /* @__PURE__ */ f("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "w-full h-full", children: [
89
- /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ f("linearGradient", { id: "line-gradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
90
- /* @__PURE__ */ t("stop", { offset: "0%", stopColor: u, stopOpacity: "0.3" }),
91
- /* @__PURE__ */ t("stop", { offset: "100%", stopColor: u, stopOpacity: "0" })
92
- ] }) }),
93
- h && /* @__PURE__ */ t(
94
- "path",
95
- {
96
- d: r,
97
- fill: "url(#line-gradient)",
98
- className: d(v && "animate-fade-in")
99
- }
100
- ),
101
- /* @__PURE__ */ t(
102
- "path",
103
- {
104
- d: s,
105
- fill: "none",
106
- stroke: u,
107
- strokeWidth: g / 10,
108
- strokeLinecap: "round",
109
- strokeLinejoin: "round",
110
- className: d(v && "animate-draw-line")
111
- }
112
- ),
113
- $ && n.map((e, a) => /* @__PURE__ */ t(
114
- "circle",
115
- {
116
- cx: e.x,
117
- cy: e.y,
118
- r: 1.5,
119
- fill: u,
120
- className: d(v && "animate-scale-in"),
121
- style: { animationDelay: `${a * 50}ms` }
122
- },
123
- a
124
- ))
125
- ] }),
126
- p && /* @__PURE__ */ t("div", { className: "flex justify-between mt-2", children: l.map((e, a) => /* @__PURE__ */ t("span", { className: "text-xs text-gray-600 dark:text-slate-300", children: e.label }, a)) })
127
- ] });
128
- }, L = ({
129
- data: l,
130
- height: i = 200,
131
- showLabels: p = !0,
132
- innerRadius: $ = 0,
133
- startAngle: m = -90,
134
- padAngle: h = 2,
135
- animated: g = !0,
136
- className: u,
137
- ...v
138
- }) => {
139
- const y = l.reduce((r, e) => r + e.value, 0), N = b(() => {
140
- let r = m;
141
- return l.map((e, a) => {
142
- const o = e.value / y * 360 - h, c = {
143
- startAngle: r,
144
- endAngle: r + o,
145
- color: k(a, e.color),
146
- ...e
147
- };
148
- return r += o + h, c;
149
- });
150
- }, [l, y, m, h]), n = (r, e) => {
151
- const a = r * Math.PI / 180;
152
- return {
153
- x: 50 + e * Math.cos(a),
154
- y: 50 + e * Math.sin(a)
155
- };
156
- }, s = (r, e) => {
157
- const o = $ * 45, c = n(r, 45), x = n(e, 45), w = n(r, o), C = n(e, o), M = e - r > 180 ? 1 : 0;
158
- return $ > 0 ? `M ${c.x},${c.y} A 45,45 0 ${M},1 ${x.x},${x.y} L ${C.x},${C.y} A ${o},${o} 0 ${M},0 ${w.x},${w.y} Z` : `M 50,50 L ${c.x},${c.y} A 45,45 0 ${M},1 ${x.x},${x.y} Z`;
159
- };
160
- return /* @__PURE__ */ f("div", { className: d("flex items-center gap-4", u), ...v, children: [
161
- /* @__PURE__ */ t("div", { style: { width: i, height: i }, children: /* @__PURE__ */ t("svg", { viewBox: "0 0 100 100", className: "w-full h-full", children: N.map((r, e) => /* @__PURE__ */ t(
162
- "path",
163
- {
164
- d: s(r.startAngle, r.endAngle),
165
- fill: r.color,
166
- className: d(
167
- "transition-opacity hover:opacity-80",
168
- g && "animate-scale-in"
169
- ),
170
- style: { animationDelay: `${e * 100}ms` }
171
- },
172
- e
173
- )) }) }),
174
- p && /* @__PURE__ */ t("div", { className: "flex flex-col gap-2", children: l.map((r, e) => /* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
175
- /* @__PURE__ */ t(
176
- "div",
177
- {
178
- className: "w-3 h-3 rounded-full",
179
- style: { backgroundColor: k(e, r.color) }
180
- }
181
- ),
182
- /* @__PURE__ */ t("span", { className: "text-sm text-gray-600 dark:text-slate-300", children: r.label }),
183
- /* @__PURE__ */ f("span", { className: "text-sm text-gray-400 dark:text-slate-500", children: [
184
- Math.round(r.value / y * 100),
185
- "%"
186
- ] })
187
- ] }, e)) })
188
- ] });
189
- }, P = ({ type: l, ...i }) => {
190
- switch (l) {
191
- case "bar":
192
- return /* @__PURE__ */ t(R, { ...i });
193
- case "line":
194
- case "area":
195
- return /* @__PURE__ */ t(j, { ...i, fill: l === "area" });
196
- case "pie":
197
- return /* @__PURE__ */ t(L, { ...i });
198
- case "donut":
199
- return /* @__PURE__ */ t(L, { ...i, innerRadius: 0.6 });
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { BarChart as i } from "./BarChart.js";
3
+ import { LineChart as n } from "./LineChart.js";
4
+ import { PieChart as m } from "./PieChart.js";
5
+ import { CHART_TYPES as r, CHART as A } from "./Chart.const.js";
6
+ const E = ({ type: a, ...t }) => {
7
+ switch (a) {
8
+ case r.BAR:
9
+ return /* @__PURE__ */ e(i, { ...t });
10
+ case r.LINE:
11
+ case r.AREA:
12
+ return /* @__PURE__ */ e(n, { ...t, fill: a === r.AREA });
13
+ case r.PIE:
14
+ return /* @__PURE__ */ e(m, { ...t });
15
+ case r.DONUT:
16
+ return /* @__PURE__ */ e(m, { ...t, innerRadius: A.DEFAULT_INNER_RADIUS });
200
17
  default:
201
- return /* @__PURE__ */ t(R, { ...i });
18
+ return /* @__PURE__ */ e(i, { ...t });
202
19
  }
203
20
  };
204
21
  export {
205
- R as BarChart,
206
- P as Chart,
207
- j as LineChart,
208
- L as PieChart
22
+ E as Chart
209
23
  };
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes } from 'react';
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
2
  export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'donut';
3
3
  export interface ChartDataPoint {
4
4
  label: string;
@@ -48,4 +48,10 @@ export interface PieChartProps extends Omit<ChartProps, 'type'> {
48
48
  startAngle?: number;
49
49
  /** Padding between slices */
50
50
  padAngle?: number;
51
+ onSliceClick?: (item: ChartDataPoint, index: number) => void;
52
+ onSliceHover?: (item: ChartDataPoint | null, index: number | null) => void;
53
+ showSliceTooltip?: boolean;
54
+ sliceTooltipTitle?: (item: ChartDataPoint, index: number) => ReactNode;
55
+ sliceTooltipDescription?: (item: ChartDataPoint, index: number) => ReactNode;
56
+ sliceTooltipContent?: (item: ChartDataPoint, index: number) => ReactNode;
51
57
  }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),m=require("react"),u=require("../../utils/cn.cjs"),N=({data:a,height:y=200,showLabels:d=!0,showDots:h=!0,smooth:f=!0,fill:p=!1,strokeWidth:j=2,color:i="#ec4899",animated:x=!0,className:$,...g})=>{const n=m.useMemo(()=>{const t=Math.max(...a.map(r=>r.value)),e=Math.min(...a.map(r=>r.value)),l=t-e||1;return a.map((r,c)=>({x:c/(a.length-1||1)*100,y:100-(r.value-e)/l*80-10,...r}))},[a]),o=m.useMemo(()=>n.length===0?"":f?n.reduce((t,e,l,r)=>{if(l===0)return`M ${e.x},${e.y}`;const c=r[l-1],M=c.x+(e.x-c.x)/3,L=e.x-(e.x-c.x)/3;return`${t} C ${M},${c.y} ${L},${e.y} ${e.x},${e.y}`},""):n.reduce((t,e,l)=>`${t} ${l===0?"M":"L"} ${e.x},${e.y}`,""),[n,f]),v=m.useMemo(()=>n.length===0?"":`${o} L 100,100 L 0,100 Z`,[o,n]);return s.jsxs("div",{className:u.cn("w-full",$),style:{height:y},...g,children:[s.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"w-full h-full",children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"line-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[s.jsx("stop",{offset:"0%",stopColor:i,stopOpacity:"0.3"}),s.jsx("stop",{offset:"100%",stopColor:i,stopOpacity:"0"})]})}),p&&s.jsx("path",{d:v,fill:"url(#line-gradient)",className:u.cn(x&&"animate-fade-in")}),s.jsx("path",{d:o,fill:"none",stroke:i,strokeWidth:j/10,strokeLinecap:"round",strokeLinejoin:"round",className:u.cn(x&&"animate-draw-line")}),h&&n.map((t,e)=>s.jsx("circle",{cx:t.x,cy:t.y,r:1.5,fill:i,className:u.cn(x&&"animate-scale-in"),style:{animationDelay:`${e*50}ms`}},e))]}),d&&s.jsx("div",{className:"flex justify-between mt-2",children:a.map((t,e)=>s.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300",children:t.label},e))})]})};exports.LineChart=N;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { LineChartProps } from './Chart.types';
3
+ export declare const LineChart: FC<LineChartProps>;
@@ -0,0 +1,73 @@
1
+ import { jsxs as m, jsx as s } from "react/jsx-runtime";
2
+ import { useMemo as f } from "react";
3
+ import { cn as u } from "../../utils/cn.js";
4
+ const D = ({
5
+ data: a,
6
+ height: y = 200,
7
+ showLabels: d = !0,
8
+ showDots: h = !0,
9
+ smooth: p = !0,
10
+ fill: $ = !1,
11
+ strokeWidth: v = 2,
12
+ color: i = "#ec4899",
13
+ animated: x = !0,
14
+ className: g,
15
+ ...N
16
+ }) => {
17
+ const n = f(() => {
18
+ const r = Math.max(...a.map((t) => t.value)), e = Math.min(...a.map((t) => t.value)), l = r - e || 1;
19
+ return a.map((t, c) => ({
20
+ x: c / (a.length - 1 || 1) * 100,
21
+ y: 100 - (t.value - e) / l * 80 - 10,
22
+ ...t
23
+ }));
24
+ }, [a]), o = f(() => n.length === 0 ? "" : p ? n.reduce((r, e, l, t) => {
25
+ if (l === 0) return `M ${e.x},${e.y}`;
26
+ const c = t[l - 1], k = c.x + (e.x - c.x) / 3, w = e.x - (e.x - c.x) / 3;
27
+ return `${r} C ${k},${c.y} ${w},${e.y} ${e.x},${e.y}`;
28
+ }, "") : n.reduce((r, e, l) => `${r} ${l === 0 ? "M" : "L"} ${e.x},${e.y}`, ""), [n, p]), L = f(() => n.length === 0 ? "" : `${o} L 100,100 L 0,100 Z`, [o, n]);
29
+ return /* @__PURE__ */ m("div", { className: u("w-full", g), style: { height: y }, ...N, children: [
30
+ /* @__PURE__ */ m("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "w-full h-full", children: [
31
+ /* @__PURE__ */ s("defs", { children: /* @__PURE__ */ m("linearGradient", { id: "line-gradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
32
+ /* @__PURE__ */ s("stop", { offset: "0%", stopColor: i, stopOpacity: "0.3" }),
33
+ /* @__PURE__ */ s("stop", { offset: "100%", stopColor: i, stopOpacity: "0" })
34
+ ] }) }),
35
+ $ && /* @__PURE__ */ s(
36
+ "path",
37
+ {
38
+ d: L,
39
+ fill: "url(#line-gradient)",
40
+ className: u(x && "animate-fade-in")
41
+ }
42
+ ),
43
+ /* @__PURE__ */ s(
44
+ "path",
45
+ {
46
+ d: o,
47
+ fill: "none",
48
+ stroke: i,
49
+ strokeWidth: v / 10,
50
+ strokeLinecap: "round",
51
+ strokeLinejoin: "round",
52
+ className: u(x && "animate-draw-line")
53
+ }
54
+ ),
55
+ h && n.map((r, e) => /* @__PURE__ */ s(
56
+ "circle",
57
+ {
58
+ cx: r.x,
59
+ cy: r.y,
60
+ r: 1.5,
61
+ fill: i,
62
+ className: u(x && "animate-scale-in"),
63
+ style: { animationDelay: `${e * 50}ms` }
64
+ },
65
+ e
66
+ ))
67
+ ] }),
68
+ d && /* @__PURE__ */ s("div", { className: "flex justify-between mt-2", children: a.map((r, e) => /* @__PURE__ */ s("span", { className: "text-xs text-gray-600 dark:text-slate-300", children: r.label }, e)) })
69
+ ] });
70
+ };
71
+ export {
72
+ D as LineChart
73
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),b=require("react"),A=require("../../utils/cn.cjs"),X=require("../Portal/Portal.cjs"),g=require("../Card/Card.cjs"),L=require("./Chart.utils.cjs"),c=45,Y=({data:s,height:N=200,showLabels:R=!0,innerRadius:w=0,startAngle:P=-90,padAngle:f=2,animated:_=!0,onSliceClick:d,onSliceHover:x,showSliceTooltip:j=!0,sliceTooltipTitle:y,sliceTooltipDescription:m,sliceTooltipContent:v,className:B,...C})=>{const h=s.reduce((r,e)=>r+e.value,0),[n,o]=b.useState(null),q=b.useCallback((r,e,a)=>{const u=s[a];if(x==null||x(u,a),!j)return;const l=Math.round(u.value/h*100);o({x:r,y:e,index:a,label:u.label,value:u.value,pct:l})},[s,x,j,h]),E=b.useCallback(()=>{o(null),x==null||x(null,null)},[x]),O=b.useMemo(()=>{let r=P;return s.map((e,a)=>{const u=e.value/h*360-f,l={startAngle:r,endAngle:r+u,color:L.getChartColor(a,e.color),...e};return r+=u+f,l})},[s,h,P,f]),$=(r,e)=>{const a=r*Math.PI/180;return{x:50+e*Math.cos(a),y:50+e*Math.sin(a)}},U=(r,e)=>{const a=w*c,u=$(r,c),l=$(e,c),I=$(r,a),p=$(e,a),M=e-r>180?1:0;return w>0?`M ${u.x},${u.y} A ${c},${c} 0 ${M},1 ${l.x},${l.y} L ${p.x},${p.y} A ${a},${a} 0 ${M},0 ${I.x},${I.y} Z`:`M 50,50 L ${u.x},${u.y} A ${c},${c} 0 ${M},1 ${l.x},${l.y} Z`};return t.jsxs("div",{className:A.cn("relative flex max-w-full flex-wrap items-center gap-4",B),...C,children:[t.jsx("div",{style:{width:N,height:N},className:"min-w-0 shrink-0",children:t.jsx("svg",{viewBox:"0 0 100 100",className:"h-full w-full",children:O.map((r,e)=>t.jsx("path",{d:U(r.startAngle,r.endAngle),fill:r.color,className:A.cn(d&&"cursor-pointer","transition-opacity hover:opacity-80",_&&"animate-scale-in"),style:{animationDelay:`${e*100}ms`},onClick:()=>d==null?void 0:d(s[e],e),tabIndex:0,role:"button","aria-label":`${s[e].label} ${Math.round(s[e].value/h*100)}%`,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),d==null||d(s[e],e))},onMouseEnter:a=>q(a.clientX,a.clientY,e),onMouseMove:a=>q(a.clientX,a.clientY,e),onMouseLeave:E},e))})}),R&&t.jsx("div",{className:"flex flex-col gap-2",children:s.map((r,e)=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:L.getChartColor(e,r.color)}}),t.jsx("span",{className:"text-sm text-gray-600 dark:text-slate-300",children:r.label}),t.jsxs("span",{className:"text-sm text-gray-400 dark:text-slate-500",children:[Math.round(r.value/h*100),"%"]})]},e))}),n&&j&&t.jsx(X.Portal,{children:t.jsx("div",{className:"pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]",style:{left:n.x+12,top:n.y+12},children:t.jsxs(g.Card,{variant:"elevated",padding:"none",children:[(y||m)&&t.jsx(g.CardHeader,{title:(y==null?void 0:y(s[n.index],n.index))??n.label,subtitle:m==null?void 0:m(s[n.index],n.index)}),t.jsx(g.CardBody,{className:"bear-text-xs bear-text-gray-500 dark:bear-text-slate-400",children:(v==null?void 0:v(s[n.index],n.index))??t.jsxs("span",{children:[n.value," (",n.pct,"%)"]})})]})})})]})};exports.PieChart=Y;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { PieChartProps } from './Chart.types';
3
+ export declare const PieChart: FC<PieChartProps>;
@@ -0,0 +1,110 @@
1
+ import { jsxs as h, jsx as u } from "react/jsx-runtime";
2
+ import { useState as K, useCallback as L, useMemo as O } from "react";
3
+ import { cn as j } from "../../utils/cn.js";
4
+ import { Portal as R } from "../Portal/Portal.js";
5
+ import { Card as q, CardHeader as F, CardBody as G } from "../Card/Card.js";
6
+ import { getChartColor as B } from "./Chart.utils.js";
7
+ const l = 45, C = ({
8
+ data: t,
9
+ height: N = 200,
10
+ showLabels: E = !0,
11
+ innerRadius: g = 0,
12
+ startAngle: w = -90,
13
+ padAngle: b = 2,
14
+ animated: U = !0,
15
+ onSliceClick: d,
16
+ onSliceHover: x,
17
+ showSliceTooltip: v = !0,
18
+ sliceTooltipTitle: y,
19
+ sliceTooltipDescription: f,
20
+ sliceTooltipContent: M,
21
+ className: X,
22
+ ...Y
23
+ }) => {
24
+ const $ = t.reduce((e, r) => e + r.value, 0), [n, o] = K(null), I = L(
25
+ (e, r, a) => {
26
+ const s = t[a];
27
+ if (x == null || x(s, a), !v) return;
28
+ const m = Math.round(s.value / $ * 100);
29
+ o({ x: e, y: r, index: a, label: s.label, value: s.value, pct: m });
30
+ },
31
+ [t, x, v, $]
32
+ ), Z = L(() => {
33
+ o(null), x == null || x(null, null);
34
+ }, [x]), _ = O(() => {
35
+ let e = w;
36
+ return t.map((r, a) => {
37
+ const s = r.value / $ * 360 - b, m = {
38
+ startAngle: e,
39
+ endAngle: e + s,
40
+ color: B(a, r.color),
41
+ ...r
42
+ };
43
+ return e += s + b, m;
44
+ });
45
+ }, [t, $, w, b]), c = (e, r) => {
46
+ const a = e * Math.PI / 180;
47
+ return { x: 50 + r * Math.cos(a), y: 50 + r * Math.sin(a) };
48
+ }, z = (e, r) => {
49
+ const a = g * l, s = c(e, l), m = c(r, l), P = c(e, a), A = c(r, a), p = r - e > 180 ? 1 : 0;
50
+ return g > 0 ? `M ${s.x},${s.y} A ${l},${l} 0 ${p},1 ${m.x},${m.y} L ${A.x},${A.y} A ${a},${a} 0 ${p},0 ${P.x},${P.y} Z` : `M 50,50 L ${s.x},${s.y} A ${l},${l} 0 ${p},1 ${m.x},${m.y} Z`;
51
+ };
52
+ return /* @__PURE__ */ h("div", { className: j("relative flex max-w-full flex-wrap items-center gap-4", X), ...Y, children: [
53
+ /* @__PURE__ */ u("div", { style: { width: N, height: N }, className: "min-w-0 shrink-0", children: /* @__PURE__ */ u("svg", { viewBox: "0 0 100 100", className: "h-full w-full", children: _.map((e, r) => /* @__PURE__ */ u(
54
+ "path",
55
+ {
56
+ d: z(e.startAngle, e.endAngle),
57
+ fill: e.color,
58
+ className: j(
59
+ d && "cursor-pointer",
60
+ "transition-opacity hover:opacity-80",
61
+ U && "animate-scale-in"
62
+ ),
63
+ style: { animationDelay: `${r * 100}ms` },
64
+ onClick: () => d == null ? void 0 : d(t[r], r),
65
+ tabIndex: 0,
66
+ role: "button",
67
+ "aria-label": `${t[r].label} ${Math.round(t[r].value / $ * 100)}%`,
68
+ onKeyDown: (a) => {
69
+ (a.key === "Enter" || a.key === " ") && (a.preventDefault(), d == null || d(t[r], r));
70
+ },
71
+ onMouseEnter: (a) => I(a.clientX, a.clientY, r),
72
+ onMouseMove: (a) => I(a.clientX, a.clientY, r),
73
+ onMouseLeave: Z
74
+ },
75
+ r
76
+ )) }) }),
77
+ E && /* @__PURE__ */ u("div", { className: "flex flex-col gap-2", children: t.map((e, r) => /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
78
+ /* @__PURE__ */ u(
79
+ "div",
80
+ {
81
+ className: "w-3 h-3 rounded-full",
82
+ style: { backgroundColor: B(r, e.color) }
83
+ }
84
+ ),
85
+ /* @__PURE__ */ u("span", { className: "text-sm text-gray-600 dark:text-slate-300", children: e.label }),
86
+ /* @__PURE__ */ h("span", { className: "text-sm text-gray-400 dark:text-slate-500", children: [
87
+ Math.round(e.value / $ * 100),
88
+ "%"
89
+ ] })
90
+ ] }, r)) }),
91
+ n && v && /* @__PURE__ */ u(R, { children: /* @__PURE__ */ u("div", { className: "pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]", style: { left: n.x + 12, top: n.y + 12 }, children: /* @__PURE__ */ h(q, { variant: "elevated", padding: "none", children: [
92
+ (y || f) && /* @__PURE__ */ u(
93
+ F,
94
+ {
95
+ title: (y == null ? void 0 : y(t[n.index], n.index)) ?? n.label,
96
+ subtitle: f == null ? void 0 : f(t[n.index], n.index)
97
+ }
98
+ ),
99
+ /* @__PURE__ */ u(G, { className: "bear-text-xs bear-text-gray-500 dark:bear-text-slate-400", children: (M == null ? void 0 : M(t[n.index], n.index)) ?? /* @__PURE__ */ h("span", { children: [
100
+ n.value,
101
+ " (",
102
+ n.pct,
103
+ "%)"
104
+ ] }) })
105
+ ] }) }) })
106
+ ] });
107
+ };
108
+ export {
109
+ C as PieChart
110
+ };
@@ -1,2 +1,5 @@
1
- export { Chart, BarChart, LineChart, PieChart } from './Chart';
1
+ export { Chart } from './Chart';
2
+ export { BarChart } from './BarChart';
3
+ export { LineChart } from './LineChart';
4
+ export { PieChart } from './PieChart';
2
5
  export type { ChartProps, BarChartProps, LineChartProps, PieChartProps, ChartDataPoint, ChartType, } from './Chart.types';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),E=require("react"),_=require("../../utils/cn.cjs"),t=require("./ColorPicker.const.cjs"),p=({value:c=t.COLOR_PICKER_DEFAULT_VALUE,onChange:s,presets:R=t.COLOR_PICKER_DEFAULT_PRESETS,showInput:O=!0,showPresets:L=!0,disabled:a=!1,label:S,size:P="md",className:I})=>{const[o,u]=E.useState(!1),[d,n]=E.useState(c),i=E.useRef(null);E.useEffect(()=>{n(c)},[c]),E.useEffect(()=>{const e=l=>{i.current&&!i.current.contains(l.target)&&u(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const m=e=>{const l=e.target.value;n(l),t.COLOR_PICKER_HEX_PATTERN.test(l)&&(s==null||s(l))},A=e=>{n(e),s==null||s(e)},C=t.COLOR_PICKER_SWATCH_SIZE[P];return r.jsxs("div",{ref:i,className:_.cn("bear-relative bear-inline-block",I),children:[S&&r.jsx("label",{className:t.COLOR_PICKER_LABEL_CLASSES,children:S}),r.jsxs("div",{className:"bear-flex bear-items-center bear-gap-2",children:[r.jsx("button",{type:"button",onClick:()=>!a&&u(!o),disabled:a,className:_.cn(t.COLOR_PICKER_SWATCH_CLASSES,C.swatch,a&&"bear-opacity-50 bear-cursor-not-allowed"),style:{backgroundColor:c},"aria-label":"Pick color"}),O&&r.jsx("input",{type:"text",value:d,onChange:m,disabled:a,placeholder:"#000000",className:_.cn(t.COLOR_PICKER_INPUT_CLASSES,a&&"bear-opacity-50 bear-cursor-not-allowed")})]}),o&&r.jsxs("div",{className:t.COLOR_PICKER_POPUP_CLASSES,children:[r.jsx("input",{type:"color",value:c,onChange:e=>{s==null||s(e.target.value),n(e.target.value)},className:t.COLOR_PICKER_NATIVE_INPUT_CLASSES}),L&&r.jsx("div",{className:t.COLOR_PICKER_GRID_CLASSES,children:R.map(e=>r.jsx("button",{type:"button",onClick:()=>A(e),className:_.cn(t.COLOR_PICKER_PRESET_ITEM_CLASSES,C.presetSwatch,c===e?t.COLOR_PICKER_PRESET_ACTIVE_CLASSES:t.COLOR_PICKER_PRESET_INACTIVE_CLASSES),style:{backgroundColor:e},"aria-label":`Color ${e}`},e))})]})]})};exports.ColorPicker=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),n=require("react"),f=require("../../utils/cn.cjs"),j=require("../Portal/Portal.cjs"),s=require("./ColorPicker.const.cjs"),u=require("./ColorPicker.utils.cjs"),H=({value:l=s.COLOR_PICKER_DEFAULT_VALUE,onChange:a,presets:x=s.COLOR_PICKER_DEFAULT_PRESETS,showInput:g=!0,showPresets:T=!0,disabled:R=!1,label:P,size:w="md",className:A})=>{const[i,S]=n.useState(!1),[y,_]=n.useState(l),[E,d]=n.useState({h:330,s:80,v:90}),[p,K]=n.useState({top:0,left:0}),b=n.useRef(null),O=n.useRef(null),L=n.useRef(null),m=n.useRef(E);m.current=E,n.useEffect(()=>{_(l)},[l]),n.useEffect(()=>{if(!i||!b.current)return;const e=()=>{const t=b.current.getBoundingClientRect(),r=256;let o=t.left;o=Math.max(8,Math.min(o,window.innerWidth-r-8)),K({top:t.bottom+8,left:o})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[i]),n.useEffect(()=>{if(i){const e=u.hexToRgb(l);e&&d(u.rgbToHsv(e.r,e.g,e.b))}},[i,l]),n.useEffect(()=>{if(!i)return;const e=t=>{var o,C;const r=t.target;(o=b.current)!=null&&o.contains(r)||(C=O.current)!=null&&C.contains(r)||S(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);const I=(e,t,r)=>{d({h:e,s:t,v:r});const o=u.hsvToHex(e,t,r);a==null||a(o),_(o)},h=e=>{const t=L.current;if(!t)return;const r=t.getBoundingClientRect(),o=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width)),C=Math.max(0,Math.min(1,(e.clientY-r.top)/r.height));I(m.current.h,o*100,(1-C)*100)},N=e=>{const t=e.target.value;if(_(t),s.COLOR_PICKER_HEX_PATTERN.test(t)){a==null||a(t);const r=u.hexToRgb(t);r&&d(u.rgbToHsv(r.r,r.g,r.b))}},k=e=>{_(e),a==null||a(e);const t=u.hexToRgb(e);t&&d(u.rgbToHsv(t.r,t.g,t.b))},v=s.COLOR_PICKER_SWATCH_SIZE[w];return c.jsxs("div",{ref:b,className:f.cn("bear-relative bear-inline-block",A),children:[P&&c.jsx("label",{className:s.COLOR_PICKER_LABEL_CLASSES,children:P}),c.jsxs("div",{className:"bear-flex bear-items-center bear-gap-2",children:[c.jsx("button",{type:"button",onClick:()=>!R&&S(!i),disabled:R,className:f.cn(s.COLOR_PICKER_SWATCH_CLASSES,v.swatch,R&&"bear-opacity-50 bear-cursor-not-allowed"),style:{backgroundColor:l},"aria-label":"Pick color"}),g&&c.jsx("input",{type:"text",value:y,onChange:N,disabled:R,placeholder:"#000000",className:f.cn(s.COLOR_PICKER_INPUT_CLASSES,R&&"bear-opacity-50 bear-cursor-not-allowed")})]}),i&&c.jsx(j.Portal,{children:c.jsxs("div",{ref:O,className:s.COLOR_PICKER_POPUP_CLASSES,style:{position:"fixed",top:p.top,left:p.left,zIndex:s.COLOR_PICKER_POPUP_Z_INDEX},children:[c.jsx("div",{ref:L,role:"presentation",className:"bear-relative bear-mb-3 bear-h-28 bear-w-full bear-cursor-crosshair bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-touch-none",style:{backgroundImage:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${Math.round(E.h)}, 100%, 50%))`},onPointerDown:e=>{h(e),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{(e.pressure>0||e.buttons>0)&&h(e)}}),c.jsx("input",{type:"range",min:0,max:359,value:Math.round(E.h),"aria-label":"Hue",onChange:e=>I(Number(e.target.value),E.s,E.v),className:s.COLOR_PICKER_HUE_STRIP_CLASSES,style:{background:s.COLOR_PICKER_HUE_BACKGROUND}}),T&&c.jsx("div",{className:s.COLOR_PICKER_GRID_CLASSES,children:x.map(e=>c.jsx("button",{type:"button",onClick:()=>k(e),className:f.cn(s.COLOR_PICKER_PRESET_ITEM_CLASSES,v.presetSwatch,l===e?s.COLOR_PICKER_PRESET_ACTIVE_CLASSES:s.COLOR_PICKER_PRESET_INACTIVE_CLASSES),style:{backgroundColor:e},"aria-label":`Color ${e}`},e))})]})})]})};exports.ColorPicker=H;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="#ec4899",e=/^#[0-9A-Fa-f]{6}$/,a=["#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#64748b","#1e293b","#000000","#ffffff"],b={sm:{swatch:"bear-w-6 bear-h-6",presetSwatch:"bear-w-5 bear-h-5"},md:{swatch:"bear-w-8 bear-h-8",presetSwatch:"bear-w-6 bear-h-6"},lg:{swatch:"bear-w-10 bear-h-10",presetSwatch:"bear-w-7 bear-h-7"}},_="bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5",E="bear-px-3 bear-py-1.5 bear-rounded-lg bear-border bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-text-sm bear-font-mono bear-w-24 bear-outline-none bear-border-gray-300 dark:bear-border-zinc-600 focus:bear-border-pink-500",C="bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-transition-all hover:bear-scale-105 bear-shadow-sm",S="bear-absolute bear-z-50 bear-mt-2 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4 bear-animate-in bear-fade-in bear-slide-in-from-top-1 bear-duration-150",R="bear-w-full bear-h-32 bear-rounded-lg bear-cursor-pointer bear-mb-3 bear-border bear-border-gray-200 dark:bear-border-zinc-600",o="bear-border-gray-900 dark:bear-border-white bear-ring-2 bear-ring-pink-500",t="bear-border-gray-300 dark:bear-border-zinc-600",O="bear-rounded bear-border bear-transition-transform hover:bear-scale-110 bear-shadow-sm",L="bear-grid bear-grid-cols-6 bear-gap-1.5";exports.COLOR_PICKER_DEFAULT_PRESETS=a;exports.COLOR_PICKER_DEFAULT_VALUE=r;exports.COLOR_PICKER_GRID_CLASSES=L;exports.COLOR_PICKER_HEX_PATTERN=e;exports.COLOR_PICKER_INPUT_CLASSES=E;exports.COLOR_PICKER_LABEL_CLASSES=_;exports.COLOR_PICKER_NATIVE_INPUT_CLASSES=R;exports.COLOR_PICKER_POPUP_CLASSES=S;exports.COLOR_PICKER_PRESET_ACTIVE_CLASSES=o;exports.COLOR_PICKER_PRESET_INACTIVE_CLASSES=t;exports.COLOR_PICKER_PRESET_ITEM_CLASSES=O;exports.COLOR_PICKER_SWATCH_CLASSES=C;exports.COLOR_PICKER_SWATCH_SIZE=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="#ec4899",e=/^#[0-9A-Fa-f]{6}$/,a=["#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#64748b","#1e293b","#000000","#ffffff"],b={sm:{swatch:"bear-w-6 bear-h-6",presetSwatch:"bear-w-5 bear-h-5"},md:{swatch:"bear-w-8 bear-h-8",presetSwatch:"bear-w-6 bear-h-6"},lg:{swatch:"bear-w-10 bear-h-10",presetSwatch:"bear-w-7 bear-h-7"}},_="bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5",E="bear-px-3 bear-py-1.5 bear-rounded-lg bear-border bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-text-sm bear-font-mono bear-w-24 bear-outline-none bear-border-gray-300 dark:bear-border-zinc-600 focus:bear-border-pink-500",C="bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-transition-all hover:bear-scale-105 bear-shadow-sm",S="bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4 bear-animate-in bear-fade-in bear-duration-150 bear-w-64",R="bear-w-full bear-h-2 bear-rounded-full bear-cursor-pointer bear-appearance-none bear-border-0 bear-mb-3",O="bear-border-gray-900 dark:bear-border-white bear-ring-2 bear-ring-pink-500",o="bear-border-gray-300 dark:bear-border-zinc-600",t="bear-rounded bear-border bear-transition-transform hover:bear-scale-110 bear-shadow-sm",L="bear-grid bear-grid-cols-6 bear-gap-1.5",P=11e3,n="linear-gradient(to right,#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100%)";exports.COLOR_PICKER_DEFAULT_PRESETS=a;exports.COLOR_PICKER_DEFAULT_VALUE=r;exports.COLOR_PICKER_GRID_CLASSES=L;exports.COLOR_PICKER_HEX_PATTERN=e;exports.COLOR_PICKER_HUE_BACKGROUND=n;exports.COLOR_PICKER_HUE_STRIP_CLASSES=R;exports.COLOR_PICKER_INPUT_CLASSES=E;exports.COLOR_PICKER_LABEL_CLASSES=_;exports.COLOR_PICKER_POPUP_CLASSES=S;exports.COLOR_PICKER_POPUP_Z_INDEX=P;exports.COLOR_PICKER_PRESET_ACTIVE_CLASSES=O;exports.COLOR_PICKER_PRESET_INACTIVE_CLASSES=o;exports.COLOR_PICKER_PRESET_ITEM_CLASSES=t;exports.COLOR_PICKER_SWATCH_CLASSES=C;exports.COLOR_PICKER_SWATCH_SIZE=b;
@@ -18,9 +18,11 @@ export declare const COLOR_PICKER_SWATCH_SIZE: {
18
18
  export declare const COLOR_PICKER_LABEL_CLASSES = "bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5";
19
19
  export declare const COLOR_PICKER_INPUT_CLASSES = "bear-px-3 bear-py-1.5 bear-rounded-lg bear-border bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-text-sm bear-font-mono bear-w-24 bear-outline-none bear-border-gray-300 dark:bear-border-zinc-600 focus:bear-border-pink-500";
20
20
  export declare const COLOR_PICKER_SWATCH_CLASSES = "bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-transition-all hover:bear-scale-105 bear-shadow-sm";
21
- export declare const COLOR_PICKER_POPUP_CLASSES = "bear-absolute bear-z-50 bear-mt-2 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4 bear-animate-in bear-fade-in bear-slide-in-from-top-1 bear-duration-150";
22
- export declare const COLOR_PICKER_NATIVE_INPUT_CLASSES = "bear-w-full bear-h-32 bear-rounded-lg bear-cursor-pointer bear-mb-3 bear-border bear-border-gray-200 dark:bear-border-zinc-600";
21
+ export declare const COLOR_PICKER_POPUP_CLASSES = "bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4 bear-animate-in bear-fade-in bear-duration-150 bear-w-64";
22
+ export declare const COLOR_PICKER_HUE_STRIP_CLASSES = "bear-w-full bear-h-2 bear-rounded-full bear-cursor-pointer bear-appearance-none bear-border-0 bear-mb-3";
23
23
  export declare const COLOR_PICKER_PRESET_ACTIVE_CLASSES = "bear-border-gray-900 dark:bear-border-white bear-ring-2 bear-ring-pink-500";
24
24
  export declare const COLOR_PICKER_PRESET_INACTIVE_CLASSES = "bear-border-gray-300 dark:bear-border-zinc-600";
25
25
  export declare const COLOR_PICKER_PRESET_ITEM_CLASSES = "bear-rounded bear-border bear-transition-transform hover:bear-scale-110 bear-shadow-sm";
26
26
  export declare const COLOR_PICKER_GRID_CLASSES = "bear-grid bear-grid-cols-6 bear-gap-1.5";
27
+ export declare const COLOR_PICKER_POPUP_Z_INDEX = 11000;
28
+ export declare const COLOR_PICKER_HUE_BACKGROUND = "linear-gradient(to right,#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100%)";
@@ -20,19 +20,21 @@ const r = "#ec4899", e = /^#[0-9A-Fa-f]{6}$/, a = [
20
20
  sm: { swatch: "bear-w-6 bear-h-6", presetSwatch: "bear-w-5 bear-h-5" },
21
21
  md: { swatch: "bear-w-8 bear-h-8", presetSwatch: "bear-w-6 bear-h-6" },
22
22
  lg: { swatch: "bear-w-10 bear-h-10", presetSwatch: "bear-w-7 bear-h-7" }
23
- }, o = "bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5", t = "bear-px-3 bear-py-1.5 bear-rounded-lg bear-border bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-text-sm bear-font-mono bear-w-24 bear-outline-none bear-border-gray-300 dark:bear-border-zinc-600 focus:bear-border-pink-500", d = "bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-transition-all hover:bear-scale-105 bear-shadow-sm", n = "bear-absolute bear-z-50 bear-mt-2 bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4 bear-animate-in bear-fade-in bear-slide-in-from-top-1 bear-duration-150", _ = "bear-w-full bear-h-32 bear-rounded-lg bear-cursor-pointer bear-mb-3 bear-border bear-border-gray-200 dark:bear-border-zinc-600", E = "bear-border-gray-900 dark:bear-border-white bear-ring-2 bear-ring-pink-500", C = "bear-border-gray-300 dark:bear-border-zinc-600", S = "bear-rounded bear-border bear-transition-transform hover:bear-scale-110 bear-shadow-sm", c = "bear-grid bear-grid-cols-6 bear-gap-1.5";
23
+ }, o = "bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5", t = "bear-px-3 bear-py-1.5 bear-rounded-lg bear-border bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-text-sm bear-font-mono bear-w-24 bear-outline-none bear-border-gray-300 dark:bear-border-zinc-600 focus:bear-border-pink-500", n = "bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-transition-all hover:bear-scale-105 bear-shadow-sm", _ = "bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4 bear-animate-in bear-fade-in bear-duration-150 bear-w-64", d = "bear-w-full bear-h-2 bear-rounded-full bear-cursor-pointer bear-appearance-none bear-border-0 bear-mb-3", E = "bear-border-gray-900 dark:bear-border-white bear-ring-2 bear-ring-pink-500", C = "bear-border-gray-300 dark:bear-border-zinc-600", c = "bear-rounded bear-border bear-transition-transform hover:bear-scale-110 bear-shadow-sm", S = "bear-grid bear-grid-cols-6 bear-gap-1.5", R = 11e3, s = "linear-gradient(to right,#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100%)";
24
24
  export {
25
25
  a as COLOR_PICKER_DEFAULT_PRESETS,
26
26
  r as COLOR_PICKER_DEFAULT_VALUE,
27
- c as COLOR_PICKER_GRID_CLASSES,
27
+ S as COLOR_PICKER_GRID_CLASSES,
28
28
  e as COLOR_PICKER_HEX_PATTERN,
29
+ s as COLOR_PICKER_HUE_BACKGROUND,
30
+ d as COLOR_PICKER_HUE_STRIP_CLASSES,
29
31
  t as COLOR_PICKER_INPUT_CLASSES,
30
32
  o as COLOR_PICKER_LABEL_CLASSES,
31
- _ as COLOR_PICKER_NATIVE_INPUT_CLASSES,
32
- n as COLOR_PICKER_POPUP_CLASSES,
33
+ _ as COLOR_PICKER_POPUP_CLASSES,
34
+ R as COLOR_PICKER_POPUP_Z_INDEX,
33
35
  E as COLOR_PICKER_PRESET_ACTIVE_CLASSES,
34
36
  C as COLOR_PICKER_PRESET_INACTIVE_CLASSES,
35
- S as COLOR_PICKER_PRESET_ITEM_CLASSES,
36
- d as COLOR_PICKER_SWATCH_CLASSES,
37
+ c as COLOR_PICKER_PRESET_ITEM_CLASSES,
38
+ n as COLOR_PICKER_SWATCH_CLASSES,
37
39
  b as COLOR_PICKER_SWATCH_SIZE
38
40
  };