@midas-ds/components 1.0.2 → 1.0.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 (125) hide show
  1. package/Button-B4vMZbC6.js +182 -0
  2. package/CHANGELOG.md +10 -0
  3. package/Checkbox-DnKWanep.js +402 -0
  4. package/{Collection-B3xUVWPF.js → Collection-COLWgm24.js} +179 -152
  5. package/Dialog-Cb6toyXO.js +1951 -0
  6. package/DragAndDrop-B0T3WgjL.js +40 -0
  7. package/FocusScope-C8i7CH6y.js +513 -0
  8. package/Form-BQQs3jUk.js +238 -0
  9. package/Group-CdwXhx8Q.js +42 -0
  10. package/{Hidden-BQWDvze4.js → Hidden-DngIphiL.js} +1 -1
  11. package/Link-iAZLB3RI.js +75 -0
  12. package/ListBox-BKWkIIm6.js +474 -0
  13. package/ListKeyboardDelegate-BH-K5hyq.js +172 -0
  14. package/{PressResponder-DP8ZDNGy.js → PressResponder-Cz-TRBHO.js} +10 -10
  15. package/README.md +21 -3
  16. package/SelectionManager-8o40f7mx.js +1047 -0
  17. package/Separator-BlvmQjwz.js +49 -0
  18. package/Tag--W5TgxmK.js +728 -0
  19. package/Text-CQPW6xs7.js +15 -0
  20. package/TextField-DeK_yiK-.js +225 -0
  21. package/TextField.module-0-u4LVPp.js +143 -0
  22. package/{VisuallyHidden-B_XzVvlX.js → VisuallyHidden-CFx06Bae.js} +1 -1
  23. package/{context-ScOIq_Gu.js → context-Bnqknrce.js} +1 -1
  24. package/index-B-jHjTDC.js +120 -0
  25. package/{index-CorR1LBD.js → index-BPdc9gJ8.js} +3 -3
  26. package/index-DK9ZACEc.js +642 -0
  27. package/{index-Dl1Q-tbj.js → index-KSgQWWiy.js} +5315 -5315
  28. package/index.js +45 -47
  29. package/index15.js +1 -1
  30. package/index16.js +1 -1
  31. package/index25.js +1 -1
  32. package/index26.js +1 -1
  33. package/index3.js +2 -4
  34. package/index31.js +3 -3
  35. package/index32.js +2 -2
  36. package/index33.js +2 -2
  37. package/index34.js +1 -1
  38. package/index35.js +1 -1
  39. package/index36.js +1 -1
  40. package/index37.js +1 -1
  41. package/index38.js +1 -1
  42. package/index39.js +1 -1
  43. package/index40.js +1 -1
  44. package/index41.js +1 -1
  45. package/index42.js +1 -1
  46. package/index43.js +1 -1
  47. package/index45.js +3 -3
  48. package/index5.js +1 -1
  49. package/index50.js +1 -1
  50. package/index52.js +3 -3
  51. package/index53.js +3 -3
  52. package/index54.js +1 -1
  53. package/index55.js +4 -4
  54. package/index56.js +1 -1
  55. package/index57.js +1 -1
  56. package/index58.js +1 -1
  57. package/index59.js +3 -3
  58. package/index60.js +1 -1
  59. package/index61.js +1 -1
  60. package/index62.js +1 -1
  61. package/index63.js +4 -4
  62. package/index64.js +3 -3
  63. package/index65.js +3 -3
  64. package/index66.js +1 -1
  65. package/index67.js +3 -3
  66. package/index68.js +2 -2
  67. package/index69.js +1 -1
  68. package/index71.js +1 -1
  69. package/index76.js +5 -5
  70. package/index77.js +2 -2
  71. package/index78.js +2 -2
  72. package/index79.js +1 -1
  73. package/index80.js +226 -227
  74. package/index81.js +197 -199
  75. package/index82.js +192 -195
  76. package/index83.js +181 -183
  77. package/index84.js +52 -54
  78. package/index85.js +261 -262
  79. package/index86.js +262 -262
  80. package/index87.js +209 -211
  81. package/index88.js +436 -440
  82. package/index89.js +962 -964
  83. package/index90.js +2401 -2399
  84. package/index92.js +5 -5
  85. package/index93.js +1 -1
  86. package/index94.js +1 -1
  87. package/link/Link.d.ts +2 -2
  88. package/link-button/LinkButton.d.ts +1 -1
  89. package/package.json +7 -1
  90. package/{react.esm-D8HpDGKP.js → react.esm-sMU8Z7rL.js} +1872 -1872
  91. package/textfield/index.d.ts +0 -2
  92. package/{useControlledState-S_TYcV_c.js → useControlledState-DrAoodI6.js} +1 -1
  93. package/{useDescription-D4_zk_sA.js → useDescription-BPs7eRff.js} +1 -1
  94. package/useField-Dz62UHCP.js +67 -0
  95. package/{useFilter-BnJDBCkt.js → useFilter-ViwzkzZe.js} +1 -1
  96. package/useFocusRing-BKGhL91C.js +1297 -0
  97. package/{useFocusable-C-N9wcwm.js → useFocusable-CRSmYEQc.js} +11 -8
  98. package/{useGridSelectionCheckbox-i1rsjlC-.js → useGridSelectionCheckbox-CVEvUCJL.js} +3 -3
  99. package/useHasTabbableChild-C8y4fwiY.js +34 -0
  100. package/{useHighlightSelectionDescription-JVx2MW_e.js → useHighlightSelectionDescription-CD74uzLh.js} +19 -19
  101. package/useListState-DKnP5TB5.js +119 -0
  102. package/{useLocalizedStringFormatter-DVCAZqcL.js → useLocalizedStringFormatter-DsZ-ZWSk.js} +29 -29
  103. package/{useSingleSelectListState-CmX9_L5H.js → useSingleSelectListState-BHTLh8Ob.js} +5 -5
  104. package/Button-CCevm2s3.js +0 -183
  105. package/Checkbox-CllWDBxF.js +0 -405
  106. package/Dialog-CLTyYwkS.js +0 -1889
  107. package/DragAndDrop-OTN7La7U.js +0 -42
  108. package/FocusScope-BR0SJ-cZ.js +0 -512
  109. package/Form-DXLoQL91.js +0 -240
  110. package/Group-DPMuN3h8.js +0 -44
  111. package/Label-C18A_4Z5.js +0 -69
  112. package/Link-BU1h3K2a.js +0 -77
  113. package/ListBox-D21tdwTs.js +0 -463
  114. package/ListKeyboardDelegate-DxMjfMsI.js +0 -172
  115. package/SelectionManager-D4WtKtey.js +0 -988
  116. package/Separator-DLUHK9vv.js +0 -48
  117. package/Tag-CEd6WWSc.js +0 -725
  118. package/Text-DGLaY3HR.js +0 -17
  119. package/TextField-C_hq9WeT.js +0 -226
  120. package/TextField.module-Cwq1FAm7.js +0 -141
  121. package/index-CEg5vZQH.js +0 -132
  122. package/index-CgfokhRq.js +0 -674
  123. package/useFocusRing-D97-G3fT.js +0 -1324
  124. package/useHasTabbableChild-DeuCnGGv.js +0 -34
  125. package/useListState-DSOTbsL3.js +0 -119
