linear-react-components-ui 1.1.2-beta.7 → 1.1.2-beta.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.
Files changed (53) hide show
  1. package/lib/assets/styles/checkbox.scss +0 -8
  2. package/lib/assets/styles/dialog.scss +10 -27
  3. package/lib/assets/styles/icon.scss +31 -4
  4. package/lib/assets/styles/multiSelect.scss +1 -6
  5. package/lib/assets/styles/select.scss +7 -13
  6. package/lib/assets/styles/tabs.scss +0 -3
  7. package/lib/assets/styles/textContent.scss +9 -0
  8. package/lib/checkbox/index.d.ts +2 -2
  9. package/lib/checkbox/index.js +11 -12
  10. package/lib/checkbox/types.d.ts +1 -2
  11. package/lib/dialog/Custom.js +4 -2
  12. package/lib/dialog/base/Content.js +0 -1
  13. package/lib/dialog/base/Header.js +4 -4
  14. package/lib/dialog/base/index.js +4 -6
  15. package/lib/dialog/form/index.js +3 -3
  16. package/lib/drawer/Drawer.js +4 -5
  17. package/lib/drawer/Header.js +1 -1
  18. package/lib/dropdown/Popup.d.ts +1 -1
  19. package/lib/dropdown/Popup.js +2 -5
  20. package/lib/dropdown/types.d.ts +0 -1
  21. package/lib/icons/helper.js +1 -1
  22. package/lib/icons/index.d.ts +3 -2
  23. package/lib/icons/index.js +10 -3
  24. package/lib/icons/types.d.ts +22 -9
  25. package/lib/index.d.ts +1 -0
  26. package/lib/inputs/base/InputTextBase.js +1 -3
  27. package/lib/inputs/base/types.d.ts +0 -1
  28. package/lib/inputs/multiSelect/ActionButtons.js +8 -10
  29. package/lib/inputs/multiSelect/Dropdown.js +6 -2
  30. package/lib/inputs/multiSelect/index.js +2 -2
  31. package/lib/inputs/select/ActionButtons.js +25 -16
  32. package/lib/inputs/select/Dropdown.js +6 -2
  33. package/lib/inputs/select/multiple/Selecteds.d.ts +1 -1
  34. package/lib/inputs/select/multiple/Selecteds.js +5 -3
  35. package/lib/inputs/select/multiple/index.js +21 -29
  36. package/lib/inputs/select/simple/index.js +32 -51
  37. package/lib/inputs/select/types.d.ts +1 -1
  38. package/lib/inputs/types.d.ts +2 -2
  39. package/lib/menus/float/types.d.ts +1 -1
  40. package/lib/menus/sidenav/index.js +3 -3
  41. package/lib/menus/sidenav/popup_menu_help/index.js +78 -0
  42. package/lib/menus/sidenav/popup_menu_search/index.js +2 -3
  43. package/lib/menus/sidenav/types.d.ts +1 -1
  44. package/lib/table/HeaderColumn.d.ts +1 -1
  45. package/lib/table/HeaderColumn.js +1 -5
  46. package/lib/table/types.d.ts +0 -2
  47. package/lib/tabs/context.js +1 -1
  48. package/lib/tabs/types.d.ts +3 -3
  49. package/lib/textContent/index.d.ts +8 -0
  50. package/lib/textContent/index.js +30 -0
  51. package/lib/tooltip/index.js +2 -2
  52. package/lib/treeview/Node.js +2 -2
  53. package/package.json +2 -2
@@ -80,14 +80,6 @@
80
80
  padding-left: 22px;
81
81
  }
82
82
 
