@tedi-design-system/react 18.1.0-rc.25 → 18.1.0-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 (37) hide show
  1. package/bundle-stats.html +1 -1
  2. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  3. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  4. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  5. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  6. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  7. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  8. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  9. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  10. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  11. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  12. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  13. package/external/prop-types/external/react-is/index.es.js +1 -1
  14. package/index.css +1 -1
  15. package/package.json +1 -1
  16. package/src/community/components/tooltip/tooltip-trigger.cjs.js +1 -1
  17. package/src/community/components/tooltip/tooltip-trigger.es.js +15 -14
  18. package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
  19. package/src/tedi/components/form/date-field/date-field.d.ts +15 -0
  20. package/src/tedi/components/form/date-field/date-field.es.js +304 -269
  21. package/src/tedi/components/form/multi-value-field/multi-value-field.cjs.js +1 -1
  22. package/src/tedi/components/form/multi-value-field/multi-value-field.d.ts +8 -0
  23. package/src/tedi/components/form/multi-value-field/multi-value-field.es.js +147 -66
  24. package/src/tedi/components/form/multi-value-field/multi-value-field.module.scss.cjs.js +1 -1
  25. package/src/tedi/components/form/multi-value-field/multi-value-field.module.scss.es.js +3 -0
  26. package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.cjs.js +1 -1
  27. package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.es.js +8 -7
  28. package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.cjs.js +1 -1
  29. package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.es.js +10 -9
  30. package/src/tedi/components/overlays/overlay/overlay-trigger.cjs.js +1 -1
  31. package/src/tedi/components/overlays/overlay/overlay-trigger.es.js +20 -19
  32. package/src/tedi/helpers/get-element-ref.cjs.js +1 -0
  33. package/src/tedi/helpers/get-element-ref.d.ts +11 -0
  34. package/src/tedi/helpers/get-element-ref.es.js +8 -0
  35. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  36. package/src/tedi/providers/label-provider/labels-map.d.ts +21 -0
  37. package/src/tedi/providers/label-provider/labels-map.es.js +21 -0