@@ -0,0 +1,238 @@
1
+ import { J as b, k as N, K as Q, n as q, d as J } from "./useFocusRing-BKGhL91C.js";
2
+ import R, { useRef as x, useEffect as S, createContext as L, useMemo as y, useContext as D, useState as m, forwardRef as B } from "react";
3
+ import { a as K } from "./Text-CQPW6xs7.js";
4
+ function re(t, e, a) {
5
+ let i = x(e), r = b(() => {
6
+ a && a(i.current);
7
+ });
8
+ S(() => {
9
+ var n;
10
+ let l = t == null || (n = t.current) === null || n === void 0 ? void 0 : n.form;
11
+ return l == null || l.addEventListener("reset", r), () => {
12
+ l == null || l.removeEventListener("reset", r);
13
+ };
14
+ }, [
15
+ t,
16
+ r
17
+ ]);
18
+ }
19
+ const C = {
20
+ badInput: !1,
21
+ customError: !1,
22
+ patternMismatch: !1,
23
+ rangeOverflow: !1,
24
+ rangeUnderflow: !1,
25
+ stepMismatch: !1,
26
+ tooLong: !1,
27
+ tooShort: !1,
28
+ typeMismatch: !1,
29
+ valueMissing: !1,
30
+ valid: !0
31
+ }, T = {
32
+ ...C,
33
+ customError: !0,
34
+ valid: !1
35
+ }, v = {
36
+ isInvalid: !1,
37
+ validationDetails: C,
38
+ validationErrors: []
39
+ }, Y = L({}), F = "__formValidationState" + Date.now();
40
+ function le(t) {
41
+ if (t[F]) {
42
+ let { realtimeValidation: e, displayValidation: a, updateValidation: i, resetValidation: r, commitValidation: n } = t[F];
43
+ return {
44
+ realtimeValidation: e,
45
+ displayValidation: a,
46
+ updateValidation: i,
47
+ resetValidation: r,
48
+ commitValidation: n
49
+ };
50
+ }
51
+ return z(t);
52
+ }
53
+ function z(t) {
54
+ let { isInvalid: e, validationState: a, name: i, value: r, builtinValidation: n, validate: l, validationBehavior: u = "aria" } = t;
55
+ a && (e || (e = a === "invalid"));
56
+ let d = e !== void 0 ? {
57
+ isInvalid: e,
58
+ validationErrors: [],
59
+ validationDetails: T
60
+ } : null, s = y(() => {
61
+ if (!l || r == null) return null;
62
+ let o = G(l, r);
63
+ return O(o);
64
+ }, [
65
+ l,
66
+ r
67
+ ]);
68
+ n != null && n.validationDetails.valid && (n = void 0);
69
+ let f = D(Y), c = y(() => i ? Array.isArray(i) ? i.flatMap((o) => M(f[o])) : M(f[i]) : [], [
70
+ f,
71
+ i
72
+ ]), [_, j] = m(f), [w, V] = m(!1);
73
+ f !== _ && (j(f), V(!1));
74
+ let p = y(() => O(w ? [] : c), [
75
+ w,
76
+ c
77
+ ]), A = x(v), [E, g] = m(v), $ = x(v), P = () => {
78
+ if (!k) return;
79
+ h(!1);
80
+ let o = s || n || A.current;
81
+ I(o, $.current) || ($.current = o, g(o));
82
+ }, [k, h] = m(!1);
83
+ return S(P), {
84
+ realtimeValidation: d || p || s || n || v,
85
+ displayValidation: u === "native" ? d || p || E : d || p || s || n || E,
86
+ updateValidation(o) {
87
+ u === "aria" && !I(E, o) ? g(o) : A.current = o;
88
+ },
89
+ resetValidation() {
90
+ let o = v;
91
+ I(o, $.current) || ($.current = o, g(o)), u === "native" && h(!1), V(!0);
92
+ },
93
+ commitValidation() {
94
+ u === "native" && h(!0), V(!0);
95
+ }
96
+ };
97
+ }
98
+ function M(t) {
99
+ return t ? Array.isArray(t) ? t : [
100
+ t
101
+ ] : [];
102
+ }
103
+ function G(t, e) {
104
+ if (typeof t == "function") {
105
+ let a = t(e);
106
+ if (a && typeof a != "boolean") return M(a);
107
+ }
108
+ return [];
109
+ }
110
+ function O(t) {
111
+ return t.length ? {
112
+ isInvalid: !0,
113
+ validationErrors: t,
114
+ validationDetails: T
115
+ } : null;
116
+ }
117
+ function I(t, e) {
118
+ return t === e ? !0 : !!t && !!e && t.isInvalid === e.isInvalid && t.validationErrors.length === e.validationErrors.length && t.validationErrors.every((a, i) => a === e.validationErrors[i]) && Object.entries(t.validationDetails).every(([a, i]) => e.validationDetails[a] === i);
119
+ }
120
+ function de(...t) {
121
+ let e = /* @__PURE__ */ new Set(), a = !1, i = {
122
+ ...C
123
+ };
124
+ for (let l of t) {
125
+ var r, n;
126
+ for (let u of l.validationErrors) e.add(u);
127
+ a || (a = l.isInvalid);
128
+ for (let u in i) (r = i)[n = u] || (r[n] = l.validationDetails[u]);
129
+ }
130
+ return i.valid = !a, {
131
+ isInvalid: a,
132
+ validationErrors: [
133
+ ...e
134
+ ],
135
+ validationDetails: i
136
+ };
137
+ }
138
+ function oe(t, e, a) {
139
+ let { validationBehavior: i, focus: r } = t;
140
+ N(() => {
141
+ if (i === "native" && (a != null && a.current) && !a.current.disabled) {
142
+ let d = e.realtimeValidation.isInvalid ? e.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
143
+ a.current.setCustomValidity(d), a.current.hasAttribute("title") || (a.current.title = ""), e.realtimeValidation.isInvalid || e.updateValidation(W(a.current));
144
+ }
145
+ });
146
+ let n = b(() => {
147
+ e.resetValidation();
148
+ }), l = b((d) => {
149
+ var s;
150
+ e.displayValidation.isInvalid || e.commitValidation();
151
+ let f = a == null || (s = a.current) === null || s === void 0 ? void 0 : s.form;
152
+ if (!d.defaultPrevented && a && f && X(f) === a.current) {
153
+ var c;
154
+ r ? r() : (c = a.current) === null || c === void 0 || c.focus(), Q("keyboard");
155
+ }
156
+ d.preventDefault();
157
+ }), u = b(() => {
158
+ e.commitValidation();
159
+ });
160
+ S(() => {
161
+ let d = a == null ? void 0 : a.current;
162
+ if (!d) return;
163
+ let s = d.form;
164
+ return d.addEventListener("invalid", l), d.addEventListener("change", u), s == null || s.addEventListener("reset", n), () => {
165
+ d.removeEventListener("invalid", l), d.removeEventListener("change", u), s == null || s.removeEventListener("reset", n);
166
+ };
167
+ }, [
168
+ a,
169
+ l,
170
+ u,
171
+ n,
172
+ i
173
+ ]);
174
+ }
175
+ function H(t) {
176
+ let e = t.validity;
177
+ return {
178
+ badInput: e.badInput,
179
+ customError: e.customError,
180
+ patternMismatch: e.patternMismatch,
181
+ rangeOverflow: e.rangeOverflow,
182
+ rangeUnderflow: e.rangeUnderflow,
183
+ stepMismatch: e.stepMismatch,
184
+ tooLong: e.tooLong,
185
+ tooShort: e.tooShort,
186
+ typeMismatch: e.typeMismatch,
187
+ valueMissing: e.valueMissing,
188
+ valid: e.valid
189
+ };
190
+ }
191
+ function W(t) {
192
+ return {
193
+ isInvalid: !t.validity.valid,
194
+ validationDetails: H(t),
195
+ validationErrors: t.validationMessage ? [
196
+ t.validationMessage
197
+ ] : []
198
+ };
199
+ }
200
+ function X(t) {
201
+ for (let e = 0; e < t.elements.length; e++) {
202
+ let a = t.elements[e];
203
+ if (!a.validity.valid) return a;
204
+ }
205
+ return null;
206
+ }
207
+ const U = /* @__PURE__ */ L(null), se = /* @__PURE__ */ B(function(e, a) {
208
+ let i = D(U);
209
+ return i != null && i.isInvalid ? /* @__PURE__ */ R.createElement(Z, {
210
+ ...e,
211
+ ref: a
212
+ }) : null;
213
+ }), Z = /* @__PURE__ */ B((t, e) => {
214
+ let a = D(U), i = q(t), r = J({
215
+ ...t,
216
+ defaultClassName: "react-aria-FieldError",
217
+ defaultChildren: a.validationErrors.length === 0 ? void 0 : a.validationErrors.join(" "),
218
+ values: a
219
+ });
220
+ return r.children == null ? null : /* @__PURE__ */ R.createElement(K, {
221
+ slot: "errorMessage",
222
+ ...i,
223
+ ...r,
224
+ ref: e
225
+ });
226
+ }), ue = /* @__PURE__ */ L(null);
227
+ export {
228
+ ue as $,
229
+ U as a,
230
+ se as b,
231
+ le as c,
232
+ re as d,
233
+ oe as e,
234
+ F as f,
235
+ v as g,
236
+ de as h,
237
+ C as i
238
+ };
@@ -0,0 +1,42 @@
1
+ import { a as H, b as h, c as x, d as m, e as F } from "./useFocusRing-BKGhL91C.js";
2
+ import P, { forwardRef as _, createContext as p } from "react";
3
+ const C = /* @__PURE__ */ p({}), w = /* @__PURE__ */ _(function(e, i) {
4
+ [e, i] = H(e, i, C);
5
+ let { isDisabled: d, isInvalid: a, onHoverStart: f, onHoverChange: u, onHoverEnd: c, ...v } = e, { hoverProps: b, isHovered: s } = h({
6
+ onHoverStart: f,
7
+ onHoverChange: u,
8
+ onHoverEnd: c,
9
+ isDisabled: d
10
+ }), { isFocused: r, isFocusVisible: t, focusProps: $ } = x({
11
+ within: !0
12
+ });
13
+ d ?? (d = !!e["aria-disabled"] && e["aria-disabled"] !== "false"), a ?? (a = !!e["aria-invalid"] && e["aria-invalid"] !== "false");
14
+ let l = m({
15
+ ...e,
16
+ values: {
17
+ isHovered: s,
18
+ isFocusWithin: r,
19
+ isFocusVisible: t,
20
+ isDisabled: d,
21
+ isInvalid: a
22
+ },
23
+ defaultClassName: "react-aria-Group"
24
+ });
25
+ var o, n;
26
+ return /* @__PURE__ */ P.createElement("div", {
27
+ ...F(v, $, b),
28
+ ...l,
29
+ ref: i,
30
+ role: (o = e.role) !== null && o !== void 0 ? o : "group",
31
+ slot: (n = e.slot) !== null && n !== void 0 ? n : void 0,
32
+ "data-focus-within": r || void 0,
33
+ "data-hovered": s || void 0,
34
+ "data-focus-visible": t || void 0,
35
+ "data-disabled": d || void 0,
36
+ "data-invalid": a || void 0
37
+ }, l.children);
38
+ });
39
+ export {
40
+ w as $,
41
+ C as a
42
+ };
@@ -1,6 +1,6 @@
1
1
  import { createPortal as c } from "react-dom";
