@companix/uikit 0.1.14 → 0.1.16

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/DrawerMobile/MobileDrawer.scss +71 -0
  2. package/dist/DrawerMobile/constants.d.ts +9 -0
  3. package/dist/DrawerMobile/context.d.ts +18 -0
  4. package/dist/DrawerMobile/helpers.d.ts +13 -0
  5. package/dist/DrawerMobile/index.d.ts +17 -0
  6. package/dist/DrawerMobile/types.d.ts +5 -0
  7. package/dist/DrawerMobile/use-prevent-scroll.d.ts +5 -0
  8. package/dist/Popup/index.d.ts +4 -2
  9. package/dist/Scrollable/Scrollable.scss +0 -5
  10. package/dist/__helpers/createPopupRegistry.d.ts +4 -0
  11. package/dist/bundle.es.js +112 -109
  12. package/dist/bundle.es10.js +1 -1
  13. package/dist/bundle.es13.js +4 -4
  14. package/dist/bundle.es14.js +4 -4
  15. package/dist/bundle.es15.js +2 -2
  16. package/dist/bundle.es16.js +1 -1
  17. package/dist/bundle.es17.js +1 -1
  18. package/dist/bundle.es19.js +1 -1
  19. package/dist/bundle.es22.js +1 -1
  20. package/dist/bundle.es23.js +260 -13
  21. package/dist/bundle.es24.js +14 -21
  22. package/dist/bundle.es25.js +20 -37
  23. package/dist/bundle.es26.js +38 -21
  24. package/dist/bundle.es27.js +20 -18
  25. package/dist/bundle.es28.js +18 -20
  26. package/dist/bundle.es29.js +20 -43
  27. package/dist/bundle.es30.js +37 -114
  28. package/dist/bundle.es31.js +119 -72
  29. package/dist/bundle.es32.js +68 -38
  30. package/dist/bundle.es33.js +42 -10
  31. package/dist/bundle.es34.js +11 -85
  32. package/dist/bundle.es35.js +85 -19
  33. package/dist/bundle.es36.js +20 -7
  34. package/dist/bundle.es37.js +7 -3
  35. package/dist/bundle.es38.js +3 -23
  36. package/dist/bundle.es39.js +16 -45
  37. package/dist/bundle.es40.js +51 -56
  38. package/dist/bundle.es41.js +57 -162
  39. package/dist/bundle.es42.js +160 -79
  40. package/dist/bundle.es43.js +81 -7
  41. package/dist/bundle.es44.js +7 -35
  42. package/dist/bundle.es45.js +33 -20
  43. package/dist/bundle.es46.js +19 -47
  44. package/dist/bundle.es47.js +49 -11
  45. package/dist/bundle.es48.js +11 -13
  46. package/dist/bundle.es49.js +13 -13
  47. package/dist/bundle.es50.js +13 -30
  48. package/dist/bundle.es51.js +29 -25
  49. package/dist/bundle.es52.js +17 -29
  50. package/dist/bundle.es53.js +36 -48
  51. package/dist/bundle.es54.js +49 -50
  52. package/dist/bundle.es55.js +56 -8
  53. package/dist/bundle.es56.js +8 -26
  54. package/dist/bundle.es57.js +27 -5
  55. package/dist/bundle.es58.js +5 -66
  56. package/dist/bundle.es59.js +66 -23
  57. package/dist/bundle.es60.js +22 -23
  58. package/dist/bundle.es61.js +24 -88
  59. package/dist/bundle.es62.js +88 -18
  60. package/dist/bundle.es63.js +17 -92
  61. package/dist/bundle.es64.js +92 -73
  62. package/dist/bundle.es65.js +73 -23
  63. package/dist/bundle.es66.js +20 -35
  64. package/dist/bundle.es67.js +37 -68
  65. package/dist/bundle.es68.js +23 -10
  66. package/dist/bundle.es69.js +78 -42
  67. package/dist/bundle.es70.js +93 -33
  68. package/dist/bundle.es71.js +10 -66
  69. package/dist/bundle.es72.js +69 -40
  70. package/dist/bundle.es73.js +10 -14
  71. package/dist/bundle.es74.js +43 -32
  72. package/dist/bundle.es75.js +32 -69
  73. package/dist/bundle.es76.js +64 -12
  74. package/dist/bundle.es77.js +41 -75
  75. package/dist/bundle.es78.js +14 -48
  76. package/dist/bundle.es79.js +32 -14
  77. package/dist/bundle.es80.js +72 -0
  78. package/dist/bundle.es81.js +77 -0
  79. package/dist/bundle.es82.js +51 -0
  80. package/dist/bundle.es83.js +16 -0
  81. package/dist/bundle.es84.js +16 -0
  82. package/dist/bundle.es9.js +1 -1
  83. package/dist/index.d.ts +3 -1
  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.es24.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 C 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.es58.js";
