@canonical/react-ds-global-form 0.47.0 → 0.48.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 (435) hide show
  1. package/README.md +5 -6
  2. package/dist/esm/density.css +23 -28
  3. package/dist/esm/index.css +28 -13
  4. package/dist/esm/lib/{component → _work_in_progress/component}/ColorField/ColorField.js +2 -2
  5. package/dist/esm/lib/_work_in_progress/component/ColorField/ColorField.js.map +1 -0
  6. package/dist/esm/lib/_work_in_progress/component/ColorField/index.js.map +1 -0
  7. package/dist/esm/lib/_work_in_progress/component/ColorField/types.js.map +1 -0
  8. package/dist/esm/lib/{component → _work_in_progress/component}/ComboboxField/ComboboxField.js +2 -2
  9. package/dist/esm/lib/_work_in_progress/component/ComboboxField/ComboboxField.js.map +1 -0
  10. package/dist/esm/lib/_work_in_progress/component/ComboboxField/index.js.map +1 -0
  11. package/dist/esm/lib/_work_in_progress/component/ComboboxField/types.js.map +1 -0
  12. package/dist/esm/lib/{component → _work_in_progress/component}/RatingField/RatingField.js +2 -2
  13. package/dist/esm/lib/_work_in_progress/component/RatingField/RatingField.js.map +1 -0
  14. package/dist/esm/lib/_work_in_progress/component/RatingField/index.js.map +1 -0
  15. package/dist/esm/lib/_work_in_progress/component/RatingField/types.js.map +1 -0
  16. package/dist/esm/lib/_work_in_progress/subcomponent/ColorInput/ColorInput.js.map +1 -0
  17. package/dist/esm/lib/_work_in_progress/subcomponent/ColorInput/index.js.map +1 -0
  18. package/dist/esm/lib/_work_in_progress/subcomponent/ColorInput/types.js.map +1 -0
  19. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/ComboboxInput.js.map +1 -0
  20. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.js +198 -0
  21. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.js.map +1 -0
  22. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/SingleCombobox.js +120 -0
  23. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/SingleCombobox.js.map +1 -0
  24. package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/List.js +16 -4
  25. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/List.js.map +1 -0
  26. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/index.js.map +1 -0
  27. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/types.js.map +1 -0
  28. package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/ResetButton.js +2 -2
  29. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/ResetButton.js.map +1 -0
  30. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/index.js.map +1 -0
  31. package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/styles.css +3 -0
  32. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/types.js.map +1 -0
  33. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/index.js.map +1 -0
  34. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/constants.js.map +1 -0
  35. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/index.js.map +1 -0
  36. package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/messages.js +1 -0
  37. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/messages.js.map +1 -0
  38. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/types.js.map +1 -0
  39. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.js.map +1 -0
  40. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertValueToItem.js.map +1 -0
  41. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.js.map +1 -0
  42. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.js +7 -0
  43. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.js.map +1 -0
  44. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.js +6 -0
  45. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.js.map +1 -0
  46. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.js +10 -0
  47. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.js.map +1 -0
  48. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.js +25 -0
  49. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.js.map +1 -0
  50. package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/RatingInput.js.map +1 -0
  51. package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/index.js.map +1 -0
  52. package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/styles.css +7 -7
  53. package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/types.js.map +1 -0
  54. package/dist/esm/lib/common/Wrapper/InvisibleWrapper.js +3 -1
  55. package/dist/esm/lib/common/Wrapper/InvisibleWrapper.js.map +1 -1
  56. package/dist/esm/lib/common/Wrapper/ToggleWrapper.css +0 -6
  57. package/dist/esm/lib/common/Wrapper/ToggleWrapper.js +2 -1
  58. package/dist/esm/lib/common/Wrapper/ToggleWrapper.js.map +1 -1
  59. package/dist/esm/lib/common/Wrapper/Wrapper.js +10 -6
  60. package/dist/esm/lib/common/Wrapper/Wrapper.js.map +1 -1
  61. package/dist/esm/lib/common/Wrapper/createMiddleware.js +70 -0
  62. package/dist/esm/lib/common/Wrapper/createMiddleware.js.map +1 -0
  63. package/dist/esm/lib/common/Wrapper/hooks/useFieldWrapper.js +2 -2
  64. package/dist/esm/lib/common/Wrapper/hooks/useFieldWrapper.js.map +1 -1
  65. package/dist/esm/lib/common/Wrapper/withConditionalDisplay.js +17 -12
  66. package/dist/esm/lib/common/Wrapper/withConditionalDisplay.js.map +1 -1
  67. package/dist/esm/lib/common/Wrapper/withWrapper.js +16 -10
  68. package/dist/esm/lib/common/Wrapper/withWrapper.js.map +1 -1
  69. package/dist/esm/lib/component/ChoicesField/Choices.js +2 -2
  70. package/dist/esm/lib/component/ChoicesField/Choices.js.map +1 -1
  71. package/dist/esm/lib/component/ChoicesField/ChoicesField.js +3 -2
  72. package/dist/esm/lib/component/ChoicesField/ChoicesField.js.map +1 -1
  73. package/dist/esm/lib/component/ChoicesField/styles.css +3 -65
  74. package/dist/esm/lib/component/DateTimeField/DateTimeField.js +2 -1
  75. package/dist/esm/lib/component/DateTimeField/DateTimeField.js.map +1 -1
  76. package/dist/esm/lib/component/FileUploadField/FileUploadField.js +45 -41
  77. package/dist/esm/lib/component/FileUploadField/FileUploadField.js.map +1 -1
  78. package/dist/esm/lib/component/FileUploadField/fileUploadRules.js +39 -0
  79. package/dist/esm/lib/component/FileUploadField/fileUploadRules.js.map +1 -0
  80. package/dist/esm/lib/component/FileUploadField/styles.css +30 -0
  81. package/dist/esm/lib/component/RichChoicesField/RichChoices.js +2 -2
  82. package/dist/esm/lib/component/RichChoicesField/RichChoices.js.map +1 -1
  83. package/dist/esm/lib/component/RichChoicesField/RichChoicesField.js +2 -2
  84. package/dist/esm/lib/component/index.js +5 -4
  85. package/dist/esm/lib/component/index.js.map +1 -1
  86. package/dist/esm/lib/index.js.map +1 -1
  87. package/dist/esm/lib/pattern/Field/Field.js +3 -3
  88. package/dist/esm/lib/pattern/Field/Field.js.map +1 -1
  89. package/dist/esm/lib/subcomponent/DateInput/styles.css +16 -0
  90. package/dist/esm/lib/subcomponent/DateTimeInput/styles.css +24 -7
  91. package/dist/esm/lib/subcomponent/Field/Description/Description.js +1 -3
  92. package/dist/esm/lib/subcomponent/Field/Description/Description.js.map +1 -1
  93. package/dist/esm/lib/subcomponent/Field/Description/styles.css +4 -0
  94. package/dist/esm/lib/subcomponent/Field/Error/Error.js +4 -4
  95. package/dist/esm/lib/subcomponent/Field/Error/Error.js.map +1 -1
  96. package/dist/esm/lib/subcomponent/Field/Error/styles.css +8 -0
  97. package/dist/esm/lib/subcomponent/Field/Label/styles.css +1 -0
  98. package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js +119 -64
  99. package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js.map +1 -1
  100. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.js +52 -0
  101. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.js.map +1 -0
  102. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/index.js +2 -0
  103. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/index.js.map +1 -0
  104. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/types.js +2 -0
  105. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/types.js.map +1 -0
  106. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.js +40 -0
  107. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.js.map +1 -0
  108. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/index.js +2 -0
  109. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/index.js.map +1 -0
  110. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/types.js +2 -0
  111. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/types.js.map +1 -0
  112. package/dist/esm/lib/subcomponent/FileUploadInput/constants.js +3 -0
  113. package/dist/esm/lib/subcomponent/FileUploadInput/constants.js.map +1 -0
  114. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/index.js +3 -0
  115. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/index.js.map +1 -0
  116. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useFileUploads.js +148 -0
  117. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useFileUploads.js.map +1 -0
  118. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.js +22 -0
  119. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.js.map +1 -0
  120. package/dist/esm/lib/subcomponent/FileUploadInput/messages.js +25 -0
  121. package/dist/esm/lib/subcomponent/FileUploadInput/messages.js.map +1 -0
  122. package/dist/esm/lib/subcomponent/FileUploadInput/styles.css +255 -94
  123. package/dist/esm/lib/subcomponent/FileUploadInput/utils/formatFileSize.js +21 -0
  124. package/dist/esm/lib/subcomponent/FileUploadInput/utils/formatFileSize.js.map +1 -0
  125. package/dist/esm/lib/subcomponent/FileUploadInput/utils/getFileMessage.js +20 -0
  126. package/dist/esm/lib/subcomponent/FileUploadInput/utils/getFileMessage.js.map +1 -0
  127. package/dist/esm/lib/subcomponent/FileUploadInput/utils/index.js +4 -0
  128. package/dist/esm/lib/subcomponent/FileUploadInput/utils/index.js.map +1 -0
  129. package/dist/esm/lib/subcomponent/FileUploadInput/utils/matchesAccept.js +26 -0
  130. package/dist/esm/lib/subcomponent/FileUploadInput/utils/matchesAccept.js.map +1 -0
  131. package/dist/esm/lib/subcomponent/NumberInput/NumberInput.js +1 -1
  132. package/dist/esm/lib/subcomponent/NumberInput/NumberInput.js.map +1 -1
  133. package/dist/esm/lib/subcomponent/NumberInput/styles.css +17 -0
  134. package/dist/esm/lib/subcomponent/PasswordInput/styles.css +7 -1
  135. package/dist/esm/lib/subcomponent/PhoneInput/PhoneInput.js +8 -2
  136. package/dist/esm/lib/subcomponent/PhoneInput/PhoneInput.js.map +1 -1
  137. package/dist/esm/lib/subcomponent/RadioInput/styles.css +15 -13
  138. package/dist/esm/lib/subcomponent/TextInput/TextInput.js +3 -1
  139. package/dist/esm/lib/subcomponent/TextInput/TextInput.js.map +1 -1
  140. package/dist/esm/lib/subcomponent/index.js +5 -5
  141. package/dist/esm/lib/subcomponent/index.js.map +1 -1
  142. package/dist/esm/lib/utils/hooks/useFieldAriaProperties.js +6 -4
  143. package/dist/esm/lib/utils/hooks/useFieldAriaProperties.js.map +1 -1
  144. package/dist/esm/lib/utils/hooks/useOptionAriaProperties.js +3 -3
  145. package/dist/esm/lib/utils/hooks/useOptionAriaProperties.js.map +1 -1
  146. package/dist/esm/lib/utils/middleware/addRESTOptions.js +99 -39
  147. package/dist/esm/lib/utils/middleware/addRESTOptions.js.map +1 -1
  148. package/dist/esm/lib/utils/middleware/addRESTValidation.js +246 -32
  149. package/dist/esm/lib/utils/middleware/addRESTValidation.js.map +1 -1
  150. package/dist/esm/lib/utils/middleware/index.js +1 -0
  151. package/dist/esm/lib/utils/middleware/index.js.map +1 -1
  152. package/dist/esm/testing/expectNoAxeViolations.js +30 -0
  153. package/dist/esm/testing/expectNoAxeViolations.js.map +1 -0
  154. package/dist/types/lib/{component → _work_in_progress/component}/ColorField/ColorField.d.ts +7 -12
  155. package/dist/types/lib/_work_in_progress/component/ColorField/ColorField.d.ts.map +1 -0
  156. package/dist/types/lib/_work_in_progress/component/ColorField/index.d.ts.map +1 -0
  157. package/dist/types/lib/{component → _work_in_progress/component}/ColorField/types.d.ts +1 -1
  158. package/dist/types/lib/_work_in_progress/component/ColorField/types.d.ts.map +1 -0
  159. package/dist/types/lib/_work_in_progress/component/ComboboxField/ComboboxField.d.ts +53 -0
  160. package/dist/types/lib/_work_in_progress/component/ComboboxField/ComboboxField.d.ts.map +1 -0
  161. package/dist/types/lib/_work_in_progress/component/ComboboxField/index.d.ts.map +1 -0
  162. package/dist/types/lib/{component → _work_in_progress/component}/ComboboxField/types.d.ts +1 -1
  163. package/dist/types/lib/_work_in_progress/component/ComboboxField/types.d.ts.map +1 -0
  164. package/dist/types/lib/{component → _work_in_progress/component}/RatingField/RatingField.d.ts +7 -12
  165. package/dist/types/lib/_work_in_progress/component/RatingField/RatingField.d.ts.map +1 -0
  166. package/dist/types/lib/_work_in_progress/component/RatingField/index.d.ts.map +1 -0
  167. package/dist/types/lib/{component → _work_in_progress/component}/RatingField/types.d.ts +1 -1
  168. package/dist/types/lib/_work_in_progress/component/RatingField/types.d.ts.map +1 -0
  169. package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/ColorInput.d.ts.map +1 -0
  170. package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/index.d.ts.map +1 -0
  171. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/types.d.ts +1 -1
  172. package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/types.d.ts.map +1 -0
  173. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/ComboboxInput.d.ts +13 -5
  174. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/ComboboxInput.d.ts.map +1 -0
  175. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.d.ts +24 -0
  176. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.d.ts.map +1 -0
  177. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/SingleCombobox.d.ts +19 -4
  178. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/SingleCombobox.d.ts.map +1 -0
  179. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/List.d.ts +1 -1
  180. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/List.d.ts.map +1 -0
  181. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/index.d.ts.map +1 -0
  182. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/types.d.ts +2 -1
  183. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/types.d.ts.map +1 -0
  184. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/ResetButton.d.ts +1 -1
  185. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/ResetButton.d.ts.map +1 -0
  186. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/index.d.ts.map +1 -0
  187. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/types.d.ts +1 -0
  188. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/types.d.ts.map +1 -0
  189. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/index.d.ts.map +1 -0
  190. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/constants.d.ts.map +1 -0
  191. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/index.d.ts.map +1 -0
  192. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/messages.d.ts +1 -0
  193. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/messages.d.ts.map +1 -0
  194. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/types.d.ts +52 -0
  195. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/types.d.ts.map +1 -0
  196. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.d.ts +4 -0
  197. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.d.ts.map +1 -0
  198. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertValueToItem.d.ts +1 -1
  199. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertValueToItem.d.ts.map +1 -0
  200. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.d.ts +4 -0
  201. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.d.ts.map +1 -0
  202. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.d.ts +7 -0
  203. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.d.ts.map +1 -0
  204. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.d.ts +4 -0
  205. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.d.ts.map +1 -0
  206. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.d.ts +8 -0
  207. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.d.ts.map +1 -0
  208. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.d.ts +13 -0
  209. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.d.ts.map +1 -0
  210. package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/RatingInput.d.ts.map +1 -0
  211. package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/index.d.ts.map +1 -0
  212. package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/types.d.ts.map +1 -0
  213. package/dist/types/lib/common/Wrapper/InvisibleWrapper.d.ts.map +1 -1
  214. package/dist/types/lib/common/Wrapper/ToggleWrapper.d.ts.map +1 -1
  215. package/dist/types/lib/common/Wrapper/Wrapper.d.ts +1 -1
  216. package/dist/types/lib/common/Wrapper/Wrapper.d.ts.map +1 -1
  217. package/dist/types/lib/common/Wrapper/createMiddleware.d.ts +43 -0
  218. package/dist/types/lib/common/Wrapper/createMiddleware.d.ts.map +1 -0
  219. package/dist/types/lib/common/Wrapper/hooks/useFieldWrapper.d.ts +2 -0
  220. package/dist/types/lib/common/Wrapper/hooks/useFieldWrapper.d.ts.map +1 -1
  221. package/dist/types/lib/common/Wrapper/withConditionalDisplay.d.ts +9 -3
  222. package/dist/types/lib/common/Wrapper/withConditionalDisplay.d.ts.map +1 -1
  223. package/dist/types/lib/common/Wrapper/withWrapper.d.ts +3 -5
  224. package/dist/types/lib/common/Wrapper/withWrapper.d.ts.map +1 -1
  225. package/dist/types/lib/common/types.d.ts +19 -7
  226. package/dist/types/lib/common/types.d.ts.map +1 -1
  227. package/dist/types/lib/component/ChoicesField/Choices.d.ts +1 -1
  228. package/dist/types/lib/component/ChoicesField/Choices.d.ts.map +1 -1
  229. package/dist/types/lib/component/ChoicesField/ChoicesField.d.ts +9 -13
  230. package/dist/types/lib/component/ChoicesField/ChoicesField.d.ts.map +1 -1
  231. package/dist/types/lib/component/ChoicesField/types.d.ts +2 -2
  232. package/dist/types/lib/component/ChoicesField/types.d.ts.map +1 -1
  233. package/dist/types/lib/component/DateField/DateField.d.ts +6 -11
  234. package/dist/types/lib/component/DateTimeField/DateTimeField.d.ts +7 -11
  235. package/dist/types/lib/component/DateTimeField/DateTimeField.d.ts.map +1 -1
  236. package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts +299 -19
  237. package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts.map +1 -1
  238. package/dist/types/lib/component/FileUploadField/fileUploadRules.d.ts +24 -0
  239. package/dist/types/lib/component/FileUploadField/fileUploadRules.d.ts.map +1 -0
  240. package/dist/types/lib/component/HiddenField/HiddenField.d.ts +6 -11
  241. package/dist/types/lib/component/NumberField/NumberField.d.ts +6 -11
  242. package/dist/types/lib/component/PasswordField/PasswordField.d.ts +6 -11
  243. package/dist/types/lib/component/PhoneField/PhoneField.d.ts +7 -11
  244. package/dist/types/lib/component/RangeField/RangeField.d.ts +6 -11
  245. package/dist/types/lib/component/RichChoicesField/RichChoices.d.ts +1 -1
  246. package/dist/types/lib/component/RichChoicesField/RichChoices.d.ts.map +1 -1
  247. package/dist/types/lib/component/RichChoicesField/RichChoicesField.d.ts +8 -13
  248. package/dist/types/lib/component/RichChoicesField/types.d.ts +2 -2
  249. package/dist/types/lib/component/RichChoicesField/types.d.ts.map +1 -1
  250. package/dist/types/lib/component/SelectField/SelectField.d.ts +6 -11
  251. package/dist/types/lib/component/TextField/TextField.d.ts +6 -11
  252. package/dist/types/lib/component/TextareaField/TextareaField.d.ts +6 -11
  253. package/dist/types/lib/component/TimeField/TimeField.d.ts +6 -11
  254. package/dist/types/lib/component/index.d.ts +3 -3
  255. package/dist/types/lib/component/index.d.ts.map +1 -1
  256. package/dist/types/lib/index.d.ts +1 -1
  257. package/dist/types/lib/index.d.ts.map +1 -1
  258. package/dist/types/lib/pattern/Field/types.d.ts +4 -4
  259. package/dist/types/lib/pattern/Field/types.d.ts.map +1 -1
  260. package/dist/types/lib/subcomponent/Field/Description/Description.d.ts.map +1 -1
  261. package/dist/types/lib/subcomponent/Field/Error/Error.d.ts.map +1 -1
  262. package/dist/types/lib/subcomponent/FileUploadInput/FileUploadInput.d.ts +25 -4
  263. package/dist/types/lib/subcomponent/FileUploadInput/FileUploadInput.d.ts.map +1 -1
  264. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.d.ts +15 -0
  265. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.d.ts.map +1 -0
  266. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/index.d.ts +3 -0
  267. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/index.d.ts.map +1 -0
  268. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/types.d.ts +28 -0
  269. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/types.d.ts.map +1 -0
  270. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.d.ts +14 -0
  271. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.d.ts.map +1 -0
  272. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/index.d.ts +3 -0
  273. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/index.d.ts.map +1 -0
  274. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/types.d.ts +9 -0
  275. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/types.d.ts.map +1 -0
  276. package/dist/types/lib/subcomponent/FileUploadInput/constants.d.ts +3 -0
  277. package/dist/types/lib/subcomponent/FileUploadInput/constants.d.ts.map +1 -0
  278. package/dist/types/lib/subcomponent/FileUploadInput/hooks/index.d.ts +3 -0
  279. package/dist/types/lib/subcomponent/FileUploadInput/hooks/index.d.ts.map +1 -0
  280. package/dist/types/lib/subcomponent/FileUploadInput/hooks/useFileUploads.d.ts +33 -0
  281. package/dist/types/lib/subcomponent/FileUploadInput/hooks/useFileUploads.d.ts.map +1 -0
  282. package/dist/types/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.d.ts +8 -0
  283. package/dist/types/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.d.ts.map +1 -0
  284. package/dist/types/lib/subcomponent/FileUploadInput/index.d.ts +1 -1
  285. package/dist/types/lib/subcomponent/FileUploadInput/index.d.ts.map +1 -1
  286. package/dist/types/lib/subcomponent/FileUploadInput/messages.d.ts +4 -0
  287. package/dist/types/lib/subcomponent/FileUploadInput/messages.d.ts.map +1 -0
  288. package/dist/types/lib/subcomponent/FileUploadInput/types.d.ts +165 -8
  289. package/dist/types/lib/subcomponent/FileUploadInput/types.d.ts.map +1 -1
  290. package/dist/types/lib/subcomponent/FileUploadInput/utils/formatFileSize.d.ts +7 -0
  291. package/dist/types/lib/subcomponent/FileUploadInput/utils/formatFileSize.d.ts.map +1 -0
  292. package/dist/types/lib/subcomponent/FileUploadInput/utils/getFileMessage.d.ts +14 -0
  293. package/dist/types/lib/subcomponent/FileUploadInput/utils/getFileMessage.d.ts.map +1 -0
  294. package/dist/types/lib/subcomponent/FileUploadInput/utils/index.d.ts +5 -0
  295. package/dist/types/lib/subcomponent/FileUploadInput/utils/index.d.ts.map +1 -0
  296. package/dist/types/lib/subcomponent/FileUploadInput/utils/matchesAccept.d.ts +10 -0
  297. package/dist/types/lib/subcomponent/FileUploadInput/utils/matchesAccept.d.ts.map +1 -0
  298. package/dist/types/lib/subcomponent/PhoneInput/PhoneInput.d.ts +12 -0
  299. package/dist/types/lib/subcomponent/PhoneInput/PhoneInput.d.ts.map +1 -1
  300. package/dist/types/lib/subcomponent/PhoneInput/types.d.ts +11 -2
  301. package/dist/types/lib/subcomponent/PhoneInput/types.d.ts.map +1 -1
  302. package/dist/types/lib/subcomponent/TextInput/TextInput.d.ts +2 -0
  303. package/dist/types/lib/subcomponent/TextInput/TextInput.d.ts.map +1 -1
  304. package/dist/types/lib/subcomponent/index.d.ts +7 -7
  305. package/dist/types/lib/subcomponent/index.d.ts.map +1 -1
  306. package/dist/types/lib/subcomponent/types.d.ts +6 -0
  307. package/dist/types/lib/subcomponent/types.d.ts.map +1 -1
  308. package/dist/types/lib/utils/hooks/useFieldAriaProperties.d.ts +2 -1
  309. package/dist/types/lib/utils/hooks/useFieldAriaProperties.d.ts.map +1 -1
  310. package/dist/types/lib/utils/hooks/useOptionAriaProperties.d.ts +3 -2
  311. package/dist/types/lib/utils/hooks/useOptionAriaProperties.d.ts.map +1 -1
  312. package/dist/types/lib/utils/middleware/addRESTOptions.d.ts +37 -4
  313. package/dist/types/lib/utils/middleware/addRESTOptions.d.ts.map +1 -1
  314. package/dist/types/lib/utils/middleware/addRESTValidation.d.ts +38 -3
  315. package/dist/types/lib/utils/middleware/addRESTValidation.d.ts.map +1 -1
  316. package/dist/types/lib/utils/middleware/index.d.ts +2 -0
  317. package/dist/types/lib/utils/middleware/index.d.ts.map +1 -1
  318. package/dist/types/testing/expectNoAxeViolations.d.ts +10 -0
  319. package/dist/types/testing/expectNoAxeViolations.d.ts.map +1 -0
  320. package/package.json +18 -17
  321. package/dist/esm/lib/component/ColorField/ColorField.js.map +0 -1
  322. package/dist/esm/lib/component/ColorField/index.js.map +0 -1
  323. package/dist/esm/lib/component/ColorField/types.js.map +0 -1
  324. package/dist/esm/lib/component/ComboboxField/ComboboxField.js.map +0 -1
  325. package/dist/esm/lib/component/ComboboxField/index.js.map +0 -1
  326. package/dist/esm/lib/component/ComboboxField/types.js.map +0 -1
  327. package/dist/esm/lib/component/RatingField/RatingField.js.map +0 -1
  328. package/dist/esm/lib/component/RatingField/index.js.map +0 -1
  329. package/dist/esm/lib/component/RatingField/types.js.map +0 -1
  330. package/dist/esm/lib/subcomponent/ColorInput/ColorInput.js.map +0 -1
  331. package/dist/esm/lib/subcomponent/ColorInput/index.js.map +0 -1
  332. package/dist/esm/lib/subcomponent/ColorInput/types.js.map +0 -1
  333. package/dist/esm/lib/subcomponent/ComboboxInput/ComboboxInput.js.map +0 -1
  334. package/dist/esm/lib/subcomponent/ComboboxInput/MultipleCombobox.js +0 -84
  335. package/dist/esm/lib/subcomponent/ComboboxInput/MultipleCombobox.js.map +0 -1
  336. package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js +0 -67
  337. package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js.map +0 -1
  338. package/dist/esm/lib/subcomponent/ComboboxInput/common/List/List.js.map +0 -1
  339. package/dist/esm/lib/subcomponent/ComboboxInput/common/List/index.js.map +0 -1
  340. package/dist/esm/lib/subcomponent/ComboboxInput/common/List/types.js.map +0 -1
  341. package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/ResetButton.js.map +0 -1
  342. package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/index.js.map +0 -1
  343. package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/types.js.map +0 -1
  344. package/dist/esm/lib/subcomponent/ComboboxInput/common/index.js.map +0 -1
  345. package/dist/esm/lib/subcomponent/ComboboxInput/constants.js.map +0 -1
  346. package/dist/esm/lib/subcomponent/ComboboxInput/index.js.map +0 -1
  347. package/dist/esm/lib/subcomponent/ComboboxInput/messages.js.map +0 -1
  348. package/dist/esm/lib/subcomponent/ComboboxInput/types.js.map +0 -1
  349. package/dist/esm/lib/subcomponent/ComboboxInput/utils/convertItemToString.js.map +0 -1
  350. package/dist/esm/lib/subcomponent/ComboboxInput/utils/convertValueToItem.js.map +0 -1
  351. package/dist/esm/lib/subcomponent/ComboboxInput/utils/filterItems.js.map +0 -1
  352. package/dist/esm/lib/subcomponent/ComboboxInput/utils/index.js +0 -4
  353. package/dist/esm/lib/subcomponent/ComboboxInput/utils/index.js.map +0 -1
  354. package/dist/esm/lib/subcomponent/RatingInput/RatingInput.js.map +0 -1
  355. package/dist/esm/lib/subcomponent/RatingInput/index.js.map +0 -1
  356. package/dist/esm/lib/subcomponent/RatingInput/types.js.map +0 -1
  357. package/dist/types/lib/component/ColorField/ColorField.d.ts.map +0 -1
  358. package/dist/types/lib/component/ColorField/index.d.ts.map +0 -1
  359. package/dist/types/lib/component/ColorField/types.d.ts.map +0 -1
  360. package/dist/types/lib/component/ComboboxField/ComboboxField.d.ts +0 -56
  361. package/dist/types/lib/component/ComboboxField/ComboboxField.d.ts.map +0 -1
  362. package/dist/types/lib/component/ComboboxField/index.d.ts.map +0 -1
  363. package/dist/types/lib/component/ComboboxField/types.d.ts.map +0 -1
  364. package/dist/types/lib/component/RatingField/RatingField.d.ts.map +0 -1
  365. package/dist/types/lib/component/RatingField/index.d.ts.map +0 -1
  366. package/dist/types/lib/component/RatingField/types.d.ts.map +0 -1
  367. package/dist/types/lib/subcomponent/ColorInput/ColorInput.d.ts.map +0 -1
  368. package/dist/types/lib/subcomponent/ColorInput/index.d.ts.map +0 -1
  369. package/dist/types/lib/subcomponent/ColorInput/types.d.ts.map +0 -1
  370. package/dist/types/lib/subcomponent/ComboboxInput/ComboboxInput.d.ts.map +0 -1
  371. package/dist/types/lib/subcomponent/ComboboxInput/MultipleCombobox.d.ts +0 -16
  372. package/dist/types/lib/subcomponent/ComboboxInput/MultipleCombobox.d.ts.map +0 -1
  373. package/dist/types/lib/subcomponent/ComboboxInput/SingleCombobox.d.ts.map +0 -1
  374. package/dist/types/lib/subcomponent/ComboboxInput/common/List/List.d.ts.map +0 -1
  375. package/dist/types/lib/subcomponent/ComboboxInput/common/List/index.d.ts.map +0 -1
  376. package/dist/types/lib/subcomponent/ComboboxInput/common/List/types.d.ts.map +0 -1
  377. package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/ResetButton.d.ts.map +0 -1
  378. package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/index.d.ts.map +0 -1
  379. package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/types.d.ts.map +0 -1
  380. package/dist/types/lib/subcomponent/ComboboxInput/common/index.d.ts.map +0 -1
  381. package/dist/types/lib/subcomponent/ComboboxInput/constants.d.ts.map +0 -1
  382. package/dist/types/lib/subcomponent/ComboboxInput/index.d.ts.map +0 -1
  383. package/dist/types/lib/subcomponent/ComboboxInput/messages.d.ts.map +0 -1
  384. package/dist/types/lib/subcomponent/ComboboxInput/types.d.ts +0 -27
  385. package/dist/types/lib/subcomponent/ComboboxInput/types.d.ts.map +0 -1
  386. package/dist/types/lib/subcomponent/ComboboxInput/utils/convertItemToString.d.ts +0 -4
  387. package/dist/types/lib/subcomponent/ComboboxInput/utils/convertItemToString.d.ts.map +0 -1
  388. package/dist/types/lib/subcomponent/ComboboxInput/utils/convertValueToItem.d.ts.map +0 -1
  389. package/dist/types/lib/subcomponent/ComboboxInput/utils/filterItems.d.ts +0 -4
  390. package/dist/types/lib/subcomponent/ComboboxInput/utils/filterItems.d.ts.map +0 -1
  391. package/dist/types/lib/subcomponent/ComboboxInput/utils/index.d.ts +0 -4
  392. package/dist/types/lib/subcomponent/ComboboxInput/utils/index.d.ts.map +0 -1
  393. package/dist/types/lib/subcomponent/RatingInput/RatingInput.d.ts.map +0 -1
  394. package/dist/types/lib/subcomponent/RatingInput/index.d.ts.map +0 -1
  395. package/dist/types/lib/subcomponent/RatingInput/types.d.ts.map +0 -1
  396. /package/dist/esm/lib/{component → _work_in_progress/component}/ColorField/index.js +0 -0
  397. /package/dist/esm/lib/{component → _work_in_progress/component}/ColorField/types.js +0 -0
  398. /package/dist/esm/lib/{component → _work_in_progress/component}/ComboboxField/index.js +0 -0
  399. /package/dist/esm/lib/{component → _work_in_progress/component}/ComboboxField/types.js +0 -0
  400. /package/dist/esm/lib/{component → _work_in_progress/component}/RatingField/index.js +0 -0
  401. /package/dist/esm/lib/{component → _work_in_progress/component}/RatingField/types.js +0 -0
  402. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/ColorInput.js +0 -0
  403. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/index.js +0 -0
  404. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/styles.css +0 -0
  405. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/types.js +0 -0
  406. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/ComboboxInput.js +0 -0
  407. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/index.js +0 -0
  408. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/styles.css +0 -0
  409. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/types.js +0 -0
  410. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/index.js +0 -0
  411. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/types.js +0 -0
  412. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/index.js +0 -0
  413. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/constants.js +0 -0
  414. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/index.js +0 -0
  415. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/styles.css +0 -0
  416. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/types.js +0 -0
  417. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertItemToString.js +0 -0
  418. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertValueToItem.js +0 -0
  419. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/filterItems.js +0 -0
  420. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/RatingInput.js +0 -0
  421. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/index.js +0 -0
  422. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/types.js +0 -0
  423. /package/dist/types/lib/{component → _work_in_progress/component}/ColorField/index.d.ts +0 -0
  424. /package/dist/types/lib/{component → _work_in_progress/component}/ComboboxField/index.d.ts +0 -0
  425. /package/dist/types/lib/{component → _work_in_progress/component}/RatingField/index.d.ts +0 -0
  426. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/ColorInput.d.ts +0 -0
  427. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/index.d.ts +0 -0
  428. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/index.d.ts +0 -0
  429. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/index.d.ts +0 -0
  430. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/index.d.ts +0 -0
  431. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/constants.d.ts +0 -0
  432. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/index.d.ts +0 -0
  433. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/RatingInput.d.ts +0 -0
  434. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/index.d.ts +0 -0
  435. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/types.d.ts +0 -0
