@pega/cosmos-react-core 7.0.0-build.9.1 → 7.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (750) hide show
  1. package/lib/components/AIButton/AIButton.d.ts +30 -2
  2. package/lib/components/AIButton/AIButton.d.ts.map +1 -1
  3. package/lib/components/AIButton/AIButton.js +7 -6
  4. package/lib/components/AIButton/AIButton.js.map +1 -1
  5. package/lib/components/Actions/Actions.d.ts +1 -1
  6. package/lib/components/Actions/Actions.d.ts.map +1 -1
  7. package/lib/components/Actions/Actions.js +6 -3
  8. package/lib/components/Actions/Actions.js.map +1 -1
  9. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  10. package/lib/components/AppShell/AppHeader.js +9 -7
  11. package/lib/components/AppShell/AppHeader.js.map +1 -1
  12. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppHeader.styles.js +26 -19
  14. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  15. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShell.js +17 -5
  17. package/lib/components/AppShell/AppShell.js.map +1 -1
  18. package/lib/components/AppShell/AppShell.styles.d.ts +5 -1
  19. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  20. package/lib/components/AppShell/AppShell.styles.js +50 -11
  21. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  22. package/lib/components/AppShell/AppShell.types.d.ts +4 -0
  23. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  24. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  25. package/lib/components/AppShell/AppShellContext.d.ts +3 -1
  26. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  27. package/lib/components/AppShell/AppShellContext.js +3 -1
  28. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  29. package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
  30. package/lib/components/AppShell/AppShellList.styles.js +1 -0
  31. package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
  32. package/lib/components/AppShell/AppShellSearch.styles.d.ts.map +1 -1
  33. package/lib/components/AppShell/AppShellSearch.styles.js +2 -0
  34. package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -1
  35. package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
  36. package/lib/components/AppShell/NavigationList.js +3 -3
  37. package/lib/components/AppShell/NavigationList.js.map +1 -1
  38. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
  39. package/lib/components/AppShell/NavigationListItemWrapper.js +1 -0
  40. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  41. package/lib/components/AppShell/Operator.d.ts +1 -1
  42. package/lib/components/AppShell/style-utils.d.ts +3 -0
  43. package/lib/components/AppShell/style-utils.d.ts.map +1 -1
  44. package/lib/components/AppShell/style-utils.js +40 -1
  45. package/lib/components/AppShell/style-utils.js.map +1 -1
  46. package/lib/components/Avatar/Avatar.d.ts +2 -2
  47. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  48. package/lib/components/Avatar/Avatar.js +19 -19
  49. package/lib/components/Avatar/Avatar.js.map +1 -1
  50. package/lib/components/Avatar/Avatar.test-ids.d.ts +1 -1
  51. package/lib/components/Avatar/Avatar.test-ids.d.ts.map +1 -1
  52. package/lib/components/Backdrop/Backdrop.d.ts +1 -1
  53. package/lib/components/Backdrop/Backdrop.test-ids.d.ts +1 -1
  54. package/lib/components/Backdrop/Backdrop.test-ids.d.ts.map +1 -1
  55. package/lib/components/Badges/Alert.d.ts +1 -1
  56. package/lib/components/Badges/Badges.test-ids.d.ts +6 -6
  57. package/lib/components/Badges/Badges.test-ids.d.ts.map +1 -1
  58. package/lib/components/Badges/Count.d.ts +1 -1
  59. package/lib/components/Badges/Keyboard.d.ts +1 -1
  60. package/lib/components/Badges/Selection.d.ts +1 -1
  61. package/lib/components/Badges/Selection.d.ts.map +1 -1
  62. package/lib/components/Badges/Selection.js +23 -20
  63. package/lib/components/Badges/Selection.js.map +1 -1
  64. package/lib/components/Badges/Status.d.ts +1 -1
  65. package/lib/components/Badges/Status.d.ts.map +1 -1
  66. package/lib/components/Badges/Status.js +0 -1
  67. package/lib/components/Badges/Status.js.map +1 -1
  68. package/lib/components/Badges/Tag.d.ts +1 -1
  69. package/lib/components/Banner/Banner.d.ts +1 -1
  70. package/lib/components/Banner/Banner.d.ts.map +1 -1
  71. package/lib/components/Banner/Banner.js +3 -1
  72. package/lib/components/Banner/Banner.js.map +1 -1
  73. package/lib/components/Banner/Banner.test-ids.d.ts +1 -1
  74. package/lib/components/Banner/Banner.test-ids.d.ts.map +1 -1
  75. package/lib/components/Button/Button.d.ts +1 -1
  76. package/lib/components/Button/Button.d.ts.map +1 -1
  77. package/lib/components/Button/Button.js +87 -58
  78. package/lib/components/Button/Button.js.map +1 -1
  79. package/lib/components/Card/Card.d.ts.map +1 -1
  80. package/lib/components/Card/Card.js +8 -0
  81. package/lib/components/Card/Card.js.map +1 -1
  82. package/lib/components/Checkbox/Checkbox.d.ts +3 -33
  83. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  84. package/lib/components/Checkbox/Checkbox.js +1 -5
  85. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  86. package/lib/components/ColorPicker/ColorPicker.d.ts +6 -23
  87. package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  88. package/lib/components/ColorPicker/ColorPicker.js +3 -4
  89. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  90. package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts +1 -1
  91. package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts.map +1 -1
  92. package/lib/components/ComboBox/ComboBox.d.ts +2 -4
  93. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  94. package/lib/components/ComboBox/ComboBox.js +8 -5
  95. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  96. package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
  97. package/lib/components/ComboBox/ComboBox.styles.js +7 -1
  98. package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
  99. package/lib/components/ComboBox/ComboBox.types.d.ts +8 -26
  100. package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
  101. package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
  102. package/lib/components/ComboBox/ComboxBox.test-ids.d.ts +1 -1
  103. package/lib/components/ComboBox/ComboxBox.test-ids.d.ts.map +1 -1
  104. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  105. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +21 -32
  106. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  107. package/lib/components/CompositeInput/CompositeInput.d.ts +2 -3
  108. package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -1
  109. package/lib/components/CompositeInput/CompositeInput.js +2 -3
  110. package/lib/components/CompositeInput/CompositeInput.js.map +1 -1
  111. package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts +1 -1
  112. package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts.map +1 -1
  113. package/lib/components/CompositeInput/CompositeInput.types.d.ts +4 -13
  114. package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -1
  115. package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -1
  116. package/lib/components/Configuration/Configuration.d.ts +1 -0
  117. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  118. package/lib/components/Configuration/Configuration.js +58 -30
  119. package/lib/components/Configuration/Configuration.js.map +1 -1
  120. package/lib/components/Configuration/ThemeOverride.d.ts +11 -0
  121. package/lib/components/Configuration/ThemeOverride.d.ts.map +1 -0
  122. package/lib/components/Configuration/ThemeOverride.js +23 -0
  123. package/lib/components/Configuration/ThemeOverride.js.map +1 -0
  124. package/lib/components/Configuration/connected-watcher.d.ts +17 -0
  125. package/lib/components/Configuration/connected-watcher.d.ts.map +1 -0
  126. package/lib/components/Configuration/connected-watcher.js +13 -0
  127. package/lib/components/Configuration/connected-watcher.js.map +1 -0
  128. package/lib/components/Configuration/index.d.ts +1 -0
  129. package/lib/components/Configuration/index.d.ts.map +1 -1
  130. package/lib/components/Configuration/index.js +1 -0
  131. package/lib/components/Configuration/index.js.map +1 -1
  132. package/lib/components/Configuration/withConfiguration.d.ts.map +1 -1
  133. package/lib/components/Configuration/withConfiguration.js.map +1 -1
  134. package/lib/components/CreditCard/CreditCard.types.d.ts +5 -25
  135. package/lib/components/CreditCard/CreditCard.types.d.ts.map +1 -1
  136. package/lib/components/CreditCard/CreditCard.types.js.map +1 -1
  137. package/lib/components/CreditCard/CreditCardDisplay.d.ts +2 -4
  138. package/lib/components/CreditCard/CreditCardDisplay.d.ts.map +1 -1
  139. package/lib/components/CreditCard/CreditCardDisplay.js +1 -2
  140. package/lib/components/CreditCard/CreditCardDisplay.js.map +1 -1
  141. package/lib/components/CreditCard/CreditCardInput.d.ts +15 -5
  142. package/lib/components/CreditCard/CreditCardInput.d.ts.map +1 -1
  143. package/lib/components/CreditCard/CreditCardInput.js +1 -2
  144. package/lib/components/CreditCard/CreditCardInput.js.map +1 -1
  145. package/lib/components/Currency/Currency.test-ids.d.ts +1 -1
  146. package/lib/components/Currency/Currency.test-ids.d.ts.map +1 -1
  147. package/lib/components/Currency/CurrencyInput.d.ts +1 -1
  148. package/lib/components/Currency/CurrencyInput.js +1 -1
  149. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  150. package/lib/components/Currency/CurrencyInput.types.d.ts +1 -1
  151. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  152. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  153. package/lib/components/DangerButton/DangerButton.js +2 -2
  154. package/lib/components/DangerButton/DangerButton.js.map +1 -1
  155. package/lib/components/DateTime/DateTime.test-ids.d.ts +11 -11
  156. package/lib/components/DateTime/DateTime.test-ids.d.ts.map +1 -1
  157. package/lib/components/DateTime/DateTime.test-ids.js +5 -1
  158. package/lib/components/DateTime/DateTime.test-ids.js.map +1 -1
  159. package/lib/components/DateTime/Input/DateInput.d.ts +1 -1
  160. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  161. package/lib/components/DateTime/Input/DateInput.js +30 -27
  162. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  163. package/lib/components/DateTime/Input/DateRangeInput.d.ts +1 -1
  164. package/lib/components/DateTime/Input/DateRangeInput.js +2 -2
  165. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  166. package/lib/components/DateTime/Input/DateTime.styles.d.ts +1 -0
  167. package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
  168. package/lib/components/DateTime/Input/DateTime.styles.js +24 -16
  169. package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
  170. package/lib/components/DateTime/Input/DateTimeInput.d.ts +1 -1
  171. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  172. package/lib/components/DateTime/Input/DateTimeInput.js +26 -25
  173. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  174. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +1 -1
  175. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts +1 -1
  176. package/lib/components/DateTime/Input/MonthInput.d.ts +1 -1
  177. package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
  178. package/lib/components/DateTime/Input/MonthInput.js +21 -10
  179. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  180. package/lib/components/DateTime/Input/PartInput.d.ts +1 -1
  181. package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
  182. package/lib/components/DateTime/Input/PartInput.js +13 -7
  183. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  184. package/lib/components/DateTime/Input/QuarterInput.d.ts +1 -1
  185. package/lib/components/DateTime/Input/TimeInput.d.ts +1 -1
  186. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  187. package/lib/components/DateTime/Input/TimeInput.js +2 -7
  188. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  189. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +1 -1
  190. package/lib/components/DateTime/Input/TimeRangeInput.js +3 -3
  191. package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
  192. package/lib/components/DateTime/Input/WeekInput.d.ts +1 -1
  193. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  194. package/lib/components/DateTime/Input/WeekInput.js +17 -6
  195. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  196. package/lib/components/DateTime/Input/utils.d.ts +2 -2
  197. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  198. package/lib/components/DateTime/Input/utils.js +5 -2
  199. package/lib/components/DateTime/Input/utils.js.map +1 -1
  200. package/lib/components/DateTime/Picker/DatePicker.d.ts +1 -1
  201. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  202. package/lib/components/DateTime/Picker/DatePicker.js +28 -17
  203. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  204. package/lib/components/DateTime/Picker/DatePicker.styles.d.ts +1 -0
  205. package/lib/components/DateTime/Picker/DatePicker.styles.d.ts.map +1 -1
  206. package/lib/components/DateTime/Picker/DatePicker.styles.js +13 -5
  207. package/lib/components/DateTime/Picker/DatePicker.styles.js.map +1 -1
  208. package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
  209. package/lib/components/DateTime/Picker/DateRangePicker.js +18 -11
  210. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  211. package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
  212. package/lib/components/DateTime/Picker/TimePicker.js +2 -1
  213. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  214. package/lib/components/DateTime/Picker/utils.d.ts +9 -0
  215. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  216. package/lib/components/DateTime/Picker/utils.js +16 -0
  217. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  218. package/lib/components/DateTime/index.d.ts +1 -1
  219. package/lib/components/DateTime/index.d.ts.map +1 -1
  220. package/lib/components/DateTime/index.js +1 -1
  221. package/lib/components/DateTime/index.js.map +1 -1
  222. package/lib/components/DateTime/utils.d.ts +1 -0
  223. package/lib/components/DateTime/utils.d.ts.map +1 -1
  224. package/lib/components/DateTime/utils.js +13 -11
  225. package/lib/components/DateTime/utils.js.map +1 -1
  226. package/lib/components/Email/EmailDisplay.d.ts.map +1 -1
  227. package/lib/components/Email/EmailDisplay.js +2 -2
  228. package/lib/components/Email/EmailDisplay.js.map +1 -1
  229. package/lib/components/EmptyState/EmptyState.d.ts.map +1 -1
  230. package/lib/components/EmptyState/EmptyState.js +5 -2
  231. package/lib/components/EmptyState/EmptyState.js.map +1 -1
  232. package/lib/components/FieldGroup/FieldGroup.d.ts +6 -0
  233. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  234. package/lib/components/FieldGroup/FieldGroup.js +37 -15
  235. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  236. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  237. package/lib/components/FieldGroup/FieldGroupList.js +39 -20
  238. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  239. package/lib/components/FieldValueList/FieldValueList.d.ts +14 -10
  240. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  241. package/lib/components/FieldValueList/FieldValueList.js +13 -5
  242. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  243. package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts +2 -2
  244. package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts.map +1 -1
  245. package/lib/components/FieldValueList/index.d.ts +1 -1
  246. package/lib/components/FieldValueList/index.d.ts.map +1 -1
  247. package/lib/components/FieldValueList/index.js.map +1 -1
  248. package/lib/components/File/CompactList.d.ts +15 -0
  249. package/lib/components/File/CompactList.d.ts.map +1 -0
  250. package/lib/components/File/CompactList.js +21 -0
  251. package/lib/components/File/CompactList.js.map +1 -0
  252. package/lib/components/File/File.test-ids.d.ts +1 -1
  253. package/lib/components/File/File.test-ids.d.ts.map +1 -1
  254. package/lib/components/File/FileDisplay.d.ts +5 -0
  255. package/lib/components/File/FileDisplay.d.ts.map +1 -1
  256. package/lib/components/File/FileDisplay.js +2 -2
  257. package/lib/components/File/FileDisplay.js.map +1 -1
  258. package/lib/components/File/FileDisplayList.d.ts +4 -2
  259. package/lib/components/File/FileDisplayList.d.ts.map +1 -1
  260. package/lib/components/File/FileDisplayList.js +9 -3
  261. package/lib/components/File/FileDisplayList.js.map +1 -1
  262. package/lib/components/File/FileInput.d.ts +32 -8
  263. package/lib/components/File/FileInput.d.ts.map +1 -1
  264. package/lib/components/File/FileInput.js +169 -74
  265. package/lib/components/File/FileInput.js.map +1 -1
  266. package/lib/components/File/FileInput.styles.d.ts +26 -0
  267. package/lib/components/File/FileInput.styles.d.ts.map +1 -0
  268. package/lib/components/File/FileInput.styles.js +166 -0
  269. package/lib/components/File/FileInput.styles.js.map +1 -0
  270. package/lib/components/File/FileItem.d.ts +16 -0
  271. package/lib/components/File/FileItem.d.ts.map +1 -1
  272. package/lib/components/File/FileItem.js +82 -27
  273. package/lib/components/File/FileItem.js.map +1 -1
  274. package/lib/components/File/FileList.d.ts +9 -3
  275. package/lib/components/File/FileList.d.ts.map +1 -1
  276. package/lib/components/File/FileList.js +53 -9
  277. package/lib/components/File/FileList.js.map +1 -1
  278. package/lib/components/File/FileUploadItem.d.ts +4 -0
  279. package/lib/components/File/FileUploadItem.d.ts.map +1 -1
  280. package/lib/components/File/FileUploadItem.js +42 -38
  281. package/lib/components/File/FileUploadItem.js.map +1 -1
  282. package/lib/components/Flex/Flex.js.map +1 -1
  283. package/lib/components/Form/Form.d.ts +1 -1
  284. package/lib/components/Form/Form.test-ids.d.ts +1 -1
  285. package/lib/components/Form/Form.test-ids.d.ts.map +1 -1
  286. package/lib/components/FormField/FormField.d.ts +2 -2
  287. package/lib/components/FormField/FormField.d.ts.map +1 -1
  288. package/lib/components/FormField/FormField.js +62 -64
  289. package/lib/components/FormField/FormField.js.map +1 -1
  290. package/lib/components/FormField/FormField.test-ids.d.ts +1 -1
  291. package/lib/components/FormField/FormField.test-ids.d.ts.map +1 -1
  292. package/lib/components/Fullscreen/Fullscreen.d.ts +18 -0
  293. package/lib/components/Fullscreen/Fullscreen.d.ts.map +1 -0
  294. package/lib/components/Fullscreen/Fullscreen.js +56 -0
  295. package/lib/components/Fullscreen/Fullscreen.js.map +1 -0
  296. package/lib/components/Fullscreen/Fullscreen.test-ids.d.ts +2 -0
  297. package/lib/components/Fullscreen/Fullscreen.test-ids.d.ts.map +1 -0
  298. package/lib/components/Fullscreen/Fullscreen.test-ids.js +3 -0
  299. package/lib/components/Fullscreen/Fullscreen.test-ids.js.map +1 -0
  300. package/lib/components/Fullscreen/FullscreenButton.d.ts +6 -0
  301. package/lib/components/Fullscreen/FullscreenButton.d.ts.map +1 -0
  302. package/lib/components/Fullscreen/FullscreenButton.js +33 -0
  303. package/lib/components/Fullscreen/FullscreenButton.js.map +1 -0
  304. package/lib/components/Fullscreen/index.d.ts +4 -0
  305. package/lib/components/Fullscreen/index.d.ts.map +1 -0
  306. package/lib/components/Fullscreen/index.js +4 -0
  307. package/lib/components/Fullscreen/index.js.map +1 -0
  308. package/lib/components/HTML/HTML.d.ts +1 -1
  309. package/lib/components/HTML/HTML.test-ids.d.ts +1 -1
  310. package/lib/components/HTML/HTML.test-ids.d.ts.map +1 -1
  311. package/lib/components/Icon/Icon.d.ts.map +1 -1
  312. package/lib/components/Icon/Icon.js +2 -2
  313. package/lib/components/Icon/Icon.js.map +1 -1
  314. package/lib/components/Icon/iconNames.d.ts +1 -1
  315. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  316. package/lib/components/Icon/iconNames.js +2 -0
  317. package/lib/components/Icon/iconNames.js.map +1 -1
  318. package/lib/components/Icon/icons/calendar-now.icon.d.ts +5 -0
  319. package/lib/components/Icon/icons/calendar-now.icon.d.ts.map +1 -0
  320. package/lib/components/Icon/icons/calendar-now.icon.js +7 -0
  321. package/lib/components/Icon/icons/calendar-now.icon.js.map +1 -0
  322. package/lib/components/Icon/icons/preview.icon.d.ts +5 -0
  323. package/lib/components/Icon/icons/preview.icon.d.ts.map +1 -0
  324. package/lib/components/Icon/icons/preview.icon.js +7 -0
  325. package/lib/components/Icon/icons/preview.icon.js.map +1 -0
  326. package/lib/components/Icon/streamline-icons/arrow-down.icon.d.ts.map +1 -1
  327. package/lib/components/Icon/streamline-icons/arrow-down.icon.js +1 -1
  328. package/lib/components/Icon/streamline-icons/arrow-down.icon.js.map +1 -1
  329. package/lib/components/Icon/streamline-icons/arrow-left.icon.d.ts.map +1 -1
  330. package/lib/components/Icon/streamline-icons/arrow-left.icon.js +1 -1
  331. package/lib/components/Icon/streamline-icons/arrow-left.icon.js.map +1 -1
  332. package/lib/components/Icon/streamline-icons/arrow-right.icon.d.ts.map +1 -1
  333. package/lib/components/Icon/streamline-icons/arrow-right.icon.js +1 -1
  334. package/lib/components/Icon/streamline-icons/arrow-right.icon.js.map +1 -1
  335. package/lib/components/Icon/streamline-icons/arrow-up.icon.d.ts.map +1 -1
  336. package/lib/components/Icon/streamline-icons/arrow-up.icon.js +1 -1
  337. package/lib/components/Icon/streamline-icons/arrow-up.icon.js.map +1 -1
  338. package/lib/components/Icon/streamline-icons/calendar-now.icon.d.ts +5 -0
  339. package/lib/components/Icon/streamline-icons/calendar-now.icon.d.ts.map +1 -0
  340. package/lib/components/Icon/streamline-icons/calendar-now.icon.js +7 -0
  341. package/lib/components/Icon/streamline-icons/calendar-now.icon.js.map +1 -0
  342. package/lib/components/Icon/streamline-icons/caret-down.icon.d.ts.map +1 -1
  343. package/lib/components/Icon/streamline-icons/caret-down.icon.js +1 -1
  344. package/lib/components/Icon/streamline-icons/caret-down.icon.js.map +1 -1
  345. package/lib/components/Icon/streamline-icons/caret-left.icon.d.ts.map +1 -1
  346. package/lib/components/Icon/streamline-icons/caret-left.icon.js +1 -1
  347. package/lib/components/Icon/streamline-icons/caret-left.icon.js.map +1 -1
  348. package/lib/components/Icon/streamline-icons/caret-right.icon.d.ts.map +1 -1
  349. package/lib/components/Icon/streamline-icons/caret-right.icon.js +1 -1
  350. package/lib/components/Icon/streamline-icons/caret-right.icon.js.map +1 -1
  351. package/lib/components/Icon/streamline-icons/caret-up.icon.d.ts.map +1 -1
  352. package/lib/components/Icon/streamline-icons/caret-up.icon.js +1 -1
  353. package/lib/components/Icon/streamline-icons/caret-up.icon.js.map +1 -1
  354. package/lib/components/Icon/streamline-icons/case-solid.icon.js +1 -1
  355. package/lib/components/Icon/streamline-icons/case-solid.icon.js.map +1 -1
  356. package/lib/components/Icon/streamline-icons/clipboard-pencil-solid.icon.js +1 -1
  357. package/lib/components/Icon/streamline-icons/clipboard-pencil-solid.icon.js.map +1 -1
  358. package/lib/components/Icon/streamline-icons/clock-solid.icon.js +1 -1
  359. package/lib/components/Icon/streamline-icons/clock-solid.icon.js.map +1 -1
  360. package/lib/components/Icon/streamline-icons/disc-stack-solid.icon.d.ts.map +1 -1
  361. package/lib/components/Icon/streamline-icons/disc-stack-solid.icon.js +1 -1
  362. package/lib/components/Icon/streamline-icons/disc-stack-solid.icon.js.map +1 -1
  363. package/lib/components/Icon/streamline-icons/dock.icon.d.ts +5 -0
  364. package/lib/components/Icon/streamline-icons/dock.icon.d.ts.map +1 -0
  365. package/lib/components/Icon/streamline-icons/dock.icon.js +7 -0
  366. package/lib/components/Icon/streamline-icons/dock.icon.js.map +1 -0
  367. package/lib/components/Icon/streamline-icons/expression.icon.d.ts +5 -0
  368. package/lib/components/Icon/streamline-icons/expression.icon.d.ts.map +1 -0
  369. package/lib/components/Icon/streamline-icons/expression.icon.js +7 -0
  370. package/lib/components/Icon/streamline-icons/expression.icon.js.map +1 -0
  371. package/lib/components/Icon/streamline-icons/indent.icon.d.ts +5 -0
  372. package/lib/components/Icon/streamline-icons/indent.icon.d.ts.map +1 -0
  373. package/lib/components/Icon/streamline-icons/indent.icon.js +7 -0
  374. package/lib/components/Icon/streamline-icons/indent.icon.js.map +1 -0
  375. package/lib/components/Icon/streamline-icons/information-solid.icon.js +1 -1
  376. package/lib/components/Icon/streamline-icons/information-solid.icon.js.map +1 -1
  377. package/lib/components/Icon/streamline-icons/list-number.icon.d.ts +5 -0
  378. package/lib/components/Icon/streamline-icons/list-number.icon.d.ts.map +1 -0
  379. package/lib/components/Icon/streamline-icons/list-number.icon.js +7 -0
  380. package/lib/components/Icon/streamline-icons/list-number.icon.js.map +1 -0
  381. package/lib/components/Icon/streamline-icons/open.icon.d.ts.map +1 -1
  382. package/lib/components/Icon/streamline-icons/open.icon.js +1 -1
  383. package/lib/components/Icon/streamline-icons/open.icon.js.map +1 -1
  384. package/lib/components/Icon/streamline-icons/rule-library-solid.icon.js +1 -1
  385. package/lib/components/Icon/streamline-icons/rule-library-solid.icon.js.map +1 -1
  386. package/lib/components/Icon/streamline-icons/search-analytics-solid.icon.js +1 -1
  387. package/lib/components/Icon/streamline-icons/search-analytics-solid.icon.js.map +1 -1
  388. package/lib/components/Icon/streamline-icons/undock.icon.d.ts +5 -0
  389. package/lib/components/Icon/streamline-icons/undock.icon.d.ts.map +1 -0
  390. package/lib/components/Icon/streamline-icons/undock.icon.js +7 -0
  391. package/lib/components/Icon/streamline-icons/undock.icon.js.map +1 -0
  392. package/lib/components/Icon/streamline-icons/unindent.icon.d.ts +5 -0
  393. package/lib/components/Icon/streamline-icons/unindent.icon.d.ts.map +1 -0
  394. package/lib/components/Icon/streamline-icons/unindent.icon.js +7 -0
  395. package/lib/components/Icon/streamline-icons/unindent.icon.js.map +1 -0
  396. package/lib/components/Icon/streamline-icons/warn-solid.icon.js +1 -1
  397. package/lib/components/Icon/streamline-icons/warn-solid.icon.js.map +1 -1
  398. package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
  399. package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
  400. package/lib/components/Icon/streamlineIconNames.js +7 -0
  401. package/lib/components/Icon/streamlineIconNames.js.map +1 -1
  402. package/lib/components/IconPicker/IconPicker.d.ts +7 -1
  403. package/lib/components/IconPicker/IconPicker.d.ts.map +1 -1
  404. package/lib/components/IconPicker/IconPicker.js +20 -14
  405. package/lib/components/IconPicker/IconPicker.js.map +1 -1
  406. package/lib/components/Input/Input.d.ts +5 -8
  407. package/lib/components/Input/Input.d.ts.map +1 -1
  408. package/lib/components/Input/Input.js +2 -3
  409. package/lib/components/Input/Input.js.map +1 -1
  410. package/lib/components/Input/Input.test-ids.d.ts +1 -1
  411. package/lib/components/Input/Input.test-ids.d.ts.map +1 -1
  412. package/lib/components/Lightbox/Lightbox.d.ts +1 -1
  413. package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
  414. package/lib/components/Lightbox/Lightbox.js +13 -6
  415. package/lib/components/Lightbox/Lightbox.js.map +1 -1
  416. package/lib/components/Lightbox/Lightbox.styles.d.ts +1 -1
  417. package/lib/components/Lightbox/Lightbox.test-ids.d.ts +1 -1
  418. package/lib/components/Lightbox/Lightbox.test-ids.d.ts.map +1 -1
  419. package/lib/components/Lightbox/Lightbox.types.d.ts +1 -1
  420. package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -1
  421. package/lib/components/Lightbox/Lightbox.types.js.map +1 -1
  422. package/lib/components/Link/Link.d.ts +5 -2
  423. package/lib/components/Link/Link.d.ts.map +1 -1
  424. package/lib/components/Link/Link.js +45 -17
  425. package/lib/components/Link/Link.js.map +1 -1
  426. package/lib/components/Link/Link.test-ids.d.ts +1 -1
  427. package/lib/components/Link/Link.test-ids.d.ts.map +1 -1
  428. package/lib/components/ListToolbar/ListToolbar.d.ts +1 -1
  429. package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
  430. package/lib/components/ListToolbar/ListToolbar.js +8 -7
  431. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  432. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  433. package/lib/components/ListToolbar/ListToolbar.styles.js +5 -5
  434. package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
  435. package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts +1 -1
  436. package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts.map +1 -1
  437. package/lib/components/ListToolbar/ListToolbar.test-ids.js +4 -1
  438. package/lib/components/ListToolbar/ListToolbar.test-ids.js.map +1 -1
  439. package/lib/components/ListToolbar/ListToolbar.types.d.ts +7 -3
  440. package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
  441. package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
  442. package/lib/components/ListToolbar/PresetMenuPopover.d.ts.map +1 -1
  443. package/lib/components/ListToolbar/PresetMenuPopover.js +2 -2
  444. package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
  445. package/lib/components/ListToolbar/helpers.d.ts.map +1 -1
  446. package/lib/components/ListToolbar/helpers.js.map +1 -1
  447. package/lib/components/Location/CurrentLocationButton.d.ts +1 -6
  448. package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
  449. package/lib/components/Location/CurrentLocationButton.js +10 -20
  450. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  451. package/lib/components/Location/Location.test-ids.d.ts +1 -1
  452. package/lib/components/Location/Location.test-ids.d.ts.map +1 -1
  453. package/lib/components/Location/Location.types.d.ts +49 -17
  454. package/lib/components/Location/Location.types.d.ts.map +1 -1
  455. package/lib/components/Location/Location.types.js +9 -1
  456. package/lib/components/Location/Location.types.js.map +1 -1
  457. package/lib/components/Location/LocationDisplay.d.ts +5 -4
  458. package/lib/components/Location/LocationDisplay.d.ts.map +1 -1
  459. package/lib/components/Location/LocationDisplay.js +17 -4
  460. package/lib/components/Location/LocationDisplay.js.map +1 -1
  461. package/lib/components/Location/LocationInput.d.ts +23 -18
  462. package/lib/components/Location/LocationInput.d.ts.map +1 -1
  463. package/lib/components/Location/LocationInput.js +37 -15
  464. package/lib/components/Location/LocationInput.js.map +1 -1
  465. package/lib/components/Location/LocationView.d.ts +26 -12
  466. package/lib/components/Location/LocationView.d.ts.map +1 -1
  467. package/lib/components/Location/LocationView.js +103 -50
  468. package/lib/components/Location/LocationView.js.map +1 -1
  469. package/lib/components/Location/index.d.ts +2 -2
  470. package/lib/components/Location/index.d.ts.map +1 -1
  471. package/lib/components/Location/index.js +1 -1
  472. package/lib/components/Location/index.js.map +1 -1
  473. package/lib/components/Location/utils.d.ts +2 -2
  474. package/lib/components/Location/utils.d.ts.map +1 -1
  475. package/lib/components/Location/utils.js +67 -38
  476. package/lib/components/Location/utils.js.map +1 -1
  477. package/lib/components/Menu/Menu.context.d.ts.map +1 -1
  478. package/lib/components/Menu/Menu.context.js +1 -0
  479. package/lib/components/Menu/Menu.context.js.map +1 -1
  480. package/lib/components/Menu/Menu.d.ts +1 -1
  481. package/lib/components/Menu/Menu.d.ts.map +1 -1
  482. package/lib/components/Menu/Menu.js +6 -2
  483. package/lib/components/Menu/Menu.js.map +1 -1
  484. package/lib/components/Menu/Menu.styles.d.ts +0 -1
  485. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  486. package/lib/components/Menu/Menu.styles.js +2 -9
  487. package/lib/components/Menu/Menu.styles.js.map +1 -1
  488. package/lib/components/Menu/Menu.test-ids.d.ts +2 -2
  489. package/lib/components/Menu/Menu.test-ids.d.ts.map +1 -1
  490. package/lib/components/Menu/Menu.types.d.ts +14 -2
  491. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  492. package/lib/components/Menu/Menu.types.js.map +1 -1
  493. package/lib/components/Menu/Menu.utils.d.ts +4 -0
  494. package/lib/components/Menu/Menu.utils.d.ts.map +1 -0
  495. package/lib/components/Menu/Menu.utils.js +6 -0
  496. package/lib/components/Menu/Menu.utils.js.map +1 -0
  497. package/lib/components/Menu/MenuGroup.js +2 -2
  498. package/lib/components/Menu/MenuGroup.js.map +1 -1
  499. package/lib/components/Menu/MenuItem.d.ts +1 -1
  500. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  501. package/lib/components/Menu/MenuItem.js +3 -3
  502. package/lib/components/Menu/MenuItem.js.map +1 -1
  503. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  504. package/lib/components/Menu/MenuList.js +3 -3
  505. package/lib/components/Menu/MenuList.js.map +1 -1
  506. package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
  507. package/lib/components/Menu/NavItemsList.js +1 -3
  508. package/lib/components/Menu/NavItemsList.js.map +1 -1
  509. package/lib/components/Menu/index.d.ts +1 -0
  510. package/lib/components/Menu/index.d.ts.map +1 -1
  511. package/lib/components/Menu/index.js +1 -0
  512. package/lib/components/Menu/index.js.map +1 -1
  513. package/lib/components/MenuButton/MenuButton.d.ts +8 -1
  514. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  515. package/lib/components/MenuButton/MenuButton.js +24 -14
  516. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  517. package/lib/components/MenuButton/MenuButton.test-ids.d.ts +1 -1
  518. package/lib/components/MenuButton/MenuButton.test-ids.d.ts.map +1 -1
  519. package/lib/components/MetaList/MetaList.d.ts +1 -1
  520. package/lib/components/MetaList/MetaList.test-ids.d.ts +1 -1
  521. package/lib/components/MetaList/MetaList.test-ids.d.ts.map +1 -1
  522. package/lib/components/Modal/Modal.d.ts.map +1 -1
  523. package/lib/components/Modal/Modal.js +31 -7
  524. package/lib/components/Modal/Modal.js.map +1 -1
  525. package/lib/components/Modal/Modal.styles.d.ts +3 -1
  526. package/lib/components/Modal/Modal.styles.d.ts.map +1 -1
  527. package/lib/components/Modal/Modal.styles.js +34 -17
  528. package/lib/components/Modal/Modal.styles.js.map +1 -1
  529. package/lib/components/Modal/ModalManager.d.ts.map +1 -1
  530. package/lib/components/Modal/ModalManager.js +5 -1
  531. package/lib/components/Modal/ModalManager.js.map +1 -1
  532. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
  533. package/lib/components/MultiStepForm/MultiStepForm.js +28 -1
  534. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  535. package/lib/components/Number/Number.test-ids.d.ts +2 -2
  536. package/lib/components/Number/Number.test-ids.d.ts.map +1 -1
  537. package/lib/components/Number/NumberDisplay.d.ts +5 -8
  538. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  539. package/lib/components/Number/NumberDisplay.js +1 -2
  540. package/lib/components/Number/NumberDisplay.js.map +1 -1
  541. package/lib/components/Number/NumberInput.d.ts +2 -4
  542. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  543. package/lib/components/Number/NumberInput.js +15 -7
  544. package/lib/components/Number/NumberInput.js.map +1 -1
  545. package/lib/components/Number/NumberInput.types.d.ts +12 -30
  546. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  547. package/lib/components/Number/NumberInput.types.js.map +1 -1
  548. package/lib/components/Number/NumberRangeInput.d.ts +2 -4
  549. package/lib/components/Number/NumberRangeInput.d.ts.map +1 -1
  550. package/lib/components/Number/NumberRangeInput.js +7 -72
  551. package/lib/components/Number/NumberRangeInput.js.map +1 -1
  552. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +3 -1
  553. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  554. package/lib/components/PageTemplates/CategorySubPage.styles.js +2 -0
  555. package/lib/components/PageTemplates/CategorySubPage.styles.js.map +1 -1
  556. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  557. package/lib/components/PageTemplates/DashboardPage.js +41 -6
  558. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  559. package/lib/components/PageTemplates/PageTemplates.d.ts +1 -0
  560. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  561. package/lib/components/PageTemplates/PageTemplates.js +85 -31
  562. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  563. package/lib/components/Phone/Phone.test-ids.d.ts +1 -1
  564. package/lib/components/Phone/Phone.test-ids.d.ts.map +1 -1
  565. package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
  566. package/lib/components/Phone/PhoneDisplay.js +2 -2
  567. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  568. package/lib/components/Phone/PhoneInput.d.ts +1 -1
  569. package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
  570. package/lib/components/Phone/PhoneInput.js +20 -5
  571. package/lib/components/Phone/PhoneInput.js.map +1 -1
  572. package/lib/components/Popover/Popover.d.ts +2 -0
  573. package/lib/components/Popover/Popover.d.ts.map +1 -1
  574. package/lib/components/Popover/Popover.js +20 -3
  575. package/lib/components/Popover/Popover.js.map +1 -1
  576. package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
  577. package/lib/components/Popover/Popover.styles.js +2 -2
  578. package/lib/components/Popover/Popover.styles.js.map +1 -1
  579. package/lib/components/Popover/modifiers.d.ts.map +1 -1
  580. package/lib/components/Popover/modifiers.js +11 -5
  581. package/lib/components/Popover/modifiers.js.map +1 -1
  582. package/lib/components/Progress/Progress.d.ts.map +1 -1
  583. package/lib/components/Progress/Progress.js +2 -2
  584. package/lib/components/Progress/Progress.js.map +1 -1
  585. package/lib/components/Progress/Progress.styles.d.ts +1 -1
  586. package/lib/components/Progress/Progress.styles.d.ts.map +1 -1
  587. package/lib/components/Progress/Progress.styles.js +7 -7
  588. package/lib/components/Progress/Progress.styles.js.map +1 -1
  589. package/lib/components/Progress/Progress.types.d.ts +4 -0
  590. package/lib/components/Progress/Progress.types.d.ts.map +1 -1
  591. package/lib/components/Progress/Progress.types.js.map +1 -1
  592. package/lib/components/RadioCheck/RadioCheck.d.ts +6 -30
  593. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  594. package/lib/components/RadioCheck/RadioCheck.js +1 -2
  595. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  596. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  597. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +1 -1
  598. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  599. package/lib/components/SearchInput/SearchInput.d.ts +19 -6
  600. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  601. package/lib/components/SearchInput/SearchInput.js +5 -1
  602. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  603. package/lib/components/SearchInput/SearchInput.styles.d.ts +3 -3
  604. package/lib/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  605. package/lib/components/SearchInput/SearchInput.styles.js +15 -15
  606. package/lib/components/SearchInput/SearchInput.styles.js.map +1 -1
  607. package/lib/components/Select/Select.d.ts +1 -1
  608. package/lib/components/Select/Select.test-ids.d.ts +1 -1
  609. package/lib/components/Select/Select.test-ids.d.ts.map +1 -1
  610. package/lib/components/Slider/Slider.d.ts +1 -1
  611. package/lib/components/Slider/Slider.js +1 -1
  612. package/lib/components/Slider/Slider.js.map +1 -1
  613. package/lib/components/Slider/Slider.styles.d.ts +1 -1
  614. package/lib/components/Slider/Slider.test-ids.d.ts +1 -1
  615. package/lib/components/Slider/Slider.test-ids.d.ts.map +1 -1
  616. package/lib/components/SummaryItem/SummaryItem.d.ts +6 -1
  617. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  618. package/lib/components/SummaryItem/SummaryItem.js +13 -5
  619. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  620. package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts +1 -1
  621. package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts.map +1 -1
  622. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  623. package/lib/components/SummaryList/SummaryList.js +9 -9
  624. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  625. package/lib/components/Tabs/Tab.d.ts +7 -3
  626. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  627. package/lib/components/Tabs/Tab.js +83 -23
  628. package/lib/components/Tabs/Tab.js.map +1 -1
  629. package/lib/components/Tabs/TabPanel.d.ts +13 -2
  630. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  631. package/lib/components/Tabs/TabPanel.js +60 -5
  632. package/lib/components/Tabs/TabPanel.js.map +1 -1
  633. package/lib/components/Tabs/Tabs.d.ts +0 -1
  634. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  635. package/lib/components/Tabs/Tabs.js +97 -35
  636. package/lib/components/Tabs/Tabs.js.map +1 -1
  637. package/lib/components/Tabs/Tabs.styles.d.ts +17 -0
  638. package/lib/components/Tabs/Tabs.styles.d.ts.map +1 -0
  639. package/lib/components/Tabs/Tabs.styles.js +110 -0
  640. package/lib/components/Tabs/Tabs.styles.js.map +1 -0
  641. package/lib/components/Tabs/TabsContext.d.ts +6 -0
  642. package/lib/components/Tabs/TabsContext.d.ts.map +1 -0
  643. package/lib/components/Tabs/TabsContext.js +6 -0
  644. package/lib/components/Tabs/TabsContext.js.map +1 -0
  645. package/lib/components/Tabs/index.d.ts +1 -0
  646. package/lib/components/Tabs/index.d.ts.map +1 -1
  647. package/lib/components/Tabs/index.js +1 -0
  648. package/lib/components/Tabs/index.js.map +1 -1
  649. package/lib/components/Text/Text.js +1 -1
  650. package/lib/components/Text/Text.js.map +1 -1
  651. package/lib/components/TextArea/TextArea.d.ts +1 -1
  652. package/lib/components/TextArea/TextArea.test-ids.d.ts +1 -1
  653. package/lib/components/TextArea/TextArea.test-ids.d.ts.map +1 -1
  654. package/lib/components/Toaster/Toaster.d.ts +1 -1
  655. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  656. package/lib/components/Toaster/Toaster.js +117 -21
  657. package/lib/components/Toaster/Toaster.js.map +1 -1
  658. package/lib/components/Toaster/Toaster.test-ids.d.ts +1 -1
  659. package/lib/components/Toaster/Toaster.test-ids.d.ts.map +1 -1
  660. package/lib/components/Toaster/Toaster.types.d.ts +17 -4
  661. package/lib/components/Toaster/Toaster.types.d.ts.map +1 -1
  662. package/lib/components/Toaster/Toaster.types.js.map +1 -1
  663. package/lib/components/Tooltip/Tooltip.d.ts +8 -3
  664. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  665. package/lib/components/Tooltip/Tooltip.js +20 -5
  666. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  667. package/lib/components/Tooltip/Tooltip.test-ids.d.ts +1 -1
  668. package/lib/components/Tooltip/Tooltip.test-ids.d.ts.map +1 -1
  669. package/lib/components/Tree/StandardTree.styles.d.ts +1 -1
  670. package/lib/components/Tree/Tree.d.ts +1 -1
  671. package/lib/components/Tree/Tree.test-ids.d.ts +2 -2
  672. package/lib/components/Tree/Tree.test-ids.d.ts.map +1 -1
  673. package/lib/hooks/index.d.ts +2 -0
  674. package/lib/hooks/index.d.ts.map +1 -1
  675. package/lib/hooks/index.js +2 -0
  676. package/lib/hooks/index.js.map +1 -1
  677. package/lib/hooks/useArrows.d.ts.map +1 -1
  678. package/lib/hooks/useArrows.js +3 -1
  679. package/lib/hooks/useArrows.js.map +1 -1
  680. package/lib/hooks/useEvent.d.ts +5 -0
  681. package/lib/hooks/useEvent.d.ts.map +1 -1
  682. package/lib/hooks/useEvent.js.map +1 -1
  683. package/lib/hooks/useFocusWithin.d.ts.map +1 -1
  684. package/lib/hooks/useFocusWithin.js +14 -8
  685. package/lib/hooks/useFocusWithin.js.map +1 -1
  686. package/lib/hooks/useI18n.d.ts +155 -4
  687. package/lib/hooks/useI18n.d.ts.map +1 -1
  688. package/lib/hooks/useRefMap.d.ts +8 -0
  689. package/lib/hooks/useRefMap.d.ts.map +1 -0
  690. package/lib/hooks/useRefMap.js +27 -0
  691. package/lib/hooks/useRefMap.js.map +1 -0
  692. package/lib/hooks/useScrollToggle.d.ts.map +1 -1
  693. package/lib/hooks/useScrollToggle.js +1 -0
  694. package/lib/hooks/useScrollToggle.js.map +1 -1
  695. package/lib/hooks/useSimpleStoreInstance.d.ts +9 -0
  696. package/lib/hooks/useSimpleStoreInstance.d.ts.map +1 -0
  697. package/lib/hooks/useSimpleStoreInstance.js +13 -0
  698. package/lib/hooks/useSimpleStoreInstance.js.map +1 -0
  699. package/lib/hooks/useTestIds.d.ts +1 -1
  700. package/lib/hooks/useTestIds.d.ts.map +1 -1
  701. package/lib/hooks/useTestIds.js +1 -1
  702. package/lib/hooks/useTestIds.js.map +1 -1
  703. package/lib/i18n/default.d.ts +155 -4
  704. package/lib/i18n/default.d.ts.map +1 -1
  705. package/lib/i18n/default.js +178 -11
  706. package/lib/i18n/default.js.map +1 -1
  707. package/lib/i18n/i18n.d.ts +155 -4
  708. package/lib/i18n/i18n.d.ts.map +1 -1
  709. package/lib/index.d.ts +2 -0
  710. package/lib/index.d.ts.map +1 -1
  711. package/lib/index.js +2 -0
  712. package/lib/index.js.map +1 -1
  713. package/lib/styles/GlobalStyle.d.ts +1 -1
  714. package/lib/styles/GlobalStyle.d.ts.map +1 -1
  715. package/lib/styles/GlobalStyle.js +6 -1
  716. package/lib/styles/GlobalStyle.js.map +1 -1
  717. package/lib/styles/mixins.d.ts +3 -0
  718. package/lib/styles/mixins.d.ts.map +1 -0
  719. package/lib/styles/mixins.js +14 -0
  720. package/lib/styles/mixins.js.map +1 -0
  721. package/lib/theme/ThemeMachine.d.ts.map +1 -1
  722. package/lib/theme/ThemeMachine.js.map +1 -1
  723. package/lib/theme/theme.d.ts +18 -24
  724. package/lib/theme/theme.d.ts.map +1 -1
  725. package/lib/theme/themeDefinition.json +9 -14
  726. package/lib/theme/themeOverrides.schema.json +13 -18
  727. package/lib/types/types.d.ts +6 -4
  728. package/lib/types/types.d.ts.map +1 -1
  729. package/lib/types/types.js.map +1 -1
  730. package/lib/utils/createStringMatcher.d.ts +1 -1
  731. package/lib/utils/createStringMatcher.d.ts.map +1 -1
  732. package/lib/utils/createStringMatcher.js +4 -1
  733. package/lib/utils/createStringMatcher.js.map +1 -1
  734. package/lib/utils/formatListToLocaleString.d.ts.map +1 -1
  735. package/lib/utils/formatListToLocaleString.js +5 -2
  736. package/lib/utils/formatListToLocaleString.js.map +1 -1
  737. package/lib/utils/index.d.ts +1 -0
  738. package/lib/utils/index.d.ts.map +1 -1
  739. package/lib/utils/index.js +1 -0
  740. package/lib/utils/index.js.map +1 -1
  741. package/lib/utils/isPositionWithinRect.d.ts +12 -0
  742. package/lib/utils/isPositionWithinRect.d.ts.map +1 -0
  743. package/lib/utils/isPositionWithinRect.js +11 -0
  744. package/lib/utils/isPositionWithinRect.js.map +1 -0
  745. package/lib/utils/withTestIds.d.ts +1 -1
  746. package/package.json +10 -7
  747. package/lib/components/Location/types.d.ts +0 -45
  748. package/lib/components/Location/types.d.ts.map +0 -1
  749. package/lib/components/Location/types.js +0 -10
  750. package/lib/components/Location/types.js.map +0 -1
