linear-react-components-ui 1.0.12-beta.5 → 1.0.12-beta.7

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.
@@ -1,3 +1,3 @@
1
- type PointerEvents = 'none' | 'all' | 'fill' | 'painted' | 'stroke' | 'visible' | 'visibleFill' | 'visiblePainted' | 'visibleStroke' | 'inherit' | 'initial' | 'unset' | 'auto';
1
+ type PointerEvents = 'none' | 'all' | 'fill' | 'painted' | 'stroke' | 'visible' | 'visibleFill' | 'visiblePainted' | 'visibleStroke' | 'inherit' | 'initial' | 'unset';
2
2
 
3
3
  export { PointerEvents };
@@ -97,7 +97,7 @@
97
97
  > .label {
98
98
  flex-grow: 1;
99
99
  }
100
- > .icon-component-container > .menuicon {
100
+ > .menuicon {
101
101
  margin-right: 5px;
102
102
  }
103
103
  }
@@ -112,7 +112,7 @@
112
112
  > .label {
113
113
  flex-grow: 1;
114
114
  }
115
- > .icon-component-container > .menuicon {
115
+ > .menuicon {
116
116
  margin-right: 5px
117
117
  }
118
118
  }
@@ -48,9 +48,9 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
48
48
  > .item:hover {
49
49
  background-color: #eee;
50
50
  }
51
- > .item:hover > .icon-component-container > .menuicon,
51
+ > .item:hover > .menuicon,
52
52
  > .item:hover .searchmenuicon,
53
- > .item:hover > .menulink > .icon-component-container > .menuicon,
53
+ > .item:hover > .menulink > .menuicon,
54
54
  > .item:hover > .menulink .searchmenuicon {
55
55
  fill: rgb(114, 114, 114);
56
56
  }
@@ -132,7 +132,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
132
132
  align-items: center;
133
133
  text-decoration: none;
134
134
  }
135
- > .icon-component-container > .menuicon {
135
+ > .menuicon {
136
136
  justify-self: center;
137
137
  }
138
138
  > .title,
@@ -164,7 +164,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
164
164
  align-items: center;
165
165
  }
166
166
  > .menuicon,
167
- > .menulink > .icon-component-container > .menuicon {
167
+ > .menulink > .menuicon {
168
168
  justify-self: center;
169
169
  }
170
170
  }
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = exports.FormDialogContext = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _uuid = _interopRequireDefault(require("uuid"));
10
9
  var _base = _interopRequireDefault(require("../base"));
11
10
  var _Header = _interopRequireDefault(require("../base/Header"));
12
11
  var _index = require("../../buttons/index");
@@ -70,17 +69,14 @@ var ModalForm = function ModalForm(props) {
70
69
  styleForContent: _objectSpread(_objectSpread({}, props.styleForContent), overlayStyle)
71
70
  }, content || children), getSpinner(), showFooter && /*#__PURE__*/_react.default.createElement(_Footer.default, null, /*#__PURE__*/_react.default.createElement(_index.ButtonContainer, _extends({}, props, {
72
71
  style: _objectSpread({}, overlayStyle)
73
- }), props.buttons.map(function (button) {
72
+ }), _react.default.Children.toArray(props.buttons.map(function (button) {
74
73
  if (context && context.securityBeforeUnload && button && button.type && button.type.name === 'CancelButton') {
75
74
  return /*#__PURE__*/_react.default.cloneElement(button, {
76
- key: "button-".concat(_uuid.default.v1()),
77
75
  onClick: props.handlerClose
78
76
  });
79
77
  }
80
- return /*#__PURE__*/_react.default.cloneElement(button, {
81
- key: "button-".concat(_uuid.default.v1())
82
- });
83
- })))));
78
+ return /*#__PURE__*/_react.default.cloneElement(button);
79
+ }))))));
84
80
  };
85
81
  var _default = (0, _withFormSecurity.default)(ModalForm);
86
82
  exports.default = _default;
@@ -42,7 +42,6 @@ var getEventProps = function getEventProps(_ref) {
42
42
  },
