@pega/cosmos-react-core 4.0.0-dev.23.1 → 4.0.0-dev.24.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 (392) hide show
  1. package/lib/components/Actions/Actions.d.ts.map +1 -1
  2. package/lib/components/Actions/Actions.js +1 -1
  3. package/lib/components/Actions/Actions.js.map +1 -1
  4. package/lib/components/AdditionalInfo/AdditionalInfo.d.ts.map +1 -1
  5. package/lib/components/AdditionalInfo/AdditionalInfo.js +3 -2
  6. package/lib/components/AdditionalInfo/AdditionalInfo.js.map +1 -1
  7. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  8. package/lib/components/AppShell/AppHeader.js +1 -1
  9. package/lib/components/AppShell/AppHeader.js.map +1 -1
  10. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  11. package/lib/components/AppShell/AppShell.js +1 -1
  12. package/lib/components/AppShell/AppShell.js.map +1 -1
  13. package/lib/components/AppShell/Operator.d.ts.map +1 -1
  14. package/lib/components/AppShell/Operator.js +1 -1
  15. package/lib/components/AppShell/Operator.js.map +1 -1
  16. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  17. package/lib/components/Avatar/Avatar.js +1 -1
  18. package/lib/components/Avatar/Avatar.js.map +1 -1
  19. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  20. package/lib/components/Backdrop/Backdrop.js +1 -1
  21. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  22. package/lib/components/Badges/Alert.d.ts.map +1 -1
  23. package/lib/components/Badges/Alert.js +1 -1
  24. package/lib/components/Badges/Alert.js.map +1 -1
  25. package/lib/components/Badges/Count.d.ts.map +1 -1
  26. package/lib/components/Badges/Count.js +1 -1
  27. package/lib/components/Badges/Count.js.map +1 -1
  28. package/lib/components/Badges/Selection.d.ts.map +1 -1
  29. package/lib/components/Badges/Selection.js +1 -1
  30. package/lib/components/Badges/Selection.js.map +1 -1
  31. package/lib/components/Badges/Status.d.ts.map +1 -1
  32. package/lib/components/Badges/Status.js +1 -1
  33. package/lib/components/Badges/Status.js.map +1 -1
  34. package/lib/components/Badges/Tag.d.ts.map +1 -1
  35. package/lib/components/Badges/Tag.js +1 -1
  36. package/lib/components/Badges/Tag.js.map +1 -1
  37. package/lib/components/Banner/Banner.d.ts.map +1 -1
  38. package/lib/components/Banner/Banner.js +2 -3
  39. package/lib/components/Banner/Banner.js.map +1 -1
  40. package/lib/components/Boolean/BooleanDisplay.js +1 -1
  41. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  42. package/lib/components/Breadcrumbs/Breadcrumbs.js +1 -1
  43. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  44. package/lib/components/Button/BareButton.js +1 -1
  45. package/lib/components/Button/BareButton.js.map +1 -1
  46. package/lib/components/Button/BareRoleButton.js +1 -1
  47. package/lib/components/Button/BareRoleButton.js.map +1 -1
  48. package/lib/components/Button/Button.d.ts.map +1 -1
  49. package/lib/components/Button/Button.js +1 -1
  50. package/lib/components/Button/Button.js.map +1 -1
  51. package/lib/components/Card/Card.d.ts.map +1 -1
  52. package/lib/components/Card/Card.js +1 -1
  53. package/lib/components/Card/Card.js.map +1 -1
  54. package/lib/components/Card/CardHeader.js +1 -1
  55. package/lib/components/Card/CardHeader.js.map +1 -1
  56. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  57. package/lib/components/Checkbox/Checkbox.js +3 -1
  58. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  59. package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  60. package/lib/components/ColorPicker/ColorPicker.js +1 -1
  61. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  62. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  63. package/lib/components/ComboBox/ComboBox.js +1 -1
  64. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  65. package/lib/components/ComboBox/ComboBoxInput.js +1 -1
  66. package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
  67. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  68. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +1 -1
  69. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  70. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
  71. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +1 -1
  72. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
  73. package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -1
  74. package/lib/components/CompositeInput/CompositeInput.js +1 -1
  75. package/lib/components/CompositeInput/CompositeInput.js.map +1 -1
  76. package/lib/components/CreditCard/CreditCardDisplay.js +1 -1
  77. package/lib/components/CreditCard/CreditCardDisplay.js.map +1 -1
  78. package/lib/components/CreditCard/CreditCardInput.js +1 -1
  79. package/lib/components/CreditCard/CreditCardInput.js.map +1 -1
  80. package/lib/components/Currency/CurrencyDisplay.js +1 -1
  81. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  82. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  83. package/lib/components/Currency/CurrencyInput.js +1 -1
  84. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  85. package/lib/components/DateTime/DateTimeDisplay.js +1 -1
  86. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  87. package/lib/components/DateTime/DurationDisplay.js +1 -1
  88. package/lib/components/DateTime/DurationDisplay.js.map +1 -1
  89. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  90. package/lib/components/DateTime/Input/DateInput.js +1 -1
  91. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  92. package/lib/components/DateTime/Input/DateRangeInput.js +1 -1
  93. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  94. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  95. package/lib/components/DateTime/Input/DateTimeInput.js +1 -1
  96. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  97. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
  98. package/lib/components/DateTime/Input/DayOfWeekInput.js +1 -12
  99. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  100. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
  101. package/lib/components/DateTime/Input/Duration/DurationInput.js +1 -1
  102. package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
  103. package/lib/components/DateTime/Input/MonthInput.js +1 -1
  104. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  105. package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
  106. package/lib/components/DateTime/Input/PartInput.js +1 -1
  107. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  108. package/lib/components/DateTime/Input/QuarterInput.js +1 -1
  109. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
  110. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  111. package/lib/components/DateTime/Input/TimeInput.js +2 -5
  112. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  113. package/lib/components/DateTime/Input/TimeRangeInput.js +1 -1
  114. package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
  115. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  116. package/lib/components/DateTime/Input/WeekInput.js +2 -3
  117. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  118. package/lib/components/DateTime/Input/utils.d.ts +3 -0
  119. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  120. package/lib/components/DateTime/Input/utils.js +11 -0
  121. package/lib/components/DateTime/Input/utils.js.map +1 -1
  122. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  123. package/lib/components/DateTime/Picker/Calendar.js +1 -1
  124. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  125. package/lib/components/DateTime/Picker/Weeks.d.ts.map +1 -1
  126. package/lib/components/DateTime/Picker/Weeks.js +1 -1
  127. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  128. package/lib/components/Dialog/Dialog.d.ts.map +1 -1
  129. package/lib/components/Dialog/Dialog.js +1 -1
  130. package/lib/components/Dialog/Dialog.js.map +1 -1
  131. package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
  132. package/lib/components/Dialog/FormDialog.js +1 -1
  133. package/lib/components/Dialog/FormDialog.js.map +1 -1
  134. package/lib/components/Dialog/InfoDialog.js +1 -1
  135. package/lib/components/Dialog/InfoDialog.js.map +1 -1
  136. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  137. package/lib/components/Drawer/Drawer.js +1 -1
  138. package/lib/components/Drawer/Drawer.js.map +1 -1
  139. package/lib/components/Email/EmailDisplay.js +1 -1
  140. package/lib/components/Email/EmailDisplay.js.map +1 -1
  141. package/lib/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  142. package/lib/components/EmojiPicker/EmojiPicker.js +1 -1
  143. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  144. package/lib/components/EmptyState/EmptyState.js +1 -1
  145. package/lib/components/EmptyState/EmptyState.js.map +1 -1
  146. package/lib/components/ErrorState/ErrorState.js +1 -1
  147. package/lib/components/ErrorState/ErrorState.js.map +1 -1
  148. package/lib/components/ExpandCollapse/ExpandCollapse.js +1 -1
  149. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  150. package/lib/components/FieldGroup/FieldGroup.js +1 -1
  151. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  152. package/lib/components/FieldGroup/FieldGroupList.js +1 -1
  153. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  154. package/lib/components/FieldValueList/FieldValueList.js +1 -1
  155. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  156. package/lib/components/File/FileDisplay.js +1 -1
  157. package/lib/components/File/FileDisplay.js.map +1 -1
  158. package/lib/components/File/FileInput.d.ts.map +1 -1
  159. package/lib/components/File/FileInput.js +1 -1
  160. package/lib/components/File/FileInput.js.map +1 -1
  161. package/lib/components/File/FileItem.d.ts.map +1 -1
  162. package/lib/components/File/FileItem.js +1 -1
  163. package/lib/components/File/FileItem.js.map +1 -1
  164. package/lib/components/File/FileUploadItem.d.ts.map +1 -1
  165. package/lib/components/File/FileUploadItem.js +1 -1
  166. package/lib/components/File/FileUploadItem.js.map +1 -1
  167. package/lib/components/File/FileVisual.d.ts.map +1 -1
  168. package/lib/components/File/FileVisual.js +1 -1
  169. package/lib/components/File/FileVisual.js.map +1 -1
  170. package/lib/components/Flex/Flex.d.ts.map +1 -1
  171. package/lib/components/Flex/Flex.js +1 -1
  172. package/lib/components/Flex/Flex.js.map +1 -1
  173. package/lib/components/Form/Form.d.ts.map +1 -1
  174. package/lib/components/Form/Form.js +1 -1
  175. package/lib/components/Form/Form.js.map +1 -1
  176. package/lib/components/FormControl/FormControl.js +1 -1
  177. package/lib/components/FormControl/FormControl.js.map +1 -1
  178. package/lib/components/FormField/FormField.d.ts.map +1 -1
  179. package/lib/components/FormField/FormField.js +1 -1
  180. package/lib/components/FormField/FormField.js.map +1 -1
  181. package/lib/components/FormField/index.d.ts +1 -1
  182. package/lib/components/FormField/index.d.ts.map +1 -1
  183. package/lib/components/FormField/index.js +1 -1
  184. package/lib/components/FormField/index.js.map +1 -1
  185. package/lib/components/Grid/Grid.d.ts.map +1 -1
  186. package/lib/components/Grid/Grid.js +1 -1
  187. package/lib/components/Grid/Grid.js.map +1 -1
  188. package/lib/components/HTML/HTML.d.ts.map +1 -1
  189. package/lib/components/HTML/HTML.js +1 -1
  190. package/lib/components/HTML/HTML.js.map +1 -1
  191. package/lib/components/Icon/Icon.d.ts.map +1 -1
  192. package/lib/components/Icon/Icon.js +1 -1
  193. package/lib/components/Icon/Icon.js.map +1 -1
  194. package/lib/components/Icon/iconNames.d.ts +1 -1
  195. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  196. package/lib/components/Icon/iconNames.js +1 -0
  197. package/lib/components/Icon/iconNames.js.map +1 -1
  198. package/lib/components/Icon/icons/live-transcript.icon.d.ts +5 -0
  199. package/lib/components/Icon/icons/live-transcript.icon.d.ts.map +1 -0
  200. package/lib/components/Icon/icons/live-transcript.icon.js +7 -0
  201. package/lib/components/Icon/icons/live-transcript.icon.js.map +1 -0
  202. package/lib/components/Icon/streamline-icons/code-search.icon.d.ts.map +1 -1
  203. package/lib/components/Icon/streamline-icons/code-search.icon.js +1 -1
  204. package/lib/components/Icon/streamline-icons/code-search.icon.js.map +1 -1
  205. package/lib/components/Icon/streamline-icons/copy.icon.d.ts +5 -0
  206. package/lib/components/Icon/streamline-icons/copy.icon.d.ts.map +1 -0
  207. package/lib/components/Icon/streamline-icons/copy.icon.js +7 -0
  208. package/lib/components/Icon/streamline-icons/copy.icon.js.map +1 -0
  209. package/lib/components/Icon/streamline-icons/search.icon.d.ts.map +1 -1
  210. package/lib/components/Icon/streamline-icons/search.icon.js +1 -1
  211. package/lib/components/Icon/streamline-icons/search.icon.js.map +1 -1
  212. package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
  213. package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
  214. package/lib/components/Icon/streamlineIconNames.js +1 -0
  215. package/lib/components/Icon/streamlineIconNames.js.map +1 -1
  216. package/lib/components/IconPicker/IconPicker.js +1 -1
  217. package/lib/components/IconPicker/IconPicker.js.map +1 -1
  218. package/lib/components/Image/Image.d.ts.map +1 -1
  219. package/lib/components/Image/Image.js +1 -1
  220. package/lib/components/Image/Image.js.map +1 -1
  221. package/lib/components/Input/Input.d.ts.map +1 -1
  222. package/lib/components/Input/Input.js +1 -1
  223. package/lib/components/Input/Input.js.map +1 -1
  224. package/lib/components/Label/Label.d.ts.map +1 -1
  225. package/lib/components/Label/Label.js +1 -1
  226. package/lib/components/Label/Label.js.map +1 -1
  227. package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
  228. package/lib/components/Lightbox/Lightbox.js +1 -1
  229. package/lib/components/Lightbox/Lightbox.js.map +1 -1
  230. package/lib/components/Link/Link.d.ts.map +1 -1
  231. package/lib/components/Link/Link.js +3 -4
  232. package/lib/components/Link/Link.js.map +1 -1
  233. package/lib/components/List/CommaSeparatedList.js +1 -1
  234. package/lib/components/List/CommaSeparatedList.js.map +1 -1
  235. package/lib/components/List/List.d.ts.map +1 -1
  236. package/lib/components/List/List.js +1 -1
  237. package/lib/components/List/List.js.map +1 -1
  238. package/lib/components/List/OrderedList.d.ts.map +1 -1
  239. package/lib/components/List/OrderedList.js +3 -1
  240. package/lib/components/List/OrderedList.js.map +1 -1
  241. package/lib/components/List/UnorderedList.d.ts.map +1 -1
  242. package/lib/components/List/UnorderedList.js +3 -1
  243. package/lib/components/List/UnorderedList.js.map +1 -1
  244. package/lib/components/ListToolbar/ListToolbar.js +1 -1
  245. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  246. package/lib/components/Location/LocationDisplay.js +1 -1
  247. package/lib/components/Location/LocationDisplay.js.map +1 -1
  248. package/lib/components/Location/LocationInput.d.ts.map +1 -1
  249. package/lib/components/Location/LocationInput.js +1 -1
  250. package/lib/components/Location/LocationInput.js.map +1 -1
  251. package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
  252. package/lib/components/Menu/FlyoutMenuList.js +1 -1
  253. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  254. package/lib/components/Menu/Menu.d.ts.map +1 -1
  255. package/lib/components/Menu/Menu.js +1 -1
  256. package/lib/components/Menu/Menu.js.map +1 -1
  257. package/lib/components/Menu/MenuList.js +1 -1
  258. package/lib/components/Menu/MenuList.js.map +1 -1
  259. package/lib/components/MenuButton/MenuButton.js +1 -1
  260. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  261. package/lib/components/MetaList/MetaList.d.ts.map +1 -1
  262. package/lib/components/MetaList/MetaList.js +1 -1
  263. package/lib/components/MetaList/MetaList.js.map +1 -1
  264. package/lib/components/Modal/DockedModals.d.ts.map +1 -1
  265. package/lib/components/Modal/DockedModals.js +1 -1
  266. package/lib/components/Modal/DockedModals.js.map +1 -1
  267. package/lib/components/Modal/Modal.d.ts.map +1 -1
  268. package/lib/components/Modal/Modal.js +2 -5
  269. package/lib/components/Modal/Modal.js.map +1 -1
  270. package/lib/components/MultiStepForm/MultiStepForm.js +1 -1
  271. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  272. package/lib/components/Number/NumberDisplay.js +1 -1
  273. package/lib/components/Number/NumberDisplay.js.map +1 -1
  274. package/lib/components/Number/NumberInput.js +1 -1
  275. package/lib/components/Number/NumberInput.js.map +1 -1
  276. package/lib/components/Number/NumberRangeInput.js +1 -1
  277. package/lib/components/Number/NumberRangeInput.js.map +1 -1
  278. package/lib/components/PageTemplates/CategorySubPage.js +1 -1
  279. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  280. package/lib/components/PageTemplates/DashboardPage.js +2 -2
  281. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  282. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  283. package/lib/components/PageTemplates/PageTemplates.js +11 -11
  284. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  285. package/lib/components/Paragraph/ParagraphDisplay.js +1 -1
  286. package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -1
  287. package/lib/components/Phone/PhoneDisplay.js +1 -1
  288. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  289. package/lib/components/Phone/PhoneInput.js +1 -1
  290. package/lib/components/Phone/PhoneInput.js.map +1 -1
  291. package/lib/components/Popover/Popover.d.ts.map +1 -1
  292. package/lib/components/Popover/Popover.js +1 -1
  293. package/lib/components/Popover/Popover.js.map +1 -1
  294. package/lib/components/Progress/Bar.d.ts.map +1 -1
  295. package/lib/components/Progress/Bar.js +1 -1
  296. package/lib/components/Progress/Bar.js.map +1 -1
  297. package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
  298. package/lib/components/Progress/Ellipsis.js +1 -1
  299. package/lib/components/Progress/Ellipsis.js.map +1 -1
  300. package/lib/components/Progress/Progress.d.ts.map +1 -1
  301. package/lib/components/Progress/Progress.js +1 -1
  302. package/lib/components/Progress/Progress.js.map +1 -1
  303. package/lib/components/Progress/Ring.d.ts.map +1 -1
  304. package/lib/components/Progress/Ring.js +1 -1
  305. package/lib/components/Progress/Ring.js.map +1 -1
  306. package/lib/components/QRCode/QRCode.d.ts.map +1 -1
  307. package/lib/components/QRCode/QRCode.js +1 -1
  308. package/lib/components/QRCode/QRCode.js.map +1 -1
  309. package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
  310. package/lib/components/RadioButton/RadioButton.js +3 -1
  311. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  312. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  313. package/lib/components/RadioCheck/RadioCheck.js +15 -5
  314. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  315. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  316. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +1 -1
  317. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  318. package/lib/components/Rating/Rating.d.ts.map +1 -1
  319. package/lib/components/Rating/Rating.js +3 -6
  320. package/lib/components/Rating/Rating.js.map +1 -1
  321. package/lib/components/SearchInput/SearchInput.js +1 -1
  322. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  323. package/lib/components/Select/Select.d.ts.map +1 -1
  324. package/lib/components/Select/Select.js +1 -1
  325. package/lib/components/Select/Select.js.map +1 -1
  326. package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
  327. package/lib/components/Sentiment/Sentiment.js +1 -1
  328. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  329. package/lib/components/Slider/Slider.d.ts.map +1 -1
  330. package/lib/components/Slider/Slider.js +1 -1
  331. package/lib/components/Slider/Slider.js.map +1 -1
  332. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  333. package/lib/components/Slider/Slider.styles.js +3 -3
  334. package/lib/components/Slider/Slider.styles.js.map +1 -1
  335. package/lib/components/SummaryItem/SummaryItem.js +1 -1
  336. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  337. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  338. package/lib/components/SummaryList/SummaryList.js +1 -1
  339. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  340. package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
  341. package/lib/components/SummaryList/ViewAll.js +1 -1
  342. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  343. package/lib/components/Switch/Switch.d.ts.map +1 -1
  344. package/lib/components/Switch/Switch.js +1 -1
  345. package/lib/components/Switch/Switch.js.map +1 -1
  346. package/lib/components/Table/Table.d.ts.map +1 -1
  347. package/lib/components/Table/Table.js +1 -1
  348. package/lib/components/Table/Table.js.map +1 -1
  349. package/lib/components/Tabs/Tab.d.ts +2 -0
  350. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  351. package/lib/components/Tabs/Tab.js +19 -3
  352. package/lib/components/Tabs/Tab.js.map +1 -1
  353. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  354. package/lib/components/Tabs/TabPanel.js +1 -1
  355. package/lib/components/Tabs/TabPanel.js.map +1 -1
  356. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  357. package/lib/components/Tabs/Tabs.js +3 -3
  358. package/lib/components/Tabs/Tabs.js.map +1 -1
  359. package/lib/components/Tabs/Tabs.types.d.ts +2 -0
  360. package/lib/components/Tabs/Tabs.types.d.ts.map +1 -1
  361. package/lib/components/Tabs/Tabs.types.js.map +1 -1
  362. package/lib/components/Text/Text.d.ts.map +1 -1
  363. package/lib/components/Text/Text.js +1 -1
  364. package/lib/components/Text/Text.js.map +1 -1
  365. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  366. package/lib/components/TextArea/TextArea.js +1 -1
  367. package/lib/components/TextArea/TextArea.js.map +1 -1
  368. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  369. package/lib/components/Toaster/Toaster.js +1 -1
  370. package/lib/components/Toaster/Toaster.js.map +1 -1
  371. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  372. package/lib/components/Tooltip/Tooltip.js +1 -1
  373. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  374. package/lib/components/Tree/StandardTree.js +2 -2
  375. package/lib/components/Tree/StandardTree.js.map +1 -1
  376. package/lib/components/Tree/Tree.d.ts.map +1 -1
  377. package/lib/components/Tree/Tree.js +2 -2
  378. package/lib/components/Tree/Tree.js.map +1 -1
  379. package/lib/components/URL/URLDisplay.js +1 -1
  380. package/lib/components/URL/URLDisplay.js.map +1 -1
  381. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.d.ts.map +1 -1
  382. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js +3 -1
  383. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js.map +1 -1
  384. package/lib/hooks/useI18n.d.ts +22 -15
  385. package/lib/hooks/useI18n.d.ts.map +1 -1
  386. package/lib/i18n/default.d.ts +22 -15
  387. package/lib/i18n/default.d.ts.map +1 -1
  388. package/lib/i18n/default.js +25 -17
  389. package/lib/i18n/default.js.map +1 -1
  390. package/lib/i18n/i18n.d.ts +22 -15
  391. package/lib/i18n/i18n.d.ts.map +1 -1
  392. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Sentiment.js","sourceRoot":"","sources":["../../../src/components/Sentiment/Sentiment.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,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yBAAO,MAAM,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,GAAQ,IACpE,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../Flex';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport Icon, { StyledIcon } from '../Icon';\n\nexport interface SentimentProps extends BaseProps, NoChildrenProp {\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Variant of the sentiment */\n variant: 'positive' | 'neutral' | 'negative';\n /** Flag that indicates if label needs to be hidden\n * @default false\n */\n labelHidden?: boolean;\n /** Labels for different sentiment variants. If not supplied default labels will be shown */\n labels?: {\n [variant in SentimentProps['variant']]?: string;\n };\n /** Icons for different sentiment variants. If not supplied default icons will be shown */\n icons?: {\n [variant in SentimentProps['variant']]?: string;\n };\n /** Aria label for screen readers. */\n 'aria-label'?: string;\n}\n\nconst defaultIcons: SentimentProps['icons'] = {\n negative: 'face-sad',\n positive: 'face-happy',\n neutral: 'face-blank'\n};\n\nexport const StyledSentiment = styled.div<SentimentProps>(props => {\n const { theme, variant } = props;\n return css`\n > ${StyledIcon} {\n color: ${theme.components.sentiment[variant].color};\n }\n `;\n});\n\nStyledSentiment.defaultProps = defaultThemeProp;\n\nconst Sentiment: FunctionComponent<SentimentProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SentimentProps>, ref: SentimentProps['ref']) => {\n const t = useI18n();\n\n const defaultLabels: SentimentProps['labels'] = {\n negative: t('sentiment_negative'),\n positive: t('sentiment_positive'),\n neutral: t('sentiment_neutral')\n };\n\n const {\n 'aria-label': ariaLabel,\n variant,\n labelHidden = false,\n labels = {},\n icons = {},\n ...restProps\n } = props;\n\n return (\n <Flex\n aria-label={ariaLabel}\n ref={ref}\n variant={variant}\n role='img'\n {...restProps}\n as={StyledSentiment}\n container={{ gap: 1 }}\n >\n <Icon aria-hidden='true' name={icons[variant] || defaultIcons[variant]!} />\n {!labelHidden && <span>{labels[variant] || defaultLabels[variant]}</span>}\n </Flex>\n );\n }\n);\n\nexport default Sentiment;\n"]}