@@ -1,10 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useContext, useRef, useState, useEffect } from 'react';
2
+ import { useContext, useRef, useState, useEffect, forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { defaultThemeProp } from '../../theme';
5
5
  import Progress from '../Progress';
6
6
  import { Status } from '../Badges';
7
- import { loadMapsAPI, getCoords, toGoogleLatLng, getPlaceById, isLatLngObject, getAddress } from './utils';
7
+ import { createUID } from '../../utils';
8
+ import useTheme from '../../hooks/useTheme';
9
+ import { omitProps } from '../../styles';
10
+ import { loadMapsAPI, toGoogleLatLng, getPlaceById, isLatLngObject, getAddress } from './utils';
8
11
  import MapsContext from './MapsContext';
9
12
  export const StyledLocationError = styled(Status) `
10
13
  position: absolute;
@@ -13,27 +16,27 @@ export const StyledLocationError = styled(Status) `
13
16
  transform: translate(-50%, -50%);
14
17
  `;
15
18
  StyledLocationError.defaultProps = defaultThemeProp;
16
- export const StyledLocationView = styled.div(props => {
17
- const { height, theme } = props;
19
+ export const StyledLocationView = styled.div.withConfig(omitProps('height'))(({ height, theme }) => {
18
20
  return css `
19
- height: ${height};
20
- position: relative;
21
- flex: auto;
22
- border-radius: ${theme.base['border-radius']};
23
- mask-image: radial-gradient(white, black);
24
- -webkit-mask-image: radial-gradient(white, black);
25
- `;
21
+ min-height: inherit;
22
+ height: ${height};
23
+ position: relative;
24
+ flex: auto;
25
+ border-radius: ${theme.base['border-radius']};
26
+ mask-image: radial-gradient(white, black);
27
+ -webkit-mask-image: radial-gradient(white, black);
28
+ `;
26
29
  });
