@pega/cosmos-react-core 3.0.0-dev.9.1 → 3.0.0-rc.10

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 (1045) hide show
  1. package/lib/components/Actions/Actions.d.ts +5 -0
  2. package/lib/components/Actions/Actions.d.ts.map +1 -1
  3. package/lib/components/Actions/Actions.js +2 -2
  4. package/lib/components/Actions/Actions.js.map +1 -1
  5. package/lib/components/AdditionalInfo/AdditionalInfo.d.ts +11 -0
  6. package/lib/components/AdditionalInfo/AdditionalInfo.d.ts.map +1 -0
  7. package/lib/components/AdditionalInfo/AdditionalInfo.js +25 -0
  8. package/lib/components/AdditionalInfo/AdditionalInfo.js.map +1 -0
  9. package/lib/components/AdditionalInfo/index.d.ts +2 -0
  10. package/lib/components/AdditionalInfo/index.d.ts.map +1 -0
  11. package/lib/components/AdditionalInfo/index.js +2 -0
  12. package/lib/components/AdditionalInfo/index.js.map +1 -0
  13. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  14. package/lib/components/AppShell/AppHeader.js +17 -8
  15. package/lib/components/AppShell/AppHeader.js.map +1 -1
  16. package/lib/components/AppShell/AppHeader.styles.d.ts +16 -0
  17. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -0
  18. package/lib/components/AppShell/AppHeader.styles.js +155 -0
  19. package/lib/components/AppShell/AppHeader.styles.js.map +1 -0
  20. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  21. package/lib/components/AppShell/AppShell.js +92 -220
  22. package/lib/components/AppShell/AppShell.js.map +1 -1
  23. package/lib/components/AppShell/AppShell.styles.d.ts +7 -48
  24. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  25. package/lib/components/AppShell/AppShell.styles.js +54 -527
  26. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  27. package/lib/components/AppShell/AppShell.types.d.ts +29 -80
  28. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  29. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  30. package/lib/components/AppShell/AppShellContext.d.ts +12 -6
  31. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  32. package/lib/components/AppShell/AppShellContext.js +10 -5
  33. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  34. package/lib/components/AppShell/AppShellList.d.ts +2 -2
  35. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  36. package/lib/components/AppShell/AppShellList.js +16 -2
  37. package/lib/components/AppShell/AppShellList.js.map +1 -1
  38. package/lib/components/AppShell/AppShellList.styles.d.ts +19 -0
  39. package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -0
  40. package/lib/components/AppShell/AppShellList.styles.js +141 -0
  41. package/lib/components/AppShell/AppShellList.styles.js.map +1 -0
  42. package/lib/components/AppShell/AppShellSearch.d.ts +9 -0
  43. package/lib/components/AppShell/AppShellSearch.d.ts.map +1 -0
  44. package/lib/components/AppShell/AppShellSearch.js +39 -0
  45. package/lib/components/AppShell/AppShellSearch.js.map +1 -0
  46. package/lib/components/AppShell/AppShellSearch.styles.d.ts +8 -0
  47. package/lib/components/AppShell/AppShellSearch.styles.d.ts.map +1 -0
  48. package/lib/components/AppShell/AppShellSearch.styles.js +193 -0
  49. package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -0
  50. package/lib/components/AppShell/Drawer.d.ts +3 -1
  51. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  52. package/lib/components/AppShell/Drawer.js +14 -11
  53. package/lib/components/AppShell/Drawer.js.map +1 -1
  54. package/lib/components/AppShell/Drawer.styles.d.ts +15 -0
  55. package/lib/components/AppShell/Drawer.styles.d.ts.map +1 -0
  56. package/lib/components/AppShell/Drawer.styles.js +153 -0
  57. package/lib/components/AppShell/Drawer.styles.js.map +1 -0
  58. package/lib/components/AppShell/NavigationList.d.ts +6 -0
  59. package/lib/components/AppShell/NavigationList.d.ts.map +1 -0
  60. package/lib/components/AppShell/NavigationList.js +121 -0
  61. package/lib/components/AppShell/NavigationList.js.map +1 -0
  62. package/lib/components/AppShell/NavigationListItemWrapper.d.ts +5 -0
  63. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -0
  64. package/lib/components/AppShell/NavigationListItemWrapper.js +160 -0
  65. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -0
  66. package/lib/components/AppShell/Operator.js +4 -4
  67. package/lib/components/AppShell/Operator.js.map +1 -1
  68. package/lib/components/AppShell/index.d.ts +2 -3
  69. package/lib/components/AppShell/index.d.ts.map +1 -1
  70. package/lib/components/AppShell/index.js +1 -2
  71. package/lib/components/AppShell/index.js.map +1 -1
  72. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  73. package/lib/components/Avatar/Avatar.js +4 -4
  74. package/lib/components/Avatar/Avatar.js.map +1 -1
  75. package/lib/components/Badges/Count.d.ts.map +1 -1
  76. package/lib/components/Badges/Count.js +37 -1
  77. package/lib/components/Badges/Count.js.map +1 -1
  78. package/lib/components/Badges/Keyboard.d.ts +2 -2
  79. package/lib/components/Badges/Keyboard.d.ts.map +1 -1
  80. package/lib/components/Badges/Keyboard.js +6 -1
  81. package/lib/components/Badges/Keyboard.js.map +1 -1
  82. package/lib/components/Badges/Selection.d.ts +1 -1
  83. package/lib/components/Badges/Selection.d.ts.map +1 -1
  84. package/lib/components/Badges/Selection.js +42 -42
  85. package/lib/components/Badges/Selection.js.map +1 -1
  86. package/lib/components/Badges/Tag.d.ts +9 -3
  87. package/lib/components/Badges/Tag.d.ts.map +1 -1
  88. package/lib/components/Badges/Tag.js +3 -2
  89. package/lib/components/Badges/Tag.js.map +1 -1
  90. package/lib/components/Banner/Banner.d.ts.map +1 -1
  91. package/lib/components/Banner/Banner.js +19 -16
  92. package/lib/components/Banner/Banner.js.map +1 -1
  93. package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
  94. package/lib/components/Boolean/BooleanDisplay.js +4 -12
  95. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  96. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -1
  97. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  98. package/lib/components/Breadcrumbs/Breadcrumbs.js +44 -13
  99. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  100. package/lib/components/Button/BareButton.d.ts.map +1 -1
  101. package/lib/components/Button/BareButton.js +1 -0
  102. package/lib/components/Button/BareButton.js.map +1 -1
  103. package/lib/components/Button/BareRoleButton.d.ts.map +1 -1
  104. package/lib/components/Button/BareRoleButton.js +3 -1
  105. package/lib/components/Button/BareRoleButton.js.map +1 -1
  106. package/lib/components/Button/Button.d.ts.map +1 -1
  107. package/lib/components/Button/Button.js +3 -1
  108. package/lib/components/Button/Button.js.map +1 -1
  109. package/lib/components/Checkbox/Checkbox.d.ts +3 -1
  110. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  111. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  112. package/lib/components/ColorPicker/ColorPicker.d.ts +2 -0
  113. package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  114. package/lib/components/ColorPicker/ColorPicker.js +2 -4
  115. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  116. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  117. package/lib/components/ComboBox/ComboBox.js +70 -13
  118. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  119. package/lib/components/ComboBox/ComboBox.styles.d.ts +3 -1
  120. package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
  121. package/lib/components/ComboBox/ComboBox.styles.js +4 -1
  122. package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
  123. package/lib/components/ComboBox/ComboBox.types.d.ts +11 -1
  124. package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
  125. package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
  126. package/lib/components/ComboBox/ComboBoxInput.d.ts +7 -0
  127. package/lib/components/ComboBox/ComboBoxInput.d.ts.map +1 -1
  128. package/lib/components/ComboBox/ComboBoxInput.js +5 -2
  129. package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
  130. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  131. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +130 -36
  132. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  133. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.d.ts +10 -0
  134. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.d.ts.map +1 -1
  135. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.js.map +1 -1
  136. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
  137. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +3 -3
  138. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
  139. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.d.ts +2 -0
  140. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.d.ts.map +1 -1
  141. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.js.map +1 -1
  142. package/lib/components/CompositeInput/CompositeInput.d.ts +5 -0
  143. package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -0
  144. package/lib/components/CompositeInput/CompositeInput.js +62 -0
  145. package/lib/components/CompositeInput/CompositeInput.js.map +1 -0
  146. package/lib/components/CompositeInput/CompositeInput.styles.d.ts +5 -0
  147. package/lib/components/CompositeInput/CompositeInput.styles.d.ts.map +1 -0
  148. package/lib/components/CompositeInput/CompositeInput.styles.js +57 -0
  149. package/lib/components/CompositeInput/CompositeInput.styles.js.map +1 -0
  150. package/lib/components/CompositeInput/CompositeInput.types.d.ts +52 -0
  151. package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -0
  152. package/lib/components/CompositeInput/CompositeInput.types.js +2 -0
  153. package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -0
  154. package/lib/components/CompositeInput/index.d.ts +3 -0
  155. package/lib/components/CompositeInput/index.d.ts.map +1 -0
  156. package/lib/components/CompositeInput/index.js +2 -0
  157. package/lib/components/CompositeInput/index.js.map +1 -0
  158. package/lib/components/Configuration/Configuration.d.ts +16 -13
  159. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  160. package/lib/components/Configuration/Configuration.js +42 -14
  161. package/lib/components/Configuration/Configuration.js.map +1 -1
  162. package/lib/components/Configuration/index.d.ts +0 -1
  163. package/lib/components/Configuration/index.d.ts.map +1 -1
  164. package/lib/components/Configuration/index.js +0 -1
  165. package/lib/components/Configuration/index.js.map +1 -1
  166. package/lib/components/CreditCard/CreditCard.types.d.ts +2 -0
  167. package/lib/components/CreditCard/CreditCard.types.d.ts.map +1 -1
  168. package/lib/components/CreditCard/CreditCard.types.js.map +1 -1
  169. package/lib/components/CreditCard/CreditCardInput.js +1 -1
  170. package/lib/components/CreditCard/CreditCardInput.js.map +1 -1
  171. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  172. package/lib/components/Currency/CurrencyDisplay.js +2 -2
  173. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  174. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  175. package/lib/components/Currency/CurrencyInput.js +92 -26
  176. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  177. package/lib/components/Currency/CurrencyInput.types.d.ts +9 -1
  178. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  179. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  180. package/lib/components/Currency/utils.d.ts +7 -17
  181. package/lib/components/Currency/utils.d.ts.map +1 -1
  182. package/lib/components/Currency/utils.js +50 -51
  183. package/lib/components/Currency/utils.js.map +1 -1
  184. package/lib/components/DateTime/DateTime.types.d.ts +15 -9
  185. package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
  186. package/lib/components/DateTime/DateTime.types.js.map +1 -1
  187. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  188. package/lib/components/DateTime/DateTimeDisplay.js +8 -1
  189. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  190. package/lib/components/DateTime/DurationDisplay.js +3 -3
  191. package/lib/components/DateTime/DurationDisplay.js.map +1 -1
  192. package/lib/components/DateTime/Input/DateInput.d.ts +9 -2
  193. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  194. package/lib/components/DateTime/Input/DateInput.js +29 -17
  195. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  196. package/lib/components/DateTime/Input/DateRangeInput.d.ts +18 -23
  197. package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
  198. package/lib/components/DateTime/Input/DateRangeInput.js +98 -83
  199. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  200. package/lib/components/DateTime/Input/DateTimeInput.d.ts +3 -0
  201. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  202. package/lib/components/DateTime/Input/DateTimeInput.js +30 -14
  203. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  204. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +2 -0
  205. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
  206. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  207. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
  208. package/lib/components/DateTime/Input/Duration/DurationInput.js +10 -2
  209. package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
  210. package/lib/components/DateTime/Input/Duration/DurationInput.types.d.ts +2 -0
  211. package/lib/components/DateTime/Input/Duration/DurationInput.types.d.ts.map +1 -1
  212. package/lib/components/DateTime/Input/Duration/DurationInput.types.js.map +1 -1
  213. package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts.map +1 -1
  214. package/lib/components/DateTime/Input/Duration/NumberUnit.js +30 -33
  215. package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
  216. package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
  217. package/lib/components/DateTime/Input/Duration/Time.js +5 -4
  218. package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
  219. package/lib/components/DateTime/Input/MonthInput.d.ts +3 -0
  220. package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
  221. package/lib/components/DateTime/Input/MonthInput.js +30 -26
  222. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  223. package/lib/components/DateTime/Input/PartInput.d.ts +1 -0
  224. package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
  225. package/lib/components/DateTime/Input/PartInput.js +10 -7
  226. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  227. package/lib/components/DateTime/Input/QuarterInput.d.ts +3 -0
  228. package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -1
  229. package/lib/components/DateTime/Input/QuarterInput.js +31 -25
  230. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
  231. package/lib/components/DateTime/Input/TimeInput.d.ts +3 -0
  232. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  233. package/lib/components/DateTime/Input/TimeInput.js +21 -9
  234. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  235. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +46 -0
  236. package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -0
  237. package/lib/components/DateTime/Input/TimeRangeInput.js +74 -0
  238. package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -0
  239. package/lib/components/DateTime/Input/WeekInput.d.ts +3 -2
  240. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  241. package/lib/components/DateTime/Input/WeekInput.js +12 -7
  242. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  243. package/lib/components/DateTime/Input/usePickerButton.d.ts +1 -1
  244. package/lib/components/DateTime/Input/usePickerButton.d.ts.map +1 -1
  245. package/lib/components/DateTime/Input/utils.d.ts +7 -7
  246. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  247. package/lib/components/DateTime/Input/utils.js +19 -6
  248. package/lib/components/DateTime/Input/utils.js.map +1 -1
  249. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  250. package/lib/components/DateTime/Picker/Calendar.js +20 -16
  251. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  252. package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -4
  253. package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
  254. package/lib/components/DateTime/Picker/Calendar.styles.js +13 -55
  255. package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
  256. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  257. package/lib/components/DateTime/Picker/DatePicker.js +2 -1
  258. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  259. package/lib/components/DateTime/Picker/DatePicker.styles.d.ts +3 -0
  260. package/lib/components/DateTime/Picker/DatePicker.styles.d.ts.map +1 -0
  261. package/lib/components/DateTime/Picker/DatePicker.styles.js +39 -0
  262. package/lib/components/DateTime/Picker/DatePicker.styles.js.map +1 -0
  263. package/lib/components/DateTime/Picker/DateRangePicker.js +1 -1
  264. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  265. package/lib/components/DateTime/Picker/TimePicker.d.ts +1 -1
  266. package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
  267. package/lib/components/DateTime/Picker/TimePicker.js +10 -5
  268. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  269. package/lib/components/DateTime/Picker/Weeks.d.ts.map +1 -1
  270. package/lib/components/DateTime/Picker/Weeks.js +14 -6
  271. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  272. package/lib/components/DateTime/Picker/utils.d.ts +1 -1
  273. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  274. package/lib/components/DateTime/index.d.ts +4 -0
  275. package/lib/components/DateTime/index.d.ts.map +1 -1
  276. package/lib/components/DateTime/index.js +3 -0
  277. package/lib/components/DateTime/index.js.map +1 -1
  278. package/lib/components/DateTime/utils.d.ts +5 -4
  279. package/lib/components/DateTime/utils.d.ts.map +1 -1
  280. package/lib/components/DateTime/utils.js +21 -8
  281. package/lib/components/DateTime/utils.js.map +1 -1
  282. package/lib/components/Dialog/Dialog.d.ts +32 -0
  283. package/lib/components/Dialog/Dialog.d.ts.map +1 -0
  284. package/lib/components/Dialog/Dialog.js +150 -0
  285. package/lib/components/Dialog/Dialog.js.map +1 -0
  286. package/lib/components/Dialog/index.d.ts +3 -0
  287. package/lib/components/Dialog/index.d.ts.map +1 -0
  288. package/lib/components/Dialog/index.js +3 -0
  289. package/lib/components/Dialog/index.js.map +1 -0
  290. package/lib/components/EmojiPicker/EmojiPicker.styles.d.ts.map +1 -1
  291. package/lib/components/EmojiPicker/EmojiPicker.styles.js +8 -6
  292. package/lib/components/EmojiPicker/EmojiPicker.styles.js.map +1 -1
  293. package/lib/components/FieldGroup/FieldGroup.d.ts +7 -0
  294. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  295. package/lib/components/FieldGroup/FieldGroup.js +46 -42
  296. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  297. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  298. package/lib/components/FieldGroup/FieldGroupList.js +8 -8
  299. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  300. package/lib/components/FieldValueList/FieldValueList.d.ts +13 -7
  301. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  302. package/lib/components/FieldValueList/FieldValueList.js +53 -19
  303. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  304. package/lib/components/FieldValueList/index.d.ts +3 -5
  305. package/lib/components/FieldValueList/index.d.ts.map +1 -1
  306. package/lib/components/FieldValueList/index.js +2 -4
  307. package/lib/components/FieldValueList/index.js.map +1 -1
  308. package/lib/components/File/FileItem.d.ts +3 -0
  309. package/lib/components/File/FileItem.d.ts.map +1 -1
  310. package/lib/components/File/FileItem.js +18 -14
  311. package/lib/components/File/FileItem.js.map +1 -1
  312. package/lib/components/File/utils.d.ts +1 -1
  313. package/lib/components/File/utils.d.ts.map +1 -1
  314. package/lib/components/File/utils.js.map +1 -1
  315. package/lib/components/Flex/Flex.d.ts +11 -10
  316. package/lib/components/Flex/Flex.d.ts.map +1 -1
  317. package/lib/components/Flex/Flex.js.map +1 -1
  318. package/lib/components/Form/Form.d.ts +5 -16
  319. package/lib/components/Form/Form.d.ts.map +1 -1
  320. package/lib/components/Form/Form.js +14 -11
  321. package/lib/components/Form/Form.js.map +1 -1
  322. package/lib/components/FormControl/FormControl.d.ts +12 -2
  323. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  324. package/lib/components/FormControl/FormControl.js +60 -35
  325. package/lib/components/FormControl/FormControl.js.map +1 -1
  326. package/lib/components/FormField/FormField.d.ts +5 -0
  327. package/lib/components/FormField/FormField.d.ts.map +1 -1
  328. package/lib/components/FormField/FormField.js +87 -16
  329. package/lib/components/FormField/FormField.js.map +1 -1
  330. package/lib/components/Grid/Grid.d.ts +1 -1
  331. package/lib/components/Grid/Grid.d.ts.map +1 -1
  332. package/lib/components/Grid/Grid.types.d.ts +11 -10
  333. package/lib/components/Grid/Grid.types.d.ts.map +1 -1
  334. package/lib/components/Grid/Grid.types.js.map +1 -1
  335. package/lib/components/HTML/HTML.d.ts +1 -0
  336. package/lib/components/HTML/HTML.d.ts.map +1 -1
  337. package/lib/components/HTML/HTML.js +63 -17
  338. package/lib/components/HTML/HTML.js.map +1 -1
  339. package/lib/components/Icon/Icon.d.ts +7 -7
  340. package/lib/components/Icon/Icon.d.ts.map +1 -1
  341. package/lib/components/Icon/Icon.js +14 -15
  342. package/lib/components/Icon/Icon.js.map +1 -1
  343. package/lib/components/Icon/iconNames.d.ts +2 -2
  344. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  345. package/lib/components/Icon/iconNames.js +2 -1
  346. package/lib/components/Icon/iconNames.js.map +1 -1
  347. package/lib/components/Icon/icons/ai-assist.icon.js +1 -1
  348. package/lib/components/Icon/icons/ai-assist.icon.js.map +1 -1
  349. package/lib/components/Icon/icons/align-center.icon.js +1 -1
  350. package/lib/components/Icon/icons/align-center.icon.js.map +1 -1
  351. package/lib/components/Icon/icons/align-left.icon.js +1 -1
  352. package/lib/components/Icon/icons/align-left.icon.js.map +1 -1
  353. package/lib/components/Icon/icons/align-right.icon.js +1 -1
  354. package/lib/components/Icon/icons/align-right.icon.js.map +1 -1
  355. package/lib/components/Icon/icons/arrow-left.icon.js +1 -1
  356. package/lib/components/Icon/icons/arrow-left.icon.js.map +1 -1
  357. package/lib/components/Icon/icons/arrow-micro-down.icon.js +1 -1
  358. package/lib/components/Icon/icons/arrow-micro-down.icon.js.map +1 -1
  359. package/lib/components/Icon/icons/arrow-micro-left.icon.js +1 -1
  360. package/lib/components/Icon/icons/arrow-micro-left.icon.js.map +1 -1
  361. package/lib/components/Icon/icons/arrow-micro-right.icon.js +1 -1
  362. package/lib/components/Icon/icons/arrow-micro-right.icon.js.map +1 -1
  363. package/lib/components/Icon/icons/arrow-micro-up-down.icon.js +1 -1
  364. package/lib/components/Icon/icons/arrow-micro-up-down.icon.js.map +1 -1
  365. package/lib/components/Icon/icons/arrow-micro-up.icon.js +1 -1
  366. package/lib/components/Icon/icons/arrow-micro-up.icon.js.map +1 -1
  367. package/lib/components/Icon/icons/arrow-up-down.icon.js +1 -1
  368. package/lib/components/Icon/icons/arrow-up-down.icon.js.map +1 -1
  369. package/lib/components/Icon/icons/bars.icon.js +1 -1
  370. package/lib/components/Icon/icons/bars.icon.js.map +1 -1
  371. package/lib/components/Icon/icons/bell-solid.icon.js +1 -1
  372. package/lib/components/Icon/icons/bell-solid.icon.js.map +1 -1
  373. package/lib/components/Icon/icons/bell.icon.js +1 -1
  374. package/lib/components/Icon/icons/bell.icon.js.map +1 -1
  375. package/lib/components/Icon/icons/box-4-solid.icon.js +1 -1
  376. package/lib/components/Icon/icons/box-4-solid.icon.js.map +1 -1
  377. package/lib/components/Icon/icons/box-4.icon.js +1 -1
  378. package/lib/components/Icon/icons/box-4.icon.js.map +1 -1
  379. package/lib/components/Icon/icons/calendar-range.icon.js +1 -1
  380. package/lib/components/Icon/icons/calendar-range.icon.js.map +1 -1
  381. package/lib/components/Icon/icons/calendar-solid.icon.js +1 -1
  382. package/lib/components/Icon/icons/calendar-solid.icon.js.map +1 -1
  383. package/lib/components/Icon/icons/caret-down.icon.js +1 -1
  384. package/lib/components/Icon/icons/caret-down.icon.js.map +1 -1
  385. package/lib/components/Icon/icons/caret-left.icon.js +1 -1
  386. package/lib/components/Icon/icons/caret-left.icon.js.map +1 -1
  387. package/lib/components/Icon/icons/caret-right.icon.js +1 -1
  388. package/lib/components/Icon/icons/caret-right.icon.js.map +1 -1
  389. package/lib/components/Icon/icons/caret-up.icon.js +1 -1
  390. package/lib/components/Icon/icons/caret-up.icon.js.map +1 -1
  391. package/lib/components/Icon/icons/{script-solid.icon.d.ts → carrot.icon.d.ts} +2 -2
  392. package/lib/components/Icon/icons/carrot.icon.d.ts.map +1 -0
  393. package/lib/components/Icon/icons/carrot.icon.js +6 -0
  394. package/lib/components/Icon/icons/carrot.icon.js.map +1 -0
  395. package/lib/components/Icon/icons/case-solid.icon.js +1 -1
  396. package/lib/components/Icon/icons/case-solid.icon.js.map +1 -1
  397. package/lib/components/Icon/icons/case.icon.js +1 -1
  398. package/lib/components/Icon/icons/case.icon.js.map +1 -1
  399. package/lib/components/Icon/icons/chain.icon.js +1 -1
  400. package/lib/components/Icon/icons/chain.icon.js.map +1 -1
  401. package/lib/components/Icon/icons/chat-solid.icon.js +1 -1
  402. package/lib/components/Icon/icons/chat-solid.icon.js.map +1 -1
  403. package/lib/components/Icon/icons/chat.icon.js +1 -1
  404. package/lib/components/Icon/icons/chat.icon.js.map +1 -1
  405. package/lib/components/Icon/icons/check.icon.js +1 -1
  406. package/lib/components/Icon/icons/check.icon.js.map +1 -1
  407. package/lib/components/Icon/icons/clipboard-plus-solid.icon.js +1 -1
  408. package/lib/components/Icon/icons/clipboard-plus-solid.icon.js.map +1 -1
  409. package/lib/components/Icon/icons/clipboard-plus.icon.js +1 -1
  410. package/lib/components/Icon/icons/clipboard-plus.icon.js.map +1 -1
  411. package/lib/components/Icon/icons/clock-solid.icon.js +1 -1
  412. package/lib/components/Icon/icons/clock-solid.icon.js.map +1 -1
  413. package/lib/components/Icon/icons/clock.icon.js +1 -1
  414. package/lib/components/Icon/icons/clock.icon.js.map +1 -1
  415. package/lib/components/Icon/icons/code.icon.js +1 -1
  416. package/lib/components/Icon/icons/code.icon.js.map +1 -1
  417. package/lib/components/Icon/icons/dataviz-string-field.icon.d.ts +1 -1
  418. package/lib/components/Icon/icons/dataviz-string-field.icon.js +2 -2
  419. package/lib/components/Icon/icons/dataviz-string-field.icon.js.map +1 -1
  420. package/lib/components/Icon/icons/dock.icon.js +1 -1
  421. package/lib/components/Icon/icons/dock.icon.js.map +1 -1
  422. package/lib/components/Icon/icons/dot-9-solid.icon.js +1 -1
  423. package/lib/components/Icon/icons/dot-9-solid.icon.js.map +1 -1
  424. package/lib/components/Icon/icons/dot-9.icon.js +1 -1
  425. package/lib/components/Icon/icons/dot-9.icon.js.map +1 -1
  426. package/lib/components/Icon/icons/download.icon.js +1 -1
  427. package/lib/components/Icon/icons/download.icon.js.map +1 -1
  428. package/lib/components/Icon/icons/drag.icon.js +1 -1
  429. package/lib/components/Icon/icons/drag.icon.js.map +1 -1
  430. package/lib/components/Icon/icons/eye-off-solid.icon.js +1 -1
  431. package/lib/components/Icon/icons/eye-off-solid.icon.js.map +1 -1
  432. package/lib/components/Icon/icons/eye-off.icon.js +1 -1
  433. package/lib/components/Icon/icons/eye-off.icon.js.map +1 -1
  434. package/lib/components/Icon/icons/face-blank-solid.icon.d.ts.map +1 -1
  435. package/lib/components/Icon/icons/face-blank-solid.icon.js +1 -1
  436. package/lib/components/Icon/icons/face-blank-solid.icon.js.map +1 -1
  437. package/lib/components/Icon/icons/face-blank.icon.d.ts.map +1 -1
  438. package/lib/components/Icon/icons/face-blank.icon.js +1 -1
  439. package/lib/components/Icon/icons/face-blank.icon.js.map +1 -1
  440. package/lib/components/Icon/icons/face-happy-solid.icon.d.ts.map +1 -1
  441. package/lib/components/Icon/icons/face-happy-solid.icon.js +1 -1
  442. package/lib/components/Icon/icons/face-happy-solid.icon.js.map +1 -1
  443. package/lib/components/Icon/icons/face-happy.icon.d.ts.map +1 -1
  444. package/lib/components/Icon/icons/face-happy.icon.js +1 -1
  445. package/lib/components/Icon/icons/face-happy.icon.js.map +1 -1
  446. package/lib/components/Icon/icons/face-sad-solid.icon.d.ts.map +1 -1
  447. package/lib/components/Icon/icons/face-sad-solid.icon.js +1 -1
  448. package/lib/components/Icon/icons/face-sad-solid.icon.js.map +1 -1
  449. package/lib/components/Icon/icons/face-sad.icon.d.ts.map +1 -1
  450. package/lib/components/Icon/icons/face-sad.icon.js +1 -1
  451. package/lib/components/Icon/icons/face-sad.icon.js.map +1 -1
  452. package/lib/components/Icon/icons/fast-forward-solid.icon.js +1 -1
  453. package/lib/components/Icon/icons/fast-forward-solid.icon.js.map +1 -1
  454. package/lib/components/Icon/icons/filetype-text.icon.d.ts.map +1 -1
  455. package/lib/components/Icon/icons/filetype-text.icon.js +2 -2
  456. package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
  457. package/lib/components/Icon/icons/filter-on.icon.js +1 -1
  458. package/lib/components/Icon/icons/filter-on.icon.js.map +1 -1
  459. package/lib/components/Icon/icons/filter.icon.js +1 -1
  460. package/lib/components/Icon/icons/filter.icon.js.map +1 -1
  461. package/lib/components/Icon/icons/folder-hierarchy-solid.icon.js +1 -1
  462. package/lib/components/Icon/icons/folder-hierarchy-solid.icon.js.map +1 -1
  463. package/lib/components/Icon/icons/folder-hierarchy.icon.js +1 -1
  464. package/lib/components/Icon/icons/folder-hierarchy.icon.js.map +1 -1
  465. package/lib/components/Icon/icons/forward-all-solid.icon.js +1 -1
  466. package/lib/components/Icon/icons/forward-all-solid.icon.js.map +1 -1
  467. package/lib/components/Icon/icons/forward-all.icon.js +1 -1
  468. package/lib/components/Icon/icons/forward-all.icon.js.map +1 -1
  469. package/lib/components/Icon/icons/forward-solid.icon.js +1 -1
  470. package/lib/components/Icon/icons/forward-solid.icon.js.map +1 -1
  471. package/lib/components/Icon/icons/forward.icon.js +1 -1
  472. package/lib/components/Icon/icons/forward.icon.js.map +1 -1
  473. package/lib/components/Icon/icons/galaxy.icon.d.ts.map +1 -1
  474. package/lib/components/Icon/icons/galaxy.icon.js +2 -2
  475. package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
  476. package/lib/components/Icon/icons/globe-solid.icon.js +1 -1
  477. package/lib/components/Icon/icons/globe-solid.icon.js.map +1 -1
  478. package/lib/components/Icon/icons/globe.icon.js +1 -1
  479. package/lib/components/Icon/icons/globe.icon.js.map +1 -1
  480. package/lib/components/Icon/icons/hand.icon.js +1 -1
  481. package/lib/components/Icon/icons/hand.icon.js.map +1 -1
  482. package/lib/components/Icon/icons/help-solid.icon.js +1 -1
  483. package/lib/components/Icon/icons/help-solid.icon.js.map +1 -1
  484. package/lib/components/Icon/icons/help.icon.js +1 -1
  485. package/lib/components/Icon/icons/help.icon.js.map +1 -1
  486. package/lib/components/Icon/icons/home-solid.icon.js +1 -1
  487. package/lib/components/Icon/icons/home-solid.icon.js.map +1 -1
  488. package/lib/components/Icon/icons/home.icon.js +1 -1
  489. package/lib/components/Icon/icons/home.icon.js.map +1 -1
  490. package/lib/components/Icon/icons/information-solid.icon.js +1 -1
  491. package/lib/components/Icon/icons/information-solid.icon.js.map +1 -1
  492. package/lib/components/Icon/icons/information.icon.js +1 -1
  493. package/lib/components/Icon/icons/information.icon.js.map +1 -1
  494. package/lib/components/Icon/icons/list-number.icon.d.ts.map +1 -1
  495. package/lib/components/Icon/icons/list-number.icon.js +2 -2
  496. package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
  497. package/lib/components/Icon/icons/list.icon.d.ts.map +1 -1
  498. package/lib/components/Icon/icons/list.icon.js +2 -2
  499. package/lib/components/Icon/icons/list.icon.js.map +1 -1
  500. package/lib/components/Icon/icons/mail-solid.icon.js +1 -1
  501. package/lib/components/Icon/icons/mail-solid.icon.js.map +1 -1
  502. package/lib/components/Icon/icons/mail.icon.js +1 -1
  503. package/lib/components/Icon/icons/mail.icon.js.map +1 -1
  504. package/lib/components/Icon/icons/minus.icon.js +1 -1
  505. package/lib/components/Icon/icons/minus.icon.js.map +1 -1
  506. package/lib/components/Icon/icons/more.icon.js +1 -1
  507. package/lib/components/Icon/icons/more.icon.js.map +1 -1
  508. package/lib/components/Icon/icons/move-left-solid.icon.js +1 -1
  509. package/lib/components/Icon/icons/move-left-solid.icon.js.map +1 -1
  510. package/lib/components/Icon/icons/move-right-solid.icon.js +1 -1
  511. package/lib/components/Icon/icons/move-right-solid.icon.js.map +1 -1
  512. package/lib/components/Icon/icons/open.icon.js +1 -1
  513. package/lib/components/Icon/icons/open.icon.js.map +1 -1
  514. package/lib/components/Icon/icons/paper-clip.icon.js +1 -1
  515. package/lib/components/Icon/icons/paper-clip.icon.js.map +1 -1
  516. package/lib/components/Icon/icons/phone-solid.icon.js +1 -1
  517. package/lib/components/Icon/icons/phone-solid.icon.js.map +1 -1
  518. package/lib/components/Icon/icons/phone.icon.js +1 -1
  519. package/lib/components/Icon/icons/phone.icon.js.map +1 -1
  520. package/lib/components/Icon/icons/picture-solid.icon.js +1 -1
  521. package/lib/components/Icon/icons/picture-solid.icon.js.map +1 -1
  522. package/lib/components/Icon/icons/picture.icon.js +1 -1
  523. package/lib/components/Icon/icons/picture.icon.js.map +1 -1
  524. package/lib/components/Icon/icons/placeholder.icon.d.ts +4 -0
  525. package/lib/components/Icon/icons/placeholder.icon.d.ts.map +1 -0
  526. package/lib/components/Icon/icons/placeholder.icon.js +6 -0
  527. package/lib/components/Icon/icons/placeholder.icon.js.map +1 -0
  528. package/lib/components/Icon/icons/plus.icon.js +1 -1
  529. package/lib/components/Icon/icons/plus.icon.js.map +1 -1
  530. package/lib/components/Icon/icons/polaris-solid.icon.js +1 -1
  531. package/lib/components/Icon/icons/polaris-solid.icon.js.map +1 -1
  532. package/lib/components/Icon/icons/polaris.icon.js +1 -1
  533. package/lib/components/Icon/icons/polaris.icon.js.map +1 -1
  534. package/lib/components/Icon/icons/qr.icon.js +1 -1
  535. package/lib/components/Icon/icons/qr.icon.js.map +1 -1
  536. package/lib/components/Icon/icons/reply-all-solid.icon.js +1 -1
  537. package/lib/components/Icon/icons/reply-all-solid.icon.js.map +1 -1
  538. package/lib/components/Icon/icons/reply-all.icon.js +1 -1
  539. package/lib/components/Icon/icons/reply-all.icon.js.map +1 -1
  540. package/lib/components/Icon/icons/reply-solid.icon.js +1 -1
  541. package/lib/components/Icon/icons/reply-solid.icon.js.map +1 -1
  542. package/lib/components/Icon/icons/reply.icon.js +1 -1
  543. package/lib/components/Icon/icons/reply.icon.js.map +1 -1
  544. package/lib/components/Icon/icons/reset.icon.js +1 -1
  545. package/lib/components/Icon/icons/reset.icon.js.map +1 -1
  546. package/lib/components/Icon/icons/robot-happy-solid.icon.js +1 -1
  547. package/lib/components/Icon/icons/robot-happy-solid.icon.js.map +1 -1
  548. package/lib/components/Icon/icons/robot-happy.icon.js +1 -1
  549. package/lib/components/Icon/icons/robot-happy.icon.js.map +1 -1
  550. package/lib/components/Icon/icons/row-insert.icon.js +1 -1
  551. package/lib/components/Icon/icons/row-insert.icon.js.map +1 -1
  552. package/lib/components/Icon/icons/row.icon.js +1 -1
  553. package/lib/components/Icon/icons/row.icon.js.map +1 -1
  554. package/lib/components/Icon/icons/scale-down.icon.js +1 -1
  555. package/lib/components/Icon/icons/scale-down.icon.js.map +1 -1
  556. package/lib/components/Icon/icons/scale-up-solid.icon.js +1 -1
  557. package/lib/components/Icon/icons/scale-up-solid.icon.js.map +1 -1
  558. package/lib/components/Icon/icons/scale-up.icon.js +1 -1
  559. package/lib/components/Icon/icons/scale-up.icon.js.map +1 -1
  560. package/lib/components/Icon/icons/script.icon.js +1 -1
  561. package/lib/components/Icon/icons/script.icon.js.map +1 -1
  562. package/lib/components/Icon/icons/search-analytics-solid.icon.js +1 -1
  563. package/lib/components/Icon/icons/search-analytics-solid.icon.js.map +1 -1
  564. package/lib/components/Icon/icons/search-analytics.icon.js +1 -1
  565. package/lib/components/Icon/icons/search-analytics.icon.js.map +1 -1
  566. package/lib/components/Icon/icons/search.icon.js +1 -1
  567. package/lib/components/Icon/icons/search.icon.js.map +1 -1
  568. package/lib/components/Icon/icons/send-solid.icon.js +1 -1
  569. package/lib/components/Icon/icons/send-solid.icon.js.map +1 -1
  570. package/lib/components/Icon/icons/send.icon.js +1 -1
  571. package/lib/components/Icon/icons/send.icon.js.map +1 -1
  572. package/lib/components/Icon/icons/slideshow-solid.icon.js +1 -1
  573. package/lib/components/Icon/icons/slideshow-solid.icon.js.map +1 -1
  574. package/lib/components/Icon/icons/slideshow.icon.js +1 -1
  575. package/lib/components/Icon/icons/slideshow.icon.js.map +1 -1
  576. package/lib/components/Icon/icons/snow.icon.js +1 -1
  577. package/lib/components/Icon/icons/snow.icon.js.map +1 -1
  578. package/lib/components/Icon/icons/speaker-solid.icon.js +1 -1
  579. package/lib/components/Icon/icons/speaker-solid.icon.js.map +1 -1
  580. package/lib/components/Icon/icons/speaker.icon.js +1 -1
  581. package/lib/components/Icon/icons/speaker.icon.js.map +1 -1
  582. package/lib/components/Icon/icons/star-solid.icon.js +1 -1
  583. package/lib/components/Icon/icons/star-solid.icon.js.map +1 -1
  584. package/lib/components/Icon/icons/star.icon.js +1 -1
  585. package/lib/components/Icon/icons/star.icon.js.map +1 -1
  586. package/lib/components/Icon/icons/target-solid.icon.js +1 -1
  587. package/lib/components/Icon/icons/target-solid.icon.js.map +1 -1
  588. package/lib/components/Icon/icons/target.icon.js +1 -1
  589. package/lib/components/Icon/icons/target.icon.js.map +1 -1
  590. package/lib/components/Icon/icons/thumbs-up-solid.icon.js +1 -1
  591. package/lib/components/Icon/icons/thumbs-up-solid.icon.js.map +1 -1
  592. package/lib/components/Icon/icons/thumbs-up.icon.js +1 -1
  593. package/lib/components/Icon/icons/thumbs-up.icon.js.map +1 -1
  594. package/lib/components/Icon/icons/times.icon.js +1 -1
  595. package/lib/components/Icon/icons/times.icon.js.map +1 -1
  596. package/lib/components/Icon/icons/trash-solid.icon.js +1 -1
  597. package/lib/components/Icon/icons/trash-solid.icon.js.map +1 -1
  598. package/lib/components/Icon/icons/trash.icon.js +1 -1
  599. package/lib/components/Icon/icons/trash.icon.js.map +1 -1
  600. package/lib/components/Icon/icons/twitter.icon.js +1 -1
  601. package/lib/components/Icon/icons/twitter.icon.js.map +1 -1
  602. package/lib/components/Icon/icons/undock.icon.js +1 -1
  603. package/lib/components/Icon/icons/undock.icon.js.map +1 -1
  604. package/lib/components/Icon/icons/user-solid.icon.js +1 -1
  605. package/lib/components/Icon/icons/user-solid.icon.js.map +1 -1
  606. package/lib/components/Icon/icons/user-star-solid.icon.js +1 -1
  607. package/lib/components/Icon/icons/user-star-solid.icon.js.map +1 -1
  608. package/lib/components/Icon/icons/user-star.icon.js +1 -1
  609. package/lib/components/Icon/icons/user-star.icon.js.map +1 -1
  610. package/lib/components/Icon/icons/user.icon.js +1 -1
  611. package/lib/components/Icon/icons/user.icon.js.map +1 -1
  612. package/lib/components/Icon/icons/warn-solid.icon.js +1 -1
  613. package/lib/components/Icon/icons/warn-solid.icon.js.map +1 -1
  614. package/lib/components/Icon/icons/warn.icon.js +1 -1
  615. package/lib/components/Icon/icons/warn.icon.js.map +1 -1
  616. package/lib/components/Icon/index.d.ts +1 -1
  617. package/lib/components/Icon/index.d.ts.map +1 -1
  618. package/lib/components/Icon/index.js.map +1 -1
  619. package/lib/components/Input/Input.d.ts +3 -1
  620. package/lib/components/Input/Input.d.ts.map +1 -1
  621. package/lib/components/Input/Input.js +16 -2
  622. package/lib/components/Input/Input.js.map +1 -1
  623. package/lib/components/Input/Input.styles.d.ts +1 -0
  624. package/lib/components/Input/Input.styles.d.ts.map +1 -1
  625. package/lib/components/Input/Input.styles.js +31 -0
  626. package/lib/components/Input/Input.styles.js.map +1 -1
  627. package/lib/components/Link/Link.d.ts +4 -1
  628. package/lib/components/Link/Link.d.ts.map +1 -1
  629. package/lib/components/Link/Link.js +87 -30
  630. package/lib/components/Link/Link.js.map +1 -1
  631. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -1
  632. package/lib/components/List/CommaSeparatedList.js +6 -14
  633. package/lib/components/List/CommaSeparatedList.js.map +1 -1
  634. package/lib/components/List/List.d.ts +2 -2
  635. package/lib/components/List/List.d.ts.map +1 -1
  636. package/lib/components/List/List.js.map +1 -1
  637. package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
  638. package/lib/components/ListToolbar/ListToolbar.js +108 -53
  639. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  640. package/lib/components/ListToolbar/ListToolbar.styles.d.ts +1 -0
  641. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  642. package/lib/components/ListToolbar/ListToolbar.styles.js +38 -2
  643. package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
  644. package/lib/components/ListToolbar/ListToolbar.types.d.ts +28 -10
  645. package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
  646. package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
  647. package/lib/components/ListToolbar/PresetMenuPopover.d.ts +12 -0
  648. package/lib/components/ListToolbar/PresetMenuPopover.d.ts.map +1 -0
  649. package/lib/components/ListToolbar/PresetMenuPopover.js +36 -0
  650. package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -0
  651. package/lib/components/ListToolbar/QueryOptionPopover.d.ts.map +1 -1
  652. package/lib/components/ListToolbar/QueryOptionPopover.js +14 -44
  653. package/lib/components/ListToolbar/QueryOptionPopover.js.map +1 -1
  654. package/lib/components/Location/LocationInput.d.ts +3 -1
  655. package/lib/components/Location/LocationInput.d.ts.map +1 -1
  656. package/lib/components/Location/LocationInput.js +2 -2
  657. package/lib/components/Location/LocationInput.js.map +1 -1
  658. package/lib/components/Location/LocationView.d.ts +1 -1
  659. package/lib/components/Location/LocationView.d.ts.map +1 -1
  660. package/lib/components/Location/LocationView.js +16 -10
  661. package/lib/components/Location/LocationView.js.map +1 -1
  662. package/lib/components/Location/utils.d.ts +3 -2
  663. package/lib/components/Location/utils.d.ts.map +1 -1
  664. package/lib/components/Location/utils.js +17 -9
  665. package/lib/components/Location/utils.js.map +1 -1
  666. package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
  667. package/lib/components/Menu/FlyoutMenuList.js +11 -7
  668. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  669. package/lib/components/Menu/Menu.context.d.ts.map +1 -1
  670. package/lib/components/Menu/Menu.context.js +2 -1
  671. package/lib/components/Menu/Menu.context.js.map +1 -1
  672. package/lib/components/Menu/Menu.d.ts.map +1 -1
  673. package/lib/components/Menu/Menu.js +42 -15
  674. package/lib/components/Menu/Menu.js.map +1 -1
  675. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  676. package/lib/components/Menu/Menu.styles.js +4 -2
  677. package/lib/components/Menu/Menu.styles.js.map +1 -1
  678. package/lib/components/Menu/Menu.types.d.ts +14 -0
  679. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  680. package/lib/components/Menu/Menu.types.js.map +1 -1
  681. package/lib/components/Menu/MenuGroup.d.ts.map +1 -1
  682. package/lib/components/Menu/MenuGroup.js +3 -3
  683. package/lib/components/Menu/MenuGroup.js.map +1 -1
  684. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  685. package/lib/components/Menu/MenuItem.js +4 -8
  686. package/lib/components/Menu/MenuItem.js.map +1 -1
  687. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  688. package/lib/components/Menu/MenuList.js +23 -14
  689. package/lib/components/Menu/MenuList.js.map +1 -1
  690. package/lib/components/Menu/NavItemsList.d.ts +2 -2
  691. package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
  692. package/lib/components/Menu/NavItemsList.js +12 -7
  693. package/lib/components/Menu/NavItemsList.js.map +1 -1
  694. package/lib/components/Menu/helpers.d.ts +9 -7
  695. package/lib/components/Menu/helpers.d.ts.map +1 -1
  696. package/lib/components/Menu/helpers.js +16 -13
  697. package/lib/components/Menu/helpers.js.map +1 -1
  698. package/lib/components/Menu/index.d.ts +1 -1
  699. package/lib/components/Menu/index.d.ts.map +1 -1
  700. package/lib/components/Menu/index.js +1 -1
  701. package/lib/components/Menu/index.js.map +1 -1
  702. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  703. package/lib/components/MenuButton/MenuButton.js +13 -11
  704. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  705. package/lib/components/MetaList/MetaList.d.ts.map +1 -1
  706. package/lib/components/MetaList/MetaList.js +13 -10
  707. package/lib/components/MetaList/MetaList.js.map +1 -1
  708. package/lib/components/Modal/Contexts.d.ts.map +1 -1
  709. package/lib/components/Modal/Contexts.js +2 -3
  710. package/lib/components/Modal/Contexts.js.map +1 -1
  711. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  712. package/lib/components/Modal/MinimizedModal.js +2 -5
  713. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  714. package/lib/components/Modal/Modal.d.ts.map +1 -1
  715. package/lib/components/Modal/Modal.js +7 -9
  716. package/lib/components/Modal/Modal.js.map +1 -1
  717. package/lib/components/Modal/Modal.types.d.ts +2 -6
  718. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  719. package/lib/components/Modal/Modal.types.js +1 -2
  720. package/lib/components/Modal/Modal.types.js.map +1 -1
  721. package/lib/components/Modal/ModalManager.d.ts +8 -2
  722. package/lib/components/Modal/ModalManager.d.ts.map +1 -1
  723. package/lib/components/Modal/ModalManager.js +21 -20
  724. package/lib/components/Modal/ModalManager.js.map +1 -1
  725. package/lib/components/Modal/index.d.ts +0 -1
  726. package/lib/components/Modal/index.d.ts.map +1 -1
  727. package/lib/components/Modal/index.js +0 -1
  728. package/lib/components/Modal/index.js.map +1 -1
  729. package/lib/components/MultiStepForm/FormProgress.d.ts +10 -0
  730. package/lib/components/MultiStepForm/FormProgress.d.ts.map +1 -0
  731. package/lib/components/{MultiStep/MultiStep.js → MultiStepForm/FormProgress.js} +8 -22
  732. package/lib/components/MultiStepForm/FormProgress.js.map +1 -0
  733. package/lib/components/{MultiStep/MultiStep.styles.d.ts → MultiStepForm/FormProgress.styles.d.ts} +2 -4
  734. package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -0
  735. package/lib/components/{MultiStep/MultiStep.styles.js → MultiStepForm/FormProgress.styles.js} +4 -8
  736. package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -0
  737. package/lib/components/MultiStepForm/MultiStepForm.d.ts +9 -0
  738. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -0
  739. package/lib/components/MultiStepForm/MultiStepForm.js +50 -0
  740. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -0
  741. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +48 -0
  742. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts.map +1 -0
  743. package/lib/components/MultiStepForm/MultiStepForm.types.js +2 -0
  744. package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -0
  745. package/lib/components/MultiStepForm/index.d.ts +2 -0
  746. package/lib/components/MultiStepForm/index.d.ts.map +1 -0
  747. package/lib/components/MultiStepForm/index.js +2 -0
  748. package/lib/components/MultiStepForm/index.js.map +1 -0
  749. package/lib/components/Number/NumberDisplay.d.ts +0 -5
  750. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  751. package/lib/components/Number/NumberDisplay.js +8 -12
  752. package/lib/components/Number/NumberDisplay.js.map +1 -1
  753. package/lib/components/Number/NumberInput.d.ts +1 -1
  754. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  755. package/lib/components/Number/NumberInput.js +51 -25
  756. package/lib/components/Number/NumberInput.js.map +1 -1
  757. package/lib/components/Number/NumberInput.styles.d.ts +8 -5
  758. package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
  759. package/lib/components/Number/NumberInput.styles.js +8 -3
  760. package/lib/components/Number/NumberInput.styles.js.map +1 -1
  761. package/lib/components/Number/NumberInput.types.d.ts +56 -21
  762. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  763. package/lib/components/Number/NumberInput.types.js.map +1 -1
  764. package/lib/components/Number/NumberRangeInput.d.ts +6 -0
  765. package/lib/components/Number/NumberRangeInput.d.ts.map +1 -0
  766. package/lib/components/Number/NumberRangeInput.js +30 -0
  767. package/lib/components/Number/NumberRangeInput.js.map +1 -0
  768. package/lib/components/Number/index.d.ts +3 -2
  769. package/lib/components/Number/index.d.ts.map +1 -1
  770. package/lib/components/Number/index.js +1 -0
  771. package/lib/components/Number/index.js.map +1 -1
  772. package/lib/components/Number/utils.d.ts +3 -4
  773. package/lib/components/Number/utils.d.ts.map +1 -1
  774. package/lib/components/Number/utils.js +41 -22
  775. package/lib/components/Number/utils.js.map +1 -1
  776. package/lib/components/PageTemplates/CategorySubPage.d.ts +3 -3
  777. package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
  778. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  779. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  780. package/lib/components/PageTemplates/DashboardPage.js +1 -4
  781. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  782. package/lib/components/PageTemplates/PageTemplates.d.ts +1 -2
  783. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  784. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  785. package/lib/components/Phone/PhoneDisplay.d.ts +8 -0
  786. package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
  787. package/lib/components/Phone/PhoneDisplay.js +2 -2
  788. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  789. package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
  790. package/lib/components/Phone/PhoneInput.js +19 -9
  791. package/lib/components/Phone/PhoneInput.js.map +1 -1
  792. package/lib/components/Phone/utils.d.ts +4 -1
  793. package/lib/components/Phone/utils.d.ts.map +1 -1
  794. package/lib/components/Phone/utils.js +4 -2
  795. package/lib/components/Phone/utils.js.map +1 -1
  796. package/lib/components/Popover/Popover.d.ts +4 -1
  797. package/lib/components/Popover/Popover.d.ts.map +1 -1
  798. package/lib/components/Popover/Popover.js +26 -12
  799. package/lib/components/Popover/Popover.js.map +1 -1
  800. package/lib/components/Popover/Popover.styles.d.ts +1 -0
  801. package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
  802. package/lib/components/Popover/Popover.styles.js +19 -58
  803. package/lib/components/Popover/Popover.styles.js.map +1 -1
  804. package/lib/components/Popover/PopoverContext.d.ts +1 -0
  805. package/lib/components/Popover/PopoverContext.d.ts.map +1 -1
  806. package/lib/components/Popover/PopoverContext.js +2 -1
  807. package/lib/components/Popover/PopoverContext.js.map +1 -1
  808. package/lib/components/Popover/PopoverManager.d.ts.map +1 -1
  809. package/lib/components/Popover/PopoverManager.js +2 -1
  810. package/lib/components/Popover/PopoverManager.js.map +1 -1
  811. package/lib/components/Popover/modifiers.d.ts +2 -0
  812. package/lib/components/Popover/modifiers.d.ts.map +1 -1
  813. package/lib/components/Popover/modifiers.js +32 -1
  814. package/lib/components/Popover/modifiers.js.map +1 -1
  815. package/lib/components/Progress/Ring.js +2 -2
  816. package/lib/components/Progress/Ring.js.map +1 -1
  817. package/lib/components/RadioButton/RadioButton.d.ts +3 -1
  818. package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
  819. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  820. package/lib/components/RadioCheck/RadioCheck.d.ts +2 -0
  821. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  822. package/lib/components/RadioCheck/RadioCheck.js +7 -5
  823. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  824. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +3 -0
  825. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  826. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +2 -2
  827. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  828. package/lib/components/RadioCheckGroup/index.d.ts +1 -1
  829. package/lib/components/RadioCheckGroup/index.d.ts.map +1 -1
  830. package/lib/components/RadioCheckGroup/index.js +1 -1
  831. package/lib/components/RadioCheckGroup/index.js.map +1 -1
  832. package/lib/components/SearchInput/SearchInput.d.ts +24 -8
  833. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  834. package/lib/components/SearchInput/SearchInput.js +127 -94
  835. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  836. package/lib/components/SearchInput/SearchInput.styles.d.ts +16 -0
  837. package/lib/components/SearchInput/SearchInput.styles.d.ts.map +1 -0
  838. package/lib/components/SearchInput/SearchInput.styles.js +133 -0
  839. package/lib/components/SearchInput/SearchInput.styles.js.map +1 -0
  840. package/lib/components/SearchInput/index.d.ts +1 -1
  841. package/lib/components/SearchInput/index.d.ts.map +1 -1
  842. package/lib/components/SearchInput/index.js +1 -1
  843. package/lib/components/SearchInput/index.js.map +1 -1
  844. package/lib/components/Select/Select.d.ts +5 -0
  845. package/lib/components/Select/Select.d.ts.map +1 -1
  846. package/lib/components/Select/Select.js +18 -8
  847. package/lib/components/Select/Select.js.map +1 -1
  848. package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
  849. package/lib/components/Sentiment/Sentiment.js +1 -1
  850. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  851. package/lib/components/Skeleton/ParagraphSkeleton.d.ts.map +1 -1
  852. package/lib/components/Skeleton/ParagraphSkeleton.js +2 -2
  853. package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
  854. package/lib/components/SkipLinks/SkipLinks.d.ts +15 -0
  855. package/lib/components/SkipLinks/SkipLinks.d.ts.map +1 -0
  856. package/lib/components/SkipLinks/SkipLinks.js +67 -0
  857. package/lib/components/SkipLinks/SkipLinks.js.map +1 -0
  858. package/lib/components/SkipLinks/index.d.ts +4 -0
  859. package/lib/components/SkipLinks/index.d.ts.map +1 -0
  860. package/lib/components/SkipLinks/index.js +3 -0
  861. package/lib/components/SkipLinks/index.js.map +1 -0
  862. package/lib/components/Slider/Slider.styles.d.ts +1 -1
  863. package/lib/components/SummaryItem/SummaryItem.d.ts +2 -2
  864. package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
  865. package/lib/components/SummaryList/ViewAll.js +6 -2
  866. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  867. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  868. package/lib/components/Tabs/Tab.js +11 -4
  869. package/lib/components/Tabs/Tab.js.map +1 -1
  870. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  871. package/lib/components/Tabs/TabPanel.js +1 -7
  872. package/lib/components/Tabs/TabPanel.js.map +1 -1
  873. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  874. package/lib/components/Tabs/Tabs.js +1 -1
  875. package/lib/components/Tabs/Tabs.js.map +1 -1
  876. package/lib/components/Text/Text.js +2 -2
  877. package/lib/components/Text/Text.js.map +1 -1
  878. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  879. package/lib/components/TextArea/TextArea.js +8 -3
  880. package/lib/components/TextArea/TextArea.js.map +1 -1
  881. package/lib/components/Toaster/Context.d.ts +7 -0
  882. package/lib/components/Toaster/Context.d.ts.map +1 -0
  883. package/lib/components/Toaster/Context.js +6 -0
  884. package/lib/components/Toaster/Context.js.map +1 -0
  885. package/lib/components/Toaster/Toaster.d.ts +8 -40
  886. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  887. package/lib/components/Toaster/Toaster.js +12 -12
  888. package/lib/components/Toaster/Toaster.js.map +1 -1
  889. package/lib/components/Toaster/Toaster.types.d.ts +31 -0
  890. package/lib/components/Toaster/Toaster.types.d.ts.map +1 -0
  891. package/lib/components/Toaster/Toaster.types.js +2 -0
  892. package/lib/components/Toaster/Toaster.types.js.map +1 -0
  893. package/lib/components/Toaster/index.d.ts +1 -2
  894. package/lib/components/Toaster/index.d.ts.map +1 -1
  895. package/lib/components/Toaster/index.js +0 -1
  896. package/lib/components/Toaster/index.js.map +1 -1
  897. package/lib/components/Tooltip/Tooltip.d.ts +6 -1
  898. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  899. package/lib/components/Tooltip/Tooltip.js +24 -5
  900. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  901. package/lib/components/Tree/StandardTree.d.ts.map +1 -1
  902. package/lib/components/Tree/StandardTree.js +27 -13
  903. package/lib/components/Tree/StandardTree.js.map +1 -1
  904. package/lib/components/Tree/StandardTree.styles.js +3 -3
  905. package/lib/components/Tree/StandardTree.styles.js.map +1 -1
  906. package/lib/components/Tree/StandardTree.types.d.ts +1 -0
  907. package/lib/components/Tree/StandardTree.types.d.ts.map +1 -1
  908. package/lib/components/Tree/StandardTree.types.js.map +1 -1
  909. package/lib/hooks/index.d.ts +3 -0
  910. package/lib/hooks/index.d.ts.map +1 -1
  911. package/lib/hooks/index.js +3 -0
  912. package/lib/hooks/index.js.map +1 -1
  913. package/lib/hooks/useActiveDescendant.d.ts +5 -1
  914. package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
  915. package/lib/hooks/useActiveDescendant.js +179 -100
  916. package/lib/hooks/useActiveDescendant.js.map +1 -1
  917. package/lib/hooks/useAutoResize.d.ts +1 -1
  918. package/lib/hooks/useAutoResize.d.ts.map +1 -1
  919. package/lib/hooks/useAutoResize.js +14 -6
  920. package/lib/hooks/useAutoResize.js.map +1 -1
  921. package/lib/hooks/useBreakpoint.d.ts +3 -2
  922. package/lib/hooks/useBreakpoint.d.ts.map +1 -1
  923. package/lib/hooks/useBreakpoint.js +12 -15
  924. package/lib/hooks/useBreakpoint.js.map +1 -1
  925. package/lib/hooks/useConfiguration.d.ts +1 -0
  926. package/lib/hooks/useConfiguration.d.ts.map +1 -1
  927. package/lib/hooks/useConfiguration.js +9 -2
  928. package/lib/hooks/useConfiguration.js.map +1 -1
  929. package/lib/hooks/useDraggable.d.ts +1 -1
  930. package/lib/hooks/useDraggable.d.ts.map +1 -1
  931. package/lib/hooks/useDraggable.js +35 -8
  932. package/lib/hooks/useDraggable.js.map +1 -1
  933. package/lib/hooks/useFocusTrap.d.ts.map +1 -1
  934. package/lib/hooks/useFocusTrap.js +4 -5
  935. package/lib/hooks/useFocusTrap.js.map +1 -1
  936. package/lib/hooks/useFocusWithin.d.ts.map +1 -1
  937. package/lib/hooks/useFocusWithin.js +0 -8
  938. package/lib/hooks/useFocusWithin.js.map +1 -1
  939. package/lib/hooks/useI18n.d.ts +148 -38
  940. package/lib/hooks/useI18n.d.ts.map +1 -1
  941. package/lib/hooks/useI18n.js +2 -1
  942. package/lib/hooks/useI18n.js.map +1 -1
  943. package/lib/hooks/useInputFormatter.d.ts.map +1 -1
  944. package/lib/hooks/useInputFormatter.js +5 -0
  945. package/lib/hooks/useInputFormatter.js.map +1 -1
  946. package/lib/hooks/useLongPress.d.ts +1 -1
  947. package/lib/hooks/useLongPress.d.ts.map +1 -1
  948. package/lib/hooks/useModalContext.d.ts +7 -0
  949. package/lib/hooks/useModalContext.d.ts.map +1 -0
  950. package/lib/hooks/useModalContext.js +12 -0
  951. package/lib/hooks/useModalContext.js.map +1 -0
  952. package/lib/hooks/useModalManager.d.ts +8 -0
  953. package/lib/hooks/useModalManager.d.ts.map +1 -0
  954. package/lib/hooks/useModalManager.js +16 -0
  955. package/lib/hooks/useModalManager.js.map +1 -0
  956. package/lib/hooks/useOS.d.ts.map +1 -1
  957. package/lib/hooks/useOS.js +1 -2
  958. package/lib/hooks/useOS.js.map +1 -1
  959. package/lib/hooks/useScrollStick.d.ts +1 -1
  960. package/lib/hooks/useScrollStick.d.ts.map +1 -1
  961. package/lib/hooks/useToaster.d.ts +8 -0
  962. package/lib/hooks/useToaster.d.ts.map +1 -0
  963. package/lib/hooks/useToaster.js +16 -0
  964. package/lib/hooks/useToaster.js.map +1 -0
  965. package/lib/hooks/useTransitionState.js +1 -1
  966. package/lib/hooks/useTransitionState.js.map +1 -1
  967. package/lib/i18n/default.d.ts +148 -38
  968. package/lib/i18n/default.d.ts.map +1 -1
  969. package/lib/i18n/default.js +175 -53
  970. package/lib/i18n/default.js.map +1 -1
  971. package/lib/i18n/i18n.d.ts +144 -702
  972. package/lib/i18n/i18n.d.ts.map +1 -1
  973. package/lib/i18n/translate.d.ts +4 -2
  974. package/lib/i18n/translate.d.ts.map +1 -1
  975. package/lib/i18n/translate.js.map +1 -1
  976. package/lib/index.d.ts +9 -2
  977. package/lib/index.d.ts.map +1 -1
  978. package/lib/index.js +9 -2
  979. package/lib/index.js.map +1 -1
  980. package/lib/init.d.ts +8 -0
  981. package/lib/init.d.ts.map +1 -0
  982. package/lib/init.js +5 -0
  983. package/lib/init.js.map +1 -0
  984. package/lib/register-contexts.d.ts +2 -0
  985. package/lib/register-contexts.d.ts.map +1 -0
  986. package/lib/register-contexts.js +10 -0
  987. package/lib/register-contexts.js.map +1 -0
  988. package/lib/styles/GlobalStyle.d.ts.map +1 -1
  989. package/lib/styles/GlobalStyle.js +12 -2
  990. package/lib/styles/GlobalStyle.js.map +1 -1
  991. package/lib/styles/utils.d.ts +1 -1
  992. package/lib/styles/utils.d.ts.map +1 -1
  993. package/lib/styles/utils.js.map +1 -1
  994. package/lib/theme/ThemeMachine.d.ts +11 -3
  995. package/lib/theme/ThemeMachine.d.ts.map +1 -1
  996. package/lib/theme/ThemeMachine.js +28 -26
  997. package/lib/theme/ThemeMachine.js.map +1 -1
  998. package/lib/theme/index.d.ts +1 -0
  999. package/lib/theme/index.d.ts.map +1 -1
  1000. package/lib/theme/index.js +1 -0
  1001. package/lib/theme/index.js.map +1 -1
  1002. package/lib/theme/theme.d.ts +56 -2
  1003. package/lib/theme/theme.d.ts.map +1 -1
  1004. package/lib/theme/themeDefinition.json +37 -5
  1005. package/lib/theme/themeOverrides.schema.json +9 -0
  1006. package/lib/theme/themes/buildTheme.json +0 -3
  1007. package/lib/theme/themes/darkTheme.json +3 -1
  1008. package/lib/theme/themes/legacyBuildTheme.json +0 -3
  1009. package/lib/theme/themes/wssTheme.json +6 -0
  1010. package/lib/types/types.d.ts +3 -0
  1011. package/lib/types/types.d.ts.map +1 -1
  1012. package/lib/types/types.js.map +1 -1
  1013. package/lib/utils/utils.d.ts +11 -0
  1014. package/lib/utils/utils.d.ts.map +1 -1
  1015. package/lib/utils/utils.js +39 -0
  1016. package/lib/utils/utils.js.map +1 -1
  1017. package/package.json +13 -10
  1018. package/lib/components/AppShell/SkipNavigation.d.ts +0 -4
  1019. package/lib/components/AppShell/SkipNavigation.d.ts.map +0 -1
  1020. package/lib/components/AppShell/SkipNavigation.js +0 -61
  1021. package/lib/components/AppShell/SkipNavigation.js.map +0 -1
  1022. package/lib/components/Currency/currencyCodes.d.ts +0 -3
  1023. package/lib/components/Currency/currencyCodes.d.ts.map +0 -1
  1024. package/lib/components/Currency/currencyCodes.js +0 -182
  1025. package/lib/components/Currency/currencyCodes.js.map +0 -1
  1026. package/lib/components/DateTime/types.d.ts +0 -9
  1027. package/lib/components/DateTime/types.d.ts.map +0 -1
  1028. package/lib/components/DateTime/types.js +0 -2
  1029. package/lib/components/DateTime/types.js.map +0 -1
  1030. package/lib/components/Icon/icons/script-solid.icon.d.ts.map +0 -1
  1031. package/lib/components/Icon/icons/script-solid.icon.js +0 -6
  1032. package/lib/components/Icon/icons/script-solid.icon.js.map +0 -1
  1033. package/lib/components/MultiStep/MultiStep.d.ts +0 -6
  1034. package/lib/components/MultiStep/MultiStep.d.ts.map +0 -1
  1035. package/lib/components/MultiStep/MultiStep.js.map +0 -1
  1036. package/lib/components/MultiStep/MultiStep.styles.d.ts.map +0 -1
  1037. package/lib/components/MultiStep/MultiStep.styles.js.map +0 -1
  1038. package/lib/components/MultiStep/MultiStep.types.d.ts +0 -36
  1039. package/lib/components/MultiStep/MultiStep.types.d.ts.map +0 -1
  1040. package/lib/components/MultiStep/MultiStep.types.js +0 -2
  1041. package/lib/components/MultiStep/MultiStep.types.js.map +0 -1
  1042. package/lib/components/MultiStep/index.d.ts +0 -3
  1043. package/lib/components/MultiStep/index.d.ts.map +0 -1
  1044. package/lib/components/MultiStep/index.js +0 -2
  1045. package/lib/components/MultiStep/index.js.map +0 -1
