@pega/cosmos-react-core 2.0.0-dev.9.2 → 2.0.0-rc.2

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 (810) hide show
  1. package/README.md +3 -3
  2. package/lib/components/Actions/Actions.js +1 -1
  3. package/lib/components/Actions/Actions.js.map +1 -1
  4. package/lib/components/AppShell/AppHeader.d.ts +2 -1
  5. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  6. package/lib/components/AppShell/AppHeader.js +4 -9
  7. package/lib/components/AppShell/AppHeader.js.map +1 -1
  8. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppShell.js +89 -62
  10. package/lib/components/AppShell/AppShell.js.map +1 -1
  11. package/lib/components/AppShell/AppShell.styles.d.ts +19 -16
  12. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppShell.styles.js +227 -173
  14. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  15. package/lib/components/AppShell/AppShell.types.d.ts +7 -7
  16. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  17. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  18. package/lib/components/AppShell/AppShellContext.d.ts +3 -0
  19. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  20. package/lib/components/AppShell/AppShellContext.js +3 -1
  21. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  22. package/lib/components/AppShell/AppShellList.d.ts +4 -3
  23. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  24. package/lib/components/AppShell/AppShellList.js +24 -19
  25. package/lib/components/AppShell/AppShellList.js.map +1 -1
  26. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  27. package/lib/components/AppShell/Drawer.js +7 -8
  28. package/lib/components/AppShell/Drawer.js.map +1 -1
  29. package/lib/components/AppShell/Operator.js +3 -5
  30. package/lib/components/AppShell/Operator.js.map +1 -1
  31. package/lib/components/AppShell/SkipNavigation.d.ts.map +1 -1
  32. package/lib/components/AppShell/SkipNavigation.js +30 -39
  33. package/lib/components/AppShell/SkipNavigation.js.map +1 -1
  34. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  35. package/lib/components/Avatar/Avatar.js +5 -4
  36. package/lib/components/Avatar/Avatar.js.map +1 -1
  37. package/lib/components/Backdrop/Backdrop.d.ts +1 -1
  38. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  39. package/lib/components/Backdrop/Backdrop.js +7 -6
  40. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  41. package/lib/components/Badges/Alert.d.ts +2 -2
  42. package/lib/components/Badges/Alert.d.ts.map +1 -1
  43. package/lib/components/Badges/Alert.js +1 -1
  44. package/lib/components/Badges/Alert.js.map +1 -1
  45. package/lib/components/Badges/Count.js +1 -1
  46. package/lib/components/Badges/Count.js.map +1 -1
  47. package/lib/components/Badges/Selection.d.ts.map +1 -1
  48. package/lib/components/Badges/Selection.js +10 -9
  49. package/lib/components/Badges/Selection.js.map +1 -1
  50. package/lib/components/Badges/Status.d.ts +2 -2
  51. package/lib/components/Badges/Status.d.ts.map +1 -1
  52. package/lib/components/Badges/Status.js +1 -1
  53. package/lib/components/Badges/Status.js.map +1 -1
  54. package/lib/components/Badges/Tag.js +1 -1
  55. package/lib/components/Badges/Tag.js.map +1 -1
  56. package/lib/components/Banner/Banner.d.ts +2 -2
  57. package/lib/components/Banner/Banner.d.ts.map +1 -1
  58. package/lib/components/Banner/Banner.js +6 -8
  59. package/lib/components/Banner/Banner.js.map +1 -1
  60. package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
  61. package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
  62. package/lib/components/Boolean/BooleanDisplay.js +1 -2
  63. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  64. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
  65. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  66. package/lib/components/Breadcrumbs/Breadcrumbs.js +13 -11
  67. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  68. package/lib/components/Button/BareButton.d.ts.map +1 -1
  69. package/lib/components/Button/BareButton.js +21 -2
  70. package/lib/components/Button/BareButton.js.map +1 -1
  71. package/lib/components/Button/BareRoleButton.d.ts +12 -0
  72. package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
  73. package/lib/components/Button/BareRoleButton.js +20 -0
  74. package/lib/components/Button/BareRoleButton.js.map +1 -0
  75. package/lib/components/Button/Button.d.ts +5 -0
  76. package/lib/components/Button/Button.d.ts.map +1 -1
  77. package/lib/components/Button/Button.js +34 -10
  78. package/lib/components/Button/Button.js.map +1 -1
  79. package/lib/components/Card/Card.d.ts.map +1 -1
  80. package/lib/components/Card/Card.js +3 -2
  81. package/lib/components/Card/Card.js.map +1 -1
  82. package/lib/components/Card/CardContent.d.ts.map +1 -1
  83. package/lib/components/Card/CardContent.js +5 -4
  84. package/lib/components/Card/CardContent.js.map +1 -1
  85. package/lib/components/Card/CardFooter.d.ts.map +1 -1
  86. package/lib/components/Card/CardFooter.js +5 -4
  87. package/lib/components/Card/CardFooter.js.map +1 -1
  88. package/lib/components/Card/CardHeader.d.ts +3 -1
  89. package/lib/components/Card/CardHeader.d.ts.map +1 -1
  90. package/lib/components/Card/CardHeader.js +9 -7
  91. package/lib/components/Card/CardHeader.js.map +1 -1
  92. package/lib/components/Card/CardMedia.js +1 -1
  93. package/lib/components/Card/CardMedia.js.map +1 -1
  94. package/lib/components/Card/CollapsibleCard.d.ts.map +1 -1
  95. package/lib/components/Card/CollapsibleCard.js +5 -7
  96. package/lib/components/Card/CollapsibleCard.js.map +1 -1
  97. package/lib/components/Card/SelectableCard.js +1 -1
  98. package/lib/components/Card/SelectableCard.js.map +1 -1
  99. package/lib/components/Checkbox/Checkbox.d.ts +2 -2
  100. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  101. package/lib/components/Checkbox/Checkbox.js +1 -1
  102. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  103. package/lib/components/ColorPicker/ColorPicker.d.ts +2 -2
  104. package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  105. package/lib/components/ColorPicker/ColorPicker.js +8 -11
  106. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  107. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  108. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  109. package/lib/components/ComboBox/ComboBox.js +30 -33
  110. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  111. package/lib/components/ComboBox/ComboBox.types.d.ts +2 -1
  112. package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
  113. package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
  114. package/lib/components/ComboBox/ComboBoxInput.js +4 -4
  115. package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
  116. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  117. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +23 -29
  118. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  119. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
  120. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +16 -12
  121. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
  122. package/lib/components/Configuration/Configuration.js +11 -13
  123. package/lib/components/Configuration/Configuration.js.map +1 -1
  124. package/lib/components/Currency/CurrencyDisplay.d.ts +6 -2
  125. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  126. package/lib/components/Currency/CurrencyDisplay.js +11 -7
  127. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  128. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  129. package/lib/components/Currency/CurrencyInput.js +16 -16
  130. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  131. package/lib/components/Currency/CurrencyInput.types.d.ts +6 -2
  132. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  133. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  134. package/lib/components/Currency/utils.d.ts +12 -1
  135. package/lib/components/Currency/utils.d.ts.map +1 -1
  136. package/lib/components/Currency/utils.js +30 -2
  137. package/lib/components/Currency/utils.js.map +1 -1
  138. package/lib/components/DateTime/DateTime.types.d.ts +2 -1
  139. package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
  140. package/lib/components/DateTime/DateTime.types.js.map +1 -1
  141. package/lib/components/DateTime/DateTimeDisplay.d.ts +1 -1
  142. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  143. package/lib/components/DateTime/DateTimeDisplay.js +14 -3
  144. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  145. package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
  146. package/lib/components/DateTime/DurationDisplay.js +11 -6
  147. package/lib/components/DateTime/DurationDisplay.js.map +1 -1
  148. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  149. package/lib/components/DateTime/Input/DateInput.js +25 -27
  150. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  151. package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
  152. package/lib/components/DateTime/Input/DateRangeInput.js +10 -16
  153. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  154. package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
  155. package/lib/components/DateTime/Input/DateTime.styles.js +14 -3
  156. package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
  157. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  158. package/lib/components/DateTime/Input/DateTimeInput.js +42 -42
  159. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  160. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +2 -0
  161. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
  162. package/lib/components/DateTime/Input/DayOfWeekInput.js +7 -5
  163. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  164. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
  165. package/lib/components/DateTime/Input/Duration/DurationInput.js +3 -3
  166. package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
  167. package/lib/components/DateTime/Input/Duration/NumberUnit.js +4 -5
  168. package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
  169. package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
  170. package/lib/components/DateTime/Input/Duration/Time.js +12 -15
  171. package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
  172. package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
  173. package/lib/components/DateTime/Input/MonthInput.js +12 -17
  174. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  175. package/lib/components/DateTime/Input/PartInput.js +3 -4
  176. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  177. package/lib/components/DateTime/Input/QuarterInput.d.ts +9 -0
  178. package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -0
  179. package/lib/components/DateTime/Input/QuarterInput.js +102 -0
  180. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -0
  181. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  182. package/lib/components/DateTime/Input/TimeInput.js +26 -30
  183. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  184. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  185. package/lib/components/DateTime/Input/WeekInput.js +22 -23
  186. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  187. package/lib/components/DateTime/Input/useAutoFocusNextInput.d.ts.map +1 -1
  188. package/lib/components/DateTime/Input/useAutoFocusNextInput.js +8 -9
  189. package/lib/components/DateTime/Input/useAutoFocusNextInput.js.map +1 -1
  190. package/lib/components/DateTime/Input/usePickerButton.js +4 -4
  191. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  192. package/lib/components/DateTime/Input/utils.d.ts +7 -0
  193. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  194. package/lib/components/DateTime/Input/utils.js +52 -10
  195. package/lib/components/DateTime/Input/utils.js.map +1 -1
  196. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  197. package/lib/components/DateTime/Picker/Calendar.js +47 -72
  198. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  199. package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -2
  200. package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
  201. package/lib/components/DateTime/Picker/Calendar.styles.js +16 -7
  202. package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
  203. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  204. package/lib/components/DateTime/Picker/DatePicker.js +13 -17
  205. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  206. package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
  207. package/lib/components/DateTime/Picker/DateRangePicker.js +13 -17
  208. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  209. package/lib/components/DateTime/Picker/TimePicker.js +9 -10
  210. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  211. package/lib/components/DateTime/Picker/Weeks.js +9 -11
  212. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  213. package/lib/components/DateTime/Picker/utils.d.ts +1 -0
  214. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  215. package/lib/components/DateTime/Picker/utils.js +3 -0
  216. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  217. package/lib/components/DateTime/index.d.ts +2 -0
  218. package/lib/components/DateTime/index.d.ts.map +1 -1
  219. package/lib/components/DateTime/index.js +1 -0
  220. package/lib/components/DateTime/index.js.map +1 -1
  221. package/lib/components/Drawer/Drawer.js +6 -6
  222. package/lib/components/Drawer/Drawer.js.map +1 -1
  223. package/lib/components/Email/EmailDisplay.d.ts +2 -2
  224. package/lib/components/Email/EmailDisplay.d.ts.map +1 -1
  225. package/lib/components/Email/EmailDisplay.js +2 -2
  226. package/lib/components/Email/EmailDisplay.js.map +1 -1
  227. package/lib/components/EmojiPicker/EmojiDisplay.d.ts.map +1 -1
  228. package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
  229. package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
  230. package/lib/components/EmojiPicker/EmojiPicker.js +3 -4
  231. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  232. package/lib/components/EmptyState/EmptyState.d.ts +14 -0
  233. package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
  234. package/lib/components/{NoItems/NoItems.js → EmptyState/EmptyState.js} +11 -8
  235. package/lib/components/EmptyState/EmptyState.js.map +1 -0
  236. package/lib/components/EmptyState/index.d.ts +4 -0
  237. package/lib/components/EmptyState/index.d.ts.map +1 -0
  238. package/lib/components/EmptyState/index.js +3 -0
  239. package/lib/components/EmptyState/index.js.map +1 -0
  240. package/lib/components/ErrorState/ErrorState.d.ts +16 -0
  241. package/lib/components/ErrorState/ErrorState.d.ts.map +1 -0
  242. package/lib/components/ErrorState/ErrorState.js +31 -0
  243. package/lib/components/ErrorState/ErrorState.js.map +1 -0
  244. package/lib/components/ErrorState/index.d.ts +4 -0
  245. package/lib/components/ErrorState/index.d.ts.map +1 -0
  246. package/lib/components/ErrorState/index.js +3 -0
  247. package/lib/components/ErrorState/index.js.map +1 -0
  248. package/lib/components/ExpandCollapse/ExpandCollapse.js +5 -5
  249. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  250. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  251. package/lib/components/FieldGroup/FieldGroup.js +6 -7
  252. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  253. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  254. package/lib/components/FieldGroup/FieldGroupList.js +7 -6
  255. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  256. package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
  257. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  258. package/lib/components/FieldValueList/FieldValueList.js +5 -7
  259. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  260. package/lib/components/File/FileDisplay.d.ts +6 -3
  261. package/lib/components/File/FileDisplay.d.ts.map +1 -1
  262. package/lib/components/File/FileDisplay.js +7 -7
  263. package/lib/components/File/FileDisplay.js.map +1 -1
  264. package/lib/components/File/FileInput.d.ts +3 -3
  265. package/lib/components/File/FileInput.d.ts.map +1 -1
  266. package/lib/components/File/FileInput.js +18 -19
  267. package/lib/components/File/FileInput.js.map +1 -1
  268. package/lib/components/File/FileItem.d.ts +0 -2
  269. package/lib/components/File/FileItem.d.ts.map +1 -1
  270. package/lib/components/File/FileItem.js +3 -4
  271. package/lib/components/File/FileItem.js.map +1 -1
  272. package/lib/components/File/FileUploadItem.d.ts +4 -2
  273. package/lib/components/File/FileUploadItem.d.ts.map +1 -1
  274. package/lib/components/File/FileUploadItem.js +58 -20
  275. package/lib/components/File/FileUploadItem.js.map +1 -1
  276. package/lib/components/File/FileVisual.d.ts +7 -16
  277. package/lib/components/File/FileVisual.d.ts.map +1 -1
  278. package/lib/components/File/FileVisual.js +44 -47
  279. package/lib/components/File/FileVisual.js.map +1 -1
  280. package/lib/components/File/utils.js +2 -3
  281. package/lib/components/File/utils.js.map +1 -1
  282. package/lib/components/Flex/Flex.d.ts +17 -7
  283. package/lib/components/Flex/Flex.d.ts.map +1 -1
  284. package/lib/components/Flex/Flex.js +25 -9
  285. package/lib/components/Flex/Flex.js.map +1 -1
  286. package/lib/components/Form/Form.d.ts +7 -1
  287. package/lib/components/Form/Form.d.ts.map +1 -1
  288. package/lib/components/Form/Form.js +5 -4
  289. package/lib/components/Form/Form.js.map +1 -1
  290. package/lib/components/FormControl/FormControl.d.ts +1 -1
  291. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  292. package/lib/components/FormControl/FormControl.js +1 -1
  293. package/lib/components/FormControl/FormControl.js.map +1 -1
  294. package/lib/components/FormField/FormField.d.ts +5 -7
  295. package/lib/components/FormField/FormField.d.ts.map +1 -1
  296. package/lib/components/FormField/FormField.js +9 -19
  297. package/lib/components/FormField/FormField.js.map +1 -1
  298. package/lib/components/Grid/Grid.d.ts +1 -1
  299. package/lib/components/Grid/Grid.d.ts.map +1 -1
  300. package/lib/components/Grid/Grid.js +17 -21
  301. package/lib/components/Grid/Grid.js.map +1 -1
  302. package/lib/components/Icon/Icon.js +3 -5
  303. package/lib/components/Icon/Icon.js.map +1 -1
  304. package/lib/components/Icon/iconNames.d.ts +1 -1
  305. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  306. package/lib/components/Icon/iconNames.js +2 -0
  307. package/lib/components/Icon/iconNames.js.map +1 -1
  308. package/lib/components/Icon/icons/compass-solid.icon.js +1 -2
  309. package/lib/components/Icon/icons/compass-solid.icon.js.map +1 -1
  310. package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js +1 -4
  311. package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js.map +1 -1
  312. package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js +1 -2
  313. package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js.map +1 -1
  314. package/lib/components/Icon/icons/dataviz-waterfall.icon.js +1 -5
  315. package/lib/components/Icon/icons/dataviz-waterfall.icon.js.map +1 -1
  316. package/lib/components/Icon/icons/dock.icon.d.ts +4 -0
  317. package/lib/components/Icon/icons/dock.icon.d.ts.map +1 -0
  318. package/lib/components/Icon/icons/dock.icon.js +6 -0
  319. package/lib/components/Icon/icons/dock.icon.js.map +1 -0
  320. package/lib/components/Icon/icons/filetype-text.icon.js +1 -4
  321. package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
  322. package/lib/components/Icon/icons/folder-dollar.icon.js +1 -2
  323. package/lib/components/Icon/icons/folder-dollar.icon.js.map +1 -1
  324. package/lib/components/Icon/icons/freeze-column.icon.js +1 -2
  325. package/lib/components/Icon/icons/freeze-column.icon.js.map +1 -1
  326. package/lib/components/Icon/icons/galaxy.icon.js +1 -3
  327. package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
  328. package/lib/components/Icon/icons/grad-solid.icon.js +1 -2
  329. package/lib/components/Icon/icons/grad-solid.icon.js.map +1 -1
  330. package/lib/components/Icon/icons/grad.icon.js +1 -5
  331. package/lib/components/Icon/icons/grad.icon.js.map +1 -1
  332. package/lib/components/Icon/icons/list-number.icon.js +1 -6
  333. package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
  334. package/lib/components/Icon/icons/list.icon.js +1 -6
  335. package/lib/components/Icon/icons/list.icon.js.map +1 -1
  336. package/lib/components/Icon/icons/pin.icon.js +1 -2
  337. package/lib/components/Icon/icons/pin.icon.js.map +1 -1
  338. package/lib/components/Icon/icons/search-solid.icon.js +1 -2
  339. package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
  340. package/lib/components/Icon/icons/tracer.icon.js +1 -2
  341. package/lib/components/Icon/icons/tracer.icon.js.map +1 -1
  342. package/lib/components/Icon/icons/tribox-solid.icon.js +1 -3
  343. package/lib/components/Icon/icons/tribox-solid.icon.js.map +1 -1
  344. package/lib/components/Icon/icons/tribox.icon.js +1 -3
  345. package/lib/components/Icon/icons/tribox.icon.js.map +1 -1
  346. package/lib/components/Icon/icons/undock.icon.d.ts +4 -0
  347. package/lib/components/Icon/icons/undock.icon.d.ts.map +1 -0
  348. package/lib/components/Icon/icons/undock.icon.js +6 -0
  349. package/lib/components/Icon/icons/undock.icon.js.map +1 -0
  350. package/lib/components/Image/Image.js +1 -1
  351. package/lib/components/Image/Image.js.map +1 -1
  352. package/lib/components/Image/index.d.ts +1 -1
  353. package/lib/components/Image/index.d.ts.map +1 -1
  354. package/lib/components/Image/index.js +1 -0
  355. package/lib/components/Image/index.js.map +1 -1
  356. package/lib/components/Input/Input.d.ts +2 -2
  357. package/lib/components/Input/Input.d.ts.map +1 -1
  358. package/lib/components/Input/Input.js +13 -13
  359. package/lib/components/Input/Input.js.map +1 -1
  360. package/lib/components/Input/Input.styles.js +2 -2
  361. package/lib/components/Input/Input.styles.js.map +1 -1
  362. package/lib/components/Label/Label.js +1 -1
  363. package/lib/components/Label/Label.js.map +1 -1
  364. package/lib/components/Lightbox/Lightbox.d.ts +6 -0
  365. package/lib/components/Lightbox/Lightbox.d.ts.map +1 -0
  366. package/lib/components/Lightbox/Lightbox.js +129 -0
  367. package/lib/components/Lightbox/Lightbox.js.map +1 -0
  368. package/lib/components/Lightbox/Lightbox.styles.d.ts +11 -0
  369. package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -0
  370. package/lib/components/Lightbox/Lightbox.styles.js +166 -0
  371. package/lib/components/Lightbox/Lightbox.styles.js.map +1 -0
  372. package/lib/components/Lightbox/Lightbox.types.d.ts +42 -0
  373. package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -0
  374. package/lib/components/Lightbox/Lightbox.types.js +2 -0
  375. package/lib/components/Lightbox/Lightbox.types.js.map +1 -0
  376. package/lib/components/Lightbox/index.d.ts +3 -0
  377. package/lib/components/Lightbox/index.d.ts.map +1 -0
  378. package/lib/components/Lightbox/index.js +2 -0
  379. package/lib/components/Lightbox/index.js.map +1 -0
  380. package/lib/components/Link/Link.js +5 -8
  381. package/lib/components/Link/Link.js.map +1 -1
  382. package/lib/components/List/CommaSeparatedList.d.ts +15 -0
  383. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -0
  384. package/lib/components/List/CommaSeparatedList.js +61 -0
  385. package/lib/components/List/CommaSeparatedList.js.map +1 -0
  386. package/lib/components/List/List.d.ts +30 -0
  387. package/lib/components/List/List.d.ts.map +1 -0
  388. package/lib/components/List/List.js +56 -0
  389. package/lib/components/List/List.js.map +1 -0
  390. package/lib/components/List/OrderedList.d.ts +6 -0
  391. package/lib/components/List/OrderedList.d.ts.map +1 -0
  392. package/lib/components/List/OrderedList.js +6 -0
  393. package/lib/components/List/OrderedList.js.map +1 -0
  394. package/lib/components/List/UnorderedList.d.ts +6 -0
  395. package/lib/components/List/UnorderedList.d.ts.map +1 -0
  396. package/lib/components/List/UnorderedList.js +6 -0
  397. package/lib/components/List/UnorderedList.js.map +1 -0
  398. package/lib/components/List/index.d.ts +5 -0
  399. package/lib/components/List/index.d.ts.map +1 -0
  400. package/lib/components/List/index.js +4 -0
  401. package/lib/components/List/index.js.map +1 -0
  402. package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
  403. package/lib/components/Location/CurrentLocationButton.js +7 -7
  404. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  405. package/lib/components/Location/Location.types.d.ts +2 -1
  406. package/lib/components/Location/Location.types.d.ts.map +1 -1
  407. package/lib/components/Location/Location.types.js.map +1 -1
  408. package/lib/components/Location/LocationDisplay.js +8 -9
  409. package/lib/components/Location/LocationDisplay.js.map +1 -1
  410. package/lib/components/Location/LocationInput.js +27 -28
  411. package/lib/components/Location/LocationInput.js.map +1 -1
  412. package/lib/components/Location/LocationView.js +8 -13
  413. package/lib/components/Location/LocationView.js.map +1 -1
  414. package/lib/components/Location/utils.js +11 -15
  415. package/lib/components/Location/utils.js.map +1 -1
  416. package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
  417. package/lib/components/Menu/FlyoutMenuList.js +12 -15
  418. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  419. package/lib/components/Menu/Menu.context.d.ts.map +1 -1
  420. package/lib/components/Menu/Menu.context.js +2 -0
  421. package/lib/components/Menu/Menu.context.js.map +1 -1
  422. package/lib/components/Menu/Menu.d.ts.map +1 -1
  423. package/lib/components/Menu/Menu.js +89 -46
  424. package/lib/components/Menu/Menu.js.map +1 -1
  425. package/lib/components/Menu/Menu.styles.d.ts +11 -0
  426. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  427. package/lib/components/Menu/Menu.styles.js +202 -3
  428. package/lib/components/Menu/Menu.styles.js.map +1 -1
  429. package/lib/components/Menu/Menu.types.d.ts +30 -12
  430. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  431. package/lib/components/Menu/Menu.types.js.map +1 -1
  432. package/lib/components/Menu/MenuGroup.d.ts +6 -0
  433. package/lib/components/Menu/MenuGroup.d.ts.map +1 -0
  434. package/lib/components/Menu/MenuGroup.js +17 -0
  435. package/lib/components/Menu/MenuGroup.js.map +1 -0
  436. package/lib/components/Menu/MenuItem.d.ts +0 -3
  437. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  438. package/lib/components/Menu/MenuItem.js +57 -164
  439. package/lib/components/Menu/MenuItem.js.map +1 -1
  440. package/lib/components/Menu/MenuList.d.ts +1 -1
  441. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  442. package/lib/components/Menu/MenuList.js +28 -30
  443. package/lib/components/Menu/MenuList.js.map +1 -1
  444. package/lib/components/Menu/MenuListHeader.d.ts +0 -1
  445. package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
  446. package/lib/components/Menu/MenuListHeader.js +7 -55
  447. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  448. package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
  449. package/lib/components/Menu/NavItemsList.js +2 -3
  450. package/lib/components/Menu/NavItemsList.js.map +1 -1
  451. package/lib/components/Menu/helpers.d.ts +13 -12
  452. package/lib/components/Menu/helpers.d.ts.map +1 -1
  453. package/lib/components/Menu/helpers.js +40 -36
  454. package/lib/components/Menu/helpers.js.map +1 -1
  455. package/lib/components/Menu/index.d.ts +2 -3
  456. package/lib/components/Menu/index.d.ts.map +1 -1
  457. package/lib/components/Menu/index.js +1 -2
  458. package/lib/components/Menu/index.js.map +1 -1
  459. package/lib/components/MenuButton/MenuButton.d.ts +3 -1
  460. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  461. package/lib/components/MenuButton/MenuButton.js +13 -14
  462. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  463. package/lib/components/MetaList/MetaList.d.ts +13 -4
  464. package/lib/components/MetaList/MetaList.d.ts.map +1 -1
  465. package/lib/components/MetaList/MetaList.js +34 -20
  466. package/lib/components/MetaList/MetaList.js.map +1 -1
  467. package/lib/components/Modal/Contexts.d.ts.map +1 -1
  468. package/lib/components/Modal/Contexts.js +3 -0
  469. package/lib/components/Modal/Contexts.js.map +1 -1
  470. package/lib/components/Modal/DockedModals.d.ts.map +1 -1
  471. package/lib/components/Modal/DockedModals.js +5 -4
  472. package/lib/components/Modal/DockedModals.js.map +1 -1
  473. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  474. package/lib/components/Modal/MinimizedModal.js +53 -38
  475. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  476. package/lib/components/Modal/Modal.d.ts +1 -6
  477. package/lib/components/Modal/Modal.d.ts.map +1 -1
  478. package/lib/components/Modal/Modal.js +82 -134
  479. package/lib/components/Modal/Modal.js.map +1 -1
  480. package/lib/components/Modal/Modal.styles.d.ts +9 -0
  481. package/lib/components/Modal/Modal.styles.d.ts.map +1 -0
  482. package/lib/components/Modal/Modal.styles.js +135 -0
  483. package/lib/components/Modal/Modal.styles.js.map +1 -0
  484. package/lib/components/Modal/Modal.types.d.ts +56 -5
  485. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  486. package/lib/components/Modal/Modal.types.js.map +1 -1
  487. package/lib/components/Modal/ModalManager.d.ts.map +1 -1
  488. package/lib/components/Modal/ModalManager.js +74 -65
  489. package/lib/components/Modal/ModalManager.js.map +1 -1
  490. package/lib/components/MultiStep/MultiStep.d.ts.map +1 -1
  491. package/lib/components/MultiStep/MultiStep.js +10 -12
  492. package/lib/components/MultiStep/MultiStep.js.map +1 -1
  493. package/lib/components/MultiStep/MultiStep.styles.js +1 -1
  494. package/lib/components/MultiStep/MultiStep.styles.js.map +1 -1
  495. package/lib/components/MultiStep/MultiStep.types.d.ts +4 -2
  496. package/lib/components/MultiStep/MultiStep.types.d.ts.map +1 -1
  497. package/lib/components/MultiStep/MultiStep.types.js.map +1 -1
  498. package/lib/components/Number/NumberDisplay.d.ts +2 -2
  499. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  500. package/lib/components/Number/NumberDisplay.js +1 -1
  501. package/lib/components/Number/NumberDisplay.js.map +1 -1
  502. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  503. package/lib/components/Number/NumberInput.js +18 -25
  504. package/lib/components/Number/NumberInput.js.map +1 -1
  505. package/lib/components/Number/NumberInput.styles.d.ts +2 -2
  506. package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
  507. package/lib/components/Number/NumberInput.types.d.ts +2 -2
  508. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  509. package/lib/components/Number/NumberInput.types.js.map +1 -1
  510. package/lib/components/Number/utils.js +2 -3
  511. package/lib/components/Number/utils.js.map +1 -1
  512. package/lib/components/PageTemplates/CategorySubPage.d.ts +1 -1
  513. package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
  514. package/lib/components/PageTemplates/CategorySubPage.js +8 -18
  515. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  516. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -1
  517. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  518. package/lib/components/PageTemplates/DashboardPage.d.ts +7 -1
  519. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  520. package/lib/components/PageTemplates/DashboardPage.js +48 -28
  521. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  522. package/lib/components/PageTemplates/PageTemplates.d.ts +15 -6
  523. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  524. package/lib/components/PageTemplates/PageTemplates.js +89 -79
  525. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  526. package/lib/components/PageTemplates/index.d.ts +3 -0
  527. package/lib/components/PageTemplates/index.d.ts.map +1 -1
  528. package/lib/components/PageTemplates/index.js +1 -0
  529. package/lib/components/PageTemplates/index.js.map +1 -1
  530. package/lib/components/Pagination/Pagination.d.ts +2 -2
  531. package/lib/components/Pagination/Pagination.d.ts.map +1 -1
  532. package/lib/components/Pagination/Pagination.js +7 -6
  533. package/lib/components/Pagination/Pagination.js.map +1 -1
  534. package/lib/components/Paragraph/ParagraphDisplay.d.ts +11 -0
  535. package/lib/components/Paragraph/ParagraphDisplay.d.ts.map +1 -0
  536. package/lib/components/Paragraph/ParagraphDisplay.js +11 -0
  537. package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -0
  538. package/lib/components/Paragraph/index.d.ts +3 -0
  539. package/lib/components/Paragraph/index.d.ts.map +1 -0
  540. package/lib/components/Paragraph/index.js +2 -0
  541. package/lib/components/Paragraph/index.js.map +1 -0
  542. package/lib/components/Phone/PhoneDisplay.d.ts +2 -2
  543. package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
  544. package/lib/components/Phone/PhoneDisplay.js +2 -3
  545. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  546. package/lib/components/Phone/PhoneInput.d.ts +2 -2
  547. package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
  548. package/lib/components/Phone/PhoneInput.js +18 -17
  549. package/lib/components/Phone/PhoneInput.js.map +1 -1
  550. package/lib/components/Phone/utils.js +2 -3
  551. package/lib/components/Phone/utils.js.map +1 -1
  552. package/lib/components/Popover/Popover.d.ts +0 -4
  553. package/lib/components/Popover/Popover.d.ts.map +1 -1
  554. package/lib/components/Popover/Popover.js +11 -122
  555. package/lib/components/Popover/Popover.js.map +1 -1
  556. package/lib/components/Popover/Popover.styles.d.ts +5 -0
  557. package/lib/components/Popover/Popover.styles.d.ts.map +1 -0
  558. package/lib/components/Popover/Popover.styles.js +116 -0
  559. package/lib/components/Popover/Popover.styles.js.map +1 -0
  560. package/lib/components/Popover/PopoverManager.js +2 -2
  561. package/lib/components/Popover/PopoverManager.js.map +1 -1
  562. package/lib/components/Popover/index.d.ts +1 -1
  563. package/lib/components/Popover/index.d.ts.map +1 -1
  564. package/lib/components/Popover/index.js +1 -1
  565. package/lib/components/Popover/index.js.map +1 -1
  566. package/lib/components/Progress/Bar.js +2 -2
  567. package/lib/components/Progress/Bar.js.map +1 -1
  568. package/lib/components/Progress/Ellipsis.d.ts +1 -1
  569. package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
  570. package/lib/components/Progress/Ellipsis.js +48 -50
  571. package/lib/components/Progress/Ellipsis.js.map +1 -1
  572. package/lib/components/Progress/Progress.js +3 -4
  573. package/lib/components/Progress/Progress.js.map +1 -1
  574. package/lib/components/Progress/Progress.types.d.ts +2 -2
  575. package/lib/components/Progress/Progress.types.d.ts.map +1 -1
  576. package/lib/components/Progress/Progress.types.js.map +1 -1
  577. package/lib/components/Progress/Ring.d.ts +1 -1
  578. package/lib/components/Progress/Ring.d.ts.map +1 -1
  579. package/lib/components/Progress/Ring.js +40 -40
  580. package/lib/components/Progress/Ring.js.map +1 -1
  581. package/lib/components/RadioButton/RadioButton.d.ts +2 -2
  582. package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
  583. package/lib/components/RadioButton/RadioButton.js +1 -1
  584. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  585. package/lib/components/RadioCheck/RadioCheck.d.ts +2 -2
  586. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  587. package/lib/components/RadioCheck/RadioCheck.js +7 -8
  588. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  589. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +4 -0
  590. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  591. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +19 -18
  592. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  593. package/lib/components/Rating/Rating.d.ts +2 -2
  594. package/lib/components/Rating/Rating.d.ts.map +1 -1
  595. package/lib/components/Rating/Rating.js +6 -7
  596. package/lib/components/Rating/Rating.js.map +1 -1
  597. package/lib/components/SearchInput/SearchInput.d.ts +4 -4
  598. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  599. package/lib/components/SearchInput/SearchInput.js +14 -14
  600. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  601. package/lib/components/Select/Option.js +1 -1
  602. package/lib/components/Select/Option.js.map +1 -1
  603. package/lib/components/Select/Select.d.ts.map +1 -1
  604. package/lib/components/Select/Select.js +15 -16
  605. package/lib/components/Select/Select.js.map +1 -1
  606. package/lib/components/Sentiment/Sentiment.d.ts +2 -2
  607. package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
  608. package/lib/components/Sentiment/Sentiment.js +1 -2
  609. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  610. package/lib/components/Skeleton/LineSkeleton.js +1 -1
  611. package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
  612. package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
  613. package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
  614. package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
  615. package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
  616. package/lib/components/Slider/Slider.d.ts.map +1 -1
  617. package/lib/components/Slider/Slider.js +12 -19
  618. package/lib/components/Slider/Slider.js.map +1 -1
  619. package/lib/components/Slider/Slider.styles.d.ts +4 -1
  620. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  621. package/lib/components/Slider/Slider.styles.js +17 -5
  622. package/lib/components/Slider/Slider.styles.js.map +1 -1
  623. package/lib/components/Slider/Slider.types.d.ts +2 -2
  624. package/lib/components/Slider/Slider.types.d.ts.map +1 -1
  625. package/lib/components/Slider/Slider.types.js.map +1 -1
  626. package/lib/components/Slider/SliderTicks.d.ts +1 -0
  627. package/lib/components/Slider/SliderTicks.d.ts.map +1 -1
  628. package/lib/components/Slider/SliderTicks.js +19 -12
  629. package/lib/components/Slider/SliderTicks.js.map +1 -1
  630. package/lib/components/Slider/utils.d.ts +10 -11
  631. package/lib/components/Slider/utils.d.ts.map +1 -1
  632. package/lib/components/Slider/utils.js +24 -18
  633. package/lib/components/Slider/utils.js.map +1 -1
  634. package/lib/components/SummaryItem/SummaryItem.d.ts +5 -5
  635. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  636. package/lib/components/SummaryItem/SummaryItem.js +3 -5
  637. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  638. package/lib/components/SummaryList/SummaryList.d.ts +8 -2
  639. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  640. package/lib/components/SummaryList/SummaryList.js +10 -11
  641. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  642. package/lib/components/SummaryList/ViewAll.d.ts +1 -1
  643. package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
  644. package/lib/components/SummaryList/ViewAll.js +14 -10
  645. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  646. package/lib/components/Switch/Switch.d.ts +2 -2
  647. package/lib/components/Switch/Switch.d.ts.map +1 -1
  648. package/lib/components/Switch/Switch.js +41 -30
  649. package/lib/components/Switch/Switch.js.map +1 -1
  650. package/lib/components/Table/Table.d.ts +2 -2
  651. package/lib/components/Table/Table.d.ts.map +1 -1
  652. package/lib/components/Table/Table.js +14 -13
  653. package/lib/components/Table/Table.js.map +1 -1
  654. package/lib/components/Tabs/Tab.d.ts +1 -1
  655. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  656. package/lib/components/Tabs/Tab.js +9 -7
  657. package/lib/components/Tabs/Tab.js.map +1 -1
  658. package/lib/components/Tabs/TabPanel.d.ts +10 -2
  659. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  660. package/lib/components/Tabs/TabPanel.js +24 -8
  661. package/lib/components/Tabs/TabPanel.js.map +1 -1
  662. package/lib/components/Tabs/Tabs.d.ts +1 -0
  663. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  664. package/lib/components/Tabs/Tabs.js +22 -18
  665. package/lib/components/Tabs/Tabs.js.map +1 -1
  666. package/lib/components/Tabs/Tabs.types.d.ts +2 -2
  667. package/lib/components/Tabs/Tabs.types.d.ts.map +1 -1
  668. package/lib/components/Tabs/Tabs.types.js.map +1 -1
  669. package/lib/components/Text/Text.d.ts +1 -1
  670. package/lib/components/Text/Text.d.ts.map +1 -1
  671. package/lib/components/Text/Text.js +2 -2
  672. package/lib/components/Text/Text.js.map +1 -1
  673. package/lib/components/TextArea/TextArea.d.ts +2 -2
  674. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  675. package/lib/components/TextArea/TextArea.js +31 -30
  676. package/lib/components/TextArea/TextArea.js.map +1 -1
  677. package/lib/components/Toaster/Toaster.d.ts +8 -36
  678. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  679. package/lib/components/Toaster/Toaster.js +97 -102
  680. package/lib/components/Toaster/Toaster.js.map +1 -1
  681. package/lib/components/Tooltip/Tooltip.d.ts +6 -1
  682. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  683. package/lib/components/Tooltip/Tooltip.js +6 -13
  684. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  685. package/lib/components/Tree/StandardTree.d.ts +6 -0
  686. package/lib/components/Tree/StandardTree.d.ts.map +1 -0
  687. package/lib/components/Tree/StandardTree.js +175 -0
  688. package/lib/components/Tree/StandardTree.js.map +1 -0
  689. package/lib/components/Tree/StandardTree.styles.d.ts +13 -0
  690. package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -0
  691. package/lib/components/Tree/StandardTree.styles.js +155 -0
  692. package/lib/components/Tree/StandardTree.styles.js.map +1 -0
  693. package/lib/components/Tree/StandardTree.types.d.ts +25 -0
  694. package/lib/components/Tree/StandardTree.types.d.ts.map +1 -0
  695. package/lib/components/Tree/StandardTree.types.js +2 -0
  696. package/lib/components/Tree/StandardTree.types.js.map +1 -0
  697. package/lib/components/Tree/Tree.d.ts +35 -49
  698. package/lib/components/Tree/Tree.d.ts.map +1 -1
  699. package/lib/components/Tree/Tree.js +18 -56
  700. package/lib/components/Tree/Tree.js.map +1 -1
  701. package/lib/components/Tree/helpers.d.ts +19 -0
  702. package/lib/components/Tree/helpers.d.ts.map +1 -0
  703. package/lib/components/Tree/helpers.js +180 -0
  704. package/lib/components/Tree/helpers.js.map +1 -0
  705. package/lib/components/Tree/index.d.ts +4 -2
  706. package/lib/components/Tree/index.d.ts.map +1 -1
  707. package/lib/components/Tree/index.js +3 -1
  708. package/lib/components/Tree/index.js.map +1 -1
  709. package/lib/components/URL/URLDisplay.d.ts +2 -2
  710. package/lib/components/URL/URLDisplay.d.ts.map +1 -1
  711. package/lib/components/URL/URLDisplay.js +2 -2
  712. package/lib/components/URL/URLDisplay.js.map +1 -1
  713. package/lib/hooks/index.d.ts +7 -4
  714. package/lib/hooks/index.d.ts.map +1 -1
  715. package/lib/hooks/index.js +7 -3
  716. package/lib/hooks/index.js.map +1 -1
  717. package/lib/hooks/useActiveDescendant.d.ts +17 -3
  718. package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
  719. package/lib/hooks/useActiveDescendant.js +86 -64
  720. package/lib/hooks/useActiveDescendant.js.map +1 -1
  721. package/lib/hooks/useAutoResize.d.ts.map +1 -1
  722. package/lib/hooks/useAutoResize.js +6 -7
  723. package/lib/hooks/useAutoResize.js.map +1 -1
  724. package/lib/hooks/useBreakpoint.js +2 -4
  725. package/lib/hooks/useBreakpoint.js.map +1 -1
  726. package/lib/hooks/useDraggable.d.ts +8 -0
  727. package/lib/hooks/useDraggable.d.ts.map +1 -0
  728. package/lib/hooks/useDraggable.js +64 -0
  729. package/lib/hooks/useDraggable.js.map +1 -0
  730. package/lib/hooks/useFocusWithin.d.ts +1 -1
  731. package/lib/hooks/useFocusWithin.d.ts.map +1 -1
  732. package/lib/hooks/useFocusWithin.js +29 -24
  733. package/lib/hooks/useFocusWithin.js.map +1 -1
  734. package/lib/hooks/useI18n.d.ts +505 -170
  735. package/lib/hooks/useI18n.d.ts.map +1 -1
  736. package/lib/hooks/useI18n.js +2 -2
  737. package/lib/hooks/useI18n.js.map +1 -1
  738. package/lib/hooks/useLongPress.d.ts +16 -0
  739. package/lib/hooks/useLongPress.d.ts.map +1 -0
  740. package/lib/hooks/useLongPress.js +59 -0
  741. package/lib/hooks/useLongPress.js.map +1 -0
  742. package/lib/hooks/useOuterEvent.js +1 -1
  743. package/lib/hooks/useOuterEvent.js.map +1 -1
  744. package/lib/hooks/useOverride.js +1 -1
  745. package/lib/hooks/useOverride.js.map +1 -1
  746. package/lib/hooks/useScrollStick.js +14 -3
  747. package/lib/hooks/useScrollStick.js.map +1 -1
  748. package/lib/hooks/useScrollToggle.d.ts +6 -0
  749. package/lib/hooks/useScrollToggle.d.ts.map +1 -0
  750. package/lib/hooks/useScrollToggle.js +40 -0
  751. package/lib/hooks/useScrollToggle.js.map +1 -0
  752. package/lib/hooks/useTransitionState.d.ts +39 -0
  753. package/lib/hooks/useTransitionState.d.ts.map +1 -0
  754. package/lib/hooks/useTransitionState.js +56 -0
  755. package/lib/hooks/useTransitionState.js.map +1 -0
  756. package/lib/i18n/default.d.ts +583 -0
  757. package/lib/i18n/default.d.ts.map +1 -0
  758. package/lib/i18n/default.js +627 -0
  759. package/lib/i18n/default.js.map +1 -0
  760. package/lib/i18n/i18n.d.ts +988 -318
  761. package/lib/i18n/i18n.d.ts.map +1 -1
  762. package/lib/i18n/i18n.js +1 -1
  763. package/lib/i18n/i18n.js.map +1 -1
  764. package/lib/i18n/index.d.ts +1 -0
  765. package/lib/i18n/index.d.ts.map +1 -1
  766. package/lib/i18n/index.js.map +1 -1
  767. package/lib/i18n/translate.d.ts +29 -4
  768. package/lib/i18n/translate.d.ts.map +1 -1
  769. package/lib/i18n/translate.js +21 -8
  770. package/lib/i18n/translate.js.map +1 -1
  771. package/lib/index.d.ts +8 -2
  772. package/lib/index.d.ts.map +1 -1
  773. package/lib/index.js +8 -2
  774. package/lib/index.js.map +1 -1
  775. package/lib/styles/GlobalStyle.d.ts.map +1 -1
  776. package/lib/styles/GlobalStyle.js +2 -26
  777. package/lib/styles/GlobalStyle.js.map +1 -1
  778. package/lib/theme/ThemeMachine.js +7 -1
  779. package/lib/theme/ThemeMachine.js.map +1 -1
  780. package/lib/theme/index.d.ts +1 -0
  781. package/lib/theme/index.d.ts.map +1 -1
  782. package/lib/theme/index.js +1 -0
  783. package/lib/theme/index.js.map +1 -1
  784. package/lib/theme/theme.d.ts +83 -53
  785. package/lib/theme/theme.d.ts.map +1 -1
  786. package/lib/theme/themeDefinition.json +50 -30
  787. package/lib/theme/themeOverrides.schema.json +24 -3
  788. package/lib/theme/themes/buildTheme.json +3 -39
  789. package/lib/theme/themes/darkTheme.json +6 -0
  790. package/lib/theme/themes/legacyBuildTheme.json +50 -0
  791. package/lib/types/types.d.ts +6 -1
  792. package/lib/types/types.d.ts.map +1 -1
  793. package/lib/types/types.js.map +1 -1
  794. package/lib/utils/utils.d.ts +41 -4
  795. package/lib/utils/utils.d.ts.map +1 -1
  796. package/lib/utils/utils.js +55 -9
  797. package/lib/utils/utils.js.map +1 -1
  798. package/package.json +10 -11
  799. package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts +0 -3
  800. package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts.map +0 -1
  801. package/lib/components/DateTime/Input/useButtonAriaLabel.js +0 -33
  802. package/lib/components/DateTime/Input/useButtonAriaLabel.js.map +0 -1
  803. package/lib/components/NoItems/NoItems.d.ts +0 -14
  804. package/lib/components/NoItems/NoItems.d.ts.map +0 -1
  805. package/lib/components/NoItems/NoItems.js.map +0 -1
  806. package/lib/components/NoItems/index.d.ts +0 -4
  807. package/lib/components/NoItems/index.d.ts.map +0 -1
  808. package/lib/components/NoItems/index.js +0 -3
  809. package/lib/components/NoItems/index.js.map +0 -1
  810. package/lib/i18n/default.json +0 -246
