@midas-ds/components 1.0.2 → 1.1.0

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 (175) hide show
  1. package/Button-DL6nqUco.js +182 -0
  2. package/CHANGELOG.md +15 -0
  3. package/Checkbox-q0dugR2t.js +402 -0
  4. package/{Collection-B3xUVWPF.js → Collection-KMFfVuzU.js} +179 -152
  5. package/Dialog-D6Bqrpn-.js +1952 -0
  6. package/Disclosure-dAZYXyTH.js +225 -0
  7. package/Disclosure.css +1 -0
  8. package/DragAndDrop-B0T3WgjL.js +40 -0
  9. package/FocusScope-B7CkxXNC.js +513 -0
  10. package/{Form-DXLoQL91.js → Form-BWBjJC6v.js} +79 -81
  11. package/Group-D7_8007y.js +42 -0
  12. package/Heading-RCRHv6hd.js +15 -0
  13. package/{Hidden-BQWDvze4.js → Hidden-CVlUgUJM.js} +1 -1
  14. package/Link-BnQvB-hH.js +75 -0
  15. package/ListBox-DBBiqvcR.js +474 -0
  16. package/ListKeyboardDelegate-gCXy-Xnn.js +172 -0
  17. package/PressResponder-B4g56kDz.js +31 -0
  18. package/README.md +21 -3
  19. package/{RSPContexts-EOiWkKOf.js → RSPContexts-BW2SEIqe.js} +2 -2
  20. package/SelectionManager-BfXUE1qg.js +1031 -0
  21. package/Separator-BBX9m2O2.js +49 -0
  22. package/Tag-DWt0koFj.js +728 -0
  23. package/Text-BCF0xvqL.js +15 -0
  24. package/TextField-CX4eOQf6.js +225 -0
  25. package/TextField.module-DdICj682.js +143 -0
  26. package/{VisuallyHidden-B_XzVvlX.js → VisuallyHidden-Dhr5caPC.js} +1 -1
  27. package/accordion/Accordion.d.ts +8 -8
  28. package/accordion/AccordionItem.d.ts +11 -3
  29. package/accordion/index.d.ts +0 -3
  30. package/{context-ScOIq_Gu.js → context-BpJLnOuu.js} +11 -11
  31. package/global.css +1 -0
  32. package/index-B-jHjTDC.js +120 -0
  33. package/{index-CorR1LBD.js → index-BPdc9gJ8.js} +3 -3
  34. package/{index-Dl1Q-tbj.js → index-KSgQWWiy.js} +5315 -5315
  35. package/index.d.ts +1 -0
  36. package/index.js +105 -112
  37. package/index10.js +1 -1
  38. package/index11.js +1 -1
  39. package/index12.js +1 -1
  40. package/index13.js +1 -1
  41. package/index14.js +1 -1
  42. package/index15.js +2 -2
  43. package/index16.js +2 -2
  44. package/index17.js +1 -1
  45. package/index18.js +1 -1
  46. package/index19.js +2 -2
  47. package/index2.js +1 -1
  48. package/index20.js +2 -2
  49. package/index21.js +1 -1
  50. package/index22.js +1 -1
  51. package/index23.js +1 -1
  52. package/index24.js +1 -1
  53. package/index25.js +2 -2
  54. package/index26.js +2 -2
  55. package/index27.js +2 -2
  56. package/index28.js +1 -1
  57. package/index29.js +2 -8
  58. package/index3.js +2 -4
  59. package/index30.js +17 -16
  60. package/index31.js +3 -3
  61. package/index32.js +3 -3
  62. package/index33.js +2 -2
  63. package/index34.js +3 -3
  64. package/index35.js +1 -1
  65. package/index36.js +2 -2
  66. package/index37.js +2 -2
  67. package/index38.js +2 -2
  68. package/index39.js +2 -2
  69. package/index4.js +1 -1
  70. package/index40.js +19 -12
  71. package/index41.js +61 -14
  72. package/index42.js +44 -22
  73. package/index43.js +13 -11
  74. package/index44.js +25 -4
  75. package/index45.js +16 -51
  76. package/index46.js +19 -16
  77. package/index47.js +49 -27
  78. package/index48.js +5 -18
  79. package/index49.js +25 -21
  80. package/index5.js +1 -1
  81. package/index50.js +16 -47
  82. package/index51.js +7 -3
  83. package/index52.js +18 -18
  84. package/index53.js +16 -16
  85. package/index54.js +6 -4
  86. package/index55.js +8 -21
  87. package/index56.js +13 -16
  88. package/index57.js +6 -8
  89. package/index58.js +6 -9
  90. package/index59.js +17 -13
  91. package/index6.js +1 -1
  92. package/index60.js +20 -7
  93. package/index61.js +59 -7
  94. package/index62.js +13 -17
  95. package/index63.js +9 -20
  96. package/index64.js +40 -48
  97. package/index65.js +85 -15
  98. package/index66.js +74 -11
  99. package/index67.js +23 -62
  100. package/index68.js +64 -80
  101. package/index69.js +68 -62
  102. package/index7.js +1 -1
  103. package/index70.js +138 -22
  104. package/index71.js +66 -65
  105. package/index72.js +40 -78
  106. package/index73.js +75 -133
  107. package/index74.js +69 -68
  108. package/index75.js +96 -34
  109. package/index76.js +258 -65
  110. package/index77.js +715 -63
  111. package/index78.js +478 -93
  112. package/index79.js +303 -263
  113. package/index8.js +1 -1
  114. package/index80.js +343 -678
  115. package/index81.js +242 -481
  116. package/index82.js +1329 -282
  117. package/index83.js +968 -350
  118. package/index84.js +343 -211
  119. package/index85.js +2025 -1288
  120. package/index86.js +2313 -954
  121. package/index87.js +6782 -339
  122. package/index88.js +15 -2103
  123. package/index89.js +12 -2369
  124. package/index9.js +1 -1
  125. package/index90.js +4 -6832
  126. package/index91.js +7 -15
  127. package/link/Link.d.ts +2 -2
  128. package/link-button/LinkButton.d.ts +1 -1
  129. package/package.json +7 -1
  130. package/{react.esm-D8HpDGKP.js → react.esm-sMU8Z7rL.js} +1872 -1872
  131. package/textfield/index.d.ts +0 -2
  132. package/useControlledState-Kv9K2AYu.js +30 -0
  133. package/{useDescription-D4_zk_sA.js → useDescription-B7stiK3j.js} +1 -1
  134. package/useEvent-Xk5kn5Ns.js +21 -0
  135. package/useField-DMzJIIN4.js +67 -0
  136. package/{useFilter-BnJDBCkt.js → useFilter-Bt9dbV1U.js} +1 -1
  137. package/useFocusRing-9PXyKy2A.js +1297 -0
  138. package/{useFocusable-C-N9wcwm.js → useFocusable-CcEBZe40.js} +11 -8
  139. package/{useGridSelectionCheckbox-i1rsjlC-.js → useGridSelectionCheckbox-DYgEnElE.js} +3 -3
  140. package/useHasTabbableChild-D6DwR81L.js +34 -0
  141. package/{useHighlightSelectionDescription-JVx2MW_e.js → useHighlightSelectionDescription-WYAbP4No.js} +19 -19
  142. package/useLabels-9zaZ9oa0.js +17 -0
  143. package/useListState-BfTeKTk5.js +119 -0
  144. package/{useLocalizedStringFormatter-DVCAZqcL.js → useLocalizedStringFormatter-BlCbn-hX.js} +29 -29
  145. package/{useSingleSelectListState-CmX9_L5H.js → useSingleSelectListState-DPkaL0la.js} +5 -5
  146. package/Button-CCevm2s3.js +0 -183
  147. package/Checkbox-CllWDBxF.js +0 -405
  148. package/Dialog-CLTyYwkS.js +0 -1889
  149. package/DragAndDrop-OTN7La7U.js +0 -42
  150. package/FocusScope-BR0SJ-cZ.js +0 -512
  151. package/Group-DPMuN3h8.js +0 -44
  152. package/Label-C18A_4Z5.js +0 -69
  153. package/Link-BU1h3K2a.js +0 -77
  154. package/ListBox-D21tdwTs.js +0 -463
  155. package/ListKeyboardDelegate-DxMjfMsI.js +0 -172
  156. package/PressResponder-DP8ZDNGy.js +0 -31
  157. package/SelectionManager-D4WtKtey.js +0 -988
  158. package/Separator-DLUHK9vv.js +0 -48
  159. package/Tag-CEd6WWSc.js +0 -725
  160. package/Text-DGLaY3HR.js +0 -17
  161. package/TextField-C_hq9WeT.js +0 -226
  162. package/TextField.module-Cwq1FAm7.js +0 -141
  163. package/accordion/AccordionContent.d.ts +0 -3
  164. package/accordion/AccordionTagContext.d.ts +0 -3
  165. package/accordion/AccordionTrigger.d.ts +0 -3
  166. package/index-CEg5vZQH.js +0 -132
  167. package/index-CgfokhRq.js +0 -674
  168. package/index.css +0 -1
  169. package/index92.js +0 -14
  170. package/index93.js +0 -6
  171. package/index94.js +0 -9
  172. package/useControlledState-S_TYcV_c.js +0 -45
  173. package/useFocusRing-D97-G3fT.js +0 -1324
  174. package/useHasTabbableChild-DeuCnGGv.js +0 -34
  175. package/useListState-DSOTbsL3.js +0 -119
