@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
package/Form-DXLoQL91.js DELETED
@@ -1,240 +0,0 @@
1
- import { F as b, l as Q, G as k, n as q, d as G } from "./useFocusRing-D97-G3fT.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 Y } from "./Text-DGLaY3HR.js";
4
- function ne(t, e, a) {
5
- let i = x(e), l = b(() => {
6
- a && a(i.current);
7
- });
8
- S(() => {
9
- var r;
10
- let n = t == null || (r = t.current) === null || r === void 0 ? void 0 : r.form;
11
- return n == null || n.addEventListener("reset", l), () => {
12
- n == null || n.removeEventListener("reset", l);
13
- };
14
- }, [
15
- t,
16
- l
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
- }, f = {
36
- isInvalid: !1,
37
- validationDetails: C,
38
- validationErrors: []
39
- }, z = L({}), F = "__formValidationState" + Date.now();
40
- function oe(t) {
41
- if (t[F]) {
42
- let { realtimeValidation: e, displayValidation: a, updateValidation: i, resetValidation: l, commitValidation: r } = t[F];
43
- return {
44
- realtimeValidation: e,
45
- displayValidation: a,
46
- updateValidation: i,
47
- resetValidation: l,
48
- commitValidation: r
49
- };
50
- }
51
- return H(t);
52
- }
53
- function H(t) {
54
- let { isInvalid: e, validationState: a, name: i, value: l, builtinValidation: r, validate: n, validationBehavior: v = "aria" } = t;
55
- a && (e || (e = a === "invalid"));
56
- let o = e !== void 0 ? {
57
- isInvalid: e,
58
- validationErrors: [],
59
- validationDetails: T
60
- } : null, s = y(() => {
61
- if (!n || l == null) return null;
62
- let d = J(n, l);
63
- return O(d);
64
- }, [
65
- n,
66
- l
67
- ]);
68
- r != null && r.validationDetails.valid && (r = void 0);
69
- let c = D(z), u = y(() => i ? Array.isArray(i) ? i.flatMap((d) => M(c[d])) : M(c[i]) : [], [
70
- c,
71
- i
72
- ]), [_, j] = m(c), [w, V] = m(!1);
73
- c !== _ && (j(c), V(!1));
74
- let p = y(() => O(w ? [] : u), [
75
- w,
76
- u
77
- ]), A = x(f), [E, g] = m(f), $ = x(f), P = () => {
78
- if (!N) return;
79
- h(!1);
80
- let d = s || r || A.current;
81
- I(d, $.current) || ($.current = d, g(d));
82
- }, [N, h] = m(!1);
83
- return S(P), {
84
- realtimeValidation: o || p || s || r || f,
85
- displayValidation: v === "native" ? o || p || E : o || p || s || r || E,
86
- updateValidation(d) {
87
- v === "aria" && !I(E, d) ? g(d) : A.current = d;
88
- },
89
- resetValidation() {
90
- let d = f;
91
- I(d, $.current) || ($.current = d, g(d)), v === "native" && h(!1), V(!0);
92
- },
93
- commitValidation() {
94
- v === "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 J(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 n of t) {
125
- var l, r;
126
- for (let v of n.validationErrors) e.add(v);
127
- a || (a = n.isInvalid);
128
- for (let v in i) (l = i)[r = v] || (l[r] = n.validationDetails[v]);
129
- }
130
- return i.valid = !a, {
131
- isInvalid: a,
132
- validationErrors: [
133
- ...e
134
- ],
135
- validationDetails: i
136
- };
137
- }
138
- function se(t, e, a) {
139
- let { validationBehavior: i, focus: l } = t;
140
- Q(() => {
141
- if (i === "native" && (a != null && a.current)) {
142
- let o = e.realtimeValidation.isInvalid ? e.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
143
- a.current.setCustomValidity(o), a.current.hasAttribute("title") || (a.current.title = ""), e.realtimeValidation.isInvalid || e.updateValidation(W(a.current));
144
- }
145
- });
146
- let r = b(() => {
147
- e.resetValidation();
148
- }), n = b((o) => {
149
- var s;
150
- e.displayValidation.isInvalid || e.commitValidation();
151
- let c = a == null || (s = a.current) === null || s === void 0 ? void 0 : s.form;
152
- if (!o.defaultPrevented && a && c && X(c) === a.current) {
153
- var u;
154
- l ? l() : (u = a.current) === null || u === void 0 || u.focus(), k("keyboard");
155
- }
156
- o.preventDefault();
157
- }), v = b(() => {
158
- e.commitValidation();
159
- });
160
- S(() => {
161
- let o = a == null ? void 0 : a.current;
162
- if (!o) return;
163
- let s = o.form;
164
- return o.addEventListener("invalid", n), o.addEventListener("change", v), s == null || s.addEventListener("reset", r), () => {
165
- o.removeEventListener("invalid", n), o.removeEventListener("change", v), s == null || s.removeEventListener("reset", r);
166
- };
167
- }, [
168
- a,
169
- n,
170
- v,
171
- r,
172
- i
173
- ]);
174
- }
175
- function K(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: K(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);
208
- function Z(t, e) {
209
- let a = D(U);
210
- return a != null && a.isInvalid ? /* @__PURE__ */ R.createElement(ee, {
211
- ...t,
212
- ref: e
213
- }) : null;
214
- }
215
- const ve = /* @__PURE__ */ B(Z), ee = /* @__PURE__ */ B((t, e) => {
216
- let a = D(U), i = q(t), l = G({
217
- ...t,
218
- defaultClassName: "react-aria-FieldError",
219
- defaultChildren: a.validationErrors.length === 0 ? void 0 : a.validationErrors.join(" "),
220
- values: a
221
- });
222
- return l.children == null ? null : /* @__PURE__ */ R.createElement(Y, {
223
- slot: "errorMessage",
224
- ...i,
225
- ...l,
226
- ref: e
227
- });
228
- }), ce = /* @__PURE__ */ L(null);
229
- export {
230
- oe as $,
231
- ne as a,
232
- se as b,
233
- ce as c,
234
- U as d,
235
- ve as e,
236
- F as f,
237
- f as g,
238
- de as h,
239
- C as i
240
- };
package/Group-DPMuN3h8.js DELETED
@@ -1,44 +0,0 @@
1
- import { a as H, b as h, c as x, d as m, e as F } from "./useFocusRing-D97-G3fT.js";
2
- import P, { forwardRef as _, createContext as p } from "react";
3
- const C = /* @__PURE__ */ p({});
4
- function g(e, i) {
5
- [e, i] = H(e, i, C);
6
- let { isDisabled: a, isInvalid: d, onHoverStart: f, onHoverChange: v, onHoverEnd: u, ...c } = e, { hoverProps: $, isHovered: s } = h({
7
- onHoverStart: f,
8
- onHoverChange: v,
9
- onHoverEnd: u,
10
- isDisabled: a
11
- }), { isFocused: n, isFocusVisible: t, focusProps: b } = x({
12
- within: !0
13
- });
14
- a ?? (a = !!e["aria-disabled"] && e["aria-disabled"] !== "false"), d ?? (d = !!e["aria-invalid"] && e["aria-invalid"] !== "false");
15
- let l = m({
16
- ...e,
17
- values: {
18
- isHovered: s,
19
- isFocusWithin: n,
20
- isFocusVisible: t,
21
- isDisabled: a,
22
- isInvalid: d
23
- },
24
- defaultClassName: "react-aria-Group"
25
- });
26
- var o, r;
27
- return /* @__PURE__ */ P.createElement("div", {
28
- ...F(c, b, $),
29
- ...l,
30
- ref: i,
31
- role: (o = e.role) !== null && o !== void 0 ? o : "group",
32
- slot: (r = e.slot) !== null && r !== void 0 ? r : void 0,
33
- "data-focus-within": n || void 0,
34
- "data-hovered": s || void 0,
35
- "data-focus-visible": t || void 0,
36
- "data-disabled": a || void 0,
37
- "data-invalid": d || void 0
38
- }, l.children);
39
- }
40
- const w = /* @__PURE__ */ _(g);
41
- export {
42
- w as $,
43
- C as a
44
- };
package/Label-C18A_4Z5.js DELETED
@@ -1,69 +0,0 @@
1
- import { k as s, y as f, e as n, a as $ } from "./useFocusRing-D97-G3fT.js";
2
- import { a as c } from "./useControlledState-S_TYcV_c.js";
3
- import { $ as p } from "./Hidden-BQWDvze4.js";
4
- import m, { createContext as y } from "react";
5
- function u(l) {
6
- let { id: e, label: o, "aria-labelledby": a, "aria-label": t, labelElementType: d = "label" } = l;
7
- e = s(e);
8
- let r = s(), i = {};
9
- o ? (a = a ? `${r} ${a}` : r, i = {
10
- id: r,
11
- htmlFor: d === "label" ? e : void 0
12
- }) : !a && !t && console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
13
- let b = c({
14
- id: e,
15
- "aria-label": t,
16
- "aria-labelledby": a
17
- });
18
- return {
19
- labelProps: i,
20
- fieldProps: b
21
- };
22
- }
23
- function E(l) {
24
- let { description: e, errorMessage: o, isInvalid: a, validationState: t } = l, { labelProps: d, fieldProps: r } = u(l), i = f([
25
- !!e,
26
- !!o,
27
- a,
28
- t
29
- ]), b = f([
30
- !!e,
31
- !!o,
32
- a,
33
- t
34
- ]);
35
- return r = n(r, {
36
- "aria-describedby": [
37
- i,
38
- // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
39
- b,
40
- l["aria-describedby"]
41
- ].filter(Boolean).join(" ") || void 0
42
- }), {
43
- labelProps: d,
44
- fieldProps: r,
45
- descriptionProps: {
46
- id: i
47
- },
48
- errorMessageProps: {
49
- id: b
50
- }
51
- };
52
- }
53
- const P = /* @__PURE__ */ y({});
54
- function x(l, e) {
55
- [l, e] = $(l, e, P);
56
- let { elementType: o = "label", ...a } = l;
57
- return /* @__PURE__ */ m.createElement(o, {
58
- className: "react-aria-Label",
59
- ...a,
60
- ref: e
61
- });
62
- }
63
- const L = /* @__PURE__ */ p(x);
64
- export {
65
- E as $,
66
- P as a,
67
- L as b,
68
- u as c
69
- };
package/Link-BU1h3K2a.js DELETED
@@ -1,77 +0,0 @@
1
- import { m as k, 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-D97-G3fT.js";
2
- import y, { createContext as L, forwardRef as _ } from "react";
3
- import { $ as S } from "./useFocusable-C-N9wcwm.js";
4
- function V(e, r) {
5
- let {
6
- elementType: n = "a",
7
- onPress: l,
8
- onPressStart: i,
9
- onPressEnd: f,
10
- // @ts-ignore
11
- onClick: a,
12
- isDisabled: d,
13
- ...o
14
- } = e, t = {};
15
- n !== "a" && (t = {
16
- role: "link",
17
- tabIndex: d ? void 0 : 0
18
- });
19
- let { focusableProps: c } = S(e, r), { pressProps: u, isPressed: p } = k({
20
- onPress: l,
21
- onPressStart: i,
22
- onPressEnd: f,
23
- isDisabled: d,
24
- ref: r
25
- }), x = h(o, {
26
- labelable: !0
27
- }), m = b(c, u), P = C(), v = D(e);
28
- return {
29
- isPressed: p,
30
- linkProps: b(x, v, {
31
- ...m,
32
- ...t,
33
- "aria-disabled": d || void 0,
34
- "aria-current": e["aria-current"],
35
- onClick: (s) => {
36
- var $;
37
- ($ = u.onClick) === null || $ === void 0 || $.call(u, s), a && (a(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) && e.href && (s.preventDefault(), P.open(s.currentTarget, s, e.href, e.routerOptions));
39
- }
40
- })
41
- };
42
- }
43
- const w = /* @__PURE__ */ L(null);
44
- function N(e, r) {
45
- [e, r] = E(e, r, w);
46
- let n = e.href && !e.isDisabled ? "a" : "span", { linkProps: l, isPressed: i } = V({
47
- ...e,
48
- elementType: n
49
- }, r), { hoverProps: f, isHovered: a } = F(e), { focusProps: d, isFocused: o, isFocusVisible: t } = H(), c = g({
50
- ...e,
51
- defaultClassName: "react-aria-Link",
52
- values: {
53
- isCurrent: !!e["aria-current"],
54
- isDisabled: e.isDisabled || !1,
55
- isPressed: i,
56
- isHovered: a,
57
- isFocused: o,
58
- isFocusVisible: t
59
- }
60
- });
61
- return /* @__PURE__ */ y.createElement(n, {
62
- ref: r,
63
- slot: e.slot || void 0,
64
- ...b(c, l, f, d),
65
- "data-focused": o || void 0,
66
- "data-hovered": a || void 0,
67
- "data-pressed": i || void 0,
68
- "data-focus-visible": t || void 0,
69
- "data-current": !!e["aria-current"] || void 0,
70
- "data-disabled": e.isDisabled || void 0
71
- }, c.children);
72
- }
73
- const A = /* @__PURE__ */ _(N);
74
- export {
75
- A as $,
76
- w as a
77
- };