@scality/core-ui 0.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +17 -0
- package/.eslintrc.json +7 -0
- package/.flowconfig +21 -0
- package/.github/ISSUE_TEMPLATE/bug.md +18 -0
- package/.github/ISSUE_TEMPLATE/improvement.md +18 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +24 -0
- package/.github/workflows/codeql.yaml +25 -0
- package/.github/workflows/dependency-review.yaml +16 -0
- package/.github/workflows/github-pages.yml +17 -0
- package/.github/workflows/post-release.yml +52 -0
- package/.github/workflows/tests.yaml +32 -0
- package/.prettierrc +5 -0
- package/.storybook/main.ts +38 -0
- package/.storybook/manager.ts +6 -0
- package/.storybook/preview-head.html +99 -0
- package/.storybook/preview.js +68 -0
- package/.storybook/public/favicon.ico +0 -0
- package/.storybook/public/logo-core-ui.png +0 -0
- package/.storybook/theme.storybook.ts +13 -0
- package/LICENSE +201 -0
- package/README.md +296 -0
- package/__mocks__/fileMock.js +2 -0
- package/__mocks__/styleMock.js +2 -0
- package/dist/components/IconHelper.d.ts +10 -0
- package/dist/components/IconHelper.d.ts.map +1 -0
- package/dist/components/IconHelper.js +4 -0
- package/dist/components/areachart/AreaChart.component.d.ts +14 -0
- package/dist/components/areachart/AreaChart.component.d.ts.map +1 -0
- package/dist/components/areachart/AreaChart.component.js +27 -0
- package/dist/components/banner/Banner.component.d.ts +11 -0
- package/dist/components/banner/Banner.component.d.ts.map +1 -0
- package/dist/components/banner/Banner.component.js +40 -0
- package/dist/components/barchart/BarChart.component.d.ts +13 -0
- package/dist/components/barchart/BarChart.component.d.ts.map +1 -0
- package/dist/components/barchart/BarChart.component.js +22 -0
- package/dist/components/box/Box.d.ts +9 -0
- package/dist/components/box/Box.d.ts.map +1 -0
- package/dist/components/box/Box.js +21 -0
- package/dist/components/breadcrumb/Breadcrumb.component.d.ts +7 -0
- package/dist/components/breadcrumb/Breadcrumb.component.d.ts.map +1 -0
- package/dist/components/breadcrumb/Breadcrumb.component.js +77 -0
- package/dist/components/button/Button.component.d.ts +28 -0
- package/dist/components/button/Button.component.d.ts.map +1 -0
- package/dist/components/button/Button.component.js +227 -0
- package/dist/components/buttonv2/Buttonv2.component.d.ts +34 -0
- package/dist/components/buttonv2/Buttonv2.component.d.ts.map +1 -0
- package/dist/components/buttonv2/Buttonv2.component.js +198 -0
- package/dist/components/buttonv2/CopyButton.component.d.ts +24 -0
- package/dist/components/buttonv2/CopyButton.component.d.ts.map +1 -0
- package/dist/components/buttonv2/CopyButton.component.js +52 -0
- package/dist/components/card/Card.component.d.ts +28 -0
- package/dist/components/card/Card.component.d.ts.map +1 -0
- package/dist/components/card/Card.component.js +105 -0
- package/dist/components/checkbox/Checkbox.component.d.ts +10 -0
- package/dist/components/checkbox/Checkbox.component.d.ts.map +1 -0
- package/dist/components/checkbox/Checkbox.component.js +94 -0
- package/dist/components/chips/Chips.component.d.ts +22 -0
- package/dist/components/chips/Chips.component.d.ts.map +1 -0
- package/dist/components/chips/Chips.component.js +105 -0
- package/dist/components/circularprogressbar/CircularProgressBar.component.d.ts +13 -0
- package/dist/components/circularprogressbar/CircularProgressBar.component.d.ts.map +1 -0
- package/dist/components/circularprogressbar/CircularProgressBar.component.js +9 -0
- package/dist/components/circularprogressbar/CircularProgressBar.component.style.d.ts +11 -0
- package/dist/components/circularprogressbar/CircularProgressBar.component.style.d.ts.map +1 -0
- package/dist/components/circularprogressbar/CircularProgressBar.component.style.js +27 -0
- package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts +11 -0
- package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts.map +1 -0
- package/dist/components/cloudprogressbar/CloudProgressBar.component.js +38 -0
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts +10 -0
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts.map +1 -0
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.js +44 -0
- package/dist/components/constants.d.ts +27 -0
- package/dist/components/constants.d.ts.map +1 -0
- package/dist/components/constants.js +47 -0
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts +12 -0
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts.map +1 -0
- package/dist/components/constrainedtext/Constrainedtext.component.js +46 -0
- package/dist/components/coreuithemeprovider/CoreUiThemeProvider.d.ts +9 -0
- package/dist/components/coreuithemeprovider/CoreUiThemeProvider.d.ts.map +1 -0
- package/dist/components/coreuithemeprovider/CoreUiThemeProvider.js +13 -0
- package/dist/components/date/FormattedDateTime.d.ts +11 -0
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -0
- package/dist/components/date/FormattedDateTime.js +66 -0
- package/dist/components/date/FormattedDateTime.spec.d.ts +2 -0
- package/dist/components/date/FormattedDateTime.spec.d.ts.map +1 -0
- package/dist/components/date/FormattedDateTime.spec.js +140 -0
- package/dist/components/date/dateDiffer.d.ts +2 -0
- package/dist/components/date/dateDiffer.d.ts.map +1 -0
- package/dist/components/date/dateDiffer.js +7 -0
- package/dist/components/date/dateDiffer.spec.d.ts +2 -0
- package/dist/components/date/dateDiffer.spec.d.ts.map +1 -0
- package/dist/components/date/dateDiffer.spec.js +6 -0
- package/dist/components/dropdown/Dropdown.component.d.ts +20 -0
- package/dist/components/dropdown/Dropdown.component.d.ts.map +1 -0
- package/dist/components/dropdown/Dropdown.component.js +99 -0
- package/dist/components/dropzone/Dropzone.d.ts +16 -0
- package/dist/components/dropzone/Dropzone.d.ts.map +1 -0
- package/dist/components/dropzone/Dropzone.js +79 -0
- package/dist/components/emptystate/Emptystate.component.d.ts +13 -0
- package/dist/components/emptystate/Emptystate.component.d.ts.map +1 -0
- package/dist/components/emptystate/Emptystate.component.js +32 -0
- package/dist/components/emptytable/Emptytable.component.d.ts +8 -0
- package/dist/components/emptytable/Emptytable.component.d.ts.map +1 -0
- package/dist/components/emptytable/Emptytable.component.js +62 -0
- package/dist/components/error-pages/ErrorPage401.component.d.ts +9 -0
- package/dist/components/error-pages/ErrorPage401.component.d.ts.map +1 -0
- package/dist/components/error-pages/ErrorPage401.component.js +28 -0
- package/dist/components/error-pages/ErrorPage404.component.d.ts +8 -0
- package/dist/components/error-pages/ErrorPage404.component.d.ts.map +1 -0
- package/dist/components/error-pages/ErrorPage404.component.js +26 -0
- package/dist/components/error-pages/ErrorPage500.component.d.ts +13 -0
- package/dist/components/error-pages/ErrorPage500.component.d.ts.map +1 -0
- package/dist/components/error-pages/ErrorPage500.component.js +32 -0
- package/dist/components/error-pages/ErrorPageAuth.component.d.ts +8 -0
- package/dist/components/error-pages/ErrorPageAuth.component.d.ts.map +1 -0
- package/dist/components/error-pages/ErrorPageAuth.component.js +27 -0
- package/dist/components/error-pages/ErrorPageStyle.d.ts +7 -0
- package/dist/components/error-pages/ErrorPageStyle.d.ts.map +1 -0
- package/dist/components/error-pages/ErrorPageStyle.js +34 -0
- package/dist/components/form/Form.component.d.ts +61 -0
- package/dist/components/form/Form.component.d.ts.map +1 -0
- package/dist/components/form/Form.component.js +115 -0
- package/dist/components/globalhealthbar/GlobalHealthBar.component.d.ts +20 -0
- package/dist/components/globalhealthbar/GlobalHealthBar.component.d.ts.map +1 -0
- package/dist/components/globalhealthbar/GlobalHealthBar.component.js +169 -0
- package/dist/components/globalhealthbar/tooltip/index.d.ts +8 -0
- package/dist/components/globalhealthbar/tooltip/index.d.ts.map +1 -0
- package/dist/components/globalhealthbar/tooltip/index.js +55 -0
- package/dist/components/healthselectorv2/HealthSelector.component.d.ts +61 -0
- package/dist/components/healthselectorv2/HealthSelector.component.d.ts.map +1 -0
- package/dist/components/healthselectorv2/HealthSelector.component.js +70 -0
- package/dist/components/icon/Icon.component.d.ts +134 -0
- package/dist/components/icon/Icon.component.d.ts.map +1 -0
- package/dist/components/icon/Icon.component.js +209 -0
- package/dist/components/infomessage/InfoMessage.component.d.ts +9 -0
- package/dist/components/infomessage/InfoMessage.component.d.ts.map +1 -0
- package/dist/components/infomessage/InfoMessage.component.js +20 -0
- package/dist/components/infomessage/InfoMessageUtils.d.ts +8 -0
- package/dist/components/infomessage/InfoMessageUtils.d.ts.map +1 -0
- package/dist/components/infomessage/InfoMessageUtils.js +32 -0
- package/dist/components/input/Input.component.d.ts +24 -0
- package/dist/components/input/Input.component.d.ts.map +1 -0
- package/dist/components/input/Input.component.js +55 -0
- package/dist/components/input/Input.component.style.d.ts +9 -0
- package/dist/components/input/Input.component.style.d.ts.map +1 -0
- package/dist/components/input/Input.component.style.js +136 -0
- package/dist/components/inputlist/InputButtons.d.ts +20 -0
- package/dist/components/inputlist/InputButtons.d.ts.map +1 -0
- package/dist/components/inputlist/InputButtons.js +48 -0
- package/dist/components/inputlist/InputList.component.d.ts +27 -0
- package/dist/components/inputlist/InputList.component.d.ts.map +1 -0
- package/dist/components/inputlist/InputList.component.js +30 -0
- package/dist/components/inputv2/inputv2.d.ts +12 -0
- package/dist/components/inputv2/inputv2.d.ts.map +1 -0
- package/dist/components/inputv2/inputv2.js +80 -0
- package/dist/components/lateralnavbarlayout/LateralNavbarLayout.component.d.ts +9 -0
- package/dist/components/lateralnavbarlayout/LateralNavbarLayout.component.d.ts.map +1 -0
- package/dist/components/lateralnavbarlayout/LateralNavbarLayout.component.js +23 -0
- package/dist/components/layout/Layout.component.d.ts +12 -0
- package/dist/components/layout/Layout.component.d.ts.map +1 -0
- package/dist/components/layout/Layout.component.js +26 -0
- package/dist/components/layout/v2/AppContainer.d.ts +28 -0
- package/dist/components/layout/v2/AppContainer.d.ts.map +1 -0
- package/dist/components/layout/v2/AppContainer.js +63 -0
- package/dist/components/layout/v2/index.d.ts +6 -0
- package/dist/components/layout/v2/index.d.ts.map +1 -0
- package/dist/components/layout/v2/index.js +16 -0
- package/dist/components/layout/v2/panels.d.ts +17 -0
- package/dist/components/layout/v2/panels.d.ts.map +1 -0
- package/dist/components/layout/v2/panels.js +52 -0
- package/dist/components/linechart/LineChart.component.d.ts +22 -0
- package/dist/components/linechart/LineChart.component.d.ts.map +1 -0
- package/dist/components/linechart/LineChart.component.js +109 -0
- package/dist/components/linetemporalchart/ChartUtil.d.ts +40 -0
- package/dist/components/linetemporalchart/ChartUtil.d.ts.map +1 -0
- package/dist/components/linetemporalchart/ChartUtil.js +126 -0
- package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts +43 -0
- package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts.map +1 -0
- package/dist/components/linetemporalchart/LineTemporalChart.component.js +576 -0
- package/dist/components/linetemporalchart/MetricTimespanProvider.d.ts +8 -0
- package/dist/components/linetemporalchart/MetricTimespanProvider.d.ts.map +1 -0
- package/dist/components/linetemporalchart/MetricTimespanProvider.js +31 -0
- package/dist/components/linetemporalchart/tooltip/index.d.ts +30 -0
- package/dist/components/linetemporalchart/tooltip/index.d.ts.map +1 -0
- package/dist/components/linetemporalchart/tooltip/index.js +104 -0
- package/dist/components/loader/Loader.component.d.ts +11 -0
- package/dist/components/loader/Loader.component.d.ts.map +1 -0
- package/dist/components/loader/Loader.component.js +41 -0
- package/dist/components/modal/Modal.component.d.ts +13 -0
- package/dist/components/modal/Modal.component.d.ts.map +1 -0
- package/dist/components/modal/Modal.component.js +64 -0
- package/dist/components/multiselect/MultiSelect.component.d.ts +29 -0
- package/dist/components/multiselect/MultiSelect.component.d.ts.map +1 -0
- package/dist/components/multiselect/MultiSelect.component.js +73 -0
- package/dist/components/navbar/Navbar.component.d.ts +23 -0
- package/dist/components/navbar/Navbar.component.d.ts.map +1 -0
- package/dist/components/navbar/Navbar.component.js +151 -0
- package/dist/components/notifications/Notification.component.d.ts +13 -0
- package/dist/components/notifications/Notification.component.d.ts.map +1 -0
- package/dist/components/notifications/Notification.component.js +107 -0
- package/dist/components/notifications/Notifications.component.d.ts +15 -0
- package/dist/components/notifications/Notifications.component.d.ts.map +1 -0
- package/dist/components/notifications/Notifications.component.js +42 -0
- package/dist/components/prettybytes/PrettyBytes.component.d.ts +9 -0
- package/dist/components/prettybytes/PrettyBytes.component.d.ts.map +1 -0
- package/dist/components/prettybytes/PrettyBytes.component.js +24 -0
- package/dist/components/progressbar/ProgressBar.component.d.ts +18 -0
- package/dist/components/progressbar/ProgressBar.component.d.ts.map +1 -0
- package/dist/components/progressbar/ProgressBar.component.js +129 -0
- package/dist/components/scrollbarwrapper/ScrollbarWrapper.component.d.ts +7 -0
- package/dist/components/scrollbarwrapper/ScrollbarWrapper.component.d.ts.map +1 -0
- package/dist/components/scrollbarwrapper/ScrollbarWrapper.component.js +54 -0
- package/dist/components/searchinput/SearchInput.component.d.ts +12 -0
- package/dist/components/searchinput/SearchInput.component.d.ts.map +1 -0
- package/dist/components/searchinput/SearchInput.component.js +91 -0
- package/dist/components/select/Select.component.d.ts +15 -0
- package/dist/components/select/Select.component.d.ts.map +1 -0
- package/dist/components/select/Select.component.js +71 -0
- package/dist/components/selectv2/SelectStyle.d.ts +3 -0
- package/dist/components/selectv2/SelectStyle.d.ts.map +1 -0
- package/dist/components/selectv2/SelectStyle.js +238 -0
- package/dist/components/selectv2/Selectv2.component.d.ts +32 -0
- package/dist/components/selectv2/Selectv2.component.d.ts.map +1 -0
- package/dist/components/selectv2/Selectv2.component.js +267 -0
- package/dist/components/sidebar/Sidebar.component.d.ts +22 -0
- package/dist/components/sidebar/Sidebar.component.d.ts.map +1 -0
- package/dist/components/sidebar/Sidebar.component.js +136 -0
- package/dist/components/spacedbox/SpacedBox.d.ts +34 -0
- package/dist/components/spacedbox/SpacedBox.d.ts.map +1 -0
- package/dist/components/spacedbox/SpacedBox.js +64 -0
- package/dist/components/sparkline/SparkLine.component.d.ts +19 -0
- package/dist/components/sparkline/SparkLine.component.d.ts.map +1 -0
- package/dist/components/sparkline/SparkLine.component.js +148 -0
- package/dist/components/statuswrapper/Statuswrapper.component.d.ts +9 -0
- package/dist/components/statuswrapper/Statuswrapper.component.d.ts.map +1 -0
- package/dist/components/statuswrapper/Statuswrapper.component.js +44 -0
- package/dist/components/steppers/Stepper.component.d.ts +14 -0
- package/dist/components/steppers/Stepper.component.d.ts.map +1 -0
- package/dist/components/steppers/Stepper.component.js +33 -0
- package/dist/components/steppers/Steppers.component.d.ts +18 -0
- package/dist/components/steppers/Steppers.component.d.ts.map +1 -0
- package/dist/components/steppers/Steppers.component.js +96 -0
- package/dist/components/tablev2/MultiSelectableContent.d.ts +22 -0
- package/dist/components/tablev2/MultiSelectableContent.d.ts.map +1 -0
- package/dist/components/tablev2/MultiSelectableContent.js +129 -0
- package/dist/components/tablev2/Search.d.ts +29 -0
- package/dist/components/tablev2/Search.d.ts.map +1 -0
- package/dist/components/tablev2/Search.js +49 -0
- package/dist/components/tablev2/SearchWithQueryParams.d.ts +7 -0
- package/dist/components/tablev2/SearchWithQueryParams.d.ts.map +1 -0
- package/dist/components/tablev2/SearchWithQueryParams.js +24 -0
- package/dist/components/tablev2/SingleSelectableContent.d.ts +17 -0
- package/dist/components/tablev2/SingleSelectableContent.d.ts.map +1 -0
- package/dist/components/tablev2/SingleSelectableContent.js +75 -0
- package/dist/components/tablev2/TableCommon.d.ts +24 -0
- package/dist/components/tablev2/TableCommon.d.ts.map +1 -0
- package/dist/components/tablev2/TableCommon.js +35 -0
- package/dist/components/tablev2/TableUtils.d.ts +18 -0
- package/dist/components/tablev2/TableUtils.d.ts.map +1 -0
- package/dist/components/tablev2/TableUtils.js +32 -0
- package/dist/components/tablev2/Tablestyle.d.ts +36 -0
- package/dist/components/tablev2/Tablestyle.d.ts.map +1 -0
- package/dist/components/tablev2/Tablestyle.js +136 -0
- package/dist/components/tablev2/Tablev2.component.d.ts +71 -0
- package/dist/components/tablev2/Tablev2.component.d.ts.map +1 -0
- package/dist/components/tablev2/Tablev2.component.js +144 -0
- package/dist/components/tablev2/react-table-config.d.ts +28 -0
- package/dist/components/tablev2/react-table-config.d.ts.map +1 -0
- package/dist/components/tablev2/react-table-config.js +1 -0
- package/dist/components/tablev2/useCheckbox.d.ts +6 -0
- package/dist/components/tablev2/useCheckbox.d.ts.map +1 -0
- package/dist/components/tablev2/useCheckbox.js +40 -0
- package/dist/components/tablev2/useSyncedScroll.d.ts +7 -0
- package/dist/components/tablev2/useSyncedScroll.d.ts.map +1 -0
- package/dist/components/tablev2/useSyncedScroll.js +43 -0
- package/dist/components/tabsv2/ScrollButton.d.ts +8 -0
- package/dist/components/tabsv2/ScrollButton.d.ts.map +1 -0
- package/dist/components/tabsv2/ScrollButton.js +32 -0
- package/dist/components/tabsv2/StyledTabs.d.ts +18 -0
- package/dist/components/tabsv2/StyledTabs.d.ts.map +1 -0
- package/dist/components/tabsv2/StyledTabs.js +96 -0
- package/dist/components/tabsv2/Tab.d.ts +17 -0
- package/dist/components/tabsv2/Tab.d.ts.map +1 -0
- package/dist/components/tabsv2/Tab.js +10 -0
- package/dist/components/tabsv2/Tabsv2.component.d.ts +21 -0
- package/dist/components/tabsv2/Tabsv2.component.d.ts.map +1 -0
- package/dist/components/tabsv2/Tabsv2.component.js +89 -0
- package/dist/components/tabsv2/useScrollingTabs.d.ts +17 -0
- package/dist/components/tabsv2/useScrollingTabs.d.ts.map +1 -0
- package/dist/components/tabsv2/useScrollingTabs.js +261 -0
- package/dist/components/text/Text.component.d.ts +33 -0
- package/dist/components/text/Text.component.d.ts.map +1 -0
- package/dist/components/text/Text.component.js +154 -0
- package/dist/components/textarea/TextArea.component.d.ts +10 -0
- package/dist/components/textarea/TextArea.component.d.ts.map +1 -0
- package/dist/components/textarea/TextArea.component.js +60 -0
- package/dist/components/textbadge/TextBadge.component.d.ts +9 -0
- package/dist/components/textbadge/TextBadge.component.d.ts.map +1 -0
- package/dist/components/textbadge/TextBadge.component.js +19 -0
- package/dist/components/toast/DurationBasedProgressBar.d.ts +6 -0
- package/dist/components/toast/DurationBasedProgressBar.d.ts.map +1 -0
- package/dist/components/toast/DurationBasedProgressBar.js +24 -0
- package/dist/components/toast/Toast.component.d.ts +20 -0
- package/dist/components/toast/Toast.component.d.ts.map +1 -0
- package/dist/components/toast/Toast.component.js +106 -0
- package/dist/components/toast/ToastPositionHelpers.d.ts +4 -0
- package/dist/components/toast/ToastPositionHelpers.d.ts.map +1 -0
- package/dist/components/toast/ToastPositionHelpers.js +28 -0
- package/dist/components/toast/ToastProvider.d.ts +14 -0
- package/dist/components/toast/ToastProvider.d.ts.map +1 -0
- package/dist/components/toast/ToastProvider.js +18 -0
- package/dist/components/toast/useMutationsHandler.d.ts +40 -0
- package/dist/components/toast/useMutationsHandler.d.ts.map +1 -0
- package/dist/components/toast/useMutationsHandler.js +66 -0
- package/dist/components/toast/useToastParameters.d.ts +10 -0
- package/dist/components/toast/useToastParameters.d.ts.map +1 -0
- package/dist/components/toast/useToastParameters.js +39 -0
- package/dist/components/toggle/Toggle.component.d.ts +11 -0
- package/dist/components/toggle/Toggle.component.d.ts.map +1 -0
- package/dist/components/toggle/Toggle.component.js +80 -0
- package/dist/components/tooltip/Tooltip.component.d.ts +23 -0
- package/dist/components/tooltip/Tooltip.component.d.ts.map +1 -0
- package/dist/components/tooltip/Tooltip.component.js +82 -0
- package/dist/components/vegachart/VegaChart.component.d.ts +14 -0
- package/dist/components/vegachart/VegaChart.component.d.ts.map +1 -0
- package/dist/components/vegachart/VegaChart.component.js +120 -0
- package/dist/components/vegachartv2/SyncedCursorCharts.d.ts +13 -0
- package/dist/components/vegachartv2/SyncedCursorCharts.d.ts.map +1 -0
- package/dist/components/vegachartv2/SyncedCursorCharts.js +17 -0
- package/dist/components/vegachartv2/VegaChartV2.component.d.ts +16 -0
- package/dist/components/vegachartv2/VegaChartV2.component.d.ts.map +1 -0
- package/dist/components/vegachartv2/VegaChartV2.component.js +216 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +19 -0
- package/dist/icons/branding.d.ts +4 -0
- package/dist/icons/branding.d.ts.map +1 -0
- package/dist/icons/branding.js +3 -0
- package/dist/icons/scality-loading.d.ts +4 -0
- package/dist/icons/scality-loading.d.ts.map +1 -0
- package/dist/icons/scality-loading.js +3 -0
- package/dist/index.css +25 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/next.d.ts +15 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +14 -0
- package/dist/organisms/attachments/AttachmentConfirmationModal.d.ts +22 -0
- package/dist/organisms/attachments/AttachmentConfirmationModal.d.ts.map +1 -0
- package/dist/organisms/attachments/AttachmentConfirmationModal.js +142 -0
- package/dist/organisms/attachments/AttachmentTable.d.ts +37 -0
- package/dist/organisms/attachments/AttachmentTable.d.ts.map +1 -0
- package/dist/organisms/attachments/AttachmentTable.js +375 -0
- package/dist/organisms/attachments/AttachmentTypes.d.ts +15 -0
- package/dist/organisms/attachments/AttachmentTypes.d.ts.map +1 -0
- package/dist/organisms/attachments/AttachmentTypes.js +5 -0
- package/dist/spacing.d.ts +44 -0
- package/dist/spacing.d.ts.map +1 -0
- package/dist/spacing.js +60 -0
- package/dist/style/fonts/Lato-Bold.woff +0 -0
- package/dist/style/fonts/Lato-Bold.woff2 +0 -0
- package/dist/style/fonts/Lato-Regular.woff +0 -0
- package/dist/style/fonts/Lato-Regular.woff2 +0 -0
- package/dist/style/theme.d.ts +160 -0
- package/dist/style/theme.d.ts.map +1 -0
- package/dist/style/theme.js +234 -0
- package/dist/testUtils.d.ts +9 -0
- package/dist/testUtils.d.ts.map +1 -0
- package/dist/testUtils.js +11 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +46 -0
- package/global-setup.js +3 -0
- package/jest.config.js +8 -0
- package/package.json +161 -0
- package/plop-templates/component.hbs +18 -0
- package/plop-templates/component.test.hbs +10 -0
- package/plop-templates/stories.hbs +18 -0
- package/plopfile.js +38 -0
- package/setupTests.js +3 -0
- package/src/lib/components/IconHelper.tsx +23 -0
- package/src/lib/components/areachart/AreaChart.component.tsx +49 -0
- package/src/lib/components/banner/Banner.component.tsx +59 -0
- package/src/lib/components/barchart/BarChart.component.tsx +46 -0
- package/src/lib/components/box/Box.ts +57 -0
- package/src/lib/components/breadcrumb/Breadcrumb.component.tsx +101 -0
- package/src/lib/components/button/Button.component.tsx +312 -0
- package/src/lib/components/buttonv2/Buttonv2.component.tsx +270 -0
- package/src/lib/components/buttonv2/CopyButton.component.tsx +89 -0
- package/src/lib/components/card/Card.component.tsx +196 -0
- package/src/lib/components/checkbox/Checkbox.component.tsx +131 -0
- package/src/lib/components/chips/Chips.component.tsx +169 -0
- package/src/lib/components/circularprogressbar/CircularProgressBar.component.style.ts +31 -0
- package/src/lib/components/circularprogressbar/CircularProgressBar.component.tsx +58 -0
- package/src/lib/components/cloudprogressbar/CloudProgressBar.component.tsx +105 -0
- package/src/lib/components/collapsiblepanel/CollapsiblePanel.component.tsx +77 -0
- package/src/lib/components/constants.ts +67 -0
- package/src/lib/components/constrainedtext/Constrainedtext.component.tsx +93 -0
- package/src/lib/components/coreuithemeprovider/CoreUiThemeProvider.tsx +21 -0
- package/src/lib/components/date/FormattedDateTime.spec.tsx +217 -0
- package/src/lib/components/date/FormattedDateTime.tsx +150 -0
- package/src/lib/components/date/dateDiffer.spec.ts +13 -0
- package/src/lib/components/date/dateDiffer.ts +12 -0
- package/src/lib/components/dropdown/Dropdown.component.tsx +184 -0
- package/src/lib/components/dropzone/Dropzone.tsx +181 -0
- package/src/lib/components/emptystate/Emptystate.component.tsx +66 -0
- package/src/lib/components/emptytable/Emptytable.component.tsx +79 -0
- package/src/lib/components/error-pages/ErrorPage401.component.tsx +77 -0
- package/src/lib/components/error-pages/ErrorPage404.component.tsx +64 -0
- package/src/lib/components/error-pages/ErrorPage500.component.tsx +88 -0
- package/src/lib/components/error-pages/ErrorPageAuth.component.tsx +70 -0
- package/src/lib/components/error-pages/ErrorPageStyle.ts +34 -0
- package/src/lib/components/form/Form.component.tsx +416 -0
- package/src/lib/components/globalhealthbar/GlobalHealthBar.component.tsx +201 -0
- package/src/lib/components/globalhealthbar/tooltip/index.ts +72 -0
- package/src/lib/components/healthselectorv2/HealthSelector.component.test.tsx +62 -0
- package/src/lib/components/healthselectorv2/HealthSelector.component.tsx +103 -0
- package/src/lib/components/icon/Icon.component.tsx +280 -0
- package/src/lib/components/infomessage/InfoMessage.component.tsx +47 -0
- package/src/lib/components/infomessage/InfoMessageUtils.test.tsx +110 -0
- package/src/lib/components/infomessage/InfoMessageUtils.ts +39 -0
- package/src/lib/components/input/Input.component.style.ts +141 -0
- package/src/lib/components/input/Input.component.tsx +174 -0
- package/src/lib/components/inputlist/InputButtons.tsx +111 -0
- package/src/lib/components/inputlist/InputList.component.tsx +98 -0
- package/src/lib/components/inputlist/InputList.test.tsx +102 -0
- package/src/lib/components/inputv2/inputv2.tsx +155 -0
- package/src/lib/components/lateralnavbarlayout/LateralNavbarLayout.component.tsx +38 -0
- package/src/lib/components/layout/Layout.component.tsx +46 -0
- package/src/lib/components/layout/v2/AppContainer.tsx +160 -0
- package/src/lib/components/layout/v2/index.tsx +30 -0
- package/src/lib/components/layout/v2/panels.tsx +105 -0
- package/src/lib/components/linechart/LineChart.component.tsx +152 -0
- package/src/lib/components/linetemporalchart/ChartUtil.test.ts +261 -0
- package/src/lib/components/linetemporalchart/ChartUtil.ts +187 -0
- package/src/lib/components/linetemporalchart/LineTemporalChart.component.tsx +797 -0
- package/src/lib/components/linetemporalchart/MetricTimespanProvider.tsx +50 -0
- package/src/lib/components/linetemporalchart/tooltip/index.ts +178 -0
- package/src/lib/components/loader/Loader.component.tsx +71 -0
- package/src/lib/components/modal/Modal.component.tsx +121 -0
- package/src/lib/components/multiselect/MultiSelect.component.tsx +158 -0
- package/src/lib/components/navbar/Navbar.component.tsx +238 -0
- package/src/lib/components/notifications/Notification.component.tsx +160 -0
- package/src/lib/components/notifications/Notifications.component.tsx +73 -0
- package/src/lib/components/prettybytes/PrettyBytes.component.tsx +39 -0
- package/src/lib/components/prettybytes/prettybytes.test.tsx +217 -0
- package/src/lib/components/progressbar/ProgressBar.component.tsx +217 -0
- package/src/lib/components/scrollbarwrapper/ScrollbarWrapper.component.tsx +66 -0
- package/src/lib/components/searchinput/SearchInput.component.tsx +146 -0
- package/src/lib/components/select/Select.component.tsx +98 -0
- package/src/lib/components/selectv2/SelectStyle.ts +267 -0
- package/src/lib/components/selectv2/Selectv2.component.tsx +487 -0
- package/src/lib/components/selectv2/selectv2.test.tsx +277 -0
- package/src/lib/components/sidebar/Sidebar.component.tsx +217 -0
- package/src/lib/components/spacedbox/SpacedBox.ts +116 -0
- package/src/lib/components/sparkline/SparkLine.component.tsx +176 -0
- package/src/lib/components/statuswrapper/Statuswrapper.component.tsx +66 -0
- package/src/lib/components/steppers/Stepper.component.d.ts +70 -0
- package/src/lib/components/steppers/Stepper.component.tsx +62 -0
- package/src/lib/components/steppers/Steppers.component.tsx +157 -0
- package/src/lib/components/tablev2/MultiSelectableContent.tsx +318 -0
- package/src/lib/components/tablev2/Search.tsx +112 -0
- package/src/lib/components/tablev2/SearchWithQueryParams.tsx +38 -0
- package/src/lib/components/tablev2/SingleSelectableContent.tsx +222 -0
- package/src/lib/components/tablev2/TableCommon.tsx +102 -0
- package/src/lib/components/tablev2/TableUtils.test.ts +17 -0
- package/src/lib/components/tablev2/TableUtils.ts +60 -0
- package/src/lib/components/tablev2/Tablestyle.tsx +184 -0
- package/src/lib/components/tablev2/Tablev2.component.tsx +316 -0
- package/src/lib/components/tablev2/Tablev2.test.tsx +136 -0
- package/src/lib/components/tablev2/react-table-config.ts +90 -0
- package/src/lib/components/tablev2/useCheckbox.tsx +62 -0
- package/src/lib/components/tablev2/useSyncedScroll.ts +64 -0
- package/src/lib/components/tabsv2/ScrollButton.tsx +39 -0
- package/src/lib/components/tabsv2/StyledTabs.ts +108 -0
- package/src/lib/components/tabsv2/Tab.ts +27 -0
- package/src/lib/components/tabsv2/Tabsv2.component.tsx +247 -0
- package/src/lib/components/tabsv2/useScrollingTabs.ts +335 -0
- package/src/lib/components/text/Text.component.tsx +194 -0
- package/src/lib/components/textarea/TextArea.component.tsx +106 -0
- package/src/lib/components/textbadge/TextBadge.component.tsx +44 -0
- package/src/lib/components/toast/DurationBasedProgressBar.tsx +45 -0
- package/src/lib/components/toast/Toast.component.tsx +181 -0
- package/src/lib/components/toast/ToastPositionHelpers.ts +38 -0
- package/src/lib/components/toast/ToastProvider.tsx +40 -0
- package/src/lib/components/toast/useMutationsHandler.test.tsx +238 -0
- package/src/lib/components/toast/useMutationsHandler.ts +172 -0
- package/src/lib/components/toast/useToastParameters.ts +59 -0
- package/src/lib/components/toggle/Toggle.component.tsx +128 -0
- package/src/lib/components/tooltip/Tooltip.component.tsx +136 -0
- package/src/lib/components/vegachart/VegaChart.component.tsx +146 -0
- package/src/lib/components/vegachartv2/SyncedCursorCharts.tsx +30 -0
- package/src/lib/components/vegachartv2/VegaChartV2.component.tsx +279 -0
- package/src/lib/hooks.ts +26 -0
- package/src/lib/icons/branding.tsx +55 -0
- package/src/lib/icons/scality-loading.tsx +118 -0
- package/src/lib/index.css +25 -0
- package/src/lib/index.ts +75 -0
- package/src/lib/next.ts +17 -0
- package/src/lib/organisms/attachments/AttachmentConfirmationModal.tsx +311 -0
- package/src/lib/organisms/attachments/AttachmentTable.tsx +728 -0
- package/src/lib/organisms/attachments/AttachmentTypes.ts +16 -0
- package/src/lib/spacing.tsx +108 -0
- package/src/lib/style/fonts/Lato-Bold.woff +0 -0
- package/src/lib/style/fonts/Lato-Bold.woff2 +0 -0
- package/src/lib/style/fonts/Lato-Regular.woff +0 -0
- package/src/lib/style/fonts/Lato-Regular.woff2 +0 -0
- package/src/lib/style/theme.ts +270 -0
- package/src/lib/testUtils.tsx +18 -0
- package/src/lib/utils.ts +57 -0
- package/stories/Button/button.guideline.mdx +199 -0
- package/stories/Button/button.stories.tsx +299 -0
- package/stories/Icon.mdx +31 -0
- package/stories/InfoMessage/infomessage.guideline.mdx +32 -0
- package/stories/InfoMessage/infomessage.stories.tsx +124 -0
- package/stories/Introduction.mdx +32 -0
- package/stories/Select/select.guideline.mdx +91 -0
- package/stories/Select/selectv2.stories.tsx +169 -0
- package/stories/areachart.stories.tsx +121 -0
- package/stories/banner.stories.tsx +75 -0
- package/stories/barchart.stories.tsx +148 -0
- package/stories/box.stories.tsx +114 -0
- package/stories/breadcrumb.stories.tsx +42 -0
- package/stories/card.stories.tsx +195 -0
- package/stories/checkbox.stories.tsx +63 -0
- package/stories/chips.stories.tsx +107 -0
- package/stories/circularprogressbar.stories.tsx +136 -0
- package/stories/cloudprogressbar.stories.tsx +93 -0
- package/stories/collapsiblepanel.stories.tsx +57 -0
- package/stories/color.mdx +43 -0
- package/stories/common.tsx +39 -0
- package/stories/constrainedtext.stories.tsx +51 -0
- package/stories/controls.ts +59 -0
- package/stories/copybutton.stories.tsx +58 -0
- package/stories/data/areachart.ts +122 -0
- package/stories/data/barchart.ts +1497 -0
- package/stories/data/linechart.ts +1516 -0
- package/stories/data/list.ts +802 -0
- package/stories/data/sparklinechart.ts +164 -0
- package/stories/designprinciples.mdx +29 -0
- package/stories/dropdown.stories.tsx +146 -0
- package/stories/dropzone.stories.tsx +49 -0
- package/stories/emptystate.stories.tsx +22 -0
- package/stories/errorpage401.stories.tsx +25 -0
- package/stories/errorpage404.stories.tsx +24 -0
- package/stories/errorpage500.stories.tsx +44 -0
- package/stories/errorpageauth.stories.tsx +31 -0
- package/stories/form.stories.tsx +255 -0
- package/stories/format.mdx +44 -0
- package/stories/formattedate.stories.tsx +58 -0
- package/stories/globalhealthbar.stories.tsx +171 -0
- package/stories/guideline/chart-guideline.mdx +63 -0
- package/stories/guideline/docs-template.mdx +43 -0
- package/stories/guideline/mdxExampleComponents.tsx +57 -0
- package/stories/healthselectorv2.stories.tsx +74 -0
- package/stories/icon.stories.tsx +146 -0
- package/stories/icons.mdx +108 -0
- package/stories/input.stories.tsx +228 -0
- package/stories/inputlist.stories.tsx +57 -0
- package/stories/lateralnavbarlayout.stories.tsx +127 -0
- package/stories/layout.stories.tsx +378 -0
- package/stories/linechart.stories.tsx +319 -0
- package/stories/linecharttemporal.stories.tsx +88 -0
- package/stories/loader.stories.tsx +49 -0
- package/stories/modal.mdx +17 -0
- package/stories/modal.stories.tsx +177 -0
- package/stories/multiselect.stories.tsx +126 -0
- package/stories/navbar.stories.tsx +156 -0
- package/stories/notifications.stories.tsx +199 -0
- package/stories/pictures/icon-design-system.png +0 -0
- package/stories/prettybytes.stories.tsx +51 -0
- package/stories/progressbar.stories.tsx +174 -0
- package/stories/scrollbar.stories.tsx +76 -0
- package/stories/searchinput.stories.tsx +86 -0
- package/stories/select.stories.tsx +52 -0
- package/stories/selectinput.stories.tsx +73 -0
- package/stories/sidebar.stories.tsx +95 -0
- package/stories/spacing.stories.mdx +50 -0
- package/stories/spacing.stories.tsx +116 -0
- package/stories/sparkline.stories.tsx +85 -0
- package/stories/statuswrapper.stories.tsx +108 -0
- package/stories/stepper.stories.tsx +124 -0
- package/stories/steppers.stories.tsx +115 -0
- package/stories/tablev2.stories.tsx +539 -0
- package/stories/tabsv2.stories.tsx +168 -0
- package/stories/text.stories.tsx +138 -0
- package/stories/textarea.stories.tsx +69 -0
- package/stories/textbadge.stories.tsx +27 -0
- package/stories/toast.stories.tsx +144 -0
- package/stories/toggle.stories.tsx +45 -0
- package/stories/tooltip.stories.tsx +170 -0
- package/stories/typography.mdx +28 -0
- package/stories/vegachart.stories.tsx +98 -0
- package/tsconfig.json +18 -0
- package/types/styled.d.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurationBasedProgressBar.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/DurationBasedProgressBar.tsx"],"names":[],"mappings":";AAIA,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,eAkCA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { darken } from 'polished';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { ProgressBar } from '../progressbar/ProgressBar.component';
|
|
5
|
+
export function DurationBasedProgressBar({ duration, color, }) {
|
|
6
|
+
const [progress, setProgress] = useState(0);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (duration) {
|
|
9
|
+
const interval = setInterval(() => {
|
|
10
|
+
setProgress((prevProgress) => prevProgress + (100 / duration) * 1000);
|
|
11
|
+
}, 1000);
|
|
12
|
+
return () => {
|
|
13
|
+
clearInterval(interval);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}, [duration]);
|
|
17
|
+
return (_jsx("div", { style: {
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
bottom: 0,
|
|
20
|
+
left: 0,
|
|
21
|
+
width: '100%',
|
|
22
|
+
borderRadius: 4,
|
|
23
|
+
}, children: _jsx(ProgressBar, { size: "custom", percentage: progress, color: color, backgroundColor: `${darken(0.1, color)}`, height: '4px' }) }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ToastPosition } from './ToastPositionHelpers';
|
|
3
|
+
export type ToastStatus = 'success' | 'error' | 'warning' | 'info';
|
|
4
|
+
export type ToastProps = {
|
|
5
|
+
open: boolean;
|
|
6
|
+
message: ReactNode;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
status?: ToastStatus;
|
|
9
|
+
position?: ToastPosition;
|
|
10
|
+
autoDismiss?: boolean;
|
|
11
|
+
duration?: number;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
width?: React.CSSProperties['width'];
|
|
14
|
+
withProgressBar?: boolean;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
};
|
|
17
|
+
export declare const useGetBackgroundColor: (status: string) => string;
|
|
18
|
+
declare function Toast({ open, message, onClose, position, status, autoDismiss, duration, icon, width, withProgressBar, style, }: ToastProps): JSX.Element | null;
|
|
19
|
+
export { Toast };
|
|
20
|
+
//# sourceMappingURL=Toast.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/Toast.component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAMjD,OAAO,EAAE,aAAa,EAAkB,MAAM,wBAAwB,CAAC;AAKvE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,MAAM,WAYnD,CAAC;AA6DF,iBAAS,KAAK,CAAC,EACb,IAAI,EACJ,OAAO,EACP,OAAO,EACP,QAAsB,EACtB,MAAe,EACf,WAAkB,EAClB,QAAe,EACf,IAAsC,EACtC,KAAqB,EACrB,eAAuB,EACvB,KAAK,GACN,EAAE,UAAU,sBAiEZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { useTheme } from 'styled-components';
|
|
5
|
+
import { Box } from '../box/Box';
|
|
6
|
+
import { Button } from '../buttonv2/Buttonv2.component';
|
|
7
|
+
import { Icon } from '../icon/Icon.component';
|
|
8
|
+
import { BasicText } from '../text/Text.component';
|
|
9
|
+
import { positionOutput } from './ToastPositionHelpers';
|
|
10
|
+
import { DurationBasedProgressBar } from './DurationBasedProgressBar';
|
|
11
|
+
import { useToastParameters } from './useToastParameters';
|
|
12
|
+
import styled from 'styled-components';
|
|
13
|
+
export const useGetBackgroundColor = (status) => {
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
switch (status) {
|
|
16
|
+
case 'success':
|
|
17
|
+
return theme.statusHealthy;
|
|
18
|
+
case 'error':
|
|
19
|
+
return theme.statusCritical;
|
|
20
|
+
case 'warning':
|
|
21
|
+
return theme.statusWarning;
|
|
22
|
+
default:
|
|
23
|
+
return theme.infoPrimary;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const useGetRgbBackgroundColor = (status) => {
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
switch (status) {
|
|
29
|
+
case 'success':
|
|
30
|
+
return `rgba(${theme.statusHealthyRGB}, 0.4)`;
|
|
31
|
+
case 'error':
|
|
32
|
+
return `rgba(${theme.statusCriticalRGB}, 0.4)`;
|
|
33
|
+
case 'warning':
|
|
34
|
+
return `rgba(${theme.statusWarningRGB}, 0.4)`;
|
|
35
|
+
default:
|
|
36
|
+
return theme.infoSecondary;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const defaultIconName = (status) => {
|
|
40
|
+
switch (status) {
|
|
41
|
+
case 'success':
|
|
42
|
+
return 'Check-circle';
|
|
43
|
+
case 'error':
|
|
44
|
+
return 'Times-circle';
|
|
45
|
+
case 'warning':
|
|
46
|
+
return 'Exclamation-circle';
|
|
47
|
+
default:
|
|
48
|
+
return 'Info-circle';
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const DefaultIcon = ({ status }) => {
|
|
52
|
+
const color = useGetBackgroundColor(status);
|
|
53
|
+
const iconName = defaultIconName(status);
|
|
54
|
+
return _jsx(Icon, { name: iconName, color: color });
|
|
55
|
+
};
|
|
56
|
+
const DEFAULT_WIDTH = '25rem';
|
|
57
|
+
const IconContainer = styled.div `
|
|
58
|
+
align-items: center;
|
|
59
|
+
align-self: stretch;
|
|
60
|
+
border-radius: 4px 0px 0px 4px;
|
|
61
|
+
display: flex;
|
|
62
|
+
gap: 16px;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
position: relative;
|
|
65
|
+
width: 32px;
|
|
66
|
+
background-color: ${(props) => props.bgColor};
|
|
67
|
+
`;
|
|
68
|
+
const ContentContainer = styled.div `
|
|
69
|
+
align-items: center;
|
|
70
|
+
align-self: stretch;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex: 1;
|
|
73
|
+
flex-grow: 1;
|
|
74
|
+
gap: 8px;
|
|
75
|
+
padding: 0px 16px;
|
|
76
|
+
position: relative;
|
|
77
|
+
`;
|
|
78
|
+
function Toast({ open, message, onClose, position = 'top-right', status = 'info', autoDismiss = true, duration = 5000, icon = _jsx(DefaultIcon, { status: status }), width = DEFAULT_WIDTH, withProgressBar = false, style, }) {
|
|
79
|
+
const ref = useRef(null);
|
|
80
|
+
const { params } = useToastParameters({
|
|
81
|
+
open,
|
|
82
|
+
duration: autoDismiss ? duration : null,
|
|
83
|
+
onClose,
|
|
84
|
+
});
|
|
85
|
+
const positionStyle = positionOutput[position];
|
|
86
|
+
const bgColor = useGetBackgroundColor(status);
|
|
87
|
+
const rgbBgColor = useGetRgbBackgroundColor(status);
|
|
88
|
+
const theme = useTheme();
|
|
89
|
+
if (!open) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return (_jsxs("div", { ref: ref, role: "status", "aria-live": "polite", style: {
|
|
93
|
+
position: 'fixed',
|
|
94
|
+
...(style || positionStyle),
|
|
95
|
+
width,
|
|
96
|
+
}, children: [_jsxs(motion.div, { initial: { opacity: 0, y: -20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: 20 }, transition: { duration: 0.3 }, style: {
|
|
97
|
+
alignItems: 'flex-end',
|
|
98
|
+
backgroundColor: theme.backgroundLevel1,
|
|
99
|
+
border: `1px solid ${theme.border}`,
|
|
100
|
+
boxShadow: '0px 4px 10px 4px #000',
|
|
101
|
+
display: 'flex',
|
|
102
|
+
borderRadius: '4px',
|
|
103
|
+
position: 'relative',
|
|
104
|
+
}, children: [_jsx(IconContainer, { bgColor: rgbBgColor, children: icon }), _jsx(ContentContainer, { children: _jsx(BasicText, { children: message }) }), _jsx(Box, { display: "flex", alignItems: "center", alignSelf: "stretch", children: _jsx(Button, { icon: _jsx(Icon, { name: "Close", size: "lg", color: "textSecondary" }), onClick: params === null || params === void 0 ? void 0 : params.onClose, "aria-label": "Close" }) })] }, "toast"), withProgressBar && (_jsx(DurationBasedProgressBar, { duration: autoDismiss ? duration : null, color: bgColor }))] }));
|
|
105
|
+
}
|
|
106
|
+
export { Toast };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export type ToastPosition = 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center';
|
|
3
|
+
export declare const positionOutput: Record<ToastPosition, CSSProperties>;
|
|
4
|
+
//# sourceMappingURL=ToastPositionHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastPositionHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/ToastPositionHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,WAAW,GACX,YAAY,GACZ,aAAa,GACb,cAAc,GACd,eAAe,CAAC;AAEpB,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,aAAa,EAAE,aAAa,CA2B/D,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const positionOutput = {
|
|
2
|
+
'top-left': {
|
|
3
|
+
top: '3rem',
|
|
4
|
+
left: '1rem',
|
|
5
|
+
},
|
|
6
|
+
'top-right': {
|
|
7
|
+
top: '3rem',
|
|
8
|
+
right: '1rem',
|
|
9
|
+
},
|
|
10
|
+
'top-center': {
|
|
11
|
+
top: '1rem',
|
|
12
|
+
left: '50%',
|
|
13
|
+
transform: 'translateX(-50%)',
|
|
14
|
+
},
|
|
15
|
+
'bottom-left': {
|
|
16
|
+
bottom: '1rem',
|
|
17
|
+
left: '1rem',
|
|
18
|
+
},
|
|
19
|
+
'bottom-right': {
|
|
20
|
+
bottom: '1rem',
|
|
21
|
+
right: '1rem',
|
|
22
|
+
},
|
|
23
|
+
'bottom-center': {
|
|
24
|
+
bottom: '1rem',
|
|
25
|
+
left: '50%',
|
|
26
|
+
transform: 'translateX(-50%)',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ToastProps } from './Toast.component';
|
|
3
|
+
export type ToastContextState = Omit<ToastProps, 'onClose'>;
|
|
4
|
+
export interface ToastContextType {
|
|
5
|
+
showToast: (toastProps: ToastContextState) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ToastContext: import("react").Context<ToastContextType | undefined>;
|
|
8
|
+
interface ToastProviderProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
12
|
+
export declare const useToast: () => ToastContextType;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=ToastProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuC,MAAM,OAAO,CAAC;AACvE,OAAO,EAAS,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,YAAY,uDAExB,CAAC;AAEF,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AACD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAetD,CAAC;AAEF,eAAO,MAAM,QAAQ,wBAMpB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from 'react';
|
|
3
|
+
import { Toast } from './Toast.component';
|
|
4
|
+
export const ToastContext = createContext(undefined);
|
|
5
|
+
export const ToastProvider = ({ children }) => {
|
|
6
|
+
const [toastProps, setToastProps] = useState(null);
|
|
7
|
+
const showToast = (toastProps) => {
|
|
8
|
+
setToastProps(toastProps);
|
|
9
|
+
};
|
|
10
|
+
return (_jsxs(ToastContext.Provider, { value: { showToast }, children: [children, toastProps && (_jsx(Toast, { ...toastProps, onClose: () => setToastProps(null) }))] }));
|
|
11
|
+
};
|
|
12
|
+
export const useToast = () => {
|
|
13
|
+
const context = useContext(ToastContext);
|
|
14
|
+
if (!context) {
|
|
15
|
+
throw new Error('useToast must be used within a ToastProvider');
|
|
16
|
+
}
|
|
17
|
+
return context;
|
|
18
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { UseMutationOptions, UseMutationResult } from 'react-query';
|
|
3
|
+
import { ToastContextState } from './ToastProvider';
|
|
4
|
+
export type MutationConfig<T> = {
|
|
5
|
+
mutation: T;
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
declare type GetResults<T> = T extends MutationConfig<MinimalMutationResult<infer TData, infer TError>> ? MutationConfig<MinimalMutationResult<TData, TError>> : T extends MinimalMutationResult<infer TData, infer TError> ? MutationConfig<MinimalMutationResult<TData, TError>> : MutationConfig<MinimalMutationResult<unknown, unknown>>;
|
|
9
|
+
declare type GetDescriptionBuilder<T> = T extends MutationConfig<MinimalMutationResult<infer TData, infer TError>> ? DescriptionBuilder<TData, TError> : T extends MutationConfig<UseMutationOptions<infer TData, infer TError>> ? DescriptionBuilder<TData, TError> : T extends MinimalMutationResult<infer TData, infer TError> ? DescriptionBuilder<TData, TError> : never;
|
|
10
|
+
/**
|
|
11
|
+
* MutationResults reducer recursively maps type param to results
|
|
12
|
+
*/
|
|
13
|
+
declare type MutationsResults<T extends unknown[]> = T extends [] ? [] : T extends [infer Head, ...infer Tail] ? [GetResults<Head>, ...MutationsResults<Tail>] : T extends [infer Head] ? [GetResults<Head>] : unknown[] extends T ? T : never;
|
|
14
|
+
declare enum DescriptionBuilderStatus {
|
|
15
|
+
Success = "success",
|
|
16
|
+
Error = "error"
|
|
17
|
+
}
|
|
18
|
+
type DescriptionBuilder<Data = unknown, Error = unknown> = {
|
|
19
|
+
error?: Error;
|
|
20
|
+
data?: Data;
|
|
21
|
+
status: DescriptionBuilderStatus;
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
24
|
+
declare type DescriptionBuilders<T extends any[]> = T extends [] ? [] : T extends [infer Head, ...infer Tail] ? [GetDescriptionBuilder<Head>, ...DescriptionBuilders<Tail>] : T extends [infer Head] ? [GetDescriptionBuilder<Head>] : T extends UseMutationOptions<infer TMutationFnData, infer TError, infer TData>[] ? DescriptionBuilder<unknown extends TData ? TMutationFnData : TData, TError>[] : DescriptionBuilder[];
|
|
25
|
+
type Props<MainMutationType, T extends any[]> = {
|
|
26
|
+
mainMutation: MutationConfig<MainMutationType>;
|
|
27
|
+
dependantMutations?: readonly [...MutationsResults<T>] | MutationConfig<MinimalMutationResult<unknown, unknown>>[];
|
|
28
|
+
messageDescriptionBuilder: (mutations: T extends [] ? [GetDescriptionBuilder<MainMutationType>] : [GetDescriptionBuilder<MainMutationType>, ...DescriptionBuilders<T>]) => ReactNode;
|
|
29
|
+
toastProps?: Pick<ToastContextState, 'style' | 'autoDismiss' | 'position' | 'duration' | 'withProgressBar'>;
|
|
30
|
+
} & ({
|
|
31
|
+
onMainMutationSuccess?: () => void;
|
|
32
|
+
onAllMutationsSuccess?: never;
|
|
33
|
+
} | {
|
|
34
|
+
onAllMutationsSuccess?: () => void;
|
|
35
|
+
onMainMutationSuccess?: never;
|
|
36
|
+
});
|
|
37
|
+
type MinimalMutationResult<TData, TError> = Pick<UseMutationResult<TData, TError, unknown, unknown>, 'isError' | 'isIdle' | 'isSuccess' | 'isLoading' | 'error' | 'data'>;
|
|
38
|
+
export declare const useMutationsHandler: <MainMutationType extends MinimalMutationResult<unknown, unknown>, T extends any[] | []>({ mainMutation, dependantMutations, messageDescriptionBuilder, toastProps, ...rest }: Props<MainMutationType, T>) => void;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=useMutationsHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMutationsHandler.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/useMutationsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAY,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,QAAQ,EAAE,CAAC,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,OAAO,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CACnD,qBAAqB,CAAC,MAAM,KAAK,EAAE,MAAM,MAAM,CAAC,CACjD,GACG,cAAc,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,GACpD,CAAC,SAAS,qBAAqB,CAAC,MAAM,KAAK,EAAE,MAAM,MAAM,CAAC,GAC1D,cAAc,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,GACpD,cAAc,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAE5D,OAAO,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CAC9D,qBAAqB,CAAC,MAAM,KAAK,EAAE,MAAM,MAAM,CAAC,CACjD,GACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,GACjC,CAAC,SAAS,cAAc,CAAC,kBAAkB,CAAC,MAAM,KAAK,EAAE,MAAM,MAAM,CAAC,CAAC,GACvE,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,GACjC,CAAC,SAAS,qBAAqB,CAAC,MAAM,KAAK,EAAE,MAAM,MAAM,CAAC,GAC1D,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,GACjC,KAAK,CAAC;AAEV;;GAEG;AACH,OAAO,MAAM,gBAAgB,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,GAC7D,EAAE,GACF,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACrC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAC7C,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,GACtB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAClB,OAAO,EAAE,SAAS,CAAC,GACnB,CAAC,GACD,KAAK,CAAC;AAEV,aAAK,wBAAwB;IAC3B,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,KAAK,kBAAkB,CAAC,IAAI,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO,IAAI;IACzD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,EAAE,wBAAwB,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,OAAO,MAAM,mBAAmB,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,GAC5D,EAAE,GACF,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACrC,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAC3D,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,GACtB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,GAC7B,CAAC,SAAS,kBAAkB,CAC1B,MAAM,eAAe,EACrB,MAAM,MAAM,EACZ,MAAM,KAAK,CACZ,EAAE,GACH,kBAAkB,CAChB,OAAO,SAAS,KAAK,GAAG,eAAe,GAAG,KAAK,EAC/C,MAAM,CACP,EAAE,GACH,kBAAkB,EAAE,CAAC;AAEzB,KAAK,KAAK,CAAC,gBAAgB,EAAE,CAAC,SAAS,GAAG,EAAE,IAAI;IAC9C,YAAY,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC/C,kBAAkB,CAAC,EACf,SAAS,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,GACjC,cAAc,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAC9D,yBAAyB,EAAE,CACzB,SAAS,EAAE,CAAC,SAAS,EAAE,GACnB,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,GACzC,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,EAAE,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,KACrE,SAAS,CAAC;IACf,UAAU,CAAC,EAAE,IAAI,CACf,iBAAiB,EACjB,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,iBAAiB,CACtE,CAAC;CACH,GAAG,CACA;IAAE,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,qBAAqB,CAAC,EAAE,KAAK,CAAA;CAAE,GACrE;IAAE,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,qBAAqB,CAAC,EAAE,KAAK,CAAA;CAAE,CACxE,CAAC;AAEF,KAAK,qBAAqB,CAAC,KAAK,EAAE,MAAM,IAAI,IAAI,CAC9C,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAClD,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CACpE,CAAC;AAEF,eAAO,MAAM,mBAAmB,oNA8E/B,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
|
+
import { useToast } from './ToastProvider';
|
|
3
|
+
var DescriptionBuilderStatus;
|
|
4
|
+
(function (DescriptionBuilderStatus) {
|
|
5
|
+
DescriptionBuilderStatus["Success"] = "success";
|
|
6
|
+
DescriptionBuilderStatus["Error"] = "error";
|
|
7
|
+
})(DescriptionBuilderStatus || (DescriptionBuilderStatus = {}));
|
|
8
|
+
export const useMutationsHandler = ({ mainMutation, dependantMutations, messageDescriptionBuilder, toastProps, ...rest }) => {
|
|
9
|
+
const { showToast } = useToast();
|
|
10
|
+
const mutations = [
|
|
11
|
+
mainMutation,
|
|
12
|
+
...(dependantMutations ? dependantMutations : []),
|
|
13
|
+
];
|
|
14
|
+
const handleMutationsCompletion = useCallback(async () => {
|
|
15
|
+
var _a, _b, _c, _d, _e;
|
|
16
|
+
const results = await Promise.all(mutations.map((m) => m.mutation));
|
|
17
|
+
const loadingMutations = mutations.filter((_, index) => results[index].isLoading);
|
|
18
|
+
const successMutations = mutations.filter((_, index) => results[index].isSuccess);
|
|
19
|
+
const errorMutations = mutations.filter((_, index) => results[index].isError);
|
|
20
|
+
const mainMutationDesc = {
|
|
21
|
+
data: (_a = mainMutation.mutation) === null || _a === void 0 ? void 0 : _a.data,
|
|
22
|
+
status: DescriptionBuilderStatus.Success,
|
|
23
|
+
name: mainMutation.name,
|
|
24
|
+
};
|
|
25
|
+
const descriptionBuilders = [
|
|
26
|
+
mainMutationDesc,
|
|
27
|
+
...((dependantMutations === null || dependantMutations === void 0 ? void 0 : dependantMutations.map(({ mutation, name }) => ({
|
|
28
|
+
data: mutation.data,
|
|
29
|
+
error: mutation.isError && mutation.error,
|
|
30
|
+
status: mutation.isSuccess
|
|
31
|
+
? DescriptionBuilderStatus.Success
|
|
32
|
+
: DescriptionBuilderStatus.Error,
|
|
33
|
+
name,
|
|
34
|
+
}))) || []),
|
|
35
|
+
];
|
|
36
|
+
if (loadingMutations.length === 0) {
|
|
37
|
+
if (errorMutations.length > 0) {
|
|
38
|
+
if ((_b = mainMutation.mutation) === null || _b === void 0 ? void 0 : _b.isSuccess) {
|
|
39
|
+
'onMainMutationSuccess' in rest && ((_c = rest === null || rest === void 0 ? void 0 : rest.onMainMutationSuccess) === null || _c === void 0 ? void 0 : _c.call(rest));
|
|
40
|
+
}
|
|
41
|
+
showToast({
|
|
42
|
+
open: true,
|
|
43
|
+
status: 'error',
|
|
44
|
+
message: messageDescriptionBuilder(descriptionBuilders),
|
|
45
|
+
...toastProps,
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
else if (successMutations.length > 0) {
|
|
50
|
+
'onMainMutationSuccess' in rest && ((_d = rest === null || rest === void 0 ? void 0 : rest.onMainMutationSuccess) === null || _d === void 0 ? void 0 : _d.call(rest));
|
|
51
|
+
if (successMutations.length === mutations.length) {
|
|
52
|
+
'onAllMutationsSuccess' in rest && ((_e = rest === null || rest === void 0 ? void 0 : rest.onAllMutationsSuccess) === null || _e === void 0 ? void 0 : _e.call(rest));
|
|
53
|
+
}
|
|
54
|
+
showToast({
|
|
55
|
+
open: true,
|
|
56
|
+
status: 'success',
|
|
57
|
+
message: messageDescriptionBuilder(descriptionBuilders),
|
|
58
|
+
...(toastProps ? toastProps : {}),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, [JSON.stringify(mutations)]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
handleMutationsCompletion();
|
|
65
|
+
}, [handleMutationsCompletion]);
|
|
66
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface ToastParameters {
|
|
2
|
+
duration?: number | null;
|
|
3
|
+
open?: boolean;
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function useToastParameters(params: ToastParameters): {
|
|
7
|
+
params: ToastParameters;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=useToastParameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToastParameters.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/useToastParameters.ts"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe;;EAkDzD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
export function useToastParameters(params) {
|
|
3
|
+
const { duration = null, open, onClose } = params;
|
|
4
|
+
const timerAutoHide = useRef();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!open) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
function handleKeyDown(nativeEvent) {
|
|
10
|
+
if (!nativeEvent.defaultPrevented) {
|
|
11
|
+
if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') {
|
|
12
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
17
|
+
return () => {
|
|
18
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
19
|
+
};
|
|
20
|
+
}, [open, onClose]);
|
|
21
|
+
const setAutoHideTimer = useCallback((autoHideDurationParam) => {
|
|
22
|
+
if (!onClose || autoHideDurationParam == null) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
clearTimeout(timerAutoHide.current);
|
|
26
|
+
timerAutoHide.current = setTimeout(() => {
|
|
27
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
28
|
+
}, autoHideDurationParam);
|
|
29
|
+
}, [onClose]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (open) {
|
|
32
|
+
setAutoHideTimer(duration);
|
|
33
|
+
}
|
|
34
|
+
return () => {
|
|
35
|
+
clearTimeout(timerAutoHide.current);
|
|
36
|
+
};
|
|
37
|
+
}, [open, duration, setAutoHideTimer]);
|
|
38
|
+
return { params };
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeEvent, InputHTMLAttributes } from 'react';
|
|
2
|
+
type Props = InputHTMLAttributes<HTMLInputElement> & {
|
|
3
|
+
toggle: boolean;
|
|
4
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
5
|
+
label?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare function ToggleSwitch({ toggle, label, onChange, disabled, ...rest }: Props): JSX.Element;
|
|
9
|
+
export declare const Toggle: typeof ToggleSwitch;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=Toggle.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toggle/Toggle.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAU,MAAM,OAAO,CAAC;AAQjE,KAAK,KAAK,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IACnD,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA6DF,iBAAS,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAmD1E;AAED,eAAO,MAAM,MAAM,qBAAe,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { spacing } from '../../style/theme';
|
|
5
|
+
import { LABEL_PREFIX, useFieldContext } from '../form/Form.component';
|
|
6
|
+
import { Stack } from '../../spacing';
|
|
7
|
+
import { Text } from '../text/Text.component';
|
|
8
|
+
const ToggleContainer = styled.span `
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
position: relative;
|
|
12
|
+
opacity: ${(props) => (props.disabled ? 0.5 : 1)};
|
|
13
|
+
`;
|
|
14
|
+
const Switch = styled.label `
|
|
15
|
+
position: relative;
|
|
16
|
+
width: ${spacing.sp24};
|
|
17
|
+
height: ${spacing.sp14};
|
|
18
|
+
align-self: center;
|
|
19
|
+
${(props) => {
|
|
20
|
+
return css `
|
|
21
|
+
${props.disabled
|
|
22
|
+
? `
|
|
23
|
+
cursor: not-allowed;
|
|
24
|
+
`
|
|
25
|
+
: `
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
`}
|
|
28
|
+
`;
|
|
29
|
+
}}
|
|
30
|
+
`;
|
|
31
|
+
const Slider = styled.div `
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 1rem;
|
|
34
|
+
background-color: ${(props) => props.theme.backgroundLevel1};
|
|
35
|
+
border: ${spacing.sp1} solid
|
|
36
|
+
${(props) => props.theme[props.toggle ? 'selectedActive' : 'infoPrimary']};
|
|
37
|
+
border-radius: ${spacing.sp8};
|
|
38
|
+
transition: 0.4s;
|
|
39
|
+
-moz-transform: rotate(0.02deg);
|
|
40
|
+
&:before {
|
|
41
|
+
border-radius: 100%;
|
|
42
|
+
position: absolute;
|
|
43
|
+
content: '';
|
|
44
|
+
height: ${spacing.sp10};
|
|
45
|
+
width: ${spacing.sp10};
|
|
46
|
+
left: 3px;
|
|
47
|
+
top: 3.5px;
|
|
48
|
+
background-color: ${(props) => props.theme[props.toggle ? 'textSecondary' : 'textPrimary']};
|
|
49
|
+
transition: 0.4s;
|
|
50
|
+
-moz-transform: rotate(0.02deg);
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
const ToggleInput = styled.input `
|
|
54
|
+
&:checked + ${Slider} {
|
|
55
|
+
background-color: ${(props) => props.theme.selectedActive};
|
|
56
|
+
}
|
|
57
|
+
&:checked + ${Slider}:before {
|
|
58
|
+
transform: translateX(${spacing.sp10});
|
|
59
|
+
}
|
|
60
|
+
display: none;
|
|
61
|
+
`;
|
|
62
|
+
const StyledSwitchLabel = styled.label `
|
|
63
|
+
color: ${(props) => props.theme[props.toggle ? 'textPrimary' : 'textPrimary']};
|
|
64
|
+
`;
|
|
65
|
+
function ToggleSwitch({ toggle, label, onChange, disabled, ...rest }) {
|
|
66
|
+
const { isContextAvailable } = useFieldContext();
|
|
67
|
+
const checkboxRef = useRef(null);
|
|
68
|
+
return (_jsx(StyledSwitchLabel, { toggle: toggle, className: "text", id: `${rest['id']}-label`, htmlFor: rest['id'], children: _jsx(ToggleContainer, { className: "sc-toggle", disabled: disabled, children: _jsxs(Stack, { gap: 'r8', style: { alignItems: 'baseline' }, children: [_jsxs(Switch, { htmlFor: rest['id'], role: "checkbox", "aria-checked": toggle, tabIndex: disabled ? -1 : 0, "aria-disabled": disabled, disabled: disabled, onKeyDown: (e) => {
|
|
69
|
+
if (e.code === 'Space' || e.code === 'Enter') {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
checkboxRef.current && checkboxRef.current.click();
|
|
73
|
+
}
|
|
74
|
+
}, "aria-labelledby": label
|
|
75
|
+
? `${rest['id']}-label`
|
|
76
|
+
: isContextAvailable
|
|
77
|
+
? `${LABEL_PREFIX}${rest['id']}`
|
|
78
|
+
: undefined, children: [_jsx(ToggleInput, { type: "checkbox", checked: toggle, onChange: onChange, disabled: disabled, ref: checkboxRef, ...rest }), _jsx(Slider, { className: "sc-slider", toggle: toggle })] }), label && _jsx(Text, { children: label })] }) }) }));
|
|
79
|
+
}
|
|
80
|
+
export const Toggle = ToggleSwitch;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export declare const TOP = "top";
|
|
3
|
+
export declare const BOTTOM = "bottom";
|
|
4
|
+
export declare const LEFT = "left";
|
|
5
|
+
export declare const TOPSTART = "top-start";
|
|
6
|
+
export declare const TOPEND = "top-end";
|
|
7
|
+
export declare const RIGHT = "right";
|
|
8
|
+
export declare const RIGHTSTART = "right-start";
|
|
9
|
+
export declare const RIGHTEND = "right-end";
|
|
10
|
+
export declare const BOTTOMEND = "bottom-end";
|
|
11
|
+
export declare const BOTTOMSTART = "bottom-start";
|
|
12
|
+
export declare const LEFTSTART = "left-start";
|
|
13
|
+
export declare const LEFTEND = "left-end";
|
|
14
|
+
export type Position = typeof TOP | typeof BOTTOM | typeof LEFT | typeof RIGHT | typeof TOPSTART | typeof TOPEND | typeof RIGHTSTART | typeof RIGHTEND | typeof BOTTOMEND | typeof BOTTOMSTART | typeof LEFTEND | typeof LEFTSTART;
|
|
15
|
+
export type Props = {
|
|
16
|
+
placement?: Position;
|
|
17
|
+
overlayStyle?: CSSProperties;
|
|
18
|
+
overlay?: React.ReactNode;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
declare function Tooltip({ placement, overlayStyle, children, overlay, ...rest }: Props): JSX.Element;
|
|
22
|
+
export { Tooltip };
|
|
23
|
+
//# sourceMappingURL=Tooltip.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tooltip/Tooltip.component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA+B,MAAM,OAAO,CAAC;AAKnE,eAAO,MAAM,GAAG,QAAQ,CAAC;AACzB,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,eAAO,MAAM,IAAI,SAAS,CAAC;AAC3B,eAAO,MAAM,QAAQ,cAAc,CAAC;AACpC,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,KAAK,UAAU,CAAC;AAC7B,eAAO,MAAM,UAAU,gBAAgB,CAAC;AACxC,eAAO,MAAM,QAAQ,cAAc,CAAC;AACpC,eAAO,MAAM,SAAS,eAAe,CAAC;AACtC,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAC1C,eAAO,MAAM,SAAS,eAAe,CAAC;AACtC,eAAO,MAAM,OAAO,aAAa,CAAC;AAClC,MAAM,MAAM,QAAQ,GAChB,OAAO,GAAG,GACV,OAAO,MAAM,GACb,OAAO,IAAI,GACX,OAAO,KAAK,GACZ,OAAO,QAAQ,GACf,OAAO,MAAM,GACb,OAAO,UAAU,GACjB,OAAO,QAAQ,GACf,OAAO,SAAS,GAChB,OAAO,WAAW,GAClB,OAAO,OAAO,GACd,OAAO,SAAS,CAAC;AACrB,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AA4CF,iBAAS,OAAO,CAAC,EACf,SAAe,EACf,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,GAAG,IAAI,EACR,EAAE,KAAK,eA+CP;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { computePosition, flip, offset, shift } from '@floating-ui/dom';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { spacing } from '../../spacing';
|
|
6
|
+
import { fontSize, zIndex } from '../../style/theme';
|
|
7
|
+
import { getThemePropSelector } from '../../utils';
|
|
8
|
+
export const TOP = 'top';
|
|
9
|
+
export const BOTTOM = 'bottom';
|
|
10
|
+
export const LEFT = 'left';
|
|
11
|
+
export const TOPSTART = 'top-start';
|
|
12
|
+
export const TOPEND = 'top-end';
|
|
13
|
+
export const RIGHT = 'right';
|
|
14
|
+
export const RIGHTSTART = 'right-start';
|
|
15
|
+
export const RIGHTEND = 'right-end';
|
|
16
|
+
export const BOTTOMEND = 'bottom-end';
|
|
17
|
+
export const BOTTOMSTART = 'bottom-start';
|
|
18
|
+
export const LEFTSTART = 'left-start';
|
|
19
|
+
export const LEFTEND = 'left-end';
|
|
20
|
+
const TooltipContainer = styled.div `
|
|
21
|
+
position: relative;
|
|
22
|
+
display: inline-block;
|
|
23
|
+
`;
|
|
24
|
+
const TooltipOverLayContainer = styled.div `
|
|
25
|
+
display: inline-block;
|
|
26
|
+
opacity: 0;
|
|
27
|
+
position: fixed;
|
|
28
|
+
width: max-content;
|
|
29
|
+
border: 1px solid ${getThemePropSelector('border')};
|
|
30
|
+
background-color: ${(props) => (props && props.style && props.style.backgroundColor) ||
|
|
31
|
+
props.theme.backgroundLevel1};
|
|
32
|
+
color: ${(props) => (props && props.style && props.style.color) || props.theme.textPrimary};
|
|
33
|
+
z-index: ${zIndex.tooltip};
|
|
34
|
+
border-radius: 4px;
|
|
35
|
+
font-size: ${(props) => (props && props.style && props.style.fontSize) || fontSize.small};
|
|
36
|
+
vertical-align: middle;
|
|
37
|
+
padding: ${spacing.r4} ${spacing.r8};
|
|
38
|
+
max-width: 40rem;
|
|
39
|
+
`;
|
|
40
|
+
const TooltipText = styled.div `
|
|
41
|
+
width: 100%;
|
|
42
|
+
ul,
|
|
43
|
+
ol {
|
|
44
|
+
padding-inline-start: ${spacing.r16};
|
|
45
|
+
margin-block-start: 0;
|
|
46
|
+
margin-block-end: 0;
|
|
47
|
+
}
|
|
48
|
+
li {
|
|
49
|
+
margin-bottom: ${spacing.r8};
|
|
50
|
+
}
|
|
51
|
+
li:last-child {
|
|
52
|
+
margin-bottom: 0;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
function Tooltip({ placement = TOP, overlayStyle, children, overlay, ...rest }) {
|
|
56
|
+
const childrenRef = useRef(null);
|
|
57
|
+
const tooltipRef = useRef(null);
|
|
58
|
+
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (childrenRef.current && tooltipRef.current) {
|
|
61
|
+
computePosition(childrenRef.current, tooltipRef.current, {
|
|
62
|
+
placement,
|
|
63
|
+
middleware: [offset(5), shift(), flip()],
|
|
64
|
+
}).then(({ x, y }) => {
|
|
65
|
+
if (tooltipRef.current) {
|
|
66
|
+
Object.assign(tooltipRef.current.style, {
|
|
67
|
+
opacity: '1',
|
|
68
|
+
// we set opacity to 1 to make sure the tooltip is not displayed before the position is computed
|
|
69
|
+
left: `${x}px`,
|
|
70
|
+
top: `${y}px`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, [tooltipRef.current, childrenRef.current, isTooltipVisible]);
|
|
76
|
+
return (_jsxs(TooltipContainer, { className: "sc-tooltip", onPointerEnter: () => {
|
|
77
|
+
setIsTooltipVisible(true);
|
|
78
|
+
}, onPointerLeave: () => {
|
|
79
|
+
setIsTooltipVisible(false);
|
|
80
|
+
}, children: [isTooltipVisible && overlay ? (_jsx(TooltipOverLayContainer, { ref: tooltipRef, className: "sc-tooltip-overlay", placement: placement, style: overlayStyle, children: _jsx(TooltipText, { className: "sc-tooltip-overlay-text", children: overlay }) })) : null, _jsx("div", { ref: childrenRef, children: children })] }));
|
|
81
|
+
}
|
|
82
|
+
export { Tooltip };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const TOP = "top";
|
|
3
|
+
export declare const BOTTOM = "bottom";
|
|
4
|
+
type Position = typeof TOP | typeof BOTTOM;
|
|
5
|
+
type Props = {
|
|
6
|
+
id: string;
|
|
7
|
+
spec: Record<string, any>;
|
|
8
|
+
tooltipPosition?: Position;
|
|
9
|
+
theme?: 'light' | 'dark' | 'custom';
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
declare function VegaChart({ id, spec, tooltipPosition, theme, }: Props): JSX.Element;
|
|
13
|
+
export { VegaChart };
|
|
14
|
+
//# sourceMappingURL=VegaChart.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VegaChart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/vegachart/VegaChart.component.tsx"],"names":[],"mappings":";AAKA,eAAO,MAAM,GAAG,QAAQ,CAAC;AACzB,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,KAAK,QAAQ,GAAG,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;AAC3C,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA0BF,iBAAS,SAAS,CAAC,EACjB,EAAE,EACF,IAAI,EACJ,eAAwB,EACxB,KAAgB,GACjB,EAAE,KAAK,eAkGP;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|