@companix/uikit 0.1.42 → 0.1.44

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 (84) hide show
  1. package/dist/CounterInput/CounterInput.scss +29 -0
  2. package/dist/CounterInput/index.d.ts +14 -0
  3. package/dist/Select/index.d.ts +9 -1
  4. package/dist/bundle.es.js +122 -120
  5. package/dist/bundle.es10.js +1 -1
  6. package/dist/bundle.es13.js +82 -76
  7. package/dist/bundle.es14.js +4 -4
  8. package/dist/bundle.es15.js +2 -2
  9. package/dist/bundle.es16.js +1 -1
  10. package/dist/bundle.es17.js +1 -1
  11. package/dist/bundle.es18.js +105 -19
  12. package/dist/bundle.es19.js +21 -34
  13. package/dist/bundle.es20.js +33 -24
  14. package/dist/bundle.es21.js +24 -45
  15. package/dist/bundle.es22.js +46 -26
  16. package/dist/bundle.es23.js +24 -259
  17. package/dist/bundle.es24.js +260 -13
  18. package/dist/bundle.es25.js +14 -21
  19. package/dist/bundle.es26.js +20 -37
  20. package/dist/bundle.es27.js +38 -21
  21. package/dist/bundle.es28.js +20 -18
  22. package/dist/bundle.es29.js +18 -21
  23. package/dist/bundle.es30.js +21 -43
  24. package/dist/bundle.es31.js +37 -114
  25. package/dist/bundle.es32.js +119 -72
  26. package/dist/bundle.es33.js +68 -38
  27. package/dist/bundle.es34.js +42 -10
  28. package/dist/bundle.es35.js +11 -85
  29. package/dist/bundle.es36.js +85 -19
  30. package/dist/bundle.es37.js +20 -7
  31. package/dist/bundle.es38.js +7 -3
  32. package/dist/bundle.es39.js +3 -23
  33. package/dist/bundle.es40.js +16 -45
  34. package/dist/bundle.es41.js +51 -56
  35. package/dist/bundle.es42.js +57 -162
  36. package/dist/bundle.es43.js +160 -79
  37. package/dist/bundle.es44.js +81 -7
  38. package/dist/bundle.es45.js +7 -59
  39. package/dist/bundle.es46.js +58 -33
  40. package/dist/bundle.es47.js +33 -20
  41. package/dist/bundle.es48.js +19 -47
  42. package/dist/bundle.es49.js +49 -11
  43. package/dist/bundle.es50.js +11 -13
  44. package/dist/bundle.es51.js +13 -13
  45. package/dist/bundle.es52.js +13 -30
  46. package/dist/bundle.es53.js +30 -11
  47. package/dist/bundle.es54.js +10 -25
  48. package/dist/bundle.es55.js +17 -29
  49. package/dist/bundle.es56.js +36 -48
  50. package/dist/bundle.es57.js +49 -55
  51. package/dist/bundle.es58.js +56 -8
  52. package/dist/bundle.es59.js +8 -26
  53. package/dist/bundle.es60.js +27 -5
  54. package/dist/bundle.es61.js +5 -66
  55. package/dist/bundle.es62.js +66 -23
  56. package/dist/bundle.es63.js +22 -23
  57. package/dist/bundle.es64.js +24 -90
  58. package/dist/bundle.es65.js +90 -18
  59. package/dist/bundle.es66.js +17 -93
  60. package/dist/bundle.es67.js +93 -73
  61. package/dist/bundle.es68.js +73 -23
  62. package/dist/bundle.es69.js +20 -35
  63. package/dist/bundle.es70.js +39 -24
  64. package/dist/bundle.es71.js +24 -79
  65. package/dist/bundle.es72.js +71 -85
  66. package/dist/bundle.es73.js +93 -10
  67. package/dist/bundle.es74.js +10 -6
  68. package/dist/bundle.es75.js +5 -69
  69. package/dist/bundle.es76.js +68 -10
  70. package/dist/bundle.es77.js +11 -42
  71. package/dist/bundle.es78.js +42 -32
  72. package/dist/bundle.es79.js +31 -64
  73. package/dist/bundle.es80.js +65 -40
  74. package/dist/bundle.es81.js +40 -14
  75. package/dist/bundle.es82.js +15 -32
  76. package/dist/bundle.es83.js +23 -61
  77. package/dist/bundle.es84.js +69 -13
  78. package/dist/bundle.es85.js +13 -74
  79. package/dist/bundle.es86.js +71 -45
  80. package/dist/bundle.es87.js +48 -13
  81. package/dist/bundle.es88.js +16 -0
  82. package/dist/index.d.ts +3 -1
  83. package/dist/index.scss +1 -0
  84. package/package.json +1 -1
@@ -1,263 +1,28 @@
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.es60.js";
8
- import { DrawerContext as ie, useDrawerContext as J } from "./bundle.es70.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.es71.js";
10
- import { usePreventScroll as de } from "./bundle.es72.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.es73.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);
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import r from "classnames";
3
+ import { customCSS as i } from "@companix/utils-browser";
4
+ import { PopupLayout as o } from "./bundle.es26.js";
5
+ const l = ({
6
+ direction: e,
7
+ children: t,
8
+ size: a,
9
+ overlayClassName: m,
10
+ className: s,
11
+ ...p
12
+ }) => /* @__PURE__ */ c(
13
+ o,
14
+ {
15
+ ...p,
16
+ overlay: { className: r("drawer-overlay", m) },
17
+ content: {
18
+ className: r("popup drawer", s),
19
+ style: i({ "--drawer-size": a ?? "50%" }),
20
+ "data-direction": e
16
21
  },
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
- );
22
+ children: t
189
23
  }
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;
24
+ );
25
+ l.Close = o.Close;
260
26
  export {
261
- Te as Handle,
262
- Z as MobileDrawer
27
+ l as Drawer
263
28
  };
@@ -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
  };