@pega/cosmos-react-core 2.0.0-dev.19.0 → 2.0.0-dev.21.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 (350) hide show
  1. package/lib/components/Actions/Actions.js +1 -1
  2. package/lib/components/Actions/Actions.js.map +1 -1
  3. package/lib/components/AppShell/AppHeader.js +1 -1
  4. package/lib/components/AppShell/AppHeader.js.map +1 -1
  5. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  6. package/lib/components/AppShell/AppShell.js +44 -30
  7. package/lib/components/AppShell/AppShell.js.map +1 -1
  8. package/lib/components/AppShell/AppShell.styles.d.ts +4 -11
  9. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  10. package/lib/components/AppShell/AppShell.styles.js +102 -89
  11. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  12. package/lib/components/AppShell/AppShell.types.d.ts +2 -2
  13. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  14. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  15. package/lib/components/AppShell/AppShellContext.d.ts +2 -0
  16. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  17. package/lib/components/AppShell/AppShellContext.js +1 -0
  18. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  19. package/lib/components/AppShell/AppShellList.js +6 -6
  20. package/lib/components/AppShell/AppShellList.js.map +1 -1
  21. package/lib/components/AppShell/Drawer.js +2 -2
  22. package/lib/components/AppShell/Drawer.js.map +1 -1
  23. package/lib/components/AppShell/Operator.js +3 -3
  24. package/lib/components/AppShell/Operator.js.map +1 -1
  25. package/lib/components/AppShell/SkipNavigation.js +2 -2
  26. package/lib/components/AppShell/SkipNavigation.js.map +1 -1
  27. package/lib/components/Avatar/Avatar.js +1 -1
  28. package/lib/components/Avatar/Avatar.js.map +1 -1
  29. package/lib/components/Backdrop/Backdrop.js +1 -1
  30. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  31. package/lib/components/Badges/Alert.js +1 -1
  32. package/lib/components/Badges/Alert.js.map +1 -1
  33. package/lib/components/Badges/Count.js +1 -1
  34. package/lib/components/Badges/Count.js.map +1 -1
  35. package/lib/components/Badges/Selection.js +1 -1
  36. package/lib/components/Badges/Selection.js.map +1 -1
  37. package/lib/components/Badges/Status.js +1 -1
  38. package/lib/components/Badges/Status.js.map +1 -1
  39. package/lib/components/Badges/Tag.js +1 -1
  40. package/lib/components/Badges/Tag.js.map +1 -1
  41. package/lib/components/Banner/Banner.js +3 -3
  42. package/lib/components/Banner/Banner.js.map +1 -1
  43. package/lib/components/Boolean/BooleanDisplay.js +1 -1
  44. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  45. package/lib/components/Breadcrumbs/Breadcrumbs.js +5 -5
  46. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  47. package/lib/components/Button/BareButton.js +2 -2
  48. package/lib/components/Button/BareButton.js.map +1 -1
  49. package/lib/components/Button/BareRoleButton.d.ts +12 -0
  50. package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
  51. package/lib/components/Button/BareRoleButton.js +20 -0
  52. package/lib/components/Button/BareRoleButton.js.map +1 -0
  53. package/lib/components/Button/Button.js +2 -2
  54. package/lib/components/Button/Button.js.map +1 -1
  55. package/lib/components/Card/Card.js +1 -1
  56. package/lib/components/Card/Card.js.map +1 -1
  57. package/lib/components/Card/CardContent.js +1 -1
  58. package/lib/components/Card/CardContent.js.map +1 -1
  59. package/lib/components/Card/CardFooter.js +2 -2
  60. package/lib/components/Card/CardFooter.js.map +1 -1
  61. package/lib/components/Card/CardHeader.js +1 -1
  62. package/lib/components/Card/CardHeader.js.map +1 -1
  63. package/lib/components/Card/CardMedia.js +1 -1
  64. package/lib/components/Card/CardMedia.js.map +1 -1
  65. package/lib/components/Card/CollapsibleCard.js +1 -1
  66. package/lib/components/Card/CollapsibleCard.js.map +1 -1
  67. package/lib/components/Card/SelectableCard.js +1 -1
  68. package/lib/components/Card/SelectableCard.js.map +1 -1
  69. package/lib/components/Checkbox/Checkbox.js +1 -1
  70. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  71. package/lib/components/ColorPicker/ColorPicker.js +3 -3
  72. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  73. package/lib/components/ComboBox/ComboBox.js +15 -15
  74. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  75. package/lib/components/ComboBox/ComboBoxInput.js +4 -4
  76. package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
  77. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  78. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +14 -10
  79. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  80. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
  81. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +15 -11
  82. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
  83. package/lib/components/Configuration/Configuration.js +5 -5
  84. package/lib/components/Configuration/Configuration.js.map +1 -1
  85. package/lib/components/Currency/CurrencyDisplay.d.ts +3 -1
  86. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  87. package/lib/components/Currency/CurrencyDisplay.js +11 -16
  88. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  89. package/lib/components/Currency/CurrencyInput.js +14 -14
  90. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  91. package/lib/components/Currency/CurrencyInput.types.d.ts +3 -1
  92. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  93. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  94. package/lib/components/Currency/utils.d.ts +12 -1
  95. package/lib/components/Currency/utils.d.ts.map +1 -1
  96. package/lib/components/Currency/utils.js +30 -2
  97. package/lib/components/Currency/utils.js.map +1 -1
  98. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  99. package/lib/components/DateTime/DateTimeDisplay.js +2 -1
  100. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  101. package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
  102. package/lib/components/DateTime/DurationDisplay.js +11 -6
  103. package/lib/components/DateTime/DurationDisplay.js.map +1 -1
  104. package/lib/components/DateTime/Input/DateInput.js +6 -6
  105. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  106. package/lib/components/DateTime/Input/DateRangeInput.js +1 -1
  107. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  108. package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
  109. package/lib/components/DateTime/Input/DateTime.styles.js +13 -2
  110. package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
  111. package/lib/components/DateTime/Input/DateTimeInput.js +9 -9
  112. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  113. package/lib/components/DateTime/Input/DayOfWeekInput.js +2 -2
  114. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  115. package/lib/components/DateTime/Input/Duration/DurationInput.js +2 -2
  116. package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
  117. package/lib/components/DateTime/Input/Duration/NumberUnit.js +2 -2
  118. package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
  119. package/lib/components/DateTime/Input/Duration/Time.js +2 -2
  120. package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
  121. package/lib/components/DateTime/Input/MonthInput.js +6 -6
  122. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  123. package/lib/components/DateTime/Input/PartInput.js +1 -1
  124. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  125. package/lib/components/DateTime/Input/QuarterInput.js +6 -6
  126. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
  127. package/lib/components/DateTime/Input/TimeInput.js +9 -9
  128. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  129. package/lib/components/DateTime/Input/WeekInput.js +6 -6
  130. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  131. package/lib/components/DateTime/Picker/Calendar.js +11 -11
  132. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  133. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  134. package/lib/components/DateTime/Picker/DatePicker.js +7 -9
  135. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  136. package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
  137. package/lib/components/DateTime/Picker/DateRangePicker.js +7 -9
  138. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  139. package/lib/components/DateTime/Picker/TimePicker.js +4 -4
  140. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  141. package/lib/components/DateTime/Picker/Weeks.js +4 -4
  142. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  143. package/lib/components/DateTime/Picker/utils.d.ts +1 -0
  144. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  145. package/lib/components/DateTime/Picker/utils.js +3 -0
  146. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  147. package/lib/components/Drawer/Drawer.js +1 -1
  148. package/lib/components/Drawer/Drawer.js.map +1 -1
  149. package/lib/components/Email/EmailDisplay.js +2 -2
  150. package/lib/components/Email/EmailDisplay.js.map +1 -1
  151. package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
  152. package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
  153. package/lib/components/EmojiPicker/EmojiPicker.js +1 -1
  154. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  155. package/lib/components/EmptyState/EmptyState.js +1 -1
  156. package/lib/components/EmptyState/EmptyState.js.map +1 -1
  157. package/lib/components/ErrorState/ErrorState.js +1 -1
  158. package/lib/components/ErrorState/ErrorState.js.map +1 -1
  159. package/lib/components/ExpandCollapse/ExpandCollapse.js +1 -1
  160. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  161. package/lib/components/FieldGroup/FieldGroup.js +3 -3
  162. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  163. package/lib/components/FieldGroup/FieldGroupList.js +4 -4
  164. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  165. package/lib/components/FieldValueList/FieldValueList.js +5 -5
  166. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  167. package/lib/components/File/FileDisplay.js +7 -7
  168. package/lib/components/File/FileDisplay.js.map +1 -1
  169. package/lib/components/File/FileInput.js +9 -9
  170. package/lib/components/File/FileInput.js.map +1 -1
  171. package/lib/components/File/FileItem.js +1 -1
  172. package/lib/components/File/FileItem.js.map +1 -1
  173. package/lib/components/File/FileUploadItem.js +4 -4
  174. package/lib/components/File/FileUploadItem.js.map +1 -1
  175. package/lib/components/File/FileVisual.js +4 -4
  176. package/lib/components/File/FileVisual.js.map +1 -1
  177. package/lib/components/Flex/Flex.js +1 -1
  178. package/lib/components/Flex/Flex.js.map +1 -1
  179. package/lib/components/Form/Form.js +1 -1
  180. package/lib/components/Form/Form.js.map +1 -1
  181. package/lib/components/FormControl/FormControl.js +1 -1
  182. package/lib/components/FormControl/FormControl.js.map +1 -1
  183. package/lib/components/FormField/FormField.js +7 -7
  184. package/lib/components/FormField/FormField.js.map +1 -1
  185. package/lib/components/Grid/Grid.js +1 -1
  186. package/lib/components/Grid/Grid.js.map +1 -1
  187. package/lib/components/Icon/Icon.js +1 -1
  188. package/lib/components/Icon/Icon.js.map +1 -1
  189. package/lib/components/Image/Image.js +1 -1
  190. package/lib/components/Image/Image.js.map +1 -1
  191. package/lib/components/Input/Input.js +11 -11
  192. package/lib/components/Input/Input.js.map +1 -1
  193. package/lib/components/Label/Label.js +1 -1
  194. package/lib/components/Label/Label.js.map +1 -1
  195. package/lib/components/Link/Link.js +1 -1
  196. package/lib/components/Link/Link.js.map +1 -1
  197. package/lib/components/List/CommaSeparatedList.js +3 -3
  198. package/lib/components/List/CommaSeparatedList.js.map +1 -1
  199. package/lib/components/List/List.js +1 -1
  200. package/lib/components/List/List.js.map +1 -1
  201. package/lib/components/List/OrderedList.js +1 -1
  202. package/lib/components/List/OrderedList.js.map +1 -1
  203. package/lib/components/List/UnorderedList.js +1 -1
  204. package/lib/components/List/UnorderedList.js.map +1 -1
  205. package/lib/components/Location/CurrentLocationButton.js +1 -1
  206. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  207. package/lib/components/Location/LocationDisplay.js +7 -7
  208. package/lib/components/Location/LocationDisplay.js.map +1 -1
  209. package/lib/components/Location/LocationInput.js +19 -19
  210. package/lib/components/Location/LocationInput.js.map +1 -1
  211. package/lib/components/Location/LocationView.js +1 -1
  212. package/lib/components/Location/LocationView.js.map +1 -1
  213. package/lib/components/Menu/FlyoutMenuList.js +3 -3
  214. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  215. package/lib/components/Menu/Menu.d.ts.map +1 -1
  216. package/lib/components/Menu/Menu.js +4 -3
  217. package/lib/components/Menu/Menu.js.map +1 -1
  218. package/lib/components/Menu/Menu.types.d.ts +2 -0
  219. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  220. package/lib/components/Menu/Menu.types.js.map +1 -1
  221. package/lib/components/Menu/MenuGroup.js +2 -2
  222. package/lib/components/Menu/MenuGroup.js.map +1 -1
  223. package/lib/components/Menu/MenuItem.js +11 -11
  224. package/lib/components/Menu/MenuItem.js.map +1 -1
  225. package/lib/components/Menu/MenuList.js +5 -5
  226. package/lib/components/Menu/MenuList.js.map +1 -1
  227. package/lib/components/Menu/MenuListHeader.js +2 -2
  228. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  229. package/lib/components/MenuButton/MenuButton.js +3 -3
  230. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  231. package/lib/components/MetaList/MetaList.js +4 -4
  232. package/lib/components/MetaList/MetaList.js.map +1 -1
  233. package/lib/components/Modal/DockedModals.d.ts.map +1 -1
  234. package/lib/components/Modal/DockedModals.js +4 -6
  235. package/lib/components/Modal/DockedModals.js.map +1 -1
  236. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  237. package/lib/components/Modal/MinimizedModal.js +37 -34
  238. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  239. package/lib/components/Modal/Modal.d.ts.map +1 -1
  240. package/lib/components/Modal/Modal.js +26 -21
  241. package/lib/components/Modal/Modal.js.map +1 -1
  242. package/lib/components/Modal/ModalManager.js +6 -6
  243. package/lib/components/Modal/ModalManager.js.map +1 -1
  244. package/lib/components/MultiStep/MultiStep.js +7 -7
  245. package/lib/components/MultiStep/MultiStep.js.map +1 -1
  246. package/lib/components/Number/NumberDisplay.js +1 -1
  247. package/lib/components/Number/NumberDisplay.js.map +1 -1
  248. package/lib/components/Number/NumberInput.js +5 -5
  249. package/lib/components/Number/NumberInput.js.map +1 -1
  250. package/lib/components/PageTemplates/CategorySubPage.js +7 -7
  251. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  252. package/lib/components/PageTemplates/DashboardPage.js +9 -9
  253. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  254. package/lib/components/PageTemplates/PageTemplates.js +20 -20
  255. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  256. package/lib/components/Pagination/Pagination.js +3 -3
  257. package/lib/components/Pagination/Pagination.js.map +1 -1
  258. package/lib/components/Phone/PhoneDisplay.js +2 -2
  259. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  260. package/lib/components/Phone/PhoneInput.js +3 -3
  261. package/lib/components/Phone/PhoneInput.js.map +1 -1
  262. package/lib/components/Popover/Popover.d.ts.map +1 -1
  263. package/lib/components/Popover/Popover.js +7 -1
  264. package/lib/components/Popover/Popover.js.map +1 -1
  265. package/lib/components/Popover/PopoverManager.js +2 -2
  266. package/lib/components/Popover/PopoverManager.js.map +1 -1
  267. package/lib/components/Progress/Bar.js +1 -1
  268. package/lib/components/Progress/Bar.js.map +1 -1
  269. package/lib/components/Progress/Ellipsis.js +1 -1
  270. package/lib/components/Progress/Ellipsis.js.map +1 -1
  271. package/lib/components/Progress/Progress.js +2 -2
  272. package/lib/components/Progress/Progress.js.map +1 -1
  273. package/lib/components/Progress/Ring.js +1 -1
  274. package/lib/components/Progress/Ring.js.map +1 -1
  275. package/lib/components/RadioButton/RadioButton.js +1 -1
  276. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  277. package/lib/components/RadioCheck/RadioCheck.js +2 -2
  278. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  279. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +10 -10
  280. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  281. package/lib/components/Rating/Rating.js +2 -2
  282. package/lib/components/Rating/Rating.js.map +1 -1
  283. package/lib/components/SearchInput/SearchInput.js +2 -2
  284. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  285. package/lib/components/Select/Option.js +1 -1
  286. package/lib/components/Select/Option.js.map +1 -1
  287. package/lib/components/Select/Select.js +13 -13
  288. package/lib/components/Select/Select.js.map +1 -1
  289. package/lib/components/Sentiment/Sentiment.js +1 -1
  290. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  291. package/lib/components/Skeleton/LineSkeleton.js +1 -1
  292. package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
  293. package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
  294. package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
  295. package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
  296. package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
  297. package/lib/components/Slider/Slider.js +5 -5
  298. package/lib/components/Slider/Slider.js.map +1 -1
  299. package/lib/components/Slider/SliderTicks.js +4 -4
  300. package/lib/components/Slider/SliderTicks.js.map +1 -1
  301. package/lib/components/SummaryItem/SummaryItem.js +2 -2
  302. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  303. package/lib/components/SummaryList/SummaryList.js +3 -3
  304. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  305. package/lib/components/SummaryList/ViewAll.js +1 -1
  306. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  307. package/lib/components/Switch/Switch.js +1 -1
  308. package/lib/components/Switch/Switch.js.map +1 -1
  309. package/lib/components/Table/Table.d.ts.map +1 -1
  310. package/lib/components/Table/Table.js +13 -8
  311. package/lib/components/Table/Table.js.map +1 -1
  312. package/lib/components/Tabs/Tab.js +1 -1
  313. package/lib/components/Tabs/Tab.js.map +1 -1
  314. package/lib/components/Tabs/TabPanel.js +1 -1
  315. package/lib/components/Tabs/TabPanel.js.map +1 -1
  316. package/lib/components/Tabs/Tabs.js +4 -4
  317. package/lib/components/Tabs/Tabs.js.map +1 -1
  318. package/lib/components/Text/Text.js +1 -1
  319. package/lib/components/Text/Text.js.map +1 -1
  320. package/lib/components/TextArea/TextArea.js +23 -23
  321. package/lib/components/TextArea/TextArea.js.map +1 -1
  322. package/lib/components/Toaster/Toaster.js +4 -4
  323. package/lib/components/Toaster/Toaster.js.map +1 -1
  324. package/lib/components/Tooltip/Tooltip.js +1 -1
  325. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  326. package/lib/components/Tree/StandardTree.js +6 -6
  327. package/lib/components/Tree/StandardTree.js.map +1 -1
  328. package/lib/components/Tree/Tree.js +3 -3
  329. package/lib/components/Tree/Tree.js.map +1 -1
  330. package/lib/components/Tree/helpers.d.ts +1 -0
  331. package/lib/components/Tree/helpers.d.ts.map +1 -1
  332. package/lib/components/Tree/helpers.js +20 -0
  333. package/lib/components/Tree/helpers.js.map +1 -1
  334. package/lib/components/URL/URLDisplay.js +2 -2
  335. package/lib/components/URL/URLDisplay.js.map +1 -1
  336. package/lib/hooks/index.d.ts +6 -6
  337. package/lib/hooks/index.d.ts.map +1 -1
  338. package/lib/hooks/index.js +6 -5
  339. package/lib/hooks/index.js.map +1 -1
  340. package/lib/hooks/useI18n.d.ts +1 -0
  341. package/lib/hooks/useI18n.d.ts.map +1 -1
  342. package/lib/hooks/useTransitionState.d.ts +39 -0
  343. package/lib/hooks/useTransitionState.d.ts.map +1 -0
  344. package/lib/hooks/useTransitionState.js +56 -0
  345. package/lib/hooks/useTransitionState.js.map +1 -0
  346. package/lib/i18n/default.json +1 -0
  347. package/lib/i18n/i18n.d.ts +2 -0
  348. package/lib/i18n/i18n.d.ts.map +1 -1
  349. package/lib/theme/themes/buildTheme.json +2 -1
  350. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"FileItem.js","sourceRoot":"","sources":["../../../src/components/File/FileItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,WAAW,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,UAAU,EAAE,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAiB5D,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACxD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IAEtC,OAAO,GAAG,CAAA;gCACoB,IAAI,CAAC,eAAe,CAAC;;QAE7C,gBAAgB;QAChB,cAAc,KAAK,SAAS;QAC5B,iBAAiB,KAAK,SAAS;QAC/B,cAAc,GAAG,SAAS;QAC1B,iBAAiB,GAAG,SAAS;;;QAG7B,gBAAgB,MAAM,YAAY;;gCAEV,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;0BACj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AO,EAAE,eAAe,gBACZ,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,gBAEtC,IAAI,YACE,aACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, FC, Ref, useCallback } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, BaseProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Button, { StyledButton } from '../Button';\nimport Grid from '../Grid';\nimport { useDirection, useI18n } from '../../hooks';\n\nimport { getKindFromMimeType, getMimeTypeFromFile } from './utils';\nimport FileVisual, { StyledFileVisual } from './FileVisual';\n\nexport interface FileItemProps extends BaseProps {\n /** Name of the file. */\n name: string;\n /** Url of the file. */\n url: string;\n /** Url pointing to the thumbnail image, rendered in the 'visual' region. */\n thumbnail?: string;\n /** When passed, it will make the icon/thumbnail region actionable. Passes file url as the parameter. */\n onPreview?: (url: FileItemProps['url']) => void;\n /** When passed, it will make the name region actionable. Passes file url as the parameter. */\n onDownload?: (url: FileItemProps['url']) => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLButtonElement>;\n}\n\nconst StyledFileItem = styled.div(({ theme: { base } }) => {\n const { start, end } = useDirection();\n\n return css`\n border-radius: calc(0.5 * ${base['border-radius']});\n\n > ${StyledFileVisual} {\n ${`border-top-${start}-radius`}: inherit;\n ${`border-bottom-${start}-radius`}: inherit;\n ${`border-top-${end}-radius`}: 0;\n ${`border-bottom-${end}-radius`}: 0;\n }\n\n > ${StyledFileVisual} + ${StyledButton} {\n margin-inline-start: 0;\n border: 0.0625rem solid ${base.palette['border-line']};\n background-color: ${base.palette['primary-background']};\n opacity: 1;\n padding: 0 ${base.spacing};\n border-inline-start: 0;\n ${`border-top-${start}-radius`}: 0;\n ${`border-bottom-${start}-radius`}: 0;\n ${`border-top-${end}-radius`}: inherit;\n ${`border-bottom-${end}-radius`}: inherit;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n `;\n});\n\nStyledFileItem.defaultProps = defaultThemeProp;\n\nconst FileItem: FC<FileItemProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileItemProps>, ref: FileItemProps['ref']) => {\n const { name, url, thumbnail, onPreview, onDownload, ...restProps } = props;\n\n const t = useI18n();\n\n const onDownloadClick = useCallback(() => {\n onDownload?.(url);\n }, [url, onDownload]);\n\n const type = getMimeTypeFromFile(url);\n const text = name || url;\n\n return (\n <Grid as={StyledFileItem} container={{ cols: 'auto 1fr' }} ref={ref}>\n <FileVisual\n type={getKindFromMimeType(type ?? '')}\n disabled={!onPreview}\n thumbnail={thumbnail}\n onClick={() => onPreview?.(url)}\n aria-label={`${t('preview')}: ${text}`}\n />\n <Button\n {...restProps}\n variant='text'\n disabled={!onDownload}\n onClick={onDownloadClick}\n aria-label={`${t('download')}: ${text}`}\n >\n {text}\n </Button>\n </Grid>\n );\n }\n);\n\nexport default FileItem;\n"]}
