@helpwave/hightide 0.8.0 → 0.8.2

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/dist/index.js CHANGED
@@ -6967,9 +6967,7 @@ __export(index_exports, {
6967
6967
  VerticalDivider: () => VerticalDivider,
6968
6968
  Visibility: () => Visibility,
6969
6969
  YearMonthPicker: () => YearMonthPicker,
6970
- addDuration: () => addDuration,
6971
6970
  builder: () => builder,
6972
- changeDuration: () => changeDuration,
6973
6971
  closestMatch: () => closestMatch,
6974
6972
  createLoopingList: () => createLoopingList,
6975
6973
  createLoopingListWithIndex: () => createLoopingListWithIndex,
@@ -6982,21 +6980,15 @@ __export(index_exports, {
6982
6980
  filterTags: () => filterTags,
6983
6981
  filterTagsSingle: () => filterTagsSingle,
6984
6982
  filterText: () => filterText,
6985
- formatDate: () => formatDate,
6986
- formatDateTime: () => formatDateTime,
6987
- getBetweenDuration: () => getBetweenDuration,
6988
6983
  getNeighbours: () => getNeighbours,
6989
- getWeeksForCalenderMonth: () => getWeeksForCalenderMonth,
6990
6984
  hightideTranslation: () => hightideTranslation,
6991
6985
  hightideTranslationLocales: () => hightideTranslationLocales,
6992
- isInTimeSpan: () => isInTimeSpan,
6993
6986
  isTableFilterCategory: () => isTableFilterCategory,
6994
6987
  match: () => match,
6995
6988
  mergeProps: () => mergeProps,
6996
6989
  noop: () => noop,
6997
6990
  range: () => range,
6998
6991
  resolveSetState: () => resolveSetState,
6999
- subtractDuration: () => subtractDuration,
7000
6992
  toSizeVars: () => toSizeVars,
7001
6993
  useAnchoredPosition: () => useAnchoredPosition,
7002
6994
  useControlledState: () => useControlledState,
@@ -7042,6 +7034,7 @@ __export(index_exports, {
7042
7034
  useTooltip: () => useTooltip,
7043
7035
  useTransitionState: () => useTransitionState,
7044
7036
  useTranslatedValidators: () => useTranslatedValidators,
7037
+ useUpdatingDateTime: () => useUpdatingDateTime,
7045
7038
  useWindowResizeObserver: () => useWindowResizeObserver,
7046
7039
  validateEmail: () => validateEmail,
7047
7040
  writeToClipboard: () => writeToClipboard
@@ -10378,28 +10371,34 @@ function resolveSetState(action, prev) {
10378
10371
 
10379
10372
  // src/hooks/useControlledState.ts
10380
10373
  var useControlledState = ({
10381
- value,
10374
+ value: controlledValue,
10382
10375
  onValueChange,
10383
10376
  defaultValue,
10384
10377
  isControlled: isEnforcingControlled
10385
10378
  }) => {
10386
- const [internalValue, setInternalValue] = (0, import_react26.useState)(defaultValue);
10387
- const [isControlled] = (0, import_react26.useState)(isEnforcingControlled || value !== void 0);
10379
+ const [internalValue, setInternalValue] = (0, import_react26.useState)(() => defaultValue);
10380
+ const [isControlled] = (0, import_react26.useState)(isEnforcingControlled || controlledValue !== void 0);
10388
10381
  const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
10389
10382
  useLogOnce(
10390
10383
  "useControlledState: Attempted to change from controlled to uncontrolled or vice versa.For a controlled state: isControlled === true OR value !== undefinedFor an uncontrolled state: isControlled === false OR value === undefined",
10391
- isControlled !== (isEnforcingControlled || value !== void 0),
10384
+ isControlled !== (isEnforcingControlled || controlledValue !== void 0),
10392
10385
  { type: "error" }
10393
10386
  );
10394
- if (isControlled) {
10395
- return [value, onValueChangeStable];
10396
- }
10397
- const onChangeWrapper = (action) => {
10398
- const resolved = resolveSetState(action, internalValue);
10399
- setInternalValue(resolved);
10387
+ const lastValue = (0, import_react26.useRef)(isControlled ? controlledValue : internalValue);
10388
+ (0, import_react26.useEffect)(() => {
10389
+ lastValue.current = isControlled ? controlledValue : internalValue;
10390
+ }, [isControlled, controlledValue, internalValue]);
10391
+ const setState = (0, import_react26.useCallback)((action) => {
10392
+ const resolved = resolveSetState(action, lastValue.current);
10393
+ if (resolved === lastValue.current) return;
10394
+ if (!isControlled) {
10395
+ lastValue.current = resolved;
10396
+ setInternalValue(resolved);
10397
+ }
10400
10398
  onValueChangeStable(resolved);
10401
- };
10402
- return [internalValue, onChangeWrapper];
10399
+ }, [onValueChangeStable, isControlled]);
10400
+ const value = isControlled ? controlledValue : internalValue;
10401
+ return [value, setState];
10403
10402
  };
10404
10403
 
10405
10404
  // src/components/layout/Expandable.tsx
@@ -14572,7 +14571,7 @@ var TableBody = import_react63.default.memo(function TableBodyVisual() {
14572
14571
 
14573
14572
  // src/components/layout/table/TableHeader.tsx
14574
14573
  var import_react_table3 = require("@tanstack/react-table");
14575
- var import_clsx26 = __toESM(require("clsx"));
14574
+ var import_clsx25 = __toESM(require("clsx"));
14576
14575
 
14577
14576
  // src/components/layout/table/TableSortButton.tsx
14578
14577
  var import_lucide_react14 = require("lucide-react");
@@ -14630,179 +14629,6 @@ var import_react72 = require("react");
14630
14629
  // src/components/user-interaction/input/DateTimeInput.tsx
14631
14630
  var import_react68 = require("react");
14632
14631
  var import_lucide_react16 = require("lucide-react");
14633
- var import_clsx25 = __toESM(require("clsx"));
14634
-
14635
- // src/utils/date.ts
14636
- var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
14637
- var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
14638
- var formatDate = (date) => {
14639
- const year = date.getFullYear().toString().padStart(4, "0");
14640
- const month = (date.getMonth() + 1).toString().padStart(2, "0");
14641
- const day = date.getDate().toString().padStart(2, "0");
14642
- return `${year}-${month}-${day}`;
14643
- };
14644
- var formatDateTime = (date) => {
14645
- const dateString = formatDate(date);
14646
- const hours = date.getHours().toString().padStart(2, "0");
14647
- const minutes = date.getMinutes().toString().padStart(2, "0");
14648
- return `${dateString}T${hours}:${minutes}`;
14649
- };
14650
- var changeDuration = (date, duration, isAdding) => {
14651
- const {
14652
- years = 0,
14653
- months = 0,
14654
- days = 0,
14655
- hours = 0,
14656
- minutes = 0,
14657
- seconds = 0,
14658
- milliseconds = 0
14659
- } = duration;
14660
- if (years < 0) {
14661
- console.error(`Range error years must be greater than 0: received ${years}`);
14662
- return new Date(date);
14663
- }
14664
- if (months < 0 || months > 11) {
14665
- console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
14666
- return new Date(date);
14667
- }
14668
- if (days < 0) {
14669
- console.error(`Range error days must be greater than 0: received ${days}`);
14670
- return new Date(date);
14671
- }
14672
- if (hours < 0 || hours > 23) {
14673
- console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
14674
- return new Date(date);
14675
- }
14676
- if (minutes < 0 || minutes > 59) {
14677
- console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
14678
- return new Date(date);
14679
- }
14680
- if (seconds < 0 || seconds > 59) {
14681
- console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
14682
- return new Date(date);
14683
- }
14684
- if (milliseconds < 0) {
14685
- console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
14686
- return new Date(date);
14687
- }
14688
- const multiplier = isAdding ? 1 : -1;
14689
- const newDate = new Date(date);
14690
- newDate.setFullYear(newDate.getFullYear() + multiplier * years);
14691
- newDate.setMonth(newDate.getMonth() + multiplier * months);
14692
- newDate.setDate(newDate.getDate() + multiplier * days);
14693
- newDate.setHours(newDate.getHours() + multiplier * hours);
14694
- newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
14695
- newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
14696
- newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
14697
- return newDate;
14698
- };
14699
- var addDuration = (date, duration) => {
14700
- return changeDuration(date, duration, true);
14701
- };
14702
- var subtractDuration = (date, duration) => {
14703
- return changeDuration(date, duration, false);
14704
- };
14705
- var getBetweenDuration = (startDate, endDate) => {
14706
- const durationInMilliseconds = endDate.getTime() - startDate.getTime();
14707
- const millisecondsInSecond = 1e3;
14708
- const millisecondsInMinute = 60 * millisecondsInSecond;
14709
- const millisecondsInHour = 60 * millisecondsInMinute;
14710
- const millisecondsInDay = 24 * millisecondsInHour;
14711
- const millisecondsInMonth = 30 * millisecondsInDay;
14712
- const years = Math.floor(durationInMilliseconds / (365.25 * millisecondsInDay));
14713
- const months = Math.floor(durationInMilliseconds / millisecondsInMonth);
14714
- const days = Math.floor(durationInMilliseconds / millisecondsInDay);
14715
- const hours = Math.floor(durationInMilliseconds % millisecondsInDay / millisecondsInHour);
14716
- const seconds = Math.floor(durationInMilliseconds % millisecondsInHour / millisecondsInSecond);
14717
- const milliseconds = durationInMilliseconds % millisecondsInSecond;
14718
- return {
14719
- years,
14720
- months,
14721
- days,
14722
- hours,
14723
- seconds,
14724
- milliseconds
14725
- };
14726
- };
14727
- var isInTimeSpan = (value, startDate, endDate) => {
14728
- if (startDate && endDate) {
14729
- console.assert(startDate <= endDate);
14730
- return startDate <= value && value <= endDate;
14731
- } else if (startDate) {
14732
- return startDate <= value;
14733
- } else if (endDate) {
14734
- return endDate >= value;
14735
- } else {
14736
- return true;
14737
- }
14738
- };
14739
- var equalDate = (date1, date2) => {
14740
- return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
14741
- };
14742
- var getWeeksForCalenderMonth = (date, weekStart, weeks = 6) => {
14743
- const month = date.getMonth();
14744
- const year = date.getFullYear();
14745
- const dayList = [];
14746
- let currentDate = new Date(year, month, 1);
14747
- const weekStartIndex = weekDayList.indexOf(weekStart);
14748
- while (currentDate.getDay() !== weekStartIndex) {
14749
- currentDate = subtractDuration(currentDate, { days: 1 });
14750
- }
14751
- while (dayList.length < 7 * weeks) {
14752
- const date2 = new Date(currentDate);
14753
- date2.setHours(date2.getHours(), date2.getMinutes());
14754
- dayList.push(date2);
14755
- currentDate = addDuration(currentDate, { days: 1 });
14756
- }
14757
- return equalSizeGroups(dayList, 7);
14758
- };
14759
- var formatGerman = (date, showTime) => {
14760
- const d = new Intl.DateTimeFormat("de-DE", {
14761
- day: "2-digit",
14762
- month: "2-digit",
14763
- year: "numeric"
14764
- }).format(date);
14765
- if (!showTime) return d;
14766
- const t = new Intl.DateTimeFormat("de-DE", {
14767
- hour: "2-digit",
14768
- minute: "2-digit"
14769
- }).format(date);
14770
- return `${d} um ${t} Uhr`;
14771
- };
14772
- var formatAbsolute = (date, locale, showTime) => {
14773
- if (locale === "de-DE") {
14774
- return formatGerman(date, showTime);
14775
- }
14776
- const options = {
14777
- year: "numeric",
14778
- month: "numeric",
14779
- day: "numeric"
14780
- };
14781
- if (showTime) {
14782
- options.hour = "numeric";
14783
- options.minute = "numeric";
14784
- }
14785
- return new Intl.DateTimeFormat(locale, options).format(date);
14786
- };
14787
- var formatRelative = (date, locale, showTime) => {
14788
- const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
14789
- const now = /* @__PURE__ */ new Date();
14790
- const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
14791
- if (Math.abs(diffInSeconds) < 60) return rtf.format(Math.round(diffInSeconds), "second");
14792
- if (Math.abs(diffInSeconds) < 3600) return rtf.format(Math.round(diffInSeconds / 60), "minute");
14793
- if (Math.abs(diffInSeconds) < 86400) return rtf.format(Math.round(diffInSeconds / 3600), "hour");
14794
- if (Math.abs(diffInSeconds) < 604800) return rtf.format(Math.round(diffInSeconds / 86400), "day");
14795
- return formatAbsolute(date, locale, showTime);
14796
- };
14797
- var DateUtils = {
14798
- monthsList,
14799
- weekDayList,
14800
- equalDate,
14801
- formatAbsolute,
14802
- formatRelative
14803
- };
14804
-
14805
- // src/components/user-interaction/date/DateTimePicker.tsx
14806
14632
  var import_clsx24 = __toESM(require("clsx"));
14807
14633
 
14808
14634
  // src/components/user-interaction/date/TimePicker.tsx
@@ -14920,6 +14746,173 @@ var TimePicker = ({
14920
14746
  // src/components/user-interaction/date/DatePicker.tsx
14921
14747
  var import_react67 = require("react");
14922
14748
  var import_lucide_react15 = require("lucide-react");
14749
+
14750
+ // src/utils/date.ts
14751
+ var timesInSeconds = {
14752
+ second: 1,
14753
+ minute: 60,
14754
+ hour: 3600,
14755
+ day: 86400,
14756
+ week: 604800,
14757
+ monthImprecise: 2629800,
14758
+ // 30.4375 days
14759
+ yearImprecise: 31557600
14760
+ // 365.25 days
14761
+ };
14762
+ var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
14763
+ var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
14764
+ var changeDuration = (date, duration, isAdding) => {
14765
+ const {
14766
+ years = 0,
14767
+ months = 0,
14768
+ days = 0,
14769
+ hours = 0,
14770
+ minutes = 0,
14771
+ seconds = 0,
14772
+ milliseconds = 0
14773
+ } = duration;
14774
+ if (years < 0) {
14775
+ console.error(`Range error years must be greater than 0: received ${years}`);
14776
+ return new Date(date);
14777
+ }
14778
+ if (months < 0 || months > 11) {
14779
+ console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
14780
+ return new Date(date);
14781
+ }
14782
+ if (days < 0) {
14783
+ console.error(`Range error days must be greater than 0: received ${days}`);
14784
+ return new Date(date);
14785
+ }
14786
+ if (hours < 0 || hours > 23) {
14787
+ console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
14788
+ return new Date(date);
14789
+ }
14790
+ if (minutes < 0 || minutes > 59) {
14791
+ console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
14792
+ return new Date(date);
14793
+ }
14794
+ if (seconds < 0 || seconds > 59) {
14795
+ console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
14796
+ return new Date(date);
14797
+ }
14798
+ if (milliseconds < 0) {
14799
+ console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
14800
+ return new Date(date);
14801
+ }
14802
+ const multiplier = isAdding ? 1 : -1;
14803
+ const newDate = new Date(date);
14804
+ newDate.setFullYear(newDate.getFullYear() + multiplier * years);
14805
+ newDate.setMonth(newDate.getMonth() + multiplier * months);
14806
+ newDate.setDate(newDate.getDate() + multiplier * days);
14807
+ newDate.setHours(newDate.getHours() + multiplier * hours);
14808
+ newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
14809
+ newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
14810
+ newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
14811
+ return newDate;
14812
+ };
14813
+ var addDuration = (date, duration) => {
14814
+ return changeDuration(date, duration, true);
14815
+ };
14816
+ var subtractDuration = (date, duration) => {
14817
+ return changeDuration(date, duration, false);
14818
+ };
14819
+ var between = (value, startDate, endDate) => {
14820
+ if (startDate && endDate) {
14821
+ console.assert(startDate <= endDate);
14822
+ return startDate <= value && value <= endDate;
14823
+ } else if (startDate) {
14824
+ return startDate <= value;
14825
+ } else if (endDate) {
14826
+ return endDate >= value;
14827
+ } else {
14828
+ return true;
14829
+ }
14830
+ };
14831
+ var equalDate = (date1, date2) => {
14832
+ return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
14833
+ };
14834
+ var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
14835
+ const month = date.getMonth();
14836
+ const year = date.getFullYear();
14837
+ const dayList = [];
14838
+ let currentDate = new Date(year, month, 1);
14839
+ const weekStartIndex = weekDayList.indexOf(weekStart);
14840
+ while (currentDate.getDay() !== weekStartIndex) {
14841
+ currentDate = subtractDuration(currentDate, { days: 1 });
14842
+ }
14843
+ while (dayList.length < 7 * weeks) {
14844
+ const date2 = new Date(currentDate);
14845
+ date2.setHours(date2.getHours(), date2.getMinutes());
14846
+ dayList.push(date2);
14847
+ currentDate = addDuration(currentDate, { days: 1 });
14848
+ }
14849
+ return equalSizeGroups(dayList, 7);
14850
+ };
14851
+ var formatAbsolute = (date, locale, format) => {
14852
+ let options;
14853
+ switch (format) {
14854
+ case "date":
14855
+ options = {
14856
+ year: "2-digit",
14857
+ month: "2-digit",
14858
+ day: "2-digit"
14859
+ };
14860
+ break;
14861
+ case "time":
14862
+ options = {
14863
+ hour: "2-digit",
14864
+ minute: "2-digit"
14865
+ };
14866
+ break;
14867
+ case "dateTime":
14868
+ options = {
14869
+ year: "numeric",
14870
+ month: "2-digit",
14871
+ day: "2-digit",
14872
+ hour: "2-digit",
14873
+ minute: "2-digit"
14874
+ };
14875
+ break;
14876
+ }
14877
+ return new Intl.DateTimeFormat(locale, options).format(date);
14878
+ };
14879
+ var formatRelative = (date, locale) => {
14880
+ const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
14881
+ const now = /* @__PURE__ */ new Date();
14882
+ const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
14883
+ if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
14884
+ if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
14885
+ if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
14886
+ if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
14887
+ if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
14888
+ if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
14889
+ return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "year");
14890
+ };
14891
+ var toInputString = (date, format) => {
14892
+ switch (format) {
14893
+ case "date":
14894
+ return date.toISOString().split("T")[0];
14895
+ case "time":
14896
+ return date.toISOString().split("T")[1].split("Z")[0];
14897
+ case "dateTime":
14898
+ return date.toISOString();
14899
+ }
14900
+ };
14901
+ var DateUtils = {
14902
+ monthsList,
14903
+ weekDayList,
14904
+ equalDate,
14905
+ formatAbsolute,
14906
+ formatRelative,
14907
+ addDuration,
14908
+ subtractDuration,
14909
+ between,
14910
+ weeksForCalenderMonth,
14911
+ timesInSeconds,
14912
+ toInputString
14913
+ };
14914
+
14915
+ // src/components/user-interaction/date/DatePicker.tsx
14923
14916
  var import_clsx23 = __toESM(require("clsx"));
14924
14917
 
14925
14918
  // src/components/user-interaction/date/DayPicker.tsx
@@ -14951,7 +14944,7 @@ var DayPicker = ({
14951
14944
  defaultValue: initialDisplayedMonth ?? value
14952
14945
  });
14953
14946
  const month = displayedMonth.getMonth();
14954
- const weeks = getWeeksForCalenderMonth(displayedMonth, weekStart);
14947
+ const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
14955
14948
  const selectedButtonRef = (0, import_react65.useRef)(null);
14956
14949
  const isValueInDisplayedWeeks = (0, import_react65.useMemo)(
14957
14950
  () => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
@@ -14980,7 +14973,7 @@ var DayPicker = ({
14980
14973
  }, [start, end]);
14981
14974
  const navigateTo = (0, import_react65.useCallback)((candidate) => {
14982
14975
  const clamped = clampToRange(candidate);
14983
- if (!isInTimeSpan(clamped, start, end)) return;
14976
+ if (!DateUtils.between(clamped, start, end)) return;
14984
14977
  setValue(clamped);
14985
14978
  onEditComplete?.(clamped);
14986
14979
  if (clamped.getMonth() !== displayedMonth.getMonth() || clamped.getFullYear() !== displayedMonth.getFullYear()) {
@@ -14990,10 +14983,10 @@ var DayPicker = ({
14990
14983
  const onKeyDown = (0, import_react65.useCallback)(
14991
14984
  (event) => {
14992
14985
  PropsUtil.aria.navigate({
14993
- left: () => focusTargetDate && navigateTo(subtractDuration(focusTargetDate, { days: 1 })),
14994
- right: () => focusTargetDate && navigateTo(addDuration(focusTargetDate, { days: 1 })),
14995
- up: () => focusTargetDate && navigateTo(subtractDuration(focusTargetDate, { days: 7 })),
14996
- down: () => focusTargetDate && navigateTo(addDuration(focusTargetDate, { days: 7 }))
14986
+ left: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 1 })),
14987
+ right: () => focusTargetDate && navigateTo(DateUtils.addDuration(focusTargetDate, { days: 1 })),
14988
+ up: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 7 })),
14989
+ down: () => focusTargetDate && navigateTo(DateUtils.addDuration(focusTargetDate, { days: 7 }))
14997
14990
  })(event);
14998
14991
  },
14999
14992
  [focusTargetDate, navigateTo]
@@ -15005,7 +14998,7 @@ var DayPicker = ({
15005
14998
  const isFocused = !!focusTargetDate && DateUtils.equalDate(focusTargetDate, date);
15006
14999
  const isToday = DateUtils.equalDate(/* @__PURE__ */ new Date(), date);
15007
15000
  const isSameMonth = date.getMonth() === month;
15008
- const isDayValid = isInTimeSpan(date, start, end);
15001
+ const isDayValid = DateUtils.between(date, start, end);
15009
15002
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
15010
15003
  "div",
15011
15004
  {
@@ -15099,8 +15092,8 @@ var YearRow = (0, import_react66.memo)(function YearRow2({
15099
15092
  }
15100
15093
  );
15101
15094
  });
15102
- var defaultStart = subtractDuration(/* @__PURE__ */ new Date(), { years: 100 });
15103
- var defaultEnd = addDuration(/* @__PURE__ */ new Date(), { years: 100 });
15095
+ var defaultStart = DateUtils.subtractDuration(/* @__PURE__ */ new Date(), { years: 100 });
15096
+ var defaultEnd = DateUtils.addDuration(/* @__PURE__ */ new Date(), { years: 100 });
15104
15097
  var YearMonthPicker = ({
15105
15098
  value: controlledValue,
15106
15099
  initialValue = /* @__PURE__ */ new Date(),
@@ -15226,9 +15219,9 @@ var DatePicker = ({
15226
15219
  {
15227
15220
  tooltip: translation("time.previousMonth"),
15228
15221
  size: "sm",
15229
- disabled: !isInTimeSpan(subtractDuration(displayedMonth, { months: 1 }), start, end),
15222
+ disabled: !DateUtils.between(DateUtils.subtractDuration(displayedMonth, { months: 1 }), start, end),
15230
15223
  onClick: () => {
15231
- setDisplayedMonth(subtractDuration(displayedMonth, { months: 1 }));
15224
+ setDisplayedMonth(DateUtils.subtractDuration(displayedMonth, { months: 1 }));
15232
15225
  },
15233
15226
  children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react15.ArrowUp, { size: 20 })
15234
15227
  }
@@ -15238,9 +15231,9 @@ var DatePicker = ({
15238
15231
  {
15239
15232
  tooltip: translation("time.nextMonth"),
15240
15233
  size: "sm",
15241
- disabled: !isInTimeSpan(addDuration(displayedMonth, { months: 1 }), start, end),
15234
+ disabled: !DateUtils.between(DateUtils.addDuration(displayedMonth, { months: 1 }), start, end),
15242
15235
  onClick: () => {
15243
- setDisplayedMonth(addDuration(displayedMonth, { months: 1 }));
15236
+ setDisplayedMonth(DateUtils.addDuration(displayedMonth, { months: 1 }));
15244
15237
  },
15245
15238
  children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react15.ArrowDown, { size: 20 })
15246
15239
  }
@@ -15330,7 +15323,6 @@ var DateTimePicker = ({
15330
15323
  ...timePickerProps,
15331
15324
  is24HourFormat,
15332
15325
  minuteIncrement,
15333
- className: (0, import_clsx24.default)({ "justify-between": mode === "time" }),
15334
15326
  value,
15335
15327
  onValueChange: setValue,
15336
15328
  onEditComplete
@@ -15426,9 +15418,9 @@ var DateTimePickerDialog = ({
15426
15418
  // src/components/user-interaction/input/DateTimeInput.tsx
15427
15419
  var import_jsx_runtime66 = require("react/jsx-runtime");
15428
15420
  var DateTimeInput = (0, import_react68.forwardRef)(function DateTimeInput2({
15421
+ id: inputId,
15429
15422
  value,
15430
15423
  initialValue = null,
15431
- placeholder,
15432
15424
  onValueChange,
15433
15425
  onEditComplete,
15434
15426
  allowRemove = false,
@@ -15444,7 +15436,6 @@ var DateTimeInput = (0, import_react68.forwardRef)(function DateTimeInput2({
15444
15436
  ...props
15445
15437
  }, forwardedRef) {
15446
15438
  const translation = useHightideTranslation();
15447
- const { locale } = useLocale();
15448
15439
  const [isOpen, setIsOpen] = (0, import_react68.useState)(false);
15449
15440
  const [state, setState] = useControlledState({
15450
15441
  value,
@@ -15452,19 +15443,21 @@ var DateTimeInput = (0, import_react68.forwardRef)(function DateTimeInput2({
15452
15443
  defaultValue: initialValue
15453
15444
  });
15454
15445
  const [dialogValue, setDialogValue] = (0, import_react68.useState)(state ?? /* @__PURE__ */ new Date());
15446
+ const [dateString, setDateString] = (0, import_react68.useState)(state ? DateUtils.toInputString(state, mode) : "");
15455
15447
  (0, import_react68.useEffect)(() => {
15456
15448
  setDialogValue(state ?? /* @__PURE__ */ new Date());
15457
- }, [state]);
15449
+ setDateString(state ? DateUtils.toInputString(state, mode) : "");
15450
+ }, [mode, state]);
15458
15451
  const changeOpenWrapper = (0, import_react68.useCallback)((isOpen2) => {
15459
15452
  onDialogOpeningChange?.(isOpen2);
15460
15453
  setIsOpen(isOpen2);
15461
15454
  }, [onDialogOpeningChange]);
15462
- const id = (0, import_react68.useId)();
15455
+ const generatedId = (0, import_react68.useId)();
15463
15456
  const ids = (0, import_react68.useMemo)(() => ({
15464
- input: `date-time-input-${id}`,
15465
- popup: `date-time-input-popup-${id}`,
15466
- label: `date-time-input-label-${id}`
15467
- }), [id]);
15457
+ input: inputId ?? `date-time-input-${generatedId}`,
15458
+ popup: `date-time-input-popup-${generatedId}`,
15459
+ label: `date-time-input-label-${generatedId}`
15460
+ }), [generatedId, inputId]);
15468
15461
  const innerRef = (0, import_react68.useRef)(null);
15469
15462
  (0, import_react68.useImperativeHandle)(forwardedRef, () => innerRef.current);
15470
15463
  (0, import_react68.useEffect)(() => {
@@ -15472,30 +15465,28 @@ var DateTimeInput = (0, import_react68.forwardRef)(function DateTimeInput2({
15472
15465
  changeOpenWrapper(false);
15473
15466
  }
15474
15467
  }, [changeOpenWrapper, readOnly, disabled]);
15475
- const clickHandler = PropsUtil.aria.click(() => changeOpenWrapper(true));
15476
15468
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
15477
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { ...containerProps, className: (0, import_clsx25.default)("relative w-full", containerProps?.className), children: [
15469
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { ...containerProps, className: (0, import_clsx24.default)("relative w-full", containerProps?.className), children: [
15478
15470
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
15479
- "div",
15471
+ "input",
15480
15472
  {
15481
15473
  ...props,
15482
15474
  ref: innerRef,
15483
15475
  id: ids.input,
15484
- onClick: (event) => {
15485
- clickHandler.onClick();
15486
- props.onClick?.(event);
15476
+ value: dateString,
15477
+ onChange: (event) => {
15478
+ const date = event.target.valueAsDate;
15479
+ if (date) {
15480
+ setState(date);
15481
+ } else {
15482
+ setDateString(event.target.value);
15483
+ }
15487
15484
  },
15488
- onKeyDown: clickHandler.onKeyDown,
15485
+ type: mode === "date" ? "date" : mode === "time" ? "time" : "datetime-local",
15489
15486
  ...PropsUtil.dataAttributes.interactionStates({ disabled, readOnly, invalid, required }),
15490
- "data-value": PropsUtil.dataAttributes.bool(!!state),
15491
- ...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props),
15492
- tabIndex: 0,
15493
- role: "combobox",
15494
- "aria-haspopup": "dialog",
15495
- "aria-expanded": isOpen,
15496
- "aria-controls": isOpen ? ids.popup : void 0,
15497
15487
  "data-name": props["data-name"] ?? "date-time-input",
15498
- children: state ? DateUtils.formatAbsolute(state, locale, mode === "dateTime") : placeholder ?? translation("clickToSelect")
15488
+ "data-value": PropsUtil.dataAttributes.bool(!!state || !!dateString),
15489
+ ...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props)
15499
15490
  }
15500
15491
  ),
15501
15492
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Visibility, { isVisible: !readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
@@ -15613,16 +15604,16 @@ var Checkbox = ({
15613
15604
  onClick: (event) => {
15614
15605
  if (!disabled) {
15615
15606
  setValue((prev) => !prev);
15616
- props.onClick?.(event);
15617
15607
  }
15608
+ props.onClick?.(event);
15618
15609
  },
15619
15610
  onKeyDown: (event) => {
15620
15611
  if (disabled) return;
15621
15612
  if (event.key === " " || event.key === "Enter") {
15622
15613
  event.preventDefault();
15623
15614
  setValue((prev) => !prev);
15624
- props.onKeyDown?.(event);
15625
15615
  }
15616
+ props.onKeyDown?.(event);
15626
15617
  },
15627
15618
  "data-checked": !indeterminate ? value : "indeterminate",
15628
15619
  "data-size": size ?? void 0,
@@ -15963,6 +15954,12 @@ var NumberFilter = ({ filterValue, onFilterValueChange }) => {
15963
15954
  };
15964
15955
  var DateFilter = ({ filterValue, onFilterValueChange }) => {
15965
15956
  const translation = useHightideTranslation();
15957
+ const id = (0, import_react71.useId)();
15958
+ const ids = {
15959
+ startDate: `date-filter-start-date-${id}`,
15960
+ endDate: `date-filter-end-date-${id}`,
15961
+ compareDate: `date-filter-compare-date-${id}`
15962
+ };
15966
15963
  const operator = filterValue?.operator ?? "dateBetween";
15967
15964
  const parameter = filterValue?.parameter ?? {};
15968
15965
  const [temporaryMinDateValue, setTemporaryMinDateValue] = (0, import_react71.useState)(null);
@@ -15990,11 +15987,12 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
15990
15987
  ),
15991
15988
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
15992
15989
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Visibility, { isVisible: needsRangeInput, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex-col-2 gap-2", children: [
15990
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: ids.startDate, className: "typography-label-md", children: translation("startDate") }),
15993
15991
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
15994
15992
  DateTimeInput,
15995
15993
  {
15994
+ id: ids.startDate,
15996
15995
  value: temporaryMinDateValue ?? parameter.min ?? null,
15997
- placeholder: translation("startDate"),
15998
15996
  onValueChange: (value) => setTemporaryMinDateValue(value),
15999
15997
  onEditComplete: (value) => {
16000
15998
  if (value && parameter.max && value > parameter.max) {
@@ -16023,11 +16021,12 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
16023
16021
  className: "min-w-64"
16024
16022
  }
16025
16023
  ),
16024
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: ids.endDate, className: "typography-label-md", children: translation("endDate") }),
16026
16025
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
16027
16026
  DateTimeInput,
16028
16027
  {
16028
+ id: ids.endDate,
16029
16029
  value: temporaryMaxDateValue ?? parameter.max ?? null,
16030
- placeholder: translation("endDate"),
16031
16030
  onValueChange: (value) => setTemporaryMaxDateValue(value),
16032
16031
  onEditComplete: (value) => {
16033
16032
  if (value && parameter.min && value < parameter.min) {
@@ -16056,27 +16055,36 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
16056
16055
  }
16057
16056
  )
16058
16057
  ] }) }),
16059
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Visibility, { isVisible: !needsRangeInput && needsParameterInput, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
16060
- DateTimeInput,
16061
- {
16062
- value: parameter.compareDate ?? null,
16063
- placeholder: translation("date"),
16064
- onValueChange: (compareDate) => {
16065
- onFilterValueChange({
16066
- operator,
16067
- parameter: { compareDate }
16068
- });
16069
- },
16070
- allowRemove: true,
16071
- outsideClickCloses: false,
16072
- className: "min-w-64"
16073
- }
16074
- ) }),
16058
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Visibility, { isVisible: !needsRangeInput && needsParameterInput, children: [
16059
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: ids.compareDate, className: "typography-label-md", children: translation("date") }),
16060
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
16061
+ DateTimeInput,
16062
+ {
16063
+ id: ids.compareDate,
16064
+ value: parameter.compareDate ?? null,
16065
+ onValueChange: (compareDate) => {
16066
+ onFilterValueChange({
16067
+ operator,
16068
+ parameter: { compareDate }
16069
+ });
16070
+ },
16071
+ allowRemove: true,
16072
+ outsideClickCloses: false,
16073
+ className: "min-w-64"
16074
+ }
16075
+ )
16076
+ ] }),
16075
16077
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Visibility, { isVisible: !needsParameterInput, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-sm text-description", children: translation("noParameterRequired") }) })
16076
16078
  ] });
16077
16079
  };
16078
16080
  var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
16079
16081
  const translation = useHightideTranslation();
16082
+ const id = (0, import_react71.useId)();
16083
+ const ids = {
16084
+ startDate: `datetime-filter-start-date-${id}`,
16085
+ endDate: `datetime-filter-end-date-${id}`,
16086
+ compareDate: `datetime-filter-compare-date-${id}`
16087
+ };
16080
16088
  const operator = filterValue?.operator ?? "dateTimeBetween";
16081
16089
  const parameter = filterValue?.parameter ?? {};
16082
16090
  const [temporaryMinDateValue, setTemporaryMinDateValue] = (0, import_react71.useState)(null);
@@ -16104,12 +16112,13 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
16104
16112
  ),
16105
16113
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
16106
16114
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Visibility, { isVisible: needsRangeInput, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex-col-2 gap-2", children: [
16115
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: ids.startDate, className: "typography-label-md", children: translation("startDate") }),
16107
16116
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
16108
16117
  DateTimeInput,
16109
16118
  {
16119
+ id: ids.startDate,
16110
16120
  mode: "dateTime",
16111
16121
  value: temporaryMinDateValue ?? parameter.min ?? null,
16112
- placeholder: translation("startDate"),
16113
16122
  onValueChange: (value) => setTemporaryMinDateValue(value),
16114
16123
  onEditComplete: (value) => {
16115
16124
  if (value && parameter.max && value > parameter.max) {
@@ -16138,12 +16147,13 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
16138
16147
  className: "min-w-64"
16139
16148
  }
16140
16149
  ),
16150
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: ids.endDate, className: "typography-label-md", children: translation("endDate") }),
16141
16151
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
16142
16152
  DateTimeInput,
16143
16153
  {
16154
+ id: ids.endDate,
16144
16155
  mode: "dateTime",
16145
16156
  value: temporaryMaxDateValue ?? parameter.max ?? null,
16146
- placeholder: translation("endDate"),
16147
16157
  onValueChange: (value) => setTemporaryMaxDateValue(value),
16148
16158
  onEditComplete: (value) => {
16149
16159
  if (value && parameter.min && value < parameter.min) {
@@ -16172,22 +16182,25 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
16172
16182
  }
16173
16183
  )
16174
16184
  ] }) }),
16175
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Visibility, { isVisible: !needsRangeInput && needsParameterInput, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
16176
- DateTimeInput,
16177
- {
16178
- value: parameter.compareDatetime ?? null,
16179
- placeholder: translation("date"),
16180
- onValueChange: (compareDatetime) => {
16181
- onFilterValueChange({
16182
- operator,
16183
- parameter: { compareDatetime }
16184
- });
16185
- },
16186
- allowRemove: true,
16187
- outsideClickCloses: false,
16188
- className: "min-w-64"
16189
- }
16190
- ) }),
16185
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Visibility, { isVisible: !needsRangeInput && needsParameterInput, children: [
16186
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: ids.compareDate, className: "typography-label-md", children: translation("date") }),
16187
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
16188
+ DateTimeInput,
16189
+ {
16190
+ id: ids.compareDate,
16191
+ value: parameter.compareDatetime ?? null,
16192
+ onValueChange: (compareDatetime) => {
16193
+ onFilterValueChange({
16194
+ operator,
16195
+ parameter: { compareDatetime }
16196
+ });
16197
+ },
16198
+ allowRemove: true,
16199
+ outsideClickCloses: false,
16200
+ className: "min-w-64"
16201
+ }
16202
+ )
16203
+ ] }),
16191
16204
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Visibility, { isVisible: !needsParameterInput, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-sm text-description", children: translation("noParameterRequired") }) })
16192
16205
  ] });
