@stack-spot/portal-components 0.0.17 → 1.0.0-dev.1768482754546

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 (613) hide show
  1. package/CHANGELOG.md +670 -0
  2. package/dist/components/AnimatedHeight.d.ts +58 -0
  3. package/dist/components/AnimatedHeight.d.ts.map +1 -0
  4. package/dist/components/AnimatedHeight.js +105 -0
  5. package/dist/components/AnimatedHeight.js.map +1 -0
  6. package/dist/components/AsyncContent.d.ts +46 -0
  7. package/dist/components/AsyncContent.d.ts.map +1 -0
  8. package/dist/components/AsyncContent.js +34 -0
  9. package/dist/components/AsyncContent.js.map +1 -0
  10. package/dist/components/BannerWarning.d.ts +11 -2
  11. package/dist/components/BannerWarning.d.ts.map +1 -1
  12. package/dist/components/BannerWarning.js +45 -3
  13. package/dist/components/BannerWarning.js.map +1 -1
  14. package/dist/components/Breadcrumb/index.d.ts +10 -2
  15. package/dist/components/Breadcrumb/index.d.ts.map +1 -1
  16. package/dist/components/Breadcrumb/index.js +7 -5
  17. package/dist/components/Breadcrumb/index.js.map +1 -1
  18. package/dist/components/Breadcrumb/styled.d.ts +1 -2
  19. package/dist/components/Breadcrumb/styled.d.ts.map +1 -1
  20. package/dist/components/Breadcrumb/styled.js +1 -0
  21. package/dist/components/Breadcrumb/styled.js.map +1 -1
  22. package/dist/components/ButtonLoading.d.ts +11 -0
  23. package/dist/components/ButtonLoading.d.ts.map +1 -0
  24. package/dist/components/ButtonLoading.js +5 -0
  25. package/dist/components/ButtonLoading.js.map +1 -0
  26. package/dist/components/ChatBot.d.ts +5 -0
  27. package/dist/components/ChatBot.d.ts.map +1 -1
  28. package/dist/components/ChatBot.js +11 -6
  29. package/dist/components/ChatBot.js.map +1 -1
  30. package/dist/components/ContentValidateFilter.d.ts +6 -0
  31. package/dist/components/ContentValidateFilter.d.ts.map +1 -0
  32. package/dist/components/ContentValidateFilter.js +8 -0
  33. package/dist/components/ContentValidateFilter.js.map +1 -0
  34. package/dist/components/FadingOverflow.d.ts +37 -0
  35. package/dist/components/FadingOverflow.d.ts.map +1 -0
  36. package/dist/components/FadingOverflow.js +228 -0
  37. package/dist/components/FadingOverflow.js.map +1 -0
  38. package/dist/components/FileTreeView/More.d.ts +23 -0
  39. package/dist/components/FileTreeView/More.d.ts.map +1 -0
  40. package/dist/components/FileTreeView/More.js +55 -0
  41. package/dist/components/FileTreeView/More.js.map +1 -0
  42. package/dist/components/FileTreeView/index.d.ts +32 -0
  43. package/dist/components/FileTreeView/index.d.ts.map +1 -0
  44. package/dist/components/FileTreeView/index.js +91 -0
  45. package/dist/components/FileTreeView/index.js.map +1 -0
  46. package/dist/components/InfiniteScroll.d.ts +11 -0
  47. package/dist/components/InfiniteScroll.d.ts.map +1 -0
  48. package/dist/components/InfiniteScroll.js +14 -0
  49. package/dist/components/InfiniteScroll.js.map +1 -0
  50. package/dist/components/InfoMaintenanceBanner.d.ts +8 -0
  51. package/dist/components/InfoMaintenanceBanner.d.ts.map +1 -0
  52. package/dist/components/InfoMaintenanceBanner.js +19 -0
  53. package/dist/components/InfoMaintenanceBanner.js.map +1 -0
  54. package/dist/components/LazyMarkdown/BlockquoteMd.d.ts +11 -0
  55. package/dist/components/LazyMarkdown/BlockquoteMd.d.ts.map +1 -0
  56. package/dist/components/LazyMarkdown/BlockquoteMd.js +77 -0
  57. package/dist/components/LazyMarkdown/BlockquoteMd.js.map +1 -0
  58. package/dist/components/LazyMarkdown/CodeViewer.d.ts +24 -0
  59. package/dist/components/LazyMarkdown/CodeViewer.d.ts.map +1 -0
  60. package/dist/components/LazyMarkdown/CodeViewer.js +122 -0
  61. package/dist/components/LazyMarkdown/CodeViewer.js.map +1 -0
  62. package/dist/components/LazyMarkdown/Markdown.d.ts +19 -0
  63. package/dist/components/LazyMarkdown/Markdown.d.ts.map +1 -0
  64. package/dist/components/LazyMarkdown/Markdown.js +96 -0
  65. package/dist/components/LazyMarkdown/Markdown.js.map +1 -0
  66. package/dist/components/LazyMarkdown/MarkdownButton.d.ts +19 -0
  67. package/dist/components/LazyMarkdown/MarkdownButton.d.ts.map +1 -0
  68. package/dist/components/LazyMarkdown/MarkdownButton.js +9 -0
  69. package/dist/components/LazyMarkdown/MarkdownButton.js.map +1 -0
  70. package/dist/components/LazyMarkdown/Video.d.ts +11 -0
  71. package/dist/components/LazyMarkdown/Video.d.ts.map +1 -0
  72. package/dist/components/LazyMarkdown/Video.js +10 -0
  73. package/dist/components/LazyMarkdown/Video.js.map +1 -0
  74. package/dist/components/LazyMarkdown/index.d.ts +10 -0
  75. package/dist/components/LazyMarkdown/index.d.ts.map +1 -0
  76. package/dist/components/LazyMarkdown/index.js +8 -0
  77. package/dist/components/LazyMarkdown/index.js.map +1 -0
  78. package/dist/components/Placeholder.d.ts +28 -0
  79. package/dist/components/Placeholder.d.ts.map +1 -0
  80. package/dist/components/Placeholder.js +32 -0
  81. package/dist/components/Placeholder.js.map +1 -0
  82. package/dist/components/ScrollView.d.ts +31 -0
  83. package/dist/components/ScrollView.d.ts.map +1 -0
  84. package/dist/components/ScrollView.js +30 -0
  85. package/dist/components/ScrollView.js.map +1 -0
  86. package/dist/components/Select/BadgeItem.d.ts +4 -0
  87. package/dist/components/Select/BadgeItem.d.ts.map +1 -0
  88. package/dist/components/Select/BadgeItem.js +28 -0
  89. package/dist/components/Select/BadgeItem.js.map +1 -0
  90. package/dist/components/Select/ClearInput.d.ts +3 -0
  91. package/dist/components/Select/ClearInput.d.ts.map +1 -0
  92. package/dist/components/Select/ClearInput.js +18 -0
  93. package/dist/components/Select/ClearInput.js.map +1 -0
  94. package/dist/components/Select/CloseItem.d.ts +3 -0
  95. package/dist/components/Select/CloseItem.d.ts.map +1 -0
  96. package/dist/components/Select/CloseItem.js +26 -0
  97. package/dist/components/Select/CloseItem.js.map +1 -0
  98. package/dist/components/Select/CreatableSelect.d.ts +16 -0
  99. package/dist/components/Select/CreatableSelect.d.ts.map +1 -0
  100. package/dist/components/Select/CreatableSelect.js +114 -0
  101. package/dist/components/Select/CreatableSelect.js.map +1 -0
  102. package/dist/components/Select/CustomMenu.d.ts +8 -0
  103. package/dist/components/Select/CustomMenu.d.ts.map +1 -0
  104. package/dist/components/Select/CustomMenu.js +4 -0
  105. package/dist/components/Select/CustomMenu.js.map +1 -0
  106. package/dist/components/Select/LabelItem.d.ts +3 -0
  107. package/dist/components/Select/LabelItem.d.ts.map +1 -0
  108. package/dist/components/Select/LabelItem.js +4 -0
  109. package/dist/components/Select/LabelItem.js.map +1 -0
  110. package/dist/components/Select/MultiValue.d.ts +3 -0
  111. package/dist/components/Select/MultiValue.d.ts.map +1 -0
  112. package/dist/components/Select/MultiValue.js +27 -0
  113. package/dist/components/Select/MultiValue.js.map +1 -0
  114. package/dist/components/Select/SelectInfiniteScroll.d.ts +14 -0
  115. package/dist/components/Select/SelectInfiniteScroll.d.ts.map +1 -0
  116. package/dist/components/Select/SelectInfiniteScroll.js +31 -0
  117. package/dist/components/Select/SelectInfiniteScroll.js.map +1 -0
  118. package/dist/components/Select/SelectSearch.d.ts +11 -0
  119. package/dist/components/Select/SelectSearch.d.ts.map +1 -0
  120. package/dist/components/Select/SelectSearch.js +156 -0
  121. package/dist/components/Select/SelectSearch.js.map +1 -0
  122. package/dist/components/Select/index.d.ts +6 -0
  123. package/dist/components/Select/index.d.ts.map +1 -0
  124. package/dist/components/Select/index.js +6 -0
  125. package/dist/components/Select/index.js.map +1 -0
  126. package/dist/components/Select/types.d.ts +7 -0
  127. package/dist/components/Select/types.d.ts.map +1 -0
  128. package/dist/components/Select/types.js +2 -0
  129. package/dist/components/Select/types.js.map +1 -0
  130. package/dist/components/SelectionList.d.ts +151 -0
  131. package/dist/components/SelectionList.d.ts.map +1 -0
  132. package/dist/components/SelectionList.js +180 -0
  133. package/dist/components/SelectionList.js.map +1 -0
  134. package/dist/components/StatusCircle.d.ts +24 -0
  135. package/dist/components/StatusCircle.d.ts.map +1 -0
  136. package/dist/components/StatusCircle.js +44 -0
  137. package/dist/components/StatusCircle.js.map +1 -0
  138. package/dist/components/Stepper/Navigation.d.ts +35 -0
  139. package/dist/components/Stepper/Navigation.d.ts.map +1 -0
  140. package/dist/components/Stepper/Navigation.js +41 -0
  141. package/dist/components/Stepper/Navigation.js.map +1 -0
  142. package/dist/components/Stepper/Step.d.ts +18 -0
  143. package/dist/components/Stepper/Step.d.ts.map +1 -0
  144. package/dist/components/Stepper/Step.js +13 -0
  145. package/dist/components/Stepper/Step.js.map +1 -0
  146. package/dist/components/Stepper/Stepper.d.ts +45 -0
  147. package/dist/components/Stepper/Stepper.d.ts.map +1 -0
  148. package/dist/components/Stepper/Stepper.js +57 -0
  149. package/dist/components/Stepper/Stepper.js.map +1 -0
  150. package/dist/components/Stepper/headers.d.ts +19 -0
  151. package/dist/components/Stepper/headers.d.ts.map +1 -0
  152. package/dist/components/Stepper/headers.js +40 -0
  153. package/dist/components/Stepper/headers.js.map +1 -0
  154. package/dist/components/Stepper/index.d.ts +4 -0
  155. package/dist/components/Stepper/index.d.ts.map +1 -0
  156. package/dist/components/Stepper/index.js +4 -0
  157. package/dist/components/Stepper/index.js.map +1 -0
  158. package/dist/components/Table/HeaderItem.d.ts +18 -0
  159. package/dist/components/Table/HeaderItem.d.ts.map +1 -0
  160. package/dist/components/Table/HeaderItem.js +14 -0
  161. package/dist/components/Table/HeaderItem.js.map +1 -0
  162. package/dist/components/Table/SettingsVerticalMenu.d.ts +14 -0
  163. package/dist/components/Table/SettingsVerticalMenu.d.ts.map +1 -0
  164. package/dist/components/Table/SettingsVerticalMenu.js +14 -0
  165. package/dist/components/Table/SettingsVerticalMenu.js.map +1 -0
  166. package/dist/components/Table/StyledLinkTable.d.ts +5 -0
  167. package/dist/components/Table/StyledLinkTable.d.ts.map +1 -0
  168. package/dist/components/Table/StyledLinkTable.js +13 -0
  169. package/dist/components/Table/StyledLinkTable.js.map +1 -0
  170. package/dist/components/Table/TableData.d.ts +37 -0
  171. package/dist/components/Table/TableData.d.ts.map +1 -0
  172. package/dist/components/Table/TableData.js +84 -0
  173. package/dist/components/Table/TableData.js.map +1 -0
  174. package/dist/components/Table/index.d.ts +3 -0
  175. package/dist/components/Table/index.d.ts.map +1 -0
  176. package/dist/components/Table/index.js +3 -0
  177. package/dist/components/Table/index.js.map +1 -0
  178. package/dist/components/TimelineSection.d.ts +24 -0
  179. package/dist/components/TimelineSection.d.ts.map +1 -0
  180. package/dist/components/TimelineSection.js +37 -0
  181. package/dist/components/TimelineSection.js.map +1 -0
  182. package/dist/components/error/ErrorFeedback.d.ts +58 -0
  183. package/dist/components/error/ErrorFeedback.d.ts.map +1 -0
  184. package/dist/components/error/ErrorFeedback.js +110 -0
  185. package/dist/components/error/ErrorFeedback.js.map +1 -0
  186. package/dist/components/error/NotFound.d.ts +4 -0
  187. package/dist/components/error/NotFound.d.ts.map +1 -0
  188. package/dist/components/error/NotFound.js +19 -0
  189. package/dist/components/error/NotFound.js.map +1 -0
  190. package/dist/components/error/UnderMaintenance.d.ts +4 -0
  191. package/dist/components/error/UnderMaintenance.d.ts.map +1 -0
  192. package/dist/components/error/UnderMaintenance.js +25 -0
  193. package/dist/components/error/UnderMaintenance.js.map +1 -0
  194. package/dist/components/error/index.d.ts +4 -0
  195. package/dist/components/error/index.d.ts.map +1 -0
  196. package/dist/components/error/index.js +4 -0
  197. package/dist/components/error/index.js.map +1 -0
  198. package/dist/components/form/Form/Form.d.ts +15 -0
  199. package/dist/components/form/Form/Form.d.ts.map +1 -0
  200. package/dist/components/form/Form/Form.js +48 -0
  201. package/dist/components/form/Form/Form.js.map +1 -0
  202. package/dist/components/form/Form/FormGroup.d.ts +37 -0
  203. package/dist/components/form/Form/FormGroup.d.ts.map +1 -0
  204. package/dist/components/form/Form/FormGroup.js +72 -0
  205. package/dist/components/form/Form/FormGroup.js.map +1 -0
  206. package/dist/components/form/Form/index.d.ts +3 -0
  207. package/dist/components/form/Form/index.d.ts.map +1 -0
  208. package/dist/components/form/Form/index.js +3 -0
  209. package/dist/components/form/Form/index.js.map +1 -0
  210. package/dist/components/form/SearchInput.d.ts +9 -0
  211. package/dist/components/form/SearchInput.d.ts.map +1 -0
  212. package/dist/components/form/SearchInput.js +28 -0
  213. package/dist/components/form/SearchInput.js.map +1 -0
  214. package/dist/components/form/Select/CustomSelect.d.ts +81 -0
  215. package/dist/components/form/Select/CustomSelect.d.ts.map +1 -0
  216. package/dist/components/form/Select/CustomSelect.js +178 -0
  217. package/dist/components/form/Select/CustomSelect.js.map +1 -0
  218. package/dist/components/form/Select/DetailedSelect.d.ts +65 -0
  219. package/dist/components/form/Select/DetailedSelect.d.ts.map +1 -0
  220. package/dist/components/form/Select/DetailedSelect.js +80 -0
  221. package/dist/components/form/Select/DetailedSelect.js.map +1 -0
  222. package/dist/components/form/Select/Select.d.ts +47 -0
  223. package/dist/components/form/Select/Select.d.ts.map +1 -0
  224. package/dist/components/form/Select/Select.js +62 -0
  225. package/dist/components/form/Select/Select.js.map +1 -0
  226. package/dist/components/form/Select/index.d.ts +5 -0
  227. package/dist/components/form/Select/index.d.ts.map +1 -0
  228. package/dist/components/form/Select/index.js +5 -0
  229. package/dist/components/form/Select/index.js.map +1 -0
  230. package/dist/components/form/Select/styled.d.ts +5 -0
  231. package/dist/components/form/Select/styled.d.ts.map +1 -0
  232. package/dist/components/form/Select/styled.js +165 -0
  233. package/dist/components/form/Select/styled.js.map +1 -0
  234. package/dist/components/form/Select/types.d.ts +103 -0
  235. package/dist/components/form/Select/types.d.ts.map +1 -0
  236. package/dist/components/form/Select/types.js +2 -0
  237. package/dist/components/form/Select/types.js.map +1 -0
  238. package/dist/components/form/Select/utils.d.ts +3 -0
  239. package/dist/components/form/Select/utils.d.ts.map +1 -0
  240. package/dist/components/form/Select/utils.js +20 -0
  241. package/dist/components/form/Select/utils.js.map +1 -0
  242. package/dist/components/notification/NotificationComponent.d.ts +31 -0
  243. package/dist/components/notification/NotificationComponent.d.ts.map +1 -0
  244. package/dist/components/notification/NotificationComponent.js +176 -0
  245. package/dist/components/notification/NotificationComponent.js.map +1 -0
  246. package/dist/components/notification/NotificationItem.d.ts +51 -0
  247. package/dist/components/notification/NotificationItem.d.ts.map +1 -0
  248. package/dist/components/notification/NotificationItem.js +165 -0
  249. package/dist/components/notification/NotificationItem.js.map +1 -0
  250. package/dist/components/notification/NotificationList.d.ts +47 -0
  251. package/dist/components/notification/NotificationList.d.ts.map +1 -0
  252. package/dist/components/notification/NotificationList.js +82 -0
  253. package/dist/components/notification/NotificationList.js.map +1 -0
  254. package/dist/components/notification/NotificationPlaceholder.d.ts +13 -0
  255. package/dist/components/notification/NotificationPlaceholder.d.ts.map +1 -0
  256. package/dist/components/notification/NotificationPlaceholder.js +34 -0
  257. package/dist/components/notification/NotificationPlaceholder.js.map +1 -0
  258. package/dist/components/notification/types.d.ts +60 -0
  259. package/dist/components/notification/types.d.ts.map +1 -0
  260. package/dist/components/notification/types.js +7 -0
  261. package/dist/components/notification/types.js.map +1 -0
  262. package/dist/containers/NotificationsPage.d.ts +2 -0
  263. package/dist/containers/NotificationsPage.d.ts.map +1 -0
  264. package/dist/containers/NotificationsPage.js +71 -0
  265. package/dist/containers/NotificationsPage.js.map +1 -0
  266. package/dist/context/anchor.d.ts +27 -0
  267. package/dist/context/anchor.d.ts.map +1 -0
  268. package/dist/context/anchor.js +23 -0
  269. package/dist/context/anchor.js.map +1 -0
  270. package/dist/context/loading.d.ts +27 -0
  271. package/dist/context/loading.d.ts.map +1 -0
  272. package/dist/context/loading.js +24 -0
  273. package/dist/context/loading.js.map +1 -0
  274. package/dist/context/notification/LazyNotificationList.d.ts +28 -0
  275. package/dist/context/notification/LazyNotificationList.d.ts.map +1 -0
  276. package/dist/context/notification/LazyNotificationList.js +136 -0
  277. package/dist/context/notification/LazyNotificationList.js.map +1 -0
  278. package/dist/context/notification/NotificationController.d.ts +25 -0
  279. package/dist/context/notification/NotificationController.d.ts.map +1 -0
  280. package/dist/context/notification/NotificationController.js +153 -0
  281. package/dist/context/notification/NotificationController.js.map +1 -0
  282. package/dist/context/notification/context.d.ts +8 -0
  283. package/dist/context/notification/context.d.ts.map +1 -0
  284. package/dist/context/notification/context.js +12 -0
  285. package/dist/context/notification/context.js.map +1 -0
  286. package/dist/context/notification/hooks.d.ts +18 -0
  287. package/dist/context/notification/hooks.d.ts.map +1 -0
  288. package/dist/context/notification/hooks.js +92 -0
  289. package/dist/context/notification/hooks.js.map +1 -0
  290. package/dist/context/notification/types.d.ts +65 -0
  291. package/dist/context/notification/types.d.ts.map +1 -0
  292. package/dist/context/notification/types.js +2 -0
  293. package/dist/context/notification/types.js.map +1 -0
  294. package/dist/hooks/date.d.ts +18 -0
  295. package/dist/hooks/date.d.ts.map +1 -0
  296. package/dist/hooks/date.js +68 -0
  297. package/dist/hooks/date.js.map +1 -0
  298. package/dist/hooks/keyboard.d.ts +64 -0
  299. package/dist/hooks/keyboard.d.ts.map +1 -0
  300. package/dist/hooks/keyboard.js +84 -0
  301. package/dist/hooks/keyboard.js.map +1 -0
  302. package/dist/hooks/manual-render.d.ts +8 -0
  303. package/dist/hooks/manual-render.d.ts.map +1 -0
  304. package/dist/hooks/manual-render.js +10 -0
  305. package/dist/hooks/manual-render.js.map +1 -0
  306. package/dist/hooks/service-now.d.ts +32 -1
  307. package/dist/hooks/service-now.d.ts.map +1 -1
  308. package/dist/hooks/service-now.js +58 -18
  309. package/dist/hooks/service-now.js.map +1 -1
  310. package/dist/hooks/text.d.ts +9 -0
  311. package/dist/hooks/text.d.ts.map +1 -0
  312. package/dist/hooks/text.js +24 -0
  313. package/dist/hooks/text.js.map +1 -0
  314. package/dist/hooks/title.d.ts +13 -0
  315. package/dist/hooks/title.d.ts.map +1 -1
  316. package/dist/hooks/title.js +13 -0
  317. package/dist/hooks/title.js.map +1 -1
  318. package/dist/hooks/use-effect-once.d.ts.map +1 -1
  319. package/dist/hooks/use-effect-once.js.map +1 -1
  320. package/dist/index.d.ts +14 -4
  321. package/dist/index.d.ts.map +1 -1
  322. package/dist/index.js +14 -4
  323. package/dist/index.js.map +1 -1
  324. package/dist/notifications.d.ts +11 -0
  325. package/dist/notifications.d.ts.map +1 -0
  326. package/dist/notifications.js +10 -0
  327. package/dist/notifications.js.map +1 -0
  328. package/dist/svg/AI.d.ts +8 -0
  329. package/dist/svg/AI.d.ts.map +1 -0
  330. package/dist/svg/AI.js +15 -0
  331. package/dist/svg/AI.js.map +1 -0
  332. package/dist/svg/CS.d.ts +8 -0
  333. package/dist/svg/CS.d.ts.map +1 -0
  334. package/dist/svg/CS.js +15 -0
  335. package/dist/svg/CS.js.map +1 -0
  336. package/dist/svg/EDP.d.ts +8 -0
  337. package/dist/svg/EDP.d.ts.map +1 -0
  338. package/dist/svg/EDP.js +15 -0
  339. package/dist/svg/EDP.js.map +1 -0
  340. package/dist/svg/Forbidden.d.ts +5 -0
  341. package/dist/svg/Forbidden.d.ts.map +1 -0
  342. package/dist/svg/Forbidden.js +4 -0
  343. package/dist/svg/Forbidden.js.map +1 -0
  344. package/dist/svg/GenericPlaceholder.d.ts +7 -0
  345. package/dist/svg/GenericPlaceholder.d.ts.map +1 -0
  346. package/dist/svg/GenericPlaceholder.js +4 -0
  347. package/dist/svg/GenericPlaceholder.js.map +1 -0
  348. package/dist/svg/HUB.d.ts +8 -0
  349. package/dist/svg/HUB.d.ts.map +1 -0
  350. package/dist/svg/HUB.js +15 -0
  351. package/dist/svg/HUB.js.map +1 -0
  352. package/dist/svg/Logo.d.ts +5 -0
  353. package/dist/svg/Logo.d.ts.map +1 -0
  354. package/dist/svg/Logo.js +8 -0
  355. package/dist/svg/Logo.js.map +1 -0
  356. package/dist/svg/MiniLogo.d.ts +8 -0
  357. package/dist/svg/MiniLogo.d.ts.map +1 -0
  358. package/dist/svg/MiniLogo.js +6 -0
  359. package/dist/svg/MiniLogo.js.map +1 -0
  360. package/dist/svg/NotFound.d.ts +5 -0
  361. package/dist/svg/NotFound.d.ts.map +1 -0
  362. package/dist/svg/NotFound.js +4 -0
  363. package/dist/svg/NotFound.js.map +1 -0
  364. package/dist/svg/ServerError.d.ts +5 -0
  365. package/dist/svg/ServerError.d.ts.map +1 -0
  366. package/dist/svg/ServerError.js +4 -0
  367. package/dist/svg/ServerError.js.map +1 -0
  368. package/dist/svg/Unauthenticated.d.ts +5 -0
  369. package/dist/svg/Unauthenticated.d.ts.map +1 -0
  370. package/dist/svg/Unauthenticated.js +4 -0
  371. package/dist/svg/Unauthenticated.js.map +1 -0
  372. package/dist/svg/index.d.ts +12 -0
  373. package/dist/svg/index.d.ts.map +1 -0
  374. package/dist/svg/index.js +12 -0
  375. package/dist/svg/index.js.map +1 -0
  376. package/dist/utils/accessibility.d.ts +75 -0
  377. package/dist/utils/accessibility.d.ts.map +1 -0
  378. package/dist/utils/accessibility.js +123 -0
  379. package/dist/utils/accessibility.js.map +1 -0
  380. package/dist/utils/cookie.d.ts +34 -0
  381. package/dist/utils/cookie.d.ts.map +1 -0
  382. package/dist/utils/cookie.js +69 -0
  383. package/dist/utils/cookie.js.map +1 -0
  384. package/dist/utils/promise.d.ts +2 -0
  385. package/dist/utils/promise.d.ts.map +1 -0
  386. package/dist/utils/promise.js +6 -0
  387. package/dist/utils/promise.js.map +1 -0
  388. package/dist/utils/read-file.d.ts +2 -0
  389. package/dist/utils/read-file.d.ts.map +1 -0
  390. package/dist/utils/read-file.js +14 -0
  391. package/dist/utils/read-file.js.map +1 -0
  392. package/package.dev.json +3 -0
  393. package/package.json +53 -14
  394. package/package.stg.json +3 -0
  395. package/readme.md +55 -13
  396. package/src/components/AnimatedHeight.tsx +174 -0
  397. package/src/components/AsyncContent.tsx +78 -0
  398. package/src/components/BannerWarning.tsx +89 -19
  399. package/src/components/Breadcrumb/index.tsx +20 -5
  400. package/src/components/Breadcrumb/styled.ts +2 -1
  401. package/src/components/ButtonLoading.tsx +29 -0
  402. package/src/components/ChatBot.tsx +12 -7
  403. package/src/components/ContentValidateFilter.tsx +15 -0
  404. package/src/components/FadingOverflow.tsx +265 -0
  405. package/src/components/FileTreeView/More.tsx +114 -0
  406. package/src/components/FileTreeView/index.tsx +186 -0
  407. package/src/components/InfiniteScroll.tsx +24 -0
  408. package/src/components/InfoMaintenanceBanner.tsx +25 -0
  409. package/src/components/LazyMarkdown/BlockquoteMd.tsx +107 -0
  410. package/src/components/LazyMarkdown/CodeViewer.tsx +161 -0
  411. package/src/components/LazyMarkdown/Markdown.tsx +122 -0
  412. package/src/components/LazyMarkdown/MarkdownButton.tsx +24 -0
  413. package/src/components/LazyMarkdown/Video.tsx +13 -0
  414. package/src/components/LazyMarkdown/index.tsx +21 -0
  415. package/src/components/Placeholder.tsx +124 -0
  416. package/src/components/ScrollView.tsx +57 -0
  417. package/src/components/Select/BadgeItem.tsx +58 -0
  418. package/src/components/Select/ClearInput.tsx +24 -0
  419. package/src/components/Select/CloseItem.tsx +38 -0
  420. package/src/components/Select/CreatableSelect.tsx +155 -0
  421. package/src/components/Select/CustomMenu.tsx +16 -0
  422. package/src/components/Select/LabelItem.tsx +8 -0
  423. package/src/components/Select/MultiValue.tsx +49 -0
  424. package/src/components/Select/SelectInfiniteScroll.tsx +82 -0
  425. package/src/components/Select/SelectSearch.tsx +195 -0
  426. package/src/components/Select/index.tsx +7 -0
  427. package/src/components/Select/types.ts +8 -0
  428. package/src/components/SelectionList.tsx +427 -0
  429. package/src/components/StatusCircle.tsx +67 -0
  430. package/src/components/Stepper/Navigation.tsx +97 -0
  431. package/src/components/Stepper/Step.tsx +30 -0
  432. package/src/components/Stepper/Stepper.tsx +113 -0
  433. package/src/components/Stepper/headers.tsx +64 -0
  434. package/src/components/Stepper/index.ts +3 -0
  435. package/src/components/Table/HeaderItem.tsx +52 -0
  436. package/src/components/Table/SettingsVerticalMenu.tsx +50 -0
  437. package/src/components/Table/StyledLinkTable.tsx +22 -0
  438. package/src/components/Table/TableData.tsx +251 -0
  439. package/src/components/Table/index.tsx +2 -0
  440. package/src/components/TimelineSection.tsx +66 -0
  441. package/src/components/error/ErrorFeedback.tsx +217 -0
  442. package/src/components/error/NotFound.tsx +24 -0
  443. package/src/components/error/UnderMaintenance.tsx +30 -0
  444. package/src/components/error/index.ts +4 -0
  445. package/src/components/form/Form/Form.tsx +101 -0
  446. package/src/components/form/Form/FormGroup.tsx +221 -0
  447. package/src/components/form/Form/index.ts +2 -0
  448. package/src/components/form/SearchInput.tsx +69 -0
  449. package/src/components/form/Select/CustomSelect.tsx +232 -0
  450. package/src/components/form/Select/DetailedSelect.tsx +85 -0
  451. package/src/components/form/Select/Select.tsx +67 -0
  452. package/src/components/form/Select/index.ts +4 -0
  453. package/src/components/form/Select/styled.ts +165 -0
  454. package/src/components/form/Select/types.ts +112 -0
  455. package/src/components/form/Select/utils.tsx +28 -0
  456. package/src/components/notification/NotificationComponent.tsx +340 -0
  457. package/src/components/notification/NotificationItem.tsx +353 -0
  458. package/src/components/notification/NotificationList.tsx +185 -0
  459. package/src/components/notification/NotificationPlaceholder.tsx +60 -0
  460. package/src/components/notification/types.ts +72 -0
  461. package/src/containers/NotificationsPage.tsx +120 -0
  462. package/src/context/anchor.tsx +37 -0
  463. package/src/context/loading.tsx +36 -0
  464. package/src/context/notification/LazyNotificationList.ts +103 -0
  465. package/src/context/notification/NotificationController.ts +119 -0
  466. package/src/context/notification/context.tsx +23 -0
  467. package/src/context/notification/hooks.ts +98 -0
  468. package/src/context/notification/types.ts +71 -0
  469. package/src/hooks/date.ts +68 -0
  470. package/src/hooks/keyboard.tsx +128 -0
  471. package/src/hooks/manual-render.tsx +10 -0
  472. package/src/hooks/service-now.tsx +64 -19
  473. package/src/hooks/text.tsx +30 -0
  474. package/src/hooks/title.tsx +13 -0
  475. package/src/index.ts +14 -6
  476. package/src/notifications.ts +11 -0
  477. package/src/svg/AI.tsx +41 -0
  478. package/src/svg/CS.tsx +48 -0
  479. package/src/svg/EDP.tsx +31 -0
  480. package/src/svg/Forbidden.tsx +22 -0
  481. package/src/svg/GenericPlaceholder.tsx +16 -0
  482. package/src/svg/HUB.tsx +48 -0
  483. package/src/svg/Logo.tsx +16 -0
  484. package/src/svg/MiniLogo.tsx +12 -0
  485. package/src/svg/NotFound.tsx +16 -0
  486. package/src/svg/ServerError.tsx +33 -0
  487. package/src/svg/Unauthenticated.tsx +16 -0
  488. package/src/svg/index.ts +11 -0
  489. package/src/utils/accessibility.ts +135 -0
  490. package/src/utils/cookie.ts +73 -0
  491. package/src/utils/promise.ts +5 -0
  492. package/src/utils/read-file.ts +16 -0
  493. package/tsconfig.json +1 -0
  494. package/dist/BannerWarning.d.ts +0 -4
  495. package/dist/BannerWarning.d.ts.map +0 -1
  496. package/dist/BannerWarning.js +0 -6
  497. package/dist/BannerWarning.js.map +0 -1
  498. package/dist/Login.d.ts +0 -25
  499. package/dist/Login.d.ts.map +0 -1
  500. package/dist/Login.js +0 -104
  501. package/dist/Login.js.map +0 -1
  502. package/dist/MiniLogo.d.ts +0 -6
  503. package/dist/MiniLogo.d.ts.map +0 -1
  504. package/dist/MiniLogo.js +0 -4
  505. package/dist/MiniLogo.js.map +0 -1
  506. package/dist/components/Login.d.ts +0 -26
  507. package/dist/components/Login.d.ts.map +0 -1
  508. package/dist/components/Login.js +0 -100
  509. package/dist/components/Login.js.map +0 -1
  510. package/dist/components/MiniLogo.d.ts +0 -6
  511. package/dist/components/MiniLogo.d.ts.map +0 -1
  512. package/dist/components/MiniLogo.js +0 -4
  513. package/dist/components/MiniLogo.js.map +0 -1
  514. package/dist/components/src/components/BannerWarning.d.ts +0 -4
  515. package/dist/components/src/components/BannerWarning.d.ts.map +0 -1
  516. package/dist/components/src/components/BannerWarning.js +0 -6
  517. package/dist/components/src/components/BannerWarning.js.map +0 -1
  518. package/dist/components/src/components/Breadcrumb/index.d.ts +0 -42
  519. package/dist/components/src/components/Breadcrumb/index.d.ts.map +0 -1
  520. package/dist/components/src/components/Breadcrumb/index.js +0 -27
  521. package/dist/components/src/components/Breadcrumb/index.js.map +0 -1
  522. package/dist/components/src/components/Breadcrumb/styled.d.ts +0 -3
  523. package/dist/components/src/components/Breadcrumb/styled.d.ts.map +0 -1
  524. package/dist/components/src/components/Breadcrumb/styled.js +0 -36
  525. package/dist/components/src/components/Breadcrumb/styled.js.map +0 -1
  526. package/dist/components/src/components/ChatBot.d.ts +0 -2
  527. package/dist/components/src/components/ChatBot.d.ts.map +0 -1
  528. package/dist/components/src/components/ChatBot.js +0 -61
  529. package/dist/components/src/components/ChatBot.js.map +0 -1
  530. package/dist/components/src/components/Login.d.ts +0 -26
  531. package/dist/components/src/components/Login.d.ts.map +0 -1
  532. package/dist/components/src/components/Login.js +0 -100
  533. package/dist/components/src/components/Login.js.map +0 -1
  534. package/dist/components/src/components/MiniLogo.d.ts +0 -6
  535. package/dist/components/src/components/MiniLogo.d.ts.map +0 -1
  536. package/dist/components/src/components/MiniLogo.js +0 -4
  537. package/dist/components/src/components/MiniLogo.js.map +0 -1
  538. package/dist/components/src/components/tour/StepContainer.d.ts +0 -13
  539. package/dist/components/src/components/tour/StepContainer.d.ts.map +0 -1
  540. package/dist/components/src/components/tour/StepContainer.js +0 -48
  541. package/dist/components/src/components/tour/StepContainer.js.map +0 -1
  542. package/dist/components/src/components/tour/StepNavigation.d.ts +0 -13
  543. package/dist/components/src/components/tour/StepNavigation.d.ts.map +0 -1
  544. package/dist/components/src/components/tour/StepNavigation.js +0 -20
  545. package/dist/components/src/components/tour/StepNavigation.js.map +0 -1
  546. package/dist/components/src/components/tour/StepTitle.d.ts +0 -7
  547. package/dist/components/src/components/tour/StepTitle.d.ts.map +0 -1
  548. package/dist/components/src/components/tour/StepTitle.js +0 -5
  549. package/dist/components/src/components/tour/StepTitle.js.map +0 -1
  550. package/dist/components/src/components/tour/context.d.ts +0 -17
  551. package/dist/components/src/components/tour/context.d.ts.map +0 -1
  552. package/dist/components/src/components/tour/context.js +0 -48
  553. package/dist/components/src/components/tour/context.js.map +0 -1
  554. package/dist/components/src/components/tour/index.d.ts +0 -4
  555. package/dist/components/src/components/tour/index.d.ts.map +0 -1
  556. package/dist/components/src/components/tour/index.js +0 -4
  557. package/dist/components/src/components/tour/index.js.map +0 -1
  558. package/dist/components/src/components/tour/utils.d.ts +0 -13
  559. package/dist/components/src/components/tour/utils.d.ts.map +0 -1
  560. package/dist/components/src/components/tour/utils.js +0 -43
  561. package/dist/components/src/components/tour/utils.js.map +0 -1
  562. package/dist/components/src/hooks/service-now.d.ts +0 -24
  563. package/dist/components/src/hooks/service-now.d.ts.map +0 -1
  564. package/dist/components/src/hooks/service-now.js +0 -161
  565. package/dist/components/src/hooks/service-now.js.map +0 -1
  566. package/dist/components/src/hooks/title.d.ts +0 -3
  567. package/dist/components/src/hooks/title.d.ts.map +0 -1
  568. package/dist/components/src/hooks/title.js +0 -13
  569. package/dist/components/src/hooks/title.js.map +0 -1
  570. package/dist/components/src/hooks/use-effect-once.d.ts +0 -12
  571. package/dist/components/src/hooks/use-effect-once.d.ts.map +0 -1
  572. package/dist/components/src/hooks/use-effect-once.js +0 -40
  573. package/dist/components/src/hooks/use-effect-once.js.map +0 -1
  574. package/dist/components/src/index.d.ts +0 -9
  575. package/dist/components/src/index.d.ts.map +0 -1
  576. package/dist/components/src/index.js +0 -9
  577. package/dist/components/src/index.js.map +0 -1
  578. package/dist/components/tour/StepContainer.d.ts +0 -13
  579. package/dist/components/tour/StepContainer.d.ts.map +0 -1
  580. package/dist/components/tour/StepContainer.js +0 -48
  581. package/dist/components/tour/StepContainer.js.map +0 -1
  582. package/dist/components/tour/StepNavigation.d.ts +0 -13
  583. package/dist/components/tour/StepNavigation.d.ts.map +0 -1
  584. package/dist/components/tour/StepNavigation.js +0 -20
  585. package/dist/components/tour/StepNavigation.js.map +0 -1
  586. package/dist/components/tour/StepTitle.d.ts +0 -7
  587. package/dist/components/tour/StepTitle.d.ts.map +0 -1
  588. package/dist/components/tour/StepTitle.js +0 -5
  589. package/dist/components/tour/StepTitle.js.map +0 -1
  590. package/dist/components/tour/context.d.ts +0 -17
  591. package/dist/components/tour/context.d.ts.map +0 -1
  592. package/dist/components/tour/context.js +0 -48
  593. package/dist/components/tour/context.js.map +0 -1
  594. package/dist/components/tour/index.d.ts +0 -9
  595. package/dist/components/tour/index.d.ts.map +0 -1
  596. package/dist/components/tour/index.js +0 -4
  597. package/dist/components/tour/index.js.map +0 -1
  598. package/dist/components/tour/utils.d.ts +0 -13
  599. package/dist/components/tour/utils.d.ts.map +0 -1
  600. package/dist/components/tour/utils.js +0 -43
  601. package/dist/components/tour/utils.js.map +0 -1
  602. package/dist/layout/src/components/tour/PortalSwitcherStep.d.ts +0 -2
  603. package/dist/layout/src/components/tour/PortalSwitcherStep.d.ts.map +0 -1
  604. package/dist/layout/src/components/tour/PortalSwitcherStep.js +0 -30
  605. package/dist/layout/src/components/tour/PortalSwitcherStep.js.map +0 -1
  606. package/src/components/Login.tsx +0 -157
  607. package/src/components/MiniLogo.tsx +0 -32
  608. package/src/components/tour/StepContainer.tsx +0 -67
  609. package/src/components/tour/StepNavigation.tsx +0 -32
  610. package/src/components/tour/StepTitle.tsx +0 -17
  611. package/src/components/tour/context.tsx +0 -56
  612. package/src/components/tour/index.ts +0 -7
  613. package/src/components/tour/utils.tsx +0 -65
