@ironsource/shared-ui 2.1.12-rc.25 → 2.1.12-rc.27

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 (93) hide show
  1. package/ButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_adb49e50_lang.css +1 -0
  2. package/ButtonV4.vue_vue_type_style_index_0_scoped_852be7ec_lang.css +1 -0
  3. package/Chart.vue_vue_type_style_index_0_scoped_e8f25a03_lang.css +1 -0
  4. package/ChartHeader.vue_vue_type_style_index_0_scoped_af520313_lang.css +1 -0
  5. package/ChartHeaderTrend.vue_vue_type_style_index_0_scoped_db8a902c_lang.css +1 -0
  6. package/ChartLegend.vue_vue_type_style_index_0_scoped_6103d8bd_lang.css +1 -0
  7. package/ChartPlane.vue_vue_type_style_index_0_scoped_4f67d41d_lang.css +1 -0
  8. package/ChartTooltip.vue_vue_type_style_index_0_scoped_3315b68f_lang.css +1 -0
  9. package/ConditionalDropdown.vue_vue_type_style_index_0_scoped_f5204c04_lang.css +1 -0
  10. package/DataGrid.vue_vue_type_style_index_0_scoped_b21a79b1_lang.css +1 -0
  11. package/DropdownV4.vue_vue_type_style_index_0_scoped_55dd36a7_lang.css +1 -0
  12. package/Link.vue_vue_type_style_index_0_scoped_ad98fe7b_lang.css +1 -0
  13. package/OptionV4.vue_vue_type_style_index_0_scoped_0287cebf_lang.css +1 -0
  14. package/SwitchV4.vue_vue_type_style_index_0_scoped_cd6621a7_lang.css +1 -0
  15. package/components/button/v4/ButtonV4.vue.d.ts +1 -0
  16. package/components/button/v4/ButtonV4.vue.js +3 -3
  17. package/components/button/v4/ButtonV4.vue2.js +28 -27
  18. package/components/chart/Chart.vue.d.ts +6 -1
  19. package/components/chart/Chart.vue.js +3 -3
  20. package/components/chart/Chart.vue2.js +6 -4
  21. package/components/chart/ChartHeader.vue.d.ts +5 -0
  22. package/components/chart/ChartHeader.vue.js +2 -2
  23. package/components/chart/ChartHeader.vue2.js +43 -35
  24. package/components/chart/ChartHeaderTrend.vue.js +3 -3
  25. package/components/chart/ChartHeaderTrend.vue2.js +17 -17
  26. package/components/chart/ChartLegend.vue.js +3 -3
  27. package/components/chart/ChartLegend.vue2.js +1 -1
  28. package/components/chart/ChartPlane.vue.d.ts +6 -1
  29. package/components/chart/ChartPlane.vue.js +5 -5
  30. package/components/chart/ChartPlane.vue2.js +140 -138
  31. package/components/chart/ChartTooltip.vue.js +2 -2
  32. package/components/chart/ChartTooltip.vue2.js +5 -5
  33. package/components/chart/index.d.ts +43 -24
  34. package/components/chart/utils/utils.d.ts +1 -2
  35. package/components/chart/utils/utils.js +13 -19
  36. package/components/dateRange/common/DateRange.common.js +81 -75
  37. package/components/dateRange/common/DateServices.common.d.ts +1 -1
  38. package/components/dateRange/common/DateServices.common.js +1 -0
  39. package/components/dropdown/common/Dropdown.common.js +82 -78
  40. package/components/dropdown/v4/ButtonDropdownTrigger.vue.d.ts +1 -0
  41. package/components/dropdown/v4/ButtonDropdownTrigger.vue.js +3 -3
  42. package/components/dropdown/v4/ButtonDropdownTrigger.vue2.js +16 -13
  43. package/components/dropdown/v4/ConditionalDropdown.vue.d.ts +17 -9
  44. package/components/dropdown/v4/ConditionalDropdown.vue.js +4 -4
  45. package/components/dropdown/v4/ConditionalDropdown.vue2.js +142 -123
  46. package/components/dropdown/v4/DropdownV4.vue.d.ts +10 -0
  47. package/components/dropdown/v4/DropdownV4.vue.js +4 -4
  48. package/components/dropdown/v4/DropdownV4.vue2.js +174 -163
  49. package/components/dropdown/v4/OptionV4.vue.d.ts +10 -5
  50. package/components/dropdown/v4/OptionV4.vue.js +4 -4
  51. package/components/dropdown/v4/OptionV4.vue2.js +106 -99
  52. package/components/dropdown/v4/dropdownStoryArgs.d.ts +8 -0
  53. package/components/dropdown/v4/index.d.ts +510 -127
  54. package/components/includeExclude/IncludeExclude.vue.d.ts +1 -1
  55. package/components/includeExclude/IncludeExcludeDragDrop.vue.d.ts +1 -1
  56. package/components/includeExclude/index.d.ts +40 -40
  57. package/components/link/Link.vue.d.ts +70 -0
  58. package/components/link/Link.vue.js +7 -0
  59. package/components/link/Link.vue2.js +43 -0
  60. package/components/link/index.d.ts +201 -0
  61. package/components/link/index.js +6 -0
  62. package/components/switch/v4/SwitchV4.vue.d.ts +11 -0
  63. package/components/switch/v4/SwitchV4.vue.js +2 -2
  64. package/components/switch/v4/SwitchV4.vue2.js +39 -26
  65. package/components/switch/v4/index.d.ts +18 -0
  66. package/components/table/v4/DataGrid.vue.d.ts +2 -0
  67. package/components/table/v4/DataGrid.vue.js +3 -3
  68. package/components/table/v4/DataGrid.vue2.js +111 -110
  69. package/components/table/v4/index.d.ts +2 -0
  70. package/composables/useDateService.d.ts +7 -0
  71. package/composables/useDateService.js +10 -0
  72. package/index.d.ts +1120 -310
  73. package/index.js +111 -105
  74. package/mocks/apps.d.ts +1 -0
  75. package/mocks/optionsWithIcons.d.ts +2 -0
  76. package/package.json +9 -1
  77. package/testids/index.d.ts +4 -0
  78. package/testids/index.js +31 -30
  79. package/ButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_0123c361_lang.css +0 -1
  80. package/ButtonV4.vue_vue_type_style_index_0_scoped_d7948c77_lang.css +0 -1
  81. package/Chart.vue_vue_type_style_index_0_scoped_03771fa3_lang.css +0 -1
  82. package/ChartHeader.vue_vue_type_style_index_0_scoped_da34b108_lang.css +0 -1
  83. package/ChartHeaderTrend.vue_vue_type_style_index_0_scoped_ebc0c582_lang.css +0 -1
  84. package/ChartLegend.vue_vue_type_style_index_0_scoped_fd9e4ea2_lang.css +0 -1
  85. package/ChartPlane.vue_vue_type_style_index_0_scoped_903fc6ae_lang.css +0 -1
  86. package/ChartTooltip.vue_vue_type_style_index_0_scoped_e53c6287_lang.css +0 -1
  87. package/ConditionalDropdown.vue_vue_type_style_index_0_scoped_cce87267_lang.css +0 -1
  88. package/DataGrid.vue_vue_type_style_index_0_scoped_5b72e35a_lang.css +0 -1
  89. package/DropdownV4.vue_vue_type_style_index_0_scoped_92ead583_lang.css +0 -1
  90. package/OptionV4.vue_vue_type_style_index_0_scoped_3dc741c1_lang.css +0 -1
  91. package/SwitchV4.vue_vue_type_style_index_0_scoped_fa120cf6_lang.css +0 -1
  92. package/components/chart/composables/useChartValues.d.ts +0 -12
  93. package/components/chart/composables/useChartValues.js +0 -32
