linear-react-components-ui 1.1.26-beta.24 → 1.1.26-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { CSSProperties, KeyboardEvent, MutableRefObject, RefObject, DragEvent, MouseEvent, JSX, ReactNode } from 'react';
1
+ import { CSSProperties, KeyboardEvent, MutableRefObject, RefObject, DragEvent, MouseEvent, JSX, ReactNode, HTMLInputAutoCompleteAttribute } from 'react';
2
2
  import { TextAlign } from 'src/lib/@types/Align';
3
3
  import { ITooltipCommonProps } from 'src/lib/tooltip/types';
4
4
  import { Period } from '../../@types/Period';
@@ -80,9 +80,9 @@ export interface IBaseProps extends ITooltipCommonProps {
80
80
  accept?: string;
81
81
  multiple?: boolean;
82
82
  readOnlyClass?: string;
83
- autoComplete?: 'on' | 'off';
84
83
  themePopover?: 'light' | 'dark';
85
84
  popoverAlign?: 'right' | 'left';
86
85
  tabIndex?: number;
87
86
  defaultValue?: string | string[];
87
+ autoComplete?: HTMLInputAutoCompleteAttribute;
88
88
  }
@@ -1,4 +1,4 @@
1
- import { JSX, KeyboardEvent, MutableRefObject } from 'react';
1
+ import { JSX, KeyboardEvent, MutableRefObject, HTMLInputAutoCompleteAttribute } from 'react';
2
2
  import { TextAlign } from 'src/lib/@types/Align';
3
3
  import { OnDenied, PermissionAttr } from '../../@types/PermissionAttr';
4
4
  import { CustomInputEvent } from '../base/types';
@@ -54,6 +54,7 @@ export type IBaseMaskProps = {
54
54
  mapToRadix?: string[];
55
55
  normalizeZeros?: boolean;
56
56
  isDateTimeField?: boolean;
57
+ autoComplete?: HTMLInputAutoCompleteAttribute;
57
58
  };
