@godxjp/ui 6.1.2 → 6.3.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 (90) hide show
  1. package/dist/app/index.js +4 -4
  2. package/dist/{checkbox-NkFkqsQ8.d.ts → checkbox-CNP1MnPn.d.ts} +1 -1
  3. package/dist/{chunk-TOO5AEKL.js → chunk-5DRKN2HI.js} +1 -1
  4. package/dist/{chunk-YFCQKO3B.js → chunk-6BJ2X7PA.js} +49 -12
  5. package/dist/{chunk-E7LTWRYF.js → chunk-7JN4JXK6.js} +1 -1
  6. package/dist/{chunk-7S7MYFXE.js → chunk-7W3CHMLL.js} +1 -1
  7. package/dist/{chunk-3F2AKYRD.js → chunk-EYLUVDHJ.js} +62 -19
  8. package/dist/{chunk-DU6ZYZRP.js → chunk-FKAXA6OI.js} +1 -1
  9. package/dist/{chunk-E4HJNQ62.js → chunk-FNZQTYAG.js} +2 -2
  10. package/dist/{chunk-7NZFVD24.js → chunk-GXHZAJUA.js} +22 -1
  11. package/dist/{chunk-WXCYI3YN.js → chunk-J6ZZVN6T.js} +58 -29
  12. package/dist/{chunk-RTRZZ2IZ.js → chunk-LFLHBTDK.js} +1 -1
  13. package/dist/{chunk-H2FHJOLU.js → chunk-MIVDO3Z3.js} +2 -2
  14. package/dist/chunk-PPXBEAAM.js +106 -0
  15. package/dist/{chunk-JEA3QDRW.js → chunk-PUY25RRT.js} +1 -1
  16. package/dist/{chunk-7LB5XDO7.js → chunk-QDAASTWZ.js} +1 -1
  17. package/dist/{chunk-XDYZ3X2E.js → chunk-R2B7XJ6A.js} +5 -2
  18. package/dist/{chunk-GDSVW62T.js → chunk-RGSH6FQN.js} +1 -1
  19. package/dist/{chunk-OXKQMFKV.js → chunk-TDTNDXWK.js} +3 -3
  20. package/dist/chunk-UCF25X5E.js +123 -0
  21. package/dist/{chunk-DABP4NQF.js → chunk-UGQ3HQD5.js} +1 -1
  22. package/dist/{chunk-LVNUHUEZ.js → chunk-WUXFOY6M.js} +2 -2
  23. package/dist/components/admin/index.d.ts +7 -7
  24. package/dist/components/admin/index.js +16 -16
  25. package/dist/components/data-display/card.d.ts +3 -1
  26. package/dist/components/data-display/card.js +1 -1
  27. package/dist/components/data-display/index.d.ts +4 -4
  28. package/dist/components/data-display/index.js +4 -4
  29. package/dist/components/data-entry/autocomplete.d.ts +2 -2
  30. package/dist/components/data-entry/autocomplete.js +3 -3
  31. package/dist/components/data-entry/calendar.d.ts +2 -2
  32. package/dist/components/data-entry/cascader.d.ts +2 -2
  33. package/dist/components/data-entry/cascader.js +3 -3
  34. package/dist/components/data-entry/checkbox.d.ts +3 -3
  35. package/dist/components/data-entry/color-picker.d.ts +2 -2
  36. package/dist/components/data-entry/color-picker.js +3 -3
  37. package/dist/components/data-entry/date-picker.d.ts +9 -3
  38. package/dist/components/data-entry/date-picker.js +4 -3
  39. package/dist/components/data-entry/date-range-picker.d.ts +8 -3
  40. package/dist/components/data-entry/date-range-picker.js +4 -3
  41. package/dist/components/data-entry/index.d.ts +5 -5
  42. package/dist/components/data-entry/index.js +13 -13
  43. package/dist/components/data-entry/radio.d.ts +2 -2
  44. package/dist/components/data-entry/slider.d.ts +2 -2
  45. package/dist/components/data-entry/switch.d.ts +2 -2
  46. package/dist/components/data-entry/time-picker.d.ts +8 -3
  47. package/dist/components/data-entry/time-picker.js +3 -3
  48. package/dist/components/data-entry/transfer.d.ts +3 -3
  49. package/dist/components/data-entry/transfer.js +3 -3
  50. package/dist/components/data-entry/tree-select.d.ts +2 -2
  51. package/dist/components/data-entry/tree-select.js +3 -3
  52. package/dist/components/data-entry/upload.d.ts +3 -3
  53. package/dist/components/data-entry/upload.js +5 -5
  54. package/dist/components/feedback/alert.js +4 -4
  55. package/dist/components/feedback/dialog.js +3 -3
  56. package/dist/components/feedback/index.js +5 -5
  57. package/dist/components/feedback/sheet.d.ts +1 -1
  58. package/dist/components/layout/index.js +1 -1
  59. package/dist/components/navigation/index.d.ts +3 -3
  60. package/dist/components/navigation/index.js +6 -6
  61. package/dist/components/navigation/pagination.d.ts +2 -2
  62. package/dist/components/navigation/pagination.js +3 -3
  63. package/dist/components/navigation/steps.d.ts +3 -3
  64. package/dist/components/navigation/tabs-items.d.ts +2 -2
  65. package/dist/components/query/index.js +5 -5
  66. package/dist/components/ui/index.d.ts +4 -4
  67. package/dist/components/ui/index.js +14 -14
  68. package/dist/{data-display.prop-DNTAzmDy.d.ts → data-display.prop-Cvi2Mrfw.d.ts} +1 -1
  69. package/dist/{data-entry.prop-BEGA1lTq.d.ts → data-entry.prop-I3mgmdGm.d.ts} +7 -1
  70. package/dist/{data-table-DiiZAD3v.d.ts → data-table-Pd62B4WQ.d.ts} +2 -2
  71. package/dist/{data.prop-BVvfKC_g.d.ts → data.prop-BmLaGLb7.d.ts} +1 -0
  72. package/dist/{filter-bar-B7OGFO9S.d.ts → filter-bar-XpspcQdZ.d.ts} +1 -1
  73. package/dist/i18n/index.d.ts +8 -3
  74. package/dist/i18n/index.js +2 -2
  75. package/dist/index.d.ts +7 -7
  76. package/dist/index.js +16 -16
  77. package/dist/lib/datetime/index.d.ts +5 -1
  78. package/dist/lib/datetime/index.js +1 -1
  79. package/dist/{navigation.prop-DpZqcXey.d.ts → navigation.prop-Ck5_gSfs.d.ts} +1 -1
  80. package/dist/props/components/index.d.ts +4 -4
  81. package/dist/props/index.d.ts +4 -4
  82. package/dist/props/vocabulary/index.d.ts +1 -1
  83. package/dist/{search-input-uP01rY1L.d.ts → search-input-JWJMFVqC.d.ts} +1 -1
  84. package/dist/styles/index.css +6 -0
  85. package/dist/styles/layout.css +0 -6
  86. package/dist/styles/shell-layout.css +23 -0
  87. package/dist/styles/table-layout.css +28 -0
  88. package/package.json +2 -1
  89. package/dist/chunk-DKO4OFVM.js +0 -66
  90. package/dist/chunk-KA563UHL.js +0 -70
