linear-react-components-ui 2.0.0-beta.4 → 2.0.0-rc.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 (122) hide show
  1. package/lib/assets/styles/radio.css +1 -1
  2. package/lib/assets/styles/selectfield.css +1 -1
  3. package/lib/assets/styles/split.css +1 -1
  4. package/lib/form2/useForm/index.js +74 -63
  5. package/lib/form2/useForm/index.js.map +1 -1
  6. package/lib/inputs/base/types.d.ts +2 -2
  7. package/lib/inputs/date/helpers.js +11 -22
  8. package/lib/inputs/date/helpers.js.map +1 -1
  9. package/lib/inputs/mask/BaseMask.js +55 -65
  10. package/lib/inputs/mask/BaseMask.js.map +1 -1
  11. package/lib/inputs/mask/types.d.ts +2 -1
  12. package/lib/inputs/number/Currency.js +35 -45
  13. package/lib/inputs/number/Currency.js.map +1 -1
  14. package/lib/inputs/number/Decimal.js +38 -48
  15. package/lib/inputs/number/Decimal.js.map +1 -1
  16. package/lib/inputs/number/index.js +38 -48
  17. package/lib/inputs/number/index.js.map +1 -1
  18. package/lib/inputs/period/helper.d.ts +1 -0
  19. package/lib/inputs/period/helper.js +27 -19
  20. package/lib/inputs/period/helper.js.map +1 -1
  21. package/lib/inputs/period/index.js +143 -139
  22. package/lib/inputs/period/index.js.map +1 -1
  23. package/lib/inputs2/date/datefield/base.js +60 -70
  24. package/lib/inputs2/date/datefield/base.js.map +1 -1
  25. package/lib/inputs2/date/dateperiodfield/base.js +79 -89
  26. package/lib/inputs2/date/dateperiodfield/base.js.map +1 -1
  27. package/lib/inputs2/mask/Cnpj.js +58 -68
  28. package/lib/inputs2/mask/Cnpj.js.map +1 -1
  29. package/lib/inputs2/mask/Cpf.js +38 -48
  30. package/lib/inputs2/mask/Cpf.js.map +1 -1
  31. package/lib/inputs2/mask/index.js +50 -60
  32. package/lib/inputs2/mask/index.js.map +1 -1
  33. package/lib/inputs2/numberfield/currency.js +51 -61
  34. package/lib/inputs2/numberfield/currency.js.map +1 -1
  35. package/lib/inputs2/numberfield/decimal.js +25 -35
  36. package/lib/inputs2/numberfield/decimal.js.map +1 -1
  37. package/lib/inputs2/numberfield/index.js +46 -56
  38. package/lib/inputs2/numberfield/index.js.map +1 -1
  39. package/lib/inputs2/selectfield/base.d.ts +1 -2
  40. package/lib/inputs2/selectfield/base.js +260 -382
  41. package/lib/inputs2/selectfield/base.js.map +1 -1
  42. package/lib/inputs2/selectfield/context.d.ts +1 -1
  43. package/lib/inputs2/selectfield/context.js.map +1 -1
  44. package/lib/inputs2/selectfield/helpers.d.ts +5 -0
  45. package/lib/inputs2/selectfield/helpers.js +22 -13
  46. package/lib/inputs2/selectfield/helpers.js.map +1 -1
  47. package/lib/inputs2/selectfield/index.js.map +1 -1
  48. package/lib/inputs2/selectfield/listbox.js +17 -18
  49. package/lib/inputs2/selectfield/listbox.js.map +1 -1
  50. package/lib/inputs2/selectfield/selections.d.ts +1 -1
  51. package/lib/inputs2/selectfield/selections.js +11 -11
  52. package/lib/inputs2/selectfield/selections.js.map +1 -1
  53. package/lib/inputs2/selectfield/triggers.js +15 -15
  54. package/lib/inputs2/selectfield/triggers.js.map +1 -1
  55. package/lib/radio/index.js +74 -84
  56. package/lib/radio/index.js.map +1 -1
  57. package/lib/table/Row.js +57 -46
  58. package/lib/table/Row.js.map +1 -1
  59. package/lib/table/types.d.ts +2 -1
  60. package/package.json +9 -6
  61. package/lib/node_modules/imask/esm/controls/html-contenteditable-mask-element.js +0 -35
  62. package/lib/node_modules/imask/esm/controls/html-contenteditable-mask-element.js.map +0 -1
  63. package/lib/node_modules/imask/esm/controls/html-input-mask-element.js +0 -32
  64. package/lib/node_modules/imask/esm/controls/html-input-mask-element.js.map +0 -1
  65. package/lib/node_modules/imask/esm/controls/html-mask-element.js +0 -49
  66. package/lib/node_modules/imask/esm/controls/html-mask-element.js.map +0 -1
  67. package/lib/node_modules/imask/esm/controls/input-history.js +0 -31
  68. package/lib/node_modules/imask/esm/controls/input-history.js.map +0 -1
  69. package/lib/node_modules/imask/esm/controls/input.js +0 -223
  70. package/lib/node_modules/imask/esm/controls/input.js.map +0 -1
  71. package/lib/node_modules/imask/esm/controls/mask-element.js +0 -44
  72. package/lib/node_modules/imask/esm/controls/mask-element.js.map +0 -1
  73. package/lib/node_modules/imask/esm/core/action-details.js +0 -52
  74. package/lib/node_modules/imask/esm/core/action-details.js.map +0 -1
  75. package/lib/node_modules/imask/esm/core/change-details.js +0 -37
  76. package/lib/node_modules/imask/esm/core/change-details.js.map +0 -1
  77. package/lib/node_modules/imask/esm/core/continuous-tail-details.js +0 -43
  78. package/lib/node_modules/imask/esm/core/continuous-tail-details.js.map +0 -1
  79. package/lib/node_modules/imask/esm/core/holder.js +0 -7
  80. package/lib/node_modules/imask/esm/core/holder.js.map +0 -1
  81. package/lib/node_modules/imask/esm/core/utils.js +0 -68
  82. package/lib/node_modules/imask/esm/core/utils.js.map +0 -1
  83. package/lib/node_modules/imask/esm/index.js +0 -51
  84. package/lib/node_modules/imask/esm/index.js.map +0 -1
  85. package/lib/node_modules/imask/esm/masked/base.js +0 -253
  86. package/lib/node_modules/imask/esm/masked/base.js.map +0 -1
  87. package/lib/node_modules/imask/esm/masked/date.js +0 -118
  88. package/lib/node_modules/imask/esm/masked/date.js.map +0 -1
  89. package/lib/node_modules/imask/esm/masked/dynamic.js +0 -223
  90. package/lib/node_modules/imask/esm/masked/dynamic.js.map +0 -1
  91. package/lib/node_modules/imask/esm/masked/enum.js +0 -70
  92. package/lib/node_modules/imask/esm/masked/enum.js.map +0 -1
  93. package/lib/node_modules/imask/esm/masked/factory.js +0 -47
  94. package/lib/node_modules/imask/esm/masked/factory.js.map +0 -1
  95. package/lib/node_modules/imask/esm/masked/function.js +0 -24
  96. package/lib/node_modules/imask/esm/masked/function.js.map +0 -1
  97. package/lib/node_modules/imask/esm/masked/number.js +0 -213
  98. package/lib/node_modules/imask/esm/masked/number.js.map +0 -1
  99. package/lib/node_modules/imask/esm/masked/pattern/chunk-tail-details.js +0 -104
  100. package/lib/node_modules/imask/esm/masked/pattern/chunk-tail-details.js.map +0 -1
  101. package/lib/node_modules/imask/esm/masked/pattern/cursor.js +0 -101
  102. package/lib/node_modules/imask/esm/masked/pattern/cursor.js.map +0 -1
  103. package/lib/node_modules/imask/esm/masked/pattern/fixed-definition.js +0 -103
  104. package/lib/node_modules/imask/esm/masked/pattern/fixed-definition.js.map +0 -1
  105. package/lib/node_modules/imask/esm/masked/pattern/input-definition.js +0 -134
  106. package/lib/node_modules/imask/esm/masked/pattern/input-definition.js.map +0 -1
  107. package/lib/node_modules/imask/esm/masked/pattern.js +0 -323
  108. package/lib/node_modules/imask/esm/masked/pattern.js.map +0 -1
  109. package/lib/node_modules/imask/esm/masked/pipe.js +0 -24
  110. package/lib/node_modules/imask/esm/masked/pipe.js.map +0 -1
  111. package/lib/node_modules/imask/esm/masked/range.js +0 -79
  112. package/lib/node_modules/imask/esm/masked/range.js.map +0 -1
  113. package/lib/node_modules/imask/esm/masked/regexp.js +0 -22
  114. package/lib/node_modules/imask/esm/masked/regexp.js.map +0 -1
  115. package/lib/node_modules/imask/esm/masked/repeat.js +0 -105
  116. package/lib/node_modules/imask/esm/masked/repeat.js.map +0 -1
  117. package/lib/node_modules/react-imask/esm/hook.js +0 -76
  118. package/lib/node_modules/react-imask/esm/hook.js.map +0 -1
  119. package/lib/node_modules/react-imask/esm/input.js +0 -24
  120. package/lib/node_modules/react-imask/esm/input.js.map +0 -1
  121. package/lib/node_modules/react-imask/esm/mixin.js +0 -132
  122. package/lib/node_modules/react-imask/esm/mixin.js.map +0 -1
@@ -1,199 +1,203 @@
1
- import { jsx as i, jsxs as x } from "react/jsx-runtime";
1
+ import { jsx as i, jsxs as L } from "react/jsx-runtime";
2
2
  import '../../assets/styles/button.css';import '../../assets/styles/periodpicker.css';/* empty css */
3
- import { useId as se, useState as v, useRef as h, useCallback as ce, useEffect as L } from "react";
4
- import l from "../../node_modules/moment/dist/moment.js";
5
- import ye from "./PeriodList.js";
6
- import fe from "../mask/BaseMask.js";
7
- import U from "./Dropdown.js";
8
- import Oe from "../../calendar/base/index.js";
3
+ import { useId as ge, useState as v, useRef as s, useCallback as he, useEffect as V } from "react";
4
+ import d from "../../node_modules/moment/dist/moment.js";
5
+ import ve from "../mask/BaseMask.js";
6
+ import Ee from "../../calendar/base/index.js";
9
7
  import "../../_virtual/compiler-runtime.js";
10
- import de from "../../buttons/Button.js";
8
+ import Ce from "../../buttons/Button.js";
11
9
  /* empty css */
