@spark-ui/components 17.2.5-beta.0 → 17.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/{FormFieldRequiredIndicator-CtgkvPZo.js → FormFieldRequiredIndicator-CEB8Ez-q.js} +2 -2
  2. package/dist/{FormFieldRequiredIndicator-CtgkvPZo.js.map → FormFieldRequiredIndicator-CEB8Ez-q.js.map} +1 -1
  3. package/dist/{FormFieldRequiredIndicator-DOGQ_HxO.mjs → FormFieldRequiredIndicator-CzdpinIz.mjs} +2 -2
  4. package/dist/{FormFieldRequiredIndicator-DOGQ_HxO.mjs.map → FormFieldRequiredIndicator-CzdpinIz.mjs.map} +1 -1
  5. package/dist/avatar/index.js +1 -1
  6. package/dist/avatar/index.mjs +1 -1
  7. package/dist/button/index.js +1 -1
  8. package/dist/button/index.mjs +1 -1
  9. package/dist/{button-CvvFH9fU.js → button-B-sMnDc_.js} +2 -2
  10. package/dist/{button-CvvFH9fU.js.map → button-B-sMnDc_.js.map} +1 -1
  11. package/dist/{button-CaQkq3cR.mjs → button-C6nlNPdv.mjs} +26 -25
  12. package/dist/{button-CaQkq3cR.mjs.map → button-C6nlNPdv.mjs.map} +1 -1
  13. package/dist/carousel/index.js +1 -1
  14. package/dist/carousel/index.mjs +1 -1
  15. package/dist/checkbox/index.js +1 -2
  16. package/dist/checkbox/index.mjs +2 -216
  17. package/dist/checkbox-DjwbAH09.js +2 -0
  18. package/dist/checkbox-DjwbAH09.js.map +1 -0
  19. package/dist/checkbox-xsURzANi.mjs +216 -0
  20. package/dist/checkbox-xsURzANi.mjs.map +1 -0
  21. package/dist/chip/index.js +1 -1
  22. package/dist/chip/index.js.map +1 -1
  23. package/dist/chip/index.mjs +1 -1
  24. package/dist/chip/index.mjs.map +1 -1
  25. package/dist/combobox/index.js +1 -1
  26. package/dist/combobox/index.js.map +1 -1
  27. package/dist/combobox/index.mjs +3 -3
  28. package/dist/combobox/index.mjs.map +1 -1
  29. package/dist/dialog/index.js +1 -1
  30. package/dist/dialog/index.mjs +2 -2
  31. package/dist/drawer/index.js +1 -1
  32. package/dist/drawer/index.mjs +2 -2
  33. package/dist/dropdown/index.js +1 -1
  34. package/dist/dropdown/index.js.map +1 -1
  35. package/dist/dropdown/index.mjs +2 -2
  36. package/dist/dropdown/index.mjs.map +1 -1
  37. package/dist/file-upload/index.js +1 -1
  38. package/dist/file-upload/index.mjs +3 -3
  39. package/dist/form-field/index.js +1 -1
  40. package/dist/form-field/index.mjs +1 -1
  41. package/dist/{form-field-Bu_0E9tb.js → form-field-81wzFxM0.js} +2 -2
  42. package/dist/{form-field-Bu_0E9tb.js.map → form-field-81wzFxM0.js.map} +1 -1
  43. package/dist/{form-field-B8QzM655.mjs → form-field-GTAuK_nO.mjs} +3 -3
  44. package/dist/{form-field-B8QzM655.mjs.map → form-field-GTAuK_nO.mjs.map} +1 -1
  45. package/dist/icon-button/index.js +1 -1
  46. package/dist/icon-button/index.mjs +1 -1
  47. package/dist/icon-button-CYz_Fitz.js +2 -0
  48. package/dist/{icon-button-D1Lg6gvI.js.map → icon-button-CYz_Fitz.js.map} +1 -1
  49. package/dist/{icon-button-C669hs83.mjs → icon-button-DpucUC_L.mjs} +3 -3
  50. package/dist/{icon-button-C669hs83.mjs.map → icon-button-DpucUC_L.mjs.map} +1 -1
  51. package/dist/input/index.js +1 -1
  52. package/dist/input/index.mjs +1 -1
  53. package/dist/{input-C8JGTQf_.js → input-BUSYZ_VO.js} +2 -2
  54. package/dist/input-BUSYZ_VO.js.map +1 -0
  55. package/dist/{input-n-ocJBNV.mjs → input-CiWFuTs_.mjs} +7 -7
  56. package/dist/input-CiWFuTs_.mjs.map +1 -0
  57. package/dist/label/index.js +1 -1
  58. package/dist/label/index.mjs +1 -1
  59. package/dist/{label-DU0p0d-f.js → label-BCSEss4U.js} +1 -1
  60. package/dist/{label-DU0p0d-f.js.map → label-BCSEss4U.js.map} +1 -1
  61. package/dist/{label-BqRlrca0.mjs → label-DDBRKLUX.mjs} +1 -1
  62. package/dist/{label-BqRlrca0.mjs.map → label-DDBRKLUX.mjs.map} +1 -1
  63. package/dist/pagination/index.js +1 -1
  64. package/dist/pagination/index.js.map +1 -1
  65. package/dist/pagination/index.mjs +14 -14
  66. package/dist/pagination/index.mjs.map +1 -1
  67. package/dist/popover/index.js +1 -1
  68. package/dist/popover/index.mjs +1 -1
  69. package/dist/{popover-DeJQ91qR.js → popover-CrKp_TKk.js} +2 -2
  70. package/dist/{popover-DeJQ91qR.js.map → popover-CrKp_TKk.js.map} +1 -1
  71. package/dist/{popover-BC8GjGp3.mjs → popover-DsBY8eYl.mjs} +2 -2
  72. package/dist/{popover-BC8GjGp3.mjs.map → popover-DsBY8eYl.mjs.map} +1 -1
  73. package/dist/progress/index.js +1 -1
  74. package/dist/progress/index.mjs +1 -1
  75. package/dist/{progress-rJZcPJsZ.js → progress-BjqJSRnK.js} +1 -1
  76. package/dist/{progress-rJZcPJsZ.js.map → progress-BjqJSRnK.js.map} +1 -1
  77. package/dist/{progress-cEf3tFbn.mjs → progress-C3w4PmxY.mjs} +1 -1
  78. package/dist/{progress-cEf3tFbn.mjs.map → progress-C3w4PmxY.mjs.map} +1 -1
  79. package/dist/rating/index.js +1 -1
  80. package/dist/rating/index.mjs +1 -1
  81. package/dist/scrolling-list/index.js +1 -1
  82. package/dist/scrolling-list/index.mjs +2 -2
  83. package/dist/select/index.js +1 -1
  84. package/dist/select/index.js.map +1 -1
  85. package/dist/select/index.mjs +1 -1
  86. package/dist/select/index.mjs.map +1 -1
  87. package/dist/slider/index.js +1 -1
  88. package/dist/slider/index.mjs +2 -2
  89. package/dist/src/button/Button.d.ts +7 -1
  90. package/dist/src/table/ResizableTableContainer.d.ts +9 -0
  91. package/dist/src/table/Table.d.ts +45 -0
  92. package/dist/src/table/Table.styles.d.ts +11 -0
  93. package/dist/src/table/TableBody.d.ts +8 -0
  94. package/dist/src/table/TableBulkBar.d.ts +27 -0
  95. package/dist/src/table/TableCell.d.ts +10 -0
  96. package/dist/src/table/TableColumn.d.ts +12 -0
  97. package/dist/src/table/TableContext.d.ts +28 -0
  98. package/dist/src/table/TableHeader.d.ts +10 -0
  99. package/dist/src/table/TableHeaderSelectionCheckbox.d.ts +13 -0
  100. package/dist/src/table/TableRow.d.ts +8 -0
  101. package/dist/src/table/TableSelectionCheckbox.d.ts +7 -0
  102. package/dist/src/table/index.d.mts +31 -0
  103. package/dist/src/table/index.d.ts +31 -0
  104. package/dist/src/table/table-utils.d.ts +2 -0
  105. package/dist/src/table/useTablePagination.d.ts +76 -0
  106. package/dist/src/table/useTableSort.d.ts +38 -0
  107. package/dist/src/toast/Toast.styles.d.ts +0 -4
  108. package/dist/stepper/index.js +1 -1
  109. package/dist/stepper/index.mjs +2 -2
  110. package/dist/switch/index.js +1 -1
  111. package/dist/switch/index.mjs +2 -2
  112. package/dist/table/index.js +2 -0
  113. package/dist/table/index.js.map +1 -0
  114. package/dist/table/index.mjs +529 -0
  115. package/dist/table/index.mjs.map +1 -0
  116. package/dist/tabs/index.js +1 -1
  117. package/dist/tabs/index.mjs +3 -3
  118. package/dist/tag/index.js +1 -1
  119. package/dist/tag/index.js.map +1 -1
  120. package/dist/tag/index.mjs +2 -2
  121. package/dist/tag/index.mjs.map +1 -1
  122. package/dist/textarea/index.js +1 -1
  123. package/dist/textarea/index.js.map +1 -1
  124. package/dist/textarea/index.mjs +2 -2
  125. package/dist/textarea/index.mjs.map +1 -1
  126. package/dist/toast/index.js +1 -1
  127. package/dist/toast/index.js.map +1 -1
  128. package/dist/toast/index.mjs +2 -17
  129. package/dist/toast/index.mjs.map +1 -1
  130. package/dist/{useRenderSlot-Xxf_s88b.js → useRenderSlot-C4UVWhDN.js} +1 -1
  131. package/dist/{useRenderSlot-Xxf_s88b.js.map → useRenderSlot-C4UVWhDN.js.map} +1 -1
  132. package/dist/{useRenderSlot-DP4fYerF.mjs → useRenderSlot-DKIwoqpO.mjs} +1 -1
  133. package/dist/{useRenderSlot-DP4fYerF.mjs.map → useRenderSlot-DKIwoqpO.mjs.map} +1 -1
  134. package/package.json +5 -4
  135. package/dist/checkbox/index.js.map +0 -1
  136. package/dist/checkbox/index.mjs.map +0 -1
  137. package/dist/icon-button-D1Lg6gvI.js +0 -2
  138. package/dist/input-C8JGTQf_.js.map +0 -1
  139. package/dist/input-n-ocJBNV.mjs.map +0 -1
  140. package/dist/snackbar/index.js +0 -2
  141. package/dist/snackbar/index.js.map +0 -1
  142. package/dist/snackbar/index.mjs +0 -409
  143. package/dist/snackbar/index.mjs.map +0 -1
  144. package/dist/src/snackbar/Snackbar.d.ts +0 -29
  145. package/dist/src/snackbar/SnackbarItem.d.ts +0 -49
  146. package/dist/src/snackbar/SnackbarItem.styles.d.ts +0 -10
  147. package/dist/src/snackbar/SnackbarItemAction.d.ts +0 -10
  148. package/dist/src/snackbar/SnackbarItemClose.d.ts +0 -9
  149. package/dist/src/snackbar/SnackbarItemContext.d.ts +0 -8
  150. package/dist/src/snackbar/SnackbarItemIcon.d.ts +0 -7
  151. package/dist/src/snackbar/SnackbarRegion.d.ts +0 -30
  152. package/dist/src/snackbar/SnackbarRegion.styles.d.ts +0 -5
  153. package/dist/src/snackbar/index.d.mts +0 -13
  154. package/dist/src/snackbar/index.d.ts +0 -13
  155. package/dist/src/snackbar/snackbarVariants.d.ts +0 -74
  156. package/dist/src/snackbar/useSnackbarGlobalStore.d.ts +0 -18
  157. package/dist/src/snackbar/useSwipe.d.ts +0 -15
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderSlot-Xxf_s88b.js","names":[],"sources":["../src/drawer/useRenderSlot.tsx"],"sourcesContent":["import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n"],"mappings":"qGAEA,SAAgB,EAAc,EAAkB,EAAoB,CAClE,IAAM,EAAY,EAAU,EAAA,KAAO,EAEnC,OAAO,GAAW,CAAE,GAAG,MAAY,EAAA,EAAA,KAAC,EAAD,CAAW,GAAI,EAAS,CAAA,CAAG,IAAA"}
1
+ {"version":3,"file":"useRenderSlot-C4UVWhDN.js","names":[],"sources":["../src/drawer/useRenderSlot.tsx"],"sourcesContent":["import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n"],"mappings":"qGAEA,SAAgB,EAAc,EAAkB,EAAoB,CAClE,IAAM,EAAY,EAAU,EAAA,KAAO,EAEnC,OAAO,GAAW,CAAE,GAAG,MAAY,EAAA,EAAA,KAAC,EAAD,CAAW,GAAI,EAAS,CAAA,CAAG,IAAA"}
@@ -8,4 +8,4 @@ function n(n, r) {
8
8
  //#endregion
9
9
  export { n as t };
10
10
 
11
- //# sourceMappingURL=useRenderSlot-DP4fYerF.mjs.map
11
+ //# sourceMappingURL=useRenderSlot-DKIwoqpO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderSlot-DP4fYerF.mjs","names":[],"sources":["../src/drawer/useRenderSlot.tsx"],"sourcesContent":["import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n"],"mappings":";;;AAEA,SAAgB,EAAc,GAAkB,GAAoB;CAClE,IAAM,IAAY,IAAU,IAAO;AAEnC,QAAO,KAAW,EAAE,GAAG,QAAY,kBAAC,GAAD,EAAW,GAAI,GAAS,CAAA,GAAG,KAAA"}
1
+ {"version":3,"file":"useRenderSlot-DKIwoqpO.mjs","names":[],"sources":["../src/drawer/useRenderSlot.tsx"],"sourcesContent":["import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n"],"mappings":";;;AAEA,SAAgB,EAAc,GAAkB,GAAoB;CAClE,IAAM,IAAY,IAAU,IAAO;AAEnC,QAAO,KAAW,EAAE,GAAG,QAAY,kBAAC,GAAD,EAAW,GAAI,GAAS,CAAA,GAAG,KAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/components",
3
- "version": "17.2.5-beta.0",
3
+ "version": "17.3.0",
4
4
  "license": "MIT",
5
5
  "description": "Spark (Leboncoin design system) components.",
6
6
  "exports": {
@@ -53,9 +53,9 @@
53
53
  "@react-aria/toast": "^3.0.0-beta.18",
54
54
  "@react-stately/numberfield": "3.9.11",
55
55
  "@react-stately/toast": "^3.0.0-beta.7",
56
- "@spark-ui/hooks": "^17.2.5-beta.0",
57
- "@spark-ui/icons": "^17.2.5-beta.0",
58
- "@spark-ui/internal-utils": "^17.2.5-beta.0",
56
+ "@spark-ui/hooks": "^17.3.0",
57
+ "@spark-ui/icons": "^17.3.0",
58
+ "@spark-ui/internal-utils": "^17.3.0",
59
59
  "@zag-js/pagination": "1.30.0",
60
60
  "@zag-js/react": "1.30.0",
61
61
  "class-variance-authority": "0.7.1",
@@ -63,6 +63,7 @@
63
63
  "emulate-tab": "^1.2.1",
64
64
  "motion": "^12.34.3",
65
65
  "radix-ui": "1.4.3",
66
+ "react-aria-components": "^1.15.0",
66
67
  "react-snap-carousel": "^0.5.1"
67
68
  },
68
69
  "peerDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroup.styles.ts","../../src/checkbox/CheckboxGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value of the checkbox group.\n */\n value?: string[]\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-success',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-alert',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-error',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-info',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends\n CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('grow', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\n// oxlint-disable-next-line max-lines-per-function\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <span\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </span>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends\n Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked\n ? [...values, changed]\n : values.filter((val: string) => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n"],"mappings":"mhBA2CA,IAAa,GAAA,EAAA,EAAA,eAAyE,EAAE,CAAC,CAE5E,OAGX,EAAA,EAAA,YAF2B,EAAqB,CC3C5C,EAA6B,EAAA,SAAS,kBAM/B,EAAqB,IAChC,EAAA,EAAA,KAAC,EAAD,CAA4B,UAAU,6CAA6C,GAAI,EAAS,CAAA,CAGlG,EAAkB,YAAc,oBCVhC,IAAa,GAAA,EAAA,EAAA,KACX,CACE,sFACA,2EACA,0BACA,oCACA,6BACD,CACD,CACE,SAAU,CAIR,QAAA,EAAA,EAAA,cAGE,CACA,KAAM,CACJ,eACA,4BACA,wCACA,4EACA,gEACD,CACD,QAAS,CACP,kBACA,+BACA,wCACA,kFACA,sEACD,CACD,OAAQ,CACN,iBACA,8BACA,wCACA,gFACA,oEACD,CACD,QAAS,CACP,kBACA,+BACA,wCACA,kFACA,sEACD,CACD,MAAO,CACL,gBACA,6BACA,sCACA,8EACA,kEACD,CACD,MAAO,CACL,gBACA,6BACA,sCACA,8EACA,kEACD,CACD,KAAM,CACJ,eACA,4BACA,qCACA,4EACA,gEACD,CACD,QAAS,CACP,kBACA,+BACA,wCACA,kFACA,sEACD,CACF,CAAC,CACH,CACD,gBAAiB,CACf,OAAQ,UACT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mjs","names":[],"sources":["../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroup.styles.ts","../../src/checkbox/CheckboxGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value of the checkbox group.\n */\n value?: string[]\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-success',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-alert',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-error',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-info',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends\n CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('grow', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\n// oxlint-disable-next-line max-lines-per-function\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <span\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </span>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends\n Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked\n ? [...values, changed]\n : values.filter((val: string) => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n"],"mappings":";;;;;;;;;;;;;AA2CA,IAAa,IAAuB,EAAkD,EAAE,CAAC,EAE5E,UACK,EAAW,EAAqB,EC3C5C,IAA6B,EAAS,mBAM/B,KAAqB,MAChC,kBAAC,GAAD;CAA4B,WAAU;CAA6C,GAAI;CAAS,CAAA;AAGlG,EAAkB,cAAc;;;ACVhC,IAAa,IAAsB,EACjC;CACE;CACA;CACA;CACA;CACA;CACD,EACD;CACE,UAAU,EAIR,QAAQ,EAGN;EACA,MAAM;GACJ;GACA;GACA;GACA;GACA;GACD;EACD,SAAS;GACP;GACA;GACA;GACA;GACA;GACD;EACD,QAAQ;GACN;GACA;GACA;GACA;GACA;GACD;EACD,SAAS;GACP;GACA;GACA;GACA;GACA;GACD;EACD,OA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IvB,IAAa,IAAsB,EAAI,CAAC,OAAO,EAAE,EAC/C,UAAU,EAIR,aAAa;CACX,UAAU,CAAC,YAAY,SAAS;CAChC,YAAY,CAAC,SAAS;CACvB,EACF,EACF,CAAC,ECWW,KAAiB,EAC5B,MAAM,GACN,OAAO,GACP,iBACA,cACA,WACA,iBAAc,YACd,iBAAiB,GACjB,aAAU,IACV,aACA,QACA,GAAG,QACqB;CACxB,IAAM,CAAC,GAAO,KAAY,EAAiB,GAAW,EAAa,EAC7D,IAAQ,GAAqB,EAC7B,IAAqB,EAAO,EAAoB,EAEhD,EAAE,OAAI,YAAS,gBAAa,UAAO,cAAW,kBAAe,GAC7D,IAAO,KAAY,EAAM,MAEzB,IAAU,SAcP;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAvB2B,GAAkB,MAAoB;GACjE,IAAM,IAAS,KAAS,EAAE,EACpB,IAAW,IACb,CAAC,GAAG,GAAQ,EAAQ,GACpB,EAAO,QAAQ,MAAgB,MAAQ,EAAQ;AAInD,GAFA,EAAS,EAAS,EAEd,EAAmB,WACrB,EAAmB,QAAQ,EAAS;;EAevC,GACA;EAAC;EAAI;EAAM;EAAO;EAAQ;EAAO;EAAW;EAAa;EAAY;EAAU;EAAQ,CAAC;AAM3F,QAJA,QAAgB;AACd,IAAmB,UAAU;IAC5B,CAAC,EAAoB,CAAC,EAGvB,kBAAC,EAAqB,UAAtB;EAA+B,OAAO;YACpC,kBAAC,OAAD;GACO;GACL,WAAW,EAAoB;IAAE;IAAW;IAAa,CAAC;GAC1D,MAAK;GACL,mBAAiB;GACjB,oBAAkB;GAClB,GAAI;GAEH;GACG,CAAA;EACwB,CAAA;;AAIpC,EAAc,cAAc"}
