@tedi-design-system/react 18.0.0-rc.27 → 18.0.0-rc.28

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