@canonical/react-ds-global-form 0.47.0 → 0.49.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 (439) hide show
  1. package/README.md +5 -6
  2. package/dist/esm/density.css +40 -79
  3. package/dist/esm/index.css +39 -22
  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 +199 -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 +3 -3
  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/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/styles.css +1 -2
  39. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/types.js.map +1 -0
  40. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.js.map +1 -0
  41. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertValueToItem.js.map +1 -0
  42. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.js.map +1 -0
  43. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.js +7 -0
  44. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.js.map +1 -0
  45. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.js +6 -0
  46. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.js.map +1 -0
  47. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.js +10 -0
  48. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.js.map +1 -0
  49. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.js +25 -0
  50. package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.js.map +1 -0
  51. package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/RatingInput.js.map +1 -0
  52. package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/index.js.map +1 -0
  53. package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/styles.css +7 -7
  54. package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/types.js.map +1 -0
  55. package/dist/esm/lib/common/Wrapper/InvisibleWrapper.js +3 -1
  56. package/dist/esm/lib/common/Wrapper/InvisibleWrapper.js.map +1 -1
  57. package/dist/esm/lib/common/Wrapper/ToggleWrapper.css +0 -6
  58. package/dist/esm/lib/common/Wrapper/ToggleWrapper.js +2 -1
  59. package/dist/esm/lib/common/Wrapper/ToggleWrapper.js.map +1 -1
  60. package/dist/esm/lib/common/Wrapper/Wrapper.js +10 -6
  61. package/dist/esm/lib/common/Wrapper/Wrapper.js.map +1 -1
  62. package/dist/esm/lib/common/Wrapper/createMiddleware.js +70 -0
  63. package/dist/esm/lib/common/Wrapper/createMiddleware.js.map +1 -0
  64. package/dist/esm/lib/common/Wrapper/hooks/useFieldWrapper.js +2 -2
  65. package/dist/esm/lib/common/Wrapper/hooks/useFieldWrapper.js.map +1 -1
  66. package/dist/esm/lib/common/Wrapper/withConditionalDisplay.js +17 -12
  67. package/dist/esm/lib/common/Wrapper/withConditionalDisplay.js.map +1 -1
  68. package/dist/esm/lib/common/Wrapper/withWrapper.js +16 -10
  69. package/dist/esm/lib/common/Wrapper/withWrapper.js.map +1 -1
  70. package/dist/esm/lib/component/ChoicesField/Choices.js +2 -2
  71. package/dist/esm/lib/component/ChoicesField/Choices.js.map +1 -1
  72. package/dist/esm/lib/component/ChoicesField/ChoicesField.js +3 -2
  73. package/dist/esm/lib/component/ChoicesField/ChoicesField.js.map +1 -1
  74. package/dist/esm/lib/component/ChoicesField/styles.css +3 -65
  75. package/dist/esm/lib/component/DateTimeField/DateTimeField.js +2 -1
  76. package/dist/esm/lib/component/DateTimeField/DateTimeField.js.map +1 -1
  77. package/dist/esm/lib/component/FileUploadField/FileUploadField.js +45 -41
  78. package/dist/esm/lib/component/FileUploadField/FileUploadField.js.map +1 -1
  79. package/dist/esm/lib/component/FileUploadField/fileUploadRules.js +39 -0
  80. package/dist/esm/lib/component/FileUploadField/fileUploadRules.js.map +1 -0
  81. package/dist/esm/lib/component/FileUploadField/styles.css +30 -0
  82. package/dist/esm/lib/component/RichChoicesField/RichChoices.js +2 -2
  83. package/dist/esm/lib/component/RichChoicesField/RichChoices.js.map +1 -1
  84. package/dist/esm/lib/component/RichChoicesField/RichChoicesField.js +2 -2
  85. package/dist/esm/lib/component/index.js +5 -4
  86. package/dist/esm/lib/component/index.js.map +1 -1
  87. package/dist/esm/lib/index.js.map +1 -1
  88. package/dist/esm/lib/pattern/Field/Field.js +3 -3
  89. package/dist/esm/lib/pattern/Field/Field.js.map +1 -1
  90. package/dist/esm/lib/subcomponent/DateInput/styles.css +16 -0
  91. package/dist/esm/lib/subcomponent/DateTimeInput/styles.css +24 -7
  92. package/dist/esm/lib/subcomponent/Field/Description/Description.js +1 -3
  93. package/dist/esm/lib/subcomponent/Field/Description/Description.js.map +1 -1
  94. package/dist/esm/lib/subcomponent/Field/Description/styles.css +4 -0
  95. package/dist/esm/lib/subcomponent/Field/Error/Error.js +4 -4
  96. package/dist/esm/lib/subcomponent/Field/Error/Error.js.map +1 -1
  97. package/dist/esm/lib/subcomponent/Field/Error/styles.css +8 -0
  98. package/dist/esm/lib/subcomponent/Field/Label/styles.css +1 -0
  99. package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js +119 -64
  100. package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js.map +1 -1
  101. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.js +52 -0
  102. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.js.map +1 -0
  103. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/index.js +2 -0
  104. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/index.js.map +1 -0
  105. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/types.js +2 -0
  106. package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/types.js.map +1 -0
  107. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.js +40 -0
  108. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.js.map +1 -0
  109. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/index.js +2 -0
  110. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/index.js.map +1 -0
  111. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/types.js +2 -0
  112. package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/types.js.map +1 -0
  113. package/dist/esm/lib/subcomponent/FileUploadInput/constants.js +3 -0
  114. package/dist/esm/lib/subcomponent/FileUploadInput/constants.js.map +1 -0
  115. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/index.js +3 -0
  116. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/index.js.map +1 -0
  117. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useFileUploads.js +148 -0
  118. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useFileUploads.js.map +1 -0
  119. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.js +22 -0
  120. package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.js.map +1 -0
  121. package/dist/esm/lib/subcomponent/FileUploadInput/messages.js +25 -0
  122. package/dist/esm/lib/subcomponent/FileUploadInput/messages.js.map +1 -0
  123. package/dist/esm/lib/subcomponent/FileUploadInput/styles.css +255 -94
  124. package/dist/esm/lib/subcomponent/FileUploadInput/utils/formatFileSize.js +21 -0
  125. package/dist/esm/lib/subcomponent/FileUploadInput/utils/formatFileSize.js.map +1 -0
  126. package/dist/esm/lib/subcomponent/FileUploadInput/utils/getFileMessage.js +20 -0
  127. package/dist/esm/lib/subcomponent/FileUploadInput/utils/getFileMessage.js.map +1 -0
  128. package/dist/esm/lib/subcomponent/FileUploadInput/utils/index.js +4 -0
  129. package/dist/esm/lib/subcomponent/FileUploadInput/utils/index.js.map +1 -0
  130. package/dist/esm/lib/subcomponent/FileUploadInput/utils/matchesAccept.js +26 -0
  131. package/dist/esm/lib/subcomponent/FileUploadInput/utils/matchesAccept.js.map +1 -0
  132. package/dist/esm/lib/subcomponent/NumberInput/NumberInput.js +1 -1
  133. package/dist/esm/lib/subcomponent/NumberInput/NumberInput.js.map +1 -1
  134. package/dist/esm/lib/subcomponent/NumberInput/styles.css +17 -0
  135. package/dist/esm/lib/subcomponent/PasswordInput/styles.css +7 -1
  136. package/dist/esm/lib/subcomponent/PhoneInput/PhoneInput.js +8 -2
  137. package/dist/esm/lib/subcomponent/PhoneInput/PhoneInput.js.map +1 -1
  138. package/dist/esm/lib/subcomponent/RadioInput/styles.css +15 -13
  139. package/dist/esm/lib/subcomponent/SelectInput/SelectInput.js +3 -2
  140. package/dist/esm/lib/subcomponent/SelectInput/SelectInput.js.map +1 -1
  141. package/dist/esm/lib/subcomponent/SelectInput/styles.css +39 -48
  142. package/dist/esm/lib/subcomponent/TextInput/TextInput.js +3 -1
  143. package/dist/esm/lib/subcomponent/TextInput/TextInput.js.map +1 -1
  144. package/dist/esm/lib/subcomponent/index.js +5 -5
  145. package/dist/esm/lib/subcomponent/index.js.map +1 -1
  146. package/dist/esm/lib/utils/hooks/useFieldAriaProperties.js +6 -4
  147. package/dist/esm/lib/utils/hooks/useFieldAriaProperties.js.map +1 -1
  148. package/dist/esm/lib/utils/hooks/useOptionAriaProperties.js +3 -3
  149. package/dist/esm/lib/utils/hooks/useOptionAriaProperties.js.map +1 -1
  150. package/dist/esm/lib/utils/middleware/addRESTOptions.js +99 -39
  151. package/dist/esm/lib/utils/middleware/addRESTOptions.js.map +1 -1
  152. package/dist/esm/lib/utils/middleware/addRESTValidation.js +246 -32
  153. package/dist/esm/lib/utils/middleware/addRESTValidation.js.map +1 -1
  154. package/dist/esm/lib/utils/middleware/index.js +1 -0
  155. package/dist/esm/lib/utils/middleware/index.js.map +1 -1
  156. package/dist/esm/testing/expectNoAxeViolations.js +30 -0
  157. package/dist/esm/testing/expectNoAxeViolations.js.map +1 -0
  158. package/dist/types/lib/{component → _work_in_progress/component}/ColorField/ColorField.d.ts +7 -12
  159. package/dist/types/lib/_work_in_progress/component/ColorField/ColorField.d.ts.map +1 -0
  160. package/dist/types/lib/_work_in_progress/component/ColorField/index.d.ts.map +1 -0
  161. package/dist/types/lib/{component → _work_in_progress/component}/ColorField/types.d.ts +1 -1
  162. package/dist/types/lib/_work_in_progress/component/ColorField/types.d.ts.map +1 -0
  163. package/dist/types/lib/_work_in_progress/component/ComboboxField/ComboboxField.d.ts +53 -0
  164. package/dist/types/lib/_work_in_progress/component/ComboboxField/ComboboxField.d.ts.map +1 -0
  165. package/dist/types/lib/_work_in_progress/component/ComboboxField/index.d.ts.map +1 -0
  166. package/dist/types/lib/{component → _work_in_progress/component}/ComboboxField/types.d.ts +1 -1
  167. package/dist/types/lib/_work_in_progress/component/ComboboxField/types.d.ts.map +1 -0
  168. package/dist/types/lib/{component → _work_in_progress/component}/RatingField/RatingField.d.ts +7 -12
  169. package/dist/types/lib/_work_in_progress/component/RatingField/RatingField.d.ts.map +1 -0
  170. package/dist/types/lib/_work_in_progress/component/RatingField/index.d.ts.map +1 -0
  171. package/dist/types/lib/{component → _work_in_progress/component}/RatingField/types.d.ts +1 -1
  172. package/dist/types/lib/_work_in_progress/component/RatingField/types.d.ts.map +1 -0
  173. package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/ColorInput.d.ts.map +1 -0
  174. package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/index.d.ts.map +1 -0
  175. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/types.d.ts +1 -1
  176. package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/types.d.ts.map +1 -0
  177. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/ComboboxInput.d.ts +13 -5
  178. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/ComboboxInput.d.ts.map +1 -0
  179. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.d.ts +24 -0
  180. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.d.ts.map +1 -0
  181. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/SingleCombobox.d.ts +19 -4
  182. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/SingleCombobox.d.ts.map +1 -0
  183. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/List.d.ts +1 -1
  184. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/List.d.ts.map +1 -0
  185. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/index.d.ts.map +1 -0
  186. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/types.d.ts +2 -1
  187. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/types.d.ts.map +1 -0
  188. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/ResetButton.d.ts +1 -1
  189. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/ResetButton.d.ts.map +1 -0
  190. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/index.d.ts.map +1 -0
  191. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/types.d.ts +1 -0
  192. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/types.d.ts.map +1 -0
  193. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/index.d.ts.map +1 -0
  194. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/constants.d.ts.map +1 -0
  195. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/index.d.ts.map +1 -0
  196. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/messages.d.ts +1 -0
  197. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/messages.d.ts.map +1 -0
  198. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/types.d.ts +52 -0
  199. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/types.d.ts.map +1 -0
  200. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.d.ts +4 -0
  201. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.d.ts.map +1 -0
  202. package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertValueToItem.d.ts +1 -1
  203. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertValueToItem.d.ts.map +1 -0
  204. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.d.ts +4 -0
  205. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.d.ts.map +1 -0
  206. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.d.ts +7 -0
  207. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.d.ts.map +1 -0
  208. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.d.ts +4 -0
  209. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.d.ts.map +1 -0
  210. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.d.ts +8 -0
  211. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.d.ts.map +1 -0
  212. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.d.ts +13 -0
  213. package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.d.ts.map +1 -0
  214. package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/RatingInput.d.ts.map +1 -0
  215. package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/index.d.ts.map +1 -0
  216. package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/types.d.ts.map +1 -0
  217. package/dist/types/lib/common/Wrapper/InvisibleWrapper.d.ts.map +1 -1
  218. package/dist/types/lib/common/Wrapper/ToggleWrapper.d.ts.map +1 -1
  219. package/dist/types/lib/common/Wrapper/Wrapper.d.ts +1 -1
  220. package/dist/types/lib/common/Wrapper/Wrapper.d.ts.map +1 -1
  221. package/dist/types/lib/common/Wrapper/createMiddleware.d.ts +43 -0
  222. package/dist/types/lib/common/Wrapper/createMiddleware.d.ts.map +1 -0
  223. package/dist/types/lib/common/Wrapper/hooks/useFieldWrapper.d.ts +2 -0
  224. package/dist/types/lib/common/Wrapper/hooks/useFieldWrapper.d.ts.map +1 -1
  225. package/dist/types/lib/common/Wrapper/withConditionalDisplay.d.ts +9 -3
  226. package/dist/types/lib/common/Wrapper/withConditionalDisplay.d.ts.map +1 -1
  227. package/dist/types/lib/common/Wrapper/withWrapper.d.ts +3 -5
  228. package/dist/types/lib/common/Wrapper/withWrapper.d.ts.map +1 -1
  229. package/dist/types/lib/common/types.d.ts +19 -7
  230. package/dist/types/lib/common/types.d.ts.map +1 -1
  231. package/dist/types/lib/component/ChoicesField/Choices.d.ts +1 -1
  232. package/dist/types/lib/component/ChoicesField/Choices.d.ts.map +1 -1
  233. package/dist/types/lib/component/ChoicesField/ChoicesField.d.ts +9 -13
  234. package/dist/types/lib/component/ChoicesField/ChoicesField.d.ts.map +1 -1
  235. package/dist/types/lib/component/ChoicesField/types.d.ts +2 -2
  236. package/dist/types/lib/component/ChoicesField/types.d.ts.map +1 -1
  237. package/dist/types/lib/component/DateField/DateField.d.ts +6 -11
  238. package/dist/types/lib/component/DateTimeField/DateTimeField.d.ts +7 -11
  239. package/dist/types/lib/component/DateTimeField/DateTimeField.d.ts.map +1 -1
  240. package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts +299 -19
  241. package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts.map +1 -1
  242. package/dist/types/lib/component/FileUploadField/fileUploadRules.d.ts +24 -0
  243. package/dist/types/lib/component/FileUploadField/fileUploadRules.d.ts.map +1 -0
  244. package/dist/types/lib/component/HiddenField/HiddenField.d.ts +6 -11
  245. package/dist/types/lib/component/NumberField/NumberField.d.ts +6 -11
  246. package/dist/types/lib/component/PasswordField/PasswordField.d.ts +6 -11
  247. package/dist/types/lib/component/PhoneField/PhoneField.d.ts +7 -11
  248. package/dist/types/lib/component/RangeField/RangeField.d.ts +6 -11
  249. package/dist/types/lib/component/RichChoicesField/RichChoices.d.ts +1 -1
  250. package/dist/types/lib/component/RichChoicesField/RichChoices.d.ts.map +1 -1
  251. package/dist/types/lib/component/RichChoicesField/RichChoicesField.d.ts +8 -13
  252. package/dist/types/lib/component/RichChoicesField/types.d.ts +2 -2
  253. package/dist/types/lib/component/RichChoicesField/types.d.ts.map +1 -1
  254. package/dist/types/lib/component/SelectField/SelectField.d.ts +6 -11
  255. package/dist/types/lib/component/TextField/TextField.d.ts +6 -11
  256. package/dist/types/lib/component/TextareaField/TextareaField.d.ts +6 -11
  257. package/dist/types/lib/component/TimeField/TimeField.d.ts +6 -11
  258. package/dist/types/lib/component/index.d.ts +3 -3
  259. package/dist/types/lib/component/index.d.ts.map +1 -1
  260. package/dist/types/lib/index.d.ts +1 -1
  261. package/dist/types/lib/index.d.ts.map +1 -1
  262. package/dist/types/lib/pattern/Field/types.d.ts +4 -4
  263. package/dist/types/lib/pattern/Field/types.d.ts.map +1 -1
  264. package/dist/types/lib/subcomponent/Field/Description/Description.d.ts.map +1 -1
  265. package/dist/types/lib/subcomponent/Field/Error/Error.d.ts.map +1 -1
  266. package/dist/types/lib/subcomponent/FileUploadInput/FileUploadInput.d.ts +25 -4
  267. package/dist/types/lib/subcomponent/FileUploadInput/FileUploadInput.d.ts.map +1 -1
  268. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.d.ts +15 -0
  269. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.d.ts.map +1 -0
  270. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/index.d.ts +3 -0
  271. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/index.d.ts.map +1 -0
  272. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/types.d.ts +28 -0
  273. package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/types.d.ts.map +1 -0
  274. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.d.ts +14 -0
  275. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.d.ts.map +1 -0
  276. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/index.d.ts +3 -0
  277. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/index.d.ts.map +1 -0
  278. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/types.d.ts +9 -0
  279. package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/types.d.ts.map +1 -0
  280. package/dist/types/lib/subcomponent/FileUploadInput/constants.d.ts +3 -0
  281. package/dist/types/lib/subcomponent/FileUploadInput/constants.d.ts.map +1 -0
  282. package/dist/types/lib/subcomponent/FileUploadInput/hooks/index.d.ts +3 -0
  283. package/dist/types/lib/subcomponent/FileUploadInput/hooks/index.d.ts.map +1 -0
  284. package/dist/types/lib/subcomponent/FileUploadInput/hooks/useFileUploads.d.ts +33 -0
  285. package/dist/types/lib/subcomponent/FileUploadInput/hooks/useFileUploads.d.ts.map +1 -0
  286. package/dist/types/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.d.ts +8 -0
  287. package/dist/types/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.d.ts.map +1 -0
  288. package/dist/types/lib/subcomponent/FileUploadInput/index.d.ts +1 -1
  289. package/dist/types/lib/subcomponent/FileUploadInput/index.d.ts.map +1 -1
  290. package/dist/types/lib/subcomponent/FileUploadInput/messages.d.ts +4 -0
  291. package/dist/types/lib/subcomponent/FileUploadInput/messages.d.ts.map +1 -0
  292. package/dist/types/lib/subcomponent/FileUploadInput/types.d.ts +165 -8
  293. package/dist/types/lib/subcomponent/FileUploadInput/types.d.ts.map +1 -1
  294. package/dist/types/lib/subcomponent/FileUploadInput/utils/formatFileSize.d.ts +7 -0
  295. package/dist/types/lib/subcomponent/FileUploadInput/utils/formatFileSize.d.ts.map +1 -0
  296. package/dist/types/lib/subcomponent/FileUploadInput/utils/getFileMessage.d.ts +14 -0
  297. package/dist/types/lib/subcomponent/FileUploadInput/utils/getFileMessage.d.ts.map +1 -0
  298. package/dist/types/lib/subcomponent/FileUploadInput/utils/index.d.ts +5 -0
  299. package/dist/types/lib/subcomponent/FileUploadInput/utils/index.d.ts.map +1 -0
  300. package/dist/types/lib/subcomponent/FileUploadInput/utils/matchesAccept.d.ts +10 -0
  301. package/dist/types/lib/subcomponent/FileUploadInput/utils/matchesAccept.d.ts.map +1 -0
  302. package/dist/types/lib/subcomponent/PhoneInput/PhoneInput.d.ts +12 -0
  303. package/dist/types/lib/subcomponent/PhoneInput/PhoneInput.d.ts.map +1 -1
  304. package/dist/types/lib/subcomponent/PhoneInput/types.d.ts +11 -2
  305. package/dist/types/lib/subcomponent/PhoneInput/types.d.ts.map +1 -1
  306. package/dist/types/lib/subcomponent/SelectInput/SelectInput.d.ts.map +1 -1
  307. package/dist/types/lib/subcomponent/TextInput/TextInput.d.ts +2 -0
  308. package/dist/types/lib/subcomponent/TextInput/TextInput.d.ts.map +1 -1
  309. package/dist/types/lib/subcomponent/index.d.ts +7 -7
  310. package/dist/types/lib/subcomponent/index.d.ts.map +1 -1
  311. package/dist/types/lib/subcomponent/types.d.ts +6 -0
  312. package/dist/types/lib/subcomponent/types.d.ts.map +1 -1
  313. package/dist/types/lib/utils/hooks/useFieldAriaProperties.d.ts +2 -1
  314. package/dist/types/lib/utils/hooks/useFieldAriaProperties.d.ts.map +1 -1
  315. package/dist/types/lib/utils/hooks/useOptionAriaProperties.d.ts +3 -2
  316. package/dist/types/lib/utils/hooks/useOptionAriaProperties.d.ts.map +1 -1
  317. package/dist/types/lib/utils/middleware/addRESTOptions.d.ts +37 -4
  318. package/dist/types/lib/utils/middleware/addRESTOptions.d.ts.map +1 -1
  319. package/dist/types/lib/utils/middleware/addRESTValidation.d.ts +38 -3
  320. package/dist/types/lib/utils/middleware/addRESTValidation.d.ts.map +1 -1
  321. package/dist/types/lib/utils/middleware/index.d.ts +2 -0
  322. package/dist/types/lib/utils/middleware/index.d.ts.map +1 -1
  323. package/dist/types/testing/expectNoAxeViolations.d.ts +10 -0
  324. package/dist/types/testing/expectNoAxeViolations.d.ts.map +1 -0
  325. package/package.json +21 -18
  326. package/dist/esm/lib/component/ColorField/ColorField.js.map +0 -1
  327. package/dist/esm/lib/component/ColorField/index.js.map +0 -1
  328. package/dist/esm/lib/component/ColorField/types.js.map +0 -1
  329. package/dist/esm/lib/component/ComboboxField/ComboboxField.js.map +0 -1
  330. package/dist/esm/lib/component/ComboboxField/index.js.map +0 -1
  331. package/dist/esm/lib/component/ComboboxField/types.js.map +0 -1
  332. package/dist/esm/lib/component/RatingField/RatingField.js.map +0 -1
  333. package/dist/esm/lib/component/RatingField/index.js.map +0 -1
  334. package/dist/esm/lib/component/RatingField/types.js.map +0 -1
  335. package/dist/esm/lib/subcomponent/ColorInput/ColorInput.js.map +0 -1
  336. package/dist/esm/lib/subcomponent/ColorInput/index.js.map +0 -1
  337. package/dist/esm/lib/subcomponent/ColorInput/types.js.map +0 -1
  338. package/dist/esm/lib/subcomponent/ComboboxInput/ComboboxInput.js.map +0 -1
  339. package/dist/esm/lib/subcomponent/ComboboxInput/MultipleCombobox.js +0 -84
  340. package/dist/esm/lib/subcomponent/ComboboxInput/MultipleCombobox.js.map +0 -1
  341. package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js +0 -67
  342. package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js.map +0 -1
  343. package/dist/esm/lib/subcomponent/ComboboxInput/common/List/List.js.map +0 -1
  344. package/dist/esm/lib/subcomponent/ComboboxInput/common/List/index.js.map +0 -1
  345. package/dist/esm/lib/subcomponent/ComboboxInput/common/List/types.js.map +0 -1
  346. package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/ResetButton.js.map +0 -1
  347. package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/index.js.map +0 -1
  348. package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/types.js.map +0 -1
  349. package/dist/esm/lib/subcomponent/ComboboxInput/common/index.js.map +0 -1
  350. package/dist/esm/lib/subcomponent/ComboboxInput/constants.js.map +0 -1
  351. package/dist/esm/lib/subcomponent/ComboboxInput/index.js.map +0 -1
  352. package/dist/esm/lib/subcomponent/ComboboxInput/messages.js.map +0 -1
  353. package/dist/esm/lib/subcomponent/ComboboxInput/types.js.map +0 -1
  354. package/dist/esm/lib/subcomponent/ComboboxInput/utils/convertItemToString.js.map +0 -1
  355. package/dist/esm/lib/subcomponent/ComboboxInput/utils/convertValueToItem.js.map +0 -1
  356. package/dist/esm/lib/subcomponent/ComboboxInput/utils/filterItems.js.map +0 -1
  357. package/dist/esm/lib/subcomponent/ComboboxInput/utils/index.js +0 -4
  358. package/dist/esm/lib/subcomponent/ComboboxInput/utils/index.js.map +0 -1
  359. package/dist/esm/lib/subcomponent/RatingInput/RatingInput.js.map +0 -1
  360. package/dist/esm/lib/subcomponent/RatingInput/index.js.map +0 -1
  361. package/dist/esm/lib/subcomponent/RatingInput/types.js.map +0 -1
  362. package/dist/types/lib/component/ColorField/ColorField.d.ts.map +0 -1
  363. package/dist/types/lib/component/ColorField/index.d.ts.map +0 -1
  364. package/dist/types/lib/component/ColorField/types.d.ts.map +0 -1
  365. package/dist/types/lib/component/ComboboxField/ComboboxField.d.ts +0 -56
  366. package/dist/types/lib/component/ComboboxField/ComboboxField.d.ts.map +0 -1
  367. package/dist/types/lib/component/ComboboxField/index.d.ts.map +0 -1
  368. package/dist/types/lib/component/ComboboxField/types.d.ts.map +0 -1
  369. package/dist/types/lib/component/RatingField/RatingField.d.ts.map +0 -1
  370. package/dist/types/lib/component/RatingField/index.d.ts.map +0 -1
  371. package/dist/types/lib/component/RatingField/types.d.ts.map +0 -1
  372. package/dist/types/lib/subcomponent/ColorInput/ColorInput.d.ts.map +0 -1
  373. package/dist/types/lib/subcomponent/ColorInput/index.d.ts.map +0 -1
  374. package/dist/types/lib/subcomponent/ColorInput/types.d.ts.map +0 -1
  375. package/dist/types/lib/subcomponent/ComboboxInput/ComboboxInput.d.ts.map +0 -1
  376. package/dist/types/lib/subcomponent/ComboboxInput/MultipleCombobox.d.ts +0 -16
  377. package/dist/types/lib/subcomponent/ComboboxInput/MultipleCombobox.d.ts.map +0 -1
  378. package/dist/types/lib/subcomponent/ComboboxInput/SingleCombobox.d.ts.map +0 -1
  379. package/dist/types/lib/subcomponent/ComboboxInput/common/List/List.d.ts.map +0 -1
  380. package/dist/types/lib/subcomponent/ComboboxInput/common/List/index.d.ts.map +0 -1
  381. package/dist/types/lib/subcomponent/ComboboxInput/common/List/types.d.ts.map +0 -1
  382. package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/ResetButton.d.ts.map +0 -1
  383. package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/index.d.ts.map +0 -1
  384. package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/types.d.ts.map +0 -1
  385. package/dist/types/lib/subcomponent/ComboboxInput/common/index.d.ts.map +0 -1
  386. package/dist/types/lib/subcomponent/ComboboxInput/constants.d.ts.map +0 -1
  387. package/dist/types/lib/subcomponent/ComboboxInput/index.d.ts.map +0 -1
  388. package/dist/types/lib/subcomponent/ComboboxInput/messages.d.ts.map +0 -1
  389. package/dist/types/lib/subcomponent/ComboboxInput/types.d.ts +0 -27
  390. package/dist/types/lib/subcomponent/ComboboxInput/types.d.ts.map +0 -1
  391. package/dist/types/lib/subcomponent/ComboboxInput/utils/convertItemToString.d.ts +0 -4
  392. package/dist/types/lib/subcomponent/ComboboxInput/utils/convertItemToString.d.ts.map +0 -1
  393. package/dist/types/lib/subcomponent/ComboboxInput/utils/convertValueToItem.d.ts.map +0 -1
  394. package/dist/types/lib/subcomponent/ComboboxInput/utils/filterItems.d.ts +0 -4
  395. package/dist/types/lib/subcomponent/ComboboxInput/utils/filterItems.d.ts.map +0 -1
  396. package/dist/types/lib/subcomponent/ComboboxInput/utils/index.d.ts +0 -4
  397. package/dist/types/lib/subcomponent/ComboboxInput/utils/index.d.ts.map +0 -1
  398. package/dist/types/lib/subcomponent/RatingInput/RatingInput.d.ts.map +0 -1
  399. package/dist/types/lib/subcomponent/RatingInput/index.d.ts.map +0 -1
  400. package/dist/types/lib/subcomponent/RatingInput/types.d.ts.map +0 -1
  401. /package/dist/esm/lib/{component → _work_in_progress/component}/ColorField/index.js +0 -0
  402. /package/dist/esm/lib/{component → _work_in_progress/component}/ColorField/types.js +0 -0
  403. /package/dist/esm/lib/{component → _work_in_progress/component}/ComboboxField/index.js +0 -0
  404. /package/dist/esm/lib/{component → _work_in_progress/component}/ComboboxField/types.js +0 -0
  405. /package/dist/esm/lib/{component → _work_in_progress/component}/RatingField/index.js +0 -0
  406. /package/dist/esm/lib/{component → _work_in_progress/component}/RatingField/types.js +0 -0
  407. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/ColorInput.js +0 -0
  408. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/index.js +0 -0
  409. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/styles.css +0 -0
  410. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/types.js +0 -0
  411. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/ComboboxInput.js +0 -0
  412. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/index.js +0 -0
  413. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/styles.css +0 -0
  414. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/types.js +0 -0
  415. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/index.js +0 -0
  416. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/types.js +0 -0
  417. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/index.js +0 -0
  418. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/constants.js +0 -0
  419. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/index.js +0 -0
  420. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/types.js +0 -0
  421. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertItemToString.js +0 -0
  422. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertValueToItem.js +0 -0
  423. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/filterItems.js +0 -0
  424. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/RatingInput.js +0 -0
  425. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/index.js +0 -0
  426. /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/types.js +0 -0
  427. /package/dist/types/lib/{component → _work_in_progress/component}/ColorField/index.d.ts +0 -0
  428. /package/dist/types/lib/{component → _work_in_progress/component}/ComboboxField/index.d.ts +0 -0
  429. /package/dist/types/lib/{component → _work_in_progress/component}/RatingField/index.d.ts +0 -0
  430. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/ColorInput.d.ts +0 -0
  431. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/index.d.ts +0 -0
  432. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/index.d.ts +0 -0
  433. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/index.d.ts +0 -0
  434. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/index.d.ts +0 -0
  435. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/constants.d.ts +0 -0
  436. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/index.d.ts +0 -0
  437. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/RatingInput.d.ts +0 -0
  438. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/index.d.ts +0 -0
  439. /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/types.d.ts +0 -0
