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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (586) hide show
  1. package/lib/components/Actions/Actions.d.ts.map +1 -1
  2. package/lib/components/Actions/Actions.js +11 -5
  3. package/lib/components/Actions/Actions.js.map +1 -1
  4. package/lib/components/AdditionalInfo/AdditionalInfo.d.ts +2 -0
  5. package/lib/components/AdditionalInfo/AdditionalInfo.d.ts.map +1 -1
  6. package/lib/components/AdditionalInfo/AdditionalInfo.js +24 -15
  7. package/lib/components/AdditionalInfo/AdditionalInfo.js.map +1 -1
  8. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppHeader.js +4 -3
  10. package/lib/components/AppShell/AppHeader.js.map +1 -1
  11. package/lib/components/AppShell/AppHeader.styles.d.ts +2 -0
  12. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppHeader.styles.js +43 -33
  14. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  15. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShell.js +37 -13
  17. package/lib/components/AppShell/AppShell.js.map +1 -1
  18. package/lib/components/AppShell/AppShell.styles.d.ts +4 -1
  19. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  20. package/lib/components/AppShell/AppShell.styles.js +45 -14
  21. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  22. package/lib/components/AppShell/AppShell.types.d.ts +30 -0
  23. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  24. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  25. package/lib/components/AppShell/AppShellContext.d.ts +2 -0
  26. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  27. package/lib/components/AppShell/AppShellContext.js +2 -0
  28. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  29. package/lib/components/AppShell/AppShellList.d.ts +1 -1
  30. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  31. package/lib/components/AppShell/AppShellList.js +6 -2
  32. package/lib/components/AppShell/AppShellList.js.map +1 -1
  33. package/lib/components/AppShell/AppShellList.styles.d.ts +1 -1
  34. package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
  35. package/lib/components/AppShell/AppShellList.styles.js +21 -19
  36. package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
  37. package/lib/components/AppShell/AppShellSearch.styles.js +1 -1
  38. package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -1
  39. package/lib/components/AppShell/ContextSwitcher.d.ts +6 -0
  40. package/lib/components/AppShell/ContextSwitcher.d.ts.map +1 -0
  41. package/lib/components/AppShell/ContextSwitcher.js +18 -0
  42. package/lib/components/AppShell/ContextSwitcher.js.map +1 -0
  43. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  44. package/lib/components/AppShell/Drawer.js +8 -9
  45. package/lib/components/AppShell/Drawer.js.map +1 -1
  46. package/lib/components/AppShell/Drawer.styles.d.ts.map +1 -1
  47. package/lib/components/AppShell/Drawer.styles.js +7 -4
  48. package/lib/components/AppShell/Drawer.styles.js.map +1 -1
  49. package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
  50. package/lib/components/AppShell/NavigationList.js +15 -12
  51. package/lib/components/AppShell/NavigationList.js.map +1 -1
  52. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
  53. package/lib/components/AppShell/NavigationListItemWrapper.js +4 -2
  54. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  55. package/lib/components/AppShell/index.d.ts +2 -1
  56. package/lib/components/AppShell/index.d.ts.map +1 -1
  57. package/lib/components/AppShell/index.js +1 -0
  58. package/lib/components/AppShell/index.js.map +1 -1
  59. package/lib/components/Avatar/Avatar.d.ts +1 -1
  60. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  61. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  62. package/lib/components/Backdrop/Backdrop.js +22 -2
  63. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  64. package/lib/components/Badges/Count.d.ts +2 -2
  65. package/lib/components/Badges/Count.d.ts.map +1 -1
  66. package/lib/components/Badges/Count.js +22 -25
  67. package/lib/components/Badges/Count.js.map +1 -1
  68. package/lib/components/Badges/Selection.js +1 -1
  69. package/lib/components/Badges/Selection.js.map +1 -1
  70. package/lib/components/Badges/Tag.js +1 -1
  71. package/lib/components/Badges/Tag.js.map +1 -1
  72. package/lib/components/Banner/Banner.d.ts +28 -21
  73. package/lib/components/Banner/Banner.d.ts.map +1 -1
  74. package/lib/components/Banner/Banner.js +138 -96
  75. package/lib/components/Banner/Banner.js.map +1 -1
  76. package/lib/components/Banner/index.d.ts +1 -1
  77. package/lib/components/Banner/index.d.ts.map +1 -1
  78. package/lib/components/Banner/index.js.map +1 -1
  79. package/lib/components/Button/Button.d.ts +1 -1
  80. package/lib/components/Button/Button.d.ts.map +1 -1
  81. package/lib/components/Card/Card.d.ts +4 -7
  82. package/lib/components/Card/Card.d.ts.map +1 -1
  83. package/lib/components/Card/Card.js +2 -9
  84. package/lib/components/Card/Card.js.map +1 -1
  85. package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
  86. package/lib/components/ComboBox/ComboBox.styles.js +0 -3
  87. package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
  88. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  89. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +1 -3
  90. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  91. package/lib/components/Configuration/Configuration.d.ts +4 -1
  92. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  93. package/lib/components/Configuration/Configuration.js +2 -0
  94. package/lib/components/Configuration/Configuration.js.map +1 -1
  95. package/lib/components/CreditCard/CreditCard.types.d.ts +1 -1
  96. package/lib/components/CreditCard/CreditCard.types.d.ts.map +1 -1
  97. package/lib/components/DateTime/DateTime.types.d.ts +10 -7
  98. package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
  99. package/lib/components/DateTime/DateTime.types.js.map +1 -1
  100. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  101. package/lib/components/DateTime/Input/DateInput.js +19 -4
  102. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  103. package/lib/components/DateTime/Input/DateRangeInput.d.ts +4 -2
  104. package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
  105. package/lib/components/DateTime/Input/DateRangeInput.js +71 -34
  106. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  107. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  108. package/lib/components/DateTime/Input/DateTimeInput.js +26 -5
  109. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  110. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +1 -1
  111. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
  112. package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts +1 -1
  113. package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts.map +1 -1
  114. package/lib/components/DateTime/Input/Duration/Time.d.ts +1 -1
  115. package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
  116. package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
  117. package/lib/components/DateTime/Input/MonthInput.js +8 -3
  118. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  119. package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
  120. package/lib/components/DateTime/Input/PartInput.js +2 -2
  121. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  122. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  123. package/lib/components/DateTime/Input/TimeInput.js +13 -3
  124. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  125. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +4 -2
  126. package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
  127. package/lib/components/DateTime/Input/TimeRangeInput.js +70 -27
  128. package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
  129. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  130. package/lib/components/DateTime/Input/WeekInput.js +7 -2
  131. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  132. package/lib/components/DateTime/Input/usePickerButton.d.ts.map +1 -1
  133. package/lib/components/DateTime/Input/usePickerButton.js +19 -27
  134. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  135. package/lib/components/DateTime/Input/utils.d.ts +2 -2
  136. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  137. package/lib/components/DateTime/Input/utils.js +6 -17
  138. package/lib/components/DateTime/Input/utils.js.map +1 -1
  139. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  140. package/lib/components/DateTime/Picker/Calendar.js +3 -1
  141. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  142. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  143. package/lib/components/DateTime/Picker/DatePicker.js +2 -8
  144. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  145. package/lib/components/DateTime/Picker/TimePicker.d.ts +1 -1
  146. package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
  147. package/lib/components/DateTime/Picker/TimePicker.js +1 -1
  148. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  149. package/lib/components/Dialog/Dialog.d.ts +3 -30
  150. package/lib/components/Dialog/Dialog.d.ts.map +1 -1
  151. package/lib/components/Dialog/Dialog.js +7 -147
  152. package/lib/components/Dialog/Dialog.js.map +1 -1
  153. package/lib/components/Dialog/Dialog.styles.d.ts +3 -0
  154. package/lib/components/Dialog/Dialog.styles.d.ts.map +1 -0
  155. package/lib/components/Dialog/Dialog.styles.js +18 -0
  156. package/lib/components/Dialog/Dialog.styles.js.map +1 -0
  157. package/lib/components/Dialog/Dialog.types.d.ts +87 -0
  158. package/lib/components/Dialog/Dialog.types.d.ts.map +1 -0
  159. package/lib/components/Dialog/Dialog.types.js +3 -0
  160. package/lib/components/Dialog/Dialog.types.js.map +1 -0
  161. package/lib/components/Dialog/FormDialog.d.ts +7 -0
  162. package/lib/components/Dialog/FormDialog.d.ts.map +1 -0
  163. package/lib/components/Dialog/FormDialog.js +58 -0
  164. package/lib/components/Dialog/FormDialog.js.map +1 -0
  165. package/lib/components/Dialog/InfoDialog.d.ts +6 -0
  166. package/lib/components/Dialog/InfoDialog.d.ts.map +1 -0
  167. package/lib/components/Dialog/InfoDialog.js +43 -0
  168. package/lib/components/Dialog/InfoDialog.js.map +1 -0
  169. package/lib/components/Dialog/index.d.ts +3 -2
  170. package/lib/components/Dialog/index.d.ts.map +1 -1
  171. package/lib/components/Dialog/index.js +2 -2
  172. package/lib/components/Dialog/index.js.map +1 -1
  173. package/lib/components/Drawer/Drawer.d.ts +1 -1
  174. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  175. package/lib/components/EmojiPicker/EmojiPicker.d.ts +1 -1
  176. package/lib/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  177. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  178. package/lib/components/FieldGroup/FieldGroup.js +2 -1
  179. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  180. package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
  181. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  182. package/lib/components/FieldValueList/FieldValueList.js +5 -36
  183. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  184. package/lib/components/FieldValueList/index.d.ts +1 -1
  185. package/lib/components/FieldValueList/index.d.ts.map +1 -1
  186. package/lib/components/FieldValueList/index.js.map +1 -1
  187. package/lib/components/File/utils.d.ts +1 -1
  188. package/lib/components/File/utils.d.ts.map +1 -1
  189. package/lib/components/Flex/Flex.d.ts +2 -2
  190. package/lib/components/Flex/Flex.d.ts.map +1 -1
  191. package/lib/components/FormControl/FormControl.d.ts +4 -0
  192. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  193. package/lib/components/FormControl/FormControl.js +3 -1
  194. package/lib/components/FormControl/FormControl.js.map +1 -1
  195. package/lib/components/FormControl/index.d.ts +1 -0
  196. package/lib/components/FormControl/index.d.ts.map +1 -1
  197. package/lib/components/FormControl/index.js.map +1 -1
  198. package/lib/components/Grid/Grid.types.d.ts +2 -2
  199. package/lib/components/Grid/Grid.types.d.ts.map +1 -1
  200. package/lib/components/HTML/HTML.d.ts.map +1 -1
  201. package/lib/components/HTML/HTML.js +1 -0
  202. package/lib/components/HTML/HTML.js.map +1 -1
  203. package/lib/components/Icon/iconNames.d.ts +2 -2
  204. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  205. package/lib/components/Icon/iconNames.js +2 -0
  206. package/lib/components/Icon/iconNames.js.map +1 -1
  207. package/lib/components/Icon/icons/user-question-mark-solid.icon.d.ts +4 -0
  208. package/lib/components/Icon/icons/user-question-mark-solid.icon.d.ts.map +1 -0
  209. package/lib/components/Icon/icons/user-question-mark-solid.icon.js +6 -0
  210. package/lib/components/Icon/icons/user-question-mark-solid.icon.js.map +1 -0
  211. package/lib/components/Icon/icons/user-question-mark.icon.d.ts +4 -0
  212. package/lib/components/Icon/icons/user-question-mark.icon.d.ts.map +1 -0
  213. package/lib/components/Icon/icons/user-question-mark.icon.js +6 -0
  214. package/lib/components/Icon/icons/user-question-mark.icon.js.map +1 -0
  215. package/lib/components/Lightbox/Lightbox.styles.js +2 -2
  216. package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
  217. package/lib/components/Link/Link.d.ts.map +1 -1
  218. package/lib/components/Link/Link.js +13 -4
  219. package/lib/components/Link/Link.js.map +1 -1
  220. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -1
  221. package/lib/components/List/CommaSeparatedList.js +5 -37
  222. package/lib/components/List/CommaSeparatedList.js.map +1 -1
  223. package/lib/components/List/List.d.ts.map +1 -1
  224. package/lib/components/List/List.js +11 -1
  225. package/lib/components/List/List.js.map +1 -1
  226. package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
  227. package/lib/components/ListToolbar/ListToolbar.js +106 -68
  228. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  229. package/lib/components/ListToolbar/ListToolbar.styles.d.ts +5 -1
  230. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  231. package/lib/components/ListToolbar/ListToolbar.styles.js +50 -5
  232. package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
  233. package/lib/components/ListToolbar/ListToolbar.types.d.ts +5 -5
  234. package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
  235. package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
  236. package/lib/components/LiveLog/Context.d.ts +3 -0
  237. package/lib/components/LiveLog/Context.d.ts.map +1 -0
  238. package/lib/components/LiveLog/Context.js +9 -0
  239. package/lib/components/LiveLog/Context.js.map +1 -0
  240. package/lib/components/LiveLog/LiveLog.d.ts +10 -0
  241. package/lib/components/LiveLog/LiveLog.d.ts.map +1 -0
  242. package/lib/components/LiveLog/LiveLog.js +99 -0
  243. package/lib/components/LiveLog/LiveLog.js.map +1 -0
  244. package/lib/components/LiveLog/LiveLog.styles.d.ts +3 -0
  245. package/lib/components/LiveLog/LiveLog.styles.d.ts.map +1 -0
  246. package/lib/components/LiveLog/LiveLog.styles.js +9 -0
  247. package/lib/components/LiveLog/LiveLog.styles.js.map +1 -0
  248. package/lib/components/LiveLog/LiveLog.types.d.ts +93 -0
  249. package/lib/components/LiveLog/LiveLog.types.d.ts.map +1 -0
  250. package/lib/components/LiveLog/LiveLog.types.js +2 -0
  251. package/lib/components/LiveLog/LiveLog.types.js.map +1 -0
  252. package/lib/components/LiveLog/index.d.ts +4 -0
  253. package/lib/components/LiveLog/index.d.ts.map +1 -0
  254. package/lib/components/LiveLog/index.js +3 -0
  255. package/lib/components/LiveLog/index.js.map +1 -0
  256. package/lib/components/Location/CurrentLocationButton.d.ts +1 -1
  257. package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
  258. package/lib/components/Location/LocationInput.d.ts.map +1 -1
  259. package/lib/components/Location/LocationInput.js +1 -2
  260. package/lib/components/Location/LocationInput.js.map +1 -1
  261. package/lib/components/Location/LocationView.d.ts.map +1 -1
  262. package/lib/components/Location/LocationView.js +4 -4
  263. package/lib/components/Location/LocationView.js.map +1 -1
  264. package/lib/components/Location/MapsContext.d.ts +1 -1
  265. package/lib/components/Location/MapsContext.d.ts.map +1 -1
  266. package/lib/components/Location/utils.d.ts +1 -1
  267. package/lib/components/Location/utils.d.ts.map +1 -1
  268. package/lib/components/Location/utils.js.map +1 -1
  269. package/lib/components/Menu/Menu.js +3 -3
  270. package/lib/components/Menu/Menu.js.map +1 -1
  271. package/lib/components/Menu/Menu.styles.js +1 -1
  272. package/lib/components/Menu/Menu.styles.js.map +1 -1
  273. package/lib/components/Menu/Menu.types.d.ts +3 -5
  274. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  275. package/lib/components/Menu/Menu.types.js.map +1 -1
  276. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  277. package/lib/components/Menu/MenuList.js +4 -3
  278. package/lib/components/Menu/MenuList.js.map +1 -1
  279. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  280. package/lib/components/MenuButton/MenuButton.js +18 -4
  281. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  282. package/lib/components/Modal/Modal.d.ts.map +1 -1
  283. package/lib/components/Modal/Modal.js +6 -8
  284. package/lib/components/Modal/Modal.js.map +1 -1
  285. package/lib/components/Modal/Modal.types.d.ts +2 -1
  286. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  287. package/lib/components/Modal/Modal.types.js.map +1 -1
  288. package/lib/components/Number/NumberInput.types.d.ts +3 -1
  289. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  290. package/lib/components/Number/NumberInput.types.js.map +1 -1
  291. package/lib/components/Number/NumberRangeInput.d.ts.map +1 -1
  292. package/lib/components/Number/NumberRangeInput.js +71 -4
  293. package/lib/components/Number/NumberRangeInput.js.map +1 -1
  294. package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
  295. package/lib/components/PageTemplates/CategorySubPage.js +15 -4
  296. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  297. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  298. package/lib/components/PageTemplates/CategorySubPage.styles.js +5 -0
  299. package/lib/components/PageTemplates/CategorySubPage.styles.js.map +1 -1
  300. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  301. package/lib/components/PageTemplates/DashboardPage.js +16 -2
  302. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  303. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  304. package/lib/components/PageTemplates/PageTemplates.js +20 -3
  305. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  306. package/lib/components/Popover/Popover.d.ts +1 -1
  307. package/lib/components/Popover/Popover.d.ts.map +1 -1
  308. package/lib/components/Popover/Popover.js +2 -5
  309. package/lib/components/Popover/Popover.js.map +1 -1
  310. package/lib/components/Popover/Popover.styles.d.ts +0 -1
  311. package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
  312. package/lib/components/Popover/Popover.styles.js +0 -6
  313. package/lib/components/Popover/Popover.styles.js.map +1 -1
  314. package/lib/components/Popover/modifiers.d.ts +0 -2
  315. package/lib/components/Popover/modifiers.d.ts.map +1 -1
  316. package/lib/components/Popover/modifiers.js +1 -32
  317. package/lib/components/Popover/modifiers.js.map +1 -1
  318. package/lib/components/Progress/Bar.d.ts +0 -3
  319. package/lib/components/Progress/Bar.d.ts.map +1 -1
  320. package/lib/components/Progress/Bar.js +1 -54
  321. package/lib/components/Progress/Bar.js.map +1 -1
  322. package/lib/components/Progress/Ellipsis.d.ts +0 -1
  323. package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
  324. package/lib/components/Progress/Ellipsis.js +1 -72
  325. package/lib/components/Progress/Ellipsis.js.map +1 -1
  326. package/lib/components/Progress/Progress.d.ts.map +1 -1
  327. package/lib/components/Progress/Progress.js +99 -60
  328. package/lib/components/Progress/Progress.js.map +1 -1
  329. package/lib/components/Progress/Progress.styles.d.ts +12 -0
  330. package/lib/components/Progress/Progress.styles.d.ts.map +1 -0
  331. package/lib/components/Progress/Progress.styles.js +217 -0
  332. package/lib/components/Progress/Progress.styles.js.map +1 -0
  333. package/lib/components/Progress/Progress.types.d.ts +19 -2
  334. package/lib/components/Progress/Progress.types.d.ts.map +1 -1
  335. package/lib/components/Progress/Progress.types.js.map +1 -1
  336. package/lib/components/Progress/Ring.d.ts +0 -3
  337. package/lib/components/Progress/Ring.d.ts.map +1 -1
  338. package/lib/components/Progress/Ring.js +1 -58
  339. package/lib/components/Progress/Ring.js.map +1 -1
  340. package/lib/components/Progress/index.d.ts +1 -3
  341. package/lib/components/Progress/index.d.ts.map +1 -1
  342. package/lib/components/Progress/index.js +1 -3
  343. package/lib/components/Progress/index.js.map +1 -1
  344. package/lib/components/QRCode/QRCode.d.ts +14 -0
  345. package/lib/components/QRCode/QRCode.d.ts.map +1 -0
  346. package/lib/components/QRCode/QRCode.js +39 -0
  347. package/lib/components/QRCode/QRCode.js.map +1 -0
  348. package/lib/components/QRCode/index.d.ts +3 -0
  349. package/lib/components/QRCode/index.d.ts.map +1 -0
  350. package/lib/components/QRCode/index.js +2 -0
  351. package/lib/components/QRCode/index.js.map +1 -0
  352. package/lib/components/RadioCheck/RadioCheck.js +1 -1
  353. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  354. package/lib/components/SearchInput/SearchInput.d.ts +2 -2
  355. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  356. package/lib/components/SearchInput/SearchInput.js +28 -8
  357. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  358. package/lib/components/SearchInput/SearchInput.styles.js +1 -1
  359. package/lib/components/SearchInput/SearchInput.styles.js.map +1 -1
  360. package/lib/components/ShowMoreLess/ShowMoreLess.d.ts +9 -0
  361. package/lib/components/ShowMoreLess/ShowMoreLess.d.ts.map +1 -0
  362. package/lib/components/ShowMoreLess/ShowMoreLess.js +41 -0
  363. package/lib/components/ShowMoreLess/ShowMoreLess.js.map +1 -0
  364. package/lib/components/ShowMoreLess/index.d.ts +3 -0
  365. package/lib/components/ShowMoreLess/index.d.ts.map +1 -0
  366. package/lib/components/ShowMoreLess/index.js +2 -0
  367. package/lib/components/ShowMoreLess/index.js.map +1 -0
  368. package/lib/components/SkipLinks/SkipLinks.d.ts.map +1 -1
  369. package/lib/components/SkipLinks/SkipLinks.js +3 -26
  370. package/lib/components/SkipLinks/SkipLinks.js.map +1 -1
  371. package/lib/components/Slider/Slider.styles.d.ts +1 -1
  372. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  373. package/lib/components/Tabs/Tab.js +2 -2
  374. package/lib/components/Tabs/Tab.js.map +1 -1
  375. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  376. package/lib/components/Tabs/Tabs.js +8 -10
  377. package/lib/components/Tabs/Tabs.js.map +1 -1
  378. package/lib/components/TextArea/TextArea.js +2 -2
  379. package/lib/components/TextArea/TextArea.js.map +1 -1
  380. package/lib/components/Toaster/Context.d.ts +1 -0
  381. package/lib/components/Toaster/Context.d.ts.map +1 -1
  382. package/lib/components/Toaster/Context.js.map +1 -1
  383. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  384. package/lib/components/Toaster/Toaster.js +6 -2
  385. package/lib/components/Toaster/Toaster.js.map +1 -1
  386. package/lib/components/Tree/StandardTree.d.ts.map +1 -1
  387. package/lib/components/Tree/StandardTree.js +70 -27
  388. package/lib/components/Tree/StandardTree.js.map +1 -1
  389. package/lib/components/Tree/StandardTree.styles.d.ts +1 -0
  390. package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -1
  391. package/lib/components/Tree/StandardTree.styles.js +32 -18
  392. package/lib/components/Tree/StandardTree.styles.js.map +1 -1
  393. package/lib/components/Tree/StandardTree.types.d.ts +28 -1
  394. package/lib/components/Tree/StandardTree.types.d.ts.map +1 -1
  395. package/lib/components/Tree/StandardTree.types.js.map +1 -1
  396. package/lib/components/Tree/Tree.d.ts +2 -2
  397. package/lib/components/Tree/Tree.d.ts.map +1 -1
  398. package/lib/components/Tree/helpers.d.ts +11 -9
  399. package/lib/components/Tree/helpers.d.ts.map +1 -1
  400. package/lib/components/Tree/helpers.js +25 -5
  401. package/lib/components/Tree/helpers.js.map +1 -1
  402. package/lib/components/Tree/index.d.ts +1 -1
  403. package/lib/components/Tree/index.d.ts.map +1 -1
  404. package/lib/components/Tree/index.js.map +1 -1
  405. package/lib/components/URL/URLDisplay.d.ts +2 -2
  406. package/lib/components/URL/URLDisplay.d.ts.map +1 -1
  407. package/lib/components/URL/URLDisplay.js +8 -1
  408. package/lib/components/URL/URLDisplay.js.map +1 -1
  409. package/lib/hooks/index.d.ts +1 -0
  410. package/lib/hooks/index.d.ts.map +1 -1
  411. package/lib/hooks/index.js +1 -0
  412. package/lib/hooks/index.js.map +1 -1
  413. package/lib/hooks/useActiveDescendant.d.ts +2 -2
  414. package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
  415. package/lib/hooks/useArrows.d.ts.map +1 -1
  416. package/lib/hooks/useArrows.js +3 -3
  417. package/lib/hooks/useArrows.js.map +1 -1
  418. package/lib/hooks/useBreakpoint.d.ts.map +1 -1
  419. package/lib/hooks/useBreakpoint.js +3 -2
  420. package/lib/hooks/useBreakpoint.js.map +1 -1
  421. package/lib/hooks/useEvent.d.ts +2 -2
  422. package/lib/hooks/useEvent.d.ts.map +1 -1
  423. package/lib/hooks/useI18n.d.ts +88 -19
  424. package/lib/hooks/useI18n.d.ts.map +1 -1
  425. package/lib/hooks/useLiveLog.d.ts +8 -0
  426. package/lib/hooks/useLiveLog.d.ts.map +1 -0
  427. package/lib/hooks/useLiveLog.js +16 -0
  428. package/lib/hooks/useLiveLog.js.map +1 -0
  429. package/lib/hooks/useOverride.d.ts +1 -1
  430. package/lib/hooks/useOverride.d.ts.map +1 -1
  431. package/lib/hooks/useScrollStick.d.ts +1 -1
  432. package/lib/hooks/useScrollStick.d.ts.map +1 -1
  433. package/lib/i18n/default.d.ts +88 -19
  434. package/lib/i18n/default.d.ts.map +1 -1
  435. package/lib/i18n/default.js +98 -27
  436. package/lib/i18n/default.js.map +1 -1
  437. package/lib/i18n/i18n.d.ts +90 -21
  438. package/lib/i18n/i18n.d.ts.map +1 -1
  439. package/lib/i18n/translate.d.ts +1 -1
  440. package/lib/i18n/translate.d.ts.map +1 -1
  441. package/lib/index.d.ts +6 -1
  442. package/lib/index.d.ts.map +1 -1
  443. package/lib/index.js +6 -1
  444. package/lib/index.js.map +1 -1
  445. package/lib/register-contexts.js +2 -0
  446. package/lib/register-contexts.js.map +1 -1
  447. package/lib/styles/gradients.d.ts +1 -1
  448. package/lib/styles/gradients.d.ts.map +1 -1
  449. package/lib/styles/utils.d.ts +1 -1
  450. package/lib/styles/utils.d.ts.map +1 -1
  451. package/lib/styles/utils.js +10 -10
  452. package/lib/styles/utils.js.map +1 -1
  453. package/lib/theme/ThemeMachine.d.ts +3 -3
  454. package/lib/theme/ThemeMachine.d.ts.map +1 -1
  455. package/lib/theme/ThemeMachine.js +30 -30
  456. package/lib/theme/ThemeMachine.js.map +1 -1
  457. package/lib/theme/theme.d.ts +45 -75
  458. package/lib/theme/theme.d.ts.map +1 -1
  459. package/lib/theme/themeDefinition.json +14 -30
  460. package/lib/theme/themeOverrides.schema.json +1 -4
  461. package/lib/theme/themes/darkTheme.json +4 -1
  462. package/lib/theme/themes/legacyBuildTheme.json +2 -3
  463. package/lib/types/types.d.ts +19 -11
  464. package/lib/types/types.d.ts.map +1 -1
  465. package/lib/types/types.js.map +1 -1
  466. package/lib/utils/bindAll.d.ts +4 -0
  467. package/lib/utils/bindAll.d.ts.map +1 -0
  468. package/lib/utils/bindAll.js +9 -0
  469. package/lib/utils/bindAll.js.map +1 -0
  470. package/lib/utils/cap.d.ts +4 -0
  471. package/lib/utils/cap.d.ts.map +1 -0
  472. package/lib/utils/cap.js +6 -0
  473. package/lib/utils/cap.js.map +1 -0
  474. package/lib/utils/createStringMatcher.d.ts +10 -0
  475. package/lib/utils/createStringMatcher.d.ts.map +1 -0
  476. package/lib/utils/createStringMatcher.js +21 -0
  477. package/lib/utils/createStringMatcher.js.map +1 -0
  478. package/lib/utils/createUID.d.ts +4 -0
  479. package/lib/utils/createUID.d.ts.map +1 -0
  480. package/lib/utils/createUID.js +6 -0
  481. package/lib/utils/createUID.js.map +1 -0
  482. package/lib/utils/debounce.d.ts +4 -0
  483. package/lib/utils/debounce.d.ts.map +1 -0
  484. package/lib/utils/debounce.js +14 -0
  485. package/lib/utils/debounce.js.map +1 -0
  486. package/lib/utils/deepGet.d.ts +3 -0
  487. package/lib/utils/deepGet.d.ts.map +1 -0
  488. package/lib/utils/deepGet.js +15 -0
  489. package/lib/utils/deepGet.js.map +1 -0
  490. package/lib/utils/deepObjectComparison.d.ts +4 -0
  491. package/lib/utils/deepObjectComparison.d.ts.map +1 -0
  492. package/lib/utils/deepObjectComparison.js +35 -0
  493. package/lib/utils/deepObjectComparison.js.map +1 -0
  494. package/lib/utils/defineSmartGetter.d.ts +3 -0
  495. package/lib/utils/defineSmartGetter.d.ts.map +1 -0
  496. package/lib/utils/defineSmartGetter.js +14 -0
  497. package/lib/utils/defineSmartGetter.js.map +1 -0
  498. package/lib/utils/documentIsAvailable.d.ts +3 -0
  499. package/lib/utils/documentIsAvailable.d.ts.map +1 -0
  500. package/lib/utils/documentIsAvailable.js +3 -0
  501. package/lib/utils/documentIsAvailable.js.map +1 -0
  502. package/lib/utils/escapeRegExp.d.ts +8 -0
  503. package/lib/utils/escapeRegExp.d.ts.map +1 -0
  504. package/lib/utils/escapeRegExp.js +8 -0
  505. package/lib/utils/escapeRegExp.js.map +1 -0
  506. package/lib/utils/focusHeadingOrContainer.d.ts +8 -0
  507. package/lib/utils/focusHeadingOrContainer.d.ts.map +1 -0
  508. package/lib/utils/focusHeadingOrContainer.js +29 -0
  509. package/lib/utils/focusHeadingOrContainer.js.map +1 -0
  510. package/lib/utils/formatListToLocaleString.d.ts +15 -0
  511. package/lib/utils/formatListToLocaleString.d.ts.map +1 -0
  512. package/lib/utils/formatListToLocaleString.js +17 -0
  513. package/lib/utils/formatListToLocaleString.js.map +1 -0
  514. package/lib/utils/getActiveElement.d.ts +8 -0
  515. package/lib/utils/getActiveElement.d.ts.map +1 -0
  516. package/lib/utils/getActiveElement.js +18 -0
  517. package/lib/utils/getActiveElement.js.map +1 -0
  518. package/lib/utils/getFocusables.d.ts +9 -0
  519. package/lib/utils/getFocusables.d.ts.map +1 -0
  520. package/lib/utils/getFocusables.js +15 -0
  521. package/lib/utils/getFocusables.js.map +1 -0
  522. package/lib/utils/getScrollbarWidth.d.ts +4 -0
  523. package/lib/utils/getScrollbarWidth.d.ts.map +1 -0
  524. package/lib/utils/getScrollbarWidth.js +17 -0
  525. package/lib/utils/getScrollbarWidth.js.map +1 -0
  526. package/lib/utils/hasProp.d.ts +4 -0
  527. package/lib/utils/hasProp.d.ts.map +1 -0
  528. package/lib/utils/hasProp.js +6 -0
  529. package/lib/utils/hasProp.js.map +1 -0
  530. package/lib/utils/index.d.ts +27 -1
  531. package/lib/utils/index.d.ts.map +1 -1
  532. package/lib/utils/index.js +27 -1
  533. package/lib/utils/index.js.map +1 -1
  534. package/lib/utils/loadScript.d.ts +3 -0
  535. package/lib/utils/loadScript.d.ts.map +1 -0
  536. package/lib/utils/loadScript.js +9 -0
  537. package/lib/utils/loadScript.js.map +1 -0
  538. package/lib/utils/navigatorIsAvailable.d.ts +3 -0
  539. package/lib/utils/navigatorIsAvailable.d.ts.map +1 -0
  540. package/lib/utils/navigatorIsAvailable.js +3 -0
  541. package/lib/utils/navigatorIsAvailable.js.map +1 -0
  542. package/lib/utils/normalizeElements.d.ts +9 -0
  543. package/lib/utils/normalizeElements.d.ts.map +1 -0
  544. package/lib/utils/normalizeElements.js +14 -0
  545. package/lib/utils/normalizeElements.js.map +1 -0
  546. package/lib/utils/range.d.ts +4 -0
  547. package/lib/utils/range.d.ts.map +1 -0
  548. package/lib/utils/range.js +8 -0
  549. package/lib/utils/range.js.map +1 -0
  550. package/lib/utils/reflow.d.ts +4 -0
  551. package/lib/utils/reflow.d.ts.map +1 -0
  552. package/lib/utils/reflow.js +7 -0
  553. package/lib/utils/reflow.js.map +1 -0
  554. package/lib/utils/replaceMatchWithElement.d.ts +4 -0
  555. package/lib/utils/replaceMatchWithElement.d.ts.map +1 -0
  556. package/lib/utils/replaceMatchWithElement.js +32 -0
  557. package/lib/utils/replaceMatchWithElement.js.map +1 -0
  558. package/lib/utils/sameOrigin.d.ts +7 -0
  559. package/lib/utils/sameOrigin.d.ts.map +1 -0
  560. package/lib/utils/sameOrigin.js +25 -0
  561. package/lib/utils/sameOrigin.js.map +1 -0
  562. package/lib/utils/testElForOverflow.d.ts +4 -0
  563. package/lib/utils/testElForOverflow.d.ts.map +1 -0
  564. package/lib/utils/testElForOverflow.js +6 -0
  565. package/lib/utils/testElForOverflow.js.map +1 -0
  566. package/lib/utils/triple.d.ts +12 -0
  567. package/lib/utils/triple.d.ts.map +1 -0
  568. package/lib/utils/triple.js +13 -0
  569. package/lib/utils/triple.js.map +1 -0
  570. package/lib/utils/tryCatch.d.ts +5 -0
  571. package/lib/utils/tryCatch.d.ts.map +1 -0
  572. package/lib/utils/tryCatch.js +16 -0
  573. package/lib/utils/tryCatch.js.map +1 -0
  574. package/lib/utils/windowIsAvailable.d.ts +3 -0
  575. package/lib/utils/windowIsAvailable.d.ts.map +1 -0
  576. package/lib/utils/windowIsAvailable.js +3 -0
  577. package/lib/utils/windowIsAvailable.js.map +1 -0
  578. package/package.json +4 -2
  579. package/lib/components/ListToolbar/QueryOptionPopover.d.ts +0 -12
  580. package/lib/components/ListToolbar/QueryOptionPopover.d.ts.map +0 -1
  581. package/lib/components/ListToolbar/QueryOptionPopover.js +0 -36
  582. package/lib/components/ListToolbar/QueryOptionPopover.js.map +0 -1
  583. package/lib/utils/utils.d.ts +0 -93
  584. package/lib/utils/utils.d.ts.map +0 -1
  585. package/lib/utils/utils.js +0 -287
  586. package/lib/utils/utils.js.map +0 -1
