@flipdish/ui-library 0.51.0 → 0.53.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 (343) hide show
  1. package/README.md +17 -16
  2. package/dist/components/atoms/Checkbox/index.cjs +4 -2
  3. package/dist/components/atoms/Checkbox/index.cjs.map +1 -1
  4. package/dist/components/atoms/Checkbox/index.d.ts.map +1 -1
  5. package/dist/components/atoms/Checkbox/index.js +4 -2
  6. package/dist/components/atoms/Checkbox/index.js.map +1 -1
  7. package/dist/components/atoms/Slider/index.cjs +2 -2
  8. package/dist/components/atoms/Slider/index.cjs.map +1 -1
  9. package/dist/components/atoms/Slider/index.d.ts +3 -1
  10. package/dist/components/atoms/Slider/index.d.ts.map +1 -1
  11. package/dist/components/atoms/Slider/index.js +2 -2
  12. package/dist/components/atoms/Slider/index.js.map +1 -1
  13. package/dist/components/forms/Form/hooks/useForm.cjs +26 -0
  14. package/dist/components/forms/Form/hooks/useForm.cjs.map +1 -0
  15. package/dist/components/forms/Form/hooks/useForm.d.ts +13 -0
  16. package/dist/components/forms/Form/hooks/useForm.d.ts.map +1 -0
  17. package/dist/components/forms/Form/hooks/useForm.js +24 -0
  18. package/dist/components/forms/Form/hooks/useForm.js.map +1 -0
  19. package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.cjs +93 -0
  20. package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.cjs.map +1 -0
  21. package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.d.ts +54 -0
  22. package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.d.ts.map +1 -0
  23. package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.js +91 -0
  24. package/dist/components/forms/Form/hooks/useSaveForm/useSaveForm.js.map +1 -0
  25. package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.cjs +28 -0
  26. package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.cjs.map +1 -0
  27. package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.d.ts +10 -0
  28. package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.d.ts.map +1 -0
  29. package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.js +26 -0
  30. package/dist/components/forms/Form/hooks/useSubmitInTurn/useSubmitInTurn.js.map +1 -0
  31. package/dist/components/forms/Form/index.cjs +63 -0
  32. package/dist/components/forms/Form/index.cjs.map +1 -0
  33. package/dist/components/forms/Form/index.d.ts +37 -0
  34. package/dist/components/forms/Form/index.d.ts.map +1 -0
  35. package/dist/components/forms/Form/index.js +59 -0
  36. package/dist/components/forms/Form/index.js.map +1 -0
  37. package/dist/components/forms/Form/utilities/formSubmit.utils.cjs +23 -0
  38. package/dist/components/forms/Form/utilities/formSubmit.utils.cjs.map +1 -0
  39. package/dist/components/forms/Form/utilities/formSubmit.utils.d.ts +14 -0
  40. package/dist/components/forms/Form/utilities/formSubmit.utils.d.ts.map +1 -0
  41. package/dist/components/forms/Form/utilities/formSubmit.utils.js +21 -0
  42. package/dist/components/forms/Form/utilities/formSubmit.utils.js.map +1 -0
  43. package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.cjs +39 -0
  44. package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.cjs.map +1 -0
  45. package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.d.ts +17 -0
  46. package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.d.ts.map +1 -0
  47. package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.js +37 -0
  48. package/dist/components/forms/FormFooter/hooks/useDestructiveConfirmation.js.map +1 -0
  49. package/dist/components/forms/FormFooter/hooks/useHasFieldError.cjs +26 -0
  50. package/dist/components/forms/FormFooter/hooks/useHasFieldError.cjs.map +1 -0
  51. package/dist/components/forms/FormFooter/hooks/useHasFieldError.d.ts +9 -0
  52. package/dist/components/forms/FormFooter/hooks/useHasFieldError.d.ts.map +1 -0
  53. package/dist/components/forms/FormFooter/hooks/useHasFieldError.js +24 -0
  54. package/dist/components/forms/FormFooter/hooks/useHasFieldError.js.map +1 -0
  55. package/dist/components/forms/FormFooter/index.cjs +41 -0
  56. package/dist/components/forms/FormFooter/index.cjs.map +1 -0
  57. package/dist/components/forms/FormFooter/index.d.ts +56 -0
  58. package/dist/components/forms/FormFooter/index.d.ts.map +1 -0
  59. package/dist/components/forms/FormFooter/index.js +39 -0
  60. package/dist/components/forms/FormFooter/index.js.map +1 -0
  61. package/dist/components/forms/FormFooter/utilities/formFooter.utils.cjs +21 -0
  62. package/dist/components/forms/FormFooter/utilities/formFooter.utils.cjs.map +1 -0
  63. package/dist/components/forms/FormFooter/utilities/formFooter.utils.d.ts +12 -0
  64. package/dist/components/forms/FormFooter/utilities/formFooter.utils.d.ts.map +1 -0
  65. package/dist/components/forms/FormFooter/utilities/formFooter.utils.js +19 -0
  66. package/dist/components/forms/FormFooter/utilities/formFooter.utils.js.map +1 -0
  67. package/dist/components/forms/FormSaveErrorAlert/index.cjs +28 -0
  68. package/dist/components/forms/FormSaveErrorAlert/index.cjs.map +1 -0
  69. package/dist/components/forms/FormSaveErrorAlert/index.d.ts +18 -0
  70. package/dist/components/forms/FormSaveErrorAlert/index.d.ts.map +1 -0
  71. package/dist/components/forms/FormSaveErrorAlert/index.js +26 -0
  72. package/dist/components/forms/FormSaveErrorAlert/index.js.map +1 -0
  73. package/dist/components/forms/FormSection/FormSection.styles.cjs +15 -0
  74. package/dist/components/forms/FormSection/FormSection.styles.cjs.map +1 -0
  75. package/dist/components/forms/FormSection/FormSection.styles.d.ts +9 -0
  76. package/dist/components/forms/FormSection/FormSection.styles.d.ts.map +1 -0
  77. package/dist/components/forms/FormSection/FormSection.styles.js +13 -0
  78. package/dist/components/forms/FormSection/FormSection.styles.js.map +1 -0
  79. package/dist/components/forms/FormSection/index.cjs +43 -0
  80. package/dist/components/forms/FormSection/index.cjs.map +1 -0
  81. package/dist/components/forms/FormSection/index.d.ts +41 -0
  82. package/dist/components/forms/FormSection/index.d.ts.map +1 -0
  83. package/dist/components/forms/FormSection/index.js +41 -0
  84. package/dist/components/forms/FormSection/index.js.map +1 -0
  85. package/dist/components/forms/FormUnsavedChangesModal/index.cjs +24 -0
  86. package/dist/components/forms/FormUnsavedChangesModal/index.cjs.map +1 -0
  87. package/dist/components/forms/FormUnsavedChangesModal/index.d.ts +14 -0
  88. package/dist/components/forms/FormUnsavedChangesModal/index.d.ts.map +1 -0
  89. package/dist/components/forms/FormUnsavedChangesModal/index.js +22 -0
  90. package/dist/components/forms/FormUnsavedChangesModal/index.js.map +1 -0
  91. package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.cjs +28 -0
  92. package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.cjs.map +1 -0
  93. package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.d.ts +12 -0
  94. package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.d.ts.map +1 -0
  95. package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.js +26 -0
  96. package/dist/components/forms/__internal__/formField/hooks/useFocusTarget.js.map +1 -0
  97. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs +68 -0
  98. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs.map +1 -0
  99. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.d.ts +26 -0
  100. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.d.ts.map +1 -0
  101. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js +66 -0
  102. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js.map +1 -0
  103. package/dist/components/forms/__internal__/formField/hooks/useFormField.cjs +147 -0
  104. package/dist/components/forms/__internal__/formField/hooks/useFormField.cjs.map +1 -0
  105. package/dist/components/forms/__internal__/formField/hooks/useFormField.d.ts +35 -0
  106. package/dist/components/forms/__internal__/formField/hooks/useFormField.d.ts.map +1 -0
  107. package/dist/components/forms/__internal__/formField/hooks/useFormField.js +145 -0
  108. package/dist/components/forms/__internal__/formField/hooks/useFormField.js.map +1 -0
  109. package/dist/components/forms/__internal__/formField/providers/FieldElements.context.cjs +12 -0
  110. package/dist/components/forms/__internal__/formField/providers/FieldElements.context.cjs.map +1 -0
  111. package/dist/components/forms/__internal__/formField/providers/FieldElements.context.d.ts +7 -0
  112. package/dist/components/forms/__internal__/formField/providers/FieldElements.context.d.ts.map +1 -0
  113. package/dist/components/forms/__internal__/formField/providers/FieldElements.context.js +10 -0
  114. package/dist/components/forms/__internal__/formField/providers/FieldElements.context.js.map +1 -0
  115. package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.cjs +47 -0
  116. package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.cjs.map +1 -0
  117. package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.d.ts +26 -0
  118. package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.d.ts.map +1 -0
  119. package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.js +43 -0
  120. package/dist/components/forms/__internal__/formField/utilities/fieldDependents.utils.js.map +1 -0
  121. package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.cjs +39 -0
  122. package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.cjs.map +1 -0
  123. package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.d.ts +21 -0
  124. package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.d.ts.map +1 -0
  125. package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.js +37 -0
  126. package/dist/components/forms/__internal__/formField/utilities/fieldElements.utils.js.map +1 -0
  127. package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.cjs +40 -0
  128. package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.cjs.map +1 -0
  129. package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.d.ts +18 -0
  130. package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.d.ts.map +1 -0
  131. package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.js +37 -0
  132. package/dist/components/forms/__internal__/formField/utilities/fieldValue.utils.js.map +1 -0
  133. package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.cjs +21 -0
  134. package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.cjs.map +1 -0
  135. package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.d.ts +11 -0
  136. package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.d.ts.map +1 -0
  137. package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.js +19 -0
  138. package/dist/components/forms/__internal__/formField/utilities/formFocus.utils.js.map +1 -0
  139. package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.cjs +128 -0
  140. package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.cjs.map +1 -0
  141. package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.d.ts +72 -0
  142. package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.d.ts.map +1 -0
  143. package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.js +121 -0
  144. package/dist/components/forms/__internal__/formField/utilities/validationQueue.utils.js.map +1 -0
  145. package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.cjs +12 -0
  146. package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.cjs.map +1 -0
  147. package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.d.ts +6 -0
  148. package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.d.ts.map +1 -0
  149. package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.js +10 -0
  150. package/dist/components/forms/__internal__/formSubmit/providers/FormSubmit.context.js.map +1 -0
  151. package/dist/components/forms/fields/FormCheckbox/index.cjs +34 -0
  152. package/dist/components/forms/fields/FormCheckbox/index.cjs.map +1 -0
  153. package/dist/components/forms/fields/FormCheckbox/index.d.ts +19 -0
  154. package/dist/components/forms/fields/FormCheckbox/index.d.ts.map +1 -0
  155. package/dist/components/forms/fields/FormCheckbox/index.js +32 -0
  156. package/dist/components/forms/fields/FormCheckbox/index.js.map +1 -0
  157. package/dist/components/forms/fields/FormCheckboxGroup/index.cjs +33 -0
  158. package/dist/components/forms/fields/FormCheckboxGroup/index.cjs.map +1 -0
  159. package/dist/components/forms/fields/FormCheckboxGroup/index.d.ts +19 -0
  160. package/dist/components/forms/fields/FormCheckboxGroup/index.d.ts.map +1 -0
  161. package/dist/components/forms/fields/FormCheckboxGroup/index.js +31 -0
  162. package/dist/components/forms/fields/FormCheckboxGroup/index.js.map +1 -0
  163. package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.cjs +26 -0
  164. package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.cjs.map +1 -0
  165. package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.d.ts +11 -0
  166. package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.d.ts.map +1 -0
  167. package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.js +24 -0
  168. package/dist/components/forms/fields/FormColorPicker/hooks/useEmptyFieldValue.js.map +1 -0
  169. package/dist/components/forms/fields/FormColorPicker/index.cjs +33 -0
  170. package/dist/components/forms/fields/FormColorPicker/index.cjs.map +1 -0
  171. package/dist/components/forms/fields/FormColorPicker/index.d.ts +24 -0
  172. package/dist/components/forms/fields/FormColorPicker/index.d.ts.map +1 -0
  173. package/dist/components/forms/fields/FormColorPicker/index.js +31 -0
  174. package/dist/components/forms/fields/FormColorPicker/index.js.map +1 -0
  175. package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.cjs +20 -0
  176. package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.cjs.map +1 -0
  177. package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.d.ts +17 -0
  178. package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.d.ts.map +1 -0
  179. package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.js +18 -0
  180. package/dist/components/forms/fields/FormColorPicker/utilities/formColorPicker.utils.js.map +1 -0
  181. package/dist/components/forms/fields/FormDatePicker/index.cjs +35 -0
  182. package/dist/components/forms/fields/FormDatePicker/index.cjs.map +1 -0
  183. package/dist/components/forms/fields/FormDatePicker/index.d.ts +20 -0
  184. package/dist/components/forms/fields/FormDatePicker/index.d.ts.map +1 -0
  185. package/dist/components/forms/fields/FormDatePicker/index.js +33 -0
  186. package/dist/components/forms/fields/FormDatePicker/index.js.map +1 -0
  187. package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.cjs +23 -0
  188. package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.cjs.map +1 -0
  189. package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.d.ts +9 -0
  190. package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.d.ts.map +1 -0
  191. package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.js +21 -0
  192. package/dist/components/forms/fields/FormDatePicker/utilities/formDatePicker.utils.js.map +1 -0
  193. package/dist/components/forms/fields/FormInput/index.cjs +27 -0
  194. package/dist/components/forms/fields/FormInput/index.cjs.map +1 -0
  195. package/dist/components/forms/fields/FormInput/index.d.ts +19 -0
  196. package/dist/components/forms/fields/FormInput/index.d.ts.map +1 -0
  197. package/dist/components/forms/fields/FormInput/index.js +25 -0
  198. package/dist/components/forms/fields/FormInput/index.js.map +1 -0
  199. package/dist/components/forms/fields/FormMultiSelect/index.cjs +44 -0
  200. package/dist/components/forms/fields/FormMultiSelect/index.cjs.map +1 -0
  201. package/dist/components/forms/fields/FormMultiSelect/index.d.ts +20 -0
  202. package/dist/components/forms/fields/FormMultiSelect/index.d.ts.map +1 -0
  203. package/dist/components/forms/fields/FormMultiSelect/index.js +42 -0
  204. package/dist/components/forms/fields/FormMultiSelect/index.js.map +1 -0
  205. package/dist/components/forms/fields/FormRadioCardGroup/index.cjs +36 -0
  206. package/dist/components/forms/fields/FormRadioCardGroup/index.cjs.map +1 -0
  207. package/dist/components/forms/fields/FormRadioCardGroup/index.d.ts +32 -0
  208. package/dist/components/forms/fields/FormRadioCardGroup/index.d.ts.map +1 -0
  209. package/dist/components/forms/fields/FormRadioCardGroup/index.js +34 -0
  210. package/dist/components/forms/fields/FormRadioCardGroup/index.js.map +1 -0
  211. package/dist/components/forms/fields/FormRadioGroup/index.cjs +31 -0
  212. package/dist/components/forms/fields/FormRadioGroup/index.cjs.map +1 -0
  213. package/dist/components/forms/fields/FormRadioGroup/index.d.ts +20 -0
  214. package/dist/components/forms/fields/FormRadioGroup/index.d.ts.map +1 -0
  215. package/dist/components/forms/fields/FormRadioGroup/index.js +29 -0
  216. package/dist/components/forms/fields/FormRadioGroup/index.js.map +1 -0
  217. package/dist/components/forms/fields/FormSelect/index.cjs +30 -0
  218. package/dist/components/forms/fields/FormSelect/index.cjs.map +1 -0
  219. package/dist/components/forms/fields/FormSelect/index.d.ts +19 -0
  220. package/dist/components/forms/fields/FormSelect/index.d.ts.map +1 -0
  221. package/dist/components/forms/fields/FormSelect/index.js +28 -0
  222. package/dist/components/forms/fields/FormSelect/index.js.map +1 -0
  223. package/dist/components/forms/fields/FormSlider/index.cjs +43 -0
  224. package/dist/components/forms/fields/FormSlider/index.cjs.map +1 -0
  225. package/dist/components/forms/fields/FormSlider/index.d.ts +20 -0
  226. package/dist/components/forms/fields/FormSlider/index.d.ts.map +1 -0
  227. package/dist/components/forms/fields/FormSlider/index.js +41 -0
  228. package/dist/components/forms/fields/FormSlider/index.js.map +1 -0
  229. package/dist/components/forms/fields/FormTextArea/index.cjs +27 -0
  230. package/dist/components/forms/fields/FormTextArea/index.cjs.map +1 -0
  231. package/dist/components/forms/fields/FormTextArea/index.d.ts +19 -0
  232. package/dist/components/forms/fields/FormTextArea/index.d.ts.map +1 -0
  233. package/dist/components/forms/fields/FormTextArea/index.js +25 -0
  234. package/dist/components/forms/fields/FormTextArea/index.js.map +1 -0
  235. package/dist/components/forms/fields/FormToggle/index.cjs +32 -0
  236. package/dist/components/forms/fields/FormToggle/index.cjs.map +1 -0
  237. package/dist/components/forms/fields/FormToggle/index.d.ts +19 -0
  238. package/dist/components/forms/fields/FormToggle/index.d.ts.map +1 -0
  239. package/dist/components/forms/fields/FormToggle/index.js +30 -0
  240. package/dist/components/forms/fields/FormToggle/index.js.map +1 -0
  241. package/dist/components/forms/validation/hooks/useSchemaResolver.cjs +44 -0
  242. package/dist/components/forms/validation/hooks/useSchemaResolver.cjs.map +1 -0
  243. package/dist/components/forms/validation/hooks/useSchemaResolver.d.ts +16 -0
  244. package/dist/components/forms/validation/hooks/useSchemaResolver.d.ts.map +1 -0
  245. package/dist/components/forms/validation/hooks/useSchemaResolver.js +42 -0
  246. package/dist/components/forms/validation/hooks/useSchemaResolver.js.map +1 -0
  247. package/dist/components/forms/validation/index.cjs +413 -0
  248. package/dist/components/forms/validation/index.cjs.map +1 -0
  249. package/dist/components/forms/validation/index.d.ts +278 -0
  250. package/dist/components/forms/validation/index.d.ts.map +1 -0
  251. package/dist/components/forms/validation/index.js +394 -0
  252. package/dist/components/forms/validation/index.js.map +1 -0
  253. package/dist/components/forms/validation/utilities/validation.utils.cjs +72 -0
  254. package/dist/components/forms/validation/utilities/validation.utils.cjs.map +1 -0
  255. package/dist/components/forms/validation/utilities/validation.utils.d.ts +38 -0
  256. package/dist/components/forms/validation/utilities/validation.utils.d.ts.map +1 -0
  257. package/dist/components/forms/validation/utilities/validation.utils.js +67 -0
  258. package/dist/components/forms/validation/utilities/validation.utils.js.map +1 -0
  259. package/dist/components/forms/validation/validation.types.d.ts +8 -0
  260. package/dist/components/forms/validation/validation.types.d.ts.map +1 -0
  261. package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs +13 -3
  262. package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs.map +1 -1
  263. package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts +1 -1
  264. package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts.map +1 -1
  265. package/dist/components/organisms/ColorPicker/components/ColorPickerField.js +13 -3
  266. package/dist/components/organisms/ColorPicker/components/ColorPickerField.js.map +1 -1
  267. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.cjs +2 -2
  268. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.cjs.map +1 -1
  269. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.d.ts +1 -0
  270. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.d.ts.map +1 -1
  271. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.js +2 -2
  272. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.js.map +1 -1
  273. package/dist/components/organisms/ColorPicker/hooks/useCssColorField.cjs +1 -1
  274. package/dist/components/organisms/ColorPicker/hooks/useCssColorField.js +1 -1
  275. package/dist/components/organisms/ColorPicker/index.cjs +1 -1
  276. package/dist/components/organisms/ColorPicker/index.d.ts.map +1 -1
  277. package/dist/components/organisms/ColorPicker/index.js +1 -1
  278. package/dist/components/organisms/ColorPicker/providers/ColorPicker.provider.d.ts +1 -1
  279. package/dist/components/organisms/ColorPicker/providers/ColorPicker.provider.d.ts.map +1 -1
  280. package/dist/components/organisms/ColorPicker/utilities/colorPicker.utils.cjs.map +1 -0
  281. package/dist/components/organisms/ColorPicker/utilities/colorPicker.utils.d.ts.map +1 -0
  282. package/dist/components/organisms/ColorPicker/utilities/colorPicker.utils.js.map +1 -0
  283. package/dist/components/organisms/GradientPicker/components/GradientStopRow.cjs +1 -1
  284. package/dist/components/organisms/GradientPicker/components/GradientStopRow.js +1 -1
  285. package/dist/hooks/useFocusAfterRetry/index.cjs +7 -3
  286. package/dist/hooks/useFocusAfterRetry/index.cjs.map +1 -1
  287. package/dist/hooks/useFocusAfterRetry/index.d.ts +8 -2
  288. package/dist/hooks/useFocusAfterRetry/index.d.ts.map +1 -1
  289. package/dist/hooks/useFocusAfterRetry/index.js +7 -3
  290. package/dist/hooks/useFocusAfterRetry/index.js.map +1 -1
  291. package/dist/localization/en.json.cjs +117 -0
  292. package/dist/localization/en.json.cjs.map +1 -0
  293. package/dist/localization/en.json.js +98 -0
  294. package/dist/localization/en.json.js.map +1 -0
  295. package/dist/native/components/forms/Form/index.d.ts +12 -0
  296. package/dist/native/components/forms/FormFooter/index.d.ts +12 -0
  297. package/dist/native/components/forms/FormSaveErrorAlert/index.d.ts +12 -0
  298. package/dist/native/components/forms/FormSection/index.d.ts +12 -0
  299. package/dist/native/components/forms/FormUnsavedChangesModal/index.d.ts +12 -0
  300. package/dist/native/components/forms/fields/FormCheckbox/index.d.ts +12 -0
  301. package/dist/native/components/forms/fields/FormCheckboxGroup/index.d.ts +12 -0
  302. package/dist/native/components/forms/fields/FormColorPicker/index.d.ts +12 -0
  303. package/dist/native/components/forms/fields/FormDatePicker/index.d.ts +12 -0
  304. package/dist/native/components/forms/fields/FormInput/index.d.ts +12 -0
  305. package/dist/native/components/forms/fields/FormMultiSelect/index.d.ts +12 -0
  306. package/dist/native/components/forms/fields/FormRadioCardGroup/index.d.ts +12 -0
  307. package/dist/native/components/forms/fields/FormRadioGroup/index.d.ts +12 -0
  308. package/dist/native/components/forms/fields/FormSelect/index.d.ts +12 -0
  309. package/dist/native/components/forms/fields/FormSlider/index.d.ts +12 -0
  310. package/dist/native/components/forms/fields/FormTextArea/index.d.ts +12 -0
  311. package/dist/native/components/forms/fields/FormToggle/index.d.ts +12 -0
  312. package/dist/native/components/forms/validation/index.d.ts +12 -0
  313. package/dist/native/utilities/colorUtils/index.d.ts +12 -0
  314. package/dist/providers/UnsavedChangesGuardProvider/index.cjs +1 -1
  315. package/dist/providers/UnsavedChangesGuardProvider/index.js +1 -1
  316. package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.cjs.map +1 -0
  317. package/dist/providers/UnsavedChangesGuardProvider/{unsavedChangesGuard.utils.d.ts → utilities/unsavedChangesGuard.utils.d.ts} +1 -1
  318. package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.d.ts.map +1 -0
  319. package/dist/providers/UnsavedChangesGuardProvider/utilities/unsavedChangesGuard.utils.js.map +1 -0
  320. package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.cjs +74 -0
  321. package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.cjs.map +1 -0
  322. package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.d.ts +51 -0
  323. package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.d.ts.map +1 -0
  324. package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.js +68 -0
  325. package/dist/utilities/__internal__/builtInTextUtils/builtInText.utils.js.map +1 -0
  326. package/dist/utilities/colorUtils/index.cjs +24 -0
  327. package/dist/utilities/colorUtils/index.cjs.map +1 -0
  328. package/dist/utilities/colorUtils/index.d.ts +8 -0
  329. package/dist/utilities/colorUtils/index.d.ts.map +1 -0
  330. package/dist/utilities/colorUtils/index.js +22 -0
  331. package/dist/utilities/colorUtils/index.js.map +1 -0
  332. package/package.json +41 -6
  333. package/dist/components/organisms/ColorPicker/colorPicker.utils.cjs.map +0 -1
  334. package/dist/components/organisms/ColorPicker/colorPicker.utils.d.ts.map +0 -1
  335. package/dist/components/organisms/ColorPicker/colorPicker.utils.js.map +0 -1
  336. package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.cjs.map +0 -1
  337. package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.d.ts.map +0 -1
  338. package/dist/providers/UnsavedChangesGuardProvider/unsavedChangesGuard.utils.js.map +0 -1
  339. /package/dist/components/organisms/ColorPicker/{colorPicker.utils.cjs → utilities/colorPicker.utils.cjs} +0 -0
  340. /package/dist/components/organisms/ColorPicker/{colorPicker.utils.d.ts → utilities/colorPicker.utils.d.ts} +0 -0
  341. /package/dist/components/organisms/ColorPicker/{colorPicker.utils.js → utilities/colorPicker.utils.js} +0 -0
  342. /package/dist/providers/UnsavedChangesGuardProvider/{unsavedChangesGuard.utils.cjs → utilities/unsavedChangesGuard.utils.cjs} +0 -0
  343. /package/dist/providers/UnsavedChangesGuardProvider/{unsavedChangesGuard.utils.js → utilities/unsavedChangesGuard.utils.js} +0 -0