1
+ {"version":3,"file":"FileItem.js","sourceRoot":"","sources":["../../../src/components/File/FileItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,WAAW,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,UAAU,EAAE,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAiB5D,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE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GAAG,aACjE,KAAC,UAAU,IACT,IAAI,EAAE,mBAAmB,CAAC,IAAI,IAAI,EAAE,CAAC,EACrC,QAAQ,EAAE,CAAC,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,gBACnB,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,WACtC,EACF,KAAC,MAAM,OACD,SAAS,EACb,OAAO,EAAC,MAAM,EACd,QAAQ,EAAE,CAAC,UAAU,EACrB,OAAO,EAAE,eAAe,gBACZ,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,YAEtC,IAAI,WACE,YACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, FC, Ref, useCallback } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, BaseProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Button, { StyledButton } from '../Button';\nimport Grid from '../Grid';\nimport { useDirection, useI18n } from '../../hooks';\n\nimport { getKindFromMimeType, getMimeTypeFromFile } from './utils';\nimport FileVisual, { StyledFileVisual } from './FileVisual';\n\nexport interface FileItemProps extends BaseProps {\n /** Name of the file. */\n name: string;\n /** Url of the file. */\n url: string;\n /** Url pointing to the thumbnail image, rendered in the 'visual' region. */\n thumbnail?: string;\n /** When passed, it will make the icon/thumbnail region actionable. Passes file url as the parameter. */\n onPreview?: (url: FileItemProps['url']) => void;\n /** When passed, it will make the name region actionable. Passes file url as the parameter. */\n onDownload?: (url: FileItemProps['url']) => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLButtonElement>;\n}\n\nconst StyledFileItem = styled.div(({ theme: { base } }) => {\n const { start, end } = useDirection();\n\n return css`\n border-radius: calc(0.5 * ${base['border-radius']});\n\n > ${StyledFileVisual} {\n ${`border-top-${start}-radius`}: inherit;\n ${`border-bottom-${start}-radius`}: inherit;\n ${`border-top-${end}-radius`}: 0;\n ${`border-bottom-${end}-radius`}: 0;\n }\n\n > ${StyledFileVisual} + ${StyledButton} {\n margin-inline-start: 0;\n border: 0.0625rem solid ${base.palette['border-line']};\n background-color: ${base.palette['primary-background']};\n opacity: 1;\n padding: 0 ${base.spacing};\n border-inline-start: 0;\n ${`border-top-${start}-radius`}: 0;\n ${`border-bottom-${start}-radius`}: 0;\n ${`border-top-${end}-radius`}: inherit;\n ${`border-bottom-${end}-radius`}: inherit;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n `;\n});\n\nStyledFileItem.defaultProps = defaultThemeProp;\n\nconst FileItem: FC<FileItemProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileItemProps>, ref: FileItemProps['ref']) => {\n const { name, url, thumbnail, onPreview, onDownload, ...restProps } = props;\n\n const t = useI18n();\n\n const onDownloadClick = useCallback(() => {\n onDownload?.(url);\n }, [url, onDownload]);\n\n const type = getMimeTypeFromFile(url);\n const text = name || url;\n\n return (\n <Grid as={StyledFileItem} container={{ cols: 'auto 1fr' }} ref={ref}>\n <FileVisual\n type={getKindFromMimeType(type ?? '')}\n disabled={!onPreview}\n thumbnail={thumbnail}\n onClick={() => onPreview?.(url)}\n aria-label={`${t('preview')}: ${text}`}\n />\n <Button\n {...restProps}\n variant='text'\n disabled={!onDownload}\n onClick={onDownloadClick}\n aria-label={`${t('download')}: ${text}`}\n >\n {text}\n </Button>\n </Grid>\n );\n }\n);\n\nexport default FileItem;\n"]}
@@ -37,14 +37,14 @@ const FileUploadItem = forwardRef((props, ref) => {
37
37
  metaContent = `${t('uploading')}…${Math.floor(progress)}%`;
38
38
  }
39
39
  if (Array.isArray(metaContent)) {
40
- metaContent = (_jsx(MetaList, { items: metaContent.map(item => (_jsx(Text, Object.assign({ variant: 'secondary', status: error ? 'error' : undefined }, { children: item }), item?.toString()))) }, void 0));
40
+ metaContent = (_jsx(MetaList, { items: metaContent.map(item => (_jsx(Text, { variant: 'secondary', status: error ? 'error' : undefined, children: item }, item?.toString()))) }, void 0));
41
41
  }
42
42
  else if (typeof metaContent === 'string') {
43
- metaContent = (_jsx(Text, Object.assign({ variant: 'secondary', status: error ? 'error' : undefined }, { children: metaContent }), void 0));
43
+ metaContent = (_jsx(Text, { variant: 'secondary', status: error ? 'error' : undefined, children: metaContent }, void 0));
44
44
  }
45
45
  if (definedActions.length === 1) {
46
46
  const action = definedActions[0];
47
- actions = (_jsx(Button, Object.assign({ icon: true, variant: 'simple', onClick: () => action.fn?.(name), "aria-label": `${action.text} ${name}` }, { children: _jsx(Icon, { name: action.icon }, void 0) }), void 0));
47
+ actions = (_jsx(Button, { icon: true, variant: 'simple', onClick: () => action.fn?.(name), "aria-label": `${action.text} ${name}`, children: _jsx(Icon, { name: action.icon }, void 0) }, void 0));
48
48
  }
49
49
  else if (definedActions.length > 1) {
50
50
  actions = (_jsx(MenuButton, { text: t('actions'), iconOnly: true, icon: 'more', variant: 'simple', menu: {
@@ -64,7 +64,7 @@ const FileUploadItem = forwardRef((props, ref) => {
64
64
  const type = getMimeTypeFromFile(name);
65
65
  return _jsx(FileVisual, { type: getKindFromMimeType(type ?? ''), thumbnail: thumbnail }, void 0);
66
66
  }, [progress, thumbnail, name]);
67
- return (_jsx(SummaryItem, Object.assign({}, restProps, { as: StyledFileUploadItem, ref: ref, visual: visual, primary: name, secondary: metaContent, actions: actions, error: error }), void 0));
67
+ return (_jsx(SummaryItem, { ...restProps, as: StyledFileUploadItem, ref: ref, visual: visual, primary: name, secondary: metaContent, actions: actions, error: error }, void 0));
68
68
  });
69
69
  export default FileUploadItem;
70
70
  //# sourceMappingURL=FileUploadItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadItem.js","sourceRoot":"","sources":["../../../src/components/File/FileUploadItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA0C,OAAO,EAAa,MAAM,OAAO,CAAC;AAC/F,OAAO,MAAM,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,KAAK,QAAQ,IAAI,QAAQ,KAAK,GAAG,EAAE;YACpD,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAC,QAAQ,EAAC,OAAO,EAAC,MAAM,WAAG,CAAC;SACxE;QACD,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,KAAC,UAAU,IAAC,IAAI,EAAE,mBAAmB,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,SAAS,WAAI,CAAC;IACrF,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAEhC,OAAO,CACL,KAAC,WAAW,oBACN,SAAS,IACb,EAAE,EAAE,oBAAoB,EACxB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,YACZ,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, FC, Ref, ReactElement, useMemo, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport MenuButton from '../MenuButton';\nimport MetaList from '../MetaList';\nimport SummaryItem from '../SummaryItem';\nimport Progress from '../Progress';\nimport Text from '../Text';\nimport { ForwardProps, BaseProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useI18n } from '../../hooks';\n\nimport { getKindFromMimeType, getMimeTypeFromFile } from './utils';\nimport FileVisual from './FileVisual';\n\nexport interface FileUploadItemProps extends BaseProps {\n /** Name of the file. */\n name: string;\n /** A FileUploadVisual element to represent the file. */\n visual?: ReactElement;\n /** Additional information about the file. If progress prop is passed and its value is less than 100, this region is instead used for the upload progress indicator. */\n meta?: string | string[];\n /** When passed, will render a single icon button for yet to be or in progress uploads. Use this action to trigger xhr request termination. */\n onCancel?: (name: FileUploadItemProps['name']) => void;\n /** When passed, will render a single icon button or within a MenuButton if other actions are defined. */\n onEdit?: (name: FileUploadItemProps['name']) => void;\n /** When passed, will render a single icon button or within a MenuButton if other actions are defined. */\n onPreview?: (name: FileUploadItemProps['name']) => void;\n /** When passed, will render a single icon button or within a MenuButton if other actions are defined. */\n onDownload?: (name: FileUploadItemProps['name']) => void;\n /** When passed, will render a single icon button or within a MenuButton if other actions are defined. */\n onDelete?: (name: FileUploadItemProps['name']) => void;\n /**\n * Set if there is an error uploading or processing the file. Applies error styling to the meta string passed.\n * @default false\n */\n error?: boolean;\n /** A string to be used as an image src for a attachment thumbnail. Falls back to a provided icon or the default attachment icon. */\n thumbnail?: string;\n /** If the attachment is in an upload state, pass progress as a number between 0-100 representing the percentage of progress. */\n progress?: number;\n /** A ref to the file item's HTMLLIElement. */\n ref?: Ref<HTMLLIElement>;\n}\n\ninterface FileAction {\n fn: (name: FileUploadItemProps['name']) => void;\n text: string;\n icon: string;\n}\n\nconst StyledFileUploadItem = styled.li(props => {\n const { theme } = props;\n\n return css`\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n background-color: ${theme.base.palette['primary-background']};\n padding: calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledFileUploadItem.defaultProps = defaultThemeProp;\n\nconst FileUploadItem: FC<FileUploadItemProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileUploadItemProps>, ref: FileUploadItemProps['ref']) => {\n const {\n name,\n meta,\n error = false,\n progress,\n thumbnail,\n onCancel,\n onEdit,\n onPreview,\n onDownload,\n onDelete,\n ...restProps\n } = props;\n\n const t = useI18n();\n\n const definedActions: FileAction[] = useMemo(\n () =>\n [\n { fn: onCancel, text: t('cancel'), icon: 'times' },\n { fn: onEdit, text: t('edit'), icon: 'pencil' },\n { fn: onPreview, text: t('preview'), icon: 'eye' },\n { fn: onDownload, text: t('download'), icon: 'download' },\n { fn: onDelete, text: t('delete'), icon: 'trash' }\n ].filter<FileAction>((action): action is FileAction => !!action.fn),\n [onCancel, onEdit, onPreview, onDownload, onDelete]\n );\n\n let metaContent: ReactNode = meta;\n let actions: ReactElement | undefined;\n\n if (typeof progress === 'number' && progress < 100) {\n metaContent = `${t('uploading')}…${Math.floor(progress)}%`;\n }\n\n if (Array.isArray(metaContent)) {\n metaContent = (\n <MetaList\n items={metaContent.map(item => (\n <Text key={item?.toString()} variant='secondary' status={error ? 'error' : undefined}>\n {item}\n </Text>\n ))}\n />\n );\n } else if (typeof metaContent === 'string') {\n metaContent = (\n <Text variant='secondary' status={error ? 'error' : undefined}>\n {metaContent}\n </Text>\n );\n }\n\n if (definedActions.length === 1) {\n const action = definedActions[0];\n\n actions = (\n <Button\n icon\n variant='simple'\n onClick={() => action.fn?.(name)}\n aria-label={`${action.text} ${name}`}\n >\n <Icon name={action.icon} />\n </Button>\n );\n } else if (definedActions.length > 1) {\n actions = (\n <MenuButton\n text={t('actions')}\n iconOnly\n icon='more'\n variant='simple'\n menu={{\n items: definedActions.map(action => ({\n id: action.text,\n primary: action.text,\n onClick: () => {\n action.fn(name);\n }\n }))\n }}\n />\n );\n }\n\n const visual = useMemo(() => {\n if (typeof progress === 'number' && progress !== 100) {\n return <Progress value={progress} placement='inline' variant='ring' />;\n }\n const type = getMimeTypeFromFile(name);\n return <FileVisual type={getKindFromMimeType(type ?? '')} thumbnail={thumbnail} />;\n }, [progress, thumbnail, name]);\n\n return (\n <SummaryItem\n {...restProps}\n as={StyledFileUploadItem}\n ref={ref}\n visual={visual}\n primary={name}\n secondary={metaContent}\n actions={actions}\n error={error}\n />\n );\n }\n);\n\nexport default FileUploadItem;\n"]}
1
+ {"version":3,"file":"FileUploadItem.js","sourceRoot":"","sources":["../../../src/components/File/FileUploadItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA0C,OAAO,EAAa,MAAM,OAAO,CAAC;AAC/F,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,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G,EAAE;YACpD,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAC,QAAQ,EAAC,OAAO,EAAC,MAAM,WAAG,CAAC;SACxE;QACD,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,KAAC,UAAU,IAAC,IAAI,EAAE,mBAAmB,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,SAAS,WAAI,CAAC;IACrF,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAEhC,OAAO,CACL,KAAC,WAAW,OACN,SAAS,EACb,EAAE,EAAE,oBAAoB,EACxB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,WACZ,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, FC, Ref, ReactElement, useMemo, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport MenuButton from '../MenuButton';\nimport MetaList from '../MetaList';\nimport SummaryItem from '../SummaryItem';\nimport Progress from '../Progress';\nimport Text from '../Text';\nimport { ForwardProps, BaseProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useI18n } from '../../hooks';\n\nimport { getKindFromMimeType, getMimeTypeFromFile } from './utils';\nimport FileVisual from './FileVisual';\n\nexport interface FileUploadItemProps extends BaseProps {\n /** Name of the file. */\n name: string;\n /** A FileUploadVisual element to represent the file. */\n visual?: ReactElement;\n /** Additional information about the file. If progress prop is passed and its value is less than 100, this region is instead used for the upload progress indicator. */\n meta?: string | string[];\n /** When passed, will render a single icon button for yet to be or in progress uploads. Use this action to trigger xhr request termination. */\n onCancel?: (name: FileUploadItemProps['name']) => void;\n /** When passed, will render a single icon button or within a MenuButton if other actions are defined. */\n onEdit?: (name: FileUploadItemProps['name']) => void;\n /** When passed, will render a single icon button or within a MenuButton if other actions are defined. */\n onPreview?: (name: FileUploadItemProps['name']) => void;\n /** When passed, will render a single icon button or within a MenuButton if other actions are defined. */\n onDownload?: (name: FileUploadItemProps['name']) => void;\n /** When passed, will render a single icon button or within a MenuButton if other actions are defined. */\n onDelete?: (name: FileUploadItemProps['name']) => void;\n /**\n * Set if there is an error uploading or processing the file. Applies error styling to the meta string passed.\n * @default false\n */\n error?: boolean;\n /** A string to be used as an image src for a attachment thumbnail. Falls back to a provided icon or the default attachment icon. */\n thumbnail?: string;\n /** If the attachment is in an upload state, pass progress as a number between 0-100 representing the percentage of progress. */\n progress?: number;\n /** A ref to the file item's HTMLLIElement. */\n ref?: Ref<HTMLLIElement>;\n}\n\ninterface FileAction {\n fn: (name: FileUploadItemProps['name']) => void;\n text: string;\n icon: string;\n}\n\nconst StyledFileUploadItem = styled.li(props => {\n const { theme } = props;\n\n return css`\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n background-color: ${theme.base.palette['primary-background']};\n padding: calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledFileUploadItem.defaultProps = defaultThemeProp;\n\nconst FileUploadItem: FC<FileUploadItemProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileUploadItemProps>, ref: FileUploadItemProps['ref']) => {\n const {\n name,\n meta,\n error = false,\n progress,\n thumbnail,\n onCancel,\n onEdit,\n onPreview,\n onDownload,\n onDelete,\n ...restProps\n } = props;\n\n const t = useI18n();\n\n const definedActions: FileAction[] = useMemo(\n () =>\n [\n { fn: onCancel, text: t('cancel'), icon: 'times' },\n { fn: onEdit, text: t('edit'), icon: 'pencil' },\n { fn: onPreview, text: t('preview'), icon: 'eye' },\n { fn: onDownload, text: t('download'), icon: 'download' },\n { fn: onDelete, text: t('delete'), icon: 'trash' }\n ].filter<FileAction>((action): action is FileAction => !!action.fn),\n [onCancel, onEdit, onPreview, onDownload, onDelete]\n );\n\n let metaContent: ReactNode = meta;\n let actions: ReactElement | undefined;\n\n if (typeof progress === 'number' && progress < 100) {\n metaContent = `${t('uploading')}…${Math.floor(progress)}%`;\n }\n\n if (Array.isArray(metaContent)) {\n metaContent = (\n <MetaList\n items={metaContent.map(item => (\n <Text key={item?.toString()} variant='secondary' status={error ? 'error' : undefined}>\n {item}\n </Text>\n ))}\n />\n );\n } else if (typeof metaContent === 'string') {\n metaContent = (\n <Text variant='secondary' status={error ? 'error' : undefined}>\n {metaContent}\n </Text>\n );\n }\n\n if (definedActions.length === 1) {\n const action = definedActions[0];\n\n actions = (\n <Button\n icon\n variant='simple'\n onClick={() => action.fn?.(name)}\n aria-label={`${action.text} ${name}`}\n >\n <Icon name={action.icon} />\n </Button>\n );\n } else if (definedActions.length > 1) {\n actions = (\n <MenuButton\n text={t('actions')}\n iconOnly\n icon='more'\n variant='simple'\n menu={{\n items: definedActions.map(action => ({\n id: action.text,\n primary: action.text,\n onClick: () => {\n action.fn(name);\n }\n }))\n }}\n />\n );\n }\n\n const visual = useMemo(() => {\n if (typeof progress === 'number' && progress !== 100) {\n return <Progress value={progress} placement='inline' variant='ring' />;\n }\n const type = getMimeTypeFromFile(name);\n return <FileVisual type={getKindFromMimeType(type ?? '')} thumbnail={thumbnail} />;\n }, [progress, thumbnail, name]);\n\n return (\n <SummaryItem\n {...restProps}\n as={StyledFileUploadItem}\n ref={ref}\n visual={visual}\n primary={name}\n secondary={metaContent}\n actions={actions}\n error={error}\n />\n );\n }\n);\n\nexport default FileUploadItem;\n"]}
@@ -93,10 +93,10 @@ export const StyledFileVisual = styled.div(({ theme, thumbnail, size, aType }) =
93
93
  StyledFileVisual.defaultProps = defaultThemeProp;
94
94
  const FileVisual = forwardRef((props, ref) => {
95
95
  const { type, thumbnail, size, disabled, ...restProps } = props;
96
- return (_jsxs(StyledFileVisual, Object.assign({}, restProps, { as: StyledButton, ref: ref, icon: true, aType: type }, {
97
- thumbnail,
98
- disabled
99
- }, { children: [mapping[type].iconName && _jsx(Icon, { name: mapping[type].iconName }, void 0), mapping[type].text] }), void 0));
96
+ return (_jsxs(StyledFileVisual, { ...restProps, as: StyledButton, ref: ref, icon: true, aType: type, ...{
97
+ thumbnail,
98
+ disabled
99
+ }, children: [mapping[type].iconName && _jsx(Icon, { name: mapping[type].iconName }, void 0), mapping[type].text] }, void 0));
100
100
  });
101
101
  export default FileVisual;
102
102
  //# sourceMappingURL=FileVisual.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileVisual.js","sourceRoot":"","sources":["../../../src/components/File/FileVisual.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,MAAM,OAAO,CAAC;AAC7D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAe,YAAY,EAAE,MAAM,WAAW,CAAC;AAyBtD,MAAM,OAAO,GAGT;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,YAAY;QACtB,eAAe,EAAE,YAAY;KAC9B;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,YAAY;QACtB,eAAe,EAAE,YAAY;KAC9B;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,kBAAkB;QAC5B,eAAe,EAAE,YAAY;KAC9B;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,eAAe;QACzB,eAAe,EAAE,aAAa;KAC/B;IACD,OAAO,EAAE;QACP,QAAQ,EAAE,YAAY;QACtB,eAAe,EAAE,WAAW;KAC7B;IACD,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,eAAe,EAAE,YAAY;KAC9B;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,YAAY;QACtB,eAAe,EAAE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;4BAChC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC;mBAChC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;;;MAGnD,SAAS;QACX,GAAG,CAAA;8BACuB,SAAS;;KAElC;;MAEC,UAAU;;;;GAIb,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,UAAU,GAAuC,UAAU,CAC/D,CAAC,KAAuC,EAAE,GAA2B,EAAE,EAAE;IACvE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAChE,OAAO,CACL,MAAC,gBAAgB,oBACX,SAAS,IACb,EAAE,EAAE,YAAY,EAChB,GAAG,EAAE,GAAG,EACR,IAAI,QACJ,KAAK,EAAE,IAAI,IACP;QACF,SAAS;QACT,QAAQ;KACT,eAEA,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,QAAS,WAAI,EACjE,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,aACF,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, FC, Ref } from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\n\nimport Icon from '../Icon';\nimport { ForwardProps, BaseProps, OmitStrict, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { StyledText } from '../Text';\nimport { ButtonProps, StyledButton } from '../Button';\n\nimport { AttachmentType } from './utils';\n\nexport interface FileVisualProps extends BaseProps {\n /** Attachment/File type, it has an impact on background color and icon rendered. */\n type: AttachmentType;\n /** A string to be used as an image src for a attachment thumbnail. */\n thumbnail?: string;\n /** Disabled means, the button is not interactive. */\n disabled?: ButtonProps['disabled'];\n /** Reference to a button element. */\n ref?: Ref<HTMLButtonElement>;\n /**\n * FileVisual size.\n * @default \"s\"\n */\n size?: 's' | 'l';\n}\ntype FileVisualPropsWithDefaults = PropsWithDefaults<FileVisualProps, 'size'>;\ntype ThemeColor = keyof OmitStrict<DefaultTheme['base']['colors'], 'white' | 'black'>;\ntype ThemeColorVariant = 'extra-light' | 'light' | 'medium' | 'dark' | 'extra-dark';\n\ntype BackgroundColor = `${ThemeColor}-${ThemeColorVariant}`;\n\nconst mapping: Record<\n AttachmentType,\n { iconName?: string; backgroundColor: BackgroundColor; text?: string }\n> = {\n generic: {\n iconName: 'paper-clip',\n backgroundColor: 'slate-dark'\n },\n video: {\n iconName: 'play-solid',\n backgroundColor: 'slate-dark'\n },\n audio: {\n iconName: 'speaker-on-solid',\n backgroundColor: 'slate-dark'\n },\n document: {\n iconName: 'filetype-text',\n backgroundColor: 'blue-medium'\n },\n message: {\n iconName: 'mail-solid',\n backgroundColor: 'blue-dark'\n },\n pdf: {\n text: 'PDF',\n backgroundColor: 'red-medium'\n },\n spreadsheet: {\n iconName: 'grid-solid',\n backgroundColor: 'green-medium'\n },\n presentation: {\n iconName: 'slideshow-solid',\n backgroundColor: 'orange-medium'\n },\n link: {\n iconName: 'chain',\n backgroundColor: 'purple-dark'\n },\n archive: {\n iconName: 'archive-solid',\n backgroundColor: 'slate-dark'\n },\n database: {\n iconName: 'disc-stack-solid',\n backgroundColor: 'slate-dark'\n },\n image: {\n iconName: 'picture-solid',\n backgroundColor: 'slate-dark'\n },\n text: {\n iconName: 'filetype-text',\n backgroundColor: 'slate-dark'\n }\n} as const;\n\nconst sizeConverter = {\n s: 1,\n l: 1.375\n};\n\nexport const StyledFileVisual = styled.div<\n Pick<FileVisualPropsWithDefaults, 'size'> & {\n thumbnail?: FileVisualProps['thumbnail'];\n aType: AttachmentType;\n }\n>(({ theme, thumbnail, size, aType }) => {\n const [color, lightness] = mapping[aType].backgroundColor.split('-', 2) as [\n ThemeColor,\n ThemeColorVariant\n ];\n const backgroundColor = theme.base.colors[color];\n const sizeMultiplier = sizeConverter[size] ?? 1;\n return css`\n background-color: ${backgroundColor[lightness]};\n color: ${theme.base.palette.light};\n border-color: transparent;\n height: calc(${sizeMultiplier} * ${theme.components.input.height});\n width: calc(${sizeMultiplier} * ${theme.components.input.height});\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n font-size: calc(0.7 * ${theme.base['font-size']});\n font-weight: ${theme.base['font-weight']['semi-bold']};\n overflow: hidden;\n opacity: 1;\n ${thumbnail &&\n css`\n background-image: url(${thumbnail});\n background-size: contain;\n `}\n\n ${StyledText} {\n color: inherit;\n white-space: nowrap;\n }\n `;\n});\n\nStyledFileVisual.defaultProps = defaultThemeProp;\n\nconst FileVisual: FC<FileVisualProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileVisualProps>, ref: FileVisualProps['ref']) => {\n const { type, thumbnail, size, disabled, ...restProps } = props;\n return (\n <StyledFileVisual\n {...restProps}\n as={StyledButton}\n ref={ref}\n icon\n aType={type}\n {...{\n thumbnail,\n disabled\n }}\n >\n {mapping[type].iconName && <Icon name={mapping[type].iconName!} />}\n {mapping[type].text}\n </StyledFileVisual>\n );\n }\n);\n\nexport default FileVisual;\n"]}
1
+ {"version":3,"file":"FileVisual.js","sourceRoot":"","sources":["../../../src/components/File/FileVisual.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,MAAM,OAAO,CAAC;AAC7D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAe,YAAY,EAAE,MAAM,WAAW,CAAC;AAyBtD,MAAM,OAAO,GAGT;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,YAAY;QACtB,eAAe,EA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CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, FC, Ref } from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\n\nimport Icon from '../Icon';\nimport { ForwardProps, BaseProps, OmitStrict, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { StyledText } from '../Text';\nimport { ButtonProps, StyledButton } from '../Button';\n\nimport { AttachmentType } from './utils';\n\nexport interface FileVisualProps extends BaseProps {\n /** Attachment/File type, it has an impact on background color and icon rendered. */\n type: AttachmentType;\n /** A string to be used as an image src for a attachment thumbnail. */\n thumbnail?: string;\n /** Disabled means, the button is not interactive. */\n disabled?: ButtonProps['disabled'];\n /** Reference to a button element. */\n ref?: Ref<HTMLButtonElement>;\n /**\n * FileVisual size.\n * @default \"s\"\n */\n size?: 's' | 'l';\n}\ntype FileVisualPropsWithDefaults = PropsWithDefaults<FileVisualProps, 'size'>;\ntype ThemeColor = keyof OmitStrict<DefaultTheme['base']['colors'], 'white' | 'black'>;\ntype ThemeColorVariant = 'extra-light' | 'light' | 'medium' | 'dark' | 'extra-dark';\n\ntype BackgroundColor = `${ThemeColor}-${ThemeColorVariant}`;\n\nconst mapping: Record<\n AttachmentType,\n { iconName?: string; backgroundColor: BackgroundColor; text?: string }\n> = {\n generic: {\n iconName: 'paper-clip',\n backgroundColor: 'slate-dark'\n },\n video: {\n iconName: 'play-solid',\n backgroundColor: 'slate-dark'\n },\n audio: {\n iconName: 'speaker-on-solid',\n backgroundColor: 'slate-dark'\n },\n document: {\n iconName: 'filetype-text',\n backgroundColor: 'blue-medium'\n },\n message: {\n iconName: 'mail-solid',\n backgroundColor: 'blue-dark'\n },\n pdf: {\n text: 'PDF',\n backgroundColor: 'red-medium'\n },\n spreadsheet: {\n iconName: 'grid-solid',\n backgroundColor: 'green-medium'\n },\n presentation: {\n iconName: 'slideshow-solid',\n backgroundColor: 'orange-medium'\n },\n link: {\n iconName: 'chain',\n backgroundColor: 'purple-dark'\n },\n archive: {\n iconName: 'archive-solid',\n backgroundColor: 'slate-dark'\n },\n database: {\n iconName: 'disc-stack-solid',\n backgroundColor: 'slate-dark'\n },\n image: {\n iconName: 'picture-solid',\n backgroundColor: 'slate-dark'\n },\n text: {\n iconName: 'filetype-text',\n backgroundColor: 'slate-dark'\n }\n} as const;\n\nconst sizeConverter = {\n s: 1,\n l: 1.375\n};\n\nexport const StyledFileVisual = styled.div<\n Pick<FileVisualPropsWithDefaults, 'size'> & {\n thumbnail?: FileVisualProps['thumbnail'];\n aType: AttachmentType;\n }\n>(({ theme, thumbnail, size, aType }) => {\n const [color, lightness] = mapping[aType].backgroundColor.split('-', 2) as [\n ThemeColor,\n ThemeColorVariant\n ];\n const backgroundColor = theme.base.colors[color];\n const sizeMultiplier = sizeConverter[size] ?? 1;\n return css`\n background-color: ${backgroundColor[lightness]};\n color: ${theme.base.palette.light};\n border-color: transparent;\n height: calc(${sizeMultiplier} * ${theme.components.input.height});\n width: calc(${sizeMultiplier} * ${theme.components.input.height});\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n font-size: calc(0.7 * ${theme.base['font-size']});\n font-weight: ${theme.base['font-weight']['semi-bold']};\n overflow: hidden;\n opacity: 1;\n ${thumbnail &&\n css`\n background-image: url(${thumbnail});\n background-size: contain;\n `}\n\n ${StyledText} {\n color: inherit;\n white-space: nowrap;\n }\n `;\n});\n\nStyledFileVisual.defaultProps = defaultThemeProp;\n\nconst FileVisual: FC<FileVisualProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileVisualProps>, ref: FileVisualProps['ref']) => {\n const { type, thumbnail, size, disabled, ...restProps } = props;\n return (\n <StyledFileVisual\n {...restProps}\n as={StyledButton}\n ref={ref}\n icon\n aType={type}\n {...{\n thumbnail,\n disabled\n }}\n >\n {mapping[type].iconName && <Icon name={mapping[type].iconName!} />}\n {mapping[type].text}\n </StyledFileVisual>\n );\n }\n);\n\nexport default FileVisual;\n"]}
@@ -122,7 +122,7 @@ export const StyledFlex = styled.div(({ container, item }) => {
122
122
  });
123
123
  StyledFlex.defaultProps = defaultThemeProp;
124
124
  const Flex = forwardRef((props, ref) => {
125
- return _jsx(StyledFlex, Object.assign({}, props, { ref: ref }), void 0);
125
+ return _jsx(StyledFlex, { ...props, ref: ref }, void 0);
126
126
  });
127
127
  export default Flex;
128
128
  //# sourceMappingURL=Flex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmC,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAkE/C,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;IAC/B,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,KAAK,EAAE,CAAC;IAC7E,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,QAAQ,KAAK,EAAE,CAAC;IAC7D,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,SAAiC,EAAE,EAAE;IAC/D,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAE1B,IAAI,SAAS,KAAK,IAAI,EAAE;QACtB,OAAO,GAAG,CAAA;;KAET,CAAC;KACH;IAED,IAAI,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QAC9C,MAAM,KAAK,GAAG,CAAC,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC1E,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CA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AC,SAAS,CAAC;MAC7B,aAAa,CAAC,IAAI,CAAC;GACtB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAgD,UAAU,CAClE,CAAC,KAAiC,EAAE,GAAqB,EAAE,EAAE;IAC3D,OAAO,KAAC,UAAU,oBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,YAAI,CAAC;AAC7C,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, BaseProps, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nexport interface FlexContainerProps {\n /** Display as inline-flex. */\n inline?: boolean;\n /** Padding on the container represented as a multiplier or set of multipliers to the base spacing value in the theme. */\n pad?:\n | number\n | [topRightBottomLeft: number]\n | [topBottom: number, rightLeft: number]\n | [top: number, rightLeft: number, bottom: number]\n | [top: number, right: number, bottom: number, left: number];\n /** [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/) */\n direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';\n /** [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch';\n /** [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/) */\n wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';\n /** [align-items](https://css-tricks.com/almanac/properties/a/align-items/). */\n alignItems?: 'stretch' | 'start' | 'end' | 'center' | 'baseline';\n /** [align-content](https://css-tricks.com/almanac/properties/a/align-content/) */\n alignContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'stretch';\n /**\n * Defines how much equal space to place between items represented as a multiplier to the base spacing value in the theme.\n * @deprecated\n */\n itemGap?: number;\n /**\n * Defines how much equal space to place between columns represented as a multiplier to the base spacing value in the theme.\n * [column-gap](https://css-tricks.com/almanac/properties/c/column-gap/)\n */\n colGap?: number;\n /**\n * Defines how much equal space to place between rows represented as a multiplier to the base spacing value in the theme.\n * [row-gap](https://css-tricks.com/almanac/properties/r/row-gap/)\n */\n rowGap?: number;\n /**\n * Defines how much equal space to place between both rows and columns represented as a multiplier to the base spacing value in the theme.\n * [gap](https://css-tricks.com/almanac/properties/g/gap/)\n */\n gap?: number;\n}\n\nexport interface FlexItemProps {\n /** [align-self](https://css-tricks.com/almanac/properties/a/align-self/) */\n alignSelf?: 'auto' | 'start' | 'end' | 'baseline' | 'center' | 'stretch';\n /** [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/) */\n grow?: number;\n /** [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/) */\n shrink?: number;\n /** [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/) */\n basis?: string;\n}\n\nexport interface FlexProps extends BaseProps, AsProp {\n /** Content for either a container or item. */\n children?: ReactNode;\n /** Display as flex. Passed as a boolean, only a display flex will be applied. Provide FlexContainer object props to enable flex functionality. */\n container?: FlexContainerProps | boolean;\n /** Use to leverage flex item functionality when rendered as a child of a flex container. Items can be containers as well. */\n item?: FlexItemProps;\n /** Ref for the flex element. */\n ref?: Ref<Element>;\n}\n\nconst prefix = (value: string) => {\n if (['between', 'around', 'evenly'].includes(value)) return `space-${value}`;\n if (['start', 'end'].includes(value)) return `flex-${value}`;\n return value;\n};\n\nconst getContainerStyles = (container: FlexProps['container']) => {\n if (!container) return '';\n\n if (container === true) {\n return css`\n display: flex;\n `;\n }\n\n if (container && typeof container === 'object') {\n const isRow = !container.direction || container.direction.includes('row');\n const isReverse = container.direction && container.direction.includes('reverse');\n\n return css`\n display: ${container.inline ? 'inline-flex' : 'flex'};\n\n ${typeof container.pad !== 'undefined' &&\n css`\n /* stylelint-disable function-name-case, function-whitespace-after */\n padding: ${({\n theme: {\n base: { spacing }\n }\n }) =>\n (Array.isArray(container.pad) ? container.pad : [container.pad])\n .map(p => `calc(${p} * ${spacing})`)\n .join(' ')};\n\n /* stylelint-enable function-name-case, function-whitespace-after */\n `}\n\n ${container.direction &&\n css`\n flex-direction: ${container.direction};\n `}\n\n ${container.justify &&\n css`\n justify-content: ${prefix(container.justify)};\n `}\n\n ${container.wrap &&\n css`\n flex-wrap: ${container.wrap};\n `}\n\n ${container.alignItems &&\n css`\n align-items: ${prefix(container.alignItems)};\n `}\n\n ${container.alignContent &&\n css`\n align-content: ${prefix(container.alignContent)};\n `}\n\n ${container.itemGap &&\n css`\n > * {\n margin-${isRow ? 'inline-start' : 'block-start'}: calc(${container.itemGap} * ${props =>\n props.theme.base.spacing});\n ${isReverse ? ':last-child' : ':first-child'} {\n margin-${isRow ? 'inline-start' : 'block-start'}: 0;\n }\n }\n `}\n\n ${typeof container.gap !== 'undefined' &&\n css`\n gap: calc(${container.gap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof container.colGap !== 'undefined' &&\n css`\n column-gap: calc(${container.colGap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof container.rowGap !== 'undefined' &&\n css`\n row-gap: calc(${container.rowGap} * ${props => props.theme.base.spacing});\n `}\n `;\n }\n};\n\nconst getItemStyles = (item: FlexProps['item']) => {\n return css`\n ${item &&\n css`\n max-width: 100%;\n min-width: 0;\n\n ${item.grow !== undefined &&\n css`\n flex-grow: ${item.grow};\n `}\n\n ${item.shrink !== undefined &&\n css`\n flex-shrink: ${item.shrink};\n `}\n\n ${item.alignSelf &&\n css`\n align-self: ${prefix(item.alignSelf)};\n `}\n\n ${item.basis &&\n css`\n flex-basis: ${item.basis};\n `}\n `}\n `;\n};\n\nexport const StyledFlex = styled.div<FlexProps>(({ container, item }) => {\n return css`\n ${getContainerStyles(container)}\n ${getItemStyles(item)}\n `;\n});\n\nStyledFlex.defaultProps = defaultThemeProp;\n\nconst Flex: FunctionComponent<FlexProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FlexProps>, ref: FlexProps['ref']) => {\n return <StyledFlex {...props} ref={ref} />;\n }\n);\n\nexport default Flex;\n"]}
1
+ {"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmC,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAkE/C,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;IAC/B,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,KAAK,EAAE,CAAC;IAC7E,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,QAAQ,KAAK,EAAE,CAAC;IAC7D,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,SAAiC,EAAE,EAAE;IAC/D,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAE1B,IAAI,SAAS,KAAK,IAAI,EAAE;QACtB,OAAO,GAAG,CAAA;;KAET,CAAC;KACH;IAED,IAAI,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QAC9C,MAAM,KAAK,GAAG,CAAC,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC1E,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAEjF,OAAO,GAAG,CAAA;iBACG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM;;QAElD,OAAO,SAAS,CAAC,GAAG,KAAK,WAAW;YACtC,GAA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GAAqB,EAAE,EAAE;IAC3D,OAAO,KAAC,UAAU,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,WAAI,CAAC;AAC7C,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, BaseProps, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nexport interface FlexContainerProps {\n /** Display as inline-flex. */\n inline?: boolean;\n /** Padding on the container represented as a multiplier or set of multipliers to the base spacing value in the theme. */\n pad?:\n | number\n | [topRightBottomLeft: number]\n | [topBottom: number, rightLeft: number]\n | [top: number, rightLeft: number, bottom: number]\n | [top: number, right: number, bottom: number, left: number];\n /** [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/) */\n direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';\n /** [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch';\n /** [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/) */\n wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';\n /** [align-items](https://css-tricks.com/almanac/properties/a/align-items/). */\n alignItems?: 'stretch' | 'start' | 'end' | 'center' | 'baseline';\n /** [align-content](https://css-tricks.com/almanac/properties/a/align-content/) */\n alignContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'stretch';\n /**\n * Defines how much equal space to place between items represented as a multiplier to the base spacing value in the theme.\n * @deprecated\n */\n itemGap?: number;\n /**\n * Defines how much equal space to place between columns represented as a multiplier to the base spacing value in the theme.\n * [column-gap](https://css-tricks.com/almanac/properties/c/column-gap/)\n */\n colGap?: number;\n /**\n * Defines how much equal space to place between rows represented as a multiplier to the base spacing value in the theme.\n * [row-gap](https://css-tricks.com/almanac/properties/r/row-gap/)\n */\n rowGap?: number;\n /**\n * Defines how much equal space to place between both rows and columns represented as a multiplier to the base spacing value in the theme.\n * [gap](https://css-tricks.com/almanac/properties/g/gap/)\n */\n gap?: number;\n}\n\nexport interface FlexItemProps {\n /** [align-self](https://css-tricks.com/almanac/properties/a/align-self/) */\n alignSelf?: 'auto' | 'start' | 'end' | 'baseline' | 'center' | 'stretch';\n /** [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/) */\n grow?: number;\n /** [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/) */\n shrink?: number;\n /** [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/) */\n basis?: string;\n}\n\nexport interface FlexProps extends BaseProps, AsProp {\n /** Content for either a container or item. */\n children?: ReactNode;\n /** Display as flex. Passed as a boolean, only a display flex will be applied. Provide FlexContainer object props to enable flex functionality. */\n container?: FlexContainerProps | boolean;\n /** Use to leverage flex item functionality when rendered as a child of a flex container. Items can be containers as well. */\n item?: FlexItemProps;\n /** Ref for the flex element. */\n ref?: Ref<Element>;\n}\n\nconst prefix = (value: string) => {\n if (['between', 'around', 'evenly'].includes(value)) return `space-${value}`;\n if (['start', 'end'].includes(value)) return `flex-${value}`;\n return value;\n};\n\nconst getContainerStyles = (container: FlexProps['container']) => {\n if (!container) return '';\n\n if (container === true) {\n return css`\n display: flex;\n `;\n }\n\n if (container && typeof container === 'object') {\n const isRow = !container.direction || container.direction.includes('row');\n const isReverse = container.direction && container.direction.includes('reverse');\n\n return css`\n display: ${container.inline ? 'inline-flex' : 'flex'};\n\n ${typeof container.pad !== 'undefined' &&\n css`\n /* stylelint-disable function-name-case, function-whitespace-after */\n padding: ${({\n theme: {\n base: { spacing }\n }\n }) =>\n (Array.isArray(container.pad) ? container.pad : [container.pad])\n .map(p => `calc(${p} * ${spacing})`)\n .join(' ')};\n\n /* stylelint-enable function-name-case, function-whitespace-after */\n `}\n\n ${container.direction &&\n css`\n flex-direction: ${container.direction};\n `}\n\n ${container.justify &&\n css`\n justify-content: ${prefix(container.justify)};\n `}\n\n ${container.wrap &&\n css`\n flex-wrap: ${container.wrap};\n `}\n\n ${container.alignItems &&\n css`\n align-items: ${prefix(container.alignItems)};\n `}\n\n ${container.alignContent &&\n css`\n align-content: ${prefix(container.alignContent)};\n `}\n\n ${container.itemGap &&\n css`\n > * {\n margin-${isRow ? 'inline-start' : 'block-start'}: calc(${container.itemGap} * ${props =>\n props.theme.base.spacing});\n ${isReverse ? ':last-child' : ':first-child'} {\n margin-${isRow ? 'inline-start' : 'block-start'}: 0;\n }\n }\n `}\n\n ${typeof container.gap !== 'undefined' &&\n css`\n gap: calc(${container.gap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof container.colGap !== 'undefined' &&\n css`\n column-gap: calc(${container.colGap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof container.rowGap !== 'undefined' &&\n css`\n row-gap: calc(${container.rowGap} * ${props => props.theme.base.spacing});\n `}\n `;\n }\n};\n\nconst getItemStyles = (item: FlexProps['item']) => {\n return css`\n ${item &&\n css`\n max-width: 100%;\n min-width: 0;\n\n ${item.grow !== undefined &&\n css`\n flex-grow: ${item.grow};\n `}\n\n ${item.shrink !== undefined &&\n css`\n flex-shrink: ${item.shrink};\n `}\n\n ${item.alignSelf &&\n css`\n align-self: ${prefix(item.alignSelf)};\n `}\n\n ${item.basis &&\n css`\n flex-basis: ${item.basis};\n `}\n `}\n `;\n};\n\nexport const StyledFlex = styled.div<FlexProps>(({ container, item }) => {\n return css`\n ${getContainerStyles(container)}\n ${getItemStyles(item)}\n `;\n});\n\nStyledFlex.defaultProps = defaultThemeProp;\n\nconst Flex: FunctionComponent<FlexProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FlexProps>, ref: FlexProps['ref']) => {\n return <StyledFlex {...props} ref={ref} />;\n }\n);\n\nexport default Flex;\n"]}
@@ -9,7 +9,7 @@ export const StyledFormContent = styled.div ``;
9
9
  const Form = forwardRef((props, ref) => {
10
10
  const { children, actions, heading, description, banners, ...restProps } = props;
11
11
  const uid = useUID();
12
- return (_jsxs(Flex, Object.assign({ container: { direction: 'column', gap: 3 }, as: StyledForm, ref: ref }, restProps, { "aria-labelledby": heading ? `${uid}-heading` : undefined, "aria-describedby": description ? `${uid}-description` : undefined }, { children: [banners, (heading || description) && (_jsxs(Flex, Object.assign({ container: { direction: 'column', gap: 1 } }, { children: [heading && (_jsx(Text, Object.assign({ id: `${uid}-heading`, variant: 'h3' }, { children: heading }), void 0)), description && (_jsx(Text, Object.assign({ id: `${uid}-description`, as: 'p' }, { children: description }), void 0))] }), void 0)), _jsx(Flex, Object.assign({ as: StyledFormContent, container: { direction: 'column', gap: 3 } }, { children: children }), void 0), actions && _jsx(Flex, Object.assign({ container: { justify: 'between', alignItems: 'center' } }, { children: actions }), void 0)] }), void 0));
12
+ return (_jsxs(Flex, { container: { direction: 'column', gap: 3 }, as: StyledForm, ref: ref, ...restProps, "aria-labelledby": heading ? `${uid}-heading` : undefined, "aria-describedby": description ? `${uid}-description` : undefined, children: [banners, (heading || description) && (_jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [heading && (_jsx(Text, { id: `${uid}-heading`, variant: 'h3', children: heading }, void 0)), description && (_jsx(Text, { id: `${uid}-description`, as: 'p', children: description }, void 0))] }, void 0)), _jsx(Flex, { as: StyledFormContent, container: { direction: 'column', gap: 3 }, children: children }, void 0), actions && _jsx(Flex, { container: { justify: 'between', alignItems: 'center' }, children: actions }, void 0)] }, void 0));
13
13
  });
14
14
  export default Form;
15
15
  //# sourceMappingURL=Form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuC,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAiB3B,M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,IAAI,KAAC,IAAI,kBAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAG,OAAO,YAAQ,aACtF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, FC, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport { useUID } from '../../hooks';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Flex from '../Flex';\nimport Text from '../Text';\n\nexport interface FormProps extends BaseProps {\n /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */\n children: ReactNode;\n /** Region for Form Actions. */\n actions?: ReactNode;\n /** The heading of the form. */\n heading?: string;\n /** A description of the form to be displayed above the controls. */\n description?: string;\n /** Region for Banners above the Form. */\n banners?: ReactNode;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLFormElement>;\n}\n\nexport const StyledForm = styled.form``;\nexport const StyledFormContent = styled.div``;\n\nconst Form: FC<FormProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormProps>, ref: FormProps['ref']) => {\n const { children, actions, heading, description, banners, ...restProps } = props;\n\n const uid = useUID();\n\n return (\n <Flex\n container={{ direction: 'column', gap: 3 }}\n as={StyledForm}\n ref={ref}\n {...restProps}\n aria-labelledby={heading ? `${uid}-heading` : undefined}\n aria-describedby={description ? `${uid}-description` : undefined}\n >\n {banners}\n {(heading || description) && (\n <Flex container={{ direction: 'column', gap: 1 }}>\n {heading && (\n <Text id={`${uid}-heading`} variant='h3'>\n {heading}\n </Text>\n )}\n {description && (\n <Text id={`${uid}-description`} as='p'>\n {description}\n </Text>\n )}\n </Flex>\n )}\n <Flex as={StyledFormContent} container={{ direction: 'column', gap: 3 }}>\n {children}\n </Flex>\n\n {actions && <Flex container={{ justify: 'between', alignItems: 'center' }}>{actions}</Flex>}\n </Flex>\n );\n }\n);\n\nexport default Form;\n"]}
1
+ {"version":3,"file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WAAW,IAAI,CACd,KAAC,IAAI,IAAC,EAAE,EAAE,GAAG,GAAG,cAAc,EAAE,EAAE,EAAC,GAAG,YACnC,WAAW,WACP,CACR,YACI,CACR,EACD,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,YACpE,QAAQ,WACJ,EAEN,OAAO,IAAI,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAG,OAAO,WAAQ,YACtF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, FC, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport { useUID } from '../../hooks';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Flex from '../Flex';\nimport Text from '../Text';\n\nexport interface FormProps extends BaseProps {\n /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */\n children: ReactNode;\n /** Region for Form Actions. */\n actions?: ReactNode;\n /** The heading of the form. */\n heading?: string;\n /** A description of the form to be displayed above the controls. */\n description?: string;\n /** Region for Banners above the Form. */\n banners?: ReactNode;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLFormElement>;\n}\n\nexport const StyledForm = styled.form``;\nexport const StyledFormContent = styled.div``;\n\nconst Form: FC<FormProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormProps>, ref: FormProps['ref']) => {\n const { children, actions, heading, description, banners, ...restProps } = props;\n\n const uid = useUID();\n\n return (\n <Flex\n container={{ direction: 'column', gap: 3 }}\n as={StyledForm}\n ref={ref}\n {...restProps}\n aria-labelledby={heading ? `${uid}-heading` : undefined}\n aria-describedby={description ? `${uid}-description` : undefined}\n >\n {banners}\n {(heading || description) && (\n <Flex container={{ direction: 'column', gap: 1 }}>\n {heading && (\n <Text id={`${uid}-heading`} variant='h3'>\n {heading}\n </Text>\n )}\n {description && (\n <Text id={`${uid}-description`} as='p'>\n {description}\n </Text>\n )}\n </Flex>\n )}\n <Flex as={StyledFormContent} container={{ direction: 'column', gap: 3 }}>\n {children}\n </Flex>\n\n {actions && <Flex container={{ justify: 'between', alignItems: 'center' }}>{actions}</Flex>}\n </Flex>\n );\n }\n);\n\nexport default Form;\n"]}
@@ -51,7 +51,7 @@ export const StyledFormControl = styled.div(props => {
51
51
  });
52
52
  StyledFormControl.defaultProps = defaultThemeProp;
53
53
  const FormControl = forwardRef((props, ref) => {
54
- return _jsx(StyledFormControl, Object.assign({ ref: ref }, props), void 0);
54
+ return _jsx(StyledFormControl, { ref: ref, ...props }, void 0);
55
55
  });
56
56
  export default FormControl;
57
57
  //# sourceMappingURL=FormControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl.js","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAuCjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAA+B,KAAK,CAAC,EAAE;IAChF,MAAM,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,EAC7F,UAAU,EAAE,EACV,YAAY,EAAE,SAAS,EACvB,cAAc,EAAE,EACd,kBAAkB,EAAE,UAAU,EAC9B,kBAAkB,EAAE,UAAU,EAC9B,cAAc,EAAE,GAAG,EACnB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,WAAW,EAC3B,QAAQ,EAAE,EAAE,cAAc,EAAE,gBAAgB,EAAE,EAC9C,QAAQ,EAAE,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,EACpE,WAAW,EAAE,EACX,cAAc,EAAE,mBAAmB,EACnC,kBAAkB,EAAE,uBAAuB,EAC5C,EACD,YAAY,EAAE,EACZ,cAAc,EAAE,mBAAmB,EACnC,kBAAkB,EAAE,uBAAuB,EAC5C,EACF,EACF,EACF,EACD,MAAM,EACP,GAAG,KAAK,CAAC;IACV,MAAM,QAAQ,GAAG,iBAAiB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAEhE,MAAM,WAAW,GAAG,MAAM,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAE1F,OAAO,GAAG,CAAA;aACC,UAAU;wBACC,UAAU;0BACR,UAAU,MAAM,MAAM;oBAC5B,WAAW;oBACX,WAAW;;;;;;;;;0BASL,uBAAuB;sBAC3B,mBAAmB;;;;;sBAKnB,gBAAgB;oBAClB,MAAM;;;MAGpB,CAAC,MAAM;QACT,GAAG,CAAA;;wBAEiB,gBAAgB;;KAEnC;;;0BAGqB,uBAAuB;sBAC3B,mBAAmB;;;;;uBAKlB,QAAQ,CAAC,CAAC;;GAE9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,WAAW,GAAuD,UAAU,CAChF,CAAC,KAAwC,EAAE,GAAwB,EAAE,EAAE;IACrE,OAAO,KAAC,iBAAiB,kBAAC,GAAG,EAAE,GAAG,IAAM,KAAK,UAAI,CAAC;AACpD,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\n\nexport interface FormControlProps extends BaseProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: string;\n /** Set visual state based on a validation state. */\n status?: 'success' | 'warning' | 'error';\n /** Pass a string or a fragment with an Icon and string. */\n label?: ReactNode;\n /** Visually hides the label region. */\n labelHidden?: boolean;\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: ReactNode;\n /** Indicate if the field is required. The browser defaults to false. */\n required?: boolean;\n /** Placeholder text. The browser defaults to an empty string. */\n placeholder?: string;\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: string;\n /**\n * If you wish to use an [uncontrolled input](https://reactjs.org/docs/uncontrolled-components.html), pass a defaultValue prop and a ref to access the input's native value prop or by other DOM ref means.\n */\n defaultValue?: string;\n /** Disable the control. The browser defaults to false. */\n disabled?: boolean;\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: boolean;\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: string;\n}\n\ntype FormControlPropsWithDefaults = PropsWithDefaults<FormControlProps>;\n\nexport const StyledFormControl = styled.div<FormControlPropsWithDefaults>(props => {\n const {\n theme: {\n base: { 'border-radius': baseRadius, 'font-size': baseFontSize, 'font-scale': baseFontScale },\n components: {\n 'form-field': formField,\n 'form-control': {\n 'foreground-color': foreground,\n 'background-color': background,\n 'border-color': brd,\n 'border-radius': radius,\n 'border-width': borderWidth,\n ':hover': { 'border-color': hoverBorderColor },\n ':focus': { 'border-color': focusBorderColor, 'box-shadow': shadow },\n ':disabled': {\n 'border-color': disabledBorderColor,\n 'background-color': disabledBackgroundColor\n },\n ':read-only': {\n 'border-color': readOnlyBorderColor,\n 'background-color': readOnlyBackgroundColor\n }\n }\n }\n },\n status\n } = props;\n const fontSize = calculateFontSize(baseFontSize, baseFontScale);\n\n const borderColor = status && formField[status] ? formField[status]['status-color'] : brd;\n\n return css`\n color: ${foreground};\n background-color: ${background};\n border-radius: calc(${baseRadius} * ${radius});\n border-color: ${borderColor};\n border-width: ${borderWidth};\n border-style: solid;\n &,\n & > select {\n outline: none;\n }\n\n &:disabled,\n &[disabled] {\n background-color: ${disabledBackgroundColor};\n border-color: ${disabledBorderColor};\n cursor: not-allowed;\n }\n\n &:focus:not([disabled]) {\n border-color: ${focusBorderColor};\n box-shadow: ${shadow};\n }\n\n ${!status &&\n css`\n &:hover:not([readonly]):not([disabled]):not(:focus) {\n border-color: ${hoverBorderColor};\n }\n `}\n\n &[readonly] {\n background-color: ${readOnlyBackgroundColor};\n border-color: ${readOnlyBorderColor};\n }\n\n @media (pointer: coarse) {\n /* stylelint-disable-next-line unit-allowed-list */\n font-size: max(${fontSize.s}, 16px);\n }\n `;\n});\n\nStyledFormControl.defaultProps = defaultThemeProp;\n\nconst FormControl: FunctionComponent<FormControlProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormControlProps>, ref: Ref<HTMLDivElement>) => {\n return <StyledFormControl ref={ref} {...props} />;\n }\n);\n\nexport default FormControl;\n"]}
1
+ {"version":3,"file":"FormControl.js","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAuCjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAA+B,KAAK,CAAC,EAAE;IAChF,MAAM,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EA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E,EAAE;IACrE,OAAO,KAAC,iBAAiB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,WAAI,CAAC;AACpD,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\n\nexport interface FormControlProps extends BaseProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: string;\n /** Set visual state based on a validation state. */\n status?: 'success' | 'warning' | 'error';\n /** Pass a string or a fragment with an Icon and string. */\n label?: ReactNode;\n /** Visually hides the label region. */\n labelHidden?: boolean;\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: ReactNode;\n /** Indicate if the field is required. The browser defaults to false. */\n required?: boolean;\n /** Placeholder text. The browser defaults to an empty string. */\n placeholder?: string;\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: string;\n /**\n * If you wish to use an [uncontrolled input](https://reactjs.org/docs/uncontrolled-components.html), pass a defaultValue prop and a ref to access the input's native value prop or by other DOM ref means.\n */\n defaultValue?: string;\n /** Disable the control. The browser defaults to false. */\n disabled?: boolean;\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: boolean;\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: string;\n}\n\ntype FormControlPropsWithDefaults = PropsWithDefaults<FormControlProps>;\n\nexport const StyledFormControl = styled.div<FormControlPropsWithDefaults>(props => {\n const {\n theme: {\n base: { 'border-radius': baseRadius, 'font-size': baseFontSize, 'font-scale': baseFontScale },\n components: {\n 'form-field': formField,\n 'form-control': {\n 'foreground-color': foreground,\n 'background-color': background,\n 'border-color': brd,\n 'border-radius': radius,\n 'border-width': borderWidth,\n ':hover': { 'border-color': hoverBorderColor },\n ':focus': { 'border-color': focusBorderColor, 'box-shadow': shadow },\n ':disabled': {\n 'border-color': disabledBorderColor,\n 'background-color': disabledBackgroundColor\n },\n ':read-only': {\n 'border-color': readOnlyBorderColor,\n 'background-color': readOnlyBackgroundColor\n }\n }\n }\n },\n status\n } = props;\n const fontSize = calculateFontSize(baseFontSize, baseFontScale);\n\n const borderColor = status && formField[status] ? formField[status]['status-color'] : brd;\n\n return css`\n color: ${foreground};\n background-color: ${background};\n border-radius: calc(${baseRadius} * ${radius});\n border-color: ${borderColor};\n border-width: ${borderWidth};\n border-style: solid;\n &,\n & > select {\n outline: none;\n }\n\n &:disabled,\n &[disabled] {\n background-color: ${disabledBackgroundColor};\n border-color: ${disabledBorderColor};\n cursor: not-allowed;\n }\n\n &:focus:not([disabled]) {\n border-color: ${focusBorderColor};\n box-shadow: ${shadow};\n }\n\n ${!status &&\n css`\n &:hover:not([readonly]):not([disabled]):not(:focus) {\n border-color: ${hoverBorderColor};\n }\n `}\n\n &[readonly] {\n background-color: ${readOnlyBackgroundColor};\n border-color: ${readOnlyBorderColor};\n }\n\n @media (pointer: coarse) {\n /* stylelint-disable-next-line unit-allowed-list */\n font-size: max(${fontSize.s}, 16px);\n }\n `;\n});\n\nStyledFormControl.defaultProps = defaultThemeProp;\n\nconst FormControl: FunctionComponent<FormControlProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormControlProps>, ref: Ref<HTMLDivElement>) => {\n return <StyledFormControl ref={ref} {...props} />;\n }\n);\n\nexport default FormControl;\n"]}
@@ -67,10 +67,10 @@ const FormField = forwardRef((props, ref) => {
67
67
  const uid = useUID();
68
68
  const { children: controlElement, id = uid, as = 'div', label, labelAs = 'label', labelHidden = false, labelAfter = false, info, status, charLimitDisplay, required = false, disabled = false, readOnly = false, inline = false, actions, container, ...restProps } = props;
69
69
  const labelAsLegend = labelAs === 'legend';
70
- const styledLabel = (_jsxs(Label, Object.assign({ as: labelAs, htmlFor: labelAs === 'label' ? id : undefined, labelHidden: labelHidden, onClick: (e) => {
70
+ const styledLabel = (_jsxs(Label, { as: labelAs, htmlFor: labelAs === 'label' ? id : undefined, labelHidden: labelHidden, onClick: (e) => {
71
71
  if (readOnly)
72
72
  e.preventDefault();
73
- }, inline: inline }, { children: [status && !labelHidden && (_jsx(StyledStatusIcon, { status: status, name: statusIconMap[status] }, void 0)), label] }), void 0));
73
+ }, inline: inline, children: [status && !labelHidden && (_jsx(StyledStatusIcon, { status: status, name: statusIconMap[status] }, void 0)), label] }, void 0));
74
74
  /*
75
75
  We have to use an internal state and an effect to set the text value of info after the DOM element is rendered.
76
76
  This is to ensure screen readers will announce info on errors when role is set to alert.
@@ -91,7 +91,7 @@ const FormField = forwardRef((props, ref) => {
91
91
  'aria-describedby': info && `${id}-info`
92
92
  });
93
93
  if (actions) {
94
- content = (_jsxs(Flex, Object.assign({ container: { alignItems: 'center', gap: 0.5 } }, { children: [content, _jsx(Actions, { items: actions, menuAt: 3 }, void 0)] }), void 0));
94
+ content = (_jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, children: [content, _jsx(Actions, { items: actions, menuAt: 3 }, void 0)] }, void 0));
95
95
  }
96
96
  let infoContent = info ? (
97
97
  /*
@@ -99,15 +99,15 @@ const FormField = forwardRef((props, ref) => {
99
99
  Withholding aria-live="assertive" to avoid iOS issue. See below.
100
100
  https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles
101
101
  */
102
- _jsx(StyledFormFieldInfo, Object.assign({ status: status, role: status === 'error' || status === 'warning' ? 'alert' : undefined, id: `${id}-info` }, { children: liveRegionInfo }), void 0)) : undefined;
102
+ _jsx(StyledFormFieldInfo, { status: status, role: status === 'error' || status === 'warning' ? 'alert' : undefined, id: `${id}-info`, children: liveRegionInfo }, void 0)) : undefined;
103
103
  if (charLimitDisplay) {
104
- infoContent = (_jsxs(Flex, Object.assign({ container: { justify: infoContent ? 'between' : 'end', gap: 1 } }, { children: [infoContent, _jsx(Flex, Object.assign({ item: { shrink: 0 } }, { children: charLimitDisplay }), void 0)] }), void 0));
104
+ infoContent = (_jsxs(Flex, { container: { justify: infoContent ? 'between' : 'end', gap: 1 }, children: [infoContent, _jsx(Flex, { item: { shrink: 0 }, children: charLimitDisplay }, void 0)] }, void 0));
105
105
  }