43
43
  onKeyDown: function onKeyDown(e) {
44
44
  if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
45
- handlerFieldChange === null || handlerFieldChange === void 0 ? void 0 : handlerFieldChange(e);
46
45
  if (validators) handlerFieldValidade === null || handlerFieldValidade === void 0 ? void 0 : handlerFieldValidade(name, e.target.value, validators);
47
46
  if (_onKeyDown) _onKeyDown(e);
48
47
  handleShowValidateMessages(true);
@@ -4,11 +4,7 @@ import '../@types/PointerEvents.js';
4
4
  import '../@types/SizePixels.js';
5
5
  import '../@types/Icon.js';
6
6
  import './helper.js';
7
- import '../@types/Position.js';
8
7
 
9
- declare const _default: {
10
- (props: IIconProps): JSX.Element;
11
- displayName: string;
12
- };
8
+ declare const Icon: ({ name, onClick, svgStruct, size, style, visible, disabled, customClass, color, pointerEvents, }: IIconProps) => JSX.Element | null;
13
9
 
14
- export { _default as default };
10
+ export { Icon as default };
@@ -1,17 +1,13 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
7
+ var _react = _interopRequireDefault(require("react"));
9
8
  var _helper = _interopRequireDefault(require("./helper"));
10
9
  require("../assets/styles/icon.scss");
11
- var _withTooltip = _interopRequireDefault(require("../internals/withTooltip"));
12
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
11
  var listIcon = _helper.default;
16
12
  var disabledIconColor = 'rgb(193, 193, 193)';
17
13
  var Icon = function Icon(_ref) {
@@ -29,36 +25,20 @@ var Icon = function Icon(_ref) {
29
25
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
30
26
  _ref$customClass = _ref.customClass,
31
27
  customClass = _ref$customClass === void 0 ? '' : _ref$customClass,
32
- _ref$customClassForCo = _ref.customClassForContainer,
33
- customClassForContainer = _ref$customClassForCo === void 0 ? '' : _ref$customClassForCo,
34
28
  _ref$color = _ref.color,
35
29
  color = _ref$color === void 0 ? '#676464' : _ref$color,
36
30
  _ref$pointerEvents = _ref.pointerEvents,
37
- pointerEvents = _ref$pointerEvents === void 0 ? 'none' : _ref$pointerEvents,
38
- targetRef = _ref.targetRef;
39
- var refSvg = (0, _react.useRef)(null);
31
+ pointerEvents = _ref$pointerEvents === void 0 ? 'none' : _ref$pointerEvents;
40
32
  var getPaths = function getPaths() {
41
33
  return name ? listIcon[name].paths : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.paths;
42
34
  };
43
35
  if (!name && !svgStruct) throw new Error('One of the "name" and "svgStruct" props must be filled');
44
36
  if (!visible) return null;
45
- return /*#__PURE__*/_react.default.createElement("div", {
46
- className: "icon-component-container ".concat(customClassForContainer),
47
- style: {
48
- display: 'inline-flex',
49
- placeSelf: 'center'
50
- },
51
- ref: function ref(r) {
52
- if (targetRef && r) targetRef(r);
53
- }
54
- }, /*#__PURE__*/_react.default.createElement("svg", {
37
+ return /*#__PURE__*/_react.default.createElement("svg", {
55
38
  "data-testid": "icon",
56
39
  onClick: function onClick() {
57
40
  if (_onClick && !disabled) _onClick();
58
41
  },
59
- ref: function ref(r) {
60
- refSvg.current = r;
61
- },
62
42
  width: "".concat(size, "px"),
63
43
  height: "".concat(size, "px"),
64
44
  fill: disabled ? disabledIconColor : color,
@@ -72,7 +52,7 @@ var Icon = function Icon(_ref) {
72
52
  d: value,
73
53
  key: value
74
54
  });
75
- })));
55
+ }));
76
56
  };
77
- var _default = (0, _withTooltip.default)(Icon);
57
+ var _default = Icon;
78
58
  exports.default = _default;
@@ -2,7 +2,6 @@ import { CSSProperties } from 'react';
2
2
  import { PointerEvents } from '../@types/PointerEvents.js';
3
3
  import { SizePixels } from '../@types/SizePixels.js';
4
4
  import { IconNames } from '../@types/Icon.js';
5
- import { Position } from '../@types/Position.js';
6
5
  import './helper.js';
7
6
 
8
7
  type ListIconType = {
@@ -15,7 +14,6 @@ interface IIconProps {
15
14
  size?: SizePixels;
16
15
  color?: string;
17
16
  customClass?: string;
18
- customClassForContainer?: string;
19
17
  style?: CSSProperties;
20
18
  visible?: boolean;
21
19
  disabled?: boolean;
@@ -27,10 +25,6 @@ interface IIconProps {
27
25
  paths: Array<string>;
28
26
  };
29
27
  onClick?: () => void;
30
- tooltipPosition?: Exclude<Position, 'center'>;
31
- tooltipWidth?: string | number;
32
- tooltip?: string;
33
- targetRef?: (ref: HTMLDivElement) => void;
34
28
  }
35
29
 
36
30
  export { IIconProps, ListIconType };
@@ -71,6 +71,7 @@ var InputTextBase = function InputTextBase(props) {
71
71
  _onDragOver = props.onDragOver,
72
72
  _onDrop = props.onDrop,
73
73
  _onDragLeave = props.onDragLeave,
74
+ _onClick = props.onClick,
74
75
  readOnlyClass = props.readOnlyClass;
75
76
  var propsInput;
76
77
  var options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
@@ -148,6 +149,9 @@ var InputTextBase = function InputTextBase(props) {
148
149
  },
149
150
  onDragLeave: function onDragLeave(e) {
150
151
  if (_onDragLeave) _onDragLeave(e);
152
+ },
153
+ onClick: function onClick(e) {
154
+ if (_onClick) _onClick(e);
151
155
  }
152
156
  });
