@overdoser/react-toolkit 0.6.0 → 0.8.0

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 (116) hide show
  1. package/AGENTS.md +6 -0
  2. package/CHANGELOG.md +82 -0
  3. package/components/ActionButton/ActionButton.d.ts +105 -0
  4. package/components/ActionButton/ActionButton.js +211 -0
  5. package/components/ActionButton/ActionButton.module.scss.js +47 -0
  6. package/components/ActionButton/CopyButton.d.ts +31 -0
  7. package/components/ActionButton/CopyButton.js +66 -0
  8. package/components/ActionButton/index.d.ts +4 -0
  9. package/components/Alert/Alert.js +82 -0
  10. package/components/Alert/Alert.module.scss.js +25 -0
  11. package/components/Avatar/Avatar.js +57 -0
  12. package/components/Avatar/Avatar.module.scss.js +43 -0
  13. package/components/Badge/Badge.js +38 -0
  14. package/components/Badge/Badge.module.scss.js +31 -0
  15. package/components/Breadcrumbs/Breadcrumbs.js +49 -0
  16. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +17 -0
  17. package/components/Button/Button.js +57 -0
  18. package/components/Button/Button.module.scss.js +47 -0
  19. package/components/Chart/AreaChart.js +244 -0
  20. package/components/Chart/Axis.js +45 -0
  21. package/components/Chart/BarChart.js +353 -0
  22. package/components/Chart/Chart.module.scss.js +61 -0
  23. package/components/Chart/ChartContainer.js +41 -0
  24. package/components/Chart/ChartLegend.js +31 -0
  25. package/components/Chart/ChartTooltip.js +42 -0
  26. package/components/Chart/LineChart.js +236 -0
  27. package/components/Chart/PieChart.js +248 -0
  28. package/components/Chart/RadarChart.js +221 -0
  29. package/components/Chart/Sparkline.js +69 -0
  30. package/components/Chart/TradingChart.js +732 -0
  31. package/components/Chart/scales.js +39 -0
  32. package/components/Chart/trading/indicators.js +68 -0
  33. package/components/Chart/trading/period.js +71 -0
  34. package/components/Chart/useChartDimensions.js +23 -0
  35. package/components/Divider/Divider.js +36 -0
  36. package/components/Divider/Divider.module.scss.js +31 -0
  37. package/components/Draggable/Draggable.js +155 -0
  38. package/components/Draggable/Draggable.module.scss.js +17 -0
  39. package/components/Drawer/Drawer.js +126 -0
  40. package/components/Drawer/Drawer.module.scss.js +117 -0
  41. package/components/Dropdown/Dropdown.js +142 -0
  42. package/components/Dropdown/Dropdown.module.scss.js +35 -0
  43. package/components/Dropdown/DropdownItem.js +31 -0
  44. package/components/Dropzone/Dropzone.js +107 -0
  45. package/components/Dropzone/Dropzone.module.scss.js +21 -0
  46. package/components/Form/Form.js +36 -0
  47. package/components/Form/Form.module.scss.js +29 -0
  48. package/components/Form/FormField.js +76 -0
  49. package/components/Form/FormRow.js +9 -0
  50. package/components/Form/formFieldDefaults.js +5 -0
  51. package/components/Link/Link.js +59 -0
  52. package/components/Link/Link.module.scss.js +16 -0
  53. package/components/List/List.js +46 -0
  54. package/components/List/List.module.scss.js +21 -0
  55. package/components/Modal/Modal.js +109 -0
  56. package/components/Modal/Modal.module.scss.js +31 -0
  57. package/components/Pagination/Pagination.js +84 -0
  58. package/components/Pagination/Pagination.module.scss.js +23 -0
  59. package/components/Pagination/paginationRange.js +24 -0
  60. package/components/Popover/Popover.js +138 -0
  61. package/components/Popover/Popover.module.scss.js +21 -0
  62. package/components/Skeleton/Skeleton.js +50 -0
  63. package/components/Skeleton/Skeleton.module.scss.js +25 -0
  64. package/components/Spinner/Spinner.js +25 -0
  65. package/components/Spinner/Spinner.module.scss.js +20 -0
  66. package/components/Table/Table.d.ts +61 -6
  67. package/components/Table/Table.js +284 -0
  68. package/components/Table/Table.module.scss.js +59 -0
  69. package/components/Table/useTableSort.d.ts +7 -5
  70. package/components/Table/useTableSort.js +44 -0
  71. package/components/Tabs/Tabs.js +163 -0
  72. package/components/Tabs/Tabs.module.scss.js +53 -0
  73. package/components/Timer/Timer.js +159 -0
  74. package/components/Timer/Timer.module.scss.js +55 -0
  75. package/components/Toast/Toast.js +133 -0
  76. package/components/Toast/Toast.module.scss.js +62 -0
  77. package/components/Toast/toastStore.js +62 -0
  78. package/components/ToggleIconButton/ToggleIconButton.d.ts +62 -0
  79. package/components/ToggleIconButton/ToggleIconButton.js +58 -0
  80. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +27 -0
  81. package/components/ToggleIconButton/index.d.ts +2 -0
  82. package/components/Tooltip/Tooltip.js +86 -0
  83. package/components/Tooltip/Tooltip.module.scss.js +30 -0
  84. package/components/Typography/Typography.js +37 -0
  85. package/components/Typography/Typography.module.scss.js +53 -0
  86. package/components/inputs/Checkbox/Checkbox.js +50 -0
  87. package/components/inputs/Checkbox/Checkbox.module.scss.js +15 -0
  88. package/components/inputs/Checkbox/CheckboxGroup.js +111 -0
  89. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +31 -0
  90. package/components/inputs/DatePicker/DatePicker.js +229 -0
  91. package/components/inputs/DatePicker/DatePicker.module.scss.js +45 -0
  92. package/components/inputs/DatePicker/dateUtils.js +41 -0
  93. package/components/inputs/Input/Input.js +50 -0
  94. package/components/inputs/Input/Input.module.scss.js +25 -0
  95. package/components/inputs/NumberInput/NumberInput.js +134 -0
  96. package/components/inputs/NumberInput/NumberInput.module.scss.js +25 -0
  97. package/components/inputs/Radio/Radio.js +68 -0
  98. package/components/inputs/Radio/Radio.module.scss.js +13 -0
  99. package/components/inputs/Select/Select.js +520 -0
  100. package/components/inputs/Select/Select.module.scss.js +69 -0
  101. package/components/inputs/Slider/Slider.js +128 -0
  102. package/components/inputs/Slider/Slider.module.scss.js +15 -0
  103. package/components/inputs/Textarea/Textarea.js +58 -0
  104. package/components/inputs/Textarea/Textarea.module.scss.js +25 -0
  105. package/hooks/useClickOutside.js +15 -0
  106. package/hooks/useFocusTrap.js +39 -0
  107. package/hooks/useKeyboard.js +19 -0
  108. package/hooks/usePortalPosition.js +20 -0
  109. package/index.css +1 -1
  110. package/index.d.ts +4 -0
  111. package/index.js +119 -6575
  112. package/index.layered.css +1 -1
  113. package/llms.txt +123 -5
  114. package/manifest.json +230 -2
  115. package/package.json +3 -2
  116. package/recipes/comparison-table.tsx +123 -0