106
- return (_jsxs(Flex, Object.assign({}, restProps, { container: {
106
+ return (_jsxs(Flex, { ...restProps, container: {
107
107
  direction: inline ? 'row' : 'column',
108
108
  alignItems: inline ? 'center' : undefined,
109
109
  ...container
110
- }, as: StyledFormField, id: `${id}-field`, forwardedAs: as, required: required, disabled: disabled, readOnly: readOnly, "aria-describedby": labelAsLegend && info ? `${id}-info` : undefined, ref: ref }, { children: [(labelAsLegend || !labelAfter) && styledLabel, content, !labelAsLegend && labelAfter && styledLabel, infoContent] }), void 0));
110
+ }, as: StyledFormField, id: `${id}-field`, forwardedAs: as, required: required, disabled: disabled, readOnly: readOnly, "aria-describedby": labelAsLegend && info ? `${id}-info` : undefined, ref: ref, children: [(labelAsLegend || !labelAfter) && styledLabel, content, !labelAsLegend && labelAfter && styledLabel, infoContent] }, void 0));
111
111
  });
112
112
  export default FormField;
113
113
  //# sourceMappingURL=FormField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,YAAY,EAEZ,SAAS,EACT,QAAQ,EAER,UAAU,EAEX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE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Z,MAAC,IAAI,kBAAC,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,iBAClE,WAAW,EACZ,KAAC,IAAI,kBAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,gBAAG,gBAAgB,YAAQ,aAC/C,CACR,CAAC;KACH;IAED,OAAO,CACL,MAAC,IAAI,oBACC,SAAS,IACb,SAAS,EAAE;YACT,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;YACpC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACzC,GAAG,SAAS;SACb,EACD,EAAE,EAAE,eAAe,EACnB,EAAE,EAAE,GAAG,EAAE,QAAQ,EACjB,WAAW,EAAE,EAAE,EACf,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,sBACA,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,EAClE,GAAG,EAAE,GAAG,iBAEP,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,IAAI,WAAW,EAC7C,OAAO,EACP,CAAC,aAAa,IAAI,UAAU,IAAI,WAAW,EAC3C,WAAW,aACP,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FC,\n ReactNode,\n ComponentType,\n cloneElement,\n ReactElement,\n useEffect,\n useState,\n PropsWithoutRef,\n forwardRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { Action, ForwardProps, OmitStrict } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport { FormControlProps } from '../FormControl';\nimport { useUID } from '../../hooks';\nimport Label, { LabelProps, StyledLabel } from '../Label';\nimport { calculateFontSize } from '../../styles';\nimport Icon from '../Icon';\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'> {\n /** Pass a single form control component i.e. Input | TextArea | Select | etc.. */\n children: ReactElement | ReactElement[];\n /**\n * An id is required to connect a FormField's wrapping element, control element and info(aria-describedby) live region.\n * A random id will be generated if none is provided.\n * Since MOST FormControls should possess an id(excl. i.e RadioCheckGroup and others) this can be used.\n * The id prop will be used to generate the following:\n * - FormControl <-> Label association via a Label's htmlFor prop.\n * - FormField's wrapping element id {id}-field.\n * - FormField info element id ${id}-info.\n */\n id?: string;\n /**\n * Determines how the wrapping label should be rendered.\n * @default \"label\"\n */\n labelAs?: LabelProps['as'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Visually places the label after the input.\n * @default false\n */\n labelAfter?: boolean;\n /**\n * Wrapping HTML element tag. Renders as a fieldset for grouped elements i.e. RadioButtons/CheckboxGroup\n * @default \"div\"\n */\n as?: 'div' | 'fieldset' | ComponentType<any>;\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: boolean;\n /** Optionally utilized by Input or Select. */\n actions?: Action[];\n /** Enables Flex container prop pass through. */\n container?: Exclude<FlexProps['container'], boolean>;\n /** Character remaining count. Typically used on Textareas only */\n charLimitDisplay?: ReactNode;\n}\n\nconst StyledStatusIcon = styled(Icon)<{ status: NonNullable<FormFieldProps['status']> }>(\n ({ theme, status }) => {\n return css`\n height: 1em;\n width: 1em;\n color: ${theme.components['form-field'][status]['status-color']};\n vertical-align: baseline;\n margin-inline-end: 0.5ch;\n `;\n }\n);\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFormFieldInfo = styled.div<Pick<FormControlProps, 'status'>>(\n ({\n status,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { 'form-field': formField }\n }\n }) => {\n const { xxs: infoFontSize } = calculateFontSize(fontSize, fontScale);\n\n return css`\n max-width: max-content;\n margin-top: calc(0.25 * ${spacing});\n font-size: ${infoFontSize};\n word-break: break-word;\n ${status &&\n formField[status] &&\n css`\n color: ${formField[status]['status-color']};\n `}\n `;\n }\n);\n\nStyledFormFieldInfo.defaultProps = defaultThemeProp;\n\nexport const StyledFormField = styled.div<FormFieldProps>(props => {\n const {\n disabled,\n required,\n theme: {\n base: {\n palette: { urgent },\n 'disabled-opacity': disabledOpacity,\n spacing\n }\n }\n } = props;\n\n return css`\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n -webkit-user-select: none;\n user-select: none;\n `}\n position: relative;\n border: 0;\n\n > ${StyledLabel} {\n margin-bottom: calc(0.25 * ${spacing});\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n }\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\n\nconst statusIconMap = { error: 'warn-solid', warning: 'warn', success: 'check' };\n\nconst FormField: FC<FormFieldProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormFieldProps>, ref: Ref<HTMLElement>) => {\n const uid = useUID();\n const {\n children: controlElement,\n id = uid,\n as = 'div',\n label,\n labelAs = 'label',\n labelHidden = false,\n labelAfter = false,\n info,\n status,\n charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = false,\n actions,\n container,\n ...restProps\n } = props;\n\n const labelAsLegend: boolean = labelAs === 'legend';\n\n const styledLabel = (\n <Label\n as={labelAs}\n htmlFor={labelAs === 'label' ? id : undefined}\n labelHidden={labelHidden}\n onClick={(e: MouseEvent) => {\n if (readOnly) e.preventDefault();\n }}\n inline={inline}\n >\n {status && !labelHidden && (\n <StyledStatusIcon status={status} name={statusIconMap[status]} />\n )}\n {label}\n </Label>\n );\n\n /*\n We have to use an internal state and an effect to set the text value of info after the DOM element is rendered.\n This is to ensure screen readers will announce info on errors when role is set to alert.\n Needs testing to confirm. Currently the expected sequence would be:\n - FormField renders with no error and no info\n - user input triggers an error status\n - props passed set error status and provide info text\n - effect runs and sets live region state which renders and is announced\n */\n const [liveRegionInfo, setLiveRegionInfo] = useState<ReactNode>(null);\n\n useEffect(() => {\n setLiveRegionInfo(info);\n }, [info]);\n\n // fieldset or single form control element\n let content: FormFieldProps['children'] = labelAsLegend\n ? controlElement\n : cloneElement(controlElement as ReactElement, {\n 'aria-describedby': info && `${id}-info`\n });\n\n if (actions) {\n content = (\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {content}\n <Actions items={actions} menuAt={3} />\n </Flex>\n );\n }\n\n let infoContent = info ? (\n /*\n Region for additional info, help or error message.\n Withholding aria-live=\"assertive\" to avoid iOS issue. See below.\n https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles\n */\n <StyledFormFieldInfo\n status={status}\n role={status === 'error' || status === 'warning' ? 'alert' : undefined}\n id={`${id}-info`}\n >\n {liveRegionInfo}\n </StyledFormFieldInfo>\n ) : undefined;\n\n if (charLimitDisplay) {\n infoContent = (\n <Flex container={{ justify: infoContent ? 'between' : 'end', gap: 1 }}>\n {infoContent}\n <Flex item={{ shrink: 0 }}>{charLimitDisplay}</Flex>\n </Flex>\n );\n }\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: inline ? 'row' : 'column',\n alignItems: inline ? 'center' : undefined,\n ...container\n }}\n as={StyledFormField}\n id={`${id}-field`}\n forwardedAs={as}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n aria-describedby={labelAsLegend && info ? `${id}-info` : undefined}\n ref={ref}\n >\n {(labelAsLegend || !labelAfter) && styledLabel}\n {content}\n {!labelAsLegend && labelAfter && styledLabel}\n {infoContent}\n </Flex>\n );\n }\n);\n\nexport default FormField;\n"]}