@@ -1,10 +1,12 @@
1
1
  import styled, { css } from 'styled-components';
2
+ import Flex from '../Flex';
2
3
  import { StyledSearchInput } from '../SearchInput';
3
4
  import MenuButton from '../MenuButton';
4
5
  import Text, { StyledText } from '../Text';
5
6
  import { defaultThemeProp } from '../../theme';
6
7
  import { calculateFontSize } from '../../styles';
7
8
  import { StyledButton } from '../Button';
9
+ import { StyledFormDialog } from '../Dialog/FormDialog';
8
10
  export const StyledSearchForm = styled.div `
9
11
  ${StyledSearchInput} {
10
12
  flex-grow: 1;
@@ -38,18 +40,35 @@ export const StyledViewSelector = styled(MenuButton)(({ theme, required }) => {
38
40
  `;
39
41
  });
40
42
  StyledViewSelector.defaultProps = defaultThemeProp;
41
- export const StyledListToolbar = styled.div `
42
- ${StyledButton} + ${StyledButton} {
43
- margin-inline-start: 0;
44
- }
45
- `;
43
+ export const StyledListToolbar = styled.div(({ theme }) => {
44
+ return css `
45
+ ${StyledButton} + ${StyledButton} {
46
+ margin-inline-start: 0;
47
+ }
48
+ border-radius: calc(0.25 * ${theme.base['border-radius']});
49
+
50
+ &:has(:focus-visible:not(input)):not([disabled]) {
51
+ box-shadow: ${theme.base.shadow['focus-group']};
52
+ }
53
+
54
+ ${StyledFormDialog} {
55
+ min-width: min(${theme.base['content-width'].md}, 100vw);
56
+ }
57
+ `;
58
+ });
59
+ StyledListToolbar.defaultProps = defaultThemeProp;
46
60
  export const StyledHeadingText = styled(Text)(({ theme, required }) => {
47
61
  const { urgent } = theme.base.palette;
48
62
  const hitAreaMouse = theme.base['hit-area']['mouse-min'];
49
63
  const hitAreaFinger = theme.base['hit-area']['finger-min'];
50
64
  return css `
65
+ position: relative;
51
66
  line-height: ${hitAreaMouse};
52
67
  word-break: break-word;
68
+ ${required &&
69
+ css `
70
+ padding-inline-end: calc(1.5 * ${theme.base.spacing});
71
+ `}
53
72
  @media (pointer: coarse) {
54
73
  line-height: ${hitAreaFinger};
55
74
  }
@@ -58,8 +77,34 @@ export const StyledHeadingText = styled(Text)(({ theme, required }) => {
58
77
  content: '\\00a0*';
59
78
  vertical-align: top;
60
79
  color: ${urgent};
80
+ position: absolute;
81
+ inset-inline-end: 0;
82
+ inset-block-start: 0;
61
83
  }
62
84
  `;
63
85
  });
