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

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';
1
+ type PointerEvents = 'none' | 'all' | 'fill' | 'painted' | 'stroke' | 'visible' | 'visibleFill' | 'visiblePainted' | 'visibleStroke' | 'inherit' | 'initial' | 'unset' | 'auto';
2
2
 
3
3
  export { PointerEvents };
@@ -97,7 +97,7 @@
97
97
  > .label {
98
98
  flex-grow: 1;
99
99
  }
100
- > .menuicon {
100
+ > .icon-component-container > .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
- > .menuicon {
115
+ > .icon-component-container > .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 > .menuicon,
51
+ > .item:hover > .icon-component-container > .menuicon,
52
52
  > .item:hover .searchmenuicon,
53
- > .item:hover > .menulink > .menuicon,
53
+ > .item:hover > .menulink > .icon-component-container > .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
- > .menuicon {
135
+ > .icon-component-container > .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 > .menuicon {
167
+ > .menulink > .icon-component-container > .menuicon {
168
168
  justify-self: center;
169
169
  }
170
170
  }
@@ -6,6 +6,7 @@ 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"));
9
10
  var _base = _interopRequireDefault(require("../base"));
10
11
  var _Header = _interopRequireDefault(require("../base/Header"));
11
12
  var _index = require("../../buttons/index");
@@ -69,14 +70,17 @@ var ModalForm = function ModalForm(props) {
69
70
  styleForContent: _objectSpread(_objectSpread({}, props.styleForContent), overlayStyle)
70
71
  }, content || children), getSpinner(), showFooter && /*#__PURE__*/_react.default.createElement(_Footer.default, null, /*#__PURE__*/_react.default.createElement(_index.ButtonContainer, _extends({}, props, {
71
72
  style: _objectSpread({}, overlayStyle)
72
- }), _react.default.Children.toArray(props.buttons.map(function (button) {
73
+ }), props.buttons.map(function (button) {
73
74
  if (context && context.securityBeforeUnload && button && button.type && button.type.name === 'CancelButton') {
74
75
  return /*#__PURE__*/_react.default.cloneElement(button, {
76
+ key: "button-".concat(_uuid.default.v1()),
75
77
  onClick: props.handlerClose
76
78
  });
77
79
  }
78
- return /*#__PURE__*/_react.default.cloneElement(button);
79
- }))))));
80
+ return /*#__PURE__*/_react.default.cloneElement(button, {
81
+ key: "button-".concat(_uuid.default.v1())
82
+ });
83
+ })))));
80
84
  };
81
85
  var _default = (0, _withFormSecurity.default)(ModalForm);
82
86
  exports.default = _default;
@@ -41,8 +41,8 @@ var getEventProps = function getEventProps(_ref) {
41
41
  handleShowValidateMessages(true);
42
42
  },
43
43
  onKeyDown: function onKeyDown(e) {
44
- handlerFieldChange === null || handlerFieldChange === void 0 ? void 0 : handlerFieldChange(e);
45
44
  if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
45
+ handlerFieldChange === null || handlerFieldChange === void 0 ? void 0 : handlerFieldChange(e);
46
46
  if (validators) handlerFieldValidade === null || handlerFieldValidade === void 0 ? void 0 : handlerFieldValidade(name, e.target.value, validators);
47
47
  if (_onKeyDown) _onKeyDown(e);
48
48
  handleShowValidateMessages(true);
@@ -4,7 +4,11 @@ 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';
7
8
 
8
- declare const Icon: ({ name, onClick, svgStruct, size, style, visible, disabled, customClass, color, pointerEvents, }: IIconProps) => JSX.Element | null;
9
+ declare const _default: {
10
+ (props: IIconProps): JSX.Element;
11
+ displayName: string;
12
+ };
9
13
 
10
- export { Icon as default };
14
+ export { _default as default };
@@ -1,13 +1,17 @@
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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
8
9
  var _helper = _interopRequireDefault(require("./helper"));
9
10
  require("../assets/styles/icon.scss");
11
+ var _withTooltip = _interopRequireDefault(require("../internals/withTooltip"));
10
12
  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; }
11
15
  var listIcon = _helper.default;
12
16
  var disabledIconColor = 'rgb(193, 193, 193)';