1
+ {"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":";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,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FC,\n ReactNode,\n ComponentType,\n cloneElement,\n ReactElement,\n useEffect,\n useState,\n PropsWithoutRef,\n forwardRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { Action, ForwardProps, OmitStrict } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport { FormControlProps } from '../FormControl';\nimport { useUID } from '../../hooks';\nimport Label, { LabelProps, StyledLabel } from '../Label';\nimport { calculateFontSize } from '../../styles';\nimport Icon from '../Icon';\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'> {\n /** Pass a single form control component i.e. Input | TextArea | Select | etc.. */\n children: ReactElement | ReactElement[];\n /**\n * An id is required to connect a FormField's wrapping element, control element and info(aria-describedby) live region.\n * A random id will be generated if none is provided.\n * Since MOST FormControls should possess an id(excl. i.e RadioCheckGroup and others) this can be used.\n * The id prop will be used to generate the following:\n * - FormControl <-> Label association via a Label's htmlFor prop.\n * - FormField's wrapping element id {id}-field.\n * - FormField info element id ${id}-info.\n */\n id?: string;\n /**\n * Determines how the wrapping label should be rendered.\n * @default \"label\"\n */\n labelAs?: LabelProps['as'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Visually places the label after the input.\n * @default false\n */\n labelAfter?: boolean;\n /**\n * Wrapping HTML element tag. Renders as a fieldset for grouped elements i.e. RadioButtons/CheckboxGroup\n * @default \"div\"\n */\n as?: 'div' | 'fieldset' | ComponentType<any>;\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: boolean;\n /** Optionally utilized by Input or Select. */\n actions?: Action[];\n /** Enables Flex container prop pass through. */\n container?: Exclude<FlexProps['container'], boolean>;\n /** Character remaining count. Typically used on Textareas only */\n charLimitDisplay?: ReactNode;\n}\n\nconst StyledStatusIcon = styled(Icon)<{ status: NonNullable<FormFieldProps['status']> }>(\n ({ theme, status }) => {\n return css`\n height: 1em;\n width: 1em;\n color: ${theme.components['form-field'][status]['status-color']};\n vertical-align: baseline;\n margin-inline-end: 0.5ch;\n `;\n }\n);\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFormFieldInfo = styled.div<Pick<FormControlProps, 'status'>>(\n ({\n status,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { 'form-field': formField }\n }\n }) => {\n const { xxs: infoFontSize } = calculateFontSize(fontSize, fontScale);\n\n return css`\n max-width: max-content;\n margin-top: calc(0.25 * ${spacing});\n font-size: ${infoFontSize};\n word-break: break-word;\n ${status &&\n formField[status] &&\n css`\n color: ${formField[status]['status-color']};\n `}\n `;\n }\n);\n\nStyledFormFieldInfo.defaultProps = defaultThemeProp;\n\nexport const StyledFormField = styled.div<FormFieldProps>(props => {\n const {\n disabled,\n required,\n theme: {\n base: {\n palette: { urgent },\n 'disabled-opacity': disabledOpacity,\n spacing\n }\n }\n } = props;\n\n return css`\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n -webkit-user-select: none;\n user-select: none;\n `}\n position: relative;\n border: 0;\n\n > ${StyledLabel} {\n margin-bottom: calc(0.25 * ${spacing});\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n }\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\n\nconst statusIconMap = { error: 'warn-solid', warning: 'warn', success: 'check' };\n\nconst FormField: FC<FormFieldProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormFieldProps>, ref: Ref<HTMLElement>) => {\n const uid = useUID();\n const {\n children: controlElement,\n id = uid,\n as = 'div',\n label,\n labelAs = 'label',\n labelHidden = false,\n labelAfter = false,\n info,\n status,\n charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = false,\n actions,\n container,\n ...restProps\n } = props;\n\n const labelAsLegend: boolean = labelAs === 'legend';\n\n const styledLabel = (\n <Label\n as={labelAs}\n htmlFor={labelAs === 'label' ? id : undefined}\n labelHidden={labelHidden}\n onClick={(e: MouseEvent) => {\n if (readOnly) e.preventDefault();\n }}\n inline={inline}\n >\n {status && !labelHidden && (\n <StyledStatusIcon status={status} name={statusIconMap[status]} />\n )}\n {label}\n </Label>\n );\n\n /*\n We have to use an internal state and an effect to set the text value of info after the DOM element is rendered.\n This is to ensure screen readers will announce info on errors when role is set to alert.\n Needs testing to confirm. Currently the expected sequence would be:\n - FormField renders with no error and no info\n - user input triggers an error status\n - props passed set error status and provide info text\n - effect runs and sets live region state which renders and is announced\n */\n const [liveRegionInfo, setLiveRegionInfo] = useState<ReactNode>(null);\n\n useEffect(() => {\n setLiveRegionInfo(info);\n }, [info]);\n\n // fieldset or single form control element\n let content: FormFieldProps['children'] = labelAsLegend\n ? controlElement\n : cloneElement(controlElement as ReactElement, {\n 'aria-describedby': info && `${id}-info`\n });\n\n if (actions) {\n content = (\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {content}\n <Actions items={actions} menuAt={3} />\n </Flex>\n );\n }\n\n let infoContent = info ? (\n /*\n Region for additional info, help or error message.\n Withholding aria-live=\"assertive\" to avoid iOS issue. See below.\n https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles\n */\n <StyledFormFieldInfo\n status={status}\n role={status === 'error' || status === 'warning' ? 'alert' : undefined}\n id={`${id}-info`}\n >\n {liveRegionInfo}\n </StyledFormFieldInfo>\n ) : undefined;\n\n if (charLimitDisplay) {\n infoContent = (\n <Flex container={{ justify: infoContent ? 'between' : 'end', gap: 1 }}>\n {infoContent}\n <Flex item={{ shrink: 0 }}>{charLimitDisplay}</Flex>\n </Flex>\n );\n }\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: inline ? 'row' : 'column',\n alignItems: inline ? 'center' : undefined,\n ...container\n }}\n as={StyledFormField}\n id={`${id}-field`}\n forwardedAs={as}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n aria-describedby={labelAsLegend && info ? `${id}-info` : undefined}\n ref={ref}\n >\n {(labelAsLegend || !labelAfter) && styledLabel}\n {content}\n {!labelAsLegend && labelAfter && styledLabel}\n {infoContent}\n </Flex>\n );\n }\n);\n\nexport default FormField;\n"]}
@@ -174,7 +174,7 @@ export const StyledGrid = styled.div(props => {
174
174
  });
