@oliasoft-open-source/react-ui-library 2.4.8 → 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 -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,300 +0,0 @@
|
|
|
1
|
-
@import '../../style/variables.less';
|
|
2
|
-
|
|
3
|
-
@boxShadowOuter: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
4
|
-
|
|
5
|
-
:root {
|
|
6
|
-
--color-background-button-default: var(--color-neutral-0);
|
|
7
|
-
--color-background-button-default-hover: var(--color-neutral-50);
|
|
8
|
-
--color-background-button-default-active: var(--color-neutral-100);
|
|
9
|
-
|
|
10
|
-
--color-background-button-primary: var(--color-primary-500);
|
|
11
|
-
--color-background-button-primary-hover: var(--color-primary-550);
|
|
12
|
-
--color-background-button-primary-active: var(--color-primary-600);
|
|
13
|
-
|
|
14
|
-
--color-background-button-success: var(--color-success-500);
|
|
15
|
-
--color-background-button-success-hover: var(--color-success-550);
|
|
16
|
-
--color-background-button-success-active: var(--color-success-600);
|
|
17
|
-
|
|
18
|
-
--color-background-button-error: var(--color-error-500);
|
|
19
|
-
--color-background-button-error-hover: var(--color-error-550);
|
|
20
|
-
--color-background-button-error-active: var(--color-error-600);
|
|
21
|
-
|
|
22
|
-
--color-border-button: rgba(black, 0.15);
|
|
23
|
-
--color-border-button-hover: rgba(black, 0.2);
|
|
24
|
-
|
|
25
|
-
--color-text-button-muted: rgba(black, 0.4);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
html[data-theme='dark'] {
|
|
29
|
-
--color-background-button-default: var(--color-neutral-700);
|
|
30
|
-
--color-background-button-default-hover: var(--color-neutral-650);
|
|
31
|
-
--color-background-button-default-active: var(--color-neutral-600);
|
|
32
|
-
|
|
33
|
-
--color-background-button-primary: var(--color-primary-muted-500);
|
|
34
|
-
--color-background-button-primary-hover: var(--color-primary-muted-550);
|
|
35
|
-
--color-background-button-primary-active: var(--color-primary-muted-600);
|
|
36
|
-
|
|
37
|
-
--color-background-button-success: var(--color-success-muted-500);
|
|
38
|
-
--color-background-button-success-hover: var(--color-success-muted-550);
|
|
39
|
-
--color-background-button-success-active: var(--color-success-muted-600);
|
|
40
|
-
|
|
41
|
-
--color-background-button-error: var(--color-error-muted-500);
|
|
42
|
-
--color-background-button-error-hover: var(--color-error-muted-550);
|
|
43
|
-
--color-background-button-error-active: var(--color-error-muted-600);
|
|
44
|
-
|
|
45
|
-
--color-border-button: transparent;
|
|
46
|
-
--color-border-button-hover: transparent;
|
|
47
|
-
|
|
48
|
-
--color-text-button-muted: rgba(white, 0.4);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.button {
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
display: inline-flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
outline: 0;
|
|
57
|
-
border: 1px solid var(--color-border-button);
|
|
58
|
-
vertical-align: baseline;
|
|
59
|
-
background: var(--color-background-button-default);
|
|
60
|
-
color: var(--color-text);
|
|
61
|
-
font-family: @default_font;
|
|
62
|
-
padding: @input_padding_y @input_padding_x;
|
|
63
|
-
text-transform: none;
|
|
64
|
-
text-shadow: none;
|
|
65
|
-
font-weight: 700;
|
|
66
|
-
line-height: 1em;
|
|
67
|
-
font-style: normal;
|
|
68
|
-
text-align: center;
|
|
69
|
-
text-decoration: none;
|
|
70
|
-
border-radius: @input_border_radius;
|
|
71
|
-
user-select: none;
|
|
72
|
-
transition: opacity 0.1s ease, background-color 0.1s ease, color 0.1s ease,
|
|
73
|
-
box-shadow 0.1s ease, background 0.1s ease;
|
|
74
|
-
max-width: 100%;
|
|
75
|
-
min-height: @input_height;
|
|
76
|
-
box-shadow: @boxShadowOuter;
|
|
77
|
-
|
|
78
|
-
&:hover {
|
|
79
|
-
background: var(--color-background-button-default-hover);
|
|
80
|
-
border-color: var(--color-border-button-hover);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&:active {
|
|
84
|
-
background: var(--color-background-button-default-active);
|
|
85
|
-
box-shadow: none;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
&.active {
|
|
89
|
-
border-color: var(--color-background-button-primary);
|
|
90
|
-
color: var(--color-text-primary);
|
|
91
|
-
position: relative;
|
|
92
|
-
z-index: 2;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&:hover,
|
|
96
|
-
&:focus,
|
|
97
|
-
&:active {
|
|
98
|
-
position: relative;
|
|
99
|
-
z-index: 1;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.icon {
|
|
103
|
-
margin: 0 8px 0 -4px;
|
|
104
|
-
|
|
105
|
-
svg {
|
|
106
|
-
height: 14px;
|
|
107
|
-
width: 14px;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.iconOnly {
|
|
113
|
-
padding: 0.78571429em 0.78571429em 0.78571429em;
|
|
114
|
-
display: inline-flex;
|
|
115
|
-
align-items: center;
|
|
116
|
-
justify-content: center;
|
|
117
|
-
|
|
118
|
-
.icon {
|
|
119
|
-
margin: 0;
|
|
120
|
-
line-height: 0;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.basic {
|
|
125
|
-
color: var(--color-text-primary);
|
|
126
|
-
background: transparent;
|
|
127
|
-
box-shadow: none !important;
|
|
128
|
-
border: none !important;
|
|
129
|
-
|
|
130
|
-
&.muted {
|
|
131
|
-
color: var(--color-text-button-muted);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
&:hover,
|
|
135
|
-
&:focus {
|
|
136
|
-
color: var(--color-text-primary-hover);
|
|
137
|
-
background: rgba(0, 0, 0, 0.05);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
&:active,
|
|
141
|
-
&.active {
|
|
142
|
-
color: var(--color-text-primary-active);
|
|
143
|
-
background: rgba(0, 0, 0, 0.1);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.disabled {
|
|
148
|
-
cursor: default;
|
|
149
|
-
pointer-events: none !important;
|
|
150
|
-
color: var(--color-text-faint) !important;
|
|
151
|
-
box-shadow: none !important;
|
|
152
|
-
|
|
153
|
-
&:not(.active) {
|
|
154
|
-
&:not(.basic) {
|
|
155
|
-
background: var(--color-background-disabled) !important;
|
|
156
|
-
border: 1px solid var(--color-border) !important;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.small {
|
|
162
|
-
font-size: @input_font_size_small;
|
|
163
|
-
min-height: @input_height_small;
|
|
164
|
-
padding: 0 0.75rem;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.pill,
|
|
168
|
-
.round {
|
|
169
|
-
text-transform: uppercase;
|
|
170
|
-
letter-spacing: 0.1em;
|
|
171
|
-
font-size: 13px;
|
|
172
|
-
font-weight: bold;
|
|
173
|
-
border-radius: 19px;
|
|
174
|
-
display: inline-flex;
|
|
175
|
-
align-items: center;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.round {
|
|
179
|
-
padding: 0;
|
|
180
|
-
width: @input_height;
|
|
181
|
-
line-height: 1; // Fix for rendering issue on Windows
|
|
182
|
-
|
|
183
|
-
&.small {
|
|
184
|
-
width: @input_height_small;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.orange {
|
|
189
|
-
background-color: var(--color-background-button-primary);
|
|
190
|
-
|
|
191
|
-
&:hover,
|
|
192
|
-
&:focus {
|
|
193
|
-
background-color: var(--color-background-button-primary-hover);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
&:active {
|
|
197
|
-
background-color: var(--color-background-button-primary-active);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.red {
|
|
202
|
-
background-color: var(--color-background-button-error);
|
|
203
|
-
|
|
204
|
-
&:hover,
|
|
205
|
-
&:focus {
|
|
206
|
-
background-color: var(--color-background-button-error-hover);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
&:active {
|
|
210
|
-
background-color: var(--color-background-button-error-active);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.green {
|
|
215
|
-
background-color: var(--color-background-button-success);
|
|
216
|
-
|
|
217
|
-
&:hover,
|
|
218
|
-
&:focus {
|
|
219
|
-
background-color: var(--color-background-button-success-hover);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
&:active {
|
|
223
|
-
background-color: var(--color-background-button-success-active);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.orange,
|
|
228
|
-
.red,
|
|
229
|
-
.green {
|
|
230
|
-
color: #fff;
|
|
231
|
-
|
|
232
|
-
// &:not(.disabled) {
|
|
233
|
-
// border-color: transparent !important;
|
|
234
|
-
// }
|
|
235
|
-
|
|
236
|
-
&:hover,
|
|
237
|
-
&:focus {
|
|
238
|
-
color: #fff;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
&:active {
|
|
242
|
-
color: #fff;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.inverted {
|
|
247
|
-
background-color: transparent;
|
|
248
|
-
border-color: var(--color-text);
|
|
249
|
-
box-shadow: none;
|
|
250
|
-
|
|
251
|
-
&:hover,
|
|
252
|
-
&:focus,
|
|
253
|
-
&:active {
|
|
254
|
-
box-shadow: none;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
&.orange {
|
|
258
|
-
color: var(--color-background-button-primary);
|
|
259
|
-
border-color: var(--color-background-button-primary);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
&.red {
|
|
263
|
-
color: var(--color-background-button-error);
|
|
264
|
-
border-color: var(--color-background-button-error);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
&.green {
|
|
268
|
-
color: var(--color-background-button-success);
|
|
269
|
-
border-color: var(--color-background-button-success);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
&.orange,
|
|
273
|
-
&.red,
|
|
274
|
-
&.green {
|
|
275
|
-
&:hover,
|
|
276
|
-
&:focus,
|
|
277
|
-
&:active {
|
|
278
|
-
color: white;
|
|
279
|
-
box-shadow: none;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.groupOrderFirst,
|
|
285
|
-
.groupOrderMiddle,
|
|
286
|
-
.groupOrderLast {
|
|
287
|
-
margin-right: 0;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.groupOrderFirst,
|
|
291
|
-
.groupOrderMiddle {
|
|
292
|
-
border-top-right-radius: 0 !important;
|
|
293
|
-
border-bottom-right-radius: 0 !important;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.groupOrderLast,
|
|
297
|
-
.groupOrderMiddle {
|
|
298
|
-
border-top-left-radius: 0 !important;
|
|
299
|
-
border-bottom-left-radius: 0 !important;
|
|
300
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FaTrash } from 'react-icons/fa';
|
|
3
|
-
import { Button } from './button';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Forms/Button',
|
|
7
|
-
component: Button,
|
|
8
|
-
parameters: {
|
|
9
|
-
canvas: {
|
|
10
|
-
page: null,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
argTypes: {
|
|
14
|
-
colored: {
|
|
15
|
-
control: {
|
|
16
|
-
type: 'inline-radio',
|
|
17
|
-
},
|
|
18
|
-
options: {
|
|
19
|
-
off: false,
|
|
20
|
-
primary: 'primary',
|
|
21
|
-
success: 'success',
|
|
22
|
-
danger: 'danger',
|
|
23
|
-
muted: 'muted',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
icon: {
|
|
27
|
-
control: { type: 'inline-radio' },
|
|
28
|
-
options: {
|
|
29
|
-
off: undefined,
|
|
30
|
-
on: <FaTrash />,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
args: {
|
|
35
|
-
label: 'Label',
|
|
36
|
-
colored: false,
|
|
37
|
-
disabled: false,
|
|
38
|
-
icon: undefined,
|
|
39
|
-
basic: false,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const Template = (args) => (
|
|
44
|
-
<Button
|
|
45
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
46
|
-
{...args}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
export const Default = Template.bind({});
|
|
51
|
-
|
|
52
|
-
export const Small = Template.bind({});
|
|
53
|
-
Small.args = { small: true };
|
|
54
|
-
|
|
55
|
-
export const Basic = Template.bind({});
|
|
56
|
-
Basic.args = { basic: true };
|
|
57
|
-
|
|
58
|
-
export const WithIcon = Template.bind({});
|
|
59
|
-
WithIcon.args = { icon: <FaTrash /> };
|
|
60
|
-
|
|
61
|
-
export const Round = Template.bind({});
|
|
62
|
-
Round.args = { round: true, icon: <FaTrash />, label: undefined };
|
|
63
|
-
|
|
64
|
-
export const RoundMuted = Template.bind({});
|
|
65
|
-
RoundMuted.args = {
|
|
66
|
-
round: true,
|
|
67
|
-
icon: <FaTrash />,
|
|
68
|
-
label: undefined,
|
|
69
|
-
colored: 'muted',
|
|
70
|
-
basic: true,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const FullWidth = Template.bind({});
|
|
74
|
-
FullWidth.args = { width: '100%' };
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import { Button } from '../button/button';
|
|
5
|
-
import { Tooltip } from '../tooltip/tooltip';
|
|
6
|
-
import styles from './button-group.module.less';
|
|
7
|
-
import { isStringNumberOrNode } from '../../helpers/types';
|
|
8
|
-
import { DisabledContext } from '../../helpers/disabled-context';
|
|
9
|
-
|
|
10
|
-
export class ButtonGroup extends React.PureComponent {
|
|
11
|
-
onClick = (evt, key, value, label, disabledContextValue, disabledButton) => {
|
|
12
|
-
evt.preventDefault();
|
|
13
|
-
evt.stopPropagation();
|
|
14
|
-
if (this.props.disabled || disabledButton || disabledContextValue) return;
|
|
15
|
-
this.props.onSelected(key, value, label);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
renderIcon = (icon) => {
|
|
19
|
-
if (icon) {
|
|
20
|
-
return <i className={cx('icon', icon)} />;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
renderButtons = () => {
|
|
25
|
-
const buttons = this.props.items;
|
|
26
|
-
return buttons.map((button, i) => {
|
|
27
|
-
const type = Array.isArray(button) ? 'array' : typeof button;
|
|
28
|
-
const groupOrder =
|
|
29
|
-
i === 0 ? 'first' : i === buttons.length - 1 ? 'last' : 'middle';
|
|
30
|
-
const label =
|
|
31
|
-
type === 'string'
|
|
32
|
-
? button
|
|
33
|
-
: type === 'object'
|
|
34
|
-
? button.label
|
|
35
|
-
: type === 'array'
|
|
36
|
-
? button[1]
|
|
37
|
-
: null;
|
|
38
|
-
const value =
|
|
39
|
-
type === 'string'
|
|
40
|
-
? button
|
|
41
|
-
: type === 'object'
|
|
42
|
-
? button.value
|
|
43
|
-
: type === 'array'
|
|
44
|
-
? button[0]
|
|
45
|
-
: null;
|
|
46
|
-
const key = type === 'object' ? button.key : value;
|
|
47
|
-
const hidden = type === 'object' ? button.hidden : false;
|
|
48
|
-
const icon = type === 'object' ? button.icon : false;
|
|
49
|
-
const active =
|
|
50
|
-
type === 'object'
|
|
51
|
-
? key === this.props.value
|
|
52
|
-
: value === this.props.value;
|
|
53
|
-
const { error, maxTooltipWidth, testId, tooltip, warning } = button;
|
|
54
|
-
if (!hidden) {
|
|
55
|
-
return (
|
|
56
|
-
<DisabledContext.Consumer key={i}>
|
|
57
|
-
{(disabledContextValue) => (
|
|
58
|
-
<Tooltip
|
|
59
|
-
key={i}
|
|
60
|
-
error={!!error}
|
|
61
|
-
warning={!!warning}
|
|
62
|
-
text={tooltip || error || warning}
|
|
63
|
-
maxWidth={maxTooltipWidth}
|
|
64
|
-
display="block"
|
|
65
|
-
enabled={
|
|
66
|
-
(tooltip && isStringNumberOrNode(tooltip)) ||
|
|
67
|
-
(error && isStringNumberOrNode(error)) ||
|
|
68
|
-
(warning && isStringNumberOrNode(warning)) ||
|
|
69
|
-
false
|
|
70
|
-
}
|
|
71
|
-
placement="bottom-center"
|
|
72
|
-
>
|
|
73
|
-
<Button
|
|
74
|
-
active={active}
|
|
75
|
-
basic={this.props.basic}
|
|
76
|
-
disabled={this.props.disabled || button.disabled}
|
|
77
|
-
groupOrder={groupOrder}
|
|
78
|
-
icon={icon}
|
|
79
|
-
label={label}
|
|
80
|
-
onClick={(evt) =>
|
|
81
|
-
this.onClick(
|
|
82
|
-
evt,
|
|
83
|
-
key,
|
|
84
|
-
value,
|
|
85
|
-
label,
|
|
86
|
-
disabledContextValue,
|
|
87
|
-
button.disabled,
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
small={this.props.small}
|
|
91
|
-
testId={testId}
|
|
92
|
-
/>
|
|
93
|
-
</Tooltip>
|
|
94
|
-
)}
|
|
95
|
-
</DisabledContext.Consumer>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
renderHeader = () => {
|
|
102
|
-
if (this.props.header) {
|
|
103
|
-
return <label className={styles.label}>{this.props.header}</label>;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
render() {
|
|
108
|
-
const { testId } = this.props;
|
|
109
|
-
return (
|
|
110
|
-
<div>
|
|
111
|
-
<div>
|
|
112
|
-
{this.renderHeader()}
|
|
113
|
-
<div className={styles.buttonGroup} data-testid={testId}>
|
|
114
|
-
{this.renderButtons()}
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
ButtonGroup.defaultProps = {
|
|
123
|
-
basic: false,
|
|
124
|
-
items: [],
|
|
125
|
-
header: '',
|
|
126
|
-
onSelected: () => {},
|
|
127
|
-
small: false,
|
|
128
|
-
value: '',
|
|
129
|
-
testId: undefined,
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
ButtonGroup.propTypes = {
|
|
133
|
-
basic: PropTypes.bool, // Deprecated?
|
|
134
|
-
items: PropTypes.array,
|
|
135
|
-
header: PropTypes.string,
|
|
136
|
-
onSelected: PropTypes.func,
|
|
137
|
-
small: PropTypes.bool,
|
|
138
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
139
|
-
testId: PropTypes.string,
|
|
140
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
@import '../../style/variables.less';
|
|
2
|
-
|
|
3
|
-
.label {
|
|
4
|
-
display: inline-block;
|
|
5
|
-
width: auto;
|
|
6
|
-
margin: 0 0.85714286em 0 0;
|
|
7
|
-
vertical-align: baseline;
|
|
8
|
-
font-size: 0.92857143em;
|
|
9
|
-
font-weight: 700;
|
|
10
|
-
color: var(--color-text);
|
|
11
|
-
text-transform: none;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.buttonGroup {
|
|
15
|
-
display: inline-flex;
|
|
16
|
-
flex-direction: row;
|
|
17
|
-
// font-size: 0;
|
|
18
|
-
vertical-align: baseline;
|
|
19
|
-
margin: 0 0.25em 0 0;
|
|
20
|
-
|
|
21
|
-
> *:not(:last-child) {
|
|
22
|
-
margin-right: -1px;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FaQuestion, FaSortAmountDown, FaTrash } from 'react-icons/fa';
|
|
3
|
-
|
|
4
|
-
export const buttonsArrayOfObjects = [
|
|
5
|
-
{ key: 0, label: 'Aardvarks', value: 'termites' },
|
|
6
|
-
{ key: 1, label: 'Kangaroos', value: 'grass' },
|
|
7
|
-
{ key: 2, label: 'Monkeys', value: 'bananas' },
|
|
8
|
-
{ key: 3, label: 'Possums', value: 'slugs', hidden: true },
|
|
9
|
-
{ key: 4, label: 'Pandas', value: 'bamboo', disabled: true },
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
export const buttonsWithIcons = [
|
|
13
|
-
{
|
|
14
|
-
key: 0,
|
|
15
|
-
label: 'Sort',
|
|
16
|
-
value: 'upload',
|
|
17
|
-
icon: <FaSortAmountDown />,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
key: 1,
|
|
21
|
-
label: 'Delete',
|
|
22
|
-
value: 'delete',
|
|
23
|
-
icon: <FaTrash />,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
key: 2,
|
|
27
|
-
label: 'Help',
|
|
28
|
-
value: 'help',
|
|
29
|
-
icon: <FaQuestion />,
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
export const buttonsArrayOfStrings = ['One', 'Two', 'Three'];
|
|
34
|
-
|
|
35
|
-
export const buttonsArrayOfArrays = [
|
|
36
|
-
['first_item', 'One'],
|
|
37
|
-
['second_item', 'Two'],
|
|
38
|
-
['third_item', 'Three'],
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
export const buttonsWithTooltips = [
|
|
42
|
-
{
|
|
43
|
-
key: 0,
|
|
44
|
-
label: 'Aardvarks',
|
|
45
|
-
value: 'termites',
|
|
46
|
-
tooltip: 'Eats 50k termites / night',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
key: 1,
|
|
50
|
-
label: 'Kangaroos',
|
|
51
|
-
value: 'grass',
|
|
52
|
-
tooltip: <span>Babies are called joeys</span>,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
key: 2,
|
|
56
|
-
label: 'Monkeys',
|
|
57
|
-
value: 'bananas',
|
|
58
|
-
warning: 'A bit cheeky',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
key: 3,
|
|
62
|
-
label: 'Pandas',
|
|
63
|
-
value: 'bamboo',
|
|
64
|
-
disabled: true,
|
|
65
|
-
tooltip: 'Extinct',
|
|
66
|
-
},
|
|
67
|
-
];
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useArgs } from '@storybook/addons';
|
|
3
|
-
import { ButtonGroup } from './button-group';
|
|
4
|
-
import * as storyData from './button-group.stories-data';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Forms/ButtonGroup',
|
|
8
|
-
component: ButtonGroup,
|
|
9
|
-
args: {
|
|
10
|
-
disabled: false,
|
|
11
|
-
items: storyData.buttonsArrayOfObjects,
|
|
12
|
-
value: 0,
|
|
13
|
-
small: false,
|
|
14
|
-
testId: undefined,
|
|
15
|
-
onSelected: () => {},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Template = (args) => {
|
|
20
|
-
const [_, updateArgs] = useArgs();
|
|
21
|
-
const handleChange = (evt) => {
|
|
22
|
-
updateArgs({ value: evt });
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<ButtonGroup
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
|
-
{...args}
|
|
29
|
-
onSelected={handleChange}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
export const Default = Template.bind({});
|
|
34
|
-
|
|
35
|
-
export const Icons = Template.bind({});
|
|
36
|
-
Icons.args = { items: storyData.buttonsWithIcons };
|
|
37
|
-
|
|
38
|
-
export const Tooltips = Template.bind({});
|
|
39
|
-
Tooltips.args = { items: storyData.buttonsWithTooltips };
|
|
40
|
-
|
|
41
|
-
export const Disabled = Template.bind({});
|
|
42
|
-
Disabled.args = { disabled: true };
|
|
43
|
-
|
|
44
|
-
export const ArrayOfStrings = Template.bind({});
|
|
45
|
-
ArrayOfStrings.args = { items: storyData.buttonsArrayOfStrings };
|
|
46
|
-
ArrayOfStrings.parameters = {
|
|
47
|
-
docs: {
|
|
48
|
-
description: {
|
|
49
|
-
story: 'For simple cases when button key, label and value are the same.',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const ArrayOfArrays = Template.bind({});
|
|
55
|
-
ArrayOfArrays.args = { items: storyData.buttonsArrayOfArrays };
|
|
56
|
-
ArrayOfArrays.parameters = {
|
|
57
|
-
docs: {
|
|
58
|
-
description: {
|
|
59
|
-
story:
|
|
60
|
-
'Avoid this deprecated legacy usage (still supported, but may be removed in future).',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
};
|