@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 +1 @@
1
- {"version":3,"file":"Location.types.d.ts","sourceRoot":"","sources":["../../../src/components/Location/Location.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,CAAC,OAAO,WAAW,iBAAkB,SAAQ,cAAc;IAC/D;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sGAAsG;IACtG,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,8DAA8D;IAC9D,IAAI,CAAC,EAAE,IAAI,CAAC;CACb"}
1
+ {"version":3,"file":"Location.types.d.ts","sourceRoot":"","sources":["../../../src/components/Location/Location.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,CAAC,OAAO,MAAM,MAAM,GAAG;IAC3B,mCAAmC;IACnC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,oCAAoC;IACpC,SAAS,EAAE,UAAU,CAAC,MAA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AAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC9D,QAAQ,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,SAAS,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,GAAI,SAAQ,MAAM;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -1,2 +1,10 @@
1
- export {};
1
+ export const QUERY_FIELDS = ['name', 'formatted_address', 'geometry.location', 'place_id'];
2
+ export const QUERY_TYPES = ['establishment', 'geocode'];
3
+ export const LocationNotFoundError = 'Location not found';
4
+ export const GeolocationUnsupportedError = 'Geolocation unsupported';
5
+ export const GoogleMapsAPINotFoundError = 'Cannot load Google Maps API';
6
+ export const IsNotAnObjectError = 'Provider data given is not an object';
7
+ export const ProviderNotSupportedError = 'Not supported maps provider given';
8
+ export const CoordsCannotBeParsedError = 'Coords cannot be parsed!';
9
+ export const GeocoderFailedError = 'Geocoder failed due to';
2
10
  //# sourceMappingURL=Location.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Location.types.js","sourceRoot":"","sources":["../../../src/components/Location/Location.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { NoChildrenProp } from '../../types';\n\nimport type { Bias, LatLng } from './types';\n\nexport default interface BaseLocationProps extends NoChildrenProp {\n /**\n * Location in either text format (name or address) or coordinates.\n * @default 'current'\n */\n location?: LatLng | string | 'current';\n /**\n * Flag to control 'disabled' state for input.\n * @default false\n */\n disabled?: boolean;\n /** Callback fired when an error occurs. This function gets called with one argument of type Error. */\n onError?: (error: Error) => void;\n /** Biasing query results towards user location/preference. */\n bias?: Bias;\n}\n"]}
1
+ {"version":3,"file":"Location.types.js","sourceRoot":"","sources":["../../../src/components/Location/Location.types.ts"],"names":[],"mappings":"AAkCA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAC3F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAC1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AACzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;AAC7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAAC","sourcesContent":["import type { FieldValueListItemProps } from '../FieldValueList';\n\nexport declare type LatLng = {\n /** The latitude representation. */\n latitude: ReturnType<google.maps.LatLng['lat']>;\n /** The longitude representation. */\n longitude: ReturnType<google.maps.LatLng['lng']>;\n};\n\nexport declare type Bias = {\n /** Predictions will be biased towards, but not restricted to, the given bounds. Both location and radius will be ignored if bounds is set.\n * Array stores south-west coordinate of bounding box and north-east coordinate of bounding box. */\n bounds?: [LatLng, LatLng];\n /** Predictions will be biased towards the given location and radius. */\n location?: {\n /** Must to provide both center and radius. */\n /** Location coordinate or current (means user current location). */\n center: LatLng | 'current';\n /** The radius is specified in meters. */\n radius: number;\n };\n};\n\nexport declare type ProviderOpts = {\n [key: string]: any;\n};\n\nexport interface MapsProvider {\n name: string;\n loadAPI: (options: ProviderOpts) => Promise<void>;\n loadedPromise: Promise<void> | null;\n loadedApiKey: string;\n}\n\nexport const QUERY_FIELDS = ['name', 'formatted_address', 'geometry.location', 'place_id'];\nexport const QUERY_TYPES = ['establishment', 'geocode'];\n\nexport const LocationNotFoundError = 'Location not found';\nexport const GeolocationUnsupportedError = 'Geolocation unsupported';\nexport const GoogleMapsAPINotFoundError = 'Cannot load Google Maps API';\nexport const IsNotAnObjectError = 'Provider data given is not an object';\nexport const ProviderNotSupportedError = 'Not supported maps provider given';\nexport const CoordsCannotBeParsedError = 'Coords cannot be parsed!';\nexport const GeocoderFailedError = 'Geocoder failed due to';\n\nexport interface Location {\n name?: google.maps.places.PlaceResult['name'];\n address?: google.maps.places.PlaceResult['formatted_address'];\n latitude?: ReturnType<google.maps.LatLng['lat']>;\n longitude?: ReturnType<google.maps.LatLng['lng']>;\n}\n\nexport interface Pin extends LatLng {\n title?: string;\n additionalInfo?: FieldValueListItemProps[];\n selected?: boolean;\n}\n"]}
@@ -1,9 +1,10 @@
1
1
  import type { FunctionComponent, Ref } from 'react';
2
2
  import type { BaseProps, ForwardProps } from '../../types';
3
- import type { LatLng } from './types';
3
+ import type { LocationViewProps } from './LocationView';
4
+ import type { LatLng } from './Location.types';
4
5
  export interface LocationDisplayProps extends BaseProps {
5
6
  /** Location address or coordinates */
6
- value?: string | LatLng;
7
+ value?: string | 'current' | LatLng;
7
8
  /** The text to be displayed. */
8
9
  displayText?: string;
9
10
  /**
@@ -15,12 +16,12 @@ export interface LocationDisplayProps extends BaseProps {
15
16
  * Height of the map container.
16
17
  * @default '25rem'
17
18
  */
18
- height?: string;
19
+ height?: LocationViewProps['height'];
19
20
  /**
20
21
  * How much the map should zoom.
21
22
  * @default 13
22
23
  */
23
- zoomLevel?: number;
24
+ zoomLevel?: LocationViewProps['zoomLevel'];
24
25
  /** Ref for the wrapping element. */
25
26
  ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LocationDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Location/LocationDisplay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,C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C;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC;;;OAGG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3C,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,GAAG,eAAe,CAAC,CAAC;CAChD;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CAkE3E,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,15 +1,28 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useContext } from 'react';
2
+ import { forwardRef, useContext, useEffect, useState } from 'react';
3
3
  import Text from '../Text';
4
4
  import Link from '../Link';
5
5
  import NoValue from '../NoValue/NoValue';
6
6
  import LocationView from './LocationView';
7
7
  import MapsContext from './MapsContext';
8
- const LocationDisplay = forwardRef(function LocationDisplay({ value = '', displayText, variant = 'text-map', height = '25rem', zoomLevel = 13, ...restProps }, ref) {
9
- const { name } = useContext(MapsContext);
8
+ import { getCoords, loadMapsAPI } from './utils';
9
+ const LocationDisplay = forwardRef(function LocationDisplay({ value, displayText, variant = 'text-map', height = '25rem', zoomLevel = 13, ...restProps }, ref) {
10
+ const { name, ...providerOpts } = useContext(MapsContext);
11
+ const [location, setLocation] = useState();
12
+ const [loading, setLoading] = useState(false);
10
13
  const valueString = typeof value === 'string' ? value : `${value?.latitude}, ${value?.longitude}`;
14
+ useEffect(() => {
15
+ if (['text-map', 'map'].includes(variant) && value) {
16
+ (async () => {
17
+ setLoading(true);
18
+ await loadMapsAPI(name, providerOpts);
19
+ setLocation(await getCoords(value));
20
+ setLoading(false);
21
+ })();
22
+ }
23
+ }, [variant, value]);
11
24
  return !value ? (_jsx(Text, { ref: ref, ...restProps, "aria-hidden": 'true', children: _jsx(NoValue, {}) })) : (_jsxs(_Fragment, { children: [(variant === 'text' || variant === 'text-map') &&
12
- (name === 'google' ? (_jsx(Link, { ref: ref, ...restProps, target: '_blank', rel: 'noopener noreferrer', href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(typeof value === 'string' ? value : `${value?.latitude}, ${value?.longitude}`)}`, children: displayText || valueString })) : (_jsx(Text, { ref: ref, ...restProps, children: displayText || valueString }))), (variant === 'text-map' || variant === 'map') && (_jsx(LocationView, { location: value, centerMapOnChange: true, height: height, zoomLevel: zoomLevel }))] }));
25
+ (name === 'google' ? (_jsx(Link, { ref: ref, ...restProps, target: '_blank', rel: 'noopener noreferrer', href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(typeof value === 'string' ? value : `${value?.latitude}, ${value?.longitude}`)}`, children: displayText || valueString })) : (_jsx(Text, { ref: ref, ...restProps, children: displayText || valueString }))), (variant === 'text-map' || variant === 'map') && (_jsx(LocationView, { pins: location ? [location] : [], centerMapOnChange: true, height: height, zoomLevel: zoomLevel, loading: loading }))] }));
13
26
  });
14
27
  export default LocationDisplay;
15
28
  //# sourceMappingURL=LocationDisplay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocationDisplay.js","sourceRoot":"","sources":["../../../src/components/Location/LocationDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,WAAW,MAAM,eAAe,CAAC;AA2BxC,MAAM,eAAe,GAA2D,UAAU,CACxF,SAAS,eAAe,CACtB,EACE,KAAK,GAAG,EAAE,EACV,WAAW,EACX,OAAO,GAAG,UAAU,EACpB,MAAM,GAAG,OAAO,EAChB,SAAS,GAAG,EAAE,EACd,GAAG,SAAS,EAC0B,EACxC,GAAgC;IAEhC,MAAM,EA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n\nimport Text from '../Text';\nimport Link from '../Link';\nimport type { BaseProps, ForwardProps } from '../../types';\nimport NoValue from '../NoValue/NoValue';\n\nimport LocationView from './LocationView';\nimport MapsContext from './MapsContext';\nimport type { LatLng } from './types';\n\nexport interface LocationDisplayProps extends BaseProps {\n /** Location address or coordinates */\n value?: string | LatLng;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default 'text-map'\n */\n variant?: 'text-map' | 'text' | 'map';\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 /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\nconst LocationDisplay: FunctionComponent<LocationDisplayProps & ForwardProps> = forwardRef(\n function LocationDisplay(\n {\n value = '',\n displayText,\n variant = 'text-map',\n height = '25rem',\n zoomLevel = 13,\n ...restProps\n }: PropsWithoutRef<LocationDisplayProps>,\n ref: LocationDisplayProps['ref']\n ) {\n const { name } = useContext(MapsContext);\n\n const valueString =\n typeof value === 'string' ? value : `${value?.latitude}, ${value?.longitude}`;\n\n return !value ? (\n <Text ref={ref as Ref<HTMLSpanElement>} {...restProps} aria-hidden='true'>\n <NoValue />\n </Text>\n ) : (\n <>\n {(variant === 'text' || variant === 'text-map') &&\n (name === 'google' ? (\n <Link\n ref={ref as Ref<HTMLAnchorElement>}\n {...restProps}\n target='_blank'\n rel='noopener noreferrer'\n href={`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(\n typeof value === 'string' ? value : `${value?.latitude}, ${value?.longitude}`\n )}`}\n >\n {displayText || valueString}\n </Link>\n ) : (\n <Text ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayText || valueString}\n </Text>\n ))}\n {(variant === 'text-map' || variant === 'map') && (\n <LocationView location={value} centerMapOnChange height={height} zoomLevel={zoomLevel} />\n )}\n </>\n );\n }\n);\n\nexport default LocationDisplay;\n"]}
1
+ {"version":3,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":["import { forwardRef, useContext, useEffect, useState } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport Text from '../Text';\nimport Link from '../Link';\nimport type { BaseProps, ForwardProps } from '../../types';\nimport NoValue from '../NoValue/NoValue';\n\nimport LocationView from './LocationView';\nimport type { LocationViewProps } from './LocationView';\nimport MapsContext from './MapsContext';\nimport type { LatLng } from './Location.types';\nimport { getCoords, loadMapsAPI } from './utils';\n\nexport interface LocationDisplayProps extends BaseProps {\n /** Location address or coordinates */\n value?: string | 'current' | LatLng;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default 'text-map'\n */\n variant?: 'text-map' | 'text' | 'map';\n /**\n * Height of the map container.\n * @default '25rem'\n */\n height?: LocationViewProps['height'];\n /**\n * How much the map should zoom.\n * @default 13\n */\n zoomLevel?: LocationViewProps['zoomLevel'];\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\nconst LocationDisplay: FunctionComponent<LocationDisplayProps & ForwardProps> = forwardRef(\n function LocationDisplay(\n {\n value,\n displayText,\n variant = 'text-map',\n height = '25rem',\n zoomLevel = 13,\n ...restProps\n }: PropsWithoutRef<LocationDisplayProps>,\n ref: LocationDisplayProps['ref']\n ) {\n const { name, ...providerOpts } = useContext(MapsContext);\n const [location, setLocation] = useState<LatLng>();\n const [loading, setLoading] = useState(false);\n\n const valueString =\n typeof value === 'string' ? value : `${value?.latitude}, ${value?.longitude}`;\n\n useEffect(() => {\n if (['text-map', 'map'].includes(variant) && value) {\n (async () => {\n setLoading(true);\n await loadMapsAPI(name, providerOpts);\n setLocation(await getCoords(value));\n setLoading(false);\n })();\n }\n }, [variant, value]);\n\n return !value ? (\n <Text ref={ref as Ref<HTMLSpanElement>} {...restProps} aria-hidden='true'>\n <NoValue />\n </Text>\n ) : (\n <>\n {(variant === 'text' || variant === 'text-map') &&\n (name === 'google' ? (\n <Link\n ref={ref as Ref<HTMLAnchorElement>}\n {...restProps}\n target='_blank'\n rel='noopener noreferrer'\n href={`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(\n typeof value === 'string' ? value : `${value?.latitude}, ${value?.longitude}`\n )}`}\n >\n {displayText || valueString}\n </Link>\n ) : (\n <Text ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayText || valueString}\n </Text>\n ))}\n {(variant === 'text-map' || variant === 'map') && (\n <LocationView\n pins={location ? [location] : []}\n centerMapOnChange\n height={height}\n zoomLevel={zoomLevel}\n loading={loading}\n />\n )}\n </>\n );\n }\n);\n\nexport default LocationDisplay;\n"]}
@@ -1,17 +1,9 @@
1
1
  import type { FC } from 'react';
2
2
  import type { FormControlProps } from '../FormControl';
3
3
  import type { BaseProps, ForwardProps, TestIdProp } from '../../types';
4
- import type BaseLocationProps from './Location.types';
5
- import type { LatLng } from './types';
4
+ import type { Bias, LatLng } from './Location.types';
6
5
  import type { LocationViewProps } from './LocationView';
7
- export interface LocationInputProps extends LocationViewProps, BaseLocationProps, BaseProps, FormControlProps, TestIdProp {
8
- /** Button when clicked will show additional information for the location input */
9
- additionalInfo?: FormControlProps['additionalInfo'];
10
- /**
11
- * Only select coordinates on map clicks.
12
- * @default false
13
- */
14
- onlyCoordinates?: boolean;
6
+ export interface LocationInputProps extends BaseProps, FormControlProps, TestIdProp {
15
7
  /**
16
8
  * Get user current location on component first render.
17
9
  * @default false
@@ -29,13 +21,6 @@ export interface LocationInputProps extends LocationViewProps, BaseLocationProps
29
21
  * The argument passed back is the component's value prop.
30
22
  */
31
23
  onBlur?: (value: string) => void;
32
- /**
33
- * Set to true renders the map view below input.
34
- * @default false
35
- */
36
- showMap?: boolean;
37
- /** Location coordinates used for the map view. */
38
- location?: LatLng | string;
39
24
  /** Callback fired when user chooses location from the dropdown of suggestions or submits input value. */
40
25
  onSelect?: (value: {
41
26
  name?: string;
@@ -43,9 +28,29 @@ export interface LocationInputProps extends LocationViewProps, BaseLocationProps
43
28
  latitude?: number;
44
29
  longitude?: number;
45
30
  }) => void;
31
+ /**
32
+ * Only select coordinates on map clicks.
33
+ * @default false
34
+ */
35
+ onlyCoordinates?: boolean;
36
+ /** Biasing query results towards user location/preference. */
37
+ bias?: Bias;
38
+ /**
39
+ * Set to true renders the map view below input.
40
+ * @default false
41
+ */
42
+ map?: {
43
+ /** Location coordinates used for the map view. */
44
+ location?: LatLng;
45
+ height: LocationViewProps['height'];
46
+ zoomLevel?: LocationViewProps['zoomLevel'];
47
+ onClick?: LocationViewProps['onClick'];
48
+ };
49
+ /** Callback fired when an error occurs. This function gets called with one argument of type Error. */
50
+ onError?: (error: Error) => void;
46
51
  }
47
52
  declare const _default: FC<LocationInputProps & ForwardProps> & {
48
- getTestIds: (testIdProp?: string | undefined) => import("../../types").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
53
+ getTestIds: (testIdProp?: string | null | undefined) => import("../../types").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
49
54
  };
50
55
  export default _default;
51
56
  //# sourceMappingURL=LocationInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocationInput.d.ts","sourceRoot":"","sources":["../../../src/components/Location/LocationInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,EAAE,EAAwB,MAAM,OAAO,CAAC;AAQnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAcvE,OAAO,KAAK,iBAAiB,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,MAAM,WAAW,kBACf,SAAQ,iBAAiB,EACvB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,UAAU;IAC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;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,yGAAyG;IACzG,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,KAAK,IAAI,CAAC;IACX;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;OAGG;IACH,GAAG,CAAC,EAAE;QACJ,kDAAkD;QAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACpC,SAAS,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAC3C,OAAO,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;KACxC,CAAC;IACF,sGAAsG;IACtG,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;;;;AAkSD,wBAAmE"}
@@ -2,29 +2,49 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { forwardRef, useCallback, useContext, useEffect, useState } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import ComboBox from '../ComboBox';
5
- import { useI18n, useTestIds } from '../../hooks';
5
+ import { useI18n, useTestIds, useUID } from '../../hooks';
6
6
  import { createUID, withTestIds } from '../../utils';
7
7
  import FormField from '../FormField';
8
8
  import Flex from '../Flex';
9
+ import { defaultThemeProp } from '../../theme';
9
10
  import PoweredByGoogleImage from './PoweredByGoogleImage';
10
11
  import CurrentLocationButton from './CurrentLocationButton';
11
12
  import MapsContext from './MapsContext';
12
- import { getAddress, getCoords, getPlaceById, getPlacePredictions, isValueACoordinate, loadMapsAPI } from './utils';
13
+ import { getAddress, getCoords, getNavigatorPosition, getPlaceById, getPlacePredictions, isValueACoordinate, loadMapsAPI } from './utils';
13
14
  import LocationView, { StyledLocationView } from './LocationView';
14
15
  import { getLocationInputTestIds } from './Location.test-ids';
16
+ const StyledLocationInput = styled(ComboBox) `
17
+ z-index: 1;
18
+ `;
19
+ StyledLocationInput.defaultProps = defaultThemeProp;
15
20
  const StyledLocationMap = styled.div `
16
21
  ${StyledLocationView} {
17
22
  border-top-left-radius: 0;
18
23
  border-top-right-radius: 0;
19
24
  }
20
25
  `;
26
+ StyledLocationMap.defaultProps = defaultThemeProp;
21
27
  const LocationInput = forwardRef(function LocationInput(props, ref) {
22
- const { testId, label, labelHidden, id = createUID(), location = '', value = '', info, status, required, readOnly, disabled, additionalInfo, onSelect, onError, onChange, bias, showMap, defaultToCurrentLocation, centerMapOnChange, height, zoomLevel, onClick, onBlur, onlyCoordinates = false, ...restProps } = props;
28
+ const uid = useUID();
29
+ const { testId, label, labelHidden, id = uid, value = '', info, status, required, readOnly, disabled, additionalInfo, onSelect, onError, onChange, onBlur, bias, defaultToCurrentLocation, onlyCoordinates = false, map, ...restProps } = props;
23
30
  const testIds = useTestIds(testId, getLocationInputTestIds);
24
31
  const { name, ...providerOpts } = useContext(MapsContext);
25
32
  const t = useI18n();
26
33
  const [placePredictionMenuItems, setPlacePredictionMenuItems] = useState([]);
27
34
  const [filterValue, setFilterValue] = useState('');
35
+ const [mapLoading, setMapLoading] = useState(false);
36
+ useEffect(() => {
37
+ (async () => {
38
+ if (defaultToCurrentLocation) {
39
+ setMapLoading(true);
40
+ await loadMapsAPI(name, providerOpts);
41
+ const navigatorPosition = await getNavigatorPosition();
42
+ const currentLocationAddress = await getAddress(navigatorPosition);
43
+ setMapLoading(false);
44
+ onSelect?.(currentLocationAddress);
45
+ }
46
+ })();
47
+ }, []);
28
48
  useEffect(() => {
29
49
  (async () => {
30
50
  try {
@@ -130,24 +150,26 @@ const LocationInput = forwardRef(function LocationInput(props, ref) {
130
150
  })();
131
151
  }, [filterValue, bias, onError, onSelect, onlyCoordinates]);
132
152
  const onInputChange = useCallback((e) => {
133
- setFilterValue(e.target.value);
153
+ setFilterValue(e.target.value.trim());
134
154
  onChange?.(e.target.value);
135
155
  }, [onChange]);
136
156
  const onMapClick = useCallback((placeInfo) => {
157
+ if (readOnly)
158
+ return;
137
159
  if (onlyCoordinates) {
138
160
  const coords = {
139
161
  latitude: placeInfo.latitude,
140
162
  longitude: placeInfo.longitude
141
163
  };
142
164
  onSelect?.(coords);
143
- onClick?.(coords);
165
+ map?.onClick?.(coords);
144
166
  }
145
167
  else {
146
168
  onSelect?.(placeInfo);
147
- onClick?.(placeInfo);
169
+ map?.onClick?.(placeInfo);
148
170
  }
149
- }, [onSelect, onClick, onlyCoordinates]);
150
- const Comp = (_jsxs(_Fragment, { children: [_jsx(ComboBox, { "data-testid": testIds.control, placeholder: t('location_input_placeholder'), menu: filterValue
171
+ }, [readOnly, onSelect, map?.onClick, onlyCoordinates]);
172
+ const Comp = (_jsxs(_Fragment, { children: [_jsx(StyledLocationInput, { id: id, info: info, "data-testid": testIds.control, placeholder: t('location_input_placeholder'), menu: filterValue
151
173
  ? {
152
174
  items: placePredictionMenuItems.concat([
153
175
  {
@@ -155,26 +177,26 @@ const LocationInput = forwardRef(function LocationInput(props, ref) {
155
177
  primary: t('use_input_value', [filterValue]),
156
178
  onClick: () => {
157
179
  setFilterValue('');
158
- onSelect?.({ name: filterValue, address: filterValue });
180
+ onSelect?.({ name: filterValue });
159
181
  }
160
182
  }
161
183
  ]),
162
184
  emptyText: t('location_not_found_text'),
163
185
  mode: 'action',
164
- footer: !showMap && (_jsx(Flex, { container: { justify: 'end' }, children: _jsx(PoweredByGoogleImage, {}) }))
186
+ footer: !map && (_jsx(Flex, { container: { justify: 'end' }, children: _jsx(PoweredByGoogleImage, {}) }))
165
187
  }
166
188
  : undefined, actions: !disabled &&
167
- !readOnly && (_jsx(CurrentLocationButton, { defaultToCurrentLocation: defaultToCurrentLocation, onError: onError, onChange: a => {
168
- if (onlyCoordinates && a.longitude && a.latitude) {
169
- onSelect?.({ latitude: a.latitude, longitude: a.longitude });
189
+ !readOnly && (_jsx(CurrentLocationButton, { onError: onError, onResolve: resolved => {
190
+ if (onlyCoordinates) {
191
+ onSelect?.({ latitude: resolved.latitude, longitude: resolved.longitude });
170
192
  }
171
193
  else {
172
- onSelect?.(a);
194
+ onSelect?.(resolved);
173
195
  }
174
196
  } })), onChange: onInputChange, onBlur: () => {
175
197
  setFilterValue('');
176
198
  onBlur?.(value);
177
- }, value: value, required: required, disabled: disabled, readOnly: readOnly, status: status, ...restProps }), showMap && (_jsx(StyledLocationMap, { children: _jsx(LocationView, { location: location, onClick: onMapClick, onError: onError, bias: bias, disabled: disabled, centerMapOnChange: centerMapOnChange, height: height, zoomLevel: zoomLevel }) }))] }));
199
+ }, value: value, required: required, disabled: disabled, readOnly: readOnly, status: status, ...restProps }), map && (_jsx(StyledLocationMap, { children: _jsx(LocationView, { ...map, pins: map.location ? [{ ...map.location }] : [], onClick: onMapClick, onError: onError, disabled: disabled, loading: mapLoading, centerMapOnChange: true }) }))] }));
178
200
  return label ? (_jsx(FormField, { testId: testIds, label: label, labelHidden: labelHidden, id: id, info: info, status: status, ref: ref, required: required, disabled: disabled, additionalInfo: additionalInfo, children: Comp })) : (Comp);
179
201
  });
180
202
  export default withTestIds(LocationInput, getLocationInputTestIds);
@@ -1 +1 @@
1
- {"version":3,"file":"LocationInput.js","sourceRoot":"","sources":["../../../src/components/Location/LocationInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,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M,EAAE,MAAM,KACV,SAAS,GACb,EACD,OAAO,IAAI,CACV,KAAC,iBAAiB,cAChB,KAAC,YAAY,IACX,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GACpB,GACgB,CACrB,IACA,CACJ,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,YAE7B,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useContext, useEffect, useState } from 'react';\nimport type { ChangeEvent, FC, PropsWithoutRef, Ref } from 'react';\nimport styled from 'styled-components';\n\nimport ComboBox from '../ComboBox';\nimport type { MenuItemProps, MenuProps } from '../Menu';\nimport { useI18n, useTestIds } from '../../hooks';\nimport { createUID, withTestIds } from '../../utils';\nimport FormField from '../FormField';\nimport type { FormControlProps } from '../FormControl';\nimport type { BaseProps, ForwardProps, TestIdProp } from '../../types';\nimport Flex from '../Flex';\n\nimport PoweredByGoogleImage from './PoweredByGoogleImage';\nimport CurrentLocationButton from './CurrentLocationButton';\nimport MapsContext from './MapsContext';\nimport {\n getAddress,\n getCoords,\n getPlaceById,\n getPlacePredictions,\n isValueACoordinate,\n loadMapsAPI\n} from './utils';\nimport type BaseLocationProps from './Location.types';\nimport type { LatLng } from './types';\nimport LocationView, { StyledLocationView } from './LocationView';\nimport type { LocationViewProps } from './LocationView';\nimport { getLocationInputTestIds } from './Location.test-ids';\n\nexport interface LocationInputProps\n extends LocationViewProps,\n BaseLocationProps,\n BaseProps,\n FormControlProps,\n TestIdProp {\n /** Button when clicked will show additional information for the location input */\n additionalInfo?: FormControlProps['additionalInfo'];\n /**\n * Only select coordinates on map clicks.\n * @default false\n */\n onlyCoordinates?: boolean;\n /**\n * Get user current location on component first render.\n * @default false\n */\n defaultToCurrentLocation?: boolean;\n /** The value of the location field. */\n value?: string;\n /**\n * Callback fired on every change of the location input.\n * The argument passed back is the component's value prop.\n */\n onChange?: (value: string) => void;\n /**\n * Callback fired when the control's input loses focus.\n * The argument passed back is the component's value prop.\n */\n onBlur?: (value: string) => void;\n /**\n * Set to true renders the map view below input.\n * @default false\n */\n showMap?: boolean;\n /** Location coordinates used for the map view. */\n location?: LatLng | string;\n /** Callback fired when user chooses location from the dropdown of suggestions or submits input value. */\n onSelect?: (value: {\n name?: string;\n address?: string;\n latitude?: number;\n longitude?: number;\n }) => void;\n}\n\nconst StyledLocationMap = styled.div`\n ${StyledLocationView} {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n`;\n\nconst LocationInput: FC<LocationInputProps & ForwardProps> = forwardRef(function LocationInput(\n props: PropsWithoutRef<LocationInputProps>,\n ref: Ref<HTMLInputElement>\n) {\n const {\n testId,\n label,\n labelHidden,\n id = createUID(),\n location = '',\n value = '',\n info,\n status,\n required,\n readOnly,\n disabled,\n additionalInfo,\n onSelect,\n onError,\n onChange,\n bias,\n showMap,\n defaultToCurrentLocation,\n centerMapOnChange,\n height,\n zoomLevel,\n onClick,\n onBlur,\n onlyCoordinates = false,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getLocationInputTestIds);\n\n const { name, ...providerOpts } = useContext(MapsContext);\n const t = useI18n();\n const [placePredictionMenuItems, setPlacePredictionMenuItems] = useState<MenuProps['items']>([]);\n\n const [filterValue, setFilterValue] = useState('');\n\n useEffect(() => {\n (async () => {\n try {\n await loadMapsAPI(name, providerOpts);\n if (filterValue) {\n if (onlyCoordinates) {\n const { latitude, longitude } = await getCoords(filterValue);\n setPlacePredictionMenuItems([\n {\n primary: t('exact_location'),\n secondary: [`${latitude}, ${longitude}`],\n id: createUID(),\n onClick: () => {\n setFilterValue('');\n onSelect?.({ latitude, longitude });\n }\n }\n ]);\n } else {\n if (isValueACoordinate(filterValue)) {\n const { latitude, longitude } = await getCoords(filterValue);\n const { name: addressName, address } = await getAddress({ latitude, longitude });\n const menuItems = [\n {\n primary: t('exact_location'),\n secondary: [`${latitude}, ${longitude}`],\n id: createUID(),\n onClick: () => {\n setFilterValue('');\n onSelect?.({\n latitude,\n longitude\n });\n }\n },\n {\n primary: addressName,\n secondary: [address],\n id: createUID(),\n onClick: () => {\n setFilterValue('');\n onSelect?.({ name: addressName, address, latitude, longitude });\n }\n }\n ];\n setPlacePredictionMenuItems(menuItems);\n return;\n }\n const { placePredictions, token } = await getPlacePredictions(filterValue, bias);\n if (placePredictions.length === 1) {\n const exactLocation = await getPlaceById(placePredictions[0].place_id, token);\n const menuItems = placePredictions.map(item => ({\n id: item.place_id,\n primary: item.structured_formatting.main_text,\n secondary: [item.structured_formatting.secondary_text],\n onClick: (menuItemId: MenuItemProps['id']) => {\n getPlaceById(menuItemId, token).then(menuItemLocation => {\n setFilterValue('');\n onSelect?.(menuItemLocation);\n });\n }\n }));\n if (exactLocation) {\n menuItems.push({\n primary: t('exact_location'),\n secondary: [`${exactLocation.latitude}, ${exactLocation.longitude}`],\n id: createUID(),\n onClick: () => {\n setFilterValue('');\n onSelect?.({\n latitude: exactLocation.latitude,\n longitude: exactLocation.longitude\n });\n }\n });\n }\n setPlacePredictionMenuItems(menuItems);\n } else {\n setPlacePredictionMenuItems(\n placePredictions.map(item => ({\n id: item.place_id,\n primary: item.structured_formatting.main_text,\n secondary: [item.structured_formatting.secondary_text],\n onClick: (menuItemId: MenuItemProps['id']) => {\n getPlaceById(menuItemId, token).then(menuItemLocation => {\n setFilterValue('');\n onSelect?.(menuItemLocation);\n });\n }\n }))\n );\n }\n }\n } else {\n setPlacePredictionMenuItems([]);\n }\n } catch (e: any) {\n setPlacePredictionMenuItems([]);\n onError?.(e);\n }\n })();\n }, [filterValue, bias, onError, onSelect, onlyCoordinates]);\n\n const onInputChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setFilterValue(e.target.value);\n onChange?.(e.target.value);\n },\n [onChange]\n );\n\n const onMapClick = useCallback(\n (placeInfo: { latitude: number; longitude: number; name?: string; address?: string }) => {\n if (onlyCoordinates) {\n const coords = {\n latitude: placeInfo.latitude,\n longitude: placeInfo.longitude\n };\n onSelect?.(coords);\n onClick?.(coords);\n } else {\n onSelect?.(placeInfo);\n onClick?.(placeInfo);\n }\n },\n [onSelect, onClick, onlyCoordinates]\n );\n\n const Comp = (\n <>\n <ComboBox\n data-testid={testIds.control}\n placeholder={t('location_input_placeholder')}\n menu={\n filterValue\n ? {\n items: placePredictionMenuItems.concat([\n {\n id: createUID(),\n primary: t('use_input_value', [filterValue]),\n onClick: () => {\n setFilterValue('');\n onSelect?.({ name: filterValue, address: filterValue });\n }\n }\n ]),\n emptyText: t('location_not_found_text'),\n mode: 'action',\n footer: !showMap && (\n <Flex container={{ justify: 'end' }}>\n <PoweredByGoogleImage />\n </Flex>\n )\n }\n : undefined\n }\n actions={\n !disabled &&\n !readOnly && (\n <CurrentLocationButton\n defaultToCurrentLocation={defaultToCurrentLocation}\n onError={onError}\n onChange={a => {\n if (onlyCoordinates && a.longitude && a.latitude) {\n onSelect?.({ latitude: a.latitude, longitude: a.longitude });\n } else {\n onSelect?.(a);\n }\n }}\n />\n )\n }\n onChange={onInputChange}\n onBlur={() => {\n setFilterValue('');\n onBlur?.(value);\n }}\n value={value}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n {...restProps}\n />\n {showMap && (\n <StyledLocationMap>\n <LocationView\n location={location}\n onClick={onMapClick}\n onError={onError}\n bias={bias}\n disabled={disabled}\n centerMapOnChange={centerMapOnChange}\n height={height}\n zoomLevel={zoomLevel}\n />\n </StyledLocationMap>\n )}\n </>\n );\n\n return label ? (\n <FormField\n testId={testIds}\n label={label}\n labelHidden={labelHidden}\n id={id}\n info={info}\n status={status}\n ref={ref}\n required={required}\n disabled={disabled}\n additionalInfo={additionalInfo}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n});\n\nexport default withTestIds(LocationInput, getLocationInputTestIds);\n"]}
1
+ {"version":3,"file":"LocationInput.js","sourceRoot":"","sources":["../../../src/components/Location/LocationInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,YAAY,EAAE,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MA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AClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,KACV,SAAS,GACb,EACD,GAAG,IAAI,CACN,KAAC,iBAAiB,cAChB,KAAC,YAAY,OACP,GAAG,EACP,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAC/C,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,UAAU,EACnB,iBAAiB,SACjB,GACgB,CACrB,IACA,CACJ,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,YAE7B,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useContext, useEffect, useState } from 'react';\nimport type { ChangeEvent, FC, PropsWithoutRef, Ref } from 'react';\nimport styled from 'styled-components';\n\nimport ComboBox from '../ComboBox';\nimport type { MenuItemProps, MenuProps } from '../Menu';\nimport { useI18n, useTestIds, useUID } from '../../hooks';\nimport { createUID, withTestIds } from '../../utils';\nimport FormField from '../FormField';\nimport type { FormControlProps } from '../FormControl';\nimport type { BaseProps, ForwardProps, TestIdProp } from '../../types';\nimport Flex from '../Flex';\nimport { defaultThemeProp } from '../../theme';\n\nimport PoweredByGoogleImage from './PoweredByGoogleImage';\nimport CurrentLocationButton from './CurrentLocationButton';\nimport MapsContext from './MapsContext';\nimport {\n getAddress,\n getCoords,\n getNavigatorPosition,\n getPlaceById,\n getPlacePredictions,\n isValueACoordinate,\n loadMapsAPI\n} from './utils';\nimport type { Bias, LatLng } from './Location.types';\nimport LocationView, { StyledLocationView } from './LocationView';\nimport type { LocationViewProps } from './LocationView';\nimport { getLocationInputTestIds } from './Location.test-ids';\n\nexport interface LocationInputProps extends BaseProps, FormControlProps, TestIdProp {\n /**\n * Get user current location on component first render.\n * @default false\n */\n defaultToCurrentLocation?: boolean;\n /** The value of the location field. */\n value?: string;\n /**\n * Callback fired on every change of the location input.\n * The argument passed back is the component's value prop.\n */\n onChange?: (value: string) => void;\n /**\n * Callback fired when the control's input loses focus.\n * The argument passed back is the component's value prop.\n */\n onBlur?: (value: string) => void;\n /** Callback fired when user chooses location from the dropdown of suggestions or submits input value. */\n onSelect?: (value: {\n name?: string;\n address?: string;\n latitude?: number;\n longitude?: number;\n }) => void;\n /**\n * Only select coordinates on map clicks.\n * @default false\n */\n onlyCoordinates?: boolean;\n /** Biasing query results towards user location/preference. */\n bias?: Bias;\n /**\n * Set to true renders the map view below input.\n * @default false\n */\n map?: {\n /** Location coordinates used for the map view. */\n location?: LatLng;\n height: LocationViewProps['height'];\n zoomLevel?: LocationViewProps['zoomLevel'];\n onClick?: LocationViewProps['onClick'];\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\nconst StyledLocationInput = styled(ComboBox)`\n z-index: 1;\n`;\n\nStyledLocationInput.defaultProps = defaultThemeProp;\n\nconst StyledLocationMap = styled.div`\n ${StyledLocationView} {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n`;\n\nStyledLocationMap.defaultProps = defaultThemeProp;\n\nconst LocationInput: FC<LocationInputProps & ForwardProps> = forwardRef(function LocationInput(\n props: PropsWithoutRef<LocationInputProps>,\n ref: Ref<HTMLInputElement>\n) {\n const uid = useUID();\n const {\n testId,\n label,\n labelHidden,\n id = uid,\n value = '',\n info,\n status,\n required,\n readOnly,\n disabled,\n additionalInfo,\n onSelect,\n onError,\n onChange,\n onBlur,\n bias,\n defaultToCurrentLocation,\n onlyCoordinates = false,\n map,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getLocationInputTestIds);\n\n const { name, ...providerOpts } = useContext(MapsContext);\n const t = useI18n();\n const [placePredictionMenuItems, setPlacePredictionMenuItems] = useState<MenuProps['items']>([]);\n const [filterValue, setFilterValue] = useState('');\n const [mapLoading, setMapLoading] = useState(false);\n\n useEffect(() => {\n (async () => {\n if (defaultToCurrentLocation) {\n setMapLoading(true);\n await loadMapsAPI(name, providerOpts);\n const navigatorPosition = await getNavigatorPosition();\n const currentLocationAddress = await getAddress(navigatorPosition);\n setMapLoading(false);\n onSelect?.(currentLocationAddress);\n }\n })();\n }, []);\n\n useEffect(() => {\n (async () => {\n try {\n await loadMapsAPI(name, providerOpts);\n if (filterValue) {\n if (onlyCoordinates) {\n const { latitude, longitude } = await getCoords(filterValue);\n setPlacePredictionMenuItems([\n {\n primary: t('exact_location'),\n secondary: [`${latitude}, ${longitude}`],\n id: createUID(),\n onClick: () => {\n setFilterValue('');\n onSelect?.({ latitude, longitude });\n }\n }\n ]);\n } else {\n if (isValueACoordinate(filterValue)) {\n const { latitude, longitude } = await getCoords(filterValue);\n const { name: addressName, address } = await getAddress({ latitude, longitude });\n const menuItems = [\n {\n primary: t('exact_location'),\n secondary: [`${latitude}, ${longitude}`],\n id: createUID(),\n onClick: () => {\n setFilterValue('');\n onSelect?.({\n latitude,\n longitude\n });\n }\n },\n {\n primary: addressName,\n secondary: [address],\n id: createUID(),\n onClick: () => {\n setFilterValue('');\n onSelect?.({ name: addressName, address, latitude, longitude });\n }\n }\n ];\n\n setPlacePredictionMenuItems(menuItems);\n return;\n }\n const { placePredictions, token } = await getPlacePredictions(filterValue, bias);\n if (placePredictions.length === 1) {\n const exactLocation = await getPlaceById(placePredictions[0].place_id, token);\n const menuItems = placePredictions.map(item => ({\n id: item.place_id,\n primary: item.structured_formatting.main_text,\n secondary: [item.structured_formatting.secondary_text],\n onClick: (menuItemId: MenuItemProps['id']) => {\n getPlaceById(menuItemId, token).then(menuItemLocation => {\n setFilterValue('');\n onSelect?.(menuItemLocation);\n });\n }\n }));\n if (exactLocation) {\n menuItems.push({\n primary: t('exact_location'),\n secondary: [`${exactLocation.latitude}, ${exactLocation.longitude}`],\n id: createUID(),\n onClick: () => {\n setFilterValue('');\n onSelect?.({\n latitude: exactLocation.latitude,\n longitude: exactLocation.longitude\n });\n }\n });\n }\n setPlacePredictionMenuItems(menuItems);\n } else {\n setPlacePredictionMenuItems(\n placePredictions.map(item => ({\n id: item.place_id,\n primary: item.structured_formatting.main_text,\n secondary: [item.structured_formatting.secondary_text],\n onClick: (menuItemId: MenuItemProps['id']) => {\n getPlaceById(menuItemId, token).then(menuItemLocation => {\n setFilterValue('');\n onSelect?.(menuItemLocation);\n });\n }\n }))\n );\n }\n }\n } else {\n setPlacePredictionMenuItems([]);\n }\n } catch (e: any) {\n setPlacePredictionMenuItems([]);\n onError?.(e);\n }\n })();\n }, [filterValue, bias, onError, onSelect, onlyCoordinates]);\n\n const onInputChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setFilterValue(e.target.value.trim());\n onChange?.(e.target.value);\n },\n [onChange]\n );\n\n const onMapClick = useCallback(\n (placeInfo: { latitude: number; longitude: number; name?: string; address?: string }) => {\n if (readOnly) return;\n\n if (onlyCoordinates) {\n const coords = {\n latitude: placeInfo.latitude,\n longitude: placeInfo.longitude\n };\n onSelect?.(coords);\n map?.onClick?.(coords);\n } else {\n onSelect?.(placeInfo);\n map?.onClick?.(placeInfo);\n }\n },\n [readOnly, onSelect, map?.onClick, onlyCoordinates]\n );\n\n const Comp = (\n <>\n <StyledLocationInput\n id={id}\n info={info}\n data-testid={testIds.control}\n placeholder={t('location_input_placeholder')}\n menu={\n filterValue\n ? {\n items: placePredictionMenuItems.concat([\n {\n id: createUID(),\n primary: t('use_input_value', [filterValue]),\n onClick: () => {\n setFilterValue('');\n onSelect?.({ name: filterValue });\n }\n }\n ]),\n emptyText: t('location_not_found_text'),\n mode: 'action',\n footer: !map && (\n <Flex container={{ justify: 'end' }}>\n <PoweredByGoogleImage />\n </Flex>\n )\n }\n : undefined\n }\n actions={\n !disabled &&\n !readOnly && (\n <CurrentLocationButton\n onError={onError}\n onResolve={resolved => {\n if (onlyCoordinates) {\n onSelect?.({ latitude: resolved.latitude, longitude: resolved.longitude });\n } else {\n onSelect?.(resolved);\n }\n }}\n />\n )\n }\n onChange={onInputChange}\n onBlur={() => {\n setFilterValue('');\n onBlur?.(value);\n }}\n value={value}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n {...restProps}\n />\n {map && (\n <StyledLocationMap>\n <LocationView\n {...map}\n pins={map.location ? [{ ...map.location }] : []}\n onClick={onMapClick}\n onError={onError}\n disabled={disabled}\n loading={mapLoading}\n centerMapOnChange\n />\n </StyledLocationMap>\n )}\n </>\n );\n\n return label ? (\n <FormField\n testId={testIds}\n label={label}\n labelHidden={labelHidden}\n id={id}\n info={info}\n status={status}\n ref={ref}\n required={required}\n disabled={disabled}\n additionalInfo={additionalInfo}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n});\n\nexport default withTestIds(LocationInput, getLocationInputTestIds);\n"]}
@@ -1,19 +1,17 @@
1
- import type { FC } from 'react';
2
- import type { BaseProps } from '../../types';
3
- import type { LatLng } from './types';
4
- import type BaseLocationProps from './Location.types';
1
+ import type { WithAttributes } from '../../types';
2
+ import type { LatLng, Pin } from './Location.types';
5
3
  export declare const StyledLocationError: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("../Badges").StatusProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>> & {
6
- getTestIds: (testIdProp?: string | undefined) => import("../../types").TestIdsRecord<readonly []>;
4
+ getTestIds: (testIdProp?: string | null | undefined) => import("../../types").TestIdsRecord<readonly []>;
7
5
  }, import("styled-components").DefaultTheme, {}, never>;
8
6
  export declare const StyledLocationView: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
9
7
  height?: string | undefined;
10
8
  }, never>;
11
- export interface LocationViewProps extends BaseLocationProps, BaseProps {
9
+ export type LocationViewProps = WithAttributes<'div', {
12
10
  /**
13
- * Location string as either coordinates, name of a place, or 'current' for the current location.
14
- * @default 'current'
11
+ * Array of location objects.
12
+ * @default []
15
13
  */
16
- location?: LatLng | string | 'current';
14
+ pins?: Pin[];
17
15
  /**
18
16
  * 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.
19
17
  * @default false
@@ -30,11 +28,27 @@ export interface LocationViewProps extends BaseLocationProps, BaseProps {
30
28
  */
31
29
  zoomLevel?: number;
32
30
  /** Callback fired when user clicks on a location on the map. This function will be passed the coordinates of the location that was clicked. */
33
- onClick?: (coords: LatLng & {
31
+ onClick?: (locationData: LatLng & {
34
32
  name?: string;
35
33
  address?: string;
36
34
  }) => void;
37
- }
38
- declare const LocationView: FC<LocationViewProps>;
35
+ /**
36
+ * Renders loading indicator when true. Informs the user location resolution is in progress.
37
+ */
38
+ loading?: boolean;
39
+ /**
40
+ * Disables dragging and clicking when true.
41
+ * @default false
42
+ */
43
+ disabled?: boolean;
44
+ /**
45
+ * Indicates if route between pins should be rendered.
46
+ * @default false
47
+ */
48
+ drawRoute?: boolean;
49
+ /** Callback fired when an error occurs. This function gets called with one argument of type Error. */
50
+ onError?: (error: Error) => void;
51
+ }>;
52
+ declare const LocationView: import("react").ForwardRefExoticComponent<Omit<LocationViewProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
39
53
  export default LocationView;
40
54
  //# sourceMappingURL=LocationView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocationView.d.ts","sourceRoot":"","sources":["../../../src/components/Location/LocationView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA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AAiB,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,CACR,YAAY,EAAE,MAAM,GAAG;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KACE,IAAI,CAAC;IACV;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,sGAAsG;IACtG,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,CACF,CAAC;AAeF,QAAA,MAAM,YAAY,2HA4LjB,CAAC;AAEF,eAAe,YAAY,CAAC"}