@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
@@ -0,0 +1,42 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { MultiSelect } from '@flipdish/ui-library/components/molecules/Select';
3
+ import { useMemo } from 'react';
4
+ import { useFocusTarget } from '../../__internal__/formField/hooks/useFocusTarget.js';
5
+ import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
6
+ import { collectSelectableKeys } from '../../../molecules/Select/multiSelect.utils.js';
7
+
8
+ /**
9
+ * A `MultiSelect` bound to a react-hook-form field: every tick, Reset and Select all writes the chosen `id`s to the form
10
+ * as an array and validates it at once, and the field's error shows in place of `hint`. Use it when the user picks
11
+ * several options from a list in a react-hook-form form.
12
+ *
13
+ * @summary multi-option select bound to a react-hook-form field
14
+ */
15
+ const FormMultiSelect = ({ name, revalidates, hint, items, children, onReset, onSelectAll, ...multiSelectProps }) => {
16
+ const { value, ref, onCommit, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
17
+ // An unset field is `undefined`, which would leave the list uncontrolled; a stable set avoids re-rendering every option.
18
+ const selectedKeys = useMemo(() => new Set(value ?? []), [value]);
19
+ // The same ids `MultiSelect`'s own Select all uses: from `items`, else from the static `MultiSelect.Item` children.
20
+ const allKeys = () => [
21
+ ...collectSelectableKeys(items?.map((item) => item.id), children),
22
+ ];
23
+ // A react-aria `Selection` may be `'all'`, which a schema cannot validate, so it becomes the ids.
24
+ const handleSelectionChange = (keys) => onCommit(keys === 'all' ? allKeys() : [...keys]);
25
+ // A controlled `MultiSelect` leaves Reset and Select all to its parent.
26
+ const handleReset = () => {
27
+ onCommit([]);
28
+ onReset?.();
29
+ };
30
+ const handleSelectAll = () => {
31
+ onCommit(allKeys());
32
+ onSelectAll?.();
33
+ };
34
+ // `MultiSelect`'s ref is its wrapper div; the trigger is its only direct button child (the label's tooltip is nested).
35
+ const focusRef = useFocusTarget(ref, ':scope > button');
36
+ return (jsx(MultiSelect, { ...multiSelectProps, ref: focusRef, items: items, selectedKeys: selectedKeys, onSelectionChange: handleSelectionChange, onReset: handleReset, onSelectAll: handleSelectAll, isInvalid: isInvalid, hint: errorMessage ?? hint,
37
+ // Disabled while the form submits, having no read-only mode: a change made meanwhile would be lost to the save.
38
+ isDisabled: multiSelectProps.isDisabled || isDisabled || isLocked, children: children }));
39
+ };
40
+
41
+ export { FormMultiSelect };
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormMultiSelect/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;AAqBA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,CAA4C,EACzE,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EACX,GAAG,gBAAgB,EACW,KAAI;IAClC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAiB,IAAI,EAAE,WAAW,CAAC;;AAE/H,IAAA,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;;AAEjE,IAAA,MAAM,OAAO,GAAG,MAAM;AACpB,QAAA,GAAG,qBAAqB,CACtB,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC,EAC7B,QAAQ,CACT;KACF;;IAGD,MAAM,qBAAqB,GAAG,CAAC,IAAe,KAAK,QAAQ,CAAC,IAAI,KAAK,KAAK,GAAG,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;;IAEnG,MAAM,WAAW,GAAG,MAAK;QACvB,QAAQ,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI;AACb,IAAA,CAAC;IACD,MAAM,eAAe,GAAG,MAAK;AAC3B,QAAA,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,WAAW,IAAI;AACjB,IAAA,CAAC;;IAGD,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,iBAAiB,CAAC;AAEvD,IAAA,QACEA,GAAA,CAAC,WAAW,EAAA,EAAA,GACN,gBAAgB,EACpB,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,qBAAqB,EACxC,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI;;AAE1B,QAAA,UAAU,EAAE,gBAAgB,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,QAAA,EAEhE,QAAQ,EAAA,CACG;AAElB;;"}
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var Input = require('@flipdish/ui-library/components/atoms/Input');
5
+ var RadioGroup = require('@flipdish/ui-library/components/molecules/RadioGroup');
6
+ var React = require('react');
7
+ var useFocusTarget = require('../../__internal__/formField/hooks/useFocusTarget.cjs');
8
+ var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
9
+ var ariaIds_utils = require('../../../../utilities/__internal__/ariaIdsUtils/ariaIds.utils.cjs');
10
+
11
+ /**
12
+ * The card radio group, `RadioGroup.RadioButton`, bound to a react-hook-form field: choosing a card writes its value to
13
+ * the form and validates it at once, and the field's error shows beneath the cards. Use it when each option needs a line of description.
14
+ *
15
+ * @summary card radio group bound to a react-hook-form field
16
+ */
17
+ const FormRadioCardGroup = ({ name, revalidates, label, hint, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...radioGroupProps }) => {
18
+ const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
19
+ // The group takes no ref, so the wrapper hands the form the chosen radio, or the first when none is.
20
+ const focusRef = useFocusTarget.useFocusTarget(ref, 'input:checked:not(:disabled)', 'input:not(:disabled)');
21
+ const labelId = React.useId();
22
+ const messageId = React.useId();
23
+ const message = errorMessage ?? hint;
24
+ return (jsxRuntime.jsxs("div", { ref: focusRef, className: "flex w-full flex-col gap-1.5", children: [label && (jsxRuntime.jsxs("span", { id: labelId, className: "flex items-center gap-0.5 text-sm font-medium text-secondary", children: [label, radioGroupProps.isRequired && (jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-brand-tertiary", children: "*" }))] })), jsxRuntime.jsx(RadioGroup.RadioButton
25
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
26
+ , {
27
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
28
+ validationBehavior: "aria", ...radioGroupProps, name: name,
29
+ // An unset field is `undefined`, which would flip the group between uncontrolled and controlled.
30
+ value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, isDisabled: radioGroupProps.isDisabled || isDisabled,
31
+ // Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
32
+ isReadOnly: radioGroupProps.isReadOnly || isLocked, "aria-labelledby": ariaIds_utils.joinIds(ariaLabelledBy, label && labelId), "aria-describedby": ariaIds_utils.joinIds(ariaDescribedBy, message && messageId) }), message && (jsxRuntime.jsx(Input.HintText, { id: messageId, isInvalid: Boolean(errorMessage), children: message }))] }));
33
+ };
34
+
35
+ exports.FormRadioCardGroup = FormRadioCardGroup;
36
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormRadioCardGroup/index.tsx"],"sourcesContent":[null],"names":["useFormField","useFocusTarget","useId","_jsxs","_jsx","RadioButton","joinIds","HintText"],"mappings":";;;;;;;;;;AA6BA;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAA4C,EAC5E,IAAI,EACJ,WAAW,EACX,KAAK,EACL,IAAI,EACJ,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,eAAe,EACe,KAAI;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAExI,MAAM,QAAQ,GAAGC,6BAAc,CAAC,GAAG,EAAE,8BAA8B,EAAE,sBAAsB,CAAC;AAC5F,IAAA,MAAM,OAAO,GAAGC,WAAK,EAAE;AACvB,IAAA,MAAM,SAAS,GAAGA,WAAK,EAAE;AACzB,IAAA,MAAM,OAAO,GAAG,YAAY,IAAI,IAAI;AAEpC,IAAA,QACEC,eAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,8BAA8B,EAAA,QAAA,EAAA,CACzD,KAAK,KACJA,eAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,8DAA8D,EAAA,QAAA,EAAA,CACxF,KAAK,EACL,eAAe,CAAC,UAAU,KACzBC,cAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAC,SAAS,EAAC,qBAAqB,EAAA,QAAA,EAAA,GAAA,EAAA,CAEjD,CACR,IACI,CACR,EACDA,eAACC;;;;AAEC,gBAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,IAAI,EAAE,IAAI;;gBAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU;;gBAEpD,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,QAAQ,EAAA,iBAAA,EACjCC,qBAAO,CAAC,cAAc,EAAE,KAAK,IAAI,OAAO,CAAC,EAAA,kBAAA,EAExCA,qBAAO,CAAC,eAAe,EAAE,OAAO,IAAI,SAAS,CAAC,GAChE,EACD,OAAO,KACNF,cAAA,CAACG,cAAQ,EAAA,EAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,EAAA,QAAA,EACtD,OAAO,EAAA,CACC,CACZ,CAAA,EAAA,CACG;AAEV;;"}
@@ -0,0 +1,32 @@
1
+ import { RadioButton } from '@flipdish/ui-library/components/molecules/RadioGroup';
2
+ import { type ComponentProps } from 'react';
3
+ import type { FieldPath, FieldValues } from 'react-hook-form';
4
+ interface FormRadioCardGroupBaseProps<TValues extends FieldValues = FieldValues> extends Omit<ComponentProps<typeof RadioButton>, 'name' | 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'isInvalid'> {
5
+ /** The field's path in the form values, such as `template` or `delivery.method`. */
6
+ name: FieldPath<TValues>;
7
+ /**
8
+ * Other fields to re-validate when this changes. A `crossFieldRules` rule validated through `useSchemaResolver` names them
9
+ * itself, so pass this only for a rule written another way, such as a zod `superRefine` in the same schema, or for a nested field.
10
+ */
11
+ revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
12
+ /** Name of the group, shown above the cards; the types ask for this, `aria-label` or `aria-labelledby`. */
13
+ label?: string;
14
+ /** Help text beneath the cards; the field's error replaces it. */
15
+ hint?: string;
16
+ }
17
+ export type FormRadioCardGroupProps<TValues extends FieldValues = FieldValues> = FormRadioCardGroupBaseProps<TValues> & ({
18
+ label: string;
19
+ } | {
20
+ 'aria-label': string;
21
+ } | {
22
+ 'aria-labelledby': string;
23
+ });
24
+ /**
25
+ * The card radio group, `RadioGroup.RadioButton`, bound to a react-hook-form field: choosing a card writes its value to
26
+ * the form and validates it at once, and the field's error shows beneath the cards. Use it when each option needs a line of description.
27
+ *
28
+ * @summary card radio group bound to a react-hook-form field
29
+ */
30
+ export declare const FormRadioCardGroup: <TValues extends FieldValues = FieldValues>({ name, revalidates, label, hint, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...radioGroupProps }: FormRadioCardGroupProps<TValues>) => import("react").JSX.Element;
31
+ export {};
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormRadioCardGroup/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9D,UAAU,2BAA2B,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAC7E,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzH,oFAAoF;IACpF,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IACxD,2GAA2G;IAC3G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,IAAI,2BAA2B,CAAC,OAAO,CAAC,GACnH,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,gIAQ3E,uBAAuB,CAAC,OAAO,CAAC,gCA4ClC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { HintText } from '@flipdish/ui-library/components/atoms/Input';
3
+ import { RadioButton } from '@flipdish/ui-library/components/molecules/RadioGroup';
4
+ import { useId } from 'react';
5
+ import { useFocusTarget } from '../../__internal__/formField/hooks/useFocusTarget.js';
6
+ import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
7
+ import { joinIds } from '../../../../utilities/__internal__/ariaIdsUtils/ariaIds.utils.js';
8
+
9
+ /**
10
+ * The card radio group, `RadioGroup.RadioButton`, bound to a react-hook-form field: choosing a card writes its value to
11
+ * the form and validates it at once, and the field's error shows beneath the cards. Use it when each option needs a line of description.
12
+ *
13
+ * @summary card radio group bound to a react-hook-form field
14
+ */
15
+ const FormRadioCardGroup = ({ name, revalidates, label, hint, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...radioGroupProps }) => {
16
+ const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
17
+ // The group takes no ref, so the wrapper hands the form the chosen radio, or the first when none is.
18
+ const focusRef = useFocusTarget(ref, 'input:checked:not(:disabled)', 'input:not(:disabled)');
19
+ const labelId = useId();
20
+ const messageId = useId();
21
+ const message = errorMessage ?? hint;
22
+ return (jsxs("div", { ref: focusRef, className: "flex w-full flex-col gap-1.5", children: [label && (jsxs("span", { id: labelId, className: "flex items-center gap-0.5 text-sm font-medium text-secondary", children: [label, radioGroupProps.isRequired && (jsx("span", { "aria-hidden": "true", className: "text-brand-tertiary", children: "*" }))] })), jsx(RadioButton
23
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
24
+ , {
25
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
26
+ validationBehavior: "aria", ...radioGroupProps, name: name,
27
+ // An unset field is `undefined`, which would flip the group between uncontrolled and controlled.
28
+ value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, isDisabled: radioGroupProps.isDisabled || isDisabled,
29
+ // Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
30
+ isReadOnly: radioGroupProps.isReadOnly || isLocked, "aria-labelledby": joinIds(ariaLabelledBy, label && labelId), "aria-describedby": joinIds(ariaDescribedBy, message && messageId) }), message && (jsx(HintText, { id: messageId, isInvalid: Boolean(errorMessage), children: message }))] }));
31
+ };
32
+
33
+ export { FormRadioCardGroup };
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormRadioCardGroup/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AA6BA;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAA4C,EAC5E,IAAI,EACJ,WAAW,EACX,KAAK,EACL,IAAI,EACJ,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,eAAe,EACe,KAAI;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAExI,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,8BAA8B,EAAE,sBAAsB,CAAC;AAC5F,IAAA,MAAM,OAAO,GAAG,KAAK,EAAE;AACvB,IAAA,MAAM,SAAS,GAAG,KAAK,EAAE;AACzB,IAAA,MAAM,OAAO,GAAG,YAAY,IAAI,IAAI;AAEpC,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,8BAA8B,EAAA,QAAA,EAAA,CACzD,KAAK,KACJA,IAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,8DAA8D,EAAA,QAAA,EAAA,CACxF,KAAK,EACL,eAAe,CAAC,UAAU,KACzBC,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAC,SAAS,EAAC,qBAAqB,EAAA,QAAA,EAAA,GAAA,EAAA,CAEjD,CACR,IACI,CACR,EACDA,IAAC;;;;AAEC,gBAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,IAAI,EAAE,IAAI;;gBAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU;;gBAEpD,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,QAAQ,EAAA,iBAAA,EACjC,OAAO,CAAC,cAAc,EAAE,KAAK,IAAI,OAAO,CAAC,EAAA,kBAAA,EAExC,OAAO,CAAC,eAAe,EAAE,OAAO,IAAI,SAAS,CAAC,GAChE,EACD,OAAO,KACNA,GAAA,CAAC,QAAQ,EAAA,EAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,EAAA,QAAA,EACtD,OAAO,EAAA,CACC,CACZ,CAAA,EAAA,CACG;AAEV;;"}
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var Input = require('@flipdish/ui-library/components/atoms/Input');
5
+ var RadioButton = require('@flipdish/ui-library/components/atoms/RadioButton');
6
+ var useFocusTarget = require('../../__internal__/formField/hooks/useFocusTarget.cjs');
7
+ var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
8
+
9
+ /**
10
+ * A `RadioGroup` bound to a react-hook-form field: choosing an option writes its value to the form and validates it
11
+ * at once, and the field's error shows beneath the group. Use it when the user picks one of a few visible options.
12
+ *
13
+ * @summary radio group bound to a react-hook-form field
14
+ */
15
+ const FormRadioGroup = ({ name, revalidates, children, ...radioGroupProps }) => {
16
+ const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
17
+ // `RadioGroup` takes no ref, so a layout-neutral wrapper hands the form the chosen radio, or the first when none is.
18
+ const focusRef = useFocusTarget.useFocusTarget(ref, 'input:checked:not(:disabled)', 'input:not(:disabled)');
19
+ return (jsxRuntime.jsx("div", { ref: focusRef, className: "contents", children: jsxRuntime.jsxs(RadioButton.RadioGroup
20
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
21
+ , {
22
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
23
+ validationBehavior: "aria", ...radioGroupProps, name: name,
24
+ // An unset field is `undefined`, which would flip the group between uncontrolled and controlled.
25
+ value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, isDisabled: radioGroupProps.isDisabled || isDisabled,
26
+ // Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
27
+ isReadOnly: radioGroupProps.isReadOnly || isLocked, children: [children, isInvalid && errorMessage && (jsxRuntime.jsx(Input.HintText, { isInvalid: true, role: "alert", children: errorMessage }))] }) }));
28
+ };
29
+
30
+ exports.FormRadioGroup = FormRadioGroup;
31
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormRadioGroup/index.tsx"],"sourcesContent":[null],"names":["useFormField","useFocusTarget","_jsx","_jsxs","RadioGroup","HintText"],"mappings":";;;;;;;;AAoBA;;;;;AAKG;AACI,MAAM,cAAc,GAAG,CAA4C,EACxE,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,GAAG,eAAe,EACW,KAAI;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAExI,MAAM,QAAQ,GAAGC,6BAAc,CAAC,GAAG,EAAE,8BAA8B,EAAE,sBAAsB,CAAC;IAE5F,QACEC,cAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,UAAU,EAAA,QAAA,EACtCC,eAAA,CAACC;;;;AAEC,YAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,IAAI,EAAE,IAAI;;YAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU;;AAEpD,YAAA,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,QAAQ,EAAA,QAAA,EAAA,CAEjD,QAAQ,EAER,SAAS,IAAI,YAAY,KACxBF,cAAA,CAACG,cAAQ,EAAA,EAAC,SAAS,EAAA,IAAA,EAAC,IAAI,EAAC,OAAO,EAAA,QAAA,EAC7B,YAAY,EAAA,CACJ,CACZ,CAAA,EAAA,CACU,EAAA,CACT;AAEV;;"}
@@ -0,0 +1,20 @@
1
+ import { RadioGroup } from '@flipdish/ui-library/components/atoms/RadioButton';
2
+ import type { ComponentProps } from 'react';
3
+ import type { FieldPath, FieldValues } from 'react-hook-form';
4
+ export interface FormRadioGroupProps<TValues extends FieldValues = FieldValues> extends Omit<ComponentProps<typeof RadioGroup>, 'name' | 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'isInvalid' | 'ref'> {
5
+ /** The field's path in the form values, such as `plan` or `delivery.method`. */
6
+ name: FieldPath<TValues>;
7
+ /**
8
+ * Other fields to re-validate when this changes. A `crossFieldRules` rule validated through `useSchemaResolver` names them
9
+ * itself, so pass this only for a rule written another way, such as a zod `superRefine` in the same schema, or for a nested field.
10
+ */
11
+ revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
12
+ }
13
+ /**
14
+ * A `RadioGroup` bound to a react-hook-form field: choosing an option writes its value to the form and validates it
15
+ * at once, and the field's error shows beneath the group. Use it when the user picks one of a few visible options.
16
+ *
17
+ * @summary radio group bound to a react-hook-form field
18
+ */
19
+ export declare const FormRadioGroup: <TValues extends FieldValues = FieldValues>({ name, revalidates, children, ...radioGroupProps }: FormRadioGroupProps<TValues>) => import("react").JSX.Element;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormRadioGroup/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9D,MAAM,WAAW,mBAAmB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAC5E,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IAChI,gFAAgF;IAChF,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,qDAKvE,mBAAmB,CAAC,OAAO,CAAC,gCA+B9B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { HintText } from '@flipdish/ui-library/components/atoms/Input';
3
+ import { RadioGroup } from '@flipdish/ui-library/components/atoms/RadioButton';
4
+ import { useFocusTarget } from '../../__internal__/formField/hooks/useFocusTarget.js';
5
+ import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
6
+
7
+ /**
8
+ * A `RadioGroup` bound to a react-hook-form field: choosing an option writes its value to the form and validates it
9
+ * at once, and the field's error shows beneath the group. Use it when the user picks one of a few visible options.
10
+ *
11
+ * @summary radio group bound to a react-hook-form field
12
+ */
13
+ const FormRadioGroup = ({ name, revalidates, children, ...radioGroupProps }) => {
14
+ const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
15
+ // `RadioGroup` takes no ref, so a layout-neutral wrapper hands the form the chosen radio, or the first when none is.
16
+ const focusRef = useFocusTarget(ref, 'input:checked:not(:disabled)', 'input:not(:disabled)');
17
+ return (jsx("div", { ref: focusRef, className: "contents", children: jsxs(RadioGroup
18
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
19
+ , {
20
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
21
+ validationBehavior: "aria", ...radioGroupProps, name: name,
22
+ // An unset field is `undefined`, which would flip the group between uncontrolled and controlled.
23
+ value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, isDisabled: radioGroupProps.isDisabled || isDisabled,
24
+ // Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
25
+ isReadOnly: radioGroupProps.isReadOnly || isLocked, children: [children, isInvalid && errorMessage && (jsx(HintText, { isInvalid: true, role: "alert", children: errorMessage }))] }) }));
26
+ };
27
+
28
+ export { FormRadioGroup };
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormRadioGroup/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAoBA;;;;;AAKG;AACI,MAAM,cAAc,GAAG,CAA4C,EACxE,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,GAAG,eAAe,EACW,KAAI;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAExI,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,8BAA8B,EAAE,sBAAsB,CAAC;IAE5F,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,UAAU,EAAA,QAAA,EACtCC,IAAA,CAAC;;;;AAEC,YAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,eAAe,EACnB,IAAI,EAAE,IAAI;;YAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,UAAU;;AAEpD,YAAA,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,QAAQ,EAAA,QAAA,EAAA,CAEjD,QAAQ,EAER,SAAS,IAAI,YAAY,KACxBD,GAAA,CAAC,QAAQ,EAAA,EAAC,SAAS,EAAA,IAAA,EAAC,IAAI,EAAC,OAAO,EAAA,QAAA,EAC7B,YAAY,EAAA,CACJ,CACZ,CAAA,EAAA,CACU,EAAA,CACT;AAEV;;"}
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var Select = require('@flipdish/ui-library/components/molecules/Select');
5
+ var useFocusTarget = require('../../__internal__/formField/hooks/useFocusTarget.cjs');
6
+ var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
7
+
8
+ /**
9
+ * A `Select` bound to a react-hook-form field: choosing an option writes its `id` to the form and validates it at once,
10
+ * and the field's error shows in place of `hint`. Use it when the user picks one option from a list in a react-hook-form form.
11
+ *
12
+ * @summary single-option select bound to a react-hook-form field
13
+ */
14
+ const FormSelect = ({ name, revalidates, hint, ...selectProps }) => {
15
+ const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
16
+ // `Select`'s ref is its wrapper div; the trigger is its only direct button child (the label's tooltip is nested).
17
+ const focusRef = useFocusTarget.useFocusTarget(ref, ':scope > button');
18
+ return (jsxRuntime.jsx(Select.Select
19
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
20
+ , {
21
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
22
+ validationBehavior: "aria", ...selectProps, ref: focusRef, name: name,
23
+ // An unset field is `undefined`, which would flip the select between uncontrolled and controlled.
24
+ value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, hint: errorMessage ?? hint,
25
+ // Disabled while the form submits, having no read-only mode: a change made meanwhile would be lost to the save.
26
+ isDisabled: selectProps.isDisabled || isDisabled || isLocked }));
27
+ };
28
+
29
+ exports.FormSelect = FormSelect;
30
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormSelect/index.tsx"],"sourcesContent":[null],"names":["useFormField","useFocusTarget","_jsx","Select"],"mappings":";;;;;;;AAsBA;;;;;AAKG;AACI,MAAM,UAAU,GAAG,CAA4C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,WAAW,EAA4B,KAAI;IAC7I,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAsB,IAAI,EAAE,WAAW,CAAC;;IAG5I,MAAM,QAAQ,GAAGC,6BAAc,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAEvD,QACEC,eAACC;;;;QAEC,kBAAkB,EAAC,MAAM,EAAA,GACrB,WAAW,EACf,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI;;QAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI;;QAE1B,UAAU,EAAE,WAAW,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,CAC5D;AAEN;;"}
@@ -0,0 +1,19 @@
1
+ import { type SelectProps } from '@flipdish/ui-library/components/molecules/Select';
2
+ import type { FieldPath, FieldValues } from 'react-hook-form';
3
+ export interface FormSelectProps<TValues extends FieldValues = FieldValues> extends Omit<SelectProps, 'name' | 'value' | 'defaultValue' | 'onChange' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'onBlur' | 'isInvalid' | 'ref'> {
4
+ /** The field's path in the form values, such as `country` or `address.country`. */
5
+ name: FieldPath<TValues>;
6
+ /**
7
+ * Other fields to re-validate when this changes. A `crossFieldRules` rule validated through `useSchemaResolver` names them
8
+ * itself, so pass this only for a rule written another way, such as a zod `superRefine` in the same schema, or for a nested field.
9
+ */
10
+ revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
11
+ }
12
+ /**
13
+ * A `Select` bound to a react-hook-form field: choosing an option writes its `id` to the form and validates it at once,
14
+ * and the field's error shows in place of `hint`. Use it when the user picks one option from a list in a react-hook-form form.
15
+ *
16
+ * @summary single-option select bound to a react-hook-form field
17
+ */
18
+ export declare const FormSelect: <TValues extends FieldValues = FieldValues>({ name, revalidates, hint, ...selectProps }: FormSelectProps<TValues>) => import("react").JSX.Element;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormSelect/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAE5F,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9D,MAAM,WAAW,eAAe,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CACxE,SAAQ,IAAI,CACV,WAAW,EACX,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,GAAG,oBAAoB,GAAG,mBAAmB,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAC7I;IACD,mFAAmF;IACnF,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,6CAA6C,eAAe,CAAC,OAAO,CAAC,gCAuB1I,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { Select } from '@flipdish/ui-library/components/molecules/Select';
3
+ import { useFocusTarget } from '../../__internal__/formField/hooks/useFocusTarget.js';
4
+ import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
5
+
6
+ /**
7
+ * A `Select` bound to a react-hook-form field: choosing an option writes its `id` to the form and validates it at once,
8
+ * and the field's error shows in place of `hint`. Use it when the user picks one option from a list in a react-hook-form form.
9
+ *
10
+ * @summary single-option select bound to a react-hook-form field
11
+ */
12
+ const FormSelect = ({ name, revalidates, hint, ...selectProps }) => {
13
+ const { value, ref, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
14
+ // `Select`'s ref is its wrapper div; the trigger is its only direct button child (the label's tooltip is nested).
15
+ const focusRef = useFocusTarget(ref, ':scope > button');
16
+ return (jsx(Select
17
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
18
+ , {
19
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
20
+ validationBehavior: "aria", ...selectProps, ref: focusRef, name: name,
21
+ // An unset field is `undefined`, which would flip the select between uncontrolled and controlled.
22
+ value: value ?? null, onChange: onCommit, onBlur: onBlur, isInvalid: isInvalid, hint: errorMessage ?? hint,
23
+ // Disabled while the form submits, having no read-only mode: a change made meanwhile would be lost to the save.
24
+ isDisabled: selectProps.isDisabled || isDisabled || isLocked }));
25
+ };
26
+
27
+ export { FormSelect };
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormSelect/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;AAsBA;;;;;AAKG;AACI,MAAM,UAAU,GAAG,CAA4C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,WAAW,EAA4B,KAAI;IAC7I,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAsB,IAAI,EAAE,WAAW,CAAC;;IAG5I,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAEvD,QACEA,IAAC;;;;QAEC,kBAAkB,EAAC,MAAM,EAAA,GACrB,WAAW,EACf,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI;;QAEV,KAAK,EAAE,KAAK,IAAI,IAAI,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI;;QAE1B,UAAU,EAAE,WAAW,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,CAC5D;AAEN;;"}
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var Input = require('@flipdish/ui-library/components/atoms/Input');
5
+ var Slider = require('@flipdish/ui-library/components/atoms/Slider');
6
+ var React = require('react');
7
+ var useFocusTarget = require('../../__internal__/formField/hooks/useFocusTarget.cjs');
8
+ var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
9
+ var ariaIds_utils = require('../../../../utilities/__internal__/ariaIdsUtils/ariaIds.utils.cjs');
10
+
11
+ /**
12
+ * A single-thumb `Slider` bound to a react-hook-form field: moving the thumb updates the field's number, and releasing
13
+ * it validates, with the field's error shown beneath the slider in place of `hint`. Use it for a bounded number the user
14
+ * adjusts by feel.
15
+ *
16
+ * @summary single-thumb slider bound to a react-hook-form field
17
+ */
18
+ const FormSlider = ({ name, revalidates, minValue = 0, hint, ...sliderProps }) => {
19
+ const { value, ref, onDraft, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
20
+ // `Slider` takes no ref, so the wrapper hands the form the thumb's input.
21
+ const focusRef = useFocusTarget.useFocusTarget(ref, 'input');
22
+ const errorId = React.useId();
23
+ const describedBy = ariaIds_utils.joinIds(sliderProps['aria-describedby'], errorMessage && errorId);
24
+ // A single thumb reports a number; the range type of `Slider` also allows an array.
25
+ const toNumber = (next) => (Array.isArray(next) ? next[0] : next);
26
+ // `Slider` has no `onBlur`, so the wrapper hears the thumb's: leaving the slider untouched still marks the field visited and validates it.
27
+ const blur = (event) => {
28
+ if (!event.currentTarget.contains(event.relatedTarget))
29
+ onBlur();
30
+ };
31
+ return (
32
+ // biome-ignore lint/a11y/noStaticElementInteractions: it only hears the thumb's blur as it bubbles, and takes no interaction itself
33
+ jsxRuntime.jsxs("div", { ref: focusRef, onBlur: blur, className: "flex w-full flex-col gap-1.5", children: [jsxRuntime.jsx(Slider.Slider, { ...sliderProps, minValue: minValue,
34
+ // The error takes the hint's place, as it does on the other fields.
35
+ hint: errorMessage ? undefined : hint,
36
+ // An unset field is `undefined`, which would flip the slider between uncontrolled and controlled.
37
+ value: value ?? minValue, onChange: (next) => onDraft(toNumber(next)), onChangeEnd: (next) => onCommit(toNumber(next)), "aria-describedby": describedBy, isInvalid: isInvalid,
38
+ // Disabled while the form submits, having no read-only mode: a change made meanwhile would be lost to the save.
39
+ isDisabled: sliderProps.isDisabled || isDisabled || isLocked }), errorMessage && (jsxRuntime.jsx(Input.HintText, { isInvalid: true, id: errorId, children: errorMessage }))] }));
40
+ };
41
+
42
+ exports.FormSlider = FormSlider;
43
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormSlider/index.tsx"],"sourcesContent":[null],"names":["useFormField","useFocusTarget","useId","joinIds","_jsxs","_jsx","Slider","HintText"],"mappings":";;;;;;;;;;AAqBA;;;;;;AAMG;MACU,UAAU,GAAG,CAA4C,EACpE,IAAI,EACJ,WAAW,EACX,QAAQ,GAAG,CAAC,EACZ,IAAI,EACJ,GAAG,WAAW,EACW,KAAI;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAEjJ,MAAM,QAAQ,GAAGC,6BAAc,CAAC,GAAG,EAAE,OAAO,CAAC;AAC7C,IAAA,MAAM,OAAO,GAAGC,WAAK,EAAE;AACvB,IAAA,MAAM,WAAW,GAAGC,qBAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAE,YAAY,IAAI,OAAO,CAAC;;IAErF,MAAM,QAAQ,GAAG,CAAC,IAAuB,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;;AAEpF,IAAA,MAAM,IAAI,GAAG,CAAC,KAAiC,KAAI;QACjD,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;AAAE,YAAA,MAAM,EAAE;AAClE,IAAA,CAAC;IAED;;AAEE,IAAAC,eAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAC,8BAA8B,EAAA,QAAA,EAAA,CACxEC,eAACC,aAAM,EAAA,EAAA,GACD,WAAW,EACf,QAAQ,EAAE,QAAQ;;gBAElB,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;;AAErC,gBAAA,KAAK,EAAE,KAAK,IAAI,QAAQ,EACxB,QAAQ,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAC3C,WAAW,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAA,kBAAA,EAC7B,WAAW,EAC7B,SAAS,EAAE,SAAS;;gBAEpB,UAAU,EAAE,WAAW,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,CAC5D,EACD,YAAY,KACXD,cAAA,CAACE,cAAQ,EAAA,EAAC,SAAS,EAAA,IAAA,EAAC,EAAE,EAAE,OAAO,EAAA,QAAA,EAC5B,YAAY,EAAA,CACJ,CACZ,CAAA,EAAA,CACG;AAEV;;"}
@@ -0,0 +1,20 @@
1
+ import { type SliderProps } from '@flipdish/ui-library/components/atoms/Slider';
2
+ import type { FieldPath, FieldValues } from 'react-hook-form';
3
+ export interface FormSliderProps<TValues extends FieldValues = FieldValues> extends Omit<SliderProps, 'name' | 'value' | 'defaultValue' | 'onChange' | 'onChangeEnd' | 'isInvalid'> {
4
+ /** The field's path in the form values, such as `discount` or `tip.percent`. */
5
+ name: FieldPath<TValues>;
6
+ /**
7
+ * Other fields to re-validate when this changes. A `crossFieldRules` rule validated through `useSchemaResolver` names them
8
+ * itself, so pass this only for a rule written another way, such as a zod `superRefine` in the same schema, or for a nested field.
9
+ */
10
+ revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
11
+ }
12
+ /**
13
+ * A single-thumb `Slider` bound to a react-hook-form field: moving the thumb updates the field's number, and releasing
14
+ * it validates, with the field's error shown beneath the slider in place of `hint`. Use it for a bounded number the user
15
+ * adjusts by feel.
16
+ *
17
+ * @summary single-thumb slider bound to a react-hook-form field
18
+ */
19
+ export declare const FormSlider: <TValues extends FieldValues = FieldValues>({ name, revalidates, minValue, hint, ...sliderProps }: FormSliderProps<TValues>) => import("react").JSX.Element;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormSlider/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9D,MAAM,WAAW,eAAe,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CACxE,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,GAAG,WAAW,CAAC;IACvG,gFAAgF;IAChF,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,uDAMnE,eAAe,CAAC,OAAO,CAAC,gCAqC1B,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { HintText } from '@flipdish/ui-library/components/atoms/Input';
3
+ import { Slider } from '@flipdish/ui-library/components/atoms/Slider';
4
+ import { useId } from 'react';
5
+ import { useFocusTarget } from '../../__internal__/formField/hooks/useFocusTarget.js';
6
+ import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
7
+ import { joinIds } from '../../../../utilities/__internal__/ariaIdsUtils/ariaIds.utils.js';
8
+
9
+ /**
10
+ * A single-thumb `Slider` bound to a react-hook-form field: moving the thumb updates the field's number, and releasing
11
+ * it validates, with the field's error shown beneath the slider in place of `hint`. Use it for a bounded number the user
12
+ * adjusts by feel.
13
+ *
14
+ * @summary single-thumb slider bound to a react-hook-form field
15
+ */
16
+ const FormSlider = ({ name, revalidates, minValue = 0, hint, ...sliderProps }) => {
17
+ const { value, ref, onDraft, onCommit, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
18
+ // `Slider` takes no ref, so the wrapper hands the form the thumb's input.
19
+ const focusRef = useFocusTarget(ref, 'input');
20
+ const errorId = useId();
21
+ const describedBy = joinIds(sliderProps['aria-describedby'], errorMessage && errorId);
22
+ // A single thumb reports a number; the range type of `Slider` also allows an array.
23
+ const toNumber = (next) => (Array.isArray(next) ? next[0] : next);
24
+ // `Slider` has no `onBlur`, so the wrapper hears the thumb's: leaving the slider untouched still marks the field visited and validates it.
25
+ const blur = (event) => {
26
+ if (!event.currentTarget.contains(event.relatedTarget))
27
+ onBlur();
28
+ };
29
+ return (
30
+ // biome-ignore lint/a11y/noStaticElementInteractions: it only hears the thumb's blur as it bubbles, and takes no interaction itself
31
+ jsxs("div", { ref: focusRef, onBlur: blur, className: "flex w-full flex-col gap-1.5", children: [jsx(Slider, { ...sliderProps, minValue: minValue,
32
+ // The error takes the hint's place, as it does on the other fields.
33
+ hint: errorMessage ? undefined : hint,
34
+ // An unset field is `undefined`, which would flip the slider between uncontrolled and controlled.
35
+ value: value ?? minValue, onChange: (next) => onDraft(toNumber(next)), onChangeEnd: (next) => onCommit(toNumber(next)), "aria-describedby": describedBy, isInvalid: isInvalid,
36
+ // Disabled while the form submits, having no read-only mode: a change made meanwhile would be lost to the save.
37
+ isDisabled: sliderProps.isDisabled || isDisabled || isLocked }), errorMessage && (jsx(HintText, { isInvalid: true, id: errorId, children: errorMessage }))] }));
38
+ };
39
+
40
+ export { FormSlider };
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormSlider/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAqBA;;;;;;AAMG;MACU,UAAU,GAAG,CAA4C,EACpE,IAAI,EACJ,WAAW,EACX,QAAQ,GAAG,CAAC,EACZ,IAAI,EACJ,GAAG,WAAW,EACW,KAAI;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;;IAEjJ,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC;AAC7C,IAAA,MAAM,OAAO,GAAG,KAAK,EAAE;AACvB,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAE,YAAY,IAAI,OAAO,CAAC;;IAErF,MAAM,QAAQ,GAAG,CAAC,IAAuB,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;;AAEpF,IAAA,MAAM,IAAI,GAAG,CAAC,KAAiC,KAAI;QACjD,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;AAAE,YAAA,MAAM,EAAE;AAClE,IAAA,CAAC;IAED;;AAEE,IAAAA,IAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAC,8BAA8B,EAAA,QAAA,EAAA,CACxEC,IAAC,MAAM,EAAA,EAAA,GACD,WAAW,EACf,QAAQ,EAAE,QAAQ;;gBAElB,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;;AAErC,gBAAA,KAAK,EAAE,KAAK,IAAI,QAAQ,EACxB,QAAQ,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAC3C,WAAW,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAA,kBAAA,EAC7B,WAAW,EAC7B,SAAS,EAAE,SAAS;;gBAEpB,UAAU,EAAE,WAAW,CAAC,UAAU,IAAI,UAAU,IAAI,QAAQ,EAAA,CAC5D,EACD,YAAY,KACXA,GAAA,CAAC,QAAQ,EAAA,EAAC,SAAS,EAAA,IAAA,EAAC,EAAE,EAAE,OAAO,EAAA,QAAA,EAC5B,YAAY,EAAA,CACJ,CACZ,CAAA,EAAA,CACG;AAEV;;"}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var TextArea = require('@flipdish/ui-library/components/molecules/TextArea');
5
+ var useFormField = require('../../__internal__/formField/hooks/useFormField.cjs');
6
+
7
+ /**
8
+ * A `TextArea` bound to a react-hook-form field: it reads and writes the field's value, marks itself invalid and shows
9
+ * the field's error in place of `hint`. Use it for every multi-line text field in a form built with react-hook-form.
10
+ *
11
+ * @summary multi-line text field bound to a react-hook-form field
12
+ */
13
+ const FormTextArea = ({ name, revalidates, hint, ...textAreaProps }) => {
14
+ const { value, ref, onChange, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField.useFormField(name, revalidates);
15
+ return (jsxRuntime.jsx(TextArea.TextArea
16
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
17
+ , {
18
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
19
+ validationBehavior: "aria", ...textAreaProps, name: name, textAreaRef: ref, onChange: onChange, onBlur: onBlur,
20
+ // An unset field is `undefined`, which would flip the textarea between uncontrolled and controlled.
21
+ value: value ?? '', isInvalid: isInvalid, hint: errorMessage ?? hint, isDisabled: textAreaProps.isDisabled || isDisabled,
22
+ // Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
23
+ isReadOnly: textAreaProps.isReadOnly || isLocked }));
24
+ };
25
+
26
+ exports.FormTextArea = FormTextArea;
27
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../src/components/forms/fields/FormTextArea/index.tsx"],"sourcesContent":[null],"names":["useFormField","_jsx","TextArea"],"mappings":";;;;;;AAiBA;;;;;AAKG;AACI,MAAM,YAAY,GAAG,CAA4C,EACtE,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,GAAG,aAAa,EACW,KAAI;IAC/B,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,yBAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;IAExI,QACEC,eAACC;;;;AAEC,QAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,aAAa,EACjB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,GAAG,EAChB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM;;QAEd,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI,EAC1B,UAAU,EAAE,aAAa,CAAC,UAAU,IAAI,UAAU;;QAElD,UAAU,EAAE,aAAa,CAAC,UAAU,IAAI,QAAQ,EAAA,CAChD;AAEN;;"}
@@ -0,0 +1,19 @@
1
+ import { type TextFieldProps } from '@flipdish/ui-library/components/molecules/TextArea';
2
+ import type { FieldPath, FieldValues } from 'react-hook-form';
3
+ export interface FormTextAreaProps<TValues extends FieldValues = FieldValues> extends Omit<TextFieldProps, 'name' | 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'isInvalid' | 'ref' | 'textAreaRef'> {
4
+ /** The field's path in the form values, such as `notes` or `address.line2`. */
5
+ name: FieldPath<TValues>;
6
+ /**
7
+ * Other fields to re-validate when this changes. A `crossFieldRules` rule validated through `useSchemaResolver` names them
8
+ * itself, so pass this only for a rule written another way, such as a zod `superRefine` in the same schema, or for a nested field.
9
+ */
10
+ revalidates?: FieldPath<TValues> | FieldPath<TValues>[];
11
+ }
12
+ /**
13
+ * A `TextArea` bound to a react-hook-form field: it reads and writes the field's value, marks itself invalid and shows
14
+ * the field's error in place of `hint`. Use it for every multi-line text field in a form built with react-hook-form.
15
+ *
16
+ * @summary multi-line text field bound to a react-hook-form field
17
+ */
18
+ export declare const FormTextArea: <TValues extends FieldValues = FieldValues>({ name, revalidates, hint, ...textAreaProps }: FormTextAreaProps<TValues>) => import("react").JSX.Element;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/forms/fields/FormTextArea/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9D,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAC1E,SAAQ,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,GAAG,aAAa,CAAC;IAC7H,+EAA+E;IAC/E,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,+CAKrE,iBAAiB,CAAC,OAAO,CAAC,gCAqB5B,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { TextArea } from '@flipdish/ui-library/components/molecules/TextArea';
3
+ import { useFormField } from '../../__internal__/formField/hooks/useFormField.js';
4
+
5
+ /**
6
+ * A `TextArea` bound to a react-hook-form field: it reads and writes the field's value, marks itself invalid and shows
7
+ * the field's error in place of `hint`. Use it for every multi-line text field in a form built with react-hook-form.
8
+ *
9
+ * @summary multi-line text field bound to a react-hook-form field
10
+ */
11
+ const FormTextArea = ({ name, revalidates, hint, ...textAreaProps }) => {
12
+ const { value, ref, onChange, onBlur, isInvalid, errorMessage, isDisabled, isLocked } = useFormField(name, revalidates);
13
+ return (jsx(TextArea
14
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
15
+ , {
16
+ // The form's schema validates; the browser's own `required` check would block the submit before it runs.
17
+ validationBehavior: "aria", ...textAreaProps, name: name, textAreaRef: ref, onChange: onChange, onBlur: onBlur,
18
+ // An unset field is `undefined`, which would flip the textarea between uncontrolled and controlled.
19
+ value: value ?? '', isInvalid: isInvalid, hint: errorMessage ?? hint, isDisabled: textAreaProps.isDisabled || isDisabled,
20
+ // Read-only while the form submits: the field keeps its focus and its value, and nothing typed meanwhile is lost to the save.
21
+ isReadOnly: textAreaProps.isReadOnly || isLocked }));
22
+ };
23
+
24
+ export { FormTextArea };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/forms/fields/FormTextArea/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;AAiBA;;;;;AAKG;AACI,MAAM,YAAY,GAAG,CAA4C,EACtE,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,GAAG,aAAa,EACW,KAAI;IAC/B,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAkB,IAAI,EAAE,WAAW,CAAC;IAExI,QACEA,IAAC;;;;AAEC,QAAA,kBAAkB,EAAC,MAAM,EAAA,GACrB,aAAa,EACjB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,GAAG,EAChB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM;;QAEd,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,YAAY,IAAI,IAAI,EAC1B,UAAU,EAAE,aAAa,CAAC,UAAU,IAAI,UAAU;;QAElD,UAAU,EAAE,aAAa,CAAC,UAAU,IAAI,QAAQ,EAAA,CAChD;AAEN;;"}