@companix/uikit 0.1.41 → 0.1.43

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 (85) hide show
  1. package/dist/CounterInput/CounterInput.scss +29 -0
  2. package/dist/CounterInput/index.d.ts +14 -0
  3. package/dist/Popover/index.d.ts +1 -0
  4. package/dist/bundle.es.js +122 -120
  5. package/dist/bundle.es10.js +1 -1
  6. package/dist/bundle.es11.js +28 -27
  7. package/dist/bundle.es13.js +4 -4
  8. package/dist/bundle.es14.js +4 -4
  9. package/dist/bundle.es15.js +2 -2
  10. package/dist/bundle.es16.js +1 -1
  11. package/dist/bundle.es17.js +1 -1
  12. package/dist/bundle.es18.js +105 -19
  13. package/dist/bundle.es19.js +21 -34
  14. package/dist/bundle.es20.js +33 -24
  15. package/dist/bundle.es21.js +24 -45
  16. package/dist/bundle.es22.js +46 -26
  17. package/dist/bundle.es23.js +24 -259
  18. package/dist/bundle.es24.js +260 -13
  19. package/dist/bundle.es25.js +14 -21
  20. package/dist/bundle.es26.js +20 -37
  21. package/dist/bundle.es27.js +38 -21
  22. package/dist/bundle.es28.js +20 -18
  23. package/dist/bundle.es29.js +18 -21
  24. package/dist/bundle.es30.js +21 -43
  25. package/dist/bundle.es31.js +37 -114
  26. package/dist/bundle.es32.js +119 -72
  27. package/dist/bundle.es33.js +68 -38
  28. package/dist/bundle.es34.js +42 -10
  29. package/dist/bundle.es35.js +11 -85
  30. package/dist/bundle.es36.js +85 -19
  31. package/dist/bundle.es37.js +20 -7
  32. package/dist/bundle.es38.js +7 -3
  33. package/dist/bundle.es39.js +3 -23
  34. package/dist/bundle.es40.js +16 -45
  35. package/dist/bundle.es41.js +51 -56
  36. package/dist/bundle.es42.js +57 -162
  37. package/dist/bundle.es43.js +160 -79
  38. package/dist/bundle.es44.js +81 -7
  39. package/dist/bundle.es45.js +7 -59
  40. package/dist/bundle.es46.js +58 -33
  41. package/dist/bundle.es47.js +33 -20
  42. package/dist/bundle.es48.js +19 -47
  43. package/dist/bundle.es49.js +49 -11
  44. package/dist/bundle.es50.js +11 -13
  45. package/dist/bundle.es51.js +13 -13
  46. package/dist/bundle.es52.js +13 -30
  47. package/dist/bundle.es53.js +30 -11
  48. package/dist/bundle.es54.js +10 -25
  49. package/dist/bundle.es55.js +17 -29
  50. package/dist/bundle.es56.js +36 -48
  51. package/dist/bundle.es57.js +49 -55
  52. package/dist/bundle.es58.js +56 -8
  53. package/dist/bundle.es59.js +8 -26
  54. package/dist/bundle.es60.js +27 -5
  55. package/dist/bundle.es61.js +5 -66
  56. package/dist/bundle.es62.js +66 -23
  57. package/dist/bundle.es63.js +22 -23
  58. package/dist/bundle.es64.js +24 -90
  59. package/dist/bundle.es65.js +90 -18
  60. package/dist/bundle.es66.js +17 -93
  61. package/dist/bundle.es67.js +93 -73
  62. package/dist/bundle.es68.js +73 -23
  63. package/dist/bundle.es69.js +20 -35
  64. package/dist/bundle.es70.js +39 -24
  65. package/dist/bundle.es71.js +24 -79
  66. package/dist/bundle.es72.js +71 -85
  67. package/dist/bundle.es73.js +93 -10
  68. package/dist/bundle.es74.js +10 -6
  69. package/dist/bundle.es75.js +5 -69
  70. package/dist/bundle.es76.js +68 -10
  71. package/dist/bundle.es77.js +11 -42
  72. package/dist/bundle.es78.js +42 -32
  73. package/dist/bundle.es79.js +31 -64
  74. package/dist/bundle.es80.js +65 -40
  75. package/dist/bundle.es81.js +40 -14
  76. package/dist/bundle.es82.js +15 -32
  77. package/dist/bundle.es83.js +23 -61
  78. package/dist/bundle.es84.js +69 -13
  79. package/dist/bundle.es85.js +12 -12
  80. package/dist/bundle.es86.js +3 -3
  81. package/dist/bundle.es87.js +2 -2
  82. package/dist/bundle.es88.js +16 -0
  83. package/dist/index.d.ts +2 -0
  84. package/dist/index.scss +1 -0
  85. package/package.json +1 -1
