linear-react-components-ui 1.0.16-beta.1 → 1.0.17-beta.0

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 (42) hide show
  1. package/lib/assets/styles/icon.scss +4 -31
  2. package/lib/dialog/form/index.js +4 -8
  3. package/lib/drawer/Header.js +1 -1
  4. package/lib/form/FieldNumber.js +13 -6
  5. package/lib/form/types.d.ts +1 -0
  6. package/lib/icons/helper.js +1 -1
  7. package/lib/icons/index.d.ts +2 -3
  8. package/lib/icons/index.js +4 -11
  9. package/lib/icons/types.d.ts +9 -22
  10. package/lib/index.d.ts +1 -2
  11. package/lib/inputs/base/InputTextBase.js +4 -0
  12. package/lib/inputs/base/types.d.ts +2 -1
  13. package/lib/inputs/number/BaseNumber.d.ts +1 -1
  14. package/lib/inputs/number/Currency.d.ts +1 -1
  15. package/lib/inputs/number/Decimal.d.ts +1 -1
  16. package/lib/inputs/number/index.d.ts +1 -1
  17. package/lib/inputs/number/index.js +36 -10
  18. package/lib/inputs/number/types.d.ts +11 -12
  19. package/lib/inputs/select/multiple/index.js +32 -19
  20. package/lib/inputs/select/simple/index.js +5 -1
  21. package/lib/inputs/types.d.ts +2 -1
  22. package/lib/menus/float/types.d.ts +1 -1
  23. package/lib/menus/sidenav/types.d.ts +1 -1
  24. package/lib/panel/Content.d.ts +1 -1
  25. package/lib/panel/Content.js +51 -24
  26. package/lib/panel/DangerPanel.d.ts +1 -1
  27. package/lib/panel/Default.d.ts +1 -1
  28. package/lib/panel/Header.d.ts +1 -1
  29. package/lib/panel/InfoPanel.d.ts +1 -1
  30. package/lib/panel/PrimaryPanel.d.ts +1 -1
  31. package/lib/panel/SuccessPanel.d.ts +1 -1
  32. package/lib/panel/ToolBar.d.ts +1 -1
  33. package/lib/panel/WarningPanel.d.ts +1 -1
  34. package/lib/panel/helpers.d.ts +1 -1
  35. package/lib/panel/helpers.js +9 -7
  36. package/lib/panel/index.d.ts +1 -1
  37. package/lib/panel/types.d.ts +1 -1
  38. package/lib/{types-fe4a1068.d.ts → types-c2a0f035.d.ts} +6 -4
  39. package/package.json +1 -1
  40. package/lib/assets/styles/textContent.scss +0 -9
  41. package/lib/textContent/index.d.ts +0 -8
  42. package/lib/textContent/index.js +0 -30
@@ -1,42 +1,15 @@
1
- @import "colors.scss";
2
-
3
1
  /*
4
2
  * Caso altere o nome da classe, deverá pesquisar em todo projeto se existe
5
3
  * algum lugar que esta sobescrevendo
6
4
  */
5
+ .icon-component {
6
+ margin: 0px 2px;
7
+ }
8
+
7
9
  .icon-component-container {
8
10
  display: inline-flex;
9
11
  place-self: center;
10
12
  padding: 2px;
11
13
  border-radius: 99999px;
12
14
  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
- }
41
15
  }
