@okam/stack-ui 1.35.2 → 1.35.3

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 (120) hide show
  1. package/index.d.ts +1 -0
  2. package/index103.js +1 -1
  3. package/index103.mjs +1 -1
  4. package/index105.js +1 -1
  5. package/index105.mjs +1 -1
  6. package/index106.js +1 -1
  7. package/index106.mjs +3 -3
  8. package/index107.js +1 -1
  9. package/index107.mjs +1 -1
  10. package/index114.js +1 -1
  11. package/index114.mjs +3 -3
  12. package/index115.js +1 -1
  13. package/index115.mjs +3 -3
  14. package/index116.js +1 -1
  15. package/index116.mjs +1 -1
  16. package/index117.js +1 -1
  17. package/index117.mjs +1 -1
  18. package/index118.js +1 -1
  19. package/index118.mjs +1 -1
  20. package/index122.js +1 -1
  21. package/index122.mjs +1 -1
  22. package/index123.js +1 -1
  23. package/index123.mjs +1 -1
  24. package/index124.js +1 -1
  25. package/index124.mjs +1 -1
  26. package/index131.js +1 -1
  27. package/index131.mjs +1 -1
  28. package/index139.js +1 -1
  29. package/index139.mjs +46 -12
  30. package/index140.js +1 -1
  31. package/index140.mjs +238 -54
  32. package/index141.js +2 -1
  33. package/index141.mjs +13 -46
  34. package/index142.js +1 -1
  35. package/index142.mjs +28 -239
  36. package/index143.js +1 -2
  37. package/index143.mjs +11 -12
  38. package/index144.js +1 -1
  39. package/index144.mjs +57 -30
  40. package/index148.js +1 -1
  41. package/index148.mjs +1 -1
  42. package/index150.js +1 -1
  43. package/index150.mjs +68 -22
  44. package/index151.js +1 -1
  45. package/index151.mjs +370 -62
  46. package/index152.js +1 -1
  47. package/index152.mjs +44 -379
  48. package/index153.js +1 -1
  49. package/index153.mjs +4 -47
  50. package/index154.js +1 -1
  51. package/index154.mjs +25 -4
  52. package/index155.js +1 -1
  53. package/index155.mjs +46 -23
  54. package/index156.js +1 -1
  55. package/index156.mjs +4 -46
  56. package/index157.js +1 -1
  57. package/index157.mjs +24 -5
  58. package/index158.js +1 -1
  59. package/index158.mjs +11 -23
  60. package/index159.js +1 -1
  61. package/index159.mjs +4 -12
  62. package/index160.js +1 -1
  63. package/index160.mjs +14 -4
  64. package/index161.js +1 -1
  65. package/index161.mjs +21 -14
  66. package/index162.js +1 -1
  67. package/index162.mjs +42 -21
  68. package/index163.js +1 -1
  69. package/index163.mjs +23 -41
  70. package/index164.js +1 -1
  71. package/index164.mjs +42 -24
  72. package/index165.js +1 -1
  73. package/index165.mjs +27 -41
  74. package/index166.js +1 -1
  75. package/index166.mjs +30 -27
  76. package/index167.js +1 -1
  77. package/index167.mjs +13 -30
  78. package/index168.js +1 -1
  79. package/index168.mjs +28 -14
  80. package/index169.js +1 -1
  81. package/index169.mjs +9 -28
  82. package/index170.js +1 -1
  83. package/index170.mjs +6 -9
  84. package/index171.js +1 -1
  85. package/index171.mjs +5 -6
  86. package/index172.js +1 -1
  87. package/index172.mjs +13 -5
  88. package/index173.js +1 -1
  89. package/index173.mjs +8 -13
  90. package/index174.js +1 -1
  91. package/index174.mjs +17 -8
  92. package/index175.js +1 -1
  93. package/index175.mjs +19 -17
  94. package/index176.js +1 -1
  95. package/index176.mjs +54 -19
  96. package/index177.js +1 -1
  97. package/index177.mjs +23 -50
  98. package/index221.js +1 -1
  99. package/index221.mjs +2 -2
  100. package/index222.js +1 -1
  101. package/index222.mjs +1 -1
  102. package/index224.js +1 -1
  103. package/index224.mjs +1 -1
  104. package/index225.js +1 -1
  105. package/index225.mjs +2 -2
  106. package/index226.js +1 -1
  107. package/index226.mjs +4 -4
  108. package/index275.js +1 -1
  109. package/index275.mjs +3 -3
  110. package/index277.js +1 -1
  111. package/index277.mjs +2 -2
  112. package/index278.js +1 -1
  113. package/index278.mjs +5 -5
  114. package/index281.js +1 -1
  115. package/index281.mjs +3 -3
  116. package/index284.js +1 -1
  117. package/index284.mjs +1 -1
  118. package/index285.js +1 -1
  119. package/index285.mjs +4 -4
  120. package/package.json +3 -2