27
30
  StyledLocationView.defaultProps = defaultThemeProp;
28
- const StyledMap = styled.div(({ height, disabled, status, eMessage, theme: { base: { 'disabled-opacity': disabledOpacity } } }) => {
31
+ const StyledMap = styled.div(({ disabled, status, theme: { base: { 'disabled-opacity': disabledOpacity } } }) => {
29
32
  return css `
30
- height: ${height};
33
+ position: absolute;
34
+ inset: 0;
31
35
  ${disabled &&
32
36
  css `
33
37
  opacity: ${disabledOpacity};
34
38
  `}
35
39
  ${status === 'error' &&
36
- eMessage &&
37
40
  css `
38
41
  opacity: ${disabledOpacity};
39
42
  `}
@@ -49,14 +52,19 @@ var LoadStatus;
49
52
  const hasPlaceId = (obj) => {
50
53
  return typeof obj === 'object' && obj.placeId && typeof obj.placeId === 'string';
51
54
  };
52
- const LocationView = (props) => {
53
- const { location = 'current', zoomLevel = 13, height = '25rem', centerMapOnChange = false, onClick, onError, disabled = false, ...restProps } = props;
55
+ /* cSpell:ignore 'ABCDEFGHIJKLMNOPQRSTUVWYZ' */
56
+ const markerLabels = 'ABCDEFGHIJKLMNOPQRSTUVWYZ';
57
+ const LocationView = forwardRef(function LocationView(props, ref) {
58
+ const { pins = [], zoomLevel = 13, height = '25rem', centerMapOnChange = false, onClick, onError, disabled = false, loading = false, drawRoute = false, ...restProps } = props;
54
59
  const { name, ...providerOpts } = useContext(MapsContext);
55
60
  const [status, setStatus] = useState(LoadStatus.Init);
56
61
  const [eMessage, setEMessage] = useState('');
57
62
  const mapElemRef = useRef();
58
63
  const map = useRef();
59
- const marker = useRef();
64
+ const markers = useRef([]);
65
+ const ds = useRef();
66
+ const dr = useRef();
67
+ const theme = useTheme();
60
68
  const onMapClick = (e) => {
61
69
  if (!isLatLngObject(e.latLng))
62
70
  return;
@@ -82,17 +90,15 @@ const LocationView = (props) => {
82
90
  if (mapElemRef.current) {
83
91
  const position = toGoogleLatLng({ latitude: 0, longitude: 0 });
84
92
  map.current = new google.maps.Map(mapElemRef.current, {
93
+ mapId: createUID(),
85
94
  center: position,
86
95
  zoom: 2,
87
96
  draggable: !disabled,
88
97
  draggableCursor: 'auto',
89
98
  draggingCursor: 'move'
90
99
  });
91
- marker.current = new google.maps.Marker({
92
- map: map.current,
93
- position
94
- });
95
- marker.current?.setVisible(false);
100
+ ds.current = new google.maps.DirectionsService();
101
+ dr.current = new google.maps.DirectionsRenderer({ suppressMarkers: true });
96
102
  }
97
103
  };
98
104
  useEffect(() => {
@@ -102,10 +108,10 @@ const LocationView = (props) => {
102
108
  return () => google.maps.event.removeListener(l);
103
109
  }, [onClick, map.current]);
104
110
  useEffect(() => {
105
- let unMounted = false;
111
+ let mounted = true;
106
112
  loadMapsAPI(name, providerOpts)
107
113
  .then(() => {
108
- if (!unMounted) {
114
+ if (mounted) {
109
115
  initialize();
110
116
  setStatus(LoadStatus.Ready);
111
117
  }
@@ -116,38 +122,85 @@ const LocationView = (props) => {
116
122
  onError?.(error);
117
123
  });
118
124
  return () => {
119
- unMounted = true;
125
+ mounted = false;
120
126
  if (map.current)
121
127
  google.maps.event.clearInstanceListeners(map.current);
122
128
  };
123
129
  }, []);
124
130
  useEffect(() => {
125
- getCoords(location)
126
- .then(coords => {
127
- if (map.current) {
128
- map.current.setOptions({
129
- zoom: zoomLevel,
130
- draggable: !disabled
131
- });
132
- const googleLatLng = toGoogleLatLng(coords);
133
- marker.current?.setPosition(googleLatLng);
134
- marker.current?.setVisible(true);
135
- if (centerMapOnChange) {
136
- map.current.setCenter(googleLatLng);
137
- }
138
- if (status !== LoadStatus.Ready)
139
- setStatus(LoadStatus.Ready);
131
+ if (status !== LoadStatus.Ready ||
132
+ !map.current ||
133
+ !dr.current ||
134
+ !ds.current ||
135
+ // FIXME: Workaround for marker library not being imported
136
+ !google.maps.marker)
137
+ return;
138
+ if (drawRoute && pins.length > 1) {
139
+ dr.current.setMap(map.current);
140
+ const request = {
141
+ origin: toGoogleLatLng({ latitude: pins[0].latitude, longitude: pins[0].longitude }),
142
+ destination: toGoogleLatLng({
143
+ latitude: pins[pins.length - 1].latitude,
144
+ longitude: pins[pins.length - 1].longitude
145
+ }),
146
+ waypoints: pins.slice(1, pins.length - 1).map(l => {
147
+ return {
148
+ stopover: true,
149
+ location: toGoogleLatLng({
150
+ latitude: l.latitude,
151
+ longitude: l.longitude
152
+ })
153
+ };
154
+ }),
155
+ travelMode: google.maps.TravelMode.DRIVING
156
+ };
157
+ ds.current.route(request).then(dr.current.setDirections.bind(dr.current), onError);
158
+ }
159
+ const bounds = new google.maps.LatLngBounds();
160
+ markers.current = pins.map(({ latitude, longitude, title, selected }, index) => {
161
+ const gCoords = toGoogleLatLng({ latitude, longitude });
162
+ const contentConfig = {
163
+ glyphColor: theme.base.colors.white
164
+ };
165
+ if (pins.length > 1) {
166
+ const glyphWrapper = document.createElement('span');
167
+ glyphWrapper.style.fontSize = '0.9rem';
168
+ glyphWrapper.style.paddingTop = '0.1rem';
169
+ glyphWrapper.innerHTML = markerLabels[index % markerLabels.length];
170
+ contentConfig.glyph = glyphWrapper;
140
171
  }
141
- })
142
- .catch((error) => {
143
- if (status !== LoadStatus.Error)
144
- setStatus(LoadStatus.Error);
145
- marker.current?.setVisible(false);
146
- setEMessage(error.message);
147
- onError?.(error);
172
+ if (selected) {
173
+ contentConfig.background = theme.base.colors.red.dark;
174
+ contentConfig.borderColor = theme.base.colors.red.dark;
175
+ contentConfig.scale = 1.15;
176
+ }
177
+ const content = new google.maps.marker.PinElement(contentConfig);
178
+ const marker = new google.maps.marker.AdvancedMarkerElement({
179
+ map: map.current,
180
+ position: gCoords,
181
+ title,
182
+ content: content.element
183
+ });
184
+ bounds.extend(gCoords);
185
+ return marker;
148
186
  });
149
- }, [location, status, zoomLevel, disabled, centerMapOnChange, onError]);
150
- 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(StyledLocationError, { "aria-label": eMessage, variant: 'info', children: eMessage }))] }));
151
- };
187
+ if (centerMapOnChange) {
188
+ if (pins.length === 1) {
189
+ map.current.setCenter(toGoogleLatLng(pins[0]));
190
+ map.current.setZoom(zoomLevel);
191
+ }
192
+ else if (pins.length > 1) {
193
+ map.current.fitBounds(bounds);
194
+ }
195
+ }
196
+ return () => {
197
+ markers.current.forEach(m => {
198
+ m.map = null;
199
+ });
200
+ dr.current?.setMap(null);
201
+ };
202
+ }, [JSON.stringify(pins), status, zoomLevel, disabled, drawRoute, centerMapOnChange, onError]);
203
+ return (_jsxs(StyledLocationView, { height: height, ref: ref, children: [_jsx(StyledMap, { ref: mapElemRef, disabled: disabled, status: status, ...restProps }), (status === LoadStatus.Init || loading) && _jsx(Progress, { placement: 'local' }), status === LoadStatus.Error && eMessage && (_jsx(StyledLocationError, { "aria-label": eMessage, variant: 'info', children: eMessage }))] }));
204
+ });
152
205
  export default LocationView;
153
206
  //# sourceMappingURL=LocationView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocationView.js","sourceRoot":"","sources":["../../../src/components/Location/LocationView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,EACL,WAAW,EACX,SAAS,EACT,cAAc,EACd,YAAY,EACZ,cAAc,EACd,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB,OAAO,WAAW,MAAM,eAA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EAAE;YACtB,IAAI,MAAM,KAAK,UAAU,CAAC,KAAK;gBAAE,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAC7D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;YAClC,WAAW,CAAC,KAAK,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,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,mBAAmB,kBAAa,QAAQ,EAAE,OAAO,EAAC,MAAM,YACtD,QAAQ,GACW,CACvB,IACkB,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useContext, useRef, useState, useEffect } from 'react';\nimport type { FC, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { BaseProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Progress from '../Progress';\nimport { Status } from '../Badges';\n\nimport type { LatLng } from './types';\nimport {\n loadMapsAPI,\n getCoords,\n toGoogleLatLng,\n getPlaceById,\n isLatLngObject,\n getAddress\n} from './utils';\nimport type BaseLocationProps from './Location.types';\nimport MapsContext from './MapsContext';\n\nexport const StyledLocationError = styled(Status)`\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 /**\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?: (\n coords: LatLng & {\n name?: string;\n address?: string;\n }\n ) => void;\n}\n\nenum LoadStatus {\n Init = 'init',\n Ready = 'ready',\n Error = 'error'\n}\n\nconst hasPlaceId = (obj: any): obj is google.maps.IconMouseEvent & { placeId: string } => {\n return typeof obj === 'object' && obj.placeId && typeof obj.placeId === 'string';\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 const onMapClick = (e: google.maps.MapMouseEvent) => {\n if (!isLatLngObject(e.latLng)) return;\n\n if (hasPlaceId(e)) {\n getPlaceById(e.placeId).then(placeInfo => {\n onClick?.({\n ...placeInfo,\n latitude: e.latLng!.lat(),\n longitude: e.latLng!.lng()\n });\n });\n } else {\n getAddress({\n latitude: e.latLng.lat(),\n longitude: e.latLng.lng()\n })\n .then(onClick)\n .catch(err => onError?.(err));\n }\n };\n\n const initialize = () => {\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 draggableCursor: 'auto',\n draggingCursor: 'move'\n });\n marker.current = new google.maps.Marker({\n map: map.current,\n position\n });\n marker.current?.setVisible(false);\n }\n };\n\n useEffect(() => {\n if (!onClick || !map.current) return;\n\n const l = map.current.addListener('click', onMapClick);\n return () => google.maps.event.removeListener(l);\n }, [onClick, map.current]);\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 const googleLatLng = toGoogleLatLng(coords);\n\n marker.current?.setPosition(googleLatLng);\n marker.current?.setVisible(true);\n\n if (centerMapOnChange) {\n map.current.setCenter(googleLatLng);\n }\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 <StyledLocationError aria-label={eMessage} variant='info'>\n {eMessage}\n </StyledLocationError>\n )}\n </StyledLocationView>\n );\n};\n\nexport default LocationView;\n"]}
1
+ {"version":3,"file":"LocationView.js","sourceRoot":"","sources":["../../../src/components/Location/LocationView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChG,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;;;;CAKhD,CAAC;AAEF,mBAAmB,CAAC,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I,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;aAC/B;SACF;QAED,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBAC1B,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC;YACf,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;IAE/F,OAAO,CACL,MAAC,kBAAkB,IAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,aAC1C,KAAC,SAAS,IACR,GAAG,EAAE,UAAiC,EACtC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,KACV,SAAS,GACb,EACD,CAAC,MAAM,KAAK,UAAU,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,GAAG,EACzE,MAAM,KAAK,UAAU,CAAC,KAAK,IAAI,QAAQ,IAAI,CAC1C,KAAC,mBAAmB,kBAAa,QAAQ,EAAE,OAAO,EAAC,MAAM,YACtD,QAAQ,GACW,CACvB,IACkB,CACtB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useContext, useRef, useState, useEffect, forwardRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { RefElement, WithAttributes } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Progress from '../Progress';\nimport { Status } from '../Badges';\nimport { createUID } from '../../utils';\nimport useTheme from '../../hooks/useTheme';\nimport { omitProps } from '../../styles';\n\nimport type { LatLng, Pin } from './Location.types';\nimport { loadMapsAPI, toGoogleLatLng, getPlaceById, isLatLngObject, getAddress } from './utils';\nimport MapsContext from './MapsContext';\n\nexport const StyledLocationError = styled(Status)`\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.withConfig<{ height?: string }>(omitProps('height'))(\n ({ height, theme }) => {\n return css`\n min-height: inherit;\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);\n\nStyledLocationView.defaultProps = defaultThemeProp;\n\nconst StyledMap = styled.div<{\n status: string;\n disabled: boolean;\n}>(\n ({\n disabled,\n status,\n theme: {\n base: { 'disabled-opacity': disabledOpacity }\n }\n }) => {\n return css`\n position: absolute;\n inset: 0;\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n `}\n ${status === 'error' &&\n css`\n opacity: ${disabledOpacity};\n `}\n `;\n }\n);\n\nStyledMap.defaultProps = defaultThemeProp;\n\nexport type LocationViewProps = WithAttributes<\n 'div',\n {\n /**\n * Array of location objects.\n * @default []\n */\n pins?: Pin[];\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?: (\n locationData: LatLng & {\n name?: string;\n address?: string;\n }\n ) => void;\n /**\n * Renders loading indicator when true. Informs the user location resolution is in progress.\n */\n loading?: boolean;\n /**\n * Disables dragging and clicking when true.\n * @default false\n */\n disabled?: boolean;\n /**\n * Indicates if route between pins should be rendered.\n * @default false\n */\n drawRoute?: boolean;\n\n /** Callback fired when an error occurs. This function gets called with one argument of type Error. */\n onError?: (error: Error) => void;\n }\n>;\n\nenum LoadStatus {\n Init = 'init',\n Ready = 'ready',\n Error = 'error'\n}\n\nconst hasPlaceId = (obj: any): obj is google.maps.IconMouseEvent & { placeId: string } => {\n return typeof obj === 'object' && obj.placeId && typeof obj.placeId === 'string';\n};\n\n/* cSpell:ignore 'ABCDEFGHIJKLMNOPQRSTUVWYZ' */\nconst markerLabels = 'ABCDEFGHIJKLMNOPQRSTUVWYZ';\n\nconst LocationView = forwardRef<RefElement<LocationViewProps>, PropsWithoutRef<LocationViewProps>>(\n function LocationView(props, ref) {\n const {\n pins = [],\n zoomLevel = 13,\n height = '25rem',\n centerMapOnChange = false,\n onClick,\n onError,\n disabled = false,\n loading = false,\n drawRoute = 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 markers = useRef<google.maps.marker.AdvancedMarkerElement[]>([]);\n const ds = useRef<google.maps.DirectionsService>();\n const dr = useRef<google.maps.DirectionsRenderer>();\n const theme = useTheme();\n\n const onMapClick = (e: google.maps.MapMouseEvent) => {\n if (!isLatLngObject(e.latLng)) return;\n\n if (hasPlaceId(e)) {\n getPlaceById(e.placeId).then(placeInfo => {\n onClick?.({\n ...placeInfo,\n latitude: e.latLng!.lat(),\n longitude: e.latLng!.lng()\n });\n });\n } else {\n getAddress({\n latitude: e.latLng.lat(),\n longitude: e.latLng.lng()\n })\n .then(onClick)\n .catch(err => onError?.(err));\n }\n };\n\n const initialize = () => {\n if (mapElemRef.current) {\n const position = toGoogleLatLng({ latitude: 0, longitude: 0 });\n map.current = new google.maps.Map(mapElemRef.current, {\n mapId: createUID(),\n center: position,\n zoom: 2,\n draggable: !disabled,\n draggableCursor: 'auto',\n draggingCursor: 'move'\n });\n ds.current = new google.maps.DirectionsService();\n dr.current = new google.maps.DirectionsRenderer({ suppressMarkers: true });\n }\n };\n\n useEffect(() => {\n if (!onClick || !map.current) return;\n\n const l = map.current.addListener('click', onMapClick);\n return () => google.maps.event.removeListener(l);\n }, [onClick, map.current]);\n\n useEffect(() => {\n let mounted = true;\n loadMapsAPI(name, providerOpts)\n .then(() => {\n if (mounted) {\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 mounted = false;\n if (map.current) google.maps.event.clearInstanceListeners(map.current);\n };\n }, []);\n\n useEffect(() => {\n if (\n status !== LoadStatus.Ready ||\n !map.current ||\n !dr.current ||\n !ds.current ||\n // FIXME: Workaround for marker library not being imported\n !google.maps.marker\n )\n return;\n\n if (drawRoute && pins.length > 1) {\n dr.current.setMap(map.current);\n const request: google.maps.DirectionsRequest = {\n origin: toGoogleLatLng({ latitude: pins[0].latitude, longitude: pins[0].longitude }),\n destination: toGoogleLatLng({\n latitude: pins[pins.length - 1].latitude,\n longitude: pins[pins.length - 1].longitude\n }),\n waypoints: pins.slice(1, pins.length - 1).map(l => {\n return {\n stopover: true,\n location: toGoogleLatLng({\n latitude: l.latitude,\n longitude: l.longitude\n })\n };\n }),\n travelMode: google.maps.TravelMode.DRIVING\n };\n\n ds.current.route(request).then(dr.current.setDirections.bind(dr.current), onError);\n }\n\n const bounds = new google.maps.LatLngBounds();\n\n markers.current = pins.map(({ latitude, longitude, title, selected }, index) => {\n const gCoords = toGoogleLatLng({ latitude, longitude });\n\n const contentConfig: google.maps.marker.PinElementOptions = {\n glyphColor: theme.base.colors.white\n };\n if (pins.length > 1) {\n const glyphWrapper = document.createElement('span');\n glyphWrapper.style.fontSize = '0.9rem';\n glyphWrapper.style.paddingTop = '0.1rem';\n glyphWrapper.innerHTML = markerLabels[index % markerLabels.length];\n contentConfig.glyph = glyphWrapper;\n }\n if (selected) {\n contentConfig.background = theme.base.colors.red.dark;\n contentConfig.borderColor = theme.base.colors.red.dark;\n contentConfig.scale = 1.15;\n }\n const content = new google.maps.marker.PinElement(contentConfig);\n const marker = new google.maps.marker.AdvancedMarkerElement({\n map: map.current,\n position: gCoords,\n title,\n content: content.element\n });\n bounds.extend(gCoords);\n return marker;\n });\n\n if (centerMapOnChange) {\n if (pins.length === 1) {\n map.current.setCenter(toGoogleLatLng(pins[0]));\n map.current.setZoom(zoomLevel);\n } else if (pins.length > 1) {\n map.current.fitBounds(bounds);\n }\n }\n\n return () => {\n markers.current.forEach(m => {\n m.map = null;\n });\n dr.current?.setMap(null);\n };\n }, [JSON.stringify(pins), status, zoomLevel, disabled, drawRoute, centerMapOnChange, onError]);\n\n return (\n <StyledLocationView height={height} ref={ref}>\n <StyledMap\n ref={mapElemRef as Ref<HTMLDivElement>}\n disabled={disabled}\n status={status}\n {...restProps}\n />\n {(status === LoadStatus.Init || loading) && <Progress placement='local' />}\n {status === LoadStatus.Error && eMessage && (\n <StyledLocationError aria-label={eMessage} variant='info'>\n {eMessage}\n </StyledLocationError>\n )}\n </StyledLocationView>\n );\n }\n);\n\nexport default LocationView;\n"]}
@@ -5,6 +5,6 @@ export type { LocationViewProps } from './LocationView';
5
5
  export { default as MapsContext } from './MapsContext';
6
6
  export { default as LocationDisplay } from './LocationDisplay';
7
7
  export type { LocationDisplayProps } from './LocationDisplay';
8
- export type { LatLng } from './types';
9
- export { isValueACoordinate } from './utils';
8
+ export type { LatLng, Pin, Location } from './Location.types';
9
+ export { isValueACoordinate, getCoords } from './utils';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Location/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Location/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
@@ -2,5 +2,5 @@ export { default as LocationInput } from './LocationInput';
2
2
  export { default as LocationView } from './LocationView';
3
3
  export { default as MapsContext } from './MapsContext';
4
4
  export { default as LocationDisplay } from './LocationDisplay';
5
- export { isValueACoordinate } from './utils';
5
+ export { isValueACoordinate, getCoords } from './utils';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Location/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { default as LocationInput } from './LocationInput';\nexport type { LocationInputProps } from './LocationInput';\nexport { default as LocationView } from './LocationView';\nexport type { LocationViewProps } from './LocationView';\nexport { default as MapsContext } from './MapsContext';\nexport { default as LocationDisplay } from './LocationDisplay';\nexport type { LocationDisplayProps } from './LocationDisplay';\nexport type { LatLng } from './types';\nexport { isValueACoordinate } from './utils';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Location/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { default as LocationInput } from './LocationInput';\nexport type { LocationInputProps } from './LocationInput';\nexport { default as LocationView } from './LocationView';\nexport type { LocationViewProps } from './LocationView';\nexport { default as MapsContext } from './MapsContext';\nexport { default as LocationDisplay } from './LocationDisplay';\nexport type { LocationDisplayProps } from './LocationDisplay';\nexport type { LatLng, Pin, Location } from './Location.types';\nexport { isValueACoordinate, getCoords } from './utils';\n"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.maps" />
2
- import type { Bias, LatLng, ProviderOpts, Location } from './types';
2
+ import type { Bias, LatLng, ProviderOpts, Location } from './Location.types';
3
3
  export declare function loadMapsAPI(name?: string, opts?: ProviderOpts): Promise<void>;
4
4
  /**
5
5
  * Identifies coordinates in degree format
@@ -37,7 +37,7 @@ export declare function getPlacePredictions(location: string, bias?: Bias): Prom
37
37
  export declare function getPlace(location: string, mapElement?: HTMLDivElement): Promise<LatLng>;
38
38
  export declare function getPlaceById(placeId: string, sessionToken?: google.maps.places.AutocompleteSessionToken, mapElement?: HTMLDivElement): Promise<Location>;
39
39
  /** Returns coordinations for given input: either coords, address or current position. */
40
- export declare function getCoords(coords: string | LatLng, mapElement?: HTMLDivElement): Promise<LatLng>;
40
+ export declare function getCoords(coords: string | 'current' | LatLng, mapElement?: HTMLDivElement): Promise<LatLng>;
41
41
  export declare function getAddress(coords: LatLng): Promise<{
42
42
  name: string;
43
43
  address?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Location/utils.ts"],"names":[],"mappings":";AAaA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAgB,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiIlF,wBAAsB,WAAW,CAAC,IAAI,GAAE,MAAW,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvF;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAA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AAI,CAAC,MAAM,CAAC,wBAA4E,EAC7G,UAAU,GAAE,cAA8C,GACzD,OAAO,CAAC,QAAQ,CAAC,CAgBnB;AAED,yFAAyF;AACzF,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EACnC,UAAU,CAAC,EAAE,cAAc,GAC1B,OAAO,CAAC,MAAM,CAAC,CAuCjB;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAkCD;AAED,eAAO,MAAM,cAAc,QAAS,GAAG,8BAStC,CAAC"}
@@ -1,13 +1,15 @@
1
- import { hasProp, loadScript } from '../../utils';
2
- import { CoordsCannotBeParsedError, GeocoderFailedError, GeolocationUnsupportedError, GoogleMapsAPINotFoundError, IsNotAnObjectError, LocationNotFoundError, ProviderNotSupportedError, QUERY_FIELDS, QUERY_TYPES } from './types';
3
- const GOOGLE_MAPS_SCRIPT_ID = 'google-map';
1
+ import { Loader } from '@googlemaps/js-api-loader';
2
+ import { hasProp } from '../../utils';
3
+ import { CoordsCannotBeParsedError, GeocoderFailedError, GeolocationUnsupportedError, GoogleMapsAPINotFoundError, IsNotAnObjectError, LocationNotFoundError, ProviderNotSupportedError, QUERY_FIELDS, QUERY_TYPES } from './Location.types';
4
4
  const DegreeRegexChunks = [
5
5
  /^[-+]?/,
6
6
  // latitude degrees
7
7
  /([0-9]|[1-8][0-9]|90)(\.\d+)?°/,
8
8
  /\s?/,
9
9
  // latitude direction
10
- /(N|S)?\s/,
10
+ /(N|S)?/,
11
+ // sepeartor between latitude and longitude
12
+ /(,|,\s|\s)/,
11
13
  /[-+]?/,
12
14
  // longitude degrees
13
15
  /([0-9]|[1-9][0-9]|1[0-7][0-9]|180)(\.\d+)?°/,
@@ -22,16 +24,18 @@ const DMRegexChunks = [
22
24
  /([0-9]|[1-8][0-9]|90)°/,
23
25
  /\s?/,
24
26
  // latitude minutes
25
- /[0-5][0-9](\.\d+)?('|’)/,
27
+ /([0-9]|[0-5][0-9])(\.\d+)?('|’)/,
26
28
  /\s?/,
27
29
  // latitude direction
28
- /(N|S)?\s/,
30
+ /(N|S)?/,
31
+ // sepeartor between latitude and longitude
32
+ /(,|,\s|\s)/,
29
33
  /[-+]?/,
30
34
  // longitude degrees
31
35
  /([0-9]|[1-9][0-9]|1[0-7][0-9]|180)°/,
32
36
  /\s?/,
33
37
  // longitude minutes
34
- /[0-5][0-9](\.\d+)?('|’)/,
38
+ /([0-9]|[0-5][0-9])(\.\d+)?('|’)/,
35
39
  /\s?/,
36
40
  // longitude direction
37
41
  /(W|E)?$/
@@ -43,22 +47,24 @@ const DMSRegexChunks = [
43
47
  /([0-9]|[1-8][0-9]|90)°/,
44
48
  /\s?/,
45
49
  // latitude minutes
46
- /[0-5][0-9]('|’)/,
50
+ /([0-9]|[0-5][0-9])('|’)/,
47
51
  /\s?/,
48
52
  // latitude seconds
49
- /[0-5][0-9](\.\d+)?("|″)/,
53
+ /([0-9]|[0-5][0-9])(\.\d+)?("|″)/,
50
54
  /\s?/,
51
55
  // latitude direction
52
- /(N|S)?\s/,
56
+ /(N|S)?/,
57
+ // sepeartor between latitude and longitude
58
+ /(,|,\s|\s)/,
53
59
  /[-+]?/,
54
60
  // longitude degrees
55
61
  /([0-9]|[1-9][0-9]|1[0-7][0-9]|180)°/,
56
62
  /\s?/,
57
63
  // longitude minutes
58
- /[0-5][0-9]('|’)/,
64
+ /([0-9]|[0-5][0-9])('|’)/,
59
65
  /\s?/,
60
66
  // longitude seconds
61
- /[0-5][0-9](\.\d+)?("|″)/,
67
+ /([0-9]|[0-5][0-9])(\.\d+)?("|″)/,
62
68
  /\s?/,
63
69
  // longitude direction
64
70
  /(W|E)?$/
@@ -68,7 +74,7 @@ const decimalRegexChunks = [
68
74
  /^[-+]?/,
69
75
  /([0-9]|[1-8][0-9]|90)/,
70
76
  /(\.\d+)?/,
71
- /,(\s)?/,
77
+ /(,|\s|,\s)/,
72
78
  /[-+]?/,
73
79
  /([0-9]|[1-9][0-9]|1[0-7][0-9]|180)/,
74
80
  /(\.\d+)?$/
@@ -80,23 +86,15 @@ const providers = {
80
86
  loadedPromise: null,
81
87
  loadedApiKey: '',
82
88
  loadAPI(opts) {
83
- const params = new URLSearchParams(Object.entries({
84
- key: opts.apiKey,
89
+ const loader = new Loader({
90
+ version: '3.55',
91
+ apiKey: opts.apiKey,
85
92
  region: opts.region,
86
93
  language: opts.language,
87
- libraries: 'places'
88
- }).filter(([, value]) => value !== undefined)).toString();
89
- const loadedScript = document.getElementById(GOOGLE_MAPS_SCRIPT_ID);
90
- if (loadedScript) {
91
- loadedScript.remove();
92
- // https://stackoverflow.com/questions/29930274/fixing-you-have-included-the-google-maps-api-multiple-times-on-this-page-this
93
- delete window.google;
94
- }
95
- return new Promise((resolve, reject) => {
96
- loadScript(`https://maps.googleapis.com/maps/api/js?${params}`, function onLoad() {
97
- this.id = GOOGLE_MAPS_SCRIPT_ID;
98
- return resolve();
99
- }, () => reject(new Error(GoogleMapsAPINotFoundError)));
94
+ libraries: ['places', 'marker']
95
+ });
96
+ return loader.load().then(() => { }, () => {
97
+ throw new Error(GoogleMapsAPINotFoundError);
100
98
  });
101
99
  }
102
100
  },
@@ -112,9 +110,15 @@ export async function loadMapsAPI(name = '', opts) {
112
110
  throw new Error(IsNotAnObjectError);
113
111
  }
114
112
  const provider = providers[name] ?? providers.undefined;
115
- if (!provider.loadedPromise || provider.loadedApiKey !== opts?.apiKey) {
116
- provider.loadedApiKey = opts?.apiKey;
117
- provider.loadedPromise = provider.loadAPI(opts);
113
+ if (!provider.loadedPromise) {
114
+ provider.loadedPromise = provider
115
+ .loadAPI(opts)
116
+ .then(() => {
117
+ provider.loadedApiKey = opts?.apiKey;
118
+ })
119
+ .catch(() => {
120
+ provider.loadedPromise = null;
121
+ });
118
122
  }
119
123
  return provider.loadedPromise;
120
124
  }
@@ -176,18 +180,26 @@ function convertDMSToDD({ degrees, minutes, seconds }, direction) {
176
180
  */
177
181
  export function parseDMS(input) {
178
182
  if (isValueDMSCoordinate(input)) {
179
- const parts = input.split(/'|’|"|″|°|\s/);
180
- const lat = convertDMSToDD({ degrees: Number(parts[0]), minutes: Number(parts[1]), seconds: Number(parts[2]) }, parts[3]);
181
- const lng = convertDMSToDD({ degrees: Number(parts[4]), minutes: Number(parts[5]), seconds: Number(parts[6]) }, parts[7]);
183
+ const parts = input.split(/'|’|"\s?|″\s?|°|,?\s|,\s?/);
184
+ const lat = convertDMSToDD({
185
+ degrees: Number(parts[0]),
186
+ minutes: Number(parts[1]),
187
+ seconds: Number(parts[2])
188
+ }, parts[3]);
189
+ const lng = convertDMSToDD({
190
+ degrees: Number(parts[4]),
191
+ minutes: Number(parts[5]),
192
+ seconds: Number(parts[6])
193
+ }, parts[7]);
182
194
  return [lat, lng];
183
195
  }
184
196
  if (isValueDMCoordinate(input)) {
185
- const parts = input.split(/'|’|°|\s/);
197
+ const parts = input.split(/'\s?|’\s?|°|,?\s|,\s?/);
186
198
  const lat = convertDMSToDD({ degrees: Number(parts[0]), minutes: Number(parts[1]) }, parts[2]);
187
199
  const lng = convertDMSToDD({ degrees: Number(parts[3]), minutes: Number(parts[4]) }, parts[5]);
188
200
  return [lat, lng];
189
201
  }
190
- const parts = input.split(/°|\s/);
202
+ const parts = input.split(/°\s?|,?\s|,\s?/);
191
203
  const lat = convertDMSToDD({ degrees: Number(parts[0]) }, parts[1]);
192
204
  const lng = convertDMSToDD({ degrees: Number(parts[2]) }, parts[3]);
193
205
  return [lat, lng];
@@ -253,7 +265,11 @@ export async function getPlace(location, mapElement = document.createElement('di
253
265
  const placesService = new google.maps.places.PlacesService(mapElement);
254
266
  const { placePredictions, token } = await getPlacePredictions(location);
255
267
  return new Promise((resolve, reject) => {
256
- placesService.getDetails({ placeId: placePredictions[0]?.place_id, fields: QUERY_FIELDS, sessionToken: token }, (place, pStatus) => {
268
+ placesService.getDetails({
269
+ placeId: placePredictions[0]?.place_id,
270
+ fields: QUERY_FIELDS,
271
+ sessionToken: token
272
+ }, (place, pStatus) => {
257
273
  if (pStatus === google.maps.places.PlacesServiceStatus.OK) {
258
274
  resolve({
259
275
  latitude: place?.geometry?.location?.lat() || NaN,
@@ -299,7 +315,20 @@ export async function getCoords(coords, mapElement) {
299
315
  latLng = parseDMS(coords);
300
316
  }
301
317
  else {
302
- latLng = coords.split(',', 2).map(Number);
318
+ let splitter;
319
+ if (coords.includes(', ')) {
320
+ splitter = ', ';
321
+ }
322
+ else if (coords.includes(',')) {
323
+ splitter = ',';
324
+ }
325
+ else if (coords.includes(' ')) {
326
+ splitter = ' ';
327
+ }
328
+ else {
329
+ splitter = ', ';
330
+ }
331
+ latLng = coords.split(splitter).map(Number);
303
332
  }
304
333
  const [lat, lng] = latLng;
305
334
  if (Number.isNaN(lat) || Number.isNaN(lng) || lat === undefined || lng === undefined)