83
- > .errormessages {
84
- width: 100%;
85
- color: red;
86
- font-size: 13px!important;
87
- line-height: 13px;
88
- margin-top: 0px;
89
- }
90
-
91
83
  &.-skeletonized {
92
84
  > .inputcontent {
93
85
  .input {
@@ -1,9 +1,6 @@
1
1
  @import "commons.scss";
2
2
  @import "colors.scss";
3
3
  @import "effects.scss";
4
-
5
- $shadow-button-default: 1px 1px 1px rgba(0, 0, 0, 0.2);
6
- $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-button-default;
7
4
  .modalcontainer {
8
5
  font-family: 'Roboto', sans-serif;
9
6
  line-height: 22px;
@@ -62,37 +59,23 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
62
59
  width: 100%;
63
60
  margin-left: 2px;
64
61
  display: flex;
65
- justify-content: space-between;
66
62
  align-items: center;
67
- .modal-title {
68
- color: $font-color-default;
69
- font-weight: 400;
63
+ &.modal-title {
64
+ color: #4e4c4c;
65
+ font-weight: 600;
70
66
  }
71
67
  }
72
68
  .close-button {
73
- all: unset;
69
+ margin-left: auto;
74
70
  line-height: 0;
75
- display: flex;
76
- align-items: center;
77
- justify-content: center;
78
- width: 28px;
79
- height: 28px;
80
- border: none;
81
- background-color: $default-color;
82
- color: $font-color-soft;
83
- border-radius: 999999px;
84
- cursor: pointer !important;
85
- >svg {
86
- fill: $font-color-soft;
71
+ cursor: pointer;
72
+ > svg {
73
+ fill: #252424;
87
74
  pointer-events: fill;
88
75
  transition: 0.2s fill;
89
- }
90
- &:hover {
91
- background-color: $default-hover-color;
92
- }
93
- &:focus {
94
- -webkit-box-shadow: $shadow-button-inset-default;
95
- box-shadow: $shadow-button-inset-default;
76
+ &:hover {
77
+ fill: rgba(0, 0, 0, 0.164);
78
+ }
96
79
  }
97
80
  }
98
81
  }
@@ -1,15 +1,42 @@
1
+ @import "colors.scss";
2
+
1
3
  /*
2
4
  * Caso altere o nome da classe, deverá pesquisar em todo projeto se existe
3
5
  * algum lugar que esta sobescrevendo
4
6
  */
5
- .icon-component {
6
- margin: 0px 2px;
7
- }
8
-
9
7
  .icon-component-container {
10
8
  display: inline-flex;
11
9
  place-self: center;
12
10
  padding: 2px;
13
11
  border-radius: 99999px;
14
12
  pointer-events: fill;
13
+
14
+ }
15
+
16
+ .icon-component {
17
+ margin: 0px 2px;
18
+ &:not([fill]) {
19
+ fill: #676464;
20
+ }
21
+
22
+ &[data-color-style="primary"] {
23
+ fill: $primary-color
24
+ }
25
+
26
+ &[data-color-style="success"] {
27
+ fill: $success-color
28
+ }
29
+
30
+ &[data-color-style="info"] {
31
+ fill: $info-color
32
+ }
33
+
34
+ &[data-color-style="warning"] {
35
+ fill: $warning-color
36
+ }
37
+
38
+ &[data-color-style="danger"] {
39
+ fill: $danger-color
40
+ }
15
41
  }
42
+
@@ -23,10 +23,6 @@
23
23
  top: 50%;
24
24
  left: 10px;
25
25
  transform: translateY(-50%);
26
-
27
- button {
28
- all: unset;
29
- }
30
26
  }
31
27
  }
32
28
 
@@ -99,7 +95,6 @@
99
95
  }
100
96
 
101
97
  .menubutton {
102
- all: unset;
103
98
  background-color: transparent;
104
99
  border: 0;
105
100
  padding: 0;
@@ -122,4 +117,4 @@
122
117
  }
123
118
  }
124
119
  }
125
- }
120
+ }
@@ -10,15 +10,14 @@
10
10
  height: auto;
11
11
  }
12
12
 
