linear-react-components-ui 1.1.3-beta.3 → 1.1.3

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 (85) hide show
  1. package/.eslintcache +1 -1
  2. package/lib/@types/Align.d.ts +1 -1
  3. package/lib/@types/ButtonTypes.d.ts +1 -1
  4. package/lib/@types/ColorStyles.d.ts +1 -1
  5. package/lib/@types/DataCombo.d.ts +1 -1
  6. package/lib/@types/Icon.d.ts +1 -1
  7. package/lib/@types/LabelStyles.d.ts +1 -1
  8. package/lib/@types/Period.d.ts +1 -1
  9. package/lib/@types/PermissionAttr.d.ts +1 -1
  10. package/lib/@types/PointerEvents.d.ts +1 -1
  11. package/lib/@types/Position.d.ts +1 -1
  12. package/lib/@types/PositionAlert.d.ts +1 -1
  13. package/lib/@types/Size.d.ts +1 -1
  14. package/lib/@types/SizePixels.d.ts +1 -1
  15. package/lib/@types/StorageMock.d.ts +1 -1
  16. package/lib/alerts/types.d.ts +1 -1
  17. package/lib/assets/styles/button.scss +9 -11
  18. package/lib/assets/styles/table.scss +1 -2
  19. package/lib/avatar/types.d.ts +1 -1
  20. package/lib/badge/types.d.ts +1 -1
  21. package/lib/buttons/DefaultButton.js +11 -29
  22. package/lib/buttons/types.d.ts +1 -2
  23. package/lib/calendar/types.d.ts +1 -1
  24. package/lib/checkbox/index.js +1 -1
  25. package/lib/checkbox/types.d.ts +1 -1
  26. package/lib/dialog/types.d.ts +1 -1
  27. package/lib/drawer/types.d.ts +1 -1
  28. package/lib/dropdown/types.d.ts +1 -1
  29. package/lib/fieldset/types.d.ts +1 -1
  30. package/lib/form/Field.d.ts +1 -1
  31. package/lib/form/FieldArray.js +26 -12
  32. package/lib/form/index.js +7 -6
  33. package/lib/form/types.d.ts +3 -4
  34. package/lib/gridlayout/types.d.ts +1 -1
  35. package/lib/hint/types.d.ts +1 -1
  36. package/lib/icons/types.d.ts +1 -1
  37. package/lib/inputs/base/InputTextBase.js +2 -1
  38. package/lib/inputs/base/types.d.ts +1 -1
  39. package/lib/inputs/color/types.d.ts +1 -1
  40. package/lib/inputs/date/index.js +38 -26
  41. package/lib/inputs/date/types.d.ts +1 -1
  42. package/lib/inputs/file/types.d.ts +1 -1
  43. package/lib/inputs/mask/Cpf.js +1 -0
  44. package/lib/inputs/mask/imaskHOC.js +4 -2
  45. package/lib/inputs/mask/types.d.ts +1 -1
  46. package/lib/inputs/multiSelect/types.d.ts +1 -1
  47. package/lib/inputs/number/types.d.ts +1 -1
  48. package/lib/inputs/period/types.d.ts +1 -1
  49. package/lib/inputs/select/types.d.ts +1 -1
  50. package/lib/inputs/text/types.d.ts +1 -1
  51. package/lib/inputs/textarea/types.d.ts +1 -1
  52. package/lib/inputs/types.d.ts +1 -1
  53. package/lib/internals/types.d.ts +2 -5
  54. package/lib/internals/withTooltip.d.ts +2 -3
  55. package/lib/internals/withTooltip.js +8 -19
  56. package/lib/labelMessages/types.d.ts +1 -1
  57. package/lib/labels/types.d.ts +1 -1
  58. package/lib/list/Item.js +5 -24
  59. package/lib/list/types.d.ts +1 -1
  60. package/lib/menus/float/index.d.ts +10 -10
  61. package/lib/menus/float/types.d.ts +1 -1
  62. package/lib/menus/sidenav/types.d.ts +1 -1
  63. package/lib/panel/types.d.ts +1 -1
  64. package/lib/popover/types.d.ts +1 -1
  65. package/lib/progress/types.d.ts +1 -1
  66. package/lib/radio/types.d.ts +1 -1
  67. package/lib/shortcuts/types.d.ts +1 -1
  68. package/lib/skeleton/types.d.ts +1 -1
  69. package/lib/spinner/types.d.ts +1 -1
  70. package/lib/split/helpers.d.ts +1 -1
  71. package/lib/split/types.d.ts +1 -1
  72. package/lib/table/RowColumn.js +8 -6
  73. package/lib/table/types.d.ts +1 -1
  74. package/lib/tabs/types.d.ts +1 -1
  75. package/lib/toolbar/types.d.ts +1 -2
  76. package/lib/tooltip/types.d.ts +1 -1
  77. package/lib/treetable/Row.d.ts +1 -1
  78. package/lib/treetable/helpers.d.ts +1 -1
  79. package/lib/treetable/index.d.ts +2 -2
  80. package/lib/treeview/types.d.ts +1 -1
  81. package/lib/{types.d-DvJcBS8L.d.ts → types.d-73cece43.d.ts} +1 -1
  82. package/lib/uitour/index.d.ts +1 -2
  83. package/lib/uitour/index.js +4 -57
  84. package/lib/uitour/types.d.ts +1 -9
  85. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