58
59
  export type ICnpjFieldProps = IBaseMaskProps & {
59
60
  value?: string;
@@ -9,3 +9,4 @@ export default getCalendarDropdownStyle;
9
9
  export declare const getDropdownItemCssClass: (selected?: boolean, disabled?: boolean, striped?: boolean) => string;
10
10
  export declare const CalcDatesByPeriod: (dateType: DateTypes) => Moment[];
11
11
  export declare const isDateValid: (date: Moment) => boolean;
12
+ export declare const parseDateValue: (value?: string | Moment) => Moment | undefined;
@@ -1,32 +1,40 @@
1
- import a from "../../node_modules/moment/dist/moment.js";
2
- const l = (s = !1, e = !1, r = !1) => {
3
- let t = "item";
4
- return t += s && !e ? " -selected " : "", t += e ? " -disabled" : "", t += !s && !e && r ? " -striped " : "", t;
5
- }, m = (s) => {
6
- const e = a();
1
+ import r from "../../node_modules/moment/dist/moment.js";
2
+ const d = (n = !1, t = !1, o = !1) => {
3
+ let e = "item";
4
+ return e += n && !t ? " -selected " : "", e += t ? " -disabled" : "", e += !n && !t && o ? " -striped " : "", e;
5
+ }, l = (n) => {
6
+ const t = r();
7
7
  return {
8
- today: () => [e, e],
8
+ today: () => [t, t],
9
9
  week: () => {
10
- const t = e.clone().startOf("week"), n = e.clone().endOf("week");
11
- return [t, n];
10
+ const e = t.clone().startOf("week"), s = t.clone().endOf("week");
11
+ return [e, s];
12
12
  },
13
13
  lastweek: () => {
14
- const t = e.subtract(1, "weeks"), n = t.clone().startOf("week"), o = t.clone().endOf("week");
15
- return [n, o];
14
+ const e = t.subtract(1, "weeks"), s = e.clone().startOf("week"), a = e.clone().endOf("week");
15
+ return [s, a];
16
16
  },
17
- last15: () => [a(e).subtract(15, "days"), e],
17
+ last15: () => [r(t).subtract(15, "days"), t],
18
18
  month: () => {
19
- const t = e.clone().startOf("month"), n = e.clone().endOf("month");
20
- return [t, n];
19
+ const e = t.clone().startOf("month"), s = t.clone().endOf("month");
20
+ return [e, s];
21
21
  },
22
22
  lastmonth: () => {
23
- const t = e.subtract(1, "months"), n = t.clone().startOf("month"), o = t.clone().endOf("month");
24
- return [n, o];
23
+ const e = t.subtract(1, "months"), s = e.clone().startOf("month"), a = e.clone().endOf("month");
24
+ return [s, a];
25
25
  }
26
- }[s]();
26
+ }[n]();
27
+ }, i = (n) => {
28
+ if (!n) return;
29
+ if (r.isMoment(n)) return n.isValid() ? n : void 0;
30
+ const t = r(n, "YYYY-MM-DD", !0);
31
+ if (t.isValid()) return t;
32
+ const o = r(n, "DD/MM/YYYY", !0);
33
+ if (o.isValid()) return o;
27
34
  };
28
35
  export {
29
- m as CalcDatesByPeriod,
30
- l as getDropdownItemCssClass
36
+ l as CalcDatesByPeriod,
37
+ d as getDropdownItemCssClass,
38
+ i as parseDateValue
31
39
  };
32
40
  //# sourceMappingURL=helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sources":["../../../src/lib/inputs/period/helper.ts"],"sourcesContent":["import moment, { Moment } from 'moment';\nimport { DateTypes } from './types';\n\nconst getCalendarDropdownStyle = ({ topPosition, leftPosition, width }:\n{ topPosition: number | string, leftPosition: number | string, width: number | string }) => (\n `top: ${topPosition}px;\n left: ${leftPosition}px;\n width:${width}px`\n);\nexport default getCalendarDropdownStyle;\n\nexport const getDropdownItemCssClass = (selected = false, disabled = false, striped = false) => {\n let className = 'item';\n className += (selected && !disabled ? ' -selected ' : '');\n className += disabled ? ' -disabled' : '';\n className += (!selected && !disabled && striped ? ' -striped ' : '');\n return className;\n};\n\nexport const CalcDatesByPeriod = (dateType: DateTypes): Moment[] => {\n const currentDate = moment();\n const dateTypes = {\n today: () => [currentDate, currentDate],\n week: () => {\n const weekStart = currentDate.clone().startOf('week');\n const weekEnd = currentDate.clone().endOf('week');\n return [weekStart, weekEnd];\n },\n lastweek: () => {\n const lastWeek = currentDate.subtract(1, 'weeks');\n const weekStart = lastWeek.clone().startOf('week');\n const weekEnd = lastWeek.clone().endOf('week');\n return [weekStart, weekEnd];\n },\n last15: () => {\n const last15Day = moment(currentDate);\n return [last15Day.subtract(15, 'days'), currentDate];\n },\n month: () => {\n const monthStart = currentDate.clone().startOf('month');\n const monthEnd = currentDate.clone().endOf('month');\n return [monthStart, monthEnd];\n },\n lastmonth: () => {\n const lastMonth = currentDate.subtract(1, 'months');\n const monthStart = lastMonth.clone().startOf('month');\n const monthEnd = lastMonth.clone().endOf('month');\n return [monthStart, monthEnd];\n },\n };\n return dateTypes[dateType]();\n};\n\nexport const isDateValid = (date: Moment) => date && moment(date).isValid();\n"],"names":["getDropdownItemCssClass","selected","disabled","striped","className","CalcDatesByPeriod","dateType","currentDate","moment","today","week","weekStart","clone","startOf","weekEnd","endOf","lastweek","lastWeek","subtract","last15","month","monthStart","monthEnd","lastmonth","lastMonth"],"mappings":";AAWO,MAAMA,IAA0BA,CAACC,IAAW,IAAOC,IAAW,IAAOC,IAAU,OAAU;AAC9F,MAAIC,IAAY;AAChBA,SAAAA,KAAcH,KAAY,CAACC,IAAW,gBAAgB,IACtDE,KAAaF,IAAW,eAAe,IACvCE,KAAc,CAACH,KAAY,CAACC,KAAYC,IAAU,eAAe,IAC1DC;AACT,GAEaC,IAAoBA,CAACC,MAAkC;AAClE,QAAMC,IAAcC,EAAAA;AA8BpB,SA7BkB;AAAA,IAChBC,OAAOA,MAAM,CAACF,GAAaA,CAAW;AAAA,IACtCG,MAAMA,MAAM;AACV,YAAMC,IAAYJ,EAAYK,MAAAA,EAAQC,QAAQ,MAAM,GAC9CC,IAAUP,EAAYK,MAAAA,EAAQG,MAAM,MAAM;AAChD,aAAO,CAACJ,GAAWG,CAAO;AAAA,IAC5B;AAAA,IACAE,UAAUA,MAAM;AACd,YAAMC,IAAWV,EAAYW,SAAS,GAAG,OAAO,GAC1CP,IAAYM,EAASL,MAAAA,EAAQC,QAAQ,MAAM,GAC3CC,IAAUG,EAASL,MAAAA,EAAQG,MAAM,MAAM;AAC7C,aAAO,CAACJ,GAAWG,CAAO;AAAA,IAC5B;AAAA,IACAK,QAAQA,MAEC,CADWX,EAAOD,CAAW,EAClBW,SAAS,IAAI,MAAM,GAAGX,CAAW;AAAA,IAErDa,OAAOA,MAAM;AACX,YAAMC,IAAad,EAAYK,MAAAA,EAAQC,QAAQ,OAAO,GAChDS,IAAWf,EAAYK,MAAAA,EAAQG,MAAM,OAAO;AAClD,aAAO,CAACM,GAAYC,CAAQ;AAAA,IAC9B;AAAA,IACAC,WAAWA,MAAM;AACf,YAAMC,IAAYjB,EAAYW,SAAS,GAAG,QAAQ,GAC5CG,IAAaG,EAAUZ,MAAAA,EAAQC,QAAQ,OAAO,GAC9CS,IAAWE,EAAUZ,MAAAA,EAAQG,MAAM,OAAO;AAChD,aAAO,CAACM,GAAYC,CAAQ;AAAA,IAC9B;AAAA,EAAA,EAEehB,CAAQ,EAAA;AAC3B;"}
1
+ {"version":3,"file":"helper.js","sources":["../../../src/lib/inputs/period/helper.ts"],"sourcesContent":["import moment, { Moment } from 'moment';\nimport { DateTypes } from './types';\n\nconst getCalendarDropdownStyle = ({ topPosition, leftPosition, width }:\n{ topPosition: number | string, leftPosition: number | string, width: number | string }) => (\n `top: ${topPosition}px;\n left: ${leftPosition}px;\n width:${width}px`\n);\nexport default getCalendarDropdownStyle;\n\nexport const getDropdownItemCssClass = (selected = false, disabled = false, striped = false) => {\n let className = 'item';\n className += (selected && !disabled ? ' -selected ' : '');\n className += disabled ? ' -disabled' : '';\n className += (!selected && !disabled && striped ? ' -striped ' : '');\n return className;\n};\n\nexport const CalcDatesByPeriod = (dateType: DateTypes): Moment[] => {\n const currentDate = moment();\n const dateTypes = {\n today: () => [currentDate, currentDate],\n week: () => {\n const weekStart = currentDate.clone().startOf('week');\n const weekEnd = currentDate.clone().endOf('week');\n return [weekStart, weekEnd];\n },\n lastweek: () => {\n const lastWeek = currentDate.subtract(1, 'weeks');\n const weekStart = lastWeek.clone().startOf('week');\n const weekEnd = lastWeek.clone().endOf('week');\n return [weekStart, weekEnd];\n },\n last15: () => {\n const last15Day = moment(currentDate);\n return [last15Day.subtract(15, 'days'), currentDate];\n },\n month: () => {\n const monthStart = currentDate.clone().startOf('month');\n const monthEnd = currentDate.clone().endOf('month');\n return [monthStart, monthEnd];\n },\n lastmonth: () => {\n const lastMonth = currentDate.subtract(1, 'months');\n const monthStart = lastMonth.clone().startOf('month');\n const monthEnd = lastMonth.clone().endOf('month');\n return [monthStart, monthEnd];\n },\n };\n return dateTypes[dateType]();\n};\n\nexport const isDateValid = (date: Moment) => date && moment(date).isValid();\n\nexport const parseDateValue = (value?: string | Moment): Moment | undefined => {\n if (!value) return undefined;\n if (moment.isMoment(value)) return value.isValid() ? value : undefined;\n const iso = moment(value, 'YYYY-MM-DD', true);\n if (iso.isValid()) return iso;\n const dmy = moment(value, 'DD/MM/YYYY', true);\n if (dmy.isValid()) return dmy;\n return undefined;\n};\n"],"names":["getDropdownItemCssClass","selected","disabled","striped","className","CalcDatesByPeriod","dateType","currentDate","moment","today","week","weekStart","clone","startOf","weekEnd","endOf","lastweek","lastWeek","subtract","last15","month","monthStart","monthEnd","lastmonth","lastMonth","parseDateValue","value","isMoment","isValid","undefined","iso","dmy"],"mappings":";AAWO,MAAMA,IAA0BA,CAACC,IAAW,IAAOC,IAAW,IAAOC,IAAU,OAAU;AAC9F,MAAIC,IAAY;AAChBA,SAAAA,KAAcH,KAAY,CAACC,IAAW,gBAAgB,IACtDE,KAAaF,IAAW,eAAe,IACvCE,KAAc,CAACH,KAAY,CAACC,KAAYC,IAAU,eAAe,IAC1DC;AACT,GAEaC,IAAoBA,CAACC,MAAkC;AAClE,QAAMC,IAAcC,EAAAA;AA8BpB,SA7BkB;AAAA,IAChBC,OAAOA,MAAM,CAACF,GAAaA,CAAW;AAAA,IACtCG,MAAMA,MAAM;AACV,YAAMC,IAAYJ,EAAYK,MAAAA,EAAQC,QAAQ,MAAM,GAC9CC,IAAUP,EAAYK,MAAAA,EAAQG,MAAM,MAAM;AAChD,aAAO,CAACJ,GAAWG,CAAO;AAAA,IAC5B;AAAA,IACAE,UAAUA,MAAM;AACd,YAAMC,IAAWV,EAAYW,SAAS,GAAG,OAAO,GAC1CP,IAAYM,EAASL,MAAAA,EAAQC,QAAQ,MAAM,GAC3CC,IAAUG,EAASL,MAAAA,EAAQG,MAAM,MAAM;AAC7C,aAAO,CAACJ,GAAWG,CAAO;AAAA,IAC5B;AAAA,IACAK,QAAQA,MAEC,CADWX,EAAOD,CAAW,EAClBW,SAAS,IAAI,MAAM,GAAGX,CAAW;AAAA,IAErDa,OAAOA,MAAM;AACX,YAAMC,IAAad,EAAYK,MAAAA,EAAQC,QAAQ,OAAO,GAChDS,IAAWf,EAAYK,MAAAA,EAAQG,MAAM,OAAO;AAClD,aAAO,CAACM,GAAYC,CAAQ;AAAA,IAC9B;AAAA,IACAC,WAAWA,MAAM;AACf,YAAMC,IAAYjB,EAAYW,SAAS,GAAG,QAAQ,GAC5CG,IAAaG,EAAUZ,MAAAA,EAAQC,QAAQ,OAAO,GAC9CS,IAAWE,EAAUZ,MAAAA,EAAQG,MAAM,OAAO;AAChD,aAAO,CAACM,GAAYC,CAAQ;AAAA,IAC9B;AAAA,EAAA,EAEehB,CAAQ,EAAA;AAC3B,GAIamB,IAAiBA,CAACC,MAAgD;AAC7E,MAAI,CAACA,EAAO;AACZ,MAAIlB,EAAOmB,SAASD,CAAK,UAAUA,EAAME,QAAAA,IAAYF,IAAQG;AAC7D,QAAMC,IAAMtB,EAAOkB,GAAO,cAAc,EAAI;AAC5C,MAAII,EAAIF,QAAAA,EAAW,QAAOE;AAC1B,QAAMC,IAAMvB,EAAOkB,GAAO,cAAc,EAAI;AAC5C,MAAIK,EAAIH,QAAAA,EAAW,QAAOG;AAE5B;"}
@@ -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 h, useRef as s, useCallback as he, useEffect as V } from "react";
4
+ import Y from "../../node_modules/moment/dist/moment.js";
5
+ import pe 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 ve 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 Ce 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 = (t) => {
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: Ye = "light",
35
+ popoverAlign: Ie = "left",
36
+ gridLayout: X
37
+ } = t, Se = ge(), be = ge(), [r, w] = h(() => E(t.value?.initial)), [u, F] = h(() => E(t.value?.final)), [Z, _] = h("week"), [p, d] = h(!1), [v, o] = h(!1), [M, C] = h(!1), [q, A] = h(), [m, ee] = h(), [ne, te] = h("valueInitial"), R = s(null), D = s(null), c = s(null), we = s(null), z = s(null), Fe = s(null), S = s(null), l = s(null), g = s(null), B = s(null), N = s(!1), j = () => {
38
+ A(D?.current?.getBoundingClientRect());
39
+ }, Me = (e) => {
40
+ const n = !R.current?.contains(e.relatedTarget);
41
+ !I && p && n && d(!1), !I && v && n && o(!1);
42
+ }, ie = (e) => {
42
43
  const {
43
- 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 = () => {
47
- 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, "", {
60
- initial: t,
61
- final: u
44
+ target: n
45
+ } = e, a = n;
46
+ g.current && e && e.key && e.key === "Escape" && (e.preventDefault(), a.focus(), p && (a.id !== "valueInitial" && c.current?.focus(), d(!1)), v && (a.id !== "valueFinal" && l.current?.focus(), o(!1)), M && (C(!1), l.current?.focus(), o(!1))), e.stopPropagation();
47
+ }, k = () => {
48
+ const e = D.current?.getBoundingClientRect(), n = e && e.bottom;
49
+ S && S.current && e && (S.current.style.top = String(n).concat("px"));
50
+ }, re = (e) => {
51
+ e === "valueInitial" && (te("valueInitial"), o(!1), p || (c.current?.focus(), I && setTimeout(() => {
52
+ z.current?.focus();
53
+ }, 100), d(!0))), e === "valueFinal" && (te("valueFinal"), d(!1), v || (l.current?.focus(), I && setTimeout(() => {
54
+ z.current?.focus();
55
+ }, 100), o(!0))), D.current && A(D.current.getBoundingClientRect());
56
+ }, Re = (e) => {
57
+ e === "valueInitial" && c.current?.focus(), e === "valueFinal" && l.current?.focus(), d(!1), o(!1);
58
+ }, oe = (e) => {
59
+ const n = e.initial ? e.initial.format("YYYY-MM-DD") : "", a = e.final ? e.final.format("YYYY-MM-DD") : "";
60
+ B.current = {
61
+ initial: n,
62
+ final: a
63
+ }, t?.onChange?.(void 0, "", {
64
+ initial: n,
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(), d(!1)), e === "valueFinal" && (l.current?.focus(), o(!1)), e === "periodSelection" && (C(!1), l.current?.focus(), o(!1));
66
70
  }, 100);
67
- }, ie = (e) => {
71
+ }, le = (e) => {
68
72
  const {
69
- name: t
73
+ name: n
70
74
  } = e.target;
71
- ge && ne(t), n.onFocus && n.onFocus(e);
72
- }, le = (e) => {
73
- n.onBlur && n.onBlur(e);
74
- }, re = (e) => {
75
+ De && re(n), t.onFocus && t.onFocus(e);
76
+ }, ae = (e) => {
77
+ t.onBlur && t.onBlur(e);
78
+ }, ue = (e) => {
75
79
  if (e) {
76
80
  const {
77
- name: t,
78
- value: u
81
+ name: n,
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 && (n === "valueInitial" ? w(void 0) : F(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, n, a = !0) => {
87
+ const f = e ? e.target.name : "", b = Y(n, "DD/MM/YYYY");
88
+ p && c.current?.focus(), v && l.current?.focus(), f === "valueInitial" ? (w(b), oe({
89
+ initial: b,
90
+ final: u
91
+ })) : (F(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 && (d(!1), o(!1));
95
+ }, $ = () => {
92
96
  const {
93
97
  disabled: e
94
- } = n;
98
+ } = t;
95
99
  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);
100
+ }, Be = he(() => y ? /* @__PURE__ */ i(ve, { boxShadow: !1, disabled: $(), customClass: "calendar-button", icon: /* @__PURE__ */ i(G, { name: "calendar" }), onClick: () => {
101
+ v || p ? 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, [v, p]), se = (e, n) => /* @__PURE__ */ i(je, { selected: e, handleOnSelect: n }), ye = () => {
105
+ o(!1), d(!1), C(!0), D.current && A(D.current.getBoundingClientRect());
106
+ }, Pe = () => {
107
+ C(!1), l.current?.focus(), o(!1);
108
+ }, Oe = he(() => /* @__PURE__ */ i(ve, { disabled: $(), tabIndex: -1, customClass: "calendar-button", icon: /* @__PURE__ */ i(G, { name: "more1" }), onBlur: () => setTimeout(() => C(!1), 100), onClick: () => M ? Pe() : ye(), targetRef: (e) => {
109
+ Fe.current = e;
110
+ } }, "button-select-period"), [M]), x = (e, n, a) => /* @__PURE__ */ i(Ee, { colorStyle: n, currentDate: e !== void 0 ? Y(e) : Y(), calendarContainer: (f) => {
111
+ g.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, n) => {
113
117
  if (e === "custom") {
114
- f.current?.focus(), Q(e), D(!1);
118
+ c.current?.focus(), _(e), C(!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), n && (w(n[0]), F(n[1])), J && C(!1), l.current?.focus(), o(!1);
122
+ }, ke = () => m && m.readOnly ? null : (g && g.current && (g.current.id = "valueInitial"), I ? /* @__PURE__ */ i(H, { handlerClose: () => U("valueInitial"), dialogSize: T, onOpenChange: d, 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 = () => m && m.readOnly ? null : (g && g.current && (g.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: C, 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), D.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
+ }), [v, p, M, g.current]), V(() => {
134
+ if (u && r && Y(u).isBefore(Y(r)))
135
+ w(u), F(r);
136
+ else if (t.onChange && !N.current) {
137
+ const e = r ? r.format("YYYY-MM-DD") : "", n = u ? u.format("YYYY-MM-DD") : "";
138
+ (!B.current || B.current.initial !== e || B.current.final !== n) && (B.current = {
135
139
  initial: e,
136
- 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 {
140
+ final: n
141
+ }, t.onChange(void 0, "", {
142
142
  initial: e,
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);
143
+ final: n
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 = t.value?.initial?.toString() ?? "", de = t.value?.final?.toString() ?? "";
149
+ if (V(() => {
150
+ const e = E(fe), n = E(de), a = r?.format("YYYY-MM-DD") ?? "", f = u?.format("YYYY-MM-DD") ?? "", b = e?.format("YYYY-MM-DD") ?? "", Ve = n?.format("YYYY-MM-DD") ?? "";
151
+ (a !== b || f !== Ve) && (N.current = !0, w(e), F(n));
152
+ }, [fe, de]), m && m.unvisible) return null;
153
+ const me = () => /* @__PURE__ */ L("div", { ref: R, onBlur: Me, className: "input-base-component datepicker-period-container", children: [
154
+ t.label && /* @__PURE__ */ L("div", { className: "labelcontainer", children: [
155
+ /* @__PURE__ */ i(Ce, { required: t.required, className: t.customClassForLabel, labelUppercase: t.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 ${t.customClassForLabel} ${t.labelUppercase && " -uppercase"}`, style: {
155
159
  alignSelf: "center"
156
160
  }, children: [
157
- n.label,
158
- n.required && /* @__PURE__ */ i("span", { className: "-requiredlabel", children: "*" }),
159
- !!P && H === "onLabelRight" && /* @__PURE__ */ i(Ve, { theme: ve, align: he, iconColor: "#03bde2", customClass: "-hint", style: {
161
+ t.label,
162
+ t.required && /* @__PURE__ */ i("span", { className: "-requiredlabel", children: "*" }),
163
+ !!O && Q === "onLabelRight" && /* @__PURE__ */ i(Ne, { theme: Ye, 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(Ce, {})
166
170
  ] }),
167
- /* @__PURE__ */ x("div", { className: `periodpicker-component ${Le({
168
- ...n,
169
- value: r ? l(r).format("DD/MM/YYYY") : "",
170
- disabled: j()
171
- })}`, 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;
171
+ /* @__PURE__ */ L("div", { className: `periodpicker-component ${Ae({
172
+ ...t,
173
+ value: r ? Y(r).format("DD/MM/YYYY") : "",
174
+ disabled: $()
175
+ })}`, ref: D, children: [
176
+ /* @__PURE__ */ i(pe, { autoComplete: "off", gridLayout: void 0, permissionAttr: t.permissionAttr, name: "valueInitial", value: r ? Y(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);
178
- }, 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()
181
+ ee(e);
182
+ }, required: t.required }),
183
+ /* @__PURE__ */ i(G, { name: "arrow_right", customClass: "separation_icon" }),
184
+ /* @__PURE__ */ i(pe, { autoComplete: "off", gridLayout: void 0, permissionAttr: t.permissionAttr, name: "valueFinal", value: u ? Y(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: t.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
+ p && ke(),
193
+ v && xe(),
194
+ M && Le(),
195
+ /* @__PURE__ */ i(Te, { visible: !!O && Q === "below", customClass: "hint", description: O }),
196
+ /* @__PURE__ */ i(ze, { messages: t.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