@kanso-labs/kanso-ui 0.43.6 → 0.44.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/README.md +1 -0
- package/dist/calendar/index.js +34 -10
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +30 -0
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/index.js +27 -18
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/label.js +32 -0
- package/dist/chip/label.js.map +1 -0
- package/dist/chip/styles.js +32 -2
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/text.js +24 -3
- package/dist/collection/text.js.map +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +8 -1
- package/dist/components/calendar/index.js +129 -73
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/checkbox/index.js +29 -30
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.js +4 -2
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +35 -5
- package/dist/components/chip-group/index.js +137 -97
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.d.ts +64 -6
- package/dist/components/currency/index.js +117 -40
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/dialog/index.d.ts +3 -1
- package/dist/components/dialog/index.js +121 -81
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure-group/index.js +1 -1
- package/dist/components/disclosure-group/index.js.map +1 -1
- package/dist/components/icon-button/index.js +18 -1
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/keycap/index.d.ts +3 -0
- package/dist/components/keycap/index.js +30 -44
- package/dist/components/keycap/index.js.map +1 -1
- package/dist/components/list/index.d.ts +16 -2
- package/dist/components/list/index.js +124 -69
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-detail/index.d.ts +11 -3
- package/dist/components/list-detail/index.js +13 -6
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/list-item/index.d.ts +16 -1
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +6 -2
- package/dist/components/menu/index.js +22 -15
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +4 -1
- package/dist/components/meter/index.js +6 -0
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-bar/index.d.ts +14 -4
- package/dist/components/navigation-bar/index.js +77 -50
- package/dist/components/navigation-bar/index.js.map +1 -1
- package/dist/components/navigation-rail/index.d.ts +3 -2
- package/dist/components/navigation-rail/index.js +59 -52
- package/dist/components/navigation-rail/index.js.map +1 -1
- package/dist/components/navigation-tree/index.js +4 -1
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +3 -2
- package/dist/components/number-field/index.js +91 -115
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +3 -1
- package/dist/components/popover/index.js +102 -100
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +4 -2
- package/dist/components/progress-indicator/index.js +4 -3
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/radio-group/index.js +34 -24
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +11 -1
- package/dist/components/search-field/index.js +32 -28
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +9 -2
- package/dist/components/segmented-button/index.js +1 -1
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +19 -7
- package/dist/components/separator/index.js +36 -13
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.js +72 -61
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +4 -1
- package/dist/components/snackbar/index.js +140 -55
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/stack/index.d.ts +6 -3
- package/dist/components/stack/index.js +48 -31
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +16 -6
- package/dist/components/switch/index.js +115 -62
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +10 -1
- package/dist/components/text-area/index.js +21 -19
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +16 -2
- package/dist/components/text-field/index.js +49 -43
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-picker/index.js +42 -38
- package/dist/components/time-picker/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +3 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +15 -3
- package/dist/components/tree/index.js +41 -28
- package/dist/components/tree/index.js.map +1 -1
- package/dist/control/index.js +26 -23
- package/dist/control/index.js.map +1 -1
- package/dist/control/styles.js +8 -1
- package/dist/control/styles.js.map +1 -1
- package/dist/field/index.js +149 -131
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +14 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/glyphs/index.js +37 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/hooks/useClippedTitle.js +44 -0
- package/dist/hooks/useClippedTitle.js.map +1 -0
- package/dist/hooks/useRipple.js +6 -5
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/hooks/useScrollStop.js +133 -0
- package/dist/hooks/useScrollStop.js.map +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +34 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/indicator/index.js +18 -16
- package/dist/indicator/index.js.map +1 -1
- package/dist/indicator/styles.js +3 -0
- package/dist/indicator/styles.js.map +1 -1
- package/dist/keycap/context.js +7 -0
- package/dist/keycap/context.js.map +1 -0
- package/dist/navigation/index.d.ts +16 -2
- package/dist/navigation/index.js +145 -44
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/styles.js +79 -16
- package/dist/navigation/styles.js.map +1 -1
- package/dist/overlay/modal.js +7 -0
- package/dist/overlay/modal.js.map +1 -0
- package/dist/row/index.js +92 -89
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +24 -1
- package/dist/row/styles.js.map +1 -1
- package/dist/styles/overlay.d.ts +6 -2
- package/dist/styles/overlay.js +9 -1
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles.css +177 -20
- package/dist/theme-scope.d.ts +5 -1
- package/dist/theme-scope.js +100 -51
- package/dist/theme-scope.js.map +1 -1
- package/dist/tokens/design.tokens.stylex.js.map +1 -1
- package/package.json +21 -20
- package/dist/hooks/useScrollable.js +0 -69
- package/dist/hooks/useScrollable.js.map +0 -1
|
@@ -4,12 +4,13 @@ import { mergeRefs } from "../../render/ref.js";
|
|
|
4
4
|
import { mergeStatefulStyles, mergeStyles } from "../../styles/merge.js";
|
|
5
5
|
import { overlay } from "../../styles/overlay.js";
|
|
6
6
|
import { useHoldBottomEdge } from "../../hooks/useBottomEdge.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useScrollStop } from "../../hooks/useScrollStop.js";
|
|
8
8
|
import { OverlayScope } from "../../overlay/index.js";
|
|
9
|
+
import { InsideModalContext } from "../../overlay/modal.js";
|
|
9
10
|
import { c } from "react/compiler-runtime";
|
|
10
|
-
import { createContext, useContext, useRef, useSyncExternalStore } from "react";
|
|
11
|
+
import { createContext, useContext, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
11
12
|
import { jsx } from "react/jsx-runtime";
|
|
12
|
-
import { Dialog, DialogTrigger, Heading, Modal, ModalOverlay } from "react-aria-components";
|
|
13
|
+
import { Dialog, DialogTrigger, Heading, HeadingContext, Modal, ModalOverlay, useSlottedContext } from "react-aria-components";
|
|
13
14
|
//#region src/components/dialog/index.tsx
|
|
14
15
|
const FULL_SCREEN = "(width < 600px)";
|
|
15
16
|
const styles = {
|
|
@@ -25,6 +26,7 @@ const styles = {
|
|
|
25
26
|
kOIVth: "xxj4525",
|
|
26
27
|
kb6lSQ: "xn43zvd",
|
|
27
28
|
kLWn49: "xv61bfh",
|
|
29
|
+
kHjlTd: "xj0a0fe",
|
|
28
30
|
kORKVm: "x1odjw0f",
|
|
29
31
|
kGO01o: "x1az23kl x18d9i69",
|
|
30
32
|
kLKAdn: "x886u18 xexx8yu x3reb9c",
|
|
@@ -50,6 +52,7 @@ const basic = {
|
|
|
50
52
|
}
|
|
51
53
|
};
|
|
52
54
|
const BasicContext = createContext(false);
|
|
55
|
+
const DescriptionContext = createContext(null);
|
|
53
56
|
/**
|
|
54
57
|
* A modal dialog centred over the page, and the same dialog filling the
|
|
55
58
|
* window below the medium breakpoint — the dialogs page's basic and
|
|
@@ -97,11 +100,25 @@ function Dialog$1(t0) {
|
|
|
97
100
|
return t1;
|
|
98
101
|
}
|
|
99
102
|
function DialogBody(t0) {
|
|
100
|
-
const $ = c(
|
|
103
|
+
const $ = c(8);
|
|
101
104
|
const { ref: callerRef, ...props$2 } = t0;
|
|
102
105
|
const isBasic = useContext(BasicContext);
|
|
106
|
+
const describe = useContext(DescriptionContext);
|
|
107
|
+
const generated = useId();
|
|
108
|
+
const id = props$2.id ?? (describe === null ? void 0 : generated);
|
|
109
|
+
useLayoutEffect(() => {
|
|
110
|
+
if (describe === null || id === void 0) return;
|
|
111
|
+
describe(id);
|
|
112
|
+
return () => {
|
|
113
|
+
describe(void 0);
|
|
114
|
+
};
|
|
115
|
+
}, [describe, id]);
|
|
103
116
|
const ref = useRef(null);
|
|
104
|
-
const
|
|
117
|
+
const title = useSlottedContext(HeadingContext, "title");
|
|
118
|
+
const scrollStop = useScrollStop(ref, {
|
|
119
|
+
label: props$2["aria-label"],
|
|
120
|
+
title: title?.id
|
|
121
|
+
});
|
|
105
122
|
const t1 = callerRef ?? void 0;
|
|
106
123
|
let t2;
|
|
107
124
|
if ($[0] !== t1) {
|
|
@@ -110,23 +127,24 @@ function DialogBody(t0) {
|
|
|
110
127
|
$[1] = t2;
|
|
111
128
|
} else t2 = $[1];
|
|
112
129
|
const merged = t2;
|
|
113
|
-
const t3 =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
130
|
+
const t3 = mergeStyles(props(styles.body, isBasic && basic.body, overlay.modalBodyRing), props$2);
|
|
131
|
+
let t4;
|
|
132
|
+
if ($[2] !== id || $[3] !== merged || $[4] !== props$2 || $[5] !== scrollStop || $[6] !== t3) {
|
|
133
|
+
t4 = /* @__PURE__ */ jsx("div", {
|
|
134
|
+
...scrollStop,
|
|
135
|
+
id,
|
|
119
136
|
...props$2,
|
|
120
137
|
ref: merged,
|
|
121
|
-
...
|
|
138
|
+
...t3
|
|
122
139
|
});
|
|
123
|
-
$[2] =
|
|
124
|
-
$[3] =
|
|
125
|
-
$[4] =
|
|
126
|
-
$[5] =
|
|
127
|
-
$[6] =
|
|
128
|
-
|
|
129
|
-
|
|
140
|
+
$[2] = id;
|
|
141
|
+
$[3] = merged;
|
|
142
|
+
$[4] = props$2;
|
|
143
|
+
$[5] = scrollStop;
|
|
144
|
+
$[6] = t3;
|
|
145
|
+
$[7] = t4;
|
|
146
|
+
} else t4 = $[7];
|
|
147
|
+
return t4;
|
|
130
148
|
}
|
|
131
149
|
/**
|
|
132
150
|
* The dialog itself, and the scrim behind it. Everything the dialog shows
|
|
@@ -137,7 +155,9 @@ function DialogBody(t0) {
|
|
|
137
155
|
* something that has to be answered before the page carries on — a screen
|
|
138
156
|
* reader announces it rather than waiting to be asked. It also keeps the
|
|
139
157
|
* dialog the basic one below the medium breakpoint, centred and sized to its
|
|
140
|
-
* content, where a dialog of the default role fills the window.
|
|
158
|
+
* content, where a dialog of the default role fills the window. Its
|
|
159
|
+
* `Dialog.Body` is its description, so the message is read out with the
|
|
160
|
+
* title; an `aria-describedby` of the call site's own names another.
|
|
141
161
|
*
|
|
142
162
|
* A press on the scrim closes the dialog unless `isDismissable` says
|
|
143
163
|
* otherwise, which is the same default `Sheet` takes and the reverse of
|
|
@@ -157,7 +177,7 @@ function DialogBody(t0) {
|
|
|
157
177
|
* over it, and React Aria's popovers and menus draw above both.
|
|
158
178
|
*/
|
|
159
179
|
function DialogContent(t0) {
|
|
160
|
-
const $ = c(
|
|
180
|
+
const $ = c(43);
|
|
161
181
|
let children;
|
|
162
182
|
let className;
|
|
163
183
|
let container;
|
|
@@ -198,87 +218,107 @@ function DialogContent(t0) {
|
|
|
198
218
|
}
|
|
199
219
|
const isDismissable = t1 === void 0 ? true : t1;
|
|
200
220
|
const isBasic = props$1.role === "alertdialog";
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
$[12] = isBasic;
|
|
205
|
-
$[13] = t2;
|
|
206
|
-
} else t2 = $[13];
|
|
221
|
+
const [body, setBody] = useState();
|
|
222
|
+
const overModal = useContext(InsideModalContext);
|
|
223
|
+
const t2 = isBasic ? setBody : null;
|
|
207
224
|
let t3;
|
|
208
|
-
if ($[
|
|
209
|
-
t3 =
|
|
225
|
+
if ($[12] !== isBasic || $[13] !== overModal) {
|
|
226
|
+
t3 = props(overlay.scrim, overModal && overlay.scrimOverModal, styles.centre, isBasic && basic.centre);
|
|
227
|
+
$[12] = isBasic;
|
|
228
|
+
$[13] = overModal;
|
|
229
|
+
$[14] = t3;
|
|
230
|
+
} else t3 = $[14];
|
|
231
|
+
let t4;
|
|
232
|
+
if ($[15] !== className || $[16] !== isBasic || $[17] !== style) {
|
|
233
|
+
t4 = mergeStatefulStyles({
|
|
210
234
|
0: { className: "x1n1nwrg x1u6grsq xbhiib0 x1ebxanj x16dv9tl xvkjz1l xt7dq6l x1ju3lih x1w1tqly x19pkqky x1f120ba xx61lck x1gb867b x13rsnn2 x1udv5rz x9f619 x139gbkf x78zum5 xdt5ytf xh8yej3 xmz0i5r x27kpxv x6iovhr x1u2d2a2 xxzqys8 xb3r6kr x9xqwrn xg8iv3o x19b5e0v xsds98l" },
|
|
211
235
|
1: { className: "x1n1nwrg x1u6grsq x16dv9tl xvkjz1l x1w1tqly x13rsnn2 x1udv5rz x9f619 x139gbkf x78zum5 xdt5ytf xh8yej3 xmz0i5r xb3r6kr xbhiib0 xt7dq6l x19pkqky xx61lck x27kpxv x1u2d2a2" }
|
|
212
236
|
}[!!isBasic << 0], {
|
|
213
237
|
className,
|
|
214
238
|
style
|
|
215
239
|
});
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[17] = t3;
|
|
220
|
-
} else t3 = $[17];
|
|
221
|
-
let t4;
|
|
222
|
-
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
223
|
-
t4 = props(overlay.modalDialog);
|
|
240
|
+
$[15] = className;
|
|
241
|
+
$[16] = isBasic;
|
|
242
|
+
$[17] = style;
|
|
224
243
|
$[18] = t4;
|
|
225
244
|
} else t4 = $[18];
|
|
226
|
-
|
|
227
|
-
if ($[19] !== children || $[20] !== props$1) {
|
|
228
|
-
t5 = /* @__PURE__ */ jsx(Dialog, {
|
|
229
|
-
...props$1,
|
|
230
|
-
...t4,
|
|
231
|
-
children
|
|
232
|
-
});
|
|
233
|
-
$[19] = children;
|
|
234
|
-
$[20] = props$1;
|
|
235
|
-
$[21] = t5;
|
|
236
|
-
} else t5 = $[21];
|
|
245
|
+
const t5 = props$1["aria-describedby"] ?? (isBasic ? body : void 0);
|
|
237
246
|
let t6;
|
|
238
|
-
if ($[
|
|
239
|
-
t6 =
|
|
247
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
248
|
+
t6 = props(overlay.modalDialog);
|
|
249
|
+
$[19] = t6;
|
|
250
|
+
} else t6 = $[19];
|
|
251
|
+
let t7;
|
|
252
|
+
if ($[20] !== children || $[21] !== props$1 || $[22] !== t5) {
|
|
253
|
+
t7 = /* @__PURE__ */ jsx(InsideModalContext, {
|
|
254
|
+
value: true,
|
|
255
|
+
children: /* @__PURE__ */ jsx(Dialog, {
|
|
256
|
+
...props$1,
|
|
257
|
+
"aria-describedby": t5,
|
|
258
|
+
...t6,
|
|
259
|
+
children
|
|
260
|
+
})
|
|
261
|
+
});
|
|
262
|
+
$[20] = children;
|
|
263
|
+
$[21] = props$1;
|
|
264
|
+
$[22] = t5;
|
|
265
|
+
$[23] = t7;
|
|
266
|
+
} else t7 = $[23];
|
|
267
|
+
let t8;
|
|
268
|
+
if ($[24] !== ref || $[25] !== t4 || $[26] !== t7) {
|
|
269
|
+
t8 = /* @__PURE__ */ jsx(Modal, {
|
|
240
270
|
ref,
|
|
241
|
-
...
|
|
242
|
-
children:
|
|
271
|
+
...t4,
|
|
272
|
+
children: t7
|
|
243
273
|
});
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
} else
|
|
249
|
-
let
|
|
250
|
-
if ($[
|
|
251
|
-
|
|
274
|
+
$[24] = ref;
|
|
275
|
+
$[25] = t4;
|
|
276
|
+
$[26] = t7;
|
|
277
|
+
$[27] = t8;
|
|
278
|
+
} else t8 = $[27];
|
|
279
|
+
let t9;
|
|
280
|
+
if ($[28] !== container || $[29] !== defaultOpen || $[30] !== isDismissable || $[31] !== isKeyboardDismissDisabled || $[32] !== isOpen || $[33] !== onOpenChange || $[34] !== t3 || $[35] !== t8) {
|
|
281
|
+
t9 = /* @__PURE__ */ jsx(OverlayScope, { children: /* @__PURE__ */ jsx(ModalOverlay, {
|
|
252
282
|
defaultOpen,
|
|
253
283
|
isDismissable,
|
|
254
284
|
isKeyboardDismissDisabled,
|
|
255
285
|
isOpen,
|
|
256
286
|
onOpenChange,
|
|
257
287
|
UNSTABLE_portalContainer: container,
|
|
258
|
-
...
|
|
259
|
-
children:
|
|
288
|
+
...t3,
|
|
289
|
+
children: t8
|
|
260
290
|
}) });
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
} else
|
|
271
|
-
let
|
|
272
|
-
if ($[
|
|
273
|
-
|
|
291
|
+
$[28] = container;
|
|
292
|
+
$[29] = defaultOpen;
|
|
293
|
+
$[30] = isDismissable;
|
|
294
|
+
$[31] = isKeyboardDismissDisabled;
|
|
295
|
+
$[32] = isOpen;
|
|
296
|
+
$[33] = onOpenChange;
|
|
297
|
+
$[34] = t3;
|
|
298
|
+
$[35] = t8;
|
|
299
|
+
$[36] = t9;
|
|
300
|
+
} else t9 = $[36];
|
|
301
|
+
let t10;
|
|
302
|
+
if ($[37] !== t2 || $[38] !== t9) {
|
|
303
|
+
t10 = /* @__PURE__ */ jsx(DescriptionContext, {
|
|
304
|
+
value: t2,
|
|
305
|
+
children: t9
|
|
306
|
+
});
|
|
307
|
+
$[37] = t2;
|
|
308
|
+
$[38] = t9;
|
|
309
|
+
$[39] = t10;
|
|
310
|
+
} else t10 = $[39];
|
|
311
|
+
let t11;
|
|
312
|
+
if ($[40] !== isBasic || $[41] !== t10) {
|
|
313
|
+
t11 = /* @__PURE__ */ jsx(BasicContext, {
|
|
274
314
|
value: isBasic,
|
|
275
|
-
children:
|
|
315
|
+
children: t10
|
|
276
316
|
});
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
} else
|
|
281
|
-
return
|
|
317
|
+
$[40] = isBasic;
|
|
318
|
+
$[41] = t10;
|
|
319
|
+
$[42] = t11;
|
|
320
|
+
} else t11 = $[42];
|
|
321
|
+
return t11;
|
|
282
322
|
}
|
|
283
323
|
/**
|
|
284
324
|
* The dialog's actions. Full screen they are the action bar on the window's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","HTMLAttributes","ReactNode","RefAttributes","ClassNameOrFunction","DialogTriggerProps","HeadingProps","ModalOverlayProps","ModalRenderProps","DialogProps","RACDialogProps","StyleOrFunction","stylex","createContext","useContext","useMemo","useRef","useSyncExternalStore","DialogTrigger","Heading","Modal","ModalOverlay","Dialog","RACDialog","useHoldBottomEdge","useScrollable","OverlayScope","mergeRefs","mergeStatefulStyles","mergeStyles","overlay","colors","media","motion","radii","shadows","spacing","typography","FORCED_COLORS","FULL_SCREEN","scaleIn","slideInFromBottom","styles","body","kB7OPa","kMwMTN","k1xSpc","kXwgrk","kzQI83","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","kORKVm","kGO01o","kLKAdn","kg3NbH","$$css","centre","kGNEyG","kjj79g","kmVPX3","basic","BasicContext","Omit","children","t0","$","props","t1","DialogBody","ref","callerRef","isBasic","scrollable","undefined","t2","merged","t3","t4","modalBodyRing","t5","DialogContent","className","container","defaultOpen","isKeyboardDismissDisabled","isOpen","onOpenChange","style","isDismissable","role","scrim","0","1","Symbol","for","modalDialog","t6","t7","t8","DialogFooter","useFullScreen","DialogHeader","DialogTitle","isFullScreen","window","matchMedia","matches","isFullScreenOnServer","subscribeToFullScreen","listener","query","addEventListener","removeEventListener","Body","Content","Footer","Header","Title","DialogContentProps","Element","Pick","DialogTitleProps","Dialog","_c","props","stylex.props","RACDialog"],"sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, DialogTriggerProps, HeadingProps, ModalOverlayProps, ModalRenderProps, DialogProps as RACDialogProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext, useMemo, useRef, useSyncExternalStore } from 'react';\nimport { DialogTrigger, Heading, Modal, ModalOverlay, Dialog as RACDialog } from 'react-aria-components';\nimport { useHoldBottomEdge } from '../../hooks/useBottomEdge';\nimport { useScrollable } from '../../hooks/useScrollable';\nimport { OverlayScope } from '../../overlay';\nimport { mergeRefs } from '../../render/ref';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, media, motion, radii, shadows, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// The window size the full-screen dialog is drawn at, which the styles read\n// as `media.belowMedium`. Spelled again for `matchMedia`, which is the one\n// thing in this file that has to know it outside a stylesheet: the footer\n// holds the window's bottom edge only there. See `useFullScreen`.\nconst FULL_SCREEN = '(width < 600px)';\n\n// The dialogs page's two dialogs, which are one component here for the same\n// reason Sheet's two presentations are: the page pairs them by window size\n// rather than offering a choice. Above the medium breakpoint it is the basic\n// dialog — a container on surface container high with a 28dp corner, between\n// 280 and 560dp wide, centred over the scrim, with 24dp of padding all round,\n// 16dp between the headline and the body and 24dp between the body and the\n// actions. Below it the same dialog fills the window as the page's\n// full-screen dialog: square corners, a 56dp header with the headline and a\n// divider under it, and a 56dp action bar with a divider over it.\n//\n// The pairing is for a dialog that is a task, which needs the room. An alert\n// dialog is a question with two or three answers, and the page keeps the\n// full-screen dialog for tasks, so `role=\"alertdialog\"` stays the basic dialog\n// at every width. Filled to a phone's window it read as a headline at the top\n// of the screen and its answers at the bottom, with nothing between them but\n// the chrome. The `basic` styles below are how: each restates, without the\n// breakpoint, the properties the paired styles change below it.\n//\n// The headline is headline-small on surface, the body body-medium on surface\n// variant, and the buttons are the call site's — the page draws text buttons\n// there, which is `Button`'s `text` variant.\n//\n// Two things the page draws are the call site's rather than the component's.\n// The optional icon above the headline, which the page centres the headline\n// and body with when it is there, is anything a `Dialog.Header` is given; a\n// dialog that wants it centres its own header. And the dividers a basic\n// dialog may show around a scrolling body are left out, since the page has\n// them only for that case and the body here scrolls with the header and\n// footer pinned either side of it, which is what they were marking.\n//\n// React Aria's overlay is three nested elements — the scrim, the container,\n// and the dialog inside it — so the styles split the same way, and the scrim\n// and the element carrying the dialog role are the ones every modal overlay\n// shares.\nconst scaleIn = \"xnirehn-B\";\nconst slideInFromBottom = \"x1itx4s0-B\";\nconst styles = {\n body: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kMv6JI: \"xpo2rfv\",\n kGuDYH: \"x193rfdd\",\n k63SB2: \"x1hews6w\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"xn43zvd\",\n kLWn49: \"xv61bfh\",\n kORKVm: \"x1odjw0f\",\n kGO01o: \"x1az23kl x18d9i69\",\n kLKAdn: \"x886u18 xexx8yu x3reb9c\",\n kg3NbH: \"xg0ps1x\",\n $$css: true\n },\n centre: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1apw6a7 xd76zvj\",\n $$css: true\n }\n};\n\n// The basic dialog at every width, for an alert dialog. Each entry is the\n// above-breakpoint value of every property its namesake in `styles` changes\n// below the breakpoint, laid over that namesake, so a property it leaves out\n// is the same in both presentations already. A value changed above the\n// breakpoint there has to change here too, which `index.test.tsx` checks by\n// comparing an alert dialog on a phone with any dialog on a desktop.\nconst basic = {\n body: {\n kLKAdn: \"x886u18 xexx8yu\",\n $$css: true\n },\n centre: {\n kmVPX3: \"x1apw6a7\",\n $$css: true\n }\n};\n\n// Whether this dialog is the basic one at every width. Content decides it from\n// the role and the parts read it, since each part carries its own share of\n// the full-screen presentation.\nconst BasicContext = createContext(false);\ntype DialogProps = Omit<DialogTriggerProps, 'children'> & {\n children?: ReactNode;\n};\n\n/**\n * A modal dialog centred over the page, and the same dialog filling the\n * window below the medium breakpoint — the dialogs page's basic and\n * full-screen dialogs, paired by window size as the page pairs them. An\n * alert dialog stays the basic one at every width. Open state is React\n * Aria's: pass `isOpen` with `onOpenChange` to control it, or\n * `defaultOpen` to let it keep its own.\n *\n * Composed rather than configured by props, as `Sheet` is, since a dialog's\n * header, body and actions all take arbitrary content — the parts are\n * `Dialog.Content`, `Dialog.Header`, `Dialog.Title`, `Dialog.Body` and\n * `Dialog.Footer`. A `Button` or `IconButton` placed directly inside\n * `Dialog` opens it, and one given `slot=\"close\"` anywhere inside the\n * content closes it; neither needs a part of its own.\n *\n * `Dialog` is the trigger's half, so a dialog nothing on the page opens — one\n * a route shows, or a menu item raises — leaves it out and passes `isOpen`\n * and `onOpenChange` to `Dialog.Content` instead. Wrapped in `Dialog` with no\n * button inside it, React Aria warns that its press responder found nothing\n * to press.\n */\nfunction Dialog({\n children,\n ...props\n}: DialogProps) {\n return <DialogTrigger {...props}>{children}</DialogTrigger>;\n}\nfunction DialogBody({\n ref: callerRef,\n ...props\n}: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n const isBasic = useContext(BasicContext);\n const ref = useRef<HTMLDivElement>(null);\n // A body its content runs past is a tab stop, so a keyboard can scroll it\n // when nothing inside it takes focus; a call site's own tabIndex still\n // wins. See useScrollable.\n const scrollable = useScrollable(ref);\n // The body measures itself through its own ref, and the call site's lands\n // on the same element.\n const merged = useMemo(() => mergeRefs(ref, callerRef ?? undefined), [callerRef]);\n return <div\n // oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- a scroll container with nothing focusable inside is otherwise out of a keyboard's reach, which axe's scrollable-region-focusable reports\n tabIndex={scrollable ? 0 : undefined} {...props} ref={merged} {...mergeStyles(stylex.props(styles.body, isBasic && basic.body, overlay.modalBodyRing), props)} />;\n}\n\n/**\n * The dialog itself, and the scrim behind it. Everything the dialog shows\n * goes in here; the trigger stays outside it, since the trigger lives in the\n * page while this is portalled out to the end of the body.\n *\n * `role=\"alertdialog\"` is React Aria's, for a dialog interrupting with\n * something that has to be answered before the page carries on — a screen\n * reader announces it rather than waiting to be asked. It also keeps the\n * dialog the basic one below the medium breakpoint, centred and sized to its\n * content, where a dialog of the default role fills the window.\n *\n * A press on the scrim closes the dialog unless `isDismissable` says\n * otherwise, which is the same default `Sheet` takes and the reverse of\n * React Aria's own. Escape is a separate prop, `isKeyboardDismissDisabled`,\n * and `isDismissable` says nothing about it — so a dialog that has to be\n * answered from one of its actions, as an alert dialog usually does, turns\n * off both.\n *\n * Inside `Dialog`, the open state is the trigger's. On its own, with no\n * trigger, it is this part's: `isOpen` with `onOpenChange` controls it, and\n * a `slot=\"close\"` button, Escape and the scrim all report through\n * `onOpenChange`, as they would to `Dialog`.\n *\n * The scrim draws at `z-index: 900`, over any page content layered below\n * that, such as a sticky header, and the panel draws inside it. A\n * `Snackbar` draws at 1000, so a toast raised from inside the dialog is read\n * over it, and React Aria's popovers and menus draw above both.\n */\nfunction DialogContent({\n children,\n className,\n container,\n defaultOpen,\n isDismissable = true,\n isKeyboardDismissDisabled,\n isOpen,\n onOpenChange,\n ref,\n style,\n ...props\n}: DialogContentProps & RefAttributes<HTMLDivElement>) {\n const isBasic = props.role === 'alertdialog';\n return <BasicContext value={isBasic}>\n <OverlayScope>\n <ModalOverlay defaultOpen={defaultOpen} isDismissable={isDismissable} isKeyboardDismissDisabled={isKeyboardDismissDisabled} isOpen={isOpen} onOpenChange={onOpenChange}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...stylex.props(overlay.scrim, styles.centre, isBasic && basic.centre)}>\n <Modal\n // The panel, where the call site's class and style land, rather\n // than the dialog inside it, which takes the rest of the props.\n ref={ref} {...mergeStatefulStyles({\n 0: {\n className: \"x1n1nwrg x1u6grsq xbhiib0 x1ebxanj x16dv9tl xvkjz1l xt7dq6l x1ju3lih x1w1tqly x19pkqky x1f120ba xx61lck x1gb867b x13rsnn2 x1udv5rz x9f619 x139gbkf x78zum5 xdt5ytf xh8yej3 xmz0i5r x27kpxv x6iovhr x1u2d2a2 xxzqys8 xb3r6kr x9xqwrn xg8iv3o x19b5e0v xsds98l\"\n },\n 1: {\n className: \"x1n1nwrg x1u6grsq x16dv9tl xvkjz1l x1w1tqly x13rsnn2 x1udv5rz x9f619 x139gbkf x78zum5 xdt5ytf xh8yej3 xmz0i5r xb3r6kr xbhiib0 xt7dq6l x19pkqky xx61lck x27kpxv x1u2d2a2\"\n }\n }[!!isBasic << 0], {\n className,\n style\n })}>\n <RACDialog {...props} {...stylex.props(overlay.modalDialog)}>\n {children}\n </RACDialog>\n </Modal>\n </ModalOverlay>\n </OverlayScope>\n </BasicContext>;\n}\n\n/**\n * The dialog's actions. Full screen they are the action bar on the window's\n * bottom edge, which a toast rises clear of while the dialog is open, so a\n * tap meant for one of them never lands on the toast's own action instead.\n */\nfunction DialogFooter({\n ref: callerRef,\n ...props\n}: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n const isBasic = useContext(BasicContext);\n const ref = useRef<HTMLDivElement>(null);\n useHoldBottomEdge(ref, useFullScreen() && !isBasic);\n // The footer measures itself through its own ref, and the call site's\n // lands on the same element.\n const merged = useMemo(() => mergeRefs(ref, callerRef ?? undefined), [callerRef]);\n return <div {...props} ref={merged} {...mergeStyles({\n 0: {\n className: \"x6s0dn4 x12smttz x1ejq31n x1vv4zg8 x178xt8z x9f619 x78zum5 x2lah0s x1a02dak x126z3so x13a6bvl xnvi70j x8i8c5o x1pr6p50 x13h71tw xs3zajk xg0ps1x\"\n },\n 1: {\n className: \"x6s0dn4 x12smttz x178xt8z x9f619 x78zum5 x2lah0s x1a02dak x126z3so x13a6bvl xg0ps1x x1ejq31n x8i8c5o x13h71tw\"\n }\n }[!!isBasic << 0], props)} />;\n}\nfunction DialogHeader(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n const isBasic = useContext(BasicContext);\n return <div {...props} {...mergeStyles({\n 0: {\n className: \"x6s0dn4 x1j6faob x1sy0etr xf6te7g xso031l x9f619 x78zum5 x2lah0s x1gka490 x1qughib xnvi70j xzfxn0k x1pr6p50 x13h71tw xs3zajk xg0ps1x\"\n },\n 1: {\n className: \"x6s0dn4 x1j6faob xso031l x9f619 x78zum5 x2lah0s x1gka490 x1qughib xg0ps1x x1sy0etr xzfxn0k x13h71tw\"\n }\n }[!!isBasic << 0], props)} />;\n}\n\n/**\n * Names the dialog. Rendered through React Aria's title slot, which is what\n * points the dialog's `aria-labelledby` at it — a dialog without one\n * announces itself unnamed.\n */\nfunction DialogTitle(props: DialogTitleProps & RefAttributes<HTMLHeadingElement>) {\n const isBasic = useContext(BasicContext);\n return <Heading slot=\"title\" {...props} {...mergeStyles({\n 0: {\n className: \"x9f619 x139gbkf x1fz0g89 xl849ld xkb6epg xcji80f x76yrz5 x6ksu6j x1s1qhaa x1khanjg x1voeury xrr2tf9 x1ghz6dp xeuugli xj0a0fe\"\n },\n 1: {\n className: \"x9f619 x139gbkf x1ghz6dp xeuugli xj0a0fe x1fz0g89 xkb6epg x76yrz5 x1s1qhaa x1voeury\"\n }\n }[!!isBasic << 0], props)} />;\n}\n\n// Whether the window is at the size the full-screen dialog is drawn at, kept\n// current as it resizes. False on the server, where there is no window and\n// nothing is open.\nfunction isFullScreen() {\n return window.matchMedia(FULL_SCREEN).matches;\n}\nfunction isFullScreenOnServer() {\n return false;\n}\nfunction subscribeToFullScreen(listener: () => void) {\n const query = window.matchMedia(FULL_SCREEN);\n query.addEventListener('change', listener);\n return () => {\n query.removeEventListener('change', listener);\n };\n}\nfunction useFullScreen() {\n return useSyncExternalStore(subscribeToFullScreen, isFullScreen, isFullScreenOnServer);\n}\nDialog.Body = DialogBody;\nDialog.Content = DialogContent;\nDialog.Footer = DialogFooter;\nDialog.Header = DialogHeader;\nDialog.Title = DialogTitle;\n\n// The dialog's own props, plus the scrim's open state and dismissal settings\n// and the container's styling. A call site has no reason to know there are\n// three elements: `className` and `style` reach the container, which is the\n// one worth restyling, the open state and the dismissal settings reach the\n// scrim, and everything else lands on the dialog.\n//\n// `isDismissable` is declared here rather than picked with its siblings,\n// since the picked one carries React Aria's documentation, whose default is\n// the reverse of this component's.\ntype DialogContentProps = {\n /** A function may compute the class from the container's render state. */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Where to portal the dialog and scrim. Defaults to the container of the\n * `ThemeScope` around it, which keeps the dialog on that scope's tokens, or\n * to the end of `<body>` where there is none. A subtree themed through the\n * `themeScope` class has no container of its own, so point this inside it, or\n * the dialog renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * Whether a press on the scrim, outside the container, closes the\n * dialog. `true` here where React Aria's own default is `false`, the\n * same default `Sheet` takes. Escape is `isKeyboardDismissDisabled`'s,\n * and this says nothing about it — an alert dialog, which has to be\n * answered from one of its actions, turns off both.\n * @default true\n */\n isDismissable?: boolean;\n /** A function may compute the style from the container's render state. */\n style?: StyleOrFunction<ModalRenderProps>;\n} & Omit<RACDialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'defaultOpen' | 'isKeyboardDismissDisabled' | 'isOpen' | 'onOpenChange'>;\ntype DialogTitleProps = HeadingProps;\nexport type { DialogContentProps, DialogProps, DialogTitleProps };\nexport { DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle };\nexport default Dialog;"],"mappings":";;;;;;;;;;;;;AA0BA,MAAMwC,cAAc;AAsCpB,MAAMG,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QAAQ;EACNC,QAAQ;EACRf,QAAQ;EACRgB,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;AACF;AAQA,MAAMK,QAAQ;CACZrB,MAAM;EACJc,QAAQ;EACRE,OAAO;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;;;;AAQ/B,SAAAmC,YAAApC,OAAA;CAAA,MAAAD,IAAArE,EAAA,CAAA;CACE,MAAA2E,UAAgB7D,WAAWmD,YAAY;CAAE,IAAAG;CAAA,IAAAC,EAAA,OAAAM,WAAAN,EAAA,OAAAC,OAAA;EACGF,KAAAvC,YAAY;GAAAkE,GACnD,EAAAV,WACU,+HACb;GAACW,GACE,EAAAX,WACU,sFACb;EACF,EAAE,CAAC,CAACV,WAAW,IAAIL,KAAK;EAACD,EAAA,KAAAM;EAAAN,EAAA,KAAAC;EAAAD,EAAA,KAAAD;CAAA,OAAAA,KAAAC,EAAA;CAAA,IAAAE;CAAA,IAAAF,EAAA,OAAAC,SAAAD,EAAA,OAAAD,IAAA;EAPlBG,KAAA,oBAAC,SAAD;GAAc,MAAA;GAAO,GAAKD;GAAK,GAAMF;EAOnB,CAAA;EAAIC,EAAA,KAAAC;EAAAD,EAAA,KAAAD;EAAAC,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAPtBE;AAOsB;AAM/B,SAASoC,eAAe;CACtB,OAAOC,OAAOC,WAAWtE,WAAW,CAAC,CAACuE;AACxC;AACA,SAASC,uBAAuB;CAC9B,OAAO;AACT;AACA,SAASC,sBAAsBC,UAAsB;CACnD,MAAMC,QAAQN,OAAOC,WAAWtE,WAAW;CAC3C2E,MAAMC,iBAAiB,UAAUF,QAAQ;CACzC,aAAa;EACXC,MAAME,oBAAoB,UAAUH,QAAQ;CAC9C;AACF;AACA,SAAAT,gBAAA;CAAA,OACSvF,qBAAqB+F,uBAAuBL,cAAcI,oBAAoB;AAAC;AAExFzF,SAAO+F,OAAO7C;AACdlD,SAAOgG,UAAUlC;AACjB9D,SAAOiG,SAAShB;AAChBjF,SAAOkG,SAASf;AAChBnF,SAAOmG,QAAQf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","HTMLAttributes","ReactNode","RefAttributes","ClassNameOrFunction","DialogTriggerProps","HeadingProps","ModalOverlayProps","ModalRenderProps","DialogProps","RACDialogProps","StyleOrFunction","stylex","createContext","useContext","useId","useLayoutEffect","useMemo","useRef","useState","useSyncExternalStore","DialogTrigger","Heading","HeadingContext","Modal","ModalOverlay","Dialog","RACDialog","useSlottedContext","useHoldBottomEdge","useScrollStop","OverlayScope","InsideModalContext","mergeRefs","mergeStatefulStyles","mergeStyles","overlay","colors","media","motion","radii","shadows","spacing","typography","FORCED_COLORS","FULL_SCREEN","scaleIn","slideInFromBottom","styles","body","kB7OPa","kMwMTN","k1xSpc","kXwgrk","kzQI83","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","kHjlTd","kORKVm","kGO01o","kLKAdn","kg3NbH","$$css","centre","kGNEyG","kjj79g","kmVPX3","basic","BasicContext","DescriptionContext","id","Omit","children","t0","$","props","t1","DialogBody","ref","callerRef","isBasic","describe","generated","undefined","title","scrollStop","label","t2","merged","t3","modalBodyRing","t4","DialogContent","className","container","defaultOpen","isKeyboardDismissDisabled","isOpen","onOpenChange","style","isDismissable","role","setBody","overModal","scrim","scrimOverModal","0","1","t5","t6","Symbol","for","modalDialog","t7","t8","t9","t10","t11","DialogFooter","useFullScreen","DialogHeader","DialogTitle","isFullScreen","window","matchMedia","matches","isFullScreenOnServer","subscribeToFullScreen","listener","query","addEventListener","removeEventListener","Body","Content","Footer","Header","Title","DialogContentProps","Element","Pick","DialogTitleProps","Dialog","_c","props","stylex.props","RACDialog"],"sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, DialogTriggerProps, HeadingProps, ModalOverlayProps, ModalRenderProps, DialogProps as RACDialogProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { DialogTrigger, Heading, HeadingContext, Modal, ModalOverlay, Dialog as RACDialog, useSlottedContext } from 'react-aria-components';\nimport { useHoldBottomEdge } from '../../hooks/useBottomEdge';\nimport { useScrollStop } from '../../hooks/useScrollStop';\nimport { OverlayScope } from '../../overlay';\nimport { InsideModalContext } from '../../overlay/modal';\nimport { mergeRefs } from '../../render/ref';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, media, motion, radii, shadows, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// The window size the full-screen dialog is drawn at, which the styles read\n// as `media.belowMedium`. Spelled again for `matchMedia`, which is the one\n// thing in this file that has to know it outside a stylesheet: the footer\n// holds the window's bottom edge only there. See `useFullScreen`.\nconst FULL_SCREEN = '(width < 600px)';\n\n// The dialogs page's two dialogs, which are one component here for the same\n// reason Sheet's two presentations are: the page pairs them by window size\n// rather than offering a choice. Above the medium breakpoint it is the basic\n// dialog — a container on surface container high with a 28dp corner, between\n// 280 and 560dp wide, centred over the scrim, with 24dp of padding all round,\n// 16dp between the headline and the body and 24dp between the body and the\n// actions. Below it the same dialog fills the window as the page's\n// full-screen dialog: square corners, a 56dp header with the headline and a\n// divider under it, and a 56dp action bar with a divider over it.\n//\n// The pairing is for a dialog that is a task, which needs the room. An alert\n// dialog is a question with two or three answers, and the page keeps the\n// full-screen dialog for tasks, so `role=\"alertdialog\"` stays the basic dialog\n// at every width. Filled to a phone's window it read as a headline at the top\n// of the screen and its answers at the bottom, with nothing between them but\n// the chrome. The `basic` styles below are how: each restates, without the\n// breakpoint, the properties the paired styles change below it.\n//\n// The headline is headline-small on surface, the body body-medium on surface\n// variant, and the buttons are the call site's — the page draws text buttons\n// there, which is `Button`'s `text` variant.\n//\n// Two things the page draws are the call site's rather than the component's.\n// The optional icon above the headline, which the page centres the headline\n// and body with when it is there, is anything a `Dialog.Header` is given; a\n// dialog that wants it centres its own header. And the dividers a basic\n// dialog may show around a scrolling body are left out, since the page has\n// them only for that case and the body here scrolls with the header and\n// footer pinned either side of it, which is what they were marking.\n//\n// React Aria's overlay is three nested elements — the scrim, the container,\n// and the dialog inside it — so the styles split the same way, and the scrim\n// and the element carrying the dialog role are the ones every modal overlay\n// shares.\nconst scaleIn = \"xnirehn-B\";\nconst slideInFromBottom = \"x1itx4s0-B\";\nconst styles = {\n body: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kMv6JI: \"xpo2rfv\",\n kGuDYH: \"x193rfdd\",\n k63SB2: \"x1hews6w\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"xn43zvd\",\n kLWn49: \"xv61bfh\",\n kHjlTd: \"xj0a0fe\",\n kORKVm: \"x1odjw0f\",\n kGO01o: \"x1az23kl x18d9i69\",\n kLKAdn: \"x886u18 xexx8yu x3reb9c\",\n kg3NbH: \"xg0ps1x\",\n $$css: true\n },\n centre: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1apw6a7 xd76zvj\",\n $$css: true\n }\n};\n\n// The basic dialog at every width, for an alert dialog. Each entry is the\n// above-breakpoint value of every property its namesake in `styles` changes\n// below the breakpoint, laid over that namesake, so a property it leaves out\n// is the same in both presentations already. A value changed above the\n// breakpoint there has to change here too, which `index.test.tsx` checks by\n// comparing an alert dialog on a phone with any dialog on a desktop.\nconst basic = {\n body: {\n kLKAdn: \"x886u18 xexx8yu\",\n $$css: true\n },\n centre: {\n kmVPX3: \"x1apw6a7\",\n $$css: true\n }\n};\n\n// Whether this dialog is the basic one at every width. Content decides it from\n// the role and the parts read it, since each part carries its own share of\n// the full-screen presentation.\nconst BasicContext = createContext(false);\n\n// Where an alert dialog's body hands Content its id, so the dialog can name\n// the body as its description: the message an alert dialog interrupts with\n// is what a screen reader should read out with the title. Null in a dialog\n// of any other role, whose body may hold a form or a long document rather\n// than one message.\nconst DescriptionContext = createContext<((id: string | undefined) => void) | null>(null);\ntype DialogProps = Omit<DialogTriggerProps, 'children'> & {\n children?: ReactNode;\n};\n\n/**\n * A modal dialog centred over the page, and the same dialog filling the\n * window below the medium breakpoint — the dialogs page's basic and\n * full-screen dialogs, paired by window size as the page pairs them. An\n * alert dialog stays the basic one at every width. Open state is React\n * Aria's: pass `isOpen` with `onOpenChange` to control it, or\n * `defaultOpen` to let it keep its own.\n *\n * Composed rather than configured by props, as `Sheet` is, since a dialog's\n * header, body and actions all take arbitrary content — the parts are\n * `Dialog.Content`, `Dialog.Header`, `Dialog.Title`, `Dialog.Body` and\n * `Dialog.Footer`. A `Button` or `IconButton` placed directly inside\n * `Dialog` opens it, and one given `slot=\"close\"` anywhere inside the\n * content closes it; neither needs a part of its own.\n *\n * `Dialog` is the trigger's half, so a dialog nothing on the page opens — one\n * a route shows, or a menu item raises — leaves it out and passes `isOpen`\n * and `onOpenChange` to `Dialog.Content` instead. Wrapped in `Dialog` with no\n * button inside it, React Aria warns that its press responder found nothing\n * to press.\n */\nfunction Dialog({\n children,\n ...props\n}: DialogProps) {\n return <DialogTrigger {...props}>{children}</DialogTrigger>;\n}\nfunction DialogBody({\n ref: callerRef,\n ...props\n}: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n const isBasic = useContext(BasicContext);\n const describe = useContext(DescriptionContext);\n const generated = useId();\n // An alert dialog's body describes the dialog, so it carries an id for the\n // dialog to point at: the call site's own, or one of its own. In a layout\n // effect, so the dialog carries its description from its first paint.\n const id = props.id ?? (describe === null ? undefined : generated);\n useLayoutEffect(() => {\n if (describe === null || id === undefined) {\n return undefined;\n }\n describe(id);\n return () => {\n describe(undefined);\n };\n }, [describe, id]);\n const ref = useRef<HTMLDivElement>(null);\n // A body its content runs past is a tab stop named by the title, so a\n // keyboard can scroll it, when nothing inside it takes focus; a call\n // site's own name, role and tabIndex still win. See useScrollStop.\n const title = useSlottedContext(HeadingContext, 'title');\n const scrollStop = useScrollStop(ref, {\n label: props['aria-label'],\n title: title?.id\n });\n // The body measures itself through its own ref, and the call site's lands\n // on the same element.\n const merged = useMemo(() => mergeRefs(ref, callerRef ?? undefined), [callerRef]);\n return <div {...scrollStop} id={id} {...props} ref={merged} {...mergeStyles(stylex.props(styles.body, isBasic && basic.body, overlay.modalBodyRing), props)} />;\n}\n\n/**\n * The dialog itself, and the scrim behind it. Everything the dialog shows\n * goes in here; the trigger stays outside it, since the trigger lives in the\n * page while this is portalled out to the end of the body.\n *\n * `role=\"alertdialog\"` is React Aria's, for a dialog interrupting with\n * something that has to be answered before the page carries on — a screen\n * reader announces it rather than waiting to be asked. It also keeps the\n * dialog the basic one below the medium breakpoint, centred and sized to its\n * content, where a dialog of the default role fills the window. Its\n * `Dialog.Body` is its description, so the message is read out with the\n * title; an `aria-describedby` of the call site's own names another.\n *\n * A press on the scrim closes the dialog unless `isDismissable` says\n * otherwise, which is the same default `Sheet` takes and the reverse of\n * React Aria's own. Escape is a separate prop, `isKeyboardDismissDisabled`,\n * and `isDismissable` says nothing about it — so a dialog that has to be\n * answered from one of its actions, as an alert dialog usually does, turns\n * off both.\n *\n * Inside `Dialog`, the open state is the trigger's. On its own, with no\n * trigger, it is this part's: `isOpen` with `onOpenChange` controls it, and\n * a `slot=\"close\"` button, Escape and the scrim all report through\n * `onOpenChange`, as they would to `Dialog`.\n *\n * The scrim draws at `z-index: 900`, over any page content layered below\n * that, such as a sticky header, and the panel draws inside it. A\n * `Snackbar` draws at 1000, so a toast raised from inside the dialog is read\n * over it, and React Aria's popovers and menus draw above both.\n */\nfunction DialogContent({\n children,\n className,\n container,\n defaultOpen,\n isDismissable = true,\n isKeyboardDismissDisabled,\n isOpen,\n onOpenChange,\n ref,\n style,\n ...props\n}: DialogContentProps & RefAttributes<HTMLDivElement>) {\n const isBasic = props.role === 'alertdialog';\n // The id of the body, which an alert dialog is described by unless the\n // call site names a description of its own.\n const [body, setBody] = useState<string>();\n const overModal = useContext(InsideModalContext);\n return <BasicContext value={isBasic}>\n <DescriptionContext value={isBasic ? setBody : null}>\n <OverlayScope>\n <ModalOverlay defaultOpen={defaultOpen} isDismissable={isDismissable} isKeyboardDismissDisabled={isKeyboardDismissDisabled} isOpen={isOpen} onOpenChange={onOpenChange}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...stylex.props(overlay.scrim, overModal && overlay.scrimOverModal, styles.centre, isBasic && basic.centre)}>\n <Modal\n // The panel, where the call site's class and style land, rather\n // than the dialog inside it, which takes the rest of the props.\n ref={ref} {...mergeStatefulStyles({\n 0: {\n className: \"x1n1nwrg x1u6grsq xbhiib0 x1ebxanj x16dv9tl xvkjz1l xt7dq6l x1ju3lih x1w1tqly x19pkqky x1f120ba xx61lck x1gb867b x13rsnn2 x1udv5rz x9f619 x139gbkf x78zum5 xdt5ytf xh8yej3 xmz0i5r x27kpxv x6iovhr x1u2d2a2 xxzqys8 xb3r6kr x9xqwrn xg8iv3o x19b5e0v xsds98l\"\n },\n 1: {\n className: \"x1n1nwrg x1u6grsq x16dv9tl xvkjz1l x1w1tqly x13rsnn2 x1udv5rz x9f619 x139gbkf x78zum5 xdt5ytf xh8yej3 xmz0i5r xb3r6kr xbhiib0 xt7dq6l x19pkqky xx61lck x27kpxv x1u2d2a2\"\n }\n }[!!isBasic << 0], {\n className,\n style\n })}>\n <InsideModalContext value>\n <RACDialog {...props} aria-describedby={props['aria-describedby'] ?? (isBasic ? body : undefined)} {...stylex.props(overlay.modalDialog)}>\n {children}\n </RACDialog>\n </InsideModalContext>\n </Modal>\n </ModalOverlay>\n </OverlayScope>\n </DescriptionContext>\n </BasicContext>;\n}\n\n/**\n * The dialog's actions. Full screen they are the action bar on the window's\n * bottom edge, which a toast rises clear of while the dialog is open, so a\n * tap meant for one of them never lands on the toast's own action instead.\n */\nfunction DialogFooter({\n ref: callerRef,\n ...props\n}: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n const isBasic = useContext(BasicContext);\n const ref = useRef<HTMLDivElement>(null);\n useHoldBottomEdge(ref, useFullScreen() && !isBasic);\n // The footer measures itself through its own ref, and the call site's\n // lands on the same element.\n const merged = useMemo(() => mergeRefs(ref, callerRef ?? undefined), [callerRef]);\n return <div {...props} ref={merged} {...mergeStyles({\n 0: {\n className: \"x6s0dn4 x12smttz x1ejq31n x1vv4zg8 x178xt8z x9f619 x78zum5 x2lah0s x1a02dak x126z3so x13a6bvl xnvi70j x8i8c5o x1pr6p50 x13h71tw xs3zajk xg0ps1x\"\n },\n 1: {\n className: \"x6s0dn4 x12smttz x178xt8z x9f619 x78zum5 x2lah0s x1a02dak x126z3so x13a6bvl xg0ps1x x1ejq31n x8i8c5o x13h71tw\"\n }\n }[!!isBasic << 0], props)} />;\n}\nfunction DialogHeader(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n const isBasic = useContext(BasicContext);\n return <div {...props} {...mergeStyles({\n 0: {\n className: \"x6s0dn4 x1j6faob x1sy0etr xf6te7g xso031l x9f619 x78zum5 x2lah0s x1gka490 x1qughib xnvi70j xzfxn0k x1pr6p50 x13h71tw xs3zajk xg0ps1x\"\n },\n 1: {\n className: \"x6s0dn4 x1j6faob xso031l x9f619 x78zum5 x2lah0s x1gka490 x1qughib xg0ps1x x1sy0etr xzfxn0k x13h71tw\"\n }\n }[!!isBasic << 0], props)} />;\n}\n\n/**\n * Names the dialog. Rendered through React Aria's title slot, which is what\n * points the dialog's `aria-labelledby` at it — a dialog without one\n * announces itself unnamed.\n */\nfunction DialogTitle(props: DialogTitleProps & RefAttributes<HTMLHeadingElement>) {\n const isBasic = useContext(BasicContext);\n return <Heading slot=\"title\" {...props} {...mergeStyles({\n 0: {\n className: \"x9f619 x139gbkf x1fz0g89 xl849ld xkb6epg xcji80f x76yrz5 x6ksu6j x1s1qhaa x1khanjg x1voeury xrr2tf9 x1ghz6dp xeuugli xj0a0fe\"\n },\n 1: {\n className: \"x9f619 x139gbkf x1ghz6dp xeuugli xj0a0fe x1fz0g89 xkb6epg x76yrz5 x1s1qhaa x1voeury\"\n }\n }[!!isBasic << 0], props)} />;\n}\n\n// Whether the window is at the size the full-screen dialog is drawn at, kept\n// current as it resizes. False on the server, where there is no window and\n// nothing is open.\nfunction isFullScreen() {\n return window.matchMedia(FULL_SCREEN).matches;\n}\nfunction isFullScreenOnServer() {\n return false;\n}\nfunction subscribeToFullScreen(listener: () => void) {\n const query = window.matchMedia(FULL_SCREEN);\n query.addEventListener('change', listener);\n return () => {\n query.removeEventListener('change', listener);\n };\n}\nfunction useFullScreen() {\n return useSyncExternalStore(subscribeToFullScreen, isFullScreen, isFullScreenOnServer);\n}\nDialog.Body = DialogBody;\nDialog.Content = DialogContent;\nDialog.Footer = DialogFooter;\nDialog.Header = DialogHeader;\nDialog.Title = DialogTitle;\n\n// The dialog's own props, plus the scrim's open state and dismissal settings\n// and the container's styling. A call site has no reason to know there are\n// three elements: `className` and `style` reach the container, which is the\n// one worth restyling, the open state and the dismissal settings reach the\n// scrim, and everything else lands on the dialog.\n//\n// `isDismissable` is declared here rather than picked with its siblings,\n// since the picked one carries React Aria's documentation, whose default is\n// the reverse of this component's.\ntype DialogContentProps = {\n /** A function may compute the class from the container's render state. */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Where to portal the dialog and scrim. Defaults to the container of the\n * `ThemeScope` around it, which keeps the dialog on that scope's tokens, or\n * to the end of `<body>` where there is none. A subtree themed through the\n * `themeScope` class has no container of its own, so point this inside it, or\n * the dialog renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * Whether a press on the scrim, outside the container, closes the\n * dialog. `true` here where React Aria's own default is `false`, the\n * same default `Sheet` takes. Escape is `isKeyboardDismissDisabled`'s,\n * and this says nothing about it — an alert dialog, which has to be\n * answered from one of its actions, turns off both.\n * @default true\n */\n isDismissable?: boolean;\n /** A function may compute the style from the container's render state. */\n style?: StyleOrFunction<ModalRenderProps>;\n} & Omit<RACDialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'defaultOpen' | 'isKeyboardDismissDisabled' | 'isOpen' | 'onOpenChange'>;\ntype DialogTitleProps = HeadingProps;\nexport type { DialogContentProps, DialogProps, DialogTitleProps };\nexport { DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle };\nexport default Dialog;"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAM8C,cAAc;AAsCpB,MAAMG,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QAAQ;EACNC,QAAQ;EACRhB,QAAQ;EACRiB,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;AACF;AAQA,MAAMK,QAAQ;CACZtB,MAAM;EACJe,QAAQ;EACRE,OAAO;CACT;CACAC,QAAQ;EACNG,QAAQ;EACRJ,OAAO;CACT;AACF;AAKA,MAAMM,eAAe3D,cAAc,KAAK;AAOxC,MAAM4D,qBAAqB5D,cAAyD,IAAI;;;;;;;;;;;;;;;;;;;;;;AA0BxF,SAAAa,SAAAmD,IAAA;CAAA,MAAAC,IAAA9E,EAAA,CAAA;CAAA,IAAA4E;CAAA,IAAAG;CAAA,IAAAD,EAAA,OAAAD,IAAA;EAAgB,CAAA,CAAAD,UAAA,GAAAG,SAAAF;EAGFC,EAAA,KAAAD;EAAAC,EAAA,KAAAF;EAAAE,EAAA,KAAAC;CAAA,OAAA;EAAAH,WAAAE,E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C,EAAA,KAAAC;EAAAD,EAAA,KAAAD;EAAAC,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAPtBE;AAOsB;AAM/B,SAAS8C,eAAe;CACtB,OAAOC,OAAOC,WAAWnF,WAAW,CAAC,CAACoF;AACxC;AACA,SAASC,uBAAuB;CAC9B,OAAO;AACT;AACA,SAASC,sBAAsBC,UAAsB;CACnD,MAAMC,QAAQN,OAAOC,WAAWnF,WAAW;CAC3CwF,MAAMC,iBAAiB,UAAUF,QAAQ;CACzC,aAAa;EACXC,MAAME,oBAAoB,UAAUH,QAAQ;CAC9C;AACF;AACA,SAAAT,gBAAA;CAAA,OACSvG,qBAAqB+G,uBAAuBL,cAAcI,oBAAoB;AAAC;AAExFxG,SAAO8G,OAAOvD;AACdvD,SAAO+G,UAAUzC;AACjBtE,SAAOgH,SAAShB;AAChBhG,SAAOiH,SAASf;AAChBlG,SAAOkH,QAAQf"}
|
|
@@ -76,7 +76,7 @@ function DisclosureGroup$1(t0) {
|
|
|
76
76
|
return t4;
|
|
77
77
|
}
|
|
78
78
|
function dividedChildren(children) {
|
|
79
|
-
return flatten(children).map((section, index) => /* @__PURE__ */ jsxs(Fragment, { children: [index === 0 ? null : /* @__PURE__ */ jsx(Separator$1, {}), section] }, keyOf(section, index)));
|
|
79
|
+
return flatten(children).map((section, index) => /* @__PURE__ */ jsxs(Fragment, { children: [index === 0 ? null : /* @__PURE__ */ jsx(Separator$1, { decorative: true }), section] }, keyOf(section, index)));
|
|
80
80
|
}
|
|
81
81
|
function flatten(children) {
|
|
82
82
|
return Children.toArray(children).flatMap((child) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","DisclosureGroupProps","RACDisclosureGroupProps","stylex","Children","Fragment","isValidElement","DisclosureGroup","RACDisclosureGroup","mergeStatefulStyles","Separator","Omit","children","divided","t0","$","T0","t1","t2","t3","t4","props","undefined","className","dividedChildren","sections","flatten","map","section","index","keyOf","toArray","flatMap","child","type","key","String","DisclosureGroup","_c","RACDisclosureGroup","Separator"],"sources":["../../../src/components/disclosure-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { DisclosureGroupProps as RACDisclosureGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Children, Fragment, isValidElement } from 'react';\nimport { DisclosureGroup as RACDisclosureGroup } from 'react-aria-components';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport Separator from '../separator';\n\n// A stack of Disclosures that agree with each other about what is open —\n// the lists page's accordion. The sections are the library's own\n// `Disclosure`, unchanged: this adds only the agreement between them and the\n// rule that divides them.\n//\n// Give each section an `id`, which is the key the group reports as expanded.\n// Whether one opens at a time or several is `allowsMultipleExpanded`, and it\n// is React Aria's rather than two components — a group that closes the last\n// section when a new one opens is the same stack with a different word.\n//\n// Two things are this component's own.\n//\n// **A rule between the sections, and none at the ends.** The group renders\n// the library's `Separator` between each pair rather than asking each\n// section to draw a border, so a section drawn on its own and a section in a\n// group stay the same component. `divided={false}` leaves them undivided,\n// for a stack sitting on cards of its own.\n//\n// **Nothing else is added.** The group draws no container, no corner and no\n// colour: an accordion inside a card and one running down a page want\n// different surroundings, and the page is what knows which it is.\n//\n// The lists page keeps its expand-interaction tokens behind a token-set menu\n// that does not open to a script, so what is drawn here is what the page\n// states in words plus what `Disclosure` already carries; see that\n// component's comment for the same note.\n\ntype DisclosureGroupProps = Omit<RACDisclosureGroupProps, 'children'> & {\n /** The sections, as `Disclosure` elements each given an `id`. */\n children?: ReactNode;\n /**\n * Whether a rule is drawn between the sections. There is never one above\n * the first or below the last.\n * @default true\n */\n divided?: boolean;\n};\n\n/**\n * A stack of `Disclosure` sections that agree about what is open. Which are\n * expanded is React Aria's: pass `expandedKeys` with `onExpandedChange` to\n * control it, or `defaultExpandedKeys` to let the group keep its own.\n *\n * ```tsx\n * <DisclosureGroup defaultExpandedKeys={FIRST}>\n * <Disclosure id=\"first\">\n * <Disclosure.Header>Headline</Disclosure.Header>\n * <Disclosure.Panel>Supporting line</Disclosure.Panel>\n * </Disclosure>\n * </DisclosureGroup>\n * ```\n *\n * One section opens at a time unless `allowsMultipleExpanded` says otherwise.\n * Give every section an `id` — that is the key the group reports.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction DisclosureGroup({\n children,\n divided = true,\n ...props\n}: DisclosureGroupProps & RefAttributes<HTMLDivElement>) {\n return <RACDisclosureGroup {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 xdt5ytf\"\n }, props)}>\n {divided ? dividedChildren(children) : children}\n </RACDisclosureGroup>;\n}\n\n// The sections with a rule between each pair, and none at the ends.\nfunction dividedChildren(children: ReactNode) {\n const sections = flatten(children);\n return sections.map((section, index) => <Fragment key={keyOf(section, index)}>\n {index === 0 ? null : <Separator />}\n {section}\n </Fragment>);\n}\n\n// The sections, with any fragment around them opened up first.\n// `Children.toArray` flattens arrays but hands back a fragment as one child,\n// and a call site that writes its sections inside one — or maps over data and\n// wraps the result — would otherwise get a single entry and no rules at all.\n// Recursive, since a fragment may hold another.\nfunction flatten(children: ReactNode): ReactNode[] {\n return Children.toArray(children).flatMap(child => {\n if (isValidElement<{\n children?: ReactNode;\n }>(child)) {\n if (child.type === Fragment) {\n return flatten(child.props.children);\n }\n }\n return [child];\n });\n}\n\n// The key `Children.toArray` put on the entry, falling back to its position\n// for anything that is not an element — a string between two sections is not\n// a thing this component expects, but it should render rather than throw.\nfunction keyOf(section: ReactNode, index: number) {\n if (isValidElement(section)) {\n return section.key ?? String(index);\n }\n return String(index);\n}\nexport type { DisclosureGroupProps };\nexport default DisclosureGroup;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,SAAAU,kBAAAO,IAAA;CAAA,MAAAC,IAAAjB,EAAA,EAAA;CAAA,IAAAkB;CAAA,IAAAJ;CAAA,IAAAC;CAAA,IAAAI;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAyB,MAAA,EAAAF,UAAAO,IAAAN,SAAAO,IAAA,GAAAC,UAAAP;EAAAF,WAAAO;EAEvBN,UAAAO,OAAAE,KAAAA,IAAA,OAAAF;EAGQJ,KAAAR;EAAuBa,KAAAA;EAAWH,KAAAT,oBAAoB,EAAAc,WACjD,yBACb,GAAGF,KAAK;EAACN,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAH;EAAAG,EAAA,KAAAF;EAAAE,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAF,KAAAD,EAAA;EAAAH,WAAAG,EAAA;EAAAF,UAAAE,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAAA,IAAAI;CAAA,IAAAJ,EAAA,OAAAH,YAAAG,EAAA,OAAAF,SAAA;EACJM,KAAAN,UAAUW,gBAAgBZ,QAAmB,IAA7CA;EAA8CG,EAAA,KAAAH;EAAAG,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAC,MAAAD,EAAA,QAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,IAAA;EAH5CC,KAAA,oBAAC,IAAD;GAAmB,GAAKC;GAAK,GAAMH;GAGrCC,UAAAA;EAHqB,CAAA;EAIHJ,EAAA,KAAAC;EAAAD,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAJhBK;AAIgB;
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","DisclosureGroupProps","RACDisclosureGroupProps","stylex","Children","Fragment","isValidElement","DisclosureGroup","RACDisclosureGroup","mergeStatefulStyles","Separator","Omit","children","divided","t0","$","T0","t1","t2","t3","t4","props","undefined","className","dividedChildren","sections","flatten","map","section","index","keyOf","toArray","flatMap","child","type","key","String","DisclosureGroup","_c","RACDisclosureGroup","Separator"],"sources":["../../../src/components/disclosure-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { DisclosureGroupProps as RACDisclosureGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Children, Fragment, isValidElement } from 'react';\nimport { DisclosureGroup as RACDisclosureGroup } from 'react-aria-components';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport Separator from '../separator';\n\n// A stack of Disclosures that agree with each other about what is open —\n// the lists page's accordion. The sections are the library's own\n// `Disclosure`, unchanged: this adds only the agreement between them and the\n// rule that divides them.\n//\n// Give each section an `id`, which is the key the group reports as expanded.\n// Whether one opens at a time or several is `allowsMultipleExpanded`, and it\n// is React Aria's rather than two components — a group that closes the last\n// section when a new one opens is the same stack with a different word.\n//\n// Two things are this component's own.\n//\n// **A rule between the sections, and none at the ends.** The group renders\n// the library's `Separator` between each pair rather than asking each\n// section to draw a border, so a section drawn on its own and a section in a\n// group stay the same component. `divided={false}` leaves them undivided,\n// for a stack sitting on cards of its own.\n//\n// **Nothing else is added.** The group draws no container, no corner and no\n// colour: an accordion inside a card and one running down a page want\n// different surroundings, and the page is what knows which it is.\n//\n// The lists page keeps its expand-interaction tokens behind a token-set menu\n// that does not open to a script, so what is drawn here is what the page\n// states in words plus what `Disclosure` already carries; see that\n// component's comment for the same note.\n\ntype DisclosureGroupProps = Omit<RACDisclosureGroupProps, 'children'> & {\n /** The sections, as `Disclosure` elements each given an `id`. */\n children?: ReactNode;\n /**\n * Whether a rule is drawn between the sections. There is never one above\n * the first or below the last.\n * @default true\n */\n divided?: boolean;\n};\n\n/**\n * A stack of `Disclosure` sections that agree about what is open. Which are\n * expanded is React Aria's: pass `expandedKeys` with `onExpandedChange` to\n * control it, or `defaultExpandedKeys` to let the group keep its own.\n *\n * ```tsx\n * <DisclosureGroup defaultExpandedKeys={FIRST}>\n * <Disclosure id=\"first\">\n * <Disclosure.Header>Headline</Disclosure.Header>\n * <Disclosure.Panel>Supporting line</Disclosure.Panel>\n * </Disclosure>\n * </DisclosureGroup>\n * ```\n *\n * One section opens at a time unless `allowsMultipleExpanded` says otherwise.\n * Give every section an `id` — that is the key the group reports.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction DisclosureGroup({\n children,\n divided = true,\n ...props\n}: DisclosureGroupProps & RefAttributes<HTMLDivElement>) {\n return <RACDisclosureGroup {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 xdt5ytf\"\n }, props)}>\n {divided ? dividedChildren(children) : children}\n </RACDisclosureGroup>;\n}\n\n// The sections with a rule between each pair, and none at the ends. The\n// rules are decorative: each section opens on a heading holding its button,\n// which already tells a reader where it starts, so a \"separator\" announced\n// between every pair would only repeat it.\nfunction dividedChildren(children: ReactNode) {\n const sections = flatten(children);\n return sections.map((section, index) => <Fragment key={keyOf(section, index)}>\n {index === 0 ? null : <Separator decorative />}\n {section}\n </Fragment>);\n}\n\n// The sections, with any fragment around them opened up first.\n// `Children.toArray` flattens arrays but hands back a fragment as one child,\n// and a call site that writes its sections inside one — or maps over data and\n// wraps the result — would otherwise get a single entry and no rules at all.\n// Recursive, since a fragment may hold another.\nfunction flatten(children: ReactNode): ReactNode[] {\n return Children.toArray(children).flatMap(child => {\n if (isValidElement<{\n children?: ReactNode;\n }>(child)) {\n if (child.type === Fragment) {\n return flatten(child.props.children);\n }\n }\n return [child];\n });\n}\n\n// The key `Children.toArray` put on the entry, falling back to its position\n// for anything that is not an element — a string between two sections is not\n// a thing this component expects, but it should render rather than throw.\nfunction keyOf(section: ReactNode, index: number) {\n if (isValidElement(section)) {\n return section.key ?? String(index);\n }\n return String(index);\n}\nexport type { DisclosureGroupProps };\nexport default DisclosureGroup;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,SAAAU,kBAAAO,IAAA;CAAA,MAAAC,IAAA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CACnCA,UAAU,IAAI,OAAO,oBAACW,aAAD,EAAW,YAAA,KAAU,CAAA,GAC1CZ,OACO,EAAA,GAH2CE,MAAMF,SAASC,KAAK,CAG/D,CAAC;AACf;AAOA,SAASH,QAAQd,UAAkC;CACjD,OAAOR,SAAS2B,QAAQnB,QAAQ,CAAC,CAACoB,SAAQC,UAAS;EACjD,IAAI3B,eAED2B,KAAK,GACFA;OAAAA,MAAMC,SAAS7B,UACjB,OAAOqB,QAAQO,MAAMZ,MAAMT,QAAQ;EAAA;EAGvC,OAAO,CAACqB,KAAK;CACf,CAAC;AACH;AAKA,SAASH,MAAMF,SAAoBC,OAAe;CAChD,IAAIvB,eAAesB,OAAO,GACxB,OAAOA,QAAQO,OAAOC,OAAOP,KAAK;CAEpC,OAAOO,OAAOP,KAAK;AACrB"}
|
|
@@ -90,6 +90,10 @@ const styles = {
|
|
|
90
90
|
kMwMTN: "x1girmi0 x1k5gbb1",
|
|
91
91
|
$$css: true
|
|
92
92
|
},
|
|
93
|
+
outlinedToggleSelectedDisabled: {
|
|
94
|
+
kWkggS: "xepofeg",
|
|
95
|
+
$$css: true
|
|
96
|
+
},
|
|
93
97
|
pending: {
|
|
94
98
|
kkrTdU: "x19v85br",
|
|
95
99
|
$$css: true
|
|
@@ -111,6 +115,13 @@ const styles = {
|
|
|
111
115
|
kMwMTN: "x1mxwv8y x1k5gbb1",
|
|
112
116
|
$$css: true
|
|
113
117
|
},
|
|
118
|
+
standardToggleSelectedDisabled: {
|
|
119
|
+
kWkggS: "x19v6zzp",
|
|
120
|
+
kVAM5u: "xmnqt3w",
|
|
121
|
+
ksu8eU: "xx61lck",
|
|
122
|
+
kMzoRj: "xc342km x13rsnn2",
|
|
123
|
+
$$css: true
|
|
124
|
+
},
|
|
114
125
|
tonal: {
|
|
115
126
|
kWkggS: "x15dekr4",
|
|
116
127
|
kMwMTN: "x1sawysd",
|
|
@@ -383,6 +394,12 @@ const disabledStyles = {
|
|
|
383
394
|
standard: styles.standardDisabled,
|
|
384
395
|
tonal: styles.tonalDisabled
|
|
385
396
|
};
|
|
397
|
+
const selectedDisabledStyles = {
|
|
398
|
+
filled: null,
|
|
399
|
+
outlined: styles.outlinedToggleSelectedDisabled,
|
|
400
|
+
standard: styles.standardToggleSelectedDisabled,
|
|
401
|
+
tonal: null
|
|
402
|
+
};
|
|
386
403
|
function groupStyles(group, size, state) {
|
|
387
404
|
if (group === null) return null;
|
|
388
405
|
return [group.styles?.(state), group.shift !== 0 && shifted.width(`calc(${EDGES[size]} + ${group.shift}px)`)];
|
|
@@ -490,7 +507,7 @@ function iconButtonClasses(size, variant, group) {
|
|
|
490
507
|
function toggleStyleProps(size, variant, group) {
|
|
491
508
|
return (state) => {
|
|
492
509
|
const container = toggleContainers[variant][state.isSelected === true ? "selected" : "unselected"];
|
|
493
|
-
return props(styles.base, focus.ring, state.isSelected === true ? toggleStyles[variant].selected : toggleStyles[variant].unselected, styles[size], roundShapes[size], variant === "outlined" && state.isSelected !== true && outlineWidths[size], state.isHovered && hovered[container], state.isFocusVisible && focused[container], state.isPressed && pressed[container], state.isPressed && selectedShapes[size], state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && roundShapes[size], state.isDisabled && disabledStyles[variant], state.isSelected === true && selectedShapes[size], groupStyles(group, size, state));
|
|
510
|
+
return props(styles.base, focus.ring, state.isSelected === true ? toggleStyles[variant].selected : toggleStyles[variant].unselected, styles[size], roundShapes[size], variant === "outlined" && state.isSelected !== true && outlineWidths[size], state.isHovered && hovered[container], state.isFocusVisible && focused[container], state.isPressed && pressed[container], state.isPressed && selectedShapes[size], state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && roundShapes[size], state.isDisabled && disabledStyles[variant], state.isDisabled && state.isSelected === true && selectedDisabledStyles[variant], state.isSelected === true && selectedShapes[size], groupStyles(group, size, state));
|
|
494
511
|
};
|
|
495
512
|
}
|
|
496
513
|
//#endregion
|