@spark-ui/components 10.0.2 → 10.0.3
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/CHANGELOG.md +6 -0
- package/dist/checkbox/index.js +117 -478
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs +3 -4
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/{chunk-JC6KKYUQ.mjs → chunk-7BTJUYP3.mjs} +6 -5
- package/dist/{chunk-JC6KKYUQ.mjs.map → chunk-7BTJUYP3.mjs.map} +1 -1
- package/dist/combobox/index.js +301 -710
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +3 -5
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/dropdown/index.js +252 -662
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs +1 -4
- package/dist/dropdown/index.mjs.map +1 -1
- package/dist/form-field/index.mjs +373 -7
- package/dist/form-field/index.mjs.map +1 -1
- package/dist/input/index.js +47 -454
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +1 -3
- package/dist/radio-group/index.js +47 -553
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +3 -9
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/select/index.js +159 -569
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +1 -4
- package/dist/select/index.mjs.map +1 -1
- package/dist/stepper/index.js +110 -516
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +2 -5
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/switch/index.js +96 -545
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +3 -6
- package/dist/switch/index.mjs.map +1 -1
- package/dist/textarea/index.js +58 -465
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +1 -3
- package/dist/textarea/index.mjs.map +1 -1
- package/package.json +16 -6
- package/tsup.config.ts +2 -1
- package/dist/chunk-7PMPYEHJ.mjs +0 -379
- package/dist/chunk-7PMPYEHJ.mjs.map +0 -1
package/dist/stepper/index.js
CHANGED
|
@@ -24,9 +24,16 @@ __export(stepper_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(stepper_exports);
|
|
26
26
|
|
|
27
|
-
// src/
|
|
28
|
-
var
|
|
29
|
-
var
|
|
27
|
+
// src/stepper/Stepper.tsx
|
|
28
|
+
var import_form_field3 = require("@spark-ui/components/form-field");
|
|
29
|
+
var import_react6 = require("react");
|
|
30
|
+
|
|
31
|
+
// src/input/InputClearButton.tsx
|
|
32
|
+
var import_DeleteOutline = require("@spark-ui/icons/DeleteOutline");
|
|
33
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
34
|
+
|
|
35
|
+
// src/icon/Icon.tsx
|
|
36
|
+
var import_react2 = require("react");
|
|
30
37
|
|
|
31
38
|
// src/slot/Slot.tsx
|
|
32
39
|
var import_radix_ui = require("radix-ui");
|
|
@@ -45,122 +52,11 @@ var wrapPolymorphicSlot = (asChild, children, callback) => {
|
|
|
45
52
|
) : null;
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
// src/form-field/FormFieldContext.tsx
|
|
49
|
-
var import_react2 = require("react");
|
|
50
|
-
var FormFieldContext = (0, import_react2.createContext)(null);
|
|
51
|
-
var ID_PREFIX = ":form-field";
|
|
52
|
-
var useFormField = () => {
|
|
53
|
-
const context = (0, import_react2.useContext)(FormFieldContext);
|
|
54
|
-
if (!context) {
|
|
55
|
-
throw Error("useFormField must be used within a FormField provider");
|
|
56
|
-
}
|
|
57
|
-
return context;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// src/form-field/FormFieldProvider.tsx
|
|
61
|
-
var import_react3 = require("react");
|
|
62
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
63
|
-
var FormFieldProvider = ({
|
|
64
|
-
id,
|
|
65
|
-
name,
|
|
66
|
-
disabled = false,
|
|
67
|
-
readOnly = false,
|
|
68
|
-
state,
|
|
69
|
-
isRequired,
|
|
70
|
-
children
|
|
71
|
-
}) => {
|
|
72
|
-
const labelId = `${ID_PREFIX}-label-${(0, import_react3.useId)()}`;
|
|
73
|
-
const [messageIds, setMessageIds] = (0, import_react3.useState)([]);
|
|
74
|
-
const description = messageIds.length > 0 ? messageIds.join(" ") : void 0;
|
|
75
|
-
const handleMessageIdAdd = (0, import_react3.useCallback)((msgId) => {
|
|
76
|
-
setMessageIds((ids) => [...ids, msgId]);
|
|
77
|
-
}, []);
|
|
78
|
-
const handleMessageIdRemove = (0, import_react3.useCallback)((msgId) => {
|
|
79
|
-
setMessageIds((ids) => ids.filter((current) => current !== msgId));
|
|
80
|
-
}, []);
|
|
81
|
-
const value = (0, import_react3.useMemo)(() => {
|
|
82
|
-
const isInvalid = state === "error";
|
|
83
|
-
return {
|
|
84
|
-
id,
|
|
85
|
-
labelId,
|
|
86
|
-
name,
|
|
87
|
-
disabled,
|
|
88
|
-
readOnly,
|
|
89
|
-
state,
|
|
90
|
-
isRequired,
|
|
91
|
-
isInvalid,
|
|
92
|
-
description,
|
|
93
|
-
onMessageIdAdd: handleMessageIdAdd,
|
|
94
|
-
onMessageIdRemove: handleMessageIdRemove
|
|
95
|
-
};
|
|
96
|
-
}, [
|
|
97
|
-
id,
|
|
98
|
-
labelId,
|
|
99
|
-
name,
|
|
100
|
-
disabled,
|
|
101
|
-
readOnly,
|
|
102
|
-
description,
|
|
103
|
-
state,
|
|
104
|
-
isRequired,
|
|
105
|
-
handleMessageIdAdd,
|
|
106
|
-
handleMessageIdRemove
|
|
107
|
-
]);
|
|
108
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FormFieldContext.Provider, { value, children });
|
|
109
|
-
};
|
|
110
|
-
FormFieldProvider.displayName = "FormFieldProvider";
|
|
111
|
-
|
|
112
|
-
// src/form-field/FormField.tsx
|
|
113
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
114
|
-
var FormField = ({
|
|
115
|
-
className,
|
|
116
|
-
disabled = false,
|
|
117
|
-
readOnly = false,
|
|
118
|
-
name,
|
|
119
|
-
state,
|
|
120
|
-
isRequired = false,
|
|
121
|
-
asChild = false,
|
|
122
|
-
ref,
|
|
123
|
-
...others
|
|
124
|
-
}) => {
|
|
125
|
-
const id = `${ID_PREFIX}-${(0, import_react4.useId)()}`;
|
|
126
|
-
const Component = asChild ? Slot : "div";
|
|
127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
128
|
-
FormFieldProvider,
|
|
129
|
-
{
|
|
130
|
-
id,
|
|
131
|
-
name,
|
|
132
|
-
isRequired,
|
|
133
|
-
disabled,
|
|
134
|
-
readOnly,
|
|
135
|
-
state,
|
|
136
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
137
|
-
Component,
|
|
138
|
-
{
|
|
139
|
-
ref,
|
|
140
|
-
"data-spark-component": "form-field",
|
|
141
|
-
className: (0, import_class_variance_authority.cx)(className, "gap-sm flex flex-col"),
|
|
142
|
-
...others
|
|
143
|
-
}
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
};
|
|
148
|
-
FormField.displayName = "FormField";
|
|
149
|
-
|
|
150
|
-
// src/form-field/FormFieldStateMessage.tsx
|
|
151
|
-
var import_AlertOutline = require("@spark-ui/icons/AlertOutline");
|
|
152
|
-
var import_Check = require("@spark-ui/icons/Check");
|
|
153
|
-
var import_WarningOutline = require("@spark-ui/icons/WarningOutline");
|
|
154
|
-
var import_class_variance_authority4 = require("class-variance-authority");
|
|
155
|
-
|
|
156
|
-
// src/icon/Icon.tsx
|
|
157
|
-
var import_react5 = require("react");
|
|
158
|
-
|
|
159
55
|
// src/visually-hidden/VisuallyHidden.tsx
|
|
160
|
-
var
|
|
56
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
161
57
|
var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
|
|
162
58
|
const Component = asChild ? Slot : "span";
|
|
163
|
-
return /* @__PURE__ */ (0,
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
164
60
|
Component,
|
|
165
61
|
{
|
|
166
62
|
...props,
|
|
@@ -186,8 +82,8 @@ VisuallyHidden.displayName = "VisuallyHidden";
|
|
|
186
82
|
|
|
187
83
|
// src/icon/Icon.styles.tsx
|
|
188
84
|
var import_internal_utils = require("@spark-ui/internal-utils");
|
|
189
|
-
var
|
|
190
|
-
var iconStyles = (0,
|
|
85
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
86
|
+
var iconStyles = (0, import_class_variance_authority.cva)(["fill-current shrink-0"], {
|
|
191
87
|
variants: {
|
|
192
88
|
/**
|
|
193
89
|
* Color scheme of the icon.
|
|
@@ -218,7 +114,7 @@ var iconStyles = (0, import_class_variance_authority2.cva)(["fill-current shrink
|
|
|
218
114
|
});
|
|
219
115
|
|
|
220
116
|
// src/icon/Icon.tsx
|
|
221
|
-
var
|
|
117
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
222
118
|
var Icon = ({
|
|
223
119
|
label,
|
|
224
120
|
className,
|
|
@@ -227,336 +123,30 @@ var Icon = ({
|
|
|
227
123
|
children,
|
|
228
124
|
...others
|
|
229
125
|
}) => {
|
|
230
|
-
const child =
|
|
231
|
-
return /* @__PURE__ */ (0,
|
|
232
|
-
(0,
|
|
126
|
+
const child = import_react2.Children.only(children);
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
128
|
+
(0, import_react2.cloneElement)(child, {
|
|
233
129
|
className: iconStyles({ className, size, intent }),
|
|
234
130
|
"data-spark-component": "icon",
|
|
235
131
|
"aria-hidden": "true",
|
|
236
132
|
focusable: "false",
|
|
237
133
|
...others
|
|
238
134
|
}),
|
|
239
|
-
label && /* @__PURE__ */ (0,
|
|
135
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(VisuallyHidden, { children: label })
|
|
240
136
|
] });
|
|
241
137
|
};
|
|
242
138
|
Icon.displayName = "Icon";
|
|
243
139
|
|
|
244
|
-
// src/form-field/FormFieldMessage.tsx
|
|
245
|
-
var import_class_variance_authority3 = require("class-variance-authority");
|
|
246
|
-
var import_react6 = require("react");
|
|
247
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
248
|
-
var FormFieldMessage = ({
|
|
249
|
-
id: idProp,
|
|
250
|
-
className,
|
|
251
|
-
ref,
|
|
252
|
-
...others
|
|
253
|
-
}) => {
|
|
254
|
-
const { onMessageIdAdd, onMessageIdRemove } = useFormField();
|
|
255
|
-
const currentId = `${ID_PREFIX}-message-${(0, import_react6.useId)()}`;
|
|
256
|
-
const id = idProp || currentId;
|
|
257
|
-
(0, import_react6.useEffect)(() => {
|
|
258
|
-
onMessageIdAdd(id);
|
|
259
|
-
return () => {
|
|
260
|
-
onMessageIdRemove(id);
|
|
261
|
-
};
|
|
262
|
-
}, [id, onMessageIdAdd, onMessageIdRemove]);
|
|
263
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
264
|
-
"span",
|
|
265
|
-
{
|
|
266
|
-
ref,
|
|
267
|
-
id,
|
|
268
|
-
"data-spark-component": "form-field-message",
|
|
269
|
-
className: (0, import_class_variance_authority3.cx)(className, "text-caption"),
|
|
270
|
-
...others
|
|
271
|
-
}
|
|
272
|
-
);
|
|
273
|
-
};
|
|
274
|
-
FormFieldMessage.displayName = "FormField.Message";
|
|
275
|
-
|
|
276
|
-
// src/form-field/FormFieldStateMessage.tsx
|
|
277
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
278
|
-
var FormFieldStateMessage = ({
|
|
279
|
-
className,
|
|
280
|
-
state,
|
|
281
|
-
children,
|
|
282
|
-
ref,
|
|
283
|
-
...others
|
|
284
|
-
}) => {
|
|
285
|
-
const field = useFormField();
|
|
286
|
-
if (field.state !== state) {
|
|
287
|
-
return null;
|
|
288
|
-
}
|
|
289
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
290
|
-
FormFieldMessage,
|
|
291
|
-
{
|
|
292
|
-
ref,
|
|
293
|
-
"data-spark-component": "form-field-state-message",
|
|
294
|
-
"aria-live": "polite",
|
|
295
|
-
className: (0, import_class_variance_authority4.cx)(
|
|
296
|
-
"gap-sm flex items-center",
|
|
297
|
-
state === "error" ? "text-error" : "text-on-surface/dim-1",
|
|
298
|
-
className
|
|
299
|
-
),
|
|
300
|
-
...others,
|
|
301
|
-
children: [
|
|
302
|
-
state === "alert" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_WarningOutline.WarningOutline, {}) }),
|
|
303
|
-
state === "error" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", intent: "error", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_AlertOutline.AlertOutline, {}) }),
|
|
304
|
-
state === "success" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Check.Check, {}) }),
|
|
305
|
-
children
|
|
306
|
-
]
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
};
|
|
310
|
-
FormFieldStateMessage.displayName = "FormField.StateMessage";
|
|
311
|
-
|
|
312
|
-
// src/form-field/FormFieldAlertMessage.tsx
|
|
313
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
314
|
-
var FormFieldAlertMessage = ({ ref, ...props }) => {
|
|
315
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
316
|
-
FormFieldStateMessage,
|
|
317
|
-
{
|
|
318
|
-
ref,
|
|
319
|
-
"data-spark-component": "form-field-alert-message",
|
|
320
|
-
state: "alert",
|
|
321
|
-
...props
|
|
322
|
-
}
|
|
323
|
-
);
|
|
324
|
-
};
|
|
325
|
-
FormFieldAlertMessage.displayName = "FormField.AlertMessage";
|
|
326
|
-
|
|
327
|
-
// src/form-field/FormFieldCharactersCount.tsx
|
|
328
|
-
var import_class_variance_authority5 = require("class-variance-authority");
|
|
329
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
330
|
-
var FormFieldCharactersCount = ({
|
|
331
|
-
className,
|
|
332
|
-
value = "",
|
|
333
|
-
maxLength,
|
|
334
|
-
ref,
|
|
335
|
-
...others
|
|
336
|
-
}) => {
|
|
337
|
-
const displayValue = `${value.length}/${maxLength}`;
|
|
338
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
339
|
-
"span",
|
|
340
|
-
{
|
|
341
|
-
ref,
|
|
342
|
-
"data-spark-component": "form-field-characters-count",
|
|
343
|
-
className: (0, import_class_variance_authority5.cx)(className, "text-caption", "text-neutral"),
|
|
344
|
-
...others,
|
|
345
|
-
children: displayValue
|
|
346
|
-
}
|
|
347
|
-
);
|
|
348
|
-
};
|
|
349
|
-
FormFieldCharactersCount.displayName = "FormField.CharactersCount";
|
|
350
|
-
|
|
351
|
-
// src/form-field/FormFieldControl.tsx
|
|
352
|
-
var import_react7 = require("react");
|
|
353
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
354
|
-
var useFormFieldControl = () => {
|
|
355
|
-
const { id, name, description, disabled, readOnly, state, labelId, isInvalid, isRequired } = (0, import_react7.useContext)(FormFieldContext) || {};
|
|
356
|
-
return {
|
|
357
|
-
id,
|
|
358
|
-
name,
|
|
359
|
-
description,
|
|
360
|
-
disabled,
|
|
361
|
-
readOnly,
|
|
362
|
-
state,
|
|
363
|
-
labelId,
|
|
364
|
-
isInvalid,
|
|
365
|
-
isRequired
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
|
-
var FormFieldControl = ({ children }) => {
|
|
369
|
-
const props = useFormFieldControl();
|
|
370
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: children(props) });
|
|
371
|
-
};
|
|
372
|
-
FormFieldControl.displayName = "FormField.Control";
|
|
373
|
-
|
|
374
|
-
// src/form-field/FormFieldErrorMessage.tsx
|
|
375
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
376
|
-
var FormFieldErrorMessage = ({ ref, ...props }) => {
|
|
377
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
378
|
-
FormFieldStateMessage,
|
|
379
|
-
{
|
|
380
|
-
ref,
|
|
381
|
-
"data-spark-component": "form-field-error-message",
|
|
382
|
-
state: "error",
|
|
383
|
-
...props
|
|
384
|
-
}
|
|
385
|
-
);
|
|
386
|
-
};
|
|
387
|
-
FormFieldErrorMessage.displayName = "FormField.ErrorMessage";
|
|
388
|
-
|
|
389
|
-
// src/form-field/FormFieldHelperMessage.tsx
|
|
390
|
-
var import_class_variance_authority6 = require("class-variance-authority");
|
|
391
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
392
|
-
var FormFieldHelperMessage = ({
|
|
393
|
-
className,
|
|
394
|
-
ref,
|
|
395
|
-
...others
|
|
396
|
-
}) => {
|
|
397
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
398
|
-
FormFieldMessage,
|
|
399
|
-
{
|
|
400
|
-
ref,
|
|
401
|
-
"data-spark-component": "form-field-helper-message",
|
|
402
|
-
className: (0, import_class_variance_authority6.cx)("text-on-surface/dim-1", className),
|
|
403
|
-
...others
|
|
404
|
-
}
|
|
405
|
-
);
|
|
406
|
-
};
|
|
407
|
-
FormFieldHelperMessage.displayName = "FormField.HelperMessage";
|
|
408
|
-
|
|
409
|
-
// src/form-field/FormFieldLabel.tsx
|
|
410
|
-
var import_class_variance_authority10 = require("class-variance-authority");
|
|
411
|
-
|
|
412
|
-
// src/label/Label.tsx
|
|
413
|
-
var import_class_variance_authority7 = require("class-variance-authority");
|
|
414
|
-
var import_radix_ui2 = require("radix-ui");
|
|
415
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
416
|
-
var Label = ({ className, ref, ...others }) => {
|
|
417
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
418
|
-
import_radix_ui2.Label.Label,
|
|
419
|
-
{
|
|
420
|
-
ref,
|
|
421
|
-
"data-spark-component": "label",
|
|
422
|
-
className: (0, import_class_variance_authority7.cx)("text-body-1", className),
|
|
423
|
-
...others
|
|
424
|
-
}
|
|
425
|
-
);
|
|
426
|
-
};
|
|
427
|
-
Label.displayName = "Label";
|
|
428
|
-
|
|
429
|
-
// src/label/LabelRequiredIndicator.tsx
|
|
430
|
-
var import_class_variance_authority8 = require("class-variance-authority");
|
|
431
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
432
|
-
var LabelRequiredIndicator = ({
|
|
433
|
-
className,
|
|
434
|
-
children = "*",
|
|
435
|
-
ref,
|
|
436
|
-
...others
|
|
437
|
-
}) => {
|
|
438
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
439
|
-
"span",
|
|
440
|
-
{
|
|
441
|
-
ref,
|
|
442
|
-
"data-spark-component": "label-required-indicator",
|
|
443
|
-
role: "presentation",
|
|
444
|
-
"aria-hidden": "true",
|
|
445
|
-
className: (0, import_class_variance_authority8.cx)(className, "text-caption text-on-surface/dim-1"),
|
|
446
|
-
...others,
|
|
447
|
-
children
|
|
448
|
-
}
|
|
449
|
-
);
|
|
450
|
-
};
|
|
451
|
-
LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
|
|
452
|
-
|
|
453
|
-
// src/label/index.ts
|
|
454
|
-
var Label2 = Object.assign(Label, {
|
|
455
|
-
RequiredIndicator: LabelRequiredIndicator
|
|
456
|
-
});
|
|
457
|
-
Label2.displayName = "Label";
|
|
458
|
-
LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
|
|
459
|
-
|
|
460
|
-
// src/form-field/FormFieldRequiredIndicator.tsx
|
|
461
|
-
var import_class_variance_authority9 = require("class-variance-authority");
|
|
462
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
463
|
-
var FormFieldRequiredIndicator = ({
|
|
464
|
-
className,
|
|
465
|
-
ref,
|
|
466
|
-
...props
|
|
467
|
-
}) => {
|
|
468
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label2.RequiredIndicator, { ref, className: (0, import_class_variance_authority9.cx)("ml-sm", className), ...props });
|
|
469
|
-
};
|
|
470
|
-
FormFieldRequiredIndicator.displayName = "FormField.RequiredIndicator";
|
|
471
|
-
|
|
472
|
-
// src/form-field/FormFieldLabel.tsx
|
|
473
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
474
|
-
var FormFieldLabel = ({
|
|
475
|
-
htmlFor: htmlForProp,
|
|
476
|
-
className,
|
|
477
|
-
children,
|
|
478
|
-
requiredIndicator = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FormFieldRequiredIndicator, {}),
|
|
479
|
-
asChild,
|
|
480
|
-
ref,
|
|
481
|
-
...others
|
|
482
|
-
}) => {
|
|
483
|
-
const control = useFormField();
|
|
484
|
-
const { disabled, labelId, isRequired } = control;
|
|
485
|
-
const htmlFor = asChild ? void 0 : htmlForProp || control.id;
|
|
486
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
487
|
-
Label2,
|
|
488
|
-
{
|
|
489
|
-
ref,
|
|
490
|
-
id: labelId,
|
|
491
|
-
"data-spark-component": "form-field-label",
|
|
492
|
-
htmlFor,
|
|
493
|
-
className: (0, import_class_variance_authority10.cx)(className, disabled ? "text-on-surface/dim-3 pointer-events-none" : void 0),
|
|
494
|
-
asChild,
|
|
495
|
-
...others,
|
|
496
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
497
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Slottable, { children }),
|
|
498
|
-
isRequired && requiredIndicator
|
|
499
|
-
] })
|
|
500
|
-
}
|
|
501
|
-
);
|
|
502
|
-
};
|
|
503
|
-
FormFieldLabel.displayName = "FormField.Label";
|
|
504
|
-
|
|
505
|
-
// src/form-field/FormFieldSuccessMessage.tsx
|
|
506
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
507
|
-
var FormFieldSuccessMessage = ({ ref, ...props }) => {
|
|
508
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
509
|
-
FormFieldStateMessage,
|
|
510
|
-
{
|
|
511
|
-
ref,
|
|
512
|
-
"data-spark-component": "form-field-success-message",
|
|
513
|
-
state: "success",
|
|
514
|
-
...props
|
|
515
|
-
}
|
|
516
|
-
);
|
|
517
|
-
};
|
|
518
|
-
FormFieldSuccessMessage.displayName = "FormField.SuccessMessage";
|
|
519
|
-
|
|
520
|
-
// src/form-field/index.ts
|
|
521
|
-
var FormField2 = Object.assign(FormField, {
|
|
522
|
-
Label: FormFieldLabel,
|
|
523
|
-
Control: FormFieldControl,
|
|
524
|
-
StateMessage: FormFieldStateMessage,
|
|
525
|
-
SuccessMessage: FormFieldSuccessMessage,
|
|
526
|
-
AlertMessage: FormFieldAlertMessage,
|
|
527
|
-
ErrorMessage: FormFieldErrorMessage,
|
|
528
|
-
HelperMessage: FormFieldHelperMessage,
|
|
529
|
-
RequiredIndicator: FormFieldRequiredIndicator,
|
|
530
|
-
CharactersCount: FormFieldCharactersCount
|
|
531
|
-
});
|
|
532
|
-
FormField2.displayName = "FormField";
|
|
533
|
-
FormFieldLabel.displayName = "FormField.Label";
|
|
534
|
-
FormFieldControl.displayName = "FormField.Control";
|
|
535
|
-
FormFieldStateMessage.displayName = "FormField.StateMessage";
|
|
536
|
-
FormFieldSuccessMessage.displayName = "FormField.SuccessMessage";
|
|
537
|
-
FormFieldAlertMessage.displayName = "FormField.AlertMessage";
|
|
538
|
-
FormFieldErrorMessage.displayName = "FormField.ErrorMessage";
|
|
539
|
-
FormFieldHelperMessage.displayName = "FormField.HelperMessage";
|
|
540
|
-
FormFieldRequiredIndicator.displayName = "FormField.RequiredIndicator";
|
|
541
|
-
FormFieldCharactersCount.displayName = "FormField.CharactersCount";
|
|
542
|
-
|
|
543
|
-
// src/stepper/Stepper.tsx
|
|
544
|
-
var import_react11 = require("react");
|
|
545
|
-
|
|
546
|
-
// src/input/InputClearButton.tsx
|
|
547
|
-
var import_DeleteOutline = require("@spark-ui/icons/DeleteOutline");
|
|
548
|
-
var import_class_variance_authority11 = require("class-variance-authority");
|
|
549
|
-
|
|
550
140
|
// src/input/InputGroupContext.ts
|
|
551
|
-
var
|
|
552
|
-
var InputGroupContext = (0,
|
|
141
|
+
var import_react3 = require("react");
|
|
142
|
+
var InputGroupContext = (0, import_react3.createContext)(null);
|
|
553
143
|
var useInputGroup = () => {
|
|
554
|
-
const context = (0,
|
|
144
|
+
const context = (0, import_react3.useContext)(InputGroupContext);
|
|
555
145
|
return context || { isStandalone: true };
|
|
556
146
|
};
|
|
557
147
|
|
|
558
148
|
// src/input/InputClearButton.tsx
|
|
559
|
-
var
|
|
149
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
560
150
|
var Root = ({ className, tabIndex = -1, onClick, ref, ...others }) => {
|
|
561
151
|
const { onClear, hasTrailingIcon } = useInputGroup();
|
|
562
152
|
const handleClick = (event) => {
|
|
@@ -567,11 +157,11 @@ var Root = ({ className, tabIndex = -1, onClick, ref, ...others }) => {
|
|
|
567
157
|
onClear();
|
|
568
158
|
}
|
|
569
159
|
};
|
|
570
|
-
return /* @__PURE__ */ (0,
|
|
160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
571
161
|
"button",
|
|
572
162
|
{
|
|
573
163
|
ref,
|
|
574
|
-
className: (0,
|
|
164
|
+
className: (0, import_class_variance_authority2.cx)(
|
|
575
165
|
className,
|
|
576
166
|
"pointer-events-auto absolute top-1/2 -translate-y-1/2",
|
|
577
167
|
"inline-flex h-full items-center justify-center outline-hidden",
|
|
@@ -582,7 +172,7 @@ var Root = ({ className, tabIndex = -1, onClick, ref, ...others }) => {
|
|
|
582
172
|
onClick: handleClick,
|
|
583
173
|
type: "button",
|
|
584
174
|
...others,
|
|
585
|
-
children: /* @__PURE__ */ (0,
|
|
175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_DeleteOutline.DeleteOutline, {}) })
|
|
586
176
|
}
|
|
587
177
|
);
|
|
588
178
|
};
|
|
@@ -592,13 +182,14 @@ var InputClearButton = Object.assign(Root, {
|
|
|
592
182
|
Root.displayName = "InputGroup.ClearButton";
|
|
593
183
|
|
|
594
184
|
// src/input/InputGroup.tsx
|
|
185
|
+
var import_form_field = require("@spark-ui/components/form-field");
|
|
595
186
|
var import_use_combined_state = require("@spark-ui/use-combined-state");
|
|
596
187
|
var import_use_merge_refs = require("@spark-ui/use-merge-refs");
|
|
597
|
-
var
|
|
188
|
+
var import_react4 = require("react");
|
|
598
189
|
|
|
599
190
|
// src/input/InputGroup.styles.ts
|
|
600
|
-
var
|
|
601
|
-
var inputGroupStyles = (0,
|
|
191
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
192
|
+
var inputGroupStyles = (0, import_class_variance_authority3.cva)(["relative inline-flex w-full"], {
|
|
602
193
|
variants: {
|
|
603
194
|
/**
|
|
604
195
|
* When `true`, prevents the user from interacting.
|
|
@@ -635,7 +226,7 @@ var inputGroupStyles = (0, import_class_variance_authority12.cva)(["relative inl
|
|
|
635
226
|
});
|
|
636
227
|
|
|
637
228
|
// src/input/InputGroup.tsx
|
|
638
|
-
var
|
|
229
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
639
230
|
var InputGroup = ({
|
|
640
231
|
className,
|
|
641
232
|
children: childrenProp,
|
|
@@ -652,18 +243,18 @@ var InputGroup = ({
|
|
|
652
243
|
const findElement = (...values) => {
|
|
653
244
|
return children.find((child) => values.includes(getElementId(child) || ""));
|
|
654
245
|
};
|
|
655
|
-
const children =
|
|
246
|
+
const children = import_react4.Children.toArray(childrenProp).filter(import_react4.isValidElement);
|
|
656
247
|
const input = findElement("Input");
|
|
657
248
|
const props = input?.props || {};
|
|
658
|
-
const inputRef = (0,
|
|
659
|
-
const onClearRef = (0,
|
|
249
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
250
|
+
const onClearRef = (0, import_react4.useRef)(onClear);
|
|
660
251
|
const ref = (0, import_use_merge_refs.useMergeRefs)(input?.ref, inputRef);
|
|
661
252
|
const [value, onChange] = (0, import_use_combined_state.useCombinedState)(
|
|
662
253
|
props.value,
|
|
663
254
|
props.defaultValue,
|
|
664
255
|
props.onValueChange
|
|
665
256
|
);
|
|
666
|
-
const field = useFormFieldControl();
|
|
257
|
+
const field = (0, import_form_field.useFormFieldControl)();
|
|
667
258
|
const state = field.state ?? stateProp;
|
|
668
259
|
const disabled = field.disabled || !!disabledProp;
|
|
669
260
|
const readOnly = field.readOnly || !!readOnlyProp;
|
|
@@ -683,14 +274,14 @@ var InputGroup = ({
|
|
|
683
274
|
}
|
|
684
275
|
onChange(event.target.value);
|
|
685
276
|
};
|
|
686
|
-
const handleClear = (0,
|
|
277
|
+
const handleClear = (0, import_react4.useCallback)(() => {
|
|
687
278
|
if (onClearRef.current) {
|
|
688
279
|
onClearRef.current();
|
|
689
280
|
}
|
|
690
281
|
onChange("");
|
|
691
282
|
inputRef.current.focus();
|
|
692
283
|
}, [onChange]);
|
|
693
|
-
const current = (0,
|
|
284
|
+
const current = (0, import_react4.useMemo)(() => {
|
|
694
285
|
return {
|
|
695
286
|
state,
|
|
696
287
|
disabled,
|
|
@@ -713,10 +304,10 @@ var InputGroup = ({
|
|
|
713
304
|
hasClearButton,
|
|
714
305
|
handleClear
|
|
715
306
|
]);
|
|
716
|
-
(0,
|
|
307
|
+
(0, import_react4.useEffect)(() => {
|
|
717
308
|
onClearRef.current = onClear;
|
|
718
309
|
}, [onClear]);
|
|
719
|
-
return /* @__PURE__ */ (0,
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(InputGroupContext.Provider, { value: current, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
720
311
|
"div",
|
|
721
312
|
{
|
|
722
313
|
ref: forwardedRef,
|
|
@@ -724,8 +315,8 @@ var InputGroup = ({
|
|
|
724
315
|
...others,
|
|
725
316
|
children: [
|
|
726
317
|
hasLeadingAddon && leadingAddon,
|
|
727
|
-
/* @__PURE__ */ (0,
|
|
728
|
-
input && (0,
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative inline-flex w-full", children: [
|
|
319
|
+
input && (0, import_react4.cloneElement)(input, {
|
|
729
320
|
ref,
|
|
730
321
|
defaultValue: void 0,
|
|
731
322
|
value: value ?? "",
|
|
@@ -743,14 +334,14 @@ var InputGroup = ({
|
|
|
743
334
|
InputGroup.displayName = "InputGroup";
|
|
744
335
|
|
|
745
336
|
// src/input/InputLeadingAddon.tsx
|
|
746
|
-
var
|
|
337
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
747
338
|
|
|
748
339
|
// src/input/InputAddon.tsx
|
|
749
|
-
var
|
|
340
|
+
var import_react5 = require("react");
|
|
750
341
|
|
|
751
342
|
// src/input/InputAddon.styles.ts
|
|
752
|
-
var
|
|
753
|
-
var inputAddonStyles = (0,
|
|
343
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
344
|
+
var inputAddonStyles = (0, import_class_variance_authority4.cva)(
|
|
754
345
|
[
|
|
755
346
|
"overflow-hidden",
|
|
756
347
|
"border-sm",
|
|
@@ -816,7 +407,7 @@ var inputAddonStyles = (0, import_class_variance_authority13.cva)(
|
|
|
816
407
|
);
|
|
817
408
|
|
|
818
409
|
// src/input/InputAddon.tsx
|
|
819
|
-
var
|
|
410
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
820
411
|
var InputAddon = ({
|
|
821
412
|
asChild: asChildProp,
|
|
822
413
|
className,
|
|
@@ -827,14 +418,14 @@ var InputAddon = ({
|
|
|
827
418
|
const { state, disabled, readOnly } = useInputGroup();
|
|
828
419
|
const isRawText = typeof children === "string";
|
|
829
420
|
const asChild = !!(isRawText ? false : asChildProp);
|
|
830
|
-
const child = isRawText ? children :
|
|
421
|
+
const child = isRawText ? children : import_react5.Children.only(children);
|
|
831
422
|
const Component = asChild && !isRawText ? Slot : "div";
|
|
832
423
|
const getDesign = () => {
|
|
833
424
|
if (isRawText) return "text";
|
|
834
425
|
return asChild ? "solid" : "inline";
|
|
835
426
|
};
|
|
836
427
|
const design = getDesign();
|
|
837
|
-
return /* @__PURE__ */ (0,
|
|
428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
838
429
|
Component,
|
|
839
430
|
{
|
|
840
431
|
ref,
|
|
@@ -855,15 +446,15 @@ var InputAddon = ({
|
|
|
855
446
|
InputAddon.displayName = "InputGroup.Addon";
|
|
856
447
|
|
|
857
448
|
// src/input/InputLeadingAddon.tsx
|
|
858
|
-
var
|
|
449
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
859
450
|
var Root2 = ({ className, ref, ...others }) => {
|
|
860
451
|
const { disabled, readOnly } = useInputGroup();
|
|
861
452
|
const isInactive = disabled || readOnly;
|
|
862
|
-
return /* @__PURE__ */ (0,
|
|
453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: (0, import_class_variance_authority5.cx)("rounded-l-lg", isInactive ? "bg-on-surface/dim-5" : null), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
863
454
|
InputAddon,
|
|
864
455
|
{
|
|
865
456
|
ref,
|
|
866
|
-
className: (0,
|
|
457
|
+
className: (0, import_class_variance_authority5.cx)(className, "rounded-r-0! mr-[-1px] rounded-l-lg"),
|
|
867
458
|
...others
|
|
868
459
|
}
|
|
869
460
|
) });
|
|
@@ -874,19 +465,19 @@ var InputLeadingAddon = Object.assign(Root2, {
|
|
|
874
465
|
Root2.displayName = "InputGroup.LeadingAddon";
|
|
875
466
|
|
|
876
467
|
// src/input/InputLeadingIcon.tsx
|
|
877
|
-
var
|
|
468
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
878
469
|
|
|
879
470
|
// src/input/InputIcon.tsx
|
|
880
|
-
var
|
|
881
|
-
var
|
|
471
|
+
var import_class_variance_authority6 = require("class-variance-authority");
|
|
472
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
882
473
|
var InputIcon = ({ className, intent, children, ...others }) => {
|
|
883
474
|
const { disabled, readOnly } = useInputGroup();
|
|
884
475
|
const isInactive = disabled || readOnly;
|
|
885
|
-
return /* @__PURE__ */ (0,
|
|
476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
886
477
|
Icon,
|
|
887
478
|
{
|
|
888
479
|
intent,
|
|
889
|
-
className: (0,
|
|
480
|
+
className: (0, import_class_variance_authority6.cx)(
|
|
890
481
|
className,
|
|
891
482
|
"pointer-events-none absolute top-[calc(var(--spacing-sz-44)/2)] -translate-y-1/2",
|
|
892
483
|
intent ? void 0 : "text-neutral peer-focus:text-outline-high",
|
|
@@ -900,22 +491,22 @@ var InputIcon = ({ className, intent, children, ...others }) => {
|
|
|
900
491
|
InputIcon.displayName = "InputGroup.Icon";
|
|
901
492
|
|
|
902
493
|
// src/input/InputLeadingIcon.tsx
|
|
903
|
-
var
|
|
904
|
-
var InputLeadingIcon = ({ className, ...others }) => /* @__PURE__ */ (0,
|
|
494
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
495
|
+
var InputLeadingIcon = ({ className, ...others }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputIcon, { className: (0, import_class_variance_authority7.cx)(className, "left-lg text-body-1"), ...others });
|
|
905
496
|
InputLeadingIcon.id = "LeadingIcon";
|
|
906
497
|
InputLeadingIcon.displayName = "InputGroup.LeadingIcon";
|
|
907
498
|
|
|
908
499
|
// src/input/InputTrailingAddon.tsx
|
|
909
|
-
var
|
|
910
|
-
var
|
|
500
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
501
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
911
502
|
var Root3 = ({ className, ref, ...others }) => {
|
|
912
503
|
const { disabled, readOnly } = useInputGroup();
|
|
913
504
|
const isInactive = disabled || readOnly;
|
|
914
|
-
return /* @__PURE__ */ (0,
|
|
505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_class_variance_authority8.cx)("rounded-r-lg", isInactive ? "bg-on-surface/dim-5" : null), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
915
506
|
InputAddon,
|
|
916
507
|
{
|
|
917
508
|
ref,
|
|
918
|
-
className: (0,
|
|
509
|
+
className: (0, import_class_variance_authority8.cx)(className, "rounded-l-0! ml-[-1px] rounded-r-lg"),
|
|
919
510
|
...others
|
|
920
511
|
}
|
|
921
512
|
) });
|
|
@@ -926,15 +517,18 @@ var InputTrailingAddon = Object.assign(Root3, {
|
|
|
926
517
|
Root3.displayName = "InputGroup.TrailingAddon";
|
|
927
518
|
|
|
928
519
|
// src/input/InputTrailingIcon.tsx
|
|
929
|
-
var
|
|
930
|
-
var
|
|
931
|
-
var InputTrailingIcon = ({ className, ...others }) => /* @__PURE__ */ (0,
|
|
520
|
+
var import_class_variance_authority9 = require("class-variance-authority");
|
|
521
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
522
|
+
var InputTrailingIcon = ({ className, ...others }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InputIcon, { className: (0, import_class_variance_authority9.cx)(className, "right-lg text-body-1"), ...others });
|
|
932
523
|
InputTrailingIcon.id = "TrailingIcon";
|
|
933
524
|
InputTrailingIcon.displayName = "InputGroup.TrailingIcon";
|
|
934
525
|
|
|
526
|
+
// src/input/Input.tsx
|
|
527
|
+
var import_form_field2 = require("@spark-ui/components/form-field");
|
|
528
|
+
|
|
935
529
|
// src/input/Input.styles.ts
|
|
936
|
-
var
|
|
937
|
-
var inputStyles = (0,
|
|
530
|
+
var import_class_variance_authority10 = require("class-variance-authority");
|
|
531
|
+
var inputStyles = (0, import_class_variance_authority10.cva)(
|
|
938
532
|
[
|
|
939
533
|
"relative",
|
|
940
534
|
"border-sm",
|
|
@@ -1030,7 +624,7 @@ var inputStyles = (0, import_class_variance_authority19.cva)(
|
|
|
1030
624
|
);
|
|
1031
625
|
|
|
1032
626
|
// src/input/Input.tsx
|
|
1033
|
-
var
|
|
627
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1034
628
|
var Root4 = ({
|
|
1035
629
|
className,
|
|
1036
630
|
asChild = false,
|
|
@@ -1042,7 +636,7 @@ var Root4 = ({
|
|
|
1042
636
|
ref,
|
|
1043
637
|
...others
|
|
1044
638
|
}) => {
|
|
1045
|
-
const field = useFormFieldControl();
|
|
639
|
+
const field = (0, import_form_field2.useFormFieldControl)();
|
|
1046
640
|
const group = useInputGroup();
|
|
1047
641
|
const { id, name, isInvalid, isRequired, description } = field;
|
|
1048
642
|
const {
|
|
@@ -1073,7 +667,7 @@ var Root4 = ({
|
|
|
1073
667
|
onClear();
|
|
1074
668
|
}
|
|
1075
669
|
};
|
|
1076
|
-
return /* @__PURE__ */ (0,
|
|
670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1077
671
|
Component,
|
|
1078
672
|
{
|
|
1079
673
|
ref,
|
|
@@ -1155,8 +749,8 @@ var useStepper = ({
|
|
|
1155
749
|
};
|
|
1156
750
|
|
|
1157
751
|
// src/stepper/Stepper.tsx
|
|
1158
|
-
var
|
|
1159
|
-
var StepperContext = (0,
|
|
752
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
753
|
+
var StepperContext = (0, import_react6.createContext)(null);
|
|
1160
754
|
var Stepper = ({
|
|
1161
755
|
children,
|
|
1162
756
|
formatOptions,
|
|
@@ -1167,7 +761,7 @@ var Stepper = ({
|
|
|
1167
761
|
ref: forwardedRef,
|
|
1168
762
|
...stepperProps
|
|
1169
763
|
}) => {
|
|
1170
|
-
const inputRef = (0,
|
|
764
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
1171
765
|
const {
|
|
1172
766
|
groupProps,
|
|
1173
767
|
inputProps: _inputProps,
|
|
@@ -1185,7 +779,7 @@ var Stepper = ({
|
|
|
1185
779
|
decrementAriaLabel,
|
|
1186
780
|
inputRef
|
|
1187
781
|
});
|
|
1188
|
-
const formFieldControlProps = useFormFieldControl();
|
|
782
|
+
const formFieldControlProps = (0, import_form_field3.useFormFieldControl)();
|
|
1189
783
|
const isWrappedInFormField = !!formFieldControlProps.id;
|
|
1190
784
|
const incrementButtonProps = {
|
|
1191
785
|
..._incrementButtonProps,
|
|
@@ -1204,11 +798,11 @@ var Stepper = ({
|
|
|
1204
798
|
}
|
|
1205
799
|
};
|
|
1206
800
|
const { onValueChange: _, ...remainingStepperProps } = stepperProps;
|
|
1207
|
-
return /* @__PURE__ */ (0,
|
|
801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1208
802
|
StepperContext.Provider,
|
|
1209
803
|
{
|
|
1210
804
|
value: { incrementButtonProps, decrementButtonProps, inputProps, inputRef },
|
|
1211
|
-
children: /* @__PURE__ */ (0,
|
|
805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1212
806
|
InputGroup2,
|
|
1213
807
|
{
|
|
1214
808
|
...remainingStepperProps,
|
|
@@ -1223,7 +817,7 @@ var Stepper = ({
|
|
|
1223
817
|
};
|
|
1224
818
|
Stepper.displayName = "Stepper";
|
|
1225
819
|
var useStepperContext = () => {
|
|
1226
|
-
const context = (0,
|
|
820
|
+
const context = (0, import_react6.useContext)(StepperContext);
|
|
1227
821
|
if (!context) {
|
|
1228
822
|
throw Error("useStepperContext must be used within a Stepper provider");
|
|
1229
823
|
}
|
|
@@ -1234,21 +828,21 @@ var useStepperContext = () => {
|
|
|
1234
828
|
var import_button2 = require("@react-aria/button");
|
|
1235
829
|
var import_Minus = require("@spark-ui/icons/Minus");
|
|
1236
830
|
var import_Plus = require("@spark-ui/icons/Plus");
|
|
1237
|
-
var
|
|
831
|
+
var import_react8 = require("react");
|
|
1238
832
|
|
|
1239
833
|
// src/button/Button.tsx
|
|
1240
|
-
var
|
|
1241
|
-
var
|
|
834
|
+
var import_class_variance_authority13 = require("class-variance-authority");
|
|
835
|
+
var import_react7 = require("react");
|
|
1242
836
|
|
|
1243
837
|
// src/spinner/Spinner.styles.tsx
|
|
1244
838
|
var import_internal_utils2 = require("@spark-ui/internal-utils");
|
|
1245
|
-
var
|
|
839
|
+
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1246
840
|
var defaultVariants = {
|
|
1247
841
|
intent: "current",
|
|
1248
842
|
size: "current",
|
|
1249
843
|
isBackgroundVisible: false
|
|
1250
844
|
};
|
|
1251
|
-
var spinnerStyles = (0,
|
|
845
|
+
var spinnerStyles = (0, import_class_variance_authority11.cva)(
|
|
1252
846
|
["inline-block", "border-solid", "rounded-full", "border-md", "animate-spin"],
|
|
1253
847
|
{
|
|
1254
848
|
variants: {
|
|
@@ -1289,7 +883,7 @@ var spinnerStyles = (0, import_class_variance_authority20.cva)(
|
|
|
1289
883
|
);
|
|
1290
884
|
|
|
1291
885
|
// src/spinner/Spinner.tsx
|
|
1292
|
-
var
|
|
886
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1293
887
|
var Spinner = ({
|
|
1294
888
|
className,
|
|
1295
889
|
size = "current",
|
|
@@ -1299,7 +893,7 @@ var Spinner = ({
|
|
|
1299
893
|
ref,
|
|
1300
894
|
...others
|
|
1301
895
|
}) => {
|
|
1302
|
-
return /* @__PURE__ */ (0,
|
|
896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1303
897
|
"span",
|
|
1304
898
|
{
|
|
1305
899
|
role: "status",
|
|
@@ -1307,14 +901,14 @@ var Spinner = ({
|
|
|
1307
901
|
ref,
|
|
1308
902
|
className: spinnerStyles({ className, size, intent, isBackgroundVisible }),
|
|
1309
903
|
...others,
|
|
1310
|
-
children: label && /* @__PURE__ */ (0,
|
|
904
|
+
children: label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VisuallyHidden, { children: label })
|
|
1311
905
|
}
|
|
1312
906
|
);
|
|
1313
907
|
};
|
|
1314
908
|
|
|
1315
909
|
// src/button/Button.styles.tsx
|
|
1316
910
|
var import_internal_utils8 = require("@spark-ui/internal-utils");
|
|
1317
|
-
var
|
|
911
|
+
var import_class_variance_authority12 = require("class-variance-authority");
|
|
1318
912
|
|
|
1319
913
|
// src/button/variants/filled.ts
|
|
1320
914
|
var import_internal_utils3 = require("@spark-ui/internal-utils");
|
|
@@ -1868,7 +1462,7 @@ var contrastVariants = [
|
|
|
1868
1462
|
];
|
|
1869
1463
|
|
|
1870
1464
|
// src/button/Button.styles.tsx
|
|
1871
|
-
var buttonStyles = (0,
|
|
1465
|
+
var buttonStyles = (0, import_class_variance_authority12.cva)(
|
|
1872
1466
|
[
|
|
1873
1467
|
"u-shadow-border-transition",
|
|
1874
1468
|
"box-border inline-flex items-center justify-center gap-md whitespace-nowrap",
|
|
@@ -1955,7 +1549,7 @@ var buttonStyles = (0, import_class_variance_authority21.cva)(
|
|
|
1955
1549
|
);
|
|
1956
1550
|
|
|
1957
1551
|
// src/button/Button.tsx
|
|
1958
|
-
var
|
|
1552
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1959
1553
|
var blockedEventHandlers = [
|
|
1960
1554
|
"onClick",
|
|
1961
1555
|
"onMouseDown",
|
|
@@ -1986,7 +1580,7 @@ var Button = ({
|
|
|
1986
1580
|
}) => {
|
|
1987
1581
|
const Component = asChild ? Slot : "button";
|
|
1988
1582
|
const shouldNotInteract = !!disabled || isLoading;
|
|
1989
|
-
const disabledEventHandlers = (0,
|
|
1583
|
+
const disabledEventHandlers = (0, import_react7.useMemo)(() => {
|
|
1990
1584
|
const result = {};
|
|
1991
1585
|
if (shouldNotInteract) {
|
|
1992
1586
|
blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
|
|
@@ -1998,7 +1592,7 @@ var Button = ({
|
|
|
1998
1592
|
className: loadingText ? "inline-block" : "absolute",
|
|
1999
1593
|
...loadingLabel && { "aria-label": loadingLabel }
|
|
2000
1594
|
};
|
|
2001
|
-
return /* @__PURE__ */ (0,
|
|
1595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2002
1596
|
Component,
|
|
2003
1597
|
{
|
|
2004
1598
|
"data-spark-component": "button",
|
|
@@ -2020,14 +1614,14 @@ var Button = ({
|
|
|
2020
1614
|
children: wrapPolymorphicSlot(
|
|
2021
1615
|
asChild,
|
|
2022
1616
|
children,
|
|
2023
|
-
(slotted) => isLoading ? /* @__PURE__ */ (0,
|
|
2024
|
-
/* @__PURE__ */ (0,
|
|
1617
|
+
(slotted) => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Spinner, { ...spinnerProps }),
|
|
2025
1619
|
loadingText && loadingText,
|
|
2026
|
-
/* @__PURE__ */ (0,
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2027
1621
|
"div",
|
|
2028
1622
|
{
|
|
2029
1623
|
"aria-hidden": true,
|
|
2030
|
-
className: (0,
|
|
1624
|
+
className: (0, import_class_variance_authority13.cx)("gap-md", loadingText ? "hidden" : "inline-flex opacity-0"),
|
|
2031
1625
|
children: slotted
|
|
2032
1626
|
}
|
|
2033
1627
|
)
|
|
@@ -2040,8 +1634,8 @@ Button.displayName = "Button";
|
|
|
2040
1634
|
|
|
2041
1635
|
// src/icon-button/IconButton.styles.tsx
|
|
2042
1636
|
var import_internal_utils9 = require("@spark-ui/internal-utils");
|
|
2043
|
-
var
|
|
2044
|
-
var iconButtonStyles = (0,
|
|
1637
|
+
var import_class_variance_authority14 = require("class-variance-authority");
|
|
1638
|
+
var iconButtonStyles = (0, import_class_variance_authority14.cva)(["pl-0 pr-0"], {
|
|
2045
1639
|
variants: {
|
|
2046
1640
|
/**
|
|
2047
1641
|
* Sets the size of the icon.
|
|
@@ -2055,7 +1649,7 @@ var iconButtonStyles = (0, import_class_variance_authority23.cva)(["pl-0 pr-0"],
|
|
|
2055
1649
|
});
|
|
2056
1650
|
|
|
2057
1651
|
// src/icon-button/IconButton.tsx
|
|
2058
|
-
var
|
|
1652
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2059
1653
|
var IconButton = ({
|
|
2060
1654
|
design = "filled",
|
|
2061
1655
|
disabled = false,
|
|
@@ -2066,7 +1660,7 @@ var IconButton = ({
|
|
|
2066
1660
|
ref,
|
|
2067
1661
|
...others
|
|
2068
1662
|
}) => {
|
|
2069
|
-
return /* @__PURE__ */ (0,
|
|
1663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2070
1664
|
Button,
|
|
2071
1665
|
{
|
|
2072
1666
|
ref,
|
|
@@ -2083,7 +1677,7 @@ var IconButton = ({
|
|
|
2083
1677
|
IconButton.displayName = "IconButton";
|
|
2084
1678
|
|
|
2085
1679
|
// src/stepper/StepperButton.tsx
|
|
2086
|
-
var
|
|
1680
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2087
1681
|
var IncrementButton = ({
|
|
2088
1682
|
children,
|
|
2089
1683
|
design = "ghost",
|
|
@@ -2092,11 +1686,11 @@ var IncrementButton = ({
|
|
|
2092
1686
|
ref: forwardedRef,
|
|
2093
1687
|
...rest
|
|
2094
1688
|
}) => {
|
|
2095
|
-
const innerRef = (0,
|
|
1689
|
+
const innerRef = (0, import_react8.useRef)(null);
|
|
2096
1690
|
const ref = forwardedRef && typeof forwardedRef !== "function" ? forwardedRef : innerRef;
|
|
2097
1691
|
const { incrementButtonProps } = useStepperContext();
|
|
2098
1692
|
const { buttonProps } = (0, import_button2.useButton)({ ...incrementButtonProps, ...rest }, ref);
|
|
2099
|
-
return /* @__PURE__ */ (0,
|
|
1693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputGroup2.TrailingAddon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2100
1694
|
IconButton,
|
|
2101
1695
|
{
|
|
2102
1696
|
ref,
|
|
@@ -2105,7 +1699,7 @@ var IncrementButton = ({
|
|
|
2105
1699
|
className,
|
|
2106
1700
|
"aria-label": buttonProps["aria-label"],
|
|
2107
1701
|
...buttonProps,
|
|
2108
|
-
children: children || /* @__PURE__ */ (0,
|
|
1702
|
+
children: children || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Plus.Plus, {}) })
|
|
2109
1703
|
}
|
|
2110
1704
|
) });
|
|
2111
1705
|
};
|
|
@@ -2117,11 +1711,11 @@ var DecrementButton = ({
|
|
|
2117
1711
|
ref: forwardedRef,
|
|
2118
1712
|
...rest
|
|
2119
1713
|
}) => {
|
|
2120
|
-
const innerRef = (0,
|
|
1714
|
+
const innerRef = (0, import_react8.useRef)(null);
|
|
2121
1715
|
const ref = forwardedRef && typeof forwardedRef !== "function" ? forwardedRef : innerRef;
|
|
2122
1716
|
const { decrementButtonProps } = useStepperContext();
|
|
2123
1717
|
const { buttonProps } = (0, import_button2.useButton)({ ...decrementButtonProps, ...rest }, ref);
|
|
2124
|
-
return /* @__PURE__ */ (0,
|
|
1718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputGroup2.LeadingAddon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2125
1719
|
IconButton,
|
|
2126
1720
|
{
|
|
2127
1721
|
ref,
|
|
@@ -2130,7 +1724,7 @@ var DecrementButton = ({
|
|
|
2130
1724
|
className,
|
|
2131
1725
|
"aria-label": buttonProps["aria-label"],
|
|
2132
1726
|
...buttonProps,
|
|
2133
|
-
children: children || /* @__PURE__ */ (0,
|
|
1727
|
+
children: children || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Minus.Minus, {}) })
|
|
2134
1728
|
}
|
|
2135
1729
|
) });
|
|
2136
1730
|
};
|
|
@@ -2145,12 +1739,12 @@ DecrementButton.displayName = "Stepper.DecrementButton";
|
|
|
2145
1739
|
|
|
2146
1740
|
// src/stepper/StepperInput.tsx
|
|
2147
1741
|
var import_use_merge_refs2 = require("@spark-ui/use-merge-refs");
|
|
2148
|
-
var
|
|
1742
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2149
1743
|
var Input2 = ({ ref: forwardedRef, ...props }) => {
|
|
2150
1744
|
const { inputRef, inputProps } = useStepperContext();
|
|
2151
1745
|
const ref = (0, import_use_merge_refs2.useMergeRefs)(forwardedRef, inputRef);
|
|
2152
1746
|
const { className = "", ...remainingProps } = props;
|
|
2153
|
-
return /* @__PURE__ */ (0,
|
|
1747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2154
1748
|
Input,
|
|
2155
1749
|
{
|
|
2156
1750
|
ref,
|