@pega/cosmos-react-core 4.0.0-dev.1.2 → 4.0.0-dev.10.1

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 (586) hide show
  1. package/lib/components/Actions/Actions.d.ts.map +1 -1
  2. package/lib/components/Actions/Actions.js +11 -5
  3. package/lib/components/Actions/Actions.js.map +1 -1
  4. package/lib/components/AdditionalInfo/AdditionalInfo.d.ts +2 -0
  5. package/lib/components/AdditionalInfo/AdditionalInfo.d.ts.map +1 -1
  6. package/lib/components/AdditionalInfo/AdditionalInfo.js +24 -15
  7. package/lib/components/AdditionalInfo/AdditionalInfo.js.map +1 -1
  8. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppHeader.js +4 -3
  10. package/lib/components/AppShell/AppHeader.js.map +1 -1
  11. package/lib/components/AppShell/AppHeader.styles.d.ts +2 -0
  12. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppHeader.styles.js +43 -33
  14. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  15. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShell.js +37 -13
  17. package/lib/components/AppShell/AppShell.js.map +1 -1
  18. package/lib/components/AppShell/AppShell.styles.d.ts +4 -1
  19. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  20. package/lib/components/AppShell/AppShell.styles.js +57 -20
  21. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  22. package/lib/components/AppShell/AppShell.types.d.ts +30 -0
  23. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  24. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  25. package/lib/components/AppShell/AppShellContext.d.ts +2 -0
  26. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  27. package/lib/components/AppShell/AppShellContext.js +2 -0
  28. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  29. package/lib/components/AppShell/AppShellList.d.ts +1 -1
  30. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  31. package/lib/components/AppShell/AppShellList.js +6 -2
  32. package/lib/components/AppShell/AppShellList.js.map +1 -1
  33. package/lib/components/AppShell/AppShellList.styles.d.ts +1 -1
  34. package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
  35. package/lib/components/AppShell/AppShellList.styles.js +21 -19
  36. package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
  37. package/lib/components/AppShell/AppShellSearch.styles.js +1 -1
  38. package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -1
  39. package/lib/components/AppShell/ContextSwitcher.d.ts +6 -0
  40. package/lib/components/AppShell/ContextSwitcher.d.ts.map +1 -0
  41. package/lib/components/AppShell/ContextSwitcher.js +18 -0
  42. package/lib/components/AppShell/ContextSwitcher.js.map +1 -0
  43. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  44. package/lib/components/AppShell/Drawer.js +8 -9
  45. package/lib/components/AppShell/Drawer.js.map +1 -1
  46. package/lib/components/AppShell/Drawer.styles.d.ts.map +1 -1
  47. package/lib/components/AppShell/Drawer.styles.js +7 -4
  48. package/lib/components/AppShell/Drawer.styles.js.map +1 -1
  49. package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
  50. package/lib/components/AppShell/NavigationList.js +15 -12
  51. package/lib/components/AppShell/NavigationList.js.map +1 -1
  52. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
  53. package/lib/components/AppShell/NavigationListItemWrapper.js +4 -2
  54. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  55. package/lib/components/AppShell/index.d.ts +2 -1
  56. package/lib/components/AppShell/index.d.ts.map +1 -1
  57. package/lib/components/AppShell/index.js +1 -0
  58. package/lib/components/AppShell/index.js.map +1 -1
  59. package/lib/components/Avatar/Avatar.d.ts +1 -1
  60. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  61. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  62. package/lib/components/Backdrop/Backdrop.js +22 -2
  63. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  64. package/lib/components/Badges/Count.d.ts +2 -2
  65. package/lib/components/Badges/Count.d.ts.map +1 -1
  66. package/lib/components/Badges/Count.js +22 -25
  67. package/lib/components/Badges/Count.js.map +1 -1
  68. package/lib/components/Badges/Selection.js +1 -1
  69. package/lib/components/Badges/Selection.js.map +1 -1
  70. package/lib/components/Badges/Tag.js +1 -1
  71. package/lib/components/Badges/Tag.js.map +1 -1
  72. package/lib/components/Banner/Banner.d.ts +28 -21
  73. package/lib/components/Banner/Banner.d.ts.map +1 -1
  74. package/lib/components/Banner/Banner.js +138 -96
  75. package/lib/components/Banner/Banner.js.map +1 -1
  76. package/lib/components/Banner/index.d.ts +1 -1
  77. package/lib/components/Banner/index.d.ts.map +1 -1
  78. package/lib/components/Banner/index.js.map +1 -1
  79. package/lib/components/Button/Button.d.ts +1 -1
  80. package/lib/components/Button/Button.d.ts.map +1 -1
  81. package/lib/components/Card/Card.d.ts +4 -7
  82. package/lib/components/Card/Card.d.ts.map +1 -1
  83. package/lib/components/Card/Card.js +2 -9
  84. package/lib/components/Card/Card.js.map +1 -1
  85. package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
  86. package/lib/components/ComboBox/ComboBox.styles.js +0 -3
  87. package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
  88. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  89. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +1 -3
  90. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  91. package/lib/components/Configuration/Configuration.d.ts +4 -1
  92. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  93. package/lib/components/Configuration/Configuration.js +2 -0
  94. package/lib/components/Configuration/Configuration.js.map +1 -1
  95. package/lib/components/CreditCard/CreditCard.types.d.ts +1 -1
  96. package/lib/components/CreditCard/CreditCard.types.d.ts.map +1 -1
  97. package/lib/components/DateTime/DateTime.types.d.ts +10 -7
  98. package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
  99. package/lib/components/DateTime/DateTime.types.js.map +1 -1
  100. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  101. package/lib/components/DateTime/Input/DateInput.js +19 -4
  102. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  103. package/lib/components/DateTime/Input/DateRangeInput.d.ts +4 -2
  104. package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
  105. package/lib/components/DateTime/Input/DateRangeInput.js +71 -34
  106. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  107. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  108. package/lib/components/DateTime/Input/DateTimeInput.js +26 -5
  109. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  110. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +1 -1
  111. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
  112. package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts +1 -1
  113. package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts.map +1 -1
  114. package/lib/components/DateTime/Input/Duration/Time.d.ts +1 -1
  115. package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
  116. package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
  117. package/lib/components/DateTime/Input/MonthInput.js +8 -3
  118. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  119. package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
  120. package/lib/components/DateTime/Input/PartInput.js +2 -2
  121. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  122. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  123. package/lib/components/DateTime/Input/TimeInput.js +13 -3
  124. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  125. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +4 -2
  126. package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
  127. package/lib/components/DateTime/Input/TimeRangeInput.js +70 -27
  128. package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
  129. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  130. package/lib/components/DateTime/Input/WeekInput.js +7 -2
  131. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  132. package/lib/components/DateTime/Input/usePickerButton.d.ts.map +1 -1
  133. package/lib/components/DateTime/Input/usePickerButton.js +19 -27
  134. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  135. package/lib/components/DateTime/Input/utils.d.ts +2 -2
  136. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  137. package/lib/components/DateTime/Input/utils.js +6 -17
  138. package/lib/components/DateTime/Input/utils.js.map +1 -1
  139. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  140. package/lib/components/DateTime/Picker/Calendar.js +3 -1
  141. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  142. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  143. package/lib/components/DateTime/Picker/DatePicker.js +2 -8
  144. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  145. package/lib/components/DateTime/Picker/TimePicker.d.ts +1 -1
  146. package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
  147. package/lib/components/DateTime/Picker/TimePicker.js +1 -1
  148. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  149. package/lib/components/Dialog/Dialog.d.ts +3 -30
  150. package/lib/components/Dialog/Dialog.d.ts.map +1 -1
  151. package/lib/components/Dialog/Dialog.js +7 -147
  152. package/lib/components/Dialog/Dialog.js.map +1 -1
  153. package/lib/components/Dialog/Dialog.styles.d.ts +3 -0
  154. package/lib/components/Dialog/Dialog.styles.d.ts.map +1 -0
  155. package/lib/components/Dialog/Dialog.styles.js +18 -0
  156. package/lib/components/Dialog/Dialog.styles.js.map +1 -0
  157. package/lib/components/Dialog/Dialog.types.d.ts +87 -0
  158. package/lib/components/Dialog/Dialog.types.d.ts.map +1 -0
  159. package/lib/components/Dialog/Dialog.types.js +3 -0
  160. package/lib/components/Dialog/Dialog.types.js.map +1 -0
  161. package/lib/components/Dialog/FormDialog.d.ts +7 -0
  162. package/lib/components/Dialog/FormDialog.d.ts.map +1 -0
  163. package/lib/components/Dialog/FormDialog.js +58 -0
  164. package/lib/components/Dialog/FormDialog.js.map +1 -0
  165. package/lib/components/Dialog/InfoDialog.d.ts +6 -0
  166. package/lib/components/Dialog/InfoDialog.d.ts.map +1 -0
  167. package/lib/components/Dialog/InfoDialog.js +43 -0
  168. package/lib/components/Dialog/InfoDialog.js.map +1 -0
  169. package/lib/components/Dialog/index.d.ts +3 -2
  170. package/lib/components/Dialog/index.d.ts.map +1 -1
  171. package/lib/components/Dialog/index.js +2 -2
  172. package/lib/components/Dialog/index.js.map +1 -1
  173. package/lib/components/Drawer/Drawer.d.ts +1 -1
  174. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  175. package/lib/components/EmojiPicker/EmojiPicker.d.ts +1 -1
  176. package/lib/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  177. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  178. package/lib/components/FieldGroup/FieldGroup.js +2 -1
  179. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  180. package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
  181. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  182. package/lib/components/FieldValueList/FieldValueList.js +5 -36
  183. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  184. package/lib/components/FieldValueList/index.d.ts +1 -1
  185. package/lib/components/FieldValueList/index.d.ts.map +1 -1
  186. package/lib/components/FieldValueList/index.js.map +1 -1
  187. package/lib/components/File/utils.d.ts +1 -1
  188. package/lib/components/File/utils.d.ts.map +1 -1
  189. package/lib/components/Flex/Flex.d.ts +2 -2
  190. package/lib/components/Flex/Flex.d.ts.map +1 -1
  191. package/lib/components/FormControl/FormControl.d.ts +4 -0
  192. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  193. package/lib/components/FormControl/FormControl.js +3 -1
  194. package/lib/components/FormControl/FormControl.js.map +1 -1
  195. package/lib/components/FormControl/index.d.ts +1 -0
  196. package/lib/components/FormControl/index.d.ts.map +1 -1
  197. package/lib/components/FormControl/index.js.map +1 -1
  198. package/lib/components/Grid/Grid.types.d.ts +2 -2
  199. package/lib/components/Grid/Grid.types.d.ts.map +1 -1
  200. package/lib/components/HTML/HTML.d.ts.map +1 -1
  201. package/lib/components/HTML/HTML.js +1 -0
  202. package/lib/components/HTML/HTML.js.map +1 -1
  203. package/lib/components/Icon/iconNames.d.ts +2 -2
  204. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  205. package/lib/components/Icon/iconNames.js +2 -0
  206. package/lib/components/Icon/iconNames.js.map +1 -1
  207. package/lib/components/Icon/icons/user-question-mark-solid.icon.d.ts +4 -0
  208. package/lib/components/Icon/icons/user-question-mark-solid.icon.d.ts.map +1 -0
  209. package/lib/components/Icon/icons/user-question-mark-solid.icon.js +6 -0
  210. package/lib/components/Icon/icons/user-question-mark-solid.icon.js.map +1 -0
  211. package/lib/components/Icon/icons/user-question-mark.icon.d.ts +4 -0
  212. package/lib/components/Icon/icons/user-question-mark.icon.d.ts.map +1 -0
  213. package/lib/components/Icon/icons/user-question-mark.icon.js +6 -0
  214. package/lib/components/Icon/icons/user-question-mark.icon.js.map +1 -0
  215. package/lib/components/Lightbox/Lightbox.styles.js +2 -2
  216. package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
  217. package/lib/components/Link/Link.d.ts.map +1 -1
  218. package/lib/components/Link/Link.js +13 -4
  219. package/lib/components/Link/Link.js.map +1 -1
  220. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -1
  221. package/lib/components/List/CommaSeparatedList.js +5 -37
  222. package/lib/components/List/CommaSeparatedList.js.map +1 -1
  223. package/lib/components/List/List.d.ts.map +1 -1
  224. package/lib/components/List/List.js +11 -1
  225. package/lib/components/List/List.js.map +1 -1
  226. package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
  227. package/lib/components/ListToolbar/ListToolbar.js +106 -68
  228. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  229. package/lib/components/ListToolbar/ListToolbar.styles.d.ts +5 -1
  230. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  231. package/lib/components/ListToolbar/ListToolbar.styles.js +50 -5
  232. package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
  233. package/lib/components/ListToolbar/ListToolbar.types.d.ts +5 -5
  234. package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
  235. package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
  236. package/lib/components/LiveLog/Context.d.ts +3 -0
  237. package/lib/components/LiveLog/Context.d.ts.map +1 -0
  238. package/lib/components/LiveLog/Context.js +9 -0
  239. package/lib/components/LiveLog/Context.js.map +1 -0
  240. package/lib/components/LiveLog/LiveLog.d.ts +10 -0
  241. package/lib/components/LiveLog/LiveLog.d.ts.map +1 -0
  242. package/lib/components/LiveLog/LiveLog.js +99 -0
  243. package/lib/components/LiveLog/LiveLog.js.map +1 -0
  244. package/lib/components/LiveLog/LiveLog.styles.d.ts +3 -0
  245. package/lib/components/LiveLog/LiveLog.styles.d.ts.map +1 -0
  246. package/lib/components/LiveLog/LiveLog.styles.js +9 -0
  247. package/lib/components/LiveLog/LiveLog.styles.js.map +1 -0
  248. package/lib/components/LiveLog/LiveLog.types.d.ts +93 -0
  249. package/lib/components/LiveLog/LiveLog.types.d.ts.map +1 -0
  250. package/lib/components/LiveLog/LiveLog.types.js +2 -0
  251. package/lib/components/LiveLog/LiveLog.types.js.map +1 -0
  252. package/lib/components/LiveLog/index.d.ts +4 -0
  253. package/lib/components/LiveLog/index.d.ts.map +1 -0
  254. package/lib/components/LiveLog/index.js +3 -0
  255. package/lib/components/LiveLog/index.js.map +1 -0
  256. package/lib/components/Location/CurrentLocationButton.d.ts +1 -1
  257. package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
  258. package/lib/components/Location/LocationInput.d.ts.map +1 -1
  259. package/lib/components/Location/LocationInput.js +1 -2
  260. package/lib/components/Location/LocationInput.js.map +1 -1
  261. package/lib/components/Location/LocationView.d.ts.map +1 -1
  262. package/lib/components/Location/LocationView.js +4 -4
  263. package/lib/components/Location/LocationView.js.map +1 -1
  264. package/lib/components/Location/MapsContext.d.ts +1 -1
  265. package/lib/components/Location/MapsContext.d.ts.map +1 -1
  266. package/lib/components/Location/utils.d.ts +1 -1
  267. package/lib/components/Location/utils.d.ts.map +1 -1
  268. package/lib/components/Location/utils.js.map +1 -1
  269. package/lib/components/Menu/Menu.js +3 -3
  270. package/lib/components/Menu/Menu.js.map +1 -1
  271. package/lib/components/Menu/Menu.styles.js +1 -1
  272. package/lib/components/Menu/Menu.styles.js.map +1 -1
  273. package/lib/components/Menu/Menu.types.d.ts +3 -5
  274. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  275. package/lib/components/Menu/Menu.types.js.map +1 -1
  276. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  277. package/lib/components/Menu/MenuList.js +4 -3
  278. package/lib/components/Menu/MenuList.js.map +1 -1
  279. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  280. package/lib/components/MenuButton/MenuButton.js +26 -5
  281. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  282. package/lib/components/Modal/Modal.d.ts.map +1 -1
  283. package/lib/components/Modal/Modal.js +6 -8
  284. package/lib/components/Modal/Modal.js.map +1 -1
  285. package/lib/components/Modal/Modal.types.d.ts +2 -1
  286. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  287. package/lib/components/Modal/Modal.types.js.map +1 -1
  288. package/lib/components/Number/NumberInput.types.d.ts +3 -1
  289. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  290. package/lib/components/Number/NumberInput.types.js.map +1 -1
  291. package/lib/components/Number/NumberRangeInput.d.ts.map +1 -1
  292. package/lib/components/Number/NumberRangeInput.js +71 -4
  293. package/lib/components/Number/NumberRangeInput.js.map +1 -1
  294. package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
  295. package/lib/components/PageTemplates/CategorySubPage.js +15 -4
  296. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  297. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  298. package/lib/components/PageTemplates/CategorySubPage.styles.js +5 -0
  299. package/lib/components/PageTemplates/CategorySubPage.styles.js.map +1 -1
  300. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  301. package/lib/components/PageTemplates/DashboardPage.js +16 -2
  302. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  303. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  304. package/lib/components/PageTemplates/PageTemplates.js +20 -3
  305. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  306. package/lib/components/Popover/Popover.d.ts +1 -1
  307. package/lib/components/Popover/Popover.d.ts.map +1 -1
  308. package/lib/components/Popover/Popover.js +2 -5
  309. package/lib/components/Popover/Popover.js.map +1 -1
  310. package/lib/components/Popover/Popover.styles.d.ts +0 -1
  311. package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
  312. package/lib/components/Popover/Popover.styles.js +0 -6
  313. package/lib/components/Popover/Popover.styles.js.map +1 -1
  314. package/lib/components/Popover/modifiers.d.ts +0 -2
  315. package/lib/components/Popover/modifiers.d.ts.map +1 -1
  316. package/lib/components/Popover/modifiers.js +1 -32
  317. package/lib/components/Popover/modifiers.js.map +1 -1
  318. package/lib/components/Progress/Bar.d.ts +0 -3
  319. package/lib/components/Progress/Bar.d.ts.map +1 -1
  320. package/lib/components/Progress/Bar.js +1 -54
  321. package/lib/components/Progress/Bar.js.map +1 -1
  322. package/lib/components/Progress/Ellipsis.d.ts +0 -1
  323. package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
  324. package/lib/components/Progress/Ellipsis.js +1 -72
  325. package/lib/components/Progress/Ellipsis.js.map +1 -1
  326. package/lib/components/Progress/Progress.d.ts.map +1 -1
  327. package/lib/components/Progress/Progress.js +99 -60
  328. package/lib/components/Progress/Progress.js.map +1 -1
  329. package/lib/components/Progress/Progress.styles.d.ts +12 -0
  330. package/lib/components/Progress/Progress.styles.d.ts.map +1 -0
  331. package/lib/components/Progress/Progress.styles.js +217 -0
  332. package/lib/components/Progress/Progress.styles.js.map +1 -0
  333. package/lib/components/Progress/Progress.types.d.ts +19 -2
  334. package/lib/components/Progress/Progress.types.d.ts.map +1 -1
  335. package/lib/components/Progress/Progress.types.js.map +1 -1
  336. package/lib/components/Progress/Ring.d.ts +0 -3
  337. package/lib/components/Progress/Ring.d.ts.map +1 -1
  338. package/lib/components/Progress/Ring.js +1 -58
  339. package/lib/components/Progress/Ring.js.map +1 -1
  340. package/lib/components/Progress/index.d.ts +1 -3
  341. package/lib/components/Progress/index.d.ts.map +1 -1
  342. package/lib/components/Progress/index.js +1 -3
  343. package/lib/components/Progress/index.js.map +1 -1
  344. package/lib/components/QRCode/QRCode.d.ts +14 -0
  345. package/lib/components/QRCode/QRCode.d.ts.map +1 -0
  346. package/lib/components/QRCode/QRCode.js +39 -0
  347. package/lib/components/QRCode/QRCode.js.map +1 -0
  348. package/lib/components/QRCode/index.d.ts +3 -0
  349. package/lib/components/QRCode/index.d.ts.map +1 -0
  350. package/lib/components/QRCode/index.js +2 -0
  351. package/lib/components/QRCode/index.js.map +1 -0
  352. package/lib/components/RadioCheck/RadioCheck.js +1 -1
  353. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  354. package/lib/components/SearchInput/SearchInput.d.ts +2 -2
  355. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  356. package/lib/components/SearchInput/SearchInput.js +28 -8
  357. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  358. package/lib/components/SearchInput/SearchInput.styles.js +1 -1
  359. package/lib/components/SearchInput/SearchInput.styles.js.map +1 -1
  360. package/lib/components/ShowMoreLess/ShowMoreLess.d.ts +9 -0
  361. package/lib/components/ShowMoreLess/ShowMoreLess.d.ts.map +1 -0
  362. package/lib/components/ShowMoreLess/ShowMoreLess.js +41 -0
  363. package/lib/components/ShowMoreLess/ShowMoreLess.js.map +1 -0
  364. package/lib/components/ShowMoreLess/index.d.ts +3 -0
  365. package/lib/components/ShowMoreLess/index.d.ts.map +1 -0
  366. package/lib/components/ShowMoreLess/index.js +2 -0
  367. package/lib/components/ShowMoreLess/index.js.map +1 -0
  368. package/lib/components/SkipLinks/SkipLinks.d.ts.map +1 -1
  369. package/lib/components/SkipLinks/SkipLinks.js +3 -26
  370. package/lib/components/SkipLinks/SkipLinks.js.map +1 -1
  371. package/lib/components/Slider/Slider.styles.d.ts +1 -1
  372. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  373. package/lib/components/Tabs/Tab.js +2 -2
  374. package/lib/components/Tabs/Tab.js.map +1 -1
  375. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  376. package/lib/components/Tabs/Tabs.js +8 -10
  377. package/lib/components/Tabs/Tabs.js.map +1 -1
  378. package/lib/components/TextArea/TextArea.js +2 -2
  379. package/lib/components/TextArea/TextArea.js.map +1 -1
  380. package/lib/components/Toaster/Context.d.ts +1 -0
  381. package/lib/components/Toaster/Context.d.ts.map +1 -1
  382. package/lib/components/Toaster/Context.js.map +1 -1
  383. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  384. package/lib/components/Toaster/Toaster.js +6 -2
  385. package/lib/components/Toaster/Toaster.js.map +1 -1
  386. package/lib/components/Tree/StandardTree.d.ts.map +1 -1
  387. package/lib/components/Tree/StandardTree.js +70 -27
  388. package/lib/components/Tree/StandardTree.js.map +1 -1
  389. package/lib/components/Tree/StandardTree.styles.d.ts +1 -0
  390. package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -1
  391. package/lib/components/Tree/StandardTree.styles.js +32 -18
  392. package/lib/components/Tree/StandardTree.styles.js.map +1 -1
  393. package/lib/components/Tree/StandardTree.types.d.ts +28 -1
  394. package/lib/components/Tree/StandardTree.types.d.ts.map +1 -1
  395. package/lib/components/Tree/StandardTree.types.js.map +1 -1
  396. package/lib/components/Tree/Tree.d.ts +2 -2
  397. package/lib/components/Tree/Tree.d.ts.map +1 -1
  398. package/lib/components/Tree/helpers.d.ts +11 -9
  399. package/lib/components/Tree/helpers.d.ts.map +1 -1
  400. package/lib/components/Tree/helpers.js +25 -5
  401. package/lib/components/Tree/helpers.js.map +1 -1
  402. package/lib/components/Tree/index.d.ts +1 -1
  403. package/lib/components/Tree/index.d.ts.map +1 -1
  404. package/lib/components/Tree/index.js.map +1 -1
  405. package/lib/components/URL/URLDisplay.d.ts +2 -2
  406. package/lib/components/URL/URLDisplay.d.ts.map +1 -1
  407. package/lib/components/URL/URLDisplay.js +8 -1
  408. package/lib/components/URL/URLDisplay.js.map +1 -1
  409. package/lib/hooks/index.d.ts +1 -0
  410. package/lib/hooks/index.d.ts.map +1 -1
  411. package/lib/hooks/index.js +1 -0
  412. package/lib/hooks/index.js.map +1 -1
  413. package/lib/hooks/useActiveDescendant.d.ts +2 -2
  414. package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
  415. package/lib/hooks/useArrows.d.ts.map +1 -1
  416. package/lib/hooks/useArrows.js +3 -3
  417. package/lib/hooks/useArrows.js.map +1 -1
  418. package/lib/hooks/useBreakpoint.d.ts.map +1 -1
  419. package/lib/hooks/useBreakpoint.js +3 -2
  420. package/lib/hooks/useBreakpoint.js.map +1 -1
  421. package/lib/hooks/useEvent.d.ts +2 -2
  422. package/lib/hooks/useEvent.d.ts.map +1 -1
  423. package/lib/hooks/useI18n.d.ts +88 -19
  424. package/lib/hooks/useI18n.d.ts.map +1 -1
  425. package/lib/hooks/useLiveLog.d.ts +8 -0
  426. package/lib/hooks/useLiveLog.d.ts.map +1 -0
  427. package/lib/hooks/useLiveLog.js +16 -0
  428. package/lib/hooks/useLiveLog.js.map +1 -0
  429. package/lib/hooks/useOverride.d.ts +1 -1
  430. package/lib/hooks/useOverride.d.ts.map +1 -1
  431. package/lib/hooks/useScrollStick.d.ts +1 -1
  432. package/lib/hooks/useScrollStick.d.ts.map +1 -1
  433. package/lib/i18n/default.d.ts +88 -19
  434. package/lib/i18n/default.d.ts.map +1 -1
  435. package/lib/i18n/default.js +98 -27
  436. package/lib/i18n/default.js.map +1 -1
  437. package/lib/i18n/i18n.d.ts +90 -21
  438. package/lib/i18n/i18n.d.ts.map +1 -1
  439. package/lib/i18n/translate.d.ts +1 -1
  440. package/lib/i18n/translate.d.ts.map +1 -1
  441. package/lib/index.d.ts +6 -1
  442. package/lib/index.d.ts.map +1 -1
  443. package/lib/index.js +6 -1
  444. package/lib/index.js.map +1 -1
  445. package/lib/register-contexts.js +2 -0
  446. package/lib/register-contexts.js.map +1 -1
  447. package/lib/styles/gradients.d.ts +1 -1
  448. package/lib/styles/gradients.d.ts.map +1 -1
  449. package/lib/styles/utils.d.ts +1 -1
  450. package/lib/styles/utils.d.ts.map +1 -1
  451. package/lib/styles/utils.js +10 -10
  452. package/lib/styles/utils.js.map +1 -1
  453. package/lib/theme/ThemeMachine.d.ts +3 -3
  454. package/lib/theme/ThemeMachine.d.ts.map +1 -1
  455. package/lib/theme/ThemeMachine.js +30 -30
  456. package/lib/theme/ThemeMachine.js.map +1 -1
  457. package/lib/theme/theme.d.ts +45 -75
  458. package/lib/theme/theme.d.ts.map +1 -1
  459. package/lib/theme/themeDefinition.json +14 -30
  460. package/lib/theme/themeOverrides.schema.json +1 -4
  461. package/lib/theme/themes/darkTheme.json +4 -1
  462. package/lib/theme/themes/legacyBuildTheme.json +2 -3
  463. package/lib/types/types.d.ts +19 -11
  464. package/lib/types/types.d.ts.map +1 -1
  465. package/lib/types/types.js.map +1 -1
  466. package/lib/utils/bindAll.d.ts +4 -0
  467. package/lib/utils/bindAll.d.ts.map +1 -0
  468. package/lib/utils/bindAll.js +9 -0
  469. package/lib/utils/bindAll.js.map +1 -0
  470. package/lib/utils/cap.d.ts +4 -0
  471. package/lib/utils/cap.d.ts.map +1 -0
  472. package/lib/utils/cap.js +6 -0
  473. package/lib/utils/cap.js.map +1 -0
  474. package/lib/utils/createStringMatcher.d.ts +10 -0
  475. package/lib/utils/createStringMatcher.d.ts.map +1 -0
  476. package/lib/utils/createStringMatcher.js +21 -0
  477. package/lib/utils/createStringMatcher.js.map +1 -0
  478. package/lib/utils/createUID.d.ts +4 -0
  479. package/lib/utils/createUID.d.ts.map +1 -0
  480. package/lib/utils/createUID.js +6 -0
  481. package/lib/utils/createUID.js.map +1 -0
  482. package/lib/utils/debounce.d.ts +4 -0
  483. package/lib/utils/debounce.d.ts.map +1 -0
  484. package/lib/utils/debounce.js +14 -0
  485. package/lib/utils/debounce.js.map +1 -0
  486. package/lib/utils/deepGet.d.ts +3 -0
  487. package/lib/utils/deepGet.d.ts.map +1 -0
  488. package/lib/utils/deepGet.js +15 -0
  489. package/lib/utils/deepGet.js.map +1 -0
  490. package/lib/utils/deepObjectComparison.d.ts +4 -0
  491. package/lib/utils/deepObjectComparison.d.ts.map +1 -0
  492. package/lib/utils/deepObjectComparison.js +35 -0
  493. package/lib/utils/deepObjectComparison.js.map +1 -0
  494. package/lib/utils/defineSmartGetter.d.ts +3 -0
  495. package/lib/utils/defineSmartGetter.d.ts.map +1 -0
  496. package/lib/utils/defineSmartGetter.js +14 -0
  497. package/lib/utils/defineSmartGetter.js.map +1 -0
  498. package/lib/utils/documentIsAvailable.d.ts +3 -0
  499. package/lib/utils/documentIsAvailable.d.ts.map +1 -0
  500. package/lib/utils/documentIsAvailable.js +3 -0
  501. package/lib/utils/documentIsAvailable.js.map +1 -0
  502. package/lib/utils/escapeRegExp.d.ts +8 -0
  503. package/lib/utils/escapeRegExp.d.ts.map +1 -0
  504. package/lib/utils/escapeRegExp.js +8 -0
  505. package/lib/utils/escapeRegExp.js.map +1 -0
  506. package/lib/utils/focusHeadingOrContainer.d.ts +8 -0
  507. package/lib/utils/focusHeadingOrContainer.d.ts.map +1 -0
  508. package/lib/utils/focusHeadingOrContainer.js +29 -0
  509. package/lib/utils/focusHeadingOrContainer.js.map +1 -0
  510. package/lib/utils/formatListToLocaleString.d.ts +15 -0
  511. package/lib/utils/formatListToLocaleString.d.ts.map +1 -0
  512. package/lib/utils/formatListToLocaleString.js +17 -0
  513. package/lib/utils/formatListToLocaleString.js.map +1 -0
  514. package/lib/utils/getActiveElement.d.ts +8 -0
  515. package/lib/utils/getActiveElement.d.ts.map +1 -0
  516. package/lib/utils/getActiveElement.js +18 -0
  517. package/lib/utils/getActiveElement.js.map +1 -0
  518. package/lib/utils/getFocusables.d.ts +9 -0
  519. package/lib/utils/getFocusables.d.ts.map +1 -0
  520. package/lib/utils/getFocusables.js +15 -0
  521. package/lib/utils/getFocusables.js.map +1 -0
  522. package/lib/utils/getScrollbarWidth.d.ts +4 -0
  523. package/lib/utils/getScrollbarWidth.d.ts.map +1 -0
  524. package/lib/utils/getScrollbarWidth.js +17 -0
  525. package/lib/utils/getScrollbarWidth.js.map +1 -0
  526. package/lib/utils/hasProp.d.ts +4 -0
  527. package/lib/utils/hasProp.d.ts.map +1 -0
  528. package/lib/utils/hasProp.js +6 -0
  529. package/lib/utils/hasProp.js.map +1 -0
  530. package/lib/utils/index.d.ts +27 -1
  531. package/lib/utils/index.d.ts.map +1 -1
  532. package/lib/utils/index.js +27 -1
  533. package/lib/utils/index.js.map +1 -1
  534. package/lib/utils/loadScript.d.ts +3 -0
  535. package/lib/utils/loadScript.d.ts.map +1 -0
  536. package/lib/utils/loadScript.js +9 -0
  537. package/lib/utils/loadScript.js.map +1 -0
  538. package/lib/utils/navigatorIsAvailable.d.ts +3 -0
  539. package/lib/utils/navigatorIsAvailable.d.ts.map +1 -0
  540. package/lib/utils/navigatorIsAvailable.js +3 -0
  541. package/lib/utils/navigatorIsAvailable.js.map +1 -0
  542. package/lib/utils/normalizeElements.d.ts +9 -0
  543. package/lib/utils/normalizeElements.d.ts.map +1 -0
  544. package/lib/utils/normalizeElements.js +14 -0
  545. package/lib/utils/normalizeElements.js.map +1 -0
  546. package/lib/utils/range.d.ts +4 -0
  547. package/lib/utils/range.d.ts.map +1 -0
  548. package/lib/utils/range.js +8 -0
  549. package/lib/utils/range.js.map +1 -0
  550. package/lib/utils/reflow.d.ts +4 -0
  551. package/lib/utils/reflow.d.ts.map +1 -0
  552. package/lib/utils/reflow.js +7 -0
  553. package/lib/utils/reflow.js.map +1 -0
  554. package/lib/utils/replaceMatchWithElement.d.ts +4 -0
  555. package/lib/utils/replaceMatchWithElement.d.ts.map +1 -0
  556. package/lib/utils/replaceMatchWithElement.js +32 -0
  557. package/lib/utils/replaceMatchWithElement.js.map +1 -0
  558. package/lib/utils/sameOrigin.d.ts +7 -0
  559. package/lib/utils/sameOrigin.d.ts.map +1 -0
  560. package/lib/utils/sameOrigin.js +25 -0
  561. package/lib/utils/sameOrigin.js.map +1 -0
  562. package/lib/utils/testElForOverflow.d.ts +4 -0
  563. package/lib/utils/testElForOverflow.d.ts.map +1 -0
  564. package/lib/utils/testElForOverflow.js +6 -0
  565. package/lib/utils/testElForOverflow.js.map +1 -0
  566. package/lib/utils/triple.d.ts +12 -0
  567. package/lib/utils/triple.d.ts.map +1 -0
  568. package/lib/utils/triple.js +13 -0
  569. package/lib/utils/triple.js.map +1 -0
  570. package/lib/utils/tryCatch.d.ts +5 -0
  571. package/lib/utils/tryCatch.d.ts.map +1 -0
  572. package/lib/utils/tryCatch.js +16 -0
  573. package/lib/utils/tryCatch.js.map +1 -0
  574. package/lib/utils/windowIsAvailable.d.ts +3 -0
  575. package/lib/utils/windowIsAvailable.d.ts.map +1 -0
  576. package/lib/utils/windowIsAvailable.js +3 -0
  577. package/lib/utils/windowIsAvailable.js.map +1 -0
  578. package/package.json +4 -2
  579. package/lib/components/ListToolbar/QueryOptionPopover.d.ts +0 -12
  580. package/lib/components/ListToolbar/QueryOptionPopover.d.ts.map +0 -1
  581. package/lib/components/ListToolbar/QueryOptionPopover.js +0 -36
  582. package/lib/components/ListToolbar/QueryOptionPopover.js.map +0 -1
  583. package/lib/utils/utils.d.ts +0 -93
  584. package/lib/utils/utils.d.ts.map +0 -1
  585. package/lib/utils/utils.js +0 -287
  586. package/lib/utils/utils.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef, createContext, useMemo, useContext, useCallback, useState, useEffect, useRef } from 'react';