@@ -1 +1 @@
1
- {"version":3,"file":"LocationView.js","sourceRoot":"","sources":["../../../src/components/Location/LocationView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAO,MAAM,OA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S,EACb,GAAG,EAAE,UAA0B,EAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,IACd,SAAS,UACb;YACD,MAAM,KAAK,UAAU,CAAC,IAAI,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,WAAG;YAC5D,MAAM,KAAK,UAAU,CAAC,KAAK,IAAI,QAAQ,IAAI,CAC1C,KAAC,MAAM,kBAAC,EAAE,EAAE,mBAAmB,gBAAc,QAAQ,EAAE,OAAO,EAAC,MAAM,gBAClE,QAAQ,YACF,CACV,aACkB,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { FC, useContext, useRef, useState, useEffect, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { hasProp } from '../../utils';\nimport Progress from '../Progress';\nimport Flex from '../Flex';\nimport { Status } from '../Badges';\n\nimport { LatLng } from './types';\nimport { loadMapsAPI, getCoords, toGoogleLatLng, getPlaceById } from './utils';\nimport BaseLocationProps from './Location.types';\nimport MapsContext from './MapsContext';\n\nexport const StyledLocationError = styled.div`\n position: absolute;\n top: 40%;\n left: 50%;\n transform: translate(-50%, -50%);\n`;\n\nStyledLocationError.defaultProps = defaultThemeProp;\n\nexport const StyledLocationView = styled.div<{ height?: string }>(props => {\n const { height, theme } = props;\n\n return css`\n height: ${height};\n position: relative;\n flex: auto;\n border-radius: ${theme.base['border-radius']};\n mask-image: radial-gradient(white, black);\n -webkit-mask-image: radial-gradient(white, black);\n `;\n});\n\nStyledLocationView.defaultProps = defaultThemeProp;\n\nconst StyledMap = styled.div<{\n height?: string;\n status: string;\n disabled: boolean;\n eMessage: string;\n}>(\n ({\n height,\n disabled,\n status,\n eMessage,\n theme: {\n base: { 'disabled-opacity': disabledOpacity }\n }\n }) => {\n return css`\n height: ${height};\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n `}\n ${status === 'error' &&\n eMessage &&\n css`\n opacity: ${disabledOpacity};\n `}\n `;\n }\n);\n\nexport interface LocationViewProps extends BaseLocationProps, BaseProps {\n /**\n * Location string as either coordinates, name of a place, or 'current' for the current location.\n * @default 'current'\n */\n location?: LatLng | string | 'current';\n /**\n * Set to true to always center the map when the selected location changes. Toggling this from false to true will re-center map on the last pinned location.\n * @default false\n */\n centerMapOnChange?: boolean;\n /**\n * Height of the map container.\n * @default '25rem'\n */\n height?: string;\n /**\n * How much the map should zoom.\n * @default 13\n */\n zoomLevel?: number;\n /** Callback fired when user clicks on a location on the map. This function will be passed the coordinates of the location that was clicked. */\n onClick?: (coords: {\n latitude: number;\n longitude: number;\n name: string;\n address?: string;\n }) => void;\n}\n\nenum LoadStatus {\n Init = 'init',\n Ready = 'ready',\n Error = 'error'\n}\n\nconst LocationView: FC<LocationViewProps> = (props: LocationViewProps) => {\n const {\n location = 'current',\n zoomLevel = 13,\n height = '25rem',\n centerMapOnChange = false,\n onClick,\n onError,\n disabled = false,\n ...restProps\n } = props;\n const { name, ...providerOpts } = useContext(MapsContext);\n const [status, setStatus] = useState<LoadStatus>(LoadStatus.Init);\n const [eMessage, setEMessage] = useState('');\n const mapElemRef = useRef<HTMLDivElement>();\n const map = useRef<google.maps.Map<HTMLDivElement>>();\n const marker = useRef<google.maps.Marker>();\n\n function initialize(): void {\n if (mapElemRef.current) {\n const position = toGoogleLatLng({ latitude: 0, longitude: 0 });\n map.current = new google.maps.Map(mapElemRef.current!, {\n center: position,\n zoom: 2,\n draggable: !disabled\n });\n marker.current = new google.maps.Marker({\n map: map.current,\n position\n });\n marker.current?.setVisible(false);\n if (onClick)\n map.current.addListener<'click'>('click', event => {\n if (hasProp(event, 'placeId')) {\n getPlaceById(event.placeId).then(placeInfo =>\n onClick?.({\n ...placeInfo,\n latitude: event.latLng.lat(),\n longitude: event.latLng.lng()\n })\n );\n }\n });\n }\n }\n\n useEffect(() => {\n let unMounted = false;\n loadMapsAPI(name, providerOpts)\n .then(() => {\n if (!unMounted) {\n initialize();\n setStatus(LoadStatus.Ready);\n }\n })\n .catch((error: Error) => {\n setStatus(LoadStatus.Error);\n setEMessage(error.message);\n onError?.(error);\n });\n\n return () => {\n unMounted = true;\n if (map.current) google.maps.event.clearInstanceListeners(map.current);\n };\n }, []);\n\n useEffect(() => {\n getCoords(location!)\n .then(coords => {\n if (map.current) {\n map.current.setOptions({\n zoom: zoomLevel,\n draggable: !disabled\n });\n marker.current?.setPosition(toGoogleLatLng(coords));\n marker.current?.setVisible(true);\n if (centerMapOnChange) map.current.setCenter(toGoogleLatLng(coords));\n if (status !== LoadStatus.Ready) setStatus(LoadStatus.Ready);\n }\n })\n .catch((error: Error) => {\n if (status !== LoadStatus.Error) setStatus(LoadStatus.Error);\n marker.current?.setVisible(false);\n setEMessage(error.message);\n onError?.(error);\n });\n }, [location, status, zoomLevel, disabled, centerMapOnChange, onError]);\n\n return (\n <StyledLocationView height={height}>\n <Flex\n as={StyledMap}\n ref={mapElemRef as Ref<Element>}\n height={height}\n disabled={disabled}\n status={status}\n eMessage={eMessage}\n {...restProps}\n />\n {status === LoadStatus.Init && <Progress placement='local' />}\n {status === LoadStatus.Error && eMessage && (\n <Status as={StyledLocationError} aria-label={eMessage} variant='info'>\n {eMessage}\n </Status>\n )}\n </StyledLocationView>\n );\n};\n\nexport default LocationView;\n"]}
1
+ {"version":3,"file":"LocationView.js","sourceRoot":"","sources":["../../../src/components/Location/LocationView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;AACzE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,QAAQ,MAAM,aA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,MAAM,IAAC,EAAE,EAAE,mBAAmB,gBAAc,QAAQ,EAAE,OAAO,EAAC,MAAM,YAClE,QAAQ,WACF,CACV,YACkB,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { FC, useContext, useRef, useState, useEffect, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { hasProp } from '../../utils';\nimport Progress from '../Progress';\nimport Flex from '../Flex';\nimport { Status } from '../Badges';\n\nimport { LatLng } from './types';\nimport { loadMapsAPI, getCoords, toGoogleLatLng, getPlaceById } from './utils';\nimport BaseLocationProps from './Location.types';\nimport MapsContext from './MapsContext';\n\nexport const StyledLocationError = styled.div`\n position: absolute;\n top: 40%;\n left: 50%;\n transform: translate(-50%, -50%);\n`;\n\nStyledLocationError.defaultProps = defaultThemeProp;\n\nexport const StyledLocationView = styled.div<{ height?: string }>(props => {\n const { height, theme } = props;\n\n return css`\n height: ${height};\n position: relative;\n flex: auto;\n border-radius: ${theme.base['border-radius']};\n mask-image: radial-gradient(white, black);\n -webkit-mask-image: radial-gradient(white, black);\n `;\n});\n\nStyledLocationView.defaultProps = defaultThemeProp;\n\nconst StyledMap = styled.div<{\n height?: string;\n status: string;\n disabled: boolean;\n eMessage: string;\n}>(\n ({\n height,\n disabled,\n status,\n eMessage,\n theme: {\n base: { 'disabled-opacity': disabledOpacity }\n }\n }) => {\n return css`\n height: ${height};\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n `}\n ${status === 'error' &&\n eMessage &&\n css`\n opacity: ${disabledOpacity};\n `}\n `;\n }\n);\n\nexport interface LocationViewProps extends BaseLocationProps, BaseProps {\n /**\n * Location string as either coordinates, name of a place, or 'current' for the current location.\n * @default 'current'\n */\n location?: LatLng | string | 'current';\n /**\n * Set to true to always center the map when the selected location changes. Toggling this from false to true will re-center map on the last pinned location.\n * @default false\n */\n centerMapOnChange?: boolean;\n /**\n * Height of the map container.\n * @default '25rem'\n */\n height?: string;\n /**\n * How much the map should zoom.\n * @default 13\n */\n zoomLevel?: number;\n /** Callback fired when user clicks on a location on the map. This function will be passed the coordinates of the location that was clicked. */\n onClick?: (coords: {\n latitude: number;\n longitude: number;\n name: string;\n address?: string;\n }) => void;\n}\n\nenum LoadStatus {\n Init = 'init',\n Ready = 'ready',\n Error = 'error'\n}\n\nconst LocationView: FC<LocationViewProps> = (props: LocationViewProps) => {\n const {\n location = 'current',\n zoomLevel = 13,\n height = '25rem',\n centerMapOnChange = false,\n onClick,\n onError,\n disabled = false,\n ...restProps\n } = props;\n const { name, ...providerOpts } = useContext(MapsContext);\n const [status, setStatus] = useState<LoadStatus>(LoadStatus.Init);\n const [eMessage, setEMessage] = useState('');\n const mapElemRef = useRef<HTMLDivElement>();\n const map = useRef<google.maps.Map<HTMLDivElement>>();\n const marker = useRef<google.maps.Marker>();\n\n function initialize(): void {\n if (mapElemRef.current) {\n const position = toGoogleLatLng({ latitude: 0, longitude: 0 });\n map.current = new google.maps.Map(mapElemRef.current!, {\n center: position,\n zoom: 2,\n draggable: !disabled\n });\n marker.current = new google.maps.Marker({\n map: map.current,\n position\n });\n marker.current?.setVisible(false);\n if (onClick)\n map.current.addListener<'click'>('click', event => {\n if (hasProp(event, 'placeId')) {\n getPlaceById(event.placeId).then(placeInfo =>\n onClick?.({\n ...placeInfo,\n latitude: event.latLng.lat(),\n longitude: event.latLng.lng()\n })\n );\n }\n });\n }\n }\n\n useEffect(() => {\n let unMounted = false;\n loadMapsAPI(name, providerOpts)\n .then(() => {\n if (!unMounted) {\n initialize();\n setStatus(LoadStatus.Ready);\n }\n })\n .catch((error: Error) => {\n setStatus(LoadStatus.Error);\n setEMessage(error.message);\n onError?.(error);\n });\n\n return () => {\n unMounted = true;\n if (map.current) google.maps.event.clearInstanceListeners(map.current);\n };\n }, []);\n\n useEffect(() => {\n getCoords(location!)\n .then(coords => {\n if (map.current) {\n map.current.setOptions({\n zoom: zoomLevel,\n draggable: !disabled\n });\n marker.current?.setPosition(toGoogleLatLng(coords));\n marker.current?.setVisible(true);\n if (centerMapOnChange) map.current.setCenter(toGoogleLatLng(coords));\n if (status !== LoadStatus.Ready) setStatus(LoadStatus.Ready);\n }\n })\n .catch((error: Error) => {\n if (status !== LoadStatus.Error) setStatus(LoadStatus.Error);\n marker.current?.setVisible(false);\n setEMessage(error.message);\n onError?.(error);\n });\n }, [location, status, zoomLevel, disabled, centerMapOnChange, onError]);\n\n return (\n <StyledLocationView height={height}>\n <Flex\n as={StyledMap}\n ref={mapElemRef as Ref<Element>}\n height={height}\n disabled={disabled}\n status={status}\n eMessage={eMessage}\n {...restProps}\n />\n {status === LoadStatus.Init && <Progress placement='local' />}\n {status === LoadStatus.Error && eMessage && (\n <Status as={StyledLocationError} aria-label={eMessage} variant='info'>\n {eMessage}\n </Status>\n )}\n </StyledLocationView>\n );\n};\n\nexport default LocationView;\n"]}
@@ -35,13 +35,12 @@ const providers = {
35
35
  }