package/dist/app/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { useAppContext } from '../chunk-3F2AKYRD.js';
2
- export { APP_LOCALES, APP_REQUEST_HEADER_LOCALE, APP_REQUEST_HEADER_TIMEZONE, APP_TIMEZONE_OPTIONS, APP_TIMEZONE_PRESET, APP_TIME_FORMAT_OPTIONS, AppProvider, DEFAULT_STORAGE_KEY, TIMEZONE_ALIASES, formatTimezoneDisplayLabel, getAllIanaTimezones, getAppRequestHeaders, getBrowserTimezone, getTimeFormatLabel, getTimezoneCityName, getTimezoneLabel, getTimezoneOffsetLabel, isKnownAppTimezone, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useOptionalAppContext, usePickerLocales, useTranslation, writeStoredPreferences } from '../chunk-3F2AKYRD.js';
3
- import { formatDate } from '../chunk-YFCQKO3B.js';
4
- export { APP_DATE_FORMATS, APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, APP_TIME_FORMATS, detectFormatDateKind, formatAppDate, formatAppDateLong, formatAppDateTime, formatAppRelative, formatAppTime, formatCalendarDate, formatDate, formatTimeOfDay, getDateFnsLocale, getDateFormatLabel, getDatePattern, getDateTimePattern, getDatetimeContext, getDayPickerLocale, getTimePattern, isAppDateFormat, isAppLocale, isAppTimeFormat, isFormatDateValue, isValidHhmm, normalizeHhmm, parseDateInput, resolveDefaultDateFormat, syncDatetimeContext } from '../chunk-YFCQKO3B.js';
1
+ import { useAppContext } from '../chunk-EYLUVDHJ.js';
2
+ export { APP_LOCALES, APP_REQUEST_HEADER_LOCALE, APP_REQUEST_HEADER_TIMEZONE, APP_TIMEZONE_OPTIONS, APP_TIMEZONE_PRESET, APP_TIME_FORMAT_OPTIONS, AppProvider, DEFAULT_STORAGE_KEY, TIMEZONE_ALIASES, formatTimezoneDisplayLabel, getAllIanaTimezones, getAppRequestHeaders, getBrowserTimezone, getTimeFormatLabel, getTimezoneCityName, getTimezoneLabel, getTimezoneOffsetLabel, isKnownAppTimezone, isValidIanaTimezone, readStoredPreferences, resetAppRequestHeaders, resetIanaTimezoneCacheForTests, resolveDefaultTimeFormat, resolveDefaultTimezone, resolveTimezoneForIntl, resolveTimezonePickerOptions, syncAppRequestHeaders, useAppContext, useAppDateFormat, useAppLocale, useAppTimeFormat, useAppTimezone, useOptionalAppContext, usePickerLocales, useTranslation, writeStoredPreferences } from '../chunk-EYLUVDHJ.js';
3
+ import { formatDate } from '../chunk-6BJ2X7PA.js';
4
+ export { APP_DATE_FORMATS, APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, APP_TIME_FORMATS, detectFormatDateKind, formatAppDate, formatAppDateLong, formatAppDateTime, formatAppRelative, formatAppTime, formatCalendarDate, formatDate, formatTimeOfDay, getDateFnsLocale, getDateFormatLabel, getDatePattern, getDateTimePattern, getDatetimeContext, getDayPickerLocale, getTimePattern, isAppDateFormat, isAppLocale, isAppTimeFormat, isFormatDateValue, isValidHhmm, normalizeHhmm, parseDateInput, resolveDefaultDateFormat, syncDatetimeContext } from '../chunk-6BJ2X7PA.js';
5
5
  import { useMemo } from 'react';