175
175
  StyledGrid.defaultProps = defaultThemeProp;
176
176
  const Grid = forwardRef((props, ref) => {
177
- return _jsx(StyledGrid, Object.assign({}, props, { ref: ref }), void 0);
177
+ return _jsx(StyledGrid, { ...props, ref: ref }, void 0);
178
178
  });
179
179
  export default Grid;
180
180
  //# sourceMappingURL=Grid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI/C,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;IAC/B,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,KAAK,EAAE,CAAC;IAC7E,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,SAAiC,EAAE,EAAE;IAC/D,IAAI,CAAC,SAAS;QAAE,OAAO;IAEvB,IAAI,SAAS,KAAK,IAAI,EAAE;QACtB,OAAO,GAAG,CAAA;;KAET,CAAC;KACH;IAED,MAAM,EACJ,MAAM,EACN,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,QA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MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAA+B,KAAK,CAAC,EAAE;IACzE,MAAM,EACJ,SAAS,EACT,IAAI,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE,EACxC,EACD,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACH,GAAG,KAAK,CAAC;IAEV,MAAM,WAAW,GAAG;QAClB,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;KACH,CAAC;IAEF,OAAO,GAAG,CAAA;MACN,kBAAkB,CAAC,SAAS,CAAC;MAC7B,aAAa,CAAC,IAAI,CAAC;;MAEnB,eAAe,CAAC,GAAG,CACnB,UAAU,CAAC,EAAE,CACX,WAAW,CAAC,UAAU,CAAC;QACvB,GAAG,CAAA;0CAC+B,gBAAgB,CAAC,UAAU,CAAC;cACxD,kBAAkB,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC;cACtD,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC;;SAEjD,CACJ;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAgD,UAAU,CAClE,CAAC,KAAiC,EAAE,GAAqB,EAAE,EAAE;IAC3D,OAAO,KAAC,UAAU,oBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,YAAI,CAAC;AAC7C,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nimport GridProps from './Grid.types';\n\nconst prefix = (value: string) => {\n if (['between', 'around', 'evenly'].includes(value)) return `space-${value}`;\n return value;\n};\n\nconst getContainerStyles = (gridProps: GridProps['container']) => {\n if (!gridProps) return;\n\n if (gridProps === true) {\n return css`\n display: grid;\n `;\n }\n\n const {\n inline,\n pad,\n cols,\n autoCols,\n rows,\n autoRows,\n autoFlow,\n areas,\n template,\n colGap,\n rowGap,\n gap,\n justifyItems,\n justifyContent,\n alignItems,\n alignContent\n } = gridProps;\n\n return css`\n display: ${inline ? 'inline-grid' : 'grid'};\n\n ${typeof pad !== 'undefined' &&\n css`\n /* stylelint-disable function-name-case, function-whitespace-after */\n padding: ${({\n theme: {\n base: { spacing }\n }\n }) => (Array.isArray(pad) ? pad : [pad]).map(p => `calc(${p} * ${spacing})`).join(' ')};\n\n /* stylelint-enable function-name-case, function-whitespace-after */\n `}\n\n ${cols &&\n css`\n grid-template-columns: ${cols};\n `}\n\n ${autoCols &&\n css`\n grid-auto-columns: ${autoCols};\n `}\n\n ${rows &&\n css`\n grid-template-rows: ${rows};\n `}\n\n ${autoRows &&\n css`\n grid-auto-rows: ${autoRows};\n `}\n\n ${autoFlow &&\n css`\n grid-auto-flow: ${autoFlow};\n `}\n\n ${areas &&\n css`\n grid-template-areas: ${areas};\n `}\n\n ${template &&\n css`\n grid-template: ${template};\n `}\n\n ${typeof gap !== 'undefined' &&\n css`\n gap: calc(${gap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof colGap !== 'undefined' &&\n css`\n column-gap: calc(${colGap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof rowGap !== 'undefined' &&\n css`\n row-gap: calc(${rowGap} * ${props => props.theme.base.spacing});\n `}\n\n ${justifyItems &&\n css`\n justify-items: ${justifyItems};\n `}\n\n ${justifyContent &&\n css`\n justify-content: ${prefix(justifyContent)};\n `}\n\n ${alignItems &&\n css`\n align-items: ${alignItems};\n `}\n\n ${alignContent &&\n css`\n align-content: ${prefix(alignContent)};\n `}\n `;\n};\n\nconst getItemStyles = (props: GridProps['item']) => {\n if (!props) return;\n\n const {\n colStart,\n colEnd,\n colStartEnd,\n rowStart,\n rowEnd,\n rowStartEnd,\n area,\n justifySelf,\n alignSelf\n } = props;\n\n return css`\n ${colStart &&\n css`\n grid-column-start: ${colStart};\n `}\n\n ${colEnd &&\n css`\n grid-column-end: ${colEnd};\n `}\n\n ${colStartEnd &&\n css`\n grid-column: ${colStartEnd};\n `}\n\n ${rowStart &&\n css`\n grid-row-start: ${rowStart};\n `}\n\n ${rowEnd &&\n css`\n grid-row-end: ${rowEnd};\n `}\n\n ${rowStartEnd &&\n css`\n grid-row: ${rowStartEnd};\n `}\n\n ${area &&\n css`\n grid-area: ${area};\n `}\n\n ${justifySelf &&\n css`\n justify-self: ${justifySelf};\n `}\n\n ${alignSelf &&\n css`\n align-self: ${alignSelf};\n `}\n `;\n};\n\nconst breakpointOrder = ['xs', 'sm', 'md', 'lg', 'xl'] as const;\n\nexport const StyledGrid = styled.div<PropsWithDefaults<GridProps>>(props => {\n const {\n container,\n item,\n theme: {\n base: { breakpoints: themeBreakpoints }\n },\n xs,\n sm,\n md,\n lg,\n xl\n } = props;\n\n const breakpoints = {\n xs,\n sm,\n md,\n lg,\n xl\n };\n\n return css`\n ${getContainerStyles(container)}\n ${getItemStyles(item)}\n\n ${breakpointOrder.map(\n breakpoint =>\n breakpoints[breakpoint] &&\n css`\n @media screen and (min-width: ${themeBreakpoints[breakpoint]}) {\n ${getContainerStyles(breakpoints[breakpoint]?.container)}\n ${getItemStyles(breakpoints[breakpoint]?.item)}\n }\n `\n )}\n `;\n});\n\nStyledGrid.defaultProps = defaultThemeProp;\n\nconst Grid: FunctionComponent<GridProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<GridProps>, ref: GridProps['ref']) => {\n return <StyledGrid {...props} ref={ref} />;\n }\n);\n\nexport default Grid;\n"]}
