@tedi-design-system/react 18.2.0-rc.2 → 18.2.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,30 @@
1
1
  import { jsx as o, jsxs as b } from "react/jsx-runtime";
2
- import P from "../../../../../../external/classnames/index.es.js";
3
- import { useState as g, useEffect as Q, useCallback as w } from "react";
4
- import { Heading as U } from "../../../base/typography/heading/heading.es.js";
2
+ import Q from "../../../../../../external/classnames/index.es.js";
3
+ import { useState as g, useEffect as U, useCallback as w } from "react";
4
+ import { Heading as W } from "../../../base/typography/heading/heading.es.js";
5
5
  import { Button as T } from "../../../buttons/button/button.es.js";
6
- import { ClosingButton as W } from "../../../buttons/closing-button/closing-button.es.js";
7
- import { Calendar as X } from "../../../content/calendar/calendar.es.js";
8
- import { resolveRangeSelection as Z } from "../date-field-helpers.es.js";
6
+ import { ClosingButton as X } from "../../../buttons/closing-button/closing-button.es.js";
7
+ import { Calendar as Z } from "../../../content/calendar/calendar.es.js";
8
+ import { resolveRangeSelection as $ } from "../date-field-helpers.es.js";
9
9
  import c from "./date-picker-modal.module.scss.es.js";
10
- import { useLabels as $ } from "../../../../providers/label-provider/use-labels.es.js";
10
+ import { useLabels as v } from "../../../../providers/label-provider/use-labels.es.js";
11
11
  import { Modal as d } from "../../../overlays/modal/modal.es.js";