@@ -0,0 +1,68 @@
1
+ import { useLanguage } from '@stack-spot/portal-translate';
2
+ import { format, formatDistanceToNow } from 'date-fns';
3
+ import { enUS, ptBR } from 'date-fns/locale';
4
+ function toValidDate(date) {
5
+ if (!date)
6
+ return undefined;
7
+ const d = typeof date === 'string' ? new Date(date) : date;
8
+ return isNaN(d.getTime()) ? undefined : d;
9
+ }
10
+ function formatDate(date, locale, includeTime) {
11
+ const d = toValidDate(date);
12
+ if (!d)
13
+ return undefined;
14
+ return locale === 'pt'
15
+ ? format(d, includeTime ? "dd/MM/yyyy 'às' HH:mm" : 'dd/MM/yyyy', { locale: ptBR })
16
+ : format(d, includeTime ? "MMM dd yyyy 'at' HH:mm" : 'MMM dd yyyy', { locale: enUS });
17
+ }
18
+ function formatSimpleDate(date, locale) {
19
+ const d = toValidDate(date);
20
+ if (!d)
21
+ return undefined;
22
+ return locale === 'pt'
23
+ ? format(d, 'dd/MM/yyyy', { locale: ptBR })
24
+ : format(d, 'MMM dd yyyy', { locale: enUS });
25
+ }
26
+ function formatMonthYear(date, locale) {
27
+ const d = toValidDate(date);
28
+ if (!d)
29
+ return undefined;
30
+ return locale === 'pt'
31
+ ? format(d, "MMMM 'de' yyyy", { locale: ptBR })
32
+ : format(d, 'MMMM yyyy', { locale: enUS });
33
+ }
34
+ function formatISODate(date) {
35
+ const d = toValidDate(date);
36
+ return d ? d.toISOString() : undefined;
37
+ }
38
+ function formatISOSDateShort(date) {
39
+ const d = toValidDate(date);
40
+ return d ? format(d, 'yyyy-MM-dd') : undefined;
41
+ }
42
+ /**
43
+ * A utility for formatting dates.
44
+ * @param date
45
+ * @returns a date formatter object.
46
+ */
47
+ export function useDateFormatter() {
48
+ const locale = useLanguage();
49
+ return {
50
+ formatDate: (date) => date ? formatDate(date, locale, false) : undefined,
51
+ formatDateWithTime: (date) => date ? formatDate(date, locale, true) : undefined,
52
+ formatSimpleDate: (date) => date ? formatSimpleDate(date, locale) : undefined,
53
+ formatMonthYear: (date) => date ? formatMonthYear(date, locale) : undefined,
54
+ formatRelativeWithTooltip: (date) => {
55
+ const d = toValidDate(date);
56
+ if (!d)
57
+ return undefined;
58
+ return {
59
+ relative: locale === 'pt'
60
+ ? formatDistanceToNow(d, { addSuffix: true, locale: ptBR })
61
+ : formatDistanceToNow(d, { addSuffix: true, locale: enUS }), tooltip: formatDate(d, locale, true),
62
+ };
63
+ },
64
+ formatISODate: (date) => date ? formatISODate(date) : undefined,
65
+ formatISOSDateShort: (date) => date ? formatISOSDateShort(date) : undefined,
66
+ };
67
+ }
68
+ //# sourceMappingURL=date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/hooks/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,I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C,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;QAC7F,eAAe,EAAE,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;QAC3F,yBAAyB,EAAE,CAAC,IAAoB,EAAE,EAAE;YACnD,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAA;YAC1B,IAAI,CAAC,CAAC;gBAAE,OAAO,SAAS,CAAA;YACxB,OAAO;gBACL,QAAQ,EAAE,MAAM,KAAK,IAAI;oBACvB,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;oBAC3D,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC;aACpG,CAAA;QAAA,CAAC;QACJ,aAAa,EAAE,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QAC/E,mBAAmB,EAAE,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;KAC5F,CAAA;AACH,CAAC"}
@@ -0,0 +1,64 @@
1
+ interface Options<T extends HTMLElement = HTMLDivElement> {
2
+ /**
3
+ * A query selector that returns every html element that must be navigable through the keyboard.
4
+ */
5
+ querySelectors: string;
6
+ /**
7
+ * Function to call when ESC is pressed. or when TAB is pressed at the last item in the list of items returned by the query selector.
8
+ */
9
+ onPressEscape?: () => void;
10
+ /**
11
+ * Function to call when TAB is pressed at the last item in the list of items returned by the query selector. Will be the same as
12
+ * onPressEscape if not specified.
13
+ *
14
+ * Attention: has no effect if `disableTabBehavior` is true.
15
+ */
16
+ onPressLastTab?: () => void;
17
+ /**
18
+ * Pass this function if you want any behavior when the user presses the arrow left.
19
+ */
20
+ onPressArrowLeft?: () => void;
21
+ /**
22
+ * Pass this function if you want any behavior when the user presses the arrow right.
23
+ */
24
+ onPressArrowRight?: () => void;
25
+ /**
26
+ * Disables any alteration to the tab key.
27
+ * @default false
28
+ */
29
+ disableTabBehavior?: boolean;
30
+ /**
31
+ * If you already have a ref to the element you want to attach the events to, you can pass it in this prop.
32
+ *
33
+ * If you pass a ref. The events won't be attached to the document, instead, they will be attached to the element referred by the ref.
34
+ */
35
+ ref?: React.RefObject<T>;
36
+ }
37
+ /**
38
+ * Creates listeners for controlling a Menu UI through the keyboard.
39
+ * - Arrow down: next element in the iterator returned by the query selectors. First element, if the current element is the last.
40
+ * - Arrow up: previous element in the iterator returned by the query selectors. Last element, if the current element is the first.
41
+ * - Tab: same as Arrow down, but has a different behavior if the element is the last (see onPressLastTab).
42
+ * - Esc: determined by onPressEscape.
43
+ * @param props {@link Options}.
44
+ * @returns an object with the element controlled by the keyboard (useRef); a function to attach the keyboard events and a function to
45
+ * detach the keyboard events.
46
+ */
47
+ export declare function useKeyboardControls<T extends HTMLElement = HTMLDivElement>(
48
+ /**
49
+ * Options for the keyboard controls.
50
+ */
51
+ { querySelectors, onPressEscape, onPressLastTab, onPressArrowLeft, onPressArrowRight, disableTabBehavior, ref, }: Options<T>,
52
+ /**
53
+ * Calls `attachKeyboardListeners` (mount) and `detachKeyboardListeners` (unmount) whenever the deps passed as parameter changes.
54
+ *
55
+ * If deps are undefined, this component doesn't automatically add these listeners and you have to use the functions returned in the
56
+ * result.
57
+ */
58
+ deps?: any[]): {
59
+ keyboardControlledElement: import("react").RefObject<T>;
60
+ attachKeyboardListeners: () => void;
61
+ detachKeyboardListeners: () => void;
62
+ };
63
+ export {};
64
+ //# sourceMappingURL=keyboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/hooks/keyboard.tsx"],"names":[],"mappings":"AAEA,UAAU,OAAO,CAAC,CAAC,SAAS,WAAW,GAAG,cAAc;IACtD;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,WAAW,GAAG,cAAc;AACxE;;GAEG;AACH,EACE,cAAc,EAAE,aAAa,EAAE,cAA8B,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,GAAG,GAC5H,EAAE,OAAO,CAAC,CAAC,CAAC;AACb;;;;;GAKG;AACH,IAAI,CAAC,EAAE,GAAG,EAAE;;;;EAiEb"}
@@ -0,0 +1,84 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ /**
3
+ * Creates listeners for controlling a Menu UI through the keyboard.
4
+ * - Arrow down: next element in the iterator returned by the query selectors. First element, if the current element is the last.
5
+ * - Arrow up: previous element in the iterator returned by the query selectors. Last element, if the current element is the first.
6
+ * - Tab: same as Arrow down, but has a different behavior if the element is the last (see onPressLastTab).
7
+ * - Esc: determined by onPressEscape.
8
+ * @param props {@link Options}.
9
+ * @returns an object with the element controlled by the keyboard (useRef); a function to attach the keyboard events and a function to
10
+ * detach the keyboard events.
11
+ */
12
+ export function useKeyboardControls(
13
+ /**
14
+ * Options for the keyboard controls.
15
+ */
16
+ { querySelectors, onPressEscape, onPressLastTab = onPressEscape, onPressArrowLeft, onPressArrowRight, disableTabBehavior, ref, },
17
+ /**
18
+ * Calls `attachKeyboardListeners` (mount) and `detachKeyboardListeners` (unmount) whenever the deps passed as parameter changes.
19
+ *
20
+ * If deps are undefined, this component doesn't automatically add these listeners and you have to use the functions returned in the
21
+ * result.
22
+ */
23
+ deps) {
24
+ const localRef = useRef(null);
25
+ const keyboardControlledElement = ref ?? localRef;
26
+ const listeners = useRef({});
27
+ listeners.current = { onPressEscape, onPressLastTab };
28
+ const keyboardControls = useCallback((event) => {
29
+ const eventKey = event.key;
30
+ const target = event?.target;
31
+ function getSelectableAnchors() {
32
+ return keyboardControlledElement.current?.querySelectorAll(querySelectors) ?? [];
33
+ }
34
+ function handleArrows(key = eventKey) {
35
+ const anchors = getSelectableAnchors();
36
+ let i = 0;
37
+ while (i < anchors.length && document.activeElement !== anchors[i])
38
+ i++;
39
+ const next = key === 'ArrowDown' ? (anchors[i + 1] ?? anchors[0]) : (anchors[i - 1] ?? anchors[anchors.length - 1]);
40
+ next?.focus?.();
41
+ }
42
+ const handlers = {
43
+ Escape: () => {
44
+ listeners.current.onPressEscape?.();
45
+ event.stopPropagation();
46
+ event.preventDefault();
47
+ },
48
+ Enter: () => {
49
+ target?.click();
50
+ },
51
+ Tab: () => {
52
+ if (disableTabBehavior)
53
+ return;
54
+ const anchors = getSelectableAnchors();
55
+ if (document.activeElement === anchors[anchors.length - 1])
56
+ listeners.current.onPressLastTab?.();
57
+ else
58
+ handleArrows('ArrowDown');
59
+ event.preventDefault();
60
+ },
61
+ ArrowUp: handleArrows,
62
+ ArrowDown: handleArrows,
63
+ ArrowLeft: onPressArrowLeft,
64
+ ArrowRight: onPressArrowRight,
65
+ };
66
+ handlers[eventKey]?.();
67
+ }, []);
68
+ const attachKeyboardListeners = useCallback(() => {
69
+ const element = ref?.current ?? document;
70
+ element.addEventListener('keydown', keyboardControls);
71
+ }, []);
72
+ const detachKeyboardListeners = useCallback(() => {
73
+ const element = ref?.current ?? document;
74
+ element.removeEventListener('keydown', keyboardControls);
75
+ }, []);
76
+ useEffect(() => {
77
+ if (!deps)
78
+ return;
79
+ attachKeyboardListeners();
80
+ return detachKeyboardListeners;
81
+ }, deps);
82
+ return { keyboardControlledElement, attachKeyboardListeners, detachKeyboardListeners };
83
+ }
84
+ //# sourceMappingURL=keyboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../src/hooks/keyboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAuCtD;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB;AACjC;;GAEG;AACH,EACE,cAAc,EAAE,aAAa,EAAE,cAAc,GAAG,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,GAAG,GAChH;AACb;;;;;GAKG;AACH,IAAY;IAEZ,MAAM,QAAQ,GAAG,MAAM,CAAI,IAAI,CAAC,CAAA;IAChC,MAAM,yBAAyB,GAAG,GAAG,IAAI,QAAQ,CAAA;IACjD,MAAM,SAAS,GAAG,MAAM,CAAoD,EAAE,CAAC,CAAA;IAC/E,SAAS,CAAC,OAAO,GAAG,EAAE,aAAa,EAAE,cAAc,EAAE,CAAA;IAErD,MAAM,gBAAgB,GAAG,WAAW,CAAC,CAAC,KAAY,EAAE,EAAE;QACpD,MAAM,QAAQ,GAAI,KAAuB,CAAC,GAAG,CAAA;QAC7C,MAAM,MAAM,GAAG,KAAK,EAAE,MAA4B,CAAA;QAElD,SAAS,oBAAoB;YAC3B,OAAO,yBAAyB,CAAC,OAAO,EAAE,gBAAgB,CAAC,cAAc,CAAC,IAAI,EAAE,CAAA;QAClF,CAAC;QAED,SAAS,YAAY,CAAC,GAAG,GAAG,QAAQ;YAClC,MA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C9B,CAAA;QAED,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAA;IACxB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,uBAAuB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/C,MAAM,OAAO,GAAG,GAAG,EAAE,OAAO,IAAI,QAAQ,CAAA;QACxC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IACvD,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,uBAAuB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/C,MAAM,OAAO,GAAG,GAAG,EAAE,OAAO,IAAI,QAAQ,CAAA;QACxC,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IAC1D,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,uBAAuB,EAAE,CAAA;QACzB,OAAO,uBAAuB,CAAA;IAChC,CAAC,EAAE,IAAI,CAAC,CAAA;IAER,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,CAAA;AACxF,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Use this hook to manually trigger a re-render from React.
3
+ * @returns an object with a function to re-render the component.
4
+ */
5
+ export declare function useManualRender(): {
6
+ repaint: () => void;
7
+ };
8
+ //# sourceMappingURL=manual-render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manual-render.d.ts","sourceRoot":"","sources":["../../src/hooks/manual-render.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,eAAe;;EAG9B"}
@@ -0,0 +1,10 @@
1
+ import { useCallback, useState } from 'react';
2
+ /**
3
+ * Use this hook to manually trigger a re-render from React.
4
+ * @returns an object with a function to re-render the component.
5
+ */
6
+ export function useManualRender() {
7
+ const [, setCount] = useState(0);
8
+ return { repaint: useCallback(() => setCount(v => v + 1), []) };
9
+ }
10
+ //# sourceMappingURL=manual-render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manual-render.js","sourceRoot":"","sources":["../../src/hooks/manual-render.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE7C;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAChC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAA;AACjE,CAAC"}
@@ -1,10 +1,41 @@
1
+ export declare const CHAT_BUTTON_ID = "service-now-button";
2
+ export declare const CHAT_BUTTON_WRAPPER_ID = "service-now-content";
1
3
  interface Options {
4
+ /**
5
+ * Function to run when the chat button is hidden, i.e. when the user clicks the close button that appears when the chat button is
6
+ * hovered.
7
+ */
2
8
  onClose?: () => void;
3
9
  }
