@stack-spot/portal-components 0.0.18 → 1.0.0-dev.1770393008395
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 +7 -9
- package/dist/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/components/Breadcrumb/index.js +7 -6
- 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 +27 -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 +102 -0
- package/dist/components/notification/NotificationList.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 +72 -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 +104 -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/GenericPlaceholderCentered.d.ts +7 -0
- package/dist/svg/GenericPlaceholderCentered.d.ts.map +1 -0
- package/dist/svg/GenericPlaceholderCentered.js +4 -0
- package/dist/svg/GenericPlaceholderCentered.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 +13 -0
- package/dist/svg/index.d.ts.map +1 -0
- package/dist/svg/index.js +14 -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 +54 -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 +15 -13
- 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 +123 -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 +72 -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 +207 -0
- package/src/components/notification/types.ts +72 -0
- package/src/containers/NotificationsPage.tsx +121 -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 +115 -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/GenericPlaceholderCentered.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 +14 -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/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/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/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,217 @@
|
|
|
1
|
+
import { Button, LinkBox, Text } from '@citric/core'
|
|
2
|
+
import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
3
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
4
|
+
import { useState } from 'react'
|
|
5
|
+
import { styled } from 'styled-components'
|
|
6
|
+
import { Forbidden } from '../../svg/Forbidden'
|
|
7
|
+
import { Logo } from '../../svg/Logo'
|
|
8
|
+
import { NotFound } from '../../svg/NotFound'
|
|
9
|
+
import { ServerError } from '../../svg/ServerError'
|
|
10
|
+
import { Unauthenticated } from '../../svg/Unauthenticated'
|
|
11
|
+
|
|
12
|
+
const imageStyle: React.CSSProperties = {
|
|
13
|
+
width: '200px',
|
|
14
|
+
height: '200px',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const imageMap: Record<number, React.ReactElement> = {
|
|
18
|
+
401: <Unauthenticated style={imageStyle} />,
|
|
19
|
+
403: <Forbidden style={imageStyle} />,
|
|
20
|
+
404: <NotFound style={imageStyle} />,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ErrorDescription {
|
|
24
|
+
/**
|
|
25
|
+
* The HTTP Error code if this is a network error.
|
|
26
|
+
*/
|
|
27
|
+
code?: number,
|
|
28
|
+
/**
|
|
29
|
+
* The error message. This is only visible if debug is true.
|
|
30
|
+
*/
|
|
31
|
+
message?: string,
|
|
32
|
+
/**
|
|
33
|
+
* Whether or not the application is in debug mode.
|
|
34
|
+
*/
|
|
35
|
+
debug?: boolean,
|
|
36
|
+
/**
|
|
37
|
+
* The title for this error. Overwrites anything preset by "code".
|
|
38
|
+
*/
|
|
39
|
+
title?: string,
|
|
40
|
+
/**
|
|
41
|
+
* The error description. Overwrites anything preset by "code".
|
|
42
|
+
*/
|
|
43
|
+
description?: string,
|
|
44
|
+
/**
|
|
45
|
+
* A help text to aid the user. Overwrites anything preset by "code".
|
|
46
|
+
*/
|
|
47
|
+
help?: string,
|
|
48
|
+
/**
|
|
49
|
+
* A button so the user can take some action.
|
|
50
|
+
*/
|
|
51
|
+
action?: { label: string, onClick: () => void },
|
|
52
|
+
/**
|
|
53
|
+
* The content for this error. Overwrites anything preset by "code", "description", "help" or "button".
|
|
54
|
+
*/
|
|
55
|
+
body?: React.ReactNode,
|
|
56
|
+
/**
|
|
57
|
+
* The image for the error. Overwrites anything preset by "code".
|
|
58
|
+
*/
|
|
59
|
+
image?: React.ReactElement,
|
|
60
|
+
/**
|
|
61
|
+
* Whether to show the feedback horizontally (row) or vertically (column).
|
|
62
|
+
*
|
|
63
|
+
* @default 'row'
|
|
64
|
+
*/
|
|
65
|
+
direction?: 'row' | 'column',
|
|
66
|
+
style?: React.CSSProperties,
|
|
67
|
+
className?: string,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const FeedbackBox = styled.div`
|
|
71
|
+
background-color: ${theme.color.light[400]};
|
|
72
|
+
padding: 24px;
|
|
73
|
+
.content {
|
|
74
|
+
display: flex;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
align-items: center;
|
|
77
|
+
&.row {
|
|
78
|
+
flex-direction: row;
|
|
79
|
+
gap: 40px;
|
|
80
|
+
}
|
|
81
|
+
&.column {
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
.text-content {
|
|
84
|
+
align-items: center;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
.text-content {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: 12px;
|
|
91
|
+
}
|
|
92
|
+
.buttons {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: row;
|
|
95
|
+
gap: '10px';
|
|
96
|
+
}
|
|
97
|
+
.details {
|
|
98
|
+
background-color: ${theme.color.danger[500]};
|
|
99
|
+
color: ${theme.color.danger.contrastText};
|
|
100
|
+
padding: 12px;
|
|
101
|
+
border-radius: 5px;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A box with an icon and an error message. This is used for giving error feedbacks to the user.
|
|
108
|
+
*
|
|
109
|
+
* If the application is in debug mode, a button is rendered to show the error message.
|
|
110
|
+
*
|
|
111
|
+
* @param options the error code, the error message and whether or not the application is in debug mode.
|
|
112
|
+
*/
|
|
113
|
+
export const ErrorFeedback = (
|
|
114
|
+
{ code = 0, message, debug, title, body, image, action, description, help, direction = 'row', style, className }: ErrorDescription,
|
|
115
|
+
) => {
|
|
116
|
+
const t = useTranslate(dictionary) as Record<string, string>
|
|
117
|
+
const [showDetails, setShowDetails] = useState(false)
|
|
118
|
+
const shouldShowButtons = !!(action || (debug && message))
|
|
119
|
+
|
|
120
|
+
function renderBody() {
|
|
121
|
+
return typeof body === 'string' ? <Text appearance="body1" colorScheme="inverse" className="description">{body}</Text> : body
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<FeedbackBox style={style} className={className}>
|
|
126
|
+
<div className={listToClass(['content', direction])}>
|
|
127
|
+
<div className="image">{image ?? imageMap[code] ?? <ServerError style={imageStyle} />}</div>
|
|
128
|
+
<div className="text-content">
|
|
129
|
+
<LinkBox href="/" className="logo">
|
|
130
|
+
<Logo style={{ width: '130px', height: '30px' }} />
|
|
131
|
+
</LinkBox>
|
|
132
|
+
<Text appearance="h4" mt={5} colorScheme="inverse" className="title">
|
|
133
|
+
{(code && !title) ? `${t.errorLabel} ${code}. ` : ''}
|
|
134
|
+
<Text appearance="h4" as="span" colorScheme="light.700">
|
|
135
|
+
{title ?? t[`${code}.title`]}
|
|
136
|
+
</Text>
|
|
137
|
+
</Text>
|
|
138
|
+
{body ? renderBody() : (
|
|
139
|
+
<>
|
|
140
|
+
<Text appearance="body1" mt={5} colorScheme="inverse" className="description"
|
|
141
|
+
sx={{
|
|
142
|
+
maxWidth: '70ch',
|
|
143
|
+
whiteSpace: 'normal',
|
|
144
|
+
wordBreak: 'break-word',
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
{description ?? t[`${code}.description`]}
|
|
148
|
+
</Text>
|
|
149
|
+
|
|
150
|
+
<Text appearance="body1" colorScheme="light.700" className="help">
|
|
151
|
+
{help ?? t[`${code}.help`]}
|
|
152
|
+
</Text>
|
|
153
|
+
</>
|
|
154
|
+
)}
|
|
155
|
+
{shouldShowButtons && (
|
|
156
|
+
<div className="buttons">
|
|
157
|
+
{action && (
|
|
158
|
+
<Button colorScheme="inverse" onClick={action.onClick}>
|
|
159
|
+
{action.label}
|
|
160
|
+
</Button>
|
|
161
|
+
)}
|
|
162
|
+
{debug && message && (
|
|
163
|
+
<Button appearance="outlined" colorScheme="inverse" onClick={() => setShowDetails(v => !v)}>
|
|
164
|
+
{showDetails ? t.hideDetails : t.showDetails}
|
|
165
|
+
</Button>
|
|
166
|
+
)}
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
169
|
+
{showDetails && (
|
|
170
|
+
<div className="details">
|
|
171
|
+
<Text appearance="microtext1">{message}</Text>
|
|
172
|
+
</div>
|
|
173
|
+
)}
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</FeedbackBox>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const dictionary = {
|
|
181
|
+
en: {
|
|
182
|
+
altLogo: 'Logo Stackspot',
|
|
183
|
+
'0.title': 'Something didn’t go as expected',
|
|
184
|
+
'0.description': 'This can happen from time to time. Try refreshing the page. If it still doesn’t work, reach out. We’re here to help.',
|
|
185
|
+
'401.title': 'You need a valid credential',
|
|
186
|
+
'401.description': 'We couldn’t verify your credentials. Check the link or log in with a different account to continue.',
|
|
187
|
+
'403.title': 'Access restricted to your organization',
|
|
188
|
+
'403.help': 'Log in with an account from your organization or request access from your Account Holder.',
|
|
189
|
+
'404.title': 'This resource is no longer available',
|
|
190
|
+
'404.description': 'It may have been moved or removed. You can try again or ask your organization’s Account Holder for a new link.',
|
|
191
|
+
'500.title': 'We\'re making some adjustments',
|
|
192
|
+
'500.description':
|
|
193
|
+
'Something unexpected happened on our side. It might just be a momentary glitch. Try refreshing later to pick up where you left off.',
|
|
194
|
+
showDetails: 'Show Details',
|
|
195
|
+
hideDetails: 'Hide Details',
|
|
196
|
+
errorLabel: 'Error',
|
|
197
|
+
},
|
|
198
|
+
pt: {
|
|
199
|
+
altLogo: 'Logo Stackspot',
|
|
200
|
+
'0.title': 'Algo saiu diferente do esperado',
|
|
201
|
+
'0.description':
|
|
202
|
+
'Isso pode acontecer de vez em quando. Tente recarregar a página. Se ainda não funcionar, chama a gente. Estamos por aqui para ajudar.',
|
|
203
|
+
'401.title': 'Você precisa de uma credencial válida',
|
|
204
|
+
'401.description': 'Não conseguimos confirmar suas credenciais. Verifique o link ou faça login com outra conta para continuar.',
|
|
205
|
+
'403.title': 'Acesso exclusivo da sua organização',
|
|
206
|
+
'403.help': 'Faça login com uma conta da sua organização ou peça acesso ao Account Holder.',
|
|
207
|
+
'404.title': 'Este recurso não está mais disponível',
|
|
208
|
+
'404.description':
|
|
209
|
+
'Ele pode ter sido movido ou removido. Você pode tentar de novo ou pedir um novo link ao Account Holder da sua organização.',
|
|
210
|
+
'500.title': 'Estamos ajustando o sistema',
|
|
211
|
+
'500.description':
|
|
212
|
+
'Algo inesperado aconteceu do nosso lado. Pode ser só por alguns instantes. Tente recarregar mais tarde para continuar de onde parou.',
|
|
213
|
+
showDetails: 'Ver Detalhes',
|
|
214
|
+
hideDetails: 'Esconder Detalhes',
|
|
215
|
+
errorLabel: 'Erro',
|
|
216
|
+
},
|
|
217
|
+
} satisfies Dictionary
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
2
|
+
import { ErrorFeedback } from './ErrorFeedback'
|
|
3
|
+
|
|
4
|
+
export const PageNotFound = ({ goHome }: { goHome?: () => void }) => {
|
|
5
|
+
const t = useTranslate(dictionary)
|
|
6
|
+
return (
|
|
7
|
+
<ErrorFeedback
|
|
8
|
+
code={404}
|
|
9
|
+
action={goHome ? {
|
|
10
|
+
label: t.homePage,
|
|
11
|
+
onClick: goHome,
|
|
12
|
+
} : undefined}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const dictionary = {
|
|
18
|
+
en: {
|
|
19
|
+
homePage: 'Home Page',
|
|
20
|
+
},
|
|
21
|
+
pt: {
|
|
22
|
+
homePage: 'Página Inicial',
|
|
23
|
+
},
|
|
24
|
+
} satisfies Dictionary
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
2
|
+
import { ErrorFeedback } from './ErrorFeedback'
|
|
3
|
+
|
|
4
|
+
export const UnderMaintenance = ({ refresh }: { refresh?: () => void }) => {
|
|
5
|
+
const t = useTranslate(dictionary)
|
|
6
|
+
return <ErrorFeedback
|
|
7
|
+
title={t.underMaintenance}
|
|
8
|
+
description={t.underMaintenanceDescription}
|
|
9
|
+
help={t.underMaintenanceHelp}
|
|
10
|
+
action={refresh ? {
|
|
11
|
+
label: t.refresh,
|
|
12
|
+
onClick: refresh,
|
|
13
|
+
} : undefined}
|
|
14
|
+
/>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const dictionary = {
|
|
18
|
+
en: {
|
|
19
|
+
underMaintenance: 'Under maintenance',
|
|
20
|
+
underMaintenanceDescription: 'The site is currently undergoing maintenance.',
|
|
21
|
+
underMaintenanceHelp: 'Please, try again in a few minutes.',
|
|
22
|
+
refresh: 'Refresh page',
|
|
23
|
+
},
|
|
24
|
+
pt: {
|
|
25
|
+
underMaintenance: 'Em manutenção',
|
|
26
|
+
underMaintenanceDescription: 'O site está em manutenção.',
|
|
27
|
+
underMaintenanceHelp: 'Por favor, tente novamente em alguns minutos.',
|
|
28
|
+
refresh: 'Atualizar página',
|
|
29
|
+
},
|
|
30
|
+
} satisfies Dictionary
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { get } from 'lodash'
|
|
2
|
+
import { FormEvent, ReactNode } from 'react'
|
|
3
|
+
import { FieldValues, FormProvider, UseFormReturn, useForm, useFormContext } from 'react-hook-form'
|
|
4
|
+
|
|
5
|
+
export interface FormProps {
|
|
6
|
+
id?: string,
|
|
7
|
+
name: string,
|
|
8
|
+
defaultValues?: FieldValues,
|
|
9
|
+
autoComplete?: HTMLInputElement['autocomplete'],
|
|
10
|
+
children?: ReactNode,
|
|
11
|
+
onSubmit?: (params: FieldValues) => unknown,
|
|
12
|
+
form?: UseFormReturn<any, any>,
|
|
13
|
+
style?: React.CSSProperties,
|
|
14
|
+
className?: string,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function handleGraphqlErrors(error: unknown, methods: UseFormReturn<FieldValues>) {
|
|
19
|
+
const errors: any = get(error, 'cause.extensions.fields')
|
|
20
|
+
|
|
21
|
+
if (errors) {
|
|
22
|
+
Object.keys(errors).forEach((key) => {
|
|
23
|
+
if (Object.keys(methods.control._fields).includes(key)) {
|
|
24
|
+
methods.setError(key, { type: 'server', message: errors[`${key}`] })
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const handleFormSubmit = async (
|
|
31
|
+
data: FormEvent<HTMLFormElement>,
|
|
32
|
+
methods: UseFormReturn,
|
|
33
|
+
onSubmit?: (params: Record<string, any>) => Promise<unknown> | unknown,
|
|
34
|
+
) => {
|
|
35
|
+
|
|
36
|
+
if (!onSubmit) {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const result = methods.handleSubmit(onSubmit)(data)
|
|
41
|
+
const isPromise = result instanceof Promise
|
|
42
|
+
|
|
43
|
+
if (!isPromise) {
|
|
44
|
+
return result
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
return await result
|
|
49
|
+
} catch (error: any) {
|
|
50
|
+
const isGraphqlError = error.message === 'GraphqlError'
|
|
51
|
+
if (!isGraphqlError) {
|
|
52
|
+
throw error
|
|
53
|
+
}
|
|
54
|
+
handleGraphqlErrors(error, methods)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const BasicForm = ({
|
|
59
|
+
onSubmit,
|
|
60
|
+
id,
|
|
61
|
+
name,
|
|
62
|
+
children,
|
|
63
|
+
methods,
|
|
64
|
+
autoComplete,
|
|
65
|
+
...props
|
|
66
|
+
}: FormProps & { methods: UseFormReturn<FieldValues> }) => (
|
|
67
|
+
<form
|
|
68
|
+
id={id}
|
|
69
|
+
autoComplete={autoComplete}
|
|
70
|
+
name={name}
|
|
71
|
+
onSubmit={(data: FormEvent<HTMLFormElement>) => handleFormSubmit(data, methods, onSubmit)}
|
|
72
|
+
noValidate
|
|
73
|
+
style={props.style}
|
|
74
|
+
className={props.className}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
</form>
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
const FormWithProvider = (props: FormProps) => {
|
|
81
|
+
const methods = useForm({ defaultValues: props.defaultValues })
|
|
82
|
+
const form = props.form || methods
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<FormProvider {...form}>
|
|
86
|
+
<BasicForm {...props} methods={form} />
|
|
87
|
+
</FormProvider>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const Form = (props: FormProps) => {
|
|
92
|
+
const useFormMethods = useFormContext()
|
|
93
|
+
const hasFormProvider = !!useFormMethods
|
|
94
|
+
|
|
95
|
+
if (hasFormProvider) {
|
|
96
|
+
return <BasicForm {...props} methods={useFormMethods} />
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return <FormWithProvider {...props} />
|
|
100
|
+
}
|
|
101
|
+
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { Box, Flex, IconBox, Input, Label } from '@citric/core'
|
|
2
|
+
import { SxProperties } from '@citric/core/dist/sx'
|
|
3
|
+
import { InfoCircle, TimesCircle } from '@citric/icons'
|
|
4
|
+
import { FieldAddon, FieldGroup, FormHelper, FormItem, Tooltip } from '@citric/ui'
|
|
5
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
6
|
+
import { debounce, get } from 'lodash'
|
|
7
|
+
import { ChangeEvent, ComponentProps, ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode, useEffect } from 'react'
|
|
8
|
+
import { FieldPath, FieldValues, RegisterOptions, useFormContext, UseFormRegister, UseFormRegisterReturn, UseFormTrigger } from 'react-hook-form'
|
|
9
|
+
|
|
10
|
+
const registerFieldWithDebounceChangeValidation = <T extends FieldValues>(
|
|
11
|
+
name: FieldPath<T>,
|
|
12
|
+
delay: number,
|
|
13
|
+
trigger: UseFormTrigger<T>,
|
|
14
|
+
register: UseFormRegister<T>,
|
|
15
|
+
options?: RegisterOptions<T, FieldPath<T>>,
|
|
16
|
+
) => {
|
|
17
|
+
const useFormRegisterReturn: UseFormRegisterReturn = register(name, options)
|
|
18
|
+
const { onChange } = useFormRegisterReturn
|
|
19
|
+
const debouncedValidate = debounce(() => {
|
|
20
|
+
trigger(name)
|
|
21
|
+
}, delay)
|
|
22
|
+
|
|
23
|
+
const debouncedChange = debounce((event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>) => {
|
|
24
|
+
onChange?.(event)
|
|
25
|
+
}, delay)
|
|
26
|
+
return {
|
|
27
|
+
...useFormRegisterReturn,
|
|
28
|
+
onChange: (e: any) => {
|
|
29
|
+
debouncedChange(e)
|
|
30
|
+
debouncedValidate()
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface FormGroupProps<T extends ElementType> {
|
|
36
|
+
fieldAddonAfter?: ReactNode,
|
|
37
|
+
fieldAddonBefore?: ReactNode,
|
|
38
|
+
formHelper?: ReactNode,
|
|
39
|
+
name: string,
|
|
40
|
+
id?: string,
|
|
41
|
+
component?: T,
|
|
42
|
+
label?: string | ReactElement,
|
|
43
|
+
registerOptions?: RegisterOptions,
|
|
44
|
+
formItemSx?: SxProperties,
|
|
45
|
+
formGroupSx?: SxProperties,
|
|
46
|
+
componentSx?: SxProperties,
|
|
47
|
+
fieldAddonBeforeSx?: SxProperties,
|
|
48
|
+
fieldAddonAfterSx?: SxProperties,
|
|
49
|
+
$formName?: string,
|
|
50
|
+
required?: boolean,
|
|
51
|
+
onChange?: (event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>) => void,
|
|
52
|
+
tooltipProps?: Omit<ComponentProps<typeof Tooltip>, 'children'>,
|
|
53
|
+
readOnly?: boolean,
|
|
54
|
+
disabled?: boolean,
|
|
55
|
+
// When true, input will not be registered on form
|
|
56
|
+
standalone?: boolean,
|
|
57
|
+
delay?: number,
|
|
58
|
+
// prop for tests of usability
|
|
59
|
+
hideRequiredSymbol?: boolean,
|
|
60
|
+
shouldUnregister?: boolean,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
type Props<T extends ElementType> = FormGroupProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof FormGroupProps<T>>
|
|
64
|
+
|
|
65
|
+
export const FormGroup = <T extends ElementType>({
|
|
66
|
+
fieldAddonAfter,
|
|
67
|
+
fieldAddonBefore,
|
|
68
|
+
formHelper,
|
|
69
|
+
id,
|
|
70
|
+
name,
|
|
71
|
+
component,
|
|
72
|
+
label,
|
|
73
|
+
registerOptions = {},
|
|
74
|
+
formGroupSx = {},
|
|
75
|
+
formItemSx = {},
|
|
76
|
+
componentSx = {},
|
|
77
|
+
disabled,
|
|
78
|
+
readOnly,
|
|
79
|
+
onChange,
|
|
80
|
+
tooltipProps,
|
|
81
|
+
required,
|
|
82
|
+
colorScheme: propColorScheme,
|
|
83
|
+
fieldAddonBeforeSx,
|
|
84
|
+
fieldAddonAfterSx,
|
|
85
|
+
standalone,
|
|
86
|
+
delay,
|
|
87
|
+
hideRequiredSymbol,
|
|
88
|
+
shouldUnregister = false,
|
|
89
|
+
...props
|
|
90
|
+
}: Props<T>) => {
|
|
91
|
+
const t = useTranslate(dictionary)
|
|
92
|
+
const { register, getFieldState, trigger, unregister } = useFormContext()
|
|
93
|
+
const Component = component || Input
|
|
94
|
+
const colorScheme = propColorScheme
|
|
95
|
+
|
|
96
|
+
let formRegistry = {}
|
|
97
|
+
|
|
98
|
+
if (!standalone) {
|
|
99
|
+
const options = {
|
|
100
|
+
onChange,
|
|
101
|
+
required: { message: hideRequiredSymbol ? t.requiredTest : t.required, value: !!required }, validate: (value: string) => {
|
|
102
|
+
if (required && typeof value === 'string') {
|
|
103
|
+
return !!value?.trim()
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
...registerOptions,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
formRegistry = delay ? registerFieldWithDebounceChangeValidation(name, delay, trigger, register, options) : register(name, options)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
useEffect(() => () => {
|
|
113
|
+
shouldUnregister && unregister(name)
|
|
114
|
+
}, [name, unregister])
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<FormItem sx={formItemSx}>
|
|
118
|
+
{label && (
|
|
119
|
+
<Flex>
|
|
120
|
+
<Label appearance="body2" htmlFor={id || name} sx={{ pointerEvents: disabled || readOnly ? 'none' : undefined }}>
|
|
121
|
+
{label}
|
|
122
|
+
|
|
123
|
+
{required && !hideRequiredSymbol && '*'}
|
|
124
|
+
</Label>
|
|
125
|
+
{tooltipProps?.text && (
|
|
126
|
+
<Tooltip {...(tooltipProps as typeof tooltipProps & { text: string })}>
|
|
127
|
+
<IconBox>
|
|
128
|
+
<InfoCircle />
|
|
129
|
+
</IconBox>
|
|
130
|
+
</Tooltip>
|
|
131
|
+
)}
|
|
132
|
+
</Flex>
|
|
133
|
+
)}
|
|
134
|
+
|
|
135
|
+
{!fieldAddonBefore && !fieldAddonAfter ? (
|
|
136
|
+
<Component
|
|
137
|
+
id={id || name}
|
|
138
|
+
disabled={disabled}
|
|
139
|
+
readOnly={readOnly}
|
|
140
|
+
{...props}
|
|
141
|
+
{...{ colorScheme }}
|
|
142
|
+
{...formRegistry}
|
|
143
|
+
required={required}
|
|
144
|
+
sx={componentSx}
|
|
145
|
+
aria-errormessage={`err${(id || name)}`}
|
|
146
|
+
aria-invalid={getFieldState(name).invalid}
|
|
147
|
+
/>
|
|
148
|
+
) : (
|
|
149
|
+
<FieldGroup sx={formGroupSx}>
|
|
150
|
+
{fieldAddonBefore && (
|
|
151
|
+
<FieldAddon sx={{ borderColor: colorScheme ? colorScheme : 'light.600', ...fieldAddonBeforeSx }}>
|
|
152
|
+
{fieldAddonBefore}
|
|
153
|
+
</FieldAddon>
|
|
154
|
+
)}
|
|
155
|
+
|
|
156
|
+
<Component
|
|
157
|
+
disabled={disabled}
|
|
158
|
+
readOnly={readOnly}
|
|
159
|
+
id={id || name}
|
|
160
|
+
{...props}
|
|
161
|
+
{...{ colorScheme }}
|
|
162
|
+
{...formRegistry}
|
|
163
|
+
required={required}
|
|
164
|
+
sx={componentSx}
|
|
165
|
+
aria-errormessage={`err${(id || name)}`}
|
|
166
|
+
aria-invalid={getFieldState(name).invalid}
|
|
167
|
+
/>
|
|
168
|
+
|
|
169
|
+
{fieldAddonAfter && (
|
|
170
|
+
<FieldAddon sx={{ borderColor: colorScheme ? colorScheme : 'light.600', ...fieldAddonAfterSx }}>
|
|
171
|
+
{fieldAddonAfter}
|
|
172
|
+
</FieldAddon>
|
|
173
|
+
)}
|
|
174
|
+
</FieldGroup>
|
|
175
|
+
)}
|
|
176
|
+
<FormItemError name={name} id={id || name} />
|
|
177
|
+
{formHelper && (
|
|
178
|
+
<Box mt="2">
|
|
179
|
+
<FormHelper>{formHelper}</FormHelper>
|
|
180
|
+
</Box>
|
|
181
|
+
)}
|
|
182
|
+
</FormItem>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const FormItemError = ({ name, id }: { name: string, id: string }) => {
|
|
187
|
+
const t = useTranslate(dictionary)
|
|
188
|
+
const { formState } = useFormContext()
|
|
189
|
+
const formItemError = get(formState.errors, name)
|
|
190
|
+
|
|
191
|
+
if (formItemError) {
|
|
192
|
+
return (
|
|
193
|
+
<Flex alignItems="center" flexWrap="nowrap">
|
|
194
|
+
<IconBox size="xs" appearance="circle" colorIcon="danger" colorBg="danger.500">
|
|
195
|
+
<TimesCircle />
|
|
196
|
+
</IconBox>
|
|
197
|
+
<Box ml="3">
|
|
198
|
+
<FormHelper colorScheme="danger" aria-live="assertive" id={`err${id}`}>
|
|
199
|
+
{formItemError.message?.toString() || formItemError?.root?.message?.toString() || t.invalidGenericError}
|
|
200
|
+
</FormHelper>
|
|
201
|
+
</Box>
|
|
202
|
+
</Flex>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
return null
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const dictionary = {
|
|
209
|
+
en: {
|
|
210
|
+
invalidGenericError: 'Invalid field',
|
|
211
|
+
required: 'Required field',
|
|
212
|
+
// text for tests of usability
|
|
213
|
+
requiredTest: 'Fill in the required field to continue.',
|
|
214
|
+
},
|
|
215
|
+
pt: {
|
|
216
|
+
invalidGenericError: 'Campo inválido',
|
|
217
|
+
required: 'Campo obrigatório',
|
|
218
|
+
// text for tests of usability
|
|
219
|
+
requiredTest: 'Preencha este campo obrigatório para continuar.',
|
|
220
|
+
},
|
|
221
|
+
} satisfies Dictionary
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Box, IconBox } from '@citric/core'
|
|
2
|
+
import { Input } from '@stack-spot/citric-react'
|
|
3
|
+
import { Filter, Times } from '@citric/icons'
|
|
4
|
+
import { FieldAddon, FieldGroup, IconButton } from '@citric/ui'
|
|
5
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
6
|
+
import { debounce } from 'lodash'
|
|
7
|
+
import { useCallback, useState } from 'react'
|
|
8
|
+
|
|
9
|
+
export const SearchInput = ({
|
|
10
|
+
searchText,
|
|
11
|
+
defaultValue,
|
|
12
|
+
disabled = false,
|
|
13
|
+
onChange,
|
|
14
|
+
style,
|
|
15
|
+
className,
|
|
16
|
+
}: {
|
|
17
|
+
searchText: string,
|
|
18
|
+
defaultValue?: string,
|
|
19
|
+
disabled?: boolean,
|
|
20
|
+
onChange: (value?: string) => void,
|
|
21
|
+
style?: React.CSSProperties,
|
|
22
|
+
className?: string,
|
|
23
|
+
}) => {
|
|
24
|
+
const [value, setValue] = useState(defaultValue)
|
|
25
|
+
const t = useTranslate(dictionary)
|
|
26
|
+
const debouncedOnChange = useCallback(
|
|
27
|
+
debounce((nextValue?: string) => onChange(nextValue), 800),
|
|
28
|
+
[onChange],
|
|
29
|
+
)
|
|
30
|
+
const handleInputOnChange = (nextValue: string) => {
|
|
31
|
+
setValue(nextValue)
|
|
32
|
+
debouncedOnChange(nextValue)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Box sx={{ position: 'relative' }} style={style} className={className}>
|
|
37
|
+
<FieldGroup>
|
|
38
|
+
<FieldAddon>
|
|
39
|
+
<IconBox size="xs" colorIcon="light.700">
|
|
40
|
+
<Filter />
|
|
41
|
+
</IconBox>
|
|
42
|
+
</FieldAddon>
|
|
43
|
+
<Input
|
|
44
|
+
style={{ width: '100%' }}
|
|
45
|
+
value={value}
|
|
46
|
+
placeholder={searchText}
|
|
47
|
+
onChange={handleInputOnChange}
|
|
48
|
+
disabled={disabled}
|
|
49
|
+
maxLength={255}
|
|
50
|
+
/>
|
|
51
|
+
</FieldGroup>
|
|
52
|
+
{!!value && (
|
|
53
|
+
<IconButton
|
|
54
|
+
sx={{ position: 'absolute', right: '20px', top: '50%', transform: 'translate(50%, -50%)' }}
|
|
55
|
+
onClick={() => handleInputOnChange('')}
|
|
56
|
+
aria-label={t.ariaClearField}
|
|
57
|
+
>
|
|
58
|
+
<Times />
|
|
59
|
+
</IconButton>
|
|
60
|
+
)}
|
|
61
|
+
</Box>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const dictionary = {
|
|
66
|
+
en: {
|
|
67
|
+
ariaClearField: 'Clear field',
|
|
68
|
+
},
|
|
69
|
+
pt: {
|
|
70
|
+
ariaClearField: 'Limpar campo',
|
|
71
|
+
},
|
|
72
|
+
} satisfies Dictionary
|