@spark-ui/components 10.0.1 → 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.
Files changed (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/checkbox/index.js +115 -476
  3. package/dist/checkbox/index.js.map +1 -1
  4. package/dist/checkbox/index.mjs +3 -4
  5. package/dist/checkbox/index.mjs.map +1 -1
  6. package/dist/{chunk-JKNBJHD5.mjs → chunk-7BTJUYP3.mjs} +6 -5
  7. package/dist/chunk-7BTJUYP3.mjs.map +1 -0
  8. package/dist/combobox/index.js +298 -707
  9. package/dist/combobox/index.js.map +1 -1
  10. package/dist/combobox/index.mjs +3 -5
  11. package/dist/combobox/index.mjs.map +1 -1
  12. package/dist/dropdown/index.js +251 -661
  13. package/dist/dropdown/index.js.map +1 -1
  14. package/dist/dropdown/index.mjs +1 -4
  15. package/dist/dropdown/index.mjs.map +1 -1
  16. package/dist/form-field/index.mjs +373 -7
  17. package/dist/form-field/index.mjs.map +1 -1
  18. package/dist/input/index.js +46 -453
  19. package/dist/input/index.js.map +1 -1
  20. package/dist/input/index.mjs +1 -3
  21. package/dist/radio-group/index.js +46 -552
  22. package/dist/radio-group/index.js.map +1 -1
  23. package/dist/radio-group/index.mjs +3 -9
  24. package/dist/radio-group/index.mjs.map +1 -1
  25. package/dist/select/index.js +158 -568
  26. package/dist/select/index.js.map +1 -1
  27. package/dist/select/index.mjs +1 -4
  28. package/dist/select/index.mjs.map +1 -1
  29. package/dist/stepper/index.js +108 -514
  30. package/dist/stepper/index.js.map +1 -1
  31. package/dist/stepper/index.mjs +2 -5
  32. package/dist/stepper/index.mjs.map +1 -1
  33. package/dist/switch/index.js +94 -543
  34. package/dist/switch/index.js.map +1 -1
  35. package/dist/switch/index.mjs +3 -6
  36. package/dist/switch/index.mjs.map +1 -1
  37. package/dist/textarea/index.js +57 -464
  38. package/dist/textarea/index.js.map +1 -1
  39. package/dist/textarea/index.mjs +1 -3
  40. package/dist/textarea/index.mjs.map +1 -1
  41. package/package.json +16 -6
  42. package/tsup.config.ts +2 -1
  43. package/dist/chunk-7PMPYEHJ.mjs +0 -379
  44. package/dist/chunk-7PMPYEHJ.mjs.map +0 -1
  45. package/dist/chunk-JKNBJHD5.mjs.map +0 -1
@@ -26,139 +26,41 @@ __export(checkbox_exports, {
26
26
  module.exports = __toCommonJS(checkbox_exports);
27
27
 
28
28
  // src/checkbox/Checkbox.tsx
29
+ var import_form_field = require("@spark-ui/components/form-field");
29
30
  var import_use_merge_refs = require("@spark-ui/use-merge-refs");
30
- var import_class_variance_authority13 = require("class-variance-authority");
31
- var import_react9 = require("react");
32
-
33
- // src/form-field/FormField.tsx
34
- var import_class_variance_authority = require("class-variance-authority");
31
+ var import_class_variance_authority6 = require("class-variance-authority");
35
32
  var import_react4 = require("react");
36
33
 
37
- // src/slot/Slot.tsx
38
- var import_radix_ui = require("radix-ui");
34
+ // src/checkbox/CheckboxGroupContext.tsx
39
35
  var import_react = require("react");
40
- var import_jsx_runtime = require("react/jsx-runtime");
41
- var Slottable = import_radix_ui.Slot.Slottable;
42
- var Slot = ({ ref, ...props }) => {
43
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
44
- };
45
-
46
- // src/form-field/FormFieldContext.tsx
47
- var import_react2 = require("react");
48
- var FormFieldContext = (0, import_react2.createContext)(null);
49
- var ID_PREFIX = ":form-field";
50
- var useFormField = () => {
51
- const context = (0, import_react2.useContext)(FormFieldContext);
52
- if (!context) {
53
- throw Error("useFormField must be used within a FormField provider");
54
- }
36
+ var CheckboxGroupContext = (0, import_react.createContext)({});
37
+ var useCheckboxGroup = () => {
38
+ const context = (0, import_react.useContext)(CheckboxGroupContext);
55
39
  return context;
56
40
  };
57
41
 
58
- // src/form-field/FormFieldProvider.tsx
59
- var import_react3 = require("react");
60
- var import_jsx_runtime2 = require("react/jsx-runtime");
61
- var FormFieldProvider = ({
62
- id,
63
- name,
64
- disabled = false,
65
- readOnly = false,
66
- state,
67
- isRequired,
68
- children
69
- }) => {
70
- const labelId = `${ID_PREFIX}-label-${(0, import_react3.useId)()}`;
71
- const [messageIds, setMessageIds] = (0, import_react3.useState)([]);
72
- const description = messageIds.length > 0 ? messageIds.join(" ") : void 0;
73
- const handleMessageIdAdd = (0, import_react3.useCallback)((msgId) => {
74
- setMessageIds((ids) => [...ids, msgId]);
75
- }, []);
76
- const handleMessageIdRemove = (0, import_react3.useCallback)((msgId) => {
77
- setMessageIds((ids) => ids.filter((current) => current !== msgId));
78
- }, []);
79
- const value = (0, import_react3.useMemo)(() => {
80
- const isInvalid = state === "error";
81
- return {
82
- id,
83
- labelId,
84
- name,
85
- disabled,
86
- readOnly,
87
- state,
88
- isRequired,
89
- isInvalid,
90
- description,
91
- onMessageIdAdd: handleMessageIdAdd,
92
- onMessageIdRemove: handleMessageIdRemove
93
- };
94
- }, [
95
- id,
96
- labelId,
97
- name,
98
- disabled,
99
- readOnly,
100
- description,
101
- state,
102
- isRequired,
103
- handleMessageIdAdd,
104
- handleMessageIdRemove
105
- ]);
106
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FormFieldContext.Provider, { value, children });
107
- };
108
- FormFieldProvider.displayName = "FormFieldProvider";
109
-
110
- // src/form-field/FormField.tsx
111
- var import_jsx_runtime3 = require("react/jsx-runtime");
112
- var FormField = ({
113
- className,
114
- disabled = false,
115
- readOnly = false,
116
- name,
117
- state,
118
- isRequired = false,
119
- asChild = false,
120
- ref,
121
- ...others
122
- }) => {
123
- const id = `${ID_PREFIX}-${(0, import_react4.useId)()}`;
124
- const Component = asChild ? Slot : "div";
125
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
126
- FormFieldProvider,
127
- {
128
- id,
129
- name,
130
- isRequired,
131
- disabled,
132
- readOnly,
133
- state,
134
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
135
- Component,
136
- {
137
- ref,
138
- "data-spark-component": "form-field",
139
- className: (0, import_class_variance_authority.cx)(className, "gap-sm flex flex-col"),
140
- ...others
141
- }
142
- )
143
- }
144
- );
145
- };
146
- FormField.displayName = "FormField";
147
-
148
- // src/form-field/FormFieldStateMessage.tsx
149
- var import_AlertOutline = require("@spark-ui/icons/AlertOutline");
42
+ // src/checkbox/CheckboxInput.tsx
150
43
  var import_Check = require("@spark-ui/icons/Check");
151
- var import_WarningOutline = require("@spark-ui/icons/WarningOutline");
152
- var import_class_variance_authority4 = require("class-variance-authority");
44
+ var import_Minus = require("@spark-ui/icons/Minus");
45
+ var import_radix_ui3 = require("radix-ui");
153
46
 
154
47
  // src/icon/Icon.tsx
155
- var import_react5 = require("react");
48
+ var import_react3 = require("react");
49
+
50
+ // src/slot/Slot.tsx
51
+ var import_radix_ui = require("radix-ui");
52
+ var import_react2 = require("react");
53
+ var import_jsx_runtime = require("react/jsx-runtime");
54
+ var Slottable = import_radix_ui.Slot.Slottable;
55
+ var Slot = ({ ref, ...props }) => {
56
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
57
+ };
156
58
 
157
59
  // src/visually-hidden/VisuallyHidden.tsx
158
- var import_jsx_runtime4 = require("react/jsx-runtime");
60
+ var import_jsx_runtime2 = require("react/jsx-runtime");
159
61
  var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
160
62
  const Component = asChild ? Slot : "span";
161
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
63
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
162
64
  Component,
163
65
  {
164
66
  ...props,
@@ -184,8 +86,8 @@ VisuallyHidden.displayName = "VisuallyHidden";
184
86
 
185
87
  // src/icon/Icon.styles.tsx
186
88
  var import_internal_utils = require("@spark-ui/internal-utils");
187
- var import_class_variance_authority2 = require("class-variance-authority");
188
- var iconStyles = (0, import_class_variance_authority2.cva)(["fill-current shrink-0"], {
89
+ var import_class_variance_authority = require("class-variance-authority");
90
+ var iconStyles = (0, import_class_variance_authority.cva)(["fill-current shrink-0"], {
189
91
  variants: {
190
92
  /**
191
93
  * Color scheme of the icon.
@@ -216,7 +118,7 @@ var iconStyles = (0, import_class_variance_authority2.cva)(["fill-current shrink
216
118
  });
217
119
 
218
120
  // src/icon/Icon.tsx
219
- var import_jsx_runtime5 = require("react/jsx-runtime");
121
+ var import_jsx_runtime3 = require("react/jsx-runtime");
220
122
  var Icon = ({
221
123
  label,
222
124
  className,
@@ -225,343 +127,31 @@ var Icon = ({
225
127
  children,
226
128
  ...others
227
129
  }) => {
228
- const child = import_react5.Children.only(children);
229
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
230
- (0, import_react5.cloneElement)(child, {
130
+ const child = import_react3.Children.only(children);
131
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
132
+ (0, import_react3.cloneElement)(child, {
231
133
  className: iconStyles({ className, size, intent }),
232
134
  "data-spark-component": "icon",
233
135
  "aria-hidden": "true",
234
136
  focusable: "false",
235
137
  ...others
236
138
  }),
237
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VisuallyHidden, { children: label })
139
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(VisuallyHidden, { children: label })
238
140
  ] });
239
141
  };
240
142
  Icon.displayName = "Icon";
241
143
 
242
- // src/form-field/FormFieldMessage.tsx
243
- var import_class_variance_authority3 = require("class-variance-authority");
244
- var import_react6 = require("react");
245
- var import_jsx_runtime6 = require("react/jsx-runtime");
246
- var FormFieldMessage = ({
247
- id: idProp,
248
- className,
249
- ref,
250
- ...others
251
- }) => {
252
- const { onMessageIdAdd, onMessageIdRemove } = useFormField();
253
- const currentId = `${ID_PREFIX}-message-${(0, import_react6.useId)()}`;
254
- const id = idProp || currentId;
255
- (0, import_react6.useEffect)(() => {
256
- onMessageIdAdd(id);
257
- return () => {
258
- onMessageIdRemove(id);
259
- };
260
- }, [id, onMessageIdAdd, onMessageIdRemove]);
261
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
262
- "span",
263
- {
264
- ref,
265
- id,
266
- "data-spark-component": "form-field-message",
267
- className: (0, import_class_variance_authority3.cx)(className, "text-caption"),
268
- ...others
269
- }
270
- );
271
- };
272
- FormFieldMessage.displayName = "FormField.Message";
273
-
274
- // src/form-field/FormFieldStateMessage.tsx
275
- var import_jsx_runtime7 = require("react/jsx-runtime");
276
- var FormFieldStateMessage = ({
277
- className,
278
- state,
279
- children,
280
- ref,
281
- ...others
282
- }) => {
283
- const field = useFormField();
284
- if (field.state !== state) {
285
- return null;
286
- }
287
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
288
- FormFieldMessage,
289
- {
290
- ref,
291
- "data-spark-component": "form-field-state-message",
292
- "aria-live": "polite",
293
- className: (0, import_class_variance_authority4.cx)(
294
- "gap-sm flex items-center",
295
- state === "error" ? "text-error" : "text-on-surface/dim-1",
296
- className
297
- ),
298
- ...others,
299
- children: [
300
- state === "alert" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_WarningOutline.WarningOutline, {}) }),
301
- state === "error" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", intent: "error", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_AlertOutline.AlertOutline, {}) }),
302
- state === "success" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Check.Check, {}) }),
303
- children
304
- ]
305
- }
306
- );
307
- };
308
- FormFieldStateMessage.displayName = "FormField.StateMessage";
309
-
310
- // src/form-field/FormFieldAlertMessage.tsx
311
- var import_jsx_runtime8 = require("react/jsx-runtime");
312
- var FormFieldAlertMessage = ({ ref, ...props }) => {
313
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
314
- FormFieldStateMessage,
315
- {
316
- ref,
317
- "data-spark-component": "form-field-alert-message",
318
- state: "alert",
319
- ...props
320
- }
321
- );
322
- };
323
- FormFieldAlertMessage.displayName = "FormField.AlertMessage";
324
-
325
- // src/form-field/FormFieldCharactersCount.tsx
326
- var import_class_variance_authority5 = require("class-variance-authority");
327
- var import_jsx_runtime9 = require("react/jsx-runtime");
328
- var FormFieldCharactersCount = ({
329
- className,
330
- value = "",
331
- maxLength,
332
- ref,
333
- ...others
334
- }) => {
335
- const displayValue = `${value.length}/${maxLength}`;
336
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
337
- "span",
338
- {
339
- ref,
340
- "data-spark-component": "form-field-characters-count",
341
- className: (0, import_class_variance_authority5.cx)(className, "text-caption", "text-neutral"),
342
- ...others,
343
- children: displayValue
344
- }
345
- );
346
- };
347
- FormFieldCharactersCount.displayName = "FormField.CharactersCount";
348
-
349
- // src/form-field/FormFieldControl.tsx
350
- var import_react7 = require("react");
351
- var import_jsx_runtime10 = require("react/jsx-runtime");
352
- var useFormFieldControl = () => {
353
- const { id, name, description, disabled, readOnly, state, labelId, isInvalid, isRequired } = (0, import_react7.useContext)(FormFieldContext) || {};
354
- return {
355
- id,
356
- name,
357
- description,
358
- disabled,
359
- readOnly,
360
- state,
361
- labelId,
362
- isInvalid,
363
- isRequired
364
- };
365
- };
366
- var FormFieldControl = ({ children }) => {
367
- const props = useFormFieldControl();
368
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: children(props) });
369
- };
370
- FormFieldControl.displayName = "FormField.Control";
371
-
372
- // src/form-field/FormFieldErrorMessage.tsx
373
- var import_jsx_runtime11 = require("react/jsx-runtime");
374
- var FormFieldErrorMessage = ({ ref, ...props }) => {
375
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
376
- FormFieldStateMessage,
377
- {
378
- ref,
379
- "data-spark-component": "form-field-error-message",
380
- state: "error",
381
- ...props
382
- }
383
- );
384
- };
385
- FormFieldErrorMessage.displayName = "FormField.ErrorMessage";
386
-
387
- // src/form-field/FormFieldHelperMessage.tsx
388
- var import_class_variance_authority6 = require("class-variance-authority");
389
- var import_jsx_runtime12 = require("react/jsx-runtime");
390
- var FormFieldHelperMessage = ({
391
- className,
392
- ref,
393
- ...others
394
- }) => {
395
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
396
- FormFieldMessage,
397
- {
398
- ref,
399
- "data-spark-component": "form-field-helper-message",
400
- className: (0, import_class_variance_authority6.cx)("text-on-surface/dim-1", className),
401
- ...others
402
- }
403
- );
404
- };
405
- FormFieldHelperMessage.displayName = "FormField.HelperMessage";
406
-
407
- // src/form-field/FormFieldLabel.tsx
408
- var import_class_variance_authority10 = require("class-variance-authority");
409
-
410
- // src/label/Label.tsx
411
- var import_class_variance_authority7 = require("class-variance-authority");
412
- var import_radix_ui2 = require("radix-ui");
413
- var import_jsx_runtime13 = require("react/jsx-runtime");
414
- var Label = ({ className, ref, ...others }) => {
415
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
416
- import_radix_ui2.Label.Label,
417
- {
418
- ref,
419
- "data-spark-component": "label",
420
- className: (0, import_class_variance_authority7.cx)("text-body-1", className),
421
- ...others
422
- }
423
- );
424
- };
425
- Label.displayName = "Label";
426
-
427
- // src/label/LabelRequiredIndicator.tsx
428
- var import_class_variance_authority8 = require("class-variance-authority");
429
- var import_jsx_runtime14 = require("react/jsx-runtime");
430
- var LabelRequiredIndicator = ({
431
- className,
432
- children = "*",
433
- ref,
434
- ...others
435
- }) => {
436
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
437
- "span",
438
- {
439
- ref,
440
- "data-spark-component": "label-required-indicator",
441
- role: "presentation",
442
- "aria-hidden": "true",
443
- className: (0, import_class_variance_authority8.cx)(className, "text-caption text-on-surface/dim-1"),
444
- ...others,
445
- children
446
- }
447
- );
448
- };
449
- LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
450
-
451
- // src/label/index.ts
452
- var Label2 = Object.assign(Label, {
453
- RequiredIndicator: LabelRequiredIndicator
454
- });
455
- Label2.displayName = "Label";
456
- LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
457
-
458
- // src/form-field/FormFieldRequiredIndicator.tsx
459
- var import_class_variance_authority9 = require("class-variance-authority");
460
- var import_jsx_runtime15 = require("react/jsx-runtime");
461
- var FormFieldRequiredIndicator = ({
462
- className,
463
- ref,
464
- ...props
465
- }) => {
466
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label2.RequiredIndicator, { ref, className: (0, import_class_variance_authority9.cx)("ml-sm", className), ...props });
467
- };
468
- FormFieldRequiredIndicator.displayName = "FormField.RequiredIndicator";
469
-
470
- // src/form-field/FormFieldLabel.tsx
471
- var import_jsx_runtime16 = require("react/jsx-runtime");
472
- var FormFieldLabel = ({
473
- htmlFor: htmlForProp,
474
- className,
475
- children,
476
- requiredIndicator = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FormFieldRequiredIndicator, {}),
477
- asChild,
478
- ref,
479
- ...others
480
- }) => {
481
- const control = useFormField();
482
- const { disabled, labelId, isRequired } = control;
483
- const htmlFor = asChild ? void 0 : htmlForProp || control.id;
484
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
485
- Label2,
486
- {
487
- ref,
488
- id: labelId,
489
- "data-spark-component": "form-field-label",
490
- htmlFor,
491
- className: (0, import_class_variance_authority10.cx)(className, disabled ? "text-on-surface/dim-3 pointer-events-none" : void 0),
492
- asChild,
493
- ...others,
494
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
495
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Slottable, { children }),
496
- isRequired && requiredIndicator
497
- ] })
498
- }
499
- );
500
- };
501
- FormFieldLabel.displayName = "FormField.Label";
502
-
503
- // src/form-field/FormFieldSuccessMessage.tsx
504
- var import_jsx_runtime17 = require("react/jsx-runtime");
505
- var FormFieldSuccessMessage = ({ ref, ...props }) => {
506
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
507
- FormFieldStateMessage,
508
- {
509
- ref,
510
- "data-spark-component": "form-field-success-message",
511
- state: "success",
512
- ...props
513
- }
514
- );
515
- };
516
- FormFieldSuccessMessage.displayName = "FormField.SuccessMessage";
517
-
518
- // src/form-field/index.ts
519
- var FormField2 = Object.assign(FormField, {
520
- Label: FormFieldLabel,
521
- Control: FormFieldControl,
522
- StateMessage: FormFieldStateMessage,
523
- SuccessMessage: FormFieldSuccessMessage,
524
- AlertMessage: FormFieldAlertMessage,
525
- ErrorMessage: FormFieldErrorMessage,
526
- HelperMessage: FormFieldHelperMessage,
527
- RequiredIndicator: FormFieldRequiredIndicator,
528
- CharactersCount: FormFieldCharactersCount
529
- });
530
- FormField2.displayName = "FormField";
531
- FormFieldLabel.displayName = "FormField.Label";
532
- FormFieldControl.displayName = "FormField.Control";
533
- FormFieldStateMessage.displayName = "FormField.StateMessage";
534
- FormFieldSuccessMessage.displayName = "FormField.SuccessMessage";
535
- FormFieldAlertMessage.displayName = "FormField.AlertMessage";
536
- FormFieldErrorMessage.displayName = "FormField.ErrorMessage";
537
- FormFieldHelperMessage.displayName = "FormField.HelperMessage";
538
- FormFieldRequiredIndicator.displayName = "FormField.RequiredIndicator";
539
- FormFieldCharactersCount.displayName = "FormField.CharactersCount";
540
-
541
- // src/checkbox/CheckboxGroupContext.tsx
542
- var import_react8 = require("react");
543
- var CheckboxGroupContext = (0, import_react8.createContext)({});
544
- var useCheckboxGroup = () => {
545
- const context = (0, import_react8.useContext)(CheckboxGroupContext);
546
- return context;
547
- };
548
-
549
- // src/checkbox/CheckboxInput.tsx
550
- var import_Check2 = require("@spark-ui/icons/Check");
551
- var import_Minus = require("@spark-ui/icons/Minus");
552
- var import_radix_ui4 = require("radix-ui");
553
-
554
144
  // src/checkbox/CheckboxIndicator.tsx
555
- var import_radix_ui3 = require("radix-ui");
556
- var import_jsx_runtime18 = require("react/jsx-runtime");
557
- var CheckboxIndicatorPrimitive = import_radix_ui3.Checkbox.CheckboxIndicator;
558
- var CheckboxIndicator = (props) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CheckboxIndicatorPrimitive, { className: "flex size-full items-center justify-center", ...props });
145
+ var import_radix_ui2 = require("radix-ui");
146
+ var import_jsx_runtime4 = require("react/jsx-runtime");
147
+ var CheckboxIndicatorPrimitive = import_radix_ui2.Checkbox.CheckboxIndicator;
148
+ var CheckboxIndicator = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckboxIndicatorPrimitive, { className: "flex size-full items-center justify-center", ...props });
559
149
  CheckboxIndicator.displayName = "CheckboxIndicator";
560
150
 
561
151
  // src/checkbox/CheckboxInput.styles.ts
562
152
  var import_internal_utils2 = require("@spark-ui/internal-utils");
563
- var import_class_variance_authority11 = require("class-variance-authority");
564
- var checkboxInputStyles = (0, import_class_variance_authority11.cva)(
153
+ var import_class_variance_authority2 = require("class-variance-authority");
154
+ var checkboxInputStyles = (0, import_class_variance_authority2.cva)(
565
155
  [
566
156
  "size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent",
567
157
  "disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0",
@@ -648,31 +238,79 @@ var checkboxInputStyles = (0, import_class_variance_authority11.cva)(
648
238
  );
649
239
 
650
240
  // src/checkbox/CheckboxInput.tsx
651
- var import_jsx_runtime19 = require("react/jsx-runtime");
652
- var CheckboxPrimitive = import_radix_ui4.Checkbox.Checkbox;
241
+ var import_jsx_runtime5 = require("react/jsx-runtime");
242
+ var CheckboxPrimitive = import_radix_ui3.Checkbox.Checkbox;
653
243
  var CheckboxInput = ({
654
244
  className,
655
- icon = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_Check2.Check, {}),
656
- indeterminateIcon = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_Minus.Minus, {}),
245
+ icon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Check.Check, {}),
246
+ indeterminateIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Minus.Minus, {}),
657
247
  intent,
658
248
  checked,
659
249
  ref,
660
250
  ...others
661
- }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
251
+ }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
662
252
  CheckboxPrimitive,
663
253
  {
664
254
  ref,
665
255
  className: checkboxInputStyles({ intent, className }),
666
256
  checked,
667
257
  ...others,
668
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CheckboxIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { size: "sm", children: checked === "indeterminate" ? indeterminateIcon : icon }) })
258
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CheckboxIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { size: "sm", children: checked === "indeterminate" ? indeterminateIcon : icon }) })
669
259
  }
670
260
  );
671
261
  CheckboxInput.displayName = "CheckboxInput";
672
262
 
263
+ // src/label/Label.tsx
264
+ var import_class_variance_authority3 = require("class-variance-authority");
265
+ var import_radix_ui4 = require("radix-ui");
266
+ var import_jsx_runtime6 = require("react/jsx-runtime");
267
+ var Label = ({ className, ref, ...others }) => {
268
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
269
+ import_radix_ui4.Label.Label,
270
+ {
271
+ ref,
272
+ "data-spark-component": "label",
273
+ className: (0, import_class_variance_authority3.cx)("text-body-1", className),
274
+ ...others
275
+ }
276
+ );
277
+ };
278
+ Label.displayName = "Label";
279
+
280
+ // src/label/LabelRequiredIndicator.tsx
281
+ var import_class_variance_authority4 = require("class-variance-authority");
282
+ var import_jsx_runtime7 = require("react/jsx-runtime");
283
+ var LabelRequiredIndicator = ({
284
+ className,
285
+ children = "*",
286
+ ref,
287
+ ...others
288
+ }) => {
289
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
290
+ "span",
291
+ {
292
+ ref,
293
+ "data-spark-component": "label-required-indicator",
294
+ role: "presentation",
295
+ "aria-hidden": "true",
296
+ className: (0, import_class_variance_authority4.cx)(className, "text-caption text-on-surface/dim-1"),
297
+ ...others,
298
+ children
299
+ }
300
+ );
301
+ };
302
+ LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
303
+
304
+ // src/label/index.ts
305
+ var Label2 = Object.assign(Label, {
306
+ RequiredIndicator: LabelRequiredIndicator
307
+ });
308
+ Label2.displayName = "Label";
309
+ LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
310
+
673
311
  // src/checkbox/CheckboxLabel.styles.ts
674
- var import_class_variance_authority12 = require("class-variance-authority");
675
- var labelStyles = (0, import_class_variance_authority12.cva)("grow", {
312
+ var import_class_variance_authority5 = require("class-variance-authority");
313
+ var labelStyles = (0, import_class_variance_authority5.cva)("grow", {
676
314
  variants: {
677
315
  disabled: {
678
316
  true: ["text-neutral/dim-2", "cursor-not-allowed"],
@@ -685,13 +323,13 @@ var labelStyles = (0, import_class_variance_authority12.cva)("grow", {
685
323
  });
686
324
 
687
325
  // src/checkbox/CheckboxLabel.tsx
688
- var import_jsx_runtime20 = require("react/jsx-runtime");
689
- var CheckboxLabel = ({ disabled, ...others }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Label2, { className: labelStyles({ disabled }), ...others });
326
+ var import_jsx_runtime8 = require("react/jsx-runtime");
327
+ var CheckboxLabel = ({ disabled, ...others }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label2, { className: labelStyles({ disabled }), ...others });
690
328
  CheckboxLabel.displayName = "CheckboxLabel";
691
329
 
692
330
  // src/checkbox/Checkbox.tsx
693
- var import_jsx_runtime21 = require("react/jsx-runtime");
694
- var ID_PREFIX2 = ":checkbox";
331
+ var import_jsx_runtime9 = require("react/jsx-runtime");
332
+ var ID_PREFIX = ":checkbox";
695
333
  var Checkbox3 = ({
696
334
  id: idProp,
697
335
  className,
@@ -705,12 +343,12 @@ var Checkbox3 = ({
705
343
  ref: forwardedRef,
706
344
  ...others
707
345
  }) => {
708
- const checkboxId = `${ID_PREFIX2}-${(0, import_react9.useId)()}`;
346
+ const checkboxId = `${ID_PREFIX}-${(0, import_react4.useId)()}`;
709
347
  const innerId = idProp || checkboxId;
710
- const innerLabelId = `${ID_PREFIX2}-${(0, import_react9.useId)()}`;
711
- const field = useFormFieldControl();
348
+ const innerLabelId = `${ID_PREFIX}-${(0, import_react4.useId)()}`;
349
+ const field = (0, import_form_field.useFormFieldControl)();
712
350
  const group = useCheckboxGroup();
713
- const rootRef = (0, import_react9.useRef)(null);
351
+ const rootRef = (0, import_react4.useRef)(null);
714
352
  const ref = (0, import_use_merge_refs.useMergeRefs)(forwardedRef, rootRef);
715
353
  const getCheckboxAttributes = ({
716
354
  fieldState,
@@ -747,12 +385,12 @@ var Checkbox3 = ({
747
385
  groupState: group,
748
386
  checkboxIntent: intentProp
749
387
  });
750
- const isRequired = (0, import_react9.useMemo)(() => {
388
+ const isRequired = (0, import_react4.useMemo)(() => {
751
389
  if (!group) return isRequiredAttr;
752
390
  return isRequiredAttr ? !group.value?.length : false;
753
391
  }, [group, isRequiredAttr]);
754
- const checkboxLabel = children && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CheckboxLabel, { disabled, htmlFor: id || innerId, id: innerLabelId, children });
755
- const checkboxInput = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
392
+ const checkboxLabel = children && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckboxLabel, { disabled, htmlFor: id || innerId, id: innerLabelId, children });
393
+ const checkboxInput = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
756
394
  CheckboxInput,
757
395
  {
758
396
  ref,
@@ -770,18 +408,18 @@ var Checkbox3 = ({
770
408
  ...others
771
409
  }
772
410
  );
773
- const content = group.reverse || reverse ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
411
+ const content = group.reverse || reverse ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
774
412
  checkboxLabel,
775
413
  checkboxInput
776
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
414
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
777
415
  checkboxInput,
778
416
  checkboxLabel
779
417
  ] });
780
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
418
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
781
419
  "div",
782
420
  {
783
421
  "data-spark-component": "checkbox",
784
- className: (0, import_class_variance_authority13.cx)("gap-md text-body-1 relative flex items-start", className),
422
+ className: (0, import_class_variance_authority6.cx)("gap-md text-body-1 relative flex items-start", className),
785
423
  children: content
786
424
  }
787
425
  );
@@ -789,12 +427,13 @@ var Checkbox3 = ({
789
427
  Checkbox3.displayName = "Checkbox";
790
428
 
791
429
  // src/checkbox/CheckboxGroup.tsx
430
+ var import_form_field2 = require("@spark-ui/components/form-field");
792
431
  var import_use_combined_state = require("@spark-ui/use-combined-state");
793
- var import_react10 = require("react");
432
+ var import_react5 = require("react");
794
433
 
795
434
  // src/checkbox/CheckboxGroup.styles.ts
796
- var import_class_variance_authority14 = require("class-variance-authority");
797
- var checkboxGroupStyles = (0, import_class_variance_authority14.cva)(["flex"], {
435
+ var import_class_variance_authority7 = require("class-variance-authority");
436
+ var checkboxGroupStyles = (0, import_class_variance_authority7.cva)(["flex"], {
798
437
  variants: {
799
438
  /**
800
439
  * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.
@@ -807,7 +446,7 @@ var checkboxGroupStyles = (0, import_class_variance_authority14.cva)(["flex"], {
807
446
  });
808
447
 
809
448
  // src/checkbox/CheckboxGroup.tsx
810
- var import_jsx_runtime22 = require("react/jsx-runtime");
449
+ var import_jsx_runtime10 = require("react/jsx-runtime");
811
450
  var CheckboxGroup = ({
812
451
  name: nameProp,
813
452
  value: valueProp,
@@ -822,11 +461,11 @@ var CheckboxGroup = ({
822
461
  ...others
823
462
  }) => {
824
463
  const [value, setValue] = (0, import_use_combined_state.useCombinedState)(valueProp, defaultValue);
825
- const field = useFormFieldControl();
826
- const onCheckedChangeRef = (0, import_react10.useRef)(onCheckedChangeProp);
464
+ const field = (0, import_form_field2.useFormFieldControl)();
465
+ const onCheckedChangeRef = (0, import_react5.useRef)(onCheckedChangeProp);
827
466
  const { id, labelId, description, state, isInvalid, isRequired } = field;
828
467
  const name = nameProp ?? field.name;
829
- const current = (0, import_react10.useMemo)(() => {
468
+ const current = (0, import_react5.useMemo)(() => {
830
469
  const handleCheckedChange = (checked, changed) => {
831
470
  const values = value || [];
832
471
  const modified = checked ? [...values, changed] : values.filter((val) => val !== changed);
@@ -848,10 +487,10 @@ var CheckboxGroup = ({
848
487
  onCheckedChange: handleCheckedChange
849
488
  };
850
489
  }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse]);
851
- (0, import_react10.useEffect)(() => {
490
+ (0, import_react5.useEffect)(() => {
852
491
  onCheckedChangeRef.current = onCheckedChangeProp;
853
492
  }, [onCheckedChangeProp]);
854
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CheckboxGroupContext.Provider, { value: current, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
493
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CheckboxGroupContext.Provider, { value: current, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
855
494
  "div",
856
495
  {
857
496
  ref,