42
-
@@ -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");
@@ -68,19 +67,16 @@ var ModalForm = function ModalForm(props) {
68
67
  handlerClose: props.handlerClose
69
68
  }, props))), /*#__PURE__*/_react.default.createElement(_Content.default, {
70
69
  styleForContent: _objectSpread(_objectSpread({}, props.styleForContent), overlayStyle)
71
- }, content || children), getSpinner(), showFooter && props.buttons && props.buttons.length > 0 && /*#__PURE__*/_react.default.createElement(_Footer.default, null, /*#__PURE__*/_react.default.createElement(_index.ButtonContainer, _extends({}, props, {
70
+ }, content || children), getSpinner(), showFooter && props.buttons && /*#__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;
@@ -26,7 +26,7 @@ var getIcon = function getIcon(titleIcon, icon) {
26
26
  return /*#__PURE__*/_react.default.createElement("span", {
27
27
  "data-testid": "icon-header",
28
28
  className: "icon-header"
29
- }, icon || titleIcon && /*#__PURE__*/_react.default.createElement(_icons.default, {
29
+ }, icon || /*#__PURE__*/_react.default.createElement(_icons.default, {
30
30
  name: titleIcon,
31
31
  color: "#000",
32
32
  size: 24
@@ -30,27 +30,34 @@ var getEventProps = function getEventProps(_ref) {
30
30
  validators = _ref.validators,
31
31
  _onBlur = _ref.onBlur,
32
32
  _onKeyDown = _ref.onKeyDown,
33
+ _onChange = _ref.onChange,
33
34
  handlerFieldValidade = _ref.handlerFieldValidade,
34
35
  handlerFieldChange = _ref.handlerFieldChange,
35
36
  handleShowValidateMessages = _ref.handleShowValidateMessages,
36
- _onChange = _ref.onChange;
37
+ component = _ref.component;
37
38
  return {
38
39
  onBlur: function onBlur(e) {
40
+ if (handlerFieldChange) handlerFieldChange(e);
39
41
  if (validators && handlerFieldValidade) handlerFieldValidade(name, e.target.value, validators);
40
42
  if (_onBlur) _onBlur(e);
41
43
  handleShowValidateMessages(true);
42
44
  },
43
- onChange: function onChange(e) {
44
- if (handlerFieldChange) handlerFieldChange(e);
45
- if (_onChange) _onChange(e);
46
- },
47
45
  onKeyDown: function onKeyDown(e) {
48
46
  if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
49
- handlerFieldChange === null || handlerFieldChange === void 0 ? void 0 : handlerFieldChange(e);
50
47
  if (validators) handlerFieldValidade === null || handlerFieldValidade === void 0 ? void 0 : handlerFieldValidade(name, e.target.value, validators);
51
48
  if (_onKeyDown) _onKeyDown(e);
52
49
  handleShowValidateMessages(true);
53
50
  }
51
+ },
52
+ onChange: function onChange(e) {
53
+ if ((component === null || component === void 0 ? void 0 : component.name) === 'NumberField') {
54
+ if (validators && e.target && handlerFieldValidade) {
55
+ handlerFieldValidade(name, e.target.value, validators);
56
+ handleShowValidateMessages(true);
57
+ }
58
+ if (handlerFieldChange) handlerFieldChange(e);
59
+ if (_onChange) _onChange(e);
60
+ }
54
61
  }
55
62
  };
56
63
  };
@@ -198,6 +198,7 @@ interface IEventParams {
198
198
  handlerFieldChange?: (event: ChangeEvent<HTMLInputElement> | CustomKeyboardEvent) => void;
199
199
  validatorFromComponent?: Validator | Validator[];
200
200
  handleShowValidateMessages: (value: boolean) => void;
201
+ component?: ComponentType<any>;
201
202
  }
202
203
  interface IGetErrorMessagesParams {
203
204
  name: string;
@@ -575,7 +575,7 @@ var _default = {
575
575
  },
576
576
  cash3: {
577
577
  viewbox: '0 0 17 16',
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']
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']
579
579
  },
580
580
  wallet: {
581
581
  viewbox: '0 0 17 16',
@@ -1,14 +1,13 @@
1
- import { IconProps } from './types.js';
1
+ import { IIconProps } 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';
9
8
 
10
9
  declare const _default: {
11
- (props: IconProps): JSX.Element;
10
+ (props: IIconProps): JSX.Element;
12
11
  displayName: string;
13
12
  };
14
13
 
@@ -30,18 +30,13 @@ var Icon = function Icon(_ref) {
30
30
  customClass = _ref$customClass === void 0 ? '' : _ref$customClass,
31
31
  _ref$customClassForCo = _ref.customClassForContainer,
32
32
  customClassForContainer = _ref$customClassForCo === void 0 ? '' : _ref$customClassForCo,
33
- _ref$colorStyle = _ref.colorStyle,
34
- colorStyle = _ref$colorStyle === void 0 ? 'default' : _ref$colorStyle,
35
- color = _ref.color,
36
- viewBox = _ref.viewBox,
33
+ _ref$color = _ref.color,
34
+ color = _ref$color === void 0 ? '#676464' : _ref$color,
37
35
  _ref$pointerEvents = _ref.pointerEvents,
38
36
  pointerEvents = _ref$pointerEvents === void 0 ? 'none' : _ref$pointerEvents,
39
37
  targetRef = _ref.targetRef,
40
38
  tooltip = _ref.tooltip;
41
- var isUsingColorStyle = colorStyle !== 'default';
42
- var colorFromProp = isUsingColorStyle || !color ? undefined : color;
43
39
  var refSvg = (0, _react.useRef)(null);
44
- var viewBoxFromIconOrSvgStrcut = name ? listIcon[name].viewbox : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.viewbox;
45
40
  var getPaths = function getPaths() {
46
41
  return name ? listIcon[name].paths : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.paths;
47
42
  };
@@ -49,7 +44,6 @@ var Icon = function Icon(_ref) {
49
44
  var _getPaths;
50
45
  return /*#__PURE__*/_react.default.createElement("svg", {
51
46
  "data-testid": "icon",
52
- "data-color-style": colorStyle,
53
47
  onClick: function onClick() {
54
48
  if (_onClick && !disabled) _onClick();
55
49
  },
@@ -58,8 +52,8 @@ var Icon = function Icon(_ref) {
58
52
  },
59
53
  width: "".concat(size, "px"),
60
54
  height: "".concat(size, "px"),
61
- fill: disabled ? disabledIconColor : colorFromProp,
62
- viewBox: viewBox || viewBoxFromIconOrSvgStrcut,
55
+ fill: disabled ? disabledIconColor : color,
56
+ viewBox: name ? listIcon[name].viewbox : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.viewbox,
63
57
  className: "icon-component ".concat(customClass),
64
58
  pointerEvents: pointerEvents,
65
59
  style: style
@@ -71,7 +65,6 @@ var Icon = function Icon(_ref) {
71
65
  });
72
66
  }));
73
67
  };
74
- if (color && colorStyle !== 'default') throw new Error('Expected only one of the two properties: colorStyle or color');
75
68
  if (!name && !svgStruct) throw new Error('One of the "name" and "svgStruct" props must be filled');
76
69
  if (!visible) return null;
77
70
  if (!tooltip) return getSvg();
@@ -3,7 +3,6 @@ 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';
7
6
  import './helper.js';
8
7
 
9
8
  type ListIconType = {
@@ -12,38 +11,26 @@ type ListIconType = {
12
11
  paths: Array<string>;
13
12
  };
14
13
  };
15
- type SvgStruct = {
16
- viewbox: string;
17
- paths: Array<string>;
18
- };
19
- type BaseIconProps = {
14
+ interface IIconProps {
20
15
  size?: SizePixels;
16
+ color?: string;
21
17
  customClass?: string;
22
18
  customClassForContainer?: string;
23
19
  style?: CSSProperties;
24
20
  visible?: boolean;
25
21
  disabled?: boolean;
26
22
  pointerEvents?: PointerEvents;
23
+ name?: IconNames;
27
24
  viewBox?: string;
25
+ svgStruct?: {
26
+ viewbox: string;
27
+ paths: Array<string>;
28
+ };
28
29
  onClick?: () => void;
29
30
  tooltipPosition?: Exclude<Position, 'center'>;
30
31
  tooltipWidth?: string | number;
31
32
  tooltip?: string;
32
33
  targetRef?: (ref: HTMLDivElement) => void;
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
- });
34
+ }
48
35
 
49
- export { IconProps, ListIconType };
36
+ export { IIconProps, ListIconType };
package/lib/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { default as List } from './list/index.js';
7
7
  export { default as Radio } from './radio/index.js';
8
8
  export { default as Tab } from './tabs/index.js';
9
9
  export { default as Dialog } from './dialog/base/index.js';
10
- import './types-fe4a1068.js';
10
+ import './types-c2a0f035.js';
11
11
  import 'react';
12
12
  import './@types/PermissionAttr.js';
13
13
  import './internals/colorStyles.js';
@@ -27,7 +27,6 @@ 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';
31
30
  import './list/Header.js';
32
31
  import './list/types.js';
33
32
  import './list/Item.js';
@@ -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;
@@ -1,9 +1,9 @@
1
1
  import { IBaseNumberProps } from './types.js';
2
- import '../../@types/PermissionAttr.js';
3
2
  import '../base/types.js';
4
3
  import 'react';
5
4
  import '../../@types/Align.js';
6
5
  import '../../@types/Period.js';
6
+ import '../../@types/PermissionAttr.js';
7
7
  import '../types.js';
8
8
  import '../../@types/DataCombo.js';
9
9
  import '../../drawer/types.js';
@@ -1,9 +1,9 @@
1
1
  import { ICurrencyProps } from './types.js';
2
- import '../../@types/PermissionAttr.js';
3
2
  import '../base/types.js';
4
3
  import 'react';
5
4
  import '../../@types/Align.js';
6
5
  import '../../@types/Period.js';
6
+ import '../../@types/PermissionAttr.js';
7
7
  import '../types.js';
8
8
  import '../../@types/DataCombo.js';
9
9
  import '../../drawer/types.js';
@@ -1,9 +1,9 @@
1
1
  import { IBaseNumberProps } from './types.js';
2
- import '../../@types/PermissionAttr.js';
3
2
  import '../base/types.js';
4
3
  import 'react';
5
4
  import '../../@types/Align.js';
6
5
  import '../../@types/Period.js';
6
+ import '../../@types/PermissionAttr.js';
7
7
  import '../types.js';
8
8
  import '../../@types/DataCombo.js';
9
9
  import '../../drawer/types.js';
@@ -1,11 +1,11 @@
1
1
  export { default as CurrencyField } from './Currency.js';
2
2
  export { default as DecimalField } from './Decimal.js';
3
3
  import { INumberFieldProps } from './types.js';
4
- import '../../@types/PermissionAttr.js';
5
4
  import '../base/types.js';
6
5
  import 'react';
7
6
  import '../../@types/Align.js';
8
7
  import '../../@types/Period.js';
8
+ import '../../@types/PermissionAttr.js';
9
9
  import '../types.js';
10
10
  import '../../@types/DataCombo.js';
11
11
  import '../../drawer/types.js';
@@ -1,5 +1,6 @@
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
  });
@@ -16,27 +17,52 @@ Object.defineProperty(exports, "DecimalField", {
16
17
  }
17
18
  });
18
19
  exports.default = void 0;
19
- var _react = _interopRequireDefault(require("react"));
20
- var _BaseMask = _interopRequireDefault(require("../mask/BaseMask"));
20
+ var _react = _interopRequireWildcard(require("react"));
21
21
  var _Currency = _interopRequireDefault(require("./Currency"));
22
22
  var _Decimal = _interopRequireDefault(require("./Decimal"));
23
23
  require("../../assets/styles/numbers.scss");
24
- var _format_number = require("./format_number");
24
+ var _InputTextBase = _interopRequireDefault(require("../base/InputTextBase"));
25
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
+ 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); }
27
+ 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; }
26
28
  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); }
