@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.
- package/Button-DL6nqUco.js +182 -0
- package/CHANGELOG.md +15 -0
- package/Checkbox-q0dugR2t.js +402 -0
- package/{Collection-B3xUVWPF.js → Collection-KMFfVuzU.js} +179 -152
- package/Dialog-D6Bqrpn-.js +1952 -0
- package/Disclosure-dAZYXyTH.js +225 -0
- package/Disclosure.css +1 -0
- package/DragAndDrop-B0T3WgjL.js +40 -0
- package/FocusScope-B7CkxXNC.js +513 -0
- package/{Form-DXLoQL91.js → Form-BWBjJC6v.js} +79 -81
- package/Group-D7_8007y.js +42 -0
- package/Heading-RCRHv6hd.js +15 -0
- package/{Hidden-BQWDvze4.js → Hidden-CVlUgUJM.js} +1 -1
- package/Link-BnQvB-hH.js +75 -0
- package/ListBox-DBBiqvcR.js +474 -0
- package/ListKeyboardDelegate-gCXy-Xnn.js +172 -0
- package/PressResponder-B4g56kDz.js +31 -0
- package/README.md +21 -3
- package/{RSPContexts-EOiWkKOf.js → RSPContexts-BW2SEIqe.js} +2 -2
- package/SelectionManager-BfXUE1qg.js +1031 -0
- package/Separator-BBX9m2O2.js +49 -0
- package/Tag-DWt0koFj.js +728 -0
- package/Text-BCF0xvqL.js +15 -0
- package/TextField-CX4eOQf6.js +225 -0
- package/TextField.module-DdICj682.js +143 -0
- package/{VisuallyHidden-B_XzVvlX.js → VisuallyHidden-Dhr5caPC.js} +1 -1
- package/accordion/Accordion.d.ts +8 -8
- package/accordion/AccordionItem.d.ts +11 -3
- package/accordion/index.d.ts +0 -3
- package/{context-ScOIq_Gu.js → context-BpJLnOuu.js} +11 -11
- package/global.css +1 -0
- package/index-B-jHjTDC.js +120 -0
- package/{index-CorR1LBD.js → index-BPdc9gJ8.js} +3 -3
- package/{index-Dl1Q-tbj.js → index-KSgQWWiy.js} +5315 -5315
- package/index.d.ts +1 -0
- package/index.js +105 -112
- package/index10.js +1 -1
- package/index11.js +1 -1
- package/index12.js +1 -1
- package/index13.js +1 -1
- package/index14.js +1 -1
- package/index15.js +2 -2
- package/index16.js +2 -2
- package/index17.js +1 -1
- package/index18.js +1 -1
- package/index19.js +2 -2
- package/index2.js +1 -1
- package/index20.js +2 -2
- package/index21.js +1 -1
- package/index22.js +1 -1
- package/index23.js +1 -1
- package/index24.js +1 -1
- package/index25.js +2 -2
- package/index26.js +2 -2
- package/index27.js +2 -2
- package/index28.js +1 -1
- package/index29.js +2 -8
- package/index3.js +2 -4
- package/index30.js +17 -16
- package/index31.js +3 -3
- package/index32.js +3 -3
- package/index33.js +2 -2
- package/index34.js +3 -3
- package/index35.js +1 -1
- package/index36.js +2 -2
- package/index37.js +2 -2
- package/index38.js +2 -2
- package/index39.js +2 -2
- package/index4.js +1 -1
- package/index40.js +19 -12
- package/index41.js +61 -14
- package/index42.js +44 -22
- package/index43.js +13 -11
- package/index44.js +25 -4
- package/index45.js +16 -51
- package/index46.js +19 -16
- package/index47.js +49 -27
- package/index48.js +5 -18
- package/index49.js +25 -21
- package/index5.js +1 -1
- package/index50.js +16 -47
- package/index51.js +7 -3
- package/index52.js +18 -18
- package/index53.js +16 -16
- package/index54.js +6 -4
- package/index55.js +8 -21
- package/index56.js +13 -16
- package/index57.js +6 -8
- package/index58.js +6 -9
- package/index59.js +17 -13
- package/index6.js +1 -1
- package/index60.js +20 -7
- package/index61.js +59 -7
- package/index62.js +13 -17
- package/index63.js +9 -20
- package/index64.js +40 -48
- package/index65.js +85 -15
- package/index66.js +74 -11
- package/index67.js +23 -62
- package/index68.js +64 -80
- package/index69.js +68 -62
- package/index7.js +1 -1
- package/index70.js +138 -22
- package/index71.js +66 -65
- package/index72.js +40 -78
- package/index73.js +75 -133
- package/index74.js +69 -68
- package/index75.js +96 -34
- package/index76.js +258 -65
- package/index77.js +715 -63
- package/index78.js +478 -93
- package/index79.js +303 -263
- package/index8.js +1 -1
- package/index80.js +343 -678
- package/index81.js +242 -481
- package/index82.js +1329 -282
- package/index83.js +968 -350
- package/index84.js +343 -211
- package/index85.js +2025 -1288
- package/index86.js +2313 -954
- package/index87.js +6782 -339
- package/index88.js +15 -2103
- package/index89.js +12 -2369
- package/index9.js +1 -1
- package/index90.js +4 -6832
- package/index91.js +7 -15
- package/link/Link.d.ts +2 -2
- package/link-button/LinkButton.d.ts +1 -1
- package/package.json +7 -1
- package/{react.esm-D8HpDGKP.js → react.esm-sMU8Z7rL.js} +1872 -1872
- package/textfield/index.d.ts +0 -2
- package/useControlledState-Kv9K2AYu.js +30 -0
- package/{useDescription-D4_zk_sA.js → useDescription-B7stiK3j.js} +1 -1
- package/useEvent-Xk5kn5Ns.js +21 -0
- package/useField-DMzJIIN4.js +67 -0
- package/{useFilter-BnJDBCkt.js → useFilter-Bt9dbV1U.js} +1 -1
- package/useFocusRing-9PXyKy2A.js +1297 -0
- package/{useFocusable-C-N9wcwm.js → useFocusable-CcEBZe40.js} +11 -8
- package/{useGridSelectionCheckbox-i1rsjlC-.js → useGridSelectionCheckbox-DYgEnElE.js} +3 -3
- package/useHasTabbableChild-D6DwR81L.js +34 -0
- package/{useHighlightSelectionDescription-JVx2MW_e.js → useHighlightSelectionDescription-WYAbP4No.js} +19 -19
- package/useLabels-9zaZ9oa0.js +17 -0
- package/useListState-BfTeKTk5.js +119 -0
- package/{useLocalizedStringFormatter-DVCAZqcL.js → useLocalizedStringFormatter-BlCbn-hX.js} +29 -29
- package/{useSingleSelectListState-CmX9_L5H.js → useSingleSelectListState-DPkaL0la.js} +5 -5
- package/Button-CCevm2s3.js +0 -183
- package/Checkbox-CllWDBxF.js +0 -405
- package/Dialog-CLTyYwkS.js +0 -1889
- package/DragAndDrop-OTN7La7U.js +0 -42
- package/FocusScope-BR0SJ-cZ.js +0 -512
- package/Group-DPMuN3h8.js +0 -44
- package/Label-C18A_4Z5.js +0 -69
- package/Link-BU1h3K2a.js +0 -77
- package/ListBox-D21tdwTs.js +0 -463
- package/ListKeyboardDelegate-DxMjfMsI.js +0 -172
- package/PressResponder-DP8ZDNGy.js +0 -31
- package/SelectionManager-D4WtKtey.js +0 -988
- package/Separator-DLUHK9vv.js +0 -48
- package/Tag-CEd6WWSc.js +0 -725
- package/Text-DGLaY3HR.js +0 -17
- package/TextField-C_hq9WeT.js +0 -226
- package/TextField.module-Cwq1FAm7.js +0 -141
- package/accordion/AccordionContent.d.ts +0 -3
- package/accordion/AccordionTagContext.d.ts +0 -3
- package/accordion/AccordionTrigger.d.ts +0 -3
- package/index-CEg5vZQH.js +0 -132
- package/index-CgfokhRq.js +0 -674
- package/index.css +0 -1
- package/index92.js +0 -14
- package/index93.js +0 -6
- package/index94.js +0 -9
- package/useControlledState-S_TYcV_c.js +0 -45
- package/useFocusRing-D97-G3fT.js +0 -1324
- package/useHasTabbableChild-DeuCnGGv.js +0 -34
- package/useListState-DSOTbsL3.js +0 -119
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { n as I, e as x, o as E, a as w, c as F, b as N, d as O, k as y } from "./useFocusRing-9PXyKy2A.js";
|
|
2
|
+
import L, { createContext as A, useRef as S, useEffect as V } from "react";
|
|
3
|
+
import { $ as M } from "./Hidden-CVlUgUJM.js";
|
|
4
|
+
import { $ as R } from "./useFocusable-CcEBZe40.js";
|
|
5
|
+
function k(n, e) {
|
|
6
|
+
let {
|
|
7
|
+
elementType: t = "button",
|
|
8
|
+
isDisabled: d,
|
|
9
|
+
onPress: i,
|
|
10
|
+
onPressStart: a,
|
|
11
|
+
onPressEnd: r,
|
|
12
|
+
onPressUp: v,
|
|
13
|
+
onPressChange: l,
|
|
14
|
+
preventFocusOnPress: $,
|
|
15
|
+
allowFocusWhenDisabled: g,
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
onClick: c,
|
|
18
|
+
href: h,
|
|
19
|
+
target: P,
|
|
20
|
+
rel: u,
|
|
21
|
+
type: f = "button"
|
|
22
|
+
} = n, o;
|
|
23
|
+
t === "button" ? o = {
|
|
24
|
+
type: f,
|
|
25
|
+
disabled: d
|
|
26
|
+
} : o = {
|
|
27
|
+
role: "button",
|
|
28
|
+
tabIndex: d ? void 0 : 0,
|
|
29
|
+
href: t === "a" && !d ? h : void 0,
|
|
30
|
+
target: t === "a" ? P : void 0,
|
|
31
|
+
type: t === "input" ? f : void 0,
|
|
32
|
+
disabled: t === "input" ? d : void 0,
|
|
33
|
+
"aria-disabled": !d || t === "input" ? void 0 : d,
|
|
34
|
+
rel: t === "a" ? u : void 0
|
|
35
|
+
};
|
|
36
|
+
let { pressProps: b, isPressed: p } = I({
|
|
37
|
+
onPressStart: a,
|
|
38
|
+
onPressEnd: r,
|
|
39
|
+
onPressChange: l,
|
|
40
|
+
onPress: i,
|
|
41
|
+
onPressUp: v,
|
|
42
|
+
isDisabled: d,
|
|
43
|
+
preventFocusOnPress: $,
|
|
44
|
+
ref: e
|
|
45
|
+
}), { focusableProps: m } = R(n, e);
|
|
46
|
+
g && (m.tabIndex = d ? -1 : m.tabIndex);
|
|
47
|
+
let _ = x(m, b, E(n, {
|
|
48
|
+
labelable: !0
|
|
49
|
+
}));
|
|
50
|
+
return {
|
|
51
|
+
isPressed: p,
|
|
52
|
+
buttonProps: x(o, _, {
|
|
53
|
+
"aria-haspopup": n["aria-haspopup"],
|
|
54
|
+
"aria-expanded": n["aria-expanded"],
|
|
55
|
+
"aria-controls": n["aria-controls"],
|
|
56
|
+
"aria-pressed": n["aria-pressed"],
|
|
57
|
+
onClick: (D) => {
|
|
58
|
+
c && (c(D), console.warn("onClick is deprecated, please use onPress"));
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const T = 7e3;
|
|
64
|
+
let s = null;
|
|
65
|
+
function C(n, e = "assertive", t = T) {
|
|
66
|
+
s ? s.announce(n, e, t) : (s = new H(), (typeof IS_REACT_ACT_ENVIRONMENT == "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest < "u") ? s.announce(n, e, t) : setTimeout(() => {
|
|
67
|
+
s != null && s.isAttached() && (s == null || s.announce(n, e, t));
|
|
68
|
+
}, 100));
|
|
69
|
+
}
|
|
70
|
+
function z(n) {
|
|
71
|
+
s && s.clear(n);
|
|
72
|
+
}
|
|
73
|
+
class H {
|
|
74
|
+
isAttached() {
|
|
75
|
+
var e;
|
|
76
|
+
return (e = this.node) === null || e === void 0 ? void 0 : e.isConnected;
|
|
77
|
+
}
|
|
78
|
+
createLog(e) {
|
|
79
|
+
let t = document.createElement("div");
|
|
80
|
+
return t.setAttribute("role", "log"), t.setAttribute("aria-live", e), t.setAttribute("aria-relevant", "additions"), t;
|
|
81
|
+
}
|
|
82
|
+
destroy() {
|
|
83
|
+
this.node && (document.body.removeChild(this.node), this.node = null);
|
|
84
|
+
}
|
|
85
|
+
announce(e, t = "assertive", d = T) {
|
|
86
|
+
var i, a;
|
|
87
|
+
if (!this.node) return;
|
|
88
|
+
let r = document.createElement("div");
|
|
89
|
+
typeof e == "object" ? (r.setAttribute("role", "img"), r.setAttribute("aria-labelledby", e["aria-labelledby"])) : r.textContent = e, t === "assertive" ? (i = this.assertiveLog) === null || i === void 0 || i.appendChild(r) : (a = this.politeLog) === null || a === void 0 || a.appendChild(r), e !== "" && setTimeout(() => {
|
|
90
|
+
r.remove();
|
|
91
|
+
}, d);
|
|
92
|
+
}
|
|
93
|
+
clear(e) {
|
|
94
|
+
this.node && ((!e || e === "assertive") && this.assertiveLog && (this.assertiveLog.innerHTML = ""), (!e || e === "polite") && this.politeLog && (this.politeLog.innerHTML = ""));
|
|
95
|
+
}
|
|
96
|
+
constructor() {
|
|
97
|
+
this.node = null, this.assertiveLog = null, this.politeLog = null, typeof document < "u" && (this.node = document.createElement("div"), this.node.dataset.liveAnnouncer = "true", Object.assign(this.node.style, {
|
|
98
|
+
border: 0,
|
|
99
|
+
clip: "rect(0 0 0 0)",
|
|
100
|
+
clipPath: "inset(50%)",
|
|
101
|
+
height: "1px",
|
|
102
|
+
margin: "-1px",
|
|
103
|
+
overflow: "hidden",
|
|
104
|
+
padding: 0,
|
|
105
|
+
position: "absolute",
|
|
106
|
+
width: "1px",
|
|
107
|
+
whiteSpace: "nowrap"
|
|
108
|
+
}), this.assertiveLog = this.createLog("assertive"), this.node.appendChild(this.assertiveLog), this.politeLog = this.createLog("polite"), this.node.appendChild(this.politeLog), document.body.prepend(this.node));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const U = /* @__PURE__ */ A(null), j = /* @__PURE__ */ new Set([
|
|
112
|
+
"form",
|
|
113
|
+
"formAction",
|
|
114
|
+
"formEncType",
|
|
115
|
+
"formMethod",
|
|
116
|
+
"formNoValidate",
|
|
117
|
+
"formTarget",
|
|
118
|
+
"name",
|
|
119
|
+
"value"
|
|
120
|
+
]), B = /* @__PURE__ */ A({}), J = /* @__PURE__ */ M(function(e, t) {
|
|
121
|
+
[e, t] = w(e, t, B), e = K(e);
|
|
122
|
+
let d = e, { isPending: i } = d, { buttonProps: a, isPressed: r } = k(e, t), { focusProps: v, isFocused: l, isFocusVisible: $ } = F(e), { hoverProps: g, isHovered: c } = N({
|
|
123
|
+
...e,
|
|
124
|
+
isDisabled: e.isDisabled || i
|
|
125
|
+
}), h = {
|
|
126
|
+
isHovered: c,
|
|
127
|
+
isPressed: (d.isPressed || r) && !i,
|
|
128
|
+
isFocused: l,
|
|
129
|
+
isFocusVisible: $,
|
|
130
|
+
isDisabled: e.isDisabled || !1,
|
|
131
|
+
isPending: i ?? !1
|
|
132
|
+
}, P = O({
|
|
133
|
+
...e,
|
|
134
|
+
values: h,
|
|
135
|
+
defaultClassName: "react-aria-Button"
|
|
136
|
+
}), u = y(a.id), f = y(), o = a["aria-labelledby"];
|
|
137
|
+
i && (o ? o = `${o} ${f}` : a["aria-label"] && (o = `${u} ${f}`));
|
|
138
|
+
let b = S(i);
|
|
139
|
+
return V(() => {
|
|
140
|
+
let p = {
|
|
141
|
+
"aria-labelledby": o || u
|
|
142
|
+
};
|
|
143
|
+
(!b.current && l && i || b.current && l && !i) && C(p, "assertive"), b.current = i;
|
|
144
|
+
}, [
|
|
145
|
+
i,
|
|
146
|
+
l,
|
|
147
|
+
o,
|
|
148
|
+
u
|
|
149
|
+
]), /* @__PURE__ */ L.createElement("button", {
|
|
150
|
+
...E(e, {
|
|
151
|
+
propNames: j
|
|
152
|
+
}),
|
|
153
|
+
...x(a, v, g),
|
|
154
|
+
...P,
|
|
155
|
+
type: a.type === "submit" && i ? "button" : a.type,
|
|
156
|
+
id: u,
|
|
157
|
+
ref: t,
|
|
158
|
+
"aria-labelledby": o,
|
|
159
|
+
slot: e.slot || void 0,
|
|
160
|
+
"aria-disabled": i ? "true" : a["aria-disabled"],
|
|
161
|
+
"data-disabled": e.isDisabled || void 0,
|
|
162
|
+
"data-pressed": h.isPressed || void 0,
|
|
163
|
+
"data-hovered": c || void 0,
|
|
164
|
+
"data-focused": l || void 0,
|
|
165
|
+
"data-pending": i || void 0,
|
|
166
|
+
"data-focus-visible": $ || void 0
|
|
167
|
+
}, /* @__PURE__ */ L.createElement(U.Provider, {
|
|
168
|
+
value: {
|
|
169
|
+
id: f
|
|
170
|
+
}
|
|
171
|
+
}, P.children));
|
|
172
|
+
});
|
|
173
|
+
function K(n) {
|
|
174
|
+
return n.isPending && (n.onPress = void 0, n.onPressStart = void 0, n.onPressEnd = void 0, n.onPressChange = void 0, n.onPressUp = void 0, n.onKeyDown = void 0, n.onKeyUp = void 0, n.onClick = void 0, n.href = void 0), n;
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
J as $,
|
|
178
|
+
B as a,
|
|
179
|
+
C as b,
|
|
180
|
+
k as c,
|
|
181
|
+
z as d
|
|
182
|
+
};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 1.1.0 (2025-01-31)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **components:** new api and style for accordion
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- import/export textfield css directly from css module
|
|
10
|
+
|
|
11
|
+
### ❤️ Thank You
|
|
12
|
+
|
|
13
|
+
- pixelrickdreamer
|
|
14
|
+
- Wilhelm Hjelm
|
|
15
|
+
|
|
1
16
|
## 1.0.2 (2025-01-27)
|
|
2
17
|
|
|
3
18
|
### 🚀 Features
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { jsx as P, jsxs as K, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { c as U } from "./clsx-OuTLNxxd.js";
|
|
3
|
+
import { a as X } from "./RSPContexts-BW2SEIqe.js";
|
|
4
|
+
import { n as D, e as g, o as S, f as Y, a as w, y as M, z as Z, d as E, B as ee, i as ae, F as ie, A as q, c as de, b as le } from "./useFocusRing-9PXyKy2A.js";
|
|
5
|
+
import { d as ne, c as B, e as te, f as F, g as se, h as re, $ as W, a as oe } from "./Form-BWBjJC6v.js";
|
|
6
|
+
import { b as ce, $ as fe } from "./useField-DMzJIIN4.js";
|
|
7
|
+
import { $ as ue } from "./Text-BCF0xvqL.js";
|
|
8
|
+
import R, { useEffect as G, useRef as N, forwardRef as L, useContext as be, createContext as j } from "react";
|
|
9
|
+
import { $ as H } from "./useControlledState-Kv9K2AYu.js";
|
|
10
|
+
import { $ as ve } from "./useFocusable-CcEBZe40.js";
|
|
11
|
+
import { a as $e } from "./VisuallyHidden-Dhr5caPC.js";
|
|
12
|
+
import './Checkbox.css';function he(a, e, d) {
|
|
13
|
+
let { isDisabled: t = !1, isReadOnly: s = !1, value: r, name: o, children: l, "aria-label": f, "aria-labelledby": i, validationState: n = "valid", isInvalid: c } = a, v = (y) => {
|
|
14
|
+
y.stopPropagation(), e.setSelected(y.target.checked);
|
|
15
|
+
}, $ = l != null, u = f != null || i != null;
|
|
16
|
+
!$ && !u && console.warn("If you do not provide children, you must specify an aria-label for accessibility");
|
|
17
|
+
let { pressProps: b, isPressed: h } = D({
|
|
18
|
+
isDisabled: t
|
|
19
|
+
}), { pressProps: m, isPressed: x } = D({
|
|
20
|
+
isDisabled: t || s,
|
|
21
|
+
onPress() {
|
|
22
|
+
e.toggle();
|
|
23
|
+
}
|
|
24
|
+
}), { focusableProps: I } = ve(a, d), p = g(b, I), V = S(a, {
|
|
25
|
+
labelable: !0
|
|
26
|
+
});
|
|
27
|
+
return ne(d, e.isSelected, e.setSelected), {
|
|
28
|
+
labelProps: g(m, {
|
|
29
|
+
onClick: (y) => y.preventDefault()
|
|
30
|
+
}),
|
|
31
|
+
inputProps: g(V, {
|
|
32
|
+
"aria-invalid": c || n === "invalid" || void 0,
|
|
33
|
+
"aria-errormessage": a["aria-errormessage"],
|
|
34
|
+
"aria-controls": a["aria-controls"],
|
|
35
|
+
"aria-readonly": s || void 0,
|
|
36
|
+
onChange: v,
|
|
37
|
+
disabled: t,
|
|
38
|
+
...r == null ? {} : {
|
|
39
|
+
value: r
|
|
40
|
+
},
|
|
41
|
+
name: o,
|
|
42
|
+
type: "checkbox",
|
|
43
|
+
...p
|
|
44
|
+
}),
|
|
45
|
+
isSelected: e.isSelected,
|
|
46
|
+
isPressed: h || x,
|
|
47
|
+
isDisabled: t,
|
|
48
|
+
isReadOnly: s,
|
|
49
|
+
isInvalid: c || n === "invalid"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function T(a, e, d) {
|
|
53
|
+
let t = B({
|
|
54
|
+
...a,
|
|
55
|
+
value: e.isSelected
|
|
56
|
+
}), { isInvalid: s, validationErrors: r, validationDetails: o } = t.displayValidation, { labelProps: l, inputProps: f, isSelected: i, isPressed: n, isDisabled: c, isReadOnly: v } = he({
|
|
57
|
+
...a,
|
|
58
|
+
isInvalid: s
|
|
59
|
+
}, e, d);
|
|
60
|
+
te(a, t, d);
|
|
61
|
+
let { isIndeterminate: $, isRequired: u, validationBehavior: b = "aria" } = a;
|
|
62
|
+
G(() => {
|
|
63
|
+
d.current && (d.current.indeterminate = !!$);
|
|
64
|
+
});
|
|
65
|
+
let { pressProps: h } = D({
|
|
66
|
+
isDisabled: c || v,
|
|
67
|
+
onPress() {
|
|
68
|
+
let { [F]: m } = a, { commitValidation: x } = m || t;
|
|
69
|
+
x();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
labelProps: g(l, h),
|
|
74
|
+
inputProps: {
|
|
75
|
+
...f,
|
|
76
|
+
checked: i,
|
|
77
|
+
"aria-required": u && b === "aria" || void 0,
|
|
78
|
+
required: u && b === "native"
|
|
79
|
+
},
|
|
80
|
+
isSelected: i,
|
|
81
|
+
isPressed: n,
|
|
82
|
+
isDisabled: c,
|
|
83
|
+
isReadOnly: v,
|
|
84
|
+
isInvalid: s,
|
|
85
|
+
validationErrors: r,
|
|
86
|
+
validationDetails: o
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const A = /* @__PURE__ */ new WeakMap();
|
|
90
|
+
function me(a, e) {
|
|
91
|
+
let { isDisabled: d, name: t, validationBehavior: s = "aria" } = a, { isInvalid: r, validationErrors: o, validationDetails: l } = e.displayValidation, { labelProps: f, fieldProps: i, descriptionProps: n, errorMessageProps: c } = ce({
|
|
92
|
+
...a,
|
|
93
|
+
// Checkbox group is not an HTML input element so it
|
|
94
|
+
// shouldn't be labeled by a <label> element.
|
|
95
|
+
labelElementType: "span",
|
|
96
|
+
isInvalid: r,
|
|
97
|
+
errorMessage: a.errorMessage || o
|
|
98
|
+
});
|
|
99
|
+
A.set(e, {
|
|
100
|
+
name: t,
|
|
101
|
+
descriptionId: n.id,
|
|
102
|
+
errorMessageId: c.id,
|
|
103
|
+
validationBehavior: s
|
|
104
|
+
});
|
|
105
|
+
let v = S(a, {
|
|
106
|
+
labelable: !0
|
|
107
|
+
}), { focusWithinProps: $ } = Y({
|
|
108
|
+
onBlurWithin: a.onBlur,
|
|
109
|
+
onFocusWithin: a.onFocus,
|
|
110
|
+
onFocusWithinChange: a.onFocusChange
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
groupProps: g(v, {
|
|
114
|
+
role: "group",
|
|
115
|
+
"aria-disabled": d || void 0,
|
|
116
|
+
...i,
|
|
117
|
+
...$
|
|
118
|
+
}),
|
|
119
|
+
labelProps: f,
|
|
120
|
+
descriptionProps: n,
|
|
121
|
+
errorMessageProps: c,
|
|
122
|
+
isInvalid: r,
|
|
123
|
+
validationErrors: o,
|
|
124
|
+
validationDetails: l
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function z(a = {}) {
|
|
128
|
+
let { isReadOnly: e } = a, [d, t] = H(a.isSelected, a.defaultSelected || !1, a.onChange);
|
|
129
|
+
function s(o) {
|
|
130
|
+
e || t(o);
|
|
131
|
+
}
|
|
132
|
+
function r() {
|
|
133
|
+
e || t(!d);
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
isSelected: d,
|
|
137
|
+
setSelected: s,
|
|
138
|
+
toggle: r
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function ge(a, e, d) {
|
|
142
|
+
const t = z({
|
|
143
|
+
isReadOnly: a.isReadOnly || e.isReadOnly,
|
|
144
|
+
isSelected: e.isSelected(a.value),
|
|
145
|
+
onChange(h) {
|
|
146
|
+
h ? e.addValue(a.value) : e.removeValue(a.value), a.onChange && a.onChange(h);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
let { name: s, descriptionId: r, errorMessageId: o, validationBehavior: l } = A.get(e);
|
|
150
|
+
var f;
|
|
151
|
+
l = (f = a.validationBehavior) !== null && f !== void 0 ? f : l;
|
|
152
|
+
let { realtimeValidation: i } = B({
|
|
153
|
+
...a,
|
|
154
|
+
value: t.isSelected,
|
|
155
|
+
// Server validation is handled at the group level.
|
|
156
|
+
name: void 0,
|
|
157
|
+
validationBehavior: "aria"
|
|
158
|
+
}), n = N(se), c = () => {
|
|
159
|
+
e.setInvalid(a.value, i.isInvalid ? i : n.current);
|
|
160
|
+
};
|
|
161
|
+
G(c);
|
|
162
|
+
let v = e.realtimeValidation.isInvalid ? e.realtimeValidation : i, $ = l === "native" ? e.displayValidation : v;
|
|
163
|
+
var u;
|
|
164
|
+
let b = T({
|
|
165
|
+
...a,
|
|
166
|
+
isReadOnly: a.isReadOnly || e.isReadOnly,
|
|
167
|
+
isDisabled: a.isDisabled || e.isDisabled,
|
|
168
|
+
name: a.name || s,
|
|
169
|
+
isRequired: (u = a.isRequired) !== null && u !== void 0 ? u : e.isRequired,
|
|
170
|
+
validationBehavior: l,
|
|
171
|
+
[F]: {
|
|
172
|
+
realtimeValidation: v,
|
|
173
|
+
displayValidation: $,
|
|
174
|
+
resetValidation: e.resetValidation,
|
|
175
|
+
commitValidation: e.commitValidation,
|
|
176
|
+
updateValidation(h) {
|
|
177
|
+
n.current = h, c();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}, t, d);
|
|
181
|
+
return {
|
|
182
|
+
...b,
|
|
183
|
+
inputProps: {
|
|
184
|
+
...b.inputProps,
|
|
185
|
+
"aria-describedby": [
|
|
186
|
+
a["aria-describedby"],
|
|
187
|
+
e.isInvalid ? o : null,
|
|
188
|
+
r
|
|
189
|
+
].filter(Boolean).join(" ") || void 0
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function xe(a = {}) {
|
|
194
|
+
let [e, d] = H(a.value, a.defaultValue || [], a.onChange), t = !!a.isRequired && e.length === 0, s = N(/* @__PURE__ */ new Map()), r = B({
|
|
195
|
+
...a,
|
|
196
|
+
value: e
|
|
197
|
+
}), o = r.displayValidation.isInvalid;
|
|
198
|
+
var l;
|
|
199
|
+
return {
|
|
200
|
+
...r,
|
|
201
|
+
value: e,
|
|
202
|
+
setValue(i) {
|
|
203
|
+
a.isReadOnly || a.isDisabled || d(i);
|
|
204
|
+
},
|
|
205
|
+
isDisabled: a.isDisabled || !1,
|
|
206
|
+
isReadOnly: a.isReadOnly || !1,
|
|
207
|
+
isSelected(i) {
|
|
208
|
+
return e.includes(i);
|
|
209
|
+
},
|
|
210
|
+
addValue(i) {
|
|
211
|
+
a.isReadOnly || a.isDisabled || e.includes(i) || d(e.concat(i));
|
|
212
|
+
},
|
|
213
|
+
removeValue(i) {
|
|
214
|
+
a.isReadOnly || a.isDisabled || e.includes(i) && d(e.filter((n) => n !== i));
|
|
215
|
+
},
|
|
216
|
+
toggleValue(i) {
|
|
217
|
+
a.isReadOnly || a.isDisabled || (e.includes(i) ? d(e.filter((n) => n !== i)) : d(e.concat(i)));
|
|
218
|
+
},
|
|
219
|
+
setInvalid(i, n) {
|
|
220
|
+
let c = new Map(s.current);
|
|
221
|
+
n.isInvalid ? c.set(i, n) : c.delete(i), s.current = c, r.updateValidation(re(...c.values()));
|
|
222
|
+
},
|
|
223
|
+
validationState: (l = a.validationState) !== null && l !== void 0 ? l : o ? "invalid" : null,
|
|
224
|
+
isInvalid: o,
|
|
225
|
+
isRequired: t
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
const ye = /* @__PURE__ */ j(null), J = /* @__PURE__ */ j(null), da = /* @__PURE__ */ L(function(e, d) {
|
|
229
|
+
[e, d] = w(e, d, ye);
|
|
230
|
+
let { validationBehavior: t } = M(W) || {};
|
|
231
|
+
var s, r;
|
|
232
|
+
let o = (r = (s = e.validationBehavior) !== null && s !== void 0 ? s : t) !== null && r !== void 0 ? r : "native", l = xe({
|
|
233
|
+
...e,
|
|
234
|
+
validationBehavior: o
|
|
235
|
+
}), [f, i] = Z(), { groupProps: n, labelProps: c, descriptionProps: v, errorMessageProps: $, ...u } = me({
|
|
236
|
+
...e,
|
|
237
|
+
label: i,
|
|
238
|
+
validationBehavior: o
|
|
239
|
+
}, l), b = E({
|
|
240
|
+
...e,
|
|
241
|
+
values: {
|
|
242
|
+
isDisabled: l.isDisabled,
|
|
243
|
+
isReadOnly: l.isReadOnly,
|
|
244
|
+
isRequired: e.isRequired || !1,
|
|
245
|
+
isInvalid: l.isInvalid,
|
|
246
|
+
state: l
|
|
247
|
+
},
|
|
248
|
+
defaultClassName: "react-aria-CheckboxGroup"
|
|
249
|
+
});
|
|
250
|
+
return /* @__PURE__ */ R.createElement("div", {
|
|
251
|
+
...n,
|
|
252
|
+
...b,
|
|
253
|
+
ref: d,
|
|
254
|
+
slot: e.slot || void 0,
|
|
255
|
+
"data-readonly": l.isReadOnly || void 0,
|
|
256
|
+
"data-required": e.isRequired || void 0,
|
|
257
|
+
"data-invalid": l.isInvalid || void 0,
|
|
258
|
+
"data-disabled": e.isDisabled || void 0
|
|
259
|
+
}, /* @__PURE__ */ R.createElement(ee, {
|
|
260
|
+
values: [
|
|
261
|
+
[
|
|
262
|
+
J,
|
|
263
|
+
l
|
|
264
|
+
],
|
|
265
|
+
[
|
|
266
|
+
fe,
|
|
267
|
+
{
|
|
268
|
+
...c,
|
|
269
|
+
ref: f,
|
|
270
|
+
elementType: "span"
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
[
|
|
274
|
+
ue,
|
|
275
|
+
{
|
|
276
|
+
slots: {
|
|
277
|
+
description: v,
|
|
278
|
+
errorMessage: $
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
[
|
|
283
|
+
oe,
|
|
284
|
+
u
|
|
285
|
+
]
|
|
286
|
+
]
|
|
287
|
+
}, b.children));
|
|
288
|
+
}), Pe = /* @__PURE__ */ L(function(e, d) {
|
|
289
|
+
let { inputRef: t = null, ...s } = e;
|
|
290
|
+
[e, d] = w(s, d, X);
|
|
291
|
+
let { validationBehavior: r } = M(W) || {};
|
|
292
|
+
var o, l;
|
|
293
|
+
let f = (l = (o = e.validationBehavior) !== null && o !== void 0 ? o : r) !== null && l !== void 0 ? l : "native", i = be(J), n = ae(ie(t, e.inputRef !== void 0 ? e.inputRef : null)), { labelProps: c, inputProps: v, isSelected: $, isDisabled: u, isReadOnly: b, isPressed: h, isInvalid: m } = i ? ge({
|
|
294
|
+
...q(e),
|
|
295
|
+
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
296
|
+
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
297
|
+
// @ts-ignore
|
|
298
|
+
value: e.value,
|
|
299
|
+
// ReactNode type doesn't allow function children.
|
|
300
|
+
children: typeof e.children == "function" ? !0 : e.children
|
|
301
|
+
}, i, n) : T({
|
|
302
|
+
...q(e),
|
|
303
|
+
children: typeof e.children == "function" ? !0 : e.children,
|
|
304
|
+
validationBehavior: f
|
|
305
|
+
}, z(e), n), { isFocused: x, isFocusVisible: I, focusProps: p } = de(), V = u || b, { hoverProps: y, isHovered: k } = le({
|
|
306
|
+
...e,
|
|
307
|
+
isDisabled: V
|
|
308
|
+
}), O = E({
|
|
309
|
+
...e,
|
|
310
|
+
defaultClassName: "react-aria-Checkbox",
|
|
311
|
+
values: {
|
|
312
|
+
isSelected: $,
|
|
313
|
+
isIndeterminate: e.isIndeterminate || !1,
|
|
314
|
+
isPressed: h,
|
|
315
|
+
isHovered: k,
|
|
316
|
+
isFocused: x,
|
|
317
|
+
isFocusVisible: I,
|
|
318
|
+
isDisabled: u,
|
|
319
|
+
isReadOnly: b,
|
|
320
|
+
isInvalid: m,
|
|
321
|
+
isRequired: e.isRequired || !1
|
|
322
|
+
}
|
|
323
|
+
}), _ = S(e);
|
|
324
|
+
return delete _.id, /* @__PURE__ */ R.createElement("label", {
|
|
325
|
+
...g(_, c, y, O),
|
|
326
|
+
ref: d,
|
|
327
|
+
slot: e.slot || void 0,
|
|
328
|
+
"data-selected": $ || void 0,
|
|
329
|
+
"data-indeterminate": e.isIndeterminate || void 0,
|
|
330
|
+
"data-pressed": h || void 0,
|
|
331
|
+
"data-hovered": k || void 0,
|
|
332
|
+
"data-focused": x || void 0,
|
|
333
|
+
"data-focus-visible": I || void 0,
|
|
334
|
+
"data-disabled": u || void 0,
|
|
335
|
+
"data-readonly": b || void 0,
|
|
336
|
+
"data-invalid": m || void 0,
|
|
337
|
+
"data-required": e.isRequired || void 0
|
|
338
|
+
}, /* @__PURE__ */ R.createElement($e, {
|
|
339
|
+
elementType: "span"
|
|
340
|
+
}, /* @__PURE__ */ R.createElement("input", {
|
|
341
|
+
...g(v, p),
|
|
342
|
+
ref: n
|
|
343
|
+
})), O.children);
|
|
344
|
+
}), Re = '"../theme/tokens.css"', Ie = '"Inter", sans-serif', pe = "#000000", Ve = "#143c50", De = "#5897b8", Se = "#25607f", Be = "#ffdfdf", ke = "#e62323", Oe = "0 0 0 2px #ffffff, 0 0 0 4px #000000", _e = "#b31b1b", qe = "#ffffff", Ce = "#f2f2f2", we = "#cccccc", Me = "#808080", Ee = "#bfbfbf", Fe = "#e6e6e6", We = "400", Ge = "500", Ne = "(max-width: 767px)", Le = "#b3b3b3", je = "_wrap_qn5vw_4", He = "_checkboxInner_qn5vw_11", Te = "_checkbox_qn5vw_11", Ae = "_checkboxGroup_qn5vw_129", C = {
|
|
345
|
+
tokens: Re,
|
|
346
|
+
display: Ie,
|
|
347
|
+
black: pe,
|
|
348
|
+
primaryBackground: Ve,
|
|
349
|
+
blue80: De,
|
|
350
|
+
blue130: Se,
|
|
351
|
+
signalRed10: Be,
|
|
352
|
+
signalRed100: ke,
|
|
353
|
+
focus: Oe,
|
|
354
|
+
signalRed130: _e,
|
|
355
|
+
white: qe,
|
|
356
|
+
gray10: Ce,
|
|
357
|
+
gray40: we,
|
|
358
|
+
gray100: Me,
|
|
359
|
+
gray50: Ee,
|
|
360
|
+
gray20: Fe,
|
|
361
|
+
regularWeight: We,
|
|
362
|
+
mediumWeight: Ge,
|
|
363
|
+
smBreakpoint: Ne,
|
|
364
|
+
borderSecondary: Le,
|
|
365
|
+
wrap: je,
|
|
366
|
+
checkboxInner: He,
|
|
367
|
+
checkbox: Te,
|
|
368
|
+
checkboxGroup: Ae
|
|
369
|
+
}, la = ({ children: a, ...e }) => /* @__PURE__ */ P(
|
|
370
|
+
Pe,
|
|
371
|
+
{
|
|
372
|
+
className: U(C.checkbox, e.className),
|
|
373
|
+
...e,
|
|
374
|
+
children: ({ isIndeterminate: d }) => /* @__PURE__ */ K(Q, { children: [
|
|
375
|
+
/* @__PURE__ */ P("div", { className: C.checkboxInner, children: /* @__PURE__ */ P(
|
|
376
|
+
"svg",
|
|
377
|
+
{
|
|
378
|
+
width: 16,
|
|
379
|
+
height: 16,
|
|
380
|
+
viewBox: "0 0 18 18",
|
|
381
|
+
"aria-hidden": "true",
|
|
382
|
+
children: d ? /* @__PURE__ */ P(
|
|
383
|
+
"rect",
|
|
384
|
+
{
|
|
385
|
+
x: 4,
|
|
386
|
+
y: 8,
|
|
387
|
+
width: 10,
|
|
388
|
+
height: 2
|
|
389
|
+
}
|
|
390
|
+
) : /* @__PURE__ */ P("polyline", { points: "3,9 7,13 15,4" })
|
|
391
|
+
}
|
|
392
|
+
) }),
|
|
393
|
+
a
|
|
394
|
+
] })
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
export {
|
|
398
|
+
da as $,
|
|
399
|
+
la as C,
|
|
400
|
+
J as a,
|
|
401
|
+
C as s
|
|
402
|
+
};
|