@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,155 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Loader, ProgressBar, Spinner, Spacer, Button, Card } from '../../..';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Progress/Loader',
|
|
6
|
-
component: Loader,
|
|
7
|
-
argTypes: {
|
|
8
|
-
theme: {
|
|
9
|
-
control: {
|
|
10
|
-
type: 'inline-radio',
|
|
11
|
-
},
|
|
12
|
-
options: ['white', 'light', 'dark'],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
args: {
|
|
16
|
-
theme: 'white',
|
|
17
|
-
text: 'Loading...',
|
|
18
|
-
width: '100%',
|
|
19
|
-
height: '100%',
|
|
20
|
-
fullViewPortSize: false,
|
|
21
|
-
},
|
|
22
|
-
decorators: [
|
|
23
|
-
(story) => (
|
|
24
|
-
<div style={{ height: '200px', position: 'relative' }}>{story()}</div>
|
|
25
|
-
),
|
|
26
|
-
],
|
|
27
|
-
parameters: {
|
|
28
|
-
docs: {
|
|
29
|
-
source: {
|
|
30
|
-
excludeDecorators: true,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const SpinnerTemplate = (args) => {
|
|
37
|
-
const { theme } = args;
|
|
38
|
-
return (
|
|
39
|
-
<Loader
|
|
40
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
41
|
-
{...args}
|
|
42
|
-
>
|
|
43
|
-
<Spinner dark={theme !== 'dark'} />
|
|
44
|
-
</Loader>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const ProgressBarTemplate = (args) => {
|
|
49
|
-
const { theme } = args;
|
|
50
|
-
return (
|
|
51
|
-
<Loader
|
|
52
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
53
|
-
{...args}
|
|
54
|
-
>
|
|
55
|
-
<ProgressBar width="300px" inverted={theme === 'dark'} percentage={40} />
|
|
56
|
-
</Loader>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Default = SpinnerTemplate.bind({});
|
|
61
|
-
|
|
62
|
-
export const WithProgressBar = ProgressBarTemplate.bind({});
|
|
63
|
-
|
|
64
|
-
export const TintedBackground = SpinnerTemplate.bind({});
|
|
65
|
-
TintedBackground.args = { theme: 'light' };
|
|
66
|
-
|
|
67
|
-
export const FullViewport = SpinnerTemplate.bind({});
|
|
68
|
-
FullViewport.args = {
|
|
69
|
-
theme: 'dark',
|
|
70
|
-
fullViewPortSize: true,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const FullViewportWithProgressBar = ProgressBarTemplate.bind({});
|
|
74
|
-
FullViewportWithProgressBar.args = {
|
|
75
|
-
theme: 'dark',
|
|
76
|
-
fullViewPortSize: true,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const WithExtraTextDetails = ProgressBarTemplate.bind({});
|
|
80
|
-
WithExtraTextDetails.args = { details: 'Some extra info' };
|
|
81
|
-
|
|
82
|
-
export const WithExtraJSXDetails = ProgressBarTemplate.bind({});
|
|
83
|
-
WithExtraJSXDetails.args = {
|
|
84
|
-
text: '',
|
|
85
|
-
details: (
|
|
86
|
-
<>
|
|
87
|
-
<div style={{ opacity: 0.5 }}>Step 1: Lorem ipsum...DONE</div>
|
|
88
|
-
<Spacer height="8px" />
|
|
89
|
-
<div>Step 2: Dolor est</div>
|
|
90
|
-
<Spacer height="8px" />
|
|
91
|
-
<div style={{ opacity: 0.5 }}>Step 3: Compendum</div>
|
|
92
|
-
<Spacer height="16px" />
|
|
93
|
-
<Button label="Cancel" onClick={() => {}} />
|
|
94
|
-
</>
|
|
95
|
-
),
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export const CoversCardContent = () => {
|
|
99
|
-
const [loading, setLoading] = useState(true);
|
|
100
|
-
return (
|
|
101
|
-
<>
|
|
102
|
-
<Button label="Toggle loading" onClick={() => setLoading(!loading)} />
|
|
103
|
-
<Spacer />
|
|
104
|
-
<Card>
|
|
105
|
-
<div style={{ position: 'relative' }}>
|
|
106
|
-
{loading && (
|
|
107
|
-
<Loader cover theme="white">
|
|
108
|
-
<Spinner dark />
|
|
109
|
-
</Loader>
|
|
110
|
-
)}
|
|
111
|
-
{'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '.repeat(
|
|
112
|
-
20,
|
|
113
|
-
)}
|
|
114
|
-
</div>
|
|
115
|
-
</Card>
|
|
116
|
-
</>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
CoversCardContent.parameters = {
|
|
120
|
-
docs: {
|
|
121
|
-
inlineStories: false,
|
|
122
|
-
iframeHeight: 300,
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export const ReplacesCardContent = () => {
|
|
127
|
-
const [loading, setLoading] = useState(true);
|
|
128
|
-
return (
|
|
129
|
-
<>
|
|
130
|
-
<Button label="Toggle loading" onClick={() => setLoading(!loading)} />
|
|
131
|
-
<Spacer />
|
|
132
|
-
<Card>
|
|
133
|
-
<div style={{ position: 'relative' }}>
|
|
134
|
-
{loading ? (
|
|
135
|
-
<Loader theme="white" height="200px">
|
|
136
|
-
<Spinner dark />
|
|
137
|
-
</Loader>
|
|
138
|
-
) : (
|
|
139
|
-
<div>
|
|
140
|
-
{'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '.repeat(
|
|
141
|
-
20,
|
|
142
|
-
)}
|
|
143
|
-
</div>
|
|
144
|
-
)}
|
|
145
|
-
</div>
|
|
146
|
-
</Card>
|
|
147
|
-
</>
|
|
148
|
-
);
|
|
149
|
-
};
|
|
150
|
-
ReplacesCardContent.parameters = {
|
|
151
|
-
docs: {
|
|
152
|
-
inlineStories: false,
|
|
153
|
-
iframeHeight: 300,
|
|
154
|
-
},
|
|
155
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/* intentional circular dependency (recursion for sub-menus) */
|
|
2
|
-
/* eslint-disable import/no-cycle*/
|
|
3
|
-
export { Layer } from './layer/layer';
|
|
4
|
-
/* eslint-enable import/no-cycle*/
|
|
5
|
-
export { placementOptions } from './layer/placementOptions';
|
|
6
|
-
export { siblings, registerClose } from './layer/path';
|
|
7
|
-
export { Trigger } from './trigger/trigger';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styles from '../menu.module.less';
|
|
3
|
-
|
|
4
|
-
export const Heading = ({ label, onClick, icon, testId }) => (
|
|
5
|
-
<div
|
|
6
|
-
onClick={(evt) => evt.stopPropagation()} //don't close menu
|
|
7
|
-
className={styles.heading}
|
|
8
|
-
data-testid={testId}
|
|
9
|
-
>
|
|
10
|
-
{label}
|
|
11
|
-
<span className={styles.headingIcon} onClick={onClick}>
|
|
12
|
-
{icon}
|
|
13
|
-
</span>
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { isValidElement, useState } from 'react';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import styles from '../menu.module.less';
|
|
4
|
-
import { Section } from './section';
|
|
5
|
-
import { childPath } from './path';
|
|
6
|
-
|
|
7
|
-
export const Layer = ({
|
|
8
|
-
sections,
|
|
9
|
-
isNested,
|
|
10
|
-
width,
|
|
11
|
-
closeOnOptionClick,
|
|
12
|
-
close,
|
|
13
|
-
tree,
|
|
14
|
-
path,
|
|
15
|
-
maxHeight,
|
|
16
|
-
showAllButton,
|
|
17
|
-
}) => {
|
|
18
|
-
if (isValidElement(sections)) {
|
|
19
|
-
return <>{sections}</>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const [showAll, setShowAll] = useState(!showAllButton?.visible); //show all by default
|
|
23
|
-
const additionalSections =
|
|
24
|
-
showAllButton?.additionalSections?.map((s) => ({
|
|
25
|
-
...s,
|
|
26
|
-
closeOnOptionClick,
|
|
27
|
-
visible: true,
|
|
28
|
-
})) ?? [];
|
|
29
|
-
|
|
30
|
-
const localSections = showAllButton?.visible
|
|
31
|
-
? sections
|
|
32
|
-
.map((s, i) => {
|
|
33
|
-
return showAll || i <= 3
|
|
34
|
-
? {
|
|
35
|
-
...s,
|
|
36
|
-
visible: true,
|
|
37
|
-
closeOnOptionClick,
|
|
38
|
-
}
|
|
39
|
-
: s;
|
|
40
|
-
})
|
|
41
|
-
.concat(
|
|
42
|
-
// add the show all button only when sections length is bigger than 4 options
|
|
43
|
-
sections.length > 4 && {
|
|
44
|
-
type: 'Option',
|
|
45
|
-
label: showAll
|
|
46
|
-
? showAllButton.showLessTitle
|
|
47
|
-
: showAllButton.showAllTitle,
|
|
48
|
-
onClick: () => setShowAll(!showAll),
|
|
49
|
-
visible: true,
|
|
50
|
-
closeOnOptionClick: false,
|
|
51
|
-
},
|
|
52
|
-
additionalSections,
|
|
53
|
-
)
|
|
54
|
-
.filter((s) => s?.visible)
|
|
55
|
-
: sections.map((s) => ({ ...s, closeOnOptionClick }));
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div
|
|
59
|
-
className={cx(styles.layer, isNested ? styles.nested : null)}
|
|
60
|
-
style={{
|
|
61
|
-
maxWidth: width,
|
|
62
|
-
maxHeight: maxHeight || 'auto',
|
|
63
|
-
overflowY: maxHeight ? 'auto' : 'default',
|
|
64
|
-
}}
|
|
65
|
-
>
|
|
66
|
-
<ul>
|
|
67
|
-
{localSections.map((section, i) => (
|
|
68
|
-
<li key={i}>
|
|
69
|
-
<Section
|
|
70
|
-
section={section}
|
|
71
|
-
closeOnOptionClick={section.closeOnOptionClick}
|
|
72
|
-
close={close}
|
|
73
|
-
tree={tree}
|
|
74
|
-
path={childPath(path, i)}
|
|
75
|
-
maxHeight={maxHeight}
|
|
76
|
-
/>
|
|
77
|
-
</li>
|
|
78
|
-
))}
|
|
79
|
-
</ul>
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React, { isValidElement } from 'react';
|
|
2
|
-
import { FaCheck } from 'react-icons/fa';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import { Icon } from '../../icon/icon';
|
|
5
|
-
import styles from '../menu.module.less';
|
|
6
|
-
import { Actions } from '../../actions/actions';
|
|
7
|
-
|
|
8
|
-
export const Option = ({
|
|
9
|
-
actions,
|
|
10
|
-
label,
|
|
11
|
-
url,
|
|
12
|
-
onClick,
|
|
13
|
-
description,
|
|
14
|
-
icon,
|
|
15
|
-
selected,
|
|
16
|
-
closeOnOptionClick,
|
|
17
|
-
close,
|
|
18
|
-
disabled,
|
|
19
|
-
inline,
|
|
20
|
-
title,
|
|
21
|
-
upload,
|
|
22
|
-
onChange,
|
|
23
|
-
testId,
|
|
24
|
-
}) => {
|
|
25
|
-
return (
|
|
26
|
-
<a
|
|
27
|
-
href={url}
|
|
28
|
-
className={cx(
|
|
29
|
-
styles.option,
|
|
30
|
-
disabled ? styles.disabled : '',
|
|
31
|
-
inline ? styles.inline : '',
|
|
32
|
-
selected ? styles.selected : '',
|
|
33
|
-
)}
|
|
34
|
-
disabled={disabled}
|
|
35
|
-
onClick={(evt) => {
|
|
36
|
-
evt.stopPropagation();
|
|
37
|
-
if (disabled || upload) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (closeOnOptionClick) {
|
|
41
|
-
close();
|
|
42
|
-
}
|
|
43
|
-
return onClick(evt);
|
|
44
|
-
}}
|
|
45
|
-
data-testid={testId}
|
|
46
|
-
>
|
|
47
|
-
{icon ? (
|
|
48
|
-
<span className={styles.icon}>
|
|
49
|
-
<Icon icon={icon} size={14} />
|
|
50
|
-
</span>
|
|
51
|
-
) : null}
|
|
52
|
-
<div className={styles.optionContent}>
|
|
53
|
-
{upload && (
|
|
54
|
-
<input
|
|
55
|
-
type="file"
|
|
56
|
-
className={styles.fileInput}
|
|
57
|
-
onChange={(evt) => {
|
|
58
|
-
onChange(evt.target.files);
|
|
59
|
-
close();
|
|
60
|
-
}}
|
|
61
|
-
/>
|
|
62
|
-
)}
|
|
63
|
-
<span className={styles.label} title={title || label}>
|
|
64
|
-
{label}
|
|
65
|
-
</span>
|
|
66
|
-
<div className={styles.right}>
|
|
67
|
-
<span className={styles.description}>{description}</span>
|
|
68
|
-
{!!actions?.length && (
|
|
69
|
-
<div className={styles.actions}>
|
|
70
|
-
<Actions actions={actions} right />
|
|
71
|
-
</div>
|
|
72
|
-
)}
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</a>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
Path helpers for menus with subsections
|
|
5
|
-
Mainly to help keep track of the close() handlers for nested layers
|
|
6
|
-
See menu.test.js for examples
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
parentPath gets the parent path
|
|
11
|
-
foo.bar[45] -> foo.bar
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const parentPath = (path) =>
|
|
15
|
-
path.includes('[') ? path.substr(0, path.lastIndexOf('[')) : path;
|
|
16
|
-
|
|
17
|
-
/*
|
|
18
|
-
childPath gets the child path given the parent path and section index
|
|
19
|
-
foo -> foo.sections[2]
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
export const childPath = (path, sectionIndex) =>
|
|
23
|
-
`${path}.sections[${sectionIndex}]`.replace(/^\./, '');
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
closePath gets the close handler's path given the path to the section
|
|
27
|
-
foo -> foo.close
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
export const closePath = (path) => `${path}.close`.replace(/^\./, '');
|
|
31
|
-
|
|
32
|
-
/*
|
|
33
|
-
siblings gets the siblings given any tree and path to a child
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
export const siblings = (tree, path) => _.get(tree, parentPath(path), []);
|
|
37
|
-
|
|
38
|
-
/*
|
|
39
|
-
registerClose sets the close handler given any tree and path to a child
|
|
40
|
-
(mutates intentionally, unavoidable in how we use the tree in Menu)
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
export const registerClose = (tree, path, close) =>
|
|
44
|
-
_.set(tree, closePath(path), close);
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { Heading } from './heading';
|
|
3
|
-
import { Divider } from './divider';
|
|
4
|
-
import { Option } from './option';
|
|
5
|
-
import { DropDownMenu } from '../menu';
|
|
6
|
-
import { DisabledContext } from '../../../helpers/disabled-context';
|
|
7
|
-
|
|
8
|
-
export const Section = ({
|
|
9
|
-
section,
|
|
10
|
-
closeOnOptionClick,
|
|
11
|
-
close,
|
|
12
|
-
tree,
|
|
13
|
-
path,
|
|
14
|
-
maxHeight,
|
|
15
|
-
}) => {
|
|
16
|
-
const disabledContext = useContext(DisabledContext);
|
|
17
|
-
|
|
18
|
-
switch (section.type) {
|
|
19
|
-
case 'Heading':
|
|
20
|
-
return (
|
|
21
|
-
<Heading
|
|
22
|
-
label={section.label}
|
|
23
|
-
onClick={section.onClick}
|
|
24
|
-
icon={section.icon}
|
|
25
|
-
testId={section.testId}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
case 'Divider':
|
|
29
|
-
return <Divider />;
|
|
30
|
-
case 'Option':
|
|
31
|
-
return (
|
|
32
|
-
<Option
|
|
33
|
-
actions={section.actions}
|
|
34
|
-
label={section.label}
|
|
35
|
-
url={section.url}
|
|
36
|
-
onClick={section.onClick}
|
|
37
|
-
description={section.description}
|
|
38
|
-
icon={section.icon}
|
|
39
|
-
selected={section.selected}
|
|
40
|
-
closeOnOptionClick={closeOnOptionClick}
|
|
41
|
-
close={close}
|
|
42
|
-
disabled={section.disabled || disabledContext}
|
|
43
|
-
inline={section.inline}
|
|
44
|
-
title={section.title}
|
|
45
|
-
upload={section.upload}
|
|
46
|
-
onChange={section.onChange}
|
|
47
|
-
testId={section.testId}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
case 'Menu':
|
|
51
|
-
return (
|
|
52
|
-
<DropDownMenu
|
|
53
|
-
menu={section.menu}
|
|
54
|
-
closeOnOptionClick={closeOnOptionClick}
|
|
55
|
-
isNested
|
|
56
|
-
closeParent={close}
|
|
57
|
-
tree={tree}
|
|
58
|
-
path={path}
|
|
59
|
-
maxHeight={maxHeight}
|
|
60
|
-
testId={section.testId}
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
default:
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
};
|