@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,110 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button, LinkBox, Text } from '@citric/core';
|
|
3
|
+
import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
4
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { styled } from 'styled-components';
|
|
7
|
+
import { Forbidden } from '../../svg/Forbidden.js';
|
|
8
|
+
import { Logo } from '../../svg/Logo.js';
|
|
9
|
+
import { NotFound } from '../../svg/NotFound.js';
|
|
10
|
+
import { ServerError } from '../../svg/ServerError.js';
|
|
11
|
+
import { Unauthenticated } from '../../svg/Unauthenticated.js';
|
|
12
|
+
const imageStyle = {
|
|
13
|
+
width: '200px',
|
|
14
|
+
height: '200px',
|
|
15
|
+
};
|
|
16
|
+
const imageMap = {
|
|
17
|
+
401: _jsx(Unauthenticated, { style: imageStyle }),
|
|
18
|
+
403: _jsx(Forbidden, { style: imageStyle }),
|
|
19
|
+
404: _jsx(NotFound, { style: imageStyle }),
|
|
20
|
+
};
|
|
21
|
+
const FeedbackBox = styled.div `
|
|
22
|
+
background-color: ${theme.color.light[400]};
|
|
23
|
+
padding: 24px;
|
|
24
|
+
.content {
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: center;
|
|
28
|
+
&.row {
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
gap: 40px;
|
|
31
|
+
}
|
|
32
|
+
&.column {
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
.text-content {
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.text-content {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: 12px;
|
|
42
|
+
}
|
|
43
|
+
.buttons {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
gap: '10px';
|
|
47
|
+
}
|
|
48
|
+
.details {
|
|
49
|
+
background-color: ${theme.color.danger[500]};
|
|
50
|
+
color: ${theme.color.danger.contrastText};
|
|
51
|
+
padding: 12px;
|
|
52
|
+
border-radius: 5px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
/**
|
|
57
|
+
* A box with an icon and an error message. This is used for giving error feedbacks to the user.
|
|
58
|
+
*
|
|
59
|
+
* If the application is in debug mode, a button is rendered to show the error message.
|
|
60
|
+
*
|
|
61
|
+
* @param options the error code, the error message and whether or not the application is in debug mode.
|
|
62
|
+
*/
|
|
63
|
+
export const ErrorFeedback = ({ code = 0, message, debug, title, body, image, action, description, help, direction = 'row', style, className }) => {
|
|
64
|
+
const t = useTranslate(dictionary);
|
|
65
|
+
const [showDetails, setShowDetails] = useState(false);
|
|
66
|
+
const shouldShowButtons = !!(action || (debug && message));
|
|
67
|
+
function renderBody() {
|
|
68
|
+
return typeof body === 'string' ? _jsx(Text, { appearance: "body1", colorScheme: "inverse", className: "description", children: body }) : body;
|
|
69
|
+
}
|
|
70
|
+
return (_jsx(FeedbackBox, { style: style, className: className, children: _jsxs("div", { className: listToClass(['content', direction]), children: [_jsx("div", { className: "image", children: image ?? imageMap[code] ?? _jsx(ServerError, { style: imageStyle }) }), _jsxs("div", { className: "text-content", children: [_jsx(LinkBox, { href: "/", className: "logo", children: _jsx(Logo, { style: { width: '130px', height: '30px' } }) }), _jsxs(Text, { appearance: "h4", mt: 5, colorScheme: "inverse", className: "title", children: [(code && !title) ? `${t.errorLabel} ${code}. ` : '', _jsx(Text, { appearance: "h4", as: "span", colorScheme: "light.700", children: title ?? t[`${code}.title`] })] }), body ? renderBody() : (_jsxs(_Fragment, { children: [_jsx(Text, { appearance: "body1", mt: 5, colorScheme: "inverse", className: "description", sx: {
|
|
71
|
+
maxWidth: '70ch',
|
|
72
|
+
whiteSpace: 'normal',
|
|
73
|
+
wordBreak: 'break-word',
|
|
74
|
+
}, children: description ?? t[`${code}.description`] }), _jsx(Text, { appearance: "body1", colorScheme: "light.700", className: "help", children: help ?? t[`${code}.help`] })] })), shouldShowButtons && (_jsxs("div", { className: "buttons", children: [action && (_jsx(Button, { colorScheme: "inverse", onClick: action.onClick, children: action.label })), debug && message && (_jsx(Button, { appearance: "outlined", colorScheme: "inverse", onClick: () => setShowDetails(v => !v), children: showDetails ? t.hideDetails : t.showDetails }))] })), showDetails && (_jsx("div", { className: "details", children: _jsx(Text, { appearance: "microtext1", children: message }) }))] })] }) }));
|
|
75
|
+
};
|
|
76
|
+
const dictionary = {
|
|
77
|
+
en: {
|
|
78
|
+
altLogo: 'Logo Stackspot',
|
|
79
|
+
'0.title': 'Something didn’t go as expected',
|
|
80
|
+
'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.',
|
|
81
|
+
'401.title': 'You need a valid credential',
|
|
82
|
+
'401.description': 'We couldn’t verify your credentials. Check the link or log in with a different account to continue.',
|
|
83
|
+
'403.title': 'Access restricted to your organization',
|
|
84
|
+
'403.help': 'Log in with an account from your organization or request access from your Account Holder.',
|
|
85
|
+
'404.title': 'This resource is no longer available',
|
|
86
|
+
'404.description': 'It may have been moved or removed. You can try again or ask your organization’s Account Holder for a new link.',
|
|
87
|
+
'500.title': 'We\'re making some adjustments',
|
|
88
|
+
'500.description': 'Something unexpected happened on our side. It might just be a momentary glitch. Try refreshing later to pick up where you left off.',
|
|
89
|
+
showDetails: 'Show Details',
|
|
90
|
+
hideDetails: 'Hide Details',
|
|
91
|
+
errorLabel: 'Error',
|
|
92
|
+
},
|
|
93
|
+
pt: {
|
|
94
|
+
altLogo: 'Logo Stackspot',
|
|
95
|
+
'0.title': 'Algo saiu diferente do esperado',
|
|
96
|
+
'0.description': '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.',
|
|
97
|
+
'401.title': 'Você precisa de uma credencial válida',
|
|
98
|
+
'401.description': 'Não conseguimos confirmar suas credenciais. Verifique o link ou faça login com outra conta para continuar.',
|
|
99
|
+
'403.title': 'Acesso exclusivo da sua organização',
|
|
100
|
+
'403.help': 'Faça login com uma conta da sua organização ou peça acesso ao Account Holder.',
|
|
101
|
+
'404.title': 'Este recurso não está mais disponível',
|
|
102
|
+
'404.description': 'Ele pode ter sido movido ou removido. Você pode tentar de novo ou pedir um novo link ao Account Holder da sua organização.',
|
|
103
|
+
'500.title': 'Estamos ajustando o sistema',
|
|
104
|
+
'500.description': 'Algo inesperado aconteceu do nosso lado. Pode ser só por alguns instantes. Tente recarregar mais tarde para continuar de onde parou.',
|
|
105
|
+
showDetails: 'Ver Detalhes',
|
|
106
|
+
hideDetails: 'Esconder Detalhes',
|
|
107
|
+
errorLabel: 'Erro',
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=ErrorFeedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorFeedback.js","sourceRoot":"","sources":["../../../src/components/error/ErrorFeedback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA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AE,gBAAgB;QACzB,SAAS,EAAE,iCAAiC;QAC5C,eAAe,EAAE,sHAAsH;QACvI,WAAW,EAAE,6BAA6B;QAC1C,iBAAiB,EAAE,qGAAqG;QACxH,WAAW,EAAE,wCAAwC;QACrD,UAAU,EAAE,2FAA2F;QACvG,WAAW,EAAE,sCAAsC;QACnD,iBAAiB,EAAE,gHAAgH;QACnI,WAAW,EAAE,gCAAgC;QAC7C,iBAAiB,EACjB,qIAAqI;QACrI,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,cAAc;QAC3B,UAAU,EAAE,OAAO;KACpB;IACD,EAAE,EAAE;QACF,OAAO,EAAE,gBAAgB;QACzB,SAAS,EAAE,iCAAiC;QAC5C,eAAe,EACf,uIAAuI;QACvI,WAAW,EAAE,uCAAuC;QACpD,iBAAiB,EAAE,4GAA4G;QAC/H,WAAW,EAAE,qCAAqC;QAClD,UAAU,EAAE,+EAA+E;QAC3F,WAAW,EAAE,uCAAuC;QACpD,iBAAiB,EACjB,4HAA4H;QAC5H,WAAW,EAAE,6BAA6B;QAC1C,iBAAiB,EACjB,sIAAsI;QACtI,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,mBAAmB;QAChC,UAAU,EAAE,MAAM;KACnB;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFound.d.ts","sourceRoot":"","sources":["../../../src/components/error/NotFound.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,YAAY;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,4CAW/D,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
3
|
+
import { ErrorFeedback } from './ErrorFeedback.js';
|
|
4
|
+
export const PageNotFound = ({ goHome }) => {
|
|
5
|
+
const t = useTranslate(dictionary);
|
|
6
|
+
return (_jsx(ErrorFeedback, { code: 404, action: goHome ? {
|
|
7
|
+
label: t.homePage,
|
|
8
|
+
onClick: goHome,
|
|
9
|
+
} : undefined }));
|
|
10
|
+
};
|
|
11
|
+
const dictionary = {
|
|
12
|
+
en: {
|
|
13
|
+
homePage: 'Home Page',
|
|
14
|
+
},
|
|
15
|
+
pt: {
|
|
16
|
+
homePage: 'Página Inicial',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=NotFound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFound.js","sourceRoot":"","sources":["../../../src/components/error/NotFound.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,MAAM,EAA2B,EAAE,EAAE;IAClE,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,OAAO,CACL,KAAC,aAAa,IACZ,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;YACf,KAAK,EAAE,CAAC,CAAC,QAAQ;YACjB,OAAO,EAAE,MAAM;SAChB,CAAC,CAAC,CAAC,SAAS,GACb,CACH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,QAAQ,EAAE,WAAW;KACtB;IACD,EAAE,EAAE;QACF,QAAQ,EAAE,gBAAgB;KAC3B;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnderMaintenance.d.ts","sourceRoot":"","sources":["../../../src/components/error/UnderMaintenance.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,GAAI,aAAa;IAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,4CAWrE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
3
|
+
import { ErrorFeedback } from './ErrorFeedback.js';
|
|
4
|
+
export const UnderMaintenance = ({ refresh }) => {
|
|
5
|
+
const t = useTranslate(dictionary);
|
|
6
|
+
return _jsx(ErrorFeedback, { title: t.underMaintenance, description: t.underMaintenanceDescription, help: t.underMaintenanceHelp, action: refresh ? {
|
|
7
|
+
label: t.refresh,
|
|
8
|
+
onClick: refresh,
|
|
9
|
+
} : undefined });
|
|
10
|
+
};
|
|
11
|
+
const dictionary = {
|
|
12
|
+
en: {
|
|
13
|
+
underMaintenance: 'Under maintenance',
|
|
14
|
+
underMaintenanceDescription: 'The site is currently undergoing maintenance.',
|
|
15
|
+
underMaintenanceHelp: 'Please, try again in a few minutes.',
|
|
16
|
+
refresh: 'Refresh page',
|
|
17
|
+
},
|
|
18
|
+
pt: {
|
|
19
|
+
underMaintenance: 'Em manutenção',
|
|
20
|
+
underMaintenanceDescription: 'O site está em manutenção.',
|
|
21
|
+
underMaintenanceHelp: 'Por favor, tente novamente em alguns minutos.',
|
|
22
|
+
refresh: 'Atualizar página',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=UnderMaintenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnderMaintenance.js","sourceRoot":"","sources":["../../../src/components/error/UnderMaintenance.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,OAAO,EAA4B,EAAE,EAAE;IACxE,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,OAAO,KAAC,aAAa,IACnB,KAAK,EAAE,CAAC,CAAC,gBAAgB,EACzB,WAAW,EAAE,CAAC,CAAC,2BAA2B,EAC1C,IAAI,EAAE,CAAC,CAAC,oBAAoB,EAC5B,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAChB,KAAK,EAAE,CAAC,CAAC,OAAO;YAChB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC,CAAC,SAAS,GACb,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,gBAAgB,EAAE,mBAAmB;QACrC,2BAA2B,EAAE,+CAA+C;QAC5E,oBAAoB,EAAE,qCAAqC;QAC3D,OAAO,EAAE,cAAc;KACxB;IACD,EAAE,EAAE;QACF,gBAAgB,EAAE,eAAe;QACjC,2BAA2B,EAAE,4BAA4B;QACzD,oBAAoB,EAAE,+CAA+C;QACrE,OAAO,EAAE,kBAAkB;KAC5B;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
3
|
+
export interface FormProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
defaultValues?: FieldValues;
|
|
7
|
+
autoComplete?: HTMLInputElement['autocomplete'];
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
onSubmit?: (params: FieldValues) => unknown;
|
|
10
|
+
form?: UseFormReturn<any, any>;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const Form: (props: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Form/Form.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,SAAS,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAgB,aAAa,EAA2B,MAAM,iBAAiB,CAAA;AAEnG,MAAM,WAAW,SAAS;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC;IAC5C,IAAI,CAAC,EAAE,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4ED,eAAO,MAAM,IAAI,GAAI,OAAO,SAAS,4CASpC,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { get } from 'lodash';
|
|
3
|
+
import { FormProvider, useForm, useFormContext } from 'react-hook-form';
|
|
4
|
+
function handleGraphqlErrors(error, methods) {
|
|
5
|
+
const errors = get(error, 'cause.extensions.fields');
|
|
6
|
+
if (errors) {
|
|
7
|
+
Object.keys(errors).forEach((key) => {
|
|
8
|
+
if (Object.keys(methods.control._fields).includes(key)) {
|
|
9
|
+
methods.setError(key, { type: 'server', message: errors[`${key}`] });
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const handleFormSubmit = async (data, methods, onSubmit) => {
|
|
15
|
+
if (!onSubmit) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const result = methods.handleSubmit(onSubmit)(data);
|
|
19
|
+
const isPromise = result instanceof Promise;
|
|
20
|
+
if (!isPromise) {
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return await result;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
const isGraphqlError = error.message === 'GraphqlError';
|
|
28
|
+
if (!isGraphqlError) {
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
handleGraphqlErrors(error, methods);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const BasicForm = ({ onSubmit, id, name, children, methods, autoComplete, ...props }) => (_jsx("form", { id: id, autoComplete: autoComplete, name: name, onSubmit: (data) => handleFormSubmit(data, methods, onSubmit), noValidate: true, style: props.style, className: props.className, children: children }));
|
|
35
|
+
const FormWithProvider = (props) => {
|
|
36
|
+
const methods = useForm({ defaultValues: props.defaultValues });
|
|
37
|
+
const form = props.form || methods;
|
|
38
|
+
return (_jsx(FormProvider, { ...form, children: _jsx(BasicForm, { ...props, methods: form }) }));
|
|
39
|
+
};
|
|
40
|
+
export const Form = (props) => {
|
|
41
|
+
const useFormMethods = useFormContext();
|
|
42
|
+
const hasFormProvider = !!useFormMethods;
|
|
43
|
+
if (hasFormProvider) {
|
|
44
|
+
return _jsx(BasicForm, { ...props, methods: useFormMethods });
|
|
45
|
+
}
|
|
46
|
+
return _jsx(FormWithProvider, { ...props });
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../../src/components/form/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,OAAO,EAAe,YAAY,EAAiB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAenG,SAAS,mBAAmB,CAAC,KAAc,EAAE,OAAmC;IAC9E,MAAM,MAAM,GAAQ,GAAG,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAA;IAEzD,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAClC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvD,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;YACtE,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAED,MAAM,gBAAgB,GAAG,KAAK,EAC5B,IAAgC,EAChC,OAAsB,EACtB,QAAsE,EACtE,EAAE;IAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAM;IACR,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAA;IACnD,MAAM,SAAS,GAAG,MAAM,YAAY,OAAO,CAAA;IAE3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAA;IAC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K,KAAK,EAAE,OAAO,EAAE,cAAc,GAAI,CAAA;IAC1D,CAAC;IAED,OAAO,KAAC,gBAAgB,OAAK,KAAK,GAAI,CAAA;AACxC,CAAC,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SxProperties } from '@citric/core/dist/sx.js';
|
|
2
|
+
import { Tooltip } from '@citric/ui';
|
|
3
|
+
import { ChangeEvent, ComponentProps, ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from 'react';
|
|
4
|
+
import { RegisterOptions } from 'react-hook-form';
|
|
5
|
+
interface FormGroupProps<T extends ElementType> {
|
|
6
|
+
fieldAddonAfter?: ReactNode;
|
|
7
|
+
fieldAddonBefore?: ReactNode;
|
|
8
|
+
formHelper?: ReactNode;
|
|
9
|
+
name: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
component?: T;
|
|
12
|
+
label?: string | ReactElement;
|
|
13
|
+
registerOptions?: RegisterOptions;
|
|
14
|
+
formItemSx?: SxProperties;
|
|
15
|
+
formGroupSx?: SxProperties;
|
|
16
|
+
componentSx?: SxProperties;
|
|
17
|
+
fieldAddonBeforeSx?: SxProperties;
|
|
18
|
+
fieldAddonAfterSx?: SxProperties;
|
|
19
|
+
$formName?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
onChange?: (event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>) => void;
|
|
22
|
+
tooltipProps?: Omit<ComponentProps<typeof Tooltip>, 'children'>;
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
standalone?: boolean;
|
|
26
|
+
delay?: number;
|
|
27
|
+
hideRequiredSymbol?: boolean;
|
|
28
|
+
shouldUnregister?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type Props<T extends ElementType> = FormGroupProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof FormGroupProps<T>>;
|
|
31
|
+
export declare const FormGroup: <T extends ElementType>({ fieldAddonAfter, fieldAddonBefore, formHelper, id, name, component, label, registerOptions, formGroupSx, formItemSx, componentSx, disabled, readOnly, onChange, tooltipProps, required, colorScheme: propColorScheme, fieldAddonBeforeSx, fieldAddonAfterSx, standalone, delay, hideRequiredSymbol, shouldUnregister, ...props }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare const FormItemError: ({ name, id }: {
|
|
33
|
+
name: string;
|
|
34
|
+
id: string;
|
|
35
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=FormGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Form/FormGroup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,OAAO,EAAgD,OAAO,EAAE,MAAM,YAAY,CAAA;AAGlF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,wBAAwB,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAC9H,OAAO,EAA0B,eAAe,EAA0E,MAAM,iBAAiB,CAAA;AA2BjJ,UAAU,cAAc,CAAC,CAAC,SAAS,WAAW;IAC5C,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,iBAAiB,CAAC,EAAE,YAAY,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC3F,YAAY,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,KAAK,KAAK,CAAC,CAAC,SAAS,WAAW,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAElH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,WAAW,EAAE,oUAyB9C,KAAK,CAAC,CAAC,CAAC,4CA8FV,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,mDAoBvE,CAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex, IconBox, Input, Label } from '@citric/core';
|
|
3
|
+
import { InfoCircle, TimesCircle } from '@citric/icons';
|
|
4
|
+
import { FieldAddon, FieldGroup, FormHelper, FormItem, Tooltip } from '@citric/ui';
|
|
5
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
6
|
+
import { debounce, get } from 'lodash';
|
|
7
|
+
import { useEffect } from 'react';
|
|
8
|
+
import { useFormContext } from 'react-hook-form';
|
|
9
|
+
const registerFieldWithDebounceChangeValidation = (name, delay, trigger, register, options) => {
|
|
10
|
+
const useFormRegisterReturn = register(name, options);
|
|
11
|
+
const { onChange } = useFormRegisterReturn;
|
|
12
|
+
const debouncedValidate = debounce(() => {
|
|
13
|
+
trigger(name);
|
|
14
|
+
}, delay);
|
|
15
|
+
const debouncedChange = debounce((event) => {
|
|
16
|
+
onChange?.(event);
|
|
17
|
+
}, delay);
|
|
18
|
+
return {
|
|
19
|
+
...useFormRegisterReturn,
|
|
20
|
+
onChange: (e) => {
|
|
21
|
+
debouncedChange(e);
|
|
22
|
+
debouncedValidate();
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export const FormGroup = ({ fieldAddonAfter, fieldAddonBefore, formHelper, id, name, component, label, registerOptions = {}, formGroupSx = {}, formItemSx = {}, componentSx = {}, disabled, readOnly, onChange, tooltipProps, required, colorScheme: propColorScheme, fieldAddonBeforeSx, fieldAddonAfterSx, standalone, delay, hideRequiredSymbol, shouldUnregister = false, ...props }) => {
|
|
27
|
+
const t = useTranslate(dictionary);
|
|
28
|
+
const { register, getFieldState, trigger, unregister } = useFormContext();
|
|
29
|
+
const Component = component || Input;
|
|
30
|
+
const colorScheme = propColorScheme;
|
|
31
|
+
let formRegistry = {};
|
|
32
|
+
if (!standalone) {
|
|
33
|
+
const options = {
|
|
34
|
+
onChange,
|
|
35
|
+
required: { message: hideRequiredSymbol ? t.requiredTest : t.required, value: !!required }, validate: (value) => {
|
|
36
|
+
if (required && typeof value === 'string') {
|
|
37
|
+
return !!value?.trim();
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
...registerOptions,
|
|
41
|
+
};
|
|
42
|
+
formRegistry = delay ? registerFieldWithDebounceChangeValidation(name, delay, trigger, register, options) : register(name, options);
|
|
43
|
+
}
|
|
44
|
+
useEffect(() => () => {
|
|
45
|
+
shouldUnregister && unregister(name);
|
|
46
|
+
}, [name, unregister]);
|
|
47
|
+
return (_jsxs(FormItem, { sx: formItemSx, children: [label && (_jsxs(Flex, { children: [_jsxs(Label, { appearance: "body2", htmlFor: id || name, sx: { pointerEvents: disabled || readOnly ? 'none' : undefined }, children: [label, "\u00A0", required && !hideRequiredSymbol && '*'] }), tooltipProps?.text && (_jsx(Tooltip, { ...tooltipProps, children: _jsx(IconBox, { children: _jsx(InfoCircle, {}) }) }))] })), !fieldAddonBefore && !fieldAddonAfter ? (_jsx(Component, { id: id || name, disabled: disabled, readOnly: readOnly, ...props, colorScheme, ...formRegistry, required: required, sx: componentSx, "aria-errormessage": `err${(id || name)}`, "aria-invalid": getFieldState(name).invalid })) : (_jsxs(FieldGroup, { sx: formGroupSx, children: [fieldAddonBefore && (_jsx(FieldAddon, { sx: { borderColor: colorScheme ? colorScheme : 'light.600', ...fieldAddonBeforeSx }, children: fieldAddonBefore })), _jsx(Component, { disabled: disabled, readOnly: readOnly, id: id || name, ...props, colorScheme, ...formRegistry, required: required, sx: componentSx, "aria-errormessage": `err${(id || name)}`, "aria-invalid": getFieldState(name).invalid }), fieldAddonAfter && (_jsx(FieldAddon, { sx: { borderColor: colorScheme ? colorScheme : 'light.600', ...fieldAddonAfterSx }, children: fieldAddonAfter }))] })), _jsx(FormItemError, { name: name, id: id || name }), formHelper && (_jsx(Box, { mt: "2", children: _jsx(FormHelper, { children: formHelper }) }))] }));
|
|
48
|
+
};
|
|
49
|
+
export const FormItemError = ({ name, id }) => {
|
|
50
|
+
const t = useTranslate(dictionary);
|
|
51
|
+
const { formState } = useFormContext();
|
|
52
|
+
const formItemError = get(formState.errors, name);
|
|
53
|
+
if (formItemError) {
|
|
54
|
+
return (_jsxs(Flex, { alignItems: "center", flexWrap: "nowrap", children: [_jsx(IconBox, { size: "xs", appearance: "circle", colorIcon: "danger", colorBg: "danger.500", children: _jsx(TimesCircle, {}) }), _jsx(Box, { ml: "3", children: _jsx(FormHelper, { colorScheme: "danger", "aria-live": "assertive", id: `err${id}`, children: formItemError.message?.toString() || formItemError?.root?.message?.toString() || t.invalidGenericError }) })] }));
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
};
|
|
58
|
+
const dictionary = {
|
|
59
|
+
en: {
|
|
60
|
+
invalidGenericError: 'Invalid field',
|
|
61
|
+
required: 'Required field',
|
|
62
|
+
// text for tests of usability
|
|
63
|
+
requiredTest: 'Fill in the required field to continue.',
|
|
64
|
+
},
|
|
65
|
+
pt: {
|
|
66
|
+
invalidGenericError: 'Campo inválido',
|
|
67
|
+
required: 'Campo obrigatório',
|
|
68
|
+
// text for tests of usability
|
|
69
|
+
requiredTest: 'Preencha este campo obrigatório para continuar.',
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=FormGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormGroup.js","sourceRoot":"","sources":["../../../../src/components/form/Form/FormGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAE/D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAClF,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAA+F,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9H,OAAO,EAA2C,cAAc,EAA0D,MAAM,iBAAiB,CAAA;AAEjJ,MAAM,yCAAyC,GAAG,CAChD,IAAkB,EAClB,KAAa,EACb,OAA0B,EAC1B,QAA4B,EAC5B,OAA0C,EAC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AE,iDAAiD;KAChE;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/form/Form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const SearchInput: ({ searchText, defaultValue, disabled, onChange, style, className, }: {
|
|
2
|
+
searchText: string;
|
|
3
|
+
defaultValue?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
onChange: (value?: string) => void;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
className?: string;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SearchInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/components/form/SearchInput.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAI,qEAOzB;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,4CAsCA,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, IconBox, Input } from '@citric/core';
|
|
3
|
+
import { Filter, Times } from '@citric/icons';
|
|
4
|
+
import { FieldAddon, FieldGroup, IconButton } from '@citric/ui';
|
|
5
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
6
|
+
import { debounce } from 'lodash';
|
|
7
|
+
import { useCallback, useState } from 'react';
|
|
8
|
+
export const SearchInput = ({ searchText, defaultValue, disabled = false, onChange, style, className, }) => {
|
|
9
|
+
const [value, setValue] = useState(defaultValue);
|
|
10
|
+
const runOnChange = useCallback(debounce(onChange, 800), [onChange]);
|
|
11
|
+
const t = useTranslate(dictionary);
|
|
12
|
+
return (_jsxs(Box, { sx: { position: 'relative' }, style: style, className: className, children: [_jsxs(FieldGroup, { children: [_jsx(FieldAddon, { children: _jsx(IconBox, { size: "xs", colorIcon: "light.700", children: _jsx(Filter, {}) }) }), _jsx(Input, { value: value, placeholder: searchText, onChange: (e) => {
|
|
13
|
+
setValue(e.target.value);
|
|
14
|
+
runOnChange(e.target.value);
|
|
15
|
+
}, disabled: disabled, maxLength: 255 })] }), !!value && (_jsx(IconButton, { sx: { position: 'absolute', right: '20px', top: '50%', transform: 'translate(50%, -50%)' }, onClick: () => {
|
|
16
|
+
setValue('');
|
|
17
|
+
runOnChange('');
|
|
18
|
+
}, "aria-label": t.ariaClearField, children: _jsx(Times, {}) }))] }));
|
|
19
|
+
};
|
|
20
|
+
const dictionary = {
|
|
21
|
+
en: {
|
|
22
|
+
ariaClearField: 'Clear field',
|
|
23
|
+
},
|
|
24
|
+
pt: {
|
|
25
|
+
ariaClearField: 'Limpar campo',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=SearchInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../src/components/form/SearchInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GA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BAC7B,CAAC,EACD,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,GAAG,GACd,IACS,EACZ,CAAC,CAAC,KAAK,IAAI,CACV,KAAC,UAAU,IACT,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAC1F,OAAO,EAAE,GAAG,EAAE;oBACZ,QAAQ,CAAC,EAAE,CAAC,CAAA;oBACZ,WAAW,CAAC,EAAE,CAAC,CAAA;gBACjB,CAAC,gBACW,CAAC,CAAC,cAAc,YAE5B,KAAC,KAAK,KAAG,GACE,CACd,IACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,cAAc,EAAE,aAAa;KAC9B;IACD,EAAE,EAAE;QACF,cAAc,EAAE,cAAc;KAC/B;CACmB,CAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { CustomSelectProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a Select component using the Citric Design System.
|
|
4
|
+
*
|
|
5
|
+
* The styled version of the select component is rendered on top of the default select from the browser. Visual users will use the Citric
|
|
6
|
+
* version of a Select, but blind users, who interacts with the keyboard, will use the default browser select instead, which is already
|
|
7
|
+
* highly optimized for accessibility.
|
|
8
|
+
*
|
|
9
|
+
* The CustomSelect lets you customize how each option and the selected value are rendered. To do so, use the prop `renderLabel` and
|
|
10
|
+
* `emptyOption`.
|
|
11
|
+
*
|
|
12
|
+
* If you don't need fully customized labels, check the more simple components: `DetailedSelect` and `Select`.
|
|
13
|
+
*
|
|
14
|
+
* The CustomSelect expects a {@link GenericAccessibleLabel} to create labels.
|
|
15
|
+
*
|
|
16
|
+
* Tips:
|
|
17
|
+
* - This is a controlled field. You can't use it any other way. If you're using it with react-hook-form, you need to wrap it under the
|
|
18
|
+
* component `<Controller>` from the same library.
|
|
19
|
+
* - `value` is required and must be of the same type of an item of the array of options. `value` is only optional if `emptyOption` is
|
|
20
|
+
* provided, in this case, an empty option is rendered and the value is undefined when it's selected.
|
|
21
|
+
* - A consequence of the previous rule is that you can't have an empty selection if you don't set a value for `emptyOption`. This
|
|
22
|
+
* component must work exactly like the browser's `select`, so this behavior is intended.
|
|
23
|
+
* - If `renderLabel` or `renderValue` are not provided, this will use the `toString` method of the object.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* options as an object array
|
|
27
|
+
* ```
|
|
28
|
+
* const options = ['option 1', 'option 2', 'option 3']
|
|
29
|
+
*
|
|
30
|
+
* function renderCustomLabel(option: string) {
|
|
31
|
+
* return {
|
|
32
|
+
* // this is how the option will be rendered in the list
|
|
33
|
+
* option: (
|
|
34
|
+
* <div style={{ display: flex, flexDirection: 'row', gap: '5px' }}>
|
|
35
|
+
* <img src="/my-image.png" width="40px" height="40px" />
|
|
36
|
+
* <p>An option called {option}</p>
|
|
37
|
+
* </div>
|
|
38
|
+
* ),
|
|
39
|
+
* // this is how the option will be rendered inside the input, when it's the value currently selected.
|
|
40
|
+
* selected: <p>{option}</p>,
|
|
41
|
+
* // this a string representation of the option: used for accessibility. This should contain the same information as `option`.
|
|
42
|
+
* text: `An option called ${option}`,
|
|
43
|
+
* )
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* const MyComponent = {
|
|
47
|
+
* const [value, setValue] = useState(options[0])
|
|
48
|
+
* return <CustomSelect options={options} value={value} onChange={setValue} renderLabel={renderCustomLabel} />
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
* @example
|
|
52
|
+
* options as an object array
|
|
53
|
+
* ```
|
|
54
|
+
* const options = [{ id: 1, name: 'John', age: 34 }, { id: 2, name: 'Marcia', age: 28 }, { id: 3, name: 'Angeline', age: 58 }]
|
|
55
|
+
*
|
|
56
|
+
* function renderCustomLabel(option: (typeof options)[number]) {
|
|
57
|
+
* return {
|
|
58
|
+
* // this is how the option will be rendered in the list
|
|
59
|
+
* option: (
|
|
60
|
+
* <div style={{ display: flex, flexDirection: 'row', gap: '5px' }}>
|
|
61
|
+
* <img src="/my-image.png" width="40px" height="40px" />
|
|
62
|
+
* <p>{option.name}, aged {option.age}</p>
|
|
63
|
+
* </div>
|
|
64
|
+
* ),
|
|
65
|
+
* // this is how the option will be rendered inside the input, when it's the value currently selected.
|
|
66
|
+
* selected: <p>{option}</p>,
|
|
67
|
+
* // this a string representation of the option: used for accessibility. This should contain the same information as `option`.
|
|
68
|
+
* text: `${option.name}, aged ${option.age}`,
|
|
69
|
+
* )
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* const MyComponent = {
|
|
73
|
+
* const [value, setValue] = useState(options[0])
|
|
74
|
+
* // below, renderValue could be `o => o.id`
|
|
75
|
+
* return <CustomSelect options={options} value={value} onChange={setValue} renderValue="id" renderLabel={renderCustomLabel} />
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
* @param props the component props: {@link CustomSelectProps}.
|
|
79
|
+
*/
|
|
80
|
+
export declare function CustomSelect<T>({ onChange, options, value, emptyOption, renderLabel, renderValue, maxItems, onFocus, onBlur, style, className, isLoading, disabled, height, ...props }: CustomSelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
//# sourceMappingURL=CustomSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Select/CustomSelect.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAqC,MAAM,SAAS,CAAA;AAkC9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC9B,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,QAAY,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EACrI,MAAe,EAAE,GAAG,KAAK,EAC1B,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CA6GtB"}
|