@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,89 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import React, { createContext, useEffect, useState, useCallback } from 'react';
|
|
4
|
+
import { TabBar, ScrollableContainer, TabContent, TabItem, TabsContainer, TabsScroller, } from './StyledTabs';
|
|
5
|
+
import { useHistory, useLocation, useRouteMatch, matchPath, Route, } from 'react-router-dom';
|
|
6
|
+
import { SecondaryText, BasicText, EmphaseText } from '../text/Text.component';
|
|
7
|
+
import { ScrollButton } from './ScrollButton';
|
|
8
|
+
import { Tab } from './Tab';
|
|
9
|
+
import { useScrollingTabs } from './useScrollingTabs';
|
|
10
|
+
import { ButtonIcon } from '../buttonv2/Buttonv2.component';
|
|
11
|
+
import styled from 'styled-components';
|
|
12
|
+
export const TabsContext = createContext(false);
|
|
13
|
+
const TabIcon = styled(ButtonIcon) `
|
|
14
|
+
color: ${(props) => props.theme.textSecondary};
|
|
15
|
+
`;
|
|
16
|
+
function Tabs({ activeTabColor, activeTabSeparator, tabLineColor, inactiveTabColor, tabContentColor, separatorColor, tabHoverColor, children, className, ...rest }) {
|
|
17
|
+
const location = useLocation();
|
|
18
|
+
const history = useHistory();
|
|
19
|
+
const { url } = useRouteMatch();
|
|
20
|
+
const [selectedTabIndex, setSelectedTabIndex] = useState(null);
|
|
21
|
+
const queryURL = new URLSearchParams(location.search);
|
|
22
|
+
const filteredTabsChildren = React.Children.toArray(children).filter((child) => React.isValidElement(child) && child.type === Tab);
|
|
23
|
+
const matchQuery = useCallback((query) => {
|
|
24
|
+
for (const key of Object.keys(query)) {
|
|
25
|
+
// To support the case of {tab:null}
|
|
26
|
+
if (queryURL.get(key) === null && !query[key]) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (!(queryURL.has(key) && queryURL.get(key) === query[key]))
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}, [queryURL]);
|
|
34
|
+
const serialize = (query) => {
|
|
35
|
+
if (!query) {
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const o = Object.fromEntries(Object.entries(query).filter(([_, v]) => v != null));
|
|
40
|
+
//$FlowFixMe
|
|
41
|
+
return '?' + new URLSearchParams(o).toString();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const getPushHistoryPath = (path, query) => {
|
|
45
|
+
if (path.startsWith('/')) {
|
|
46
|
+
return `${path}${serialize(query)}`;
|
|
47
|
+
}
|
|
48
|
+
return `${url}/${path}${serialize(query)}`;
|
|
49
|
+
};
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
let hasSelectedTab = false;
|
|
52
|
+
filteredTabsChildren.forEach((child, index) => {
|
|
53
|
+
const isSelected = !!matchPath(location.pathname, {
|
|
54
|
+
path: child.props.path.startsWith('/')
|
|
55
|
+
? child.props.path
|
|
56
|
+
: url + '/' + child.props.path,
|
|
57
|
+
exact: child.props.exact,
|
|
58
|
+
strict: child.props.strict,
|
|
59
|
+
sensitive: child.props.sensitive,
|
|
60
|
+
}) && (child.props.query ? matchQuery(child.props.query) : true);
|
|
61
|
+
if (isSelected) {
|
|
62
|
+
setSelectedTabIndex(index);
|
|
63
|
+
hasSelectedTab = true;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
if (!hasSelectedTab)
|
|
67
|
+
setSelectedTabIndex(null);
|
|
68
|
+
}, [location.pathname, filteredTabsChildren, matchQuery]);
|
|
69
|
+
const { scrollButtonEndRef, scrollButtonStartRef, tabsListRef, tabsRef, handleStartScrollClick, handleEndScrollClick, handleTabsScroll, handleKeyDown, displayScroll, } = useScrollingTabs(selectedTabIndex);
|
|
70
|
+
const tabItems = filteredTabsChildren.map((child, index) => {
|
|
71
|
+
const { path, query, label, textBadge, children, icon, ...childRest } = child.props;
|
|
72
|
+
const isSelected = selectedTabIndex === index;
|
|
73
|
+
return (_jsxs(TabItem, { className: `sc-tabs-item ${isSelected ? 'selected' : ''}`, role: "tab", onClick: () => history.push(getPushHistoryPath(path, query)), selected: isSelected, tabHoverColor: tabHoverColor, inactiveTabColor: inactiveTabColor, activeTabColor: activeTabColor, activeTabSeparator: activeTabSeparator, tabIndex: isSelected ? 0 : -1, onKeyDown: (event) => {
|
|
74
|
+
if (event.key === ' ' ||
|
|
75
|
+
event.key === 'Enter' ||
|
|
76
|
+
event.key === 'Spacebar') {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
history.push(getPushHistoryPath(path, query));
|
|
79
|
+
}
|
|
80
|
+
}, ...childRest, children: [icon && _jsx(TabIcon, { label: label, children: icon }), isSelected ? (_jsx(BasicText, { className: "sc-tabs-item-title", children: label })) : (_jsx(SecondaryText, { className: "sc-tabs-item-title", children: label })), textBadge && (_jsx(EmphaseText, { className: "sc-tabs-item-icon", children: textBadge }))] }, index));
|
|
81
|
+
});
|
|
82
|
+
return (_jsx(TabsContext.Provider, { value: true, children: _jsxs(TabsContainer, { className: ['sc-tabs', className].join(' '), tabLineColor: tabLineColor, separatorColor: separatorColor, ...rest, children: [_jsxs(ScrollableContainer, { children: [displayScroll.start && (_jsx(ScrollButton, { ref: scrollButtonStartRef, direction: "left", onClick: handleStartScrollClick })), _jsx(TabsScroller, { ref: tabsRef, onScroll: handleTabsScroll, children: _jsx(TabBar, { onKeyDown: handleKeyDown, ref: tabsListRef, className: "sc-tabs-bar", role: "tablist", children: tabItems }) }), displayScroll.end && (_jsx(ScrollButton, { ref: scrollButtonEndRef, direction: "right", onClick: handleEndScrollClick }))] }), _jsx(TabContent, { className: "sc-tabs-item-content", tabContentColor: tabContentColor, children: filteredTabsChildren.map((tab, index) => (_jsx(Route, { exact: tab.props.exact, sensitive: tab.props.sensitive, strict: tab.props.strict, path: tab.props.path.startsWith('/')
|
|
83
|
+
? tab.props.path
|
|
84
|
+
: url + '/' + tab.props.path, children: !tab.props.query ||
|
|
85
|
+
(tab.props.query && matchQuery(tab.props.query)) ? (tab.props.children) : (_jsx(_Fragment, {})) }, index))) })] }) }));
|
|
86
|
+
}
|
|
87
|
+
Tabs.Tab = Tab;
|
|
88
|
+
// re-export Tab
|
|
89
|
+
export { Tabs, Tab };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const useScrollingTabs: (selectedTabIndex: number | null | undefined) => {
|
|
3
|
+
scrollButtonStartRef: import("react").MutableRefObject<HTMLDivElement | null | undefined>;
|
|
4
|
+
scrollButtonEndRef: import("react").MutableRefObject<HTMLDivElement | null | undefined>;
|
|
5
|
+
tabsRef: import("react").MutableRefObject<any>;
|
|
6
|
+
tabsListRef: import("react").RefObject<HTMLDivElement>;
|
|
7
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
8
|
+
handleTabsScroll: () => void;
|
|
9
|
+
handleStartScrollClick: () => void;
|
|
10
|
+
handleEndScrollClick: () => void;
|
|
11
|
+
displayScroll: {
|
|
12
|
+
start: boolean;
|
|
13
|
+
end: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export { useScrollingTabs };
|
|
17
|
+
//# sourceMappingURL=useScrollingTabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollingTabs.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/useScrollingTabs.ts"],"names":[],"mappings":";AAmIA,QAAA,MAAM,gBAAgB,qBAAsB,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;2BA0JrC,aAAa;;;;;;;;CA+C5C,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The Tabs component uses a lot of the code from Material-UI Scrollable Tabs to have the same behavior as it.
|
|
3
|
+
Here is the license of material-ui:
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2014 Call-Em-All
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
28
|
+
function easeInOutSin(time) {
|
|
29
|
+
return (1 + Math.sin(Math.PI * time - Math.PI / 2)) / 2;
|
|
30
|
+
}
|
|
31
|
+
function animate(property, element, to) {
|
|
32
|
+
const duration = 1000; // standard
|
|
33
|
+
let start = null;
|
|
34
|
+
const from = element[property];
|
|
35
|
+
let cancelled = false;
|
|
36
|
+
const cancel = () => {
|
|
37
|
+
cancelled = true;
|
|
38
|
+
};
|
|
39
|
+
const step = (timestamp) => {
|
|
40
|
+
if (cancelled) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (start === null) {
|
|
44
|
+
start = timestamp;
|
|
45
|
+
}
|
|
46
|
+
const time = Math.min(1, (timestamp - start) / duration);
|
|
47
|
+
element[property] = easeInOutSin(time) * (to - from) + from;
|
|
48
|
+
if (time >= 1) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
requestAnimationFrame(step);
|
|
52
|
+
};
|
|
53
|
+
if (from === to) {
|
|
54
|
+
return cancel;
|
|
55
|
+
}
|
|
56
|
+
requestAnimationFrame(step);
|
|
57
|
+
return cancel;
|
|
58
|
+
}
|
|
59
|
+
const nextItem = (list, item) => {
|
|
60
|
+
if (list === item) {
|
|
61
|
+
return list.firstChild;
|
|
62
|
+
}
|
|
63
|
+
if (item && item.nextElementSibling) {
|
|
64
|
+
return item.nextElementSibling;
|
|
65
|
+
}
|
|
66
|
+
return list.firstChild;
|
|
67
|
+
};
|
|
68
|
+
const previousItem = (list, item) => {
|
|
69
|
+
if (list === item) {
|
|
70
|
+
return list.lastChild;
|
|
71
|
+
}
|
|
72
|
+
if (item && item.previousElementSibling) {
|
|
73
|
+
return item.previousElementSibling;
|
|
74
|
+
}
|
|
75
|
+
return list.lastChild;
|
|
76
|
+
};
|
|
77
|
+
const moveFocus = (list, currentFocus, traversalFunction) => {
|
|
78
|
+
let wrappedOnce = false;
|
|
79
|
+
let nextFocus = traversalFunction(list, currentFocus);
|
|
80
|
+
while (nextFocus) {
|
|
81
|
+
// Prevent infinite loop.
|
|
82
|
+
if (nextFocus === list.firstChild) {
|
|
83
|
+
if (wrappedOnce) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
wrappedOnce = true;
|
|
87
|
+
}
|
|
88
|
+
if (!nextFocus.hasAttribute('tabindex')) {
|
|
89
|
+
// Move to the next element.
|
|
90
|
+
nextFocus = traversalFunction(list, nextFocus);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
nextFocus.focus();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const useScrollingTabs = (selectedTabIndex) => {
|
|
99
|
+
const [displayScroll, setDisplayScroll] = useState({
|
|
100
|
+
start: false,
|
|
101
|
+
end: false,
|
|
102
|
+
});
|
|
103
|
+
const scrollButtonEndRef = useRef(null);
|
|
104
|
+
const scrollButtonStartRef = useRef(null);
|
|
105
|
+
const tabsListRef = useRef(null);
|
|
106
|
+
const tabsRef = useRef(null);
|
|
107
|
+
const scroll = (scrollValue) => {
|
|
108
|
+
animate('scrollLeft', tabsRef.current, scrollValue);
|
|
109
|
+
};
|
|
110
|
+
const moveTabsScroll = (delta) => {
|
|
111
|
+
let scrollValue = tabsRef.current.scrollLeft;
|
|
112
|
+
scrollValue += delta;
|
|
113
|
+
scroll(scrollValue);
|
|
114
|
+
};
|
|
115
|
+
const getScrollSize = (isStart = false) => {
|
|
116
|
+
if (!tabsListRef.current)
|
|
117
|
+
return 0;
|
|
118
|
+
const fullContainerSize = tabsListRef.current.clientWidth;
|
|
119
|
+
const containerSize = tabsRef.current.clientWidth;
|
|
120
|
+
let totalSize = 0;
|
|
121
|
+
const children = Array.from(tabsListRef.current.children);
|
|
122
|
+
for (let i = 0; i < children.length; i += 1) {
|
|
123
|
+
const tab = children[i];
|
|
124
|
+
if (totalSize + tab.clientWidth > containerSize) {
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
totalSize += tab.clientWidth;
|
|
128
|
+
}
|
|
129
|
+
const cornerChild = isStart ? children[0] : children[children.length - 1];
|
|
130
|
+
if (totalSize +
|
|
131
|
+
tabsRef.current.scrollLeft +
|
|
132
|
+
containerSize +
|
|
133
|
+
cornerChild.clientWidth >
|
|
134
|
+
fullContainerSize) {
|
|
135
|
+
totalSize += cornerChild.clientWidth;
|
|
136
|
+
}
|
|
137
|
+
return totalSize;
|
|
138
|
+
};
|
|
139
|
+
const handleStartScrollClick = () => {
|
|
140
|
+
moveTabsScroll(-1 * getScrollSize(true));
|
|
141
|
+
};
|
|
142
|
+
const handleEndScrollClick = () => {
|
|
143
|
+
moveTabsScroll(getScrollSize(false));
|
|
144
|
+
};
|
|
145
|
+
const getTabsMeta = useCallback(() => {
|
|
146
|
+
const tabsNode = tabsRef.current;
|
|
147
|
+
let tabsMeta;
|
|
148
|
+
if (tabsNode) {
|
|
149
|
+
const rect = tabsNode.getBoundingClientRect();
|
|
150
|
+
tabsMeta = {
|
|
151
|
+
scrollLeft: tabsNode.scrollLeft,
|
|
152
|
+
left: rect.left,
|
|
153
|
+
right: rect.right,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
let selectedTabMeta;
|
|
157
|
+
if (tabsNode && tabsListRef.current && selectedTabIndex) {
|
|
158
|
+
const children = tabsListRef.current.children;
|
|
159
|
+
if (children.length > 0) {
|
|
160
|
+
const tab = children[selectedTabIndex];
|
|
161
|
+
selectedTabMeta = tab ? tab.getBoundingClientRect() : null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
tabsMeta,
|
|
166
|
+
selectedTabMeta,
|
|
167
|
+
};
|
|
168
|
+
}, [selectedTabIndex]);
|
|
169
|
+
const scrollSelectedIntoView = useCallback(() => {
|
|
170
|
+
const { tabsMeta, selectedTabMeta } = getTabsMeta();
|
|
171
|
+
if (!selectedTabMeta || !tabsMeta)
|
|
172
|
+
return;
|
|
173
|
+
if (selectedTabMeta.left < tabsMeta.left) {
|
|
174
|
+
// left side of button is out of view
|
|
175
|
+
const nextScrollStart = tabsMeta.scrollLeft + (selectedTabMeta.left - tabsMeta.left);
|
|
176
|
+
scroll(nextScrollStart);
|
|
177
|
+
}
|
|
178
|
+
else if (selectedTabMeta.right > tabsMeta.right) {
|
|
179
|
+
// right side of button is out of view
|
|
180
|
+
let nextScrollStart = tabsMeta.scrollLeft + (selectedTabMeta.right - tabsMeta.right);
|
|
181
|
+
if (scrollButtonEndRef.current &&
|
|
182
|
+
((displayScroll.start && !displayScroll.end) ||
|
|
183
|
+
(!displayScroll.start && displayScroll.end))) {
|
|
184
|
+
nextScrollStart +=
|
|
185
|
+
scrollButtonEndRef.current.getBoundingClientRect().width;
|
|
186
|
+
}
|
|
187
|
+
scroll(nextScrollStart);
|
|
188
|
+
}
|
|
189
|
+
}, // we do not want to re-trigger this function if display.start / display.end are modified
|
|
190
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
|
+
[getTabsMeta]);
|
|
192
|
+
const updateScrollButtonState = useCallback(() => {
|
|
193
|
+
if (tabsRef.current) {
|
|
194
|
+
const { scrollLeft, scrollWidth, clientWidth } = tabsRef.current;
|
|
195
|
+
let showStartScroll = scrollLeft > 1;
|
|
196
|
+
let showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
|
|
197
|
+
if (showStartScroll !== displayScroll.start ||
|
|
198
|
+
showEndScroll !== displayScroll.end) {
|
|
199
|
+
setDisplayScroll({
|
|
200
|
+
start: showStartScroll,
|
|
201
|
+
end: showEndScroll,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, [displayScroll.end, displayScroll.start]);
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
window.addEventListener('resize', updateScrollButtonState);
|
|
208
|
+
return () => {
|
|
209
|
+
window.removeEventListener('resize', updateScrollButtonState);
|
|
210
|
+
};
|
|
211
|
+
}, [updateScrollButtonState]);
|
|
212
|
+
const handleTabsScroll = useMemo(() => () => updateScrollButtonState(), [updateScrollButtonState]);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
updateScrollButtonState();
|
|
215
|
+
});
|
|
216
|
+
// scroll to selected tab on first render
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
scrollSelectedIntoView();
|
|
219
|
+
}, [scrollSelectedIntoView, selectedTabIndex]);
|
|
220
|
+
const handleKeyDown = (event) => {
|
|
221
|
+
const list = tabsListRef.current;
|
|
222
|
+
const ownerDocument = (list && list.ownerDocument) || document;
|
|
223
|
+
const currentFocus = ownerDocument.activeElement;
|
|
224
|
+
const role = currentFocus === null || currentFocus === void 0 ? void 0 : currentFocus.getAttribute('role');
|
|
225
|
+
if (role !== 'tab' || !list) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
switch (event.key) {
|
|
229
|
+
case 'ArrowLeft':
|
|
230
|
+
event.preventDefault();
|
|
231
|
+
moveFocus(list, currentFocus, previousItem);
|
|
232
|
+
break;
|
|
233
|
+
case 'ArrowRight':
|
|
234
|
+
event.preventDefault();
|
|
235
|
+
moveFocus(list, currentFocus, nextItem);
|
|
236
|
+
break;
|
|
237
|
+
case 'Home':
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
moveFocus(list, null, nextItem);
|
|
240
|
+
break;
|
|
241
|
+
case 'End':
|
|
242
|
+
event.preventDefault();
|
|
243
|
+
moveFocus(list, null, previousItem);
|
|
244
|
+
break;
|
|
245
|
+
default:
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
return {
|
|
250
|
+
scrollButtonStartRef,
|
|
251
|
+
scrollButtonEndRef,
|
|
252
|
+
tabsRef,
|
|
253
|
+
tabsListRef,
|
|
254
|
+
handleKeyDown,
|
|
255
|
+
handleTabsScroll,
|
|
256
|
+
handleStartScrollClick,
|
|
257
|
+
handleEndScrollClick,
|
|
258
|
+
displayScroll,
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
export { useScrollingTabs };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CoreUITheme } from '../../style/theme';
|
|
3
|
+
type Status = 'unknown' | 'healthy' | 'warning' | 'critical';
|
|
4
|
+
type Props = {
|
|
5
|
+
children: React.ReactNode | string;
|
|
6
|
+
status?: Status;
|
|
7
|
+
id?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const SmallerEmphaseTextStyle: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
10
|
+
statusColor: string;
|
|
11
|
+
}, never>;
|
|
12
|
+
export declare function BasicText({ children, ...rest }: Props): JSX.Element;
|
|
13
|
+
export declare function SecondaryText({ children, ...rest }: Props): JSX.Element;
|
|
14
|
+
export declare function LargerText({ children, ...rest }: Props): JSX.Element;
|
|
15
|
+
export declare function EmphaseText({ children, ...rest }: Props): JSX.Element;
|
|
16
|
+
export declare function StatusText({ children, status, ...rest }: Props): JSX.Element;
|
|
17
|
+
export declare function LargeText({ children, ...rest }: Props): JSX.Element;
|
|
18
|
+
export declare function SmallerText({ children, ...rest }: Props): JSX.Element;
|
|
19
|
+
export declare function SmallerSecondaryText({ children, ...rest }: Props): JSX.Element;
|
|
20
|
+
export declare function SmallerEmphaseText({ children, status, ...rest }: Props): JSX.Element;
|
|
21
|
+
export declare function ChartTitleText({ children, ...rest }: Props): JSX.Element;
|
|
22
|
+
export declare const GentleEmphaseSecondaryText: import("styled-components").StyledComponent<typeof SecondaryText, import("styled-components").DefaultTheme, {
|
|
23
|
+
alignRight?: boolean | undefined;
|
|
24
|
+
}, never>;
|
|
25
|
+
export declare const Text: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
26
|
+
variant?: "ChartTitle" | "Basic" | "Smaller" | "Larger" | "Large" | undefined;
|
|
27
|
+
color?: keyof CoreUITheme | undefined;
|
|
28
|
+
isEmphazed?: boolean | undefined;
|
|
29
|
+
isGentleEmphazed?: boolean | undefined;
|
|
30
|
+
}, never>;
|
|
31
|
+
export declare const Link: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, {}, never>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=Text.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/text/Text.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,KAAK,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAC7D,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAsDF,eAAO,MAAM,uBAAuB;iBACrB,MAAM;SAIpB,CAAC;AAIF,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAErD;AACD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAEzD;AACD,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAEtD;AACD,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAEvD;AACD,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAO9D;AACD,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAErD;AACD,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAEvD;AACD,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAIhE;AACD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAOtE;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAE1D;AACD,eAAO,MAAM,0BAA0B;;SAWtC,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;SA+ChB,CAAC;AAEF,eAAO,MAAM,IAAI,uGAehB,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { spacing } from '../../spacing';
|
|
4
|
+
const BasicTextStyle = styled.span `
|
|
5
|
+
color: ${(props) => props.theme.textPrimary};
|
|
6
|
+
font-size: 1rem;
|
|
7
|
+
line-height: ${spacing.r24};
|
|
8
|
+
font-weight: 400;
|
|
9
|
+
`;
|
|
10
|
+
const SecondaryTextStyle = styled(BasicTextStyle) `
|
|
11
|
+
color: ${(props) => props.theme.textSecondary};
|
|
12
|
+
`;
|
|
13
|
+
const LargerTextStyle = styled(BasicTextStyle) `
|
|
14
|
+
font-size: 1.43rem;
|
|
15
|
+
line-height: 1.5;
|
|
16
|
+
`;
|
|
17
|
+
const EmphaseTextStyle = styled(BasicTextStyle) `
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
`;
|
|
20
|
+
const StatusTextStyle = styled(BasicTextStyle) `
|
|
21
|
+
color: ${(props) => props.theme[`${props.statusColor}`]};
|
|
22
|
+
`;
|
|
23
|
+
const LargetStyle = styled(BasicTextStyle) `
|
|
24
|
+
font-size: 1.14rem;
|
|
25
|
+
line-height: 1.5;
|
|
26
|
+
`;
|
|
27
|
+
const SmallerTextStyle = styled(BasicTextStyle) `
|
|
28
|
+
font-size: 0.71rem;
|
|
29
|
+
line-height: 1.4;
|
|
30
|
+
letter-spacing: 2%; // to be defined, percentage value is not valid
|
|
31
|
+
`;
|
|
32
|
+
const SmallerSecondaryTextStyle = styled(SmallerTextStyle) `
|
|
33
|
+
color: ${(props) => props.theme.textSecondary};
|
|
34
|
+
`;
|
|
35
|
+
const getStatusColor = (status) => {
|
|
36
|
+
let statusColor;
|
|
37
|
+
switch (status) {
|
|
38
|
+
case 'healthy':
|
|
39
|
+
statusColor = 'statusHealthy';
|
|
40
|
+
break;
|
|
41
|
+
case 'warning':
|
|
42
|
+
statusColor = 'statusWarning';
|
|
43
|
+
break;
|
|
44
|
+
case 'critical':
|
|
45
|
+
statusColor = 'statusCritical';
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
statusColor = 'textSecondary';
|
|
49
|
+
}
|
|
50
|
+
return statusColor;
|
|
51
|
+
};
|
|
52
|
+
export const SmallerEmphaseTextStyle = styled(SmallerTextStyle) `
|
|
53
|
+
font-weight: 700;
|
|
54
|
+
color: ${(props) => props.theme[`${props.statusColor}`]};
|
|
55
|
+
`;
|
|
56
|
+
const ChartTitleTextStyle = styled(BasicTextStyle) `
|
|
57
|
+
letter-spacing: ${spacing.r2};
|
|
58
|
+
`;
|
|
59
|
+
export function BasicText({ children, ...rest }) {
|
|
60
|
+
return _jsx(BasicTextStyle, { ...rest, children: children });
|
|
61
|
+
}
|
|
62
|
+
export function SecondaryText({ children, ...rest }) {
|
|
63
|
+
return _jsx(SecondaryTextStyle, { ...rest, children: children });
|
|
64
|
+
}
|
|
65
|
+
export function LargerText({ children, ...rest }) {
|
|
66
|
+
return _jsx(LargerTextStyle, { ...rest, children: children });
|
|
67
|
+
}
|
|
68
|
+
export function EmphaseText({ children, ...rest }) {
|
|
69
|
+
return _jsx(EmphaseTextStyle, { ...rest, children: children });
|
|
70
|
+
}
|
|
71
|
+
export function StatusText({ children, status, ...rest }) {
|
|
72
|
+
const statusColor = getStatusColor(status);
|
|
73
|
+
return (_jsx(StatusTextStyle, { statusColor: statusColor, ...rest, children: children }));
|
|
74
|
+
}
|
|
75
|
+
export function LargeText({ children, ...rest }) {
|
|
76
|
+
return _jsx(LargetStyle, { ...rest, children: children });
|
|
77
|
+
}
|
|
78
|
+
export function SmallerText({ children, ...rest }) {
|
|
79
|
+
return _jsx(SmallerTextStyle, { ...rest, children: children });
|
|
80
|
+
}
|
|
81
|
+
export function SmallerSecondaryText({ children, ...rest }) {
|
|
82
|
+
return (_jsx(SmallerSecondaryTextStyle, { ...rest, children: children }));
|
|
83
|
+
}
|
|
84
|
+
export function SmallerEmphaseText({ children, status, ...rest }) {
|
|
85
|
+
const statusColor = getStatusColor(status);
|
|
86
|
+
return (_jsx(SmallerEmphaseTextStyle, { statusColor: statusColor, ...rest, children: children }));
|
|
87
|
+
}
|
|
88
|
+
export function ChartTitleText({ children, ...rest }) {
|
|
89
|
+
return _jsx(ChartTitleTextStyle, { ...rest, children: children });
|
|
90
|
+
}
|
|
91
|
+
export const GentleEmphaseSecondaryText = styled(SecondaryText) `
|
|
92
|
+
font-style: italic;
|
|
93
|
+
${(props) => props.alignRight
|
|
94
|
+
? `
|
|
95
|
+
text-align: right;
|
|
96
|
+
display: block;
|
|
97
|
+
`
|
|
98
|
+
: ''}
|
|
99
|
+
`;
|
|
100
|
+
export const Text = styled.span `
|
|
101
|
+
color: ${(props) => props.theme[props.color || 'textPrimary']};
|
|
102
|
+
${(props) => props.variant === 'Larger'
|
|
103
|
+
? `
|
|
104
|
+
font-size: 1.43rem;
|
|
105
|
+
line-height: 1.5;
|
|
106
|
+
`
|
|
107
|
+
: props.variant === 'Large'
|
|
108
|
+
? `
|
|
109
|
+
font-size: 1.14rem;
|
|
110
|
+
line-height: 1.5;
|
|
111
|
+
`
|
|
112
|
+
: props.variant === 'Smaller'
|
|
113
|
+
? `
|
|
114
|
+
font-size: 0.71rem;
|
|
115
|
+
line-height: 1.4;
|
|
116
|
+
letter-spacing: 2%;// to be defined, percentage value is not valid
|
|
117
|
+
`
|
|
118
|
+
: `
|
|
119
|
+
font-size: 1rem;
|
|
120
|
+
line-height: ${spacing.r24};
|
|
121
|
+
`}
|
|
122
|
+
|
|
123
|
+
${(props) => props.isEmphazed
|
|
124
|
+
? `
|
|
125
|
+
font-weight: 700;
|
|
126
|
+
`
|
|
127
|
+
: `
|
|
128
|
+
font-weight: 400;
|
|
129
|
+
`}
|
|
130
|
+
|
|
131
|
+
${(props) => props.isGentleEmphazed
|
|
132
|
+
? `
|
|
133
|
+
font-style: italic;
|
|
134
|
+
`
|
|
135
|
+
: ``}
|
|
136
|
+
|
|
137
|
+
${(props) => props.variant === 'ChartTitle' && `letter-spacing: ${spacing.r2};`}
|
|
138
|
+
`;
|
|
139
|
+
export const Link = styled.a `
|
|
140
|
+
font-size: 1rem;
|
|
141
|
+
line-height: ${spacing.r24};
|
|
142
|
+
color: ${(props) => props.theme.textLink};
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
text-decoration-line: none;
|
|
145
|
+
width: fit-content;
|
|
146
|
+
&:hover {
|
|
147
|
+
text-decoration-line: underline;
|
|
148
|
+
}
|
|
149
|
+
// :focus-visible is the keyboard-only version of :focus
|
|
150
|
+
&:focus-visible {
|
|
151
|
+
outline: dashed ${spacing.r2} ${(props) => props.theme.textLink};
|
|
152
|
+
outline-offset: ${spacing.r2};
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
type TextAreaVariant = 'code' | 'text';
|
|
3
|
+
type RefType = HTMLTextAreaElement | null;
|
|
4
|
+
export declare const TextArea: React.ForwardRefExoticComponent<React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
5
|
+
variant?: TextAreaVariant | undefined;
|
|
6
|
+
width?: CSSProperties['width'];
|
|
7
|
+
height?: CSSProperties['height'];
|
|
8
|
+
} & React.RefAttributes<RefType>>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=TextArea.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/textarea/TextArea.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAGd,MAAM,OAAO,CAAC;AAIf,KAAK,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAMvC,KAAK,OAAO,GAAG,mBAAmB,GAAG,IAAI,CAAC;AA2F1C,eAAO,MAAM,QAAQ;;YA9FX,aAAa,CAAC,OAAO,CAAC;aACrB,aAAa,CAAC,QAAQ,CAAC;iCA6FiC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { spacing } from '../../spacing';
|
|
5
|
+
const TextAreaContainer = styled.textarea `
|
|
6
|
+
padding: ${spacing.r12} ${spacing.r8};
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
resize: vertical;
|
|
9
|
+
font-family: ${(props) => props.variant === 'code' ? 'Courier New' : 'Lato'};
|
|
10
|
+
font-size: ${spacing.f14};
|
|
11
|
+
|
|
12
|
+
${(props) => props.disabled &&
|
|
13
|
+
css `
|
|
14
|
+
opacity: 0.5;
|
|
15
|
+
cursor: not-allowed;
|
|
16
|
+
`}
|
|
17
|
+
|
|
18
|
+
${(props) => props.width &&
|
|
19
|
+
css `
|
|
20
|
+
width: ${props.width};
|
|
21
|
+
`}
|
|
22
|
+
|
|
23
|
+
${(props) => props.height &&
|
|
24
|
+
css `
|
|
25
|
+
height: ${props.height};
|
|
26
|
+
`}
|
|
27
|
+
|
|
28
|
+
&:placeholder-shown {
|
|
29
|
+
font-style: italic;
|
|
30
|
+
}
|
|
31
|
+
&::placeholder {
|
|
32
|
+
color: ${(props) => props.theme.textSecondary};
|
|
33
|
+
}
|
|
34
|
+
&:hover {
|
|
35
|
+
${(props) => !props.disabled &&
|
|
36
|
+
`border: ${spacing.r1} solid ${props.theme.infoPrimary};`}
|
|
37
|
+
}
|
|
38
|
+
&:focus {
|
|
39
|
+
border: ${spacing.r1} solid ${(props) => props.theme.infoPrimary};
|
|
40
|
+
}
|
|
41
|
+
${(props) => {
|
|
42
|
+
const { border, textSecondary, backgroundLevel1, selectedActive } = props.theme;
|
|
43
|
+
return css `
|
|
44
|
+
border-color: ${border};
|
|
45
|
+
color: ${textSecondary};
|
|
46
|
+
background: ${backgroundLevel1};
|
|
47
|
+
&:focus {
|
|
48
|
+
border-color: ${selectedActive};
|
|
49
|
+
outline: none;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
}}
|
|
53
|
+
`;
|
|
54
|
+
function TextAreaElement({ rows = 3, cols = 20, width, height, variant = 'code', ...rest }, ref) {
|
|
55
|
+
if (width || height) {
|
|
56
|
+
return (_jsx(TextAreaContainer, { className: "sc-textarea", width: width, height: height, variant: variant, ...rest, ref: ref }));
|
|
57
|
+
}
|
|
58
|
+
return (_jsx(TextAreaContainer, { className: "sc-textarea", rows: rows, cols: cols, variant: variant, ...rest, ref: ref }));
|
|
59
|
+
}
|
|
60
|
+
export const TextArea = forwardRef(TextAreaElement);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
text: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
variant?: 'statusHealthy' | 'statusWarning' | 'statusCritical' | 'infoPrimary' | 'infoSecondary';
|
|
6
|
+
};
|
|
7
|
+
export declare function TextBadge({ text, variant, className, ...rest }: Props): JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=TextBadge.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextBadge.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/textbadge/TextBadge.component.tsx"],"names":[],"mappings":";AAkBA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EACJ,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,eAAe,CAAC;CACrB,CAAC;AACF,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,OAAuB,EACvB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,KAAK,eAUP"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { spacing } from '../../spacing';
|
|
5
|
+
import { fontWeight } from '../../style/theme';
|
|
6
|
+
const StyledTextBadge = styled.span `
|
|
7
|
+
${({ theme, variant }) => `
|
|
8
|
+
background-color: ${theme[variant]};
|
|
9
|
+
color: ${variant === 'infoSecondary' ? theme.textPrimary : theme.textReverse};
|
|
10
|
+
padding: 2px ${spacing.r4};
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
font-size: 0.9rem;
|
|
13
|
+
font-weight: ${fontWeight.bold};
|
|
14
|
+
margin: 0 ${spacing.r4} 0 ${spacing.r4};
|
|
15
|
+
`}
|
|
16
|
+
`;
|
|
17
|
+
export function TextBadge({ text, variant = 'infoPrimary', className, ...rest }) {
|
|
18
|
+
return (_jsx(StyledTextBadge, { className: ['sc-text-badge', className].join(' '), variant: variant, ...rest, children: text }));
|
|
19
|
+
}
|