36
36
  };
37
37
  export async function loadMapsAPI(name = '', opts) {
38
- var _a;
39
38
  if (typeof opts !== 'object' || !opts) {
40
39
  throw new Error(IsNotAnObjectError);
41
40
  }
42
- const provider = (_a = providers[name]) !== null && _a !== void 0 ? _a : providers.undefined;
43
- if (!provider.loadedPromise || provider.loadedApiKey !== (opts === null || opts === void 0 ? void 0 : opts.apiKey)) {
44
- provider.loadedApiKey = opts === null || opts === void 0 ? void 0 : opts.apiKey;
41
+ const provider = providers[name] ?? providers.undefined;
42
+ if (!provider.loadedPromise || provider.loadedApiKey !== opts?.apiKey) {
43
+ provider.loadedApiKey = opts?.apiKey;
45
44
  provider.loadedPromise = provider.loadAPI(opts);
46
45
  }
47
46
  return provider.loadedPromise;
@@ -67,8 +66,8 @@ export function toGoogleLatLng(coords) {
67
66
  export async function getPlacePredictions(location, bias = {}) {
68
67
  const autocompleteService = new google.maps.places.AutocompleteService();
69
68
  const optionalParams = {};
70
- if (bias === null || bias === void 0 ? void 0 : bias.location) {
71
- if ((bias === null || bias === void 0 ? void 0 : bias.location.center) === 'current') {
69
+ if (bias?.location) {
70
+ if (bias?.location.center === 'current') {
72
71
  await getNavigatorPosition()
73
72
  .then(coords => {
74
73
  optionalParams.location = toGoogleLatLng(coords);
@@ -82,7 +81,7 @@ export async function getPlacePredictions(location, bias = {}) {
82
81
  optionalParams.radius = bias.location.radius;
83
82
  }
84
83
  }
85
- if (bias === null || bias === void 0 ? void 0 : bias.bounds) {
84
+ if (bias?.bounds) {
86
85
  const [sw, ne] = bias.bounds;
87
86
  optionalParams.bounds = new google.maps.LatLngBounds(toGoogleLatLng(sw), toGoogleLatLng(ne));
88
87
  }
@@ -107,13 +106,11 @@ export async function getPlace(location, mapElement = document.createElement('di
107
106
  const placesService = new google.maps.places.PlacesService(mapElement);
108
107
  const { placePredictions, token } = await getPlacePredictions(location);
109
108
  return new Promise((resolve, reject) => {
110
- var _a;
111
- placesService.getDetails({ placeId: (_a = placePredictions[0]) === null || _a === void 0 ? void 0 : _a.place_id, fields: QUERY_FIELDS, sessionToken: token }, (place, pStatus) => {
112
- var _a, _b;
109
+ placesService.getDetails({ placeId: placePredictions[0]?.place_id, fields: QUERY_FIELDS, sessionToken: token }, (place, pStatus) => {
113
110
  if (pStatus === google.maps.places.PlacesServiceStatus.OK) {
114
111
  resolve({
115
- latitude: ((_a = place.geometry) === null || _a === void 0 ? void 0 : _a.location.lat()) || NaN,
116
- longitude: ((_b = place.geometry) === null || _b === void 0 ? void 0 : _b.location.lng()) || NaN
112
+ latitude: place.geometry?.location.lat() || NaN,
113
+ longitude: place.geometry?.location.lng() || NaN
117
114
  });
118
115
  }
119
116
  else {
@@ -126,13 +123,12 @@ export async function getPlaceById(placeId, sessionToken = new google.maps.place
126
123
  const placesService = new google.maps.places.PlacesService(mapElement);
127
124
  return new Promise((resolve, reject) => {
128
125
  placesService.getDetails({ placeId, fields: QUERY_FIELDS, sessionToken }, (place, pStatus) => {
129
- var _a, _b;
130
126
  if (pStatus === google.maps.places.PlacesServiceStatus.OK) {
131
127
  resolve({
132
128
  name: place.name,
133
129
  address: place.formatted_address,
134
- latitude: ((_a = place.geometry) === null || _a === void 0 ? void 0 : _a.location.lat()) || NaN,
135
- longitude: ((_b = place.geometry) === null || _b === void 0 ? void 0 : _b.location.lng()) || NaN
130
+ latitude: place.geometry?.location.lat() || NaN,
131
+ longitude: place.geometry?.location.lng() || NaN
136
132
  });
137
133
  }
138
134
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Location/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAEL,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,kBAAkB,EAElB,qBAAqB,EAErB,yBAAyB,EAEzB,YAAY,EACZ,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C,MAAM,SAAS,GAEX;IACF,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,EAAE;QAChB,OAAO,CAAC,IAAI;YACV,MAAM,MAAM,GAAG,IAAI,eAAe,CAChC,MAAM,CAAC,OAAO,CAAC;gBACb,GAAG,EAAE,IAAI,CAAC,MAAM;gBAChB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,SAAS,EAAE,QAAQ;aACpB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAC9C,CAAC,QAAQ,EAAE,CAAC;YAEb,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;YACpE,IAAI,YAAY,EAAE;gBAChB,YAAY,CAAC,MAAM,EAAE,CAAC;gBACtB,6H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QAAQ,CAAC,GAAG,EAAE;yBAC1C,CAAC;qBACH,CAAC,CAAC;iBACJ;qBAAM;oBACL,OAAO,CAAC;wBACN,IAAI,EAAE,GAAG,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,SAAS,EAAE;wBAC/C,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;qBAC5B,CAAC,CAAC;iBACJ;aACF;iBAAM;gBACL,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,mBAAmB,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC;aACxD;QACH,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { loadScript } from '../../utils';\n\nimport {\n Bias,\n CoordsCannotBeParsedError,\n GeocoderFailedError,\n GeolocationUnsupportedError,\n GoogleMapsAPINotFoundError,\n IsNotAnObjectError,\n LatLng,\n LocationNotFoundError,\n MapsProvider,\n ProviderNotSupportedError,\n ProviderOpts,\n QUERY_FIELDS,\n QUERY_TYPES\n} from './types';\n\nconst GOOGLE_MAPS_SCRIPT_ID = 'google-map';\n\nconst providers: {\n [key: string]: MapsProvider;\n} = {\n google: {\n name: 'Google',\n loadedPromise: null,\n loadedApiKey: '',\n loadAPI(opts) {\n const params = new URLSearchParams(\n Object.entries({\n key: opts.apiKey,\n region: opts.region,\n language: opts.language,\n libraries: 'places'\n }).filter(([, value]) => value !== undefined)\n ).toString();\n\n const loadedScript = document.getElementById(GOOGLE_MAPS_SCRIPT_ID);\n if (loadedScript) {\n loadedScript.remove();\n // https://stackoverflow.com/questions/29930274/fixing-you-have-included-the-google-maps-api-multiple-times-on-this-page-this\n delete (window as any).google;\n }\n\n return new Promise((resolve, reject) => {\n loadScript(\n `https://maps.googleapis.com/maps/api/js?${params}`,\n function onLoad(this: HTMLScriptElement) {\n this.id = GOOGLE_MAPS_SCRIPT_ID;\n return resolve();\n },\n () => reject(new Error(GoogleMapsAPINotFoundError))\n );\n });\n }\n },\n undefined: {\n name: 'undefined',\n loadedPromise: null,\n loadedApiKey: '',\n loadAPI: data => Promise.reject(new Error(`${ProviderNotSupportedError}: ${data.name}`))\n }\n};\n\nexport async function loadMapsAPI(name: string = '', opts?: ProviderOpts): Promise<void> {\n if (typeof opts !== 'object' || !opts) {\n throw new Error(IsNotAnObjectError);\n }\n\n const provider = providers[name] ?? providers.undefined;\n\n if (!provider.loadedPromise || provider.loadedApiKey !== opts?.apiKey) {\n provider.loadedApiKey = opts?.apiKey;\n provider.loadedPromise = provider.loadAPI(opts);\n }\n return provider.loadedPromise;\n}\n\nexport async function getNavigatorPosition(): Promise<LatLng> {\n if (!navigator.geolocation) throw new Error(GeolocationUnsupportedError);\n\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(\n currentLocation => {\n resolve({\n latitude: currentLocation.coords.latitude,\n longitude: currentLocation.coords.longitude\n });\n },\n error => reject(new Error(error.message))\n );\n });\n}\n\nexport function toGoogleLatLng(coords: LatLng): google.maps.LatLng {\n return new google.maps.LatLng(coords.latitude, coords.longitude);\n}\n\n/** Returns an array of place prediction objects ('place' can be an establishment, geographic location, or prominent point of interest)\n * and session token (valid for multiple queries, followed by one place selection).\n */\nexport async function getPlacePredictions(\n location: string,\n bias: Bias = {}\n): Promise<{\n placePredictions: google.maps.places.AutocompletePrediction[];\n token: google.maps.places.AutocompleteSessionToken;\n}> {\n const autocompleteService = new google.maps.places.AutocompleteService();\n const optionalParams: Partial<google.maps.places.AutocompletionRequest> = {};\n if (bias?.location) {\n if (bias?.location.center === 'current') {\n await getNavigatorPosition()\n .then(coords => {\n optionalParams.location = toGoogleLatLng(coords);\n optionalParams.radius = bias.location!.radius;\n })\n // no-op user didn't allow location\n .catch(() => {});\n } else {\n optionalParams.location = toGoogleLatLng(bias.location.center);\n optionalParams.radius = bias.location.radius;\n }\n }\n\n if (bias?.bounds) {\n const [sw, ne] = bias.bounds;\n optionalParams.bounds = new google.maps.LatLngBounds(toGoogleLatLng(sw), toGoogleLatLng(ne));\n }\n return new Promise((resolve, reject) => {\n const token = new google.maps.places.AutocompleteSessionToken();\n autocompleteService.getPlacePredictions(\n {\n input: location,\n types: QUERY_TYPES,\n sessionToken: token,\n ...optionalParams\n },\n (placePredictions, status) => {\n if (status === google.maps.places.PlacesServiceStatus.OK) {\n resolve({ placePredictions, token });\n } else {\n reject(new Error(LocationNotFoundError));\n }\n }\n );\n });\n}\n\nexport async function getPlace(\n location: string,\n mapElement: HTMLDivElement = document.createElement('div')\n): Promise<LatLng> {\n const placesService = new google.maps.places.PlacesService(mapElement);\n const { placePredictions, token } = await getPlacePredictions(location);\n return new Promise((resolve, reject) => {\n placesService.getDetails(\n { placeId: placePredictions[0]?.place_id, fields: QUERY_FIELDS, sessionToken: token },\n (place, pStatus) => {\n if (pStatus === google.maps.places.PlacesServiceStatus.OK) {\n resolve({\n latitude: place.geometry?.location.lat() || NaN,\n longitude: place.geometry?.location.lng() || NaN\n });\n } else {\n reject(new Error(LocationNotFoundError));\n }\n }\n );\n });\n}\n\nexport async function getPlaceById(\n placeId: string,\n sessionToken: google.maps.places.AutocompleteSessionToken = new google.maps.places.AutocompleteSessionToken(),\n mapElement: HTMLDivElement = document.createElement('div')\n): Promise<{ name: string; address?: string; latitude?: number; longitude?: number }> {\n const placesService = new google.maps.places.PlacesService(mapElement);\n return new Promise((resolve, reject) => {\n placesService.getDetails({ placeId, fields: QUERY_FIELDS, sessionToken }, (place, pStatus) => {\n if (pStatus === google.maps.places.PlacesServiceStatus.OK) {\n resolve({\n name: place.name,\n address: place.formatted_address,\n latitude: place.geometry?.location.lat() || NaN,\n longitude: place.geometry?.location.lng() || NaN\n });\n } else {\n reject(new Error(LocationNotFoundError));\n }\n });\n });\n}\n\n/** Returns coordinations for given input: either coords, address or current position. */\nexport async function getCoords(\n coords: string | LatLng,\n mapElement?: HTMLDivElement\n): Promise<LatLng> {\n if (coords === '' || coords === undefined) throw new Error();\n if (coords === 'current') return getNavigatorPosition();\n\n let location: LatLng;\n if (typeof coords === 'string') {\n const [lat, lng] = coords.split(',', 2).map(Number);\n if (Number.isNaN(lat) || Number.isNaN(lng) || lat === undefined || lng === undefined)\n return getPlace(coords, mapElement);\n location = { latitude: lat, longitude: lng };\n } else {\n location = coords;\n }\n\n if (Number.isFinite(location.latitude) && Number.isFinite(location.longitude)) return location;\n\n throw new Error(CoordsCannotBeParsedError);\n}\n\nexport async function getAddress(\n coords: LatLng\n): Promise<{ name: string; address?: string; latitude?: number; longitude?: number }> {\n const location = {\n lat: coords.latitude,\n lng: coords.longitude\n };\n const geocoder = new google.maps.Geocoder();\n return new Promise((resolve, reject) => {\n geocoder.geocode(\n { location },\n (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => {\n if (status === 'OK') {\n const [result] = results;\n if (result) {\n resolve({\n name: result.formatted_address,\n address: result.formatted_address,\n ...(result.geometry && {\n latitude: result.geometry.location.lat(),\n longitude: result.geometry.location.lng()\n })\n });\n } else {\n resolve({\n name: `${coords.latitude}, ${coords.longitude}`,\n latitude: coords.latitude,\n longitude: coords.longitude\n });\n }\n } else {\n reject(new Error(`${GeocoderFailedError}: ${status}`));\n }\n }\n );\n });\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Location/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAEL,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,kBAAkB,EAElB,qBAAqB,EAErB,yBAAyB,EAEzB,YAAY,EACZ,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C,MAAM,SAAS,GAEX;IACF,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,EAAE;QAChB,OAAO,CAAC,IAAI;YACV,MAAM,MAAM,GAAG,IAA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AI,EAAE,MAAM,CAAC,iBAAiB;wBAC9B,OAAO,EAAE,MAAM,CAAC,iBAAiB;wBACjC,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI;4BACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE;4BACxC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE;yBAC1C,CAAC;qBACH,CAAC,CAAC;iBACJ;qBAAM;oBACL,OAAO,CAAC;wBACN,IAAI,EAAE,GAAG,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,SAAS,EAAE;wBAC/C,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;qBAC5B,CAAC,CAAC;iBACJ;aACF;iBAAM;gBACL,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,mBAAmB,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC;aACxD;QACH,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { loadScript } from '../../utils';\n\nimport {\n Bias,\n CoordsCannotBeParsedError,\n GeocoderFailedError,\n GeolocationUnsupportedError,\n GoogleMapsAPINotFoundError,\n IsNotAnObjectError,\n LatLng,\n LocationNotFoundError,\n MapsProvider,\n ProviderNotSupportedError,\n ProviderOpts,\n QUERY_FIELDS,\n QUERY_TYPES\n} from './types';\n\nconst GOOGLE_MAPS_SCRIPT_ID = 'google-map';\n\nconst providers: {\n [key: string]: MapsProvider;\n} = {\n google: {\n name: 'Google',\n loadedPromise: null,\n loadedApiKey: '',\n loadAPI(opts) {\n const params = new URLSearchParams(\n Object.entries({\n key: opts.apiKey,\n region: opts.region,\n language: opts.language,\n libraries: 'places'\n }).filter(([, value]) => value !== undefined)\n ).toString();\n\n const loadedScript = document.getElementById(GOOGLE_MAPS_SCRIPT_ID);\n if (loadedScript) {\n loadedScript.remove();\n // https://stackoverflow.com/questions/29930274/fixing-you-have-included-the-google-maps-api-multiple-times-on-this-page-this\n delete (window as any).google;\n }\n\n return new Promise((resolve, reject) => {\n loadScript(\n `https://maps.googleapis.com/maps/api/js?${params}`,\n function onLoad(this: HTMLScriptElement) {\n this.id = GOOGLE_MAPS_SCRIPT_ID;\n return resolve();\n },\n () => reject(new Error(GoogleMapsAPINotFoundError))\n );\n });\n }\n },\n undefined: {\n name: 'undefined',\n loadedPromise: null,\n loadedApiKey: '',\n loadAPI: data => Promise.reject(new Error(`${ProviderNotSupportedError}: ${data.name}`))\n }\n};\n\nexport async function loadMapsAPI(name: string = '', opts?: ProviderOpts): Promise<void> {\n if (typeof opts !== 'object' || !opts) {\n throw new Error(IsNotAnObjectError);\n }\n\n const provider = providers[name] ?? providers.undefined;\n\n if (!provider.loadedPromise || provider.loadedApiKey !== opts?.apiKey) {\n provider.loadedApiKey = opts?.apiKey;\n provider.loadedPromise = provider.loadAPI(opts);\n }\n return provider.loadedPromise;\n}\n\nexport async function getNavigatorPosition(): Promise<LatLng> {\n if (!navigator.geolocation) throw new Error(GeolocationUnsupportedError);\n\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(\n currentLocation => {\n resolve({\n latitude: currentLocation.coords.latitude,\n longitude: currentLocation.coords.longitude\n });\n },\n error => reject(new Error(error.message))\n );\n });\n}\n\nexport function toGoogleLatLng(coords: LatLng): google.maps.LatLng {\n return new google.maps.LatLng(coords.latitude, coords.longitude);\n}\n\n/** Returns an array of place prediction objects ('place' can be an establishment, geographic location, or prominent point of interest)\n * and session token (valid for multiple queries, followed by one place selection).\n */\nexport async function getPlacePredictions(\n location: string,\n bias: Bias = {}\n): Promise<{\n placePredictions: google.maps.places.AutocompletePrediction[];\n token: google.maps.places.AutocompleteSessionToken;\n}> {\n const autocompleteService = new google.maps.places.AutocompleteService();\n const optionalParams: Partial<google.maps.places.AutocompletionRequest> = {};\n if (bias?.location) {\n if (bias?.location.center === 'current') {\n await getNavigatorPosition()\n .then(coords => {\n optionalParams.location = toGoogleLatLng(coords);\n optionalParams.radius = bias.location!.radius;\n })\n // no-op user didn't allow location\n .catch(() => {});\n } else {\n optionalParams.location = toGoogleLatLng(bias.location.center);\n optionalParams.radius = bias.location.radius;\n }\n }\n\n if (bias?.bounds) {\n const [sw, ne] = bias.bounds;\n optionalParams.bounds = new google.maps.LatLngBounds(toGoogleLatLng(sw), toGoogleLatLng(ne));\n }\n return new Promise((resolve, reject) => {\n const token = new google.maps.places.AutocompleteSessionToken();\n autocompleteService.getPlacePredictions(\n {\n input: location,\n types: QUERY_TYPES,\n sessionToken: token,\n ...optionalParams\n },\n (placePredictions, status) => {\n if (status === google.maps.places.PlacesServiceStatus.OK) {\n resolve({ placePredictions, token });\n } else {\n reject(new Error(LocationNotFoundError));\n }\n }\n );\n });\n}\n\nexport async function getPlace(\n location: string,\n mapElement: HTMLDivElement = document.createElement('div')\n): Promise<LatLng> {\n const placesService = new google.maps.places.PlacesService(mapElement);\n const { placePredictions, token } = await getPlacePredictions(location);\n return new Promise((resolve, reject) => {\n placesService.getDetails(\n { placeId: placePredictions[0]?.place_id, fields: QUERY_FIELDS, sessionToken: token },\n (place, pStatus) => {\n if (pStatus === google.maps.places.PlacesServiceStatus.OK) {\n resolve({\n latitude: place.geometry?.location.lat() || NaN,\n longitude: place.geometry?.location.lng() || NaN\n });\n } else {\n reject(new Error(LocationNotFoundError));\n }\n }\n );\n });\n}\n\nexport async function getPlaceById(\n placeId: string,\n sessionToken: google.maps.places.AutocompleteSessionToken = new google.maps.places.AutocompleteSessionToken(),\n mapElement: HTMLDivElement = document.createElement('div')\n): Promise<{ name: string; address?: string; latitude?: number; longitude?: number }> {\n const placesService = new google.maps.places.PlacesService(mapElement);\n return new Promise((resolve, reject) => {\n placesService.getDetails({ placeId, fields: QUERY_FIELDS, sessionToken }, (place, pStatus) => {\n if (pStatus === google.maps.places.PlacesServiceStatus.OK) {\n resolve({\n name: place.name,\n address: place.formatted_address,\n latitude: place.geometry?.location.lat() || NaN,\n longitude: place.geometry?.location.lng() || NaN\n });\n } else {\n reject(new Error(LocationNotFoundError));\n }\n });\n });\n}\n\n/** Returns coordinations for given input: either coords, address or current position. */\nexport async function getCoords(\n coords: string | LatLng,\n mapElement?: HTMLDivElement\n): Promise<LatLng> {\n if (coords === '' || coords === undefined) throw new Error();\n if (coords === 'current') return getNavigatorPosition();\n\n let location: LatLng;\n if (typeof coords === 'string') {\n const [lat, lng] = coords.split(',', 2).map(Number);\n if (Number.isNaN(lat) || Number.isNaN(lng) || lat === undefined || lng === undefined)\n return getPlace(coords, mapElement);\n location = { latitude: lat, longitude: lng };\n } else {\n location = coords;\n }\n\n if (Number.isFinite(location.latitude) && Number.isFinite(location.longitude)) return location;\n\n throw new Error(CoordsCannotBeParsedError);\n}\n\nexport async function getAddress(\n coords: LatLng\n): Promise<{ name: string; address?: string; latitude?: number; longitude?: number }> {\n const location = {\n lat: coords.latitude,\n lng: coords.longitude\n };\n const geocoder = new google.maps.Geocoder();\n return new Promise((resolve, reject) => {\n geocoder.geocode(\n { location },\n (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => {\n if (status === 'OK') {\n const [result] = results;\n if (result) {\n resolve({\n name: result.formatted_address,\n address: result.formatted_address,\n ...(result.geometry && {\n latitude: result.geometry.location.lat(),\n longitude: result.geometry.location.lng()\n })\n });\n } else {\n resolve({\n name: `${coords.latitude}, ${coords.longitude}`,\n latitude: coords.latitude,\n longitude: coords.longitude\n });\n }\n } else {\n reject(new Error(`${GeocoderFailedError}: ${status}`));\n }\n }\n );\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FlyoutMenuList.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/FlyoutMenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAUlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,OAAO,EAAE,aAAa,EAAuB,MAAM,cAAc,CAAC;AAMlE,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CA6HnE,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"FlyoutMenuList.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/FlyoutMenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAUlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,OAAO,EAAE,aAAa,EAAuB,MAAM,cAAc,CAAC;AAQlE,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CA+HnE,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -3,12 +3,14 @@ import { createElement as _createElement } from "react";
3
3
  import { forwardRef, useContext, useEffect, useRef, useState, useMemo, useCallback, useLayoutEffect } from 'react';
4
4
  import { useAfterInitialEffect, useConsolidatedRef, useItemIntersection } from '../../hooks';
5
5
  import Progress from '../Progress';
6
- import NoItems from '../NoItems';
6
+ import EmptyState from '../EmptyState';
7
7
  import Popover from '../Popover';
8
8
  import MenuContext from './Menu.context';
9
9
  import MenuItem from './MenuItem';
10
10
  import { StyledLoadingItem, StyledMenuList, StyledFlyoutMenuListContainer } from './Menu.styles';
11
11
  import { resizeRootEl } from './NavItemsList';
12
+ import helpers from './helpers';
13
+ import MenuGroup from './MenuGroup';
12
14
  const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
13
15
  const selfRef = useConsolidatedRef(ref);
14
16
  const ulRef = useRef(null);
@@ -17,8 +19,7 @@ const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
17
19
  const [expandedItem, setExpandedItem] = useState();
18
20
  const { componentId, loadMore, loading, scrollAt, emptyText, onItemExpand, pushFlyoutId, flyOutActiveIdStack } = useContext(MenuContext);
19
21
  useItemIntersection(ulRef, items.length - 1, () => {
20
- var _a;
21
- loadMore === null || loadMore === void 0 ? void 0 : loadMore((_a = parent === null || parent === void 0 ? void 0 : parent.item) === null || _a === void 0 ? void 0 : _a.id);
22
+ loadMore?.(parent?.item?.id);
22
23
  });
23
24
  useAfterInitialEffect(() => {
24
25
  if (expandedItem) {
@@ -37,30 +38,27 @@ const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
37
38
  const listContent = useMemo(() => {
38
39
  if (items.length) {
39
40
  return items.map(item => {
40
- return (_createElement(MenuItem, { ...item, key: item.id, "aria-haspopup": !!item.items, "aria-expanded": item.id === (expandedItem === null || expandedItem === void 0 ? void 0 : expandedItem.id), onExpand: (id, e) => {
41
- var _a;
41
+ return helpers.isItem(item) ? (_createElement(MenuItem, { ...item, key: item.id, "aria-haspopup": !!item.items, "aria-expanded": item.id === expandedItem?.id, onExpand: (id, e) => {
42
42
  if (item.items) {
43
43
  returnFocusRef.current = e.currentTarget;
44
44
  setExpandedItem(item); // FIXME
45
- (_a = item === null || item === void 0 ? void 0 : item.onExpand) === null || _a === void 0 ? void 0 : _a.call(// FIXME
46
- item, id, e);
47
- onItemExpand === null || onItemExpand === void 0 ? void 0 : onItemExpand(id, e);
45
+ item?.onExpand?.(id, e);
46
+ onItemExpand?.(id, e);
48
47
  pushFlyoutId(item.id || componentId);
49
48
  }
50
49
  else {
51
50
  returnFocusRef.current = null;
52
51
  setExpandedItem(undefined);
53
52
  }
54
- } }));
53
+ } })) : (_createElement(MenuGroup, { ...item, key: item.id }));
55
54
  });
56
55
  }
57
56
  if (!loading) {
58
- return _jsx(NoItems, { message: emptyText, forwardedAs: 'li' }, void 0);
57
+ return _jsx(EmptyState, { message: emptyText, forwardedAs: 'li' }, void 0);
59
58
  }
60
59
  return null;
61
60
  }, [items, loading, emptyText, expandedItem]);
62
- const list = (_jsxs(StyledMenuList, Object.assign({ ref: ulRef }, { children: [listContent,
63
- loading && !expandedItem && (_jsx(StyledLoadingItem, { children: _jsx(Progress, { placement: 'local' }, void 0) }, void 0))] }), void 0));
61
+ const list = (_jsxs(StyledMenuList, { ref: ulRef, children: [listContent, loading && !expandedItem && (_jsx(StyledLoadingItem, { children: _jsx(Progress, { placement: 'local' }, void 0) }, void 0))] }, void 0));
64
62
  useLayoutEffect(() => {
65
63
  setExpandedItem(undefined);
66
64
  if (selfRef.current) {
@@ -73,14 +71,13 @@ const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
73
71
  setExpandedItem(undefined);
74
72
  }
75
73
  }, [expandedItem]);
76
- return (_jsxs(_Fragment, { children: [_jsx(StyledFlyoutMenuListContainer, Object.assign({ ref: selfRef, onScroll: handleMenuListScroll, "data-flyout-menu-parent-id": componentId, "data-flyout-menu-id": (parent === null || parent === void 0 ? void 0 : parent.item.id) || componentId }, { children: list }), void 0),
77
- expandedItem && selfRef.current && (_jsx(Popover, Object.assign({ target: returnFocusRef.current, show: true, strategy: 'fixed', placement: 'right-start' }, { children: _jsx(FlyoutMenuList, { items: expandedItem.items, parent: {
74
+ return (_jsxs(_Fragment, { children: [_jsx(StyledFlyoutMenuListContainer, { ref: selfRef, onScroll: handleMenuListScroll, "data-flyout-menu-parent-id": componentId, "data-flyout-menu-id": parent?.item.id || componentId, children: list }, void 0), expandedItem && selfRef.current && (_jsx(Popover, { target: returnFocusRef.current, show: true, strategy: 'fixed', placement: 'right-start', children: _jsx(FlyoutMenuList, { items: expandedItem.items, parent: {
78
75
  el: selfRef.current,
79
76
  item: expandedItem,
80
77
  siblingItems: items,
81
78
  setExpandedItem,
82
79
  returnFocusRef
83
- } }, void 0) }), void 0))] }, void 0));
80
+ } }, void 0) }, void 0))] }, void 0));
84
81
  });
85
82
  export default FlyoutMenuList;
86
83
  //# sourceMappingURL=FlyoutMenuList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlyoutMenuList.js","sourceRoot":"","sources":["../../../src/components/Menu/FlyoutMenuList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EAIV,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,eAAe,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C,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,8BACE,KAAC,6BAA6B,kBAC5B,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,oBAAoB,gCACF,WAAW,yBAClB,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,EAAE,KAAI,WAAW,gBAElD,IAAI,YACyB;YAE/B,YAAY,IAAI,OAAO,CAAC,OAAO,IAAI,CAClC,KAAC,OAAO,kBAAC,MAAM,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,QAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,aAAa,gBACpF,KAAC,cAAc,IACb,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,MAAM,EAAE;wBACN,EAAE,EAAE,OAAO,CAAC,OAAO;wBACnB,IAAI,EAAE,YAAY;wBAClB,YAAY,EAAE,KAAK;wBACnB,eAAe;wBACf,cAAc;qBACf,WACD,YACM,CACX,YACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MutableRefObject,\n PropsWithoutRef,\n useContext,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n useLayoutEffect\n} from 'react';\n\nimport { ForwardProps } from '../../types';\nimport { useAfterInitialEffect, useConsolidatedRef, useItemIntersection } from '../../hooks';\nimport Progress from '../Progress';\nimport NoItems from '../NoItems';\nimport Popover from '../Popover';\n\nimport { MenuListProps, ParentMenuItemProps } from './Menu.types';\nimport MenuContext from './Menu.context';\nimport MenuItem from './MenuItem';\nimport { StyledLoadingItem, StyledMenuList, StyledFlyoutMenuListContainer } from './Menu.styles';\nimport { resizeRootEl } from './NavItemsList';\n\nconst FlyoutMenuList: FunctionComponent<MenuListProps & ForwardProps> = forwardRef(\n ({ items, parent }: PropsWithoutRef<MenuListProps>, ref: MenuListProps['ref']) => {\n const selfRef = useConsolidatedRef(ref);\n const ulRef = useRef<HTMLUListElement>(null);\n const menuListWrapperRef: MutableRefObject<HTMLElement | null> = useRef(null);\n const returnFocusRef: MutableRefObject<HTMLButtonElement | null> = useRef(null);\n const [expandedItem, setExpandedItem] = useState<ParentMenuItemProps>();\n const {\n componentId,\n loadMore,\n loading,\n scrollAt,\n emptyText,\n onItemExpand,\n pushFlyoutId,\n flyOutActiveIdStack\n } = useContext(MenuContext);\n\n useItemIntersection(ulRef, items.length - 1, () => {\n loadMore?.(parent?.item?.id);\n });\n\n useAfterInitialEffect(() => {\n if (expandedItem) {\n setExpandedItem(items.find(item => item.id === expandedItem.id) as ParentMenuItemProps); // FIXME\n }\n }, [expandedItem, items]);\n\n useEffect(() => {\n const hasExpanded = items.some(item => {\n return flyOutActiveIdStack.includes(item.id);\n });\n\n if (!hasExpanded) {\n returnFocusRef.current = null;\n setExpandedItem(undefined);\n }\n }, [flyOutActiveIdStack]);\n\n const listContent = useMemo(() => {\n if (items.length) {\n return items.map(item => {\n return (\n <MenuItem\n {...item}\n key={item.id}\n aria-haspopup={!!item.items}\n aria-expanded={item.id === expandedItem?.id}\n onExpand={(id, e) => {\n if (item.items) {\n returnFocusRef.current = e.currentTarget as HTMLButtonElement;\n setExpandedItem(item as ParentMenuItemProps); // FIXME\n item?.onExpand?.(id, e);\n onItemExpand?.(id, e);\n pushFlyoutId(item.id || componentId);\n } else {\n returnFocusRef.current = null;\n setExpandedItem(undefined);\n }\n }}\n />\n );\n });\n }\n\n if (!loading) {\n return <NoItems message={emptyText} forwardedAs='li' />;\n }\n\n return null;\n }, [items, loading, emptyText, expandedItem]);\n\n const list = (\n <StyledMenuList ref={ulRef}>\n {listContent}\n {loading && !expandedItem && (\n <StyledLoadingItem>\n <Progress placement='local' />\n </StyledLoadingItem>\n )}\n </StyledMenuList>\n );\n\n useLayoutEffect(() => {\n setExpandedItem(undefined);\n if (selfRef.current) {\n menuListWrapperRef.current = selfRef.current.parentElement;\n resizeRootEl(selfRef.current, selfRef.current, items.length, scrollAt);\n }\n }, [items]);\n\n const handleMenuListScroll = useCallback(() => {\n if (expandedItem) {\n setExpandedItem(undefined);\n }\n }, [expandedItem]);\n\n return (\n <>\n <StyledFlyoutMenuListContainer\n ref={selfRef}\n onScroll={handleMenuListScroll}\n data-flyout-menu-parent-id={componentId}\n data-flyout-menu-id={parent?.item.id || componentId}\n >\n {list}\n </StyledFlyoutMenuListContainer>\n\n {expandedItem && selfRef.current && (\n <Popover target={returnFocusRef.current} show strategy='fixed' placement='right-start'>\n <FlyoutMenuList\n items={expandedItem.items}\n parent={{\n el: selfRef.current,\n item: expandedItem,\n siblingItems: items,\n setExpandedItem,\n returnFocusRef\n }}\n />\n </Popover>\n )}\n </>\n );\n }\n);\n\nexport default FlyoutMenuList;\n"]}
1
+ {"version":3,"file":"FlyoutMenuList.js","sourceRoot":"","sources":["../../../src/components/Menu/FlyoutMenuList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EAIV,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,eAAe,EAChB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,OAAO,MAAM,YAAY,CAAC;AAGjC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,cAAc,GAAoD,UAAU,CAChF,CAAC,EAAE,KAAK,EAAE,MAAM,EAAkC,EAAE,GAAyB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Ae;wBACf,cAAc;qBACf,WACD,WACM,CACX,YACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MutableRefObject,\n PropsWithoutRef,\n useContext,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n useLayoutEffect\n} from 'react';\n\nimport { ForwardProps } from '../../types';\nimport { useAfterInitialEffect, useConsolidatedRef, useItemIntersection } from '../../hooks';\nimport Progress from '../Progress';\nimport EmptyState from '../EmptyState';\nimport Popover from '../Popover';\n\nimport { MenuListProps, ParentMenuItemProps } from './Menu.types';\nimport MenuContext from './Menu.context';\nimport MenuItem from './MenuItem';\nimport { StyledLoadingItem, StyledMenuList, StyledFlyoutMenuListContainer } from './Menu.styles';\nimport { resizeRootEl } from './NavItemsList';\nimport helpers from './helpers';\nimport MenuGroup from './MenuGroup';\n\nconst FlyoutMenuList: FunctionComponent<MenuListProps & ForwardProps> = forwardRef(\n ({ items, parent }: PropsWithoutRef<MenuListProps>, ref: MenuListProps['ref']) => {\n const selfRef = useConsolidatedRef(ref);\n const ulRef = useRef<HTMLUListElement>(null);\n const menuListWrapperRef: MutableRefObject<HTMLElement | null> = useRef(null);\n const returnFocusRef: MutableRefObject<HTMLButtonElement | null> = useRef(null);\n const [expandedItem, setExpandedItem] = useState<ParentMenuItemProps>();\n const {\n componentId,\n loadMore,\n loading,\n scrollAt,\n emptyText,\n onItemExpand,\n pushFlyoutId,\n flyOutActiveIdStack\n } = useContext(MenuContext);\n\n useItemIntersection(ulRef, items.length - 1, () => {\n loadMore?.(parent?.item?.id);\n });\n\n useAfterInitialEffect(() => {\n if (expandedItem) {\n setExpandedItem(items.find(item => item.id === expandedItem.id) as ParentMenuItemProps); // FIXME\n }\n }, [expandedItem, items]);\n\n useEffect(() => {\n const hasExpanded = items.some(item => {\n return flyOutActiveIdStack.includes(item.id);\n });\n\n if (!hasExpanded) {\n returnFocusRef.current = null;\n setExpandedItem(undefined);\n }\n }, [flyOutActiveIdStack]);\n\n const listContent = useMemo(() => {\n if (items.length) {\n return items.map(item => {\n return helpers.isItem(item) ? (\n <MenuItem\n {...item}\n key={item.id}\n aria-haspopup={!!item.items}\n aria-expanded={item.id === expandedItem?.id}\n onExpand={(id, e) => {\n if (item.items) {\n returnFocusRef.current = e.currentTarget as HTMLButtonElement;\n setExpandedItem(item as ParentMenuItemProps); // FIXME\n item?.onExpand?.(id, e);\n onItemExpand?.(id, e);\n pushFlyoutId(item.id || componentId);\n } else {\n returnFocusRef.current = null;\n setExpandedItem(undefined);\n }\n }}\n />\n ) : (\n <MenuGroup {...item} key={item.id} />\n );\n });\n }\n\n if (!loading) {\n return <EmptyState message={emptyText} forwardedAs='li' />;\n }\n\n return null;\n }, [items, loading, emptyText, expandedItem]);\n\n const list = (\n <StyledMenuList ref={ulRef}>\n {listContent}\n {loading && !expandedItem && (\n <StyledLoadingItem>\n <Progress placement='local' />\n </StyledLoadingItem>\n )}\n </StyledMenuList>\n );\n\n useLayoutEffect(() => {\n setExpandedItem(undefined);\n if (selfRef.current) {\n menuListWrapperRef.current = selfRef.current.parentElement;\n resizeRootEl(selfRef.current, selfRef.current, items.length, scrollAt);\n }\n }, [items]);\n\n const handleMenuListScroll = useCallback(() => {\n if (expandedItem) {\n setExpandedItem(undefined);\n }\n }, [expandedItem]);\n\n return (\n <>\n <StyledFlyoutMenuListContainer\n ref={selfRef}\n onScroll={handleMenuListScroll}\n data-flyout-menu-parent-id={componentId}\n data-flyout-menu-id={parent?.item.id || componentId}\n >\n {list}\n </StyledFlyoutMenuListContainer>\n\n {expandedItem && selfRef.current && (\n <Popover target={returnFocusRef.current} show strategy='fixed' placement='right-start'>\n <FlyoutMenuList\n items={expandedItem.items}\n parent={{\n el: selfRef.current,\n item: expandedItem,\n siblingItems: items,\n setExpandedItem,\n returnFocusRef\n }}\n />\n </Popover>\n )}\n </>\n );\n }\n);\n\nexport default FlyoutMenuList;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.context.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;;AAEhD,wBAWG"}
1
+ {"version":3,"file":"Menu.context.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;;AAEhD,wBAaG"}
@@ -8,7 +8,9 @@ export default createContext({
8
8
  componentId: createUID(),
9
9
  pushFlyoutId: () => null,
10
10
  flyOutActiveIdStack: [],
11
+ focusControl: null,
11
12
  updateActiveDescendants: () => null,
13
+ setFocusDescendant: () => null,
12
14
  setFocusReturnEl: () => null,
13
15
  getScopedItemId: () => ''
14
16
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.context.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAe,aAAa,CAAmB;IAC7C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,SAAS,EAAE;IACxB,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI;IACxB,mBAAmB,EAAE,EAAE;IACvB,uBAAuB,EAAE,GAAG,EAAE,CAAC,IAAI;IACnC,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC5B,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE;CAC1B,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport { createUID } from '../../utils';\n\nimport { MenuContextProps } from './Menu.types';\n\nexport default createContext<MenuContextProps>({\n mode: 'action',\n variant: 'drill-down',\n scrollAt: 7,\n loading: false,\n componentId: createUID(),\n pushFlyoutId: () => null,\n flyOutActiveIdStack: [],\n updateActiveDescendants: () => null,\n setFocusReturnEl: () => null,\n getScopedItemId: () => ''\n});\n"]}
1
+ {"version":3,"file":"Menu.context.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAe,aAAa,CAAmB;IAC7C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,SAAS,EAAE;IACxB,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI;IACxB,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,IAAI;IAClB,uBAAuB,EAAE,GAAG,EAAE,CAAC,IAAI;IACnC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC5B,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE;CAC1B,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport { createUID } from '../../utils';\n\nimport { MenuContextProps } from './Menu.types';\n\nexport default createContext<MenuContextProps>({\n mode: 'action',\n variant: 'drill-down',\n scrollAt: 7,\n loading: false,\n componentId: createUID(),\n pushFlyoutId: () => null,\n flyOutActiveIdStack: [],\n focusControl: null,\n updateActiveDescendants: () => null,\n setFocusDescendant: () => null,\n setFocusReturnEl: () => null,\n getScopedItemId: () => ''\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CA2RrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CA2UrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,18 +1,21 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback, useEffect, useState, useRef, useMemo } from 'react';
3
- import { useConsolidatedRef, useUID, useActiveDescendant, useI18n, usePrevious } from '../../hooks';
3
+ import { useConsolidatedRef, useUID, useActiveDescendant, useI18n, usePrevious, useDirection } from '../../hooks';
4
+ import { cap } from '../../utils';
4
5
  import FlyoutMenuList from './FlyoutMenuList';
5
6
  import MenuContext from './Menu.context';
6
7
  import { StyledAriaDescription, StyledMenu, StyledMenuListWrapper } from './Menu.styles';
7
8
  import MenuList from './MenuList';
8
9
  const Menu = forwardRef((props, ref) => {
9
10
  const uid = useUID();
10
- const { id = uid, items = [], mode = 'action', accent, scrollAt = 7, emptyText, onItemClick, onItemExpand, loadMore, onItemCollapse, loading = false, currentItemId, header, footer, variant = 'drill-down', focusControlEl, arrowNavigationUnsupported, 'aria-describedby': ariaDescribedBy, ...restProps } = props;
11
+ const { id = uid, items = [], mode = 'action', accent, scrollAt = 7, emptyText, onItemClick, onItemActive, onItemExpand, loadMore, onItemCollapse, loading = false, currentItemId, header, footer, variant = 'drill-down', focusControlEl, focusElOnClose = true, arrowNavigationUnsupported, 'aria-describedby': ariaDescribedBy, ...restProps } = props;
11
12
  const t = useI18n();
13
+ const { end: endDirection, start: startDirection } = useDirection();
12
14
  const radioName = useUID();
13
15
  const menuRef = useConsolidatedRef(ref);
14
16
  const previousItemCount = useRef(0);
15
17
  const [activeDescendantUpdateId, setActiveDescendantUpdateId] = useState(0);
18
+ const [focusDescendant, setFocusDescendant] = useState(null);
16
19
  const [flyOutActiveIdStack, setFlyoutActiveIdStack] = useState([id]);
17
20
  const [focusReturnEl, setFocusReturnEl] = useState();
18
21
  const [preventInitialScroll, setPreventInitialScroll] = useState(false);
@@ -26,6 +29,9 @@ const Menu = forwardRef((props, ref) => {
26
29
  const getScopedItemId = useCallback((itemId) => {
27
30
  return `${id}-item-${itemId}`;
28
31
  }, [id]);
32
+ const getUnscopedItemId = useCallback((itemId) => {
33
+ return itemId.split(`${id}-item-`)[1];
34
+ }, [id]);
29
35
  const updateActiveDescendants = useCallback(({ preventScroll = false } = {}) => {
30
36
  setPreventInitialScroll(preventScroll);
31
37
  setActiveDescendantUpdateId(Math.random());
@@ -37,6 +43,12 @@ const Menu = forwardRef((props, ref) => {
37
43
  ? 'fieldset[aria-hidden="false"]'
38
44
  : activeFlyoutSelector,
39
45
  selector: '[role="menuitem"], legend button',
46
+ focusDescendantEl: focusDescendant,
47
+ clearFocusDescendant: () => {
48
+ setFocusDescendant(null);
49
+ if (focusElOnClose)
50
+ focusControl?.focus();
51
+ },
40
52
  focusReturnEl,
41
53
  clearFocusReturn: () => {
42
54
  setFocusReturnEl(null);
@@ -51,6 +63,7 @@ const Menu = forwardRef((props, ref) => {
51
63
  menuRef.current,
52
64
  activeFlyoutSelector,
53
65
  focusReturnEl,
66
+ focusDescendant,
54
67
  currentItemId,
55
68
  preventInitialScroll
56
69
  ]);
@@ -60,30 +73,31 @@ const Menu = forwardRef((props, ref) => {
60
73
  const previousActiveDescendant = usePrevious(activeDescendant);
61
74
  // ## Bind Menu-specific navigation keyDown.
62
75
  useEffect(() => {
63
- const expandOrCollapse = () => {
64
- var _a;
76
+ const expandOrCollapse = (action = null) => {
65
77
  if (activeDescendant) {
66
- if (activeDescendant.dataset.expand === 'true') {
67
- (_a = activeDescendant.querySelector('button')) === null || _a === void 0 ? void 0 : _a.click();
78
+ // expand
79
+ if (activeDescendant.dataset.expand === 'true' && action !== 'collapse') {
80
+ activeDescendant.querySelector('button')?.click();
68
81
  return;
69
82
  }
70
- if (activeDescendant.dataset.collapse === 'true') {
83
+ // collapse
84
+ if (activeDescendant.dataset.collapse === 'true' && action !== 'expand') {
71
85
  activeDescendant.click();
72
86
  }
73
87
  }
74
88
  };
75
89
  const additionalKeydown = (e) => {
76
90
  switch (e.key) {
77
- case 'ArrowRight': {
91
+ case `Arrow${cap(endDirection)}`: {
78
92
  if (arrowNavigationUnsupported)
79
93
  break;
80
- expandOrCollapse();
94
+ expandOrCollapse('expand');
81
95
  break;
82
96
  }
83
- case 'ArrowLeft': {
97
+ case `Arrow${cap(startDirection)}`: {
84
98
  if (arrowNavigationUnsupported)
85
99
  break;
86
- expandOrCollapse();
100
+ expandOrCollapse('collapse');
87
101
  break;
88
102
  }
89
103
  case 'Escape': {
@@ -104,23 +118,26 @@ const Menu = forwardRef((props, ref) => {
104
118
  expandOrCollapse();
105
119
  }
106
120
  };
107
- focusControl === null || focusControl === void 0 ? void 0 : focusControl.addEventListener('keydown', additionalKeydown);
108
- return () => focusControl === null || focusControl === void 0 ? void 0 : focusControl.removeEventListener('keydown', additionalKeydown);
121
+ if (activeDescendant)
122
+ onItemActive?.(getUnscopedItemId(activeDescendant.id));
123
+ focusControl?.addEventListener('keydown', additionalKeydown);
124
+ return () => focusControl?.removeEventListener('keydown', additionalKeydown);
109
125
  }, [focusControl, activeDescendant]);
110
126
  // ## Update useActiveDescendant on change of items, not selection of items.
111
127
  useEffect(() => {
112
128
  // Next tick for DOM updates.
113
129
  setTimeout(() => {
114
- var _a, _b;
115
130
  if (items.length === previousItemCount.current) {
116
- const previousDescendantIds = descendants === null || descendants === void 0 ? void 0 : descendants.map(node => node.id);
117
- const newDescendants = (_b = (_a = uadConfig.scope) === null || _a === void 0 ? void 0 : _a.querySelector(uadConfig.scopeSelector)) === null || _b === void 0 ? void 0 : _b.querySelectorAll(uadConfig.selector);
131
+ const previousDescendantIds = descendants?.map(node => node.id);
132
+ const newDescendants = uadConfig.scope
133
+ ?.querySelector(uadConfig.scopeSelector)
134
+ ?.querySelectorAll(uadConfig.selector);
118
135
  if (!newDescendants) {
119
136
  updateActiveDescendants();
120
137
  return;
121
138
  }
122
139
  const scopedDescendants = Array.from(newDescendants);
123
- if ((scopedDescendants === null || scopedDescendants === void 0 ? void 0 : scopedDescendants.length) !== (previousDescendantIds === null || previousDescendantIds === void 0 ? void 0 : previousDescendantIds.length)) {
140
+ if (scopedDescendants?.length !== previousDescendantIds?.length) {
124
141
  updateActiveDescendants();
125
142
  return;
126
143
  }
@@ -136,27 +153,28 @@ const Menu = forwardRef((props, ref) => {
136
153
  }, [items]);
137
154
  // ## Bump scroll & set return element when descendant focused in loading state.
138
155
  useEffect(() => {
139
- var _a, _b;
140
- const activeDescendantChanged = (previousActiveDescendant === null || previousActiveDescendant === void 0 ? void 0 : previousActiveDescendant.id) !== (activeDescendant === null || activeDescendant === void 0 ? void 0 : activeDescendant.id);
156
+ const activeDescendantChanged = previousActiveDescendant?.id !== activeDescendant?.id;
141
157
  if (!activeDescendantChanged)
142
158
  return;
143
159
  if (loading && descendants && descendants.length && activeDescendant) {
144
160
  const descendantList = [...descendants];
145
161
  const lastItem = descendantList.pop();
146
- const lastId = (lastItem === null || lastItem === void 0 ? void 0 : lastItem.id) || undefined;
162
+ const lastId = lastItem?.id || undefined;
147
163
  if (lastId === activeDescendant.id) {
148
- const scrollRegion = (_b = (_a = uadConfig.scope) === null || _a === void 0 ? void 0 : _a.querySelector(uadConfig.scopeSelector)) === null || _b === void 0 ? void 0 : _b.querySelector('ul');
164
+ const scrollRegion = uadConfig.scope
165
+ ?.querySelector(uadConfig.scopeSelector)
166
+ ?.querySelector('ul');
149
167
  if (scrollRegion) {
150
168
  scrollRegion.scrollTop = scrollRegion.scrollHeight - scrollRegion.offsetHeight;
151
169
  }
152
- if ((focusReturnEl === null || focusReturnEl === void 0 ? void 0 : focusReturnEl.id) !== activeDescendant.id) {
170
+ if (focusReturnEl?.id !== activeDescendant.id) {
153
171
  // Set focus return on 'nextTick' and avoid looping calls with immediate siblings.
154
172
  setTimeout(() => {
155
173
  setFocusReturnEl(lastItem);
156
174
  }, 0);
157
175
  }
158
176
  }
159
- else if ((focusReturnEl === null || focusReturnEl === void 0 ? void 0 : focusReturnEl.id) !== activeDescendant.id) {
177
+ else if (focusReturnEl?.id !== activeDescendant.id) {
160
178
  // Set focus return on 'nextTick' and avoid looping calls with immediate siblings.
161
179
  setTimeout(() => {
162
180
  setFocusReturnEl(activeDescendant);
@@ -171,29 +189,54 @@ const Menu = forwardRef((props, ref) => {
171
189
  uadConfig,
172
190
  focusReturnEl
173
191
  ]);
174
- return (_jsxs(StyledMenu, Object.assign({ id: id, role: 'menu', "aria-describedby": !focusControlEl ? `${id}-menuDescription` : undefined }, restProps, { ref: menuRef }, { children: [!focusControlEl && (_jsxs(StyledAriaDescription, Object.assign({ id: `${id}-menuDescription` }, { children: [t('menu_selection_instructions'), " ", ariaDescribedBy && ` ${ariaDescribedBy}`] }), void 0)),
175
- header && _jsx("header", { children: header }, void 0),
176
- _jsx(StyledMenuListWrapper, { children: _jsx(MenuContext.Provider, Object.assign({ value: {
177
- componentId: id,
178
- mode,
179
- arrowNavigationUnsupported,
180
- onItemClick,
181
- onItemExpand,
182
- onItemCollapse,
183
- accent,
184
- scrollAt,
185
- emptyText,
186
- radioName,
187
- loadMore,
188
- loading,
189
- variant,
190
- updateActiveDescendants,
191
- setFocusReturnEl,
192
- getScopedItemId,
193
- pushFlyoutId,
194
- flyOutActiveIdStack
195
- } }, { children: variant === 'drill-down' ? (_jsx(MenuList, { items: items }, void 0)) : (_jsx(FlyoutMenuList, { items: items }, void 0)) }), void 0) }, void 0),
196
- footer && _jsx("footer", { children: footer }, void 0)] }), void 0));
192
+ const contextValue = useMemo(() => {
193
+ return {
194
+ componentId: id,
195
+ mode,
196
+ arrowNavigationUnsupported,
197
+ onItemClick,
198
+ onItemActive,
199
+ onItemExpand,
200
+ onItemCollapse,
201
+ accent,
202
+ scrollAt,
203
+ emptyText,
204
+ radioName,
205
+ loadMore,
206
+ loading,
207
+ variant,
208
+ focusControl,
209
+ updateActiveDescendants,
210
+ setFocusReturnEl,
211
+ setFocusDescendant,
212
+ getScopedItemId,
213
+ pushFlyoutId,
214
+ flyOutActiveIdStack
215
+ };
216
+ }, [
217
+ id,
218
+ mode,
219
+ arrowNavigationUnsupported,
220
+ onItemClick,
221
+ onItemActive,
222
+ onItemExpand,
223
+ onItemCollapse,
224
+ accent,
225
+ scrollAt,
226
+ emptyText,
227
+ radioName,
228
+ loadMore,
229
+ loading,
230
+ variant,
231
+ focusControl,
232
+ updateActiveDescendants,
233
+ setFocusReturnEl,
234
+ setFocusDescendant,
235
+ getScopedItemId,
236
+ pushFlyoutId,
237
+ flyOutActiveIdStack
238
+ ]);
239
+ return (_jsxs(StyledMenu, { id: id, role: 'menu', "aria-describedby": !focusControlEl ? `${id}-menuDescription` : undefined, ...restProps, ref: menuRef, children: [!focusControlEl && (_jsxs(StyledAriaDescription, { id: `${id}-menuDescription`, children: [t('menu_selection_instructions'), " ", ariaDescribedBy && ` ${ariaDescribedBy}`] }, void 0)), header && _jsx("header", { children: header }, void 0), _jsx(StyledMenuListWrapper, { children: _jsx(MenuContext.Provider, { value: contextValue, children: variant === 'drill-down' ? (_jsx(MenuList, { items: items }, void 0)) : (_jsx(FlyoutMenuList, { items: items }, void 0)) }, void 0) }, void 0), footer && _jsx("footer", { children: footer }, void 0)] }, void 0));
197
240
  });
198
241
  export default Menu;
199
242
  //# sourceMappingURL=Menu.js.map