153
157
  }
@@ -1,4 +1,4 @@
1
- import { KeyboardEvent, DragEvent, MutableRefObject, RefObject, CSSProperties } from 'react';
1
+ import { MouseEvent, KeyboardEvent, DragEvent, MutableRefObject, RefObject, CSSProperties } from 'react';
2
2
  import { TextAlign } from '../../@types/Align.js';
3
3
  import { Period } from '../../@types/Period.js';
4
4
  import { PermissionAttr, OnDenied } from '../../@types/PermissionAttr.js';
@@ -33,6 +33,7 @@ interface IBaseProps {
33
33
  maxLength?: number;
34
34
  name?: string;
35
35
  required?: boolean;
36
+ onClick?: (event: MouseEvent) => void;
36
37
  onBlur?: (e: CustomInputEvent) => void;
37
38
  onFocus?: (e: CustomInputEvent) => void;
38
39
  onReset?: (e: CustomInputEvent) => void;
@@ -80,20 +80,20 @@ var MultipleSelect = function MultipleSelect(props) {
80
80
  var selectWrapper = (0, _react.useRef)();
81
81
  var gridElRef = (0, _react.useRef)();
82
82
  var descriptionKeyIsString = typeof descriptionKey === 'string';
83
+ var insideComponents = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label', 'select-dropdown'];
83
84
  var onScreenResize = function onScreenResize() {
84
85
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
85
86
  };
86
87
  var onClickOutside = function onClickOutside(event) {
87
88
  var target = event.target;
88
- if (target !== selectWrapper.current && selectWrapper.current && !selectWrapper.current.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
89
+ if (!insideComponents.includes(target.className) && target !== selectWrapper.current && selectWrapper.current && !selectWrapper.current.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
89
90
  setOpened(false);
90
91
  }
91
92
  };
92
93
  var onMouseMove = function onMouseMove(event) {
93
94
  var target = event.target;
94
95
  if (target.className === '') return;
95
- var insideComponents = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target.className);
96
- setInsideComponent(insideComponents);
96
+ setInsideComponent(insideComponents.includes(target.className));
97
97
  };
98
98
  var onClearClick = function onClearClick() {
99
99
  setSelected(undefined);
@@ -123,16 +123,21 @@ var MultipleSelect = function MultipleSelect(props) {
123
123
  setInputValue([filteredValue]);
124
124
  }
125
125
  };
126
+ var _onFocus = function onFocus() {
127
+ var dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : dropdownWidth;
128
+ setOpened(true);
129
+ setDropdownWidth(dropdownWidthFocus);
130
+ };
126
131
  var onSelect = function onSelect(select) {
127
132
  if (select === null) return;
128
133
  var currentsSelect = [].concat(_toConsumableArray(currents), [select]);
129
134
  setCurrents(currentsSelect);
130
135
  setDataCombo(dataSource);
131
136
  setInputValue([]);
132
- setOpened(false);
133
137
  if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(function (i) {
134
138
  return i[idKey];
135
139
  })));
140
+ _onFocus();
136
141
  };
