@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.
- package/CHANGELOG.md +670 -0
- package/dist/components/AnimatedHeight.d.ts +58 -0
- package/dist/components/AnimatedHeight.d.ts.map +1 -0
- package/dist/components/AnimatedHeight.js +105 -0
- package/dist/components/AnimatedHeight.js.map +1 -0
- package/dist/components/AsyncContent.d.ts +46 -0
- package/dist/components/AsyncContent.d.ts.map +1 -0
- package/dist/components/AsyncContent.js +34 -0
- package/dist/components/AsyncContent.js.map +1 -0
- package/dist/components/BannerWarning.d.ts +11 -2
- package/dist/components/BannerWarning.d.ts.map +1 -1
- package/dist/components/BannerWarning.js +45 -3
- package/dist/components/BannerWarning.js.map +1 -1
- package/dist/components/Breadcrumb/index.d.ts +10 -2
- package/dist/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/components/Breadcrumb/index.js +7 -5
- package/dist/components/Breadcrumb/index.js.map +1 -1
- package/dist/components/Breadcrumb/styled.d.ts +1 -2
- package/dist/components/Breadcrumb/styled.d.ts.map +1 -1
- package/dist/components/Breadcrumb/styled.js +1 -0
- package/dist/components/Breadcrumb/styled.js.map +1 -1
- package/dist/components/ButtonLoading.d.ts +11 -0
- package/dist/components/ButtonLoading.d.ts.map +1 -0
- package/dist/components/ButtonLoading.js +5 -0
- package/dist/components/ButtonLoading.js.map +1 -0
- package/dist/components/ChatBot.d.ts +5 -0
- package/dist/components/ChatBot.d.ts.map +1 -1
- package/dist/components/ChatBot.js +11 -6
- package/dist/components/ChatBot.js.map +1 -1
- package/dist/components/ContentValidateFilter.d.ts +6 -0
- package/dist/components/ContentValidateFilter.d.ts.map +1 -0
- package/dist/components/ContentValidateFilter.js +8 -0
- package/dist/components/ContentValidateFilter.js.map +1 -0
- package/dist/components/FadingOverflow.d.ts +37 -0
- package/dist/components/FadingOverflow.d.ts.map +1 -0
- package/dist/components/FadingOverflow.js +228 -0
- package/dist/components/FadingOverflow.js.map +1 -0
- package/dist/components/FileTreeView/More.d.ts +23 -0
- package/dist/components/FileTreeView/More.d.ts.map +1 -0
- package/dist/components/FileTreeView/More.js +55 -0
- package/dist/components/FileTreeView/More.js.map +1 -0
- package/dist/components/FileTreeView/index.d.ts +32 -0
- package/dist/components/FileTreeView/index.d.ts.map +1 -0
- package/dist/components/FileTreeView/index.js +91 -0
- package/dist/components/FileTreeView/index.js.map +1 -0
- package/dist/components/InfiniteScroll.d.ts +11 -0
- package/dist/components/InfiniteScroll.d.ts.map +1 -0
- package/dist/components/InfiniteScroll.js +14 -0
- package/dist/components/InfiniteScroll.js.map +1 -0
- package/dist/components/InfoMaintenanceBanner.d.ts +8 -0
- package/dist/components/InfoMaintenanceBanner.d.ts.map +1 -0
- package/dist/components/InfoMaintenanceBanner.js +19 -0
- package/dist/components/InfoMaintenanceBanner.js.map +1 -0
- package/dist/components/LazyMarkdown/BlockquoteMd.d.ts +11 -0
- package/dist/components/LazyMarkdown/BlockquoteMd.d.ts.map +1 -0
- package/dist/components/LazyMarkdown/BlockquoteMd.js +77 -0
- package/dist/components/LazyMarkdown/BlockquoteMd.js.map +1 -0
- package/dist/components/LazyMarkdown/CodeViewer.d.ts +24 -0
- package/dist/components/LazyMarkdown/CodeViewer.d.ts.map +1 -0
- package/dist/components/LazyMarkdown/CodeViewer.js +122 -0
- package/dist/components/LazyMarkdown/CodeViewer.js.map +1 -0
- package/dist/components/LazyMarkdown/Markdown.d.ts +19 -0
- package/dist/components/LazyMarkdown/Markdown.d.ts.map +1 -0
- package/dist/components/LazyMarkdown/Markdown.js +96 -0
- package/dist/components/LazyMarkdown/Markdown.js.map +1 -0
- package/dist/components/LazyMarkdown/MarkdownButton.d.ts +19 -0
- package/dist/components/LazyMarkdown/MarkdownButton.d.ts.map +1 -0
- package/dist/components/LazyMarkdown/MarkdownButton.js +9 -0
- package/dist/components/LazyMarkdown/MarkdownButton.js.map +1 -0
- package/dist/components/LazyMarkdown/Video.d.ts +11 -0
- package/dist/components/LazyMarkdown/Video.d.ts.map +1 -0
- package/dist/components/LazyMarkdown/Video.js +10 -0
- package/dist/components/LazyMarkdown/Video.js.map +1 -0
- package/dist/components/LazyMarkdown/index.d.ts +10 -0
- package/dist/components/LazyMarkdown/index.d.ts.map +1 -0
- package/dist/components/LazyMarkdown/index.js +8 -0
- package/dist/components/LazyMarkdown/index.js.map +1 -0
- package/dist/components/Placeholder.d.ts +28 -0
- package/dist/components/Placeholder.d.ts.map +1 -0
- package/dist/components/Placeholder.js +32 -0
- package/dist/components/Placeholder.js.map +1 -0
- package/dist/components/ScrollView.d.ts +31 -0
- package/dist/components/ScrollView.d.ts.map +1 -0
- package/dist/components/ScrollView.js +30 -0
- package/dist/components/ScrollView.js.map +1 -0
- package/dist/components/Select/BadgeItem.d.ts +4 -0
- package/dist/components/Select/BadgeItem.d.ts.map +1 -0
- package/dist/components/Select/BadgeItem.js +28 -0
- package/dist/components/Select/BadgeItem.js.map +1 -0
- package/dist/components/Select/ClearInput.d.ts +3 -0
- package/dist/components/Select/ClearInput.d.ts.map +1 -0
- package/dist/components/Select/ClearInput.js +18 -0
- package/dist/components/Select/ClearInput.js.map +1 -0
- package/dist/components/Select/CloseItem.d.ts +3 -0
- package/dist/components/Select/CloseItem.d.ts.map +1 -0
- package/dist/components/Select/CloseItem.js +26 -0
- package/dist/components/Select/CloseItem.js.map +1 -0
- package/dist/components/Select/CreatableSelect.d.ts +16 -0
- package/dist/components/Select/CreatableSelect.d.ts.map +1 -0
- package/dist/components/Select/CreatableSelect.js +114 -0
- package/dist/components/Select/CreatableSelect.js.map +1 -0
- package/dist/components/Select/CustomMenu.d.ts +8 -0
- package/dist/components/Select/CustomMenu.d.ts.map +1 -0
- package/dist/components/Select/CustomMenu.js +4 -0
- package/dist/components/Select/CustomMenu.js.map +1 -0
- package/dist/components/Select/LabelItem.d.ts +3 -0
- package/dist/components/Select/LabelItem.d.ts.map +1 -0
- package/dist/components/Select/LabelItem.js +4 -0
- package/dist/components/Select/LabelItem.js.map +1 -0
- package/dist/components/Select/MultiValue.d.ts +3 -0
- package/dist/components/Select/MultiValue.d.ts.map +1 -0
- package/dist/components/Select/MultiValue.js +27 -0
- package/dist/components/Select/MultiValue.js.map +1 -0
- package/dist/components/Select/SelectInfiniteScroll.d.ts +14 -0
- package/dist/components/Select/SelectInfiniteScroll.d.ts.map +1 -0
- package/dist/components/Select/SelectInfiniteScroll.js +31 -0
- package/dist/components/Select/SelectInfiniteScroll.js.map +1 -0
- package/dist/components/Select/SelectSearch.d.ts +11 -0
- package/dist/components/Select/SelectSearch.d.ts.map +1 -0
- package/dist/components/Select/SelectSearch.js +156 -0
- package/dist/components/Select/SelectSearch.js.map +1 -0
- package/dist/components/Select/index.d.ts +6 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Select/index.js +6 -0
- package/dist/components/Select/index.js.map +1 -0
- package/dist/components/Select/types.d.ts +7 -0
- package/dist/components/Select/types.d.ts.map +1 -0
- package/dist/components/Select/types.js +2 -0
- package/dist/components/Select/types.js.map +1 -0
- package/dist/components/SelectionList.d.ts +151 -0
- package/dist/components/SelectionList.d.ts.map +1 -0
- package/dist/components/SelectionList.js +180 -0
- package/dist/components/SelectionList.js.map +1 -0
- package/dist/components/StatusCircle.d.ts +24 -0
- package/dist/components/StatusCircle.d.ts.map +1 -0
- package/dist/components/StatusCircle.js +44 -0
- package/dist/components/StatusCircle.js.map +1 -0
- package/dist/components/Stepper/Navigation.d.ts +35 -0
- package/dist/components/Stepper/Navigation.d.ts.map +1 -0
- package/dist/components/Stepper/Navigation.js +41 -0
- package/dist/components/Stepper/Navigation.js.map +1 -0
- package/dist/components/Stepper/Step.d.ts +18 -0
- package/dist/components/Stepper/Step.d.ts.map +1 -0
- package/dist/components/Stepper/Step.js +13 -0
- package/dist/components/Stepper/Step.js.map +1 -0
- package/dist/components/Stepper/Stepper.d.ts +45 -0
- package/dist/components/Stepper/Stepper.d.ts.map +1 -0
- package/dist/components/Stepper/Stepper.js +57 -0
- package/dist/components/Stepper/Stepper.js.map +1 -0
- package/dist/components/Stepper/headers.d.ts +19 -0
- package/dist/components/Stepper/headers.d.ts.map +1 -0
- package/dist/components/Stepper/headers.js +40 -0
- package/dist/components/Stepper/headers.js.map +1 -0
- package/dist/components/Stepper/index.d.ts +4 -0
- package/dist/components/Stepper/index.d.ts.map +1 -0
- package/dist/components/Stepper/index.js +4 -0
- package/dist/components/Stepper/index.js.map +1 -0
- package/dist/components/Table/HeaderItem.d.ts +18 -0
- package/dist/components/Table/HeaderItem.d.ts.map +1 -0
- package/dist/components/Table/HeaderItem.js +14 -0
- package/dist/components/Table/HeaderItem.js.map +1 -0
- package/dist/components/Table/SettingsVerticalMenu.d.ts +14 -0
- package/dist/components/Table/SettingsVerticalMenu.d.ts.map +1 -0
- package/dist/components/Table/SettingsVerticalMenu.js +14 -0
- package/dist/components/Table/SettingsVerticalMenu.js.map +1 -0
- package/dist/components/Table/StyledLinkTable.d.ts +5 -0
- package/dist/components/Table/StyledLinkTable.d.ts.map +1 -0
- package/dist/components/Table/StyledLinkTable.js +13 -0
- package/dist/components/Table/StyledLinkTable.js.map +1 -0
- package/dist/components/Table/TableData.d.ts +37 -0
- package/dist/components/Table/TableData.d.ts.map +1 -0
- package/dist/components/Table/TableData.js +84 -0
- package/dist/components/Table/TableData.js.map +1 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Table/index.d.ts.map +1 -0
- package/dist/components/Table/index.js +3 -0
- package/dist/components/Table/index.js.map +1 -0
- package/dist/components/TimelineSection.d.ts +24 -0
- package/dist/components/TimelineSection.d.ts.map +1 -0
- package/dist/components/TimelineSection.js +37 -0
- package/dist/components/TimelineSection.js.map +1 -0
- package/dist/components/error/ErrorFeedback.d.ts +58 -0
- package/dist/components/error/ErrorFeedback.d.ts.map +1 -0
- package/dist/components/error/ErrorFeedback.js +110 -0
- package/dist/components/error/ErrorFeedback.js.map +1 -0
- package/dist/components/error/NotFound.d.ts +4 -0
- package/dist/components/error/NotFound.d.ts.map +1 -0
- package/dist/components/error/NotFound.js +19 -0
- package/dist/components/error/NotFound.js.map +1 -0
- package/dist/components/error/UnderMaintenance.d.ts +4 -0
- package/dist/components/error/UnderMaintenance.d.ts.map +1 -0
- package/dist/components/error/UnderMaintenance.js +25 -0
- package/dist/components/error/UnderMaintenance.js.map +1 -0
- package/dist/components/error/index.d.ts +4 -0
- package/dist/components/error/index.d.ts.map +1 -0
- package/dist/components/error/index.js +4 -0
- package/dist/components/error/index.js.map +1 -0
- package/dist/components/form/Form/Form.d.ts +15 -0
- package/dist/components/form/Form/Form.d.ts.map +1 -0
- package/dist/components/form/Form/Form.js +48 -0
- package/dist/components/form/Form/Form.js.map +1 -0
- package/dist/components/form/Form/FormGroup.d.ts +37 -0
- package/dist/components/form/Form/FormGroup.d.ts.map +1 -0
- package/dist/components/form/Form/FormGroup.js +72 -0
- package/dist/components/form/Form/FormGroup.js.map +1 -0
- package/dist/components/form/Form/index.d.ts +3 -0
- package/dist/components/form/Form/index.d.ts.map +1 -0
- package/dist/components/form/Form/index.js +3 -0
- package/dist/components/form/Form/index.js.map +1 -0
- package/dist/components/form/SearchInput.d.ts +9 -0
- package/dist/components/form/SearchInput.d.ts.map +1 -0
- package/dist/components/form/SearchInput.js +28 -0
- package/dist/components/form/SearchInput.js.map +1 -0
- package/dist/components/form/Select/CustomSelect.d.ts +81 -0
- package/dist/components/form/Select/CustomSelect.d.ts.map +1 -0
- package/dist/components/form/Select/CustomSelect.js +178 -0
- package/dist/components/form/Select/CustomSelect.js.map +1 -0
- package/dist/components/form/Select/DetailedSelect.d.ts +65 -0
- package/dist/components/form/Select/DetailedSelect.d.ts.map +1 -0
- package/dist/components/form/Select/DetailedSelect.js +80 -0
- package/dist/components/form/Select/DetailedSelect.js.map +1 -0
- package/dist/components/form/Select/Select.d.ts +47 -0
- package/dist/components/form/Select/Select.d.ts.map +1 -0
- package/dist/components/form/Select/Select.js +62 -0
- package/dist/components/form/Select/Select.js.map +1 -0
- package/dist/components/form/Select/index.d.ts +5 -0
- package/dist/components/form/Select/index.d.ts.map +1 -0
- package/dist/components/form/Select/index.js +5 -0
- package/dist/components/form/Select/index.js.map +1 -0
- package/dist/components/form/Select/styled.d.ts +5 -0
- package/dist/components/form/Select/styled.d.ts.map +1 -0
- package/dist/components/form/Select/styled.js +165 -0
- package/dist/components/form/Select/styled.js.map +1 -0
- package/dist/components/form/Select/types.d.ts +103 -0
- package/dist/components/form/Select/types.d.ts.map +1 -0
- package/dist/components/form/Select/types.js +2 -0
- package/dist/components/form/Select/types.js.map +1 -0
- package/dist/components/form/Select/utils.d.ts +3 -0
- package/dist/components/form/Select/utils.d.ts.map +1 -0
- package/dist/components/form/Select/utils.js +20 -0
- package/dist/components/form/Select/utils.js.map +1 -0
- package/dist/components/notification/NotificationComponent.d.ts +31 -0
- package/dist/components/notification/NotificationComponent.d.ts.map +1 -0
- package/dist/components/notification/NotificationComponent.js +176 -0
- package/dist/components/notification/NotificationComponent.js.map +1 -0
- package/dist/components/notification/NotificationItem.d.ts +51 -0
- package/dist/components/notification/NotificationItem.d.ts.map +1 -0
- package/dist/components/notification/NotificationItem.js +165 -0
- package/dist/components/notification/NotificationItem.js.map +1 -0
- package/dist/components/notification/NotificationList.d.ts +47 -0
- package/dist/components/notification/NotificationList.d.ts.map +1 -0
- package/dist/components/notification/NotificationList.js +82 -0
- package/dist/components/notification/NotificationList.js.map +1 -0
- package/dist/components/notification/NotificationPlaceholder.d.ts +13 -0
- package/dist/components/notification/NotificationPlaceholder.d.ts.map +1 -0
- package/dist/components/notification/NotificationPlaceholder.js +34 -0
- package/dist/components/notification/NotificationPlaceholder.js.map +1 -0
- package/dist/components/notification/types.d.ts +60 -0
- package/dist/components/notification/types.d.ts.map +1 -0
- package/dist/components/notification/types.js +7 -0
- package/dist/components/notification/types.js.map +1 -0
- package/dist/containers/NotificationsPage.d.ts +2 -0
- package/dist/containers/NotificationsPage.d.ts.map +1 -0
- package/dist/containers/NotificationsPage.js +71 -0
- package/dist/containers/NotificationsPage.js.map +1 -0
- package/dist/context/anchor.d.ts +27 -0
- package/dist/context/anchor.d.ts.map +1 -0
- package/dist/context/anchor.js +23 -0
- package/dist/context/anchor.js.map +1 -0
- package/dist/context/loading.d.ts +27 -0
- package/dist/context/loading.d.ts.map +1 -0
- package/dist/context/loading.js +24 -0
- package/dist/context/loading.js.map +1 -0
- package/dist/context/notification/LazyNotificationList.d.ts +28 -0
- package/dist/context/notification/LazyNotificationList.d.ts.map +1 -0
- package/dist/context/notification/LazyNotificationList.js +136 -0
- package/dist/context/notification/LazyNotificationList.js.map +1 -0
- package/dist/context/notification/NotificationController.d.ts +25 -0
- package/dist/context/notification/NotificationController.d.ts.map +1 -0
- package/dist/context/notification/NotificationController.js +153 -0
- package/dist/context/notification/NotificationController.js.map +1 -0
- package/dist/context/notification/context.d.ts +8 -0
- package/dist/context/notification/context.d.ts.map +1 -0
- package/dist/context/notification/context.js +12 -0
- package/dist/context/notification/context.js.map +1 -0
- package/dist/context/notification/hooks.d.ts +18 -0
- package/dist/context/notification/hooks.d.ts.map +1 -0
- package/dist/context/notification/hooks.js +92 -0
- package/dist/context/notification/hooks.js.map +1 -0
- package/dist/context/notification/types.d.ts +65 -0
- package/dist/context/notification/types.d.ts.map +1 -0
- package/dist/context/notification/types.js +2 -0
- package/dist/context/notification/types.js.map +1 -0
- package/dist/hooks/date.d.ts +18 -0
- package/dist/hooks/date.d.ts.map +1 -0
- package/dist/hooks/date.js +68 -0
- package/dist/hooks/date.js.map +1 -0
- package/dist/hooks/keyboard.d.ts +64 -0
- package/dist/hooks/keyboard.d.ts.map +1 -0
- package/dist/hooks/keyboard.js +84 -0
- package/dist/hooks/keyboard.js.map +1 -0
- package/dist/hooks/manual-render.d.ts +8 -0
- package/dist/hooks/manual-render.d.ts.map +1 -0
- package/dist/hooks/manual-render.js +10 -0
- package/dist/hooks/manual-render.js.map +1 -0
- package/dist/hooks/service-now.d.ts +32 -1
- package/dist/hooks/service-now.d.ts.map +1 -1
- package/dist/hooks/service-now.js +58 -18
- package/dist/hooks/service-now.js.map +1 -1
- package/dist/hooks/text.d.ts +9 -0
- package/dist/hooks/text.d.ts.map +1 -0
- package/dist/hooks/text.js +24 -0
- package/dist/hooks/text.js.map +1 -0
- package/dist/hooks/title.d.ts +13 -0
- package/dist/hooks/title.d.ts.map +1 -1
- package/dist/hooks/title.js +13 -0
- package/dist/hooks/title.js.map +1 -1
- package/dist/hooks/use-effect-once.d.ts.map +1 -1
- package/dist/hooks/use-effect-once.js.map +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/notifications.d.ts +11 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +10 -0
- package/dist/notifications.js.map +1 -0
- package/dist/svg/AI.d.ts +8 -0
- package/dist/svg/AI.d.ts.map +1 -0
- package/dist/svg/AI.js +15 -0
- package/dist/svg/AI.js.map +1 -0
- package/dist/svg/CS.d.ts +8 -0
- package/dist/svg/CS.d.ts.map +1 -0
- package/dist/svg/CS.js +15 -0
- package/dist/svg/CS.js.map +1 -0
- package/dist/svg/EDP.d.ts +8 -0
- package/dist/svg/EDP.d.ts.map +1 -0
- package/dist/svg/EDP.js +15 -0
- package/dist/svg/EDP.js.map +1 -0
- package/dist/svg/Forbidden.d.ts +5 -0
- package/dist/svg/Forbidden.d.ts.map +1 -0
- package/dist/svg/Forbidden.js +4 -0
- package/dist/svg/Forbidden.js.map +1 -0
- package/dist/svg/GenericPlaceholder.d.ts +7 -0
- package/dist/svg/GenericPlaceholder.d.ts.map +1 -0
- package/dist/svg/GenericPlaceholder.js +4 -0
- package/dist/svg/GenericPlaceholder.js.map +1 -0
- package/dist/svg/HUB.d.ts +8 -0
- package/dist/svg/HUB.d.ts.map +1 -0
- package/dist/svg/HUB.js +15 -0
- package/dist/svg/HUB.js.map +1 -0
- package/dist/svg/Logo.d.ts +5 -0
- package/dist/svg/Logo.d.ts.map +1 -0
- package/dist/svg/Logo.js +8 -0
- package/dist/svg/Logo.js.map +1 -0
- package/dist/svg/MiniLogo.d.ts +8 -0
- package/dist/svg/MiniLogo.d.ts.map +1 -0
- package/dist/svg/MiniLogo.js +6 -0
- package/dist/svg/MiniLogo.js.map +1 -0
- package/dist/svg/NotFound.d.ts +5 -0
- package/dist/svg/NotFound.d.ts.map +1 -0
- package/dist/svg/NotFound.js +4 -0
- package/dist/svg/NotFound.js.map +1 -0
- package/dist/svg/ServerError.d.ts +5 -0
- package/dist/svg/ServerError.d.ts.map +1 -0
- package/dist/svg/ServerError.js +4 -0
- package/dist/svg/ServerError.js.map +1 -0
- package/dist/svg/Unauthenticated.d.ts +5 -0
- package/dist/svg/Unauthenticated.d.ts.map +1 -0
- package/dist/svg/Unauthenticated.js +4 -0
- package/dist/svg/Unauthenticated.js.map +1 -0
- package/dist/svg/index.d.ts +12 -0
- package/dist/svg/index.d.ts.map +1 -0
- package/dist/svg/index.js +12 -0
- package/dist/svg/index.js.map +1 -0
- package/dist/utils/accessibility.d.ts +75 -0
- package/dist/utils/accessibility.d.ts.map +1 -0
- package/dist/utils/accessibility.js +123 -0
- package/dist/utils/accessibility.js.map +1 -0
- package/dist/utils/cookie.d.ts +34 -0
- package/dist/utils/cookie.d.ts.map +1 -0
- package/dist/utils/cookie.js +69 -0
- package/dist/utils/cookie.js.map +1 -0
- package/dist/utils/promise.d.ts +2 -0
- package/dist/utils/promise.d.ts.map +1 -0
- package/dist/utils/promise.js +6 -0
- package/dist/utils/promise.js.map +1 -0
- package/dist/utils/read-file.d.ts +2 -0
- package/dist/utils/read-file.d.ts.map +1 -0
- package/dist/utils/read-file.js +14 -0
- package/dist/utils/read-file.js.map +1 -0
- package/package.dev.json +3 -0
- package/package.json +53 -14
- package/package.stg.json +3 -0
- package/readme.md +55 -13
- package/src/components/AnimatedHeight.tsx +174 -0
- package/src/components/AsyncContent.tsx +78 -0
- package/src/components/BannerWarning.tsx +89 -19
- package/src/components/Breadcrumb/index.tsx +20 -5
- package/src/components/Breadcrumb/styled.ts +2 -1
- package/src/components/ButtonLoading.tsx +29 -0
- package/src/components/ChatBot.tsx +12 -7
- package/src/components/ContentValidateFilter.tsx +15 -0
- package/src/components/FadingOverflow.tsx +265 -0
- package/src/components/FileTreeView/More.tsx +114 -0
- package/src/components/FileTreeView/index.tsx +186 -0
- package/src/components/InfiniteScroll.tsx +24 -0
- package/src/components/InfoMaintenanceBanner.tsx +25 -0
- package/src/components/LazyMarkdown/BlockquoteMd.tsx +107 -0
- package/src/components/LazyMarkdown/CodeViewer.tsx +161 -0
- package/src/components/LazyMarkdown/Markdown.tsx +122 -0
- package/src/components/LazyMarkdown/MarkdownButton.tsx +24 -0
- package/src/components/LazyMarkdown/Video.tsx +13 -0
- package/src/components/LazyMarkdown/index.tsx +21 -0
- package/src/components/Placeholder.tsx +124 -0
- package/src/components/ScrollView.tsx +57 -0
- package/src/components/Select/BadgeItem.tsx +58 -0
- package/src/components/Select/ClearInput.tsx +24 -0
- package/src/components/Select/CloseItem.tsx +38 -0
- package/src/components/Select/CreatableSelect.tsx +155 -0
- package/src/components/Select/CustomMenu.tsx +16 -0
- package/src/components/Select/LabelItem.tsx +8 -0
- package/src/components/Select/MultiValue.tsx +49 -0
- package/src/components/Select/SelectInfiniteScroll.tsx +82 -0
- package/src/components/Select/SelectSearch.tsx +195 -0
- package/src/components/Select/index.tsx +7 -0
- package/src/components/Select/types.ts +8 -0
- package/src/components/SelectionList.tsx +427 -0
- package/src/components/StatusCircle.tsx +67 -0
- package/src/components/Stepper/Navigation.tsx +97 -0
- package/src/components/Stepper/Step.tsx +30 -0
- package/src/components/Stepper/Stepper.tsx +113 -0
- package/src/components/Stepper/headers.tsx +64 -0
- package/src/components/Stepper/index.ts +3 -0
- package/src/components/Table/HeaderItem.tsx +52 -0
- package/src/components/Table/SettingsVerticalMenu.tsx +50 -0
- package/src/components/Table/StyledLinkTable.tsx +22 -0
- package/src/components/Table/TableData.tsx +251 -0
- package/src/components/Table/index.tsx +2 -0
- package/src/components/TimelineSection.tsx +66 -0
- package/src/components/error/ErrorFeedback.tsx +217 -0
- package/src/components/error/NotFound.tsx +24 -0
- package/src/components/error/UnderMaintenance.tsx +30 -0
- package/src/components/error/index.ts +4 -0
- package/src/components/form/Form/Form.tsx +101 -0
- package/src/components/form/Form/FormGroup.tsx +221 -0
- package/src/components/form/Form/index.ts +2 -0
- package/src/components/form/SearchInput.tsx +69 -0
- package/src/components/form/Select/CustomSelect.tsx +232 -0
- package/src/components/form/Select/DetailedSelect.tsx +85 -0
- package/src/components/form/Select/Select.tsx +67 -0
- package/src/components/form/Select/index.ts +4 -0
- package/src/components/form/Select/styled.ts +165 -0
- package/src/components/form/Select/types.ts +112 -0
- package/src/components/form/Select/utils.tsx +28 -0
- package/src/components/notification/NotificationComponent.tsx +340 -0
- package/src/components/notification/NotificationItem.tsx +353 -0
- package/src/components/notification/NotificationList.tsx +185 -0
- package/src/components/notification/NotificationPlaceholder.tsx +60 -0
- package/src/components/notification/types.ts +72 -0
- package/src/containers/NotificationsPage.tsx +120 -0
- package/src/context/anchor.tsx +37 -0
- package/src/context/loading.tsx +36 -0
- package/src/context/notification/LazyNotificationList.ts +103 -0
- package/src/context/notification/NotificationController.ts +119 -0
- package/src/context/notification/context.tsx +23 -0
- package/src/context/notification/hooks.ts +98 -0
- package/src/context/notification/types.ts +71 -0
- package/src/hooks/date.ts +68 -0
- package/src/hooks/keyboard.tsx +128 -0
- package/src/hooks/manual-render.tsx +10 -0
- package/src/hooks/service-now.tsx +64 -19
- package/src/hooks/text.tsx +30 -0
- package/src/hooks/title.tsx +13 -0
- package/src/index.ts +14 -6
- package/src/notifications.ts +11 -0
- package/src/svg/AI.tsx +41 -0
- package/src/svg/CS.tsx +48 -0
- package/src/svg/EDP.tsx +31 -0
- package/src/svg/Forbidden.tsx +22 -0
- package/src/svg/GenericPlaceholder.tsx +16 -0
- package/src/svg/HUB.tsx +48 -0
- package/src/svg/Logo.tsx +16 -0
- package/src/svg/MiniLogo.tsx +12 -0
- package/src/svg/NotFound.tsx +16 -0
- package/src/svg/ServerError.tsx +33 -0
- package/src/svg/Unauthenticated.tsx +16 -0
- package/src/svg/index.ts +11 -0
- package/src/utils/accessibility.ts +135 -0
- package/src/utils/cookie.ts +73 -0
- package/src/utils/promise.ts +5 -0
- package/src/utils/read-file.ts +16 -0
- package/tsconfig.json +1 -0
- package/dist/BannerWarning.d.ts +0 -4
- package/dist/BannerWarning.d.ts.map +0 -1
- package/dist/BannerWarning.js +0 -6
- package/dist/BannerWarning.js.map +0 -1
- package/dist/Login.d.ts +0 -25
- package/dist/Login.d.ts.map +0 -1
- package/dist/Login.js +0 -104
- package/dist/Login.js.map +0 -1
- package/dist/MiniLogo.d.ts +0 -6
- package/dist/MiniLogo.d.ts.map +0 -1
- package/dist/MiniLogo.js +0 -4
- package/dist/MiniLogo.js.map +0 -1
- package/dist/components/Login.d.ts +0 -26
- package/dist/components/Login.d.ts.map +0 -1
- package/dist/components/Login.js +0 -100
- package/dist/components/Login.js.map +0 -1
- package/dist/components/MiniLogo.d.ts +0 -6
- package/dist/components/MiniLogo.d.ts.map +0 -1
- package/dist/components/MiniLogo.js +0 -4
- package/dist/components/MiniLogo.js.map +0 -1
- package/dist/components/src/components/BannerWarning.d.ts +0 -4
- package/dist/components/src/components/BannerWarning.d.ts.map +0 -1
- package/dist/components/src/components/BannerWarning.js +0 -6
- package/dist/components/src/components/BannerWarning.js.map +0 -1
- package/dist/components/src/components/Breadcrumb/index.d.ts +0 -42
- package/dist/components/src/components/Breadcrumb/index.d.ts.map +0 -1
- package/dist/components/src/components/Breadcrumb/index.js +0 -27
- package/dist/components/src/components/Breadcrumb/index.js.map +0 -1
- package/dist/components/src/components/Breadcrumb/styled.d.ts +0 -3
- package/dist/components/src/components/Breadcrumb/styled.d.ts.map +0 -1
- package/dist/components/src/components/Breadcrumb/styled.js +0 -36
- package/dist/components/src/components/Breadcrumb/styled.js.map +0 -1
- package/dist/components/src/components/ChatBot.d.ts +0 -2
- package/dist/components/src/components/ChatBot.d.ts.map +0 -1
- package/dist/components/src/components/ChatBot.js +0 -61
- package/dist/components/src/components/ChatBot.js.map +0 -1
- package/dist/components/src/components/Login.d.ts +0 -26
- package/dist/components/src/components/Login.d.ts.map +0 -1
- package/dist/components/src/components/Login.js +0 -100
- package/dist/components/src/components/Login.js.map +0 -1
- package/dist/components/src/components/MiniLogo.d.ts +0 -6
- package/dist/components/src/components/MiniLogo.d.ts.map +0 -1
- package/dist/components/src/components/MiniLogo.js +0 -4
- package/dist/components/src/components/MiniLogo.js.map +0 -1
- package/dist/components/src/components/tour/StepContainer.d.ts +0 -13
- package/dist/components/src/components/tour/StepContainer.d.ts.map +0 -1
- package/dist/components/src/components/tour/StepContainer.js +0 -48
- package/dist/components/src/components/tour/StepContainer.js.map +0 -1
- package/dist/components/src/components/tour/StepNavigation.d.ts +0 -13
- package/dist/components/src/components/tour/StepNavigation.d.ts.map +0 -1
- package/dist/components/src/components/tour/StepNavigation.js +0 -20
- package/dist/components/src/components/tour/StepNavigation.js.map +0 -1
- package/dist/components/src/components/tour/StepTitle.d.ts +0 -7
- package/dist/components/src/components/tour/StepTitle.d.ts.map +0 -1
- package/dist/components/src/components/tour/StepTitle.js +0 -5
- package/dist/components/src/components/tour/StepTitle.js.map +0 -1
- package/dist/components/src/components/tour/context.d.ts +0 -17
- package/dist/components/src/components/tour/context.d.ts.map +0 -1
- package/dist/components/src/components/tour/context.js +0 -48
- package/dist/components/src/components/tour/context.js.map +0 -1
- package/dist/components/src/components/tour/index.d.ts +0 -4
- package/dist/components/src/components/tour/index.d.ts.map +0 -1
- package/dist/components/src/components/tour/index.js +0 -4
- package/dist/components/src/components/tour/index.js.map +0 -1
- package/dist/components/src/components/tour/utils.d.ts +0 -13
- package/dist/components/src/components/tour/utils.d.ts.map +0 -1
- package/dist/components/src/components/tour/utils.js +0 -43
- package/dist/components/src/components/tour/utils.js.map +0 -1
- package/dist/components/src/hooks/service-now.d.ts +0 -24
- package/dist/components/src/hooks/service-now.d.ts.map +0 -1
- package/dist/components/src/hooks/service-now.js +0 -161
- package/dist/components/src/hooks/service-now.js.map +0 -1
- package/dist/components/src/hooks/title.d.ts +0 -3
- package/dist/components/src/hooks/title.d.ts.map +0 -1
- package/dist/components/src/hooks/title.js +0 -13
- package/dist/components/src/hooks/title.js.map +0 -1
- package/dist/components/src/hooks/use-effect-once.d.ts +0 -12
- package/dist/components/src/hooks/use-effect-once.d.ts.map +0 -1
- package/dist/components/src/hooks/use-effect-once.js +0 -40
- package/dist/components/src/hooks/use-effect-once.js.map +0 -1
- package/dist/components/src/index.d.ts +0 -9
- package/dist/components/src/index.d.ts.map +0 -1
- package/dist/components/src/index.js +0 -9
- package/dist/components/src/index.js.map +0 -1
- package/dist/components/tour/StepContainer.d.ts +0 -13
- package/dist/components/tour/StepContainer.d.ts.map +0 -1
- package/dist/components/tour/StepContainer.js +0 -48
- package/dist/components/tour/StepContainer.js.map +0 -1
- package/dist/components/tour/StepNavigation.d.ts +0 -13
- package/dist/components/tour/StepNavigation.d.ts.map +0 -1
- package/dist/components/tour/StepNavigation.js +0 -20
- package/dist/components/tour/StepNavigation.js.map +0 -1
- package/dist/components/tour/StepTitle.d.ts +0 -7
- package/dist/components/tour/StepTitle.d.ts.map +0 -1
- package/dist/components/tour/StepTitle.js +0 -5
- package/dist/components/tour/StepTitle.js.map +0 -1
- package/dist/components/tour/context.d.ts +0 -17
- package/dist/components/tour/context.d.ts.map +0 -1
- package/dist/components/tour/context.js +0 -48
- package/dist/components/tour/context.js.map +0 -1
- package/dist/components/tour/index.d.ts +0 -9
- package/dist/components/tour/index.d.ts.map +0 -1
- package/dist/components/tour/index.js +0 -4
- package/dist/components/tour/index.js.map +0 -1
- package/dist/components/tour/utils.d.ts +0 -13
- package/dist/components/tour/utils.d.ts.map +0 -1
- package/dist/components/tour/utils.js +0 -43
- package/dist/components/tour/utils.js.map +0 -1
- package/dist/layout/src/components/tour/PortalSwitcherStep.d.ts +0 -2
- package/dist/layout/src/components/tour/PortalSwitcherStep.d.ts.map +0 -1
- package/dist/layout/src/components/tour/PortalSwitcherStep.js +0 -30
- package/dist/layout/src/components/tour/PortalSwitcherStep.js.map +0 -1
- package/src/components/Login.tsx +0 -157
- package/src/components/MiniLogo.tsx +0 -32
- package/src/components/tour/StepContainer.tsx +0 -67
- package/src/components/tour/StepNavigation.tsx +0 -32
- package/src/components/tour/StepTitle.tsx +0 -17
- package/src/components/tour/context.tsx +0 -56
- package/src/components/tour/index.ts +0 -7
- 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=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"}
|
|
@@ -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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B,KAAK,CAAC,cAAc,EAAE,CAAA;YACxB,CAAC;YACD,OAAO,EAAE,YAAY;YACrB,SAAS,EAAE,YAAY;YACvB,SAAS,EAAE,gBAAgB;YAC3B,UAAU,EAAE,iBAAiB;SAC9B,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 @@
|
|
|
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
|
-
|
|
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":"
|
|
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(
|
|
43
|
-
iframe.setAttribute('id',
|
|
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(
|
|
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
|
-
|
|
65
|
+
showChatWindow();
|
|
57
66
|
showServiceNowChatButton();
|
|
58
67
|
}
|
|
59
68
|
function getServiceNowButton() {
|
|
60
|
-
return document.getElementById(
|
|
69
|
+
return document.getElementById(CHAT_BUTTON_ID);
|
|
61
70
|
}
|
|
62
71
|
function hideOrShowServiceNowContent(action) {
|
|
63
|
-
const content = document.getElementById(
|
|
72
|
+
const content = document.getElementById(CHAT_BUTTON_WRAPPER_ID);
|
|
64
73
|
if (content) {
|
|
65
74
|
content.style.visibility = action;
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
|
-
|
|
77
|
+
function toggleChatWindow(show) {
|
|
69
78
|
const launcher = getServiceNowLauncher();
|
|
70
|
-
const
|
|
71
|
-
if (launcher)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
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;
|
|
1
|
+
{"version":3,"file":"service-now.js","sourceRoot":"","sources":["../../src/hooks/service-now.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACvF,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,cAAc,GAAG,kBAAkB,CAAA;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAA;AAClD,MAAM,CAAC,MAAM,sBAAsB,GAAG,qBAAqB,CAAA;AAE3D,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;CAmBxB,CAAA;AAED,MAAM,WAAW,GAAG;;;;;;;;;CASnB,CAAA;AAYD,MAAM,aAAa,GAAG,GAAG,CAAA;AACzB,MAAM,+BAA+B,GAAG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;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAiB;IACnD,aAAa,CAAC,GAAG,EAAE;QACjB,cAAc,CAAC,OAAO,CAAC,CAAA;IACzB,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,eAAe,EAAE,6CAA6C;QAC9D,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"}
|
package/dist/hooks/title.d.ts
CHANGED
|
@@ -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"}
|
package/dist/hooks/title.js
CHANGED
|
@@ -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
|
}
|
package/dist/hooks/title.js.map
CHANGED
|
@@ -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,
|
|
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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AAO;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 {
|
|
3
|
+
export { ButtonLoading } from './components/ButtonLoading.js';
|
|
3
4
|
export { ChatBot } from './components/ChatBot.js';
|
|
4
|
-
export {
|
|
5
|
-
export * from './components/
|
|
6
|
-
export
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA"}
|