1
+ {"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,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AEjD,CACJ;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAgD,UAAU,CAClE,CAAC,KAAiC,EAAE,GAAqB,EAAE,EAAE;IAC3D,OAAO,KAAC,UAAU,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,WAAI,CAAC;AAC7C,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nimport GridProps from './Grid.types';\n\nconst prefix = (value: string) => {\n if (['between', 'around', 'evenly'].includes(value)) return `space-${value}`;\n return value;\n};\n\nconst getContainerStyles = (gridProps: GridProps['container']) => {\n if (!gridProps) return;\n\n if (gridProps === true) {\n return css`\n display: grid;\n `;\n }\n\n const {\n inline,\n pad,\n cols,\n autoCols,\n rows,\n autoRows,\n autoFlow,\n areas,\n template,\n colGap,\n rowGap,\n gap,\n justifyItems,\n justifyContent,\n alignItems,\n alignContent\n } = gridProps;\n\n return css`\n display: ${inline ? 'inline-grid' : 'grid'};\n\n ${typeof pad !== 'undefined' &&\n css`\n /* stylelint-disable function-name-case, function-whitespace-after */\n padding: ${({\n theme: {\n base: { spacing }\n }\n }) => (Array.isArray(pad) ? pad : [pad]).map(p => `calc(${p} * ${spacing})`).join(' ')};\n\n /* stylelint-enable function-name-case, function-whitespace-after */\n `}\n\n ${cols &&\n css`\n grid-template-columns: ${cols};\n `}\n\n ${autoCols &&\n css`\n grid-auto-columns: ${autoCols};\n `}\n\n ${rows &&\n css`\n grid-template-rows: ${rows};\n `}\n\n ${autoRows &&\n css`\n grid-auto-rows: ${autoRows};\n `}\n\n ${autoFlow &&\n css`\n grid-auto-flow: ${autoFlow};\n `}\n\n ${areas &&\n css`\n grid-template-areas: ${areas};\n `}\n\n ${template &&\n css`\n grid-template: ${template};\n `}\n\n ${typeof gap !== 'undefined' &&\n css`\n gap: calc(${gap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof colGap !== 'undefined' &&\n css`\n column-gap: calc(${colGap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof rowGap !== 'undefined' &&\n css`\n row-gap: calc(${rowGap} * ${props => props.theme.base.spacing});\n `}\n\n ${justifyItems &&\n css`\n justify-items: ${justifyItems};\n `}\n\n ${justifyContent &&\n css`\n justify-content: ${prefix(justifyContent)};\n `}\n\n ${alignItems &&\n css`\n align-items: ${alignItems};\n `}\n\n ${alignContent &&\n css`\n align-content: ${prefix(alignContent)};\n `}\n `;\n};\n\nconst getItemStyles = (props: GridProps['item']) => {\n if (!props) return;\n\n const {\n colStart,\n colEnd,\n colStartEnd,\n rowStart,\n rowEnd,\n rowStartEnd,\n area,\n justifySelf,\n alignSelf\n } = props;\n\n return css`\n ${colStart &&\n css`\n grid-column-start: ${colStart};\n `}\n\n ${colEnd &&\n css`\n grid-column-end: ${colEnd};\n `}\n\n ${colStartEnd &&\n css`\n grid-column: ${colStartEnd};\n `}\n\n ${rowStart &&\n css`\n grid-row-start: ${rowStart};\n `}\n\n ${rowEnd &&\n css`\n grid-row-end: ${rowEnd};\n `}\n\n ${rowStartEnd &&\n css`\n grid-row: ${rowStartEnd};\n `}\n\n ${area &&\n css`\n grid-area: ${area};\n `}\n\n ${justifySelf &&\n css`\n justify-self: ${justifySelf};\n `}\n\n ${alignSelf &&\n css`\n align-self: ${alignSelf};\n `}\n `;\n};\n\nconst breakpointOrder = ['xs', 'sm', 'md', 'lg', 'xl'] as const;\n\nexport const StyledGrid = styled.div<PropsWithDefaults<GridProps>>(props => {\n const {\n container,\n item,\n theme: {\n base: { breakpoints: themeBreakpoints }\n },\n xs,\n sm,\n md,\n lg,\n xl\n } = props;\n\n const breakpoints = {\n xs,\n sm,\n md,\n lg,\n xl\n };\n\n return css`\n ${getContainerStyles(container)}\n ${getItemStyles(item)}\n\n ${breakpointOrder.map(\n breakpoint =>\n breakpoints[breakpoint] &&\n css`\n @media screen and (min-width: ${themeBreakpoints[breakpoint]}) {\n ${getContainerStyles(breakpoints[breakpoint]?.container)}\n ${getItemStyles(breakpoints[breakpoint]?.item)}\n }\n `\n )}\n `;\n});\n\nStyledGrid.defaultProps = defaultThemeProp;\n\nconst Grid: FunctionComponent<GridProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<GridProps>, ref: GridProps['ref']) => {\n return <StyledGrid {...props} ref={ref} />;\n }\n);\n\nexport default Grid;\n"]}
@@ -45,7 +45,7 @@ const Icon = forwardRef(({ name, ...restProps }, ref) => {
45
45
  controller.abort();
46
46
  };
47
47
  }, [name]);