8
+ import { DrawerContext as ie, useDrawerContext as J } from "./bundle.es68.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.es69.js";
10
+ import { usePreventScroll as de } from "./bundle.es70.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.es71.js";
12
+ const we = (m) => {
13
+ const { open: p, onOpenChange: l, onClosed: v, children: E, defaultOpen: y = !1, disableEsc: f } = m, [x, M] = t.useState(!1), [D, S] = t.useState(!1), [_, A] = t.useState(!1), P = 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), T = t.useRef(!1), N = t.useRef(!y), e = t.useRef(null), b = t.useRef(e.current?.getBoundingClientRect().height || 0), g = t.useRef(0), O = t.useRef(0), w = p ?? !1, V = t.useCallback(
14
+ (r) => {
15
+ l(r);
16
+ },
17
+ [l]
18
+ );
19
+ de({
20
+ isDisabled: !w || D || _ || !x
21
+ });
22
+ const ee = (r) => {
23
+ e.current && !e.current.contains(r.target) || (b.current = e.current?.getBoundingClientRect().height || 0, S(!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 && D) {
47
+ const c = h.current - r.pageY, n = c > 0, u = Math.abs(c), i = b.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(P.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
+ P.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) || T.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(O.current - i) > 60 && (T.current = !T.current), O.current = i, a > n || T.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(P.current, {
107
+ transition: `opacity ${Y.DURATION}s cubic-bezier(${Y.EASE.join(",")})`,
108
+ opacity: "1"
109
+ }));
110
+ }, re = () => {
111
+ !D || !e.current || (e.current.classList.remove(j), d.current = !1, S(!1), L.current = /* @__PURE__ */ new Date());
112
+ }, ne = (r) => {
113
+ if (!D || !e.current) return;
114
+ e.current.classList.remove(j), d.current = !1, S(!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 && (R(document.documentElement, {
139
+ scrollBehavior: "auto"
140
+ }), H.current = /* @__PURE__ */ new Date()), () => {
141
+ ae(document.documentElement, "scrollBehavior");
142
+ }), [w]), /* @__PURE__ */ s(
143
+ C.Root,
144
+ {
145
+ defaultOpen: y,
146
+ onOpenChange: (r) => {
147
+ r ? M(!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: P,
157
+ onPress: ee,
158
+ onRelease: ne,
159
+ onDrag: te,
160
+ isOpen: w,
161
+ isDragging: D,
162
+ keyboardIsOpen: T,
163
+ closeDrawer: () => B(),
164
+ shouldAnimate: N,
165
+ onClosed: v,
166
+ disableEsc: f
167
+ },
168
+ children: E
169
+ }
170
+ )
171
+ }
172
+ );
173
+ }, Re = t.forwardRef(
174
+ ({ className: m, ...p }, l) => {
175
+ const { overlayRef: v, onRelease: E, shouldAnimate: y } = J(), f = Q(l, v), x = t.useCallback(
176
+ (M) => E(M),
177
+ [E]
178
+ );
179
+ return /* @__PURE__ */ s(
180
+ C.Overlay,
181
+ {
182
+ onMouseUp: x,
183
+ ref: f,
184
+ "data-animate": y?.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: v, size: E, children: y, ...f }, x) => {
192
+ const {
193
+ drawerRef: M,
194
+ onPress: D,
195
+ onRelease: S,
196
+ onDrag: _,
197
+ keyboardIsOpen: A,
198
+ shouldAnimate: P,
199
+ onClosed: H,
200
+ disableEsc: I
201
+ } = J(), L = Q(x, M), o = t.useRef(null), d = t.useRef(null), h = t.useRef(!1), T = (e, b = 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 <= b ? !w : (h.current = !0, !0);
205
+ }, N = (e) => {
206
+ o.current = null, h.current = !1, S(e);
207
+ };
208
+ return /* @__PURE__ */ q(
209
+ C.Content,
210
+ {
211
+ "data-direction": "bottom",
212
+ "data-animate": P?.current ? "true" : "false",
213
+ className: G("popup drawer drawer-mobile", v),
214
+ style: { ...oe({ "--drawer-size": E ?? "50%" }), ...p },
215
+ ...f,
216
+ ref: L,
217
+ onPointerDown: (e) => {
218
+ f.onPointerDown?.(e), o.current = { x: e.pageX, y: e.pageY }, D(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 b = e.pageY - o.current.y, g = e.pageX - o.current.x, O = e.pointerType === "touch" ? 10 : 2;
232
+ T({ x: g, y: b }, O) ? _(e) : (Math.abs(g) > O || Math.abs(b) > O) && (o.current = null);
233
+ },
234
+ onPointerUp: (e) => {
235
+ f.onPointerUp?.(e), o.current = null, h.current = !1, S(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(C.Title, {}) }),
246
+ /* @__PURE__ */ s(K, { children: /* @__PURE__ */ s(C.Description, {}) }),
247
+ y
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, size: p, ...l }) => /* @__PURE__ */ s(we, { ...l, children: /* @__PURE__ */ q(C.Portal, { children: [
255
+ /* @__PURE__ */ s(Re, {}),
256
+ /* @__PURE__ */ s(De, { size: p, children: m })
257
+ ] }) });
258
+ Z.Close = C.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 f 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 u } from "./bundle.es57.js";
6
- const v = (i) => {
7
- const { open: t, onOpenChange: s, children: a, onClosed: c, disableEsc: p, overlay: n = {}, content: m = {} } = i, d = (h) => {
8
- p && h.preventDefault();
9
- };
10
- return /* @__PURE__ */ e(o.Root, { open: t, onOpenChange: s, children: /* @__PURE__ */ r(o.Portal, { children: [
11
- /* @__PURE__ */ e(o.Overlay, { ...n, className: f("popup-overlay", n.className) }),
12
- /* @__PURE__ */ r(o.Content, { ...m, onEscapeKeyDown: d, children: [
13
- /* @__PURE__ */ e(u, { callback: c }),
14
- /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Title, {}) }),
15
- /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Description, {}) }),
16
- a
17
- ] })
18
- ] }) });
19
- };
20
- v.Close = o.Close;
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 })
11
+ }
12
+ );
13
+ t.Close = a.Close;
21
14
  export {
22
- v 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.es57.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 n } from "react/jsx-runtime";
2
+ import y 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 u } from "./bundle.es58.js";
6
+ const C = (t) => {
7
+ const { open: i, onOpenChange: a, children: s, onClosed: c, disableEsc: p, overlay: r = {}, overlayRef: m, content: d = {}, contentRef: f } = t, h = (v) => {
8
+ p && v.preventDefault();
9
+ };
10
+ return /* @__PURE__ */ e(o.Root, { open: i, onOpenChange: a, children: /* @__PURE__ */ n(o.Portal, { children: [
11
+ /* @__PURE__ */ e(o.Overlay, { ...r, ref: m, className: y("popup-overlay", r.className) }),
12
+ /* @__PURE__ */ n(o.Content, { ...d, ref: f, onEscapeKeyDown: h, children: [
13
+ /* @__PURE__ */ e(u, { callback: c }),
14
+ /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Title, {}) }),
15
+ /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Description, {}) }),
16
+ s
35
17
  ] })
