@helpwave/hightide 0.8.1 → 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.d.mts +34 -22
- package/dist/index.d.ts +34 -22
- package/dist/index.js +343 -296
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +340 -286
- package/dist/index.mjs.map +1 -1
- package/dist/style/globals.css +7 -0
- package/dist/style/uncompiled/theme/components/date-time-input.css +7 -0
- package/package.json +1 -1
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
|
|
@@ -14578,7 +14571,7 @@ var TableBody = import_react63.default.memo(function TableBodyVisual() {
|
|
|
14578
14571
|
|
|
14579
14572
|
// src/components/layout/table/TableHeader.tsx
|
|
14580
14573
|
var import_react_table3 = require("@tanstack/react-table");
|
|
14581
|
-
var
|
|
14574
|
+
var import_clsx25 = __toESM(require("clsx"));
|
|
14582
14575
|
|
|
14583
14576
|
// src/components/layout/table/TableSortButton.tsx
|
|
14584
14577
|
var import_lucide_react14 = require("lucide-react");
|
|
@@ -14636,179 +14629,6 @@ var import_react72 = require("react");
|
|
|
14636
14629
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
14637
14630
|
var import_react68 = require("react");
|
|
14638
14631
|
var import_lucide_react16 = require("lucide-react");
|
|
14639
|
-
var import_clsx25 = __toESM(require("clsx"));
|
|
14640
|
-
|
|
14641
|
-
// src/utils/date.ts
|
|
14642
|
-
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14643
|
-
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14644
|
-
var formatDate = (date) => {
|
|
14645
|
-
const year = date.getFullYear().toString().padStart(4, "0");
|
|
14646
|
-
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
14647
|
-
const day = date.getDate().toString().padStart(2, "0");
|
|
14648
|
-
return `${year}-${month}-${day}`;
|
|
14649
|
-
};
|
|
14650
|
-
var formatDateTime = (date) => {
|
|
14651
|
-
const dateString = formatDate(date);
|
|
14652
|
-
const hours = date.getHours().toString().padStart(2, "0");
|
|
14653
|
-
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
14654
|
-
return `${dateString}T${hours}:${minutes}`;
|
|
14655
|
-
};
|
|
14656
|
-
var changeDuration = (date, duration, isAdding) => {
|
|
14657
|
-
const {
|
|
14658
|
-
years = 0,
|
|
14659
|
-
months = 0,
|
|
14660
|
-
days = 0,
|
|
14661
|
-
hours = 0,
|
|
14662
|
-
minutes = 0,
|
|
14663
|
-
seconds = 0,
|
|
14664
|
-
milliseconds = 0
|
|
14665
|
-
} = duration;
|
|
14666
|
-
if (years < 0) {
|
|
14667
|
-
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14668
|
-
return new Date(date);
|
|
14669
|
-
}
|
|
14670
|
-
if (months < 0 || months > 11) {
|
|
14671
|
-
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14672
|
-
return new Date(date);
|
|
14673
|
-
}
|
|
14674
|
-
if (days < 0) {
|
|
14675
|
-
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14676
|
-
return new Date(date);
|
|
14677
|
-
}
|
|
14678
|
-
if (hours < 0 || hours > 23) {
|
|
14679
|
-
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14680
|
-
return new Date(date);
|
|
14681
|
-
}
|
|
14682
|
-
if (minutes < 0 || minutes > 59) {
|
|
14683
|
-
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14684
|
-
return new Date(date);
|
|
14685
|
-
}
|
|
14686
|
-
if (seconds < 0 || seconds > 59) {
|
|
14687
|
-
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14688
|
-
return new Date(date);
|
|
14689
|
-
}
|
|
14690
|
-
if (milliseconds < 0) {
|
|
14691
|
-
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14692
|
-
return new Date(date);
|
|
14693
|
-
}
|
|
14694
|
-
const multiplier = isAdding ? 1 : -1;
|
|
14695
|
-
const newDate = new Date(date);
|
|
14696
|
-
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14697
|
-
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14698
|
-
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14699
|
-
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14700
|
-
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14701
|
-
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14702
|
-
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14703
|
-
return newDate;
|
|
14704
|
-
};
|
|
14705
|
-
var addDuration = (date, duration) => {
|
|
14706
|
-
return changeDuration(date, duration, true);
|
|
14707
|
-
};
|
|
14708
|
-
var subtractDuration = (date, duration) => {
|
|
14709
|
-
return changeDuration(date, duration, false);
|
|
14710
|
-
};
|
|
14711
|
-
var getBetweenDuration = (startDate, endDate) => {
|
|
14712
|
-
const durationInMilliseconds = endDate.getTime() - startDate.getTime();
|
|
14713
|
-
const millisecondsInSecond = 1e3;
|
|
14714
|
-
const millisecondsInMinute = 60 * millisecondsInSecond;
|
|
14715
|
-
const millisecondsInHour = 60 * millisecondsInMinute;
|
|
14716
|
-
const millisecondsInDay = 24 * millisecondsInHour;
|
|
14717
|
-
const millisecondsInMonth = 30 * millisecondsInDay;
|
|
14718
|
-
const years = Math.floor(durationInMilliseconds / (365.25 * millisecondsInDay));
|
|
14719
|
-
const months = Math.floor(durationInMilliseconds / millisecondsInMonth);
|
|
14720
|
-
const days = Math.floor(durationInMilliseconds / millisecondsInDay);
|
|
14721
|
-
const hours = Math.floor(durationInMilliseconds % millisecondsInDay / millisecondsInHour);
|
|
14722
|
-
const seconds = Math.floor(durationInMilliseconds % millisecondsInHour / millisecondsInSecond);
|
|
14723
|
-
const milliseconds = durationInMilliseconds % millisecondsInSecond;
|
|
14724
|
-
return {
|
|
14725
|
-
years,
|
|
14726
|
-
months,
|
|
14727
|
-
days,
|
|
14728
|
-
hours,
|
|
14729
|
-
seconds,
|
|
14730
|
-
milliseconds
|
|
14731
|
-
};
|
|
14732
|
-
};
|
|
14733
|
-
var isInTimeSpan = (value, startDate, endDate) => {
|
|
14734
|
-
if (startDate && endDate) {
|
|
14735
|
-
console.assert(startDate <= endDate);
|
|
14736
|
-
return startDate <= value && value <= endDate;
|
|
14737
|
-
} else if (startDate) {
|
|
14738
|
-
return startDate <= value;
|
|
14739
|
-
} else if (endDate) {
|
|
14740
|
-
return endDate >= value;
|
|
14741
|
-
} else {
|
|
14742
|
-
return true;
|
|
14743
|
-
}
|
|
14744
|
-
};
|
|
14745
|
-
var equalDate = (date1, date2) => {
|
|
14746
|
-
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14747
|
-
};
|
|
14748
|
-
var getWeeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14749
|
-
const month = date.getMonth();
|
|
14750
|
-
const year = date.getFullYear();
|
|
14751
|
-
const dayList = [];
|
|
14752
|
-
let currentDate = new Date(year, month, 1);
|
|
14753
|
-
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14754
|
-
while (currentDate.getDay() !== weekStartIndex) {
|
|
14755
|
-
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14756
|
-
}
|
|
14757
|
-
while (dayList.length < 7 * weeks) {
|
|
14758
|
-
const date2 = new Date(currentDate);
|
|
14759
|
-
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14760
|
-
dayList.push(date2);
|
|
14761
|
-
currentDate = addDuration(currentDate, { days: 1 });
|
|
14762
|
-
}
|
|
14763
|
-
return equalSizeGroups(dayList, 7);
|
|
14764
|
-
};
|
|
14765
|
-
var formatGerman = (date, showTime) => {
|
|
14766
|
-
const d = new Intl.DateTimeFormat("de-DE", {
|
|
14767
|
-
day: "2-digit",
|
|
14768
|
-
month: "2-digit",
|
|
14769
|
-
year: "numeric"
|
|
14770
|
-
}).format(date);
|
|
14771
|
-
if (!showTime) return d;
|
|
14772
|
-
const t = new Intl.DateTimeFormat("de-DE", {
|
|
14773
|
-
hour: "2-digit",
|
|
14774
|
-
minute: "2-digit"
|
|
14775
|
-
}).format(date);
|
|
14776
|
-
return `${d} um ${t} Uhr`;
|
|
14777
|
-
};
|
|
14778
|
-
var formatAbsolute = (date, locale, showTime) => {
|
|
14779
|
-
if (locale === "de-DE") {
|
|
14780
|
-
return formatGerman(date, showTime);
|
|
14781
|
-
}
|
|
14782
|
-
const options = {
|
|
14783
|
-
year: "numeric",
|
|
14784
|
-
month: "numeric",
|
|
14785
|
-
day: "numeric"
|
|
14786
|
-
};
|
|
14787
|
-
if (showTime) {
|
|
14788
|
-
options.hour = "numeric";
|
|
14789
|
-
options.minute = "numeric";
|
|
14790
|
-
}
|
|
14791
|
-
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14792
|
-
};
|
|
14793
|
-
var formatRelative = (date, locale, showTime) => {
|
|
14794
|
-
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14795
|
-
const now = /* @__PURE__ */ new Date();
|
|
14796
|
-
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14797
|
-
if (Math.abs(diffInSeconds) < 60) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14798
|
-
if (Math.abs(diffInSeconds) < 3600) return rtf.format(Math.round(diffInSeconds / 60), "minute");
|
|
14799
|
-
if (Math.abs(diffInSeconds) < 86400) return rtf.format(Math.round(diffInSeconds / 3600), "hour");
|
|
14800
|
-
if (Math.abs(diffInSeconds) < 604800) return rtf.format(Math.round(diffInSeconds / 86400), "day");
|
|
14801
|
-
return formatAbsolute(date, locale, showTime);
|
|
14802
|
-
};
|
|
14803
|
-
var DateUtils = {
|
|
14804
|
-
monthsList,
|
|
14805
|
-
weekDayList,
|
|
14806
|
-
equalDate,
|
|
14807
|
-
formatAbsolute,
|
|
14808
|
-
formatRelative
|
|
14809
|
-
};
|
|
14810
|
-
|
|
14811
|
-
// src/components/user-interaction/date/DateTimePicker.tsx
|
|
14812
14632
|
var import_clsx24 = __toESM(require("clsx"));
|
|
14813
14633
|
|
|
14814
14634
|
// src/components/user-interaction/date/TimePicker.tsx
|
|
@@ -14926,6 +14746,173 @@ var TimePicker = ({
|
|
|
14926
14746
|
// src/components/user-interaction/date/DatePicker.tsx
|
|
14927
14747
|
var import_react67 = require("react");
|
|
14928
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
|
|
14929
14916
|
var import_clsx23 = __toESM(require("clsx"));
|
|
14930
14917
|
|
|
14931
14918
|
// src/components/user-interaction/date/DayPicker.tsx
|
|
@@ -14957,7 +14944,7 @@ var DayPicker = ({
|
|
|
14957
14944
|
defaultValue: initialDisplayedMonth ?? value
|
|
14958
14945
|
});
|
|
14959
14946
|
const month = displayedMonth.getMonth();
|
|
14960
|
-
const weeks =
|
|
14947
|
+
const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
|
|
14961
14948
|
const selectedButtonRef = (0, import_react65.useRef)(null);
|
|
14962
14949
|
const isValueInDisplayedWeeks = (0, import_react65.useMemo)(
|
|
14963
14950
|
() => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
|
|
@@ -14986,7 +14973,7 @@ var DayPicker = ({
|
|
|
14986
14973
|
}, [start, end]);
|
|
14987
14974
|
const navigateTo = (0, import_react65.useCallback)((candidate) => {
|
|
14988
14975
|
const clamped = clampToRange(candidate);
|
|
14989
|
-
if (!
|
|
14976
|
+
if (!DateUtils.between(clamped, start, end)) return;
|
|
14990
14977
|
setValue(clamped);
|
|
14991
14978
|
onEditComplete?.(clamped);
|
|
14992
14979
|
if (clamped.getMonth() !== displayedMonth.getMonth() || clamped.getFullYear() !== displayedMonth.getFullYear()) {
|
|
@@ -14996,10 +14983,10 @@ var DayPicker = ({
|
|
|
14996
14983
|
const onKeyDown = (0, import_react65.useCallback)(
|
|
14997
14984
|
(event) => {
|
|
14998
14985
|
PropsUtil.aria.navigate({
|
|
14999
|
-
left: () => focusTargetDate && navigateTo(subtractDuration(focusTargetDate, { days: 1 })),
|
|
15000
|
-
right: () => focusTargetDate && navigateTo(addDuration(focusTargetDate, { days: 1 })),
|
|
15001
|
-
up: () => focusTargetDate && navigateTo(subtractDuration(focusTargetDate, { days: 7 })),
|
|
15002
|
-
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 }))
|
|
15003
14990
|
})(event);
|
|
15004
14991
|
},
|
|
15005
14992
|
[focusTargetDate, navigateTo]
|
|
@@ -15011,7 +14998,7 @@ var DayPicker = ({
|
|
|
15011
14998
|
const isFocused = !!focusTargetDate && DateUtils.equalDate(focusTargetDate, date);
|
|
15012
14999
|
const isToday = DateUtils.equalDate(/* @__PURE__ */ new Date(), date);
|
|
15013
15000
|
const isSameMonth = date.getMonth() === month;
|
|
15014
|
-
const isDayValid =
|
|
15001
|
+
const isDayValid = DateUtils.between(date, start, end);
|
|
15015
15002
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
15016
15003
|
"div",
|
|
15017
15004
|
{
|
|
@@ -15105,8 +15092,8 @@ var YearRow = (0, import_react66.memo)(function YearRow2({
|
|
|
15105
15092
|
}
|
|
15106
15093
|
);
|
|
15107
15094
|
});
|
|
15108
|
-
var defaultStart = subtractDuration(/* @__PURE__ */ new Date(), { years: 100 });
|
|
15109
|
-
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 });
|
|
15110
15097
|
var YearMonthPicker = ({
|
|
15111
15098
|
value: controlledValue,
|
|
15112
15099
|
initialValue = /* @__PURE__ */ new Date(),
|
|
@@ -15232,9 +15219,9 @@ var DatePicker = ({
|
|
|
15232
15219
|
{
|
|
15233
15220
|
tooltip: translation("time.previousMonth"),
|
|
15234
15221
|
size: "sm",
|
|
15235
|
-
disabled: !
|
|
15222
|
+
disabled: !DateUtils.between(DateUtils.subtractDuration(displayedMonth, { months: 1 }), start, end),
|
|
15236
15223
|
onClick: () => {
|
|
15237
|
-
setDisplayedMonth(subtractDuration(displayedMonth, { months: 1 }));
|
|
15224
|
+
setDisplayedMonth(DateUtils.subtractDuration(displayedMonth, { months: 1 }));
|
|
15238
15225
|
},
|
|
15239
15226
|
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react15.ArrowUp, { size: 20 })
|
|
15240
15227
|
}
|
|
@@ -15244,9 +15231,9 @@ var DatePicker = ({
|
|
|
15244
15231
|
{
|
|
15245
15232
|
tooltip: translation("time.nextMonth"),
|
|
15246
15233
|
size: "sm",
|
|
15247
|
-
disabled: !
|
|
15234
|
+
disabled: !DateUtils.between(DateUtils.addDuration(displayedMonth, { months: 1 }), start, end),
|
|
15248
15235
|
onClick: () => {
|
|
15249
|
-
setDisplayedMonth(addDuration(displayedMonth, { months: 1 }));
|
|
15236
|
+
setDisplayedMonth(DateUtils.addDuration(displayedMonth, { months: 1 }));
|
|
15250
15237
|
},
|
|
15251
15238
|
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react15.ArrowDown, { size: 20 })
|
|
15252
15239
|
}
|
|
@@ -15336,7 +15323,6 @@ var DateTimePicker = ({
|
|
|
15336
15323
|
...timePickerProps,
|
|
15337
15324
|
is24HourFormat,
|
|
15338
15325
|
minuteIncrement,
|
|
15339
|
-
className: (0, import_clsx24.default)({ "justify-between": mode === "time" }),
|
|
15340
15326
|
value,
|
|
15341
15327
|
onValueChange: setValue,
|
|
15342
15328
|
onEditComplete
|
|
@@ -15432,9 +15418,9 @@ var DateTimePickerDialog = ({
|
|
|
15432
15418
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
15433
15419
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
15434
15420
|
var DateTimeInput = (0, import_react68.forwardRef)(function DateTimeInput2({
|
|
15421
|
+
id: inputId,
|
|
15435
15422
|
value,
|
|
15436
15423
|
initialValue = null,
|
|
15437
|
-
placeholder,
|
|
15438
15424
|
onValueChange,
|
|
15439
15425
|
onEditComplete,
|
|
15440
15426
|
allowRemove = false,
|
|
@@ -15450,7 +15436,6 @@ var DateTimeInput = (0, import_react68.forwardRef)(function DateTimeInput2({
|
|
|
15450
15436
|
...props
|
|
15451
15437
|
}, forwardedRef) {
|
|
15452
15438
|
const translation = useHightideTranslation();
|
|
15453
|
-
const { locale } = useLocale();
|
|
15454
15439
|
const [isOpen, setIsOpen] = (0, import_react68.useState)(false);
|
|
15455
15440
|
const [state, setState] = useControlledState({
|
|
15456
15441
|
value,
|
|
@@ -15458,19 +15443,21 @@ var DateTimeInput = (0, import_react68.forwardRef)(function DateTimeInput2({
|
|
|
15458
15443
|
defaultValue: initialValue
|
|
15459
15444
|
});
|
|
15460
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) : "");
|
|
15461
15447
|
(0, import_react68.useEffect)(() => {
|
|
15462
15448
|
setDialogValue(state ?? /* @__PURE__ */ new Date());
|
|
15463
|
-
|
|
15449
|
+
setDateString(state ? DateUtils.toInputString(state, mode) : "");
|
|
15450
|
+
}, [mode, state]);
|
|
15464
15451
|
const changeOpenWrapper = (0, import_react68.useCallback)((isOpen2) => {
|
|
15465
15452
|
onDialogOpeningChange?.(isOpen2);
|
|
15466
15453
|
setIsOpen(isOpen2);
|
|
15467
15454
|
}, [onDialogOpeningChange]);
|
|
15468
|
-
const
|
|
15455
|
+
const generatedId = (0, import_react68.useId)();
|
|
15469
15456
|
const ids = (0, import_react68.useMemo)(() => ({
|
|
15470
|
-
input: `date-time-input-${
|
|
15471
|
-
popup: `date-time-input-popup-${
|
|
15472
|
-
label: `date-time-input-label-${
|
|
15473
|
-
}), [
|
|
15457
|
+
input: inputId ?? `date-time-input-${generatedId}`,
|
|
15458
|
+
popup: `date-time-input-popup-${generatedId}`,
|
|
15459
|
+
label: `date-time-input-label-${generatedId}`
|
|
15460
|
+
}), [generatedId, inputId]);
|
|
15474
15461
|
const innerRef = (0, import_react68.useRef)(null);
|
|
15475
15462
|
(0, import_react68.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
15476
15463
|
(0, import_react68.useEffect)(() => {
|
|
@@ -15478,30 +15465,28 @@ var DateTimeInput = (0, import_react68.forwardRef)(function DateTimeInput2({
|
|
|
15478
15465
|
changeOpenWrapper(false);
|
|
15479
15466
|
}
|
|
15480
15467
|
}, [changeOpenWrapper, readOnly, disabled]);
|
|
15481
|
-
const clickHandler = PropsUtil.aria.click(() => changeOpenWrapper(true));
|
|
15482
15468
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
15483
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { ...containerProps, className: (0,
|
|
15469
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { ...containerProps, className: (0, import_clsx24.default)("relative w-full", containerProps?.className), children: [
|
|
15484
15470
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
15485
|
-
"
|
|
15471
|
+
"input",
|
|
15486
15472
|
{
|
|
15487
15473
|
...props,
|
|
15488
15474
|
ref: innerRef,
|
|
15489
15475
|
id: ids.input,
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
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
|
+
}
|
|
15493
15484
|
},
|
|
15494
|
-
|
|
15485
|
+
type: mode === "date" ? "date" : mode === "time" ? "time" : "datetime-local",
|
|
15495
15486
|
...PropsUtil.dataAttributes.interactionStates({ disabled, readOnly, invalid, required }),
|
|
15496
|
-
"data-value": PropsUtil.dataAttributes.bool(!!state),
|
|
15497
|
-
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props),
|
|
15498
|
-
tabIndex: 0,
|
|
15499
|
-
role: "combobox",
|
|
15500
|
-
"aria-haspopup": "dialog",
|
|
15501
|
-
"aria-expanded": isOpen,
|
|
15502
|
-
"aria-controls": isOpen ? ids.popup : void 0,
|
|
15503
15487
|
"data-name": props["data-name"] ?? "date-time-input",
|
|
15504
|
-
|
|
15488
|
+
"data-value": PropsUtil.dataAttributes.bool(!!state || !!dateString),
|
|
15489
|
+
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props)
|
|
15505
15490
|
}
|
|
15506
15491
|
),
|
|
15507
15492
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Visibility, { isVisible: !readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
@@ -15969,6 +15954,12 @@ var NumberFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15969
15954
|
};
|
|
15970
15955
|
var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
15971
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
|
+
};
|
|
15972
15963
|
const operator = filterValue?.operator ?? "dateBetween";
|
|
15973
15964
|
const parameter = filterValue?.parameter ?? {};
|
|
15974
15965
|
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0, import_react71.useState)(null);
|
|
@@ -15996,11 +15987,12 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15996
15987
|
),
|
|
15997
15988
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
15998
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") }),
|
|
15999
15991
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
16000
15992
|
DateTimeInput,
|
|
16001
15993
|
{
|
|
15994
|
+
id: ids.startDate,
|
|
16002
15995
|
value: temporaryMinDateValue ?? parameter.min ?? null,
|
|
16003
|
-
placeholder: translation("startDate"),
|
|
16004
15996
|
onValueChange: (value) => setTemporaryMinDateValue(value),
|
|
16005
15997
|
onEditComplete: (value) => {
|
|
16006
15998
|
if (value && parameter.max && value > parameter.max) {
|
|
@@ -16029,11 +16021,12 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
16029
16021
|
className: "min-w-64"
|
|
16030
16022
|
}
|
|
16031
16023
|
),
|
|
16024
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: ids.endDate, className: "typography-label-md", children: translation("endDate") }),
|
|
16032
16025
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
16033
16026
|
DateTimeInput,
|
|
16034
16027
|
{
|
|
16028
|
+
id: ids.endDate,
|
|
16035
16029
|
value: temporaryMaxDateValue ?? parameter.max ?? null,
|
|
16036
|
-
placeholder: translation("endDate"),
|
|
16037
16030
|
onValueChange: (value) => setTemporaryMaxDateValue(value),
|
|
16038
16031
|
onEditComplete: (value) => {
|
|
16039
16032
|
if (value && parameter.min && value < parameter.min) {
|
|
@@ -16062,27 +16055,36 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
16062
16055
|
}
|
|
16063
16056
|
)
|
|
16064
16057
|
] }) }),
|
|
16065
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
|
|
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
|
+
] }),
|
|
16081
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") }) })
|
|
16082
16078
|
] });
|
|
16083
16079
|
};
|
|
16084
16080
|
var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
16085
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
|
+
};
|
|
16086
16088
|
const operator = filterValue?.operator ?? "dateTimeBetween";
|
|
16087
16089
|
const parameter = filterValue?.parameter ?? {};
|
|
16088
16090
|
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0, import_react71.useState)(null);
|
|
@@ -16110,12 +16112,13 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
16110
16112
|
),
|
|
16111
16113
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
16112
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") }),
|
|
16113
16116
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
16114
16117
|
DateTimeInput,
|
|
16115
16118
|
{
|
|
16119
|
+
id: ids.startDate,
|
|
16116
16120
|
mode: "dateTime",
|
|
16117
16121
|
value: temporaryMinDateValue ?? parameter.min ?? null,
|
|
16118
|
-
placeholder: translation("startDate"),
|
|
16119
16122
|
onValueChange: (value) => setTemporaryMinDateValue(value),
|
|
16120
16123
|
onEditComplete: (value) => {
|
|
16121
16124
|
if (value && parameter.max && value > parameter.max) {
|
|
@@ -16144,12 +16147,13 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
16144
16147
|
className: "min-w-64"
|
|
16145
16148
|
}
|
|
16146
16149
|
),
|
|
16150
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: ids.endDate, className: "typography-label-md", children: translation("endDate") }),
|
|
16147
16151
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
16148
16152
|
DateTimeInput,
|
|
16149
16153
|
{
|
|
16154
|
+
id: ids.endDate,
|
|
16150
16155
|
mode: "dateTime",
|
|
16151
16156
|
value: temporaryMaxDateValue ?? parameter.max ?? null,
|
|
16152
|
-
placeholder: translation("endDate"),
|
|
16153
16157
|
onValueChange: (value) => setTemporaryMaxDateValue(value),
|
|
16154
16158
|
onEditComplete: (value) => {
|
|
16155
16159
|
if (value && parameter.min && value < parameter.min) {
|
|
@@ -16178,22 +16182,25 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
16178
16182
|
}
|
|
16179
16183
|
)
|
|
16180
16184
|
] }) }),
|
|
16181
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
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
|
+
] }),
|
|
16197
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") }) })
|
|
16198
16205
|
] });
|
|
16199
16206
|
};
|
|
@@ -16530,14 +16537,14 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
16530
16537
|
},
|
|
16531
16538
|
header.id
|
|
16532
16539
|
)) }) }, headerGroup.id)),
|
|
16533
|
-
/* @__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,
|
|
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) => {
|
|
16534
16541
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
16535
16542
|
"th",
|
|
16536
16543
|
{
|
|
16537
16544
|
colSpan: header.colSpan,
|
|
16538
16545
|
"data-sticky": isSticky ? "" : void 0,
|
|
16539
16546
|
"data-name": "table-header-cell",
|
|
16540
|
-
className: (0,
|
|
16547
|
+
className: (0, import_clsx25.default)("group/table-header-cell", header.column.columnDef.meta?.className),
|
|
16541
16548
|
children: [
|
|
16542
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: [
|
|
16543
16550
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Visibility, { isVisible: header.column.getCanSort(), children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
@@ -16637,7 +16644,7 @@ var TableDisplay = ({
|
|
|
16637
16644
|
};
|
|
16638
16645
|
|
|
16639
16646
|
// src/components/layout/table/TablePagination.tsx
|
|
16640
|
-
var
|
|
16647
|
+
var import_clsx26 = __toESM(require("clsx"));
|
|
16641
16648
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
16642
16649
|
var TablePaginationMenu = ({ ...props }) => {
|
|
16643
16650
|
const { table } = useTableStateWithoutSizingContext();
|
|
@@ -16672,7 +16679,7 @@ var TablePageSizeSelect = ({
|
|
|
16672
16679
|
);
|
|
16673
16680
|
};
|
|
16674
16681
|
var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props }) => {
|
|
16675
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { ...props, className: (0,
|
|
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: [
|
|
16676
16683
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(TablePaginationMenu, {}),
|
|
16677
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" } }) })
|
|
16678
16685
|
] });
|
|
@@ -16765,11 +16772,11 @@ var TableWithSelectionProvider = ({
|
|
|
16765
16772
|
};
|
|
16766
16773
|
|
|
16767
16774
|
// src/components/layout/table/Table.tsx
|
|
16768
|
-
var
|
|
16775
|
+
var import_clsx27 = __toESM(require("clsx"));
|
|
16769
16776
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
16770
16777
|
var Table = ({ children, table, paginationOptions, displayProps, header, footer, ...props }) => {
|
|
16771
16778
|
const { showPagination = true, allowChangingPageSize, pageSizeOptions } = paginationOptions ?? {};
|
|
16772
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ...props, className: (0,
|
|
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: [
|
|
16773
16780
|
header,
|
|
16774
16781
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TableDisplay, { ...displayProps, children }),
|
|
16775
16782
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Visibility, { isVisible: showPagination, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TablePagination, { allowChangingPageSize, pageSizeOptions }) }),
|
|
@@ -16786,7 +16793,7 @@ var TableWithSelection = ({
|
|
|
16786
16793
|
...props
|
|
16787
16794
|
}) => {
|
|
16788
16795
|
const { showPagination = true, allowChangingPageSize, pageSizeOptions } = paginationOptions ?? {};
|
|
16789
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ...props, className: (0,
|
|
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: [
|
|
16790
16797
|
header,
|
|
16791
16798
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TableDisplay, { ...displayProps, children }),
|
|
16792
16799
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Visibility, { isVisible: showPagination, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TablePagination, { allowChangingPageSize, pageSizeOptions }) }),
|
|
@@ -17105,7 +17112,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
17105
17112
|
|
|
17106
17113
|
// src/components/user-interaction/CopyToClipboardWrapper.tsx
|
|
17107
17114
|
var import_react77 = require("react");
|
|
17108
|
-
var
|
|
17115
|
+
var import_clsx28 = require("clsx");
|
|
17109
17116
|
|
|
17110
17117
|
// src/utils/writeToClipboard.ts
|
|
17111
17118
|
var writeToClipboard = (text) => {
|
|
@@ -17144,7 +17151,7 @@ var CopyToClipboardWrapper = ({
|
|
|
17144
17151
|
"div",
|
|
17145
17152
|
{
|
|
17146
17153
|
ref: callbackRef,
|
|
17147
|
-
className: (0,
|
|
17154
|
+
className: (0, import_clsx28.clsx)("w-fit hover:cursor-copy", containerClassName),
|
|
17148
17155
|
...disabled2 ? void 0 : props2,
|
|
17149
17156
|
onClick: () => {
|
|
17150
17157
|
if (disabled2) return;
|
|
@@ -17177,7 +17184,7 @@ var CopyToClipboardWrapper = ({
|
|
|
17177
17184
|
|
|
17178
17185
|
// src/components/user-interaction/Menu.tsx
|
|
17179
17186
|
var import_react78 = require("react");
|
|
17180
|
-
var
|
|
17187
|
+
var import_clsx29 = __toESM(require("clsx"));
|
|
17181
17188
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
17182
17189
|
var MenuItem = ({
|
|
17183
17190
|
children,
|
|
@@ -17187,7 +17194,7 @@ var MenuItem = ({
|
|
|
17187
17194
|
}) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
17188
17195
|
"div",
|
|
17189
17196
|
{
|
|
17190
|
-
className: (0,
|
|
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", {
|
|
17191
17198
|
"text-disabled cursor-not-allowed": isDisabled,
|
|
17192
17199
|
"text-menu-text hover:bg-primary/20": !isDisabled,
|
|
17193
17200
|
"cursor-pointer": !!onClick
|
|
@@ -17234,7 +17241,7 @@ var Menu = ({
|
|
|
17234
17241
|
|
|
17235
17242
|
// src/components/user-interaction/ScrollPicker.tsx
|
|
17236
17243
|
var import_react79 = require("react");
|
|
17237
|
-
var
|
|
17244
|
+
var import_clsx30 = __toESM(require("clsx"));
|
|
17238
17245
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
17239
17246
|
var up = 1;
|
|
17240
17247
|
var down = -1;
|
|
@@ -17404,7 +17411,7 @@ var ScrollPicker = ({
|
|
|
17404
17411
|
children: shownItems.map(({ name, index }, arrayIndex) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
17405
17412
|
"div",
|
|
17406
17413
|
{
|
|
17407
|
-
className: (0,
|
|
17414
|
+
className: (0, import_clsx30.default)(
|
|
17408
17415
|
`flex-col-2 items-center justify-center rounded-md`,
|
|
17409
17416
|
{
|
|
17410
17417
|
"text-primary font-bold": currentIndex === index,
|
|
@@ -17487,7 +17494,7 @@ var Switch = ({
|
|
|
17487
17494
|
|
|
17488
17495
|
// src/components/user-interaction/Textarea.tsx
|
|
17489
17496
|
var import_react81 = require("react");
|
|
17490
|
-
var
|
|
17497
|
+
var import_clsx31 = __toESM(require("clsx"));
|
|
17491
17498
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
17492
17499
|
var Textarea = (0, import_react81.forwardRef)(function Textarea2({
|
|
17493
17500
|
value: controlledValue,
|
|
@@ -17548,7 +17555,7 @@ var TextareaWithHeadline = ({
|
|
|
17548
17555
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
17549
17556
|
"div",
|
|
17550
17557
|
{
|
|
17551
|
-
className: (0,
|
|
17558
|
+
className: (0, import_clsx31.default)(
|
|
17552
17559
|
"group flex-col-3 border-2 rounded-lg",
|
|
17553
17560
|
{
|
|
17554
17561
|
"bg-input-background text-input-text hover:border-primary focus-within:border-primary": !disabled,
|
|
@@ -17557,13 +17564,13 @@ var TextareaWithHeadline = ({
|
|
|
17557
17564
|
containerClassName
|
|
17558
17565
|
),
|
|
17559
17566
|
children: [
|
|
17560
|
-
headline && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("label", { ...headlineProps, htmlFor: usedId, className: (0,
|
|
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 }),
|
|
17561
17568
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
17562
17569
|
Textarea,
|
|
17563
17570
|
{
|
|
17564
17571
|
...props,
|
|
17565
17572
|
id: usedId,
|
|
17566
|
-
className: (0,
|
|
17573
|
+
className: (0, import_clsx31.default)(
|
|
17567
17574
|
"border-transparent focus:ring-0 focus-visible:ring-0 resize-none h-32",
|
|
17568
17575
|
className
|
|
17569
17576
|
)
|
|
@@ -17618,7 +17625,7 @@ var TimeDisplay = ({
|
|
|
17618
17625
|
// src/components/user-interaction/input/InsideLabelInput.tsx
|
|
17619
17626
|
var import_react82 = require("react");
|
|
17620
17627
|
var import_react83 = require("react");
|
|
17621
|
-
var
|
|
17628
|
+
var import_clsx32 = __toESM(require("clsx"));
|
|
17622
17629
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
17623
17630
|
var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2({
|
|
17624
17631
|
id: customId,
|
|
@@ -17636,7 +17643,7 @@ var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2
|
|
|
17636
17643
|
const [isFocused, setIsFocused] = (0, import_react83.useState)(false);
|
|
17637
17644
|
const generatedId = (0, import_react82.useId)();
|
|
17638
17645
|
const id = customId ?? generatedId;
|
|
17639
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: (0,
|
|
17646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: (0, import_clsx32.default)("relative"), children: [
|
|
17640
17647
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
17641
17648
|
Input,
|
|
17642
17649
|
{
|
|
@@ -17654,7 +17661,7 @@ var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2
|
|
|
17654
17661
|
setIsFocused(false);
|
|
17655
17662
|
},
|
|
17656
17663
|
"aria-labelledby": id + "-label",
|
|
17657
|
-
className: (0,
|
|
17664
|
+
className: (0, import_clsx32.default)("h-14 px-4 pb-2 py-6.5", props.className)
|
|
17658
17665
|
}
|
|
17659
17666
|
),
|
|
17660
17667
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
@@ -17663,7 +17670,7 @@ var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2
|
|
|
17663
17670
|
id: id + "-label",
|
|
17664
17671
|
"aria-hidden": true,
|
|
17665
17672
|
"data-display": isFocused || !!value ? "small" : "full",
|
|
17666
|
-
className: (0,
|
|
17673
|
+
className: (0, import_clsx32.default)(
|
|
17667
17674
|
// margin left to account for the border which is ignored for absolute positions
|
|
17668
17675
|
"absolute left-4 ml-0.5 top-2 transition-all delay-25 pointer-events-none touch-none",
|
|
17669
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",
|
|
@@ -17677,7 +17684,7 @@ var InsideLabelInput = (0, import_react83.forwardRef)(function InsideLabelInput2
|
|
|
17677
17684
|
|
|
17678
17685
|
// src/components/user-interaction/input/SearchBar.tsx
|
|
17679
17686
|
var import_lucide_react22 = require("lucide-react");
|
|
17680
|
-
var
|
|
17687
|
+
var import_clsx33 = require("clsx");
|
|
17681
17688
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
17682
17689
|
var SearchBar = ({
|
|
17683
17690
|
value: controlledValue,
|
|
@@ -17694,7 +17701,7 @@ var SearchBar = ({
|
|
|
17694
17701
|
onValueChange,
|
|
17695
17702
|
defaultValue: initialValue
|
|
17696
17703
|
});
|
|
17697
|
-
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { ...containerProps, className: (0,
|
|
17704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { ...containerProps, className: (0, import_clsx33.clsx)("relative", containerProps?.className), children: [
|
|
17698
17705
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
17699
17706
|
Input,
|
|
17700
17707
|
{
|
|
@@ -17703,7 +17710,7 @@ var SearchBar = ({
|
|
|
17703
17710
|
onValueChange: setValue,
|
|
17704
17711
|
onEditComplete: onSearch,
|
|
17705
17712
|
placeholder: inputProps.placeholder ?? translation("search"),
|
|
17706
|
-
className: (0,
|
|
17713
|
+
className: (0, import_clsx33.clsx)("pr-10 w-full", inputProps.className)
|
|
17707
17714
|
}
|
|
17708
17715
|
),
|
|
17709
17716
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
@@ -17715,7 +17722,7 @@ var SearchBar = ({
|
|
|
17715
17722
|
color: "neutral",
|
|
17716
17723
|
coloringStyle: "text",
|
|
17717
17724
|
onClick: () => onSearch(value),
|
|
17718
|
-
className: (0,
|
|
17725
|
+
className: (0, import_clsx33.clsx)("absolute right-1.5 top-1/2 -translate-y-1/2", searchButtonProps?.className),
|
|
17719
17726
|
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react22.Search, { className: "w-full h-full" })
|
|
17720
17727
|
}
|
|
17721
17728
|
)
|
|
@@ -17725,7 +17732,7 @@ var SearchBar = ({
|
|
|
17725
17732
|
// src/components/user-interaction/input/ToggleableInput.tsx
|
|
17726
17733
|
var import_react84 = require("react");
|
|
17727
17734
|
var import_lucide_react23 = require("lucide-react");
|
|
17728
|
-
var
|
|
17735
|
+
var import_clsx34 = __toESM(require("clsx"));
|
|
17729
17736
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
17730
17737
|
var ToggleableInput = (0, import_react84.forwardRef)(function ToggleableInput2({
|
|
17731
17738
|
value: controlledValue,
|
|
@@ -17748,7 +17755,7 @@ var ToggleableInput = (0, import_react84.forwardRef)(function ToggleableInput2({
|
|
|
17748
17755
|
innerRef.current?.focus();
|
|
17749
17756
|
}
|
|
17750
17757
|
}, [isEditing]);
|
|
17751
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: (0,
|
|
17758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: (0, import_clsx34.default)("relative flex-row-2", { "flex-1": isEditing }), children: [
|
|
17752
17759
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
17753
17760
|
Input,
|
|
17754
17761
|
{
|
|
@@ -17774,8 +17781,8 @@ var ToggleableInput = (0, import_react84.forwardRef)(function ToggleableInput2({
|
|
|
17774
17781
|
}
|
|
17775
17782
|
),
|
|
17776
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: [
|
|
17777
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: (0,
|
|
17778
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react23.Pencil, { className: (0,
|
|
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 }) })
|
|
17779
17786
|
] })
|
|
17780
17787
|
] });
|
|
17781
17788
|
});
|
|
@@ -17784,7 +17791,7 @@ var ToggleableInput = (0, import_react84.forwardRef)(function ToggleableInput2({
|
|
|
17784
17791
|
var import_lucide_react25 = require("lucide-react");
|
|
17785
17792
|
|
|
17786
17793
|
// src/components/user-interaction/properties/PropertyBase.tsx
|
|
17787
|
-
var
|
|
17794
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
17788
17795
|
var import_lucide_react24 = require("lucide-react");
|
|
17789
17796
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
17790
17797
|
var PropertyBase = ({
|
|
@@ -17808,7 +17815,7 @@ var PropertyBase = ({
|
|
|
17808
17815
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
17809
17816
|
"div",
|
|
17810
17817
|
{
|
|
17811
|
-
className: (0,
|
|
17818
|
+
className: (0, import_clsx35.default)("group/property", className),
|
|
17812
17819
|
"data-name": "property-root",
|
|
17813
17820
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
17814
17821
|
children: [
|
|
@@ -18533,13 +18540,60 @@ var useSearch = ({
|
|
|
18533
18540
|
};
|
|
18534
18541
|
};
|
|
18535
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
|
+
|
|
18536
18590
|
// src/utils/emailValidation.ts
|
|
18537
18591
|
var validateEmail = (email) => {
|
|
18538
18592
|
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
18539
18593
|
};
|
|
18540
18594
|
|
|
18541
18595
|
// src/hooks/useValidators.ts
|
|
18542
|
-
var
|
|
18596
|
+
var import_react96 = require("react");
|
|
18543
18597
|
var notEmpty = (value) => {
|
|
18544
18598
|
if (!value) {
|
|
18545
18599
|
return "notEmpty";
|
|
@@ -18589,7 +18643,7 @@ var UseValidators = {
|
|
|
18589
18643
|
};
|
|
18590
18644
|
var useTranslatedValidators = () => {
|
|
18591
18645
|
const translation = useHightideTranslation();
|
|
18592
|
-
return (0,
|
|
18646
|
+
return (0, import_react96.useMemo)(() => ({
|
|
18593
18647
|
notEmpty: (value) => {
|
|
18594
18648
|
const result = notEmpty(value);
|
|
18595
18649
|
if (result) {
|
|
@@ -19028,9 +19082,7 @@ var PromiseUtils = {
|
|
|
19028
19082
|
VerticalDivider,
|
|
19029
19083
|
Visibility,
|
|
19030
19084
|
YearMonthPicker,
|
|
19031
|
-
addDuration,
|
|
19032
19085
|
builder,
|
|
19033
|
-
changeDuration,
|
|
19034
19086
|
closestMatch,
|
|
19035
19087
|
createLoopingList,
|
|
19036
19088
|
createLoopingListWithIndex,
|
|
@@ -19043,21 +19095,15 @@ var PromiseUtils = {
|
|
|
19043
19095
|
filterTags,
|
|
19044
19096
|
filterTagsSingle,
|
|
19045
19097
|
filterText,
|
|
19046
|
-
formatDate,
|
|
19047
|
-
formatDateTime,
|
|
19048
|
-
getBetweenDuration,
|
|
19049
19098
|
getNeighbours,
|
|
19050
|
-
getWeeksForCalenderMonth,
|
|
19051
19099
|
hightideTranslation,
|
|
19052
19100
|
hightideTranslationLocales,
|
|
19053
|
-
isInTimeSpan,
|
|
19054
19101
|
isTableFilterCategory,
|
|
19055
19102
|
match,
|
|
19056
19103
|
mergeProps,
|
|
19057
19104
|
noop,
|
|
19058
19105
|
range,
|
|
19059
19106
|
resolveSetState,
|
|
19060
|
-
subtractDuration,
|
|
19061
19107
|
toSizeVars,
|
|
19062
19108
|
useAnchoredPosition,
|
|
19063
19109
|
useControlledState,
|
|
@@ -19103,6 +19149,7 @@ var PromiseUtils = {
|
|
|
19103
19149
|
useTooltip,
|
|
19104
19150
|
useTransitionState,
|
|
19105
19151
|
useTranslatedValidators,
|
|
19152
|
+
useUpdatingDateTime,
|
|
19106
19153
|
useWindowResizeObserver,
|
|
19107
19154
|
validateEmail,
|
|
19108
19155
|
writeToClipboard
|