16193
16206
  };
@@ -16524,14 +16537,14 @@ var TableHeader = ({ isSticky = false }) => {
16524
16537
  },
16525
16538
  header.id
16526
16539
  )) }) }, headerGroup.id)),
16527
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("tr", { "data-name": "table-header-row", className: (0, import_clsx26.default)(table.options.meta?.headerRowClassName), children: headerGroup.headers.map((header) => {
16540
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("tr", { "data-name": "table-header-row", className: (0, import_clsx25.default)(table.options.meta?.headerRowClassName), children: headerGroup.headers.map((header) => {
16528
16541
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
16529
16542
  "th",
16530
16543
  {
16531
16544
  colSpan: header.colSpan,
16532
16545
  "data-sticky": isSticky ? "" : void 0,
16533
16546
  "data-name": "table-header-cell",
16534
- className: (0, import_clsx26.default)("group/table-header-cell", header.column.columnDef.meta?.className),
16547
+ className: (0, import_clsx25.default)("group/table-header-cell", header.column.columnDef.meta?.className),
16535
16548
  children: [
16536
16549
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Visibility, { isVisible: !header.isPlaceholder, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex-row-1 items-center", children: [
16537
16550
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Visibility, { isVisible: header.column.getCanSort(), children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
@@ -16631,7 +16644,7 @@ var TableDisplay = ({
16631
16644
  };
16632
16645
 
16633
16646
  // src/components/layout/table/TablePagination.tsx
16634
- var import_clsx27 = __toESM(require("clsx"));
16647
+ var import_clsx26 = __toESM(require("clsx"));
16635
16648
  var import_jsx_runtime73 = require("react/jsx-runtime");
16636
16649
  var TablePaginationMenu = ({ ...props }) => {
16637
16650
  const { table } = useTableStateWithoutSizingContext();
@@ -16666,7 +16679,7 @@ var TablePageSizeSelect = ({
16666
16679
  );
16667
16680
  };
16668
16681
  var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props }) => {
16669
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { ...props, className: (0, import_clsx27.default)("container flex-col-2 sm:flex-row-8 items-center justify-center", props.className), children: [
16682
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { ...props, className: (0, import_clsx26.default)("container flex-col-2 sm:flex-row-8 items-center justify-center", props.className), children: [
16670
16683
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(TablePaginationMenu, {}),
16671
16684
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Visibility, { isVisible: allowChangingPageSize, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(TablePageSizeSelect, { pageSizeOptions, buttonProps: { className: "h-10 min-w-24 max-w-24" } }) })
16672
16685
  ] });
@@ -16759,11 +16772,11 @@ var TableWithSelectionProvider = ({
16759
16772
  };
16760
16773
 
16761
16774
  // src/components/layout/table/Table.tsx
16762
- var import_clsx28 = __toESM(require("clsx"));
16775
+ var import_clsx27 = __toESM(require("clsx"));
16763
16776
  var import_jsx_runtime75 = require("react/jsx-runtime");
16764
16777
  var Table = ({ children, table, paginationOptions, displayProps, header, footer, ...props }) => {
16765
16778
  const { showPagination = true, allowChangingPageSize, pageSizeOptions } = paginationOptions ?? {};
16766
- return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ...props, className: (0, import_clsx28.default)("flex-col-3", props.className), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(TableProvider, { ...table, children: [
16779
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ...props, className: (0, import_clsx27.default)("flex-col-3", props.className), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(TableProvider, { ...table, children: [
16767
16780
  header,
16768
16781
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TableDisplay, { ...displayProps, children }),
16769
16782
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Visibility, { isVisible: showPagination, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TablePagination, { allowChangingPageSize, pageSizeOptions }) }),
@@ -16780,7 +16793,7 @@ var TableWithSelection = ({
16780
16793
  ...props
16781
16794
  }) => {
16782
16795
  const { showPagination = true, allowChangingPageSize, pageSizeOptions } = paginationOptions ?? {};
16783
- return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ...props, className: (0, import_clsx28.default)("flex-col-3", props.className), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(TableWithSelectionProvider, { ...table, children: [
16796
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ...props, className: (0, import_clsx27.default)("flex-col-3", props.className), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(TableWithSelectionProvider, { ...table, children: [
16784
16797
  header,
16785
16798
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TableDisplay, { ...displayProps, children }),
16786
16799
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Visibility, { isVisible: showPagination, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TablePagination, { allowChangingPageSize, pageSizeOptions }) }),
@@ -17099,7 +17112,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
17099
17112
 
17100
17113
  // src/components/user-interaction/CopyToClipboardWrapper.tsx
17101
17114
  var import_react77 = require("react");
17102
- var import_clsx29 = require("clsx");
17115
+ var import_clsx28 = require("clsx");
17103
17116
 
17104
17117
  // src/utils/writeToClipboard.ts
17105
17118
  var writeToClipboard = (text) => {
@@ -17138,7 +17151,7 @@ var CopyToClipboardWrapper = ({
17138
17151
  "div",
17139
17152
  {
17140
17153
  ref: callbackRef,
17141
- className: (0, import_clsx29.clsx)("w-fit hover:cursor-copy", containerClassName),
17154
+ className: (0, import_clsx28.clsx)("w-fit hover:cursor-copy", containerClassName),
17142
17155
  ...disabled2 ? void 0 : props2,
17143
17156
  onClick: () => {
17144
17157
  if (disabled2) return;
@@ -17171,7 +17184,7 @@ var CopyToClipboardWrapper = ({
17171
17184
 
17172
17185
  // src/components/user-interaction/Menu.tsx
17173
17186
  var import_react78 = require("react");
17174
- var import_clsx30 = __toESM(require("clsx"));
17187
+ var import_clsx29 = __toESM(require("clsx"));
17175
17188
  var import_jsx_runtime79 = require("react/jsx-runtime");
17176
17189
  var MenuItem = ({
17177
17190
  children,
@@ -17181,7 +17194,7 @@ var MenuItem = ({
17181
17194
  }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
17182
17195
  "div",
17183
17196
  {
17184
- className: (0, import_clsx30.default)("block px-3 py-1.5 first:rounded-t-md last:rounded-b-md text-sm font-semibold text-nowrap", {
17197
+ className: (0, import_clsx29.default)("block px-3 py-1.5 first:rounded-t-md last:rounded-b-md text-sm font-semibold text-nowrap", {
17185
17198
  "text-disabled cursor-not-allowed": isDisabled,
17186
17199
  "text-menu-text hover:bg-primary/20": !isDisabled,
17187
17200
  "cursor-pointer": !!onClick
@@ -17228,7 +17241,7 @@ var Menu = ({
17228
17241
 
17229
17242
  // src/components/user-interaction/ScrollPicker.tsx
17230
17243
  var import_react79 = require("react");
17231
- var import_clsx31 = __toESM(require("clsx"));
17244
+ var import_clsx30 = __toESM(require("clsx"));
17232
17245
  var import_jsx_runtime80 = require("react/jsx-runtime");
17233
17246
  var up = 1;
17234
17247
  var down = -1;
@@ -17398,7 +17411,7 @@ var ScrollPicker = ({
17398
17411
  children: shownItems.map(({ name, index }, arrayIndex) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
17399
17412
  "div",
17400
17413
  {
17401
- className: (0, import_clsx31.default)(
17414
+ className: (0, import_clsx30.default)(
17402
17415
  `flex-col-2 items-center justify-center rounded-md`,
17403
17416
  {
17404
17417
  "text-primary font-bold": currentIndex === index,
@@ -17481,7 +17494,7 @@ var Switch = ({
17481
17494
 
17482
17495
  // src/components/user-interaction/Textarea.tsx
17483
17496
  var import_react81 = require("react");
17484
- var import_clsx32 = __toESM(require("clsx"));
17497
+ var import_clsx31 = __toESM(require("clsx"));
17485
17498
  var import_jsx_runtime82 = require("react/jsx-runtime");
17486
17499
  var Textarea = (0, import_react81.forwardRef)(function Textarea2({
17487
17500
  value: controlledValue,
@@ -17542,7 +17555,7 @@ var TextareaWithHeadline = ({
17542
17555
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
17543
17556
  "div",
17544
17557
  {
17545
- className: (0, import_clsx32.default)(
17558
+ className: (0, import_clsx31.default)(
17546
17559
  "group flex-col-3 border-2 rounded-lg",
17547
17560
  {
17548
17561
  "bg-input-background text-input-text hover:border-primary focus-within:border-primary": !disabled,
@@ -17551,13 +17564,13 @@ var TextareaWithHeadline = ({
17551
17564
  containerClassName
17552
17565
  ),
17553
17566
  children: [
17554
- headline && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("label", { ...headlineProps, htmlFor: usedId, className: (0, import_clsx32.default)("typography-lable-md text-label", headlineProps.className), children: headline }),
17567
+ headline && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("label", { ...headlineProps, htmlFor: usedId, className: (0, import_clsx31.default)("typography-lable-md text-label", headlineProps.className), children: headline }),
17555
17568
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
17556
17569
  Textarea,
17557
17570
  {
17558
17571
  ...props,
17559
17572
  id: usedId,
17560
- className: (0, import_clsx32.default)(
17573
+ className: (0, import_clsx31.default)(
17561
17574
  "border-transparent focus:ring-0 focus-visible:ring-0 resize-none h-32",
17562
17575
  className
17563
17576
  )
@@ -17612,7 +17625,7 @@ var TimeDisplay = ({
17612
17625
  // src/components/user-interaction/input/InsideLabelInput.tsx
17613
17626
  var import_react82 = require("react");
17614
17627
  var import_react83 = require("react");
17615
- var import_clsx33 = __toESM(require("clsx"));
17628
+ var import_clsx32 = __toESM(require("clsx"));
17616
17629
  var import_jsx_runtime84 = require("react/jsx-runtime");
17617
17630
  var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2({
17618
17631
  id: customId,
@@ -17630,7 +17643,7 @@ var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2
17630
17643
  const [isFocused, setIsFocused] = (0, import_react83.useState)(false);
17631
17644
  const generatedId = (0, import_react82.useId)();
17632
17645
  const id = customId ?? generatedId;
17633
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: (0, import_clsx33.default)("relative"), children: [
17646
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: (0, import_clsx32.default)("relative"), children: [
17634
17647
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
17635
17648
  Input,
17636
17649
  {
@@ -17648,7 +17661,7 @@ var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2
17648
17661
  setIsFocused(false);
17649
17662
  },
17650
17663
  "aria-labelledby": id + "-label",
17651
- className: (0, import_clsx33.default)("h-14 px-4 pb-2 py-6.5", props.className)
17664
+ className: (0, import_clsx32.default)("h-14 px-4 pb-2 py-6.5", props.className)
17652
17665
  }
17653
17666
  ),
17654
17667
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
@@ -17657,7 +17670,7 @@ var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2
17657
17670
  id: id + "-label",
17658
17671
  "aria-hidden": true,
17659
17672
  "data-display": isFocused || !!value ? "small" : "full",
17660
- className: (0, import_clsx33.default)(
17673
+ className: (0, import_clsx32.default)(
17661
17674
  // margin left to account for the border which is ignored for absolute positions
17662
17675
  "absolute left-4 ml-0.5 top-2 transition-all delay-25 pointer-events-none touch-none",
17663
17676
  "data-[display=small]:top-2 data-[display=small]:h-force-4.5 data-[display=small]:typography-caption-sm data-[display=small]:overflow-y-hidden",
@@ -17671,7 +17684,7 @@ var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2
17671
17684
 
17672
17685
  // src/components/user-interaction/input/SearchBar.tsx
17673
17686
  var import_lucide_react22 = require("lucide-react");
17674
- var import_clsx34 = require("clsx");
17687
+ var import_clsx33 = require("clsx");
17675
17688
  var import_jsx_runtime85 = require("react/jsx-runtime");
17676
17689
  var SearchBar = ({
17677
17690
  value: controlledValue,
@@ -17688,7 +17701,7 @@ var SearchBar = ({
17688
17701
  onValueChange,
17689
17702
  defaultValue: initialValue
17690
17703
  });
17691
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { ...containerProps, className: (0, import_clsx34.clsx)("relative", containerProps?.className), children: [
17704
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { ...containerProps, className: (0, import_clsx33.clsx)("relative", containerProps?.className), children: [
17692
17705
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
17693
17706
  Input,
17694
17707
  {
@@ -17697,7 +17710,7 @@ var SearchBar = ({
17697
17710
  onValueChange: setValue,
17698
17711
  onEditComplete: onSearch,
17699
17712
  placeholder: inputProps.placeholder ?? translation("search"),
17700
- className: (0, import_clsx34.clsx)("pr-10 w-full", inputProps.className)
17713
+ className: (0, import_clsx33.clsx)("pr-10 w-full", inputProps.className)
17701
17714
  }
17702
17715
  ),
17703
17716
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
@@ -17709,7 +17722,7 @@ var SearchBar = ({
17709
17722
  color: "neutral",
17710
17723
  coloringStyle: "text",
17711
17724
  onClick: () => onSearch(value),
17712
- className: (0, import_clsx34.clsx)("absolute right-1.5 top-1/2 -translate-y-1/2", searchButtonProps?.className),
17725
+ className: (0, import_clsx33.clsx)("absolute right-1.5 top-1/2 -translate-y-1/2", searchButtonProps?.className),
17713
17726
  children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react22.Search, { className: "w-full h-full" })
17714
17727
  }
17715
17728
  )
@@ -17719,7 +17732,7 @@ var SearchBar = ({
17719
17732
  // src/components/user-interaction/input/ToggleableInput.tsx
17720
17733
  var import_react84 = require("react");
17721
17734
  var import_lucide_react23 = require("lucide-react");
17722
- var import_clsx35 = __toESM(require("clsx"));
17735
+ var import_clsx34 = __toESM(require("clsx"));
17723
17736
  var import_jsx_runtime86 = require("react/jsx-runtime");
17724
17737
  var ToggleableInput = (0, import_react84.forwardRef)(function ToggleableInput2({
17725
17738
  value: controlledValue,
@@ -17742,7 +17755,7 @@ var ToggleableInput = (0, import_react84.forwardRef)(function ToggleableInput2({
17742
17755
  innerRef.current?.focus();
17743
17756
  }
17744
17757
  }, [isEditing]);
17745
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: (0, import_clsx35.default)("relative flex-row-2", { "flex-1": isEditing }), children: [
17758
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: (0, import_clsx34.default)("relative flex-row-2", { "flex-1": isEditing }), children: [
17746
17759
  /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
17747
17760
  Input,
17748
17761
  {
@@ -17768,8 +17781,8 @@ var ToggleableInput = (0, import_react84.forwardRef)(function ToggleableInput2({
17768
17781
  }
17769
17782
  ),
17770
17783
  !isEditing && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "absolute left-0 flex-row-2 items-center pointer-events-none touch-none w-full overflow-hidden", children: [
17771
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: (0, import_clsx35.default)(" truncate"), children: value }),
17772
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react23.Pencil, { className: (0, import_clsx35.default)(`size-force-4`, { "text-transparent": isEditing }) })
17784
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: (0, import_clsx34.default)(" truncate"), children: value }),
17785
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react23.Pencil, { className: (0, import_clsx34.default)(`size-force-4`, { "text-transparent": isEditing }) })
17773
17786
  ] })
17774
17787
  ] });
17775
17788
  });
@@ -17778,7 +17791,7 @@ var ToggleableInput = (0, import_react84.forwardRef)(function ToggleableInput2({
17778
17791
  var import_lucide_react25 = require("lucide-react");
17779
17792
 
17780
17793
  // src/components/user-interaction/properties/PropertyBase.tsx
17781
- var import_clsx36 = __toESM(require("clsx"));
17794
+ var import_clsx35 = __toESM(require("clsx"));
17782
17795
  var import_lucide_react24 = require("lucide-react");
17783
17796
  var import_jsx_runtime87 = require("react/jsx-runtime");
17784
17797
  var PropertyBase = ({
@@ -17802,7 +17815,7 @@ var PropertyBase = ({
17802
17815
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
17803
17816
  "div",
17804
17817
  {
17805
- className: (0, import_clsx36.default)("group/property", className),
17818
+ className: (0, import_clsx35.default)("group/property", className),
17806
17819
  "data-name": "property-root",
17807
17820
  "data-invalid": PropsUtil.dataAttributes.bool(invalid),
17808
17821
  children: [
@@ -18527,13 +18540,60 @@ var useSearch = ({
18527
18540
  };
18528
18541
  };
18529
18542
 
18543
+ // src/hooks/useUpdatingDateStrings.ts
18544
+ var import_react95 = require("react");
18545
+ var useUpdatingDateTime = ({ absoluteFormat, localeOverride, date }) => {
18546
+ const { locale: contextLocale } = useLocale();
18547
+ const locale = localeOverride ?? contextLocale;
18548
+ const [dateAndTimeStrings, setDateAndTimeStrings] = (0, import_react95.useState)({
18549
+ compareDate: date,
18550
+ absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
18551
+ relative: DateUtils.formatRelative(date, locale)
18552
+ });
18553
+ (0, import_react95.useEffect)(() => {
18554
+ setDateAndTimeStrings({
18555
+ compareDate: date,
18556
+ absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
18557
+ relative: DateUtils.formatRelative(date, locale)
18558
+ });
18559
+ }, [date, absoluteFormat, locale]);
18560
+ (0, import_react95.useEffect)(() => {
18561
+ let timeoutId;
18562
+ const startTimer = () => {
18563
+ const now = /* @__PURE__ */ new Date();
18564
+ const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
18565
+ let delayInSeconds;
18566
+ if (diff < DateUtils.timesInSeconds.minute) {
18567
+ delayInSeconds = DateUtils.timesInSeconds.second;
18568
+ } else if (diff < DateUtils.timesInSeconds.hour) {
18569
+ delayInSeconds = DateUtils.timesInSeconds.minute;
18570
+ } else {
18571
+ delayInSeconds = DateUtils.timesInSeconds.hour;
18572
+ }
18573
+ timeoutId = setInterval(() => {
18574
+ setDateAndTimeStrings({
18575
+ compareDate: date,
18576
+ absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
18577
+ relative: DateUtils.formatRelative(date, locale)
18578
+ });
18579
+ }, delayInSeconds * 1e3 / 2);
18580
+ };
18581
+ startTimer();
18582
+ return () => clearInterval(timeoutId);
18583
+ }, [absoluteFormat, date, locale]);
18584
+ return {
18585
+ absolute: dateAndTimeStrings.absolute,
18586
+ relative: dateAndTimeStrings.relative
18587
+ };
18588
+ };
18589
+
18530
18590
  // src/utils/emailValidation.ts
18531
18591
  var validateEmail = (email) => {
18532
18592
  return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
18533
18593
  };
18534
18594
 
18535
18595
  // src/hooks/useValidators.ts
18536
- var import_react95 = require("react");
18596
+ var import_react96 = require("react");
18537
18597
  var notEmpty = (value) => {
18538
18598
  if (!value) {
18539
18599
  return "notEmpty";
@@ -18583,7 +18643,7 @@ var UseValidators = {
18583
18643
  };
18584
18644
  var useTranslatedValidators = () => {
18585
18645
  const translation = useHightideTranslation();
18586
- return (0, import_react95.useMemo)(() => ({
18646
+ return (0, import_react96.useMemo)(() => ({
18587
18647
  notEmpty: (value) => {
18588
18648
  const result = notEmpty(value);
18589
18649
  if (result) {
@@ -19022,9 +19082,7 @@ var PromiseUtils = {
19022
19082
  VerticalDivider,
19023
19083
  Visibility,
19024
19084
  YearMonthPicker,
19025
- addDuration,
19026
19085
  builder,
19027
- changeDuration,
19028
19086
  closestMatch,
19029
19087
  createLoopingList,
19030
19088
  createLoopingListWithIndex,
@@ -19037,21 +19095,15 @@ var PromiseUtils = {
19037
19095
  filterTags,
19038
19096
  filterTagsSingle,
19039
19097
  filterText,
19040
- formatDate,
19041
- formatDateTime,
19042
- getBetweenDuration,
19043
19098
  getNeighbours,
19044
- getWeeksForCalenderMonth,
19045
19099
  hightideTranslation,
19046
19100
  hightideTranslationLocales,
19047
- isInTimeSpan,
19048
19101
  isTableFilterCategory,
19049
19102
  match,
19050
19103
  mergeProps,
19051
19104
  noop,
19052
19105
  range,
19053
19106
  resolveSetState,
19054
- subtractDuration,
19055
19107
  toSizeVars,
19056
19108
  useAnchoredPosition,
19057
19109
  useControlledState,
@@ -19097,6 +19149,7 @@ var PromiseUtils = {
19097
19149
  useTooltip,
19098
19150
  useTransitionState,
19099
19151
  useTranslatedValidators,
19152
+ useUpdatingDateTime,
19100
19153
  useWindowResizeObserver,
19101
19154
  validateEmail,
19102
19155
  writeToClipboard