linear-react-components-ui 1.1.2-beta.9 → 1.1.3-beta.1

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 (153) hide show
  1. package/.gitlab-ci.yml +1 -0
  2. package/.vscode/settings.json +10 -1
  3. package/lib/@types/SizePixels.d.ts +1 -1
  4. package/lib/assets/styles/button.scss +11 -9
  5. package/lib/assets/styles/checkbox.scss +45 -38
  6. package/lib/assets/styles/colors.scss +3 -1
  7. package/lib/assets/styles/commons.scss +1 -0
  8. package/lib/assets/styles/dialog.scss +27 -10
  9. package/lib/assets/styles/error.scss +9 -0
  10. package/lib/assets/styles/fieldset.scss +3 -0
  11. package/lib/assets/styles/gridlayout.scss +0 -2
  12. package/lib/assets/styles/hint.scss +21 -0
  13. package/lib/assets/styles/icon.scss +4 -31
  14. package/lib/assets/styles/input.scss +7 -7
  15. package/lib/assets/styles/multiSelect.scss +6 -1
  16. package/lib/assets/styles/radio.scss +37 -35
  17. package/lib/assets/styles/select.scss +13 -7
  18. package/lib/assets/styles/table.scss +2 -1
  19. package/lib/assets/styles/tabs.scss +3 -0
  20. package/lib/buttons/DefaultButton.js +30 -11
  21. package/lib/buttons/types.d.ts +1 -0
  22. package/lib/checkbox/Label.js +13 -4
  23. package/lib/checkbox/index.d.ts +2 -2
  24. package/lib/checkbox/index.js +23 -18
  25. package/lib/checkbox/types.d.ts +2 -1
  26. package/lib/dialog/base/Content.js +1 -0
  27. package/lib/dialog/base/Header.js +4 -4
  28. package/lib/dialog/base/index.js +9 -6
  29. package/lib/drawer/Drawer.js +5 -4
  30. package/lib/drawer/Header.js +1 -1
  31. package/lib/dropdown/Popup.d.ts +1 -1
  32. package/lib/dropdown/Popup.js +5 -2
  33. package/lib/dropdown/types.d.ts +1 -0
  34. package/lib/fieldset/index.js +4 -2
  35. package/lib/fieldset/types.d.ts +2 -0
  36. package/lib/form/Field.d.ts +2 -0
  37. package/lib/form/FieldArray.d.ts +2 -0
  38. package/lib/form/FieldArray.js +12 -26
  39. package/lib/form/FieldNumber.d.ts +2 -0
  40. package/lib/form/FieldPeriod.d.ts +2 -0
  41. package/lib/form/helpers.d.ts +2 -0
  42. package/lib/form/index.d.ts +2 -0
  43. package/lib/form/index.js +6 -7
  44. package/lib/form/types.d.ts +5 -2
  45. package/lib/form/withFieldHOC.d.ts +2 -0
  46. package/lib/form/withFormSecurity.d.ts +2 -0
  47. package/lib/gridlayout/GridRow.js +10 -2
  48. package/lib/gridlayout/types.d.ts +1 -1
  49. package/lib/hint/helpers.d.ts +3 -0
  50. package/lib/hint/helpers.js +21 -0
  51. package/lib/hint/index.d.ts +2 -1
  52. package/lib/hint/index.js +9 -15
  53. package/lib/hint/types.d.ts +3 -0
  54. package/lib/icons/helper.d.ts +4 -0
  55. package/lib/icons/helper.js +5 -1
  56. package/lib/icons/index.d.ts +2 -3
  57. package/lib/icons/index.js +3 -10
  58. package/lib/icons/types.d.ts +9 -22
  59. package/lib/index.d.ts +0 -1
  60. package/lib/inputs/base/InputTextBase.d.ts +2 -0
  61. package/lib/inputs/base/InputTextBase.js +54 -8
  62. package/lib/inputs/base/Label.d.ts +14 -0
  63. package/lib/inputs/base/Label.js +35 -0
  64. package/lib/inputs/base/helpers.d.ts +3 -2
  65. package/lib/inputs/base/helpers.js +1 -8
  66. package/lib/inputs/base/types.d.ts +15 -2
  67. package/lib/inputs/date/Dialog.d.ts +2 -0
  68. package/lib/inputs/date/Dropdown.d.ts +2 -0
  69. package/lib/inputs/date/helpers.d.ts +2 -0
  70. package/lib/inputs/date/index.d.ts +2 -0
  71. package/lib/inputs/date/index.js +2 -0
  72. package/lib/inputs/date/types.d.ts +3 -0
  73. package/lib/inputs/errorMessage/index.d.ts +17 -0
  74. package/lib/inputs/errorMessage/index.js +26 -0
  75. package/lib/inputs/file/DefaultFile.d.ts +2 -0
  76. package/lib/inputs/file/DefaultFile.js +4 -2
  77. package/lib/inputs/file/DragDropFile.d.ts +2 -0
  78. package/lib/inputs/file/DragDropFile.js +4 -2
  79. package/lib/inputs/file/File.d.ts +2 -0
  80. package/lib/inputs/file/FileButtonSettings.d.ts +2 -0
  81. package/lib/inputs/file/helpers.d.ts +2 -0
  82. package/lib/inputs/file/index.d.ts +2 -0
  83. package/lib/inputs/file/types.d.ts +2 -0
  84. package/lib/inputs/inputHOC.d.ts +3 -1
  85. package/lib/inputs/mask/BaseMask.d.ts +3 -0
  86. package/lib/inputs/mask/Cnpj.d.ts +3 -0
  87. package/lib/inputs/mask/Cpf.d.ts +3 -0
  88. package/lib/inputs/mask/Cpf.js +0 -1
  89. package/lib/inputs/mask/Phone.d.ts +3 -0
  90. package/lib/inputs/mask/ZipCode.d.ts +3 -0
  91. package/lib/inputs/mask/helpers.d.ts +2 -1
  92. package/lib/inputs/mask/imaskHOC.d.ts +3 -1
  93. package/lib/inputs/mask/index.d.ts +3 -0
  94. package/lib/inputs/mask/types.d.ts +5 -1
  95. package/lib/inputs/multiSelect/ActionButtons.d.ts +2 -0
  96. package/lib/inputs/multiSelect/ActionButtons.js +10 -8
  97. package/lib/inputs/multiSelect/Dropdown.d.ts +2 -0
  98. package/lib/inputs/multiSelect/Dropdown.js +2 -6
  99. package/lib/inputs/multiSelect/helper.d.ts +2 -0
  100. package/lib/inputs/multiSelect/index.d.ts +2 -0
  101. package/lib/inputs/multiSelect/types.d.ts +2 -0
  102. package/lib/inputs/number/BaseNumber.d.ts +3 -1
  103. package/lib/inputs/number/Currency.d.ts +3 -1
  104. package/lib/inputs/number/Decimal.d.ts +3 -1
  105. package/lib/inputs/number/index.d.ts +3 -1
  106. package/lib/inputs/number/types.d.ts +3 -1
  107. package/lib/inputs/period/Dialog.d.ts +2 -0
  108. package/lib/inputs/period/Dropdown.d.ts +2 -0
  109. package/lib/inputs/period/PeriodList.d.ts +2 -0
  110. package/lib/inputs/period/helper.d.ts +2 -0
  111. package/lib/inputs/period/index.d.ts +2 -0
  112. package/lib/inputs/period/index.js +4 -1
  113. package/lib/inputs/period/types.d.ts +2 -0
  114. package/lib/inputs/search/index.d.ts +3 -1
  115. package/lib/inputs/select/ActionButtons.d.ts +3 -1
  116. package/lib/inputs/select/ActionButtons.js +18 -27
  117. package/lib/inputs/select/Dropdown.d.ts +3 -1
  118. package/lib/inputs/select/Dropdown.js +2 -6
  119. package/lib/inputs/select/helper.d.ts +3 -1
  120. package/lib/inputs/select/index.d.ts +2 -0
  121. package/lib/inputs/select/multiple/Selecteds.d.ts +3 -1
  122. package/lib/inputs/select/multiple/Selecteds.js +3 -5
  123. package/lib/inputs/select/multiple/index.d.ts +2 -0
  124. package/lib/inputs/select/multiple/index.js +38 -19
  125. package/lib/inputs/select/simple/index.d.ts +2 -0
  126. package/lib/inputs/select/simple/index.js +60 -31
  127. package/lib/inputs/select/types.d.ts +5 -2
  128. package/lib/inputs/textarea/index.d.ts +2 -0
  129. package/lib/inputs/textarea/types.d.ts +2 -0
  130. package/lib/inputs/types.d.ts +12 -5
  131. package/lib/internals/types.d.ts +5 -2
  132. package/lib/internals/withTooltip.d.ts +3 -2
  133. package/lib/internals/withTooltip.js +25 -10
  134. package/lib/list/Item.js +19 -6
  135. package/lib/menus/float/types.d.ts +1 -1
  136. package/lib/menus/sidenav/popup_menu_search/index.js +4 -3
  137. package/lib/menus/sidenav/types.d.ts +1 -1
  138. package/lib/table/HeaderColumn.d.ts +1 -1
  139. package/lib/table/HeaderColumn.js +5 -1
  140. package/lib/table/RowColumn.js +6 -8
  141. package/lib/table/types.d.ts +2 -0
  142. package/lib/tabs/context.js +1 -1
  143. package/lib/tabs/types.d.ts +3 -3
  144. package/lib/toolbar/types.d.ts +1 -0
  145. package/lib/uitour/index.d.ts +2 -1
  146. package/lib/uitour/index.js +57 -4
  147. package/lib/uitour/types.d.ts +9 -1
  148. package/package.json +4 -4
  149. package/.tool-versions +0 -1
  150. package/lib/assets/styles/textContent.scss +0 -9
  151. package/lib/menus/sidenav/popup_menu_help/index.js +0 -78
  152. package/lib/textContent/index.d.ts +0 -8
  153. package/lib/textContent/index.js +0 -30