@@ -1,2 +0,0 @@
1
- require(`./chunk-C91j1N6u.js`);const e=require(`./button-CvvFH9fU.js`);let t=require(`class-variance-authority`),n=require(`react/jsx-runtime`),r=require(`@spark-ui/internal-utils`);var i=(0,t.cva)([`pl-0 pr-0`],{variants:{size:(0,r.makeVariants)({sm:[`text-body-1`],md:[`text-body-1`],lg:[`text-display-3`]})}}),a=({design:t=`filled`,disabled:r=!1,intent:a=`main`,shape:o=`pill`,size:s=`md`,className:c,ref:l,...u})=>(0,n.jsx)(e.t,{"data-spark-component":`icon-button`,ref:l,className:i({size:s,className:c}),design:t,disabled:r,intent:a,shape:o,size:s,...u});a.displayName=`IconButton`,Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
2
- //# sourceMappingURL=icon-button-D1Lg6gvI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-C8JGTQf_.js","names":[],"sources":["../src/input/InputGroupContext.ts","../src/input/InputClearButton.tsx","../src/input/InputGroup.styles.ts","../src/input/InputGroup.tsx","../src/input/InputAddon.styles.ts","../src/input/InputAddon.tsx","../src/input/InputLeadingAddon.tsx","../src/input/InputIcon.tsx","../src/input/InputLeadingIcon.tsx","../src/input/InputTrailingAddon.tsx","../src/input/InputTrailingIcon.tsx","../src/input/Input.styles.ts","../src/input/Input.tsx","../src/input/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport interface InputGroupContextValue {\n disabled?: boolean\n readOnly?: boolean\n hasLeadingIcon: boolean\n hasTrailingIcon: boolean\n hasLeadingAddon: boolean\n hasTrailingAddon: boolean\n hasClearButton: boolean\n state: null | undefined | 'error' | 'alert' | 'success'\n isStandalone?: boolean\n onClear: () => void\n}\n\nexport const InputGroupContext = createContext<Partial<InputGroupContextValue> | null>(null)\n\nexport const useInputGroup = () => {\n const context = useContext(InputGroupContext)\n\n return context || { isStandalone: true }\n}\n","import { DeleteOutline } from '@spark-ui/icons/DeleteOutline'\nimport { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, MouseEventHandler, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport interface InputClearButtonProps extends ComponentPropsWithoutRef<'button'> {\n 'aria-label': string\n inline?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nconst Root = ({\n className,\n tabIndex = -1,\n onClick,\n inline = false,\n ref,\n ...others\n}: InputClearButtonProps) => {\n const { onClear, hasTrailingIcon } = useInputGroup()\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = event => {\n if (onClick) {\n onClick(event)\n }\n\n if (onClear) {\n onClear()\n }\n }\n\n return (\n <button\n ref={ref}\n data-spark-component=\"input-clear-button\"\n className={cx(\n className,\n 'pointer-events-auto absolute',\n inline ? 'h-sz-44 top-0 -translate-y-0' : 'top-1/2 -translate-y-1/2',\n 'inline-flex h-full items-center justify-center outline-hidden',\n 'text-neutral hover:text-neutral-hovered',\n hasTrailingIcon ? 'right-3xl px-sz-12' : 'pl-md pr-lg right-0'\n )}\n tabIndex={tabIndex}\n onClick={handleClick}\n type=\"button\"\n {...others}\n >\n <Icon size=\"sm\">\n <DeleteOutline />\n </Icon>\n </button>\n )\n}\n\nexport const InputClearButton = Object.assign(Root, {\n id: 'ClearButton',\n})\n\nRoot.displayName = 'InputGroup.ClearButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputGroupStyles = cva(['relative inline-flex w-full'], {\n variants: {\n /**\n * When `true`, prevents the user from interacting.\n */\n disabled: {\n true: [\n 'cursor-not-allowed',\n 'relative',\n 'after:absolute',\n 'after:top-0',\n 'after:h-full',\n 'after:w-full',\n 'after:border-sm after:border-outline',\n 'after:rounded-lg',\n ],\n false: 'after:hidden',\n },\n /**\n * Sets the component as interactive or not.\n */\n readOnly: {\n true: [\n 'relative',\n 'after:absolute',\n 'after:top-0',\n 'after:h-full',\n 'after:w-full',\n 'after:border-sm after:border-outline',\n 'after:rounded-lg',\n ],\n false: 'after:hidden',\n },\n },\n})\n\nexport type InputGroupStylesProps = VariantProps<typeof inputGroupStyles>\n","/* eslint-disable max-lines-per-function */\n\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport {\n ChangeEventHandler,\n Children,\n cloneElement,\n ComponentPropsWithoutRef,\n DetailedReactHTMLElement,\n FC,\n isValidElement,\n PropsWithChildren,\n ReactElement,\n Ref,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react'\n\nimport { InputProps } from './Input'\nimport { inputGroupStyles, InputGroupStylesProps } from './InputGroup.styles'\nimport { InputGroupContext } from './InputGroupContext'\n\nexport interface InputGroupProps extends ComponentPropsWithoutRef<'div'>, InputGroupStylesProps {\n /**\n * Use `state` prop to assign a specific state to the group, choosing from: `error`, `alert` and `success`. By doing so, the outline styles will be updated.\n */\n state?: 'error' | 'alert' | 'success'\n /**\n * Function handler to be executed after the input has been cleared.\n */\n onClear?: () => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputGroup = ({\n className,\n children: childrenProp,\n state: stateProp,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n onClear,\n ref: forwardedRef,\n ...others\n}: PropsWithChildren<InputGroupProps>) => {\n const getElementId = (element?: ReactElement) => {\n return element ? (element.type as FC & { id?: string }).id : ''\n }\n\n const findElement = (...values: string[]) => {\n return children.find(child => values.includes(getElementId(child) || ''))\n }\n\n const children = Children.toArray(childrenProp).filter(isValidElement)\n const input = findElement('Input') as\n | DetailedReactHTMLElement<InputProps, HTMLInputElement>\n | undefined\n const props = input?.props || {}\n\n const inputRef = useRef<HTMLInputElement>(null!)\n const onClearRef = useRef(onClear)\n const ref = useMergeRefs<HTMLInputElement>(input?.ref, inputRef)\n const [value, onChange] = useCombinedState(\n props.value as string,\n props.defaultValue as string,\n props.onValueChange\n )\n\n // Data derivated from FormField context\n const field = useFormFieldControl()\n const state = field.state ?? stateProp\n const disabled = field.disabled || !!disabledProp\n const readOnly = field.readOnly || !!readOnlyProp\n\n // InputGroup elements (in visual order)\n const leadingAddon = findElement('LeadingAddon')\n const leadingIcon = findElement('LeadingIcon')\n const clearButton = findElement('ClearButton')\n const trailingIcon = findElement('TrailingIcon')\n const trailingAddon = findElement('TrailingAddon')\n\n // Acknowledge which subComponents are used in the compound context\n const hasLeadingAddon = !!leadingAddon\n const hasTrailingAddon = !!trailingAddon\n const hasLeadingIcon = !!leadingIcon\n const hasTrailingIcon = !!trailingIcon\n const hasClearButton = !!value && !!clearButton && !disabled && !readOnly\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = event => {\n if (props.onChange) {\n props.onChange(event)\n }\n\n onChange(event.target.value)\n }\n\n const handleClear = useCallback(() => {\n if (onClearRef.current) {\n onClearRef.current()\n }\n\n onChange('')\n\n inputRef.current.focus()\n }, [onChange])\n\n const current = useMemo(() => {\n return {\n state,\n disabled,\n readOnly,\n hasLeadingIcon,\n hasTrailingIcon,\n hasLeadingAddon,\n hasTrailingAddon,\n hasClearButton,\n onClear: handleClear,\n }\n }, [\n state,\n disabled,\n readOnly,\n hasLeadingIcon,\n hasTrailingIcon,\n hasLeadingAddon,\n hasTrailingAddon,\n hasClearButton,\n handleClear,\n ])\n\n useEffect(() => {\n onClearRef.current = onClear\n }, [onClear])\n\n // Preserve the input value when cloning. Some libraries like React Hook Form\n // only expose a ref (via `register`) without direct value access, so we need\n // to manually retrieve the value from the ref to avoid losing it.\n const inputRefValue = inputRef.current?.value\n\n return (\n <InputGroupContext.Provider value={current}>\n <div\n data-spark-component=\"input-group\"\n ref={forwardedRef}\n className={inputGroupStyles({ disabled, readOnly, className })}\n {...others}\n >\n {hasLeadingAddon && leadingAddon}\n\n <div className=\"relative inline-flex w-full\">\n {input &&\n cloneElement(input, {\n value: value ?? inputRefValue ?? '',\n ref,\n defaultValue: undefined,\n onChange: handleChange,\n })}\n\n {leadingIcon}\n\n {hasClearButton && clearButton}\n\n {trailingIcon}\n </div>\n\n {hasTrailingAddon && trailingAddon}\n </div>\n </InputGroupContext.Provider>\n )\n}\n\nInputGroup.displayName = 'InputGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputAddonStyles = cva(\n [\n 'overflow-hidden',\n 'border-sm',\n 'shrink-0',\n 'h-full',\n 'focus-visible:relative focus-visible:z-raised',\n 'mx-0',\n ],\n {\n variants: {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild: { false: ['flex', 'items-center', 'px-lg'] },\n intent: {\n neutral: 'border-outline',\n error: 'border-error',\n alert: 'border-alert',\n success: 'border-success',\n },\n /**\n * Disable the input addon, preventing user interaction and adding opacity.\n */\n disabled: {\n true: ['pointer-events-none border-outline!'],\n },\n /**\n * Changes input addon styles based on the read only status from the input.\n */\n readOnly: {\n true: ['pointer-events-none'],\n },\n /**\n * Main style of the input addon.\n */\n design: {\n text: '',\n solid: '',\n inline: '',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n readOnly: false,\n design: 'text',\n class: ['bg-surface', 'text-on-surface'],\n },\n {\n disabled: true,\n design: 'text',\n class: ['text-on-surface/dim-3'],\n },\n {\n disabled: true,\n design: ['solid', 'inline'],\n class: ['opacity-dim-3'],\n },\n ],\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputAddonStylesProps = VariantProps<typeof inputAddonStyles>\n","import { Children, type ComponentPropsWithoutRef, type PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { inputAddonStyles, type InputAddonStylesProps } from './InputAddon.styles'\nimport { useInputGroup } from './InputGroupContext'\n\nexport interface InputAddonProps\n extends ComponentPropsWithoutRef<'div'>, Omit<InputAddonStylesProps, 'intent' | 'disabled'> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputAddon = ({\n asChild: asChildProp,\n className,\n children,\n ref,\n ...others\n}: PropsWithChildren<InputAddonProps>) => {\n const { state, disabled, readOnly } = useInputGroup()\n\n const isRawText = typeof children === 'string'\n const asChild = !!(isRawText ? false : asChildProp)\n const child = isRawText ? children : Children.only(children)\n const Component = asChild && !isRawText ? Slot : 'div'\n\n const getDesign = (): InputAddonStylesProps['design'] => {\n if (isRawText) return 'text'\n\n return asChild ? 'solid' : 'inline'\n }\n\n const design = getDesign()\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"input-addon\"\n className={inputAddonStyles({\n className,\n intent: state,\n disabled,\n readOnly,\n asChild,\n design,\n })}\n {...(disabled && { tabIndex: -1 })}\n {...others}\n >\n {child}\n </Component>\n )\n}\n\nInputAddon.displayName = 'InputGroup.Addon'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { InputAddon, InputAddonProps } from './InputAddon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputLeadingAddonProps = InputAddonProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nconst Root = ({ className, ref, ...others }: InputLeadingAddonProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <div className={cx('rounded-l-full', isInactive ? 'bg-on-surface/dim-5' : null)}>\n <InputAddon\n ref={ref}\n className={cx(className, 'rounded-r-0! -mr-px rounded-l-full')}\n {...others}\n />\n </div>\n )\n}\n\nexport const InputLeadingAddon = Object.assign(Root, {\n id: 'LeadingAddon',\n})\n\nRoot.displayName = 'InputGroup.LeadingAddon'\n","import { cx } from 'class-variance-authority'\n\nimport { Icon, type IconProps } from '../icon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputIconProps = IconProps\n\nexport const InputIcon = ({ className, intent, children, ...others }: InputIconProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <Icon\n data-spark-component=\"input-icon\"\n intent={intent}\n className={cx(\n className,\n 'pointer-events-none absolute top-[calc(var(--spacing-sz-44)/2)] -translate-y-1/2',\n intent ? undefined : 'text-neutral peer-focus:text-outline-high',\n isInactive ? 'opacity-dim-3' : undefined\n )}\n {...others}\n >\n {children}\n </Icon>\n )\n}\n\nInputIcon.displayName = 'InputGroup.Icon'\n","import { cx } from 'class-variance-authority'\n\nimport { InputIcon, InputIconProps } from './InputIcon'\n\nexport type InputLeadingIconProps = InputIconProps\n\nexport const InputLeadingIcon = ({ className, ...others }: InputLeadingIconProps) => (\n <InputIcon className={cx(className, 'left-lg text-body-1')} {...others} />\n)\n\nInputLeadingIcon.id = 'LeadingIcon'\nInputLeadingIcon.displayName = 'InputGroup.LeadingIcon'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { InputAddon, InputAddonProps } from './InputAddon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputTrailingAddonProps = InputAddonProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nconst Root = ({ className, ref, ...others }: InputTrailingAddonProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <div className={cx('rounded-r-full', isInactive ? 'bg-on-surface/dim-5' : null)}>\n <InputAddon\n ref={ref}\n className={cx(className, 'rounded-l-0! -ml-px rounded-r-full')}\n {...others}\n />\n </div>\n )\n}\n\nexport const InputTrailingAddon = Object.assign(Root, {\n id: 'TrailingAddon',\n})\n\nRoot.displayName = 'InputGroup.TrailingAddon'\n","import { cx } from 'class-variance-authority'\n\nimport { InputIcon, InputIconProps } from './InputIcon'\n\nexport type InputTrailingIconProps = InputIconProps\n\nexport const InputTrailingIcon = ({ className, ...others }: InputTrailingIconProps) => (\n <InputIcon className={cx(className, 'right-lg text-body-1')} {...others} />\n)\n\nInputTrailingIcon.id = 'TrailingIcon'\nInputTrailingIcon.displayName = 'InputGroup.TrailingIcon'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputStyles = cva(\n [\n 'relative',\n 'border-sm',\n 'peer',\n 'w-full',\n 'appearance-none outline-hidden',\n 'bg-surface',\n 'text-ellipsis text-body-1 text-on-surface',\n 'caret-neutral',\n '[&:-webkit-autofill]:[-webkit-text-fill-color:var(--color-on-surface)]',\n 'autofill:shadow-surface autofill:shadow-[inset_0_0_0px_1000px]',\n 'disabled:cursor-not-allowed disabled:border-outline disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3',\n 'read-only:cursor-default read-only:pointer-events-none read-only:bg-on-surface/dim-5',\n 'focus:ring-1 focus:ring-inset focus:ring-focus focus:border-focus',\n ],\n {\n variants: {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild: {\n true: ['min-h-sz-44'],\n false: ['h-sz-44'],\n },\n /**\n * Color scheme of the button.\n */\n intent: {\n neutral: ['border-outline', 'default:hover:border-outline-high'],\n success: ['default:border-success'],\n alert: ['default:border-alert'],\n error: ['default:border-error'],\n },\n /**\n * Sets if there is an addon before the input text.\n */\n hasLeadingAddon: {\n true: ['rounded-l-0'],\n false: ['rounded-l-full'],\n },\n /**\n * Sets if there is an addon after the input text.\n */\n hasTrailingAddon: {\n true: ['rounded-r-0'],\n false: ['rounded-r-full'],\n },\n /**\n * Sets if there is an icon before the input text.\n */\n hasLeadingIcon: {\n true: ['pl-3xl'],\n false: ['pl-lg'],\n },\n /**\n * Sets if there is an icon after the input text.\n */\n hasTrailingIcon: { true: '' },\n /**\n * Sets if there is a button to clear the input text.\n */\n hasClearButton: { true: '' },\n },\n compoundVariants: [\n {\n hasTrailingIcon: false,\n hasClearButton: false,\n class: 'pr-lg',\n },\n {\n hasTrailingIcon: true,\n hasClearButton: false,\n class: 'pr-3xl',\n },\n {\n hasTrailingIcon: false,\n hasClearButton: true,\n class: 'pr-3xl',\n },\n {\n hasTrailingIcon: true,\n hasClearButton: true,\n class: 'pr-[calc(var(--spacing-3xl)*2)]',\n },\n ],\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputStylesProps = VariantProps<typeof inputStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { ChangeEventHandler, ComponentPropsWithoutRef, KeyboardEventHandler, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { inputStyles } from './Input.styles'\nimport { useInputGroup } from './InputGroupContext'\n\ntype InputPrimitiveProps = ComponentPropsWithoutRef<'input'>\n\nexport interface InputProps extends InputPrimitiveProps {\n asChild?: boolean\n onValueChange?: (value: string) => void\n ref?: Ref<HTMLInputElement>\n}\n\nconst Root = ({\n className,\n asChild = false,\n onValueChange,\n onChange,\n onKeyDown,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n ref,\n ...others\n}: InputProps) => {\n const field = useFormFieldControl()\n const group = useInputGroup()\n\n const { id, name, isInvalid, isRequired, description } = field\n const {\n hasLeadingAddon,\n hasTrailingAddon,\n hasLeadingIcon,\n hasTrailingIcon,\n hasClearButton,\n onClear,\n } = group\n const Component = asChild ? Slot : 'input'\n const state = field.state || group.state\n const disabled = field.disabled || group.disabled || disabledProp\n const readOnly = field.readOnly || group.readOnly || readOnlyProp\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = event => {\n if (onChange) {\n onChange(event)\n }\n\n if (onValueChange) {\n onValueChange(event.target.value)\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = event => {\n if (onKeyDown) {\n onKeyDown(event)\n }\n\n if (hasClearButton && onClear && event.key === 'Escape') {\n onClear()\n }\n }\n\n return (\n <Component\n data-spark-component=\"input\"\n ref={ref}\n id={id}\n name={name}\n className={inputStyles({\n asChild,\n className,\n intent: state,\n hasLeadingAddon: !!hasLeadingAddon,\n hasTrailingAddon: !!hasTrailingAddon,\n hasLeadingIcon: !!hasLeadingIcon,\n hasTrailingIcon: !!hasTrailingIcon,\n hasClearButton: !!hasClearButton,\n })}\n disabled={disabled}\n readOnly={readOnly}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...others}\n />\n )\n}\n\nexport const Input = Object.assign(Root, {\n id: 'Input',\n})\n\nRoot.displayName = 'Input'\n","import { InputClearButton } from './InputClearButton'\nimport { InputGroup as Root } from './InputGroup'\nimport { InputLeadingAddon } from './InputLeadingAddon'\nimport { InputLeadingIcon } from './InputLeadingIcon'\nimport { InputTrailingAddon } from './InputTrailingAddon'\nimport { InputTrailingIcon } from './InputTrailingIcon'\n\nexport * from './Input'\n\nexport const InputGroup: typeof Root & {\n LeadingAddon: typeof InputLeadingAddon\n TrailingAddon: typeof InputTrailingAddon\n LeadingIcon: typeof InputLeadingIcon\n TrailingIcon: typeof InputTrailingIcon\n ClearButton: typeof InputClearButton\n} = Object.assign(Root, {\n LeadingAddon: InputLeadingAddon,\n TrailingAddon: InputTrailingAddon,\n LeadingIcon: InputLeadingIcon,\n TrailingIcon: InputTrailingIcon,\n ClearButton: InputClearButton,\n})\n\nInputGroup.displayName = 'InputGroup'\nInputLeadingAddon.displayName = 'InputGroup.LeadingAddon'\nInputTrailingAddon.displayName = 'InputGroup.TrailingAddon'\nInputLeadingIcon.displayName = 'InputGroup.LeadingIcon'\nInputTrailingIcon.displayName = 'InputGroup.TrailingIcon'\nInputClearButton.displayName = 'InputGroup.ClearButton'\n\nexport { useInputGroup } from './InputGroupContext'\nexport { type InputGroupProps } from './InputGroup'\nexport { type InputLeadingIconProps } from './InputLeadingIcon'\nexport { type InputTrailingIconProps } from './InputTrailingIcon'\nexport { type InputLeadingAddonProps } from './InputLeadingAddon'\nexport { type InputTrailingAddonProps } from './InputTrailingAddon'\nexport { type InputClearButtonProps } from './InputClearButton'\n"],"mappings":"kXAeA,IAAa,GAAA,EAAA,EAAA,eAA0E,KAAK,CAE/E,OAGX,EAAA,EAAA,YAF2B,EAAkB,EAE3B,CAAE,aAAc,GAAM,CCPpC,GAAQ,CACZ,YACA,WAAW,GACX,UACA,SAAS,GACT,MACA,GAAG,KACwB,CAC3B,GAAM,CAAE,UAAS,mBAAoB,GAAe,CAE9C,EAAoD,GAAS,CAC7D,GACF,EAAQ,EAAM,CAGZ,GACF,GAAS,EAIb,OACE,EAAA,EAAA,KAAC,SAAD,CACO,MACL,uBAAqB,qBACrB,WAAA,EAAA,EAAA,IACE,EACA,+BACA,EAAS,+BAAiC,2BAC1C,gEACA,0CACA,EAAkB,qBAAuB,sBAC1C,CACS,WACV,QAAS,EACT,KAAK,SACL,GAAI,YAEJ,EAAA,EAAA,KAAC,EAAA,EAAD,CAAM,KAAK,eACT,EAAA,EAAA,KAAC,EAAA,cAAD,EA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EAAM,MAAQ,UAC7C,GAAS,EAIb,OACE,EAAA,EAAA,KAAC,EAAD,CACE,uBAAqB,QAChB,MACD,KACE,OACN,UAAW,EAAY,CACrB,UACA,YACA,OAAQ,EACR,gBAAiB,CAAC,CAAC,EACnB,iBAAkB,CAAC,CAAC,EACpB,eAAgB,CAAC,CAAC,EAClB,gBAAiB,CAAC,CAAC,EACnB,eAAgB,CAAC,CAAC,EACnB,CAAC,CACQ,WACA,WACV,SAAU,EACV,mBAAkB,EAClB,eAAc,EACd,SAAU,EACV,UAAW,EACX,GAAI,EACJ,CAAA,EAIO,EAAQ,OAAO,OAAO,EAAM,CACvC,GAAI,QACL,CAAC,CAEF,EAAK,YAAc,QCtFnB,IAAa,EAMT,OAAO,OAAO,EAAM,CACtB,aAAc,EACd,cAAe,EACf,YAAa,EACb,aAAc,EACd,YAAa,EACd,CAAC,CAEF,EAAW,YAAc,aACzB,EAAkB,YAAc,0BAChC,EAAmB,YAAc,2BACjC,EAAiB,YAAc,yBAC/B,EAAkB,YAAc,0BAChC,EAAiB,YAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-n-ocJBNV.mjs","names":[],"sources":["../src/input/InputGroupContext.ts","../src/input/InputClearButton.tsx","../src/input/InputGroup.styles.ts","../src/input/InputGroup.tsx","../src/input/InputAddon.styles.ts","../src/input/InputAddon.tsx","../src/input/InputLeadingAddon.tsx","../src/input/InputIcon.tsx","../src/input/InputLeadingIcon.tsx","../src/input/InputTrailingAddon.tsx","../src/input/InputTrailingIcon.tsx","../src/input/Input.styles.ts","../src/input/Input.tsx","../src/input/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport interface InputGroupContextValue {\n disabled?: boolean\n readOnly?: boolean\n hasLeadingIcon: boolean\n hasTrailingIcon: boolean\n hasLeadingAddon: boolean\n hasTrailingAddon: boolean\n hasClearButton: boolean\n state: null | undefined | 'error' | 'alert' | 'success'\n isStandalone?: boolean\n onClear: () => void\n}\n\nexport const InputGroupContext = createContext<Partial<InputGroupContextValue> | null>(null)\n\nexport const useInputGroup = () => {\n const context = useContext(InputGroupContext)\n\n return context || { isStandalone: true }\n}\n","import { DeleteOutline } from '@spark-ui/icons/DeleteOutline'\nimport { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, MouseEventHandler, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport interface InputClearButtonProps extends ComponentPropsWithoutRef<'button'> {\n 'aria-label': string\n inline?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nconst Root = ({\n className,\n tabIndex = -1,\n onClick,\n inline = false,\n ref,\n ...others\n}: InputClearButtonProps) => {\n const { onClear, hasTrailingIcon } = useInputGroup()\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = event => {\n if (onClick) {\n onClick(event)\n }\n\n if (onClear) {\n onClear()\n }\n }\n\n return (\n <button\n ref={ref}\n data-spark-component=\"input-clear-button\"\n className={cx(\n className,\n 'pointer-events-auto absolute',\n inline ? 'h-sz-44 top-0 -translate-y-0' : 'top-1/2 -translate-y-1/2',\n 'inline-flex h-full items-center justify-center outline-hidden',\n 'text-neutral hover:text-neutral-hovered',\n hasTrailingIcon ? 'right-3xl px-sz-12' : 'pl-md pr-lg right-0'\n )}\n tabIndex={tabIndex}\n onClick={handleClick}\n type=\"button\"\n {...others}\n >\n <Icon size=\"sm\">\n <DeleteOutline />\n </Icon>\n </button>\n )\n}\n\nexport const InputClearButton = Object.assign(Root, {\n id: 'ClearButton',\n})\n\nRoot.displayName = 'InputGroup.ClearButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputGroupStyles = cva(['relative inline-flex w-full'], {\n variants: {\n /**\n * When `true`, prevents the user from interacting.\n */\n disabled: {\n true: [\n 'cursor-not-allowed',\n 'relative',\n 'after:absolute',\n 'after:top-0',\n 'after:h-full',\n 'after:w-full',\n 'after:border-sm after:border-outline',\n 'after:rounded-lg',\n ],\n false: 'after:hidden',\n },\n /**\n * Sets the component as interactive or not.\n */\n readOnly: {\n true: [\n 'relative',\n 'after:absolute',\n 'after:top-0',\n 'after:h-full',\n 'after:w-full',\n 'after:border-sm after:border-outline',\n 'after:rounded-lg',\n ],\n false: 'after:hidden',\n },\n },\n})\n\nexport type InputGroupStylesProps = VariantProps<typeof inputGroupStyles>\n","/* eslint-disable max-lines-per-function */\n\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport {\n ChangeEventHandler,\n Children,\n cloneElement,\n ComponentPropsWithoutRef,\n DetailedReactHTMLElement,\n FC,\n isValidElement,\n PropsWithChildren,\n ReactElement,\n Ref,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react'\n\nimport { InputProps } from './Input'\nimport { inputGroupStyles, InputGroupStylesProps } from './InputGroup.styles'\nimport { InputGroupContext } from './InputGroupContext'\n\nexport interface InputGroupProps extends ComponentPropsWithoutRef<'div'>, InputGroupStylesProps {\n /**\n * Use `state` prop to assign a specific state to the group, choosing from: `error`, `alert` and `success`. By doing so, the outline styles will be updated.\n */\n state?: 'error' | 'alert' | 'success'\n /**\n * Function handler to be executed after the input has been cleared.\n */\n onClear?: () => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputGroup = ({\n className,\n children: childrenProp,\n state: stateProp,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n onClear,\n ref: forwardedRef,\n ...others\n}: PropsWithChildren<InputGroupProps>) => {\n const getElementId = (element?: ReactElement) => {\n return element ? (element.type as FC & { id?: string }).id : ''\n }\n\n const findElement = (...values: string[]) => {\n return children.find(child => values.includes(getElementId(child) || ''))\n }\n\n const children = Children.toArray(childrenProp).filter(isValidElement)\n const input = findElement('Input') as\n | DetailedReactHTMLElement<InputProps, HTMLInputElement>\n | undefined\n const props = input?.props || {}\n\n const inputRef = useRef<HTMLInputElement>(null!)\n const onClearRef = useRef(onClear)\n const ref = useMergeRefs<HTMLInputElement>(input?.ref, inputRef)\n const [value, onChange] = useCombinedState(\n props.value as string,\n props.defaultValue as string,\n props.onValueChange\n )\n\n // Data derivated from FormField context\n const field = useFormFieldControl()\n const state = field.state ?? stateProp\n const disabled = field.disabled || !!disabledProp\n const readOnly = field.readOnly || !!readOnlyProp\n\n // InputGroup elements (in visual order)\n const leadingAddon = findElement('LeadingAddon')\n const leadingIcon = findElement('LeadingIcon')\n const clearButton = findElement('ClearButton')\n const trailingIcon = findElement('TrailingIcon')\n const trailingAddon = findElement('TrailingAddon')\n\n // Acknowledge which subComponents are used in the compound context\n const hasLeadingAddon = !!leadingAddon\n const hasTrailingAddon = !!trailingAddon\n const hasLeadingIcon = !!leadingIcon\n const hasTrailingIcon = !!trailingIcon\n const hasClearButton = !!value && !!clearButton && !disabled && !readOnly\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = event => {\n if (props.onChange) {\n props.onChange(event)\n }\n\n onChange(event.target.value)\n }\n\n const handleClear = useCallback(() => {\n if (onClearRef.current) {\n onClearRef.current()\n }\n\n onChange('')\n\n inputRef.current.focus()\n }, [onChange])\n\n const current = useMemo(() => {\n return {\n state,\n disabled,\n readOnly,\n hasLeadingIcon,\n hasTrailingIcon,\n hasLeadingAddon,\n hasTrailingAddon,\n hasClearButton,\n onClear: handleClear,\n }\n }, [\n state,\n disabled,\n readOnly,\n hasLeadingIcon,\n hasTrailingIcon,\n hasLeadingAddon,\n hasTrailingAddon,\n hasClearButton,\n handleClear,\n ])\n\n useEffect(() => {\n onClearRef.current = onClear\n }, [onClear])\n\n // Preserve the input value when cloning. Some libraries like React Hook Form\n // only expose a ref (via `register`) without direct value access, so we need\n // to manually retrieve the value from the ref to avoid losing it.\n const inputRefValue = inputRef.current?.value\n\n return (\n <InputGroupContext.Provider value={current}>\n <div\n data-spark-component=\"input-group\"\n ref={forwardedRef}\n className={inputGroupStyles({ disabled, readOnly, className })}\n {...others}\n >\n {hasLeadingAddon && leadingAddon}\n\n <div className=\"relative inline-flex w-full\">\n {input &&\n cloneElement(input, {\n value: value ?? inputRefValue ?? '',\n ref,\n defaultValue: undefined,\n onChange: handleChange,\n })}\n\n {leadingIcon}\n\n {hasClearButton && clearButton}\n\n {trailingIcon}\n </div>\n\n {hasTrailingAddon && trailingAddon}\n </div>\n </InputGroupContext.Provider>\n )\n}\n\nInputGroup.displayName = 'InputGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputAddonStyles = cva(\n [\n 'overflow-hidden',\n 'border-sm',\n 'shrink-0',\n 'h-full',\n 'focus-visible:relative focus-visible:z-raised',\n 'mx-0',\n ],\n {\n variants: {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild: { false: ['flex', 'items-center', 'px-lg'] },\n intent: {\n neutral: 'border-outline',\n error: 'border-error',\n alert: 'border-alert',\n success: 'border-success',\n },\n /**\n * Disable the input addon, preventing user interaction and adding opacity.\n */\n disabled: {\n true: ['pointer-events-none border-outline!'],\n },\n /**\n * Changes input addon styles based on the read only status from the input.\n */\n readOnly: {\n true: ['pointer-events-none'],\n },\n /**\n * Main style of the input addon.\n */\n design: {\n text: '',\n solid: '',\n inline: '',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n readOnly: false,\n design: 'text',\n class: ['bg-surface', 'text-on-surface'],\n },\n {\n disabled: true,\n design: 'text',\n class: ['text-on-surface/dim-3'],\n },\n {\n disabled: true,\n design: ['solid', 'inline'],\n class: ['opacity-dim-3'],\n },\n ],\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputAddonStylesProps = VariantProps<typeof inputAddonStyles>\n","import { Children, type ComponentPropsWithoutRef, type PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { inputAddonStyles, type InputAddonStylesProps } from './InputAddon.styles'\nimport { useInputGroup } from './InputGroupContext'\n\nexport interface InputAddonProps\n extends ComponentPropsWithoutRef<'div'>, Omit<InputAddonStylesProps, 'intent' | 'disabled'> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputAddon = ({\n asChild: asChildProp,\n className,\n children,\n ref,\n ...others\n}: PropsWithChildren<InputAddonProps>) => {\n const { state, disabled, readOnly } = useInputGroup()\n\n const isRawText = typeof children === 'string'\n const asChild = !!(isRawText ? false : asChildProp)\n const child = isRawText ? children : Children.only(children)\n const Component = asChild && !isRawText ? Slot : 'div'\n\n const getDesign = (): InputAddonStylesProps['design'] => {\n if (isRawText) return 'text'\n\n return asChild ? 'solid' : 'inline'\n }\n\n const design = getDesign()\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"input-addon\"\n className={inputAddonStyles({\n className,\n intent: state,\n disabled,\n readOnly,\n asChild,\n design,\n })}\n {...(disabled && { tabIndex: -1 })}\n {...others}\n >\n {child}\n </Component>\n )\n}\n\nInputAddon.displayName = 'InputGroup.Addon'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { InputAddon, InputAddonProps } from './InputAddon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputLeadingAddonProps = InputAddonProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nconst Root = ({ className, ref, ...others }: InputLeadingAddonProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <div className={cx('rounded-l-full', isInactive ? 'bg-on-surface/dim-5' : null)}>\n <InputAddon\n ref={ref}\n className={cx(className, 'rounded-r-0! -mr-px rounded-l-full')}\n {...others}\n />\n </div>\n )\n}\n\nexport const InputLeadingAddon = Object.assign(Root, {\n id: 'LeadingAddon',\n})\n\nRoot.displayName = 'InputGroup.LeadingAddon'\n","import { cx } from 'class-variance-authority'\n\nimport { Icon, type IconProps } from '../icon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputIconProps = IconProps\n\nexport const InputIcon = ({ className, intent, children, ...others }: InputIconProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <Icon\n data-spark-component=\"input-icon\"\n intent={intent}\n className={cx(\n className,\n 'pointer-events-none absolute top-[calc(var(--spacing-sz-44)/2)] -translate-y-1/2',\n intent ? undefined : 'text-neutral peer-focus:text-outline-high',\n isInactive ? 'opacity-dim-3' : undefined\n )}\n {...others}\n >\n {children}\n </Icon>\n )\n}\n\nInputIcon.displayName = 'InputGroup.Icon'\n","import { cx } from 'class-variance-authority'\n\nimport { InputIcon, InputIconProps } from './InputIcon'\n\nexport type InputLeadingIconProps = InputIconProps\n\nexport const InputLeadingIcon = ({ className, ...others }: InputLeadingIconProps) => (\n <InputIcon className={cx(className, 'left-lg text-body-1')} {...others} />\n)\n\nInputLeadingIcon.id = 'LeadingIcon'\nInputLeadingIcon.displayName = 'InputGroup.LeadingIcon'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { InputAddon, InputAddonProps } from './InputAddon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputTrailingAddonProps = InputAddonProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nconst Root = ({ className, ref, ...others }: InputTrailingAddonProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <div className={cx('rounded-r-full', isInactive ? 'bg-on-surface/dim-5' : null)}>\n <InputAddon\n ref={ref}\n className={cx(className, 'rounded-l-0! -ml-px rounded-r-full')}\n {...others}\n />\n </div>\n )\n}\n\nexport const InputTrailingAddon = Object.assign(Root, {\n id: 'TrailingAddon',\n})\n\nRoot.displayName = 'InputGroup.TrailingAddon'\n","import { cx } from 'class-variance-authority'\n\nimport { InputIcon, InputIconProps } from './InputIcon'\n\nexport type InputTrailingIconProps = InputIconProps\n\nexport const InputTrailingIcon = ({ className, ...others }: InputTrailingIconProps) => (\n <InputIcon className={cx(className, 'right-lg text-body-1')} {...others} />\n)\n\nInputTrailingIcon.id = 'TrailingIcon'\nInputTrailingIcon.displayName = 'InputGroup.TrailingIcon'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputStyles = cva(\n [\n 'relative',\n 'border-sm',\n 'peer',\n 'w-full',\n 'appearance-none outline-hidden',\n 'bg-surface',\n 'text-ellipsis text-body-1 text-on-surface',\n 'caret-neutral',\n '[&:-webkit-autofill]:[-webkit-text-fill-color:var(--color-on-surface)]',\n 'autofill:shadow-surface autofill:shadow-[inset_0_0_0px_1000px]',\n 'disabled:cursor-not-allowed disabled:border-outline disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3',\n 'read-only:cursor-default read-only:pointer-events-none read-only:bg-on-surface/dim-5',\n 'focus:ring-1 focus:ring-inset focus:ring-focus focus:border-focus',\n ],\n {\n variants: {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild: {\n true: ['min-h-sz-44'],\n false: ['h-sz-44'],\n },\n /**\n * Color scheme of the button.\n */\n intent: {\n neutral: ['border-outline', 'default:hover:border-outline-high'],\n success: ['default:border-success'],\n alert: ['default:border-alert'],\n error: ['default:border-error'],\n },\n /**\n * Sets if there is an addon before the input text.\n */\n hasLeadingAddon: {\n true: ['rounded-l-0'],\n false: ['rounded-l-full'],\n },\n /**\n * Sets if there is an addon after the input text.\n */\n hasTrailingAddon: {\n true: ['rounded-r-0'],\n false: ['rounded-r-full'],\n },\n /**\n * Sets if there is an icon before the input text.\n */\n hasLeadingIcon: {\n true: ['pl-3xl'],\n false: ['pl-lg'],\n },\n /**\n * Sets if there is an icon after the input text.\n */\n hasTrailingIcon: { true: '' },\n /**\n * Sets if there is a button to clear the input text.\n */\n hasClearButton: { true: '' },\n },\n compoundVariants: [\n {\n hasTrailingIcon: false,\n hasClearButton: false,\n class: 'pr-lg',\n },\n {\n hasTrailingIcon: true,\n hasClearButton: false,\n class: 'pr-3xl',\n },\n {\n hasTrailingIcon: false,\n hasClearButton: true,\n class: 'pr-3xl',\n },\n {\n hasTrailingIcon: true,\n hasClearButton: true,\n class: 'pr-[calc(var(--spacing-3xl)*2)]',\n },\n ],\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputStylesProps = VariantProps<typeof inputStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { ChangeEventHandler, ComponentPropsWithoutRef, KeyboardEventHandler, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { inputStyles } from './Input.styles'\nimport { useInputGroup } from './InputGroupContext'\n\ntype InputPrimitiveProps = ComponentPropsWithoutRef<'input'>\n\nexport interface InputProps extends InputPrimitiveProps {\n asChild?: boolean\n onValueChange?: (value: string) => void\n ref?: Ref<HTMLInputElement>\n}\n\nconst Root = ({\n className,\n asChild = false,\n onValueChange,\n onChange,\n onKeyDown,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n ref,\n ...others\n}: InputProps) => {\n const field = useFormFieldControl()\n const group = useInputGroup()\n\n const { id, name, isInvalid, isRequired, description } = field\n const {\n hasLeadingAddon,\n hasTrailingAddon,\n hasLeadingIcon,\n hasTrailingIcon,\n hasClearButton,\n onClear,\n } = group\n const Component = asChild ? Slot : 'input'\n const state = field.state || group.state\n const disabled = field.disabled || group.disabled || disabledProp\n const readOnly = field.readOnly || group.readOnly || readOnlyProp\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = event => {\n if (onChange) {\n onChange(event)\n }\n\n if (onValueChange) {\n onValueChange(event.target.value)\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = event => {\n if (onKeyDown) {\n onKeyDown(event)\n }\n\n if (hasClearButton && onClear && event.key === 'Escape') {\n onClear()\n }\n }\n\n return (\n <Component\n data-spark-component=\"input\"\n ref={ref}\n id={id}\n name={name}\n className={inputStyles({\n asChild,\n className,\n intent: state,\n hasLeadingAddon: !!hasLeadingAddon,\n hasTrailingAddon: !!hasTrailingAddon,\n hasLeadingIcon: !!hasLeadingIcon,\n hasTrailingIcon: !!hasTrailingIcon,\n hasClearButton: !!hasClearButton,\n })}\n disabled={disabled}\n readOnly={readOnly}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...others}\n />\n )\n}\n\nexport const Input = Object.assign(Root, {\n id: 'Input',\n})\n\nRoot.displayName = 'Input'\n","import { InputClearButton } from './InputClearButton'\nimport { InputGroup as Root } from './InputGroup'\nimport { InputLeadingAddon } from './InputLeadingAddon'\nimport { InputLeadingIcon } from './InputLeadingIcon'\nimport { InputTrailingAddon } from './InputTrailingAddon'\nimport { InputTrailingIcon } from './InputTrailingIcon'\n\nexport * from './Input'\n\nexport const InputGroup: typeof Root & {\n LeadingAddon: typeof InputLeadingAddon\n TrailingAddon: typeof InputTrailingAddon\n LeadingIcon: typeof InputLeadingIcon\n TrailingIcon: typeof InputTrailingIcon\n ClearButton: typeof InputClearButton\n} = Object.assign(Root, {\n LeadingAddon: InputLeadingAddon,\n TrailingAddon: InputTrailingAddon,\n LeadingIcon: InputLeadingIcon,\n TrailingIcon: InputTrailingIcon,\n ClearButton: InputClearButton,\n})\n\nInputGroup.displayName = 'InputGroup'\nInputLeadingAddon.displayName = 'InputGroup.LeadingAddon'\nInputTrailingAddon.displayName = 'InputGroup.TrailingAddon'\nInputLeadingIcon.displayName = 'InputGroup.LeadingIcon'\nInputTrailingIcon.displayName = 'InputGroup.TrailingIcon'\nInputClearButton.displayName = 'InputGroup.ClearButton'\n\nexport { useInputGroup } from './InputGroupContext'\nexport { type InputGroupProps } from './InputGroup'\nexport { type InputLeadingIconProps } from './InputLeadingIcon'\nexport { type InputTrailingIconProps } from './InputTrailingIcon'\nexport { type InputLeadingAddonProps } from './InputLeadingAddon'\nexport { type InputTrailingAddonProps } from './InputTrailingAddon'\nexport { type InputClearButtonProps } from './InputClearButton'\n"],"mappings":";;;;;;;;;;AAeA,IAAa,IAAoB,EAAsD,KAAK,EAE/E,UACK,EAAW,EAAkB,IAE3B,EAAE,cAAc,IAAM,ECPpC,KAAQ,EACZ,cACA,cAAW,IACX,YACA,YAAS,IACT,QACA,GAAG,QACwB;CAC3B,IAAM,EAAE,YAAS,uBAAoB,GAAe,EAE9C,KAAoD,MAAS;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ACrB;GACA;GACA,QAAQ;GACR,iBAAiB,CAAC,CAAC;GACnB,kBAAkB,CAAC,CAAC;GACpB,gBAAgB,CAAC,CAAC;GAClB,iBAAiB,CAAC,CAAC;GACnB,gBAAgB,CAAC,CAAC;GACnB,CAAC;EACQ;EACA;EACV,UAAU;EACV,oBAAkB;EAClB,gBAAc;EACd,UAAU;EACV,WAAW;EACX,GAAI;EACJ,CAAA;GAIO,IAAQ,OAAO,OAAO,GAAM,EACvC,IAAI,SACL,CAAC;AAEF,EAAK,cAAc;;;ACtFnB,IAAa,IAMT,OAAO,OAAO,GAAM;CACtB,cAAc;CACd,eAAe;CACf,aAAa;CACb,cAAc;CACd,aAAa;CACd,CAAC;AAEF,EAAW,cAAc,cACzB,EAAkB,cAAc,2BAChC,EAAmB,cAAc,4BACjC,EAAiB,cAAc,0BAC/B,EAAkB,cAAc,2BAChC,EAAiB,cAAc"}
@@ -1,2 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);const e=require(`../icon-CRPcdgYp.js`),t=require(`../button-CvvFH9fU.js`),n=require(`../icon-button-D1Lg6gvI.js`);let r=require(`class-variance-authority`),i=require(`react`),a=require(`react/jsx-runtime`),o=require(`@spark-ui/icons/Close`),s=require(`@react-stately/toast`),c=require(`react-dom`),l=require(`@react-aria/toast`);var u=[{design:`filled`,intent:`success`,class:[`bg-success text-on-success`]},{design:`filled`,intent:`alert`,class:[`bg-alert text-on-alert`]},{design:`filled`,intent:`error`,class:[`bg-error text-on-error`]},{design:`filled`,intent:`info`,class:[`bg-info text-on-info`]},{design:`filled`,intent:`neutral`,class:[`bg-neutral text-on-neutral`]},{design:`filled`,intent:`main`,class:[`bg-main text-on-main`]},{design:`filled`,intent:`support`,class:[`bg-support text-on-support`]},{design:`filled`,intent:`accent`,class:[`bg-accent text-on-accent`]},{design:`filled`,intent:`inverse`,class:[`bg-surface-inverse text-on-surface-inverse`]}],d=[{design:`tinted`,intent:`success`,class:[`bg-success-container text-on-success-container`]},{design:`tinted`,intent:`alert`,class:[`bg-alert-container text-on-alert-container`]},{design:`tinted`,intent:`error`,class:[`bg-error-container text-on-error-container`]},{design:`tinted`,intent:`info`,class:[`bg-info-container text-on-info-container`]},{design:`tinted`,intent:`neutral`,class:[`bg-neutral-container text-on-neutral-container`]},{design:`tinted`,intent:`main`,class:[`bg-main-container text-on-main-container`]},{design:`tinted`,intent:`support`,class:[`bg-support-container text-on-support-container`]},{design:`tinted`,intent:`accent`,class:[`bg-accent-container text-on-accent-container`]},{design:`tinted`,intent:`inverse`,class:[`bg-surface-inverse text-on-surface-inverse`]}],f=(0,r.cva)(`rounded-md shadow-sm.max-w-[600px].cursor-default pointer-events-auto touch-none select-none.absolute.group-focus-visible:outline-hidden group-focus-visible:u-outline group-not-focus-visible:ring-inset.group-data-[position=bottom]:bottom-0 group-data-[position=bottom-left]:bottom-0 group-data-[position=bottom-right]:bottom-0.group-data-[position=top]:top-0 group-data-[position=top-left]:top-0 group-data-[position=top-right]:top-0.animation-duration-400.[animation-fill-mode: forwards]!.data-[animation=queued]:animate-fade-in.data-[animation=entering]:animation-ease-decelerate-back.data-[animation=exiting]:animation-ease-accelerate.data-[animation=entering]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-in-bottom.data-[animation=exiting]:opacity-0 data-[animation=exiting]:transition-opacity.data-[animation=exiting]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-out-bottom.data-[animation=entering]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-in-bottom.data-[animation=exiting]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-out-bottom.data-[animation=entering]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-in-bottom.data-[animation=exiting]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-out-bottom.data-[animation=entering]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-in-top.data-[animation=exiting]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-out-top.data-[animation=entering]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-in-top.data-[animation=exiting]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-out-top.data-[animation=entering]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-in-top.data-[animation=exiting]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-out-top.data-[swipe=move]:data-[swipe-direction=right]:translate-x-(--swipe-position-x).data-[swipe=move]:data-[swipe-direction=left]:translate-x-(--swipe-position-x).data-[swipe=cancel]:translate-x-0.data-[swipe=end]:data-[swipe-direction=right]:animate-standalone-swipe-out-right.data-[swipe=end]:data-[swipe-direction=left]:animate-standalone-swipe-out-left`.split(`.`),{variants:{design:{filled:``,tinted:``},intent:{success:``,alert:``,error:``,info:``,neutral:``,main:``,support:``,accent:``,inverse:``}},compoundVariants:[...u,...d],defaultVariants:{design:`filled`,intent:`neutral`}}),p=(0,r.cva)([`inline-grid items-center`,`col-start-1 row-start-1`,`pl-md pr-lg`],{variants:{actionOnNewline:{true:[`grid-rows-[52px_1fr_52px]`,`grid-cols-[min-content_1fr_min-content]`,`[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']`],false:[`grid-cols-[min-content_1fr_min-content_min-content]`,`[grid-template-areas:'icon_message_action_close']`]}},defaultVariants:{actionOnNewline:!1}}),m=(0,i.createContext)({}),h=()=>(0,i.useContext)(m),g=({design:e=`filled`,intent:n=`neutral`,onClick:i,children:o,className:s,ref:c,...l})=>{let{toast:u,state:d}=h(),f=n??u.content.intent,p=e??u.content.design;return(0,a.jsx)(t.t,{"data-spark-component":`snackbar-item-action`,ref:c,size:`md`,shape:`rounded`,...f===`inverse`?{design:`ghost`,intent:`surface`}:{design:p,intent:f===`error`?`danger`:f},onClick:e=>{i?.(e),d.close(u.key)},style:{gridArea:`action`,...l.style},className:(0,r.cx)(`ml-md justify-self-end`,s),...l,children:o})};g.displayName=`Snackbar.ItemAction`;var _=({design:t=`filled`,intent:i=`neutral`,"aria-label":s,onClick:c,className:l,ref:u,...d})=>{let{toast:f,state:p}=h(),m=i??f.content.intent,g=t??f.content.design;return(0,a.jsx)(n.t,{"data-spark-component":`snackbar-item-close`,ref:u,size:`md`,shape:`rounded`,...m===`inverse`?{design:`ghost`,intent:`surface`}:{design:g,intent:m===`error`?`danger`:m},"aria-label":s,onClick:e=>{c?.(e),p.close(f.key)},style:{gridArea:`close`,...d.style},className:(0,r.cx)(`ml-md justify-self-end`,l),...d,children:(0,a.jsx)(e.t,{size:`sm`,children:(0,a.jsx)(o.Close,{})})})};_.displayName=`Snackbar.ItemClose`;var v=({children:t,className:n,...i})=>(0,a.jsx)(e.t,{size:`md`,className:(0,r.cx)(`mx-md`,n),style:{gridArea:`icon`,...i.style},...i,children:t});v.displayName=`Snackbar.ItemIcon`;var y=75,b=({swipeRef:e,onSwipeStart:t,onSwipeMove:n,onSwipeCancel:r,onSwipeEnd:a,threshold:o=10})=>{let[s,c]=(0,i.useState)(),l=(0,i.useRef)(null),u=(0,i.useRef)(null),d=(0,i.useRef)(null),f=e=>{u.current={x:e.clientX,y:e.clientY},document.addEventListener(`selectstart`,e=>e.preventDefault())},p=r=>{if(!u.current)return;let i=Math.abs(r.clientX-u.current.x),a=Math.abs(r.clientY-u.current.y),s;i>a&&i>o?l.current=r.clientX>u.current.x?`right`:`left`:a>o&&(l.current=r.clientY>u.current.y?`down`:`up`),l.current&&(d.current?(s=`move`,d.current={x:i,y:a},e.current.style.setProperty(`--swipe-position-x`,`${i>a?r.clientX-u.current.x:0}px`),e.current.style.setProperty(`--swipe-position-y`,`${i>a?0:r.clientY-u.current.y}px`),n?.({state:s,direction:l.current})):(s=`start`,d.current={x:i,y:a},t?.({state:s,direction:l.current})),c(s))},m=()=>{let e=d.current;if(u.current=null,d.current=null,e){let{x:t,y:n}=e,i;t>n?t>y?(i=`end`,a?.({state:i,direction:l.current})):(i=`cancel`,r?.({state:i,direction:l.current})):n>y?(i=`end`,a?.({state:i,direction:l.current})):(i=`cancel`,r?.({state:i,direction:l.current})),c(i),document.removeEventListener(`selectstart`,e=>e.preventDefault())}};return(0,i.useEffect)(()=>{if(!e.current)return;let t=e.current;return t.addEventListener(`pointerdown`,f),document.addEventListener(`pointermove`,p),document.addEventListener(`pointerup`,m),()=>{t.removeEventListener(`pointerdown`,f),document.removeEventListener(`pointermove`,p),document.removeEventListener(`pointerup`,m)}},[]),{state:s,direction:l.current}},x=({"aria-label":e,"aria-labelledby":t,"aria-describedby":n,"aria-details":r,design:o,intent:s,actionOnNewline:c,className:u,children:d,ref:m,...y})=>{let x=(0,i.useRef)(null),C=typeof m==`function`?x:m||x,{toast:w,state:T}=h(),{state:E,direction:D}=b({swipeRef:C,onSwipeStart:T.pauseAll,onSwipeCancel:T.resumeAll,onSwipeEnd:({direction:e})=>{[`left`,`right`].includes(`${e}`)&&T.close(w.key)}}),{message:O,icon:k,isClosable:A,onAction:j,actionLabel:M}=w.content,N=s??w.content.intent,P=o??w.content.design,F=c??w.content.actionOnNewline,{toastProps:I,titleProps:L,closeButtonProps:R,contentProps:z}=(0,l.useToast)({toast:w,ariaLabel:e,ariaLabelledby:t,ariaDescribedby:n,ariaDetails:r},T,C),B=(0,i.useCallback)(e=>i.Children.toArray(d).filter(i.isValidElement).find(t=>!!t.type.displayName?.includes(e)),[d]),V=B(`Snackbar.ItemIcon`),H=B(`Snackbar.ItemAction`),U=B(`Snackbar.ItemClose`);return(0,a.jsx)(`div`,{"data-spark-component":`snackbar-item`,className:f({design:P,intent:N,className:u}),"data-animation":w.animation,...!(E===`cancel`&&w.animation===`exiting`)&&{"data-swipe":E,"data-swipe-direction":D},...w.animation===`exiting`&&{onAnimationEnd:()=>T.remove(w.key)},ref:C,...I,...y,children:(0,a.jsxs)(`div`,{className:p({actionOnNewline:F}),...z,children:[S(V,k?v:null,{children:k}),(0,a.jsx)(`p`,{className:`px-md py-lg text-body-2 row-span-3`,style:{gridArea:`message`},...L,children:O}),S(H,M&&j?g:null,{intent:N,design:P,onClick:j,children:M}),S(U,A?_:null,{intent:N,design:P,"aria-label":R[`aria-label`]})]})})};x.displayName=`Snackbar.Item`;var S=(e,t,n)=>e?(0,i.cloneElement)(e,{...n,...e.props}):t?(0,a.jsx)(t,{...n}):null,C=(0,r.cva)([`fixed inset-x-lg z-toast group`,`outline-hidden pointer-events-none`,`grid grid-rows-1 grid-cols-1 gap-lg`],{variants:{position:{top:`top-lg justify-items-center`,"top-right":`top-lg justify-items-end`,"top-left":`top-lg justify-items-start`,bottom:`bottom-lg justify-items-center`,"bottom-right":`bottom-lg justify-items-end`,"bottom-left":`bottom-lg justify-items-start`}},defaultVariants:{position:`bottom`}}),w=({children:e=(0,a.jsx)(x,{}),state:t,position:n=`bottom`,className:r,ref:o,...s})=>{let c=(0,i.useRef)(null),u=o&&typeof o!=`function`?o:c,{regionProps:d}=(0,l.useToastRegion)(s,t,u);return(0,a.jsx)(`div`,{...d,ref:u,"data-position":n,className:C({position:n,className:r}),children:t.visibleToasts.map(n=>(0,a.jsx)(m.Provider,{value:{toast:n,state:t},children:(0,i.cloneElement)(e,{key:n.key})},n.key))})},T=({providers:e,subscriptions:t})=>{let n=(0,i.useCallback)(e=>(t.add(e),()=>t.delete(e)),[t]),r=(0,i.useCallback)(()=>[...e].reverse()[0],[e]),a=(0,i.useCallback)(n=>{e.add(n);for(let e of t)e()},[e,t]),o=(0,i.useCallback)(n=>{e.delete(n);for(let e of t)e()},[e,t]);return{provider:(0,i.useSyncExternalStore)(n,r,r),addProvider:a,deleteProvider:o}},E=null,D=()=>(E||=new s.ToastQueue({maxVisibleToasts:1,hasExitAnimation:!0}),E),O=()=>{E=null},k={providers:new Set,subscriptions:new Set},A=({ref:e,...t})=>{let n=(0,i.useRef)(null),r=(0,s.useToastQueue)(D()),{provider:o,addProvider:l,deleteProvider:u}=T(k);return(0,i.useEffect)(()=>(l(n),()=>{for(let e of D().visibleToasts)e.animation=void 0;u(n)}),[]),n===o&&r.visibleToasts.length>0?(0,c.createPortal)((0,a.jsx)(w,{ref:e,state:r,...t}),document.body):null};A.displayName=`Snackbar`;var j=({onClose:e,timeout:t=5e3,priority:n,...r})=>{D().add(r,{onClose:e,timeout:t&&!r.onAction?Math.max(t,5e3):void 0,priority:n})},M=Object.assign(A,{Item:x,ItemAction:g,ItemClose:_,ItemIcon:v});M.displayName=`Snackbar`,x.displayName=`Snackbar.Item`,g.displayName=`Snackbar.ItemAction`,_.displayName=`Snackbar.ItemClose`,v.displayName=`Snackbar.ItemIcon`,exports.Snackbar=M,exports.addSnackbar=j,exports.clearSnackbarQueue=O;
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/snackbar/snackbarVariants.ts","../../src/snackbar/SnackbarItem.styles.ts","../../src/snackbar/SnackbarItemContext.tsx","../../src/snackbar/SnackbarItemAction.tsx","../../src/snackbar/SnackbarItemClose.tsx","../../src/snackbar/SnackbarItemIcon.tsx","../../src/snackbar/useSwipe.ts","../../src/snackbar/SnackbarItem.tsx","../../src/snackbar/SnackbarRegion.styles.ts","../../src/snackbar/SnackbarRegion.tsx","../../src/snackbar/useSnackbarGlobalStore.ts","../../src/snackbar/Snackbar.tsx","../../src/snackbar/index.ts"],"sourcesContent":["export const filledVariants = [\n {\n design: 'filled',\n intent: 'success',\n class: ['bg-success text-on-success'],\n },\n {\n design: 'filled',\n intent: 'alert',\n class: ['bg-alert text-on-alert'],\n },\n {\n design: 'filled',\n intent: 'error',\n class: ['bg-error text-on-error'],\n },\n {\n design: 'filled',\n intent: 'info',\n class: ['bg-info text-on-info'],\n },\n {\n design: 'filled',\n intent: 'neutral',\n class: ['bg-neutral text-on-neutral'],\n },\n {\n design: 'filled',\n intent: 'main',\n class: ['bg-main text-on-main'],\n },\n {\n design: 'filled',\n intent: 'support',\n class: ['bg-support text-on-support'],\n },\n {\n design: 'filled',\n intent: 'accent',\n class: ['bg-accent text-on-accent'],\n },\n {\n design: 'filled',\n intent: 'inverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n] as const\n\nexport const tintedVariants = [\n {\n design: 'tinted',\n intent: 'success',\n class: ['bg-success-container text-on-success-container'],\n },\n {\n design: 'tinted',\n intent: 'alert',\n class: ['bg-alert-container text-on-alert-container'],\n },\n {\n design: 'tinted',\n intent: 'error',\n class: ['bg-error-container text-on-error-container'],\n },\n {\n design: 'tinted',\n intent: 'info',\n class: ['bg-info-container text-on-info-container'],\n },\n {\n design: 'tinted',\n intent: 'neutral',\n class: ['bg-neutral-container text-on-neutral-container'],\n },\n {\n design: 'tinted',\n intent: 'main',\n class: ['bg-main-container text-on-main-container'],\n },\n {\n design: 'tinted',\n intent: 'support',\n class: ['bg-support-container text-on-support-container'],\n },\n {\n design: 'tinted',\n intent: 'accent',\n class: ['bg-accent-container text-on-accent-container'],\n },\n {\n design: 'tinted',\n intent: 'inverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n] as const\n","import { cva, VariantProps } from 'class-variance-authority'\n\nimport { filledVariants, tintedVariants } from './snackbarVariants'\n\nexport const snackbarItemVariant = cva(\n [\n 'rounded-md shadow-sm',\n 'max-w-[600px]',\n 'cursor-default pointer-events-auto touch-none select-none',\n 'absolute',\n /**\n * Focus\n */\n 'group-focus-visible:outline-hidden group-focus-visible:u-outline group-not-focus-visible:ring-inset',\n /**\n * Positionning\n */\n 'group-data-[position=bottom]:bottom-0 group-data-[position=bottom-left]:bottom-0 group-data-[position=bottom-right]:bottom-0',\n 'group-data-[position=top]:top-0 group-data-[position=top-left]:top-0 group-data-[position=top-right]:top-0',\n /**\n * Animation and opacity\n */\n 'animation-duration-400',\n '[animation-fill-mode: forwards]!',\n 'data-[animation=queued]:animate-fade-in',\n 'data-[animation=entering]:animation-ease-decelerate-back',\n 'data-[animation=exiting]:animation-ease-accelerate',\n // Parent position bottom|bottom-left|bottom-right\n 'data-[animation=entering]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:opacity-0 data-[animation=exiting]:transition-opacity',\n 'data-[animation=exiting]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-out-bottom',\n 'data-[animation=entering]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-out-bottom',\n 'data-[animation=entering]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-out-bottom',\n // Parent position top|top-left|top-right\n 'data-[animation=entering]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-out-top',\n 'data-[animation=entering]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-out-top',\n 'data-[animation=entering]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-out-top',\n /**\n * Swipe\n */\n 'data-[swipe=move]:data-[swipe-direction=right]:translate-x-(--swipe-position-x)',\n 'data-[swipe=move]:data-[swipe-direction=left]:translate-x-(--swipe-position-x)',\n 'data-[swipe=cancel]:translate-x-0',\n 'data-[swipe=end]:data-[swipe-direction=right]:animate-standalone-swipe-out-right',\n 'data-[swipe=end]:data-[swipe-direction=left]:animate-standalone-swipe-out-left',\n ],\n {\n variants: {\n /**\n * Set different look and feel\n * @default 'filled'\n */\n design: {\n filled: '',\n tinted: '',\n },\n /**\n * Set color intent\n * @default 'neutral'\n */\n intent: {\n success: '',\n alert: '',\n error: '',\n info: '',\n neutral: '',\n main: '',\n support: '',\n accent: '',\n inverse: '',\n },\n },\n compoundVariants: [...filledVariants, ...tintedVariants],\n defaultVariants: {\n design: 'filled',\n intent: 'neutral',\n },\n }\n)\n\nexport const snackbarItemVariantContent = cva(\n [\n 'inline-grid items-center',\n 'col-start-1 row-start-1',\n 'pl-md pr-lg', // applying padding on the parent prevents VoiceOver on Safari from reading snackbar content 🤷\n ],\n {\n variants: {\n /**\n * Force action button displaying on a new line\n * @default false\n */\n actionOnNewline: {\n true: [\n 'grid-rows-[52px_1fr_52px]',\n 'grid-cols-[min-content_1fr_min-content]',\n \"[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']\",\n ],\n false: [\n 'grid-cols-[min-content_1fr_min-content_min-content]',\n \"[grid-template-areas:'icon_message_action_close']\",\n ],\n },\n },\n defaultVariants: {\n actionOnNewline: false,\n },\n }\n)\n\nexport type SnackbarItemVariantProps = VariantProps<typeof snackbarItemVariant>\nexport type SnackbarItemVariantContentProps = VariantProps<typeof snackbarItemVariantContent>\n","import { QueuedToast, ToastState } from '@react-stately/toast'\nimport { createContext, useContext } from 'react'\n\nimport type { SnackbarItemValue } from './SnackbarItem'\n\nexport interface SnackbarItemState<T = SnackbarItemValue> {\n toast: QueuedToast<T>\n state: ToastState<T>\n}\n\nexport const SnackbarItemContext = createContext<SnackbarItemState>({} as SnackbarItemState)\n\nexport const useSnackbarItemContext = () => useContext(SnackbarItemContext)\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Button, type ButtonProps } from '../button'\nimport type { SnackbarItemVariantProps } from './SnackbarItem.styles'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\n\nexport type SnackbarItemActionProps = Omit<ButtonProps, 'size' | 'shape' | 'intent'> &\n SnackbarItemVariantProps & {\n ref?: Ref<HTMLButtonElement>\n }\n\nexport const SnackbarItemAction = ({\n design: designProp = 'filled',\n intent: intentProp = 'neutral',\n onClick,\n children,\n className,\n ref,\n ...rest\n}: SnackbarItemActionProps) => {\n const { toast, state } = useSnackbarItemContext()\n\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n\n return (\n <Button\n data-spark-component=\"snackbar-item-action\"\n ref={ref}\n size=\"md\"\n shape=\"rounded\"\n {...(intent === 'inverse'\n ? {\n design: 'ghost',\n intent: 'surface',\n }\n : {\n design,\n intent: intent === 'error' ? 'danger' : intent,\n })}\n onClick={e => {\n onClick?.(e)\n state.close(toast.key)\n }}\n style={{ gridArea: 'action', ...rest.style }}\n className={cx('ml-md justify-self-end', className)}\n {...rest}\n >\n {children}\n </Button>\n )\n}\n\nSnackbarItemAction.displayName = 'Snackbar.ItemAction'\n","import { Close } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithRef } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport type { SnackbarItemVariantProps } from './SnackbarItem.styles'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\n\nexport interface SnackbarItemCloseProps\n extends\n Omit<ComponentPropsWithRef<'button'>, 'aria-label' | 'disabled'>,\n Pick<IconButtonProps, 'aria-label'>,\n SnackbarItemVariantProps {}\n\nexport const SnackbarItemClose = ({\n design: designProp = 'filled',\n intent: intentProp = 'neutral',\n 'aria-label': ariaLabel,\n onClick,\n className,\n ref,\n ...rest\n}: SnackbarItemCloseProps) => {\n const { toast, state } = useSnackbarItemContext()\n\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n\n return (\n <IconButton\n data-spark-component=\"snackbar-item-close\"\n ref={ref}\n size=\"md\"\n shape=\"rounded\"\n {...(intent === 'inverse'\n ? {\n design: 'ghost',\n intent: 'surface',\n }\n : {\n design,\n intent: intent === 'error' ? 'danger' : intent,\n })}\n aria-label={ariaLabel}\n onClick={e => {\n onClick?.(e)\n state.close(toast.key)\n }}\n style={{ gridArea: 'close', ...rest.style }}\n className={cx('ml-md justify-self-end', className)}\n {...rest}\n >\n <Icon size=\"sm\">\n <Close />\n </Icon>\n </IconButton>\n )\n}\n\nSnackbarItemClose.displayName = 'Snackbar.ItemClose'\n","import { cx } from 'class-variance-authority'\nimport type { ReactElement } from 'react'\n\nimport { Icon, type IconProps } from '../icon'\n\nexport type SnackbarItemIconProps = IconProps\n\nexport const SnackbarItemIcon = ({\n children,\n className,\n ...rest\n}: SnackbarItemIconProps): ReactElement => (\n <Icon\n size=\"md\"\n className={cx('mx-md', className)}\n style={{ gridArea: 'icon', ...rest.style }}\n {...rest}\n >\n {children}\n </Icon>\n)\n\nSnackbarItemIcon.displayName = 'Snackbar.ItemIcon'\n","/* eslint-disable complexity */\nimport { type RefObject, useEffect, useRef, useState } from 'react'\n\ninterface SwipeArgs<T> {\n swipeRef: RefObject<T | null>\n onSwipeStart?: ({ state, direction }: SwipeReturn) => void\n onSwipeMove?: ({ state, direction }: SwipeReturn) => void\n onSwipeCancel?: ({ state, direction }: SwipeReturn) => void\n onSwipeEnd?: ({ state, direction }: SwipeReturn) => void\n threshold?: number\n}\n\ninterface SwipeReturn {\n state?: 'start' | 'move' | 'cancel' | 'end'\n direction?: 'up' | 'down' | 'right' | 'left' | null\n}\n\nconst SWIPE_THRESHOLD = 75\n\nexport const useSwipe = <T extends HTMLElement>({\n swipeRef,\n onSwipeStart,\n onSwipeMove,\n onSwipeCancel,\n onSwipeEnd,\n threshold = 10,\n}: SwipeArgs<T>): SwipeReturn => {\n const [state, setState] = useState<SwipeReturn['state']>()\n\n const direction = useRef<SwipeReturn['direction']>(null)\n const origin = useRef<Record<'x' | 'y', number> | null>(null)\n const delta = useRef<Record<'x' | 'y', number> | null>(null)\n\n const handleSwipeStart = (evt: PointerEvent) => {\n origin.current = { x: evt.clientX, y: evt.clientY }\n\n /**\n * Prevents unwanted text selection in Safari browser (longpress)\n */\n document.addEventListener('selectstart', e => e.preventDefault())\n }\n\n const handleSwipeMove = (evt: PointerEvent) => {\n if (!origin.current) return\n\n const deltaX = Math.abs(evt.clientX - origin.current.x)\n const deltaY = Math.abs(evt.clientY - origin.current.y)\n\n let moveState: SwipeReturn['state']\n\n if (deltaX > deltaY && deltaX > threshold) {\n direction.current = evt.clientX > origin.current.x ? 'right' : 'left'\n } else if (deltaY > threshold) {\n direction.current = evt.clientY > origin.current.y ? 'down' : 'up'\n }\n\n /**\n * If no direction could be defined, then no move should be handled.\n * This is particularly true with trackpads working with MacOS/Windows.\n */\n if (!direction.current) return\n\n if (!delta.current) {\n moveState = 'start'\n delta.current = { x: deltaX, y: deltaY }\n onSwipeStart?.({ state: moveState, direction: direction.current })\n } else {\n moveState = 'move'\n delta.current = { x: deltaX, y: deltaY }\n ;(swipeRef.current as T).style.setProperty(\n '--swipe-position-x',\n `${deltaX > deltaY ? evt.clientX - origin.current.x : 0}px`\n )\n ;(swipeRef.current as T).style.setProperty(\n '--swipe-position-y',\n `${!(deltaX > deltaY) ? evt.clientY - origin.current.y : 0}px`\n )\n onSwipeMove?.({ state: moveState, direction: direction.current })\n }\n\n setState(moveState)\n }\n\n const handleSwipeEnd = () => {\n const proxyDelta = delta.current\n\n origin.current = null\n delta.current = null\n\n if (proxyDelta) {\n const { x: deltaX, y: deltaY } = proxyDelta\n\n let endState: SwipeReturn['state']\n\n if (deltaX > deltaY) {\n if (deltaX > SWIPE_THRESHOLD) {\n endState = 'end'\n onSwipeEnd?.({ state: endState, direction: direction.current })\n } else {\n endState = 'cancel'\n onSwipeCancel?.({ state: endState, direction: direction.current })\n }\n } else {\n if (deltaY > SWIPE_THRESHOLD) {\n endState = 'end'\n onSwipeEnd?.({ state: endState, direction: direction.current })\n } else {\n endState = 'cancel'\n onSwipeCancel?.({ state: endState, direction: direction.current })\n }\n }\n\n setState(endState)\n\n /**\n * Prevents unwanted text selection in Safari browser (longpress)\n */\n document.removeEventListener('selectstart', e => e.preventDefault())\n }\n }\n\n useEffect(() => {\n if (!swipeRef.current) return\n\n const swipeElement = swipeRef.current\n\n swipeElement.addEventListener('pointerdown', handleSwipeStart)\n document.addEventListener('pointermove', handleSwipeMove)\n document.addEventListener('pointerup', handleSwipeEnd)\n\n return () => {\n swipeElement.removeEventListener('pointerdown', handleSwipeStart)\n document.removeEventListener('pointermove', handleSwipeMove)\n document.removeEventListener('pointerup', handleSwipeEnd)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return {\n state,\n direction: direction.current,\n }\n}\n","/* eslint-disable max-lines-per-function */\n\nimport { useToast } from '@react-aria/toast'\nimport {\n Children,\n cloneElement,\n type ComponentPropsWithRef,\n type FC,\n isValidElement,\n type PropsWithChildren,\n type ReactElement,\n type ReactNode,\n useCallback,\n useRef,\n} from 'react'\n\nimport {\n snackbarItemVariant,\n snackbarItemVariantContent,\n type SnackbarItemVariantContentProps,\n type SnackbarItemVariantProps,\n} from './SnackbarItem.styles'\nimport { SnackbarItemAction, SnackbarItemActionProps } from './SnackbarItemAction'\nimport { SnackbarItemClose, SnackbarItemCloseProps } from './SnackbarItemClose'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\nimport { SnackbarItemIcon, SnackbarItemIconProps } from './SnackbarItemIcon'\nimport { useSwipe } from './useSwipe'\n\nexport interface SnackbarItemValue extends SnackbarItemVariantProps {\n /**\n * Icon that will be prepended before snackbar message\n */\n icon?: ReactNode\n message: ReactNode\n /**\n * If `true` snackbar will display a close button\n * @default false\n */\n isClosable?: boolean\n /**\n * A label for the action button within the toast.\n */\n actionLabel?: string\n /**\n * Handler that is called when the action button is pressed.\n */\n onAction?: () => void\n /**\n * If `true` the action button will be displayed on a new line.\n * @default false\n */\n actionOnNewline?: boolean\n}\n\nexport interface SnackbarItemProps\n extends ComponentPropsWithRef<'div'>, SnackbarItemVariantProps, SnackbarItemVariantContentProps {\n /**\n * Defines a string value that labels the current element.\n */\n 'aria-label'?: string\n /**\n * Identifies the element (or elements) that labels the current element.\n */\n 'aria-labelledby'?: string\n /**\n * Identifies the element (or elements) that describes the object.\n */\n 'aria-describedby'?: string\n /**\n * Identifies the element (or elements) that provide a detailed, extended description for the object.\n */\n 'aria-details'?: string\n}\n\nexport const SnackbarItem = ({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n design: designProp,\n intent: intentProp,\n actionOnNewline: actionOnNewlineProp,\n className,\n children,\n ref: forwardedRef,\n ...rest\n}: PropsWithChildren<SnackbarItemProps>) => {\n const innerRef = useRef(null)\n const ref = typeof forwardedRef !== 'function' ? forwardedRef || innerRef : innerRef\n\n const { toast, state } = useSnackbarItemContext()\n\n const { state: swipeState, direction: swipeDirection } = useSwipe({\n swipeRef: ref,\n onSwipeStart: state.pauseAll,\n onSwipeCancel: state.resumeAll,\n onSwipeEnd: ({ direction }) => {\n ;['left', 'right'].includes(`${direction}`) && state.close(toast.key)\n },\n })\n\n const { message, icon, isClosable, onAction, actionLabel } = toast.content\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n const actionOnNewline = actionOnNewlineProp ?? toast.content.actionOnNewline\n\n const ariaProps = {\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaDetails,\n }\n\n const { toastProps, titleProps, closeButtonProps, contentProps } = useToast(\n { toast, ...ariaProps },\n state,\n ref\n )\n\n const findElement = useCallback(\n <P extends object>(elementDisplayName: string): ReactElement<P> | undefined => {\n const childrenArray = Children.toArray(children)\n\n const match = childrenArray\n .filter(isValidElement)\n .find(\n (child): child is ReactElement<P> =>\n !!(child.type as FC<P> & { displayName?: string }).displayName?.includes(\n elementDisplayName\n )\n )\n\n return match as ReactElement<P> | undefined\n },\n [children]\n )\n\n const iconFromChildren = findElement<SnackbarItemIconProps>('Snackbar.ItemIcon')\n const actionBtnFromChildren = findElement<SnackbarItemActionProps>('Snackbar.ItemAction')\n const closeBtnFromChildren = findElement<SnackbarItemCloseProps>('Snackbar.ItemClose')\n\n return (\n <div\n data-spark-component=\"snackbar-item\"\n className={snackbarItemVariant({ design, intent, className })}\n data-animation={toast.animation}\n {...(!(swipeState === 'cancel' && toast.animation === 'exiting') && {\n 'data-swipe': swipeState,\n 'data-swipe-direction': swipeDirection,\n })}\n {...(toast.animation === 'exiting' && {\n // Remove snackbar when the exiting animation completes\n onAnimationEnd: () => state.remove(toast.key),\n })}\n ref={ref}\n {...toastProps}\n {...rest}\n >\n <div className={snackbarItemVariantContent({ actionOnNewline })} {...contentProps}>\n {/* 1. ICON */}\n {renderSubComponent(iconFromChildren, icon ? SnackbarItemIcon : null, {\n children: icon,\n })}\n\n {/* 2. MESSAGE */}\n <p\n className=\"px-md py-lg text-body-2 row-span-3\"\n style={{ gridArea: 'message' }}\n {...titleProps}\n >\n {message}\n </p>\n\n {/* 3. ACTION BUTTON */}\n {renderSubComponent(\n actionBtnFromChildren,\n actionLabel && onAction ? SnackbarItemAction : null,\n { intent, design, onClick: onAction, children: actionLabel }\n )}\n\n {/* 4. CLOSE BUTTON */}\n {renderSubComponent(closeBtnFromChildren, isClosable ? SnackbarItemClose : null, {\n intent,\n design,\n /**\n * React Spectrum typing of aria-label is inaccurate, and aria-label value should never be undefined.\n * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/i18n/src/useLocalizedStringFormatter.ts#L40\n */\n 'aria-label': closeButtonProps['aria-label'] as string,\n })}\n </div>\n </div>\n )\n}\n\nSnackbarItem.displayName = 'Snackbar.Item'\n\n/**\n * Returns compound item if found in children prop.\n * If not fallbacks to default item, conditionned by addSnackbar options.\n */\nconst renderSubComponent = <P extends object>(\n childItem?: ReactElement<P>,\n defaultItem?: FC<P> | null,\n props?: P\n) => {\n if (childItem) {\n return cloneElement(childItem, { ...props, ...childItem.props })\n } else if (defaultItem) {\n const Item = defaultItem\n\n return <Item {...(props as P)} />\n } else {\n return null\n }\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const snackbarRegionVariant = cva(\n [\n 'fixed inset-x-lg z-toast group',\n 'outline-hidden pointer-events-none',\n 'grid grid-rows-1 grid-cols-1 gap-lg',\n ],\n {\n variants: {\n /**\n * Set snackbar item position\n * @default 'bottom'\n */\n position: {\n top: 'top-lg justify-items-center',\n 'top-right': 'top-lg justify-items-end',\n 'top-left': 'top-lg justify-items-start',\n bottom: 'bottom-lg justify-items-center',\n 'bottom-right': 'bottom-lg justify-items-end',\n 'bottom-left': 'bottom-lg justify-items-start',\n },\n },\n defaultVariants: {\n position: 'bottom',\n },\n }\n)\n\nexport type SnackbarRegionVariantProps = VariantProps<typeof snackbarRegionVariant>\n","import { type AriaToastRegionProps, useToastRegion } from '@react-aria/toast'\nimport { cloneElement, type ComponentPropsWithRef, type ReactElement, useRef } from 'react'\n\nimport { SnackbarItem, type SnackbarItemProps } from './SnackbarItem'\nimport { SnackbarItemContext, type SnackbarItemState } from './SnackbarItemContext'\nimport { snackbarRegionVariant, type SnackbarRegionVariantProps } from './SnackbarRegion.styles'\n\nexport interface SnackbarRegionProps\n extends\n ComponentPropsWithRef<'div'>,\n AriaToastRegionProps,\n SnackbarRegionVariantProps,\n Pick<SnackbarItemState, 'state'> {\n /**\n * An accessibility label for the snackbar region.\n * @default 'Notifications'\n */\n 'aria-label'?: string\n /**\n * Identifies the element (or elements) that labels the current element.\n */\n 'aria-labelledby'?: string\n /**\n * Identifies the element (or elements) that describes the object.\n */\n 'aria-describedby'?: string\n /**\n * Identifies the element (or elements) that provide a detailed, extended description for the object.\n */\n 'aria-details'?: string\n /**\n * The component/template used to display each snackbar from the queue\n * @default 'Snackbar.Item'\n */\n children?: ReactElement<SnackbarItemProps, typeof SnackbarItem>\n}\n\nexport const SnackbarRegion = ({\n children = <SnackbarItem />,\n state,\n position = 'bottom',\n className,\n ref: forwardedRef,\n ...rest\n}: SnackbarRegionProps): ReactElement => {\n const innerRef = useRef<HTMLDivElement>(null)\n const ref = forwardedRef && typeof forwardedRef !== 'function' ? forwardedRef : innerRef\n\n const { regionProps } = useToastRegion(rest, state, ref)\n\n return (\n <div\n {...regionProps}\n ref={ref}\n data-position={position}\n className={snackbarRegionVariant({ position, className })}\n >\n {state.visibleToasts.map(toast => (\n <SnackbarItemContext.Provider key={toast.key} value={{ toast, state }}>\n {cloneElement(children, { key: toast.key })}\n </SnackbarItemContext.Provider>\n ))}\n </div>\n )\n}\n","import { type RefObject, useCallback, useSyncExternalStore } from 'react'\n\ninterface UseSnackbarGlobalStoreArgs<T> {\n providers: Set<T>\n subscriptions: Set<() => void>\n}\n\ninterface UseSnackbarGlobalStoreReturn<T> {\n provider: T\n addProvider: (ref: T) => void\n deleteProvider: (ref: T) => void\n}\n\n/**\n * This hook is a basic abstraction of useSyncExternalStore hook which allows us\n * to consume data from an external data store.\n *\n * Cf. https://react.dev/reference/react/useSyncExternalStore#subscribing-to-an-external-store\n */\n\nexport const useSnackbarGlobalStore = <T = RefObject<HTMLDivElement | null>>({\n providers,\n subscriptions,\n}: UseSnackbarGlobalStoreArgs<T>): UseSnackbarGlobalStoreReturn<T> => {\n const subscribe = useCallback(\n (listener: () => void) => {\n subscriptions.add(listener)\n\n return () => subscriptions.delete(listener)\n },\n [subscriptions]\n )\n\n const getLastSnackbarProvider = useCallback(() => [...providers].reverse()[0] as T, [providers])\n\n const addProvider = useCallback(\n (provider: T) => {\n providers.add(provider)\n\n for (const subscribeFn of subscriptions) {\n subscribeFn()\n }\n },\n [providers, subscriptions]\n )\n\n const deleteProvider = useCallback(\n (provider: T) => {\n providers.delete(provider)\n\n for (const subscribeFn of subscriptions) {\n subscribeFn()\n }\n },\n [providers, subscriptions]\n )\n\n const provider = useSyncExternalStore(subscribe, getLastSnackbarProvider, getLastSnackbarProvider)\n\n return {\n provider,\n addProvider,\n deleteProvider,\n }\n}\n","import {\n type ToastOptions as SnackBarItemOptions,\n ToastQueue,\n useToastQueue,\n} from '@react-stately/toast'\nimport { type ReactElement, Ref, type RefObject, useEffect, useRef } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { type SnackbarItemValue } from './SnackbarItem'\nimport { SnackbarRegion, type SnackbarRegionProps } from './SnackbarRegion'\nimport { useSnackbarGlobalStore } from './useSnackbarGlobalStore'\n\n/**\n * We define here a global queue thanks to dedicated util from React Spectrum.\n * It is based on React `useSyncExternalStore` and allows us to consume data from\n * an external data store, and thus preventing use of React context that could\n * lead to unwanted rerenderings. It also simplifies initial implementation.\n */\nlet GLOBAL_SNACKBAR_QUEUE: ToastQueue<SnackbarItemValue> | null = null\n\nconst getGlobalSnackBarQueue = () => {\n if (!GLOBAL_SNACKBAR_QUEUE) {\n GLOBAL_SNACKBAR_QUEUE = new ToastQueue({\n maxVisibleToasts: 1,\n hasExitAnimation: true,\n })\n }\n\n return GLOBAL_SNACKBAR_QUEUE\n}\n\nexport const clearSnackbarQueue = () => {\n GLOBAL_SNACKBAR_QUEUE = null\n}\n\n/**\n * We define a global store to keep track of all providers instances, to ensure\n * we always have a single Snackbar container.\n */\nconst GLOBAL_SNACKBAR_STORE = {\n providers: new Set<RefObject<HTMLDivElement | null>>(),\n subscriptions: new Set<() => void>(),\n}\n\nexport type SnackbarProps = Omit<SnackbarRegionProps, 'state'> & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Snackbar = ({ ref: forwardedRef, ...props }: SnackbarProps): ReactElement | null => {\n const ref = useRef<HTMLDivElement>(null)\n\n const state = useToastQueue(getGlobalSnackBarQueue())\n\n const { provider, addProvider, deleteProvider } = useSnackbarGlobalStore(GLOBAL_SNACKBAR_STORE)\n\n useEffect(() => {\n addProvider(ref)\n\n return () => {\n for (const toast of getGlobalSnackBarQueue().visibleToasts) {\n toast.animation = undefined\n }\n\n deleteProvider(ref)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return ref === provider && state.visibleToasts.length > 0\n ? createPortal(<SnackbarRegion ref={forwardedRef} state={state} {...props} />, document.body)\n : null\n}\n\nSnackbar.displayName = 'Snackbar'\n\nexport interface AddSnackbarArgs extends SnackbarItemValue, Omit<SnackBarItemOptions, 'timeout'> {\n /**\n * Handler that is called when the snackbar is closed, either by the user\n * or after a timeout.\n */\n onClose?: () => void\n /**\n * A timeout to automatically close the snackbar after, in milliseconds.\n * @default 5000\n */\n timeout?: number | null\n /**\n * The priority of the snackbar relative to other snackbars. Larger numbers indicate higher priority.\n */\n priority?: number\n}\n\nexport const addSnackbar = ({ onClose, timeout = 5000, priority, ...content }: AddSnackbarArgs) => {\n const queue = getGlobalSnackBarQueue()\n\n queue.add(content, {\n onClose,\n timeout: timeout && !content.onAction ? Math.max(timeout, 5000) : undefined,\n priority,\n })\n}\n","import {\n addSnackbar,\n type AddSnackbarArgs,\n clearSnackbarQueue,\n Snackbar as Root,\n type SnackbarProps,\n} from './Snackbar'\nimport { SnackbarItem as Item, type SnackbarItemProps } from './SnackbarItem'\nimport {\n SnackbarItemAction as ItemAction,\n type SnackbarItemActionProps,\n} from './SnackbarItemAction'\nimport { SnackbarItemClose as ItemClose, type SnackbarItemCloseProps } from './SnackbarItemClose'\nimport { SnackbarItemIcon as ItemIcon, type SnackbarItemIconProps } from './SnackbarItemIcon'\n\nexport const Snackbar: typeof Root & {\n Item: typeof Item\n ItemAction: typeof ItemAction\n ItemClose: typeof ItemClose\n ItemIcon: typeof ItemIcon\n} = Object.assign(Root, {\n Item,\n ItemAction,\n ItemClose,\n ItemIcon,\n})\n\nSnackbar.displayName = 'Snackbar'\nItem.displayName = 'Snackbar.Item'\nItemAction.displayName = 'Snackbar.ItemAction'\nItemClose.displayName = 'Snackbar.ItemClose'\nItemIcon.displayName = 'Snackbar.ItemIcon'\n\nexport type {\n SnackbarProps,\n SnackbarItemProps,\n SnackbarItemActionProps,\n SnackbarItemCloseProps,\n SnackbarItemIconProps,\n AddSnackbarArgs,\n}\nexport { addSnackbar, clearSnackbarQueue }\n"],"mappings":"4aAAA,IAAa,EAAiB,CAC5B,CACE,OAAQ,SACR,OAAQ,UACR,MAAO,CAAC,6BAA6B,CACtC,CACD,CACE,OAAQ,SACR,OAAQ,QACR,MAAO,CAAC,yBAAyB,CAClC,CACD,CACE,OAAQ,SACR,OAAQ,QACR,MAAO,CAAC,yBAAyB,CAClC,CACD,CACE,OAAQ,SACR,OAAQ,OACR,MAAO,CAAC,uBAAuB,CAChC,CACD,CACE,OAAQ,SACR,OAAQ,UACR,MAAO,CAAC,6BAA6B,CACtC,CACD,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