64
86
  StyledHeadingText.defaultProps = defaultThemeProp;
87
+ export const StyledCountMeta = styled(Text)(({ theme }) => {
88
+ const hitAreaMouse = theme.base['hit-area']['mouse-min'];
89
+ const hitAreaFinger = theme.base['hit-area']['finger-min'];
90
+ return css `
91
+ line-height: ${hitAreaMouse};
92
+
93
+ @media (pointer: coarse) {
94
+ line-height: ${hitAreaFinger};
95
+ }
96
+ `;
97
+ });
98
+ StyledCountMeta.defaultProps = defaultThemeProp;
99
+ export const StyledContainer = styled(Flex) `
100
+ @media (pointer: coarse) {
101
+ overflow: hidden;
102
+
103
+ ${StyledHeadingText}, ${StyledViewSelector} ${StyledText} {
104
+ white-space: nowrap;
105
+ overflow: hidden;
106
+ text-overflow: ellipsis;
107
+ }
108
+ }
109
+ `;
65
110
  //# sourceMappingURL=ListToolbar.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListToolbar.styles.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MA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iB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;IACtC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;IAE3D,OAAO,GAAG,CAAA;mBACO,YAAY;;;qBAGV,aAAa;;;iBAGjB,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM;;;eAG9B,MAAM;;GAElB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { StyledSearchInput } from '../SearchInput';\nimport MenuButton from '../MenuButton';\nimport Text, { StyledText } from '../Text';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport { StyledButton } from '../Button';\n\nexport const StyledSearchForm = styled.div`\n ${StyledSearchInput} {\n flex-grow: 1;\n max-width: min(100%, 40ch);\n }\n`;\n\nexport const StyledViewSelector = styled(MenuButton)(({ theme, required }) => {\n const fontSizes = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { urgent } = theme.base.palette;\n const hitAreaMouse = theme.base['hit-area']['mouse-min'];\n const hitAreaFinger = theme.base['hit-area']['finger-min'];\n\n return css`\n flex-shrink: initial;\n white-space: initial;\n ${StyledText} {\n font-size: ${fontSizes[theme.components.text.h3['font-size'] as FontSize]};\n font-weight: ${theme.components.text.h3['font-weight']};\n line-height: ${hitAreaMouse};\n word-break: break-word;\n @media (pointer: coarse) {\n line-height: ${hitAreaFinger};\n }\n }\n\n ${StyledText}::after {\n display: ${required ? 'inline-block' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n `;\n});\n\nStyledViewSelector.defaultProps = defaultThemeProp;\n\nexport const StyledListToolbar = styled.div`\n ${StyledButton} + ${StyledButton} {\n margin-inline-start: 0;\n }\n`;\n\nexport const StyledHeadingText = styled(Text)(({ theme, required }) => {\n const { urgent } = theme.base.palette;\n const hitAreaMouse = theme.base['hit-area']['mouse-min'];\n const hitAreaFinger = theme.base['hit-area']['finger-min'];\n\n return css`\n line-height: ${hitAreaMouse};\n word-break: break-word;\n @media (pointer: coarse) {\n line-height: ${hitAreaFinger};\n }\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n `;\n});\n\nStyledHeadingText.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"ListToolbar.styles.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;IACtC,iBAAiB;;;;CAIpB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE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SearchInput } from '../SearchInput';\nimport MenuButton from '../MenuButton';\nimport Text, { StyledText } from '../Text';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport { StyledButton } from '../Button';\nimport { StyledFormDialog } from '../Dialog/FormDialog';\n\nexport const StyledSearchForm = styled.div`\n ${StyledSearchInput} {\n flex-grow: 1;\n max-width: min(100%, 40ch);\n }\n`;\n\nexport const StyledViewSelector = styled(MenuButton)(({ theme, required }) => {\n const fontSizes = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { urgent } = theme.base.palette;\n const hitAreaMouse = theme.base['hit-area']['mouse-min'];\n const hitAreaFinger = theme.base['hit-area']['finger-min'];\n\n return css`\n flex-shrink: initial;\n white-space: initial;\n ${StyledText} {\n font-size: ${fontSizes[theme.components.text.h3['font-size'] as FontSize]};\n font-weight: ${theme.components.text.h3['font-weight']};\n line-height: ${hitAreaMouse};\n word-break: break-word;\n @media (pointer: coarse) {\n line-height: ${hitAreaFinger};\n }\n }\n\n ${StyledText}::after {\n display: ${required ? 'inline-block' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n `;\n});\n\nStyledViewSelector.defaultProps = defaultThemeProp;\n\nexport const StyledListToolbar = styled.div(({ theme }) => {\n return css`\n ${StyledButton} + ${StyledButton} {\n margin-inline-start: 0;\n }\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n\n &:has(:focus-visible:not(input)):not([disabled]) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n\n ${StyledFormDialog} {\n min-width: min(${theme.base['content-width'].md}, 100vw);\n }\n `;\n});\n\nStyledListToolbar.defaultProps = defaultThemeProp;\n\nexport const StyledHeadingText = styled(Text)<{ required?: boolean }>(({ theme, required }) => {\n const { urgent } = theme.base.palette;\n const hitAreaMouse = theme.base['hit-area']['mouse-min'];\n const hitAreaFinger = theme.base['hit-area']['finger-min'];\n\n return css`\n position: relative;\n line-height: ${hitAreaMouse};\n word-break: break-word;\n ${required &&\n css`\n padding-inline-end: calc(1.5 * ${theme.base.spacing});\n `}\n @media (pointer: coarse) {\n line-height: ${hitAreaFinger};\n }\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n position: absolute;\n inset-inline-end: 0;\n inset-block-start: 0;\n }\n `;\n});\n\nStyledHeadingText.defaultProps = defaultThemeProp;\n\nexport const StyledCountMeta = styled(Text)(({ theme }) => {\n const hitAreaMouse = theme.base['hit-area']['mouse-min'];\n const hitAreaFinger = theme.base['hit-area']['finger-min'];\n\n return css`\n line-height: ${hitAreaMouse};\n\n @media (pointer: coarse) {\n line-height: ${hitAreaFinger};\n }\n `;\n});\n\nStyledCountMeta.defaultProps = defaultThemeProp;\n\nexport const StyledContainer = styled(Flex)`\n @media (pointer: coarse) {\n overflow: hidden;\n\n ${StyledHeadingText}, ${StyledViewSelector} ${StyledText} {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n`;\n"]}