package/README.md CHANGED
@@ -73,6 +73,7 @@ A handful of components are backed by larger third-party libraries declared as *
73
73
  | `VerificationCodeInput` | `input-otp` |
74
74
  | `CommandMenu` | `react-hotkeys-hook` |
75
75
  | `FileUpload`, `SidebarNavigation` | `motion` |
76
+ | `forms/*` (except `FormSection`) | `react-hook-form`; `forms/validation` needs `zod` and `@hookform/resolvers` as well |
76
77
 
77
78
  ## Tailwind setup
78
79
 
@@ -81,11 +82,11 @@ Import the library's shared runtime from your CSS entry **in this exact layer or
81
82
  ```css
82
83
  @layer theme, base, components, utilities;
83
84
 
84
- @import "tailwindcss/theme.css" layer(theme);
85
- @import "@flipdish/ui-tokens/css" layer(theme);
86
- @import "tailwindcss/preflight.css" layer(base);
87
- @import "@flipdish/ui-library/styles";
88
- @import "tailwindcss/utilities.css" layer(utilities);
85
+ @import 'tailwindcss/theme.css' layer(theme);
86
+ @import '@flipdish/ui-tokens/css' layer(theme);
87
+ @import 'tailwindcss/preflight.css' layer(base);
88
+ @import '@flipdish/ui-library/styles';
89
+ @import 'tailwindcss/utilities.css' layer(utilities);
89
90
  ```