3
3
  import Progress from '../Progress';
4
- import { useDirection } from '../../hooks';
4
+ import { useConsolidatedRef, useDirection, useFocusWithin } from '../../hooks';
5
5
  import Flex from '../Flex';
6
- import Button from '../Button';
7
6
  import Actions from '../Actions';
8
7
  import { cap } from '../../utils';
9
- import { StyledStandardTreeParent, StyledToggleIcon, StyledStandardTreeItemSubTree, StyledStandardTreeLeaf, StyledStandardTree, StyledNodeInteraction, StyledStandardTreeNode, StyledNodeActions, StyledLabelContent, StyledNodeIcon, StyledNodeText } from './StandardTree.styles';
8
+ import Button from '../Button';
9
+ import { StyledStandardTreeParent, StyledToggleIcon, StyledToggleIconWrapper, StyledStandardTreeItemSubTree, StyledStandardTreeLeaf, StyledStandardTree, StyledNodeInteraction, StyledStandardTreeNode, StyledNodeActions, StyledLabelContent, StyledNodeIcon, StyledNodeText } from './StandardTree.styles';
10
10
  import helpers from './helpers';
11
11
  const StandardTreeContext = createContext({
12
12
  currentNodeId: undefined,
@@ -16,20 +16,24 @@ const StandardTreeContext = createContext({
16
16
  firstNodeId: undefined,
17
17
  lastNodeId: undefined,
18
18
  focusedNodeId: undefined,
19
- changeFocusedNodeId: () => { }
19
+ changeFocusedNodeId: () => { },
20
+ selectableParents: true
20
21
  });
21
- const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expanded = false, loading = false, subTree, actions, onClick }) => {
22
- const { currentNodeId, onNodeClick, onNodeToggle, lined, focusedNodeId, changeFocusedNodeId, firstNodeId, lastNodeId } = useContext(StandardTreeContext);
22
+ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expanded = false, loading = false, subTree, actions, onClick, href }) => {
23
+ const { currentNodeId, onNodeClick, onNodeToggle, lined, focusedNodeId, changeFocusedNodeId, firstNodeId, lastNodeId, selectableParents } = useContext(StandardTreeContext);
23
24
  const current = currentNodeId === id;
24
25
  const focusedEl = focusedNodeId === id;
25
26
  const firstNode = firstNodeId === id;
26
27
  const { start, end } = useDirection();
28
+ const ariaCurrent = useMemo(() => {
29
+ return href ? 'page' : 'true';
30
+ }, [href]);
27
31
  const tabIndex = useMemo(() => {
28
32
  let index = -1;
29
33
  if (focusedNodeId) {
30
34
  index = focusedEl ? 0 : -1;
31
35
  }
32
- else if (currentNodeId) {
36
+ else if (currentNodeId && nodes && helpers.getNode(nodes, currentNodeId)) {
33
37
  index = current ? 0 : -1;
34
38
  }
35
39
  else {
@@ -37,12 +41,20 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
37
41
  }
38
42
  return index;
39
43
  }, [focusedNodeId, currentNodeId, current, focusedEl]);
40
- const handleToggleClick = useCallback((e) => {
44
+ const handleParentClick = useCallback((e) => {
41
45
  onNodeClick?.(id, e);
42
46
  changeFocusedNodeId(id);
43
47
  }, [id, onNodeClick, changeFocusedNodeId]);
48
+ const handleParentToggle = useCallback((e) => {
49
+ e.preventDefault();
50
+ e.stopPropagation();
51
+ onNodeToggle?.(id, e);
52
+ changeFocusedNodeId(id);
53
+ }, [id, onNodeToggle, changeFocusedNodeId]);
44
54
  const onKeyDown = useCallback((e) => {
45
- if (['ArrowUp', 'ArrowDown', 'Enter', 'Home', 'End'].includes(e.key))
55
+ if (['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(e.key))
56
+ e.preventDefault();
57
+ if (e.key === 'Enter' && !href)
46
58
  e.preventDefault();
47
59
  switch (e.key) {
48
60
  case 'ArrowUp':
@@ -70,11 +82,18 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
70
82
  }
71
83
  break;
72
84
  case 'Enter':
73
- if (onClick) {
74
- onClick(id, e);
85
+ onClick?.(id, e);
86
+ if (nodes) {
87
+ if (selectableParents) {
88
+ handleParentClick(e);
89
+ }
90
+ else {
91
+ handleParentToggle(e);
92
+ }
75
93
  }
76
94
  else {
77
- handleToggleClick(e);
95
+ onNodeClick?.(id, e);
96
+ changeFocusedNodeId(id);
78
97
  }
79
98
  break;
80
99
  case 'Home':
@@ -95,11 +114,19 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
95
114
  ...action,
96
115
  onClick: (actionId, e) => {
97
116
  e.stopPropagation();
117
+ e.preventDefault();
98
118
  action?.onClick?.(actionId, e);
119
+ },
120
+ onKeyDown: (e) => {
121
+ if (e.key === 'Enter')
122
+ e.stopPropagation();
99
123
  }
100
124
  };
101
125
  }), menuAt: 3, menuButtonProps: {
102
- onClick: (e) => e.stopPropagation(),
126
+ onClick: (e) => {
127
+ e.stopPropagation();
128
+ e.preventDefault();
129
+ },
103
130
  onKeyDown: (e) => {
104
131
  e.stopPropagation();
105
132
  if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
@@ -118,11 +145,11 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
118
145
  const internal = (
119
146
  // Wrapping in a div for handling of flex space-between when there are node actions.
120
147
  _jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: StyledLabelContent, children: [icon && _jsx(StyledNodeIcon, { name: icon }), _jsx(StyledNodeText, { children: label })] }));
121
- return !nodes && (onClick ?? onNodeClick) ? (_jsxs(Flex, { container: { alignItems: 'center', justify: 'between', gap: 2 }, as: StyledNodeInteraction, role: 'treeitem', "aria-current": current ? 'true' : undefined, tabIndex: tabIndex, onClick: (e) => {
148
+ return !nodes && (onClick ?? onNodeClick) ? (_jsxs(Flex, { container: { alignItems: 'center', justify: 'between', gap: 2 }, as: StyledNodeInteraction, forwardedAs: href ? 'a' : 'div', role: 'treeitem', "aria-current": current ? ariaCurrent : undefined, tabIndex: tabIndex, onClick: (e) => {
122
149
  onClick?.(id, e);
123
150
  onNodeClick?.(id, e);
124
151
  changeFocusedNodeId(id);
125
- }, onKeyDown: onKeyDown, ref: elRef, children: [internal, actionsJSX] })) : (internal);
152
+ }, href: href, onKeyDown: onKeyDown, ref: elRef, children: [internal, actionsJSX] })) : (internal);
126
153
  }, [
127
154
  id,
128
155
  label,
@@ -137,16 +164,15 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
137
164
  changeFocusedNodeId,
138
165
  onKeyDown
139
166
  ]);
140
- return (_jsx(StyledStandardTreeNode, { id: id, style: { '--depth': depth, '--has-parent-sibling': Number(hasParentSibling) }, "aria-busy": loading, children: nodes ? (_jsxs(_Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'between', gap: 2 }, as: StyledStandardTreeParent, role: 'treeitem', "aria-current": current ? 'true' : undefined, tabIndex: tabIndex, variant: 'text', onClick: handleToggleClick, "aria-expanded": expanded ? 'true' : 'false', "aria-label": label, onKeyDown: onKeyDown, ref: elRef, children: [_jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: 'span', children: [_jsx(Button, { variant: 'simple', icon: true, compact: true, onClick: (e) => {
141
- if (onNodeToggle) {
142
- e.stopPropagation();
143
- onNodeToggle(id, e);
144
- changeFocusedNodeId(id);
145
- }
146
- }, children: _jsx(StyledToggleIcon, { name: 'caret-right' }) }), labelContent] }), actionsJSX] }), _jsxs(StyledStandardTreeItemSubTree, { lined: lined, children: [subTree, loading && _jsx(Progress, { variant: 'ring', placement: 'inline' })] })] })) : (_jsx(StyledStandardTreeLeaf, { children: labelContent })) }));
167
+ return (_jsx(StyledStandardTreeNode, { id: id, style: {
168
+ '--depth': depth,
169
+ '--has-parent': depth ? 1 : 0,
170
+ '--has-parent-sibling': hasParentSibling ? 1 : 0
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 })) }));
147
172
  };
