@kanso-labs/kanso-ui 0.40.7 → 0.40.8
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/badge/index.js +15 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/components/badge/index.js +91 -47
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +6 -1
- package/dist/components/dialog/index.js +54 -24
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/form/index.d.ts +5 -4
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/link/index.js +16 -5
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/menu/index.js +29 -21
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-bar/index.js +134 -54
- package/dist/components/navigation-bar/index.js.map +1 -1
- package/dist/components/navigation-rail/index.js +56 -37
- package/dist/components/navigation-rail/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +13 -2
- package/dist/components/number-field/index.js +95 -84
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +8 -1
- package/dist/components/sheet/index.js +45 -29
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +4 -0
- package/dist/components/snackbar/index.js +54 -49
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/field/index.js +303 -252
- package/dist/field/index.js.map +1 -1
- package/dist/field/root.js +8 -8
- package/dist/field/root.js.map +1 -1
- package/dist/field/styles.js +22 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/hooks/useBottomEdge.js +83 -0
- package/dist/hooks/useBottomEdge.js.map +1 -0
- package/dist/navigation/context.js.map +1 -1
- package/dist/navigation/index.js +16 -4
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/styles.js +35 -1
- package/dist/navigation/styles.js.map +1 -1
- package/dist/row/styles.js +2 -1
- package/dist/row/styles.js.map +1 -1
- package/dist/styles.css +90 -24
- package/package.json +2 -2
package/dist/field/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { props } from "../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
|
+
import { spacing } from "../tokens/design.tokens.stylex.js";
|
|
2
3
|
import { mergeStatefulStyles, mergeStyles } from "../styles/merge.js";
|
|
3
4
|
import { useMessages } from "../i18n/index.js";
|
|
4
5
|
import { useInsideForm } from "./root.js";
|
|
@@ -35,8 +36,9 @@ const BOX_CONTROLS = {
|
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
38
|
const BoxContext = createContext(OUTSIDE_BOX);
|
|
38
|
-
function boxContent(label, children, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
|
|
39
|
+
function boxContent(label, children, endInset, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant) {
|
|
39
40
|
return (state) => /* @__PURE__ */ jsx(BoxContent, {
|
|
41
|
+
endInset,
|
|
40
42
|
floatingLabel,
|
|
41
43
|
isFocused,
|
|
42
44
|
isPopulated,
|
|
@@ -59,8 +61,8 @@ function boxContent(label, children, floatingLabel, isFocused, isPopulated, isRe
|
|
|
59
61
|
* for them. See the outlined variant's note above.
|
|
60
62
|
*/
|
|
61
63
|
function BoxContent(t0) {
|
|
62
|
-
const $ = c(
|
|
63
|
-
const { children, floatingLabel, isFocused, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
|
|
64
|
+
const $ = c(47);
|
|
65
|
+
const { children, endInset, floatingLabel, isFocused, isPopulated, isRequired, label, leading, multiline, state, trailing, trigger, variant } = t0;
|
|
64
66
|
const read = useFieldPopulated();
|
|
65
67
|
const populated = isPopulated ?? read;
|
|
66
68
|
const outlined = variant === "outlined";
|
|
@@ -68,98 +70,100 @@ function BoxContent(t0) {
|
|
|
68
70
|
const floated = !floatingLabel || focused || populated;
|
|
69
71
|
const t1 = BOX_CONTROLS[variant][floatingLabel ? "floating" : "fixed"];
|
|
70
72
|
let t2;
|
|
71
|
-
if ($[0] !==
|
|
73
|
+
if ($[0] !== endInset || $[1] !== floated || $[2] !== focused || $[3] !== isRequired || $[4] !== label || $[5] !== leading || $[6] !== outlined || $[7] !== trailing) {
|
|
72
74
|
t2 = outlined ? /* @__PURE__ */ jsx("fieldset", {
|
|
73
75
|
"aria-hidden": "true",
|
|
74
|
-
...props(fieldChromeStyles.outline, leading !== void 0 && fieldChromeStyles.outlineLeading, trailing !== void 0 && fieldChromeStyles.outlineTrailing, focused && fieldChromeStyles.outlineFocused),
|
|
76
|
+
...props(fieldChromeStyles.outline, leading !== void 0 && fieldChromeStyles.outlineLeading, trailing !== void 0 && fieldChromeStyles.outlineTrailing, focused && fieldChromeStyles.outlineFocused, endInset !== "0px" && fieldChromeStyles.outlineEndInset(`calc(${spacing.lg} - ${spacing.xs} + ${endInset})`)),
|
|
75
77
|
children: /* @__PURE__ */ jsx("legend", {
|
|
76
78
|
...props(fieldChromeStyles.outlineNotch, floated && fieldChromeStyles.outlineNotchOpen),
|
|
77
79
|
children: floated ? /* @__PURE__ */ jsxs(Fragment$1, { children: [label, isRequired ? REQUIRED_MARK : null] }) : null
|
|
78
80
|
})
|
|
79
81
|
}) : null;
|
|
80
|
-
$[0] =
|
|
81
|
-
$[1] =
|
|
82
|
-
$[2] =
|
|
83
|
-
$[3] =
|
|
84
|
-
$[4] =
|
|
85
|
-
$[5] =
|
|
86
|
-
$[6] =
|
|
87
|
-
$[7] =
|
|
88
|
-
|
|
82
|
+
$[0] = endInset;
|
|
83
|
+
$[1] = floated;
|
|
84
|
+
$[2] = focused;
|
|
85
|
+
$[3] = isRequired;
|
|
86
|
+
$[4] = label;
|
|
87
|
+
$[5] = leading;
|
|
88
|
+
$[6] = outlined;
|
|
89
|
+
$[7] = trailing;
|
|
90
|
+
$[8] = t2;
|
|
91
|
+
} else t2 = $[8];
|
|
89
92
|
let t3;
|
|
90
|
-
if ($[
|
|
93
|
+
if ($[9] !== leading || $[10] !== multiline || $[11] !== outlined || $[12] !== state.isDisabled) {
|
|
91
94
|
t3 = leading === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
92
95
|
...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isDisabled && fieldChromeStyles.iconDisabled),
|
|
93
96
|
children: leading
|
|
94
97
|
});
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
} else t3 = $[
|
|
98
|
+
$[9] = leading;
|
|
99
|
+
$[10] = multiline;
|
|
100
|
+
$[11] = outlined;
|
|
101
|
+
$[12] = state.isDisabled;
|
|
102
|
+
$[13] = t3;
|
|
103
|
+
} else t3 = $[13];
|
|
101
104
|
let t4;
|
|
102
|
-
if ($[
|
|
105
|
+
if ($[14] !== floatingLabel || $[15] !== state.isDisabled) {
|
|
103
106
|
t4 = props(fieldChromeStyles.column, floatingLabel && fieldChromeStyles.columnFloating, state.isDisabled && (floatingLabel ? fieldChromeStyles.columnDisabledFloating : fieldChromeStyles.columnDisabled));
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
} else t4 = $[
|
|
107
|
+
$[14] = floatingLabel;
|
|
108
|
+
$[15] = state.isDisabled;
|
|
109
|
+
$[16] = t4;
|
|
110
|
+
} else t4 = $[16];
|
|
108
111
|
let t5;
|
|
109
|
-
if ($[
|
|
112
|
+
if ($[17] !== focused || $[18] !== state) {
|
|
110
113
|
t5 = withFocus(state, focused);
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
} else t5 = $[
|
|
114
|
+
$[17] = focused;
|
|
115
|
+
$[18] = state;
|
|
116
|
+
$[19] = t5;
|
|
117
|
+
} else t5 = $[19];
|
|
115
118
|
let t6;
|
|
116
|
-
if ($[
|
|
117
|
-
t6 = props(fieldChromeStyles.boxLabel, floatingLabel && floated && fieldChromeStyles.boxLabelFloated, outlined && fieldChromeStyles.boxLabelOutlined, outlined && floated && fieldChromeStyles.boxLabelOutlinedFloated);
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
|
|
119
|
+
if ($[20] !== endInset || $[21] !== floated || $[22] !== floatingLabel || $[23] !== outlined) {
|
|
120
|
+
t6 = props(fieldChromeStyles.boxLabel, floatingLabel && floated && fieldChromeStyles.boxLabelFloated, outlined && fieldChromeStyles.boxLabelOutlined, outlined && floated && fieldChromeStyles.boxLabelOutlinedFloated, endInset !== "0px" && fieldChromeStyles.boxLabelEndInset(outlined ? `calc(100% + 2 * ${spacing.xs} - ${endInset})` : `calc(100% - ${endInset})`));
|
|
121
|
+
$[20] = endInset;
|
|
122
|
+
$[21] = floated;
|
|
123
|
+
$[22] = floatingLabel;
|
|
124
|
+
$[23] = outlined;
|
|
125
|
+
$[24] = t6;
|
|
126
|
+
} else t6 = $[24];
|
|
123
127
|
let t7;
|
|
124
|
-
if ($[
|
|
128
|
+
if ($[25] !== isRequired || $[26] !== label || $[27] !== t5 || $[28] !== t6) {
|
|
125
129
|
t7 = /* @__PURE__ */ jsx(FieldLabel, {
|
|
126
130
|
isRequired,
|
|
127
131
|
state: t5,
|
|
128
132
|
...t6,
|
|
129
133
|
children: label
|
|
130
134
|
});
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
} else t7 = $[
|
|
135
|
+
$[25] = isRequired;
|
|
136
|
+
$[26] = label;
|
|
137
|
+
$[27] = t5;
|
|
138
|
+
$[28] = t6;
|
|
139
|
+
$[29] = t7;
|
|
140
|
+
} else t7 = $[29];
|
|
137
141
|
let t8;
|
|
138
|
-
if ($[
|
|
142
|
+
if ($[30] !== children || $[31] !== t4 || $[32] !== t7) {
|
|
139
143
|
t8 = /* @__PURE__ */ jsxs("div", {
|
|
140
144
|
...t4,
|
|
141
145
|
children: [t7, children]
|
|
142
146
|
});
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
} else t8 = $[
|
|
147
|
+
$[30] = children;
|
|
148
|
+
$[31] = t4;
|
|
149
|
+
$[32] = t7;
|
|
150
|
+
$[33] = t8;
|
|
151
|
+
} else t8 = $[33];
|
|
148
152
|
let t9;
|
|
149
|
-
if ($[
|
|
153
|
+
if ($[34] !== multiline || $[35] !== outlined || $[36] !== state.isDisabled || $[37] !== state.isInvalid || $[38] !== trailing) {
|
|
150
154
|
t9 = trailing === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
151
155
|
...props(fieldChromeStyles.icon, multiline && fieldChromeStyles.iconMultiline, outlined && fieldChromeStyles.iconOutlined, state.isInvalid && fieldChromeStyles.iconError, state.isDisabled && fieldChromeStyles.iconDisabled),
|
|
152
156
|
children: trailing
|
|
153
157
|
});
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
} else t9 = $[
|
|
158
|
+
$[34] = multiline;
|
|
159
|
+
$[35] = outlined;
|
|
160
|
+
$[36] = state.isDisabled;
|
|
161
|
+
$[37] = state.isInvalid;
|
|
162
|
+
$[38] = trailing;
|
|
163
|
+
$[39] = t9;
|
|
164
|
+
} else t9 = $[39];
|
|
161
165
|
let t10;
|
|
162
|
-
if ($[
|
|
166
|
+
if ($[40] !== t1 || $[41] !== t2 || $[42] !== t3 || $[43] !== t8 || $[44] !== t9 || $[45] !== trigger) {
|
|
163
167
|
t10 = /* @__PURE__ */ jsxs(BoxContext, {
|
|
164
168
|
value: t1,
|
|
165
169
|
children: [
|
|
@@ -170,14 +174,14 @@ function BoxContent(t0) {
|
|
|
170
174
|
t9
|
|
171
175
|
]
|
|
172
176
|
});
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
} else t10 = $[
|
|
177
|
+
$[40] = t1;
|
|
178
|
+
$[41] = t2;
|
|
179
|
+
$[42] = t3;
|
|
180
|
+
$[43] = t8;
|
|
181
|
+
$[44] = t9;
|
|
182
|
+
$[45] = trigger;
|
|
183
|
+
$[46] = t10;
|
|
184
|
+
} else t10 = $[46];
|
|
181
185
|
return t10;
|
|
182
186
|
}
|
|
183
187
|
function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, variant) {
|
|
@@ -185,6 +189,29 @@ function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, varia
|
|
|
185
189
|
return (state) => props(fieldChromeStyles.box, floatingLabel ? fieldChromeStyles.boxFloating : fieldChromeStyles.boxFixed, multiline && fieldChromeStyles.boxMultiline, leading && fieldChromeStyles.boxLeading, trailing && fieldChromeStyles.boxTrailing, outlined && fieldChromeStyles.boxOutlined, outlined && floatingLabel && fieldChromeStyles.boxOutlinedFloating, outlined && multiline && fieldChromeStyles.boxOutlinedMultiline, state.isInvalid && (outlined ? fieldChromeStyles.boxOutlinedError : fieldChromeStyles.boxError), outlined && state.isHovered && (state.isInvalid ? fieldChromeStyles.boxOutlinedErrorHovered : fieldChromeStyles.boxOutlinedHovered), isFocused && focusedStyle(outlined, state.isInvalid), state.isDisabled && (outlined ? fieldChromeStyles.boxOutlinedDisabled : fieldChromeStyles.boxDisabled));
|
|
186
190
|
}
|
|
187
191
|
/**
|
|
192
|
+
* The control's `onInput`, which also commits the field's validation while it
|
|
193
|
+
* shows an error, so an edit that fixes the value clears the error as it is
|
|
194
|
+
* typed rather than once focus leaves.
|
|
195
|
+
*
|
|
196
|
+
* React Aria commits a field's validation — the moment a server's error is
|
|
197
|
+
* cleared, or the browser's own is checked again — on the control's native
|
|
198
|
+
* `change` event, and a text control fires that only on blur. So a reader
|
|
199
|
+
* typing the fix saw the error, red and `aria-invalid`, until they tabbed
|
|
200
|
+
* away from a value that was already right. Re-dispatching `change` on input
|
|
201
|
+
* is what commits early, through React Aria's own listener.
|
|
202
|
+
*
|
|
203
|
+
* Only while the field is invalid. A valid field still commits on blur, so
|
|
204
|
+
* nothing new is flagged in the middle of typing a value: an error is shown
|
|
205
|
+
* late and taken back early. React's `onChange` does not run a second time
|
|
206
|
+
* for it, since the value it tracks has not moved since the input.
|
|
207
|
+
*/
|
|
208
|
+
function commitWhileInvalid(isInvalid, onInput) {
|
|
209
|
+
return (event) => {
|
|
210
|
+
onInput?.(event);
|
|
211
|
+
if (isInvalid) event.currentTarget.dispatchEvent(new Event("change", { bubbles: true }));
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
188
215
|
* The box a control sits in, filled or outlined, with its label. React
|
|
189
216
|
* Aria's `Group`, so
|
|
190
217
|
* the field around it hands down `isDisabled` and `isInvalid` through context
|
|
@@ -193,9 +220,10 @@ function boxStyles(floatingLabel, isFocused, multiline, leading, trailing, varia
|
|
|
193
220
|
* on a button rather than an input — passes the two states itself.
|
|
194
221
|
*/
|
|
195
222
|
function FieldBox(t0) {
|
|
196
|
-
const $ = c(
|
|
223
|
+
const $ = c(36);
|
|
197
224
|
let T0;
|
|
198
225
|
let children;
|
|
226
|
+
let endInset;
|
|
199
227
|
let floatingLabel;
|
|
200
228
|
let isFocused;
|
|
201
229
|
let isPopulated;
|
|
@@ -210,18 +238,19 @@ function FieldBox(t0) {
|
|
|
210
238
|
let trigger;
|
|
211
239
|
let variant;
|
|
212
240
|
if ($[0] !== t0) {
|
|
213
|
-
const { children: t4,
|
|
241
|
+
const { children: t4, endInset: t5, floatingLabel: t6, isFocused: t7, isPopulated: t8, isRequired: t9, label: t10, leading: t11, multiline: t12, trailing: t13, trigger: t14, variant: t15, ...props } = t0;
|
|
214
242
|
children = t4;
|
|
215
|
-
isPopulated =
|
|
216
|
-
label =
|
|
217
|
-
leading =
|
|
218
|
-
trailing =
|
|
219
|
-
trigger =
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
243
|
+
isPopulated = t8;
|
|
244
|
+
label = t10;
|
|
245
|
+
leading = t11;
|
|
246
|
+
trailing = t13;
|
|
247
|
+
trigger = t14;
|
|
248
|
+
endInset = t5 === void 0 ? "0px" : t5;
|
|
249
|
+
floatingLabel = t6 === void 0 ? true : t6;
|
|
250
|
+
isFocused = t7 === void 0 ? false : t7;
|
|
251
|
+
isRequired = t9 === void 0 ? false : t9;
|
|
252
|
+
multiline = t12 === void 0 ? false : t12;
|
|
253
|
+
variant = t15 === void 0 ? "filled" : t15;
|
|
225
254
|
T0 = Group;
|
|
226
255
|
t1 = props;
|
|
227
256
|
t2 = trigger === void 0 ? focusesControl(props.onPointerDown) : props.onPointerDown;
|
|
@@ -229,67 +258,70 @@ function FieldBox(t0) {
|
|
|
229
258
|
$[0] = t0;
|
|
230
259
|
$[1] = T0;
|
|
231
260
|
$[2] = children;
|
|
232
|
-
$[3] =
|
|
233
|
-
$[4] =
|
|
234
|
-
$[5] =
|
|
235
|
-
$[6] =
|
|
236
|
-
$[7] =
|
|
237
|
-
$[8] =
|
|
238
|
-
$[9] =
|
|
239
|
-
$[10] =
|
|
240
|
-
$[11] =
|
|
241
|
-
$[12] =
|
|
242
|
-
$[13] =
|
|
243
|
-
$[14] =
|
|
244
|
-
$[15] =
|
|
261
|
+
$[3] = endInset;
|
|
262
|
+
$[4] = floatingLabel;
|
|
263
|
+
$[5] = isFocused;
|
|
264
|
+
$[6] = isPopulated;
|
|
265
|
+
$[7] = isRequired;
|
|
266
|
+
$[8] = label;
|
|
267
|
+
$[9] = leading;
|
|
268
|
+
$[10] = multiline;
|
|
269
|
+
$[11] = t1;
|
|
270
|
+
$[12] = t2;
|
|
271
|
+
$[13] = t3;
|
|
272
|
+
$[14] = trailing;
|
|
273
|
+
$[15] = trigger;
|
|
274
|
+
$[16] = variant;
|
|
245
275
|
} else {
|
|
246
276
|
T0 = $[1];
|
|
247
277
|
children = $[2];
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
278
|
+
endInset = $[3];
|
|
279
|
+
floatingLabel = $[4];
|
|
280
|
+
isFocused = $[5];
|
|
281
|
+
isPopulated = $[6];
|
|
282
|
+
isRequired = $[7];
|
|
283
|
+
label = $[8];
|
|
284
|
+
leading = $[9];
|
|
285
|
+
multiline = $[10];
|
|
286
|
+
t1 = $[11];
|
|
287
|
+
t2 = $[12];
|
|
288
|
+
t3 = $[13];
|
|
289
|
+
trailing = $[14];
|
|
290
|
+
trigger = $[15];
|
|
291
|
+
variant = $[16];
|
|
261
292
|
}
|
|
262
293
|
let t4;
|
|
263
|
-
if ($[
|
|
264
|
-
t4 = boxContent(label, children, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant);
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
|
|
294
|
+
if ($[17] !== children || $[18] !== endInset || $[19] !== floatingLabel || $[20] !== isFocused || $[21] !== isPopulated || $[22] !== isRequired || $[23] !== label || $[24] !== leading || $[25] !== multiline || $[26] !== trailing || $[27] !== trigger || $[28] !== variant) {
|
|
295
|
+
t4 = boxContent(label, children, endInset, floatingLabel, isFocused, isPopulated, isRequired, leading, multiline, trailing, trigger, variant);
|
|
296
|
+
$[17] = children;
|
|
297
|
+
$[18] = endInset;
|
|
298
|
+
$[19] = floatingLabel;
|
|
299
|
+
$[20] = isFocused;
|
|
300
|
+
$[21] = isPopulated;
|
|
301
|
+
$[22] = isRequired;
|
|
302
|
+
$[23] = label;
|
|
303
|
+
$[24] = leading;
|
|
304
|
+
$[25] = multiline;
|
|
305
|
+
$[26] = trailing;
|
|
306
|
+
$[27] = trigger;
|
|
307
|
+
$[28] = variant;
|
|
308
|
+
$[29] = t4;
|
|
309
|
+
} else t4 = $[29];
|
|
278
310
|
let t5;
|
|
279
|
-
if ($[
|
|
311
|
+
if ($[30] !== T0 || $[31] !== t1 || $[32] !== t2 || $[33] !== t3 || $[34] !== t4) {
|
|
280
312
|
t5 = /* @__PURE__ */ jsx(T0, {
|
|
281
313
|
...t1,
|
|
282
314
|
onPointerDown: t2,
|
|
283
315
|
...t3,
|
|
284
316
|
children: t4
|
|
285
317
|
});
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
} else t5 = $[
|
|
318
|
+
$[30] = T0;
|
|
319
|
+
$[31] = t1;
|
|
320
|
+
$[32] = t2;
|
|
321
|
+
$[33] = t3;
|
|
322
|
+
$[34] = t4;
|
|
323
|
+
$[35] = t5;
|
|
324
|
+
} else t5 = $[35];
|
|
293
325
|
return t5;
|
|
294
326
|
}
|
|
295
327
|
const PRESSABLE = "a, button, input, textarea, select, [role=\"button\"], [contenteditable=\"true\"]";
|
|
@@ -305,76 +337,80 @@ const PRESSABLE = "a, button, input, textarea, select, [role=\"button\"], [conte
|
|
|
305
337
|
* placeholder it was given in every state.
|
|
306
338
|
*/
|
|
307
339
|
function FieldInput(t0) {
|
|
308
|
-
const $ = c(
|
|
309
|
-
const { numeric: t1, placeholder, prefix, suffix, ...props$
|
|
340
|
+
const $ = c(20);
|
|
341
|
+
const { numeric: t1, placeholder, prefix, suffix, ...props$1 } = t0;
|
|
310
342
|
const numeric = t1 === void 0 ? false : t1;
|
|
311
343
|
const box = useContext(BoxContext);
|
|
344
|
+
const validation = useContext(FieldErrorContext);
|
|
312
345
|
const T0 = Input;
|
|
313
346
|
const t2 = placeholder ?? (box.label === "floating" ? " " : void 0);
|
|
314
|
-
|
|
347
|
+
const t3 = commitWhileInvalid(validation?.isInvalid ?? false, props$1.onInput);
|
|
348
|
+
let t4;
|
|
315
349
|
if ($[0] !== box || $[1] !== numeric) {
|
|
316
|
-
|
|
350
|
+
t4 = (state) => props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, box.label === "floating" && fieldChromeStyles.inputUnderFloatingLabel, numeric && fieldChromeStyles.numeric, state.isDisabled && fieldChromeStyles.inputDisabled);
|
|
317
351
|
$[0] = box;
|
|
318
352
|
$[1] = numeric;
|
|
319
|
-
$[2] =
|
|
320
|
-
} else
|
|
321
|
-
const
|
|
322
|
-
let
|
|
323
|
-
if ($[3] !== T0 || $[4] !== props$
|
|
324
|
-
|
|
353
|
+
$[2] = t4;
|
|
354
|
+
} else t4 = $[2];
|
|
355
|
+
const t5 = mergeStatefulStyles(t4, props$1);
|
|
356
|
+
let t6;
|
|
357
|
+
if ($[3] !== T0 || $[4] !== props$1 || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
|
|
358
|
+
t6 = /* @__PURE__ */ jsx(T0, {
|
|
325
359
|
placeholder: t2,
|
|
326
|
-
...props$
|
|
327
|
-
|
|
360
|
+
...props$1,
|
|
361
|
+
onInput: t3,
|
|
362
|
+
...t5
|
|
328
363
|
});
|
|
329
364
|
$[3] = T0;
|
|
330
|
-
$[4] = props$
|
|
365
|
+
$[4] = props$1;
|
|
331
366
|
$[5] = t2;
|
|
332
|
-
$[6] =
|
|
367
|
+
$[6] = t3;
|
|
333
368
|
$[7] = t5;
|
|
334
|
-
} else t5 = $[7];
|
|
335
|
-
const control = t5;
|
|
336
|
-
if (prefix === void 0 && suffix === void 0) return control;
|
|
337
|
-
let t6;
|
|
338
|
-
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
339
|
-
t6 = props(fieldChromeStyles.affixLine);
|
|
340
369
|
$[8] = t6;
|
|
341
370
|
} else t6 = $[8];
|
|
371
|
+
const control = t6;
|
|
372
|
+
if (prefix === void 0 && suffix === void 0) return control;
|
|
342
373
|
let t7;
|
|
343
|
-
if ($[9]
|
|
344
|
-
t7 =
|
|
374
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
375
|
+
t7 = props(fieldChromeStyles.affixLine);
|
|
376
|
+
$[9] = t7;
|
|
377
|
+
} else t7 = $[9];
|
|
378
|
+
let t8;
|
|
379
|
+
if ($[10] !== box || $[11] !== prefix) {
|
|
380
|
+
t8 = prefix === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
345
381
|
...props(fieldChromeStyles.affix, box.underLabel && fieldChromeStyles.inputUnderLabel),
|
|
346
382
|
children: prefix
|
|
347
383
|
});
|
|
348
|
-
$[
|
|
349
|
-
$[
|
|
350
|
-
$[
|
|
351
|
-
} else
|
|
352
|
-
let
|
|
353
|
-
if ($[
|
|
354
|
-
|
|
384
|
+
$[10] = box;
|
|
385
|
+
$[11] = prefix;
|
|
386
|
+
$[12] = t8;
|
|
387
|
+
} else t8 = $[12];
|
|
388
|
+
let t9;
|
|
389
|
+
if ($[13] !== box || $[14] !== suffix) {
|
|
390
|
+
t9 = suffix === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
355
391
|
...props(fieldChromeStyles.affix, box.underLabel && fieldChromeStyles.inputUnderLabel),
|
|
356
392
|
children: suffix
|
|
357
393
|
});
|
|
358
|
-
$[
|
|
359
|
-
$[
|
|
360
|
-
$[
|
|
361
|
-
} else
|
|
362
|
-
let
|
|
363
|
-
if ($[
|
|
364
|
-
|
|
365
|
-
...
|
|
394
|
+
$[13] = box;
|
|
395
|
+
$[14] = suffix;
|
|
396
|
+
$[15] = t9;
|
|
397
|
+
} else t9 = $[15];
|
|
398
|
+
let t10;
|
|
399
|
+
if ($[16] !== control || $[17] !== t8 || $[18] !== t9) {
|
|
400
|
+
t10 = /* @__PURE__ */ jsxs("span", {
|
|
401
|
+
...t7,
|
|
366
402
|
children: [
|
|
367
|
-
|
|
403
|
+
t8,
|
|
368
404
|
control,
|
|
369
|
-
|
|
405
|
+
t9
|
|
370
406
|
]
|
|
371
407
|
});
|
|
372
|
-
$[
|
|
373
|
-
$[16] = t7;
|
|
408
|
+
$[16] = control;
|
|
374
409
|
$[17] = t8;
|
|
375
410
|
$[18] = t9;
|
|
376
|
-
|
|
377
|
-
|
|
411
|
+
$[19] = t10;
|
|
412
|
+
} else t10 = $[19];
|
|
413
|
+
return t10;
|
|
378
414
|
}
|
|
379
415
|
/**
|
|
380
416
|
* A date or a time's segments, in a {@link FieldBox}: React Aria's
|
|
@@ -425,70 +461,74 @@ function FieldSegments(t0) {
|
|
|
425
461
|
* of the two is taller.
|
|
426
462
|
*/
|
|
427
463
|
function FieldTextArea(t0) {
|
|
428
|
-
const $ = c(
|
|
464
|
+
const $ = c(18);
|
|
429
465
|
const { autosize: t1, placeholder, ...props$4 } = t0;
|
|
430
466
|
const autosize = t1 === void 0 ? false : t1;
|
|
431
467
|
const box = useContext(BoxContext);
|
|
432
468
|
const context = useSlottedContext(TextAreaContext);
|
|
469
|
+
const validation = useContext(FieldErrorContext);
|
|
433
470
|
const value = typeof context?.value === "string" ? context.value : "";
|
|
434
471
|
const T0 = TextArea;
|
|
435
472
|
const t2 = placeholder ?? (box.label === "floating" ? " " : void 0);
|
|
436
|
-
|
|
473
|
+
const t3 = commitWhileInvalid(validation?.isInvalid ?? false, props$4.onInput);
|
|
474
|
+
let t4;
|
|
437
475
|
if ($[0] !== autosize || $[1] !== box) {
|
|
438
|
-
|
|
476
|
+
t4 = (state) => props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, box.label === "floating" && fieldChromeStyles.inputUnderFloatingLabel, fieldChromeStyles.textArea, autosize && fieldChromeStyles.textAreaAutosize, autosize && fieldChromeStyles.autosizeCell, state.isDisabled && fieldChromeStyles.inputDisabled);
|
|
439
477
|
$[0] = autosize;
|
|
440
478
|
$[1] = box;
|
|
441
|
-
$[2] =
|
|
442
|
-
} else
|
|
443
|
-
const
|
|
444
|
-
let
|
|
445
|
-
if ($[3] !== T0 || $[4] !== props$4 || $[5] !== t2 || $[6] !==
|
|
446
|
-
|
|
479
|
+
$[2] = t4;
|
|
480
|
+
} else t4 = $[2];
|
|
481
|
+
const t5 = mergeStatefulStyles(t4, props$4);
|
|
482
|
+
let t6;
|
|
483
|
+
if ($[3] !== T0 || $[4] !== props$4 || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
|
|
484
|
+
t6 = /* @__PURE__ */ jsx(T0, {
|
|
447
485
|
placeholder: t2,
|
|
448
486
|
...props$4,
|
|
449
|
-
|
|
487
|
+
onInput: t3,
|
|
488
|
+
...t5
|
|
450
489
|
});
|
|
451
490
|
$[3] = T0;
|
|
452
491
|
$[4] = props$4;
|
|
453
492
|
$[5] = t2;
|
|
454
|
-
$[6] =
|
|
493
|
+
$[6] = t3;
|
|
455
494
|
$[7] = t5;
|
|
456
|
-
} else t5 = $[7];
|
|
457
|
-
const control = t5;
|
|
458
|
-
if (!autosize) return control;
|
|
459
|
-
let t6;
|
|
460
|
-
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
461
|
-
t6 = props(fieldChromeStyles.autosize);
|
|
462
495
|
$[8] = t6;
|
|
463
496
|
} else t6 = $[8];
|
|
497
|
+
const control = t6;
|
|
498
|
+
if (!autosize) return control;
|
|
464
499
|
let t7;
|
|
465
|
-
if ($[9]
|
|
466
|
-
t7 = props(fieldChromeStyles.
|
|
467
|
-
$[9] =
|
|
468
|
-
|
|
469
|
-
} else t7 = $[10];
|
|
500
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
501
|
+
t7 = props(fieldChromeStyles.autosize);
|
|
502
|
+
$[9] = t7;
|
|
503
|
+
} else t7 = $[9];
|
|
470
504
|
let t8;
|
|
471
|
-
if ($[
|
|
472
|
-
t8 =
|
|
505
|
+
if ($[10] !== box.underLabel) {
|
|
506
|
+
t8 = props(fieldChromeStyles.input, box.underLabel && fieldChromeStyles.inputUnderLabel, fieldChromeStyles.replica, fieldChromeStyles.autosizeCell);
|
|
507
|
+
$[10] = box.underLabel;
|
|
508
|
+
$[11] = t8;
|
|
509
|
+
} else t8 = $[11];
|
|
510
|
+
let t9;
|
|
511
|
+
if ($[12] !== t8 || $[13] !== value) {
|
|
512
|
+
t9 = /* @__PURE__ */ jsxs("div", {
|
|
473
513
|
"aria-hidden": "true",
|
|
474
|
-
...
|
|
514
|
+
...t8,
|
|
475
515
|
children: [value, " "]
|
|
476
516
|
});
|
|
477
|
-
$[
|
|
478
|
-
$[
|
|
479
|
-
$[
|
|
480
|
-
} else
|
|
481
|
-
let
|
|
482
|
-
if ($[
|
|
483
|
-
|
|
484
|
-
...
|
|
485
|
-
children: [control,
|
|
517
|
+
$[12] = t8;
|
|
518
|
+
$[13] = value;
|
|
519
|
+
$[14] = t9;
|
|
520
|
+
} else t9 = $[14];
|
|
521
|
+
let t10;
|
|
522
|
+
if ($[15] !== control || $[16] !== t9) {
|
|
523
|
+
t10 = /* @__PURE__ */ jsxs("div", {
|
|
524
|
+
...t7,
|
|
525
|
+
children: [control, t9]
|
|
486
526
|
});
|
|
487
|
-
$[
|
|
488
|
-
$[15] = t8;
|
|
527
|
+
$[15] = control;
|
|
489
528
|
$[16] = t9;
|
|
490
|
-
|
|
491
|
-
|
|
529
|
+
$[17] = t10;
|
|
530
|
+
} else t10 = $[17];
|
|
531
|
+
return t10;
|
|
492
532
|
}
|
|
493
533
|
/**
|
|
494
534
|
* The press target over a {@link FieldBox} whose whole surface opens
|
|
@@ -538,19 +578,19 @@ function FieldTrigger(props$5) {
|
|
|
538
578
|
*/
|
|
539
579
|
function FieldValue(t0) {
|
|
540
580
|
const $ = c(3);
|
|
541
|
-
const { isFocused: t1, isPlaceholder: t2, ...props$
|
|
581
|
+
const { isFocused: t1, isPlaceholder: t2, ...props$3 } = t0;
|
|
542
582
|
const isFocused = t1 === void 0 ? false : t1;
|
|
543
583
|
const isPlaceholder = t2 === void 0 ? false : t2;
|
|
544
584
|
const box = useContext(BoxContext);
|
|
545
585
|
const hidden = isPlaceholder && box.label === "floating" && !isFocused;
|
|
546
|
-
const t3 = mergeStyles(props(fieldChromeStyles.input, fieldChromeStyles.value, box.underLabel && fieldChromeStyles.inputUnderLabel, isPlaceholder && fieldChromeStyles.valuePlaceholder, hidden && fieldChromeStyles.valuePlaceholderHidden), props$
|
|
586
|
+
const t3 = mergeStyles(props(fieldChromeStyles.input, fieldChromeStyles.value, box.underLabel && fieldChromeStyles.inputUnderLabel, isPlaceholder && fieldChromeStyles.valuePlaceholder, hidden && fieldChromeStyles.valuePlaceholderHidden), props$3);
|
|
547
587
|
let t4;
|
|
548
|
-
if ($[0] !== props$
|
|
588
|
+
if ($[0] !== props$3 || $[1] !== t3) {
|
|
549
589
|
t4 = /* @__PURE__ */ jsx("span", {
|
|
550
|
-
...props$
|
|
590
|
+
...props$3,
|
|
551
591
|
...t3
|
|
552
592
|
});
|
|
553
|
-
$[0] = props$
|
|
593
|
+
$[0] = props$3;
|
|
554
594
|
$[1] = t3;
|
|
555
595
|
$[2] = t4;
|
|
556
596
|
} else t4 = $[2];
|
|
@@ -674,7 +714,7 @@ function FieldLabel(t0) {
|
|
|
674
714
|
* the field's validation state is read for.
|
|
675
715
|
*/
|
|
676
716
|
function FieldMessage(t0) {
|
|
677
|
-
const $ = c(
|
|
717
|
+
const $ = c(34);
|
|
678
718
|
const { characterCount: t1, characterLimitLabel, description, error, errorId, inset: t2, maxLength, reserve: t3 } = t0;
|
|
679
719
|
const characterCount = t1 === void 0 ? false : t1;
|
|
680
720
|
const inset = t2 === void 0 ? true : t2;
|
|
@@ -709,7 +749,7 @@ function FieldMessage(t0) {
|
|
|
709
749
|
$[5] = t5;
|
|
710
750
|
} else t5 = $[5];
|
|
711
751
|
const hidden = t5;
|
|
712
|
-
|
|
752
|
+
const collapsed = !invalid && description === void 0 && !characterCount && !(insideForm && reserve);
|
|
713
753
|
const value = input?.value ?? textArea?.value ?? "";
|
|
714
754
|
const length = String(value).length;
|
|
715
755
|
const hint = invalid ? void 0 : description;
|
|
@@ -754,53 +794,64 @@ function FieldMessage(t0) {
|
|
|
754
794
|
} else t8 = $[14];
|
|
755
795
|
const written = t8;
|
|
756
796
|
let t9;
|
|
757
|
-
if ($[15] !== inset) {
|
|
758
|
-
t9 = props(fieldChromeStyles.message, fieldChromeStyles.messageLine, inset && fieldChromeStyles.messageInset);
|
|
759
|
-
$[15] =
|
|
760
|
-
$[16] =
|
|
761
|
-
|
|
797
|
+
if ($[15] !== collapsed || $[16] !== inset) {
|
|
798
|
+
t9 = props(fieldChromeStyles.message, fieldChromeStyles.messageLine, inset && fieldChromeStyles.messageInset, collapsed && fieldChromeStyles.messageLineCollapsed);
|
|
799
|
+
$[15] = collapsed;
|
|
800
|
+
$[16] = inset;
|
|
801
|
+
$[17] = t9;
|
|
802
|
+
} else t9 = $[17];
|
|
762
803
|
let t10;
|
|
763
|
-
if ($[
|
|
764
|
-
t10 =
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
});
|
|
768
|
-
$[17] = error;
|
|
769
|
-
$[18] = validation;
|
|
770
|
-
$[19] = written;
|
|
771
|
-
$[20] = t10;
|
|
772
|
-
} else t10 = $[20];
|
|
804
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
805
|
+
t10 = props(fieldChromeStyles.messageRegion);
|
|
806
|
+
$[18] = t10;
|
|
807
|
+
} else t10 = $[18];
|
|
773
808
|
let t11;
|
|
774
|
-
if ($[
|
|
775
|
-
t11 =
|
|
809
|
+
if ($[19] !== error || $[20] !== validation || $[21] !== written) {
|
|
810
|
+
t11 = /* @__PURE__ */ jsx("span", {
|
|
811
|
+
"aria-atomic": "true",
|
|
812
|
+
"aria-live": "polite",
|
|
813
|
+
...t10,
|
|
814
|
+
children: validation === null && error !== void 0 ? written : /* @__PURE__ */ jsx(FieldError, {
|
|
815
|
+
...props(fieldChromeStyles.message, fieldChromeStyles.messageError),
|
|
816
|
+
children: error
|
|
817
|
+
})
|
|
818
|
+
});
|
|
819
|
+
$[19] = error;
|
|
820
|
+
$[20] = validation;
|
|
821
|
+
$[21] = written;
|
|
822
|
+
$[22] = t11;
|
|
823
|
+
} else t11 = $[22];
|
|
824
|
+
let t12;
|
|
825
|
+
if ($[23] !== characterCount || $[24] !== invalid || $[25] !== length || $[26] !== locale || $[27] !== maxLength) {
|
|
826
|
+
t12 = characterCount ? /* @__PURE__ */ jsx("span", {
|
|
776
827
|
"aria-hidden": "true",
|
|
777
828
|
...props(fieldChromeStyles.message, fieldChromeStyles.counter, invalid && fieldChromeStyles.messageError),
|
|
778
829
|
children: countIn(locale, length, maxLength)
|
|
779
830
|
}) : null;
|
|
780
|
-
$[
|
|
781
|
-
$[
|
|
782
|
-
$[
|
|
783
|
-
$[
|
|
784
|
-
$[
|
|
785
|
-
$[
|
|
786
|
-
} else
|
|
787
|
-
let
|
|
788
|
-
if ($[
|
|
789
|
-
|
|
831
|
+
$[23] = characterCount;
|
|
832
|
+
$[24] = invalid;
|
|
833
|
+
$[25] = length;
|
|
834
|
+
$[26] = locale;
|
|
835
|
+
$[27] = maxLength;
|
|
836
|
+
$[28] = t12;
|
|
837
|
+
} else t12 = $[28];
|
|
838
|
+
let t13;
|
|
839
|
+
if ($[29] !== described || $[30] !== t11 || $[31] !== t12 || $[32] !== t9) {
|
|
840
|
+
t13 = /* @__PURE__ */ jsxs("div", {
|
|
790
841
|
...t9,
|
|
791
842
|
children: [
|
|
792
|
-
|
|
843
|
+
t11,
|
|
793
844
|
described,
|
|
794
|
-
|
|
845
|
+
t12
|
|
795
846
|
]
|
|
796
847
|
});
|
|
797
|
-
$[
|
|
798
|
-
$[
|
|
799
|
-
$[29] = t11;
|
|
800
|
-
$[30] = t9;
|
|
848
|
+
$[29] = described;
|
|
849
|
+
$[30] = t11;
|
|
801
850
|
$[31] = t12;
|
|
802
|
-
|
|
803
|
-
|
|
851
|
+
$[32] = t9;
|
|
852
|
+
$[33] = t13;
|
|
853
|
+
} else t13 = $[33];
|
|
854
|
+
return t13;
|
|
804
855
|
}
|
|
805
856
|
/**
|
|
806
857
|
* The same asterisk for a label that is not a field's own — a checkbox's, a
|