@@ -1,10 +1,12 @@
1
1
  import { ReactNode, MouseEvent, MutableRefObject, CSSProperties, KeyboardEvent, ReactElement } from 'react';
2
+ import IMask from 'imask';
2
3
  import { PermissionAttr, OnDenied } from '../@types/PermissionAttr.js';
3
4
  import { DataCombo } from '../@types/DataCombo.js';
4
5
  import { IBaseProps, CustomInputEvent } from './base/types.js';
5
6
  import { IDrawerProps } from '../drawer/types.js';
6
7
  import { TextAlign } from '../@types/Align.js';
7
8
  import '../@types/Period.js';
9
+ import '../internals/types.js';
8
10
  import '../@types/Position.js';
9
11
  import '../@types/Icon.js';
10
12
  import '../icons/helper.js';
@@ -62,7 +64,7 @@ interface IMaskHOCProps {
62
64
  inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
63
65
  placeholderChar?: string;
64
66
  lazy?: boolean;
65
- definitions?: object;
67
+ definitions?: IMask.AllMaskedOptions['definitions'];
66
68
  groups?: object;
67
69
  pattern?: string;
68
70
  format?: () => void;
@@ -97,7 +99,7 @@ interface IMaskHOCProps {
97
99
  rounded?: boolean;
98
100
  errorMessages?: string[];
99
101
  skeletonize?: boolean;
100
- mask?: string | NumberConstructor;
102
+ mask?: IMask.AnyMask;
101
103
  isDateField?: boolean;
102
104
  autoCompleteMask?: 'left' | 'right';
103
105
  }
@@ -133,8 +135,8 @@ interface IDropdownSelectProps {
133
135
  align?: 'left' | 'right';
134
136
  }
135
137
  interface IActionButtonsSelectProps {
136
- handleClear: () => void;
137
- handleOpenClose: () => void;
138
+ handlerClear: () => void;
139
+ handlerOpenClose: () => void;
138
140
  dropDownOpened: boolean;
139
141
  showClearButton?: boolean;
140
142
  disabled?: boolean;
@@ -149,5 +151,10 @@ interface IButtonsProps {
149
151
  transparent: boolean;
150
152
  disabled?: boolean;
151
153
  }
154
+ interface ErrorProps {
155
+ customClass?: string;
156
+ style?: React.CSSProperties;
157
+ messages?: string | string[];
158
+ }
152
159
 
153
- export type { IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
160
+ export type { ErrorProps, IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
@@ -8,9 +8,12 @@ interface WithTooltipProps {
8
8
  tooltip?: string;
9
9
  tooltipPosition?: Exclude<Position, 'center'>;
10
10
  style?: CSSProperties;
11
- handlerSetOnDenied?: (onDeniedValue: OnDenied) => void;
11
+ handlerSetOnDeniedText?: (onDeniedValue: OnDenied) => void;
12
12
  errorMessage?: string;
13
13
  }
14
+ interface ITooltipContext {
15
+ handlerSetOnDeniedText: (text: string) => void;
16
+ }
14
17
  interface GetDisplayNameParams {
15
18
  displayName?: string;
16
19
  name?: string;
@@ -19,4 +22,4 @@ interface HasToolTipParams {
19
22
  tooltip?: string;
20
23
  }
21
24
 
22
- export type { GetDisplayNameParams, HasToolTipParams, WithTooltipProps };
25
+ export type { GetDisplayNameParams, HasToolTipParams, ITooltipContext, WithTooltipProps };
@@ -1,11 +1,12 @@
1
1
  import React__default from 'react';
2
- import { WithTooltipProps } from './types.js';
2
+ import { ITooltipContext, WithTooltipProps } from './types.js';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../@types/Position.js';
5
5
 
6
+ declare const TooltipContext: React__default.Context<ITooltipContext>;
6
7
  declare const withTooltip: <ComponentProps extends WithTooltipProps>(WrappedComponent: React__default.ComponentType<ComponentProps>) => {
7
8
  (props: ComponentProps): JSX.Element;
8
9
  displayName: string;
9
10
  };
10
11
 
11
- export { withTooltip as default };
12
+ export { TooltipContext, withTooltip as default };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.TooltipContext = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _tooltip = _interopRequireDefault(require("../tooltip"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -17,6 +17,7 @@ const hasTooltip = _ref => {
17
17
  } = _ref;
18
18
  return tooltip;
19
19
  };
20
+ const TooltipContext = exports.TooltipContext = /*#__PURE__*/_react.default.createContext({});
20
21
  const getDisplayName = _ref2 => {
21
22
  let {
22
23
  displayName,
@@ -34,6 +35,7 @@ const withTooltip = WrappedComponent => {
34
35
  errorMessage
35
36
  } = props;
36
37
  const [stateTooltipPosition, setStateTooltipPosition] = (0, _react.useState)(tooltipPosition);
38
+ const [onDeniedText, setOnDeniedText] = (0, _react.useState)('');
37
39
  const [tooltipStyle, setTooltipStyle] = (0, _react.useState)('');
38
40
  const [showTooltip, setShowTooltip] = (0, _react.useState)(false);
39
41
  const [tooltipDimensions, setTooltipDimensions] = (0, _react.useState)({
@@ -54,7 +56,7 @@ const withTooltip = WrappedComponent => {
54
56
  setShowTooltip(false);
55
57
  };
56
58
  (0, _react.useEffect)(() => {
57
- if (hasTooltip(props)) {
59
+ if (hasTooltip(props) || onDeniedText) {
58
60
  if (errorMessage) {
59
61
  setShowTooltip(true);
60
62
  } else {
@@ -67,7 +69,7 @@ const withTooltip = WrappedComponent => {
67
69
  }
68
70
  }
69
71
  return () => {
70
- if (hasTooltip(props)) {
72
+ if (hasTooltip(props) || onDeniedText) {
71
73
  document.removeEventListener('mouseover', onMouseOver);
72
74
  document.removeEventListener('scroll', onAnyScroll, true);
73
75
  if (targetElement && targetElement.current) {
@@ -75,7 +77,7 @@ const withTooltip = WrappedComponent => {
75
77
  }
76
78
  }
77
79
  };
78
- }, [errorMessage]);
80
+ }, [errorMessage, tooltip, onDeniedText]);
79
81
  (0, _react.useEffect)(() => {
80
82
  if (targetElement.current && tooltipElement.current) {
81
83
  const {
@@ -106,7 +108,11 @@ const withTooltip = WrappedComponent => {
106
108
  break;
107
109
  case 'left':
108
110
  if (targetDimensions.left < tooltipClientWidth) {
109
- setStateTooltipPosition('right');
111
+ if (window.innerWidth - targetDimensions.right < tooltipClientWidth) {
112
+ setStateTooltipPosition('bottom');
113
+ } else {
114
+ setStateTooltipPosition('right');
115
+ }
110
116
  } else {
111
117
  style += "; top: ".concat(targetVerticalCenter + window.scrollY - height / 2, "px");
112
118
  style += "; left: ".concat(targetDimensions.left - tooltipClientWidth - 6, "px");
@@ -125,14 +131,14 @@ const withTooltip = WrappedComponent => {
125
131
  }
126
132
  setTooltipStyle(style);
127
133
  }
128
- }, [tooltipDimensions, tooltipElement.current, targetElement.current, stateTooltipPosition]);
134
+ }, [tooltipDimensions, stateTooltipPosition]);
129
135
  (0, _react.useEffect)(() => {
130
136
  setStateTooltipPosition(tooltipPosition);
131
137
  }, [window.scrollY, window.scrollX, window.innerWidth]);
132
138
  const getTooltip = () => {
133
- if (tooltip) {
139
+ if (tooltip || onDeniedText) {
134
140
  return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
135
- text: tooltip,
141
+ text: onDeniedText || tooltip,
136
142
  textError: errorMessage,
137
143
  tooltipRef: tooltipElement,
138
144
  style: tooltipStyle,
@@ -146,8 +152,17 @@ const withTooltip = WrappedComponent => {
146
152
  const getTarget = targetEl => {
147
153
  if (!targetElement.current) targetElement.current = targetEl;
148
154
  };
149
- if (!hasTooltip(props)) return /*#__PURE__*/_react.default.createElement(WrappedComponent, props);
150
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({}, props, {
155
+ const contextValues = {
156
+ handlerSetOnDeniedText: setOnDeniedText
157
+ };
158
+ if (!hasTooltip(props) && !onDeniedText) {
159
+ return /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
160
+ value: contextValues
161
+ }, /*#__PURE__*/_react.default.createElement(WrappedComponent, props));
162
+ }
163
+ return /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
164
+ value: contextValues
165
+ }, /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({}, props, {
151
166
  targetRef: getTarget
152
167
  })), showTooltip && getTooltip());
153
168
  };
package/lib/list/Item.js CHANGED
@@ -51,6 +51,7 @@ const Item = props => {
51
51
  const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
52
52
  const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
53
53
  const navigate = (0, _reactRouterDom.useNavigate)();
54
+ const disabledByPermission = onDenied.disabled;
54
55
  const shouldDisable = () => disabled || onDenied.disabled;
55
56
  const getClass = () => "item ".concat(customClass, " ").concat(separator && 'list-separator', " ").concat(shouldDisable() && 'disabled', "\n ").concat(displayCheckbox && 'list-checkbox');
56
57
  const getIcon = (iconName, icon) => {
@@ -58,9 +59,11 @@ const Item = props => {
58
59
  return icon;
59
60
  } else if (iconName) {
60
61
  return /*#__PURE__*/_react.default.createElement(_icons.default, {
61
- name: iconName
62
+ name: !disabledByPermission ? iconName : 'padlock'
62
63
  });
63
- }
64
+ } else if (!icon && !displayCheckbox && !leftElement && !leftIconName && !leftIcon && onDenied.disabled) return /*#__PURE__*/_react.default.createElement(_icons.default, {
65
+ name: "padlock"
66
+ });
64
67
  return null;
65
68
  };
66
69
  const handleOnSelectItem = e => {
@@ -94,6 +97,18 @@ const Item = props => {
94
97
  document.removeEventListener('keydown', onKeyDown);
95
98
  };
96
99
  }, [url, selectedItemId, itemId]);
100
+ const renderCheckBox = (0, _react.useMemo)(() => {
101
+ if (!disabledByPermission && displayCheckbox) {
102
+ return /*#__PURE__*/_react.default.createElement(_checkbox.default, {
103
+ name: "checkbox"
104
+ });
105
+ } else if (disabledByPermission && displayCheckbox) {
106
+ return /*#__PURE__*/_react.default.createElement(_icons.default, {
107
+ name: "padlock"
108
+ });
109
+ }
110
+ return null;
111
+ }, [disabledByPermission && displayCheckbox]);
97
112
  if (!visible || onDenied.unvisible) return null;
98
113
  return /*#__PURE__*/_react.default.createElement("li", _extends({
99
114
  ref: itemId && selectedItemId === itemId ? selectedItemRef : null,
@@ -106,15 +121,13 @@ const Item = props => {
106
121
  to: url
107
122
  }), (displayCheckbox || leftElement || leftIconName || leftIcon) && /*#__PURE__*/_react.default.createElement("div", {
108
123
  className: "".concat(getClass(), " -icon-left")
109
- }, displayCheckbox && /*#__PURE__*/_react.default.createElement(_checkbox.default, {
110
- name: "checkbox"
111
- }), leftElement, getIcon(leftIconName, leftIcon)), (text || subText || children) && /*#__PURE__*/_react.default.createElement("div", {
124
+ }, renderCheckBox, leftElement, getIcon(leftIconName, leftIcon)), (text || subText || children) && /*#__PURE__*/_react.default.createElement("div", {
112
125
  className: "".concat(getClass())
113
126
  }, /*#__PURE__*/_react.default.createElement("p", {
114
127
  className: "".concat(text && 'text')
115
128
  }, text), /*#__PURE__*/_react.default.createElement("p", {
116
129
  className: "".concat(subText && 'subtext')
117
- }, subText), children), (rightIconName || rightIcon || rightElement) && /*#__PURE__*/_react.default.createElement("div", {
130
+ }, subText), children), (rightIconName || rightIcon || rightElement || disabledByPermission) && /*#__PURE__*/_react.default.createElement("div", {
118
131
  className: "".concat(getClass(), " -icon-right")
119
132
  }, getIcon(rightIconName, rightIcon), rightElement));
120
133
  };
@@ -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;
@@ -32,17 +32,18 @@ const PopupMenuSearch = props => {
32
32
  style
33
33
  });
34
34
  const closeOnEsc = e => {
35
- if (e.keyCode === 27 || e.key === 'ESC') {
35
+ if (e.key === 'Escape') {
36
36
  handlerClose();
37
+ e.stopPropagation();
37
38
  }
38
39
  };
39
40
  (0, _react.useEffect)(() => {
40
41
  body.appendChild(popupRef.current);
41
42
  if (searchFieldRef && searchFieldRef.current) searchFieldRef.current.focus();
42
- document.body.addEventListener('keyup', closeOnEsc);
43
+ document.body.addEventListener('keydown', closeOnEsc);
43
44
  return () => {
44
45
  body.removeChild(popupRef.current);
45
- document.body.removeEventListener('keyup', closeOnEsc);
46
+ document.body.removeEventListener('keydown', closeOnEsc);
46
47
  };
47
48
  }, []);
48
49
  (0, _react.useEffect)(() => {
@@ -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,6 +1,6 @@
1
1
  import { ITableHeaderProps } from './types.js';
2
2
  import 'react';
3
3
 
4
- declare const HeaderColumn: ({ customClass, style, children, textAlign, visible, id, }: ITableHeaderProps) => JSX.Element | null;
4
+ declare const HeaderColumn: ({ customClass, style, children, textAlign, visible, id, rowSpan, colSpan, }: ITableHeaderProps) => JSX.Element | null;
5
5
 
6
6
  export { HeaderColumn as default };
@@ -17,7 +17,9 @@ const HeaderColumn = _ref => {
17
17
  children,
18
18
  textAlign,
19
19
  visible = true,
20
- id
20
+ id,
21
+ rowSpan,
22
+ colSpan
21
23
  } = _ref;
22
24
  const {
23
25
  skeletonize,
@@ -28,6 +30,8 @@ const HeaderColumn = _ref => {
28
30
  if (!visible) return null;
29
31
  return /*#__PURE__*/_react.default.createElement("th", {
30
32
  id: id,
33
+ rowSpan: rowSpan,
34
+ colSpan: colSpan,
31
35
  className: "headercolumn ".concat(customClass, " text-align-").concat(textAlign),
32
36
  style: style
33
37
  }, skeletonize && (skeletonInHeader || !skeletonInRows) && !vertical ? /*#__PURE__*/_react.default.createElement(_skeleton.default, {
@@ -42,7 +42,8 @@ const RowColumn = props => {
42
42
  textAlign,
43
43
  visible = true,
44
44
  rowSpan,
45
- colSpan
45
+ colSpan,
46
+ children
46
47
  } = props;
47
48
  const context = (0, _react.useContext)(_helpers.RowContext);
48
49
  const {
@@ -51,8 +52,7 @@ const RowColumn = props => {
51
52
  skeletonInRows = 10
52
53
  } = context;
53
54
  const hiddenContent = displayContent !== 'always';
54
- const childrenProps = props.children;
55
- const renderContent = () => {
55
+ const renderContent = (0, _react.useCallback)(() => {
56
56
  if (skeletonize && vertical) {
57
57
  return /*#__PURE__*/_react.default.createElement(_skeleton.default, {
58
58
  height: 16,
@@ -63,8 +63,8 @@ const RowColumn = props => {
63
63
  }
64
64
  return hiddenContent && displayContent ? /*#__PURE__*/_react.default.createElement("span", {
65
65
  className: displayClass[displayContent]
66
- }, childrenProps) : childrenProps;
67
- };
66
+ }, children) : children;
67
+ }, [skeletonize, vertical, children, displayContent, hiddenContent, displayClass]);
68
68
  if (!visible) return null;
69
69
  if (skeletonize && !skeletonInRows && !vertical) return null;
70
70
  return /*#__PURE__*/_react.default.createElement("td", {
@@ -72,9 +72,7 @@ const RowColumn = props => {
72
72
  colSpan: colSpan,
73
73
  className: "rowcolumn ".concat(customClass, " text-align-").concat(textAlign, " ").concat(!context.rowBorder && ' -noborder', " ").concat(!rowSpan ? ' -norowspan' : ''),
74
74
  style: style,
75
- onClick: e => {
76
- getColClickEvent(e, _objectSpread(_objectSpread({}, context), props));
77
- },
75
+ onClick: e => getColClickEvent(e, _objectSpread(_objectSpread({}, context), props)),
78
76
  role: "presentation",
79
77
  tabIndex: -1
80
78
  }, renderContent());
@@ -25,6 +25,8 @@ interface ITableHeaderProps extends TableHTMLAttributes<HTMLTableElement> {
25
25
  textAlign?: string;
26
26
  visible?: boolean;
27
27
  id?: string;
28
+ rowSpan?: number;
29
+ colSpan?: number;
28
30
  }
29
31
  interface ITableBodyProps extends TableHTMLAttributes<HTMLTableElement> {
30
32
  children?: ReactNode;
@@ -67,7 +67,7 @@ function TabsProvider(_ref) {
67
67
  updateTabs(tabId);
68
68
  setSelectedTabId(tabId);
69
69
  if (onTabChange) {
70
- onTabChange(String(tabId));
70
+ onTabChange(tabId);
71
71
  }
72
72
  }, [onTabChange, setSelectedTabId, updateTabs]);
73
73
  const removeTab = (0, _react.useCallback)(tabId => {
@@ -23,7 +23,7 @@ interface TabsProviderProps {
23
23
  container: RefObject<HTMLDivElement>;
24
24
  tabsWidth: number | string;
25
25
  selectedTab?: string | number | null;
26
- onTabChange?: (tabId: string) => void;
26
+ onTabChange?: (tabId: string | number) => void;
27
27
  onTabClose?: (tabId: string) => void;
28
28
  firstTabIdent?: boolean;
29
29
  }
@@ -32,12 +32,12 @@ interface ITabsPros {
32
32
  toolbar?: ReactElement;
33
33
  toolBarRef?: (value: HTMLDivElement | null) => void;
34
34
  children?: ReactNode;
35
- selectedTab?: string;
35
+ selectedTab?: string | number;
36
36
  tabMenuSize?: Size;
37
37
  tabMenuAlign?: Position;
38
38
  firstTabIdent?: boolean;
39
39
  tabMenuPosition?: Exclude<Position, 'center'>;
40
- handlerTabClick?: (id?: string) => void;
40
+ handlerTabClick?: (id?: string | number) => void;
41
41
  handlerCloseTab?: (id?: string, idx?: string) => void;
42
42
  customClassForToolBar?: string;
43
43
  tabsWidth?: string | number;
@@ -26,6 +26,7 @@ interface IButtonBarProps {
26
26
  iconAlign?: Exclude<Position, 'top' | 'bottom'>;
27
27
  validationKey?: string;
28
28
  boxShadow?: boolean;
29
+ id?: string;
29
30
  onNodeElementClick?: (node: NodeItem) => void;
30
31
  }
31
32
  interface ILabelBarProps {
@@ -1,6 +1,7 @@
1
+ import React__default from 'react';
1
2
  import { IUITourProps } from './types.js';
2
3
  import './helpers.js';
3
4
 
4
- declare const UiTour: (props: IUITourProps) => JSX.Element | null;
5
+ declare const UiTour: (props: IUITourProps) => React__default.ReactPortal | null;
5
6
 
6
7
  export { UiTour as default };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
+ var _reactDom = require("react-dom");
8
9
  var _buttons = _interopRequireWildcard(require("../buttons"));
9
10
  require("../assets/styles/uitour.scss");
10
11
  var _helpers = require("./helpers");
@@ -24,7 +25,8 @@ const UiTour = props => {
24
25
  showCloseButton = true,
25
26
  showBackButton = true,
26
27
  visible = true,
27
- onFinish
28
+ onFinish,
29
+ onStepChange
28
30
  } = props;
29
31
  const [currentStep, setCurrentStep] = (0, _react.useState)(undefined);
30
32
  const [hasNextStep, setHasNextStep] = (0, _react.useState)(false);
@@ -35,6 +37,7 @@ const UiTour = props => {
35
37
  const [stepPosition, setStepPosition] = (0, _react.useState)(_helpers.STEP_POSITIONS.left);
36
38
  const stepRef = (0, _react.useRef)(null);
37
39
  const descriptionRef = (0, _react.useRef)(null);
40
+ const activatedEffects = (0, _react.useRef)([]);
38
41
  const handleNextStep = () => {
39
42
  if (hasNextStep) {
40
43
  const currentStepIndex = data.findIndex(item => item.id === (currentStep === null || currentStep === void 0 ? void 0 : currentStep.id));
@@ -88,6 +91,46 @@ const UiTour = props => {
88
91
  setShowTour(visible);
89
92
  setCurrentStep(step);
90
93
  };
94
+ const removePreviousElementsEffects = () => {
95
+ if (activatedEffects.current.length > 0) {
96
+ const effects = activatedEffects.current;
97
+ effects.forEach(ef => {
98
+ const element = document.getElementById(ef.elementId);
99
+ if (element) {
100
+ delete element.dataset.uitour;
101
+ activatedEffects.current = activatedEffects.current.filter(r => r.elementId !== ef.elementId);
102
+ }
103
+ });
104
+ }
105
+ };
106
+ const addElementEffect = (0, _react.useCallback)(elementEffect => {
107
+ const element = document.getElementById(elementEffect.elementId);
108
+ if (element) {
109
+ element.dataset.uitour = elementEffect.effect;
110
+ if (activatedEffects.current) activatedEffects.current.push(elementEffect);
111
+ }
112
+ }, []);
113
+ const showElementsEffects = currentData => {
114
+ if (currentData.effect) {
115
+ const {
116
+ effect,
117
+ targetId
118
+ } = currentData;
119
+ addElementEffect({
120
+ effect,
121
+ elementId: targetId
122
+ });
123
+ }
124
+ if (currentData.elementsEffects) {
125
+ let {
126
+ elementsEffects
127
+ } = currentData;
128
+ if (!Array.isArray(elementsEffects)) elementsEffects = [elementsEffects];
129
+ elementsEffects.forEach(ef => {
130
+ addElementEffect(ef);
131
+ });
132
+ }
133
+ };
91
134
  (0, _react.useEffect)(() => {
92
135
  if (currentStep) {
93
136
  const target = document.getElementById(currentStep.targetId);
@@ -113,6 +156,9 @@ const UiTour = props => {
113
156
  setIsLastStep(false);
114
157
  }
115
158
  getStepPosition(targetRect);
159
+ removePreviousElementsEffects();
160
+ showElementsEffects(data[currentStepIndex]);
161
+ if (onStepChange) onStepChange(target);
116
162
  }
117
163
  if (descriptionRef.current) {
118
164
  descriptionRef.current.innerHTML = currentStep.description;
@@ -151,8 +197,13 @@ const UiTour = props => {
151
197
  mutationObserver = null;
152
198
  };
153
199
  }, [visible, data]);
154
- if (!showTour) return null;
155
- return /*#__PURE__*/_react.default.createElement("div", {
200
+ (0, _react.useEffect)(() => {
201
+ if (!showTour && activatedEffects.current.length > 0) {
202
+ removePreviousElementsEffects();
203
+ }
204
+ if (showTour) document.body.style.overflow = 'hidden';else document.body.style.overflow = 'auto';
205
+ }, [showTour, activatedEffects.current.length]);
206
+ const component = (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement("div", {
156
207
  className: "uitour-component"
157
208
  }, currentStep && /*#__PURE__*/_react.default.createElement("div", {
158
209
  ref: stepRef,
@@ -199,6 +250,8 @@ const UiTour = props => {
199
250
  visible: isLastStep,
200
251
  onClick: onCloseTour,
201
252
  customClass: "finish-button"
202
- }))));
253
+ })))), [currentStep, stepPosition, stepDimensions, showCloseButton, onCloseTour, backButtonLabel, handleBackStep, hasBackStep, showBackButton, nextButtonLabel, handleNextStep, hasNextStep, isLastStep, finishButtonLabel, isLastStep, onCloseTour]);
254
+ if (!showTour) return null;
255
+ return /*#__PURE__*/(0, _reactDom.createPortal)(component, document.body);
203
256
  };
204
257
  var _default = exports.default = UiTour;
@@ -1,11 +1,18 @@
1
1
  import { STEP_POSITIONS } from './helpers.js';
2
2
 
3
+ type Effect = 'hover' | 'focus' | 'blur' | 'active' | 'selected';
4
+ type ElementEffect = {
5
+ elementId: string;
6
+ effect: Effect;
7
+ };
3
8
  type UITourData = {
4
9
  id: string | number;
5
10
  targetId: string;
11
+ effect?: Effect;
6
12
  title: string;
7
13
  description: string;
8
14
  position?: keyof typeof STEP_POSITIONS;
15
+ elementsEffects?: ElementEffect | ElementEffect[];
9
16
  };
10
17
  interface CurrentStep extends UITourData {
11
18
  number: number;
@@ -25,6 +32,7 @@ interface IUITourProps {
25
32
  showBackButton?: boolean;
26
33
  visible?: boolean;
27
34
  onFinish: (value: boolean) => void;
35
+ onStepChange?: (target: HTMLElement) => void;
28
36
  }
29
37
 
30
- export type { CurrentStep, IUITourProps, StepDimensions, UITourData };
38
+ export type { CurrentStep, Effect, ElementEffect, IUITourProps, StepDimensions, UITourData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.2-beta.9",
3
+ "version": "1.1.3-beta.1",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",
@@ -9,7 +9,7 @@
9
9
  "lib:types": "NODE_OPTIONS='--max-old-space-size=16384' tsup --dts-only --dts --external react",
10
10
  "demo": "node scripts/start.js",
11
11
  "demo:prod": "webpack --config ./config/webpack.config.js --mode production",
12
- "check:js": "eslint ./src/** --ext=.jsx,.js,.tsx,.ts",
12
+ "check:js": "eslint ./src/** --ext=.jsx,.js,.tsx,.ts --cache",
13
13
  "deploy:heroku": "npm run demo:prod && cd demo && git commit -am 'Deploy' && git push heroku master",
14
14
  "deploy:vercel": "npm run demo:prod && vercel --prod demo",
15
15
  "publish:npm": "npm run lib && npm publish",
@@ -43,7 +43,7 @@
43
43
  "dependencies": {
44
44
  "@types/react-dom": "18.0.5",
45
45
  "attach-dom-events": "1.0.0",
46
- "browserslist": "4.18.1",
46
+ "browserslist": "4.23.0",
47
47
  "history": "5.0.0",
48
48
  "imask": "6.4.3",
49
49
  "init": "0.1.2",
@@ -65,7 +65,7 @@
65
65
  "@babel/preset-react": "7.18.6",
66
66
  "@babel/preset-typescript": "7.23.3",
67
67
  "@svgr/webpack": "8.1.0",
68
- "@swc/core": "1.3.29",
68
+ "@swc/core": "1.4.13",
69
69
  "@testing-library/jest-dom": "5.16.5",
70
70
  "@testing-library/react": "14.1.2",
71
71
  "@testing-library/user-event": "14.4.3",
package/.tool-versions DELETED
@@ -1 +0,0 @@
1
- nodejs 10.16.0
@@ -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
- }