@@ -0,0 +1,225 @@
1
+ import { a as y } from "./Button-DL6nqUco.js";
2
+ import { k as b, g as k, l as A, d as x, o as g, a as V, c as P, B as D, E as I, F as B, e as N } from "./useFocusRing-9PXyKy2A.js";
3
+ import { flushSync as G } from "react-dom";
4
+ import c, { useRef as q, useCallback as u, useEffect as v, useMemo as _, forwardRef as h, useContext as w, createContext as p } from "react";
5
+ import { $ as z } from "./useEvent-Xk5kn5Ns.js";
6
+ import { $ as S } from "./useControlledState-Kv9K2AYu.js";
7
+ import './Disclosure.css';const O = '"../theme/tokens.css"', j = '"Inter", sans-serif', H = "#f2f2f2", J = "#e6e6e6", L = "#d9d9d9", Q = "#000000", U = "300ms", X = "400", Y = "500", Z = "_root_6hoor_4", ee = "_contained_6hoor_12", ae = "_triggerText_6hoor_27", te = "_trigger_6hoor_27", de = "_item_6hoor_78", ne = "_panel_6hoor_84", se = "_panel0_6hoor_84", ie = "_content_6hoor_94", le = "_header_6hoor_98", me = {
8
+ tokens: O,
9
+ display: j,
10
+ gray10: H,
11
+ gray20: J,
12
+ gray30: L,
13
+ black: Q,
14
+ normalTransition: U,
15
+ regularWeight: X,
16
+ mediumWeight: Y,
17
+ root: Z,
18
+ contained: ee,
19
+ triggerText: ae,
20
+ trigger: te,
21
+ item: de,
22
+ panel: ne,
23
+ panel0: se,
24
+ content: ie,
25
+ header: le
26
+ };
27
+ function oe(n, e, t) {
28
+ let { isDisabled: a } = n, d = b(), s = b(), o = !k() && "onbeforematch" in document.body, i = q(null), f = u(() => {
29
+ i.current = requestAnimationFrame(() => {
30
+ t.current && t.current.setAttribute("hidden", "until-found");
31
+ }), G(() => {
32
+ e.toggle();
33
+ });
34
+ }, [
35
+ t,
36
+ e
37
+ ]);
38
+ return z(t, "beforematch", o ? f : null), A(() => {
39
+ i.current && cancelAnimationFrame(i.current), o && t.current && !a && (e.isExpanded ? t.current.removeAttribute("hidden") : t.current.setAttribute("hidden", "until-found"));
40
+ }, [
41
+ a,
42
+ t,
43
+ e.isExpanded,
44
+ o
45
+ ]), v(() => () => {
46
+ i.current && cancelAnimationFrame(i.current);
47
+ }, []), {
48
+ buttonProps: {
49
+ id: d,
50
+ "aria-expanded": e.isExpanded,
51
+ "aria-controls": s,
52
+ onPress: (r) => {
53
+ !a && r.pointerType !== "keyboard" && e.toggle();
54
+ },
55
+ isDisabled: a,
56
+ onPressStart(r) {
57
+ r.pointerType === "keyboard" && !a && e.toggle();
58
+ }
59
+ },
60
+ panelProps: {
61
+ id: s,
62
+ // This can be overridden at the panel element level.
63
+ role: "group",
64
+ "aria-labelledby": d,
65
+ "aria-hidden": !e.isExpanded,
66
+ hidden: o ? !0 : !e.isExpanded
67
+ }
68
+ };
69
+ }
70
+ function re(n) {
71
+ let [e, t] = S(n.isExpanded, n.defaultExpanded || !1, n.onExpandedChange);
72
+ const a = u(() => {
73
+ t(!0);
74
+ }, [
75
+ t
76
+ ]), d = u(() => {
77
+ t(!1);
78
+ }, [
79
+ t
80
+ ]), s = u(() => {
81
+ t(!e);
82
+ }, [
83
+ t,
84
+ e
85
+ ]);
86
+ return {
87
+ isExpanded: e,
88
+ setExpanded: t,
89
+ expand: a,
90
+ collapse: d,
91
+ toggle: s
92
+ };
93
+ }
94
+ function ce(n) {
95
+ let { allowsMultipleExpanded: e = !1, isDisabled: t = !1 } = n, [a, d] = S(_(() => n.expandedKeys ? new Set(n.expandedKeys) : void 0, [
96
+ n.expandedKeys
97
+ ]), _(() => n.defaultExpandedKeys ? new Set(n.defaultExpandedKeys) : /* @__PURE__ */ new Set(), [
98
+ n.defaultExpandedKeys
99
+ ]), n.onExpandedChange);
100
+ return v(() => {
101
+ !e && a.size > 1 && d(/* @__PURE__ */ new Set([
102
+ a.values().next().value
103
+ ]));
104
+ }), {
105
+ allowsMultipleExpanded: e,
106
+ isDisabled: t,
107
+ expandedKeys: a,
108
+ setExpandedKeys: d,
109
+ toggleKey(s) {
110
+ let l;
111
+ e ? (l = new Set(a), l.has(s) ? l.delete(s) : l.add(s)) : l = new Set(a.has(s) ? [] : [
112
+ s
113
+ ]), d(l);
114
+ }
115
+ };
116
+ }
117
+ const K = /* @__PURE__ */ p(null), Ee = /* @__PURE__ */ h(function(e, t) {
118
+ let a = ce(e), d = x({
119
+ ...e,
120
+ defaultClassName: "react-aria-DisclosureGroup",
121
+ values: {
122
+ isDisabled: a.isDisabled,
123
+ state: a
124
+ }
125
+ }), s = g(e);
126
+ return /* @__PURE__ */ c.createElement("div", {
127
+ ...s,
128
+ ...d,
129
+ ref: t,
130
+ "data-disabled": e.isDisabled || void 0
131
+ }, /* @__PURE__ */ c.createElement(K.Provider, {
132
+ value: a
133
+ }, d.children));
134
+ }), fe = /* @__PURE__ */ p(null), ue = /* @__PURE__ */ p(null), C = /* @__PURE__ */ p(null), _e = /* @__PURE__ */ h(function(e, t) {
135
+ [e, t] = V(e, t, fe);
136
+ let a = w(K), { id: d, ...s } = e, l = b();
137
+ d || (d = l);
138
+ let o = a ? a.expandedKeys.has(d) : e.isExpanded, i = re({
139
+ ...e,
140
+ isExpanded: o,
141
+ onExpandedChange(T) {
142
+ var $;
143
+ a && a.toggleKey(d), ($ = e.onExpandedChange) === null || $ === void 0 || $.call(e, T);
144
+ }
145
+ }), f = c.useRef(null), r = e.isDisabled || (a == null ? void 0 : a.isDisabled) || !1, { buttonProps: F, panelProps: R } = oe({
146
+ ...e,
147
+ isExpanded: o,
148
+ isDisabled: r
149
+ }, i, f), { isFocusVisible: m, focusProps: W } = P({
150
+ within: !0
151
+ }), E = x({
152
+ ...e,
153
+ id: void 0,
154
+ defaultClassName: "react-aria-Disclosure",
155
+ values: {
156
+ isExpanded: i.isExpanded,
157
+ isDisabled: r,
158
+ isFocusVisibleWithin: m,
159
+ state: i
160
+ }
161
+ }), M = g(s);
162
+ return /* @__PURE__ */ c.createElement(D, {
163
+ values: [
164
+ [
165
+ y,
166
+ {
167
+ slots: {
168
+ [I]: {},
169
+ trigger: F
170
+ }
171
+ }
172
+ ],
173
+ [
174
+ C,
175
+ {
176
+ panelProps: R,
177
+ panelRef: f
178
+ }
179
+ ],
180
+ [
181
+ ue,
182
+ i
183
+ ]
184
+ ]
185
+ }, /* @__PURE__ */ c.createElement("div", {
186
+ ref: t,
187
+ "data-expanded": i.isExpanded || void 0,
188
+ "data-disabled": r || void 0,
189
+ "data-focus-visible-within": m || void 0,
190
+ ...M,
191
+ ...W,
192
+ ...E
193
+ }, E.children));
194
+ }), ye = /* @__PURE__ */ h(function(e, t) {
195
+ let { role: a = "group" } = e, { panelProps: d, panelRef: s } = w(C), { isFocusVisible: l, focusProps: o } = P({
196
+ within: !0
197
+ }), i = x({
198
+ ...e,
199
+ defaultClassName: "react-aria-DisclosurePanel",
200
+ values: {
201
+ isFocusVisibleWithin: l
202
+ }
203
+ }), f = g(e);
204
+ return /* @__PURE__ */ c.createElement("div", {
205
+ ...f,
206
+ ref: B(t, s),
207
+ ...N(d, o),
208
+ ...i,
209
+ role: a,
210
+ "data-focus-visible-within": l || void 0
211
+ }, /* @__PURE__ */ c.createElement(D, {
212
+ values: [
213
+ [
214
+ y,
215
+ null
216
+ ]
217
+ ]
218
+ }, e.children));
219
+ });
220
+ export {
221
+ Ee as $,
222
+ _e as a,
223
+ ye as b,
224
+ me as s
225
+ };
package/Disclosure.css ADDED
@@ -0,0 +1 @@
1
+ ._root_6hoor_4{--gap: .75rem;--item-padding: 0;--content-padding: .5rem .5rem .5rem 1.85rem;--background: transparent;--background-active: transparent;--background-hover: transparent;width:100%;display:flex;flex-direction:column;gap:var(--gap)}._root_6hoor_4._contained_6hoor_12{--gap: .25rem;--item-padding: .875rem;--content-padding: 1rem;--background: #f2f2f2;--background-active: #e6e6e6;--background-hover: #d9d9d9}._triggerText_6hoor_27{margin:0;padding:0;font-size:1rem;font-weight:400}._trigger_6hoor_27{font-family:Inter,sans-serif;color:#000;border:0;cursor:pointer;display:flex;justify-content:space-between;align-items:center;margin:0}._trigger_6hoor_27 button{width:100%;justify-content:flex-start;gap:.5rem;padding:var(--item-padding)}._trigger_6hoor_27 button svg{transform:rotate(0);transition:transform .3s ease}._trigger_6hoor_27 button[aria-expanded=true]{background-color:var(--background-active)}._trigger_6hoor_27 button[aria-expanded=true] ._triggerText_6hoor_27{font-weight:500}._trigger_6hoor_27 button[aria-expanded=true] svg{transform:rotate(-180deg);transition:transform .3s ease}._trigger_6hoor_27 button[aria-expanded=true]:hover{background-color:var(--background-hover)}._trigger_6hoor_27 button:hover{background-color:var(--background-active)}._item_6hoor_78{background-color:var(--background);font-family:Inter,sans-serif}._panel_6hoor_84:not(._panel0_6hoor_84){height:0;overflow:hidden;transition:height .5s cubic-bezier(.16,1,.3,1)}._panel_6hoor_84:not(._panel0_6hoor_84)[aria-hidden=false]{height:var(--panel-height)}._content_6hoor_94{padding:var(--content-padding)}._header_6hoor_98{margin:0}
@@ -0,0 +1,40 @@
1
+ import r, { createContext as c, useCallback as b, forwardRef as $, useContext as g, useMemo as s } from "react";
2
+ const y = /* @__PURE__ */ c({}), x = /* @__PURE__ */ c(null), m = /* @__PURE__ */ $(function(n, u) {
3
+ let { render: l } = g(x);
4
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, l(n, u));
5
+ });
6
+ function I(e, n) {
7
+ var u;
8
+ let l = e == null ? void 0 : e.renderDropIndicator, f = e == null || (u = e.isVirtualDragging) === null || u === void 0 ? void 0 : u.call(e), d = b((i) => {
9
+ if (f || n != null && n.isDropTarget(i)) return l ? l(i) : /* @__PURE__ */ r.createElement(m, {
10
+ target: i
11
+ });
12
+ }, [
13
+ n == null ? void 0 : n.target,
14
+ f,
15
+ l
16
+ ]);
17
+ return e != null && e.useDropIndicator ? d : void 0;
18
+ }
19
+ function v(e, n, u) {
20
+ var l, f;
21
+ let d = e.focusedKey, i = null;
22
+ if (!(n == null || (l = n.isVirtualDragging) === null || l === void 0) && l.call(n) && (u == null || (f = u.target) === null || f === void 0 ? void 0 : f.type) === "item") {
23
+ i = u.target.key;
24
+ var t;
25
+ u.target.dropPosition === "after" && (i = (t = u.collection.getKeyAfter(i)) !== null && t !== void 0 ? t : i);
26
+ }
27
+ return s(() => new Set([
28
+ d,
29
+ i
30
+ ].filter((a) => a != null)), [
31
+ d,
32
+ i
33
+ ]);
34
+ }
35
+ export {
36
+ y as $,
37
+ x as a,
38
+ v as b,
39
+ I as c
40
+ };