package/README.md CHANGED
@@ -26,6 +26,8 @@ Each component brings its own stylesheet when you import it. The package stylesh
26
26
  import "@canonical/react-ds-global-form/dist/esm/index.css";
27
27
  ```
28
28
 
29
+ Testing with Jest? `@canonical/react-ds-global`'s [Testing with Jest](../ds-global/README.md#testing-with-jest) section covers the ESM transform, the stylesheet stub and the mapper entries that this package needs too.
30
+
29
31
  ### How component CSS reaches the page
30
32
 
31
33
  This package puts CSS on the page two ways. `dist/esm/index.css` — the file the snippet above imports — is the package-level stylesheet: the `--form-*` token block, the field grid, the shared input chrome, and `density.css`, which sizes every control to the context and density cell on the root. Each component module then imports its own stylesheet (`import "./styles.css"`), so importing a component is what puts that component's CSS on the page; a bundler collects those imports into the application's CSS. Nothing here is injected at runtime, and a component you never import ships no CSS.
@@ -58,7 +60,7 @@ An application's own **unlayered** CSS now beats every rule in this package, wha
58
60
 
59
61
  This package renders more native elements than any other: `<input>` in a dozen types, `<select>`, `<textarea>`, `<label>`, `<legend>`, `<fieldset>`, `<button>`. A component that renders a native element is responsible for that element's box — its margin, its width, its `min-width`, its `box-sizing` — and for `::placeholder` where it renders a text input. Anything a component leaves undeclared is filled in by whatever else the host page loads, and on a page that also runs another framework that is a visible bug rather than a default. Declaring the box is being done as its own change; until it lands, treat "the control looks right on our own page" as a weaker guarantee than it sounds.
60
62
 
61
- Nothing in this package portals: no `createPortal`, no `appendChild`, no `<dialog>`. The two surfaces that escape their container — the combobox list (`ComboboxInput/common/List/List.tsx:42`) and the colour picker's swatch panel (`ColorInput/ColorInput.tsx:198`) — use the Popover API, which promotes an element to the top layer for painting but leaves it where it is in the DOM. So they stay inside the `.ds` subtree their caller marks, and the element-level layers `@canonical/styles` scopes to that subtree still reach them.
63
+ Nothing in this package portals: no `createPortal`, no `appendChild`, no `<dialog>`. The two surfaces that escape their container — the combobox list (`_work_in_progress/subcomponent/ComboboxInput/common/List/List.tsx:42`) and the colour picker's swatch panel (`_work_in_progress/subcomponent/ColorInput/ColorInput.tsx:198`) — use the Popover API, which promotes an element to the top layer for painting but leaves it where it is in the DOM. So they stay inside the `.ds` subtree their caller marks, and the element-level layers `@canonical/styles` scopes to that subtree still reach them.
62
64
 
63
65
  ### Transitions read the motion tokens
64
66
 
@@ -258,14 +260,11 @@ Fields can conditionally render based on other field values:
258
260
  name="company"
259
261
  inputType="text"
260
262
  label="Company"
261
- condition={[
262
- ["accountType"],
263
- ([type]) => type === "business",
264
- ]}
263
+ condition={({ accountType }) => accountType === "business"}
265
264
  />
266
265
  ```