90
91
 
91
92
  ## React Native
@@ -110,7 +111,7 @@ Import paths are identical across platforms — Metro picks the native build via
110
111
 
111
112
  ```tsx
112
113
  // Resolves to the web build under Vite/webpack, the native build under Metro.
113
- import { Avatar } from "@flipdish/ui-library/components/atoms/Avatar";
114
+ import { Avatar } from '@flipdish/ui-library/components/atoms/Avatar';
114
115
  ```
115
116
 
116
117
  > `react-native >= 0.81` is load-bearing, not just a version floor. Every public subpath of
@@ -128,15 +129,15 @@ In your app's `global.css` — the file you import from your root component and
128
129
  [`withNativewind`](https://www.nativewind.dev/v5/api/with-nativewind) at in `metro.config.js`:
129
130
 
130
131
  ```css
131
- @import "tailwindcss/theme.css" layer(theme);
132
- @import "@flipdish/ui-tokens/css" layer(theme);
133
- @import "tailwindcss/preflight.css" layer(base);
132
+ @import 'tailwindcss/theme.css' layer(theme);
133
+ @import '@flipdish/ui-tokens/css' layer(theme);
134
+ @import 'tailwindcss/preflight.css' layer(base);
134
135
 
135
136
  /* NativeWind's own theme variables — required by its Metro transformer. */
136
- @import "nativewind/theme";
137
+ @import 'nativewind/theme';
137
138
 
138
- @import "@flipdish/ui-library/styles.native";
139
- @import "tailwindcss/utilities.css";
139
+ @import '@flipdish/ui-library/styles.native';
140
+ @import 'tailwindcss/utilities.css';
140
141
  ```
141
142
 
142
143
  `styles.native` contributes exactly one thing: `@source "./native"`, which tells Tailwind to
@@ -199,8 +200,8 @@ Then add it to your PostCSS config:
199
200
 
200
201
  ```js
201
202
  // postcss.config.mjs
202
- import prefixSelector from "postcss-prefix-selector";
203
- import { createScopedPrefixTransform } from "@flipdish/ui-library/utilities/cssScopeUtils";
203
+ import prefixSelector from 'postcss-prefix-selector';
204
+ import { createScopedPrefixTransform } from '@flipdish/ui-library/utilities/cssScopeUtils';
204
205
 
205
206
  // Your Portal microFrontendWindowName; must match <UIProvider scopeId="sale-service">.
206
207
  const SCOPE = '[data-mfe-scope="sale-service"]';
@@ -228,8 +229,8 @@ Tailwind's output becomes plain `[data-mfe-scope="sale-service"] .px-4 { … }`,
228
229
  | `matchRootElement` | `boolean` | `true` | Also emit a compound selector so the scope root itself matches class and attribute selectors; `[data-theme="dark"]` on the themed root needs it. |
229
230
 
230
231
  ```js
231
- createScopedPrefixTransform("[data-tailwind]", {
232
- shouldScope: (file) => !file || !file.includes("node_modules"),
232
+ createScopedPrefixTransform('[data-tailwind]', {
233
+ shouldScope: (file) => !file || !file.includes('node_modules'),
233
234
  scopeBody: true,
234
235
  });
235
236
  ```
@@ -33,7 +33,9 @@ const Checkbox = ({ label, hint, size = 'sm', className, 'data-testid': dataTest
33
33
  const isReadOnly = (isStandaloneInGroup && groupState?.isReadOnly) || ariaCheckboxProps.isReadOnly;
34
34
  const isGroupOption = !dataTestId && group && value !== undefined;
35
35
  const checkboxTestId = isGroupOption ? testIdUtils.joinTestId(group.testIdPrefix, `option-${testIdUtils.slugifyTestId(value)}`) : fallbackTestId;
36
- const checkbox = (jsxRuntime.jsx(reactAriaComponents.Checkbox, { ...ariaCheckboxProps, isDisabled: isDisabled, isReadOnly: isReadOnly, "data-testid": checkboxTestId, className: (state) => cx.cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', selectionControl_styles.selectionControlSizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isIndeterminate, isDisabled, isFocusVisible }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CheckboxBase, { size: size, isSelected: isSelected, isIndeterminate: isIndeterminate, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxRuntime.jsxs("div", { className: cx.cx('inline-flex flex-col', selectionControl_styles.selectionControlSizes[size].textWrapper), children: [label && jsxRuntime.jsx("p", { className: cx.cx('text-secondary select-none', selectionControl_styles.selectionControlSizes[size].label), children: label }), hint && (
36
+ const checkbox = (jsxRuntime.jsx(reactAriaComponents.Checkbox, { ...ariaCheckboxProps,
37
+ // Each box resolves this by itself and would fall back to the browser's own check, whatever its group asked for (react-aria-components 1.19).
38
+ validationBehavior: ariaCheckboxProps.validationBehavior ?? group?.validationBehavior, isDisabled: isDisabled, isReadOnly: isReadOnly, "data-testid": checkboxTestId, className: (state) => cx.cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', selectionControl_styles.selectionControlSizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isIndeterminate, isDisabled, isFocusVisible }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CheckboxBase, { size: size, isSelected: isSelected, isIndeterminate: isIndeterminate, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxRuntime.jsxs("div", { className: cx.cx('inline-flex flex-col', selectionControl_styles.selectionControlSizes[size].textWrapper), children: [label && jsxRuntime.jsx("p", { className: cx.cx('text-secondary select-none', selectionControl_styles.selectionControlSizes[size].label), children: label }), hint && (
37
39
  // biome-ignore lint/a11y/noStaticElementInteractions: not independently interactive — only stops the click reaching outer React handlers, see below
38
40
  // biome-ignore lint/a11y/useKeyWithClickEvents: same as above, no keyboard equivalent needed
39
41
  jsxRuntime.jsx("span", { className: cx.cx('text-tertiary', selectionControl_styles.selectionControlSizes[size].hint), onClick: (event) => {
@@ -57,7 +59,7 @@ Checkbox.displayName = 'Checkbox';
57
59
  /** Wrapper around react-aria-components' `CheckboxGroup` that names a set of `Checkbox` children, holds their ticked values as a list, and shows one hint or error for the set. */
58
60
  const CheckboxGroup = ({ children, label, hint, size = 'sm', className, 'data-testid': dataTestId, ...props }) => {
59
61
  const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'checkbox-group', rootName: 'checkbox-group' });
60
- return (jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: { size, testIdPrefix: rootTestId }, children: jsxRuntime.jsx(reactAriaComponents.CheckboxGroup, { ...props, "data-testid": rootTestId, className: cx.cx('flex flex-col gap-3', className), children: ({ isInvalid, isRequired }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [label && (jsxRuntime.jsx(Input.Label, { isRequired: isRequired, isInvalid: isInvalid, children: label })), children, hint && jsxRuntime.jsx(Input.HintText, { isInvalid: isInvalid, children: hint })] })) }) }));
62
+ return (jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: { size, testIdPrefix: rootTestId, validationBehavior: props.validationBehavior }, children: jsxRuntime.jsx(reactAriaComponents.CheckboxGroup, { ...props, "data-testid": rootTestId, className: cx.cx('flex flex-col gap-3', className), children: ({ isInvalid, isRequired }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [label && (jsxRuntime.jsx(Input.Label, { isRequired: isRequired, isInvalid: isInvalid, children: label })), children, hint && jsxRuntime.jsx(Input.HintText, { isInvalid: isInvalid, children: hint })] })) }) }));
61
63
  };
62
64
  CheckboxGroup.displayName = 'CheckboxGroup';
63
65
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Checkbox/index.tsx"],"sourcesContent":[null],"names":["createContext","_jsxs","cx","_jsx","useContext","CheckboxGroupStateContext","useResolvedTestId","joinTestId","slugifyTestId","AriaCheckbox","selectionControlSizes","_Fragment","AriaCheckboxGroup","Label","HintText"],"mappings":";;;;;;;;;;AAoBA,MAAM,oBAAoB,GAAGA,mBAAa,CAAkC,IAAI,CAAC;AAiBjF;MACa,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,GAAG,IAAI,EAAE,cAAc,GAAG,KAAK,EAAqB,KAAI;AAC7I,IAAA,QACEC,eAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEC,KAAE,CACX,4IAA4I,EAC5I,IAAI,KAAK,IAAI,IAAI,mBAAmB,EACpC,CAAC,UAAU,IAAI,eAAe,KAAK,iCAAiC,EACpE,UAAU,IAAI,+BAA+B,EAC7C,UAAU,IAAI,EAAE,UAAU,IAAI,eAAe,CAAC,IAAI,aAAa,EAC/D,cAAc,IAAI,+CAA+C,EACjE,SAAS,CACV,EAAA,QAAA,EAAA,CAEDC,cAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS,EAAED,KAAE,CACX,uFAAuF,EACvF,IAAI,KAAK,IAAI,IAAI,UAAU,EAC3B,eAAe,IAAI,aAAa,CACjC,EAAA,QAAA,EAEDC,yBAAM,CAAC,EAAC,oBAAoB,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EA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AAA,CAAAU,mBAAA,EAAA,EAAA,QAAA,EAAA,CACG,KAAK,KACJR,eAACU,WAAK,EAAA,EAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAA,QAAA,EAChD,KAAK,EAAA,CACA,CACT,EACA,QAAQ,EAER,IAAI,IAAIV,cAAA,CAACW,cAAQ,IAAC,SAAS,EAAE,SAAS,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,CAAA,EAAA,CACzD,CACJ,EAAA,CACiB,EAAA,CACU;AAEpC;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Checkbox/index.tsx"],"sourcesContent":[null],"names":["createContext","_jsxs","cx","_jsx","useContext","CheckboxGroupStateContext","useResolvedTestId","joinTestId","slugifyTestId","AriaCheckbox","selectionControlSizes","_Fragment","AriaCheckboxGroup","Label","HintText"],"mappings":";;;;;;;;;;AAqBA,MAAM,oBAAoB,GAAGA,mBAAa,CAAkC,IAAI,CAAC;AAiBjF;MACa,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,GAAG,IAAI,EAAE,cAAc,GAAG,KAAK,EAAqB,KAAI;AAC7I,IAAA,QACEC,eAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEC,KAAE,CACX,4IAA4I,EAC5I,IAAI,KAAK,IAAI,IAAI,mBAAmB,EACpC,CAAC,UAAU,IAAI,eAAe,KAAK,iCAAiC,EACpE,UAAU,IAAI,+BAA+B,EAC7C,UAAU,IAAI,EAAE,UAAU,IAAI,eAAe,CAAC,IAAI,aAAa,EAC/D,cAAc,IAAI,+CAA+C,EACjE,SAAS,CACV,EAAA,QAAA,EAAA,CAEDC,cAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS,EAAED,KAAE,CACX,u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DAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4HAA4H;IAC5H,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,mLAAmL;AACnL,eAAO,MAAM,aAAa;sFAA4F,kBAAkB;;CAqBvI,CAAC"}
@@ -31,7 +31,9 @@ const Checkbox = ({ label, hint, size = 'sm', className, 'data-testid': dataTest
31
31
  const isReadOnly = (isStandaloneInGroup && groupState?.isReadOnly) || ariaCheckboxProps.isReadOnly;
32
32
  const isGroupOption = !dataTestId && group && value !== undefined;
33
33
  const checkboxTestId = isGroupOption ? joinTestId(group.testIdPrefix, `option-${slugifyTestId(value)}`) : fallbackTestId;
34
- const checkbox = (jsx(Checkbox$1, { ...ariaCheckboxProps, isDisabled: isDisabled, isReadOnly: isReadOnly, "data-testid": checkboxTestId, className: (state) => cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', selectionControlSizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isIndeterminate, isDisabled, isFocusVisible }) => (jsxs(Fragment, { children: [jsx(CheckboxBase, { size: size, isSelected: isSelected, isIndeterminate: isIndeterminate, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxs("div", { className: cx('inline-flex flex-col', selectionControlSizes[size].textWrapper), children: [label && jsx("p", { className: cx('text-secondary select-none', selectionControlSizes[size].label), children: label }), hint && (
34
+ const checkbox = (jsx(Checkbox$1, { ...ariaCheckboxProps,
35
+ // Each box resolves this by itself and would fall back to the browser's own check, whatever its group asked for (react-aria-components 1.19).
36
+ validationBehavior: ariaCheckboxProps.validationBehavior ?? group?.validationBehavior, isDisabled: isDisabled, isReadOnly: isReadOnly, "data-testid": checkboxTestId, className: (state) => cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', selectionControlSizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isIndeterminate, isDisabled, isFocusVisible }) => (jsxs(Fragment, { children: [jsx(CheckboxBase, { size: size, isSelected: isSelected, isIndeterminate: isIndeterminate, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxs("div", { className: cx('inline-flex flex-col', selectionControlSizes[size].textWrapper), children: [label && jsx("p", { className: cx('text-secondary select-none', selectionControlSizes[size].label), children: label }), hint && (
35
37
  // biome-ignore lint/a11y/noStaticElementInteractions: not independently interactive — only stops the click reaching outer React handlers, see below
36
38
  // biome-ignore lint/a11y/useKeyWithClickEvents: same as above, no keyboard equivalent needed
37
39
  jsx("span", { className: cx('text-tertiary', selectionControlSizes[size].hint), onClick: (event) => {
@@ -55,7 +57,7 @@ Checkbox.displayName = 'Checkbox';
55
57
  /** Wrapper around react-aria-components' `CheckboxGroup` that names a set of `Checkbox` children, holds their ticked values as a list, and shows one hint or error for the set. */
56
58
  const CheckboxGroup = ({ children, label, hint, size = 'sm', className, 'data-testid': dataTestId, ...props }) => {
57
59
  const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'checkbox-group', rootName: 'checkbox-group' });
58
- return (jsx(CheckboxGroupContext.Provider, { value: { size, testIdPrefix: rootTestId }, children: jsx(CheckboxGroup$1, { ...props, "data-testid": rootTestId, className: cx('flex flex-col gap-3', className), children: ({ isInvalid, isRequired }) => (jsxs(Fragment, { children: [label && (jsx(Label, { isRequired: isRequired, isInvalid: isInvalid, children: label })), children, hint && jsx(HintText, { isInvalid: isInvalid, children: hint })] })) }) }));
60
+ return (jsx(CheckboxGroupContext.Provider, { value: { size, testIdPrefix: rootTestId, validationBehavior: props.validationBehavior }, children: jsx(CheckboxGroup$1, { ...props, "data-testid": rootTestId, className: cx('flex flex-col gap-3', className), children: ({ isInvalid, isRequired }) => (jsxs(Fragment, { children: [label && (jsx(Label, { isRequired: isRequired, isInvalid: isInvalid, children: label })), children, hint && jsx(HintText, { isInvalid: isInvalid, children: hint })] })) }) }));
59
61
  };
60
62
  CheckboxGroup.displayName = 'CheckboxGroup';
61
63
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Checkbox/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaCheckbox","_Fragment","AriaCheckboxGroup"],"mappings":";;;;;;;;AAoBA,MAAM,oBAAoB,GAAG,aAAa,CAAkC,IAAI,CAAC;AAiBjF;MACa,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,GAAG,IAAI,EAAE,cAAc,GAAG,KAAK,EAAqB,KAAI;AAC7I,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,4IAA4I,EAC5I,IAAI,KAAK,IAAI,IAAI,mBAAmB,EACpC,CAAC,UAAU,IAAI,eAAe,KAAK,iCAAiC,EACpE,UAAU,IAAI,+BAA+B,EAC7C,UAAU,IAAI,EAAE,UAAU,IAAI,eAAe,CAAC,IAAI,aAAa,EAC/D,cAAc,IAAI,+CAA+C,EACjE,SAAS,CACV,EAAA,QAAA,EAAA,CAEDC,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,EAAE,CACX,uFAAuF,EACvF,IAAI,KAAK,IAAI,IAAI,UAAU,EAC3B,eAAe,IAAI,aAAa,CACjC,EAAA,QAAA,EAEDA,cAAM,CAAC,EAAC,oBAAoB,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAA,CAAG,EAAA,CAC9G,EAENA,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,EAAE,CACX,oFAAoF,EACpF,IAAI,KAAK,IAAI,IAAI,UAAU,EAC3B,UAAU,IAAI,CAAC,eAA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AA,CAAY,CAAA,EAAA,CACzD,CACJ,EAAA,CACiB,EAAA,CACU;AAEpC;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Checkbox/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaCheckbox","_Fragment","AriaCheckboxGroup"],"mappings":";;;;;;;;AAqBA,MAAM,oBAAoB,GAAG,aAAa,CAAkC,IAAI,CAAC;AAiBjF;MACa,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,GAAG,IAAI,EAAE,cAAc,GAAG,KAAK,EAAqB,KAAI;AAC7I,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,4IAA4I,EAC5I,IAAI,KAAK,IAAI,IAAI,mBAAmB,EACpC,CAAC,UAAU,IAAI,eAAe,KAAK,iCAAiC,EACpE,UAAU,IAAI,+BAA+B,EAC7C,UAAU,IAAI,EAAE,UAAU,IAAI,eAAe,CAAC,IAAI,aAAa,EAC/D,cAAc,IAAI,+CAA+C,EACjE,SAAS,CACV,EAAA,QAAA,EAAA,CAEDC,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,EAAE,CACX,uFAAuF,EACvF,IAAI,KAAK,IAAI,IAAI,UAAU,EAC3B,eAAe,IAAI,aAAa,CACjC,EAAA,QAAA,EAEDA,cAAM,CAAC,EAAC,oBAAoB,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAA,CAAG,EAAA,CAC9G,EAENA,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS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G,KAAK,KACJF,GAAA,CAAC,KAAK,EAAA,EAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAA,QAAA,EAChD,KAAK,EAAA,CACA,CACT,EACA,QAAQ,EAER,IAAI,IAAIA,GAAA,CAAC,QAAQ,EAAA,EAAC,SAAS,EAAE,SAAS,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,CAAA,EAAA,CACzD,CACJ,EAAA,CACiB,EAAA,CACU;AAEpC;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
@@ -19,7 +19,7 @@ const styles = cx.sortCx({
19
19
  *
20
20
  * @summary draggable range input for selecting a numeric value
21
21
  */
22
- const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label, hint, labelFormatter, formatOptions, className, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...rest }) => {
22
+ const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label, hint, labelFormatter, isInvalid, formatOptions, className, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...rest }) => {
23
23
  // Format thumb value as percentage by default.
24
24
  const defaultFormatOptions = {
25
25
  style: 'percent',
@@ -38,7 +38,7 @@ const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label
38
38
  } }), values.map((_, index) => {
39
39
  return (jsxRuntime.jsx(reactAriaComponents.SliderThumb
40
40
  // biome-ignore lint/suspicious/noArrayIndexKey: static, ordered list of thumbs
41
- , { index: index, "data-testid": testIdUtils.joinTestId(sliderTestId, `thumb-${index}`), className: ({ isFocusVisible, isDragging }) => cx.cx('top-1/2 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', isDragging && 'cursor-grabbing'), children: jsxRuntime.jsx(reactAriaComponents.SliderOutput, { className: cx.cx('whitespace-nowrap', styles[labelPosition]), "data-testid": testIdUtils.joinTestId(sliderTestId, `output-${index}`), children: labelFormatter ? labelFormatter(getThumbValue(index)) : getFormattedValue(getThumbValue(index) / 100) }) }, index));
41
+ , { index: index, isInvalid: isInvalid, "data-testid": testIdUtils.joinTestId(sliderTestId, `thumb-${index}`), className: ({ isFocusVisible, isDragging }) => cx.cx('top-1/2 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', isDragging && 'cursor-grabbing'), children: jsxRuntime.jsx(reactAriaComponents.SliderOutput, { className: cx.cx('whitespace-nowrap', styles[labelPosition]), "data-testid": testIdUtils.joinTestId(sliderTestId, `output-${index}`), children: labelFormatter ? labelFormatter(getThumbValue(index)) : getFormattedValue(getThumbValue(index) / 100) }) }, index));
42
42
  })] }));
43
43
  } }), hint ? jsxRuntime.jsx(Input.HintText, { id: hintId, children: hint }) : null] }));
44
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Slider/index.tsx"],"sourcesContent":[null],"names":["sortCx","useResolvedTestId","useId","joinIds","_jsxs","AriaSlider","cx","_jsx","Label","AriaSliderTrack","joinTestId","_Fragment","AriaSliderThumb","AriaSliderOutput","HintText"],"mappings":";;;;;;;;;;AAeA,MAAM,MAAM,GAAGA,SAAM,CAAC;AACpB,IAAA,OAAO,EAAE,QAAQ;AACjB,IAAA,MAAM,EAAE,4FAA4F;AACpG,IAAA,cAAc,EACZ,wKAAwK;AAC3K,CAAA,CAAC;AAeF;;;;;AAKG;AACI,MAAM,MAAM,GAAG,CAAC,EACrB,aAAa,GAAG,SAAS,EACzB,QAAQ,GAAG,CAAC,EACZ,QAAQ,GAAG,GAAG,EACd,KAAK,EACL,IAAI,EACJ,cAAc,EACd,aAAa,EACb,SAAS,EACT,kBAAkB,EAAE,eAAe,EACnC,aAAa,EAAE,UAAU,EACzB,GAAG,IAAI,EACK,KAAI;;AAEhB,IAAA,MAAM,oBAAoB,GAA6B;AACrD,QAAA,KAAK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,CAAY,GAAG,IAAI,CAAA,EAAA,CAC3C;AAEjB;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Slider/index.tsx"],"sourcesContent":[null],"names":["sortCx","useResolvedTestId","useId","joinIds","_jsxs","AriaSlider","cx","_jsx","Label","AriaSliderTrack","joinTestId","_Fragment","AriaSliderThumb","AriaSliderOutput","HintText"],"mappings":";;;;;;;;;;AAeA,MAAM,MAAM,GAAGA,SAAM,CAAC;AACpB,IAAA,OAAO,EAAE,QAAQ;AACjB,IAAA,MAAM,EAAE,4FAA4F;AACpG,IAAA,cAAc,EACZ,wKAAwK;AAC3K,CAAA,CAAC;AAiBF;;;;;AAKG;AACI,MAAM,MAAM,GAAG,CAAC,EACrB,aAAa,GAAG,SAAS,EACzB,QAAQ,GAAG,CAAC,EACZ,QAAQ,GAAG,GAAG,EACd,KAAK,EACL,IAAI,EACJ,cAAc,EACd,SAAS,EACT,aAAa,EACb,SAAS,EACT,kBAAkB,EAAE,eAAe,EACnC,aAAa,EAAE,UAAU,EACzB,GAAG,IAAI,EACK,KAAI;;AAEhB,IAAA,MAAM,oBAAoB,GAA6B;AACrD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,qBAAqB,EAAE,CAAC;KACzB;AACD,IAAA,MAAM,YAAY,GAAGC,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AACrG,IAAA,MAAM,MAAM,GAAGC,WAAK,EAAE;;IAEtB,MAAM,WAAW,GAAGC,qBAAO,CAAC,eAAe,EAAE,IAAI,IAAI,MAAM,CAAC;IAE5D,QACEC,eAAA,CAACC,0BAAU,EAAA,EAAA,GACL,IAAI,EACF,QAAQ,EAAE,QAAQ,EACxB,aAAa,EAAE,aAAa,IAAI,oBAAoB,EAAA,kBAAA,EAClC,WAAW,EAAA,aAAA,EAChB,YAAY,EACzB,SAAS,EAAE,CAAC,KAAK,KA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EAAE,SAAS,EAAA,aAAA,EACPF,sBAAU,CAAC,YAAY,EAAE,CAAA,MAAA,EAAS,KAAK,EAAE,CAAC,EACvD,SAAS,EAAE,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,KACxCJ,KAAE,CACA,8HAA8H,EAC9H,cAAc,IAAI,+CAA+C,EACjE,UAAU,IAAI,iBAAiB,CAChC,EAAA,QAAA,EAGHC,eAACM,gCAAgB,EAAA,EACf,SAAS,EAAEP,KAAE,CAAC,mBAAmB,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,EAAA,aAAA,EAC5CI,sBAAU,CAAC,YAAY,EAAE,CAAA,OAAA,EAAU,KAAK,EAAE,CAAC,EAAA,QAAA,EAEvD,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,iBAAiB,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,EAAA,CACrF,IAjBd,KAAK,CAkBM;4BAEtB,CAAC,CAAC,CAAA,EAAA,CACD;gBAEP,CAAC,EAAA,CACe,EACjB,IAAI,GAAGH,cAAA,CAACO,cAAQ,EAAA,EAAC,EAAE,EAAE,MAAM,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,GAAG,IAAI,CAAA,EAAA,CAC3C;AAEjB;;"}
@@ -13,6 +13,8 @@ export interface SliderProps extends AriaSliderProps {
13
13
  hint?: string;
14
14
  /** Formats each thumb's value label, replacing the default whole-number percentage. */
15
15
  labelFormatter?: (value: number) => string;
16
+ /** Marks each thumb `aria-invalid`, for a value a form has rejected; say why in `hint` or with `aria-describedby`. */
17
+ isInvalid?: boolean;
16
18
  /** Overrides the `data-testid` (defaults to `fd-slider`); the track, thumb(s), and output derive their ids from it. */
17
19
  'data-testid'?: string;
18
20
  }
@@ -22,6 +24,6 @@ export interface SliderProps extends AriaSliderProps {
22
24
  *
23
25
  * @summary draggable range input for selecting a numeric value
24
26
  */
25
- export declare const Slider: ({ labelPosition, minValue, maxValue, label, hint, labelFormatter, formatOptions, className, "aria-describedby": ariaDescribedBy, "data-testid": dataTestId, ...rest }: SliderProps) => import("react").JSX.Element;
27
+ export declare const Slider: ({ labelPosition, minValue, maxValue, label, hint, labelFormatter, isInvalid, formatOptions, className, "aria-describedby": ariaDescribedBy, "data-testid": dataTestId, ...rest }: SliderProps) => import("react").JSX.Element;
26
28
  export {};
27
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Slider/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAS5E,QAAA,MAAM,MAAM;;;;CAKV,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,qIAAqI;IACrI,aAAa,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC;IACpC,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yIAAyI;IACzI,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,uHAAuH;IACvH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,uKAYpB,WAAW,gCAuEb,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Slider/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAS5E,QAAA,MAAM,MAAM;;;;CAKV,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,qIAAqI;IACrI,aAAa,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC;IACpC,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yIAAyI;IACzI,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,sHAAsH;IACtH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uHAAuH;IACvH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,kLAapB,WAAW,gCAwEb,CAAC"}
@@ -17,7 +17,7 @@ const styles = sortCx({
17
17
  *
18
18
  * @summary draggable range input for selecting a numeric value
19
19
  */
20
- const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label, hint, labelFormatter, formatOptions, className, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...rest }) => {
20
+ const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label, hint, labelFormatter, isInvalid, formatOptions, className, 'aria-describedby': ariaDescribedBy, 'data-testid': dataTestId, ...rest }) => {
21
21
  // Format thumb value as percentage by default.
22
22
  const defaultFormatOptions = {
23
23
  style: 'percent',
@@ -36,7 +36,7 @@ const Slider = ({ labelPosition = 'default', minValue = 0, maxValue = 100, label
36
36
  } }), values.map((_, index) => {
37
37
  return (jsx(SliderThumb
38
38
  // biome-ignore lint/suspicious/noArrayIndexKey: static, ordered list of thumbs
39
- , { index: index, "data-testid": joinTestId(sliderTestId, `thumb-${index}`), className: ({ isFocusVisible, isDragging }) => cx('top-1/2 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', isDragging && 'cursor-grabbing'), children: jsx(SliderOutput, { className: cx('whitespace-nowrap', styles[labelPosition]), "data-testid": joinTestId(sliderTestId, `output-${index}`), children: labelFormatter ? labelFormatter(getThumbValue(index)) : getFormattedValue(getThumbValue(index) / 100) }) }, index));
39
+ , { index: index, isInvalid: isInvalid, "data-testid": joinTestId(sliderTestId, `thumb-${index}`), className: ({ isFocusVisible, isDragging }) => cx('top-1/2 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', isDragging && 'cursor-grabbing'), children: jsx(SliderOutput, { className: cx('whitespace-nowrap', styles[labelPosition]), "data-testid": joinTestId(sliderTestId, `output-${index}`), children: labelFormatter ? labelFormatter(getThumbValue(index)) : getFormattedValue(getThumbValue(index) / 100) }) }, index));
40
40
  })] }));
41
41
  } }), hint ? jsx(HintText, { id: hintId, children: hint }) : null] }));
42
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Slider/index.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaSlider","_jsx","AriaSliderTrack","_Fragment","AriaSliderThumb","AriaSliderOutput"],"mappings":";;;;;;;;AAeA,MAAM,MAAM,GAAG,MAAM,CAAC;AACpB,IAAA,OAAO,EAAE,QAAQ;AACjB,IAAA,MAAM,EAAE,4FAA4F;AACpG,IAAA,cAAc,EACZ,wKAAwK;AAC3K,CAAA,CAAC;AAeF;;;;;AAKG;AACI,MAAM,MAAM,GAAG,CAAC,EACrB,aAAa,GAAG,SAAS,EACzB,QAAQ,GAAG,CAAC,EACZ,QAAQ,GAAG,GAAG,EACd,KAAK,EACL,IAAI,EACJ,cAAc,EACd,aAAa,EACb,SAAS,EACT,kBAAkB,EAAE,eAAe,EACnC,aAAa,EAAE,UAAU,EACzB,GAAG,IAAI,EACK,KAAI;;AAEhB,IAAA,MAAM,oBAAoB,GAA6B;AACrD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,qBAAqB,EAAE,CAAC;KACzB;AACD,IAAA,MAAM,YAAY,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AACrG,IAAA,MAAM,MAAM,GAAG,KA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oCAAA,IAAI,EAAE,CAAA,EAAG,IAAI,GAAG,GAAG,CAAA,CAAA,CAAG;AACtB,oCAAA,KAAK,EAAE,CAAA,EAAG,KAAK,GAAG,GAAG,CAAA,CAAA,CAAG;iCACzB,EAAA,CACD,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAI;gCACvB,QACEA,IAACG;;AAGC,kCAAA,EAAA,KAAK,EAAE,KAAK,EAAA,aAAA,EACC,UAAU,CAAC,YAAY,EAAE,CAAA,MAAA,EAAS,KAAK,EAAE,CAAC,EACvD,SAAS,EAAE,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,KACxC,EAAE,CACA,8HAA8H,EAC9H,cAAc,IAAI,+CAA+C,EACjE,UAAU,IAAI,iBAAiB,CAChC,YAGHH,GAAA,CAACI,YAAgB,IACf,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,EAAA,aAAA,EAC5C,UAAU,CAAC,YAAY,EAAE,UAAU,KAAK,CAAA,CAAE,CAAC,EAAA,QAAA,EAEvD,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,iBAAiB,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,EAAA,CACrF,IAhBd,KAAK,CAiBM;4BAEtB,CAAC,CAAC,CAAA,EAAA,CACD;gBAEP,CAAC,EAAA,CACe,EACjB,IAAI,GAAGJ,GAAA,CAAC,QAAQ,EAAA,EAAC,EAAE,EAAE,MAAM,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,GAAG,IAAI,CAAA,EAAA,CAC3C;AAEjB;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Slider/index.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaSlider","_jsx","AriaSliderTrack","_Fragment","AriaSliderThumb","AriaSliderOutput"],"mappings":";;;;;;;;AAeA,MAAM,MAAM,GAAG,MAAM,CAA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EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,EAAA,aAAA,EAC5C,UAAU,CAAC,YAAY,EAAE,CAAA,OAAA,EAAU,KAAK,EAAE,CAAC,EAAA,QAAA,EAEvD,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,iBAAiB,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,EAAA,CACrF,IAjBd,KAAK,CAkBM;4BAEtB,CAAC,CAAC,CAAA,EAAA,CACD;gBAEP,CAAC,EAAA,CACe,EACjB,IAAI,GAAGJ,GAAA,CAAC,QAAQ,EAAA,EAAC,EAAE,EAAE,MAAM,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,GAAG,IAAI,CAAA,EAAA,CAC3C;AAEjB;;"}
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var reactHookForm = require('react-hook-form');
4
+
5
+ /**
6
+ * react-hook-form's `useForm` with the validation timing the `Form*` fields are built on: errors appear when the user
7
+ * leaves a field, and clear as they fix it. Use it for every form whose fields come from `components/forms`.
8
+ *
9
+ * @param options Every option react-hook-form's `useForm` takes. `mode` and `reValidateMode` default to `'onBlur'`;
10
+ * set either only for a form with none of the library's fields, since theirs validate twice per keystroke otherwise.
11
+ * `shouldFocusError` defaults to `false`: `Form` focuses the first invalid field in page order, where
12
+ * react-hook-form's own choice follows the order the fields mounted in.
13
+ * @returns The form, exactly as react-hook-form returns it, for `Form`'s `form` prop.
14
+ */
15
+ // biome-ignore lint/suspicious/noExplicitAny: mirrors react-hook-form's own `TContext = any`, so the two signatures stay interchangeable
16
+ const useForm = (options) =>
17
+ // Read one by one, not spread over: an option passed as `undefined` would otherwise switch the default off.
18
+ reactHookForm.useForm({
19
+ ...options,
20
+ mode: options?.mode ?? 'onBlur',
21
+ reValidateMode: options?.reValidateMode ?? 'onBlur',
22
+ shouldFocusError: options?.shouldFocusError ?? false,
23
+ });
24
+
25
+ exports.useForm = useForm;
26
+ //# sourceMappingURL=useForm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useForm.cjs","sources":["../../../../../src/components/forms/Form/hooks/useForm.ts"],"sourcesContent":[null],"names":["useReactHookForm"],"mappings":";;;;AAEA;;;;;;;;;AASG;AACH;AACO,MAAM,OAAO,GAAG,CACrB,OAA6D;AAE7D;AACAA,qBAAgB,CAAwC;AACtD,IAAA,GAAG,OAAO;AACV,IAAA,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ;AAC/B,IAAA,cAAc,EAAE,OAAO,EAAE,cAAc,IAAI,QAAQ;AACnD,IAAA,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,IAAI,KAAK;AACrD,CAAA;;"}
@@ -0,0 +1,13 @@
1
+ import { type FieldValues, type UseFormProps, type UseFormReturn } from 'react-hook-form';
2
+ /**
3
+ * react-hook-form's `useForm` with the validation timing the `Form*` fields are built on: errors appear when the user
4
+ * leaves a field, and clear as they fix it. Use it for every form whose fields come from `components/forms`.
5
+ *
6
+ * @param options Every option react-hook-form's `useForm` takes. `mode` and `reValidateMode` default to `'onBlur'`;
7
+ * set either only for a form with none of the library's fields, since theirs validate twice per keystroke otherwise.
8
+ * `shouldFocusError` defaults to `false`: `Form` focuses the first invalid field in page order, where
9
+ * react-hook-form's own choice follows the order the fields mounted in.
10
+ * @returns The form, exactly as react-hook-form returns it, for `Form`'s `form` prop.
11
+ */
12
+ export declare const useForm: <TValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TValues>(options?: UseFormProps<TValues, TContext, TTransformedValues>) => UseFormReturn<TValues, TContext, TTransformedValues>;
13
+ //# sourceMappingURL=useForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/Form/hooks/useForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAA+B,MAAM,iBAAiB,CAAC;AAEvH;;;;;;;;;GASG;AAEH,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,QAAQ,GAAG,GAAG,EAAE,kBAAkB,GAAG,OAAO,EAC7G,UAAU,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,CAAC,KAC5D,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,CAOlD,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { useForm as useForm$1 } from 'react-hook-form';
2
+
3
+ /**
4
+ * react-hook-form's `useForm` with the validation timing the `Form*` fields are built on: errors appear when the user
5
+ * leaves a field, and clear as they fix it. Use it for every form whose fields come from `components/forms`.
6
+ *
7
+ * @param options Every option react-hook-form's `useForm` takes. `mode` and `reValidateMode` default to `'onBlur'`;
8
+ * set either only for a form with none of the library's fields, since theirs validate twice per keystroke otherwise.
9
+ * `shouldFocusError` defaults to `false`: `Form` focuses the first invalid field in page order, where
10
+ * react-hook-form's own choice follows the order the fields mounted in.
11
+ * @returns The form, exactly as react-hook-form returns it, for `Form`'s `form` prop.
12
+ */
13
+ // biome-ignore lint/suspicious/noExplicitAny: mirrors react-hook-form's own `TContext = any`, so the two signatures stay interchangeable
14
+ const useForm = (options) =>
15
+ // Read one by one, not spread over: an option passed as `undefined` would otherwise switch the default off.
16
+ useForm$1({
17
+ ...options,
18
+ mode: options?.mode ?? 'onBlur',
19
+ reValidateMode: options?.reValidateMode ?? 'onBlur',
20
+ shouldFocusError: options?.shouldFocusError ?? false,
21
+ });
22
+
23
+ export { useForm };
24
+ //# sourceMappingURL=useForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useForm.js","sources":["../../../../../src/components/forms/Form/hooks/useForm.ts"],"sourcesContent":[null],"names":["useReactHookForm"],"mappings":";;AAEA;;;;;;;;;AASG;AACH;AACO,MAAM,OAAO,GAAG,CACrB,OAA6D;AAE7D;AACAA,SAAgB,CAAwC;AACtD,IAAA,GAAG,OAAO;AACV,IAAA,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ;AAC/B,IAAA,cAAc,EAAE,OAAO,EAAE,cAAc,IAAI,QAAQ;AACnD,IAAA,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,IAAI,KAAK;AACrD,CAAA;;"}
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var useForm = require('../useForm.cjs');
5
+
6
+ // A refetch brings newer values: the fields the user has edited keep the draft, the rest follow the server. The errors
7
+ // on screen and the dirty flag stay too, or a refetch would hide a rejection and switch Save off for a moment.
8
+ const FOLLOW_REFETCH = { keepDirtyValues: true, keepErrors: true, keepDirty: true };
9
+ // A save and Discard start the form again: `resetOptions` reaches each `reset` call, and would keep the edits and errors.
10
+ const START_AGAIN = { keepDirtyValues: false, keepErrors: false, keepDirty: false };
11
+ // A mapper written for the server's rejections may not expect a network failure, and one that threw would leave the save in flight for good.
12
+ const rejectedFieldOf = (fieldErrorOf, error) => {
13
+ try {
14
+ return fieldErrorOf?.(error);
15
+ }
16
+ catch {
17
+ return undefined;
18
+ }
19
+ };
20
+ /**
21
+ * Creates a form that waits on Save, and owns what happens around the save: it starts again from what was saved, keeps
22
+ * a draft through a refetch, holds a refetch that lands mid-save, and reports a failure beside Save or beneath the field
23
+ * the server rejected. Use it in place of `useForm` for a form with `FormFooter`, mounted once per record: give the
24
+ * form's component a `key` of the record's id, so another record never inherits this one's save.
25
+ *
26
+ * @param options Every option this module's `useForm` takes except `resetOptions`, with `save` and `fieldErrorOf`; see
27
+ * `UseSaveFormOptions`. Pass the loaded record as `values`, so the fields the user has not edited follow a refetch.
28
+ * @returns The form and its save state, with one handler per action; see `UseSaveFormReturn`. "Try again" has none:
29
+ * `FormSaveErrorAlert` submits the form itself, as Save does.
30
+ */
31
+ // biome-ignore lint/suspicious/noExplicitAny: mirrors react-hook-form's own `TContext = any`, so the two signatures stay interchangeable
32
+ const useSaveForm = ({ save, fieldErrorOf, values, ...options }) => {
33
+ const [saveState, setSaveState] = React.useState({ status: 'idle' });
34
+ const isSaving = saveState.status === 'saving';
35
+ const form = useForm.useForm({
36
+ ...options,
37
+ // Held while a save is in flight: a refetch landing then would reset the form, which ends the lock on its fields.
38
+ values: isSaving ? undefined : values,
39
+ resetOptions: FOLLOW_REFETCH,
40
+ });
41
+ const { reset, setError, getValues } = form;
42
+ const { isDirty, errors } = form.formState;
43
+ // The saved check ends with the next edit, for good: undoing that edit by hand must not bring it back with nothing saved.
44
+ const hasSaved = saveState.status === 'saved';
45
+ React.useEffect(() => {
46
+ if (isDirty && hasSaved)
47
+ setSaveState({ status: 'idle' });
48
+ }, [isDirty, hasSaved]);
49
+ const rejectedField = saveState.status === 'failed' ? saveState.rejectedField : undefined;
50
+ // Set once the save has settled, not as it fails: the fields are still locked then, and a locked control refuses focus.
51
+ React.useEffect(() => {
52
+ if (rejectedField)
53
+ setError(rejectedField.field, { type: 'server', message: rejectedField.message }, { shouldFocus: true });
54
+ }, [rejectedField, setError]);
55
+ // Awaited by `Form`, so the form counts as submitting until the save lands, which locks its fields.
56
+ const submit = async (submitted) => {
57
+ setSaveState({ status: 'saving' });
58
+ try {
59
+ await save(submitted);
60
+ }
61
+ catch (error) {
62
+ return setSaveState({ status: 'failed', error, rejectedField: rejectedFieldOf(fieldErrorOf, error) });
63
+ }
64
+ // What the form holds is what was sent: the resolved value may be any shape, and the saved record arrives through `values`.
65
+ reset(getValues(), START_AGAIN);
66
+ return setSaveState({ status: 'saved' });
67
+ };
68
+ const discard = () => {
69
+ // Mid-save it would end the hold on `values`, and a refetch landing then would unlock the fields.
70
+ if (isSaving)
71
+ return;
72
+ reset(undefined, START_AGAIN);
73
+ setSaveState({ status: 'idle' });
74
+ };
75
+ // Only a failure is dismissed: clearing a save in flight would end the hold on `values` too.
76
+ const dismissSaveError = () => setSaveState((current) => (current.status === 'failed' ? { status: 'idle' } : current));
77
+ const hasErrors = Object.keys(errors).length > 0;
78
+ const hasSaveError = saveState.status === 'failed' && !rejectedField;
79
+ return {
80
+ form,
81
+ submit,
82
+ discard,
83
+ isSaving,
84
+ // The saved check lasts until the next edit, or until an error shows.
85
+ isSaved: hasSaved && !isDirty && !hasErrors,
86
+ hasSaveError,
87
+ saveError: saveState.status === 'failed' && hasSaveError ? saveState.error : undefined,
88
+ dismissSaveError,
89
+ };
90
+ };
91
+
92
+ exports.useSaveForm = useSaveForm;
93
+ //# sourceMappingURL=useSaveForm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSaveForm.cjs","sources":["../../../../../../src/components/forms/Form/hooks/useSaveForm/useSaveForm.ts"],"sourcesContent":[null],"names":["useState","useForm","useEffect"],"mappings":";;;;;AAsDA;AACA;AACA,MAAM,cAAc,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;AAEnF;AACA,MAAM,WAAW,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE;AAEnF;AACA,MAAM,eAAe,GAAG,CACtB,YAAyD,EACzD,KAAc,KACyB;AACvC,IAAA,IAAI;AACF,QAAA,OAAO,YAAY,GAAG,KAAK,CAAC;IAC9B;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,SAAS;IAClB;AACF,CAAC;AAED;;;;;;;;;;AAUG;AACH;AACO,MAAM,WAAW,GAAG,CAAqF,EAC9G,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,GAAG,OAAO,EAC2C,KAAyD;AAC9G,IAAA,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAGA,cAAQ,CAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAClF,IAAA,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,KAAK,QAAQ;IAE9C,MAAM,IAAI,GAAGC,eAAO,CAAmC;AACrD,QAAA,GAAG,OAAO;;QAEV,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM;AAC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O,EAAE,CAAC;AAC1C,IAAA,CAAC;IACD,MAAM,OAAO,GAAG,MAAK;;AAEnB,QAAA,IAAI,QAAQ;YAAE;AACd,QAAA,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC;AAC7B,QAAA,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAClC,IAAA,CAAC;;AAED,IAAA,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,CAAC,OAAO,MAAM,OAAO,CAAC,MAAM,KAAK,QAAQ,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;AAEtH,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC;IAChD,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,aAAa;IAEpE,OAAO;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,QAAQ;;AAER,QAAA,OAAO,EAAE,QAAQ,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS;QAC3C,YAAY;AACZ,QAAA,SAAS,EAAE,SAAS,CAAC,MAAM,KAAK,QAAQ,IAAI,YAAY,GAAG,SAAS,CAAC,KAAK,GAAG,SAAS;QACtF,gBAAgB;KACjB;AACH;;"}
@@ -0,0 +1,54 @@
1
+ import type { FieldPath, FieldValues, SubmitHandler, UseFormProps, UseFormReturn } from 'react-hook-form';
2
+ /** A field the server rejected, which the form shows beneath that field in place of a failed-save alert. */
3
+ export interface SaveFieldError<TValues extends FieldValues> {
4
+ /** The rejected field's path in the form values. */
5
+ field: FieldPath<TValues>;
6
+ /** The server's message, shown beneath the field. */
7
+ message: string;
8
+ }
9
+ export interface UseSaveFormOptions<TValues extends FieldValues = FieldValues, TContext = any, TSubmitValues = TValues> extends Omit<UseFormProps<TValues, TContext, TSubmitValues>, 'resetOptions'> {
10
+ /**
11
+ * Sends the validated values, such as a mutation's `mutateAsync`; reject to report a failed save. What it resolves
12
+ * with is not read: the form starts again from what it holds, and a record the server changed on the way in reaches
13
+ * it through `values`. Resolve only once `values` holds the saved record: one that lands mid-save is taken as the
14
+ * saved one when the save succeeds, so a record read before the save would show as saved.
15
+ */
16
+ save: (values: TSubmitValues) => Promise<unknown>;
17
+ /**
18
+ * Picks the field a failed save rejected, from what `save` rejected with. Return `undefined` for any other failure,
19
+ * and for a field the form does not show: that one is reported as a failed save, since no field can show it. One that
20
+ * throws is treated the same way.
21
+ */
22
+ fieldErrorOf?: (error: unknown) => SaveFieldError<TValues> | undefined;
23
+ }
24
+ export interface UseSaveFormReturn<TValues extends FieldValues = FieldValues, TContext = any, TSubmitValues = TValues> {
25
+ /** The form, for `Form`'s `form` prop. */
26
+ form: UseFormReturn<TValues, TContext, TSubmitValues>;
27
+ /** Saves the validated values, for `Form`'s `onSubmit`. It never rejects: a failure shows in `hasSaveError` or beneath a field. */
28
+ submit: SubmitHandler<TSubmitValues>;
29
+ /** Puts the form back to what was loaded or last saved and clears a failed save, for `FormFooter`'s `onDiscard`. Ignored while a save is in flight. */
30
+ discard: () => void;
31
+ /** Whether a save is in flight. */
32
+ isSaving: boolean;
33
+ /** Whether the last save succeeded and nothing has changed since, for `FormFooter`'s `isSaved`. */
34
+ isSaved: boolean;
35
+ /** Whether the last save failed outright, which is when to render `FormSaveErrorAlert`. `false` when a field took the rejection. */
36
+ hasSaveError: boolean;
37
+ /** What `save` rejected with while `hasSaveError` is `true`, to read the server's reason from. */
38
+ saveError: unknown;
39
+ /** Clears a failed save, for `FormSaveErrorAlert`'s `onDismiss`. */
40
+ dismissSaveError: () => void;
41
+ }
42
+ /**
43
+ * Creates a form that waits on Save, and owns what happens around the save: it starts again from what was saved, keeps
44
+ * a draft through a refetch, holds a refetch that lands mid-save, and reports a failure beside Save or beneath the field
45
+ * the server rejected. Use it in place of `useForm` for a form with `FormFooter`, mounted once per record: give the
46
+ * form's component a `key` of the record's id, so another record never inherits this one's save.
47
+ *
48
+ * @param options Every option this module's `useForm` takes except `resetOptions`, with `save` and `fieldErrorOf`; see
49
+ * `UseSaveFormOptions`. Pass the loaded record as `values`, so the fields the user has not edited follow a refetch.
50
+ * @returns The form and its save state, with one handler per action; see `UseSaveFormReturn`. "Try again" has none:
51
+ * `FormSaveErrorAlert` submits the form itself, as Save does.
52
+ */
53
+ export declare const useSaveForm: <TValues extends FieldValues = FieldValues, TContext = any, TSubmitValues = TValues>({ save, fieldErrorOf, values, ...options }: UseSaveFormOptions<TValues, TContext, TSubmitValues>) => UseSaveFormReturn<TValues, TContext, TSubmitValues>;
54
+ //# sourceMappingURL=useSaveForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSaveForm.d.ts","sourceRoot":"","sources":["../../../../../../src/components/forms/Form/hooks/useSaveForm/useSaveForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG1G,4GAA4G;AAC5G,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,WAAW;IACzD,oDAAoD;IACpD,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,QAAQ,GAAG,GAAG,EAAE,aAAa,GAAG,OAAO,CACpH,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,cAAc,CAAC;IAC5E;;;;;OAKG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;CACxE;AAGD,MAAM,W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