@oliasoft-open-source/react-ui-library 2.4.8 → 3.0.1
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 -621
- 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 -875
- 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,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styles from './divider.module.less';
|
|
4
|
-
import { Text } from '../text/text';
|
|
5
|
-
|
|
6
|
-
const cssAlignClass = (align) => {
|
|
7
|
-
switch (align) {
|
|
8
|
-
case 'left':
|
|
9
|
-
return styles.alignLeft;
|
|
10
|
-
case 'right':
|
|
11
|
-
return styles.alignRight;
|
|
12
|
-
default:
|
|
13
|
-
return '';
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const Divider = ({ children, margin, color, align }) => (
|
|
18
|
-
<div
|
|
19
|
-
className={`${styles.divider} ${cssAlignClass(align)}`}
|
|
20
|
-
style={{
|
|
21
|
-
marginTop: margin,
|
|
22
|
-
marginBottom: margin,
|
|
23
|
-
'--color': color,
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
{typeof children === 'string' ? <Text muted>{children}</Text> : children}
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
Divider.defaultProps = {
|
|
31
|
-
margin: 20,
|
|
32
|
-
color: 'var(--color-border)',
|
|
33
|
-
align: 'center',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
Divider.propTypes = {
|
|
37
|
-
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
38
|
-
color: PropTypes.string,
|
|
39
|
-
align: PropTypes.string,
|
|
40
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
@import '../../style/variables.less';
|
|
2
|
-
|
|
3
|
-
.divider {
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
text-align: center;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.divider::before,
|
|
10
|
-
.divider::after {
|
|
11
|
-
content: '';
|
|
12
|
-
flex: 1;
|
|
13
|
-
border-bottom: 1px solid var(--color);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.alignLeft::before {
|
|
17
|
-
flex-grow: 0.05;
|
|
18
|
-
}
|
|
19
|
-
.alignRight::after {
|
|
20
|
-
flex-grow: 0.05;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.divider:not(:empty)::before {
|
|
24
|
-
margin-right: 0.25em;
|
|
25
|
-
}
|
|
26
|
-
.divider:not(:empty)::after {
|
|
27
|
-
margin-left: 0.25em;
|
|
28
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Divider, Text } from '../../..';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Layout/Divider',
|
|
6
|
-
component: Divider,
|
|
7
|
-
argTypes: {
|
|
8
|
-
align: {
|
|
9
|
-
control: {
|
|
10
|
-
type: 'inline-radio',
|
|
11
|
-
},
|
|
12
|
-
options: ['left', 'center', 'right'],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
decorators: [(story) => <>content{story()}more content</>],
|
|
16
|
-
parameters: {
|
|
17
|
-
docs: {
|
|
18
|
-
source: {
|
|
19
|
-
excludeDecorators: true,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const Template = (args) => (
|
|
26
|
-
<Divider
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
|
-
{...args}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export const Default = Template.bind({});
|
|
33
|
-
|
|
34
|
-
export const WithText = Template.bind({});
|
|
35
|
-
WithText.args = {
|
|
36
|
-
children: 'Heading',
|
|
37
|
-
align: 'left',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const Margin = Template.bind({});
|
|
41
|
-
Margin.args = {
|
|
42
|
-
margin: 0,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const CustomColor = Template.bind({});
|
|
46
|
-
CustomColor.args = {
|
|
47
|
-
color: 'var(--color-text-success)',
|
|
48
|
-
children: <Text success>Colored text</Text>,
|
|
49
|
-
align: 'left',
|
|
50
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { FaGripLinesVertical } from 'react-icons/fa';
|
|
3
|
-
import { Resizable } from 'react-resizable';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import styles from './drawer.module.less';
|
|
6
|
-
|
|
7
|
-
const ResizeHandle = React.forwardRef((props, ref) => {
|
|
8
|
-
const { handleAxis, ...rest } = props;
|
|
9
|
-
return (
|
|
10
|
-
<div
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={styles.resizeHandle}
|
|
13
|
-
{...rest} // eslint-disable-line react/jsx-props-no-spreading
|
|
14
|
-
>
|
|
15
|
-
<FaGripLinesVertical />
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const DrawerResizeWrapper = ({
|
|
21
|
-
children,
|
|
22
|
-
width,
|
|
23
|
-
minWidth,
|
|
24
|
-
right,
|
|
25
|
-
onResize,
|
|
26
|
-
open,
|
|
27
|
-
}) => {
|
|
28
|
-
const [isResizing, setIsResizing] = useState(false);
|
|
29
|
-
const MINIMUM_OPEN_WIDTH = 100;
|
|
30
|
-
const MAXIMUM_OPEN_WIDTH = window.innerWidth / 2;
|
|
31
|
-
|
|
32
|
-
const handleResize = (event, { node, size, handle }) => {
|
|
33
|
-
if (
|
|
34
|
-
open &&
|
|
35
|
-
size.width > MINIMUM_OPEN_WIDTH &&
|
|
36
|
-
size.width < MAXIMUM_OPEN_WIDTH
|
|
37
|
-
) {
|
|
38
|
-
onResize(size.width);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return onResize ? (
|
|
43
|
-
<Resizable
|
|
44
|
-
width={width}
|
|
45
|
-
height={100} // Arbitrary height value. It's required by react-resizable even if height not adjustable but doesn't actually do anything in this case
|
|
46
|
-
minConstraints={[minWidth, null]}
|
|
47
|
-
onResize={handleResize}
|
|
48
|
-
handle={open ? <ResizeHandle /> : null}
|
|
49
|
-
resizeHandles={right ? ['w'] : ['e']}
|
|
50
|
-
axis="x"
|
|
51
|
-
className={isResizing ? styles.isResizing : ''}
|
|
52
|
-
onResizeStart={() => setIsResizing(true)}
|
|
53
|
-
onResizeStop={() => setIsResizing(false)}
|
|
54
|
-
>
|
|
55
|
-
{children}
|
|
56
|
-
</Resizable>
|
|
57
|
-
) : (
|
|
58
|
-
<>{children}</>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
DrawerResizeWrapper.defaultProps = {
|
|
63
|
-
right: false,
|
|
64
|
-
width: 400,
|
|
65
|
-
minWidth: null,
|
|
66
|
-
children: null,
|
|
67
|
-
onResize: null,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
DrawerResizeWrapper.propTypes = {
|
|
71
|
-
right: PropTypes.bool,
|
|
72
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
73
|
-
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
74
|
-
children: PropTypes.node,
|
|
75
|
-
onResize: PropTypes.func,
|
|
76
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import styles from './drawer.module.less';
|
|
4
|
-
|
|
5
|
-
export const DrawerTabs = ({
|
|
6
|
-
tabs,
|
|
7
|
-
activeTab,
|
|
8
|
-
background,
|
|
9
|
-
handleTabClick,
|
|
10
|
-
width,
|
|
11
|
-
testId,
|
|
12
|
-
}) => {
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<div className={styles.tabs}>
|
|
16
|
-
{tabs.map((tab, index) => (
|
|
17
|
-
<div
|
|
18
|
-
key={index}
|
|
19
|
-
className={cx(styles.tab, activeTab === index && styles.active)}
|
|
20
|
-
style={{ background }}
|
|
21
|
-
onClick={() => handleTabClick(index)}
|
|
22
|
-
data-testid={testId && `${testId}-icon-${index}`}
|
|
23
|
-
>
|
|
24
|
-
{tab.icon}
|
|
25
|
-
</div>
|
|
26
|
-
))}
|
|
27
|
-
</div>
|
|
28
|
-
{tabs.map((tab, index) => {
|
|
29
|
-
const active = activeTab === index;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div
|
|
33
|
-
style={{ width }}
|
|
34
|
-
className={styles.tabsContent}
|
|
35
|
-
key={index}
|
|
36
|
-
data-testid={testId && `${testId}-content-${index}`}
|
|
37
|
-
>
|
|
38
|
-
{active && tab.content}
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
})}
|
|
42
|
-
</>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import React, { isValidElement, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import { FaChevronLeft, FaChevronRight } from 'react-icons/fa';
|
|
5
|
-
import { Button } from '../button/button';
|
|
6
|
-
import { DrawerTabs } from './drawer-tabs';
|
|
7
|
-
import styles from './drawer.module.less';
|
|
8
|
-
import { DrawerResizeWrapper } from './drawer-resize-wrapper';
|
|
9
|
-
|
|
10
|
-
export const Drawer = ({
|
|
11
|
-
background,
|
|
12
|
-
children,
|
|
13
|
-
fixed,
|
|
14
|
-
open: openProp,
|
|
15
|
-
right,
|
|
16
|
-
shadow,
|
|
17
|
-
top,
|
|
18
|
-
width,
|
|
19
|
-
closedWidth,
|
|
20
|
-
button,
|
|
21
|
-
buttonAnimate,
|
|
22
|
-
buttonPosition,
|
|
23
|
-
border,
|
|
24
|
-
tabs,
|
|
25
|
-
defaultTabIndex,
|
|
26
|
-
testId,
|
|
27
|
-
onResize,
|
|
28
|
-
}) => {
|
|
29
|
-
const isStandardButton = button === true;
|
|
30
|
-
const isCustomButton = !isStandardButton && isValidElement(button);
|
|
31
|
-
const [open, setOpen] =
|
|
32
|
-
isStandardButton || tabs ? useState(openProp) : [openProp, null];
|
|
33
|
-
const [activeTab, setActiveTab] = useState(open ? defaultTabIndex : null);
|
|
34
|
-
const openWidth = Array.isArray(width) ? width[activeTab] : width;
|
|
35
|
-
const TABS_WIDTH = 38;
|
|
36
|
-
const currentWidth = open ? openWidth : tabs ? TABS_WIDTH : closedWidth;
|
|
37
|
-
|
|
38
|
-
const handleTabClick = (index) => {
|
|
39
|
-
if (activeTab === index) {
|
|
40
|
-
setActiveTab(null);
|
|
41
|
-
setOpen(false);
|
|
42
|
-
} else {
|
|
43
|
-
setActiveTab(index);
|
|
44
|
-
setOpen(true);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<DrawerResizeWrapper
|
|
50
|
-
width={currentWidth}
|
|
51
|
-
minWidth={tabs ? TABS_WIDTH : closedWidth}
|
|
52
|
-
onResize={onResize}
|
|
53
|
-
open={open}
|
|
54
|
-
right={right}
|
|
55
|
-
>
|
|
56
|
-
<div
|
|
57
|
-
className={cx(
|
|
58
|
-
styles.drawer,
|
|
59
|
-
shadow ? styles.shadow : '',
|
|
60
|
-
fixed ? styles.fixed : styles.inline,
|
|
61
|
-
right ? styles.right : styles.left,
|
|
62
|
-
)}
|
|
63
|
-
style={{ top }}
|
|
64
|
-
>
|
|
65
|
-
<div
|
|
66
|
-
className={cx(styles.drawerContent, border && styles.border)}
|
|
67
|
-
style={{ background, borderColor: border, width: currentWidth }}
|
|
68
|
-
>
|
|
69
|
-
{tabs ? (
|
|
70
|
-
<DrawerTabs
|
|
71
|
-
width={openWidth}
|
|
72
|
-
testId={testId}
|
|
73
|
-
open={open}
|
|
74
|
-
tabs={tabs}
|
|
75
|
-
activeTab={activeTab}
|
|
76
|
-
background={background}
|
|
77
|
-
handleTabClick={handleTabClick}
|
|
78
|
-
/>
|
|
79
|
-
) : (
|
|
80
|
-
<div style={{ width: openWidth }}>{children}</div>
|
|
81
|
-
)}
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
{button && (
|
|
85
|
-
<span
|
|
86
|
-
className={cx(
|
|
87
|
-
styles.toggleButton,
|
|
88
|
-
open && (isStandardButton || (isCustomButton && buttonAnimate))
|
|
89
|
-
? styles.toggleButtonOpen
|
|
90
|
-
: '',
|
|
91
|
-
buttonPosition === 'top' ? styles.top : styles.bottom,
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
{isCustomButton ? (
|
|
95
|
-
button
|
|
96
|
-
) : (
|
|
97
|
-
<Button
|
|
98
|
-
onClick={setOpen ? () => setOpen(!open) : null}
|
|
99
|
-
round
|
|
100
|
-
icon={right ? <FaChevronRight /> : <FaChevronLeft />}
|
|
101
|
-
/>
|
|
102
|
-
)}
|
|
103
|
-
</span>
|
|
104
|
-
)}
|
|
105
|
-
</div>
|
|
106
|
-
</DrawerResizeWrapper>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
Drawer.defaultProps = {
|
|
111
|
-
background: 'transparent',
|
|
112
|
-
fixed: false,
|
|
113
|
-
open: false,
|
|
114
|
-
right: false,
|
|
115
|
-
width: 400,
|
|
116
|
-
closedWidth: 0,
|
|
117
|
-
shadow: false,
|
|
118
|
-
top: 0,
|
|
119
|
-
button: null,
|
|
120
|
-
buttonAnimate: true,
|
|
121
|
-
buttonPosition: 'bottom',
|
|
122
|
-
border: false,
|
|
123
|
-
children: null,
|
|
124
|
-
tabs: null,
|
|
125
|
-
defaultTabIndex: 0,
|
|
126
|
-
testId: undefined,
|
|
127
|
-
onResize: null,
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
Drawer.propTypes = {
|
|
131
|
-
background: PropTypes.string,
|
|
132
|
-
fixed: PropTypes.bool,
|
|
133
|
-
open: PropTypes.bool,
|
|
134
|
-
right: PropTypes.bool,
|
|
135
|
-
width: PropTypes.oneOfType([
|
|
136
|
-
PropTypes.string,
|
|
137
|
-
PropTypes.number,
|
|
138
|
-
PropTypes.arrayOf(
|
|
139
|
-
PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
140
|
-
),
|
|
141
|
-
]),
|
|
142
|
-
closedWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
143
|
-
children: PropTypes.node,
|
|
144
|
-
shadow: PropTypes.bool,
|
|
145
|
-
top: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
146
|
-
//button
|
|
147
|
-
button: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
|
|
148
|
-
buttonAnimate: PropTypes.bool,
|
|
149
|
-
buttonPosition: PropTypes.oneOf(['top', 'bottom']),
|
|
150
|
-
border: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
151
|
-
// tabs
|
|
152
|
-
tabs: PropTypes.arrayOf(
|
|
153
|
-
PropTypes.shape({
|
|
154
|
-
icon: PropTypes.node,
|
|
155
|
-
content: PropTypes.node,
|
|
156
|
-
}),
|
|
157
|
-
),
|
|
158
|
-
testId: PropTypes.string,
|
|
159
|
-
defaultTabIndex: PropTypes.number,
|
|
160
|
-
onResize: PropTypes.func,
|
|
161
|
-
};
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
@import '../../style/variables.less';
|
|
2
|
-
|
|
3
|
-
:root {
|
|
4
|
-
--color-background-drawer-tabs: var(--color-neutral-50);
|
|
5
|
-
--color-background-drawer-tab: #fff9f4;
|
|
6
|
-
--color-background-drawer-tab-hover: white;
|
|
7
|
-
--color-border-drawer-tab: #e4cbb7;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
html[data-theme='dark'] {
|
|
11
|
-
--color-background-drawer-tabs: var(--color-neutral-900);
|
|
12
|
-
--color-background-drawer-tab: var(--color-primary-muted-800);
|
|
13
|
-
--color-background-drawer-tab-hover: var(--color-primary-muted-700);
|
|
14
|
-
--color-border-drawer-tab: var(--color-border);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.inline {
|
|
18
|
-
position: relative;
|
|
19
|
-
|
|
20
|
-
&.left {
|
|
21
|
-
order: -1;
|
|
22
|
-
margin-left: -1px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&.right {
|
|
26
|
-
order: 9999;
|
|
27
|
-
margin-right: -1px;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.fixed {
|
|
32
|
-
position: fixed;
|
|
33
|
-
top: 0;
|
|
34
|
-
bottom: 0;
|
|
35
|
-
z-index: @zindex_drawer;
|
|
36
|
-
|
|
37
|
-
&.left {
|
|
38
|
-
left: 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.right {
|
|
42
|
-
right: 0;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.border {
|
|
47
|
-
.left & {
|
|
48
|
-
border-right: 1px solid var(--color-border);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.right & {
|
|
52
|
-
border-left: 1px solid var(--color-border);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.shadow {
|
|
57
|
-
box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.drawerContent {
|
|
61
|
-
overflow-x: hidden;
|
|
62
|
-
overflow-y: auto;
|
|
63
|
-
max-height: 100%;
|
|
64
|
-
min-height: 100%;
|
|
65
|
-
transition: width 0.2s;
|
|
66
|
-
|
|
67
|
-
.isResizing & {
|
|
68
|
-
transition: none;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@media print {
|
|
72
|
-
background: transparent !important;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/* Hide scrollbar for Firefox */
|
|
76
|
-
scrollbar-width: none;
|
|
77
|
-
/* Hide scrollbar for IE 10+ */
|
|
78
|
-
-ms-overflow-style: none;
|
|
79
|
-
|
|
80
|
-
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
81
|
-
&::-webkit-scrollbar {
|
|
82
|
-
display: none;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.toggleButton {
|
|
87
|
-
transition: transform 0.4s;
|
|
88
|
-
display: inline-block;
|
|
89
|
-
transform: rotate(180deg);
|
|
90
|
-
position: absolute;
|
|
91
|
-
z-index: @zindex_drawer + 3;
|
|
92
|
-
|
|
93
|
-
.left & {
|
|
94
|
-
right: -19px;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.right & {
|
|
98
|
-
left: -19px;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&.top {
|
|
102
|
-
top: 20px;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&.bottom {
|
|
106
|
-
bottom: 20px;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
&.toggleButtonOpen {
|
|
110
|
-
transform: rotate(0deg);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.tabs {
|
|
115
|
-
position: absolute;
|
|
116
|
-
top: 0;
|
|
117
|
-
bottom: 0;
|
|
118
|
-
background-color: var(--color-background-drawer-tabs);
|
|
119
|
-
padding-top: 20px;
|
|
120
|
-
z-index: @zindex_drawer + 1;
|
|
121
|
-
border-left: 1px solid var(--color-border);
|
|
122
|
-
border-right: 1px solid var(--color-border);
|
|
123
|
-
|
|
124
|
-
.left & {
|
|
125
|
-
right: 0;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.right & {
|
|
129
|
-
left: 0;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.tab {
|
|
133
|
-
height: 38px;
|
|
134
|
-
width: 38px;
|
|
135
|
-
display: flex;
|
|
136
|
-
justify-content: center;
|
|
137
|
-
align-items: center;
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
margin: -1px;
|
|
140
|
-
transition: color 0.3s, background-color 0.3s;
|
|
141
|
-
border: 1px solid var(--color-border-drawer-tab);
|
|
142
|
-
|
|
143
|
-
.left & {
|
|
144
|
-
border-top-left-radius: 0;
|
|
145
|
-
border-bottom-left-radius: 0;
|
|
146
|
-
|
|
147
|
-
&.active {
|
|
148
|
-
border-left-color: transparent;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.right & {
|
|
153
|
-
border-top-right-radius: 0;
|
|
154
|
-
border-bottom-right-radius: 0;
|
|
155
|
-
|
|
156
|
-
&.active {
|
|
157
|
-
border-right-color: transparent;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
&:not(.active) {
|
|
162
|
-
color: var(--color-text-primary);
|
|
163
|
-
background-color: var(--color-background-drawer-tab) !important;
|
|
164
|
-
|
|
165
|
-
&:hover {
|
|
166
|
-
color: var(--color-text);
|
|
167
|
-
background-color: var(--color-background-drawer-tab-hover) !important;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
&.active {
|
|
172
|
-
color: var(--color-text);
|
|
173
|
-
border-color: var(--color-border);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.tabsContent {
|
|
179
|
-
.left & {
|
|
180
|
-
padding-right: 36px;
|
|
181
|
-
}
|
|
182
|
-
.right & {
|
|
183
|
-
padding-left: 36px;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.resizeHandle {
|
|
188
|
-
position: absolute;
|
|
189
|
-
top: 0;
|
|
190
|
-
bottom: 0;
|
|
191
|
-
width: 10px;
|
|
192
|
-
z-index: @zindex_drawer + 2;
|
|
193
|
-
cursor: ew-resize;
|
|
194
|
-
display: flex;
|
|
195
|
-
align-items: center;
|
|
196
|
-
color: var(--color-text-faint);
|
|
197
|
-
font-size: 12px;
|
|
198
|
-
transition: all 0.2s;
|
|
199
|
-
|
|
200
|
-
&:hover {
|
|
201
|
-
background: rgba(@colorPrimary, 0.15);
|
|
202
|
-
color: var(--color-text-primary);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
&:active {
|
|
206
|
-
background: var(--color-text-primary);
|
|
207
|
-
color: white;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.left & {
|
|
211
|
-
right: 0;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.right & {
|
|
215
|
-
left: 0;
|
|
216
|
-
}
|
|
217
|
-
}
|