@pega/cosmos-react-core 4.0.0-dev.23.0 → 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 (406) 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 +2 -6
  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 +5 -9
  133. package/lib/components/Dialog/FormDialog.js.map +1 -1
  134. package/lib/components/Dialog/InfoDialog.d.ts.map +1 -1
  135. package/lib/components/Dialog/InfoDialog.js +4 -3
  136. package/lib/components/Dialog/InfoDialog.js.map +1 -1
  137. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  138. package/lib/components/Drawer/Drawer.js +1 -1
  139. package/lib/components/Drawer/Drawer.js.map +1 -1
  140. package/lib/components/Email/EmailDisplay.js +1 -1
  141. package/lib/components/Email/EmailDisplay.js.map +1 -1
  142. package/lib/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  143. package/lib/components/EmojiPicker/EmojiPicker.js +1 -1
  144. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  145. package/lib/components/EmptyState/EmptyState.js +1 -1
  146. package/lib/components/EmptyState/EmptyState.js.map +1 -1
  147. package/lib/components/ErrorState/ErrorState.js +1 -1
  148. package/lib/components/ErrorState/ErrorState.js.map +1 -1
  149. package/lib/components/ExpandCollapse/ExpandCollapse.js +1 -1
  150. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  151. package/lib/components/FieldGroup/FieldGroup.js +1 -1
  152. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  153. package/lib/components/FieldGroup/FieldGroupList.js +1 -1
  154. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  155. package/lib/components/FieldValueList/FieldValueList.js +1 -1
  156. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  157. package/lib/components/File/FileDisplay.js +1 -1
  158. package/lib/components/File/FileDisplay.js.map +1 -1
  159. package/lib/components/File/FileInput.d.ts.map +1 -1
  160. package/lib/components/File/FileInput.js +1 -1
  161. package/lib/components/File/FileInput.js.map +1 -1
  162. package/lib/components/File/FileItem.d.ts.map +1 -1
  163. package/lib/components/File/FileItem.js +1 -1
  164. package/lib/components/File/FileItem.js.map +1 -1
  165. package/lib/components/File/FileUploadItem.d.ts.map +1 -1
  166. package/lib/components/File/FileUploadItem.js +1 -1
  167. package/lib/components/File/FileUploadItem.js.map +1 -1
  168. package/lib/components/File/FileVisual.d.ts.map +1 -1
  169. package/lib/components/File/FileVisual.js +1 -1
  170. package/lib/components/File/FileVisual.js.map +1 -1
  171. package/lib/components/Flex/Flex.d.ts.map +1 -1
  172. package/lib/components/Flex/Flex.js +1 -1
  173. package/lib/components/Flex/Flex.js.map +1 -1
  174. package/lib/components/Form/Form.d.ts.map +1 -1
  175. package/lib/components/Form/Form.js +1 -1
  176. package/lib/components/Form/Form.js.map +1 -1
  177. package/lib/components/FormControl/FormControl.js +1 -1
  178. package/lib/components/FormControl/FormControl.js.map +1 -1
  179. package/lib/components/FormField/FormField.d.ts.map +1 -1
  180. package/lib/components/FormField/FormField.js +1 -1
  181. package/lib/components/FormField/FormField.js.map +1 -1
  182. package/lib/components/FormField/index.d.ts +1 -1
  183. package/lib/components/FormField/index.d.ts.map +1 -1
  184. package/lib/components/FormField/index.js +1 -1
  185. package/lib/components/FormField/index.js.map +1 -1
  186. package/lib/components/Grid/Grid.d.ts.map +1 -1
  187. package/lib/components/Grid/Grid.js +1 -1
  188. package/lib/components/Grid/Grid.js.map +1 -1
  189. package/lib/components/HTML/HTML.d.ts.map +1 -1
  190. package/lib/components/HTML/HTML.js +1 -1
  191. package/lib/components/HTML/HTML.js.map +1 -1
  192. package/lib/components/Icon/Icon.d.ts.map +1 -1
  193. package/lib/components/Icon/Icon.js +1 -1
  194. package/lib/components/Icon/Icon.js.map +1 -1
  195. package/lib/components/Icon/iconNames.d.ts +1 -1
  196. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  197. package/lib/components/Icon/iconNames.js +1 -0
  198. package/lib/components/Icon/iconNames.js.map +1 -1
  199. package/lib/components/Icon/icons/live-transcript.icon.d.ts +5 -0
  200. package/lib/components/Icon/icons/live-transcript.icon.d.ts.map +1 -0
  201. package/lib/components/Icon/icons/live-transcript.icon.js +7 -0
  202. package/lib/components/Icon/icons/live-transcript.icon.js.map +1 -0
  203. package/lib/components/Icon/streamline-icons/code-search.icon.d.ts.map +1 -1
  204. package/lib/components/Icon/streamline-icons/code-search.icon.js +1 -1
  205. package/lib/components/Icon/streamline-icons/code-search.icon.js.map +1 -1
  206. package/lib/components/Icon/streamline-icons/copy.icon.d.ts +5 -0
  207. package/lib/components/Icon/streamline-icons/copy.icon.d.ts.map +1 -0
  208. package/lib/components/Icon/streamline-icons/copy.icon.js +7 -0
  209. package/lib/components/Icon/streamline-icons/copy.icon.js.map +1 -0
  210. package/lib/components/Icon/streamline-icons/search.icon.d.ts.map +1 -1
  211. package/lib/components/Icon/streamline-icons/search.icon.js +1 -1
  212. package/lib/components/Icon/streamline-icons/search.icon.js.map +1 -1
  213. package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
  214. package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
  215. package/lib/components/Icon/streamlineIconNames.js +1 -0
  216. package/lib/components/Icon/streamlineIconNames.js.map +1 -1
  217. package/lib/components/IconPicker/IconPicker.js +1 -1
  218. package/lib/components/IconPicker/IconPicker.js.map +1 -1
  219. package/lib/components/Image/Image.d.ts.map +1 -1
  220. package/lib/components/Image/Image.js +1 -1
  221. package/lib/components/Image/Image.js.map +1 -1
  222. package/lib/components/Input/Input.d.ts.map +1 -1
  223. package/lib/components/Input/Input.js +1 -1
  224. package/lib/components/Input/Input.js.map +1 -1
  225. package/lib/components/Label/Label.d.ts.map +1 -1
  226. package/lib/components/Label/Label.js +1 -1
  227. package/lib/components/Label/Label.js.map +1 -1
  228. package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
  229. package/lib/components/Lightbox/Lightbox.js +1 -1
  230. package/lib/components/Lightbox/Lightbox.js.map +1 -1
  231. package/lib/components/Link/Link.d.ts.map +1 -1
  232. package/lib/components/Link/Link.js +3 -4
  233. package/lib/components/Link/Link.js.map +1 -1
  234. package/lib/components/List/CommaSeparatedList.js +1 -1
  235. package/lib/components/List/CommaSeparatedList.js.map +1 -1
  236. package/lib/components/List/List.d.ts.map +1 -1
  237. package/lib/components/List/List.js +1 -1
  238. package/lib/components/List/List.js.map +1 -1
  239. package/lib/components/List/OrderedList.d.ts.map +1 -1
  240. package/lib/components/List/OrderedList.js +3 -1
  241. package/lib/components/List/OrderedList.js.map +1 -1
  242. package/lib/components/List/UnorderedList.d.ts.map +1 -1
  243. package/lib/components/List/UnorderedList.js +3 -1
  244. package/lib/components/List/UnorderedList.js.map +1 -1
  245. package/lib/components/ListToolbar/ListToolbar.js +1 -1
  246. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  247. package/lib/components/ListToolbar/PresetMenuPopover.d.ts.map +1 -1
  248. package/lib/components/ListToolbar/PresetMenuPopover.js +10 -4
  249. package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
  250. package/lib/components/Location/LocationDisplay.js +1 -1
  251. package/lib/components/Location/LocationDisplay.js.map +1 -1
  252. package/lib/components/Location/LocationInput.d.ts.map +1 -1
  253. package/lib/components/Location/LocationInput.js +1 -1
  254. package/lib/components/Location/LocationInput.js.map +1 -1
  255. package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
  256. package/lib/components/Menu/FlyoutMenuList.js +1 -1
  257. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  258. package/lib/components/Menu/Menu.d.ts.map +1 -1
  259. package/lib/components/Menu/Menu.js +1 -1
  260. package/lib/components/Menu/Menu.js.map +1 -1
  261. package/lib/components/Menu/MenuList.js +1 -1
  262. package/lib/components/Menu/MenuList.js.map +1 -1
  263. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  264. package/lib/components/MenuButton/MenuButton.js +8 -6
  265. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  266. package/lib/components/MetaList/MetaList.d.ts.map +1 -1
  267. package/lib/components/MetaList/MetaList.js +1 -1
  268. package/lib/components/MetaList/MetaList.js.map +1 -1
  269. package/lib/components/Modal/DockedModals.d.ts.map +1 -1
  270. package/lib/components/Modal/DockedModals.js +1 -1
  271. package/lib/components/Modal/DockedModals.js.map +1 -1
  272. package/lib/components/Modal/Modal.d.ts.map +1 -1
  273. package/lib/components/Modal/Modal.js +2 -5
  274. package/lib/components/Modal/Modal.js.map +1 -1
  275. package/lib/components/MultiStepForm/MultiStepForm.js +1 -1
  276. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  277. package/lib/components/Number/NumberDisplay.js +1 -1
  278. package/lib/components/Number/NumberDisplay.js.map +1 -1
  279. package/lib/components/Number/NumberInput.js +1 -1
  280. package/lib/components/Number/NumberInput.js.map +1 -1
  281. package/lib/components/Number/NumberRangeInput.js +1 -1
  282. package/lib/components/Number/NumberRangeInput.js.map +1 -1
  283. package/lib/components/PageTemplates/CategorySubPage.js +1 -1
  284. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  285. package/lib/components/PageTemplates/DashboardPage.js +2 -2
  286. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  287. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  288. package/lib/components/PageTemplates/PageTemplates.js +11 -11
  289. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  290. package/lib/components/Paragraph/ParagraphDisplay.js +1 -1
  291. package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -1
  292. package/lib/components/Phone/PhoneDisplay.js +1 -1
  293. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  294. package/lib/components/Phone/PhoneInput.js +1 -1
  295. package/lib/components/Phone/PhoneInput.js.map +1 -1
  296. package/lib/components/Popover/Popover.d.ts.map +1 -1
  297. package/lib/components/Popover/Popover.js +1 -1
  298. package/lib/components/Popover/Popover.js.map +1 -1
  299. package/lib/components/Progress/Bar.d.ts.map +1 -1
  300. package/lib/components/Progress/Bar.js +1 -1
  301. package/lib/components/Progress/Bar.js.map +1 -1
  302. package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
  303. package/lib/components/Progress/Ellipsis.js +1 -1
  304. package/lib/components/Progress/Ellipsis.js.map +1 -1
  305. package/lib/components/Progress/Progress.d.ts.map +1 -1
  306. package/lib/components/Progress/Progress.js +1 -1
  307. package/lib/components/Progress/Progress.js.map +1 -1
  308. package/lib/components/Progress/Ring.d.ts.map +1 -1
  309. package/lib/components/Progress/Ring.js +1 -1
  310. package/lib/components/Progress/Ring.js.map +1 -1
  311. package/lib/components/QRCode/QRCode.d.ts.map +1 -1
  312. package/lib/components/QRCode/QRCode.js +1 -1
  313. package/lib/components/QRCode/QRCode.js.map +1 -1
  314. package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
  315. package/lib/components/RadioButton/RadioButton.js +3 -1
  316. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  317. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  318. package/lib/components/RadioCheck/RadioCheck.js +15 -5
  319. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  320. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  321. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +1 -1
  322. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  323. package/lib/components/Rating/Rating.d.ts.map +1 -1
  324. package/lib/components/Rating/Rating.js +3 -6
  325. package/lib/components/Rating/Rating.js.map +1 -1
  326. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  327. package/lib/components/SearchInput/SearchInput.js +4 -12
  328. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  329. package/lib/components/Select/Select.d.ts.map +1 -1
  330. package/lib/components/Select/Select.js +1 -1
  331. package/lib/components/Select/Select.js.map +1 -1
  332. package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
  333. package/lib/components/Sentiment/Sentiment.js +1 -1
  334. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  335. package/lib/components/Slider/Slider.d.ts.map +1 -1
  336. package/lib/components/Slider/Slider.js +1 -1
  337. package/lib/components/Slider/Slider.js.map +1 -1
  338. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  339. package/lib/components/Slider/Slider.styles.js +3 -3
  340. package/lib/components/Slider/Slider.styles.js.map +1 -1
  341. package/lib/components/SummaryItem/SummaryItem.js +1 -1
  342. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  343. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  344. package/lib/components/SummaryList/SummaryList.js +1 -1
  345. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  346. package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
  347. package/lib/components/SummaryList/ViewAll.js +1 -1
  348. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  349. package/lib/components/Switch/Switch.d.ts.map +1 -1
  350. package/lib/components/Switch/Switch.js +1 -1
  351. package/lib/components/Switch/Switch.js.map +1 -1
  352. package/lib/components/Table/Table.d.ts.map +1 -1
  353. package/lib/components/Table/Table.js +1 -1
  354. package/lib/components/Table/Table.js.map +1 -1
  355. package/lib/components/Tabs/Tab.d.ts +2 -0
  356. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  357. package/lib/components/Tabs/Tab.js +19 -3
  358. package/lib/components/Tabs/Tab.js.map +1 -1
  359. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  360. package/lib/components/Tabs/TabPanel.js +1 -1
  361. package/lib/components/Tabs/TabPanel.js.map +1 -1
  362. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  363. package/lib/components/Tabs/Tabs.js +3 -3
  364. package/lib/components/Tabs/Tabs.js.map +1 -1
  365. package/lib/components/Tabs/Tabs.types.d.ts +2 -0
  366. package/lib/components/Tabs/Tabs.types.d.ts.map +1 -1
  367. package/lib/components/Tabs/Tabs.types.js.map +1 -1
  368. package/lib/components/Text/Text.d.ts.map +1 -1
  369. package/lib/components/Text/Text.js +1 -1
  370. package/lib/components/Text/Text.js.map +1 -1
  371. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  372. package/lib/components/TextArea/TextArea.js +1 -1
  373. package/lib/components/TextArea/TextArea.js.map +1 -1
  374. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  375. package/lib/components/Toaster/Toaster.js +1 -1
  376. package/lib/components/Toaster/Toaster.js.map +1 -1
  377. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  378. package/lib/components/Tooltip/Tooltip.js +1 -1
  379. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  380. package/lib/components/Tree/StandardTree.js +2 -2
  381. package/lib/components/Tree/StandardTree.js.map +1 -1
  382. package/lib/components/Tree/Tree.d.ts.map +1 -1
  383. package/lib/components/Tree/Tree.js +2 -2
  384. package/lib/components/Tree/Tree.js.map +1 -1
  385. package/lib/components/URL/URLDisplay.js +1 -1
  386. package/lib/components/URL/URLDisplay.js.map +1 -1
  387. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.d.ts.map +1 -1
  388. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js +3 -1
  389. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js.map +1 -1
  390. package/lib/hooks/useEscape.d.ts +3 -0
  391. package/lib/hooks/useEscape.d.ts.map +1 -1
  392. package/lib/hooks/useEscape.js +5 -2
  393. package/lib/hooks/useEscape.js.map +1 -1
  394. package/lib/hooks/useI18n.d.ts +25 -14
  395. package/lib/hooks/useI18n.d.ts.map +1 -1
  396. package/lib/i18n/default.d.ts +25 -14
  397. package/lib/i18n/default.d.ts.map +1 -1
  398. package/lib/i18n/default.js +28 -16
  399. package/lib/i18n/default.js.map +1 -1
  400. package/lib/i18n/i18n.d.ts +25 -14
  401. package/lib/i18n/i18n.d.ts.map +1 -1
  402. package/lib/styles/GlobalStyle.d.ts +2 -2
  403. package/lib/styles/GlobalStyle.d.ts.map +1 -1
  404. package/lib/styles/GlobalStyle.js +2 -2
  405. package/lib/styles/GlobalStyle.js.map +1 -1
  406. package/package.json +1 -1
