@nice2dev/ui 1.4.2 → 1.4.4

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,230 +1,261 @@
1
- import { jsxs as v, jsx as n } from "react/jsx-runtime";
2
- import { useNiceAccessMode as He, useControlId as Ke, useNiceTranslation as Oe, useControllableState as he, COMMON_SHORTCUTS as je, NiceThemeContext as Ye, useOverlayFocus as Fe, NiceKeyboardHint as Ge, NiceIcon as ye } from "@nice2dev/ui-core";
3
- import { useMemo as ve, useRef as _e, useState as X, useContext as Ue, useLayoutEffect as Je, useEffect as Qe } from "react";
4
- import { createPortal as Xe } from "react-dom";
5
- import { scopeThemeClass as Ze } from "../../utility/scopeThemeClass.mjs";
6
- import { NiceCalendar as Pe } from "./NiceCalendar.mjs";
7
- import { getDefaultLocale as We, NiceDateTimePicker as Ne } from "./NiceDateTimePicker.mjs";
8
- function P(t) {
1
+ import { jsxs as T, jsx as n } from "react/jsx-runtime";
2
+ import { useNiceAccessMode as et, useControlId as tt, useNiceTranslation as nt, useControllableState as ke, COMMON_SHORTCUTS as rt, NiceThemeContext as at, useOverlayFocus as it, NiceKeyboardHint as ot, NiceIcon as Te } from "@nice2dev/ui-core";
3
+ import { useMemo as de, useRef as Ce, useState as Q, useContext as ct, useLayoutEffect as lt, useEffect as st } from "react";
4
+ import { createPortal as dt } from "react-dom";
5
+ import { scopeThemeClass as ut } from "../../utility/scopeThemeClass.mjs";
6
+ import { NiceCalendar as pt } from "./NiceCalendar.mjs";
7
+ import { getDefaultLocale as ft, rangeMaskSpec as gt, dateMaskDigits as w, NiceDateTimePicker as Ee } from "./NiceDateTimePicker.mjs";
8
+ function ue(t) {
9
9
  return t?.startsWith("datetime") ? "datetime" : t === "week" ? "week" : t?.startsWith("month") ? "month" : "date";
10
10
  }
11
- function et(t) {
12
- const c = /* @__PURE__ */ new Date(), r = `${c.getFullYear()}-${String(c.getMonth() + 1).padStart(2, "0")}-${String(c.getDate()).padStart(2, "0")}`, l = P(t);
13
- return l === "datetime" ? `${r}T00:00` : l === "month" ? r.slice(0, 7) : r;
11
+ function mt(t) {
12
+ const o = /* @__PURE__ */ new Date(), i = `${o.getFullYear()}-${String(o.getMonth() + 1).padStart(2, "0")}-${String(o.getDate()).padStart(2, "0")}`, c = ue(t);
13
+ return c === "datetime" ? `${i}T00:00` : c === "month" ? i.slice(0, 7) : i;
14
14
  }
15
- function be(t, c) {
15
+ function Le(t, o) {
16
16
  if (!t)
17
17
  return t;
18
- const r = new Date(t.length <= 10 ? `${t}T00:00` : t);
19
- if (Number.isNaN(r.getTime()))
18
+ const i = new Date(t.length <= 10 ? `${t}T00:00` : t);
19
+ if (Number.isNaN(i.getTime()))
20
20
  return t;
21
- r.setDate(r.getDate() + c);
22
- const l = `${r.getFullYear()}-${String(r.getMonth() + 1).padStart(2, "0")}-${String(r.getDate()).padStart(2, "0")}`;
23
- return t.length <= 10 ? l.slice(0, t.length) : l + t.slice(10);
21
+ i.setDate(i.getDate() + o);
22
+ const c = `${i.getFullYear()}-${String(i.getMonth() + 1).padStart(2, "0")}-${String(i.getDate()).padStart(2, "0")}`;
23
+ return t.length <= 10 ? c.slice(0, t.length) : c + t.slice(10);
24
24
  }
25
- function V(...t) {
25
+ function X(...t) {
26
26
  return t.filter(Boolean).sort().pop();
27
27
  }
28
- function Z(t, c, r) {
28
+ function Me(t, o, i) {
29
29
  if (!t)
30
30
  return "";
31
- const l = new Date(t.length <= 10 ? `${t}T00:00` : t);
32
- if (Number.isNaN(l.getTime()))
31
+ const c = new Date(t.length <= 10 ? `${t}T00:00` : t);
32
+ if (Number.isNaN(c.getTime()))
33
33
  return t;
34
- const x = P(r);
35
- return x === "month" ? l.toLocaleDateString(c, { year: "numeric", month: "2-digit" }) : x === "datetime" ? l.toLocaleString(c, {
34
+ const b = ue(i);
35
+ return b === "month" ? c.toLocaleDateString(o, { year: "numeric", month: "2-digit" }) : b === "datetime" ? c.toLocaleString(o, {
36
36
  year: "numeric",
37
37
  month: "2-digit",
38
38
  day: "2-digit",
39
39
  hour: "2-digit",
40
40
  minute: "2-digit"
41
- }) : l.toLocaleDateString(c, { year: "numeric", month: "2-digit", day: "2-digit" });
41
+ }) : c.toLocaleDateString(o, { year: "numeric", month: "2-digit", day: "2-digit" });
42
42
  }
43
- function we(t) {
44
- let c = 0;
45
- for (const r of t)
46
- c += /[\p{L}\p{N}]/u.test(r) ? 1 : 0.5;
47
- return c;
43
+ function Re(t) {
44
+ let o = 0;
45
+ for (const i of t)
46
+ o += /[\p{L}\p{N}]/u.test(i) ? 1 : 0.5;
47
+ return o;
48
48
  }
49
- const st = ({
49
+ function Ie(t) {
50
+ const o = /^(\d{4})-(\d{2})(?:-(\d{2}))?(?:T(\d{2}):(\d{2}))?$/.exec(t);
51
+ if (!o)
52
+ return !1;
53
+ const [, i, c, b = "01", Z = "00", g = "00"] = o, D = new Date(Number(i), Number(c) - 1, Number(b));
54
+ return D.getMonth() === Number(c) - 1 && D.getDate() === Number(b) && Number(Z) < 24 && Number(g) < 60;
55
+ }
56
+ const wt = ({
50
57
  startDate: t,
51
- endDate: c,
52
- defaultStartDate: r,
53
- defaultEndDate: l,
54
- onStartChange: x,
55
- onEndChange: $e,
58
+ endDate: o,
59
+ defaultStartDate: i,
60
+ defaultEndDate: c,
61
+ onStartChange: b,
62
+ onEndChange: Z,
56
63
  min: g,
57
- max: q,
58
- clearable: S,
59
- startPlaceholder: W,
60
- endPlaceholder: De,
61
- startLabel: xe,
62
- endLabel: Se,
63
- layout: ee = "horizontal",
64
- separator: h = "–",
65
- gap: Ce = 12,
66
- fullWidth: C = !1,
64
+ max: D,
65
+ clearable: B,
66
+ startPlaceholder: pe,
67
+ endPlaceholder: Be,
68
+ startLabel: ze,
69
+ endLabel: Ve,
70
+ layout: fe = "horizontal",
71
+ separator: x = "–",
72
+ gap: qe = 12,
73
+ fullWidth: z = !1,
67
74
  dateFormatPreset: m,
68
- locale: A,
69
- timeSelectorType: te,
70
- endCondition: _ = "greater-or-equal",
71
- startCondition: N = "today-or-greater",
72
- singleField: ne = !1,
73
- label: H,
74
- error: K,
75
- helperText: T,
76
- required: Te,
77
- disabled: ke,
78
- size: b = "md",
79
- id: ae,
80
- className: Ee,
81
- style: Le,
82
- accessMode: Re,
83
- showKeyboardHints: Me,
84
- labelPlacement: k,
85
- errorPlacement: E,
86
- labelWidth: y,
87
- controlWidth: L,
88
- loading: R,
89
- readOnly: f
75
+ locale: F,
76
+ timeSelectorType: ge,
77
+ endCondition: C = "greater-or-equal",
78
+ startCondition: E = "today-or-greater",
79
+ singleField: me = !1,
80
+ label: P,
81
+ error: W,
82
+ helperText: V,
83
+ required: Ae,
84
+ disabled: He,
85
+ size: L = "md",
86
+ id: he,
87
+ className: Ke,
88
+ style: je,
89
+ accessMode: Oe,
90
+ showKeyboardHints: Ye,
91
+ labelPlacement: q,
92
+ errorPlacement: A,
93
+ labelWidth: S,
94
+ controlWidth: H,
95
+ loading: K,
96
+ readOnly: h
90
97
  }) => {
91
- const O = He(Re, ae), j = Ke(ae), { t: o } = Oe(), d = O === "disabled" || O === "readOnly" || !!ke, [a, Y] = he({
98
+ const ee = et(Oe, he), te = tt(he), { t: d } = nt(), y = ee === "disabled" || ee === "readOnly" || !!He, [a, M] = ke({
92
99
  value: t,
93
- defaultValue: r,
100
+ defaultValue: i,
94
101
  fallbackValue: "",
95
- onChange: x,
102
+ onChange: b,
96
103
  componentName: "NiceDateRangeBox"
97
- }), [s, M] = he({
98
- value: c,
99
- defaultValue: l,
104
+ }), [l, k] = ke({
105
+ value: o,
106
+ defaultValue: c,
100
107
  fallbackValue: "",
101
- onChange: $e,
108
+ onChange: Z,
102
109
  componentName: "NiceDateRangeBox"
103
- }), Ie = ve(
110
+ }), Ge = de(
104
111
  () => [
105
- { key: "Tab", description: o("shortcuts.switchField", "Switch between start/end") },
106
- je.cancel
112
+ { key: "Tab", description: d("shortcuts.switchField", "Switch between start/end") },
113
+ rt.cancel
107
114
  ],
108
- [o]
109
- ), w = _e(null), F = _e(null), [u, I] = X(!1), [G, re] = X(null), [ie, Be] = X(""), U = Ue(Ye), oe = U?.portalTarget ?? (typeof document < "u" ? document.body : null);
110
- Je(() => {
111
- if (!u)
115
+ [d]
116
+ ), R = Ce(null), ne = Ce(null), [N, j] = Q(!1), [re, ye] = Q(null), [Ne, Ue] = Q(""), ae = ct(at), ve = ae?.portalTarget ?? (typeof document < "u" ? document.body : null), ie = F || ft(), u = de(
117
+ () => gt(m, ie),
118
+ [m, ie]
119
+ ), [_, O] = Q(null);
120
+ lt(() => {
121
+ if (!N)
112
122
  return;
113
- const e = w.current?.getBoundingClientRect();
114
- e && (re({ left: e.left, top: e.bottom + 6 }), Be(U?.portalTarget ? "" : Ze(w.current)));
115
- }, [u, U?.portalTarget]), Qe(() => {
116
- if (!u)
123
+ const e = R.current?.getBoundingClientRect();
124
+ e && (ye({ left: e.left, top: e.bottom + 6 }), Ue(ae?.portalTarget ? "" : ut(R.current)));
125
+ }, [N, ae?.portalTarget]), st(() => {
126
+ if (!N)
117
127
  return;
118
- const e = (D) => {
119
- const me = D.target;
120
- w.current?.contains(me) || F.current?.contains(me) || I(!1);
121
- }, i = () => {
122
- const D = w.current?.getBoundingClientRect();
123
- D && re({ left: D.left, top: D.bottom + 6 });
128
+ const e = (s) => {
129
+ const $ = s.target;
130
+ R.current?.contains($) || ne.current?.contains($) || j(!1);
131
+ }, r = () => {
132
+ const s = R.current?.getBoundingClientRect();
133
+ s && ye({ left: s.left, top: s.bottom + 6 });
124
134
  };
125
- return document.addEventListener("mousedown", e), window.addEventListener("scroll", i, !0), window.addEventListener("resize", i), () => {
126
- document.removeEventListener("mousedown", e), window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i);
135
+ return document.addEventListener("mousedown", e), window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), () => {
136
+ document.removeEventListener("mousedown", e), window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
127
137
  };
128
- }, [u]), Fe(F, {
129
- open: u,
138
+ }, [N]), it(ne, {
139
+ open: N,
130
140
  modal: !1,
131
141
  initialFocus: '.nice-calendar__grid [tabindex="0"]',
132
- onClose: () => I(!1)
142
+ onClose: () => j(!1)
133
143
  });
134
- const $ = et(m), ce = N === "today-or-greater" ? V(g, $) : N === "greater-than-today" ? V(g, be($, 1)) : g, ze = _ === "greater-or-equal" ? V(g, a) : _ === "greater" ? V(g, a ? be(a, 1) : void 0) : g, p = ve(() => {
135
- if (K)
136
- return K;
137
- if (a && s) {
138
- if (_ === "greater-or-equal" && s < a)
139
- return o("daterange.endBeforeStart", "End date must be on or after the start date");
140
- if (_ === "greater" && s <= a)
141
- return o("daterange.endAfterStart", "End date must be after the start date");
144
+ const I = mt(m), be = E === "today-or-greater" ? X(g, I) : E === "greater-than-today" ? X(g, Le(I, 1)) : g, Je = C === "greater-or-equal" ? X(g, a) : C === "greater" ? X(g, a ? Le(a, 1) : void 0) : g, v = de(() => {
145
+ if (W)
146
+ return W;
147
+ if (a && l) {
148
+ if (C === "greater-or-equal" && l < a)
149
+ return d("daterange.endBeforeStart", "End date must be on or after the start date");
150
+ if (C === "greater" && l <= a)
151
+ return d("daterange.endAfterStart", "End date must be after the start date");
142
152
  }
143
153
  if (a) {
144
- if (N === "today-or-greater" && a < $)
145
- return o("daterange.startInPast", "Start date cannot be in the past");
146
- if (N === "greater-than-today" && a <= $)
147
- return o("daterange.startAfterToday", "Start date must be after today");
154
+ if (E === "today-or-greater" && a < I)
155
+ return d("daterange.startInPast", "Start date cannot be in the past");
156
+ if (E === "greater-than-today" && a <= I)
157
+ return d("daterange.startAfterToday", "Start date must be after today");
148
158
  }
149
- }, [K, a, s, N, _, $, o]);
150
- if (O === "hidden")
159
+ }, [W, a, l, E, C, I, d]);
160
+ if (ee === "hidden")
151
161
  return null;
152
- const Ve = (e) => {
153
- Y(e), e && s && e > s && M(e);
154
- }, B = ee === "horizontal", se = P(m), J = A || We(), le = typeof h == "string" && h !== "" ? h : "–", de = Z(a, J, m), ue = Z(s, J, m), pe = de || ue ? `${de || "…"} ${le} ${ue || "…"}` : "", qe = (() => {
155
- const e = Z("2026-12-30T22:58", J, m), i = `${e} ${le} ${e}`;
156
- return `${(Math.max(we(i), we(pe)) + 1.5).toFixed(1)}ch`;
157
- })(), fe = (e, i) => se === "datetime" ? i && i.length > 10 ? `${e}${i.slice(10)}` : `${e}T00:00` : se === "month" ? e.slice(0, 7) : e, Ae = ({ start: e, end: i }) => {
158
- Y(e ? fe(e, a) : ""), M(i ? fe(i, s) : ""), e && i && I(!1);
159
- }, ge = () => {
160
- Y(""), M("");
161
- }, Q = () => {
162
- !d && !f && I((e) => !e);
163
- }, z = (e) => e && e.length >= 10 ? e.slice(0, 10) : e || void 0;
164
- return /* @__PURE__ */ v(
162
+ const Qe = (e) => {
163
+ M(e), e && l && e > l && k(e);
164
+ }, Y = fe === "horizontal", oe = ue(m), _e = ie, G = typeof x == "string" && x !== "" ? x : "–", p = oe !== "week" && m !== "time", f = w.slots(u), $e = (e) => e ? p ? w.render(u, w.fromIso(u, e)) : Me(e, _e, m) : "", we = $e(a), De = $e(l), ce = we || De ? `${we || "…"} ${G} ${De || "…"}` : "", xe = (e) => {
165
+ const r = w.render(u, e.slice(0, f));
166
+ return e.length < f ? r : `${r} ${G} ${w.render(u, e.slice(f))}`;
167
+ }, Xe = `${u.placeholder} ${G} ${u.placeholder}`, Ze = (() => {
168
+ const e = p ? u.placeholder : Me("2026-12-30T22:58", _e, m), r = `${e} ${G} ${e}`;
169
+ return `${(Math.max(Re(r), Re(ce)) + 1.5).toFixed(1)}ch`;
170
+ })(), Se = (e, r) => oe === "datetime" ? r && r.length > 10 ? `${e}${r.slice(10)}` : `${e}T00:00` : oe === "month" ? e.slice(0, 7) : e, Fe = ({ start: e, end: r }) => {
171
+ O(null), M(e ? Se(e, a) : ""), k(r ? Se(r, l) : ""), e && r && j(!1);
172
+ }, le = () => {
173
+ O(null), M(""), k("");
174
+ }, Pe = (e) => {
175
+ const r = _ !== null ? xe(_) : ce;
176
+ let s = e.replace(/\D/g, "").slice(0, f * 2);
177
+ if (e.length < r.length && s === r.replace(/\D/g, "") && (s = s.slice(0, -1)), s.length === 0) {
178
+ le();
179
+ return;
180
+ }
181
+ O(s);
182
+ const $ = s.length >= f ? w.toIso(u, s.slice(0, f)) : "";
183
+ $ && Ie($) && $ !== a && M($);
184
+ const J = s.length === f * 2 ? w.toIso(u, s.slice(f)) : "";
185
+ J && Ie(J) && J !== l && k(J);
186
+ }, We = () => {
187
+ _ !== null && (_.length < f && M(""), _.length < f * 2 && k(""), O(null));
188
+ }, se = () => {
189
+ !y && !h && j((e) => !e);
190
+ }, U = (e) => e && e.length >= 10 ? e.slice(0, 10) : e || void 0;
191
+ return /* @__PURE__ */ T(
165
192
  "div",
166
193
  {
167
- className: `nice-field nice-field--${b} nice-daterange nice-daterange--${ee} ${k === "left" ? "nice-field--label-left" : ""} ${p ? "nice-field--error" : ""} ${R ? "nice-field--loading" : ""} ${Ee || ""}`,
194
+ className: `nice-field nice-field--${L} nice-daterange nice-daterange--${fe} ${q === "left" ? "nice-field--label-left" : ""} ${v ? "nice-field--error" : ""} ${K ? "nice-field--loading" : ""} ${Ke || ""}`,
168
195
  style: {
169
- ...Le,
170
- ...y != null && {
171
- "--nice-field-label-width": typeof y == "number" ? `${y}px` : y
196
+ ...je,
197
+ ...S != null && {
198
+ "--nice-field-label-width": typeof S == "number" ? `${S}px` : S
172
199
  },
173
- ...L != null && {
174
- "--nice-field-control-width": typeof L == "number" ? `${L}px` : L
200
+ ...H != null && {
201
+ "--nice-field-control-width": typeof H == "number" ? `${H}px` : H
175
202
  }
176
203
  },
177
- "aria-busy": R || void 0,
204
+ "aria-busy": K || void 0,
178
205
  children: [
179
- H && /* @__PURE__ */ v("label", { className: "nice-field__label", htmlFor: j, children: [
180
- H,
181
- Te && /* @__PURE__ */ n("span", { className: "nice-field__required", children: "*" }),
182
- Me && /* @__PURE__ */ n(Ge, { shortcuts: Ie, size: "sm" })
206
+ P && /* @__PURE__ */ T("label", { className: "nice-field__label", htmlFor: te, children: [
207
+ P,
208
+ Ae && /* @__PURE__ */ n("span", { className: "nice-field__required", children: "*" }),
209
+ Ye && /* @__PURE__ */ n(ot, { shortcuts: Ge, size: "sm" })
183
210
  ] }),
184
- /* @__PURE__ */ v("div", { className: "nice-field__control", children: [
185
- ne ? /* @__PURE__ */ v(
211
+ /* @__PURE__ */ T("div", { className: "nice-field__control", children: [
212
+ me ? /* @__PURE__ */ T(
186
213
  "div",
187
214
  {
188
- ref: w,
189
- className: `nice-input nice-input--date nice-input--${b} nice-daterange__single ${p ? "nice-input--error" : ""} ${d ? "nice-input--disabled" : ""} ${f ? "nice-input--readonly" : ""}`,
190
- style: { position: "relative", width: C ? "100%" : "fit-content" },
215
+ ref: R,
216
+ className: `nice-input nice-input--date nice-input--${L} nice-daterange__single ${v ? "nice-input--error" : ""} ${y ? "nice-input--disabled" : ""} ${h ? "nice-input--readonly" : ""}`,
217
+ style: { position: "relative", width: z ? "100%" : "fit-content" },
191
218
  children: [
192
219
  /* @__PURE__ */ n(
193
220
  "input",
194
221
  {
195
- id: j,
222
+ id: te,
196
223
  className: "nice-input__native",
197
224
  type: "text",
198
- readOnly: !0,
199
- value: pe,
200
- placeholder: W || o("controls.startDate", "Start date"),
201
- disabled: d || R,
225
+ readOnly: !p || h,
226
+ value: _ !== null ? xe(_) : ce,
227
+ placeholder: pe || (p ? Xe : d("controls.startDate", "Start date")),
228
+ disabled: y || K,
202
229
  autoComplete: "off",
203
- "aria-invalid": !!p,
204
- "aria-label": H ? void 0 : o("controls.startDate", "Start date"),
230
+ spellCheck: !1,
231
+ inputMode: p ? "numeric" : void 0,
232
+ "aria-invalid": !!v,
233
+ "aria-label": P ? void 0 : d("controls.startDate", "Start date"),
205
234
  "aria-haspopup": "dialog",
206
- "aria-expanded": u,
207
- onClick: Q,
235
+ "aria-expanded": N,
236
+ onClick: p ? void 0 : se,
237
+ onChange: p ? (e) => Pe(e.target.value) : void 0,
238
+ onBlur: p ? We : void 0,
208
239
  onKeyDown: (e) => {
209
- const i = !!e.nativeEvent.niceSource;
210
- (e.key === "Enter" || e.key === " " || e.key === "ArrowDown" && !i) && (e.preventDefault(), u || Q());
240
+ const r = !!e.nativeEvent.niceSource;
241
+ (e.key === "Enter" || e.key === " " && !p || e.key === "ArrowDown" && !r) && (e.preventDefault(), N || se());
211
242
  },
212
243
  style: {
213
- width: C ? "100%" : qe,
214
- cursor: d || f ? void 0 : "pointer"
244
+ width: z ? "100%" : Ze,
245
+ cursor: y || h ? void 0 : p ? "text" : "pointer"
215
246
  }
216
247
  }
217
248
  ),
218
- S && /* @__PURE__ */ n(
249
+ B && /* @__PURE__ */ n(
219
250
  "button",
220
251
  {
221
252
  type: "button",
222
253
  className: "nice-input__clear",
223
- onClick: ge,
224
- disabled: !a && !s || d || f,
225
- "aria-label": o("controls.clear", "Clear"),
226
- tabIndex: (a || s) && !d && !f ? 0 : -1,
227
- children: /* @__PURE__ */ n(ye, { name: "close", size: 14 })
254
+ onClick: le,
255
+ disabled: !a && !l || y || h,
256
+ "aria-label": d("controls.clear", "Clear"),
257
+ tabIndex: (a || l) && !y && !h ? 0 : -1,
258
+ children: /* @__PURE__ */ n(Te, { name: "close", size: 14 })
228
259
  }
229
260
  ),
230
261
  /* @__PURE__ */ n(
@@ -232,138 +263,138 @@ const st = ({
232
263
  {
233
264
  type: "button",
234
265
  className: "nice-input__picker-trigger",
235
- onClick: Q,
236
- "aria-label": o("controls.openPicker", "Open picker"),
237
- "aria-expanded": u,
266
+ onClick: se,
267
+ "aria-label": d("controls.openPicker", "Open picker"),
268
+ "aria-expanded": N,
238
269
  tabIndex: -1,
239
- disabled: d || f,
240
- children: /* @__PURE__ */ n(ye, { name: "calendar", size: 16 })
270
+ disabled: y || h,
271
+ children: /* @__PURE__ */ n(Te, { name: "calendar", size: 16 })
241
272
  }
242
273
  )
243
274
  ]
244
275
  }
245
- ) : /* @__PURE__ */ v(
276
+ ) : /* @__PURE__ */ T(
246
277
  "div",
247
278
  {
248
279
  className: "nice-daterange__row",
249
280
  style: {
250
281
  display: "flex",
251
- flexDirection: B ? "row" : "column",
282
+ flexDirection: Y ? "row" : "column",
252
283
  // With inline labels (labelPlacement="left") the fields align on
253
284
  // their center; otherwise bottom-align so the separator sits on the
254
285
  // input baseline.
255
- alignItems: B ? k === "left" ? "center" : "flex-end" : "stretch",
256
- gap: Ce,
286
+ alignItems: Y ? q === "left" ? "center" : "flex-end" : "stretch",
287
+ gap: qe,
257
288
  // Horizontal means one line — don't wrap (wrapping made `layout`
258
289
  // look dead inside a width-capped container).
259
- flexWrap: B ? "nowrap" : "wrap"
290
+ flexWrap: Y ? "nowrap" : "wrap"
260
291
  },
261
292
  children: [
262
- /* @__PURE__ */ n("div", { style: { flex: C ? "1 1 0" : void 0, minWidth: 0 }, children: /* @__PURE__ */ n(
263
- Ne,
293
+ /* @__PURE__ */ n("div", { style: { flex: z ? "1 1 0" : void 0, minWidth: 0 }, children: /* @__PURE__ */ n(
294
+ Ee,
264
295
  {
265
- id: j,
296
+ id: te,
266
297
  dateFormatPreset: m,
267
- displayLocale: A,
268
- timeSelectorType: te,
269
- label: xe,
298
+ displayLocale: F,
299
+ timeSelectorType: ge,
300
+ label: ze,
270
301
  value: a,
271
- onChange: Ve,
272
- min: ce,
273
- max: s || q,
274
- placeholder: W || o("controls.startDate", "Start date"),
275
- disabled: d,
276
- readOnly: f,
277
- size: b,
278
- clearable: S,
279
- labelPlacement: k,
280
- labelWidth: y
302
+ onChange: Qe,
303
+ min: be,
304
+ max: l || D,
305
+ placeholder: pe,
306
+ disabled: y,
307
+ readOnly: h,
308
+ size: L,
309
+ clearable: B,
310
+ labelPlacement: q,
311
+ labelWidth: S
281
312
  }
282
313
  ) }),
283
- B && h !== "" && h != null && /* @__PURE__ */ n(
314
+ Y && x !== "" && x != null && /* @__PURE__ */ n(
284
315
  "span",
285
316
  {
286
317
  className: "nice-daterange__separator",
287
318
  style: { paddingBottom: 8, color: "var(--nice-text-secondary, #666)" },
288
319
  "aria-hidden": "true",
289
- children: h
320
+ children: x
290
321
  }
291
322
  ),
292
- /* @__PURE__ */ n("div", { style: { flex: C ? "1 1 0" : void 0, minWidth: 0 }, children: /* @__PURE__ */ n(
293
- Ne,
323
+ /* @__PURE__ */ n("div", { style: { flex: z ? "1 1 0" : void 0, minWidth: 0 }, children: /* @__PURE__ */ n(
324
+ Ee,
294
325
  {
295
326
  dateFormatPreset: m,
296
- displayLocale: A,
297
- timeSelectorType: te,
298
- label: Se,
299
- value: s,
300
- onChange: (e) => M(e),
301
- min: ze || a || g,
302
- max: q,
303
- placeholder: De || o("controls.endDate", "End date"),
304
- disabled: d,
305
- readOnly: f,
306
- size: b,
307
- clearable: S,
308
- labelPlacement: k,
309
- labelWidth: y
327
+ displayLocale: F,
328
+ timeSelectorType: ge,
329
+ label: Ve,
330
+ value: l,
331
+ onChange: (e) => k(e),
332
+ min: Je || a || g,
333
+ max: D,
334
+ placeholder: Be,
335
+ disabled: y,
336
+ readOnly: h,
337
+ size: L,
338
+ clearable: B,
339
+ labelPlacement: q,
340
+ labelWidth: S
310
341
  }
311
342
  ) })
312
343
  ]
313
344
  }
314
345
  ),
315
- ne && u && G && oe && Xe(
316
- /* @__PURE__ */ v(
346
+ me && N && re && ve && dt(
347
+ /* @__PURE__ */ T(
317
348
  "div",
318
349
  {
319
- ref: F,
320
- className: `nice-datetime-popup${ie ? ` ${ie}` : ""}`,
350
+ ref: ne,
351
+ className: `nice-datetime-popup${Ne ? ` ${Ne}` : ""}`,
321
352
  style: {
322
353
  position: "fixed",
323
- left: G.left,
324
- top: G.top,
354
+ left: re.left,
355
+ top: re.top,
325
356
  zIndex: 1e3
326
357
  },
327
358
  role: "dialog",
328
- "aria-label": o("controls.openPicker", "Open picker"),
359
+ "aria-label": d("controls.openPicker", "Open picker"),
329
360
  children: [
330
361
  /* @__PURE__ */ n("div", { className: "nice-datetime-popup__body", children: /* @__PURE__ */ n("div", { className: "nice-datetime-popup__col nice-datetime-popup__col--date", children: /* @__PURE__ */ n(
331
- Pe,
362
+ pt,
332
363
  {
333
364
  selectionMode: "range",
334
- rangeStart: z(a),
335
- rangeEnd: z(s),
336
- onRangeChange: Ae,
337
- min: z(ce),
338
- max: z(q),
339
- size: b
365
+ rangeStart: U(a),
366
+ rangeEnd: U(l),
367
+ onRangeChange: Fe,
368
+ min: U(be),
369
+ max: U(D),
370
+ size: L
340
371
  }
341
372
  ) }) }),
342
- S && /* @__PURE__ */ n("div", { className: "nice-datetime-popup__footer", children: /* @__PURE__ */ n(
373
+ B && /* @__PURE__ */ n("div", { className: "nice-datetime-popup__footer", children: /* @__PURE__ */ n(
343
374
  "button",
344
375
  {
345
376
  type: "button",
346
377
  className: "nice-datetime-popup__btn",
347
- onClick: ge,
348
- disabled: !a && !s,
349
- children: o("controls.clear", "Clear")
378
+ onClick: le,
379
+ disabled: !a && !l,
380
+ children: d("controls.clear", "Clear")
350
381
  }
351
382
  ) })
352
383
  ]
353
384
  }
354
385
  ),
355
- oe
386
+ ve
356
387
  ),
357
- R && /* @__PURE__ */ n("span", { className: "nice-field__spinner", children: /* @__PURE__ */ n("span", { className: "nice-spinner nice-spinner--sm" }) }),
358
- E === "right" && p && /* @__PURE__ */ n("div", { className: "nice-field__error", role: "alert", children: p }),
359
- E === "right" && !p && T && /* @__PURE__ */ n("div", { className: "nice-field__helper", children: T })
388
+ K && /* @__PURE__ */ n("span", { className: "nice-field__spinner", children: /* @__PURE__ */ n("span", { className: "nice-spinner nice-spinner--sm" }) }),
389
+ A === "right" && v && /* @__PURE__ */ n("div", { className: "nice-field__error", role: "alert", children: v }),
390
+ A === "right" && !v && V && /* @__PURE__ */ n("div", { className: "nice-field__helper", children: V })
360
391
  ] }),
361
- E !== "right" && p && /* @__PURE__ */ n("div", { className: "nice-field__error", children: p }),
362
- E !== "right" && !p && T && /* @__PURE__ */ n("div", { className: "nice-field__hint", children: T })
392
+ A !== "right" && v && /* @__PURE__ */ n("div", { className: "nice-field__error", children: v }),
393
+ A !== "right" && !v && V && /* @__PURE__ */ n("div", { className: "nice-field__hint", children: V })
363
394
  ]
364
395
  }
365
396
  );
366
397
  };
367
398
  export {
368
- st as NiceDateRangeBox
399
+ wt as NiceDateRangeBox
369
400
  };