@@ -1,16 +1,263 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import i from "classnames";
3
- import { PopupLayout as a } from "./bundle.es25.js";
4
- const t = ({ size: e = "s", className: r, children: l, ...s }) => /* @__PURE__ */ o(
5
- a,
6
- {
7
- ...s,
8
- overlay: { className: "dialog-overlay" },
9
- content: { className: "dialog-container", "data-size": e },
10
- children: /* @__PURE__ */ o("div", { className: i("popup dialog", r), children: l })
1
+ import { jsx as s, jsxs as q } from "react/jsx-runtime";
2
+ import t from "react";
3
+ import G from "classnames";
4
+ import * as E from "@radix-ui/react-dialog";
5
+ import { VisuallyHidden as K } from "@radix-ui/react-visually-hidden";
6
+ import { customCSS as oe } from "@companix/utils-browser";
7
+ import { RemoveListener as se } from "./bundle.es61.js";
8
+ import { DrawerContext as ie, useDrawerContext as J } from "./bundle.es71.js";
9
+ import { set as R, reset as ae, composeRefs as Q, isInput as ce, isMobileFirefox as ue, getTranslate as W, isIOS as le, dampenValue as fe } from "./bundle.es72.js";
10
+ import { usePreventScroll as de } from "./bundle.es73.js";
11
+ import { DRAG_CLASS as j, VELOCITY_THRESHOLD as ge, CLOSE_THRESHOLD as me, SCROLL_LOCK_TIMEOUT as pe, TRANSITIONS as Y, WINDOW_TOP_OFFSET as he } from "./bundle.es74.js";
12
+ const we = (m) => {
13
+ const { open: p, onOpenChange: l, onClosed: D, children: y, defaultOpen: S = !1, disableEsc: f } = m, [M, P] = t.useState(!1), [T, v] = t.useState(!1), [_, A] = t.useState(!1), x = t.useRef(null), H = t.useRef(null), I = t.useRef(null), L = t.useRef(null), o = t.useRef(null), d = t.useRef(!1), h = t.useRef(0), b = t.useRef(!1), N = t.useRef(!S), e = t.useRef(null), O = t.useRef(e.current?.getBoundingClientRect().height || 0), g = t.useRef(0), C = t.useRef(0), w = p ?? !1, V = t.useCallback(
14
+ (r) => {
15
+ l(r);
16
+ },
17
+ [l]
18
+ );
19
+ de({
20
+ isDisabled: !w || T || _ || !M
21
+ });
22
+ const ee = (r) => {
23
+ e.current && !e.current.contains(r.target) || (O.current = e.current?.getBoundingClientRect().height || 0, v(!0), I.current = /* @__PURE__ */ new Date(), le() && window.addEventListener("touchend", () => d.current = !1, { once: !0 }), r.target.setPointerCapture(r.pointerId), h.current = r.pageY);
24
+ }, z = (r, c) => {
25
+ let n = r;
26
+ const u = window.getSelection()?.toString(), i = e.current ? W(e.current) : null, a = /* @__PURE__ */ new Date();
27
+ if (n.tagName === "SELECT" || n.hasAttribute("data-no-drag") || n.closest("[data-no-drag]") || H.current && a.getTime() - H.current.getTime() < 500)
28
+ return !1;
29
+ if (i !== null && i > 0)
30
+ return !0;
31
+ if (u && u.length > 0)
32
+ return !1;
33
+ if (o.current && a.getTime() - o.current.getTime() < pe && i === 0 || c)
34
+ return o.current = a, !1;
35
+ for (; n; ) {
36
+ if (n.scrollHeight > n.clientHeight) {
37
+ if (n.scrollTop !== 0)
38
+ return o.current = /* @__PURE__ */ new Date(), !1;
39
+ if (n.getAttribute("role") === "dialog")
40
+ return !0;
41
+ }
42
+ n = n.parentNode;
43
+ }
44
+ return !0;
45
+ }, te = (r) => {
46
+ if (e.current && T) {
47
+ const c = h.current - r.pageY, n = c > 0, u = Math.abs(c), i = O.current, a = u / i;
48
+ if (!d.current && !z(r.target, n)) return;
49
+ if (e.current.classList.add(j), d.current = !0, R(e.current, {
50
+ transition: "none"
51
+ }), R(x.current, {
52
+ transition: "none"
53
+ }), n) {
54
+ const F = fe(c), U = Math.min(F * -1, 0) * 1;
55
+ R(e.current, {
56
+ transform: `translate3d(0, ${U}px, 0)`
57
+ });
58
+ return;
59
+ }
60
+ const k = 1 - a;
61
+ R(
62
+ x.current,
63
+ {
64
+ opacity: `${k}`,
65
+ transition: "none"
66
+ },
67
+ !0
68
+ );
69
+ const $ = u;
70
+ R(e.current, {
71
+ transform: `translate3d(0, ${$}px, 0)`
72
+ });
73
+ }
74
+ };
75
+ t.useEffect(() => {
76
+ window.requestAnimationFrame(() => {
77
+ N.current = !0;
78
+ });
79
+ }, []), t.useEffect(() => {
80
+ const r = () => {
81
+ if (!e.current) return;
82
+ const c = document.activeElement;
83
+ if (ce(c) || b.current) {
84
+ const n = window.visualViewport?.height || 0, u = window.innerHeight, i = u - n, a = e.current.getBoundingClientRect().height || 0, k = a > u * 0.8;
85
+ g.current || (g.current = a);
86
+ const $ = e.current.getBoundingClientRect().top;
87
+ if (Math.abs(C.current - i) > 60 && (b.current = !b.current), C.current = i, a > n || b.current) {
88
+ const F = e.current.getBoundingClientRect().height;
89
+ let U = F;
90
+ F > n && (U = n - (k ? $ : he)), e.current.style.height = `${Math.max(
91
+ U,
92
+ n - $
93
+ )}px`;
94
+ } else ue() || (e.current.style.height = `${g.current}px`);
95
+ e.current.style.bottom = `${Math.max(i, 0)}px`;
96
+ }
97
+ };
98
+ return window.visualViewport?.addEventListener("resize", r), () => window.visualViewport?.removeEventListener("resize", r);
99
+ }, []);
100
+ const B = (r) => {
101
+ re(), r || V(!1);
102
+ }, X = () => {
103
+ e.current && (R(e.current, {
104
+ transform: "translate3d(0, 0, 0)",
105
+ transition: `transform ${Y.DURATION}s cubic-bezier(${Y.EASE.join(",")})`
106
+ }), R(x.current, {
107
+ transition: `opacity ${Y.DURATION}s cubic-bezier(${Y.EASE.join(",")})`,
108
+ opacity: "1"
109
+ }));
110
+ }, re = () => {
111
+ !T || !e.current || (e.current.classList.remove(j), d.current = !1, v(!1), L.current = /* @__PURE__ */ new Date());
112
+ }, ne = (r) => {
113
+ if (!T || !e.current) return;
114
+ e.current.classList.remove(j), d.current = !1, v(!1), L.current = /* @__PURE__ */ new Date();
115
+ const c = W(e.current);
116
+ if (!r || !z(r.target, !1) || !c || Number.isNaN(c) || I.current === null) return;
117
+ const n = L.current.getTime() - I.current.getTime(), u = h.current - r.pageY, i = Math.abs(u) / n;
118
+ if (i > 0.05 && (A(!0), setTimeout(() => {
119
+ A(!1);
120
+ }, 200)), u > 0) {
121
+ X();
122
+ return;
123
+ }
124
+ if (i > ge) {
125
+ B();
126
+ return;
127
+ }
128
+ const a = Math.min(
129
+ e.current.getBoundingClientRect().height ?? 0,
130
+ window.innerHeight
131
+ );
132
+ if (Math.abs(c) >= a * me) {
133
+ B();
134
+ return;
135
+ }
136
+ X();
137
+ };
138
+ return t.useEffect(() => (w && (P(!0), R(document.documentElement, {
139
+ scrollBehavior: "auto"
140
+ }), H.current = /* @__PURE__ */ new Date()), () => {
141
+ ae(document.documentElement, "scrollBehavior");
142
+ }), [w]), /* @__PURE__ */ s(
143
+ E.Root,
144
+ {
145
+ defaultOpen: S,
146
+ onOpenChange: (r) => {
147
+ r ? P(!0) : B(!0), V(r);
148
+ },
149
+ open: w,
150
+ modal: !0,
151
+ children: /* @__PURE__ */ s(
152
+ ie.Provider,
153
+ {
154
+ value: {
155
+ drawerRef: e,
156
+ overlayRef: x,
157
+ onPress: ee,
158
+ onRelease: ne,
159
+ onDrag: te,
160
+ isOpen: w,
161
+ isDragging: T,
162
+ keyboardIsOpen: b,
163
+ closeDrawer: () => B(),
164
+ shouldAnimate: N,
165
+ onClosed: D,
166
+ disableEsc: f
167
+ },
168
+ children: y
169
+ }
170
+ )
171
+ }
172
+ );
173
+ }, Re = t.forwardRef(
174
+ ({ className: m, ...p }, l) => {
175
+ const { overlayRef: D, onRelease: y, shouldAnimate: S } = J(), f = Q(l, D), M = t.useCallback(
176
+ (P) => y(P),
177
+ [y]
178
+ );
179
+ return /* @__PURE__ */ s(
180
+ E.Overlay,
181
+ {
182
+ onMouseUp: M,
183
+ ref: f,
184
+ "data-animate": S?.current ? "true" : "false",
185
+ className: G("popup-overlay drawer-overlay", m),
186
+ ...p
187
+ }
188
+ );
11
189
  }
12
- );
13
- t.Close = a.Close;
190
+ ), De = t.forwardRef(
191
+ ({ onPointerDownOutside: m, style: p, onOpenAutoFocus: l, className: D, size: y, children: S, ...f }, M) => {
192
+ const {
193
+ drawerRef: P,
194
+ onPress: T,
195
+ onRelease: v,
196
+ onDrag: _,
197
+ keyboardIsOpen: A,
198
+ shouldAnimate: x,
199
+ onClosed: H,
200
+ disableEsc: I
201
+ } = J(), L = Q(M, P), o = t.useRef(null), d = t.useRef(null), h = t.useRef(!1), b = (e, O = 0) => {
202
+ if (h.current) return !0;
203
+ const g = Math.abs(e.y), w = Math.abs(e.x) > g;
204
+ return !(e.y * 1 < 0) && g >= 0 && g <= O ? !w : (h.current = !0, !0);
205
+ }, N = (e) => {
206
+ o.current = null, h.current = !1, v(e);
207
+ };
208
+ return /* @__PURE__ */ q(
209
+ E.Content,
210
+ {
211
+ "data-direction": "bottom",
212
+ "data-animate": x?.current ? "true" : "false",
213
+ className: G("popup drawer drawer-mobile", D),
214
+ style: { ...oe({ "--drawer-size": y ?? "50%" }), ...p },
215
+ ...f,
216
+ ref: L,
217
+ onPointerDown: (e) => {
218
+ f.onPointerDown?.(e), o.current = { x: e.pageX, y: e.pageY }, T(e);
219
+ },
220
+ onOpenAutoFocus: (e) => {
221
+ l?.(e), e.preventDefault();
222
+ },
223
+ onEscapeKeyDown: (e) => {
224
+ I && e.preventDefault();
225
+ },
226
+ onPointerDownOutside: (e) => {
227
+ m?.(e), !e.defaultPrevented && A.current && (A.current = !1);
228
+ },
229
+ onPointerMove: (e) => {
230
+ if (d.current = e, f.onPointerMove?.(e), !o.current) return;
231
+ const O = e.pageY - o.current.y, g = e.pageX - o.current.x, C = e.pointerType === "touch" ? 10 : 2;
232
+ b({ x: g, y: O }, C) ? _(e) : (Math.abs(g) > C || Math.abs(O) > C) && (o.current = null);
233
+ },
234
+ onPointerUp: (e) => {
235
+ f.onPointerUp?.(e), o.current = null, h.current = !1, v(e);
236
+ },
237
+ onPointerOut: (e) => {
238
+ f.onPointerOut?.(e), N(d.current);
239
+ },
240
+ onContextMenu: (e) => {
241
+ f.onContextMenu?.(e), d.current && N(d.current);
242
+ },
243
+ children: [
244
+ /* @__PURE__ */ s(se, { callback: H }),
245
+ /* @__PURE__ */ s(K, { children: /* @__PURE__ */ s(E.Title, {}) }),
246
+ /* @__PURE__ */ s(K, { children: /* @__PURE__ */ s(E.Description, {}) }),
247
+ S
248
+ ]
249
+ }
250
+ );
251
+ }
252
+ ), Te = t.forwardRef(
253
+ ({ children: m, ...p }, l) => /* @__PURE__ */ s("div", { className: "drawer-handle", "aria-hidden": "true", ref: l, ...p, children: /* @__PURE__ */ s("span", { className: "drawer-handle-hitarea", "aria-hidden": "true", children: m }) })
254
+ ), Z = ({ children: m, className: p, size: l, ...D }) => /* @__PURE__ */ s(we, { ...D, children: /* @__PURE__ */ q(E.Portal, { children: [
255
+ /* @__PURE__ */ s(Re, {}),
256
+ /* @__PURE__ */ s(De, { className: p, size: l, children: m })
257
+ ] }) });
258
+ Z.Close = E.Close;
259
+ Z.Handle = Te;
14
260
  export {
15
- t as Dialog
261
+ Te as Handle,
262
+ Z as MobileDrawer
16
263
  };
@@ -1,23 +1,16 @@
1
- import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
- import C from "classnames";
3
- import * as o from "@radix-ui/react-dialog";
4
- import { VisuallyHidden as l } from "@radix-ui/react-visually-hidden";
5
- import { RemoveListener as D } from "./bundle.es60.js";
6
- const R = (t) => {
7
- const { open: i, onOpenChange: a, children: c, onClosed: s, disableEsc: p, modal: m, container: d, overlay: n = {}, overlayRef: f, content: h = {}, contentRef: v } = t, y = (u) => {
8
- p && u.preventDefault();
9
- };
10
- return /* @__PURE__ */ e(o.Root, { open: i, onOpenChange: a, modal: m, children: /* @__PURE__ */ r(o.Portal, { container: d, children: [
11
- /* @__PURE__ */ e(o.Overlay, { ...n, ref: f, className: C("popup-overlay", n.className) }),
12
- /* @__PURE__ */ r(o.Content, { ...h, ref: v, onEscapeKeyDown: y, children: [
13
- /* @__PURE__ */ e(D, { callback: s }),
14
- /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Title, {}) }),
15
- /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Description, {}) }),
16
- c
17
- ] })
18
- ] }) });
19
- };
20
- R.Close = o.Close;
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import i from "classnames";
3
+ import { PopupLayout as a } from "./bundle.es26.js";
4
+ const t = ({ size: e = "s", className: r, children: l, ...s }) => /* @__PURE__ */ o(
5
+ a,
6
+ {
7
+ ...s,
8
+ overlay: { className: "dialog-overlay" },
9
+ content: { className: "dialog-container", "data-size": e },
10
+ children: /* @__PURE__ */ o("div", { className: i("popup dialog", r), children: l })
11
+ }
12
+ );
13
+ t.Close = a.Close;
21
14
  export {
22
- R as PopupLayout
15
+ t as Dialog
23
16
  };