48
- return (_jsx(StyledIcon, Object.assign({}, restProps, { role: 'img', ref: ref, xmlns: 'http://www.w3.org/2000/svg', viewBox: iconDef.viewBox }, { children: _jsx(iconDef.Component, {}, void 0) }), void 0));
48
+ return (_jsx(StyledIcon, { ...restProps, role: 'img', ref: ref, xmlns: 'http://www.w3.org/2000/svg', viewBox: iconDef.viewBox, children: _jsx(iconDef.Component, {}, void 0) }, void 0));
49
49
  });
50
50
  export default Icon;
51
51
  //# sourceMappingURL=Icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAoBvC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,KAAmB,EAAE,EAAE;IACrD,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE;QACrC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,YAAY,CA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M,CAAC,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAC5B,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,UAAU,oBACL,SAAS,IACb,IAAI,EAAC,KAAK,EACV,GAAG,EAAE,GAAG,EACR,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAE,OAAO,CAAC,OAAO,gBAExB,KAAC,OAAO,CAAC,SAAS,aAAG,YACV,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n useEffect,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n ComponentType\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\n\nexport interface IconDefinition {\n Component: ComponentType;\n viewBox?: string;\n}\n\nexport interface IconModule extends IconDefinition {\n name: string;\n}\n\nexport interface IconProps extends BaseProps, NoChildrenProp {\n /** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */\n name: string;\n /** Ref for the wrapping element. */\n ref?: Ref<SVGSVGElement>;\n}\n\nconst iconRegistry = new Map<string, IconDefinition>();\n\nexport const registerIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n if (!iconRegistry.has(name)) iconRegistry.set(name, iconDef);\n });\n};\n\nexport const forceRegisterIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n iconRegistry.set(name, iconDef);\n });\n};\n\nexport const StyledIcon = styled.svg`\n display: inline-block;\n fill: currentColor;\n height: 1.125rem;\n width: 1.125rem;\n vertical-align: middle;\n`;\n\nconst emptyIconDefinition: Readonly<IconDefinition> = Object.freeze({ Component: () => null });\n\nconst Icon: FunctionComponent<IconProps & ForwardProps> = forwardRef(\n ({ name, ...restProps }: PropsWithoutRef<IconProps>, ref: IconProps['ref']) => {\n const [iconDef, setIconDef] = useState(iconRegistry.get(name) ?? emptyIconDefinition);\n\n useEffect(() => {\n if (iconRegistry.has(name)) {\n setIconDef(iconRegistry.get(name)!);\n return;\n }\n\n const controller = new AbortController();\n import(`./icons/${encodeURIComponent(name)}.icon`)\n .then((module: IconModule) => {\n if (!module.name || !module.Component) throw new Error('Malformed icon definition');\n\n registerIcon(module);\n if (!controller.signal.aborted)\n setIconDef(iconRegistry.get(module.name) ?? emptyIconDefinition);\n })\n .catch(() => {\n if (!controller.signal.aborted) setIconDef(emptyIconDefinition);\n });\n\n return () => {\n controller.abort();\n };\n }, [name]);\n\n return (\n <StyledIcon\n {...restProps}\n role='img'\n ref={ref}\n xmlns='http://www.w3.org/2000/svg'\n viewBox={iconDef.viewBox}\n >\n <iconDef.Component />\n </StyledIcon>\n );\n }\n);\n\nexport default Icon;\n"]}
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAoBvC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,KAAmB,EAAE,EAAE;IACrD,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE;QACrC,IAAI,CAAC,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,CAAC,2BAA2B,CAAC,CAAC;YAEpF,YAAY,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAC5B,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,UAAU,OACL,SAAS,EACb,IAAI,EAAC,KAAK,EACV,GAAG,EAAE,GAAG,EACR,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAE,OAAO,CAAC,OAAO,YAExB,KAAC,OAAO,CAAC,SAAS,aAAG,WACV,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n useEffect,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n ComponentType\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\n\nexport interface IconDefinition {\n Component: ComponentType;\n viewBox?: string;\n}\n\nexport interface IconModule extends IconDefinition {\n name: string;\n}\n\nexport interface IconProps extends BaseProps, NoChildrenProp {\n /** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */\n name: string;\n /** Ref for the wrapping element. */\n ref?: Ref<SVGSVGElement>;\n}\n\nconst iconRegistry = new Map<string, IconDefinition>();\n\nexport const registerIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n if (!iconRegistry.has(name)) iconRegistry.set(name, iconDef);\n });\n};\n\nexport const forceRegisterIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n iconRegistry.set(name, iconDef);\n });\n};\n\nexport const StyledIcon = styled.svg`\n display: inline-block;\n fill: currentColor;\n height: 1.125rem;\n width: 1.125rem;\n vertical-align: middle;\n`;\n\nconst emptyIconDefinition: Readonly<IconDefinition> = Object.freeze({ Component: () => null });\n\nconst Icon: FunctionComponent<IconProps & ForwardProps> = forwardRef(\n ({ name, ...restProps }: PropsWithoutRef<IconProps>, ref: IconProps['ref']) => {\n const [iconDef, setIconDef] = useState(iconRegistry.get(name) ?? emptyIconDefinition);\n\n useEffect(() => {\n if (iconRegistry.has(name)) {\n setIconDef(iconRegistry.get(name)!);\n return;\n }\n\n const controller = new AbortController();\n import(`./icons/${encodeURIComponent(name)}.icon`)\n .then((module: IconModule) => {\n if (!module.name || !module.Component) throw new Error('Malformed icon definition');\n\n registerIcon(module);\n if (!controller.signal.aborted)\n setIconDef(iconRegistry.get(module.name) ?? emptyIconDefinition);\n })\n .catch(() => {\n if (!controller.signal.aborted) setIconDef(emptyIconDefinition);\n });\n\n return () => {\n controller.abort();\n };\n }, [name]);\n\n return (\n <StyledIcon\n {...restProps}\n role='img'\n ref={ref}\n xmlns='http://www.w3.org/2000/svg'\n viewBox={iconDef.viewBox}\n >\n <iconDef.Component />\n </StyledIcon>\n );\n }\n);\n\nexport default Icon;\n"]}
@@ -6,7 +6,7 @@ export const StyledImage = styled.img `
6
6
  `;