package/index152.mjs CHANGED
@@ -1,384 +1,49 @@
1
- import { setEventTarget as se, createSyntheticEvent as oe, preventFocus as B } from "./index278.mjs";
2
- import { restoreTextSelection as A, disableTextSelection as N } from "./index281.mjs";
3
- import { PressResponderContext as le } from "./index276.mjs";
4
- import { _ as fe } from "./index282.mjs";
5
- import { _ as ue } from "./index184.mjs";
6
- import { _ as W } from "./index283.mjs";
7
- import { chain as ce } from "./index157.mjs";
8
- import { nodeContains as p, getEventTarget as c } from "./index158.mjs";
9
- import { getOwnerDocument as Y, getOwnerWindow as I } from "./index159.mjs";
10
- import { mergeProps as te } from "./index115.mjs";
11
- import { focusWithoutScrolling as pe } from "./index163.mjs";
12
- import { openLink as z } from "./index164.mjs";
13
- import { useGlobalListeners as de } from "./index167.mjs";
14
- import { useSyncRef as ge } from "./index170.mjs";
15
- import { isMac as ve } from "./index165.mjs";
16
- import { isVirtualPointerEvent as Te, isVirtualClick as j } from "./index174.mjs";
17
- import { useEffectEvent as K } from "./index173.mjs";
18
- import { flushSync as Pe } from "react-dom";
19
- import { useState as ye, useRef as $e, useMemo as he, useEffect as q, useContext as me } from "react";
20
- function Ee(n) {
21
- let i = me(le);
22
- if (i) {
23
- let { register: o, ...l } = i;
24
- n = te(l, n), o();
25
- }
26
- return ge(i, n.ref), n;
27
- }
28
- var _ = /* @__PURE__ */ new WeakMap();
29
- class U {
30
- continuePropagation() {
31
- W(this, _, !1);
32
- }
33
- get shouldStopPropagation() {
34
- return fe(this, _);
35
- }
36
- constructor(i, o, l, d) {
37
- ue(this, _, {
38
- writable: !0,
39
- value: void 0
40
- }), W(this, _, !0);
41
- var $;
42
- let h = ($ = d == null ? void 0 : d.target) !== null && $ !== void 0 ? $ : l.currentTarget;
43
- const v = h == null ? void 0 : h.getBoundingClientRect();
44
- let C, S = 0, w, T = null;
45
- l.clientX != null && l.clientY != null && (w = l.clientX, T = l.clientY), v && (w != null && T != null ? (C = w - v.left, S = T - v.top) : (C = v.width / 2, S = v.height / 2)), this.type = i, this.pointerType = o, this.target = l.currentTarget, this.shiftKey = l.shiftKey, this.metaKey = l.metaKey, this.ctrlKey = l.ctrlKey, this.altKey = l.altKey, this.x = C, this.y = S;
46
- }
47
- }
48
- const J = Symbol("linkClicked");
49
- function We(n) {
50
- let { onPress: i, onPressChange: o, onPressStart: l, onPressEnd: d, onPressUp: $, onClick: h, isDisabled: v, isPressed: C, preventFocusOnPress: S, shouldCancelOnPointerExit: w, allowTextSelectionOnPress: T, ref: L, ...ne } = Ee(n), [ie, V] = ye(!1), k = $e({
51
- isPressed: !1,
52
- ignoreEmulatedMouseEvents: !1,
53
- didFirePressStart: !1,
54
- isTriggeringEvent: !1,
55
- activePointerId: null,
56
- target: null,
57
- isOverTarget: !1,
58
- pointerType: null,
59
- disposables: []
60
- }), { addGlobalListener: x, removeAllGlobalListeners: D } = de(), m = K((e, a) => {
61
- let g = k.current;
62
- if (v || g.didFirePressStart) return !1;
63
- let r = !0;
64
- if (g.isTriggeringEvent = !0, l) {
65
- let u = new U("pressstart", a, e);
66
- l(u), r = u.shouldStopPropagation;
67
- }
68
- return o && o(!0), g.isTriggeringEvent = !1, g.didFirePressStart = !0, V(!0), r;
69
- }), y = K((e, a, g = !0) => {
70
- let r = k.current;
71
- if (!r.didFirePressStart) return !1;
72
- r.didFirePressStart = !1, r.isTriggeringEvent = !0;
73
- let u = !0;
74
- if (d) {
75
- let t = new U("pressend", a, e);
76
- d(t), u = t.shouldStopPropagation;
77
- }
78
- if (o && o(!1), V(!1), i && g && !v) {
79
- let t = new U("press", a, e);
80
- i(t), u && (u = t.shouldStopPropagation);
81
- }
82
- return r.isTriggeringEvent = !1, u;
83
- }), O = K((e, a) => {
84
- let g = k.current;
85
- if (v) return !1;
86
- if ($) {
87
- g.isTriggeringEvent = !0;
88
- let r = new U("pressup", a, e);
89
- return $(r), g.isTriggeringEvent = !1, r.shouldStopPropagation;
90
- }
91
- return !0;
92
- }), P = K((e) => {
93
- let a = k.current;
94
- if (a.isPressed && a.target) {
95
- a.didFirePressStart && a.pointerType != null && y(M(a.target, e), a.pointerType, !1), a.isPressed = !1, a.isOverTarget = !1, a.activePointerId = null, a.pointerType = null, D(), T || A(a.target);
96
- for (let g of a.disposables) g();
97
- a.disposables = [];
98
- }
99
- }), X = K((e) => {
100
- w && P(e);
101
- }), F = K((e) => {
102
- h == null || h(e);
103
- }), R = K((e, a) => {
104
- if (h) {
105
- let g = new MouseEvent("click", e);
106
- se(g, a), h(oe(g));
107
- }
108
- }), ae = he(() => {
109
- let e = k.current, a = {
110
- onKeyDown(r) {
111
- if (H(r.nativeEvent, r.currentTarget) && p(r.currentTarget, c(r.nativeEvent))) {
112
- var u;
113
- ee(c(r.nativeEvent), r.key) && r.preventDefault();
114
- let t = !0;
115
- if (!e.isPressed && !r.repeat) {
116
- e.target = r.currentTarget, e.isPressed = !0, e.pointerType = "keyboard", t = m(r, "keyboard");
117
- let s = r.currentTarget, f = (E) => {
118
- H(E, s) && !E.repeat && p(s, c(E)) && e.target && O(M(e.target, E), "keyboard");
119
- };
120
- x(Y(r.currentTarget), "keyup", ce(f, g), !0);
121
- }
122
- t && r.stopPropagation(), r.metaKey && ve() && ((u = e.metaKeyEvents) === null || u === void 0 || u.set(r.key, r.nativeEvent));
123
- } else r.key === "Meta" && (e.metaKeyEvents = /* @__PURE__ */ new Map());
1
+ import { mergeProps as o } from "./index115.mjs";
2
+ import { filterDOMProps as O } from "./index161.mjs";
3
+ import { useFormReset as C } from "./index174.mjs";
4
+ import { usePress as c } from "./index151.mjs";
5
+ import { useFocusable as I } from "./index284.mjs";
6
+ function F(a, s, i) {
7
+ let { isDisabled: l = !1, isReadOnly: r = !1, value: d, name: b, children: f, "aria-label": u, "aria-labelledby": p, validationState: n = "valid", isInvalid: t } = a, m = (e) => {
8
+ e.stopPropagation(), s.setSelected(e.target.checked);
9
+ }, P = f != null, v = u != null || p != null;
10
+ !P && !v && process.env.NODE_ENV !== "production" && console.warn("If you do not provide children, you must specify an aria-label for accessibility");
11
+ let { pressProps: $, isPressed: g } = c({
12
+ isDisabled: l
13
+ }), { pressProps: y, isPressed: h } = c({
14
+ onPress() {
15
+ var e;
16
+ s.toggle(), (e = i.current) === null || e === void 0 || e.focus();
17
+ },
18
+ isDisabled: l || r
19
+ }), { focusableProps: x } = I(a, i), D = o($, x), S = O(a, {
20
+ labelable: !0
21
+ });
22
+ return C(i, s.isSelected, s.setSelected), {
23
+ labelProps: o(y, {
24
+ onClick: (e) => e.preventDefault()
25
+ }),
26
+ inputProps: o(S, {
27
+ "aria-invalid": t || n === "invalid" || void 0,
28
+ "aria-errormessage": a["aria-errormessage"],
29
+ "aria-controls": a["aria-controls"],
30
+ "aria-readonly": r || void 0,
31
+ onChange: m,
32
+ disabled: l,
33
+ ...d == null ? {} : {
34
+ value: d
124
35
  },
125
- onClick(r) {
126
- if (!(r && !p(r.currentTarget, c(r.nativeEvent))) && r && r.button === 0 && !e.isTriggeringEvent && !z.isOpening) {
127
- let u = !0;
128
- if (v && r.preventDefault(), !e.ignoreEmulatedMouseEvents && !e.isPressed && (e.pointerType === "virtual" || j(r.nativeEvent))) {
129
- let t = m(r, "virtual"), s = O(r, "virtual"), f = y(r, "virtual");
130
- F(r), u = t && s && f;
131
- } else if (e.isPressed && e.pointerType !== "keyboard") {
132
- let t = e.pointerType || r.nativeEvent.pointerType || "virtual";
133
- u = y(M(r.currentTarget, r), t, !0), e.isOverTarget = !1, F(r), P(r);
134
- }
135
- e.ignoreEmulatedMouseEvents = !1, u && r.stopPropagation();
136
- }
137
- }
138
- }, g = (r) => {
139
- var u;
140
- if (e.isPressed && e.target && H(r, e.target)) {
141
- var t;
142
- ee(c(r), r.key) && r.preventDefault();
143
- let f = c(r), E = p(e.target, c(r));
144
- y(M(e.target, r), "keyboard", E), E && R(r, e.target), D(), r.key !== "Enter" && G(e.target) && p(e.target, f) && !r[J] && (r[J] = !0, z(e.target, r, !1)), e.isPressed = !1, (t = e.metaKeyEvents) === null || t === void 0 || t.delete(r.key);
145
- } else if (r.key === "Meta" && (!((u = e.metaKeyEvents) === null || u === void 0) && u.size)) {
146
- var s;
147
- let f = e.metaKeyEvents;
148
- e.metaKeyEvents = void 0;
149
- for (let E of f.values()) (s = e.target) === null || s === void 0 || s.dispatchEvent(new KeyboardEvent("keyup", E));
150
- }
151
- };
152
- if (typeof PointerEvent < "u") {
153
- a.onPointerDown = (t) => {
154
- if (t.button !== 0 || !p(t.currentTarget, c(t.nativeEvent))) return;
155
- if (Te(t.nativeEvent)) {
156
- e.pointerType = "virtual";
157
- return;
158
- }
159
- e.pointerType = t.pointerType;
160
- let s = !0;
161
- if (!e.isPressed) {
162
- e.isPressed = !0, e.isOverTarget = !0, e.activePointerId = t.pointerId, e.target = t.currentTarget, T || N(e.target), s = m(t, e.pointerType);
163
- let f = c(t.nativeEvent);
164
- "releasePointerCapture" in f && f.releasePointerCapture(t.pointerId), x(Y(t.currentTarget), "pointerup", r, !1), x(Y(t.currentTarget), "pointercancel", u, !1);
165
- }
166
- s && t.stopPropagation();
167
- }, a.onMouseDown = (t) => {
168
- if (p(t.currentTarget, c(t.nativeEvent)) && t.button === 0) {
169
- if (S) {
170
- let s = B(t.target);
171
- s && e.disposables.push(s);
172
- }
173
- t.stopPropagation();
174
- }
175
- }, a.onPointerUp = (t) => {
176
- !p(t.currentTarget, c(t.nativeEvent)) || e.pointerType === "virtual" || t.button === 0 && O(t, e.pointerType || t.pointerType);
177
- }, a.onPointerEnter = (t) => {
178
- t.pointerId === e.activePointerId && e.target && !e.isOverTarget && e.pointerType != null && (e.isOverTarget = !0, m(M(e.target, t), e.pointerType));
179
- }, a.onPointerLeave = (t) => {
180
- t.pointerId === e.activePointerId && e.target && e.isOverTarget && e.pointerType != null && (e.isOverTarget = !1, y(M(e.target, t), e.pointerType, !1), X(t));
181
- };
182
- let r = (t) => {
183
- if (t.pointerId === e.activePointerId && e.isPressed && t.button === 0 && e.target) {
184
- if (p(e.target, c(t)) && e.pointerType != null) {
185
- let s = !1, f = setTimeout(() => {
186
- e.isPressed && e.target instanceof HTMLElement && (s ? P(t) : (pe(e.target), e.target.click()));
187
- }, 80);
188
- x(t.currentTarget, "click", () => s = !0, !0), e.disposables.push(() => clearTimeout(f));
189
- } else P(t);
190
- e.isOverTarget = !1;
191
- }
192
- }, u = (t) => {
193
- P(t);
194
- };
195
- a.onDragStart = (t) => {
196
- p(t.currentTarget, c(t.nativeEvent)) && P(t);
197
- };
198
- } else if (process.env.NODE_ENV === "test") {
199
- a.onMouseDown = (t) => {
200
- if (t.button !== 0 || !p(t.currentTarget, c(t.nativeEvent))) return;
201
- if (e.ignoreEmulatedMouseEvents) {
202
- t.stopPropagation();
203
- return;
204
- }
205
- if (e.isPressed = !0, e.isOverTarget = !0, e.target = t.currentTarget, e.pointerType = j(t.nativeEvent) ? "virtual" : "mouse", Pe(() => m(t, e.pointerType)) && t.stopPropagation(), S) {
206
- let f = B(t.target);
207
- f && e.disposables.push(f);
208
- }
209
- x(Y(t.currentTarget), "mouseup", r, !1);
210
- }, a.onMouseEnter = (t) => {
211
- if (!p(t.currentTarget, c(t.nativeEvent))) return;
212
- let s = !0;
213
- e.isPressed && !e.ignoreEmulatedMouseEvents && e.pointerType != null && (e.isOverTarget = !0, s = m(t, e.pointerType)), s && t.stopPropagation();
214
- }, a.onMouseLeave = (t) => {
215
- if (!p(t.currentTarget, c(t.nativeEvent))) return;
216
- let s = !0;
217
- e.isPressed && !e.ignoreEmulatedMouseEvents && e.pointerType != null && (e.isOverTarget = !1, s = y(t, e.pointerType, !1), X(t)), s && t.stopPropagation();
218
- }, a.onMouseUp = (t) => {
219
- p(t.currentTarget, c(t.nativeEvent)) && !e.ignoreEmulatedMouseEvents && t.button === 0 && O(t, e.pointerType || "mouse");
220
- };
221
- let r = (t) => {
222
- if (t.button === 0) {
223
- if (e.ignoreEmulatedMouseEvents) {
224
- e.ignoreEmulatedMouseEvents = !1;
225
- return;
226
- }
227
- e.target && e.target.contains(t.target) && e.pointerType != null || P(t), e.isOverTarget = !1;
228
- }
229
- };
230
- a.onTouchStart = (t) => {
231
- if (!p(t.currentTarget, c(t.nativeEvent))) return;
232
- let s = be(t.nativeEvent);
233
- if (!s) return;
234
- e.activePointerId = s.identifier, e.ignoreEmulatedMouseEvents = !0, e.isOverTarget = !0, e.isPressed = !0, e.target = t.currentTarget, e.pointerType = "touch", T || N(e.target), m(b(e.target, t), e.pointerType) && t.stopPropagation(), x(I(t.currentTarget), "scroll", u, !0);
235
- }, a.onTouchMove = (t) => {
236
- if (!p(t.currentTarget, c(t.nativeEvent))) return;
237
- if (!e.isPressed) {
238
- t.stopPropagation();
239
- return;
240
- }
241
- let s = Q(t.nativeEvent, e.activePointerId), f = !0;
242
- s && Z(s, t.currentTarget) ? !e.isOverTarget && e.pointerType != null && (e.isOverTarget = !0, f = m(b(e.target, t), e.pointerType)) : e.isOverTarget && e.pointerType != null && (e.isOverTarget = !1, f = y(b(e.target, t), e.pointerType, !1), X(b(e.target, t))), f && t.stopPropagation();
243
- }, a.onTouchEnd = (t) => {
244
- if (!p(t.currentTarget, c(t.nativeEvent))) return;
245
- if (!e.isPressed) {
246
- t.stopPropagation();
247
- return;
248
- }
249
- let s = Q(t.nativeEvent, e.activePointerId), f = !0;
250
- s && Z(s, t.currentTarget) && e.pointerType != null ? (O(b(e.target, t), e.pointerType), f = y(b(e.target, t), e.pointerType), R(t.nativeEvent, e.target)) : e.isOverTarget && e.pointerType != null && (f = y(b(e.target, t), e.pointerType, !1)), f && t.stopPropagation(), e.isPressed = !1, e.activePointerId = null, e.isOverTarget = !1, e.ignoreEmulatedMouseEvents = !0, e.target && !T && A(e.target), D();
251
- }, a.onTouchCancel = (t) => {
252
- p(t.currentTarget, c(t.nativeEvent)) && (t.stopPropagation(), e.isPressed && P(b(e.target, t)));
253
- };
254
- let u = (t) => {
255
- e.isPressed && p(c(t), e.target) && P({
256
- currentTarget: e.target,
257
- shiftKey: !1,
258
- ctrlKey: !1,
259
- metaKey: !1,
260
- altKey: !1
261
- });
262
- };
263
- a.onDragStart = (t) => {
264
- p(t.currentTarget, c(t.nativeEvent)) && P(t);
265
- };
266
- }
267
- return a;
268
- }, [
269
- x,
270
- v,
271
- S,
272
- D,
273
- T,
274
- P,
275
- X,
276
- y,
277
- m,
278
- O,
279
- F,
280
- R
281
- ]);
282
- return q(() => {
283
- let e = L == null ? void 0 : L.current;
284
- e && e instanceof I(e).Element && I(e).getComputedStyle(e).touchAction === "auto" && (e.style.touchAction = "pan-x pan-y pinch-zoom");
285
- }, [
286
- L
287
- ]), q(() => {
288
- let e = k.current;
289
- return () => {
290
- var a;
291
- T || A((a = e.target) !== null && a !== void 0 ? a : void 0);
292
- for (let g of e.disposables) g();
293
- e.disposables = [];
294
- };
295
- }, [
296
- T
297
- ]), {
298
- isPressed: C || ie,
299
- pressProps: te(ne, ae)
36
+ name: b,
37
+ type: "checkbox",
38
+ ...D
39
+ }),
40
+ isSelected: s.isSelected,
41
+ isPressed: g || h,
42
+ isDisabled: l,
43
+ isReadOnly: r,
44
+ isInvalid: t || n === "invalid"
300
45
  };
301
46
  }
302
- function G(n) {
303
- return n.tagName === "A" && n.hasAttribute("href");
304
- }
305
- function H(n, i) {
306
- const { key: o, code: l } = n, d = i, $ = d.getAttribute("role");
307
- return (o === "Enter" || o === " " || o === "Spacebar" || l === "Space") && !(d instanceof I(d).HTMLInputElement && !re(d, o) || d instanceof I(d).HTMLTextAreaElement || d.isContentEditable) && // Links should only trigger with Enter key
308
- !(($ === "link" || !$ && G(d)) && o !== "Enter");
309
- }
310
- function be(n) {
311
- const { targetTouches: i } = n;
312
- return i.length > 0 ? i[0] : null;
313
- }
314
- function Q(n, i) {
315
- const o = n.changedTouches;
316
- for (let l = 0; l < o.length; l++) {
317
- const d = o[l];
318
- if (d.identifier === i) return d;
319
- }
320
- return null;
321
- }
322
- function b(n, i) {
323
- let o = 0, l = 0;
324
- return i.targetTouches && i.targetTouches.length === 1 && (o = i.targetTouches[0].clientX, l = i.targetTouches[0].clientY), {
325
- currentTarget: n,
326
- shiftKey: i.shiftKey,
327
- ctrlKey: i.ctrlKey,
328
- metaKey: i.metaKey,
329
- altKey: i.altKey,
330
- clientX: o,
331
- clientY: l
332
- };
333
- }
334
- function M(n, i) {
335
- let o = i.clientX, l = i.clientY;
336
- return {
337
- currentTarget: n,
338
- shiftKey: i.shiftKey,
339
- ctrlKey: i.ctrlKey,
340
- metaKey: i.metaKey,
341
- altKey: i.altKey,
342
- clientX: o,
343
- clientY: l
344
- };
345
- }
346
- function Se(n) {
347
- let i = 0, o = 0;
348
- return n.width !== void 0 ? i = n.width / 2 : n.radiusX !== void 0 && (i = n.radiusX), n.height !== void 0 ? o = n.height / 2 : n.radiusY !== void 0 && (o = n.radiusY), {
349
- top: n.clientY - o,
350
- right: n.clientX + i,
351
- bottom: n.clientY + o,
352
- left: n.clientX - i
353
- };
354
- }
355
- function xe(n, i) {
356
- return !(n.left > i.right || i.left > n.right || n.top > i.bottom || i.top > n.bottom);
357
- }
358
- function Z(n, i) {
359
- let o = i.getBoundingClientRect(), l = Se(n);
360
- return xe(o, l);
361
- }
362
- function Ke(n) {
363
- return n instanceof HTMLInputElement ? !1 : n instanceof HTMLButtonElement ? n.type !== "submit" && n.type !== "reset" : !G(n);
364
- }
365
- function ee(n, i) {
366
- return n instanceof HTMLInputElement ? !re(n, i) : Ke(n);
367
- }
368
- const ke = /* @__PURE__ */ new Set([
369
- "checkbox",
370
- "radio",
371
- "range",
372
- "color",
373
- "file",
374
- "image",
375
- "button",
376
- "submit",
377
- "reset"
378
- ]);
379
- function re(n, i) {
380
- return n.type === "checkbox" || n.type === "radio" ? i === " " : ke.has(n.type);
381
- }
382
47
  export {
383
- We as usePress
48
+ F as useToggle
384
49
  };
package/index153.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index115.js"),R=require("./index162.js"),C=require("./index175.js"),u=require("./index152.js"),F=require("./index284.js");function I(s,l,a){let{isDisabled:r=!1,isReadOnly:i=!1,value:n,name:c,children:b,"aria-label":P,"aria-labelledby":p,validationState:t="valid",isInvalid:d}=s,v=e=>{e.stopPropagation(),l.setSelected(e.target.checked)},f=b!=null,g=P!=null||p!=null;!f&&!g&&process.env.NODE_ENV!=="production"&&console.warn("If you do not provide children, you must specify an aria-label for accessibility");let{pressProps:m,isPressed:y}=u.usePress({isDisabled:r}),{pressProps:h,isPressed:D}=u.usePress({onPress(){var e;l.toggle(),(e=a.current)===null||e===void 0||e.focus()},isDisabled:r||i}),{focusableProps:S}=F.useFocusable(s,a),O=o.mergeProps(m,S),q=R.filterDOMProps(s,{labelable:!0});return C.useFormReset(a,l.isSelected,l.setSelected),{labelProps:o.mergeProps(h,{onClick:e=>e.preventDefault()}),inputProps:o.mergeProps(q,{"aria-invalid":d||t==="invalid"||void 0,"aria-errormessage":s["aria-errormessage"],"aria-controls":s["aria-controls"],"aria-readonly":i||void 0,onChange:v,disabled:r,...n==null?{}:{value:n},name:c,type:"checkbox",...O}),isSelected:l.isSelected,isPressed:y||D,isDisabled:r,isReadOnly:i,isInvalid:d||t==="invalid"}}exports.useToggle=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=typeof document<"u"?e.useLayoutEffect:()=>{};exports.useLayoutEffect=t;
package/index153.mjs CHANGED
@@ -1,49 +1,6 @@
1
- import { mergeProps as o } from "./index115.mjs";
2
- import { filterDOMProps as O } from "./index162.mjs";
3
- import { useFormReset as C } from "./index175.mjs";
4
- import { usePress as c } from "./index152.mjs";
5
- import { useFocusable as I } from "./index284.mjs";
6
- function F(a, s, i) {
7
- let { isDisabled: l = !1, isReadOnly: r = !1, value: d, name: b, children: f, "aria-label": u, "aria-labelledby": p, validationState: n = "valid", isInvalid: t } = a, m = (e) => {
8
- e.stopPropagation(), s.setSelected(e.target.checked);
9
- }, P = f != null, v = u != null || p != null;
10
- !P && !v && process.env.NODE_ENV !== "production" && console.warn("If you do not provide children, you must specify an aria-label for accessibility");
11
- let { pressProps: $, isPressed: g } = c({
12
- isDisabled: l
13
- }), { pressProps: y, isPressed: h } = c({
14
- onPress() {
15
- var e;
16
- s.toggle(), (e = i.current) === null || e === void 0 || e.focus();
17
- },
18
- isDisabled: l || r
19
- }), { focusableProps: x } = I(a, i), D = o($, x), S = O(a, {
20
- labelable: !0
21
- });
22
- return C(i, s.isSelected, s.setSelected), {
23
- labelProps: o(y, {
24
- onClick: (e) => e.preventDefault()
25
- }),
26
- inputProps: o(S, {
27
- "aria-invalid": t || n === "invalid" || void 0,
28
- "aria-errormessage": a["aria-errormessage"],
29
- "aria-controls": a["aria-controls"],
30
- "aria-readonly": r || void 0,
31
- onChange: m,
32
- disabled: l,
33
- ...d == null ? {} : {
34
- value: d
35
- },
36
- name: b,
37
- type: "checkbox",
38
- ...D
39
- }),
40
- isSelected: s.isSelected,
41
- isPressed: g || h,
42
- isDisabled: l,
43
- isReadOnly: r,
44
- isInvalid: t || n === "invalid"
45
- };
46
- }
1
+ import e from "react";
2
+ const f = typeof document < "u" ? e.useLayoutEffect : () => {
3
+ };
47
4
  export {
48
- F as useToggle
5
+ f as useLayoutEffect
49
6
  };
package/index154.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=typeof document<"u"?e.useLayoutEffect:()=>{};exports.useLayoutEffect=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index172.js"),a=require("./index153.js"),n=require("react");function o(c){let[u,l]=n.useState(c),e=n.useRef(null),r=f.useEffectEvent(()=>{if(!e.current)return;let t=e.current.next();if(t.done){e.current=null;return}u===t.value?r():l(t.value)});a.useLayoutEffect(()=>{e.current&&r()});let s=f.useEffectEvent(t=>{e.current=t(u),r()});return[u,s]}exports.useValueEffect=o;
package/index154.mjs CHANGED
@@ -1,6 +1,27 @@
1
- import e from "react";
2
- const f = typeof document < "u" ? e.useLayoutEffect : () => {
3
- };
1
+ import { useEffectEvent as u } from "./index172.mjs";
2
+ import { useLayoutEffect as l } from "./index153.mjs";
3
+ import { useState as o, useRef as s } from "react";
4
+ function p(a) {
5
+ let [f, c] = o(a), e = s(null), r = u(() => {
6
+ if (!e.current) return;
7
+ let t = e.current.next();
8
+ if (t.done) {
9
+ e.current = null;
10
+ return;
11
+ }
12
+ f === t.value ? r() : c(t.value);
13
+ });
14
+ l(() => {
15
+ e.current && r();
16
+ });
17
+ let n = u((t) => {
18
+ e.current = t(f), r();
19
+ });
20
+ return [
21
+ f,
22
+ n
23
+ ];
24
+ }
4
25
  export {
5
- f as useLayoutEffect
26
+ p as useValueEffect
6
27
  };
package/index155.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index173.js"),a=require("./index154.js"),n=require("react");function o(c){let[u,l]=n.useState(c),e=n.useRef(null),r=f.useEffectEvent(()=>{if(!e.current)return;let t=e.current.next();if(t.done){e.current=null;return}u===t.value?r():l(t.value)});a.useLayoutEffect(()=>{e.current&&r()});let s=f.useEffectEvent(t=>{e.current=t(u),r()});return[u,s]}exports.useValueEffect=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),c={prefix:String(Math.round(Math.random()*1e10)),current:0},d=e.createContext(c),l=e.createContext(!1);let f=!!(typeof window<"u"&&window.document&&window.document.createElement),s=new WeakMap;function v(r=!1){let t=e.useContext(d),n=e.useRef(null);if(n.current===null&&!r){var a,u;let o=(u=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||u===void 0||(a=u.ReactCurrentOwner)===null||a===void 0?void 0:a.current;if(o){let i=s.get(o);i==null?s.set(o,{id:t.current,state:o.memoizedState}):o.memoizedState!==i.state&&(t.current=i.id,s.delete(o))}n.current=++t.current}return n.current}function p(r){let t=e.useContext(d);t===c&&!f&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let n=v(!!r),a=t===c&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return r||`${a}-${n}`}function S(r){let t=e.useId(),[n]=e.useState($()),a=n||process.env.NODE_ENV==="test"?"react-aria":`react-aria${c.prefix}`;return r||`${a}-${t}`}const b=typeof e.useId=="function"?S:p;function x(){return!1}function m(){return!0}function g(r){return()=>{}}function $(){return typeof e.useSyncExternalStore=="function"?e.useSyncExternalStore(g,x,m):e.useContext(l)}exports.useIsSSR=$;exports.useSSRSafeId=b;
package/index155.mjs CHANGED
@@ -1,27 +1,50 @@
1
- import { useEffectEvent as u } from "./index173.mjs";
2
- import { useLayoutEffect as l } from "./index154.mjs";
3
- import { useState as o, useRef as s } from "react";
4
- function p(a) {
5
- let [f, c] = o(a), e = s(null), r = u(() => {
6
- if (!e.current) return;
7
- let t = e.current.next();
8
- if (t.done) {
9
- e.current = null;
10
- return;
1
+ import a, { useContext as d, useState as f, useRef as l } from "react";
2
+ const c = {
3
+ prefix: String(Math.round(Math.random() * 1e10)),
4
+ current: 0
5
+ }, $ = /* @__PURE__ */ a.createContext(c), p = /* @__PURE__ */ a.createContext(!1);
6
+ let v = !!(typeof window < "u" && window.document && window.document.createElement), s = /* @__PURE__ */ new WeakMap();
7
+ function S(t = !1) {
8
+ let e = d($), r = l(null);
9
+ if (r.current === null && !t) {
10
+ var n, u;
11
+ let o = (u = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || u === void 0 || (n = u.ReactCurrentOwner) === null || n === void 0 ? void 0 : n.current;
12
+ if (o) {
13
+ let i = s.get(o);
14
+ i == null ? s.set(o, {
15
+ id: e.current,
16
+ state: o.memoizedState
17
+ }) : o.memoizedState !== i.state && (e.current = i.id, s.delete(o));
11
18
  }
12
- f === t.value ? r() : c(t.value);
13
- });
14
- l(() => {
15
- e.current && r();
16
- });
17
- let n = u((t) => {
18
- e.current = t(f), r();
19
- });
20
- return [
21
- f,
22
- n
23
- ];
19
+ r.current = ++e.current;
20
+ }
21
+ return r.current;
22
+ }
23
+ function b(t) {
24
+ let e = d($);
25
+ e === c && !v && process.env.NODE_ENV !== "production" && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
26
+ let r = S(!!t), n = e === c && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${e.prefix}`;
27
+ return t || `${n}-${r}`;
28
+ }
29
+ function x(t) {
30
+ let e = a.useId(), [r] = f(y()), n = r || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${c.prefix}`;
31
+ return t || `${n}-${e}`;
32
+ }
33
+ const C = typeof a.useId == "function" ? x : b;
34
+ function m() {
35
+ return !1;
36
+ }
37
+ function w() {
38
+ return !0;
39
+ }
40
+ function g(t) {
41
+ return () => {
42
+ };
43
+ }
44
+ function y() {
45
+ return typeof a.useSyncExternalStore == "function" ? a.useSyncExternalStore(g, m, w) : d(p);
24
46
  }
25
47
  export {
26
- p as useValueEffect
48
+ y as useIsSSR,
49
+ C as useSSRSafeId
27
50
  };
package/index156.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),c={prefix:String(Math.round(Math.random()*1e10)),current:0},d=e.createContext(c),l=e.createContext(!1);let f=!!(typeof window<"u"&&window.document&&window.document.createElement),s=new WeakMap;function v(r=!1){let t=e.useContext(d),n=e.useRef(null);if(n.current===null&&!r){var a,u;let o=(u=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||u===void 0||(a=u.ReactCurrentOwner)===null||a===void 0?void 0:a.current;if(o){let i=s.get(o);i==null?s.set(o,{id:t.current,state:o.memoizedState}):o.memoizedState!==i.state&&(t.current=i.id,s.delete(o))}n.current=++t.current}return n.current}function p(r){let t=e.useContext(d);t===c&&!f&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let n=v(!!r),a=t===c&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return r||`${a}-${n}`}function S(r){let t=e.useId(),[n]=e.useState($()),a=n||process.env.NODE_ENV==="test"?"react-aria":`react-aria${c.prefix}`;return r||`${a}-${t}`}const b=typeof e.useId=="function"?S:p;function x(){return!1}function m(){return!0}function g(r){return()=>{}}function $(){return typeof e.useSyncExternalStore=="function"?e.useSyncExternalStore(g,x,m):e.useContext(l)}exports.useIsSSR=$;exports.useSSRSafeId=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(...t){return(...f)=>{for(let e of t)typeof e=="function"&&e(...f)}}exports.chain=o;