13
- .selectwrapper .actionbuttonsselect {
13
+ .selectwrapper .actionbutton {
14
+ cursor: pointer;
14
15
  display: flex;
15
- flex-direction: row;
16
+ align-items: center;
17
+ height: 100%;
16
18
 
17
- .actionbutton {
18
- all: unset;
19
- cursor: pointer;
20
- display: flex;
21
- align-items: center;
19
+ >.iconclear {
20
+ margin: 8px -3px 2px 3px;
22
21
  }
23
22
  }
24
23
 
@@ -43,10 +42,6 @@
43
42
  float: left;
44
43
  margin: 2px;
45
44
  padding: 0px 8px 0px 5px;
46
-
47
- .close {
48
- all: unset;
49
- }
50
45
  }
51
46
  }
52
47
 
@@ -123,7 +118,6 @@
123
118
  }
124
119
 
125
120
  .menubutton {
126
- all: unset;
127
121
  background-color: transparent;
128
122
  border: 0;
129
123
  padding: 0;
@@ -151,4 +145,4 @@
151
145
  font-style: italic;
152
146
  font-size: 13px;
153
147
  }
154
- }
148
+ }
@@ -123,9 +123,6 @@ $dropdown-width: 38px;
123
123
  float: none;
124
124
  }
125
125
  }
126
- .toolbar-component {
127
- width: auto;
128
- }
129
126
  }
130
127
 
131
128
  >.panel {
@@ -0,0 +1,9 @@
1
+ @import "colors.scss";
2
+ @import "fonts.scss";
3
+
4
+ .text-content-component {
5
+ @extend %component-fonts;
6
+ &[data-textcontent="strong"] {
7
+ font-weight: bold;
8
+ }
9
+ }
@@ -1,5 +1,5 @@
1
+ import React__default from 'react';
1
2
  import { ICheckBoxProps } from './types.js';
2
- import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../@types/Position.js';
5
5
 
@@ -8,6 +8,6 @@ import '../@types/Position.js';
8
8
  * o componente Field dentro do componente Form, pois o mesmo leva em consideração o tipo do
9
9
  * componente para gerar propriedades customizadas.
10
10
  */
11
- declare const CheckBox: ({ name, required, value, label, onChange, autofocus, hint, id, gridLayout, checked, disabled, permissionAttr, tooltip, tooltipPosition, tooltipWidth, skeletonize, targetRef, errorMessages, }: ICheckBoxProps) => JSX.Element | null;
11
+ declare const CheckBox: React__default.ForwardRefExoticComponent<ICheckBoxProps & React__default.RefAttributes<HTMLInputElement>>;
12
12
 
13
13
  export { CheckBox as default };
@@ -5,12 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _Label = _interopRequireDefault(require("./Label"));
9
- var _hint = _interopRequireDefault(require("../hint"));
10
8
  var _gridlayout = _interopRequireDefault(require("../gridlayout"));
11
- var helpers = _interopRequireWildcard(require("../inputs/base/helpers"));
12
- var _permissionValidations = require("../permissionValidations");
9
+ var _Label = _interopRequireDefault(require("./Label"));
13
10
  require("../assets/styles/checkbox.scss");
11
+ var _permissionValidations = require("../permissionValidations");
12
+ var _hint = _interopRequireDefault(require("../hint"));
14
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -21,7 +20,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
21
20
  * componente para gerar propriedades customizadas.
22
21
  */
23
22
 
24
- const CheckBox = _ref => {
23
+ const CheckBox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
25
24
  let {
26
25
  name,
27
26
  required,
@@ -30,7 +29,7 @@ const CheckBox = _ref => {
30
29
  onChange,
31
30
  autofocus,
32
31
  hint,
33
- id = '',
32
+ id = undefined,
34
33
  gridLayout,
35
34
  checked = false,
36
35
  disabled,
@@ -39,13 +38,13 @@ const CheckBox = _ref => {
39
38
  tooltipPosition = 'top',
40
39
  tooltipWidth = 'auto',
41
40
  skeletonize,
42
- targetRef,
43
- errorMessages
41
+ targetRef
44
42
  } = _ref;
45
43
  const [isChecked, setIsChecked] = (0, _react.useState)(checked);
46
44
  const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
47
45
  const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
48
46
  const inputRef = (0, _react.useRef)(null);
47
+ (0, _react.useImperativeHandle)(ref, () => inputRef.current, [inputRef.current]);
49
48
  (0, _react.useEffect)(() => {
50
49
  setIsChecked(checked);
51
50
  }, [checked]);
@@ -77,8 +76,7 @@ const CheckBox = _ref => {
77
76
  onClick: !shouldDisable() && !skeletonize ? () => setIsChecked(!isChecked) : undefined,
78
77
  tabIndex: -1,
79
78
  role: "checkbox",
80
- "aria-checked": "false",
81
- onKeyPress: undefined
79
+ "aria-checked": "false"
82
80
  }, /*#__PURE__*/_react.default.createElement("input", {
83
81
  ref: r => {
84
82
  if (targetRef) targetRef(r);
@@ -103,11 +101,12 @@ const CheckBox = _ref => {
103
101
  visible: !!hint,
104
102
  description: hint,
105
103
  customClass: "hint"
106
- }), errorMessages && helpers.getErrorMessages(errorMessages));
104
+ }));
107
105
  if (onDenied.unvisible) return null;
108
106
  return gridLayout ? /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
109
107
  customClass: "-withinput",
110
108
  cols: gridLayout
111
109
  }, renderInput()) : renderInput();