1
+ {"version":3,"file":"Sentiment.js","sourceRoot":"","sources":["../../../src/components/Sentiment/Sentiment.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAuB3C,MAAM,YAAY,GAA4B;IAC5C,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAiB,KAAK,CAAC,EAAE;IAChE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACjC,OAAO,GAAG,CAAA;QACJ,UAAU;eACH,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK;;GAErD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,SAAS,GAAqD,UAAU,CAAC,SAAS,SAAS,CAC/F,KAAsC,EACtC,GAA0B;IAE1B,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,aAAa,GAA6B;QAC9C,QAAQ,EAAE,CAAC,CAAC,oBAAoB,CAAC;QACjC,QAAQ,EAAE,CAAC,CAAC,oBAAoB,CAAC;QACjC,OAAO,EAAE,CAAC,CAAC,mBAAmB,CAAC;KAChC,CAAC;IAEF,MAAM,EACJ,YAAY,EAAE,SAAS,EACvB,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,MAAM,GAAG,EAAE,EACX,KAAK,GAAG,EAAE,EACV,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,MAAC,IAAI,kBACS,SAAS,EACrB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,KAAK,KACN,SAAS,EACb,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,aAErB,KAAC,IAAI,mBAAa,MAAM,EAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,OAAO,CAAE,GAAI,EAC1E,CAAC,WAAW,IAAI,yBAAO,MAAM,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,GAAQ,IACpE,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../Flex';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport Icon, { StyledIcon } from '../Icon';\n\nexport interface SentimentProps extends BaseProps, NoChildrenProp {\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Variant of the sentiment */\n variant: 'positive' | 'neutral' | 'negative';\n /** Flag that indicates if label needs to be hidden\n * @default false\n */\n labelHidden?: boolean;\n /** Labels for different sentiment variants. If not supplied default labels will be shown */\n labels?: {\n [variant in SentimentProps['variant']]?: string;\n };\n /** Icons for different sentiment variants. If not supplied default icons will be shown */\n icons?: {\n [variant in SentimentProps['variant']]?: string;\n };\n /** Aria label for screen readers. */\n 'aria-label'?: string;\n}\n\nconst defaultIcons: SentimentProps['icons'] = {\n negative: 'face-sad',\n positive: 'face-happy',\n neutral: 'face-blank'\n};\n\nexport const StyledSentiment = styled.div<SentimentProps>(props => {\n const { theme, variant } = props;\n return css`\n > ${StyledIcon} {\n color: ${theme.components.sentiment[variant].color};\n }\n `;\n});\n\nStyledSentiment.defaultProps = defaultThemeProp;\n\nconst Sentiment: FunctionComponent<SentimentProps & ForwardProps> = forwardRef(function Sentiment(\n props: PropsWithoutRef<SentimentProps>,\n ref: SentimentProps['ref']\n) {\n const t = useI18n();\n\n const defaultLabels: SentimentProps['labels'] = {\n negative: t('sentiment_negative'),\n positive: t('sentiment_positive'),\n neutral: t('sentiment_neutral')\n };\n\n const {\n 'aria-label': ariaLabel,\n variant,\n labelHidden = false,\n labels = {},\n icons = {},\n ...restProps\n } = props;\n\n return (\n <Flex\n aria-label={ariaLabel}\n ref={ref}\n variant={variant}\n role='img'\n {...restProps}\n as={StyledSentiment}\n container={{ gap: 1 }}\n >\n <Icon aria-hidden='true' name={icons[variant] || defaultIcons[variant]!} />\n {!labelHidden && <span>{labels[variant] || defaultLabels[variant]}</span>}\n </Flex>\n );\n});\n\nexport default Sentiment;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/Slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAUlB,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,WAAW,MAAM,gBAAgB,CAAC;;;;AA6PzC,wBAAqD"}
1
+ {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/Slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAUlB,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,WAAW,MAAM,gBAAgB,CAAC;;;;AA8PzC,wBAAqD"}
@@ -10,7 +10,7 @@ import { StyledSlider, StyledTrack, StyledThumb, StyledSliderTrackWrapper, Style
10
10
  import { calculateValueLength, getNearestValue } from './utils';
11
11
  import SliderTicks from './SliderTicks';
12
12
  import { getSliderTestIds } from './Slider.test-ids';
13
- const Slider = forwardRef((props, ref) => {
13
+ const Slider = forwardRef(function Slider(props, ref) {
14
14
  const uid = useUID();
15
15
  const { testId, id = uid, required, status, info, label, labelHidden, min = 0, max = 100, step = 1, value = min, orientation = 'horizontal', preview, disabled = false, readOnly = false, showInput = true, showProgress, ticks = {}, onChange, autoFocus, onDragStart, onDragEnd: onDragEndProp, ...restProps } = props;
16
16
  const testIds = useTestIds(testId, getSliderTestIds);
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/components/Slider/Slider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EAER,UAAU,EAGX,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,wBAAwB,EACxB,SAAS,EACT,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD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CAAC","sourcesContent":["import {\n KeyboardEvent,\n FunctionComponent,\n PropsWithoutRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n CSSProperties,\n forwardRef,\n Ref,\n TouchEvent as ReactTouchEvent\n} from 'react';\n\nimport { NumberInput } from '../Number';\nimport { useConsolidatedRef, useDirection, useTestIds, useUID } from '../../hooks';\nimport FormField from '../FormField';\nimport Flex from '../Flex';\nimport Grid from '../Grid';\nimport { ForwardProps } from '../../types';\nimport { cap, withTestIds } from '../../utils';\n\nimport SliderProps from './Slider.types';\nimport {\n StyledSlider,\n StyledTrack,\n StyledThumb,\n StyledSliderTrackWrapper,\n StyledBar,\n StyledPreview\n} from './Slider.styles';\nimport { calculateValueLength, getNearestValue } from './utils';\nimport SliderTicks from './SliderTicks';\nimport { getSliderTestIds } from './Slider.test-ids';\n\nconst Slider: FunctionComponent<SliderProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SliderProps>, ref: Ref<HTMLDivElement>) => {\n const uid = useUID();\n const {\n testId,\n id = uid,\n required,\n status,\n info,\n label,\n labelHidden,\n min = 0,\n max = 100,\n step = 1,\n value = min,\n orientation = 'horizontal',\n preview,\n disabled = false,\n readOnly = false,\n showInput = true,\n showProgress,\n ticks = {},\n onChange,\n autoFocus,\n onDragStart,\n onDragEnd: onDragEndProp,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getSliderTestIds);\n\n const thumbRef = useConsolidatedRef<HTMLDivElement>(ref);\n const trackRef = useRef<HTMLDivElement>(null);\n const [inDrag, setInDrag] = useState(false);\n const [inputValue, setInputValue] = useState(value.toString());\n\n const setValue = useCallback(\n (newValue: number) => {\n if (disabled || readOnly) return;\n const normalizedValue = Math.min(Math.max(newValue, min), max);\n\n setInputValue(normalizedValue.toString());\n onChange(normalizedValue);\n },\n [disabled, readOnly, onChange]\n );\n\n const { start, end } = useDirection();\n\n const moveThumb = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (disabled || readOnly) return;\n if (trackRef.current) {\n const track = trackRef.current.getBoundingClientRect();\n const { clientX, clientY } = 'touches' in e ? e.touches[0] : e;\n const newPosition =\n orientation === 'horizontal'\n ? (clientX - track[start]) / (track[end] - track[start])\n : (clientY - track.bottom) / (track.top - track.bottom);\n\n const normalizedValue = Math.min(Math.max(min + (max - min) * newPosition, min), max);\n setValue(getNearestValue(normalizedValue, min, max, step));\n }\n thumbRef.current?.focus();\n },\n [disabled, readOnly, step, min, max, setValue, start, end]\n );\n\n const onThumbKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (\n [\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'PageUp',\n 'PageDown',\n 'Home',\n 'End'\n ].includes(e.key)\n )\n e.preventDefault();\n\n switch (e.key) {\n case 'ArrowDown':\n case `Arrow${cap(start)}`:\n setValue(value - step);\n break;\n case 'ArrowUp':\n case `Arrow${cap(end)}`:\n setValue(value + step);\n break;\n case 'PageUp':\n setValue(value + 10 * step);\n break;\n case 'PageDown':\n setValue(value - 10 * step);\n break;\n case 'Home':\n setValue(min);\n break;\n case 'End':\n setValue(max);\n break;\n default:\n }\n },\n [setValue, value, step, start, end]\n );\n\n useEffect(() => {\n const onDragEnd = () => {\n setInDrag(false);\n if (inDrag) onDragEndProp?.();\n };\n\n document.addEventListener('mouseup', onDragEnd);\n document.addEventListener('touchend', onDragEnd);\n document.addEventListener('touchcancel', onDragEnd);\n if (inDrag) {\n document.addEventListener('mousemove', moveThumb);\n document.addEventListener('touchmove', moveThumb);\n }\n\n return () => {\n document.removeEventListener('mouseup', onDragEnd);\n document.removeEventListener('touchend', onDragEnd);\n document.removeEventListener('touchcancel', onDragEnd);\n document.removeEventListener('mousemove', moveThumb);\n document.removeEventListener('touchmove', moveThumb);\n };\n }, [inDrag, moveThumb, onDragEndProp]);\n\n useEffect(() => {\n if (autoFocus) thumbRef.current?.focus();\n }, [autoFocus]);\n\n const percentage = ((Number(value) - min) / (max - min)) * 100;\n\n const Comp = (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n as={StyledSlider}\n container={{\n alignItems: 'start',\n direction: orientation === 'horizontal' ? 'row' : 'column'\n }}\n orientation={orientation}\n {...{ status, disabled, readOnly }}\n style={\n {\n '--slider-value': `${percentage}%`,\n userSelect: inDrag ? 'none' : 'auto'\n } as CSSProperties\n }\n >\n <Grid as={StyledSliderTrackWrapper} container>\n <Flex\n as={StyledTrack}\n ref={trackRef}\n onMouseDown={moveThumb}\n container={{ alignItems: 'center', justify: 'center' }}\n >\n <StyledBar showProgress={showProgress} />\n <StyledThumb\n ref={thumbRef}\n role='slider'\n tabIndex={0}\n onKeyDown={onThumbKeyDown}\n onMouseDown={() => {\n setInDrag(true);\n onDragStart?.();\n }}\n onTouchStart={(e: ReactTouchEvent<HTMLDivElement>) => {\n setInDrag(true);\n e.preventDefault(); // Prevent dispatching mouse events as some browser may do that\n onDragStart?.();\n }}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={value}\n aria-orientation={orientation}\n aria-readonly={readOnly || undefined}\n aria-disabled={disabled || undefined}\n id={id}\n aria-label={label?.toString()}\n aria-describedby={`${id}-info`}\n aria-controls={`${id}-value`}\n />\n </Flex>\n {Object.keys(ticks).length > 0 && (\n <SliderTicks\n ticks={ticks}\n min={min}\n max={max}\n step={step}\n orientation={orientation}\n onClick={setValue}\n />\n )}\n </Grid>\n {showInput && !preview && (\n <NumberInput\n data-testid={testIds.control}\n id={`${id}-value`}\n status={status}\n min={min}\n max={max}\n step={step}\n value={inputValue}\n onChange={setInputValue}\n onBlur={v => setValue(getNearestValue(Number(v), min, max, step))}\n size={calculateValueLength(min, max, step)}\n readOnly={readOnly}\n disabled={disabled}\n aria-label={label?.toString()}\n />\n )}\n {preview && (\n <StyledPreview\n id={`${id}-value`}\n value={value.toString()}\n size={calculateValueLength(min, max, step)}\n />\n )}\n </Flex>\n );\n\n return label ? (\n <FormField {...{ testId: testIds, label, labelHidden, id, info, status, required, disabled }}>\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default withTestIds(Slider, getSliderTestIds);\n"]}
1
+ {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/components/Slider/Slider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EAER,UAAU,EAGX,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,wBAAwB,EACxB,SAAS,EACT,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,GAAkD,UAAU,CAAC,SAAS,MAAM,CACtF,KAAmC,EACnC,GAAwB;IAExB,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,EACJ,MAAM,EACN,EAAE,GAAG,GAAG,EACR,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,KAAK,EACL,WAAW,EACX,GAAG,GAAG,CAAC,EACP,GAAG,GAAG,GAAG,EACT,IAAI,GAAG,CAAC,EACR,KAAK,GAAG,GAAG,EACX,WAAW,GAAG,YAAY,EAC1B,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,IAAI,EA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AE,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,EACjE,IAAI,EAAE,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAC1C,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,gBACN,KAAK,EAAE,QAAQ,EAAE,GAC7B,CACH,EACA,OAAO,IAAI,CACV,KAAC,aAAa,IACZ,EAAE,EAAE,GAAG,EAAE,QAAQ,EACjB,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,EACvB,IAAI,EAAE,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAC1C,CACH,IACI,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,OAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YACzF,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import {\n KeyboardEvent,\n FunctionComponent,\n PropsWithoutRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n CSSProperties,\n forwardRef,\n Ref,\n TouchEvent as ReactTouchEvent\n} from 'react';\n\nimport { NumberInput } from '../Number';\nimport { useConsolidatedRef, useDirection, useTestIds, useUID } from '../../hooks';\nimport FormField from '../FormField';\nimport Flex from '../Flex';\nimport Grid from '../Grid';\nimport { ForwardProps } from '../../types';\nimport { cap, withTestIds } from '../../utils';\n\nimport SliderProps from './Slider.types';\nimport {\n StyledSlider,\n StyledTrack,\n StyledThumb,\n StyledSliderTrackWrapper,\n StyledBar,\n StyledPreview\n} from './Slider.styles';\nimport { calculateValueLength, getNearestValue } from './utils';\nimport SliderTicks from './SliderTicks';\nimport { getSliderTestIds } from './Slider.test-ids';\n\nconst Slider: FunctionComponent<SliderProps & ForwardProps> = forwardRef(function Slider(\n props: PropsWithoutRef<SliderProps>,\n ref: Ref<HTMLDivElement>\n) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n required,\n status,\n info,\n label,\n labelHidden,\n min = 0,\n max = 100,\n step = 1,\n value = min,\n orientation = 'horizontal',\n preview,\n disabled = false,\n readOnly = false,\n showInput = true,\n showProgress,\n ticks = {},\n onChange,\n autoFocus,\n onDragStart,\n onDragEnd: onDragEndProp,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getSliderTestIds);\n\n const thumbRef = useConsolidatedRef<HTMLDivElement>(ref);\n const trackRef = useRef<HTMLDivElement>(null);\n const [inDrag, setInDrag] = useState(false);\n const [inputValue, setInputValue] = useState(value.toString());\n\n const setValue = useCallback(\n (newValue: number) => {\n if (disabled || readOnly) return;\n const normalizedValue = Math.min(Math.max(newValue, min), max);\n\n setInputValue(normalizedValue.toString());\n onChange(normalizedValue);\n },\n [disabled, readOnly, onChange]\n );\n\n const { start, end } = useDirection();\n\n const moveThumb = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (disabled || readOnly) return;\n if (trackRef.current) {\n const track = trackRef.current.getBoundingClientRect();\n const { clientX, clientY } = 'touches' in e ? e.touches[0] : e;\n const newPosition =\n orientation === 'horizontal'\n ? (clientX - track[start]) / (track[end] - track[start])\n : (clientY - track.bottom) / (track.top - track.bottom);\n\n const normalizedValue = Math.min(Math.max(min + (max - min) * newPosition, min), max);\n setValue(getNearestValue(normalizedValue, min, max, step));\n }\n thumbRef.current?.focus();\n },\n [disabled, readOnly, step, min, max, setValue, start, end]\n );\n\n const onThumbKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (\n [\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'PageUp',\n 'PageDown',\n 'Home',\n 'End'\n ].includes(e.key)\n )\n e.preventDefault();\n\n switch (e.key) {\n case 'ArrowDown':\n case `Arrow${cap(start)}`:\n setValue(value - step);\n break;\n case 'ArrowUp':\n case `Arrow${cap(end)}`:\n setValue(value + step);\n break;\n case 'PageUp':\n setValue(value + 10 * step);\n break;\n case 'PageDown':\n setValue(value - 10 * step);\n break;\n case 'Home':\n setValue(min);\n break;\n case 'End':\n setValue(max);\n break;\n default:\n }\n },\n [setValue, value, step, start, end]\n );\n\n useEffect(() => {\n const onDragEnd = () => {\n setInDrag(false);\n if (inDrag) onDragEndProp?.();\n };\n\n document.addEventListener('mouseup', onDragEnd);\n document.addEventListener('touchend', onDragEnd);\n document.addEventListener('touchcancel', onDragEnd);\n if (inDrag) {\n document.addEventListener('mousemove', moveThumb);\n document.addEventListener('touchmove', moveThumb);\n }\n\n return () => {\n document.removeEventListener('mouseup', onDragEnd);\n document.removeEventListener('touchend', onDragEnd);\n document.removeEventListener('touchcancel', onDragEnd);\n document.removeEventListener('mousemove', moveThumb);\n document.removeEventListener('touchmove', moveThumb);\n };\n }, [inDrag, moveThumb, onDragEndProp]);\n\n useEffect(() => {\n if (autoFocus) thumbRef.current?.focus();\n }, [autoFocus]);\n\n const percentage = ((Number(value) - min) / (max - min)) * 100;\n\n const Comp = (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n as={StyledSlider}\n container={{\n alignItems: 'start',\n direction: orientation === 'horizontal' ? 'row' : 'column'\n }}\n orientation={orientation}\n {...{ status, disabled, readOnly }}\n style={\n {\n '--slider-value': `${percentage}%`,\n userSelect: inDrag ? 'none' : 'auto'\n } as CSSProperties\n }\n >\n <Grid as={StyledSliderTrackWrapper} container>\n <Flex\n as={StyledTrack}\n ref={trackRef}\n onMouseDown={moveThumb}\n container={{ alignItems: 'center', justify: 'center' }}\n >\n <StyledBar showProgress={showProgress} />\n <StyledThumb\n ref={thumbRef}\n role='slider'\n tabIndex={0}\n onKeyDown={onThumbKeyDown}\n onMouseDown={() => {\n setInDrag(true);\n onDragStart?.();\n }}\n onTouchStart={(e: ReactTouchEvent<HTMLDivElement>) => {\n setInDrag(true);\n e.preventDefault(); // Prevent dispatching mouse events as some browser may do that\n onDragStart?.();\n }}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={value}\n aria-orientation={orientation}\n aria-readonly={readOnly || undefined}\n aria-disabled={disabled || undefined}\n id={id}\n aria-label={label?.toString()}\n aria-describedby={`${id}-info`}\n aria-controls={`${id}-value`}\n />\n </Flex>\n {Object.keys(ticks).length > 0 && (\n <SliderTicks\n ticks={ticks}\n min={min}\n max={max}\n step={step}\n orientation={orientation}\n onClick={setValue}\n />\n )}\n </Grid>\n {showInput && !preview && (\n <NumberInput\n data-testid={testIds.control}\n id={`${id}-value`}\n status={status}\n min={min}\n max={max}\n step={step}\n value={inputValue}\n onChange={setInputValue}\n onBlur={v => setValue(getNearestValue(Number(v), min, max, step))}\n size={calculateValueLength(min, max, step)}\n readOnly={readOnly}\n disabled={disabled}\n aria-label={label?.toString()}\n />\n )}\n {preview && (\n <StyledPreview\n id={`${id}-value`}\n value={value.toString()}\n size={calculateValueLength(min, max, step)}\n />\n )}\n </Flex>\n );\n\n return label ? (\n <FormField {...{ testId: testIds, label, labelHidden, id, info, status, required, disabled }}>\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n});\n\nexport default withTestIds(Slider, getSliderTestIds);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/Slider.styles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAErE,eAAO,MAAM,WAAW,yGAoCvB,CAAC;AAIF,eAAO,MAAM,SAAS;;SAuCpB,CAAC;AAIH,eAAO,MAAM,WAAW,yGA6BvB,CAAC;AAIF,eAAO,MAAM,oBAAoB,yGAUhC,CAAC;AAIF,eAAO,MAAM,wBAAwB,yGAEpC,CAAC;AAIF,eAAO,MAAM,aAAa;UAAiC,MAAM;SAGhE,CAAC;AAIF,eAAO,MAAM,YAAY;iBACV,UAAU,GAAG,YAAY;YAC9B,gBAAgB,CAAC,QAAQ,CAAC;SAmIlC,CAAC;AAIH,eAAO,MAAM,cAAc;;;iBAGZ,YAAY,GAAG,UAAU;SAwDtC,CAAC;AAIH,eAAO,MAAM,gBAAgB,0GAO5B,CAAC"}
1
+ {"version":3,"file":"Slider.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/Slider.styles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAErE,eAAO,MAAM,WAAW,yGAqCvB,CAAC;AAIF,eAAO,MAAM,SAAS;;SAyCpB,CAAC;AAIH,eAAO,MAAM,WAAW,yGA6BvB,CAAC;AAIF,eAAO,MAAM,oBAAoB,yGAUhC,CAAC;AAIF,eAAO,MAAM,wBAAwB,yGAEpC,CAAC;AAIF,eAAO,MAAM,aAAa;UAAiC,MAAM;SAGhE,CAAC;AAIF,eAAO,MAAM,YAAY;iBACV,UAAU,GAAG,YAAY;YAC9B,gBAAgB,CAAC,QAAQ,CAAC;SAmIlC,CAAC;AAIH,eAAO,MAAM,cAAc;;;iBAGZ,YAAY,GAAG,UAAU;SAwDtC,CAAC;AAIH,eAAO,MAAM,gBAAgB,0GAO5B,CAAC"}
@@ -6,7 +6,7 @@ import { tryCatch } from '../../utils';
6
6
  import { StyledGrid } from '../Grid';
7
7
  import { NumberDisplay } from '../Number';
8
8
  import StyledNumberInput from '../Number/NumberInput.styles';
9
- export const StyledThumb = styled.div(({ theme: { base: { palette: { 'primary-background': bgColor, 'border-line': borderColor }, spacing, 'border-radius': borderRadius }, components: { progress: { 'progress-color': fgColor }, button } } }) => {
9
+ export const StyledThumb = styled.div(({ theme: { base: { palette: { 'primary-background': bgColor, 'border-line': borderColor, interactive: fgColor }, spacing, 'border-radius': borderRadius }, components: { button } } }) => {
10
10
  const hoverBgColor = tryCatch(() => mix(0.2, fgColor, bgColor));
11
11
  return css `
12
12
  border: ${button['border-width']} solid ${borderColor};
@@ -30,7 +30,7 @@ export const StyledThumb = styled.div(({ theme: { base: { palette: { 'primary-ba
30
30
  });
31
31
  StyledThumb.defaultProps = defaultThemeProp;
32
32
  export const StyledBar = styled.div(({ theme, showProgress }) => {
33
- const { base: { spacing, colors, 'border-radius': borderRadius }, components: { progress: { 'progress-color': progressColor } } } = theme;
33
+ const { base: { spacing, colors, 'border-radius': borderRadius, palette: { interactive: interactiveColor } } } = theme;
34
34
  const { ltr } = useDirection();
35
35
  return css `
36
36
  border-radius: ${borderRadius};
@@ -50,7 +50,7 @@ export const StyledBar = styled.div(({ theme, showProgress }) => {
50
50
  display: block;
51
51
  width: 100%;
52
52
  height: 100%;
53
- background-color: ${progressColor};
53
+ background-color: ${interactiveColor};
54
54
  ${ltr
55
55
  ? css `
56
56
  transform: translateX(calc(-100% + var(--slider-value, 0)));
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.styles.js","sourceRoot":"","sources":["../../../src/components/Slider/Slider.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC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components';\n\nimport { useDirection } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { PropsWithDefaults } from '../../types';\nimport { tryCatch } from '../../utils';\nimport { FormControlProps } from '../FormControl';\nimport { StyledGrid } from '../Grid';\nimport { NumberDisplay } from '../Number';\nimport StyledNumberInput from '../Number/NumberInput.styles';\n\nimport SliderProps from './Slider.types';\n\nexport type SliderPropsWithDefaults = PropsWithDefaults<SliderProps>;\n\nexport const StyledThumb = styled.div(\n ({\n theme: {\n base: {\n palette: { 'primary-background': bgColor, 'border-line': borderColor },\n spacing,\n 'border-radius': borderRadius\n },\n components: {\n progress: { 'progress-color': fgColor },\n button\n }\n }\n }) => {\n const hoverBgColor = tryCatch(() => mix(0.2, fgColor, bgColor));\n\n return css`\n border: ${button['border-width']} solid ${borderColor};\n border-radius: calc(${borderRadius} * 3);\n outline: none;\n background-color: ${bgColor};\n width: calc(${spacing} * 3);\n height: calc(${spacing} * 3);\n cursor: pointer;\n\n &:focus {\n box-shadow: ${button['focus-shadow']};\n }\n\n &:hover,\n &:active {\n background-color: ${hoverBgColor};\n border-color: ${fgColor};\n }\n `;\n }\n);\n\nStyledThumb.defaultProps = defaultThemeProp;\n\nexport const StyledBar = styled.div<{ showProgress?: boolean }>(({ theme, showProgress }) => {\n const {\n base: { spacing, colors, 'border-radius': borderRadius },\n components: {\n progress: { 'progress-color': progressColor }\n }\n } = theme;\n\n const { ltr } = useDirection();\n\n return css`\n border-radius: ${borderRadius};\n height: ${spacing};\n width: 100%;\n overflow: hidden;\n position: relative;\n background-color: ${colors.gray.light};\n\n ${showProgress &&\n css`\n ::before {\n position: absolute;\n left: 0;\n top: 0;\n content: '';\n display: block;\n width: 100%;\n height: 100%;\n background-color: ${progressColor};\n ${ltr\n ? css`\n transform: translateX(calc(-100% + var(--slider-value, 0)));\n `\n : css`\n transform: translateX(calc(100% - var(--slider-value, 0)));\n `}\n }\n `}\n `;\n});\n\nStyledBar.defaultProps = defaultThemeProp;\n\nexport const StyledTrack = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n const { ltr } = useDirection();\n return css`\n height: calc(${spacing} * 4);\n width: 100%;\n cursor: pointer;\n position: relative;\n\n > ${StyledThumb} {\n z-index: 1;\n position: absolute;\n top: calc(${spacing} / 2);\n left: var(--slider-value);\n right: var(--slider-value);\n ${ltr\n ? css`\n transform: translate(-50%, 0);\n `\n : css`\n transform: translate(50%, 0);\n `}\n }\n `;\n }\n);\n\nStyledTrack.defaultProps = defaultThemeProp;\n\nexport const StyledTicksContainer = styled.div`\n width: 100%;\n\n div {\n &::before {\n content: '';\n display: table;\n background: ${p => p.theme.base.palette['foreground-color']};\n }\n }\n`;\n\nStyledTicksContainer.defaultProps = defaultThemeProp;\n\nexport const StyledSliderTrackWrapper = styled.div`\n width: 100%;\n`;\n\nStyledSliderTrackWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledPreview = styled(NumberDisplay)<{ size: number }>`\n width: ${props => props.size}ch;\n flex-shrink: 0;\n`;\n\nStyledPreview.defaultProps = defaultThemeProp;\n\nexport const StyledSlider = styled.div<{\n orientation: 'vertical' | 'horizontal';\n status: FormControlProps['status'];\n}>(props => {\n const {\n theme: {\n base: { spacing, palette },\n components: { 'form-field': formField }\n },\n status,\n orientation\n } = props;\n\n const statusColor =\n status && formField[status] ? formField[status]['status-color'] : 'transparent';\n const thumbBgColor = tryCatch(() => mix(0.2, statusColor, palette['primary-background']));\n\n const borderColor =\n status && formField[status] ? formField[status]['status-color'] : palette['border-line'];\n\n return css`\n > span {\n line-height: calc(${spacing} * 4);\n }\n\n ${orientation === 'horizontal'\n ? css`\n ${StyledSliderTrackWrapper} {\n margin-inline: calc(1.5 * ${spacing});\n\n ${StyledTrack},\n ${StyledThumb} {\n grid-row: 1;\n }\n\n ${StyledBar} {\n /* extend by thumb width */\n min-width: calc(100% + ${spacing} * 3);\n }\n\n ${StyledTicksContainer} {\n grid-row: 2;\n }\n\n & + ${StyledNumberInput}, & + ${StyledPreview} {\n margin-inline-start: calc(2 * ${spacing});\n }\n }\n `\n : css`\n ${StyledSliderTrackWrapper} {\n grid-template-columns: calc(${spacing} * 4) minmax(0, 1fr);\n grid-template-rows: 0.5em [track-start] minmax(calc(${spacing} * 20), max-content) [track-end] 0.5em;\n margin-top: ${spacing};\n\n ${StyledTrack} {\n grid-row: track-start / track-end;\n height: 100%;\n transform: scale(-1);\n\n ${StyledBar} {\n height: 100%;\n width: ${spacing};\n\n ::before {\n transform: translateY(calc(-100% + var(--slider-value, 0)));\n }\n }\n }\n\n ${StyledThumb} {\n grid-row: track-start / track-end;\n top: auto;\n bottom: calc(100% - var(--slider-value));\n left: calc(${spacing} / 2);\n right: calc(${spacing} / 2);\n transform: translate(0, 50%);\n }\n\n ${StyledTicksContainer} {\n grid-row: 1 / -1;\n height: 100%;\n }\n\n & + ${StyledNumberInput}, & + ${StyledPreview} {\n margin-top: calc(2 * ${spacing});\n width: calc(${spacing} * 4);\n text-align: center;\n\n input {\n border-radius: inherit;\n }\n\n /* fix NumberInput double padding issue */\n &,\n & > input {\n padding: 0;\n }\n }\n }\n `}\n\n &[disabled],\n &[readonly] {\n ${StyledTrack} {\n cursor: default;\n }\n\n ${StyledThumb} {\n cursor: default;\n border-color: ${palette['border-line']};\n :hover,\n :active {\n background-color: ${palette['background-color']};\n }\n }\n }\n\n ${status &&\n css`\n ${StyledBar}::before {\n background-color: ${statusColor};\n }\n\n ${StyledThumb} {\n border-color: ${borderColor};\n :hover,\n :active {\n background-color: ${thumbBgColor};\n }\n }\n `}\n `;\n});\n\nStyledSlider.defaultProps = defaultThemeProp;\n\nexport const StyledTickItem = styled(StyledGrid)<{\n lowerBoundaryItem?: boolean;\n upperBoundaryItem?: boolean;\n orientation: 'horizontal' | 'vertical';\n}>(({ lowerBoundaryItem, upperBoundaryItem, orientation, theme }) => {\n const spacing = theme.base.spacing;\n\n const { ltr } = useDirection();\n\n return css`\n overflow: hidden;\n\n ${orientation === 'horizontal'\n ? css`\n text-align: center;\n text-overflow: ellipsis;\n white-space: nowrap;\n &::before {\n width: 0.0625rem;\n height: ${spacing};\n transform: translateY(-50%);\n margin: 0 auto;\n }\n\n ${lowerBoundaryItem &&\n css`\n text-align: start;\n transform: translate(-0.5ch, 0);\n &::before {\n margin-inline-start: 0.5ch;\n }\n `}\n\n ${upperBoundaryItem &&\n css`\n text-align: end;\n transform: translate(0.5ch, 0);\n &::before {\n margin-inline-end: 0.5ch;\n }\n `}\n `\n : css`\n display: flex;\n align-items: center;\n\n &::before {\n width: ${spacing};\n height: calc(${spacing} / 8);\n ${ltr\n ? css`\n transform: translateX(-50%);\n `\n : css`\n transform: translateX(50%);\n `}\n }\n `}\n `;\n});\n\nStyledTickItem.defaultProps = defaultThemeProp;\n\nexport const StyledTickButton = styled.span`\n cursor: pointer;\n line-height: 1em;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n outline: 0;\n`;\n\nStyledTickButton.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"Slider.styles.js","sourceRoot":"","sources":["../../../src/components/Slider/Slider.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,iBAAiB,MAAM,8BAA8B,CAAC;AAM7D,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CACnC,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EACP,oBAAoB,EAAE,OAAO,EAC7B,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Ac,GAAG,MAAM,CAAC,UAAU,CAAC,CAI7C,CAAC,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE;IAClE,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;IAEnC,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IAE/B,OAAO,GAAG,CAAA;;;MAGN,WAAW,KAAK,YAAY;QAC5B,CAAC,CAAC,GAAG,CAAA;;;;;;sBAMW,OAAO;;;;;YAKjB,iBAAiB;YACnB,GAAG,CAAA;;;;;;WAMF;;YAEC,iBAAiB;YACnB,GAAG,CAAA;;;;;;WAMF;SACF;QACH,CAAC,CAAC,GAAG,CAAA;;;;;qBAKU,OAAO;2BACD,OAAO;cACpB,GAAG;YACH,CAAC,CAAC,GAAG,CAAA;;iBAEF;YACH,CAAC,CAAC,GAAG,CAAA;;iBAEF;;SAER;GACN,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;;;CAO1C,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { mix } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { useDirection } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { PropsWithDefaults } from '../../types';\nimport { tryCatch } from '../../utils';\nimport { FormControlProps } from '../FormControl';\nimport { StyledGrid } from '../Grid';\nimport { NumberDisplay } from '../Number';\nimport StyledNumberInput from '../Number/NumberInput.styles';\n\nimport SliderProps from './Slider.types';\n\nexport type SliderPropsWithDefaults = PropsWithDefaults<SliderProps>;\n\nexport const StyledThumb = styled.div(\n ({\n theme: {\n base: {\n palette: {\n 'primary-background': bgColor,\n 'border-line': borderColor,\n interactive: fgColor\n },\n spacing,\n 'border-radius': borderRadius\n },\n components: { button }\n }\n }) => {\n const hoverBgColor = tryCatch(() => mix(0.2, fgColor, bgColor));\n\n return css`\n border: ${button['border-width']} solid ${borderColor};\n border-radius: calc(${borderRadius} * 3);\n outline: none;\n background-color: ${bgColor};\n width: calc(${spacing} * 3);\n height: calc(${spacing} * 3);\n cursor: pointer;\n\n &:focus {\n box-shadow: ${button['focus-shadow']};\n }\n\n &:hover,\n &:active {\n background-color: ${hoverBgColor};\n border-color: ${fgColor};\n }\n `;\n }\n);\n\nStyledThumb.defaultProps = defaultThemeProp;\n\nexport const StyledBar = styled.div<{ showProgress?: boolean }>(({ theme, showProgress }) => {\n const {\n base: {\n spacing,\n colors,\n 'border-radius': borderRadius,\n palette: { interactive: interactiveColor }\n }\n } = theme;\n\n const { ltr } = useDirection();\n\n return css`\n border-radius: ${borderRadius};\n height: ${spacing};\n width: 100%;\n overflow: hidden;\n position: relative;\n background-color: ${colors.gray.light};\n\n ${showProgress &&\n css`\n ::before {\n position: absolute;\n left: 0;\n top: 0;\n content: '';\n display: block;\n width: 100%;\n height: 100%;\n background-color: ${interactiveColor};\n ${ltr\n ? css`\n transform: translateX(calc(-100% + var(--slider-value, 0)));\n `\n : css`\n transform: translateX(calc(100% - var(--slider-value, 0)));\n `}\n }\n `}\n `;\n});\n\nStyledBar.defaultProps = defaultThemeProp;\n\nexport const StyledTrack = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n const { ltr } = useDirection();\n return css`\n height: calc(${spacing} * 4);\n width: 100%;\n cursor: pointer;\n position: relative;\n\n > ${StyledThumb} {\n z-index: 1;\n position: absolute;\n top: calc(${spacing} / 2);\n left: var(--slider-value);\n right: var(--slider-value);\n ${ltr\n ? css`\n transform: translate(-50%, 0);\n `\n : css`\n transform: translate(50%, 0);\n `}\n }\n `;\n }\n);\n\nStyledTrack.defaultProps = defaultThemeProp;\n\nexport const StyledTicksContainer = styled.div`\n width: 100%;\n\n div {\n &::before {\n content: '';\n display: table;\n background: ${p => p.theme.base.palette['foreground-color']};\n }\n }\n`;\n\nStyledTicksContainer.defaultProps = defaultThemeProp;\n\nexport const StyledSliderTrackWrapper = styled.div`\n width: 100%;\n`;\n\nStyledSliderTrackWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledPreview = styled(NumberDisplay)<{ size: number }>`\n width: ${props => props.size}ch;\n flex-shrink: 0;\n`;\n\nStyledPreview.defaultProps = defaultThemeProp;\n\nexport const StyledSlider = styled.div<{\n orientation: 'vertical' | 'horizontal';\n status: FormControlProps['status'];\n}>(props => {\n const {\n theme: {\n base: { spacing, palette },\n components: { 'form-field': formField }\n },\n status,\n orientation\n } = props;\n\n const statusColor =\n status && formField[status] ? formField[status]['status-color'] : 'transparent';\n const thumbBgColor = tryCatch(() => mix(0.2, statusColor, palette['primary-background']));\n\n const borderColor =\n status && formField[status] ? formField[status]['status-color'] : palette['border-line'];\n\n return css`\n > span {\n line-height: calc(${spacing} * 4);\n }\n\n ${orientation === 'horizontal'\n ? css`\n ${StyledSliderTrackWrapper} {\n margin-inline: calc(1.5 * ${spacing});\n\n ${StyledTrack},\n ${StyledThumb} {\n grid-row: 1;\n }\n\n ${StyledBar} {\n /* extend by thumb width */\n min-width: calc(100% + ${spacing} * 3);\n }\n\n ${StyledTicksContainer} {\n grid-row: 2;\n }\n\n & + ${StyledNumberInput}, & + ${StyledPreview} {\n margin-inline-start: calc(2 * ${spacing});\n }\n }\n `\n : css`\n ${StyledSliderTrackWrapper} {\n grid-template-columns: calc(${spacing} * 4) minmax(0, 1fr);\n grid-template-rows: 0.5em [track-start] minmax(calc(${spacing} * 20), max-content) [track-end] 0.5em;\n margin-top: ${spacing};\n\n ${StyledTrack} {\n grid-row: track-start / track-end;\n height: 100%;\n transform: scale(-1);\n\n ${StyledBar} {\n height: 100%;\n width: ${spacing};\n\n ::before {\n transform: translateY(calc(-100% + var(--slider-value, 0)));\n }\n }\n }\n\n ${StyledThumb} {\n grid-row: track-start / track-end;\n top: auto;\n bottom: calc(100% - var(--slider-value));\n left: calc(${spacing} / 2);\n right: calc(${spacing} / 2);\n transform: translate(0, 50%);\n }\n\n ${StyledTicksContainer} {\n grid-row: 1 / -1;\n height: 100%;\n }\n\n & + ${StyledNumberInput}, & + ${StyledPreview} {\n margin-top: calc(2 * ${spacing});\n width: calc(${spacing} * 4);\n text-align: center;\n\n input {\n border-radius: inherit;\n }\n\n /* fix NumberInput double padding issue */\n &,\n & > input {\n padding: 0;\n }\n }\n }\n `}\n\n &[disabled],\n &[readonly] {\n ${StyledTrack} {\n cursor: default;\n }\n\n ${StyledThumb} {\n cursor: default;\n border-color: ${palette['border-line']};\n :hover,\n :active {\n background-color: ${palette['background-color']};\n }\n }\n }\n\n ${status &&\n css`\n ${StyledBar}::before {\n background-color: ${statusColor};\n }\n\n ${StyledThumb} {\n border-color: ${borderColor};\n :hover,\n :active {\n background-color: ${thumbBgColor};\n }\n }\n `}\n `;\n});\n\nStyledSlider.defaultProps = defaultThemeProp;\n\nexport const StyledTickItem = styled(StyledGrid)<{\n lowerBoundaryItem?: boolean;\n upperBoundaryItem?: boolean;\n orientation: 'horizontal' | 'vertical';\n}>(({ lowerBoundaryItem, upperBoundaryItem, orientation, theme }) => {\n const spacing = theme.base.spacing;\n\n const { ltr } = useDirection();\n\n return css`\n overflow: hidden;\n\n ${orientation === 'horizontal'\n ? css`\n text-align: center;\n text-overflow: ellipsis;\n white-space: nowrap;\n &::before {\n width: 0.0625rem;\n height: ${spacing};\n transform: translateY(-50%);\n margin: 0 auto;\n }\n\n ${lowerBoundaryItem &&\n css`\n text-align: start;\n transform: translate(-0.5ch, 0);\n &::before {\n margin-inline-start: 0.5ch;\n }\n `}\n\n ${upperBoundaryItem &&\n css`\n text-align: end;\n transform: translate(0.5ch, 0);\n &::before {\n margin-inline-end: 0.5ch;\n }\n `}\n `\n : css`\n display: flex;\n align-items: center;\n\n &::before {\n width: ${spacing};\n height: calc(${spacing} / 8);\n ${ltr\n ? css`\n transform: translateX(-50%);\n `\n : css`\n transform: translateX(50%);\n `}\n }\n `}\n `;\n});\n\nStyledTickItem.defaultProps = defaultThemeProp;\n\nexport const StyledTickButton = styled.span`\n cursor: pointer;\n line-height: 1em;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n outline: 0;\n`;\n\nStyledTickButton.defaultProps = defaultThemeProp;\n"]}
@@ -57,7 +57,7 @@ const getColumns = ({ visual, actions }) => {
57
57
  const getAreas = ({ secondary, visual, actions }) => {
58
58
  return `"${visual ? 'visual ' : ''}primary${actions ? ' actions' : ''}"${secondary ? `\n"${visual ? 'visual ' : ''}secondary${actions ? ' actions' : ''}"` : ''}`;
59
59
  };
60
- const SummaryItem = forwardRef(({ testId, visual, primary, secondary, actions, container, overflowStrategy = 'wrap', as, ...restProps }, ref) => {
60
+ const SummaryItem = forwardRef(function SummaryItem({ testId, visual, primary, secondary, actions, container, overflowStrategy = 'wrap', as, ...restProps }, ref) {
61
61
  const testIds = useTestIds(testId, getSummaryItemTestIds);
62
62
  return (_jsxs(Grid, { "data-testid": testIds.root, ...restProps, ref: ref, container: {
63
63
  cols: getColumns({ visual, actions }),
@@ -1 +1 @@
1
- {"version":3,"file":"SummaryItem.js","sourceRoot":"","sources":["../../../src/components/SummaryItem/SummaryItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqC,UAAU,EAAgC,MAAM,OAAO,CAAC;AACpG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAA4B,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAwB/D,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,C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E,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,EAClE,QAAQ,EAAE,OAAO,OAAO,KAAK,QAAQ,EACrC,gBAAgB,EAAE,gBAAgB,YAEjC,OAAO,GACM,EACf,SAAS,IAAI,CACZ,KAAC,eAAe,mBACD,OAAO,CAAC,SAAS,EAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,EAC/C,gBAAgB,EAAE,gBAAgB,YAEjC,SAAS,GACM,CACnB,EACA,OAAO,IAAI,CACV,KAAC,IAAI,mBACU,OAAO,CAAC,OAAO,EAC5B,EAAE,EAAE,wBAAwB,EAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAE7C,OAAO,GACH,CACR,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { FunctionComponent, ReactNode, Ref, forwardRef, PropsWithoutRef, ElementType } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Grid, { GridContainerProps } from '../Grid';\nimport { defaultThemeProp } from '../../theme';\nimport { ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport { StyledProgressRing } from '../Progress';\nimport { useTestIds } from '../../hooks';\nimport { withTestIds } from '../../utils';\n\nimport { getSummaryItemTestIds } from './SummaryItem.test-ids';\n\nexport interface SummaryItemProps extends NoChildrenProp, TestIdProp {\n /** Region for the primary information. */\n primary: NonNullable<ReactNode>;\n /** Region for displaying supporting metadata. */\n secondary?: ReactNode;\n /** Region for an Avatar, Icon, or other supporting visual. */\n visual?: ReactNode;\n /** Region for adding Actions, Buttons, or Links. */\n actions?: ReactNode;\n /** Override the default Grid container props on SummaryItem. */\n container?: GridContainerProps;\n /**\n * Determines how the text within primary and secondary fields should handle overflow.\n * @default 'wrap'\n */\n overflowStrategy?: 'wrap' | 'ellipsis';\n /** HTML tag to render the SummaryItem's element with. */\n as?: ElementType;\n /** Ref for the SummaryItem. */\n ref?: Ref<HTMLElement>;\n}\n\nexport const StyledVisual = styled.div`\n > ${StyledProgressRing}, img {\n display: block;\n object-fit: cover;\n width: 2rem;\n height: 2rem;\n }\n`;\n\nStyledVisual.defaultProps = defaultThemeProp;\n\nexport const StyledPrimary = styled(Grid)<{\n isString?: boolean;\n overflowStrategy?: SummaryItemProps['overflowStrategy'];\n}>(({ theme, isString, overflowStrategy }) => {\n return css`\n ${overflowStrategy === 'ellipsis'\n ? css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `\n : css`\n word-break: break-word;\n `}\n\n ${isString &&\n css`\n font-weight: ${theme.base['font-weight']['semi-bold']};\n `}\n `;\n});\n\nStyledPrimary.defaultProps = defaultThemeProp;\n\nexport const StyledSecondary = styled(Grid)<{\n overflowStrategy?: SummaryItemProps['overflowStrategy'];\n}>(({ overflowStrategy }) => {\n return css`\n ${overflowStrategy === 'ellipsis'\n ? css`\n overflow: hidden;\n text-overflow: ellipsis;\n `\n : css`\n word-break: break-word;\n `}\n `;\n});\n\nexport const StyledSummaryItemActions = styled.div`\n white-space: nowrap;\n`;\n\nexport const StyledSummaryItem = styled.div``;\n\nconst getColumns = ({ visual, actions }: Pick<SummaryItemProps, 'visual' | 'actions'>) => {\n return `${visual ? 'auto ' : ''}minmax(0, 1fr)${actions ? ' auto' : ''}`;\n};\n\nconst getAreas = ({\n secondary,\n visual,\n actions\n}: Pick<SummaryItemProps, 'secondary' | 'visual' | 'actions'>) => {\n return `\"${visual ? 'visual ' : ''}primary${actions ? ' actions' : ''}\"${\n secondary ? `\\n\"${visual ? 'visual ' : ''}secondary${actions ? ' actions' : ''}\"` : ''\n }`;\n};\n\nconst SummaryItem: FunctionComponent<SummaryItemProps & ForwardProps> = forwardRef(\n (\n {\n testId,\n visual,\n primary,\n secondary,\n actions,\n container,\n overflowStrategy = 'wrap',\n as,\n ...restProps\n }: PropsWithoutRef<SummaryItemProps>,\n ref: SummaryItemProps['ref']\n ) => {\n const testIds = useTestIds(testId, getSummaryItemTestIds);\n\n return (\n <Grid\n data-testid={testIds.root}\n {...restProps}\n ref={ref}\n container={{\n cols: getColumns({ visual, actions }),\n colGap: 2,\n areas: getAreas({ secondary, visual, actions }),\n ...container\n }}\n as={StyledSummaryItem}\n forwardedAs={as}\n >\n {visual && (\n <Grid\n data-testid={testIds.visual}\n as={StyledVisual}\n item={{ area: 'visual', alignSelf: 'center' }}\n >\n {visual}\n </Grid>\n )}\n <StyledPrimary\n data-testid={testIds.primary}\n item={{ area: 'primary', alignSelf: secondary ? 'end' : 'center' }}\n isString={typeof primary === 'string'}\n overflowStrategy={overflowStrategy}\n >\n {primary}\n </StyledPrimary>\n {secondary && (\n <StyledSecondary\n data-testid={testIds.secondary}\n item={{ area: 'secondary', alignSelf: 'start' }}\n overflowStrategy={overflowStrategy}\n >\n {secondary}\n </StyledSecondary>\n )}\n {actions && (\n <Grid\n data-testid={testIds.actions}\n as={StyledSummaryItemActions}\n item={{ area: 'actions', alignSelf: 'center' }}\n >\n {actions}\n </Grid>\n )}\n </Grid>\n );\n }\n);\n\nexport default withTestIds(SummaryItem, getSummaryItemTestIds);\n"]}
1
+ {"version":3,"file":"SummaryItem.js","sourceRoot":"","sources":["../../../src/components/SummaryItem/SummaryItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqC,UAAU,EAAgC,MAAM,OAAO,CAAC;AACpG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAA4B,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAA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AI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,YAE5C,MAAM,GACF,CACR,EACD,KAAC,aAAa,mBACC,OAAO,CAAC,OAAO,EAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,EAClE,QAAQ,EAAE,OAAO,OAAO,KAAK,QAAQ,EACrC,gBAAgB,EAAE,gBAAgB,YAEjC,OAAO,GACM,EACf,SAAS,IAAI,CACZ,KAAC,eAAe,mBACD,OAAO,CAAC,SAAS,EAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,EAC/C,gBAAgB,EAAE,gBAAgB,YAEjC,SAAS,GACM,CACnB,EACA,OAAO,IAAI,CACV,KAAC,IAAI,mBACU,OAAO,CAAC,OAAO,EAC5B,EAAE,EAAE,wBAAwB,EAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAE7C,OAAO,GACH,CACR,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { FunctionComponent, ReactNode, Ref, forwardRef, PropsWithoutRef, ElementType } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Grid, { GridContainerProps } from '../Grid';\nimport { defaultThemeProp } from '../../theme';\nimport { ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport { StyledProgressRing } from '../Progress';\nimport { useTestIds } from '../../hooks';\nimport { withTestIds } from '../../utils';\n\nimport { getSummaryItemTestIds } from './SummaryItem.test-ids';\n\nexport interface SummaryItemProps extends NoChildrenProp, TestIdProp {\n /** Region for the primary information. */\n primary: NonNullable<ReactNode>;\n /** Region for displaying supporting metadata. */\n secondary?: ReactNode;\n /** Region for an Avatar, Icon, or other supporting visual. */\n visual?: ReactNode;\n /** Region for adding Actions, Buttons, or Links. */\n actions?: ReactNode;\n /** Override the default Grid container props on SummaryItem. */\n container?: GridContainerProps;\n /**\n * Determines how the text within primary and secondary fields should handle overflow.\n * @default 'wrap'\n */\n overflowStrategy?: 'wrap' | 'ellipsis';\n /** HTML tag to render the SummaryItem's element with. */\n as?: ElementType;\n /** Ref for the SummaryItem. */\n ref?: Ref<HTMLElement>;\n}\n\nexport const StyledVisual = styled.div`\n > ${StyledProgressRing}, img {\n display: block;\n object-fit: cover;\n width: 2rem;\n height: 2rem;\n }\n`;\n\nStyledVisual.defaultProps = defaultThemeProp;\n\nexport const StyledPrimary = styled(Grid)<{\n isString?: boolean;\n overflowStrategy?: SummaryItemProps['overflowStrategy'];\n}>(({ theme, isString, overflowStrategy }) => {\n return css`\n ${overflowStrategy === 'ellipsis'\n ? css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `\n : css`\n word-break: break-word;\n `}\n\n ${isString &&\n css`\n font-weight: ${theme.base['font-weight']['semi-bold']};\n `}\n `;\n});\n\nStyledPrimary.defaultProps = defaultThemeProp;\n\nexport const StyledSecondary = styled(Grid)<{\n overflowStrategy?: SummaryItemProps['overflowStrategy'];\n}>(({ overflowStrategy }) => {\n return css`\n ${overflowStrategy === 'ellipsis'\n ? css`\n overflow: hidden;\n text-overflow: ellipsis;\n `\n : css`\n word-break: break-word;\n `}\n `;\n});\n\nexport const StyledSummaryItemActions = styled.div`\n white-space: nowrap;\n`;\n\nexport const StyledSummaryItem = styled.div``;\n\nconst getColumns = ({ visual, actions }: Pick<SummaryItemProps, 'visual' | 'actions'>) => {\n return `${visual ? 'auto ' : ''}minmax(0, 1fr)${actions ? ' auto' : ''}`;\n};\n\nconst getAreas = ({\n secondary,\n visual,\n actions\n}: Pick<SummaryItemProps, 'secondary' | 'visual' | 'actions'>) => {\n return `\"${visual ? 'visual ' : ''}primary${actions ? ' actions' : ''}\"${\n secondary ? `\\n\"${visual ? 'visual ' : ''}secondary${actions ? ' actions' : ''}\"` : ''\n }`;\n};\n\nconst SummaryItem: FunctionComponent<SummaryItemProps & ForwardProps> = forwardRef(\n function SummaryItem(\n {\n testId,\n visual,\n primary,\n secondary,\n actions,\n container,\n overflowStrategy = 'wrap',\n as,\n ...restProps\n }: PropsWithoutRef<SummaryItemProps>,\n ref: SummaryItemProps['ref']\n ) {\n const testIds = useTestIds(testId, getSummaryItemTestIds);\n\n return (\n <Grid\n data-testid={testIds.root}\n {...restProps}\n ref={ref}\n container={{\n cols: getColumns({ visual, actions }),\n colGap: 2,\n areas: getAreas({ secondary, visual, actions }),\n ...container\n }}\n as={StyledSummaryItem}\n forwardedAs={as}\n >\n {visual && (\n <Grid\n data-testid={testIds.visual}\n as={StyledVisual}\n item={{ area: 'visual', alignSelf: 'center' }}\n >\n {visual}\n </Grid>\n )}\n <StyledPrimary\n data-testid={testIds.primary}\n item={{ area: 'primary', alignSelf: secondary ? 'end' : 'center' }}\n isString={typeof primary === 'string'}\n overflowStrategy={overflowStrategy}\n >\n {primary}\n </StyledPrimary>\n {secondary && (\n <StyledSecondary\n data-testid={testIds.secondary}\n item={{ area: 'secondary', alignSelf: 'start' }}\n overflowStrategy={overflowStrategy}\n >\n {secondary}\n </StyledSecondary>\n )}\n {actions && (\n <Grid\n data-testid={testIds.actions}\n as={StyledSummaryItemActions}\n item={{ area: 'actions', alignSelf: 'center' }}\n >\n {actions}\n </Grid>\n )}\n </Grid>\n );\n }\n);\n\nexport default withTestIds(SummaryItem, getSummaryItemTestIds);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SummaryList.d.ts","sourceRoot":"","sources":["../../../src/components/SummaryList/SummaryList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,GAAG,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAGtE,OAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAMnD,OAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO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OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IAClC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,eACf,SAAQ,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAC7C,IAAI,CAAC,YAAY,EAAE,iBAAiB,CAAC,EACrC,YAAY;IACd,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,oIAAoI;IACpI,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,wBAAwB;;SAapC,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,OAAO,WAS1C,CAAC;AAIF,eAAO,MAAM,gBAAgB,oBAAqB,KAAK,gBAAgB,EAAE,OAAO,GAAG,MAAM,CAAC,gBA2BzF,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,GAAG,YAAY,CAgEnD,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -42,7 +42,7 @@ export const SummaryListItems = ({ name, items }) => {
42
42
  : contextualLabel })) }, id));
43
43
  }) }));
44
44
  };
45
- const SummaryList = forwardRef(({ icon, name, headingTag = 'h2', count, actions, items, onViewAll, loading, noItemsText, error, ...restProps }, ref) => {
45
+ const SummaryList = forwardRef(function SummaryList({ icon, name, headingTag = 'h2', count, actions, items, onViewAll, loading, noItemsText, error, ...restProps }, ref) {
46
46
  const t = useI18n();
47
47
  const content = useMemo(() => {
48
48
  if (loading) {
@@ -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,OAAyB,MAAM,YAAY,CAAC;AACnD,OAA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAC3E,OAAO,EAAE,SAAS,YAEjB,CAAC,CAAC,UAAU,CAAC,GACP,GACE,CACd,IACI,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, { ActionsProps } 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, HeadingTag } 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 /**\n * The heading tag to render the provided name as with.\n * @default 'h2'\n */\n headingTag?: HeadingTag;\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\n extends OmitStrict<SummaryItemProps, 'actions'>,\n Pick<ActionsProps, 'contextualLabel'>,\n 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 = ({ name, items }: Pick<SummaryListProps, 'items' | 'name'>) => {\n const t = useI18n();\n return (\n <ul>\n {items.map(({ id, actions: itemActions, contextualLabel, ...restItemProps }) => {\n return (\n <StyledSummaryListItem\n key={id}\n {...restItemProps}\n forwardedAs='li'\n actions={\n itemActions && (\n <Actions\n items={itemActions}\n contextualLabel={\n name && contextualLabel\n ? t('action_from_summarylist_heading', [contextualLabel, name])\n : contextualLabel\n }\n />\n )\n }\n />\n );\n })}\n </ul>\n );\n};\n\nconst SummaryList: FC<SummaryListProps & ForwardProps> = forwardRef(\n (\n {\n icon,\n name,\n headingTag = 'h2',\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 name={name} 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={headingTag}>{name}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n {actions && <Actions items={actions} contextualLabel={name} />}\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,OAAyB,MAAM,YAAY,CAAC;AACnD,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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C,CAAC,CAAC;IAEzC,OAAO,CACL,MAAC,IAAI,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,aAC1B,CAAC,IAAI,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CACzD,MAAC,UAAU,eACT,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC9C,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,EAC5B,IAAI,IAAI,KAAC,IAAI,IAAC,OAAO,EAAE,UAAU,YAAG,IAAI,GAAQ,EAChD,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAC,KAAK,cAAE,KAAK,GAAS,IAC/C,EACN,OAAO,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,GAAI,IACnD,CACd,EAED,KAAC,wBAAwB,IAAC,OAAO,EAAE,OAAO,YAAG,OAAO,GAA4B,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,GACP,GACE,CACd,IACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, FC, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions, { ActionsProps } 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, HeadingTag } 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 /**\n * The heading tag to render the provided name as with.\n * @default 'h2'\n */\n headingTag?: HeadingTag;\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\n extends OmitStrict<SummaryItemProps, 'actions'>,\n Pick<ActionsProps, 'contextualLabel'>,\n 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 = ({ name, items }: Pick<SummaryListProps, 'items' | 'name'>) => {\n const t = useI18n();\n return (\n <ul>\n {items.map(({ id, actions: itemActions, contextualLabel, ...restItemProps }) => {\n return (\n <StyledSummaryListItem\n key={id}\n {...restItemProps}\n forwardedAs='li'\n actions={\n itemActions && (\n <Actions\n items={itemActions}\n contextualLabel={\n name && contextualLabel\n ? t('action_from_summarylist_heading', [contextualLabel, name])\n : contextualLabel\n }\n />\n )\n }\n />\n );\n })}\n </ul>\n );\n};\n\nconst SummaryList: FC<SummaryListProps & ForwardProps> = forwardRef(function SummaryList(\n {\n icon,\n name,\n headingTag = 'h2',\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 name={name} 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={headingTag}>{name}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n {actions && <Actions items={actions} contextualLabel={name} />}\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\nexport default SummaryList;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ViewAll.d.ts","sourceRoot":"","sources":["../../../src/components/SummaryList/ViewAll.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,GAAG,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAMtD,OAAoB,EAAE,gBAAgB,EAAqB,MAAM,gBAAgB,CAAC;AAMlF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC3F,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAoBD,eAAO,MAAM,aAAa;aAAoC,YAAY,CAAC,SAAS,CAAC;SAapF,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,CA2BnD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ViewAll.d.ts","sourceRoot":"","sources":["../../../src/components/SummaryList/ViewAll.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,GAAG,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAMtD,OAAoB,EAAE,gBAAgB,EAAqB,MAAM,gBAAgB,CAAC;AAMlF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC3F,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAoBD,eAAO,MAAM,aAAa;aAAoC,YAAY,CAAC,SAAS,CAAC;SAapF,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,CA4BlD,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -37,7 +37,7 @@ export const StyledViewAll = styled.div.withConfig(omitProps('loading'))(({ load
37
37
  min-height: 8rem;
38
38
  `}
39
39
  `);
40
- const SearchableList = forwardRef(({ loading, actions, items, searchInputProps, ...restProps }, ref) => {
40
+ const SearchableList = forwardRef(function SearchableList({ loading, actions, items, searchInputProps, ...restProps }, ref) {
41
41
  const [searchValue, setSearchValue] = useState('');
42
42
  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: val => {
43
43
  searchInputProps.onSearchChange?.(val);
@@ -1 +1 @@
1
- {"version":3,"file":"ViewAll.js","sourceRoot":"","sources":["../../../src/components/SummaryList/ViewAll.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAW,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,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AAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAA4B,EAAE,CAAC,CAAC;IAC9E,OAAO,CACL,MAAC,aAAa,IAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,KAAM,SAAS,aACrD,CAAC,OAAO,IAAI,CAAC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAC5C,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,aAAa,aACrF,gBAAgB,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,IACV,cAAc,EAAE,GAAG,CAAC,EAAE;gCACpB,gBAAgB,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC;gCACvC,cAAc,CAAC,GAAG,CAAC,CAAC;4BACtB,CAAC,EACD,KAAK,EAAE,gBAAgB,CAAC,KAAK,IAAI,WAAW,GAC5C,GACG,CACR,EACA,OAAO,IAAI,KAAC,OAAO,IAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,GAAI,IACnD,CACR,EAEA,OAAO,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,GAAG,EACzC,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,UAAU,KAAG,CAAC,IAC9D,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, Ref, FC, useState } 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 const [searchValue, setSearchValue] = useState<SearchInputProps['value']>('');\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\n onSearchChange={val => {\n searchInputProps.onSearchChange?.(val);\n setSearchValue(val);\n }}\n value={searchInputProps.value || searchValue}\n />\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,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtD,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,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,WAAiC,MAAM,eAAe,CAAC;AAO9D,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACvD,OAAO,GAAG,CAAA;;;;wBAIY,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;qBACrC,IAAI,CAAC,OAAO;wCACO,IAAI,CAAC,OAAO;eACrC,IAAI,CAAC,OAAO;;MAErB,iBAAiB;;;GAGpB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAChD,SAAS,CAAC,SAAS,CAAC,CACrB,CACC,CAAC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C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,UAAU,KAAG,CAAC,IAC9D,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, Ref, FC, useState } 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(function SearchableList(\n { loading, actions, items, searchInputProps, ...restProps },\n ref: ViewAllProps['ref']\n) {\n const [searchValue, setSearchValue] = useState<SearchInputProps['value']>('');\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\n onSearchChange={val => {\n searchInputProps.onSearchChange?.(val);\n setSearchValue(val);\n }}\n value={searchInputProps.value || searchValue}\n />\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\nexport default SearchableList;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAIzF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAUlD,MAAM,WAAW,WAAY,SAAQ,SAAS,EAAE,cAAc;IAC5D;;;OAGG;IACH,EAAE,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC5B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC;;;OAGG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACtD,iCAAiC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AA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 +129,7 @@ export const SwitchInput = styled.input(({ theme: { base, components: { 'form-co
129
129
  });
130
130
  SwitchInput.defaultProps = defaultThemeProp;
131
131
  export const StyledSwitch = styled.div ``;
132
- const Switch = forwardRef((props, ref) => {
132
+ const Switch = forwardRef(function Switch(props, ref) {
133
133
  const uid = useUID();
134
134
  const { id = uid, label, disabled = false, on = false, onChange, ...restProps } = props;
135
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 }), _jsxs(Flex, { container: { alignItems: 'center' }, as: SwitchLabel, htmlFor: id, children: [label, on && _jsx(Icon, { name: 'check' })] })] }));
@@ -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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E,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,GACR,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,GAAG,IACvB,IACM,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 type { BaseProps, ForwardProps, NoChildrenProp } 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, NoChildrenProp {\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,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;8BACZ,WAAW;;;;;;;;;iBASxB,KAAK;kBACJ,MAAM;4BACI,GAAG,CAAC,KAA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,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,GAAG,IACvB,IACM,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,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 type { BaseProps, ForwardProps, NoChildrenProp } 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, NoChildrenProp {\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(function Switch(\n props: PropsWithoutRef<SwitchProps>,\n ref: SwitchProps['ref']\n) {\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\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;AAIjG,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAqB,MAAM,aAAa,CAAC;AAQ9F,MAAM,WAAW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C;AAQ9F,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;AAED,MAAM,WAAW,UAAU,CAAC,OAAO,SAAS,cAAc,GAAG,cAAc,CACzE,SAAQ,SAAS,EACf,cAAc;IAChB,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;AAmJD,eAAO,MAAM,kBAAkB,yGAG9B,CAAC;AAUF,QAAA,MAAM,KAAK,kGAoEN,YAAY,GAAG,IAAI,CAAC;AAEzB,eAAe,KAAK,CAAC"}
@@ -114,7 +114,7 @@ const StyledTableCaption = styled.caption `
114
114
  ${hideVisually}
115
115
  `;
116
116
  StyledTableCaption.defaultProps = defaultThemeProp;
117
- const Table = forwardRef((props, ref) => {
117
+ const Table = forwardRef(function Table(props, ref) {
118
118
  const { columns, data = [], hoverHighlight = false, loading = false, loadingMessage = '', title, ...restProps } = props;
119
119
  return (_jsx(Card, { children: _jsxs(CardContent, { container: { rowGap: 1 }, children: [title && (_jsx(Text, { variant: 'h2', as: 'span', "aria-hidden": true, children: title })), _jsx(StyledTableWrapper, { children: _jsxs(StyledTable, { ref: ref, hoverHighlight: hoverHighlight, ...restProps, children: [title && _jsx(StyledTableCaption, { children: title }), _jsx("thead", { children: _jsx("tr", { children: columns.map(col => (_createElement(StyledCell, { as: StyledHeaderCell, ...col, scope: 'col', key: col.label }, col.label))) }) }), _jsxs("tbody", { children: [loading && (_jsx("tr", { children: _jsx(StyledLoadingCell, { colSpan: columns.length, children: _jsx(Progress, { placement: 'local', message: loadingMessage }) }) })), data.length > 0 &&
120
120
  !loading &&
@@ -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;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;AAqD5C,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,qBA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AAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAClB,eAAC,UAAU,IAAC,EAAE,EAAE,gBAAgB,KAAM,GAAG,EAAE,KAAK,EAAC,KAAK,EAAC,GAAG,EAAE,GAAG,CAAC,KAAK,IAClE,GAAG,CAAC,KAAK,CACC,CACd,CAAC,GACC,GACC,EACR,4BACG,OAAO,IAAI,CACV,uBACE,KAAC,iBAAiB,IAAC,OAAO,EAAE,OAAO,CAAC,MAAM,YACxC,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,cAAc,GAAI,GACrC,GACjB,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,GAAI,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,KAAG,GACE,GACf,CACN,IACK,IACI,GACK,IACT,GACT,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 type { BaseProps, ForwardProps, NoChildrenProp, 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>\n extends BaseProps,\n NoChildrenProp {\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\nexport const 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"]}
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;AA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,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,KAAG,GACE,GACf,CACN,IACK,IACI,GACK,IACT,GACT,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 type { BaseProps, ForwardProps, NoChildrenProp, 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>\n extends BaseProps,\n NoChildrenProp {\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\nexport const 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(function Table(\n props: PropsWithoutRef<TableProps>,\n ref: Ref<HTMLTableElement>\n) {\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"]}