10
+ /**
11
+ * @returns the iframe loaded by service now, i.e. the chat window; or null if the chat window doesn't exist.
12
+ */
4
13
  export declare function getServiceNowLauncher(): HTMLElement | null;
14
+ /**
15
+ * Opens the chat window and makes the chat button visible.
16
+ */
5
17
  export declare function openServiceNowChat(): void;
6
- export declare function addOrRemoveServiceNowLauncher(action: string): void;
18
+ /**
19
+ * Shows the chat window, i.e. shows the service now iframe and switch the icon in the chat button to "close".
20
+ */
21
+ export declare function showChatWindow(): void;
22
+ /**
23
+ * Hides the chat window, i.e. hides the service now iframe and switch the icon in the chat button to "chat".
24
+ */
25
+ export declare function hideChatWindow(): void;
26
+ /**
27
+ * A react hook that indicates whether the chat button is visible or not. This is updated whenever the value changes.
28
+ * @returns true if the chat button is visible and false otherwise.
29
+ */
7
30
  export declare function useServiceNowChatButtonVisibility(): boolean;
31
+ /**
32
+ * Starts Service Now:
33
+ *
34
+ * - Creates the chat window feature by loading the required script.
35
+ * - Adds a "minimize" button on top of the chat button (left bottom corner). This button appears whenever the user hovers the chat button.
36
+ * If clicked, the chat button is hidden.
37
+ * @param options
38
+ */
8
39
  export declare function useServiceNowEffect(options?: Options): void;
