@spark-ui/components 10.0.2 → 10.0.4

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 (44) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/checkbox/index.js +117 -478
  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-JC6KKYUQ.mjs → chunk-7BTJUYP3.mjs} +6 -5
  7. package/dist/{chunk-JC6KKYUQ.mjs.map → chunk-7BTJUYP3.mjs.map} +1 -1
  8. package/dist/combobox/index.js +301 -710
  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 +252 -662
  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 +47 -454
  19. package/dist/input/index.js.map +1 -1
  20. package/dist/input/index.mjs +1 -3
  21. package/dist/radio-group/index.js +47 -553
  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 +159 -569
  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 +110 -516
  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 +96 -545
  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 +58 -465
  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 +20 -10
  42. package/tsup.config.ts +2 -1
  43. package/dist/chunk-7PMPYEHJ.mjs +0 -379
  44. package/dist/chunk-7PMPYEHJ.mjs.map +0 -1
@@ -25,135 +25,42 @@ __export(checkbox_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(checkbox_exports);
27
27
 
28
- // src/form-field/FormField.tsx
29
- var import_class_variance_authority = require("class-variance-authority");
28
+ // src/checkbox/Checkbox.tsx
29
+ var import_form_field = require("@spark-ui/components/form-field");
30
+ var import_use_merge_refs = require("@spark-ui/use-merge-refs");
31
+ var import_class_variance_authority6 = require("class-variance-authority");
30
32
  var import_react4 = require("react");
31
33
 
32
- // src/slot/Slot.tsx
33
- var import_radix_ui = require("radix-ui");
34
+ // src/checkbox/CheckboxGroupContext.tsx
34
35
  var import_react = require("react");
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var Slottable = import_radix_ui.Slot.Slottable;
37
- var Slot = ({ ref, ...props }) => {
38
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
39
- };
40
-
41
- // src/form-field/FormFieldContext.tsx
42
- var import_react2 = require("react");
43
- var FormFieldContext = (0, import_react2.createContext)(null);
44
- var ID_PREFIX = ":form-field";
45
- var useFormField = () => {
46
- const context = (0, import_react2.useContext)(FormFieldContext);
47
- if (!context) {
48
- throw Error("useFormField must be used within a FormField provider");
49
- }
36
+ var CheckboxGroupContext = (0, import_react.createContext)({});
37
+ var useCheckboxGroup = () => {
38
+ const context = (0, import_react.useContext)(CheckboxGroupContext);
50
39
  return context;
51
40
  };
52
41
 
53
- // src/form-field/FormFieldProvider.tsx
54
- var import_react3 = require("react");
55
- var import_jsx_runtime2 = require("react/jsx-runtime");
56
- var FormFieldProvider = ({
57
- id,
58
- name,
59
- disabled = false,
60
- readOnly = false,
61
- state,
62
- isRequired,
63
- children
64
- }) => {
65
- const labelId = `${ID_PREFIX}-label-${(0, import_react3.useId)()}`;
66
- const [messageIds, setMessageIds] = (0, import_react3.useState)([]);
67
- const description = messageIds.length > 0 ? messageIds.join(" ") : void 0;
68
- const handleMessageIdAdd = (0, import_react3.useCallback)((msgId) => {
69
- setMessageIds((ids) => [...ids, msgId]);
70
- }, []);
71
- const handleMessageIdRemove = (0, import_react3.useCallback)((msgId) => {
72
- setMessageIds((ids) => ids.filter((current) => current !== msgId));
73
- }, []);
74
- const value = (0, import_react3.useMemo)(() => {
75
- const isInvalid = state === "error";
76
- return {
77
- id,
78
- labelId,
79
- name,
80
- disabled,
81
- readOnly,
82
- state,
83
- isRequired,
84
- isInvalid,
85
- description,
86
- onMessageIdAdd: handleMessageIdAdd,
87
- onMessageIdRemove: handleMessageIdRemove
88
- };
89
- }, [
90
- id,
91
- labelId,
92
- name,
93
- disabled,
94
- readOnly,
95
- description,
96
- state,
97
- isRequired,
98
- handleMessageIdAdd,
99
- handleMessageIdRemove
100
- ]);
101
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FormFieldContext.Provider, { value, children });
102
- };
103
- FormFieldProvider.displayName = "FormFieldProvider";
104
-
105
- // src/form-field/FormField.tsx
106
- var import_jsx_runtime3 = require("react/jsx-runtime");
107
- var FormField = ({
108
- className,
109
- disabled = false,
110
- readOnly = false,
111
- name,
112
- state,
113
- isRequired = false,
114
- asChild = false,
115
- ref,
116
- ...others
117
- }) => {
118
- const id = `${ID_PREFIX}-${(0, import_react4.useId)()}`;
119
- const Component = asChild ? Slot : "div";
120
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
121
- FormFieldProvider,
122
- {
123
- id,
124
- name,
125
- isRequired,
126
- disabled,
127
- readOnly,
128
- state,
129
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
130
- Component,
131
- {
132
- ref,
133
- "data-spark-component": "form-field",
134
- className: (0, import_class_variance_authority.cx)(className, "gap-sm flex flex-col"),
135
- ...others
136
- }
137
- )
138
- }
139
- );
140
- };
141
- FormField.displayName = "FormField";
142
-
143
- // src/form-field/FormFieldStateMessage.tsx
144
- var import_AlertOutline = require("@spark-ui/icons/AlertOutline");
42
+ // src/checkbox/CheckboxInput.tsx
145
43
  var import_Check = require("@spark-ui/icons/Check");