13
17
  var Icon = function Icon(_ref) {
@@ -25,20 +29,36 @@ var Icon = function Icon(_ref) {
25
29
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
26
30
  _ref$customClass = _ref.customClass,
27
31
  customClass = _ref$customClass === void 0 ? '' : _ref$customClass,
32
+ _ref$customClassForCo = _ref.customClassForContainer,
33
+ customClassForContainer = _ref$customClassForCo === void 0 ? '' : _ref$customClassForCo,
28
34
  _ref$color = _ref.color,
29
35
  color = _ref$color === void 0 ? '#676464' : _ref$color,
30
36
  _ref$pointerEvents = _ref.pointerEvents,
31
- pointerEvents = _ref$pointerEvents === void 0 ? 'none' : _ref$pointerEvents;
37
+ pointerEvents = _ref$pointerEvents === void 0 ? 'none' : _ref$pointerEvents,
38
+ targetRef = _ref.targetRef;
39
+ var refSvg = (0, _react.useRef)(null);
32
40
  var getPaths = function getPaths() {
33
41
  return name ? listIcon[name].paths : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.paths;
34
42
  };
35
43
  if (!name && !svgStruct) throw new Error('One of the "name" and "svgStruct" props must be filled');
36
44
  if (!visible) return null;
37
- return /*#__PURE__*/_react.default.createElement("svg", {
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", {
38
55
  "data-testid": "icon",
39
56
  onClick: function onClick() {
40
57
  if (_onClick && !disabled) _onClick();
41
58
  },
59
+ ref: function ref(r) {
60
+ refSvg.current = r;
61
+ },
42
62
  width: "".concat(size, "px"),
43
63
  height: "".concat(size, "px"),
44
64
  fill: disabled ? disabledIconColor : color,
@@ -52,7 +72,7 @@ var Icon = function Icon(_ref) {
52
72
  d: value,
53
73
  key: value
54
74
  });
55
- }));
75
+ })));
56
76
  };
57
- var _default = Icon;
77
+ var _default = (0, _withTooltip.default)(Icon);
58
78
  exports.default = _default;
@@ -2,6 +2,7 @@ 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';
5
6
  import './helper.js';
6
7
 
