@helpwave/hightide 0.9.1 → 0.9.3
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 +32 -4
- package/dist/index.d.ts +32 -4
- package/dist/index.js +1475 -1224
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1383 -1134
- package/dist/index.mjs.map +1 -1
- package/dist/style/globals.css +3 -0
- package/package.json +3 -1
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,8 @@ var hightideTranslation = {
|
|
|
8336
8336
|
"de-DE": {
|
|
8337
8337
|
"add": `Hinzuf\xFCgen`,
|
|
8338
8338
|
"addFilter": `Filter hinzuf\xFCgen`,
|
|
8339
|
+
"addSorting": `Sortierung hinzuf\xFCgen`,
|
|
8340
|
+
"addTime": `Uhrzeit hinzuf\xFCgen`,
|
|
8339
8341
|
"after": `Nach`,
|
|
8340
8342
|
"age": `Alter`,
|
|
8341
8343
|
"all": `Alle`,
|
|
@@ -8546,6 +8548,8 @@ var hightideTranslation = {
|
|
|
8546
8548
|
"slideOf": ({ index, length }) => {
|
|
8547
8549
|
return `Slide ${index} von ${length} slides`;
|
|
8548
8550
|
},
|
|
8551
|
+
"sortAsc": `ASC`,
|
|
8552
|
+
"sortDesc": `DESC`,
|
|
8549
8553
|
"sorting": `Sortierung`,
|
|
8550
8554
|
"sSortingState": ({ sortDirection }) => {
|
|
8551
8555
|
return TranslationGen.resolveSelect(sortDirection, {
|
|
@@ -8696,11 +8700,14 @@ var hightideTranslation = {
|
|
|
8696
8700
|
"update": `Update`,
|
|
8697
8701
|
"value": `Wert`,
|
|
8698
8702
|
"welcome": `Willkommen`,
|
|
8703
|
+
"withoutTime": `Ohne Uhrzeit`,
|
|
8699
8704
|
"yes": `Ja`
|
|
8700
8705
|
},
|
|
8701
8706
|
"en-US": {
|
|
8702
8707
|
"add": `Add`,
|
|
8703
8708
|
"addFilter": `Add filter`,
|
|
8709
|
+
"addSorting": `Add sorting`,
|
|
8710
|
+
"addTime": `Add Time`,
|
|
8704
8711
|
"after": `After`,
|
|
8705
8712
|
"age": `Age`,
|
|
8706
8713
|
"all": `All`,
|
|
@@ -8911,6 +8918,8 @@ var hightideTranslation = {
|
|
|
8911
8918
|
"slideOf": ({ index, length }) => {
|
|
8912
8919
|
return `Slide ${index} of ${length} slides`;
|
|
8913
8920
|
},
|
|
8921
|
+
"sortAsc": `ASC`,
|
|
8922
|
+
"sortDesc": `DESC`,
|
|
8914
8923
|
"sorting": `Sorting`,
|
|
8915
8924
|
"sSortingState": ({ sortDirection }) => {
|
|
8916
8925
|
return TranslationGen.resolveSelect(sortDirection, {
|
|
@@ -9061,6 +9070,7 @@ var hightideTranslation = {
|
|
|
9061
9070
|
"update": `Update`,
|
|
9062
9071
|
"value": `Value`,
|
|
9063
9072
|
"welcome": `Welcome`,
|
|
9073
|
+
"withoutTime": `Without Time`,
|
|
9064
9074
|
"yes": `Yes`
|
|
9065
9075
|
}
|
|
9066
9076
|
};
|
|
@@ -9582,7 +9592,7 @@ var TooltipDisplay = forwardRef4(function TooltipAnchoredFloatingContainer({
|
|
|
9582
9592
|
isAnimated: isAnimatedOverwrite,
|
|
9583
9593
|
anchor: anchorOverwrite,
|
|
9584
9594
|
...props
|
|
9585
|
-
},
|
|
9595
|
+
}, forwardRef34) {
|
|
9586
9596
|
const { config } = useHightideConfig();
|
|
9587
9597
|
const tooltipContext = useContext4(TooltipContext);
|
|
9588
9598
|
const disabled = disabledOverwrite ?? tooltipContext?.disabled;
|
|
@@ -9598,7 +9608,7 @@ var TooltipDisplay = forwardRef4(function TooltipAnchoredFloatingContainer({
|
|
|
9598
9608
|
[isAnimatedOverwrite, config.tooltip.isAnimated]
|
|
9599
9609
|
);
|
|
9600
9610
|
const container = useRef7(null);
|
|
9601
|
-
useImperativeHandle2(
|
|
9611
|
+
useImperativeHandle2(forwardRef34, () => container.current);
|
|
9602
9612
|
const isActive = !disabled && isShown;
|
|
9603
9613
|
const { isVisible, transitionState } = useTransitionState(
|
|
9604
9614
|
useMemo9(() => ({ isOpen: isShown, ref: container }), [isShown])
|
|
@@ -11855,7 +11865,7 @@ var InputDialog = ({
|
|
|
11855
11865
|
import { forwardRef as forwardRef15 } from "react";
|
|
11856
11866
|
|
|
11857
11867
|
// src/components/user-interaction/Select/SelectRoot.tsx
|
|
11858
|
-
import { useCallback as
|
|
11868
|
+
import { useCallback as useCallback21, useEffect as useEffect21, useId as useId9, useMemo as useMemo19, useState as useState19 } from "react";
|
|
11859
11869
|
|
|
11860
11870
|
// src/components/user-interaction/Select/SelectContext.tsx
|
|
11861
11871
|
import { createContext as createContext9, useContext as useContext10 } from "react";
|
|
@@ -11868,10 +11878,10 @@ function useSelectContext() {
|
|
|
11868
11878
|
|
|
11869
11879
|
// src/components/user-interaction/Select/useSelect.ts
|
|
11870
11880
|
import {
|
|
11871
|
-
useCallback as
|
|
11872
|
-
useEffect as
|
|
11873
|
-
useMemo as
|
|
11874
|
-
useState as
|
|
11881
|
+
useCallback as useCallback20,
|
|
11882
|
+
useEffect as useEffect20,
|
|
11883
|
+
useMemo as useMemo18,
|
|
11884
|
+
useState as useState18
|
|
11875
11885
|
} from "react";
|
|
11876
11886
|
|
|
11877
11887
|
// src/hooks/useSingleSelection.ts
|
|
@@ -11998,217 +12008,8 @@ function useListNavigation({
|
|
|
11998
12008
|
}), [resolvedHighlightId, highlight, first, last, next, previous]);
|
|
11999
12009
|
}
|
|
12000
12010
|
|
|
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
12011
|
// src/hooks/useSearch.ts
|
|
12211
|
-
import { useMemo as
|
|
12012
|
+
import { useMemo as useMemo17 } from "react";
|
|
12212
12013
|
|
|
12213
12014
|
// src/utils/simpleSearch.ts
|
|
12214
12015
|
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
@@ -12247,18 +12048,18 @@ function useSearch({
|
|
|
12247
12048
|
}) {
|
|
12248
12049
|
const toTagsResolved = toTags ?? defaultToTags;
|
|
12249
12050
|
const toTagsStable = useEventCallbackStabilizer(toTagsResolved);
|
|
12250
|
-
const searchResult =
|
|
12051
|
+
const searchResult = useMemo17(() => {
|
|
12251
12052
|
const q = searchQuery.trim().toLowerCase();
|
|
12252
12053
|
if (!q) return items;
|
|
12253
12054
|
return MultiSearchWithMapping(searchQuery, [...items], (item) => toTagsStable(item));
|
|
12254
12055
|
}, [items, searchQuery, toTagsStable]);
|
|
12255
|
-
return
|
|
12056
|
+
return useMemo17(() => ({
|
|
12256
12057
|
searchResult
|
|
12257
12058
|
}), [searchResult]);
|
|
12258
12059
|
}
|
|
12259
12060
|
|
|
12260
12061
|
// src/hooks/useTypeAheadSearch.ts
|
|
12261
|
-
import { useCallback as
|
|
12062
|
+
import { useCallback as useCallback19, useEffect as useEffect19, useRef as useRef19 } from "react";
|
|
12262
12063
|
function defaultToString(value) {
|
|
12263
12064
|
return String(value);
|
|
12264
12065
|
}
|
|
@@ -12268,12 +12069,12 @@ function useTypeAheadSearch({
|
|
|
12268
12069
|
toString: toStringProp,
|
|
12269
12070
|
onResultChange
|
|
12270
12071
|
}) {
|
|
12271
|
-
const bufferRef =
|
|
12272
|
-
const timeoutRef =
|
|
12072
|
+
const bufferRef = useRef19("");
|
|
12073
|
+
const timeoutRef = useRef19(null);
|
|
12273
12074
|
const toString = toStringProp ?? defaultToString;
|
|
12274
12075
|
const toStringStable = useEventCallbackStabilizer(toString);
|
|
12275
12076
|
const onResultChangeStable = useEventCallbackStabilizer(onResultChange);
|
|
12276
|
-
const reset =
|
|
12077
|
+
const reset = useCallback19(() => {
|
|
12277
12078
|
if (timeoutRef.current) {
|
|
12278
12079
|
clearTimeout(timeoutRef.current);
|
|
12279
12080
|
timeoutRef.current = null;
|
|
@@ -12281,10 +12082,10 @@ function useTypeAheadSearch({
|
|
|
12281
12082
|
bufferRef.current = "";
|
|
12282
12083
|
onResultChangeStable(null);
|
|
12283
12084
|
}, [onResultChangeStable]);
|
|
12284
|
-
|
|
12085
|
+
useEffect19(() => () => {
|
|
12285
12086
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12286
12087
|
}, []);
|
|
12287
|
-
const addToTypeAhead =
|
|
12088
|
+
const addToTypeAhead = useCallback19((str) => {
|
|
12288
12089
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12289
12090
|
bufferRef.current += str;
|
|
12290
12091
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -12306,397 +12107,43 @@ function useTypeAheadSearch({
|
|
|
12306
12107
|
return { addToTypeAhead, reset };
|
|
12307
12108
|
}
|
|
12308
12109
|
|
|
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]);
|
|
12110
|
+
// src/components/user-interaction/Select/useSelect.ts
|
|
12111
|
+
function useSelect({
|
|
12112
|
+
options,
|
|
12113
|
+
value: controlledValue,
|
|
12114
|
+
onValueChange,
|
|
12115
|
+
onEditComplete,
|
|
12116
|
+
initialValue = null,
|
|
12117
|
+
onClose,
|
|
12118
|
+
onIsOpenChange,
|
|
12119
|
+
initialIsOpen = false,
|
|
12120
|
+
typeAheadResetMs = 500
|
|
12121
|
+
}) {
|
|
12122
|
+
const [isOpen, setIsOpen] = useState18(initialIsOpen);
|
|
12123
|
+
const [searchQuery, setSearchQuery] = useState18("");
|
|
12124
|
+
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
12125
|
+
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
12126
|
+
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12127
|
+
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
12128
|
+
const onSelectionChangeWrapper = useCallback20((id) => {
|
|
12129
|
+
if (id === null) return;
|
|
12130
|
+
onValueChangeStable(id);
|
|
12131
|
+
onEditCompleteStable(id);
|
|
12132
|
+
setIsOpen(false);
|
|
12133
|
+
}, [onValueChangeStable, onEditCompleteStable, setIsOpen]);
|
|
12134
|
+
const { selection, selectValue } = useSingleSelection({
|
|
12135
|
+
options,
|
|
12136
|
+
selection: controlledValue,
|
|
12137
|
+
onSelectionChange: onSelectionChangeWrapper,
|
|
12138
|
+
initialSelection: initialValue
|
|
12139
|
+
});
|
|
12140
|
+
const { searchResult: visibleOptions } = useSearch({
|
|
12141
|
+
items: options,
|
|
12142
|
+
searchQuery,
|
|
12143
|
+
toTags: useCallback20((o) => [o.label], [])
|
|
12144
|
+
});
|
|
12145
|
+
const visibleOptionIds = useMemo18(() => visibleOptions.map((o) => o.id), [visibleOptions]);
|
|
12146
|
+
const enabledOptions = useMemo18(() => visibleOptions.filter((o) => !o.disabled), [visibleOptions]);
|
|
12700
12147
|
const {
|
|
12701
12148
|
highlightedId,
|
|
12702
12149
|
highlight: listNavHighlight,
|
|
@@ -12712,28 +12159,28 @@ function useSelect({
|
|
|
12712
12159
|
options: enabledOptions,
|
|
12713
12160
|
resetTimer: typeAheadResetMs,
|
|
12714
12161
|
toString: (o) => o.label ?? "",
|
|
12715
|
-
onResultChange:
|
|
12162
|
+
onResultChange: useCallback20((option) => {
|
|
12716
12163
|
if (option) listNavHighlight(option.id);
|
|
12717
12164
|
}, [listNavHighlight])
|
|
12718
12165
|
});
|
|
12719
|
-
|
|
12166
|
+
useEffect20(() => {
|
|
12720
12167
|
if (!isOpen) typeAheadReset();
|
|
12721
12168
|
}, [isOpen, typeAheadReset]);
|
|
12722
|
-
const state =
|
|
12169
|
+
const state = useMemo18(() => ({
|
|
12723
12170
|
value: selection,
|
|
12724
12171
|
highlightedValue: highlightedId,
|
|
12725
12172
|
isOpen,
|
|
12726
12173
|
searchQuery,
|
|
12727
12174
|
options
|
|
12728
12175
|
}), [selection, highlightedId, isOpen, searchQuery, options]);
|
|
12729
|
-
const computedState =
|
|
12176
|
+
const computedState = useMemo18(() => ({
|
|
12730
12177
|
visibleOptionIds
|
|
12731
12178
|
}), [visibleOptionIds]);
|
|
12732
|
-
const highlightItem =
|
|
12179
|
+
const highlightItem = useCallback20((value) => {
|
|
12733
12180
|
if (!enabledOptions.some((o) => o.id === value)) return;
|
|
12734
12181
|
listNavHighlight(value);
|
|
12735
12182
|
}, [enabledOptions, listNavHighlight]);
|
|
12736
|
-
const setIsOpenWrapper =
|
|
12183
|
+
const setIsOpenWrapper = useCallback20((isOpen2, behavior) => {
|
|
12737
12184
|
behavior = behavior ?? "first";
|
|
12738
12185
|
if (isOpen2) {
|
|
12739
12186
|
if (selection == null) {
|
|
@@ -12752,11 +12199,11 @@ function useSelect({
|
|
|
12752
12199
|
setIsOpen(isOpen2);
|
|
12753
12200
|
onIsOpenChangeStable(isOpen2);
|
|
12754
12201
|
}, [setIsOpen, highlightItem, onCloseStable, setSearchQuery, onIsOpenChangeStable, selection, listNavFirst, listNavLast]);
|
|
12755
|
-
const toggleOpenWrapper =
|
|
12202
|
+
const toggleOpenWrapper = useCallback20((behavior) => {
|
|
12756
12203
|
const next = !isOpen;
|
|
12757
12204
|
setIsOpenWrapper(next, behavior);
|
|
12758
12205
|
}, [isOpen, setIsOpenWrapper]);
|
|
12759
|
-
const actions =
|
|
12206
|
+
const actions = useMemo18(() => ({
|
|
12760
12207
|
selectValue: (id) => selectValue(id),
|
|
12761
12208
|
setIsOpen: setIsOpenWrapper,
|
|
12762
12209
|
toggleOpen: toggleOpenWrapper,
|
|
@@ -12768,7 +12215,7 @@ function useSelect({
|
|
|
12768
12215
|
highlightItem,
|
|
12769
12216
|
handleTypeaheadKey: addToTypeAhead
|
|
12770
12217
|
}), [selectValue, setIsOpenWrapper, listNavFirst, listNavLast, listNavNext, listNavPrevious, highlightItem, addToTypeAhead, toggleOpenWrapper]);
|
|
12771
|
-
return
|
|
12218
|
+
return useMemo18(() => ({
|
|
12772
12219
|
...state,
|
|
12773
12220
|
...computedState,
|
|
12774
12221
|
...actions
|
|
@@ -12816,16 +12263,16 @@ function SelectRoot({
|
|
|
12816
12263
|
readOnly = false,
|
|
12817
12264
|
required = false
|
|
12818
12265
|
}) {
|
|
12819
|
-
const [triggerRef, setTriggerRef] =
|
|
12820
|
-
const [options, setOptions] =
|
|
12266
|
+
const [triggerRef, setTriggerRef] = useState19(null);
|
|
12267
|
+
const [options, setOptions] = useState19([]);
|
|
12821
12268
|
const generatedId = useId9();
|
|
12822
|
-
const [ids, setIds] =
|
|
12269
|
+
const [ids, setIds] = useState19({
|
|
12823
12270
|
trigger: "select-" + generatedId,
|
|
12824
12271
|
content: "select-content-" + generatedId,
|
|
12825
12272
|
listbox: "select-listbox-" + generatedId,
|
|
12826
12273
|
searchInput: "select-search-" + generatedId
|
|
12827
12274
|
});
|
|
12828
|
-
const registerOption =
|
|
12275
|
+
const registerOption = useCallback21(
|
|
12829
12276
|
(item) => {
|
|
12830
12277
|
setOptions((prev) => {
|
|
12831
12278
|
const next = prev.filter((o) => o.value !== item.value);
|
|
@@ -12837,31 +12284,31 @@ function SelectRoot({
|
|
|
12837
12284
|
},
|
|
12838
12285
|
[]
|
|
12839
12286
|
);
|
|
12840
|
-
const registerTrigger =
|
|
12287
|
+
const registerTrigger = useCallback21((ref) => {
|
|
12841
12288
|
setTriggerRef(ref);
|
|
12842
12289
|
return () => {
|
|
12843
12290
|
setTriggerRef(null);
|
|
12844
12291
|
};
|
|
12845
12292
|
}, []);
|
|
12846
|
-
const compare =
|
|
12847
|
-
const idToOptionMap =
|
|
12293
|
+
const compare = useMemo19(() => compareFunction ?? Object.is, [compareFunction]);
|
|
12294
|
+
const idToOptionMap = useMemo19(() => {
|
|
12848
12295
|
return options.reduce((acc, o) => {
|
|
12849
12296
|
acc[o.id] = o;
|
|
12850
12297
|
return acc;
|
|
12851
12298
|
}, {});
|
|
12852
12299
|
}, [options]);
|
|
12853
|
-
const mappedValueId =
|
|
12300
|
+
const mappedValueId = useMemo19(() => {
|
|
12854
12301
|
if (value === void 0) return void 0;
|
|
12855
12302
|
return options.find((o) => compare(o.value, value))?.id ?? null;
|
|
12856
12303
|
}, [options, value, compare]);
|
|
12857
|
-
const mappedInitialValueId =
|
|
12304
|
+
const mappedInitialValueId = useMemo19(() => {
|
|
12858
12305
|
if (initialValue === void 0) return void 0;
|
|
12859
12306
|
return options.find((o) => compare(o.value, initialValue))?.id ?? null;
|
|
12860
12307
|
}, [options, initialValue, compare]);
|
|
12861
12308
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
12862
12309
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
12863
12310
|
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
12864
|
-
const onValueChangeWrapper =
|
|
12311
|
+
const onValueChangeWrapper = useCallback21((value2) => {
|
|
12865
12312
|
const option = idToOptionMap[value2];
|
|
12866
12313
|
if (option === void 0) {
|
|
12867
12314
|
console.warn(`Attempted to select an option ${value2} that is not valid`);
|
|
@@ -12869,7 +12316,7 @@ function SelectRoot({
|
|
|
12869
12316
|
}
|
|
12870
12317
|
onValueChangeStable(option.value);
|
|
12871
12318
|
}, [onValueChangeStable, idToOptionMap]);
|
|
12872
|
-
const onEditCompleteWrapper =
|
|
12319
|
+
const onEditCompleteWrapper = useCallback21((value2) => {
|
|
12873
12320
|
const option = idToOptionMap[value2];
|
|
12874
12321
|
if (option === void 0) {
|
|
12875
12322
|
console.warn(`Attempted to edit complete an option ${value2} that is not valid`);
|
|
@@ -12888,17 +12335,17 @@ function SelectRoot({
|
|
|
12888
12335
|
onIsOpenChange: onIsOpenChangeStable
|
|
12889
12336
|
});
|
|
12890
12337
|
const { setSearchQuery } = state;
|
|
12891
|
-
|
|
12338
|
+
useEffect21(() => {
|
|
12892
12339
|
if (showSearch === false) {
|
|
12893
12340
|
setSearchQuery("");
|
|
12894
12341
|
}
|
|
12895
12342
|
}, [showSearch, setSearchQuery]);
|
|
12896
|
-
const config =
|
|
12343
|
+
const config = useMemo19(() => ({
|
|
12897
12344
|
iconAppearance,
|
|
12898
12345
|
ids,
|
|
12899
12346
|
setIds
|
|
12900
12347
|
}), [iconAppearance, ids, setIds]);
|
|
12901
|
-
const layout =
|
|
12348
|
+
const layout = useMemo19(() => ({
|
|
12902
12349
|
triggerRef,
|
|
12903
12350
|
registerTrigger
|
|
12904
12351
|
}), [triggerRef, registerTrigger]);
|
|
@@ -12953,12 +12400,12 @@ function SelectRoot({
|
|
|
12953
12400
|
}
|
|
12954
12401
|
|
|
12955
12402
|
// src/components/user-interaction/Select/SelectButton.tsx
|
|
12956
|
-
import { forwardRef as forwardRef12, useEffect as
|
|
12403
|
+
import { forwardRef as forwardRef12, useEffect as useEffect23, useImperativeHandle as useImperativeHandle8, useRef as useRef21 } from "react";
|
|
12957
12404
|
|
|
12958
12405
|
// src/components/user-interaction/Select/SelectOption.tsx
|
|
12959
12406
|
import clsx9 from "clsx";
|
|
12960
12407
|
import { CheckIcon } from "lucide-react";
|
|
12961
|
-
import { createContext as createContext11, forwardRef as forwardRef11, useContext as useContext12, useEffect as
|
|
12408
|
+
import { createContext as createContext11, forwardRef as forwardRef11, useContext as useContext12, useEffect as useEffect22, useId as useId10, useRef as useRef20 } from "react";
|
|
12962
12409
|
import { jsx as jsx35, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
12963
12410
|
var SelectOptionDisplayContext = createContext11(null);
|
|
12964
12411
|
function useSelectOptionDisplayLocation() {
|
|
@@ -12978,12 +12425,12 @@ var SelectOption = forwardRef11(function SelectOption2({
|
|
|
12978
12425
|
}, ref) {
|
|
12979
12426
|
const context = useSelectContext();
|
|
12980
12427
|
const { registerOption } = context;
|
|
12981
|
-
const itemRef =
|
|
12428
|
+
const itemRef = useRef20(null);
|
|
12982
12429
|
const display = children ?? label;
|
|
12983
12430
|
const iconAppearanceResolved = iconAppearance ?? context.config.iconAppearance;
|
|
12984
12431
|
const generatedId = useId10();
|
|
12985
12432
|
const optionId = props?.id ?? "select-option-" + generatedId;
|
|
12986
|
-
|
|
12433
|
+
useEffect22(() => {
|
|
12987
12434
|
return registerOption({
|
|
12988
12435
|
id: optionId,
|
|
12989
12436
|
value,
|
|
@@ -13065,12 +12512,12 @@ var SelectButton = forwardRef12(
|
|
|
13065
12512
|
const { config, layout } = context;
|
|
13066
12513
|
const { setIds } = config;
|
|
13067
12514
|
const { registerTrigger } = layout;
|
|
13068
|
-
|
|
12515
|
+
useEffect23(() => {
|
|
13069
12516
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
13070
12517
|
}, [id, setIds]);
|
|
13071
|
-
const innerRef =
|
|
12518
|
+
const innerRef = useRef21(null);
|
|
13072
12519
|
useImperativeHandle8(ref, () => innerRef.current);
|
|
13073
|
-
|
|
12520
|
+
useEffect23(() => {
|
|
13074
12521
|
const unregister = registerTrigger(innerRef);
|
|
13075
12522
|
return () => unregister();
|
|
13076
12523
|
}, [registerTrigger]);
|
|
@@ -13131,11 +12578,36 @@ var SelectButton = forwardRef12(
|
|
|
13131
12578
|
);
|
|
13132
12579
|
|
|
13133
12580
|
// src/components/user-interaction/Select/SelectContent.tsx
|
|
13134
|
-
import { forwardRef as forwardRef14, useCallback as
|
|
12581
|
+
import { forwardRef as forwardRef14, useCallback as useCallback23, useEffect as useEffect25, useImperativeHandle as useImperativeHandle10, useRef as useRef22 } from "react";
|
|
13135
12582
|
import clsx10 from "clsx";
|
|
13136
12583
|
|
|
13137
12584
|
// src/components/layout/popup/PopUp.tsx
|
|
13138
|
-
import { forwardRef as forwardRef13, useCallback as
|
|
12585
|
+
import { forwardRef as forwardRef13, useCallback as useCallback22, useContext as useContext13, useImperativeHandle as useImperativeHandle9, useMemo as useMemo20 } from "react";
|
|
12586
|
+
|
|
12587
|
+
// src/hooks/useOutsideClick.ts
|
|
12588
|
+
import { useEffect as useEffect24 } from "react";
|
|
12589
|
+
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12590
|
+
useEffect24(() => {
|
|
12591
|
+
if (!active) return;
|
|
12592
|
+
const listener = (event) => {
|
|
12593
|
+
if (event.target === null) return;
|
|
12594
|
+
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
12595
|
+
return;
|
|
12596
|
+
}
|
|
12597
|
+
onOutsideClick(event);
|
|
12598
|
+
};
|
|
12599
|
+
document.addEventListener("mousedown", listener);
|
|
12600
|
+
document.addEventListener("touchstart", listener);
|
|
12601
|
+
document.addEventListener("pointerdown", listener);
|
|
12602
|
+
return () => {
|
|
12603
|
+
document.removeEventListener("mousedown", listener);
|
|
12604
|
+
document.removeEventListener("touchstart", listener);
|
|
12605
|
+
document.removeEventListener("pointerdown", listener);
|
|
12606
|
+
};
|
|
12607
|
+
}, [refs, onOutsideClick, active]);
|
|
12608
|
+
};
|
|
12609
|
+
|
|
12610
|
+
// src/components/layout/popup/PopUp.tsx
|
|
13139
12611
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
13140
12612
|
var PopUp = forwardRef13(function PopUp2({
|
|
13141
12613
|
children,
|
|
@@ -13148,24 +12620,24 @@ var PopUp = forwardRef13(function PopUp2({
|
|
|
13148
12620
|
forceMount = false,
|
|
13149
12621
|
anchorExcludedFromOutsideClick = false,
|
|
13150
12622
|
...props
|
|
13151
|
-
},
|
|
12623
|
+
}, forwardRef34) {
|
|
13152
12624
|
const context = useContext13(PopUpContext);
|
|
13153
12625
|
const isOpen = isOpenOverwrite ?? context?.isOpen ?? false;
|
|
13154
12626
|
const anchor = anchorOverwrite ?? context?.triggerRef ?? void 0;
|
|
13155
12627
|
const id = props.id ?? context?.popUpId;
|
|
13156
12628
|
const { refAssignment, isPresent, ref } = usePresenceRef({ isOpen });
|
|
13157
|
-
useImperativeHandle9(
|
|
12629
|
+
useImperativeHandle9(forwardRef34, () => ref.current, [ref]);
|
|
13158
12630
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
13159
12631
|
const onOutsideClickStable = useEventCallbackStabilizer(onOutsideClick);
|
|
13160
|
-
const onCloseWrapper =
|
|
12632
|
+
const onCloseWrapper = useCallback22(() => {
|
|
13161
12633
|
onCloseStable();
|
|
13162
12634
|
context?.setIsOpen(false);
|
|
13163
12635
|
}, [onCloseStable, context]);
|
|
13164
|
-
const { zIndex, tagPositions } = useOverlayRegistry({ isActive: isOpen, tags:
|
|
12636
|
+
const { zIndex, tagPositions } = useOverlayRegistry({ isActive: isOpen, tags: useMemo20(() => ["popup"], []) });
|
|
13165
12637
|
const isInFront = tagPositions?.["popup"] === 0;
|
|
13166
12638
|
const isOutsideClickActive = isOpen && isInFront && (outsideClickOptions?.active ?? true);
|
|
13167
12639
|
useOutsideClick({
|
|
13168
|
-
onOutsideClick:
|
|
12640
|
+
onOutsideClick: useCallback22((event) => {
|
|
13169
12641
|
if (event.defaultPrevented) return;
|
|
13170
12642
|
onCloseWrapper();
|
|
13171
12643
|
onOutsideClickStable(event);
|
|
@@ -13211,18 +12683,18 @@ var SelectContent = forwardRef14(function SelectContent2({
|
|
|
13211
12683
|
...props
|
|
13212
12684
|
}, ref) {
|
|
13213
12685
|
const translation = useHightideTranslation();
|
|
13214
|
-
const innerRef =
|
|
13215
|
-
const searchInputRef =
|
|
12686
|
+
const innerRef = useRef22(null);
|
|
12687
|
+
const searchInputRef = useRef22(null);
|
|
13216
12688
|
useImperativeHandle10(ref, () => innerRef.current);
|
|
13217
12689
|
const context = useSelectContext();
|
|
13218
12690
|
const { config, handleTypeaheadKey, toggleSelection, highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId } = context;
|
|
13219
12691
|
const { setIds } = config;
|
|
13220
|
-
|
|
12692
|
+
useEffect25(() => {
|
|
13221
12693
|
if (id) setIds((prev) => ({ ...prev, content: id }));
|
|
13222
12694
|
}, [id, setIds]);
|
|
13223
12695
|
const showSearch = showSearchOverride ?? context.search.hasSearch;
|
|
13224
12696
|
const listboxAriaLabel = showSearch ? translation("searchResults") : void 0;
|
|
13225
|
-
const keyHandler =
|
|
12697
|
+
const keyHandler = useCallback23(
|
|
13226
12698
|
(event) => {
|
|
13227
12699
|
switch (event.key) {
|
|
13228
12700
|
case "ArrowDown":
|
|
@@ -13398,7 +12870,7 @@ import { MonitorCog, MoonIcon, SunIcon } from "lucide-react";
|
|
|
13398
12870
|
import clsx12 from "clsx";
|
|
13399
12871
|
|
|
13400
12872
|
// src/global-contexts/ThemeContext.tsx
|
|
13401
|
-
import { createContext as createContext12, useCallback as
|
|
12873
|
+
import { createContext as createContext12, useCallback as useCallback24, useContext as useContext14, useEffect as useEffect26, useMemo as useMemo21, useState as useState20 } from "react";
|
|
13402
12874
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
13403
12875
|
var themes = ["light", "dark", "system"];
|
|
13404
12876
|
var ThemeUtil = {
|
|
@@ -13412,8 +12884,8 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13412
12884
|
deleteValue: deleteStoredTheme
|
|
13413
12885
|
} = useStorage({ key: "theme", defaultValue: "system" });
|
|
13414
12886
|
const { config } = useHightideConfig();
|
|
13415
|
-
const [themePreference, setThemePreference] =
|
|
13416
|
-
const resolvedTheme =
|
|
12887
|
+
const [themePreference, setThemePreference] = useState20("system");
|
|
12888
|
+
const resolvedTheme = useMemo21(() => {
|
|
13417
12889
|
if (theme && theme !== "system") {
|
|
13418
12890
|
return theme;
|
|
13419
12891
|
}
|
|
@@ -13425,7 +12897,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13425
12897
|
}
|
|
13426
12898
|
return initialTheme ?? config.theme.initialTheme;
|
|
13427
12899
|
}, [config.theme.initialTheme, initialTheme, storedTheme, theme, themePreference]);
|
|
13428
|
-
|
|
12900
|
+
useEffect26(() => {
|
|
13429
12901
|
if (!theme) return;
|
|
13430
12902
|
if (theme === "system") {
|
|
13431
12903
|
deleteStoredTheme();
|
|
@@ -13433,18 +12905,18 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13433
12905
|
setStoredTheme(theme);
|
|
13434
12906
|
}
|
|
13435
12907
|
}, [theme, deleteStoredTheme, setStoredTheme]);
|
|
13436
|
-
|
|
12908
|
+
useEffect26(() => {
|
|
13437
12909
|
document.documentElement.setAttribute("data-theme", resolvedTheme);
|
|
13438
12910
|
}, [resolvedTheme]);
|
|
13439
|
-
const getPreference =
|
|
12911
|
+
const getPreference = useCallback24(() => {
|
|
13440
12912
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
13441
12913
|
const prefersLight = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
13442
12914
|
setThemePreference(prefersDark ? "dark" : prefersLight ? "light" : "system");
|
|
13443
12915
|
}, []);
|
|
13444
|
-
|
|
12916
|
+
useEffect26(() => {
|
|
13445
12917
|
getPreference();
|
|
13446
12918
|
}, [getPreference]);
|
|
13447
|
-
|
|
12919
|
+
useEffect26(() => {
|
|
13448
12920
|
const darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
13449
12921
|
const lightQuery = window.matchMedia("(prefers-color-scheme: light)");
|
|
13450
12922
|
const noPrefQuery = window.matchMedia("(prefers-color-scheme: no-preference)");
|
|
@@ -13558,7 +13030,7 @@ var ThemeDialog = ({
|
|
|
13558
13030
|
import { forwardRef as forwardRef17 } from "react";
|
|
13559
13031
|
|
|
13560
13032
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
13561
|
-
import { forwardRef as forwardRef16, useId as useId11, useImperativeHandle as useImperativeHandle11, useMemo as
|
|
13033
|
+
import { forwardRef as forwardRef16, useId as useId11, useImperativeHandle as useImperativeHandle11, useMemo as useMemo22, useRef as useRef23 } from "react";
|
|
13562
13034
|
|
|
13563
13035
|
// src/components/layout/drawer/DrawerContext.tsx
|
|
13564
13036
|
import { createContext as createContext13, useContext as useContext15 } from "react";
|
|
@@ -13583,12 +13055,12 @@ var DrawerContent = forwardRef16(function DrawerContent2({
|
|
|
13583
13055
|
}, forwardedRef) {
|
|
13584
13056
|
const { isOpen } = useDrawerContext();
|
|
13585
13057
|
const generatedId = useId11();
|
|
13586
|
-
const ids =
|
|
13058
|
+
const ids = useMemo22(() => ({
|
|
13587
13059
|
container: `dialog-container-${generatedId}`,
|
|
13588
13060
|
background: `dialog-background-${generatedId}`,
|
|
13589
13061
|
content: props.id ?? `dialog-content-${generatedId}`
|
|
13590
13062
|
}), [generatedId, props.id]);
|
|
13591
|
-
const ref =
|
|
13063
|
+
const ref = useRef23(null);
|
|
13592
13064
|
useImperativeHandle11(forwardedRef, () => ref.current, [ref]);
|
|
13593
13065
|
const { isVisible, transitionState } = useTransitionState({ isOpen, ref });
|
|
13594
13066
|
useFocusTrap({
|
|
@@ -13597,7 +13069,7 @@ var DrawerContent = forwardRef16(function DrawerContent2({
|
|
|
13597
13069
|
});
|
|
13598
13070
|
const { zIndex, tagPositions, tagItemCounts } = useOverlayRegistry({
|
|
13599
13071
|
isActive: isVisible,
|
|
13600
|
-
tags:
|
|
13072
|
+
tags: useMemo22(() => ["drawer"], [])
|
|
13601
13073
|
});
|
|
13602
13074
|
const depth = tagPositions && tagItemCounts ? (tagItemCounts["drawer"] ?? 0) - (tagPositions["drawer"] ?? 0) : 0;
|
|
13603
13075
|
const { setOpen } = useDrawerContext();
|
|
@@ -13750,7 +13222,7 @@ var ErrorComponent = ({
|
|
|
13750
13222
|
};
|
|
13751
13223
|
|
|
13752
13224
|
// src/components/layout/loading/LoadingAndErrorComponent.tsx
|
|
13753
|
-
import { useState as
|
|
13225
|
+
import { useState as useState21 } from "react";
|
|
13754
13226
|
|
|
13755
13227
|
// src/components/layout/loading/LoadingContainer.tsx
|
|
13756
13228
|
import { clsx as clsx14 } from "clsx";
|
|
@@ -13771,8 +13243,8 @@ var LoadingAndErrorComponent = ({
|
|
|
13771
13243
|
minimumLoadingDuration = 200,
|
|
13772
13244
|
className
|
|
13773
13245
|
}) => {
|
|
13774
|
-
const [isInMinimumLoading, setIsInMinimumLoading] =
|
|
13775
|
-
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] =
|
|
13246
|
+
const [isInMinimumLoading, setIsInMinimumLoading] = useState21(false);
|
|
13247
|
+
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = useState21(false);
|
|
13776
13248
|
if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {
|
|
13777
13249
|
setIsInMinimumLoading(true);
|
|
13778
13250
|
setTimeout(() => {
|
|
@@ -13836,8 +13308,8 @@ var BreadCrumbs = ({ crumbs }) => {
|
|
|
13836
13308
|
// src/components/layout/navigation/Navigation.tsx
|
|
13837
13309
|
var import_link2 = __toESM(require_link2());
|
|
13838
13310
|
import { Menu as MenuIcon, XIcon } from "lucide-react";
|
|
13839
|
-
import { useEffect as
|
|
13840
|
-
import { useCallback as
|
|
13311
|
+
import { useEffect as useEffect27 } from "react";
|
|
13312
|
+
import { useCallback as useCallback25, useId as useId12, useRef as useRef24, useState as useState22 } from "react";
|
|
13841
13313
|
import clsx17 from "clsx";
|
|
13842
13314
|
import { Fragment as Fragment5, jsx as jsx52, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
13843
13315
|
function isSubItem(item) {
|
|
@@ -13849,9 +13321,9 @@ var NavigationItemWithSubItem = ({
|
|
|
13849
13321
|
horizontalAlignment = "center",
|
|
13850
13322
|
...options
|
|
13851
13323
|
}) => {
|
|
13852
|
-
const [isOpen, setOpen] =
|
|
13853
|
-
const containerRef =
|
|
13854
|
-
const triggerRef =
|
|
13324
|
+
const [isOpen, setOpen] = useState22(false);
|
|
13325
|
+
const containerRef = useRef24(null);
|
|
13326
|
+
const triggerRef = useRef24(null);
|
|
13855
13327
|
const id = useId12();
|
|
13856
13328
|
const style = useAnchoredPosition({
|
|
13857
13329
|
active: isOpen,
|
|
@@ -13860,7 +13332,7 @@ var NavigationItemWithSubItem = ({
|
|
|
13860
13332
|
horizontalAlignment,
|
|
13861
13333
|
...options
|
|
13862
13334
|
});
|
|
13863
|
-
const onBlur =
|
|
13335
|
+
const onBlur = useCallback25((event) => {
|
|
13864
13336
|
const nextFocus = event.relatedTarget;
|
|
13865
13337
|
if (!containerRef.current?.contains(nextFocus) && !triggerRef.current?.contains(nextFocus)) {
|
|
13866
13338
|
setOpen(false);
|
|
@@ -13926,10 +13398,10 @@ var NavigationItemList = ({ items, ...restProps }) => {
|
|
|
13926
13398
|
};
|
|
13927
13399
|
var Navigation = ({ ...props }) => {
|
|
13928
13400
|
const translation = useHightideTranslation();
|
|
13929
|
-
const [isMobileOpen, setIsMobileOpen] =
|
|
13401
|
+
const [isMobileOpen, setIsMobileOpen] = useState22(false);
|
|
13930
13402
|
const id = useId12();
|
|
13931
|
-
const menuRef =
|
|
13932
|
-
|
|
13403
|
+
const menuRef = useRef24(null);
|
|
13404
|
+
useEffect27(() => {
|
|
13933
13405
|
menuRef.current?.focus();
|
|
13934
13406
|
}, [isMobileOpen]);
|
|
13935
13407
|
const { zIndex } = useOverlayRegistry({ isActive: isMobileOpen });
|
|
@@ -13997,7 +13469,7 @@ var Navigation = ({ ...props }) => {
|
|
|
13997
13469
|
// src/components/layout/navigation/Pagination.tsx
|
|
13998
13470
|
import { ChevronFirst, ChevronLast, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
13999
13471
|
import clsx18 from "clsx";
|
|
14000
|
-
import { useEffect as
|
|
13472
|
+
import { useEffect as useEffect28, useState as useState23 } from "react";
|
|
14001
13473
|
import { jsx as jsx53, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
14002
13474
|
var Pagination = ({
|
|
14003
13475
|
pageIndex,
|
|
@@ -14006,11 +13478,11 @@ var Pagination = ({
|
|
|
14006
13478
|
...props
|
|
14007
13479
|
}) => {
|
|
14008
13480
|
const translation = useHightideTranslation();
|
|
14009
|
-
const [value, setValue] =
|
|
13481
|
+
const [value, setValue] = useState23((pageIndex + 1).toString());
|
|
14010
13482
|
const noPages = pageCount === 0;
|
|
14011
13483
|
const onFirstPage = pageIndex === 0 && !noPages;
|
|
14012
13484
|
const onLastPage = pageIndex === pageCount - 1;
|
|
14013
|
-
|
|
13485
|
+
useEffect28(() => {
|
|
14014
13486
|
if (noPages) {
|
|
14015
13487
|
setValue("0");
|
|
14016
13488
|
} else {
|
|
@@ -14204,18 +13676,18 @@ var StepperBar = ({
|
|
|
14204
13676
|
};
|
|
14205
13677
|
|
|
14206
13678
|
// src/components/layout/popup/PopUpOpener.tsx
|
|
14207
|
-
import { useEffect as
|
|
13679
|
+
import { useEffect as useEffect29, useMemo as useMemo23, useRef as useRef25 } from "react";
|
|
14208
13680
|
function PopUpOpener({ children }) {
|
|
14209
13681
|
const context = usePopUpContext();
|
|
14210
13682
|
const { setTriggerRef } = context;
|
|
14211
|
-
const ref =
|
|
14212
|
-
|
|
13683
|
+
const ref = useRef25(null);
|
|
13684
|
+
useEffect29(() => {
|
|
14213
13685
|
setTriggerRef(ref);
|
|
14214
13686
|
return () => {
|
|
14215
13687
|
setTriggerRef(null);
|
|
14216
13688
|
};
|
|
14217
13689
|
}, [setTriggerRef]);
|
|
14218
|
-
const bag =
|
|
13690
|
+
const bag = useMemo23(() => ({
|
|
14219
13691
|
open: () => context.setIsOpen(true),
|
|
14220
13692
|
close: () => context.setIsOpen(false),
|
|
14221
13693
|
toggleOpen: () => context.setIsOpen((prev) => !prev),
|
|
@@ -14233,7 +13705,7 @@ function PopUpOpener({ children }) {
|
|
|
14233
13705
|
}
|
|
14234
13706
|
|
|
14235
13707
|
// src/components/layout/popup/PopUpRoot.tsx
|
|
14236
|
-
import { useId as useId13, useMemo as
|
|
13708
|
+
import { useId as useId13, useMemo as useMemo24, useState as useState24 } from "react";
|
|
14237
13709
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
14238
13710
|
function PopUpRoot({
|
|
14239
13711
|
children,
|
|
@@ -14250,10 +13722,10 @@ function PopUpRoot({
|
|
|
14250
13722
|
onValueChange: onIsOpenChange,
|
|
14251
13723
|
defaultValue: initialIsOpen
|
|
14252
13724
|
});
|
|
14253
|
-
const [triggerRef, setTriggerRef] =
|
|
14254
|
-
const popUpId =
|
|
14255
|
-
const triggerId =
|
|
14256
|
-
const contextValue =
|
|
13725
|
+
const [triggerRef, setTriggerRef] = useState24(null);
|
|
13726
|
+
const popUpId = useMemo24(() => popUpIdOverwrite ?? `pop-up-${generatedPopUpId}`, [popUpIdOverwrite, generatedPopUpId]);
|
|
13727
|
+
const triggerId = useMemo24(() => triggerIdOverwrite ?? `pop-up-trigger-${generatedTriggerId}`, [triggerIdOverwrite, generatedTriggerId]);
|
|
13728
|
+
const contextValue = useMemo24(() => ({
|
|
14257
13729
|
isOpen,
|
|
14258
13730
|
setIsOpen,
|
|
14259
13731
|
popUpId,
|
|
@@ -14440,7 +13912,7 @@ var FillerCell = ({ ...props }) => {
|
|
|
14440
13912
|
};
|
|
14441
13913
|
|
|
14442
13914
|
// src/components/layout/table/TableProvider.tsx
|
|
14443
|
-
import { useCallback as
|
|
13915
|
+
import { useCallback as useCallback27, useEffect as useEffect30, useLayoutEffect as useLayoutEffect6, useMemo as useMemo25, useRef as useRef26, useState as useState25 } from "react";
|
|
14444
13916
|
|
|
14445
13917
|
// src/components/layout/table/TableContext.tsx
|
|
14446
13918
|
import { createContext as createContext14, useContext as useContext16 } from "react";
|
|
@@ -14615,46 +14087,293 @@ var getOperatorInfo = (operator) => {
|
|
|
14615
14087
|
return { icon: null, translationKey: "unknown translation key", replacementTranslationKey: "unknown" };
|
|
14616
14088
|
}
|
|
14617
14089
|
};
|
|
14618
|
-
function getDefaultOperator(dataType) {
|
|
14619
|
-
switch (dataType) {
|
|
14620
|
-
case "text":
|
|
14621
|
-
return "contains";
|
|
14622
|
-
case "number":
|
|
14623
|
-
return "between";
|
|
14090
|
+
function getDefaultOperator(dataType) {
|
|
14091
|
+
switch (dataType) {
|
|
14092
|
+
case "text":
|
|
14093
|
+
return "contains";
|
|
14094
|
+
case "number":
|
|
14095
|
+
return "between";
|
|
14096
|
+
case "date":
|
|
14097
|
+
return "between";
|
|
14098
|
+
case "dateTime":
|
|
14099
|
+
return "between";
|
|
14100
|
+
case "boolean":
|
|
14101
|
+
return "isTrue";
|
|
14102
|
+
case "multiTags":
|
|
14103
|
+
return "contains";
|
|
14104
|
+
case "singleTag":
|
|
14105
|
+
return "contains";
|
|
14106
|
+
case "unknownType":
|
|
14107
|
+
return "isNotUndefined";
|
|
14108
|
+
}
|
|
14109
|
+
}
|
|
14110
|
+
var FilterOperatorUtils = {
|
|
14111
|
+
operators: filterOperators,
|
|
14112
|
+
operatorsByCategory: filterOperatorsByCategory,
|
|
14113
|
+
getInfo: getOperatorInfo,
|
|
14114
|
+
getDefaultOperator,
|
|
14115
|
+
typeCheck: {
|
|
14116
|
+
all: isFilterOperator,
|
|
14117
|
+
text: isFilterOperatorText,
|
|
14118
|
+
number: isFilterOperatorNumber,
|
|
14119
|
+
date: isFilterOperatorDate,
|
|
14120
|
+
datetime: isFilterOperatorDatetime,
|
|
14121
|
+
boolean: isFilterOperatorBoolean,
|
|
14122
|
+
tags: isFilterOperatorTags,
|
|
14123
|
+
tagsSingle: isFilterOperatorTagsSingle,
|
|
14124
|
+
unknownType: isFilterOperatorUnknownType
|
|
14125
|
+
}
|
|
14126
|
+
};
|
|
14127
|
+
|
|
14128
|
+
// src/components/user-interaction/data/filter-function.ts
|
|
14129
|
+
import { useCallback as useCallback26 } from "react";
|
|
14130
|
+
|
|
14131
|
+
// src/utils/date.ts
|
|
14132
|
+
var timesInSeconds = {
|
|
14133
|
+
second: 1,
|
|
14134
|
+
minute: 60,
|
|
14135
|
+
hour: 3600,
|
|
14136
|
+
day: 86400,
|
|
14137
|
+
week: 604800,
|
|
14138
|
+
monthImprecise: 2629800,
|
|
14139
|
+
// 30.4375 days
|
|
14140
|
+
yearImprecise: 31557600
|
|
14141
|
+
// 365.25 days
|
|
14142
|
+
};
|
|
14143
|
+
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14144
|
+
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14145
|
+
var changeDuration = (date, duration, isAdding) => {
|
|
14146
|
+
const {
|
|
14147
|
+
years = 0,
|
|
14148
|
+
months = 0,
|
|
14149
|
+
days = 0,
|
|
14150
|
+
hours = 0,
|
|
14151
|
+
minutes = 0,
|
|
14152
|
+
seconds = 0,
|
|
14153
|
+
milliseconds = 0
|
|
14154
|
+
} = duration;
|
|
14155
|
+
if (years < 0) {
|
|
14156
|
+
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14157
|
+
return new Date(date);
|
|
14158
|
+
}
|
|
14159
|
+
if (months < 0 || months > 11) {
|
|
14160
|
+
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14161
|
+
return new Date(date);
|
|
14162
|
+
}
|
|
14163
|
+
if (days < 0) {
|
|
14164
|
+
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14165
|
+
return new Date(date);
|
|
14166
|
+
}
|
|
14167
|
+
if (hours < 0 || hours > 23) {
|
|
14168
|
+
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14169
|
+
return new Date(date);
|
|
14170
|
+
}
|
|
14171
|
+
if (minutes < 0 || minutes > 59) {
|
|
14172
|
+
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14173
|
+
return new Date(date);
|
|
14174
|
+
}
|
|
14175
|
+
if (seconds < 0 || seconds > 59) {
|
|
14176
|
+
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14177
|
+
return new Date(date);
|
|
14178
|
+
}
|
|
14179
|
+
if (milliseconds < 0) {
|
|
14180
|
+
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14181
|
+
return new Date(date);
|
|
14182
|
+
}
|
|
14183
|
+
const multiplier = isAdding ? 1 : -1;
|
|
14184
|
+
const newDate = new Date(date);
|
|
14185
|
+
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14186
|
+
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14187
|
+
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14188
|
+
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14189
|
+
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14190
|
+
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14191
|
+
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14192
|
+
return newDate;
|
|
14193
|
+
};
|
|
14194
|
+
var addDuration = (date, duration) => {
|
|
14195
|
+
return changeDuration(date, duration, true);
|
|
14196
|
+
};
|
|
14197
|
+
var subtractDuration = (date, duration) => {
|
|
14198
|
+
return changeDuration(date, duration, false);
|
|
14199
|
+
};
|
|
14200
|
+
var between = (value, startDate, endDate) => {
|
|
14201
|
+
if (startDate && endDate) {
|
|
14202
|
+
console.assert(startDate <= endDate);
|
|
14203
|
+
return startDate <= value && value <= endDate;
|
|
14204
|
+
} else if (startDate) {
|
|
14205
|
+
return startDate <= value;
|
|
14206
|
+
} else if (endDate) {
|
|
14207
|
+
return endDate >= value;
|
|
14208
|
+
} else {
|
|
14209
|
+
return true;
|
|
14210
|
+
}
|
|
14211
|
+
};
|
|
14212
|
+
var equalDate = (date1, date2) => {
|
|
14213
|
+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14214
|
+
};
|
|
14215
|
+
var isLastMillisecondOfDay = (date) => {
|
|
14216
|
+
const next = new Date(date.getTime() + 1);
|
|
14217
|
+
return !equalDate(date, next);
|
|
14218
|
+
};
|
|
14219
|
+
var sameTime = (a, b, compareSeconds = false, compareMilliseconds = false) => {
|
|
14220
|
+
if (a.getHours() !== b.getHours() || a.getMinutes() !== b.getMinutes()) {
|
|
14221
|
+
return false;
|
|
14222
|
+
}
|
|
14223
|
+
if (compareSeconds && a.getSeconds() !== b.getSeconds()) {
|
|
14224
|
+
return false;
|
|
14225
|
+
}
|
|
14226
|
+
if (compareMilliseconds && a.getMilliseconds() !== b.getMilliseconds()) {
|
|
14227
|
+
return false;
|
|
14228
|
+
}
|
|
14229
|
+
return true;
|
|
14230
|
+
};
|
|
14231
|
+
var withTime = (datePart, timePart) => {
|
|
14232
|
+
const out = new Date(datePart);
|
|
14233
|
+
out.setHours(
|
|
14234
|
+
timePart.getHours(),
|
|
14235
|
+
timePart.getMinutes(),
|
|
14236
|
+
timePart.getSeconds(),
|
|
14237
|
+
timePart.getMilliseconds()
|
|
14238
|
+
);
|
|
14239
|
+
return out;
|
|
14240
|
+
};
|
|
14241
|
+
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14242
|
+
const month = date.getMonth();
|
|
14243
|
+
const year = date.getFullYear();
|
|
14244
|
+
const dayList = [];
|
|
14245
|
+
let currentDate = new Date(year, month, 1);
|
|
14246
|
+
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14247
|
+
while (currentDate.getDay() !== weekStartIndex) {
|
|
14248
|
+
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14249
|
+
}
|
|
14250
|
+
while (dayList.length < 7 * weeks) {
|
|
14251
|
+
const date2 = new Date(currentDate);
|
|
14252
|
+
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14253
|
+
dayList.push(date2);
|
|
14254
|
+
currentDate = addDuration(currentDate, { days: 1 });
|
|
14255
|
+
}
|
|
14256
|
+
return equalSizeGroups(dayList, 7);
|
|
14257
|
+
};
|
|
14258
|
+
var formatAbsolute = (date, locale, format) => {
|
|
14259
|
+
let options;
|
|
14260
|
+
switch (format) {
|
|
14261
|
+
case "date":
|
|
14262
|
+
options = {
|
|
14263
|
+
year: "2-digit",
|
|
14264
|
+
month: "2-digit",
|
|
14265
|
+
day: "2-digit"
|
|
14266
|
+
};
|
|
14267
|
+
break;
|
|
14268
|
+
case "time":
|
|
14269
|
+
options = {
|
|
14270
|
+
hour: "2-digit",
|
|
14271
|
+
minute: "2-digit"
|
|
14272
|
+
};
|
|
14273
|
+
break;
|
|
14274
|
+
case "dateTime":
|
|
14275
|
+
options = {
|
|
14276
|
+
year: "numeric",
|
|
14277
|
+
month: "2-digit",
|
|
14278
|
+
day: "2-digit",
|
|
14279
|
+
hour: "2-digit",
|
|
14280
|
+
minute: "2-digit"
|
|
14281
|
+
};
|
|
14282
|
+
break;
|
|
14283
|
+
}
|
|
14284
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14285
|
+
};
|
|
14286
|
+
var formatRelative = (date, locale) => {
|
|
14287
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14288
|
+
const now = /* @__PURE__ */ new Date();
|
|
14289
|
+
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14290
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14291
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
14292
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
14293
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
14294
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
14295
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
14296
|
+
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
14297
|
+
};
|
|
14298
|
+
var toInputString = (date, format, precision = "minute", isLocalTime = true) => {
|
|
14299
|
+
const pad = (n, l = 2) => String(n).padStart(l, "0");
|
|
14300
|
+
const parts = isLocalTime ? {
|
|
14301
|
+
y: date.getFullYear(),
|
|
14302
|
+
m: date.getMonth() + 1,
|
|
14303
|
+
d: date.getDate(),
|
|
14304
|
+
h: date.getHours(),
|
|
14305
|
+
min: date.getMinutes(),
|
|
14306
|
+
s: date.getSeconds(),
|
|
14307
|
+
ms: date.getMilliseconds()
|
|
14308
|
+
} : {
|
|
14309
|
+
y: date.getUTCFullYear(),
|
|
14310
|
+
m: date.getUTCMonth() + 1,
|
|
14311
|
+
d: date.getUTCDate(),
|
|
14312
|
+
h: date.getUTCHours(),
|
|
14313
|
+
min: date.getUTCMinutes(),
|
|
14314
|
+
s: date.getUTCSeconds(),
|
|
14315
|
+
ms: date.getUTCMilliseconds()
|
|
14316
|
+
};
|
|
14317
|
+
const dateStr = `${pad(parts.y, 4)}-${pad(parts.m)}-${pad(parts.d)}`;
|
|
14318
|
+
let timeStr = `${pad(parts.h)}:${pad(parts.min)}`;
|
|
14319
|
+
if (precision === "second" || precision === "millisecond") {
|
|
14320
|
+
timeStr += `:${pad(parts.s)}`;
|
|
14321
|
+
}
|
|
14322
|
+
if (precision === "millisecond") {
|
|
14323
|
+
timeStr += `.${pad(parts.ms, 3)}`;
|
|
14324
|
+
}
|
|
14325
|
+
switch (format) {
|
|
14624
14326
|
case "date":
|
|
14625
|
-
return
|
|
14327
|
+
return dateStr;
|
|
14328
|
+
case "time":
|
|
14329
|
+
return timeStr;
|
|
14626
14330
|
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";
|
|
14331
|
+
return `${dateStr}T${timeStr}`;
|
|
14636
14332
|
}
|
|
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
|
|
14333
|
+
};
|
|
14334
|
+
function tryParseDate(dateValue) {
|
|
14335
|
+
if (!dateValue) return null;
|
|
14336
|
+
if (dateValue instanceof Date) return dateValue;
|
|
14337
|
+
if (typeof dateValue === "string" || typeof dateValue === "number") {
|
|
14338
|
+
const parsed = new Date(dateValue);
|
|
14339
|
+
return isNaN(parsed.getTime()) ? null : parsed;
|
|
14653
14340
|
}
|
|
14341
|
+
return null;
|
|
14342
|
+
}
|
|
14343
|
+
function normalizeToDateOnly(date) {
|
|
14344
|
+
const normalized = new Date(date);
|
|
14345
|
+
normalized.setHours(0, 0, 0, 0);
|
|
14346
|
+
return normalized;
|
|
14347
|
+
}
|
|
14348
|
+
function normalizeDatetime(dateTime) {
|
|
14349
|
+
const normalized = new Date(dateTime);
|
|
14350
|
+
normalized.setSeconds(0, 0);
|
|
14351
|
+
return normalized;
|
|
14352
|
+
}
|
|
14353
|
+
var DateUtils = {
|
|
14354
|
+
monthsList,
|
|
14355
|
+
weekDayList,
|
|
14356
|
+
equalDate,
|
|
14357
|
+
isLastMillisecondOfDay,
|
|
14358
|
+
sameTime,
|
|
14359
|
+
withTime,
|
|
14360
|
+
formatAbsolute,
|
|
14361
|
+
formatRelative,
|
|
14362
|
+
addDuration,
|
|
14363
|
+
subtractDuration,
|
|
14364
|
+
between,
|
|
14365
|
+
weeksForCalenderMonth,
|
|
14366
|
+
timesInSeconds,
|
|
14367
|
+
toInputString,
|
|
14368
|
+
tryParseDate,
|
|
14369
|
+
toOnlyDate: normalizeToDateOnly,
|
|
14370
|
+
/**
|
|
14371
|
+
* Normalizes a datetime by removing seconds and milliseconds.
|
|
14372
|
+
*/
|
|
14373
|
+
toDateTimeOnly: normalizeDatetime
|
|
14654
14374
|
};
|
|
14655
14375
|
|
|
14656
14376
|
// src/components/user-interaction/data/filter-function.ts
|
|
14657
|
-
import { useCallback as useCallback27 } from "react";
|
|
14658
14377
|
var allowedOperatorsByDataType = {
|
|
14659
14378
|
text: ["equals", "notEquals", "contains", "notContains", "startsWith", "endsWith", "isUndefined", "isNotUndefined"],
|
|
14660
14379
|
number: ["equals", "notEquals", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "between", "notBetween", "isUndefined", "isNotUndefined"],
|
|
@@ -15007,7 +14726,7 @@ function tagToLabel(tags, value) {
|
|
|
15007
14726
|
function useFilterValueTranslation() {
|
|
15008
14727
|
const translation = useHightideTranslation();
|
|
15009
14728
|
const { locale } = useLocale();
|
|
15010
|
-
return
|
|
14729
|
+
return useCallback26((value, options) => {
|
|
15011
14730
|
const p = value.parameter;
|
|
15012
14731
|
const tags = options?.tags;
|
|
15013
14732
|
const dateFormat = value.dataType === "dateTime" ? "dateTime" : "date";
|
|
@@ -15209,9 +14928,9 @@ var TableProvider = ({
|
|
|
15209
14928
|
}) => {
|
|
15210
14929
|
const onRowClickStable = useEventCallbackStabilizer(onRowClick);
|
|
15211
14930
|
const onFillerRowClickStable = useEventCallbackStabilizer(onFillerRowClick);
|
|
15212
|
-
const [registeredColumns, setRegisteredColumns] =
|
|
15213
|
-
const containerRef =
|
|
15214
|
-
const [, setTableState] =
|
|
14931
|
+
const [registeredColumns, setRegisteredColumns] = useState25([]);
|
|
14932
|
+
const containerRef = useRef26(null);
|
|
14933
|
+
const [, setTableState] = useState25({
|
|
15215
14934
|
columnSizing: {},
|
|
15216
14935
|
columnOrder: [],
|
|
15217
14936
|
columnFilters: [],
|
|
@@ -15236,16 +14955,16 @@ var TableProvider = ({
|
|
|
15236
14955
|
pageSize: 10
|
|
15237
14956
|
}
|
|
15238
14957
|
});
|
|
15239
|
-
const [targetWidth, setTargetWidth] =
|
|
15240
|
-
|
|
14958
|
+
const [targetWidth, setTargetWidth] = useState25(void 0);
|
|
14959
|
+
useLayoutEffect6(() => {
|
|
15241
14960
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
15242
14961
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
15243
14962
|
}, [containerRef]);
|
|
15244
|
-
useWindowResizeObserver(
|
|
14963
|
+
useWindowResizeObserver(useCallback27(() => {
|
|
15245
14964
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
15246
14965
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
15247
14966
|
}, [containerRef]));
|
|
15248
|
-
const registerColumn =
|
|
14967
|
+
const registerColumn = useCallback27((column) => {
|
|
15249
14968
|
setRegisteredColumns((prev) => {
|
|
15250
14969
|
return [...prev, column];
|
|
15251
14970
|
});
|
|
@@ -15255,7 +14974,7 @@ var TableProvider = ({
|
|
|
15255
14974
|
});
|
|
15256
14975
|
};
|
|
15257
14976
|
}, []);
|
|
15258
|
-
const columns =
|
|
14977
|
+
const columns = useMemo25(() => {
|
|
15259
14978
|
const contextColumns = Array.from(registeredColumns.values());
|
|
15260
14979
|
if (columnsProp) {
|
|
15261
14980
|
return [...contextColumns, ...columnsProp];
|
|
@@ -15272,7 +14991,7 @@ var TableProvider = ({
|
|
|
15272
14991
|
defaultColumn: {
|
|
15273
14992
|
minSize: 60,
|
|
15274
14993
|
maxSize: 800,
|
|
15275
|
-
cell:
|
|
14994
|
+
cell: useCallback27(({ cell }) => {
|
|
15276
14995
|
return /* @__PURE__ */ jsx59(TableCell, { children: String(cell.getValue()) });
|
|
15277
14996
|
}, []),
|
|
15278
14997
|
enableResizing: true,
|
|
@@ -15313,7 +15032,7 @@ var TableProvider = ({
|
|
|
15313
15032
|
});
|
|
15314
15033
|
const pagination = table.getState().pagination;
|
|
15315
15034
|
const pageCount = table.getPageCount();
|
|
15316
|
-
|
|
15035
|
+
useEffect30(() => {
|
|
15317
15036
|
if (pageCount === -1) {
|
|
15318
15037
|
return;
|
|
15319
15038
|
}
|
|
@@ -15321,20 +15040,20 @@ var TableProvider = ({
|
|
|
15321
15040
|
table.setPageIndex(pageCount - 1);
|
|
15322
15041
|
}
|
|
15323
15042
|
}, [table, pagination.pageIndex, pageCount]);
|
|
15324
|
-
|
|
15043
|
+
useEffect30(() => {
|
|
15325
15044
|
table.setColumnOrder((prev) => [...prev]);
|
|
15326
15045
|
}, [table, columns]);
|
|
15327
15046
|
const columnVisibility = table.getState().columnVisibility;
|
|
15328
15047
|
const columnOrder = table.getState().columnOrder;
|
|
15329
15048
|
const columnPinning = table.getState().columnPinning;
|
|
15330
|
-
|
|
15049
|
+
useEffect30(() => {
|
|
15331
15050
|
table.setColumnSizing((prev) => ({ ...prev }));
|
|
15332
15051
|
}, [table, targetWidth, columnVisibility, columnOrder, columnPinning]);
|
|
15333
|
-
const tableColumnDefinitionContextValue =
|
|
15052
|
+
const tableColumnDefinitionContextValue = useMemo25(() => ({
|
|
15334
15053
|
table,
|
|
15335
15054
|
registerColumn
|
|
15336
15055
|
}), [table, registerColumn]);
|
|
15337
|
-
const tableContainerContextValue =
|
|
15056
|
+
const tableContainerContextValue = useMemo25(() => ({
|
|
15338
15057
|
table,
|
|
15339
15058
|
containerRef
|
|
15340
15059
|
}), [table, containerRef]);
|
|
@@ -15343,7 +15062,7 @@ var TableProvider = ({
|
|
|
15343
15062
|
return rest;
|
|
15344
15063
|
})();
|
|
15345
15064
|
const rowModel = table.getRowModel();
|
|
15346
|
-
const tableStateWithoutSizingContextValue =
|
|
15065
|
+
const tableStateWithoutSizingContextValue = useMemo25(() => ({
|
|
15347
15066
|
table,
|
|
15348
15067
|
isUsingFillerRows,
|
|
15349
15068
|
fillerRowCell,
|
|
@@ -15386,7 +15105,7 @@ var TableProvider = ({
|
|
|
15386
15105
|
]);
|
|
15387
15106
|
const columnSizing = table.getState().columnSizing;
|
|
15388
15107
|
const columnSizingInfo = table.getState().columnSizingInfo;
|
|
15389
|
-
const tableStateContextValue =
|
|
15108
|
+
const tableStateContextValue = useMemo25(() => ({
|
|
15390
15109
|
...tableStateWithoutSizingContextValue,
|
|
15391
15110
|
sizeVars: ColumnSizeUtil.toSizeVars(columnSizing),
|
|
15392
15111
|
columnSizingInfo,
|
|
@@ -15397,10 +15116,10 @@ var TableProvider = ({
|
|
|
15397
15116
|
|
|
15398
15117
|
// src/components/layout/table/TableBody.tsx
|
|
15399
15118
|
import { flexRender } from "@tanstack/react-table";
|
|
15400
|
-
import
|
|
15119
|
+
import React4 from "react";
|
|
15401
15120
|
import clsx20 from "clsx";
|
|
15402
15121
|
import { jsx as jsx60, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
15403
|
-
var TableBody =
|
|
15122
|
+
var TableBody = React4.memo(function TableBodyVisual() {
|
|
15404
15123
|
const { table, isUsingFillerRows, fillerRowCell, onRowClick, onFillerRowClick } = useTableStateWithoutSizingContext();
|
|
15405
15124
|
const rows = table.getRowModel().rows;
|
|
15406
15125
|
const columnOrder = table.getState().columnOrder;
|
|
@@ -15498,16 +15217,16 @@ var TableSortButton = ({
|
|
|
15498
15217
|
|
|
15499
15218
|
// src/components/layout/table/TableFilterButton.tsx
|
|
15500
15219
|
import { FilterIcon } from "lucide-react";
|
|
15501
|
-
import { useEffect as
|
|
15220
|
+
import { useEffect as useEffect41, useId as useId18, useMemo as useMemo34, useRef as useRef34, useState as useState33 } from "react";
|
|
15502
15221
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
15503
15222
|
|
|
15504
15223
|
// src/components/user-interaction/data/FilterPopUp.tsx
|
|
15505
15224
|
import { TrashIcon, XIcon as XIcon2 } from "lucide-react";
|
|
15506
|
-
import { forwardRef as forwardRef23, useId as useId17, useMemo as
|
|
15225
|
+
import { forwardRef as forwardRef23, useId as useId17, useMemo as useMemo33, useState as useState32 } from "react";
|
|
15507
15226
|
|
|
15508
15227
|
// src/components/user-interaction/Checkbox.tsx
|
|
15509
15228
|
import { Check as Check2, Minus as Minus2 } from "lucide-react";
|
|
15510
|
-
import { useCallback as
|
|
15229
|
+
import { useCallback as useCallback28 } from "react";
|
|
15511
15230
|
import { jsx as jsx62, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
15512
15231
|
var Checkbox = ({
|
|
15513
15232
|
value: controlledValue,
|
|
@@ -15525,7 +15244,7 @@ var Checkbox = ({
|
|
|
15525
15244
|
}) => {
|
|
15526
15245
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15527
15246
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
15528
|
-
const onChangeWrapper =
|
|
15247
|
+
const onChangeWrapper = useCallback28((value2) => {
|
|
15529
15248
|
onValueChangeStable(value2);
|
|
15530
15249
|
onEditCompleteStable(value2);
|
|
15531
15250
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -15569,12 +15288,12 @@ var Checkbox = ({
|
|
|
15569
15288
|
};
|
|
15570
15289
|
|
|
15571
15290
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
15572
|
-
import { forwardRef as forwardRef18, useCallback as
|
|
15291
|
+
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
15292
|
import { CalendarIcon } from "lucide-react";
|
|
15574
15293
|
import clsx24 from "clsx";
|
|
15575
15294
|
|
|
15576
15295
|
// src/components/user-interaction/date/TimePicker.tsx
|
|
15577
|
-
import { useEffect as
|
|
15296
|
+
import { useEffect as useEffect31, useMemo as useMemo26, useRef as useRef27 } from "react";
|
|
15578
15297
|
import { jsx as jsx63, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
15579
15298
|
var TimePicker = ({
|
|
15580
15299
|
value: controlledValue,
|
|
@@ -15593,11 +15312,11 @@ var TimePicker = ({
|
|
|
15593
15312
|
onValueChange,
|
|
15594
15313
|
defaultValue: initialValue
|
|
15595
15314
|
});
|
|
15596
|
-
const minuteRef =
|
|
15597
|
-
const hourRef =
|
|
15315
|
+
const minuteRef = useRef27(null);
|
|
15316
|
+
const hourRef = useRef27(null);
|
|
15598
15317
|
const isPM = value.getHours() > 11;
|
|
15599
15318
|
const hours = is24HourFormat ? range(24) : range(12);
|
|
15600
|
-
const minutes =
|
|
15319
|
+
const minutes = useMemo26(() => {
|
|
15601
15320
|
const full = range(60);
|
|
15602
15321
|
switch (minuteIncrement) {
|
|
15603
15322
|
case "5min":
|
|
@@ -15610,7 +15329,7 @@ var TimePicker = ({
|
|
|
15610
15329
|
return full.filter((value2) => value2 % 30 === 0);
|
|
15611
15330
|
}
|
|
15612
15331
|
}, [minuteIncrement]);
|
|
15613
|
-
const seconds =
|
|
15332
|
+
const seconds = useMemo26(() => {
|
|
15614
15333
|
const full = range(60);
|
|
15615
15334
|
switch (secondIncrement) {
|
|
15616
15335
|
case "1s":
|
|
@@ -15625,7 +15344,7 @@ var TimePicker = ({
|
|
|
15625
15344
|
return full.filter((value2) => value2 % 30 === 0);
|
|
15626
15345
|
}
|
|
15627
15346
|
}, [secondIncrement]);
|
|
15628
|
-
const milliseconds =
|
|
15347
|
+
const milliseconds = useMemo26(() => {
|
|
15629
15348
|
const full = range(1e3);
|
|
15630
15349
|
switch (millisecondIncrement) {
|
|
15631
15350
|
case "1ms":
|
|
@@ -15646,17 +15365,17 @@ var TimePicker = ({
|
|
|
15646
15365
|
return full.filter((value2) => value2 % 500 === 0);
|
|
15647
15366
|
}
|
|
15648
15367
|
}, [millisecondIncrement]);
|
|
15649
|
-
const closestMinute =
|
|
15650
|
-
const closestSecond =
|
|
15651
|
-
const closestMillisecond =
|
|
15368
|
+
const closestMinute = useMemo26(() => closestMatch(minutes, (item1, item2) => Math.abs(item1 - value.getMinutes()) < Math.abs(item2 - value.getMinutes())), [minutes, value]);
|
|
15369
|
+
const closestSecond = useMemo26(() => closestMatch(seconds, (item1, item2) => Math.abs(item1 - value.getSeconds()) < Math.abs(item2 - value.getSeconds())), [seconds, value]);
|
|
15370
|
+
const closestMillisecond = useMemo26(() => closestMatch(milliseconds, (item1, item2) => Math.abs(item1 - value.getMilliseconds()) < Math.abs(item2 - value.getMilliseconds())), [milliseconds, value]);
|
|
15652
15371
|
const hour = value.getHours();
|
|
15653
|
-
|
|
15372
|
+
useEffect31(() => {
|
|
15654
15373
|
minuteRef.current?.scrollIntoView({
|
|
15655
15374
|
behavior: "smooth",
|
|
15656
15375
|
block: "nearest"
|
|
15657
15376
|
});
|
|
15658
15377
|
}, [closestMinute]);
|
|
15659
|
-
|
|
15378
|
+
useEffect31(() => {
|
|
15660
15379
|
hourRef.current?.scrollIntoView({
|
|
15661
15380
|
behavior: "smooth",
|
|
15662
15381
|
block: "nearest"
|
|
@@ -15755,12 +15474,12 @@ var TimePicker = ({
|
|
|
15755
15474
|
};
|
|
15756
15475
|
|
|
15757
15476
|
// src/components/user-interaction/date/DatePicker.tsx
|
|
15758
|
-
import { useState as
|
|
15477
|
+
import { useState as useState27 } from "react";
|
|
15759
15478
|
import { ArrowDown, ArrowUp, Calendar, ChevronDown as ChevronDown4 } from "lucide-react";
|
|
15760
15479
|
import clsx23 from "clsx";
|
|
15761
15480
|
|
|
15762
15481
|
// src/components/user-interaction/date/DayPicker.tsx
|
|
15763
|
-
import { useCallback as
|
|
15482
|
+
import { useCallback as useCallback29, useEffect as useEffect32, useMemo as useMemo27, useRef as useRef28 } from "react";
|
|
15764
15483
|
import { jsx as jsx64, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
15765
15484
|
var DayPicker = ({
|
|
15766
15485
|
displayedMonth: controlledDisplayedMonth,
|
|
@@ -15789,33 +15508,33 @@ var DayPicker = ({
|
|
|
15789
15508
|
});
|
|
15790
15509
|
const month = displayedMonth.getMonth();
|
|
15791
15510
|
const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
|
|
15792
|
-
const selectedButtonRef =
|
|
15793
|
-
const isValueInDisplayedWeeks =
|
|
15511
|
+
const selectedButtonRef = useRef28(null);
|
|
15512
|
+
const isValueInDisplayedWeeks = useMemo27(
|
|
15794
15513
|
() => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
|
|
15795
15514
|
[value, weeks]
|
|
15796
15515
|
);
|
|
15797
|
-
const firstDayOfMonth =
|
|
15516
|
+
const firstDayOfMonth = useCallback29(
|
|
15798
15517
|
(date) => new Date(date.getFullYear(), date.getMonth(), 1),
|
|
15799
15518
|
[]
|
|
15800
15519
|
);
|
|
15801
15520
|
const focusTargetDate = value && isValueInDisplayedWeeks ? value : firstDayOfMonth(displayedMonth);
|
|
15802
|
-
|
|
15521
|
+
useEffect32(() => {
|
|
15803
15522
|
selectedButtonRef.current?.focus();
|
|
15804
15523
|
}, [focusTargetDate]);
|
|
15805
|
-
const end =
|
|
15524
|
+
const end = useMemo27(() => {
|
|
15806
15525
|
if (!providedEnd) return;
|
|
15807
15526
|
return new Date(providedEnd.getFullYear(), providedEnd.getMonth(), providedEnd.getDate());
|
|
15808
15527
|
}, [providedEnd]);
|
|
15809
|
-
const start =
|
|
15528
|
+
const start = useMemo27(() => {
|
|
15810
15529
|
if (!providedStart) return;
|
|
15811
15530
|
return new Date(providedStart.getFullYear(), providedStart.getMonth(), providedStart.getDate());
|
|
15812
15531
|
}, [providedStart]);
|
|
15813
|
-
const clampToRange =
|
|
15532
|
+
const clampToRange = useCallback29((date) => {
|
|
15814
15533
|
if (start && date < start) return start;
|
|
15815
15534
|
if (end && date > end) return end;
|
|
15816
15535
|
return date;
|
|
15817
15536
|
}, [start, end]);
|
|
15818
|
-
const navigateTo =
|
|
15537
|
+
const navigateTo = useCallback29((candidate) => {
|
|
15819
15538
|
const clamped = clampToRange(candidate);
|
|
15820
15539
|
if (!DateUtils.between(clamped, start, end)) return;
|
|
15821
15540
|
setValue(clamped);
|
|
@@ -15824,7 +15543,7 @@ var DayPicker = ({
|
|
|
15824
15543
|
setDisplayedMonth(firstDayOfMonth(clamped));
|
|
15825
15544
|
}
|
|
15826
15545
|
}, [clampToRange, start, end, setValue, onEditComplete, displayedMonth, setDisplayedMonth, firstDayOfMonth]);
|
|
15827
|
-
const onKeyDown =
|
|
15546
|
+
const onKeyDown = useCallback29(
|
|
15828
15547
|
(event) => {
|
|
15829
15548
|
PropsUtil.aria.navigate({
|
|
15830
15549
|
left: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 1 })),
|
|
@@ -15881,7 +15600,7 @@ var DayPicker = ({
|
|
|
15881
15600
|
};
|
|
15882
15601
|
|
|
15883
15602
|
// src/components/user-interaction/date/YearMonthPicker.tsx
|
|
15884
|
-
import { memo, useCallback as
|
|
15603
|
+
import { memo, useCallback as useCallback30, useEffect as useEffect33, useMemo as useMemo28, useRef as useRef29, useState as useState26 } from "react";
|
|
15885
15604
|
import clsx22 from "clsx";
|
|
15886
15605
|
import { jsx as jsx65, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
15887
15606
|
var YearRow = memo(function YearRow2({
|
|
@@ -15892,15 +15611,15 @@ var YearRow = memo(function YearRow2({
|
|
|
15892
15611
|
monthNames,
|
|
15893
15612
|
onSelect
|
|
15894
15613
|
}) {
|
|
15895
|
-
const ref =
|
|
15614
|
+
const ref = useRef29(null);
|
|
15896
15615
|
const isSelectedYear = selectedMonthIndex !== void 0;
|
|
15897
|
-
const [isExpanded, setIsExpanded] =
|
|
15898
|
-
|
|
15616
|
+
const [isExpanded, setIsExpanded] = useState26(false);
|
|
15617
|
+
useEffect33(() => {
|
|
15899
15618
|
if (isSelectedYear) {
|
|
15900
15619
|
ref.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
15901
15620
|
}
|
|
15902
15621
|
}, [isSelectedYear]);
|
|
15903
|
-
const monthGrid =
|
|
15622
|
+
const monthGrid = useMemo28(() => equalSizeGroups([...DateUtils.monthsList], 3), []);
|
|
15904
15623
|
return /* @__PURE__ */ jsxs36(
|
|
15905
15624
|
ExpandableRoot,
|
|
15906
15625
|
{
|
|
@@ -15955,23 +15674,23 @@ var YearMonthPicker = ({
|
|
|
15955
15674
|
defaultValue: initialValue
|
|
15956
15675
|
});
|
|
15957
15676
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15958
|
-
const monthNames =
|
|
15677
|
+
const monthNames = useMemo28(() => {
|
|
15959
15678
|
const formatter = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
15960
15679
|
return Array.from({ length: 12 }, (_, i) => formatter.format(new Date(2e3, i, 1)));
|
|
15961
15680
|
}, [locale]);
|
|
15962
|
-
const years =
|
|
15681
|
+
const years = useMemo28(
|
|
15963
15682
|
() => range([start.getFullYear(), end.getFullYear()], { exclusiveEnd: false }),
|
|
15964
15683
|
[start, end]
|
|
15965
15684
|
);
|
|
15966
|
-
const minTimestamp =
|
|
15685
|
+
const minTimestamp = useMemo28(() => {
|
|
15967
15686
|
if (!start) return;
|
|
15968
15687
|
return new Date(start.getFullYear(), start.getMonth(), 1).getTime();
|
|
15969
15688
|
}, [start]);
|
|
15970
|
-
const maxTimestamp =
|
|
15689
|
+
const maxTimestamp = useMemo28(() => {
|
|
15971
15690
|
if (!end) return;
|
|
15972
15691
|
return new Date(end.getFullYear(), end.getMonth() + 1, 0).getTime();
|
|
15973
15692
|
}, [end]);
|
|
15974
|
-
const handleSelect =
|
|
15693
|
+
const handleSelect = useCallback30((newDate) => {
|
|
15975
15694
|
setValue(newDate);
|
|
15976
15695
|
onEditCompleteStable(newDate);
|
|
15977
15696
|
}, [onEditCompleteStable, setValue]);
|
|
@@ -16024,8 +15743,8 @@ var DatePicker = ({
|
|
|
16024
15743
|
onValueChange,
|
|
16025
15744
|
defaultValue: initialValue
|
|
16026
15745
|
});
|
|
16027
|
-
const [displayedMonth, setDisplayedMonth] =
|
|
16028
|
-
const [displayMode, setDisplayMode] =
|
|
15746
|
+
const [displayedMonth, setDisplayedMonth] = useState27(new Date(value.getFullYear(), value.getMonth(), 1));
|
|
15747
|
+
const [displayMode, setDisplayMode] = useState27(initialDisplay);
|
|
16029
15748
|
return /* @__PURE__ */ jsxs37("div", { className: clsx23("flex-col-3", className), children: [
|
|
16030
15749
|
/* @__PURE__ */ jsxs37("div", { className: "flex-row-2 items-center justify-between", children: [
|
|
16031
15750
|
/* @__PURE__ */ jsxs37(
|
|
@@ -16187,7 +15906,7 @@ var DateTimePicker = ({
|
|
|
16187
15906
|
};
|
|
16188
15907
|
|
|
16189
15908
|
// src/components/user-interaction/date/DateTimePickerDialog.tsx
|
|
16190
|
-
import { useEffect as
|
|
15909
|
+
import { useEffect as useEffect34, useState as useState28 } from "react";
|
|
16191
15910
|
import { Fragment as Fragment6, jsx as jsx68, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
16192
15911
|
var DateTimePickerDialog = ({
|
|
16193
15912
|
initialValue = null,
|
|
@@ -16215,8 +15934,8 @@ var DateTimePickerDialog = ({
|
|
|
16215
15934
|
onValueChange,
|
|
16216
15935
|
defaultValue: initialValue
|
|
16217
15936
|
});
|
|
16218
|
-
const [pickerState, setPickerState] =
|
|
16219
|
-
|
|
15937
|
+
const [pickerState, setPickerState] = useState28(state ?? /* @__PURE__ */ new Date());
|
|
15938
|
+
useEffect34(() => {
|
|
16220
15939
|
setPickerState(state ?? /* @__PURE__ */ new Date());
|
|
16221
15940
|
}, [state]);
|
|
16222
15941
|
return /* @__PURE__ */ jsxs39(Fragment6, { children: [
|
|
@@ -16316,40 +16035,41 @@ var DateTimeInput = forwardRef18(function DateTimeInput2({
|
|
|
16316
16035
|
readOnly = false,
|
|
16317
16036
|
invalid = false,
|
|
16318
16037
|
required = false,
|
|
16038
|
+
actions = [],
|
|
16319
16039
|
...props
|
|
16320
16040
|
}, forwardedRef) {
|
|
16321
16041
|
const translation = useHightideTranslation();
|
|
16322
|
-
const [isOpen, setIsOpen] =
|
|
16042
|
+
const [isOpen, setIsOpen] = useState29(false);
|
|
16323
16043
|
const [state, setState] = useControlledState({
|
|
16324
16044
|
value,
|
|
16325
16045
|
onValueChange,
|
|
16326
16046
|
defaultValue: initialValue
|
|
16327
16047
|
});
|
|
16328
|
-
const [dialogValue, setDialogValue] =
|
|
16329
|
-
const [stringInputState, setStringInputState] =
|
|
16048
|
+
const [dialogValue, setDialogValue] = useState29(state);
|
|
16049
|
+
const [stringInputState, setStringInputState] = useState29({
|
|
16330
16050
|
state: state ? DateUtils.toInputString(state, mode, precision) : "",
|
|
16331
16051
|
date: void 0
|
|
16332
16052
|
});
|
|
16333
|
-
|
|
16053
|
+
useEffect35(() => {
|
|
16334
16054
|
setDialogValue(state);
|
|
16335
16055
|
setStringInputState({
|
|
16336
16056
|
state: state ? DateUtils.toInputString(state, mode) : "",
|
|
16337
16057
|
date: void 0
|
|
16338
16058
|
});
|
|
16339
16059
|
}, [mode, state]);
|
|
16340
|
-
const changeOpenWrapper =
|
|
16060
|
+
const changeOpenWrapper = useCallback31((isOpen2) => {
|
|
16341
16061
|
onDialogOpeningChange?.(isOpen2);
|
|
16342
16062
|
setIsOpen(isOpen2);
|
|
16343
16063
|
}, [onDialogOpeningChange]);
|
|
16344
16064
|
const generatedId = useId14();
|
|
16345
|
-
const ids =
|
|
16065
|
+
const ids = useMemo29(() => ({
|
|
16346
16066
|
input: inputId ?? `date-time-input-${generatedId}`,
|
|
16347
16067
|
popup: `date-time-input-popup-${generatedId}`,
|
|
16348
16068
|
label: `date-time-input-label-${generatedId}`
|
|
16349
16069
|
}), [generatedId, inputId]);
|
|
16350
|
-
const innerRef =
|
|
16070
|
+
const innerRef = useRef30(null);
|
|
16351
16071
|
useImperativeHandle12(forwardedRef, () => innerRef.current);
|
|
16352
|
-
|
|
16072
|
+
useEffect35(() => {
|
|
16353
16073
|
if (readOnly || disabled) {
|
|
16354
16074
|
changeOpenWrapper(false);
|
|
16355
16075
|
}
|
|
@@ -16367,6 +16087,12 @@ var DateTimeInput = forwardRef18(function DateTimeInput2({
|
|
|
16367
16087
|
ref: innerRef,
|
|
16368
16088
|
id: ids.input,
|
|
16369
16089
|
value: stringInputState.state,
|
|
16090
|
+
onClick: (event) => {
|
|
16091
|
+
event.preventDefault();
|
|
16092
|
+
},
|
|
16093
|
+
onFocus: (event) => {
|
|
16094
|
+
event.preventDefault();
|
|
16095
|
+
},
|
|
16370
16096
|
onChange: (event) => {
|
|
16371
16097
|
const date = new Date(event.target.value ?? "");
|
|
16372
16098
|
const isValid = !isNaN(date.getTime());
|
|
@@ -16407,24 +16133,26 @@ var DateTimeInput = forwardRef18(function DateTimeInput2({
|
|
|
16407
16133
|
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props)
|
|
16408
16134
|
}
|
|
16409
16135
|
),
|
|
16410
|
-
/* @__PURE__ */
|
|
16411
|
-
|
|
16412
|
-
{
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16136
|
+
/* @__PURE__ */ jsxs40("div", { className: "absolute right-1 top-1/2 -translate-y-1/2 flex-row-0", children: [
|
|
16137
|
+
actions,
|
|
16138
|
+
/* @__PURE__ */ jsx69(Visibility, { isVisible: !readOnly, children: /* @__PURE__ */ jsx69(
|
|
16139
|
+
IconButton,
|
|
16140
|
+
{
|
|
16141
|
+
tooltip: translation("sDateTimeSelect", { datetimeMode: mode }),
|
|
16142
|
+
coloringStyle: "text",
|
|
16143
|
+
color: "neutral",
|
|
16144
|
+
size: "sm",
|
|
16145
|
+
disabled,
|
|
16146
|
+
onClick: () => {
|
|
16147
|
+
changeOpenWrapper(true);
|
|
16148
|
+
},
|
|
16149
|
+
"aria-haspopup": "dialog",
|
|
16150
|
+
"aria-expanded": isOpen,
|
|
16151
|
+
"aria-controls": isOpen ? ids.popup : void 0,
|
|
16152
|
+
children: /* @__PURE__ */ jsx69(CalendarIcon, { className: "size-5" })
|
|
16153
|
+
}
|
|
16154
|
+
) })
|
|
16155
|
+
] })
|
|
16428
16156
|
] }),
|
|
16429
16157
|
/* @__PURE__ */ jsx69(
|
|
16430
16158
|
PopUp,
|
|
@@ -16478,7 +16206,7 @@ var DateTimeInput = forwardRef18(function DateTimeInput2({
|
|
|
16478
16206
|
import { forwardRef as forwardRef22 } from "react";
|
|
16479
16207
|
|
|
16480
16208
|
// src/components/user-interaction/MultiSelect/MultiSelectRoot.tsx
|
|
16481
|
-
import { useCallback as useCallback34, useEffect as
|
|
16209
|
+
import { useCallback as useCallback34, useEffect as useEffect37, useId as useId15, useMemo as useMemo32, useState as useState31 } from "react";
|
|
16482
16210
|
|
|
16483
16211
|
// src/components/user-interaction/MultiSelect/MultiSelectContext.tsx
|
|
16484
16212
|
import { createContext as createContext15, useContext as useContext17 } from "react";
|
|
@@ -16492,10 +16220,51 @@ function useMultiSelectContext() {
|
|
|
16492
16220
|
// src/components/user-interaction/MultiSelect/useMultiSelect.ts
|
|
16493
16221
|
import {
|
|
16494
16222
|
useCallback as useCallback33,
|
|
16495
|
-
useEffect as
|
|
16496
|
-
useMemo as
|
|
16497
|
-
useState as
|
|
16223
|
+
useEffect as useEffect36,
|
|
16224
|
+
useMemo as useMemo31,
|
|
16225
|
+
useState as useState30
|
|
16498
16226
|
} from "react";
|
|
16227
|
+
|
|
16228
|
+
// src/hooks/useMultiSelection.ts
|
|
16229
|
+
import { useCallback as useCallback32, useMemo as useMemo30 } from "react";
|
|
16230
|
+
function useMultiSelection({
|
|
16231
|
+
options: optionsList,
|
|
16232
|
+
value,
|
|
16233
|
+
onSelectionChange,
|
|
16234
|
+
initialSelection = [],
|
|
16235
|
+
isControlled
|
|
16236
|
+
}) {
|
|
16237
|
+
const [selection, setSelection] = useControlledState({
|
|
16238
|
+
value,
|
|
16239
|
+
onValueChange: onSelectionChange,
|
|
16240
|
+
defaultValue: [...initialSelection],
|
|
16241
|
+
isControlled
|
|
16242
|
+
});
|
|
16243
|
+
const isSelected = useCallback32((id) => selection.includes(id), [selection]);
|
|
16244
|
+
const toggleSelection = useCallback32(
|
|
16245
|
+
(id) => {
|
|
16246
|
+
const option = optionsList.find((o) => o.id === id);
|
|
16247
|
+
if (!option || option.disabled) return;
|
|
16248
|
+
setSelection((prev) => prev.includes(id) ? prev.filter((s) => s !== id) : [...prev, id]);
|
|
16249
|
+
},
|
|
16250
|
+
[optionsList, setSelection]
|
|
16251
|
+
);
|
|
16252
|
+
const setSelectionValue = useCallback32(
|
|
16253
|
+
(next) => setSelection(Array.from(next)),
|
|
16254
|
+
[setSelection]
|
|
16255
|
+
);
|
|
16256
|
+
return useMemo30(
|
|
16257
|
+
() => ({
|
|
16258
|
+
selection,
|
|
16259
|
+
setSelection: setSelectionValue,
|
|
16260
|
+
toggleSelection,
|
|
16261
|
+
isSelected
|
|
16262
|
+
}),
|
|
16263
|
+
[selection, setSelectionValue, toggleSelection, isSelected]
|
|
16264
|
+
);
|
|
16265
|
+
}
|
|
16266
|
+
|
|
16267
|
+
// src/components/user-interaction/MultiSelect/useMultiSelect.ts
|
|
16499
16268
|
function useMultiSelect({
|
|
16500
16269
|
options,
|
|
16501
16270
|
value: controlledValue,
|
|
@@ -16506,9 +16275,9 @@ function useMultiSelect({
|
|
|
16506
16275
|
initialIsOpen = false,
|
|
16507
16276
|
typeAheadResetMs = 500
|
|
16508
16277
|
}) {
|
|
16509
|
-
const [isOpen, setIsOpen] =
|
|
16510
|
-
const [searchQuery, setSearchQuery] =
|
|
16511
|
-
const selectionOptions =
|
|
16278
|
+
const [isOpen, setIsOpen] = useState30(initialIsOpen);
|
|
16279
|
+
const [searchQuery, setSearchQuery] = useState30("");
|
|
16280
|
+
const selectionOptions = useMemo31(
|
|
16512
16281
|
() => options.map((o) => ({ id: o.id, disabled: o.disabled })),
|
|
16513
16282
|
[options]
|
|
16514
16283
|
);
|
|
@@ -16526,11 +16295,11 @@ function useMultiSelect({
|
|
|
16526
16295
|
searchQuery,
|
|
16527
16296
|
toTags: useCallback33((o) => [o.label ?? ""], [])
|
|
16528
16297
|
});
|
|
16529
|
-
const visibleOptionIds =
|
|
16298
|
+
const visibleOptionIds = useMemo31(
|
|
16530
16299
|
() => visibleOptions.map((o) => o.id),
|
|
16531
16300
|
[visibleOptions]
|
|
16532
16301
|
);
|
|
16533
|
-
const enabledOptions =
|
|
16302
|
+
const enabledOptions = useMemo31(
|
|
16534
16303
|
() => visibleOptions.filter((o) => !o.disabled),
|
|
16535
16304
|
[visibleOptions]
|
|
16536
16305
|
);
|
|
@@ -16551,7 +16320,7 @@ function useMultiSelect({
|
|
|
16551
16320
|
)
|
|
16552
16321
|
});
|
|
16553
16322
|
const { reset: typeAheadReset, addToTypeAhead } = typeAhead;
|
|
16554
|
-
|
|
16323
|
+
useEffect36(() => {
|
|
16555
16324
|
if (!isOpen) typeAheadReset();
|
|
16556
16325
|
}, [isOpen, typeAheadReset]);
|
|
16557
16326
|
const highlightItem = useCallback33((id) => {
|
|
@@ -16604,7 +16373,7 @@ function useMultiSelect({
|
|
|
16604
16373
|
},
|
|
16605
16374
|
[isOpen, setIsOpenWrapper]
|
|
16606
16375
|
);
|
|
16607
|
-
const state =
|
|
16376
|
+
const state = useMemo31(
|
|
16608
16377
|
() => ({
|
|
16609
16378
|
value: [...selection],
|
|
16610
16379
|
highlightedId: listNav.highlightedId,
|
|
@@ -16620,11 +16389,11 @@ function useMultiSelect({
|
|
|
16620
16389
|
options
|
|
16621
16390
|
]
|
|
16622
16391
|
);
|
|
16623
|
-
const computedState =
|
|
16392
|
+
const computedState = useMemo31(
|
|
16624
16393
|
() => ({ visibleOptionIds }),
|
|
16625
16394
|
[visibleOptionIds]
|
|
16626
16395
|
);
|
|
16627
|
-
const actions =
|
|
16396
|
+
const actions = useMemo31(
|
|
16628
16397
|
() => ({
|
|
16629
16398
|
setIsOpen: setIsOpenWrapper,
|
|
16630
16399
|
toggleOpen: toggleOpenWrapper,
|
|
@@ -16653,7 +16422,7 @@ function useMultiSelect({
|
|
|
16653
16422
|
addToTypeAhead
|
|
16654
16423
|
]
|
|
16655
16424
|
);
|
|
16656
|
-
return
|
|
16425
|
+
return useMemo31(
|
|
16657
16426
|
() => ({
|
|
16658
16427
|
...state,
|
|
16659
16428
|
...computedState,
|
|
@@ -16681,10 +16450,10 @@ function MultiSelectRoot({
|
|
|
16681
16450
|
readOnly = false,
|
|
16682
16451
|
required = false
|
|
16683
16452
|
}) {
|
|
16684
|
-
const [triggerRef, setTriggerRef] =
|
|
16685
|
-
const [options, setOptions] =
|
|
16453
|
+
const [triggerRef, setTriggerRef] = useState31(null);
|
|
16454
|
+
const [options, setOptions] = useState31([]);
|
|
16686
16455
|
const generatedId = useId15();
|
|
16687
|
-
const [ids, setIds] =
|
|
16456
|
+
const [ids, setIds] = useState31({
|
|
16688
16457
|
trigger: "multi-select-" + generatedId,
|
|
16689
16458
|
content: "multi-select-content-" + generatedId,
|
|
16690
16459
|
listbox: "multi-select-listbox-" + generatedId,
|
|
@@ -16703,8 +16472,8 @@ function MultiSelectRoot({
|
|
|
16703
16472
|
setTriggerRef(ref);
|
|
16704
16473
|
return () => setTriggerRef(null);
|
|
16705
16474
|
}, []);
|
|
16706
|
-
const compare =
|
|
16707
|
-
const idToOptionMap =
|
|
16475
|
+
const compare = useMemo32(() => compareFunction ?? Object.is, [compareFunction]);
|
|
16476
|
+
const idToOptionMap = useMemo32(
|
|
16708
16477
|
() => options.reduce(
|
|
16709
16478
|
(acc, o) => {
|
|
16710
16479
|
acc[o.id] = o;
|
|
@@ -16714,11 +16483,11 @@ function MultiSelectRoot({
|
|
|
16714
16483
|
),
|
|
16715
16484
|
[options]
|
|
16716
16485
|
);
|
|
16717
|
-
const mappedValueIds =
|
|
16486
|
+
const mappedValueIds = useMemo32(() => {
|
|
16718
16487
|
if (value == null) return void 0;
|
|
16719
16488
|
return value.map((v) => options.find((o) => compare(o.value, v))?.id).filter((id) => id !== void 0);
|
|
16720
16489
|
}, [options, value, compare]);
|
|
16721
|
-
const mappedInitialValueIds =
|
|
16490
|
+
const mappedInitialValueIds = useMemo32(() => {
|
|
16722
16491
|
if (initialValue == null) return [];
|
|
16723
16492
|
return initialValue.map((v) => options.find((o) => compare(o.value, v))?.id).filter((id) => id !== void 0);
|
|
16724
16493
|
}, [options, initialValue, compare]);
|
|
@@ -16746,12 +16515,12 @@ function MultiSelectRoot({
|
|
|
16746
16515
|
onClose
|
|
16747
16516
|
});
|
|
16748
16517
|
const { setSearchQuery } = state;
|
|
16749
|
-
|
|
16518
|
+
useEffect37(() => {
|
|
16750
16519
|
if (showSearch === false) {
|
|
16751
16520
|
setSearchQuery("");
|
|
16752
16521
|
}
|
|
16753
16522
|
}, [showSearch, setSearchQuery]);
|
|
16754
|
-
const contextValue =
|
|
16523
|
+
const contextValue = useMemo32(() => {
|
|
16755
16524
|
const valueT = state.value.map((id) => idToOptionMap[id]?.value).filter((v) => v != null);
|
|
16756
16525
|
return {
|
|
16757
16526
|
invalid,
|
|
@@ -16822,12 +16591,12 @@ function MultiSelectRoot({
|
|
|
16822
16591
|
}
|
|
16823
16592
|
|
|
16824
16593
|
// src/components/user-interaction/MultiSelect/MultiSelectButton.tsx
|
|
16825
|
-
import { forwardRef as forwardRef20, useEffect as
|
|
16594
|
+
import { forwardRef as forwardRef20, useEffect as useEffect39, useImperativeHandle as useImperativeHandle13, useRef as useRef32 } from "react";
|
|
16826
16595
|
|
|
16827
16596
|
// src/components/user-interaction/MultiSelect/MultiSelectOption.tsx
|
|
16828
16597
|
import clsx25 from "clsx";
|
|
16829
16598
|
import { CheckIcon as CheckIcon2 } from "lucide-react";
|
|
16830
|
-
import { createContext as createContext16, forwardRef as forwardRef19, useContext as useContext18, useEffect as
|
|
16599
|
+
import { createContext as createContext16, forwardRef as forwardRef19, useContext as useContext18, useEffect as useEffect38, useId as useId16, useRef as useRef31 } from "react";
|
|
16831
16600
|
import { jsx as jsx71, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
16832
16601
|
var MultiSelectOptionDisplayContext = createContext16(null);
|
|
16833
16602
|
function useMultiSelectOptionDisplayLocation() {
|
|
@@ -16849,12 +16618,12 @@ var MultiSelectOption = forwardRef19(function MultiSelectOption2({
|
|
|
16849
16618
|
}, ref) {
|
|
16850
16619
|
const context = useMultiSelectContext();
|
|
16851
16620
|
const { registerOption } = context;
|
|
16852
|
-
const itemRef =
|
|
16621
|
+
const itemRef = useRef31(null);
|
|
16853
16622
|
const display = children ?? label;
|
|
16854
16623
|
const iconAppearanceResolved = iconAppearance ?? context.config.iconAppearance;
|
|
16855
16624
|
const generatedId = useId16();
|
|
16856
16625
|
const optionId = props?.id ?? "multi-select-option-" + generatedId;
|
|
16857
|
-
|
|
16626
|
+
useEffect38(() => {
|
|
16858
16627
|
return registerOption({
|
|
16859
16628
|
id: optionId,
|
|
16860
16629
|
value,
|
|
@@ -16935,12 +16704,12 @@ var MultiSelectButton = forwardRef20(function MultiSelectButton2({
|
|
|
16935
16704
|
const { config, layout } = context;
|
|
16936
16705
|
const { setIds } = config;
|
|
16937
16706
|
const { registerTrigger } = layout;
|
|
16938
|
-
|
|
16707
|
+
useEffect39(() => {
|
|
16939
16708
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
16940
16709
|
}, [id, setIds]);
|
|
16941
|
-
const innerRef =
|
|
16710
|
+
const innerRef = useRef32(null);
|
|
16942
16711
|
useImperativeHandle13(ref, () => innerRef.current);
|
|
16943
|
-
|
|
16712
|
+
useEffect39(() => {
|
|
16944
16713
|
const unregister = registerTrigger(innerRef);
|
|
16945
16714
|
return () => unregister();
|
|
16946
16715
|
}, [registerTrigger]);
|
|
@@ -17003,18 +16772,18 @@ var MultiSelectButton = forwardRef20(function MultiSelectButton2({
|
|
|
17003
16772
|
});
|
|
17004
16773
|
|
|
17005
16774
|
// src/components/user-interaction/MultiSelect/MultiSelectContent.tsx
|
|
17006
|
-
import { forwardRef as forwardRef21, useCallback as useCallback35, useEffect as
|
|
16775
|
+
import { forwardRef as forwardRef21, useCallback as useCallback35, useEffect as useEffect40, useImperativeHandle as useImperativeHandle14, useRef as useRef33 } from "react";
|
|
17007
16776
|
import clsx26 from "clsx";
|
|
17008
16777
|
import { jsx as jsx73, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
17009
16778
|
var MultiSelectContent = forwardRef21(function MultiSelectContent2({ id, options, showSearch: showSearchOverride, searchInputProps, ...props }, ref) {
|
|
17010
16779
|
const translation = useHightideTranslation();
|
|
17011
|
-
const innerRef =
|
|
17012
|
-
const searchInputRef =
|
|
16780
|
+
const innerRef = useRef33(null);
|
|
16781
|
+
const searchInputRef = useRef33(null);
|
|
17013
16782
|
useImperativeHandle14(ref, () => innerRef.current);
|
|
17014
16783
|
const context = useMultiSelectContext();
|
|
17015
16784
|
const { config, highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId, handleTypeaheadKey, toggleSelection } = context;
|
|
17016
16785
|
const { setIds } = config;
|
|
17017
|
-
|
|
16786
|
+
useEffect40(() => {
|
|
17018
16787
|
if (id) setIds((prev) => ({ ...prev, content: id }));
|
|
17019
16788
|
}, [id, setIds]);
|
|
17020
16789
|
const showSearch = showSearchOverride ?? context.search.hasSearch;
|
|
@@ -17166,7 +16935,6 @@ var FilterBasePopUp = forwardRef23(function FilterBasePopUp2({
|
|
|
17166
16935
|
onOperatorChange,
|
|
17167
16936
|
onRemove,
|
|
17168
16937
|
allowedOperators,
|
|
17169
|
-
hasValue,
|
|
17170
16938
|
noParameterRequired = false,
|
|
17171
16939
|
...props
|
|
17172
16940
|
}, ref) {
|
|
@@ -17196,28 +16964,30 @@ var FilterBasePopUp = forwardRef23(function FilterBasePopUp2({
|
|
|
17196
16964
|
}
|
|
17197
16965
|
)
|
|
17198
16966
|
] }),
|
|
17199
|
-
/* @__PURE__ */
|
|
17200
|
-
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17220
|
-
|
|
16967
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex-row-0 items-center", children: [
|
|
16968
|
+
/* @__PURE__ */ jsx75(
|
|
16969
|
+
IconButton,
|
|
16970
|
+
{
|
|
16971
|
+
tooltip: translation("removeFilter"),
|
|
16972
|
+
onClick: onRemove,
|
|
16973
|
+
color: "negative",
|
|
16974
|
+
coloringStyle: "text",
|
|
16975
|
+
size: "sm",
|
|
16976
|
+
children: /* @__PURE__ */ jsx75(TrashIcon, { className: "size-4" })
|
|
16977
|
+
}
|
|
16978
|
+
),
|
|
16979
|
+
/* @__PURE__ */ jsx75(
|
|
16980
|
+
IconButton,
|
|
16981
|
+
{
|
|
16982
|
+
tooltip: translation("close"),
|
|
16983
|
+
onClick: props.onClose,
|
|
16984
|
+
color: "neutral",
|
|
16985
|
+
coloringStyle: "text",
|
|
16986
|
+
size: "sm",
|
|
16987
|
+
children: /* @__PURE__ */ jsx75(XIcon2, { className: "size-4" })
|
|
16988
|
+
}
|
|
16989
|
+
)
|
|
16990
|
+
] })
|
|
17221
16991
|
] }),
|
|
17222
16992
|
children,
|
|
17223
16993
|
/* @__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 +17008,7 @@ var TextFilterPopUp = forwardRef23(function TextFilterPopUp2({
|
|
|
17238
17008
|
search: `text-filter-search-${id}`,
|
|
17239
17009
|
caseSensitive: `text-filter-case-sensitive-${id}`
|
|
17240
17010
|
};
|
|
17241
|
-
const operator =
|
|
17011
|
+
const operator = useMemo33(() => {
|
|
17242
17012
|
const suggestion = value?.operator ?? "contains";
|
|
17243
17013
|
if (!FilterOperatorUtils.typeCheck.text(suggestion)) {
|
|
17244
17014
|
return "contains";
|
|
@@ -17257,7 +17027,6 @@ var TextFilterPopUp = forwardRef23(function TextFilterPopUp2({
|
|
|
17257
17027
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "text", parameter, operator: newOperator }),
|
|
17258
17028
|
onRemove,
|
|
17259
17029
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.text,
|
|
17260
|
-
hasValue: !!value,
|
|
17261
17030
|
noParameterRequired: !needsParameterInput,
|
|
17262
17031
|
children: /* @__PURE__ */ jsxs46(Visibility, { isVisible: needsParameterInput, children: [
|
|
17263
17032
|
/* @__PURE__ */ jsxs46("div", { className: "flex-col-1", children: [
|
|
@@ -17314,7 +17083,7 @@ var NumberFilterPopUp = forwardRef23(function NumberFilterPopUp2({
|
|
|
17314
17083
|
max: `number-filter-max-${id}`,
|
|
17315
17084
|
compareValue: `number-filter-compare-value-${id}`
|
|
17316
17085
|
};
|
|
17317
|
-
const operator =
|
|
17086
|
+
const operator = useMemo33(() => {
|
|
17318
17087
|
const suggestion = value?.operator ?? "between";
|
|
17319
17088
|
if (!FilterOperatorUtils.typeCheck.number(suggestion)) {
|
|
17320
17089
|
return "between";
|
|
@@ -17336,7 +17105,6 @@ var NumberFilterPopUp = forwardRef23(function NumberFilterPopUp2({
|
|
|
17336
17105
|
},
|
|
17337
17106
|
onRemove,
|
|
17338
17107
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.number,
|
|
17339
|
-
hasValue: !!value,
|
|
17340
17108
|
noParameterRequired: !needsParameterInput,
|
|
17341
17109
|
children: [
|
|
17342
17110
|
/* @__PURE__ */ jsxs46(Visibility, { isVisible: needsRangeInput, children: [
|
|
@@ -17418,7 +17186,7 @@ var DateFilterPopUp = forwardRef23(function DateFilterPopUp2({
|
|
|
17418
17186
|
endDate: `date-filter-end-date-${id}`,
|
|
17419
17187
|
compareDate: `date-filter-compare-date-${id}`
|
|
17420
17188
|
};
|
|
17421
|
-
const operator =
|
|
17189
|
+
const operator = useMemo33(() => {
|
|
17422
17190
|
const suggestion = value?.operator ?? "between";
|
|
17423
17191
|
if (!FilterOperatorUtils.typeCheck.date(suggestion)) {
|
|
17424
17192
|
return "between";
|
|
@@ -17426,8 +17194,8 @@ var DateFilterPopUp = forwardRef23(function DateFilterPopUp2({
|
|
|
17426
17194
|
return suggestion;
|
|
17427
17195
|
}, [value]);
|
|
17428
17196
|
const parameter = value?.parameter ?? {};
|
|
17429
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] =
|
|
17430
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] =
|
|
17197
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState32(null);
|
|
17198
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = useState32(null);
|
|
17431
17199
|
const needsRangeInput = operator === "between" || operator === "notBetween";
|
|
17432
17200
|
const needsParameterInput = operator !== "isUndefined" && operator !== "isNotUndefined";
|
|
17433
17201
|
return /* @__PURE__ */ jsxs46(
|
|
@@ -17440,7 +17208,6 @@ var DateFilterPopUp = forwardRef23(function DateFilterPopUp2({
|
|
|
17440
17208
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "date", parameter, operator: newOperator }),
|
|
17441
17209
|
onRemove,
|
|
17442
17210
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.date,
|
|
17443
|
-
hasValue: !!value,
|
|
17444
17211
|
noParameterRequired: !needsParameterInput,
|
|
17445
17212
|
children: [
|
|
17446
17213
|
/* @__PURE__ */ jsxs46(Visibility, { isVisible: needsRangeInput, children: [
|
|
@@ -17561,7 +17328,7 @@ var DatetimeFilterPopUp = forwardRef23(function DatetimeFilterPopUp2({
|
|
|
17561
17328
|
endDate: `datetime-filter-end-date-${id}`,
|
|
17562
17329
|
compareDate: `datetime-filter-compare-date-${id}`
|
|
17563
17330
|
};
|
|
17564
|
-
const operator =
|
|
17331
|
+
const operator = useMemo33(() => {
|
|
17565
17332
|
const suggestion = value?.operator ?? "between";
|
|
17566
17333
|
if (!FilterOperatorUtils.typeCheck.datetime(suggestion)) {
|
|
17567
17334
|
return "between";
|
|
@@ -17569,8 +17336,8 @@ var DatetimeFilterPopUp = forwardRef23(function DatetimeFilterPopUp2({
|
|
|
17569
17336
|
return suggestion;
|
|
17570
17337
|
}, [value]);
|
|
17571
17338
|
const parameter = value?.parameter ?? {};
|
|
17572
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] =
|
|
17573
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] =
|
|
17339
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState32(null);
|
|
17340
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = useState32(null);
|
|
17574
17341
|
const needsRangeInput = operator === "between" || operator === "notBetween";
|
|
17575
17342
|
const needsParameterInput = operator !== "isUndefined" && operator !== "isNotUndefined";
|
|
17576
17343
|
return /* @__PURE__ */ jsxs46(
|
|
@@ -17583,7 +17350,6 @@ var DatetimeFilterPopUp = forwardRef23(function DatetimeFilterPopUp2({
|
|
|
17583
17350
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "dateTime", parameter, operator: newOperator }),
|
|
17584
17351
|
onRemove,
|
|
17585
17352
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.dateTime,
|
|
17586
|
-
hasValue: !!value,
|
|
17587
17353
|
children: [
|
|
17588
17354
|
/* @__PURE__ */ jsx75("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17589
17355
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: needsRangeInput, children: /* @__PURE__ */ jsxs46("div", { className: "flex-col-2 gap-2", children: [
|
|
@@ -17697,7 +17463,7 @@ var BooleanFilterPopUp = forwardRef23(function BooleanFilterPopUp2({
|
|
|
17697
17463
|
onRemove,
|
|
17698
17464
|
...props
|
|
17699
17465
|
}, ref) {
|
|
17700
|
-
const operator =
|
|
17466
|
+
const operator = useMemo33(() => {
|
|
17701
17467
|
const suggestion = value?.operator ?? "isTrue";
|
|
17702
17468
|
if (!FilterOperatorUtils.typeCheck.boolean(suggestion)) {
|
|
17703
17469
|
return "isTrue";
|
|
@@ -17714,8 +17480,7 @@ var BooleanFilterPopUp = forwardRef23(function BooleanFilterPopUp2({
|
|
|
17714
17480
|
operator,
|
|
17715
17481
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "boolean", parameter, operator: newOperator }),
|
|
17716
17482
|
onRemove,
|
|
17717
|
-
allowedOperators: FilterOperatorUtils.operatorsByCategory.boolean
|
|
17718
|
-
hasValue: !!value
|
|
17483
|
+
allowedOperators: FilterOperatorUtils.operatorsByCategory.boolean
|
|
17719
17484
|
}
|
|
17720
17485
|
);
|
|
17721
17486
|
});
|
|
@@ -17728,7 +17493,7 @@ var TagsFilterPopUp = forwardRef23(function TagsFilterPopUp2({
|
|
|
17728
17493
|
...props
|
|
17729
17494
|
}, ref) {
|
|
17730
17495
|
const translation = useHightideTranslation();
|
|
17731
|
-
const operator =
|
|
17496
|
+
const operator = useMemo33(() => {
|
|
17732
17497
|
const suggestion = value?.operator ?? "contains";
|
|
17733
17498
|
if (!FilterOperatorUtils.typeCheck.tags(suggestion)) {
|
|
17734
17499
|
return "contains";
|
|
@@ -17751,7 +17516,6 @@ var TagsFilterPopUp = forwardRef23(function TagsFilterPopUp2({
|
|
|
17751
17516
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "multiTags", parameter, operator: newOperator }),
|
|
17752
17517
|
onRemove,
|
|
17753
17518
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.multiTags,
|
|
17754
|
-
hasValue: !!value,
|
|
17755
17519
|
children: [
|
|
17756
17520
|
/* @__PURE__ */ jsx75("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17757
17521
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: needsParameterInput, children: /* @__PURE__ */ jsx75(
|
|
@@ -17783,7 +17547,7 @@ var TagsSingleFilterPopUp = forwardRef23(function TagsSingleFilterPopUp2({
|
|
|
17783
17547
|
...props
|
|
17784
17548
|
}, ref) {
|
|
17785
17549
|
const translation = useHightideTranslation();
|
|
17786
|
-
const operator =
|
|
17550
|
+
const operator = useMemo33(() => {
|
|
17787
17551
|
const suggestion = value?.operator ?? "contains";
|
|
17788
17552
|
if (!FilterOperatorUtils.typeCheck.tagsSingle(suggestion)) {
|
|
17789
17553
|
return "contains";
|
|
@@ -17808,7 +17572,6 @@ var TagsSingleFilterPopUp = forwardRef23(function TagsSingleFilterPopUp2({
|
|
|
17808
17572
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "singleTag", parameter, operator: newOperator }),
|
|
17809
17573
|
onRemove,
|
|
17810
17574
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.singleTag,
|
|
17811
|
-
hasValue: !!value,
|
|
17812
17575
|
children: [
|
|
17813
17576
|
/* @__PURE__ */ jsx75("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17814
17577
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: needsParameterInput && needsMultiSelect, children: /* @__PURE__ */ jsx75(
|
|
@@ -17847,7 +17610,7 @@ var TagsSingleFilterPopUp = forwardRef23(function TagsSingleFilterPopUp2({
|
|
|
17847
17610
|
);
|
|
17848
17611
|
});
|
|
17849
17612
|
var GenericFilterPopUp = forwardRef23(function GenericFilterPopUp2({ name, value, onValueChange, ...props }, ref) {
|
|
17850
|
-
const operator =
|
|
17613
|
+
const operator = useMemo33(() => {
|
|
17851
17614
|
const suggestion = value?.operator ?? "isNotUndefined";
|
|
17852
17615
|
if (!FilterOperatorUtils.typeCheck.unknownType(suggestion)) {
|
|
17853
17616
|
return "isNotUndefined";
|
|
@@ -17863,8 +17626,7 @@ var GenericFilterPopUp = forwardRef23(function GenericFilterPopUp2({ name, value
|
|
|
17863
17626
|
operator,
|
|
17864
17627
|
onOperatorChange: (newOperator) => onValueChange({ ...value, operator: newOperator }),
|
|
17865
17628
|
onRemove: () => onValueChange({ ...value, operator: void 0 }),
|
|
17866
|
-
allowedOperators: FilterOperatorUtils.operatorsByCategory.unknownType
|
|
17867
|
-
hasValue: !!value
|
|
17629
|
+
allowedOperators: FilterOperatorUtils.operatorsByCategory.unknownType
|
|
17868
17630
|
}
|
|
17869
17631
|
);
|
|
17870
17632
|
});
|
|
@@ -17905,18 +17667,18 @@ var TableFilterButton = ({
|
|
|
17905
17667
|
const translation = useHightideTranslation();
|
|
17906
17668
|
const column = header.column;
|
|
17907
17669
|
const columnFilterValue = column.getFilterValue();
|
|
17908
|
-
const [filterValue, setFilterValue] =
|
|
17670
|
+
const [filterValue, setFilterValue] = useState33(columnFilterValue);
|
|
17909
17671
|
const hasFilter = !!filterValue;
|
|
17910
|
-
const anchorRef =
|
|
17911
|
-
const containerRef =
|
|
17912
|
-
const [isOpen, setIsOpen] =
|
|
17672
|
+
const anchorRef = useRef34(null);
|
|
17673
|
+
const containerRef = useRef34(null);
|
|
17674
|
+
const [isOpen, setIsOpen] = useState33(false);
|
|
17913
17675
|
const id = useId18();
|
|
17914
|
-
const ids =
|
|
17676
|
+
const ids = useMemo34(() => ({
|
|
17915
17677
|
button: `table-filter-button-${id}`,
|
|
17916
17678
|
popup: `table-filter-popup-${id}`,
|
|
17917
17679
|
label: `table-filter-label-${id}`
|
|
17918
17680
|
}), [id]);
|
|
17919
|
-
|
|
17681
|
+
useEffect41(() => {
|
|
17920
17682
|
setFilterValue(columnFilterValue);
|
|
17921
17683
|
}, [columnFilterValue]);
|
|
17922
17684
|
const isTagsFilter = filterType === "multiTags" || filterType === "singleTag";
|
|
@@ -17977,7 +17739,7 @@ var TableFilterButton = ({
|
|
|
17977
17739
|
};
|
|
17978
17740
|
|
|
17979
17741
|
// src/components/layout/table/TableHeader.tsx
|
|
17980
|
-
import { useCallback as useCallback36, useEffect as
|
|
17742
|
+
import { useCallback as useCallback36, useEffect as useEffect42 } from "react";
|
|
17981
17743
|
|
|
17982
17744
|
// src/components/user-interaction/data/data-types.tsx
|
|
17983
17745
|
import { Binary, Calendar as Calendar2, CalendarClock, Check as Check3, Database, Tag, Tags, TextIcon } from "lucide-react";
|
|
@@ -18075,7 +17837,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
18075
17837
|
startSize: null
|
|
18076
17838
|
});
|
|
18077
17839
|
}, [table]);
|
|
18078
|
-
|
|
17840
|
+
useEffect42(() => {
|
|
18079
17841
|
window.addEventListener("pointermove", handleResizeMove);
|
|
18080
17842
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
18081
17843
|
return () => {
|
|
@@ -18104,7 +17866,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
18104
17866
|
"data-name": "table-header-cell",
|
|
18105
17867
|
className: clsx28("group/table-header-cell", header.column.columnDef.meta?.className),
|
|
18106
17868
|
children: [
|
|
18107
|
-
/* @__PURE__ */ jsx78(Visibility, { isVisible: !header.isPlaceholder, children: /* @__PURE__ */ jsxs48("div", { className: "flex-row-1 items-center", children: [
|
|
17869
|
+
/* @__PURE__ */ jsx78(Visibility, { isVisible: !header.isPlaceholder, children: /* @__PURE__ */ jsxs48("div", { className: "flex-row-1 items-center truncate", children: [
|
|
18108
17870
|
/* @__PURE__ */ jsx78(Visibility, { isVisible: header.column.getCanSort(), children: /* @__PURE__ */ jsx78(
|
|
18109
17871
|
TableSortButton,
|
|
18110
17872
|
{
|
|
@@ -18244,7 +18006,7 @@ var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props
|
|
|
18244
18006
|
};
|
|
18245
18007
|
|
|
18246
18008
|
// src/components/layout/table/TableWithSelectionProvider.tsx
|
|
18247
|
-
import { useCallback as useCallback37, useMemo as
|
|
18009
|
+
import { useCallback as useCallback37, useMemo as useMemo35 } from "react";
|
|
18248
18010
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
18249
18011
|
var TableWithSelectionProvider = ({
|
|
18250
18012
|
children,
|
|
@@ -18257,7 +18019,7 @@ var TableWithSelectionProvider = ({
|
|
|
18257
18019
|
...props
|
|
18258
18020
|
}) => {
|
|
18259
18021
|
const translation = useHightideTranslation();
|
|
18260
|
-
const columnDef =
|
|
18022
|
+
const columnDef = useMemo35(() => [
|
|
18261
18023
|
{
|
|
18262
18024
|
id: selectionRowId,
|
|
18263
18025
|
header: ({ table }) => {
|
|
@@ -18360,7 +18122,7 @@ var TableWithSelection = ({
|
|
|
18360
18122
|
};
|
|
18361
18123
|
|
|
18362
18124
|
// src/components/layout/table/TableColumn.tsx
|
|
18363
|
-
import { memo as memo2, useEffect as
|
|
18125
|
+
import { memo as memo2, useEffect as useEffect43, useMemo as useMemo36, useState as useState34 } from "react";
|
|
18364
18126
|
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
18365
18127
|
var TableColumnComponent = ({
|
|
18366
18128
|
filterType,
|
|
@@ -18372,11 +18134,11 @@ var TableColumnComponent = ({
|
|
|
18372
18134
|
"TableColumn: For filterType === multiTags or singleTag, filterData.tags must be set.",
|
|
18373
18135
|
(filterType === "multiTags" || filterType === "singleTag") && props.meta?.filterData?.tags === void 0
|
|
18374
18136
|
);
|
|
18375
|
-
const [column] =
|
|
18137
|
+
const [column] = useState34({
|
|
18376
18138
|
...props,
|
|
18377
18139
|
filterFn
|
|
18378
18140
|
});
|
|
18379
|
-
|
|
18141
|
+
useEffect43(() => {
|
|
18380
18142
|
const unsubscribe = registerColumn(column);
|
|
18381
18143
|
return () => {
|
|
18382
18144
|
unsubscribe();
|
|
@@ -18391,27 +18153,29 @@ var TableColumnFactory = () => memo2(
|
|
|
18391
18153
|
}
|
|
18392
18154
|
);
|
|
18393
18155
|
var TableColumn = (props) => {
|
|
18394
|
-
const TableColumnComponent2 =
|
|
18156
|
+
const TableColumnComponent2 = useMemo36(() => TableColumnFactory(), []);
|
|
18395
18157
|
return /* @__PURE__ */ jsx83(TableColumnComponent2, { ...props });
|
|
18396
18158
|
};
|
|
18397
18159
|
|
|
18398
18160
|
// src/components/layout/table/TableColumnSwitcher.tsx
|
|
18399
|
-
import { useMemo as
|
|
18400
|
-
import { ChevronUp as ChevronUp3, ChevronDown as ChevronDown5, ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight5, Eye, EyeOff, Pin, PinOff,
|
|
18161
|
+
import { useMemo as useMemo37, useRef as useRef35, useId as useId19 } from "react";
|
|
18162
|
+
import { ChevronUp as ChevronUp3, ChevronDown as ChevronDown5, ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight5, Eye, EyeOff, Pin, PinOff, Columns3Cog } from "lucide-react";
|
|
18401
18163
|
import { Fragment as Fragment10, jsx as jsx84, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
18402
18164
|
var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
18403
18165
|
const { table } = useTableStateWithoutSizingContext();
|
|
18404
18166
|
const translation = useHightideTranslation();
|
|
18405
|
-
const containerRef =
|
|
18167
|
+
const containerRef = useRef35(null);
|
|
18406
18168
|
const generatedId = useId19();
|
|
18407
|
-
const ids =
|
|
18169
|
+
const ids = useMemo37(() => ({
|
|
18408
18170
|
popup: props.id ?? `table-column-picker-popup-${generatedId}`,
|
|
18409
18171
|
label: `table-column-picker-label-${generatedId}`
|
|
18410
18172
|
}), [generatedId, props.id]);
|
|
18173
|
+
const enableHiding = table.options.enableHiding !== false;
|
|
18174
|
+
const enableColumnPinning = table.options.enableColumnPinning !== false;
|
|
18411
18175
|
const tableState = table.getState();
|
|
18412
18176
|
const columnOrder = tableState.columnOrder;
|
|
18413
18177
|
const columnPinning = tableState.columnPinning;
|
|
18414
|
-
const columns =
|
|
18178
|
+
const columns = useMemo37(() => {
|
|
18415
18179
|
const allColumns = table.getAllColumns();
|
|
18416
18180
|
const leftPinned = [];
|
|
18417
18181
|
const unpinned = [];
|
|
@@ -18612,7 +18376,7 @@ var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
|
18612
18376
|
] }) }),
|
|
18613
18377
|
/* @__PURE__ */ jsx84("div", { className: "flex-1 typography-label-lg", children: getColumnHeader(columnId) }),
|
|
18614
18378
|
/* @__PURE__ */ jsxs52(Fragment10, { children: [
|
|
18615
|
-
/* @__PURE__ */ jsx84(
|
|
18379
|
+
/* @__PURE__ */ jsx84(Visibility, { isVisible: enableHiding, children: /* @__PURE__ */ jsx84(
|
|
18616
18380
|
IconButton,
|
|
18617
18381
|
{
|
|
18618
18382
|
tooltip: translation("changeVisibility"),
|
|
@@ -18624,8 +18388,8 @@ var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
|
18624
18388
|
"aria-label": isVisible ? translation("hideColumn") : translation("showColumn"),
|
|
18625
18389
|
children: isVisible ? /* @__PURE__ */ jsx84(Eye, { className: "size-4" }) : /* @__PURE__ */ jsx84(EyeOff, { className: "size-4" })
|
|
18626
18390
|
}
|
|
18627
|
-
),
|
|
18628
|
-
/* @__PURE__ */ jsx84(
|
|
18391
|
+
) }),
|
|
18392
|
+
/* @__PURE__ */ jsx84(Visibility, { isVisible: enableColumnPinning, children: /* @__PURE__ */ jsx84(
|
|
18629
18393
|
IconButton,
|
|
18630
18394
|
{
|
|
18631
18395
|
tooltip: translation("changePinning"),
|
|
@@ -18643,7 +18407,7 @@ var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
|
18643
18407
|
"aria-label": isPinned ? translation("unpin") : translation("pinLeft"),
|
|
18644
18408
|
children: !isPinned ? /* @__PURE__ */ jsx84(PinOff, { className: "size-4" }) : /* @__PURE__ */ jsx84(Pin, { className: "size-4" })
|
|
18645
18409
|
}
|
|
18646
|
-
)
|
|
18410
|
+
) })
|
|
18647
18411
|
] })
|
|
18648
18412
|
] }, columnId);
|
|
18649
18413
|
}) })
|
|
@@ -18661,7 +18425,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
18661
18425
|
color: "neutral",
|
|
18662
18426
|
tooltip: translation("changeColumnDisplay"),
|
|
18663
18427
|
...buttonProps,
|
|
18664
|
-
children: /* @__PURE__ */ jsx84(
|
|
18428
|
+
children: /* @__PURE__ */ jsx84(Columns3Cog, { className: "size-5" })
|
|
18665
18429
|
}
|
|
18666
18430
|
) }),
|
|
18667
18431
|
/* @__PURE__ */ jsx84(TableColumnSwitcherPopUp, { ...props })
|
|
@@ -18672,7 +18436,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
18672
18436
|
import { forwardRef as forwardRef26 } from "react";
|
|
18673
18437
|
|
|
18674
18438
|
// src/components/user-interaction/Combobox/ComboboxRoot.tsx
|
|
18675
|
-
import { useCallback as useCallback39, useId as useId20, useMemo as
|
|
18439
|
+
import { useCallback as useCallback39, useId as useId20, useMemo as useMemo39, useState as useState35 } from "react";
|
|
18676
18440
|
|
|
18677
18441
|
// src/components/user-interaction/Combobox/ComboboxContext.tsx
|
|
18678
18442
|
import { createContext as createContext17, useContext as useContext19 } from "react";
|
|
@@ -18686,7 +18450,7 @@ function useComboboxContext() {
|
|
|
18686
18450
|
}
|
|
18687
18451
|
|
|
18688
18452
|
// src/components/user-interaction/Combobox/useCombobox.ts
|
|
18689
|
-
import { useCallback as useCallback38, useMemo as
|
|
18453
|
+
import { useCallback as useCallback38, useMemo as useMemo38 } from "react";
|
|
18690
18454
|
function useCombobox({
|
|
18691
18455
|
options,
|
|
18692
18456
|
searchQuery: controlledSearchQuery,
|
|
@@ -18703,11 +18467,11 @@ function useCombobox({
|
|
|
18703
18467
|
searchQuery: searchQuery ?? "",
|
|
18704
18468
|
toTags: useCallback38((o) => [o.label], [])
|
|
18705
18469
|
});
|
|
18706
|
-
const visibleOptionIds =
|
|
18470
|
+
const visibleOptionIds = useMemo38(
|
|
18707
18471
|
() => visibleOptions.map((o) => o.id),
|
|
18708
18472
|
[visibleOptions]
|
|
18709
18473
|
);
|
|
18710
|
-
const enabledOptionIds =
|
|
18474
|
+
const enabledOptionIds = useMemo38(
|
|
18711
18475
|
() => visibleOptions.filter((o) => !o.disabled).map((o) => o.id),
|
|
18712
18476
|
[visibleOptions]
|
|
18713
18477
|
);
|
|
@@ -18719,18 +18483,18 @@ function useCombobox({
|
|
|
18719
18483
|
},
|
|
18720
18484
|
[enabledOptionIds, listNav]
|
|
18721
18485
|
);
|
|
18722
|
-
const state =
|
|
18486
|
+
const state = useMemo38(
|
|
18723
18487
|
() => ({
|
|
18724
18488
|
searchQuery: searchQuery ?? "",
|
|
18725
18489
|
highlightedId: listNav.highlightedId
|
|
18726
18490
|
}),
|
|
18727
18491
|
[searchQuery, listNav.highlightedId]
|
|
18728
18492
|
);
|
|
18729
|
-
const computedState =
|
|
18493
|
+
const computedState = useMemo38(
|
|
18730
18494
|
() => ({ visibleOptionIds }),
|
|
18731
18495
|
[visibleOptionIds]
|
|
18732
18496
|
);
|
|
18733
|
-
const actions =
|
|
18497
|
+
const actions = useMemo38(
|
|
18734
18498
|
() => ({
|
|
18735
18499
|
setSearchQuery,
|
|
18736
18500
|
highlightFirst: listNav.first,
|
|
@@ -18741,7 +18505,7 @@ function useCombobox({
|
|
|
18741
18505
|
}),
|
|
18742
18506
|
[setSearchQuery, listNav.first, listNav.last, listNav.next, listNav.previous, highlightItem]
|
|
18743
18507
|
);
|
|
18744
|
-
return
|
|
18508
|
+
return useMemo38(
|
|
18745
18509
|
() => ({
|
|
18746
18510
|
...state,
|
|
18747
18511
|
...computedState,
|
|
@@ -18758,10 +18522,10 @@ function ComboboxRoot({
|
|
|
18758
18522
|
onItemClick,
|
|
18759
18523
|
...hookProps
|
|
18760
18524
|
}) {
|
|
18761
|
-
const [options, setOptions] =
|
|
18762
|
-
const [listRef, setListRef] =
|
|
18525
|
+
const [options, setOptions] = useState35([]);
|
|
18526
|
+
const [listRef, setListRef] = useState35(null);
|
|
18763
18527
|
const generatedId = useId20();
|
|
18764
|
-
const [ids, setIds] =
|
|
18528
|
+
const [ids, setIds] = useState35({
|
|
18765
18529
|
trigger: `combobox-${generatedId}`,
|
|
18766
18530
|
listbox: `combobox-${generatedId}-listbox`
|
|
18767
18531
|
});
|
|
@@ -18781,7 +18545,7 @@ function ComboboxRoot({
|
|
|
18781
18545
|
setListRef(() => ref);
|
|
18782
18546
|
return () => setListRef(null);
|
|
18783
18547
|
}, []);
|
|
18784
|
-
const hookOptions =
|
|
18548
|
+
const hookOptions = useMemo39(
|
|
18785
18549
|
() => options.map((o) => ({
|
|
18786
18550
|
id: o.id,
|
|
18787
18551
|
label: o.label,
|
|
@@ -18790,7 +18554,7 @@ function ComboboxRoot({
|
|
|
18790
18554
|
[options]
|
|
18791
18555
|
);
|
|
18792
18556
|
const state = useCombobox({ ...hookProps, options: hookOptions });
|
|
18793
|
-
const idToOptionMap =
|
|
18557
|
+
const idToOptionMap = useMemo39(() => {
|
|
18794
18558
|
return options.reduce((acc, o) => {
|
|
18795
18559
|
acc[o.id] = o;
|
|
18796
18560
|
return acc;
|
|
@@ -18803,25 +18567,25 @@ function ComboboxRoot({
|
|
|
18803
18567
|
},
|
|
18804
18568
|
[idToOptionMap, onItemClick]
|
|
18805
18569
|
);
|
|
18806
|
-
const config =
|
|
18570
|
+
const config = useMemo39(
|
|
18807
18571
|
() => ({ ids, setIds }),
|
|
18808
18572
|
[ids, setIds]
|
|
18809
18573
|
);
|
|
18810
|
-
const layout =
|
|
18574
|
+
const layout = useMemo39(
|
|
18811
18575
|
() => ({
|
|
18812
18576
|
listRef: listRef ?? { current: null },
|
|
18813
18577
|
registerList
|
|
18814
18578
|
}),
|
|
18815
18579
|
[listRef, registerList]
|
|
18816
18580
|
);
|
|
18817
|
-
const search =
|
|
18581
|
+
const search = useMemo39(
|
|
18818
18582
|
() => ({
|
|
18819
18583
|
searchQuery: state.searchQuery,
|
|
18820
18584
|
setSearchQuery: state.setSearchQuery
|
|
18821
18585
|
}),
|
|
18822
18586
|
[state.searchQuery, state.setSearchQuery]
|
|
18823
18587
|
);
|
|
18824
|
-
const contextValue =
|
|
18588
|
+
const contextValue = useMemo39(
|
|
18825
18589
|
() => ({
|
|
18826
18590
|
highlightedId: state.highlightedId,
|
|
18827
18591
|
options,
|
|
@@ -18918,7 +18682,7 @@ var ComboboxInput = forwardRef24(
|
|
|
18918
18682
|
);
|
|
18919
18683
|
|
|
18920
18684
|
// src/components/user-interaction/Combobox/ComboboxList.tsx
|
|
18921
|
-
import { forwardRef as forwardRef25, useEffect as
|
|
18685
|
+
import { forwardRef as forwardRef25, useEffect as useEffect44, useRef as useRef36 } from "react";
|
|
18922
18686
|
import clsx31 from "clsx";
|
|
18923
18687
|
import { jsx as jsx87, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
18924
18688
|
var ComboboxList = forwardRef25(
|
|
@@ -18927,8 +18691,8 @@ var ComboboxList = forwardRef25(
|
|
|
18927
18691
|
const context = useComboboxContext();
|
|
18928
18692
|
const { layout } = context;
|
|
18929
18693
|
const { registerList } = layout;
|
|
18930
|
-
const innerRef =
|
|
18931
|
-
|
|
18694
|
+
const innerRef = useRef36(null);
|
|
18695
|
+
useEffect44(() => {
|
|
18932
18696
|
return registerList(innerRef);
|
|
18933
18697
|
}, [registerList]);
|
|
18934
18698
|
const setRefs = (node) => {
|
|
@@ -18995,7 +18759,7 @@ var Combobox = forwardRef26(function Combobox2({
|
|
|
18995
18759
|
});
|
|
18996
18760
|
|
|
18997
18761
|
// src/components/user-interaction/Combobox/ComboboxOption.tsx
|
|
18998
|
-
import { forwardRef as forwardRef27, useEffect as
|
|
18762
|
+
import { forwardRef as forwardRef27, useEffect as useEffect45, useId as useId21, useRef as useRef37 } from "react";
|
|
18999
18763
|
import clsx32 from "clsx";
|
|
19000
18764
|
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
19001
18765
|
var ComboboxOption = forwardRef27(function ComboboxOption2({
|
|
@@ -19009,11 +18773,11 @@ var ComboboxOption = forwardRef27(function ComboboxOption2({
|
|
|
19009
18773
|
}, ref) {
|
|
19010
18774
|
const context = useComboboxContext();
|
|
19011
18775
|
const { registerOption } = context;
|
|
19012
|
-
const itemRef =
|
|
18776
|
+
const itemRef = useRef37(null);
|
|
19013
18777
|
const generatedId = useId21();
|
|
19014
18778
|
const optionId = idProp ?? `combobox-option-${generatedId}`;
|
|
19015
18779
|
const resolvedDisplay = children ?? label;
|
|
19016
|
-
|
|
18780
|
+
useEffect45(() => {
|
|
19017
18781
|
return registerOption({
|
|
19018
18782
|
id: optionId,
|
|
19019
18783
|
value,
|
|
@@ -19023,7 +18787,7 @@ var ComboboxOption = forwardRef27(function ComboboxOption2({
|
|
|
19023
18787
|
ref: itemRef
|
|
19024
18788
|
});
|
|
19025
18789
|
}, [optionId, value, label, resolvedDisplay, disabled, registerOption]);
|
|
19026
|
-
|
|
18790
|
+
useEffect45(() => {
|
|
19027
18791
|
if (context.highlightedId === optionId) {
|
|
19028
18792
|
itemRef.current?.scrollIntoView?.({ behavior: "smooth", block: "nearest" });
|
|
19029
18793
|
}
|
|
@@ -19069,7 +18833,7 @@ var ComboboxOption = forwardRef27(function ComboboxOption2({
|
|
|
19069
18833
|
ComboboxOption.displayName = "ComboboxOption";
|
|
19070
18834
|
|
|
19071
18835
|
// src/components/user-interaction/CopyToClipboardWrapper.tsx
|
|
19072
|
-
import { useState as
|
|
18836
|
+
import { useState as useState36 } from "react";
|
|
19073
18837
|
import { clsx as clsx33 } from "clsx";
|
|
19074
18838
|
|
|
19075
18839
|
// src/utils/writeToClipboard.ts
|
|
@@ -19092,7 +18856,7 @@ var CopyToClipboardWrapper = ({
|
|
|
19092
18856
|
...props
|
|
19093
18857
|
}) => {
|
|
19094
18858
|
const translation = useHightideTranslation();
|
|
19095
|
-
const [isShowingConfirmation, setIsShowingConfirmation] =
|
|
18859
|
+
const [isShowingConfirmation, setIsShowingConfirmation] = useState36(false);
|
|
19096
18860
|
return /* @__PURE__ */ jsxs55(
|
|
19097
18861
|
TooltipRoot,
|
|
19098
18862
|
{
|
|
@@ -19141,7 +18905,7 @@ var CopyToClipboardWrapper = ({
|
|
|
19141
18905
|
};
|
|
19142
18906
|
|
|
19143
18907
|
// src/components/user-interaction/Menu.tsx
|
|
19144
|
-
import { useCallback as useCallback41, useRef as
|
|
18908
|
+
import { useCallback as useCallback41, useRef as useRef38, useState as useState37 } from "react";
|
|
19145
18909
|
import clsx34 from "clsx";
|
|
19146
18910
|
import { Fragment as Fragment11, jsx as jsx91, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
19147
18911
|
var MenuItem = ({
|
|
@@ -19167,8 +18931,8 @@ var Menu = ({
|
|
|
19167
18931
|
disabled = false,
|
|
19168
18932
|
...props
|
|
19169
18933
|
}) => {
|
|
19170
|
-
const triggerRef =
|
|
19171
|
-
const [isOpen, setIsOpen] =
|
|
18934
|
+
const triggerRef = useRef38(null);
|
|
18935
|
+
const [isOpen, setIsOpen] = useState37(false);
|
|
19172
18936
|
const bag = {
|
|
19173
18937
|
isOpen,
|
|
19174
18938
|
close: () => setIsOpen(false),
|
|
@@ -19198,7 +18962,7 @@ var Menu = ({
|
|
|
19198
18962
|
};
|
|
19199
18963
|
|
|
19200
18964
|
// src/components/user-interaction/MultiSelect/MultiSelectChipDisplay.tsx
|
|
19201
|
-
import { forwardRef as forwardRef28, useEffect as
|
|
18965
|
+
import { forwardRef as forwardRef28, useEffect as useEffect46, useImperativeHandle as useImperativeHandle15, useRef as useRef39 } from "react";
|
|
19202
18966
|
import { XIcon as XIcon3, Plus } from "lucide-react";
|
|
19203
18967
|
import { jsx as jsx92, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
19204
18968
|
var MultiSelectChipDisplayButton = forwardRef28(function MultiSelectChipDisplayButton2({ id, ...props }, ref) {
|
|
@@ -19207,12 +18971,12 @@ var MultiSelectChipDisplayButton = forwardRef28(function MultiSelectChipDisplayB
|
|
|
19207
18971
|
const { config, layout } = context;
|
|
19208
18972
|
const { setIds } = config;
|
|
19209
18973
|
const { registerTrigger } = layout;
|
|
19210
|
-
|
|
18974
|
+
useEffect46(() => {
|
|
19211
18975
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
19212
18976
|
}, [id, setIds]);
|
|
19213
|
-
const innerRef =
|
|
18977
|
+
const innerRef = useRef39(null);
|
|
19214
18978
|
useImperativeHandle15(ref, () => innerRef.current);
|
|
19215
|
-
|
|
18979
|
+
useEffect46(() => {
|
|
19216
18980
|
const unregister = registerTrigger(innerRef);
|
|
19217
18981
|
return () => unregister();
|
|
19218
18982
|
}, [registerTrigger]);
|
|
@@ -19302,7 +19066,7 @@ var MultiSelectChipDisplay = forwardRef28(
|
|
|
19302
19066
|
);
|
|
19303
19067
|
|
|
19304
19068
|
// src/components/user-interaction/ScrollPicker.tsx
|
|
19305
|
-
import { useCallback as useCallback42, useEffect as
|
|
19069
|
+
import { useCallback as useCallback42, useEffect as useEffect47, useState as useState38 } from "react";
|
|
19306
19070
|
import clsx35 from "clsx";
|
|
19307
19071
|
import { jsx as jsx93, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
19308
19072
|
var up = 1;
|
|
@@ -19323,7 +19087,7 @@ var ScrollPicker = ({
|
|
|
19323
19087
|
transition,
|
|
19324
19088
|
items,
|
|
19325
19089
|
lastTimeStamp
|
|
19326
|
-
}, setAnimation] =
|
|
19090
|
+
}, setAnimation] = useState38({
|
|
19327
19091
|
targetIndex: selectedIndex,
|
|
19328
19092
|
currentIndex: disabled ? selectedIndex : 0,
|
|
19329
19093
|
velocity: 0,
|
|
@@ -19422,7 +19186,7 @@ var ScrollPicker = ({
|
|
|
19422
19186
|
};
|
|
19423
19187
|
});
|
|
19424
19188
|
}, [disabled, getDirection, onChange]);
|
|
19425
|
-
|
|
19189
|
+
useEffect47(() => {
|
|
19426
19190
|
requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp));
|
|
19427
19191
|
});
|
|
19428
19192
|
const opacity = (transition2, index, itemsCount) => {
|
|
@@ -19644,20 +19408,20 @@ var TextareaWithHeadline = ({
|
|
|
19644
19408
|
};
|
|
19645
19409
|
|
|
19646
19410
|
// src/components/user-interaction/data/FilterList.tsx
|
|
19647
|
-
import { useMemo as
|
|
19411
|
+
import { useMemo as useMemo40, useState as useState39 } from "react";
|
|
19648
19412
|
import { PlusIcon } from "lucide-react";
|
|
19649
|
-
import { jsx as jsx96, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
19413
|
+
import { Fragment as Fragment12, jsx as jsx96, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
19650
19414
|
var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
19651
19415
|
const translation = useHightideTranslation();
|
|
19652
19416
|
const filterValueToLabel = useFilterValueTranslation();
|
|
19653
|
-
const activeIds =
|
|
19654
|
-
const inactiveItems =
|
|
19655
|
-
const itemRecord =
|
|
19417
|
+
const activeIds = useMemo40(() => value.map((item) => item.id), [value]);
|
|
19418
|
+
const inactiveItems = useMemo40(() => availableItems.filter((item) => !activeIds.includes(item.id)).sort((a, b) => a.label.localeCompare(b.label)), [availableItems, activeIds]);
|
|
19419
|
+
const itemRecord = useMemo40(() => availableItems.reduce((acc, item) => {
|
|
19656
19420
|
acc[item.id] = item;
|
|
19657
19421
|
return acc;
|
|
19658
19422
|
}, {}), [availableItems]);
|
|
19659
|
-
const [editState, setEditState] =
|
|
19660
|
-
const valueWithEditState =
|
|
19423
|
+
const [editState, setEditState] = useState39(void 0);
|
|
19424
|
+
const valueWithEditState = useMemo40(() => {
|
|
19661
19425
|
let foundEditValue = false;
|
|
19662
19426
|
for (const item of value) {
|
|
19663
19427
|
if (item.id === editState?.id) {
|
|
@@ -19670,9 +19434,9 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19670
19434
|
}
|
|
19671
19435
|
return value;
|
|
19672
19436
|
}, [value, editState]);
|
|
19673
|
-
return /* @__PURE__ */ jsxs60("div", { className: "flex-row-
|
|
19437
|
+
return /* @__PURE__ */ jsxs60("div", { className: "flex-row-2 flex-wrap gap-y-2", children: [
|
|
19674
19438
|
/* @__PURE__ */ jsxs60(PopUpRoot, { children: [
|
|
19675
|
-
/* @__PURE__ */ jsx96(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ jsxs60(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "sm", children: [
|
|
19439
|
+
/* @__PURE__ */ jsx96(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ jsxs60(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "sm", className: "min-w-36", children: [
|
|
19676
19440
|
translation("addFilter"),
|
|
19677
19441
|
/* @__PURE__ */ jsx96(PlusIcon, { className: "size-4" })
|
|
19678
19442
|
] }) }),
|
|
@@ -19721,11 +19485,11 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19721
19485
|
}
|
|
19722
19486
|
},
|
|
19723
19487
|
children: [
|
|
19724
|
-
/* @__PURE__ */ jsx96(PopUpOpener, { children: ({ toggleOpen, props
|
|
19725
|
-
|
|
19726
|
-
|
|
19727
|
-
] }) }),
|
|
19728
|
-
|
|
19488
|
+
/* @__PURE__ */ jsx96(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ jsx96(Button, { ...props, onClick: toggleOpen, color: "primary", coloringStyle: "tonal-outline", size: "sm", children: item.activeLabelBuilder ? item.activeLabelBuilder(columnFilter.value) : /* @__PURE__ */ jsxs60(Fragment12, { children: [
|
|
19489
|
+
/* @__PURE__ */ jsx96("span", { className: "font-bold", children: item.label }),
|
|
19490
|
+
filterValueToLabel(columnFilter.value, { tags: item.tags })
|
|
19491
|
+
] }) }) }),
|
|
19492
|
+
/* @__PURE__ */ jsx96(PopUpContext.Consumer, { children: ({ isOpen, setIsOpen }) => item.popUpBuilder ? item.popUpBuilder({
|
|
19729
19493
|
value: editState?.id === columnFilter.id ? editState.value : columnFilter.value,
|
|
19730
19494
|
onValueChange: (value2) => setEditState({ ...columnFilter, value: value2 }),
|
|
19731
19495
|
onRemove: () => {
|
|
@@ -19737,7 +19501,7 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19737
19501
|
name: item.label,
|
|
19738
19502
|
isOpen,
|
|
19739
19503
|
close: () => setIsOpen(false)
|
|
19740
|
-
})
|
|
19504
|
+
}) : /* @__PURE__ */ jsx96(
|
|
19741
19505
|
FilterPopUp,
|
|
19742
19506
|
{
|
|
19743
19507
|
name: item.label,
|
|
@@ -19750,9 +19514,10 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19750
19514
|
onRemove: () => {
|
|
19751
19515
|
onValueChange(value.filter((prevItem) => prevItem.id !== columnFilter.id));
|
|
19752
19516
|
setEditState(void 0);
|
|
19753
|
-
}
|
|
19517
|
+
},
|
|
19518
|
+
onClose: () => setIsOpen(false)
|
|
19754
19519
|
}
|
|
19755
|
-
)
|
|
19520
|
+
) })
|
|
19756
19521
|
]
|
|
19757
19522
|
},
|
|
19758
19523
|
columnFilter.id
|
|
@@ -19761,8 +19526,142 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19761
19526
|
] });
|
|
19762
19527
|
};
|
|
19763
19528
|
|
|
19529
|
+
// src/components/user-interaction/data/SortingList.tsx
|
|
19530
|
+
import { useMemo as useMemo41 } from "react";
|
|
19531
|
+
import { ArrowDownWideNarrow, ArrowUpNarrowWide, PlusIcon as PlusIcon2, TrashIcon as TrashIcon2, XIcon as XIcon4 } from "lucide-react";
|
|
19532
|
+
import clsx37 from "clsx";
|
|
19533
|
+
import { jsx as jsx97, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
19534
|
+
var SortingList = ({ sorting, onSortingChange, availableItems }) => {
|
|
19535
|
+
const translation = useHightideTranslation();
|
|
19536
|
+
const activeIds = useMemo41(() => sorting.map((item) => item.id), [sorting]);
|
|
19537
|
+
const inactiveItems = useMemo41(
|
|
19538
|
+
() => availableItems.filter((item) => !activeIds.includes(item.id)).sort((a, b) => a.label.localeCompare(b.label)),
|
|
19539
|
+
[availableItems, activeIds]
|
|
19540
|
+
);
|
|
19541
|
+
const itemRecord = useMemo41(
|
|
19542
|
+
() => availableItems.reduce(
|
|
19543
|
+
(acc, item) => {
|
|
19544
|
+
acc[item.id] = item;
|
|
19545
|
+
return acc;
|
|
19546
|
+
},
|
|
19547
|
+
{}
|
|
19548
|
+
),
|
|
19549
|
+
[availableItems]
|
|
19550
|
+
);
|
|
19551
|
+
const setSortDirection = (columnId, desc) => {
|
|
19552
|
+
onSortingChange(sorting.map((s) => s.id === columnId ? { ...s, desc } : s));
|
|
19553
|
+
};
|
|
19554
|
+
const removeSort = (columnId) => {
|
|
19555
|
+
onSortingChange(sorting.filter((s) => s.id !== columnId));
|
|
19556
|
+
};
|
|
19557
|
+
return /* @__PURE__ */ jsxs61("div", { className: "flex-row-2 flex-wrap gap-y-2", children: [
|
|
19558
|
+
/* @__PURE__ */ jsxs61(PopUpRoot, { children: [
|
|
19559
|
+
/* @__PURE__ */ jsx97(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ jsxs61(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "sm", className: "min-w-36", children: [
|
|
19560
|
+
translation("addSorting"),
|
|
19561
|
+
/* @__PURE__ */ jsx97(PlusIcon2, { className: "size-4" })
|
|
19562
|
+
] }) }),
|
|
19563
|
+
/* @__PURE__ */ jsx97(PopUp, { className: "flex-col-2 p-2", children: /* @__PURE__ */ jsx97(PopUpContext.Consumer, { children: ({ setIsOpen }) => /* @__PURE__ */ jsx97(
|
|
19564
|
+
Combobox,
|
|
19565
|
+
{
|
|
19566
|
+
onItemClick: (id) => {
|
|
19567
|
+
const item = itemRecord[id];
|
|
19568
|
+
if (!item) return;
|
|
19569
|
+
onSortingChange([...sorting, { id: item.id, desc: false }]);
|
|
19570
|
+
setIsOpen(false);
|
|
19571
|
+
},
|
|
19572
|
+
children: inactiveItems.map((item) => /* @__PURE__ */ jsxs61(ComboboxOption, { value: item.id, label: item.label, children: [
|
|
19573
|
+
DataTypeUtils.toIcon(item.dataType),
|
|
19574
|
+
item.label
|
|
19575
|
+
] }, item.id))
|
|
19576
|
+
}
|
|
19577
|
+
) }) })
|
|
19578
|
+
] }),
|
|
19579
|
+
sorting.map((columnSort) => {
|
|
19580
|
+
const item = itemRecord[columnSort.id];
|
|
19581
|
+
if (!item) return null;
|
|
19582
|
+
return /* @__PURE__ */ jsxs61(PopUpRoot, { children: [
|
|
19583
|
+
/* @__PURE__ */ jsx97(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ jsxs61(Button, { ...props, onClick: toggleOpen, color: "secondary", coloringStyle: "tonal-outline", size: "sm", children: [
|
|
19584
|
+
/* @__PURE__ */ jsx97("span", { className: "font-bold", children: item.label }),
|
|
19585
|
+
columnSort.desc ? /* @__PURE__ */ jsx97(ArrowDownWideNarrow, { className: "size-5" }) : /* @__PURE__ */ jsx97(ArrowUpNarrowWide, { className: "size-5" })
|
|
19586
|
+
] }) }),
|
|
19587
|
+
/* @__PURE__ */ jsx97(PopUpContext.Consumer, { children: ({ setIsOpen }) => /* @__PURE__ */ jsxs61(
|
|
19588
|
+
PopUp,
|
|
19589
|
+
{
|
|
19590
|
+
className: clsx37("flex-col-3 p-3 min-w-64"),
|
|
19591
|
+
onClose: () => setIsOpen(false),
|
|
19592
|
+
children: [
|
|
19593
|
+
/* @__PURE__ */ jsxs61("div", { className: "flex-row-4 justify-between w-full items-center gap-2", children: [
|
|
19594
|
+
/* @__PURE__ */ jsx97("span", { className: "typography-title-sm font-semibold", children: item.label }),
|
|
19595
|
+
/* @__PURE__ */ jsxs61("div", { className: "flex-row-0 shrink-0 items-center", children: [
|
|
19596
|
+
/* @__PURE__ */ jsx97(
|
|
19597
|
+
IconButton,
|
|
19598
|
+
{
|
|
19599
|
+
tooltip: translation("removeFilter"),
|
|
19600
|
+
onClick: () => {
|
|
19601
|
+
removeSort(columnSort.id);
|
|
19602
|
+
setIsOpen(false);
|
|
19603
|
+
},
|
|
19604
|
+
color: "negative",
|
|
19605
|
+
coloringStyle: "text",
|
|
19606
|
+
size: "sm",
|
|
19607
|
+
children: /* @__PURE__ */ jsx97(TrashIcon2, { className: "size-4" })
|
|
19608
|
+
}
|
|
19609
|
+
),
|
|
19610
|
+
/* @__PURE__ */ jsx97(
|
|
19611
|
+
IconButton,
|
|
19612
|
+
{
|
|
19613
|
+
tooltip: translation("close"),
|
|
19614
|
+
onClick: () => setIsOpen(false),
|
|
19615
|
+
color: "neutral",
|
|
19616
|
+
coloringStyle: "text",
|
|
19617
|
+
size: "sm",
|
|
19618
|
+
children: /* @__PURE__ */ jsx97(XIcon4, { className: "size-4" })
|
|
19619
|
+
}
|
|
19620
|
+
)
|
|
19621
|
+
] })
|
|
19622
|
+
] }),
|
|
19623
|
+
/* @__PURE__ */ jsxs61("div", { className: "flex-row-1 w-full gap-2", children: [
|
|
19624
|
+
/* @__PURE__ */ jsxs61(
|
|
19625
|
+
Button,
|
|
19626
|
+
{
|
|
19627
|
+
type: "button",
|
|
19628
|
+
className: "flex-1 flex-row-1 items-center justify-center gap-2",
|
|
19629
|
+
color: columnSort.desc ? "neutral" : "primary",
|
|
19630
|
+
coloringStyle: "solid",
|
|
19631
|
+
size: "md",
|
|
19632
|
+
onClick: () => setSortDirection(columnSort.id, false),
|
|
19633
|
+
children: [
|
|
19634
|
+
/* @__PURE__ */ jsx97(ArrowUpNarrowWide, { className: "size-4" }),
|
|
19635
|
+
translation("sortAsc")
|
|
19636
|
+
]
|
|
19637
|
+
}
|
|
19638
|
+
),
|
|
19639
|
+
/* @__PURE__ */ jsxs61(
|
|
19640
|
+
Button,
|
|
19641
|
+
{
|
|
19642
|
+
type: "button",
|
|
19643
|
+
className: "flex-1 flex-row-1 items-center justify-center gap-2",
|
|
19644
|
+
color: columnSort.desc ? "primary" : "neutral",
|
|
19645
|
+
coloringStyle: "solid",
|
|
19646
|
+
size: "md",
|
|
19647
|
+
onClick: () => setSortDirection(columnSort.id, true),
|
|
19648
|
+
children: [
|
|
19649
|
+
/* @__PURE__ */ jsx97(ArrowDownWideNarrow, { className: "size-4" }),
|
|
19650
|
+
translation("sortDesc")
|
|
19651
|
+
]
|
|
19652
|
+
}
|
|
19653
|
+
)
|
|
19654
|
+
] })
|
|
19655
|
+
]
|
|
19656
|
+
}
|
|
19657
|
+
) })
|
|
19658
|
+
] }, columnSort.id);
|
|
19659
|
+
})
|
|
19660
|
+
] });
|
|
19661
|
+
};
|
|
19662
|
+
|
|
19764
19663
|
// src/components/user-interaction/date/TimeDisplay.tsx
|
|
19765
|
-
import { jsx as
|
|
19664
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
19766
19665
|
var TimeDisplay = ({
|
|
19767
19666
|
date,
|
|
19768
19667
|
mode = "daysFromToday"
|
|
@@ -19799,15 +19698,80 @@ var TimeDisplay = ({
|
|
|
19799
19698
|
} else {
|
|
19800
19699
|
fullString = `${date.getDate()}. ${monthToTranslation[date.getMonth()]} ${date.getFullYear()}`;
|
|
19801
19700
|
}
|
|
19802
|
-
return /* @__PURE__ */
|
|
19701
|
+
return /* @__PURE__ */ jsx98("span", { children: fullString });
|
|
19803
19702
|
};
|
|
19804
19703
|
|
|
19704
|
+
// src/components/user-interaction/input/FlexibleDateTimeInput.tsx
|
|
19705
|
+
import { forwardRef as forwardRef30, useMemo as useMemo42, useState as useState40 } from "react";
|
|
19706
|
+
import { ClockFading, ClockPlus } from "lucide-react";
|
|
19707
|
+
import { jsx as jsx99 } from "react/jsx-runtime";
|
|
19708
|
+
var FlexibleDateTimeInput = forwardRef30(function FlexibleDateTimeInput2({
|
|
19709
|
+
defaultMode = "date",
|
|
19710
|
+
value: controlledValue,
|
|
19711
|
+
initialValue,
|
|
19712
|
+
onValueChange,
|
|
19713
|
+
fixedTime: fixedTimeOverride,
|
|
19714
|
+
actions = [],
|
|
19715
|
+
...props
|
|
19716
|
+
}, forwardedRef) {
|
|
19717
|
+
const translation = useHightideTranslation();
|
|
19718
|
+
const [value, setValue] = useControlledState({
|
|
19719
|
+
value: controlledValue,
|
|
19720
|
+
onValueChange,
|
|
19721
|
+
defaultValue: initialValue
|
|
19722
|
+
});
|
|
19723
|
+
const fixedTime = useMemo42(() => fixedTimeOverride ?? new Date(23, 59, 59, 999), [fixedTimeOverride]);
|
|
19724
|
+
const [preferredMode, setPreferredMode] = useState40(defaultMode);
|
|
19725
|
+
const mode = useMemo42(() => {
|
|
19726
|
+
if (!value) return preferredMode;
|
|
19727
|
+
if (DateUtils.sameTime(value, fixedTime, true, true)) {
|
|
19728
|
+
return "date";
|
|
19729
|
+
}
|
|
19730
|
+
return "dateTime";
|
|
19731
|
+
}, [preferredMode, value, fixedTime]);
|
|
19732
|
+
return /* @__PURE__ */ jsx99(
|
|
19733
|
+
DateTimeInput,
|
|
19734
|
+
{
|
|
19735
|
+
...props,
|
|
19736
|
+
ref: forwardedRef,
|
|
19737
|
+
mode,
|
|
19738
|
+
value,
|
|
19739
|
+
onValueChange: setValue,
|
|
19740
|
+
actions: [
|
|
19741
|
+
...actions,
|
|
19742
|
+
/* @__PURE__ */ jsx99(
|
|
19743
|
+
IconButton,
|
|
19744
|
+
{
|
|
19745
|
+
size: "sm",
|
|
19746
|
+
coloringStyle: "text",
|
|
19747
|
+
color: "neutral",
|
|
19748
|
+
tooltip: preferredMode === "date" ? translation("addTime") : translation("withoutTime"),
|
|
19749
|
+
onClick: () => {
|
|
19750
|
+
const newMode = preferredMode === "date" ? "dateTime" : "date";
|
|
19751
|
+
setPreferredMode((prev) => prev === "date" ? "dateTime" : "date");
|
|
19752
|
+
if (value) {
|
|
19753
|
+
if (newMode === "date") {
|
|
19754
|
+
setValue(DateUtils.withTime(value, fixedTime));
|
|
19755
|
+
} else {
|
|
19756
|
+
setValue(DateUtils.isLastMillisecondOfDay(value) ? new Date(value.getTime() - 1) : new Date(value.getTime() + 1));
|
|
19757
|
+
}
|
|
19758
|
+
}
|
|
19759
|
+
},
|
|
19760
|
+
children: preferredMode === "date" ? /* @__PURE__ */ jsx99(ClockPlus, { className: "size-5" }) : /* @__PURE__ */ jsx99(ClockFading, { className: "size-5" })
|
|
19761
|
+
},
|
|
19762
|
+
"date-mode"
|
|
19763
|
+
)
|
|
19764
|
+
]
|
|
19765
|
+
}
|
|
19766
|
+
);
|
|
19767
|
+
});
|
|
19768
|
+
|
|
19805
19769
|
// src/components/user-interaction/input/InsideLabelInput.tsx
|
|
19806
19770
|
import { useId as useId23 } from "react";
|
|
19807
|
-
import { forwardRef as
|
|
19808
|
-
import
|
|
19809
|
-
import { jsx as
|
|
19810
|
-
var InsideLabelInput =
|
|
19771
|
+
import { forwardRef as forwardRef31, useState as useState41 } from "react";
|
|
19772
|
+
import clsx38 from "clsx";
|
|
19773
|
+
import { jsx as jsx100, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
19774
|
+
var InsideLabelInput = forwardRef31(function InsideLabelInput2({
|
|
19811
19775
|
id: customId,
|
|
19812
19776
|
value: controlledValue,
|
|
19813
19777
|
initialValue,
|
|
@@ -19820,11 +19784,11 @@ var InsideLabelInput = forwardRef30(function InsideLabelInput2({
|
|
|
19820
19784
|
onValueChange,
|
|
19821
19785
|
defaultValue: initialValue
|
|
19822
19786
|
});
|
|
19823
|
-
const [isFocused, setIsFocused] =
|
|
19787
|
+
const [isFocused, setIsFocused] = useState41(false);
|
|
19824
19788
|
const generatedId = useId23();
|
|
19825
19789
|
const id = customId ?? generatedId;
|
|
19826
|
-
return /* @__PURE__ */
|
|
19827
|
-
/* @__PURE__ */
|
|
19790
|
+
return /* @__PURE__ */ jsxs62("div", { className: clsx38("relative"), children: [
|
|
19791
|
+
/* @__PURE__ */ jsx100(
|
|
19828
19792
|
Input,
|
|
19829
19793
|
{
|
|
19830
19794
|
...props,
|
|
@@ -19841,16 +19805,16 @@ var InsideLabelInput = forwardRef30(function InsideLabelInput2({
|
|
|
19841
19805
|
setIsFocused(false);
|
|
19842
19806
|
},
|
|
19843
19807
|
"aria-labelledby": id + "-label",
|
|
19844
|
-
className:
|
|
19808
|
+
className: clsx38("h-14 px-4 pb-2 py-6.5", props.className)
|
|
19845
19809
|
}
|
|
19846
19810
|
),
|
|
19847
|
-
/* @__PURE__ */
|
|
19811
|
+
/* @__PURE__ */ jsx100(
|
|
19848
19812
|
"label",
|
|
19849
19813
|
{
|
|
19850
19814
|
id: id + "-label",
|
|
19851
19815
|
"aria-hidden": true,
|
|
19852
19816
|
"data-display": isFocused || !!value ? "small" : "full",
|
|
19853
|
-
className:
|
|
19817
|
+
className: clsx38(
|
|
19854
19818
|
// margin left to account for the border which is ignored for absolute positions
|
|
19855
19819
|
"absolute left-4 ml-0.5 top-2 transition-all delay-25 pointer-events-none touch-none",
|
|
19856
19820
|
"data-[display=small]:top-2 data-[display=small]:h-force-4.5 data-[display=small]:typography-caption-sm data-[display=small]:overflow-y-hidden",
|
|
@@ -19864,8 +19828,8 @@ var InsideLabelInput = forwardRef30(function InsideLabelInput2({
|
|
|
19864
19828
|
|
|
19865
19829
|
// src/components/user-interaction/input/SearchBar.tsx
|
|
19866
19830
|
import { Search } from "lucide-react";
|
|
19867
|
-
import { clsx as
|
|
19868
|
-
import { jsx as
|
|
19831
|
+
import { clsx as clsx39 } from "clsx";
|
|
19832
|
+
import { jsx as jsx101, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
19869
19833
|
var SearchBar = ({
|
|
19870
19834
|
value: controlledValue,
|
|
19871
19835
|
initialValue,
|
|
@@ -19881,8 +19845,8 @@ var SearchBar = ({
|
|
|
19881
19845
|
onValueChange,
|
|
19882
19846
|
defaultValue: initialValue
|
|
19883
19847
|
});
|
|
19884
|
-
return /* @__PURE__ */
|
|
19885
|
-
/* @__PURE__ */
|
|
19848
|
+
return /* @__PURE__ */ jsxs63("div", { ...containerProps, className: clsx39("relative", containerProps?.className), children: [
|
|
19849
|
+
/* @__PURE__ */ jsx101(
|
|
19886
19850
|
Input,
|
|
19887
19851
|
{
|
|
19888
19852
|
...inputProps,
|
|
@@ -19890,10 +19854,10 @@ var SearchBar = ({
|
|
|
19890
19854
|
onValueChange: setValue,
|
|
19891
19855
|
onEditComplete: onSearch,
|
|
19892
19856
|
placeholder: inputProps.placeholder ?? translation("search"),
|
|
19893
|
-
className:
|
|
19857
|
+
className: clsx39("pr-10 w-full", inputProps.className)
|
|
19894
19858
|
}
|
|
19895
19859
|
),
|
|
19896
|
-
/* @__PURE__ */
|
|
19860
|
+
/* @__PURE__ */ jsx101(
|
|
19897
19861
|
IconButton,
|
|
19898
19862
|
{
|
|
19899
19863
|
...searchButtonProps,
|
|
@@ -19902,19 +19866,19 @@ var SearchBar = ({
|
|
|
19902
19866
|
color: "neutral",
|
|
19903
19867
|
coloringStyle: "text",
|
|
19904
19868
|
onClick: () => onSearch(value),
|
|
19905
|
-
className:
|
|
19906
|
-
children: /* @__PURE__ */
|
|
19869
|
+
className: clsx39("absolute right-1.5 top-1/2 -translate-y-1/2", searchButtonProps?.className),
|
|
19870
|
+
children: /* @__PURE__ */ jsx101(Search, { className: "w-full h-full" })
|
|
19907
19871
|
}
|
|
19908
19872
|
)
|
|
19909
19873
|
] });
|
|
19910
19874
|
};
|
|
19911
19875
|
|
|
19912
19876
|
// src/components/user-interaction/input/ToggleableInput.tsx
|
|
19913
|
-
import { forwardRef as
|
|
19877
|
+
import { forwardRef as forwardRef32, useEffect as useEffect48, useImperativeHandle as useImperativeHandle16, useRef as useRef40, useState as useState42 } from "react";
|
|
19914
19878
|
import { Pencil } from "lucide-react";
|
|
19915
|
-
import
|
|
19916
|
-
import { jsx as
|
|
19917
|
-
var ToggleableInput =
|
|
19879
|
+
import clsx40 from "clsx";
|
|
19880
|
+
import { jsx as jsx102, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
19881
|
+
var ToggleableInput = forwardRef32(function ToggleableInput2({
|
|
19918
19882
|
value: controlledValue,
|
|
19919
19883
|
initialValue,
|
|
19920
19884
|
onValueChange,
|
|
@@ -19927,16 +19891,16 @@ var ToggleableInput = forwardRef31(function ToggleableInput2({
|
|
|
19927
19891
|
onValueChange,
|
|
19928
19892
|
defaultValue: initialValue
|
|
19929
19893
|
});
|
|
19930
|
-
const [isEditing, setIsEditing] =
|
|
19931
|
-
const innerRef =
|
|
19894
|
+
const [isEditing, setIsEditing] = useState42(initialState !== "display");
|
|
19895
|
+
const innerRef = useRef40(null);
|
|
19932
19896
|
useImperativeHandle16(forwardedRef, () => innerRef.current);
|
|
19933
|
-
|
|
19897
|
+
useEffect48(() => {
|
|
19934
19898
|
if (isEditing) {
|
|
19935
19899
|
innerRef.current?.focus();
|
|
19936
19900
|
}
|
|
19937
19901
|
}, [isEditing]);
|
|
19938
|
-
return /* @__PURE__ */
|
|
19939
|
-
/* @__PURE__ */
|
|
19902
|
+
return /* @__PURE__ */ jsxs64("div", { className: clsx40("relative flex-row-2", { "flex-1": isEditing }), children: [
|
|
19903
|
+
/* @__PURE__ */ jsx102(
|
|
19940
19904
|
Input,
|
|
19941
19905
|
{
|
|
19942
19906
|
...props,
|
|
@@ -19960,9 +19924,9 @@ var ToggleableInput = forwardRef31(function ToggleableInput2({
|
|
|
19960
19924
|
"data-name": props["data-name"] ?? "togglable-input"
|
|
19961
19925
|
}
|
|
19962
19926
|
),
|
|
19963
|
-
!isEditing && /* @__PURE__ */
|
|
19964
|
-
/* @__PURE__ */
|
|
19965
|
-
/* @__PURE__ */
|
|
19927
|
+
!isEditing && /* @__PURE__ */ jsxs64("div", { className: "absolute left-0 flex-row-2 items-center pointer-events-none touch-none w-full overflow-hidden", children: [
|
|
19928
|
+
/* @__PURE__ */ jsx102("span", { className: clsx40(" truncate"), children: value }),
|
|
19929
|
+
/* @__PURE__ */ jsx102(Pencil, { className: clsx40(`size-force-4`, { "text-transparent": isEditing }) })
|
|
19966
19930
|
] })
|
|
19967
19931
|
] });
|
|
19968
19932
|
});
|
|
@@ -19971,9 +19935,9 @@ var ToggleableInput = forwardRef31(function ToggleableInput2({
|
|
|
19971
19935
|
import { Check as Check4 } from "lucide-react";
|
|
19972
19936
|
|
|
19973
19937
|
// src/components/user-interaction/properties/PropertyBase.tsx
|
|
19974
|
-
import
|
|
19938
|
+
import clsx41 from "clsx";
|
|
19975
19939
|
import { AlertTriangle, Trash, X as X3 } from "lucide-react";
|
|
19976
|
-
import { jsx as
|
|
19940
|
+
import { jsx as jsx103, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
19977
19941
|
var PropertyBase = ({
|
|
19978
19942
|
name,
|
|
19979
19943
|
children,
|
|
@@ -19992,36 +19956,36 @@ var PropertyBase = ({
|
|
|
19992
19956
|
const isClearEnabled = allowClear && !readOnly;
|
|
19993
19957
|
const isRemoveEnabled = allowRemove && !readOnly;
|
|
19994
19958
|
const showActionsContainer = isClearEnabled || isRemoveEnabled;
|
|
19995
|
-
return /* @__PURE__ */
|
|
19959
|
+
return /* @__PURE__ */ jsxs65(
|
|
19996
19960
|
"div",
|
|
19997
19961
|
{
|
|
19998
|
-
className:
|
|
19962
|
+
className: clsx41("group/property", className),
|
|
19999
19963
|
"data-name": "property-root",
|
|
20000
19964
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20001
19965
|
children: [
|
|
20002
|
-
/* @__PURE__ */
|
|
19966
|
+
/* @__PURE__ */ jsxs65(
|
|
20003
19967
|
"div",
|
|
20004
19968
|
{
|
|
20005
19969
|
"data-name": "property-title",
|
|
20006
19970
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20007
19971
|
children: [
|
|
20008
|
-
/* @__PURE__ */
|
|
20009
|
-
/* @__PURE__ */
|
|
20010
|
-
/* @__PURE__ */
|
|
19972
|
+
/* @__PURE__ */ jsx103(Tooltip, { tooltip: name, containerClassName: "min-w-0", children: /* @__PURE__ */ jsxs65("div", { className: "flex-row-1 items-center", children: [
|
|
19973
|
+
/* @__PURE__ */ jsx103("div", { "data-name": "property-title-icon", children: icon }),
|
|
19974
|
+
/* @__PURE__ */ jsx103("span", { "data-name": "property-title-text", children: name })
|
|
20011
19975
|
] }) }),
|
|
20012
|
-
invalid && /* @__PURE__ */
|
|
19976
|
+
invalid && /* @__PURE__ */ jsx103(AlertTriangle, { className: "size-force-6" })
|
|
20013
19977
|
]
|
|
20014
19978
|
}
|
|
20015
19979
|
),
|
|
20016
|
-
/* @__PURE__ */
|
|
19980
|
+
/* @__PURE__ */ jsxs65(
|
|
20017
19981
|
"div",
|
|
20018
19982
|
{
|
|
20019
19983
|
"data-name": "property-content",
|
|
20020
19984
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20021
19985
|
children: [
|
|
20022
19986
|
children({ required, hasValue, invalid }),
|
|
20023
|
-
showActionsContainer && /* @__PURE__ */
|
|
20024
|
-
isClearEnabled && /* @__PURE__ */
|
|
19987
|
+
showActionsContainer && /* @__PURE__ */ jsxs65("div", { "data-name": "property-actions", children: [
|
|
19988
|
+
isClearEnabled && /* @__PURE__ */ jsx103(
|
|
20025
19989
|
IconButton,
|
|
20026
19990
|
{
|
|
20027
19991
|
tooltip: translation("clearValue"),
|
|
@@ -20030,10 +19994,10 @@ var PropertyBase = ({
|
|
|
20030
19994
|
color: "negative",
|
|
20031
19995
|
coloringStyle: "text",
|
|
20032
19996
|
size: "sm",
|
|
20033
|
-
children: /* @__PURE__ */
|
|
19997
|
+
children: /* @__PURE__ */ jsx103(X3, { className: "size-force-5" })
|
|
20034
19998
|
}
|
|
20035
19999
|
),
|
|
20036
|
-
isRemoveEnabled && /* @__PURE__ */
|
|
20000
|
+
isRemoveEnabled && /* @__PURE__ */ jsx103(
|
|
20037
20001
|
IconButton,
|
|
20038
20002
|
{
|
|
20039
20003
|
tooltip: translation("removeProperty"),
|
|
@@ -20041,7 +20005,7 @@ var PropertyBase = ({
|
|
|
20041
20005
|
color: "negative",
|
|
20042
20006
|
coloringStyle: "text",
|
|
20043
20007
|
size: "sm",
|
|
20044
|
-
children: /* @__PURE__ */
|
|
20008
|
+
children: /* @__PURE__ */ jsx103(Trash, { className: "size-force-5" })
|
|
20045
20009
|
}
|
|
20046
20010
|
)
|
|
20047
20011
|
] })
|
|
@@ -20054,7 +20018,7 @@ var PropertyBase = ({
|
|
|
20054
20018
|
};
|
|
20055
20019
|
|
|
20056
20020
|
// src/components/user-interaction/properties/CheckboxProperty.tsx
|
|
20057
|
-
import { jsx as
|
|
20021
|
+
import { jsx as jsx104, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
20058
20022
|
var CheckboxProperty = ({
|
|
20059
20023
|
value,
|
|
20060
20024
|
onValueChange,
|
|
@@ -20063,15 +20027,15 @@ var CheckboxProperty = ({
|
|
|
20063
20027
|
...baseProps
|
|
20064
20028
|
}) => {
|
|
20065
20029
|
const translation = useHightideTranslation();
|
|
20066
|
-
return /* @__PURE__ */
|
|
20030
|
+
return /* @__PURE__ */ jsx104(
|
|
20067
20031
|
PropertyBase,
|
|
20068
20032
|
{
|
|
20069
20033
|
...baseProps,
|
|
20070
20034
|
hasValue: value !== void 0,
|
|
20071
20035
|
readOnly,
|
|
20072
|
-
icon: /* @__PURE__ */
|
|
20073
|
-
children: () => /* @__PURE__ */
|
|
20074
|
-
/* @__PURE__ */
|
|
20036
|
+
icon: /* @__PURE__ */ jsx104(Check4, { size: 24 }),
|
|
20037
|
+
children: () => /* @__PURE__ */ jsxs66("div", { className: "flex-row-2 items-center", children: [
|
|
20038
|
+
/* @__PURE__ */ jsx104(
|
|
20075
20039
|
Button,
|
|
20076
20040
|
{
|
|
20077
20041
|
color: value ? "positive" : "neutral",
|
|
@@ -20084,7 +20048,7 @@ var CheckboxProperty = ({
|
|
|
20084
20048
|
children: translation("yes")
|
|
20085
20049
|
}
|
|
20086
20050
|
),
|
|
20087
|
-
/* @__PURE__ */
|
|
20051
|
+
/* @__PURE__ */ jsx104(
|
|
20088
20052
|
Button,
|
|
20089
20053
|
{
|
|
20090
20054
|
color: !value && value !== void 0 ? "negative" : "neutral",
|
|
@@ -20104,7 +20068,7 @@ var CheckboxProperty = ({
|
|
|
20104
20068
|
|
|
20105
20069
|
// src/components/user-interaction/properties/DateProperty.tsx
|
|
20106
20070
|
import { CalendarDays } from "lucide-react";
|
|
20107
|
-
import { jsx as
|
|
20071
|
+
import { jsx as jsx105 } from "react/jsx-runtime";
|
|
20108
20072
|
var DateProperty = ({
|
|
20109
20073
|
value,
|
|
20110
20074
|
onValueChange,
|
|
@@ -20114,13 +20078,13 @@ var DateProperty = ({
|
|
|
20114
20078
|
...baseProps
|
|
20115
20079
|
}) => {
|
|
20116
20080
|
const hasValue = !!value;
|
|
20117
|
-
return /* @__PURE__ */
|
|
20081
|
+
return /* @__PURE__ */ jsx105(
|
|
20118
20082
|
PropertyBase,
|
|
20119
20083
|
{
|
|
20120
20084
|
...baseProps,
|
|
20121
20085
|
hasValue,
|
|
20122
|
-
icon: /* @__PURE__ */
|
|
20123
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
20086
|
+
icon: /* @__PURE__ */ jsx105(CalendarDays, { size: 24 }),
|
|
20087
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx105(
|
|
20124
20088
|
DateTimeInput,
|
|
20125
20089
|
{
|
|
20126
20090
|
value,
|
|
@@ -20138,7 +20102,7 @@ var DateProperty = ({
|
|
|
20138
20102
|
|
|
20139
20103
|
// src/components/user-interaction/properties/MultiSelectProperty.tsx
|
|
20140
20104
|
import { List } from "lucide-react";
|
|
20141
|
-
import { jsx as
|
|
20105
|
+
import { jsx as jsx106 } from "react/jsx-runtime";
|
|
20142
20106
|
var MultiSelectProperty = ({
|
|
20143
20107
|
children,
|
|
20144
20108
|
value,
|
|
@@ -20147,18 +20111,18 @@ var MultiSelectProperty = ({
|
|
|
20147
20111
|
...props
|
|
20148
20112
|
}) => {
|
|
20149
20113
|
const hasValue = value.length > 0;
|
|
20150
|
-
return /* @__PURE__ */
|
|
20114
|
+
return /* @__PURE__ */ jsx106(
|
|
20151
20115
|
PropertyBase,
|
|
20152
20116
|
{
|
|
20153
20117
|
...props,
|
|
20154
20118
|
hasValue,
|
|
20155
|
-
icon: /* @__PURE__ */
|
|
20156
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
20119
|
+
icon: /* @__PURE__ */ jsx106(List, { size: 24 }),
|
|
20120
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx106(
|
|
20157
20121
|
"div",
|
|
20158
20122
|
{
|
|
20159
20123
|
"data-name": "property-input-wrapper",
|
|
20160
20124
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20161
|
-
children: /* @__PURE__ */
|
|
20125
|
+
children: /* @__PURE__ */ jsx106(
|
|
20162
20126
|
MultiSelectChipDisplay,
|
|
20163
20127
|
{
|
|
20164
20128
|
value,
|
|
@@ -20185,7 +20149,7 @@ var MultiSelectProperty = ({
|
|
|
20185
20149
|
|
|
20186
20150
|
// src/components/user-interaction/properties/NumberProperty.tsx
|
|
20187
20151
|
import { Binary as Binary2 } from "lucide-react";
|
|
20188
|
-
import { jsx as
|
|
20152
|
+
import { jsx as jsx107, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
20189
20153
|
var NumberProperty = ({
|
|
20190
20154
|
value,
|
|
20191
20155
|
onValueChange,
|
|
@@ -20197,20 +20161,20 @@ var NumberProperty = ({
|
|
|
20197
20161
|
}) => {
|
|
20198
20162
|
const translation = useHightideTranslation();
|
|
20199
20163
|
const hasValue = value !== void 0;
|
|
20200
|
-
return /* @__PURE__ */
|
|
20164
|
+
return /* @__PURE__ */ jsx107(
|
|
20201
20165
|
PropertyBase,
|
|
20202
20166
|
{
|
|
20203
20167
|
...baseProps,
|
|
20204
20168
|
onValueClear,
|
|
20205
20169
|
hasValue,
|
|
20206
|
-
icon: /* @__PURE__ */
|
|
20207
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
20170
|
+
icon: /* @__PURE__ */ jsx107(Binary2, { size: 24 }),
|
|
20171
|
+
children: ({ invalid }) => /* @__PURE__ */ jsxs67(
|
|
20208
20172
|
"div",
|
|
20209
20173
|
{
|
|
20210
20174
|
"data-name": "property-input-wrapper",
|
|
20211
20175
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20212
20176
|
children: [
|
|
20213
|
-
/* @__PURE__ */
|
|
20177
|
+
/* @__PURE__ */ jsx107(
|
|
20214
20178
|
Input,
|
|
20215
20179
|
{
|
|
20216
20180
|
"data-name": "property-input",
|
|
@@ -20238,7 +20202,7 @@ var NumberProperty = ({
|
|
|
20238
20202
|
}
|
|
20239
20203
|
}
|
|
20240
20204
|
),
|
|
20241
|
-
suffix && /* @__PURE__ */
|
|
20205
|
+
suffix && /* @__PURE__ */ jsx107(
|
|
20242
20206
|
"span",
|
|
20243
20207
|
{
|
|
20244
20208
|
"data-name": "property-suffix",
|
|
@@ -20255,7 +20219,7 @@ var NumberProperty = ({
|
|
|
20255
20219
|
|
|
20256
20220
|
// src/components/user-interaction/properties/SelectProperty.tsx
|
|
20257
20221
|
import { List as List2 } from "lucide-react";
|
|
20258
|
-
import { jsx as
|
|
20222
|
+
import { jsx as jsx108, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
20259
20223
|
var SingleSelectProperty = ({
|
|
20260
20224
|
children,
|
|
20261
20225
|
value,
|
|
@@ -20264,18 +20228,18 @@ var SingleSelectProperty = ({
|
|
|
20264
20228
|
...props
|
|
20265
20229
|
}) => {
|
|
20266
20230
|
const hasValue = value !== void 0;
|
|
20267
|
-
return /* @__PURE__ */
|
|
20231
|
+
return /* @__PURE__ */ jsx108(
|
|
20268
20232
|
PropertyBase,
|
|
20269
20233
|
{
|
|
20270
20234
|
...props,
|
|
20271
20235
|
hasValue,
|
|
20272
|
-
icon: /* @__PURE__ */
|
|
20273
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
20236
|
+
icon: /* @__PURE__ */ jsx108(List2, { size: 24 }),
|
|
20237
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx108(
|
|
20274
20238
|
"div",
|
|
20275
20239
|
{
|
|
20276
20240
|
"data-name": "property-input-wrapper",
|
|
20277
20241
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20278
|
-
children: /* @__PURE__ */
|
|
20242
|
+
children: /* @__PURE__ */ jsxs68(
|
|
20279
20243
|
SelectRoot,
|
|
20280
20244
|
{
|
|
20281
20245
|
value,
|
|
@@ -20285,7 +20249,7 @@ var SingleSelectProperty = ({
|
|
|
20285
20249
|
},
|
|
20286
20250
|
disabled: props.readOnly,
|
|
20287
20251
|
children: [
|
|
20288
|
-
/* @__PURE__ */
|
|
20252
|
+
/* @__PURE__ */ jsx108(
|
|
20289
20253
|
SelectButton,
|
|
20290
20254
|
{
|
|
20291
20255
|
className: "flex-row-2 w-full items-center justify-between",
|
|
@@ -20293,7 +20257,7 @@ var SingleSelectProperty = ({
|
|
|
20293
20257
|
"data-name": "property-input"
|
|
20294
20258
|
}
|
|
20295
20259
|
),
|
|
20296
|
-
/* @__PURE__ */
|
|
20260
|
+
/* @__PURE__ */ jsx108(SelectContent, { children })
|
|
20297
20261
|
]
|
|
20298
20262
|
}
|
|
20299
20263
|
)
|
|
@@ -20303,99 +20267,382 @@ var SingleSelectProperty = ({
|
|
|
20303
20267
|
);
|
|
20304
20268
|
};
|
|
20305
20269
|
|
|
20306
|
-
// src/components/user-interaction/properties/TextProperty.tsx
|
|
20307
|
-
import { Text } from "lucide-react";
|
|
20308
|
-
import { jsx as
|
|
20309
|
-
var TextProperty = ({
|
|
20310
|
-
value,
|
|
20311
|
-
readOnly,
|
|
20312
|
-
onValueChange,
|
|
20313
|
-
onEditComplete,
|
|
20314
|
-
...baseProps
|
|
20315
|
-
}) => {
|
|
20316
|
-
const translation = useHightideTranslation();
|
|
20317
|
-
const hasValue = value !== void 0;
|
|
20318
|
-
return /* @__PURE__ */
|
|
20319
|
-
PropertyBase,
|
|
20320
|
-
{
|
|
20321
|
-
...baseProps,
|
|
20322
|
-
hasValue,
|
|
20323
|
-
icon: /* @__PURE__ */
|
|
20324
|
-
children: ({ invalid }) => /* @__PURE__ */
|
|
20325
|
-
Textarea,
|
|
20326
|
-
{
|
|
20327
|
-
"data-name": "property-input",
|
|
20328
|
-
className: "w-full",
|
|
20329
|
-
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20330
|
-
rows: 5,
|
|
20331
|
-
value: value ?? "",
|
|
20332
|
-
readOnly,
|
|
20333
|
-
placeholder: translation("text"),
|
|
20334
|
-
onValueChange: (value2) => onValueChange?.(value2),
|
|
20335
|
-
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
20336
|
-
}
|
|
20337
|
-
)
|
|
20270
|
+
// src/components/user-interaction/properties/TextProperty.tsx
|
|
20271
|
+
import { Text } from "lucide-react";
|
|
20272
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
20273
|
+
var TextProperty = ({
|
|
20274
|
+
value,
|
|
20275
|
+
readOnly,
|
|
20276
|
+
onValueChange,
|
|
20277
|
+
onEditComplete,
|
|
20278
|
+
...baseProps
|
|
20279
|
+
}) => {
|
|
20280
|
+
const translation = useHightideTranslation();
|
|
20281
|
+
const hasValue = value !== void 0;
|
|
20282
|
+
return /* @__PURE__ */ jsx109(
|
|
20283
|
+
PropertyBase,
|
|
20284
|
+
{
|
|
20285
|
+
...baseProps,
|
|
20286
|
+
hasValue,
|
|
20287
|
+
icon: /* @__PURE__ */ jsx109(Text, { size: 24 }),
|
|
20288
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx109(
|
|
20289
|
+
Textarea,
|
|
20290
|
+
{
|
|
20291
|
+
"data-name": "property-input",
|
|
20292
|
+
className: "w-full",
|
|
20293
|
+
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20294
|
+
rows: 5,
|
|
20295
|
+
value: value ?? "",
|
|
20296
|
+
readOnly,
|
|
20297
|
+
placeholder: translation("text"),
|
|
20298
|
+
onValueChange: (value2) => onValueChange?.(value2),
|
|
20299
|
+
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
20300
|
+
}
|
|
20301
|
+
)
|
|
20302
|
+
}
|
|
20303
|
+
);
|
|
20304
|
+
};
|
|
20305
|
+
|
|
20306
|
+
// src/components/utils/Polymorphic.tsx
|
|
20307
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
20308
|
+
import { forwardRef as forwardRef33 } from "react";
|
|
20309
|
+
import { jsx as jsx110 } from "react/jsx-runtime";
|
|
20310
|
+
var PolymorphicSlot = forwardRef33(function PolymorphicSlot2({
|
|
20311
|
+
children,
|
|
20312
|
+
asChild,
|
|
20313
|
+
defaultComponent = "div",
|
|
20314
|
+
...props
|
|
20315
|
+
}, ref) {
|
|
20316
|
+
const Component = asChild ? Slot : defaultComponent;
|
|
20317
|
+
return /* @__PURE__ */ jsx110(Component, { ...props, ref, children });
|
|
20318
|
+
});
|
|
20319
|
+
|
|
20320
|
+
// src/components/utils/Transition.tsx
|
|
20321
|
+
import { useEffect as useEffect49, useState as useState43 } from "react";
|
|
20322
|
+
function Transition({
|
|
20323
|
+
children,
|
|
20324
|
+
show,
|
|
20325
|
+
includeAnimation = true
|
|
20326
|
+
}) {
|
|
20327
|
+
const [isOpen, setIsOpen] = useState43(show);
|
|
20328
|
+
const [isTransitioning, setIsTransitioning] = useState43(!isOpen);
|
|
20329
|
+
const isUsingReducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : true;
|
|
20330
|
+
useEffect49(() => {
|
|
20331
|
+
setIsOpen(show);
|
|
20332
|
+
setIsTransitioning(true);
|
|
20333
|
+
}, [show]);
|
|
20334
|
+
const onAnimationEnd = () => setIsTransitioning(false);
|
|
20335
|
+
const bag = {
|
|
20336
|
+
isOpen,
|
|
20337
|
+
isTransitioning,
|
|
20338
|
+
isUsingReducedMotion,
|
|
20339
|
+
data: {
|
|
20340
|
+
"data-open": isOpen && !isTransitioning ? "" : void 0,
|
|
20341
|
+
"data-opening": isOpen && isTransitioning ? "" : void 0,
|
|
20342
|
+
"data-closing": !isOpen && isTransitioning ? "" : void 0,
|
|
20343
|
+
"data-closed": !isOpen && !isTransitioning ? "" : void 0
|
|
20344
|
+
},
|
|
20345
|
+
handlers: {
|
|
20346
|
+
onTransitionEnd: () => setIsTransitioning(false),
|
|
20347
|
+
onTransitionCancel: () => setIsTransitioning(false),
|
|
20348
|
+
onAnimationEnd: includeAnimation ? onAnimationEnd : void 0
|
|
20349
|
+
}
|
|
20350
|
+
};
|
|
20351
|
+
return BagFunctionUtil.resolve(children, bag);
|
|
20352
|
+
}
|
|
20353
|
+
|
|
20354
|
+
// src/global-contexts/HightideProvider.tsx
|
|
20355
|
+
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
20356
|
+
var HightideProvider = ({
|
|
20357
|
+
children,
|
|
20358
|
+
theme,
|
|
20359
|
+
locale,
|
|
20360
|
+
config
|
|
20361
|
+
}) => {
|
|
20362
|
+
return /* @__PURE__ */ jsx111(LocaleProvider, { ...locale, children: /* @__PURE__ */ jsx111(ThemeProvider, { ...theme, children: /* @__PURE__ */ jsx111(HightideConfigProvider, { ...config, children }) }) });
|
|
20363
|
+
};
|
|
20364
|
+
|
|
20365
|
+
// src/hooks/focus/useFocusGuards.ts
|
|
20366
|
+
import { useEffect as useEffect50 } from "react";
|
|
20367
|
+
var selectorName = "data-hw-focus-guard";
|
|
20368
|
+
function FocusGuard() {
|
|
20369
|
+
const element = document.createElement("div");
|
|
20370
|
+
element.setAttribute(selectorName, "");
|
|
20371
|
+
element.tabIndex = 0;
|
|
20372
|
+
element.style.border = "none";
|
|
20373
|
+
element.style.outline = "none";
|
|
20374
|
+
element.style.boxShadow = "none";
|
|
20375
|
+
element.style.opacity = "0";
|
|
20376
|
+
element.style.position = "fixed";
|
|
20377
|
+
element.style.pointerEvents = "none";
|
|
20378
|
+
return element;
|
|
20379
|
+
}
|
|
20380
|
+
var FocusGuardsService = class _FocusGuardsService {
|
|
20381
|
+
constructor() {
|
|
20382
|
+
this.count = 0;
|
|
20383
|
+
}
|
|
20384
|
+
static getInstance() {
|
|
20385
|
+
if (!_FocusGuardsService.instance) {
|
|
20386
|
+
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
20387
|
+
}
|
|
20388
|
+
return _FocusGuardsService.instance;
|
|
20389
|
+
}
|
|
20390
|
+
add() {
|
|
20391
|
+
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
20392
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
20393
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
20394
|
+
this.count++;
|
|
20395
|
+
}
|
|
20396
|
+
remove() {
|
|
20397
|
+
if (this.count === 1) {
|
|
20398
|
+
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
20399
|
+
}
|
|
20400
|
+
this.count--;
|
|
20401
|
+
}
|
|
20402
|
+
};
|
|
20403
|
+
var useFocusGuards = () => {
|
|
20404
|
+
useEffect50(() => {
|
|
20405
|
+
FocusGuardsService.getInstance().add();
|
|
20406
|
+
return () => {
|
|
20407
|
+
FocusGuardsService.getInstance().remove();
|
|
20408
|
+
};
|
|
20409
|
+
}, []);
|
|
20410
|
+
};
|
|
20411
|
+
|
|
20412
|
+
// src/hooks/focus/useFocusOnceVisible.ts
|
|
20413
|
+
import React5, { useEffect as useEffect51 } from "react";
|
|
20414
|
+
var useFocusOnceVisible = (ref, disable = false) => {
|
|
20415
|
+
const [hasUsedFocus, setHasUsedFocus] = React5.useState(false);
|
|
20416
|
+
useEffect51(() => {
|
|
20417
|
+
if (disable || hasUsedFocus) {
|
|
20418
|
+
return;
|
|
20419
|
+
}
|
|
20420
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
20421
|
+
if (entry.isIntersecting && !hasUsedFocus) {
|
|
20422
|
+
ref.current?.focus();
|
|
20423
|
+
setHasUsedFocus(hasUsedFocus);
|
|
20424
|
+
}
|
|
20425
|
+
}, {
|
|
20426
|
+
threshold: 0.1
|
|
20427
|
+
});
|
|
20428
|
+
if (ref.current) {
|
|
20429
|
+
observer.observe(ref.current);
|
|
20430
|
+
}
|
|
20431
|
+
return () => observer.disconnect();
|
|
20432
|
+
}, [disable, hasUsedFocus, ref]);
|
|
20433
|
+
};
|
|
20434
|
+
|
|
20435
|
+
// src/hooks/focus/useIsMounted.ts
|
|
20436
|
+
import { useEffect as useEffect52, useLayoutEffect as useLayoutEffect7, useState as useState44 } from "react";
|
|
20437
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
20438
|
+
var useIsomorphicEffect = isClient ? useLayoutEffect7 : useEffect52;
|
|
20439
|
+
var useIsMounted = () => {
|
|
20440
|
+
const [isMounted, setIsMounted] = useState44(false);
|
|
20441
|
+
useIsomorphicEffect(() => {
|
|
20442
|
+
setIsMounted(true);
|
|
20443
|
+
return () => {
|
|
20444
|
+
setIsMounted(false);
|
|
20445
|
+
};
|
|
20446
|
+
}, []);
|
|
20447
|
+
return isMounted;
|
|
20448
|
+
};
|
|
20449
|
+
|
|
20450
|
+
// src/hooks/useHandleRefs.ts
|
|
20451
|
+
import { useEffect as useEffect53, useRef as useRef41 } from "react";
|
|
20452
|
+
function useHandleRefs(handleRef) {
|
|
20453
|
+
const refs = useRef41([]);
|
|
20454
|
+
useEffect53(() => {
|
|
20455
|
+
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
20456
|
+
() => ({ current: null })
|
|
20457
|
+
);
|
|
20458
|
+
const values = Object.values(handleRef?.current ?? {});
|
|
20459
|
+
values.forEach((el, i) => {
|
|
20460
|
+
refs.current[i].current = el;
|
|
20461
|
+
});
|
|
20462
|
+
});
|
|
20463
|
+
return refs.current;
|
|
20464
|
+
}
|
|
20465
|
+
|
|
20466
|
+
// src/hooks/useLogUnstableDependencies.ts
|
|
20467
|
+
import React6 from "react";
|
|
20468
|
+
function useLogUnstableDependencies(name, value) {
|
|
20469
|
+
const prev = React6.useRef(null);
|
|
20470
|
+
React6.useEffect(() => {
|
|
20471
|
+
if (!prev.current) {
|
|
20472
|
+
prev.current = value;
|
|
20473
|
+
return;
|
|
20338
20474
|
}
|
|
20339
|
-
|
|
20475
|
+
const changes = {};
|
|
20476
|
+
for (const key of Object.keys(value)) {
|
|
20477
|
+
if (prev.current[key] !== value[key]) {
|
|
20478
|
+
changes[key] = {
|
|
20479
|
+
prev: prev.current[key],
|
|
20480
|
+
next: value[key]
|
|
20481
|
+
};
|
|
20482
|
+
}
|
|
20483
|
+
}
|
|
20484
|
+
if (Object.keys(changes).length > 0) {
|
|
20485
|
+
console.info(`[${name}] changed`, changes);
|
|
20486
|
+
}
|
|
20487
|
+
prev.current = value;
|
|
20488
|
+
});
|
|
20489
|
+
}
|
|
20490
|
+
|
|
20491
|
+
// src/hooks/useOverwritableState.ts
|
|
20492
|
+
import { useEffect as useEffect54, useState as useState45 } from "react";
|
|
20493
|
+
var useOverwritableState = (overwriteValue, onChange) => {
|
|
20494
|
+
const [state, setState] = useState45(overwriteValue);
|
|
20495
|
+
useEffect54(() => {
|
|
20496
|
+
setState(overwriteValue);
|
|
20497
|
+
}, [overwriteValue]);
|
|
20498
|
+
const onChangeWrapper = (action) => {
|
|
20499
|
+
const resolved = resolveSetState(action, state);
|
|
20500
|
+
setState(resolved);
|
|
20501
|
+
onChange?.(resolved);
|
|
20502
|
+
};
|
|
20503
|
+
return [state, onChangeWrapper];
|
|
20340
20504
|
};
|
|
20341
20505
|
|
|
20342
|
-
// src/
|
|
20343
|
-
import {
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
children,
|
|
20348
|
-
asChild,
|
|
20349
|
-
defaultComponent = "div",
|
|
20350
|
-
...props
|
|
20351
|
-
}, ref) {
|
|
20352
|
-
const Component = asChild ? Slot : defaultComponent;
|
|
20353
|
-
return /* @__PURE__ */ jsx108(Component, { ...props, ref, children });
|
|
20354
|
-
});
|
|
20506
|
+
// src/hooks/useRerender.ts
|
|
20507
|
+
import { useReducer as useReducer2 } from "react";
|
|
20508
|
+
var useRerender = () => {
|
|
20509
|
+
return useReducer2(() => ({}), {})[1];
|
|
20510
|
+
};
|
|
20355
20511
|
|
|
20356
|
-
// src/
|
|
20357
|
-
import { useEffect as useEffect55, useState as
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20364
|
-
|
|
20365
|
-
|
|
20512
|
+
// src/hooks/useUpdatingDateString.ts
|
|
20513
|
+
import { useEffect as useEffect55, useState as useState46 } from "react";
|
|
20514
|
+
var useUpdatingDateString = ({ absoluteFormat = "dateTime", localeOverride, date }) => {
|
|
20515
|
+
const { locale: contextLocale } = useLocale();
|
|
20516
|
+
const locale = localeOverride ?? contextLocale;
|
|
20517
|
+
const [dateAndTimeStrings, setDateAndTimeStrings] = useState46({
|
|
20518
|
+
compareDate: date,
|
|
20519
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20520
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20521
|
+
});
|
|
20366
20522
|
useEffect55(() => {
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20523
|
+
setDateAndTimeStrings({
|
|
20524
|
+
compareDate: date,
|
|
20525
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20526
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20527
|
+
});
|
|
20528
|
+
}, [date, absoluteFormat, locale]);
|
|
20529
|
+
useEffect55(() => {
|
|
20530
|
+
let timeoutId;
|
|
20531
|
+
const startTimer = () => {
|
|
20532
|
+
const now = /* @__PURE__ */ new Date();
|
|
20533
|
+
const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
|
|
20534
|
+
let delayInSeconds;
|
|
20535
|
+
if (diff < DateUtils.timesInSeconds.minute) {
|
|
20536
|
+
delayInSeconds = DateUtils.timesInSeconds.second;
|
|
20537
|
+
} else if (diff < DateUtils.timesInSeconds.hour) {
|
|
20538
|
+
delayInSeconds = DateUtils.timesInSeconds.minute;
|
|
20539
|
+
} else {
|
|
20540
|
+
delayInSeconds = DateUtils.timesInSeconds.hour;
|
|
20541
|
+
}
|
|
20542
|
+
timeoutId = setInterval(() => {
|
|
20543
|
+
setDateAndTimeStrings({
|
|
20544
|
+
compareDate: date,
|
|
20545
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20546
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20547
|
+
});
|
|
20548
|
+
}, delayInSeconds * 1e3 / 2);
|
|
20549
|
+
};
|
|
20550
|
+
startTimer();
|
|
20551
|
+
return () => clearInterval(timeoutId);
|
|
20552
|
+
}, [absoluteFormat, date, locale]);
|
|
20553
|
+
return {
|
|
20554
|
+
absolute: dateAndTimeStrings.absolute,
|
|
20555
|
+
relative: dateAndTimeStrings.relative
|
|
20386
20556
|
};
|
|
20387
|
-
|
|
20388
|
-
}
|
|
20557
|
+
};
|
|
20389
20558
|
|
|
20390
|
-
// src/
|
|
20391
|
-
|
|
20392
|
-
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20559
|
+
// src/utils/emailValidation.ts
|
|
20560
|
+
var validateEmail = (email) => {
|
|
20561
|
+
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
20562
|
+
};
|
|
20563
|
+
|
|
20564
|
+
// src/hooks/useValidators.ts
|
|
20565
|
+
import { useMemo as useMemo43 } from "react";
|
|
20566
|
+
var notEmpty = (value) => {
|
|
20567
|
+
if (!value) {
|
|
20568
|
+
return "notEmpty";
|
|
20569
|
+
}
|
|
20570
|
+
};
|
|
20571
|
+
var boundsValidator = (length, bounds) => {
|
|
20572
|
+
const [min, max] = bounds;
|
|
20573
|
+
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
20574
|
+
return "range";
|
|
20575
|
+
}
|
|
20576
|
+
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
20577
|
+
return "lower";
|
|
20578
|
+
}
|
|
20579
|
+
if (max !== void 0 && length !== void 0 && length > max) {
|
|
20580
|
+
return "upper";
|
|
20581
|
+
}
|
|
20582
|
+
return "none";
|
|
20583
|
+
};
|
|
20584
|
+
var lengthValidator = (value, bounds) => {
|
|
20585
|
+
const mapping = {
|
|
20586
|
+
range: "outOfRangeString",
|
|
20587
|
+
lower: "tooShort",
|
|
20588
|
+
upper: "tooLong",
|
|
20589
|
+
none: void 0
|
|
20590
|
+
};
|
|
20591
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
20592
|
+
};
|
|
20593
|
+
var selectionValidator = (value, bounds) => {
|
|
20594
|
+
const mapping = {
|
|
20595
|
+
range: "outOfRangeSelectionItems",
|
|
20596
|
+
lower: "tooFewSelectionItems",
|
|
20597
|
+
upper: "tooManySelectionItems",
|
|
20598
|
+
none: void 0
|
|
20599
|
+
};
|
|
20600
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
20601
|
+
};
|
|
20602
|
+
var emailValidator = (value) => {
|
|
20603
|
+
if (!value || !validateEmail(value)) {
|
|
20604
|
+
return "invalidEmail";
|
|
20605
|
+
}
|
|
20606
|
+
};
|
|
20607
|
+
var UseValidators = {
|
|
20608
|
+
notEmpty,
|
|
20609
|
+
length: lengthValidator,
|
|
20610
|
+
email: emailValidator,
|
|
20611
|
+
selection: selectionValidator
|
|
20612
|
+
};
|
|
20613
|
+
var useTranslatedValidators = () => {
|
|
20614
|
+
const translation = useHightideTranslation();
|
|
20615
|
+
return useMemo43(() => ({
|
|
20616
|
+
notEmpty: (value) => {
|
|
20617
|
+
const result = notEmpty(value);
|
|
20618
|
+
if (result) {
|
|
20619
|
+
return translation(result);
|
|
20620
|
+
}
|
|
20621
|
+
},
|
|
20622
|
+
length: (value, length) => {
|
|
20623
|
+
const [min, max] = length;
|
|
20624
|
+
const result = lengthValidator(value, length);
|
|
20625
|
+
if (result) {
|
|
20626
|
+
return translation(result, { min, max });
|
|
20627
|
+
}
|
|
20628
|
+
},
|
|
20629
|
+
email: (value) => {
|
|
20630
|
+
const result = emailValidator(value ?? "");
|
|
20631
|
+
if (result) {
|
|
20632
|
+
return translation(result);
|
|
20633
|
+
}
|
|
20634
|
+
},
|
|
20635
|
+
selection: (value, length) => {
|
|
20636
|
+
const [min, max] = length;
|
|
20637
|
+
const result = selectionValidator(value, length);
|
|
20638
|
+
if (result) {
|
|
20639
|
+
return translation(
|
|
20640
|
+
result,
|
|
20641
|
+
{ min, max }
|
|
20642
|
+
);
|
|
20643
|
+
}
|
|
20644
|
+
}
|
|
20645
|
+
}), [translation]);
|
|
20399
20646
|
};
|
|
20400
20647
|
|
|
20401
20648
|
// src/utils/builder.ts
|
|
@@ -20691,6 +20938,7 @@ export {
|
|
|
20691
20938
|
FilterOperatorUtils,
|
|
20692
20939
|
FilterPopUp,
|
|
20693
20940
|
FilterValueUtils,
|
|
20941
|
+
FlexibleDateTimeInput,
|
|
20694
20942
|
FocusTrap,
|
|
20695
20943
|
FocusTrapWrapper,
|
|
20696
20944
|
FormContext,
|
|
@@ -20765,6 +21013,7 @@ export {
|
|
|
20765
21013
|
SimpleSearch,
|
|
20766
21014
|
SimpleSearchWithMapping,
|
|
20767
21015
|
SingleSelectProperty,
|
|
21016
|
+
SortingList,
|
|
20768
21017
|
StepperBar,
|
|
20769
21018
|
StorageListener,
|
|
20770
21019
|
Switch,
|