@@ -0,0 +1,9 @@
1
+ /** Props for a file's image thumbnail. */
2
+ export type ThumbnailProps = {
3
+ /**
4
+ * The object URL of the image. Without it the thumbnail box stays empty and
5
+ * has no preview.
6
+ */
7
+ url?: string;
8
+ };
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/subcomponent/FileUploadInput/common/Thumbnail/types.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** How long the result icon stays on a tile after its upload ends, in ms. */
2
+ export declare const RESULT_DISPLAY_DURATION = 2000;
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/constants.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as useFileUploads } from "./useFileUploads.js";
2
+ export { default as useObjectUrl } from "./useObjectUrl.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { UploadFunction, UploadState, UploadSummary } from "../types.js";
2
+ type UseFileUploadsOptions = {
3
+ /** The upload function; the input is live only when it is set. */
4
+ upload?: UploadFunction;
5
+ /** Whether a chosen file may be uploaded (a file with an error may not). */
6
+ canUpload: (file: File) => boolean;
7
+ /** Called when the count of running or failed uploads changes. */
8
+ onSummaryChange?: (summary: UploadSummary) => void;
9
+ };
10
+ type FileUploads = {
11
+ /** The upload state of each chosen file that has been sent. */
12
+ states: ReadonlyMap<File, UploadState>;
13
+ /** Sends a file again after a failed upload. */
14
+ retry: (file: File) => void;
15
+ };
16
+ /**
17
+ * Runs the live uploads of the chosen files. Each new file that may be
18
+ * uploaded is sent once with its own abort signal; a file that leaves the
19
+ * selection has its upload aborted and its state dropped. Upload state lives
20
+ * here, keyed by the `File` object, and never in the form value.
21
+ *
22
+ * Cancelling an upload is removing its file: the consumer drops it from the
23
+ * value, and the upload is aborted with it. Once an upload ends, success or
24
+ * failure, its result shows for `RESULT_DISPLAY_DURATION`; a failed upload
25
+ * then stays failed until it is retried or removed.
26
+ *
27
+ * Every upload promise is settled here, so neither a rejection nor an abort
28
+ * escapes as an unhandled rejection. A result from an upload that has since
29
+ * been retried or removed is ignored.
30
+ */
31
+ export default function useFileUploads(files: readonly File[], { upload, canUpload, onSummaryChange }: UseFileUploadsOptions): FileUploads;
32
+ export {};
33
+ //# sourceMappingURL=useFileUploads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFileUploads.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/hooks/useFileUploads.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9E,KAAK,qBAAqB,GAAG;IAC3B,kEAAkE;IAClE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,4EAA4E;IAC5E,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC,kEAAkE;IAClE,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,+DAA+D;IAC/D,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvC,gDAAgD;IAChD,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAC7B,CAAC;AAeF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,qBAAqB,GAC5D,WAAW,CAoJb"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * An object URL for a file, created after mount and revoked when the file
3
+ * changes or the component unmounts. `undefined` without a file, during server
4
+ * rendering, on the first client render, and where object URLs are not
5
+ * supported.
6
+ */
7
+ export default function useObjectUrl(file: File | undefined): string | undefined;
8
+ //# sourceMappingURL=useObjectUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useObjectUrl.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,MAAM,GAAG,SAAS,CAcpB"}
@@ -1,3 +1,3 @@
1
1
  export { default as FileUploadInput } from "./FileUploadInput.js";