9
40
  export declare const dictionary: {
10
41
  en: {
@@ -1 +1 @@
1
- {"version":3,"file":"service-now.d.ts","sourceRoot":"","sources":["../../src/hooks/service-now.tsx"],"names":[],"mappings":"AAwCA,UAAU,OAAO;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAuBD,wBAAgB,qBAAqB,uBAEpC;AAED,wBAAgB,kBAAkB,SAIjC;AAaD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,QAU3D;AAkED,wBAAgB,iCAAiC,YAIhD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,OAAO,QAIpD;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAaD,CAAA"}
1
+ {"version":3,"file":"service-now.d.ts","sourceRoot":"","sources":["../../src/hooks/service-now.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc,uBAAuB,CAAA;AAClD,eAAO,MAAM,sBAAsB,wBAAwB,CAAA;AAoC3D,UAAU,OAAO;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAuBD;;GAEG;AACH,wBAAgB,qBAAqB,uBAEpC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,SAIjC;AAuBD;;GAEG;AACH,wBAAgB,cAAc,SAE7B;AAED;;GAEG;AACH,wBAAgB,cAAc,SAE7B;AAyED;;;GAGG;AACH,wBAAgB,iCAAiC,YAIhD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,OAAO,QAIpD;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAaD,CAAA"}
@@ -1,7 +1,10 @@
1
- import { getLanguage, translate } from '@stack-spot/portal-translate';
1
+ import { getLanguage, ptEn, translate } from '@stack-spot/portal-translate';
2
2
  import { pull } from 'lodash';
3
3
  import { useState } from 'react';
4
4
  import { useEffectOnce } from './use-effect-once.js';
5
+ const CHAT_IFRAME_ID = 'sn_va_web_client';
6
+ export const CHAT_BUTTON_ID = 'service-now-button';
7
+ export const CHAT_BUTTON_WRAPPER_ID = 'service-now-content';
5
8
  const closeButtonStyle = `
6
9
  position: absolute;
7
10
  bottom: -64px;
@@ -39,8 +42,8 @@ const serviceNowReference = 'https://zup.service-now.com/sn_va_web_client_app_em
39
42
  function loadScript(src) {
40
43
  return new Promise((resolve, reject) => {
41
44
  const iframe = document.createElement('iframe');
42
- const serviceNowContent = document.getElementById('service-now-content');
43
- iframe.setAttribute('id', 'sn_va_web_client');
45
+ const serviceNowContent = document.getElementById(CHAT_BUTTON_WRAPPER_ID);
46
+ iframe.setAttribute('id', CHAT_IFRAME_ID);
44
47
  iframe.setAttribute('src', src);
45
48
  iframe.style.cssText = iframeStyle;
46
49
  iframe.onload = () => resolve();
@@ -48,33 +51,58 @@ function loadScript(src) {
48
51
  serviceNowContent && serviceNowContent.appendChild(iframe);
49
52
  });
50
53
  }
54
+ /**
55
+ * @returns the iframe loaded by service now, i.e. the chat window; or null if the chat window doesn't exist.
56
+ */
51
57
  export function getServiceNowLauncher() {
52
- return document.getElementById('sn_va_web_client');
58
+ return document.getElementById(CHAT_IFRAME_ID);
53
59
  }
60
+ /**
61
+ * Opens the chat window and makes the chat button visible.
62
+ */
54
63
  export function openServiceNowChat() {
55
64
  hideOrShowServiceNowContent('visible');
56
- addOrRemoveServiceNowLauncher('add');
65
+ showChatWindow();
57
66
  showServiceNowChatButton();
58
67
  }
59
68
  function getServiceNowButton() {
60
- return document.getElementById('service-now-button');
69
+ return document.getElementById(CHAT_BUTTON_ID);
61
70
  }
62
71
  function hideOrShowServiceNowContent(action) {
63
- const content = document.getElementById('service-now-content');
72
+ const content = document.getElementById(CHAT_BUTTON_WRAPPER_ID);
64
73
  if (content) {
65
74
  content.style.visibility = action;
66
75
  }
67
76
  }
68
- export function addOrRemoveServiceNowLauncher(action) {
77
+ function toggleChatWindow(show) {
69
78
  const launcher = getServiceNowLauncher();
70
- const isAdd = action === 'add';
71
- if (launcher) {
72
- isAdd ? launcher.classList.add('show') : launcher.classList.remove('show');
73
- const content = document.getElementById('service-now-content');
74
- isAdd ? content?.classList.add('opened') : content?.classList.remove('opened');
75
- launcher.style.display = isAdd ? 'block' : 'none';
76
- }
79
+ const content = document.getElementById(CHAT_BUTTON_WRAPPER_ID);
80
+ if (!launcher || !content)
81
+ return;
82
+ const [action, display] = show ? ['add', 'block'] : ['remove', 'none'];
83
+ launcher.classList[action]('show');
84
+ content.classList[action]('opened');
85
+ launcher.style.display = display;
86
+ }
87
+ /**
88
+ * Shows the chat window, i.e. shows the service now iframe and switch the icon in the chat button to "close".
89
+ */
90
+ export function showChatWindow() {
91
+ toggleChatWindow(true);
92
+ }
93
+ /**
94
+ * Hides the chat window, i.e. hides the service now iframe and switch the icon in the chat button to "chat".
95
+ */
96
+ export function hideChatWindow() {
97
+ toggleChatWindow(false);
77
98
  }
99
+ /**
100
+ * Adds a listener that is called whenever the visibility of the chat button changes.
101
+ *
102
+ * The listener is called with a single parameter which indicates if the button is visible or not.
103
+ * @param listener the listener to register.
104
+ * @returns a function that, when called, removes the listener.
105
+ */
78
106
  function addChatVisibilityListener(listener) {
79
107
  chatVisibilityListeners.push(listener);
80
108
  return () => pull(chatVisibilityListeners, listener);
@@ -91,7 +119,7 @@ function renderCloseButton(onClose) {
91
119
  close.addEventListener('click', () => hideServiceNowChatButton(onClose));
92
120
  anchor.appendChild(close);
93
121
  serviceNowButton.addEventListener('mouseenter', () => {
94
- const t = translate(dictionary, getLanguage());
122
+ const t = translate(dictionary, getLanguage(ptEn));
95
123
  close.setAttribute('title', t.hide);
96
124
  close.style.transform = 'scale(1)';
97
125
  const onMouseMove = (ev) => {
@@ -110,7 +138,7 @@ function showServiceNowChatButton() {
110
138
  }
111
139
  function hideServiceNowChatButton(onClose) {
112
140
  hideOrShowServiceNowContent('hidden');
113
- addOrRemoveServiceNowLauncher('remove');
141
+ hideChatWindow();
114
142
  getServiceNowButton()?.classList?.remove('show');
115
143
  localStorage.setItem(LOCAL_STORAGE_SERVICE_NOW_VALUE, 'false');
116
144
  onClose?.();
@@ -129,16 +157,28 @@ async function initializeChat({ onClose } = {}) {
129
157
  renderCloseButton(onClose);
130
158
  }
131
159
  catch {
132
- const t = translate(dictionary, getLanguage());
160
+ const t = translate(dictionary, getLanguage(ptEn));
133
161
  // eslint-disable-next-line no-console
134
162
  console.warn(t.errorLoadScript);
135
163
  }
136
164
  }
165
+ /**
166
+ * A react hook that indicates whether the chat button is visible or not. This is updated whenever the value changes.
167
+ * @returns true if the chat button is visible and false otherwise.
168
+ */
137
169
  export function useServiceNowChatButtonVisibility() {
138
170
  const [visible, setVisible] = useState(isServiceNowChatButtonVisible());
139
171
  useEffectOnce(() => addChatVisibilityListener(setVisible));
140
172
  return visible;
141
173
  }
174
+ /**
175
+ * Starts Service Now:
176
+ *
177
+ * - Creates the chat window feature by loading the required script.
178
+ * - Adds a "minimize" button on top of the chat button (left bottom corner). This button appears whenever the user hovers the chat button.
179
+ * If clicked, the chat button is hidden.
180
+ * @param options
181
+ */
142
182
  export function useServiceNowEffect(options) {
143
183
  useEffectOnce(() => {
144
184
  initializeChat(options);
@@ -1 +1 @@
1
- {"version":3,"file":"service-now.js","sourceRoot":"","sources":["../../src/hooks/service-now.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,WAAW,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACjF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,gBAAgB,GAAG;;;;;;;;;;;;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D,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,+BAA+B;QAC5C,aAAa,EAAE,+FAA+F;KAC/G;IACD,EAAE,EAAE;QACF,eAAe,EAAE,uCAAuC;QACxD,IAAI,EAAE,0BAA0B;QAChC,WAAW,EAAE,+BAA+B;QAC5C,aAAa,EAAE,0GAA0G;KAC1H;CACmB,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Checks if the text fits completely in the space available.
3
+ * @returns true if it fits, false otherwise.
4
+ */
5
+ export declare function useCheckTextOverflow(): {
6
+ overflow: boolean;
7
+ ref: import("react").RefObject<HTMLParagraphElement>;
8
+ };
9
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/hooks/text.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,oBAAoB;;;EAuBnC"}
@@ -0,0 +1,24 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ /**
3
+ * Checks if the text fits completely in the space available.
4
+ * @returns true if it fits, false otherwise.
5
+ */
6
+ export function useCheckTextOverflow() {
7
+ const [overflow, setOverflow] = useState(false);
8
+ const ref = useRef(null);
9
+ const checkOverflow = () => {
10
+ if (!ref.current) {
11
+ return;
12
+ }
13
+ const hasOverflow = ref.current.offsetWidth < ref.current.scrollWidth;
14
+ if (hasOverflow === overflow) {
15
+ return;
16
+ }
17
+ setOverflow(hasOverflow);
18
+ };
19
+ useEffect(() => {
20
+ checkOverflow();
21
+ }, [ref.current]);
22
+ return { overflow, ref };
23
+ }
24
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/hooks/text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAA;IACxD,MAAM,GAAG,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAA;IAE9C,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,OAAM;QACR,CAAC;QAED,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAA;QAErE,IAAI,WAAW,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAM;QACR,CAAC;QAED,WAAW,CAAC,WAAW,CAAC,CAAA;IAC1B,CAAC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,EAAE,CAAA;IACjB,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAEjB,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAA;AAC1B,CAAC"}
@@ -1,3 +1,16 @@
1
+ /**
2
+ * A React effect for prefixing the page title with the string passed as parameter followed by " - ".
3
+ *
4
+ * This returns a dispose function that changes the title back to its original value.
5
+ * @param title the prefix to add to the page title.
6
+ * @returns a dispose function.
7
+ */
1
8
  export declare function titleEffect(title: string | undefined | null): () => void;
9
+ /**
10
+ * Changes the page title to have the string passed as parameter as a prefix followed by " - " and the original title.
11
+ *
12
+ * Once disposed, this hook changes the title back to its original value.
13
+ * @param title the prefix to add to the page title.
14
+ */
2
15
  export declare function useTitleEffect(title: string | undefined | null): void;
3
16
  //# sourceMappingURL=title.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../src/hooks/title.tsx"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,cAM3D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,QAE9D"}
1
+ {"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../src/hooks/title.tsx"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,cAM3D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,QAE9D"}
@@ -1,5 +1,12 @@
1
1
  import { useEffect } from 'react';
2
2
  let originalTitle;
3
+ /**
4
+ * A React effect for prefixing the page title with the string passed as parameter followed by " - ".
5
+ *
6
+ * This returns a dispose function that changes the title back to its original value.
7
+ * @param title the prefix to add to the page title.
8
+ * @returns a dispose function.
9
+ */
3
10
  export function titleEffect(title) {
4
11
  originalTitle ??= document.title;
5
12
  document.title = title ? `${title} - ${originalTitle}` : originalTitle;
@@ -7,6 +14,12 @@ export function titleEffect(title) {
7
14
  document.title = originalTitle ?? '';
8
15
  };
9
16
  }
17
+ /**
18
+ * Changes the page title to have the string passed as parameter as a prefix followed by " - " and the original title.
19
+ *
20
+ * Once disposed, this hook changes the title back to its original value.
21
+ * @param title the prefix to add to the page title.
22
+ */
10
23
  export function useTitleEffect(title) {
11
24
  useEffect(() => titleEffect(title), [title]);
12
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"title.js","sourceRoot":"","sources":["../../src/hooks/title.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,IAAI,aAAiC,CAAA;AAErC,MAAM,UAAU,WAAW,CAAC,KAAgC;IAC1D,aAAa,KAAK,QAAQ,CAAC,KAAK,CAAA;IAChC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,aAAa,EAAE,CAAC,CAAC,CAAC,aAAa,CAAA;IACtE,OAAO,GAAG,EAAE;QACV,QAAQ,CAAC,KAAK,GAAG,aAAa,IAAI,EAAE,CAAA;IACtC,CAAC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAgC;IAC7D,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AAC9C,CAAC"}
1
+ {"version":3,"file":"title.js","sourceRoot":"","sources":["../../src/hooks/title.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,IAAI,aAAiC,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgC;IAC1D,aAAa,KAAK,QAAQ,CAAC,KAAK,CAAA;IAChC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,aAAa,EAAE,CAAC,CAAC,CAAC,aAAa,CAAA;IACtE,OAAO,GAAG,EAAE;QACV,QAAQ,CAAC,KAAK,GAAG,aAAa,IAAI,EAAE,CAAA;IACtC,CAAC,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAgC;IAC7D,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AAC9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-effect-once.d.ts","sourceRoot":"","sources":["../../src/hooks/use-effect-once.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,SA8B9D,CAAA"}
1
+ {"version":3,"file":"use-effect-once.d.ts","sourceRoot":"","sources":["../../src/hooks/use-effect-once.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,SA8B9D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-effect-once.js","sourceRoot":"","sources":["../../src/hooks/use-effect-once.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAiC,EAAE,EAAE;IACjE,MAAM,QAAQ,GAAG,MAAM,CAA4B,MAAM,CAAC,CAAA;IAC1D,MAAM,SAAS,GAAG,MAAM,EAAuB,CAAA;IAC/C,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAA;IAEtC,IAAI,YAAY,CAAC,OAAO,EAAE;QACxB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAA;KACxB;IAED,SAAS,CAAC,GAAG,EAAE;QACb,4CAA4C;QAC5C,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACzB,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAA;YACtC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;SAC5B;QAED,iDAAiD;QACjD,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;QAExB,OAAO,GAAG,EAAE;YACV,4DAA4D;YAC5D,qCAAqC;YACrC,IAAI,CAAC,QAAQ,CAAC,OAAO;gBAAE,OAAM;YAE7B,kEAAkE;YAClE,IAAI,SAAS,CAAC,OAAO;gBAAE,SAAS,CAAC,OAAO,EAAE,CAAA;QAC5C,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC,CAAA"}
1
+ {"version":3,"file":"use-effect-once.js","sourceRoot":"","sources":["../../src/hooks/use-effect-once.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAiC,EAAE,EAAE;IACjE,MAAM,QAAQ,GAAG,MAAM,CAA4B,MAAM,CAAC,CAAA;IAC1D,MAAM,SAAS,GAAG,MAAM,EAAuB,CAAA;IAC/C,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAA;IAEtC,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QACzB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAA;IACzB,CAAC;IAED,SAAS,CAAC,GAAG,EAAE;QACb,4CAA4C;QAC5C,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1B,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAA;YACtC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;QAC7B,CAAC;QAED,iDAAiD;QACjD,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;QAExB,OAAO,GAAG,EAAE;YACV,4DAA4D;YAC5D,qCAAqC;YACrC,IAAI,CAAC,QAAQ,CAAC,OAAO;gBAAE,OAAM;YAE7B,kEAAkE;YAClE,IAAI,SAAS,CAAC,OAAO;gBAAE,SAAS,CAAC,OAAO,EAAE,CAAA;QAC5C,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,19 @@
1
+ export { AsyncContent } from './components/AsyncContent.js';
1
2
  export { BannerWarning } from './components/BannerWarning.js';
2
- export { BreadcrumbList } from './components/Breadcrumb/index.js';
3
+ export { ButtonLoading } from './components/ButtonLoading.js';
3
4
  export { ChatBot } from './components/ChatBot.js';
4
- export { Login } from './components/Login.js';
5
- export * from './components/tour/index.js';
6
- export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect, } from './hooks/service-now.js';
5
+ export { InfoMaintenanceBanner } from './components/InfoMaintenanceBanner.js';
6
+ export * from './components/Select/index.js';
7
+ export * from './components/Select/types.js';
8
+ export { useDateFormatter } from './hooks/date.js';
9
+ export { useKeyboardControls } from './hooks/keyboard.js';
10
+ export { useManualRender } from './hooks/manual-render.js';
11
+ export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect } from './hooks/service-now.js';
12
+ export { useCheckTextOverflow } from './hooks/text.js';
7
13
  export { titleEffect, useTitleEffect } from './hooks/title.js';
8
14
  export { useEffectOnce } from './hooks/use-effect-once.js';
15
+ export * from './utils/accessibility.js';
16
+ export * from './utils/cookie.js';
17
+ export { delay } from './utils/promise.js';
18
+ export { readFile } from './utils/read-file.js';
9
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,OAAO,EACL,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,GAC/G,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA"}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