2
2
  import a, { forwardRef as l, useContext as d, createContext as o } from "react";
3
- import { g as f } from "./useFocusRing-D97-G3fT.js";
3
+ import { g as f } from "./useFocusRing-BKGhL91C.js";
4
4
  if (typeof HTMLTemplateElement < "u") {
5
5
  const e = Object.getOwnPropertyDescriptor(Node.prototype, "firstChild").get;
6
6
  Object.defineProperty(HTMLTemplateElement.prototype, "firstChild", {
@@ -0,0 +1,75 @@
1
+ import { m as v, n as h, e as b, o as C, p as D, q as T, a as E, b as F, c as H, d as g } from "./useFocusRing-BKGhL91C.js";
2
+ import y, { createContext as L, forwardRef as _ } from "react";
3
+ import { $ as S } from "./useFocusable-CRSmYEQc.js";
4
+ function V(r, e) {
5
+ let {
6
+ elementType: a = "a",
7
+ onPress: i,
8
+ onPressStart: f,
9
+ onPressEnd: o,
10
+ // @ts-ignore
11
+ onClick: c,
12
+ isDisabled: d,
13
+ ...u
14
+ } = r, n = {};
15
+ a !== "a" && (n = {
16
+ role: "link",
17
+ tabIndex: d ? void 0 : 0
18
+ });
19
+ let { focusableProps: l } = S(r, e), { pressProps: t, isPressed: p } = v({
20
+ onPress: i,
21
+ onPressStart: f,
22
+ onPressEnd: o,
23
+ isDisabled: d,
24
+ ref: e
25
+ }), x = h(u, {
26
+ labelable: !0
27
+ }), m = b(l, t), P = C(), k = D(r);
28
+ return {
29
+ isPressed: p,
30
+ linkProps: b(x, k, {
31
+ ...m,
32
+ ...n,
33
+ "aria-disabled": d || void 0,
34
+ "aria-current": r["aria-current"],
35
+ onClick: (s) => {
36
+ var $;
37
+ ($ = t.onClick) === null || $ === void 0 || $.call(t, s), c && (c(s), console.warn("onClick is deprecated, please use onPress")), !P.isNative && s.currentTarget instanceof HTMLAnchorElement && s.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
38
+ !s.isDefaultPrevented() && T(s.currentTarget, s) && r.href && (s.preventDefault(), P.open(s.currentTarget, s, r.href, r.routerOptions));
39
+ }
40
+ })
41
+ };
42
+ }
43
+ const w = /* @__PURE__ */ L(null), q = /* @__PURE__ */ _(function(e, a) {
44
+ [e, a] = E(e, a, w);
45
+ let i = e.href && !e.isDisabled ? "a" : "span", { linkProps: f, isPressed: o } = V({
46
+ ...e,
47
+ elementType: i
48
+ }, a), { hoverProps: c, isHovered: d } = F(e), { focusProps: u, isFocused: n, isFocusVisible: l } = H(), t = g({
49
+ ...e,
50
+ defaultClassName: "react-aria-Link",
51
+ values: {
52
+ isCurrent: !!e["aria-current"],
53
+ isDisabled: e.isDisabled || !1,
54
+ isPressed: o,
55
+ isHovered: d,
56
+ isFocused: n,
57
+ isFocusVisible: l
58
+ }
59
+ });
60
+ return /* @__PURE__ */ y.createElement(i, {
61
+ ref: a,
62
+ slot: e.slot || void 0,
63
+ ...b(t, f, c, u),
64
+ "data-focused": n || void 0,
65
+ "data-hovered": d || void 0,
66
+ "data-pressed": o || void 0,
67
+ "data-focus-visible": l || void 0,
68
+ "data-current": !!e["aria-current"] || void 0,
69
+ "data-disabled": e.isDisabled || void 0
70
+ }, t.children);
71
+ });
72
+ export {
73
+ q as $,
74
+ w as a
75
+ };