@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
@@ -36,7 +36,7 @@ export const StyledSummaryListItem = styled(SummaryItem)(({ theme }) => css `
36
36
  StyledSummaryListItem.defaultProps = defaultThemeProp;
37
37
  export const SummaryListItems = ({ items }) => {
38
38
  return (_jsx("ul", { children: items.map(({ id, actions: itemActions, ...restItemProps }) => {
39
- return (_jsx(StyledSummaryListItem, Object.assign({}, restItemProps, { forwardedAs: 'li', actions: itemActions && _jsx(Actions, { items: itemActions }, void 0) }), id));
39
+ return (_jsx(StyledSummaryListItem, { ...restItemProps, forwardedAs: 'li', actions: itemActions && _jsx(Actions, { items: itemActions }, void 0) }, id));
40
40
  }) }, void 0));
41
41
  };
42
42
  const SummaryList = forwardRef(({ icon, name, count, actions, items, onViewAll, loading, noItemsText, error, ...restProps }, ref) => {
@@ -46,11 +46,11 @@ const SummaryList = forwardRef(({ icon, name, count, actions, items, onViewAll,
46
46
  return (_jsx(Progress, { placement: 'local', message: typeof loading === 'string' ? loading : undefined }, void 0));
47
47
  }
48
48
  if (error) {
49
- return _jsx(ErrorState, Object.assign({}, (error === true ? {} : error)), void 0);
49
+ return _jsx(ErrorState, { ...(error === true ? {} : error) }, void 0);
50
50
  }
51
51
  return items.length > 0 ? (_jsx(SummaryListItems, { items: items }, void 0)) : (_jsx(EmptyState, { message: noItemsText }, void 0));
52
52
  }, [loading, items, noItemsText, error]);
53
- return (_jsxs(Card, Object.assign({ ref: ref }, restProps, { children: [(icon || name || typeof count === 'number' || actions) && (_jsxs(CardHeader, { children: [_jsxs(Flex, Object.assign({ container: { alignItems: 'center', gap: 1 } }, { children: [icon && _jsx(Icon, { name: icon }, void 0), name && _jsx(Text, Object.assign({ variant: 'h2' }, { children: name }), void 0), typeof count === 'number' && _jsx(Count, { children: count }, void 0)] }), void 0), actions && _jsx(Actions, { items: actions }, void 0)] }, void 0)), _jsx(StyledSummaryListContent, Object.assign({ loading: loading }, { children: content }), void 0), !error && typeof count === 'number' && count > items.length && onViewAll && (_jsx(CardFooter, Object.assign({ justify: 'center' }, { children: _jsx(Button, Object.assign({ variant: 'link', "aria-label": name ? t('view_all_noun', [name.toLowerCase()]) : t('view_all'), onClick: onViewAll }, { children: t('view_all') }), void 0) }), void 0))] }), void 0));
53
+ return (_jsxs(Card, { ref: ref, ...restProps, children: [(icon || name || typeof count === 'number' || actions) && (_jsxs(CardHeader, { children: [_jsxs(Flex, { container: { alignItems: 'center', gap: 1 }, children: [icon && _jsx(Icon, { name: icon }, void 0), name && _jsx(Text, { variant: 'h2', children: name }, void 0), typeof count === 'number' && _jsx(Count, { children: count }, void 0)] }, void 0), actions && _jsx(Actions, { items: actions }, void 0)] }, void 0)), _jsx(StyledSummaryListContent, { loading: loading, children: content }, void 0), !error && typeof count === 'number' && count > items.length && onViewAll && (_jsx(CardFooter, { justify: 'center', children: _jsx(Button, { variant: 'link', "aria-label": name ? t('view_all_noun', [name.toLowerCase()]) : t('view_all'), onClick: onViewAll, children: t('view_all') }, void 0) }, void 0))] }, void 0));
54
54
  });
55
55
  export default SummaryList;
56
56
  //# sourceMappingURL=SummaryList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SummaryList.js","sourceRoot":"","sources":["../../../src/components/SummaryList/SummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,OAAO,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,UAA+B,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,WAAiC,MAAM,gBAAgB,CAAC;AAC/D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,UAAU,MAAM,eAAe,CAAC;AAoCvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,UAAU,CACpE,SAAS,CAAC,SAAS,CAAC,CACrB,CACC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;MACvB,OAAO;IACT,GAAG,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S,IAAI,CAC3E,KAAC,UAAU,kBAAC,OAAO,EAAC,QAAQ,gBAC1B,KAAC,MAAM,kBACL,OAAO,EAAC,MAAM,gBACF,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAC3E,OAAO,EAAE,SAAS,gBAEjB,CAAC,CAAC,UAAU,CAAC,YACP,YACE,CACd,aACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, FC, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions from '../Actions';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Count from '../Badges/Count';\nimport Icon from '../Icon';\nimport Card, { CardHeader, CardContent, CardFooter } from '../Card';\nimport EmptyState, { EmptyStateProps } from '../EmptyState';\nimport { ForwardProps, NoChildrenProp, OmitStrict, Action } from '../../types';\nimport { omitProps } from '../../styles';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport SummaryItem, { SummaryItemProps } from '../SummaryItem';\nimport Progress from '../Progress';\nimport Button from '../Button';\nimport ErrorState from '../ErrorState';\nimport type { ErrorStateProps } from '../ErrorState';\n\nexport interface SummaryListProps extends NoChildrenProp {\n /** Name of the utility to be used as its heading along with associated actions and aria attributes. */\n name?: string;\n /** Identifier for the icon within Pega icons. */\n icon?: string;\n /** Integer representing the total count of items for a list utility dataset. */\n count?: number;\n /** Top level actions for the utility. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n /** If the utility is in a state of fetching data. */\n loading?: boolean | string;\n /** An array of SummaryListItem objects to render. Pass an appropriately limited length array with a desired sort order based on design system defaults or config. */\n items: SummaryListItem[];\n /** User click initiated callback for when to show view all modal. List lengths less than the count prop will display a \"View all\" button with this function is bound to. */\n onViewAll?: (callback: Function) => void;\n /** A simple message to display when there are no items. */\n noItemsText?: EmptyStateProps['message'];\n /**\n * Indicate an error occurred while acquiring data for the list.\n * The default error state may be overridden with custom props.\n */\n error?: boolean | ErrorStateProps;\n /** Ref for the SummaryList's root element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport interface SummaryListItem extends OmitStrict<SummaryItemProps, 'actions'>, ForwardProps {\n /** A unique id to represent the item. */\n id: string;\n /** A set of Actions to render alongside the item. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n}\n\nexport const StyledSummaryListContent = styled(CardContent).withConfig<{ loading?: boolean }>(\n omitProps('loading')\n)(\n ({ theme, loading }) => css`\n ${loading &&\n css`\n min-height: 4rem;\n `}\n\n &:not(:last-child) > ul > li:last-child {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListContent.defaultProps = defaultThemeProp;\n\nexport const StyledSummaryListItem: typeof SummaryItem = styled(SummaryItem)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0;\n\n &:not(:last-child) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListItem.defaultProps = defaultThemeProp;\n\nexport const SummaryListItems = ({ items }: Pick<SummaryListProps, 'items'>) => {\n return (\n <ul>\n {items.map(({ id, actions: itemActions, ...restItemProps }) => {\n return (\n <StyledSummaryListItem\n key={id}\n {...restItemProps}\n forwardedAs='li'\n actions={itemActions && <Actions items={itemActions} />}\n />\n );\n })}\n </ul>\n );\n};\n\nconst SummaryList: FC<SummaryListProps & ForwardProps> = forwardRef(\n (\n {\n icon,\n name,\n count,\n actions,\n items,\n onViewAll,\n loading,\n noItemsText,\n error,\n ...restProps\n }: PropsWithoutRef<SummaryListProps>,\n ref: SummaryListProps['ref']\n ) => {\n const t = useI18n();\n\n const content = useMemo(() => {\n if (loading) {\n return (\n <Progress placement='local' message={typeof loading === 'string' ? loading : undefined} />\n );\n }\n\n if (error) {\n return <ErrorState {...(error === true ? {} : error)} />;\n }\n\n return items.length > 0 ? (\n <SummaryListItems items={items} />\n ) : (\n <EmptyState message={noItemsText} />\n );\n }, [loading, items, noItemsText, error]);\n\n return (\n <Card ref={ref} {...restProps}>\n {(icon || name || typeof count === 'number' || actions) && (\n <CardHeader>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {name && <Text variant='h2'>{name}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n {actions && <Actions items={actions} />}\n </CardHeader>\n )}\n\n <StyledSummaryListContent loading={loading}>{content}</StyledSummaryListContent>\n\n {!error && typeof count === 'number' && count > items.length && onViewAll && (\n <CardFooter justify='center'>\n <Button\n variant='link'\n aria-label={name ? t('view_all_noun', [name.toLowerCase()]) : t('view_all')}\n onClick={onViewAll}\n >\n {t('view_all')}\n </Button>\n </CardFooter>\n )}\n </Card>\n );\n }\n);\n\nexport default SummaryList;\n"]}
1
+ {"version":3,"file":"SummaryList.js","sourceRoot":"","sources":["../../../src/components/SummaryList/SummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,OAAO,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,UAA+B,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAA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C5B,IAAI,IAAI,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,IAAI,WAAQ,EACxC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAC,KAAK,cAAE,KAAK,WAAS,YAC/C,EACN,OAAO,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,OAAO,WAAI,YAC5B,CACd,EAED,KAAC,wBAAwB,IAAC,OAAO,EAAE,OAAO,YAAG,OAAO,WAA4B,EAE/E,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,IAAI,SAAS,IAAI,CAC3E,KAAC,UAAU,IAAC,OAAO,EAAC,QAAQ,YAC1B,KAAC,MAAM,IACL,OAAO,EAAC,MAAM,gBACF,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAC3E,OAAO,EAAE,SAAS,YAEjB,CAAC,CAAC,UAAU,CAAC,WACP,WACE,CACd,YACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, FC, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions from '../Actions';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Count from '../Badges/Count';\nimport Icon from '../Icon';\nimport Card, { CardHeader, CardContent, CardFooter } from '../Card';\nimport EmptyState, { EmptyStateProps } from '../EmptyState';\nimport { ForwardProps, NoChildrenProp, OmitStrict, Action } from '../../types';\nimport { omitProps } from '../../styles';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport SummaryItem, { SummaryItemProps } from '../SummaryItem';\nimport Progress from '../Progress';\nimport Button from '../Button';\nimport ErrorState from '../ErrorState';\nimport type { ErrorStateProps } from '../ErrorState';\n\nexport interface SummaryListProps extends NoChildrenProp {\n /** Name of the utility to be used as its heading along with associated actions and aria attributes. */\n name?: string;\n /** Identifier for the icon within Pega icons. */\n icon?: string;\n /** Integer representing the total count of items for a list utility dataset. */\n count?: number;\n /** Top level actions for the utility. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n /** If the utility is in a state of fetching data. */\n loading?: boolean | string;\n /** An array of SummaryListItem objects to render. Pass an appropriately limited length array with a desired sort order based on design system defaults or config. */\n items: SummaryListItem[];\n /** User click initiated callback for when to show view all modal. List lengths less than the count prop will display a \"View all\" button with this function is bound to. */\n onViewAll?: (callback: Function) => void;\n /** A simple message to display when there are no items. */\n noItemsText?: EmptyStateProps['message'];\n /**\n * Indicate an error occurred while acquiring data for the list.\n * The default error state may be overridden with custom props.\n */\n error?: boolean | ErrorStateProps;\n /** Ref for the SummaryList's root element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport interface SummaryListItem extends OmitStrict<SummaryItemProps, 'actions'>, ForwardProps {\n /** A unique id to represent the item. */\n id: string;\n /** A set of Actions to render alongside the item. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n}\n\nexport const StyledSummaryListContent = styled(CardContent).withConfig<{ loading?: boolean }>(\n omitProps('loading')\n)(\n ({ theme, loading }) => css`\n ${loading &&\n css`\n min-height: 4rem;\n `}\n\n &:not(:last-child) > ul > li:last-child {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListContent.defaultProps = defaultThemeProp;\n\nexport const StyledSummaryListItem: typeof SummaryItem = styled(SummaryItem)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0;\n\n &:not(:last-child) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListItem.defaultProps = defaultThemeProp;\n\nexport const SummaryListItems = ({ items }: Pick<SummaryListProps, 'items'>) => {\n return (\n <ul>\n {items.map(({ id, actions: itemActions, ...restItemProps }) => {\n return (\n <StyledSummaryListItem\n key={id}\n {...restItemProps}\n forwardedAs='li'\n actions={itemActions && <Actions items={itemActions} />}\n />\n );\n })}\n </ul>\n );\n};\n\nconst SummaryList: FC<SummaryListProps & ForwardProps> = forwardRef(\n (\n {\n icon,\n name,\n count,\n actions,\n items,\n onViewAll,\n loading,\n noItemsText,\n error,\n ...restProps\n }: PropsWithoutRef<SummaryListProps>,\n ref: SummaryListProps['ref']\n ) => {\n const t = useI18n();\n\n const content = useMemo(() => {\n if (loading) {\n return (\n <Progress placement='local' message={typeof loading === 'string' ? loading : undefined} />\n );\n }\n\n if (error) {\n return <ErrorState {...(error === true ? {} : error)} />;\n }\n\n return items.length > 0 ? (\n <SummaryListItems items={items} />\n ) : (\n <EmptyState message={noItemsText} />\n );\n }, [loading, items, noItemsText, error]);\n\n return (\n <Card ref={ref} {...restProps}>\n {(icon || name || typeof count === 'number' || actions) && (\n <CardHeader>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {name && <Text variant='h2'>{name}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n {actions && <Actions items={actions} />}\n </CardHeader>\n )}\n\n <StyledSummaryListContent loading={loading}>{content}</StyledSummaryListContent>\n\n {!error && typeof count === 'number' && count > items.length && onViewAll && (\n <CardFooter justify='center'>\n <Button\n variant='link'\n aria-label={name ? t('view_all_noun', [name.toLowerCase()]) : t('view_all')}\n onClick={onViewAll}\n >\n {t('view_all')}\n </Button>\n </CardFooter>\n )}\n </Card>\n );\n }\n);\n\nexport default SummaryList;\n"]}
@@ -38,7 +38,7 @@ export const StyledViewAll = styled.div.withConfig(omitProps('loading'))(({ load
38
38
  `}
39
39
  `);
40
40
  const SearchableList = forwardRef(({ loading, actions, items, searchInputProps, ...restProps }, ref) => {
41
- return (_jsxs(StyledViewAll, Object.assign({ ref: ref, loading: loading }, restProps, { children: [!loading && (searchInputProps || actions) && (_jsxs(Flex, Object.assign({ container: { justify: 'between', alignItems: 'center', gap: 2 }, as: StyledToolbar }, { children: [searchInputProps && (_jsx(Flex, Object.assign({ container: { alignItems: 'center', gap: 1 }, item: { grow: 1 } }, { children: _jsx(SearchInput, { onSearchChange: searchInputProps.onSearchChange }, void 0) }), void 0)), actions && _jsx(Actions, { iconOnly: false, items: actions }, void 0)] }), void 0)), loading && _jsx(Progress, { placement: 'local' }, void 0), !loading && (items.length ? _jsx(SummaryList, { items: items }, void 0) : _jsx(EmptyState, {}, void 0))] }), void 0));
41
+ return (_jsxs(StyledViewAll, { ref: ref, loading: loading, ...restProps, children: [!loading && (searchInputProps || actions) && (_jsxs(Flex, { container: { justify: 'between', alignItems: 'center', gap: 2 }, as: StyledToolbar, children: [searchInputProps && (_jsx(Flex, { container: { alignItems: 'center', gap: 1 }, item: { grow: 1 }, children: _jsx(SearchInput, { onSearchChange: searchInputProps.onSearchChange }, void 0) }, void 0)), actions && _jsx(Actions, { iconOnly: false, items: actions }, void 0)] }, void 0)), loading && _jsx(Progress, { placement: 'local' }, void 0), !loading && (items.length ? _jsx(SummaryList, { items: items }, void 0) : _jsx(EmptyState, {}, void 0))] }, void 0));
42
42
  });
43
43
  export default SearchableList;
44
44
  //# sourceMappingURL=ViewAll.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ViewAll.js","sourceRoot":"","sources":["../../../src/components/SummaryList/ViewAll.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,OAAO,CAAC;AAC5C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,WAAW,EAAE,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,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AAE,aAAa,iBACrF,gBAAgB,IAAI,CACnB,KAAC,IAAI,kBAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,gBAClE,KAAC,WAAW,IAAC,cAAc,EAAE,gBAAgB,CAAC,cAAc,WAAI,YAC3D,CACR,EACA,OAAO,IAAI,KAAC,OAAO,IAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,WAAI,aACnD,CACR,EAEA,OAAO,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,WAAG,EACzC,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,WAAI,CAAC,CAAC,CAAC,KAAC,UAAU,aAAG,CAAC,aAC9D,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, Ref, FC } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions from '../Actions';\nimport Flex from '../Flex';\nimport EmptyState from '../EmptyState';\nimport SearchInput, { SearchInputProps, StyledSearchInput } from '../SearchInput';\nimport { defaultThemeProp } from '../../theme';\nimport Progress from '../Progress';\nimport { StyledCard } from '../Card';\nimport { StyledCardContent } from '../Card/CardContent';\nimport { omitProps } from '../../styles';\nimport type { ForwardProps } from '../../types';\n\nimport SummaryList, { SummaryListProps } from './SummaryList';\n\nexport interface ViewAllProps extends Pick<SummaryListProps, 'loading' | 'actions' | 'items'> {\n searchInputProps?: SearchInputProps;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledToolbar = styled.div(({ theme: { base } }) => {\n return css`\n position: sticky;\n top: 0;\n z-index: 1;\n background-color: ${base.palette['primary-background']};\n margin-bottom: ${base.spacing};\n transform: translateY(calc(-0.5 * ${base.spacing}));\n padding: ${base.spacing} 0;\n\n ${StyledSearchInput} {\n flex-grow: 1;\n }\n `;\n});\n\nStyledToolbar.defaultProps = defaultThemeProp;\n\nexport const StyledViewAll = styled.div.withConfig<{ loading: ViewAllProps['loading'] }>(\n omitProps('loading')\n)(\n ({ loading }) => css`\n ${StyledCardContent}:not(${StyledCard} ${StyledCard} > ${StyledCardContent}) {\n padding: 0;\n }\n\n ${loading &&\n css`\n min-height: 8rem;\n `}\n `\n);\n\nconst SearchableList: FC<ViewAllProps & ForwardProps> = forwardRef(\n ({ loading, actions, items, searchInputProps, ...restProps }, ref: ViewAllProps['ref']) => {\n return (\n <StyledViewAll ref={ref} loading={loading} {...restProps}>\n {!loading && (searchInputProps || actions) && (\n <Flex container={{ justify: 'between', alignItems: 'center', gap: 2 }} as={StyledToolbar}>\n {searchInputProps && (\n <Flex container={{ alignItems: 'center', gap: 1 }} item={{ grow: 1 }}>\n <SearchInput onSearchChange={searchInputProps.onSearchChange} />\n </Flex>\n )}\n {actions && <Actions iconOnly={false} items={actions} />}\n </Flex>\n )}\n\n {loading && <Progress placement='local' />}\n {!loading && (items.length ? <SummaryList items={items} /> : <EmptyState />)}\n </StyledViewAll>\n );\n }\n);\n\nexport default SearchableList;\n"]}
1
+ {"version":3,"file":"ViewAll.js","sourceRoot":"","sources":["../../../src/components/SummaryList/ViewAll.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,OAAO,CAAC;AAC5C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,WAAW,EAAE,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE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AAgB,IAAI,CACnB,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,YAClE,KAAC,WAAW,IAAC,cAAc,EAAE,gBAAgB,CAAC,cAAc,WAAI,WAC3D,CACR,EACA,OAAO,IAAI,KAAC,OAAO,IAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,WAAI,YACnD,CACR,EAEA,OAAO,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,WAAG,EACzC,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,WAAI,CAAC,CAAC,CAAC,KAAC,UAAU,aAAG,CAAC,YAC9D,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, Ref, FC } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions from '../Actions';\nimport Flex from '../Flex';\nimport EmptyState from '../EmptyState';\nimport SearchInput, { SearchInputProps, StyledSearchInput } from '../SearchInput';\nimport { defaultThemeProp } from '../../theme';\nimport Progress from '../Progress';\nimport { StyledCard } from '../Card';\nimport { StyledCardContent } from '../Card/CardContent';\nimport { omitProps } from '../../styles';\nimport type { ForwardProps } from '../../types';\n\nimport SummaryList, { SummaryListProps } from './SummaryList';\n\nexport interface ViewAllProps extends Pick<SummaryListProps, 'loading' | 'actions' | 'items'> {\n searchInputProps?: SearchInputProps;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledToolbar = styled.div(({ theme: { base } }) => {\n return css`\n position: sticky;\n top: 0;\n z-index: 1;\n background-color: ${base.palette['primary-background']};\n margin-bottom: ${base.spacing};\n transform: translateY(calc(-0.5 * ${base.spacing}));\n padding: ${base.spacing} 0;\n\n ${StyledSearchInput} {\n flex-grow: 1;\n }\n `;\n});\n\nStyledToolbar.defaultProps = defaultThemeProp;\n\nexport const StyledViewAll = styled.div.withConfig<{ loading: ViewAllProps['loading'] }>(\n omitProps('loading')\n)(\n ({ loading }) => css`\n ${StyledCardContent}:not(${StyledCard} ${StyledCard} > ${StyledCardContent}) {\n padding: 0;\n }\n\n ${loading &&\n css`\n min-height: 8rem;\n `}\n `\n);\n\nconst SearchableList: FC<ViewAllProps & ForwardProps> = forwardRef(\n ({ loading, actions, items, searchInputProps, ...restProps }, ref: ViewAllProps['ref']) => {\n return (\n <StyledViewAll ref={ref} loading={loading} {...restProps}>\n {!loading && (searchInputProps || actions) && (\n <Flex container={{ justify: 'between', alignItems: 'center', gap: 2 }} as={StyledToolbar}>\n {searchInputProps && (\n <Flex container={{ alignItems: 'center', gap: 1 }} item={{ grow: 1 }}>\n <SearchInput onSearchChange={searchInputProps.onSearchChange} />\n </Flex>\n )}\n {actions && <Actions iconOnly={false} items={actions} />}\n </Flex>\n )}\n\n {loading && <Progress placement='local' />}\n {!loading && (items.length ? <SummaryList items={items} /> : <EmptyState />)}\n </StyledViewAll>\n );\n }\n);\n\nexport default SearchableList;\n"]}
@@ -132,7 +132,7 @@ export const StyledSwitch = styled.div ``;
132
132
  const Switch = forwardRef((props, ref) => {
133
133
  const uid = useUID();
134
134
  const { id = uid, label, disabled = false, on = false, onChange, ...restProps } = props;
135
- return (_jsxs(StyledSwitch, { children: [_jsx(SwitchInput, Object.assign({}, restProps, { id: id, type: 'checkbox', role: 'switch', checked: on, "aria-checked": on, disabled: disabled, onChange: onChange, ref: ref }), void 0), _jsxs(Flex, Object.assign({ container: { alignItems: 'center' }, as: SwitchLabel, htmlFor: id }, { children: [label, on && _jsx(Icon, { name: 'check' }, void 0)] }), void 0)] }, void 0));
135
+ return (_jsxs(StyledSwitch, { children: [_jsx(SwitchInput, { ...restProps, id: id, type: 'checkbox', role: 'switch', checked: on, "aria-checked": on, disabled: disabled, onChange: onChange, ref: ref }, void 0), _jsxs(Flex, { container: { alignItems: 'center' }, as: SwitchLabel, htmlFor: id, children: [label, on && _jsx(Icon, { name: 'check' }, void 0)] }, void 0)] }, void 0));
136
136
  });
137
137
  export default Switch;
138
138
  //# sourceMappingURL=Switch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,UAAU,EAA2C,MAAM,OAAO,CAAC;AACzF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,YAAY,CAAC,SAAS,CAAC,CAAC;AA0BxB,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CACrC,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EACJ,UAAU,EAAE,EACV,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,EAAE,EACvF,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;;iCAGmB,KAAK;gBACtB,MAAM;;;;mCAIa,UAAU;kBAC3B,WAAW;;;;YAIjB,UAAU;;uCAEiB,KAAK;6BACf,MAAM;4BACP,MAAM;;;yCAGO,UAAU;+BACpB,WAAW;8B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EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,YACR,EACF,MAAC,IAAI,kBAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,iBACpE,KAAK,EACL,EAAE,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,WAAG,aACvB,YACM,CAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { ChangeEvent, forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually, readableColor } from 'polished';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { FormControlProps } from '../FormControl';\nimport { useDirection, useUID } from '../../hooks';\nimport Flex from '../Flex';\nimport { getHoverColors } from '../../styles';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport { tryCatch } from '../../utils';\n\nregisterIcon(checkIcon);\n\nexport interface SwitchProps 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?: FormControlProps['id'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /**\n * Disables the control.\n * @default false\n */\n disabled?: FormControlProps['disabled'];\n /**\n * Sets checked prop via onChange.\n * @default false\n */\n on?: boolean;\n /** Callback that is triggered when the Switch is toggled. */\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n /** Ref for the input element. */\n ref?: Ref<HTMLInputElement>;\n}\n\nexport const SwitchLabel = styled.label(\n ({\n theme: {\n base,\n components: {\n switch: { width, height, 'touch-width': touchWidth, 'touch-height': touchHeight, off }\n }\n }\n }) => {\n return css`\n position: relative;\n cursor: pointer;\n padding-inline-end: calc(${width} + 0.5rem);\n height: ${height};\n width: 100%;\n\n @media (pointer: coarse) {\n padding-inline-end: calc(${touchWidth} + 0.5rem);\n height: ${touchHeight};\n }\n\n /** Checkmark */\n & > ${StyledIcon} {\n position: absolute;\n inset-inline-end: calc(0.5 * ${width} + 0.25rem);\n height: calc(0.5 * ${height});\n width: calc(0.5 * ${height});\n\n @media (pointer: coarse) {\n inset-inline-end: calc(0.5 * ${touchWidth} + 0.25rem);\n height: calc(0.5 * ${touchHeight});\n width: calc(0.5 * ${touchHeight});\n }\n }\n\n /** Track */\n &::before {\n position: absolute;\n content: '';\n inset-inline-end: 0;\n width: ${width};\n height: ${height};\n background-color: ${off.color};\n transition: background-color calc(0.5 * ${base.animation.speed})\n ${base.animation.timing.ease};\n border-radius: calc(9999 * ${base['border-radius']});\n\n @media (pointer: coarse) {\n width: ${touchWidth};\n height: ${touchHeight};\n }\n }\n\n /** Switch */\n &::after {\n position: absolute;\n content: '';\n inset-inline-end: calc(${width} - ${height} + 0.0625rem);\n height: calc(${height} - 0.125rem);\n width: calc(${height} - 0.125rem);\n background-color: ${base.palette['primary-background']};\n transition: transform calc(0.5 * ${base.animation.speed}) ${base.animation.timing.ease};\n border-radius: calc(9999 * ${base['border-radius']});\n\n @media (pointer: coarse) {\n inset-inline-end: calc(${touchWidth} - ${touchHeight} + 0.0625rem);\n height: calc(${touchHeight} - 0.125rem);\n width: calc(${touchHeight} - 0.125rem);\n }\n }\n `;\n }\n);\n\nSwitchLabel.defaultProps = defaultThemeProp;\n\nexport const SwitchInput = styled.input(\n ({\n theme: {\n base,\n components: {\n 'form-control': {\n ':focus': { 'box-shadow': shadow }\n },\n switch: { height, width, 'touch-height': touchHeight, 'touch-width': touchWidth, on, off }\n }\n }\n }) => {\n const { ltr } = useDirection();\n\n const checkmarkColor = tryCatch(() => readableColor(on.color));\n\n const onHoverColors = getHoverColors(on.color);\n const offHoverColors = getHoverColors(off.color);\n\n return css`\n ${hideVisually}\n\n & + ${SwitchLabel} {\n min-height: ${base['hit-area']['mouse-min']};\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n }\n\n & + ${SwitchLabel} > ${StyledIcon} {\n color: ${checkmarkColor};\n }\n\n &:checked + ${SwitchLabel}::before {\n background-color: ${on.color};\n }\n\n &:checked + ${SwitchLabel}::after {\n transform: translateX(calc((${width} - ${height}) * ${ltr ? '1' : '-1'}));\n\n @media (pointer: coarse) {\n transform: translateX(calc((${touchWidth} - ${touchHeight}) * ${ltr ? '1' : '-1'}));\n }\n }\n\n &:hover + ${SwitchLabel} > ${StyledIcon} {\n color: ${onHoverColors.foreground};\n }\n\n &:hover:checked + ${SwitchLabel}::before {\n background-color: ${onHoverColors.background};\n }\n\n &:hover + ${SwitchLabel}::before {\n background-color: ${offHoverColors.background};\n }\n\n &:focus + ${SwitchLabel}::before {\n box-shadow: ${shadow};\n }\n\n &:disabled + ${SwitchLabel} {\n opacity: ${base['disabled-opacity']};\n }\n `;\n }\n);\n\nSwitchInput.defaultProps = defaultThemeProp;\n\nexport const StyledSwitch = styled.div``;\n\nconst Switch: FunctionComponent<SwitchProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SwitchProps>, ref: SwitchProps['ref']) => {\n const uid = useUID();\n const { id = uid, label, disabled = false, on = false, onChange, ...restProps } = props;\n\n return (\n <StyledSwitch>\n <SwitchInput\n {...restProps}\n id={id}\n type='checkbox'\n role='switch'\n checked={on}\n aria-checked={on}\n disabled={disabled}\n onChange={onChange}\n ref={ref}\n />\n <Flex container={{ alignItems: 'center' }} as={SwitchLabel} htmlFor={id}>\n {label}\n {on && <Icon name='check' />}\n </Flex>\n </StyledSwitch>\n );\n }\n);\n\nexport default Switch;\n"]}
1
+ {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,UAAU,EAA2C,MAAM,OAAO,CAAC;AACzF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,M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kBAIxE,WAAW,MAAM,UAAU;iBAC5B,aAAa,CAAC,UAAU;;;0BAGf,WAAW;4BACT,aAAa,CAAC,UAAU;;;kBAGlC,WAAW;4BACD,cAAc,CAAC,UAAU;;;kBAGnC,WAAW;sBACP,MAAM;;;qBAGP,WAAW;mBACb,IAAI,CAAC,kBAAkB,CAAC;;KAEtC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEzC,MAAM,MAAM,GAAkD,UAAU,CACtE,CAAC,KAAmC,EAAE,GAAuB,EAAE,EAAE;IAC/D,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAExF,OAAO,CACL,MAAC,YAAY,eACX,KAAC,WAAW,OACN,SAAS,EACb,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,UAAU,EACf,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,EAAE,kBACG,EAAE,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,WACR,EACF,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,aACpE,KAAK,EACL,EAAE,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,WAAG,YACvB,YACM,CAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { ChangeEvent, forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually, readableColor } from 'polished';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { FormControlProps } from '../FormControl';\nimport { useDirection, useUID } from '../../hooks';\nimport Flex from '../Flex';\nimport { getHoverColors } from '../../styles';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport { tryCatch } from '../../utils';\n\nregisterIcon(checkIcon);\n\nexport interface SwitchProps 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?: FormControlProps['id'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /**\n * Disables the control.\n * @default false\n */\n disabled?: FormControlProps['disabled'];\n /**\n * Sets checked prop via onChange.\n * @default false\n */\n on?: boolean;\n /** Callback that is triggered when the Switch is toggled. */\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n /** Ref for the input element. */\n ref?: Ref<HTMLInputElement>;\n}\n\nexport const SwitchLabel = styled.label(\n ({\n theme: {\n base,\n components: {\n switch: { width, height, 'touch-width': touchWidth, 'touch-height': touchHeight, off }\n }\n }\n }) => {\n return css`\n position: relative;\n cursor: pointer;\n padding-inline-end: calc(${width} + 0.5rem);\n height: ${height};\n width: 100%;\n\n @media (pointer: coarse) {\n padding-inline-end: calc(${touchWidth} + 0.5rem);\n height: ${touchHeight};\n }\n\n /** Checkmark */\n & > ${StyledIcon} {\n position: absolute;\n inset-inline-end: calc(0.5 * ${width} + 0.25rem);\n height: calc(0.5 * ${height});\n width: calc(0.5 * ${height});\n\n @media (pointer: coarse) {\n inset-inline-end: calc(0.5 * ${touchWidth} + 0.25rem);\n height: calc(0.5 * ${touchHeight});\n width: calc(0.5 * ${touchHeight});\n }\n }\n\n /** Track */\n &::before {\n position: absolute;\n content: '';\n inset-inline-end: 0;\n width: ${width};\n height: ${height};\n background-color: ${off.color};\n transition: background-color calc(0.5 * ${base.animation.speed})\n ${base.animation.timing.ease};\n border-radius: calc(9999 * ${base['border-radius']});\n\n @media (pointer: coarse) {\n width: ${touchWidth};\n height: ${touchHeight};\n }\n }\n\n /** Switch */\n &::after {\n position: absolute;\n content: '';\n inset-inline-end: calc(${width} - ${height} + 0.0625rem);\n height: calc(${height} - 0.125rem);\n width: calc(${height} - 0.125rem);\n background-color: ${base.palette['primary-background']};\n transition: transform calc(0.5 * ${base.animation.speed}) ${base.animation.timing.ease};\n border-radius: calc(9999 * ${base['border-radius']});\n\n @media (pointer: coarse) {\n inset-inline-end: calc(${touchWidth} - ${touchHeight} + 0.0625rem);\n height: calc(${touchHeight} - 0.125rem);\n width: calc(${touchHeight} - 0.125rem);\n }\n }\n `;\n }\n);\n\nSwitchLabel.defaultProps = defaultThemeProp;\n\nexport const SwitchInput = styled.input(\n ({\n theme: {\n base,\n components: {\n 'form-control': {\n ':focus': { 'box-shadow': shadow }\n },\n switch: { height, width, 'touch-height': touchHeight, 'touch-width': touchWidth, on, off }\n }\n }\n }) => {\n const { ltr } = useDirection();\n\n const checkmarkColor = tryCatch(() => readableColor(on.color));\n\n const onHoverColors = getHoverColors(on.color);\n const offHoverColors = getHoverColors(off.color);\n\n return css`\n ${hideVisually}\n\n & + ${SwitchLabel} {\n min-height: ${base['hit-area']['mouse-min']};\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n }\n\n & + ${SwitchLabel} > ${StyledIcon} {\n color: ${checkmarkColor};\n }\n\n &:checked + ${SwitchLabel}::before {\n background-color: ${on.color};\n }\n\n &:checked + ${SwitchLabel}::after {\n transform: translateX(calc((${width} - ${height}) * ${ltr ? '1' : '-1'}));\n\n @media (pointer: coarse) {\n transform: translateX(calc((${touchWidth} - ${touchHeight}) * ${ltr ? '1' : '-1'}));\n }\n }\n\n &:hover + ${SwitchLabel} > ${StyledIcon} {\n color: ${onHoverColors.foreground};\n }\n\n &:hover:checked + ${SwitchLabel}::before {\n background-color: ${onHoverColors.background};\n }\n\n &:hover + ${SwitchLabel}::before {\n background-color: ${offHoverColors.background};\n }\n\n &:focus + ${SwitchLabel}::before {\n box-shadow: ${shadow};\n }\n\n &:disabled + ${SwitchLabel} {\n opacity: ${base['disabled-opacity']};\n }\n `;\n }\n);\n\nSwitchInput.defaultProps = defaultThemeProp;\n\nexport const StyledSwitch = styled.div``;\n\nconst Switch: FunctionComponent<SwitchProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SwitchProps>, ref: SwitchProps['ref']) => {\n const uid = useUID();\n const { id = uid, label, disabled = false, on = false, onChange, ...restProps } = props;\n\n return (\n <StyledSwitch>\n <SwitchInput\n {...restProps}\n id={id}\n type='checkbox'\n role='switch'\n checked={on}\n aria-checked={on}\n disabled={disabled}\n onChange={onChange}\n ref={ref}\n />\n <Flex container={{ alignItems: 'center' }} as={SwitchLabel} htmlFor={id}>\n {label}\n {on && <Icon name='check' />}\n </Flex>\n </StyledSwitch>\n );\n }\n);\n\nexport default Switch;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGjG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAQzE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW,CAAC,OAAO,SAAS,cAAc,GAAG,cAAc;IAC1E,gIAAgI;IAChI,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC;IACjD,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB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GAAG,cAAc,CAAE,SAAQ,SAAS;IAC5F,wDAAwD;IACxD,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAgKD,QAAA,MAAM,KAAK,kGAiEN,YAAY,GAAG,IAAI,CAAC;AAEzB,eAAe,KAAK,CAAC"}
@@ -2,6 +2,7 @@ import { createElement as _createElement } from "react";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { forwardRef } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
+ import { hideVisually } from 'polished';
5
6
  import { defaultThemeProp } from '../../theme';
6
7
  import { calculateFontSize } from '../../styles';
7
8
  import Progress from '../Progress';
@@ -20,11 +21,6 @@ const StyledTable = styled.table(props => {
20
21
  width: 100%;
21
22
  background-color: transparent;
22
23
 
23
- caption {
24
- margin-bottom: ${spacing};
25
- text-align: start;
26
- }
27
-
28
24
  thead {
29
25
  tr th {
30
26
  padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingHeader : '0'} ${table.spacing['horizontal-inner'] ? horizontalSpacing : '0'}`};
@@ -109,11 +105,20 @@ const StyledLoadingCell = styled.td `
109
105
  position: relative;
110
106
  height: 6rem;
111
107
  `;
108
+ const StyledTableWrapper = styled.div `
109
+ /* Setting it on a table element requires 'display: block' which breaks a11y. */
110
+ overflow-x: auto;
111
+ `;
112
+ StyledTableWrapper.defaultProps = defaultThemeProp;
113
+ const StyledTableCaption = styled.caption `
114
+ ${hideVisually}
115
+ `;
116
+ StyledTableCaption.defaultProps = defaultThemeProp;
112
117
  const Table = forwardRef((props, ref) => {
113
118
  const { columns, data = [], hoverHighlight = false, loading = false, loadingMessage = '', title, ...restProps } = props;
114
- return (_jsx(Card, { children: _jsx(CardContent, { children: _jsxs(StyledTable, Object.assign({ ref: ref, hoverHighlight: hoverHighlight }, restProps, { children: [title && (_jsx(Text, Object.assign({ as: 'caption', variant: 'h2' }, { children: title }), void 0)), _jsx("thead", { children: _jsx("tr", { children: columns.map(col => (_createElement(StyledCell, { as: StyledHeaderCell, ...col, scope: 'col', key: col.label }, col.label))) }, void 0) }, void 0), _jsxs("tbody", { children: [loading && (_jsx("tr", { children: _jsx(StyledLoadingCell, Object.assign({ colSpan: columns.length }, { children: _jsx(Progress, { placement: 'local', message: loadingMessage }, void 0) }), void 0) }, void 0)), data.length > 0 &&
115
- !loading &&
116
- data.map(row => (_jsx("tr", { children: columns.map(({ renderer: Renderer, ...col }) => (_createElement(StyledCell, { as: StyledBodyCell, ...col, key: `${col.label}-${row.id}` }, typeof Renderer === 'function' ? _jsx(Renderer, Object.assign({}, row), void 0) : row[Renderer]))) }, row.id))), data.length === 0 && !loading && (_jsx("tr", { children: _jsx(StyledEmptyCell, Object.assign({ colSpan: columns.length }, { children: _jsx(EmptyState, {}, void 0) }), void 0) }, void 0))] }, void 0)] }), void 0) }, void 0) }, void 0));
119
+ return (_jsx(Card, { children: _jsxs(CardContent, { container: { rowGap: 1 }, children: [title && (_jsx(Text, { variant: 'h2', as: 'span', "aria-hidden": true, children: title }, void 0)), _jsx(StyledTableWrapper, { children: _jsxs(StyledTable, { ref: ref, hoverHighlight: hoverHighlight, ...restProps, children: [title && _jsx(StyledTableCaption, { children: title }, void 0), _jsx("thead", { children: _jsx("tr", { children: columns.map(col => (_createElement(StyledCell, { as: StyledHeaderCell, ...col, scope: 'col', key: col.label }, col.label))) }, void 0) }, void 0), _jsxs("tbody", { children: [loading && (_jsx("tr", { children: _jsx(StyledLoadingCell, { colSpan: columns.length, children: _jsx(Progress, { placement: 'local', message: loadingMessage }, void 0) }, void 0) }, void 0)), data.length > 0 &&
120
+ !loading &&
121
+ data.map(row => (_jsx("tr", { children: columns.map(({ renderer: Renderer, ...col }) => (_createElement(StyledCell, { as: StyledBodyCell, ...col, key: `${col.label}-${row.id}` }, typeof Renderer === 'function' ? _jsx(Renderer, { ...row }, void 0) : row[Renderer]))) }, row.id))), data.length === 0 && !loading && (_jsx("tr", { children: _jsx(StyledEmptyCell, { colSpan: columns.length, children: _jsx(EmptyState, {}, void 0) }, void 0) }, void 0))] }, void 0)] }, void 0) }, void 0)] }, void 0) }, void 0));
117
122
  });
118
123
  export default Table;
119
124
  //# sourceMappingURL=Table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAgE,MAAM,OAAO,CAAC;AACjG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAC3D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAmD5C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAiD,KAAK,CAAC,EAAE;IACvF,MAAM,EACJ,cAAc,EACd,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,EAC5C,OAAO,EACR,EACD,UAAU,EAAE,EAAE,KAAK,EAAE,EACtB,EACF,GAAG,KAAK,CAAC;IAEV,MAAM,qBAAqB,GAAG,QAAQ,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WAAI,YACrC,WACjB,CACN,EACA,IAAI,CAAC,MAAM,GAAG,CAAC;gCACd,CAAC,OAAO;gCACR,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACd,uBACG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,CAAC,CAC/C,eAAC,UAAU,IAAC,EAAE,EAAE,cAAc,KAAM,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE,IACnE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAC,QAAQ,oBAAK,GAAG,UAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAC5D,CACd,CAAC,IALK,GAAG,CAAC,EAAE,CAMV,CACN,CAAC,EACH,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAChC,uBACE,KAAC,eAAe,kBAAC,OAAO,EAAE,OAAO,CAAC,MAAM,gBACtC,KAAC,UAAU,aAAG,YACE,WACf,CACN,YACK,aACI,WACF,WACT,CACR,CAAC;AACJ,CAAC,CAEuB,CAAC;AAEzB,eAAe,KAAK,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, ReactNode, ReactElement, ComponentType } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport Progress from '../Progress';\nimport Text from '../Text';\nimport EmptyState from '../EmptyState';\nimport Card, { CardContent } from '../Card';\n\nexport interface DefaultRowData {\n id: string | number;\n}\n\nexport interface ColumnProps<RowData extends DefaultRowData = DefaultRowData> {\n /** Render cell content for a column with a component or by passing a property key on the row object to serve as an accessor. */\n renderer: ComponentType<RowData> | keyof RowData;\n /** The visual label for the column. */\n label: string;\n /**\n * The text alignment of the column header and the row contents for the column.\n * @default \"left\"\n */\n align?: 'left' | 'center' | 'right';\n /**\n * If true, this column will not wrap text on overflow.\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport interface TableProps<RowData extends DefaultRowData = DefaultRowData> extends BaseProps {\n /** The column headers that will structure the Table. */\n columns: ColumnProps<RowData>[];\n /**\n * The content of the Table, represented as an array of objects with key value pairs.\n * @default []\n */\n data?: RowData[];\n /**\n * Should the data rows highlight when the mouse hovers over them.\n * @default false\n */\n hoverHighlight?: boolean;\n /**\n * Indicates if the data to populate the Table is still loading.\n * @default false\n */\n loading?: boolean;\n /** A message to be displayed when Table data is loading. */\n loadingMessage?: string;\n /** The title that will render above the Table if provided. */\n title?: ReactNode;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLTableElement>;\n}\n\ntype TablePropsWithDefaults = PropsWithDefaults<TableProps, 'hoverHighlight' | 'loading'>;\n\nconst StyledTable = styled.table<Pick<TablePropsWithDefaults, 'hoverHighlight'>>(props => {\n const {\n hoverHighlight,\n theme: {\n base: {\n palette: { 'secondary-background': hoverBg },\n spacing\n },\n components: { table }\n }\n } = props;\n\n const verticalSpacingHeader = `calc(${table.header['vertical-spacing']} * ${spacing})`;\n const verticalSpacingBody = `calc(${table.body['vertical-spacing']} * ${spacing})`;\n const horizontalSpacing = `calc(max(${table.header['horizontal-spacing']}, ${table.body['horizontal-spacing']}) * ${spacing})`;\n\n const borderHeader = `${table.header['border-width']} solid ${table.header['border-color']}`;\n const borderBody = `${table.body['border-width']} solid ${table.body['border-color']}`;\n\n return css`\n border-collapse: collapse;\n width: 100%;\n background-color: transparent;\n\n caption {\n margin-bottom: ${spacing};\n text-align: start;\n }\n\n thead {\n tr th {\n padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingHeader : '0'} ${\n table.spacing['horizontal-inner'] ? horizontalSpacing : '0'\n }`};\n border-bottom: ${table.border['horizontal-inner'] ? borderHeader : 'none'};\n border-inline-end: ${table.border['vertical-inner'] ? borderHeader : 'none'};\n }\n\n tr:first-of-type th {\n padding-top: ${table.spacing['vertical-outer'] ? verticalSpacingHeader : '0'};\n border-top: ${table.border['horizontal-outer'] ? borderHeader : 'none'};\n }\n\n tr th:first-of-type {\n padding-inline-start: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-start: ${table.border['vertical-outer'] ? borderHeader : 'none'};\n }\n\n tr th:last-of-type {\n padding-inline-end: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-end: ${table.border['vertical-outer'] ? borderHeader : 'none'};\n }\n }\n\n tbody {\n tr td {\n padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingBody : '0'} ${\n table.spacing['horizontal-inner'] ? horizontalSpacing : '0'\n }`};\n border-bottom: ${table.border['horizontal-inner'] ? borderBody : 'none'};\n border-inline-end: ${table.border['vertical-inner'] ? borderBody : 'none'};\n }\n\n tr:last-of-type td {\n padding-bottom: ${table.spacing['vertical-outer'] ? verticalSpacingBody : '0'};\n border-bottom: ${table.border['horizontal-outer'] ? borderBody : 'none'};\n }\n\n tr td:first-of-type {\n padding-inline-start: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-start: ${table.border['vertical-outer'] ? borderBody : 'none'};\n }\n\n tr td:last-of-type {\n padding-inline-end: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-end: ${table.border['vertical-outer'] ? borderBody : 'none'};\n }\n }\n\n ${hoverHighlight &&\n css`\n tbody tr:hover td,\n tbody tr:focus-within td {\n background-color: ${hoverBg};\n }\n `}\n `;\n});\n\nStyledTable.defaultProps = defaultThemeProp;\n\nconst StyledCell = styled.td<Pick<ColumnProps, 'align' | 'noWrap'>>(\n ({ align, noWrap = false }) => css`\n text-align: ${align || 'left'};\n white-space: ${noWrap ? 'nowrap' : null};\n `\n);\n\nStyledCell.defaultProps = defaultThemeProp;\n\nconst StyledHeaderCell = styled.th(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n table: { header }\n }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${fontSizes[header['font-size'] as FontSize]};\n font-weight: ${header['font-weight']};\n color: ${header['foreground-color']};\n background-color: ${header['background-color']};\n `;\n }\n);\n\nStyledHeaderCell.defaultProps = defaultThemeProp;\n\nconst StyledBodyCell = styled.td(\n ({\n theme: {\n components: {\n table: { body }\n }\n }\n }) => css`\n color: ${body['foreground-color']};\n background-color: ${body['background-color']};\n `\n);\n\nStyledBodyCell.defaultProps = defaultThemeProp;\n\nconst StyledEmptyCell = styled.td`\n padding: calc(2 * ${props => props.theme.base.spacing});\n`;\n\nStyledEmptyCell.defaultProps = defaultThemeProp;\n\nconst StyledLoadingCell = styled.td`\n position: relative;\n height: 6rem;\n`;\n\nconst Table = forwardRef((props: PropsWithoutRef<TableProps>, ref: Ref<HTMLTableElement>) => {\n const {\n columns,\n data = [],\n hoverHighlight = false,\n loading = false,\n loadingMessage = '',\n title,\n ...restProps\n } = props;\n\n return (\n <Card>\n <CardContent>\n <StyledTable ref={ref} hoverHighlight={hoverHighlight} {...restProps}>\n {title && (\n <Text as='caption' variant='h2'>\n {title}\n </Text>\n )}\n <thead>\n <tr>\n {columns.map(col => (\n <StyledCell as={StyledHeaderCell} {...col} scope='col' key={col.label}>\n {col.label}\n </StyledCell>\n ))}\n </tr>\n </thead>\n <tbody>\n {loading && (\n <tr>\n <StyledLoadingCell colSpan={columns.length}>\n <Progress placement='local' message={loadingMessage} />\n </StyledLoadingCell>\n </tr>\n )}\n {data.length > 0 &&\n !loading &&\n data.map(row => (\n <tr key={row.id}>\n {columns.map(({ renderer: Renderer, ...col }) => (\n <StyledCell as={StyledBodyCell} {...col} key={`${col.label}-${row.id}`}>\n {typeof Renderer === 'function' ? <Renderer {...row} /> : row[Renderer]}\n </StyledCell>\n ))}\n </tr>\n ))}\n {data.length === 0 && !loading && (\n <tr>\n <StyledEmptyCell colSpan={columns.length}>\n <EmptyState />\n </StyledEmptyCell>\n </tr>\n )}\n </tbody>\n </StyledTable>\n </CardContent>\n </Card>\n );\n}) as <RowData extends DefaultRowData = DefaultRowData>(\n props: TableProps<RowData> & ForwardProps\n) => ReactElement | null;\n\nexport default Table;\n"]}
1
+ {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAgE,MAAM,OAAO,CAAC;AACjG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAC3D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAmD5C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAiD,KAAK,CAAC,EAAE;IACvF,MAAM,EACJ,cAAc,EACd,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,EAC5C,OAAO,EACR,EACD,UAAU,EAAE,EAAE,KAAK,EAAE,EACtB,EACF,GAAG,KAAK,CAAC;IAEV,MAAM,qBAAqB,GAAG,QAAQ,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,OAAO,GAAG,CAAC;IACvF,MAAM,mBAAmB,GAAG,QAAQ,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,OAAO,GAAG,CAAC;IACnF,MAAM,iBAAiB,GAAG,YAAY,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,oBA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AM,YACxC,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,cAAc,WAAI,WACrC,WACjB,CACN,EACA,IAAI,CAAC,MAAM,GAAG,CAAC;wCACd,CAAC,OAAO;wCACR,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACd,uBACG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,CAAC,CAC/C,eAAC,UAAU,IAAC,EAAE,EAAE,cAAc,KAAM,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE,IACnE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAC,QAAQ,OAAK,GAAG,WAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAC5D,CACd,CAAC,IALK,GAAG,CAAC,EAAE,CAMV,CACN,CAAC,EACH,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAChC,uBACE,KAAC,eAAe,IAAC,OAAO,EAAE,OAAO,CAAC,MAAM,YACtC,KAAC,UAAU,aAAG,WACE,WACf,CACN,YACK,YACI,WACK,YACT,WACT,CACR,CAAC;AACJ,CAAC,CAEuB,CAAC;AAEzB,eAAe,KAAK,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, ReactNode, ReactElement, ComponentType } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport Progress from '../Progress';\nimport Text from '../Text';\nimport EmptyState from '../EmptyState';\nimport Card, { CardContent } from '../Card';\n\nexport interface DefaultRowData {\n id: string | number;\n}\n\nexport interface ColumnProps<RowData extends DefaultRowData = DefaultRowData> {\n /** Render cell content for a column with a component or by passing a property key on the row object to serve as an accessor. */\n renderer: ComponentType<RowData> | keyof RowData;\n /** The visual label for the column. */\n label: string;\n /**\n * The text alignment of the column header and the row contents for the column.\n * @default \"left\"\n */\n align?: 'left' | 'center' | 'right';\n /**\n * If true, this column will not wrap text on overflow.\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport interface TableProps<RowData extends DefaultRowData = DefaultRowData> extends BaseProps {\n /** The column headers that will structure the Table. */\n columns: ColumnProps<RowData>[];\n /**\n * The content of the Table, represented as an array of objects with key value pairs.\n * @default []\n */\n data?: RowData[];\n /**\n * Should the data rows highlight when the mouse hovers over them.\n * @default false\n */\n hoverHighlight?: boolean;\n /**\n * Indicates if the data to populate the Table is still loading.\n * @default false\n */\n loading?: boolean;\n /** A message to be displayed when Table data is loading. */\n loadingMessage?: string;\n /** The title that will render above the Table if provided. */\n title?: ReactNode;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLTableElement>;\n}\n\ntype TablePropsWithDefaults = PropsWithDefaults<TableProps, 'hoverHighlight' | 'loading'>;\n\nconst StyledTable = styled.table<Pick<TablePropsWithDefaults, 'hoverHighlight'>>(props => {\n const {\n hoverHighlight,\n theme: {\n base: {\n palette: { 'secondary-background': hoverBg },\n spacing\n },\n components: { table }\n }\n } = props;\n\n const verticalSpacingHeader = `calc(${table.header['vertical-spacing']} * ${spacing})`;\n const verticalSpacingBody = `calc(${table.body['vertical-spacing']} * ${spacing})`;\n const horizontalSpacing = `calc(max(${table.header['horizontal-spacing']}, ${table.body['horizontal-spacing']}) * ${spacing})`;\n\n const borderHeader = `${table.header['border-width']} solid ${table.header['border-color']}`;\n const borderBody = `${table.body['border-width']} solid ${table.body['border-color']}`;\n\n return css`\n border-collapse: collapse;\n width: 100%;\n background-color: transparent;\n\n thead {\n tr th {\n padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingHeader : '0'} ${\n table.spacing['horizontal-inner'] ? horizontalSpacing : '0'\n }`};\n border-bottom: ${table.border['horizontal-inner'] ? borderHeader : 'none'};\n border-inline-end: ${table.border['vertical-inner'] ? borderHeader : 'none'};\n }\n\n tr:first-of-type th {\n padding-top: ${table.spacing['vertical-outer'] ? verticalSpacingHeader : '0'};\n border-top: ${table.border['horizontal-outer'] ? borderHeader : 'none'};\n }\n\n tr th:first-of-type {\n padding-inline-start: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-start: ${table.border['vertical-outer'] ? borderHeader : 'none'};\n }\n\n tr th:last-of-type {\n padding-inline-end: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-end: ${table.border['vertical-outer'] ? borderHeader : 'none'};\n }\n }\n\n tbody {\n tr td {\n padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingBody : '0'} ${\n table.spacing['horizontal-inner'] ? horizontalSpacing : '0'\n }`};\n border-bottom: ${table.border['horizontal-inner'] ? borderBody : 'none'};\n border-inline-end: ${table.border['vertical-inner'] ? borderBody : 'none'};\n }\n\n tr:last-of-type td {\n padding-bottom: ${table.spacing['vertical-outer'] ? verticalSpacingBody : '0'};\n border-bottom: ${table.border['horizontal-outer'] ? borderBody : 'none'};\n }\n\n tr td:first-of-type {\n padding-inline-start: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-start: ${table.border['vertical-outer'] ? borderBody : 'none'};\n }\n\n tr td:last-of-type {\n padding-inline-end: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-end: ${table.border['vertical-outer'] ? borderBody : 'none'};\n }\n }\n\n ${hoverHighlight &&\n css`\n tbody tr:hover td,\n tbody tr:focus-within td {\n background-color: ${hoverBg};\n }\n `}\n `;\n});\n\nStyledTable.defaultProps = defaultThemeProp;\n\nconst StyledCell = styled.td<Pick<ColumnProps, 'align' | 'noWrap'>>(\n ({ align, noWrap = false }) => css`\n text-align: ${align || 'left'};\n white-space: ${noWrap ? 'nowrap' : null};\n `\n);\n\nStyledCell.defaultProps = defaultThemeProp;\n\nconst StyledHeaderCell = styled.th(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n table: { header }\n }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${fontSizes[header['font-size'] as FontSize]};\n font-weight: ${header['font-weight']};\n color: ${header['foreground-color']};\n background-color: ${header['background-color']};\n `;\n }\n);\n\nStyledHeaderCell.defaultProps = defaultThemeProp;\n\nconst StyledBodyCell = styled.td(\n ({\n theme: {\n components: {\n table: { body }\n }\n }\n }) => css`\n color: ${body['foreground-color']};\n background-color: ${body['background-color']};\n `\n);\n\nStyledBodyCell.defaultProps = defaultThemeProp;\n\nconst StyledEmptyCell = styled.td`\n padding: calc(2 * ${props => props.theme.base.spacing});\n`;\n\nStyledEmptyCell.defaultProps = defaultThemeProp;\n\nconst StyledLoadingCell = styled.td`\n position: relative;\n height: 6rem;\n`;\n\nconst StyledTableWrapper = styled.div`\n /* Setting it on a table element requires 'display: block' which breaks a11y. */\n overflow-x: auto;\n`;\n\nStyledTableWrapper.defaultProps = defaultThemeProp;\n\nconst StyledTableCaption = styled.caption`\n ${hideVisually}\n`;\n\nStyledTableCaption.defaultProps = defaultThemeProp;\n\nconst Table = forwardRef((props: PropsWithoutRef<TableProps>, ref: Ref<HTMLTableElement>) => {\n const {\n columns,\n data = [],\n hoverHighlight = false,\n loading = false,\n loadingMessage = '',\n title,\n ...restProps\n } = props;\n\n return (\n <Card>\n <CardContent container={{ rowGap: 1 }}>\n {title && (\n <Text variant='h2' as='span' aria-hidden>\n {title}\n </Text>\n )}\n <StyledTableWrapper>\n <StyledTable ref={ref} hoverHighlight={hoverHighlight} {...restProps}>\n {title && <StyledTableCaption>{title}</StyledTableCaption>}\n <thead>\n <tr>\n {columns.map(col => (\n <StyledCell as={StyledHeaderCell} {...col} scope='col' key={col.label}>\n {col.label}\n </StyledCell>\n ))}\n </tr>\n </thead>\n <tbody>\n {loading && (\n <tr>\n <StyledLoadingCell colSpan={columns.length}>\n <Progress placement='local' message={loadingMessage} />\n </StyledLoadingCell>\n </tr>\n )}\n {data.length > 0 &&\n !loading &&\n data.map(row => (\n <tr key={row.id}>\n {columns.map(({ renderer: Renderer, ...col }) => (\n <StyledCell as={StyledBodyCell} {...col} key={`${col.label}-${row.id}`}>\n {typeof Renderer === 'function' ? <Renderer {...row} /> : row[Renderer]}\n </StyledCell>\n ))}\n </tr>\n ))}\n {data.length === 0 && !loading && (\n <tr>\n <StyledEmptyCell colSpan={columns.length}>\n <EmptyState />\n </StyledEmptyCell>\n </tr>\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </CardContent>\n </Card>\n );\n}) as <RowData extends DefaultRowData = DefaultRowData>(\n props: TableProps<RowData> & ForwardProps\n) => ReactElement | null;\n\nexport default Table;\n"]}
@@ -139,7 +139,7 @@ export const StyledTab = styled(BareButton) `
139
139
  `;
140
140
  StyledTab.defaultProps = defaultThemeProp;
141
141
  const Tab = forwardRef(({ selected, inverted, content, count, type, disabled, ...restProps }, ref) => {
142
- return (_jsxs(StyledTab, Object.assign({ ref: ref, selected: selected, inverted: inverted, tabType: type, disabled: disabled, type: 'button' }, restProps, { children: [_jsx("span", Object.assign({ "data-content": content }, { children: content }), void 0), count] }), void 0));
142
+ return (_jsxs(StyledTab, { ref: ref, selected: selected, inverted: inverted, tabType: type, disabled: disabled, type: 'button', ...restProps, children: [_jsx("span", { "data-content": content, children: content }, void 0), count] }, void 0));
143
143
  });
144
144
  export default Tab;
145
145
  //# sourceMappingURL=Tab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,UAAU,EAAwB,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,EAAE,EAAe,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EA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E,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,EAA6B,EAC/F,GAA2B,EAC3B,EAAE;IACF,OAAO,CACL,MAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,QAAQ,IACT,SAAS,eAEb,6CAAoB,OAAO,gBAAG,OAAO,YAAQ,EAC5C,KAAK,aACI,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["import { FC, ReactNode, forwardRef, PropsWithoutRef, Ref } from 'react';\nimport styled, { StyledProps, css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils/utils';\nimport { StyledCount } from '../Badges/Count';\nimport { ForwardProps } from '../../types';\nimport BareButton from '../Button/BareButton';\n\nimport { TabsProps } from './Tabs.types';\n\ninterface TabProps {\n /** Indicates if this Tab is active. */\n selected: boolean;\n /**\n * Indicates if the styling of this Tab is inverted.\n * @deprecated\n */\n inverted: boolean;\n /** The text to display as the name of the Tab. */\n content: string;\n /** A number to associate with the Tab. */\n count?: ReactNode;\n /** Determines the direction in which the Tab will render. */\n type: TabsProps['type'];\n /** Disables the tab if true */\n disabled?: boolean;\n}\n\nexport interface StyledTabProps {\n selected: TabProps['selected'];\n inverted: TabProps['inverted'];\n tabType: TabProps['type'];\n}\n\nconst activeStyle = (color: string) => css`\n ::after {\n display: block;\n background-color: ${color};\n }\n`;\n\nconst getHorizontalStyles = ({ selected, theme, inverted }: StyledProps<StyledTabProps>) => {\n const primaryColor = inverted\n ? theme.components.tabs.inverted.foreground\n : theme.components.tabs.base.foreground;\n const lightenedColor = tryCatch(() => transparentize(0.3, primaryColor)) ?? '';\n const { spacing } = theme.base;\n\n return css`\n align-items: center;\n display: flex;\n flex-direction: row;\n height: calc(4 * ${spacing});\n padding: 0 calc(2 * ${spacing});\n border: none;\n\n span:first-of-type {\n color: ${selected ? primaryColor : theme.base.palette['foreground-color']};\n text-transform: uppercase;\n display: inline-block;\n\n ::before {\n content: attr(data-content);\n display: block;\n font-weight: bold;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n ::after {\n background: ${selected ? primaryColor : lightenedColor};\n display: ${selected ? 'block' : 'none'};\n content: '';\n position: absolute;\n height: 0.125rem;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n }\n\n &:focus {\n ${activeStyle(lightenedColor)}\n box-shadow: inset ${theme.base.shadow.focus}\n }\n\n ${StyledCount} {\n margin-inline-start: calc(0.5 * ${spacing});\n }\n `;\n};\n\nconst getVerticalStyles = ({ selected, theme }: StyledProps<StyledTabProps>) => {\n const borderColor = theme.base.palette['border-line'];\n const primaryColor = theme.base.palette.interactive;\n const lightenedColor = tryCatch(() => transparentize(0.5, primaryColor)) ?? '';\n const { spacing } = theme.base;\n\n return css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-style: solid;\n color: ${theme.base.palette['foreground-color']};\n border-width: 0.0625rem 0;\n border-color: ${borderColor};\n height: calc(5.5 * ${spacing});\n margin-top: -0.0625rem;\n padding: 0 calc(2 * ${spacing});\n\n &:first-child {\n border-top: 0.0625rem solid ${borderColor};\n }\n\n ::after {\n content: '';\n position: absolute;\n display: ${selected ? 'block' : 'none'};\n top: 0;\n bottom: 0;\n right: 0;\n width: 0.25rem;\n background: ${primaryColor};\n }\n\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n }\n\n &:focus {\n ${activeStyle(primaryColor)}\n box-shadow: inset 0 0 0 0.0625rem ${primaryColor};\n }\n `;\n};\n\nexport const StyledTab = styled(BareButton)<StyledTabProps>`\n position: relative;\n background: none;\n cursor: pointer;\n\n ${props =>\n props.tabType === 'horizontal' ? getHorizontalStyles(props) : getVerticalStyles(props)}\n ${props =>\n props.selected &&\n css`\n font-weight: bold;\n `}\n white-space: nowrap;\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: ${props => props.theme.base['disabled-opacity']};\n }\n`;\n\nStyledTab.defaultProps = defaultThemeProp;\n\nconst Tab: FC<TabProps & ForwardProps> = forwardRef(\n (\n { selected, inverted, content, count, type, disabled, ...restProps }: PropsWithoutRef<TabProps>,\n ref: Ref<HTMLButtonElement>\n ) => {\n return (\n <StyledTab\n ref={ref}\n selected={selected}\n inverted={inverted}\n tabType={type}\n disabled={disabled}\n type='button'\n {...restProps}\n >\n <span data-content={content}>{content}</span>\n {count}\n </StyledTab>\n );\n }\n);\n\nexport default Tab;\n"]}
1
+ {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,UAAU,EAAwB,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,EAAE,EAAe,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AA4B9C,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,CAAA;;;wBAGlB,KAAK;;CAE5B,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAA+B,EAAE,EAAE;IACzF,MAAM,YAAY,GAAG,QAAQ;QAC3B,C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AC,CACF,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["import { FC, ReactNode, forwardRef, PropsWithoutRef, Ref } from 'react';\nimport styled, { StyledProps, css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils/utils';\nimport { StyledCount } from '../Badges/Count';\nimport { ForwardProps } from '../../types';\nimport BareButton from '../Button/BareButton';\n\nimport { TabsProps } from './Tabs.types';\n\ninterface TabProps {\n /** Indicates if this Tab is active. */\n selected: boolean;\n /**\n * Indicates if the styling of this Tab is inverted.\n * @deprecated\n */\n inverted: boolean;\n /** The text to display as the name of the Tab. */\n content: string;\n /** A number to associate with the Tab. */\n count?: ReactNode;\n /** Determines the direction in which the Tab will render. */\n type: TabsProps['type'];\n /** Disables the tab if true */\n disabled?: boolean;\n}\n\nexport interface StyledTabProps {\n selected: TabProps['selected'];\n inverted: TabProps['inverted'];\n tabType: TabProps['type'];\n}\n\nconst activeStyle = (color: string) => css`\n ::after {\n display: block;\n background-color: ${color};\n }\n`;\n\nconst getHorizontalStyles = ({ selected, theme, inverted }: StyledProps<StyledTabProps>) => {\n const primaryColor = inverted\n ? theme.components.tabs.inverted.foreground\n : theme.components.tabs.base.foreground;\n const lightenedColor = tryCatch(() => transparentize(0.3, primaryColor)) ?? '';\n const { spacing } = theme.base;\n\n return css`\n align-items: center;\n display: flex;\n flex-direction: row;\n height: calc(4 * ${spacing});\n padding: 0 calc(2 * ${spacing});\n border: none;\n\n span:first-of-type {\n color: ${selected ? primaryColor : theme.base.palette['foreground-color']};\n text-transform: uppercase;\n display: inline-block;\n\n ::before {\n content: attr(data-content);\n display: block;\n font-weight: bold;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n ::after {\n background: ${selected ? primaryColor : lightenedColor};\n display: ${selected ? 'block' : 'none'};\n content: '';\n position: absolute;\n height: 0.125rem;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n }\n\n &:focus {\n ${activeStyle(lightenedColor)}\n box-shadow: inset ${theme.base.shadow.focus}\n }\n\n ${StyledCount} {\n margin-inline-start: calc(0.5 * ${spacing});\n }\n `;\n};\n\nconst getVerticalStyles = ({ selected, theme }: StyledProps<StyledTabProps>) => {\n const borderColor = theme.base.palette['border-line'];\n const primaryColor = theme.base.palette.interactive;\n const lightenedColor = tryCatch(() => transparentize(0.5, primaryColor)) ?? '';\n const { spacing } = theme.base;\n\n return css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-style: solid;\n color: ${theme.base.palette['foreground-color']};\n border-width: 0.0625rem 0;\n border-color: ${borderColor};\n height: calc(5.5 * ${spacing});\n margin-top: -0.0625rem;\n padding: 0 calc(2 * ${spacing});\n\n &:first-child {\n border-top: 0.0625rem solid ${borderColor};\n }\n\n ::after {\n content: '';\n position: absolute;\n display: ${selected ? 'block' : 'none'};\n top: 0;\n bottom: 0;\n right: 0;\n width: 0.25rem;\n background: ${primaryColor};\n }\n\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n }\n\n &:focus {\n ${activeStyle(primaryColor)}\n box-shadow: inset 0 0 0 0.0625rem ${primaryColor};\n }\n `;\n};\n\nexport const StyledTab = styled(BareButton)<StyledTabProps>`\n position: relative;\n background: none;\n cursor: pointer;\n\n ${props =>\n props.tabType === 'horizontal' ? getHorizontalStyles(props) : getVerticalStyles(props)}\n ${props =>\n props.selected &&\n css`\n font-weight: bold;\n `}\n white-space: nowrap;\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: ${props => props.theme.base['disabled-opacity']};\n }\n`;\n\nStyledTab.defaultProps = defaultThemeProp;\n\nconst Tab: FC<TabProps & ForwardProps> = forwardRef(\n (\n { selected, inverted, content, count, type, disabled, ...restProps }: PropsWithoutRef<TabProps>,\n ref: Ref<HTMLButtonElement>\n ) => {\n return (\n <StyledTab\n ref={ref}\n selected={selected}\n inverted={inverted}\n tabType={type}\n disabled={disabled}\n type='button'\n {...restProps}\n >\n <span data-content={content}>{content}</span>\n {count}\n </StyledTab>\n );\n }\n);\n\nexport default Tab;\n"]}
@@ -23,7 +23,7 @@ const TabPanel = forwardRef(({ tabId, currentTabId, children, ...restProps }, re
23
23
  }
24
24
  return 0;
25
25
  };
26
- return (_jsx(StyledTabPanel, Object.assign({}, restProps, { current: currentTabId && tabId ? currentTabId === tabId : true, role: 'tabpanel', tabIndex: getTabIndex(), "aria-labelledby": `${tabId}`, id: `${tabId}-panel`, ref: ref }, { children: children }), void 0));
26
+ return (_jsx(StyledTabPanel, { ...restProps, current: currentTabId && tabId ? currentTabId === tabId : true, role: 'tabpanel', tabIndex: getTabIndex(), "aria-labelledby": `${tabId}`, id: `${tabId}-panel`, ref: ref, children: children }, void 0));
27
27
  });