@@ -1,217 +1,231 @@
1
- import { jsxs as st, Fragment as lt, jsx as D } from "react/jsx-runtime";
2
- import { useFloating as ft, useClick as dt, useInteractions as ct, useDismiss as ut, useRole as mt, FloatingPortal as pt, FloatingFocusManager as ht } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
- import T from "../../../../../external/classnames/index.es.js";
4
- import oe, { useState as A, useCallback as ne, useEffect as B, useMemo as se } from "react";
5
- import { Calendar as gt } from "../../content/calendar/calendar.es.js";
6
- import { MultiValueField as yt } from "../multi-value-field/multi-value-field.es.js";
7
- import { TextField as bt } from "../textfield/textfield.es.js";
8
- import h from "./date-field.module.scss.es.js";
9
- import { getLocaleDateParts as Dt, buildDateRegexSource as _t, resolveRangeSelection as Mt, CALENDAR_POPOVER_OFFSET as At, CALENDAR_POPOVER_PADDING as ve } from "./date-field-helpers.es.js";
10
- import { DatePickerModal as Ct } from "./date-picker-modal/date-picker-modal.es.js";
11
- import { useBreakpointProps as xt } from "../../../helpers/hooks/use-breakpoint-props.es.js";
12
- import { useLabels as kt } from "../../../providers/label-provider/use-labels.es.js";
13
- import { et as wt } from "../../../../../external/react-day-picker/dist/esm/locale/et.es.js";
14
- import Nt, { isBreakpointBelow as Fe } from "../../../helpers/hooks/use-breakpoint.es.js";
15
- import { autoUpdate as vt } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
16
- import { offset as Ft, flip as Pt, shift as Ot, size as Rt } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
17
- import { dateMatchModifiers as Et } from "../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.es.js";
18
- const Vt = oe.forwardRef((I, w) => {
19
- const { getCurrentBreakpointProps: Pe } = xt(I.defaultServerBreakpoint), { getLabel: Oe } = kt(), {
20
- useNativePicker: Re = !1,
21
- enableCalendar: u = !0,
22
- calendarTrigger: $ = "button",
23
- numberOfMonths: q
24
- } = Pe(I), {
25
- id: le,
1
+ import { jsxs as Ct, Fragment as Mt, jsx as D } from "react/jsx-runtime";
2
+ import { useFloating as At, useClick as xt, useInteractions as Ft, useDismiss as vt, useRole as wt, FloatingPortal as Nt, FloatingFocusManager as kt } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import V from "../../../../../external/classnames/index.es.js";
4
+ import B, { useState as _, useCallback as ue, useEffect as T, useMemo as me } from "react";
5
+ import { Calendar as Pt } from "../../content/calendar/calendar.es.js";
6
+ import { MultiValueField as Et } from "../multi-value-field/multi-value-field.es.js";
7
+ import { TextField as Ot } from "../textfield/textfield.es.js";
8
+ import g from "./date-field.module.scss.es.js";
9
+ import { getLocaleDateParts as Rt, buildDateRegexSource as It, resolveRangeSelection as Vt, CALENDAR_POPOVER_OFFSET as Bt, CALENDAR_POPOVER_PADDING as $e } from "./date-field-helpers.es.js";
10
+ import { DatePickerModal as Tt } from "./date-picker-modal/date-picker-modal.es.js";
11
+ import { useBreakpointProps as $t } from "../../../helpers/hooks/use-breakpoint-props.es.js";
12
+ import { useLabels as Lt } from "../../../providers/label-provider/use-labels.es.js";
13
+ import { et as jt } from "../../../../../external/react-day-picker/dist/esm/locale/et.es.js";
14
+ import Ht, { isBreakpointBelow as Le } from "../../../helpers/hooks/use-breakpoint.es.js";
15
+ import { autoUpdate as Wt } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
16
+ import { offset as Yt, flip as St, shift as Ut, size as qt } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
17
+ import { dateMatchModifiers as zt } from "../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.es.js";
18
+ const Gt = B.forwardRef(($, v) => {
19
+ const { getCurrentBreakpointProps: je } = $t($.defaultServerBreakpoint), { getLabel: z } = Lt(), {
20
+ useNativePicker: He = !1,
21
+ enableCalendar: m = !0,
22
+ calendarTrigger: L = "button",
23
+ numberOfMonths: G
24
+ } = je($), {
25
+ id: pe,
26
26
  mode: s = "single",
27
- label: fe,
28
- selected: N,
27
+ label: he,
28
+ selected: w,
29
29
  onSelect: a,
30
- disabled: v,
31
- disabledMatchers: F,
32
- placeholder: Ee,
33
- className: Ve,
34
- formatDate: l,
35
- required: L,
36
- showOutsideDays: de = !0,
37
- parseDate: Te,
38
- monthYearSelectType: ce,
39
- showNavigation: ue = !0,
30
+ disabled: N,
31
+ disabledMatchers: k,
32
+ placeholder: We,
33
+ className: Ye,
34
+ formatDate: f,
35
+ required: j,
36
+ showOutsideDays: ge = !0,
37
+ parseDate: Se,
38
+ monthYearSelectType: ye,
39
+ tagsDirection: Ue,
40
+ showNavigation: be = !0,
40
41
  selectionLevel: P = "days",
41
- initialView: j,
42
- locale: me = wt,
42
+ initialView: H,
43
+ locale: De = jt,
43
44
  localeCode: W = "et-EE",
44
45
  initialMonth: Y,
45
- closeOnSelect: Be,
46
- footer: pe,
47
- defaultValue: H,
48
- minDate: z,
49
- maxDate: G,
50
- disablePast: he,
51
- disableFuture: ge,
52
- shouldDisableMonth: X,
53
- shouldDisableYear: J,
54
- readOnly: O,
55
- availableDays: ye,
56
- inputProps: n,
57
- modal: K = !1,
58
- modalProps: Ie,
59
- modalTitle: $e,
60
- disabledDateErrorMessage: Le = Oe("dateField.disabledDateError"),
61
- useNativePicker: Tt,
62
- enableCalendar: Bt,
63
- calendarTrigger: It,
64
- numberOfMonths: $t,
65
- defaultServerBreakpoint: Lt,
66
- sm: jt,
67
- md: Wt,
68
- lg: Yt,
69
- xl: Ht,
70
- xxl: St,
71
- ...be
72
- } = I, c = Re && s === "single", De = Nt(I.defaultServerBreakpoint), C = Fe(De, "md"), [je, g] = A(N ?? H), [m, R] = A(!1), [Q, _e] = A(!1), [We, Me] = A(j ?? P), [Ye, y] = A(""), [Ae, p] = A(!1), b = u && !c && !O && (K === !0 || typeof K == "string" && Fe(De, K)), Ce = C && !b && typeof q == "number" && q > 1 ? 1 : q, f = N !== void 0, o = f ? N : je, xe = oe.useRef(null), He = oe.useCallback(
46
+ closeOnSelect: qe,
47
+ footer: _e,
48
+ defaultValue: S,
49
+ minDate: X,
50
+ maxDate: J,
51
+ disablePast: Ce,
52
+ disableFuture: Me,
53
+ shouldDisableMonth: K,
54
+ shouldDisableYear: Q,
55
+ readOnly: E,
56
+ availableDays: Ae,
57
+ inputProps: i,
58
+ modal: Z = !1,
59
+ modalProps: ze,
60
+ modalTitle: Ge,
61
+ disabledDateErrorMessage: Xe = z("dateField.disabledDateError"),
62
+ invalidDateErrorMessage: Je = z("dateField.invalidDateError"),
63
+ useNativePicker: Xt,
64
+ enableCalendar: Jt,
65
+ calendarTrigger: Kt,
66
+ numberOfMonths: Qt,
67
+ defaultServerBreakpoint: Zt,
68
+ sm: er,
69
+ md: tr,
70
+ lg: rr,
71
+ xl: ar,
72
+ xxl: ir,
73
+ ...xe
74
+ } = $, c = He && s === "single", Fe = Ht($.defaultServerBreakpoint), x = Le(Fe, "md"), [Ke, y] = _(w ?? S), [p, O] = _(!1), [ee, ve] = _(!1), [Qe, we] = _(H ?? P), [te, b] = _(""), [Ne, u] = _(!1), [ke, re] = _(!1), h = m && !c && !E && (Z === !0 || typeof Z == "string" && Le(Fe, Z)), Pe = x && !h && typeof G == "number" && G > 1 ? 1 : G, d = w !== void 0, n = d ? w : Ke, ae = B.useRef(null), Ee = B.useRef(null), Ze = B.useCallback(
73
75
  (e) => {
74
- xe.current = e, typeof w == "function" ? w(e) : w && (w.current = e);
76
+ ae.current = e, typeof v == "function" ? v(e) : v && (v.current = e);
75
77
  },
76
- [w]
77
- ), Se = (e) => {
78
+ [v]
79
+ ), et = (e) => {
78
80
  if (!e) return "";
79
- const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), d = String(e.getDate()).padStart(2, "0");
80
- return `${t}-${r}-${d}`;
81
- }, Ue = c && o instanceof Date ? Se(o) : "", Z = ne((e, t) => e instanceof Date ? e : Array.isArray(e) && e.length > 0 ? [...e].sort((r, d) => r.getTime() - d.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 : t ?? /* @__PURE__ */ new Date(), []), [qe, ee] = A(() => Z(o, Y));
82
- B(() => {
83
- m || ee(Z(o, Y));
84
- }, [o, Y, m, Z]), B(() => {
85
- m && Me(j ?? P);
86
- }, [m, P, j]), B(() => {
87
- f && g(N);
88
- }, [N, f]);
89
- const _ = se(
81
+ const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0");
82
+ return `${t}-${r}-${o}`;
83
+ }, tt = c && n instanceof Date ? et(n) : "", ie = ue((e, t) => e instanceof Date ? e : Array.isArray(e) && e.length > 0 ? [...e].sort((r, o) => r.getTime() - o.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 : t ?? /* @__PURE__ */ new Date(), []), [rt, oe] = _(() => ie(n, Y));
84
+ T(() => {
85
+ p || oe(ie(n, Y));
86
+ }, [n, Y, p, ie]), T(() => {
87
+ p && we(H ?? P);
88
+ }, [p, P, H]), T(() => {
89
+ d && y(w);
90
+ }, [w, d]);
91
+ const C = me(
90
92
  () => new Intl.DateTimeFormat(W, {
91
93
  day: "2-digit",
92
94
  month: "2-digit",
93
95
  year: "numeric"
94
96
  }),
95
97
  [W]
96
- ), M = ne(
98
+ ), M = ue(
97
99
  (e) => {
98
100
  if (!e) return "";
99
- if (e instanceof Date) return _.format(e);
100
- if (Array.isArray(e)) return e.map((t) => _.format(t)).join(", ");
101
+ if (e instanceof Date) return C.format(e);
102
+ if (Array.isArray(e)) return e.map((t) => C.format(t)).join(", ");
101
103
  if (e.from) {
102
- const t = _.format(e.from);
103
- return e.to ? `${t} – ${_.format(e.to)}` : t;
104
+ const t = C.format(e.from);
105
+ return e.to ? `${t} – ${C.format(e.to)}` : t;
104
106
  }
105
107
  return "";
106
108
  },
107
- [_]
108
- ), te = Be ?? s === "single", ke = s === "multiple" && Array.isArray(o) ? o.map((e, t) => ({
109
+ [C]
110
+ ), ne = qe ?? s === "single", Oe = s === "multiple" && Array.isArray(n) ? n.map((e, t) => ({
109
111
  id: t,
110
- label: l ? l(e) : M(e),
112
+ label: f ? f(e) : M(e),
111
113
  date: e
112
- })) : [], S = se(() => {
114
+ })) : [], U = me(() => {
113
115
  const e = [];
114
- return v && (Array.isArray(v) ? e.push(...v) : e.push(v)), F && (Array.isArray(F) ? e.push(...F) : e.push(F)), z && e.push({ before: z }), G && e.push({ after: G }), he && e.push({ before: /* @__PURE__ */ new Date() }), ge && e.push({ after: /* @__PURE__ */ new Date() }), X && e.push((t) => X(t)), J && e.push((t) => J(t)), e;
116
+ return N && (Array.isArray(N) ? e.push(...N) : e.push(N)), k && (Array.isArray(k) ? e.push(...k) : e.push(k)), X && e.push({ before: X }), J && e.push({ after: J }), Ce && e.push({ before: /* @__PURE__ */ new Date() }), Me && e.push({ after: /* @__PURE__ */ new Date() }), K && e.push((t) => K(t)), Q && e.push((t) => Q(t)), e;
115
117
  }, [
116
- v,
117
- F,
118
- z,
119
- G,
120
- he,
121
- ge,
118
+ N,
119
+ k,
122
120
  X,
123
- J
124
- ]), x = ne(
125
- (e) => Et(e, S),
126
- [S]
127
- ), ze = (e, t, r, d) => {
128
- const i = s === "range" ? Mt(e, o, t) : e;
129
- if (p(!1), f || g(i), a == null || a(i, t, r, d), i) {
130
- const E = l ? l(i) : M(i);
131
- y(E);
121
+ J,
122
+ Ce,
123
+ Me,
124
+ K,
125
+ Q
126
+ ]), F = ue(
127
+ (e) => zt(e, U),
128
+ [U]
129
+ ), at = (e, t, r, o) => {
130
+ const l = s === "range" ? Vt(e, n, t) : e;
131
+ if (u(!1), d || y(l), a == null || a(l, t, r, o), l) {
132
+ const A = f ? f(l) : M(l);
133
+ b(A);
132
134
  } else
133
- y("");
134
- te && R(!1);
135
- }, Ge = (e) => {
136
- if (x(e)) return;
137
- const t = s === "range" ? { from: e, to: void 0 } : s === "multiple" ? [...Array.isArray(o) ? o : [], e] : e;
138
- p(!1), f || g(t), a == null || a(t, e, {}, {});
139
- const r = l ? l(t) : M(t);
140
- y(r), te && R(!1);
141
- }, Xe = se(() => {
142
- const e = Dt(_), t = new RegExp(`^${_t(e)}$`), { fieldOrder: r } = e;
143
- return (d) => {
144
- const i = d.match(t);
145
- if (!i) return;
146
- const E = {};
147
- r.forEach((ot, nt) => {
148
- E[ot] = Number(i[nt + 1]);
135
+ b("");
136
+ ne && O(!1);
137
+ }, it = (e) => {
138
+ if (F(e)) return;
139
+ const t = s === "range" ? { from: e, to: void 0 } : s === "multiple" ? [...Array.isArray(n) ? n : [], e] : e;
140
+ u(!1), d || y(t), a == null || a(t, e, {}, {});
141
+ const r = f ? f(t) : M(t);
142
+ b(r), ne && O(!1);
143
+ }, ot = me(() => {
144
+ const e = Rt(C), t = new RegExp(`^${It(e)}$`), { fieldOrder: r } = e;
145
+ return (o) => {
146
+ const l = o.match(t);
147
+ if (!l) return;
148
+ const A = {};
149
+ r.forEach((Dt, _t) => {
150
+ A[Dt] = Number(l[_t + 1]);
149
151
  });
150
- const { day: k, month: ae, year: ie } = E;
151
- if (k === void 0 || ae === void 0 || ie === void 0) return;
152
- const V = new Date(ie, ae - 1, k);
153
- if (!(isNaN(V.getTime()) || V.getFullYear() !== ie || V.getMonth() !== ae - 1 || V.getDate() !== k))
154
- return V;
152
+ const { day: fe, month: de, year: ce } = A;
153
+ if (fe === void 0 || de === void 0 || ce === void 0) return;
154
+ const I = new Date(ce, de - 1, fe);
155
+ if (!(isNaN(I.getTime()) || I.getFullYear() !== ce || I.getMonth() !== de - 1 || I.getDate() !== fe))
156
+ return I;
155
157
  };
156
- }, [_]), Je = (e) => {
157
- if (y(e), e.trim() === "") {
158
- p(!1);
158
+ }, [C]), Re = (e) => (Se ?? (s === "single" ? ot : () => {
159
+ }))(e), Ie = (e) => s === "single" && e instanceof Date || s === "multiple" && Array.isArray(e) || s === "range" && !!e && !Array.isArray(e) && "from" in e, nt = (e) => {
160
+ if (b(e), re(!1), e.trim() === "") {
161
+ u(!1);
162
+ return;
163
+ }
164
+ const t = Re(e);
165
+ if (!Ie(t)) {
166
+ u(!1);
159
167
  return;
160
168
  }
161
- const r = (Te ?? (s === "single" ? Xe : () => {
162
- }))(e);
163
- if (!(s === "single" && r instanceof Date || s === "multiple" && Array.isArray(r) || s === "range" && !!r && !Array.isArray(r) && "from" in r)) {
164
- p(!1);
169
+ const o = t && !Array.isArray(t) && "from" in t ? t : null;
170
+ if (t instanceof Date && F(t) || Array.isArray(t) && t.some((A) => A instanceof Date && F(A)) || !!o && (o.from && F(o.from) || o.to && F(o.to))) {
171
+ u(!0);
165
172
  return;
166
173
  }
167
- const i = r && !Array.isArray(r) && "from" in r ? r : null;
168
- if (r instanceof Date && x(r) || Array.isArray(r) && r.some((k) => k instanceof Date && x(k)) || !!i && (i.from && x(i.from) || i.to && x(i.to))) {
169
- p(!0);
174
+ u(!1), d || y(t), a == null || a(t, t, {}, {}), t instanceof Date && oe(t), ne && O(!1);
175
+ }, st = () => {
176
+ if (te.trim() === "") {
177
+ re(!1);
170
178
  return;
171
179
  }
172
- p(!1), f || g(r), a == null || a(r, r, {}, {}), r instanceof Date && ee(r), te && R(!1);
180
+ re(!Ie(Re(te)));
173
181
  };
174
- B(() => {
175
- if (f) {
176
- const e = l ? l(o) : M(o);
177
- y(e);
182
+ T(() => {
183
+ if (d) {
184
+ const e = f ? f(n) : M(n);
185
+ b(e);
178
186
  }
179
- }, [o, f, l, M]), B(() => {
180
- if (!f && H) {
181
- const e = l ? l(H) : M(H);
182
- y(e);
187
+ }, [n, d, f, M]), T(() => {
188
+ if (!d && S) {
189
+ const e = f ? f(S) : M(S);
190
+ b(e);
183
191
  }
184
192
  }, []);
185
- const Ke = ft({
186
- open: m,
187
- onOpenChange: R,
188
- placement: $ === "input" ? "bottom-start" : "bottom-end",
193
+ const lt = At({
194
+ open: p,
195
+ onOpenChange: O,
196
+ placement: L === "input" ? "bottom-start" : "bottom-end",
189
197
  middleware: [
190
- Ft(At),
191
- Pt(),
192
- Ot({ padding: ve }),
193
- Rt({
194
- padding: ve,
198
+ Yt(Bt),
199
+ St(),
200
+ Ut({ padding: $e }),
201
+ qt({
202
+ padding: $e,
195
203
  apply({ availableWidth: e, elements: t }) {
196
204
  const r = t.floating;
197
- if (r.style.width = "", r.style.maxWidth = "", r.style.overflowX = "", C) return;
205
+ if (r.style.width = "", r.style.maxWidth = "", r.style.overflowX = "", x) return;
198
206
  r.style.width = "max-content", r.getBoundingClientRect().width > e && (r.style.width = "min-content", r.style.maxWidth = `${e}px`);
199
207
  }
200
208
  })
201
209
  ],
202
- whileElementsMounted: vt
203
- }), { refs: we, context: U, x: Qe, y: Ze, strategy: et } = Ke, tt = dt(U), Ne = ct([
204
- ...u && !c && $ === "input" && !b ? [tt] : [],
205
- ut(U, {
210
+ whileElementsMounted: Wt
211
+ }), { refs: R, context: q, x: ft, y: dt, strategy: ct } = lt, ut = xt(q), Ve = Ft([
212
+ ...m && !c && L === "input" && !h ? [ut] : [],
213
+ vt(q, {
206
214
  outsidePress: (e) => {
207
215
  const t = e.target;
208
216
  return !(t != null && t.closest('[role="menu"], [role="listbox"]'));
209
217
  }
210
218
  }),
211
- mt(U, { role: "dialog" })
212
- ]), rt = () => {
219
+ wt(q, { role: "dialog" })
220
+ ]);
221
+ B.useEffect(() => {
222
+ var t, r;
223
+ const e = s === "multiple" ? ((t = Ee.current) == null ? void 0 : t.wrapper) ?? null : ((r = ae.current) == null ? void 0 : r.input) ?? null;
224
+ R.setPositionReference(e ?? R.reference.current);
225
+ }, [s, p, R]);
226
+ const mt = () => {
213
227
  var t;
214
- const e = (t = xe.current) == null ? void 0 : t.input;
228
+ const e = (t = ae.current) == null ? void 0 : t.input;
215
229
  if (e) {
216
230
  if (typeof e.showPicker == "function")
217
231
  try {
@@ -221,161 +235,182 @@ const Vt = oe.forwardRef((I, w) => {
221
235
  }
222
236
  e.focus();
223
237
  }
224
- }, re = () => {
225
- !u || O || (c ? rt() : b ? _e(!0) : R((e) => !e));
226
- }, at = (e) => {
227
- if (p(!1), f || g(e), a == null || a(e, e, {}, {}), e) {
228
- const t = l ? l(e) : M(e);
229
- y(t);
238
+ }, se = () => {
239
+ !m || E || (c ? mt() : h ? ve(!0) : O((e) => !e));
240
+ }, pt = (e) => {
241
+ if (u(!1), d || y(e), a == null || a(e, e, {}, {}), e) {
242
+ const t = f ? f(e) : M(e);
243
+ b(t);
230
244
  } else
231
- y("");
232
- }, it = (e) => {
245
+ b("");
246
+ }, ht = (e) => {
233
247
  if (!e) {
234
- p(!1), f || g(void 0), a == null || a(void 0, void 0, {}, {});
248
+ u(!1), d || y(void 0), a == null || a(void 0, void 0, {}, {});
235
249
  return;
236
250
  }
237
- const [t, r, d] = e.split("-").map(Number);
238
- if (!t || !r || !d) return;
239
- const i = new Date(t, r - 1, d);
240
- if (!Number.isNaN(i.getTime())) {
241
- if (x(i)) {
242
- p(!0);
251
+ const [t, r, o] = e.split("-").map(Number);
252
+ if (!t || !r || !o) return;
253
+ const l = new Date(t, r - 1, o);
254
+ if (!Number.isNaN(l.getTime())) {
255
+ if (F(l)) {
256
+ u(!0);
243
257
  return;
244
258
  }
245
- p(!1), f || g(i), a == null || a(i, i, {}, {});
259
+ u(!1), d || y(l), a == null || a(l, l, {}, {});
246
260
  }
261
+ }, gt = Ve.getReferenceProps(
262
+ h && L === "input" ? { onClick: () => se() } : void 0
263
+ ), {
264
+ role: or,
265
+ "aria-expanded": nr,
266
+ "aria-haspopup": sr,
267
+ "aria-controls": yt,
268
+ ...bt
269
+ } = gt, Be = h ? void 0 : yt, le = z("dateField.openCalendar"), Te = {
270
+ "aria-label": le,
271
+ "aria-expanded": h ? ee : p,
272
+ "aria-haspopup": "dialog",
273
+ "aria-controls": Be
247
274
  };
248
- return /* @__PURE__ */ st(lt, { children: [
275
+ return /* @__PURE__ */ Ct(Mt, { children: [
249
276
  /* @__PURE__ */ D(
250
277
  "div",
251
278
  {
252
- className: T(h["tedi-date-field__container"], Ve),
253
- ...Ne.getReferenceProps(
254
- b && $ === "input" ? { onClick: () => re() } : void 0
255
- ),
256
- ref: we.setReference,
279
+ className: V(g["tedi-date-field__container"], Ye),
280
+ ...bt,
281
+ ref: R.setReference,
257
282
  children: s === "multiple" ? /* @__PURE__ */ D(
258
- yt,
283
+ Et,
259
284
  {
260
- ...n,
261
- id: le,
262
- label: fe,
263
- values: ke.map((e) => e.label),
285
+ ...i,
286
+ ref: Ee,
287
+ id: pe,
288
+ label: he,
289
+ tagsDirection: Ue,
290
+ values: Oe.map((e) => e.label),
264
291
  icon: "calendar_today",
265
- onIconClick: re,
266
- iconButtonProps: u ? { "aria-expanded": b ? Q : m, "aria-haspopup": "dialog" } : void 0,
292
+ onIconClick: se,
293
+ iconButtonProps: m ? Te : { "aria-label": le },
267
294
  isClearable: !0,
268
- required: L,
295
+ required: j,
269
296
  onChange: (e) => {
270
- if (!Array.isArray(o)) return;
271
- const t = ke.filter((r) => e.includes(r.label)).map((r) => r.date);
272
- f || g(t), a == null || a(t, {}, {}, {});
297
+ if (!Array.isArray(n)) return;
298
+ const t = Oe.filter((r) => e.includes(r.label)).map((r) => r.date);
299
+ d || y(t), a == null || a(t, {}, {}, {});
273
300
  },
274
- className: T(h["tedi-date-field__textfield"], {
275
- [h["tedi-date-field__icon--disabled"]]: !u || O
301
+ className: V(g["tedi-date-field__textfield"], {
302
+ [g["tedi-date-field__icon--disabled"]]: !m || E
276
303
  })
277
304
  }
278
305
  ) : /* @__PURE__ */ D(
279
- bt,
306
+ Ot,
280
307
  {
281
- ...n,
282
- ref: He,
283
- id: le,
284
- label: fe,
285
- readOnly: O,
286
- value: c ? Ue : Ye,
287
- placeholder: Ee,
308
+ ...i,
309
+ ref: Ze,
310
+ id: pe,
311
+ label: he,
312
+ readOnly: E,
313
+ value: c ? tt : te,
314
+ placeholder: We,
288
315
  icon: "calendar_today",
289
- "aria-expanded": u && !c ? m : void 0,
290
316
  isClearable: !0,
291
- onIconClick: re,
292
- iconButtonProps: u && !c ? { "aria-expanded": b ? Q : m, "aria-haspopup": "dialog" } : void 0,
293
- onChange: (e) => c ? it(e) : Je(e),
294
- required: L,
295
- invalid: Ae || (n == null ? void 0 : n.invalid),
317
+ onIconClick: se,
318
+ iconButtonProps: m && !c ? Te : { "aria-label": le },
319
+ onChange: (e) => c ? ht(e) : nt(e),
320
+ onBlur: (e) => {
321
+ var t;
322
+ c || st(), (t = i == null ? void 0 : i.onBlur) == null || t.call(i, e);
323
+ },
324
+ required: j,
325
+ invalid: Ne || ke || (i == null ? void 0 : i.invalid),
296
326
  helper: (() => {
297
- const e = n == null ? void 0 : n.helper, t = Ae ? { text: Le, type: "error" } : null;
298
- return t ? e ? Array.isArray(e) ? [...e, t] : [e, t] : t : e;
327
+ const e = i == null ? void 0 : i.helper, t = Ne ? Xe : ke ? Je : null, r = t ? { text: t, type: "error" } : null;
328
+ return r ? e ? Array.isArray(e) ? [...e, r] : [e, r] : r : e;
299
329
  })(),
300
- className: T(h["tedi-date-field__textfield"], {
301
- [h["tedi-date-field__textfield--disabled"]]: n == null ? void 0 : n.disabled,
302
- [h["tedi-date-field__icon--disabled"]]: !u || O
330
+ className: V(g["tedi-date-field__textfield"], {
331
+ [g["tedi-date-field__textfield--disabled"]]: i == null ? void 0 : i.disabled,
332
+ [g["tedi-date-field__icon--disabled"]]: !m || E
303
333
  }),
304
334
  input: {
305
- ...n == null ? void 0 : n.input,
335
+ ...i == null ? void 0 : i.input,
306
336
  ...c && { type: "date" },
307
- ...u && !c && $ === "input" ? { "aria-haspopup": "dialog", "aria-expanded": m } : {}
337
+ ...m && !c && L === "input" ? {
338
+ role: "combobox",
339
+ "aria-haspopup": "dialog",
340
+ "aria-expanded": h ? ee : p,
341
+ "aria-controls": Be
342
+ } : {}
308
343
  }
309
344
  }
310
345
  )
311
346
  }
312
347
  ),
313
- b && /* @__PURE__ */ D(
314
- Ct,
348
+ h && /* @__PURE__ */ D(
349
+ Tt,
315
350
  {
316
- open: Q,
317
- onOpenChange: _e,
318
- value: o,
319
- onConfirm: at,
351
+ open: ee,
352
+ onOpenChange: ve,
353
+ value: n,
354
+ onConfirm: pt,
320
355
  mode: s,
321
- numberOfMonths: Ce,
322
- locale: me,
356
+ numberOfMonths: Pe,
357
+ locale: De,
323
358
  localeCode: W,
324
- showOutsideDays: de,
325
- disabledMatchers: S,
326
- required: L,
327
- availableDays: ye,
328
- footer: pe,
329
- monthYearSelectType: ce,
330
- showNavigation: ue,
359
+ showOutsideDays: ge,
360
+ disabledMatchers: U,
361
+ required: j,
362
+ availableDays: Ae,
363
+ footer: _e,
364
+ monthYearSelectType: ye,
365
+ showNavigation: be,
331
366
  selectionLevel: P,
332
- initialView: j,
367
+ initialView: H,
333
368
  initialMonth: Y,
334
- modalProps: Ie,
335
- ...be,
336
- title: $e
369
+ modalProps: ze,
370
+ ...xe,
371
+ title: Ge
337
372
  }
338
373
  ),
339
- u && !c && !b && /* @__PURE__ */ D(pt, { children: m && /* @__PURE__ */ D(ht, { context: U, modal: !1, initialFocus: -1, children: /* @__PURE__ */ D(
374
+ m && !c && !h && /* @__PURE__ */ D(Nt, { children: p && /* @__PURE__ */ D(kt, { context: q, modal: !1, initialFocus: -1, children: /* @__PURE__ */ D(
340
375
  "div",
341
376
  {
342
- ref: we.setFloating,
343
- className: T({
344
- [h["tedi-date-field__calendar-popover--fullwidth"]]: C
377
+ ref: R.setFloating,
378
+ className: V({
379
+ [g["tedi-date-field__calendar-popover--fullwidth"]]: x
345
380
  }),
346
- ...Ne.getFloatingProps({
381
+ ...Ve.getFloatingProps({
347
382
  style: {
348
- position: et,
349
- top: Ze ?? 0,
350
- left: C ? 0 : Qe ?? 0,
351
- right: C ? 0 : void 0
383
+ position: ct,
384
+ top: dt ?? 0,
385
+ left: x ? 0 : ft ?? 0,
386
+ right: x ? 0 : void 0
352
387
  }
353
388
  }),
354
389
  children: /* @__PURE__ */ D(
355
- gt,
390
+ Pt,
356
391
  {
357
- ...be,
358
- numberOfMonths: Ce,
359
- view: We,
392
+ ...xe,
393
+ numberOfMonths: Pe,
394
+ view: Qe,
360
395
  selectionLevel: P,
361
- currentMonth: qe,
362
- setCurrentMonth: ee,
363
- setView: Me,
396
+ currentMonth: rt,
397
+ setCurrentMonth: oe,
398
+ setView: we,
364
399
  mode: s,
365
- value: o,
366
- locale: me,
400
+ value: n,
401
+ locale: De,
367
402
  localeCode: W,
368
- showOutsideDays: de,
369
- disabledMatchers: S,
370
- required: L,
371
- availableDays: ye,
372
- footer: pe,
373
- monthYearSelectType: ce,
374
- showNavigation: ue,
375
- handleSelect: ze,
376
- applyValue: Ge,
377
- className: T(h["tedi-date-field__calendar"], {
378
- [h["tedi-date-field__calendar--fullwidth"]]: C
403
+ showOutsideDays: ge,
404
+ disabledMatchers: U,
405
+ required: j,
406
+ availableDays: Ae,
407
+ footer: _e,
408
+ monthYearSelectType: ye,
409
+ showNavigation: be,
410
+ handleSelect: at,
411
+ applyValue: it,
412
+ className: V(g["tedi-date-field__calendar"], {
413
+ [g["tedi-date-field__calendar--fullwidth"]]: x
379
414
  })
380
415
  }
381
416
  )
@@ -383,7 +418,7 @@ const Vt = oe.forwardRef((I, w) => {
383
418
  ) }) })
384
419
  ] });
385
420
  });
386
- Vt.displayName = "DateField";
421
+ Gt.displayName = "DateField";
387
422
  export {
388
- Vt as DateField
423
+ Gt as DateField
389
424
  };