112
- };
110
+ });
111
+ CheckBox.displayName = 'CheckBox';
113
112
  var _default = exports.default = CheckBox;
@@ -4,7 +4,7 @@ import { Position } from '../@types/Position.js';
4
4
 
5
5
  type ChangeEvent = {
6
6
  checked: boolean;
7
- id: string;
7
+ id?: string;
8
8
  name?: string;
9
9
  value: boolean;
10
10
  };
@@ -37,7 +37,6 @@ interface ICheckBoxProps {
37
37
  skeletonize?: boolean;
38
38
  targetRef?: (ref: HTMLInputElement | null) => void;
39
39
  targetSpanRef?: (ref: HTMLSpanElement | null) => void;
40
- errorMessages?: string[] | undefined;
41
40
  }
42
41
 
43
42
  export type { ChangeEvent, ICheckBoxProps };
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
- var _uuid = _interopRequireDefault(require("uuid"));
8
+ var uuid = _interopRequireWildcard(require("uuid"));
9
9
  var _base = _interopRequireDefault(require("./base"));
10
10
  var _Footer = _interopRequireDefault(require("./base/Footer"));
11
11
  var _icons = _interopRequireDefault(require("../icons"));
12
12
  var _buttons = require("../buttons");
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
16
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
17
  const getIcon = (iconName, icon) => {
@@ -46,7 +48,7 @@ const Custom = props => {
46
48
  }, props.text)), props.buttons && props.buttons.length > 0 && /*#__PURE__*/_react.default.createElement(_Footer.default, props, /*#__PURE__*/_react.default.createElement(_buttons.ButtonContainer, {
47
49
  position: "right"
48
50
  }, props.buttons.map(button => /*#__PURE__*/_react.default.cloneElement(button, {
49
- key: "button-".concat(_uuid.default.v1())
51
+ key: "button-".concat(uuid.v1())
50
52
  })))));
51
53
  };
52
54
  var _default = exports.default = Custom;
@@ -13,7 +13,6 @@ const Content = _ref => {
13
13
  styleForContent
14
14
  } = _ref;
15
15
  return /*#__PURE__*/_react.default.createElement("div", {
16
- id: "modal-dialog-content",
17
16
  className: "dialog-content",
18
17
  style: styleForContent
19
18
  }, children);