- import React__default from 'react';
2
1
  import { IUITourProps } from './types.js';
3
2
  import './helpers.js';
4
3
 
5
- declare const UiTour: (props: IUITourProps) => React__default.ReactPortal | null;
4
+ declare const UiTour: (props: IUITourProps) => JSX.Element | null;
6
5
 
7
6
  export { UiTour as default };
@@ -5,7 +5,6 @@ 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");
9
8
  var _buttons = _interopRequireWildcard(require("../buttons"));
10
9
  require("../assets/styles/uitour.scss");
11
10
  var _helpers = require("./helpers");
@@ -25,8 +24,7 @@ const UiTour = props => {
25
24
  showCloseButton = true,
26
25
  showBackButton = true,
27
26
  visible = true,
28
- onFinish,
29
- onStepChange
27
+ onFinish
30
28
  } = props;
31
29
  const [currentStep, setCurrentStep] = (0, _react.useState)(undefined);
32
30
  const [hasNextStep, setHasNextStep] = (0, _react.useState)(false);
@@ -37,7 +35,6 @@ const UiTour = props => {
37
35
  const [stepPosition, setStepPosition] = (0, _react.useState)(_helpers.STEP_POSITIONS.left);
38
36
  const stepRef = (0, _react.useRef)(null);
39
37
  const descriptionRef = (0, _react.useRef)(null);
40
- const activatedEffects = (0, _react.useRef)([]);
41
38
  const handleNextStep = () => {
42
39
  if (hasNextStep) {
43
40
  const currentStepIndex = data.findIndex(item => item.id === (currentStep === null || currentStep === void 0 ? void 0 : currentStep.id));
@@ -91,46 +88,6 @@ const UiTour = props => {
91
88
  setShowTour(visible);
92
89
  setCurrentStep(step);
93
90
  };
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
- };
134
91
  (0, _react.useEffect)(() => {
135
92
  if (currentStep) {
136
93
  const target = document.getElementById(currentStep.targetId);
@@ -156,9 +113,6 @@ const UiTour = props => {
156
113
  setIsLastStep(false);
157
114
  }
158
115
  getStepPosition(targetRect);
159
- removePreviousElementsEffects();
160
- showElementsEffects(data[currentStepIndex]);
161
- if (onStepChange) onStepChange(target);
162
116
  }
163
117
  if (descriptionRef.current) {
164
118
  descriptionRef.current.innerHTML = currentStep.description;
@@ -197,13 +151,8 @@ const UiTour = props => {
197
151
  mutationObserver = null;
198
152
  };
199
153
  }, [visible, data]);
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", {
154
+ if (!showTour) return null;
155
+ return /*#__PURE__*/_react.default.createElement("div", {
207
156
  className: "uitour-component"
208
157
  }, currentStep && /*#__PURE__*/_react.default.createElement("div", {
209
158
  ref: stepRef,
@@ -250,8 +199,6 @@ const UiTour = props => {
250
199
  visible: isLastStep,
251
200
  onClick: onCloseTour,
252
201
  customClass: "finish-button"
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);
202
+ }))));
256
203
  };
257
204
  var _default = exports.default = UiTour;
@@ -1,18 +1,11 @@
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
- };
8
3
  type UITourData = {
9
4
  id: string | number;
10
5
  targetId: string;
11
- effect?: Effect;
12
6
  title: string;
13
7
  description: string;
14
8
  position?: keyof typeof STEP_POSITIONS;
15
- elementsEffects?: ElementEffect | ElementEffect[];
16
9
  };
17
10
  interface CurrentStep extends UITourData {
18
11
  number: number;
@@ -32,7 +25,6 @@ interface IUITourProps {
32
25
  showBackButton?: boolean;
33
26
  visible?: boolean;
34
27
  onFinish: (value: boolean) => void;
35
- onStepChange?: (target: HTMLElement) => void;
36
28
  }
37
29
 
38
- export type { CurrentStep, Effect, ElementEffect, IUITourProps, StepDimensions, UITourData };
30
+ export { CurrentStep, IUITourProps, StepDimensions, UITourData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.3-beta.3",
3
+ "version": "1.1.3",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",