@@ -1,40 +1,23 @@
1
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
- import * as r from "@radix-ui/react-alert-dialog";
3
- import { Button as c } from "./bundle.es5.js";
4
- import { RemoveListener as N } from "./bundle.es60.js";
5
- import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
6
- const C = ({
7
- open: d,
8
- defaultOpen: m,
9
- onOpenChange: p,
10
- onClosed: h,
11
- icon: i,
12
- title: l,
13
- description: o,
14
- cancelDefaultText: s,
15
- cancel: t,
16
- disableCancel: v,
17
- confirm: n
18
- }) => /* @__PURE__ */ e(r.Root, { open: d, defaultOpen: m, onOpenChange: p, children: /* @__PURE__ */ a(r.Portal, { children: [
19
- /* @__PURE__ */ e(r.Overlay, { className: "popup-overlay dialog-overlay" }),
20
- /* @__PURE__ */ a(r.Content, { className: "dialog-container", children: [
21
- /* @__PURE__ */ e(N, { callback: h }),
22
- /* @__PURE__ */ a("div", { className: "popup dialog alert", children: [
23
- /* @__PURE__ */ a("div", { className: "alert-body", children: [
24
- i && /* @__PURE__ */ e("span", { className: "alert-icon", children: i }),
25
- /* @__PURE__ */ a("div", { className: "alert-content", children: [
26
- l && /* @__PURE__ */ e(r.Title, { className: "alert-title", children: l }),
27
- !l && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(r.Title, {}) }),
28
- o && /* @__PURE__ */ e(r.Description, { className: "alert-description", children: o })
29
- ] })
30
- ] }),
31
- /* @__PURE__ */ a("div", { className: "alert-footer", children: [
32
- !v && (t?.text || s) && /* @__PURE__ */ e(r.Cancel, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "neutral", ...t, text: t?.text ?? s }) }),
33
- n?.text && /* @__PURE__ */ e(r.Action, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "negative", ...n }) })
34
- ] })
1
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
+ import C from "classnames";
3
+ import * as o from "@radix-ui/react-dialog";
4
+ import { VisuallyHidden as l } from "@radix-ui/react-visually-hidden";
5
+ import { RemoveListener as D } from "./bundle.es61.js";
6
+ const R = (t) => {
7
+ const { open: i, onOpenChange: a, children: c, onClosed: s, disableEsc: p, modal: m, container: d, overlay: n = {}, overlayRef: f, content: h = {}, contentRef: v } = t, y = (u) => {
8
+ p && u.preventDefault();
9
+ };
10
+ return /* @__PURE__ */ e(o.Root, { open: i, onOpenChange: a, modal: m, children: /* @__PURE__ */ r(o.Portal, { container: d, children: [
11
+ /* @__PURE__ */ e(o.Overlay, { ...n, ref: f, className: C("popup-overlay", n.className) }),
12
+ /* @__PURE__ */ r(o.Content, { ...h, ref: v, onEscapeKeyDown: y, children: [
13
+ /* @__PURE__ */ e(D, { callback: s }),
14
+ /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Title, {}) }),
15
+ /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Description, {}) }),
16
+ c
35
17
  ] })
36
- ] })
37
- ] }) });
18
+ ] }) });
19
+ };
20
+ R.Close = o.Close;
38
21
  export {
39
- C as AlertDialog
22
+ R as PopupLayout
40
23
  };