36
- ] })
37
- ] }) });
18
+ ] }) });
19
+ };
20
+ C.Close = o.Close;
38
21
  export {
39
- C as AlertDialog
22
+ C 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.es49.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.es58.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 d } from "react/jsx-runtime";
2
- import { useTabSlider as b, makeTabId as l } from "./bundle.es59.js";
3
- import * as n from "@radix-ui/react-tabs";
4
- import { useRef as m, useId as f, createContext as T, useContext as c } from "react";
5
- const o = T({ baseId: "", containerRef: {} }), u = ({ children: s, value: e, onChange: r }) => {
6
- const t = m(null), i = f().replaceAll(":", "");
7
- return /* @__PURE__ */ a(n.Root, { value: e, onValueChange: r, children: /* @__PURE__ */ a(o.Provider, { value: { baseId: i, containerRef: t }, children: /* @__PURE__ */ d(n.List, { className: "tabs", ref: t, children: [
8
- /* @__PURE__ */ a(x, { value: e }),
9
- s
10
- ] }) }) });
11
- }, x = ({ value: s }) => {
12
- const { baseId: e, containerRef: r } = c(o), t = b({ 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
- }, I = ({ children: s, value: e, ...r }) => {
15
- const { baseId: t } = c(o);
16
- return /* @__PURE__ */ a(n.Trigger, { ...r, id: l(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.es50.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
- u.Tab = I;
19
21
  export {
20
- u as Tabs
22
+ l as LoadingButton
21
23
  };
@@ -1,23 +1,21 @@
1
- import { jsx as d, Fragment as p } from "react/jsx-runtime";
2
- import { getNextCandleTime as T, sleep as S, getTimes as x } from "@companix/utils-js";
3
- import { useRef as g, useState as v, useEffect as s } from "react";
4
- const n = (t) => String(t).padStart(2, "0"), j = ({ expiration: t, separator: m = ":", onExpired: a }) => {
5
- const e = g(null), [, o] = v([]);
6
- s(() => {
7
- const c = Date.now(), f = T(c, "1s") - c;
8
- return e.current && clearInterval(e.current), S(f).then(() => {
9
- o([]), e.current = setInterval(() => {
10
- o([]);
11
- }, 1e3);
12
- }), () => {
13
- e.current && clearInterval(e.current);
14
- };
15
- }, [t]);
16
- const r = t - Date.now(), { hours: i, minutes: u, seconds: l } = x(r);
17
- return s(() => {
18
- r <= 0 && (a?.(), e.current && clearInterval(e.current));
19
- }, [r <= 0]), /* @__PURE__ */ d(p, { children: [n(i), n(u), n(l)].join(m) });
1
+ import { jsx as a, jsxs as d } from "react/jsx-runtime";
2
+ import { useTabSlider as b, makeTabId as l } from "./bundle.es60.js";
3
+ import * as n from "@radix-ui/react-tabs";
4
+ import { useRef as m, useId as f, createContext as T, useContext as c } from "react";
5
+ const o = T({ baseId: "", containerRef: {} }), u = ({ children: s, value: e, onChange: r }) => {
6
+ const t = m(null), i = f().replaceAll(":", "");
7
+ return /* @__PURE__ */ a(n.Root, { value: e, onValueChange: r, children: /* @__PURE__ */ a(o.Provider, { value: { baseId: i, containerRef: t }, children: /* @__PURE__ */ d(n.List, { className: "tabs", ref: t, children: [
8
+ /* @__PURE__ */ a(x, { value: e }),
9
+ s
10
+ ] }) }) });
11
+ }, x = ({ value: s }) => {
12
+ const { baseId: e, containerRef: r } = c(o), t = b({ 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
+ }, I = ({ children: s, value: e, ...r }) => {
15
+ const { baseId: t } = c(o);
16
+ return /* @__PURE__ */ a(n.Trigger, { ...r, id: l(t, e), className: "tab", value: e, children: s });
20
17
  };
18
+ u.Tab = I;
21
19
  export {
22
- j as Countdown
20
+ u as Tabs
23
21
  };
@@ -1,46 +1,23 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import u from "classnames";
3
- import { useResizeTextarea as z } from "./bundle.es48.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 { getNextCandleTime as T, sleep as S, getTimes as x } from "@companix/utils-js";
3
+ import { useRef as g, useState as v, useEffect as s } from "react";
4
+ const n = (t) => String(t).padStart(2, "0"), j = ({ expiration: t, separator: m = ":", onExpired: a }) => {
5
+ const e = g(null), [, o] = v([]);
6
+ s(() => {
7
+ const c = Date.now(), f = T(c, "1s") - c;
8
+ return e.current && clearInterval(e.current), S(f).then(() => {
9
+ o([]), e.current = setInterval(() => {
10
+ o([]);
11
+ }, 1e3);
12
+ }), () => {
13
+ e.current && clearInterval(e.current);
14
+ };
15
+ }, [t]);
16
+ const r = t - Date.now(), { hours: i, minutes: u, seconds: l } = x(r);
17
+ return s(() => {
18
+ r <= 0 && (a?.(), e.current && clearInterval(e.current));
19
+ }, [r <= 0]), /* @__PURE__ */ d(p, { children: [n(i), n(u), n(l)].join(m) });
43
20
  };
44
21
  export {
45
- E as TextArea
22
+ j as Countdown
46
23
  };