venice-ui 2.2.6 → 2.2.9
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/dist/cjs/components/Dropdown/Dropdown.js +6 -4
- package/dist/cjs/components/List/List.js +5 -7
- package/dist/cjs/components/List/list.styles.js +15 -7
- package/dist/cjs/components/common/commonComponents.js +9 -5
- package/dist/esm/components/Dropdown/Dropdown.js +6 -4
- package/dist/esm/components/List/List.js +6 -8
- package/dist/esm/components/List/list.styles.js +14 -6
- package/dist/esm/components/common/commonComponents.js +9 -5
- package/dist/types/components/List/list.styles.d.ts +3 -1
- package/dist/types/components/common/commonComponents.d.ts +1 -0
- package/dist/types/types/commonTypes.d.ts +1 -0
- package/package.json +1 -1
|
@@ -62,10 +62,12 @@ const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = fa
|
|
|
62
62
|
toogleOpen(!open);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
const selectOption = (e, selectedValue) => {
|
|
65
|
+
const selectOption = (e, selectedValue, isDisabled) => {
|
|
66
66
|
e.stopPropagation();
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
if (!isDisabled) {
|
|
68
|
+
handleSelect(name, selectedValue);
|
|
69
|
+
toogleOpen(false);
|
|
70
|
+
}
|
|
69
71
|
};
|
|
70
72
|
(0, react_1.useEffect)(() => {
|
|
71
73
|
const handleClickOutside = (event) => {
|
|
@@ -95,7 +97,7 @@ const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = fa
|
|
|
95
97
|
react_1.default.createElement(Icons_1.Icon, { name: open ? 'arrow_drop_up' : 'arrow_drop_down', size: 24, iconColor: theme.inputDefaultTextColor, iconHoverColor: theme.inputDefaultTextColor, iconBgHoverColor: "transparent" })),
|
|
96
98
|
open &&
|
|
97
99
|
(0, react_dom_1.createPortal)(react_1.default.createElement(common_1.Panel, { style: dropdownStyles, ref: ref, size: size, fullWidth: true, zIndex: zIndex }, options &&
|
|
98
|
-
options.map((option) => (react_1.default.createElement(common_1.PanelOption, { key: option.value, active: option.value === value, onClick: (e) => selectOption(e, option.value) }, option.label)))), document.body),
|
|
100
|
+
options.map((option) => (react_1.default.createElement(common_1.PanelOption, { key: option.value, active: option.value === value, onClick: (e) => selectOption(e, option.value, option.disabled), isDisabled: option.disabled || false }, option.label)))), document.body),
|
|
99
101
|
error && errorMsg && react_1.default.createElement(Input_1.InputErrorMsg, null, errorMsg)))));
|
|
100
102
|
};
|
|
101
103
|
exports.Dropdown = Dropdown;
|
|
@@ -99,21 +99,19 @@ const List = ({ isCheckbox = false, isCollapsable = false, isSelectable = false,
|
|
|
99
99
|
};
|
|
100
100
|
const gerenrateRow = (row, level) => {
|
|
101
101
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
102
|
-
react_1.default.createElement(list_styles_1.ListRow, { key: row.id, level: level, selected: selected ? selected === row.id : false, action: isCheckbox || isSelectable },
|
|
102
|
+
react_1.default.createElement(list_styles_1.ListRow, { key: row.id, level: level, selected: isSelectable && selected ? selected === row.id : false, action: isCheckbox || isSelectable, isExtend: row.extend || false, onClick: (e) => handleRowClick(row, e) },
|
|
103
103
|
isCollapsable && (react_1.default.createElement(list_styles_1.ListIconWrapper, { extend: row.extend || false, onClick: (e) => {
|
|
104
104
|
e.stopPropagation();
|
|
105
105
|
} }, row.children.length !== 0 && (react_1.default.createElement(Icons_1.Icon, { name: "arrow_drop_down", size: 20, noPadding: true, onClick: () => showRow(row.id), iconBgHoverColor: "transparent" })))),
|
|
106
106
|
isCheckbox && (react_1.default.createElement("div", { onClick: (e) => e.stopPropagation() },
|
|
107
107
|
react_1.default.createElement(Checkbox_1.Checkbox, { handleClick: () => handleClick(row), value: getValue(row), isIntermedian: getIntermedian(row), size: "small" }))),
|
|
108
|
-
react_1.default.createElement(list_styles_1.ListText, {
|
|
108
|
+
react_1.default.createElement(list_styles_1.ListText, { selected: isSelectable && selected ? selected === row.id : false }, row.value),
|
|
109
109
|
haveMoreOptions && (react_1.default.createElement(list_styles_1.MoreWrapper, null,
|
|
110
110
|
react_1.default.createElement(Table_styles_1.OptionTableCellWrapper, { onClick: (e) => e.stopPropagation() },
|
|
111
111
|
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options: moreActions, targetID: row.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))))),
|
|
112
|
-
row.extend &&
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return gerenrateRow(_chiledRow, level + 1);
|
|
116
|
-
})));
|
|
112
|
+
row.extend && row.children.length > 0 && (react_1.default.createElement(list_styles_1.ListRowExtend, null, row.children.map((_chiledRow) => {
|
|
113
|
+
return gerenrateRow(_chiledRow, level + 1);
|
|
114
|
+
})))));
|
|
117
115
|
};
|
|
118
116
|
let level = 0;
|
|
119
117
|
return (react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme },
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MoreWrapper = exports.ListIconWrapper = exports.ListText = exports.ListRow = void 0;
|
|
6
|
+
exports.ListRowExtend = exports.MoreWrapper = exports.ListIconWrapper = exports.ListText = exports.ListRow = void 0;
|
|
7
7
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
8
|
exports.ListRow = styled_components_1.default.div `
|
|
9
9
|
position: relative;
|
|
@@ -16,18 +16,21 @@ exports.ListRow = styled_components_1.default.div `
|
|
|
16
16
|
gap: 8px;
|
|
17
17
|
align-content: center;
|
|
18
18
|
align-items: center;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: p.theme.
|
|
19
|
+
${(p) => p.selected &&
|
|
20
|
+
`
|
|
21
|
+
background-color: ${p.theme.tableCellActiveBackground};
|
|
22
|
+
`}
|
|
23
|
+
|
|
22
24
|
:hover {
|
|
23
25
|
background-color: ${(p) => p.theme.tableCellActiveBackground};
|
|
26
|
+
cursor: ${(p) => (p.action ? 'pointer' : 'default')};
|
|
24
27
|
}
|
|
25
28
|
`;
|
|
26
29
|
exports.ListText = styled_components_1.default.div `
|
|
27
30
|
font-size: 16px;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
${p => p.selected && `
|
|
32
|
+
color:${p.theme.action}
|
|
33
|
+
`}
|
|
31
34
|
`;
|
|
32
35
|
exports.ListIconWrapper = styled_components_1.default.div `
|
|
33
36
|
width: 24px;
|
|
@@ -43,3 +46,8 @@ exports.MoreWrapper = styled_components_1.default.div `
|
|
|
43
46
|
position: absolute;
|
|
44
47
|
right: 0px;
|
|
45
48
|
`;
|
|
49
|
+
exports.ListRowExtend = styled_components_1.default.div `
|
|
50
|
+
width: 100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
`;
|
|
@@ -26,7 +26,7 @@ exports.Panel = styled_components_1.default.div `
|
|
|
26
26
|
height: ${(p) => (p.height ? p.height : 'auto')};
|
|
27
27
|
width: ${(p) => (p.fullWidth ? '100%' : 'auto')};
|
|
28
28
|
position: absolute;
|
|
29
|
-
z-index: ${p => p.zIndex ? p.zIndex : Theme_1.Theme.zIndex.dropdown};
|
|
29
|
+
z-index: ${(p) => (p.zIndex ? p.zIndex : Theme_1.Theme.zIndex.dropdown)};
|
|
30
30
|
top: ${(p) => (0, inputStyles_1.setPanelTop)(p.size)};
|
|
31
31
|
border: 1px solid ${Theme_1.Theme.colors.gray_2};
|
|
32
32
|
border-top: none;
|
|
@@ -34,12 +34,16 @@ exports.Panel = styled_components_1.default.div `
|
|
|
34
34
|
`;
|
|
35
35
|
exports.PanelOption = styled_components_1.default.div `
|
|
36
36
|
padding: ${Theme_1.Theme.padding.s} ${Theme_1.Theme.padding.m};
|
|
37
|
-
cursor: pointer;
|
|
37
|
+
cursor: ${(p) => (p.isDisabled ? 'not-allowed' : 'pointer')};
|
|
38
38
|
white-space: nowrap;
|
|
39
|
-
font-size:16px;
|
|
40
|
-
color: ${(p) =>
|
|
39
|
+
font-size: 16px;
|
|
40
|
+
color: ${(p) => p.active
|
|
41
|
+
? Theme_1.Theme.colors.primary
|
|
42
|
+
: p.isDisabled
|
|
43
|
+
? Theme_1.Theme.colors.gray_1
|
|
44
|
+
: Theme_1.Theme.colors.text};
|
|
41
45
|
:hover {
|
|
42
|
-
background-color: ${(0, polished_1.lighten)(0.4, Theme_1.Theme.colors.primary)};
|
|
46
|
+
background-color: ${(p) => p.isDisabled ? Theme_1.Theme.colors.gray_4 : (0, polished_1.lighten)(0.4, Theme_1.Theme.colors.primary)};
|
|
43
47
|
}
|
|
44
48
|
${(p) => p.width && `width:${p.width};`}
|
|
45
49
|
`;
|
|
@@ -36,10 +36,12 @@ export const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabl
|
|
|
36
36
|
toogleOpen(!open);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
const selectOption = (e, selectedValue) => {
|
|
39
|
+
const selectOption = (e, selectedValue, isDisabled) => {
|
|
40
40
|
e.stopPropagation();
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
if (!isDisabled) {
|
|
42
|
+
handleSelect(name, selectedValue);
|
|
43
|
+
toogleOpen(false);
|
|
44
|
+
}
|
|
43
45
|
};
|
|
44
46
|
useEffect(() => {
|
|
45
47
|
const handleClickOutside = (event) => {
|
|
@@ -69,6 +71,6 @@ export const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabl
|
|
|
69
71
|
React.createElement(Icon, { name: open ? 'arrow_drop_up' : 'arrow_drop_down', size: 24, iconColor: theme.inputDefaultTextColor, iconHoverColor: theme.inputDefaultTextColor, iconBgHoverColor: "transparent" })),
|
|
70
72
|
open &&
|
|
71
73
|
createPortal(React.createElement(Panel, { style: dropdownStyles, ref: ref, size: size, fullWidth: true, zIndex: zIndex }, options &&
|
|
72
|
-
options.map((option) => (React.createElement(PanelOption, { key: option.value, active: option.value === value, onClick: (e) => selectOption(e, option.value) }, option.label)))), document.body),
|
|
74
|
+
options.map((option) => (React.createElement(PanelOption, { key: option.value, active: option.value === value, onClick: (e) => selectOption(e, option.value, option.disabled), isDisabled: option.disabled || false }, option.label)))), document.body),
|
|
73
75
|
error && errorMsg && React.createElement(InputErrorMsg, null, errorMsg)))));
|
|
74
76
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Aligment } from '../Aligment';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ListIconWrapper, ListRow, ListText, MoreWrapper } from './list.styles';
|
|
3
|
+
import { ListIconWrapper, ListRow, ListRowExtend, ListText, MoreWrapper, } from './list.styles';
|
|
4
4
|
import { Checkbox } from '../Checkbox';
|
|
5
5
|
import { ThemeProvider } from 'styled-components';
|
|
6
6
|
import { Icon } from '../Icons';
|
|
@@ -93,21 +93,19 @@ export const List = ({ isCheckbox = false, isCollapsable = false, isSelectable =
|
|
|
93
93
|
};
|
|
94
94
|
const gerenrateRow = (row, level) => {
|
|
95
95
|
return (React.createElement(React.Fragment, null,
|
|
96
|
-
React.createElement(ListRow, { key: row.id, level: level, selected: selected ? selected === row.id : false, action: isCheckbox || isSelectable },
|
|
96
|
+
React.createElement(ListRow, { key: row.id, level: level, selected: isSelectable && selected ? selected === row.id : false, action: isCheckbox || isSelectable, isExtend: row.extend || false, onClick: (e) => handleRowClick(row, e) },
|
|
97
97
|
isCollapsable && (React.createElement(ListIconWrapper, { extend: row.extend || false, onClick: (e) => {
|
|
98
98
|
e.stopPropagation();
|
|
99
99
|
} }, row.children.length !== 0 && (React.createElement(Icon, { name: "arrow_drop_down", size: 20, noPadding: true, onClick: () => showRow(row.id), iconBgHoverColor: "transparent" })))),
|
|
100
100
|
isCheckbox && (React.createElement("div", { onClick: (e) => e.stopPropagation() },
|
|
101
101
|
React.createElement(Checkbox, { handleClick: () => handleClick(row), value: getValue(row), isIntermedian: getIntermedian(row), size: "small" }))),
|
|
102
|
-
React.createElement(ListText, {
|
|
102
|
+
React.createElement(ListText, { selected: isSelectable && selected ? selected === row.id : false }, row.value),
|
|
103
103
|
haveMoreOptions && (React.createElement(MoreWrapper, null,
|
|
104
104
|
React.createElement(OptionTableCellWrapper, { onClick: (e) => e.stopPropagation() },
|
|
105
105
|
React.createElement(DropdownMenu, { options: moreActions, targetID: row.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))))),
|
|
106
|
-
row.extend &&
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return gerenrateRow(_chiledRow, level + 1);
|
|
110
|
-
})));
|
|
106
|
+
row.extend && row.children.length > 0 && (React.createElement(ListRowExtend, null, row.children.map((_chiledRow) => {
|
|
107
|
+
return gerenrateRow(_chiledRow, level + 1);
|
|
108
|
+
})))));
|
|
111
109
|
};
|
|
112
110
|
let level = 0;
|
|
113
111
|
return (React.createElement(ThemeProvider, { theme: theme },
|
|
@@ -10,18 +10,21 @@ export const ListRow = styled.div `
|
|
|
10
10
|
gap: 8px;
|
|
11
11
|
align-content: center;
|
|
12
12
|
align-items: center;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
: p.theme.
|
|
13
|
+
${(p) => p.selected &&
|
|
14
|
+
`
|
|
15
|
+
background-color: ${p.theme.tableCellActiveBackground};
|
|
16
|
+
`}
|
|
17
|
+
|
|
16
18
|
:hover {
|
|
17
19
|
background-color: ${(p) => p.theme.tableCellActiveBackground};
|
|
20
|
+
cursor: ${(p) => (p.action ? 'pointer' : 'default')};
|
|
18
21
|
}
|
|
19
22
|
`;
|
|
20
23
|
export const ListText = styled.div `
|
|
21
24
|
font-size: 16px;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
${p => p.selected && `
|
|
26
|
+
color:${p.theme.action}
|
|
27
|
+
`}
|
|
25
28
|
`;
|
|
26
29
|
export const ListIconWrapper = styled.div `
|
|
27
30
|
width: 24px;
|
|
@@ -37,3 +40,8 @@ export const MoreWrapper = styled.div `
|
|
|
37
40
|
position: absolute;
|
|
38
41
|
right: 0px;
|
|
39
42
|
`;
|
|
43
|
+
export const ListRowExtend = styled.div `
|
|
44
|
+
width: 100%;
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
`;
|
|
@@ -20,7 +20,7 @@ export const Panel = styled.div `
|
|
|
20
20
|
height: ${(p) => (p.height ? p.height : 'auto')};
|
|
21
21
|
width: ${(p) => (p.fullWidth ? '100%' : 'auto')};
|
|
22
22
|
position: absolute;
|
|
23
|
-
z-index: ${p => p.zIndex ? p.zIndex : Theme.zIndex.dropdown};
|
|
23
|
+
z-index: ${(p) => (p.zIndex ? p.zIndex : Theme.zIndex.dropdown)};
|
|
24
24
|
top: ${(p) => setPanelTop(p.size)};
|
|
25
25
|
border: 1px solid ${Theme.colors.gray_2};
|
|
26
26
|
border-top: none;
|
|
@@ -28,12 +28,16 @@ export const Panel = styled.div `
|
|
|
28
28
|
`;
|
|
29
29
|
export const PanelOption = styled.div `
|
|
30
30
|
padding: ${Theme.padding.s} ${Theme.padding.m};
|
|
31
|
-
cursor: pointer;
|
|
31
|
+
cursor: ${(p) => (p.isDisabled ? 'not-allowed' : 'pointer')};
|
|
32
32
|
white-space: nowrap;
|
|
33
|
-
font-size:16px;
|
|
34
|
-
color: ${(p) =>
|
|
33
|
+
font-size: 16px;
|
|
34
|
+
color: ${(p) => p.active
|
|
35
|
+
? Theme.colors.primary
|
|
36
|
+
: p.isDisabled
|
|
37
|
+
? Theme.colors.gray_1
|
|
38
|
+
: Theme.colors.text};
|
|
35
39
|
:hover {
|
|
36
|
-
background-color: ${lighten(0.4, Theme.colors.primary)};
|
|
40
|
+
background-color: ${(p) => p.isDisabled ? Theme.colors.gray_4 : lighten(0.4, Theme.colors.primary)};
|
|
37
41
|
}
|
|
38
42
|
${(p) => p.width && `width:${p.width};`}
|
|
39
43
|
`;
|
|
@@ -2,11 +2,12 @@ interface IListRow {
|
|
|
2
2
|
level: number;
|
|
3
3
|
selected: boolean;
|
|
4
4
|
action: boolean;
|
|
5
|
+
isExtend: boolean;
|
|
5
6
|
theme: any;
|
|
6
7
|
}
|
|
7
8
|
export declare const ListRow: import("styled-components").StyledComponent<"div", any, IListRow, never>;
|
|
8
9
|
interface IListRowPRops {
|
|
9
|
-
|
|
10
|
+
selected: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const ListText: import("styled-components").StyledComponent<"div", any, IListRowPRops, never>;
|
|
12
13
|
interface IListIconWrapperProps {
|
|
@@ -14,4 +15,5 @@ interface IListIconWrapperProps {
|
|
|
14
15
|
}
|
|
15
16
|
export declare const ListIconWrapper: import("styled-components").StyledComponent<"div", any, IListIconWrapperProps, never>;
|
|
16
17
|
export declare const MoreWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const ListRowExtend: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
19
|
export {};
|