@helpwave/hightide 0.9.0 → 0.9.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 +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +1353 -1244
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1252 -1144
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.mjs
CHANGED
|
@@ -8020,9 +8020,9 @@ var AnchoredFloatingContainer = forwardRef3(function FloatingContainer({
|
|
|
8020
8020
|
options = {},
|
|
8021
8021
|
active = true,
|
|
8022
8022
|
...props
|
|
8023
|
-
},
|
|
8023
|
+
}, forwardRef34) {
|
|
8024
8024
|
const innerRef = useRef4(null);
|
|
8025
|
-
useImperativeHandle(
|
|
8025
|
+
useImperativeHandle(forwardRef34, () => innerRef.current);
|
|
8026
8026
|
const position = useAnchoredPosition({
|
|
8027
8027
|
...options,
|
|
8028
8028
|
container: innerRef,
|
|
@@ -8336,6 +8336,7 @@ var hightideTranslation = {
|
|
|
8336
8336
|
"de-DE": {
|
|
8337
8337
|
"add": `Hinzuf\xFCgen`,
|
|
8338
8338
|
"addFilter": `Filter hinzuf\xFCgen`,
|
|
8339
|
+
"addTime": `Uhrzeit hinzuf\xFCgen`,
|
|
8339
8340
|
"after": `Nach`,
|
|
8340
8341
|
"age": `Alter`,
|
|
8341
8342
|
"all": `Alle`,
|
|
@@ -8696,11 +8697,13 @@ var hightideTranslation = {
|
|
|
8696
8697
|
"update": `Update`,
|
|
8697
8698
|
"value": `Wert`,
|
|
8698
8699
|
"welcome": `Willkommen`,
|
|
8700
|
+
"withoutTime": `Ohne Uhrzeit`,
|
|
8699
8701
|
"yes": `Ja`
|
|
8700
8702
|
},
|
|
8701
8703
|
"en-US": {
|
|
8702
8704
|
"add": `Add`,
|
|
8703
8705
|
"addFilter": `Add filter`,
|
|
8706
|
+
"addTime": `Add Time`,
|
|
8704
8707
|
"after": `After`,
|
|
8705
8708
|
"age": `Age`,
|
|
8706
8709
|
"all": `All`,
|
|
@@ -9061,6 +9064,7 @@ var hightideTranslation = {
|
|
|
9061
9064
|
"update": `Update`,
|
|
9062
9065
|
"value": `Value`,
|
|
9063
9066
|
"welcome": `Welcome`,
|
|
9067
|
+
"withoutTime": `Without Time`,
|
|
9064
9068
|
"yes": `Yes`
|
|
9065
9069
|
}
|
|
9066
9070
|
};
|
|
@@ -9582,7 +9586,7 @@ var TooltipDisplay = forwardRef4(function TooltipAnchoredFloatingContainer({
|
|
|
9582
9586
|
isAnimated: isAnimatedOverwrite,
|
|
9583
9587
|
anchor: anchorOverwrite,
|
|
9584
9588
|
...props
|
|
9585
|
-
},
|
|
9589
|
+
}, forwardRef34) {
|
|
9586
9590
|
const { config } = useHightideConfig();
|
|
9587
9591
|
const tooltipContext = useContext4(TooltipContext);
|
|
9588
9592
|
const disabled = disabledOverwrite ?? tooltipContext?.disabled;
|
|
@@ -9598,7 +9602,7 @@ var TooltipDisplay = forwardRef4(function TooltipAnchoredFloatingContainer({
|
|
|
9598
9602
|
[isAnimatedOverwrite, config.tooltip.isAnimated]
|
|
9599
9603
|
);
|
|
9600
9604
|
const container = useRef7(null);
|
|
9601
|
-
useImperativeHandle2(
|
|
9605
|
+
useImperativeHandle2(forwardRef34, () => container.current);
|
|
9602
9606
|
const isActive = !disabled && isShown;
|
|
9603
9607
|
const { isVisible, transitionState } = useTransitionState(
|
|
9604
9608
|
useMemo9(() => ({ isOpen: isShown, ref: container }), [isShown])
|
|
@@ -11855,7 +11859,7 @@ var InputDialog = ({
|
|
|
11855
11859
|
import { forwardRef as forwardRef15 } from "react";
|
|
11856
11860
|
|
|
11857
11861
|
// src/components/user-interaction/Select/SelectRoot.tsx
|
|
11858
|
-
import { useCallback as
|
|
11862
|
+
import { useCallback as useCallback21, useEffect as useEffect21, useId as useId9, useMemo as useMemo19, useState as useState19 } from "react";
|
|
11859
11863
|
|
|
11860
11864
|
// src/components/user-interaction/Select/SelectContext.tsx
|
|
11861
11865
|
import { createContext as createContext9, useContext as useContext10 } from "react";
|
|
@@ -11868,10 +11872,10 @@ function useSelectContext() {
|
|
|
11868
11872
|
|
|
11869
11873
|
// src/components/user-interaction/Select/useSelect.ts
|
|
11870
11874
|
import {
|
|
11871
|
-
useCallback as
|
|
11872
|
-
useEffect as
|
|
11873
|
-
useMemo as
|
|
11874
|
-
useState as
|
|
11875
|
+
useCallback as useCallback20,
|
|
11876
|
+
useEffect as useEffect20,
|
|
11877
|
+
useMemo as useMemo18,
|
|
11878
|
+
useState as useState18
|
|
11875
11879
|
} from "react";
|
|
11876
11880
|
|
|
11877
11881
|
// src/hooks/useSingleSelection.ts
|
|
@@ -11998,217 +12002,8 @@ function useListNavigation({
|
|
|
11998
12002
|
}), [resolvedHighlightId, highlight, first, last, next, previous]);
|
|
11999
12003
|
}
|
|
12000
12004
|
|
|
12001
|
-
// src/hooks/focus/useFocusGuards.ts
|
|
12002
|
-
import { useEffect as useEffect19 } from "react";
|
|
12003
|
-
var selectorName = "data-hw-focus-guard";
|
|
12004
|
-
function FocusGuard() {
|
|
12005
|
-
const element = document.createElement("div");
|
|
12006
|
-
element.setAttribute(selectorName, "");
|
|
12007
|
-
element.tabIndex = 0;
|
|
12008
|
-
element.style.border = "none";
|
|
12009
|
-
element.style.outline = "none";
|
|
12010
|
-
element.style.boxShadow = "none";
|
|
12011
|
-
element.style.opacity = "0";
|
|
12012
|
-
element.style.position = "fixed";
|
|
12013
|
-
element.style.pointerEvents = "none";
|
|
12014
|
-
return element;
|
|
12015
|
-
}
|
|
12016
|
-
var FocusGuardsService = class _FocusGuardsService {
|
|
12017
|
-
constructor() {
|
|
12018
|
-
this.count = 0;
|
|
12019
|
-
}
|
|
12020
|
-
static getInstance() {
|
|
12021
|
-
if (!_FocusGuardsService.instance) {
|
|
12022
|
-
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
12023
|
-
}
|
|
12024
|
-
return _FocusGuardsService.instance;
|
|
12025
|
-
}
|
|
12026
|
-
add() {
|
|
12027
|
-
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
12028
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
12029
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
12030
|
-
this.count++;
|
|
12031
|
-
}
|
|
12032
|
-
remove() {
|
|
12033
|
-
if (this.count === 1) {
|
|
12034
|
-
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
12035
|
-
}
|
|
12036
|
-
this.count--;
|
|
12037
|
-
}
|
|
12038
|
-
};
|
|
12039
|
-
var useFocusGuards = () => {
|
|
12040
|
-
useEffect19(() => {
|
|
12041
|
-
FocusGuardsService.getInstance().add();
|
|
12042
|
-
return () => {
|
|
12043
|
-
FocusGuardsService.getInstance().remove();
|
|
12044
|
-
};
|
|
12045
|
-
}, []);
|
|
12046
|
-
};
|
|
12047
|
-
|
|
12048
|
-
// src/hooks/focus/useFocusOnceVisible.ts
|
|
12049
|
-
import React3, { useEffect as useEffect20 } from "react";
|
|
12050
|
-
var useFocusOnceVisible = (ref, disable = false) => {
|
|
12051
|
-
const [hasUsedFocus, setHasUsedFocus] = React3.useState(false);
|
|
12052
|
-
useEffect20(() => {
|
|
12053
|
-
if (disable || hasUsedFocus) {
|
|
12054
|
-
return;
|
|
12055
|
-
}
|
|
12056
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
12057
|
-
if (entry.isIntersecting && !hasUsedFocus) {
|
|
12058
|
-
ref.current?.focus();
|
|
12059
|
-
setHasUsedFocus(hasUsedFocus);
|
|
12060
|
-
}
|
|
12061
|
-
}, {
|
|
12062
|
-
threshold: 0.1
|
|
12063
|
-
});
|
|
12064
|
-
if (ref.current) {
|
|
12065
|
-
observer.observe(ref.current);
|
|
12066
|
-
}
|
|
12067
|
-
return () => observer.disconnect();
|
|
12068
|
-
}, [disable, hasUsedFocus, ref]);
|
|
12069
|
-
};
|
|
12070
|
-
|
|
12071
|
-
// src/hooks/focus/useIsMounted.ts
|
|
12072
|
-
import { useEffect as useEffect21, useLayoutEffect as useLayoutEffect6, useState as useState18 } from "react";
|
|
12073
|
-
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
12074
|
-
var useIsomorphicEffect = isClient ? useLayoutEffect6 : useEffect21;
|
|
12075
|
-
var useIsMounted = () => {
|
|
12076
|
-
const [isMounted, setIsMounted] = useState18(false);
|
|
12077
|
-
useIsomorphicEffect(() => {
|
|
12078
|
-
setIsMounted(true);
|
|
12079
|
-
return () => {
|
|
12080
|
-
setIsMounted(false);
|
|
12081
|
-
};
|
|
12082
|
-
}, []);
|
|
12083
|
-
return isMounted;
|
|
12084
|
-
};
|
|
12085
|
-
|
|
12086
|
-
// src/hooks/useHandleRefs.ts
|
|
12087
|
-
import { useEffect as useEffect22, useRef as useRef19 } from "react";
|
|
12088
|
-
function useHandleRefs(handleRef) {
|
|
12089
|
-
const refs = useRef19([]);
|
|
12090
|
-
useEffect22(() => {
|
|
12091
|
-
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
12092
|
-
() => ({ current: null })
|
|
12093
|
-
);
|
|
12094
|
-
const values = Object.values(handleRef?.current ?? {});
|
|
12095
|
-
values.forEach((el, i) => {
|
|
12096
|
-
refs.current[i].current = el;
|
|
12097
|
-
});
|
|
12098
|
-
});
|
|
12099
|
-
return refs.current;
|
|
12100
|
-
}
|
|
12101
|
-
|
|
12102
|
-
// src/hooks/useLogUnstableDependencies.ts
|
|
12103
|
-
import React4 from "react";
|
|
12104
|
-
function useLogUnstableDependencies(name, value) {
|
|
12105
|
-
const prev = React4.useRef(null);
|
|
12106
|
-
React4.useEffect(() => {
|
|
12107
|
-
if (!prev.current) {
|
|
12108
|
-
prev.current = value;
|
|
12109
|
-
return;
|
|
12110
|
-
}
|
|
12111
|
-
const changes = {};
|
|
12112
|
-
for (const key of Object.keys(value)) {
|
|
12113
|
-
if (prev.current[key] !== value[key]) {
|
|
12114
|
-
changes[key] = {
|
|
12115
|
-
prev: prev.current[key],
|
|
12116
|
-
next: value[key]
|
|
12117
|
-
};
|
|
12118
|
-
}
|
|
12119
|
-
}
|
|
12120
|
-
if (Object.keys(changes).length > 0) {
|
|
12121
|
-
console.info(`[${name}] changed`, changes);
|
|
12122
|
-
}
|
|
12123
|
-
prev.current = value;
|
|
12124
|
-
});
|
|
12125
|
-
}
|
|
12126
|
-
|
|
12127
|
-
// src/hooks/useMultiSelection.ts
|
|
12128
|
-
import { useCallback as useCallback19, useMemo as useMemo17 } from "react";
|
|
12129
|
-
function useMultiSelection({
|
|
12130
|
-
options: optionsList,
|
|
12131
|
-
value,
|
|
12132
|
-
onSelectionChange,
|
|
12133
|
-
initialSelection = [],
|
|
12134
|
-
isControlled
|
|
12135
|
-
}) {
|
|
12136
|
-
const [selection, setSelection] = useControlledState({
|
|
12137
|
-
value,
|
|
12138
|
-
onValueChange: onSelectionChange,
|
|
12139
|
-
defaultValue: [...initialSelection],
|
|
12140
|
-
isControlled
|
|
12141
|
-
});
|
|
12142
|
-
const isSelected = useCallback19((id) => selection.includes(id), [selection]);
|
|
12143
|
-
const toggleSelection = useCallback19(
|
|
12144
|
-
(id) => {
|
|
12145
|
-
const option = optionsList.find((o) => o.id === id);
|
|
12146
|
-
if (!option || option.disabled) return;
|
|
12147
|
-
setSelection((prev) => prev.includes(id) ? prev.filter((s) => s !== id) : [...prev, id]);
|
|
12148
|
-
},
|
|
12149
|
-
[optionsList, setSelection]
|
|
12150
|
-
);
|
|
12151
|
-
const setSelectionValue = useCallback19(
|
|
12152
|
-
(next) => setSelection(Array.from(next)),
|
|
12153
|
-
[setSelection]
|
|
12154
|
-
);
|
|
12155
|
-
return useMemo17(
|
|
12156
|
-
() => ({
|
|
12157
|
-
selection,
|
|
12158
|
-
setSelection: setSelectionValue,
|
|
12159
|
-
toggleSelection,
|
|
12160
|
-
isSelected
|
|
12161
|
-
}),
|
|
12162
|
-
[selection, setSelectionValue, toggleSelection, isSelected]
|
|
12163
|
-
);
|
|
12164
|
-
}
|
|
12165
|
-
|
|
12166
|
-
// src/hooks/useOutsideClick.ts
|
|
12167
|
-
import { useEffect as useEffect23 } from "react";
|
|
12168
|
-
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12169
|
-
useEffect23(() => {
|
|
12170
|
-
if (!active) return;
|
|
12171
|
-
const listener = (event) => {
|
|
12172
|
-
if (event.target === null) return;
|
|
12173
|
-
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
12174
|
-
return;
|
|
12175
|
-
}
|
|
12176
|
-
onOutsideClick(event);
|
|
12177
|
-
};
|
|
12178
|
-
document.addEventListener("mousedown", listener);
|
|
12179
|
-
document.addEventListener("touchstart", listener);
|
|
12180
|
-
document.addEventListener("pointerdown", listener);
|
|
12181
|
-
return () => {
|
|
12182
|
-
document.removeEventListener("mousedown", listener);
|
|
12183
|
-
document.removeEventListener("touchstart", listener);
|
|
12184
|
-
document.removeEventListener("pointerdown", listener);
|
|
12185
|
-
};
|
|
12186
|
-
}, [refs, onOutsideClick, active]);
|
|
12187
|
-
};
|
|
12188
|
-
|
|
12189
|
-
// src/hooks/useOverwritableState.ts
|
|
12190
|
-
import { useEffect as useEffect24, useState as useState19 } from "react";
|
|
12191
|
-
var useOverwritableState = (overwriteValue, onChange) => {
|
|
12192
|
-
const [state, setState] = useState19(overwriteValue);
|
|
12193
|
-
useEffect24(() => {
|
|
12194
|
-
setState(overwriteValue);
|
|
12195
|
-
}, [overwriteValue]);
|
|
12196
|
-
const onChangeWrapper = (action) => {
|
|
12197
|
-
const resolved = resolveSetState(action, state);
|
|
12198
|
-
setState(resolved);
|
|
12199
|
-
onChange?.(resolved);
|
|
12200
|
-
};
|
|
12201
|
-
return [state, onChangeWrapper];
|
|
12202
|
-
};
|
|
12203
|
-
|
|
12204
|
-
// src/hooks/useRerender.ts
|
|
12205
|
-
import { useReducer as useReducer2 } from "react";
|
|
12206
|
-
var useRerender = () => {
|
|
12207
|
-
return useReducer2(() => ({}), {})[1];
|
|
12208
|
-
};
|
|
12209
|
-
|
|
12210
12005
|
// src/hooks/useSearch.ts
|
|
12211
|
-
import { useMemo as
|
|
12006
|
+
import { useMemo as useMemo17 } from "react";
|
|
12212
12007
|
|
|
12213
12008
|
// src/utils/simpleSearch.ts
|
|
12214
12009
|
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
@@ -12247,18 +12042,18 @@ function useSearch({
|
|
|
12247
12042
|
}) {
|
|
12248
12043
|
const toTagsResolved = toTags ?? defaultToTags;
|
|
12249
12044
|
const toTagsStable = useEventCallbackStabilizer(toTagsResolved);
|
|
12250
|
-
const searchResult =
|
|
12045
|
+
const searchResult = useMemo17(() => {
|
|
12251
12046
|
const q = searchQuery.trim().toLowerCase();
|
|
12252
12047
|
if (!q) return items;
|
|
12253
12048
|
return MultiSearchWithMapping(searchQuery, [...items], (item) => toTagsStable(item));
|
|
12254
12049
|
}, [items, searchQuery, toTagsStable]);
|
|
12255
|
-
return
|
|
12050
|
+
return useMemo17(() => ({
|
|
12256
12051
|
searchResult
|
|
12257
12052
|
}), [searchResult]);
|
|
12258
12053
|
}
|
|
12259
12054
|
|
|
12260
12055
|
// src/hooks/useTypeAheadSearch.ts
|
|
12261
|
-
import { useCallback as
|
|
12056
|
+
import { useCallback as useCallback19, useEffect as useEffect19, useRef as useRef19 } from "react";
|
|
12262
12057
|
function defaultToString(value) {
|
|
12263
12058
|
return String(value);
|
|
12264
12059
|
}
|
|
@@ -12268,12 +12063,12 @@ function useTypeAheadSearch({
|
|
|
12268
12063
|
toString: toStringProp,
|
|
12269
12064
|
onResultChange
|
|
12270
12065
|
}) {
|
|
12271
|
-
const bufferRef =
|
|
12272
|
-
const timeoutRef =
|
|
12066
|
+
const bufferRef = useRef19("");
|
|
12067
|
+
const timeoutRef = useRef19(null);
|
|
12273
12068
|
const toString = toStringProp ?? defaultToString;
|
|
12274
12069
|
const toStringStable = useEventCallbackStabilizer(toString);
|
|
12275
12070
|
const onResultChangeStable = useEventCallbackStabilizer(onResultChange);
|
|
12276
|
-
const reset =
|
|
12071
|
+
const reset = useCallback19(() => {
|
|
12277
12072
|
if (timeoutRef.current) {
|
|
12278
12073
|
clearTimeout(timeoutRef.current);
|
|
12279
12074
|
timeoutRef.current = null;
|
|
@@ -12281,10 +12076,10 @@ function useTypeAheadSearch({
|
|
|
12281
12076
|
bufferRef.current = "";
|
|
12282
12077
|
onResultChangeStable(null);
|
|
12283
12078
|
}, [onResultChangeStable]);
|
|
12284
|
-
|
|
12079
|
+
useEffect19(() => () => {
|
|
12285
12080
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12286
12081
|
}, []);
|
|
12287
|
-
const addToTypeAhead =
|
|
12082
|
+
const addToTypeAhead = useCallback19((str) => {
|
|
12288
12083
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12289
12084
|
bufferRef.current += str;
|
|
12290
12085
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -12306,397 +12101,43 @@ function useTypeAheadSearch({
|
|
|
12306
12101
|
return { addToTypeAhead, reset };
|
|
12307
12102
|
}
|
|
12308
12103
|
|
|
12309
|
-
// src/
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
const {
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
}
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
}
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
return new Date(date);
|
|
12347
|
-
}
|
|
12348
|
-
if (hours < 0 || hours > 23) {
|
|
12349
|
-
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
12350
|
-
return new Date(date);
|
|
12351
|
-
}
|
|
12352
|
-
if (minutes < 0 || minutes > 59) {
|
|
12353
|
-
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
12354
|
-
return new Date(date);
|
|
12355
|
-
}
|
|
12356
|
-
if (seconds < 0 || seconds > 59) {
|
|
12357
|
-
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
12358
|
-
return new Date(date);
|
|
12359
|
-
}
|
|
12360
|
-
if (milliseconds < 0) {
|
|
12361
|
-
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
12362
|
-
return new Date(date);
|
|
12363
|
-
}
|
|
12364
|
-
const multiplier = isAdding ? 1 : -1;
|
|
12365
|
-
const newDate = new Date(date);
|
|
12366
|
-
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
12367
|
-
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
12368
|
-
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
12369
|
-
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
12370
|
-
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
12371
|
-
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
12372
|
-
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
12373
|
-
return newDate;
|
|
12374
|
-
};
|
|
12375
|
-
var addDuration = (date, duration) => {
|
|
12376
|
-
return changeDuration(date, duration, true);
|
|
12377
|
-
};
|
|
12378
|
-
var subtractDuration = (date, duration) => {
|
|
12379
|
-
return changeDuration(date, duration, false);
|
|
12380
|
-
};
|
|
12381
|
-
var between = (value, startDate, endDate) => {
|
|
12382
|
-
if (startDate && endDate) {
|
|
12383
|
-
console.assert(startDate <= endDate);
|
|
12384
|
-
return startDate <= value && value <= endDate;
|
|
12385
|
-
} else if (startDate) {
|
|
12386
|
-
return startDate <= value;
|
|
12387
|
-
} else if (endDate) {
|
|
12388
|
-
return endDate >= value;
|
|
12389
|
-
} else {
|
|
12390
|
-
return true;
|
|
12391
|
-
}
|
|
12392
|
-
};
|
|
12393
|
-
var equalDate = (date1, date2) => {
|
|
12394
|
-
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
12395
|
-
};
|
|
12396
|
-
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
12397
|
-
const month = date.getMonth();
|
|
12398
|
-
const year = date.getFullYear();
|
|
12399
|
-
const dayList = [];
|
|
12400
|
-
let currentDate = new Date(year, month, 1);
|
|
12401
|
-
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
12402
|
-
while (currentDate.getDay() !== weekStartIndex) {
|
|
12403
|
-
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
12404
|
-
}
|
|
12405
|
-
while (dayList.length < 7 * weeks) {
|
|
12406
|
-
const date2 = new Date(currentDate);
|
|
12407
|
-
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
12408
|
-
dayList.push(date2);
|
|
12409
|
-
currentDate = addDuration(currentDate, { days: 1 });
|
|
12410
|
-
}
|
|
12411
|
-
return equalSizeGroups(dayList, 7);
|
|
12412
|
-
};
|
|
12413
|
-
var formatAbsolute = (date, locale, format) => {
|
|
12414
|
-
let options;
|
|
12415
|
-
switch (format) {
|
|
12416
|
-
case "date":
|
|
12417
|
-
options = {
|
|
12418
|
-
year: "2-digit",
|
|
12419
|
-
month: "2-digit",
|
|
12420
|
-
day: "2-digit"
|
|
12421
|
-
};
|
|
12422
|
-
break;
|
|
12423
|
-
case "time":
|
|
12424
|
-
options = {
|
|
12425
|
-
hour: "2-digit",
|
|
12426
|
-
minute: "2-digit"
|
|
12427
|
-
};
|
|
12428
|
-
break;
|
|
12429
|
-
case "dateTime":
|
|
12430
|
-
options = {
|
|
12431
|
-
year: "numeric",
|
|
12432
|
-
month: "2-digit",
|
|
12433
|
-
day: "2-digit",
|
|
12434
|
-
hour: "2-digit",
|
|
12435
|
-
minute: "2-digit"
|
|
12436
|
-
};
|
|
12437
|
-
break;
|
|
12438
|
-
}
|
|
12439
|
-
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
12440
|
-
};
|
|
12441
|
-
var formatRelative = (date, locale) => {
|
|
12442
|
-
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
12443
|
-
const now = /* @__PURE__ */ new Date();
|
|
12444
|
-
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
12445
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
12446
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
12447
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
12448
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
12449
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
12450
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
12451
|
-
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
12452
|
-
};
|
|
12453
|
-
var toInputString = (date, format, precision = "minute", isLocalTime = true) => {
|
|
12454
|
-
const pad = (n, l = 2) => String(n).padStart(l, "0");
|
|
12455
|
-
const parts = isLocalTime ? {
|
|
12456
|
-
y: date.getFullYear(),
|
|
12457
|
-
m: date.getMonth() + 1,
|
|
12458
|
-
d: date.getDate(),
|
|
12459
|
-
h: date.getHours(),
|
|
12460
|
-
min: date.getMinutes(),
|
|
12461
|
-
s: date.getSeconds(),
|
|
12462
|
-
ms: date.getMilliseconds()
|
|
12463
|
-
} : {
|
|
12464
|
-
y: date.getUTCFullYear(),
|
|
12465
|
-
m: date.getUTCMonth() + 1,
|
|
12466
|
-
d: date.getUTCDate(),
|
|
12467
|
-
h: date.getUTCHours(),
|
|
12468
|
-
min: date.getUTCMinutes(),
|
|
12469
|
-
s: date.getUTCSeconds(),
|
|
12470
|
-
ms: date.getUTCMilliseconds()
|
|
12471
|
-
};
|
|
12472
|
-
const dateStr = `${pad(parts.y, 4)}-${pad(parts.m)}-${pad(parts.d)}`;
|
|
12473
|
-
let timeStr = `${pad(parts.h)}:${pad(parts.min)}`;
|
|
12474
|
-
if (precision === "second" || precision === "millisecond") {
|
|
12475
|
-
timeStr += `:${pad(parts.s)}`;
|
|
12476
|
-
}
|
|
12477
|
-
if (precision === "millisecond") {
|
|
12478
|
-
timeStr += `.${pad(parts.ms, 3)}`;
|
|
12479
|
-
}
|
|
12480
|
-
switch (format) {
|
|
12481
|
-
case "date":
|
|
12482
|
-
return dateStr;
|
|
12483
|
-
case "time":
|
|
12484
|
-
return timeStr;
|
|
12485
|
-
case "dateTime":
|
|
12486
|
-
return `${dateStr}T${timeStr}`;
|
|
12487
|
-
}
|
|
12488
|
-
};
|
|
12489
|
-
function tryParseDate(dateValue) {
|
|
12490
|
-
if (!dateValue) return null;
|
|
12491
|
-
if (dateValue instanceof Date) return dateValue;
|
|
12492
|
-
if (typeof dateValue === "string" || typeof dateValue === "number") {
|
|
12493
|
-
const parsed = new Date(dateValue);
|
|
12494
|
-
return isNaN(parsed.getTime()) ? null : parsed;
|
|
12495
|
-
}
|
|
12496
|
-
return null;
|
|
12497
|
-
}
|
|
12498
|
-
function normalizeToDateOnly(date) {
|
|
12499
|
-
const normalized = new Date(date);
|
|
12500
|
-
normalized.setHours(0, 0, 0, 0);
|
|
12501
|
-
return normalized;
|
|
12502
|
-
}
|
|
12503
|
-
function normalizeDatetime(dateTime) {
|
|
12504
|
-
const normalized = new Date(dateTime);
|
|
12505
|
-
normalized.setSeconds(0, 0);
|
|
12506
|
-
return normalized;
|
|
12507
|
-
}
|
|
12508
|
-
var DateUtils = {
|
|
12509
|
-
monthsList,
|
|
12510
|
-
weekDayList,
|
|
12511
|
-
equalDate,
|
|
12512
|
-
formatAbsolute,
|
|
12513
|
-
formatRelative,
|
|
12514
|
-
addDuration,
|
|
12515
|
-
subtractDuration,
|
|
12516
|
-
between,
|
|
12517
|
-
weeksForCalenderMonth,
|
|
12518
|
-
timesInSeconds,
|
|
12519
|
-
toInputString,
|
|
12520
|
-
tryParseDate,
|
|
12521
|
-
toOnlyDate: normalizeToDateOnly,
|
|
12522
|
-
/**
|
|
12523
|
-
* Normalizes a datetime by removing seconds and milliseconds.
|
|
12524
|
-
*/
|
|
12525
|
-
toDateTimeOnly: normalizeDatetime
|
|
12526
|
-
};
|
|
12527
|
-
|
|
12528
|
-
// src/hooks/useUpdatingDateString.ts
|
|
12529
|
-
var useUpdatingDateString = ({ absoluteFormat = "dateTime", localeOverride, date }) => {
|
|
12530
|
-
const { locale: contextLocale } = useLocale();
|
|
12531
|
-
const locale = localeOverride ?? contextLocale;
|
|
12532
|
-
const [dateAndTimeStrings, setDateAndTimeStrings] = useState20({
|
|
12533
|
-
compareDate: date,
|
|
12534
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
12535
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
12536
|
-
});
|
|
12537
|
-
useEffect26(() => {
|
|
12538
|
-
setDateAndTimeStrings({
|
|
12539
|
-
compareDate: date,
|
|
12540
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
12541
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
12542
|
-
});
|
|
12543
|
-
}, [date, absoluteFormat, locale]);
|
|
12544
|
-
useEffect26(() => {
|
|
12545
|
-
let timeoutId;
|
|
12546
|
-
const startTimer = () => {
|
|
12547
|
-
const now = /* @__PURE__ */ new Date();
|
|
12548
|
-
const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
|
|
12549
|
-
let delayInSeconds;
|
|
12550
|
-
if (diff < DateUtils.timesInSeconds.minute) {
|
|
12551
|
-
delayInSeconds = DateUtils.timesInSeconds.second;
|
|
12552
|
-
} else if (diff < DateUtils.timesInSeconds.hour) {
|
|
12553
|
-
delayInSeconds = DateUtils.timesInSeconds.minute;
|
|
12554
|
-
} else {
|
|
12555
|
-
delayInSeconds = DateUtils.timesInSeconds.hour;
|
|
12556
|
-
}
|
|
12557
|
-
timeoutId = setInterval(() => {
|
|
12558
|
-
setDateAndTimeStrings({
|
|
12559
|
-
compareDate: date,
|
|
12560
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
12561
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
12562
|
-
});
|
|
12563
|
-
}, delayInSeconds * 1e3 / 2);
|
|
12564
|
-
};
|
|
12565
|
-
startTimer();
|
|
12566
|
-
return () => clearInterval(timeoutId);
|
|
12567
|
-
}, [absoluteFormat, date, locale]);
|
|
12568
|
-
return {
|
|
12569
|
-
absolute: dateAndTimeStrings.absolute,
|
|
12570
|
-
relative: dateAndTimeStrings.relative
|
|
12571
|
-
};
|
|
12572
|
-
};
|
|
12573
|
-
|
|
12574
|
-
// src/utils/emailValidation.ts
|
|
12575
|
-
var validateEmail = (email) => {
|
|
12576
|
-
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
12577
|
-
};
|
|
12578
|
-
|
|
12579
|
-
// src/hooks/useValidators.ts
|
|
12580
|
-
import { useMemo as useMemo19 } from "react";
|
|
12581
|
-
var notEmpty = (value) => {
|
|
12582
|
-
if (!value) {
|
|
12583
|
-
return "notEmpty";
|
|
12584
|
-
}
|
|
12585
|
-
};
|
|
12586
|
-
var boundsValidator = (length, bounds) => {
|
|
12587
|
-
const [min, max] = bounds;
|
|
12588
|
-
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
12589
|
-
return "range";
|
|
12590
|
-
}
|
|
12591
|
-
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
12592
|
-
return "lower";
|
|
12593
|
-
}
|
|
12594
|
-
if (max !== void 0 && length !== void 0 && length > max) {
|
|
12595
|
-
return "upper";
|
|
12596
|
-
}
|
|
12597
|
-
return "none";
|
|
12598
|
-
};
|
|
12599
|
-
var lengthValidator = (value, bounds) => {
|
|
12600
|
-
const mapping = {
|
|
12601
|
-
range: "outOfRangeString",
|
|
12602
|
-
lower: "tooShort",
|
|
12603
|
-
upper: "tooLong",
|
|
12604
|
-
none: void 0
|
|
12605
|
-
};
|
|
12606
|
-
return mapping[boundsValidator(value?.length, bounds)];
|
|
12607
|
-
};
|
|
12608
|
-
var selectionValidator = (value, bounds) => {
|
|
12609
|
-
const mapping = {
|
|
12610
|
-
range: "outOfRangeSelectionItems",
|
|
12611
|
-
lower: "tooFewSelectionItems",
|
|
12612
|
-
upper: "tooManySelectionItems",
|
|
12613
|
-
none: void 0
|
|
12614
|
-
};
|
|
12615
|
-
return mapping[boundsValidator(value?.length, bounds)];
|
|
12616
|
-
};
|
|
12617
|
-
var emailValidator = (value) => {
|
|
12618
|
-
if (!value || !validateEmail(value)) {
|
|
12619
|
-
return "invalidEmail";
|
|
12620
|
-
}
|
|
12621
|
-
};
|
|
12622
|
-
var UseValidators = {
|
|
12623
|
-
notEmpty,
|
|
12624
|
-
length: lengthValidator,
|
|
12625
|
-
email: emailValidator,
|
|
12626
|
-
selection: selectionValidator
|
|
12627
|
-
};
|
|
12628
|
-
var useTranslatedValidators = () => {
|
|
12629
|
-
const translation = useHightideTranslation();
|
|
12630
|
-
return useMemo19(() => ({
|
|
12631
|
-
notEmpty: (value) => {
|
|
12632
|
-
const result = notEmpty(value);
|
|
12633
|
-
if (result) {
|
|
12634
|
-
return translation(result);
|
|
12635
|
-
}
|
|
12636
|
-
},
|
|
12637
|
-
length: (value, length) => {
|
|
12638
|
-
const [min, max] = length;
|
|
12639
|
-
const result = lengthValidator(value, length);
|
|
12640
|
-
if (result) {
|
|
12641
|
-
return translation(result, { min, max });
|
|
12642
|
-
}
|
|
12643
|
-
},
|
|
12644
|
-
email: (value) => {
|
|
12645
|
-
const result = emailValidator(value ?? "");
|
|
12646
|
-
if (result) {
|
|
12647
|
-
return translation(result);
|
|
12648
|
-
}
|
|
12649
|
-
},
|
|
12650
|
-
selection: (value, length) => {
|
|
12651
|
-
const [min, max] = length;
|
|
12652
|
-
const result = selectionValidator(value, length);
|
|
12653
|
-
if (result) {
|
|
12654
|
-
return translation(
|
|
12655
|
-
result,
|
|
12656
|
-
{ min, max }
|
|
12657
|
-
);
|
|
12658
|
-
}
|
|
12659
|
-
}
|
|
12660
|
-
}), [translation]);
|
|
12661
|
-
};
|
|
12662
|
-
|
|
12663
|
-
// src/components/user-interaction/Select/useSelect.ts
|
|
12664
|
-
function useSelect({
|
|
12665
|
-
options,
|
|
12666
|
-
value: controlledValue,
|
|
12667
|
-
onValueChange,
|
|
12668
|
-
onEditComplete,
|
|
12669
|
-
initialValue = null,
|
|
12670
|
-
onClose,
|
|
12671
|
-
onIsOpenChange,
|
|
12672
|
-
initialIsOpen = false,
|
|
12673
|
-
typeAheadResetMs = 500
|
|
12674
|
-
}) {
|
|
12675
|
-
const [isOpen, setIsOpen] = useState21(initialIsOpen);
|
|
12676
|
-
const [searchQuery, setSearchQuery] = useState21("");
|
|
12677
|
-
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
12678
|
-
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
12679
|
-
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12680
|
-
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
12681
|
-
const onSelectionChangeWrapper = useCallback21((id) => {
|
|
12682
|
-
if (id === null) return;
|
|
12683
|
-
onValueChangeStable(id);
|
|
12684
|
-
onEditCompleteStable(id);
|
|
12685
|
-
setIsOpen(false);
|
|
12686
|
-
}, [onValueChangeStable, onEditCompleteStable, setIsOpen]);
|
|
12687
|
-
const { selection, selectValue } = useSingleSelection({
|
|
12688
|
-
options,
|
|
12689
|
-
selection: controlledValue,
|
|
12690
|
-
onSelectionChange: onSelectionChangeWrapper,
|
|
12691
|
-
initialSelection: initialValue
|
|
12692
|
-
});
|
|
12693
|
-
const { searchResult: visibleOptions } = useSearch({
|
|
12694
|
-
items: options,
|
|
12695
|
-
searchQuery,
|
|
12696
|
-
toTags: useCallback21((o) => [o.label], [])
|
|
12697
|
-
});
|
|
12698
|
-
const visibleOptionIds = useMemo20(() => visibleOptions.map((o) => o.id), [visibleOptions]);
|
|
12699
|
-
const enabledOptions = useMemo20(() => visibleOptions.filter((o) => !o.disabled), [visibleOptions]);
|
|
12104
|
+
// src/components/user-interaction/Select/useSelect.ts
|
|
12105
|
+
function useSelect({
|
|
12106
|
+
options,
|
|
12107
|
+
value: controlledValue,
|
|
12108
|
+
onValueChange,
|
|
12109
|
+
onEditComplete,
|
|
12110
|
+
initialValue = null,
|
|
12111
|
+
onClose,
|
|
12112
|
+
onIsOpenChange,
|
|
12113
|
+
initialIsOpen = false,
|
|
12114
|
+
typeAheadResetMs = 500
|
|
12115
|
+
}) {
|
|
12116
|
+
const [isOpen, setIsOpen] = useState18(initialIsOpen);
|
|
12117
|
+
const [searchQuery, setSearchQuery] = useState18("");
|
|
12118
|
+
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
12119
|
+
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
12120
|
+
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12121
|
+
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
12122
|
+
const onSelectionChangeWrapper = useCallback20((id) => {
|
|
12123
|
+
if (id === null) return;
|
|
12124
|
+
onValueChangeStable(id);
|
|
12125
|
+
onEditCompleteStable(id);
|
|
12126
|
+
setIsOpen(false);
|
|
12127
|
+
}, [onValueChangeStable, onEditCompleteStable, setIsOpen]);
|
|
12128
|
+
const { selection, selectValue } = useSingleSelection({
|
|
12129
|
+
options,
|
|
12130
|
+
selection: controlledValue,
|
|
12131
|
+
onSelectionChange: onSelectionChangeWrapper,
|
|
12132
|
+
initialSelection: initialValue
|
|
12133
|
+
});
|
|
12134
|
+
const { searchResult: visibleOptions } = useSearch({
|
|
12135
|
+
items: options,
|
|
12136
|
+
searchQuery,
|
|
12137
|
+
toTags: useCallback20((o) => [o.label], [])
|
|
12138
|
+
});
|
|
12139
|
+
const visibleOptionIds = useMemo18(() => visibleOptions.map((o) => o.id), [visibleOptions]);
|
|
12140
|
+
const enabledOptions = useMemo18(() => visibleOptions.filter((o) => !o.disabled), [visibleOptions]);
|
|
12700
12141
|
const {
|
|
12701
12142
|
highlightedId,
|
|
12702
12143
|
highlight: listNavHighlight,
|
|
@@ -12712,28 +12153,28 @@ function useSelect({
|
|
|
12712
12153
|
options: enabledOptions,
|
|
12713
12154
|
resetTimer: typeAheadResetMs,
|
|
12714
12155
|
toString: (o) => o.label ?? "",
|
|
12715
|
-
onResultChange:
|
|
12156
|
+
onResultChange: useCallback20((option) => {
|
|
12716
12157
|
if (option) listNavHighlight(option.id);
|
|
12717
12158
|
}, [listNavHighlight])
|
|
12718
12159
|
});
|
|
12719
|
-
|
|
12160
|
+
useEffect20(() => {
|
|
12720
12161
|
if (!isOpen) typeAheadReset();
|
|
12721
12162
|
}, [isOpen, typeAheadReset]);
|
|
12722
|
-
const state =
|
|
12163
|
+
const state = useMemo18(() => ({
|
|
12723
12164
|
value: selection,
|
|
12724
12165
|
highlightedValue: highlightedId,
|
|
12725
12166
|
isOpen,
|
|
12726
12167
|
searchQuery,
|
|
12727
12168
|
options
|
|
12728
12169
|
}), [selection, highlightedId, isOpen, searchQuery, options]);
|
|
12729
|
-
const computedState =
|
|
12170
|
+
const computedState = useMemo18(() => ({
|
|
12730
12171
|
visibleOptionIds
|
|
12731
12172
|
}), [visibleOptionIds]);
|
|
12732
|
-
const highlightItem =
|
|
12173
|
+
const highlightItem = useCallback20((value) => {
|
|
12733
12174
|
if (!enabledOptions.some((o) => o.id === value)) return;
|
|
12734
12175
|
listNavHighlight(value);
|
|
12735
12176
|
}, [enabledOptions, listNavHighlight]);
|
|
12736
|
-
const setIsOpenWrapper =
|
|
12177
|
+
const setIsOpenWrapper = useCallback20((isOpen2, behavior) => {
|
|
12737
12178
|
behavior = behavior ?? "first";
|
|
12738
12179
|
if (isOpen2) {
|
|
12739
12180
|
if (selection == null) {
|
|
@@ -12752,11 +12193,11 @@ function useSelect({
|
|
|
12752
12193
|
setIsOpen(isOpen2);
|
|
12753
12194
|
onIsOpenChangeStable(isOpen2);
|
|
12754
12195
|
}, [setIsOpen, highlightItem, onCloseStable, setSearchQuery, onIsOpenChangeStable, selection, listNavFirst, listNavLast]);
|
|
12755
|
-
const toggleOpenWrapper =
|
|
12196
|
+
const toggleOpenWrapper = useCallback20((behavior) => {
|
|
12756
12197
|
const next = !isOpen;
|
|
12757
12198
|
setIsOpenWrapper(next, behavior);
|
|
12758
12199
|
}, [isOpen, setIsOpenWrapper]);
|
|
12759
|
-
const actions =
|
|
12200
|
+
const actions = useMemo18(() => ({
|
|
12760
12201
|
selectValue: (id) => selectValue(id),
|
|
12761
12202
|
setIsOpen: setIsOpenWrapper,
|
|
12762
12203
|
toggleOpen: toggleOpenWrapper,
|
|
@@ -12768,7 +12209,7 @@ function useSelect({
|
|
|
12768
12209
|
highlightItem,
|
|
12769
12210
|
handleTypeaheadKey: addToTypeAhead
|
|
12770
12211
|
}), [selectValue, setIsOpenWrapper, listNavFirst, listNavLast, listNavNext, listNavPrevious, highlightItem, addToTypeAhead, toggleOpenWrapper]);
|
|
12771
|
-
return
|
|
12212
|
+
return useMemo18(() => ({
|
|
12772
12213
|
...state,
|
|
12773
12214
|
...computedState,
|
|
12774
12215
|
...actions
|
|
@@ -12816,16 +12257,16 @@ function SelectRoot({
|
|
|
12816
12257
|
readOnly = false,
|
|
12817
12258
|
required = false
|
|
12818
12259
|
}) {
|
|
12819
|
-
const [triggerRef, setTriggerRef] =
|
|
12820
|
-
const [options, setOptions] =
|
|
12260
|
+
const [triggerRef, setTriggerRef] = useState19(null);
|
|
12261
|
+
const [options, setOptions] = useState19([]);
|
|
12821
12262
|
const generatedId = useId9();
|
|
12822
|
-
const [ids, setIds] =
|
|
12263
|
+
const [ids, setIds] = useState19({
|
|
12823
12264
|
trigger: "select-" + generatedId,
|
|
12824
12265
|
content: "select-content-" + generatedId,
|
|
12825
12266
|
listbox: "select-listbox-" + generatedId,
|
|
12826
12267
|
searchInput: "select-search-" + generatedId
|
|
12827
12268
|
});
|
|
12828
|
-
const registerOption =
|
|
12269
|
+
const registerOption = useCallback21(
|
|
12829
12270
|
(item) => {
|
|
12830
12271
|
setOptions((prev) => {
|
|
12831
12272
|
const next = prev.filter((o) => o.value !== item.value);
|
|
@@ -12837,31 +12278,31 @@ function SelectRoot({
|
|
|
12837
12278
|
},
|
|
12838
12279
|
[]
|
|
12839
12280
|
);
|
|
12840
|
-
const registerTrigger =
|
|
12281
|
+
const registerTrigger = useCallback21((ref) => {
|
|
12841
12282
|
setTriggerRef(ref);
|
|
12842
12283
|
return () => {
|
|
12843
12284
|
setTriggerRef(null);
|
|
12844
12285
|
};
|
|
12845
12286
|
}, []);
|
|
12846
|
-
const compare =
|
|
12847
|
-
const idToOptionMap =
|
|
12287
|
+
const compare = useMemo19(() => compareFunction ?? Object.is, [compareFunction]);
|
|
12288
|
+
const idToOptionMap = useMemo19(() => {
|
|
12848
12289
|
return options.reduce((acc, o) => {
|
|
12849
12290
|
acc[o.id] = o;
|
|
12850
12291
|
return acc;
|
|
12851
12292
|
}, {});
|
|
12852
12293
|
}, [options]);
|
|
12853
|
-
const mappedValueId =
|
|
12294
|
+
const mappedValueId = useMemo19(() => {
|
|
12854
12295
|
if (value === void 0) return void 0;
|
|
12855
12296
|
return options.find((o) => compare(o.value, value))?.id ?? null;
|
|
12856
12297
|
}, [options, value, compare]);
|
|
12857
|
-
const mappedInitialValueId =
|
|
12298
|
+
const mappedInitialValueId = useMemo19(() => {
|
|
12858
12299
|
if (initialValue === void 0) return void 0;
|
|
12859
12300
|
return options.find((o) => compare(o.value, initialValue))?.id ?? null;
|
|
12860
12301
|
}, [options, initialValue, compare]);
|
|
12861
12302
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
12862
12303
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
12863
12304
|
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
12864
|
-
const onValueChangeWrapper =
|
|
12305
|
+
const onValueChangeWrapper = useCallback21((value2) => {
|
|
12865
12306
|
const option = idToOptionMap[value2];
|
|
12866
12307
|
if (option === void 0) {
|
|
12867
12308
|
console.warn(`Attempted to select an option ${value2} that is not valid`);
|
|
@@ -12869,7 +12310,7 @@ function SelectRoot({
|
|
|
12869
12310
|
}
|
|
12870
12311
|
onValueChangeStable(option.value);
|
|
12871
12312
|
}, [onValueChangeStable, idToOptionMap]);
|
|
12872
|
-
const onEditCompleteWrapper =
|
|
12313
|
+
const onEditCompleteWrapper = useCallback21((value2) => {
|
|
12873
12314
|
const option = idToOptionMap[value2];
|
|
12874
12315
|
if (option === void 0) {
|
|
12875
12316
|
console.warn(`Attempted to edit complete an option ${value2} that is not valid`);
|
|
@@ -12888,17 +12329,17 @@ function SelectRoot({
|
|
|
12888
12329
|
onIsOpenChange: onIsOpenChangeStable
|
|
12889
12330
|
});
|
|
12890
12331
|
const { setSearchQuery } = state;
|
|
12891
|
-
|
|
12332
|
+
useEffect21(() => {
|
|
12892
12333
|
if (showSearch === false) {
|
|
12893
12334
|
setSearchQuery("");
|
|
12894
12335
|
}
|
|
12895
12336
|
}, [showSearch, setSearchQuery]);
|
|
12896
|
-
const config =
|
|
12337
|
+
const config = useMemo19(() => ({
|
|
12897
12338
|
iconAppearance,
|
|
12898
12339
|
ids,
|
|
12899
12340
|
setIds
|
|
12900
12341
|
}), [iconAppearance, ids, setIds]);
|
|
12901
|
-
const layout =
|
|
12342
|
+
const layout = useMemo19(() => ({
|
|
12902
12343
|
triggerRef,
|
|
12903
12344
|
registerTrigger
|
|
12904
12345
|
}), [triggerRef, registerTrigger]);
|
|
@@ -12953,12 +12394,12 @@ function SelectRoot({
|
|
|
12953
12394
|
}
|
|
12954
12395
|
|
|
12955
12396
|
// src/components/user-interaction/Select/SelectButton.tsx
|
|
12956
|
-
import { forwardRef as forwardRef12, useEffect as
|
|
12397
|
+
import { forwardRef as forwardRef12, useEffect as useEffect23, useImperativeHandle as useImperativeHandle8, useRef as useRef21 } from "react";
|
|
12957
12398
|
|
|
12958
12399
|
// src/components/user-interaction/Select/SelectOption.tsx
|
|
12959
12400
|
import clsx9 from "clsx";
|
|
12960
12401
|
import { CheckIcon } from "lucide-react";
|
|
12961
|
-
import { createContext as createContext11, forwardRef as forwardRef11, useContext as useContext12, useEffect as
|
|
12402
|
+
import { createContext as createContext11, forwardRef as forwardRef11, useContext as useContext12, useEffect as useEffect22, useId as useId10, useRef as useRef20 } from "react";
|
|
12962
12403
|
import { jsx as jsx35, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
12963
12404
|
var SelectOptionDisplayContext = createContext11(null);
|
|
12964
12405
|
function useSelectOptionDisplayLocation() {
|
|
@@ -12978,12 +12419,12 @@ var SelectOption = forwardRef11(function SelectOption2({
|
|
|
12978
12419
|
}, ref) {
|
|
12979
12420
|
const context = useSelectContext();
|
|
12980
12421
|
const { registerOption } = context;
|
|
12981
|
-
const itemRef =
|
|
12422
|
+
const itemRef = useRef20(null);
|
|
12982
12423
|
const display = children ?? label;
|
|
12983
12424
|
const iconAppearanceResolved = iconAppearance ?? context.config.iconAppearance;
|
|
12984
12425
|
const generatedId = useId10();
|
|
12985
12426
|
const optionId = props?.id ?? "select-option-" + generatedId;
|
|
12986
|
-
|
|
12427
|
+
useEffect22(() => {
|
|
12987
12428
|
return registerOption({
|
|
12988
12429
|
id: optionId,
|
|
12989
12430
|
value,
|
|
@@ -13065,12 +12506,12 @@ var SelectButton = forwardRef12(
|
|
|
13065
12506
|
const { config, layout } = context;
|
|
13066
12507
|
const { setIds } = config;
|
|
13067
12508
|
const { registerTrigger } = layout;
|
|
13068
|
-
|
|
12509
|
+
useEffect23(() => {
|
|
13069
12510
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
13070
12511
|
}, [id, setIds]);
|
|
13071
|
-
const innerRef =
|
|
12512
|
+
const innerRef = useRef21(null);
|
|
13072
12513
|
useImperativeHandle8(ref, () => innerRef.current);
|
|
13073
|
-
|
|
12514
|
+
useEffect23(() => {
|
|
13074
12515
|
const unregister = registerTrigger(innerRef);
|
|
13075
12516
|
return () => unregister();
|
|
13076
12517
|
}, [registerTrigger]);
|
|
@@ -13131,11 +12572,36 @@ var SelectButton = forwardRef12(
|
|
|
13131
12572
|
);
|
|
13132
12573
|
|
|
13133
12574
|
// src/components/user-interaction/Select/SelectContent.tsx
|
|
13134
|
-
import { forwardRef as forwardRef14, useCallback as
|
|
12575
|
+
import { forwardRef as forwardRef14, useCallback as useCallback23, useEffect as useEffect25, useImperativeHandle as useImperativeHandle10, useRef as useRef22 } from "react";
|
|
13135
12576
|
import clsx10 from "clsx";
|
|
13136
12577
|
|
|
13137
12578
|
// src/components/layout/popup/PopUp.tsx
|
|
13138
|
-
import { forwardRef as forwardRef13, useCallback as
|
|
12579
|
+
import { forwardRef as forwardRef13, useCallback as useCallback22, useContext as useContext13, useImperativeHandle as useImperativeHandle9, useMemo as useMemo20 } from "react";
|
|
12580
|
+
|
|
12581
|
+
// src/hooks/useOutsideClick.ts
|
|
12582
|
+
import { useEffect as useEffect24 } from "react";
|
|
12583
|
+
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12584
|
+
useEffect24(() => {
|
|
12585
|
+
if (!active) return;
|
|
12586
|
+
const listener = (event) => {
|
|
12587
|
+
if (event.target === null) return;
|
|
12588
|
+
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
12589
|
+
return;
|
|
12590
|
+
}
|
|
12591
|
+
onOutsideClick(event);
|
|
12592
|
+
};
|
|
12593
|
+
document.addEventListener("mousedown", listener);
|
|
12594
|
+
document.addEventListener("touchstart", listener);
|
|
12595
|
+
document.addEventListener("pointerdown", listener);
|
|
12596
|
+
return () => {
|
|
12597
|
+
document.removeEventListener("mousedown", listener);
|
|
12598
|
+
document.removeEventListener("touchstart", listener);
|
|
12599
|
+
document.removeEventListener("pointerdown", listener);
|
|
12600
|
+
};
|
|
12601
|
+
}, [refs, onOutsideClick, active]);
|
|
12602
|
+
};
|
|
12603
|
+
|
|
12604
|
+
// src/components/layout/popup/PopUp.tsx
|
|
13139
12605
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
13140
12606
|
var PopUp = forwardRef13(function PopUp2({
|
|
13141
12607
|
children,
|
|
@@ -13148,24 +12614,24 @@ var PopUp = forwardRef13(function PopUp2({
|
|
|
13148
12614
|
forceMount = false,
|
|
13149
12615
|
anchorExcludedFromOutsideClick = false,
|
|
13150
12616
|
...props
|
|
13151
|
-
},
|
|
12617
|
+
}, forwardRef34) {
|
|
13152
12618
|
const context = useContext13(PopUpContext);
|
|
13153
12619
|
const isOpen = isOpenOverwrite ?? context?.isOpen ?? false;
|
|
13154
12620
|
const anchor = anchorOverwrite ?? context?.triggerRef ?? void 0;
|
|
13155
12621
|
const id = props.id ?? context?.popUpId;
|
|
13156
12622
|
const { refAssignment, isPresent, ref } = usePresenceRef({ isOpen });
|
|
13157
|
-
useImperativeHandle9(
|
|
12623
|
+
useImperativeHandle9(forwardRef34, () => ref.current, [ref]);
|
|
13158
12624
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
13159
12625
|
const onOutsideClickStable = useEventCallbackStabilizer(onOutsideClick);
|
|
13160
|
-
const onCloseWrapper =
|
|
12626
|
+
const onCloseWrapper = useCallback22(() => {
|
|
13161
12627
|
onCloseStable();
|
|
13162
12628
|
context?.setIsOpen(false);
|
|
13163
12629
|
}, [onCloseStable, context]);
|
|
13164
|
-
const { zIndex, tagPositions } = useOverlayRegistry({ isActive: isOpen, tags:
|
|
12630
|
+
const { zIndex, tagPositions } = useOverlayRegistry({ isActive: isOpen, tags: useMemo20(() => ["popup"], []) });
|
|
13165
12631
|
const isInFront = tagPositions?.["popup"] === 0;
|
|
13166
12632
|
const isOutsideClickActive = isOpen && isInFront && (outsideClickOptions?.active ?? true);
|
|
13167
12633
|
useOutsideClick({
|
|
13168
|
-
onOutsideClick:
|
|
12634
|
+
onOutsideClick: useCallback22((event) => {
|
|
13169
12635
|
if (event.defaultPrevented) return;
|
|
13170
12636
|
onCloseWrapper();
|
|
13171
12637
|
onOutsideClickStable(event);
|
|
@@ -13211,18 +12677,18 @@ var SelectContent = forwardRef14(function SelectContent2({
|
|
|
13211
12677
|
...props
|
|
13212
12678
|
}, ref) {
|
|
13213
12679
|
const translation = useHightideTranslation();
|
|
13214
|
-
const innerRef =
|
|
13215
|
-
const searchInputRef =
|
|
12680
|
+
const innerRef = useRef22(null);
|
|
12681
|
+
const searchInputRef = useRef22(null);
|
|
13216
12682
|
useImperativeHandle10(ref, () => innerRef.current);
|
|
13217
12683
|
const context = useSelectContext();
|
|
13218
12684
|
const { config, handleTypeaheadKey, toggleSelection, highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId } = context;
|
|
13219
12685
|
const { setIds } = config;
|
|
13220
|
-
|
|
12686
|
+
useEffect25(() => {
|
|
13221
12687
|
if (id) setIds((prev) => ({ ...prev, content: id }));
|
|
13222
12688
|
}, [id, setIds]);
|
|
13223
12689
|
const showSearch = showSearchOverride ?? context.search.hasSearch;
|
|
13224
12690
|
const listboxAriaLabel = showSearch ? translation("searchResults") : void 0;
|
|
13225
|
-
const keyHandler =
|
|
12691
|
+
const keyHandler = useCallback23(
|
|
13226
12692
|
(event) => {
|
|
13227
12693
|
switch (event.key) {
|
|
13228
12694
|
case "ArrowDown":
|
|
@@ -13398,7 +12864,7 @@ import { MonitorCog, MoonIcon, SunIcon } from "lucide-react";
|
|
|
13398
12864
|
import clsx12 from "clsx";
|
|
13399
12865
|
|
|
13400
12866
|
// src/global-contexts/ThemeContext.tsx
|
|
13401
|
-
import { createContext as createContext12, useCallback as
|
|
12867
|
+
import { createContext as createContext12, useCallback as useCallback24, useContext as useContext14, useEffect as useEffect26, useMemo as useMemo21, useState as useState20 } from "react";
|
|
13402
12868
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
13403
12869
|
var themes = ["light", "dark", "system"];
|
|
13404
12870
|
var ThemeUtil = {
|
|
@@ -13412,8 +12878,8 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13412
12878
|
deleteValue: deleteStoredTheme
|
|
13413
12879
|
} = useStorage({ key: "theme", defaultValue: "system" });
|
|
13414
12880
|
const { config } = useHightideConfig();
|
|
13415
|
-
const [themePreference, setThemePreference] =
|
|
13416
|
-
const resolvedTheme =
|
|
12881
|
+
const [themePreference, setThemePreference] = useState20("system");
|
|
12882
|
+
const resolvedTheme = useMemo21(() => {
|
|
13417
12883
|
if (theme && theme !== "system") {
|
|
13418
12884
|
return theme;
|
|
13419
12885
|
}
|
|
@@ -13425,7 +12891,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13425
12891
|
}
|
|
13426
12892
|
return initialTheme ?? config.theme.initialTheme;
|
|
13427
12893
|
}, [config.theme.initialTheme, initialTheme, storedTheme, theme, themePreference]);
|
|
13428
|
-
|
|
12894
|
+
useEffect26(() => {
|
|
13429
12895
|
if (!theme) return;
|
|
13430
12896
|
if (theme === "system") {
|
|
13431
12897
|
deleteStoredTheme();
|
|
@@ -13433,18 +12899,18 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13433
12899
|
setStoredTheme(theme);
|
|
13434
12900
|
}
|
|
13435
12901
|
}, [theme, deleteStoredTheme, setStoredTheme]);
|
|
13436
|
-
|
|
12902
|
+
useEffect26(() => {
|
|
13437
12903
|
document.documentElement.setAttribute("data-theme", resolvedTheme);
|
|
13438
12904
|
}, [resolvedTheme]);
|
|
13439
|
-
const getPreference =
|
|
12905
|
+
const getPreference = useCallback24(() => {
|
|
13440
12906
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
13441
12907
|
const prefersLight = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
13442
12908
|
setThemePreference(prefersDark ? "dark" : prefersLight ? "light" : "system");
|
|
13443
12909
|
}, []);
|
|
13444
|
-
|
|
12910
|
+
useEffect26(() => {
|
|
13445
12911
|
getPreference();
|
|
13446
12912
|
}, [getPreference]);
|
|
13447
|
-
|
|
12913
|
+
useEffect26(() => {
|
|
13448
12914
|
const darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
13449
12915
|
const lightQuery = window.matchMedia("(prefers-color-scheme: light)");
|
|
13450
12916
|
const noPrefQuery = window.matchMedia("(prefers-color-scheme: no-preference)");
|
|
@@ -13558,7 +13024,7 @@ var ThemeDialog = ({
|
|
|
13558
13024
|
import { forwardRef as forwardRef17 } from "react";
|
|
13559
13025
|
|
|
13560
13026
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
13561
|
-
import { forwardRef as forwardRef16, useId as useId11, useImperativeHandle as useImperativeHandle11, useMemo as
|
|
13027
|
+
import { forwardRef as forwardRef16, useId as useId11, useImperativeHandle as useImperativeHandle11, useMemo as useMemo22, useRef as useRef23 } from "react";
|
|
13562
13028
|
|
|
13563
13029
|
// src/components/layout/drawer/DrawerContext.tsx
|
|
13564
13030
|
import { createContext as createContext13, useContext as useContext15 } from "react";
|
|
@@ -13583,12 +13049,12 @@ var DrawerContent = forwardRef16(function DrawerContent2({
|
|
|
13583
13049
|
}, forwardedRef) {
|
|
13584
13050
|
const { isOpen } = useDrawerContext();
|
|
13585
13051
|
const generatedId = useId11();
|
|
13586
|
-
const ids =
|
|
13052
|
+
const ids = useMemo22(() => ({
|
|
13587
13053
|
container: `dialog-container-${generatedId}`,
|
|
13588
13054
|
background: `dialog-background-${generatedId}`,
|
|
13589
13055
|
content: props.id ?? `dialog-content-${generatedId}`
|
|
13590
13056
|
}), [generatedId, props.id]);
|
|
13591
|
-
const ref =
|
|
13057
|
+
const ref = useRef23(null);
|
|
13592
13058
|
useImperativeHandle11(forwardedRef, () => ref.current, [ref]);
|
|
13593
13059
|
const { isVisible, transitionState } = useTransitionState({ isOpen, ref });
|
|
13594
13060
|
useFocusTrap({
|
|
@@ -13597,7 +13063,7 @@ var DrawerContent = forwardRef16(function DrawerContent2({
|
|
|
13597
13063
|
});
|
|
13598
13064
|
const { zIndex, tagPositions, tagItemCounts } = useOverlayRegistry({
|
|
13599
13065
|
isActive: isVisible,
|
|
13600
|
-
tags:
|
|
13066
|
+
tags: useMemo22(() => ["drawer"], [])
|
|
13601
13067
|
});
|
|
13602
13068
|
const depth = tagPositions && tagItemCounts ? (tagItemCounts["drawer"] ?? 0) - (tagPositions["drawer"] ?? 0) : 0;
|
|
13603
13069
|
const { setOpen } = useDrawerContext();
|
|
@@ -13750,7 +13216,7 @@ var ErrorComponent = ({
|
|
|
13750
13216
|
};
|
|
13751
13217
|
|
|
13752
13218
|
// src/components/layout/loading/LoadingAndErrorComponent.tsx
|
|
13753
|
-
import { useState as
|
|
13219
|
+
import { useState as useState21 } from "react";
|
|
13754
13220
|
|
|
13755
13221
|
// src/components/layout/loading/LoadingContainer.tsx
|
|
13756
13222
|
import { clsx as clsx14 } from "clsx";
|
|
@@ -13771,8 +13237,8 @@ var LoadingAndErrorComponent = ({
|
|
|
13771
13237
|
minimumLoadingDuration = 200,
|
|
13772
13238
|
className
|
|
13773
13239
|
}) => {
|
|
13774
|
-
const [isInMinimumLoading, setIsInMinimumLoading] =
|
|
13775
|
-
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] =
|
|
13240
|
+
const [isInMinimumLoading, setIsInMinimumLoading] = useState21(false);
|
|
13241
|
+
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = useState21(false);
|
|
13776
13242
|
if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {
|
|
13777
13243
|
setIsInMinimumLoading(true);
|
|
13778
13244
|
setTimeout(() => {
|
|
@@ -13836,8 +13302,8 @@ var BreadCrumbs = ({ crumbs }) => {
|
|
|
13836
13302
|
// src/components/layout/navigation/Navigation.tsx
|
|
13837
13303
|
var import_link2 = __toESM(require_link2());
|
|
13838
13304
|
import { Menu as MenuIcon, XIcon } from "lucide-react";
|
|
13839
|
-
import { useEffect as
|
|
13840
|
-
import { useCallback as
|
|
13305
|
+
import { useEffect as useEffect27 } from "react";
|
|
13306
|
+
import { useCallback as useCallback25, useId as useId12, useRef as useRef24, useState as useState22 } from "react";
|
|
13841
13307
|
import clsx17 from "clsx";
|
|
13842
13308
|
import { Fragment as Fragment5, jsx as jsx52, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
13843
13309
|
function isSubItem(item) {
|
|
@@ -13849,9 +13315,9 @@ var NavigationItemWithSubItem = ({
|
|
|
13849
13315
|
horizontalAlignment = "center",
|
|
13850
13316
|
...options
|
|
13851
13317
|
}) => {
|
|
13852
|
-
const [isOpen, setOpen] =
|
|
13853
|
-
const containerRef =
|
|
13854
|
-
const triggerRef =
|
|
13318
|
+
const [isOpen, setOpen] = useState22(false);
|
|
13319
|
+
const containerRef = useRef24(null);
|
|
13320
|
+
const triggerRef = useRef24(null);
|
|
13855
13321
|
const id = useId12();
|
|
13856
13322
|
const style = useAnchoredPosition({
|
|
13857
13323
|
active: isOpen,
|
|
@@ -13860,7 +13326,7 @@ var NavigationItemWithSubItem = ({
|
|
|
13860
13326
|
horizontalAlignment,
|
|
13861
13327
|
...options
|
|
13862
13328
|
});
|
|
13863
|
-
const onBlur =
|
|
13329
|
+
const onBlur = useCallback25((event) => {
|
|
13864
13330
|
const nextFocus = event.relatedTarget;
|
|
13865
13331
|
if (!containerRef.current?.contains(nextFocus) && !triggerRef.current?.contains(nextFocus)) {
|
|
13866
13332
|
setOpen(false);
|
|
@@ -13926,10 +13392,10 @@ var NavigationItemList = ({ items, ...restProps }) => {
|
|
|
13926
13392
|
};
|
|
13927
13393
|
var Navigation = ({ ...props }) => {
|
|
13928
13394
|
const translation = useHightideTranslation();
|
|
13929
|
-
const [isMobileOpen, setIsMobileOpen] =
|
|
13395
|
+
const [isMobileOpen, setIsMobileOpen] = useState22(false);
|
|
13930
13396
|
const id = useId12();
|
|
13931
|
-
const menuRef =
|
|
13932
|
-
|
|
13397
|
+
const menuRef = useRef24(null);
|
|
13398
|
+
useEffect27(() => {
|
|
13933
13399
|
menuRef.current?.focus();
|
|
13934
13400
|
}, [isMobileOpen]);
|
|
13935
13401
|
const { zIndex } = useOverlayRegistry({ isActive: isMobileOpen });
|
|
@@ -13997,7 +13463,7 @@ var Navigation = ({ ...props }) => {
|
|
|
13997
13463
|
// src/components/layout/navigation/Pagination.tsx
|
|
13998
13464
|
import { ChevronFirst, ChevronLast, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
13999
13465
|
import clsx18 from "clsx";
|
|
14000
|
-
import { useEffect as
|
|
13466
|
+
import { useEffect as useEffect28, useState as useState23 } from "react";
|
|
14001
13467
|
import { jsx as jsx53, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
14002
13468
|
var Pagination = ({
|
|
14003
13469
|
pageIndex,
|
|
@@ -14006,11 +13472,11 @@ var Pagination = ({
|
|
|
14006
13472
|
...props
|
|
14007
13473
|
}) => {
|
|
14008
13474
|
const translation = useHightideTranslation();
|
|
14009
|
-
const [value, setValue] =
|
|
13475
|
+
const [value, setValue] = useState23((pageIndex + 1).toString());
|
|
14010
13476
|
const noPages = pageCount === 0;
|
|
14011
13477
|
const onFirstPage = pageIndex === 0 && !noPages;
|
|
14012
13478
|
const onLastPage = pageIndex === pageCount - 1;
|
|
14013
|
-
|
|
13479
|
+
useEffect28(() => {
|
|
14014
13480
|
if (noPages) {
|
|
14015
13481
|
setValue("0");
|
|
14016
13482
|
} else {
|
|
@@ -14204,18 +13670,18 @@ var StepperBar = ({
|
|
|
14204
13670
|
};
|
|
14205
13671
|
|
|
14206
13672
|
// src/components/layout/popup/PopUpOpener.tsx
|
|
14207
|
-
import { useEffect as
|
|
13673
|
+
import { useEffect as useEffect29, useMemo as useMemo23, useRef as useRef25 } from "react";
|
|
14208
13674
|
function PopUpOpener({ children }) {
|
|
14209
13675
|
const context = usePopUpContext();
|
|
14210
13676
|
const { setTriggerRef } = context;
|
|
14211
|
-
const ref =
|
|
14212
|
-
|
|
13677
|
+
const ref = useRef25(null);
|
|
13678
|
+
useEffect29(() => {
|
|
14213
13679
|
setTriggerRef(ref);
|
|
14214
13680
|
return () => {
|
|
14215
13681
|
setTriggerRef(null);
|
|
14216
13682
|
};
|
|
14217
13683
|
}, [setTriggerRef]);
|
|
14218
|
-
const bag =
|
|
13684
|
+
const bag = useMemo23(() => ({
|
|
14219
13685
|
open: () => context.setIsOpen(true),
|
|
14220
13686
|
close: () => context.setIsOpen(false),
|
|
14221
13687
|
toggleOpen: () => context.setIsOpen((prev) => !prev),
|
|
@@ -14233,7 +13699,7 @@ function PopUpOpener({ children }) {
|
|
|
14233
13699
|
}
|
|
14234
13700
|
|
|
14235
13701
|
// src/components/layout/popup/PopUpRoot.tsx
|
|
14236
|
-
import { useId as useId13, useMemo as
|
|
13702
|
+
import { useId as useId13, useMemo as useMemo24, useState as useState24 } from "react";
|
|
14237
13703
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
14238
13704
|
function PopUpRoot({
|
|
14239
13705
|
children,
|
|
@@ -14250,10 +13716,10 @@ function PopUpRoot({
|
|
|
14250
13716
|
onValueChange: onIsOpenChange,
|
|
14251
13717
|
defaultValue: initialIsOpen
|
|
14252
13718
|
});
|
|
14253
|
-
const [triggerRef, setTriggerRef] =
|
|
14254
|
-
const popUpId =
|
|
14255
|
-
const triggerId =
|
|
14256
|
-
const contextValue =
|
|
13719
|
+
const [triggerRef, setTriggerRef] = useState24(null);
|
|
13720
|
+
const popUpId = useMemo24(() => popUpIdOverwrite ?? `pop-up-${generatedPopUpId}`, [popUpIdOverwrite, generatedPopUpId]);
|
|
13721
|
+
const triggerId = useMemo24(() => triggerIdOverwrite ?? `pop-up-trigger-${generatedTriggerId}`, [triggerIdOverwrite, generatedTriggerId]);
|
|
13722
|
+
const contextValue = useMemo24(() => ({
|
|
14257
13723
|
isOpen,
|
|
14258
13724
|
setIsOpen,
|
|
14259
13725
|
popUpId,
|
|
@@ -14440,7 +13906,7 @@ var FillerCell = ({ ...props }) => {
|
|
|
14440
13906
|
};
|
|
14441
13907
|
|
|
14442
13908
|
// src/components/layout/table/TableProvider.tsx
|
|
14443
|
-
import { useCallback as
|
|
13909
|
+
import { useCallback as useCallback27, useEffect as useEffect30, useLayoutEffect as useLayoutEffect6, useMemo as useMemo25, useRef as useRef26, useState as useState25 } from "react";
|
|
14444
13910
|
|
|
14445
13911
|
// src/components/layout/table/TableContext.tsx
|
|
14446
13912
|
import { createContext as createContext14, useContext as useContext16 } from "react";
|
|
@@ -14585,76 +14051,323 @@ var getOperatorInfo = (operator) => {
|
|
|
14585
14051
|
translationKey: "lessThanOrEqual",
|
|
14586
14052
|
replacementTranslationKey: "rLessThanOrEqual"
|
|
14587
14053
|
};
|
|
14588
|
-
case "between":
|
|
14589
|
-
return {
|
|
14590
|
-
icon: /* @__PURE__ */ jsxs30("div", { className: "flex-row-0 items-center", children: [
|
|
14591
|
-
/* @__PURE__ */ jsx57(ChevronRight4, { className: "w-4 h-4" }),
|
|
14592
|
-
/* @__PURE__ */ jsx57(ChevronLeft4, { className: "-ml-1 w-4 h-4" })
|
|
14593
|
-
] }),
|
|
14594
|
-
translationKey: "between",
|
|
14595
|
-
replacementTranslationKey: "rBetween"
|
|
14054
|
+
case "between":
|
|
14055
|
+
return {
|
|
14056
|
+
icon: /* @__PURE__ */ jsxs30("div", { className: "flex-row-0 items-center", children: [
|
|
14057
|
+
/* @__PURE__ */ jsx57(ChevronRight4, { className: "w-4 h-4" }),
|
|
14058
|
+
/* @__PURE__ */ jsx57(ChevronLeft4, { className: "-ml-1 w-4 h-4" })
|
|
14059
|
+
] }),
|
|
14060
|
+
translationKey: "between",
|
|
14061
|
+
replacementTranslationKey: "rBetween"
|
|
14062
|
+
};
|
|
14063
|
+
case "notBetween":
|
|
14064
|
+
return {
|
|
14065
|
+
icon: /* @__PURE__ */ jsxs30("div", { className: "flex-row-0 items-center", children: [
|
|
14066
|
+
/* @__PURE__ */ jsx57(ChevronLeft4, { className: "w-4 h-4" }),
|
|
14067
|
+
/* @__PURE__ */ jsx57(ChevronRight4, { className: "-ml-1 w-4 h-4" })
|
|
14068
|
+
] }),
|
|
14069
|
+
translationKey: "notBetween",
|
|
14070
|
+
replacementTranslationKey: "rNotBetween"
|
|
14071
|
+
};
|
|
14072
|
+
case "isTrue":
|
|
14073
|
+
return { icon: /* @__PURE__ */ jsx57(CheckCircle2, { className: "w-4 h-4" }), translationKey: "isTrue", replacementTranslationKey: "isTrue" };
|
|
14074
|
+
case "isFalse":
|
|
14075
|
+
return { icon: /* @__PURE__ */ jsx57(XCircle, { className: "w-4 h-4" }), translationKey: "isFalse", replacementTranslationKey: "isFalse" };
|
|
14076
|
+
case "isUndefined":
|
|
14077
|
+
return { icon: /* @__PURE__ */ jsx57(CircleDashed, { className: "w-4 h-4" }), translationKey: "isUndefined", replacementTranslationKey: "isUndefined" };
|
|
14078
|
+
case "isNotUndefined":
|
|
14079
|
+
return { icon: /* @__PURE__ */ jsx57(CircleDot, { className: "w-4 h-4" }), translationKey: "isNotUndefined", replacementTranslationKey: "isNotUndefined" };
|
|
14080
|
+
default:
|
|
14081
|
+
return { icon: null, translationKey: "unknown translation key", replacementTranslationKey: "unknown" };
|
|
14082
|
+
}
|
|
14083
|
+
};
|
|
14084
|
+
function getDefaultOperator(dataType) {
|
|
14085
|
+
switch (dataType) {
|
|
14086
|
+
case "text":
|
|
14087
|
+
return "contains";
|
|
14088
|
+
case "number":
|
|
14089
|
+
return "between";
|
|
14090
|
+
case "date":
|
|
14091
|
+
return "between";
|
|
14092
|
+
case "dateTime":
|
|
14093
|
+
return "between";
|
|
14094
|
+
case "boolean":
|
|
14095
|
+
return "isTrue";
|
|
14096
|
+
case "multiTags":
|
|
14097
|
+
return "contains";
|
|
14098
|
+
case "singleTag":
|
|
14099
|
+
return "contains";
|
|
14100
|
+
case "unknownType":
|
|
14101
|
+
return "isNotUndefined";
|
|
14102
|
+
}
|
|
14103
|
+
}
|
|
14104
|
+
var FilterOperatorUtils = {
|
|
14105
|
+
operators: filterOperators,
|
|
14106
|
+
operatorsByCategory: filterOperatorsByCategory,
|
|
14107
|
+
getInfo: getOperatorInfo,
|
|
14108
|
+
getDefaultOperator,
|
|
14109
|
+
typeCheck: {
|
|
14110
|
+
all: isFilterOperator,
|
|
14111
|
+
text: isFilterOperatorText,
|
|
14112
|
+
number: isFilterOperatorNumber,
|
|
14113
|
+
date: isFilterOperatorDate,
|
|
14114
|
+
datetime: isFilterOperatorDatetime,
|
|
14115
|
+
boolean: isFilterOperatorBoolean,
|
|
14116
|
+
tags: isFilterOperatorTags,
|
|
14117
|
+
tagsSingle: isFilterOperatorTagsSingle,
|
|
14118
|
+
unknownType: isFilterOperatorUnknownType
|
|
14119
|
+
}
|
|
14120
|
+
};
|
|
14121
|
+
|
|
14122
|
+
// src/components/user-interaction/data/filter-function.ts
|
|
14123
|
+
import { useCallback as useCallback26 } from "react";
|
|
14124
|
+
|
|
14125
|
+
// src/utils/date.ts
|
|
14126
|
+
var timesInSeconds = {
|
|
14127
|
+
second: 1,
|
|
14128
|
+
minute: 60,
|
|
14129
|
+
hour: 3600,
|
|
14130
|
+
day: 86400,
|
|
14131
|
+
week: 604800,
|
|
14132
|
+
monthImprecise: 2629800,
|
|
14133
|
+
// 30.4375 days
|
|
14134
|
+
yearImprecise: 31557600
|
|
14135
|
+
// 365.25 days
|
|
14136
|
+
};
|
|
14137
|
+
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14138
|
+
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14139
|
+
var changeDuration = (date, duration, isAdding) => {
|
|
14140
|
+
const {
|
|
14141
|
+
years = 0,
|
|
14142
|
+
months = 0,
|
|
14143
|
+
days = 0,
|
|
14144
|
+
hours = 0,
|
|
14145
|
+
minutes = 0,
|
|
14146
|
+
seconds = 0,
|
|
14147
|
+
milliseconds = 0
|
|
14148
|
+
} = duration;
|
|
14149
|
+
if (years < 0) {
|
|
14150
|
+
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14151
|
+
return new Date(date);
|
|
14152
|
+
}
|
|
14153
|
+
if (months < 0 || months > 11) {
|
|
14154
|
+
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14155
|
+
return new Date(date);
|
|
14156
|
+
}
|
|
14157
|
+
if (days < 0) {
|
|
14158
|
+
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14159
|
+
return new Date(date);
|
|
14160
|
+
}
|
|
14161
|
+
if (hours < 0 || hours > 23) {
|
|
14162
|
+
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14163
|
+
return new Date(date);
|
|
14164
|
+
}
|
|
14165
|
+
if (minutes < 0 || minutes > 59) {
|
|
14166
|
+
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14167
|
+
return new Date(date);
|
|
14168
|
+
}
|
|
14169
|
+
if (seconds < 0 || seconds > 59) {
|
|
14170
|
+
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14171
|
+
return new Date(date);
|
|
14172
|
+
}
|
|
14173
|
+
if (milliseconds < 0) {
|
|
14174
|
+
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14175
|
+
return new Date(date);
|
|
14176
|
+
}
|
|
14177
|
+
const multiplier = isAdding ? 1 : -1;
|
|
14178
|
+
const newDate = new Date(date);
|
|
14179
|
+
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14180
|
+
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14181
|
+
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14182
|
+
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14183
|
+
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14184
|
+
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14185
|
+
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14186
|
+
return newDate;
|
|
14187
|
+
};
|
|
14188
|
+
var addDuration = (date, duration) => {
|
|
14189
|
+
return changeDuration(date, duration, true);
|
|
14190
|
+
};
|
|
14191
|
+
var subtractDuration = (date, duration) => {
|
|
14192
|
+
return changeDuration(date, duration, false);
|
|
14193
|
+
};
|
|
14194
|
+
var between = (value, startDate, endDate) => {
|
|
14195
|
+
if (startDate && endDate) {
|
|
14196
|
+
console.assert(startDate <= endDate);
|
|
14197
|
+
return startDate <= value && value <= endDate;
|
|
14198
|
+
} else if (startDate) {
|
|
14199
|
+
return startDate <= value;
|
|
14200
|
+
} else if (endDate) {
|
|
14201
|
+
return endDate >= value;
|
|
14202
|
+
} else {
|
|
14203
|
+
return true;
|
|
14204
|
+
}
|
|
14205
|
+
};
|
|
14206
|
+
var equalDate = (date1, date2) => {
|
|
14207
|
+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14208
|
+
};
|
|
14209
|
+
var isLastMillisecondOfDay = (date) => {
|
|
14210
|
+
const next = new Date(date.getTime() + 1);
|
|
14211
|
+
return !equalDate(date, next);
|
|
14212
|
+
};
|
|
14213
|
+
var sameTime = (a, b, compareSeconds = false, compareMilliseconds = false) => {
|
|
14214
|
+
if (a.getHours() !== b.getHours() || a.getMinutes() !== b.getMinutes()) {
|
|
14215
|
+
return false;
|
|
14216
|
+
}
|
|
14217
|
+
if (compareSeconds && a.getSeconds() !== b.getSeconds()) {
|
|
14218
|
+
return false;
|
|
14219
|
+
}
|
|
14220
|
+
if (compareMilliseconds && a.getMilliseconds() !== b.getMilliseconds()) {
|
|
14221
|
+
return false;
|
|
14222
|
+
}
|
|
14223
|
+
return true;
|
|
14224
|
+
};
|
|
14225
|
+
var withTime = (datePart, timePart) => {
|
|
14226
|
+
const out = new Date(datePart);
|
|
14227
|
+
out.setHours(
|
|
14228
|
+
timePart.getHours(),
|
|
14229
|
+
timePart.getMinutes(),
|
|
14230
|
+
timePart.getSeconds(),
|
|
14231
|
+
timePart.getMilliseconds()
|
|
14232
|
+
);
|
|
14233
|
+
return out;
|
|
14234
|
+
};
|
|
14235
|
+
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14236
|
+
const month = date.getMonth();
|
|
14237
|
+
const year = date.getFullYear();
|
|
14238
|
+
const dayList = [];
|
|
14239
|
+
let currentDate = new Date(year, month, 1);
|
|
14240
|
+
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14241
|
+
while (currentDate.getDay() !== weekStartIndex) {
|
|
14242
|
+
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14243
|
+
}
|
|
14244
|
+
while (dayList.length < 7 * weeks) {
|
|
14245
|
+
const date2 = new Date(currentDate);
|
|
14246
|
+
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14247
|
+
dayList.push(date2);
|
|
14248
|
+
currentDate = addDuration(currentDate, { days: 1 });
|
|
14249
|
+
}
|
|
14250
|
+
return equalSizeGroups(dayList, 7);
|
|
14251
|
+
};
|
|
14252
|
+
var formatAbsolute = (date, locale, format) => {
|
|
14253
|
+
let options;
|
|
14254
|
+
switch (format) {
|
|
14255
|
+
case "date":
|
|
14256
|
+
options = {
|
|
14257
|
+
year: "2-digit",
|
|
14258
|
+
month: "2-digit",
|
|
14259
|
+
day: "2-digit"
|
|
14260
|
+
};
|
|
14261
|
+
break;
|
|
14262
|
+
case "time":
|
|
14263
|
+
options = {
|
|
14264
|
+
hour: "2-digit",
|
|
14265
|
+
minute: "2-digit"
|
|
14596
14266
|
};
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14267
|
+
break;
|
|
14268
|
+
case "dateTime":
|
|
14269
|
+
options = {
|
|
14270
|
+
year: "numeric",
|
|
14271
|
+
month: "2-digit",
|
|
14272
|
+
day: "2-digit",
|
|
14273
|
+
hour: "2-digit",
|
|
14274
|
+
minute: "2-digit"
|
|
14605
14275
|
};
|
|
14606
|
-
|
|
14607
|
-
return { icon: /* @__PURE__ */ jsx57(CheckCircle2, { className: "w-4 h-4" }), translationKey: "isTrue", replacementTranslationKey: "isTrue" };
|
|
14608
|
-
case "isFalse":
|
|
14609
|
-
return { icon: /* @__PURE__ */ jsx57(XCircle, { className: "w-4 h-4" }), translationKey: "isFalse", replacementTranslationKey: "isFalse" };
|
|
14610
|
-
case "isUndefined":
|
|
14611
|
-
return { icon: /* @__PURE__ */ jsx57(CircleDashed, { className: "w-4 h-4" }), translationKey: "isUndefined", replacementTranslationKey: "isUndefined" };
|
|
14612
|
-
case "isNotUndefined":
|
|
14613
|
-
return { icon: /* @__PURE__ */ jsx57(CircleDot, { className: "w-4 h-4" }), translationKey: "isNotUndefined", replacementTranslationKey: "isNotUndefined" };
|
|
14614
|
-
default:
|
|
14615
|
-
return { icon: null, translationKey: "unknown translation key", replacementTranslationKey: "unknown" };
|
|
14276
|
+
break;
|
|
14616
14277
|
}
|
|
14278
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14617
14279
|
};
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14280
|
+
var formatRelative = (date, locale) => {
|
|
14281
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14282
|
+
const now = /* @__PURE__ */ new Date();
|
|
14283
|
+
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14284
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14285
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
14286
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
14287
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
14288
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
14289
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
14290
|
+
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
14291
|
+
};
|
|
14292
|
+
var toInputString = (date, format, precision = "minute", isLocalTime = true) => {
|
|
14293
|
+
const pad = (n, l = 2) => String(n).padStart(l, "0");
|
|
14294
|
+
const parts = isLocalTime ? {
|
|
14295
|
+
y: date.getFullYear(),
|
|
14296
|
+
m: date.getMonth() + 1,
|
|
14297
|
+
d: date.getDate(),
|
|
14298
|
+
h: date.getHours(),
|
|
14299
|
+
min: date.getMinutes(),
|
|
14300
|
+
s: date.getSeconds(),
|
|
14301
|
+
ms: date.getMilliseconds()
|
|
14302
|
+
} : {
|
|
14303
|
+
y: date.getUTCFullYear(),
|
|
14304
|
+
m: date.getUTCMonth() + 1,
|
|
14305
|
+
d: date.getUTCDate(),
|
|
14306
|
+
h: date.getUTCHours(),
|
|
14307
|
+
min: date.getUTCMinutes(),
|
|
14308
|
+
s: date.getUTCSeconds(),
|
|
14309
|
+
ms: date.getUTCMilliseconds()
|
|
14310
|
+
};
|
|
14311
|
+
const dateStr = `${pad(parts.y, 4)}-${pad(parts.m)}-${pad(parts.d)}`;
|
|
14312
|
+
let timeStr = `${pad(parts.h)}:${pad(parts.min)}`;
|
|
14313
|
+
if (precision === "second" || precision === "millisecond") {
|
|
14314
|
+
timeStr += `:${pad(parts.s)}`;
|
|
14315
|
+
}
|
|
14316
|
+
if (precision === "millisecond") {
|
|
14317
|
+
timeStr += `.${pad(parts.ms, 3)}`;
|
|
14318
|
+
}
|
|
14319
|
+
switch (format) {
|
|
14624
14320
|
case "date":
|
|
14625
|
-
return
|
|
14321
|
+
return dateStr;
|
|
14322
|
+
case "time":
|
|
14323
|
+
return timeStr;
|
|
14626
14324
|
case "dateTime":
|
|
14627
|
-
return
|
|
14628
|
-
case "boolean":
|
|
14629
|
-
return "isTrue";
|
|
14630
|
-
case "multiTags":
|
|
14631
|
-
return "contains";
|
|
14632
|
-
case "singleTag":
|
|
14633
|
-
return "contains";
|
|
14634
|
-
case "unknownType":
|
|
14635
|
-
return "isNotUndefined";
|
|
14325
|
+
return `${dateStr}T${timeStr}`;
|
|
14636
14326
|
}
|
|
14637
|
-
}
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
all: isFilterOperator,
|
|
14645
|
-
text: isFilterOperatorText,
|
|
14646
|
-
number: isFilterOperatorNumber,
|
|
14647
|
-
date: isFilterOperatorDate,
|
|
14648
|
-
datetime: isFilterOperatorDatetime,
|
|
14649
|
-
boolean: isFilterOperatorBoolean,
|
|
14650
|
-
tags: isFilterOperatorTags,
|
|
14651
|
-
tagsSingle: isFilterOperatorTagsSingle,
|
|
14652
|
-
unknownType: isFilterOperatorUnknownType
|
|
14327
|
+
};
|
|
14328
|
+
function tryParseDate(dateValue) {
|
|
14329
|
+
if (!dateValue) return null;
|
|
14330
|
+
if (dateValue instanceof Date) return dateValue;
|
|
14331
|
+
if (typeof dateValue === "string" || typeof dateValue === "number") {
|
|
14332
|
+
const parsed = new Date(dateValue);
|
|
14333
|
+
return isNaN(parsed.getTime()) ? null : parsed;
|
|
14653
14334
|
}
|
|
14335
|
+
return null;
|
|
14336
|
+
}
|
|
14337
|
+
function normalizeToDateOnly(date) {
|
|
14338
|
+
const normalized = new Date(date);
|
|
14339
|
+
normalized.setHours(0, 0, 0, 0);
|
|
14340
|
+
return normalized;
|
|
14341
|
+
}
|
|
14342
|
+
function normalizeDatetime(dateTime) {
|
|
14343
|
+
const normalized = new Date(dateTime);
|
|
14344
|
+
normalized.setSeconds(0, 0);
|
|
14345
|
+
return normalized;
|
|
14346
|
+
}
|
|
14347
|
+
var DateUtils = {
|
|
14348
|
+
monthsList,
|
|
14349
|
+
weekDayList,
|
|
14350
|
+
equalDate,
|
|
14351
|
+
isLastMillisecondOfDay,
|
|
14352
|
+
sameTime,
|
|
14353
|
+
withTime,
|
|
14354
|
+
formatAbsolute,
|
|
14355
|
+
formatRelative,
|
|
14356
|
+
addDuration,
|
|
14357
|
+
subtractDuration,
|
|
14358
|
+
between,
|
|
14359
|
+
weeksForCalenderMonth,
|
|
14360
|
+
timesInSeconds,
|
|
14361
|
+
toInputString,
|
|
14362
|
+
tryParseDate,
|
|
14363
|
+
toOnlyDate: normalizeToDateOnly,
|
|
14364
|
+
/**
|
|
14365
|
+
* Normalizes a datetime by removing seconds and milliseconds.
|
|
14366
|
+
*/
|
|
14367
|
+
toDateTimeOnly: normalizeDatetime
|
|
14654
14368
|
};
|
|
14655
14369
|
|
|
14656
14370
|
// src/components/user-interaction/data/filter-function.ts
|
|
14657
|
-
import { useCallback as useCallback27 } from "react";
|
|
14658
14371
|
var allowedOperatorsByDataType = {
|
|
14659
14372
|
text: ["equals", "notEquals", "contains", "notContains", "startsWith", "endsWith", "isUndefined", "isNotUndefined"],
|
|
14660
14373
|
number: ["equals", "notEquals", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "between", "notBetween", "isUndefined", "isNotUndefined"],
|
|
@@ -15007,7 +14720,7 @@ function tagToLabel(tags, value) {
|
|
|
15007
14720
|
function useFilterValueTranslation() {
|
|
15008
14721
|
const translation = useHightideTranslation();
|
|
15009
14722
|
const { locale } = useLocale();
|
|
15010
|
-
return
|
|
14723
|
+
return useCallback26((value, options) => {
|
|
15011
14724
|
const p = value.parameter;
|
|
15012
14725
|
const tags = options?.tags;
|
|
15013
14726
|
const dateFormat = value.dataType === "dateTime" ? "dateTime" : "date";
|
|
@@ -15209,9 +14922,9 @@ var TableProvider = ({
|
|
|
15209
14922
|
}) => {
|
|
15210
14923
|
const onRowClickStable = useEventCallbackStabilizer(onRowClick);
|
|
15211
14924
|
const onFillerRowClickStable = useEventCallbackStabilizer(onFillerRowClick);
|
|
15212
|
-
const [registeredColumns, setRegisteredColumns] =
|
|
15213
|
-
const containerRef =
|
|
15214
|
-
const [, setTableState] =
|
|
14925
|
+
const [registeredColumns, setRegisteredColumns] = useState25([]);
|
|
14926
|
+
const containerRef = useRef26(null);
|
|
14927
|
+
const [, setTableState] = useState25({
|
|
15215
14928
|
columnSizing: {},
|
|
15216
14929
|
columnOrder: [],
|
|
15217
14930
|
columnFilters: [],
|
|
@@ -15236,16 +14949,16 @@ var TableProvider = ({
|
|
|
15236
14949
|
pageSize: 10
|
|
15237
14950
|
}
|
|
15238
14951
|
});
|
|
15239
|
-
const [targetWidth, setTargetWidth] =
|
|
15240
|
-
|
|
14952
|
+
const [targetWidth, setTargetWidth] = useState25(void 0);
|
|
14953
|
+
useLayoutEffect6(() => {
|
|
15241
14954
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
15242
14955
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
15243
14956
|
}, [containerRef]);
|
|
15244
|
-
useWindowResizeObserver(
|
|
14957
|
+
useWindowResizeObserver(useCallback27(() => {
|
|
15245
14958
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
15246
14959
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
15247
14960
|
}, [containerRef]));
|
|
15248
|
-
const registerColumn =
|
|
14961
|
+
const registerColumn = useCallback27((column) => {
|
|
15249
14962
|
setRegisteredColumns((prev) => {
|
|
15250
14963
|
return [...prev, column];
|
|
15251
14964
|
});
|
|
@@ -15255,7 +14968,7 @@ var TableProvider = ({
|
|
|
15255
14968
|
});
|
|
15256
14969
|
};
|
|
15257
14970
|
}, []);
|
|
15258
|
-
const columns =
|
|
14971
|
+
const columns = useMemo25(() => {
|
|
15259
14972
|
const contextColumns = Array.from(registeredColumns.values());
|
|
15260
14973
|
if (columnsProp) {
|
|
15261
14974
|
return [...contextColumns, ...columnsProp];
|
|
@@ -15272,7 +14985,7 @@ var TableProvider = ({
|
|
|
15272
14985
|
defaultColumn: {
|
|
15273
14986
|
minSize: 60,
|
|
15274
14987
|
maxSize: 800,
|
|
15275
|
-
cell:
|
|
14988
|
+
cell: useCallback27(({ cell }) => {
|
|
15276
14989
|
return /* @__PURE__ */ jsx59(TableCell, { children: String(cell.getValue()) });
|
|
15277
14990
|
}, []),
|
|
15278
14991
|
enableResizing: true,
|
|
@@ -15313,7 +15026,7 @@ var TableProvider = ({
|
|
|
15313
15026
|
});
|
|
15314
15027
|
const pagination = table.getState().pagination;
|
|
15315
15028
|
const pageCount = table.getPageCount();
|
|
15316
|
-
|
|
15029
|
+
useEffect30(() => {
|
|
15317
15030
|
if (pageCount === -1) {
|
|
15318
15031
|
return;
|
|
15319
15032
|
}
|
|
@@ -15321,20 +15034,20 @@ var TableProvider = ({
|
|
|
15321
15034
|
table.setPageIndex(pageCount - 1);
|
|
15322
15035
|
}
|
|
15323
15036
|
}, [table, pagination.pageIndex, pageCount]);
|
|
15324
|
-
|
|
15037
|
+
useEffect30(() => {
|
|
15325
15038
|
table.setColumnOrder((prev) => [...prev]);
|
|
15326
15039
|
}, [table, columns]);
|
|
15327
15040
|
const columnVisibility = table.getState().columnVisibility;
|
|
15328
15041
|
const columnOrder = table.getState().columnOrder;
|
|
15329
15042
|
const columnPinning = table.getState().columnPinning;
|
|
15330
|
-
|
|
15043
|
+
useEffect30(() => {
|
|
15331
15044
|
table.setColumnSizing((prev) => ({ ...prev }));
|
|
15332
15045
|
}, [table, targetWidth, columnVisibility, columnOrder, columnPinning]);
|
|
15333
|
-
const tableColumnDefinitionContextValue =
|
|
15046
|
+
const tableColumnDefinitionContextValue = useMemo25(() => ({
|
|
15334
15047
|
table,
|
|
15335
15048
|
registerColumn
|
|
15336
15049
|
}), [table, registerColumn]);
|
|
15337
|
-
const tableContainerContextValue =
|
|
15050
|
+
const tableContainerContextValue = useMemo25(() => ({
|
|
15338
15051
|
table,
|
|
15339
15052
|
containerRef
|
|
15340
15053
|
}), [table, containerRef]);
|
|
@@ -15343,7 +15056,7 @@ var TableProvider = ({
|
|
|
15343
15056
|
return rest;
|
|
15344
15057
|
})();
|
|
15345
15058
|
const rowModel = table.getRowModel();
|
|
15346
|
-
const tableStateWithoutSizingContextValue =
|
|
15059
|
+
const tableStateWithoutSizingContextValue = useMemo25(() => ({
|
|
15347
15060
|
table,
|
|
15348
15061
|
isUsingFillerRows,
|
|
15349
15062
|
fillerRowCell,
|
|
@@ -15386,7 +15099,7 @@ var TableProvider = ({
|
|
|
15386
15099
|
]);
|
|
15387
15100
|
const columnSizing = table.getState().columnSizing;
|
|
15388
15101
|
const columnSizingInfo = table.getState().columnSizingInfo;
|
|
15389
|
-
const tableStateContextValue =
|
|
15102
|
+
const tableStateContextValue = useMemo25(() => ({
|
|
15390
15103
|
...tableStateWithoutSizingContextValue,
|
|
15391
15104
|
sizeVars: ColumnSizeUtil.toSizeVars(columnSizing),
|
|
15392
15105
|
columnSizingInfo,
|
|
@@ -15397,10 +15110,10 @@ var TableProvider = ({
|
|
|
15397
15110
|
|
|
15398
15111
|
// src/components/layout/table/TableBody.tsx
|
|
15399
15112
|
import { flexRender } from "@tanstack/react-table";
|
|
15400
|
-
import
|
|
15113
|
+
import React4 from "react";
|
|
15401
15114
|
import clsx20 from "clsx";
|
|
15402
15115
|
import { jsx as jsx60, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
15403
|
-
var TableBody =
|
|
15116
|
+
var TableBody = React4.memo(function TableBodyVisual() {
|
|
15404
15117
|
const { table, isUsingFillerRows, fillerRowCell, onRowClick, onFillerRowClick } = useTableStateWithoutSizingContext();
|
|
15405
15118
|
const rows = table.getRowModel().rows;
|
|
15406
15119
|
const columnOrder = table.getState().columnOrder;
|
|
@@ -15498,16 +15211,16 @@ var TableSortButton = ({
|
|
|
15498
15211
|
|
|
15499
15212
|
// src/components/layout/table/TableFilterButton.tsx
|
|
15500
15213
|
import { FilterIcon } from "lucide-react";
|
|
15501
|
-
import { useEffect as
|
|
15214
|
+
import { useEffect as useEffect41, useId as useId18, useMemo as useMemo34, useRef as useRef34, useState as useState33 } from "react";
|
|
15502
15215
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
15503
15216
|
|
|
15504
15217
|
// src/components/user-interaction/data/FilterPopUp.tsx
|
|
15505
15218
|
import { TrashIcon, XIcon as XIcon2 } from "lucide-react";
|
|
15506
|
-
import { forwardRef as forwardRef23, useId as useId17, useMemo as
|
|
15219
|
+
import { forwardRef as forwardRef23, useId as useId17, useMemo as useMemo33, useState as useState32 } from "react";
|
|
15507
15220
|
|
|
15508
15221
|
// src/components/user-interaction/Checkbox.tsx
|
|
15509
15222
|
import { Check as Check2, Minus as Minus2 } from "lucide-react";
|
|
15510
|
-
import { useCallback as
|
|
15223
|
+
import { useCallback as useCallback28 } from "react";
|
|
15511
15224
|
import { jsx as jsx62, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
15512
15225
|
var Checkbox = ({
|
|
15513
15226
|
value: controlledValue,
|
|
@@ -15525,7 +15238,7 @@ var Checkbox = ({
|
|
|
15525
15238
|
}) => {
|
|
15526
15239
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15527
15240
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
15528
|
-
const onChangeWrapper =
|
|
15241
|
+
const onChangeWrapper = useCallback28((value2) => {
|
|
15529
15242
|
onValueChangeStable(value2);
|
|
15530
15243
|
onEditCompleteStable(value2);
|
|
15531
15244
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -15569,12 +15282,12 @@ var Checkbox = ({
|
|
|
15569
15282
|
};
|
|
15570
15283
|
|
|
15571
15284
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
15572
|
-
import { forwardRef as forwardRef18, useCallback as
|
|
15285
|
+
import { forwardRef as forwardRef18, useCallback as useCallback31, useEffect as useEffect35, useId as useId14, useImperativeHandle as useImperativeHandle12, useMemo as useMemo29, useRef as useRef30, useState as useState29 } from "react";
|
|
15573
15286
|
import { CalendarIcon } from "lucide-react";
|
|
15574
15287
|
import clsx24 from "clsx";
|
|
15575
15288
|
|
|
15576
15289
|
// src/components/user-interaction/date/TimePicker.tsx
|
|
15577
|
-
import { useEffect as
|
|
15290
|
+
import { useEffect as useEffect31, useMemo as useMemo26, useRef as useRef27 } from "react";
|
|
15578
15291
|
import { jsx as jsx63, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
15579
15292
|
var TimePicker = ({
|
|
15580
15293
|
value: controlledValue,
|
|
@@ -15593,11 +15306,11 @@ var TimePicker = ({
|
|
|
15593
15306
|
onValueChange,
|
|
15594
15307
|
defaultValue: initialValue
|
|
15595
15308
|
});
|
|
15596
|
-
const minuteRef =
|
|
15597
|
-
const hourRef =
|
|
15309
|
+
const minuteRef = useRef27(null);
|
|
15310
|
+
const hourRef = useRef27(null);
|
|
15598
15311
|
const isPM = value.getHours() > 11;
|
|
15599
15312
|
const hours = is24HourFormat ? range(24) : range(12);
|
|
15600
|
-
const minutes =
|
|
15313
|
+
const minutes = useMemo26(() => {
|
|
15601
15314
|
const full = range(60);
|
|
15602
15315
|
switch (minuteIncrement) {
|
|
15603
15316
|
case "5min":
|
|
@@ -15610,7 +15323,7 @@ var TimePicker = ({
|
|
|
15610
15323
|
return full.filter((value2) => value2 % 30 === 0);
|
|
15611
15324
|
}
|
|
15612
15325
|
}, [minuteIncrement]);
|
|
15613
|
-
const seconds =
|
|
15326
|
+
const seconds = useMemo26(() => {
|
|
15614
15327
|
const full = range(60);
|
|
15615
15328
|
switch (secondIncrement) {
|
|
15616
15329
|
case "1s":
|
|
@@ -15625,7 +15338,7 @@ var TimePicker = ({
|
|
|
15625
15338
|
return full.filter((value2) => value2 % 30 === 0);
|
|
15626
15339
|
}
|
|
15627
15340
|
}, [secondIncrement]);
|
|
15628
|
-
const milliseconds =
|
|
15341
|
+
const milliseconds = useMemo26(() => {
|
|
15629
15342
|
const full = range(1e3);
|
|
15630
15343
|
switch (millisecondIncrement) {
|
|
15631
15344
|
case "1ms":
|
|
@@ -15646,17 +15359,17 @@ var TimePicker = ({
|
|
|
15646
15359
|
return full.filter((value2) => value2 % 500 === 0);
|
|
15647
15360
|
}
|
|
15648
15361
|
}, [millisecondIncrement]);
|
|
15649
|
-
const closestMinute =
|
|
15650
|
-
const closestSecond =
|
|
15651
|
-
const closestMillisecond =
|
|
15362
|
+
const closestMinute = useMemo26(() => closestMatch(minutes, (item1, item2) => Math.abs(item1 - value.getMinutes()) < Math.abs(item2 - value.getMinutes())), [minutes, value]);
|
|
15363
|
+
const closestSecond = useMemo26(() => closestMatch(seconds, (item1, item2) => Math.abs(item1 - value.getSeconds()) < Math.abs(item2 - value.getSeconds())), [seconds, value]);
|
|
15364
|
+
const closestMillisecond = useMemo26(() => closestMatch(milliseconds, (item1, item2) => Math.abs(item1 - value.getMilliseconds()) < Math.abs(item2 - value.getMilliseconds())), [milliseconds, value]);
|
|
15652
15365
|
const hour = value.getHours();
|
|
15653
|
-
|
|
15366
|
+
useEffect31(() => {
|
|
15654
15367
|
minuteRef.current?.scrollIntoView({
|
|
15655
15368
|
behavior: "smooth",
|
|
15656
15369
|
block: "nearest"
|
|
15657
15370
|
});
|
|
15658
15371
|
}, [closestMinute]);
|
|
15659
|
-
|
|
15372
|
+
useEffect31(() => {
|
|
15660
15373
|
hourRef.current?.scrollIntoView({
|
|
15661
15374
|
behavior: "smooth",
|
|
15662
15375
|
block: "nearest"
|
|
@@ -15755,12 +15468,12 @@ var TimePicker = ({
|
|
|
15755
15468
|
};
|
|
15756
15469
|
|
|
15757
15470
|
// src/components/user-interaction/date/DatePicker.tsx
|
|
15758
|
-
import { useState as
|
|
15471
|
+
import { useState as useState27 } from "react";
|
|
15759
15472
|
import { ArrowDown, ArrowUp, Calendar, ChevronDown as ChevronDown4 } from "lucide-react";
|
|
15760
15473
|
import clsx23 from "clsx";
|
|
15761
15474
|
|
|
15762
15475
|
// src/components/user-interaction/date/DayPicker.tsx
|
|
15763
|
-
import { useCallback as
|
|
15476
|
+
import { useCallback as useCallback29, useEffect as useEffect32, useMemo as useMemo27, useRef as useRef28 } from "react";
|
|
15764
15477
|
import { jsx as jsx64, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
15765
15478
|
var DayPicker = ({
|
|
15766
15479
|
displayedMonth: controlledDisplayedMonth,
|
|
@@ -15789,33 +15502,33 @@ var DayPicker = ({
|
|
|
15789
15502
|
});
|
|
15790
15503
|
const month = displayedMonth.getMonth();
|
|
15791
15504
|
const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
|
|
15792
|
-
const selectedButtonRef =
|
|
15793
|
-
const isValueInDisplayedWeeks =
|
|
15505
|
+
const selectedButtonRef = useRef28(null);
|
|
15506
|
+
const isValueInDisplayedWeeks = useMemo27(
|
|
15794
15507
|
() => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
|
|
15795
15508
|
[value, weeks]
|
|
15796
15509
|
);
|
|
15797
|
-
const firstDayOfMonth =
|
|
15510
|
+
const firstDayOfMonth = useCallback29(
|
|
15798
15511
|
(date) => new Date(date.getFullYear(), date.getMonth(), 1),
|
|
15799
15512
|
[]
|
|
15800
15513
|
);
|
|
15801
15514
|
const focusTargetDate = value && isValueInDisplayedWeeks ? value : firstDayOfMonth(displayedMonth);
|
|
15802
|
-
|
|
15515
|
+
useEffect32(() => {
|
|
15803
15516
|
selectedButtonRef.current?.focus();
|
|
15804
15517
|
}, [focusTargetDate]);
|
|
15805
|
-
const end =
|
|
15518
|
+
const end = useMemo27(() => {
|
|
15806
15519
|
if (!providedEnd) return;
|
|
15807
15520
|
return new Date(providedEnd.getFullYear(), providedEnd.getMonth(), providedEnd.getDate());
|
|
15808
15521
|
}, [providedEnd]);
|
|
15809
|
-
const start =
|
|
15522
|
+
const start = useMemo27(() => {
|
|
15810
15523
|
if (!providedStart) return;
|
|
15811
15524
|
return new Date(providedStart.getFullYear(), providedStart.getMonth(), providedStart.getDate());
|
|
15812
15525
|
}, [providedStart]);
|
|
15813
|
-
const clampToRange =
|
|
15526
|
+
const clampToRange = useCallback29((date) => {
|
|
15814
15527
|
if (start && date < start) return start;
|
|
15815
15528
|
if (end && date > end) return end;
|
|
15816
15529
|
return date;
|
|
15817
15530
|
}, [start, end]);
|
|
15818
|
-
const navigateTo =
|
|
15531
|
+
const navigateTo = useCallback29((candidate) => {
|
|
15819
15532
|
const clamped = clampToRange(candidate);
|
|
15820
15533
|
if (!DateUtils.between(clamped, start, end)) return;
|
|
15821
15534
|
setValue(clamped);
|
|
@@ -15824,7 +15537,7 @@ var DayPicker = ({
|
|
|
15824
15537
|
setDisplayedMonth(firstDayOfMonth(clamped));
|
|
15825
15538
|
}
|
|
15826
15539
|
}, [clampToRange, start, end, setValue, onEditComplete, displayedMonth, setDisplayedMonth, firstDayOfMonth]);
|
|
15827
|
-
const onKeyDown =
|
|
15540
|
+
const onKeyDown = useCallback29(
|
|
15828
15541
|
(event) => {
|
|
15829
15542
|
PropsUtil.aria.navigate({
|
|
15830
15543
|
left: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 1 })),
|
|
@@ -15881,7 +15594,7 @@ var DayPicker = ({
|
|
|
15881
15594
|
};
|
|
15882
15595
|
|
|
15883
15596
|
// src/components/user-interaction/date/YearMonthPicker.tsx
|
|
15884
|
-
import { memo, useCallback as
|
|
15597
|
+
import { memo, useCallback as useCallback30, useEffect as useEffect33, useMemo as useMemo28, useRef as useRef29, useState as useState26 } from "react";
|
|
15885
15598
|
import clsx22 from "clsx";
|
|
15886
15599
|
import { jsx as jsx65, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
15887
15600
|
var YearRow = memo(function YearRow2({
|
|
@@ -15892,15 +15605,15 @@ var YearRow = memo(function YearRow2({
|
|
|
15892
15605
|
monthNames,
|
|
15893
15606
|
onSelect
|
|
15894
15607
|
}) {
|
|
15895
|
-
const ref =
|
|
15608
|
+
const ref = useRef29(null);
|
|
15896
15609
|
const isSelectedYear = selectedMonthIndex !== void 0;
|
|
15897
|
-
const [isExpanded, setIsExpanded] =
|
|
15898
|
-
|
|
15610
|
+
const [isExpanded, setIsExpanded] = useState26(false);
|
|
15611
|
+
useEffect33(() => {
|
|
15899
15612
|
if (isSelectedYear) {
|
|
15900
15613
|
ref.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
15901
15614
|
}
|
|
15902
15615
|
}, [isSelectedYear]);
|
|
15903
|
-
const monthGrid =
|
|
15616
|
+
const monthGrid = useMemo28(() => equalSizeGroups([...DateUtils.monthsList], 3), []);
|
|
15904
15617
|
return /* @__PURE__ */ jsxs36(
|
|
15905
15618
|
ExpandableRoot,
|
|
15906
15619
|
{
|
|
@@ -15955,23 +15668,23 @@ var YearMonthPicker = ({
|
|
|
15955
15668
|
defaultValue: initialValue
|
|
15956
15669
|
});
|
|
15957
15670
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15958
|
-
const monthNames =
|
|
15671
|
+
const monthNames = useMemo28(() => {
|
|
15959
15672
|
const formatter = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
15960
15673
|
return Array.from({ length: 12 }, (_, i) => formatter.format(new Date(2e3, i, 1)));
|
|
15961
15674
|
}, [locale]);
|
|
15962
|
-
const years =
|
|
15675
|
+
const years = useMemo28(
|
|
15963
15676
|
() => range([start.getFullYear(), end.getFullYear()], { exclusiveEnd: false }),
|
|
15964
15677
|
[start, end]
|
|
15965
15678
|
);
|
|
15966
|
-
const minTimestamp =
|
|
15679
|
+
const minTimestamp = useMemo28(() => {
|
|
15967
15680
|
if (!start) return;
|
|
15968
15681
|
return new Date(start.getFullYear(), start.getMonth(), 1).getTime();
|
|
15969
15682
|
}, [start]);
|
|
15970
|
-
const maxTimestamp =
|
|
15683
|
+
const maxTimestamp = useMemo28(() => {
|
|
15971
15684
|
if (!end) return;
|
|
15972
15685
|
return new Date(end.getFullYear(), end.getMonth() + 1, 0).getTime();
|
|
15973
15686
|
}, [end]);
|
|
15974
|
-
const handleSelect =
|
|
15687
|
+
const handleSelect = useCallback30((newDate) => {
|
|
15975
15688
|
setValue(newDate);
|
|
15976
15689
|
onEditCompleteStable(newDate);
|
|
15977
15690
|
}, [onEditCompleteStable, setValue]);
|
|
@@ -16024,8 +15737,8 @@ var DatePicker = ({
|
|
|
16024
15737
|
onValueChange,
|
|
16025
15738
|
defaultValue: initialValue
|
|
16026
15739
|
});
|
|
16027
|
-
const [displayedMonth, setDisplayedMonth] =
|
|
16028
|
-
const [displayMode, setDisplayMode] =
|
|
15740
|
+
const [displayedMonth, setDisplayedMonth] = useState27(new Date(value.getFullYear(), value.getMonth(), 1));
|
|
15741
|
+
const [displayMode, setDisplayMode] = useState27(initialDisplay);
|
|
16029
15742
|
return /* @__PURE__ */ jsxs37("div", { className: clsx23("flex-col-3", className), children: [
|
|
16030
15743
|
/* @__PURE__ */ jsxs37("div", { className: "flex-row-2 items-center justify-between", children: [
|
|
16031
15744
|
/* @__PURE__ */ jsxs37(
|
|
@@ -16187,7 +15900,7 @@ var DateTimePicker = ({
|
|
|
16187
15900
|
};
|
|
16188
15901
|
|
|
16189
15902
|
// src/components/user-interaction/date/DateTimePickerDialog.tsx
|
|
16190
|
-
import { useEffect as
|
|
15903
|
+
import { useEffect as useEffect34, useState as useState28 } from "react";
|
|
16191
15904
|
import { Fragment as Fragment6, jsx as jsx68, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
16192
15905
|
var DateTimePickerDialog = ({
|
|
16193
15906
|
initialValue = null,
|
|
@@ -16215,8 +15928,8 @@ var DateTimePickerDialog = ({
|
|
|
16215
15928
|
onValueChange,
|
|
16216
15929
|
defaultValue: initialValue
|
|
16217
15930
|
});
|
|
16218
|
-
const [pickerState, setPickerState] =
|
|
16219
|
-
|
|
15931
|
+
const [pickerState, setPickerState] = useState28(state ?? /* @__PURE__ */ new Date());
|
|
15932
|
+
useEffect34(() => {
|
|
16220
15933
|
setPickerState(state ?? /* @__PURE__ */ new Date());
|
|
16221
15934
|
}, [state]);
|
|
16222
15935
|
return /* @__PURE__ */ jsxs39(Fragment6, { children: [
|
|
@@ -16316,40 +16029,41 @@ var DateTimeInput = forwardRef18(function DateTimeInput2({
|
|
|
16316
16029
|
readOnly = false,
|
|
16317
16030
|
invalid = false,
|
|
16318
16031
|
required = false,
|
|
16032
|
+
actions = [],
|
|
16319
16033
|
...props
|
|
16320
16034
|
}, forwardedRef) {
|
|
16321
16035
|
const translation = useHightideTranslation();
|
|
16322
|
-
const [isOpen, setIsOpen] =
|
|
16036
|
+
const [isOpen, setIsOpen] = useState29(false);
|
|
16323
16037
|
const [state, setState] = useControlledState({
|
|
16324
16038
|
value,
|
|
16325
16039
|
onValueChange,
|
|
16326
16040
|
defaultValue: initialValue
|
|
16327
16041
|
});
|
|
16328
|
-
const [dialogValue, setDialogValue] =
|
|
16329
|
-
const [stringInputState, setStringInputState] =
|
|
16042
|
+
const [dialogValue, setDialogValue] = useState29(state);
|
|
16043
|
+
const [stringInputState, setStringInputState] = useState29({
|
|
16330
16044
|
state: state ? DateUtils.toInputString(state, mode, precision) : "",
|
|
16331
16045
|
date: void 0
|
|
16332
16046
|
});
|
|
16333
|
-
|
|
16047
|
+
useEffect35(() => {
|
|
16334
16048
|
setDialogValue(state);
|
|
16335
16049
|
setStringInputState({
|
|
16336
16050
|
state: state ? DateUtils.toInputString(state, mode) : "",
|
|
16337
16051
|
date: void 0
|
|
16338
16052
|
});
|
|
16339
16053
|
}, [mode, state]);
|
|
16340
|
-
const changeOpenWrapper =
|
|
16054
|
+
const changeOpenWrapper = useCallback31((isOpen2) => {
|
|
16341
16055
|
onDialogOpeningChange?.(isOpen2);
|
|
16342
16056
|
setIsOpen(isOpen2);
|
|
16343
16057
|
}, [onDialogOpeningChange]);
|
|
16344
16058
|
const generatedId = useId14();
|
|
16345
|
-
const ids =
|
|
16059
|
+
const ids = useMemo29(() => ({
|
|
16346
16060
|
input: inputId ?? `date-time-input-${generatedId}`,
|
|
16347
16061
|
popup: `date-time-input-popup-${generatedId}`,
|
|
16348
16062
|
label: `date-time-input-label-${generatedId}`
|
|
16349
16063
|
}), [generatedId, inputId]);
|
|
16350
|
-
const innerRef =
|
|
16064
|
+
const innerRef = useRef30(null);
|
|
16351
16065
|
useImperativeHandle12(forwardedRef, () => innerRef.current);
|
|
16352
|
-
|
|
16066
|
+
useEffect35(() => {
|
|
16353
16067
|
if (readOnly || disabled) {
|
|
16354
16068
|
changeOpenWrapper(false);
|
|
16355
16069
|
}
|
|
@@ -16367,6 +16081,12 @@ var DateTimeInput = forwardRef18(function DateTimeInput2({
|
|
|
16367
16081
|
ref: innerRef,
|
|
16368
16082
|
id: ids.input,
|
|
16369
16083
|
value: stringInputState.state,
|
|
16084
|
+
onClick: (event) => {
|
|
16085
|
+
event.preventDefault();
|
|
16086
|
+
},
|
|
16087
|
+
onFocus: (event) => {
|
|
16088
|
+
event.preventDefault();
|
|
16089
|
+
},
|
|
16370
16090
|
onChange: (event) => {
|
|
16371
16091
|
const date = new Date(event.target.value ?? "");
|
|
16372
16092
|
const isValid = !isNaN(date.getTime());
|
|
@@ -16407,24 +16127,26 @@ var DateTimeInput = forwardRef18(function DateTimeInput2({
|
|
|
16407
16127
|
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props)
|
|
16408
16128
|
}
|
|
16409
16129
|
),
|
|
16410
|
-
/* @__PURE__ */
|
|
16411
|
-
|
|
16412
|
-
{
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16130
|
+
/* @__PURE__ */ jsxs40("div", { className: "absolute right-1 top-1/2 -translate-y-1/2 flex-row-0", children: [
|
|
16131
|
+
actions,
|
|
16132
|
+
/* @__PURE__ */ jsx69(Visibility, { isVisible: !readOnly, children: /* @__PURE__ */ jsx69(
|
|
16133
|
+
IconButton,
|
|
16134
|
+
{
|
|
16135
|
+
tooltip: translation("sDateTimeSelect", { datetimeMode: mode }),
|
|
16136
|
+
coloringStyle: "text",
|
|
16137
|
+
color: "neutral",
|
|
16138
|
+
size: "sm",
|
|
16139
|
+
disabled,
|
|
16140
|
+
onClick: () => {
|
|
16141
|
+
changeOpenWrapper(true);
|
|
16142
|
+
},
|
|
16143
|
+
"aria-haspopup": "dialog",
|
|
16144
|
+
"aria-expanded": isOpen,
|
|
16145
|
+
"aria-controls": isOpen ? ids.popup : void 0,
|
|
16146
|
+
children: /* @__PURE__ */ jsx69(CalendarIcon, { className: "size-5" })
|
|
16147
|
+
}
|
|
16148
|
+
) })
|
|
16149
|
+
] })
|
|
16428
16150
|
] }),
|
|
16429
16151
|
/* @__PURE__ */ jsx69(
|
|
16430
16152
|
PopUp,
|
|
@@ -16478,7 +16200,7 @@ var DateTimeInput = forwardRef18(function DateTimeInput2({
|
|
|
16478
16200
|
import { forwardRef as forwardRef22 } from "react";
|
|
16479
16201
|
|
|
16480
16202
|
// src/components/user-interaction/MultiSelect/MultiSelectRoot.tsx
|
|
16481
|
-
import { useCallback as useCallback34, useEffect as
|
|
16203
|
+
import { useCallback as useCallback34, useEffect as useEffect37, useId as useId15, useMemo as useMemo32, useState as useState31 } from "react";
|
|
16482
16204
|
|
|
16483
16205
|
// src/components/user-interaction/MultiSelect/MultiSelectContext.tsx
|
|
16484
16206
|
import { createContext as createContext15, useContext as useContext17 } from "react";
|
|
@@ -16492,10 +16214,51 @@ function useMultiSelectContext() {
|
|
|
16492
16214
|
// src/components/user-interaction/MultiSelect/useMultiSelect.ts
|
|
16493
16215
|
import {
|
|
16494
16216
|
useCallback as useCallback33,
|
|
16495
|
-
useEffect as
|
|
16496
|
-
useMemo as
|
|
16497
|
-
useState as
|
|
16217
|
+
useEffect as useEffect36,
|
|
16218
|
+
useMemo as useMemo31,
|
|
16219
|
+
useState as useState30
|
|
16498
16220
|
} from "react";
|
|
16221
|
+
|
|
16222
|
+
// src/hooks/useMultiSelection.ts
|
|
16223
|
+
import { useCallback as useCallback32, useMemo as useMemo30 } from "react";
|
|
16224
|
+
function useMultiSelection({
|
|
16225
|
+
options: optionsList,
|
|
16226
|
+
value,
|
|
16227
|
+
onSelectionChange,
|
|
16228
|
+
initialSelection = [],
|
|
16229
|
+
isControlled
|
|
16230
|
+
}) {
|
|
16231
|
+
const [selection, setSelection] = useControlledState({
|
|
16232
|
+
value,
|
|
16233
|
+
onValueChange: onSelectionChange,
|
|
16234
|
+
defaultValue: [...initialSelection],
|
|
16235
|
+
isControlled
|
|
16236
|
+
});
|
|
16237
|
+
const isSelected = useCallback32((id) => selection.includes(id), [selection]);
|
|
16238
|
+
const toggleSelection = useCallback32(
|
|
16239
|
+
(id) => {
|
|
16240
|
+
const option = optionsList.find((o) => o.id === id);
|
|
16241
|
+
if (!option || option.disabled) return;
|
|
16242
|
+
setSelection((prev) => prev.includes(id) ? prev.filter((s) => s !== id) : [...prev, id]);
|
|
16243
|
+
},
|
|
16244
|
+
[optionsList, setSelection]
|
|
16245
|
+
);
|
|
16246
|
+
const setSelectionValue = useCallback32(
|
|
16247
|
+
(next) => setSelection(Array.from(next)),
|
|
16248
|
+
[setSelection]
|
|
16249
|
+
);
|
|
16250
|
+
return useMemo30(
|
|
16251
|
+
() => ({
|
|
16252
|
+
selection,
|
|
16253
|
+
setSelection: setSelectionValue,
|
|
16254
|
+
toggleSelection,
|
|
16255
|
+
isSelected
|
|
16256
|
+
}),
|
|
16257
|
+
[selection, setSelectionValue, toggleSelection, isSelected]
|
|
16258
|
+
);
|
|
16259
|
+
}
|
|
16260
|
+
|
|
16261
|
+
// src/components/user-interaction/MultiSelect/useMultiSelect.ts
|
|
16499
16262
|
function useMultiSelect({
|
|
16500
16263
|
options,
|
|
16501
16264
|
value: controlledValue,
|
|
@@ -16506,9 +16269,9 @@ function useMultiSelect({
|
|
|
16506
16269
|
initialIsOpen = false,
|
|
16507
16270
|
typeAheadResetMs = 500
|
|
16508
16271
|
}) {
|
|
16509
|
-
const [isOpen, setIsOpen] =
|
|
16510
|
-
const [searchQuery, setSearchQuery] =
|
|
16511
|
-
const selectionOptions =
|
|
16272
|
+
const [isOpen, setIsOpen] = useState30(initialIsOpen);
|
|
16273
|
+
const [searchQuery, setSearchQuery] = useState30("");
|
|
16274
|
+
const selectionOptions = useMemo31(
|
|
16512
16275
|
() => options.map((o) => ({ id: o.id, disabled: o.disabled })),
|
|
16513
16276
|
[options]
|
|
16514
16277
|
);
|
|
@@ -16526,11 +16289,11 @@ function useMultiSelect({
|
|
|
16526
16289
|
searchQuery,
|
|
16527
16290
|
toTags: useCallback33((o) => [o.label ?? ""], [])
|
|
16528
16291
|
});
|
|
16529
|
-
const visibleOptionIds =
|
|
16292
|
+
const visibleOptionIds = useMemo31(
|
|
16530
16293
|
() => visibleOptions.map((o) => o.id),
|
|
16531
16294
|
[visibleOptions]
|
|
16532
16295
|
);
|
|
16533
|
-
const enabledOptions =
|
|
16296
|
+
const enabledOptions = useMemo31(
|
|
16534
16297
|
() => visibleOptions.filter((o) => !o.disabled),
|
|
16535
16298
|
[visibleOptions]
|
|
16536
16299
|
);
|
|
@@ -16551,7 +16314,7 @@ function useMultiSelect({
|
|
|
16551
16314
|
)
|
|
16552
16315
|
});
|
|
16553
16316
|
const { reset: typeAheadReset, addToTypeAhead } = typeAhead;
|
|
16554
|
-
|
|
16317
|
+
useEffect36(() => {
|
|
16555
16318
|
if (!isOpen) typeAheadReset();
|
|
16556
16319
|
}, [isOpen, typeAheadReset]);
|
|
16557
16320
|
const highlightItem = useCallback33((id) => {
|
|
@@ -16604,7 +16367,7 @@ function useMultiSelect({
|
|
|
16604
16367
|
},
|
|
16605
16368
|
[isOpen, setIsOpenWrapper]
|
|
16606
16369
|
);
|
|
16607
|
-
const state =
|
|
16370
|
+
const state = useMemo31(
|
|
16608
16371
|
() => ({
|
|
16609
16372
|
value: [...selection],
|
|
16610
16373
|
highlightedId: listNav.highlightedId,
|
|
@@ -16620,11 +16383,11 @@ function useMultiSelect({
|
|
|
16620
16383
|
options
|
|
16621
16384
|
]
|
|
16622
16385
|
);
|
|
16623
|
-
const computedState =
|
|
16386
|
+
const computedState = useMemo31(
|
|
16624
16387
|
() => ({ visibleOptionIds }),
|
|
16625
16388
|
[visibleOptionIds]
|
|
16626
16389
|
);
|
|
16627
|
-
const actions =
|
|
16390
|
+
const actions = useMemo31(
|
|
16628
16391
|
() => ({
|
|
16629
16392
|
setIsOpen: setIsOpenWrapper,
|
|
16630
16393
|
toggleOpen: toggleOpenWrapper,
|
|
@@ -16653,7 +16416,7 @@ function useMultiSelect({
|
|
|
16653
16416
|
addToTypeAhead
|
|
16654
16417
|
]
|
|
16655
16418
|
);
|
|
16656
|
-
return
|
|
16419
|
+
return useMemo31(
|
|
16657
16420
|
() => ({
|
|
16658
16421
|
...state,
|
|
16659
16422
|
...computedState,
|
|
@@ -16681,10 +16444,10 @@ function MultiSelectRoot({
|
|
|
16681
16444
|
readOnly = false,
|
|
16682
16445
|
required = false
|
|
16683
16446
|
}) {
|
|
16684
|
-
const [triggerRef, setTriggerRef] =
|
|
16685
|
-
const [options, setOptions] =
|
|
16447
|
+
const [triggerRef, setTriggerRef] = useState31(null);
|
|
16448
|
+
const [options, setOptions] = useState31([]);
|
|
16686
16449
|
const generatedId = useId15();
|
|
16687
|
-
const [ids, setIds] =
|
|
16450
|
+
const [ids, setIds] = useState31({
|
|
16688
16451
|
trigger: "multi-select-" + generatedId,
|
|
16689
16452
|
content: "multi-select-content-" + generatedId,
|
|
16690
16453
|
listbox: "multi-select-listbox-" + generatedId,
|
|
@@ -16703,8 +16466,8 @@ function MultiSelectRoot({
|
|
|
16703
16466
|
setTriggerRef(ref);
|
|
16704
16467
|
return () => setTriggerRef(null);
|
|
16705
16468
|
}, []);
|
|
16706
|
-
const compare =
|
|
16707
|
-
const idToOptionMap =
|
|
16469
|
+
const compare = useMemo32(() => compareFunction ?? Object.is, [compareFunction]);
|
|
16470
|
+
const idToOptionMap = useMemo32(
|
|
16708
16471
|
() => options.reduce(
|
|
16709
16472
|
(acc, o) => {
|
|
16710
16473
|
acc[o.id] = o;
|
|
@@ -16714,11 +16477,11 @@ function MultiSelectRoot({
|
|
|
16714
16477
|
),
|
|
16715
16478
|
[options]
|
|
16716
16479
|
);
|
|
16717
|
-
const mappedValueIds =
|
|
16480
|
+
const mappedValueIds = useMemo32(() => {
|
|
16718
16481
|
if (value == null) return void 0;
|
|
16719
16482
|
return value.map((v) => options.find((o) => compare(o.value, v))?.id).filter((id) => id !== void 0);
|
|
16720
16483
|
}, [options, value, compare]);
|
|
16721
|
-
const mappedInitialValueIds =
|
|
16484
|
+
const mappedInitialValueIds = useMemo32(() => {
|
|
16722
16485
|
if (initialValue == null) return [];
|
|
16723
16486
|
return initialValue.map((v) => options.find((o) => compare(o.value, v))?.id).filter((id) => id !== void 0);
|
|
16724
16487
|
}, [options, initialValue, compare]);
|
|
@@ -16746,12 +16509,12 @@ function MultiSelectRoot({
|
|
|
16746
16509
|
onClose
|
|
16747
16510
|
});
|
|
16748
16511
|
const { setSearchQuery } = state;
|
|
16749
|
-
|
|
16512
|
+
useEffect37(() => {
|
|
16750
16513
|
if (showSearch === false) {
|
|
16751
16514
|
setSearchQuery("");
|
|
16752
16515
|
}
|
|
16753
16516
|
}, [showSearch, setSearchQuery]);
|
|
16754
|
-
const contextValue =
|
|
16517
|
+
const contextValue = useMemo32(() => {
|
|
16755
16518
|
const valueT = state.value.map((id) => idToOptionMap[id]?.value).filter((v) => v != null);
|
|
16756
16519
|
return {
|
|
16757
16520
|
invalid,
|
|
@@ -16822,12 +16585,12 @@ function MultiSelectRoot({
|
|
|
16822
16585
|
}
|
|
16823
16586
|
|
|
16824
16587
|
// src/components/user-interaction/MultiSelect/MultiSelectButton.tsx
|
|
16825
|
-
import { forwardRef as forwardRef20, useEffect as
|
|
16588
|
+
import { forwardRef as forwardRef20, useEffect as useEffect39, useImperativeHandle as useImperativeHandle13, useRef as useRef32 } from "react";
|
|
16826
16589
|
|
|
16827
16590
|
// src/components/user-interaction/MultiSelect/MultiSelectOption.tsx
|
|
16828
16591
|
import clsx25 from "clsx";
|
|
16829
16592
|
import { CheckIcon as CheckIcon2 } from "lucide-react";
|
|
16830
|
-
import { createContext as createContext16, forwardRef as forwardRef19, useContext as useContext18, useEffect as
|
|
16593
|
+
import { createContext as createContext16, forwardRef as forwardRef19, useContext as useContext18, useEffect as useEffect38, useId as useId16, useRef as useRef31 } from "react";
|
|
16831
16594
|
import { jsx as jsx71, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
16832
16595
|
var MultiSelectOptionDisplayContext = createContext16(null);
|
|
16833
16596
|
function useMultiSelectOptionDisplayLocation() {
|
|
@@ -16849,12 +16612,12 @@ var MultiSelectOption = forwardRef19(function MultiSelectOption2({
|
|
|
16849
16612
|
}, ref) {
|
|
16850
16613
|
const context = useMultiSelectContext();
|
|
16851
16614
|
const { registerOption } = context;
|
|
16852
|
-
const itemRef =
|
|
16615
|
+
const itemRef = useRef31(null);
|
|
16853
16616
|
const display = children ?? label;
|
|
16854
16617
|
const iconAppearanceResolved = iconAppearance ?? context.config.iconAppearance;
|
|
16855
16618
|
const generatedId = useId16();
|
|
16856
16619
|
const optionId = props?.id ?? "multi-select-option-" + generatedId;
|
|
16857
|
-
|
|
16620
|
+
useEffect38(() => {
|
|
16858
16621
|
return registerOption({
|
|
16859
16622
|
id: optionId,
|
|
16860
16623
|
value,
|
|
@@ -16935,12 +16698,12 @@ var MultiSelectButton = forwardRef20(function MultiSelectButton2({
|
|
|
16935
16698
|
const { config, layout } = context;
|
|
16936
16699
|
const { setIds } = config;
|
|
16937
16700
|
const { registerTrigger } = layout;
|
|
16938
|
-
|
|
16701
|
+
useEffect39(() => {
|
|
16939
16702
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
16940
16703
|
}, [id, setIds]);
|
|
16941
|
-
const innerRef =
|
|
16704
|
+
const innerRef = useRef32(null);
|
|
16942
16705
|
useImperativeHandle13(ref, () => innerRef.current);
|
|
16943
|
-
|
|
16706
|
+
useEffect39(() => {
|
|
16944
16707
|
const unregister = registerTrigger(innerRef);
|
|
16945
16708
|
return () => unregister();
|
|
16946
16709
|
}, [registerTrigger]);
|
|
@@ -17003,18 +16766,18 @@ var MultiSelectButton = forwardRef20(function MultiSelectButton2({
|
|
|
17003
16766
|
});
|
|
17004
16767
|
|
|
17005
16768
|
// src/components/user-interaction/MultiSelect/MultiSelectContent.tsx
|
|
17006
|
-
import { forwardRef as forwardRef21, useCallback as useCallback35, useEffect as
|
|
16769
|
+
import { forwardRef as forwardRef21, useCallback as useCallback35, useEffect as useEffect40, useImperativeHandle as useImperativeHandle14, useRef as useRef33 } from "react";
|
|
17007
16770
|
import clsx26 from "clsx";
|
|
17008
16771
|
import { jsx as jsx73, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
17009
16772
|
var MultiSelectContent = forwardRef21(function MultiSelectContent2({ id, options, showSearch: showSearchOverride, searchInputProps, ...props }, ref) {
|
|
17010
16773
|
const translation = useHightideTranslation();
|
|
17011
|
-
const innerRef =
|
|
17012
|
-
const searchInputRef =
|
|
16774
|
+
const innerRef = useRef33(null);
|
|
16775
|
+
const searchInputRef = useRef33(null);
|
|
17013
16776
|
useImperativeHandle14(ref, () => innerRef.current);
|
|
17014
16777
|
const context = useMultiSelectContext();
|
|
17015
16778
|
const { config, highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId, handleTypeaheadKey, toggleSelection } = context;
|
|
17016
16779
|
const { setIds } = config;
|
|
17017
|
-
|
|
16780
|
+
useEffect40(() => {
|
|
17018
16781
|
if (id) setIds((prev) => ({ ...prev, content: id }));
|
|
17019
16782
|
}, [id, setIds]);
|
|
17020
16783
|
const showSearch = showSearchOverride ?? context.search.hasSearch;
|
|
@@ -17166,7 +16929,6 @@ var FilterBasePopUp = forwardRef23(function FilterBasePopUp2({
|
|
|
17166
16929
|
onOperatorChange,
|
|
17167
16930
|
onRemove,
|
|
17168
16931
|
allowedOperators,
|
|
17169
|
-
hasValue,
|
|
17170
16932
|
noParameterRequired = false,
|
|
17171
16933
|
...props
|
|
17172
16934
|
}, ref) {
|
|
@@ -17195,29 +16957,31 @@ var FilterBasePopUp = forwardRef23(function FilterBasePopUp2({
|
|
|
17195
16957
|
children: allowedOperators.map((op) => /* @__PURE__ */ jsx75(SelectOption, { value: op, label: translation(FilterOperatorUtils.getInfo(op).translationKey), children: /* @__PURE__ */ jsx75(FilterOperatorLabel, { operator: op }) }, op))
|
|
17196
16958
|
}
|
|
17197
16959
|
)
|
|
17198
|
-
] }),
|
|
17199
|
-
/* @__PURE__ */
|
|
17200
|
-
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17220
|
-
|
|
16960
|
+
] }),
|
|
16961
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex-row-0 items-center", children: [
|
|
16962
|
+
/* @__PURE__ */ jsx75(
|
|
16963
|
+
IconButton,
|
|
16964
|
+
{
|
|
16965
|
+
tooltip: translation("removeFilter"),
|
|
16966
|
+
onClick: onRemove,
|
|
16967
|
+
color: "negative",
|
|
16968
|
+
coloringStyle: "text",
|
|
16969
|
+
size: "sm",
|
|
16970
|
+
children: /* @__PURE__ */ jsx75(TrashIcon, { className: "size-4" })
|
|
16971
|
+
}
|
|
16972
|
+
),
|
|
16973
|
+
/* @__PURE__ */ jsx75(
|
|
16974
|
+
IconButton,
|
|
16975
|
+
{
|
|
16976
|
+
tooltip: translation("close"),
|
|
16977
|
+
onClick: props.onClose,
|
|
16978
|
+
color: "neutral",
|
|
16979
|
+
coloringStyle: "text",
|
|
16980
|
+
size: "sm",
|
|
16981
|
+
children: /* @__PURE__ */ jsx75(XIcon2, { className: "size-4" })
|
|
16982
|
+
}
|
|
16983
|
+
)
|
|
16984
|
+
] })
|
|
17221
16985
|
] }),
|
|
17222
16986
|
children,
|
|
17223
16987
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: noParameterRequired, children: /* @__PURE__ */ jsx75("div", { className: "flex-row-0 items-center text-sm text-description h-element-sm", children: translation("noParameterRequired") }) })
|
|
@@ -17238,7 +17002,7 @@ var TextFilterPopUp = forwardRef23(function TextFilterPopUp2({
|
|
|
17238
17002
|
search: `text-filter-search-${id}`,
|
|
17239
17003
|
caseSensitive: `text-filter-case-sensitive-${id}`
|
|
17240
17004
|
};
|
|
17241
|
-
const operator =
|
|
17005
|
+
const operator = useMemo33(() => {
|
|
17242
17006
|
const suggestion = value?.operator ?? "contains";
|
|
17243
17007
|
if (!FilterOperatorUtils.typeCheck.text(suggestion)) {
|
|
17244
17008
|
return "contains";
|
|
@@ -17257,7 +17021,6 @@ var TextFilterPopUp = forwardRef23(function TextFilterPopUp2({
|
|
|
17257
17021
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "text", parameter, operator: newOperator }),
|
|
17258
17022
|
onRemove,
|
|
17259
17023
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.text,
|
|
17260
|
-
hasValue: !!value,
|
|
17261
17024
|
noParameterRequired: !needsParameterInput,
|
|
17262
17025
|
children: /* @__PURE__ */ jsxs46(Visibility, { isVisible: needsParameterInput, children: [
|
|
17263
17026
|
/* @__PURE__ */ jsxs46("div", { className: "flex-col-1", children: [
|
|
@@ -17314,7 +17077,7 @@ var NumberFilterPopUp = forwardRef23(function NumberFilterPopUp2({
|
|
|
17314
17077
|
max: `number-filter-max-${id}`,
|
|
17315
17078
|
compareValue: `number-filter-compare-value-${id}`
|
|
17316
17079
|
};
|
|
17317
|
-
const operator =
|
|
17080
|
+
const operator = useMemo33(() => {
|
|
17318
17081
|
const suggestion = value?.operator ?? "between";
|
|
17319
17082
|
if (!FilterOperatorUtils.typeCheck.number(suggestion)) {
|
|
17320
17083
|
return "between";
|
|
@@ -17336,7 +17099,6 @@ var NumberFilterPopUp = forwardRef23(function NumberFilterPopUp2({
|
|
|
17336
17099
|
},
|
|
17337
17100
|
onRemove,
|
|
17338
17101
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.number,
|
|
17339
|
-
hasValue: !!value,
|
|
17340
17102
|
noParameterRequired: !needsParameterInput,
|
|
17341
17103
|
children: [
|
|
17342
17104
|
/* @__PURE__ */ jsxs46(Visibility, { isVisible: needsRangeInput, children: [
|
|
@@ -17418,7 +17180,7 @@ var DateFilterPopUp = forwardRef23(function DateFilterPopUp2({
|
|
|
17418
17180
|
endDate: `date-filter-end-date-${id}`,
|
|
17419
17181
|
compareDate: `date-filter-compare-date-${id}`
|
|
17420
17182
|
};
|
|
17421
|
-
const operator =
|
|
17183
|
+
const operator = useMemo33(() => {
|
|
17422
17184
|
const suggestion = value?.operator ?? "between";
|
|
17423
17185
|
if (!FilterOperatorUtils.typeCheck.date(suggestion)) {
|
|
17424
17186
|
return "between";
|
|
@@ -17426,8 +17188,8 @@ var DateFilterPopUp = forwardRef23(function DateFilterPopUp2({
|
|
|
17426
17188
|
return suggestion;
|
|
17427
17189
|
}, [value]);
|
|
17428
17190
|
const parameter = value?.parameter ?? {};
|
|
17429
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] =
|
|
17430
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] =
|
|
17191
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState32(null);
|
|
17192
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = useState32(null);
|
|
17431
17193
|
const needsRangeInput = operator === "between" || operator === "notBetween";
|
|
17432
17194
|
const needsParameterInput = operator !== "isUndefined" && operator !== "isNotUndefined";
|
|
17433
17195
|
return /* @__PURE__ */ jsxs46(
|
|
@@ -17440,7 +17202,6 @@ var DateFilterPopUp = forwardRef23(function DateFilterPopUp2({
|
|
|
17440
17202
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "date", parameter, operator: newOperator }),
|
|
17441
17203
|
onRemove,
|
|
17442
17204
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.date,
|
|
17443
|
-
hasValue: !!value,
|
|
17444
17205
|
noParameterRequired: !needsParameterInput,
|
|
17445
17206
|
children: [
|
|
17446
17207
|
/* @__PURE__ */ jsxs46(Visibility, { isVisible: needsRangeInput, children: [
|
|
@@ -17561,7 +17322,7 @@ var DatetimeFilterPopUp = forwardRef23(function DatetimeFilterPopUp2({
|
|
|
17561
17322
|
endDate: `datetime-filter-end-date-${id}`,
|
|
17562
17323
|
compareDate: `datetime-filter-compare-date-${id}`
|
|
17563
17324
|
};
|
|
17564
|
-
const operator =
|
|
17325
|
+
const operator = useMemo33(() => {
|
|
17565
17326
|
const suggestion = value?.operator ?? "between";
|
|
17566
17327
|
if (!FilterOperatorUtils.typeCheck.datetime(suggestion)) {
|
|
17567
17328
|
return "between";
|
|
@@ -17569,8 +17330,8 @@ var DatetimeFilterPopUp = forwardRef23(function DatetimeFilterPopUp2({
|
|
|
17569
17330
|
return suggestion;
|
|
17570
17331
|
}, [value]);
|
|
17571
17332
|
const parameter = value?.parameter ?? {};
|
|
17572
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] =
|
|
17573
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] =
|
|
17333
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState32(null);
|
|
17334
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = useState32(null);
|
|
17574
17335
|
const needsRangeInput = operator === "between" || operator === "notBetween";
|
|
17575
17336
|
const needsParameterInput = operator !== "isUndefined" && operator !== "isNotUndefined";
|
|
17576
17337
|
return /* @__PURE__ */ jsxs46(
|
|
@@ -17583,7 +17344,6 @@ var DatetimeFilterPopUp = forwardRef23(function DatetimeFilterPopUp2({
|
|
|
17583
17344
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "dateTime", parameter, operator: newOperator }),
|
|
17584
17345
|
onRemove,
|
|
17585
17346
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.dateTime,
|
|
17586
|
-
hasValue: !!value,
|
|
17587
17347
|
children: [
|
|
17588
17348
|
/* @__PURE__ */ jsx75("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17589
17349
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: needsRangeInput, children: /* @__PURE__ */ jsxs46("div", { className: "flex-col-2 gap-2", children: [
|
|
@@ -17697,7 +17457,7 @@ var BooleanFilterPopUp = forwardRef23(function BooleanFilterPopUp2({
|
|
|
17697
17457
|
onRemove,
|
|
17698
17458
|
...props
|
|
17699
17459
|
}, ref) {
|
|
17700
|
-
const operator =
|
|
17460
|
+
const operator = useMemo33(() => {
|
|
17701
17461
|
const suggestion = value?.operator ?? "isTrue";
|
|
17702
17462
|
if (!FilterOperatorUtils.typeCheck.boolean(suggestion)) {
|
|
17703
17463
|
return "isTrue";
|
|
@@ -17714,8 +17474,7 @@ var BooleanFilterPopUp = forwardRef23(function BooleanFilterPopUp2({
|
|
|
17714
17474
|
operator,
|
|
17715
17475
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "boolean", parameter, operator: newOperator }),
|
|
17716
17476
|
onRemove,
|
|
17717
|
-
allowedOperators: FilterOperatorUtils.operatorsByCategory.boolean
|
|
17718
|
-
hasValue: !!value
|
|
17477
|
+
allowedOperators: FilterOperatorUtils.operatorsByCategory.boolean
|
|
17719
17478
|
}
|
|
17720
17479
|
);
|
|
17721
17480
|
});
|
|
@@ -17728,7 +17487,7 @@ var TagsFilterPopUp = forwardRef23(function TagsFilterPopUp2({
|
|
|
17728
17487
|
...props
|
|
17729
17488
|
}, ref) {
|
|
17730
17489
|
const translation = useHightideTranslation();
|
|
17731
|
-
const operator =
|
|
17490
|
+
const operator = useMemo33(() => {
|
|
17732
17491
|
const suggestion = value?.operator ?? "contains";
|
|
17733
17492
|
if (!FilterOperatorUtils.typeCheck.tags(suggestion)) {
|
|
17734
17493
|
return "contains";
|
|
@@ -17751,7 +17510,6 @@ var TagsFilterPopUp = forwardRef23(function TagsFilterPopUp2({
|
|
|
17751
17510
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "multiTags", parameter, operator: newOperator }),
|
|
17752
17511
|
onRemove,
|
|
17753
17512
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.multiTags,
|
|
17754
|
-
hasValue: !!value,
|
|
17755
17513
|
children: [
|
|
17756
17514
|
/* @__PURE__ */ jsx75("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17757
17515
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: needsParameterInput, children: /* @__PURE__ */ jsx75(
|
|
@@ -17783,7 +17541,7 @@ var TagsSingleFilterPopUp = forwardRef23(function TagsSingleFilterPopUp2({
|
|
|
17783
17541
|
...props
|
|
17784
17542
|
}, ref) {
|
|
17785
17543
|
const translation = useHightideTranslation();
|
|
17786
|
-
const operator =
|
|
17544
|
+
const operator = useMemo33(() => {
|
|
17787
17545
|
const suggestion = value?.operator ?? "contains";
|
|
17788
17546
|
if (!FilterOperatorUtils.typeCheck.tagsSingle(suggestion)) {
|
|
17789
17547
|
return "contains";
|
|
@@ -17808,7 +17566,6 @@ var TagsSingleFilterPopUp = forwardRef23(function TagsSingleFilterPopUp2({
|
|
|
17808
17566
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "singleTag", parameter, operator: newOperator }),
|
|
17809
17567
|
onRemove,
|
|
17810
17568
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.singleTag,
|
|
17811
|
-
hasValue: !!value,
|
|
17812
17569
|
children: [
|
|
17813
17570
|
/* @__PURE__ */ jsx75("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17814
17571
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: needsParameterInput && needsMultiSelect, children: /* @__PURE__ */ jsx75(
|
|
@@ -17847,7 +17604,7 @@ var TagsSingleFilterPopUp = forwardRef23(function TagsSingleFilterPopUp2({
|
|
|
17847
17604
|
);
|
|
17848
17605
|
});
|
|
17849
17606
|
var GenericFilterPopUp = forwardRef23(function GenericFilterPopUp2({ name, value, onValueChange, ...props }, ref) {
|
|
17850
|
-
const operator =
|
|
17607
|
+
const operator = useMemo33(() => {
|
|
17851
17608
|
const suggestion = value?.operator ?? "isNotUndefined";
|
|
17852
17609
|
if (!FilterOperatorUtils.typeCheck.unknownType(suggestion)) {
|
|
17853
17610
|
return "isNotUndefined";
|
|
@@ -17863,8 +17620,7 @@ var GenericFilterPopUp = forwardRef23(function GenericFilterPopUp2({ name, value
|
|
|
17863
17620
|
operator,
|
|
17864
17621
|
onOperatorChange: (newOperator) => onValueChange({ ...value, operator: newOperator }),
|
|
17865
17622
|
onRemove: () => onValueChange({ ...value, operator: void 0 }),
|
|
17866
|
-
allowedOperators: FilterOperatorUtils.operatorsByCategory.unknownType
|
|
17867
|
-
hasValue: !!value
|
|
17623
|
+
allowedOperators: FilterOperatorUtils.operatorsByCategory.unknownType
|
|
17868
17624
|
}
|
|
17869
17625
|
);
|
|
17870
17626
|
});
|
|
@@ -17905,18 +17661,18 @@ var TableFilterButton = ({
|
|
|
17905
17661
|
const translation = useHightideTranslation();
|
|
17906
17662
|
const column = header.column;
|
|
17907
17663
|
const columnFilterValue = column.getFilterValue();
|
|
17908
|
-
const [filterValue, setFilterValue] =
|
|
17664
|
+
const [filterValue, setFilterValue] = useState33(columnFilterValue);
|
|
17909
17665
|
const hasFilter = !!filterValue;
|
|
17910
|
-
const anchorRef =
|
|
17911
|
-
const containerRef =
|
|
17912
|
-
const [isOpen, setIsOpen] =
|
|
17666
|
+
const anchorRef = useRef34(null);
|
|
17667
|
+
const containerRef = useRef34(null);
|
|
17668
|
+
const [isOpen, setIsOpen] = useState33(false);
|
|
17913
17669
|
const id = useId18();
|
|
17914
|
-
const ids =
|
|
17670
|
+
const ids = useMemo34(() => ({
|
|
17915
17671
|
button: `table-filter-button-${id}`,
|
|
17916
17672
|
popup: `table-filter-popup-${id}`,
|
|
17917
17673
|
label: `table-filter-label-${id}`
|
|
17918
17674
|
}), [id]);
|
|
17919
|
-
|
|
17675
|
+
useEffect41(() => {
|
|
17920
17676
|
setFilterValue(columnFilterValue);
|
|
17921
17677
|
}, [columnFilterValue]);
|
|
17922
17678
|
const isTagsFilter = filterType === "multiTags" || filterType === "singleTag";
|
|
@@ -17977,7 +17733,7 @@ var TableFilterButton = ({
|
|
|
17977
17733
|
};
|
|
17978
17734
|
|
|
17979
17735
|
// src/components/layout/table/TableHeader.tsx
|
|
17980
|
-
import { useCallback as useCallback36, useEffect as
|
|
17736
|
+
import { useCallback as useCallback36, useEffect as useEffect42 } from "react";
|
|
17981
17737
|
|
|
17982
17738
|
// src/components/user-interaction/data/data-types.tsx
|
|
17983
17739
|
import { Binary, Calendar as Calendar2, CalendarClock, Check as Check3, Database, Tag, Tags, TextIcon } from "lucide-react";
|
|
@@ -18075,7 +17831,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
18075
17831
|
startSize: null
|
|
18076
17832
|
});
|
|
18077
17833
|
}, [table]);
|
|
18078
|
-
|
|
17834
|
+
useEffect42(() => {
|
|
18079
17835
|
window.addEventListener("pointermove", handleResizeMove);
|
|
18080
17836
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
18081
17837
|
return () => {
|
|
@@ -18244,7 +18000,7 @@ var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props
|
|
|
18244
18000
|
};
|
|
18245
18001
|
|
|
18246
18002
|
// src/components/layout/table/TableWithSelectionProvider.tsx
|
|
18247
|
-
import { useCallback as useCallback37, useMemo as
|
|
18003
|
+
import { useCallback as useCallback37, useMemo as useMemo35 } from "react";
|
|
18248
18004
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
18249
18005
|
var TableWithSelectionProvider = ({
|
|
18250
18006
|
children,
|
|
@@ -18257,7 +18013,7 @@ var TableWithSelectionProvider = ({
|
|
|
18257
18013
|
...props
|
|
18258
18014
|
}) => {
|
|
18259
18015
|
const translation = useHightideTranslation();
|
|
18260
|
-
const columnDef =
|
|
18016
|
+
const columnDef = useMemo35(() => [
|
|
18261
18017
|
{
|
|
18262
18018
|
id: selectionRowId,
|
|
18263
18019
|
header: ({ table }) => {
|
|
@@ -18360,7 +18116,7 @@ var TableWithSelection = ({
|
|
|
18360
18116
|
};
|
|
18361
18117
|
|
|
18362
18118
|
// src/components/layout/table/TableColumn.tsx
|
|
18363
|
-
import { memo as memo2, useEffect as
|
|
18119
|
+
import { memo as memo2, useEffect as useEffect43, useMemo as useMemo36, useState as useState34 } from "react";
|
|
18364
18120
|
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
18365
18121
|
var TableColumnComponent = ({
|
|
18366
18122
|
filterType,
|
|
@@ -18372,11 +18128,11 @@ var TableColumnComponent = ({
|
|
|
18372
18128
|
"TableColumn: For filterType === multiTags or singleTag, filterData.tags must be set.",
|
|
18373
18129
|
(filterType === "multiTags" || filterType === "singleTag") && props.meta?.filterData?.tags === void 0
|
|
18374
18130
|
);
|
|
18375
|
-
const [column] =
|
|
18131
|
+
const [column] = useState34({
|
|
18376
18132
|
...props,
|
|
18377
18133
|
filterFn
|
|
18378
18134
|
});
|
|
18379
|
-
|
|
18135
|
+
useEffect43(() => {
|
|
18380
18136
|
const unsubscribe = registerColumn(column);
|
|
18381
18137
|
return () => {
|
|
18382
18138
|
unsubscribe();
|
|
@@ -18391,27 +18147,27 @@ var TableColumnFactory = () => memo2(
|
|
|
18391
18147
|
}
|
|
18392
18148
|
);
|
|
18393
18149
|
var TableColumn = (props) => {
|
|
18394
|
-
const TableColumnComponent2 =
|
|
18150
|
+
const TableColumnComponent2 = useMemo36(() => TableColumnFactory(), []);
|
|
18395
18151
|
return /* @__PURE__ */ jsx83(TableColumnComponent2, { ...props });
|
|
18396
18152
|
};
|
|
18397
18153
|
|
|
18398
18154
|
// src/components/layout/table/TableColumnSwitcher.tsx
|
|
18399
|
-
import { useMemo as
|
|
18155
|
+
import { useMemo as useMemo37, useRef as useRef35, useId as useId19 } from "react";
|
|
18400
18156
|
import { ChevronUp as ChevronUp3, ChevronDown as ChevronDown5, ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight5, Eye, EyeOff, Pin, PinOff, ArrowLeftRightIcon } from "lucide-react";
|
|
18401
18157
|
import { Fragment as Fragment10, jsx as jsx84, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
18402
18158
|
var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
18403
18159
|
const { table } = useTableStateWithoutSizingContext();
|
|
18404
18160
|
const translation = useHightideTranslation();
|
|
18405
|
-
const containerRef =
|
|
18161
|
+
const containerRef = useRef35(null);
|
|
18406
18162
|
const generatedId = useId19();
|
|
18407
|
-
const ids =
|
|
18163
|
+
const ids = useMemo37(() => ({
|
|
18408
18164
|
popup: props.id ?? `table-column-picker-popup-${generatedId}`,
|
|
18409
18165
|
label: `table-column-picker-label-${generatedId}`
|
|
18410
18166
|
}), [generatedId, props.id]);
|
|
18411
18167
|
const tableState = table.getState();
|
|
18412
18168
|
const columnOrder = tableState.columnOrder;
|
|
18413
18169
|
const columnPinning = tableState.columnPinning;
|
|
18414
|
-
const columns =
|
|
18170
|
+
const columns = useMemo37(() => {
|
|
18415
18171
|
const allColumns = table.getAllColumns();
|
|
18416
18172
|
const leftPinned = [];
|
|
18417
18173
|
const unpinned = [];
|
|
@@ -18672,7 +18428,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
18672
18428
|
import { forwardRef as forwardRef26 } from "react";
|
|
18673
18429
|
|
|
18674
18430
|
// src/components/user-interaction/Combobox/ComboboxRoot.tsx
|
|
18675
|
-
import { useCallback as useCallback39, useId as useId20, useMemo as
|
|
18431
|
+
import { useCallback as useCallback39, useId as useId20, useMemo as useMemo39, useState as useState35 } from "react";
|
|
18676
18432
|
|
|
18677
18433
|
// src/components/user-interaction/Combobox/ComboboxContext.tsx
|
|
18678
18434
|
import { createContext as createContext17, useContext as useContext19 } from "react";
|
|
@@ -18686,7 +18442,7 @@ function useComboboxContext() {
|
|
|
18686
18442
|
}
|
|
18687
18443
|
|
|
18688
18444
|
// src/components/user-interaction/Combobox/useCombobox.ts
|
|
18689
|
-
import { useCallback as useCallback38, useMemo as
|
|
18445
|
+
import { useCallback as useCallback38, useMemo as useMemo38 } from "react";
|
|
18690
18446
|
function useCombobox({
|
|
18691
18447
|
options,
|
|
18692
18448
|
searchQuery: controlledSearchQuery,
|
|
@@ -18703,11 +18459,11 @@ function useCombobox({
|
|
|
18703
18459
|
searchQuery: searchQuery ?? "",
|
|
18704
18460
|
toTags: useCallback38((o) => [o.label], [])
|
|
18705
18461
|
});
|
|
18706
|
-
const visibleOptionIds =
|
|
18462
|
+
const visibleOptionIds = useMemo38(
|
|
18707
18463
|
() => visibleOptions.map((o) => o.id),
|
|
18708
18464
|
[visibleOptions]
|
|
18709
18465
|
);
|
|
18710
|
-
const enabledOptionIds =
|
|
18466
|
+
const enabledOptionIds = useMemo38(
|
|
18711
18467
|
() => visibleOptions.filter((o) => !o.disabled).map((o) => o.id),
|
|
18712
18468
|
[visibleOptions]
|
|
18713
18469
|
);
|
|
@@ -18719,18 +18475,18 @@ function useCombobox({
|
|
|
18719
18475
|
},
|
|
18720
18476
|
[enabledOptionIds, listNav]
|
|
18721
18477
|
);
|
|
18722
|
-
const state =
|
|
18478
|
+
const state = useMemo38(
|
|
18723
18479
|
() => ({
|
|
18724
18480
|
searchQuery: searchQuery ?? "",
|
|
18725
18481
|
highlightedId: listNav.highlightedId
|
|
18726
18482
|
}),
|
|
18727
18483
|
[searchQuery, listNav.highlightedId]
|
|
18728
18484
|
);
|
|
18729
|
-
const computedState =
|
|
18485
|
+
const computedState = useMemo38(
|
|
18730
18486
|
() => ({ visibleOptionIds }),
|
|
18731
18487
|
[visibleOptionIds]
|
|
18732
18488
|
);
|
|
18733
|
-
const actions =
|
|
18489
|
+
const actions = useMemo38(
|
|
18734
18490
|
() => ({
|
|
18735
18491
|
setSearchQuery,
|
|
18736
18492
|
highlightFirst: listNav.first,
|
|
@@ -18741,7 +18497,7 @@ function useCombobox({
|
|
|
18741
18497
|
}),
|
|
18742
18498
|
[setSearchQuery, listNav.first, listNav.last, listNav.next, listNav.previous, highlightItem]
|
|
18743
18499
|
);
|
|
18744
|
-
return
|
|
18500
|
+
return useMemo38(
|
|
18745
18501
|
() => ({
|
|
18746
18502
|
...state,
|
|
18747
18503
|
...computedState,
|
|
@@ -18758,10 +18514,10 @@ function ComboboxRoot({
|
|
|
18758
18514
|
onItemClick,
|
|
18759
18515
|
...hookProps
|
|
18760
18516
|
}) {
|
|
18761
|
-
const [options, setOptions] =
|
|
18762
|
-
const [listRef, setListRef] =
|
|
18517
|
+
const [options, setOptions] = useState35([]);
|
|
18518
|
+
const [listRef, setListRef] = useState35(null);
|
|
18763
18519
|
const generatedId = useId20();
|
|
18764
|
-
const [ids, setIds] =
|
|
18520
|
+
const [ids, setIds] = useState35({
|
|
18765
18521
|
trigger: `combobox-${generatedId}`,
|
|
18766
18522
|
listbox: `combobox-${generatedId}-listbox`
|
|
18767
18523
|
});
|
|
@@ -18781,7 +18537,7 @@ function ComboboxRoot({
|
|
|
18781
18537
|
setListRef(() => ref);
|
|
18782
18538
|
return () => setListRef(null);
|
|
18783
18539
|
}, []);
|
|
18784
|
-
const hookOptions =
|
|
18540
|
+
const hookOptions = useMemo39(
|
|
18785
18541
|
() => options.map((o) => ({
|
|
18786
18542
|
id: o.id,
|
|
18787
18543
|
label: o.label,
|
|
@@ -18790,7 +18546,7 @@ function ComboboxRoot({
|
|
|
18790
18546
|
[options]
|
|
18791
18547
|
);
|
|
18792
18548
|
const state = useCombobox({ ...hookProps, options: hookOptions });
|
|
18793
|
-
const idToOptionMap =
|
|
18549
|
+
const idToOptionMap = useMemo39(() => {
|
|
18794
18550
|
return options.reduce((acc, o) => {
|
|
18795
18551
|
acc[o.id] = o;
|
|
18796
18552
|
return acc;
|
|
@@ -18803,25 +18559,25 @@ function ComboboxRoot({
|
|
|
18803
18559
|
},
|
|
18804
18560
|
[idToOptionMap, onItemClick]
|
|
18805
18561
|
);
|
|
18806
|
-
const config =
|
|
18562
|
+
const config = useMemo39(
|
|
18807
18563
|
() => ({ ids, setIds }),
|
|
18808
18564
|
[ids, setIds]
|
|
18809
18565
|
);
|
|
18810
|
-
const layout =
|
|
18566
|
+
const layout = useMemo39(
|
|
18811
18567
|
() => ({
|
|
18812
18568
|
listRef: listRef ?? { current: null },
|
|
18813
18569
|
registerList
|
|
18814
18570
|
}),
|
|
18815
18571
|
[listRef, registerList]
|
|
18816
18572
|
);
|
|
18817
|
-
const search =
|
|
18573
|
+
const search = useMemo39(
|
|
18818
18574
|
() => ({
|
|
18819
18575
|
searchQuery: state.searchQuery,
|
|
18820
18576
|
setSearchQuery: state.setSearchQuery
|
|
18821
18577
|
}),
|
|
18822
18578
|
[state.searchQuery, state.setSearchQuery]
|
|
18823
18579
|
);
|
|
18824
|
-
const contextValue =
|
|
18580
|
+
const contextValue = useMemo39(
|
|
18825
18581
|
() => ({
|
|
18826
18582
|
highlightedId: state.highlightedId,
|
|
18827
18583
|
options,
|
|
@@ -18918,7 +18674,7 @@ var ComboboxInput = forwardRef24(
|
|
|
18918
18674
|
);
|
|
18919
18675
|
|
|
18920
18676
|
// src/components/user-interaction/Combobox/ComboboxList.tsx
|
|
18921
|
-
import { forwardRef as forwardRef25, useEffect as
|
|
18677
|
+
import { forwardRef as forwardRef25, useEffect as useEffect44, useRef as useRef36 } from "react";
|
|
18922
18678
|
import clsx31 from "clsx";
|
|
18923
18679
|
import { jsx as jsx87, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
18924
18680
|
var ComboboxList = forwardRef25(
|
|
@@ -18927,8 +18683,8 @@ var ComboboxList = forwardRef25(
|
|
|
18927
18683
|
const context = useComboboxContext();
|
|
18928
18684
|
const { layout } = context;
|
|
18929
18685
|
const { registerList } = layout;
|
|
18930
|
-
const innerRef =
|
|
18931
|
-
|
|
18686
|
+
const innerRef = useRef36(null);
|
|
18687
|
+
useEffect44(() => {
|
|
18932
18688
|
return registerList(innerRef);
|
|
18933
18689
|
}, [registerList]);
|
|
18934
18690
|
const setRefs = (node) => {
|
|
@@ -18995,7 +18751,7 @@ var Combobox = forwardRef26(function Combobox2({
|
|
|
18995
18751
|
});
|
|
18996
18752
|
|
|
18997
18753
|
// src/components/user-interaction/Combobox/ComboboxOption.tsx
|
|
18998
|
-
import { forwardRef as forwardRef27, useEffect as
|
|
18754
|
+
import { forwardRef as forwardRef27, useEffect as useEffect45, useId as useId21, useRef as useRef37 } from "react";
|
|
18999
18755
|
import clsx32 from "clsx";
|
|
19000
18756
|
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
19001
18757
|
var ComboboxOption = forwardRef27(function ComboboxOption2({
|
|
@@ -19009,11 +18765,11 @@ var ComboboxOption = forwardRef27(function ComboboxOption2({
|
|
|
19009
18765
|
}, ref) {
|
|
19010
18766
|
const context = useComboboxContext();
|
|
19011
18767
|
const { registerOption } = context;
|
|
19012
|
-
const itemRef =
|
|
18768
|
+
const itemRef = useRef37(null);
|
|
19013
18769
|
const generatedId = useId21();
|
|
19014
18770
|
const optionId = idProp ?? `combobox-option-${generatedId}`;
|
|
19015
18771
|
const resolvedDisplay = children ?? label;
|
|
19016
|
-
|
|
18772
|
+
useEffect45(() => {
|
|
19017
18773
|
return registerOption({
|
|
19018
18774
|
id: optionId,
|
|
19019
18775
|
value,
|
|
@@ -19023,7 +18779,7 @@ var ComboboxOption = forwardRef27(function ComboboxOption2({
|
|
|
19023
18779
|
ref: itemRef
|
|
19024
18780
|
});
|
|
19025
18781
|
}, [optionId, value, label, resolvedDisplay, disabled, registerOption]);
|
|
19026
|
-
|
|
18782
|
+
useEffect45(() => {
|
|
19027
18783
|
if (context.highlightedId === optionId) {
|
|
19028
18784
|
itemRef.current?.scrollIntoView?.({ behavior: "smooth", block: "nearest" });
|
|
19029
18785
|
}
|
|
@@ -19069,7 +18825,7 @@ var ComboboxOption = forwardRef27(function ComboboxOption2({
|
|
|
19069
18825
|
ComboboxOption.displayName = "ComboboxOption";
|
|
19070
18826
|
|
|
19071
18827
|
// src/components/user-interaction/CopyToClipboardWrapper.tsx
|
|
19072
|
-
import { useState as
|
|
18828
|
+
import { useState as useState36 } from "react";
|
|
19073
18829
|
import { clsx as clsx33 } from "clsx";
|
|
19074
18830
|
|
|
19075
18831
|
// src/utils/writeToClipboard.ts
|
|
@@ -19092,7 +18848,7 @@ var CopyToClipboardWrapper = ({
|
|
|
19092
18848
|
...props
|
|
19093
18849
|
}) => {
|
|
19094
18850
|
const translation = useHightideTranslation();
|
|
19095
|
-
const [isShowingConfirmation, setIsShowingConfirmation] =
|
|
18851
|
+
const [isShowingConfirmation, setIsShowingConfirmation] = useState36(false);
|
|
19096
18852
|
return /* @__PURE__ */ jsxs55(
|
|
19097
18853
|
TooltipRoot,
|
|
19098
18854
|
{
|
|
@@ -19141,7 +18897,7 @@ var CopyToClipboardWrapper = ({
|
|
|
19141
18897
|
};
|
|
19142
18898
|
|
|
19143
18899
|
// src/components/user-interaction/Menu.tsx
|
|
19144
|
-
import { useCallback as useCallback41, useRef as
|
|
18900
|
+
import { useCallback as useCallback41, useRef as useRef38, useState as useState37 } from "react";
|
|
19145
18901
|
import clsx34 from "clsx";
|
|
19146
18902
|
import { Fragment as Fragment11, jsx as jsx91, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
19147
18903
|
var MenuItem = ({
|
|
@@ -19167,8 +18923,8 @@ var Menu = ({
|
|
|
19167
18923
|
disabled = false,
|
|
19168
18924
|
...props
|
|
19169
18925
|
}) => {
|
|
19170
|
-
const triggerRef =
|
|
19171
|
-
const [isOpen, setIsOpen] =
|
|
18926
|
+
const triggerRef = useRef38(null);
|
|
18927
|
+
const [isOpen, setIsOpen] = useState37(false);
|
|
19172
18928
|
const bag = {
|
|
19173
18929
|
isOpen,
|
|
19174
18930
|
close: () => setIsOpen(false),
|
|
@@ -19198,7 +18954,7 @@ var Menu = ({
|
|
|
19198
18954
|
};
|
|
19199
18955
|
|
|
19200
18956
|
// src/components/user-interaction/MultiSelect/MultiSelectChipDisplay.tsx
|
|
19201
|
-
import { forwardRef as forwardRef28, useEffect as
|
|
18957
|
+
import { forwardRef as forwardRef28, useEffect as useEffect46, useImperativeHandle as useImperativeHandle15, useRef as useRef39 } from "react";
|
|
19202
18958
|
import { XIcon as XIcon3, Plus } from "lucide-react";
|
|
19203
18959
|
import { jsx as jsx92, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
19204
18960
|
var MultiSelectChipDisplayButton = forwardRef28(function MultiSelectChipDisplayButton2({ id, ...props }, ref) {
|
|
@@ -19207,12 +18963,12 @@ var MultiSelectChipDisplayButton = forwardRef28(function MultiSelectChipDisplayB
|
|
|
19207
18963
|
const { config, layout } = context;
|
|
19208
18964
|
const { setIds } = config;
|
|
19209
18965
|
const { registerTrigger } = layout;
|
|
19210
|
-
|
|
18966
|
+
useEffect46(() => {
|
|
19211
18967
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
19212
18968
|
}, [id, setIds]);
|
|
19213
|
-
const innerRef =
|
|
18969
|
+
const innerRef = useRef39(null);
|
|
19214
18970
|
useImperativeHandle15(ref, () => innerRef.current);
|
|
19215
|
-
|
|
18971
|
+
useEffect46(() => {
|
|
19216
18972
|
const unregister = registerTrigger(innerRef);
|
|
19217
18973
|
return () => unregister();
|
|
19218
18974
|
}, [registerTrigger]);
|
|
@@ -19302,7 +19058,7 @@ var MultiSelectChipDisplay = forwardRef28(
|
|
|
19302
19058
|
);
|
|
19303
19059
|
|
|
19304
19060
|
// src/components/user-interaction/ScrollPicker.tsx
|
|
19305
|
-
import { useCallback as useCallback42, useEffect as
|
|
19061
|
+
import { useCallback as useCallback42, useEffect as useEffect47, useState as useState38 } from "react";
|
|
19306
19062
|
import clsx35 from "clsx";
|
|
19307
19063
|
import { jsx as jsx93, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
19308
19064
|
var up = 1;
|
|
@@ -19323,7 +19079,7 @@ var ScrollPicker = ({
|
|
|
19323
19079
|
transition,
|
|
19324
19080
|
items,
|
|
19325
19081
|
lastTimeStamp
|
|
19326
|
-
}, setAnimation] =
|
|
19082
|
+
}, setAnimation] = useState38({
|
|
19327
19083
|
targetIndex: selectedIndex,
|
|
19328
19084
|
currentIndex: disabled ? selectedIndex : 0,
|
|
19329
19085
|
velocity: 0,
|
|
@@ -19422,7 +19178,7 @@ var ScrollPicker = ({
|
|
|
19422
19178
|
};
|
|
19423
19179
|
});
|
|
19424
19180
|
}, [disabled, getDirection, onChange]);
|
|
19425
|
-
|
|
19181
|
+
useEffect47(() => {
|
|
19426
19182
|
requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp));
|
|
19427
19183
|
});
|
|
19428
19184
|
const opacity = (transition2, index, itemsCount) => {
|
|
@@ -19644,20 +19400,20 @@ var TextareaWithHeadline = ({
|
|
|
19644
19400
|
};
|
|
19645
19401
|
|
|
19646
19402
|
// src/components/user-interaction/data/FilterList.tsx
|
|
19647
|
-
import { useMemo as
|
|
19403
|
+
import { useMemo as useMemo40, useState as useState39 } from "react";
|
|
19648
19404
|
import { PlusIcon } from "lucide-react";
|
|
19649
19405
|
import { jsx as jsx96, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
19650
19406
|
var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
19651
19407
|
const translation = useHightideTranslation();
|
|
19652
19408
|
const filterValueToLabel = useFilterValueTranslation();
|
|
19653
|
-
const activeIds =
|
|
19654
|
-
const inactiveItems =
|
|
19655
|
-
const itemRecord =
|
|
19409
|
+
const activeIds = useMemo40(() => value.map((item) => item.id), [value]);
|
|
19410
|
+
const inactiveItems = useMemo40(() => availableItems.filter((item) => !activeIds.includes(item.id)).sort((a, b) => a.label.localeCompare(b.label)), [availableItems, activeIds]);
|
|
19411
|
+
const itemRecord = useMemo40(() => availableItems.reduce((acc, item) => {
|
|
19656
19412
|
acc[item.id] = item;
|
|
19657
19413
|
return acc;
|
|
19658
19414
|
}, {}), [availableItems]);
|
|
19659
|
-
const [editState, setEditState] =
|
|
19660
|
-
const valueWithEditState =
|
|
19415
|
+
const [editState, setEditState] = useState39(void 0);
|
|
19416
|
+
const valueWithEditState = useMemo40(() => {
|
|
19661
19417
|
let foundEditValue = false;
|
|
19662
19418
|
for (const item of value) {
|
|
19663
19419
|
if (item.id === editState?.id) {
|
|
@@ -19672,7 +19428,7 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19672
19428
|
}, [value, editState]);
|
|
19673
19429
|
return /* @__PURE__ */ jsxs60("div", { className: "flex-row-1 flex-wrap gap-y-1", children: [
|
|
19674
19430
|
/* @__PURE__ */ jsxs60(PopUpRoot, { children: [
|
|
19675
|
-
/* @__PURE__ */ jsx96(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ jsxs60(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "
|
|
19431
|
+
/* @__PURE__ */ jsx96(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ jsxs60(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "md", children: [
|
|
19676
19432
|
translation("addFilter"),
|
|
19677
19433
|
/* @__PURE__ */ jsx96(PlusIcon, { className: "size-4" })
|
|
19678
19434
|
] }) }),
|
|
@@ -19684,9 +19440,11 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19684
19440
|
if (!item) return;
|
|
19685
19441
|
const newValue = {
|
|
19686
19442
|
id: item.id,
|
|
19687
|
-
|
|
19688
|
-
|
|
19689
|
-
|
|
19443
|
+
value: {
|
|
19444
|
+
dataType: item.dataType,
|
|
19445
|
+
operator: FilterOperatorUtils.getDefaultOperator(item.dataType),
|
|
19446
|
+
parameter: {}
|
|
19447
|
+
}
|
|
19690
19448
|
};
|
|
19691
19449
|
setEditState(newValue);
|
|
19692
19450
|
setIsOpen(false);
|
|
@@ -19698,36 +19456,36 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19698
19456
|
}
|
|
19699
19457
|
) }) })
|
|
19700
19458
|
] }),
|
|
19701
|
-
valueWithEditState.map((
|
|
19702
|
-
const item = itemRecord[
|
|
19459
|
+
valueWithEditState.map((columnFilter) => {
|
|
19460
|
+
const item = itemRecord[columnFilter.id];
|
|
19703
19461
|
if (!item) return null;
|
|
19704
19462
|
return /* @__PURE__ */ jsxs60(
|
|
19705
19463
|
PopUpRoot,
|
|
19706
19464
|
{
|
|
19707
|
-
isOpen: editState?.id ===
|
|
19465
|
+
isOpen: editState?.id === columnFilter.id,
|
|
19708
19466
|
onIsOpenChange: (isOpen) => {
|
|
19709
19467
|
if (!isOpen) {
|
|
19710
|
-
const isEditStateValid = editState ? FilterValueUtils.isValid(editState) : false;
|
|
19468
|
+
const isEditStateValid = editState ? FilterValueUtils.isValid(editState.value) : false;
|
|
19711
19469
|
if (isEditStateValid) {
|
|
19712
|
-
onValueChange(valueWithEditState.map((prevItem) => prevItem.id ===
|
|
19470
|
+
onValueChange(valueWithEditState.map((prevItem) => prevItem.id === columnFilter.id ? { ...prevItem, ...editState } : prevItem));
|
|
19713
19471
|
}
|
|
19714
19472
|
setEditState(void 0);
|
|
19715
19473
|
} else {
|
|
19716
|
-
const valueItem = value.find((prevItem) => prevItem.id ===
|
|
19474
|
+
const valueItem = value.find((prevItem) => prevItem.id === columnFilter.id);
|
|
19717
19475
|
if (!valueItem) return;
|
|
19718
19476
|
setEditState({ ...valueItem });
|
|
19719
19477
|
}
|
|
19720
19478
|
},
|
|
19721
19479
|
children: [
|
|
19722
|
-
/* @__PURE__ */ jsx96(PopUpOpener, { children: ({ toggleOpen, props, isOpen }) => /* @__PURE__ */ jsxs60(Button, { ...props, onClick: toggleOpen, color: "primary", coloringStyle: "tonal", size: "
|
|
19723
|
-
item.label + ": " + filterValueToLabel(
|
|
19480
|
+
/* @__PURE__ */ jsx96(PopUpOpener, { children: ({ toggleOpen, props, isOpen }) => /* @__PURE__ */ jsxs60(Button, { ...props, onClick: toggleOpen, color: "primary", coloringStyle: "tonal-outline", size: "md", children: [
|
|
19481
|
+
item.activeLabelBuilder ? item.activeLabelBuilder(columnFilter.value) : item.label + ": " + filterValueToLabel(columnFilter.value, { tags: item.tags }),
|
|
19724
19482
|
/* @__PURE__ */ jsx96(ExpansionIcon, { isExpanded: isOpen })
|
|
19725
19483
|
] }) }),
|
|
19726
|
-
|
|
19727
|
-
value: editState?.id ===
|
|
19728
|
-
onValueChange: (value2) => setEditState({ ...
|
|
19484
|
+
/* @__PURE__ */ jsx96(PopUpContext.Consumer, { children: ({ isOpen, setIsOpen }) => item.popUpBuilder ? item.popUpBuilder({
|
|
19485
|
+
value: editState?.id === columnFilter.id ? editState.value : columnFilter.value,
|
|
19486
|
+
onValueChange: (value2) => setEditState({ ...columnFilter, value: value2 }),
|
|
19729
19487
|
onRemove: () => {
|
|
19730
|
-
onValueChange(value.filter((prevItem) => prevItem.id !==
|
|
19488
|
+
onValueChange(value.filter((prevItem) => prevItem.id !== columnFilter.id));
|
|
19731
19489
|
setEditState(void 0);
|
|
19732
19490
|
},
|
|
19733
19491
|
dataType: item.dataType,
|
|
@@ -19735,25 +19493,26 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19735
19493
|
name: item.label,
|
|
19736
19494
|
isOpen,
|
|
19737
19495
|
close: () => setIsOpen(false)
|
|
19738
|
-
})
|
|
19496
|
+
}) : /* @__PURE__ */ jsx96(
|
|
19739
19497
|
FilterPopUp,
|
|
19740
19498
|
{
|
|
19741
19499
|
name: item.label,
|
|
19742
|
-
value: editState?.id ===
|
|
19500
|
+
value: editState?.id === columnFilter.id ? editState.value : columnFilter.value,
|
|
19743
19501
|
dataType: item.dataType,
|
|
19744
19502
|
tags: item.tags,
|
|
19745
19503
|
onValueChange: (value2) => {
|
|
19746
|
-
setEditState({ ...
|
|
19504
|
+
setEditState({ ...columnFilter, value: value2 });
|
|
19747
19505
|
},
|
|
19748
19506
|
onRemove: () => {
|
|
19749
|
-
onValueChange(value.filter((prevItem) => prevItem.id !==
|
|
19507
|
+
onValueChange(value.filter((prevItem) => prevItem.id !== columnFilter.id));
|
|
19750
19508
|
setEditState(void 0);
|
|
19751
|
-
}
|
|
19509
|
+
},
|
|
19510
|
+
onClose: () => setIsOpen(false)
|
|
19752
19511
|
}
|
|
19753
|
-
)
|
|
19512
|
+
) })
|
|
19754
19513
|
]
|
|
19755
19514
|
},
|
|
19756
|
-
|
|
19515
|
+
columnFilter.id
|
|
19757
19516
|
);
|
|
19758
19517
|
})
|
|
19759
19518
|
] });
|
|
@@ -19800,12 +19559,77 @@ var TimeDisplay = ({
|
|
|
19800
19559
|
return /* @__PURE__ */ jsx97("span", { children: fullString });
|
|
19801
19560
|
};
|
|
19802
19561
|
|
|
19562
|
+
// src/components/user-interaction/input/FlexibleDateTimeInput.tsx
|
|
19563
|
+
import { forwardRef as forwardRef30, useMemo as useMemo41, useState as useState40 } from "react";
|
|
19564
|
+
import { ClockFading, ClockPlus } from "lucide-react";
|
|
19565
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
19566
|
+
var FlexibleDateTimeInput = forwardRef30(function FlexibleDateTimeInput2({
|
|
19567
|
+
defaultMode = "date",
|
|
19568
|
+
value: controlledValue,
|
|
19569
|
+
initialValue,
|
|
19570
|
+
onValueChange,
|
|
19571
|
+
fixedTime: fixedTimeOverride,
|
|
19572
|
+
actions = [],
|
|
19573
|
+
...props
|
|
19574
|
+
}, forwardedRef) {
|
|
19575
|
+
const translation = useHightideTranslation();
|
|
19576
|
+
const [value, setValue] = useControlledState({
|
|
19577
|
+
value: controlledValue,
|
|
19578
|
+
onValueChange,
|
|
19579
|
+
defaultValue: initialValue
|
|
19580
|
+
});
|
|
19581
|
+
const fixedTime = useMemo41(() => fixedTimeOverride ?? new Date(23, 59, 59, 999), [fixedTimeOverride]);
|
|
19582
|
+
const [preferredMode, setPreferredMode] = useState40(defaultMode);
|
|
19583
|
+
const mode = useMemo41(() => {
|
|
19584
|
+
if (!value) return preferredMode;
|
|
19585
|
+
if (DateUtils.sameTime(value, fixedTime, true, true)) {
|
|
19586
|
+
return "date";
|
|
19587
|
+
}
|
|
19588
|
+
return "dateTime";
|
|
19589
|
+
}, [preferredMode, value, fixedTime]);
|
|
19590
|
+
return /* @__PURE__ */ jsx98(
|
|
19591
|
+
DateTimeInput,
|
|
19592
|
+
{
|
|
19593
|
+
...props,
|
|
19594
|
+
ref: forwardedRef,
|
|
19595
|
+
mode,
|
|
19596
|
+
value,
|
|
19597
|
+
onValueChange: setValue,
|
|
19598
|
+
actions: [
|
|
19599
|
+
...actions,
|
|
19600
|
+
/* @__PURE__ */ jsx98(
|
|
19601
|
+
IconButton,
|
|
19602
|
+
{
|
|
19603
|
+
size: "sm",
|
|
19604
|
+
coloringStyle: "text",
|
|
19605
|
+
color: "neutral",
|
|
19606
|
+
tooltip: preferredMode === "date" ? translation("addTime") : translation("withoutTime"),
|
|
19607
|
+
onClick: () => {
|
|
19608
|
+
const newMode = preferredMode === "date" ? "dateTime" : "date";
|
|
19609
|
+
setPreferredMode((prev) => prev === "date" ? "dateTime" : "date");
|
|
19610
|
+
if (value) {
|
|
19611
|
+
if (newMode === "date") {
|
|
19612
|
+
setValue(DateUtils.withTime(value, fixedTime));
|
|
19613
|
+
} else {
|
|
19614
|
+
setValue(DateUtils.isLastMillisecondOfDay(value) ? new Date(value.getTime() - 1) : new Date(value.getTime() + 1));
|
|
19615
|
+
}
|
|
19616
|
+
}
|
|
19617
|
+
},
|
|
19618
|
+
children: preferredMode === "date" ? /* @__PURE__ */ jsx98(ClockPlus, { className: "size-5" }) : /* @__PURE__ */ jsx98(ClockFading, { className: "size-5" })
|
|
19619
|
+
},
|
|
19620
|
+
"date-mode"
|
|
19621
|
+
)
|
|
19622
|
+
]
|
|
19623
|
+
}
|
|
19624
|
+
);
|
|
19625
|
+
});
|
|
19626
|
+
|
|
19803
19627
|
// src/components/user-interaction/input/InsideLabelInput.tsx
|
|
19804
19628
|
import { useId as useId23 } from "react";
|
|
19805
|
-
import { forwardRef as
|
|
19629
|
+
import { forwardRef as forwardRef31, useState as useState41 } from "react";
|
|
19806
19630
|
import clsx37 from "clsx";
|
|
19807
|
-
import { jsx as
|
|
19808
|
-
var InsideLabelInput =
|
|
19631
|
+
import { jsx as jsx99, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
19632
|
+
var InsideLabelInput = forwardRef31(function InsideLabelInput2({
|
|
19809
19633
|
id: customId,
|
|
19810
19634
|
value: controlledValue,
|
|
19811
19635
|
initialValue,
|
|
@@ -19818,11 +19642,11 @@ var InsideLabelInput = forwardRef30(function InsideLabelInput2({
|
|
|
19818
19642
|
onValueChange,
|
|
19819
19643
|
defaultValue: initialValue
|
|
19820
19644
|
});
|
|
19821
|
-
const [isFocused, setIsFocused] =
|
|
19645
|
+
const [isFocused, setIsFocused] = useState41(false);
|
|
19822
19646
|
const generatedId = useId23();
|
|
19823
19647
|
const id = customId ?? generatedId;
|
|
19824
19648
|
return /* @__PURE__ */ jsxs61("div", { className: clsx37("relative"), children: [
|
|
19825
|
-
/* @__PURE__ */
|
|
19649
|
+
/* @__PURE__ */ jsx99(
|
|
19826
19650
|
Input,
|
|
19827
19651
|
{
|
|
19828
19652
|
...props,
|
|
@@ -19842,7 +19666,7 @@ var InsideLabelInput = forwardRef30(function InsideLabelInput2({
|
|
|
19842
19666
|
className: clsx37("h-14 px-4 pb-2 py-6.5", props.className)
|
|
19843
19667
|
}
|
|
19844
19668
|
),
|
|
19845
|
-
/* @__PURE__ */
|
|
19669
|
+
/* @__PURE__ */ jsx99(
|
|
19846
19670
|
"label",
|
|
19847
19671
|
{
|
|
19848
19672
|
id: id + "-label",
|
|
@@ -19863,7 +19687,7 @@ var InsideLabelInput = forwardRef30(function InsideLabelInput2({
|
|
|
19863
19687
|
// src/components/user-interaction/input/SearchBar.tsx
|
|
19864
19688
|
import { Search } from "lucide-react";
|
|
19865
19689
|
import { clsx as clsx38 } from "clsx";
|
|
19866
|
-
import { jsx as
|
|
19690
|
+
import { jsx as jsx100, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
19867
19691
|
var SearchBar = ({
|
|
19868
19692
|
value: controlledValue,
|
|
19869
19693
|
initialValue,
|
|
@@ -19880,7 +19704,7 @@ var SearchBar = ({
|
|
|
19880
19704
|
defaultValue: initialValue
|
|
19881
19705
|
});
|
|
19882
19706
|
return /* @__PURE__ */ jsxs62("div", { ...containerProps, className: clsx38("relative", containerProps?.className), children: [
|
|
19883
|
-
/* @__PURE__ */
|
|
19707
|
+
/* @__PURE__ */ jsx100(
|
|
19884
19708
|
Input,
|
|
19885
19709
|
{
|
|
19886
19710
|
...inputProps,
|
|
@@ -19891,7 +19715,7 @@ var SearchBar = ({
|
|
|
19891
19715
|
className: clsx38("pr-10 w-full", inputProps.className)
|
|
19892
19716
|
}
|
|
19893
19717
|
),
|
|
19894
|
-
/* @__PURE__ */
|
|
19718
|
+
/* @__PURE__ */ jsx100(
|
|
19895
19719
|
IconButton,
|
|
19896
19720
|
{
|
|
19897
19721
|
...searchButtonProps,
|
|
@@ -19901,18 +19725,18 @@ var SearchBar = ({
|
|
|
19901
19725
|
coloringStyle: "text",
|
|
19902
19726
|
onClick: () => onSearch(value),
|
|
19903
19727
|
className: clsx38("absolute right-1.5 top-1/2 -translate-y-1/2", searchButtonProps?.className),
|
|
19904
|
-
children: /* @__PURE__ */
|
|
19728
|
+
children: /* @__PURE__ */ jsx100(Search, { className: "w-full h-full" })
|
|
19905
19729
|
}
|
|
19906
19730
|
)
|
|
19907
19731
|
] });
|
|
19908
19732
|
};
|
|
19909
19733
|
|
|
19910
19734
|
// src/components/user-interaction/input/ToggleableInput.tsx
|
|
19911
|
-
import { forwardRef as
|
|
19735
|
+
import { forwardRef as forwardRef32, useEffect as useEffect48, useImperativeHandle as useImperativeHandle16, useRef as useRef40, useState as useState42 } from "react";
|
|
19912
19736
|
import { Pencil } from "lucide-react";
|
|
19913
19737
|
import clsx39 from "clsx";
|
|
19914
|
-
import { jsx as
|
|
19915
|
-
var ToggleableInput =
|
|
19738
|
+
import { jsx as jsx101, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
19739
|
+
var ToggleableInput = forwardRef32(function ToggleableInput2({
|
|
19916
19740
|
value: controlledValue,
|
|
19917
19741
|
initialValue,
|
|
19918
19742
|
onValueChange,
|
|
@@ -19925,16 +19749,16 @@ var ToggleableInput = forwardRef31(function ToggleableInput2({
|
|
|
19925
19749
|
onValueChange,
|
|
19926
19750
|
defaultValue: initialValue
|
|
19927
19751
|
});
|
|
19928
|
-
const [isEditing, setIsEditing] =
|
|
19929
|
-
const innerRef =
|
|
19752
|
+
const [isEditing, setIsEditing] = useState42(initialState !== "display");
|
|
19753
|
+
const innerRef = useRef40(null);
|
|
19930
19754
|
useImperativeHandle16(forwardedRef, () => innerRef.current);
|
|
19931
|
-
|
|
19755
|
+
useEffect48(() => {
|
|
19932
19756
|
if (isEditing) {
|
|
19933
19757
|
innerRef.current?.focus();
|
|
19934
19758
|
}
|
|
19935
19759
|
}, [isEditing]);
|
|
19936
19760
|
return /* @__PURE__ */ jsxs63("div", { className: clsx39("relative flex-row-2", { "flex-1": isEditing }), children: [
|
|
19937
|
-
/* @__PURE__ */
|
|
19761
|
+
/* @__PURE__ */ jsx101(
|
|
19938
19762
|
Input,
|
|
19939
19763
|
{
|
|
19940
19764
|
...props,
|
|
@@ -19959,8 +19783,8 @@ var ToggleableInput = forwardRef31(function ToggleableInput2({
|
|
|
19959
19783
|
}
|
|
19960
19784
|
),
|
|
19961
19785
|
!isEditing && /* @__PURE__ */ jsxs63("div", { className: "absolute left-0 flex-row-2 items-center pointer-events-none touch-none w-full overflow-hidden", children: [
|
|
19962
|
-
/* @__PURE__ */
|
|
19963
|
-
/* @__PURE__ */
|
|
19786
|
+
/* @__PURE__ */ jsx101("span", { className: clsx39(" truncate"), children: value }),
|
|
19787
|
+
/* @__PURE__ */ jsx101(Pencil, { className: clsx39(`size-force-4`, { "text-transparent": isEditing }) })
|
|
19964
19788
|
] })
|
|
19965
19789
|
] });
|
|
19966
19790
|
});
|
|
@@ -19971,7 +19795,7 @@ import { Check as Check4 } from "lucide-react";
|
|
|
19971
19795
|
// src/components/user-interaction/properties/PropertyBase.tsx
|
|
19972
19796
|
import clsx40 from "clsx";
|
|
19973
19797
|
import { AlertTriangle, Trash, X as X3 } from "lucide-react";
|
|
19974
|
-
import { jsx as
|
|
19798
|
+
import { jsx as jsx102, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
19975
19799
|
var PropertyBase = ({
|
|
19976
19800
|
name,
|
|
19977
19801
|
children,
|
|
@@ -20003,11 +19827,11 @@ var PropertyBase = ({
|
|
|
20003
19827
|
"data-name": "property-title",
|
|
20004
19828
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20005
19829
|
children: [
|
|
20006
|
-
/* @__PURE__ */
|
|
20007
|
-
/* @__PURE__ */
|
|
20008
|
-
/* @__PURE__ */
|
|
19830
|
+
/* @__PURE__ */ jsx102(Tooltip, { tooltip: name, containerClassName: "min-w-0", children: /* @__PURE__ */ jsxs64("div", { className: "flex-row-1 items-center", children: [
|
|
19831
|
+
/* @__PURE__ */ jsx102("div", { "data-name": "property-title-icon", children: icon }),
|
|
19832
|
+
/* @__PURE__ */ jsx102("span", { "data-name": "property-title-text", children: name })
|
|
20009
19833
|
] }) }),
|
|
20010
|
-
invalid && /* @__PURE__ */
|
|
19834
|
+
invalid && /* @__PURE__ */ jsx102(AlertTriangle, { className: "size-force-6" })
|
|
20011
19835
|
]
|
|
20012
19836
|
}
|
|
20013
19837
|
),
|
|
@@ -20019,7 +19843,7 @@ var PropertyBase = ({
|
|
|
20019
19843
|
children: [
|
|
20020
19844
|
children({ required, hasValue, invalid }),
|
|
20021
19845
|
showActionsContainer && /* @__PURE__ */ jsxs64("div", { "data-name": "property-actions", children: [
|
|
20022
|
-
isClearEnabled && /* @__PURE__ */
|
|
19846
|
+
isClearEnabled && /* @__PURE__ */ jsx102(
|
|
20023
19847
|
IconButton,
|
|
20024
19848
|
{
|
|
20025
19849
|
tooltip: translation("clearValue"),
|
|
@@ -20028,10 +19852,10 @@ var PropertyBase = ({
|
|
|
20028
19852
|
color: "negative",
|
|
20029
19853
|
coloringStyle: "text",
|
|
20030
19854
|
size: "sm",
|
|
20031
|
-
children: /* @__PURE__ */
|
|
19855
|
+
children: /* @__PURE__ */ jsx102(X3, { className: "size-force-5" })
|
|
20032
19856
|
}
|
|
20033
19857
|
),
|
|
20034
|
-
isRemoveEnabled && /* @__PURE__ */
|
|
19858
|
+
isRemoveEnabled && /* @__PURE__ */ jsx102(
|
|
20035
19859
|
IconButton,
|
|
20036
19860
|
{
|
|
20037
19861
|
tooltip: translation("removeProperty"),
|
|
@@ -20039,7 +19863,7 @@ var PropertyBase = ({
|
|
|
20039
19863
|
color: "negative",
|
|
20040
19864
|
coloringStyle: "text",
|
|
20041
19865
|
size: "sm",
|
|
20042
|
-
children: /* @__PURE__ */
|
|
19866
|
+
children: /* @__PURE__ */ jsx102(Trash, { className: "size-force-5" })
|
|
20043
19867
|
}
|
|
20044
19868
|
)
|
|
20045
19869
|
] })
|
|
@@ -20052,7 +19876,7 @@ var PropertyBase = ({
|
|
|
20052
19876
|
};
|
|
20053
19877
|
|
|
20054
19878
|
// src/components/user-interaction/properties/CheckboxProperty.tsx
|
|
20055
|
-
import { jsx as
|
|
19879
|
+
import { jsx as jsx103, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
20056
19880
|
var CheckboxProperty = ({
|
|
20057
19881
|
value,
|
|
20058
19882
|
onValueChange,
|
|
@@ -20061,15 +19885,15 @@ var CheckboxProperty = ({
|
|
|
20061
19885
|
...baseProps
|
|
20062
19886
|
}) => {
|
|
20063
19887
|
const translation = useHightideTranslation();
|
|
20064
|
-
return /* @__PURE__ */
|
|
19888
|
+
return /* @__PURE__ */ jsx103(
|
|
20065
19889
|
PropertyBase,
|
|
20066
19890
|
{
|
|
20067
19891
|
...baseProps,
|
|
20068
19892
|
hasValue: value !== void 0,
|
|
20069
19893
|
readOnly,
|
|
20070
|
-
icon: /* @__PURE__ */
|
|
19894
|
+
icon: /* @__PURE__ */ jsx103(Check4, { size: 24 }),
|
|
20071
19895
|
children: () => /* @__PURE__ */ jsxs65("div", { className: "flex-row-2 items-center", children: [
|
|
20072
|
-
/* @__PURE__ */
|
|
19896
|
+
/* @__PURE__ */ jsx103(
|
|
20073
19897
|
Button,
|
|
20074
19898
|
{
|
|
20075
19899
|
color: value ? "positive" : "neutral",
|
|
@@ -20082,7 +19906,7 @@ var CheckboxProperty = ({
|
|
|
20082
19906
|
children: translation("yes")
|
|
20083
19907
|
}
|
|
20084
19908
|
),
|
|
20085
|
-
/* @__PURE__ */
|
|
19909
|
+
/* @__PURE__ */ jsx103(
|
|
20086
19910
|
Button,
|
|
20087
19911
|
{
|
|
20088
19912
|
color: !value && value !== void 0 ? "negative" : "neutral",
|
|
@@ -20102,7 +19926,7 @@ var CheckboxProperty = ({
|
|
|
20102
19926
|
|
|
20103
19927
|
// src/components/user-interaction/properties/DateProperty.tsx
|
|
20104
19928
|
import { CalendarDays } from "lucide-react";
|
|
20105
|
-
import { jsx as
|
|
19929
|
+
import { jsx as jsx104 } from "react/jsx-runtime";
|
|
20106
19930
|
var DateProperty = ({
|
|
20107
19931
|
value,
|
|
20108
19932
|
onValueChange,
|
|
@@ -20112,13 +19936,13 @@ var DateProperty = ({
|
|
|
20112
19936
|
...baseProps
|
|
20113
19937
|
}) => {
|
|
20114
19938
|
const hasValue = !!value;
|
|
20115
|
-
return /* @__PURE__ */
|
|
19939
|
+
return /* @__PURE__ */ jsx104(
|
|
20116
19940
|
PropertyBase,
|
|
20117
19941
|
{
|
|
20118
19942
|
...baseProps,
|
|
20119
19943
|
hasValue,
|
|
20120
|
-
icon: /* @__PURE__ */
|
|
20121
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
19944
|
+
icon: /* @__PURE__ */ jsx104(CalendarDays, { size: 24 }),
|
|
19945
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx104(
|
|
20122
19946
|
DateTimeInput,
|
|
20123
19947
|
{
|
|
20124
19948
|
value,
|
|
@@ -20136,7 +19960,7 @@ var DateProperty = ({
|
|
|
20136
19960
|
|
|
20137
19961
|
// src/components/user-interaction/properties/MultiSelectProperty.tsx
|
|
20138
19962
|
import { List } from "lucide-react";
|
|
20139
|
-
import { jsx as
|
|
19963
|
+
import { jsx as jsx105 } from "react/jsx-runtime";
|
|
20140
19964
|
var MultiSelectProperty = ({
|
|
20141
19965
|
children,
|
|
20142
19966
|
value,
|
|
@@ -20145,18 +19969,18 @@ var MultiSelectProperty = ({
|
|
|
20145
19969
|
...props
|
|
20146
19970
|
}) => {
|
|
20147
19971
|
const hasValue = value.length > 0;
|
|
20148
|
-
return /* @__PURE__ */
|
|
19972
|
+
return /* @__PURE__ */ jsx105(
|
|
20149
19973
|
PropertyBase,
|
|
20150
19974
|
{
|
|
20151
19975
|
...props,
|
|
20152
19976
|
hasValue,
|
|
20153
|
-
icon: /* @__PURE__ */
|
|
20154
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
19977
|
+
icon: /* @__PURE__ */ jsx105(List, { size: 24 }),
|
|
19978
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx105(
|
|
20155
19979
|
"div",
|
|
20156
19980
|
{
|
|
20157
19981
|
"data-name": "property-input-wrapper",
|
|
20158
19982
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20159
|
-
children: /* @__PURE__ */
|
|
19983
|
+
children: /* @__PURE__ */ jsx105(
|
|
20160
19984
|
MultiSelectChipDisplay,
|
|
20161
19985
|
{
|
|
20162
19986
|
value,
|
|
@@ -20183,7 +20007,7 @@ var MultiSelectProperty = ({
|
|
|
20183
20007
|
|
|
20184
20008
|
// src/components/user-interaction/properties/NumberProperty.tsx
|
|
20185
20009
|
import { Binary as Binary2 } from "lucide-react";
|
|
20186
|
-
import { jsx as
|
|
20010
|
+
import { jsx as jsx106, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
20187
20011
|
var NumberProperty = ({
|
|
20188
20012
|
value,
|
|
20189
20013
|
onValueChange,
|
|
@@ -20195,20 +20019,20 @@ var NumberProperty = ({
|
|
|
20195
20019
|
}) => {
|
|
20196
20020
|
const translation = useHightideTranslation();
|
|
20197
20021
|
const hasValue = value !== void 0;
|
|
20198
|
-
return /* @__PURE__ */
|
|
20022
|
+
return /* @__PURE__ */ jsx106(
|
|
20199
20023
|
PropertyBase,
|
|
20200
20024
|
{
|
|
20201
20025
|
...baseProps,
|
|
20202
20026
|
onValueClear,
|
|
20203
20027
|
hasValue,
|
|
20204
|
-
icon: /* @__PURE__ */
|
|
20028
|
+
icon: /* @__PURE__ */ jsx106(Binary2, { size: 24 }),
|
|
20205
20029
|
children: ({ invalid }) => /* @__PURE__ */ jsxs66(
|
|
20206
20030
|
"div",
|
|
20207
20031
|
{
|
|
20208
20032
|
"data-name": "property-input-wrapper",
|
|
20209
20033
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20210
20034
|
children: [
|
|
20211
|
-
/* @__PURE__ */
|
|
20035
|
+
/* @__PURE__ */ jsx106(
|
|
20212
20036
|
Input,
|
|
20213
20037
|
{
|
|
20214
20038
|
"data-name": "property-input",
|
|
@@ -20236,7 +20060,7 @@ var NumberProperty = ({
|
|
|
20236
20060
|
}
|
|
20237
20061
|
}
|
|
20238
20062
|
),
|
|
20239
|
-
suffix && /* @__PURE__ */
|
|
20063
|
+
suffix && /* @__PURE__ */ jsx106(
|
|
20240
20064
|
"span",
|
|
20241
20065
|
{
|
|
20242
20066
|
"data-name": "property-suffix",
|
|
@@ -20253,7 +20077,7 @@ var NumberProperty = ({
|
|
|
20253
20077
|
|
|
20254
20078
|
// src/components/user-interaction/properties/SelectProperty.tsx
|
|
20255
20079
|
import { List as List2 } from "lucide-react";
|
|
20256
|
-
import { jsx as
|
|
20080
|
+
import { jsx as jsx107, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
20257
20081
|
var SingleSelectProperty = ({
|
|
20258
20082
|
children,
|
|
20259
20083
|
value,
|
|
@@ -20262,13 +20086,13 @@ var SingleSelectProperty = ({
|
|
|
20262
20086
|
...props
|
|
20263
20087
|
}) => {
|
|
20264
20088
|
const hasValue = value !== void 0;
|
|
20265
|
-
return /* @__PURE__ */
|
|
20089
|
+
return /* @__PURE__ */ jsx107(
|
|
20266
20090
|
PropertyBase,
|
|
20267
20091
|
{
|
|
20268
20092
|
...props,
|
|
20269
20093
|
hasValue,
|
|
20270
|
-
icon: /* @__PURE__ */
|
|
20271
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
20094
|
+
icon: /* @__PURE__ */ jsx107(List2, { size: 24 }),
|
|
20095
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx107(
|
|
20272
20096
|
"div",
|
|
20273
20097
|
{
|
|
20274
20098
|
"data-name": "property-input-wrapper",
|
|
@@ -20283,7 +20107,7 @@ var SingleSelectProperty = ({
|
|
|
20283
20107
|
},
|
|
20284
20108
|
disabled: props.readOnly,
|
|
20285
20109
|
children: [
|
|
20286
|
-
/* @__PURE__ */
|
|
20110
|
+
/* @__PURE__ */ jsx107(
|
|
20287
20111
|
SelectButton,
|
|
20288
20112
|
{
|
|
20289
20113
|
className: "flex-row-2 w-full items-center justify-between",
|
|
@@ -20291,7 +20115,7 @@ var SingleSelectProperty = ({
|
|
|
20291
20115
|
"data-name": "property-input"
|
|
20292
20116
|
}
|
|
20293
20117
|
),
|
|
20294
|
-
/* @__PURE__ */
|
|
20118
|
+
/* @__PURE__ */ jsx107(SelectContent, { children })
|
|
20295
20119
|
]
|
|
20296
20120
|
}
|
|
20297
20121
|
)
|
|
@@ -20301,99 +20125,382 @@ var SingleSelectProperty = ({
|
|
|
20301
20125
|
);
|
|
20302
20126
|
};
|
|
20303
20127
|
|
|
20304
|
-
// src/components/user-interaction/properties/TextProperty.tsx
|
|
20305
|
-
import { Text } from "lucide-react";
|
|
20306
|
-
import { jsx as
|
|
20307
|
-
var TextProperty = ({
|
|
20308
|
-
value,
|
|
20309
|
-
readOnly,
|
|
20310
|
-
onValueChange,
|
|
20311
|
-
onEditComplete,
|
|
20312
|
-
...baseProps
|
|
20313
|
-
}) => {
|
|
20314
|
-
const translation = useHightideTranslation();
|
|
20315
|
-
const hasValue = value !== void 0;
|
|
20316
|
-
return /* @__PURE__ */
|
|
20317
|
-
PropertyBase,
|
|
20318
|
-
{
|
|
20319
|
-
...baseProps,
|
|
20320
|
-
hasValue,
|
|
20321
|
-
icon: /* @__PURE__ */
|
|
20322
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
20323
|
-
Textarea,
|
|
20324
|
-
{
|
|
20325
|
-
"data-name": "property-input",
|
|
20326
|
-
className: "w-full",
|
|
20327
|
-
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20328
|
-
rows: 5,
|
|
20329
|
-
value: value ?? "",
|
|
20330
|
-
readOnly,
|
|
20331
|
-
placeholder: translation("text"),
|
|
20332
|
-
onValueChange: (value2) => onValueChange?.(value2),
|
|
20333
|
-
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
20334
|
-
}
|
|
20335
|
-
)
|
|
20128
|
+
// src/components/user-interaction/properties/TextProperty.tsx
|
|
20129
|
+
import { Text } from "lucide-react";
|
|
20130
|
+
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
20131
|
+
var TextProperty = ({
|
|
20132
|
+
value,
|
|
20133
|
+
readOnly,
|
|
20134
|
+
onValueChange,
|
|
20135
|
+
onEditComplete,
|
|
20136
|
+
...baseProps
|
|
20137
|
+
}) => {
|
|
20138
|
+
const translation = useHightideTranslation();
|
|
20139
|
+
const hasValue = value !== void 0;
|
|
20140
|
+
return /* @__PURE__ */ jsx108(
|
|
20141
|
+
PropertyBase,
|
|
20142
|
+
{
|
|
20143
|
+
...baseProps,
|
|
20144
|
+
hasValue,
|
|
20145
|
+
icon: /* @__PURE__ */ jsx108(Text, { size: 24 }),
|
|
20146
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx108(
|
|
20147
|
+
Textarea,
|
|
20148
|
+
{
|
|
20149
|
+
"data-name": "property-input",
|
|
20150
|
+
className: "w-full",
|
|
20151
|
+
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20152
|
+
rows: 5,
|
|
20153
|
+
value: value ?? "",
|
|
20154
|
+
readOnly,
|
|
20155
|
+
placeholder: translation("text"),
|
|
20156
|
+
onValueChange: (value2) => onValueChange?.(value2),
|
|
20157
|
+
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
20158
|
+
}
|
|
20159
|
+
)
|
|
20160
|
+
}
|
|
20161
|
+
);
|
|
20162
|
+
};
|
|
20163
|
+
|
|
20164
|
+
// src/components/utils/Polymorphic.tsx
|
|
20165
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
20166
|
+
import { forwardRef as forwardRef33 } from "react";
|
|
20167
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
20168
|
+
var PolymorphicSlot = forwardRef33(function PolymorphicSlot2({
|
|
20169
|
+
children,
|
|
20170
|
+
asChild,
|
|
20171
|
+
defaultComponent = "div",
|
|
20172
|
+
...props
|
|
20173
|
+
}, ref) {
|
|
20174
|
+
const Component = asChild ? Slot : defaultComponent;
|
|
20175
|
+
return /* @__PURE__ */ jsx109(Component, { ...props, ref, children });
|
|
20176
|
+
});
|
|
20177
|
+
|
|
20178
|
+
// src/components/utils/Transition.tsx
|
|
20179
|
+
import { useEffect as useEffect49, useState as useState43 } from "react";
|
|
20180
|
+
function Transition({
|
|
20181
|
+
children,
|
|
20182
|
+
show,
|
|
20183
|
+
includeAnimation = true
|
|
20184
|
+
}) {
|
|
20185
|
+
const [isOpen, setIsOpen] = useState43(show);
|
|
20186
|
+
const [isTransitioning, setIsTransitioning] = useState43(!isOpen);
|
|
20187
|
+
const isUsingReducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : true;
|
|
20188
|
+
useEffect49(() => {
|
|
20189
|
+
setIsOpen(show);
|
|
20190
|
+
setIsTransitioning(true);
|
|
20191
|
+
}, [show]);
|
|
20192
|
+
const onAnimationEnd = () => setIsTransitioning(false);
|
|
20193
|
+
const bag = {
|
|
20194
|
+
isOpen,
|
|
20195
|
+
isTransitioning,
|
|
20196
|
+
isUsingReducedMotion,
|
|
20197
|
+
data: {
|
|
20198
|
+
"data-open": isOpen && !isTransitioning ? "" : void 0,
|
|
20199
|
+
"data-opening": isOpen && isTransitioning ? "" : void 0,
|
|
20200
|
+
"data-closing": !isOpen && isTransitioning ? "" : void 0,
|
|
20201
|
+
"data-closed": !isOpen && !isTransitioning ? "" : void 0
|
|
20202
|
+
},
|
|
20203
|
+
handlers: {
|
|
20204
|
+
onTransitionEnd: () => setIsTransitioning(false),
|
|
20205
|
+
onTransitionCancel: () => setIsTransitioning(false),
|
|
20206
|
+
onAnimationEnd: includeAnimation ? onAnimationEnd : void 0
|
|
20207
|
+
}
|
|
20208
|
+
};
|
|
20209
|
+
return BagFunctionUtil.resolve(children, bag);
|
|
20210
|
+
}
|
|
20211
|
+
|
|
20212
|
+
// src/global-contexts/HightideProvider.tsx
|
|
20213
|
+
import { jsx as jsx110 } from "react/jsx-runtime";
|
|
20214
|
+
var HightideProvider = ({
|
|
20215
|
+
children,
|
|
20216
|
+
theme,
|
|
20217
|
+
locale,
|
|
20218
|
+
config
|
|
20219
|
+
}) => {
|
|
20220
|
+
return /* @__PURE__ */ jsx110(LocaleProvider, { ...locale, children: /* @__PURE__ */ jsx110(ThemeProvider, { ...theme, children: /* @__PURE__ */ jsx110(HightideConfigProvider, { ...config, children }) }) });
|
|
20221
|
+
};
|
|
20222
|
+
|
|
20223
|
+
// src/hooks/focus/useFocusGuards.ts
|
|
20224
|
+
import { useEffect as useEffect50 } from "react";
|
|
20225
|
+
var selectorName = "data-hw-focus-guard";
|
|
20226
|
+
function FocusGuard() {
|
|
20227
|
+
const element = document.createElement("div");
|
|
20228
|
+
element.setAttribute(selectorName, "");
|
|
20229
|
+
element.tabIndex = 0;
|
|
20230
|
+
element.style.border = "none";
|
|
20231
|
+
element.style.outline = "none";
|
|
20232
|
+
element.style.boxShadow = "none";
|
|
20233
|
+
element.style.opacity = "0";
|
|
20234
|
+
element.style.position = "fixed";
|
|
20235
|
+
element.style.pointerEvents = "none";
|
|
20236
|
+
return element;
|
|
20237
|
+
}
|
|
20238
|
+
var FocusGuardsService = class _FocusGuardsService {
|
|
20239
|
+
constructor() {
|
|
20240
|
+
this.count = 0;
|
|
20241
|
+
}
|
|
20242
|
+
static getInstance() {
|
|
20243
|
+
if (!_FocusGuardsService.instance) {
|
|
20244
|
+
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
20245
|
+
}
|
|
20246
|
+
return _FocusGuardsService.instance;
|
|
20247
|
+
}
|
|
20248
|
+
add() {
|
|
20249
|
+
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
20250
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
20251
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
20252
|
+
this.count++;
|
|
20253
|
+
}
|
|
20254
|
+
remove() {
|
|
20255
|
+
if (this.count === 1) {
|
|
20256
|
+
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
20257
|
+
}
|
|
20258
|
+
this.count--;
|
|
20259
|
+
}
|
|
20260
|
+
};
|
|
20261
|
+
var useFocusGuards = () => {
|
|
20262
|
+
useEffect50(() => {
|
|
20263
|
+
FocusGuardsService.getInstance().add();
|
|
20264
|
+
return () => {
|
|
20265
|
+
FocusGuardsService.getInstance().remove();
|
|
20266
|
+
};
|
|
20267
|
+
}, []);
|
|
20268
|
+
};
|
|
20269
|
+
|
|
20270
|
+
// src/hooks/focus/useFocusOnceVisible.ts
|
|
20271
|
+
import React5, { useEffect as useEffect51 } from "react";
|
|
20272
|
+
var useFocusOnceVisible = (ref, disable = false) => {
|
|
20273
|
+
const [hasUsedFocus, setHasUsedFocus] = React5.useState(false);
|
|
20274
|
+
useEffect51(() => {
|
|
20275
|
+
if (disable || hasUsedFocus) {
|
|
20276
|
+
return;
|
|
20277
|
+
}
|
|
20278
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
20279
|
+
if (entry.isIntersecting && !hasUsedFocus) {
|
|
20280
|
+
ref.current?.focus();
|
|
20281
|
+
setHasUsedFocus(hasUsedFocus);
|
|
20282
|
+
}
|
|
20283
|
+
}, {
|
|
20284
|
+
threshold: 0.1
|
|
20285
|
+
});
|
|
20286
|
+
if (ref.current) {
|
|
20287
|
+
observer.observe(ref.current);
|
|
20288
|
+
}
|
|
20289
|
+
return () => observer.disconnect();
|
|
20290
|
+
}, [disable, hasUsedFocus, ref]);
|
|
20291
|
+
};
|
|
20292
|
+
|
|
20293
|
+
// src/hooks/focus/useIsMounted.ts
|
|
20294
|
+
import { useEffect as useEffect52, useLayoutEffect as useLayoutEffect7, useState as useState44 } from "react";
|
|
20295
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
20296
|
+
var useIsomorphicEffect = isClient ? useLayoutEffect7 : useEffect52;
|
|
20297
|
+
var useIsMounted = () => {
|
|
20298
|
+
const [isMounted, setIsMounted] = useState44(false);
|
|
20299
|
+
useIsomorphicEffect(() => {
|
|
20300
|
+
setIsMounted(true);
|
|
20301
|
+
return () => {
|
|
20302
|
+
setIsMounted(false);
|
|
20303
|
+
};
|
|
20304
|
+
}, []);
|
|
20305
|
+
return isMounted;
|
|
20306
|
+
};
|
|
20307
|
+
|
|
20308
|
+
// src/hooks/useHandleRefs.ts
|
|
20309
|
+
import { useEffect as useEffect53, useRef as useRef41 } from "react";
|
|
20310
|
+
function useHandleRefs(handleRef) {
|
|
20311
|
+
const refs = useRef41([]);
|
|
20312
|
+
useEffect53(() => {
|
|
20313
|
+
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
20314
|
+
() => ({ current: null })
|
|
20315
|
+
);
|
|
20316
|
+
const values = Object.values(handleRef?.current ?? {});
|
|
20317
|
+
values.forEach((el, i) => {
|
|
20318
|
+
refs.current[i].current = el;
|
|
20319
|
+
});
|
|
20320
|
+
});
|
|
20321
|
+
return refs.current;
|
|
20322
|
+
}
|
|
20323
|
+
|
|
20324
|
+
// src/hooks/useLogUnstableDependencies.ts
|
|
20325
|
+
import React6 from "react";
|
|
20326
|
+
function useLogUnstableDependencies(name, value) {
|
|
20327
|
+
const prev = React6.useRef(null);
|
|
20328
|
+
React6.useEffect(() => {
|
|
20329
|
+
if (!prev.current) {
|
|
20330
|
+
prev.current = value;
|
|
20331
|
+
return;
|
|
20336
20332
|
}
|
|
20337
|
-
|
|
20333
|
+
const changes = {};
|
|
20334
|
+
for (const key of Object.keys(value)) {
|
|
20335
|
+
if (prev.current[key] !== value[key]) {
|
|
20336
|
+
changes[key] = {
|
|
20337
|
+
prev: prev.current[key],
|
|
20338
|
+
next: value[key]
|
|
20339
|
+
};
|
|
20340
|
+
}
|
|
20341
|
+
}
|
|
20342
|
+
if (Object.keys(changes).length > 0) {
|
|
20343
|
+
console.info(`[${name}] changed`, changes);
|
|
20344
|
+
}
|
|
20345
|
+
prev.current = value;
|
|
20346
|
+
});
|
|
20347
|
+
}
|
|
20348
|
+
|
|
20349
|
+
// src/hooks/useOverwritableState.ts
|
|
20350
|
+
import { useEffect as useEffect54, useState as useState45 } from "react";
|
|
20351
|
+
var useOverwritableState = (overwriteValue, onChange) => {
|
|
20352
|
+
const [state, setState] = useState45(overwriteValue);
|
|
20353
|
+
useEffect54(() => {
|
|
20354
|
+
setState(overwriteValue);
|
|
20355
|
+
}, [overwriteValue]);
|
|
20356
|
+
const onChangeWrapper = (action) => {
|
|
20357
|
+
const resolved = resolveSetState(action, state);
|
|
20358
|
+
setState(resolved);
|
|
20359
|
+
onChange?.(resolved);
|
|
20360
|
+
};
|
|
20361
|
+
return [state, onChangeWrapper];
|
|
20338
20362
|
};
|
|
20339
20363
|
|
|
20340
|
-
// src/
|
|
20341
|
-
import {
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
children,
|
|
20346
|
-
asChild,
|
|
20347
|
-
defaultComponent = "div",
|
|
20348
|
-
...props
|
|
20349
|
-
}, ref) {
|
|
20350
|
-
const Component = asChild ? Slot : defaultComponent;
|
|
20351
|
-
return /* @__PURE__ */ jsx108(Component, { ...props, ref, children });
|
|
20352
|
-
});
|
|
20364
|
+
// src/hooks/useRerender.ts
|
|
20365
|
+
import { useReducer as useReducer2 } from "react";
|
|
20366
|
+
var useRerender = () => {
|
|
20367
|
+
return useReducer2(() => ({}), {})[1];
|
|
20368
|
+
};
|
|
20353
20369
|
|
|
20354
|
-
// src/
|
|
20355
|
-
import { useEffect as useEffect55, useState as
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20370
|
+
// src/hooks/useUpdatingDateString.ts
|
|
20371
|
+
import { useEffect as useEffect55, useState as useState46 } from "react";
|
|
20372
|
+
var useUpdatingDateString = ({ absoluteFormat = "dateTime", localeOverride, date }) => {
|
|
20373
|
+
const { locale: contextLocale } = useLocale();
|
|
20374
|
+
const locale = localeOverride ?? contextLocale;
|
|
20375
|
+
const [dateAndTimeStrings, setDateAndTimeStrings] = useState46({
|
|
20376
|
+
compareDate: date,
|
|
20377
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20378
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20379
|
+
});
|
|
20364
20380
|
useEffect55(() => {
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20381
|
+
setDateAndTimeStrings({
|
|
20382
|
+
compareDate: date,
|
|
20383
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20384
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20385
|
+
});
|
|
20386
|
+
}, [date, absoluteFormat, locale]);
|
|
20387
|
+
useEffect55(() => {
|
|
20388
|
+
let timeoutId;
|
|
20389
|
+
const startTimer = () => {
|
|
20390
|
+
const now = /* @__PURE__ */ new Date();
|
|
20391
|
+
const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
|
|
20392
|
+
let delayInSeconds;
|
|
20393
|
+
if (diff < DateUtils.timesInSeconds.minute) {
|
|
20394
|
+
delayInSeconds = DateUtils.timesInSeconds.second;
|
|
20395
|
+
} else if (diff < DateUtils.timesInSeconds.hour) {
|
|
20396
|
+
delayInSeconds = DateUtils.timesInSeconds.minute;
|
|
20397
|
+
} else {
|
|
20398
|
+
delayInSeconds = DateUtils.timesInSeconds.hour;
|
|
20399
|
+
}
|
|
20400
|
+
timeoutId = setInterval(() => {
|
|
20401
|
+
setDateAndTimeStrings({
|
|
20402
|
+
compareDate: date,
|
|
20403
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20404
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20405
|
+
});
|
|
20406
|
+
}, delayInSeconds * 1e3 / 2);
|
|
20407
|
+
};
|
|
20408
|
+
startTimer();
|
|
20409
|
+
return () => clearInterval(timeoutId);
|
|
20410
|
+
}, [absoluteFormat, date, locale]);
|
|
20411
|
+
return {
|
|
20412
|
+
absolute: dateAndTimeStrings.absolute,
|
|
20413
|
+
relative: dateAndTimeStrings.relative
|
|
20384
20414
|
};
|
|
20385
|
-
|
|
20386
|
-
}
|
|
20415
|
+
};
|
|
20387
20416
|
|
|
20388
|
-
// src/
|
|
20389
|
-
|
|
20390
|
-
|
|
20391
|
-
|
|
20392
|
-
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20417
|
+
// src/utils/emailValidation.ts
|
|
20418
|
+
var validateEmail = (email) => {
|
|
20419
|
+
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
20420
|
+
};
|
|
20421
|
+
|
|
20422
|
+
// src/hooks/useValidators.ts
|
|
20423
|
+
import { useMemo as useMemo42 } from "react";
|
|
20424
|
+
var notEmpty = (value) => {
|
|
20425
|
+
if (!value) {
|
|
20426
|
+
return "notEmpty";
|
|
20427
|
+
}
|
|
20428
|
+
};
|
|
20429
|
+
var boundsValidator = (length, bounds) => {
|
|
20430
|
+
const [min, max] = bounds;
|
|
20431
|
+
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
20432
|
+
return "range";
|
|
20433
|
+
}
|
|
20434
|
+
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
20435
|
+
return "lower";
|
|
20436
|
+
}
|
|
20437
|
+
if (max !== void 0 && length !== void 0 && length > max) {
|
|
20438
|
+
return "upper";
|
|
20439
|
+
}
|
|
20440
|
+
return "none";
|
|
20441
|
+
};
|
|
20442
|
+
var lengthValidator = (value, bounds) => {
|
|
20443
|
+
const mapping = {
|
|
20444
|
+
range: "outOfRangeString",
|
|
20445
|
+
lower: "tooShort",
|
|
20446
|
+
upper: "tooLong",
|
|
20447
|
+
none: void 0
|
|
20448
|
+
};
|
|
20449
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
20450
|
+
};
|
|
20451
|
+
var selectionValidator = (value, bounds) => {
|
|
20452
|
+
const mapping = {
|
|
20453
|
+
range: "outOfRangeSelectionItems",
|
|
20454
|
+
lower: "tooFewSelectionItems",
|
|
20455
|
+
upper: "tooManySelectionItems",
|
|
20456
|
+
none: void 0
|
|
20457
|
+
};
|
|
20458
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
20459
|
+
};
|
|
20460
|
+
var emailValidator = (value) => {
|
|
20461
|
+
if (!value || !validateEmail(value)) {
|
|
20462
|
+
return "invalidEmail";
|
|
20463
|
+
}
|
|
20464
|
+
};
|
|
20465
|
+
var UseValidators = {
|
|
20466
|
+
notEmpty,
|
|
20467
|
+
length: lengthValidator,
|
|
20468
|
+
email: emailValidator,
|
|
20469
|
+
selection: selectionValidator
|
|
20470
|
+
};
|
|
20471
|
+
var useTranslatedValidators = () => {
|
|
20472
|
+
const translation = useHightideTranslation();
|
|
20473
|
+
return useMemo42(() => ({
|
|
20474
|
+
notEmpty: (value) => {
|
|
20475
|
+
const result = notEmpty(value);
|
|
20476
|
+
if (result) {
|
|
20477
|
+
return translation(result);
|
|
20478
|
+
}
|
|
20479
|
+
},
|
|
20480
|
+
length: (value, length) => {
|
|
20481
|
+
const [min, max] = length;
|
|
20482
|
+
const result = lengthValidator(value, length);
|
|
20483
|
+
if (result) {
|
|
20484
|
+
return translation(result, { min, max });
|
|
20485
|
+
}
|
|
20486
|
+
},
|
|
20487
|
+
email: (value) => {
|
|
20488
|
+
const result = emailValidator(value ?? "");
|
|
20489
|
+
if (result) {
|
|
20490
|
+
return translation(result);
|
|
20491
|
+
}
|
|
20492
|
+
},
|
|
20493
|
+
selection: (value, length) => {
|
|
20494
|
+
const [min, max] = length;
|
|
20495
|
+
const result = selectionValidator(value, length);
|
|
20496
|
+
if (result) {
|
|
20497
|
+
return translation(
|
|
20498
|
+
result,
|
|
20499
|
+
{ min, max }
|
|
20500
|
+
);
|
|
20501
|
+
}
|
|
20502
|
+
}
|
|
20503
|
+
}), [translation]);
|
|
20397
20504
|
};
|
|
20398
20505
|
|
|
20399
20506
|
// src/utils/builder.ts
|
|
@@ -20689,6 +20796,7 @@ export {
|
|
|
20689
20796
|
FilterOperatorUtils,
|
|
20690
20797
|
FilterPopUp,
|
|
20691
20798
|
FilterValueUtils,
|
|
20799
|
+
FlexibleDateTimeInput,
|
|
20692
20800
|
FocusTrap,
|
|
20693
20801
|
FocusTrapWrapper,
|
|
20694
20802
|
FormContext,
|