@optimum-intelligence/opti-ui 0.4.0 → 0.5.0

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 (36) hide show
  1. package/README.md +9 -7
  2. package/dist/components/app-shell/AppShell.d.ts +75 -6
  3. package/dist/components/app-shell/AppShell.js +670 -185
  4. package/dist/components/app-shell/AppShell.js.map +1 -1
  5. package/dist/components/badge/Badge.d.ts +2 -4
  6. package/dist/components/badge/Badge.js +12 -29
  7. package/dist/components/badge/Badge.js.map +1 -1
  8. package/dist/components/calendar/Calendar.d.ts +19 -8
  9. package/dist/components/calendar/Calendar.js +285 -212
  10. package/dist/components/calendar/Calendar.js.map +1 -1
  11. package/dist/components/calendar/DateConfig.d.ts +37 -0
  12. package/dist/components/calendar/DateConfig.js +75 -0
  13. package/dist/components/calendar/DateConfig.js.map +1 -0
  14. package/dist/components/calendar/date-utils.d.ts +41 -6
  15. package/dist/components/calendar/date-utils.js +119 -20
  16. package/dist/components/calendar/date-utils.js.map +1 -1
  17. package/dist/components/data-table/DataTableContent.js +3 -3
  18. package/dist/components/data-table/DataTableContent.js.map +1 -1
  19. package/dist/components/date-picker/DatePicker.d.ts +33 -10
  20. package/dist/components/date-picker/DatePicker.js +315 -279
  21. package/dist/components/date-picker/DatePicker.js.map +1 -1
  22. package/dist/components/date-picker/DateRangePicker.d.ts +11 -4
  23. package/dist/components/date-picker/DateRangePicker.js +240 -206
  24. package/dist/components/date-picker/DateRangePicker.js.map +1 -1
  25. package/dist/components/date-picker/PickerField.js +1 -1
  26. package/dist/components/date-picker/PickerField.js.map +1 -1
  27. package/dist/components/table/Table.d.ts +1 -1
  28. package/dist/components/table/Table.js +2 -2
  29. package/dist/components/table/Table.js.map +1 -1
  30. package/dist/components.json +2023 -1864
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +4 -3
  33. package/dist/llms-full.txt +869 -752
  34. package/dist/llms.txt +37 -35
  35. package/dist/opti-ui.css +171 -81
  36. 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, timePart, todayIso } from "../calendar/date-utils.js";
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 (below one-minute steps) second lists: unlike a native time input, always 24-hour. */
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(24);
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
- ...withSeconds ? [{
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 ($[13] !== labels.time) {
65
+ if ($[14] !== labels.time) {
66
66
  t6 = /* @__PURE__ */ jsx("span", { children: labels.time });
67
- $[13] = labels.time;
68
- $[14] = t6;
69
- } else t6 = $[14];
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(next.join(":"));
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] = value;
92
- $[7] = t1;
93
- $[8] = t2;
94
- $[9] = t3;
95
- $[10] = t4;
96
- $[11] = t5;
97
- $[12] = t6;
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 = $[7];
100
- t2 = $[8];
101
- t3 = $[9];
102
- t4 = $[10];
103
- t5 = $[11];
104
- t6 = $[12];
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 ($[15] !== t1 || $[16] !== t2) {
112
+ if ($[16] !== t1 || $[17] !== t2) {
108
113
  t7 = /* @__PURE__ */ jsx("div", {
109
114
  className: t1,
110
115
  children: t2
111
116
  });
112
- $[15] = t1;
113
- $[16] = t2;
114
- $[17] = t7;
115
- } else t7 = $[17];
117
+ $[16] = t1;
118
+ $[17] = t2;
119
+ $[18] = t7;
120
+ } else t7 = $[18];
116
121
  let t8;
117
- if ($[18] !== t3 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6 || $[22] !== t7) {
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
- $[18] = t3;
125
- $[19] = t4;
126
- $[20] = t5;
127
- $[21] = t6;
128
- $[22] = t7;
129
- $[23] = t8;
130
- } else t8 = $[23];
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(102);
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 locale;
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
- ({mode, step, defaultTime: t1, value, defaultValue: t2, onValueChange, min, max, isDateDisabled, defaultMonth, locale, weekStartsOn, name, placeholder, clearable, formatValue, labels, ...field} = t0);
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] = formatValue;
169
- $[5] = isDateDisabled;
170
- $[6] = labels;
171
- $[7] = locale;
172
- $[8] = max;
173
- $[9] = min;
174
- $[10] = mode;
175
- $[11] = name;
176
- $[12] = onValueChange;
177
- $[13] = placeholder;
178
- $[14] = step;
179
- $[15] = t1;
180
- $[16] = t2;
181
- $[17] = value;
182
- $[18] = weekStartsOn;
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
- formatValue = $[4];
188
- isDateDisabled = $[5];
189
- labels = $[6];
190
- locale = $[7];
191
- max = $[8];
192
- min = $[9];
193
- mode = $[10];
194
- name = $[11];
195
- onValueChange = $[12];
196
- placeholder = $[13];
197
- step = $[14];
198
- t1 = $[15];
199
- t2 = $[16];
200
- value = $[17];
201
- weekStartsOn = $[18];
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 ($[19] !== labels) {
225
+ if ($[21] !== labels) {
207
226
  t3 = {
208
227
  ...defaultLabels,
209
228
  ...labels
210
229
  };
211
- $[19] = labels;
212
- $[20] = t3;
213
- } else t3 = $[20];
230
+ $[21] = labels;
231
+ $[22] = t3;
232
+ } else t3 = $[22];
214
233
  const text = t3;
215
- const withTime = mode === "datetime";
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
- let t4;
219
- if ($[21] !== current) {
220
- t4 = datePart(current);
221
- $[21] = current;
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
- let t6;
236
- if ($[27] !== max || $[28] !== min || $[29] !== onValueChange) {
237
- t6 = (next) => {
238
- const bounded = next === null ? null : withinBounds(next, min, max);
239
- setInner(bounded);
240
- onValueChange?.(bounded);
241
- };
242
- $[27] = max;
243
- $[28] = min;
244
- $[29] = onValueChange;
245
- $[30] = t6;
246
- } else t6 = $[30];
247
- const commit = t6;
248
- const t7 = placeholder ?? (withTime ? "Select date and time" : "Select date");
249
- let t8;
250
- if ($[31] !== current || $[32] !== date || $[33] !== formatValue || $[34] !== withTime) {
251
- t8 = date && current ? formatValue?.(current) ?? formatDate(withTime ? current : date) : null;
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
- $[36] = current;
266
- $[37] = name;
267
- $[38] = t9;
268
- } else t9 = $[38];
269
- let t10;
270
- if ($[39] !== commit || $[40] !== setOpen || $[41] !== time || $[42] !== withTime) {
271
- t10 = (next_0) => {
272
- commit(withTime ? `${next_0}T${time}` : next_0);
273
- if (!withTime) setOpen(false);
274
- };
275
- $[39] = commit;
276
- $[40] = setOpen;
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 ($[46] !== max) {
289
- t12 = datePart(max) ?? void 0;
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
- onValueChange: t10,
298
- min: t11,
299
- max: t12,
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
- $[48] = date;
307
- $[49] = defaultMonth;
308
- $[50] = isDateDisabled;
309
- $[51] = labels;
310
- $[52] = locale;
311
- $[53] = t10;
312
- $[54] = t11;
313
- $[55] = t12;
314
- $[56] = weekStartsOn;
315
- $[57] = t13;
316
- } else t13 = $[57];
317
- let t14;
318
- if ($[58] !== commit || $[59] !== date || $[60] !== max || $[61] !== min || $[62] !== step || $[63] !== text || $[64] !== time) {
319
- t14 = time !== null && /* @__PURE__ */ jsx(TimeField, {
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(min) ?? void 0, datePart(max) ?? void 0)}T${next_1}`)
318
+ onChange: (next_1) => commit(`${date ?? withinBounds(todayIso(zone), datePart(lower) ?? void 0, datePart(upper) ?? void 0)}T${next_1}`)
324
319
  });
325
- $[58] = commit;
326
- $[59] = date;
327
- $[60] = max;
328
- $[61] = min;
329
- $[62] = step;
330
- $[63] = text;
331
- $[64] = time;
332
- $[65] = t14;
333
- } else t14 = $[65];
334
- let t15;
335
- if ($[66] !== isDateDisabled) {
336
- t15 = isDateDisabled?.(todayIso());
337
- $[66] = isDateDisabled;
338
- $[67] = t15;
339
- } else t15 = $[67];
340
- const t16 = Boolean(t15);
341
- let t17;
342
- if ($[68] !== commit || $[69] !== setOpen || $[70] !== time || $[71] !== withTime) {
343
- t17 = () => {
344
- const today = todayIso();
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
- $[68] = commit;
349
- $[69] = setOpen;
350
- $[70] = time;
351
- $[71] = withTime;
352
- $[72] = t17;
353
- } else t17 = $[72];
354
- let t18;
355
- if ($[73] !== t16 || $[74] !== t17 || $[75] !== text.today) {
356
- t18 = /* @__PURE__ */ jsx(Button, {
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: t16,
361
- onClick: t17,
359
+ disabled: t15,
360
+ onClick: t16,
362
361
  children: text.today
363
362
  });
364
- $[73] = t16;
365
- $[74] = t17;
366
- $[75] = text.today;
367
- $[76] = t18;
368
- } else t18 = $[76];
369
- let t19;
370
- if ($[77] !== clearable || $[78] !== commit || $[79] !== current || $[80] !== field || $[81] !== setOpen || $[82] !== text.clear) {
371
- t19 = (clearable ?? !field.required) && /* @__PURE__ */ jsx(Button, {
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
- $[77] = clearable;
383
- $[78] = commit;
384
- $[79] = current;
385
- $[80] = field;
386
- $[81] = setOpen;
387
- $[82] = text.clear;
388
- $[83] = t19;
389
- } else t19 = $[83];
390
- let t20;
391
- if ($[84] !== setOpen || $[85] !== text.done || $[86] !== withTime) {
392
- t20 = withTime && /* @__PURE__ */ jsx(Button, {
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
- $[84] = setOpen;
400
- $[85] = text.done;
401
- $[86] = withTime;
402
- $[87] = t20;
403
- } else t20 = $[87];
404
- let t21;
405
- if ($[88] !== t18 || $[89] !== t19 || $[90] !== t20) {
406
- t21 = /* @__PURE__ */ jsxs("div", {
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
- $[88] = t18;
415
- $[89] = t19;
416
- $[90] = t20;
417
- $[91] = t21;
418
- } else t21 = $[91];
419
- let t22;
420
- if ($[92] !== field || $[93] !== open || $[94] !== setOpen || $[95] !== t13 || $[96] !== t14 || $[97] !== t21 || $[98] !== t7 || $[99] !== t8 || $[100] !== t9) {
421
- t22 = /* @__PURE__ */ jsxs(PickerField, {
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: t7,
426
- display: t8,
427
- inputs: t9,
424
+ placeholder: t5,
425
+ display: t6,
426
+ inputs: t7,
428
427
  children: [
428
+ t12,
429
429
  t13,
430
- t14,
431
- t21
430
+ t20
432
431
  ]
433
432
  });
434
- $[92] = field;
435
- $[93] = open;
436
- $[94] = setOpen;
437
- $[95] = t13;
438
- $[96] = t14;
439
- $[97] = t21;
440
- $[98] = t7;
441
- $[99] = t8;
442
- $[100] = t9;
443
- $[101] = t22;
444
- } else t22 = $[101];
445
- return t22;
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. Values are ISO dates (`"2026-03-09"`),
449
- * the same format as `<input type="date">`, and are shown the same way.
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(props) {
452
- const $ = c(2);
453
- let t0;
454
- if ($[0] !== props) {
455
- t0 = /* @__PURE__ */ jsx(Picker, {
456
- mode: "date",
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
- $[0] = props;
460
- $[1] = t0;
461
- } else t0 = $[1];
462
- return t0;
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 local ISO date-times (`"2026-03-09T14:30"`),
466
- * the same format as `<input type="datetime-local">`, shown as `2026-03-09 14:30:00`
467
- * on a 24-hour clock whatever the locale.
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(props) {
470
- const $ = c(2);
471
- let t0;
472
- if ($[0] !== props) {
473
- t0 = /* @__PURE__ */ jsx(Picker, {
474
- mode: "datetime",
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
- $[0] = props;
478
- $[1] = t0;
479
- } else t0 = $[1];
480
- return t0;
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 };