@nice2dev/ui 1.4.3 → 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.
- package/CHANGELOG.md +31 -0
- package/dist/{NiceDataGrid-CrKDzMM1.cjs → NiceDataGrid-mrnaLHQk.cjs} +1 -1
- package/dist/{NiceForm-CT9hEXpc.cjs → NiceForm-O3sv-DNX.cjs} +1 -1
- package/dist/NiceMention-tgJKS8PH.cjs +432 -0
- package/dist/{NiceSavedQueryPanel-C5Ab_NWx.cjs → NiceSavedQueryPanel-BPGpKWN2.cjs} +1 -1
- package/dist/{NiceScheduler-BZQAKEVF.cjs → NiceScheduler-Boo-D1S-.cjs} +1 -1
- package/dist/{core-lazy-VTd5zfoZ.cjs → core-lazy-C_qnVGxE.cjs} +1 -1
- package/dist/data.cjs +1 -1
- package/dist/editors/pickers/NiceDateRangeBox.mjs +258 -227
- package/dist/editors/pickers/NiceDateTimePicker.mjs +403 -388
- package/dist/editors/rich/NiceMarkdownEditor.mjs +2 -1
- package/dist/editors/rich/NiceWiki.mjs +225 -158
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +29 -7
- package/dist/index.cjs +112 -112
- package/dist/index.d.ts +90 -7
- package/dist/index.mjs +716 -713
- package/dist/style.css +2 -2
- package/dist/tools/NiceThemeGalleryPicker.mjs +362 -0
- package/package.json +4 -4
- package/dist/NiceMention-BZEHqPrf.cjs +0 -432
|
@@ -1,230 +1,261 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useNiceAccessMode as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { scopeThemeClass as
|
|
6
|
-
import { NiceCalendar as
|
|
7
|
-
import { getDefaultLocale as
|
|
8
|
-
function
|
|
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
|
|
12
|
-
const
|
|
13
|
-
return
|
|
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
|
|
15
|
+
function Le(t, o) {
|
|
16
16
|
if (!t)
|
|
17
17
|
return t;
|
|
18
|
-
const
|
|
19
|
-
if (Number.isNaN(
|
|
18
|
+
const i = new Date(t.length <= 10 ? `${t}T00:00` : t);
|
|
19
|
+
if (Number.isNaN(i.getTime()))
|
|
20
20
|
return t;
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
return t.length <= 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
|
|
25
|
+
function X(...t) {
|
|
26
26
|
return t.filter(Boolean).sort().pop();
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Me(t, o, i) {
|
|
29
29
|
if (!t)
|
|
30
30
|
return "";
|
|
31
|
-
const
|
|
32
|
-
if (Number.isNaN(
|
|
31
|
+
const c = new Date(t.length <= 10 ? `${t}T00:00` : t);
|
|
32
|
+
if (Number.isNaN(c.getTime()))
|
|
33
33
|
return t;
|
|
34
|
-
const
|
|
35
|
-
return
|
|
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
|
-
}) :
|
|
41
|
+
}) : c.toLocaleDateString(o, { year: "numeric", month: "2-digit", day: "2-digit" });
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
let
|
|
45
|
-
for (const
|
|
46
|
-
|
|
47
|
-
return
|
|
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
|
-
|
|
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:
|
|
52
|
-
defaultStartDate:
|
|
53
|
-
defaultEndDate:
|
|
54
|
-
onStartChange:
|
|
55
|
-
onEndChange:
|
|
58
|
+
endDate: o,
|
|
59
|
+
defaultStartDate: i,
|
|
60
|
+
defaultEndDate: c,
|
|
61
|
+
onStartChange: b,
|
|
62
|
+
onEndChange: Z,
|
|
56
63
|
min: g,
|
|
57
|
-
max:
|
|
58
|
-
clearable:
|
|
59
|
-
startPlaceholder:
|
|
60
|
-
endPlaceholder:
|
|
61
|
-
startLabel:
|
|
62
|
-
endLabel:
|
|
63
|
-
layout:
|
|
64
|
-
separator:
|
|
65
|
-
gap:
|
|
66
|
-
fullWidth:
|
|
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:
|
|
69
|
-
timeSelectorType:
|
|
70
|
-
endCondition:
|
|
71
|
-
startCondition:
|
|
72
|
-
singleField:
|
|
73
|
-
label:
|
|
74
|
-
error:
|
|
75
|
-
helperText:
|
|
76
|
-
required:
|
|
77
|
-
disabled:
|
|
78
|
-
size:
|
|
79
|
-
id:
|
|
80
|
-
className:
|
|
81
|
-
style:
|
|
82
|
-
accessMode:
|
|
83
|
-
showKeyboardHints:
|
|
84
|
-
labelPlacement:
|
|
85
|
-
errorPlacement:
|
|
86
|
-
labelWidth:
|
|
87
|
-
controlWidth:
|
|
88
|
-
loading:
|
|
89
|
-
readOnly:
|
|
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
|
|
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:
|
|
100
|
+
defaultValue: i,
|
|
94
101
|
fallbackValue: "",
|
|
95
|
-
onChange:
|
|
102
|
+
onChange: b,
|
|
96
103
|
componentName: "NiceDateRangeBox"
|
|
97
|
-
}), [
|
|
98
|
-
value:
|
|
99
|
-
defaultValue:
|
|
104
|
+
}), [l, k] = ke({
|
|
105
|
+
value: o,
|
|
106
|
+
defaultValue: c,
|
|
100
107
|
fallbackValue: "",
|
|
101
|
-
onChange:
|
|
108
|
+
onChange: Z,
|
|
102
109
|
componentName: "NiceDateRangeBox"
|
|
103
|
-
}),
|
|
110
|
+
}), Ge = de(
|
|
104
111
|
() => [
|
|
105
|
-
{ key: "Tab", description:
|
|
106
|
-
|
|
112
|
+
{ key: "Tab", description: d("shortcuts.switchField", "Switch between start/end") },
|
|
113
|
+
rt.cancel
|
|
107
114
|
],
|
|
108
|
-
[
|
|
109
|
-
),
|
|
110
|
-
|
|
111
|
-
|
|
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 =
|
|
114
|
-
e && (
|
|
115
|
-
}, [
|
|
116
|
-
if (!
|
|
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 = (
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
const
|
|
123
|
-
|
|
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",
|
|
126
|
-
document.removeEventListener("mousedown", e), window.removeEventListener("scroll",
|
|
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
|
-
}, [
|
|
129
|
-
open:
|
|
138
|
+
}, [N]), it(ne, {
|
|
139
|
+
open: N,
|
|
130
140
|
modal: !1,
|
|
131
141
|
initialFocus: '.nice-calendar__grid [tabindex="0"]',
|
|
132
|
-
onClose: () =>
|
|
142
|
+
onClose: () => j(!1)
|
|
133
143
|
});
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
return
|
|
137
|
-
if (a &&
|
|
138
|
-
if (
|
|
139
|
-
return
|
|
140
|
-
if (
|
|
141
|
-
return
|
|
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 (
|
|
145
|
-
return
|
|
146
|
-
if (
|
|
147
|
-
return
|
|
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
|
-
}, [
|
|
150
|
-
if (
|
|
159
|
+
}, [W, a, l, E, C, I, d]);
|
|
160
|
+
if (ee === "hidden")
|
|
151
161
|
return null;
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
const
|
|
156
|
-
return `${
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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--${
|
|
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
|
-
...
|
|
170
|
-
...
|
|
171
|
-
"--nice-field-label-width": typeof
|
|
196
|
+
...je,
|
|
197
|
+
...S != null && {
|
|
198
|
+
"--nice-field-label-width": typeof S == "number" ? `${S}px` : S
|
|
172
199
|
},
|
|
173
|
-
...
|
|
174
|
-
"--nice-field-control-width": typeof
|
|
200
|
+
...H != null && {
|
|
201
|
+
"--nice-field-control-width": typeof H == "number" ? `${H}px` : H
|
|
175
202
|
}
|
|
176
203
|
},
|
|
177
|
-
"aria-busy":
|
|
204
|
+
"aria-busy": K || void 0,
|
|
178
205
|
children: [
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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__ */
|
|
185
|
-
|
|
211
|
+
/* @__PURE__ */ T("div", { className: "nice-field__control", children: [
|
|
212
|
+
me ? /* @__PURE__ */ T(
|
|
186
213
|
"div",
|
|
187
214
|
{
|
|
188
|
-
ref:
|
|
189
|
-
className: `nice-input nice-input--date nice-input--${
|
|
190
|
-
style: { position: "relative", width:
|
|
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:
|
|
222
|
+
id: te,
|
|
196
223
|
className: "nice-input__native",
|
|
197
224
|
type: "text",
|
|
198
|
-
readOnly: !
|
|
199
|
-
value:
|
|
200
|
-
placeholder:
|
|
201
|
-
disabled:
|
|
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
|
-
|
|
204
|
-
|
|
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":
|
|
207
|
-
onClick:
|
|
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
|
|
210
|
-
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown" && !
|
|
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:
|
|
214
|
-
cursor:
|
|
244
|
+
width: z ? "100%" : Ze,
|
|
245
|
+
cursor: y || h ? void 0 : p ? "text" : "pointer"
|
|
215
246
|
}
|
|
216
247
|
}
|
|
217
248
|
),
|
|
218
|
-
|
|
249
|
+
B && /* @__PURE__ */ n(
|
|
219
250
|
"button",
|
|
220
251
|
{
|
|
221
252
|
type: "button",
|
|
222
253
|
className: "nice-input__clear",
|
|
223
|
-
onClick:
|
|
224
|
-
disabled: !a && !
|
|
225
|
-
"aria-label":
|
|
226
|
-
tabIndex: (a ||
|
|
227
|
-
children: /* @__PURE__ */ n(
|
|
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:
|
|
236
|
-
"aria-label":
|
|
237
|
-
"aria-expanded":
|
|
266
|
+
onClick: se,
|
|
267
|
+
"aria-label": d("controls.openPicker", "Open picker"),
|
|
268
|
+
"aria-expanded": N,
|
|
238
269
|
tabIndex: -1,
|
|
239
|
-
disabled:
|
|
240
|
-
children: /* @__PURE__ */ n(
|
|
270
|
+
disabled: y || h,
|
|
271
|
+
children: /* @__PURE__ */ n(Te, { name: "calendar", size: 16 })
|
|
241
272
|
}
|
|
242
273
|
)
|
|
243
274
|
]
|
|
244
275
|
}
|
|
245
|
-
) : /* @__PURE__ */
|
|
276
|
+
) : /* @__PURE__ */ T(
|
|
246
277
|
"div",
|
|
247
278
|
{
|
|
248
279
|
className: "nice-daterange__row",
|
|
249
280
|
style: {
|
|
250
281
|
display: "flex",
|
|
251
|
-
flexDirection:
|
|
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:
|
|
256
|
-
gap:
|
|
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:
|
|
290
|
+
flexWrap: Y ? "nowrap" : "wrap"
|
|
260
291
|
},
|
|
261
292
|
children: [
|
|
262
|
-
/* @__PURE__ */ n("div", { style: { flex:
|
|
263
|
-
|
|
293
|
+
/* @__PURE__ */ n("div", { style: { flex: z ? "1 1 0" : void 0, minWidth: 0 }, children: /* @__PURE__ */ n(
|
|
294
|
+
Ee,
|
|
264
295
|
{
|
|
265
|
-
id:
|
|
296
|
+
id: te,
|
|
266
297
|
dateFormatPreset: m,
|
|
267
|
-
displayLocale:
|
|
268
|
-
timeSelectorType:
|
|
269
|
-
label:
|
|
298
|
+
displayLocale: F,
|
|
299
|
+
timeSelectorType: ge,
|
|
300
|
+
label: ze,
|
|
270
301
|
value: a,
|
|
271
|
-
onChange:
|
|
272
|
-
min:
|
|
273
|
-
max:
|
|
274
|
-
placeholder:
|
|
275
|
-
disabled:
|
|
276
|
-
readOnly:
|
|
277
|
-
size:
|
|
278
|
-
clearable:
|
|
279
|
-
labelPlacement:
|
|
280
|
-
labelWidth:
|
|
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
|
-
|
|
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:
|
|
320
|
+
children: x
|
|
290
321
|
}
|
|
291
322
|
),
|
|
292
|
-
/* @__PURE__ */ n("div", { style: { flex:
|
|
293
|
-
|
|
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:
|
|
297
|
-
timeSelectorType:
|
|
298
|
-
label:
|
|
299
|
-
value:
|
|
300
|
-
onChange: (e) =>
|
|
301
|
-
min:
|
|
302
|
-
max:
|
|
303
|
-
placeholder:
|
|
304
|
-
disabled:
|
|
305
|
-
readOnly:
|
|
306
|
-
size:
|
|
307
|
-
clearable:
|
|
308
|
-
labelPlacement:
|
|
309
|
-
labelWidth:
|
|
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
|
-
|
|
316
|
-
/* @__PURE__ */
|
|
346
|
+
me && N && re && ve && dt(
|
|
347
|
+
/* @__PURE__ */ T(
|
|
317
348
|
"div",
|
|
318
349
|
{
|
|
319
|
-
ref:
|
|
320
|
-
className: `nice-datetime-popup${
|
|
350
|
+
ref: ne,
|
|
351
|
+
className: `nice-datetime-popup${Ne ? ` ${Ne}` : ""}`,
|
|
321
352
|
style: {
|
|
322
353
|
position: "fixed",
|
|
323
|
-
left:
|
|
324
|
-
top:
|
|
354
|
+
left: re.left,
|
|
355
|
+
top: re.top,
|
|
325
356
|
zIndex: 1e3
|
|
326
357
|
},
|
|
327
358
|
role: "dialog",
|
|
328
|
-
"aria-label":
|
|
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
|
-
|
|
362
|
+
pt,
|
|
332
363
|
{
|
|
333
364
|
selectionMode: "range",
|
|
334
|
-
rangeStart:
|
|
335
|
-
rangeEnd:
|
|
336
|
-
onRangeChange:
|
|
337
|
-
min:
|
|
338
|
-
max:
|
|
339
|
-
size:
|
|
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
|
-
|
|
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:
|
|
348
|
-
disabled: !a && !
|
|
349
|
-
children:
|
|
378
|
+
onClick: le,
|
|
379
|
+
disabled: !a && !l,
|
|
380
|
+
children: d("controls.clear", "Clear")
|
|
350
381
|
}
|
|
351
382
|
) })
|
|
352
383
|
]
|
|
353
384
|
}
|
|
354
385
|
),
|
|
355
|
-
|
|
386
|
+
ve
|
|
356
387
|
),
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
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
|
-
|
|
362
|
-
|
|
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
|
-
|
|
399
|
+
wt as NiceDateRangeBox
|
|
369
400
|
};
|