29
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
30
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
32
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
33
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
34
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
35
  var NumberField = function NumberField(props) {
28
36
  var _props$textAlign = props.textAlign,
29
37
  textAlign = _props$textAlign === void 0 ? 'left' : _props$textAlign,
38
+ min = props.min,
39
+ max = props.max,
30
40
  _props$value = props.value,
31
41
  value = _props$value === void 0 ? '' : _props$value;
32
- return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({
33
- value: typeof value === 'number' ? (0, _format_number.numberToPtBR)(value) : value,
42
+ var _useState = (0, _react.useState)(value.toString()),
43
+ _useState2 = _slicedToArray(_useState, 2),
44
+ numberValue = _useState2[0],
45
+ setNumberValue = _useState2[1];
46
+ var onChange = function onChange(event) {
47
+ if (event) {
48
+ var inputValue = event.target.value;
49
+ var numericValue = inputValue.replace(/\D/g, '');
50
+ if (min && parseInt(numericValue, 10) < min || max && parseInt(numericValue, 10) > max) {
51
+ return;
52
+ }
53
+ if (props.onChange) props.onChange(event);
54
+ setNumberValue(numericValue);
55
+ }
56
+ };
57
+ (0, _react.useEffect)(function () {
58
+ if (value !== numberValue) setNumberValue(value.toString());
59
+ }, [value]);
60
+ return /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
61
+ value: numberValue,
34
62
  textAlign: textAlign,
35
- mask: Number,
36
- isNumeric: true,
37
- scale: 0,
38
- padFractionalZeros: false
39
- }, props));
63
+ onChange: onChange,
64
+ type: "number"
65
+ }));
40
66
  };
