venice-ui 2.1.17 → 2.1.19

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.
@@ -38,13 +38,14 @@ exports.ButtonElement = styled_components_1.default.button `
38
38
  `background-color: transparent;
39
39
  border: none;
40
40
  color: ${p.theme.action};
41
- ${p.errorVariant &&
42
- `color:${p.theme.errorBackgroundColor};
43
- border:none;`}
44
41
  &:disabled{
45
42
  color: ${p.theme.disabledText};
46
- border: 1px solid ${p.theme.disabledText};
47
43
  }
44
+ ${p.errorVariant &&
45
+ `color:${p.theme.errorBackgroundColor};
46
+ border:none;`}
47
+
48
+
48
49
  `}
49
50
 
50
51
  &:hover {
@@ -8,9 +8,9 @@ const react_1 = __importDefault(require("react"));
8
8
  const Card_styles_1 = require("./Card.styles");
9
9
  const ElementHeader_1 = require("../ElementHeader");
10
10
  const Theme_1 = require("../../Theme");
11
- const Card = ({ children, title, actionLabel, theme = Theme_1.mainTheme, iconColor = theme.textColor, iconHoverColor = theme.action, handleClick, handleBack, height, options, shadow = true, headerDivader = false }) => {
11
+ const Card = ({ children, title, actionLabel, theme = Theme_1.mainTheme, iconColor = theme.textColor, iconHoverColor = theme.action, handleClick, handleBack, height, options, shadow = true, headerDivader = false, actionDisabled = false, }) => {
12
12
  return (react_1.default.createElement(Card_styles_1.CardElement, { height: height, shadow: shadow },
13
- (title || actionLabel) && (react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, options: options, theme: theme, iconColor: iconColor, iconHoverColor: iconHoverColor, bottomDivader: headerDivader })),
13
+ (title || actionLabel) && (react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, options: options, theme: theme, iconColor: iconColor, iconHoverColor: iconHoverColor, bottomDivader: headerDivader, actionDisabled: actionDisabled })),
14
14
  react_1.default.createElement(Card_styles_1.CardContent, { soloMode: !title && !actionLabel }, children)));
15
15
  };
16
16
  exports.Card = Card;
@@ -32,7 +32,7 @@ const DropdownMenu_styles_1 = require("./DropdownMenu.styles");
32
32
  const Aligment_1 = require("../Aligment");
33
33
  const Typography_1 = require("../Typography");
34
34
  const react_dom_1 = require("react-dom");
35
- const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header = false, headerTitle, headerSubtitle, footer = false, footerText, footerAction, options, right = false, left = false, targetID, iconColor = Theme_1.mainTheme.iconColor, iconHoverColor = Theme_1.mainTheme.iconHoverColor, iconBgColor = Theme_1.mainTheme.iconBgColor, iconBgHoverColor = Theme_1.mainTheme.iconBgHoverColor, position = 'left', zIndex, textMode = false, label = '', isTextActive = false }) => {
35
+ const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header = false, headerTitle, headerSubtitle, footer = false, footerText, footerAction, options, right = false, left = false, targetID, iconColor = Theme_1.mainTheme.iconColor, iconHoverColor = Theme_1.mainTheme.iconHoverColor, iconBgColor = Theme_1.mainTheme.iconBgColor, iconBgHoverColor = Theme_1.mainTheme.iconBgHoverColor, position = 'left', zIndex, textMode = false, label = '', isTextActive = false, }) => {
36
36
  const [open, toogleOpen] = (0, react_1.useState)(false);
37
37
  const ref = (0, react_1.useRef)(null);
38
38
  const sourceRef = (0, react_1.useRef)(null);
@@ -62,19 +62,26 @@ const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header = false,
62
62
  footerAction && footerAction();
63
63
  close();
64
64
  };
65
- const handleClick = (action, disableID) => {
65
+ const handleClick = (action, disabled, disableID) => {
66
66
  if (targetID) {
67
67
  if (disableID !== targetID) {
68
- action(targetID);
68
+ if (!disabled) {
69
+ action(targetID);
70
+ }
69
71
  }
70
72
  }
71
73
  else {
72
- action();
74
+ if (!disabled) {
75
+ action();
76
+ }
73
77
  }
74
78
  close();
75
79
  };
76
- const isDisable = (disableID) => {
77
- if (targetID) {
80
+ const isDisable = (disableID, disabled) => {
81
+ if (disabled) {
82
+ return true;
83
+ }
84
+ else if (targetID) {
78
85
  return targetID === disableID;
79
86
  }
80
87
  return false;
@@ -118,7 +125,7 @@ const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header = false,
118
125
  headerTitle && (react_1.default.createElement(Typography_1.TextAccent, { color: Theme_1.Theme.colors.text }, headerTitle)),
119
126
  headerSubtitle && (react_1.default.createElement(Typography_1.TextLabel, { color: Theme_1.Theme.colors.text }, headerSubtitle)))),
120
127
  react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuContent, null, options &&
121
- options.map((option) => (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuOption, { key: option.label, isDisable: isDisable(option.disableID), onClick: () => handleClick(option.action, option.disableID), isActive: option.isActive }, option.label)))),
128
+ options.map((option) => (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuOption, { key: option.label, isDisable: isDisable(option.disableID, option.diasbled), onClick: () => handleClick(option.action, option.diasbled ? option.diasbled : false, option.disableID), isActive: option.isActive }, option.label)))),
122
129
  footer && (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuFooter, null, footerText && (react_1.default.createElement(Typography_1.Text, { action: true, onClick: handleFooterAction }, footerText)))))), document.body)));
123
130
  };
124
131
  exports.DropdownMenu = DropdownMenu;
@@ -50,5 +50,5 @@ exports.DropdownMenuOption = styled_components_1.default.div `
50
50
  exports.DropdownMenuLabel = styled_components_1.default.div `
51
51
  display: flex;
52
52
  ${(p) => (0, common_1.setSize)(p.size)};
53
- color:${(p) => p.isActive ? Theme_1.Theme.colors.primary : p.theme.optionColor};
53
+ color: ${(p) => (p.isActive ? Theme_1.Theme.colors.primary : p.theme.optionColor)};
54
54
  `;
