@alma-oss/spirit-web-react 4.4.2 → 4.5.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 (417) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/DEPRECATIONS.md +2 -2
  3. package/README.md +135 -6
  4. package/dist/bundles/web-react.umd.js +1731 -624
  5. package/dist/bundles/web-react.umd.js.map +1 -1
  6. package/dist/bundles/web-react.umd.min.js +1 -1
  7. package/dist/bundles/web-react.umd.min.js.map +1 -1
  8. package/dist/components/Button/Button.cjs +1 -1
  9. package/dist/components/Button/Button.cjs.map +1 -1
  10. package/dist/components/Button/Button.js +19 -19
  11. package/dist/components/Button/Button.js.map +1 -1
  12. package/dist/components/ButtonLink/ButtonLink.cjs +1 -1
  13. package/dist/components/ButtonLink/ButtonLink.cjs.map +1 -1
  14. package/dist/components/ButtonLink/ButtonLink.d.ts +2 -2
  15. package/dist/components/ButtonLink/ButtonLink.js +23 -18
  16. package/dist/components/ButtonLink/ButtonLink.js.map +1 -1
  17. package/dist/components/ButtonLink/useButtonLinkStyleProps.cjs.map +1 -1
  18. package/dist/components/ButtonLink/useButtonLinkStyleProps.d.ts +9 -9
  19. package/dist/components/ButtonLink/useButtonLinkStyleProps.js.map +1 -1
  20. package/dist/components/Card/CardLink.cjs +1 -1
  21. package/dist/components/Card/CardLink.cjs.map +1 -1
  22. package/dist/components/Card/CardLink.d.ts +2 -2
  23. package/dist/components/Card/CardLink.js +10 -15
  24. package/dist/components/Card/CardLink.js.map +1 -1
  25. package/dist/components/CharacterCounter/CharacterCounter.cjs +2 -0
  26. package/dist/components/CharacterCounter/CharacterCounter.cjs.map +1 -0
  27. package/dist/components/CharacterCounter/CharacterCounter.d.ts +7 -0
  28. package/dist/components/CharacterCounter/CharacterCounter.js +23 -0
  29. package/dist/components/CharacterCounter/CharacterCounter.js.map +1 -0
  30. package/dist/components/CharacterCounter/constants.cjs +2 -0
  31. package/dist/components/CharacterCounter/constants.cjs.map +1 -0
  32. package/dist/components/CharacterCounter/constants.d.ts +1 -0
  33. package/dist/components/CharacterCounter/constants.js +5 -0
  34. package/dist/components/CharacterCounter/constants.js.map +1 -0
  35. package/dist/components/CharacterCounter/index.cjs +2 -0
  36. package/dist/components/CharacterCounter/index.d.ts +3 -0
  37. package/dist/components/CharacterCounter/index.js +7 -0
  38. package/dist/components/{UNSTABLE_Attachment → CharacterCounter}/index.js.map +1 -1
  39. package/dist/components/CharacterCounter/types.d.ts +6 -0
  40. package/dist/components/CharacterCounter/useCharacterCounterState.cjs +2 -0
  41. package/dist/components/CharacterCounter/useCharacterCounterState.cjs.map +1 -0
  42. package/dist/components/CharacterCounter/useCharacterCounterState.d.ts +25 -0
  43. package/dist/components/CharacterCounter/useCharacterCounterState.js +66 -0
  44. package/dist/components/CharacterCounter/useCharacterCounterState.js.map +1 -0
  45. package/dist/components/CharacterCounter.d.ts +2 -0
  46. package/dist/components/Checkbox/Checkbox.cjs +1 -1
  47. package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
  48. package/dist/components/Checkbox/Checkbox.js +58 -54
  49. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  50. package/dist/components/ControlButton/useControlButtonStyleProps.cjs.map +1 -1
  51. package/dist/components/ControlButton/useControlButtonStyleProps.js.map +1 -1
  52. package/dist/components/Dropdown/DropdownPopover.cjs.map +1 -1
  53. package/dist/components/Dropdown/DropdownPopover.d.ts +2 -2
  54. package/dist/components/Dropdown/DropdownPopover.js.map +1 -1
  55. package/dist/components/Field/index.cjs +1 -1
  56. package/dist/components/Field/index.d.ts +0 -2
  57. package/dist/components/Field/index.js +2 -4
  58. package/dist/components/Field/index.js.map +1 -1
  59. package/dist/components/Field/types.d.ts +1 -1
  60. package/dist/components/FieldGroup/FieldGroup.cjs +1 -1
  61. package/dist/components/FieldGroup/FieldGroup.cjs.map +1 -1
  62. package/dist/components/FieldGroup/FieldGroup.js +15 -16
  63. package/dist/components/FieldGroup/FieldGroup.js.map +1 -1
  64. package/dist/components/FileUploader/FileUploaderInput.cjs +1 -1
  65. package/dist/components/FileUploader/FileUploaderInput.cjs.map +1 -1
  66. package/dist/components/FileUploader/FileUploaderInput.js +36 -35
  67. package/dist/components/FileUploader/FileUploaderInput.js.map +1 -1
  68. package/dist/components/Header/HeaderDialogLink.cjs +1 -1
  69. package/dist/components/Header/HeaderDialogLink.cjs.map +1 -1
  70. package/dist/components/Header/HeaderDialogLink.js +18 -17
  71. package/dist/components/Header/HeaderDialogLink.js.map +1 -1
  72. package/dist/components/Header/HeaderLink.cjs +1 -1
  73. package/dist/components/Header/HeaderLink.cjs.map +1 -1
  74. package/dist/components/Header/HeaderLink.js +16 -15
  75. package/dist/components/Header/HeaderLink.js.map +1 -1
  76. package/dist/components/InputDetails/InputDetails.cjs +2 -0
  77. package/dist/components/InputDetails/InputDetails.cjs.map +1 -0
  78. package/dist/components/InputDetails/InputDetails.d.ts +7 -0
  79. package/dist/components/InputDetails/InputDetails.js +21 -0
  80. package/dist/components/InputDetails/InputDetails.js.map +1 -0
  81. package/dist/components/InputDetails/index.cjs +2 -0
  82. package/dist/components/InputDetails/index.cjs.map +1 -0
  83. package/dist/components/InputDetails/index.d.ts +2 -0
  84. package/dist/components/InputDetails/index.js +7 -0
  85. package/dist/components/InputDetails/index.js.map +1 -0
  86. package/dist/components/InputDetails/useInputDetailsStyleProps.cjs +2 -0
  87. package/dist/components/InputDetails/useInputDetailsStyleProps.cjs.map +1 -0
  88. package/dist/components/InputDetails/useInputDetailsStyleProps.d.ts +7 -0
  89. package/dist/components/InputDetails/useInputDetailsStyleProps.js +11 -0
  90. package/dist/components/InputDetails/useInputDetailsStyleProps.js.map +1 -0
  91. package/dist/components/InputDetails.d.ts +2 -0
  92. package/dist/components/Link/Link.cjs +1 -1
  93. package/dist/components/Link/Link.cjs.map +1 -1
  94. package/dist/components/Link/Link.js +10 -9
  95. package/dist/components/Link/Link.js.map +1 -1
  96. package/dist/components/Link/useLinkStyleProps.cjs.map +1 -1
  97. package/dist/components/Link/useLinkStyleProps.d.ts +1 -1
  98. package/dist/components/Link/useLinkStyleProps.js.map +1 -1
  99. package/dist/components/Pagination/PaginationLink.cjs +1 -1
  100. package/dist/components/Pagination/PaginationLink.cjs.map +1 -1
  101. package/dist/components/Pagination/PaginationLink.js +29 -18
  102. package/dist/components/Pagination/PaginationLink.js.map +1 -1
  103. package/dist/components/Radio/Radio.cjs +1 -1
  104. package/dist/components/Radio/Radio.cjs.map +1 -1
  105. package/dist/components/Radio/Radio.js +24 -25
  106. package/dist/components/Radio/Radio.js.map +1 -1
  107. package/dist/components/ScrollView/useScrollPosition.js +4 -4
  108. package/dist/components/Select/Select.cjs +1 -1
  109. package/dist/components/Select/Select.cjs.map +1 -1
  110. package/dist/components/Select/Select.js +28 -29
  111. package/dist/components/Select/Select.js.map +1 -1
  112. package/dist/components/Slider/Slider.cjs +1 -1
  113. package/dist/components/Slider/Slider.cjs.map +1 -1
  114. package/dist/components/Slider/Slider.js +23 -24
  115. package/dist/components/Slider/Slider.js.map +1 -1
  116. package/dist/components/Tabs/TabLink.cjs +1 -1
  117. package/dist/components/Tabs/TabLink.cjs.map +1 -1
  118. package/dist/components/Tabs/TabLink.js +18 -17
  119. package/dist/components/Tabs/TabLink.js.map +1 -1
  120. package/dist/components/Tag/constants.cjs +1 -1
  121. package/dist/components/Tag/constants.cjs.map +1 -1
  122. package/dist/components/Tag/constants.d.ts +1 -0
  123. package/dist/components/Tag/constants.js +4 -3
  124. package/dist/components/Tag/constants.js.map +1 -1
  125. package/dist/components/Tag/useTagStyleProps.cjs +1 -1
  126. package/dist/components/Tag/useTagStyleProps.cjs.map +1 -1
  127. package/dist/components/Tag/useTagStyleProps.js +25 -10
  128. package/dist/components/Tag/useTagStyleProps.js.map +1 -1
  129. package/dist/components/TextArea/TextArea.cjs +1 -1
  130. package/dist/components/TextArea/TextArea.cjs.map +1 -1
  131. package/dist/components/TextArea/TextArea.js +57 -21
  132. package/dist/components/TextArea/TextArea.js.map +1 -1
  133. package/dist/components/TextArea/constants.cjs +2 -0
  134. package/dist/components/TextArea/constants.cjs.map +1 -0
  135. package/dist/components/TextArea/constants.d.ts +1 -0
  136. package/dist/components/TextArea/constants.js +5 -0
  137. package/dist/components/TextArea/constants.js.map +1 -0
  138. package/dist/components/TextFieldBase/TextFieldBase.cjs +1 -1
  139. package/dist/components/TextFieldBase/TextFieldBase.cjs.map +1 -1
  140. package/dist/components/TextFieldBase/TextFieldBase.js +69 -59
  141. package/dist/components/TextFieldBase/TextFieldBase.js.map +1 -1
  142. package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.cjs +1 -1
  143. package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.cjs.map +1 -1
  144. package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.d.ts +1 -0
  145. package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.js +11 -10
  146. package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.js.map +1 -1
  147. package/dist/components/Toggle/Toggle.cjs +1 -1
  148. package/dist/components/Toggle/Toggle.cjs.map +1 -1
  149. package/dist/components/Toggle/Toggle.js +59 -55
  150. package/dist/components/Toggle/Toggle.js.map +1 -1
  151. package/dist/components/UNSTABLE_File/UNSTABLE_File.cjs +2 -0
  152. package/dist/components/UNSTABLE_File/UNSTABLE_File.cjs.map +1 -0
  153. package/dist/components/UNSTABLE_File/UNSTABLE_File.d.ts +8 -0
  154. package/dist/components/UNSTABLE_File/UNSTABLE_File.js +88 -0
  155. package/dist/components/UNSTABLE_File/UNSTABLE_File.js.map +1 -0
  156. package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.cjs +2 -0
  157. package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.cjs.map +1 -0
  158. package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.d.ts +8 -0
  159. package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.js +29 -0
  160. package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.js.map +1 -0
  161. package/dist/components/UNSTABLE_File/constants.cjs +2 -0
  162. package/dist/components/UNSTABLE_File/constants.cjs.map +1 -0
  163. package/dist/components/UNSTABLE_File/constants.d.ts +9 -0
  164. package/dist/components/UNSTABLE_File/constants.js +13 -0
  165. package/dist/components/UNSTABLE_File/constants.js.map +1 -0
  166. package/dist/components/UNSTABLE_File/index.cjs +2 -0
  167. package/dist/components/UNSTABLE_File/index.cjs.map +1 -0
  168. package/dist/components/UNSTABLE_File/index.d.ts +6 -0
  169. package/dist/components/UNSTABLE_File/index.js +16 -0
  170. package/dist/components/UNSTABLE_File/index.js.map +1 -0
  171. package/dist/components/UNSTABLE_File/types.d.ts +48 -0
  172. package/dist/components/UNSTABLE_File/useFileImageStyles.cjs +2 -0
  173. package/dist/components/UNSTABLE_File/useFileImageStyles.cjs.map +1 -0
  174. package/dist/components/UNSTABLE_File/useFileImageStyles.d.ts +19 -0
  175. package/dist/components/UNSTABLE_File/useFileImageStyles.js +21 -0
  176. package/dist/components/UNSTABLE_File/useFileImageStyles.js.map +1 -0
  177. package/dist/components/UNSTABLE_File/useFileStyleProps.cjs +2 -0
  178. package/dist/components/UNSTABLE_File/useFileStyleProps.cjs.map +1 -0
  179. package/dist/components/UNSTABLE_File/useFileStyleProps.d.ts +20 -0
  180. package/dist/components/UNSTABLE_File/useFileStyleProps.js +29 -0
  181. package/dist/components/UNSTABLE_File/useFileStyleProps.js.map +1 -0
  182. package/dist/components/UNSTABLE_File.d.ts +2 -0
  183. package/dist/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.cjs +1 -1
  184. package/dist/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.cjs.map +1 -1
  185. package/dist/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.js +129 -112
  186. package/dist/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.js.map +1 -1
  187. package/dist/components/UNSTABLE_FileUpload/types.d.ts +6 -3
  188. package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.cjs +1 -1
  189. package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.cjs.map +1 -1
  190. package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.d.ts +2 -3
  191. package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.js +18 -16
  192. package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.js.map +1 -1
  193. package/dist/components/UNSTABLE_Picker/PickerContext.cjs +2 -0
  194. package/dist/components/UNSTABLE_Picker/PickerContext.cjs.map +1 -0
  195. package/dist/components/UNSTABLE_Picker/PickerContext.d.ts +3 -0
  196. package/dist/components/UNSTABLE_Picker/PickerContext.js +9 -0
  197. package/dist/components/UNSTABLE_Picker/PickerContext.js.map +1 -0
  198. package/dist/components/UNSTABLE_Picker/PickerPopoverContext.cjs +2 -0
  199. package/dist/components/UNSTABLE_Picker/PickerPopoverContext.cjs.map +1 -0
  200. package/dist/components/UNSTABLE_Picker/PickerPopoverContext.d.ts +3 -0
  201. package/dist/components/UNSTABLE_Picker/PickerPopoverContext.js +16 -0
  202. package/dist/components/UNSTABLE_Picker/PickerPopoverContext.js.map +1 -0
  203. package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.cjs +2 -0
  204. package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.cjs.map +1 -0
  205. package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.d.ts +4 -0
  206. package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.js +204 -0
  207. package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.js.map +1 -0
  208. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.cjs +2 -0
  209. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.cjs.map +1 -0
  210. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.d.ts +7 -0
  211. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.js +14 -0
  212. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.js.map +1 -0
  213. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.cjs +2 -0
  214. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.cjs.map +1 -0
  215. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.d.ts +7 -0
  216. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.js +32 -0
  217. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.js.map +1 -0
  218. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.cjs +2 -0
  219. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.cjs.map +1 -0
  220. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.d.ts +7 -0
  221. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.js +64 -0
  222. package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.js.map +1 -0
  223. package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.cjs +2 -0
  224. package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.cjs.map +1 -0
  225. package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.d.ts +4 -0
  226. package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.js +40 -0
  227. package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.js.map +1 -0
  228. package/dist/components/UNSTABLE_Picker/constants.cjs +2 -0
  229. package/dist/components/UNSTABLE_Picker/constants.cjs.map +1 -0
  230. package/dist/components/UNSTABLE_Picker/constants.d.ts +6 -0
  231. package/dist/components/UNSTABLE_Picker/constants.js +11 -0
  232. package/dist/components/UNSTABLE_Picker/constants.js.map +1 -0
  233. package/dist/components/UNSTABLE_Picker/index.cjs +2 -0
  234. package/dist/components/UNSTABLE_Picker/index.cjs.map +1 -0
  235. package/dist/components/UNSTABLE_Picker/index.d.ts +11 -0
  236. package/dist/components/UNSTABLE_Picker/index.js +26 -0
  237. package/dist/components/UNSTABLE_Picker/index.js.map +1 -0
  238. package/dist/components/UNSTABLE_Picker/types.d.ts +91 -0
  239. package/dist/components/UNSTABLE_Picker/usePickerId.cjs +2 -0
  240. package/dist/components/UNSTABLE_Picker/usePickerId.cjs.map +1 -0
  241. package/dist/components/UNSTABLE_Picker/usePickerId.d.ts +8 -0
  242. package/dist/components/UNSTABLE_Picker/usePickerId.js +15 -0
  243. package/dist/components/UNSTABLE_Picker/usePickerId.js.map +1 -0
  244. package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.cjs +2 -0
  245. package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.cjs.map +1 -0
  246. package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.d.ts +11 -0
  247. package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.js +27 -0
  248. package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.js.map +1 -0
  249. package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.cjs +2 -0
  250. package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.cjs.map +1 -0
  251. package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.d.ts +13 -0
  252. package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.js +95 -0
  253. package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.js.map +1 -0
  254. package/dist/components/UNSTABLE_Picker/usePickerStyleProps.cjs +2 -0
  255. package/dist/components/UNSTABLE_Picker/usePickerStyleProps.cjs.map +1 -0
  256. package/dist/components/UNSTABLE_Picker/usePickerStyleProps.d.ts +21 -0
  257. package/dist/components/UNSTABLE_Picker/usePickerStyleProps.js +29 -0
  258. package/dist/components/UNSTABLE_Picker/usePickerStyleProps.js.map +1 -0
  259. package/dist/components/UNSTABLE_Picker/utils.cjs +2 -0
  260. package/dist/components/UNSTABLE_Picker/utils.cjs.map +1 -0
  261. package/dist/components/UNSTABLE_Picker/utils.d.ts +10 -0
  262. package/dist/components/UNSTABLE_Picker/utils.js +41 -0
  263. package/dist/components/UNSTABLE_Picker/utils.js.map +1 -0
  264. package/dist/components/UNSTABLE_Picker.d.ts +2 -0
  265. package/dist/components/index.cjs +1 -1
  266. package/dist/components/index.d.ts +4 -1
  267. package/dist/components/index.js +523 -498
  268. package/dist/components/index.js.map +1 -1
  269. package/dist/constants/index.cjs +1 -1
  270. package/dist/constants/index.d.ts +1 -0
  271. package/dist/constants/index.js +43 -40
  272. package/dist/constants/index.js.map +1 -1
  273. package/dist/constants/selection.cjs +2 -0
  274. package/dist/constants/selection.cjs.map +1 -0
  275. package/dist/constants/selection.d.ts +2 -0
  276. package/dist/constants/selection.js +6 -0
  277. package/dist/constants/selection.js.map +1 -0
  278. package/dist/context/RouterContext.cjs +2 -0
  279. package/dist/context/RouterContext.cjs.map +1 -0
  280. package/dist/context/RouterContext.d.ts +16 -0
  281. package/dist/context/RouterContext.js +12 -0
  282. package/dist/context/RouterContext.js.map +1 -0
  283. package/dist/context/index.cjs +1 -1
  284. package/dist/context/index.d.ts +1 -0
  285. package/dist/context/index.js +11 -7
  286. package/dist/context/index.js.map +1 -1
  287. package/dist/hooks/index.cjs +1 -1
  288. package/dist/hooks/index.d.ts +5 -1
  289. package/dist/hooks/index.js +54 -40
  290. package/dist/hooks/index.js.map +1 -1
  291. package/dist/hooks/useAriaIdRefs.cjs +2 -0
  292. package/dist/hooks/useAriaIdRefs.cjs.map +1 -0
  293. package/dist/hooks/useAriaIdRefs.d.ts +11 -0
  294. package/dist/hooks/useAriaIdRefs.js +23 -0
  295. package/dist/hooks/useAriaIdRefs.js.map +1 -0
  296. package/dist/hooks/useControlledModeGuard.cjs +2 -0
  297. package/dist/hooks/useControlledModeGuard.cjs.map +1 -0
  298. package/dist/hooks/useControlledModeGuard.d.ts +10 -0
  299. package/dist/hooks/useControlledModeGuard.js +33 -0
  300. package/dist/hooks/useControlledModeGuard.js.map +1 -0
  301. package/dist/hooks/useDebouncedValue.cjs +2 -0
  302. package/dist/hooks/useDebouncedValue.cjs.map +1 -0
  303. package/dist/hooks/useDebouncedValue.d.ts +1 -0
  304. package/dist/hooks/useDebouncedValue.js +17 -0
  305. package/dist/hooks/useDebouncedValue.js.map +1 -0
  306. package/dist/hooks/useLinkClick.cjs +2 -0
  307. package/dist/hooks/useLinkClick.cjs.map +1 -0
  308. package/dist/hooks/useLinkClick.d.ts +4 -0
  309. package/dist/hooks/useLinkClick.js +15 -0
  310. package/dist/hooks/useLinkClick.js.map +1 -0
  311. package/dist/hooks/useSelectionState.cjs +2 -0
  312. package/dist/hooks/useSelectionState.cjs.map +1 -0
  313. package/dist/hooks/useSelectionState.d.ts +17 -0
  314. package/dist/hooks/useSelectionState.js +41 -0
  315. package/dist/hooks/useSelectionState.js.map +1 -0
  316. package/dist/index.cjs +1 -1
  317. package/dist/index.js +722 -673
  318. package/dist/index.js.map +1 -1
  319. package/dist/translations/defaults.cjs +1 -1
  320. package/dist/translations/defaults.cjs.map +1 -1
  321. package/dist/translations/defaults.d.ts +17 -0
  322. package/dist/translations/defaults.js +17 -0
  323. package/dist/translations/defaults.js.map +1 -1
  324. package/dist/types/button.d.ts +3 -2
  325. package/dist/types/card.cjs.map +1 -1
  326. package/dist/types/card.d.ts +5 -7
  327. package/dist/types/card.js.map +1 -1
  328. package/dist/types/checkbox.d.ts +2 -2
  329. package/dist/types/controlButton.d.ts +2 -3
  330. package/dist/types/header.d.ts +3 -3
  331. package/dist/types/index.d.ts +1 -0
  332. package/dist/types/inputDetails.d.ts +9 -0
  333. package/dist/types/link.cjs.map +1 -1
  334. package/dist/types/link.d.ts +2 -2
  335. package/dist/types/link.js.map +1 -1
  336. package/dist/types/pagination.d.ts +4 -4
  337. package/dist/types/shared/index.cjs.map +1 -1
  338. package/dist/types/shared/index.d.ts +1 -0
  339. package/dist/types/shared/index.js.map +1 -1
  340. package/dist/types/shared/inputs.d.ts +3 -0
  341. package/dist/types/shared/router.d.ts +3 -0
  342. package/dist/types/tabs.d.ts +2 -2
  343. package/dist/types/tag.d.ts +1 -0
  344. package/dist/types/textArea.d.ts +26 -5
  345. package/dist/types/textFieldBase.d.ts +5 -2
  346. package/dist/types/toggle.d.ts +2 -2
  347. package/dist/utils/debounce.cjs +1 -1
  348. package/dist/utils/debounce.cjs.map +1 -1
  349. package/dist/utils/debounce.d.ts +4 -1
  350. package/dist/utils/debounce.js +11 -8
  351. package/dist/utils/debounce.js.map +1 -1
  352. package/dist/utils/index.cjs +1 -1
  353. package/dist/utils/index.d.ts +1 -0
  354. package/dist/utils/index.js +36 -33
  355. package/dist/utils/index.js.map +1 -1
  356. package/dist/utils/router.cjs +2 -0
  357. package/dist/utils/router.cjs.map +1 -0
  358. package/dist/utils/router.d.ts +12 -0
  359. package/dist/utils/router.js +10 -0
  360. package/dist/utils/router.js.map +1 -0
  361. package/dist/utils/string.cjs +1 -1
  362. package/dist/utils/string.cjs.map +1 -1
  363. package/dist/utils/string.d.ts +1 -0
  364. package/dist/utils/string.js +10 -9
  365. package/dist/utils/string.js.map +1 -1
  366. package/package.json +38 -23
  367. package/dist/components/Field/useAriaIds.cjs +0 -2
  368. package/dist/components/Field/useAriaIds.cjs.map +0 -1
  369. package/dist/components/Field/useAriaIds.d.ts +0 -8
  370. package/dist/components/Field/useAriaIds.js +0 -15
  371. package/dist/components/Field/useAriaIds.js.map +0 -1
  372. package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.cjs +0 -2
  373. package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.cjs.map +0 -1
  374. package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.d.ts +0 -8
  375. package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.js +0 -42
  376. package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.js.map +0 -1
  377. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.cjs +0 -2
  378. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.cjs.map +0 -1
  379. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.d.ts +0 -8
  380. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.js +0 -30
  381. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.js.map +0 -1
  382. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.cjs +0 -2
  383. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.cjs.map +0 -1
  384. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.d.ts +0 -8
  385. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.js +0 -29
  386. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.js.map +0 -1
  387. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.cjs +0 -2
  388. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.cjs.map +0 -1
  389. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.d.ts +0 -8
  390. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.js +0 -29
  391. package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.js.map +0 -1
  392. package/dist/components/UNSTABLE_Attachment/constants.cjs +0 -2
  393. package/dist/components/UNSTABLE_Attachment/constants.cjs.map +0 -1
  394. package/dist/components/UNSTABLE_Attachment/constants.d.ts +0 -9
  395. package/dist/components/UNSTABLE_Attachment/constants.js +0 -13
  396. package/dist/components/UNSTABLE_Attachment/constants.js.map +0 -1
  397. package/dist/components/UNSTABLE_Attachment/index.cjs +0 -2
  398. package/dist/components/UNSTABLE_Attachment/index.d.ts +0 -8
  399. package/dist/components/UNSTABLE_Attachment/index.js +0 -20
  400. package/dist/components/UNSTABLE_Attachment/types.d.ts +0 -42
  401. package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.cjs +0 -2
  402. package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.cjs.map +0 -1
  403. package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.d.ts +0 -18
  404. package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.js +0 -22
  405. package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.js.map +0 -1
  406. package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.cjs +0 -2
  407. package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.cjs.map +0 -1
  408. package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.d.ts +0 -21
  409. package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.js +0 -24
  410. package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.js.map +0 -1
  411. package/dist/components/UNSTABLE_Attachment.d.ts +0 -2
  412. package/dist/hooks/useAriaDescribedBy.cjs +0 -2
  413. package/dist/hooks/useAriaDescribedBy.cjs.map +0 -1
  414. package/dist/hooks/useAriaDescribedBy.d.ts +0 -5
  415. package/dist/hooks/useAriaDescribedBy.js +0 -7
  416. package/dist/hooks/useAriaDescribedBy.js.map +0 -1
  417. /package/dist/components/{UNSTABLE_Attachment → CharacterCounter}/index.cjs.map +0 -0