41
67
  var _default = NumberField;
42
68
  exports.default = _default;
@@ -1,9 +1,9 @@
1
- import { PermissionAttr } from '../../@types/PermissionAttr.js';
2
1
  import { CustomInputEvent } from '../base/types.js';
3
2
  import { IMaskHOCProps } from '../types.js';
4
3
  import 'react';
5
4
  import '../../@types/Align.js';
6
5
  import '../../@types/Period.js';
6
+ import '../../@types/PermissionAttr.js';
7
7
  import '../../@types/DataCombo.js';
8
8
  import '../../drawer/types.js';
9
9
  import '../../@types/Position.js';
@@ -11,24 +11,23 @@ import '../../@types/Icon.js';
11
11
  import '../../icons/helper.js';
12
12
 
13
13
  interface INumberFieldProps extends IMaskHOCProps {
14
- value?: string;
15
- permissionAttr?: PermissionAttr;
16
- disabled?: boolean;
14
+ onChange?: (e?: CustomInputEvent) => void;
15
+ }
16
+ interface IBaseNumberProps extends IMaskHOCProps {
17
+ returnFormattedValueOnBlur?: boolean;
18
+ returnFormattedValueOnKeyDown?: boolean;
17
19
  onChange?: (e?: CustomInputEvent, maskValue?: string, date?: string | {
18
20
  initial: string;
19
21
  final: string;
20
22
  }) => void;
21
23
  }
22
- interface IBaseNumberProps extends INumberFieldProps {
23
- value?: string;
24
- leftElements?: JSX.Element | JSX.Element[];
25
- onBlur?: (e: CustomInputEvent) => void;
26
- returnFormattedValueOnBlur?: boolean;
27
- returnFormattedValueOnKeyDown?: boolean;
28
- }
29
- interface ICurrencyProps extends INumberFieldProps {
24
+ interface ICurrencyProps extends IMaskHOCProps {
30
25
  currencySymbol?: string;
31
26
  displayCurrencySymbol?: boolean;
27
+ onChange?: (e?: CustomInputEvent, maskValue?: string, date?: string | {
28
+ initial: string;
29
+ final: string;
30
+ }) => void;
32
31
  }
33
32
 
34
33
  export { IBaseNumberProps, ICurrencyProps, INumberFieldProps };
@@ -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', 'actionbutton'];
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,19 +123,26 @@ 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) {
132
+ var _dropdownRef$current;
127
133
  if (select === null) return;
128
134
  var currentsSelect = [].concat(_toConsumableArray(currents), [select]);
129
135
  setCurrents(currentsSelect);
130
136
  setDataCombo(dataSource);
131
137
  setInputValue([]);
132
- setOpened(false);
133
138
  if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(function (i) {
134
139
  return i[idKey];
135
140
  })));