7
7
  const Image = forwardRef((props, ref) => {
8
8
  const { alt, ...restProps } = props;
9
- return _jsx(StyledImage, Object.assign({}, restProps, { alt: alt, ref: ref }), void 0);
9
+ return _jsx(StyledImage, { ...restProps, alt: alt, ref: ref }, void 0);
10
10
  });
11
11
  export default Image;
12
12
  //# sourceMappingURL=Image.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../src/components/Image/Image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA8D,MAAM,OAAO,CAAC;AAC/F,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAWvC,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEpC,CAAC;AAEF,MAAM,KAAK,GAAiD,UAAU,CACpE,CAAC,KAAkC,EAAE,GAA0B,EAAE,EAAE;IACjE,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACpC,OAAO,KAAC,WAAW,oBAAK,SAAS,IAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,YAAI,CAAC;AAC5D,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, ImgHTMLAttributes, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport { ForwardProps } from '../../types';\n\nexport interface ImageProps extends ImgHTMLAttributes<HTMLImageElement> {\n /** The HTML alt attribute for the image. */\n alt: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLImageElement>;\n}\n\nexport const StyledImage = styled.img`\n max-width: 100%;\n`;\n\nconst Image: FunctionComponent<ImageProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ImageProps>, ref: Ref<HTMLImageElement>) => {\n const { alt, ...restProps } = props;\n return <StyledImage {...restProps} alt={alt} ref={ref} />;\n }\n);\n\nexport default Image;\n"]}
1
+ {"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../src/components/Image/Image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA8D,MAAM,OAAO,CAAC;AAC/F,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAWvC,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEpC,CAAC;AAEF,MAAM,KAAK,GAAiD,UAAU,CACpE,CAAC,KAAkC,EAAE,GAA0B,EAAE,EAAE;IACjE,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACpC,OAAO,KAAC,WAAW,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,WAAI,CAAC;AAC5D,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, ImgHTMLAttributes, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport { ForwardProps } from '../../types';\n\nexport interface ImageProps extends ImgHTMLAttributes<HTMLImageElement> {\n /** The HTML alt attribute for the image. */\n alt: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLImageElement>;\n}\n\nexport const StyledImage = styled.img`\n max-width: 100%;\n`;\n\nconst Image: FunctionComponent<ImageProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ImageProps>, ref: Ref<HTMLImageElement>) => {\n const { alt, ...restProps } = props;\n return <StyledImage {...restProps} alt={alt} ref={ref} />;\n }\n);\n\nexport default Image;\n"]}
@@ -16,17 +16,17 @@ const Input = forwardRef((props, ref) => {
16
16
  else if (hasProp(props, 'defaultValue')) {
17
17
  controlProp.defaultValue = defaultValue ?? '';
18
18
  }
19
- const Comp = (_jsx(StyledFormControl, Object.assign({}, {
20
- ref,
21
- id,
22
- required,
23
- disabled,
24
- status,
25
- ...controlProp,
26
- ...restProps,
27
- as: StyledInput
28
- }), void 0));
29
- return label ? (_jsx(FormField, Object.assign({}, { label, labelHidden, id, info, status, required, disabled, actions }, { children: Comp }), void 0)) : (Comp);
19
+ const Comp = (_jsx(StyledFormControl, { ...{
20
+ ref,
21
+ id,
22
+ required,
23
+ disabled,
24
+ status,
25
+ ...controlProp,
26
+ ...restProps,
27
+ as: StyledInput
28
+ } }, void 0));
29
+ return label ? (_jsx(FormField, { ...{ label, labelHidden, id, info, status, required, disabled, actions }, children: Comp }, void 0)) : (Comp);
30
30
  });
31
31
  export default Input;
32
32
  //# sourceMappingURL=Input.js.map