12
- import { useModal as v } from "../../../overlays/modal/modal-context.es.js";
13
- const _ = (e, n) => e instanceof Date ? e : Array.isArray(e) && e.length > 0 ? [...e].sort((a, l) => a.getTime() - l.getTime())[0] : e && typeof e == "object" && "from" in e && e.from instanceof Date ? e.from : e && typeof e == "object" && "to" in e && e.to instanceof Date ? e.to : n ?? /* @__PURE__ */ new Date(), ee = ({ title: e }) => {
14
- const { labelId: n, onOpenChange: a } = v();
12
+ import { useModal as ee } from "../../../overlays/modal/modal-context.es.js";
13
+ const _ = (e, n) => e instanceof Date ? e : Array.isArray(e) && e.length > 0 ? [...e].sort((a, l) => a.getTime() - l.getTime())[0] : e && typeof e == "object" && "from" in e && e.from instanceof Date ? e.from : e && typeof e == "object" && "to" in e && e.to instanceof Date ? e.to : n ?? /* @__PURE__ */ new Date(), te = ({ title: e }) => {
14
+ const { labelId: n, onOpenChange: a } = ee();
15
15
  return /* @__PURE__ */ b("div", { className: c["tedi-date-picker-modal__header"], children: [
16
- /* @__PURE__ */ o(U, { element: "h2", modifiers: "h4", id: n, className: c["tedi-date-picker-modal__title"], children: e }),
17
- /* @__PURE__ */ o(W, { size: "small", onClick: () => a(!1) })
16
+ /* @__PURE__ */ o(W, { element: "h2", modifiers: "h4", id: n, className: c["tedi-date-picker-modal__title"], children: e }),
17
+ /* @__PURE__ */ o(X, { size: "small", onClick: () => a(!1) })
18
18
  ] });
19
- }, te = (e) => {
19
+ }, ie = (e) => {
20
20
  const {
21
21
  open: n,
22
22
  onOpenChange: a,
23
23
  value: l,
24
24
  onConfirm: A,
25
25
  mode: t = "single",
26
- numberOfMonths: j,
27
- locale: S,
26
+ numberOfMonths: S,
27
+ locale: j,
28
28
  localeCode: x,
29
29
  showOutsideDays: O = !0,
30
30
  disabledMatchers: B,
@@ -32,30 +32,31 @@ const _ = (e, n) => e instanceof Date ? e : Array.isArray(e) && e.length > 0 ? [
32
32
  availableDays: H,
33
33
  footer: L,
34
34
  monthYearSelectType: V,
35
- showNavigation: I,
35
+ dayStatus: I,
36
+ showNavigation: K,
36
37
  selectionLevel: m = "days",
37
38
  initialView: h,
38
39
  initialMonth: p,
39
40
  modalProps: i,
40
- title: K,
41
- ...q
42
- } = e, { getLabel: y } = $(), [r, f] = g(l), [z, C] = g(h ?? m), [E, D] = g(() => _(l, p));
43
- Q(() => {
41
+ title: q,
42
+ ...z
43
+ } = e, { getLabel: y } = v(), [r, f] = g(l), [E, C] = g(h ?? m), [F, D] = g(() => _(l, p));
44
+ U(() => {
44
45
  n && (f(l), C(h ?? m), D(_(l, p)));
45
46
  }, [n, l, m, h, p]);
46
- const F = w(
47
+ const R = w(
47
48
  (s, u) => {
48
- f(t === "range" ? (J) => Z(s, J, u) : s);
49
+ f(t === "range" ? (P) => $(s, P, u) : s);
49
50
  },
50
51
  [t]
51
- ), R = w(
52
+ ), Y = w(
52
53
  (s) => {
53
54
  f((u) => t === "range" ? { from: s, to: void 0 } : t === "multiple" ? [...Array.isArray(u) ? u : [], s] : s);
54
55
  },
55
56
  [t]
56
- ), Y = t === "multiple" ? Array.isArray(r) && r.length > 0 : t === "range" ? !!r && typeof r == "object" && "from" in r && r.from instanceof Date : r instanceof Date, M = k === !0 && !Y, G = () => {
57
+ ), G = t === "multiple" ? Array.isArray(r) && r.length > 0 : t === "range" ? !!r && typeof r == "object" && "from" in r && r.from instanceof Date : r instanceof Date, M = k === !0 && !G, J = () => {
57
58
  M || (A(r), a(!1));
58
- }, N = K ?? y(t === "range" ? "date-field.modal-title-range" : t === "multiple" ? "date-field.modal-title-multiple" : "date-field.modal-title");
59
+ }, N = q ?? y(t === "range" ? "date-field.modal-title-range" : t === "multiple" ? "date-field.modal-title-multiple" : "date-field.modal-title");
59
60
  return /* @__PURE__ */ o(d, { open: n, onToggle: a, children: /* @__PURE__ */ b(
60
61
  d.Content,
61
62
  {
@@ -64,22 +65,22 @@ const _ = (e, n) => e instanceof Date ? e : Array.isArray(e) && e.length > 0 ? [
64
65
  ...i,
65
66
  md: { width: "max-content", ...i == null ? void 0 : i.md },
66
67
  sm: { width: "full", ...i == null ? void 0 : i.sm },
67
- className: P(c["tedi-date-picker-modal"], i == null ? void 0 : i.className),
68
+ className: Q(c["tedi-date-picker-modal"], i == null ? void 0 : i.className),
68
69
  children: [
69
- /* @__PURE__ */ o(d.Header, { children: /* @__PURE__ */ o(ee, { title: N }) }),
70
+ /* @__PURE__ */ o(d.Header, { children: /* @__PURE__ */ o(te, { title: N }) }),
70
71
  /* @__PURE__ */ o(d.Body, { className: c["tedi-date-picker-modal__body"], children: /* @__PURE__ */ o(
71
- X,
72
+ Z,
72
73
  {
73
- ...q,
74
- numberOfMonths: j,
75
- view: z,
74
+ ...z,
75
+ numberOfMonths: S,
76
+ view: E,
76
77
  selectionLevel: m,
77
- currentMonth: E,
78
+ currentMonth: F,
78
79
  setCurrentMonth: D,
79
80
  setView: C,
80
81
  mode: t,
81
82
  value: r,
82
- locale: S,
83
+ locale: j,
83
84
  localeCode: x,
84
85
  showOutsideDays: O,
85
86
  disabledMatchers: B,
@@ -87,22 +88,23 @@ const _ = (e, n) => e instanceof Date ? e : Array.isArray(e) && e.length > 0 ? [
87
88
  availableDays: H,
88
89
  footer: L,
89
90
  monthYearSelectType: V,
90
- showNavigation: I,
91
- handleSelect: F,
92
- applyValue: R,
91
+ dayStatus: I,
92
+ showNavigation: K,
93
+ handleSelect: R,
94
+ applyValue: Y,
93
95
  className: c["tedi-date-picker-modal__calendar"],
94
96
  bordered: !1
95
97
  }
96
98
  ) }),
97
99
  /* @__PURE__ */ b(d.Footer, { children: [
98
100
  /* @__PURE__ */ o(T, { visualType: "secondary", onClick: () => a(!1), children: y("date-field.cancel") }),
99
- /* @__PURE__ */ o(T, { onClick: G, disabled: M, children: y("date-field.confirm") })
101
+ /* @__PURE__ */ o(T, { onClick: J, disabled: M, children: y("date-field.confirm") })
100
102
  ] })
101
103
  ]
102
104
  }
103
105
  ) });
104
106
  };
105
- te.displayName = "DatePickerModal";
107
+ ie.displayName = "DatePickerModal";
106
108
  export {
107
- te as DatePickerModal
109
+ ie as DatePickerModal
108
110
  };