7
8
  type ListIconType = {
@@ -14,6 +15,7 @@ interface IIconProps {
14
15
  size?: SizePixels;
15
16
  color?: string;
16
17
  customClass?: string;
18
+ customClassForContainer?: string;
17
19
  style?: CSSProperties;
18
20
  visible?: boolean;
19
21
  disabled?: boolean;
@@ -25,6 +27,10 @@ interface IIconProps {
25
27
  paths: Array<string>;
26
28
  };
27
29
  onClick?: () => void;
30
+ tooltipPosition?: Exclude<Position, 'center'>;
31
+ tooltipWidth?: string | number;
32
+ tooltip?: string;
33
+ targetRef?: (ref: HTMLDivElement) => void;
28
34
  }
29
35
 
30
36
  export { IIconProps, ListIconType };
@@ -48,8 +48,7 @@ var Dropdown = function Dropdown(props) {
48
48
  searchOnDropdown = props.searchOnDropdown,
49
49
  handleOnKeydown = props.handleOnKeydown,
50
50
  searchNotFoundText = props.searchNotFoundText,
51
- idKey = props.idKey,
52
- handlerSelecionadoAgora = props.handlerSelecionadoAgora;
51
+ idKey = props.idKey;
53
52
  var _useState = (0, _react.useState)(helper.returnDropdownDynamicStyles(_objectSpread({}, props))),
54
53
  _useState2 = _slicedToArray(_useState, 2),
55
54
  dropdownDynamicStyles = _useState2[0],
@@ -105,7 +104,6 @@ var Dropdown = function Dropdown(props) {
105
104
  onKeyPress: function onKeyPress() {},
106
105
  onClick: function onClick() {
107
106
  if (!disabled) {
108
- if (handlerSelecionadoAgora) handlerSelecionadoAgora(true);
109
107
  handleOnSelect(item);
110
108
  handleOnBlur(item);
111
109
  }
@@ -89,10 +89,6 @@ var SimpleSelect = function SimpleSelect(props) {
89
89
  _useState16 = _slicedToArray(_useState15, 2),
90
90
  isTyping = _useState16[0],
91
91
  setIsTyping = _useState16[1];
92
- var _useState17 = (0, _react.useState)(false),
93
- _useState18 = _slicedToArray(_useState17, 2),
94
- selecionadoAgora = _useState18[0],
95
- setSelecionadoAgora = _useState18[1];
96
92
  var dropdownRef = (0, _react.useRef)(null);
97
93
  var componentId = "select-component".concat(_uuid.default.v1());
98
94
  var componentRef = (0, _react.useRef)(null);
@@ -163,20 +159,19 @@ var SimpleSelect = function SimpleSelect(props) {
163
159
  setSelected(selectedDropdown);
164
160
  if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
165
161
  onChange(selectedDropdown);
166
- setSelecionadoAgora(true);
167
162
  };
168
163
  var onOpenClose = function onOpenClose() {
169
164
  setOpened(!opened);
170
165
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
171
166
  };
172
- var _onFocus = function onFocus() {
167
+ var onFocus = function onFocus() {
173
168
  setOpened(openDropdownOnFocus);
174
169
  if (selectWrapper) {
175
170
  var dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : 0;
176
171
  setDropdownWidth(dropdownWidthFocus);
177
172
  }
178
173
  };
179
- var _onBlur = function onBlur() {
174
+ var onBlur = function onBlur() {
180
175
  if (props.onBlur) {
181
176
  var event = getSelectEvent(selected);
182
177
  props.onBlur(event);
@@ -190,7 +185,6 @@ var SimpleSelect = function SimpleSelect(props) {
190
185
  setOpened(false);
191
186
  setIsTyping(false);
192
187
  }
193
- setSelecionadoAgora(false);
194
188
  };
195
189
  var onInputKeyDown = function onInputKeyDown(e) {
196
190
  if (e.keyCode) {
@@ -275,7 +269,6 @@ var SimpleSelect = function SimpleSelect(props) {
275
269
  setDataCombo([(_ref2 = {}, _defineProperty(_ref2, idKey, allOptions.idValue), _defineProperty(_ref2, descriptionKeyIsString ? descriptionKey : descriptionKey(allOptions.label), allOptions.label), _ref2)].concat(_toConsumableArray(dataSource)));
276
270
  }
277
271
  }, [JSON.stringify(dataSourceWithAllOptions)]);
278
- console.log('selecionadoAgora', selecionadoAgora);
279
272
  return /*#__PURE__*/_react.default.createElement("span", {
280
273
  id: componentId,
281
274
  ref: componentRef,
@@ -283,15 +276,8 @@ var SimpleSelect = function SimpleSelect(props) {
283
276
  }, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
284
277
  readOnly: undigitable || shouldBeReadOnly(),
285
278
  value: inputText,
286
- autoFocus: opened || selecionadoAgora,
287
- onFocus: function onFocus() {
288
- setSelecionadoAgora(true);
289
- _onFocus();
290
- },
291
- onBlur: function onBlur() {
292
- setSelecionadoAgora(false);
293
- _onBlur();
294
- },
279
+ onFocus: onFocus,
280
+ onBlur: onBlur,
295
281
  onChange: function onChange(e) {
296
282
  if (e) onFilter(e.target.value);
297
283
  },
@@ -325,17 +311,14 @@ var SimpleSelect = function SimpleSelect(props) {
325
311
  handleOnSelect: function handleOnSelect(dataSelected) {
326
312
  if (dataSelected) onSelect(dataSelected);
327
313
  },
328
- handlerSelecionadoAgora: function handlerSelecionadoAgora(exemplo) {
329
- return setSelecionadoAgora(exemplo);
330
- },
331
314
  handleOnFilter: function handleOnFilter(valueFilter) {
332
315
  return onFilter(valueFilter);
333
316
  },
334
317
  handleOnKeydown: onInputKeyDown,
335
318
  handleOnBlur: function handleOnBlur() {
336
- return _onBlur;
319
+ return onBlur;
337
320
  },
338
- handleOnFocus: _onFocus,
321
+ handleOnFocus: onFocus,
339
322
  opened: opened,
340
323
  dataCombo: dataCombo,
341
324
  dropdownWidth: dropdownWidth || 0
@@ -110,7 +110,6 @@ interface IDropdownSelectProps {
110
110
  handleOnKeydown: (e: CustomInputEvent | KeyboardEvent) => void;
111
111
  handleOnBlur: (item: DataCombo) => void;
112
112
  handleOnFocus: () => void;
113
- handlerSelecionadoAgora?: (bool: boolean) => void;
114
113
  opened: boolean;
115
114
  dropdownRef: MutableRefObject<HTMLDivElement | null>;
116
115
  dataCombo: DataCombo[];
@@ -84,6 +84,7 @@ 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",
87
88
  customClass: "menuicon"
88
89
  }), isExpanded && /*#__PURE__*/_react.default.createElement("span", {
89
90
  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.4",
3
+ "version": "1.0.12-beta.5",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",