@pega/cosmos-react-core 2.0.0-dev.18.0 → 2.0.0-dev.20.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 (331) 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.js +13 -13
  6. package/lib/components/AppShell/AppShell.js.map +1 -1
  7. package/lib/components/AppShell/AppShellList.js +6 -6
  8. package/lib/components/AppShell/AppShellList.js.map +1 -1
  9. package/lib/components/AppShell/Drawer.js +2 -2
  10. package/lib/components/AppShell/Drawer.js.map +1 -1
  11. package/lib/components/AppShell/Operator.js +3 -3
  12. package/lib/components/AppShell/Operator.js.map +1 -1
  13. package/lib/components/AppShell/SkipNavigation.js +2 -2
  14. package/lib/components/AppShell/SkipNavigation.js.map +1 -1
  15. package/lib/components/Avatar/Avatar.js +1 -1
  16. package/lib/components/Avatar/Avatar.js.map +1 -1
  17. package/lib/components/Backdrop/Backdrop.js +1 -1
  18. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  19. package/lib/components/Badges/Alert.js +1 -1
  20. package/lib/components/Badges/Alert.js.map +1 -1
  21. package/lib/components/Badges/Count.js +1 -1
  22. package/lib/components/Badges/Count.js.map +1 -1
  23. package/lib/components/Badges/Selection.js +1 -1
  24. package/lib/components/Badges/Selection.js.map +1 -1
  25. package/lib/components/Badges/Status.js +1 -1
  26. package/lib/components/Badges/Status.js.map +1 -1
  27. package/lib/components/Badges/Tag.js +1 -1
  28. package/lib/components/Badges/Tag.js.map +1 -1
  29. package/lib/components/Banner/Banner.js +3 -3
  30. package/lib/components/Banner/Banner.js.map +1 -1
  31. package/lib/components/Boolean/BooleanDisplay.js +1 -1
  32. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  33. package/lib/components/Breadcrumbs/Breadcrumbs.js +5 -5
  34. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  35. package/lib/components/Button/BareButton.js +2 -2
  36. package/lib/components/Button/BareButton.js.map +1 -1
  37. package/lib/components/Button/BareRoleButton.d.ts +12 -0
  38. package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
  39. package/lib/components/Button/BareRoleButton.js +20 -0
  40. package/lib/components/Button/BareRoleButton.js.map +1 -0
  41. package/lib/components/Button/Button.js +2 -2
  42. package/lib/components/Button/Button.js.map +1 -1
  43. package/lib/components/Card/Card.js +1 -1
  44. package/lib/components/Card/Card.js.map +1 -1
  45. package/lib/components/Card/CardContent.js +1 -1
  46. package/lib/components/Card/CardContent.js.map +1 -1
  47. package/lib/components/Card/CardFooter.js +2 -2
  48. package/lib/components/Card/CardFooter.js.map +1 -1
  49. package/lib/components/Card/CardHeader.js +1 -1
  50. package/lib/components/Card/CardHeader.js.map +1 -1
  51. package/lib/components/Card/CardMedia.js +1 -1
  52. package/lib/components/Card/CardMedia.js.map +1 -1
  53. package/lib/components/Card/CollapsibleCard.js +1 -1
  54. package/lib/components/Card/CollapsibleCard.js.map +1 -1
  55. package/lib/components/Card/SelectableCard.js +1 -1
  56. package/lib/components/Card/SelectableCard.js.map +1 -1
  57. package/lib/components/Checkbox/Checkbox.js +1 -1
  58. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  59. package/lib/components/ColorPicker/ColorPicker.js +3 -3
  60. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  61. package/lib/components/ComboBox/ComboBox.js +12 -12
  62. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  63. package/lib/components/ComboBox/ComboBoxInput.js +4 -4
  64. package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
  65. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  66. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +14 -10
  67. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  68. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
  69. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +15 -11
  70. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
  71. package/lib/components/Configuration/Configuration.js +5 -5
  72. package/lib/components/Configuration/Configuration.js.map +1 -1
  73. package/lib/components/Currency/CurrencyDisplay.js +1 -1
  74. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  75. package/lib/components/Currency/CurrencyInput.js +12 -12
  76. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  77. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  78. package/lib/components/DateTime/DateTimeDisplay.js +2 -1
  79. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  80. package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
  81. package/lib/components/DateTime/DurationDisplay.js +11 -6
  82. package/lib/components/DateTime/DurationDisplay.js.map +1 -1
  83. package/lib/components/DateTime/Input/DateInput.js +6 -6
  84. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  85. package/lib/components/DateTime/Input/DateRangeInput.js +1 -1
  86. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  87. package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
  88. package/lib/components/DateTime/Input/DateTime.styles.js +13 -2
  89. package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
  90. package/lib/components/DateTime/Input/DateTimeInput.js +9 -9
  91. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  92. package/lib/components/DateTime/Input/DayOfWeekInput.js +2 -2
  93. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  94. package/lib/components/DateTime/Input/Duration/DurationInput.js +2 -2
  95. package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
  96. package/lib/components/DateTime/Input/Duration/NumberUnit.js +2 -2
  97. package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
  98. package/lib/components/DateTime/Input/Duration/Time.js +2 -2
  99. package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
  100. package/lib/components/DateTime/Input/MonthInput.js +6 -6
  101. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  102. package/lib/components/DateTime/Input/PartInput.js +1 -1
  103. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  104. package/lib/components/DateTime/Input/QuarterInput.js +6 -6
  105. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
  106. package/lib/components/DateTime/Input/TimeInput.js +9 -9
  107. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  108. package/lib/components/DateTime/Input/WeekInput.js +6 -6
  109. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  110. package/lib/components/DateTime/Picker/Calendar.js +11 -11
  111. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  112. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  113. package/lib/components/DateTime/Picker/DatePicker.js +7 -9
  114. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  115. package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
  116. package/lib/components/DateTime/Picker/DateRangePicker.js +7 -9
  117. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  118. package/lib/components/DateTime/Picker/TimePicker.js +4 -4
  119. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  120. package/lib/components/DateTime/Picker/Weeks.js +4 -4
  121. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  122. package/lib/components/DateTime/Picker/utils.d.ts +1 -0
  123. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  124. package/lib/components/DateTime/Picker/utils.js +3 -0
  125. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  126. package/lib/components/Drawer/Drawer.js +1 -1
  127. package/lib/components/Drawer/Drawer.js.map +1 -1
  128. package/lib/components/Email/EmailDisplay.js +2 -2
  129. package/lib/components/Email/EmailDisplay.js.map +1 -1
  130. package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
  131. package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
  132. package/lib/components/EmojiPicker/EmojiPicker.js +1 -1
  133. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  134. package/lib/components/EmptyState/EmptyState.js +1 -1
  135. package/lib/components/EmptyState/EmptyState.js.map +1 -1
  136. package/lib/components/ErrorState/ErrorState.js +1 -1
  137. package/lib/components/ErrorState/ErrorState.js.map +1 -1
  138. package/lib/components/ExpandCollapse/ExpandCollapse.js +1 -1
  139. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  140. package/lib/components/FieldGroup/FieldGroup.js +3 -3
  141. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  142. package/lib/components/FieldGroup/FieldGroupList.js +4 -4
  143. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  144. package/lib/components/FieldValueList/FieldValueList.js +5 -5
  145. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  146. package/lib/components/File/FileDisplay.js +7 -7
  147. package/lib/components/File/FileDisplay.js.map +1 -1
  148. package/lib/components/File/FileInput.js +10 -10
  149. package/lib/components/File/FileInput.js.map +1 -1
  150. package/lib/components/File/FileItem.js +1 -1
  151. package/lib/components/File/FileItem.js.map +1 -1
  152. package/lib/components/File/FileUploadItem.js +4 -4
  153. package/lib/components/File/FileUploadItem.js.map +1 -1
  154. package/lib/components/File/FileVisual.js +4 -4
  155. package/lib/components/File/FileVisual.js.map +1 -1
  156. package/lib/components/Flex/Flex.js +1 -1
  157. package/lib/components/Flex/Flex.js.map +1 -1
  158. package/lib/components/Form/Form.js +1 -1
  159. package/lib/components/Form/Form.js.map +1 -1
  160. package/lib/components/FormControl/FormControl.js +1 -1
  161. package/lib/components/FormControl/FormControl.js.map +1 -1
  162. package/lib/components/FormField/FormField.js +7 -7
  163. package/lib/components/FormField/FormField.js.map +1 -1
  164. package/lib/components/Grid/Grid.js +1 -1
  165. package/lib/components/Grid/Grid.js.map +1 -1
  166. package/lib/components/Icon/Icon.js +1 -1
  167. package/lib/components/Icon/Icon.js.map +1 -1
  168. package/lib/components/Image/Image.js +1 -1
  169. package/lib/components/Image/Image.js.map +1 -1
  170. package/lib/components/Input/Input.js +11 -11
  171. package/lib/components/Input/Input.js.map +1 -1
  172. package/lib/components/Label/Label.js +1 -1
  173. package/lib/components/Label/Label.js.map +1 -1
  174. package/lib/components/Link/Link.js +1 -1
  175. package/lib/components/Link/Link.js.map +1 -1
  176. package/lib/components/List/CommaSeparatedList.js +3 -3
  177. package/lib/components/List/CommaSeparatedList.js.map +1 -1
  178. package/lib/components/List/List.js +1 -1
  179. package/lib/components/List/List.js.map +1 -1
  180. package/lib/components/List/OrderedList.js +1 -1
  181. package/lib/components/List/OrderedList.js.map +1 -1
  182. package/lib/components/List/UnorderedList.js +1 -1
  183. package/lib/components/List/UnorderedList.js.map +1 -1
  184. package/lib/components/Location/CurrentLocationButton.js +1 -1
  185. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  186. package/lib/components/Location/LocationDisplay.js +7 -7
  187. package/lib/components/Location/LocationDisplay.js.map +1 -1
  188. package/lib/components/Location/LocationInput.js +19 -19
  189. package/lib/components/Location/LocationInput.js.map +1 -1
  190. package/lib/components/Location/LocationView.js +1 -1
  191. package/lib/components/Location/LocationView.js.map +1 -1
  192. package/lib/components/Menu/FlyoutMenuList.js +3 -3
  193. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  194. package/lib/components/Menu/Menu.d.ts.map +1 -1
  195. package/lib/components/Menu/Menu.js +4 -3
  196. package/lib/components/Menu/Menu.js.map +1 -1
  197. package/lib/components/Menu/Menu.types.d.ts +3 -1
  198. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  199. package/lib/components/Menu/Menu.types.js.map +1 -1
  200. package/lib/components/Menu/MenuGroup.js +2 -2
  201. package/lib/components/Menu/MenuGroup.js.map +1 -1
  202. package/lib/components/Menu/MenuItem.js +11 -11
  203. package/lib/components/Menu/MenuItem.js.map +1 -1
  204. package/lib/components/Menu/MenuList.js +5 -5
  205. package/lib/components/Menu/MenuList.js.map +1 -1
  206. package/lib/components/Menu/MenuListHeader.js +2 -2
  207. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  208. package/lib/components/MenuButton/MenuButton.js +3 -3
  209. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  210. package/lib/components/MetaList/MetaList.js +4 -4
  211. package/lib/components/MetaList/MetaList.js.map +1 -1
  212. package/lib/components/Modal/DockedModals.d.ts.map +1 -1
  213. package/lib/components/Modal/DockedModals.js +4 -6
  214. package/lib/components/Modal/DockedModals.js.map +1 -1
  215. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  216. package/lib/components/Modal/MinimizedModal.js +37 -34
  217. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  218. package/lib/components/Modal/Modal.js +8 -8
  219. package/lib/components/Modal/Modal.js.map +1 -1
  220. package/lib/components/Modal/ModalManager.js +6 -6
  221. package/lib/components/Modal/ModalManager.js.map +1 -1
  222. package/lib/components/MultiStep/MultiStep.js +7 -7
  223. package/lib/components/MultiStep/MultiStep.js.map +1 -1
  224. package/lib/components/Number/NumberDisplay.js +1 -1
  225. package/lib/components/Number/NumberDisplay.js.map +1 -1
  226. package/lib/components/Number/NumberInput.js +5 -5
  227. package/lib/components/Number/NumberInput.js.map +1 -1
  228. package/lib/components/PageTemplates/CategorySubPage.js +7 -7
  229. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  230. package/lib/components/PageTemplates/DashboardPage.d.ts +4 -0
  231. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  232. package/lib/components/PageTemplates/DashboardPage.js +19 -12
  233. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  234. package/lib/components/PageTemplates/PageTemplates.js +20 -20
  235. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  236. package/lib/components/PageTemplates/index.d.ts +1 -0
  237. package/lib/components/PageTemplates/index.d.ts.map +1 -1
  238. package/lib/components/PageTemplates/index.js +1 -0
  239. package/lib/components/PageTemplates/index.js.map +1 -1
  240. package/lib/components/Pagination/Pagination.js +3 -3
  241. package/lib/components/Pagination/Pagination.js.map +1 -1
  242. package/lib/components/Phone/PhoneDisplay.js +2 -2
  243. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  244. package/lib/components/Phone/PhoneInput.js +3 -3
  245. package/lib/components/Phone/PhoneInput.js.map +1 -1
  246. package/lib/components/Popover/Popover.js +1 -1
  247. package/lib/components/Popover/Popover.js.map +1 -1
  248. package/lib/components/Popover/PopoverManager.js +2 -2
  249. package/lib/components/Popover/PopoverManager.js.map +1 -1
  250. package/lib/components/Progress/Bar.js +1 -1
  251. package/lib/components/Progress/Bar.js.map +1 -1
  252. package/lib/components/Progress/Ellipsis.js +1 -1
  253. package/lib/components/Progress/Ellipsis.js.map +1 -1
  254. package/lib/components/Progress/Progress.js +2 -2
  255. package/lib/components/Progress/Progress.js.map +1 -1
  256. package/lib/components/Progress/Ring.js +1 -1
  257. package/lib/components/Progress/Ring.js.map +1 -1
  258. package/lib/components/RadioButton/RadioButton.js +1 -1
  259. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  260. package/lib/components/RadioCheck/RadioCheck.js +2 -2
  261. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  262. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +10 -10
  263. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  264. package/lib/components/Rating/Rating.js +2 -2
  265. package/lib/components/Rating/Rating.js.map +1 -1
  266. package/lib/components/SearchInput/SearchInput.js +2 -2
  267. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  268. package/lib/components/Select/Option.js +1 -1
  269. package/lib/components/Select/Option.js.map +1 -1
  270. package/lib/components/Select/Select.js +13 -13
  271. package/lib/components/Select/Select.js.map +1 -1
  272. package/lib/components/Sentiment/Sentiment.js +1 -1
  273. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  274. package/lib/components/Skeleton/LineSkeleton.js +1 -1
  275. package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
  276. package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
  277. package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
  278. package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
  279. package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
  280. package/lib/components/Slider/Slider.js +5 -5
  281. package/lib/components/Slider/Slider.js.map +1 -1
  282. package/lib/components/Slider/SliderTicks.js +4 -4
  283. package/lib/components/Slider/SliderTicks.js.map +1 -1
  284. package/lib/components/SummaryItem/SummaryItem.d.ts +1 -1
  285. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  286. package/lib/components/SummaryItem/SummaryItem.js +2 -2
  287. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  288. package/lib/components/SummaryList/SummaryList.js +3 -3
  289. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  290. package/lib/components/SummaryList/ViewAll.js +1 -1
  291. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  292. package/lib/components/Switch/Switch.js +1 -1
  293. package/lib/components/Switch/Switch.js.map +1 -1
  294. package/lib/components/Table/Table.d.ts.map +1 -1
  295. package/lib/components/Table/Table.js +13 -8
  296. package/lib/components/Table/Table.js.map +1 -1
  297. package/lib/components/Tabs/Tab.js +1 -1
  298. package/lib/components/Tabs/Tab.js.map +1 -1
  299. package/lib/components/Tabs/TabPanel.js +1 -1
  300. package/lib/components/Tabs/TabPanel.js.map +1 -1
  301. package/lib/components/Tabs/Tabs.js +4 -4
  302. package/lib/components/Tabs/Tabs.js.map +1 -1
  303. package/lib/components/Text/Text.js +1 -1
  304. package/lib/components/Text/Text.js.map +1 -1
  305. package/lib/components/TextArea/TextArea.js +23 -23
  306. package/lib/components/TextArea/TextArea.js.map +1 -1
  307. package/lib/components/Toaster/Toaster.js +4 -4
  308. package/lib/components/Toaster/Toaster.js.map +1 -1
  309. package/lib/components/Tooltip/Tooltip.js +1 -1
  310. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  311. package/lib/components/Tree/StandardTree.js +6 -6
  312. package/lib/components/Tree/StandardTree.js.map +1 -1
  313. package/lib/components/Tree/Tree.js +3 -3
  314. package/lib/components/Tree/Tree.js.map +1 -1
  315. package/lib/components/URL/URLDisplay.js +2 -2
  316. package/lib/components/URL/URLDisplay.js.map +1 -1
  317. package/lib/hooks/useFocusWithin.d.ts +1 -1
  318. package/lib/hooks/useFocusWithin.d.ts.map +1 -1
  319. package/lib/hooks/useFocusWithin.js +21 -16
  320. package/lib/hooks/useFocusWithin.js.map +1 -1
  321. package/lib/hooks/useI18n.d.ts +2 -1
  322. package/lib/hooks/useI18n.d.ts.map +1 -1
  323. package/lib/i18n/default.json +2 -1
  324. package/lib/i18n/i18n.d.ts +4 -2
  325. package/lib/i18n/i18n.d.ts.map +1 -1
  326. package/lib/theme/theme.d.ts +30 -30
  327. package/lib/utils/utils.d.ts +13 -0
  328. package/lib/utils/utils.d.ts.map +1 -1
  329. package/lib/utils/utils.js +15 -0
  330. package/lib/utils/utils.js.map +1 -1
  331. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,QAAQ,EAER,QAAQ,EACR,eAAe,EACf,MAAM,EACN,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,O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b,SAAS,EAAE;YACT,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB;YAC3D,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;SACV,EACD,EAAE,EAAE,oBAAoB,gBAEvB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YAClC,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,kBAAkB,cAAE,KAAK,WAAsB,CAAC,CAAC,CAAC,KAAK,CAAC;YACvF,OAAO,CACL,MAAC,OAAO,eACN,KAAC,WAAW,kBAAC,EAAE,EAAE,eAAe,gBAAG,IAAI,YAAe,EACtD,KAAC,gBAAgB,cACd,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,4CAAkB,MAAM,0CAAsB,WACpD,KAJP,EAAE,IAAI,IAAI,CAKd,CACX,CAAC;QACJ,CAAC,CAAC,YACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ReactNode,\n Fragment,\n FunctionComponent,\n useState,\n useLayoutEffect,\n useRef,\n useMemo\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Button from '../Button';\nimport ExpandCollapse from '../ExpandCollapse';\nimport Grid from '../Grid';\nimport { StyledLabel } from '../Label';\nimport { useI18n } from '../../hooks';\nimport { windowIsAvailable } from '../../utils';\n\nexport interface FieldValueListProps extends BaseProps {\n /** The set of field values to render in the list. */\n fields: {\n id?: string;\n name: string;\n value?: ReactNode;\n }[];\n /**\n * Determines if the field and values should be displayed on the same line, or stacked with the field above the value.\n * @default \"inline\"\n */\n variant?: 'inline' | 'stacked';\n}\n\nexport const StyledFieldName = styled.dt`\n word-break: break-word;\n`;\n\nexport const StyledFieldValue = styled.dd`\n word-break: break-word;\n`;\n\nexport const StyledFieldValueList = styled.dl`\n width: 100%;\n`;\n\nStyledFieldValueList.defaultProps = defaultThemeProp;\n\nconst DynamicHeightValue = ({ children }: { children: ReactNode }): JSX.Element => {\n const [collapsed, setCollapsed] = useState(true);\n const [exceedsMaxHeight, setExceedsMaxHeight] = useState(false);\n const textRef = useRef<HTMLSpanElement>(null);\n const t = useI18n();\n\n const maxTextHeight = useMemo(() => {\n if (!windowIsAvailable) return Infinity;\n\n const computedLineHeight =\n Number.parseInt(\n window.getComputedStyle(document.documentElement).getPropertyValue('font-size'),\n 10\n ) * 1.25;\n\n return 3 * computedLineHeight;\n }, []);\n\n useLayoutEffect(() => {\n if (!textRef.current) return;\n\n const observer = new ResizeObserver(entries => {\n const exceedsHeight = entries.some(({ target, contentRect }) => {\n if (target !== textRef.current) return;\n\n return contentRect.height > maxTextHeight;\n });\n\n setExceedsMaxHeight(exceedsHeight);\n });\n\n observer.observe(textRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [textRef.current, maxTextHeight]);\n\n return (\n <>\n <ExpandCollapse\n collapsed={collapsed}\n min={exceedsMaxHeight ? `${maxTextHeight}px` : 'max-content'}\n >\n <Grid ref={textRef}>\n <span>{children}</span>\n </Grid>\n </ExpandCollapse>\n {exceedsMaxHeight && (\n <Button variant='link' onClick={() => setCollapsed(current => !current)}>\n {collapsed ? t('show_more') : t('show_less')}\n </Button>\n )}\n </>\n );\n};\n\nconst FieldValueList: FunctionComponent<FieldValueListProps & ForwardProps> = ({\n fields,\n variant = 'inline',\n ...restProps\n}: FieldValueListProps) => {\n const Wrapper = variant === 'inline' ? Fragment : 'div';\n\n return (\n <Grid\n {...restProps}\n container={{\n cols: variant === 'inline' ? '16ch auto' : 'minmax(0, 1fr)',\n colGap: 2,\n rowGap: 1\n }}\n as={StyledFieldValueList}\n >\n {fields.map(({ id, name, value }) => {\n const diplayValue =\n typeof value === 'string' ? <DynamicHeightValue>{value}</DynamicHeightValue> : value;\n return (\n <Wrapper key={id ?? name}>\n <StyledLabel as={StyledFieldName}>{name}</StyledLabel>\n <StyledFieldValue>\n {value ? diplayValue : <span aria-hidden='true'>&ndash;&ndash;</span>}\n </StyledFieldValue>\n </Wrapper>\n );\n })}\n </Grid>\n );\n};\n\nexport default FieldValueList;\n"]}
1
+ {"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,QAAQ,EAER,QAAQ,EACR,eAAe,EACf,MAAM,EACN,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgBhD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA;;CAEvC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAA;;CAExC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,EAAE,CAAA;;CAE5C,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAe,EAAE;IAChF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,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AE,IAAI,IAAI,CAKd,CACX,CAAC;QACJ,CAAC,CAAC,WACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ReactNode,\n Fragment,\n FunctionComponent,\n useState,\n useLayoutEffect,\n useRef,\n useMemo\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Button from '../Button';\nimport ExpandCollapse from '../ExpandCollapse';\nimport Grid from '../Grid';\nimport { StyledLabel } from '../Label';\nimport { useI18n } from '../../hooks';\nimport { windowIsAvailable } from '../../utils';\n\nexport interface FieldValueListProps extends BaseProps {\n /** The set of field values to render in the list. */\n fields: {\n id?: string;\n name: string;\n value?: ReactNode;\n }[];\n /**\n * Determines if the field and values should be displayed on the same line, or stacked with the field above the value.\n * @default \"inline\"\n */\n variant?: 'inline' | 'stacked';\n}\n\nexport const StyledFieldName = styled.dt`\n word-break: break-word;\n`;\n\nexport const StyledFieldValue = styled.dd`\n word-break: break-word;\n`;\n\nexport const StyledFieldValueList = styled.dl`\n width: 100%;\n`;\n\nStyledFieldValueList.defaultProps = defaultThemeProp;\n\nconst DynamicHeightValue = ({ children }: { children: ReactNode }): JSX.Element => {\n const [collapsed, setCollapsed] = useState(true);\n const [exceedsMaxHeight, setExceedsMaxHeight] = useState(false);\n const textRef = useRef<HTMLSpanElement>(null);\n const t = useI18n();\n\n const maxTextHeight = useMemo(() => {\n if (!windowIsAvailable) return Infinity;\n\n const computedLineHeight =\n Number.parseInt(\n window.getComputedStyle(document.documentElement).getPropertyValue('font-size'),\n 10\n ) * 1.25;\n\n return 3 * computedLineHeight;\n }, []);\n\n useLayoutEffect(() => {\n if (!textRef.current) return;\n\n const observer = new ResizeObserver(entries => {\n const exceedsHeight = entries.some(({ target, contentRect }) => {\n if (target !== textRef.current) return;\n\n return contentRect.height > maxTextHeight;\n });\n\n setExceedsMaxHeight(exceedsHeight);\n });\n\n observer.observe(textRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [textRef.current, maxTextHeight]);\n\n return (\n <>\n <ExpandCollapse\n collapsed={collapsed}\n min={exceedsMaxHeight ? `${maxTextHeight}px` : 'max-content'}\n >\n <Grid ref={textRef}>\n <span>{children}</span>\n </Grid>\n </ExpandCollapse>\n {exceedsMaxHeight && (\n <Button variant='link' onClick={() => setCollapsed(current => !current)}>\n {collapsed ? t('show_more') : t('show_less')}\n </Button>\n )}\n </>\n );\n};\n\nconst FieldValueList: FunctionComponent<FieldValueListProps & ForwardProps> = ({\n fields,\n variant = 'inline',\n ...restProps\n}: FieldValueListProps) => {\n const Wrapper = variant === 'inline' ? Fragment : 'div';\n\n return (\n <Grid\n {...restProps}\n container={{\n cols: variant === 'inline' ? '16ch auto' : 'minmax(0, 1fr)',\n colGap: 2,\n rowGap: 1\n }}\n as={StyledFieldValueList}\n >\n {fields.map(({ id, name, value }) => {\n const diplayValue =\n typeof value === 'string' ? <DynamicHeightValue>{value}</DynamicHeightValue> : value;\n return (\n <Wrapper key={id ?? name}>\n <StyledLabel as={StyledFieldName}>{name}</StyledLabel>\n <StyledFieldValue>\n {value ? diplayValue : <span aria-hidden='true'>&ndash;&ndash;</span>}\n </StyledFieldValue>\n </Wrapper>\n );\n })}\n </Grid>\n );\n};\n\nexport default FieldValueList;\n"]}
@@ -4,15 +4,15 @@ import Link from '../Link';
4
4
  import FileItem from './FileItem';
5
5
  const FileDisplay = forwardRef(({ displayText, value, variant, thumbnail, onPreview, onDownload, ...restProps }, ref) => {
6
6
  if (variant === 'text' || !value) {
7
- return (_jsx("span", Object.assign({ ref: ref }, restProps, { children: value ? displayText || value : _jsx("span", Object.assign({ "aria-hidden": 'true' }, { children: "\u2013\u2013" }), void 0) }), void 0));
7
+ return (_jsx("span", { ref: ref, ...restProps, children: value ? displayText || value : _jsx("span", { "aria-hidden": 'true', children: "\u2013\u2013" }, void 0) }, void 0));
8
8
  }
9
9
  if (variant === 'link')
10
- return (_jsx(Link, Object.assign({ ref: ref }, restProps, { href: value }, { children: displayText || value }), void 0));
11
- return (_jsx(FileItem, Object.assign({}, restProps, { ref: ref, name: displayText || value, url: value }, {
12
- thumbnail,
13
- onDownload,
14
- onPreview
15
- }), void 0));
10
+ return (_jsx(Link, { ref: ref, ...restProps, href: value, children: displayText || value }, void 0));
11
+ return (_jsx(FileItem, { ...restProps, ref: ref, name: displayText || value, url: value, ...{
12
+ thumbnail,
13
+ onDownload,
14
+ onPreview
15
+ } }, void 0));
16
16
  });
17
17
  export default FileDisplay;
18
18
  //# sourceMappingURL=FileDisplay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileDisplay.js","sourceRoot":"","sources":["../../../src/components/File/FileDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,QAA2B,MAAM,YAAY,CAAC;AAoBrD,MAAM,WAAW,GAAuD,UAAU,CAChF,CACE,EACE,WAAW,EACX,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,EACV,GAAG,SAAS,EACsB,EACpC,GAA4B,EAC5B,EAAE;IACF,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,KAAK,EAAE;QAChC,OAAO,CACL,6BAAM,GAAG,EAAE,GAAG,IAAM,SAAS,cAC1B,KAAK,CAAC,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,4CAAkB,MAAM,0CAAsB,YACzE,CACR,CAAC;KACH;IAED,IAAI,OAAO,KAAK,MAAM;QACpB,OAAO,CACL,KAAC,IAAI,kBAAC,GAAG,EAAE,GAA6B,IAAM,SAAS,IAAE,IAAI,EAAE,KAAK,gBACjE,WAAW,IAAI,KAAK,YAChB,CACR,CAAC;IAEJ,OAAO,CACL,KAAC,QAAQ,oBACH,SAAS,IACb,GAAG,EAAE,GAA6B,EAClC,IAAI,EAAE,WAAW,IAAI,KAAK,EAC1B,GAAG,EAAE,KAAK,IACN;QACF,SAAS;QACT,UAAU;QACV,SAAS;KACV,UACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport Link from '../Link';\n\nimport FileItem, { FileItemProps } from './FileItem';\n\nexport interface FileDisplayProps\n extends Pick<FileItemProps, 'onPreview' | 'onDownload'>,\n BaseProps {\n /** URL address */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Display value either as file, link only or textual representation.\n * @default \"file\"\n * */\n variant?: 'file' | 'link' | 'text';\n /** Thumbnail image. */\n thumbnail?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement | HTMLAnchorElement | HTMLSpanElement>;\n}\n\nconst FileDisplay: FunctionComponent<FileDisplayProps & ForwardProps> = forwardRef(\n (\n {\n displayText,\n value,\n variant,\n thumbnail,\n onPreview,\n onDownload,\n ...restProps\n }: PropsWithoutRef<FileDisplayProps>,\n ref: FileDisplayProps['ref']\n ) => {\n if (variant === 'text' || !value) {\n return (\n <span ref={ref} {...restProps}>\n {value ? displayText || value : <span aria-hidden='true'>&ndash;&ndash;</span>}\n </span>\n );\n }\n\n if (variant === 'link')\n return (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={value}>\n {displayText || value}\n </Link>\n );\n\n return (\n <FileItem\n {...restProps}\n ref={ref as Ref<HTMLButtonElement>}\n name={displayText || value}\n url={value}\n {...{\n thumbnail,\n onDownload,\n onPreview\n }}\n />\n );\n }\n);\n\nexport default FileDisplay;\n"]}
1
+ {"version":3,"file":"FileDisplay.js","sourceRoot":"","sources":["../../../src/components/File/FileDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,QAA2B,MAAM,YAAY,CAAC;AAoBrD,MAAM,WAAW,GAAuD,UAAU,CAChF,CACE,EACE,WAAW,EACX,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,EACV,GAAG,SAAS,EACsB,EACpC,GAA4B,EAC5B,EAAE;IACF,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,KAAK,EAAE;QAChC,OAAO,CACL,eAAM,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1B,KAAK,CAAC,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,8BAAkB,MAAM,qCAAsB,WACzE,CACR,CAAC;KACH;IAED,IAAI,OAAO,KAAK,MAAM;QACpB,OAAO,CACL,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,KAAK,YACjE,WAAW,IAAI,KAAK,WAChB,CACR,CAAC;IAEJ,OAAO,CACL,KAAC,QAAQ,OACH,SAAS,EACb,GAAG,EAAE,GAA6B,EAClC,IAAI,EAAE,WAAW,IAAI,KAAK,EAC1B,GAAG,EAAE,KAAK,KACN;YACF,SAAS;YACT,UAAU;YACV,SAAS;SACV,WACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport Link from '../Link';\n\nimport FileItem, { FileItemProps } from './FileItem';\n\nexport interface FileDisplayProps\n extends Pick<FileItemProps, 'onPreview' | 'onDownload'>,\n BaseProps {\n /** URL address */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Display value either as file, link only or textual representation.\n * @default \"file\"\n * */\n variant?: 'file' | 'link' | 'text';\n /** Thumbnail image. */\n thumbnail?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement | HTMLAnchorElement | HTMLSpanElement>;\n}\n\nconst FileDisplay: FunctionComponent<FileDisplayProps & ForwardProps> = forwardRef(\n (\n {\n displayText,\n value,\n variant,\n thumbnail,\n onPreview,\n onDownload,\n ...restProps\n }: PropsWithoutRef<FileDisplayProps>,\n ref: FileDisplayProps['ref']\n ) => {\n if (variant === 'text' || !value) {\n return (\n <span ref={ref} {...restProps}>\n {value ? displayText || value : <span aria-hidden='true'>&ndash;&ndash;</span>}\n </span>\n );\n }\n\n if (variant === 'link')\n return (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={value}>\n {displayText || value}\n </Link>\n );\n\n return (\n <FileItem\n {...restProps}\n ref={ref as Ref<HTMLButtonElement>}\n name={displayText || value}\n url={value}\n {...{\n thumbnail,\n onDownload,\n onPreview\n }}\n />\n );\n }\n);\n\nexport default FileDisplay;\n"]}
@@ -73,7 +73,7 @@ const BaseFileInput = forwardRef((props, ref) => {
73
73
  const t = useI18n();
74
74
  const [dragOver, setDragOver] = useState(false);
75
75
  const { ltr, rtl } = useDirection();
76
- const fileInput = (_jsxs(StyledFileInput, { children: [_jsx("input", Object.assign({ ref: inputRef, type: 'file', id: id, disabled: disabled, onChange: onChange, multiple: multiple }, restProps), void 0), _jsxs(Flex, Object.assign({ container: { alignItems: 'center', justify: 'center' }, item: { grow: 1 }, as: StyledDropZone, dragOver: dragOver, onClick: () => {
76
+ const fileInput = (_jsxs(StyledFileInput, { children: [_jsx("input", { ref: inputRef, type: 'file', id: id, disabled: disabled, onChange: onChange, multiple: multiple, ...restProps }, void 0), _jsxs(Flex, { container: { alignItems: 'center', justify: 'center' }, item: { grow: 1 }, as: StyledDropZone, dragOver: dragOver, onClick: () => {
77
77
  inputRef.current?.focus();
78
78
  inputRef.current?.click();
79
79
  }, onDragOver: (e) => {
@@ -82,22 +82,22 @@ const BaseFileInput = forwardRef((props, ref) => {
82
82
  e.preventDefault();
83
83
  setDragOver(false);
84
84
  onFilesAdded?.(Array.from(e.dataTransfer.files));
85
- } }, { children: [ltr && icon, _jsxs(Text, Object.assign({ variant: 'primary' }, { children: ["\u00A0", t('file_upload_text_main', [
85
+ }, children: [ltr && icon, _jsxs(Text, { variant: 'primary', children: ["\u00A0", t('file_upload_text_main', [
86
86
  _jsx(StyledInteractiveText, { children: t(multiple ? 'file_upload_text_multiple' : 'file_upload_text_one') }, void 0)
87
- ]), "\u00A0"] }), void 0), rtl && icon] }), void 0)] }, void 0));
88
- return (_jsxs(Grid, Object.assign({ container: { rowGap: 1 } }, { children: [label ? (_jsx(FormField, Object.assign({}, { label, labelHidden, id, info, required, disabled, status }, { children: fileInput }), void 0)) : (fileInput), !!files?.length && (_jsx(Grid, Object.assign({ container: {
87
+ ]), "\u00A0"] }, void 0), rtl && icon] }, void 0)] }, void 0));
88
+ return (_jsxs(Grid, { container: { rowGap: 1 }, children: [label ? (_jsx(FormField, { ...{ label, labelHidden, id, info, required, disabled, status }, children: fileInput }, void 0)) : (fileInput), !!files?.length && (_jsx(Flex, { container: {
89
89
  gap: 1,
90
- cols: 'repeat(auto-fill, minmax(20rem, 1fr))'
91
- }, as: 'ul' }, restProps, { children: files.map(({ name, ...file }, index) => {
90
+ direction: 'column'
91
+ }, as: 'ul', ...restProps, children: files.map(({ name, ...file }, index) => {
92
92
  // eslint-disable-next-line react/no-array-index-key
93
- return _jsx(FileUploadItem, Object.assign({ name: name }, file), index);
94
- }) }), void 0))] }), void 0));
93
+ return _jsx(FileUploadItem, { name: name, ...file }, index);
94
+ }) }, void 0))] }, void 0));
95
95
  });
96
96
  const FileInput = forwardRef((props, ref) => {
97
97
  const Override = useOverride('FileInput');
98
98
  if (Override)
99
- return _jsx(Override, Object.assign({}, props, { ref: ref }), void 0);
100
- return _jsx(BaseFileInput, Object.assign({}, props, { ref: ref }), void 0);
99
+ return _jsx(Override, { ...props, ref: ref }, void 0);
100
+ return _jsx(BaseFileInput, { ...props, ref: ref }, void 0);
101
101
  });
102
102
  export default FileInput;
103
103
  //# sourceMappingURL=FileInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileInput.js","sourceRoot":"","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EH,eAAe,SAAS,CAAC","sourcesContent":["import {\n FunctionComponent,\n Ref,\n forwardRef,\n ChangeEvent,\n useCallback,\n PropsWithoutRef,\n DragEvent,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { useOverride, useConsolidatedRef, useI18n, useUID, useDirection } from '../../hooks';\nimport FormControl, { FormControlProps } from '../FormControl';\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Icon, { registerIcon } from '../Icon';\nimport * as paperClipIcon from '../Icon/icons/paper-clip.icon';\nimport FormField from '../FormField';\nimport Grid from '../Grid';\n\nimport FileUploadItem, { FileUploadItemProps } from './FileUploadItem';\n\nregisterIcon(paperClipIcon);\n\ntype FileInputPropsWithDefaults = PropsWithDefaults<FileInputProps>;\n\nexport interface FileInputProps extends BaseProps {\n /**\n * Called when files are added either via the input or drop zone.\n */\n onFilesAdded?: (files: File[]) => void;\n /**\n * Allow multiple files to be selected from the OS specific file browser.\n * NOTE: This does not restrict multiple files from being added via drag and drop.\n * Restrict multi file drag and drop via onFilesAdded and custom info message.\n * @default false\n */\n multiple?: boolean;\n /** An array of files that have been uploaded. */\n files?: FileUploadItemProps[];\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?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Ref for the input element within the component's dom structure. */\n ref?: Ref<HTMLInputElement>;\n}\n\nexport const StyledDropZone = styled(FormControl)<{ dragOver: boolean }>(({ dragOver, theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n min-height: 4rem;\n border-style: dashed;\n cursor: pointer;\n\n ${dragOver &&\n css`\n border-style: solid;\n `}\n `;\n});\n\nexport const StyledFileInput = styled.div<FileInputPropsWithDefaults & ForwardProps>(\n ({ theme }) => {\n return css`\n position: relative;\n\n input {\n ${hideVisually}\n }\n\n input:enabled:focus + ${StyledDropZone} {\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n }\n\n input[hidden] + ${StyledDropZone} {\n display: none;\n }\n `;\n }\n);\n\nStyledFileInput.defaultProps = defaultThemeProp;\n\nconst StyledInteractiveText = styled.span(({ theme }) => {\n return css`\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledInteractiveText.defaultProps = defaultThemeProp;\n\nconst BaseFileInput: FunctionComponent<FileInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileInputProps>, ref: FileInputProps['ref']) => {\n const uid = useUID();\n const {\n id = uid,\n label,\n labelHidden,\n info,\n required = false,\n disabled = false,\n files,\n onFilesAdded,\n multiple = false,\n status,\n ...restProps\n } = props;\n\n const icon = <Icon name='paper-clip' />;\n const inputRef = useConsolidatedRef(ref);\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n onFilesAdded?.(Array.from(e.target.files));\n }\n /**\n * WHY are we doing this?\n * We are not working with the \"value\" prop of the input but rather the File instances that are created.\n * The consumer of this component should manage an array or File(s) and allow for a user to remove a selected file.\n * Since we can not modify the input value of files for browser security reasons,\n * and since setting the files property is less than ideal, we reset/toggle the input to a fresh state after a render.\n * This enables onChange to fire even if the user had just previously selected a file, removed it, and selected it again.\n */\n if (inputRef.current) inputRef.current.value = '';\n },\n [onFilesAdded]\n );\n\n const t = useI18n();\n const [dragOver, setDragOver] = useState(false);\n const { ltr, rtl } = useDirection();\n\n const fileInput = (\n <StyledFileInput>\n <input\n ref={inputRef}\n type='file'\n id={id}\n disabled={disabled}\n onChange={onChange}\n multiple={multiple}\n {...restProps}\n />\n <Flex\n container={{ alignItems: 'center', justify: 'center' }}\n item={{ grow: 1 }}\n as={StyledDropZone}\n dragOver={dragOver}\n onClick={() => {\n inputRef.current?.focus();\n inputRef.current?.click();\n }}\n onDragOver={(e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n }}\n onDragEnter={() => setDragOver(true)}\n onDragLeave={() => setDragOver(false)}\n onDrop={(e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setDragOver(false);\n onFilesAdded?.(Array.from(e.dataTransfer.files));\n }}\n >\n {ltr && icon}\n <Text variant='primary'>\n &nbsp;\n {t('file_upload_text_main', [\n <StyledInteractiveText>\n {t(multiple ? 'file_upload_text_multiple' : 'file_upload_text_one')}\n </StyledInteractiveText>\n ])}\n &nbsp;\n </Text>\n {rtl && icon}\n </Flex>\n </StyledFileInput>\n );\n\n return (\n <Grid container={{ rowGap: 1 }}>\n {label ? (\n <FormField {...{ label, labelHidden, id, info, required, disabled, status }}>\n {fileInput}\n </FormField>\n ) : (\n fileInput\n )}\n {!!files?.length && (\n <Grid\n container={{\n gap: 1,\n cols: 'repeat(auto-fill, minmax(20rem, 1fr))'\n }}\n as='ul'\n {...restProps}\n >\n {files.map(({ name, ...file }, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <FileUploadItem key={index} name={name} {...file} />;\n })}\n </Grid>\n )}\n </Grid>\n );\n }\n);\n\nconst FileInput: typeof BaseFileInput = forwardRef((props, ref) => {\n const Override = useOverride('FileInput');\n if (Override) return <Override {...props} ref={ref} />;\n\n return <BaseFileInput {...props} ref={ref} />;\n});\n\nexport default FileInput;\n"]}
1
+ {"version":3,"file":"FileInput.js","sourceRoot":"","sources":["../../../src/components/File/FileInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAEV,W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ropsWithoutRef,\n DragEvent,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { useOverride, useConsolidatedRef, useI18n, useUID, useDirection } from '../../hooks';\nimport FormControl, { FormControlProps } from '../FormControl';\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Icon, { registerIcon } from '../Icon';\nimport * as paperClipIcon from '../Icon/icons/paper-clip.icon';\nimport FormField from '../FormField';\nimport Grid from '../Grid';\n\nimport FileUploadItem, { FileUploadItemProps } from './FileUploadItem';\n\nregisterIcon(paperClipIcon);\n\ntype FileInputPropsWithDefaults = PropsWithDefaults<FileInputProps>;\n\nexport interface FileInputProps extends BaseProps {\n /**\n * Called when files are added either via the input or drop zone.\n */\n onFilesAdded?: (files: File[]) => void;\n /**\n * Allow multiple files to be selected from the OS specific file browser.\n * NOTE: This does not restrict multiple files from being added via drag and drop.\n * Restrict multi file drag and drop via onFilesAdded and custom info message.\n * @default false\n */\n multiple?: boolean;\n /** An array of files that have been uploaded. */\n files?: FileUploadItemProps[];\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?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Ref for the input element within the component's dom structure. */\n ref?: Ref<HTMLInputElement>;\n}\n\nexport const StyledDropZone = styled(FormControl)<{ dragOver: boolean }>(({ dragOver, theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n min-height: 4rem;\n border-style: dashed;\n cursor: pointer;\n\n ${dragOver &&\n css`\n border-style: solid;\n `}\n `;\n});\n\nexport const StyledFileInput = styled.div<FileInputPropsWithDefaults & ForwardProps>(\n ({ theme }) => {\n return css`\n position: relative;\n\n input {\n ${hideVisually}\n }\n\n input:enabled:focus + ${StyledDropZone} {\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n }\n\n input[hidden] + ${StyledDropZone} {\n display: none;\n }\n `;\n }\n);\n\nStyledFileInput.defaultProps = defaultThemeProp;\n\nconst StyledInteractiveText = styled.span(({ theme }) => {\n return css`\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledInteractiveText.defaultProps = defaultThemeProp;\n\nconst BaseFileInput: FunctionComponent<FileInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileInputProps>, ref: FileInputProps['ref']) => {\n const uid = useUID();\n const {\n id = uid,\n label,\n labelHidden,\n info,\n required = false,\n disabled = false,\n files,\n onFilesAdded,\n multiple = false,\n status,\n ...restProps\n } = props;\n\n const icon = <Icon name='paper-clip' />;\n const inputRef = useConsolidatedRef(ref);\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n onFilesAdded?.(Array.from(e.target.files));\n }\n /**\n * WHY are we doing this?\n * We are not working with the \"value\" prop of the input but rather the File instances that are created.\n * The consumer of this component should manage an array or File(s) and allow for a user to remove a selected file.\n * Since we can not modify the input value of files for browser security reasons,\n * and since setting the files property is less than ideal, we reset/toggle the input to a fresh state after a render.\n * This enables onChange to fire even if the user had just previously selected a file, removed it, and selected it again.\n */\n if (inputRef.current) inputRef.current.value = '';\n },\n [onFilesAdded]\n );\n\n const t = useI18n();\n const [dragOver, setDragOver] = useState(false);\n const { ltr, rtl } = useDirection();\n\n const fileInput = (\n <StyledFileInput>\n <input\n ref={inputRef}\n type='file'\n id={id}\n disabled={disabled}\n onChange={onChange}\n multiple={multiple}\n {...restProps}\n />\n <Flex\n container={{ alignItems: 'center', justify: 'center' }}\n item={{ grow: 1 }}\n as={StyledDropZone}\n dragOver={dragOver}\n onClick={() => {\n inputRef.current?.focus();\n inputRef.current?.click();\n }}\n onDragOver={(e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n }}\n onDragEnter={() => setDragOver(true)}\n onDragLeave={() => setDragOver(false)}\n onDrop={(e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setDragOver(false);\n onFilesAdded?.(Array.from(e.dataTransfer.files));\n }}\n >\n {ltr && icon}\n <Text variant='primary'>\n &nbsp;\n {t('file_upload_text_main', [\n <StyledInteractiveText>\n {t(multiple ? 'file_upload_text_multiple' : 'file_upload_text_one')}\n </StyledInteractiveText>\n ])}\n &nbsp;\n </Text>\n {rtl && icon}\n </Flex>\n </StyledFileInput>\n );\n\n return (\n <Grid container={{ rowGap: 1 }}>\n {label ? (\n <FormField {...{ label, labelHidden, id, info, required, disabled, status }}>\n {fileInput}\n </FormField>\n ) : (\n fileInput\n )}\n {!!files?.length && (\n <Flex\n container={{\n gap: 1,\n direction: 'column'\n }}\n as='ul'\n {...restProps}\n >\n {files.map(({ name, ...file }, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <FileUploadItem key={index} name={name} {...file} />;\n })}\n </Flex>\n )}\n </Grid>\n );\n }\n);\n\nconst FileInput: typeof BaseFileInput = forwardRef((props, ref) => {\n const Override = useOverride('FileInput');\n if (Override) return <Override {...props} ref={ref} />;\n\n return <BaseFileInput {...props} ref={ref} />;\n});\n\nexport default FileInput;\n"]}
@@ -45,7 +45,7 @@ const FileItem = forwardRef((props, ref) => {
45
45
  }, [url, onDownload]);
46
46
  const type = getMimeTypeFromFile(url);
47
47
  const text = name || url;
48
- return (_jsxs(Grid, Object.assign({ as: StyledFileItem, container: { cols: 'auto 1fr' }, ref: ref }, { children: [_jsx(FileVisual, { type: getKindFromMimeType(type ?? ''), disabled: !onPreview, thumbnail: thumbnail, onClick: () => onPreview?.(url), "aria-label": `${t('preview')}: ${text}` }, void 0), _jsx(Button, Object.assign({}, restProps, { variant: 'text', disabled: !onDownload, onClick: onDownloadClick, "aria-label": `${t('download')}: ${text}` }, { children: text }), void 0)] }), void 0));
48
+ return (_jsxs(Grid, { as: StyledFileItem, container: { cols: 'auto 1fr' }, ref: ref, children: [_jsx(FileVisual, { type: getKindFromMimeType(type ?? ''), disabled: !onPreview, thumbnail: thumbnail, onClick: () => onPreview?.(url), "aria-label": `${t('preview')}: ${text}` }, void 0), _jsx(Button, { ...restProps, variant: 'text', disabled: !onDownload, onClick: onDownloadClick, "aria-label": `${t('download')}: ${text}`, children: text }, void 0)] }, void 0));
49
49
  });
50
50
  export default FileItem;
51
51
  //# sourceMappingURL=FileItem.js.map
@@ -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,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Q,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,oBACD,SAAS,IACb,OAAO,EAAC,MAAM,EACd,QAAQ,EAAE,CAAC,UAAU,EACrB,OAAO,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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,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IAEtB,MAAM,IAAI,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,IAAI,IAAI,GAAG,CAAC;IAEzB,OAAO,CACL,MAAC,IAAI,IAAC,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,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,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,UAAU,MAAM,cAAc,CAAC;AAsCtC,MAAM,oBAAoB,GAAG,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;IAC7C,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAExB,OAAO,GAAG,CAAA;8BACkB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;wBACvC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;0BACtC,KAAK,CAAC,IAAI,CAAC,OAAO;GACzC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,cAAc,GAA2C,UAAU,CACvE,CAAC,KAA2C,EAAE,GAA+B,EAAE,EAAE;IAC/E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AAM,CAAC,IAAI;oBACf,OAAO,EAAE,MAAM,CAAC,IAAI;oBACpB,OAAO,EAAE,GAAG,EAAE;wBACZ,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;oBAClB,CAAC;iBACF,CAAC,CAAC;aACJ,WACD,CACH,CAAC;KACH;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,OAAO,QAAQ,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,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,UAAU,MAAM,cAAc,CAAC;AAsCtC,MAAM,oBAAoB,GAAG,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;IAC7C,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAExB,OAAO,GAAG,CAAA;8BACkB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;wBACvC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;0BACtC,KAAK,CAAC,IAAI,CAAC,OAAO;GACzC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,cAAc,GAA2C,UAAU,CACvE,CAAC,KAA2C,EAAE,GAA+B,EAAE,EAAE;IAC/E,MAAM,EACJ,IAAI,EACJ,IAAI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AM,CAAC,IAAI;oBACpB,OAAO,EAAE,GAAG,EAAE;wBACZ,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;oBAClB,CAAC;iBACF,CAAC,CAAC;aACJ,WACD,CACH,CAAC;KACH;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,OAAO,QAAQ,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,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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,OAAO,GAAG,CAAA;wBACY,eAAe,CAAC,SAAS,CAAC;aACrC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK;;mBAElB,cAAc,MAAM,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM;kBAClD,cAAc,MAAM,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM;iCAClC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;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;AAE9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ACR,IAAI,QACJ,KAAK,EAAE,IAAI,KACP;YACF,SAAS;YACT,QAAQ;SACT,aAEA,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,YACF,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"]}
@@ -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,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C;OACrC;;QAEC,IAAI,CAAC,KAAK;YACZ,GAAG,CAAA;sBACa,IAAI,CAAC,KAAK;OACzB;KACF;GACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE;IACtE,OAAO,GAAG,CAAA;MACN,kBAAkB,CAAC,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,CAA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E,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE;IACtE,OAAO,GAAG,CAAA;MACN,kBAAkB,CAAC,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,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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AI,CACd,KAAC,IAAI,kBAAC,EAAE,EAAE,GAAG,GAAG,cAAc,EAAE,EAAE,EAAC,GAAG,gBACnC,WAAW,YACP,CACR,aACI,CACR,EACD,KAAC,IAAI,kBAAC,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,gBACpE,QAAQ,YACJ,EAEN,OAAO,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":"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,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE9C,MAAM,IAAI,GAAiC,UAAU,CACnD,CAAC,KAAiC,EAAE,GAAqB,EAAE,EAAE;IAC3D,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAEjF,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IAErB,OAAO,CACL,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAC1C,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,GAAG,KACJ,SAAS,qBACI,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,sBACrC,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,SAAS,aAE/D,OAAO,EACP,CAAC,OAAO,IAAI,WAAW,CAAC,IAAI,CAC3B,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC7C,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,EAAE,EAAE,GAAG,GAAG,UAAU,EAAE,OAAO,EAAC,IAAI,YACrC,OAAO,WACH,CACR,EACA,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,UA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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,gB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ACT,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,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