6
6
 
7
7
  function useFormatting() {
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { c as CheckboxGroupProp } from './data-entry.prop-BEGA1lTq.js';
4
+ import { c as CheckboxGroupProp } from './data-entry.prop-I3mgmdGm.js';
5
5
 
6
6
  declare function CheckboxGroup({ value: controlledValue, defaultValue, onChange, options, orientation, disabled, name, className, children, }: CheckboxGroupProp): react_jsx_runtime.JSX.Element;
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from './chunk-V6UWJKZF.js';
2
2
  import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
3
3
  import { Button } from './chunk-HJEBRCXL.js';
4
- import { useTranslation } from './chunk-3F2AKYRD.js';
4
+ import { useTranslation } from './chunk-EYLUVDHJ.js';
5
5
  import { cn } from './chunk-U7N2A7A3.js';
6
6
  import * as React from 'react';
7
7
  import { ChevronsUpDown, Check } from 'lucide-react';
@@ -69,16 +69,21 @@ var en_default = {
69
69
  },
70
70
  dataEntry: {
71
71
  datePicker: {
72
- placeholder: "Select date"
72
+ placeholder: "Select date",
73
+ openCalendar: "Open calendar"
73
74
  },
74
75
  dateRangePicker: {
75
- placeholder: "Select date range"
76
+ placeholder: "Select date range",
77
+ from: "From",
78
+ to: "To",
79
+ openCalendar: "Open calendar"
76
80
  },
77
81
  timePicker: {
78
82
  placeholder: "Select time",
79
83
  hour: "Hour",
80
84
  minute: "Minute",
81
- typeLabel: "Type time HH:mm"
85
+ typeLabel: "Type time HH:mm",
86
+ openPicker: "Open time picker"
82
87
  },
83
88
  searchInput: {
84
89
  placeholder: "Search\u2026"
@@ -242,16 +247,21 @@ var ja_default = {
242
247
  },
243
248
  dataEntry: {
244
249
  datePicker: {
245
- placeholder: "\u65E5\u4ED8\u3092\u9078\u629E"
250
+ placeholder: "\u65E5\u4ED8\u3092\u9078\u629E",
251
+ openCalendar: "\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u958B\u304F"
246
252
  },
247
253
  dateRangePicker: {
248
- placeholder: "\u671F\u9593\u3092\u9078\u629E"
254
+ placeholder: "\u671F\u9593\u3092\u9078\u629E",
255
+ from: "\u958B\u59CB",
256
+ to: "\u7D42\u4E86",
257
+ openCalendar: "\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u958B\u304F"
249
258
  },
250
259
  timePicker: {
251
260
  placeholder: "\u6642\u523B\u3092\u9078\u629E",
252
261
  hour: "\u6642",
253
262
  minute: "\u5206",
254
- typeLabel: "HH:mm \u3092\u5165\u529B"
263
+ typeLabel: "HH:mm \u3092\u5165\u529B",
264
+ openPicker: "\u6642\u523B\u3092\u9078\u629E"
255
265
  },
256
266
  searchInput: {
257
267
  placeholder: "\u691C\u7D22\u2026"
@@ -415,16 +425,21 @@ var vi_default = {
415
425
  },
416
426
  dataEntry: {
417
427
  datePicker: {
418
- placeholder: "Ch\u1ECDn ng\xE0y"
428
+ placeholder: "Ch\u1ECDn ng\xE0y",
429
+ openCalendar: "M\u1EDF l\u1ECBch"
419
430
  },
420
431
  dateRangePicker: {
421
- placeholder: "Ch\u1ECDn kho\u1EA3ng ng\xE0y"
432
+ placeholder: "Ch\u1ECDn kho\u1EA3ng ng\xE0y",
433
+ from: "T\u1EEB",
434
+ to: "\u0110\u1EBFn",
435
+ openCalendar: "M\u1EDF l\u1ECBch"
422
436
  },
423
437
  timePicker: {
424
438
  placeholder: "Ch\u1ECDn gi\u1EDD",
425
439
  hour: "Gi\u1EDD",
426
440
  minute: "Ph\xFAt",
427
- typeLabel: "Nh\u1EADp gi\u1EDD HH:mm"
441
+ typeLabel: "Nh\u1EADp gi\u1EDD HH:mm",
442
+ openPicker: "M\u1EDF ch\u1ECDn gi\u1EDD"
428
443
  },
429
444
  searchInput: {
430
445
  placeholder: "T\xECm ki\u1EBFm\u2026"
@@ -638,6 +653,7 @@ var defaultContext = () => ({
638
653
  dateFormat: resolveDefaultDateFormat(DEFAULT_LOCALE)
639
654
  });
640
655
  var syncedContext = defaultContext();
656
+ var liveRelativeFormattingEnabled = true;
641
657
  function syncDatetimeContext(partial) {
642
658
  syncedContext = {
643
659
  locale: partial.locale,
@@ -650,8 +666,18 @@ function syncDatetimeContext(partial) {
650
666
  function getDatetimeContext() {
651
667
  return syncedContext;
652
668
  }
669
+ function enableLiveRelativeFormatting() {
670
+ liveRelativeFormattingEnabled = true;
671
+ }
672
+ function disableLiveRelativeFormatting() {
673
+ liveRelativeFormattingEnabled = false;
674
+ }
675
+ function canUseLiveRelativeFormatting() {
676
+ return liveRelativeFormattingEnabled;
677
+ }
653
678
  function resetDatetimeContextForTests() {
654
679
  syncedContext = defaultContext();
680
+ liveRelativeFormattingEnabled = true;
655
681
  }
656
682
 
657
683
  // src/lib/datetime/detect.ts
@@ -668,6 +694,13 @@ function isDateOnlyString(value) {
668
694
  }
669
695
 
670
696
  // src/lib/datetime/parse.ts
697
+ function toIsoDate(value) {
698
+ if (value == null || Number.isNaN(value.getTime())) return "";
699
+ const year = String(value.getFullYear()).padStart(4, "0");
700
+ const month = String(value.getMonth() + 1).padStart(2, "0");
701
+ const day = String(value.getDate()).padStart(2, "0");
702
+ return `${year}-${month}-${day}`;
703
+ }
671
704
  function parseDateInput(value) {
672
705
  if (value == null) return null;
673
706
  if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;
@@ -791,6 +824,10 @@ function resolveKind(value, options) {
791
824
  if (options?.calendar && value instanceof Date) return "calendar";
792
825
  return detectFormatDateKind(value);
793
826
  }
827
+ function formatInitialRelative(value, options) {
828
+ if (canUseLiveRelativeFormatting()) return formatAppRelative(value, options);
829
+ return formatAppDateTime(value, options);
830
+ }
794
831
  function formatDate(value, options) {
795
832
  if (value == null || value === "") return EMPTY2;
796
833
  if (typeof value === "string") {
@@ -805,7 +842,7 @@ function formatDate(value, options) {
805
842
  case "long":
806
843
  return formatAppDateLong(trimmed, options);
807
844
  case "relative":
808
- return formatAppRelative(trimmed, options);
845
+ return formatInitialRelative(trimmed, options);
809
846
  case "calendar":
810
847
  case "datetime":
811
848
  default:
@@ -824,7 +861,7 @@ function formatDate(value, options) {
824
861
  case "long":
825
862
  return formatAppDateLong(value, options);
826
863
  case "relative":
827
- return formatAppRelative(value, options);
864
+ return formatInitialRelative(value, options);
828
865
  case "datetime":
829
866
  default:
830
867
  return formatAppDateTime(value, options);
@@ -839,4 +876,4 @@ function isFormatDateValue(value) {
839
876
  return parseDateInput(trimmed) != null;
840
877
  }
841
878
 
842
- export { APP_DATE_FORMATS, APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, APP_TIME_FORMATS, MESSAGE_CATALOG, calendarDateToTZDate, detectFormatDateKind, formatAppDate, formatAppDateLong, formatAppDateTime, formatAppRelative, formatAppTime, formatCalendarDate, formatDate, formatTimeOfDay, getDateFnsLocale, getDateFormatLabel, getDatePattern, getDateTimePattern, getDatetimeContext, getDayPickerLocale, getTimePattern, hhmmToTZDate, isAppDateFormat, isAppLocale, isAppTimeFormat, isDateOnlyString, isFormatDateValue, isValidHhmm, normalizeHhmm, parseDateInput, resetDatetimeContextForTests, resetI18nLocale, resolveDefaultDateFormat, syncDatetimeContext, syncI18nLocale, translate, translateCurrent };
879
+ export { APP_DATE_FORMATS, APP_DATE_FORMAT_OPTIONS, APP_LOCALE_CONFIG, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, APP_TIME_FORMATS, MESSAGE_CATALOG, calendarDateToTZDate, detectFormatDateKind, disableLiveRelativeFormatting, enableLiveRelativeFormatting, formatAppDate, formatAppDateLong, formatAppDateTime, formatAppRelative, formatAppTime, formatCalendarDate, formatDate, formatTimeOfDay, getDateFnsLocale, getDateFormatLabel, getDatePattern, getDateTimePattern, getDatetimeContext, getDayPickerLocale, getTimePattern, hhmmToTZDate, isAppDateFormat, isAppLocale, isAppTimeFormat, isDateOnlyString, isFormatDateValue, isValidHhmm, normalizeHhmm, parseDateInput, resetDatetimeContextForTests, resetI18nLocale, resolveDefaultDateFormat, syncDatetimeContext, syncI18nLocale, toIsoDate, translate, translateCurrent };
@@ -286,7 +286,7 @@ function Breadcrumb({ items }) {
286
286
  ] }, item.to ?? index);
287
287
  }) }) });
288
288
  }
289
- function ResponsiveGrid({ columns = 3, children }) {
289
+ function ResponsiveGrid({ columns = 4, children }) {
290
290
  return /* @__PURE__ */ jsx("div", { className: "ui-responsive-grid", "data-columns": columns, children });
291
291
  }
292
292
  function SplitPane({ children, aside, asideWidth = "md" }) {
@@ -1,4 +1,4 @@
1
- import { formatDate, translateCurrent } from './chunk-YFCQKO3B.js';
1
+ import { formatDate, translateCurrent } from './chunk-6BJ2X7PA.js';
2
2
 
3
3
  // src/lib/format.ts
4
4
  function formatDateTime(value, options) {
@@ -1,4 +1,4 @@
1
- import { APP_TIME_FORMATS, isAppDateFormat, isAppTimeFormat, isAppLocale, translate, syncI18nLocale, syncDatetimeContext, getDateFnsLocale, getDayPickerLocale, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, resolveDefaultDateFormat } from './chunk-YFCQKO3B.js';
1
+ import { APP_TIME_FORMATS, isAppDateFormat, isAppTimeFormat, isAppLocale, translate, getDateFnsLocale, syncI18nLocale, syncDatetimeContext, disableLiveRelativeFormatting, enableLiveRelativeFormatting, getDayPickerLocale, APP_REQUEST_HEADER_DATE_FORMAT, APP_REQUEST_HEADER_TIME_FORMAT, resolveDefaultDateFormat } from './chunk-6BJ2X7PA.js';
2
2
  import * as React from 'react';
3
3
  import { useMemo } from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
@@ -230,6 +230,10 @@ function buildRequestHeaders(locale, timezone, timeFormat, dateFormat) {
230
230
  [APP_REQUEST_HEADER_DATE_FORMAT]: dateFormat
231
231
  };
232
232
  }
233
+ function resolveHydrationSafeTimezone(defaultTimezone, systemTimezone) {
234
+ if (defaultTimezone === "browser") return systemTimezone ?? "UTC";
235
+ return resolveDefaultTimezone(defaultTimezone, systemTimezone);
236
+ }
233
237
  function AppProvider({
234
238
  children,
235
239
  defaultLocale = "vi",
@@ -246,22 +250,52 @@ function AppProvider({
246
250
  onTimeFormatChange,
247
251
  onDateFormatChange
248
252
  }) {
249
- const stored = React.useMemo(
250
- () => persist ? readStoredPreferences(storageKey) : {},
251
- [persist, storageKey]
252
- );
253
- const initialLocale = stored.locale ?? defaultLocale;
253
+ const initialLocale = defaultLocale;
254
254
  const [locale, setLocaleState] = React.useState(initialLocale);
255
255
  const [timezone, setTimezoneState] = React.useState(
256
- stored.timezone ?? resolveDefaultTimezone(defaultTimezone, systemTimezone)
256
+ resolveHydrationSafeTimezone(defaultTimezone, systemTimezone)
257
257
  );
258
258
  const [timeFormat, setTimeFormatState] = React.useState(
259
- () => resolveInitialTimeFormat(stored.timeFormat, defaultTimeFormat, initialLocale)
259
+ () => resolveInitialTimeFormat(void 0, defaultTimeFormat, initialLocale)
260
260
  );
261
261
  const [dateFormat, setDateFormatState] = React.useState(
262
- () => resolveInitialDateFormat(stored.dateFormat, defaultDateFormat, initialLocale)
262
+ () => resolveInitialDateFormat(void 0, defaultDateFormat, initialLocale)
263
263
  );
264
+ const hasMountedRef = React.useRef(false);
264
265
  const prefsRef = React.useRef({ locale, timezone, timeFormat, dateFormat });
266
+ React.useEffect(() => {
267
+ const stored = persist ? readStoredPreferences(storageKey) : {};
268
+ const nextLocale = stored.locale ?? defaultLocale;
269
+ const nextTimezone = stored.timezone ?? resolveDefaultTimezone(defaultTimezone, systemTimezone);
270
+ const nextTimeFormat = resolveInitialTimeFormat(
271
+ stored.timeFormat,
272
+ defaultTimeFormat,
273
+ nextLocale
274
+ );
275
+ const nextDateFormat = resolveInitialDateFormat(
276
+ stored.dateFormat,
277
+ defaultDateFormat,
278
+ nextLocale
279
+ );
280
+ prefsRef.current = {
281
+ locale: nextLocale,
282
+ timezone: nextTimezone,
283
+ timeFormat: nextTimeFormat,
284
+ dateFormat: nextDateFormat
285
+ };
286
+ setLocaleState(nextLocale);
287
+ setTimezoneState(nextTimezone);
288
+ setTimeFormatState(nextTimeFormat);
289
+ setDateFormatState(nextDateFormat);
290
+ }, [
291
+ defaultDateFormat,
292
+ defaultLocale,
293
+ defaultTimeFormat,
294
+ defaultTimezone,
295
+ persist,
296
+ storageKey,
297
+ systemTimezone
298
+ ]);
265
299
  React.useEffect(() => {
266
300
  prefsRef.current = { locale, timezone, timeFormat, dateFormat };
267
301
  }, [locale, timezone, timeFormat, dateFormat]);
@@ -305,17 +339,25 @@ function AppProvider({
305
339
  () => buildRequestHeaders(locale, timezone, timeFormat, dateFormat),
306
340
  [locale, timezone, timeFormat, dateFormat]
307
341
  );
342
+ const dateFnsLocale = getDateFnsLocale(locale);
343
+ syncI18nLocale(locale, fallbackLocale);
344
+ syncDatetimeContext({
345
+ locale,
346
+ timezone,
347
+ timeFormat,
348
+ dateFormat,
349
+ dateFnsLocale
350
+ });
351
+ if (!hasMountedRef.current) {
352
+ disableLiveRelativeFormatting();
353
+ }
308
354
  React.useEffect(() => {
309
355
  syncAppRequestHeaders(requestHeaders);
310
- syncI18nLocale(locale, fallbackLocale);
311
- syncDatetimeContext({
312
- locale,
313
- timezone,
314
- timeFormat,
315
- dateFormat,
316
- dateFnsLocale: getDateFnsLocale(locale)
317
- });
318
- }, [requestHeaders, locale, fallbackLocale, timezone, timeFormat, dateFormat]);
356
+ }, [requestHeaders]);
357
+ React.useEffect(() => {
358
+ hasMountedRef.current = true;
359
+ enableLiveRelativeFormatting();
360
+ }, []);
319
361
  const value = React.useMemo(
320
362
  () => ({
321
363
  locale,
@@ -323,7 +365,7 @@ function AppProvider({
323
365
  timezone,
324
366
  timeFormat,
325
367
  dateFormat,
326
- dateFnsLocale: getDateFnsLocale(locale),
368
+ dateFnsLocale,
327
369
  dayPickerLocale: getDayPickerLocale(locale),
328
370
  requestHeaders,
329
371
  timezoneOptions,
@@ -338,6 +380,7 @@ function AppProvider({
338
380
  timezone,
339
381
  timeFormat,
340
382
  dateFormat,
383
+ dateFnsLocale,
341
384
  requestHeaders,
342
385
  timezoneOptions,
343
386
  setLocale,
@@ -1,7 +1,7 @@
1
1
  import { Input } from './chunk-VOHTRR5X.js';
2
2
  import { buttonVariants, Button } from './chunk-HJEBRCXL.js';
3
3
  import { Label } from './chunk-7PWBC4BY.js';
4
- import { useTranslation } from './chunk-3F2AKYRD.js';
4
+ import { useTranslation } from './chunk-EYLUVDHJ.js';
5
5
  import { cn } from './chunk-U7N2A7A3.js';
6
6
  import * as React from 'react';
7
7
  import * as DialogPrimitive from '@radix-ui/react-dialog';
@@ -1,7 +1,7 @@
1
- import { humanError } from './chunk-7S7MYFXE.js';
1
+ import { humanError } from './chunk-7W3CHMLL.js';
2
2
  import { Inline } from './chunk-S66TJXJU.js';
3
3
  import { Button } from './chunk-HJEBRCXL.js';
4
- import { useTranslation } from './chunk-3F2AKYRD.js';
4
+ import { useTranslation } from './chunk-EYLUVDHJ.js';
5
5
  import { cn } from './chunk-U7N2A7A3.js';
6
6
  import * as React from 'react';
7
7
  import { CheckCircle2, TriangleAlert, AlertCircle, Info, X, RefreshCw } from 'lucide-react';
@@ -78,6 +78,14 @@ var CardFooter = React.forwardRef(
78
78
  )
79
79
  );
80
80
  CardFooter.displayName = "CardFooter";
81
+ function getDeltaTone(delta, inverse) {
82
+ const text = typeof delta === "string" || typeof delta === "number" ? String(delta).trim() : "";
83
+ const sign = text.match(/^[+\-−]/)?.[0];
84
+ if (!sign) return void 0;
85
+ const isPositive = sign === "+";
86
+ const semanticPositive = inverse ? !isPositive : isPositive;
87
+ return semanticPositive ? "positive" : "negative";
88
+ }
81
89
  function CardStat({
82
90
  label,
83
91
  value,
@@ -85,10 +93,12 @@ function CardStat({
85
93
  delta,
86
94
  layout = "stacked",
87
95
  align = "start",
96
+ inverse = false,
88
97
  className,
89
98
  size = "compact",
90
99
  ...props
91
100
  }) {
101
+ const deltaTone = getDeltaTone(delta, inverse);
92
102
  return /* @__PURE__ */ jsxs(
93
103
  Card,
94
104
  {
@@ -106,7 +116,18 @@ function CardStat({
106
116
  /* @__PURE__ */ jsxs("div", { children: [
107
117
  /* @__PURE__ */ jsxs("div", { "data-slot": "card-stat-value-row", children: [
108
118
  /* @__PURE__ */ jsx("span", { "data-slot": "card-stat-value", children: value }),
109
- delta ? /* @__PURE__ */ jsx("span", { "data-slot": "card-stat-delta", children: delta }) : null
119
+ delta ? /* @__PURE__ */ jsx(
120
+ "span",
121
+ {
122
+ "data-slot": "card-stat-delta",
123
+ "data-delta-tone": deltaTone,
124
+ className: cn(
125
+ deltaTone === "positive" && "text-success",
126
+ deltaTone === "negative" && "text-destructive"
127
+ ),
128
+ children: delta
129
+ }
130
+ ) : null
110
131
  ] }),
111
132
  hint && layout !== "inline" ? /* @__PURE__ */ jsx("div", { "data-slot": "card-stat-hint", children: hint }) : null
112
133
  ] })
@@ -1,8 +1,8 @@
1
1
  import { Input } from './chunk-VOHTRR5X.js';
2
2
  import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
3
3
  import { Button } from './chunk-HJEBRCXL.js';
4
- import { useTranslation } from './chunk-3F2AKYRD.js';
5
- import { isValidHhmm, formatTimeOfDay, normalizeHhmm } from './chunk-YFCQKO3B.js';
4
+ import { useTranslation } from './chunk-EYLUVDHJ.js';
5
+ import { normalizeHhmm, isValidHhmm } from './chunk-6BJ2X7PA.js';
6
6
  import { cn } from './chunk-U7N2A7A3.js';
7
7
  import * as React from 'react';
8
8
  import { Clock } from 'lucide-react';
@@ -138,6 +138,7 @@ function TimePicker({
138
138
  disabled,
139
139
  className,
140
140
  id,
141
+ name,
141
142
  minuteStep = 5
142
143
  }) {
143
144
  const { t } = useTranslation();
@@ -145,42 +146,70 @@ function TimePicker({
145
146
  const [internal, setInternal] = React.useState(defaultValue ?? "");
146
147
  const isControlled = controlledValue !== void 0;
147
148
  const value = isControlled ? controlledValue : internal;
148
- const resolvedPlaceholder = placeholder ?? t("dataEntry.timePicker.placeholder");
149
+ const resolvedPlaceholder = placeholder ?? t("dataEntry.timePicker.placeholder") ?? "hh:mm";
150
+ const [text, setText] = React.useState(value);
151
+ React.useEffect(() => {
152
+ setText(value);
153
+ }, [value]);
149
154
  const setValue = (next) => {
150
155
  if (!isControlled) setInternal(next);
151
156
  onChange?.(next);
152
157
  };
153
- const display = value && isValidHhmm(value) ? formatTimeOfDay(value) : value || null;
154
- return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
155
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
156
- Button,
158
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
159
+ /* @__PURE__ */ jsx(
160
+ Input,
157
161
  {
158
162
  id,
159
- type: "button",
160
- variant: "outline",
163
+ name,
164
+ value: text,
161
165
  disabled,
162
- className: cn(
163
- "w-full justify-start text-left font-normal tabular-nums",
164
- !display && "text-muted-foreground",
165
- className
166
- ),
167
- children: [
168
- /* @__PURE__ */ jsx(Clock, { className: "mr-2 size-4 shrink-0", "aria-hidden": "true" }),
169
- display ?? resolvedPlaceholder
170
- ]
171
- }
172
- ) }),
173
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
174
- TimePickerPanel,
175
- {
176
- value: value || "09:00",
177
- minuteStep,
178
- onChange: setValue,
179
- onDone: () => {
180
- setOpen(false);
166
+ placeholder: resolvedPlaceholder,
167
+ inputMode: "numeric",
168
+ autoComplete: "off",
169
+ role: "combobox",
170
+ "aria-expanded": open,
171
+ "aria-haspopup": "dialog",
172
+ className: "pr-10 tabular-nums",
173
+ onChange: (event) => {
174
+ setText(event.target.value);
175
+ const normalized = normalizeHhmm(event.target.value);
176
+ if (normalized) setValue(normalized);
177
+ },
178
+ onBlur: (event) => {
179
+ const normalized = normalizeHhmm(event.target.value);
180
+ setText(normalized ?? (isValidHhmm(value) ? value : ""));
181
181
  }
182
182
  }
183
- ) })
183
+ ),
184
+ /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
185
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
186
+ Button,
187
+ {
188
+ type: "button",
189
+ variant: "ghost",
190
+ size: "icon",
191
+ disabled,
192
+ tabIndex: -1,
193
+ "aria-label": t("dataEntry.timePicker.openPicker") ?? "Open time picker",
194
+ className: "text-muted-foreground absolute inset-y-0 right-0 h-full px-2 hover:bg-transparent",
195
+ children: /* @__PURE__ */ jsx(Clock, { className: "size-4 shrink-0", "aria-hidden": "true" })
196
+ }
197
+ ) }),
198
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "end", children: /* @__PURE__ */ jsx(
199
+ TimePickerPanel,
200
+ {
201
+ value: value || "09:00",
202
+ minuteStep,
203
+ onChange: (next) => {
204
+ setValue(next);
205
+ setText(next);
206
+ },
207
+ onDone: () => {
208
+ setOpen(false);
209
+ }
210
+ }
211
+ ) })
212
+ ] })
184
213
  ] });
185
214
  }
186
215
 
@@ -4,7 +4,7 @@ import { Input } from './chunk-VOHTRR5X.js';
4
4
  import { ScrollArea } from './chunk-3KPEZ5CF.js';
5
5
  import { Button } from './chunk-HJEBRCXL.js';
6
6
  import { Label } from './chunk-7PWBC4BY.js';
7
- import { useTranslation } from './chunk-3F2AKYRD.js';
7
+ import { useTranslation } from './chunk-EYLUVDHJ.js';
8
8
  import { cn } from './chunk-U7N2A7A3.js';
9
9
  import * as React from 'react';
10
10
  import { useState, useEffect } from 'react';
@@ -1,7 +1,7 @@
1
1
  import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-UX634MYF.js';
2
2
  import { Button } from './chunk-HJEBRCXL.js';
3
- import { useTranslation, useOptionalAppContext, APP_LOCALES, resolveTimezonePickerOptions, getTimezoneLabel, APP_TIME_FORMAT_OPTIONS, getTimeFormatLabel } from './chunk-3F2AKYRD.js';
4
- import { APP_DATE_FORMAT_OPTIONS, getDateFormatLabel } from './chunk-YFCQKO3B.js';
3
+ import { useTranslation, useOptionalAppContext, APP_LOCALES, resolveTimezonePickerOptions, getTimezoneLabel, APP_TIME_FORMAT_OPTIONS, getTimeFormatLabel } from './chunk-EYLUVDHJ.js';
4
+ import { APP_DATE_FORMAT_OPTIONS, getDateFormatLabel } from './chunk-6BJ2X7PA.js';
5
5
  import { cn } from './chunk-U7N2A7A3.js';
6
6
  import { X, ChevronRight, Languages, Globe, Clock, CalendarDays } from 'lucide-react';
7
7
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -0,0 +1,106 @@
1
+ import { Calendar } from './chunk-I2V4Y2VF.js';
2
+ import { Input } from './chunk-VOHTRR5X.js';
3
+ import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
4
+ import { Button } from './chunk-HJEBRCXL.js';
5
+ import { useTranslation, usePickerLocales } from './chunk-EYLUVDHJ.js';
6
+ import { toIsoDate, parseDateInput } from './chunk-6BJ2X7PA.js';
7
+ import { cn } from './chunk-U7N2A7A3.js';
8
+ import * as React from 'react';
9
+ import { CalendarIcon } from 'lucide-react';
10
+ import { jsxs, jsx } from 'react/jsx-runtime';
11
+
12
+ var ISO_HINT = "yyyy-mm-dd";
13
+ function DatePicker({
14
+ value,
15
+ onChange,
16
+ placeholder,
17
+ disabled,
18
+ className,
19
+ id,
20
+ name,
21
+ locale: localeProp,
22
+ fromDate,
23
+ toDate
24
+ }) {
25
+ const { t } = useTranslation();
26
+ const { dayPickerLocale } = usePickerLocales(localeProp);
27
+ const [open, setOpen] = React.useState(false);
28
+ const [text, setText] = React.useState(() => toIsoDate(value));
29
+ React.useEffect(() => {
30
+ setText(toIsoDate(value));
31
+ }, [value]);
32
+ const resolvedPlaceholder = placeholder ?? t("dataEntry.datePicker.placeholder") ?? ISO_HINT;
33
+ const commit = (raw) => {
34
+ const trimmed = raw.trim();
35
+ if (trimmed === "") {
36
+ onChange?.(void 0);
37
+ return;
38
+ }
39
+ const parsed = parseDateInput(trimmed);
40
+ if (parsed) {
41
+ onChange?.(parsed);
42
+ }
43
+ };
44
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
45
+ /* @__PURE__ */ jsx(
46
+ Input,
47
+ {
48
+ id,
49
+ name,
50
+ value: text,
51
+ disabled,
52
+ placeholder: resolvedPlaceholder,
53
+ inputMode: "numeric",
54
+ autoComplete: "off",
55
+ role: "combobox",
56
+ "aria-expanded": open,
57
+ "aria-haspopup": "dialog",
58
+ className: "pr-10",
59
+ onChange: (event) => {
60
+ setText(event.target.value);
61
+ commit(event.target.value);
62
+ },
63
+ onBlur: (event) => {
64
+ const parsed = parseDateInput(event.target.value.trim());
65
+ setText(parsed ? toIsoDate(parsed) : toIsoDate(value));
66
+ }
67
+ }
68
+ ),
69
+ /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
70
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
71
+ Button,
72
+ {
73
+ type: "button",
74
+ variant: "ghost",
75
+ size: "icon",
76
+ disabled,
77
+ tabIndex: -1,
78
+ "aria-label": t("dataEntry.datePicker.openCalendar") ?? "Open calendar",
79
+ className: "text-muted-foreground absolute inset-y-0 right-0 h-full px-2 hover:bg-transparent",
80
+ children: /* @__PURE__ */ jsx(CalendarIcon, { className: "size-4 shrink-0", "aria-hidden": "true" })
81
+ }
82
+ ) }),
83
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "end", children: /* @__PURE__ */ jsx(
84
+ Calendar,
85
+ {
86
+ mode: "single",
87
+ selected: value,
88
+ onSelect: (date) => {
89
+ onChange?.(date);
90
+ setText(toIsoDate(date));
91
+ setOpen(false);
92
+ },
93
+ locale: dayPickerLocale,
94
+ disabled: [
95
+ ...fromDate ? [{ before: fromDate }] : [],
96
+ ...toDate ? [{ after: toDate }] : []
97
+ ],
98
+ startMonth: fromDate,
99
+ endMonth: toDate
100
+ }
101
+ ) })
102
+ ] })
103
+ ] });
104
+ }
105
+
106
+ export { DatePicker };
@@ -1,6 +1,6 @@
1
1
  import { Input } from './chunk-VOHTRR5X.js';
2
2
  import { controlIconClass } from './chunk-ICM6XBST.js';
3
- import { useTranslation } from './chunk-3F2AKYRD.js';
3
+ import { useTranslation } from './chunk-EYLUVDHJ.js';
4
4
  import { cn } from './chunk-U7N2A7A3.js';
5
5
  import * as React from 'react';
6
6
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -4,7 +4,7 @@ import { ScrollArea, ScrollBar } from './chunk-3KPEZ5CF.js';
4
4
  import { Command, CommandInput } from './chunk-V6UWJKZF.js';
5
5
  import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
6
6
  import { Button } from './chunk-HJEBRCXL.js';
7
- import { useTranslation } from './chunk-3F2AKYRD.js';
7
+ import { useTranslation } from './chunk-EYLUVDHJ.js';
8
8
  import { cn } from './chunk-U7N2A7A3.js';
9
9
  import * as React from 'react';
10
10
  import { X, ChevronsUpDown, Check, ChevronRight } from 'lucide-react';