@@ -47,10 +47,12 @@ export interface PresetMenuProps extends QueryOption {
47
47
  /** Callback invoked on item selection. Passes the item id as an argument. */
48
48
  onItemClick: MenuProps['onItemClick'];
49
49
  }
50
- export declare type QueryOptionId = 'filter' | 'sort' | 'group';
50
+ export type QueryOptionId = 'filter' | 'sort' | 'group';
51
51
  export interface ListToolbarProps extends BaseProps {
52
- /** Renders a simple heading or view selection menu. */
53
- heading?: string | ViewSelectorProps;
52
+ /** Renders a simple text name of table */
53
+ name: string;
54
+ /** Renders a simple view heading text or view selection menu. */
55
+ viewSelector?: ViewSelectorProps;
54
56
  formControlProps?: Pick<FormControlProps, 'required'>;
55
57
  /** Props related to new item creation button. */
56
58
  createNew?: {
@@ -83,8 +85,6 @@ export interface ListToolbarProps extends BaseProps {
83
85
  actions?: Action[];
84
86
  /** Ref for the actions button element. */
85
87
  actionsButtonRef?: Ref<HTMLButtonElement>;
86
- /** Renders toolbar in condensed mode. */
87
- condensed?: boolean;
88
88
  /** Ref for the wrapping element. */
89
89
  ref?: Ref<HTMLDivElement>;
90
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ListToolbar.types.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,OAAO,CAAC;KACnB,EAAE,CAAC;IACJ,sCAAsC;IACtC,YAAY,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD,MAAM,WAAW,WAAW;IAC1B,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,4EAA4E;IAC5E,QAAQ,EAAE,aAAa,CAAC;IACxB;;;OAGG;IACH,QAAQ,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,QAAQ,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC;CAChC;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,qEAAqE;IACrE,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC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,sBAAsB,GAAG,eAAe,CAAC;IACjD,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,0CAA0C;IAC1C,gBAAgB,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC1C,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ListToolbar.types.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent, Ref, ComponentType, ReactNode } from 'react';\n\nimport { FormControlProps } from '@pega/cosmos-react-core/lib/components/FormControl';\n\nimport { SearchInputProps } from '../SearchInput';\nimport { MenuProps } from '../Menu';\nimport { Action, BaseProps } from '../../types';\n\nexport interface ViewSelectorProps {\n /** A list of pre-defined data views. */\n views: {\n id: string;\n text: string;\n selected: boolean;\n }[];\n /** Called when a view is selected. */\n onViewSelect: MenuProps['onItemClick'];\n defaultId?: string;\n appDefaultId?: string;\n}\nexport interface QueryOption {\n /** A count representing the number of applied conditions within the query option. */\n count?: number;\n}\n\nexport interface QueryOptionDialogProps extends QueryOption {\n /** A component to render the content portion of the query option dialog. */\n renderer: ComponentType;\n /**\n * Called when the user explicitly or implicitly cancels(closes) the query dialog.\n * Returning false will block the dialog from closing.\n */\n onCancel: () => boolean | void;\n /**\n * Called when the user explicitly applies the query option conditions.\n * Returning false will block the dialog from closing.\n */\n onSubmit: () => boolean | void;\n}\n\n/** Optionally provide query option presets. */\nexport interface PresetMenuProps extends QueryOption {\n /** Mode defining whether menu selection is single or multi mode. */\n mode?: Exclude<MenuProps['mode'], 'action'>;\n /** Items of the menu. */\n items: { id: string; text: string; selected: boolean; icon?: string }[];\n /** Callback invoked on item selection. Passes the item id as an argument. */\n onItemClick: MenuProps['onItemClick'];\n}\nexport type QueryOptionId = 'filter' | 'sort' | 'group';\n\nexport interface ListToolbarProps extends BaseProps {\n /** Renders a simple heading or view selection menu. */\n heading?: string | ViewSelectorProps;\n formControlProps?: Pick<FormControlProps, 'required'>;\n /** Props related to new item creation button. */\n createNew?: {\n /** Label of the new item creation button. */\n label?: string;\n /** Callback that will render a Create new button and is fired when that button is clicked. */\n onClick: (e: MouseEvent) => void;\n };\n /** Props related to the Search Input. */\n search?: SearchInputProps;\n /** Total returned results related for a given search. Optional indication of a selected item count. */\n count?: {\n total?: number;\n /**\n * If true renders + next to total number.\n * @default false\n */\n totalHasMore?: boolean;\n selected?: number;\n };\n /** Additional actions region */\n additionalActions?: ReactNode;\n /** Custom Rendering or available presets for filtering. */\n filter?: QueryOptionDialogProps | PresetMenuProps;\n /** Custom Rendering or available presets for sorting. */\n sort?: QueryOptionDialogProps | PresetMenuProps;\n /** Custom Rendering or available presets for grouping. */\n group?: QueryOptionDialogProps | PresetMenuProps;\n /** Top level dataset actions. */\n actions?: Action[];\n /** Ref for the actions button element. */\n actionsButtonRef?: Ref<HTMLButtonElement>;\n /** Renders toolbar in condensed mode. */\n condensed?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
1
+ {"version":3,"file":"ListToolbar.types.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent, Ref, ComponentType, ReactNode } from 'react';\n\nimport { FormControlProps } from '@pega/cosmos-react-core/lib/components/FormControl';\n\nimport { SearchInputProps } from '../SearchInput';\nimport { MenuProps } from '../Menu';\nimport { Action, BaseProps } from '../../types';\n\nexport interface ViewSelectorProps {\n /** A list of pre-defined data views. */\n views: {\n id: string;\n text: string;\n selected: boolean;\n }[];\n /** Called when a view is selected. */\n onViewSelect: MenuProps['onItemClick'];\n defaultId?: string;\n appDefaultId?: string;\n}\nexport interface QueryOption {\n /** A count representing the number of applied conditions within the query option. */\n count?: number;\n}\n\nexport interface QueryOptionDialogProps extends QueryOption {\n /** A component to render the content portion of the query option dialog. */\n renderer: ComponentType;\n /**\n * Called when the user explicitly or implicitly cancels(closes) the query dialog.\n * Returning false will block the dialog from closing.\n */\n onCancel: () => boolean | void;\n /**\n * Called when the user explicitly applies the query option conditions.\n * Returning false will block the dialog from closing.\n */\n onSubmit: () => boolean | void;\n}\n\n/** Optionally provide query option presets. */\nexport interface PresetMenuProps extends QueryOption {\n /** Mode defining whether menu selection is single or multi mode. */\n mode?: Exclude<MenuProps['mode'], 'action'>;\n /** Items of the menu. */\n items: { id: string; text: string; selected: boolean; icon?: string }[];\n /** Callback invoked on item selection. Passes the item id as an argument. */\n onItemClick: MenuProps['onItemClick'];\n}\nexport type QueryOptionId = 'filter' | 'sort' | 'group';\n\nexport interface ListToolbarProps extends BaseProps {\n /** Renders a simple text name of table */\n name: string;\n /** Renders a simple view heading text or view selection menu. */\n viewSelector?: ViewSelectorProps;\n formControlProps?: Pick<FormControlProps, 'required'>;\n /** Props related to new item creation button. */\n createNew?: {\n /** Label of the new item creation button. */\n label?: string;\n /** Callback that will render a Create new button and is fired when that button is clicked. */\n onClick: (e: MouseEvent) => void;\n };\n /** Props related to the Search Input. */\n search?: SearchInputProps;\n /** Total returned results related for a given search. Optional indication of a selected item count. */\n count?: {\n total?: number;\n /**\n * If true renders + next to total number.\n * @default false\n */\n totalHasMore?: boolean;\n selected?: number;\n };\n /** Additional actions region */\n additionalActions?: ReactNode;\n /** Custom Rendering or available presets for filtering. */\n filter?: QueryOptionDialogProps | PresetMenuProps;\n /** Custom Rendering or available presets for sorting. */\n sort?: QueryOptionDialogProps | PresetMenuProps;\n /** Custom Rendering or available presets for grouping. */\n group?: QueryOptionDialogProps | PresetMenuProps;\n /** Top level dataset actions. */\n actions?: Action[];\n /** Ref for the actions button element. */\n actionsButtonRef?: Ref<HTMLButtonElement>;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { LiveLogContextValue } from './LiveLog.types';
2
+ export declare const LiveLogContext: import("react").Context<LiveLogContextValue>;
3
+ //# sourceMappingURL=Context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/components/LiveLog/Context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,eAAO,MAAM,cAAc,8CAKzB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { createContext } from 'react';
2
+ // eslint-disable-next-line import/prefer-default-export
3
+ export const LiveLogContext = createContext({
4
+ announce: () => { },
5
+ announcePolite: () => { },
6
+ announceAssertive: () => { },
7
+ initialized: false
8
+ });
9
+ //# sourceMappingURL=Context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../src/components/LiveLog/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAsB;IAC/D,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC3B,WAAW,EAAE,KAAK;CACnB,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport type { LiveLogContextValue } from './LiveLog.types';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const LiveLogContext = createContext<LiveLogContextValue>({\n announce: () => {},\n announcePolite: () => {},\n announceAssertive: () => {},\n initialized: false\n});\n"]}
@@ -0,0 +1,10 @@
1
+ import { type FunctionComponent, type Context } from 'react';
2
+ import type { LiveLogContextValue, LiveLogProps } from './LiveLog.types';
3
+ declare module '../../init' {
4
+ interface CosmosGlobals {
5
+ liveLogContext?: Context<LiveLogContextValue>;
6
+ }
7
+ }
8
+ declare const LiveLog: FunctionComponent<LiveLogProps>;
9
+ export default LiveLog;
10
+ //# sourceMappingURL=LiveLog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveLog.d.ts","sourceRoot":"","sources":["../../../src/components/LiveLog/LiveLog.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,OAAO,EAIb,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAGb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAiB,aAAa;QAC5B,cAAc,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;KAC/C;CACF;AAwDD,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAsE5C,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useContext, useReducer } from 'react';
3
+ import { createUID, windowIsAvailable } from '../../utils';
4
+ import { useI18n } from '../../hooks';
5
+ import { StyledLog } from './LiveLog.styles';
6
+ import { LiveLogContext } from './Context';
7
+ const reducer = (state, action) => {
8
+ const type = action.type;
9
+ switch (type) {
10
+ case 'announce': {
11
+ const message = action.payload.message;
12
+ const messageType = action.payload.type;
13
+ const announceMessage = ['alert', 'error', 'exception'].includes(messageType) ||
14
+ !state.suppressedTypes.includes(messageType);
15
+ if (announceMessage) {
16
+ const id = createUID();
17
+ if (action.payload.level === 'assertive') {
18
+ return {
19
+ ...state,
20
+ assertiveMessages: [...state.assertiveMessages, { message, id }]
21
+ };
22
+ }
23
+ return {
24
+ ...state,
25
+ politeMessages: [...state.politeMessages, { message, id }]
26
+ };
27
+ }
28
+ return state;
29
+ }
30
+ case 'setMaxLength': {
31
+ return {
32
+ ...state,
33
+ maxLength: action.payload > 0 ? action.payload : 50
34
+ };
35
+ }
36
+ case 'trimLength': {
37
+ const trimPolite = state.politeMessages.length > state.maxLength;
38
+ const trimAssertive = state.assertiveMessages.length > state.maxLength;
39
+ return {
40
+ ...state,
41
+ politeMessages: trimPolite
42
+ ? [...state.politeMessages.slice(-state.maxLength)]
43
+ : state.politeMessages,
44
+ assertiveMessages: trimAssertive
45
+ ? [...state.assertiveMessages.slice(-state.maxLength)]
46
+ : state.assertiveMessages
47
+ };
48
+ }
49
+ default:
50
+ return state;
51
+ }
52
+ };
53
+ const LiveLog = ({ children, maxLength = 50 }) => {
54
+ const t = useI18n();
55
+ const [state, dispatch] = useReducer(reducer, {
56
+ maxLength,
57
+ politeMessages: [],
58
+ assertiveMessages: [],
59
+ suppressedTypes: [] // initialize via a11y settings once available.
60
+ });
61
+ // Manage log length.
62
+ useEffect(() => {
63
+ const timeout = setTimeout(() => {
64
+ dispatch({ type: 'trimLength' });
65
+ }, 1000);
66
+ return () => {
67
+ clearTimeout(timeout);
68
+ };
69
+ }, [state.assertiveMessages, state.politeMessages, state.maxLength]);
70
+ // Update max length
71
+ useEffect(() => {
72
+ dispatch({ type: 'setMaxLength', payload: maxLength });
73
+ }, [maxLength]);
74
+ // Don't create additional LiveLogContext.Providers.
75
+ const context = windowIsAvailable
76
+ ? window.cosmos.liveLogContext ?? LiveLogContext
77
+ : LiveLogContext;
78
+ const priorCtx = useContext(context);
79
+ if (priorCtx.initialized) {
80
+ return _jsx(context.Provider, { value: priorCtx, children: children });
81
+ }
82
+ return (_jsxs(context.Provider, { value: {
83
+ announce: ({ message, type = 'info', assertive = false }) => {
84
+ dispatch({
85
+ type: 'announce',
86
+ payload: { message, type, level: assertive ? 'assertive' : 'polite' }
87
+ });
88
+ },
89
+ announcePolite: ({ message, type = 'info' }) => {
90
+ dispatch({ type: 'announce', payload: { message, type, level: 'polite' } });
91
+ },
92
+ announceAssertive: ({ message, type = 'info' }) => {
93
+ dispatch({ type: 'announce', payload: { message, type, level: 'assertive' } });
94
+ },
95
+ initialized: true
96
+ }, children: [children, _jsxs(StyledLog, { role: 'log', "aria-relevant": 'additions', children: [_jsx("h6", { children: t('polite_announcements') }), state.politeMessages.map(({ message, id }) => (_jsx("p", { children: message }, id)))] }), _jsxs(StyledLog, { role: 'log', "aria-live": 'assertive', "aria-relevant": 'additions', children: [_jsx("h6", { children: t('assertive_announcements') }), state.assertiveMessages.map(({ message, id }) => (_jsx("p", { children: message }, id)))] })] }));
97
+ };
98
+ export default LiveLog;
99
+ //# sourceMappingURL=LiveLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveLog.js","sourceRoot":"","sources":["../../../src/components/LiveLog/LiveLog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,SAAS,EACT,UAAU,EACV,UAAU,EACX,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAO7C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAQ3C,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,MAAqB,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAEzB,QAAQ,IAAI,EAAE;QACZ,KAAK,UAAU,CAAC,CAAC;YACf,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;YACvC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;YACxC,MAAM,eAAe,GACnB,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;gBACrD,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YAE/C,IAAI,eAAe,EAAE;gBACnB,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;gBAEvB,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,KAAK,WAAW,EAAE;oBACxC,OAAO;wBACL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C,IACQ,IACK,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n type FunctionComponent,\n type Reducer,\n type Context,\n useEffect,\n useContext,\n useReducer\n} from 'react';\n\nimport { createUID, windowIsAvailable } from '../../utils';\nimport { useI18n } from '../../hooks';\n\nimport { StyledLog } from './LiveLog.styles';\nimport type {\n LiveLogContextValue,\n LiveLogProps,\n LiveLogState,\n ReducerAction\n} from './LiveLog.types';\nimport { LiveLogContext } from './Context';\n\ndeclare module '../../init' {\n export interface CosmosGlobals {\n liveLogContext?: Context<LiveLogContextValue>;\n }\n}\n\nconst reducer = (state: LiveLogState, action: ReducerAction) => {\n const type = action.type;\n\n switch (type) {\n case 'announce': {\n const message = action.payload.message;\n const messageType = action.payload.type;\n const announceMessage =\n ['alert', 'error', 'exception'].includes(messageType) ||\n !state.suppressedTypes.includes(messageType);\n\n if (announceMessage) {\n const id = createUID();\n\n if (action.payload.level === 'assertive') {\n return {\n ...state,\n assertiveMessages: [...state.assertiveMessages, { message, id }]\n };\n }\n\n return {\n ...state,\n politeMessages: [...state.politeMessages, { message, id }]\n };\n }\n\n return state;\n }\n case 'setMaxLength': {\n return {\n ...state,\n maxLength: action.payload > 0 ? action.payload : 50\n };\n }\n case 'trimLength': {\n const trimPolite = state.politeMessages.length > state.maxLength;\n const trimAssertive = state.assertiveMessages.length > state.maxLength;\n\n return {\n ...state,\n politeMessages: trimPolite\n ? [...state.politeMessages.slice(-state.maxLength)]\n : state.politeMessages,\n assertiveMessages: trimAssertive\n ? [...state.assertiveMessages.slice(-state.maxLength)]\n : state.assertiveMessages\n };\n }\n default:\n return state;\n }\n};\n\nconst LiveLog: FunctionComponent<LiveLogProps> = ({ children, maxLength = 50 }: LiveLogProps) => {\n const t = useI18n();\n\n const [state, dispatch] = useReducer<Reducer<LiveLogState, ReducerAction>>(reducer, {\n maxLength,\n politeMessages: [],\n assertiveMessages: [],\n suppressedTypes: [] // initialize via a11y settings once available.\n });\n\n // Manage log length.\n useEffect(() => {\n const timeout = setTimeout(() => {\n dispatch({ type: 'trimLength' });\n }, 1000);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [state.assertiveMessages, state.politeMessages, state.maxLength]);\n\n // Update max length\n useEffect(() => {\n dispatch({ type: 'setMaxLength', payload: maxLength });\n }, [maxLength]);\n\n // Don't create additional LiveLogContext.Providers.\n const context = windowIsAvailable\n ? window.cosmos.liveLogContext ?? LiveLogContext\n : LiveLogContext;\n const priorCtx = useContext(context);\n if (priorCtx.initialized) {\n return <context.Provider value={priorCtx}>{children}</context.Provider>;\n }\n\n return (\n <context.Provider\n value={{\n announce: ({ message, type = 'info', assertive = false }) => {\n dispatch({\n type: 'announce',\n payload: { message, type, level: assertive ? 'assertive' : 'polite' }\n });\n },\n announcePolite: ({ message, type = 'info' }) => {\n dispatch({ type: 'announce', payload: { message, type, level: 'polite' } });\n },\n announceAssertive: ({ message, type = 'info' }) => {\n dispatch({ type: 'announce', payload: { message, type, level: 'assertive' } });\n },\n initialized: true\n }}\n >\n {children}\n\n <StyledLog role='log' aria-relevant='additions'>\n <h6>{t('polite_announcements')}</h6>\n {state.politeMessages.map(({ message, id }) => (\n <p key={id}>{message}</p>\n ))}\n </StyledLog>\n\n <StyledLog role='log' aria-live='assertive' aria-relevant='additions'>\n <h6>{t('assertive_announcements')}</h6>\n {state.assertiveMessages.map(({ message, id }) => (\n <p key={id}>{message}</p>\n ))}\n </StyledLog>\n </context.Provider>\n );\n};\n\nexport default LiveLog;\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const StyledLog: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
+ export default StyledLog;
3
+ //# sourceMappingURL=LiveLog.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveLog.styles.d.ts","sourceRoot":"","sources":["../../../src/components/LiveLog/LiveLog.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,yGAIrB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,9 @@
1
+ import styled from 'styled-components';
2
+ import { hideVisually } from 'polished';
3
+ export const StyledLog = styled.div `
4
+ ${hideVisually}
5
+ -webkit-user-select: none;
6
+ user-select: none;
7
+ `;
8
+ export default StyledLog;
9
+ //# sourceMappingURL=LiveLog.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveLog.styles.js","sourceRoot":"","sources":["../../../src/components/LiveLog/LiveLog.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;IAC/B,YAAY;;;CAGf,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import styled from 'styled-components';\nimport { hideVisually } from 'polished';\n\nexport const StyledLog = styled.div`\n ${hideVisually}\n -webkit-user-select: none;\n user-select: none;\n`;\n\nexport default StyledLog;\n"]}
@@ -0,0 +1,93 @@
1
+ import { type ReactNode } from 'react';
2
+ export type AnnouncementType =
3
+ /** Immediate attention req.
4
+ * (high priority)
5
+ * (cannot be disabled)
6
+ */
7
+ 'alert'
8
+ /** Immediate action req.
9
+ * (high priority)
10
+ * (cannot be disabled)
11
+ */
12
+ | 'error'
13
+ /** System failure
14
+ * (high priority)
15
+ * (cannot be disabled)
16
+ */
17
+ | 'exception'
18
+ /** No immediate action req.
19
+ * (medium priority)
20
+ */
21
+ | 'warning'
22
+ /** Feedback on actions
23
+ * (medium priority)
24
+ */
25
+ | 'acknowledgement'
26
+ /** Confirmation of action completion
27
+ * (medium priority)
28
+ */
29
+ | 'success'
30
+ /** Passive notification
31
+ * (low priority)
32
+ * (ex: "Kelly liked your comment.")
33
+ */
34
+ | 'info'
35
+ /** System feedback
36
+ * (low priority)
37
+ * (ex: "Loading create form.")
38
+ */
39
+ | 'status';
40
+ interface AnnounceMethodProps {
41
+ /** Message to announce */
42
+ message: string;
43
+ /** Announcement type
44
+ * @default 'info'
45
+ */
46
+ type?: AnnouncementType;
47
+ }
48
+ interface GenericAnnounceMethodProps extends AnnounceMethodProps {
49
+ /** Whether announcement is assertive.
50
+ * @default false
51
+ */
52
+ assertive?: boolean;
53
+ }
54
+ export interface LiveLogContextValue {
55
+ announce: (props: GenericAnnounceMethodProps) => void;
56
+ announcePolite: (props: AnnounceMethodProps) => void;
57
+ announceAssertive: (props: AnnounceMethodProps) => void;
58
+ /** @internal */
59
+ initialized: boolean;
60
+ }
61
+ export interface LiveLogProps {
62
+ /** Content that will be provided live log context. */
63
+ children: ReactNode;
64
+ /** Length at which to start shifting the window of persisted messages.
65
+ * @default 50
66
+ */
67
+ maxLength?: number;
68
+ }
69
+ interface MessageStateItem {
70
+ message: AnnounceMethodProps['message'];
71
+ id: string;
72
+ }
73
+ export interface LiveLogState {
74
+ maxLength: number;
75
+ politeMessages: MessageStateItem[];
76
+ assertiveMessages: MessageStateItem[];
77
+ suppressedTypes: AnnouncementType[];
78
+ }
79
+ export type ReducerAction = {
80
+ type: 'announce';
81
+ payload: {
82
+ message: AnnounceMethodProps['message'];
83
+ level: 'polite' | 'assertive';
84
+ type: AnnouncementType;
85
+ };
86
+ } | {
87
+ type: 'setMaxLength';
88
+ payload: number;
89
+ } | {
90
+ type: 'trimLength';
91
+ };
92
+ export {};
93
+ //# sourceMappingURL=LiveLog.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveLog.types.d.ts","sourceRoot":"","sources":["../../../src/components/LiveLog/LiveLog.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,gBAAgB;AAC1B;;;GAGG;AACD,OAAO;AACT;;;GAGG;GACD,OAAO;AACT;;;GAGG;GACD,WAAW;AACb;;GAEG;GACD,SAAS;AACX;;GAEG;GACD,iBAAiB;AACnB;;GAEG;GACD,SAAS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B,GACD;IACE,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=LiveLog.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveLog.types.js","sourceRoot":"","sources":["../../../src/components/LiveLog/LiveLog.types.ts"],"names":[],"mappings":"","sourcesContent":["import { type ReactNode } from 'react';\n\nexport type AnnouncementType =\n /** Immediate attention req.\n * (high priority)\n * (cannot be disabled)\n */\n | 'alert'\n /** Immediate action req.\n * (high priority)\n * (cannot be disabled)\n */\n | 'error'\n /** System failure\n * (high priority)\n * (cannot be disabled)\n */\n | 'exception'\n /** No immediate action req.\n * (medium priority)\n */\n | 'warning'\n /** Feedback on actions\n * (medium priority)\n */\n | 'acknowledgement'\n /** Confirmation of action completion\n * (medium priority)\n */\n | 'success'\n /** Passive notification\n * (low priority)\n * (ex: \"Kelly liked your comment.\")\n */\n | 'info'\n /** System feedback\n * (low priority)\n * (ex: \"Loading create form.\")\n */\n | 'status';\n\ninterface AnnounceMethodProps {\n /** Message to announce */\n message: string;\n /** Announcement type\n * @default 'info'\n */\n type?: AnnouncementType;\n}\n\ninterface GenericAnnounceMethodProps extends AnnounceMethodProps {\n /** Whether announcement is assertive.\n * @default false\n */\n assertive?: boolean;\n}\n\nexport interface LiveLogContextValue {\n announce: (props: GenericAnnounceMethodProps) => void;\n announcePolite: (props: AnnounceMethodProps) => void;\n announceAssertive: (props: AnnounceMethodProps) => void;\n /** @internal */\n initialized: boolean;\n}\n\nexport interface LiveLogProps {\n /** Content that will be provided live log context. */\n children: ReactNode;\n /** Length at which to start shifting the window of persisted messages.\n * @default 50\n */\n maxLength?: number;\n}\n\ninterface MessageStateItem {\n message: AnnounceMethodProps['message'];\n id: string;\n}\n\nexport interface LiveLogState {\n maxLength: number;\n politeMessages: MessageStateItem[];\n assertiveMessages: MessageStateItem[];\n suppressedTypes: AnnouncementType[];\n}\n\nexport type ReducerAction =\n | {\n type: 'announce';\n payload: {\n message: AnnounceMethodProps['message'];\n level: 'polite' | 'assertive';\n type: AnnouncementType;\n };\n }\n | {\n type: 'setMaxLength';\n payload: number;\n }\n | {\n type: 'trimLength';\n };\n"]}
@@ -0,0 +1,4 @@
1
+ export { default } from './LiveLog';
2
+ export { LiveLogProps, AnnouncementType } from './LiveLog.types';
3
+ export { LiveLogContext } from './Context';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LiveLog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default } from './LiveLog';
2
+ export { LiveLogContext } from './Context';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LiveLog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default } from './LiveLog';\nexport { LiveLogProps, AnnouncementType } from './LiveLog.types';\nexport { LiveLogContext } from './Context';\n"]}
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- export declare type CurrentLocationButtonProps = {
2
+ export type CurrentLocationButtonProps = {
3
3
  /** Callback fired after click on my current location button if location was found. */
4
4
  onChange?: (value: {
5
5
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"CurrentLocationButton.d.ts","sourceRoot":"","sources":["../../../src/components/Location/CurrentLocationButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AAezE,oBAAY,0BAA0B,GAAG;IACvC,sFAAsF;IACtF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,KAAK,IAAI,CAAC;IACX,2CAA2C;IAC3C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,qDAAqD;IACrD,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,2BAA2B;6BAA6C,OAAO;SAa3F,CAAC;AAIF,QAAA,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAoDzD,CAAC;AACF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"CurrentLocationButton.d.ts","sourceRoot":"","sources":["../../../src/components/Location/CurrentLocationButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AAezE,MAAM,MAAM,0BAA0B,GAAG;IACvC,sFAAsF;IACtF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,KAAK,IAAI,CAAC;IACX,2CAA2C;IAC3C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,qDAAqD;IACrD,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,2BAA2B;6BAA6C,OAAO;SAa3F,CAAC;AAIF,QAAA,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAoDzD,CAAC;AACF,eAAe,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LocationIn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1
+ {"version":3,"file":"LocationInput.d.ts","sourceRoot":"","sources":["../../../src/components/Location/LocationInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EAQH,MAAM,OAAO,CAAC;AAQf,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOtD,OAAO,iBAAiB,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAqB,EAAE,iBAAiB,EAAsB,MAAM,gBAAgB,CAAC;AAErF,MAAM,WAAW,kBACf,SAAQ,iBAAiB,EACvB,iBAAiB,EACjB,SAAS,EACT,gBAAgB;IAClB,kFAAkF;IAClF,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACpD;;;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;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,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;CACZ;AASD,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,GAAG,YAAY,CAuJxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -3,7 +3,7 @@ import { forwardRef, useCallback, useContext, useEffect, useState } from 'react'
3
3
  import styled from 'styled-components';
4
4
  import ComboBox from '../ComboBox';
5
5
  import { useI18n } from '../../hooks';
6
- import { createUID } from '../../utils/utils';
6
+ import { createUID } from '../../utils';
7
7
  import FormField from '../FormField';
8
8
  import Flex from '../Flex';
9
9
  import PoweredByGoogleImage from './PoweredByGoogleImage';
@@ -67,7 +67,6 @@ const LocationInput = forwardRef((props, ref) => {
67
67
  primary: t('use_input_value', [filterValue])
68
68
  }),
69
69
  mode: 'action',
70
- emptyText: t('location_not_found_text'),
71
70
  footer: !showMap && (_jsx(Flex, { container: { justify: 'end' }, children: _jsx(PoweredByGoogleImage, {}) }))
72
71
  }
73
72
  : undefined, actions: !disabled &&
@@ -1 +1 @@
1
- {"version":3,"file":"LocationInput.js","sourceRoot":"","sources":["../../../src/components/Location/LocationInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAGV,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGzE,OAAO,YAAY,EAAE,EAAqB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AA0CrF,MAAM,iBAAiB,GAAG,M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,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,OACJ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,YAEpF,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n ChangeEvent,\n FC,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useCallback,\n useContext,\n useEffect,\n useState\n} from 'react';\nimport styled from 'styled-components';\n\nimport ComboBox from '../ComboBox';\nimport { MenuProps } from '../Menu';\nimport { useI18n } from '../../hooks';\nimport { createUID } from '../../utils/utils';\nimport FormField from '../FormField';\nimport { FormControlProps } from '../FormControl';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Flex from '../Flex';\n\nimport PoweredByGoogleImage from './PoweredByGoogleImage';\nimport CurrentLocationButton from './CurrentLocationButton';\nimport MapsContext from './MapsContext';\nimport { getPlaceById, getPlacePredictions, loadMapsAPI } from './utils';\nimport BaseLocationProps from './Location.types';\nimport { LatLng } from './types';\nimport LocationView, { LocationViewProps, StyledLocationView } from './LocationView';\n\nexport interface LocationInputProps\n extends LocationViewProps,\n BaseLocationProps,\n BaseProps,\n FormControlProps {\n /** Button when clicked will show additional information for the location input */\n additionalInfo?: FormControlProps['additionalInfo'];\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(\n (props: PropsWithoutRef<LocationInputProps>, ref: Ref<HTMLInputElement>) => {\n const {\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 ...restProps\n } = props;\n const { name, ...providerOpts } = useContext(MapsContext);\n const t = useI18n();\n const [placePredictionMenu, setPlacePredictionMenu] = useState<MenuProps>({ items: [] });\n const [filterValue, setFilterValue] = useState('');\n\n useEffect(() => {\n const mapApiPromise = loadMapsAPI(name, providerOpts).catch(error => onError?.(error));\n\n if (filterValue) {\n mapApiPromise\n .then(() => getPlacePredictions(filterValue, bias))\n .then(({ placePredictions, token }) => {\n setPlacePredictionMenu({\n items: placePredictions.map(item => ({\n id: item.place_id,\n primary: item.structured_formatting.main_text,\n secondary: [item.structured_formatting.secondary_text]\n })),\n emptyText: t('location_not_found_text'),\n onItemClick: itemId =>\n getPlaceById(itemId, token).then(arg => {\n setFilterValue('');\n onSelect?.(arg);\n })\n });\n })\n .catch(error => {\n setPlacePredictionMenu({ items: [] });\n onError?.(error);\n });\n } else {\n setPlacePredictionMenu({ items: [] });\n }\n }, [filterValue, bias, onError, onSelect]);\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 onSelect?.(placeInfo);\n onClick?.(placeInfo);\n },\n [onSelect, onClick]\n );\n\n const Comp = (\n <>\n <ComboBox\n placeholder={t('location_input_placeholder')}\n menu={\n filterValue\n ? {\n ...placePredictionMenu,\n items: placePredictionMenu.items.concat({\n id: createUID(),\n primary: t('use_input_value', [filterValue])\n }),\n mode: 'action',\n emptyText: t('location_not_found_text'),\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, onError, onChange: onSelect }}\n />\n )\n }\n onChange={onInputChange}\n onBlur={() => {\n setFilterValue('');\n onBlur?.(value);\n }}\n value={value}\n {...{\n required,\n disabled,\n readOnly,\n status,\n ...restProps\n }}\n />\n {showMap && (\n <StyledLocationMap>\n <LocationView\n {...{\n location,\n onClick: onMapClick,\n onError,\n bias,\n disabled,\n readOnly,\n centerMapOnChange,\n height,\n zoomLevel\n }}\n />\n </StyledLocationMap>\n )}\n </>\n );\n\n return label ? (\n <FormField\n {...{ label, labelHidden, id, info, status, ref, required, disabled, additionalInfo }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default LocationInput;\n"]}
1
+ {"version":3,"file":"LocationInput.js","sourceRoot":"","sources":["../../../src/components/Location/LocationInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAGV,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,qBAAq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B,cAChB,KAAC,YAAY,OACP;wBACF,QAAQ;wBACR,OAAO,EAAE,UAAU;wBACnB,OAAO;wBACP,IAAI;wBACJ,QAAQ;wBACR,QAAQ;wBACR,iBAAiB;wBACjB,MAAM;wBACN,SAAS;qBACV,GACD,GACgB,CACrB,IACA,CACJ,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,OACJ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,YAEpF,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n ChangeEvent,\n FC,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useCallback,\n useContext,\n useEffect,\n useState\n} from 'react';\nimport styled from 'styled-components';\n\nimport ComboBox from '../ComboBox';\nimport { MenuProps } from '../Menu';\nimport { useI18n } from '../../hooks';\nimport { createUID } from '../../utils';\nimport FormField from '../FormField';\nimport { FormControlProps } from '../FormControl';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Flex from '../Flex';\n\nimport PoweredByGoogleImage from './PoweredByGoogleImage';\nimport CurrentLocationButton from './CurrentLocationButton';\nimport MapsContext from './MapsContext';\nimport { getPlaceById, getPlacePredictions, loadMapsAPI } from './utils';\nimport BaseLocationProps from './Location.types';\nimport { LatLng } from './types';\nimport LocationView, { LocationViewProps, StyledLocationView } from './LocationView';\n\nexport interface LocationInputProps\n extends LocationViewProps,\n BaseLocationProps,\n BaseProps,\n FormControlProps {\n /** Button when clicked will show additional information for the location input */\n additionalInfo?: FormControlProps['additionalInfo'];\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(\n (props: PropsWithoutRef<LocationInputProps>, ref: Ref<HTMLInputElement>) => {\n const {\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 ...restProps\n } = props;\n const { name, ...providerOpts } = useContext(MapsContext);\n const t = useI18n();\n const [placePredictionMenu, setPlacePredictionMenu] = useState<MenuProps>({ items: [] });\n const [filterValue, setFilterValue] = useState('');\n\n useEffect(() => {\n const mapApiPromise = loadMapsAPI(name, providerOpts).catch(error => onError?.(error));\n\n if (filterValue) {\n mapApiPromise\n .then(() => getPlacePredictions(filterValue, bias))\n .then(({ placePredictions, token }) => {\n setPlacePredictionMenu({\n items: placePredictions.map(item => ({\n id: item.place_id,\n primary: item.structured_formatting.main_text,\n secondary: [item.structured_formatting.secondary_text]\n })),\n emptyText: t('location_not_found_text'),\n onItemClick: itemId =>\n getPlaceById(itemId, token).then(arg => {\n setFilterValue('');\n onSelect?.(arg);\n })\n });\n })\n .catch(error => {\n setPlacePredictionMenu({ items: [] });\n onError?.(error);\n });\n } else {\n setPlacePredictionMenu({ items: [] });\n }\n }, [filterValue, bias, onError, onSelect]);\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 onSelect?.(placeInfo);\n onClick?.(placeInfo);\n },\n [onSelect, onClick]\n );\n\n const Comp = (\n <>\n <ComboBox\n placeholder={t('location_input_placeholder')}\n menu={\n filterValue\n ? {\n ...placePredictionMenu,\n items: placePredictionMenu.items.concat({\n id: createUID(),\n primary: t('use_input_value', [filterValue])\n }),\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, onError, onChange: onSelect }}\n />\n )\n }\n onChange={onInputChange}\n onBlur={() => {\n setFilterValue('');\n onBlur?.(value);\n }}\n value={value}\n {...{\n required,\n disabled,\n readOnly,\n status,\n ...restProps\n }}\n />\n {showMap && (\n <StyledLocationMap>\n <LocationView\n {...{\n location,\n onClick: onMapClick,\n onError,\n bias,\n disabled,\n readOnly,\n centerMapOnChange,\n height,\n zoomLevel\n }}\n />\n </StyledLocationMap>\n )}\n </>\n );\n\n return label ? (\n <FormField\n {...{ label, labelHidden, id, info, status, ref, required, disabled, additionalInfo }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default LocationInput;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LocationView.d.ts","sourceRoot":"","sources":["../../../src/components/Location/LocationView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,iBAAiB,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,mBAAmB,yGAK/B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B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+IAA+I;IAC/I,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ;AAYD,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA4GvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -47,6 +47,9 @@ var LoadStatus;
47
47
  LoadStatus["Ready"] = "ready";
48
48
  LoadStatus["Error"] = "error";
49
49
  })(LoadStatus || (LoadStatus = {}));
50
+ const hasPlaceId = (obj) => {
51
+ return typeof obj === 'object' && obj.placeId && typeof obj.placeId === 'string';
52
+ };
50
53
  const LocationView = (props) => {
51
54
  const { location = 'current', zoomLevel = 13, height = '25rem', centerMapOnChange = false, onClick, onError, disabled = false, ...restProps } = props;
52
55
  const { name, ...providerOpts } = useContext(MapsContext);
@@ -70,10 +73,7 @@ const LocationView = (props) => {
70
73
  marker.current?.setVisible(false);
71
74
  if (onClick)
72
75
  map.current.addListener('click', (event) => {
73
- if (event &&
74
- typeof event === 'object' &&
75
- hasProp(event, 'placeId') &&
76
- typeof event.placeId === 'string') {
76
+ if (event && hasPlaceId(event)) {
77
77
  getPlaceById(event.placeId).then(placeInfo => {
78
78
  if (hasProp(event, 'latLng') && isLatLngObject(event.latLng))
79
79
  onClick?.({