@@ -0,0 +1,159 @@
1
+ import { jsx as f, jsxs as S } from "react/jsx-runtime";
2
+ import { forwardRef as pe, useState as ce, useRef as p, useCallback as g, useEffect as H, useImperativeHandle as ye, Fragment as Me } from "react";
3
+ import i from "clsx";
4
+ import t from "./Timer.module.scss.js";
5
+ const T = () => Date.now();
6
+ function xe(n) {
7
+ const l = Math.max(0, Math.floor(n)), u = Math.floor(l / 86400), d = Math.floor(l % 86400 / 3600), h = Math.floor(l % 3600 / 60), r = l % 60, e = (y) => String(y).padStart(2, "0");
8
+ return u > 0 ? `${u}d ${e(d)}:${e(h)}:${e(r)}` : d > 0 ? `${d}:${e(h)}:${e(r)}` : `${e(h)}:${e(r)}`;
9
+ }
10
+ const Ne = ["days", "hours", "minutes", "seconds"], ve = { days: 86400, hours: 3600, minutes: 60, seconds: 1 }, be = { days: "d", hours: "h", minutes: "m", seconds: "s" }, Re = { days: "days", hours: "hours", minutes: "minutes", seconds: "seconds" };
11
+ function Ie(n) {
12
+ return n >= 86400 ? ["days", "hours", "minutes", "seconds"] : n >= 3600 ? ["hours", "minutes", "seconds"] : ["minutes", "seconds"];
13
+ }
14
+ function Se(n, l, u, d) {
15
+ const h = Ne.filter((e) => l.includes(e));
16
+ let r = Math.max(0, Math.floor(n));
17
+ return h.map((e, y) => {
18
+ const $ = ve[e], M = Math.floor(r / $);
19
+ r %= $;
20
+ const F = y === 0 ? String(M) : String(M).padStart(2, "0"), x = d?.[e];
21
+ let b;
22
+ return x !== void 0 ? b = typeof x == "function" ? x(M) : x : b = u === "long" ? Re[e] : be[e], { unit: e, value: M, text: F, label: b };
23
+ });
24
+ }
25
+ const Te = pe(
26
+ ({
27
+ mode: n = "countdown",
28
+ duration: l,
29
+ to: u,
30
+ value: d,
31
+ autoStart: h = !0,
32
+ running: r,
33
+ interval: e = 1e3,
34
+ variant: y = "digital",
35
+ size: $ = "md",
36
+ format: M = xe,
37
+ units: F,
38
+ unitFormat: x = "short",
39
+ unitLabels: b,
40
+ segmentVariant: ae = "boxed",
41
+ renderSegment: G,
42
+ segmentSeparator: W,
43
+ label: q,
44
+ labelPlacement: O = "bottom",
45
+ onComplete: z,
46
+ onTick: J,
47
+ classes: o,
48
+ className: ie,
49
+ style: le,
50
+ "aria-label": ue
51
+ }, de) => {
52
+ const c = d !== void 0, s = u !== void 0, K = s ? u instanceof Date ? u.getTime() : u : 0, V = (l ?? 0) * 1e3, [, Q] = ce(0), [w, D] = ce(!1), m = p(null), X = p(!1), k = p(0), R = p(!1), L = p(null), Y = p(z), Z = p(J);
53
+ Y.current = z, Z.current = J;
54
+ const P = g(
55
+ () => k.current + (m.current != null ? T() - m.current : 0),
56
+ []
57
+ ), I = g(() => {
58
+ if (c) return d;
59
+ if (s) return Math.max(0, (K - T()) / 1e3);
60
+ const a = P();
61
+ return n === "countdown" ? Math.max(0, (V - a) / 1e3) : a / 1e3;
62
+ }, [c, d, s, K, P, n, V]), N = g(() => {
63
+ L.current && (clearInterval(L.current), L.current = null);
64
+ }, []), U = g(() => {
65
+ m.current != null && (k.current += T() - m.current, m.current = null), N(), D(!1);
66
+ }, [N]), v = g(() => {
67
+ c || (m.current == null && (m.current = T()), R.current = !1, D(!0));
68
+ }, [c]), _ = g(() => U(), [U]), ee = g(() => {
69
+ N(), m.current = null, k.current = 0, R.current = !1, D(!1), Q((a) => a + 1);
70
+ }, [N]), te = g(() => {
71
+ k.current = 0, R.current = !1, m.current = T(), D(!0);
72
+ }, []);
73
+ H(() => {
74
+ X.current || (X.current = !0, h && r === void 0 && !c && !s && v());
75
+ }, [h, r, c, s, v]), H(() => {
76
+ if (c || !(s ? !0 : w)) return;
77
+ const E = () => {
78
+ const oe = I();
79
+ Z.current?.(oe), Q((ge) => ge + 1), (n === "countdown" || s) && oe <= 0 && !R.current && (R.current = !0, Y.current?.(), s || U());
80
+ };
81
+ return L.current = setInterval(E, e), N;
82
+ }, [w, s, c, e, n, I, U, N]), H(() => {
83
+ r === void 0 || c || (r ? v() : _());
84
+ }, [r, c, v, _]), ye(
85
+ de,
86
+ () => ({
87
+ start: v,
88
+ pause: _,
89
+ reset: ee,
90
+ restart: te,
91
+ getTime: () => I(),
92
+ get isRunning() {
93
+ return w;
94
+ }
95
+ }),
96
+ [v, _, ee, te, I, w]
97
+ );
98
+ const A = I(), j = n === "countdown" || s ? Math.ceil(A) : Math.floor(A), ne = M(j), C = s ? 0 : V / 1e3;
99
+ let B = 0;
100
+ C > 0 && (B = n === "countdown" ? A / C : Math.min(1, A / C)), B = Math.max(0, Math.min(1, B));
101
+ const me = Math.max(j, l ?? 0), fe = F ?? Ie(me), he = Se(j, fe, x, b), re = O === "top" || O === "left", se = q != null && /* @__PURE__ */ f("span", { className: i(t.label, o?.label), children: q });
102
+ return /* @__PURE__ */ S(
103
+ "div",
104
+ {
105
+ className: i(
106
+ t.root,
107
+ t[$],
108
+ t[`label_${O}`],
109
+ o?.root,
110
+ ie
111
+ ),
112
+ style: le,
113
+ role: "timer",
114
+ "aria-label": ue,
115
+ "aria-live": "off",
116
+ children: [
117
+ re && se,
118
+ y === "ring" ? /* @__PURE__ */ S("span", { className: t.ringWrap, children: [
119
+ /* @__PURE__ */ S("svg", { viewBox: "0 0 100 100", className: t.ring, "aria-hidden": "true", children: [
120
+ /* @__PURE__ */ f("circle", { className: i(t.ringTrack, o?.ringTrack), cx: "50", cy: "50", r: "44" }),
121
+ /* @__PURE__ */ f(
122
+ "circle",
123
+ {
124
+ className: i(t.ringProgress, o?.ringProgress),
125
+ cx: "50",
126
+ cy: "50",
127
+ r: "44",
128
+ style: { strokeDasharray: 2 * Math.PI * 44, strokeDashoffset: 2 * Math.PI * 44 * (1 - B) }
129
+ }
130
+ )
131
+ ] }),
132
+ /* @__PURE__ */ f("span", { className: i(t.display, t.ringDisplay, o?.display), children: ne })
133
+ ] }) : y === "segments" ? /* @__PURE__ */ f("span", { className: i(t.segments, o?.segments), children: he.map((a, E) => /* @__PURE__ */ S(Me, { children: [
134
+ E > 0 && W != null && /* @__PURE__ */ f("span", { className: t.segmentSep, "aria-hidden": "true", children: W }),
135
+ G ? G(a, E) : /* @__PURE__ */ S(
136
+ "span",
137
+ {
138
+ className: i(
139
+ t.segment,
140
+ ae === "boxed" ? t.segmentBoxed : t.segmentPlain,
141
+ o?.segment
142
+ ),
143
+ children: [
144
+ /* @__PURE__ */ f("span", { className: i(t.segmentValue, o?.segmentValue), children: a.text }),
145
+ /* @__PURE__ */ f("span", { className: i(t.segmentLabel, o?.segmentLabel), children: a.label })
146
+ ]
147
+ }
148
+ )
149
+ ] }, a.unit)) }) : /* @__PURE__ */ f("span", { className: i(t.display, o?.display), children: ne }),
150
+ !re && se
151
+ ]
152
+ }
153
+ );
154
+ }
155
+ );
156
+ Te.displayName = "Timer";
157
+ export {
158
+ Te as Timer
159
+ };
@@ -0,0 +1,55 @@
1
+ const e = "crk-root-ze-qA", l = "crk-label_top-f5ix1", t = "crk-label_top-f5ix1", s = "crk-label_bottom-vf4Tk", r = "crk-label_bottom-vf4Tk", n = "crk-label_left-Tsjlx", o = "crk-label_left-Tsjlx", c = "crk-label_right-l0T9l", a = "crk-label_right-l0T9l", g = "crk-sm-LpMEk", b = "crk-md-Of6tL", i = "crk-lg-KKqPc", k = "crk-display-09uul", m = "crk-label-F7Uuf", p = "crk-ringWrap-F71Yf", _ = "crk-ring-PqZbn", f = "crk-ringTrack-SaJmr", T = "crk-ringProgress-54wH1", d = "crk-ringDisplay-biAno", x = "crk-segments-U9rJE", h = "crk-segment-2RMKN", u = "crk-segmentBoxed-iVvX0", y = "crk-segmentValue-fsXMN", L = "crk-segmentLabel-kihRG", B = "crk-segmentSep-ZGeiV", P = {
2
+ root: e,
3
+ label_top: l,
4
+ labelTop: t,
5
+ label_bottom: s,
6
+ labelBottom: r,
7
+ label_left: n,
8
+ labelLeft: o,
9
+ label_right: c,
10
+ labelRight: a,
11
+ sm: g,
12
+ md: b,
13
+ lg: i,
14
+ display: k,
15
+ label: m,
16
+ ringWrap: p,
17
+ ring: _,
18
+ ringTrack: f,
19
+ ringProgress: T,
20
+ ringDisplay: d,
21
+ segments: x,
22
+ segment: h,
23
+ segmentBoxed: u,
24
+ segmentValue: y,
25
+ segmentLabel: L,
26
+ segmentSep: B
27
+ };
28
+ export {
29
+ P as default,
30
+ k as display,
31
+ m as label,
32
+ r as labelBottom,
33
+ o as labelLeft,
34
+ a as labelRight,
35
+ t as labelTop,
36
+ s as label_bottom,
37
+ n as label_left,
38
+ c as label_right,
39
+ l as label_top,
40
+ i as lg,
41
+ b as md,
42
+ _ as ring,
43
+ d as ringDisplay,
44
+ T as ringProgress,
45
+ f as ringTrack,
46
+ p as ringWrap,
47
+ e as root,
48
+ h as segment,
49
+ u as segmentBoxed,
50
+ L as segmentLabel,
51
+ B as segmentSep,
52
+ y as segmentValue,
53
+ x as segments,
54
+ g as sm
55
+ };
@@ -0,0 +1,133 @@
1
+ import { jsx as e, jsxs as g, Fragment as L } from "react/jsx-runtime";
2
+ import { useSyncExternalStore as M, useState as b, useEffect as p, useRef as R, useCallback as x } from "react";
3
+ import { createPortal as N } from "react-dom";
4
+ import n from "clsx";
5
+ import t from "./Toast.module.scss.js";
6
+ import { subscribeToasts as C, getToasts as B, getServerToasts as y, configureToasts as S, registerProvider as j, dismissToast as T, addToast as A, dismissAllToasts as z } from "./toastStore.js";
7
+ const E = Object.assign((c) => A(c), {
8
+ dismiss: T,
9
+ dismissAll: z
10
+ });
11
+ function _() {
12
+ return { toast: E, dismiss: T, dismissAll: z };
13
+ }
14
+ function $({
15
+ children: c,
16
+ position: u = "top-right",
17
+ duration: m = 5e3,
18
+ max: a = 5,
19
+ classes: i
20
+ }) {
21
+ const l = M(C, B, y), r = u.startsWith("top"), [v, f] = b(!1);
22
+ p(() => f(!0), []), p(() => {
23
+ S({ duration: m, max: a });
24
+ }, [m, a]), p(() => j(), []);
25
+ const s = r ? [...l].reverse() : l, d = v && typeof document < "u" ? N(
26
+ /* @__PURE__ */ e(
27
+ "div",
28
+ {
29
+ className: n(t.viewport, t[`pos_${u}`], i?.viewport),
30
+ role: "region",
31
+ "aria-label": "Notifications",
32
+ children: s.map((o) => /* @__PURE__ */ e(
33
+ k,
34
+ {
35
+ record: o,
36
+ exiting: o.exiting,
37
+ isTop: r,
38
+ onDismiss: T,
39
+ classes: i
40
+ },
41
+ o.id
42
+ ))
43
+ }
44
+ ),
45
+ document.body
46
+ ) : null;
47
+ return /* @__PURE__ */ g(L, { children: [
48
+ c,
49
+ d
50
+ ] });
51
+ }
52
+ const P = {
53
+ neutral: null,
54
+ info: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
55
+ "path",
56
+ {
57
+ fillRule: "evenodd",
58
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zM9 9a1 1 0 012 0v4a1 1 0 11-2 0V9zm1-4a1 1 0 100 2 1 1 0 000-2z",
59
+ clipRule: "evenodd"
60
+ }
61
+ ) }),
62
+ success: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
63
+ "path",
64
+ {
65
+ fillRule: "evenodd",
66
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.7-9.3a1 1 0 00-1.4-1.4L9 10.6 7.7 9.3a1 1 0 00-1.4 1.4l2 2a1 1 0 001.4 0l4-4z",
67
+ clipRule: "evenodd"
68
+ }
69
+ ) }),
70
+ warning: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
71
+ "path",
72
+ {
73
+ fillRule: "evenodd",
74
+ d: "M8.26 3.1c.77-1.33 2.71-1.33 3.48 0l5.58 9.67c.77 1.33-.19 3-1.74 3H4.42c-1.55 0-2.51-1.67-1.74-3L8.26 3.1zM10 7a1 1 0 011 1v3a1 1 0 11-2 0V8a1 1 0 011-1zm0 7a1 1 0 100-2 1 1 0 000 2z",
75
+ clipRule: "evenodd"
76
+ }
77
+ ) }),
78
+ danger: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
79
+ "path",
80
+ {
81
+ fillRule: "evenodd",
82
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.7 7.3a1 1 0 00-1.4 1.4L8.6 10l-1.3 1.3a1 1 0 101.4 1.4L10 11.4l1.3 1.3a1 1 0 001.4-1.4L11.4 10l1.3-1.3a1 1 0 00-1.4-1.4L10 8.6 8.7 7.3z",
83
+ clipRule: "evenodd"
84
+ }
85
+ ) })
86
+ };
87
+ function k({ record: c, exiting: u, isTop: m, onDismiss: a, classes: i }) {
88
+ const { id: l, variant: r, title: v, description: f, duration: s = 0 } = c, d = R(null), o = x(() => {
89
+ !s || !Number.isFinite(s) || (d.current = setTimeout(() => a(l), s));
90
+ }, [s, l, a]), h = x(() => {
91
+ d.current && (clearTimeout(d.current), d.current = null);
92
+ }, []);
93
+ p(() => (o(), h), [o, h]);
94
+ const w = P[r];
95
+ return /* @__PURE__ */ g(
96
+ "div",
97
+ {
98
+ className: n(
99
+ t.toast,
100
+ t[r],
101
+ m ? t.fromTop : t.fromBottom,
102
+ u && t.leaving,
103
+ i?.toast
104
+ ),
105
+ role: r === "danger" || r === "warning" ? "alert" : "status",
106
+ "aria-live": r === "danger" || r === "warning" ? "assertive" : "polite",
107
+ onMouseEnter: h,
108
+ onMouseLeave: o,
109
+ children: [
110
+ w && /* @__PURE__ */ e("span", { className: n(t.icon, i?.icon), "aria-hidden": "true", children: w }),
111
+ /* @__PURE__ */ g("div", { className: n(t.content, i?.content), children: [
112
+ v != null && /* @__PURE__ */ e("div", { className: n(t.title, i?.title), children: v }),
113
+ f != null && /* @__PURE__ */ e("div", { className: n(t.description, i?.description), children: f })
114
+ ] }),
115
+ /* @__PURE__ */ e(
116
+ "button",
117
+ {
118
+ type: "button",
119
+ className: n(t.close, i?.close),
120
+ onClick: () => a(l),
121
+ "aria-label": "Dismiss notification",
122
+ children: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M6.3 6.3a1 1 0 011.4 0L10 8.6l2.3-2.3a1 1 0 111.4 1.4L11.4 10l2.3 2.3a1 1 0 01-1.4 1.4L10 11.4l-2.3 2.3a1 1 0 01-1.4-1.4L8.6 10 6.3 7.7a1 1 0 010-1.4z" }) })
123
+ }
124
+ )
125
+ ]
126
+ }
127
+ );
128
+ }
129
+ export {
130
+ $ as ToastProvider,
131
+ E as toast,
132
+ _ as useToast
133
+ };
@@ -0,0 +1,62 @@
1
+ const o = "crk-viewport-2hLMp", t = "crk-pos_top-left-XVZwu", c = "crk-pos_top-center-7zvlQ", s = "crk-pos_top-right-nyzVI", r = "crk-pos_bottom-left-z0yV3", n = "crk-pos_bottom-center-m0ZHE", p = "crk-pos_bottom-right-Fplwy", e = "crk-toast-ngbBR", k = "crk-fromTop-ne93U", i = "crk-crk-toast-in-top-23NC0", a = "crk-fromBottom-Y7KGE", m = "crk-crk-toast-in-bottom-TVVax", l = "crk-leaving-P017e", g = "crk-crk-toast-out-2YmIq", f = "crk-neutral-Fo-jg", T = "crk-info-YHq0a", _ = "crk-success-BoQPi", u = "crk-warning-jpQSP", b = "crk-danger-6qs-8", B = "crk-icon-r-npu", h = "crk-content-puk6Q", w = "crk-title-Iv28R", V = "crk-description-RLU-y", v = "crk-close-gWTNf", I = {
2
+ viewport: o,
3
+ "pos_top-left": "crk-pos_top-left-XVZwu",
4
+ posTopLeft: t,
5
+ "pos_top-center": "crk-pos_top-center-7zvlQ",
6
+ posTopCenter: c,
7
+ "pos_top-right": "crk-pos_top-right-nyzVI",
8
+ posTopRight: s,
9
+ "pos_bottom-left": "crk-pos_bottom-left-z0yV3",
10
+ posBottomLeft: r,
11
+ "pos_bottom-center": "crk-pos_bottom-center-m0ZHE",
12
+ posBottomCenter: n,
13
+ "pos_bottom-right": "crk-pos_bottom-right-Fplwy",
14
+ posBottomRight: p,
15
+ toast: e,
16
+ fromTop: k,
17
+ "crk-toast-in-top": "crk-crk-toast-in-top-23NC0",
18
+ crkToastInTop: i,
19
+ fromBottom: a,
20
+ "crk-toast-in-bottom": "crk-crk-toast-in-bottom-TVVax",
21
+ crkToastInBottom: m,
22
+ leaving: l,
23
+ "crk-toast-out": "crk-crk-toast-out-2YmIq",
24
+ crkToastOut: g,
25
+ neutral: f,
26
+ info: T,
27
+ success: _,
28
+ warning: u,
29
+ danger: b,
30
+ icon: B,
31
+ content: h,
32
+ title: w,
33
+ description: V,
34
+ close: v
35
+ };
36
+ export {
37
+ v as close,
38
+ h as content,
39
+ m as crkToastInBottom,
40
+ i as crkToastInTop,
41
+ g as crkToastOut,
42
+ b as danger,
43
+ I as default,
44
+ V as description,
45
+ a as fromBottom,
46
+ k as fromTop,
47
+ B as icon,
48
+ T as info,
49
+ l as leaving,
50
+ f as neutral,
51
+ n as posBottomCenter,
52
+ r as posBottomLeft,
53
+ p as posBottomRight,
54
+ c as posTopCenter,
55
+ t as posTopLeft,
56
+ s as posTopRight,
57
+ _ as success,
58
+ w as title,
59
+ e as toast,
60
+ o as viewport,
61
+ u as warning
62
+ };
@@ -0,0 +1,62 @@
1
+ const T = { duration: 5e3, max: 5 }, f = [];
2
+ let n = f, r = { ...T }, u = 0, s = 0, d = !1;
3
+ const a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
4
+ function c() {
5
+ for (const t of a) t();
6
+ }
7
+ function m(t) {
8
+ return a.add(t), () => {
9
+ a.delete(t);
10
+ };
11
+ }
12
+ function x() {
13
+ return n;
14
+ }
15
+ function v() {
16
+ return f;
17
+ }
18
+ function p(t) {
19
+ r = { ...r, ...t };
20
+ }
21
+ function w() {
22
+ return s += 1, () => {
23
+ s -= 1;
24
+ };
25
+ }
26
+ function M(t) {
27
+ u += 1;
28
+ const o = `toast-${u}`, i = {
29
+ id: o,
30
+ variant: t.variant ?? "neutral",
31
+ title: t.title,
32
+ description: t.description,
33
+ duration: t.duration ?? r.duration,
34
+ exiting: !1
35
+ };
36
+ let e = [...n, i];
37
+ return e.length > r.max && (e = e.slice(e.length - r.max)), n = e, c(), s === 0 && !d && typeof console < "u" && (d = !0, console.warn(
38
+ "[react-toolkit] toast() was called but no <ToastProvider> is mounted, so nothing will render. Mount <ToastProvider> once near the root of your app."
39
+ )), o;
40
+ }
41
+ function g(t) {
42
+ const o = n.find((e) => e.id === t);
43
+ if (!o || o.exiting) return;
44
+ n = n.map((e) => e.id === t ? { ...e, exiting: !0 } : e), c();
45
+ const i = setTimeout(() => {
46
+ n = n.filter((e) => e.id !== t), l.delete(t), c();
47
+ }, 200);
48
+ l.set(t, i);
49
+ }
50
+ function P() {
51
+ for (const t of n) g(t.id);
52
+ }
53
+ export {
54
+ M as addToast,
55
+ p as configureToasts,
56
+ P as dismissAllToasts,
57
+ g as dismissToast,
58
+ v as getServerToasts,
59
+ x as getToasts,
60
+ w as registerProvider,
61
+ m as subscribeToasts
62
+ };
@@ -0,0 +1,62 @@
1
+ import { ComponentPropsWithRef, ReactNode } from 'react';
2
+ export interface ToggleIconButtonClasses {
3
+ root: string;
4
+ icon: string;
5
+ burst: string;
6
+ }
7
+ export interface ToggleIconButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'children'> {
8
+ /**
9
+ * The icon, as an outline SVG (`fill="none"`, `stroke="currentColor"`).
10
+ * When pressed it fills with the active color and pops. Sized to `1em`.
11
+ */
12
+ icon: ReactNode;
13
+ /** Controlled pressed state. Pair with `onPressedChange`. */
14
+ pressed?: boolean;
15
+ /** Initial pressed state when uncontrolled. @default false */
16
+ defaultPressed?: boolean;
17
+ /** Called with the next pressed state on every toggle. */
18
+ onPressedChange?: (pressed: boolean) => void;
19
+ /**
20
+ * Color of the pressed state (icon fill, tinted surface, border). Any CSS
21
+ * color. @default var(--crk-color-primary)
22
+ */
23
+ activeColor?: string;
24
+ /** Expanding ring animation when toggled on (like/heart style). @default false */
25
+ burst?: boolean;
26
+ /** Surface style when off. @default 'secondary' */
27
+ variant?: 'secondary' | 'ghost';
28
+ /** Button size, same control scale as `Button`. @default 'md' */
29
+ size?: 'sm' | 'md' | 'lg';
30
+ /**
31
+ * Playback-speed multiplier for the fill/pop/burst animations: `2` halves
32
+ * durations, `0.5` doubles them.
33
+ * @default 1
34
+ */
35
+ speed?: number;
36
+ /** Override class names on internal elements. */
37
+ classes?: Partial<ToggleIconButtonClasses>;
38
+ }
39
+ /**
40
+ * Round icon-only toggle for like/save/bookmark-style optimistic actions.
41
+ * Renders a native `<button>` with `aria-pressed`; toggling fills the icon
42
+ * with the active color, tints the surface, and pops the icon (plus an
43
+ * optional expanding burst ring). Always pair with an `aria-label`.
44
+ *
45
+ * Uncontrolled via `defaultPressed`, or controlled via `pressed` +
46
+ * `onPressedChange` — sync the state to your server in the background and
47
+ * flip it back on failure (optimistic toggle). The pressed state is exposed
48
+ * as `data-pressed` on the root for custom CSS; colors and timings are
49
+ * themeable via `--crk-toggle-*` custom properties. Respects
50
+ * `prefers-reduced-motion`.
51
+ *
52
+ * @example
53
+ * <ToggleIconButton
54
+ * icon={<HeartIcon />}
55
+ * burst
56
+ * activeColor="#ff5c7a"
57
+ * pressed={liked}
58
+ * onPressedChange={setLiked}
59
+ * aria-label="Like"
60
+ * />
61
+ */
62
+ export declare const ToggleIconButton: import('react').ForwardRefExoticComponent<Omit<ToggleIconButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,58 @@
1
+ import { jsxs as w, jsx as g } from "react/jsx-runtime";
2
+ import { forwardRef as H, useState as u } from "react";
3
+ import r from "clsx";
4
+ import t from "./ToggleIconButton.module.scss.js";
5
+ const R = H(
6
+ ({
7
+ icon: p,
8
+ pressed: n,
9
+ defaultPressed: h = !1,
10
+ onPressedChange: k,
11
+ activeColor: a,
12
+ burst: x = !1,
13
+ variant: y = "secondary",
14
+ size: b = "md",
15
+ speed: i = 1,
16
+ classes: s,
17
+ className: N,
18
+ style: c,
19
+ disabled: l,
20
+ onClick: T,
21
+ ...j
22
+ }, I) => {
23
+ const [P, v] = u(h), [B, C] = u(!1), d = n !== void 0, e = d ? n : P, O = (f) => {
24
+ if (T?.(f), l || f.defaultPrevented) return;
25
+ const m = !e;
26
+ d || v(m), C(!0), k?.(m);
27
+ }, o = {};
28
+ return a && (o["--crk-toggle-color"] = a), i !== 1 && (o["--crk-toggle-speed"] = i), /* @__PURE__ */ w(
29
+ "button",
30
+ {
31
+ ref: I,
32
+ type: "button",
33
+ "aria-pressed": e,
34
+ "data-pressed": e || void 0,
35
+ className: r(
36
+ t.root,
37
+ t[y],
38
+ t[b],
39
+ e && B && t.animate,
40
+ s?.root,
41
+ N
42
+ ),
43
+ style: Object.keys(o).length > 0 ? { ...c, ...o } : c,
44
+ disabled: l,
45
+ onClick: O,
46
+ ...j,
47
+ children: [
48
+ x && /* @__PURE__ */ g("span", { className: r(t.burst, s?.burst), "aria-hidden": "true" }),
49
+ /* @__PURE__ */ g("span", { className: r(t.icon, s?.icon), "aria-hidden": "true", children: p })
50
+ ]
51
+ }
52
+ );
53
+ }
54
+ );
55
+ R.displayName = "ToggleIconButton";
56
+ export {
57
+ R as ToggleIconButton
58
+ };
@@ -0,0 +1,27 @@
1
+ const o = "crk-root-sK5En", c = "crk-secondary-fbwZs", s = "crk-ghost-MuXFl", r = "crk-sm-96-1z", t = "crk-md-h9veM", n = "crk-lg-sOekJ", e = "crk-icon-TVDmu", g = "crk-animate-qNjdL", k = "crk-crkTogglePop-bVeaK", a = "crk-burst-Wjr-r", l = "crk-crkToggleBurst-HvC9q", m = {
2
+ root: o,
3
+ secondary: c,
4
+ ghost: s,
5
+ sm: r,
6
+ md: t,
7
+ lg: n,
8
+ icon: e,
9
+ animate: g,
10
+ crkTogglePop: k,
11
+ burst: a,
12
+ crkToggleBurst: l
13
+ };
14
+ export {
15
+ g as animate,
16
+ a as burst,
17
+ l as crkToggleBurst,
18
+ k as crkTogglePop,
19
+ m as default,
20
+ s as ghost,
21
+ e as icon,
22
+ n as lg,
23
+ t as md,
24
+ o as root,
25
+ c as secondary,
26
+ r as sm
27
+ };
@@ -0,0 +1,2 @@
1
+ export { ToggleIconButton } from './ToggleIconButton';
2
+ export type { ToggleIconButtonProps, ToggleIconButtonClasses, } from './ToggleIconButton';