@@ -11,11 +11,11 @@ var _base = require("../base");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
- const getCloseButton = handleClose => /*#__PURE__*/_react.default.createElement("button", {
15
- id: "botao-fechar-modal-cabecalho",
14
+ const getCloseButton = handleClose => /*#__PURE__*/_react.default.createElement("span", {
16
15
  className: "close-button",
17
- tabIndex: 0,
18
- onClick: handleClose
16
+ onClick: handleClose,
17
+ role: "button",
18
+ tabIndex: 0
19
19
  }, /*#__PURE__*/_react.default.createElement(_icons.default, {
20
20
  name: "cancel2"
21
21
  }));
@@ -103,10 +103,10 @@ const BaseDialog = props => {
103
103
  };
104
104
  const createdModal = /*#__PURE__*/_react.default.createElement("div", {
105
105
  className: "modalcontainer",
106
- onMouseDown: handleClickOutside,
107
106
  style: {
108
107
  zIndex: 99999 + Number(zIndex)
109
- }
108
+ },
109
+ onMouseDown: handleClickOutside
110
110
  }, overlay && /*#__PURE__*/_react.default.createElement("div", {
111
111
  className: "modal-overlay",
112
112
  "data-testid": "modal-overlay"
@@ -120,10 +120,8 @@ const BaseDialog = props => {
120
120
  ref: wrapperEl
121
121
  }, children)));
122
122
  (0, _react.useEffect)(() => {
123
- if (open) {
124
- if (closeOnEsc) {
125
- document.addEventListener('keydown', handleCloseOnEsc);
126
- }
123
+ if (open && closeOnEsc) {
124
+ document.addEventListener('keydown', handleCloseOnEsc);
127
125
  }
128
126
  return () => {
129
127
  document.removeEventListener('keydown', handleCloseOnEsc);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.FormDialogContext = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _uuid = _interopRequireDefault(require("uuid"));
8
+ var uuid = _interopRequireWildcard(require("uuid"));
9
9
  var _base = _interopRequireDefault(require("../base"));
10
10
  var _Header = _interopRequireDefault(require("../base/Header"));
11
11
  var _index = require("../../buttons/index");
@@ -71,12 +71,12 @@ const ModalForm = props => {
71
71
  }), props.buttons.map(button => {
72
72
  if (context && context.securityBeforeUnload && button && button.type && button.type.name === 'CancelButton') {
73
73
  return /*#__PURE__*/_react.default.cloneElement(button, {
74
- key: "button-".concat(_uuid.default.v1()),
74
+ key: "button-".concat(uuid.v1()),
75
75
  onClick: props.handlerClose
76
76
  });
77
77
  }
78
78
  return /*#__PURE__*/_react.default.cloneElement(button, {
79
- key: "button-".concat(_uuid.default.v1())
79
+ key: "button-".concat(uuid.v1())
80
80
  });
81
81
  })))));
82
82
  };
@@ -82,9 +82,8 @@ const BaseDrawer = _ref => {
82
82
  body.appendChild(drawerOverlay);
83
83
  };