137
142
  var onUnselect = function onUnselect(id) {
138
143
  if (currents) {
@@ -149,11 +154,6 @@ var MultipleSelect = function MultipleSelect(props) {
149
154
  setOpened(!opened);
150
155
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
151
156
  };
152
- var _onFocus = function onFocus() {
153
- var dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : dropdownWidth;
154
- setOpened(true);
155
- setDropdownWidth(dropdownWidthFocus);
156
- };
157
157
  var _onBlur = function onBlur(e) {
158
158
  if (props.onBlur) props.onBlur(e);
159
159
  if (!insideComponent) setOpened(false);
@@ -164,20 +164,20 @@ var MultipleSelect = function MultipleSelect(props) {
164
164
  if (!currents.includes(selected)) onSelect(selected);
165
165
  } else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
166
166
  if (!opened) setOpened(true);
167
- var index = dataSource ? dataSource.findIndex(function (d) {
167
+ var index = dataCombo ? dataCombo.findIndex(function (d) {
168
168
  return d === selected;
169
169
  }) : 0;
170
170
  if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
171
- index = dataSource && index === dataSource.length - 1 ? 0 : index + 1;
171
+ index = dataCombo && index === dataCombo.length - 1 ? 0 : index + 1;
172
172
  } else {
173
- index = dataSource && index === 0 ? dataSource.length - 1 : index - 1;
173
+ index = dataCombo && index === 0 ? dataCombo.length - 1 : index - 1;
174
174
  }
175
- if (dataSource && dataSource.length) {
176
- if (descriptionKeyIsString && dataSource[index][descriptionKey]) {
177
- setInputValue(dataSource[index][descriptionKey]);
178
- } else if (!descriptionKeyIsString) setInputValue([descriptionKey(dataSource[index])]);
175
+ if (dataCombo && dataCombo.length) {
176
+ if (descriptionKeyIsString && dataCombo[index][descriptionKey]) {
177
+ setInputValue(dataCombo[index][descriptionKey]);
178
+ } else if (!descriptionKeyIsString) setInputValue([descriptionKey(dataCombo[index])]);
179
179
  }
180
- if (dataSource) setSelected(dataSource[index]);
180
+ if (dataCombo) setSelected(dataCombo[index]);
181
181
  } else if (e.keyCode === constants.keyCodes.BACKSPACE) {
182
182
  if (inputValue.length === 0) {
183
183
  var currentsKeyDown = _lodash.default.dropRight(currents);
@@ -252,6 +252,8 @@ var MultipleSelect = function MultipleSelect(props) {
252
252
  onChange: function onChange(e) {
253
253
  if (e) onFilter(e.target.value);
254
254
  },
255
+ onClick: _onFocus,
256
+ inputRef: dropdownRef,
255
257
  onKeyDown: onInputKeyDown,
256
258
  customClassForWrapper: "selectwrapper ".concat((props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'),
257
259
  customClassForInputContent: "multiselect",
@@ -154,11 +154,13 @@ var SimpleSelect = function SimpleSelect(props) {
154
154
  }
155
155
  };
156
156
  var onSelect = function onSelect(selectedDropdown) {
157
+ var _dropdownRef$current2;
157
158
  if (selectedDropdown === undefined) return;
158
159
  setOpened(false);
159
160
  setSelected(selectedDropdown);
160
161
  if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
161
162
  onChange(selectedDropdown);
163
+ (_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : _dropdownRef$current2.focus();
162
164
  };
163
165
  var onOpenClose = function onOpenClose() {
164
166
  setOpened(!opened);
@@ -281,6 +283,8 @@ var SimpleSelect = function SimpleSelect(props) {
281
283
  onChange: function onChange(e) {
282
284
  if (e) onFilter(e.target.value);
283
285
  },
286
+ onClick: onFocus,
287
+ inputRef: dropdownRef,
284
288
  onKeyDown: onInputKeyDown,
285
289
  customClassForWrapper: "selectwrapper ".concat((undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'),
286
290
  customClassForInputContent: "multiselect",
@@ -19,7 +19,7 @@ interface ISearchProps extends IBaseProps {
19
19
  resetButton?: boolean;
20
20
  onReset?: (event?: CustomInputEvent) => void;
21
21
  onChange?: (event?: CustomInputEvent) => void;
22
- onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
22
+ onClick?: (event: MouseEvent<Element>) => void;
23
23
  textAlign?: TextAlign;
24
24
  disabled?: boolean;
25
25
  readOnly?: boolean;
@@ -110,6 +110,7 @@ interface IDropdownSelectProps {
110
110
  handleOnKeydown: (e: CustomInputEvent | KeyboardEvent) => void;
111
111
  handleOnBlur: (item: DataCombo) => void;
112
112
  handleOnFocus: () => void;
113
+ handlerSelecionadoAgora?: (bool: boolean) => void;
113
114
  opened: boolean;
114
115
  dropdownRef: MutableRefObject<HTMLDivElement | null>;
115
116
  dataCombo: DataCombo[];
@@ -84,7 +84,6 @@ var NavMenuItem = function NavMenuItem(props) {
84
84
  }), /*#__PURE__*/_react.default.createElement(_react.Fragment, null, iconName && /*#__PURE__*/_react.default.createElement(_icons.default, {
85
85
  name: iconName,
86
86
  size: menuSize === 'small' && 16 || menuSize === 'medium' && 24 || menuSize === 'large' && 32 || 16,
87
- customClassForContainer: "menuicon-container",
88
87
  customClass: "menuicon"
89
88
  }), isExpanded && /*#__PURE__*/_react.default.createElement("span", {
90
89
  className: "title"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.0.12-beta.5",
3
+ "version": "1.0.12-beta.7",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",