148
- const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, onNodeToggle, lined = false, ...restProps }, ref) => {
173
+ const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, onNodeToggle, lined = false, selectableParents = true, ...restProps }, ref) => {
149
174
  const [focusedNodeId, setFocusedNodedId] = useState();
175
+ const treeRef = useConsolidatedRef(ref);
150
176
  const lastNodeId = useMemo(() => {
151
177
  return helpers.getDeepestNode(nodes, nodes[nodes.length - 1].id)?.id;
152
178
  }, [nodes]);
@@ -176,10 +202,18 @@ const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, o
176
202
  setFocusedNodedId(childNode.id);
177
203
  break;
178
204
  }
179
- default:
180
- setFocusedNodedId(id);
205
+ default: {
206
+ if (id !== focusedNodeId)
207
+ setFocusedNodedId(id);
208
+ break;
209
+ }
181
210
  }
182
211
  }, [nodes]);
212
+ const onFocusChange = (focused) => {
213
+ if (!focused)
214
+ setFocusedNodedId('');
215
+ };
216
+ useFocusWithin([treeRef], onFocusChange);
183
217
  return (_jsx(StandardTreeContext.Provider, { value: useMemo(() => ({
184
218
  currentNodeId,
185
219
  focusedNodeId,
@@ -188,8 +222,17 @@ const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, o
188
222
  changeFocusedNodeId,
189
223
  onNodeClick,
190
224
  onNodeToggle,
191
- lined
192
- }), [currentNodeId, onNodeClick, lined, focusedNodeId, lastNodeId, onNodeToggle]), children: _jsx(StyledStandardTree, { ...restProps, ref: ref, nodes: nodes, nodeRenderer: NodeRenderer }) }));
225
+ lined,
226
+ selectableParents
227
+ }), [
228
+ currentNodeId,
229
+ onNodeClick,
230
+ lined,
231
+ focusedNodeId,
232
+ lastNodeId,
233
+ onNodeToggle,
234
+ selectableParents
235
+ ]), children: _jsx(StyledStandardTree, { ...restProps, ref: treeRef, nodes: nodes, nodeRenderer: NodeRenderer }) }));
193
236
  });