28
28
  TabPanel.defaultProps = defaultProps;
29
29
  export default TabPanel;
@@ -1 +1 @@
1
- {"version":3,"file":"TabPanel.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAkBhD,MAAM,YAAY,GAA2B;IAC3C,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAuB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC7E,OAAO,GAAG,CAAA;;;;;MAKN,CAAC,OAAO;QACV,GAAG,CAAA;;KAEF;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoD,UAAU,CAC1E,CACE,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAkC,EAC/E,GAAyB,EACzB,EAAE;IACF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,YAAY,IAAI,KAAK,EAAE;YACzB,OAAO,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SAC/C;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,OAAO,CACL,KAAC,cAAc,oBACT,SAAS,IACb,OAAO,EAAE,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,EAC9D,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,WAAW,EAAE,qBACN,GAAG,KAAK,EAAE,EAC3B,EAAE,EAAE,GAAG,KAAK,QAAQ,EACpB,GAAG,EAAE,GAAG,gBAEP,QAAQ,YACM,CAClB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;AAErC,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../types';\n\ninterface TabPanelProps {\n /** The id of the Tab that the tab panel is related to. */\n tabId: string;\n /**\n * The current selected value of the tabs. Controls the visibility of the tab panel.\n * The tabsValue must match the tabId in order for the TabPanel to show itself.\n * */\n currentTabId?: string;\n /** Content of the tab panel. */\n children: ReactNode;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst defaultProps: Partial<TabPanelProps> = {\n tabId: ''\n};\n\nexport const StyledTabPanel = styled.div<{ current: boolean }>(({ current }) => {\n return css`\n :focus {\n outline: none;\n }\n\n ${!current &&\n css`\n display: none;\n `}\n `;\n});\n\nconst TabPanel: FunctionComponent<TabPanelProps & ForwardProps> = forwardRef(\n (\n { tabId, currentTabId, children, ...restProps }: PropsWithoutRef<TabPanelProps>,\n ref: TabPanelProps['ref']\n ) => {\n const getTabIndex = () => {\n if (currentTabId && tabId) {\n return currentTabId === tabId ? 0 : undefined;\n }\n return 0;\n };\n return (\n <StyledTabPanel\n {...restProps}\n current={currentTabId && tabId ? currentTabId === tabId : true}\n role='tabpanel'\n tabIndex={getTabIndex()}\n aria-labelledby={`${tabId}`}\n id={`${tabId}-panel`}\n ref={ref}\n >\n {children}\n </StyledTabPanel>\n );\n }\n);\n\nTabPanel.defaultProps = defaultProps;\n\nexport default TabPanel;\n"]}
1
+ {"version":3,"file":"TabPanel.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAkBhD,MAAM,YAAY,GAA2B;IAC3C,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAuB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC7E,OAAO,GAAG,CAAA;;;;;MAKN,CAAC,OAAO;QACV,GAAG,CAAA;;KAEF;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoD,UAAU,CAC1E,CACE,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAkC,EAC/E,GAAyB,EACzB,EAAE;IACF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,YAAY,IAAI,KAAK,EAAE;YACzB,OAAO,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SAC/C;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,OAAO,CACL,KAAC,cAAc,OACT,SAAS,EACb,OAAO,EAAE,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,EAC9D,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,WAAW,EAAE,qBACN,GAAG,KAAK,EAAE,EAC3B,EAAE,EAAE,GAAG,KAAK,QAAQ,EACpB,GAAG,EAAE,GAAG,YAEP,QAAQ,WACM,CAClB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;AAErC,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../types';\n\ninterface TabPanelProps {\n /** The id of the Tab that the tab panel is related to. */\n tabId: string;\n /**\n * The current selected value of the tabs. Controls the visibility of the tab panel.\n * The tabsValue must match the tabId in order for the TabPanel to show itself.\n * */\n currentTabId?: string;\n /** Content of the tab panel. */\n children: ReactNode;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst defaultProps: Partial<TabPanelProps> = {\n tabId: ''\n};\n\nexport const StyledTabPanel = styled.div<{ current: boolean }>(({ current }) => {\n return css`\n :focus {\n outline: none;\n }\n\n ${!current &&\n css`\n display: none;\n `}\n `;\n});\n\nconst TabPanel: FunctionComponent<TabPanelProps & ForwardProps> = forwardRef(\n (\n { tabId, currentTabId, children, ...restProps }: PropsWithoutRef<TabPanelProps>,\n ref: TabPanelProps['ref']\n ) => {\n const getTabIndex = () => {\n if (currentTabId && tabId) {\n return currentTabId === tabId ? 0 : undefined;\n }\n return 0;\n };\n return (\n <StyledTabPanel\n {...restProps}\n current={currentTabId && tabId ? currentTabId === tabId : true}\n role='tabpanel'\n tabIndex={getTabIndex()}\n aria-labelledby={`${tabId}`}\n id={`${tabId}-panel`}\n ref={ref}\n >\n {children}\n </StyledTabPanel>\n );\n }\n);\n\nTabPanel.defaultProps = defaultProps;\n\nexport default TabPanel;\n"]}
@@ -56,12 +56,12 @@ const Tabs = forwardRef(({ tabs = [], type = 'horizontal', currentTabId, onTabCl
56
56
  else {
57
57
  badgeVariant = 'default';
58
58
  }
59
- return (_jsx(Flex, Object.assign({}, restProps, { container: {
59
+ return (_jsx(Flex, { ...restProps, container: {
60
60
  direction: type !== 'horizontal' ? 'column' : undefined
61
- }, item: { grow: 1, shrink: 0 }, as: StyledTabs, ref: ref, type: type, role: 'tablist' }, { children: tabs.map((tab, i) => {
61
+ }, item: { grow: 1, shrink: 0 }, as: StyledTabs, ref: ref, type: type, role: 'tablist', children: tabs.map((tab, i) => {
62
62
  const { href, name, count, id, disabled } = tab;
63
63
  const selected = id === currentTabId;
64
- return (_jsx(Tab, { id: id, "aria-selected": selected, "aria-controls": `${id}-panel`, content: name, count: typeof count === 'number' && (_jsx(Count, Object.assign({ variant: selected ? 'interactive' : badgeVariant }, { children: count }), void 0)), href: href, inverted: inverted || false, selected: selected, onClick: (event) => {
64
+ return (_jsx(Tab, { id: id, "aria-selected": selected, "aria-controls": `${id}-panel`, content: name, count: typeof count === 'number' && (_jsx(Count, { variant: selected ? 'interactive' : badgeVariant, children: count }, void 0)), href: href, inverted: inverted || false, selected: selected, onClick: (event) => {
65
65
  onTabClick?.(id, event);
66
66
  }, role: 'tab', ref: (el) => {
67
67
  tabRefs.current[i] = el;
@@ -72,7 +72,7 @@ const Tabs = forwardRef(({ tabs = [], type = 'horizontal', currentTabId, onTabCl
72
72
  }, onKeyUp: (e) => {
73
73
  changeTabFocus(e, i);
74
74
  }, as: href ? Link : undefined, tabIndex: selected ? undefined : -1, "aria-label": name, type: type, disabled: disabled }, id));
75
- }) }), void 0));
75
+ }) }, void 0));
76
76
  });
77
77
  export default Tabs;
78
78
  //# sourceMappingURL=Tabs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EAGV,MAAM,EACP,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAA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E,CAMP,CACH,CAAC;QACJ,CAAC,CAAC,YACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n FunctionComponent,\n MouseEvent,\n KeyboardEvent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport Link from '../Link';\nimport Count from '../Badges/Count';\nimport { ForwardProps } from '../../types';\n\nimport Tab from './Tab';\nimport { TabsProps } from './Tabs.types';\n\ntype TabItem = TabsProps['tabs'][number];\n\nexport const StyledTabs = styled.div<Partial<TabsProps>>(\n ({ type, theme }) => css`\n position: relative;\n overflow: ${type === 'horizontal' ? 'auto' : 'visible'};\n ${type === 'horizontal' &&\n css`\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n height: max-content;\n `}\n `\n);\n\nStyledTabs.defaultProps = defaultThemeProp;\n\n/**\n * The tabs component will take a list of tab data objects and render out a list of tabs in either vertical or horizontal direction.\n * The tabs component handles which tab is active but will give you a callback function that allows you to make changes when a new tab is activated\n */\nconst Tabs: FunctionComponent<TabsProps & ForwardProps> = forwardRef(\n (\n {\n tabs = [],\n type = 'horizontal',\n currentTabId,\n onTabClick,\n inverted = false,\n ...restProps\n }: PropsWithoutRef<TabsProps>,\n ref: Ref<HTMLElement>\n ) => {\n // Used to keep a reference for every tab in order to focus them with key presses\n const tabRefs = useRef<(HTMLButtonElement | HTMLAnchorElement)[]>([]);\n\n // Handles arrow keypresses for changing the focus\n const changeTabFocus = (event: KeyboardEvent, index: number): void => {\n if (tabRefs.current?.length) {\n const { key } = event;\n if (key === 'ArrowRight' || key === 'ArrowDown') {\n const nextIndex = index + 1 < tabs.length ? index + 1 : 0;\n const nextTab = tabRefs.current[nextIndex] as HTMLButtonElement;\n\n if (!nextTab?.disabled) {\n nextTab?.focus();\n } else {\n changeTabFocus(event, nextIndex);\n }\n } else if (key === 'ArrowLeft' || key === 'ArrowUp') {\n const prevIndex = index === 0 ? tabs.length - 1 : index - 1;\n const prevTab = tabRefs.current[prevIndex] as HTMLButtonElement;\n if (!prevTab?.disabled) {\n prevTab?.focus();\n } else {\n changeTabFocus(event, prevIndex);\n }\n }\n }\n };\n\n let badgeVariant: 'inverted' | 'default';\n if (inverted) {\n badgeVariant = 'inverted';\n } else {\n badgeVariant = 'default';\n }\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: type !== 'horizontal' ? 'column' : undefined\n }}\n item={{ grow: 1, shrink: 0 }}\n as={StyledTabs}\n ref={ref}\n type={type}\n role='tablist'\n >\n {tabs.map((tab: TabItem, i) => {\n const { href, name, count, id, disabled } = tab;\n const selected = id === currentTabId;\n\n return (\n <Tab\n id={id}\n aria-selected={selected}\n aria-controls={`${id}-panel`}\n content={name}\n count={\n typeof count === 'number' && (\n <Count variant={selected ? 'interactive' : badgeVariant}>{count}</Count>\n )\n }\n href={href}\n inverted={inverted || false}\n selected={selected}\n onClick={(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n onTabClick?.(id, event);\n }}\n role='tab'\n ref={(el: HTMLButtonElement | HTMLAnchorElement) => {\n tabRefs.current[i] = el;\n }}\n onKeyDown={(e: KeyboardEvent) => {\n if (['ArrowRight', 'ArrowDown', 'ArrowLeft', 'ArrowUp'].includes(e.key)) {\n e.preventDefault();\n }\n }}\n onKeyUp={(e: KeyboardEvent<any>) => {\n changeTabFocus(e, i);\n }}\n key={id}\n as={href ? Link : undefined}\n tabIndex={selected ? undefined : -1}\n aria-label={name}\n type={type}\n disabled={disabled}\n />\n );\n })}\n </Flex>\n );\n }\n);\n\nexport default Tabs;\n"]}
1
+ {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EAGV,MAAM,EACP,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MA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,EAAE,QAAQ,IALb,EAAE,CAMP,CACH,CAAC;QACJ,CAAC,CAAC,WACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n FunctionComponent,\n MouseEvent,\n KeyboardEvent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport Link from '../Link';\nimport Count from '../Badges/Count';\nimport { ForwardProps } from '../../types';\n\nimport Tab from './Tab';\nimport { TabsProps } from './Tabs.types';\n\ntype TabItem = TabsProps['tabs'][number];\n\nexport const StyledTabs = styled.div<Partial<TabsProps>>(\n ({ type, theme }) => css`\n position: relative;\n overflow: ${type === 'horizontal' ? 'auto' : 'visible'};\n ${type === 'horizontal' &&\n css`\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n height: max-content;\n `}\n `\n);\n\nStyledTabs.defaultProps = defaultThemeProp;\n\n/**\n * The tabs component will take a list of tab data objects and render out a list of tabs in either vertical or horizontal direction.\n * The tabs component handles which tab is active but will give you a callback function that allows you to make changes when a new tab is activated\n */\nconst Tabs: FunctionComponent<TabsProps & ForwardProps> = forwardRef(\n (\n {\n tabs = [],\n type = 'horizontal',\n currentTabId,\n onTabClick,\n inverted = false,\n ...restProps\n }: PropsWithoutRef<TabsProps>,\n ref: Ref<HTMLElement>\n ) => {\n // Used to keep a reference for every tab in order to focus them with key presses\n const tabRefs = useRef<(HTMLButtonElement | HTMLAnchorElement)[]>([]);\n\n // Handles arrow keypresses for changing the focus\n const changeTabFocus = (event: KeyboardEvent, index: number): void => {\n if (tabRefs.current?.length) {\n const { key } = event;\n if (key === 'ArrowRight' || key === 'ArrowDown') {\n const nextIndex = index + 1 < tabs.length ? index + 1 : 0;\n const nextTab = tabRefs.current[nextIndex] as HTMLButtonElement;\n\n if (!nextTab?.disabled) {\n nextTab?.focus();\n } else {\n changeTabFocus(event, nextIndex);\n }\n } else if (key === 'ArrowLeft' || key === 'ArrowUp') {\n const prevIndex = index === 0 ? tabs.length - 1 : index - 1;\n const prevTab = tabRefs.current[prevIndex] as HTMLButtonElement;\n if (!prevTab?.disabled) {\n prevTab?.focus();\n } else {\n changeTabFocus(event, prevIndex);\n }\n }\n }\n };\n\n let badgeVariant: 'inverted' | 'default';\n if (inverted) {\n badgeVariant = 'inverted';\n } else {\n badgeVariant = 'default';\n }\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: type !== 'horizontal' ? 'column' : undefined\n }}\n item={{ grow: 1, shrink: 0 }}\n as={StyledTabs}\n ref={ref}\n type={type}\n role='tablist'\n >\n {tabs.map((tab: TabItem, i) => {\n const { href, name, count, id, disabled } = tab;\n const selected = id === currentTabId;\n\n return (\n <Tab\n id={id}\n aria-selected={selected}\n aria-controls={`${id}-panel`}\n content={name}\n count={\n typeof count === 'number' && (\n <Count variant={selected ? 'interactive' : badgeVariant}>{count}</Count>\n )\n }\n href={href}\n inverted={inverted || false}\n selected={selected}\n onClick={(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n onTabClick?.(id, event);\n }}\n role='tab'\n ref={(el: HTMLButtonElement | HTMLAnchorElement) => {\n tabRefs.current[i] = el;\n }}\n onKeyDown={(e: KeyboardEvent) => {\n if (['ArrowRight', 'ArrowDown', 'ArrowLeft', 'ArrowUp'].includes(e.key)) {\n e.preventDefault();\n }\n }}\n onKeyUp={(e: KeyboardEvent<any>) => {\n changeTabFocus(e, i);\n }}\n key={id}\n as={href ? Link : undefined}\n tabIndex={selected ? undefined : -1}\n aria-label={name}\n type={type}\n disabled={disabled}\n />\n );\n })}\n </Flex>\n );\n }\n);\n\nexport default Tabs;\n"]}
@@ -30,7 +30,7 @@ const Text = forwardRef(({ variant = 'primary', as, ...restProps }, ref) => {
30
30
  // If variant is for a heading, and no as is passed, set as to heading tag.
31
31
  if (!as && /h\d/i.test(variant))
32
32
  as = variant;
33
- return _jsx(StyledText, Object.assign({ ref: ref, variant: variant, as: as }, restProps), void 0);
33
+ return _jsx(StyledText, { ref: ref, variant: variant, as: as, ...restProps }, void 0);
34
34
  });
35
35
  export default Text;
36
36
  //# sourceMappingURL=Text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgC,UAAU,EAAwB,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAoB3D,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAwB,KAAK,CAAC,EAAE;IACnE,MAAM,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,WAAW,EAAE,QAAQ,EACrB,YAAY,EAAE,SAAS,EACvB,OAAO,EAAE,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EACvF,YAAY,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE,EAClD,EACD,UAAU,EAAE,EAAE,IAAI,EAAE,EACrB,EACF,GAAG,KAAK,CAAC;IAEV,IAAI,KAAyB,CAAC;IAE9B,IAAI,MAAM,EAAE;QACV,KAAK,GAAG;YACN,KAAK;YACL,OAAO;YACP,OAAO;SACR,CAAC,MAAM,CAAC,CAAC;KACX;IAED,IAAI,OAAO,KAAK,WAAW,EAAE;QAC3B,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,IAAI,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;KAChF;IAED,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEzD,OAAO,GAAG,CAAA;iBACK,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAa,CAAC;mBAC/C,IAAI,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC;aAClC,KAAK;GACf,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAgD,UAAU,CAClE,CACE,EAAE,OAAO,GAAG,SAAS,EAAE,EAAE,EAAE,GAAG,SAAS,EAA8B,EACrE,GAAqB,EACrB,EAAE;IACF,2EAA2E;IAC3E,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,EAAE,GAAG,OAAkD,CAAC;IACzF,OAAO,KAAC,UAAU,kBAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,IAAM,SAAS,UAAI,CAAC;AAC3E,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, ReactNode, forwardRef, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba as polishedRgba } from 'polished';\n\nimport { BaseProps, ForwardProps, AsProp, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { calculateFontSize, FontSize } from '../../styles';\n\nexport interface TextProps extends BaseProps, AsProp {\n /** Text content. */\n children: ReactNode;\n /**\n * Typographical sizes and styles.\n * @default \"primary\"\n */\n variant?: 'primary' | 'secondary' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n /**\n * Render text with semantic color based on a status.\n */\n status?: 'error' | 'warning' | 'success';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement | HTMLHeadingElement>;\n}\n\ntype TextPropsWithDefaults = PropsWithDefaults<TextProps, 'variant'>;\n\nexport const StyledText = styled.span<TextPropsWithDefaults>(props => {\n const {\n variant,\n status,\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n palette: { 'foreground-color': foregroundColor, urgent: error, warn: warning, success },\n transparency: { 'transparent-2': secondaryAlpha }\n },\n components: { text }\n }\n } = props;\n\n let color: string | undefined;\n\n if (status) {\n color = {\n error,\n warning,\n success\n }[status];\n }\n\n if (variant === 'secondary') {\n color = tryCatch(() => polishedRgba(color ?? foregroundColor, secondaryAlpha));\n }\n\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${fontSizes[text[variant]['font-size'] as FontSize]};\n font-weight: ${text[variant]['font-weight']};\n color: ${color};\n `;\n});\n\nStyledText.defaultProps = defaultThemeProp;\n\nconst Text: FunctionComponent<TextProps & ForwardProps> = forwardRef(\n (\n { variant = 'primary', as, ...restProps }: PropsWithoutRef<TextProps>,\n ref: TextProps['ref']\n ) => {\n // If variant is for a heading, and no as is passed, set as to heading tag.\n if (!as && /h\\d/i.test(variant)) as = variant as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n return <StyledText ref={ref} variant={variant} as={as} {...restProps} />;\n }\n);\n\nexport default Text;\n"]}
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgC,UAAU,EAAwB,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAoB3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GAAG,OAAkD,CAAC;IACzF,OAAO,KAAC,UAAU,IAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAM,SAAS,WAAI,CAAC;AAC3E,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, ReactNode, forwardRef, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba as polishedRgba } from 'polished';\n\nimport { BaseProps, ForwardProps, AsProp, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { calculateFontSize, FontSize } from '../../styles';\n\nexport interface TextProps extends BaseProps, AsProp {\n /** Text content. */\n children: ReactNode;\n /**\n * Typographical sizes and styles.\n * @default \"primary\"\n */\n variant?: 'primary' | 'secondary' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n /**\n * Render text with semantic color based on a status.\n */\n status?: 'error' | 'warning' | 'success';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement | HTMLHeadingElement>;\n}\n\ntype TextPropsWithDefaults = PropsWithDefaults<TextProps, 'variant'>;\n\nexport const StyledText = styled.span<TextPropsWithDefaults>(props => {\n const {\n variant,\n status,\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n palette: { 'foreground-color': foregroundColor, urgent: error, warn: warning, success },\n transparency: { 'transparent-2': secondaryAlpha }\n },\n components: { text }\n }\n } = props;\n\n let color: string | undefined;\n\n if (status) {\n color = {\n error,\n warning,\n success\n }[status];\n }\n\n if (variant === 'secondary') {\n color = tryCatch(() => polishedRgba(color ?? foregroundColor, secondaryAlpha));\n }\n\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${fontSizes[text[variant]['font-size'] as FontSize]};\n font-weight: ${text[variant]['font-weight']};\n color: ${color};\n `;\n});\n\nStyledText.defaultProps = defaultThemeProp;\n\nconst Text: FunctionComponent<TextProps & ForwardProps> = forwardRef(\n (\n { variant = 'primary', as, ...restProps }: PropsWithoutRef<TextProps>,\n ref: TextProps['ref']\n ) => {\n // If variant is for a heading, and no as is passed, set as to heading tag.\n if (!as && /h\\d/i.test(variant)) as = variant as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n return <StyledText ref={ref} variant={variant} as={as} {...restProps} />;\n }\n);\n\nexport default Text;\n"]}
@@ -36,29 +36,29 @@ const TextArea = forwardRef((props, ref) => {
36
36
  resizeTextArea();
37
37
  }
38
38
  }, [onChangeProp, resizeTextArea, hardStop, maxLength]);
39
- const Comp = (_jsx(StyledFormControl, Object.assign({}, {
40
- ref: autoResize ? consolidatedRef : ref,
41
- id,
42
- required,
43
- disabled,
44
- status,
45
- resizable,
46
- maxLength: hardStop ? maxLength : undefined,
47
- ...controlProp,
48
- ...restProps,
49
- onChange,
50
- as: StyledTextArea
51
- }), void 0));
52
- return label || displayCharCount ? (_jsx(FormField, Object.assign({}, {
53
- label,
54
- labelHidden,
55
- id,
56
- info,
57
- status,
58
- charLimitDisplay: displayCharCount && typeof maxLength === 'number' ? (_jsx(Text, Object.assign({ variant: 'secondary', "aria-live": maxLength >= 0 && maxLength - charCount <= 20 ? 'polite' : 'off' }, { children: maxLength >= 0 ? t('x_of_y', [charCount || '0', maxLength]) : charCount }), void 0)) : undefined,
59
- required,
60
- disabled
61
- }, { children: Comp }), void 0)) : (Comp);
39
+ const Comp = (_jsx(StyledFormControl, { ...{
40
+ ref: autoResize ? consolidatedRef : ref,
41
+ id,
42
+ required,
43
+ disabled,
44
+ status,
45
+ resizable,
46
+ maxLength: hardStop ? maxLength : undefined,
47
+ ...controlProp,
48
+ ...restProps,
49
+ onChange,
50
+ as: StyledTextArea
51
+ } }, void 0));
52
+ return label || displayCharCount ? (_jsx(FormField, { ...{
53
+ label,
54
+ labelHidden,
55
+ id,
56
+ info,
57
+ status,
58
+ charLimitDisplay: displayCharCount && typeof maxLength === 'number' ? (_jsx(Text, { variant: 'secondary', "aria-live": maxLength >= 0 && maxLength - charCount <= 20 ? 'polite' : 'off', children: maxLength >= 0 ? t('x_of_y', [charCount || '0', maxLength]) : charCount }, void 0)) : undefined,
59
+ required,
60
+ disabled
61
+ }, children: Comp }, void 0)) : (Comp);
62
62
  });
63
63
  export default TextArea;
64
64
  //# sourceMappingURL=TextArea.js.map