@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,209 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { Loader } from '../loader/Loader.component';
|
|
5
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
6
|
+
import { useQuery } from 'react-query';
|
|
7
|
+
export const iconTable = {
|
|
8
|
+
Account: 'fas faWallet',
|
|
9
|
+
Backend: 'fas faNetworkWired',
|
|
10
|
+
Tape: 'fas faTape',
|
|
11
|
+
'Node-backend': 'fas faServer',
|
|
12
|
+
'Volume-backend': 'fas faHdd',
|
|
13
|
+
'Node-pdf': 'fas faDatabase',
|
|
14
|
+
'Volume-pdf': 'fas faCompactDisc',
|
|
15
|
+
Network: 'fas faProjectDiagram',
|
|
16
|
+
Bucket: 'fas faGlassWhiskey',
|
|
17
|
+
'Cloud-backend': 'fas faCloud',
|
|
18
|
+
Datacenter: 'fas faWarehouse',
|
|
19
|
+
'Simple-user': 'fas faUser',
|
|
20
|
+
User: 'fas faUserCog',
|
|
21
|
+
Group: 'fas faUsers',
|
|
22
|
+
Alert: 'fas faBell',
|
|
23
|
+
Bell: 'far faBell',
|
|
24
|
+
'Lat-menu': 'fas faBars',
|
|
25
|
+
Dashboard: 'fas faDesktop',
|
|
26
|
+
Workflow: 'fas faRoute',
|
|
27
|
+
Expiration: 'fas faStopwatch',
|
|
28
|
+
Replication: 'fas faCoins',
|
|
29
|
+
Transition: 'fas faRocket',
|
|
30
|
+
Discovery: 'fas faReply',
|
|
31
|
+
Metrics: 'fas faChartLine',
|
|
32
|
+
Edit: 'fas faEdit',
|
|
33
|
+
Logs: 'far faFileAlt',
|
|
34
|
+
Lock: 'fa faLock',
|
|
35
|
+
'Lock-open': 'fa faLockOpen',
|
|
36
|
+
'Create-add': 'fas faPlus',
|
|
37
|
+
Delete: 'fas faTrash',
|
|
38
|
+
Save: 'fas faSave',
|
|
39
|
+
'External-link': 'fas faExternalLinkAlt',
|
|
40
|
+
Link: 'fas faLink',
|
|
41
|
+
Unlink: 'fas faUnlink',
|
|
42
|
+
Close: 'fas faTimes',
|
|
43
|
+
'Dropdown-down': 'fas faCaretDown',
|
|
44
|
+
'Dropdown-up': 'fas faCaretUp',
|
|
45
|
+
Search: 'fas faSearch',
|
|
46
|
+
More: 'fas faEllipsisV',
|
|
47
|
+
Info: 'fas faQuestionCircle',
|
|
48
|
+
Sync: 'fas faSync',
|
|
49
|
+
Export: 'fas faFileExport',
|
|
50
|
+
Copy: 'far faClone',
|
|
51
|
+
'Simple-upload': 'fas faUpload',
|
|
52
|
+
Upload: 'fas faFileUpload',
|
|
53
|
+
'Add-plus': 'fas faPlusSquare',
|
|
54
|
+
Minus: 'fas faMinus',
|
|
55
|
+
'Remove-minus': 'fas faMinusSquare',
|
|
56
|
+
Sort: 'fas faSort',
|
|
57
|
+
'Sort-up': 'fas faSortUp',
|
|
58
|
+
'Sort-down': 'fas faSortDown',
|
|
59
|
+
Calendar: 'fas faCalendarWeek',
|
|
60
|
+
'Calendar-minus': 'fas faCalendarMinus',
|
|
61
|
+
'Arrow-up': 'fas faArrowUp',
|
|
62
|
+
'Arrow-down': 'fas faArrowDown',
|
|
63
|
+
'Arrow-right': 'fas faArrowRight',
|
|
64
|
+
'Arrow-left': 'fas faArrowLeft',
|
|
65
|
+
'Arrow-alt-circle-up': 'fas faArrowAltCircleUp',
|
|
66
|
+
Folder: 'far faFolder',
|
|
67
|
+
File: 'far faFile',
|
|
68
|
+
'File-invoice': 'fas faFileInvoice',
|
|
69
|
+
'Deletion-marker': 'fas faBan',
|
|
70
|
+
'Map-marker': 'fas faMapMarkerAlt',
|
|
71
|
+
Location: 'fas faMapMarkerAlt',
|
|
72
|
+
'Info-circle': 'fas faInfoCircle',
|
|
73
|
+
'Exclamation-triangle': 'fas faExclamationTriangle',
|
|
74
|
+
'Exclamation-circle': 'fas faExclamationCircle',
|
|
75
|
+
Exclamation: 'fas faExclamation',
|
|
76
|
+
Check: 'fas faCheck',
|
|
77
|
+
Protected: 'fas faShieldAlt',
|
|
78
|
+
'Chevron-left': 'fas faChevronLeft',
|
|
79
|
+
'Chevron-right': 'fas faChevronRight',
|
|
80
|
+
'Chevron-down': 'fas faChevronDown',
|
|
81
|
+
'Chevron-up': 'fas faChevronUp',
|
|
82
|
+
'Angle-right': 'fas faAngleRight',
|
|
83
|
+
'Angle-double-right': 'fas faAngleDoubleRight',
|
|
84
|
+
Language: 'fas faLanguage',
|
|
85
|
+
Theme: 'fas faPalette',
|
|
86
|
+
Documentation: 'fas faClipboardList',
|
|
87
|
+
Support: 'fas faComments',
|
|
88
|
+
EULA: 'fas faFileContract',
|
|
89
|
+
'Log-out': 'fas faSignOutAlt',
|
|
90
|
+
Hourglass: 'far faHourglass',
|
|
91
|
+
Pause: 'fas faPause',
|
|
92
|
+
'Pause-circle': 'far faPauseCircle',
|
|
93
|
+
'Play-circle': 'far faPlayCircle',
|
|
94
|
+
Upgrade: 'fas faLevelUpAlt',
|
|
95
|
+
Expansion: 'fas faExpandAlt',
|
|
96
|
+
Rebalance: 'fas faBalanceScale',
|
|
97
|
+
Maintenance: 'fas faHardHat',
|
|
98
|
+
Role: 'fas faHatCowboy',
|
|
99
|
+
'Change-erasure': 'fas faExchangeAlt',
|
|
100
|
+
'Circle-health': 'fas faCircle',
|
|
101
|
+
'Circle-empty': 'far faCircle',
|
|
102
|
+
'Dot-circle': 'fas faDotCircle',
|
|
103
|
+
'Check-circle': 'fas faCheckCircle',
|
|
104
|
+
'Times-circle': 'fas faTimesCircle',
|
|
105
|
+
Toolbox: 'fas faToolbox',
|
|
106
|
+
Cubes: 'fas faCubes',
|
|
107
|
+
'File-alt': 'fas faFilesAlt',
|
|
108
|
+
Policy: 'fas faFileSignature',
|
|
109
|
+
Pen: 'fa faPen',
|
|
110
|
+
Pencil: 'fas faPencilAlt',
|
|
111
|
+
Eye: 'fas faEye',
|
|
112
|
+
EyeSlash: 'fas faEyeSlash',
|
|
113
|
+
Snowflake: 'fas faSnowflake',
|
|
114
|
+
Key: 'fas faKey',
|
|
115
|
+
Filter: 'fas faFilter',
|
|
116
|
+
Download: 'fas faDownload',
|
|
117
|
+
Certificate: 'fas faCertificate',
|
|
118
|
+
Redo: 'fas faRedoAlt',
|
|
119
|
+
Eraser: 'fas faEraser',
|
|
120
|
+
'ID-card': 'fas faIdCard',
|
|
121
|
+
Setting: 'fas faCog', //TODO: Rename to Gear in FA v6 <i class="fa-sharp fa-solid fa-gear"></i>
|
|
122
|
+
};
|
|
123
|
+
const IconStyled = styled(FontAwesomeIcon) `
|
|
124
|
+
${(props) => {
|
|
125
|
+
const theme = props.theme;
|
|
126
|
+
if (props.color && theme[props.color]) {
|
|
127
|
+
return css `
|
|
128
|
+
color: ${theme[props.color]};
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
131
|
+
}}
|
|
132
|
+
`;
|
|
133
|
+
const DelayedFallback = ({ children, ...rest }) => {
|
|
134
|
+
const [show, setShow] = useState(false);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
let timeout = setTimeout(() => setShow(true), 300);
|
|
137
|
+
return () => {
|
|
138
|
+
clearTimeout(timeout);
|
|
139
|
+
};
|
|
140
|
+
}, []);
|
|
141
|
+
return _jsx("i", { ...rest, children: show && children });
|
|
142
|
+
};
|
|
143
|
+
export const IconWrapper = styled.div `
|
|
144
|
+
${(props) => {
|
|
145
|
+
const brand = props.theme;
|
|
146
|
+
return css `
|
|
147
|
+
color: ${brand.infoPrimary};
|
|
148
|
+
border: 1px solid ${brand.infoPrimary};
|
|
149
|
+
background: ${brand.backgroundLevel1};
|
|
150
|
+
${props.size === 'lg'
|
|
151
|
+
? `
|
|
152
|
+
width: 2.5rem;
|
|
153
|
+
height: 2.5rem;
|
|
154
|
+
`
|
|
155
|
+
: props.size === 'sm'
|
|
156
|
+
? `
|
|
157
|
+
width: 1.75rem;
|
|
158
|
+
height: 1.75rem;
|
|
159
|
+
`
|
|
160
|
+
: props.size === 'xs'
|
|
161
|
+
? `
|
|
162
|
+
width: 1.5rem;
|
|
163
|
+
height: 1.5rem;
|
|
164
|
+
`
|
|
165
|
+
: `
|
|
166
|
+
width: ${parseInt(props.size.replace('x', '')) * 2}rem;
|
|
167
|
+
height: ${parseInt(props.size.replace('x', '')) * 2}rem;
|
|
168
|
+
`}
|
|
169
|
+
`;
|
|
170
|
+
}}
|
|
171
|
+
|
|
172
|
+
display: flex;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
align-items: center;
|
|
175
|
+
border-radius: 100%;
|
|
176
|
+
`;
|
|
177
|
+
function NonWrappedIcon({ name, size = '1x', color = undefined, ariaLabel = '', ...rest }) {
|
|
178
|
+
const iconInfo = iconTable[name];
|
|
179
|
+
if (!iconInfo)
|
|
180
|
+
throw new Error(`${name}: is not a valid icon.`);
|
|
181
|
+
const { data, status } = useQuery({
|
|
182
|
+
queryKey: ['icon', name],
|
|
183
|
+
queryFn: async () => {
|
|
184
|
+
const [iconType, iconClass] = iconInfo.split(' ');
|
|
185
|
+
try {
|
|
186
|
+
const fontAwesomeType = iconType === 'far'
|
|
187
|
+
? 'free-regular-svg-icons'
|
|
188
|
+
: 'free-solid-svg-icons';
|
|
189
|
+
const icon = await import(`@fortawesome/${fontAwesomeType}/${iconClass}.js`);
|
|
190
|
+
return {
|
|
191
|
+
default: ({ name, color, size, ariaLabel, ...rest }) => (_jsx(IconStyled, { color: color, icon: icon[iconClass], size: size, "aria-label": `${name} ${ariaLabel}`, ...rest })),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return {
|
|
196
|
+
default: ({ name, ariaLabel }) => (_jsx(Loader, { size: "base", "aria-label": `${name} ${ariaLabel}` })),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
return (_jsxs(_Fragment, { children: [(status === 'loading' || status === 'error') && (_jsx(DelayedFallback, { "aria-label": `${name} ${ariaLabel}`, children: _jsx(Loader, { size: "base" }) })), status === 'success' && (_jsx(data.default, { name: name, color: color, size: size, ariaLabel: ariaLabel, ...rest }))] }));
|
|
202
|
+
}
|
|
203
|
+
function Icon({ withWrapper, ...props }) {
|
|
204
|
+
if (withWrapper) {
|
|
205
|
+
return (_jsx(IconWrapper, { size: props.size || '1x', children: _jsx(NonWrappedIcon, { ...props }) }));
|
|
206
|
+
}
|
|
207
|
+
return _jsx(NonWrappedIcon, { ...props });
|
|
208
|
+
}
|
|
209
|
+
export { Icon };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
title: string | React.ReactNode;
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
link?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const InfoMessage: ({ title, content, link }: Props) => JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=InfoMessage.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoMessage.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/infomessage/InfoMessage.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAChC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAYF,eAAO,MAAM,WAAW,6BAA8B,KAAK,gBAuB1D,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled, { useTheme } from 'styled-components';
|
|
3
|
+
import { Stack } from '../../spacing';
|
|
4
|
+
import { Icon } from '../icon/Icon.component';
|
|
5
|
+
import { Link, Text } from '../text/Text.component';
|
|
6
|
+
import { useComputeBackgroundColor } from './InfoMessageUtils';
|
|
7
|
+
const InfoMessageContainer = styled.div `
|
|
8
|
+
background-color: ${(props) => props.theme.backgroundLevel2};
|
|
9
|
+
border-radius: 3px;
|
|
10
|
+
padding: 0.5rem;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 0.5rem;
|
|
14
|
+
color: white;
|
|
15
|
+
`;
|
|
16
|
+
export const InfoMessage = ({ title, content, link }) => {
|
|
17
|
+
const { containerRef, backgroundColor } = useComputeBackgroundColor();
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
return (_jsxs(InfoMessageContainer, { ref: containerRef, style: { backgroundColor: backgroundColor }, children: [_jsxs(Stack, { children: [_jsx(Icon, { name: "Info-circle", color: theme.infoPrimary, size: "lg" }), typeof title === 'string' ? _jsx(Text, { isEmphazed: true, children: title }) : title] }), _jsx(Text, { color: "textSecondary", isGentleEmphazed: true, children: content }), link && (_jsxs(Link, { href: link, target: "_blank", style: { alignSelf: 'flex-end' }, children: ["More infos ", _jsx(Icon, { name: "External-link" })] }))] }));
|
|
20
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DefaultTheme } from "styled-components";
|
|
3
|
+
export declare const useComputeBackgroundColor: () => {
|
|
4
|
+
containerRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getBackgroundColor: (element: HTMLElement, theme: DefaultTheme) => any;
|
|
8
|
+
//# sourceMappingURL=InfoMessageUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoMessageUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/components/infomessage/InfoMessageUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAY,MAAM,mBAAmB,CAAC;AAI3D,eAAO,MAAM,yBAAyB;;;CAcnC,CAAC;AAEJ,eAAO,MAAM,kBAAkB,YAAa,WAAW,SAAS,YAAY,QAkBzE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useTheme } from "styled-components";
|
|
2
|
+
import { hex2RGB } from "../../utils";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
export const useComputeBackgroundColor = () => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
const containerRef = useRef(null);
|
|
7
|
+
const [backgroundColor, setBackgroundColor] = useState('');
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
containerRef.current &&
|
|
10
|
+
setBackgroundColor(getBackgroundColor(containerRef.current, theme));
|
|
11
|
+
}, [containerRef, theme]);
|
|
12
|
+
return {
|
|
13
|
+
containerRef,
|
|
14
|
+
backgroundColor,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export const getBackgroundColor = (element, theme) => {
|
|
18
|
+
if (element.parentElement) {
|
|
19
|
+
const parentElementBackgroundColor = window.getComputedStyle(element.parentElement)['background-color'];
|
|
20
|
+
if (/rgba\([0-9]+, [0-9]+, [0-9]+, 0\)/.test(parentElementBackgroundColor) || !window.getComputedStyle(element.parentElement)['background-color']) {
|
|
21
|
+
return getBackgroundColor(element.parentElement, theme);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const rgbArray = hex2RGB(theme.backgroundLevel2);
|
|
25
|
+
if (`rgb(${rgbArray[0]}, ${rgbArray[1]}, ${rgbArray[2]})` ===
|
|
26
|
+
parentElementBackgroundColor) {
|
|
27
|
+
return theme.backgroundLevel3;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return theme.backgroundLevel2;
|
|
32
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ChangeEvent, HTMLAttributes, HTMLProps } from 'react';
|
|
2
|
+
import { DebounceInputProps } from 'react-debounce-input';
|
|
3
|
+
export type Item = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string | number;
|
|
6
|
+
};
|
|
7
|
+
type Items = Array<Item>;
|
|
8
|
+
export type InputProps = {
|
|
9
|
+
value: any;
|
|
10
|
+
type?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
checked?: boolean;
|
|
16
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
options?: Items;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
min?: string;
|
|
20
|
+
max?: string;
|
|
21
|
+
} & HTMLProps<HTMLInputElement> & DebounceInputProps<HTMLInputElement, HTMLAttributes<HTMLInputElement>>;
|
|
22
|
+
declare const Input: ({ label, id, error, type, disabled, ...rest }: InputProps) => JSX.Element;
|
|
23
|
+
export { Input };
|
|
24
|
+
//# sourceMappingURL=Input.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/input/Input.component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AACvE,OAAO,EAAiB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAWzE,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AACF,KAAK,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACrD,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,SAAS,CAAC,gBAAgB,CAAC,GAC7B,kBAAkB,CAAC,gBAAgB,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAoHzE,QAAA,MAAM,KAAK,kDAAmD,UAAU,gBAuBvE,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { DebounceInput } from 'react-debounce-input';
|
|
5
|
+
import { Checkbox } from '../checkbox/Checkbox.component';
|
|
6
|
+
import { Icon } from '../icon/Icon.component';
|
|
7
|
+
import { Select } from '../select/Select.component';
|
|
8
|
+
import { TextArea } from '../textarea/TextArea.component';
|
|
9
|
+
import { InputContainer, LabelStyle, InputErrorMessage, InputWrapper, } from './Input.component.style';
|
|
10
|
+
const InputRenderer = ({ type, id, value, checked, onChange, options = [], min, max, ...rest }) => {
|
|
11
|
+
const inputEl = useRef(null);
|
|
12
|
+
const handleNumberClick = (e) => {
|
|
13
|
+
/*
|
|
14
|
+
** Since react is using Synthetic event we have to do the following to be
|
|
15
|
+
** able to programmatically dispatch the onChange event from the input
|
|
16
|
+
*/
|
|
17
|
+
const valuePropDescriptor = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value');
|
|
18
|
+
if (valuePropDescriptor && inputEl.current) {
|
|
19
|
+
const nativeInputValueSetter = valuePropDescriptor.set;
|
|
20
|
+
if (nativeInputValueSetter) {
|
|
21
|
+
if (e.target.dataset.core === 'up')
|
|
22
|
+
nativeInputValueSetter.call(inputEl.current, max
|
|
23
|
+
? max && parseInt(value) + 1 <= parseInt(max)
|
|
24
|
+
? parseInt(value) + 1
|
|
25
|
+
: parseInt(value)
|
|
26
|
+
: parseInt(value) + 1);
|
|
27
|
+
else
|
|
28
|
+
nativeInputValueSetter.call(inputEl.current, min
|
|
29
|
+
? min && parseInt(value) - 1 >= parseInt(min)
|
|
30
|
+
? parseInt(value) - 1
|
|
31
|
+
: parseInt(value)
|
|
32
|
+
: parseInt(value) - 1);
|
|
33
|
+
}
|
|
34
|
+
const event = new Event('input', {
|
|
35
|
+
bubbles: true,
|
|
36
|
+
});
|
|
37
|
+
inputEl.current.dispatchEvent(event);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const input = {
|
|
41
|
+
select: (_jsx(Select, { id: id, value: value, onChange: onChange, options: options, ...rest })),
|
|
42
|
+
checkbox: (_jsx(Checkbox, { id: id, value: value, checked: !!checked, onChange: onChange, ...rest })),
|
|
43
|
+
textarea: _jsx(TextArea, { id: id, value: value, onChange: onChange, ...rest }),
|
|
44
|
+
number: (_jsxs("div", { className: "sc-number-input-wrapper", children: [_jsx("input", { className: "sc-input-type sc-number-input", type: "number", id: id, value: value, onChange: onChange, ref: inputEl, min: min, max: max, ...rest }), _jsxs("div", { className: "carets-wrapper", children: [_jsx(Icon, { name: "Dropdown-up", "data-core": "up", onClick: handleNumberClick }), _jsx(Icon, { name: "Dropdown-down", "data-core": "down", onClick: handleNumberClick })] })] })),
|
|
45
|
+
text: (_jsx(DebounceInput, { className: "sc-input-type", minLength: 1, debounceTimeout: 300, id: id, value: value, onChange: onChange, autoComplete: "off", ...rest })),
|
|
46
|
+
};
|
|
47
|
+
if (type)
|
|
48
|
+
return input[type];
|
|
49
|
+
else
|
|
50
|
+
return input.text;
|
|
51
|
+
};
|
|
52
|
+
const Input = ({ label, id, error, type, disabled, ...rest }) => {
|
|
53
|
+
return (_jsxs(InputContainer, { className: "sc-input", disabled: disabled, error: error, type: type, children: [label && (_jsx(LabelStyle, { htmlFor: id, className: "sc-input-label", children: label })), _jsxs(InputWrapper, { className: "sc-input-wrapper", children: [_jsx(InputRenderer, { id: id, type: type, disabled: disabled, ...rest }), error && (_jsx(InputErrorMessage, { className: "sc-input-error", children: error }))] })] }));
|
|
54
|
+
};
|
|
55
|
+
export { Input };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const InputContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
2
|
+
disabled: boolean;
|
|
3
|
+
error: string;
|
|
4
|
+
type: string;
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const LabelStyle: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const InputErrorMessage: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const InputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
+
//# sourceMappingURL=Input.component.style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.component.style.d.ts","sourceRoot":"","sources":["../../../src/lib/components/input/Input.component.style.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;cACf,OAAO;WACV,MAAM;UACP,MAAM;SAsHb,CAAC;AACF,eAAO,MAAM,UAAU,2GAKtB,CAAC;AACF,eAAO,MAAM,iBAAiB,0GAI7B,CAAC;AACF,eAAO,MAAM,YAAY,yGAGxB,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { spacing } from '../../spacing';
|
|
3
|
+
import { fontSize } from '../../style/theme';
|
|
4
|
+
import { getThemePropSelector } from '../../utils';
|
|
5
|
+
export const InputContainer = styled.div `
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
${(props) => {
|
|
8
|
+
if (props.disabled) {
|
|
9
|
+
return css `
|
|
10
|
+
opacity: 0.3;
|
|
11
|
+
input,
|
|
12
|
+
textarea,
|
|
13
|
+
select,
|
|
14
|
+
i {
|
|
15
|
+
cursor: not-allowed;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
}}
|
|
20
|
+
.sc-checkbox {
|
|
21
|
+
margin: ${spacing.r4} 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.sc-select {
|
|
25
|
+
width: 200px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
input.sc-input-type {
|
|
29
|
+
${(props) => {
|
|
30
|
+
const { backgroundLevel1, statusCritical, textSecondary, border } = props.theme;
|
|
31
|
+
return css `
|
|
32
|
+
background-color: ${backgroundLevel1};
|
|
33
|
+
color: ${textSecondary};
|
|
34
|
+
border: 1px solid ${props.error ? statusCritical : border};
|
|
35
|
+
`;
|
|
36
|
+
}};
|
|
37
|
+
padding: 8px ${spacing.r8};
|
|
38
|
+
font-size: ${fontSize.base};
|
|
39
|
+
display: block;
|
|
40
|
+
border-radius: 4px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
input.sc-input-type:focus {
|
|
44
|
+
border-color: ${getThemePropSelector('selectedActive')};
|
|
45
|
+
outline: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
input[type='number'] {
|
|
49
|
+
/* Adding a padding to make room for the custom absolute postionned arrows */
|
|
50
|
+
padding-right: 20px;
|
|
51
|
+
-moz-appearance: textfield; /*For FireFox*/
|
|
52
|
+
|
|
53
|
+
&::-webkit-inner-spin-button {
|
|
54
|
+
/*For Webkits like Chrome and Safari*/
|
|
55
|
+
-webkit-appearance: none;
|
|
56
|
+
margin: 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
${(props) => {
|
|
61
|
+
if (props.type === 'number')
|
|
62
|
+
return css `
|
|
63
|
+
.sc-input-wrapper {
|
|
64
|
+
.sc-number-input-wrapper {
|
|
65
|
+
position: relative;
|
|
66
|
+
}
|
|
67
|
+
align-items: baseline;
|
|
68
|
+
.carets-wrapper {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
${(props) => {
|
|
72
|
+
const { textSecondary } = props.theme;
|
|
73
|
+
return css `
|
|
74
|
+
color: ${textSecondary};
|
|
75
|
+
`;
|
|
76
|
+
}};
|
|
77
|
+
position: absolute;
|
|
78
|
+
right: ${spacing.r4};
|
|
79
|
+
top: 50%;
|
|
80
|
+
transform: translate(-50%, -50%);
|
|
81
|
+
|
|
82
|
+
i {
|
|
83
|
+
font-size: 0.8em;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
}}
|
|
90
|
+
|
|
91
|
+
${(props) => {
|
|
92
|
+
if (props.error) {
|
|
93
|
+
return css `
|
|
94
|
+
@keyframes shake {
|
|
95
|
+
from,
|
|
96
|
+
to {
|
|
97
|
+
transform: translate3d(0, 0, 0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
10%,
|
|
101
|
+
30%,
|
|
102
|
+
50%,
|
|
103
|
+
70%,
|
|
104
|
+
90% {
|
|
105
|
+
transform: translate3d(-5px, 0, 0);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
20%,
|
|
109
|
+
40%,
|
|
110
|
+
60%,
|
|
111
|
+
80% {
|
|
112
|
+
transform: translate3d(5px, 0, 0);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
animation-duration: 1s;
|
|
116
|
+
animation-fill-mode: both;
|
|
117
|
+
animation-name: shake;
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
}};
|
|
121
|
+
`;
|
|
122
|
+
export const LabelStyle = styled.label `
|
|
123
|
+
align-self: flex-start;
|
|
124
|
+
padding: ${spacing.r8};
|
|
125
|
+
font-size: ${fontSize.base};
|
|
126
|
+
color: ${getThemePropSelector('textPrimary')};
|
|
127
|
+
`;
|
|
128
|
+
export const InputErrorMessage = styled.span `
|
|
129
|
+
color: ${getThemePropSelector('statusCritical')};
|
|
130
|
+
margin: ${spacing.r4} 0;
|
|
131
|
+
font-size: ${fontSize.small};
|
|
132
|
+
`;
|
|
133
|
+
export const InputWrapper = styled.div `
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CSSProperties } from 'styled-components';
|
|
3
|
+
type AddButtonProps<T = unknown> = {
|
|
4
|
+
index: number;
|
|
5
|
+
items: Array<T>;
|
|
6
|
+
insertEntry: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
iconStyle?: CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export declare const AddButton: ({ index, items, insertEntry, disabled, iconStyle, }: AddButtonProps) => JSX.Element;
|
|
11
|
+
type SubButtonProps<T = unknown> = {
|
|
12
|
+
index: number;
|
|
13
|
+
items: Array<T>;
|
|
14
|
+
deleteEntry: (arg0: number) => void;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
iconStyle?: CSSProperties;
|
|
17
|
+
};
|
|
18
|
+
export declare const SubButton: ({ index, items, deleteEntry, disabled, iconStyle, }: SubButtonProps) => JSX.Element;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=InputButtons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputButtons.d.ts","sourceRoot":"","sources":["../../../src/lib/components/inputlist/InputButtons.tsx"],"names":[],"mappings":";AAAA,OAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAgB1D,KAAK,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,SAAS,wDAMnB,cAAc,gBA2ChB,CAAC;AACF,KAAK,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B,CAAC;AACF,eAAO,MAAM,SAAS,wDAMnB,cAAc,gBAuBhB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Button } from '../buttonv2/Buttonv2.component';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
5
|
+
import { Box } from '../box/Box';
|
|
6
|
+
import { Icon } from '../icon/Icon.component';
|
|
7
|
+
const CustomButton = styled(Button) `
|
|
8
|
+
${(props) => !props.isVisible
|
|
9
|
+
? `
|
|
10
|
+
display: none;
|
|
11
|
+
`
|
|
12
|
+
: ''}
|
|
13
|
+
`;
|
|
14
|
+
const isEmptyItem = (item) => item.key === '' && item.value === '';
|
|
15
|
+
export const AddButton = ({ index, items, insertEntry, disabled, iconStyle, }) => {
|
|
16
|
+
const itemsLength = items.length;
|
|
17
|
+
const itemsIndex = items[index];
|
|
18
|
+
const itemsIndexKey = items[index].key;
|
|
19
|
+
const itemsIndexValue = items[index].value;
|
|
20
|
+
const isDisabled = useMemo(() => {
|
|
21
|
+
if (itemsIndex && itemsIndexKey === '' && itemsIndexValue === '') {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return disabled || false;
|
|
25
|
+
}, [itemsIndex, itemsIndexKey, itemsIndexValue, disabled]);
|
|
26
|
+
const isVisible = useMemo(() => {
|
|
27
|
+
return !(itemsLength > 0 && index !== itemsLength - 1);
|
|
28
|
+
}, [itemsLength, index]);
|
|
29
|
+
const onClickFn = useCallback(() => {
|
|
30
|
+
if (!(itemsLength > 0 && index !== itemsLength - 1)) {
|
|
31
|
+
insertEntry();
|
|
32
|
+
}
|
|
33
|
+
}, [itemsLength, index, insertEntry]);
|
|
34
|
+
return (_jsxs(_Fragment, { children: [!isVisible && _jsx(Box, { ml: 16 }), _jsx(CustomButton, { isVisible: isVisible, type: "button", variant: "outline", disabled: isDisabled, name: `addbtn${index}`, id: `addbtn${index}`, onClick: onClickFn, "aria-label": `Add${index}`, tooltip: {
|
|
35
|
+
overlay: 'Add',
|
|
36
|
+
placement: 'top',
|
|
37
|
+
}, icon: _jsx(Icon, { name: "Add-plus" }) })] }));
|
|
38
|
+
};
|
|
39
|
+
export const SubButton = ({ index, items, deleteEntry, disabled, iconStyle, }) => {
|
|
40
|
+
let isDisabled = disabled || false;
|
|
41
|
+
if (items.length === 1 && isEmptyItem(items[0])) {
|
|
42
|
+
isDisabled = true;
|
|
43
|
+
}
|
|
44
|
+
return (_jsx(Button, { variant: "danger", type: "button", disabled: isDisabled, "aria-label": `Remove${index}`, name: `delbtn${index}`, id: `delbtn${index}`, onClick: () => deleteEntry(index), tooltip: {
|
|
45
|
+
overlay: 'Remove',
|
|
46
|
+
placement: 'top',
|
|
47
|
+
}, icon: _jsx(Icon, { name: "Remove-minus" }) }));
|
|
48
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HTMLProps } from 'react';
|
|
2
|
+
import { RefCallBack } from 'react-hook-form';
|
|
3
|
+
export type InputListProps<T> = Omit<HTMLProps<HTMLInputElement>, 'size'> & {
|
|
4
|
+
ref: RefCallBack;
|
|
5
|
+
min?: string | number;
|
|
6
|
+
max?: string | number;
|
|
7
|
+
maxLength?: number;
|
|
8
|
+
minLength?: number;
|
|
9
|
+
pattern?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
maxItems?: number;
|
|
13
|
+
value: T[];
|
|
14
|
+
};
|
|
15
|
+
export declare const InputList: import("react").ForwardRefExoticComponent<Omit<Omit<HTMLProps<HTMLInputElement>, "size"> & {
|
|
16
|
+
ref: RefCallBack;
|
|
17
|
+
min?: string | number | undefined;
|
|
18
|
+
max?: string | number | undefined;
|
|
19
|
+
maxLength?: number | undefined;
|
|
20
|
+
minLength?: number | undefined;
|
|
21
|
+
pattern?: string | undefined;
|
|
22
|
+
required?: boolean | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
maxItems?: number | undefined;
|
|
25
|
+
value: (string | number | readonly string[] | undefined)[];
|
|
26
|
+
}, "ref"> & import("react").RefAttributes<unknown>>;
|
|
27
|
+
//# sourceMappingURL=InputList.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputList.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/inputlist/InputList.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9C,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,GAAG;IAC1E,GAAG,EAAE,WAAW,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,CAAC,EAAE,CAAC;CACZ,CAAC;AAgFF,eAAO,MAAM,SAAS;SA1Ff,WAAW;;;;;;;;;;mDA0FoC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { Box } from '../box/Box';
|
|
4
|
+
import { Input } from '../inputv2/inputv2';
|
|
5
|
+
import { AddButton, SubButton } from './InputButtons';
|
|
6
|
+
function InternalInputList({ onChange, onBlur, min, max, maxLength, minLength, pattern, required, disabled, maxItems, value, name, ...rest }, _) {
|
|
7
|
+
const isMaxItemsReached = maxItems !== undefined && maxItems !== null && value.length === maxItems;
|
|
8
|
+
const insertEntry = () => {
|
|
9
|
+
if (!isMaxItemsReached) {
|
|
10
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
11
|
+
target: { value: [...(value !== null && value !== void 0 ? value : []), ''] },
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const deleteEntry = (entryIndex) => {
|
|
16
|
+
const newValues = value.filter((_, index) => index !== entryIndex);
|
|
17
|
+
const updatedValues = newValues.length === 0 ? [''] : newValues;
|
|
18
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
19
|
+
target: { value: updatedValues },
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
return (_jsx(_Fragment, { children: value.map((val, index) => (_jsxs(Box, { display: "flex", gap: "0.25rem", alignItems: "center", children: [_jsx(Input, { id: `${name}[${index}]`, "aria-label": `${name}${index}`, size: "1/2", value: val, onChange: (evt) => {
|
|
23
|
+
const tempValues = [...value];
|
|
24
|
+
tempValues[index] = evt.target.value;
|
|
25
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
26
|
+
target: { value: tempValues },
|
|
27
|
+
});
|
|
28
|
+
}, ...rest }), _jsx(SubButton, { index: index, deleteEntry: deleteEntry, items: value, disabled: value.length === 1 && value[0] === '' }, `${name}-delete-${value.join(',') + index}`), _jsx(AddButton, { index: index, insertEntry: insertEntry, items: value, disabled: val === '' || isMaxItemsReached }, `${name}-add-${value.join(',') + index}`)] }, index))) }));
|
|
29
|
+
}
|
|
30
|
+
export const InputList = forwardRef(InternalInputList);
|