146
- var import_WarningOutline = require("@spark-ui/icons/WarningOutline");
147
- 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");
148
46
 
149
47
  // src/icon/Icon.tsx
150
- 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
+ };
151
58
 
152
59
  // src/visually-hidden/VisuallyHidden.tsx
153
- var import_jsx_runtime4 = require("react/jsx-runtime");
60
+ var import_jsx_runtime2 = require("react/jsx-runtime");
154
61
  var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
155
62
  const Component = asChild ? Slot : "span";
156
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
63
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
157
64
  Component,
158
65
  {
159
66
  ...props,
@@ -179,8 +86,8 @@ VisuallyHidden.displayName = "VisuallyHidden";
179
86
 
180
87
  // src/icon/Icon.styles.tsx
181
88
  var import_internal_utils = require("@spark-ui/internal-utils");
182
- var import_class_variance_authority2 = require("class-variance-authority");
183
- 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"], {
184
91
  variants: {
185
92
  /**
186
93
  * Color scheme of the icon.
@@ -211,7 +118,7 @@ var iconStyles = (0, import_class_variance_authority2.cva)(["fill-current shrink
211
118
  });
212
119
 
213
120
  // src/icon/Icon.tsx
214
- var import_jsx_runtime5 = require("react/jsx-runtime");
121
+ var import_jsx_runtime3 = require("react/jsx-runtime");
215
122
  var Icon = ({
216
123
  label,
217
124
  className,
@@ -220,348 +127,31 @@ var Icon = ({
220
127
  children,
221
128
  ...others
222
129
  }) => {
223
- const child = import_react5.Children.only(children);
224
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
225
- (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, {
226
133
  className: iconStyles({ className, size, intent }),
227
134
  "data-spark-component": "icon",
228
135
  "aria-hidden": "true",
229
136
  focusable: "false",
230
137
  ...others
231
138
  }),
232
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VisuallyHidden, { children: label })
139
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(VisuallyHidden, { children: label })
233
140
  ] });
234
141
  };
235
142
  Icon.displayName = "Icon";
236
143
 
237
- // src/form-field/FormFieldMessage.tsx
238
- var import_class_variance_authority3 = require("class-variance-authority");
239
- var import_react6 = require("react");
240
- var import_jsx_runtime6 = require("react/jsx-runtime");
241
- var FormFieldMessage = ({
242
- id: idProp,
243
- className,
244
- ref,
245
- ...others
246
- }) => {
247
- const { onMessageIdAdd, onMessageIdRemove } = useFormField();
248
- const currentId = `${ID_PREFIX}-message-${(0, import_react6.useId)()}`;
249
- const id = idProp || currentId;
250
- (0, import_react6.useEffect)(() => {
251
- onMessageIdAdd(id);
252
- return () => {
253
- onMessageIdRemove(id);
254
- };
255
- }, [id, onMessageIdAdd, onMessageIdRemove]);
256
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
257
- "span",
258
- {
259
- ref,
260
- id,
261
- "data-spark-component": "form-field-message",
262
- className: (0, import_class_variance_authority3.cx)(className, "text-caption"),
263
- ...others
264
- }
265
- );
266
- };
267
- FormFieldMessage.displayName = "FormField.Message";
268
-
269
- // src/form-field/FormFieldStateMessage.tsx
270
- var import_jsx_runtime7 = require("react/jsx-runtime");
271
- var FormFieldStateMessage = ({
272
- className,
273
- state,
274
- children,
275
- ref,
276
- ...others
277
- }) => {
278
- const field = useFormField();
279
- if (field.state !== state) {
280
- return null;
281
- }
282
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
283
- FormFieldMessage,
284
- {
285
- ref,
286
- "data-spark-component": "form-field-state-message",
287
- "aria-live": "polite",
288
- className: (0, import_class_variance_authority4.cx)(
289
- "gap-sm flex items-center",
290
- state === "error" ? "text-error" : "text-on-surface/dim-1",
291
- className
292
- ),
293
- ...others,
294
- children: [
295
- state === "alert" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_WarningOutline.WarningOutline, {}) }),
296
- state === "error" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", intent: "error", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_AlertOutline.AlertOutline, {}) }),
297
- state === "success" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Check.Check, {}) }),
298
- children
299
- ]
300
- }
301
- );
302
- };
303
- FormFieldStateMessage.displayName = "FormField.StateMessage";
304
-
305
- // src/form-field/FormFieldAlertMessage.tsx
306
- var import_jsx_runtime8 = require("react/jsx-runtime");
307
- var FormFieldAlertMessage = ({ ref, ...props }) => {
308
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
309
- FormFieldStateMessage,
310
- {
311
- ref,
312
- "data-spark-component": "form-field-alert-message",
313
- state: "alert",
314
- ...props
315
- }
316
- );
317
- };
318
- FormFieldAlertMessage.displayName = "FormField.AlertMessage";
319
-
320
- // src/form-field/FormFieldCharactersCount.tsx
321
- var import_class_variance_authority5 = require("class-variance-authority");
322
- var import_jsx_runtime9 = require("react/jsx-runtime");
323
- var FormFieldCharactersCount = ({
324
- className,
325
- value = "",
326
- maxLength,
327
- ref,
328
- ...others
329
- }) => {
330
- const displayValue = `${value.length}/${maxLength}`;
331
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
332
- "span",
333
- {
334
- ref,
335
- "data-spark-component": "form-field-characters-count",
336
- className: (0, import_class_variance_authority5.cx)(className, "text-caption", "text-neutral"),
337
- ...others,
338
- children: displayValue
339
- }
340
- );
341
- };
342
- FormFieldCharactersCount.displayName = "FormField.CharactersCount";
343
-
344
- // src/form-field/FormFieldControl.tsx
345
- var import_react7 = require("react");
346
- var import_jsx_runtime10 = require("react/jsx-runtime");
347
- var useFormFieldControl = () => {
348
- const { id, name, description, disabled, readOnly, state, labelId, isInvalid, isRequired } = (0, import_react7.useContext)(FormFieldContext) || {};
349
- return {
350
- id,
351
- name,
352
- description,
353
- disabled,
354
- readOnly,
355
- state,
356
- labelId,
357
- isInvalid,
358
- isRequired
359
- };
360
- };
361
- var FormFieldControl = ({ children }) => {
362
- const props = useFormFieldControl();
363
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: children(props) });
364
- };
365
- FormFieldControl.displayName = "FormField.Control";
366
-
367
- // src/form-field/FormFieldErrorMessage.tsx
368
- var import_jsx_runtime11 = require("react/jsx-runtime");
369
- var FormFieldErrorMessage = ({ ref, ...props }) => {
370
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
371
- FormFieldStateMessage,
372
- {
373
- ref,
374
- "data-spark-component": "form-field-error-message",
375
- state: "error",
376
- ...props
377
- }
378
- );
379
- };
380
- FormFieldErrorMessage.displayName = "FormField.ErrorMessage";
381
-
382
- // src/form-field/FormFieldHelperMessage.tsx
383
- var import_class_variance_authority6 = require("class-variance-authority");
384
- var import_jsx_runtime12 = require("react/jsx-runtime");
385
- var FormFieldHelperMessage = ({
386
- className,
387
- ref,
388
- ...others
389
- }) => {
390
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
391
- FormFieldMessage,
392
- {
393
- ref,
394
- "data-spark-component": "form-field-helper-message",
395
- className: (0, import_class_variance_authority6.cx)("text-on-surface/dim-1", className),
396
- ...others
397
- }
398
- );
399
- };
400
- FormFieldHelperMessage.displayName = "FormField.HelperMessage";
401
-
402
- // src/form-field/FormFieldLabel.tsx
403
- var import_class_variance_authority10 = require("class-variance-authority");
404
-
405
- // src/label/Label.tsx
406
- var import_class_variance_authority7 = require("class-variance-authority");
407
- var import_radix_ui2 = require("radix-ui");
408
- var import_jsx_runtime13 = require("react/jsx-runtime");
409
- var Label = ({ className, ref, ...others }) => {
410
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
411
- import_radix_ui2.Label.Label,
412
- {
413
- ref,
414
- "data-spark-component": "label",
415
- className: (0, import_class_variance_authority7.cx)("text-body-1", className),
416
- ...others
417
- }
418
- );
419
- };
420
- Label.displayName = "Label";
421
-
422
- // src/label/LabelRequiredIndicator.tsx
423
- var import_class_variance_authority8 = require("class-variance-authority");
424
- var import_jsx_runtime14 = require("react/jsx-runtime");
425
- var LabelRequiredIndicator = ({
426
- className,
427
- children = "*",
428
- ref,
429
- ...others
430
- }) => {
431
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
432
- "span",
433
- {
434
- ref,
435
- "data-spark-component": "label-required-indicator",
436
- role: "presentation",
437
- "aria-hidden": "true",
438
- className: (0, import_class_variance_authority8.cx)(className, "text-caption text-on-surface/dim-1"),
439
- ...others,
440
- children
441
- }
442
- );
443
- };
444
- LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
445
-
446
- // src/label/index.ts
447
- var Label2 = Object.assign(Label, {
448
- RequiredIndicator: LabelRequiredIndicator
449
- });
450
- Label2.displayName = "Label";
451
- LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
452
-
453
- // src/form-field/FormFieldRequiredIndicator.tsx
454
- var import_class_variance_authority9 = require("class-variance-authority");
455
- var import_jsx_runtime15 = require("react/jsx-runtime");
456
- var FormFieldRequiredIndicator = ({
457
- className,
458
- ref,
459
- ...props
460
- }) => {
461
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label2.RequiredIndicator, { ref, className: (0, import_class_variance_authority9.cx)("ml-sm", className), ...props });
462
- };
463
- FormFieldRequiredIndicator.displayName = "FormField.RequiredIndicator";
464
-
465
- // src/form-field/FormFieldLabel.tsx
466
- var import_jsx_runtime16 = require("react/jsx-runtime");
467
- var FormFieldLabel = ({
468
- htmlFor: htmlForProp,
469
- className,
470
- children,
471
- requiredIndicator = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FormFieldRequiredIndicator, {}),
472
- asChild,
473
- ref,
474
- ...others
475
- }) => {
476
- const control = useFormField();
477
- const { disabled, labelId, isRequired } = control;
478
- const htmlFor = asChild ? void 0 : htmlForProp || control.id;
479
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
480
- Label2,
481
- {
482
- ref,
483
- id: labelId,
484
- "data-spark-component": "form-field-label",
485
- htmlFor,
486
- className: (0, import_class_variance_authority10.cx)(className, disabled ? "text-on-surface/dim-3 pointer-events-none" : void 0),
487
- asChild,
488
- ...others,
489
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
490
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Slottable, { children }),
491
- isRequired && requiredIndicator
492
- ] })
493
- }
494
- );
495
- };
496
- FormFieldLabel.displayName = "FormField.Label";
497
-
498
- // src/form-field/FormFieldSuccessMessage.tsx
499
- var import_jsx_runtime17 = require("react/jsx-runtime");
500
- var FormFieldSuccessMessage = ({ ref, ...props }) => {
501
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
502
- FormFieldStateMessage,
503
- {
504
- ref,
505
- "data-spark-component": "form-field-success-message",
506
- state: "success",
507
- ...props
508
- }
509
- );
510
- };
511
- FormFieldSuccessMessage.displayName = "FormField.SuccessMessage";
512
-
513
- // src/form-field/index.ts
514
- var FormField2 = Object.assign(FormField, {
515
- Label: FormFieldLabel,
516
- Control: FormFieldControl,
517
- StateMessage: FormFieldStateMessage,
518
- SuccessMessage: FormFieldSuccessMessage,
519
- AlertMessage: FormFieldAlertMessage,
520
- ErrorMessage: FormFieldErrorMessage,
521
- HelperMessage: FormFieldHelperMessage,
522
- RequiredIndicator: FormFieldRequiredIndicator,
523
- CharactersCount: FormFieldCharactersCount
524
- });
525
- FormField2.displayName = "FormField";
526
- FormFieldLabel.displayName = "FormField.Label";
527
- FormFieldControl.displayName = "FormField.Control";
528
- FormFieldStateMessage.displayName = "FormField.StateMessage";
529
- FormFieldSuccessMessage.displayName = "FormField.SuccessMessage";
530
- FormFieldAlertMessage.displayName = "FormField.AlertMessage";
531
- FormFieldErrorMessage.displayName = "FormField.ErrorMessage";
532
- FormFieldHelperMessage.displayName = "FormField.HelperMessage";
533
- FormFieldRequiredIndicator.displayName = "FormField.RequiredIndicator";
534
- FormFieldCharactersCount.displayName = "FormField.CharactersCount";
535
-
536
- // src/checkbox/Checkbox.tsx
537
- var import_use_merge_refs = require("@spark-ui/use-merge-refs");
538
- var import_class_variance_authority13 = require("class-variance-authority");
539
- var import_react9 = require("react");
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,