12
- import W from "../../icons/index.js";
13
- import $ from "./Dialog.js";
14
- import ke from "../../hint/index.js";
15
- import xe from "../../gridlayout/GridCol.js";
16
- import { getInputWrapperClass as Le } from "../base/helpers.js";
17
- import { ErrorMessage as Ee } from "../errorMessage/index.js";
18
- import me from "../../textContent/index.js";
19
- import Ve from "../../popover/index.js";
20
- const tn = (n) => {
10
+ import G from "../../icons/index.js";
11
+ import Te from "../../hint/index.js";
12
+ import qe from "../../gridlayout/GridCol.js";
13
+ import { getInputWrapperClass as Ae } from "../base/helpers.js";
14
+ import { ErrorMessage as ze } from "../errorMessage/index.js";
15
+ import Ye from "../../textContent/index.js";
16
+ import Ne from "../../popover/index.js";
17
+ import H from "./Dialog.js";
18
+ import K from "./Dropdown.js";
19
+ import je from "./PeriodList.js";
20
+ import { parseDateValue as E } from "./helper.js";
21
+ const cn = (n) => {
21
22
  const {
22
- showButtonOpen: R = !0,
23
- openOnFocus: ge = !0,
24
- shouldCloseOnSelect: G = !0,
25
- calendarColorStyle: B,
23
+ showButtonOpen: y = !0,
24
+ openOnFocus: De = !0,
25
+ shouldCloseOnSelect: J = !0,
26
+ calendarColorStyle: P,
26
27
  showCalendarInDialog: I = !1,
27
- dialogSize: E = {
28
+ dialogSize: T = {
28
29
  width: "350px",
29
30
  height: "350px"
30
31
  },
31
- hint: P,
32
- hintPosition: H = "below",
33
- themePopover: ve = "light",
34
- popoverAlign: he = "left",
35
- gridLayout: K
36
- } = n, Ce = se(), Ye = se(), [r, w] = v(n.value && l(n.value.initial, "DD/MM/YYYY")), [s, M] = v(n.value && l(n.value.final, "DD/MM/YYYY")), [J, Q] = v("week"), [C, d] = v(!1), [Y, o] = v(!1), [S, D] = v(!1), [V, T] = v(), [m, X] = v(), [Z, _] = v("valueInitial"), F = h(null), p = h(null), f = h(null), De = h(null), q = h(null), pe = h(null), b = h(null), a = h(null), g = h(null), A = () => {
37
- T(p?.current?.getBoundingClientRect());
38
- }, Ie = (e) => {
39
- const t = !F.current?.contains(e.relatedTarget);
40
- !I && C && t && d(!1), !I && Y && t && o(!1);
41
- }, ee = (e) => {
32
+ hint: O,
33
+ hintPosition: Q = "below",
34
+ themePopover: pe = "light",
35
+ popoverAlign: Ie = "left",
36
+ gridLayout: X
37
+ } = n, Se = ge(), be = ge(), [r, w] = v(() => E(n.value?.initial)), [u, M] = v(() => E(n.value?.final)), [Z, _] = v("week"), [C, m] = v(!1), [Y, o] = v(!1), [F, D] = v(!1), [q, A] = v(), [g, ee] = v(), [ne, te] = v("valueInitial"), R = s(null), p = s(null), c = s(null), we = s(null), z = s(null), Me = s(null), S = s(null), l = s(null), h = s(null), B = s(null), N = s(!1), j = () => {
38
+ A(p?.current?.getBoundingClientRect());
39
+ }, Fe = (e) => {
40
+ const t = !R.current?.contains(e.relatedTarget);
41
+ !I && C && t && m(!1), !I && Y && t && o(!1);
42
+ }, ie = (e) => {
42
43
  const {
43
44
  target: t
44
- } = e, u = t;
45
- g.current && e && e.key && e.key === "Escape" && (e.preventDefault(), u.focus(), C && (u.id !== "valueInitial" && f.current?.focus(), d(!1)), Y && (u.id !== "valueFinal" && a.current?.focus(), o(!1)), S && (D(!1), a.current?.focus(), o(!1))), e.stopPropagation();
46
- }, y = () => {
45
+ } = e, a = t;
46
+ h.current && e && e.key && e.key === "Escape" && (e.preventDefault(), a.focus(), C && (a.id !== "valueInitial" && c.current?.focus(), m(!1)), Y && (a.id !== "valueFinal" && l.current?.focus(), o(!1)), F && (D(!1), l.current?.focus(), o(!1))), e.stopPropagation();
47
+ }, k = () => {
47
48
  const e = p.current?.getBoundingClientRect(), t = e && e.bottom;
48
- b && b.current && e && (b.current.style.top = String(t).concat("px"));
49
- }, ne = (e) => {
50
- e === "valueInitial" && (_("valueInitial"), o(!1), C || (f.current?.focus(), I && setTimeout(() => {
51
- q.current?.focus();
52
- }, 100), d(!0))), e === "valueFinal" && (_("valueFinal"), d(!1), Y || (a.current?.focus(), I && setTimeout(() => {
53
- q.current?.focus();
54
- }, 100), o(!0))), p.current && T(p.current.getBoundingClientRect());
55
- }, be = (e) => {
56
- e === "valueInitial" && f.current?.focus(), e === "valueFinal" && a.current?.focus(), d(!1), o(!1);
57
- }, te = (e) => {
58
- const t = e.initial ? e.initial.format("YYYY-MM-DD") : "", u = e.final ? e.final.format("YYYY-MM-DD") : "";
59
- n?.onChange?.(void 0, "", {
49
+ S && S.current && e && (S.current.style.top = String(t).concat("px"));
50
+ }, re = (e) => {
51
+ e === "valueInitial" && (te("valueInitial"), o(!1), C || (c.current?.focus(), I && setTimeout(() => {
52
+ z.current?.focus();
53
+ }, 100), m(!0))), e === "valueFinal" && (te("valueFinal"), m(!1), Y || (l.current?.focus(), I && setTimeout(() => {
54
+ z.current?.focus();
55
+ }, 100), o(!0))), p.current && A(p.current.getBoundingClientRect());
56
+ }, Re = (e) => {
57
+ e === "valueInitial" && c.current?.focus(), e === "valueFinal" && l.current?.focus(), m(!1), o(!1);
58
+ }, oe = (e) => {
59
+ const t = e.initial ? e.initial.format("YYYY-MM-DD") : "", a = e.final ? e.final.format("YYYY-MM-DD") : "";
60
+ B.current = {
60
61
  initial: t,
61
- final: u
62
+ final: a
63
+ }, n?.onChange?.(void 0, "", {
64
+ initial: t,
65
+ final: a
62
66
  });
63
- }, z = (e) => {
67
+ }, U = (e) => {
64
68
  setTimeout(() => {
65
- e === "valueInitial" && (f.current?.focus(), d(!1)), e === "valueFinal" && (a.current?.focus(), o(!1)), e === "periodSelection" && (D(!1), a.current?.focus(), o(!1));
69
+ e === "valueInitial" && (c.current?.focus(), m(!1)), e === "valueFinal" && (l.current?.focus(), o(!1)), e === "periodSelection" && (D(!1), l.current?.focus(), o(!1));
66
70
  }, 100);
67
- }, ie = (e) => {
71
+ }, le = (e) => {
68
72
  const {
69
73
  name: t
70
74
  } = e.target;
71
- ge && ne(t), n.onFocus && n.onFocus(e);
72
- }, le = (e) => {
75
+ De && re(t), n.onFocus && n.onFocus(e);
76
+ }, ae = (e) => {
73
77
  n.onBlur && n.onBlur(e);
74
- }, re = (e) => {
78
+ }, ue = (e) => {
75
79
  if (e) {
76
80
  const {
77
81
  name: t,
78
- value: u
82
+ value: a
79
83
  } = e.target;
80
- String(u).trim().length === 0 && (t === "valueInitial" ? w(void 0) : M(void 0));
84
+ String(a).trim().length === 0 && (t === "valueInitial" ? w(void 0) : M(void 0));
81
85
  }
82
- }, N = (e, t, u = !0) => {
83
- const c = e ? e.target.name : "", k = l(t, "DD/MM/YYYY");
84
- C && f.current?.focus(), Y && a.current?.focus(), c === "valueInitial" ? (w(k), te({
85
- initial: k,
86
- final: s
87
- })) : (M(k), te({
86
+ }, W = (e, t, a = !0) => {
87
+ const f = e ? e.target.name : "", b = d(t, "DD/MM/YYYY");
88
+ C && c.current?.focus(), Y && l.current?.focus(), f === "valueInitial" ? (w(b), oe({
89
+ initial: b,
90
+ final: u
91
+ })) : (M(b), oe({
88
92
  initial: r,
89
- final: k
90
- })), c === "valueInitial" && !s && u && (a.current?.focus(), o(!0)), G && (d(!1), o(!1));
91
- }, j = () => {
93
+ final: b
94
+ })), f === "valueInitial" && !u && a && (l.current?.focus(), o(!0)), J && (m(!1), o(!1));
95
+ }, $ = () => {
92
96
  const {
93
97
  disabled: e
94
98
  } = n;
95
- return e || m && (m.disabled || m.hideContent);
96
- }, we = ce(() => R ? /* @__PURE__ */ i(de, { boxShadow: !1, disabled: j(), customClass: "calendar-button", icon: /* @__PURE__ */ i(W, { name: "calendar" }), onClick: () => {
97
- Y || C ? be(Z) : ne(Z);
99
+ return e || g && (g.disabled || g.hideContent);
100
+ }, Be = he(() => y ? /* @__PURE__ */ i(Ce, { boxShadow: !1, disabled: $(), customClass: "calendar-button", icon: /* @__PURE__ */ i(G, { name: "calendar" }), onClick: () => {
101
+ Y || C ? Re(ne) : re(ne);
98
102
  }, tabIndex: -1, targetRef: (e) => {
99
- De.current = e;
100
- } }, "button-open") : null, [Y, C]), oe = (e, t) => /* @__PURE__ */ i(ye, { selected: e, handleOnSelect: t }), Me = () => {
101
- o(!1), d(!1), D(!0), p.current && T(p.current.getBoundingClientRect());
102
- }, Se = () => {
103
- D(!1), a.current?.focus(), o(!1);
104
- }, Fe = ce(() => /* @__PURE__ */ i(de, { disabled: j(), tabIndex: -1, customClass: "calendar-button", icon: /* @__PURE__ */ i(W, { name: "more1" }), onBlur: () => setTimeout(() => D(!1), 100), onClick: () => S ? Se() : Me(), targetRef: (e) => {
105
- pe.current = e;
106
- } }, "button-select-period"), [S]), O = (e, t, u) => /* @__PURE__ */ i(Oe, { colorStyle: t, currentDate: e !== void 0 ? l(e) : l(), calendarContainer: (c) => {
107
- g.current = c;
108
- }, onDateChange: (c) => N({
103
+ we.current = e;
104
+ } }, "button-open") : null, [Y, C]), se = (e, t) => /* @__PURE__ */ i(je, { selected: e, handleOnSelect: t }), ye = () => {
105
+ o(!1), m(!1), D(!0), p.current && A(p.current.getBoundingClientRect());
106
+ }, Pe = () => {
107
+ D(!1), l.current?.focus(), o(!1);
108
+ }, Oe = he(() => /* @__PURE__ */ i(Ce, { disabled: $(), tabIndex: -1, customClass: "calendar-button", icon: /* @__PURE__ */ i(G, { name: "more1" }), onBlur: () => setTimeout(() => D(!1), 100), onClick: () => F ? Pe() : ye(), targetRef: (e) => {
109
+ Me.current = e;
110
+ } }, "button-select-period"), [F]), x = (e, t, a) => /* @__PURE__ */ i(Ee, { colorStyle: t, currentDate: e !== void 0 ? d(e) : d(), calendarContainer: (f) => {
111
+ h.current = f;
112
+ }, onDateChange: (f) => W({
109
113
  target: {
110
- name: u
114
+ name: a
111
115
  }
112
- }, c), currentDateButton: (c) => q.current = c }), ae = (e, t) => {
116
+ }, f), currentDateButton: (f) => z.current = f }), ce = (e, t) => {
113
117
  if (e === "custom") {
114
- f.current?.focus(), Q(e), D(!1);
118
+ c.current?.focus(), _(e), D(!1);
115
119
  return;
116
120
  }
117
- Q(e), t && (w(t[0]), M(t[1])), G && D(!1), a.current?.focus(), o(!1);
118
- }, Re = () => m && m.readOnly ? null : (g && g.current && (g.current.id = "valueInitial"), I ? /* @__PURE__ */ i($, { handlerClose: () => z("valueInitial"), dialogSize: E, onOpenChange: d, children: O(r, B, "valueInitial") }) : /* @__PURE__ */ i(U, { containerRef: F, showButtonOpen: R, inputDimensions: V, dropdownRef: (e) => {
119
- b.current = e;
120
- }, children: O(r, B, "valueInitial") })), Be = () => m && m.readOnly ? null : (g && g.current && (g.current.id = "valueFinal"), I ? /* @__PURE__ */ i($, { handlerClose: () => z("valueFinal"), dialogSize: E, onOpenChange: o, children: O(s, B, "valueFinal") }) : /* @__PURE__ */ i(U, { containerRef: F, showButtonOpen: R, inputDimensions: V, dropdownRef: (e) => {
121
- b.current = e;
122
- }, children: O(s, B, "valueFinal") })), Pe = () => I ? /* @__PURE__ */ i($, { handlerClose: () => z("periodSelection"), dialogSize: E, onOpenChange: D, children: oe(J, ae) }) : /* @__PURE__ */ i(U, { containerRef: F, showButtonOpen: R, inputDimensions: V, dropdownRef: (e) => {
123
- b.current = e;
124
- }, children: oe(J, ae) });
125
- if (L(() => (window.addEventListener("resize", A), document.addEventListener("scroll", y), document.getElementById("modal-dialog-content")?.addEventListener("scroll", y), p.current && A(), f && f.current && (f.current.id = Ce), a && a.current && (a.current.id = Ye), () => {
126
- window.removeEventListener("resize", A), document.removeEventListener("scroll", y), document.getElementById("modal-dialog-content")?.removeEventListener("scroll", y);
127
- }), []), L(() => (document.addEventListener("keydown", ee), () => {
128
- document.removeEventListener("keydown", ee);
129
- }), [Y, C, S, g.current]), L(() => {
130
- if (s && r && l(s).isBefore(l(r)))
131
- w(s), M(r);
132
- else if (n.onChange) {
133
- const e = r ? r.format("YYYY-MM-DD") : "", t = s ? s.format("YYYY-MM-DD") : "";
134
- n.onChange(void 0, "", {
121
+ _(e), t && (w(t[0]), M(t[1])), J && D(!1), l.current?.focus(), o(!1);
122
+ }, ke = () => g && g.readOnly ? null : (h && h.current && (h.current.id = "valueInitial"), I ? /* @__PURE__ */ i(H, { handlerClose: () => U("valueInitial"), dialogSize: T, onOpenChange: m, children: x(r, P, "valueInitial") }) : /* @__PURE__ */ i(K, { containerRef: R, showButtonOpen: y, inputDimensions: q, dropdownRef: (e) => {
123
+ S.current = e;
124
+ }, children: x(r, P, "valueInitial") })), xe = () => g && g.readOnly ? null : (h && h.current && (h.current.id = "valueFinal"), I ? /* @__PURE__ */ i(H, { handlerClose: () => U("valueFinal"), dialogSize: T, onOpenChange: o, children: x(u, P, "valueFinal") }) : /* @__PURE__ */ i(K, { containerRef: R, showButtonOpen: y, inputDimensions: q, dropdownRef: (e) => {
125
+ S.current = e;
126
+ }, children: x(u, P, "valueFinal") })), Le = () => I ? /* @__PURE__ */ i(H, { handlerClose: () => U("periodSelection"), dialogSize: T, onOpenChange: D, children: se(Z, ce) }) : /* @__PURE__ */ i(K, { containerRef: R, showButtonOpen: y, inputDimensions: q, dropdownRef: (e) => {
127
+ S.current = e;
128
+ }, children: se(Z, ce) });
129
+ V(() => (window.addEventListener("resize", j), document.addEventListener("scroll", k), document.getElementById("modal-dialog-content")?.addEventListener("scroll", k), p.current && j(), c && c.current && (c.current.id = Se), l && l.current && (l.current.id = be), () => {
130
+ window.removeEventListener("resize", j), document.removeEventListener("scroll", k), document.getElementById("modal-dialog-content")?.removeEventListener("scroll", k);
131
+ }), []), V(() => (document.addEventListener("keydown", ie), () => {
132
+ document.removeEventListener("keydown", ie);
133
+ }), [Y, C, F, h.current]), V(() => {
134
+ if (u && r && d(u).isBefore(d(r)))
135
+ w(u), M(r);
136
+ else if (n.onChange && !N.current) {
137
+ const e = r ? r.format("YYYY-MM-DD") : "", t = u ? u.format("YYYY-MM-DD") : "";
138
+ (!B.current || B.current.initial !== e || B.current.final !== t) && (B.current = {
135
139
  initial: e,
136
140
  final: t
137
- });
138
- }
139
- }, [r, s]), L(() => {
140
- if (n.value && !(l(n.value.initial).isSame(r) || l(n.value.final).isSame(s))) {
141
- const {
141
+ }, n.onChange(void 0, "", {
142
142
  initial: e,
143
143
  final: t
144
- } = n.value;
145
- let u, c;
146
- l(e, "YYYY-MM-DD", !0).isValid() && (u = l(e, "YYYY-MM-DD")), l(t, "YYYY-MM-DD", !0).isValid() && (c = l(t, "YYYY-MM-DD")), w(u), M(c);
144
+ }));
147
145
  }
148
- }, [n.value]), m && m.unvisible) return null;
149
- const ue = () => /* @__PURE__ */ x("div", { ref: F, onBlur: Ie, className: "input-base-component datepicker-period-container", children: [
150
- n.label && /* @__PURE__ */ x("div", { className: "labelcontainer", children: [
151
- /* @__PURE__ */ i(me, { required: n.required, className: n.customClassForLabel, labelUppercase: n.labelUppercase }),
146
+ N.current = !1;
147
+ }, [r, u]);
148
+ const fe = d.isMoment(n.value?.initial) ? n.value.initial.format("YYYY-MM-DD") : n.value?.initial?.toString() ?? "", de = d.isMoment(n.value?.final) ? n.value.final.format("YYYY-MM-DD") : n.value?.final?.toString() ?? "";
149
+ if (V(() => {
150
+ const e = E(fe), t = E(de), a = r?.format("YYYY-MM-DD") ?? "", f = u?.format("YYYY-MM-DD") ?? "", b = e?.format("YYYY-MM-DD") ?? "", Ve = t?.format("YYYY-MM-DD") ?? "";
151
+ (a !== b || f !== Ve) && (N.current = !0, w(e), M(t));
152
+ }, [fe, de]), g && g.unvisible) return null;
153
+ const me = () => /* @__PURE__ */ L("div", { ref: R, onBlur: Fe, className: "input-base-component datepicker-period-container", children: [
154
+ n.label && /* @__PURE__ */ L("div", { className: "labelcontainer", children: [
155
+ /* @__PURE__ */ i(Ye, { required: n.required, className: n.customClassForLabel, labelUppercase: n.labelUppercase }),
152
156
  /* @__PURE__ */ i("div", { className: "text-content", style: {
153
157
  display: "flex"
154
- }, children: /* @__PURE__ */ x("div", { className: `label ${n.customClassForLabel} ${n.labelUppercase && " -uppercase"}`, style: {
158
+ }, children: /* @__PURE__ */ L("div", { className: `label ${n.customClassForLabel} ${n.labelUppercase && " -uppercase"}`, style: {
155
159
  alignSelf: "center"
156
160
  }, children: [
157
161
  n.label,
158
162
  n.required && /* @__PURE__ */ i("span", { className: "-requiredlabel", children: "*" }),
159
- !!P && H === "onLabelRight" && /* @__PURE__ */ i(Ve, { theme: ve, align: he, iconColor: "#03bde2", customClass: "-hint", style: {
163
+ !!O && Q === "onLabelRight" && /* @__PURE__ */ i(Ne, { theme: pe, align: Ie, iconColor: "#03bde2", customClass: "-hint", style: {
160
164
  margin: "0px 5px",
161
165
  height: "auto",
162
166
  width: 20
163
- }, children: P })
167
+ }, children: O })
164
168
  ] }) }),
165
- /* @__PURE__ */ i(me, {})
169
+ /* @__PURE__ */ i(Ye, {})
166
170
  ] }),
167
- /* @__PURE__ */ x("div", { className: `periodpicker-component ${Le({
171
+ /* @__PURE__ */ L("div", { className: `periodpicker-component ${Ae({
168
172
  ...n,
169
- value: r ? l(r).format("DD/MM/YYYY") : "",
170
- disabled: j()
173
+ value: r ? d(r).format("DD/MM/YYYY") : "",
174
+ disabled: $()
171
175
  })}`, ref: p, children: [
172
- /* @__PURE__ */ i(fe, { gridLayout: void 0, permissionAttr: n.permissionAttr, name: "valueInitial", value: r ? l(r).format("DD/MM/YYYY") : "", mask: "00/00/0000", onComplete: (e) => {
173
- N(e, e.target.value, !0);
174
- }, onFocus: ie, onBlur: (e) => le(e), onChange: re, inputRef: (e) => {
175
- f.current = e;
176
+ /* @__PURE__ */ i(ve, { autoComplete: "off", gridLayout: void 0, permissionAttr: n.permissionAttr, name: "valueInitial", value: r ? d(r).format("DD/MM/YYYY") : "", mask: "00/00/0000", onComplete: (e) => {
177
+ W(e, e.target.value, !0);
178
+ }, onFocus: le, onBlur: (e) => ae(e), onChange: ue, inputRef: (e) => {
179
+ c.current = e;
176
180
  }, handlerSetOnDenied: (e) => {
177
- X(e);
181
+ ee(e);
178
182
  }, required: n.required }),
179
- /* @__PURE__ */ i(W, { name: "arrow_right", customClass: "separation_icon" }),
180
- /* @__PURE__ */ i(fe, { gridLayout: void 0, permissionAttr: n.permissionAttr, name: "valueFinal", value: s ? l(s).format("DD/MM/YYYY") : "", mask: "00/00/0000", onComplete: (e) => {
181
- N(e, e.target.value, !0);
182
- }, onFocus: ie, onBlur: (e) => le(e), onChange: re, inputRef: (e) => {
183
- a.current = e;
184
- }, handlerSetOnDenied: (e) => X(e), required: n.required }),
185
- we(),
186
- Fe()
183
+ /* @__PURE__ */ i(G, { name: "arrow_right", customClass: "separation_icon" }),
184
+ /* @__PURE__ */ i(ve, { autoComplete: "off", gridLayout: void 0, permissionAttr: n.permissionAttr, name: "valueFinal", value: u ? d(u).format("DD/MM/YYYY") : "", mask: "00/00/0000", onComplete: (e) => {
185
+ W(e, e.target.value, !0);
186
+ }, onFocus: le, onBlur: (e) => ae(e), onChange: ue, inputRef: (e) => {
187
+ l.current = e;
188
+ }, handlerSetOnDenied: (e) => ee(e), required: n.required }),
189
+ Be(),
190
+ Oe()
187
191
  ] }),
188
- C && Re(),
189
- Y && Be(),
190
- S && Pe(),
191
- /* @__PURE__ */ i(ke, { visible: !!P && H === "below", customClass: "hint", description: P }),
192
- /* @__PURE__ */ i(Ee, { messages: n.errorMessages })
192
+ C && ke(),
193
+ Y && xe(),
194
+ F && Le(),
195
+ /* @__PURE__ */ i(Te, { visible: !!O && Q === "below", customClass: "hint", description: O }),
196
+ /* @__PURE__ */ i(ze, { messages: n.errorMessages })
193
197
  ] });
194
- return K ? /* @__PURE__ */ i(xe, { customClass: "-withinput", cols: K, children: ue() }) : ue();
198
+ return X ? /* @__PURE__ */ i(qe, { customClass: "-withinput", cols: X, children: me() }) : me();
195
199
  };
196
200
  export {
197
- tn as default
201
+ cn as default
198
202
  };
199
203
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/lib/inputs/period/index.tsx"],"sourcesContent":["import '../../assets/styles/periodpicker.scss';\n\nimport { useEffect, useRef, useState, FocusEvent as ReactFocusEvent, useCallback, useId } from 'react';\nimport moment, { Moment } from 'moment';\nimport PeriodList from './PeriodList';\nimport BaseMask from '../mask/BaseMask';\nimport Dropdown from './Dropdown';\nimport Calendar from '../../calendar';\nimport Button from '../../buttons';\nimport Icon from '../../icons';\nimport Dialog from './Dialog';\nimport Hint from '../../hint';\nimport Grid from '../../gridlayout';\nimport * as helperBase from '../base/helpers';\nimport { ColorStyles } from '../../@types/ColorStyles';\nimport { OnDenied } from '../../@types/PermissionAttr';\nimport { ChangeInputPeriodEvent, TypeCurrentDate, DateTypes, IPeriodPickerProps } from './types';\nimport { CustomInputEvent } from '../base/types';\nimport { ErrorMessage } from '../errorMessage';\nimport TextContent from '../../textContent';\nimport Popover from '../../popover';\n\nconst PeriodPicker = (props: IPeriodPickerProps) => {\n const {\n showButtonOpen = true, openOnFocus = true, shouldCloseOnSelect = true, calendarColorStyle,\n showCalendarInDialog = false, dialogSize = { width: '350px', height: '350px' }, hint, hintPosition = 'below',\n themePopover = 'light', popoverAlign = 'left', gridLayout,\n } = props;\n const idValueInitial = useId();\n const idValueFinal = useId();\n\n const [valueInitial, setValueInitial] = useState<moment.Moment | undefined>(props.value && moment(props.value.initial, 'DD/MM/YYYY'));\n const [valueFinal, setValueFinal] = useState<moment.Moment | undefined>(props.value && moment(props.value.final, 'DD/MM/YYYY'));\n const [valuePeriodSelection, setValuePeriodSelection] = useState('week');\n const [showCalendarValueInitial, setShowCalendarValueInitial] = useState(false);\n const [showCalendarValueFinal, setShowCalendarValueFinal] = useState(false);\n const [showPeriodSelection, setShowPeriodSelection] = useState(false);\n const [inputDimensions, setInputDimensions] = useState<DOMRect>();\n const [onDenied, setOnDenied] = useState<OnDenied>();\n const [currentTypeDate, setCurrentTypeDate] = useState<TypeCurrentDate>('valueInitial');\n\n const wrapperBaseInputPeriodRef = useRef<HTMLDivElement | null>(null);\n const inputContainerRef = useRef<HTMLDivElement>(null);\n const inputInitialRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);\n const buttonOpenRef = useRef<HTMLButtonElement | null>(null);\n const currentDateButtonRef = useRef<HTMLButtonElement>(null);\n const buttonSelectPeriodRef = useRef<HTMLButtonElement | null>(null);\n const dropdownCalendarContainer = useRef<HTMLDivElement | null>(null);\n const inputFinalRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);\n const calendarContainerRef = useRef<HTMLDivElement | null>(null);\n\n const onScreenResize = () => {\n setInputDimensions(inputContainerRef?.current?.getBoundingClientRect());\n };\n\n const onBlurWithoutWrapper = (event: ReactFocusEvent<HTMLDivElement>) => {\n const focusOnAnotherField = !wrapperBaseInputPeriodRef.current?.contains(event.relatedTarget);\n if (!showCalendarInDialog && showCalendarValueInitial && focusOnAnotherField) { \n setShowCalendarValueInitial(false); \n }\n if (!showCalendarInDialog && showCalendarValueFinal && focusOnAnotherField) { \n setShowCalendarValueFinal(false); \n }\n };\n\n const onKeyDownPress = (event: KeyboardEvent) => {\n const { target } = event;\n const targetElement = target as HTMLInputElement;\n if (calendarContainerRef.current && event && event.key && event.key === 'Escape') {\n event.preventDefault();\n targetElement.focus();\n if (showCalendarValueInitial) {\n if (targetElement.id !== 'valueInitial') {\n inputInitialRef.current?.focus();\n }\n setShowCalendarValueInitial(false);\n }\n if (showCalendarValueFinal) {\n if (targetElement.id !== 'valueFinal') {\n inputFinalRef.current?.focus();\n }\n setShowCalendarValueFinal(false);\n }\n\n if (showPeriodSelection) {\n setShowPeriodSelection(false);\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n }\n }\n event.stopPropagation();\n };\n\n const keepPositionCalendarByScroll = () => {\n const inputDateDimensions = inputContainerRef.current?.getBoundingClientRect();\n const positionTop = inputDateDimensions && inputDateDimensions.bottom;\n if (dropdownCalendarContainer && dropdownCalendarContainer.current && inputDateDimensions) {\n dropdownCalendarContainer.current.style.top = String(positionTop).concat('px');\n }\n };\n\n const openCalendar = (calendarName: string) => {\n if (calendarName === 'valueInitial') {\n setCurrentTypeDate('valueInitial');\n setShowCalendarValueFinal(false);\n if (!showCalendarValueInitial) {\n inputInitialRef.current?.focus();\n if (showCalendarInDialog) {\n setTimeout(() => {\n currentDateButtonRef.current?.focus();\n }, 100);\n }\n setShowCalendarValueInitial(true);\n }\n }\n if (calendarName === 'valueFinal') {\n setCurrentTypeDate('valueFinal');\n setShowCalendarValueInitial(false);\n if (!showCalendarValueFinal) {\n inputFinalRef.current?.focus();\n if (showCalendarInDialog) {\n setTimeout(() => {\n currentDateButtonRef.current?.focus();\n }, 100);\n }\n setShowCalendarValueFinal(true);\n }\n }\n if (inputContainerRef.current) {\n setInputDimensions(inputContainerRef.current.getBoundingClientRect());\n }\n };\n\n const closeCalendar = (calendarName: TypeCurrentDate) => {\n if (calendarName === 'valueInitial') { inputInitialRef.current?.focus(); }\n if (calendarName === 'valueFinal') { inputFinalRef.current?.focus(); }\n setShowCalendarValueInitial(false);\n setShowCalendarValueFinal(false);\n };\n\n const onDateChange = (date: { initial?: Moment, final?: Moment }) => {\n const initial = date.initial ? date.initial.format('YYYY-MM-DD') : '';\n const final = date.final ? date.final.format('YYYY-MM-DD') : '';\n props?.onChange?.(undefined, '', { initial, final });\n };\n\n const onCloseDateDialog = (calendarName: TypeCurrentDate | 'periodSelection') => {\n setTimeout(() => {\n if (calendarName === 'valueInitial') {\n inputInitialRef.current?.focus();\n setShowCalendarValueInitial(false);\n }\n if (calendarName === 'valueFinal') {\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n }\n if (calendarName === 'periodSelection') {\n setShowPeriodSelection(false);\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n }\n }, 100);\n };\n\n const onInputFocus = (e: CustomInputEvent) => {\n const { name } = e.target as HTMLInputElement;\n\n if (openOnFocus) openCalendar(name);\n if (props.onFocus) props.onFocus(e);\n };\n\n const onInputBlur = (e: CustomInputEvent) => {\n if (props.onBlur) props.onBlur(e);\n };\n\n const onInputChange = (event?: ChangeInputPeriodEvent) => {\n if (event) {\n const { name: changingAux, value } = event.target as HTMLInputElement;\n if (String(value).trim().length === 0) {\n if (changingAux === 'valueInitial') {\n setValueInitial(undefined);\n } else {\n setValueFinal(undefined);\n }\n }\n }\n };\n\n const setValue = (\n event: ChangeInputPeriodEvent,\n value?: Moment | string,\n shouldOpenDropdown = true,\n ) => {\n const valueDateName = event ? event.target.name : '';\n const dateObj = moment(value, 'DD/MM/YYYY');\n if (showCalendarValueInitial) inputInitialRef.current?.focus();\n if (showCalendarValueFinal) inputFinalRef.current?.focus();\n\n if (valueDateName === 'valueInitial') {\n setValueInitial(dateObj);\n onDateChange({ initial: dateObj, final: valueFinal });\n } else {\n setValueFinal(dateObj);\n onDateChange({ initial: valueInitial, final: dateObj });\n }\n\n if (valueDateName === 'valueInitial' && !valueFinal && shouldOpenDropdown) {\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(true);\n }\n\n if (shouldCloseOnSelect) {\n setShowCalendarValueInitial(false);\n setShowCalendarValueFinal(false);\n }\n };\n\n const shouldDisable = () => {\n const { disabled } = props;\n return disabled || (onDenied && (onDenied.disabled || onDenied.hideContent));\n };\n\n const getButtonOpen = useCallback(() => {\n if (!showButtonOpen) return null;\n\n return (\n <Button\n key=\"button-open\"\n boxShadow={false}\n disabled={shouldDisable()}\n customClass=\"calendar-button\"\n icon={<Icon name=\"calendar\" />}\n onClick={() => {\n if (showCalendarValueFinal || showCalendarValueInitial) {\n closeCalendar(currentTypeDate);\n } else {\n openCalendar(currentTypeDate);\n }\n }}\n tabIndex={-1}\n targetRef={(ref) => { buttonOpenRef.current = ref; }} />\n );\n }, [showCalendarValueFinal, showCalendarValueInitial]);\n\n const getPeriodSelection = (\n valuePeriodSelectionAux: string,\n setPeriodDates: (value: DateTypes | 'custom', date: Moment[] | null) => void,\n ) => (\n <PeriodList selected={valuePeriodSelectionAux} handleOnSelect={setPeriodDates} />\n );\n\n const openPeriodSelecion = () => {\n setShowCalendarValueFinal(false);\n setShowCalendarValueInitial(false);\n setShowPeriodSelection(true);\n if (inputContainerRef.current) {\n setInputDimensions(inputContainerRef.current.getBoundingClientRect());\n }\n };\n\n const closePeriodSelection = () => {\n setShowPeriodSelection(false);\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n };\n\n const getButtonSelectPeriod = useCallback(() => {\n return (\n <Button\n key=\"button-select-period\"\n disabled={shouldDisable()}\n tabIndex={-1}\n customClass=\"calendar-button\"\n icon={<Icon name=\"more1\" />}\n onBlur={() => setTimeout(() => setShowPeriodSelection(false), 100)}\n onClick={() => !showPeriodSelection ? openPeriodSelecion() : closePeriodSelection()}\n targetRef={(ref) => { buttonSelectPeriodRef.current = ref; }} />\n );\n }, [showPeriodSelection]);\n\n const getCalendar = (\n value?: Moment,\n calendarColorStyleCalendar?: ColorStyles,\n valueDateName?: string,\n ) => (\n <Calendar\n colorStyle={calendarColorStyleCalendar}\n currentDate={value !== undefined ? moment(value) : moment()}\n calendarContainer={(ref) => { calendarContainerRef.current = ref; }}\n onDateChange={date => setValue({ target: { name: valueDateName } }, date)}\n currentDateButton={buttonElement => currentDateButtonRef.current = buttonElement} />\n );\n\n const setPeriodDates = (selected: DateTypes | 'custom', dates: Moment[] | null) => {\n if (selected === 'custom') {\n inputInitialRef.current?.focus();\n setValuePeriodSelection(selected);\n setShowPeriodSelection(false);\n return;\n }\n\n setValuePeriodSelection(selected);\n if (dates) {\n setValueInitial(dates[0]);\n setValueFinal(dates[1]);\n }\n\n if (shouldCloseOnSelect) {\n setShowPeriodSelection(false);\n }\n\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n };\n\n const getCalendarInitial = () => {\n if (onDenied && onDenied.readOnly) return null;\n if (calendarContainerRef && calendarContainerRef.current) calendarContainerRef.current.id = 'valueInitial';\n if (showCalendarInDialog) {\n return (\n <Dialog\n handlerClose={() => onCloseDateDialog('valueInitial')}\n dialogSize={dialogSize}\n onOpenChange={setShowCalendarValueInitial}>\n {getCalendar(valueInitial, calendarColorStyle, 'valueInitial')}\n </Dialog>\n );\n }\n return (\n <Dropdown\n containerRef={wrapperBaseInputPeriodRef as any}\n showButtonOpen={showButtonOpen}\n inputDimensions={inputDimensions}\n dropdownRef={(el: HTMLDivElement) => { dropdownCalendarContainer.current = el; }}>\n {getCalendar(valueInitial, calendarColorStyle, 'valueInitial')}\n </Dropdown>\n );\n };\n\n const getCalendarFinal = () => {\n if (onDenied && onDenied.readOnly) return null;\n if (calendarContainerRef && calendarContainerRef.current) calendarContainerRef.current.id = 'valueFinal';\n if (showCalendarInDialog) {\n return (\n <Dialog\n handlerClose={() => onCloseDateDialog('valueFinal')}\n dialogSize={dialogSize}\n onOpenChange={setShowCalendarValueFinal}>\n {getCalendar(valueFinal, calendarColorStyle, 'valueFinal')}\n </Dialog>\n );\n }\n return (\n <Dropdown\n containerRef={wrapperBaseInputPeriodRef as any}\n showButtonOpen={showButtonOpen}\n inputDimensions={inputDimensions}\n dropdownRef={(el: HTMLDivElement) => { dropdownCalendarContainer.current = el; }}>\n {getCalendar(valueFinal, calendarColorStyle, 'valueFinal')}\n </Dropdown>\n );\n };\n\n const getPeriodOfDatesSelection = () => {\n if (showCalendarInDialog) {\n return (\n <Dialog\n handlerClose={() => onCloseDateDialog('periodSelection')}\n dialogSize={dialogSize}\n onOpenChange={setShowPeriodSelection}>\n {getPeriodSelection(valuePeriodSelection, setPeriodDates)}\n </Dialog>\n );\n }\n return (\n <Dropdown\n containerRef={wrapperBaseInputPeriodRef as any}\n showButtonOpen={showButtonOpen}\n inputDimensions={inputDimensions}\n dropdownRef={(el: HTMLDivElement) => { dropdownCalendarContainer.current = el; }}>\n {getPeriodSelection(valuePeriodSelection, setPeriodDates)}\n </Dropdown>\n );\n };\n\n useEffect(() => {\n window.addEventListener('resize', onScreenResize);\n document.addEventListener('scroll', keepPositionCalendarByScroll);\n document.getElementById('modal-dialog-content')?.addEventListener('scroll', keepPositionCalendarByScroll);\n\n if (inputContainerRef.current) onScreenResize();\n\n if (inputInitialRef && inputInitialRef.current) inputInitialRef.current.id = idValueInitial;\n if (inputFinalRef && inputFinalRef.current) inputFinalRef.current.id = idValueFinal;\n\n return () => {\n window.removeEventListener('resize', onScreenResize);\n document.removeEventListener('scroll', keepPositionCalendarByScroll);\n document.getElementById('modal-dialog-content')?.removeEventListener('scroll', keepPositionCalendarByScroll);\n };\n }, []);\n\n useEffect(() => {\n document.addEventListener('keydown', onKeyDownPress);\n return () => {\n document.removeEventListener('keydown', onKeyDownPress);\n };\n }, [\n showCalendarValueFinal,\n showCalendarValueInitial,\n showPeriodSelection,\n calendarContainerRef.current,\n ]);\n\n useEffect(() => {\n if (valueFinal && valueInitial && moment(valueFinal).isBefore(moment(valueInitial))) {\n setValueInitial(valueFinal);\n setValueFinal(valueInitial);\n } else if (props.onChange) {\n const initial = valueInitial ? valueInitial.format('YYYY-MM-DD') : '';\n const final = valueFinal ? valueFinal.format('YYYY-MM-DD') : '';\n props.onChange(undefined, '', { initial, final });\n }\n }, [valueInitial, valueFinal]);\n\n useEffect(() => {\n if (props.value && !(moment(props.value.initial).isSame(valueInitial) ||\n moment(props.value.final).isSame(valueFinal))) {\n const { initial: valueInitialProp, final: valueFinalProp } = props.value;\n\n let newValueInitial;\n let newValueFinal;\n\n if (moment(valueInitialProp, 'YYYY-MM-DD', true).isValid()) {\n newValueInitial = moment(valueInitialProp, 'YYYY-MM-DD');\n }\n\n if (moment(valueFinalProp, 'YYYY-MM-DD', true).isValid()) {\n newValueFinal = moment(valueFinalProp, 'YYYY-MM-DD');\n }\n setValueInitial(newValueInitial);\n setValueFinal(newValueFinal);\n }\n }, [props.value]);\n\n if (onDenied && onDenied.unvisible) return null;\n\n const component = () => (\n <div\n ref={wrapperBaseInputPeriodRef}\n onBlur={onBlurWithoutWrapper}\n className=\"input-base-component datepicker-period-container\">\n {props.label && (\n <div className=\"labelcontainer\">\n <TextContent\n required={props.required}\n className={props.customClassForLabel}\n labelUppercase={props.labelUppercase} />\n <div className=\"text-content\" style={{ display: 'flex' }}>\n <div\n className={`label ${props.customClassForLabel} ${props.labelUppercase && ' -uppercase'}`}\n style={{ alignSelf: 'center' }}>\n {props.label}\n {props.required && <span className=\"-requiredlabel\">*</span>}\n {!!hint && hintPosition === 'onLabelRight' && (\n <Popover\n theme={themePopover}\n align={popoverAlign}\n iconColor=\"#03bde2\"\n customClass=\"-hint\"\n style={{ margin: '0px 5px', height: 'auto', width: 20 }}>\n {hint}\n </Popover>\n )}\n </div>\n </div>\n <TextContent />\n </div>\n )}\n <div\n className={\n `periodpicker-component ${helperBase.getInputWrapperClass({\n ...props,\n value: !valueInitial ? '' : moment(valueInitial).format('DD/MM/YYYY'),\n disabled: shouldDisable(),\n })\n }`\n }\n ref={inputContainerRef}>\n <BaseMask\n gridLayout={undefined}\n permissionAttr={props.permissionAttr}\n name='valueInitial'\n value={!valueInitial ? '' : moment(valueInitial).format('DD/MM/YYYY')}\n mask=\"00/00/0000\"\n onComplete={(e: CustomInputEvent) => { setValue(e, e.target.value, true); }}\n onFocus={onInputFocus}\n onBlur={e => onInputBlur(e)}\n onChange={onInputChange}\n inputRef={(el) => { inputInitialRef.current = el; }}\n handlerSetOnDenied={(denied: OnDenied) => { setOnDenied(denied);}}\n required={props.required} />\n <Icon name=\"arrow_right\" customClass=\"separation_icon\" />\n <BaseMask\n gridLayout={undefined}\n permissionAttr={props.permissionAttr}\n name='valueFinal'\n value={!valueFinal ? '' : moment(valueFinal).format('DD/MM/YYYY')}\n mask=\"00/00/0000\"\n onComplete={(e: CustomInputEvent) => { setValue(e, e.target.value, true); }}\n onFocus={onInputFocus}\n onBlur={e => onInputBlur(e)}\n onChange={onInputChange}\n inputRef={(el) => { inputFinalRef.current = el; }}\n handlerSetOnDenied={(denied: OnDenied) => setOnDenied(denied)}\n required={props.required} />\n {getButtonOpen()}\n {getButtonSelectPeriod()}\n </div>\n {showCalendarValueInitial && getCalendarInitial()}\n {showCalendarValueFinal && getCalendarFinal()}\n {showPeriodSelection && getPeriodOfDatesSelection()}\n <Hint visible={!!hint && hintPosition === 'below'} customClass=\"hint\" description={hint} />\n <ErrorMessage messages={props.errorMessages} />\n </div>\n );\n\n return (!gridLayout ? component() : <Grid customClass=\"-withinput\" cols={gridLayout}>{component()}</Grid>);\n};\n\nexport default PeriodPicker;\n"],"names":["PeriodPicker","props","showButtonOpen","openOnFocus","shouldCloseOnSelect","calendarColorStyle","showCalendarInDialog","dialogSize","width","height","hint","hintPosition","themePopover","popoverAlign","gridLayout","idValueInitial","useId","idValueFinal","valueInitial","setValueInitial","useState","value","moment","initial","valueFinal","setValueFinal","final","valuePeriodSelection","setValuePeriodSelection","showCalendarValueInitial","setShowCalendarValueInitial","showCalendarValueFinal","setShowCalendarValueFinal","showPeriodSelection","setShowPeriodSelection","inputDimensions","setInputDimensions","onDenied","setOnDenied","currentTypeDate","setCurrentTypeDate","wrapperBaseInputPeriodRef","useRef","inputContainerRef","inputInitialRef","buttonOpenRef","currentDateButtonRef","buttonSelectPeriodRef","dropdownCalendarContainer","inputFinalRef","calendarContainerRef","onScreenResize","current","getBoundingClientRect","onBlurWithoutWrapper","event","focusOnAnotherField","contains","relatedTarget","onKeyDownPress","target","targetElement","key","preventDefault","focus","id","stopPropagation","keepPositionCalendarByScroll","inputDateDimensions","positionTop","bottom","style","top","String","concat","openCalendar","calendarName","setTimeout","closeCalendar","onDateChange","date","format","onChange","undefined","onCloseDateDialog","onInputFocus","e","name","onFocus","onInputBlur","onBlur","onInputChange","changingAux","trim","length","setValue","shouldOpenDropdown","valueDateName","dateObj","shouldDisable","disabled","hideContent","getButtonOpen","useCallback","Button","Icon","ref","getPeriodSelection","valuePeriodSelectionAux","setPeriodDates","PeriodList","openPeriodSelecion","closePeriodSelection","getButtonSelectPeriod","jsx","getCalendar","calendarColorStyleCalendar","Calendar","buttonElement","selected","dates","getCalendarInitial","readOnly","Dialog","Dropdown","el","getCalendarFinal","getPeriodOfDatesSelection","useEffect","window","addEventListener","document","getElementById","removeEventListener","isBefore","isSame","valueInitialProp","valueFinalProp","newValueInitial","newValueFinal","isValid","unvisible","component","jsxs","label","TextContent","required","customClassForLabel","labelUppercase","display","alignSelf","Popover","margin","helperBase","BaseMask","permissionAttr","denied","Hint","ErrorMessage","errorMessages","Grid"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,KAAeA,CAACC,MAA8B;AAClD,QAAM;AAAA,IACJC,gBAAAA,IAAiB;AAAA,IAAMC,aAAAA,KAAc;AAAA,IAAMC,qBAAAA,IAAsB;AAAA,IAAMC,oBAAAA;AAAAA,IACvEC,sBAAAA,IAAuB;AAAA,IAAOC,YAAAA,IAAa;AAAA,MAAEC,OAAO;AAAA,MAASC,QAAQ;AAAA,IAAA;AAAA,IAAWC,MAAAA;AAAAA,IAAMC,cAAAA,IAAe;AAAA,IACrGC,cAAAA,KAAe;AAAA,IAASC,cAAAA,KAAe;AAAA,IAAQC,YAAAA;AAAAA,EAAAA,IAC7Cb,GACEc,KAAiBC,GAAAA,GACjBC,KAAeD,GAAAA,GAEf,CAACE,GAAcC,CAAe,IAAIC,EAAoCnB,EAAMoB,SAASC,EAAOrB,EAAMoB,MAAME,SAAS,YAAY,CAAC,GAC9H,CAACC,GAAYC,CAAa,IAAIL,EAAoCnB,EAAMoB,SAASC,EAAOrB,EAAMoB,MAAMK,OAAO,YAAY,CAAC,GACxH,CAACC,GAAsBC,CAAuB,IAAIR,EAAS,MAAM,GACjE,CAACS,GAA0BC,CAA2B,IAAIV,EAAS,EAAK,GACxE,CAACW,GAAwBC,CAAyB,IAAIZ,EAAS,EAAK,GACpE,CAACa,GAAqBC,CAAsB,IAAId,EAAS,EAAK,GAC9D,CAACe,GAAiBC,CAAkB,IAAIhB,EAAAA,GACxC,CAACiB,GAAUC,CAAW,IAAIlB,EAAAA,GAC1B,CAACmB,GAAiBC,CAAkB,IAAIpB,E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GAAAA;AAAAA,IACxB,gBAAAb,EAAC2C,IAAA,EAAK,SAAS,CAAC,CAACnJ,KAAQC,MAAiB,SAAS,aAAY,QAAO,aAAaD,EAAAA,CAAK;AAAA,IACxF,gBAAAwG,EAAC4C,IAAA,EAAa,UAAU7J,EAAM8J,cAAAA,CAAc;AAAA,EAAA,GAC9C;AAGF,SAASjJ,IAA2B,gBAAAoG,EAAC8C,IAAA,EAAK,aAAY,cAAa,MAAMlJ,GAAagI,UAAAA,GAAAA,EAAU,CAAE,IAA5EA;AACxB;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/lib/inputs/period/index.tsx"],"sourcesContent":["import '../../assets/styles/periodpicker.scss';\n\nimport { useEffect, useRef, useState, FocusEvent as ReactFocusEvent, useCallback, useId } from 'react';\nimport moment, { Moment } from 'moment';\nimport BaseMask from '../mask/BaseMask';\nimport Calendar from '../../calendar';\nimport Button from '../../buttons';\nimport Icon from '../../icons';\nimport Hint from '../../hint';\nimport Grid from '../../gridlayout';\nimport * as helperBase from '../base/helpers';\nimport { ColorStyles } from '../../@types/ColorStyles';\nimport { OnDenied } from '../../@types/PermissionAttr';\nimport { CustomInputEvent } from '../base/types';\nimport { ErrorMessage } from '../errorMessage';\nimport TextContent from '../../textContent';\nimport Popover from '../../popover';\nimport Dialog from './Dialog';\nimport Dropdown from './Dropdown';\nimport PeriodList from './PeriodList';\nimport { parseDateValue } from './helper';\nimport { ChangeInputPeriodEvent, TypeCurrentDate, DateTypes, IPeriodPickerProps } from './types';\n\nconst PeriodPicker = (props: IPeriodPickerProps) => {\n const {\n showButtonOpen = true, openOnFocus = true, shouldCloseOnSelect = true, calendarColorStyle,\n showCalendarInDialog = false, dialogSize = { width: '350px', height: '350px' }, hint, hintPosition = 'below',\n themePopover = 'light', popoverAlign = 'left', gridLayout,\n } = props;\n const idValueInitial = useId();\n const idValueFinal = useId();\n\n const [valueInitial, setValueInitial] = useState<moment.Moment | undefined>(\n () => parseDateValue(props.value?.initial),\n );\n const [valueFinal, setValueFinal] = useState<moment.Moment | undefined>(\n () => parseDateValue(props.value?.final),\n );\n const [valuePeriodSelection, setValuePeriodSelection] = useState('week');\n const [showCalendarValueInitial, setShowCalendarValueInitial] = useState(false);\n const [showCalendarValueFinal, setShowCalendarValueFinal] = useState(false);\n const [showPeriodSelection, setShowPeriodSelection] = useState(false);\n const [inputDimensions, setInputDimensions] = useState<DOMRect>();\n const [onDenied, setOnDenied] = useState<OnDenied>();\n const [currentTypeDate, setCurrentTypeDate] = useState<TypeCurrentDate>('valueInitial');\n\n const wrapperBaseInputPeriodRef = useRef<HTMLDivElement | null>(null);\n const inputContainerRef = useRef<HTMLDivElement>(null);\n const inputInitialRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);\n const buttonOpenRef = useRef<HTMLButtonElement | null>(null);\n const currentDateButtonRef = useRef<HTMLButtonElement>(null);\n const buttonSelectPeriodRef = useRef<HTMLButtonElement | null>(null);\n const dropdownCalendarContainer = useRef<HTMLDivElement | null>(null);\n const inputFinalRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);\n const calendarContainerRef = useRef<HTMLDivElement | null>(null);\n const lastPeriodChanged = useRef<{ initial: string; final: string } | null>(null);\n const isSyncingFromProps = useRef(false);\n\n const onScreenResize = () => {\n setInputDimensions(inputContainerRef?.current?.getBoundingClientRect());\n };\n\n const onBlurWithoutWrapper = (event: ReactFocusEvent<HTMLDivElement>) => {\n const focusOnAnotherField = !wrapperBaseInputPeriodRef.current?.contains(event.relatedTarget);\n if (!showCalendarInDialog && showCalendarValueInitial && focusOnAnotherField) { \n setShowCalendarValueInitial(false); \n }\n if (!showCalendarInDialog && showCalendarValueFinal && focusOnAnotherField) { \n setShowCalendarValueFinal(false); \n }\n };\n\n const onKeyDownPress = (event: KeyboardEvent) => {\n const { target } = event;\n const targetElement = target as HTMLInputElement;\n if (calendarContainerRef.current && event && event.key && event.key === 'Escape') {\n event.preventDefault();\n targetElement.focus();\n if (showCalendarValueInitial) {\n if (targetElement.id !== 'valueInitial') {\n inputInitialRef.current?.focus();\n }\n setShowCalendarValueInitial(false);\n }\n if (showCalendarValueFinal) {\n if (targetElement.id !== 'valueFinal') {\n inputFinalRef.current?.focus();\n }\n setShowCalendarValueFinal(false);\n }\n\n if (showPeriodSelection) {\n setShowPeriodSelection(false);\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n }\n }\n event.stopPropagation();\n };\n\n const keepPositionCalendarByScroll = () => {\n const inputDateDimensions = inputContainerRef.current?.getBoundingClientRect();\n const positionTop = inputDateDimensions && inputDateDimensions.bottom;\n if (dropdownCalendarContainer && dropdownCalendarContainer.current && inputDateDimensions) {\n dropdownCalendarContainer.current.style.top = String(positionTop).concat('px');\n }\n };\n\n const openCalendar = (calendarName: string) => {\n if (calendarName === 'valueInitial') {\n setCurrentTypeDate('valueInitial');\n setShowCalendarValueFinal(false);\n if (!showCalendarValueInitial) {\n inputInitialRef.current?.focus();\n if (showCalendarInDialog) {\n setTimeout(() => {\n currentDateButtonRef.current?.focus();\n }, 100);\n }\n setShowCalendarValueInitial(true);\n }\n }\n if (calendarName === 'valueFinal') {\n setCurrentTypeDate('valueFinal');\n setShowCalendarValueInitial(false);\n if (!showCalendarValueFinal) {\n inputFinalRef.current?.focus();\n if (showCalendarInDialog) {\n setTimeout(() => {\n currentDateButtonRef.current?.focus();\n }, 100);\n }\n setShowCalendarValueFinal(true);\n }\n }\n if (inputContainerRef.current) {\n setInputDimensions(inputContainerRef.current.getBoundingClientRect());\n }\n };\n\n const closeCalendar = (calendarName: TypeCurrentDate) => {\n if (calendarName === 'valueInitial') { inputInitialRef.current?.focus(); }\n if (calendarName === 'valueFinal') { inputFinalRef.current?.focus(); }\n setShowCalendarValueInitial(false);\n setShowCalendarValueFinal(false);\n };\n\n const onDateChange = (date: { initial?: Moment, final?: Moment }) => {\n const initial = date.initial ? date.initial.format('YYYY-MM-DD') : '';\n const final = date.final ? date.final.format('YYYY-MM-DD') : '';\n lastPeriodChanged.current = { initial, final };\n props?.onChange?.(undefined, '', { initial, final });\n };\n\n const onCloseDateDialog = (calendarName: TypeCurrentDate | 'periodSelection') => {\n setTimeout(() => {\n if (calendarName === 'valueInitial') {\n inputInitialRef.current?.focus();\n setShowCalendarValueInitial(false);\n }\n if (calendarName === 'valueFinal') {\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n }\n if (calendarName === 'periodSelection') {\n setShowPeriodSelection(false);\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n }\n }, 100);\n };\n\n const onInputFocus = (e: CustomInputEvent) => {\n const { name } = e.target as HTMLInputElement;\n\n if (openOnFocus) openCalendar(name);\n if (props.onFocus) props.onFocus(e);\n };\n\n const onInputBlur = (e: CustomInputEvent) => {\n if (props.onBlur) props.onBlur(e);\n };\n\n const onInputChange = (event?: ChangeInputPeriodEvent) => {\n if (event) {\n const { name: changingAux, value } = event.target as HTMLInputElement;\n if (String(value).trim().length === 0) {\n if (changingAux === 'valueInitial') {\n setValueInitial(undefined);\n } else {\n setValueFinal(undefined);\n }\n }\n }\n };\n\n const setValue = (\n event: ChangeInputPeriodEvent,\n value?: Moment | string,\n shouldOpenDropdown = true,\n ) => {\n const valueDateName = event ? event.target.name : '';\n const dateObj = moment(value, 'DD/MM/YYYY');\n if (showCalendarValueInitial) inputInitialRef.current?.focus();\n if (showCalendarValueFinal) inputFinalRef.current?.focus();\n\n if (valueDateName === 'valueInitial') {\n setValueInitial(dateObj);\n onDateChange({ initial: dateObj, final: valueFinal });\n } else {\n setValueFinal(dateObj);\n onDateChange({ initial: valueInitial, final: dateObj });\n }\n\n if (valueDateName === 'valueInitial' && !valueFinal && shouldOpenDropdown) {\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(true);\n }\n\n if (shouldCloseOnSelect) {\n setShowCalendarValueInitial(false);\n setShowCalendarValueFinal(false);\n }\n };\n\n const shouldDisable = () => {\n const { disabled } = props;\n return disabled || (onDenied && (onDenied.disabled || onDenied.hideContent));\n };\n\n const getButtonOpen = useCallback(() => {\n if (!showButtonOpen) return null;\n\n return (\n <Button\n key=\"button-open\"\n boxShadow={false}\n disabled={shouldDisable()}\n customClass=\"calendar-button\"\n icon={<Icon name=\"calendar\" />}\n onClick={() => {\n if (showCalendarValueFinal || showCalendarValueInitial) {\n closeCalendar(currentTypeDate);\n } else {\n openCalendar(currentTypeDate);\n }\n }}\n tabIndex={-1}\n targetRef={(ref) => { buttonOpenRef.current = ref; }} />\n );\n }, [showCalendarValueFinal, showCalendarValueInitial]);\n\n const getPeriodSelection = (\n valuePeriodSelectionAux: string,\n setPeriodDates: (value: DateTypes | 'custom', date: Moment[] | null) => void,\n ) => (\n <PeriodList selected={valuePeriodSelectionAux} handleOnSelect={setPeriodDates} />\n );\n\n const openPeriodSelecion = () => {\n setShowCalendarValueFinal(false);\n setShowCalendarValueInitial(false);\n setShowPeriodSelection(true);\n if (inputContainerRef.current) {\n setInputDimensions(inputContainerRef.current.getBoundingClientRect());\n }\n };\n\n const closePeriodSelection = () => {\n setShowPeriodSelection(false);\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n };\n\n const getButtonSelectPeriod = useCallback(() => {\n return (\n <Button\n key=\"button-select-period\"\n disabled={shouldDisable()}\n tabIndex={-1}\n customClass=\"calendar-button\"\n icon={<Icon name=\"more1\" />}\n onBlur={() => setTimeout(() => setShowPeriodSelection(false), 100)}\n onClick={() => !showPeriodSelection ? openPeriodSelecion() : closePeriodSelection()}\n targetRef={(ref) => { buttonSelectPeriodRef.current = ref; }} />\n );\n }, [showPeriodSelection]);\n\n const getCalendar = (\n value?: Moment,\n calendarColorStyleCalendar?: ColorStyles,\n valueDateName?: string,\n ) => (\n <Calendar\n colorStyle={calendarColorStyleCalendar}\n currentDate={value !== undefined ? moment(value) : moment()}\n calendarContainer={(ref) => { calendarContainerRef.current = ref; }}\n onDateChange={date => setValue({ target: { name: valueDateName } }, date)}\n currentDateButton={buttonElement => currentDateButtonRef.current = buttonElement} />\n );\n\n const setPeriodDates = (selected: DateTypes | 'custom', dates: Moment[] | null) => {\n if (selected === 'custom') {\n inputInitialRef.current?.focus();\n setValuePeriodSelection(selected);\n setShowPeriodSelection(false);\n return;\n }\n\n setValuePeriodSelection(selected);\n if (dates) {\n setValueInitial(dates[0]);\n setValueFinal(dates[1]);\n }\n\n if (shouldCloseOnSelect) {\n setShowPeriodSelection(false);\n }\n\n inputFinalRef.current?.focus();\n setShowCalendarValueFinal(false);\n };\n\n const getCalendarInitial = () => {\n if (onDenied && onDenied.readOnly) return null;\n if (calendarContainerRef && calendarContainerRef.current) calendarContainerRef.current.id = 'valueInitial';\n if (showCalendarInDialog) {\n return (\n <Dialog\n handlerClose={() => onCloseDateDialog('valueInitial')}\n dialogSize={dialogSize}\n onOpenChange={setShowCalendarValueInitial}>\n {getCalendar(valueInitial, calendarColorStyle, 'valueInitial')}\n </Dialog>\n );\n }\n return (\n <Dropdown\n containerRef={wrapperBaseInputPeriodRef as any}\n showButtonOpen={showButtonOpen}\n inputDimensions={inputDimensions}\n dropdownRef={(el: HTMLDivElement) => { dropdownCalendarContainer.current = el; }}>\n {getCalendar(valueInitial, calendarColorStyle, 'valueInitial')}\n </Dropdown>\n );\n };\n\n const getCalendarFinal = () => {\n if (onDenied && onDenied.readOnly) return null;\n if (calendarContainerRef && calendarContainerRef.current) calendarContainerRef.current.id = 'valueFinal';\n if (showCalendarInDialog) {\n return (\n <Dialog\n handlerClose={() => onCloseDateDialog('valueFinal')}\n dialogSize={dialogSize}\n onOpenChange={setShowCalendarValueFinal}>\n {getCalendar(valueFinal, calendarColorStyle, 'valueFinal')}\n </Dialog>\n );\n }\n return (\n <Dropdown\n containerRef={wrapperBaseInputPeriodRef as any}\n showButtonOpen={showButtonOpen}\n inputDimensions={inputDimensions}\n dropdownRef={(el: HTMLDivElement) => { dropdownCalendarContainer.current = el; }}>\n {getCalendar(valueFinal, calendarColorStyle, 'valueFinal')}\n </Dropdown>\n );\n };\n\n const getPeriodOfDatesSelection = () => {\n if (showCalendarInDialog) {\n return (\n <Dialog\n handlerClose={() => onCloseDateDialog('periodSelection')}\n dialogSize={dialogSize}\n onOpenChange={setShowPeriodSelection}>\n {getPeriodSelection(valuePeriodSelection, setPeriodDates)}\n </Dialog>\n );\n }\n return (\n <Dropdown\n containerRef={wrapperBaseInputPeriodRef as any}\n showButtonOpen={showButtonOpen}\n inputDimensions={inputDimensions}\n dropdownRef={(el: HTMLDivElement) => { dropdownCalendarContainer.current = el; }}>\n {getPeriodSelection(valuePeriodSelection, setPeriodDates)}\n </Dropdown>\n );\n };\n\n useEffect(() => {\n window.addEventListener('resize', onScreenResize);\n document.addEventListener('scroll', keepPositionCalendarByScroll);\n document.getElementById('modal-dialog-content')?.addEventListener('scroll', keepPositionCalendarByScroll);\n\n if (inputContainerRef.current) onScreenResize();\n\n if (inputInitialRef && inputInitialRef.current) inputInitialRef.current.id = idValueInitial;\n if (inputFinalRef && inputFinalRef.current) inputFinalRef.current.id = idValueFinal;\n\n return () => {\n window.removeEventListener('resize', onScreenResize);\n document.removeEventListener('scroll', keepPositionCalendarByScroll);\n document.getElementById('modal-dialog-content')?.removeEventListener('scroll', keepPositionCalendarByScroll);\n };\n }, []);\n\n useEffect(() => {\n document.addEventListener('keydown', onKeyDownPress);\n return () => {\n document.removeEventListener('keydown', onKeyDownPress);\n };\n }, [\n showCalendarValueFinal,\n showCalendarValueInitial,\n showPeriodSelection,\n calendarContainerRef.current,\n ]);\n\n useEffect(() => {\n if (valueFinal && valueInitial && moment(valueFinal).isBefore(moment(valueInitial))) {\n setValueInitial(valueFinal);\n setValueFinal(valueInitial);\n } else if (props.onChange && !isSyncingFromProps.current) {\n const initial = valueInitial ? valueInitial.format('YYYY-MM-DD') : '';\n const final = valueFinal ? valueFinal.format('YYYY-MM-DD') : '';\n if (\n !lastPeriodChanged.current ||\n lastPeriodChanged.current.initial !== initial ||\n lastPeriodChanged.current.final !== final\n ) {\n lastPeriodChanged.current = { initial, final };\n props.onChange(undefined, '', { initial, final });\n }\n }\n isSyncingFromProps.current = false;\n }, [valueInitial, valueFinal]);\n\n const propsValueInitialStr = moment.isMoment(props.value?.initial)\n ? props.value.initial.format('YYYY-MM-DD')\n : (props.value?.initial?.toString() ?? '');\n const propsValueFinalStr = moment.isMoment(props.value?.final)\n ? props.value.final.format('YYYY-MM-DD')\n : (props.value?.final?.toString() ?? '');\n\n useEffect(() => {\n const newValueInitial = parseDateValue(propsValueInitialStr);\n const newValueFinal = parseDateValue(propsValueFinalStr);\n\n const currentInitialStr = valueInitial?.format('YYYY-MM-DD') ?? '';\n const currentFinalStr = valueFinal?.format('YYYY-MM-DD') ?? '';\n const newInitialStr = newValueInitial?.format('YYYY-MM-DD') ?? '';\n const newFinalStr = newValueFinal?.format('YYYY-MM-DD') ?? '';\n\n if (currentInitialStr !== newInitialStr || currentFinalStr !== newFinalStr) {\n isSyncingFromProps.current = true;\n setValueInitial(newValueInitial);\n setValueFinal(newValueFinal);\n }\n }, [propsValueInitialStr, propsValueFinalStr]);\n\n if (onDenied && onDenied.unvisible) return null;\n\n const component = () => (\n <div\n ref={wrapperBaseInputPeriodRef}\n onBlur={onBlurWithoutWrapper}\n className=\"input-base-component datepicker-period-container\">\n {props.label && (\n <div className=\"labelcontainer\">\n <TextContent\n required={props.required}\n className={props.customClassForLabel}\n labelUppercase={props.labelUppercase} />\n <div className=\"text-content\" style={{ display: 'flex' }}>\n <div\n className={`label ${props.customClassForLabel} ${props.labelUppercase && ' -uppercase'}`}\n style={{ alignSelf: 'center' }}>\n {props.label}\n {props.required && <span className=\"-requiredlabel\">*</span>}\n {!!hint && hintPosition === 'onLabelRight' && (\n <Popover\n theme={themePopover}\n align={popoverAlign}\n iconColor=\"#03bde2\"\n customClass=\"-hint\"\n style={{ margin: '0px 5px', height: 'auto', width: 20 }}>\n {hint}\n </Popover>\n )}\n </div>\n </div>\n <TextContent />\n </div>\n )}\n <div\n className={\n `periodpicker-component ${helperBase.getInputWrapperClass({\n ...props,\n value: !valueInitial ? '' : moment(valueInitial).format('DD/MM/YYYY'),\n disabled: shouldDisable(),\n })\n }`\n }\n ref={inputContainerRef}>\n <BaseMask\n autoComplete=\"off\"\n gridLayout={undefined}\n permissionAttr={props.permissionAttr}\n name='valueInitial'\n value={!valueInitial ? '' : moment(valueInitial).format('DD/MM/YYYY')}\n mask=\"00/00/0000\"\n onComplete={(e: CustomInputEvent) => { setValue(e, e.target.value, true); }}\n onFocus={onInputFocus}\n onBlur={e => onInputBlur(e)}\n onChange={onInputChange}\n inputRef={(el) => { inputInitialRef.current = el; }}\n handlerSetOnDenied={(denied: OnDenied) => { setOnDenied(denied);}}\n required={props.required} />\n <Icon name=\"arrow_right\" customClass=\"separation_icon\" />\n <BaseMask\n autoComplete=\"off\"\n gridLayout={undefined}\n permissionAttr={props.permissionAttr}\n name='valueFinal'\n value={!valueFinal ? '' : moment(valueFinal).format('DD/MM/YYYY')}\n mask=\"00/00/0000\"\n onComplete={(e: CustomInputEvent) => { setValue(e, e.target.value, true); }}\n onFocus={onInputFocus}\n onBlur={e => onInputBlur(e)}\n onChange={onInputChange}\n inputRef={(el) => { inputFinalRef.current = el; }}\n handlerSetOnDenied={(denied: OnDenied) => setOnDenied(denied)}\n required={props.required} />\n {getButtonOpen()}\n {getButtonSelectPeriod()}\n </div>\n {showCalendarValueInitial && getCalendarInitial()}\n {showCalendarValueFinal && getCalendarFinal()}\n {showPeriodSelection && getPeriodOfDatesSelection()}\n <Hint visible={!!hint && hintPosition === 'below'} customClass=\"hint\" description={hint} />\n <ErrorMessage messages={props.errorMessages} />\n </div>\n );\n\n return (!gridLayout ? component() : <Grid customClass=\"-withinput\" cols={gridLayout}>{component()}</Grid>);\n};\n\nexport default PeriodPicker;\n"],"names":["PeriodPicker","props","showButtonOpen","openOnFocus","shouldCloseOnSelect","calendarColorStyle","showCalendarInDialog","dialogSize","width","height","hint","hintPosition","themePopover","popoverAlign","gridLayout","idValueInitial","useId","idValueFinal","valueInitial","setValueInitial","useState","parseDateValue","value","initial","valueFinal","setValueFinal","final","valuePeriodSelection","setValuePeriodSelection","showCalendarValueInitial","setShowCalendarValueInitial","showCalendarValueFinal","setShowCalendarValueFinal","showPeriodSelection","setShowPeriodSelection","inputDimensions","setInputDimensions","onDenied","setOnDenied","currentTypeDate","setCurrentTypeDate","wrapperBaseInputPeriodRef","useRef","inputContainerRef","inputInitialRef","buttonOpenRef","currentDateButtonRef","buttonSelectPeriodRef","dropdownCalendarContainer","inputFinalRef","calendarContainerRef","lastPeriodChanged","isSyncingFromProps","onScreenResize","current","getBoundingClientRect","onBlurWithoutWrapper","event","focusOnAnotherField","contains","relatedTarget","onKeyDownPress","target","targetElement","key","preventDefault","focus","id","stopPropagation","keepPositionCalendarByScroll","inputDateDimensions","positionTop","bottom","style","top","String","concat","openCalendar","calendarName","setTimeout","closeCalendar","onDateChange","date","format","onChange","undefined","onCloseDateDialog","onInputFocus","e","name","onFocus","onInputBlur","onBlur","onInputChange","changingAux","trim","length","setValue","shouldOpenDropdown","valueDateName","dateObj","moment","shouldDisable","disabled","hideContent","getButtonOpen","useCallback","Button","Icon","ref","getPeriodSelection","valuePeriodSelectionAux","setPeriodDates","PeriodList","openPeriodSelecion","closePeriodSelection","getButtonSelectPeriod","jsx","getCalendar","calendarColorStyleCalendar","Calendar","buttonElement","selected","dates","getCalendarInitial","readOnly","Dialog","Dropdown","el","getCalendarFinal","getPeriodOfDatesSelection","useEffect","window","addEventListener","document","getElementById","removeEventListener","isBefore","propsValueInitialStr","isMoment","toString","propsValueFinalStr","newValueInitial","newValueFinal","currentInitialStr","currentFinalStr","newInitialStr","newFinalStr","unvisible","component","jsxs","label","TextContent","required","customClassForLabel","labelUppercase","display","alignSelf","Popover","margin","helperBase","BaseMask","permissionAttr","denied","Hint","ErrorMessage","errorMessages","Grid"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAMA,KAAeA,CAACC,MAA8B;AAClD,QAAM;AAAA,IACJC,gBAAAA,IAAiB;AAAA,IAAMC,aAAAA,KAAc;AA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