2
- export type { FileUploadInputProps } from "./types.js";
2
+ export type { FileMessage, FileMessageLevel, FileUploadInputProps, FileUploadMessages, UploadFunction, UploadOptions, UploadSummary, } from "./types.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FileUploadMessages } from "./types.js";
2
+ declare const messages: FileUploadMessages;
3
+ export default messages;
4
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAKrD,QAAA,MAAM,QAAQ,EAAE,kBAsBf,CAAC;eAEa,QAAQ"}
@@ -1,19 +1,176 @@
1
- import type { BaseProps } from "../types.js";
2
- /** Props for the presentational FileUpload input (controlled, no react-hook-form). */
3
- export type FileUploadInputProps = BaseProps & {
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ /** How serious a per-file message is. */
3
+ export type FileMessageLevel = "warning" | "error";
4
+ /** A message shown under one file's tile. */
5
+ export type FileMessage = {
6
+ level: FileMessageLevel;
7
+ message: string;
8
+ };
9
+ /** What the input hands an `upload` function for each file. */
10
+ export type UploadOptions = {
11
+ /** Aborted when the user cancels the upload, which removes the file. */
12
+ signal: AbortSignal;
13
+ /** Report the share of the file sent so far, from 0 to 1. */
14
+ onProgress: (fraction: number) => void;
15
+ };
16
+ /**
17
+ * Sends one file. Resolve when the file is stored; reject when it is not. A
18
+ * rejection, including one caused by the abort signal, is caught by the input.
19
+ */
20
+ export type UploadFunction = (file: File, options: UploadOptions) => Promise<void>;
21
+ /**
22
+ * Where one file's live upload stands. Once an upload ends, `showResult` is
23
+ * true while its progress and result icon show, then false.
24
+ */
25
+ export type UploadState = {
26
+ status: "uploading";
27
+ progress: number;
28
+ } | {
29
+ status: "uploaded";
30
+ showResult: boolean;
31
+ } | {
32
+ status: "failed";
33
+ reason: unknown;
34
+ /** The share sent before the upload failed, from 0 to 1. */
35
+ progress: number;
36
+ showResult: boolean;
37
+ };
38
+ /** How many live uploads are running, and how many need a retry. */
39
+ export type UploadSummary = {
40
+ /** Files still uploading. */
41
+ uploading: number;
42
+ /** Files whose upload failed, and that are still chosen. */
43
+ failed: number;
44
+ };
45
+ /**
46
+ * Every text the input renders or announces. Pass a subset through the
47
+ * `messages` prop to translate or reword it.
48
+ */
49
+ export type FileUploadMessages = {
50
+ /** The text in the drop area, before the button. */
51
+ dropAreaText: () => string;
52
+ /** The label of the button that opens the file picker. */
53
+ chooseFile: (multiple: boolean) => string;
54
+ /** A file size, from bytes. Change it to localise the size format. */
55
+ fileSize: (bytes: number) => string;
56
+ /** The visible upload progress, from 0 to 1. */
57
+ progress: (fraction: number) => string;
58
+ /** The text alternative of the spinner while a file uploads. */
59
+ statusUploading: (fileName: string) => string;
60
+ /** The text alternative of the success icon. */
61
+ statusUploaded: (fileName: string) => string;
62
+ /** The text alternative of the warning icon after an upload. */
63
+ statusUploadedWithWarning: (fileName: string) => string;
64
+ /** The text alternative of the error icon after a failed upload. */
65
+ statusFailed: (fileName: string) => string;
66
+ /** The name of the button that removes a file. */
67
+ remove: (fileName: string) => string;
68
+ /** The name of the button that cancels a running upload and removes the file. */
69
+ cancelUpload: (fileName: string) => string;
70
+ /** The name of the button that retries a failed upload. */
71
+ retryUpload: (fileName: string) => string;
72
+ /** The text alternative of the icon before a per-file message. */
73
+ messageLevel: (level: FileMessageLevel) => string;
74
+ /** The message under a file whose upload failed. */
75
+ uploadFailed: (file: File, reason: unknown) => string;
76
+ /** The message under a file larger than `maxSize`, given as a size text. */
77
+ fileTooLarge: (maxSize: string) => string;
78
+ /** The message under a file that `accept` does not allow. */
79
+ fileTypeNotAccepted: (accept: string) => string;
80
+ /** The field error when more than `maxFiles` files are chosen. */
81
+ tooManyFiles: (maxFiles: number) => string;
82
+ /** The field error while a chosen file has an error. */
83
+ filesHaveErrors: () => string;
84
+ /** The field error while a file is still uploading. */
85
+ uploadsPending: () => string;
86
+ /** The field error while a file's upload failed. */
87
+ uploadsFailed: () => string;
88
+ };
89
+ type OwnProps = {
90
+ /**
91
+ * The `id` of the native file input, which a field label targets with
92
+ * `for`. Not set on the root element.
93
+ */
94
+ id?: string;
95
+ /**
96
+ * Name of the native file input, so the selected files post in a plain HTML
97
+ * submission. The form needs `enctype="multipart/form-data"` for the browser
98
+ * to send file contents.
99
+ */
100
+ name?: string;
101
+ /** Whether a file must be selected. Set on the native file input. */
102
+ required?: boolean;
4
103
  /** Selected files (controlled value). */
5
104
  value?: File[];
6
105
  /** Called with the next file list when files are added or removed. */
7
106
  onChange?: (files: File[]) => void;
8
- /** Accepted MIME types (e.g. "image/*,.pdf") */
107
+ /**
108
+ * Accepted file types, as in the native `accept` attribute (for example
109
+ * `"image/*,.pdf"`). A file that does not match gets an error under its
110
+ * tile.
111
+ */
9
112
  accept?: string;
10
- /** Maximum file size in bytes */
113
+ /** Maximum file size in bytes. A larger file gets an error under its tile. */
11
114
  maxSize?: number;
12
- /** Maximum number of files */
115
+ /**
116
+ * Maximum number of files. The field reports a larger selection as a field
117
+ * error; the input itself does not drop files.
118
+ */
13
119
  maxFiles?: number;
14
- /** Allow multiple file selection */
120
+ /**
121
+ * Allow multiple files. When `false`, the drop area hides once a file is
122
+ * chosen and returns when the file is removed. It stays while `showFileList`
123
+ * is off, since the file list is then the only way to remove the file.
124
+ */
15
125
  multiple?: boolean;
16
- /** Whether the input is disabled */
126
+ /** Whether the input is disabled. A disabled input draws no file list. */
17
127
  disabled?: boolean;
128
+ /**
129
+ * Upload each file as soon as it is chosen. Without it the input only lists
130
+ * the files, with no status, progress or retry.
131
+ */
132
+ upload?: UploadFunction;
133
+ /**
134
+ * Add a warning or an error to a file. Runs only when `accept` and
135
+ * `maxSize` raise nothing. A file with an error is not uploaded.
136
+ */
137
+ validateFile?: (file: File) => FileMessage | undefined;
138
+ /** Show each file's size on its tile. */
139
+ showFileSize?: boolean;
140
+ /**
141
+ * Show the drop area, with its Choose file button. When off, the files can
142
+ * only be added by the consumer through `value`; the field-level `error` still
143
+ * shows, and the file actions carry the field's `aria-describedby`.
144
+ */
145
+ showDropArea?: boolean;
146
+ /** Show the list of chosen files, with their tiles and messages. */
147
+ showFileList?: boolean;
148
+ /**
149
+ * A field-level message rendered under the drop area, or in its place when
150
+ * the drop area is not shown. While it is set, the drop area takes the error
151
+ * colours.
152
+ */
153
+ error?: ReactNode;
154
+ /** Called when the number of running or failed uploads changes. */
155
+ onUploadStatusChange?: (summary: UploadSummary) => void;
156
+ /** Replaces some of the default texts. */
157
+ messages?: Partial<FileUploadMessages>;
158
+ /** Labels the button that opens the file picker, with its own text. */
159
+ "aria-labelledby"?: string;
160
+ /** Describes the button that opens the file picker. */
161
+ "aria-describedby"?: string;
162
+ /**
163
+ * Marks the button that opens the file picker as invalid, and gives the drop
164
+ * area the error colours.
165
+ */
166
+ "aria-invalid"?: boolean | "true" | "false";
167
+ /** Points the button that opens the file picker at the field error. */
168
+ "aria-errormessage"?: string;
18
169
  };
170
+ /**
171
+ * Props for the presentational FileUpload input (controlled, no
172
+ * react-hook-form). Renders a `<div class="ds input file-upload">` as its root.
173
+ */
174
+ export type FileUploadInputProps = OwnProps & Omit<ComponentProps<"div">, keyof OwnProps>;
175
+ export {};
19
176
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,sFAAsF;AACtF,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG;IAC7C,yCAAyC;IACzC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IAEf,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAEnC,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,o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,aAAa,KAAK,IAAI,CAAC;IAExD,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEvC,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,uDAAuD;IACvD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAE5C,uEAAuE;IACvE,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GACzC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Formats a byte count as a short, human-readable size in the given locale,
3
+ * for example `1.5 MB` in English or `1,5 MB` in German. Sizes step by 1024.
4
+ * @note Pure.
5
+ */
6
+ export default function formatFileSize(bytes: number, locale?: string): string;
7
+ //# sourceMappingURL=formatFileSize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatFileSize.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/utils/formatFileSize.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAO,GAAG,MAAM,CAa3E"}
@@ -0,0 +1,14 @@
1
+ import type { FileMessage, FileUploadMessages } from "../types.js";
2
+ export type FileRules = {
3
+ accept?: string;
4
+ maxSize?: number;
5
+ validateFile?: (file: File) => FileMessage | undefined;
6
+ };
7
+ /**
8
+ * The message for one chosen file: an error when `accept` or `maxSize` rejects
9
+ * it, otherwise whatever `validateFile` returns. The input shows it under the
10
+ * file's tile, and the field turns an error into an invalid field.
11
+ * @note Pure when `validateFile` is.
12
+ */
13
+ export default function getFileMessage(file: File, { accept, maxSize, validateFile }: FileRules, messages: Pick<FileUploadMessages, "fileSize" | "fileTooLarge" | "fileTypeNotAccepted">): FileMessage | undefined;
14
+ //# sourceMappingURL=getFileMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFileMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/utils/getFileMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGnE,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,WAAW,GAAG,SAAS,CAAC;CACxD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,IAAI,EAAE,IAAI,EACV,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,SAAS,EAC5C,QAAQ,EAAE,IAAI,CACZ,kBAAkB,EAClB,UAAU,GAAG,cAAc,GAAG,qBAAqB,CACpD,GACA,WAAW,GAAG,SAAS,CAWzB"}
@@ -0,0 +1,5 @@
1
+ export { default as formatFileSize } from "./formatFileSize.js";
2
+ export type { FileRules } from "./getFileMessage.js";
3
+ export { default as getFileMessage } from "./getFileMessage.js";
4
+ export { default as matchesAccept } from "./matchesAccept.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether a file matches an `accept` list, by the rules of the native
3
+ * `accept` attribute: a `.ext` entry matches the end of the file name, a
4
+ * `type/*` entry matches the start of the MIME type, and any other entry
5
+ * matches the MIME type exactly. Matching ignores case. An empty list accepts
6
+ * every file.
7
+ * @note Pure.
8
+ */
9
+ export default function matchesAccept(file: File, accept: string): boolean;
10
+ //# sourceMappingURL=matchesAccept.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchesAccept.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/utils/matchesAccept.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAazE"}
@@ -14,6 +14,12 @@ import "./styles.css";
14
14
  *
15
15
  * The forwarded ref reaches the national-number input — the field's focusable
16
16
  * element, and what react-hook-form needs for `setFocus` and focus-on-error.
17
+ * The `id` and the field's ARIA wiring go on that input too, so the field label
18
+ * names it; the country `<select>` keeps its own "Country code" label. Without
19
+ * `aria-labelledby` the number input falls back to a "Phone number" label.
20
+ *
21
+ * With a `name`, both controls post in a plain HTML submission: the number as
22
+ * `<name>` and the selected country code as `<name>-country`.
17
23
  * @returns {React.ReactElement} - Rendered Phone
18
24
  *
19
25
  * `import { PhoneInput } from "@canonical/react-ds-global-form";`
@@ -21,6 +27,12 @@ import "./styles.css";
21
27
  * @implements ds:global.subcomponent.phone_input
22
28
  */
23
29
  export declare const PhoneInput: React.ForwardRefExoticComponent<import("../types.js").BaseProps & {
30
+ "aria-describedby"?: string | undefined;
31
+ "aria-errormessage"?: string | undefined;
32
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
33
+ "aria-labelledby"?: string | undefined;
34
+ "aria-required"?: ("false" | "true" | boolean) | undefined;
35
+ } & {
24
36
  name?: string;
25
37
  value?: string | PhoneValue;
26
38
  onChange?: (value: string | PhoneValue) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAIxC,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,cAAc,CAAC;AAgDtB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;0CAgKtB,CAAC;eAEa,UAAU"}
1
+ {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAIxC,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,cAAc,CAAC;AAgDtB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;0CA2KtB,CAAC;eAEa,UAAU"}
@@ -1,12 +1,21 @@
1
+ import type React from "react";
1
2
  import type { CountryData, KnownCountryCode } from "../../utils/countries/index.js";
2
3
  import type { BaseProps } from "../types.js";
3
4
  export type { CountryCode, CountryData, KnownCountryCode, } from "../../utils/countries/index.js";
5
+ /**
6
+ * ARIA wiring for the national-number input. The field tier supplies these, so
7
+ * the number is named by the field label and described by its description and
8
+ * error.
9
+ */
10
+ type PhoneNumberAriaProps = Pick<React.AriaAttributes, "aria-labelledby" | "aria-describedby" | "aria-errormessage" | "aria-invalid" | "aria-required">;
4
11
  /** Props for the presentational Phone input (controlled, no react-hook-form). */
5
- export type PhoneInputProps = BaseProps & {
12
+ export type PhoneInputProps = BaseProps & PhoneNumberAriaProps & {
6
13
  /**
7
14
  * Name for the national-number input. The field tier supplies this; it is what
8
15
  * gives the control a name in a plain HTML submission, so the entry is not
9
- * silently dropped when scripting is unavailable.
16
+ * silently dropped when scripting is unavailable. The country `<select>` is
17
+ * named `<name>-country`, so a server can rebuild the full number from a
18
+ * plain submission.
10
19
  */
11
20
  name?: string;
12
21
  /** Controlled value — E.164 string or structured object. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/PhoneInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,YAAY,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAExC,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE5B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,KAAK,IAAI,CAAC;IAEhD;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEnD,0EAA0E;IAC1E,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAEvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAExC;;;OAGG;IAC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,CAAC,gBAAgB,CAAC,CAAC;IAEnD,0EAA0E;IAC1E,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAEvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAExC;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAE1B,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAEpC;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAE1C;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEJ,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -4,6 +4,8 @@ import "./styles.css";
4
4
  *
5
5
  * Usable standalone (controlled via `value`/`onChange`, or uncontrolled) or via
6
6
  * the field tier, which spreads react-hook-form's `register()` result onto it.
7
+ * The `id` goes on the native `<input>`, not the chrome wrapper, so a
8
+ * `<label for>` names and focuses the real control.
7
9
  * @returns {ReactElement} - Rendered Text
8
10
  *
9
11
  * `import { TextInput } from "@canonical/react-ds-global-form";`
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/TextInput/TextInput.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;;;oDAyBrB,CAAC;eAEa,SAAS"}
1
+ {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/TextInput/TextInput.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS;;;;oDAwBrB,CAAC;eAEa,SAAS"}
@@ -1,15 +1,17 @@
1
+ export type { ColorInputProps, HexFormat, } from "../_work_in_progress/subcomponent/ColorInput/index.js";
2
+ export { ColorInput } from "../_work_in_progress/subcomponent/ColorInput/index.js";
3
+ export type { ComboboxInputProps } from "../_work_in_progress/subcomponent/ComboboxInput/index.js";
4
+ export { ComboboxInput } from "../_work_in_progress/subcomponent/ComboboxInput/index.js";
5
+ export type { RatingInputProps, RatingScale, } from "../_work_in_progress/subcomponent/RatingInput/index.js";
6
+ export { RatingInput } from "../_work_in_progress/subcomponent/RatingInput/index.js";
1
7
  export type { CheckboxInputProps } from "./CheckboxInput/index.js";
2
8
  export { CheckboxInput } from "./CheckboxInput/index.js";
3
- export type { ColorInputProps, HexFormat } from "./ColorInput/index.js";
4
- export { ColorInput } from "./ColorInput/index.js";
5
- export type { ComboboxInputProps } from "./ComboboxInput/index.js";
6
- export { ComboboxInput } from "./ComboboxInput/index.js";
7
9
  export type { DateInputProps } from "./DateInput/index.js";
8
10
  export { DateInput } from "./DateInput/index.js";
9
11
  export type { DateTimeInputProps } from "./DateTimeInput/index.js";
10
12
  export { DateTimeInput } from "./DateTimeInput/index.js";
11
13
  export * from "./Field/index.js";
12
- export type { FileUploadInputProps } from "./FileUploadInput/index.js";
14
+ export type { FileMessage, FileMessageLevel, FileUploadInputProps, FileUploadMessages, UploadFunction, UploadOptions, UploadSummary, } from "./FileUploadInput/index.js";
13
15
  export { FileUploadInput } from "./FileUploadInput/index.js";
14
16
  export type { HiddenInputProps } from "./HiddenInput/index.js";
15
17
  export { HiddenInput } from "./HiddenInput/index.js";
@@ -23,8 +25,6 @@ export type { RadioInputProps } from "./RadioInput/index.js";
23
25
  export { RadioInput } from "./RadioInput/index.js";
24
26
  export type { RangeInputProps } from "./RangeInput/index.js";
25
27
  export { RangeInput } from "./RangeInput/index.js";
26
- export type { RatingInputProps, RatingScale } from "./RatingInput/index.js";
27
- export { RatingInput } from "./RatingInput/index.js";
28
28
  export type { SelectInputProps } from "./SelectInput/index.js";
29
29
  export { SelectInput } from "./SelectInput/index.js";
30
30
  export type { SwitchInputProps } from "./SwitchInput/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/subcomponent/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,cAAc,kBAAkB,CAAC;AACjC,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EA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AAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,cAAc,YAAY,CAAC"}
@@ -4,6 +4,12 @@ export type BaseProps = {
4
4
  className?: string;
5
5
  style?: React.CSSProperties;
6
6
  };
7
+ /**
8
+ * ARIA wiring for an option group's fieldset. The field tier supplies these, so
9
+ * the group is named by the field label and described by its description and
10
+ * error.
11
+ */
12
+ export type GroupAriaProps = Pick<React.AriaAttributes, "aria-labelledby" | "aria-describedby">;
7
13
  /** A selectable option for choice-style inputs (Select, Combobox, Choices…). */
8
14
  export type Option = {
9
15
  value: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/subcomponent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,iEAAiE;AACjE,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,OAAO,GACP,QAAQ,GACR,KAAK,GACL,KAAK,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/subcomponent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,KAAK,CAAC,cAAc,EACpB,iBAAiB,GAAG,kBAAkB,CACvC,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,iEAAiE;AACjE,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,OAAO,GACP,QAAQ,GACR,KAAK,GACL,KAAK,CAAC"}
@@ -3,9 +3,10 @@
3
3
  * @param {string} name - The name of the field.
4
4
  * @param {boolean} isError - Indicates if the field is in an error state.
5
5
  * @param {boolean} [isRequired] - Whether the field is required (drives `aria-required`, independent of error state).
6
+ * @param {boolean} [hasDescription] - Whether a description is rendered. `aria-describedby` only references ids that are in the document.
6
7
  * @returns An object containing ARIA attributes for input, label, description, and error state.
7
8
  */
8
- declare const useFieldAriaProps: (name: string, isError: boolean, isRequired?: boolean) => {
9
+ declare const useFieldAriaProps: (name: string, isError: boolean, isRequired?: boolean, hasDescription?: boolean) => {
9
10
  input: {
10
11
  id: string;
11
12
  "aria-labelledby": string;
@@ -1 +1 @@
1
- {"version":3,"file":"useFieldAriaProperties.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/useFieldAriaProperties.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,SACf,MAAM,WACH,OAAO;;QAYV,EAAE;QACF,iBAAiB;QACjB,kBAAkB;QAGlB,mBAAmB;QACnB,cAAc;QAId,eAAe;;;QAGf,EAAE;QACF,OAAO;;;QAEM,EAAE;;;QAEf,EAAE;;CAMT,CAAC;eAEa,iBAAiB"}
1
+ {"version":3,"file":"useFieldAriaProperties.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/useFieldAriaProperties.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,QAAA,MAAM,iBAAiB,SACf,MAAM,WACH,OAAO;;QAaV,EAAE;QACF,iBAAiB;QACjB,kBAAkB;QAIlB,mBAAmB;QACnB,cAAc;QAId,eAAe;;;QAGf,EAAE;QACF,OAAO;;;QAEM,EAAE;;;QAEf,EAAE;;CAMT,CAAC;eAEa,iBAAiB"}
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Generates ARIA properties for a specific option in a choice-style field.
3
3
  * Pure (no react-hook-form) — lives in the presentational tier so option-group
4
- * inputs (Choices, RichChoices) can use it standalone.
4
+ * inputs (Choices, RichChoices) can use it standalone. Options carry no
5
+ * `aria-describedby`: the field description describes the whole group, so it is
6
+ * referenced from the group's fieldset instead.
5
7
  * @param {string} name - The base name of the input field.
6
8
  * @param {string} optionValue - The value of the specific option.
7
9
  * @returns An object containing ARIA attributes for the option.
@@ -10,7 +12,6 @@ declare const useOptionAriaProps: (name: string, optionValue: string) => {
10
12
  input: {
11
13
  id: string;
12
14
  "aria-labelledby": string;
13
- "aria-describedby": string;
14
15
  };
15
16
  label: {
16
17
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useOptionAriaProperties.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/useOptionAriaProperties.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,SAAU,MAAM,eAAe,MAAM;;QAWrD,EAAE;QACF,iBAAiB;QACjB,kBAAkB;;;QAGlB,EAAE;QACF,OAAO;;CAKd,CAAC;eAEa,kBAAkB"}
1
+ {"version":3,"file":"useOptionAriaProperties.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/useOptionAriaProperties.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,QAAA,MAAM,kBAAkB,SAAU,MAAM,eAAe,MAAM;;QASrD,EAAE;QACF,iBAAiB;;;QAGjB,EAAE;QACF,OAAO;;CAKd,CAAC;eAEa,kBAAkB"}
@@ -1,10 +1,43 @@
1
- import type { Middleware } from "../../common/types.js";
1
+ import type { BaseInputProps } from "../../common/types.js";
2
+ import { type ConfiguredMiddleware } from "../../common/Wrapper/createMiddleware.js";
2
3
  import type { Option } from "../../subcomponent/types.js";
3
- interface OptionsFetchOptions {
4
+ interface OptionsFetchOptions<Data> {
5
+ /** HTTP method of the options request. Defaults to `"GET"`. */
4
6
  method?: string;
7
+ /** Headers sent with the options request. */
5
8
  headers?: Record<string, string>;
6
- transformData?: (data: any) => Option[];
9
+ /**
10
+ * Turns the response body into options. Without it the body must already be
11
+ * an `Option[]`.
12
+ */
13
+ transformData?: (data: Data) => Option[];
7
14
  }
8
- declare function addRESTFieldOptions(url: string, options?: OptionsFetchOptions): Middleware<any>;
15
+ /** Props the options middleware reads from, and writes to, the field. */
16
+ type OptionsFieldProps = BaseInputProps & {
17
+ options?: Option[];
18
+ disabled?: boolean;
19
+ };
20
+ /** A middleware that works with any field taking `options`. */
21
+ type OptionsMiddleware = ConfiguredMiddleware<OptionsFieldProps>;
22
+ /**
23
+ * Fetches a field's options from a REST endpoint and passes them as the
24
+ * `options` prop.
25
+ *
26
+ * The field keeps its normal markup in every state. While loading it is
27
+ * disabled, marked `aria-busy`, and has no options. A failed request is set as
28
+ * the field's error, so it shows where the field shows any other error, and
29
+ * leaves the field enabled. The middleware can be created inline: the field
30
+ * keeps one instance, which fetches again only when the URL changes, and
31
+ * drops the answer for the previous URL, its error included. The request is
32
+ * aborted when the field unmounts. Use one per field: an inner instance's
33
+ * options replace the outer one's.
34
+ *
35
+ * @param url - The endpoint returning the options.
36
+ * @param options - Request and transform options.
37
+ * @returns A middleware for any field that takes `options`.
38
+ *
39
+ * `import { addRESTOptions } from "@canonical/react-ds-global-form";`
40
+ */
41
+ declare function addRESTFieldOptions<Data = Option[]>(url: string, options?: OptionsFetchOptions<Data>): OptionsMiddleware;
9
42
  export default addRESTFieldOptions;
10
43
  //# sourceMappingURL=addRESTOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addRESTOptions.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/middleware/addRESTOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D,UAAU,mBAAmB;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,EAAE,CAAC;CACzC;AAED,iBAAS,mBAAmB,CAC1B,GAAG,EA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