@@ -1,23 +1,40 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { Button as p } from "./bundle.es5.js";
3
- import { useLoading as s } from "./bundle.es51.js";
4
- const l = ({
5
- onClick: o,
6
- appearance: r = "primary",
7
- loading: i,
8
- ...n
9
- }) => {
10
- const { isLoading: t, isError: a, handleClick: e } = s({ onClick: o });
11
- return /* @__PURE__ */ m(
12
- p,
13
- {
14
- appearance: a ? "negative" : r,
15
- ...n,
16
- loading: t || i,
17
- onClick: e
18
- }
19
- );
20
- };
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
+ import * as r from "@radix-ui/react-alert-dialog";
3
+ import { Button as c } from "./bundle.es5.js";
4
+ import { RemoveListener as N } from "./bundle.es61.js";
5
+ import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
6
+ const C = ({
7
+ open: d,
8
+ defaultOpen: m,
9
+ onOpenChange: p,
10
+ onClosed: h,
11
+ icon: i,
12
+ title: l,
13
+ description: o,
14
+ cancelDefaultText: s,
15
+ cancel: t,
16
+ disableCancel: v,
17
+ confirm: n
18
+ }) => /* @__PURE__ */ e(r.Root, { open: d, defaultOpen: m, onOpenChange: p, children: /* @__PURE__ */ a(r.Portal, { children: [
19
+ /* @__PURE__ */ e(r.Overlay, { className: "popup-overlay dialog-overlay" }),
20
+ /* @__PURE__ */ a(r.Content, { className: "dialog-container", children: [
21
+ /* @__PURE__ */ e(N, { callback: h }),
22
+ /* @__PURE__ */ a("div", { className: "popup dialog alert", children: [
23
+ /* @__PURE__ */ a("div", { className: "alert-body", children: [
24
+ i && /* @__PURE__ */ e("span", { className: "alert-icon", children: i }),
25
+ /* @__PURE__ */ a("div", { className: "alert-content", children: [
26
+ l && /* @__PURE__ */ e(r.Title, { className: "alert-title", children: l }),
27
+ !l && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(r.Title, {}) }),
28
+ o && /* @__PURE__ */ e(r.Description, { className: "alert-description", children: o })
29
+ ] })
30
+ ] }),
31
+ /* @__PURE__ */ a("div", { className: "alert-footer", children: [
32
+ !v && (t?.text || s) && /* @__PURE__ */ e(r.Cancel, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "neutral", ...t, text: t?.text ?? s }) }),
33
+ n?.text && /* @__PURE__ */ e(r.Action, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "negative", ...n }) })
34
+ ] })
35
+ ] })
36
+ ] })
37
+ ] }) });
21
38
  export {
22
- l as LoadingButton
39
+ C as AlertDialog
23
40
  };