@@ -1,71 +1,81 @@
1
1
  "use client";
2
- import { jsxs as y, jsx as o } from "react/jsx-runtime";
3
- import b from "classnames";
4
- import { forwardRef as m } from "react";
5
- import { Sizes as S } from "../../constants/dictionaries.js";
6
- import { useStyleProps as _ } from "../../hooks/styleProps.js";
7
- import { useAriaDescribedBy as g } from "../../hooks/useAriaDescribedBy.js";
8
- import A from "../Field/HelperText.js";
9
- import v from "../Field/Label.js";
10
- import I from "../Field/useAriaIds.js";
11
- import w from "../Field/ValidationText.js";
12
- import { useValidationTextRole as D } from "../Field/useValidationTextRole.js";
13
- import E from "./TextFieldBaseInput.js";
14
- import { useTextFieldBaseStyleProps as U } from "./useTextFieldBaseStyleProps.js";
15
- import V from "./withPasswordToggle.js";
16
- const R = m(
17
- V(E)
18
- ), j = (d, n) => {
2
+ import { jsx as o, jsxs as i, Fragment as v } from "react/jsx-runtime";
3
+ import A from "classnames";
4
+ import { forwardRef as x } from "react";
5
+ import { Sizes as E } from "../../constants/dictionaries.js";
6
+ import { useStyleProps as w } from "../../hooks/styleProps.js";
7
+ import { useAriaDescribedBy as I } from "../../hooks/useAriaIdRefs.js";
8
+ import U from "../CharacterCounter/CharacterCounter.js";
9
+ import C from "../Field/HelperText.js";
10
+ import D from "../Field/Label.js";
11
+ import V from "../Field/ValidationText.js";
12
+ import { useValidationTextRole as z } from "../Field/useValidationTextRole.js";
13
+ import R from "../Flex/Flex.js";
14
+ import j from "./TextFieldBaseInput.js";
15
+ import { useTextFieldBaseStyleProps as M } from "./useTextFieldBaseStyleProps.js";
16
+ import W from "./withPasswordToggle.js";
17
+ const $ = x(
18
+ W(j)
19
+ ), H = (f, h) => {
19
20
  const {
20
- "aria-describedby": c = "",
21
- hasValidationIcon: x,
22
- helperText: T,
21
+ "aria-describedby": u = "",
22
+ counterProps: s,
23
+ hasValidationIcon: F,
24
+ helperText: n,
23
25
  id: e,
24
- label: f,
25
- size: s = S.MEDIUM,
26
+ label: g,
27
+ size: m = E.MEDIUM,
26
28
  validationState: t,
27
- validationText: i,
28
- ...h
29
- } = d, { classProps: r, props: u } = U({
29
+ validationText: a,
30
+ ...N
31
+ } = f, { classProps: r, props: P } = M({
30
32
  id: e,
31
- size: s,
33
+ size: m,
32
34
  validationState: t,
33
- ...h
34
- }), { styleProps: a, props: F } = _(u), [B, l] = I(c), N = g(B), P = D({
35
+ ...N
36
+ }), { styleProps: p, props: B } = w(P), [b, l] = I(u), y = z({
35
37
  validationState: t,
36
- validationText: i
37
- });
38
- return /* @__PURE__ */ y("div", { ...a, className: b(r.root, a.className), children: [
39
- /* @__PURE__ */ o(v, { htmlFor: e, UNSAFE_className: r.label, children: f }),
40
- /* @__PURE__ */ o(R, { ...F, ...N, id: e, ref: n, size: s }),
41
- /* @__PURE__ */ o(
42
- A,
43
- {
44
- UNSAFE_className: r.helperText,
45
- id: `${e}__helperText`,
46
- registerAria: l,
47
- helperText: T
48
- }
49
- ),
50
- t && /* @__PURE__ */ o(
51
- w,
52
- {
53
- UNSAFE_className: r.validationText,
54
- elementType: "span",
55
- ...x && { hasValidationStateIcon: t },
56
- id: `${e}__validationText`,
57
- validationText: i,
58
- registerAria: l,
59
- role: P
60
- }
61
- )
38
+ validationText: a
39
+ }), S = n || t && a, d = /* @__PURE__ */ o(
40
+ C,
41
+ {
42
+ UNSAFE_className: r.helperText,
43
+ id: `${e}__helper-text`,
44
+ registerAria: l,
45
+ helperText: n
46
+ }
47
+ ), c = t ? /* @__PURE__ */ o(
48
+ V,
49
+ {
50
+ UNSAFE_className: r.validationText,
51
+ elementType: "span",
52
+ ...F && { hasValidationStateIcon: t },
53
+ id: `${e}__validation-text`,
54
+ validationText: a,
55
+ registerAria: l,
56
+ role: y
57
+ }
58
+ ) : null, _ = s ? /* @__PURE__ */ o(U, { ...s, id: e, registerAria: l, UNSAFE_className: r.counter }) : null;
59
+ return /* @__PURE__ */ i("div", { ...p, className: A(r.root, p.className), children: [
60
+ /* @__PURE__ */ o(D, { htmlFor: e, UNSAFE_className: r.label, children: g }),
61
+ /* @__PURE__ */ o($, { ...B, ...b, id: e, ref: h, size: m }),
62
+ s ? /* @__PURE__ */ i(R, { direction: "horizontal", isWrapping: !1, alignmentX: "space-between", alignmentY: "top", children: [
63
+ S ? /* @__PURE__ */ i("div", { children: [
64
+ c,
65
+ d
66
+ ] }) : null,
67
+ _
68
+ ] }) : /* @__PURE__ */ i(v, { children: [
69
+ d,
70
+ c
71
+ ] })
62
72
  ] });
63
- }, p = m(
64
- j
73
+ }, T = x(
74
+ H
65
75
  );
66
- p.spiritComponent = "TextFieldBase";
67
- p.displayName = "TextFieldBase";
76
+ T.spiritComponent = "TextFieldBase";
77
+ T.displayName = "TextFieldBase";
68
78
  export {
69
- p as default
79
+ T as default
70
80
  };
71
81
  //# sourceMappingURL=TextFieldBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextFieldBase.js","sources":["../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ForwardedRef, forwardRef } from 'react';\nimport { Sizes } from '../../constants';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport {\n type ForwardRefComponent,\n type SpiritTextFieldBaseProps,\n type TextFieldBasePasswordToggleProps,\n} from '../../types';\nimport { HelperText, Label, ValidationText, useAriaIds } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport TextFieldBaseInput from './TextFieldBaseInput';\nimport { useTextFieldBaseStyleProps } from './useTextFieldBaseStyleProps';\nimport withPasswordToggle from './withPasswordToggle';\n\nconst TextFieldBaseInputWithPasswordToggle = forwardRef(\n withPasswordToggle<TextFieldBasePasswordToggleProps>(TextFieldBaseInput),\n);\n\nconst _TextFieldBase = (props: SpiritTextFieldBaseProps, ref: ForwardedRef<HTMLInputElement | HTMLTextAreaElement>) => {\n const {\n 'aria-describedby': ariaDescribedBy = '',\n hasValidationIcon,\n helperText,\n id,\n label,\n size = Sizes.MEDIUM,\n validationState,\n validationText,\n ...restProps\n } = props;\n const { classProps, props: modifiedProps } = useTextFieldBaseStyleProps({\n id,\n size,\n validationState,\n ...restProps,\n });\n const { styleProps, props: otherProps } = useStyleProps(modifiedProps);\n const [ids, register] = useAriaIds(ariaDescribedBy);\n const ariaDescribedByProp = useAriaDescribedBy(ids);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n return (\n <div {...styleProps} className={classNames(classProps.root, styleProps.className)}>\n <Label htmlFor={id} UNSAFE_className={classProps.label}>\n {label}\n </Label>\n <TextFieldBaseInputWithPasswordToggle {...otherProps} {...ariaDescribedByProp} id={id} ref={ref} size={size} />\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helperText`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n elementType=\"span\"\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validationText`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n </div>\n );\n};\n\nconst TextFieldBase = forwardRef<HTMLInputElement | HTMLTextAreaElement, SpiritTextFieldBaseProps>(\n _TextFieldBase,\n) as ForwardRefComponent<HTMLInputElement | HTMLTextAreaElement, SpiritTextFieldBaseProps>;\n\nTextFieldBase.spiritComponent = 'TextFieldBase';\nTextFieldBase.displayName = 'TextFieldBase';\n\nexport default TextFieldBase;\n"],"names":["TextFieldBaseInputWithPasswordToggle","forwardRef","withPasswordToggle","TextFieldBaseInput","_TextFieldBase","props","ref","ariaDescribedBy","hasValidationIcon","helperText","id","label","size","Sizes","validationState","validationText","restProps","classProps","modifiedProps","useTextFieldBaseStyleProps","styleProps","otherProps","useStyleProps","ids","register","useAriaIds","ariaDescribedByProp","useAriaDescribedBy","validationTextRole","useValidationTextRole","jsxs","classNames","jsx","Label","HelperText","ValidationText","TextFieldBase"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAMA,IAAuCC;AAAA,EAC3CC,EAAqDC,CAAkB;AACzE,GAEMC,IAAiB,CAACC,GAAiCC,MAA8D;AACrH,QAAM;AAAA,IACJ,oBAAoBC,IAAkB;AAAA,IACtC,mBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC,IAAOC,EAAM;AAAA,IACb,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDX,GACE,EAAE,YAAAY,GAAY,OAAOC,EAAA,IAAkBC,EAA2B;AAAA,IACtE,IAAAT;AAAA,IACA,MAAAE;AAAA,IACA,iBAAAE;AAAA,IACA,GAAGE;AAAA,EAAA,CACJ,GACK,EAAE,YAAAI,GAAY,OAAOC,EAAA,IAAeC,EAAcJ,CAAa,GAC/D,CAACK,GAAKC,CAAQ,IAAIC,EAAWlB,CAAe,GAC5CmB,IAAsBC,EAAmBJ,CAAG,GAC5CK,IAAqBC,EAAsB;AAAA,IAC/C,iBAAAf;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD;AAED,SACE,gBAAAe,EAAC,OAAA,EAAK,GAAGV,GAAY,WAAWW,EAAWd,EAAW,MAAMG,EAAW,SAAS,GAC9E,UAAA;AAAA,IAAA,gBAAAY,EAACC,KAAM,SAASvB,GAAI,kBAAkBO,EAAW,OAC9C,UAAAN,GACH;AAAA,IACA,gBAAAqB,EAAChC,KAAsC,GAAGqB,GAAa,GAAGK,GAAqB,IAAAhB,GAAQ,KAAAJ,GAAU,MAAAM,GAAY;AAAA,IAC7G,gBAAAoB;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,kBAAkBjB,EAAW;AAAA,QAC7B,IAAI,GAAGP,CAAE;AAAA,QACT,cAAcc;AAAA,QACd,YAAAf;AAAA,MAAA;AAAA,IAAA;AAAA,IAEDK,KACC,gBAAAkB;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,kBAAkBlB,EAAW;AAAA,QAC7B,aAAY;AAAA,QACX,GAAIT,KAAqB,EAAE,wBAAwBM,EAAA;AAAA,QACpD,IAAI,GAAGJ,CAAE;AAAA,QACT,gBAAAK;AAAA,QACA,cAAcS;AAAA,QACd,MAAMI;AAAA,MAAA;AAAA,IAAA;AAAA,EACR,GAEJ;AAEJ,GAEMQ,IAAgBnC;AAAA,EACpBG;AACF;AAEAgC,EAAc,kBAAkB;AAChCA,EAAc,cAAc;"}
1
+ {"version":3,"file":"TextFieldBase.js","sources":["../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ForwardedRef, forwardRef } from 'react';\nimport { Sizes } from '../../constants';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport {\n type ForwardRefComponent,\n type SpiritTextFieldBaseProps,\n type TextFieldBasePasswordToggleProps,\n} from '../../types';\nimport { CharacterCounter } from '../CharacterCounter';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { Flex } from '../Flex';\nimport TextFieldBaseInput from './TextFieldBaseInput';\nimport { useTextFieldBaseStyleProps } from './useTextFieldBaseStyleProps';\nimport withPasswordToggle from './withPasswordToggle';\n\nconst TextFieldBaseInputWithPasswordToggle = forwardRef(\n withPasswordToggle<TextFieldBasePasswordToggleProps>(TextFieldBaseInput),\n);\n\nconst _TextFieldBase = (props: SpiritTextFieldBaseProps, ref: ForwardedRef<HTMLInputElement | HTMLTextAreaElement>) => {\n const {\n 'aria-describedby': ariaDescribedBy = '',\n counterProps,\n hasValidationIcon,\n helperText,\n id,\n label,\n size = Sizes.MEDIUM,\n validationState,\n validationText,\n ...restProps\n } = props;\n const { classProps, props: modifiedProps } = useTextFieldBaseStyleProps({\n id,\n size,\n validationState,\n ...restProps,\n });\n const { styleProps, props: otherProps } = useStyleProps(modifiedProps);\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const hasTextContent = helperText || (validationState && validationText);\n\n const helperTextElement = (\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helper-text`}\n registerAria={register}\n helperText={helperText}\n />\n );\n\n const validationTextElement = validationState ? (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n elementType=\"span\"\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validation-text`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n ) : null;\n\n const counterElement = counterProps ? (\n <CharacterCounter {...counterProps} id={id} registerAria={register} UNSAFE_className={classProps.counter} />\n ) : null;\n\n return (\n <div {...styleProps} className={classNames(classProps.root, styleProps.className)}>\n <Label htmlFor={id} UNSAFE_className={classProps.label}>\n {label}\n </Label>\n <TextFieldBaseInputWithPasswordToggle {...otherProps} {...ariaDescribedByProp} id={id} ref={ref} size={size} />\n {counterProps ? (\n <Flex direction=\"horizontal\" isWrapping={false} alignmentX=\"space-between\" alignmentY=\"top\">\n {hasTextContent ? (\n <div>\n {/* In counter layout, put validation first so the status message stays visually closest to the counter row. */}\n {validationTextElement}\n {helperTextElement}\n </div>\n ) : null}\n {counterElement}\n </Flex>\n ) : (\n <>\n {/* Without counter, keep the default field text flow: helper first, then validation. */}\n {helperTextElement}\n {validationTextElement}\n </>\n )}\n </div>\n );\n};\n\nconst TextFieldBase = forwardRef<HTMLInputElement | HTMLTextAreaElement, SpiritTextFieldBaseProps>(\n _TextFieldBase,\n) as ForwardRefComponent<HTMLInputElement | HTMLTextAreaElement, SpiritTextFieldBaseProps>;\n\nTextFieldBase.spiritComponent = 'TextFieldBase';\nTextFieldBase.displayName = 'TextFieldBase';\n\nexport default TextFieldBase;\n"],"names":["TextFieldBaseInputWithPasswordToggle","forwardRef","withPasswordToggle","TextFieldBaseInput","_TextFieldBase","props","ref","ariaDescribedBy","counterProps","hasValidationIcon","helperText","id","label","size","Sizes","validationState","validationText","restProps","classProps","modifiedProps","useTextFieldBaseStyleProps","styleProps","otherProps","useStyleProps","ariaDescribedByProp","register","useAriaDescribedBy","validationTextRole","useValidationTextRole","hasTextContent","helperTextElement","jsx","HelperText","validationTextElement","ValidationText","counterElement","CharacterCounter","jsxs","classNames","Label","Flex","Fragment","TextFieldBase"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAMA,IAAuCC;AAAA,EAC3CC,EAAqDC,CAAkB;AACzE,GAEMC,IAAiB,CAACC,GAAiCC,MAA8D;AACrH,QAAM;AAAA,IACJ,oBAAoBC,IAAkB;AAAA,IACtC,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC,IAAOC,EAAM;AAAA,IACb,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDZ,GACE,EAAE,YAAAa,GAAY,OAAOC,EAAA,IAAkBC,EAA2B;AAAA,IACtE,IAAAT;AAAA,IACA,MAAAE;AAAA,IACA,iBAAAE;AAAA,IACA,GAAGE;AAAA,EAAA,CACJ,GACK,EAAE,YAAAI,GAAY,OAAOC,EAAA,IAAeC,EAAcJ,CAAa,GAC/D,CAACK,GAAqBC,CAAQ,IAAIC,EAAmBnB,CAAe,GACpEoB,IAAqBC,EAAsB;AAAA,IAC/C,iBAAAb;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD,GAEKa,IAAiBnB,KAAeK,KAAmBC,GAEnDc,IACJ,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,kBAAkBd,EAAW;AAAA,MAC7B,IAAI,GAAGP,CAAE;AAAA,MACT,cAAcc;AAAA,MACd,YAAAf;AAAA,IAAA;AAAA,EAAA,GAIEuB,IAAwBlB,IAC5B,gBAAAgB;AAAA,IAACG;AAAA,IAAA;AAAA,MACC,kBAAkBhB,EAAW;AAAA,MAC7B,aAAY;AAAA,MACX,GAAIT,KAAqB,EAAE,wBAAwBM,EAAA;AAAA,MACpD,IAAI,GAAGJ,CAAE;AAAA,MACT,gBAAAK;AAAA,MACA,cAAcS;AAAA,MACd,MAAME;AAAA,IAAA;AAAA,EAAA,IAEN,MAEEQ,IAAiB3B,IACrB,gBAAAuB,EAACK,GAAA,EAAkB,GAAG5B,GAAc,IAAAG,GAAQ,cAAcc,GAAU,kBAAkBP,EAAW,QAAA,CAAS,IACxG;AAEJ,SACE,gBAAAmB,EAAC,OAAA,EAAK,GAAGhB,GAAY,WAAWiB,EAAWpB,EAAW,MAAMG,EAAW,SAAS,GAC9E,UAAA;AAAA,IAAA,gBAAAU,EAACQ,KAAM,SAAS5B,GAAI,kBAAkBO,EAAW,OAC9C,UAAAN,GACH;AAAA,IACA,gBAAAmB,EAAC/B,KAAsC,GAAGsB,GAAa,GAAGE,GAAqB,IAAAb,GAAQ,KAAAL,GAAU,MAAAO,GAAY;AAAA,IAC5GL,IACC,gBAAA6B,EAACG,GAAA,EAAK,WAAU,cAAa,YAAY,IAAO,YAAW,iBAAgB,YAAW,OACnF,UAAA;AAAA,MAAAX,sBACE,OAAA,EAEE,UAAA;AAAA,QAAAI;AAAA,QACAH;AAAA,MAAA,EAAA,CACH,IACE;AAAA,MACHK;AAAA,IAAA,EAAA,CACH,IAEA,gBAAAE,EAAAI,GAAA,EAEG,UAAA;AAAA,MAAAX;AAAA,MACAG;AAAA,IAAA,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ,GAEMS,IAAgBzC;AAAA,EACpBG;AACF;AAEAsC,EAAc,kBAAkB;AAChCA,EAAc,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("classnames"),f=require("../../hooks/useClassNamePrefix.cjs");function q(i){const{isFluid:d,isMultiline:s,isLabelHidden:n,size:l,validationState:t,...a}=i,{isDisabled:r,isRequired:T}=a,e=f.useClassNamePrefix(s?"TextArea":"TextField"),c=`${e}--disabled`,x=`${e}--fluid`,u=`${e}--${l}`,_=`${e}--${t}`,g=`${e}__input`,p=`${e}__label`,F=`${e}__label--required`,B=`${e}__label--hidden`,C=`${e}__validationText`,b=`${e}__passwordToggle`,$=`${e}__passwordToggle__button`,P=`${e}__passwordToggle__icon`,w=`${e}__helperText`,S=o(e,{[c]:r,[x]:d,[_]:t,[u]:l}),y=o(p,{[F]:T,[B]:n});return{classProps:{root:S,label:y,input:g,helperText:w,validationText:C,passwordToggle:b,passwordToggleButton:$,passwordToggleIcon:P},props:{...a,isMultiline:s}}}exports.useTextFieldBaseStyleProps=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("classnames"),q=require("../../hooks/useClassNamePrefix.cjs");function m(i){const{isFluid:d,isMultiline:s,isLabelHidden:n,size:t,validationState:l,...a}=i,{isDisabled:r,isRequired:T}=a,e=q.useClassNamePrefix(s?"TextArea":"TextField"),c=`${e}--disabled`,u=`${e}--fluid`,x=`${e}--${t}`,_=`${e}--${l}`,g=`${e}__input`,p=`${e}__label`,F=`${e}__label--required`,B=`${e}__label--hidden`,C=`${e}__validationText`,$=`${e}__passwordToggle`,b=`${e}__passwordToggle__button`,P=`${e}__passwordToggle__icon`,w=`${e}__helperText`,S=o(e,{[c]:r,[u]:d,[_]:l,[x]:t}),y=o(p,{[F]:T,[B]:n}),f=`${e}__counter`;return{classProps:{root:S,label:y,input:g,helperText:w,validationText:C,passwordToggle:$,passwordToggleButton:b,passwordToggleIcon:P,counter:f},props:{...a,isMultiline:s}}}exports.useTextFieldBaseStyleProps=m;
2
2
  //# sourceMappingURL=useTextFieldBaseStyleProps.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTextFieldBaseStyleProps.cjs","sources":["../../../src/components/TextFieldBase/useTextFieldBaseStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type SpiritTextFieldBaseProps, type TextFieldBaseProps } from '../../types';\n\nexport interface TextFieldBaseStyles {\n /** className props */\n classProps: {\n root: string;\n label: string;\n input: string;\n helperText: string;\n validationText: string;\n passwordToggle: string;\n passwordToggleButton: string;\n passwordToggleIcon: string;\n };\n /** props to be passed to the input element */\n props: Omit<TextFieldBaseProps, 'label'>;\n}\n\nexport function useTextFieldBaseStyleProps(props: Omit<SpiritTextFieldBaseProps, 'label'>): TextFieldBaseStyles {\n const { isFluid, isMultiline, isLabelHidden, size, validationState, ...restProps } = props;\n const { isDisabled, isRequired } = restProps;\n\n const TextFieldBaseClass = useClassNamePrefix(isMultiline ? 'TextArea' : 'TextField');\n const TextFieldBaseDisabledClass = `${TextFieldBaseClass}--disabled`;\n const TextFieldBaseFluidClass = `${TextFieldBaseClass}--fluid`;\n const TextFieldBaseSizeClass = `${TextFieldBaseClass}--${size}`;\n const TextFieldBaseValidationClass = `${TextFieldBaseClass}--${validationState}`;\n const TextFieldBaseInputClass = `${TextFieldBaseClass}__input`;\n const TextFieldBaseLabelClass = `${TextFieldBaseClass}__label`;\n const TextFieldBaseLabelRequiredClass = `${TextFieldBaseClass}__label--required`;\n const TextFieldBaseLabelHiddenClass = `${TextFieldBaseClass}__label--hidden`;\n const TextFieldBaseValidationTextClass = `${TextFieldBaseClass}__validationText`;\n const TextFieldBasePasswordToggleClass = `${TextFieldBaseClass}__passwordToggle`;\n const TextFieldBasePasswordToggleButtonClass = `${TextFieldBaseClass}__passwordToggle__button`;\n const TextFieldBasePasswordToggleIconClass = `${TextFieldBaseClass}__passwordToggle__icon`;\n const TextFieldBaseHelperTextClass = `${TextFieldBaseClass}__helperText`;\n\n const rootStyles = classNames(TextFieldBaseClass, {\n [TextFieldBaseDisabledClass]: isDisabled,\n [TextFieldBaseFluidClass]: isFluid,\n [TextFieldBaseValidationClass]: validationState,\n [TextFieldBaseSizeClass]: size,\n });\n const labelStyles = classNames(TextFieldBaseLabelClass, {\n [TextFieldBaseLabelRequiredClass]: isRequired,\n [TextFieldBaseLabelHiddenClass]: isLabelHidden,\n });\n\n return {\n classProps: {\n root: rootStyles,\n label: labelStyles,\n input: TextFieldBaseInputClass,\n helperText: TextFieldBaseHelperTextClass,\n validationText: TextFieldBaseValidationTextClass,\n passwordToggle: TextFieldBasePasswordToggleClass,\n passwordToggleButton: TextFieldBasePasswordToggleButtonClass,\n passwordToggleIcon: TextFieldBasePasswordToggleIconClass,\n },\n props: {\n ...restProps,\n isMultiline,\n },\n };\n}\n"],"names":["useTextFieldBaseStyleProps","props","isFluid","isMultiline","isLabelHidden","size","validationState","restProps","isDisabled","isRequired","TextFieldBaseClass","useClassNamePrefix","TextFieldBaseDisabledClass","TextFieldBaseFluidClass","TextFieldBaseSizeClass","TextFieldBaseValidationClass","TextFieldBaseInputClass","TextFieldBaseLabelClass","TextFieldBaseLabelRequiredClass","TextFieldBaseLabelHiddenClass","TextFieldBaseValidationTextClass","TextFieldBasePasswordToggleClass","TextFieldBasePasswordToggleButtonClass","TextFieldBasePasswordToggleIconClass","TextFieldBaseHelperTextClass","rootStyles","classNames","labelStyles"],"mappings":"8JAoBO,SAASA,EAA2BC,EAAqE,CAC9G,KAAM,CAAE,QAAAC,EAAS,YAAAC,EAAa,cAAAC,EAAe,KAAAC,EAAM,gBAAAC,EAAiB,GAAGC,GAAcN,EAC/E,CAAE,WAAAO,EAAY,WAAAC,CAAA,EAAeF,EAE7BG,EAAqBC,EAAAA,mBAAmBR,EAAc,WAAa,WAAW,EAC9ES,EAA6B,GAAGF,CAAkB,aAClDG,EAA0B,GAAGH,CAAkB,UAC/CI,EAAyB,GAAGJ,CAAkB,KAAKL,CAAI,GACvDU,EAA+B,GAAGL,CAAkB,KAAKJ,CAAe,GACxEU,EAA0B,GAAGN,CAAkB,UAC/CO,EAA0B,GAAGP,CAAkB,UAC/CQ,EAAkC,GAAGR,CAAkB,oBACvDS,EAAgC,GAAGT,CAAkB,kBACrDU,EAAmC,GAAGV,CAAkB,mBACxDW,EAAmC,GAAGX,CAAkB,mBACxDY,EAAyC,GAAGZ,CAAkB,2BAC9Da,EAAuC,GAAGb,CAAkB,yBAC5Dc,EAA+B,GAAGd,CAAkB,eAEpDe,EAAaC,EAAWhB,EAAoB,CAChD,CAACE,CAA0B,EAAGJ,EAC9B,CAACK,CAAuB,EAAGX,EAC3B,CAACa,CAA4B,EAAGT,EAChC,CAACQ,CAAsB,EAAGT,CAAA,CAC3B,EACKsB,EAAcD,EAAWT,EAAyB,CACtD,CAACC,CAA+B,EAAGT,EACnC,CAACU,CAA6B,EAAGf,CAAA,CAClC,EAED,MAAO,CACL,WAAY,CACV,KAAMqB,EACN,MAAOE,EACP,MAAOX,EACP,WAAYQ,EACZ,eAAgBJ,EAChB,eAAgBC,EAChB,qBAAsBC,EACtB,mBAAoBC,CAAA,EAEtB,MAAO,CACL,GAAGhB,EACH,YAAAJ,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"useTextFieldBaseStyleProps.cjs","sources":["../../../src/components/TextFieldBase/useTextFieldBaseStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type SpiritTextFieldBaseProps, type TextFieldBaseProps } from '../../types';\n\nexport interface TextFieldBaseStyles {\n /** className props */\n classProps: {\n root: string;\n label: string;\n input: string;\n helperText: string;\n validationText: string;\n passwordToggle: string;\n passwordToggleButton: string;\n passwordToggleIcon: string;\n counter: string;\n };\n /** props to be passed to the input element */\n props: Omit<TextFieldBaseProps, 'label'>;\n}\n\nexport function useTextFieldBaseStyleProps(props: Omit<SpiritTextFieldBaseProps, 'label'>): TextFieldBaseStyles {\n const { isFluid, isMultiline, isLabelHidden, size, validationState, ...restProps } = props;\n const { isDisabled, isRequired } = restProps;\n\n const TextFieldBaseClass = useClassNamePrefix(isMultiline ? 'TextArea' : 'TextField');\n const TextFieldBaseDisabledClass = `${TextFieldBaseClass}--disabled`;\n const TextFieldBaseFluidClass = `${TextFieldBaseClass}--fluid`;\n const TextFieldBaseSizeClass = `${TextFieldBaseClass}--${size}`;\n const TextFieldBaseValidationClass = `${TextFieldBaseClass}--${validationState}`;\n const TextFieldBaseInputClass = `${TextFieldBaseClass}__input`;\n const TextFieldBaseLabelClass = `${TextFieldBaseClass}__label`;\n const TextFieldBaseLabelRequiredClass = `${TextFieldBaseClass}__label--required`;\n const TextFieldBaseLabelHiddenClass = `${TextFieldBaseClass}__label--hidden`;\n const TextFieldBaseValidationTextClass = `${TextFieldBaseClass}__validationText`;\n const TextFieldBasePasswordToggleClass = `${TextFieldBaseClass}__passwordToggle`;\n const TextFieldBasePasswordToggleButtonClass = `${TextFieldBaseClass}__passwordToggle__button`;\n const TextFieldBasePasswordToggleIconClass = `${TextFieldBaseClass}__passwordToggle__icon`;\n const TextFieldBaseHelperTextClass = `${TextFieldBaseClass}__helperText`;\n\n const rootStyles = classNames(TextFieldBaseClass, {\n [TextFieldBaseDisabledClass]: isDisabled,\n [TextFieldBaseFluidClass]: isFluid,\n [TextFieldBaseValidationClass]: validationState,\n [TextFieldBaseSizeClass]: size,\n });\n const labelStyles = classNames(TextFieldBaseLabelClass, {\n [TextFieldBaseLabelRequiredClass]: isRequired,\n [TextFieldBaseLabelHiddenClass]: isLabelHidden,\n });\n const counterStyles = `${TextFieldBaseClass}__counter`;\n\n return {\n classProps: {\n root: rootStyles,\n label: labelStyles,\n input: TextFieldBaseInputClass,\n helperText: TextFieldBaseHelperTextClass,\n validationText: TextFieldBaseValidationTextClass,\n passwordToggle: TextFieldBasePasswordToggleClass,\n passwordToggleButton: TextFieldBasePasswordToggleButtonClass,\n passwordToggleIcon: TextFieldBasePasswordToggleIconClass,\n counter: counterStyles,\n },\n props: {\n ...restProps,\n isMultiline,\n },\n };\n}\n"],"names":["useTextFieldBaseStyleProps","props","isFluid","isMultiline","isLabelHidden","size","validationState","restProps","isDisabled","isRequired","TextFieldBaseClass","useClassNamePrefix","TextFieldBaseDisabledClass","TextFieldBaseFluidClass","TextFieldBaseSizeClass","TextFieldBaseValidationClass","TextFieldBaseInputClass","TextFieldBaseLabelClass","TextFieldBaseLabelRequiredClass","TextFieldBaseLabelHiddenClass","TextFieldBaseValidationTextClass","TextFieldBasePasswordToggleClass","TextFieldBasePasswordToggleButtonClass","TextFieldBasePasswordToggleIconClass","TextFieldBaseHelperTextClass","rootStyles","classNames","labelStyles","counterStyles"],"mappings":"8JAqBO,SAASA,EAA2BC,EAAqE,CAC9G,KAAM,CAAE,QAAAC,EAAS,YAAAC,EAAa,cAAAC,EAAe,KAAAC,EAAM,gBAAAC,EAAiB,GAAGC,GAAcN,EAC/E,CAAE,WAAAO,EAAY,WAAAC,CAAA,EAAeF,EAE7BG,EAAqBC,EAAAA,mBAAmBR,EAAc,WAAa,WAAW,EAC9ES,EAA6B,GAAGF,CAAkB,aAClDG,EAA0B,GAAGH,CAAkB,UAC/CI,EAAyB,GAAGJ,CAAkB,KAAKL,CAAI,GACvDU,EAA+B,GAAGL,CAAkB,KAAKJ,CAAe,GACxEU,EAA0B,GAAGN,CAAkB,UAC/CO,EAA0B,GAAGP,CAAkB,UAC/CQ,EAAkC,GAAGR,CAAkB,oBACvDS,EAAgC,GAAGT,CAAkB,kBACrDU,EAAmC,GAAGV,CAAkB,mBACxDW,EAAmC,GAAGX,CAAkB,mBACxDY,EAAyC,GAAGZ,CAAkB,2BAC9Da,EAAuC,GAAGb,CAAkB,yBAC5Dc,EAA+B,GAAGd,CAAkB,eAEpDe,EAAaC,EAAWhB,EAAoB,CAChD,CAACE,CAA0B,EAAGJ,EAC9B,CAACK,CAAuB,EAAGX,EAC3B,CAACa,CAA4B,EAAGT,EAChC,CAACQ,CAAsB,EAAGT,CAAA,CAC3B,EACKsB,EAAcD,EAAWT,EAAyB,CACtD,CAACC,CAA+B,EAAGT,EACnC,CAACU,CAA6B,EAAGf,CAAA,CAClC,EACKwB,EAAgB,GAAGlB,CAAkB,YAE3C,MAAO,CACL,WAAY,CACV,KAAMe,EACN,MAAOE,EACP,MAAOX,EACP,WAAYQ,EACZ,eAAgBJ,EAChB,eAAgBC,EAChB,qBAAsBC,EACtB,mBAAoBC,EACpB,QAASK,CAAA,EAEX,MAAO,CACL,GAAGrB,EACH,YAAAJ,CAAA,CACF,CAEJ"}
@@ -9,6 +9,7 @@ export interface TextFieldBaseStyles {
9
9
  passwordToggle: string;
10
10
  passwordToggleButton: string;
11
11
  passwordToggleIcon: string;
12
+ counter: string;
12
13
  };
13
14
  props: Omit<TextFieldBaseProps, 'label'>;
14
15
  }
@@ -1,25 +1,26 @@
1
1
  import o from "classnames";
2
- import { useClassNamePrefix as S } from "../../hooks/useClassNamePrefix.js";
2
+ import { useClassNamePrefix as y } from "../../hooks/useClassNamePrefix.js";
3
3
  function q(i) {
4
- const { isFluid: d, isMultiline: s, isLabelHidden: n, size: l, validationState: t, ...a } = i, { isDisabled: r, isRequired: T } = a, e = S(s ? "TextArea" : "TextField"), c = `${e}--disabled`, x = `${e}--fluid`, _ = `${e}--${l}`, p = `${e}--${t}`, g = `${e}__input`, u = `${e}__label`, F = `${e}__label--required`, B = `${e}__label--hidden`, C = `${e}__validationText`, $ = `${e}__passwordToggle`, b = `${e}__passwordToggle__button`, w = `${e}__passwordToggle__icon`, P = `${e}__helperText`, m = o(e, {
4
+ const { isFluid: d, isMultiline: s, isLabelHidden: n, size: l, validationState: t, ...a } = i, { isDisabled: r, isRequired: T } = a, e = y(s ? "TextArea" : "TextField"), c = `${e}--disabled`, x = `${e}--fluid`, _ = `${e}--${l}`, u = `${e}--${t}`, p = `${e}__input`, g = `${e}__label`, F = `${e}__label--required`, B = `${e}__label--hidden`, $ = `${e}__validationText`, C = `${e}__passwordToggle`, b = `${e}__passwordToggle__button`, w = `${e}__passwordToggle__icon`, P = `${e}__helperText`, m = o(e, {
5
5
  [c]: r,
6
6
  [x]: d,
7
- [p]: t,
7
+ [u]: t,
8
8
  [_]: l
9
- }), f = o(u, {
9
+ }), S = o(g, {
10
10
  [F]: T,
11
11
  [B]: n
12
- });
12
+ }), f = `${e}__counter`;
13
13
  return {
14
14
  classProps: {
15
15
  root: m,
16
- label: f,
17
- input: g,
16
+ label: S,
17
+ input: p,
18
18
  helperText: P,
19
- validationText: C,
20
- passwordToggle: $,
19
+ validationText: $,
20
+ passwordToggle: C,
21
21
  passwordToggleButton: b,
22
- passwordToggleIcon: w
22
+ passwordToggleIcon: w,
23
+ counter: f
23
24
  },
24
25
  props: {
25
26
  ...a,
@@ -1 +1 @@
1
- {"version":3,"file":"useTextFieldBaseStyleProps.js","sources":["../../../src/components/TextFieldBase/useTextFieldBaseStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type SpiritTextFieldBaseProps, type TextFieldBaseProps } from '../../types';\n\nexport interface TextFieldBaseStyles {\n /** className props */\n classProps: {\n root: string;\n label: string;\n input: string;\n helperText: string;\n validationText: string;\n passwordToggle: string;\n passwordToggleButton: string;\n passwordToggleIcon: string;\n };\n /** props to be passed to the input element */\n props: Omit<TextFieldBaseProps, 'label'>;\n}\n\nexport function useTextFieldBaseStyleProps(props: Omit<SpiritTextFieldBaseProps, 'label'>): TextFieldBaseStyles {\n const { isFluid, isMultiline, isLabelHidden, size, validationState, ...restProps } = props;\n const { isDisabled, isRequired } = restProps;\n\n const TextFieldBaseClass = useClassNamePrefix(isMultiline ? 'TextArea' : 'TextField');\n const TextFieldBaseDisabledClass = `${TextFieldBaseClass}--disabled`;\n const TextFieldBaseFluidClass = `${TextFieldBaseClass}--fluid`;\n const TextFieldBaseSizeClass = `${TextFieldBaseClass}--${size}`;\n const TextFieldBaseValidationClass = `${TextFieldBaseClass}--${validationState}`;\n const TextFieldBaseInputClass = `${TextFieldBaseClass}__input`;\n const TextFieldBaseLabelClass = `${TextFieldBaseClass}__label`;\n const TextFieldBaseLabelRequiredClass = `${TextFieldBaseClass}__label--required`;\n const TextFieldBaseLabelHiddenClass = `${TextFieldBaseClass}__label--hidden`;\n const TextFieldBaseValidationTextClass = `${TextFieldBaseClass}__validationText`;\n const TextFieldBasePasswordToggleClass = `${TextFieldBaseClass}__passwordToggle`;\n const TextFieldBasePasswordToggleButtonClass = `${TextFieldBaseClass}__passwordToggle__button`;\n const TextFieldBasePasswordToggleIconClass = `${TextFieldBaseClass}__passwordToggle__icon`;\n const TextFieldBaseHelperTextClass = `${TextFieldBaseClass}__helperText`;\n\n const rootStyles = classNames(TextFieldBaseClass, {\n [TextFieldBaseDisabledClass]: isDisabled,\n [TextFieldBaseFluidClass]: isFluid,\n [TextFieldBaseValidationClass]: validationState,\n [TextFieldBaseSizeClass]: size,\n });\n const labelStyles = classNames(TextFieldBaseLabelClass, {\n [TextFieldBaseLabelRequiredClass]: isRequired,\n [TextFieldBaseLabelHiddenClass]: isLabelHidden,\n });\n\n return {\n classProps: {\n root: rootStyles,\n label: labelStyles,\n input: TextFieldBaseInputClass,\n helperText: TextFieldBaseHelperTextClass,\n validationText: TextFieldBaseValidationTextClass,\n passwordToggle: TextFieldBasePasswordToggleClass,\n passwordToggleButton: TextFieldBasePasswordToggleButtonClass,\n passwordToggleIcon: TextFieldBasePasswordToggleIconClass,\n },\n props: {\n ...restProps,\n isMultiline,\n },\n };\n}\n"],"names":["useTextFieldBaseStyleProps","props","isFluid","isMultiline","isLabelHidden","size","validationState","restProps","isDisabled","isRequired","TextFieldBaseClass","useClassNamePrefix","TextFieldBaseDisabledClass","TextFieldBaseFluidClass","TextFieldBaseSizeClass","TextFieldBaseValidationClass","TextFieldBaseInputClass","TextFieldBaseLabelClass","TextFieldBaseLabelRequiredClass","TextFieldBaseLabelHiddenClass","TextFieldBaseValidationTextClass","TextFieldBasePasswordToggleClass","TextFieldBasePasswordToggleButtonClass","TextFieldBasePasswordToggleIconClass","TextFieldBaseHelperTextClass","rootStyles","classNames","labelStyles"],"mappings":";;AAoBO,SAASA,EAA2BC,GAAqE;AAC9G,QAAM,EAAE,SAAAC,GAAS,aAAAC,GAAa,eAAAC,GAAe,MAAAC,GAAM,iBAAAC,GAAiB,GAAGC,MAAcN,GAC/E,EAAE,YAAAO,GAAY,YAAAC,EAAA,IAAeF,GAE7BG,IAAqBC,EAAmBR,IAAc,aAAa,WAAW,GAC9ES,IAA6B,GAAGF,CAAkB,cAClDG,IAA0B,GAAGH,CAAkB,WAC/CI,IAAyB,GAAGJ,CAAkB,KAAKL,CAAI,IACvDU,IAA+B,GAAGL,CAAkB,KAAKJ,CAAe,IACxEU,IAA0B,GAAGN,CAAkB,WAC/CO,IAA0B,GAAGP,CAAkB,WAC/CQ,IAAkC,GAAGR,CAAkB,qBACvDS,IAAgC,GAAGT,CAAkB,mBACrDU,IAAmC,GAAGV,CAAkB,oBACxDW,IAAmC,GAAGX,CAAkB,oBACxDY,IAAyC,GAAGZ,CAAkB,4BAC9Da,IAAuC,GAAGb,CAAkB,0BAC5Dc,IAA+B,GAAGd,CAAkB,gBAEpDe,IAAaC,EAAWhB,GAAoB;AAAA,IAChD,CAACE,CAA0B,GAAGJ;AAAA,IAC9B,CAACK,CAAuB,GAAGX;AAAA,IAC3B,CAACa,CAA4B,GAAGT;AAAA,IAChC,CAACQ,CAAsB,GAAGT;AAAA,EAAA,CAC3B,GACKsB,IAAcD,EAAWT,GAAyB;AAAA,IACtD,CAACC,CAA+B,GAAGT;AAAA,IACnC,CAACU,CAA6B,GAAGf;AAAA,EAAA,CAClC;AAED,SAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAMqB;AAAA,MACN,OAAOE;AAAA,MACP,OAAOX;AAAA,MACP,YAAYQ;AAAA,MACZ,gBAAgBJ;AAAA,MAChB,gBAAgBC;AAAA,MAChB,sBAAsBC;AAAA,MACtB,oBAAoBC;AAAA,IAAA;AAAA,IAEtB,OAAO;AAAA,MACL,GAAGhB;AAAA,MACH,aAAAJ;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"useTextFieldBaseStyleProps.js","sources":["../../../src/components/TextFieldBase/useTextFieldBaseStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type SpiritTextFieldBaseProps, type TextFieldBaseProps } from '../../types';\n\nexport interface TextFieldBaseStyles {\n /** className props */\n classProps: {\n root: string;\n label: string;\n input: string;\n helperText: string;\n validationText: string;\n passwordToggle: string;\n passwordToggleButton: string;\n passwordToggleIcon: string;\n counter: string;\n };\n /** props to be passed to the input element */\n props: Omit<TextFieldBaseProps, 'label'>;\n}\n\nexport function useTextFieldBaseStyleProps(props: Omit<SpiritTextFieldBaseProps, 'label'>): TextFieldBaseStyles {\n const { isFluid, isMultiline, isLabelHidden, size, validationState, ...restProps } = props;\n const { isDisabled, isRequired } = restProps;\n\n const TextFieldBaseClass = useClassNamePrefix(isMultiline ? 'TextArea' : 'TextField');\n const TextFieldBaseDisabledClass = `${TextFieldBaseClass}--disabled`;\n const TextFieldBaseFluidClass = `${TextFieldBaseClass}--fluid`;\n const TextFieldBaseSizeClass = `${TextFieldBaseClass}--${size}`;\n const TextFieldBaseValidationClass = `${TextFieldBaseClass}--${validationState}`;\n const TextFieldBaseInputClass = `${TextFieldBaseClass}__input`;\n const TextFieldBaseLabelClass = `${TextFieldBaseClass}__label`;\n const TextFieldBaseLabelRequiredClass = `${TextFieldBaseClass}__label--required`;\n const TextFieldBaseLabelHiddenClass = `${TextFieldBaseClass}__label--hidden`;\n const TextFieldBaseValidationTextClass = `${TextFieldBaseClass}__validationText`;\n const TextFieldBasePasswordToggleClass = `${TextFieldBaseClass}__passwordToggle`;\n const TextFieldBasePasswordToggleButtonClass = `${TextFieldBaseClass}__passwordToggle__button`;\n const TextFieldBasePasswordToggleIconClass = `${TextFieldBaseClass}__passwordToggle__icon`;\n const TextFieldBaseHelperTextClass = `${TextFieldBaseClass}__helperText`;\n\n const rootStyles = classNames(TextFieldBaseClass, {\n [TextFieldBaseDisabledClass]: isDisabled,\n [TextFieldBaseFluidClass]: isFluid,\n [TextFieldBaseValidationClass]: validationState,\n [TextFieldBaseSizeClass]: size,\n });\n const labelStyles = classNames(TextFieldBaseLabelClass, {\n [TextFieldBaseLabelRequiredClass]: isRequired,\n [TextFieldBaseLabelHiddenClass]: isLabelHidden,\n });\n const counterStyles = `${TextFieldBaseClass}__counter`;\n\n return {\n classProps: {\n root: rootStyles,\n label: labelStyles,\n input: TextFieldBaseInputClass,\n helperText: TextFieldBaseHelperTextClass,\n validationText: TextFieldBaseValidationTextClass,\n passwordToggle: TextFieldBasePasswordToggleClass,\n passwordToggleButton: TextFieldBasePasswordToggleButtonClass,\n passwordToggleIcon: TextFieldBasePasswordToggleIconClass,\n counter: counterStyles,\n },\n props: {\n ...restProps,\n isMultiline,\n },\n };\n}\n"],"names":["useTextFieldBaseStyleProps","props","isFluid","isMultiline","isLabelHidden","size","validationState","restProps","isDisabled","isRequired","TextFieldBaseClass","useClassNamePrefix","TextFieldBaseDisabledClass","TextFieldBaseFluidClass","TextFieldBaseSizeClass","TextFieldBaseValidationClass","TextFieldBaseInputClass","TextFieldBaseLabelClass","TextFieldBaseLabelRequiredClass","TextFieldBaseLabelHiddenClass","TextFieldBaseValidationTextClass","TextFieldBasePasswordToggleClass","TextFieldBasePasswordToggleButtonClass","TextFieldBasePasswordToggleIconClass","TextFieldBaseHelperTextClass","rootStyles","classNames","labelStyles","counterStyles"],"mappings":";;AAqBO,SAASA,EAA2BC,GAAqE;AAC9G,QAAM,EAAE,SAAAC,GAAS,aAAAC,GAAa,eAAAC,GAAe,MAAAC,GAAM,iBAAAC,GAAiB,GAAGC,MAAcN,GAC/E,EAAE,YAAAO,GAAY,YAAAC,EAAA,IAAeF,GAE7BG,IAAqBC,EAAmBR,IAAc,aAAa,WAAW,GAC9ES,IAA6B,GAAGF,CAAkB,cAClDG,IAA0B,GAAGH,CAAkB,WAC/CI,IAAyB,GAAGJ,CAAkB,KAAKL,CAAI,IACvDU,IAA+B,GAAGL,CAAkB,KAAKJ,CAAe,IACxEU,IAA0B,GAAGN,CAAkB,WAC/CO,IAA0B,GAAGP,CAAkB,WAC/CQ,IAAkC,GAAGR,CAAkB,qBACvDS,IAAgC,GAAGT,CAAkB,mBACrDU,IAAmC,GAAGV,CAAkB,oBACxDW,IAAmC,GAAGX,CAAkB,oBACxDY,IAAyC,GAAGZ,CAAkB,4BAC9Da,IAAuC,GAAGb,CAAkB,0BAC5Dc,IAA+B,GAAGd,CAAkB,gBAEpDe,IAAaC,EAAWhB,GAAoB;AAAA,IAChD,CAACE,CAA0B,GAAGJ;AAAA,IAC9B,CAACK,CAAuB,GAAGX;AAAA,IAC3B,CAACa,CAA4B,GAAGT;AAAA,IAChC,CAACQ,CAAsB,GAAGT;AAAA,EAAA,CAC3B,GACKsB,IAAcD,EAAWT,GAAyB;AAAA,IACtD,CAACC,CAA+B,GAAGT;AAAA,IACnC,CAACU,CAA6B,GAAGf;AAAA,EAAA,CAClC,GACKwB,IAAgB,GAAGlB,CAAkB;AAE3C,SAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAMe;AAAA,MACN,OAAOE;AAAA,MACP,OAAOX;AAAA,MACP,YAAYQ;AAAA,MACZ,gBAAgBJ;AAAA,MAChB,gBAAgBC;AAAA,MAChB,sBAAsBC;AAAA,MACtB,oBAAoBC;AAAA,MACpB,SAASK;AAAA,IAAA;AAAA,IAEX,OAAO;AAAA,MACL,GAAGrB;AAAA,MACH,aAAAJ;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),R=require("classnames"),n=require("react"),C=require("../../hooks/styleProps.cjs"),k=require("../../hooks/useAriaDescribedBy.cjs"),D=require("../Field/HelperText.cjs"),V=require("../Field/Label.cjs"),B=require("../Field/useAriaIds.cjs"),F=require("../Field/ValidationText.cjs"),E=require("../Field/useValidationTextRole.cjs"),I=require("./useToggleStyleProps.cjs"),U=(d,u)=>{const{classProps:e,props:p}=I.useToggleStyleProps(d),{"aria-describedby":g="",hasValidationIcon:x,id:t,isDisabled:h,isChecked:T=!1,isRequired:y,label:b,helperText:m,onChange:q=()=>{},validationState:r,validationText:a,...N}=p,{styleProps:o,props:P}=C.useStyleProps(N),[S,l]=B.default(g),f=k.useAriaDescribedBy(S),[_,j]=n.useState(T),v=E.useValidationTextRole({validationState:r,validationText:a}),A=c=>{j(c.target.checked),q(c)};return s.jsxs("div",{style:o.style,className:R(e.root,o.className),children:[s.jsxs("div",{className:e.text,children:[s.jsx(V.default,{UNSAFE_className:e.label,htmlFor:t,children:b}),s.jsx(D.default,{UNSAFE_className:e.helperText,id:`${t}__helperText`,registerAria:l,helperText:m}),r&&s.jsx(F.default,{UNSAFE_className:e.validationText,...x&&{hasValidationStateIcon:r},id:`${t}__validationText`,validationText:a,registerAria:l,role:v})]}),s.jsx("input",{...P,...f,type:"checkbox",id:t,className:e.input,disabled:h,checked:_,required:y,onChange:A,ref:u})]})},i=n.forwardRef(U);i.spiritComponent="Toggle";i.displayName="Toggle";exports.default=i;
1
+ "use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),V=require("classnames"),u=require("react"),F=require("../../hooks/styleProps.cjs"),d=require("../../hooks/useAriaIdRefs.cjs"),I=require("../Field/HelperText.cjs"),$=require("../Field/Label.cjs"),B=require("../Field/ValidationText.cjs"),E=require("../Field/useValidationTextRole.cjs"),U=require("../InputDetails/InputDetails.cjs"),M=require("./useToggleStyleProps.cjs"),O=(p,g)=>{const{classProps:s,props:x}=M.useToggleStyleProps(p),{"aria-describedby":h="","aria-details":T,details:r,hasValidationIcon:y,id:t,isDisabled:m,isChecked:b=!1,isRequired:q,label:P,helperText:N,onChange:f=()=>{},validationState:a,validationText:l,...S}=x,{styleProps:o,props:A}=F.useStyleProps(S),[D,c]=d.useAriaDescribedBy(h),[_,j]=d.useAriaDetails(T),[v,R]=u.useState(b),C=E.useValidationTextRole({validationState:a,validationText:l}),k=n=>{R(n.target.checked),f(n)};return e.jsxs("div",{style:o.style,className:V(s.root,o.className),children:[e.jsxs("div",{className:s.text,children:[e.jsx($.default,{UNSAFE_className:s.label,htmlFor:t,children:P}),r&&e.jsx(U.default,{id:`${t}-details`,registerAriaDetails:j,children:r}),e.jsx(I.default,{UNSAFE_className:s.helperText,id:`${t}__helperText`,registerAria:c,helperText:N}),a&&e.jsx(B.default,{UNSAFE_className:s.validationText,...y&&{hasValidationStateIcon:a},id:`${t}__validationText`,validationText:l,registerAria:c,role:C})]}),e.jsx("input",{...A,...D,..._,type:"checkbox",id:t,className:s.input,disabled:m,checked:v,required:q,onChange:k,ref:g})]})},i=u.forwardRef(O);i.spiritComponent="Toggle";i.displayName="Toggle";exports.default=i;
2
2
  //# sourceMappingURL=Toggle.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.cjs","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ChangeEvent, type ForwardedRef, forwardRef, useState } from 'react';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport { type ForwardRefComponent, type SpiritToggleProps } from '../../types';\nimport { HelperText, Label, ValidationText, useAriaIds } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { useToggleStyleProps } from './useToggleStyleProps';\n\nconst _Toggle = (props: SpiritToggleProps, ref: ForwardedRef<HTMLInputElement>) => {\n const { classProps, props: modifiedProps } = useToggleStyleProps(props);\n const {\n 'aria-describedby': ariaDescribedBy = '',\n hasValidationIcon,\n id,\n isDisabled,\n isChecked = false,\n isRequired,\n label,\n helperText,\n onChange = () => {},\n validationState,\n validationText,\n ...restProps\n } = modifiedProps;\n const { styleProps, props: otherProps } = useStyleProps(restProps);\n const [ids, register] = useAriaIds(ariaDescribedBy);\n const ariaDescribedByProp = useAriaDescribedBy(ids);\n const [checked, setChecked] = useState(isChecked);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setChecked(event.target.checked);\n onChange(event);\n };\n\n return (\n <div style={styleProps.style} className={classNames(classProps.root, styleProps.className)}>\n <div className={classProps.text}>\n <Label UNSAFE_className={classProps.label} htmlFor={id}>\n {label}\n </Label>\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helperText`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validationText`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n </div>\n <input\n {...otherProps}\n {...ariaDescribedByProp}\n type=\"checkbox\"\n id={id}\n className={classProps.input}\n disabled={isDisabled}\n checked={checked}\n required={isRequired}\n onChange={handleOnChange}\n ref={ref}\n />\n </div>\n );\n};\n\nconst Toggle = forwardRef<HTMLInputElement, SpiritToggleProps>(_Toggle) as ForwardRefComponent<\n HTMLInputElement,\n SpiritToggleProps\n>;\n\nToggle.spiritComponent = 'Toggle';\nToggle.displayName = 'Toggle';\n\nexport default Toggle;\n"],"names":["_Toggle","props","ref","classProps","modifiedProps","useToggleStyleProps","ariaDescribedBy","hasValidationIcon","id","isDisabled","isChecked","isRequired","label","helperText","onChange","validationState","validationText","restProps","styleProps","otherProps","useStyleProps","ids","register","useAriaIds","ariaDescribedByProp","useAriaDescribedBy","checked","setChecked","useState","validationTextRole","useValidationTextRole","handleOnChange","event","jsxs","classNames","jsx","Label","HelperText","ValidationText","Toggle","forwardRef"],"mappings":"2gBAUMA,EAAU,CAACC,EAA0BC,IAAwC,CACjF,KAAM,CAAE,WAAAC,EAAY,MAAOC,CAAA,EAAkBC,EAAAA,oBAAoBJ,CAAK,EAChE,CACJ,mBAAoBK,EAAkB,GACtC,kBAAAC,EACA,GAAAC,EACA,WAAAC,EACA,UAAAC,EAAY,GACZ,WAAAC,EACA,MAAAC,EACA,WAAAC,EACA,SAAAC,EAAW,IAAM,CAAC,EAClB,gBAAAC,EACA,eAAAC,EACA,GAAGC,CAAA,EACDb,EACE,CAAA,WAAEc,EAAY,MAAOC,CAAA,EAAeC,EAAAA,cAAcH,CAAS,EAC3D,CAACI,EAAKC,CAAQ,EAAIC,EAAAA,QAAWjB,CAAe,EAC5CkB,EAAsBC,EAAAA,mBAAmBJ,CAAG,EAC5C,CAACK,EAASC,CAAU,EAAIC,EAAAA,SAASlB,CAAS,EAC1CmB,EAAqBC,EAAAA,sBAAsB,CAC/C,gBAAAf,EACA,eAAAC,CAAA,CACD,EAEKe,EAAkBC,GAAyC,CAC/DL,EAAWK,EAAM,OAAO,OAAO,EAC/BlB,EAASkB,CAAK,CAChB,EAEA,OACEC,EAAAA,KAAC,MAAA,CAAI,MAAOf,EAAW,MAAO,UAAWgB,EAAW/B,EAAW,KAAMe,EAAW,SAAS,EACvF,SAAA,CAAAe,EAAAA,KAAC,MAAA,CAAI,UAAW9B,EAAW,KACzB,SAAA,CAAAgC,MAACC,EAAAA,SAAM,iBAAkBjC,EAAW,MAAO,QAASK,EACjD,SAAAI,EACH,EACAuB,EAAAA,IAACE,EAAAA,QAAA,CACC,iBAAkBlC,EAAW,WAC7B,GAAI,GAAGK,CAAE,eACT,aAAcc,EACd,WAAAT,CAAA,CAAA,EAEDE,GACCoB,EAAAA,IAACG,EAAAA,QAAA,CACC,iBAAkBnC,EAAW,eAC5B,GAAII,GAAqB,CAAE,uBAAwBQ,CAAA,EACpD,GAAI,GAAGP,CAAE,mBACT,eAAAQ,EACA,aAAcM,EACd,KAAMO,CAAA,CAAA,CACR,EAEJ,EACAM,EAAAA,IAAC,QAAA,CACE,GAAGhB,EACH,GAAGK,EACJ,KAAK,WACL,GAAAhB,EACA,UAAWL,EAAW,MACtB,SAAUM,EACV,QAAAiB,EACA,SAAUf,EACV,SAAUoB,EACV,IAAA7B,CAAA,CAAA,CACF,EACF,CAEJ,EAEMqC,EAASC,EAAAA,WAAgDxC,CAAO,EAKtEuC,EAAO,gBAAkB,SACzBA,EAAO,YAAc"}
1
+ {"version":3,"file":"Toggle.cjs","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ChangeEvent, type ForwardedRef, forwardRef, useState } from 'react';\nimport { useAriaDescribedBy, useAriaDetails, useStyleProps } from '../../hooks';\nimport { type ForwardRefComponent, type SpiritToggleProps } from '../../types';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { InputDetails } from '../InputDetails';\nimport { useToggleStyleProps } from './useToggleStyleProps';\n\nconst _Toggle = (props: SpiritToggleProps, ref: ForwardedRef<HTMLInputElement>) => {\n const { classProps, props: modifiedProps } = useToggleStyleProps(props);\n const {\n 'aria-describedby': ariaDescribedBy = '',\n 'aria-details': ariaDetailsAttr,\n details,\n hasValidationIcon,\n id,\n isDisabled,\n isChecked = false,\n isRequired,\n label,\n helperText,\n onChange = () => {},\n validationState,\n validationText,\n ...restProps\n } = modifiedProps;\n const { styleProps, props: otherProps } = useStyleProps(restProps);\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const [ariaDetailsProp, registerDetails] = useAriaDetails(ariaDetailsAttr);\n const [checked, setChecked] = useState(isChecked);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setChecked(event.target.checked);\n onChange(event);\n };\n\n return (\n <div style={styleProps.style} className={classNames(classProps.root, styleProps.className)}>\n <div className={classProps.text}>\n <Label UNSAFE_className={classProps.label} htmlFor={id}>\n {label}\n </Label>\n {details && (\n <InputDetails id={`${id}-details`} registerAriaDetails={registerDetails}>\n {details}\n </InputDetails>\n )}\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helperText`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validationText`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n </div>\n <input\n {...otherProps}\n {...ariaDescribedByProp}\n {...ariaDetailsProp}\n type=\"checkbox\"\n id={id}\n className={classProps.input}\n disabled={isDisabled}\n checked={checked}\n required={isRequired}\n onChange={handleOnChange}\n ref={ref}\n />\n </div>\n );\n};\n\nconst Toggle = forwardRef<HTMLInputElement, SpiritToggleProps>(_Toggle) as ForwardRefComponent<\n HTMLInputElement,\n SpiritToggleProps\n>;\n\nToggle.spiritComponent = 'Toggle';\nToggle.displayName = 'Toggle';\n\nexport default Toggle;\n"],"names":["_Toggle","props","ref","classProps","modifiedProps","useToggleStyleProps","ariaDescribedBy","ariaDetailsAttr","details","hasValidationIcon","id","isDisabled","isChecked","isRequired","label","helperText","onChange","validationState","validationText","restProps","styleProps","otherProps","useStyleProps","ariaDescribedByProp","register","useAriaDescribedBy","ariaDetailsProp","registerDetails","useAriaDetails","checked","setChecked","useState","validationTextRole","useValidationTextRole","handleOnChange","event","jsxs","classNames","jsx","Label","InputDetails","HelperText","ValidationText","Toggle","forwardRef"],"mappings":"+gBAWMA,EAAU,CAACC,EAA0BC,IAAwC,CACjF,KAAM,CAAE,WAAAC,EAAY,MAAOC,CAAA,EAAkBC,EAAAA,oBAAoBJ,CAAK,EAChE,CACJ,mBAAoBK,EAAkB,GACtC,eAAgBC,EAChB,QAAAC,EACA,kBAAAC,EACA,GAAAC,EACA,WAAAC,EACA,UAAAC,EAAY,GACZ,WAAAC,EACA,MAAAC,EACA,WAAAC,EACA,SAAAC,EAAW,IAAM,CAAC,EAClB,gBAAAC,EACA,eAAAC,EACA,GAAGC,CAAA,EACDf,EACE,CAAA,WAAEgB,EAAY,MAAOC,CAAA,EAAeC,EAAAA,cAAcH,CAAS,EAC3D,CAACI,EAAqBC,CAAQ,EAAIC,EAAAA,mBAAmBnB,CAAe,EACpE,CAACoB,EAAiBC,CAAe,EAAIC,EAAAA,eAAerB,CAAe,EACnE,CAACsB,EAASC,CAAU,EAAIC,EAAAA,SAASnB,CAAS,EAC1CoB,EAAqBC,EAAAA,sBAAsB,CAC/C,gBAAAhB,EACA,eAAAC,CAAA,CACD,EAEKgB,EAAkBC,GAAyC,CAC/DL,EAAWK,EAAM,OAAO,OAAO,EAC/BnB,EAASmB,CAAK,CAChB,EAEA,OACEC,EAAAA,KAAC,MAAA,CAAI,MAAOhB,EAAW,MAAO,UAAWiB,EAAWlC,EAAW,KAAMiB,EAAW,SAAS,EACvF,SAAA,CAAAgB,EAAAA,KAAC,MAAA,CAAI,UAAWjC,EAAW,KACzB,SAAA,CAAAmC,MAACC,EAAAA,SAAM,iBAAkBpC,EAAW,MAAO,QAASO,EACjD,SAAAI,EACH,EACCN,SACEgC,EAAAA,QAAA,CAAa,GAAI,GAAG9B,CAAE,WAAY,oBAAqBiB,EACrD,SAAAnB,CAAA,CACH,EAEF8B,EAAAA,IAACG,EAAAA,QAAA,CACC,iBAAkBtC,EAAW,WAC7B,GAAI,GAAGO,CAAE,eACT,aAAcc,EACd,WAAAT,CAAA,CAAA,EAEDE,GACCqB,EAAAA,IAACI,EAAAA,QAAA,CACC,iBAAkBvC,EAAW,eAC5B,GAAIM,GAAqB,CAAE,uBAAwBQ,CAAA,EACpD,GAAI,GAAGP,CAAE,mBACT,eAAAQ,EACA,aAAcM,EACd,KAAMQ,CAAA,CAAA,CACR,EAEJ,EACAM,EAAAA,IAAC,QAAA,CACE,GAAGjB,EACH,GAAGE,EACH,GAAGG,EACJ,KAAK,WACL,GAAAhB,EACA,UAAWP,EAAW,MACtB,SAAUQ,EACV,QAAAkB,EACA,SAAUhB,EACV,SAAUqB,EACV,IAAAhC,CAAA,CAAA,CACF,EACF,CAEJ,EAEMyC,EAASC,EAAAA,WAAgD5C,CAAO,EAKtE2C,EAAO,gBAAkB,SACzBA,EAAO,YAAc"}
@@ -1,80 +1,84 @@
1
1
  "use client";
2
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
3
- import D from "classnames";
4
- import { forwardRef as F, useState as R } from "react";
5
- import { useStyleProps as V } from "../../hooks/styleProps.js";
6
- import { useAriaDescribedBy as B } from "../../hooks/useAriaDescribedBy.js";
7
- import E from "../Field/HelperText.js";
8
- import I from "../Field/Label.js";
9
- import U from "../Field/useAriaIds.js";
10
- import j from "../Field/ValidationText.js";
11
- import { useValidationTextRole as q } from "../Field/useValidationTextRole.js";
12
- import { useToggleStyleProps as $ } from "./useToggleStyleProps.js";
13
- const w = (n, m) => {
14
- const { classProps: e, props: p } = $(n), {
15
- "aria-describedby": h = "",
16
- hasValidationIcon: g,
17
- id: s,
18
- isDisabled: f,
19
- isChecked: x = !1,
20
- isRequired: T,
21
- label: u,
22
- helperText: N,
23
- onChange: b = () => {
2
+ import { jsxs as c, jsx as i } from "react/jsx-runtime";
3
+ import V from "classnames";
4
+ import { forwardRef as B, useState as E } from "react";
5
+ import { useStyleProps as I } from "../../hooks/styleProps.js";
6
+ import { useAriaDescribedBy as U, useAriaDetails as $ } from "../../hooks/useAriaIdRefs.js";
7
+ import j from "../Field/HelperText.js";
8
+ import q from "../Field/Label.js";
9
+ import w from "../Field/ValidationText.js";
10
+ import { useValidationTextRole as H } from "../Field/useValidationTextRole.js";
11
+ import L from "../InputDetails/InputDetails.js";
12
+ import { useToggleStyleProps as O } from "./useToggleStyleProps.js";
13
+ const z = (p, m) => {
14
+ const { classProps: e, props: h } = O(p), {
15
+ "aria-describedby": g = "",
16
+ "aria-details": f,
17
+ details: r,
18
+ hasValidationIcon: u,
19
+ id: t,
20
+ isDisabled: x,
21
+ isChecked: T = !1,
22
+ isRequired: N,
23
+ label: b,
24
+ helperText: y,
25
+ onChange: D = () => {
24
26
  },
25
- validationState: t,
26
- validationText: r,
27
- ...y
28
- } = p, { styleProps: i, props: P } = V(y), [S, a] = U(h), _ = B(S), [A, v] = R(x), C = q({
29
- validationState: t,
30
- validationText: r
31
- }), k = (l) => {
32
- v(l.target.checked), b(l);
27
+ validationState: s,
28
+ validationText: a,
29
+ ...A
30
+ } = h, { styleProps: o, props: P } = I(A), [S, l] = U(g), [_, v] = $(f), [C, k] = E(T), F = H({
31
+ validationState: s,
32
+ validationText: a
33
+ }), R = (d) => {
34
+ k(d.target.checked), D(d);
33
35
  };
34
- return /* @__PURE__ */ d("div", { style: i.style, className: D(e.root, i.className), children: [
35
- /* @__PURE__ */ d("div", { className: e.text, children: [
36
- /* @__PURE__ */ o(I, { UNSAFE_className: e.label, htmlFor: s, children: u }),
37
- /* @__PURE__ */ o(
38
- E,
36
+ return /* @__PURE__ */ c("div", { style: o.style, className: V(e.root, o.className), children: [
37
+ /* @__PURE__ */ c("div", { className: e.text, children: [
38
+ /* @__PURE__ */ i(q, { UNSAFE_className: e.label, htmlFor: t, children: b }),
39
+ r && /* @__PURE__ */ i(L, { id: `${t}-details`, registerAriaDetails: v, children: r }),
40
+ /* @__PURE__ */ i(
41
+ j,
39
42
  {
40
43
  UNSAFE_className: e.helperText,
41
- id: `${s}__helperText`,
42
- registerAria: a,
43
- helperText: N
44
+ id: `${t}__helperText`,
45
+ registerAria: l,
46
+ helperText: y
44
47
  }
45
48
  ),
46
- t && /* @__PURE__ */ o(
47
- j,
49
+ s && /* @__PURE__ */ i(
50
+ w,
48
51
  {
49
52
  UNSAFE_className: e.validationText,
50
- ...g && { hasValidationStateIcon: t },
51
- id: `${s}__validationText`,
52
- validationText: r,
53
- registerAria: a,
54
- role: C
53
+ ...u && { hasValidationStateIcon: s },
54
+ id: `${t}__validationText`,
55
+ validationText: a,
56
+ registerAria: l,
57
+ role: F
55
58
  }
56
59
  )
57
60
  ] }),
58
- /* @__PURE__ */ o(
61
+ /* @__PURE__ */ i(
59
62
  "input",
60
63
  {
61
64
  ...P,
65
+ ...S,
62
66
  ..._,
63
67
  type: "checkbox",
64
- id: s,
68
+ id: t,
65
69
  className: e.input,
66
- disabled: f,
67
- checked: A,
68
- required: T,
69
- onChange: k,
70
+ disabled: x,
71
+ checked: C,
72
+ required: N,
73
+ onChange: R,
70
74
  ref: m
71
75
  }
72
76
  )
73
77
  ] });
74
- }, c = F(w);
75
- c.spiritComponent = "Toggle";
76
- c.displayName = "Toggle";
78
+ }, n = B(z);
79
+ n.spiritComponent = "Toggle";
80
+ n.displayName = "Toggle";
77
81
  export {
78
- c as default
82
+ n as default
79
83
  };
80
84
  //# sourceMappingURL=Toggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.js","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ChangeEvent, type ForwardedRef, forwardRef, useState } from 'react';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport { type ForwardRefComponent, type SpiritToggleProps } from '../../types';\nimport { HelperText, Label, ValidationText, useAriaIds } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { useToggleStyleProps } from './useToggleStyleProps';\n\nconst _Toggle = (props: SpiritToggleProps, ref: ForwardedRef<HTMLInputElement>) => {\n const { classProps, props: modifiedProps } = useToggleStyleProps(props);\n const {\n 'aria-describedby': ariaDescribedBy = '',\n hasValidationIcon,\n id,\n isDisabled,\n isChecked = false,\n isRequired,\n label,\n helperText,\n onChange = () => {},\n validationState,\n validationText,\n ...restProps\n } = modifiedProps;\n const { styleProps, props: otherProps } = useStyleProps(restProps);\n const [ids, register] = useAriaIds(ariaDescribedBy);\n const ariaDescribedByProp = useAriaDescribedBy(ids);\n const [checked, setChecked] = useState(isChecked);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setChecked(event.target.checked);\n onChange(event);\n };\n\n return (\n <div style={styleProps.style} className={classNames(classProps.root, styleProps.className)}>\n <div className={classProps.text}>\n <Label UNSAFE_className={classProps.label} htmlFor={id}>\n {label}\n </Label>\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helperText`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validationText`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n </div>\n <input\n {...otherProps}\n {...ariaDescribedByProp}\n type=\"checkbox\"\n id={id}\n className={classProps.input}\n disabled={isDisabled}\n checked={checked}\n required={isRequired}\n onChange={handleOnChange}\n ref={ref}\n />\n </div>\n );\n};\n\nconst Toggle = forwardRef<HTMLInputElement, SpiritToggleProps>(_Toggle) as ForwardRefComponent<\n HTMLInputElement,\n SpiritToggleProps\n>;\n\nToggle.spiritComponent = 'Toggle';\nToggle.displayName = 'Toggle';\n\nexport default Toggle;\n"],"names":["_Toggle","props","ref","classProps","modifiedProps","useToggleStyleProps","ariaDescribedBy","hasValidationIcon","id","isDisabled","isChecked","isRequired","label","helperText","onChange","validationState","validationText","restProps","styleProps","otherProps","useStyleProps","ids","register","useAriaIds","ariaDescribedByProp","useAriaDescribedBy","checked","setChecked","useState","validationTextRole","useValidationTextRole","handleOnChange","event","jsxs","classNames","jsx","Label","HelperText","ValidationText","Toggle","forwardRef"],"mappings":";;;;;;;;;;;;AAUA,MAAMA,IAAU,CAACC,GAA0BC,MAAwC;AACjF,QAAM,EAAE,YAAAC,GAAY,OAAOC,EAAA,IAAkBC,EAAoBJ,CAAK,GAChE;AAAA,IACJ,oBAAoBK,IAAkB;AAAA,IACtC,mBAAAC;AAAA,IACA,IAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC,IAAW,MAAM;AAAA,IAAC;AAAA,IAClB,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDb,GACE,EAAE,YAAAc,GAAY,OAAOC,EAAA,IAAeC,EAAcH,CAAS,GAC3D,CAACI,GAAKC,CAAQ,IAAIC,EAAWjB,CAAe,GAC5CkB,IAAsBC,EAAmBJ,CAAG,GAC5C,CAACK,GAASC,CAAU,IAAIC,EAASlB,CAAS,GAC1CmB,IAAqBC,EAAsB;AAAA,IAC/C,iBAAAf;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD,GAEKe,IAAiB,CAACC,MAAyC;AAC/D,IAAAL,EAAWK,EAAM,OAAO,OAAO,GAC/BlB,EAASkB,CAAK;AAAA,EAChB;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,OAAOf,EAAW,OAAO,WAAWgB,EAAW/B,EAAW,MAAMe,EAAW,SAAS,GACvF,UAAA;AAAA,IAAA,gBAAAe,EAAC,OAAA,EAAI,WAAW9B,EAAW,MACzB,UAAA;AAAA,MAAA,gBAAAgC,EAACC,KAAM,kBAAkBjC,EAAW,OAAO,SAASK,GACjD,UAAAI,GACH;AAAA,MACA,gBAAAuB;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,kBAAkBlC,EAAW;AAAA,UAC7B,IAAI,GAAGK,CAAE;AAAA,UACT,cAAcc;AAAA,UACd,YAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,MAEDE,KACC,gBAAAoB;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,kBAAkBnC,EAAW;AAAA,UAC5B,GAAII,KAAqB,EAAE,wBAAwBQ,EAAA;AAAA,UACpD,IAAI,GAAGP,CAAE;AAAA,UACT,gBAAAQ;AAAA,UACA,cAAcM;AAAA,UACd,MAAMO;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,GAEJ;AAAA,IACA,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAGhB;AAAA,QACH,GAAGK;AAAA,QACJ,MAAK;AAAA,QACL,IAAAhB;AAAA,QACA,WAAWL,EAAW;AAAA,QACtB,UAAUM;AAAA,QACV,SAAAiB;AAAA,QACA,UAAUf;AAAA,QACV,UAAUoB;AAAA,QACV,KAAA7B;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ,GAEMqC,IAASC,EAAgDxC,CAAO;AAKtEuC,EAAO,kBAAkB;AACzBA,EAAO,cAAc;"}
1
+ {"version":3,"file":"Toggle.js","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ChangeEvent, type ForwardedRef, forwardRef, useState } from 'react';\nimport { useAriaDescribedBy, useAriaDetails, useStyleProps } from '../../hooks';\nimport { type ForwardRefComponent, type SpiritToggleProps } from '../../types';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { InputDetails } from '../InputDetails';\nimport { useToggleStyleProps } from './useToggleStyleProps';\n\nconst _Toggle = (props: SpiritToggleProps, ref: ForwardedRef<HTMLInputElement>) => {\n const { classProps, props: modifiedProps } = useToggleStyleProps(props);\n const {\n 'aria-describedby': ariaDescribedBy = '',\n 'aria-details': ariaDetailsAttr,\n details,\n hasValidationIcon,\n id,\n isDisabled,\n isChecked = false,\n isRequired,\n label,\n helperText,\n onChange = () => {},\n validationState,\n validationText,\n ...restProps\n } = modifiedProps;\n const { styleProps, props: otherProps } = useStyleProps(restProps);\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const [ariaDetailsProp, registerDetails] = useAriaDetails(ariaDetailsAttr);\n const [checked, setChecked] = useState(isChecked);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setChecked(event.target.checked);\n onChange(event);\n };\n\n return (\n <div style={styleProps.style} className={classNames(classProps.root, styleProps.className)}>\n <div className={classProps.text}>\n <Label UNSAFE_className={classProps.label} htmlFor={id}>\n {label}\n </Label>\n {details && (\n <InputDetails id={`${id}-details`} registerAriaDetails={registerDetails}>\n {details}\n </InputDetails>\n )}\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helperText`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validationText`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n </div>\n <input\n {...otherProps}\n {...ariaDescribedByProp}\n {...ariaDetailsProp}\n type=\"checkbox\"\n id={id}\n className={classProps.input}\n disabled={isDisabled}\n checked={checked}\n required={isRequired}\n onChange={handleOnChange}\n ref={ref}\n />\n </div>\n );\n};\n\nconst Toggle = forwardRef<HTMLInputElement, SpiritToggleProps>(_Toggle) as ForwardRefComponent<\n HTMLInputElement,\n SpiritToggleProps\n>;\n\nToggle.spiritComponent = 'Toggle';\nToggle.displayName = 'Toggle';\n\nexport default Toggle;\n"],"names":["_Toggle","props","ref","classProps","modifiedProps","useToggleStyleProps","ariaDescribedBy","ariaDetailsAttr","details","hasValidationIcon","id","isDisabled","isChecked","isRequired","label","helperText","onChange","validationState","validationText","restProps","styleProps","otherProps","useStyleProps","ariaDescribedByProp","register","useAriaDescribedBy","ariaDetailsProp","registerDetails","useAriaDetails","checked","setChecked","useState","validationTextRole","useValidationTextRole","handleOnChange","event","jsxs","classNames","jsx","Label","InputDetails","HelperText","ValidationText","Toggle","forwardRef"],"mappings":";;;;;;;;;;;;AAWA,MAAMA,IAAU,CAACC,GAA0BC,MAAwC;AACjF,QAAM,EAAE,YAAAC,GAAY,OAAOC,EAAA,IAAkBC,EAAoBJ,CAAK,GAChE;AAAA,IACJ,oBAAoBK,IAAkB;AAAA,IACtC,gBAAgBC;AAAA,IAChB,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,IAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC,IAAW,MAAM;AAAA,IAAC;AAAA,IAClB,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDf,GACE,EAAE,YAAAgB,GAAY,OAAOC,EAAA,IAAeC,EAAcH,CAAS,GAC3D,CAACI,GAAqBC,CAAQ,IAAIC,EAAmBnB,CAAe,GACpE,CAACoB,GAAiBC,CAAe,IAAIC,EAAerB,CAAe,GACnE,CAACsB,GAASC,CAAU,IAAIC,EAASnB,CAAS,GAC1CoB,IAAqBC,EAAsB;AAAA,IAC/C,iBAAAhB;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD,GAEKgB,IAAiB,CAACC,MAAyC;AAC/D,IAAAL,EAAWK,EAAM,OAAO,OAAO,GAC/BnB,EAASmB,CAAK;AAAA,EAChB;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,OAAOhB,EAAW,OAAO,WAAWiB,EAAWlC,EAAW,MAAMiB,EAAW,SAAS,GACvF,UAAA;AAAA,IAAA,gBAAAgB,EAAC,OAAA,EAAI,WAAWjC,EAAW,MACzB,UAAA;AAAA,MAAA,gBAAAmC,EAACC,KAAM,kBAAkBpC,EAAW,OAAO,SAASO,GACjD,UAAAI,GACH;AAAA,MACCN,uBACEgC,GAAA,EAAa,IAAI,GAAG9B,CAAE,YAAY,qBAAqBiB,GACrD,UAAAnB,EAAA,CACH;AAAA,MAEF,gBAAA8B;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,kBAAkBtC,EAAW;AAAA,UAC7B,IAAI,GAAGO,CAAE;AAAA,UACT,cAAcc;AAAA,UACd,YAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,MAEDE,KACC,gBAAAqB;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,kBAAkBvC,EAAW;AAAA,UAC5B,GAAIM,KAAqB,EAAE,wBAAwBQ,EAAA;AAAA,UACpD,IAAI,GAAGP,CAAE;AAAA,UACT,gBAAAQ;AAAA,UACA,cAAcM;AAAA,UACd,MAAMQ;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,GAEJ;AAAA,IACA,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAGjB;AAAA,QACH,GAAGE;AAAA,QACH,GAAGG;AAAA,QACJ,MAAK;AAAA,QACL,IAAAhB;AAAA,QACA,WAAWP,EAAW;AAAA,QACtB,UAAUQ;AAAA,QACV,SAAAkB;AAAA,QACA,UAAUhB;AAAA,QACV,UAAUqB;AAAA,QACV,KAAAhC;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ,GAEMyC,IAASC,EAAgD5C,CAAO;AAKtE2C,EAAO,kBAAkB;AACzBA,EAAO,cAAc;"}
@@ -0,0 +1,2 @@
1
+ "use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),L=require("classnames"),U=require("../../hooks/styleProps.cjs"),R=require("../../hooks/useClassNamePrefix.cjs"),V=require("../../hooks/useI18n.cjs"),N=require("../ControlButton/ControlButton.cjs"),D=require("../Field/ValidationText.cjs"),O=require("../Field/useValidationTextRole.cjs"),z=require("../Flex/Flex.cjs"),a=require("../Icon/Icon.cjs"),T=require("../VisuallyHidden/VisuallyHidden.cjs"),j=require("./constants.cjs"),M=require("./useFileStyleProps.cjs"),w={elementType:"li",iconName:j.DEFAULT_FILE_ICON_NAME},o=f=>{const v={...w,...f},{t:r}=V.useI18n(),{editText:S,elementType:P,hasValidationIcon:_,helperText:c,iconName:q,id:n,isDisabled:d,label:y,onDismiss:u,onChange:m,previewSlot:C,removeText:F,validationState:s,validationText:x,...A}=v,E=S??r("attachment.edit"),I=F??r("attachment.remove"),{classProps:t}=M.useFileStyleProps({isDisabled:d,validationState:s}),{styleProps:p,props:b}=U.useStyleProps(A),g=O.useValidationTextRole({validationState:s,validationText:x}),h={size:"large",isSymmetrical:!0,isDisabled:d},i=m?e.jsxs(N.default,{...h,onClick:m,children:[e.jsx(T.default,{children:E}),e.jsx(a.default,{name:j.DEFAULT_FILE_ACTION_BUTTON_ICON_NAME,boxSize:16,"aria-hidden":"true"})]}):null,l=u?e.jsxs(N.default,{...h,onClick:u,children:[e.jsx(T.default,{children:I}),e.jsx(a.default,{name:"close",boxSize:16,"aria-hidden":"true"})]}):null,B=P;return e.jsxs(B,{...b,...p,...n!=null&&n!==""?{id:n}:{},className:L(t.root,p.className),children:[C??e.jsx("div",{className:t.preview,children:e.jsx(a.default,{name:q,boxSize:20,"aria-hidden":"true"})}),e.jsx("div",{className:t.content,children:e.jsxs("div",{className:t.text,children:[e.jsx("span",{className:t.name,children:e.jsx("span",{className:R.useClassNamePrefix("text-truncate"),children:y})}),c&&e.jsx("div",{className:t.helperText,children:c}),s&&e.jsx(D.default,{UNSAFE_className:t.validationText,elementType:"div",..._&&{hasValidationStateIcon:s},role:g,validationText:x})]})}),i&&l?e.jsxs(z.default,{alignmentX:{mobile:"stretch",tablet:"left"},alignmentY:"stretch",spacingX:"space-500",children:[i,l]}):e.jsxs(e.Fragment,{children:[i,l]})]})};o.spiritComponent="UNSTABLE_File";o.displayName="UNSTABLE_File";exports.default=o;
2
+ //# sourceMappingURL=UNSTABLE_File.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UNSTABLE_File.cjs","sources":["../../../src/components/UNSTABLE_File/UNSTABLE_File.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ElementType } from 'react';\nimport { useClassNamePrefix, useI18n, useStyleProps } from '../../hooks';\nimport { ControlButton } from '../ControlButton';\nimport { ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { Flex } from '../Flex';\nimport { Icon } from '../Icon';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { DEFAULT_FILE_ACTION_BUTTON_ICON_NAME, DEFAULT_FILE_ICON_NAME } from './constants';\nimport { type SpiritUnstableFileProps } from './types';\nimport { useFileStyleProps } from './useFileStyleProps';\n\nconst defaultProps = {\n elementType: 'li' as const,\n iconName: DEFAULT_FILE_ICON_NAME,\n};\n\nconst UNSTABLE_File = <E extends ElementType = 'li'>(props: SpiritUnstableFileProps<E>): JSX.Element => {\n const propsWithDefaults = { ...defaultProps, ...props };\n const { t } = useI18n();\n const {\n editText,\n elementType,\n hasValidationIcon,\n helperText,\n iconName,\n id,\n isDisabled,\n label,\n onDismiss,\n onChange,\n previewSlot,\n removeText,\n validationState,\n validationText,\n ...restProps\n } = propsWithDefaults;\n\n const resolvedEditText = editText ?? t('attachment.edit');\n const resolvedRemoveText = removeText ?? t('attachment.remove');\n const { classProps } = useFileStyleProps({ isDisabled, validationState });\n const { styleProps, props: transferProps } = useStyleProps(restProps);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const fileRowControlButtonProps = {\n size: 'large' as const,\n isSymmetrical: true as const,\n isDisabled,\n };\n\n const editActionButton = onChange ? (\n <ControlButton {...fileRowControlButtonProps} onClick={onChange}>\n <VisuallyHidden>{resolvedEditText}</VisuallyHidden>\n <Icon name={DEFAULT_FILE_ACTION_BUTTON_ICON_NAME} boxSize={16} aria-hidden=\"true\" />\n </ControlButton>\n ) : null;\n\n const dismissActionButton = onDismiss ? (\n <ControlButton {...fileRowControlButtonProps} onClick={onDismiss}>\n <VisuallyHidden>{resolvedRemoveText}</VisuallyHidden>\n <Icon name=\"close\" boxSize={16} aria-hidden=\"true\" />\n </ControlButton>\n ) : null;\n\n const Component = elementType as ElementType;\n\n return (\n <Component\n {...transferProps}\n {...styleProps}\n {...(id != null && id !== '' ? { id } : {})}\n className={classNames(classProps.root, styleProps.className)}\n >\n {previewSlot ?? (\n <div className={classProps.preview}>\n <Icon name={iconName} boxSize={20} aria-hidden=\"true\" />\n </div>\n )}\n <div className={classProps.content}>\n <div className={classProps.text}>\n <span className={classProps.name}>\n <span className={useClassNamePrefix('text-truncate')}>{label}</span>\n </span>\n {helperText && <div className={classProps.helperText}>{helperText}</div>}\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n elementType=\"div\"\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n role={validationTextRole}\n validationText={validationText}\n />\n )}\n </div>\n </div>\n {editActionButton && dismissActionButton ? (\n <Flex alignmentX={{ mobile: 'stretch', tablet: 'left' }} alignmentY=\"stretch\" spacingX=\"space-500\">\n {editActionButton}\n {dismissActionButton}\n </Flex>\n ) : (\n <>\n {editActionButton}\n {dismissActionButton}\n </>\n )}\n </Component>\n );\n};\n\nUNSTABLE_File.spiritComponent = 'UNSTABLE_File';\nUNSTABLE_File.displayName = 'UNSTABLE_File';\n\nexport default UNSTABLE_File;\n"],"names":["defaultProps","DEFAULT_FILE_ICON_NAME","UNSTABLE_File","props","propsWithDefaults","t","useI18n","editText","elementType","hasValidationIcon","helperText","iconName","id","isDisabled","label","onDismiss","onChange","previewSlot","removeText","validationState","validationText","restProps","resolvedEditText","resolvedRemoveText","classProps","useFileStyleProps","styleProps","transferProps","useStyleProps","validationTextRole","useValidationTextRole","fileRowControlButtonProps","editActionButton","jsxs","ControlButton","jsx","VisuallyHidden","Icon","DEFAULT_FILE_ACTION_BUTTON_ICON_NAME","dismissActionButton","Component","classNames","useClassNamePrefix","ValidationText","Flex","Fragment"],"mappings":"4mBAeMA,EAAe,CACnB,YAAa,KACb,SAAUC,EAAAA,sBACZ,EAEMC,EAA+CC,GAAmD,CACtG,MAAMC,EAAoB,CAAE,GAAGJ,EAAc,GAAGG,CAAA,EAC1C,CAAE,EAAAE,CAAA,EAAMC,UAAA,EACR,CACJ,SAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,GAAAC,EACA,WAAAC,EACA,MAAAC,EACA,UAAAC,EACA,SAAAC,EACA,YAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,GAAGC,CAAA,EACDjB,EAEEkB,EAAmBf,GAAYF,EAAE,iBAAiB,EAClDkB,EAAqBL,GAAcb,EAAE,mBAAmB,EACxD,CAAE,WAAAmB,CAAA,EAAeC,EAAAA,kBAAkB,CAAE,WAAAZ,EAAY,gBAAAM,EAAiB,EAClE,CAAA,WAAEO,EAAY,MAAOC,CAAA,EAAkBC,EAAAA,cAAcP,CAAS,EAC9DQ,EAAqBC,EAAAA,sBAAsB,CAC/C,gBAAAX,EACA,eAAAC,CAAA,CACD,EAEKW,EAA4B,CAChC,KAAM,QACN,cAAe,GACf,WAAAlB,CAAA,EAGImB,EAAmBhB,EACvBiB,EAAAA,KAACC,EAAAA,SAAe,GAAGH,EAA2B,QAASf,EACrD,SAAA,CAAAmB,EAAAA,IAACC,EAAAA,SAAgB,SAAAd,CAAA,CAAiB,QACjCe,EAAAA,QAAA,CAAK,KAAMC,EAAAA,qCAAsC,QAAS,GAAI,cAAY,MAAA,CAAO,CAAA,CAAA,CACpF,EACE,KAEEC,EAAsBxB,EAC1BkB,EAAAA,KAACC,EAAAA,SAAe,GAAGH,EAA2B,QAAShB,EACrD,SAAA,CAAAoB,EAAAA,IAACC,EAAAA,SAAgB,SAAAb,CAAA,CAAmB,QACnCc,EAAAA,QAAA,CAAK,KAAK,QAAQ,QAAS,GAAI,cAAY,MAAA,CAAO,CAAA,CAAA,CACrD,EACE,KAEEG,EAAYhC,EAElB,OACEyB,EAAAA,KAACO,EAAA,CACE,GAAGb,EACH,GAAGD,EACH,GAAId,GAAM,MAAQA,IAAO,GAAK,CAAE,GAAAA,CAAA,EAAO,CAAA,EACxC,UAAW6B,EAAWjB,EAAW,KAAME,EAAW,SAAS,EAE1D,SAAA,CAAAT,GACCkB,EAAAA,IAAC,MAAA,CAAI,UAAWX,EAAW,QACzB,SAAAW,EAAAA,IAACE,EAAAA,QAAA,CAAK,KAAM1B,EAAU,QAAS,GAAI,cAAY,OAAO,EACxD,EAEFwB,EAAAA,IAAC,OAAI,UAAWX,EAAW,QACzB,SAAAS,EAAAA,KAAC,MAAA,CAAI,UAAWT,EAAW,KACzB,SAAA,CAAAW,EAAAA,IAAC,OAAA,CAAK,UAAWX,EAAW,KAC1B,SAAAW,EAAAA,IAAC,OAAA,CAAK,UAAWO,EAAAA,mBAAmB,eAAe,EAAI,SAAA5B,CAAA,CAAM,EAC/D,EACCJ,GAAcyB,EAAAA,IAAC,MAAA,CAAI,UAAWX,EAAW,WAAa,SAAAd,EAAW,EACjES,GACCgB,EAAAA,IAACQ,EAAAA,QAAA,CACC,iBAAkBnB,EAAW,eAC7B,YAAY,MACX,GAAIf,GAAqB,CAAE,uBAAwBU,CAAA,EACpD,KAAMU,EACN,eAAAT,CAAA,CAAA,CACF,CAAA,CAEJ,CAAA,CACF,EACCY,GAAoBO,EACnBN,EAAAA,KAACW,EAAAA,QAAA,CAAK,WAAY,CAAE,OAAQ,UAAW,OAAQ,MAAA,EAAU,WAAW,UAAU,SAAS,YACpF,SAAA,CAAAZ,EACAO,CAAA,CAAA,CACH,EAEAN,EAAAA,KAAAY,EAAAA,SAAA,CACG,SAAA,CAAAb,EACAO,CAAA,CAAA,CACH,CAAA,CAAA,CAAA,CAIR,EAEArC,EAAc,gBAAkB,gBAChCA,EAAc,YAAc"}
@@ -0,0 +1,8 @@
1
+ import { ElementType } from 'react';
2
+ import { SpiritUnstableFileProps } from './types';
3
+ declare const UNSTABLE_File: {
4
+ <E extends ElementType = "li">(props: SpiritUnstableFileProps<E>): JSX.Element;
5
+ spiritComponent: string;
6
+ displayName: string;
7
+ };
8
+ export default UNSTABLE_File;