@@ -23,12 +23,13 @@ declare const ChartTypes: () => ({
23
23
  yAxisFormat: import("./types").ValueFormat;
24
24
  valueSuffix: string;
25
25
  valuePrefix: string;
26
- dataSets: import("./types").ChartDataSet[];
27
26
  trendTooltip: any;
28
27
  subheader: string;
29
28
  subheaderTooltip: any;
30
29
  trendValue: string | number;
31
30
  trendDirection: TrendDirection;
31
+ noteText: string;
32
+ dataSets: import("./types").ChartDataSet[];
32
33
  tickCount: number;
33
34
  truncateTickLabels: boolean;
34
35
  keepSubheaderVisible: boolean;
@@ -118,11 +119,6 @@ declare const ChartTypes: () => ({
118
119
  type: import("vue").PropType<string>;
119
120
  default: string;
120
121
  };
121
- dataSets: {
122
- type: import("vue").PropType<import("./types").ChartDataSet[]>;
123
- required: true;
124
- default: () => any[];
125
- };
126
122
  trendTooltip: {
127
123
  type: import("vue").PropType<{
128
124
  header?: string;
@@ -150,6 +146,15 @@ declare const ChartTypes: () => ({
150
146
  type: import("vue").PropType<TrendDirection>;
151
147
  default: TrendDirection;
152
148
  };
149
+ noteText: {
150
+ type: import("vue").PropType<string>;
151
+ default: string;
152
+ };
153
+ dataSets: {
154
+ type: import("vue").PropType<import("./types").ChartDataSet[]>;
155
+ required: true;
156
+ default: () => any[];
157
+ };
153
158
  tickCount: {
154
159
  type: import("vue").PropType<number>;
155
160
  default: number;
@@ -214,7 +219,7 @@ declare const ChartTypes: () => ({
214
219
  "onUpdate:visibleIds"?: (visibleIds: unknown[]) => any;
215
220
  "onUpdate:sortSelected"?: (sortOption: unknown) => any;
216
221
  "onUpdate:chartType"?: (chartType: ChartType) => any;
217
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "header" | "loading" | "visibleIds" | "minVisible" | "maxVisible" | "maxLimitTooltipText" | "sortSelected" | "sortOptions" | "sortOptionNameKey" | "chartType" | "hideLegend" | "xAxisFormat" | "xAxisDateInterval" | "totalsChart" | "parsing" | "yAxisFormat" | "valueSuffix" | "valuePrefix" | "dataSets" | "trendTooltip" | "subheader" | "subheaderTooltip" | "trendValue" | "trendDirection" | "tickCount" | "truncateTickLabels" | "keepSubheaderVisible" | "empty" | "noDataIcon" | "noDataTitle" | "noDataSubtitle" | "withAnimation" | "tooltipTotalType" | "tooltipTotalCalcFn" | "tooltipOrder" | "fullHeight" | "fullHeightBottomSpacing" | "withSettingsHeader" | "extraCharts">;
222
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "header" | "loading" | "visibleIds" | "minVisible" | "maxVisible" | "maxLimitTooltipText" | "sortSelected" | "sortOptions" | "sortOptionNameKey" | "chartType" | "hideLegend" | "xAxisFormat" | "xAxisDateInterval" | "totalsChart" | "parsing" | "yAxisFormat" | "valueSuffix" | "valuePrefix" | "trendTooltip" | "subheader" | "subheaderTooltip" | "trendValue" | "trendDirection" | "noteText" | "dataSets" | "tickCount" | "truncateTickLabels" | "keepSubheaderVisible" | "empty" | "noDataIcon" | "noDataTitle" | "noDataSubtitle" | "withAnimation" | "tooltipTotalType" | "tooltipTotalCalcFn" | "tooltipOrder" | "fullHeight" | "fullHeightBottomSpacing" | "withSettingsHeader" | "extraCharts">;
218
223
  $attrs: {
219
224
  [x: string]: unknown;
220
225
  };
@@ -302,11 +307,6 @@ declare const ChartTypes: () => ({
302
307
  type: import("vue").PropType<string>;
303
308
  default: string;
304
309
  };
305
- dataSets: {
306
- type: import("vue").PropType<import("./types").ChartDataSet[]>;
307
- required: true;
308
- default: () => any[];
309
- };
310
310
  trendTooltip: {
311
311
  type: import("vue").PropType<{
312
312
  header?: string;
@@ -334,6 +334,15 @@ declare const ChartTypes: () => ({
334
334
  type: import("vue").PropType<TrendDirection>;
335
335
  default: TrendDirection;
336
336
  };
337
+ noteText: {
338
+ type: import("vue").PropType<string>;
339
+ default: string;
340
+ };
341
+ dataSets: {
342
+ type: import("vue").PropType<import("./types").ChartDataSet[]>;
343
+ required: true;
344
+ default: () => any[];
345
+ };
337
346
  tickCount: {
338
347
  type: import("vue").PropType<number>;
339
348
  default: number;
@@ -421,12 +430,13 @@ declare const ChartTypes: () => ({
421
430
  yAxisFormat: import("./types").ValueFormat;
422
431
  valueSuffix: string;
423
432
  valuePrefix: string;
424
- dataSets: import("./types").ChartDataSet[];
425
433
  trendTooltip: any;
426
434
  subheader: string;
427
435
  subheaderTooltip: any;
428
436
  trendValue: string | number;
429
437
  trendDirection: TrendDirection;
438
+ noteText: string;
439
+ dataSets: import("./types").ChartDataSet[];
430
440
  tickCount: number;
431
441
  truncateTickLabels: boolean;
432
442
  keepSubheaderVisible: boolean;
@@ -536,11 +546,6 @@ declare const ChartTypes: () => ({
536
546
  type: import("vue").PropType<string>;
537
547
  default: string;
538
548
  };
539
- dataSets: {
540
- type: import("vue").PropType<import("./types").ChartDataSet[]>;
541
- required: true;
542
- default: () => any[];
543
- };
544
549
  trendTooltip: {
545
550
  type: import("vue").PropType<{
546
551
  header?: string;
@@ -568,6 +573,15 @@ declare const ChartTypes: () => ({
568
573
  type: import("vue").PropType<TrendDirection>;
569
574
  default: TrendDirection;
570
575
  };
576
+ noteText: {
577
+ type: import("vue").PropType<string>;
578
+ default: string;
579
+ };
580
+ dataSets: {
581
+ type: import("vue").PropType<import("./types").ChartDataSet[]>;
582
+ required: true;
583
+ default: () => any[];
584
+ };
571
585
  tickCount: {
572
586
  type: import("vue").PropType<number>;
573
587
  default: number;
@@ -710,11 +724,6 @@ declare const ChartTypes: () => ({
710
724
  type: import("vue").PropType<string>;
711
725
  default: string;
712
726
  };
713
- dataSets: {
714
- type: import("vue").PropType<import("./types").ChartDataSet[]>;
715
- required: true;
716
- default: () => any[];
717
- };
718
727
  trendTooltip: {
719
728
  type: import("vue").PropType<{
720
729
  header?: string;
@@ -742,6 +751,15 @@ declare const ChartTypes: () => ({
742
751
  type: import("vue").PropType<TrendDirection>;
743
752
  default: TrendDirection;
744
753
  };
754
+ noteText: {
755
+ type: import("vue").PropType<string>;
756
+ default: string;
757
+ };
758
+ dataSets: {
759
+ type: import("vue").PropType<import("./types").ChartDataSet[]>;
760
+ required: true;
761
+ default: () => any[];
762
+ };
745
763
  tickCount: {
746
764
  type: import("vue").PropType<number>;
747
765
  default: number;
@@ -829,12 +847,13 @@ declare const ChartTypes: () => ({
829
847
  yAxisFormat: import("./types").ValueFormat;
830
848
  valueSuffix: string;
831
849
  valuePrefix: string;
832
- dataSets: import("./types").ChartDataSet[];
833
850
  trendTooltip: any;
834
851
  subheader: string;
835
852
  subheaderTooltip: any;
836
853
  trendValue: string | number;
837
854
  trendDirection: TrendDirection;
855
+ noteText: string;
856
+ dataSets: import("./types").ChartDataSet[];
838
857
  tickCount: number;
839
858
  truncateTickLabels: boolean;
840
859
  keepSubheaderVisible: boolean;
@@ -1,4 +1,3 @@
1
1
  import { PrepareTicksLabelArgs, ValueFormat } from '@/components/chart/types';
2
- export declare const calcStepSize: (min: number, max: number, tickCount: number) => number;
3
- export declare const formatValue: (value: number | string | Date, valueFormat: ValueFormat) => string;
2
+ export declare const formatValue: (value: number | string | Date, valueFormat: ValueFormat, formatLowDigits?: boolean) => string;
4
3
  export declare const prepareTickLabel: ({ label, format, availableSpace, truncate, }: PrepareTicksLabelArgs) => string | string[];
@@ -1,27 +1,21 @@
1
- import { format as f } from "date-fns";
2
- import { TICK_LABEL_FONT as c } from "../consts.js";
3
- import { nFormatter as d } from "../../../utils/formatNumbers.js";
4
- import { truncateTextToFit as E } from "../../../utils/text.js";
5
- import { REGEX_LINEBREAK as i } from "../../../consts/regex.js";
6
- const g = (r, t, e) => {
7
- if (e === 0)
8
- return 0;
9
- const n = t - r, o = n / e * 0.4;
10
- return (n + o) / e;
11
- }, a = (r, t) => t === "day" ? f(new Date(r), "EEEE") : t === "number" ? d(r) : t === "date" ? f(new Date(r), "MMM dd") : t === "dateLong" ? f(new Date(r), "MMM dd, yyyy") : String(r), w = ({
1
+ import { format as e } from "date-fns";
2
+ import { TICK_LABEL_FONT as p } from "../consts.js";
3
+ import { nFormatter as E } from "../../../utils/formatNumbers.js";
4
+ import { truncateTextToFit as a } from "../../../utils/text.js";
5
+ import { REGEX_LINEBREAK as m } from "../../../consts/regex.js";
6
+ const c = (r, t, n = !1) => t === "day" ? e(new Date(r), "EEEE") : t === "number" ? E(r, n) : t === "date" ? e(new Date(r), "MMM dd") : t === "dateLong" ? e(new Date(r), "MMM dd, yyyy") : String(r), w = ({
12
7
  label: r,
13
8
  format: t,
14
- availableSpace: e,
15
- truncate: n = !1
9
+ availableSpace: n,
10
+ truncate: i = !1
16
11
  }) => {
17
- const s = i.test(r), o = (p) => {
18
- const m = a(p, t);
19
- return n && e > 0 ? E(m, c, e) : m;
12
+ const s = m.test(r), o = (d) => {
13
+ const f = c(d, t);
14
+ return i && n > 0 ? a(f, p, n) : f;
20
15
  };
21
- return s ? r.split(i).map(o) : o(r);
16
+ return s ? r.split(m).map(o) : o(r);
22
17
  };
23
18
  export {
24
- g as calcStepSize,
25
- a as formatValue,
19
+ c as formatValue,
26
20
  w as prepareTickLabel
27
21
  };
@@ -1,13 +1,13 @@
1
1
  import { onClickOutside as ie } from "@vueuse/core";
2
2
  import { useToggle as fe } from "../../../composables/useToggle.js";
3
- import { ref as r, computed as b, onMounted as ce, onBeforeMount as de, onUnmounted as ve, watch as Q } from "vue";
3
+ import { ref as r, computed as b, onMounted as de, onBeforeMount as ce, onUnmounted as ve, watch as Q } from "vue";
4
4
  import { min as me, addDays as ge, format as X } from "date-fns";
5
5
  import { presetsList as he, formatError as De, mandatoryValuesError as Me, navigatePrev as Z, navigateNext as V } from "./consts.common.js";
6
6
  import m from "./DateServices.common.js";
7
- const Te = (o, y) => {
8
- const N = r(null), c = r({ started: !1, date: null }), x = r(!1), _ = 2, S = r({ from: null, to: null }), s = r({}), g = r([]), k = r(null), f = r({}), T = r({}), w = r(!1), P = r(null), u = r(null), j = r("left"), p = r(null), O = r(null), E = r([]), K = r(null), [h] = fe({ initialValue: !1 }), q = r(null);
7
+ const pe = (o, y) => {
8
+ const N = r(null), d = r({ started: !1, date: null }), x = r(!1), _ = 2, S = r({ from: null, to: null }), u = r({}), g = r([]), k = r(null), i = r({}), p = r({}), C = r(!1), w = r(null), s = r(null), j = r("left"), P = r(null), O = r(null), E = r([]), K = r(null), [D] = fe({ initialValue: !1 }), q = r(null);
9
9
  ie(q, () => {
10
- h.value = !1;
10
+ D.value = !1;
11
11
  });
12
12
  const L = (e, t) => {
13
13
  const a = {
@@ -17,27 +17,27 @@ const Te = (o, y) => {
17
17
  year: t
18
18
  };
19
19
  let n, l;
20
- const d = new Date(t, e, 1).getDay();
20
+ const c = new Date(t, e, 1).getDay();
21
21
  let v = 1;
22
- const i = /* @__PURE__ */ new Date();
23
- i.setHours(0, 0, 0, 0);
24
- const se = m.daysInMonth(e, t);
22
+ const f = /* @__PURE__ */ new Date();
23
+ f.setHours(0, 0, 0, 0);
24
+ const ue = m.daysInMonth(e, t);
25
25
  for (let I = 0; I < 6; I++) {
26
26
  l = [];
27
27
  for (let H = 0; H < 7; H++)
28
- n = {}, I === 0 && d > 0 && H < d && (n.value = 0), v > se && (n.value = 0), !n.value && n.value !== 0 && (n.value = v, v += 1, a.days[n.value] = n, n.date = new Date(t, e, n.value), i < n.date ? n.isFuture = !0 : n.date.getTime() === i.getTime() && (n.isToday = !0, o.includeToday || (n.disabled = !0))), l.push(n);
28
+ n = {}, I === 0 && c > 0 && H < c && (n.value = 0), v > ue && (n.value = 0), !n.value && n.value !== 0 && (n.value = v, v += 1, a.days[n.value] = n, n.date = new Date(t, e, n.value), f < n.date ? n.isFuture = !0 : n.date.getTime() === f.getTime() && (n.isToday = !0, o.includeToday || (n.disabled = !0))), l.push(n);
29
29
  a.weeks.push(l);
30
30
  }
31
31
  return a;
32
- }, C = () => {
32
+ }, T = () => {
33
33
  let e = m.getCurrentTimeUTC();
34
- if (u.value && u.value.toEnd ? e = u.value.toEnd : o.range && o.range.to && (e = o.range.to), !s.value[`${e.getFullYear().toString()}_${e.getMonth().toString()}`]) {
35
- s.value = {}, g.value = [];
34
+ if (s.value && s.value.toEnd ? e = s.value.toEnd : o.range && o.range.to && (e = o.range.to), !u.value[`${e.getFullYear().toString()}_${e.getMonth().toString()}`]) {
35
+ u.value = {}, g.value = [];
36
36
  for (let t = 0; t < _; t++) {
37
37
  const a = new Date(e);
38
38
  a.setDate(1), a.setMonth(e.getMonth() - t);
39
39
  const n = `${a.getFullYear().toString()}_${a.getMonth().toString()}`;
40
- s.value[n] = {
40
+ u.value[n] = {
41
41
  parsedMonth: L(
42
42
  a.getMonth(),
43
43
  a.getFullYear()
@@ -47,60 +47,60 @@ const Te = (o, y) => {
47
47
  }
48
48
  }
49
49
  }, z = (e, t) => {
50
- P.value = e;
50
+ w.value = e;
51
51
  let a = e;
52
- e === "date" && (a = o.datePresetList), E.value = he[a], t && (u.value = {
52
+ e === "date" && (a = o.datePresetList), E.value = he[a], t && (s.value = {
53
53
  fromStart: null,
54
54
  fromEnd: null,
55
55
  toStart: null,
56
56
  toEnd: null
57
- }, S.value.from = "", S.value.to = "", c.value = { started: !1, date: null }, f.value = "custom"), y("rangeTypeChanged", P.value);
57
+ }, S.value.from = "", S.value.to = "", d.value = { started: !1, date: null }, i.value = "custom"), y("rangeTypeChanged", w.value);
58
58
  }, ee = (e) => {
59
- f.value = e.id, D(k.value[e.id].dates()), C();
60
- }, D = (e, t = !1) => {
59
+ i.value = e.id, M(k.value[e.id].dates()), T();
60
+ }, M = (e, t = !1) => {
61
61
  let a = e;
62
- return (!e || !e.from && !e.to) && (a = k.value[E.value[0]]), o.maxDaysInRange && (K.value = t ? ge(a.from, o.maxDaysInRange) : null), w.value = !1, !a.from || !a.to || !(a.from instanceof Date) || !(a.to instanceof Date) ? (O.value = De, w.value = !0, !1) : a.from > a.to ? (O.value = `"From" date can't be bigger than "To" date`, w.value = !0, !1) : (u.value = R(a), S.value.from = X(
63
- u.value.fromStart,
62
+ return !e.from && !e.to && e.preset ? a = k.value[e.preset]?.dates() : (!e || !e.from && !e.to) && (a = k.value[E.value[0]]), o.maxDaysInRange && (K.value = t ? ge(a.from, o.maxDaysInRange) : null), C.value = !1, !a.from || !a.to || !(a.from instanceof Date) || !(a.to instanceof Date) ? (O.value = De, C.value = !0, !1) : a.from > a.to ? (O.value = `"From" date can't be bigger than "To" date`, C.value = !0, !1) : (s.value = R(a), S.value.from = X(
63
+ s.value.fromStart,
64
64
  o.dateFormat
65
- ), S.value.to = X(u.value.toEnd, o.dateFormat), !0);
65
+ ), S.value.to = X(s.value.toEnd, o.dateFormat), !0);
66
66
  }, F = () => {
67
- f.value === "custom" ? p.value = m.getDateRangeString(u.value) : p.value = J.value, y("currentDateChanged", p.value);
67
+ i.value === "custom" ? P.value = m.getDateRangeString(s.value) : P.value = J.value, y("currentDateChanged", P.value);
68
68
  }, te = () => {
69
- if (u.value.fromStart == null || u.value.toEnd == null) {
70
- w.value = !0, O.value = Me;
69
+ if (s.value.fromStart == null || s.value.toEnd == null) {
70
+ C.value = !0, O.value = Me;
71
71
  return;
72
72
  }
73
73
  const e = m.getCurrentTimeUTC();
74
- u.value.toEnd > e && (u.value.toEnd = e), F(), T.value = f.value, y("rangeChanged", {
75
- from: u.value.fromStart,
76
- to: u.value.toEnd,
77
- preset: T.value
74
+ s.value.toEnd > e && (s.value.toEnd = e), F(), p.value = i.value, y("rangeChanged", {
75
+ from: s.value.fromStart,
76
+ to: s.value.toEnd,
77
+ preset: p.value
78
78
  }), W(!1);
79
79
  }, ae = (e, t) => e ? Z : t ? V : null, ne = (e) => {
80
80
  let t = null, a = null;
81
81
  const n = _ - 1;
82
- let l = "", M = null, d = null;
82
+ let l = "", h = null, c = null;
83
83
  switch (e) {
84
84
  case V:
85
- Object.keys(s.value).forEach((v) => {
86
- const i = s.value[v];
87
- i.order === 0 && (M = i), i.order === n ? (g.value.splice(
85
+ Object.keys(u.value).forEach((v) => {
86
+ const f = u.value[v];
87
+ f.order === 0 && (h = f), f.order === n ? (g.value.splice(
88
88
  g.value.indexOf(v),
89
89
  1
90
- ), delete s.value[v]) : i.order += 1;
91
- }), t = M.parsedMonth.month + 1, a = M.parsedMonth.year, t > 11 && (t = 0, a += 1), l = `${a.toString()}_${t.toString()}`, s.value[l] = {
90
+ ), delete u.value[v]) : f.order += 1;
91
+ }), t = h.parsedMonth.month + 1, a = h.parsedMonth.year, t > 11 && (t = 0, a += 1), l = `${a.toString()}_${t.toString()}`, u.value[l] = {
92
92
  parsedMonth: L(t, a),
93
93
  order: 0
94
94
  }, g.value.push(l);
95
95
  break;
96
96
  case Z:
97
- Object.keys(s.value).forEach((v) => {
98
- const i = s.value[v];
99
- i.order === n && (d = i), i.order === 0 ? (g.value.splice(
97
+ Object.keys(u.value).forEach((v) => {
98
+ const f = u.value[v];
99
+ f.order === n && (c = f), f.order === 0 ? (g.value.splice(
100
100
  g.value.indexOf(v),
101
101
  1
102
- ), delete s.value[v]) : i.order -= 1;
103
- }), t = d.parsedMonth.month - 1, a = d.parsedMonth.year, t < 0 && (t = 11, a -= 1), l = `${a.toString()}_${t.toString()}`, s.value[l] = {
102
+ ), delete u.value[v]) : f.order -= 1;
103
+ }), t = c.parsedMonth.month - 1, a = c.parsedMonth.year, t < 0 && (t = 11, a -= 1), l = `${a.toString()}_${t.toString()}`, u.value[l] = {
104
104
  parsedMonth: L(t, a),
105
105
  order: n
106
106
  }, g.value.unshift(l);
@@ -108,7 +108,7 @@ const Te = (o, y) => {
108
108
  }
109
109
  }, R = (e) => {
110
110
  let t;
111
- switch (P.value) {
111
+ switch (w.value) {
112
112
  case "week":
113
113
  t = {
114
114
  fromStart: m.getFirstDayOfWeek(e.from),
@@ -146,6 +146,12 @@ const Te = (o, y) => {
146
146
  return t;
147
147
  }, U = (e, t) => e.getUTCFullYear() === t.getUTCFullYear() && e.getUTCMonth() === t.getUTCMonth() && e.getUTCDate() === t.getUTCDate(), $ = (e) => {
148
148
  let t = !1;
149
+ if (!e.from && !e.to && e.preset) {
150
+ const l = E.value.find(
151
+ (h) => h.id === e.preset
152
+ );
153
+ i.value = l.id, t = !0;
154
+ }
149
155
  const a = {
150
156
  from: new Date(e.from),
151
157
  to: new Date(e.to)
@@ -153,53 +159,53 @@ const Te = (o, y) => {
153
159
  a.from.setHours(0, 0, 0, 0), a.to.setHours(0, 0, 0, 0);
154
160
  const n = E.value.map((l) => l.id);
155
161
  if (Object.keys(k.value).forEach((l) => {
156
- const M = k.value[l];
162
+ const h = k.value[l];
157
163
  if (l !== "custom" && !t && n.indexOf(l) !== -1) {
158
- const d = M.dates();
159
- d.from.setHours(0, 0, 0, 0), d.to.setHours(0, 0, 0, 0), U(d.from, a.from) && U(d.to, a.to) && (f.value = l, t = !0);
164
+ const c = h.dates();
165
+ c.from.setHours(0, 0, 0, 0), c.to.setHours(0, 0, 0, 0), U(c.from, a.from) && U(c.to, a.to) && (i.value = l, t = !0);
160
166
  }
161
167
  }), t) {
162
168
  const l = E.value.find(
163
- (M) => M.id === f.value
169
+ (h) => h.id === i.value
164
170
  );
165
171
  y("dateRangePresetNameChanged", l.name);
166
172
  } else
167
- y("dateRangePresetNameChanged", null), f.value = "custom";
168
- T.value = f.value;
173
+ y("dateRangePresetNameChanged", null), i.value = "custom";
174
+ p.value = i.value;
169
175
  }, A = (e, t, a) => {
170
- if (!c.value.started)
171
- f.value = "custom", c.value.started = !0, c.value.date = new Date(a, t, e.value), D(
172
- { from: c.value.date, to: c.value.date },
176
+ if (!d.value.started)
177
+ i.value = "custom", d.value.started = !0, d.value.date = new Date(a, t, e.value), M(
178
+ { from: d.value.date, to: d.value.date },
173
179
  !0
174
180
  );
175
181
  else {
176
- const n = new Date(a, t, e.value), l = c.value.date;
177
- c.value.started = !1, c.value.date = null, n < l ? A(e, t, a) : D({ from: l, to: n });
182
+ const n = new Date(a, t, e.value), l = d.value.date;
183
+ d.value.started = !1, d.value.date = null, n < l ? A(e, t, a) : M({ from: l, to: n });
178
184
  }
179
185
  }, B = () => {
180
186
  const e = N.value.offsetLeft;
181
187
  return window.innerWidth - e > 930 ? "left" : "right";
182
188
  }, W = (e = !0) => {
183
- h.value = !h.value, h.value ? (j.value = B(), D(o.range), C(), y("opened")) : (D(o.range), C(), f.value = T.value, e && y("dismissed"));
189
+ D.value = !D.value, D.value ? (j.value = B(), M(o.range), T(), y("opened")) : (M(o.range), T(), i.value = p.value, e && y("dismissed"));
184
190
  }, G = () => {
185
- h.value && W();
191
+ D.value && W();
186
192
  }, le = () => {
187
193
  k.value = m.getPresetsFunctions(o.includeToday), k.value.custom = {
188
194
  dates: () => o.range
189
195
  };
190
196
  }, oe = b(() => (g.value || []).reduce((e, t) => {
191
- const n = s.value[t].parsedMonth.weeks[s.value[t].parsedMonth.weeks.length - 1].filter(
197
+ const n = u.value[t].parsedMonth.weeks[u.value[t].parsedMonth.weeks.length - 1].filter(
192
198
  (l) => l.value !== 0
193
199
  ).length;
194
200
  return e && !n;
195
201
  }, !0)), Y = () => {
196
- o.range && (x.value = !0, z(o.initialType || o.types[0]), le(), $(o.range), D(o.range), C(), F());
202
+ o.range && (x.value = !0, z(o.initialType || o.types[0]), le(), $(o.range), M(o.range), T(), F());
197
203
  };
198
- ce(() => {
204
+ de(() => {
199
205
  Y();
200
- }), de(() => {
206
+ }), ce(() => {
201
207
  const e = (t) => {
202
- t.key === "Escape" && h.value && G();
208
+ t.key === "Escape" && D.value && G();
203
209
  };
204
210
  document.addEventListener("keyup", e), ve(() => {
205
211
  document.removeEventListener("keyup", e);
@@ -207,44 +213,44 @@ const Te = (o, y) => {
207
213
  }), Q(
208
214
  () => o.range,
209
215
  (e, t) => {
210
- e && e !== t && (x.value ? ($(e), D(e), F()) : Y());
216
+ e && e !== t && (x.value ? ($(e), M(e), F()) : Y());
211
217
  }
212
- ), Q(h, (e) => {
213
- e || (c.value.started = !1);
218
+ ), Q(D, (e) => {
219
+ e || (d.value.started = !1);
214
220
  });
215
221
  const J = b(() => {
216
222
  const e = E.value.find(
217
- (t) => t.id === f.value
223
+ (t) => t.id === i.value
218
224
  );
219
225
  return e ? e.name : "";
220
- }), re = b(() => `datepicker${o.uniqueId}`), ue = b(() => {
226
+ }), re = b(() => `datepicker${o.uniqueId}`), se = b(() => {
221
227
  const e = [o.maxDate, K.value].filter((t) => t);
222
228
  return e.length ? me(e) : null;
223
229
  });
224
230
  return {
225
231
  datePicker: N,
226
232
  datePickerId: re,
227
- getMaxAllowedDate: ue,
233
+ getMaxAllowedDate: se,
228
234
  selectedPresetName: J,
229
- selectedPreset: f,
230
- displayError: w,
231
- rangeType: P,
232
- selectedRange: u,
235
+ selectedPreset: i,
236
+ displayError: C,
237
+ rangeType: w,
238
+ selectedRange: s,
233
239
  placement: j,
234
- currentDate: p,
240
+ currentDate: P,
235
241
  error: O,
236
242
  presets: E,
237
- isOpen: h,
243
+ isOpen: D,
238
244
  popup: q,
239
- selectionStart: c,
245
+ selectionStart: d,
240
246
  initialized: x,
241
247
  textDates: S,
242
- currentMonths: s,
248
+ currentMonths: u,
243
249
  displayedMonthsKeys: g,
244
- initMonths: C,
250
+ initMonths: T,
245
251
  changeType: z,
246
252
  presetChanged: ee,
247
- initRange: D,
253
+ initRange: M,
248
254
  setCurrentDate: F,
249
255
  apply: te,
250
256
  getNavigation: ae,
@@ -261,5 +267,5 @@ const Te = (o, y) => {
261
267
  };
262
268
  };
263
269
  export {
264
- Te as dateRangeCommon
270
+ pe as dateRangeCommon
265
271
  };
@@ -6,7 +6,7 @@ export type Day = {
6
6
  disabled?: boolean;
7
7
  };
8
8
  export type Week = Day[];
9
- declare class DateServices {
9
+ export declare class DateServices {
10
10
  getCurrentTimeUTC(): Date;
11
11
  daysInMonth(month: any, year: any): number;
12
12
  getDateRangeString(dateRange: any): string;
@@ -239,5 +239,6 @@ class C {
239
239
  }
240
240
  const U = new C();
241
241
  export {
242
+ C as DateServices,
242
243
  U as default
243
244
  };