141
+ (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.focus();
136
142
  };
137
143
  var onUnselect = function onUnselect(id) {
138
144
  if (currents) {
145
+ var _dropdownRef$current2;
139
146
  var result = currents.filter(function (item) {
140
147
  return item[idKey] !== id;
141
148
  });
@@ -143,41 +150,43 @@ var MultipleSelect = function MultipleSelect(props) {
143
150
  if (props.onSelect) setSelected(props.onSelect(result.map(function (i) {
144
151
  return i[idKey];
145
152
  })));
153
+ (_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : _dropdownRef$current2.focus();
146
154
  }
147
155
  };
148
156
  var onOpenClose = function onOpenClose() {
149
157
  setOpened(!opened);
150
158
  if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
151
159
  };
152
- var _onFocus = function onFocus() {
153
- var dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : dropdownWidth;
154
- setOpened(true);
155
- setDropdownWidth(dropdownWidthFocus);
156
- };
157
160
  var _onBlur = function onBlur(e) {
158
161
  if (props.onBlur) props.onBlur(e);
159
162
  if (!insideComponent) setOpened(false);
160
163
  };
161
164
  var onInputKeyDown = function onInputKeyDown(e) {
162
165
  if (e.keyCode) {
163
- if (e.keyCode === constants.keyCodes.ENTER && selected) {
164
- if (!currents.includes(selected)) onSelect(selected);
166
+ if (e.keyCode === constants.keyCodes.ENTER && selected && opened) {
167
+ if (!currents.some(function (current) {
168
+ return current[idKey] === selected[idKey];
169
+ })) {
170
+ var _e$preventDefault;
171
+ (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
172
+ onSelect(selected);
173
+ }
165
174
  } else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
166
175
  if (!opened) setOpened(true);
167
- var index = dataSource ? dataSource.findIndex(function (d) {
176
+ var index = dataCombo ? dataCombo.findIndex(function (d) {
168
177
  return d === selected;
169
178
  }) : 0;
170
179
  if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
171
- index = dataSource && index === dataSource.length - 1 ? 0 : index + 1;
180
+ index = dataCombo && index === dataCombo.length - 1 ? 0 : index + 1;
172
181
  } else {
173
- index = dataSource && index === 0 ? dataSource.length - 1 : index - 1;
182
+ index = dataCombo && index === 0 ? dataCombo.length - 1 : index - 1;
174
183
  }
175
- if (dataSource && dataSource.length) {
176
- if (descriptionKeyIsString && dataSource[index][descriptionKey]) {
177
- setInputValue(dataSource[index][descriptionKey]);
178
- } else if (!descriptionKeyIsString) setInputValue([descriptionKey(dataSource[index])]);
184
+ if (dataCombo && dataCombo.length) {
185
+ if (descriptionKeyIsString && dataCombo[index][descriptionKey]) {
186
+ setInputValue(dataCombo[index][descriptionKey]);
187
+ } else if (!descriptionKeyIsString) setInputValue([descriptionKey(dataCombo[index])]);
179
188
  }
180
- if (dataSource) setSelected(dataSource[index]);
189
+ if (dataCombo) setSelected(dataCombo[index]);
181
190
  } else if (e.keyCode === constants.keyCodes.BACKSPACE) {
182
191
  if (inputValue.length === 0) {
183
192
  var currentsKeyDown = _lodash.default.dropRight(currents);
@@ -186,6 +195,8 @@ var MultipleSelect = function MultipleSelect(props) {
186
195
  return i[idKey];
187
196
  }));
188
197
  }
198
+ } else if (e.keyCode === constants.keyCodes.TAB) {
199
+ setOpened(false);
189
200
  }
190
201
  }
191
202
  };
@@ -252,6 +263,8 @@ var MultipleSelect = function MultipleSelect(props) {
252
263
  onChange: function onChange(e) {
253
264
  if (e) onFilter(e.target.value);
254
265
  },
266
+ onClick: _onFocus,
267
+ inputRef: dropdownRef,
255
268
  onKeyDown: onInputKeyDown,
256
269
  customClassForWrapper: "selectwrapper ".concat((props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'),
257
270
  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);
@@ -188,7 +190,7 @@ var SimpleSelect = function SimpleSelect(props) {
188
190
  };
189
191
  var onInputKeyDown = function onInputKeyDown(e) {
190
192
  if (e.keyCode) {
191
- if (e.keyCode === constants.keyCodes.ENTER && selected) {
193
+ if (e.keyCode === constants.keyCodes.ENTER && selected && opened) {
192
194
  var _e$preventDefault;
193
195
  (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
194
196
  onSelect(selected);
@@ -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;
@@ -111,6 +111,7 @@ interface IDropdownSelectProps {
111
111
  handleOnKeydown: (e: CustomInputEvent | KeyboardEvent) => void;
112
112
  handleOnBlur: (item: DataCombo) => void;
113
113
  handleOnFocus: () => void;
114
+ handlerSelecionadoAgora?: (bool: boolean) => void;
114
115
  opened: boolean;
115
116
  dropdownRef: MutableRefObject<HTMLDivElement | null>;
116
117
  dataCombo: DataCombo[];
@@ -19,7 +19,7 @@ interface IFloatMenuItemProps {
19
19
  title?: string;
20
20
  url?: string;
21
21
  urlHref?: string;
22
- iconName: IconNames;
22
+ iconName?: IconNames;
23
23
  iconColor?: string;
24
24
  iconSize?: SizePixels;
25
25
  customClass?: string;
@@ -60,7 +60,7 @@ interface INavSubMenuItemProps {
60
60
  interface IExpandMenuProps {
61
61
  expandMenuCustomClass?: string;
62
62
  onExpandMenu?: () => void;
63
- iconName: IconNames;
63
+ iconName?: IconNames;
64
64
  }
65
65
  interface IEmptyListProps {
66
66
  info?: string;
@@ -1,4 +1,4 @@
1
- import { a as IPanelContentProps } from '../types-fe4a1068.js';
1
+ import { a as IPanelContentProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -13,6 +13,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
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
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
15
  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); }
16
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
17
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
18
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
16
19
  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; }
17
20
  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; }
18
21
  var PanelContent = function PanelContent(_ref) {
@@ -26,35 +29,59 @@ var PanelContent = function PanelContent(_ref) {
26
29
  onEndReachedThreshold = _useContext$onEndReac === void 0 ? 0.1 : _useContext$onEndReac,
27
30
  hideContent = _useContext.hideContent;
28
31
  var rootElementRef = (0, _react.useRef)(null);
29
- var enableOnEndReached = (0, _react.useRef)(true);
30
32
  var lastScrollHeight = (0, _react.useRef)(0);
31
- var onScrollEndReached = (0, _react.useCallback)(function () {
32
- var element = rootElementRef.current;
33
- if (element && onEndReached) {
34
- var scrollTop = element.scrollTop,
35
- scrollHeight = element.scrollHeight,
36
- clientHeight = element.clientHeight;
37
- var scrollOffset = scrollHeight - clientHeight - scrollTop - 1;
38
- var threshold = (0, _helpers.getCurrentThreshold)(element, onEndReachedThreshold);
39
- if (scrollOffset <= threshold && enableOnEndReached.current) {
40
- onEndReached();
41
- lastScrollHeight.current = scrollHeight;
42
- if (lastScrollHeight.current === scrollHeight) enableOnEndReached.current = false;
43
- } else if (scrollOffset > threshold && !enableOnEndReached.current) {
44
- enableOnEndReached.current = true;
33
+ var enableOnEndReached = (0, _react.useRef)(true);
34
+ var onScrollEndReached = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
35
+ var element, scrollTop, scrollHeight, clientHeight, scrollOffset, threshold;
36
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
37
+ while (1) switch (_context.prev = _context.next) {
38
+ case 0:
39
+ element = rootElementRef.current;
40
+ if (!(element && onEndReached)) {
41
+ _context.next = 10;
42
+ break;
43
+ }
44
+ scrollTop = element.scrollTop, scrollHeight = element.scrollHeight, clientHeight = element.clientHeight;
45
+ scrollOffset = scrollHeight - clientHeight - scrollTop - 1;
46
+ threshold = (0, _helpers.getCurrentThreshold)(element, onEndReachedThreshold);
47
+ if (!(scrollOffset <= threshold && enableOnEndReached.current)) {
48
+ _context.next = 10;
49
+ break;
50
+ }
51
+ enableOnEndReached.current = false;
52
+ _context.next = 9;
53
+ return new Promise(function (resolve) {
54
+ resolve(onEndReached());
55
+ });
56
+ case 9:
57
+ lastScrollHeight.current = scrollHeight;
58
+ case 10:
59
+ case "end":
60
+ return _context.stop();
45
61
  }
46
- }
47
- }, [onEndReached, onEndReachedThreshold, enableOnEndReached.current, rootElementRef.current, lastScrollHeight.current]);
62
+ }, _callee);
63
+ })), [onEndReached, onEndReachedThreshold, rootElementRef.current, lastScrollHeight.current]);
48
64
  (0, _react.useEffect)(function () {
49
- if (onEndReached) {
50
- var _rootElementRef$curre, _rootElementRef$curre2;
51
- (_rootElementRef$curre = rootElementRef.current) === null || _rootElementRef$curre === void 0 ? void 0 : _rootElementRef$curre.addEventListener('scroll', onScrollEndReached);
52
- (_rootElementRef$curre2 = rootElementRef.current) === null || _rootElementRef$curre2 === void 0 ? void 0 : _rootElementRef$curre2.addEventListener('resize', onScrollEndReached);
65
+ var observer;
66
+ if (rootElementRef.current && onEndReached) {
67
+ observer = new ResizeObserver(function () {
68
+ var _ref3 = rootElementRef.current,
69
+ scrollHeight = _ref3.scrollHeight;
70
+ if (scrollHeight !== lastScrollHeight.current) {
71
+ var _observer;
72
+ enableOnEndReached.current = true;
73
+ (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.disconnect();
74
+ }
75
+ });
76
+ observer.observe(rootElementRef.current);
77
+ rootElementRef.current.addEventListener('scroll', onScrollEndReached);
78
+ rootElementRef.current.addEventListener('resize', onScrollEndReached);
53
79
  }
54
80
  return function () {
55
- var _rootElementRef$curre3, _rootElementRef$curre4;
56
- (_rootElementRef$curre3 = rootElementRef.current) === null || _rootElementRef$curre3 === void 0 ? void 0 : _rootElementRef$curre3.removeEventListener('scroll', onScrollEndReached);
57
- (_rootElementRef$curre4 = rootElementRef.current) === null || _rootElementRef$curre4 === void 0 ? void 0 : _rootElementRef$curre4.removeEventListener('resize', onScrollEndReached);
81
+ var _rootElementRef$curre, _rootElementRef$curre2, _observer2;
82
+ (_rootElementRef$curre = rootElementRef.current) === null || _rootElementRef$curre === void 0 ? void 0 : _rootElementRef$curre.removeEventListener('scroll', onScrollEndReached);
83
+ (_rootElementRef$curre2 = rootElementRef.current) === null || _rootElementRef$curre2 === void 0 ? void 0 : _rootElementRef$curre2.removeEventListener('resize', onScrollEndReached);
84
+ (_observer2 = observer) === null || _observer2 === void 0 ? void 0 : _observer2.disconnect();
58
85
  };
59
86
  }, [onScrollEndReached]);
60
87
  if (!opened) return null;
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-fe4a1068.js';
1
+ import { I as IPanelProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-fe4a1068.js';
1
+ import { I as IPanelProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { b as IPanelHeaderProps } from '../types-fe4a1068.js';
1
+ import { b as IPanelHeaderProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-fe4a1068.js';
1
+ import { I as IPanelProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-fe4a1068.js';
1
+ import { I as IPanelProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-fe4a1068.js';
1
+ import { I as IPanelProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-fe4a1068.js';
1
+ import { I as IPanelProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-fe4a1068.js';
1
+ import { I as IPanelProps } from '../types-c2a0f035.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { P as default, g as getCurrentThreshold, n as numberAroundZeroAndOne } from '../types-fe4a1068.js';
2
+ export { P as default, g as getCurrentThreshold, n as numberAroundZeroAndOne } from '../types-c2a0f035.js';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
5
5
  import '../@types/Icon.js';
@@ -20,15 +20,17 @@ function numberAroundZeroAndOne(_ref) {
20
20
  }
21
21
  return null;
22
22
  }
23
- function getCurrentThreshold(element, threshold) {
24
- if (threshold > 1) return 1;
25
- if (threshold < 0) return 0;
26
- var scrollHeight = element.scrollHeight,
27
- clientHeight = element.clientHeight;
23
+ function getCurrentThreshold(scrollableElement, scrollThreshold) {
24
+ var MIN_THRESHOLD = 0;
25
+ var MAX_THRESHOLD = 1;
26
+ if (scrollThreshold < MIN_THRESHOLD) return MIN_THRESHOLD;
27
+ if (scrollThreshold > MAX_THRESHOLD) return MAX_THRESHOLD;
28
+ var scrollHeight = scrollableElement.scrollHeight,
29
+ clientHeight = scrollableElement.clientHeight;
28
30
  var offsetHeight = scrollHeight - clientHeight;
29
- var scrollThreshold = Math.round(scrollHeight * threshold);
31
+ var calculatedScrollThreshold = Math.round(scrollHeight * scrollThreshold);
30
32
  var maxScrollThreshold = Math.round(offsetHeight - offsetHeight * 0.3);
31
- return Math.min(scrollThreshold, maxScrollThreshold);
33
+ return Math.min(calculatedScrollThreshold, maxScrollThreshold);
32
34
  }
33
35
  var PanelContext = /*#__PURE__*/_react.default.createContext({});
34
36
  var _default = PanelContext;
@@ -6,7 +6,7 @@ export { default as SuccessPanel } from './SuccessPanel.js';
6
6
  export { default as InfoPanel } from './InfoPanel.js';
7
7
  export { default as PanelHeader } from './Header.js';
8
8
  export { default as PanelContent } from './Content.js';
9
- import '../types-fe4a1068.js';
9
+ import '../types-c2a0f035.js';
10
10
  import 'react';
11
11
  import '../@types/PermissionAttr.js';
12
12
  import '../internals/colorStyles.js';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { C as ContextProps, a as IPanelContentProps, b as IPanelHeaderProps, I as IPanelProps, c as IParameterFunction } from '../types-fe4a1068.js';
2
+ export { A as AsyncFunc, C as ContextProps, F as Func, a as IPanelContentProps, b as IPanelHeaderProps, I as IPanelProps, c as IParameterFunction } from '../types-c2a0f035.js';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
5
5
  import '../@types/Icon.js';
@@ -4,9 +4,11 @@ import ColorStyles from './internals/colorStyles.js';
4
4
  import { IconNames } from './@types/Icon.js';
5
5
 
6
6
  declare function numberAroundZeroAndOne({ props, propName, componentName }: IParameterFunction): number | Error | null;
7
- declare function getCurrentThreshold(element: HTMLDivElement, threshold: number): number;
7
+ declare function getCurrentThreshold(scrollableElement: HTMLDivElement, scrollThreshold: number): number;
8
8
  declare const PanelContext: React__default.Context<ContextProps>;
9
9
 
10
+ type Func = () => void;
11
+ type AsyncFunc = () => Promise<void>;
10
12
  interface IPanelProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className'> {
11
13
  customClass?: string;
12
14
  startOpened?: boolean;
@@ -15,7 +17,7 @@ interface IPanelProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className'>
15
17
  colorStyle?: typeof ColorStyles | string;
16
18
  gridCols?: string;
17
19
  title?: string;
18
- onEndReached?: () => void;
20
+ onEndReached?: Func | AsyncFunc;
19
21
  onEndReachedThreshold?: typeof numberAroundZeroAndOne | number;
20
22
  permissionAttr?: PermissionAttr | PermissionAttr[];
21
23
  }
@@ -36,7 +38,7 @@ type ContextProps = {
36
38
  handlerToggleable: () => void;
37
39
  opened: boolean;
38
40
  hideContent: boolean;
39
- onEndReached?: () => void;
41
+ onEndReached?: Func | AsyncFunc;
40
42
  onEndReachedThreshold: number;
41
43
  };
42
44
  interface IParameterFunction {
@@ -45,4 +47,4 @@ interface IParameterFunction {
45
47
  componentName: string;
46
48
  }
47
49
 
48
- export { ContextProps as C, IPanelProps as I, PanelContext as P, IPanelContentProps as a, IPanelHeaderProps as b, IParameterFunction as c, getCurrentThreshold as g, numberAroundZeroAndOne as n };
50
+ export { AsyncFunc as A, ContextProps as C, Func as F, IPanelProps as I, PanelContext as P, IPanelContentProps as a, IPanelHeaderProps as b, IParameterFunction as c, getCurrentThreshold as g, numberAroundZeroAndOne as n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.0.16-beta.1",
3
+ "version": "1.0.17-beta.0",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",
@@ -1,9 +0,0 @@
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,8 +0,0 @@
1
- import React__default from 'react';
2
-
3
- interface TextContentProps extends React__default.HTMLAttributes<HTMLElement> {
4
- as?: 'span' | 'strong' | 'p';
5
- }
6
- declare const TextContent: React__default.ForwardRefExoticComponent<TextContentProps & React__default.RefAttributes<HTMLElement>>;
7
-
8
- export { TextContent as default };
@@ -1,30 +0,0 @@
1
- "use strict";
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
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
9
- require("../assets/styles/textContent.scss");
10
- var _excluded = ["as", "children", "className"];
11
- 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); }
12
- 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; }
13
- 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); }
14
- 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; }
15
- 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; }
16
- var TextContent = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
17
- var _ref$as = _ref.as,
18
- Comp = _ref$as === void 0 ? 'span' : _ref$as,
19
- children = _ref.children,
20
- className = _ref.className,
21
- props = _objectWithoutProperties(_ref, _excluded);
22
- var typedRef = ref;
23
- return /*#__PURE__*/_react.default.createElement(Comp, _extends({
24
- ref: typedRef,
25
- className: "text-content-component ".concat(className),
26
- "data-textcontent": Comp
27
- }, props), children);
28
- });
29
- var _default = TextContent;
30
- exports.default = _default;