@oliasoft-open-source/react-ui-library 2.4.7 → 3.0.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/README.md +0 -1
- package/dist/global.css +21840 -0
- package/dist/index.js +43567 -0
- package/package.json +37 -55
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -125
- package/.gitlab-ci.yml +0 -76
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -3
- package/.prettierrc +0 -4
- package/.storybook/main.js +0 -36
- package/.storybook/preview.js +0 -40
- package/.storybook/storybook.less +0 -8
- package/babel.config.js +0 -31
- package/index.js +0 -76
- package/jest.config.js +0 -9
- package/scripts/send-mattermost-message.sh +0 -21
- package/src/components/accordion/accordion.jsx +0 -132
- package/src/components/accordion/accordion.module.less +0 -66
- package/src/components/accordion/accordion.stories.jsx +0 -171
- package/src/components/accordion/chevron/chevron.jsx +0 -12
- package/src/components/accordion/chevron/chevron.module.less +0 -12
- package/src/components/accordion/helpers/accordion-with-default-toggle.jsx +0 -106
- package/src/components/accordion/helpers/accordion-with-default-toggle.module.less +0 -24
- package/src/components/actions/actions.jsx +0 -129
- package/src/components/actions/actions.module.less +0 -44
- package/src/components/actions/actions.shape.js +0 -32
- package/src/components/actions/actions.stories.jsx +0 -79
- package/src/components/badge/badge.jsx +0 -58
- package/src/components/badge/badge.module.less +0 -55
- package/src/components/badge/badge.stories.jsx +0 -31
- package/src/components/breadcrumb/breadcrumb.jsx +0 -49
- package/src/components/breadcrumb/breadcrumb.module.less +0 -39
- package/src/components/breadcrumb/breadcrumb.stories.jsx +0 -45
- package/src/components/breadcrumb/link.jsx +0 -31
- package/src/components/button/button.jsx +0 -156
- package/src/components/button/button.module.less +0 -300
- package/src/components/button/button.stories.jsx +0 -74
- package/src/components/button-group/button-group.jsx +0 -140
- package/src/components/button-group/button-group.module.less +0 -24
- package/src/components/button-group/button-group.stories-data.jsx +0 -67
- package/src/components/button-group/button-group.stories.jsx +0 -63
- package/src/components/buttons-and-links.stories.mdx +0 -55
- package/src/components/card/card.jsx +0 -51
- package/src/components/card/card.module.less +0 -48
- package/src/components/card/card.stories.jsx +0 -39
- package/src/components/check-box/check-box.jsx +0 -92
- package/src/components/check-box/check-box.module.less +0 -101
- package/src/components/check-box/check-box.stories.jsx +0 -27
- package/src/components/color/color.stories-data.jsx +0 -71
- package/src/components/color/color.stories.mdx +0 -37
- package/src/components/dialog/dialog.jsx +0 -77
- package/src/components/dialog/dialog.module.less +0 -76
- package/src/components/divider/divider.jsx +0 -40
- package/src/components/divider/divider.module.less +0 -28
- package/src/components/divider/divider.stories.jsx +0 -50
- package/src/components/drawer/drawer-resize-wrapper.jsx +0 -76
- package/src/components/drawer/drawer-tabs.jsx +0 -44
- package/src/components/drawer/drawer.jsx +0 -161
- package/src/components/drawer/drawer.module.less +0 -217
- package/src/components/drawer/drawer.stories.jsx +0 -296
- package/src/components/empty/empty.jsx +0 -52
- package/src/components/empty/empty.module.less +0 -17
- package/src/components/empty/empty.stories.jsx +0 -26
- package/src/components/file-input/file-input.jsx +0 -101
- package/src/components/file-input/file-input.module.less +0 -3
- package/src/components/file-input/file-input.stories.jsx +0 -109
- package/src/components/form/field.jsx +0 -96
- package/src/components/form/field.stories.jsx +0 -101
- package/src/components/form/form.module.less +0 -30
- package/src/components/form/form.stories.jsx +0 -191
- package/src/components/heading/heading.jsx +0 -105
- package/src/components/heading/heading.module.less +0 -59
- package/src/components/heading/heading.stories.jsx +0 -60
- package/src/components/icon/deprecated-icon.jsx +0 -97
- package/src/components/icon/icon.jsx +0 -71
- package/src/components/icon/icon.module.less +0 -33
- package/src/components/icon/icon.stories.jsx +0 -37
- package/src/components/icon/icons.example.module.less +0 -4
- package/src/components/input/input.jsx +0 -167
- package/src/components/input/input.module.less +0 -94
- package/src/components/input/input.stories.jsx +0 -28
- package/src/components/input-group/input-group-addon/input-group-addon.jsx +0 -36
- package/src/components/input-group/input-group-addon/input-group-addon.module.less +0 -31
- package/src/components/input-group/input-group.jsx +0 -51
- package/src/components/input-group/input-group.module.less +0 -10
- package/src/components/input-group/input-group.stories.jsx +0 -77
- package/src/components/input-validation.stories.mdx +0 -61
- package/src/components/inputs.stories.mdx +0 -201
- package/src/components/label/label.jsx +0 -115
- package/src/components/label/label.module.less +0 -43
- package/src/components/label/label.stories.jsx +0 -60
- package/src/components/layout/column/column.jsx +0 -85
- package/src/components/layout/column/styles.js +0 -45
- package/src/components/layout/column.stories.jsx +0 -60
- package/src/components/layout/examples/afe.stories.jsx +0 -180
- package/src/components/layout/examples/blowout.stories.jsx +0 -68
- package/src/components/layout/examples/casing-loads.stories.jsx +0 -297
- package/src/components/layout/examples/formation.stories.jsx +0 -110
- package/src/components/layout/examples/projects.stories.jsx +0 -108
- package/src/components/layout/examples/reservoirs.stories.jsx +0 -211
- package/src/components/layout/examples/site.stories.jsx +0 -263
- package/src/components/layout/flex/flex.jsx +0 -48
- package/src/components/layout/flex/flex.stories.jsx +0 -59
- package/src/components/layout/form-row/form-row.jsx +0 -15
- package/src/components/layout/form-row/form-row.module.less +0 -11
- package/src/components/layout/grid/grid.jsx +0 -62
- package/src/components/layout/grid/grid.stories.jsx +0 -67
- package/src/components/layout/page/page.jsx +0 -42
- package/src/components/layout/page/page.module.less +0 -27
- package/src/components/layout/page.stories.jsx +0 -93
- package/src/components/layout/placeholder.jsx +0 -2
- package/src/components/layout/print-header/print-header.jsx +0 -22
- package/src/components/layout/print-header/print-header.module.less +0 -9
- package/src/components/layout/row/row.jsx +0 -75
- package/src/components/layout/row/row.module.less +0 -7
- package/src/components/layout/spacer/spacer.jsx +0 -26
- package/src/components/layout/spacer/spacer.stories.jsx +0 -50
- package/src/components/layout-forms.stories.mdx +0 -104
- package/src/components/layout-general.stories.mdx +0 -215
- package/src/components/list/list-row/item-content.jsx +0 -15
- package/src/components/list/list-row/label.jsx +0 -11
- package/src/components/list/list-row/list-heading.jsx +0 -52
- package/src/components/list/list-row/list-row.jsx +0 -128
- package/src/components/list/list-row/list-subheading.jsx +0 -72
- package/src/components/list/list-row/meta-content.jsx +0 -24
- package/src/components/list/list-row/meta-count.jsx +0 -10
- package/src/components/list/list-row/name.jsx +0 -45
- package/src/components/list/list.jsx +0 -276
- package/src/components/list/list.module.less +0 -256
- package/src/components/list/list.stories-data.jsx +0 -287
- package/src/components/list/list.stories.jsx +0 -458
- package/src/components/list/toggle-narrow.jsx +0 -13
- package/src/components/loader/loader.jsx +0 -63
- package/src/components/loader/loader.module.less +0 -63
- package/src/components/loader/loader.stories.jsx +0 -155
- package/src/components/menu/index.js +0 -7
- package/src/components/menu/layer/divider.jsx +0 -4
- package/src/components/menu/layer/heading.jsx +0 -15
- package/src/components/menu/layer/layer.jsx +0 -82
- package/src/components/menu/layer/option.jsx +0 -77
- package/src/components/menu/layer/path.js +0 -44
- package/src/components/menu/layer/placementOptions.js +0 -6
- package/src/components/menu/layer/section.jsx +0 -66
- package/src/components/menu/menu.jsx +0 -359
- package/src/components/menu/menu.module.less +0 -241
- package/src/components/menu/menu.stories-data.jsx +0 -168
- package/src/components/menu/menu.stories.jsx +0 -126
- package/src/components/menu/menu.test.js +0 -58
- package/src/components/menu/trigger/button.jsx +0 -50
- package/src/components/menu/trigger/component.jsx +0 -14
- package/src/components/menu/trigger/text.jsx +0 -25
- package/src/components/menu/trigger/trigger.jsx +0 -86
- package/src/components/message/dismiss.jsx +0 -26
- package/src/components/message/message.jsx +0 -137
- package/src/components/message/message.module.less +0 -114
- package/src/components/message/message.stories.jsx +0 -84
- package/src/components/modal/modal.jsx +0 -50
- package/src/components/modal/modal.module.less +0 -39
- package/src/components/modal/modal.stories.jsx +0 -162
- package/src/components/option-dropdown/heading.jsx +0 -6
- package/src/components/option-dropdown/layer.jsx +0 -81
- package/src/components/option-dropdown/option-dropdown.jsx +0 -53
- package/src/components/option-dropdown/option-dropdown.module.less +0 -50
- package/src/components/option-dropdown/option-dropdown.stories.jsx +0 -35
- package/src/components/option-dropdown/option.jsx +0 -13
- package/src/components/pagination/pagination.jsx +0 -139
- package/src/components/pagination/pagination.module.less +0 -11
- package/src/components/pagination/pagination.stories.jsx +0 -78
- package/src/components/pagination/pagination.test.js +0 -92
- package/src/components/pagination/pagination.viewdata.js +0 -66
- package/src/components/pop-confirm/content.jsx +0 -25
- package/src/components/pop-confirm/pop-confirm.jsx +0 -61
- package/src/components/pop-confirm/pop-confirm.module.less +0 -18
- package/src/components/pop-confirm/pop-confirm.stories.jsx +0 -53
- package/src/components/popover/popover.jsx +0 -112
- package/src/components/popover/popover.module.less +0 -22
- package/src/components/popover/popover.stories.jsx +0 -59
- package/src/components/portal/portal.jsx +0 -16
- package/src/components/portal/portal.stories.jsx +0 -69
- package/src/components/progress-bar/progress-bar.jsx +0 -64
- package/src/components/progress-bar/progress-bar.module.less +0 -64
- package/src/components/progress-bar/progress-bar.stories.jsx +0 -23
- package/src/components/radio-button/radio-button.jsx +0 -139
- package/src/components/radio-button/radio-button.module.less +0 -135
- package/src/components/radio-button/radio-button.stories.jsx +0 -37
- package/src/components/radio-button/radio-input.jsx +0 -52
- package/src/components/select/custom-select/custom-select.jsx +0 -440
- package/src/components/select/custom-select/custom-select.module.less +0 -123
- package/src/components/select/custom-select/custom-select.reducer.js +0 -157
- package/src/components/select/custom-select/layer/heading.jsx +0 -13
- package/src/components/select/custom-select/layer/layer.jsx +0 -73
- package/src/components/select/custom-select/layer/option.jsx +0 -54
- package/src/components/select/custom-select/layer/placementOptions.js +0 -7
- package/src/components/select/custom-select/layer/section.jsx +0 -35
- package/src/components/select/custom-select/trigger/input.jsx +0 -100
- package/src/components/select/custom-select/trigger/trigger.jsx +0 -155
- package/src/components/select/custom-select/trigger/trigger.module.less +0 -289
- package/src/components/select/native-select/native-select.jsx +0 -198
- package/src/components/select/native-select/native-select.module.less +0 -107
- package/src/components/select/select.input.js +0 -146
- package/src/components/select/select.jsx +0 -207
- package/src/components/select/select.stories-data.jsx +0 -92
- package/src/components/select/select.stories.jsx +0 -135
- package/src/components/select/select.test.js +0 -519
- package/src/components/side-bar/container.module.less +0 -29
- package/src/components/side-bar/link.jsx +0 -83
- package/src/components/side-bar/sections.jsx +0 -23
- package/src/components/side-bar/side-bar.jsx +0 -102
- package/src/components/side-bar/side-bar.module.less +0 -137
- package/src/components/side-bar/side-bar.stories.jsx +0 -101
- package/src/components/slider/rc-slider.less +0 -47
- package/src/components/slider/slider-tooltip.jsx +0 -20
- package/src/components/slider/slider.jsx +0 -233
- package/src/components/slider/slider.module.less +0 -40
- package/src/components/slider/slider.stories.jsx +0 -110
- package/src/components/spinner/spinner.jsx +0 -37
- package/src/components/spinner/spinner.module.less +0 -115
- package/src/components/spinner/spinner.stories.jsx +0 -24
- package/src/components/table/cell/cell.jsx +0 -617
- package/src/components/table/cell/cell.module.less +0 -164
- package/src/components/table/footer/footer.jsx +0 -66
- package/src/components/table/footer/footer.module.less +0 -14
- package/src/components/table/helper.js +0 -64
- package/src/components/table/helper.test.js +0 -166
- package/src/components/table/icon/icon.module.less +0 -31
- package/src/components/table/row/expanded-content-row.jsx +0 -16
- package/src/components/table/row/row.jsx +0 -253
- package/src/components/table/row/row.module.less +0 -62
- package/src/components/table/table-scroll-wrapper.jsx +0 -49
- package/src/components/table/table.jsx +0 -234
- package/src/components/table/table.module.less +0 -146
- package/src/components/table/table.stories-data.jsx +0 -874
- package/src/components/table/table.stories.jsx +0 -759
- package/src/components/table/table.test.js +0 -30
- package/src/components/table/table.variables.less +0 -11
- package/src/components/table/table.viewdata.js +0 -26
- package/src/components/table/title/title.jsx +0 -30
- package/src/components/table/title/title.module.less +0 -11
- package/src/components/tabs/content.jsx +0 -14
- package/src/components/tabs/label.jsx +0 -50
- package/src/components/tabs/tabs.jsx +0 -191
- package/src/components/tabs/tabs.module.less +0 -73
- package/src/components/tabs/tabs.stories.jsx +0 -110
- package/src/components/text/text.jsx +0 -64
- package/src/components/text/text.module.less +0 -45
- package/src/components/text/text.stories.jsx +0 -31
- package/src/components/text-link/text-link.jsx +0 -23
- package/src/components/text-link/text-link.stories.jsx +0 -20
- package/src/components/textarea/textarea.jsx +0 -126
- package/src/components/textarea/textarea.module.less +0 -55
- package/src/components/textarea/textarea.stories.jsx +0 -26
- package/src/components/toaster/toaster.jsx +0 -39
- package/src/components/toaster/toaster.less +0 -17
- package/src/components/toaster/toaster.stories.jsx +0 -116
- package/src/components/toggle/toggle.jsx +0 -65
- package/src/components/toggle/toggle.module.less +0 -139
- package/src/components/toggle/toggle.stories.jsx +0 -26
- package/src/components/tooltip/tooltip-layer.jsx +0 -72
- package/src/components/tooltip/tooltip.jsx +0 -108
- package/src/components/tooltip/tooltip.module.less +0 -28
- package/src/components/tooltip/tooltip.stories.jsx +0 -71
- package/src/components/top-bar/element/element.jsx +0 -72
- package/src/components/top-bar/element/link.jsx +0 -29
- package/src/components/top-bar/title.jsx +0 -24
- package/src/components/top-bar/top-bar.jsx +0 -79
- package/src/components/top-bar/top-bar.module.less +0 -190
- package/src/components/top-bar/top-bar.stories.jsx +0 -137
- package/src/components/top-bar/warning.jsx +0 -6
- package/src/components/tree/tree-item.jsx +0 -79
- package/src/components/tree/tree-placeholder.jsx +0 -6
- package/src/components/tree/tree.jsx +0 -129
- package/src/components/tree/tree.module.less +0 -33
- package/src/components/tree/tree.stories-data.jsx +0 -89
- package/src/components/tree/tree.stories.jsx +0 -106
- package/src/docs/components/page/page.jsx +0 -16
- package/src/docs/config/config.js +0 -1
- package/src/docs/html/favicon.png +0 -0
- package/src/docs/html/index.html +0 -11
- package/src/docs/navigation/footer/footer.jsx +0 -48
- package/src/docs/navigation/header/header.jsx +0 -39
- package/src/docs/navigation/header/header.module.less +0 -32
- package/src/docs/navigation/routes/routes.jsx +0 -16
- package/src/docs/start.jsx +0 -12
- package/src/docs/views/main/main.jsx +0 -209
- package/src/docs/views/main/main.module.less +0 -14
- package/src/docs/views/not-found/not-found.jsx +0 -5
- package/src/helpers/disabled-context.js +0 -8
- package/src/helpers/styles.js +0 -68
- package/src/helpers/text.js +0 -6
- package/src/helpers/types.js +0 -5
- package/src/hooks/index.js +0 -3
- package/src/hooks/use-focus.js +0 -11
- package/src/hooks/use-keyboard-event.js +0 -16
- package/src/hooks/use-window-width.js +0 -20
- package/src/images/icons/icon-drop.png +0 -0
- package/src/images/icons/icon-share.png +0 -0
- package/src/images/icons/icons8-junction.svg +0 -4
- package/src/images/logo.png +0 -0
- package/src/images/logo.svg +0 -13
- package/src/images/oliasoft-logo.svg +0 -1
- package/src/style/colors.less +0 -26
- package/src/style/external.less +0 -10
- package/src/style/fonts/lato/Lato-Bold.woff2 +0 -0
- package/src/style/fonts/lato/Lato-BoldItalic.woff2 +0 -0
- package/src/style/fonts/lato/Lato-Italic.woff2 +0 -0
- package/src/style/fonts/lato/Lato-Regular.woff2 +0 -0
- package/src/style/fonts.less +0 -27
- package/src/style/global.less +0 -51
- package/src/style/mixins.less +0 -68
- package/src/style/reset/reset.less +0 -34
- package/src/style/shared.less +0 -25
- package/src/style/theme.dark.less +0 -37
- package/src/style/theme.default.less +0 -74
- package/src/style/variables.less +0 -49
- package/webpack/webpack.common.js +0 -39
- package/webpack/webpack.common.rules.js +0 -102
- package/webpack/webpack.dev.js +0 -22
- package/webpack/webpack.prod.js +0 -23
- package/webpack/webpack.resolve.js +0 -22
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import React, { memo, useState } from 'react';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import isEqual from 'react-fast-compare';
|
|
5
|
-
import { FaArrowLeft } from 'react-icons/fa';
|
|
6
|
-
import { Drawer } from '../drawer/drawer';
|
|
7
|
-
import { Sections } from './sections';
|
|
8
|
-
import styles from './side-bar.module.less';
|
|
9
|
-
import { Button } from '../button/button';
|
|
10
|
-
|
|
11
|
-
export const SideBar = memo(
|
|
12
|
-
({ options, startOpen, onShiftClickToggleOpen, top }) => {
|
|
13
|
-
const [isOpen, setIsOpen] = useState(startOpen || false);
|
|
14
|
-
|
|
15
|
-
const onClick = (evt, value, label, clickHandler) => {
|
|
16
|
-
evt.preventDefault();
|
|
17
|
-
if (typeof clickHandler === 'function') {
|
|
18
|
-
evt.target.value = value;
|
|
19
|
-
evt.target.label = label;
|
|
20
|
-
clickHandler(evt);
|
|
21
|
-
}
|
|
22
|
-
setIsOpen(false);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const visible = options.sections.length > 0;
|
|
26
|
-
return (
|
|
27
|
-
<Drawer
|
|
28
|
-
fixed
|
|
29
|
-
open={isOpen}
|
|
30
|
-
top={top}
|
|
31
|
-
background="var(--color-background-sidebar)"
|
|
32
|
-
closedWidth={70}
|
|
33
|
-
enableButton={visible}
|
|
34
|
-
buttonPosition="bottom"
|
|
35
|
-
buttonAnimate
|
|
36
|
-
button={
|
|
37
|
-
visible && (
|
|
38
|
-
<Button
|
|
39
|
-
onClick={(evt) => {
|
|
40
|
-
if (evt.shiftKey) {
|
|
41
|
-
onShiftClickToggleOpen(evt);
|
|
42
|
-
}
|
|
43
|
-
setIsOpen(!isOpen);
|
|
44
|
-
}}
|
|
45
|
-
colored
|
|
46
|
-
round
|
|
47
|
-
icon={<FaArrowLeft />}
|
|
48
|
-
/>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
>
|
|
52
|
-
<div className={cx(styles.sidebar, !isOpen ? styles.collapsed : '')}>
|
|
53
|
-
{visible && (
|
|
54
|
-
<div className={styles.inner}>
|
|
55
|
-
<h4 className={styles.title}>{options.title}</h4>
|
|
56
|
-
<Sections
|
|
57
|
-
isOpen={isOpen}
|
|
58
|
-
sections={options.sections}
|
|
59
|
-
onClick={onClick}
|
|
60
|
-
/>
|
|
61
|
-
</div>
|
|
62
|
-
)}
|
|
63
|
-
</div>
|
|
64
|
-
</Drawer>
|
|
65
|
-
);
|
|
66
|
-
},
|
|
67
|
-
(prevProps, nextProps) => isEqual(prevProps, nextProps),
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
SideBar.defaultProps = {
|
|
71
|
-
startOpen: false,
|
|
72
|
-
onShiftClickToggleOpen: () => {},
|
|
73
|
-
top: undefined,
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
SideBar.propTypes = {
|
|
77
|
-
options: PropTypes.shape({
|
|
78
|
-
title: PropTypes.string.isRequired,
|
|
79
|
-
sections: PropTypes.arrayOf(
|
|
80
|
-
PropTypes.shape({
|
|
81
|
-
heading: PropTypes.string.isRequired,
|
|
82
|
-
items: PropTypes.arrayOf(
|
|
83
|
-
PropTypes.shape({
|
|
84
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
|
85
|
-
.isRequired,
|
|
86
|
-
value: PropTypes.string.isRequired,
|
|
87
|
-
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
|
88
|
-
.isRequired,
|
|
89
|
-
onClick: PropTypes.func.isRequired,
|
|
90
|
-
isActive: PropTypes.bool,
|
|
91
|
-
isExperimental: PropTypes.bool,
|
|
92
|
-
invalid: PropTypes.bool,
|
|
93
|
-
testId: PropTypes.string,
|
|
94
|
-
}),
|
|
95
|
-
).isRequired,
|
|
96
|
-
}),
|
|
97
|
-
).isRequired,
|
|
98
|
-
}).isRequired,
|
|
99
|
-
startOpen: PropTypes.bool,
|
|
100
|
-
onShiftClickToggleOpen: PropTypes.func,
|
|
101
|
-
top: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
102
|
-
};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
@import '../../style/variables.less';
|
|
2
|
-
|
|
3
|
-
:root {
|
|
4
|
-
--color-background-sidebar: var(--color-neutral-950);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
@sidebarPadding: 1.4rem;
|
|
8
|
-
|
|
9
|
-
.sidebar {
|
|
10
|
-
background-color: var(--color-background-sidebar);
|
|
11
|
-
color: white;
|
|
12
|
-
position: relative;
|
|
13
|
-
|
|
14
|
-
@media print {
|
|
15
|
-
display: none;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.inner {
|
|
20
|
-
padding: @sidebarPadding;
|
|
21
|
-
scrollbar-width: none; /* Firefox */
|
|
22
|
-
-ms-overflow-style: none; /* IE 10+ */
|
|
23
|
-
|
|
24
|
-
&::-webkit-scrollbar {
|
|
25
|
-
width: 0px; /* Remove scrollbar space */
|
|
26
|
-
background: transparent; /* Optional: just make scrollbar invisible */
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.title,
|
|
31
|
-
.subtitle,
|
|
32
|
-
.label {
|
|
33
|
-
transition: opacity 0.2s, max-height 0.2s, margin 0.2s, color 0.2s;
|
|
34
|
-
max-height: 50px;
|
|
35
|
-
|
|
36
|
-
.collapsed & {
|
|
37
|
-
opacity: 0;
|
|
38
|
-
max-height: 0;
|
|
39
|
-
margin-bottom: 0;
|
|
40
|
-
margin-top: 0;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.title {
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
max-width: 100%;
|
|
47
|
-
text-overflow: ellipsis;
|
|
48
|
-
white-space: nowrap;
|
|
49
|
-
margin-top: 0;
|
|
50
|
-
font-size: 16px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.subtitle {
|
|
54
|
-
margin-bottom: 0.75rem;
|
|
55
|
-
white-space: nowrap;
|
|
56
|
-
font-size: 12px;
|
|
57
|
-
letter-spacing: 0.1em;
|
|
58
|
-
opacity: 0.6;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.list {
|
|
62
|
-
margin-left: -@sidebarPadding;
|
|
63
|
-
margin-right: -@sidebarPadding;
|
|
64
|
-
margin-bottom: 2rem;
|
|
65
|
-
margin-top: 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.item {
|
|
69
|
-
font-size: 16px;
|
|
70
|
-
color: white;
|
|
71
|
-
font-weight: normal;
|
|
72
|
-
display: flex;
|
|
73
|
-
padding: 0.4rem @sidebarPadding;
|
|
74
|
-
align-items: center;
|
|
75
|
-
|
|
76
|
-
&:focus {
|
|
77
|
-
outline: none; // Remove dotted outline on FF
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&::-moz-focus-inner {
|
|
81
|
-
border: 0; // Remove dotted outline on FF
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&:hover,
|
|
85
|
-
&:focus {
|
|
86
|
-
color: var(--color-primary-400);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
&:active {
|
|
90
|
-
color: var(--color-primary-300);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
&.active {
|
|
94
|
-
color: white;
|
|
95
|
-
background: black;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
&.experimental {
|
|
99
|
-
background: #40130b;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.icon {
|
|
104
|
-
margin-right: 10px;
|
|
105
|
-
line-height: 0;
|
|
106
|
-
flex-shrink: 0;
|
|
107
|
-
transition: opacity 0.4s;
|
|
108
|
-
opacity: 0.4;
|
|
109
|
-
display: block;
|
|
110
|
-
|
|
111
|
-
.item:hover &,
|
|
112
|
-
.item:focus & {
|
|
113
|
-
opacity: 0.6;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.item:active & {
|
|
117
|
-
opacity: 0.8;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.item.active & {
|
|
121
|
-
opacity: 1;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
> * {
|
|
125
|
-
opacity: 1;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
> span {
|
|
129
|
-
// Fix for Tooltip
|
|
130
|
-
display: block;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.label {
|
|
135
|
-
white-space: nowrap;
|
|
136
|
-
overflow: hidden;
|
|
137
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FaAngleDoubleRight } from 'react-icons/fa';
|
|
3
|
-
import { SideBar, Flex, Badge } from '../../..';
|
|
4
|
-
import svgIcon from '../../images/icons/icons8-junction.svg';
|
|
5
|
-
|
|
6
|
-
const sections = [
|
|
7
|
-
{
|
|
8
|
-
heading: 'First Heading',
|
|
9
|
-
items: [
|
|
10
|
-
{
|
|
11
|
-
label: 'Section A',
|
|
12
|
-
value: '/path/to/something',
|
|
13
|
-
onClick: () => {},
|
|
14
|
-
icon: svgIcon,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
label: (
|
|
18
|
-
<Flex alignItems="center" gap="10px">
|
|
19
|
-
Section B
|
|
20
|
-
<Badge small title="BETA" />
|
|
21
|
-
</Flex>
|
|
22
|
-
),
|
|
23
|
-
value: '/path/to/something',
|
|
24
|
-
onClick: () => {},
|
|
25
|
-
icon: svgIcon,
|
|
26
|
-
isActive: true,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: 'Section C',
|
|
30
|
-
value: '/path/to/something',
|
|
31
|
-
onClick: () => {},
|
|
32
|
-
icon: svgIcon,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: 'Experimental Section',
|
|
36
|
-
value: '/path/to/something',
|
|
37
|
-
onClick: () => {},
|
|
38
|
-
icon: svgIcon,
|
|
39
|
-
isExperimental: true,
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
heading: 'Second Heading',
|
|
45
|
-
items: [
|
|
46
|
-
{
|
|
47
|
-
label: 'Section 1',
|
|
48
|
-
value: '/path/to/something',
|
|
49
|
-
onClick: () => {},
|
|
50
|
-
icon: <FaAngleDoubleRight />,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: 'Section 2',
|
|
54
|
-
value: '/path/to/something',
|
|
55
|
-
onClick: () => {},
|
|
56
|
-
icon: <FaAngleDoubleRight />,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
label: 'Invalid Section',
|
|
60
|
-
value: '/path/to/something',
|
|
61
|
-
onClick: () => {},
|
|
62
|
-
icon: svgIcon,
|
|
63
|
-
invalid: true,
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
export default {
|
|
70
|
-
title: 'Navigation/SideBar',
|
|
71
|
-
component: SideBar,
|
|
72
|
-
parameters: {
|
|
73
|
-
layout: 'fullscreen',
|
|
74
|
-
docs: {
|
|
75
|
-
inlineStories: false,
|
|
76
|
-
iframeHeight: 500,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
args: {
|
|
80
|
-
options: {
|
|
81
|
-
title: 'Title',
|
|
82
|
-
sections,
|
|
83
|
-
},
|
|
84
|
-
startOpen: false,
|
|
85
|
-
},
|
|
86
|
-
argTypes: {
|
|
87
|
-
top: { control: { type: 'text' } },
|
|
88
|
-
startOpen: { control: { type: 'boolean' } },
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const Template = (args) => (
|
|
93
|
-
<SideBar // eslint-disable-next-line react/jsx-props-no-spreading
|
|
94
|
-
{...args}
|
|
95
|
-
/>
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
export const Default = Template.bind({});
|
|
99
|
-
|
|
100
|
-
export const StartOpen = Template.bind({});
|
|
101
|
-
StartOpen.args = { startOpen: true };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
@import '../../style/variables.less';
|
|
2
|
-
@import '~rc-slider/assets/index.css';
|
|
3
|
-
|
|
4
|
-
.rc-slider {
|
|
5
|
-
.rc-slider-rail {
|
|
6
|
-
background-color: var(--color-border);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.rc-slider-track {
|
|
10
|
-
background-color: var(--color-background-primary);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.rc-slider-dot {
|
|
14
|
-
border-color: var(--color-border);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.rc-slider-dot-active {
|
|
18
|
-
border-color: var(--color-background-primary);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.rc-slider-handle {
|
|
22
|
-
border-color: var(--color-background-primary);
|
|
23
|
-
|
|
24
|
-
&:focus {
|
|
25
|
-
border-color: var(--color-background-primary);
|
|
26
|
-
box-shadow: 0 0 0 3px var(--color-background-primary);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.rc-slider-mark-text {
|
|
31
|
-
color: var(--color-text-faint);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.rc-slider-mark-text-active {
|
|
35
|
-
color: var(--color-text-muted);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&-disabled {
|
|
39
|
-
background-color: transparent !important;
|
|
40
|
-
|
|
41
|
-
.rc-slider-mark-text,
|
|
42
|
-
.rc-slider-handle,
|
|
43
|
-
.rc-slider-dot {
|
|
44
|
-
cursor: default !important;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TooltipLayer } from '../tooltip/tooltip-layer';
|
|
3
|
-
|
|
4
|
-
//See https://github.com/react-component/slider/issues/409#issuecomment-606750232
|
|
5
|
-
export const SliderTooltip = ({ text }) => {
|
|
6
|
-
return (
|
|
7
|
-
<TooltipLayer
|
|
8
|
-
text={text}
|
|
9
|
-
layerProps={{
|
|
10
|
-
style: {
|
|
11
|
-
whiteSpace: 'nowrap',
|
|
12
|
-
position: 'fixed',
|
|
13
|
-
transform: 'translate(-50%, -100%)',
|
|
14
|
-
marginTop: -15,
|
|
15
|
-
marginLeft: 5,
|
|
16
|
-
},
|
|
17
|
-
}}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import React, { useContext } from 'react';
|
|
3
|
-
import RcSlider, { Handle } from 'rc-slider';
|
|
4
|
-
import memoizeOne from 'memoize-one';
|
|
5
|
-
import isEqual from 'react-fast-compare';
|
|
6
|
-
import { FaFastBackward, FaFastForward } from 'react-icons/fa';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import cx from 'classnames';
|
|
9
|
-
import { SliderTooltip } from './slider-tooltip';
|
|
10
|
-
import './rc-slider.less';
|
|
11
|
-
import styles from './slider.module.less';
|
|
12
|
-
import { Tooltip } from '../tooltip/tooltip';
|
|
13
|
-
import { Button } from '../button/button';
|
|
14
|
-
import { DisabledContext } from '../../helpers/disabled-context';
|
|
15
|
-
|
|
16
|
-
const formatMarkers = (marks) => {
|
|
17
|
-
const formatted = marks.reduce((acc, { label, tooltip, value }) => {
|
|
18
|
-
const isTooltip = tooltip !== undefined;
|
|
19
|
-
const formattedValue = isTooltip ? (
|
|
20
|
-
<Tooltip text={tooltip}>{label}</Tooltip>
|
|
21
|
-
) : (
|
|
22
|
-
label || value
|
|
23
|
-
);
|
|
24
|
-
acc[value] = formattedValue;
|
|
25
|
-
return acc;
|
|
26
|
-
}, {});
|
|
27
|
-
return formatted;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const memoizedFormatMarkers = memoizeOne(formatMarkers, isEqual);
|
|
31
|
-
|
|
32
|
-
export const Slider = ({
|
|
33
|
-
name,
|
|
34
|
-
label,
|
|
35
|
-
width,
|
|
36
|
-
labelWidth,
|
|
37
|
-
value,
|
|
38
|
-
min,
|
|
39
|
-
max,
|
|
40
|
-
step,
|
|
41
|
-
marks,
|
|
42
|
-
showArrows,
|
|
43
|
-
showTooltip,
|
|
44
|
-
tooltipFormatter,
|
|
45
|
-
disabled,
|
|
46
|
-
vertical,
|
|
47
|
-
onChange,
|
|
48
|
-
range,
|
|
49
|
-
}) => {
|
|
50
|
-
const disabledContext = useContext(DisabledContext);
|
|
51
|
-
|
|
52
|
-
const formattedMarks = memoizedFormatMarkers(marks);
|
|
53
|
-
|
|
54
|
-
const onChangeValue = (value) => {
|
|
55
|
-
//rc-slider doesn't pass the Synthetic event
|
|
56
|
-
//but we can still follow the standard event format
|
|
57
|
-
onChange({
|
|
58
|
-
target: {
|
|
59
|
-
name,
|
|
60
|
-
value,
|
|
61
|
-
label,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const ButtonMin = () => (
|
|
67
|
-
<div className={styles.button}>
|
|
68
|
-
<Button
|
|
69
|
-
basic
|
|
70
|
-
small
|
|
71
|
-
onClick={() => onChangeValue(min)}
|
|
72
|
-
disabled={disabled || value === min || disabledContext}
|
|
73
|
-
icon={<FaFastBackward />}
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const ButtonMax = () => (
|
|
79
|
-
<div className={styles.button}>
|
|
80
|
-
<Button
|
|
81
|
-
basic
|
|
82
|
-
small
|
|
83
|
-
onClick={() => onChangeValue(max)}
|
|
84
|
-
disabled={disabled || value === max || disabledContext}
|
|
85
|
-
icon={<FaFastForward />}
|
|
86
|
-
/>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<div
|
|
92
|
-
className={cx(
|
|
93
|
-
styles.container,
|
|
94
|
-
vertical.enabled ? styles.vertical : '',
|
|
95
|
-
!_.isEmpty(marks) ? styles.hasMarks : '',
|
|
96
|
-
)}
|
|
97
|
-
style={
|
|
98
|
-
vertical.enabled
|
|
99
|
-
? { width: vertical.width, height: vertical.height }
|
|
100
|
-
: { width }
|
|
101
|
-
}
|
|
102
|
-
>
|
|
103
|
-
{showArrows && (vertical.enabled ? <ButtonMax /> : <ButtonMin />)}
|
|
104
|
-
{range ? (
|
|
105
|
-
<RcSlider.Range
|
|
106
|
-
allowCross={false}
|
|
107
|
-
className={cx(
|
|
108
|
-
(disabled || disabledContext) && styles.rcSliderDisabled,
|
|
109
|
-
showArrows && styles.hasArrows,
|
|
110
|
-
)}
|
|
111
|
-
value={value}
|
|
112
|
-
max={max}
|
|
113
|
-
min={min}
|
|
114
|
-
step={step}
|
|
115
|
-
marks={formattedMarks}
|
|
116
|
-
onChange={(v) => onChangeValue(v)}
|
|
117
|
-
disabled={disabled || disabledContext}
|
|
118
|
-
vertical={vertical.enabled}
|
|
119
|
-
handle={
|
|
120
|
-
showTooltip
|
|
121
|
-
? ({ index, value, dragging, ...handleProps }) => (
|
|
122
|
-
<Handle
|
|
123
|
-
key={index}
|
|
124
|
-
value={value}
|
|
125
|
-
{...handleProps} // eslint-disable-line react/jsx-props-no-spreading
|
|
126
|
-
>
|
|
127
|
-
{dragging && (
|
|
128
|
-
<SliderTooltip text={tooltipFormatter(value)} />
|
|
129
|
-
)}
|
|
130
|
-
</Handle>
|
|
131
|
-
)
|
|
132
|
-
: undefined
|
|
133
|
-
}
|
|
134
|
-
/>
|
|
135
|
-
) : (
|
|
136
|
-
<RcSlider
|
|
137
|
-
className={cx(
|
|
138
|
-
(disabled || disabledContext) && styles.rcSliderDisabled,
|
|
139
|
-
showArrows && styles.hasArrows,
|
|
140
|
-
)}
|
|
141
|
-
value={value}
|
|
142
|
-
max={max}
|
|
143
|
-
min={min}
|
|
144
|
-
step={step}
|
|
145
|
-
marks={formattedMarks}
|
|
146
|
-
onChange={(v) => onChangeValue(v)}
|
|
147
|
-
disabled={disabled || disabledContext}
|
|
148
|
-
vertical={vertical.enabled}
|
|
149
|
-
handle={
|
|
150
|
-
showTooltip
|
|
151
|
-
? ({ index, value, dragging, ...handleProps }) => (
|
|
152
|
-
<Handle
|
|
153
|
-
key={index}
|
|
154
|
-
value={value}
|
|
155
|
-
{...handleProps} // eslint-disable-line react/jsx-props-no-spreading
|
|
156
|
-
>
|
|
157
|
-
{dragging && (
|
|
158
|
-
<SliderTooltip text={tooltipFormatter(value)} />
|
|
159
|
-
)}
|
|
160
|
-
</Handle>
|
|
161
|
-
)
|
|
162
|
-
: undefined
|
|
163
|
-
}
|
|
164
|
-
/>
|
|
165
|
-
)}
|
|
166
|
-
|
|
167
|
-
{showArrows && (vertical.enabled ? <ButtonMin /> : <ButtonMax />)}
|
|
168
|
-
{label && (
|
|
169
|
-
<label className={styles.label} style={{ width: labelWidth }}>
|
|
170
|
-
{label}
|
|
171
|
-
</label>
|
|
172
|
-
)}
|
|
173
|
-
</div>
|
|
174
|
-
);
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
Slider.defaultProps = {
|
|
178
|
-
name: undefined,
|
|
179
|
-
label: null,
|
|
180
|
-
width: '100%',
|
|
181
|
-
labelWidth: 'auto',
|
|
182
|
-
step: 1,
|
|
183
|
-
marks: [],
|
|
184
|
-
showArrows: false,
|
|
185
|
-
showTooltip: false,
|
|
186
|
-
tooltipFormatter: (v) => v,
|
|
187
|
-
disabled: false,
|
|
188
|
-
range: false,
|
|
189
|
-
vertical: {
|
|
190
|
-
enabled: false,
|
|
191
|
-
width: '100px',
|
|
192
|
-
height: '400px',
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
Slider.propTypes = {
|
|
197
|
-
name: PropTypes.string,
|
|
198
|
-
label: PropTypes.oneOfType([
|
|
199
|
-
PropTypes.string,
|
|
200
|
-
PropTypes.number,
|
|
201
|
-
PropTypes.node,
|
|
202
|
-
]),
|
|
203
|
-
width: PropTypes.string,
|
|
204
|
-
labelWidth: PropTypes.string,
|
|
205
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.array]).isRequired,
|
|
206
|
-
min: PropTypes.number.isRequired,
|
|
207
|
-
max: PropTypes.number.isRequired,
|
|
208
|
-
step: PropTypes.number,
|
|
209
|
-
marks: PropTypes.arrayOf(
|
|
210
|
-
PropTypes.shape({
|
|
211
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
212
|
-
.isRequired,
|
|
213
|
-
label: PropTypes.oneOfType([
|
|
214
|
-
PropTypes.number,
|
|
215
|
-
PropTypes.string,
|
|
216
|
-
PropTypes.node,
|
|
217
|
-
]),
|
|
218
|
-
tooltip: PropTypes.oneOfType([
|
|
219
|
-
PropTypes.number,
|
|
220
|
-
PropTypes.string,
|
|
221
|
-
PropTypes.node,
|
|
222
|
-
]),
|
|
223
|
-
}),
|
|
224
|
-
),
|
|
225
|
-
onChange: PropTypes.func.isRequired,
|
|
226
|
-
showArrows: PropTypes.bool,
|
|
227
|
-
showTooltip: PropTypes.bool,
|
|
228
|
-
tooltipFormatter: PropTypes.func,
|
|
229
|
-
disabled: PropTypes.bool,
|
|
230
|
-
range: PropTypes.bool,
|
|
231
|
-
//for vertical variant:
|
|
232
|
-
vertical: PropTypes.object,
|
|
233
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
@import '../../style/variables.less';
|
|
2
|
-
|
|
3
|
-
.container {
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
min-height: 38px;
|
|
7
|
-
|
|
8
|
-
&.hasMarks {
|
|
9
|
-
padding-bottom: 20px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&.vertical {
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
padding-bottom: 0;
|
|
15
|
-
|
|
16
|
-
.hasArrows {
|
|
17
|
-
margin-top: 5px;
|
|
18
|
-
margin-bottom: 5px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.button {
|
|
22
|
-
svg {
|
|
23
|
-
transform: rotate(-90deg);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.label {
|
|
30
|
-
white-space: nowrap;
|
|
31
|
-
margin-left: 10px;
|
|
32
|
-
line-height: 1;
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
text-overflow: ellipsis;
|
|
35
|
-
flex-shrink: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.rcSliderDisabled {
|
|
39
|
-
background-color: transparent;
|
|
40
|
-
}
|