@@ -82,7 +82,7 @@ function reducer(current, action) {
82
82
  return current;
83
83
  }
84
84
  }
85
- const Toast = forwardRef(({ dispatch, topLevelDismiss, dismissAfter, ...message }, ref) => {
85
+ const Toast = forwardRef(function Toast({ dispatch, topLevelDismiss, dismissAfter, ...message }, ref) {
86
86
  const { content, translateY } = message;
87
87
  const [dismissed, setDismissed] = useState(false);
88
88
  const timeoutRef = useRef(NaN);
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.js","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,OAAO,EACP,eAAe,EAKf,MAAM,EACN,QAAQ,EACR,UAAU,EAGV,SAAS,EAEV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAuB,MAAM,WAAW,CAAC;AAEhE,YAAY,CAAC,SAAS,CAAC,CAAC;AAuBxB,MAAM,iBAAiB,GAAG,MAAM,CAA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Y,CACb,IACF,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n useContext,\n useReducer,\n useMemo,\n useLayoutEffect,\n FunctionComponent,\n CSSProperties,\n TransitionEvent,\n Context,\n useRef,\n useState,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useEffect,\n Dispatch\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport { createUID, windowIsAvailable } from '../../utils';\nimport { useConfiguration, useI18n, useLiveLog } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport '../../init';\n\nimport { ToastMessage, ToasterProps } from './Toaster.types';\nimport { ToasterContext, ToasterContextValue } from './Context';\n\nregisterIcon(timesIcon);\n\ninterface ToastState extends ToastMessage {\n id: NonNullable<ToastMessage['id']>;\n}\n\ntype ToastReducerAction =\n | { type: 'push'; payload: ToastState }\n | { type: 'unmount'; payload: ToastState['id'] };\n\ninterface ToastProps extends ToastState {\n topLevelDismiss: ToasterProps['onDismiss'];\n translateY: number;\n dispatch: Dispatch<ToastReducerAction>;\n ref: Ref<HTMLDivElement>;\n}\n\ndeclare module '../../init' {\n export interface CosmosGlobals {\n toasterContext?: Context<ToasterContextValue>;\n }\n}\n\nconst StyledToastButton = styled.button(\n ({ theme }) => css`\n border: none;\n color: inherit;\n padding: 0;\n font-size: 1rem;\n\n &:enabled:hover {\n background: #ffffff19;\n }\n\n &:enabled:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledToastButton.defaultProps = defaultThemeProp;\n\nconst StyledToastContent = styled.div(({ theme }) => {\n return css`\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: ${theme.base['font-size']};\n margin-inline-start: calc(${theme.base['border-radius']} / 2);\n `;\n});\n\nStyledToastContent.defaultProps = defaultThemeProp;\n\nconst StyledToast = styled.div(({ theme }) => {\n return css`\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n width: 100%;\n padding: calc(${theme.base.spacing} / 2);\n background: ${theme.base.colors.slate['extra-dark']};\n color: ${theme.base.colors.white};\n border-radius: calc(${theme.base['border-radius']} / 2);\n opacity: var(--opacity);\n transform: translateY(var(--translateY)) scale(var(--scale));\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n `;\n});\n\nStyledToast.defaultProps = defaultThemeProp;\n\nconst StyledToaster = styled.div`\n position: fixed;\n z-index: ${({ theme }) => theme.base['z-index'].toast};\n width: min(40ch, calc(100% - 1rem));\n inset-inline-start: 50%;\n transform: translateX(-50%);\n top: 100%;\n`;\n\nStyledToaster.defaultProps = defaultThemeProp;\n\nfunction reducer(current: ToastState[], action: ToastReducerAction) {\n switch (action.type) {\n case 'push':\n return [\n ...current,\n {\n ...action.payload\n }\n ];\n\n case 'unmount':\n return current.filter(m => m.id !== action.payload);\n\n default:\n return current;\n }\n}\n\nconst Toast: FunctionComponent<ToastProps> = forwardRef(\n (\n { dispatch, topLevelDismiss, dismissAfter, ...message }: PropsWithoutRef<ToastProps>,\n ref: ToastProps['ref']\n ) => {\n const { content, translateY } = message;\n const [dismissed, setDismissed] = useState(false);\n const timeoutRef = useRef(NaN);\n const t = useI18n();\n const { announcePolite } = useLiveLog();\n\n useEffect(() => {\n announcePolite({ message: message.content, type: 'acknowledgement' });\n }, []);\n\n const onTransitionEnd = (e: TransitionEvent<HTMLDivElement>) => {\n if (dismissed && e.propertyName === 'opacity' && e.target === e.currentTarget) {\n dispatch({ type: 'unmount', payload: message.id });\n }\n };\n\n const dismiss = () => {\n clearTimeout(timeoutRef.current);\n if (dismissed) return;\n setDismissed(true);\n topLevelDismiss?.({ id: message.id, timeout: false });\n };\n\n useEffect(() => {\n if (Number.isFinite(dismissAfter)) {\n timeoutRef.current = window.setTimeout(dismiss, dismissAfter);\n }\n\n return () => {\n window.clearTimeout(timeoutRef.current);\n };\n }, []);\n\n return (\n <Flex\n container={{ alignItems: 'center', gap: 0.25 }}\n as={StyledToast}\n ref={ref}\n style={\n {\n '--translateY': `${-translateY}px`,\n '--opacity': dismissed ? '0' : '1',\n '--scale': dismissed ? '0' : '1'\n } as CSSProperties\n }\n onTransitionEnd={onTransitionEnd}\n >\n <Flex item={{ grow: 1 }} as={StyledToastContent}>\n {content}\n </Flex>\n <Button\n as={StyledToastButton}\n variant='simple'\n onClick={dismiss}\n icon\n aria-label={t('dismiss_label')}\n >\n <Icon name='times' />\n </Button>\n </Flex>\n );\n }\n);\n\nconst Toaster: FunctionComponent<ToasterProps> = ({\n children,\n dismissAfter = Infinity,\n onDismiss\n}: ToasterProps) => {\n const { portalTarget } = useConfiguration();\n const [messages, dispatch] = useReducer(reducer, []);\n const [yOffsets, setYOffsets] = useState<number[]>([]);\n const heightHashRef = useRef<{\n [id: string]: number;\n }>({});\n\n // This effect will cause a re-render with a translateY value set for each toast.\n useLayoutEffect(() => {\n const heights = [...messages].reverse().map(({ id }) => heightHashRef.current[id]);\n\n setYOffsets(\n heights\n .map((_, i) => heights.slice(0, i + 1).reduce((sum, cur) => sum + cur + 4, 0))\n .reverse()\n );\n }, [messages.length]);\n\n const providerValue = useMemo(\n () => ({\n push(incoming: ToastMessage) {\n const message: ToastState = {\n ...incoming,\n id: incoming.id ?? createUID()\n };\n\n dispatch({\n type: 'push',\n payload: message\n });\n },\n initialized: true\n }),\n [onDismiss, dismissAfter]\n );\n\n // Don't create additional ToasterContext.Providers.\n const context = windowIsAvailable\n ? window.cosmos.toasterContext ?? ToasterContext\n : ToasterContext;\n const priorCtx = useContext(context);\n if (priorCtx.initialized) {\n return <context.Provider value={priorCtx}>{children}</context.Provider>;\n }\n\n return (\n <>\n <context.Provider value={providerValue}>{children}</context.Provider>\n {!!messages.length &&\n portalTarget &&\n createPortal(\n <StyledToaster>\n {messages.map((message, i) => {\n return (\n <Toast\n {...message}\n translateY={yOffsets[i] ?? 0}\n topLevelDismiss={onDismiss}\n dismissAfter={message.dismissAfter ?? dismissAfter}\n key={message.id}\n dispatch={dispatch}\n ref={el => {\n if (el) {\n heightHashRef.current[message.id] = el.offsetHeight;\n } else {\n delete heightHashRef.current[message.id];\n }\n }}\n />\n );\n })}\n </StyledToaster>,\n portalTarget\n )}\n </>\n );\n};\n\nexport default Toaster;\n"]}
1
+ {"version":3,"file":"Toaster.js","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,OAAO,EACP,eAAe,EAKf,MAAM,EACN,QAAQ,EACR,UAAU,EAGV,SAAS,EAEV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAuB,MAAM,WAAW,CAAC;AAEhE,YAAY,CAAC,SAAS,CAAC,CAAC;AAuBxB,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CACrC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;;;;;;;;;oBAWA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Context,\n useReducer,\n useMemo,\n useLayoutEffect,\n FunctionComponent,\n CSSProperties,\n TransitionEvent,\n Context,\n useRef,\n useState,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useEffect,\n Dispatch\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport { createUID, windowIsAvailable } from '../../utils';\nimport { useConfiguration, useI18n, useLiveLog } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport '../../init';\n\nimport { ToastMessage, ToasterProps } from './Toaster.types';\nimport { ToasterContext, ToasterContextValue } from './Context';\n\nregisterIcon(timesIcon);\n\ninterface ToastState extends ToastMessage {\n id: NonNullable<ToastMessage['id']>;\n}\n\ntype ToastReducerAction =\n | { type: 'push'; payload: ToastState }\n | { type: 'unmount'; payload: ToastState['id'] };\n\ninterface ToastProps extends ToastState {\n topLevelDismiss: ToasterProps['onDismiss'];\n translateY: number;\n dispatch: Dispatch<ToastReducerAction>;\n ref: Ref<HTMLDivElement>;\n}\n\ndeclare module '../../init' {\n export interface CosmosGlobals {\n toasterContext?: Context<ToasterContextValue>;\n }\n}\n\nconst StyledToastButton = styled.button(\n ({ theme }) => css`\n border: none;\n color: inherit;\n padding: 0;\n font-size: 1rem;\n\n &:enabled:hover {\n background: #ffffff19;\n }\n\n &:enabled:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledToastButton.defaultProps = defaultThemeProp;\n\nconst StyledToastContent = styled.div(({ theme }) => {\n return css`\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: ${theme.base['font-size']};\n margin-inline-start: calc(${theme.base['border-radius']} / 2);\n `;\n});\n\nStyledToastContent.defaultProps = defaultThemeProp;\n\nconst StyledToast = styled.div(({ theme }) => {\n return css`\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n width: 100%;\n padding: calc(${theme.base.spacing} / 2);\n background: ${theme.base.colors.slate['extra-dark']};\n color: ${theme.base.colors.white};\n border-radius: calc(${theme.base['border-radius']} / 2);\n opacity: var(--opacity);\n transform: translateY(var(--translateY)) scale(var(--scale));\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n `;\n});\n\nStyledToast.defaultProps = defaultThemeProp;\n\nconst StyledToaster = styled.div`\n position: fixed;\n z-index: ${({ theme }) => theme.base['z-index'].toast};\n width: min(40ch, calc(100% - 1rem));\n inset-inline-start: 50%;\n transform: translateX(-50%);\n top: 100%;\n`;\n\nStyledToaster.defaultProps = defaultThemeProp;\n\nfunction reducer(current: ToastState[], action: ToastReducerAction) {\n switch (action.type) {\n case 'push':\n return [\n ...current,\n {\n ...action.payload\n }\n ];\n\n case 'unmount':\n return current.filter(m => m.id !== action.payload);\n\n default:\n return current;\n }\n}\n\nconst Toast: FunctionComponent<ToastProps> = forwardRef(function Toast(\n { dispatch, topLevelDismiss, dismissAfter, ...message }: PropsWithoutRef<ToastProps>,\n ref: ToastProps['ref']\n) {\n const { content, translateY } = message;\n const [dismissed, setDismissed] = useState(false);\n const timeoutRef = useRef(NaN);\n const t = useI18n();\n const { announcePolite } = useLiveLog();\n\n useEffect(() => {\n announcePolite({ message: message.content, type: 'acknowledgement' });\n }, []);\n\n const onTransitionEnd = (e: TransitionEvent<HTMLDivElement>) => {\n if (dismissed && e.propertyName === 'opacity' && e.target === e.currentTarget) {\n dispatch({ type: 'unmount', payload: message.id });\n }\n };\n\n const dismiss = () => {\n clearTimeout(timeoutRef.current);\n if (dismissed) return;\n setDismissed(true);\n topLevelDismiss?.({ id: message.id, timeout: false });\n };\n\n useEffect(() => {\n if (Number.isFinite(dismissAfter)) {\n timeoutRef.current = window.setTimeout(dismiss, dismissAfter);\n }\n\n return () => {\n window.clearTimeout(timeoutRef.current);\n };\n }, []);\n\n return (\n <Flex\n container={{ alignItems: 'center', gap: 0.25 }}\n as={StyledToast}\n ref={ref}\n style={\n {\n '--translateY': `${-translateY}px`,\n '--opacity': dismissed ? '0' : '1',\n '--scale': dismissed ? '0' : '1'\n } as CSSProperties\n }\n onTransitionEnd={onTransitionEnd}\n >\n <Flex item={{ grow: 1 }} as={StyledToastContent}>\n {content}\n </Flex>\n <Button\n as={StyledToastButton}\n variant='simple'\n onClick={dismiss}\n icon\n aria-label={t('dismiss_label')}\n >\n <Icon name='times' />\n </Button>\n </Flex>\n );\n});\n\nconst Toaster: FunctionComponent<ToasterProps> = ({\n children,\n dismissAfter = Infinity,\n onDismiss\n}: ToasterProps) => {\n const { portalTarget } = useConfiguration();\n const [messages, dispatch] = useReducer(reducer, []);\n const [yOffsets, setYOffsets] = useState<number[]>([]);\n const heightHashRef = useRef<{\n [id: string]: number;\n }>({});\n\n // This effect will cause a re-render with a translateY value set for each toast.\n useLayoutEffect(() => {\n const heights = [...messages].reverse().map(({ id }) => heightHashRef.current[id]);\n\n setYOffsets(\n heights\n .map((_, i) => heights.slice(0, i + 1).reduce((sum, cur) => sum + cur + 4, 0))\n .reverse()\n );\n }, [messages.length]);\n\n const providerValue = useMemo(\n () => ({\n push(incoming: ToastMessage) {\n const message: ToastState = {\n ...incoming,\n id: incoming.id ?? createUID()\n };\n\n dispatch({\n type: 'push',\n payload: message\n });\n },\n initialized: true\n }),\n [onDismiss, dismissAfter]\n );\n\n // Don't create additional ToasterContext.Providers.\n const context = windowIsAvailable\n ? window.cosmos.toasterContext ?? ToasterContext\n : ToasterContext;\n const priorCtx = useContext(context);\n if (priorCtx.initialized) {\n return <context.Provider value={priorCtx}>{children}</context.Provider>;\n }\n\n return (\n <>\n <context.Provider value={providerValue}>{children}</context.Provider>\n {!!messages.length &&\n portalTarget &&\n createPortal(\n <StyledToaster>\n {messages.map((message, i) => {\n return (\n <Toast\n {...message}\n translateY={yOffsets[i] ?? 0}\n topLevelDismiss={onDismiss}\n dismissAfter={message.dismissAfter ?? dismissAfter}\n key={message.id}\n dispatch={dispatch}\n ref={el => {\n if (el) {\n heightHashRef.current[message.id] = el.offsetHeight;\n } else {\n delete heightHashRef.current[message.id];\n }\n }}\n />\n );\n })}\n </StyledToaster>,\n portalTarget\n )}\n </>\n );\n};\n\nexport default Toaster;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAGjB,GAAG,EAKJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK1D,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,oCAAoC;IACpC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,gDAAgD;IAChD,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,yGAcxB,CAAC;AAIH,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,GAAG,YAAY,CAoI3D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAGjB,GAAG,EAKJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK1D,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,oCAAoC;IACpC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,gDAAgD;IAChD,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,yGAcxB,CAAC;AAIH,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,GAAG,YAAY,CAkI1D,CAAC;AAEH,eAAe,OAAO,CAAC"}
@@ -21,7 +21,7 @@ export const StyledTooltip = styled.div(({ theme }) => {
21
21
  `;
22
22
  });
23
23
  StyledTooltip.defaultProps = defaultThemeProp;
24
- const Tooltip = forwardRef(({ children, target, showDelay = 'short', hideDelay = 'long', portal = true, placement = 'bottom', describeTarget = true, smart, ...restProps }, ref) => {
24
+ const Tooltip = forwardRef(function Tooltip({ children, target, showDelay = 'short', hideDelay = 'long', portal = true, placement = 'bottom', describeTarget = true, smart, ...restProps }, ref) {
25
25
  const id = useUID();
26
26
  const [show, setShow] = useState(false);
27
27
  const tooltipRef = useConsolidatedRef(ref);
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,OAAgC,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAyC/C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC;aACvD,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC;iBACxC,QAAQ,CAAC,GAAG;;eAEd,KAAK,CAAC,IAAI,CAAC,OAAO;;;;eAIlB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO;GACzC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9C,MAAM,OAAO,GAAmD,UAAU,CACxE,CACE,EACE,QAAQ,EACR,MAAM,EACN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AS,EACpB,WAAW,EAAE,WAAW,EACxB,kBAAkB,QAClB,GAAG,EAAE,UAAU,YAEd,QAAQ,GACD,CACX,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MutableRefObject,\n PropsWithoutRef,\n Ref,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Popover, { Delay, PopoverProps } from '../Popover';\nimport { useConsolidatedRef, useUID } from '../../hooks';\nimport { calculateFontSize } from '../../styles';\nimport { getActiveElement } from '../../utils';\n\nexport interface TooltipProps extends BaseProps {\n /** Text content for the tooltip. */\n children: string | string[];\n /** Element to serve as the tooltip's target. */\n target: Element | null;\n /**\n * Delay showing the tooltip on mouseenter.\n * @default 'short'\n */\n showDelay?: Delay;\n /**\n * Delay hiding the tooltip on mouseleave.\n * @default 'long'\n */\n hideDelay?: Delay;\n /**\n * If true, the Tooltip will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default true\n */\n portal?: PopoverProps['portal'];\n /**\n * If true, the Tooltip will automatically apply an aria-describedby attribute to its target.\n * @default true\n */\n describeTarget?: boolean;\n /**\n * Sets the placement of the tooltip relative to the target.\n * @default 'bottom'\n */\n placement?: PopoverProps['placement'];\n /**\n * Conditionally renders a tooltip only if the associated element's text content is truncated.\n * To work, the associated element must be be displayed as a CSS \"block box\" i.e. block, inline-block, etc...\n * @default false\n */\n smart?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledTooltip = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n background-color: ${theme.components.tooltip['background-color']};\n color: ${theme.components.tooltip['foreground-color']};\n font-size: ${fontSize.xxs};\n max-width: 40ch;\n padding: ${theme.base.spacing};\n white-space: pre-line;\n word-break: break-word;\n pointer-events: none;\n z-index: ${theme.base['z-index'].tooltip};\n `;\n});\n\nStyledTooltip.defaultProps = defaultThemeProp;\n\nconst Tooltip: FunctionComponent<TooltipProps & ForwardProps> = forwardRef(\n (\n {\n children,\n target,\n showDelay = 'short',\n hideDelay = 'long',\n portal = true,\n placement = 'bottom',\n describeTarget = true,\n smart,\n ...restProps\n }: PropsWithoutRef<TooltipProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n const id = useUID();\n const [show, setShow] = useState(false);\n const tooltipRef = useConsolidatedRef(ref);\n const lastClickedRef: MutableRefObject<EventTarget | null> = useRef(null);\n\n const onMouseDown = useCallback(\n ({ target: eTarget }: MouseEvent) => {\n lastClickedRef.current = eTarget;\n if (eTarget === tooltipRef.current || eTarget === target) return;\n setShow(false);\n },\n [target]\n );\n\n useEffect(() => {\n if (!target) return;\n\n const showTooltip = () => {\n setShow(\n // This approach may result in a tooltip NOT appearing 1px before it should due to browser specifics. Enhance as needed.\n // https://stackoverflow.com/a/64747288\n smart ? target.scrollWidth > target.getBoundingClientRect().width : true\n );\n };\n\n const onFocusIn = () => {\n showTooltip();\n };\n\n const onFocusOut = () => {\n if (lastClickedRef.current !== tooltipRef.current) {\n setShow(false);\n }\n lastClickedRef.current = null;\n };\n\n const onMouseEnter = () => {\n showTooltip();\n };\n\n const onMouseLeave = () => {\n if (getActiveElement() !== target) {\n setShow(false);\n }\n };\n\n const onKeyDown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape' && getActiveElement() === target) {\n setShow(false);\n }\n };\n\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('mousedown', onMouseDown);\n\n target.addEventListener('focusin', onFocusIn);\n target.addEventListener('focusout', onFocusOut);\n\n target.addEventListener('mouseenter', onMouseEnter);\n target.addEventListener('mouseleave', onMouseLeave);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('mousedown', onMouseDown);\n\n target.removeEventListener('focusin', onFocusIn);\n target.removeEventListener('focusout', onFocusOut);\n\n target.removeEventListener('mouseenter', onMouseEnter);\n target.removeEventListener('mouseleave', onMouseLeave);\n };\n }, [target, onMouseDown, smart]);\n\n useEffect(() => {\n if (target && describeTarget && show) {\n const describedBy = target.getAttribute('aria-describedby');\n // Set the attribute to the old attribute plus the id\n target.setAttribute('aria-describedby', describedBy ? `${describedBy} ${id}` : id);\n } else if (target) {\n // Get the old attribute\n const describedBy = target.getAttribute('aria-describedby');\n if (describedBy) {\n // If the old attribute matches the id just remove it entirely\n if (describedBy === id) {\n target.removeAttribute('aria-describedby');\n } else {\n // Otherwise we want to just remove the id that was added and reset the attribute to what it was before\n const oldDescribedBy = describedBy.replace(new RegExp(`(?:^|\\\\s+)${id}`), '');\n target.setAttribute('aria-describedby', oldDescribedBy);\n }\n }\n }\n }, [describeTarget, target, show]);\n\n return (\n <Popover\n id={id}\n {...restProps}\n show={show}\n showDelay={showDelay}\n hideDelay={hideDelay}\n groupId='tooltip'\n strategy='fixed'\n portal={portal}\n as={StyledTooltip}\n role='tooltip'\n target={target}\n arrow\n placement={placement}\n onMouseDown={onMouseDown}\n hideOnTargetHidden\n ref={tooltipRef}\n >\n {children}\n </Popover>\n );\n }\n);\n\nexport default Tooltip;\n"]}
1
+ {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,OAAgC,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE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AAE;oBACtB,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;iBAC5C;qBAAM;oBACL,uGAAuG;oBACvG,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC9E,MAAM,CAAC,YAAY,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;iBACzD;aACF;SACF;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnC,OAAO,CACL,KAAC,OAAO,IACN,EAAE,EAAE,EAAE,KACF,SAAS,EACb,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAC,SAAS,EACjB,QAAQ,EAAC,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,aAAa,EACjB,IAAI,EAAC,SAAS,EACd,MAAM,EAAE,MAAM,EACd,KAAK,QACL,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,kBAAkB,QAClB,GAAG,EAAE,UAAU,YAEd,QAAQ,GACD,CACX,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MutableRefObject,\n PropsWithoutRef,\n Ref,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Popover, { Delay, PopoverProps } from '../Popover';\nimport { useConsolidatedRef, useUID } from '../../hooks';\nimport { calculateFontSize } from '../../styles';\nimport { getActiveElement } from '../../utils';\n\nexport interface TooltipProps extends BaseProps {\n /** Text content for the tooltip. */\n children: string | string[];\n /** Element to serve as the tooltip's target. */\n target: Element | null;\n /**\n * Delay showing the tooltip on mouseenter.\n * @default 'short'\n */\n showDelay?: Delay;\n /**\n * Delay hiding the tooltip on mouseleave.\n * @default 'long'\n */\n hideDelay?: Delay;\n /**\n * If true, the Tooltip will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default true\n */\n portal?: PopoverProps['portal'];\n /**\n * If true, the Tooltip will automatically apply an aria-describedby attribute to its target.\n * @default true\n */\n describeTarget?: boolean;\n /**\n * Sets the placement of the tooltip relative to the target.\n * @default 'bottom'\n */\n placement?: PopoverProps['placement'];\n /**\n * Conditionally renders a tooltip only if the associated element's text content is truncated.\n * To work, the associated element must be be displayed as a CSS \"block box\" i.e. block, inline-block, etc...\n * @default false\n */\n smart?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledTooltip = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n background-color: ${theme.components.tooltip['background-color']};\n color: ${theme.components.tooltip['foreground-color']};\n font-size: ${fontSize.xxs};\n max-width: 40ch;\n padding: ${theme.base.spacing};\n white-space: pre-line;\n word-break: break-word;\n pointer-events: none;\n z-index: ${theme.base['z-index'].tooltip};\n `;\n});\n\nStyledTooltip.defaultProps = defaultThemeProp;\n\nconst Tooltip: FunctionComponent<TooltipProps & ForwardProps> = forwardRef(function Tooltip(\n {\n children,\n target,\n showDelay = 'short',\n hideDelay = 'long',\n portal = true,\n placement = 'bottom',\n describeTarget = true,\n smart,\n ...restProps\n }: PropsWithoutRef<TooltipProps>,\n ref: Ref<HTMLDivElement>\n) {\n const id = useUID();\n const [show, setShow] = useState(false);\n const tooltipRef = useConsolidatedRef(ref);\n const lastClickedRef: MutableRefObject<EventTarget | null> = useRef(null);\n\n const onMouseDown = useCallback(\n ({ target: eTarget }: MouseEvent) => {\n lastClickedRef.current = eTarget;\n if (eTarget === tooltipRef.current || eTarget === target) return;\n setShow(false);\n },\n [target]\n );\n\n useEffect(() => {\n if (!target) return;\n\n const showTooltip = () => {\n setShow(\n // This approach may result in a tooltip NOT appearing 1px before it should due to browser specifics. Enhance as needed.\n // https://stackoverflow.com/a/64747288\n smart ? target.scrollWidth > target.getBoundingClientRect().width : true\n );\n };\n\n const onFocusIn = () => {\n showTooltip();\n };\n\n const onFocusOut = () => {\n if (lastClickedRef.current !== tooltipRef.current) {\n setShow(false);\n }\n lastClickedRef.current = null;\n };\n\n const onMouseEnter = () => {\n showTooltip();\n };\n\n const onMouseLeave = () => {\n if (getActiveElement() !== target) {\n setShow(false);\n }\n };\n\n const onKeyDown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape' && getActiveElement() === target) {\n setShow(false);\n }\n };\n\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('mousedown', onMouseDown);\n\n target.addEventListener('focusin', onFocusIn);\n target.addEventListener('focusout', onFocusOut);\n\n target.addEventListener('mouseenter', onMouseEnter);\n target.addEventListener('mouseleave', onMouseLeave);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('mousedown', onMouseDown);\n\n target.removeEventListener('focusin', onFocusIn);\n target.removeEventListener('focusout', onFocusOut);\n\n target.removeEventListener('mouseenter', onMouseEnter);\n target.removeEventListener('mouseleave', onMouseLeave);\n };\n }, [target, onMouseDown, smart]);\n\n useEffect(() => {\n if (target && describeTarget && show) {\n const describedBy = target.getAttribute('aria-describedby');\n // Set the attribute to the old attribute plus the id\n target.setAttribute('aria-describedby', describedBy ? `${describedBy} ${id}` : id);\n } else if (target) {\n // Get the old attribute\n const describedBy = target.getAttribute('aria-describedby');\n if (describedBy) {\n // If the old attribute matches the id just remove it entirely\n if (describedBy === id) {\n target.removeAttribute('aria-describedby');\n } else {\n // Otherwise we want to just remove the id that was added and reset the attribute to what it was before\n const oldDescribedBy = describedBy.replace(new RegExp(`(?:^|\\\\s+)${id}`), '');\n target.setAttribute('aria-describedby', oldDescribedBy);\n }\n }\n }\n }, [describeTarget, target, show]);\n\n return (\n <Popover\n id={id}\n {...restProps}\n show={show}\n showDelay={showDelay}\n hideDelay={hideDelay}\n groupId='tooltip'\n strategy='fixed'\n portal={portal}\n as={StyledTooltip}\n role='tooltip'\n target={target}\n arrow\n placement={placement}\n onMouseDown={onMouseDown}\n hideOnTargetHidden\n ref={tooltipRef}\n >\n {children}\n </Popover>\n );\n});\n\nexport default Tooltip;\n"]}
@@ -170,7 +170,7 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
170
170
  '--has-parent-sibling': hasParentSibling ? 1 : 0
171
171
  }, "aria-busy": loading, children: nodes ? (_jsxs(_Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'between', gap: 2 }, as: StyledStandardTreeParent, forwardedAs: href ? 'a' : 'div', role: 'treeitem', "aria-current": current ? ariaCurrent : undefined, tabIndex: tabIndex, variant: 'text', onClick: selectableParents ? handleParentClick : handleParentToggle, href: selectableParents ? href : undefined, "aria-expanded": expanded ? 'true' : 'false', "aria-owns": `${id}-subtree`, "aria-label": label, onKeyDown: onKeyDown, ref: elRef, children: [_jsxs(Flex, { container: { alignItems: 'center' }, as: 'span', children: [selectableParents ? (_jsx(Button, { variant: 'simple', tabIndex: -1, icon: true, compact: true, onClick: handleParentToggle, children: _jsx(StyledToggleIcon, { name: 'caret-right' }) })) : (_jsx(Flex, { as: StyledToggleIconWrapper, container: { justify: 'center', alignItems: 'center' }, children: _jsx(StyledToggleIcon, { name: 'caret-right' }) })), labelContent] }), actionsJSX] }), _jsxs(StyledStandardTreeItemSubTree, { lined: lined, id: `${id}-subtree`, children: [subTree, loading && _jsx(Progress, { variant: 'ring', placement: 'inline' })] })] })) : (_jsx(StyledStandardTreeLeaf, { children: labelContent })) }));
172
172
  };
173
- const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, onNodeToggle, lined = false, selectableParents = true, ...restProps }, ref) => {
173
+ const StandardTreeWithNodes = forwardRef(function StandardTreeWithNodes({ nodes, currentNodeId, onNodeClick, onNodeToggle, lined = false, selectableParents = true, ...restProps }, ref) {
174
174
  const [focusedNodeId, setFocusedNodedId] = useState();
175
175
  const treeRef = useConsolidatedRef(ref);
176
176
  const lastNodeId = useMemo(() => {
@@ -234,7 +234,7 @@ const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, o
234
234
  selectableParents
235
235
  ]), children: _jsx(StyledStandardTree, { ...restProps, ref: treeRef, nodes: nodes, nodeRenderer: NodeRenderer }) }));
236
236
  });
237
- const StandardTree = forwardRef((props, ref) => {
237
+ const StandardTree = forwardRef(function StandardTree(props, ref) {
238
238
  return props.nodes.length > 0 ? _jsx(StandardTreeWithNodes, { ...props, ref: ref }) : null;
239
239
  });
240
240
  export default StandardTree;
@@ -1 +1 @@
1
- {"version":3,"file":"StandardTree.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,EAER,SAAS,EACT,MAAM,EACP,MAAM,OAAO,CAAC;AAGf,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,6BAA6B,EAC7B,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACf,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,MAAM,mBAAmB,GAAG,aAAa,CAavC;IACA,aAAa,EAAE,SAAS;IACxB,KAAK,EAAE,KAAK;I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AAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;IAEzC,OAAO,CACL,KAAC,mBAAmB,CAAC,QAAQ,IAC3B,KAAK,EAAE,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;YACL,aAAa;YACb,aAAa;YACb,UAAU;YACV,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;YACxB,mBAAmB;YACnB,WAAW;YACX,YAAY;YACZ,KAAK;YACL,iBAAiB;SAClB,CAAC,EACF;YACE,aAAa;YACb,WAAW;YACX,KAAK;YACL,aAAa;YACb,UAAU;YACV,YAAY;YACZ,iBAAiB;SAClB,CACF,YAGD,KAAC,kBAAkB,OACb,SAAS,EACb,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,GAC1B,GAC2B,CAChC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,YAAY,GAAwD,UAAU,CAClF,CAAC,KAAyC,EAAE,GAA6B,EAAE,EAAE;IAC3E,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAC,qBAAqB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACxF,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n createContext,\n useMemo,\n useContext,\n useCallback,\n useState,\n KeyboardEvent,\n useEffect,\n useRef\n} from 'react';\nimport type { FunctionComponent, PropsWithoutRef, CSSProperties, MouseEvent } from 'react';\n\nimport Progress from '../Progress';\nimport { useConsolidatedRef, useDirection, useFocusWithin } from '../../hooks';\nimport Flex from '../Flex';\nimport Actions from '../Actions';\nimport type { Action, ForwardProps } from '../../types';\nimport { cap } from '../../utils';\nimport Button from '../Button';\n\nimport {\n StyledStandardTreeParent,\n StyledToggleIcon,\n StyledToggleIconWrapper,\n StyledStandardTreeItemSubTree,\n StyledStandardTreeLeaf,\n StyledStandardTree,\n StyledNodeInteraction,\n StyledStandardTreeNode,\n StyledNodeActions,\n StyledLabelContent,\n StyledNodeIcon,\n StyledNodeText\n} from './StandardTree.styles';\nimport type { TreeProps } from './Tree';\nimport type {\n StandardTreeContextProps,\n StandardTreeNode,\n StandardTreeProps,\n StandardTreePropsWithDefaults\n} from './StandardTree.types';\nimport helpers from './helpers';\n\nconst StandardTreeContext = createContext<\n Pick<\n StandardTreePropsWithDefaults,\n | 'currentNodeId'\n | 'lined'\n | 'onNodeClick'\n | 'onNodeToggle'\n | 'firstNodeId'\n | 'lastNodeId'\n | 'focusedNodeId'\n | 'changeFocusedNodeId'\n | 'selectableParents'\n >\n>({\n currentNodeId: undefined,\n lined: false,\n onNodeClick: () => {},\n onNodeToggle: () => {},\n firstNodeId: undefined,\n lastNodeId: undefined,\n focusedNodeId: undefined,\n changeFocusedNodeId: () => {},\n selectableParents: true\n});\n\nconst NodeRenderer: TreeProps<StandardTreeNode>['nodeRenderer'] = ({\n id,\n label,\n icon,\n depth,\n hasParentSibling,\n nodes,\n expanded = false,\n loading = false,\n subTree,\n actions,\n onClick,\n href\n}) => {\n const {\n currentNodeId,\n onNodeClick,\n onNodeToggle,\n lined,\n focusedNodeId,\n changeFocusedNodeId,\n firstNodeId,\n lastNodeId,\n selectableParents\n } = useContext(StandardTreeContext);\n const current = currentNodeId === id;\n const focusedEl = focusedNodeId === id;\n const firstNode = firstNodeId === id;\n const { start, end } = useDirection();\n\n const ariaCurrent = useMemo(() => {\n return href ? 'page' : 'true';\n }, [href]);\n\n const tabIndex = useMemo(() => {\n let index = -1;\n if (focusedNodeId) {\n index = focusedEl ? 0 : -1;\n } else if (currentNodeId && nodes && helpers.getNode(nodes, currentNodeId)) {\n index = current ? 0 : -1;\n } else {\n index = firstNode ? 0 : -1;\n }\n return index;\n }, [focusedNodeId, currentNodeId, current, focusedEl]);\n\n const handleParentClick = useCallback(\n (e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n },\n [id, onNodeClick, changeFocusedNodeId]\n );\n\n const handleParentToggle = useCallback(\n (e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n onNodeToggle?.(id, e);\n changeFocusedNodeId(id);\n },\n [id, onNodeToggle, changeFocusedNodeId]\n );\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(e.key)) e.preventDefault();\n if (e.key === 'Enter' && !href) e.preventDefault();\n switch (e.key) {\n case 'ArrowUp':\n changeFocusedNodeId(id, 'up');\n break;\n case 'ArrowDown':\n changeFocusedNodeId(id, 'down');\n break;\n case `Arrow${cap(end)}`:\n if (nodes) {\n if (expanded) {\n changeFocusedNodeId(id, 'right');\n } else {\n onNodeToggle?.(id);\n }\n }\n break;\n case `Arrow${cap(start)}`:\n if (expanded) {\n onNodeToggle?.(id);\n } else {\n changeFocusedNodeId(id, 'left');\n }\n break;\n case 'Enter':\n onClick?.(id, e);\n if (nodes) {\n if (selectableParents) {\n handleParentClick(e);\n } else {\n handleParentToggle(e);\n }\n } else {\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n }\n break;\n case 'Home':\n if (firstNodeId) changeFocusedNodeId(firstNodeId);\n break;\n case 'End':\n if (lastNodeId) changeFocusedNodeId(lastNodeId);\n break;\n default:\n }\n },\n [id, end, nodes, expanded, actions, firstNodeId, lastNodeId, changeFocusedNodeId]\n );\n\n const actionsJSX = useMemo(() => {\n // since Actions may render a frag of buttons and we need a wrapper for flex space-between.\n return actions ? (\n <StyledNodeActions>\n <Actions\n items={actions.map(action => {\n return {\n ...action,\n onClick: (\n actionId: Action['id'],\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => {\n e.stopPropagation();\n e.preventDefault();\n action?.onClick?.(actionId, e);\n },\n onKeyDown: (e: KeyboardEvent) => {\n if (e.key === 'Enter') e.stopPropagation();\n }\n };\n })}\n menuAt={3}\n menuButtonProps={{\n onClick: (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n },\n onKeyDown: (e: KeyboardEvent) => {\n e.stopPropagation();\n if (['ArrowUp', 'ArrowDown'].includes(e.key)) {\n e.preventDefault();\n }\n }\n }}\n />\n </StyledNodeActions>\n ) : null;\n }, [actions]);\n\n const elRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (focusedEl) {\n elRef?.current?.focus();\n }\n }, [focusedEl]);\n\n const labelContent = useMemo(() => {\n const internal = (\n // Wrapping in a div for handling of flex space-between when there are node actions.\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as={StyledLabelContent}>\n {icon && <StyledNodeIcon name={icon} />}\n <StyledNodeText>{label}</StyledNodeText>\n </Flex>\n );\n\n return !nodes && (onClick ?? onNodeClick) ? (\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledNodeInteraction}\n forwardedAs={href ? 'a' : 'div'}\n role='treeitem'\n aria-current={current ? ariaCurrent : undefined}\n tabIndex={tabIndex}\n onClick={(e: MouseEvent<HTMLElement>) => {\n onClick?.(id, e);\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n }}\n href={href}\n onKeyDown={onKeyDown}\n ref={elRef}\n >\n {internal}\n {actionsJSX}\n </Flex>\n ) : (\n internal\n );\n }, [\n id,\n label,\n icon,\n nodes,\n actions,\n onClick,\n onNodeClick,\n current,\n focusedEl,\n tabIndex,\n changeFocusedNodeId,\n onKeyDown\n ]);\n\n return (\n <StyledStandardTreeNode\n id={id}\n style={\n {\n '--depth': depth,\n '--has-parent': depth ? 1 : 0,\n '--has-parent-sibling': hasParentSibling ? 1 : 0\n } as CSSProperties\n }\n aria-busy={loading}\n >\n {nodes ? (\n <>\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledStandardTreeParent}\n forwardedAs={href ? 'a' : 'div'}\n role='treeitem'\n aria-current={current ? ariaCurrent : undefined}\n tabIndex={tabIndex}\n variant='text'\n onClick={selectableParents ? handleParentClick : handleParentToggle}\n href={selectableParents ? href : undefined}\n aria-expanded={expanded ? 'true' : 'false'}\n aria-owns={`${id}-subtree`}\n aria-label={label}\n onKeyDown={onKeyDown}\n ref={elRef}\n >\n <Flex container={{ alignItems: 'center' }} as='span'>\n {selectableParents ? (\n <Button variant='simple' tabIndex={-1} icon compact onClick={handleParentToggle}>\n <StyledToggleIcon name='caret-right' />\n </Button>\n ) : (\n <Flex\n as={StyledToggleIconWrapper}\n container={{ justify: 'center', alignItems: 'center' }}\n >\n <StyledToggleIcon name='caret-right' />\n </Flex>\n )}\n {labelContent}\n </Flex>\n {actionsJSX}\n </Flex>\n <StyledStandardTreeItemSubTree lined={lined} id={`${id}-subtree`}>\n {subTree}\n {loading && <Progress variant='ring' placement='inline' />}\n </StyledStandardTreeItemSubTree>\n </>\n ) : (\n <StyledStandardTreeLeaf>{labelContent}</StyledStandardTreeLeaf>\n )}\n </StyledStandardTreeNode>\n );\n};\n\nconst StandardTreeWithNodes: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n (\n {\n nodes,\n currentNodeId,\n onNodeClick,\n onNodeToggle,\n lined = false,\n selectableParents = true,\n ...restProps\n }: PropsWithoutRef<StandardTreeProps>,\n ref: StandardTreeProps['ref']\n ) => {\n const [focusedNodeId, setFocusedNodedId] = useState<string | undefined>();\n const treeRef = useConsolidatedRef(ref);\n\n const lastNodeId = useMemo(() => {\n return helpers.getDeepestNode(nodes, nodes[nodes.length - 1].id)?.id;\n }, [nodes]);\n\n const changeFocusedNodeId: StandardTreeContextProps['changeFocusedNodeId'] = useCallback(\n (id, type) => {\n switch (type) {\n case 'up': {\n const previousNode = helpers.getPreviousNode(nodes, id);\n if (previousNode) setFocusedNodedId(previousNode.id);\n break;\n }\n case 'down': {\n const nextNode = helpers.getNextNode(nodes, id);\n if (nextNode) setFocusedNodedId(nextNode.id);\n break;\n }\n case 'left': {\n const parentNode = helpers.getParentNode(nodes, id);\n if (parentNode) setFocusedNodedId(parentNode.id);\n break;\n }\n case 'right': {\n const childNode = helpers.getFirstChildNode(nodes, id);\n if (childNode) setFocusedNodedId(childNode.id);\n break;\n }\n default: {\n if (id !== focusedNodeId) setFocusedNodedId(id);\n break;\n }\n }\n },\n [nodes]\n );\n\n const onFocusChange = (focused: boolean) => {\n if (!focused) setFocusedNodedId('');\n };\n\n useFocusWithin([treeRef], onFocusChange);\n\n return (\n <StandardTreeContext.Provider\n value={useMemo(\n () => ({\n currentNodeId,\n focusedNodeId,\n lastNodeId,\n firstNodeId: nodes[0].id,\n changeFocusedNodeId,\n onNodeClick,\n onNodeToggle,\n lined,\n selectableParents\n }),\n [\n currentNodeId,\n onNodeClick,\n lined,\n focusedNodeId,\n lastNodeId,\n onNodeToggle,\n selectableParents\n ]\n )}\n >\n {/* FIXME: Types are having issues when styled(Tree) is typeof Tree. */}\n <StyledStandardTree\n {...restProps}\n ref={treeRef}\n nodes={nodes}\n nodeRenderer={NodeRenderer}\n />\n </StandardTreeContext.Provider>\n );\n }\n);\n\nconst StandardTree: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<StandardTreeProps>, ref: StandardTreeProps['ref']) => {\n return props.nodes.length > 0 ? <StandardTreeWithNodes {...props} ref={ref} /> : null;\n }\n);\n\nexport default StandardTree;\n"]}
1
+ {"version":3,"file":"StandardTree.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,EAER,SAAS,EACT,MAAM,EACP,MAAM,OAAO,CAAC;AAGf,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,IAAI,MAAM,SAAS,CAAC;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,IAAI,CAAC;AACxF,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n createContext,\n useMemo,\n useContext,\n useCallback,\n useState,\n KeyboardEvent,\n useEffect,\n useRef\n} from 'react';\nimport type { FunctionComponent, PropsWithoutRef, CSSProperties, MouseEvent } from 'react';\n\nimport Progress from '../Progress';\nimport { useConsolidatedRef, useDirection, useFocusWithin } from '../../hooks';\nimport Flex from '../Flex';\nimport Actions from '../Actions';\nimport type { Action, ForwardProps } from '../../types';\nimport { cap } from '../../utils';\nimport Button from '../Button';\n\nimport {\n StyledStandardTreeParent,\n StyledToggleIcon,\n StyledToggleIconWrapper,\n StyledStandardTreeItemSubTree,\n StyledStandardTreeLeaf,\n StyledStandardTree,\n StyledNodeInteraction,\n StyledStandardTreeNode,\n StyledNodeActions,\n StyledLabelContent,\n StyledNodeIcon,\n StyledNodeText\n} from './StandardTree.styles';\nimport type { TreeProps } from './Tree';\nimport type {\n StandardTreeContextProps,\n StandardTreeNode,\n StandardTreeProps,\n StandardTreePropsWithDefaults\n} from './StandardTree.types';\nimport helpers from './helpers';\n\nconst StandardTreeContext = createContext<\n Pick<\n StandardTreePropsWithDefaults,\n | 'currentNodeId'\n | 'lined'\n | 'onNodeClick'\n | 'onNodeToggle'\n | 'firstNodeId'\n | 'lastNodeId'\n | 'focusedNodeId'\n | 'changeFocusedNodeId'\n | 'selectableParents'\n >\n>({\n currentNodeId: undefined,\n lined: false,\n onNodeClick: () => {},\n onNodeToggle: () => {},\n firstNodeId: undefined,\n lastNodeId: undefined,\n focusedNodeId: undefined,\n changeFocusedNodeId: () => {},\n selectableParents: true\n});\n\nconst NodeRenderer: TreeProps<StandardTreeNode>['nodeRenderer'] = ({\n id,\n label,\n icon,\n depth,\n hasParentSibling,\n nodes,\n expanded = false,\n loading = false,\n subTree,\n actions,\n onClick,\n href\n}) => {\n const {\n currentNodeId,\n onNodeClick,\n onNodeToggle,\n lined,\n focusedNodeId,\n changeFocusedNodeId,\n firstNodeId,\n lastNodeId,\n selectableParents\n } = useContext(StandardTreeContext);\n const current = currentNodeId === id;\n const focusedEl = focusedNodeId === id;\n const firstNode = firstNodeId === id;\n const { start, end } = useDirection();\n\n const ariaCurrent = useMemo(() => {\n return href ? 'page' : 'true';\n }, [href]);\n\n const tabIndex = useMemo(() => {\n let index = -1;\n if (focusedNodeId) {\n index = focusedEl ? 0 : -1;\n } else if (currentNodeId && nodes && helpers.getNode(nodes, currentNodeId)) {\n index = current ? 0 : -1;\n } else {\n index = firstNode ? 0 : -1;\n }\n return index;\n }, [focusedNodeId, currentNodeId, current, focusedEl]);\n\n const handleParentClick = useCallback(\n (e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n },\n [id, onNodeClick, changeFocusedNodeId]\n );\n\n const handleParentToggle = useCallback(\n (e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n onNodeToggle?.(id, e);\n changeFocusedNodeId(id);\n },\n [id, onNodeToggle, changeFocusedNodeId]\n );\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(e.key)) e.preventDefault();\n if (e.key === 'Enter' && !href) e.preventDefault();\n switch (e.key) {\n case 'ArrowUp':\n changeFocusedNodeId(id, 'up');\n break;\n case 'ArrowDown':\n changeFocusedNodeId(id, 'down');\n break;\n case `Arrow${cap(end)}`:\n if (nodes) {\n if (expanded) {\n changeFocusedNodeId(id, 'right');\n } else {\n onNodeToggle?.(id);\n }\n }\n break;\n case `Arrow${cap(start)}`:\n if (expanded) {\n onNodeToggle?.(id);\n } else {\n changeFocusedNodeId(id, 'left');\n }\n break;\n case 'Enter':\n onClick?.(id, e);\n if (nodes) {\n if (selectableParents) {\n handleParentClick(e);\n } else {\n handleParentToggle(e);\n }\n } else {\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n }\n break;\n case 'Home':\n if (firstNodeId) changeFocusedNodeId(firstNodeId);\n break;\n case 'End':\n if (lastNodeId) changeFocusedNodeId(lastNodeId);\n break;\n default:\n }\n },\n [id, end, nodes, expanded, actions, firstNodeId, lastNodeId, changeFocusedNodeId]\n );\n\n const actionsJSX = useMemo(() => {\n // since Actions may render a frag of buttons and we need a wrapper for flex space-between.\n return actions ? (\n <StyledNodeActions>\n <Actions\n items={actions.map(action => {\n return {\n ...action,\n onClick: (\n actionId: Action['id'],\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => {\n e.stopPropagation();\n e.preventDefault();\n action?.onClick?.(actionId, e);\n },\n onKeyDown: (e: KeyboardEvent) => {\n if (e.key === 'Enter') e.stopPropagation();\n }\n };\n })}\n menuAt={3}\n menuButtonProps={{\n onClick: (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n },\n onKeyDown: (e: KeyboardEvent) => {\n e.stopPropagation();\n if (['ArrowUp', 'ArrowDown'].includes(e.key)) {\n e.preventDefault();\n }\n }\n }}\n />\n </StyledNodeActions>\n ) : null;\n }, [actions]);\n\n const elRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (focusedEl) {\n elRef?.current?.focus();\n }\n }, [focusedEl]);\n\n const labelContent = useMemo(() => {\n const internal = (\n // Wrapping in a div for handling of flex space-between when there are node actions.\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as={StyledLabelContent}>\n {icon && <StyledNodeIcon name={icon} />}\n <StyledNodeText>{label}</StyledNodeText>\n </Flex>\n );\n\n return !nodes && (onClick ?? onNodeClick) ? (\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledNodeInteraction}\n forwardedAs={href ? 'a' : 'div'}\n role='treeitem'\n aria-current={current ? ariaCurrent : undefined}\n tabIndex={tabIndex}\n onClick={(e: MouseEvent<HTMLElement>) => {\n onClick?.(id, e);\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n }}\n href={href}\n onKeyDown={onKeyDown}\n ref={elRef}\n >\n {internal}\n {actionsJSX}\n </Flex>\n ) : (\n internal\n );\n }, [\n id,\n label,\n icon,\n nodes,\n actions,\n onClick,\n onNodeClick,\n current,\n focusedEl,\n tabIndex,\n changeFocusedNodeId,\n onKeyDown\n ]);\n\n return (\n <StyledStandardTreeNode\n id={id}\n style={\n {\n '--depth': depth,\n '--has-parent': depth ? 1 : 0,\n '--has-parent-sibling': hasParentSibling ? 1 : 0\n } as CSSProperties\n }\n aria-busy={loading}\n >\n {nodes ? (\n <>\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledStandardTreeParent}\n forwardedAs={href ? 'a' : 'div'}\n role='treeitem'\n aria-current={current ? ariaCurrent : undefined}\n tabIndex={tabIndex}\n variant='text'\n onClick={selectableParents ? handleParentClick : handleParentToggle}\n href={selectableParents ? href : undefined}\n aria-expanded={expanded ? 'true' : 'false'}\n aria-owns={`${id}-subtree`}\n aria-label={label}\n onKeyDown={onKeyDown}\n ref={elRef}\n >\n <Flex container={{ alignItems: 'center' }} as='span'>\n {selectableParents ? (\n <Button variant='simple' tabIndex={-1} icon compact onClick={handleParentToggle}>\n <StyledToggleIcon name='caret-right' />\n </Button>\n ) : (\n <Flex\n as={StyledToggleIconWrapper}\n container={{ justify: 'center', alignItems: 'center' }}\n >\n <StyledToggleIcon name='caret-right' />\n </Flex>\n )}\n {labelContent}\n </Flex>\n {actionsJSX}\n </Flex>\n <StyledStandardTreeItemSubTree lined={lined} id={`${id}-subtree`}>\n {subTree}\n {loading && <Progress variant='ring' placement='inline' />}\n </StyledStandardTreeItemSubTree>\n </>\n ) : (\n <StyledStandardTreeLeaf>{labelContent}</StyledStandardTreeLeaf>\n )}\n </StyledStandardTreeNode>\n );\n};\n\nconst StandardTreeWithNodes: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n function StandardTreeWithNodes(\n {\n nodes,\n currentNodeId,\n onNodeClick,\n onNodeToggle,\n lined = false,\n selectableParents = true,\n ...restProps\n }: PropsWithoutRef<StandardTreeProps>,\n ref: StandardTreeProps['ref']\n ) {\n const [focusedNodeId, setFocusedNodedId] = useState<string | undefined>();\n const treeRef = useConsolidatedRef(ref);\n\n const lastNodeId = useMemo(() => {\n return helpers.getDeepestNode(nodes, nodes[nodes.length - 1].id)?.id;\n }, [nodes]);\n\n const changeFocusedNodeId: StandardTreeContextProps['changeFocusedNodeId'] = useCallback(\n (id, type) => {\n switch (type) {\n case 'up': {\n const previousNode = helpers.getPreviousNode(nodes, id);\n if (previousNode) setFocusedNodedId(previousNode.id);\n break;\n }\n case 'down': {\n const nextNode = helpers.getNextNode(nodes, id);\n if (nextNode) setFocusedNodedId(nextNode.id);\n break;\n }\n case 'left': {\n const parentNode = helpers.getParentNode(nodes, id);\n if (parentNode) setFocusedNodedId(parentNode.id);\n break;\n }\n case 'right': {\n const childNode = helpers.getFirstChildNode(nodes, id);\n if (childNode) setFocusedNodedId(childNode.id);\n break;\n }\n default: {\n if (id !== focusedNodeId) setFocusedNodedId(id);\n break;\n }\n }\n },\n [nodes]\n );\n\n const onFocusChange = (focused: boolean) => {\n if (!focused) setFocusedNodedId('');\n };\n\n useFocusWithin([treeRef], onFocusChange);\n\n return (\n <StandardTreeContext.Provider\n value={useMemo(\n () => ({\n currentNodeId,\n focusedNodeId,\n lastNodeId,\n firstNodeId: nodes[0].id,\n changeFocusedNodeId,\n onNodeClick,\n onNodeToggle,\n lined,\n selectableParents\n }),\n [\n currentNodeId,\n onNodeClick,\n lined,\n focusedNodeId,\n lastNodeId,\n onNodeToggle,\n selectableParents\n ]\n )}\n >\n {/* FIXME: Types are having issues when styled(Tree) is typeof Tree. */}\n <StyledStandardTree\n {...restProps}\n ref={treeRef}\n nodes={nodes}\n nodeRenderer={NodeRenderer}\n />\n </StandardTreeContext.Provider>\n );\n }\n);\n\nconst StandardTree: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n function StandardTree(props: PropsWithoutRef<StandardTreeProps>, ref: StandardTreeProps['ref']) {\n return props.nodes.length > 0 ? <StandardTreeWithNodes {...props} ref={ref} /> : null;\n }\n);\n\nexport default StandardTree;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/Tree.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGnF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAElF,MAAM,MAAM,QAAQ,GAAG;IACrB,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,gCAAgC;IAChC,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,SAAS,EAAE,cAAc;IACzF,6EAA6E;IAC7E,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,wEAAwE;IACxE,YAAY,CAAC,EAAE,aAAa,CAC1B;QACE,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,SAAS,CAAC;QACpB,gBAAgB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;KACrD,GAAG,UAAU,CAAC,CAAC,EAAE,eAAe,CAAC,CACnC,CAAC;IACF,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,eAAO,MAAM,kBAAkB,wGAAc,CAAC;AAE9C,eAAO,MAAM,cAAc,wGAU1B,CAAC;AAWF,UAAU,aAAc,SAAQ,QAAQ;IACtC,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,cAAc,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E,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAgDD,QAAA,MAAM,IAAI,yEAKmE,WAAW,GAAG,IAAI,CAAC;AAEhG,eAAe,IAAI,CAAC"}
@@ -21,11 +21,11 @@ let TreeList;
21
21
  const TreeItem = ({ listItemProps, depth, nodes, nodeRenderer: NodeRenderer, ...restProps }) => {
22
22
  return (_jsx(StyledTreeListItem, { ...listItemProps, children: _jsx(NodeRenderer, { ...restProps, depth: depth, nodes: nodes, subTree: nodes && _jsx(TreeList, { depth: depth + 1, nodes: nodes, nodeRenderer: NodeRenderer }) }) }));
23
23
  };
24
- TreeList = forwardRef(({ nodes, depth, nodeRenderer, ...restProps }, ref) => {
24
+ TreeList = forwardRef(function TreeListFunction({ nodes, depth, nodeRenderer, ...restProps }, ref) {
25
25
  const hasParentSibling = nodes.some(node => !!node.nodes);
26
26
  return nodes.length > 0 ? (_jsx(StyledTreeList, { ...restProps, ref: ref, role: depth === 0 ? 'tree' : 'group', children: nodes.map(node => (_createElement(TreeItem, { ...node, key: node.id, depth: depth, nodeRenderer: nodeRenderer, hasParentSibling: hasParentSibling }))) })) : null;
27
27
  });
28
- const Tree = forwardRef(({ nodeRenderer = DefaultNodeRenderer, ...restProps }, ref) => {
28
+ const Tree = forwardRef(function Tree({ nodeRenderer = DefaultNodeRenderer, ...restProps }, ref) {
29
29
  return _jsx(TreeList, { ...restProps, ref: ref, depth: 0, nodeRenderer: nodeRenderer });
30
30
  });
31
31
  export default Tree;
@@ -1 +1 @@
1
- {"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../src/components/Tree/Tree.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAkD,MAAM,OAAO,CAAC;AACnF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AA8BvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,EA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,OACH,IAAI,EACR,GAAG,EAAE,IAAI,CAAC,EAAE,EACZ,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC,GACa,CAClB,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC;AAEF,MAAM,IAAI,GAAG,UAAU,CACrB,CACE,EAAE,YAAY,GAAG,mBAAmB,EAAE,GAAG,SAAS,EAA8B,EAChF,GAAqB,EACrB,EAAE;IACF,OAAO,KAAC,QAAQ,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,GAAI,CAAC;AACrF,CAAC,CAC2F,CAAC;AAE/F,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, ComponentType, ReactNode } from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, NoChildrenProp, ForwardProps, OmitStrict } from '../../types';\n\nexport type TreeNode = {\n /** The id of the Node. Used as the key for the li element wrapping the Node. */\n id: string;\n /** Child nodes. */\n nodes?: TreeNode[];\n /** Props to apply to the li. */\n listItemProps?: ForwardProps;\n\n [key: string]: unknown;\n};\n\nexport interface TreeProps<T extends TreeNode = TreeNode> extends BaseProps, NoChildrenProp {\n /** An array of ParentNodes and Nodes that compose the layout of the Tree. */\n nodes: T[];\n /** A function that allows custom styling and behavior for all Nodes. */\n nodeRenderer?: ComponentType<\n {\n depth: number;\n subTree?: ReactNode;\n hasParentSibling: TreeItemProps['hasParentSibling'];\n } & OmitStrict<T, 'listItemProps'>\n >;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport const StyledTreeListItem = styled.li``;\n\nexport const StyledTreeList = styled.ul`\n &,\n & & {\n list-style: none;\n position: relative;\n }\n\n ${StyledTreeListItem} {\n position: relative;\n }\n`;\n\nconst DefaultNodeRenderer: TreeProps['nodeRenderer'] = ({ data, subTree }) => {\n return (\n <>\n {data}\n {subTree}\n </>\n );\n};\n\ninterface TreeItemProps extends TreeNode {\n nodeRenderer: NonNullable<TreeProps['nodeRenderer']>;\n depth: number;\n hasParentSibling: boolean;\n}\n\ninterface TreeListProps extends Pick<TreeProps, 'nodes' | 'ref'> {\n nodeRenderer: NonNullable<TreeProps['nodeRenderer']>;\n depth: number;\n}\n\nlet TreeList: ComponentType<TreeListProps>;\n\nconst TreeItem = ({\n listItemProps,\n depth,\n nodes,\n nodeRenderer: NodeRenderer,\n ...restProps\n}: TreeItemProps) => {\n return (\n <StyledTreeListItem {...listItemProps}>\n <NodeRenderer\n {...restProps}\n depth={depth}\n nodes={nodes}\n subTree={nodes && <TreeList depth={depth + 1} nodes={nodes} nodeRenderer={NodeRenderer} />}\n />\n </StyledTreeListItem>\n );\n};\n\nTreeList = forwardRef(\n (\n { nodes, depth, nodeRenderer, ...restProps }: PropsWithoutRef<TreeListProps>,\n ref?: TreeProps['ref']\n ) => {\n const hasParentSibling = nodes.some(node => !!node.nodes);\n return nodes.length > 0 ? (\n <StyledTreeList {...restProps} ref={ref} role={depth === 0 ? 'tree' : 'group'}>\n {nodes.map(node => (\n <TreeItem\n {...node}\n key={node.id}\n depth={depth}\n nodeRenderer={nodeRenderer}\n hasParentSibling={hasParentSibling}\n />\n ))}\n </StyledTreeList>\n ) : null;\n }\n);\n\nconst Tree = forwardRef(\n (\n { nodeRenderer = DefaultNodeRenderer, ...restProps }: PropsWithoutRef<TreeProps>,\n ref: TreeProps['ref']\n ) => {\n return <TreeList {...restProps} ref={ref} depth={0} nodeRenderer={nodeRenderer} />;\n }\n) as <T extends TreeNode = TreeNode>(props: TreeProps<T> & ForwardProps) => JSX.Element | null;\n\nexport default Tree;\n"]}
1
+ {"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../src/components/Tree/Tree.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAkD,MAAM,OAAO,CAAC;AACnF,OAAO,MAAM,MAAM,m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AO,YAC1E,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACjB,eAAC,QAAQ,OACH,IAAI,EACR,GAAG,EAAE,IAAI,CAAC,EAAE,EACZ,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC,GACa,CAClB,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,IAAI,CACnC,EAAE,YAAY,GAAG,mBAAmB,EAAE,GAAG,SAAS,EAA8B,EAChF,GAAqB;IAErB,OAAO,KAAC,QAAQ,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,GAAI,CAAC;AACrF,CAAC,CAA8F,CAAC;AAEhG,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, ComponentType, ReactNode } from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, NoChildrenProp, ForwardProps, OmitStrict } from '../../types';\n\nexport type TreeNode = {\n /** The id of the Node. Used as the key for the li element wrapping the Node. */\n id: string;\n /** Child nodes. */\n nodes?: TreeNode[];\n /** Props to apply to the li. */\n listItemProps?: ForwardProps;\n\n [key: string]: unknown;\n};\n\nexport interface TreeProps<T extends TreeNode = TreeNode> extends BaseProps, NoChildrenProp {\n /** An array of ParentNodes and Nodes that compose the layout of the Tree. */\n nodes: T[];\n /** A function that allows custom styling and behavior for all Nodes. */\n nodeRenderer?: ComponentType<\n {\n depth: number;\n subTree?: ReactNode;\n hasParentSibling: TreeItemProps['hasParentSibling'];\n } & OmitStrict<T, 'listItemProps'>\n >;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport const StyledTreeListItem = styled.li``;\n\nexport const StyledTreeList = styled.ul`\n &,\n & & {\n list-style: none;\n position: relative;\n }\n\n ${StyledTreeListItem} {\n position: relative;\n }\n`;\n\nconst DefaultNodeRenderer: TreeProps['nodeRenderer'] = ({ data, subTree }) => {\n return (\n <>\n {data}\n {subTree}\n </>\n );\n};\n\ninterface TreeItemProps extends TreeNode {\n nodeRenderer: NonNullable<TreeProps['nodeRenderer']>;\n depth: number;\n hasParentSibling: boolean;\n}\n\ninterface TreeListProps extends Pick<TreeProps, 'nodes' | 'ref'> {\n nodeRenderer: NonNullable<TreeProps['nodeRenderer']>;\n depth: number;\n}\n\nlet TreeList: ComponentType<TreeListProps>;\n\nconst TreeItem = ({\n listItemProps,\n depth,\n nodes,\n nodeRenderer: NodeRenderer,\n ...restProps\n}: TreeItemProps) => {\n return (\n <StyledTreeListItem {...listItemProps}>\n <NodeRenderer\n {...restProps}\n depth={depth}\n nodes={nodes}\n subTree={nodes && <TreeList depth={depth + 1} nodes={nodes} nodeRenderer={NodeRenderer} />}\n />\n </StyledTreeListItem>\n );\n};\n\nTreeList = forwardRef(function TreeListFunction(\n { nodes, depth, nodeRenderer, ...restProps }: PropsWithoutRef<TreeListProps>,\n ref?: TreeProps['ref']\n) {\n const hasParentSibling = nodes.some(node => !!node.nodes);\n return nodes.length > 0 ? (\n <StyledTreeList {...restProps} ref={ref} role={depth === 0 ? 'tree' : 'group'}>\n {nodes.map(node => (\n <TreeItem\n {...node}\n key={node.id}\n depth={depth}\n nodeRenderer={nodeRenderer}\n hasParentSibling={hasParentSibling}\n />\n ))}\n </StyledTreeList>\n ) : null;\n});\n\nconst Tree = forwardRef(function Tree(\n { nodeRenderer = DefaultNodeRenderer, ...restProps }: PropsWithoutRef<TreeProps>,\n ref: TreeProps['ref']\n) {\n return <TreeList {...restProps} ref={ref} depth={0} nodeRenderer={nodeRenderer} />;\n}) as <T extends TreeNode = TreeNode>(props: TreeProps<T> & ForwardProps) => JSX.Element | null;\n\nexport default Tree;\n"]}
@@ -27,7 +27,7 @@ const generateUrlMarkup = (url) => {
27
27
  return urlFragments;
28
28
  }, []);
29
29
  };
30
- const URLDisplay = forwardRef(({ value, displayText, variant = 'link', ...restProps }, ref) => {
30
+ const URLDisplay = forwardRef(function URLDisplay({ value, displayText, variant = 'link', ...restProps }, ref) {
31
31
  const displayValue = value ? displayText || generateUrlMarkup(value) : _jsx(NoValue, {});
32
32
  if (variant === 'text' || !value) {
33
33
  return (_jsx("span", { ref: ref, ...restProps, children: displayValue }));
@@ -1 +1 @@
1
- {"version":3,"file":"URLDisplay.js","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAEvF,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAgBzC;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAa,EAAE;IACnD,MAAM,SAAS,GAAG,GAAG;SAClB,KAAK,CAAC,IAAI,CAAC;QACZ,0EAA0E;SACzE,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,OAAO,GAAG;aACP,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC;aACzB,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC;aACrC,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACtC,CAAC,CAAC;SACD,IAAI,CAAC,QAAQ,CAAC,CAAC;IAElB,4HAA4H;IAC5H,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAc,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE;QACxE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAU,YAAY,CAAC,MAAM,CAAI,CAAC,CAAC;QAC3D,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,UAAU,GAAsD,UAAU,CAC9E,CACE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,EAAoC,EACxF,GAA2B,EAC3B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,CAAC;IAEnF,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,KAAK,EAAE;QAChC,OAAO,CACL,eAAM,GAAG,EAAE,GAA2B,KAAM,SAAS,YAClD,YAAY,GACR,CACR,CAAC;KACH;IACD,IAAI,OAAO,KAAK,QAAQ,EAAE;QACxB,OAAO,CACL,KAAC,MAAM,IACL,GAAG,EAAE,GAA4B,KAC7B,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,WAAW,GAClB,CACH,CAAC;KACH;IACD,OAAO,CACL,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,KAAK,YACjE,YAAY,GACR,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\n\nimport Link from '../Link';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport QRCode from '../QRCode';\nimport NoValue from '../NoValue/NoValue';\n\nexport interface URLDisplayProps extends BaseProps, NoChildrenProp {\n /** URL address, includes scheme, 'http://', 'https://' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default 'link'\n */\n variant?: 'link' | 'text' | 'qrcode';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement | HTMLImageElement | HTMLDivElement>;\n}\n\n/**\n * Function gets the url as a string and converts it to a HTML markup with whitespace opportunity elements.\n * It helps breaking a long url correctly to avoid parent container overflow issues\n * according to \"The Chicago Manual of Style\" copywriting standard.\n * @param url input url to construct markup for\n * @returns array of nodes\n */\nconst generateUrlMarkup = (url: string): ReactNode => {\n const markedUrl = url\n .split('//')\n // Insert \\x1f (unit separator) char as a placeholder at correct position.\n .map(str => {\n return str\n .replace(/:/giu, '$&\\x1f')\n .replace(/[/~.,\\\\-_?#%]/giu, '\\x1f$&')\n .replace(/[=&]/giu, '\\x1f$&\\x1f');\n })\n .join('//\\x1f');\n\n // Replace unit separator character with <wbr /> element. Create an array of nodes in place of string to pass tags escaping.\n return markedUrl.split('\\x1f').reduce<ReactNode[]>((urlFragments, part) => {\n urlFragments.push(part, <wbr key={urlFragments.length} />);\n return urlFragments;\n }, []);\n};\n\nconst URLDisplay: FunctionComponent<URLDisplayProps & ForwardProps> = forwardRef(\n (\n { value, displayText, variant = 'link', ...restProps }: PropsWithoutRef<URLDisplayProps>,\n ref: URLDisplayProps['ref']\n ) => {\n const displayValue = value ? displayText || generateUrlMarkup(value) : <NoValue />;\n\n if (variant === 'text' || !value) {\n return (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n );\n }\n if (variant === 'qrcode') {\n return (\n <QRCode\n ref={ref as Ref<HTMLImageElement>}\n {...restProps}\n value={value}\n label={displayText}\n />\n );\n }\n return (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={value}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default URLDisplay;\n"]}
1
+ {"version":3,"file":"URLDisplay.js","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAEvF,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAgBzC;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAa,EAAE;IACnD,MAAM,SAAS,GAAG,GAAG;SAClB,KAAK,CAAC,IAAI,CAAC;QACZ,0E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;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\n\nimport Link from '../Link';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport QRCode from '../QRCode';\nimport NoValue from '../NoValue/NoValue';\n\nexport interface URLDisplayProps extends BaseProps, NoChildrenProp {\n /** URL address, includes scheme, 'http://', 'https://' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default 'link'\n */\n variant?: 'link' | 'text' | 'qrcode';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement | HTMLImageElement | HTMLDivElement>;\n}\n\n/**\n * Function gets the url as a string and converts it to a HTML markup with whitespace opportunity elements.\n * It helps breaking a long url correctly to avoid parent container overflow issues\n * according to \"The Chicago Manual of Style\" copywriting standard.\n * @param url input url to construct markup for\n * @returns array of nodes\n */\nconst generateUrlMarkup = (url: string): ReactNode => {\n const markedUrl = url\n .split('//')\n // Insert \\x1f (unit separator) char as a placeholder at correct position.\n .map(str => {\n return str\n .replace(/:/giu, '$&\\x1f')\n .replace(/[/~.,\\\\-_?#%]/giu, '\\x1f$&')\n .replace(/[=&]/giu, '\\x1f$&\\x1f');\n })\n .join('//\\x1f');\n\n // Replace unit separator character with <wbr /> element. Create an array of nodes in place of string to pass tags escaping.\n return markedUrl.split('\\x1f').reduce<ReactNode[]>((urlFragments, part) => {\n urlFragments.push(part, <wbr key={urlFragments.length} />);\n return urlFragments;\n }, []);\n};\n\nconst URLDisplay: FunctionComponent<URLDisplayProps & ForwardProps> = forwardRef(\n function URLDisplay(\n { value, displayText, variant = 'link', ...restProps }: PropsWithoutRef<URLDisplayProps>,\n ref: URLDisplayProps['ref']\n ) {\n const displayValue = value ? displayText || generateUrlMarkup(value) : <NoValue />;\n\n if (variant === 'text' || !value) {\n return (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n );\n }\n if (variant === 'qrcode') {\n return (\n <QRCode\n ref={ref as Ref<HTMLImageElement>}\n {...restProps}\n value={value}\n label={displayText}\n />\n );\n }\n return (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={value}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default URLDisplay;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"VisuallyHiddenText.d.ts","sourceRoot":"","sources":["../../../src/components/VisuallyHiddenText/VisuallyHiddenText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAc,GAAG,EAAmB,MAAM,OAAO,CAAC;AAI5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,wBAAwB,0GAIpC,CAAC;AAEF,QAAA,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAIjF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"VisuallyHiddenText.d.ts","sourceRoot":"","sources":["../../../src/components/VisuallyHiddenText/VisuallyHiddenText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAc,GAAG,EAAmB,MAAM,OAAO,CAAC;AAI5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,wBAAwB,0GAIpC,CAAC;AAEF,QAAA,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAOjF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -7,6 +7,8 @@ export const StyledVisuallyHiddenText = styled.span `
7
7
  -webkit-user-select: none;
8
8
  user-select: none;
9
9
  `;
10
- const VisuallyHiddenText = forwardRef((props, ref) => (_jsx(StyledVisuallyHiddenText, { ...props, ref: ref })));
10
+ const VisuallyHiddenText = forwardRef(function VisuallyHiddenText(props, ref) {
11
+ return _jsx(StyledVisuallyHiddenText, { ...props, ref: ref });
12
+ });
11
13
  export default VisuallyHiddenText;
12
14
  //# sourceMappingURL=VisuallyHiddenText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VisuallyHiddenText.js","sourceRoot":"","sources":["../../../src/components/VisuallyHiddenText/VisuallyHiddenText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AASxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAA;IAC/C,YAAY;;;CAGf,CAAC;AAEF,MAAM,kBAAkB,GAA8D,UAAU,CAC9F,CAAC,KAA+C,EAAE,GAAmC,EAAE,EAAE,CAAC,CACxF,KAAC,wBAAwB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAClD,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport { ForwardProps } from '../../types';\n\ninterface VisuallyHiddenTextProps {\n children: string;\n ref?: Ref<HTMLSpanElement>;\n}\n\nexport const StyledVisuallyHiddenText = styled.span`\n ${hideVisually}\n -webkit-user-select: none;\n user-select: none;\n`;\n\nconst VisuallyHiddenText: FunctionComponent<VisuallyHiddenTextProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<VisuallyHiddenTextProps>, ref: VisuallyHiddenTextProps['ref']) => (\n <StyledVisuallyHiddenText {...props} ref={ref} />\n )\n);\n\nexport default VisuallyHiddenText;\n"]}
1
+ {"version":3,"file":"VisuallyHiddenText.js","sourceRoot":"","sources":["../../../src/components/VisuallyHiddenText/VisuallyHiddenText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AASxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAA;IAC/C,YAAY;;;CAGf,CAAC;AAEF,MAAM,kBAAkB,GAA8D,UAAU,CAC9F,SAAS,kBAAkB,CACzB,KAA+C,EAC/C,GAAmC;IAEnC,OAAO,KAAC,wBAAwB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;AAC3D,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport { ForwardProps } from '../../types';\n\ninterface VisuallyHiddenTextProps {\n children: string;\n ref?: Ref<HTMLSpanElement>;\n}\n\nexport const StyledVisuallyHiddenText = styled.span`\n ${hideVisually}\n -webkit-user-select: none;\n user-select: none;\n`;\n\nconst VisuallyHiddenText: FunctionComponent<VisuallyHiddenTextProps & ForwardProps> = forwardRef(\n function VisuallyHiddenText(\n props: PropsWithoutRef<VisuallyHiddenTextProps>,\n ref: VisuallyHiddenTextProps['ref']\n ) {\n return <StyledVisuallyHiddenText {...props} ref={ref} />;\n }\n);\n\nexport default VisuallyHiddenText;\n"]}
@@ -1,5 +1,8 @@
1
1
  import { DependencyList, RefObject } from 'react';
2
2
  /**
3
+ * Hook to define function triggered on Escape button. It attaches the listener to the element
4
+ * identified by target prop, defaults to document. Used primarily for convenience when dismissing
5
+ * popovers.
3
6
  * @example useEscape((event) => { do something });
4
7
  * @param cb The function that should be executed on keydown keyevent.
5
8
  * @param target To which esc event to be attached - Defaults to document
@@ -1 +1 @@
1
- {"version":3,"file":"useEscape.d.ts","sourceRoot":"","sources":["../../src/hooks/useEscape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAI/D;;;;;GAKG;AAEH,QAAA,MAAM,SAAS,WACL,aAAa,KAAK,IAAI,WACtB,WAAW,GAAG,UAAU,WAAW,CAAC,GAAG,QAAQ,GAAG,IAAI,wCAW/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"useEscape.d.ts","sourceRoot":"","sources":["../../src/hooks/useEscape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAI/D;;;;;;;;GAQG;AAEH,QAAA,MAAM,SAAS,WACL,aAAa,KAAK,IAAI,WACtB,WAAW,GAAG,UAAU,WAAW,CAAC,GAAG,QAAQ,GAAG,IAAI,wCAW/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,17 +1,20 @@
1
1
  import { useCallback } from 'react';
2
2
  import useEvent from './useEvent';
3
3
  /**
4
+ * Hook to define function triggered on Escape button. It attaches the listener to the element
5
+ * identified by target prop, defaults to document. Used primarily for convenience when dismissing
6
+ * popovers.
4
7
  * @example useEscape((event) => { do something });
5
8
  * @param cb The function that should be executed on keydown keyevent.
6
9
  * @param target To which esc event to be attached - Defaults to document
7
10
  * @param dependencies List of dependencies
8
11
  */
9
12
  const useEscape = (cb, target = document, dependencies = []) => {
10
- const onKeydown = useCallback((e) => {
13
+ const onKeyDown = useCallback((e) => {
11
14
  if (e.key === 'Escape')
12
15
  cb(e);
13
16
  }, [cb, ...dependencies]);
14
- useEvent('keydown', onKeydown, { target });
17
+ useEvent('keydown', onKeyDown, { target });
15
18
  };
16
19
  export default useEscape;
17
20
  //# sourceMappingURL=useEscape.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEscape.js","sourceRoot":"","sources":["../../src/hooks/useEscape.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,WAAW,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,CAChB,EAA8B,EAC9B,SAAiE,QAAQ,EACzE,eAA+B,EAAE,EACjC,EAAE;IACF,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,CAAgB,EAAE,EAAE;QACnB,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;YAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,EACD,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,CACtB,CAAC;IAEF,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { DependencyList, RefObject, useCallback } from 'react';\n\nimport useEvent from './useEvent';\n\n/**\n * @example useEscape((event) => { do something });\n * @param cb The function that should be executed on keydown keyevent.\n * @param target To which esc event to be attached - Defaults to document\n * @param dependencies List of dependencies\n */\n\nconst useEscape = (\n cb: (e: KeyboardEvent) => void,\n target: HTMLElement | RefObject<HTMLElement> | Document | null = document,\n dependencies: DependencyList = []\n) => {\n const onKeydown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Escape') cb(e);\n },\n [cb, ...dependencies]\n );\n\n useEvent('keydown', onKeydown, { target });\n};\n\nexport default useEscape;\n"]}
1
+ {"version":3,"file":"useEscape.js","sourceRoot":"","sources":["../../src/hooks/useEscape.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,WAAW,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;;;;GAQG;AAEH,MAAM,SAAS,GAAG,CAChB,EAA8B,EAC9B,SAAiE,QAAQ,EACzE,eAA+B,EAAE,EACjC,EAAE;IACF,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,CAAgB,EAAE,EAAE;QACnB,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;YAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,EACD,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,CACtB,CAAC;IAEF,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { DependencyList, RefObject, useCallback } from 'react';\n\nimport useEvent from './useEvent';\n\n/**\n * Hook to define function triggered on Escape button. It attaches the listener to the element\n * identified by target prop, defaults to document. Used primarily for convenience when dismissing\n * popovers.\n * @example useEscape((event) => { do something });\n * @param cb The function that should be executed on keydown keyevent.\n * @param target To which esc event to be attached - Defaults to document\n * @param dependencies List of dependencies\n */\n\nconst useEscape = (\n cb: (e: KeyboardEvent) => void,\n target: HTMLElement | RefObject<HTMLElement> | Document | null = document,\n dependencies: DependencyList = []\n) => {\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Escape') cb(e);\n },\n [cb, ...dependencies]\n );\n\n useEvent('keydown', onKeyDown, { target });\n};\n\nexport default useEscape;\n"]}
@@ -85,6 +85,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
85
85
  done: string;
86
86
  uploading: string;
87
87
  loading: string;
88
+ loaded: string;
88
89
  submitting: string;
89
90
  no_items: string;
90
91
  unknown_error: string;
@@ -252,7 +253,23 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
252
253
  select_country_code: string;
253
254
  enter_a_number: string;
254
255
  skip_navigation_menu_label: string;
256
+ tab_error_tooltip: string;
255
257
  assignments: string;
258
+ article_list_label_a11y: string;
259
+ article_list_filter_label_a11y: string;
260
+ article_list_header_submit_label: string;
261
+ clear_filters: string;
262
+ suggest_article: string;
263
+ suggested: string;
264
+ followed: string;
265
+ article_label_a11y: string;
266
+ article_related_links: string;
267
+ article_more_like_this: string;
268
+ article_was_this_helpful: string;
269
+ article_thank_you_for_your_feedback: string;
270
+ article_attachments: string;
271
+ likes: string;
272
+ dislikes: string;
256
273
  close_preview: string;
257
274
  confirmation_whats_next: string;
258
275
  confirmation_open_tasks: string;
@@ -342,6 +359,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
342
359
  feed_new_post_submit: string;
343
360
  feed_new_comment: string;
344
361
  feed_new_comment_submit: string;
362
+ feed_attach_files: string;
345
363
  feed_post_actions_menu: string;
346
364
  feed_edit_post: string;
347
365
  feed_edit_comment: string;
@@ -352,6 +370,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
352
370
  feed_public_post: string;
353
371
  feed_recipients: string;
354
372
  feed_like_label: string;
373
+ feed_unlike_label: string;
355
374
  feed_post_likes: {
356
375
  zero: string;
357
376
  one: string;
@@ -492,20 +511,6 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
492
511
  undelivered: string;
493
512
  drafts: string;
494
513
  unread: string;
495
- article_list_label_a11y: string;
496
- article_list_filter_label_a11y: string;
497
- article_list_header_submit_label: string;
498
- clear_filters: string;
499
- suggest_article: string;
500
- suggested: string;
501
- followed: string;
502
- article_related_links: string;
503
- article_more_like_this: string;
504
- article_was_this_helpful: string;
505
- article_thank_you_for_your_feedback: string;
506
- article_attachments: string;
507
- likes: string;
508
- dislikes: string;
509
514
  call_panel_heading: string;
510
515
  call_panel_make_new_call: string;
511
516
  call_panel_agent_status: string;
@@ -604,6 +609,12 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
604
609
  close_conversation: string;
605
610
  shortcut_AddTask: string;
606
611
  shortcut_WrapUp: string;
612
+ live_transcript: string;
613
+ open_live_transcript: string;
614
+ close_live_transcript: string;
615
+ download_live_transcript: string;
616
+ verbatim: string;
617
+ dialog: string;
607
618
  sentiment_positive: string;
608
619
  senti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