@optimum-intelligence/opti-ui 0.4.0 → 0.5.1
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/README.md +9 -7
- package/dist/components/app-shell/AppShell.d.ts +75 -6
- package/dist/components/app-shell/AppShell.js +670 -185
- package/dist/components/app-shell/AppShell.js.map +1 -1
- package/dist/components/badge/Badge.d.ts +2 -4
- package/dist/components/badge/Badge.js +12 -29
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/calendar/Calendar.d.ts +19 -8
- package/dist/components/calendar/Calendar.js +285 -212
- package/dist/components/calendar/Calendar.js.map +1 -1
- package/dist/components/calendar/DateConfig.d.ts +37 -0
- package/dist/components/calendar/DateConfig.js +75 -0
- package/dist/components/calendar/DateConfig.js.map +1 -0
- package/dist/components/calendar/date-utils.d.ts +41 -6
- package/dist/components/calendar/date-utils.js +119 -20
- package/dist/components/calendar/date-utils.js.map +1 -1
- package/dist/components/data-table/DataTableContent.js +3 -3
- package/dist/components/data-table/DataTableContent.js.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +33 -10
- package/dist/components/date-picker/DatePicker.js +315 -279
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/date-picker/DateRangePicker.d.ts +11 -4
- package/dist/components/date-picker/DateRangePicker.js +240 -206
- package/dist/components/date-picker/DateRangePicker.js.map +1 -1
- package/dist/components/date-picker/PickerField.js +1 -1
- package/dist/components/date-picker/PickerField.js.map +1 -1
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +2 -2
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components.json +2023 -1864
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -3
- package/dist/llms-full.txt +869 -752
- package/dist/llms.txt +37 -35
- package/dist/opti-ui.css +171 -81
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useDateConfig } from "../calendar/DateConfig.js";
|
|
2
3
|
import { Button } from "../button/Button.js";
|
|
3
|
-
import { datePart, formatDate, pad,
|
|
4
|
+
import { browserTimeZone, datePart, formatDate, hasTime, pad, toInstant, toWall, todayIso, truncate } from "../calendar/date-utils.js";
|
|
4
5
|
import { Calendar } from "../calendar/Calendar.js";
|
|
5
6
|
import { PickerField, useOpenState } from "./PickerField.js";
|
|
6
7
|
import { c } from "react/compiler-runtime";
|
|
@@ -26,22 +27,21 @@ function timeOptions(limit, step, current) {
|
|
|
26
27
|
const options = Array.from({ length: Math.ceil(limit / step) }, (_, index) => index * step);
|
|
27
28
|
return options.includes(current) ? options : [...options, current].sort((a, b) => a - b);
|
|
28
29
|
}
|
|
29
|
-
/** Hour, minute and
|
|
30
|
+
/** Hour, minute and second lists, down to the picker's granularity: unlike a native time input, always 24-hour. */
|
|
30
31
|
function TimeField(t0) {
|
|
31
|
-
const $ = c(
|
|
32
|
-
const { value, step, labels, onChange } = t0;
|
|
32
|
+
const $ = c(25);
|
|
33
|
+
const { value, step, units, labels, onChange } = t0;
|
|
33
34
|
let t1;
|
|
34
35
|
let t2;
|
|
35
36
|
let t3;
|
|
36
37
|
let t4;
|
|
37
38
|
let t5;
|
|
38
39
|
let t6;
|
|
39
|
-
if ($[0] !== labels.hours || $[1] !== labels.minutes || $[2] !== labels.seconds || $[3] !== labels.time || $[4] !== onChange || $[5] !== step || $[6] !== value) {
|
|
40
|
+
if ($[0] !== labels.hours || $[1] !== labels.minutes || $[2] !== labels.seconds || $[3] !== labels.time || $[4] !== onChange || $[5] !== step || $[6] !== units || $[7] !== value) {
|
|
40
41
|
const [t7, t8, t9] = value.split(":").map(_temp);
|
|
41
42
|
const hours = t7 === void 0 ? 0 : t7;
|
|
42
43
|
const minutes = t8 === void 0 ? 0 : t8;
|
|
43
44
|
const seconds = t9 === void 0 ? 0 : t9;
|
|
44
|
-
const withSeconds = step % 60 !== 0 || value.length > 5;
|
|
45
45
|
const parts = [
|
|
46
46
|
{
|
|
47
47
|
label: labels.hours,
|
|
@@ -53,20 +53,20 @@ function TimeField(t0) {
|
|
|
53
53
|
value: minutes,
|
|
54
54
|
options: timeOptions(60, step % 60 === 0 && step < 3600 ? step / 60 : 1, minutes)
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
{
|
|
57
57
|
label: labels.seconds,
|
|
58
58
|
value: seconds,
|
|
59
59
|
options: timeOptions(60, step < 60 ? step : 1, seconds)
|
|
60
|
-
}
|
|
61
|
-
];
|
|
60
|
+
}
|
|
61
|
+
].slice(0, units);
|
|
62
62
|
t3 = "group";
|
|
63
63
|
t4 = labels.time;
|
|
64
64
|
t5 = "oui-date-picker__time";
|
|
65
|
-
if ($[
|
|
65
|
+
if ($[14] !== labels.time) {
|
|
66
66
|
t6 = /* @__PURE__ */ jsx("span", { children: labels.time });
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
} else t6 = $[
|
|
67
|
+
$[14] = labels.time;
|
|
68
|
+
$[15] = t6;
|
|
69
|
+
} else t6 = $[15];
|
|
70
70
|
t1 = "oui-date-picker__time-parts";
|
|
71
71
|
t2 = parts.map((part_0, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 && /* @__PURE__ */ jsx("span", {
|
|
72
72
|
"aria-hidden": "true",
|
|
@@ -78,7 +78,11 @@ function TimeField(t0) {
|
|
|
78
78
|
value: part_0.value,
|
|
79
79
|
onChange: (event) => {
|
|
80
80
|
const next = parts.map((item, position) => pad(position === index ? Number(event.target.value) : item.value));
|
|
81
|
-
onChange(
|
|
81
|
+
onChange([
|
|
82
|
+
...next,
|
|
83
|
+
"00",
|
|
84
|
+
"00"
|
|
85
|
+
].slice(0, 3).join(":"));
|
|
82
86
|
},
|
|
83
87
|
children: part_0.options.map(_temp2)
|
|
84
88
|
})] }, part_0.label));
|
|
@@ -88,46 +92,47 @@ function TimeField(t0) {
|
|
|
88
92
|
$[3] = labels.time;
|
|
89
93
|
$[4] = onChange;
|
|
90
94
|
$[5] = step;
|
|
91
|
-
$[6] =
|
|
92
|
-
$[7] =
|
|
93
|
-
$[8] =
|
|
94
|
-
$[9] =
|
|
95
|
-
$[10] =
|
|
96
|
-
$[11] =
|
|
97
|
-
$[12] =
|
|
95
|
+
$[6] = units;
|
|
96
|
+
$[7] = value;
|
|
97
|
+
$[8] = t1;
|
|
98
|
+
$[9] = t2;
|
|
99
|
+
$[10] = t3;
|
|
100
|
+
$[11] = t4;
|
|
101
|
+
$[12] = t5;
|
|
102
|
+
$[13] = t6;
|
|
98
103
|
} else {
|
|
99
|
-
t1 = $[
|
|
100
|
-
t2 = $[
|
|
101
|
-
t3 = $[
|
|
102
|
-
t4 = $[
|
|
103
|
-
t5 = $[
|
|
104
|
-
t6 = $[
|
|
104
|
+
t1 = $[8];
|
|
105
|
+
t2 = $[9];
|
|
106
|
+
t3 = $[10];
|
|
107
|
+
t4 = $[11];
|
|
108
|
+
t5 = $[12];
|
|
109
|
+
t6 = $[13];
|
|
105
110
|
}
|
|
106
111
|
let t7;
|
|
107
|
-
if ($[
|
|
112
|
+
if ($[16] !== t1 || $[17] !== t2) {
|
|
108
113
|
t7 = /* @__PURE__ */ jsx("div", {
|
|
109
114
|
className: t1,
|
|
110
115
|
children: t2
|
|
111
116
|
});
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
} else t7 = $[
|
|
117
|
+
$[16] = t1;
|
|
118
|
+
$[17] = t2;
|
|
119
|
+
$[18] = t7;
|
|
120
|
+
} else t7 = $[18];
|
|
116
121
|
let t8;
|
|
117
|
-
if ($[
|
|
122
|
+
if ($[19] !== t3 || $[20] !== t4 || $[21] !== t5 || $[22] !== t6 || $[23] !== t7) {
|
|
118
123
|
t8 = /* @__PURE__ */ jsxs("div", {
|
|
119
124
|
role: t3,
|
|
120
125
|
"aria-label": t4,
|
|
121
126
|
className: t5,
|
|
122
127
|
children: [t6, t7]
|
|
123
128
|
});
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
} else t8 = $[
|
|
129
|
+
$[19] = t3;
|
|
130
|
+
$[20] = t4;
|
|
131
|
+
$[21] = t5;
|
|
132
|
+
$[22] = t6;
|
|
133
|
+
$[23] = t7;
|
|
134
|
+
$[24] = t8;
|
|
135
|
+
} else t8 = $[24];
|
|
131
136
|
return t8;
|
|
132
137
|
}
|
|
133
138
|
function _temp2(option) {
|
|
@@ -139,236 +144,230 @@ function _temp2(option) {
|
|
|
139
144
|
function _temp(part) {
|
|
140
145
|
return Math.floor(Number(part)) || 0;
|
|
141
146
|
}
|
|
147
|
+
var placeholders = {
|
|
148
|
+
year: "Select year",
|
|
149
|
+
month: "Select month",
|
|
150
|
+
day: "Select date",
|
|
151
|
+
hour: "Select date and time",
|
|
152
|
+
minute: "Select date and time",
|
|
153
|
+
second: "Select date and time"
|
|
154
|
+
};
|
|
142
155
|
function Picker(t0) {
|
|
143
|
-
const $ = c(
|
|
156
|
+
const $ = c(89);
|
|
144
157
|
let clearable;
|
|
145
158
|
let defaultMonth;
|
|
146
159
|
let field;
|
|
160
|
+
let format;
|
|
147
161
|
let formatValue;
|
|
162
|
+
let granularity;
|
|
148
163
|
let isDateDisabled;
|
|
149
164
|
let labels;
|
|
150
|
-
let
|
|
165
|
+
let localeProp;
|
|
151
166
|
let max;
|
|
152
167
|
let min;
|
|
153
|
-
let mode;
|
|
154
168
|
let name;
|
|
155
169
|
let onValueChange;
|
|
156
170
|
let placeholder;
|
|
157
171
|
let step;
|
|
158
172
|
let t1;
|
|
159
173
|
let t2;
|
|
174
|
+
let timeZone;
|
|
160
175
|
let value;
|
|
161
176
|
let weekStartsOn;
|
|
162
177
|
if ($[0] !== t0) {
|
|
163
|
-
({
|
|
178
|
+
({granularity, step, defaultTime: t1, value, defaultValue: t2, onValueChange, min, max, isDateDisabled, defaultMonth, locale: localeProp, weekStartsOn, name, placeholder, clearable, format, timeZone, formatValue, labels, ...field} = t0);
|
|
164
179
|
$[0] = t0;
|
|
165
180
|
$[1] = clearable;
|
|
166
181
|
$[2] = defaultMonth;
|
|
167
182
|
$[3] = field;
|
|
168
|
-
$[4] =
|
|
169
|
-
$[5] =
|
|
170
|
-
$[6] =
|
|
171
|
-
$[7] =
|
|
172
|
-
$[8] =
|
|
173
|
-
$[9] =
|
|
174
|
-
$[10] =
|
|
175
|
-
$[11] =
|
|
176
|
-
$[12] =
|
|
177
|
-
$[13] =
|
|
178
|
-
$[14] =
|
|
179
|
-
$[15] =
|
|
180
|
-
$[16] =
|
|
181
|
-
$[17] =
|
|
182
|
-
$[18] =
|
|
183
|
+
$[4] = format;
|
|
184
|
+
$[5] = formatValue;
|
|
185
|
+
$[6] = granularity;
|
|
186
|
+
$[7] = isDateDisabled;
|
|
187
|
+
$[8] = labels;
|
|
188
|
+
$[9] = localeProp;
|
|
189
|
+
$[10] = max;
|
|
190
|
+
$[11] = min;
|
|
191
|
+
$[12] = name;
|
|
192
|
+
$[13] = onValueChange;
|
|
193
|
+
$[14] = placeholder;
|
|
194
|
+
$[15] = step;
|
|
195
|
+
$[16] = t1;
|
|
196
|
+
$[17] = t2;
|
|
197
|
+
$[18] = timeZone;
|
|
198
|
+
$[19] = value;
|
|
199
|
+
$[20] = weekStartsOn;
|
|
183
200
|
} else {
|
|
184
201
|
clearable = $[1];
|
|
185
202
|
defaultMonth = $[2];
|
|
186
203
|
field = $[3];
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
204
|
+
format = $[4];
|
|
205
|
+
formatValue = $[5];
|
|
206
|
+
granularity = $[6];
|
|
207
|
+
isDateDisabled = $[7];
|
|
208
|
+
labels = $[8];
|
|
209
|
+
localeProp = $[9];
|
|
210
|
+
max = $[10];
|
|
211
|
+
min = $[11];
|
|
212
|
+
name = $[12];
|
|
213
|
+
onValueChange = $[13];
|
|
214
|
+
placeholder = $[14];
|
|
215
|
+
step = $[15];
|
|
216
|
+
t1 = $[16];
|
|
217
|
+
t2 = $[17];
|
|
218
|
+
timeZone = $[18];
|
|
219
|
+
value = $[19];
|
|
220
|
+
weekStartsOn = $[20];
|
|
202
221
|
}
|
|
203
222
|
const defaultTime = t1 === void 0 ? "00:00" : t1;
|
|
204
223
|
const defaultValue = t2 === void 0 ? null : t2;
|
|
205
224
|
let t3;
|
|
206
|
-
if ($[
|
|
225
|
+
if ($[21] !== labels) {
|
|
207
226
|
t3 = {
|
|
208
227
|
...defaultLabels,
|
|
209
228
|
...labels
|
|
210
229
|
};
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
} else t3 = $[
|
|
230
|
+
$[21] = labels;
|
|
231
|
+
$[22] = t3;
|
|
232
|
+
} else t3 = $[22];
|
|
214
233
|
const text = t3;
|
|
215
|
-
const
|
|
234
|
+
const config = useDateConfig();
|
|
235
|
+
const zone = timeZone ?? config.timeZone ?? browserTimeZone();
|
|
236
|
+
const locale = localeProp ?? config.locale;
|
|
237
|
+
let t4;
|
|
238
|
+
if ($[23] !== granularity) {
|
|
239
|
+
t4 = hasTime(granularity);
|
|
240
|
+
$[23] = granularity;
|
|
241
|
+
$[24] = t4;
|
|
242
|
+
} else t4 = $[24];
|
|
243
|
+
const withTime = t4;
|
|
216
244
|
const [inner, setInner] = React.useState(defaultValue);
|
|
217
245
|
const current = (value === void 0 ? inner : value) || null;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
$[22] = t4;
|
|
223
|
-
} else t4 = $[22];
|
|
224
|
-
const date = t4;
|
|
225
|
-
let t5;
|
|
226
|
-
if ($[23] !== current || $[24] !== defaultTime || $[25] !== withTime) {
|
|
227
|
-
t5 = withTime ? timePart(current) ?? defaultTime : null;
|
|
228
|
-
$[23] = current;
|
|
229
|
-
$[24] = defaultTime;
|
|
230
|
-
$[25] = withTime;
|
|
231
|
-
$[26] = t5;
|
|
232
|
-
} else t5 = $[26];
|
|
233
|
-
const time = t5;
|
|
246
|
+
const wall = toWall(current, zone);
|
|
247
|
+
const date = datePart(wall);
|
|
248
|
+
const time = withTime ? wall && wall.length > 10 ? wall.slice(11) : truncate(`2000-01-01T${defaultTime}`, "second").slice(11) : null;
|
|
249
|
+
const [lower, upper] = [toWall(min, zone) ?? void 0, toWall(max, zone) ?? void 0];
|
|
234
250
|
const [open, setOpen] = useOpenState(field);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
let
|
|
250
|
-
if ($[
|
|
251
|
-
|
|
252
|
-
$[31] = current;
|
|
253
|
-
$[32] = date;
|
|
254
|
-
$[33] = formatValue;
|
|
255
|
-
$[34] = withTime;
|
|
256
|
-
$[35] = t8;
|
|
257
|
-
} else t8 = $[35];
|
|
258
|
-
let t9;
|
|
259
|
-
if ($[36] !== current || $[37] !== name) {
|
|
260
|
-
t9 = name && /* @__PURE__ */ jsx("input", {
|
|
251
|
+
const commit = (next) => {
|
|
252
|
+
const cut = next === null ? null : truncate(withinBounds(next, lower, upper), granularity);
|
|
253
|
+
const stored = cut && withTime ? toInstant(cut, zone) : cut;
|
|
254
|
+
setInner(stored);
|
|
255
|
+
onValueChange?.(stored);
|
|
256
|
+
};
|
|
257
|
+
const T0 = PickerField;
|
|
258
|
+
const t5 = placeholder ?? placeholders[granularity];
|
|
259
|
+
const t6 = date && current ? formatValue?.(current) ?? formatDate(current, {
|
|
260
|
+
format: format ?? config.formats?.[granularity],
|
|
261
|
+
granularity,
|
|
262
|
+
timeZone: zone,
|
|
263
|
+
locale
|
|
264
|
+
}) : null;
|
|
265
|
+
let t7;
|
|
266
|
+
if ($[25] !== current || $[26] !== name) {
|
|
267
|
+
t7 = name && /* @__PURE__ */ jsx("input", {
|
|
261
268
|
type: "hidden",
|
|
262
269
|
name,
|
|
263
270
|
value: current ?? ""
|
|
264
271
|
});
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
} else
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
$[41] = time;
|
|
278
|
-
$[42] = withTime;
|
|
279
|
-
$[43] = t10;
|
|
280
|
-
} else t10 = $[43];
|
|
281
|
-
let t11;
|
|
282
|
-
if ($[44] !== min) {
|
|
283
|
-
t11 = datePart(min) ?? void 0;
|
|
284
|
-
$[44] = min;
|
|
285
|
-
$[45] = t11;
|
|
286
|
-
} else t11 = $[45];
|
|
272
|
+
$[25] = current;
|
|
273
|
+
$[26] = name;
|
|
274
|
+
$[27] = t7;
|
|
275
|
+
} else t7 = $[27];
|
|
276
|
+
const T1 = Calendar;
|
|
277
|
+
const t8 = withTime ? "day" : granularity;
|
|
278
|
+
const t9 = (next_0) => {
|
|
279
|
+
commit(withTime ? `${next_0}T${time}` : next_0);
|
|
280
|
+
if (!withTime) setOpen(false);
|
|
281
|
+
};
|
|
282
|
+
const t10 = datePart(lower) ?? void 0;
|
|
283
|
+
const t11 = datePart(upper) ?? void 0;
|
|
287
284
|
let t12;
|
|
288
|
-
if ($[
|
|
289
|
-
t12 =
|
|
290
|
-
$[46] = max;
|
|
291
|
-
$[47] = t12;
|
|
292
|
-
} else t12 = $[47];
|
|
293
|
-
let t13;
|
|
294
|
-
if ($[48] !== date || $[49] !== defaultMonth || $[50] !== isDateDisabled || $[51] !== labels || $[52] !== locale || $[53] !== t10 || $[54] !== t11 || $[55] !== t12 || $[56] !== weekStartsOn) {
|
|
295
|
-
t13 = /* @__PURE__ */ jsx(Calendar, {
|
|
285
|
+
if ($[28] !== T1 || $[29] !== date || $[30] !== defaultMonth || $[31] !== isDateDisabled || $[32] !== labels || $[33] !== locale || $[34] !== t10 || $[35] !== t11 || $[36] !== t8 || $[37] !== t9 || $[38] !== weekStartsOn) {
|
|
286
|
+
t12 = /* @__PURE__ */ jsx(T1, {
|
|
296
287
|
value: date,
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
288
|
+
granularity: t8,
|
|
289
|
+
onValueChange: t9,
|
|
290
|
+
min: t10,
|
|
291
|
+
max: t11,
|
|
300
292
|
isDateDisabled,
|
|
301
293
|
defaultMonth,
|
|
302
294
|
locale,
|
|
303
295
|
weekStartsOn,
|
|
304
296
|
labels
|
|
305
297
|
});
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
298
|
+
$[28] = T1;
|
|
299
|
+
$[29] = date;
|
|
300
|
+
$[30] = defaultMonth;
|
|
301
|
+
$[31] = isDateDisabled;
|
|
302
|
+
$[32] = labels;
|
|
303
|
+
$[33] = locale;
|
|
304
|
+
$[34] = t10;
|
|
305
|
+
$[35] = t11;
|
|
306
|
+
$[36] = t8;
|
|
307
|
+
$[37] = t9;
|
|
308
|
+
$[38] = weekStartsOn;
|
|
309
|
+
$[39] = t12;
|
|
310
|
+
} else t12 = $[39];
|
|
311
|
+
let t13;
|
|
312
|
+
if ($[40] !== commit || $[41] !== date || $[42] !== granularity || $[43] !== lower || $[44] !== step || $[45] !== text || $[46] !== time || $[47] !== upper || $[48] !== zone) {
|
|
313
|
+
t13 = time !== null && /* @__PURE__ */ jsx(TimeField, {
|
|
320
314
|
value: time,
|
|
321
315
|
step: step && step > 0 ? Math.floor(step) || 1 : 60,
|
|
316
|
+
units: granularity === "hour" ? 1 : granularity === "minute" ? 2 : 3,
|
|
322
317
|
labels: text,
|
|
323
|
-
onChange: (next_1) => commit(`${date ?? withinBounds(todayIso(), datePart(
|
|
318
|
+
onChange: (next_1) => commit(`${date ?? withinBounds(todayIso(zone), datePart(lower) ?? void 0, datePart(upper) ?? void 0)}T${next_1}`)
|
|
324
319
|
});
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
320
|
+
$[40] = commit;
|
|
321
|
+
$[41] = date;
|
|
322
|
+
$[42] = granularity;
|
|
323
|
+
$[43] = lower;
|
|
324
|
+
$[44] = step;
|
|
325
|
+
$[45] = text;
|
|
326
|
+
$[46] = time;
|
|
327
|
+
$[47] = upper;
|
|
328
|
+
$[48] = zone;
|
|
329
|
+
$[49] = t13;
|
|
330
|
+
} else t13 = $[49];
|
|
331
|
+
let t14;
|
|
332
|
+
if ($[50] !== isDateDisabled || $[51] !== zone) {
|
|
333
|
+
t14 = isDateDisabled?.(todayIso(zone));
|
|
334
|
+
$[50] = isDateDisabled;
|
|
335
|
+
$[51] = zone;
|
|
336
|
+
$[52] = t14;
|
|
337
|
+
} else t14 = $[52];
|
|
338
|
+
const t15 = Boolean(t14);
|
|
339
|
+
let t16;
|
|
340
|
+
if ($[53] !== commit || $[54] !== setOpen || $[55] !== time || $[56] !== withTime || $[57] !== zone) {
|
|
341
|
+
t16 = () => {
|
|
342
|
+
const today = todayIso(zone);
|
|
345
343
|
commit(withTime ? `${today}T${time}` : today);
|
|
346
344
|
if (!withTime) setOpen(false);
|
|
347
345
|
};
|
|
348
|
-
$[
|
|
349
|
-
$[
|
|
350
|
-
$[
|
|
351
|
-
$[
|
|
352
|
-
$[
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
346
|
+
$[53] = commit;
|
|
347
|
+
$[54] = setOpen;
|
|
348
|
+
$[55] = time;
|
|
349
|
+
$[56] = withTime;
|
|
350
|
+
$[57] = zone;
|
|
351
|
+
$[58] = t16;
|
|
352
|
+
} else t16 = $[58];
|
|
353
|
+
let t17;
|
|
354
|
+
if ($[59] !== t15 || $[60] !== t16 || $[61] !== text.today) {
|
|
355
|
+
t17 = /* @__PURE__ */ jsx(Button, {
|
|
357
356
|
size: "sm",
|
|
358
357
|
variant: "ghost",
|
|
359
358
|
shape: "rounded",
|
|
360
|
-
disabled:
|
|
361
|
-
onClick:
|
|
359
|
+
disabled: t15,
|
|
360
|
+
onClick: t16,
|
|
362
361
|
children: text.today
|
|
363
362
|
});
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
} else
|
|
369
|
-
let
|
|
370
|
-
if ($[
|
|
371
|
-
|
|
363
|
+
$[59] = t15;
|
|
364
|
+
$[60] = t16;
|
|
365
|
+
$[61] = text.today;
|
|
366
|
+
$[62] = t17;
|
|
367
|
+
} else t17 = $[62];
|
|
368
|
+
let t18;
|
|
369
|
+
if ($[63] !== clearable || $[64] !== commit || $[65] !== current || $[66] !== field || $[67] !== setOpen || $[68] !== text.clear) {
|
|
370
|
+
t18 = (clearable ?? !field.required) && /* @__PURE__ */ jsx(Button, {
|
|
372
371
|
size: "sm",
|
|
373
372
|
variant: "ghost",
|
|
374
373
|
shape: "rounded",
|
|
@@ -379,105 +378,142 @@ function Picker(t0) {
|
|
|
379
378
|
},
|
|
380
379
|
children: text.clear
|
|
381
380
|
});
|
|
382
|
-
$[
|
|
383
|
-
$[
|
|
384
|
-
$[
|
|
385
|
-
$[
|
|
386
|
-
$[
|
|
387
|
-
$[
|
|
388
|
-
$[
|
|
389
|
-
} else
|
|
390
|
-
let
|
|
391
|
-
if ($[
|
|
392
|
-
|
|
381
|
+
$[63] = clearable;
|
|
382
|
+
$[64] = commit;
|
|
383
|
+
$[65] = current;
|
|
384
|
+
$[66] = field;
|
|
385
|
+
$[67] = setOpen;
|
|
386
|
+
$[68] = text.clear;
|
|
387
|
+
$[69] = t18;
|
|
388
|
+
} else t18 = $[69];
|
|
389
|
+
let t19;
|
|
390
|
+
if ($[70] !== setOpen || $[71] !== text.done || $[72] !== withTime) {
|
|
391
|
+
t19 = withTime && /* @__PURE__ */ jsx(Button, {
|
|
393
392
|
size: "sm",
|
|
394
393
|
shape: "rounded",
|
|
395
394
|
className: "oui-date-picker__done",
|
|
396
395
|
onClick: () => setOpen(false),
|
|
397
396
|
children: text.done
|
|
398
397
|
});
|
|
399
|
-
$[
|
|
400
|
-
$[
|
|
401
|
-
$[
|
|
402
|
-
$[
|
|
403
|
-
} else
|
|
404
|
-
let
|
|
405
|
-
if ($[
|
|
406
|
-
|
|
398
|
+
$[70] = setOpen;
|
|
399
|
+
$[71] = text.done;
|
|
400
|
+
$[72] = withTime;
|
|
401
|
+
$[73] = t19;
|
|
402
|
+
} else t19 = $[73];
|
|
403
|
+
let t20;
|
|
404
|
+
if ($[74] !== t17 || $[75] !== t18 || $[76] !== t19) {
|
|
405
|
+
t20 = /* @__PURE__ */ jsxs("div", {
|
|
407
406
|
className: "oui-date-picker__footer",
|
|
408
407
|
children: [
|
|
408
|
+
t17,
|
|
409
409
|
t18,
|
|
410
|
-
t19
|
|
411
|
-
t20
|
|
410
|
+
t19
|
|
412
411
|
]
|
|
413
412
|
});
|
|
414
|
-
$[
|
|
415
|
-
$[
|
|
416
|
-
$[
|
|
417
|
-
$[
|
|
418
|
-
} else
|
|
419
|
-
let
|
|
420
|
-
if ($[
|
|
421
|
-
|
|
413
|
+
$[74] = t17;
|
|
414
|
+
$[75] = t18;
|
|
415
|
+
$[76] = t19;
|
|
416
|
+
$[77] = t20;
|
|
417
|
+
} else t20 = $[77];
|
|
418
|
+
let t21;
|
|
419
|
+
if ($[78] !== T0 || $[79] !== field || $[80] !== open || $[81] !== setOpen || $[82] !== t12 || $[83] !== t13 || $[84] !== t20 || $[85] !== t5 || $[86] !== t6 || $[87] !== t7) {
|
|
420
|
+
t21 = /* @__PURE__ */ jsxs(T0, {
|
|
422
421
|
...field,
|
|
423
422
|
open,
|
|
424
423
|
onOpenChange: setOpen,
|
|
425
|
-
placeholder:
|
|
426
|
-
display:
|
|
427
|
-
inputs:
|
|
424
|
+
placeholder: t5,
|
|
425
|
+
display: t6,
|
|
426
|
+
inputs: t7,
|
|
428
427
|
children: [
|
|
428
|
+
t12,
|
|
429
429
|
t13,
|
|
430
|
-
|
|
431
|
-
t21
|
|
430
|
+
t20
|
|
432
431
|
]
|
|
433
432
|
});
|
|
434
|
-
$[
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
$[
|
|
442
|
-
$[
|
|
443
|
-
$[
|
|
444
|
-
|
|
445
|
-
|
|
433
|
+
$[78] = T0;
|
|
434
|
+
$[79] = field;
|
|
435
|
+
$[80] = open;
|
|
436
|
+
$[81] = setOpen;
|
|
437
|
+
$[82] = t12;
|
|
438
|
+
$[83] = t13;
|
|
439
|
+
$[84] = t20;
|
|
440
|
+
$[85] = t5;
|
|
441
|
+
$[86] = t6;
|
|
442
|
+
$[87] = t7;
|
|
443
|
+
$[88] = t21;
|
|
444
|
+
} else t21 = $[88];
|
|
445
|
+
return t21;
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
|
-
* Date field with a calendar popover.
|
|
449
|
-
* the same format as `<input type="date"
|
|
448
|
+
* Date field with a calendar popover. Day values are ISO dates (`"2026-03-09"`),
|
|
449
|
+
* the same format as `<input type="date">`. `granularity="month"` or `"year"` opens a
|
|
450
|
+
* month or year grid and stores the period's first day (`"2026-03-01"`); a time
|
|
451
|
+
* granularity behaves like `DateTimePicker`.
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* <DatePicker label="Delivery date" value={date} onValueChange={setDate} />
|
|
455
|
+
* <DatePicker label="Billing month" granularity="month" format="MMMM YYYY" />
|
|
450
456
|
*/
|
|
451
|
-
function DatePicker(
|
|
452
|
-
const $ = c(
|
|
453
|
-
let
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
+
function DatePicker(t0) {
|
|
458
|
+
const $ = c(6);
|
|
459
|
+
let props;
|
|
460
|
+
let t1;
|
|
461
|
+
if ($[0] !== t0) {
|
|
462
|
+
({granularity: t1, ...props} = t0);
|
|
463
|
+
$[0] = t0;
|
|
464
|
+
$[1] = props;
|
|
465
|
+
$[2] = t1;
|
|
466
|
+
} else {
|
|
467
|
+
props = $[1];
|
|
468
|
+
t1 = $[2];
|
|
469
|
+
}
|
|
470
|
+
const granularity = t1 === void 0 ? "day" : t1;
|
|
471
|
+
let t2;
|
|
472
|
+
if ($[3] !== granularity || $[4] !== props) {
|
|
473
|
+
t2 = /* @__PURE__ */ jsx(Picker, {
|
|
474
|
+
granularity,
|
|
457
475
|
...props
|
|
458
476
|
});
|
|
459
|
-
$[
|
|
460
|
-
$[
|
|
461
|
-
|
|
462
|
-
|
|
477
|
+
$[3] = granularity;
|
|
478
|
+
$[4] = props;
|
|
479
|
+
$[5] = t2;
|
|
480
|
+
} else t2 = $[5];
|
|
481
|
+
return t2;
|
|
463
482
|
}
|
|
464
483
|
/**
|
|
465
|
-
* Date and time field. Values are
|
|
466
|
-
* the
|
|
467
|
-
*
|
|
484
|
+
* Date and time field. Values are UTC instants (`"2026-03-09T13:30:00Z"`) shown and
|
|
485
|
+
* edited in `timeZone` (the browser's by default) on a 24-hour clock, as
|
|
486
|
+
* `2026-03-09 14:30`. Values without an offset (`"2026-03-09T14:30"`) are read as
|
|
487
|
+
* wall-clock time in `timeZone`.
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* <DateTimePicker label="Departure" value={slot} onValueChange={setSlot} timeZone="Europe/Budapest" />
|
|
468
491
|
*/
|
|
469
|
-
function DateTimePicker(
|
|
470
|
-
const $ = c(
|
|
471
|
-
let
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
492
|
+
function DateTimePicker(t0) {
|
|
493
|
+
const $ = c(6);
|
|
494
|
+
let granularity;
|
|
495
|
+
let props;
|
|
496
|
+
if ($[0] !== t0) {
|
|
497
|
+
({granularity, ...props} = t0);
|
|
498
|
+
$[0] = t0;
|
|
499
|
+
$[1] = granularity;
|
|
500
|
+
$[2] = props;
|
|
501
|
+
} else {
|
|
502
|
+
granularity = $[1];
|
|
503
|
+
props = $[2];
|
|
504
|
+
}
|
|
505
|
+
const unit = granularity ?? (props.step && props.step % 60 !== 0 ? "second" : "minute");
|
|
506
|
+
let t1;
|
|
507
|
+
if ($[3] !== props || $[4] !== unit) {
|
|
508
|
+
t1 = /* @__PURE__ */ jsx(Picker, {
|
|
509
|
+
granularity: unit,
|
|
475
510
|
...props
|
|
476
511
|
});
|
|
477
|
-
$[
|
|
478
|
-
$[
|
|
479
|
-
|
|
480
|
-
|
|
512
|
+
$[3] = props;
|
|
513
|
+
$[4] = unit;
|
|
514
|
+
$[5] = t1;
|
|
515
|
+
} else t1 = $[5];
|
|
516
|
+
return t1;
|
|
481
517
|
}
|
|
482
518
|
//#endregion
|
|
483
519
|
export { DatePicker, DateTimePicker };
|