84
84
  const closeDrawerOnEsc = e => {
85
- if (closeOnEsc && e.key === 'ESC') {
85
+ if (closeOnEsc && (e.keyCode === 27 || e.key === 'ESC')) {
86
86
  handlerClose === null || handlerClose === void 0 ? void 0 : handlerClose();
87
- e.stopPropagation();
88
87
  }
89
88
  };
90
89
  (0, _react.useEffect)(() => {
@@ -99,7 +98,7 @@ const BaseDrawer = _ref => {
99
98
  if (overlay && !targetId && body) setDrawerOverlay(body);
100
99
  return () => {
101
100
  const drawerOverlay = document.getElementsByClassName('drawer-overlay')[0];
102
- if (closeOnEsc) document.body.removeEventListener('keydown', closeDrawerOnEsc);
101
+ if (closeOnEsc) document.body.removeEventListener('keyup', closeDrawerOnEsc);
103
102
  if (targetId) {
104
103
  const drawerComponentTarget = document.getElementById(targetId);
105
104
  if (drawerComponentTarget && drawerComponentEl.current) {
@@ -111,9 +110,9 @@ const BaseDrawer = _ref => {
111
110
  }, []);
112
111
  (0, _react.useEffect)(() => {
113
112
  if (closeOnEsc) {
114
- document.body.addEventListener('keydown', closeDrawerOnEsc);
113
+ document.body.addEventListener('keyup', closeDrawerOnEsc);
115
114
  }
116
- return () => document.body.removeEventListener('keydown', closeDrawerOnEsc);
115
+ return () => document.body.removeEventListener('keyup', closeDrawerOnEsc);
117
116
  }, [closeOnEsc]);
118
117
  const contextValues = {
119
118
  handlerClose,
@@ -24,7 +24,7 @@ const getIcon = (titleIcon, icon) => {
24
24
  return /*#__PURE__*/_react.default.createElement("span", {
25
25
  "data-testid": "icon-header",
26
26
  className: "icon-header"
27
- }, icon || /*#__PURE__*/_react.default.createElement(_icons.default, {
27
+ }, icon || titleIcon && /*#__PURE__*/_react.default.createElement(_icons.default, {
28
28
  name: titleIcon,
29
29
  color: "#000",
30
30
  size: 24
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { IPopUpProps } from './types.js';
3
3
 
4
- declare const DropdownPopup: ({ id, customClassForDropdown, align, isFloatMenu, topPosition, leftPosition, rightPosition, minWidth, ...props }: IPopUpProps) => React.ReactPortal;
4
+ declare const DropdownPopup: ({ customClassForDropdown, align, isFloatMenu, topPosition, leftPosition, rightPosition, minWidth, ...props }: IPopUpProps) => React.ReactPortal;
5
5
 
6
6
  export { DropdownPopup as default };
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _reactDom = _interopRequireDefault(require("react-dom"));
9
- var _uuid = require("uuid");
10
- const _excluded = ["id", "customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth"];
9
+ const _excluded = ["customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth"];
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
11
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
13
12
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -31,7 +30,6 @@ const getCalendarDropdownStyle = _ref => {
31
30
  const body = document.getElementsByTagName('body')[0];
32
31
  const DropdownPopup = _ref2 => {
33
32
  let {
34
- id,
35
33
  customClassForDropdown = '',
36
34
  align = 'left',
37
35
  isFloatMenu = false,
@@ -55,11 +53,10 @@ const DropdownPopup = _ref2 => {
55
53
  if (popup && popup.current) {
56
54
  const modalContainers = document.body.getElementsByClassName('modalcontainer');
57
55
  const lastModalContainer = modalContainers[modalContainers.length - 1];
58
- popup.current.style.zIndex = "".concat(modalContainers.length ? Number(lastModalContainer.style.zIndex) + 1 : 99999);
56
+ popup.current.style.zIndex = "".concat(modalContainers.length ? lastModalContainer.style.zIndex : 99999);
59
57
  }
60
58
  (0, _react.useEffect)(() => {
61
59
  body.appendChild(popup.current);
62
- popup.current.id = id || "dropdown-component-".concat((0, _uuid.v1)());
63
60
  return () => {
64
61
  body.removeChild(popup.current);
65
62
  };
@@ -22,7 +22,6 @@ interface WithDropdownContextProps {
22
22
  handleDropdownClose: () => void;
23
23
  }
24
24
  interface IPopUpProps {
25
- id?: string;
26
25
  children?: ReactNode;
27
26
  customClassForDropdown?: string;
28
27
  align: 'left' | 'right';
@@ -575,7 +575,7 @@ var _default = exports.default = {
575
575
  },
576
576
  cash3: {
577
577
  viewbox: '0 0 17 16',
578
- paths: ['9h1v1h-1v-1z', 'M0 6v9h17v-9h-17zM3 14h-2v-2h1v1h1v1zM3 8h-1v1h-1v-2h2v1zM10.5 10c0.276 0 0.5 0.224 0.5 0.5v2c0 0.276-0.224 0.5-0.5 0.5h-1.5v0.5c0 0.276-0.224 0.5-0.5 0.5s-0.5-0.224-0.5-0.5v-0.5h-1.5c-0.276 0-0.5-0.224-0.5-0.5s0.224-0.5 0.5-0.5h1.5v-1h-1.5c-0.276 0-0.5-0.224-0.5-0.5v-2c0-0.276 0.224-0.5 0.5-0.5h1.5v-0.5c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v0.5h1.5c0.276 0 0.5 0.224 0.5 0.5s-0.224 0.5-0.5 0.5h-1.5v1h1.5zM16 14h-2v-1h1v-1h1v2zM16 9h-1v-1h-1v-1h2v2z', 'M9 11h1v1h-1v-1z', 'M1 4h15v1.5h-15v-1.5z', 'M2 2h13v1.5h-13v-1.5z']
578
+ paths: ['M7 9h1v1h-1v-1z', 'M0 6v9h17v-9h-17zM3 14h-2v-2h1v1h1v1zM3 8h-1v1h-1v-2h2v1zM10.5 10c0.276 0 0.5 0.224 0.5 0.5v2c0 0.276-0.224 0.5-0.5 0.5h-1.5v0.5c0 0.276-0.224 0.5-0.5 0.5s-0.5-0.224-0.5-0.5v-0.5h-1.5c-0.276 0-0.5-0.224-0.5-0.5s0.224-0.5 0.5-0.5h1.5v-1h-1.5c-0.276 0-0.5-0.224-0.5-0.5v-2c0-0.276 0.224-0.5 0.5-0.5h1.5v-0.5c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v0.5h1.5c0.276 0 0.5 0.224 0.5 0.5s-0.224 0.5-0.5 0.5h-1.5v1h1.5zM16 14h-2v-1h1v-1h1v2zM16 9h-1v-1h-1v-1h2v2z', 'M9 11h1v1h-1v-1z', 'M1 4h15v1.5h-15v-1.5z', 'M2 2h13v1.5h-13v-1.5z']
579
579
  },
580
580
  wallet: {
581
581
  viewbox: '0 0 17 16',
@@ -1,13 +1,14 @@
1
- import { IIconProps } from './types.js';
1
+ import { IconProps } from './types.js';
2
2
  import 'react';
3
3
  import '../@types/PointerEvents.js';
4
4
  import '../@types/SizePixels.js';
5
5
  import '../@types/Icon.js';
6
6
  import './helper.js';
7
7
  import '../@types/Position.js';
8
+ import '../@types/ColorStyles.js';
8
9
 
9
10
  declare const _default: {
10
- (props: IIconProps): JSX.Element;
11
+ (props: IconProps): JSX.Element;
11
12
  displayName: string;
12
13
  };
13
14
 
@@ -24,17 +24,23 @@ const Icon = _ref => {
24
24
  disabled = false,
25
25
  customClass = '',
26
26
  customClassForContainer = '',
27
- color = '#676464',
27
+ colorStyle = 'default',
28
+ color,
29
+ viewBox,
28
30
  pointerEvents = 'none',
29
31
  targetRef,
30
32
  tooltip
31
33
  } = _ref;
34
+ const isUsingColorStyle = colorStyle !== 'default';
35
+ const colorFromProp = isUsingColorStyle || !color ? undefined : color;
32
36
  const refSvg = (0, _react.useRef)(null);
37
+ const viewBoxFromIconOrSvgStrcut = name ? listIcon[name].viewbox : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.viewbox;
33
38
  const getPaths = () => name ? listIcon[name].paths : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.paths;
34
39
  const getSvg = () => {
35
40
  var _getPaths;
36
41
  return /*#__PURE__*/_react.default.createElement("svg", {
37
42
  "data-testid": "icon",
43
+ "data-color-style": colorStyle,
38
44
  onClick: () => {
39
45
  if (onClick && !disabled) onClick();
40
46
  },
@@ -43,8 +49,8 @@ const Icon = _ref => {
43
49
  },
44
50
  width: "".concat(size, "px"),
45
51
  height: "".concat(size, "px"),
46
- fill: disabled ? disabledIconColor : color,
47
- viewBox: name ? listIcon[name].viewbox : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.viewbox,
52
+ fill: disabled ? disabledIconColor : colorFromProp,
53
+ viewBox: viewBox || viewBoxFromIconOrSvgStrcut,
48
54
  className: "icon-component ".concat(customClass),
49
55
  pointerEvents: pointerEvents,
50
56
  style: style
@@ -54,6 +60,7 @@ const Icon = _ref => {
54
60
  key: value
55
61
  })));
56
62
  };
63
+ if (color && colorStyle !== 'default') throw new Error('Expected only one of the two properties: colorStyle or color');
57
64
  if (!name && !svgStruct) throw new Error('One of the "name" and "svgStruct" props must be filled');
58
65
  if (!visible) return null;
59
66
  if (!tooltip) return getSvg();
@@ -3,6 +3,7 @@ import { PointerEvents } from '../@types/PointerEvents.js';
3
3
  import { SizePixels } from '../@types/SizePixels.js';
4
4
  import { IconNames } from '../@types/Icon.js';
5
5
  import { Position } from '../@types/Position.js';
6
+ import { ColorStyles } from '../@types/ColorStyles.js';
6
7
  import './helper.js';
7
8
 
8
9
  type ListIconType = {
@@ -11,26 +12,38 @@ type ListIconType = {
11
12
  paths: Array<string>;
12
13
  };
13
14
  };
14
- interface IIconProps {
15
+ type SvgStruct = {
16
+ viewbox: string;
17
+ paths: Array<string>;
18
+ };
19
+ type BaseIconProps = {
15
20
  size?: SizePixels;
16
- color?: string;
17
21
  customClass?: string;
18
22
  customClassForContainer?: string;
19
23
  style?: CSSProperties;
20
24
  visible?: boolean;
21
25
  disabled?: boolean;
22
26
  pointerEvents?: PointerEvents;
23
- name?: IconNames;
24
27
  viewBox?: string;
25
- svgStruct?: {
26
- viewbox: string;
27
- paths: Array<string>;
28
- };
29
28
  onClick?: () => void;
30
29
  tooltipPosition?: Exclude<Position, 'center'>;
31
30
  tooltipWidth?: string | number;
32
31
  tooltip?: string;
33
32
  targetRef?: (ref: HTMLDivElement) => void;
34
- }
33
+ };
34
+ type ColorProps = ({
35
+ colorStyle?: ColorStyles | 'default';
36
+ color?: null;
37
+ } | {
38
+ color?: string;
39
+ colorStyle?: undefined;
40
+ });
41
+ type IconProps = BaseIconProps & ColorProps & ({
42
+ name: IconNames;
43
+ svgStruct?: null;
44
+ } | {
45
+ svgStruct: SvgStruct;
46
+ name?: null;
47
+ });
35
48
 
36
- export type { IIconProps, ListIconType };
49
+ export type { IconProps, ListIconType };
package/lib/index.d.ts CHANGED
@@ -27,6 +27,7 @@ import './labels/types.js';
27
27
  import './icons/types.js';
28
28
  import './@types/PointerEvents.js';
29
29
  import './@types/SizePixels.js';
30
+ import './@types/ColorStyles.js';
30
31
  import './list/Header.js';
31
32
  import './list/types.js';
32
33
  import './list/Item.js';