194
237
  const StandardTree = forwardRef((props, ref) => {
195
238
  return props.nodes.length > 0 ? _jsx(StandardTreeWithNodes, { ...props, ref: ref }) : null;
@@ -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,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,GAAG,EAAE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AC,kBAAkB,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,GAAI,GAC5D,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 { useDirection } from '../../hooks';\nimport Flex from '../Flex';\nimport Button from '../Button';\nimport Actions from '../Actions';\nimport type { Action, ForwardProps } from '../../types';\nimport { cap } from '../../utils';\n\nimport {\n StyledStandardTreeParent,\n StyledToggleIcon,\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 >\n>({\n currentNodeId: undefined,\n lined: false,\n onNodeClick: () => {},\n onNodeToggle: () => {},\n firstNodeId: undefined,\n lastNodeId: undefined,\n focusedNodeId: undefined,\n changeFocusedNodeId: () => {}\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}) => {\n const {\n currentNodeId,\n onNodeClick,\n onNodeToggle,\n lined,\n focusedNodeId,\n changeFocusedNodeId,\n firstNodeId,\n lastNodeId\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 tabIndex = useMemo(() => {\n let index = -1;\n if (focusedNodeId) {\n index = focusedEl ? 0 : -1;\n } else if (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 handleToggleClick = useCallback(\n (e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n },\n [id, onNodeClick, changeFocusedNodeId]\n );\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Enter', 'Home', 'End'].includes(e.key)) 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 if (onClick) {\n onClick(id, e);\n } else {\n handleToggleClick(e);\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 action?.onClick?.(actionId, e);\n }\n };\n })}\n menuAt={3}\n menuButtonProps={{\n onClick: (e: MouseEvent) => e.stopPropagation(),\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 role='treeitem'\n aria-current={current ? 'true' : undefined}\n tabIndex={tabIndex}\n onClick={(e: MouseEvent<HTMLElement>) => {\n onClick?.(id, e);\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n }}\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 { '--depth': depth, '--has-parent-sibling': Number(hasParentSibling) } 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 role='treeitem'\n aria-current={current ? 'true' : undefined}\n tabIndex={tabIndex}\n variant='text'\n onClick={handleToggleClick}\n aria-expanded={expanded ? 'true' : 'false'}\n aria-label={label}\n onKeyDown={onKeyDown}\n ref={elRef}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Button\n variant='simple'\n icon\n compact\n onClick={(e: MouseEvent<HTMLElement>) => {\n if (onNodeToggle) {\n e.stopPropagation();\n onNodeToggle(id, e);\n changeFocusedNodeId(id);\n }\n }}\n >\n <StyledToggleIcon name='caret-right' />\n </Button>\n {labelContent}\n </Flex>\n {actionsJSX}\n </Flex>\n <StyledStandardTreeItemSubTree lined={lined}>\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 ...restProps\n }: PropsWithoutRef<StandardTreeProps>,\n ref: StandardTreeProps['ref']\n ) => {\n const [focusedNodeId, setFocusedNodedId] = useState<string | undefined>();\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 setFocusedNodedId(id);\n }\n },\n [nodes]\n );\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 }),\n [currentNodeId, onNodeClick, lined, focusedNodeId, lastNodeId, onNodeToggle]\n )}\n >\n {/* FIXME: Types are having issues when styled(Tree) is typeof Tree. */}\n <StyledStandardTree {...restProps} ref={ref} nodes={nodes} nodeRenderer={NodeRenderer} />\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;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa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Context,\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"]}
@@ -4,6 +4,7 @@ export declare const StyledNodeActions: import("styled-components").StyledCompon
4
4
  export declare const StyledLabelContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
5
  export declare const StyledNodeIcon: import("styled-components").StyledComponent<import("react").FunctionComponent<import("../Icon").IconProps & import("../..").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
6
6
  export declare const StyledNodeText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const StyledToggleIconWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
8
  export declare const StyledStandardTreeItemSubTree: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<StandardTreePropsWithDefaults, "lined">, never>;
8
9
  export declare const StyledNodeInteraction: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
9
10
  export declare const StyledStandardTreeLeaf: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"StandardTree.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.styles.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE,eAAO,MAAM,gBAAgB,iMAAiB,CAAC;AAE/C,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,eAAO,MAAM,kBAAkB,yGAAe,CAAC;AAE/C,eAAO,MAAM,cAAc,iMAAiB,CAAC;AAE7C,eAAO,MAAM,cAAc,0GAAgB,CAAC;AAE5C,eAAO,MAAM,6BAA6B,mJAgCxC,CAAC;AAIH,eAAO,MAAM,qBAAqB,yGA8ChC,CAAC;AAIH,eAAO,MAAM,sBAAsB,yGAYjC,CAAC;AAKH,eAAO,MAAM,wBAAwB,EAAE,GA2BrC,CAAC;AAIH,eAAO,MAAM,sBAAsB,yGAWlC,CAAC;AAIF,eAAO,MAAM,kBAAkB,kQAI9B,CAAC"}
1
+ {"version":3,"file":"StandardTree.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.styles.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE,eAAO,MAAM,gBAAgB,iMAAiB,CAAC;AAE/C,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,eAAO,MAAM,kBAAkB,yGAAe,CAAC;AAE/C,eAAO,MAAM,cAAc,iMAAiB,CAAC;AAE7C,eAAO,MAAM,cAAc,0GAAgB,CAAC;AAE5C,eAAO,MAAM,uBAAuB,yGAKlC,CAAC;AAIH,eAAO,MAAM,6BAA6B,mJAgCxC,CAAC;AAIH,eAAO,MAAM,qBAAqB,yGA8ChC,CAAC;AAIH,eAAO,MAAM,sBAAsB,yGASjC,CAAC;AAKH,eAAO,MAAM,wBAAwB,EAAE,GA2BrC,CAAC;AAIH,eAAO,MAAM,sBAAsB,yGAclC,CAAC;AAIF,eAAO,MAAM,kBAAkB,kQAU7B,CAAC"}
@@ -11,6 +11,13 @@ export const StyledNodeActions = styled.div ``;
11
11
  export const StyledLabelContent = styled.div ``;
12
12
  export const StyledNodeIcon = styled(Icon) ``;
13
13
  export const StyledNodeText = styled.span ``;
14
+ export const StyledToggleIconWrapper = styled.div(({ theme }) => {
15
+ return css `
16
+ min-height: ${theme.base['hit-area'].compact};
17
+ min-width: ${theme.base['hit-area'].compact};
18
+ `;
19
+ });
20
+ StyledToggleIconWrapper.defaultProps = defaultThemeProp;
14
21
  export const StyledStandardTreeItemSubTree = styled.div(({ theme, lined }) => {
15
22
  return css `
16
23
  position: relative;
@@ -45,9 +52,8 @@ export const StyledStandardTreeItemSubTree = styled.div(({ theme, lined }) => {
45
52
  StyledStandardTreeItemSubTree.defaultProps = defaultThemeProp;
46
53
  export const StyledNodeInteraction = styled.div(({ theme }) => {
47
54
  return css `
48
- /* Could put on Flex pad prop but, needing logical prop below, maybe makes sense to keep here.
49
- * We should fix Flex/Grid pad arrays to map to logical props...
50
- */
55
+ color: ${theme.base.palette['foreground-color']};
56
+ text-decoration: none;
51
57
  min-height: 2.25rem;
52
58
  padding-inline-start: calc(var(--parent-caret-width) * var(--depth) + var(--initial-padding));
53
59
  padding-inline-end: calc(var(--initial-padding) + ${theme.base.spacing});
@@ -81,6 +87,7 @@ export const StyledNodeInteraction = styled.div(({ theme }) => {
81
87
  }
82
88
  }
83
89
 
90
+ &[aria-current='page'],
84
91
  &[aria-current='true'] {
85
92
  background-color: ${transparentize(0.95, theme.base.palette['foreground-color'])};
86
93
 
@@ -94,12 +101,9 @@ StyledNodeInteraction.defaultProps = defaultThemeProp;
94
101
  export const StyledStandardTreeLeaf = styled.div(() => {
95
102
  return css `
96
103
  ${StyledNodeInteraction} {
97
- /* 1 when not at root and no parent sibling, 0 otherwise. */
98
- --include-parent-icon-width: min((1.5 - var(--has-parent-sibling)), (var(--depth) + 0.5));
99
104
  padding-inline-start: calc(
100
- var(--initial-padding) +
101
- (var(--parent-caret-width) * (var(--depth) + var(--has-parent-sibling))) +
102
- (var(--parent-icon-width) * var(--include-parent-icon-width))
105
+ var(--initial-padding) + (var(--parent-caret-width) * var(--depth)) +
106
+ (var(--parent-caret-spacing-width) * (max(var(--has-parent-sibling), var(--has-parent))))
103
107
  );
104
108
  }
105
109
  `;
@@ -135,21 +139,31 @@ export const StyledStandardTreeParent = styled(StyledNodeInteraction)(({ theme }
135
139
  });
136
140
  StyledStandardTreeParent.defaultProps = defaultThemeProp;
137
141
  export const StyledStandardTreeNode = styled.div(({ theme }) => css `
138
- --initial-padding: calc(${theme.base.spacing} * 1);
139
- --parent-caret-width: calc(1em + ${theme.base.spacing});
140
- --parent-icon-width: calc(1em + ${theme.base.spacing} / 2);
142
+ --initial-padding: calc(${theme.base.spacing} * 0.5);
143
+ --parent-caret-width: 1em;
144
+ --parent-caret-spacing-width: max(
145
+ (var(--parent-caret-width) + (2 * ${theme.components.button['border-width']})),
146
+ ${theme.base['hit-area'].compact}
147
+ );
141
148
 
142
149
  ${StyledIcon} {
143
- width: 1em;
144
- height: 1em;
150
+ width: var(--parent-caret-width);
151
+ height: var(--parent-caret-width);
145
152
  }
146
153
  `);
147
154
  StyledStandardTreeNode.defaultProps = defaultThemeProp;
148
- export const StyledStandardTree = styled(Tree) `
149
- ${StyledTreeListItem} {
150
- display: block;
151
- }
152
- `;
155
+ export const StyledStandardTree = styled(Tree)(({ theme }) => {
156
+ return css `
157
+ ${StyledTreeListItem} {
158
+ display: block;
159
+ }
160
+
161
+ &:has(:focus-visible) {
162
+ box-shadow: ${theme.base.shadow['focus-group']};
163
+ }
164
+ `;
165
+ });
166
+ StyledStandardTree.defaultProps = defaultThemeProp;
153
167
  // FIXME: We need to determine why styled-component types are "eating" our types.
154
168
  StyledStandardTree.defaultProps = defaultThemeProp;
155
169
  //# sourceMappingURL=StandardTree.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StandardTree.styles.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,IAAI,EAAE,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGlD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CA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AAC,IAAI,CAAC,OAAO;;MAElD,UAAU;;;;GAIb,CACF,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAC1C,kBAAkB;;;CAGrB,CAAC;AACF,iFAAiF;AAChF,kBAA6D,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { StyledButton } from '../Button';\nimport Icon, { StyledIcon } from '../Icon';\nimport { StyledProgressRing } from '../Progress';\nimport { defaultThemeProp } from '../../theme';\nimport { useDirection } from '../../hooks';\n\nimport Tree, { StyledTreeListItem } from './Tree';\nimport { StandardTreePropsWithDefaults } from './StandardTree.types';\n\nexport const StyledToggleIcon = styled(Icon)``;\n\nexport const StyledNodeActions = styled.div``;\n\nexport const StyledLabelContent = styled.div``;\n\nexport const StyledNodeIcon = styled(Icon)``;\n\nexport const StyledNodeText = styled.span``;\n\nexport const StyledStandardTreeItemSubTree = styled.div<\n Pick<StandardTreePropsWithDefaults, 'lined'>\n>(({ theme, lined }) => {\n return css`\n position: relative;\n\n ${lined &&\n css`\n ::before {\n content: '';\n display: block;\n position: absolute;\n background-color: currentColor;\n inset-block-start: -${theme.base.spacing};\n inset-block-end: 0;\n inset-inline-start: calc(\n 0.5em * (var(--depth) + 1) + (${theme.base.spacing} * var(--depth) + 0.5em * var(--depth)) +\n ${theme.base.spacing} * 1.5\n );\n width: 0.0625rem;\n opacity: 0.2;\n transition: opacity ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n `}\n\n ${StyledProgressRing} {\n margin: calc(${theme.base.spacing} * 1.25) 0;\n margin-inline-start: calc(\n var(--parent-caret-width) * (var(--depth) + 1) + var(--initial-padding)\n );\n }\n `;\n});\n\nStyledStandardTreeItemSubTree.defaultProps = defaultThemeProp;\n\nexport const StyledNodeInteraction = styled.div(({ theme }) => {\n return css`\n /* Could put on Flex pad prop but, needing logical prop below, maybe makes sense to keep here.\n * We should fix Flex/Grid pad arrays to map to logical props...\n */\n min-height: 2.25rem;\n padding-inline-start: calc(var(--parent-caret-width) * var(--depth) + var(--initial-padding));\n padding-inline-end: calc(var(--initial-padding) + ${theme.base.spacing});\n cursor: pointer;\n\n & > ${StyledNodeActions} {\n display: none;\n ${StyledButton} {\n margin-inline-start: calc(${theme.base.spacing} / 2);\n }\n }\n\n &:focus,\n &:focus-within {\n box-shadow: ${theme.base.shadow.focus};\n\n & > ${StyledNodeActions} {\n display: block;\n }\n }\n\n &:focus-visible {\n outline: none;\n }\n\n &:hover {\n background-color: ${transparentize(0.9, theme.base.palette['foreground-color'])};\n\n & > ${StyledNodeActions} {\n display: block;\n }\n }\n\n &[aria-current='true'] {\n background-color: ${transparentize(0.95, theme.base.palette['foreground-color'])};\n\n & > ${StyledLabelContent}, & > :first-child > ${StyledLabelContent} {\n color: ${theme.base.palette.interactive};\n }\n }\n `;\n});\n\nStyledNodeInteraction.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeLeaf = styled.div(() => {\n return css`\n ${StyledNodeInteraction} {\n /* 1 when not at root and no parent sibling, 0 otherwise. */\n --include-parent-icon-width: min((1.5 - var(--has-parent-sibling)), (var(--depth) + 0.5));\n padding-inline-start: calc(\n var(--initial-padding) +\n (var(--parent-caret-width) * (var(--depth) + var(--has-parent-sibling))) +\n (var(--parent-icon-width) * var(--include-parent-icon-width))\n );\n }\n `;\n});\n\nStyledStandardTreeLeaf.defaultProps = defaultThemeProp;\n\n// FIXME: any is used since typeof StyledNodeInteraction not playing nicely.\nexport const StyledStandardTreeParent: any = styled(StyledNodeInteraction)(({ theme }) => {\n const { ltr } = useDirection();\n\n return css`\n &[aria-expanded='true'] ${StyledToggleIcon} {\n transform: rotate(90deg);\n }\n\n &[aria-expanded='false'] {\n ${StyledToggleIcon} {\n transform: rotate(${ltr ? '0' : '180'}deg);\n }\n\n + ${StyledStandardTreeItemSubTree} {\n display: none;\n }\n }\n\n &:hover + ${StyledStandardTreeItemSubTree}::before {\n opacity: 0.5;\n }\n\n ${StyledToggleIcon} {\n transition: transform calc(${theme.base.animation.speed} / 2)\n ${theme.base.animation.timing.ease};\n }\n `;\n});\n\nStyledStandardTreeParent.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeNode = styled.div(\n ({ theme }) => css`\n --initial-padding: calc(${theme.base.spacing} * 1);\n --parent-caret-width: calc(1em + ${theme.base.spacing});\n --parent-icon-width: calc(1em + ${theme.base.spacing} / 2);\n\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n `\n);\n\nStyledStandardTreeNode.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTree = styled(Tree)`\n ${StyledTreeListItem} {\n display: block;\n }\n`;\n// FIXME: We need to determine why styled-component types are \"eating\" our types.\n(StyledStandardTree as typeof Tree & { defaultProps: object }).defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"StandardTree.styles.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,IAAI,EAAE,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGlD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAA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AAI,CAAC,SAAS,CAAC,KAAK;UACnD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI;;GAEvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAC9C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;8BACU,KAAK,CAAC,IAAI,CAAC,OAAO;;;0CAGN,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC;QACzE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO;;;MAGhC,UAAU;;;;GAIb,CACF,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3D,OAAO,GAAG,CAAA;MACN,kBAAkB;;;;;oBAKJ,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;;GAEjD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,iFAAiF;AAChF,kBAA6D,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { StyledButton } from '../Button';\nimport Icon, { StyledIcon } from '../Icon';\nimport { StyledProgressRing } from '../Progress';\nimport { defaultThemeProp } from '../../theme';\nimport { useDirection } from '../../hooks';\n\nimport Tree, { StyledTreeListItem } from './Tree';\nimport { StandardTreePropsWithDefaults } from './StandardTree.types';\n\nexport const StyledToggleIcon = styled(Icon)``;\n\nexport const StyledNodeActions = styled.div``;\n\nexport const StyledLabelContent = styled.div``;\n\nexport const StyledNodeIcon = styled(Icon)``;\n\nexport const StyledNodeText = styled.span``;\n\nexport const StyledToggleIconWrapper = styled.div(({ theme }) => {\n return css`\n min-height: ${theme.base['hit-area'].compact};\n min-width: ${theme.base['hit-area'].compact};\n `;\n});\n\nStyledToggleIconWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeItemSubTree = styled.div<\n Pick<StandardTreePropsWithDefaults, 'lined'>\n>(({ theme, lined }) => {\n return css`\n position: relative;\n\n ${lined &&\n css`\n ::before {\n content: '';\n display: block;\n position: absolute;\n background-color: currentColor;\n inset-block-start: -${theme.base.spacing};\n inset-block-end: 0;\n inset-inline-start: calc(\n 0.5em * (var(--depth) + 1) + (${theme.base.spacing} * var(--depth) + 0.5em * var(--depth)) +\n ${theme.base.spacing} * 1.5\n );\n width: 0.0625rem;\n opacity: 0.2;\n transition: opacity ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n `}\n\n ${StyledProgressRing} {\n margin: calc(${theme.base.spacing} * 1.25) 0;\n margin-inline-start: calc(\n var(--parent-caret-width) * (var(--depth) + 1) + var(--initial-padding)\n );\n }\n `;\n});\n\nStyledStandardTreeItemSubTree.defaultProps = defaultThemeProp;\n\nexport const StyledNodeInteraction = styled.div(({ theme }) => {\n return css`\n color: ${theme.base.palette['foreground-color']};\n text-decoration: none;\n min-height: 2.25rem;\n padding-inline-start: calc(var(--parent-caret-width) * var(--depth) + var(--initial-padding));\n padding-inline-end: calc(var(--initial-padding) + ${theme.base.spacing});\n cursor: pointer;\n\n & > ${StyledNodeActions} {\n display: none;\n ${StyledButton} {\n margin-inline-start: calc(${theme.base.spacing} / 2);\n }\n }\n\n &:focus,\n &:focus-within {\n box-shadow: ${theme.base.shadow.focus};\n\n & > ${StyledNodeActions} {\n display: block;\n }\n }\n\n &:focus-visible {\n outline: none;\n }\n\n &:hover {\n background-color: ${transparentize(0.9, theme.base.palette['foreground-color'])};\n\n & > ${StyledNodeActions} {\n display: block;\n }\n }\n\n &[aria-current='page'],\n &[aria-current='true'] {\n background-color: ${transparentize(0.95, theme.base.palette['foreground-color'])};\n\n & > ${StyledLabelContent}, & > :first-child > ${StyledLabelContent} {\n color: ${theme.base.palette.interactive};\n }\n }\n `;\n});\n\nStyledNodeInteraction.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeLeaf = styled.div(() => {\n return css`\n ${StyledNodeInteraction} {\n padding-inline-start: calc(\n var(--initial-padding) + (var(--parent-caret-width) * var(--depth)) +\n (var(--parent-caret-spacing-width) * (max(var(--has-parent-sibling), var(--has-parent))))\n );\n }\n `;\n});\n\nStyledStandardTreeLeaf.defaultProps = defaultThemeProp;\n\n// FIXME: any is used since typeof StyledNodeInteraction not playing nicely.\nexport const StyledStandardTreeParent: any = styled(StyledNodeInteraction)(({ theme }) => {\n const { ltr } = useDirection();\n\n return css`\n &[aria-expanded='true'] ${StyledToggleIcon} {\n transform: rotate(90deg);\n }\n\n &[aria-expanded='false'] {\n ${StyledToggleIcon} {\n transform: rotate(${ltr ? '0' : '180'}deg);\n }\n\n + ${StyledStandardTreeItemSubTree} {\n display: none;\n }\n }\n\n &:hover + ${StyledStandardTreeItemSubTree}::before {\n opacity: 0.5;\n }\n\n ${StyledToggleIcon} {\n transition: transform calc(${theme.base.animation.speed} / 2)\n ${theme.base.animation.timing.ease};\n }\n `;\n});\n\nStyledStandardTreeParent.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeNode = styled.div(\n ({ theme }) => css`\n --initial-padding: calc(${theme.base.spacing} * 0.5);\n --parent-caret-width: 1em;\n --parent-caret-spacing-width: max(\n (var(--parent-caret-width) + (2 * ${theme.components.button['border-width']})),\n ${theme.base['hit-area'].compact}\n );\n\n ${StyledIcon} {\n width: var(--parent-caret-width);\n height: var(--parent-caret-width);\n }\n `\n);\n\nStyledStandardTreeNode.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTree = styled(Tree)(({ theme }) => {\n return css`\n ${StyledTreeListItem} {\n display: block;\n }\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n});\n\nStyledStandardTree.defaultProps = defaultThemeProp;\n\n// FIXME: We need to determine why styled-component types are \"eating\" our types.\n(StyledStandardTree as typeof Tree & { defaultProps: object }).defaultProps = defaultThemeProp;\n"]}
@@ -2,19 +2,46 @@ import type { MouseEvent, KeyboardEvent } from 'react';
2
2
  import type { Action, PropsWithDefaults } from '../../types';
3
3
  import type { TreeProps, TreeNode } from './Tree';
4
4
  export interface StandardTreeNode extends TreeNode {
5
+ /** A set of nested tree nodes. */
5
6
  nodes?: StandardTreeNode[];
7
+ /** The display text of the tree node. */
6
8
  label: string;
9
+ /** The name of the Cosmos Icon to render as a visual, next to the label. */
7
10
  icon?: string;
11
+ /**
12
+ * If true, the node's children will be displayed.
13
+ * @default false
14
+ */
8
15
  expanded?: boolean;
16
+ /**
17
+ * If true, the node will render a loading indicator in place of any children.
18
+ * @default false
19
+ */
9
20
  loading?: boolean;
21
+ /** A set of actions attached to the node. */
10
22
  actions?: Action[];
23
+ /** Click handler for the tree node. */
11
24
  onClick?: (id: TreeNode['id'], e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
25
+ /** URL or DOM id to navigate to. This will render the tree node as a link. */
26
+ href?: string;
12
27
  }
13
28
  export interface StandardTreeProps extends TreeProps<StandardTreeNode> {
29
+ /** The id of the currently active tree node. */
14
30
  currentNodeId?: TreeNode['id'];
31
+ /**
32
+ * If true, a vertical line will render alongside nested nodes.
33
+ * @default false
34
+ */
15
35
  lined?: boolean;
36
+ /** Callback function for click events on tree nodes. This will only be called on parent nodes if selectableParents is true. It will always be called on leaf nodes. */
16
37
  onNodeClick?: (id: TreeNode['id'], e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
38
+ /** Callback function for toggling tree nodes between expanded/collapsed states. This is only ever called on parent nodes. */
17
39
  onNodeToggle?: (id: TreeNode['id'], e?: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
40
+ /**
41
+ * If true, parent tree nodes can be selected independently from being toggled expanded/collapsed.
42
+ * @default true
43
+ */
44
+ selectableParents?: boolean;
18
45
  }
19
46
  export interface StandardTreeContextProps extends StandardTreeProps {
20
47
  firstNodeId?: TreeNode['id'];
@@ -22,5 +49,5 @@ export interface StandardTreeContextProps extends StandardTreeProps {
22
49
  focusedNodeId?: TreeNode['id'];
23
50
  changeFocusedNodeId: (id: TreeNode['id'], type?: 'up' | 'down' | 'left' | 'right') => void;
24
51
  }
25
- export declare type StandardTreePropsWithDefaults = PropsWithDefaults<StandardTreeContextProps, 'lined'>;
52
+ export type StandardTreePropsWithDefaults = PropsWithDefaults<StandardTreeContextProps, 'lined'>;
26
53
  //# sourceMappingURL=StandardTree.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StandardTree.types.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElD,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACjG;AAED,MAAM,WAAW,iBAAkB,SAAQ,SAAS,CAAC,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AAC,IAAI,CAAC,CAAC;IAC5B,aAAa,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/B,mBAAmB,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC5F;AAED,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"StandardTree.types.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, KeyboardEvent } from 'react';\n\nimport type { Action, PropsWithDefaults } from '../../types';\n\nimport type { TreeProps, TreeNode } from './Tree';\n\nexport interface StandardTreeNode extends TreeNode {\n nodes?: StandardTreeNode[];\n label: string;\n icon?: string;\n expanded?: boolean;\n loading?: boolean;\n actions?: Action[];\n onClick?: (id: TreeNode['id'], e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n}\n\nexport interface StandardTreeProps extends TreeProps<StandardTreeNode> {\n currentNodeId?: TreeNode['id'];\n lined?: boolean;\n onNodeClick?: (\n id: TreeNode['id'],\n e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>\n ) => void;\n onNodeToggle?: (\n id: TreeNode['id'],\n e?: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>\n ) => void;\n}\n\nexport interface StandardTreeContextProps extends StandardTreeProps {\n firstNodeId?: TreeNode['id'];\n lastNodeId?: TreeNode['id'];\n focusedNodeId?: TreeNode['id'];\n changeFocusedNodeId: (id: TreeNode['id'], type?: 'up' | 'down' | 'left' | 'right') => void;\n}\n\nexport type StandardTreePropsWithDefaults = PropsWithDefaults<StandardTreeContextProps, 'lined'>;\n"]}
1
+ {"version":3,"file":"StandardTree.types.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, KeyboardEvent } from 'react';\n\nimport type { Action, PropsWithDefaults } from '../../types';\n\nimport type { TreeProps, TreeNode } from './Tree';\n\nexport interface StandardTreeNode extends TreeNode {\n /** A set of nested tree nodes. */\n nodes?: StandardTreeNode[];\n /** The display text of the tree node. */\n label: string;\n /** The name of the Cosmos Icon to render as a visual, next to the label. */\n icon?: string;\n /**\n * If true, the node's children will be displayed.\n * @default false\n */\n expanded?: boolean;\n /**\n * If true, the node will render a loading indicator in place of any children.\n * @default false\n */\n loading?: boolean;\n /** A set of actions attached to the node. */\n actions?: Action[];\n /** Click handler for the tree node. */\n onClick?: (id: TreeNode['id'], e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n /** URL or DOM id to navigate to. This will render the tree node as a link. */\n href?: string;\n}\n\nexport interface StandardTreeProps extends TreeProps<StandardTreeNode> {\n /** The id of the currently active tree node. */\n currentNodeId?: TreeNode['id'];\n /**\n * If true, a vertical line will render alongside nested nodes.\n * @default false\n */\n lined?: boolean;\n /** Callback function for click events on tree nodes. This will only be called on parent nodes if selectableParents is true. It will always be called on leaf nodes. */\n onNodeClick?: (\n id: TreeNode['id'],\n e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>\n ) => void;\n /** Callback function for toggling tree nodes between expanded/collapsed states. This is only ever called on parent nodes. */\n onNodeToggle?: (\n id: TreeNode['id'],\n e?: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>\n ) => void;\n /**\n * If true, parent tree nodes can be selected independently from being toggled expanded/collapsed.\n * @default true\n */\n selectableParents?: boolean;\n}\n\nexport interface StandardTreeContextProps extends StandardTreeProps {\n firstNodeId?: TreeNode['id'];\n lastNodeId?: TreeNode['id'];\n focusedNodeId?: TreeNode['id'];\n changeFocusedNodeId: (id: TreeNode['id'], type?: 'up' | 'down' | 'left' | 'right') => void;\n}\n\nexport type StandardTreePropsWithDefaults = PropsWithDefaults<StandardTreeContextProps, 'lined'>;\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Ref, ComponentType, ReactNode } from 'react';
2
2
  import { BaseProps, NoChildrenProp, ForwardProps } from '../../types';
3
- export declare type OldTreeNode<T extends object = Record<string, unknown>> = {
3
+ export type OldTreeNode<T extends object = Record<string, unknown>> = {
4
4
  /** The id of the Node. Used as the key for the li element wrapping the Node. */
5
5
  id: string;
6
6
  /** Child nodes. */
@@ -9,7 +9,7 @@ export declare type OldTreeNode<T extends object = Record<string, unknown>> = {
9
9
  listItemProps?: ForwardProps;
10
10
  [key: string]: unknown;
11
11
  } & T;
12
- export declare type TreeNode = {
12
+ export type TreeNode = {
13
13
  /** The id of the Node. Used as the key for the li element wrapping the Node. */
14
14
  id: string;
15
15
  /** Child nodes. */
@@ -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,MAAM,aAAa,CAAC;AAEtE,oBAAY,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACpE,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,KAAK,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IACzB,gCAAgC;IAChC,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,GAAG,CAAC,CAAC;AAEN,oBAAY,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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
3
3
  getNode<T extends TreeNode = TreeNode>(nodes: T[], id: T["id"]): T | undefined;
4
4
  getParentNode<T_1 extends TreeNode = TreeNode>(nodes: T_1[], id: T_1["id"]): T_1 | undefined;
5
5
  mapTree<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(nodes: T1[], fn: (node: T1, index: number, nodes: T1[]) => T2): T2[];
6
+ forEachNode<T_2 extends TreeNode = TreeNode>(nodes: T_2[], fn: (node: T_2, index: number, nodes: T_2[]) => void): void;
6
7
  mapNode<T1_1 extends TreeNode = TreeNode, T2_1 extends TreeNode = T1_1>(nodes: T1_1[], id: T1_1["id"], fn: (node: T1_1, index: number, array: T1_1[]) => T2_1): (T1_1 | T2_1)[];
7
- flatten<T_2 extends TreeNode = TreeNode>(nodes: T_2[], ancestors?: T_2[] | undefined): (T_2 & {
8
- ancestors?: T_2[] | undefined;
8
+ flatten<T_3 extends TreeNode = TreeNode>(nodes: T_3[], ancestors?: T_3[] | undefined): (T_3 & {
9
+ ancestors?: T_3[] | undefined;
9
10
  })[];
10
- appendTo<T_3 extends TreeNode = TreeNode>(nodes: T_3[], id: T_3["id"], newNodes: T_3[]): T_3[];
11
- expandTo<T_4 extends TreeNode = TreeNode>(nodes: T_4[], id: T_4["id"]): T_4[];
12
- getFirstChildNode<T_5 extends TreeNode = TreeNode>(nodes: T_5[], id: T_5["id"]): T_5 | undefined;
13
- getAdjacentNode<T_6 extends TreeNode = TreeNode>(nodes: T_6[], id: T_6["id"]): T_6 | undefined;
14
- getNextNode<T_7 extends TreeNode = TreeNode>(nodes: T_7[], id: T_7["id"]): T_7 | undefined;
15
- getDeepestNode<T_8 extends TreeNode = TreeNode>(nodes: T_8[], id: T_8["id"]): T_8 | undefined;
16
- getPreviousNode<T_9 extends TreeNode = TreeNode>(nodes: T_9[], id: T_9["id"]): T_9 | undefined;
11
+ getAncestors<T_4 extends TreeNode = TreeNode>(nodes: T_4[], id: T_4["id"], ancestors?: T_4[]): T_4[];
12
+ appendTo<T_5 extends TreeNode = TreeNode>(nodes: T_5[], id: T_5["id"], newNodes: T_5[]): T_5[];
13
+ expandTo<T_6 extends TreeNode = TreeNode>(nodes: T_6[], id: T_6["id"], collapseOthers?: boolean): T_6[];
14
+ getFirstChildNode<T_7 extends TreeNode = TreeNode>(nodes: T_7[], id: T_7["id"]): T_7 | undefined;
15
+ getAdjacentNode<T_8 extends TreeNode = TreeNode>(nodes: T_8[], id: T_8["id"]): T_8 | undefined;
16
+ getNextNode<T_9 extends TreeNode = TreeNode>(nodes: T_9[], id: T_9["id"]): T_9 | undefined;
17
+ getDeepestNode<T_10 extends TreeNode = TreeNode>(nodes: T_10[], id: T_10["id"]): T_10 | undefined;
18
+ getPreviousNode<T_11 extends TreeNode = TreeNode>(nodes: T_11[], id: T_11["id"]): T_11 | undefined;
17
19
  };
18
20
  export default helpers;
19
21
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,QAAA,MAAM,OAAO;;;yGA8Ca,MAAM;mIAmBN,MAAM;;;;;;;;;;;CA2I/B,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,QAAA,MAAM,OAAO;;;yGA8Ca,MAAM;sFAkBP,MAAM,mBAAiB,IAAI,GAC/C,IAAI;mIAaiB,MAAM;;;;;;;;;;;;CA4J/B,CAAC;AAEF,eAAe,OAAO,CAAC"}