@@ -1,21 +1,23 @@
1
- import { jsx as a, jsxs as b } from "react/jsx-runtime";
2
- import { useTabSlider as l, makeTabId as m } from "./bundle.es62.js";
3
- import * as n from "@radix-ui/react-tabs";
4
- import { useRef as f, useId as T, createContext as u, useContext as c } from "react";
5
- const o = u({ baseId: "", containerRef: {} }), x = ({ children: s, value: e, onChange: r }) => {
6
- const t = f(null), i = T().replaceAll(":", "");
7
- return /* @__PURE__ */ a(n.Root, { value: e, onValueChange: (d) => r(d), children: /* @__PURE__ */ a(o.Provider, { value: { baseId: i, containerRef: t }, children: /* @__PURE__ */ b(n.List, { className: "tabs", ref: t, children: [
8
- /* @__PURE__ */ a(I, { value: e }),
9
- s
10
- ] }) }) });
11
- }, I = ({ value: s }) => {
12
- const { baseId: e, containerRef: r } = c(o), t = l({ baseId: e, value: s, containerRef: r });
13
- return /* @__PURE__ */ a("div", { className: "tab-indicator-container", style: t, children: /* @__PURE__ */ a("div", { className: "tab-indicator" }) });
14
- }, p = ({ children: s, value: e, ...r }) => {
15
- const { baseId: t } = c(o);
16
- return /* @__PURE__ */ a(n.Trigger, { ...r, id: m(t, e), className: "tab", value: e, children: s });
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { Button as p } from "./bundle.es5.js";
3
+ import { useLoading as s } from "./bundle.es52.js";
4
+ const l = ({
5
+ onClick: o,
6
+ appearance: r = "primary",
7
+ loading: i,
8
+ ...n
9
+ }) => {
10
+ const { isLoading: t, isError: a, handleClick: e } = s({ onClick: o });
11
+ return /* @__PURE__ */ m(
12
+ p,
13
+ {
14
+ appearance: a ? "negative" : r,
15
+ ...n,
16
+ loading: t || i,
17
+ onClick: e
18
+ }
19
+ );
17
20
  };
18
- x.Tab = p;
19
21
  export {
20
- x as Tabs
22
+ l as LoadingButton
21
23
  };
@@ -1,24 +1,21 @@
1
- import { jsx as d, Fragment as p } from "react/jsx-runtime";
2
- import { useRerender as T } from "./bundle.es74.js";
3
- import { getNextCandleTime as x, sleep as S, getTimes as g } from "@companix/utils-js";
4
- import { useRef as v, useEffect as s } from "react";
5
- const n = (t) => String(t).padStart(2, "0"), C = ({ expiration: t, separator: m = ":", onExpired: i }) => {
6
- const e = v(null), o = T();
7
- s(() => {
8
- const c = Date.now(), f = x(c, "1s") - c;
9
- return e.current && clearInterval(e.current), S(f).then(() => {
10
- o(), e.current = setInterval(() => {
11
- o();
12
- }, 1e3);
13
- }), () => {
14
- e.current && clearInterval(e.current);
15
- };
16
- }, [t]);
17
- const r = t - Date.now(), { hours: u, minutes: a, seconds: l } = g(r);
18
- return s(() => {
19
- r <= 0 && (i?.(), e.current && clearInterval(e.current));
20
- }, [r <= 0]), /* @__PURE__ */ d(p, { children: [n(u), n(a), n(l)].join(m) });
1
+ import { jsx as a, jsxs as b } from "react/jsx-runtime";
2
+ import { useTabSlider as l, makeTabId as m } from "./bundle.es63.js";
3
+ import * as n from "@radix-ui/react-tabs";
4
+ import { useRef as f, useId as T, createContext as u, useContext as c } from "react";
5
+ const o = u({ baseId: "", containerRef: {} }), x = ({ children: s, value: e, onChange: r }) => {
6
+ const t = f(null), i = T().replaceAll(":", "");
7
+ return /* @__PURE__ */ a(n.Root, { value: e, onValueChange: (d) => r(d), children: /* @__PURE__ */ a(o.Provider, { value: { baseId: i, containerRef: t }, children: /* @__PURE__ */ b(n.List, { className: "tabs", ref: t, children: [
8
+ /* @__PURE__ */ a(I, { value: e }),
9
+ s
10
+ ] }) }) });
11
+ }, I = ({ value: s }) => {
12
+ const { baseId: e, containerRef: r } = c(o), t = l({ baseId: e, value: s, containerRef: r });
13
+ return /* @__PURE__ */ a("div", { className: "tab-indicator-container", style: t, children: /* @__PURE__ */ a("div", { className: "tab-indicator" }) });
14
+ }, p = ({ children: s, value: e, ...r }) => {
15
+ const { baseId: t } = c(o);
16
+ return /* @__PURE__ */ a(n.Trigger, { ...r, id: m(t, e), className: "tab", value: e, children: s });
21
17
  };
18
+ x.Tab = p;
22
19
  export {
23
- C as Countdown
20
+ x as Tabs
24
21
  };
@@ -1,46 +1,24 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import u from "classnames";
3
- import { useResizeTextarea as z } from "./bundle.es50.js";
4
- import { attr as e, callMultiple as R } from "@companix/utils-browser";
5
- import { useEffect as T } from "react";
6
- import { mergeRefs as g } from "react-merge-refs";
7
- const E = ({
8
- onResize: f,
9
- grow: t = !1,
10
- value: a,
11
- onChange: i,
12
- disabled: o,
13
- required: s,
14
- rows: l = 2,
15
- fill: p = !1,
16
- textAreaRef: c,
17
- className: n,
18
- ...d
19
- }) => {
20
- const [x, r] = z(f, t);
21
- return T(r, [r, a]), /* @__PURE__ */ m(
22
- "div",
23
- {
24
- className: "form form-textarea",
25
- "data-required": e(s),
26
- "data-disabled": e(o),
27
- "data-fill": e(p),
28
- children: /* @__PURE__ */ m(
29
- "textarea",
30
- {
31
- className: u("form-input", n),
32
- "data-grow": e(t),
33
- value: a,
34
- ref: g([c, x]),
35
- rows: l,
36
- disabled: o,
37
- onChange: R(i, r),
38
- ...d
39
- }
40
- )
41
- }
42
- );
1
+ import { jsx as d, Fragment as p } from "react/jsx-runtime";
2
+ import { useRerender as T } from "./bundle.es75.js";
3
+ import { getNextCandleTime as x, sleep as S, getTimes as g } from "@companix/utils-js";
4
+ import { useRef as v, useEffect as s } from "react";
5
+ const n = (t) => String(t).padStart(2, "0"), C = ({ expiration: t, separator: m = ":", onExpired: i }) => {
6
+ const e = v(null), o = T();
7
+ s(() => {
8
+ const c = Date.now(), f = x(c, "1s") - c;
9
+ return e.current && clearInterval(e.current), S(f).then(() => {
10
+ o(), e.current = setInterval(() => {
11
+ o();
12
+ }, 1e3);
13
+ }), () => {
14
+ e.current && clearInterval(e.current);
15
+ };
16
+ }, [t]);
17
+ const r = t - Date.now(), { hours: u, minutes: a, seconds: l } = g(r);
18
+ return s(() => {
19
+ r <= 0 && (i?.(), e.current && clearInterval(e.current));
20
+ }, [r <= 0]), /* @__PURE__ */ d(p, { children: [n(u), n(a), n(l)].join(m) });
43
21
  };
44
22
  export {
45
- E as TextArea
23
+ C as Countdown
46
24
  };