@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,137 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FaBell, FaSignOutAlt, FaUser } from 'react-icons/fa';
|
|
3
|
-
import { TopBar, Menu, Button, Badge } from '../../..';
|
|
4
|
-
import LogoSVG from '../../images/logo.svg';
|
|
5
|
-
|
|
6
|
-
const content = [
|
|
7
|
-
{
|
|
8
|
-
type: 'Link',
|
|
9
|
-
label: 'Link',
|
|
10
|
-
onClick: () => {},
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
type: 'Link',
|
|
14
|
-
label: 'Active',
|
|
15
|
-
active: true,
|
|
16
|
-
onClick: () => {},
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
type: 'Link',
|
|
20
|
-
label: 'Disabled',
|
|
21
|
-
disabled: true,
|
|
22
|
-
onClick: () => {},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'Menu',
|
|
26
|
-
label: 'Dropdown',
|
|
27
|
-
onClick: () => {},
|
|
28
|
-
sections: [
|
|
29
|
-
{
|
|
30
|
-
type: 'Option',
|
|
31
|
-
label: 'Alpacas',
|
|
32
|
-
onClick: () => {},
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: 'Option',
|
|
36
|
-
label: 'Llamas',
|
|
37
|
-
onClick: () => {},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
type: 'Button',
|
|
43
|
-
label: 'Save',
|
|
44
|
-
colored: true,
|
|
45
|
-
onClick: () => {},
|
|
46
|
-
testId: 'top-bar-button-save',
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
const contentRight = [
|
|
51
|
-
{
|
|
52
|
-
type: 'Component',
|
|
53
|
-
component: (
|
|
54
|
-
<Badge title="3" small margin="5px">
|
|
55
|
-
<Button icon={<FaBell />} round onClick={() => {}} />
|
|
56
|
-
</Badge>
|
|
57
|
-
),
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
type: 'Component',
|
|
61
|
-
component: (
|
|
62
|
-
<Menu
|
|
63
|
-
menu={{
|
|
64
|
-
trigger: 'Component',
|
|
65
|
-
fullHeightTrigger: true,
|
|
66
|
-
placement: 'bottom-end',
|
|
67
|
-
component: <Button label="TU" round onClick={() => {}} />,
|
|
68
|
-
sections: [
|
|
69
|
-
{
|
|
70
|
-
type: 'Heading',
|
|
71
|
-
label: 'Test User',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: 'Option',
|
|
75
|
-
label: 'Profile',
|
|
76
|
-
icon: <FaUser color="var(--color-text-primary)" />,
|
|
77
|
-
onClick: () => {},
|
|
78
|
-
},
|
|
79
|
-
{ type: 'Divider' },
|
|
80
|
-
{
|
|
81
|
-
type: 'Option',
|
|
82
|
-
label: 'Sign out',
|
|
83
|
-
icon: <FaSignOutAlt color="var(--color-text-primary)" />,
|
|
84
|
-
onClick: () => {},
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
}}
|
|
88
|
-
/>
|
|
89
|
-
),
|
|
90
|
-
},
|
|
91
|
-
];
|
|
92
|
-
|
|
93
|
-
export default {
|
|
94
|
-
title: 'Navigation/TopBar',
|
|
95
|
-
component: TopBar,
|
|
96
|
-
parameters: {
|
|
97
|
-
layout: 'fullscreen',
|
|
98
|
-
docs: {
|
|
99
|
-
inlineStories: false,
|
|
100
|
-
iframeHeight: 200,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
argTypes: {
|
|
104
|
-
height: { control: 'text' },
|
|
105
|
-
},
|
|
106
|
-
args: {
|
|
107
|
-
title: {
|
|
108
|
-
logo: <img src={LogoSVG} alt="logo" />,
|
|
109
|
-
version: 'V1.2.3',
|
|
110
|
-
onClick: () => {},
|
|
111
|
-
},
|
|
112
|
-
content,
|
|
113
|
-
contentRight,
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const Template = (args) => (
|
|
118
|
-
<TopBar // eslint-disable-next-line react/jsx-props-no-spreading
|
|
119
|
-
{...args}
|
|
120
|
-
/>
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
export const Default = Template.bind({});
|
|
124
|
-
|
|
125
|
-
export const WithWarning = Template.bind({});
|
|
126
|
-
WithWarning.args = {
|
|
127
|
-
warning: 'Application update available. Please refresh your browser.',
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const TextBranding = Template.bind({});
|
|
131
|
-
TextBranding.args = {
|
|
132
|
-
title: {
|
|
133
|
-
label: 'Text Branding',
|
|
134
|
-
version: 'V1.2.3',
|
|
135
|
-
onClick: () => {},
|
|
136
|
-
},
|
|
137
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import { GrDrag } from 'react-icons/gr';
|
|
4
|
-
import { AiOutlineMinusSquare, AiOutlinePlusSquare } from 'react-icons/ai';
|
|
5
|
-
import listStyles from '../list/list.module.less';
|
|
6
|
-
import styles from './tree.module.less';
|
|
7
|
-
import { Actions } from '../actions/actions';
|
|
8
|
-
import { MetaContent } from '../list/list-row/meta-content';
|
|
9
|
-
import { Button } from '../button/button';
|
|
10
|
-
|
|
11
|
-
// TODO: Replace this with reused list-item component
|
|
12
|
-
|
|
13
|
-
export const TreeItem = ({
|
|
14
|
-
node,
|
|
15
|
-
depth,
|
|
16
|
-
isOpen,
|
|
17
|
-
onToggle,
|
|
18
|
-
hasChild,
|
|
19
|
-
draggable,
|
|
20
|
-
}) => {
|
|
21
|
-
const { active, id, testId, onClick } = node;
|
|
22
|
-
|
|
23
|
-
const handleToggle = (e) => {
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
onToggle(id);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// TODO: Decide whether to implement open on drag over
|
|
29
|
-
// const dragOverProps = useDragOver(id, isOpen, onToggle);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div
|
|
33
|
-
className={cx(
|
|
34
|
-
listStyles.item,
|
|
35
|
-
listStyles.action,
|
|
36
|
-
active ? listStyles.active : '',
|
|
37
|
-
)}
|
|
38
|
-
data-testid={testId}
|
|
39
|
-
onClick={(e) => {
|
|
40
|
-
if (onClick) {
|
|
41
|
-
onClick(e);
|
|
42
|
-
}
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<div
|
|
46
|
-
className={listStyles.itemHeader}
|
|
47
|
-
style={{
|
|
48
|
-
marginInlineStart: depth * 24,
|
|
49
|
-
}}
|
|
50
|
-
// TODO: Decide whether to implement open on drag over
|
|
51
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
52
|
-
// {...dragOverProps}
|
|
53
|
-
>
|
|
54
|
-
{draggable && (
|
|
55
|
-
<div className={listStyles.drag}>
|
|
56
|
-
<GrDrag />
|
|
57
|
-
</div>
|
|
58
|
-
)}
|
|
59
|
-
|
|
60
|
-
{hasChild && (
|
|
61
|
-
<div className={styles.toggle}>
|
|
62
|
-
<Button
|
|
63
|
-
basic
|
|
64
|
-
colored="muted"
|
|
65
|
-
small
|
|
66
|
-
round
|
|
67
|
-
icon={isOpen ? <AiOutlineMinusSquare /> : <AiOutlinePlusSquare />}
|
|
68
|
-
onClick={handleToggle}
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
)}
|
|
72
|
-
<MetaContent item={node} />
|
|
73
|
-
<div className={listStyles.actions}>
|
|
74
|
-
<Actions actions={node.actions} right />
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Tree as TreeView } from '@minoru/react-dnd-treeview';
|
|
4
|
-
import { TreeItem } from './tree-item';
|
|
5
|
-
import listStyles from '../list/list.module.less';
|
|
6
|
-
import styles from './tree.module.less';
|
|
7
|
-
import { ListHeading } from '../list/list-row/list-heading';
|
|
8
|
-
import { TreePlaceholder } from './tree-placeholder';
|
|
9
|
-
import { actionsShape } from '../actions/actions.shape';
|
|
10
|
-
|
|
11
|
-
export const Tree = ({
|
|
12
|
-
list,
|
|
13
|
-
draggable,
|
|
14
|
-
onListReorder,
|
|
15
|
-
testId,
|
|
16
|
-
isInitialOpen,
|
|
17
|
-
treeRef,
|
|
18
|
-
}) => {
|
|
19
|
-
const handleDrop = (newTree) => {
|
|
20
|
-
if (onListReorder) {
|
|
21
|
-
onListReorder(newTree);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div data-testid={testId}>
|
|
27
|
-
{list.name && !list.noHeader && (
|
|
28
|
-
<ListHeading name={list.name} actions={list.actions} />
|
|
29
|
-
)}
|
|
30
|
-
<div className={listStyles.list}>
|
|
31
|
-
<TreeView
|
|
32
|
-
ref={treeRef}
|
|
33
|
-
tree={list.items}
|
|
34
|
-
sort={false}
|
|
35
|
-
insertDroppableFirst={false}
|
|
36
|
-
canDrag={() => draggable}
|
|
37
|
-
canDrop={(tree, { dragSource, dropTargetId }) => {
|
|
38
|
-
if (dragSource?.parent === dropTargetId) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
}}
|
|
42
|
-
rootId={0}
|
|
43
|
-
render={(node, { depth, isOpen, onToggle, hasChild }) => {
|
|
44
|
-
return (
|
|
45
|
-
<TreeItem
|
|
46
|
-
hasChild={hasChild}
|
|
47
|
-
node={node}
|
|
48
|
-
depth={depth}
|
|
49
|
-
isOpen={isOpen}
|
|
50
|
-
onToggle={onToggle}
|
|
51
|
-
draggable={draggable}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
}}
|
|
55
|
-
onDrop={handleDrop}
|
|
56
|
-
dropTargetOffset={5}
|
|
57
|
-
placeholderRender={(node, { depth }) => (
|
|
58
|
-
<TreePlaceholder depth={depth} />
|
|
59
|
-
)}
|
|
60
|
-
placeholderComponent="div"
|
|
61
|
-
listComponent="div"
|
|
62
|
-
listItemComponent="div"
|
|
63
|
-
classes={{
|
|
64
|
-
root: styles.tree,
|
|
65
|
-
draggingSource: styles.draggingSource,
|
|
66
|
-
dropTarget: styles.dropTarget,
|
|
67
|
-
placeholder: styles.placeholderContainer,
|
|
68
|
-
}}
|
|
69
|
-
initialOpen={isInitialOpen}
|
|
70
|
-
/>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
Tree.defaultProps = {
|
|
77
|
-
draggable: false,
|
|
78
|
-
onListReorder: () => {},
|
|
79
|
-
testId: undefined,
|
|
80
|
-
isInitialOpen: false,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
Tree.propTypes = {
|
|
84
|
-
list: PropTypes.shape({
|
|
85
|
-
name: PropTypes.string,
|
|
86
|
-
actions: actionsShape,
|
|
87
|
-
items: PropTypes.arrayOf(
|
|
88
|
-
PropTypes.shape({
|
|
89
|
-
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
90
|
-
.isRequired,
|
|
91
|
-
name: PropTypes.string.isRequired,
|
|
92
|
-
parent: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
93
|
-
.isRequired,
|
|
94
|
-
droppable: PropTypes.bool,
|
|
95
|
-
details: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
96
|
-
active: PropTypes.bool,
|
|
97
|
-
testId: PropTypes.string,
|
|
98
|
-
actions: actionsShape,
|
|
99
|
-
icon: PropTypes.shape({
|
|
100
|
-
icon: PropTypes.node.isRequired,
|
|
101
|
-
color: PropTypes.string.isRequired,
|
|
102
|
-
tooltip: PropTypes.shape({
|
|
103
|
-
text: PropTypes.oneOfType([
|
|
104
|
-
PropTypes.string,
|
|
105
|
-
PropTypes.number,
|
|
106
|
-
PropTypes.node,
|
|
107
|
-
]),
|
|
108
|
-
error: PropTypes.bool,
|
|
109
|
-
warning: PropTypes.bool,
|
|
110
|
-
placement: PropTypes.string,
|
|
111
|
-
enabled: PropTypes.bool,
|
|
112
|
-
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
113
|
-
triggerOffset: PropTypes.oneOfType([
|
|
114
|
-
PropTypes.string,
|
|
115
|
-
PropTypes.number,
|
|
116
|
-
]),
|
|
117
|
-
possiblePlacements: PropTypes.array,
|
|
118
|
-
fontSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
119
|
-
padding: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
120
|
-
}),
|
|
121
|
-
}),
|
|
122
|
-
}),
|
|
123
|
-
).isRequired,
|
|
124
|
-
}).isRequired,
|
|
125
|
-
draggable: PropTypes.bool,
|
|
126
|
-
onListReorder: PropTypes.func,
|
|
127
|
-
testId: PropTypes.string,
|
|
128
|
-
isInitialOpen: PropTypes.bool,
|
|
129
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
@import '../../style/variables.less';
|
|
2
|
-
|
|
3
|
-
.tree {
|
|
4
|
-
position: relative;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.toggle {
|
|
8
|
-
display: flex;
|
|
9
|
-
margin: -2px 7px -2px -7px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.dropTarget > div:first-child {
|
|
13
|
-
background-color: var(--color-background-listitem-active);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.draggingSource {
|
|
17
|
-
opacity: 0.2;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.placeholderContainer {
|
|
21
|
-
position: relative;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.placeholder {
|
|
25
|
-
background-color: var(--color-background-primary);
|
|
26
|
-
height: 4px;
|
|
27
|
-
border-radius: 2px;
|
|
28
|
-
position: absolute;
|
|
29
|
-
right: 0;
|
|
30
|
-
top: 0;
|
|
31
|
-
transform: translateY(-50%);
|
|
32
|
-
z-index: 2;
|
|
33
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FaArrowDown, FaArrowUp, FaPlus, FaTrash } from 'react-icons/fa';
|
|
3
|
-
|
|
4
|
-
export const list = {
|
|
5
|
-
name: 'Animals',
|
|
6
|
-
items: [
|
|
7
|
-
{
|
|
8
|
-
id: 1,
|
|
9
|
-
parent: 0,
|
|
10
|
-
droppable: true,
|
|
11
|
-
name: 'Mammals',
|
|
12
|
-
onClick: () => console.log('Test'),
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: 2,
|
|
16
|
-
parent: 1,
|
|
17
|
-
droppable: true,
|
|
18
|
-
name: 'Cats',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 3,
|
|
22
|
-
parent: 1,
|
|
23
|
-
droppable: true,
|
|
24
|
-
name: 'Dogs',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: 4,
|
|
28
|
-
parent: 0,
|
|
29
|
-
droppable: true,
|
|
30
|
-
name: 'Amphibians',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: 5,
|
|
34
|
-
parent: 4,
|
|
35
|
-
droppable: true,
|
|
36
|
-
name: 'Frogs',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 6,
|
|
40
|
-
parent: 0,
|
|
41
|
-
droppable: true,
|
|
42
|
-
name: 'Reptiles',
|
|
43
|
-
active: true,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const listActions = {
|
|
49
|
-
...list,
|
|
50
|
-
header: {
|
|
51
|
-
...list.header,
|
|
52
|
-
actions: [
|
|
53
|
-
{
|
|
54
|
-
label: 'Add',
|
|
55
|
-
primary: true,
|
|
56
|
-
icon: <FaPlus />,
|
|
57
|
-
onClick: () => {},
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
items: list.items.map((item) => ({
|
|
62
|
-
...item,
|
|
63
|
-
actions: [
|
|
64
|
-
{
|
|
65
|
-
label: 'Delete',
|
|
66
|
-
icon: <FaTrash />,
|
|
67
|
-
onClick: () => {},
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
})),
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const listControlParents = {
|
|
74
|
-
...list,
|
|
75
|
-
items: list.items.map((item) => ({
|
|
76
|
-
...item,
|
|
77
|
-
droppable: item.parent === 0,
|
|
78
|
-
details: item.parent === 0 ? 'Droppable' : 'Not droppable',
|
|
79
|
-
})),
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const listFlat = {
|
|
83
|
-
...list,
|
|
84
|
-
items: list.items.map((item) => ({
|
|
85
|
-
...item,
|
|
86
|
-
parent: 0,
|
|
87
|
-
droppable: 0,
|
|
88
|
-
})),
|
|
89
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { FaPlus } from 'react-icons/fa';
|
|
3
|
-
import { Tree } from '../../..';
|
|
4
|
-
import * as storyData from './tree.stories-data';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Basic/Tree',
|
|
8
|
-
component: Tree,
|
|
9
|
-
args: {
|
|
10
|
-
list: storyData.list,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const Template = (args) => (
|
|
15
|
-
<Tree
|
|
16
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
17
|
-
{...args}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
export const Default = Template.bind({});
|
|
21
|
-
|
|
22
|
-
export const Actions = Template.bind({});
|
|
23
|
-
Actions.args = { list: storyData.listActions };
|
|
24
|
-
|
|
25
|
-
export const Draggable = Template.bind({});
|
|
26
|
-
Draggable.args = { draggable: true };
|
|
27
|
-
|
|
28
|
-
export const Droppable = Template.bind({});
|
|
29
|
-
Droppable.args = { draggable: true, list: storyData.listControlParents };
|
|
30
|
-
Droppable.parameters = {
|
|
31
|
-
docs: {
|
|
32
|
-
description: {
|
|
33
|
-
story:
|
|
34
|
-
'Use the `droppable` prop to specify which items can have other items dropped into them.',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Flat = Template.bind({});
|
|
40
|
-
Flat.args = { draggable: true, list: storyData.listFlat };
|
|
41
|
-
|
|
42
|
-
export const ExpandedByDefault = Template.bind({});
|
|
43
|
-
ExpandedByDefault.args = { isInitialOpen: true };
|
|
44
|
-
|
|
45
|
-
export const Managed = () => {
|
|
46
|
-
const [items, setItems] = useState([
|
|
47
|
-
{
|
|
48
|
-
id: 1,
|
|
49
|
-
parent: 0,
|
|
50
|
-
droppable: true,
|
|
51
|
-
name: 'Mammals',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: 2,
|
|
55
|
-
parent: 1,
|
|
56
|
-
droppable: true,
|
|
57
|
-
name: 'Cats',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: 3,
|
|
61
|
-
parent: 1,
|
|
62
|
-
droppable: true,
|
|
63
|
-
name: 'Dogs',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: 4,
|
|
67
|
-
parent: 0,
|
|
68
|
-
droppable: true,
|
|
69
|
-
name: 'Amphibians',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: 5,
|
|
73
|
-
parent: 4,
|
|
74
|
-
droppable: true,
|
|
75
|
-
name: 'Frogs',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
id: 6,
|
|
79
|
-
parent: 0,
|
|
80
|
-
droppable: true,
|
|
81
|
-
name: 'Reptiles',
|
|
82
|
-
},
|
|
83
|
-
]);
|
|
84
|
-
const addItem = () => {
|
|
85
|
-
const newItem = {
|
|
86
|
-
id: Math.max(...items.map((item) => item.id)) + 1,
|
|
87
|
-
parent: 0,
|
|
88
|
-
droppable: true,
|
|
89
|
-
name: 'New Item',
|
|
90
|
-
};
|
|
91
|
-
setItems([newItem].concat(items));
|
|
92
|
-
};
|
|
93
|
-
const list = {
|
|
94
|
-
name: 'Animals',
|
|
95
|
-
actions: [
|
|
96
|
-
{
|
|
97
|
-
label: 'Add',
|
|
98
|
-
primary: true,
|
|
99
|
-
icon: <FaPlus />,
|
|
100
|
-
onClick: () => addItem(),
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
items,
|
|
104
|
-
};
|
|
105
|
-
return <Tree list={list} draggable onListReorder={setItems} />;
|
|
106
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Page as PageBase } from '../../../../index';
|
|
3
|
-
import { Footer } from '../../navigation/footer/footer';
|
|
4
|
-
import { Header } from '../../navigation/header/header';
|
|
5
|
-
|
|
6
|
-
export const Page = ({ children }) => {
|
|
7
|
-
return (
|
|
8
|
-
<>
|
|
9
|
-
<Header />
|
|
10
|
-
<PageBase padding="20px" left={0} top={60}>
|
|
11
|
-
{children}
|
|
12
|
-
<Footer />
|
|
13
|
-
</PageBase>
|
|
14
|
-
</>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const baseUrl = window.location.pathname || '/';
|
|
Binary file
|
package/src/docs/html/index.html
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<head>
|
|
3
|
-
<title>React UI Library</title>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" user-scalable="no">
|
|
6
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<div id="content"></div>
|
|
10
|
-
</body>
|
|
11
|
-
</html>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RiGitlabFill } from 'react-icons/ri';
|
|
3
|
-
import { ImMobile } from 'react-icons/im';
|
|
4
|
-
import {
|
|
5
|
-
Spacer,
|
|
6
|
-
TextLink,
|
|
7
|
-
Text,
|
|
8
|
-
Flex,
|
|
9
|
-
Heading,
|
|
10
|
-
Divider,
|
|
11
|
-
} from '../../../../index';
|
|
12
|
-
|
|
13
|
-
export const Footer = () => {
|
|
14
|
-
return (
|
|
15
|
-
<>
|
|
16
|
-
<Divider />
|
|
17
|
-
<Flex direction="column" alignItems="center">
|
|
18
|
-
<Heading top marginBottom={0}>
|
|
19
|
-
<Flex alignItems="center">
|
|
20
|
-
<ImMobile size={20} />
|
|
21
|
-
<Spacer width="5px" />
|
|
22
|
-
React UI Library
|
|
23
|
-
</Flex>
|
|
24
|
-
</Heading>
|
|
25
|
-
<Spacer height="10px" />
|
|
26
|
-
<Text muted>
|
|
27
|
-
© {new Date().getFullYear()} Oliasoft AS and contributors
|
|
28
|
-
</Text>
|
|
29
|
-
<Spacer height="10px" />
|
|
30
|
-
<Flex>
|
|
31
|
-
<TextLink href="https://gitlab.com/oliasoft-open-source/react-ui-library/-/blob/master/LICENSE">
|
|
32
|
-
Code licensed MIT
|
|
33
|
-
</TextLink>
|
|
34
|
-
<Spacer width="15px" />
|
|
35
|
-
<TextLink href="https://gitlab.com/oliasoft-open-source/react-ui-library">
|
|
36
|
-
<Flex alignItems="center">
|
|
37
|
-
<RiGitlabFill />
|
|
38
|
-
<Spacer width="5px" />
|
|
39
|
-
Gitlab
|
|
40
|
-
</Flex>
|
|
41
|
-
</TextLink>
|
|
42
|
-
<Spacer width="15px" />
|
|
43
|
-
<TextLink href="https://www.oliasoft.com/">Oliasoft</TextLink>
|
|
44
|
-
</Flex>
|
|
45
|
-
</Flex>
|
|
46
|
-
</>
|
|
47
|
-
);
|
|
48
|
-
};
|