267
266
 
268
- The field only renders when the condition function returns true.
267
+ `condition` receives every form value and runs again whenever one changes. The field renders only while it returns `true`; a hidden field is not rendered, and unless `unregisterOnUnmount` is `false` its value is dropped, so it is not submitted.
269
268
 
270
269
  ## Storybook
271
270
 
@@ -38,8 +38,11 @@
38
38
  * Controls no longer carry `.p` — the density system supplies the body font tier
39
39
  * (font-size / weight / family) here. */
40
40
  /* NB `.ds.input.textarea` is EXCLUDED: the textarea seats intrinsically (its own
41
- * rule below) and must keep its multi-row min-height. */
42
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input:not(.textarea) {
41
+ * rule below) and must keep its multi-row min-height. `.ds.input.file-upload`
42
+ * is EXCLUDED too: it is a stack of a drop area and a file list, not one
43
+ * control box, so it takes no density cell. */
44
+ :is(.comfortable, .dense, .app, .site, .docs)
45
+ .ds.input:not(.textarea, .file-upload) {
43
46
  box-sizing: border-box;
44
47
  /* Same effective line-height the target-baseline uses (single source of the
45
48
  fallback chain), so a bare context class keeps a valid box height too. */
@@ -48,12 +51,6 @@
48
51
  min-block-size: var(--density-box-height);
49
52
  align-items: flex-start;
50
53
  justify-content: flex-start;
51
- /* Kill the UA BOTTOM padding only. Do NOT zero padding-block-start here: this
52
- selector is more specific (0,4,0) than the placement rule below (0,2,0), so a
53
- `padding-block: 0` shorthand would out-specify and WIPE the placement's
54
- `padding-block-start: var(--space-before)` — leaving the label pinned to the
55
- box top (off the baseline). The placement rule owns the start. */
56
- padding-block-end: 0;
57
54
 
58
55
  /* Body font tier — what `.p` used to supply. */
59
56
  font-size: var(--typography-text-primary-font-size);
@@ -64,7 +61,7 @@
64
61
  * child, top-reference it so the input's own space-before governs. Needs to beat
65
62
  * the TextInput's `.ds.input.text { align-items: stretch }` (0,3,0). */
66
63
  :is(.comfortable, .dense, .app, .site, .docs) .ds.input.text,
67
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input {
64
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.input:not(.file-upload) {
68
65
  align-items: flex-start;
69
66
  }
70
67
 
@@ -105,18 +102,13 @@
105
102
  * so `.editorial` composes with density with no specificity war. `:is()` (not
106
103
  * `:where()`) still gives the control seat the specificity to beat a control's own
107
104
  * centring (e.g. the Button's `align-items: center`). */
108
- /* Body font tier for the field label/description/error plus the toggle control
109
- row (its own line metrics must match the label's so the control row centres
110
- exactly), which lost `.p`. Scoped to just these (NOT the headings, which
111
- keep their own tier). */
105
+ /* Body font tier for the field label plus the toggle control row (its own
106
+ line metrics must match the label's so the control row centres exactly),
107
+ which lost `.p`. The description and the error read the secondary ramp,
108
+ so they stay out of this seat. Scoped to just these (NOT the headings,
109
+ which keep their own tier). */
112
110
  :is(.comfortable, .dense, .app, .site, .docs)
113
- :is(
114
- .ds.field-label,
115
- .ds.field-description,
116
- .ds.field-error,
117
- .ds.field-toggle,
118
- .ds.option
119
- ) {
111
+ :is(.ds.field-label, .ds.field-toggle, .ds.option) {
120
112
  font-size: var(--typography-text-primary-font-size);
121
113
  font-family: var(--typography-text-primary-font-family);
122
114
  }
@@ -156,13 +148,15 @@
156
148
  * block-size) yet lands exactly on the density cell, both edges on the grid.
157
149
  *
158
150
  * Placed AFTER the fixed-height box rule above so this (equal-specificity)
159
- * rule wins for the text family. Direct chromes (select/date/time) and the
160
- * textarea keep the previous model until their own cutover pass. */
151
+ * rule wins for the composite family. Direct chromes (date/time/datetime)
152
+ * and the textarea keep the previous model until their own cutover pass —
153
+ * their multi-part UA internals need their own measurement. */
161
154
  :is(.comfortable, .dense, .app, .site, .docs)
162
- .ds.input:is(.text, .number, .password, .phone) {
163
- /* The COMPOSITE chrome family — every wrapper with an inner <input> leaf
164
- (text, number, password, phone). One selector, one seat: the wrapper is
165
- the box, the leaf carries the line. */
155
+ .ds.input:is(.text, .number, .password, .phone, .select) {
156
+ /* The COMPOSITE chrome family — every wrapper with an inner form-element
157
+ leaf (text, number, password, phone hold an <input>; select holds a
158
+ <select>). One selector, one seat: the wrapper is the box, the leaf
159
+ carries the line. */
166
160
 
167
161
  /* NO drift term here — deliberately. The old ~2px "native input renders low"
168
162
  compensation was an artifact of the line-height:1 crush structure: give the
@@ -212,12 +206,15 @@
212
206
  block-size: auto;
213
207
  min-block-size: 0;
214
208
  padding-block-end: var(--seat-after);
215
- /* Stretch (not the box rule's flex-start): a prefix/suffix — the password's
216
- reveal-toggle, the number's unit affix — spans the leaf's column and its
217
- own `align-items: center` centres its icon on the TEXT, which is the
218
- optical pairing (centring on the box would float it into the asymmetric
219
- closing pad). The old fixed-height model needed flex-start to top-pin the
220
- crushed leaf; the intrinsic leaf seats itself, so stretch is safe again. */
209
+ /* Stretch (not the box rule's flex-start): a prefix/suffix spans the
210
+ leaf's column. An affix that must pair with the VALUE takes the leaf's
211
+ own seat — the number input's unit slots read --seat-line-floored and
212
+ --seat-before in NumberInput/styles.css (end pad 0, like the leaf), so
213
+ their text rides the value's line box; a plain `align-items: center` on
214
+ the full stretch would float them above the seated text (the pad split
215
+ is asymmetric: seat-before ≠ seat-after). The old fixed-height model
216
+ needed flex-start to top-pin the crushed leaf; the intrinsic leaf
217
+ seats itself, so stretch is safe again. */
221
218
  align-items: stretch;
222
219
  }
223
220
  :is(.comfortable, .dense, .app, .site, .docs)
@@ -228,6 +225,16 @@
228
225
  padding-block-end: 0;
229
226
  }
230
227
 
228
+ /* The select leaf seats exactly like the input leaf. A rule of its own
229
+ because the leaf tag differs — folding it into the input rule above (via
230
+ `> :is(input, select)`) would also seat the phone wrapper's inner country
231
+ <select>, which is a separate leaf of that composite. */
232
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.input.select > select {
233
+ line-height: var(--seat-line-floored);
234
+ padding-block-start: var(--seat-before);
235
+ padding-block-end: 0;
236
+ }
237
+
231
238
  /* ── Textarea: many rows of the SAME intrinsic seat ──────────────────────────
232
239
  * The textarea is a single element (it carries the chrome itself), so it seats
233
240
  * like the button: the interior line box is `--control-seat-line` — which is a
@@ -285,52 +292,6 @@
285
292
  );
286
293
  }
287
294
 
288
- /* ── Select: a single-element direct chrome on the intrinsic seat ────────────
289
- * The <select> IS the chrome (border and text on one element), so it seats
290
- * like the button: interior line box + seat pads, height emerging as exactly
291
- * the density cell. Replaces the old fixed-height + 8px-block-padding path,
292
- * which never seated the option text at all and CLIPPED it in apps/dense
293
- * (24px fixed box − 8px pad left too little room for the line).
294
- * The line is floored like the single-line input's: a <select> shows one line,
295
- * so if the UA imposes a `normal` floor the formula already matches it, and if
296
- * it does not the specified floor is simply what renders — correct either way
297
- * (unlike the textarea, where flooring would break the multi-row rhythm).
298
- * Remaining direct chromes (date/time/datetime) stay on the previous model
299
- * until their own pass — their multi-part UA internals need their own
300
- * measurement. */
301
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input.select {
302
- --seat-line-floored: max(var(--control-seat-line), 1.2em);
303
- line-height: var(--seat-line-floored);
304
-
305
- --seat-before: round(
306
- nearest,
307
- max(
308
- 0px,
309
- calc(
310
- var(--density-target-baseline-px, 0px) -
311
- (var(--seat-line-floored) + 1cap) /
312
- 2 -
313
- var(--form-input-border-width, 0px)
314
- )
315
- ),
316
- 0.25px
317
- );
318
- --seat-after: max(
319
- 0px,
320
- calc(
321
- var(--density-line-height-effective) -
322
- var(--seat-line-floored) -
323
- var(--seat-before) -
324
- 2 *
325
- var(--form-input-border-width, 0px)
326
- )
327
- );
328
-
329
- block-size: auto;
330
- min-block-size: 0;
331
- padding-block: var(--seat-before) var(--seat-after);
332
- }
333
-
334
295
  /* ── Bottom rhythm: density-seated flow text only (NOT prose) ─────────────────
335
296
  * A BORDERED control (button, input wrapper) has a fixed `block-size` that is
336
297
  * already a whole baseline multiple, so its bottom rhythm is the box height —
@@ -347,7 +308,7 @@
347
308
  * --end-nudge already lands its bottom on the grid. Adding a density fill on top
348
309
  * would double-pad. Prose bottom rhythm belongs to the engine / `.editorial`. */
349
310
  :is(.comfortable, .dense, .app, .site, .docs)
350
- :is(.ds.field-label, .ds.field-description, .ds.field-error) {
311
+ :is(.ds.field-label, .ds.field-description, .ds.field-error) {
351
312
  padding-block-end: max(
352
313
  0px,
353
314
  calc(
@@ -121,6 +121,10 @@
121
121
 
122
122
  --form-input-background: var(--color-foreground-input);
123
123
  --form-input-color: var(--color-text);
124
+ /* Mask text (the native date/time segments and separators) reads the muted
125
+ * token while the input is empty; a real value restores --form-input-color.
126
+ * See the date/datetime sheets for the WebKit segment selectors. */
127
+ --form-input-color-mask: var(--color-text-muted);
124
128
  --form-input-font-size: var(--typography-text-primary-font-size);
125
129
  --form-input-line-height: var(--typography-text-primary-line-height);
126
130
 
@@ -140,15 +144,30 @@
140
144
 
141
145
  /* ── Description ────────────────────────────────────────────────── */
142
146
 
143
- /* Description reads the SECONDARY type ramp (design review): it is subordinate
144
- supporting text, so it takes the smaller secondary size, not the primary
145
- body size. Colour is already the muted token. */
147
+ /* Subordinate supporting text: reads the SECONDARY type ramp. */
146
148
  --form-description-font-size: var(--typography-text-secondary-font-size);
149
+ --form-description-font-weight: var(
150
+ --typography-text-secondary-font-weight
151
+ );
152
+ --form-description-line-height: var(
153
+ --typography-text-secondary-line-height-dimension
154
+ );
155
+ --form-description-letter-spacing: var(
156
+ --typography-text-secondary-letter-spacing
157
+ );
147
158
  --form-description-color: var(--color-text-muted);
148
159
 
149
160
  /* ── Error ──────────────────────────────────────────────────────── */
150
161
 
151
- --form-error-font-size: var(--typography-text-primary-font-size);
162
+ /* Status message: reads the SECONDARY type ramp like the description. */
163
+ --form-error-font-size: var(--typography-text-secondary-font-size);
164
+ --form-error-font-weight: var(--typography-text-secondary-font-weight);
165
+ --form-error-line-height: var(
166
+ --typography-text-secondary-line-height-dimension
167
+ );
168
+ --form-error-letter-spacing: var(
169
+ --typography-text-secondary-letter-spacing
170
+ );
152
171
  --form-error-color: var(--modifier-color-text, var(--color-text-error));
153
172
 
154
173
  /* ── State colors ───────────────────────────────────────────────── */
@@ -160,7 +179,7 @@
160
179
  /* Design review (15/07): a disabled control shows no border. Default the
161
180
  * disabled border to transparent; a theme wanting a visible disabled border
162
181
  * can still override this token (e.g. back to `--disabled--color-border`). */
163
- --form-input-border-color-disabled: transparent;
182
+ --form-input-border-color-disabled: var(--color-border-disabled);
164
183
 
165
184
  /* ── Focus ring ─────────────────────────────────────────────────── */
166
185
 
@@ -213,17 +232,18 @@
213
232
  }
214
233
 
215
234
  /* ── .ds.input.chrome — shared input chrome ─────────────────────────
216
- * Applied on native <textarea>/<select> directly, and on the
217
- * composite .ds.input.text wrapper for <input> + prefix/suffix.
235
+ * Applied on native <textarea> directly, and on the composite wrappers
236
+ * (.ds.input.text, .ds.input.select, …) that hold an <input>/<select>
237
+ * leaf plus optional siblings (prefix/suffix, chevron overlay).
218
238
  *
219
239
  * Inline padding is deliberately NOT set here. On composite wrappers the
220
- * text-bearing leaf is the inner <input>, which carries its own
240
+ * text-bearing leaf is the inner form element, which carries its own
221
241
  * `padding-inline`; if the wrapper ALSO had it the text would be inset twice
222
242
  * (and prefix/suffix would sit off the edge). So the inline padding lives on
223
- * the leaf in every case: the inner <input> for composite inputs (text,
224
- * number, password, phone …), and the element itself for the direct-chrome
225
- * inputs (date, time, datetime, select, textarea), which set it locally.
226
- * Only the block padding (baseline-grid height) is shared here.
243
+ * the leaf in every case: the inner <input>/<select> for composite inputs
244
+ * (text, number, password, phone, select …), and the element itself for the
245
+ * direct-chrome inputs (date, time, datetime, textarea), which set it
246
+ * locally. Only the block padding (baseline-grid height) is shared here.
227
247
  */
228
248
  .ds.input.chrome {
229
249
  display: block;
@@ -287,7 +307,7 @@
287
307
  border-color var(--motion-duration-fast) ease,
288
308
  box-shadow var(--motion-duration-fast) ease;
289
309
 
290
- &:hover:not(:disabled, :has(input:disabled)) {
310
+ &:hover:not(:disabled, :has(input:disabled), :has(select:disabled)) {
291
311
  background-color: var(
292
312
  --hover--color-foreground-input,
293
313
  var(--color-foreground-input-hover)
@@ -312,12 +332,9 @@
312
332
  * :root) but stays a themeable override point. The background + muted text
313
333
  * carry the disabled affordance instead. */
314
334
  &:disabled,
315
- &:has(input:disabled) {
316
- border-color: var(--form-input-border-color-disabled);
317
- border-top-color: var(--form-input-border-color-disabled);
318
- border-right-color: var(--form-input-border-color-disabled);
335
+ &:has(input:disabled),
336
+ &:has(select:disabled) {
319
337
  border-bottom-color: var(--form-input-border-color-disabled);
320
- border-left-color: var(--form-input-border-color-disabled);
321
338
  background-color: var(--form-input-background-disabled);
322
339
  color: var(--form-input-color-disabled);
323
340
  cursor: not-allowed;
@@ -333,11 +350,11 @@
333
350
  *
334
351
  * EXCEPTION — the borderless choices fieldset. A choices group (radios/checkboxes)
335
352
  * has no single input border to paint (each option is its own borderless control),
336
- * so its `<legend>` (a `.ds.field-label`) is the ONLY place an error can be shown
353
+ * so its label (a `.ds.field-label`) is the ONLY place an error can be shown
337
354
  * without lighting up every option box. Such a group renders its Wrapper label as
338
- * a `<legend>` (the `mockLabel` path), so the recolour is SCOPED to a legend
339
- * label — a normal field's `<label>` is untouched. */
340
- .danger > legend.ds.field-label {
355
+ * plain text, not a `<label>` (the `mockLabel` path), so the recolour is SCOPED
356
+ * to a non-`<label>` field label — a normal field's `<label>` is untouched. */
357
+ .danger > .ds.field-label:not(label) {
341
358
  color: var(--form-error-color);
342
359
 
343
360
  /* The required "*" marker recolours WITH the label (it pins its own colour to
@@ -1,5 +1,5 @@
1
- import bindField from "../../common/bindField/index.js";
2
- import withWrapper from "../../common/Wrapper/withWrapper.js";
1
+ import bindField from "../../../common/bindField/index.js";
2
+ import withWrapper from "../../../common/Wrapper/withWrapper.js";
3
3
  import { ColorInput } from "../../subcomponent/ColorInput/index.js";
4
4
  /**
5
5
  * ColorInput bound to react-hook-form (controlled), wrapped with field chrome.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorField.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/ColorField/ColorField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oCAAoC,CAAC;AAC3D,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAGpE;;;;;;GAMG;AACH,eAAe,WAAW,CACxB,SAAS,CAAkB,UAAU,EAAE,YAAY,EAAE;IACnD,YAAY,EAAE,SAAS;CACxB,CAAC,CACH,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/ColorField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/ColorField/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
- import bindField from "../../common/bindField/index.js";
2
- import withWrapper from "../../common/Wrapper/withWrapper.js";
1
+ import bindField from "../../../common/bindField/index.js";
2
+ import withWrapper from "../../../common/Wrapper/withWrapper.js";
3
3
  import { ComboboxInput } from "../../subcomponent/ComboboxInput/index.js";
4
4
  /**
5
5
  * ComboboxInput bound to react-hook-form (controlled), wrapped with field chrome.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboboxField.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/ComboboxField/ComboboxField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oCAAoC,CAAC;AAC3D,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAG1E;;;;;;;;GAQG;AACH,eAAe,WAAW,CACxB,SAAS,CAAqB,aAAa,EAAE,YAAY,CAAC,CAC3D,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/ComboboxField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/ComboboxField/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
- import bindField from "../../common/bindField/index.js";
2
- import withWrapper from "../../common/Wrapper/withWrapper.js";
1
+ import bindField from "../../../common/bindField/index.js";
2
+ import withWrapper from "../../../common/Wrapper/withWrapper.js";
3
3
  import { RatingInput } from "../../subcomponent/RatingInput/index.js";
4
4
  /**
5
5
  * RatingInput bound to react-hook-form (controlled), wrapped with the field
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RatingField.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/RatingField/RatingField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oCAAoC,CAAC;AAC3D,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAGtE;;;;;;;;GAQG;AACH,eAAe,WAAW,CACxB,SAAS,CAAmB,WAAW,EAAE,YAAY,CAAC,CACvD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/RatingField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/component/RatingField/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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YAAY,GAAQ,IAC5C,EAET,eAAK,GAAG,EAAE,UAAU,EAAE,OAAO,EAAC,QAAQ,EAAC,SAAS,EAAC,eAAe,aAC9D,cAAK,SAAS,EAAC,aAAa,EAAC,IAAI,EAAC,SAAS,gBAAY,gBAAgB,YACpE,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACvB,iBAEE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE;gCACT,QAAQ;gCACR,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,WAAW,EAAE;oCAChD,UAAU;6BACb;iCACE,MAAM,CAAC,OAAO,CAAC;iCACf,IAAI,CAAC,GAAG,CAAC,EACZ,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,EACjC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,mBACxB,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,WAAW,EAAE,gBACrD,KAAK,EACjB,QAAQ,EAAE,QAAQ,IAdb,KAAK,CAeV,CACH,CAAC,GACE,EAEL,WAAW,IACR,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/subcomponent/ColorInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/subcomponent/ColorInput/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboboxInput.js","sourceRoot":"","sources":["../../../../../../src/lib/_work_in_progress/subcomponent/ComboboxInput/ComboboxInput.tsx"],"names":[],"mappings":";AAAA,kDAAkD;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CACrC,SAAS,aAAa,CACpB,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,UAAU,EAAE,EAChD,GAAG;IAEH,MAAM,iBAAiB,GAAG,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACzD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,KAAC,gBAAgB,IAAC,SAAS,EAAE,iBAAiB,KAAM,UAAU,GAAI,CAAC;IAC5E,CAAC;IACD,OAAO,CACL,KAAC,cAAc,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,KAAM,UAAU,GAAI,CAC3E,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,199 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon } from "@canonical/react-ds-global";
3
+ import { useCombobox, useMultipleSelection } from "downshift";
4
+ import { useCallback, useEffect, useRef, useState } from "react";
5
+ import { List, ResetButton } from "./common/index.js";
6
+ import { VALUE_KEY } from "./constants.js";
7
+ import messages from "./messages.js";
8
+ import { convertItemToString as defaultConvertItemToString, convertValueToItem as defaultConvertValueToItem, filterItems as defaultFilterItems, isPromise, settleLookup, stopPageMovesAtEnds, } from "./utils/index.js";
9
+ import "./styles.css";
10
+ const componentCssClassName = "ds form-combobox";
11
+ /**
12
+ * Multiple-select combobox (presentational, controlled — no react-hook-form).
13
+ * Selected values are rendered as removable chips. Uses downshift's
14
+ * useMultipleSelection + useCombobox.
15
+ *
16
+ * With a `name`, one hidden input per selected value carries the selection, so
17
+ * a native form post sends it without JavaScript. The visible text input stays
18
+ * unnamed.
19
+ *
20
+ * The `id` and the ARIA props go to the text input; `aria-label` or
21
+ * `aria-labelledby` names the list too. Removing the focused chip moves focus
22
+ * to the chip that takes its place, or to the input when no chip is left.
23
+ *
24
+ * @param {ComboboxInputProps} props - The component props
25
+ * @returns {React.ReactElement} - Rendered MultipleCombobox component
26
+ *
27
+ * `import { MultipleCombobox } from "@canonical/react-ds-global-form";`
28
+ */
29
+ const MultipleCombobox = ({ id, className, style, name, options, value, onChange, disabled = false, placeholder, openOnReset = false, valueKey = VALUE_KEY, convertItemToString = defaultConvertItemToString, convertValueToItem = defaultConvertValueToItem, filterItems = defaultFilterItems, onInputValueChangeFactory, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, }) => {
30
+ const values = value;
31
+ // The lookup for the first value runs once, while rendering, so synchronous
32
+ // answers are shown as chips in the server render. Promises are kept for the
33
+ // mount effect to await instead of looking the values up twice. A rejected
34
+ // lookup counts as not found.
35
+ const [initialLookups] = useState(() => (values ?? []).map((val) => settleLookup(convertValueToItem(val, options, valueKey))));
36
+ const pendingInitialLookups = useRef(initialLookups.some(isPromise) ? initialLookups : null);
37
+ // State for selected items and filtered items
38
+ const [selectedItems, setSelectedItems] = useState(() => initialLookups.some(isPromise)
39
+ ? []
40
+ : initialLookups.filter(isOption));
41
+ const [items, setItems] = useState(options);
42
+ // The chips on screen, read by the sync effect without re-running it.
43
+ const selectedItemsRef = useRef(selectedItems);
44
+ selectedItemsRef.current = selectedItems;
45
+ // Whether chips are hidden while lookups are pending.
46
+ const isPendingRef = useRef(false);
47
+ // Values an asynchronous lookup could not resolve, so a re-run caused by a
48
+ // new `options` or `convertValueToItem` does not fetch them again.
49
+ const unresolvedRef = useRef(new Set());
50
+ const previousValuesRef = useRef(values);
51
+ // Keep selectedItems in sync with the controlled value — on mount and on every
52
+ // change. Must clear as well as populate: an empty/undefined `value` (e.g. after
53
+ // reset) has to drive `selectedItems` back to [], otherwise a later re-render
54
+ // that re-supplies the previous array would resurrect the cleared chips.
55
+ // A value that already has a chip (the user just picked it) is not looked up
56
+ // again. Latest wins: a value changed while its lookups are pending runs the
57
+ // cleanup, which discards the stale answers. While they are pending no chip is
58
+ // shown; the hidden inputs already carry the values.
59
+ useEffect(() => {
60
+ const previousValues = previousValuesRef.current;
61
+ previousValuesRef.current = values;
62
+ // Uncontrolled, the chips are the user's own: a new `options` must not
63
+ // clear them.
64
+ if (values === undefined && previousValues === undefined) {
65
+ return;
66
+ }
67
+ const currentValues = values ?? [];
68
+ const unresolved = unresolvedRef.current;
69
+ for (const val of unresolved) {
70
+ if (!currentValues.includes(val)) {
71
+ unresolved.delete(val);
72
+ }
73
+ }
74
+ const shown = new Map(selectedItemsRef.current.map((item) => [String(item[valueKey]), item]));
75
+ const lookups = pendingInitialLookups.current ??
76
+ currentValues.map((val) => shown.get(val) ??
77
+ (unresolved.has(val)
78
+ ? null
79
+ : settleLookup(convertValueToItem(val, options, valueKey))));
80
+ pendingInitialLookups.current = null;
81
+ if (!lookups.some(isPromise)) {
82
+ isPendingRef.current = false;
83
+ setSelectedItems(lookups.filter(isOption));
84
+ return;
85
+ }
86
+ let isStale = false;
87
+ isPendingRef.current = true;
88
+ setSelectedItems([]);
89
+ (async () => {
90
+ const resolved = await Promise.all(lookups);
91
+ if (!isStale) {
92
+ resolved.forEach((item, index) => {
93
+ if (!item && isPromise(lookups[index])) {
94
+ unresolved.add(currentValues[index]);
95
+ }
96
+ });
97
+ isPendingRef.current = false;
98
+ setSelectedItems(resolved.filter(isOption));
99
+ }
100
+ })();
101
+ return () => {
102
+ isStale = true;
103
+ };
104
+ }, [values, convertValueToItem, options, valueKey]);
105
+ // Downshift's useMultipleSelection hook for managing multiple selections
106
+ const { getSelectedItemProps, getDropdownProps, addSelectedItem, removeSelectedItem, setActiveIndex, } = useMultipleSelection({
107
+ selectedItems,
108
+ onSelectedItemsChange: ({ selectedItems: newSelectedItems }) => {
109
+ setSelectedItems(newSelectedItems);
110
+ // Emit [] (never undefined) when the list empties: with a react-hook-form
111
+ // Controller that has a defaultValue, onChange(undefined) reverts the field
112
+ // to that default, resurrecting the removed chips. [] clears cleanly.
113
+ const picked = newSelectedItems.map((item) => item[valueKey]);
114
+ // While lookups are pending no chip is shown, so a pick adds to the
115
+ // value instead of replacing the values still being looked up. Only a
116
+ // controlled value can be pending.
117
+ const newValue = isPendingRef.current
118
+ ? [...new Set([...values, ...picked])]
119
+ : picked;
120
+ onChange?.(newValue);
121
+ },
122
+ });
123
+ // Default onInputValueChangeFactory: filters items locally
124
+ const defaultOnInputValueChangeFactory = useCallback(() => ({ inputValue }) => {
125
+ setItems(filterItems(options, inputValue));
126
+ }, [filterItems, options]);
127
+ // Use provided onInputValueChangeFactory or default
128
+ const onInputValueChange = onInputValueChangeFactory
129
+ ? onInputValueChangeFactory(setItems)
130
+ : defaultOnInputValueChangeFactory();
131
+ // Downshift's useCombobox hook for combobox functionality
132
+ const { isOpen, openMenu, getMenuProps, getInputProps, getItemProps, highlightedIndex, setInputValue, // Function to set input value
133
+ } = useCombobox({
134
+ items,
135
+ inputId: id,
136
+ labelId: ariaLabelledBy,
137
+ stateReducer: (state, actionAndChanges) => stopPageMovesAtEnds(state, actionAndChanges, items.length),
138
+ // The selection lives in useMultipleSelection, not here. Pinning this to
139
+ // null stops useCombobox remembering the last pick: otherwise picking that
140
+ // option again (after removing its chip) is not a change and is ignored.
141
+ selectedItem: null,
142
+ onInputValueChange,
143
+ onSelectedItemChange: ({ selectedItem }) => {
144
+ if (selectedItem &&
145
+ !selectedItems.some((item) => item[valueKey] === selectedItem[valueKey])) {
146
+ addSelectedItem(selectedItem);
147
+ setInputValue(""); // Clear input after selection
148
+ }
149
+ },
150
+ itemToString: convertItemToString,
151
+ });
152
+ const inputRef = useRef(null);
153
+ // Reset function to clear selections and input. Emits [] (not undefined) so a
154
+ // react-hook-form Controller with a defaultValue stores the cleared state
155
+ // rather than falling back to its default and repopulating the chips. Focus
156
+ // returns to the input, as in the single combobox.
157
+ const resetSelection = useCallback(() => {
158
+ setSelectedItems([]);
159
+ setInputValue("");
160
+ onChange?.([]);
161
+ inputRef.current?.focus();
162
+ if (openOnReset) {
163
+ openMenu();
164
+ }
165
+ }, [onChange, setInputValue, openOnReset, openMenu]);
166
+ // A chip removed while it holds focus becomes the active chip first, so
167
+ // focus moves to the chip that takes its place, or to the input when none
168
+ // is left, instead of falling back to the page.
169
+ const removeChip = (event, selectedItem, index) => {
170
+ if (event.currentTarget === document.activeElement) {
171
+ // The last chip leaves the active index at -1 either way, so downshift
172
+ // would not move focus: move it to the input here.
173
+ if (selectedItems.length === 1) {
174
+ inputRef.current?.focus();
175
+ }
176
+ else {
177
+ setActiveIndex(index);
178
+ }
179
+ }
180
+ removeSelectedItem(selectedItem);
181
+ };
182
+ // Uncontrolled, the chips are the values to post.
183
+ const postedValues = (values ?? selectedItems.map((item) => String(item[valueKey]))).filter(Boolean);
184
+ return (_jsxs("div", { style: style, className: [componentCssClassName, className].filter(Boolean).join(" "), children: [_jsx("div", { className: "selected-items", children: selectedItems.map((selectedItem, index) => (_jsxs("button", { type: "button", ...getSelectedItemProps({ selectedItem, index }), "aria-label": messages.remove(convertItemToString(selectedItem)), disabled: disabled, onClick: (event) => removeChip(event, selectedItem, index), className: "chip", children: [convertItemToString(selectedItem), _jsx(Icon, { icon: "close", className: "remove-icon" })] }, index))) }), _jsxs("div", { className: "ds input combobox-input chrome", children: [_jsx("input", { className: "p", ...getInputProps({
185
+ ...getDropdownProps({ preventKeyAction: isOpen, ref: inputRef }),
186
+ "aria-label": ariaLabel,
187
+ "aria-describedby": ariaDescribedBy,
188
+ "aria-errormessage": ariaErrorMessage,
189
+ "aria-invalid": ariaInvalid,
190
+ "aria-required": ariaRequired,
191
+ }), placeholder: placeholder, disabled: disabled }), _jsx(ResetButton, { disabled: disabled, onClick: resetSelection })] }), _jsx(List, { "aria-label": ariaLabel, isOpen: isOpen, getMenuProps: getMenuProps, getItemProps: getItemProps, items: items, highlightedIndex: highlightedIndex, convertItemToString: convertItemToString, valueKey: valueKey, fieldValue: selectedItems.map((item) => String(item[valueKey])) }), name
192
+ ? postedValues.map((postedValue) => (_jsx("input", { type: "hidden", name: name, value: postedValue }, postedValue)))
193
+ : null] }));
194
+ };
195
+ function isOption(item) {
196
+ return Boolean(item);
197
+ }
198
+ export default MultipleCombobox;
199
+ //# sourceMappingURL=MultipleCombobox.js.map