@@ -12,7 +12,7 @@ const Theme_1 = require("../../Theme");
12
12
  const Button_1 = require("../Button");
13
13
  const DropdownMenu_1 = require("../DropdownMenu");
14
14
  const ElementHeader_styles_1 = require("./ElementHeader.styles");
15
- const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, handleBack, children, theme = Theme_1.mainTheme, backgroundColor = theme.contentBackground, iconColor = theme.textColor, iconHoverColor = theme.action, options, bottomDivader = false, }) => {
15
+ const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, handleBack, children, theme = Theme_1.mainTheme, backgroundColor = theme.contentBackground, iconColor = theme.textColor, iconHoverColor = theme.action, options, bottomDivader = false, actionDisabled = false, }) => {
16
16
  const leftSide = () => {
17
17
  if (title) {
18
18
  return (react_1.default.createElement(ElementHeader_styles_1.TitleWrapper, null,
@@ -30,7 +30,7 @@ const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, hand
30
30
  }
31
31
  else if (!handleClose && handleClick && actionLabel) {
32
32
  return (react_1.default.createElement(Aligment_1.Aligment, { align: "center", width: "auto" },
33
- react_1.default.createElement(Button_1.Button, { mode: "secondary", text: actionLabel, onClick: () => handleClick() }),
33
+ react_1.default.createElement(Button_1.Button, { mode: "secondary", text: actionLabel, onClick: () => handleClick(), disabled: actionDisabled }),
34
34
  options && (react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options: options, right: true, iconColor: iconColor, position: 'right' }))));
35
35
  }
36
36
  };
@@ -32,13 +32,14 @@ export const ButtonElement = styled.button `
32
32
  `background-color: transparent;
33
33
  border: none;
34
34
  color: ${p.theme.action};
35
- ${p.errorVariant &&
36
- `color:${p.theme.errorBackgroundColor};
37
- border:none;`}
38
35
  &:disabled{
39
36
  color: ${p.theme.disabledText};
40
- border: 1px solid ${p.theme.disabledText};
41
37
  }
38
+ ${p.errorVariant &&
39
+ `color:${p.theme.errorBackgroundColor};
40
+ border:none;`}
41
+
42
+
42
43
  `}
43
44
 
44
45
  &:hover {
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { CardContent, CardElement } from './Card.styles';
3
3
  import { ElementHeader } from '../ElementHeader';
4
4
  import { mainTheme } from '../../Theme';
5
- export const Card = ({ children, title, actionLabel, theme = mainTheme, iconColor = theme.textColor, iconHoverColor = theme.action, handleClick, handleBack, height, options, shadow = true, headerDivader = false }) => {
5
+ export const Card = ({ children, title, actionLabel, theme = mainTheme, iconColor = theme.textColor, iconHoverColor = theme.action, handleClick, handleBack, height, options, shadow = true, headerDivader = false, actionDisabled = false, }) => {
6
6
  return (React.createElement(CardElement, { height: height, shadow: shadow },
7
- (title || actionLabel) && (React.createElement(ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, options: options, theme: theme, iconColor: iconColor, iconHoverColor: iconHoverColor, bottomDivader: headerDivader })),
7
+ (title || actionLabel) && (React.createElement(ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, options: options, theme: theme, iconColor: iconColor, iconHoverColor: iconHoverColor, bottomDivader: headerDivader, actionDisabled: actionDisabled })),
8
8
  React.createElement(CardContent, { soloMode: !title && !actionLabel }, children)));
9
9
  };
@@ -6,7 +6,7 @@ import { DropdownMenuOption, DropdownMenuElement, DropdownMenuContent, DropdownM
6
6
  import { Aligment } from '../Aligment';
7
7
  import { TextAccent, TextLabel, Text } from '../Typography';
8
8
  import { createPortal } from 'react-dom';
9
- export const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header = false, headerTitle, headerSubtitle, footer = false, footerText, footerAction, options, right = false, left = false, targetID, iconColor = mainTheme.iconColor, iconHoverColor = mainTheme.iconHoverColor, iconBgColor = mainTheme.iconBgColor, iconBgHoverColor = mainTheme.iconBgHoverColor, position = 'left', zIndex, textMode = false, label = '', isTextActive = false }) => {
9
+ export const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header = false, headerTitle, headerSubtitle, footer = false, footerText, footerAction, options, right = false, left = false, targetID, iconColor = mainTheme.iconColor, iconHoverColor = mainTheme.iconHoverColor, iconBgColor = mainTheme.iconBgColor, iconBgHoverColor = mainTheme.iconBgHoverColor, position = 'left', zIndex, textMode = false, label = '', isTextActive = false, }) => {
10
10
  const [open, toogleOpen] = useState(false);
11
11
  const ref = useRef(null);
12
12
  const sourceRef = useRef(null);
@@ -36,19 +36,26 @@ export const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header =
36
36
  footerAction && footerAction();
37
37
  close();
38
38
  };
39
- const handleClick = (action, disableID) => {
39
+ const handleClick = (action, disabled, disableID) => {
40
40
  if (targetID) {
41
41
  if (disableID !== targetID) {
42
- action(targetID);
42
+ if (!disabled) {
43
+ action(targetID);
44
+ }
43
45
  }
44
46
  }
45
47
  else {
46
- action();
48
+ if (!disabled) {
49
+ action();
50
+ }
47
51
  }
48
52
  close();
49
53
  };
50
- const isDisable = (disableID) => {
51
- if (targetID) {
54
+ const isDisable = (disableID, disabled) => {
55
+ if (disabled) {
56
+ return true;
57
+ }
58
+ else if (targetID) {
52
59
  return targetID === disableID;
53
60
  }
54
61
  return false;
@@ -92,6 +99,6 @@ export const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header =
92
99
  headerTitle && (React.createElement(TextAccent, { color: Theme.colors.text }, headerTitle)),
93
100
  headerSubtitle && (React.createElement(TextLabel, { color: Theme.colors.text }, headerSubtitle)))),
94
101
  React.createElement(DropdownMenuContent, null, options &&
95
- options.map((option) => (React.createElement(DropdownMenuOption, { key: option.label, isDisable: isDisable(option.disableID), onClick: () => handleClick(option.action, option.disableID), isActive: option.isActive }, option.label)))),
102
+ options.map((option) => (React.createElement(DropdownMenuOption, { key: option.label, isDisable: isDisable(option.disableID, option.diasbled), onClick: () => handleClick(option.action, option.diasbled ? option.diasbled : false, option.disableID), isActive: option.isActive }, option.label)))),
96
103
  footer && (React.createElement(DropdownMenuFooter, null, footerText && (React.createElement(Text, { action: true, onClick: handleFooterAction }, footerText)))))), document.body)));
97
104
  };
@@ -44,5 +44,5 @@ export const DropdownMenuOption = styled.div `
44
44
  export const DropdownMenuLabel = styled.div `
45
45
  display: flex;
46
46
  ${(p) => setSize(p.size)};
47
- color:${(p) => p.isActive ? Theme.colors.primary : p.theme.optionColor};
47
+ color: ${(p) => (p.isActive ? Theme.colors.primary : p.theme.optionColor)};
48
48
  `;
@@ -6,7 +6,7 @@ import { Theme, mainTheme } from '../../Theme';
6
6
  import { Button } from '../Button';
7
7
  import { DropdownMenu } from '../DropdownMenu';
8
8
  import { ElementHeaderWrapper, TitleWrapper } from './ElementHeader.styles';
9
- export const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, handleBack, children, theme = mainTheme, backgroundColor = theme.contentBackground, iconColor = theme.textColor, iconHoverColor = theme.action, options, bottomDivader = false, }) => {
9
+ export const ElementHeader = ({ title, actionLabel = '', handleClose, handleClick, handleBack, children, theme = mainTheme, backgroundColor = theme.contentBackground, iconColor = theme.textColor, iconHoverColor = theme.action, options, bottomDivader = false, actionDisabled = false, }) => {
10
10
  const leftSide = () => {
11
11
  if (title) {
12
12
  return (React.createElement(TitleWrapper, null,
@@ -24,7 +24,7 @@ export const ElementHeader = ({ title, actionLabel = '', handleClose, handleClic
24
24
  }
25
25
  else if (!handleClose && handleClick && actionLabel) {
26
26
  return (React.createElement(Aligment, { align: "center", width: "auto" },
27
- React.createElement(Button, { mode: "secondary", text: actionLabel, onClick: () => handleClick() }),
27
+ React.createElement(Button, { mode: "secondary", text: actionLabel, onClick: () => handleClick(), disabled: actionDisabled }),
28
28
  options && (React.createElement(DropdownMenu, { options: options, right: true, iconColor: iconColor, position: 'right' }))));
29
29
  }
30
30
  };
@@ -13,6 +13,7 @@ interface ICardProps {
13
13
  iconHoverColor?: string;
14
14
  shadow?: boolean;
15
15
  headerDivader?: boolean;
16
+ actionDisabled?: boolean;
16
17
  }
17
18
  export declare const Card: FC<ICardProps>;
18
19
  export {};
@@ -13,6 +13,7 @@ interface IElementHeader {
13
13
  options?: IAction[];
14
14
  theme?: any;
15
15
  bottomDivader?: boolean;
16
+ actionDisabled?: boolean;
16
17
  }
17
18
  export declare const ElementHeader: FC<IElementHeader>;
18
19
  export {};
@@ -7,6 +7,7 @@ export interface IAction {
7
7
  label: string | number;
8
8
  disableID?: string;
9
9
  isActive?: boolean;
10
+ diasbled?: boolean;
10
11
  }
11
12
  export interface IIconsActions {
12
13
  iconName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "venice-ui",
3
- "version": "2.1.17",
3
+ "version": "2.1.19",
4
4
  "description": "Component library",
5
5
  "main": "index.js",
6
6
  "module": "./dist/esm/index.js",