@kanso-labs/kanso-ui 0.45.34 → 0.47.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/dist/button/index.js +13 -9
- package/dist/button/index.js.map +1 -1
- package/dist/calendar/styles.js +12 -7
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/label.js +1 -0
- package/dist/chip/label.js.map +1 -1
- package/dist/chip/styles.js +2 -0
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/styles.js +1 -1
- package/dist/collection/styles.js.map +1 -1
- package/dist/components/breadcrumbs/index.js +4 -1
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +16 -3
- package/dist/components/button-group/index.js +53 -86
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +3 -3
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.js +5 -1
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/carousel/index.js +162 -105
- package/dist/components/carousel/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +38 -15
- package/dist/components/chip/index.js +104 -8
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/code/index.js +32 -26
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +5 -3
- package/dist/components/color-area/index.js +5 -3
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-picker/index.js +6 -3
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-swatch/index.js +1 -1
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.js +24 -9
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +11 -3
- package/dist/components/combo-box/index.js +66 -62
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/copy-field/index.js +1 -0
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +22 -3
- package/dist/components/date-picker/index.js +234 -45
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +3 -1
- package/dist/components/date-range-picker/index.js +6 -4
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +4 -3
- package/dist/components/disclosure/index.js +159 -101
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +3 -1
- package/dist/components/fab/index.js +25 -12
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/fab-menu/index.js +1 -1
- package/dist/components/fab-menu/index.js.map +1 -1
- package/dist/components/icon-button/index.js +3 -3
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/link/index.js +2 -2
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/menu/index.js +5 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-bar/index.js.map +1 -1
- package/dist/components/navigation-rail/index.js +4 -4
- package/dist/components/navigation-rail/index.js.map +1 -1
- package/dist/components/navigation-tree/index.js +16 -13
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/popover/index.js +35 -33
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/progress-indicator/index.js +258 -172
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/range-calendar/index.js +41 -7
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-view/index.js +1 -1
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +3 -2
- package/dist/components/segmented-button/index.js +46 -95
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.js +5 -2
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/slider/index.js +42 -10
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/table/index.d.ts +26 -5
- package/dist/components/table/index.js +93 -75
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tag/index.js +1 -0
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/time-picker/index.js +37 -5
- package/dist/components/time-picker/index.js.map +1 -1
- package/dist/components/token-field/index.js +89 -66
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +8 -3
- package/dist/components/toolbar/index.js +123 -43
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tree/index.js +1 -1
- package/dist/components/tree/index.js.map +1 -1
- package/dist/fab/styles.js +12 -0
- package/dist/fab/styles.js.map +1 -1
- package/dist/field/styles.js +2 -2
- package/dist/field/styles.js.map +1 -1
- package/dist/hooks/useDockedMonths.js +36 -0
- package/dist/hooks/useDockedMonths.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 +3 -3
- package/dist/navigation/index.js +5 -5
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/styles.js +5 -1
- package/dist/navigation/styles.js.map +1 -1
- package/dist/row/context.js +6 -0
- package/dist/row/context.js.map +1 -0
- package/dist/row/index.js +77 -66
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +15 -0
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/index.js +2 -5
- package/dist/segments/index.js.map +1 -1
- package/dist/segments/literal.js +66 -0
- package/dist/segments/literal.js.map +1 -0
- package/dist/segments/styles.js +8 -0
- package/dist/segments/styles.js.map +1 -1
- package/dist/styles/chequer.js +1 -0
- package/dist/styles/chequer.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles.css +509 -69
- package/dist/toggle-group/index.js +133 -0
- package/dist/toggle-group/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -19,9 +19,10 @@ type ToolbarProps = Omit<ToolbarProps$1, 'children' | 'className' | 'style'> & {
|
|
|
19
19
|
type ToolbarTone = 'neutral' | 'vibrant';
|
|
20
20
|
/**
|
|
21
21
|
* A container for a set of controls, announced as a toolbar so a screen
|
|
22
|
-
* reader reads them as one group, with the arrow keys moving between them
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* reader reads them as one group, with the arrow keys moving between them
|
|
23
|
+
* and Home and End moving to the first and the last enabled control. The
|
|
24
|
+
* bar is one Tab stop: Tab and Shift+Tab leave it from whichever control has
|
|
25
|
+
* focus, and coming back returns to that control.
|
|
25
26
|
*
|
|
26
27
|
* ```tsx
|
|
27
28
|
* <Toolbar aria-label="Label">
|
|
@@ -45,6 +46,10 @@ type ToolbarTone = 'neutral' | 'vibrant';
|
|
|
45
46
|
*
|
|
46
47
|
* The call site's `className` and `style` land on the container, which is
|
|
47
48
|
* the element a layout positions.
|
|
49
|
+
*
|
|
50
|
+
* Every control keeps its own width. A bar given less room than its controls
|
|
51
|
+
* need — a phone's width, say — stays inside it and scrolls along its length
|
|
52
|
+
* rather than squeezing a control or overflowing the page.
|
|
48
53
|
*/
|
|
49
54
|
declare function Toolbar({ orientation, tone, ...props }: RefAttributes<HTMLDivElement> & ToolbarProps): import("react").JSX.Element;
|
|
50
55
|
export { type ToolbarProps, type ToolbarTone, Toolbar as default };
|
|
@@ -2,24 +2,29 @@
|
|
|
2
2
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
3
3
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import "react";
|
|
5
|
+
import { createElement } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { SeparatorContext, Toolbar as Toolbar$1 } from "react-aria-components";
|
|
8
8
|
// src/components/toolbar/index.tsx
|
|
9
9
|
const styles = {
|
|
10
10
|
base: {
|
|
11
|
-
|
|
11
|
+
kOuLrU: "xfk6m8",
|
|
12
12
|
kaIpWk: "x1dkaolv",
|
|
13
13
|
kB7OPa: "x9f619",
|
|
14
14
|
kMwMTN: "x1w5n3ug",
|
|
15
|
-
k1xSpc: "
|
|
15
|
+
k1xSpc: "xwz0xwf",
|
|
16
16
|
kOIVth: "x126z3so",
|
|
17
|
-
|
|
17
|
+
ks0D6T: "x193iq5w",
|
|
18
18
|
k3XXqK: "x1t137rt",
|
|
19
|
+
kVQacm: "xysyzu8",
|
|
20
|
+
k5wCbM: "x1rohswg",
|
|
19
21
|
$$css: true
|
|
20
22
|
},
|
|
21
23
|
horizontal: {
|
|
22
|
-
|
|
24
|
+
kGNEyG: "x6s0dn4",
|
|
25
|
+
klIVar: "x1mt6kc2",
|
|
26
|
+
kprqdN: "x1mt1orb",
|
|
27
|
+
kjj79g: "xej7fhh",
|
|
23
28
|
kAzted: "x8nclml",
|
|
24
29
|
k8WAf4: "x1cmllll",
|
|
25
30
|
kg3NbH: "x790zyz",
|
|
@@ -30,23 +35,73 @@ const styles = {
|
|
|
30
35
|
$$css: true
|
|
31
36
|
},
|
|
32
37
|
vertical: {
|
|
33
|
-
|
|
38
|
+
kfiyM8: "x1l10kik",
|
|
39
|
+
kprqdN: "x1sdr0u7",
|
|
40
|
+
kAPf3g: "x1o2pa38",
|
|
34
41
|
k7Eaqz: "x4m7ku4",
|
|
35
42
|
k8WAf4: "xp6hjv6",
|
|
36
43
|
kg3NbH: "xn60lsn",
|
|
37
44
|
$$css: true
|
|
38
45
|
},
|
|
39
46
|
vibrant: {
|
|
47
|
+
"--icon-button-standard-color": "x78l5pw",
|
|
40
48
|
kWkggS: "xp89om9",
|
|
41
49
|
kMwMTN: "xscdzaa",
|
|
42
50
|
$$css: true
|
|
43
51
|
}
|
|
44
52
|
};
|
|
53
|
+
const FOCUSABLE = [
|
|
54
|
+
"a[href]",
|
|
55
|
+
"area[href]",
|
|
56
|
+
"button",
|
|
57
|
+
"iframe",
|
|
58
|
+
"input:not([type=\"hidden\"])",
|
|
59
|
+
"select",
|
|
60
|
+
"summary",
|
|
61
|
+
"textarea",
|
|
62
|
+
"[contenteditable]:not([contenteditable=\"false\"])",
|
|
63
|
+
"[tabindex]"
|
|
64
|
+
].join(",");
|
|
65
|
+
const PRESSABLE_INPUTS = /* @__PURE__ */ new Set([
|
|
66
|
+
"button",
|
|
67
|
+
"checkbox",
|
|
68
|
+
"image",
|
|
69
|
+
"radio",
|
|
70
|
+
"reset",
|
|
71
|
+
"submit"
|
|
72
|
+
]);
|
|
73
|
+
/**
|
|
74
|
+
* The bar's controls a Tab could land on, in document order: a disabled
|
|
75
|
+
* one, one taken out of the Tab order, and one inert or not drawn are left
|
|
76
|
+
* out, so Home and End never reach a control that cannot take focus.
|
|
77
|
+
*/
|
|
78
|
+
function controlsIn(bar) {
|
|
79
|
+
return [...bar.querySelectorAll(FOCUSABLE)].filter((control) => control.tabIndex >= 0 && !control.matches(":disabled") && control.closest("[inert]") === null && control.checkVisibility());
|
|
80
|
+
}
|
|
81
|
+
function homeAndEnd(event) {
|
|
82
|
+
const bar = event.currentTarget;
|
|
83
|
+
const { target } = event;
|
|
84
|
+
if (event.key !== "Home" && event.key !== "End" || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || event.defaultPrevented || !(target instanceof HTMLElement) || !bar.contains(target) || ownsHomeAndEnd(target)) return;
|
|
85
|
+
const controls = controlsIn(bar);
|
|
86
|
+
const control = event.key === "Home" ? controls.at(0) : controls.at(-1);
|
|
87
|
+
if (control === void 0) return;
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
control.focus();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Whether `target` is a control with its own use for Home and End: a field,
|
|
93
|
+
* whose caret they move, a native select or range, or editable text.
|
|
94
|
+
*/
|
|
95
|
+
function ownsHomeAndEnd(target) {
|
|
96
|
+
if (target instanceof HTMLInputElement) return !PRESSABLE_INPUTS.has(target.type);
|
|
97
|
+
return target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement || target.isContentEditable;
|
|
98
|
+
}
|
|
45
99
|
/**
|
|
46
100
|
* A container for a set of controls, announced as a toolbar so a screen
|
|
47
|
-
* reader reads them as one group, with the arrow keys moving between them
|
|
48
|
-
*
|
|
49
|
-
*
|
|
101
|
+
* reader reads them as one group, with the arrow keys moving between them
|
|
102
|
+
* and Home and End moving to the first and the last enabled control. The
|
|
103
|
+
* bar is one Tab stop: Tab and Shift+Tab leave it from whichever control has
|
|
104
|
+
* focus, and coming back returns to that control.
|
|
50
105
|
*
|
|
51
106
|
* ```tsx
|
|
52
107
|
* <Toolbar aria-label="Label">
|
|
@@ -70,33 +125,39 @@ const styles = {
|
|
|
70
125
|
*
|
|
71
126
|
* The call site's `className` and `style` land on the container, which is
|
|
72
127
|
* the element a layout positions.
|
|
128
|
+
*
|
|
129
|
+
* Every control keeps its own width. A bar given less room than its controls
|
|
130
|
+
* need — a phone's width, say — stays inside it and scrolls along its length
|
|
131
|
+
* rather than squeezing a control or overflowing the page.
|
|
73
132
|
*/
|
|
74
133
|
function Toolbar(t0) {
|
|
75
|
-
const $ = c(
|
|
134
|
+
const $ = c(20);
|
|
76
135
|
let T0;
|
|
77
136
|
let T1;
|
|
78
137
|
let t1;
|
|
79
138
|
let t2;
|
|
80
139
|
let t3;
|
|
81
140
|
let t4;
|
|
141
|
+
let t5;
|
|
82
142
|
if ($[0] !== t0) {
|
|
83
|
-
const { orientation:
|
|
84
|
-
const orientation =
|
|
85
|
-
const tone =
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
if ($[
|
|
89
|
-
|
|
90
|
-
$[7] = t7;
|
|
143
|
+
const { orientation: t6, tone: t7, ...props$1 } = t0;
|
|
144
|
+
const orientation = t6 === void 0 ? "horizontal" : t6;
|
|
145
|
+
const tone = t7 === void 0 ? "neutral" : t7;
|
|
146
|
+
const t8 = orientation === "horizontal" ? "vertical" : "horizontal";
|
|
147
|
+
let t9;
|
|
148
|
+
if ($[8] !== t8) {
|
|
149
|
+
t9 = { orientation: t8 };
|
|
91
150
|
$[8] = t8;
|
|
92
|
-
|
|
93
|
-
|
|
151
|
+
$[9] = t9;
|
|
152
|
+
} else t9 = $[9];
|
|
153
|
+
const separator = t9;
|
|
94
154
|
T1 = SeparatorContext;
|
|
95
|
-
|
|
155
|
+
t5 = separator;
|
|
96
156
|
T0 = Toolbar$1;
|
|
97
157
|
t1 = orientation;
|
|
98
158
|
t2 = props$1;
|
|
99
|
-
t3 =
|
|
159
|
+
t3 = toolbarRenderer(props$1.render);
|
|
160
|
+
t4 = mergeStatefulStyles(props(styles.base, styles[orientation], styles[tone]), props$1);
|
|
100
161
|
$[0] = t0;
|
|
101
162
|
$[1] = T0;
|
|
102
163
|
$[2] = T1;
|
|
@@ -104,6 +165,7 @@ function Toolbar(t0) {
|
|
|
104
165
|
$[4] = t2;
|
|
105
166
|
$[5] = t3;
|
|
106
167
|
$[6] = t4;
|
|
168
|
+
$[7] = t5;
|
|
107
169
|
} else {
|
|
108
170
|
T0 = $[1];
|
|
109
171
|
T1 = $[2];
|
|
@@ -111,32 +173,50 @@ function Toolbar(t0) {
|
|
|
111
173
|
t2 = $[4];
|
|
112
174
|
t3 = $[5];
|
|
113
175
|
t4 = $[6];
|
|
176
|
+
t5 = $[7];
|
|
114
177
|
}
|
|
115
|
-
let
|
|
116
|
-
if ($[
|
|
117
|
-
|
|
178
|
+
let t6;
|
|
179
|
+
if ($[10] !== T0 || $[11] !== t1 || $[12] !== t2 || $[13] !== t3 || $[14] !== t4) {
|
|
180
|
+
t6 = /* @__PURE__ */ jsx(T0, {
|
|
118
181
|
orientation: t1,
|
|
119
182
|
...t2,
|
|
120
|
-
|
|
183
|
+
render: t3,
|
|
184
|
+
...t4
|
|
121
185
|
});
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
186
|
+
$[10] = T0;
|
|
187
|
+
$[11] = t1;
|
|
188
|
+
$[12] = t2;
|
|
189
|
+
$[13] = t3;
|
|
190
|
+
$[14] = t4;
|
|
191
|
+
$[15] = t6;
|
|
192
|
+
} else t6 = $[15];
|
|
193
|
+
let t7;
|
|
194
|
+
if ($[16] !== T1 || $[17] !== t5 || $[18] !== t6) {
|
|
195
|
+
t7 = /* @__PURE__ */ jsx(T1, {
|
|
196
|
+
value: t5,
|
|
197
|
+
children: t6
|
|
133
198
|
});
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
} else
|
|
139
|
-
return
|
|
199
|
+
$[16] = T1;
|
|
200
|
+
$[17] = t5;
|
|
201
|
+
$[18] = t6;
|
|
202
|
+
$[19] = t7;
|
|
203
|
+
} else t7 = $[19];
|
|
204
|
+
return t7;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The bar's element, with Home and End added to the keys React Aria handles,
|
|
208
|
+
* then handed to the call site's own `render` if it passed one. React Aria's
|
|
209
|
+
* toolbar passes no keyboard handler of the call site's through, so the
|
|
210
|
+
* element it hands over carries none for this to compose with.
|
|
211
|
+
*/
|
|
212
|
+
function toolbarRenderer(render) {
|
|
213
|
+
return (domProps, renderProps) => {
|
|
214
|
+
const merged = {
|
|
215
|
+
...domProps,
|
|
216
|
+
onKeyDown: homeAndEnd
|
|
217
|
+
};
|
|
218
|
+
return render === void 0 ? createElement("div", merged) : render(merged, renderProps);
|
|
219
|
+
};
|
|
140
220
|
}
|
|
141
221
|
export { Toolbar as default };
|
|
142
222
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","Toolbar","RACToolbar","SeparatorContext","mergeStatefulStyles","styles","base","kGNEyG","kaIpWk","kB7OPa","kMwMTN","k1xSpc","kOIVth","kjj79g","k3XXqK","$$css","horizontal","kXwgrk","kAzted","k8WAf4","kg3NbH","neutral","kWkggS","vertical","k7Eaqz","vibrant","tone","t0","$","T0","T1","t1","t2","t3","t4","orientation","t5","t6","props","undefined","t7","t8","separator"],"sources":["../../../src/components/toolbar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ToolbarProps as RACToolbarProps, SeparatorProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useMemo } from 'react';\nimport { Toolbar as RACToolbar, SeparatorContext } from 'react-aria-components';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing } from '../../tokens/design.tokens.stylex';\n\n// The toolbars page's container: a row of frequently used controls, on a\n// surface of its own, with the arrow keys moving between them rather than\n// Tab. The page calls it \"a container with configurable slots\", so nothing\n// here says what goes in one — an icon button, a button, a field or a rule\n// are all the call site's to place.\n//\n// The measurements are the page's, stated there in words: 64dp tall,\n// centred, 8dp between items and 16dp of padding outside them. The two\n// colour schemes are its own too — standard on surface container, vibrant on\n// primary container — and both put the muted content role on what they hold.\n// `tone` spells the standard one `neutral` rather than by the page's name,\n// since that is the word every `tone` in the library uses for its neutral\n// role.\n//\n// Two things are this component's own.\n//\n// **A rule inside it runs across the row, not along it.** React Aria's\n// `Toolbar` sets its orientation on itself and nowhere else, so a\n// `Separator` written among the controls would draw the way it does anywhere\n// else — along the row, where it is invisible. This provides React Aria's\n// separator context with the perpendicular orientation, and `Separator`\n// reads it, so a rule between two controls is correct without the call site\n// saying which way it runs. The context reaches the bar's own controls and\n// stops at an overlay opened from one: React context crosses the portal a\n// popover, sheet or dialog renders through, so their content parts clear it\n// — see `src/overlay` — and a rule inside one runs across the overlay as it\n// does anywhere else.\n//\n// **Arrow-key navigation is React Aria's and is not wrapped.** The arrows\n// move between the controls, and — worth knowing, since the pattern usually\n// implies otherwise — React Aria leaves every control tabbable rather than\n// giving the bar a roving tabindex, so Tab still steps through them one by\n// one. What the bar adds is the toolbar role, which tells a screen reader\n// the controls belong together, and a second way to move between them.\n//\n// One departure, and it is about the shape. The page gives the container's\n// corner as a token its widget draws rather than writes, so there is no\n// value to read: what it states in words is the height, the alignment and\n// the padding, and nothing else. The fully rounded corner here, and the\n// inline box that goes with it, are the library's own choice for a bar that\n// floats over a page rather than docking to its edge — a docked one spans\n// its container and squares its corner, both from the call site.\n\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"x1dkaolv\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n k1xSpc: \"x3nfvp2\",\n kOIVth: \"x126z3so\",\n kjj79g: \"xl56j7k\",\n k3XXqK: \"x1t137rt\",\n $$css: true\n },\n horizontal: {\n kXwgrk: \"x1q0g3np\",\n kAzted: \"x8nclml\",\n k8WAf4: \"x1cmllll\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n neutral: {\n kWkggS: \"x1mjdul6\",\n $$css: true\n },\n vertical: {\n kXwgrk: \"xdt5ytf\",\n k7Eaqz: \"x4m7ku4\",\n k8WAf4: \"xp6hjv6\",\n kg3NbH: \"xn60lsn\",\n $$css: true\n },\n vibrant: {\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n }\n};\ntype ToolbarProps = Omit<RACToolbarProps, 'children' | 'className' | 'style'> & {\n /** The controls, and any rule between them. */\n children?: ReactNode;\n /** A function may compute the class from the toolbar's render state. */\n className?: RACToolbarProps['className'];\n /** A function may compute the style from the toolbar's render state. */\n style?: RACToolbarProps['style'];\n /**\n * Which of the page's two colour schemes the bar takes. `neutral` is the\n * page's standard scheme, the surface container it draws by default;\n * `vibrant` moves it to primary container, for a bar meant to carry the\n * page's accent.\n * @default 'neutral'\n */\n tone?: ToolbarTone;\n};\ntype ToolbarTone = 'neutral' | 'vibrant';\n\n/**\n * A container for a set of controls, announced as a toolbar so a screen\n * reader reads them as one group, with the arrow keys moving between them.\n * Tab still steps through each control: React Aria's toolbar adds the arrows\n * rather than replacing what Tab does.\n *\n * ```tsx\n * <Toolbar aria-label=\"Label\">\n * <IconButton aria-label=\"First item\">\n * <FirstIcon />\n * </IconButton>\n * <Separator />\n * <IconButton aria-label=\"Second item\">\n * <SecondIcon />\n * </IconButton>\n * </Toolbar>\n * ```\n *\n * Name it with `aria-label` or `aria-labelledby` — nothing here labels it for\n * you, and a toolbar with no name is a group a screen reader cannot announce.\n *\n * `orientation` is React Aria's, and it decides both which arrows move and\n * which way the bar runs. A `Separator` among its controls draws across that\n * direction without being told; one inside an overlay opened from the bar\n * draws as it would anywhere else.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction Toolbar({\n orientation = 'horizontal',\n tone = 'neutral',\n ...props\n}: RefAttributes<HTMLDivElement> & ToolbarProps) {\n // The rule runs across the toolbar rather than along it. Memoised because\n // a fresh object here would be a new context value on every render, which\n // is what react-perf's no-new-object-as-prop is after.\n const separator = useMemo<SeparatorProps>(() => ({\n orientation: orientation === 'horizontal' ? 'vertical' : 'horizontal'\n }), [orientation]);\n return <SeparatorContext value={separator}>\n <RACToolbar orientation={orientation} {...props} {...mergeStatefulStyles(stylex.props(styles.base, styles[orientation], styles[tone]), props)} />\n </SeparatorContext>;\n}\nexport type { ToolbarProps, ToolbarTone };\nexport default Toolbar;"],"mappings":";;;;;;;;AAsDA,MAAMM,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,YAAY;EACVC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAM,SAAS;EACPC,QAAQ;EACRP,OAAO;CACT;CACAQ,UAAU;EACRN,QAAQ;EACRO,QAAQ;EACRL,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAU,SAAS;EACPH,QAAQ;EACRZ,QAAQ;EACRK,OAAO;CACT;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAAd,QAAA0B,IAAA;CAAA,MAAAC,IAAA7B,EAAA,EAAA;CAAA,IAAA8B;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IA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QAAAM,MAAAN,EAAA,QAAAQ,IAAA;EAD9IC,KAAA,oBAAC,IAAD;GAAyBK,OAAAA;GAC5BN,UAAAA;EADoB,CAAA;EAEHR,EAAA,MAAAE;EAAAF,EAAA,MAAAM;EAAAN,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAFdS;AAEc"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","createElement","Toolbar","RACToolbar","SeparatorContext","mergeStatefulStyles","styles","base","kOuLrU","kaIpWk","kB7OPa","kMwMTN","k1xSpc","kOIVth","ks0D6T","k3XXqK","kVQacm","k5wCbM","$$css","horizontal","kGNEyG","klIVar","kprqdN","kjj79g","kAzted","k8WAf4","kg3NbH","neutral","kWkggS","vertical","kfiyM8","kAPf3g","k7Eaqz","vibrant","tone","FOCUSABLE","join","PRESSABLE_INPUTS","Set","controlsIn","bar","HTMLElement","querySelectorAll","filter","control","tabIndex","matches","closest","checkVisibility","homeAndEnd","event","currentTarget","target","key","altKey","ctrlKey","metaKey","shiftKey","defaultPrevented","contains","ownsHomeAndEnd","controls","at","undefined","preventDefault","focus","HTMLInputElement","has","type","HTMLTextAreaElement","HTMLSelectElement","isContentEditable","t0","$","T0","T1","t1","t2","t3","t4","t5","orientation","t6","t7","props","t8","t9","separator","toolbarRenderer","render","domProps","renderProps","merged","onKeyDown"],"sources":["../../../src/components/toolbar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { KeyboardEvent, ReactNode, RefAttributes } from 'react';\nimport type { ToolbarProps as RACToolbarProps, SeparatorProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createElement, useMemo } from 'react';\nimport { Toolbar as RACToolbar, SeparatorContext } from 'react-aria-components';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing } from '../../tokens/design.tokens.stylex';\n\n// The toolbars page's container: a row of frequently used controls, on a\n// surface of its own, with the arrow keys moving between them rather than\n// Tab. The page calls it \"a container with configurable slots\", so nothing\n// here says what goes in one — an icon button, a button, a field or a rule\n// are all the call site's to place.\n//\n// The measurements are the page's, stated there in words: 64dp tall,\n// centred, 8dp between items and 16dp of padding outside them. The two\n// colour schemes are its own too — standard on surface container, vibrant on\n// primary container — and both put the muted content role on what they hold.\n// `tone` spells the standard one `neutral` rather than by the page's name,\n// since that is the word every `tone` in the library uses for its neutral\n// role.\n//\n// Two things are this component's own.\n//\n// **A rule inside it runs across the row, not along it.** React Aria's\n// `Toolbar` sets its orientation on itself and nowhere else, so a\n// `Separator` written among the controls would draw the way it does anywhere\n// else — along the row, where it is invisible. This provides React Aria's\n// separator context with the perpendicular orientation, and `Separator`\n// reads it, so a rule between two controls is correct without the call site\n// saying which way it runs. The context reaches the bar's own controls and\n// stops at an overlay opened from one: React context crosses the portal a\n// popover, sheet or dialog renders through, so their content parts clear it\n// — see `src/overlay` — and a rule inside one runs across the overlay as it\n// does anywhere else.\n//\n// **Keyboard navigation is React Aria's, with Home and End added.** The\n// arrows move between the controls, and the bar is a single Tab stop, as\n// the APG's toolbar pattern has it. React Aria gets there without a roving\n// tabindex: every control keeps its own `tabindex`, and a Tab pressed inside\n// the bar first moves focus to its last control, a Shift+Tab to its first,\n// so the browser's own move then leaves the bar from there. Coming back with\n// either, focus returns to the control focused last rather than to the end\n// it came in from. The bar's other contribution is the toolbar role, which\n// tells a screen reader the controls belong together.\n//\n// The pattern also gives Home and End to the first and the last control,\n// which React Aria's toolbar leaves alone, so `homeAndEnd` below adds them:\n// the start and the end of the bar in document order, whichever way it runs\n// and whichever direction it is drawn in, passing over a disabled control.\n// They are taken as the key bubbles out of the control rather than ahead of\n// it, so a control that has a use for them keeps it: a field moves its\n// caret, and a control that handles the key first, as React Aria's slider\n// does, takes it from the bar.\n//\n// One departure, and it is about the shape. The page gives the container's\n// corner as a token its widget draws rather than writes, so there is no\n// value to read: what it states in words is the height, the alignment and\n// the padding, and nothing else. The fully rounded corner here, and the\n// inline box that goes with it, are the library's own choice for a bar that\n// floats over a page rather than docking to its edge — a docked one spans\n// its container and squares its corner, both from the call site.\n\nconst styles = {\n base: {\n kOuLrU: \"xfk6m8\",\n kaIpWk: \"x1dkaolv\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n k1xSpc: \"xwz0xwf\",\n kOIVth: \"x126z3so\",\n ks0D6T: \"x193iq5w\",\n k3XXqK: \"x1t137rt\",\n kVQacm: \"xysyzu8\",\n k5wCbM: \"x1rohswg\",\n $$css: true\n },\n horizontal: {\n kGNEyG: \"x6s0dn4\",\n klIVar: \"x1mt6kc2\",\n kprqdN: \"x1mt1orb\",\n kjj79g: \"xej7fhh\",\n kAzted: \"x8nclml\",\n k8WAf4: \"x1cmllll\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n neutral: {\n kWkggS: \"x1mjdul6\",\n $$css: true\n },\n vertical: {\n kfiyM8: \"x1l10kik\",\n kprqdN: \"x1sdr0u7\",\n kAPf3g: \"x1o2pa38\",\n k7Eaqz: \"x4m7ku4\",\n k8WAf4: \"xp6hjv6\",\n kg3NbH: \"xn60lsn\",\n $$css: true\n },\n vibrant: {\n \"--icon-button-standard-color\": \"x78l5pw\",\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n }\n};\ntype ToolbarProps = Omit<RACToolbarProps, 'children' | 'className' | 'style'> & {\n /** The controls, and any rule between them. */\n children?: ReactNode;\n /** A function may compute the class from the toolbar's render state. */\n className?: RACToolbarProps['className'];\n /** A function may compute the style from the toolbar's render state. */\n style?: RACToolbarProps['style'];\n /**\n * Which of the page's two colour schemes the bar takes. `neutral` is the\n * page's standard scheme, the surface container it draws by default;\n * `vibrant` moves it to primary container, for a bar meant to carry the\n * page's accent.\n * @default 'neutral'\n */\n tone?: ToolbarTone;\n};\ntype ToolbarRender = RACToolbarProps['render'];\ntype ToolbarTone = 'neutral' | 'vibrant';\n\n// What can take focus in the bar, as a Tab could land on it: a native\n// control or anything with a `tabindex`, narrowed in `controlsIn`.\nconst FOCUSABLE = ['a[href]', 'area[href]', 'button', 'iframe', 'input:not([type=\"hidden\"])', 'select', 'summary', 'textarea', '[contenteditable]:not([contenteditable=\"false\"])', '[tabindex]'].join(',');\n\n// The input types that are a press target rather than a value, and so have\n// no use for Home and End of their own.\nconst PRESSABLE_INPUTS = new Set(['button', 'checkbox', 'image', 'radio', 'reset', 'submit']);\n\n/**\n * The bar's controls a Tab could land on, in document order: a disabled\n * one, one taken out of the Tab order, and one inert or not drawn are left\n * out, so Home and End never reach a control that cannot take focus.\n */\nfunction controlsIn(bar: HTMLElement) {\n return [...bar.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(control => control.tabIndex >= 0 && !control.matches(':disabled') && control.closest('[inert]') === null && control.checkVisibility());\n}\n\n// Home and End, to the first and the last control. Left alone while a\n// modifier is held, which the browser may want, once a control has taken\n// the key, and on a key from a portal the bar renders — a popover opened\n// from one of its controls — which React carries up to the bar as though it\n// came from inside it. Taken from the page once used, so End does not\n// scroll it as well.\nfunction homeAndEnd(event: KeyboardEvent<HTMLDivElement>) {\n const bar = event.currentTarget;\n const {\n target\n } = event;\n if (event.key !== 'Home' && event.key !== 'End' || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || event.defaultPrevented || !(target instanceof HTMLElement) || !bar.contains(target) || ownsHomeAndEnd(target)) {\n return;\n }\n const controls = controlsIn(bar);\n const control = event.key === 'Home' ? controls.at(0) : controls.at(-1);\n if (control === undefined) {\n return;\n }\n event.preventDefault();\n control.focus();\n}\n\n/**\n * Whether `target` is a control with its own use for Home and End: a field,\n * whose caret they move, a native select or range, or editable text.\n */\nfunction ownsHomeAndEnd(target: HTMLElement) {\n if (target instanceof HTMLInputElement) {\n return !PRESSABLE_INPUTS.has(target.type);\n }\n return target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement || target.isContentEditable;\n}\n\n/**\n * A container for a set of controls, announced as a toolbar so a screen\n * reader reads them as one group, with the arrow keys moving between them\n * and Home and End moving to the first and the last enabled control. The\n * bar is one Tab stop: Tab and Shift+Tab leave it from whichever control has\n * focus, and coming back returns to that control.\n *\n * ```tsx\n * <Toolbar aria-label=\"Label\">\n * <IconButton aria-label=\"First item\">\n * <FirstIcon />\n * </IconButton>\n * <Separator />\n * <IconButton aria-label=\"Second item\">\n * <SecondIcon />\n * </IconButton>\n * </Toolbar>\n * ```\n *\n * Name it with `aria-label` or `aria-labelledby` — nothing here labels it for\n * you, and a toolbar with no name is a group a screen reader cannot announce.\n *\n * `orientation` is React Aria's, and it decides both which arrows move and\n * which way the bar runs. A `Separator` among its controls draws across that\n * direction without being told; one inside an overlay opened from the bar\n * draws as it would anywhere else.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n *\n * Every control keeps its own width. A bar given less room than its controls\n * need — a phone's width, say — stays inside it and scrolls along its length\n * rather than squeezing a control or overflowing the page.\n */\nfunction Toolbar({\n orientation = 'horizontal',\n tone = 'neutral',\n ...props\n}: RefAttributes<HTMLDivElement> & ToolbarProps) {\n // The rule runs across the toolbar rather than along it. Memoised because\n // a fresh object here would be a new context value on every render, which\n // is what react-perf's no-new-object-as-prop is after.\n const separator = useMemo<SeparatorProps>(() => ({\n orientation: orientation === 'horizontal' ? 'vertical' : 'horizontal'\n }), [orientation]);\n return <SeparatorContext value={separator}>\n <RACToolbar orientation={orientation} {...props} render={toolbarRenderer(props.render)} {...mergeStatefulStyles(stylex.props(styles.base, styles[orientation], styles[tone]), props)} />\n </SeparatorContext>;\n}\n\n/**\n * The bar's element, with Home and End added to the keys React Aria handles,\n * then handed to the call site's own `render` if it passed one. React Aria's\n * toolbar passes no keyboard handler of the call site's through, so the\n * element it hands over carries none for this to compose with.\n */\nfunction toolbarRenderer(render: ToolbarRender): NonNullable<ToolbarRender> {\n return (domProps, renderProps) => {\n const merged = {\n ...domProps,\n onKeyDown: homeAndEnd\n };\n return render === undefined ? createElement('div', merged) : render(merged, renderProps);\n };\n}\n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AAW;CACzF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","createContext","useContext","Tree","RACTree","TreeHeader","TreeItem","RACTreeItem","RACTreeLoadMoreItem","TreeSection","RACTreeSection","collectionStyles","containerClasses","rowItemStyles","useRipple","focus","mergeStatefulStyles","mergeStyles","SelectLabelContext","undefined","styles","chevron","kGNEyG","kWkggS","kaIpWk","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kmuXW","kjj79g","kmVPX3","$$css","indent","kZCmMZ","children","className","leading","supporting","trailing","headline","textValue","label","selectionBehavior","selectLabel","header","chevronClassName","props","ring","chevronFor","state","hasChildItems","isExpanded","itemContent","ripple","isDisabled","isSelected","selectionFor","selectionMode","textValueFor","t0","$","T0","T1","t1","t2","t3","t4","t5","t6","Symbol","for","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","handlers","surface","t7","TreeLoadMore","loading","section","Item","LoadMore","Section","RACButton","RACTreeHeader","RACTreeItemContent"],"sources":["../../../src/components/tree/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { TreeItemProps as RACTreeItemProps, TreeLoadMoreItemProps as RACTreeLoadMoreItemProps, TreeProps as RACTreeProps, TreeItemRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { Button as RACButton, Tree as RACTree, TreeHeader as RACTreeHeader, TreeItem as RACTreeItem, TreeItemContent as RACTreeItemContent, TreeLoadMoreItem as RACTreeLoadMoreItem, TreeSection as RACTreeSection } from 'react-aria-components';\nimport { CollectionLoadMore } from '../../collection';\nimport { collectionStyles, containerClasses, rowItemStyles } from '../../collection/styles';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport Checkbox from '../checkbox';\n\n// A list whose rows nest. Each row is the row every list here draws —\n// `src/row`, shared with ListItem, ListBox, List and Disclosure — so its\n// 56dp floor, body-large headline, body-medium supporting line, state layers\n// and disabled treatment are that module's, and a tree beside a list cannot\n// drift from it.\n//\n// The lists page gives no nesting: it draws one flat list. So the two things\n// a tree adds beyond that row are the library's own, and both are written\n// here with their reasons. The rest — the row, the selection colours, the\n// checkbox — is the page's, through the shared module.\n//\n// Four things are this component's own.\n//\n// **A level indents by one chevron's width.** React Aria puts the depth on\n// each row as a custom property, so the inset is one `calc` against the\n// row's own inline padding rather than a style per level. 24dp is the size\n// the menus page gives that glyph, which makes a level of nesting exactly as\n// wide as the caret that opens it.\n//\n// **The caret is a button, and React Aria names it.** A `slot=\"chevron\"`\n// button is what expands and collapses; React Aria labels it Expand or\n// Collapse and composes that with the row, so nothing here names it. It is\n// drawn only on a row that has children, since a caret on a leaf says the\n// row opens when it does not.\n//\n// **A selecting tree draws a checkbox, before whatever the row was given.**\n// Same rule as List: React Aria reports the mode on each row, so a tree that\n// toggles draws one without the call site repeating it, and it always sits\n// in the same place so a column of rows reads down.\n//\n// **`TreeItemContent` has no class to style.** React Aria renders it as a\n// `display: contents` gridcell with nothing on it, so the row's own layout\n// is drawn by what goes inside rather than by that wrapper.\n\n// `TreeSection`'s props are not re-exported from the package index, only its\n// component is — so the type is taken off the component rather than imported\n// by a name that is not there to import.\ntype RACTreeSectionProps<T> = Parameters<typeof RACTreeSection<T>>[0];\n\n// What each row's selection checkbox is called. A context rather than a prop\n// on the row, since it is the tree's decision and repeating it per row is\n// how the two drift. Undefined unless the tree is given one, which leaves\n// the name React Aria gives in the reader's locale.\nconst SelectLabelContext = createContext<string | undefined>(undefined);\nconst styles = {\n chevron: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n $$css: true\n },\n indent: {\n kZCmMZ: \"x1187sqy\",\n $$css: true\n }\n};\ntype TreeHeaderProps = {\n /** The section's heading. */\n children?: ReactNode;\n};\ntype TreeItemProps<T extends object = object> = Omit<RACTreeItemProps<T>, 'children' | 'className' | 'style' | 'textValue'> & TreeItemText & {\n /** The rows nested under this one, as further `Tree.Item` entries. */\n children?: ReactNode;\n /** A function may compute the class from the row's render state. */\n className?: RACTreeItemProps<T>['className'];\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /** A function may compute the style from the row's render state. */\n style?: RACTreeItemProps<T>['style'];\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as a count or a control. */\n trailing?: ReactNode;\n};\n\n// What the row is worth as text, which React Aria requires: a tree row wraps\n// its headline in elements, so it cannot read one off the children the way a\n// plain-string child would give it. A string headline is taken as the value,\n// which is the common case; anything else has to say what it is worth, and\n// this is what makes the compiler ask rather than leaving a row unnamed.\ntype TreeItemText = {\n /** The row's headline — the one thing it is mostly about. */\n headline: string;\n /** What typeahead matches the row on. Defaults to the headline. */\n textValue?: string;\n} | {\n /** The row's headline, as something other than a plain string. */\n headline?: ReactNode;\n /** What typeahead matches the row on, and what names it. */\n textValue: string;\n};\ntype TreeLoadMoreProps = Omit<RACTreeLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * Left out, it is the word for it in the I18nProvider's locale — \"Loading\n * more\" in English.\n */\n label?: string;\n};\ntype TreeProps<T extends object = object> = {\n /** A function may compute the class from the tree's render state. */\n className?: RACTreeProps<T>['className'];\n /**\n * How a press selects. `toggle` draws a checkbox on every row, and a press\n * adds that row to the selection or takes it out. `replace` draws none, a\n * press makes that row the selection, and the arrow keys carry the\n * selection with the focus; where rows also take an action, a click\n * selects and a double click acts. Left out, a `single` tree replaces and\n * any other toggles, since a single choice drawn as checkboxes unticks one\n * box whenever another is ticked.\n */\n selectionBehavior?: RACTreeProps<T>['selectionBehavior'];\n /**\n * What each row's selection checkbox is called, for a screen reader. The\n * row's own text is what names the row; this names the box inside it.\n * Left out, React Aria names it in the reader's locale — \"Select\" in\n * English.\n */\n selectLabel?: string;\n /** A function may compute the style from the tree's render state. */\n style?: RACTreeProps<T>['style'];\n} & Omit<RACTreeProps<T>, 'className' | 'selectionBehavior' | 'style'>;\ntype TreeSectionProps<T extends object = object> = Omit<RACTreeSectionProps<T>, 'children'> & {\n /**\n * The rows in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\n\n// The button itself never turns — the glyph inside it does, so the press\n// target stays a square whichever way the row is pointing.\nfunction chevronClassName() {\n return stylex.props(styles.chevron, focus.ring).className ?? '';\n}\n\n// The caret, or the space it would have taken. Written as a call rather than\n// inline at the prop, which is what react-perf's no-new-function-as-prop and\n// jsx-no-jsx-as-prop are after; the React Compiler memoises the result on\n// its inputs.\n//\n// A leaf gets the space rather than nothing, so its headline lines up with\n// the headline of a sibling that opens.\nfunction chevronFor(state: TreeItemRenderProps): ReactNode {\n if (!state.hasChildItems) {\n return <span className=\"xxk0z11 x2lah0s xvy4d1p\" />;\n }\n return <RACButton className={chevronClassName} slot=\"chevron\">\n <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xu3v78v x1c071of xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 xaaet9u x1iffjtl\"\n }\n }[!!state.isExpanded << 0]} />\n </RACButton>;\n}\n\n// What a row draws, from React Aria's render state. The caret comes first,\n// then the selection checkbox, then whatever the row was given — one order,\n// always, which is what keeps a column of rows reading down.\nfunction itemContent(headline: ReactNode, leading: ReactNode, supporting: ReactNode, trailing: ReactNode, selectLabel: string | undefined, ripple: ReactNode) {\n return (state: TreeItemRenderProps): ReactNode => <>\n <RowContent chevron={chevronFor(state)} isDisabled={state.isDisabled} isSelected={state.isSelected} leading={leading} selection={selectionFor(state, selectLabel)} supporting={supporting} trailing={trailing}>\n {headline}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// row's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so its ground and colour\n// win over the selected container's. The state layers come from the render\n// state as well — see `focusVisible` in src/row/styles.ts — and React Aria\n// reports none of them on a disabled row, so nothing has to outrank them.\n//\n// A supporting line moves the row from the page's one-line container height\n// to its two-line one, which is a floor rather than something the row's own\n// box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as an\n// argument rather than read from the render state, since React Aria reports\n// what a row is doing and not what it holds; the row is built by a call for\n// the same reason `itemContent` is.\n/**\n * The selection checkbox, while the tree toggles. The row draws it after the\n * caret and ahead of whatever `leading` holds.\n */\nfunction selectionFor(state: TreeItemRenderProps, selectLabel: string | undefined) {\n if (state.selectionBehavior !== 'toggle' || state.selectionMode === 'none') {\n return null;\n }\n return <Checkbox aria-label={selectLabel} slot=\"selection\" />;\n}\n\n// What React Aria matches typeahead on, and what names the row. `TreeItemText`\n// makes one of the two a string, so the last branch is unreachable through the\n// public type — it is there because destructuring the two apart is what loses\n// the narrowing, not because a row can arrive without either.\nfunction textValueFor(textValue: string | undefined, headline: ReactNode) {\n if (textValue !== undefined) {\n return textValue;\n }\n return typeof headline === 'string' ? headline : '';\n}\n\n/**\n * A list whose rows nest. Which rows are open is React Aria's: pass\n * `expandedKeys` with `onExpandedChange` to control it, or\n * `defaultExpandedKeys` to let it keep its own. Selection is React Aria's\n * too — set `selectionMode` to `single` or `multiple`. A `multiple` tree\n * draws a checkbox on every row and a `single` one draws none, as a `List`\n * does; `selectionBehavior` overrides either.\n *\n * ```tsx\n * <Tree aria-label=\"Label\">\n * <Tree.Item headline=\"First item\" id=\"first\">\n * <Tree.Item headline=\"Second item\" id=\"second\" />\n * </Tree.Item>\n * </Tree>\n * ```\n *\n * Each row is the row every list here draws, indented by its depth, with a\n * caret on the rows that have children. Name the tree with `aria-label` or\n * `aria-labelledby` — nothing here labels it for you.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction Tree<T extends object>({\n selectionBehavior,\n selectLabel,\n ...props\n}: RefAttributes<HTMLDivElement> & TreeProps<T>) {\n return <SelectLabelContext value={selectLabel}>\n <RACTree<T> {...props} {...mergeStatefulStyles(containerClasses, props)}\n // React Aria's own default is `toggle` in every mode. Read with `??`\n // rather than placed before the spread, so a wrapper forwarding an\n // unset prop still gets the default.\n selectionBehavior={selectionBehavior ?? (props.selectionMode === 'single' ? 'replace' : 'toggle')} />\n </SelectLabelContext>;\n}\n\n/**\n * A named group of rows. `header` names it, and is what a screen reader\n * reads before the rows inside.\n */\nfunction TreeHeader({\n children\n}: TreeHeaderProps) {\n return <RACTreeHeader {...stylex.props(collectionStyles.header)}>\n {children}\n </RACTreeHeader>;\n}\n\n/**\n * One row, and the rows under it. Its slots are the row's: `leading`, the\n * `headline`, `supporting` under it, and `trailing`. Give every row an `id`\n * — that is the key selection and expansion are reported by.\n *\n * Rows nested as `children` are what make it a branch; a row with none is a\n * leaf and draws no caret. `textValue` is what typeahead matches on, and is\n * taken from a plain-string headline when it is not given.\n */\nfunction TreeItem<T extends object = object>({\n children,\n headline,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n supporting,\n textValue,\n trailing,\n ...props\n}: RefAttributes<HTMLDivElement> & TreeItemProps<T>) {\n const selectLabel = useContext(SelectLabelContext);\n // The press ripple List's rows draw — see ListItem there.\n const ripple = useRipple<HTMLDivElement>(true, {\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACTreeItem<T> textValue={textValueFor(textValue, headline)} {...ripple.handlers} {...props} {...mergeStatefulStyles(\n // No overline: a tree row takes the list variant's metrics because it\n // looks like a list row, but it follows its own page, and that page\n // gives a headline and a supporting line. The three-line item belongs\n // to the lists page, which `List.Item` and `ListBox.Item` draw.\n rowItemStyles(supporting, undefined, styles.indent), props)}>\n <RACTreeItemContent>\n {itemContent(headline, leading, supporting, trailing, selectLabel, ripple.surface)}\n </RACTreeItemContent>\n {children}\n </RACTreeItem>;\n}\n\n/**\n * The row the tree shows while it is fetching more. React Aria calls\n * `onLoadMore` when this comes into view, and draws it only while\n * `isLoading`.\n */\nfunction TreeLoadMore({\n label,\n ...props\n}: RefAttributes<HTMLDivElement> & TreeLoadMoreProps) {\n return <RACTreeLoadMoreItem {...props} {...mergeStatefulStyles(stylex.props(collectionStyles.loading), props)}>\n <CollectionLoadMore diameter=\"24px\" label={label} />\n </RACTreeLoadMoreItem>;\n}\n\n/**\n * A named group of rows, with its heading above them.\n */\nfunction TreeSection<T extends object = object>({\n children,\n header,\n ...props\n}: TreeSectionProps<T>) {\n return <RACTreeSection<T> {...props} {...mergeStyles(stylex.props(collectionStyles.section), props)}>\n {header === undefined ? null : <TreeHeader>{header}</TreeHeader>}\n {children}\n </RACTreeSection>;\n}\nTree.Item = TreeItem;\nTree.LoadMore = TreeLoadMore;\nTree.Section = TreeSection;\nexport type { TreeItemProps, TreeLoadMoreProps, TreeProps, TreeSectionProps };\nexport { TreeItem, TreeLoadMore, TreeSection };\nexport default Tree;"],"mappings":";;;;;;;;;;;;;;;AA6DA,MAAMmB,qBAAqBjB,cAAkCkB,KAAAA,CAAS;AACtE,MAAMC,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;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EAAA,MAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAHZM;AAGY;AAErBjE,KAAKiF,OAAO9E;AACZH,KAAKkF,WAAWJ;AAChB9E,KAAKmF,UAAU7E"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","createContext","useContext","Tree","RACTree","TreeHeader","TreeItem","RACTreeItem","RACTreeLoadMoreItem","TreeSection","RACTreeSection","collectionStyles","containerClasses","rowItemStyles","useRipple","focus","mergeStatefulStyles","mergeStyles","SelectLabelContext","undefined","styles","chevron","kGNEyG","kWkggS","kaIpWk","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kmuXW","kjj79g","kmVPX3","$$css","indent","kZCmMZ","children","className","leading","supporting","trailing","headline","textValue","label","selectionBehavior","selectLabel","header","chevronClassName","props","ring","chevronFor","state","hasChildItems","isExpanded","itemContent","ripple","isDisabled","isSelected","selectionFor","selectionMode","textValueFor","t0","$","T0","T1","t1","t2","t3","t4","t5","t6","Symbol","for","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","handlers","surface","t7","TreeLoadMore","loading","section","Item","LoadMore","Section","RACButton","RACTreeHeader","RACTreeItemContent"],"sources":["../../../src/components/tree/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { TreeItemProps as RACTreeItemProps, TreeLoadMoreItemProps as RACTreeLoadMoreItemProps, TreeProps as RACTreeProps, TreeItemRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { Button as RACButton, Tree as RACTree, TreeHeader as RACTreeHeader, TreeItem as RACTreeItem, TreeItemContent as RACTreeItemContent, TreeLoadMoreItem as RACTreeLoadMoreItem, TreeSection as RACTreeSection } from 'react-aria-components';\nimport { CollectionLoadMore } from '../../collection';\nimport { collectionStyles, containerClasses, rowItemStyles } from '../../collection/styles';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport Checkbox from '../checkbox';\n\n// A list whose rows nest. Each row is the row every list here draws —\n// `src/row`, shared with ListItem, ListBox, List and Disclosure — so its\n// 56dp floor, body-large headline, body-medium supporting line, state layers\n// and disabled treatment are that module's, and a tree beside a list cannot\n// drift from it.\n//\n// The lists page gives no nesting: it draws one flat list. So the two things\n// a tree adds beyond that row are the library's own, and both are written\n// here with their reasons. The rest — the row, the selection colours, the\n// checkbox — is the page's, through the shared module.\n//\n// Four things are this component's own.\n//\n// **A level indents by one chevron's width.** React Aria puts the depth on\n// each row as a custom property, so the inset is one `calc` against the\n// row's own inline padding rather than a style per level. 24dp is the size\n// the menus page gives that glyph, which makes a level of nesting exactly as\n// wide as the caret that opens it.\n//\n// **The caret is a button, and React Aria names it.** A `slot=\"chevron\"`\n// button is what expands and collapses; React Aria labels it Expand or\n// Collapse and composes that with the row, so nothing here names it. It is\n// drawn only on a row that has children, since a caret on a leaf says the\n// row opens when it does not.\n//\n// **A selecting tree draws a checkbox, before whatever the row was given.**\n// Same rule as List: React Aria reports the mode on each row, so a tree that\n// toggles draws one without the call site repeating it, and it always sits\n// in the same place so a column of rows reads down.\n//\n// **`TreeItemContent` has no class to style.** React Aria renders it as a\n// `display: contents` gridcell with nothing on it, so the row's own layout\n// is drawn by what goes inside rather than by that wrapper.\n\n// `TreeSection`'s props are not re-exported from the package index, only its\n// component is — so the type is taken off the component rather than imported\n// by a name that is not there to import.\ntype RACTreeSectionProps<T> = Parameters<typeof RACTreeSection<T>>[0];\n\n// What each row's selection checkbox is called. A context rather than a prop\n// on the row, since it is the tree's decision and repeating it per row is\n// how the two drift. Undefined unless the tree is given one, which leaves\n// the name React Aria gives in the reader's locale.\nconst SelectLabelContext = createContext<string | undefined>(undefined);\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)';\nconst styles = {\n chevron: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug x1xt8qih\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n $$css: true\n },\n indent: {\n kZCmMZ: \"x1187sqy\",\n $$css: true\n }\n};\ntype TreeHeaderProps = {\n /** The section's heading. */\n children?: ReactNode;\n};\ntype TreeItemProps<T extends object = object> = Omit<RACTreeItemProps<T>, 'children' | 'className' | 'style' | 'textValue'> & TreeItemText & {\n /** The rows nested under this one, as further `Tree.Item` entries. */\n children?: ReactNode;\n /** A function may compute the class from the row's render state. */\n className?: RACTreeItemProps<T>['className'];\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /** A function may compute the style from the row's render state. */\n style?: RACTreeItemProps<T>['style'];\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as a count or a control. */\n trailing?: ReactNode;\n};\n\n// What the row is worth as text, which React Aria requires: a tree row wraps\n// its headline in elements, so it cannot read one off the children the way a\n// plain-string child would give it. A string headline is taken as the value,\n// which is the common case; anything else has to say what it is worth, and\n// this is what makes the compiler ask rather than leaving a row unnamed.\ntype TreeItemText = {\n /** The row's headline — the one thing it is mostly about. */\n headline: string;\n /** What typeahead matches the row on. Defaults to the headline. */\n textValue?: string;\n} | {\n /** The row's headline, as something other than a plain string. */\n headline?: ReactNode;\n /** What typeahead matches the row on, and what names it. */\n textValue: string;\n};\ntype TreeLoadMoreProps = Omit<RACTreeLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * Left out, it is the word for it in the I18nProvider's locale — \"Loading\n * more\" in English.\n */\n label?: string;\n};\ntype TreeProps<T extends object = object> = {\n /** A function may compute the class from the tree's render state. */\n className?: RACTreeProps<T>['className'];\n /**\n * How a press selects. `toggle` draws a checkbox on every row, and a press\n * adds that row to the selection or takes it out. `replace` draws none, a\n * press makes that row the selection, and the arrow keys carry the\n * selection with the focus; where rows also take an action, a click\n * selects and a double click acts. Left out, a `single` tree replaces and\n * any other toggles, since a single choice drawn as checkboxes unticks one\n * box whenever another is ticked.\n */\n selectionBehavior?: RACTreeProps<T>['selectionBehavior'];\n /**\n * What each row's selection checkbox is called, for a screen reader. The\n * row's own text is what names the row; this names the box inside it.\n * Left out, React Aria names it in the reader's locale — \"Select\" in\n * English.\n */\n selectLabel?: string;\n /** A function may compute the style from the tree's render state. */\n style?: RACTreeProps<T>['style'];\n} & Omit<RACTreeProps<T>, 'className' | 'selectionBehavior' | 'style'>;\ntype TreeSectionProps<T extends object = object> = Omit<RACTreeSectionProps<T>, 'children'> & {\n /**\n * The rows in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\n\n// The button itself never turns — the glyph inside it does, so the press\n// target stays a square whichever way the row is pointing.\nfunction chevronClassName() {\n return stylex.props(styles.chevron, focus.ring).className ?? '';\n}\n\n// The caret, or the space it would have taken. Written as a call rather than\n// inline at the prop, which is what react-perf's no-new-function-as-prop and\n// jsx-no-jsx-as-prop are after; the React Compiler memoises the result on\n// its inputs.\n//\n// A leaf gets the space rather than nothing, so its headline lines up with\n// the headline of a sibling that opens.\nfunction chevronFor(state: TreeItemRenderProps): ReactNode {\n if (!state.hasChildItems) {\n return <span className=\"xxk0z11 x2lah0s xvy4d1p\" />;\n }\n return <RACButton className={chevronClassName} slot=\"chevron\">\n <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xu3v78v x1c071of xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 xaaet9u x1iffjtl\"\n }\n }[!!state.isExpanded << 0]} />\n </RACButton>;\n}\n\n// What a row draws, from React Aria's render state. The caret comes first,\n// then the selection checkbox, then whatever the row was given — one order,\n// always, which is what keeps a column of rows reading down.\nfunction itemContent(headline: ReactNode, leading: ReactNode, supporting: ReactNode, trailing: ReactNode, selectLabel: string | undefined, ripple: ReactNode) {\n return (state: TreeItemRenderProps): ReactNode => <>\n <RowContent chevron={chevronFor(state)} isDisabled={state.isDisabled} isSelected={state.isSelected} leading={leading} selection={selectionFor(state, selectLabel)} supporting={supporting} trailing={trailing}>\n {headline}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// row's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so its ground and colour\n// win over the selected container's. The state layers come from the render\n// state as well — see `focusVisible` in src/row/styles.ts — and React Aria\n// reports none of them on a disabled row, so nothing has to outrank them.\n//\n// A supporting line moves the row from the page's one-line container height\n// to its two-line one, which is a floor rather than something the row's own\n// box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as an\n// argument rather than read from the render state, since React Aria reports\n// what a row is doing and not what it holds; the row is built by a call for\n// the same reason `itemContent` is.\n/**\n * The selection checkbox, while the tree toggles. The row draws it after the\n * caret and ahead of whatever `leading` holds.\n */\nfunction selectionFor(state: TreeItemRenderProps, selectLabel: string | undefined) {\n if (state.selectionBehavior !== 'toggle' || state.selectionMode === 'none') {\n return null;\n }\n return <Checkbox aria-label={selectLabel} slot=\"selection\" />;\n}\n\n// What React Aria matches typeahead on, and what names the row. `TreeItemText`\n// makes one of the two a string, so the last branch is unreachable through the\n// public type — it is there because destructuring the two apart is what loses\n// the narrowing, not because a row can arrive without either.\nfunction textValueFor(textValue: string | undefined, headline: ReactNode) {\n if (textValue !== undefined) {\n return textValue;\n }\n return typeof headline === 'string' ? headline : '';\n}\n\n/**\n * A list whose rows nest. Which rows are open is React Aria's: pass\n * `expandedKeys` with `onExpandedChange` to control it, or\n * `defaultExpandedKeys` to let it keep its own. Selection is React Aria's\n * too — set `selectionMode` to `single` or `multiple`. A `multiple` tree\n * draws a checkbox on every row and a `single` one draws none, as a `List`\n * does; `selectionBehavior` overrides either.\n *\n * ```tsx\n * <Tree aria-label=\"Label\">\n * <Tree.Item headline=\"First item\" id=\"first\">\n * <Tree.Item headline=\"Second item\" id=\"second\" />\n * </Tree.Item>\n * </Tree>\n * ```\n *\n * Each row is the row every list here draws, indented by its depth, with a\n * caret on the rows that have children. Name the tree with `aria-label` or\n * `aria-labelledby` — nothing here labels it for you.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction Tree<T extends object>({\n selectionBehavior,\n selectLabel,\n ...props\n}: RefAttributes<HTMLDivElement> & TreeProps<T>) {\n return <SelectLabelContext value={selectLabel}>\n <RACTree<T> {...props} {...mergeStatefulStyles(containerClasses, props)}\n // React Aria's own default is `toggle` in every mode. Read with `??`\n // rather than placed before the spread, so a wrapper forwarding an\n // unset prop still gets the default.\n selectionBehavior={selectionBehavior ?? (props.selectionMode === 'single' ? 'replace' : 'toggle')} />\n </SelectLabelContext>;\n}\n\n/**\n * A named group of rows. `header` names it, and is what a screen reader\n * reads before the rows inside.\n */\nfunction TreeHeader({\n children\n}: TreeHeaderProps) {\n return <RACTreeHeader {...stylex.props(collectionStyles.header)}>\n {children}\n </RACTreeHeader>;\n}\n\n/**\n * One row, and the rows under it. Its slots are the row's: `leading`, the\n * `headline`, `supporting` under it, and `trailing`. Give every row an `id`\n * — that is the key selection and expansion are reported by.\n *\n * Rows nested as `children` are what make it a branch; a row with none is a\n * leaf and draws no caret. `textValue` is what typeahead matches on, and is\n * taken from a plain-string headline when it is not given.\n */\nfunction TreeItem<T extends object = object>({\n children,\n headline,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n supporting,\n textValue,\n trailing,\n ...props\n}: RefAttributes<HTMLDivElement> & TreeItemProps<T>) {\n const selectLabel = useContext(SelectLabelContext);\n // The press ripple List's rows draw — see ListItem there.\n const ripple = useRipple<HTMLDivElement>(true, {\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACTreeItem<T> textValue={textValueFor(textValue, headline)} {...ripple.handlers} {...props} {...mergeStatefulStyles(\n // No overline: a tree row takes the list variant's metrics because it\n // looks like a list row, but it follows its own page, and that page\n // gives a headline and a supporting line. The three-line item belongs\n // to the lists page, which `List.Item` and `ListBox.Item` draw.\n rowItemStyles(supporting, undefined, styles.indent), props)}>\n <RACTreeItemContent>\n {itemContent(headline, leading, supporting, trailing, selectLabel, ripple.surface)}\n </RACTreeItemContent>\n {children}\n </RACTreeItem>;\n}\n\n/**\n * The row the tree shows while it is fetching more. React Aria calls\n * `onLoadMore` when this comes into view, and draws it only while\n * `isLoading`.\n */\nfunction TreeLoadMore({\n label,\n ...props\n}: RefAttributes<HTMLDivElement> & TreeLoadMoreProps) {\n return <RACTreeLoadMoreItem {...props} {...mergeStatefulStyles(stylex.props(collectionStyles.loading), props)}>\n <CollectionLoadMore diameter=\"24px\" label={label} />\n </RACTreeLoadMoreItem>;\n}\n\n/**\n * A named group of rows, with its heading above them.\n */\nfunction TreeSection<T extends object = object>({\n children,\n header,\n ...props\n}: TreeSectionProps<T>) {\n return <RACTreeSection<T> {...props} {...mergeStyles(stylex.props(collectionStyles.section), props)}>\n {header === undefined ? null : <TreeHeader>{header}</TreeHeader>}\n {children}\n </RACTreeSection>;\n}\nTree.Item = TreeItem;\nTree.LoadMore = TreeLoadMore;\nTree.Section = TreeSection;\nexport type { TreeItemProps, TreeLoadMoreProps, TreeProps, TreeSectionProps };\nexport { TreeItem, TreeLoadMore, TreeSection };\nexport default Tree;"],"mappings":";;;;;;;;;;;;;;;AA6DA,MAAMmB,qBAAqBjB,cAAkCkB,KAAAA,CAAS;AAOtE,MAAMC,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QAAQ;EACNC,QAAQ;EACRF,OAAO;CACT;AACF;AAoFA,SAASc,mBAAmB;CAC1B,OAAO/C,MAAaoB,OAAOC,SAASN,MAAMkC,IAAI,CAAC,CAACZ,aAAa;AAC/D;AASA,SAASa,WAAWC,OAAuC;CACzD,IAAI,CAACA,MAAMC,eACT,OAAO,oBAAC,QAAD,EAAM,WAAU,0BAAyB,CAAA;CAElD,OAAO,oBAACmC,QAAD;EAAW,WAAWxC;EAAkB,MAAK;EAChD,UAAA,oBAAC,iBAAD,EAAiB,GAAI;GACrB,GAAG,EACDV,WAAW,qEACb;GACA,GAAG,EACDA,WAAW,qEACb;EACF,EAAE,CAAC,CAACc,MAAME,cAAc,GAAG,CAAA;CAChB,CAAA;AACf;AAKA,SAASC,YAAYb,UAAqBH,SAAoBC,YAAuBC,UAAqBK,aAAiCU,QAAmB;CAC5J,QAAQJ,UAA0C,qBAAA,YAAA,EAAA,UAAA,CAC9C,oBAAC,YAAD;EAAY,SAASD,WAAWC,KAAK;EAAG,YAAYA,MAAMK;EAAY,YAAYL,MAAMM;EAAqBnB;EAAS,WAAWoB,aAAaP,OAAON,WAAW;EAAeN;EAAsBC;EAClMC,UAAAA;CACS,CAAA,GACXU,MAAMK,aAAa,OAAOD,MAC7B,EAAA,CAAA;AACJ;;;;;AAmBA,SAASG,aAAaP,OAA4BN,aAAiC;CACjF,IAAIM,MAAMP,sBAAsB,YAAYO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B,EAAA,QAAAG,MAAAH,EAAA,QAAAI,MAAAJ,EAAA,QAAAK,IAAA;EAD7DC,KAAA,qBAAC,IAAD;GAAe,GAAQpB;GAAK,GAAMkB;GAAlC,UAAA,CACFC,IACA/B,QAFiB;;EAGH0B,EAAA,KAAAC;EAAAD,EAAA,KAAA1B;EAAA0B,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAHZM;AAGY;AAErBjE,KAAKiF,OAAO9E;AACZH,KAAKkF,WAAWJ;AAChB9E,KAAKmF,UAAU7E"}
|
package/dist/fab/styles.js
CHANGED
|
@@ -25,6 +25,10 @@ const fabStyles = {
|
|
|
25
25
|
kkrTdU: "x1h6gzvc",
|
|
26
26
|
$$css: true
|
|
27
27
|
},
|
|
28
|
+
extended: {
|
|
29
|
+
ks0D6T: "x193iq5w",
|
|
30
|
+
$$css: true
|
|
31
|
+
},
|
|
28
32
|
focused: {
|
|
29
33
|
kKwaWg: "x17vw94z",
|
|
30
34
|
$$css: true
|
|
@@ -41,6 +45,14 @@ const fabStyles = {
|
|
|
41
45
|
kjj79g: "xl56j7k",
|
|
42
46
|
$$css: true
|
|
43
47
|
},
|
|
48
|
+
label: {
|
|
49
|
+
k7Eaqz: "xeuugli",
|
|
50
|
+
kXHlph: "x101abm8",
|
|
51
|
+
kORKVm: "xryxfnj",
|
|
52
|
+
kg5iWk: "xlyipyv",
|
|
53
|
+
khDVqt: "xuxw1ft",
|
|
54
|
+
$$css: true
|
|
55
|
+
},
|
|
44
56
|
pressed: {
|
|
45
57
|
kKwaWg: "xdiex0u",
|
|
46
58
|
kGVxlE: "x1udv5rz",
|
package/dist/fab/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["fabStyles","base","kGNEyG","kVAM5u","ksu8eU","kMzoRj","kGVxlE","kB7OPa","kkrTdU","k1xSpc","kmuXW","kjj79g","kmVPX3","kVAEAm","kybGjl","$$css","disabled","kWkggS","kKwaWg","kMwMTN","focused","hovered","icon","pressed","fabSizes","lg","kZKoxP","kaIpWk","kzqmXN","md","xl","extendedFabSizes","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","kg3NbH","fabIconSizes","tonal","primary","secondary","tertiary","filled","fabTones"],"sources":["../../src/fab/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, shadows, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The FAB's styles, shared by Fab and by the FAB that opens FabMenu, which is\n// the same button until its menu opens. Apart from either component, and\n// outside `src/components`, for the reason src/row gives. See Fab's header\n// for the values and where they come from.\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 medium FAB's container and corner, between the steps of the control\n// and radius scales.\nconst MEDIUM_SIZE = '80px';\nconst MEDIUM_CORNER = '20px';\nconst fabStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kVAM5u: \"x1ylmb6m\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\n kGVxlE: \"x1udv5rz\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n $$css: true\n },\n disabled: {\n kWkggS: \"xepofeg\",\n kKwaWg: \"x18o3ruo\",\n kVAM5u: \"xmnqt3w\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n focused: {\n kKwaWg: \"x17vw94z\",\n $$css: true\n },\n hovered: {\n kKwaWg: \"xbmfk57\",\n kGVxlE: \"x4r79n0\",\n $$css: true\n },\n icon: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n $$css: true\n },\n pressed: {\n kKwaWg: \"xdiex0u\",\n kGVxlE: \"x1udv5rz\",\n $$css: true\n }\n};\n\n// The FAB on its own: a square of the size's edge, at its corner.\nconst fabSizes = {\n lg: {\n kZKoxP: \"xwzfr38\",\n kaIpWk: \"x1m3ak92\",\n kzqmXN: \"x1dmp6jm\",\n $$css: true\n },\n md: {\n kZKoxP: \"xs1ryiz\",\n kaIpWk: \"xhpdng0\",\n kzqmXN: \"x1fh0d6s\",\n $$css: true\n },\n xl: {\n kZKoxP: \"x1xaimp3\",\n kaIpWk: \"x19pkqky\",\n kzqmXN: \"xszbqgh\",\n $$css: true\n }\n};\n\n// The extended form: the size's height and corner, with its padding, the gap\n// before the label and the label's type role.\nconst extendedFabSizes = {\n lg: {\n kZKoxP: \"xwzfr38\",\n kaIpWk: \"x1m3ak92\",\n kMv6JI: \"xdy5w5q\",\n kGuDYH: \"xete2z3\",\n k63SB2: \"x14ijtet\",\n kOIVth: \"x1gka490\",\n kb6lSQ: \"xug9e1u\",\n kLWn49: \"x2divse\",\n kg3NbH: \"xr244g7\",\n $$css: true\n },\n md: {\n kZKoxP: \"xs1ryiz\",\n kaIpWk: \"xhpdng0\",\n kMv6JI: \"x46eyla\",\n kGuDYH: \"x5ehqhr\",\n k63SB2: \"xrf6cl6\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x1g135zh\",\n kLWn49: \"x1ggk5va\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n xl: {\n kZKoxP: \"x1xaimp3\",\n kaIpWk: \"x19pkqky\",\n kMv6JI: \"x1fz0g89\",\n kGuDYH: \"xkb6epg\",\n k63SB2: \"x76yrz5\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"x1s1qhaa\",\n kLWn49: \"x1voeury\",\n kg3NbH: \"x1pbfunf\",\n $$css: true\n }\n};\n\n// The icon each size draws.\nconst fabIconSizes = {\n lg: {\n kGuDYH: \"xneq65o\",\n $$css: true\n },\n md: {\n kGuDYH: \"x1pvqxga\",\n $$css: true\n },\n xl: {\n kGuDYH: \"xqozcyj\",\n $$css: true\n }\n};\n\n// The six colour pairs: each tone's container pair, and the tone itself.\nconst tonal = {\n primary: {\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n }\n};\nconst filled = {\n primary: {\n kWkggS: \"xnety89\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x167r6xl\",\n kMwMTN: \"x1lba3jz\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"x14t7u9f\",\n kMwMTN: \"x1007ibn\",\n $$css: true\n }\n};\nconst fabTones = {\n filled,\n tonal\n};\nexport { extendedFabSizes, fabIconSizes, fabSizes, fabStyles, fabTones };"],"mappings":";AAmBA,MAAMA,YAAY;CAChBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRf,QAAQ;EACRG,QAAQ;EACRa,QAAQ;EACRX,QAAQ;EACRO,OAAO;CACT;CACAK,SAAS;
|
|
1
|
+
{"version":3,"file":"styles.js","names":["fabStyles","base","kGNEyG","kVAM5u","ksu8eU","kMzoRj","kGVxlE","kB7OPa","kkrTdU","k1xSpc","kmuXW","kjj79g","kmVPX3","kVAEAm","kybGjl","$$css","disabled","kWkggS","kKwaWg","kMwMTN","extended","ks0D6T","focused","hovered","icon","label","k7Eaqz","kXHlph","kORKVm","kg5iWk","khDVqt","pressed","fabSizes","lg","kZKoxP","kaIpWk","kzqmXN","md","xl","extendedFabSizes","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","kg3NbH","fabIconSizes","tonal","primary","secondary","tertiary","filled","fabTones"],"sources":["../../src/fab/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, shadows, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The FAB's styles, shared by Fab and by the FAB that opens FabMenu, which is\n// the same button until its menu opens. Apart from either component, and\n// outside `src/components`, for the reason src/row gives. See Fab's header\n// for the values and where they come from.\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 medium FAB's container and corner, between the steps of the control\n// and radius scales.\nconst MEDIUM_SIZE = '80px';\nconst MEDIUM_CORNER = '20px';\nconst fabStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kVAM5u: \"x1ylmb6m\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\n kGVxlE: \"x1udv5rz\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n $$css: true\n },\n disabled: {\n kWkggS: \"xepofeg\",\n kKwaWg: \"x18o3ruo\",\n kVAM5u: \"xmnqt3w\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n extended: {\n ks0D6T: \"x193iq5w\",\n $$css: true\n },\n focused: {\n kKwaWg: \"x17vw94z\",\n $$css: true\n },\n hovered: {\n kKwaWg: \"xbmfk57\",\n kGVxlE: \"x4r79n0\",\n $$css: true\n },\n icon: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n $$css: true\n },\n label: {\n k7Eaqz: \"xeuugli\",\n kXHlph: \"x101abm8\",\n kORKVm: \"xryxfnj\",\n kg5iWk: \"xlyipyv\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n pressed: {\n kKwaWg: \"xdiex0u\",\n kGVxlE: \"x1udv5rz\",\n $$css: true\n }\n};\n\n// The FAB on its own: a square of the size's edge, at its corner.\nconst fabSizes = {\n lg: {\n kZKoxP: \"xwzfr38\",\n kaIpWk: \"x1m3ak92\",\n kzqmXN: \"x1dmp6jm\",\n $$css: true\n },\n md: {\n kZKoxP: \"xs1ryiz\",\n kaIpWk: \"xhpdng0\",\n kzqmXN: \"x1fh0d6s\",\n $$css: true\n },\n xl: {\n kZKoxP: \"x1xaimp3\",\n kaIpWk: \"x19pkqky\",\n kzqmXN: \"xszbqgh\",\n $$css: true\n }\n};\n\n// The extended form: the size's height and corner, with its padding, the gap\n// before the label and the label's type role.\nconst extendedFabSizes = {\n lg: {\n kZKoxP: \"xwzfr38\",\n kaIpWk: \"x1m3ak92\",\n kMv6JI: \"xdy5w5q\",\n kGuDYH: \"xete2z3\",\n k63SB2: \"x14ijtet\",\n kOIVth: \"x1gka490\",\n kb6lSQ: \"xug9e1u\",\n kLWn49: \"x2divse\",\n kg3NbH: \"xr244g7\",\n $$css: true\n },\n md: {\n kZKoxP: \"xs1ryiz\",\n kaIpWk: \"xhpdng0\",\n kMv6JI: \"x46eyla\",\n kGuDYH: \"x5ehqhr\",\n k63SB2: \"xrf6cl6\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x1g135zh\",\n kLWn49: \"x1ggk5va\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n xl: {\n kZKoxP: \"x1xaimp3\",\n kaIpWk: \"x19pkqky\",\n kMv6JI: \"x1fz0g89\",\n kGuDYH: \"xkb6epg\",\n k63SB2: \"x76yrz5\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"x1s1qhaa\",\n kLWn49: \"x1voeury\",\n kg3NbH: \"x1pbfunf\",\n $$css: true\n }\n};\n\n// The icon each size draws.\nconst fabIconSizes = {\n lg: {\n kGuDYH: \"xneq65o\",\n $$css: true\n },\n md: {\n kGuDYH: \"x1pvqxga\",\n $$css: true\n },\n xl: {\n kGuDYH: \"xqozcyj\",\n $$css: true\n }\n};\n\n// The six colour pairs: each tone's container pair, and the tone itself.\nconst tonal = {\n primary: {\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n }\n};\nconst filled = {\n primary: {\n kWkggS: \"xnety89\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x167r6xl\",\n kMwMTN: \"x1lba3jz\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"x14t7u9f\",\n kMwMTN: \"x1007ibn\",\n $$css: true\n }\n};\nconst fabTones = {\n filled,\n tonal\n};\nexport { extendedFabSizes, fabIconSizes, fabSizes, fabStyles, fabTones };"],"mappings":";AAmBA,MAAMA,YAAY;CAChBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ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RC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACR/B,OAAO;CACT;AACF;AAGA,MAAMgC,eAAe;CACnBd,IAAI;EACFQ,QAAQ;EACR1B,OAAO;CACT;CACAsB,IAAI;EACFI,QAAQ;EACR1B,OAAO;CACT;CACAuB,IAAI;EACFG,QAAQ;EACR1B,OAAO;CACT;AACF;AAqCA,MAAMsC,WAAW;CACfD,QAAAA;EAjBAH,SAAS;GACPhC,QAAQ;GACRE,QAAQ;GACRJ,OAAO;EACT;EACAmC,WAAW;GACTjC,QAAQ;GACRE,QAAQ;GACRJ,OAAO;EACT;EACAoC,UAAU;GACRlC,QAAQ;GACRE,QAAQ;GACRJ,OAAO;EACT;CAGAqC;CACAJ,OAAAA;EAnCAC,SAAS;GACPhC,QAAQ;GACRE,QAAQ;GACRJ,OAAO;EACT;EACAmC,WAAW;GACTjC,QAAQ;GACRE,QAAQ;GACRJ,OAAO;EACT;EACAoC,UAAU;GACRlC,QAAQ;GACRE,QAAQ;GACRJ,OAAO;EACT;CAqBAiC;AACF"}
|
package/dist/field/styles.js
CHANGED
|
@@ -31,6 +31,7 @@ const fieldChromeStyles = {
|
|
|
31
31
|
},
|
|
32
32
|
autosize: {
|
|
33
33
|
k1xSpc: "xrvj5dj",
|
|
34
|
+
kumcoG: "x1mkdm3x",
|
|
34
35
|
$$css: true
|
|
35
36
|
},
|
|
36
37
|
autosizeCell: {
|
|
@@ -295,7 +296,7 @@ const fieldChromeStyles = {
|
|
|
295
296
|
},
|
|
296
297
|
inputDisabled: {
|
|
297
298
|
k8Qsv1: "x7ip5l3",
|
|
298
|
-
kMwMTN: "x1xj74d8",
|
|
299
|
+
kMwMTN: "x1xj74d8 x1bhcspo",
|
|
299
300
|
$$css: true
|
|
300
301
|
},
|
|
301
302
|
inputInvalid: {
|
|
@@ -498,7 +499,6 @@ const fieldChromeStyles = {
|
|
|
498
499
|
kGNEyG: "x6s0dn4",
|
|
499
500
|
k1xSpc: "x78zum5",
|
|
500
501
|
kVQacm: "xb3r6kr",
|
|
501
|
-
kg5iWk: "xlyipyv",
|
|
502
502
|
khDVqt: "xuxw1ft",
|
|
503
503
|
$$css: true
|
|
504
504
|
},
|