@@ -31,7 +31,7 @@ export interface LocationViewProps extends BaseLocationProps, BaseProps {
31
31
  onClick?: (coords: {
32
32
  latitude: number;
33
33
  longitude: number;
34
- name: string;
34
+ name?: string;
35
35
  address?: string;
36
36
  }) => void;
37
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LocationView.d.ts","sourceRoot":"","sources":["../../../src/components/Location/LocationView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOxC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,iBAAiB,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,mBAAmB,yGAK/B,CAAC;AAIF,eAAO,MAAM,kBAAkB;;SAW7B,CAAC;AAkCH,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB,EAAE,SAAS;IACrE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACvC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+IAA+I;IAC/I,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ;AAQD,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA4GvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"LocationView.d.ts","sourceRoot":"","sources":["../../../src/components/Location/LocationView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,iBAAiB,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,mBAAmB,yGAK/B,CAAC;AAIF,eAAO,MAAM,kBAAkB;;SAW7B,CAAC;AAoCH,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB,EAAE,SAAS;IACrE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACvC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+IAA+I;IAC/I,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ;AAQD,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAiHvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -4,9 +4,8 @@ import styled, { css } from 'styled-components';
4
4
  import { defaultThemeProp } from '../../theme';
5
5
  import { hasProp } from '../../utils';
6
6
  import Progress from '../Progress';
7
- import Flex from '../Flex';
8
7
  import { Status } from '../Badges';
9
- import { loadMapsAPI, getCoords, toGoogleLatLng, getPlaceById } from './utils';
8
+ import { loadMapsAPI, getCoords, toGoogleLatLng, getPlaceById, isLatLngObject } from './utils';
10
9
  import MapsContext from './MapsContext';
11
10
  export const StyledLocationError = styled.div `
12
11
  position: absolute;
@@ -41,6 +40,7 @@ const StyledMap = styled.div(({ height, disabled, status, eMessage, theme: { bas
41
40
  `}
42
41
  `;
43
42
  });
43
+ StyledMap.defaultProps = defaultThemeProp;
44
44
  var LoadStatus;
45
45
  (function (LoadStatus) {
46
46
  LoadStatus["Init"] = "init";
@@ -69,13 +69,19 @@ const LocationView = (props) => {
69
69
  });
70
70
  marker.current?.setVisible(false);
71
71
  if (onClick)
72
- map.current.addListener('click', event => {
73
- if (hasProp(event, 'placeId')) {
74
- getPlaceById(event.placeId).then(placeInfo => onClick?.({
75
- ...placeInfo,
76
- latitude: event.latLng.lat(),
77
- longitude: event.latLng.lng()
78
- }));
72
+ map.current.addListener('click', (event) => {
73
+ if (event &&
74
+ typeof event === 'object' &&
75
+ hasProp(event, 'placeId') &&
76
+ typeof event.placeId === 'string') {
77
+ getPlaceById(event.placeId).then(placeInfo => {
78
+ if (hasProp(event, 'latLng') && isLatLngObject(event.latLng))
79
+ onClick?.({
80
+ ...placeInfo,
81
+ latitude: event.latLng.lat(),
82
+ longitude: event.latLng.lng()
83
+ });
84
+ });
79
85
  }
80
86
  });
81
87
  }
@@ -124,7 +130,7 @@ const LocationView = (props) => {
124
130
  onError?.(error);
125
131
  });
126
132
  }, [location, status, zoomLevel, disabled, centerMapOnChange, onError]);
127
- return (_jsxs(StyledLocationView, { height: height, children: [_jsx(Flex, { as: StyledMap, ref: mapElemRef, height: height, disabled: disabled, status: status, eMessage: eMessage, ...restProps }), status === LoadStatus.Init && _jsx(Progress, { placement: 'local' }), status === LoadStatus.Error && eMessage && (_jsx(Status, { as: StyledLocationError, "aria-label": eMessage, variant: 'info', children: eMessage }))] }));
133
+ return (_jsxs(StyledLocationView, { height: height, children: [_jsx(StyledMap, { ref: mapElemRef, height: height, disabled: disabled, status: status, eMessage: eMessage, ...restProps }), status === LoadStatus.Init && _jsx(Progress, { placement: 'local' }), status === LoadStatus.Error && eMessage && (_jsx(Status, { as: StyledLocationError, "aria-label": eMessage, variant: 'info', children: eMessage }))] }));
128
134
  };
129
135
  export default LocationView;
130
136
  //# sourceMappingURL=LocationView.js.map
@@ -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,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,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE/E,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK5C,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAsB,KAAK,CAAC,EAAE;IACxE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAEhC,OAAO,GAAG,CAAA;cACE,MAAM;;;qBAGC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;;GAG7C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GA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,CAAC,OAAO,CAAC,CAAC;YAC3B,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;IAExE,OAAO,CACL,MAAC,kBAAkB,IAAC,MAAM,EAAE,MAAM,aAChC,KAAC,IAAI,IACH,EAAE,EAAE,SAAS,EACb,GAAG,EAAE,UAA0B,EAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,KACd,SAAS,GACb,EACD,MAAM,KAAK,UAAU,CAAC,IAAI,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,GAAG,EAC5D,MAAM,KAAK,UAAU,CAAC,KAAK,IAAI,QAAQ,IAAI,CAC1C,KAAC,MAAM,IAAC,EAAE,EAAE,mBAAmB,gBAAc,QAAQ,EAAE,OAAO,EAAC,MAAM,YAClE,QAAQ,GACF,CACV,IACkB,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.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nB,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;IAExE,OAAO,CACL,MAAC,kBAAkB,IAAC,MAAM,EAAE,MAAM,aAChC,KAAC,SAAS,IACR,GAAG,EAAE,UAAiC,EACtC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,KACd,SAAS,GACb,EACD,MAAM,KAAK,UAAU,CAAC,IAAI,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,GAAG,EAC5D,MAAM,KAAK,UAAU,CAAC,KAAK,IAAI,QAAQ,IAAI,CAC1C,KAAC,MAAM,IAAC,EAAE,EAAE,mBAAmB,gBAAc,QAAQ,EAAE,OAAO,EAAC,MAAM,YAClE,QAAQ,GACF,CACV,IACkB,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 { Status } from '../Badges';\n\nimport { LatLng } from './types';\nimport { loadMapsAPI, getCoords, toGoogleLatLng, getPlaceById, isLatLngObject } 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\nStyledMap.defaultProps = defaultThemeProp;\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>();\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', (event: unknown) => {\n if (\n event &&\n typeof event === 'object' &&\n hasProp(event, 'placeId') &&\n typeof event.placeId === 'string'\n ) {\n getPlaceById(event.placeId).then(placeInfo => {\n if (hasProp(event, 'latLng') && isLatLngObject(event.latLng))\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 <StyledMap\n ref={mapElemRef as Ref<HTMLDivElement>}\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,4 +1,4 @@
1
- /// <reference types="googlemaps" />
1
+ /// <reference types="google.maps" />
2
2
  import { Bias, LatLng, ProviderOpts } from './types';
3
3
  export declare function loadMapsAPI(name?: string, opts?: ProviderOpts): Promise<void>;
4
4
  export declare function getNavigatorPosition(): Promise<LatLng>;
@@ -12,7 +12,7 @@ export declare function getPlacePredictions(location: string, bias?: Bias): Prom
12
12
  }>;
13
13
  export declare function getPlace(location: string, mapElement?: HTMLDivElement): Promise<LatLng>;
14
14
  export declare function getPlaceById(placeId: string, sessionToken?: google.maps.places.AutocompleteSessionToken, mapElement?: HTMLDivElement): Promise<{
15
- name: string;
15
+ name?: string;
16
16
  address?: string;
17
17
  latitude?: number;
18
18
  longitude?: number;
@@ -25,4 +25,5 @@ export declare function getAddress(coords: LatLng): Promise<{
25
25
  latitude?: number;
26
26
  longitude?: number;
27
27
  }>;
28
+ export declare const isLatLngObject: (obj: unknown) => obj is google.maps.LatLng;
28
29
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Location/utils.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,IAAI,EAMJ,MAAM,EAIN,YAAY,EAGb,MAAM,SAAS,CAAC;AAgDjB,wBAAsB,WAAW,CAAC,IAAI,GAAE,MAAW,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvF;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAc5D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,IAAS,GACd,OAAO,CAAC;IACT,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC;CAC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sB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,IAAS,GACd,OAAO,CAAC;IACT,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC;CACpD,CAAC,CAwCD;AAED,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,MAAM,EAChB,UAAU,GAAE,cAA8C,GACzD,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,YAAY,GAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,wBAA4E,EAC7G,UAAU,GAAE,cAA8C,GACzD,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBrF;AAED,0FAA0F;AAC1F,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,UAAU,CAAC,EAAE,cAAc,GAC1B,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAkCpF;AAED,eAAO,MAAM,cAAc,QAAS,OAAO,8BAS1C,CAAC"}
@@ -1,4 +1,4 @@
1
- import { loadScript } from '../../utils';
1
+ import { hasProp, loadScript } from '../../utils';
2
2
  import { CoordsCannotBeParsedError, GeocoderFailedError, GeolocationUnsupportedError, GoogleMapsAPINotFoundError, IsNotAnObjectError, LocationNotFoundError, ProviderNotSupportedError, QUERY_FIELDS, QUERY_TYPES } from './types';
3
3
  const GOOGLE_MAPS_SCRIPT_ID = 'google-map';
4
4
  const providers = {
@@ -94,7 +94,7 @@ export async function getPlacePredictions(location, bias = {}) {
94
94
  ...optionalParams
95
95
  }, (placePredictions, status) => {
96
96
  if (status === google.maps.places.PlacesServiceStatus.OK) {
97
- resolve({ placePredictions, token });
97
+ resolve({ placePredictions: placePredictions ?? [], token });
98
98
  }
99
99
  else {
100
100
  reject(new Error(LocationNotFoundError));
@@ -109,8 +109,8 @@ export async function getPlace(location, mapElement = document.createElement('di
109
109
  placesService.getDetails({ placeId: placePredictions[0]?.place_id, fields: QUERY_FIELDS, sessionToken: token }, (place, pStatus) => {
110
110
  if (pStatus === google.maps.places.PlacesServiceStatus.OK) {
111
111
  resolve({
112
- latitude: place.geometry?.location.lat() || NaN,
113
- longitude: place.geometry?.location.lng() || NaN
112
+ latitude: place?.geometry?.location?.lat() || NaN,
113
+ longitude: place?.geometry?.location?.lng() || NaN
114
114
  });
115
115
  }
116
116
  else {
@@ -125,10 +125,10 @@ export async function getPlaceById(placeId, sessionToken = new google.maps.place
125
125
  placesService.getDetails({ placeId, fields: QUERY_FIELDS, sessionToken }, (place, pStatus) => {
126
126
  if (pStatus === google.maps.places.PlacesServiceStatus.OK) {
127
127
  resolve({
128
- name: place.name,
129
- address: place.formatted_address,
130
- latitude: place.geometry?.location.lat() || NaN,
131
- longitude: place.geometry?.location.lng() || NaN
128
+ name: place?.name,
129
+ address: place?.formatted_address,
130
+ latitude: place?.geometry?.location?.lat() || NaN,
131
+ longitude: place?.geometry?.location?.lng() || NaN
132
132
  });
133
133
  }
134
134
  else {
@@ -166,7 +166,7 @@ export async function getAddress(coords) {
166
166
  return new Promise((resolve, reject) => {
167
167
  geocoder.geocode({ location }, (results, status) => {
168
168
  if (status === 'OK') {
169
- const [result] = results;
169
+ const [result] = results ?? [];
170
170
  if (result) {
171
171
  resolve({
172
172
  name: result.formatted_address,
@@ -191,4 +191,12 @@ export async function getAddress(coords) {
191
191
  });
192
192
  });
193
193
  }
194
+ export const isLatLngObject = (obj) => {
195
+ return (!!obj &&
196
+ typeof obj === 'object' &&
197
+ hasProp(obj, 'lat') &&
198
+ typeof obj.lat === 'function' &&
199
+ hasProp(obj, 'lng') &&
200
+ typeof obj.lng === 'function');
201
+ };
194
202
  //# sourceMappingURL=utils.js.map
@@ -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,6HAA6H;gBAC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C,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,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAElD,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,EA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;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;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAY,EAA6B,EAAE;IACxE,OAAO,CACL,CAAC,CAAC,GAAG;QACL,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC;QACnB,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU;QAC7B,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC;QACnB,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU,CAC9B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { hasProp, 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: 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[] | null, 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\nexport const isLatLngObject = (obj: unknown): obj is google.maps.LatLng => {\n return (\n !!obj &&\n typeof obj === 'object' &&\n hasProp(obj, 'lat') &&\n typeof obj.lat === 'function' &&\n hasProp(obj, 'lng') &&\n typeof obj.lng === 'function'\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;AAQlE,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAoInE,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,CAgJnE,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -11,13 +11,13 @@ import { StyledLoadingItem, StyledMenuList, StyledFlyoutMenuListContainer } from
11
11
  import { resizeRootEl } from './NavItemsList';
12
12
  import helpers from './helpers';
13
13
  import MenuGroup from './MenuGroup';
14
- const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
14
+ const FlyoutMenuList = forwardRef(({ items, parent, menuRole }, ref) => {
15
15
  const selfRef = useConsolidatedRef(ref);
16
16
  const ulRef = useRef(null);
17
17
  const menuListWrapperRef = useRef(null);
18
18
  const returnFocusRef = useRef(null);
19
19
  const [expandedItem, setExpandedItem] = useState();
20
- const { componentId, loadMore, loading, scrollAt, emptyText, onItemExpand, pushFlyoutId, flyOutActiveIdStack } = useContext(MenuContext);
20
+ const { componentId, loadMore, loading, scrollAt, emptyText, onItemExpand, pushFlyoutId, flyOutActiveIdStack, updateActiveDescendants, updateParentDescendantStack } = useContext(MenuContext);
21
21
  useItemIntersection(ulRef, items.length - 1, () => {
22
22
  loadMore?.(parent?.item?.id);
23
23
  }, ':scope > li');
@@ -38,27 +38,31 @@ const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
38
38
  const listContent = useMemo(() => {
39
39
  if (items.length) {
40
40
  return items.map(item => {
41
- return helpers.isItem(item) ? (_createElement(MenuItem, { ...item, key: item.id, "aria-haspopup": !!item.items, "aria-expanded": item.id === expandedItem?.id, onExpand: (id, e) => {
41
+ return helpers.isItem(item) ? (_createElement(MenuItem, { ...item, key: item.id, "aria-haspopup": !!item.items, "aria-expanded": item.id === expandedItem?.id, role: menuRole === 'listbox' ? 'option' : 'menuitem', onExpand: (id, e) => {
42
42
  if (item.items) {
43
43
  returnFocusRef.current = e.currentTarget;
44
44
  setExpandedItem(item); // FIXME
45
45
  item?.onExpand?.(id, e);
46
46
  onItemExpand?.(id, e);
47
47
  pushFlyoutId(item.id || componentId);
48
+ updateActiveDescendants();
49
+ if (updateParentDescendantStack) {
50
+ updateParentDescendantStack(returnFocusRef.current.closest('li'));
51
+ }
48
52
  }
49
53
  else {
50
54
  returnFocusRef.current = null;
51
55
  setExpandedItem(undefined);
52
56
  }
53
- } })) : (_createElement(MenuGroup, { ...item, key: item.id }));
57
+ } })) : (_createElement(MenuGroup, { ...item, key: item.id, itemRole: menuRole === 'listbox' ? 'option' : 'menuitem' }));
54
58
  });
55
59
  }
56
60
  if (!loading) {
57
61
  return _jsx(EmptyState, { message: emptyText, forwardedAs: 'li' });
58
62
  }
59
63
  return null;
60
- }, [items, loading, emptyText, expandedItem]);
61
- const list = (_jsxs(StyledMenuList, { ref: ulRef, children: [listContent, loading && !expandedItem && (_jsx(StyledLoadingItem, { children: _jsx(Progress, { placement: 'local' }) }))] }));
64
+ }, [items, loading, emptyText, expandedItem, flyOutActiveIdStack]);
65
+ const list = (_jsxs(StyledMenuList, { ref: ulRef, role: menuRole, children: [listContent, loading && !expandedItem && (_jsx(StyledLoadingItem, { children: _jsx(Progress, { placement: 'local' }) }))] }));
62
66
  useLayoutEffect(() => {
63
67
  setExpandedItem(undefined);
64
68
  if (selfRef.current) {
@@ -77,7 +81,7 @@ const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
77
81
  siblingItems: items,
78
82
  setExpandedItem,
79
83
  returnFocusRef
80
- } }) }))] }));
84
+ }, menuRole: menuRole }) }))] }));
81
85
  });
82
86
  export default FlyoutMenuList;
83
87
  //# 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,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,EAAE,EAAE;IAC/E,MAAM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ACf,GACD,GACM,CACX,IACA,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(\n ulRef,\n items.length - 1,\n () => {\n loadMore?.(parent?.item?.id);\n },\n ':scope > li'\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
+ {"version":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,IACA,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, menuRole }: 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 updateActiveDescendants,\n updateParentDescendantStack\n } = useContext(MenuContext);\n\n useItemIntersection(\n ulRef,\n items.length - 1,\n () => {\n loadMore?.(parent?.item?.id);\n },\n ':scope > li'\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 role={menuRole === 'listbox' ? 'option' : 'menuitem'}\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 updateActiveDescendants();\n if (updateParentDescendantStack) {\n updateParentDescendantStack(returnFocusRef.current.closest('li'));\n }\n } else {\n returnFocusRef.current = null;\n setExpandedItem(undefined);\n }\n }}\n />\n ) : (\n <MenuGroup\n {...item}\n key={item.id}\n itemRole={menuRole === 'listbox' ? 'option' : 'menuitem'}\n />\n );\n });\n }\n\n if (!loading) {\n return <EmptyState message={emptyText} forwardedAs='li' />;\n }\n\n return null;\n }, [items, loading, emptyText, expandedItem, flyOutActiveIdStack]);\n\n const list = (\n <StyledMenuList ref={ulRef} role={menuRole}>\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 menuRole={menuRole}\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,wBAaG"}
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,wBAcG"}
@@ -12,6 +12,7 @@ export default createContext({
12
12
  updateActiveDescendants: () => null,
13
13
  setFocusDescendant: () => null,
14
14
  setFocusReturnEl: () => null,
15
- getScopedItemId: () => ''
15
+ getScopedItemId: () => '',
16
+ updateParentDescendantStack: () => null
16
17
  });
17
18
  //# sourceMappingURL=Menu.context.js.map
@@ -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,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
+ {"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;IACzB,2BAA2B,EAAE,GAAG,EAAE,CAAC,IAAI;CACxC,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 updateParentDescendantStack: () => null\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;AAWf,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,CA4SrD,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;AAWf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CA2VrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -2,13 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback, useEffect, useState, useRef, useMemo } from 'react';
3
3
  import { useConsolidatedRef, useUID, useActiveDescendant, useLazyDescendant, useI18n, usePrevious, useDirection } from '../../hooks';
4
4
  import { cap } from '../../utils';
5
+ import VisuallyHiddenText from '../VisuallyHiddenText';
5
6
  import FlyoutMenuList from './FlyoutMenuList';
6
7
  import MenuContext from './Menu.context';
7
8
  import { StyledMenu, StyledMenuListWrapper } from './Menu.styles';
8
9
  import MenuList from './MenuList';
9
10
  const Menu = forwardRef((props, ref) => {
10
11
  const uid = useUID();
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;
12
+ 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, 'aria-label': label, role = 'menu', listId, pauseDescendantEvaluation, ...restProps } = props;
12
13
  const t = useI18n();
13
14
  const { end: endDirection, start: startDirection } = useDirection();
14
15
  const radioName = useUID();
@@ -19,6 +20,7 @@ const Menu = forwardRef((props, ref) => {
19
20
  const [flyOutActiveIdStack, setFlyoutActiveIdStack] = useState([id]);
20
21
  const [focusReturnEl, setFocusReturnEl] = useState();
21
22
  const [preventInitialScroll, setPreventInitialScroll] = useState(false);
23
+ const [flyoutFocusReturnStack, setFlyoutFocusReturnStack] = useState([]);
22
24
  const activeFlyoutSelector = useMemo(() => `fieldset[data-flyout-menu-id="${flyOutActiveIdStack[flyOutActiveIdStack.length - 1]}"]`, [flyOutActiveIdStack]);
23
25
  const focusControl = useMemo(() => {
24
26
  return focusControlEl || menuRef.current;
@@ -26,6 +28,12 @@ const Menu = forwardRef((props, ref) => {
26
28
  const pushFlyoutId = useCallback((flyoutId) => {
27
29
  setFlyoutActiveIdStack([...flyOutActiveIdStack, flyoutId]);
28
30
  }, [flyOutActiveIdStack]);
31
+ useEffect(() => {
32
+ setFlyoutActiveIdStack([...flyOutActiveIdStack, id]);
33
+ }, [id]);
34
+ const updateParentDescendantStack = useCallback((item) => {
35
+ setFlyoutFocusReturnStack([...flyoutFocusReturnStack, item]);
36
+ }, [flyoutFocusReturnStack]);
29
37
  const getScopedItemId = useCallback((itemId) => {
30
38
  return `${id}-item-${itemId}`;
31
39
  }, [id]);
@@ -42,7 +50,7 @@ const Menu = forwardRef((props, ref) => {
42
50
  scopeSelector: variant === 'drill-down'
43
51
  ? 'fieldset[aria-hidden="false"]'
44
52
  : activeFlyoutSelector,
45
- selector: '[role="menuitem"], legend button',
53
+ selector: `[role="${role === 'menu' ? 'menuitem' : 'option'}"], legend button`,
46
54
  focusDescendantEl: focusDescendant,
47
55
  clearFocusDescendant: () => {
48
56
  setFocusDescendant(null);
@@ -57,7 +65,8 @@ const Menu = forwardRef((props, ref) => {
57
65
  preventInitialScroll,
58
66
  clearPreventScroll: () => {
59
67
  setPreventInitialScroll(false);
60
- }
68
+ },
69
+ pauseDescendantEvaluation
61
70
  }), [
62
71
  focusControl,
63
72
  menuRef.current,
@@ -65,7 +74,8 @@ const Menu = forwardRef((props, ref) => {
65
74
  focusReturnEl,
66
75
  focusDescendant,
67
76
  currentItemId,
68
- preventInitialScroll
77
+ preventInitialScroll,
78
+ pauseDescendantEvaluation
69
79
  ]);
70
80
  const { activeDescendant, descendants } = useActiveDescendant(uadConfig, [
71
81
  activeDescendantUpdateId
@@ -90,8 +100,18 @@ const Menu = forwardRef((props, ref) => {
90
100
  return;
91
101
  }
92
102
  // collapse
93
- if (activeDescendant.dataset.collapse === 'true' && action !== 'expand') {
94
- activeDescendant.click();
103
+ if (action !== 'expand') {
104
+ if (variant === 'flyout' &&
105
+ flyOutActiveIdStack.length > 1 &&
106
+ flyoutFocusReturnStack.length > 0) {
107
+ setFlyoutActiveIdStack([...flyOutActiveIdStack].slice(0, -1));
108
+ const parentDescendant = flyoutFocusReturnStack.pop();
109
+ if (parentDescendant !== undefined)
110
+ setFocusReturnEl(parentDescendant);
111
+ updateActiveDescendants();
112
+ }
113
+ else if (activeDescendant.dataset.collapse === 'true')
114
+ activeDescendant.click();
95
115
  }
96
116
  }
97
117
  };
@@ -110,12 +130,16 @@ const Menu = forwardRef((props, ref) => {
110
130
  break;
111
131
  }
112
132
  case 'Escape': {
113
- if (variant === 'flyout' && flyOutActiveIdStack.length > 1) {
133
+ if (variant === 'flyout' &&
134
+ flyOutActiveIdStack.length > 1 &&
135
+ flyoutFocusReturnStack.length > 0) {
114
136
  e.preventDefault();
115
137
  e.stopPropagation();
116
- const newStack = [...flyOutActiveIdStack];
117
- newStack.pop();
118
- setFlyoutActiveIdStack(newStack);
138
+ setFlyoutActiveIdStack([...flyOutActiveIdStack].slice(0, -1));
139
+ const parentDescendant = flyoutFocusReturnStack.pop();
140
+ if (parentDescendant !== undefined)
141
+ setFocusReturnEl(parentDescendant);
142
+ updateActiveDescendants();
119
143
  }
120
144
  break;
121
145
  }
@@ -131,11 +155,11 @@ const Menu = forwardRef((props, ref) => {
131
155
  onItemActive?.(getUnscopedItemId(activeDescendant.id));
132
156
  focusControl?.addEventListener('keydown', additionalKeydown);
133
157
  return () => focusControl?.removeEventListener('keydown', additionalKeydown);
134
- }, [focusControl, activeDescendant]);
158
+ }, [focusControl, activeDescendant, flyOutActiveIdStack]);
135
159
  // ## Update useActiveDescendant on change of items, not selection of items.
136
160
  useEffect(() => {
137
161
  // Next tick for DOM updates.
138
- setTimeout(() => {
162
+ const timeoutId = setTimeout(() => {
139
163
  if (items.length === previousItemCount.current) {
140
164
  const previousDescendantIds = descendants?.map(node => node.id);
141
165
  const newDescendants = uadConfig.scope
@@ -159,6 +183,7 @@ const Menu = forwardRef((props, ref) => {
159
183
  previousItemCount.current = items.length;
160
184
  updateActiveDescendants();
161
185
  }, 0);
186
+ return () => clearTimeout(timeoutId);
162
187
  }, [items]);
163
188
  const contextValue = useMemo(() => {
164
189
  return {
@@ -182,7 +207,8 @@ const Menu = forwardRef((props, ref) => {
182
207
  setFocusDescendant,
183
208
  getScopedItemId,
184
209
  pushFlyoutId,
185
- flyOutActiveIdStack
210
+ flyOutActiveIdStack,
211
+ updateParentDescendantStack
186
212
  };
187
213
  }, [
188
214
  id,
@@ -205,9 +231,10 @@ const Menu = forwardRef((props, ref) => {
205
231
  setFocusDescendant,
206
232
  getScopedItemId,
207
233
  pushFlyoutId,
208
- flyOutActiveIdStack
234
+ flyOutActiveIdStack,
235
+ updateParentDescendantStack
209
236
  ]);
210
- return (_jsxs(StyledMenu, { id: id, role: 'menu', "aria-describedby": !focusControlEl ? `${id}-menuDescription` : undefined, ...restProps, ref: menuRef, children: [!focusControlEl && (_jsx("span", { id: `${id}-menuDescription`, hidden: true, children: (`${t('menu_selection_instructions')} ` && ariaDescribedBy) || '' })), header && _jsx("header", { children: header }), _jsx(StyledMenuListWrapper, { children: _jsx(MenuContext.Provider, { value: contextValue, children: variant === 'drill-down' ? (_jsx(MenuList, { items: items })) : (_jsx(FlyoutMenuList, { items: items })) }) }), footer && _jsx("footer", { children: footer })] }));
237
+ return (_jsxs(StyledMenu, { id: id, "aria-describedby": !focusControlEl ? `${id}-menuDescription` : undefined, ...restProps, ref: menuRef, children: [!focusControlEl && (_jsx("span", { id: `${id}-menuDescription`, hidden: true, children: (`${t('menu_selection_instructions')} ` && ariaDescribedBy) || '' })), label && _jsx(VisuallyHiddenText, { id: `${id}-menuLabel`, children: label }), header && _jsx("header", { children: header }), _jsx(StyledMenuListWrapper, { children: _jsx(MenuContext.Provider, { value: contextValue, children: variant === 'drill-down' ? (_jsx(MenuList, { items: items, id: listId, menuRole: role, "aria-labelledby": label ? `${id}-menuLabel` : undefined })) : (_jsx(FlyoutMenuList, { items: items, menuRole: role })) }) }), footer && _jsx("footer", { children: footer })] }));
211
238
  });
212
239
  export default Menu;
213
240
  //# sourceMappingURL=Menu.js.map