@helpwave/hightide 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +1353 -1244
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1252 -1144
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -6850,6 +6850,7 @@ __export(index_exports, {
|
|
|
6850
6850
|
FilterOperatorUtils: () => FilterOperatorUtils,
|
|
6851
6851
|
FilterPopUp: () => FilterPopUp,
|
|
6852
6852
|
FilterValueUtils: () => FilterValueUtils,
|
|
6853
|
+
FlexibleDateTimeInput: () => FlexibleDateTimeInput,
|
|
6853
6854
|
FocusTrap: () => FocusTrap,
|
|
6854
6855
|
FocusTrapWrapper: () => FocusTrapWrapper,
|
|
6855
6856
|
FormContext: () => FormContext,
|
|
@@ -8297,9 +8298,9 @@ var AnchoredFloatingContainer = (0, import_react12.forwardRef)(function Floating
|
|
|
8297
8298
|
options = {},
|
|
8298
8299
|
active = true,
|
|
8299
8300
|
...props
|
|
8300
|
-
},
|
|
8301
|
+
}, forwardRef34) {
|
|
8301
8302
|
const innerRef = (0, import_react12.useRef)(null);
|
|
8302
|
-
(0, import_react12.useImperativeHandle)(
|
|
8303
|
+
(0, import_react12.useImperativeHandle)(forwardRef34, () => innerRef.current);
|
|
8303
8304
|
const position = useAnchoredPosition({
|
|
8304
8305
|
...options,
|
|
8305
8306
|
container: innerRef,
|
|
@@ -8603,6 +8604,7 @@ var hightideTranslation = {
|
|
|
8603
8604
|
"de-DE": {
|
|
8604
8605
|
"add": `Hinzuf\xFCgen`,
|
|
8605
8606
|
"addFilter": `Filter hinzuf\xFCgen`,
|
|
8607
|
+
"addTime": `Uhrzeit hinzuf\xFCgen`,
|
|
8606
8608
|
"after": `Nach`,
|
|
8607
8609
|
"age": `Alter`,
|
|
8608
8610
|
"all": `Alle`,
|
|
@@ -8963,11 +8965,13 @@ var hightideTranslation = {
|
|
|
8963
8965
|
"update": `Update`,
|
|
8964
8966
|
"value": `Wert`,
|
|
8965
8967
|
"welcome": `Willkommen`,
|
|
8968
|
+
"withoutTime": `Ohne Uhrzeit`,
|
|
8966
8969
|
"yes": `Ja`
|
|
8967
8970
|
},
|
|
8968
8971
|
"en-US": {
|
|
8969
8972
|
"add": `Add`,
|
|
8970
8973
|
"addFilter": `Add filter`,
|
|
8974
|
+
"addTime": `Add Time`,
|
|
8971
8975
|
"after": `After`,
|
|
8972
8976
|
"age": `Age`,
|
|
8973
8977
|
"all": `All`,
|
|
@@ -9328,6 +9332,7 @@ var hightideTranslation = {
|
|
|
9328
9332
|
"update": `Update`,
|
|
9329
9333
|
"value": `Value`,
|
|
9330
9334
|
"welcome": `Welcome`,
|
|
9335
|
+
"withoutTime": `Without Time`,
|
|
9331
9336
|
"yes": `Yes`
|
|
9332
9337
|
}
|
|
9333
9338
|
};
|
|
@@ -9849,7 +9854,7 @@ var TooltipDisplay = (0, import_react19.forwardRef)(function TooltipAnchoredFloa
|
|
|
9849
9854
|
isAnimated: isAnimatedOverwrite,
|
|
9850
9855
|
anchor: anchorOverwrite,
|
|
9851
9856
|
...props
|
|
9852
|
-
},
|
|
9857
|
+
}, forwardRef34) {
|
|
9853
9858
|
const { config } = useHightideConfig();
|
|
9854
9859
|
const tooltipContext = (0, import_react19.useContext)(TooltipContext);
|
|
9855
9860
|
const disabled = disabledOverwrite ?? tooltipContext?.disabled;
|
|
@@ -9865,7 +9870,7 @@ var TooltipDisplay = (0, import_react19.forwardRef)(function TooltipAnchoredFloa
|
|
|
9865
9870
|
[isAnimatedOverwrite, config.tooltip.isAnimated]
|
|
9866
9871
|
);
|
|
9867
9872
|
const container = (0, import_react21.useRef)(null);
|
|
9868
|
-
(0, import_react19.useImperativeHandle)(
|
|
9873
|
+
(0, import_react19.useImperativeHandle)(forwardRef34, () => container.current);
|
|
9869
9874
|
const isActive = !disabled && isShown;
|
|
9870
9875
|
const { isVisible, transitionState } = useTransitionState(
|
|
9871
9876
|
(0, import_react21.useMemo)(() => ({ isOpen: isShown, ref: container }), [isShown])
|
|
@@ -12113,10 +12118,10 @@ var InputDialog = ({
|
|
|
12113
12118
|
};
|
|
12114
12119
|
|
|
12115
12120
|
// src/components/user-interaction/Select/Select.tsx
|
|
12116
|
-
var
|
|
12121
|
+
var import_react57 = require("react");
|
|
12117
12122
|
|
|
12118
12123
|
// src/components/user-interaction/Select/SelectRoot.tsx
|
|
12119
|
-
var
|
|
12124
|
+
var import_react51 = require("react");
|
|
12120
12125
|
|
|
12121
12126
|
// src/components/user-interaction/Select/SelectContext.tsx
|
|
12122
12127
|
var import_react44 = require("react");
|
|
@@ -12128,7 +12133,7 @@ function useSelectContext() {
|
|
|
12128
12133
|
}
|
|
12129
12134
|
|
|
12130
12135
|
// src/components/user-interaction/Select/useSelect.ts
|
|
12131
|
-
var
|
|
12136
|
+
var import_react49 = require("react");
|
|
12132
12137
|
|
|
12133
12138
|
// src/hooks/useSingleSelection.ts
|
|
12134
12139
|
var import_react45 = require("react");
|
|
@@ -12254,217 +12259,8 @@ function useListNavigation({
|
|
|
12254
12259
|
}), [resolvedHighlightId, highlight, first, last, next, previous]);
|
|
12255
12260
|
}
|
|
12256
12261
|
|
|
12257
|
-
// src/hooks/focus/useFocusGuards.ts
|
|
12258
|
-
var import_react47 = require("react");
|
|
12259
|
-
var selectorName = "data-hw-focus-guard";
|
|
12260
|
-
function FocusGuard() {
|
|
12261
|
-
const element = document.createElement("div");
|
|
12262
|
-
element.setAttribute(selectorName, "");
|
|
12263
|
-
element.tabIndex = 0;
|
|
12264
|
-
element.style.border = "none";
|
|
12265
|
-
element.style.outline = "none";
|
|
12266
|
-
element.style.boxShadow = "none";
|
|
12267
|
-
element.style.opacity = "0";
|
|
12268
|
-
element.style.position = "fixed";
|
|
12269
|
-
element.style.pointerEvents = "none";
|
|
12270
|
-
return element;
|
|
12271
|
-
}
|
|
12272
|
-
var FocusGuardsService = class _FocusGuardsService {
|
|
12273
|
-
constructor() {
|
|
12274
|
-
this.count = 0;
|
|
12275
|
-
}
|
|
12276
|
-
static getInstance() {
|
|
12277
|
-
if (!_FocusGuardsService.instance) {
|
|
12278
|
-
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
12279
|
-
}
|
|
12280
|
-
return _FocusGuardsService.instance;
|
|
12281
|
-
}
|
|
12282
|
-
add() {
|
|
12283
|
-
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
12284
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
12285
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
12286
|
-
this.count++;
|
|
12287
|
-
}
|
|
12288
|
-
remove() {
|
|
12289
|
-
if (this.count === 1) {
|
|
12290
|
-
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
12291
|
-
}
|
|
12292
|
-
this.count--;
|
|
12293
|
-
}
|
|
12294
|
-
};
|
|
12295
|
-
var useFocusGuards = () => {
|
|
12296
|
-
(0, import_react47.useEffect)(() => {
|
|
12297
|
-
FocusGuardsService.getInstance().add();
|
|
12298
|
-
return () => {
|
|
12299
|
-
FocusGuardsService.getInstance().remove();
|
|
12300
|
-
};
|
|
12301
|
-
}, []);
|
|
12302
|
-
};
|
|
12303
|
-
|
|
12304
|
-
// src/hooks/focus/useFocusOnceVisible.ts
|
|
12305
|
-
var import_react48 = __toESM(require("react"));
|
|
12306
|
-
var useFocusOnceVisible = (ref, disable = false) => {
|
|
12307
|
-
const [hasUsedFocus, setHasUsedFocus] = import_react48.default.useState(false);
|
|
12308
|
-
(0, import_react48.useEffect)(() => {
|
|
12309
|
-
if (disable || hasUsedFocus) {
|
|
12310
|
-
return;
|
|
12311
|
-
}
|
|
12312
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
12313
|
-
if (entry.isIntersecting && !hasUsedFocus) {
|
|
12314
|
-
ref.current?.focus();
|
|
12315
|
-
setHasUsedFocus(hasUsedFocus);
|
|
12316
|
-
}
|
|
12317
|
-
}, {
|
|
12318
|
-
threshold: 0.1
|
|
12319
|
-
});
|
|
12320
|
-
if (ref.current) {
|
|
12321
|
-
observer.observe(ref.current);
|
|
12322
|
-
}
|
|
12323
|
-
return () => observer.disconnect();
|
|
12324
|
-
}, [disable, hasUsedFocus, ref]);
|
|
12325
|
-
};
|
|
12326
|
-
|
|
12327
|
-
// src/hooks/focus/useIsMounted.ts
|
|
12328
|
-
var import_react49 = require("react");
|
|
12329
|
-
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
12330
|
-
var useIsomorphicEffect = isClient ? import_react49.useLayoutEffect : import_react49.useEffect;
|
|
12331
|
-
var useIsMounted = () => {
|
|
12332
|
-
const [isMounted, setIsMounted] = (0, import_react49.useState)(false);
|
|
12333
|
-
useIsomorphicEffect(() => {
|
|
12334
|
-
setIsMounted(true);
|
|
12335
|
-
return () => {
|
|
12336
|
-
setIsMounted(false);
|
|
12337
|
-
};
|
|
12338
|
-
}, []);
|
|
12339
|
-
return isMounted;
|
|
12340
|
-
};
|
|
12341
|
-
|
|
12342
|
-
// src/hooks/useHandleRefs.ts
|
|
12343
|
-
var import_react50 = require("react");
|
|
12344
|
-
function useHandleRefs(handleRef) {
|
|
12345
|
-
const refs = (0, import_react50.useRef)([]);
|
|
12346
|
-
(0, import_react50.useEffect)(() => {
|
|
12347
|
-
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
12348
|
-
() => ({ current: null })
|
|
12349
|
-
);
|
|
12350
|
-
const values = Object.values(handleRef?.current ?? {});
|
|
12351
|
-
values.forEach((el, i) => {
|
|
12352
|
-
refs.current[i].current = el;
|
|
12353
|
-
});
|
|
12354
|
-
});
|
|
12355
|
-
return refs.current;
|
|
12356
|
-
}
|
|
12357
|
-
|
|
12358
|
-
// src/hooks/useLogUnstableDependencies.ts
|
|
12359
|
-
var import_react51 = __toESM(require("react"));
|
|
12360
|
-
function useLogUnstableDependencies(name, value) {
|
|
12361
|
-
const prev = import_react51.default.useRef(null);
|
|
12362
|
-
import_react51.default.useEffect(() => {
|
|
12363
|
-
if (!prev.current) {
|
|
12364
|
-
prev.current = value;
|
|
12365
|
-
return;
|
|
12366
|
-
}
|
|
12367
|
-
const changes = {};
|
|
12368
|
-
for (const key of Object.keys(value)) {
|
|
12369
|
-
if (prev.current[key] !== value[key]) {
|
|
12370
|
-
changes[key] = {
|
|
12371
|
-
prev: prev.current[key],
|
|
12372
|
-
next: value[key]
|
|
12373
|
-
};
|
|
12374
|
-
}
|
|
12375
|
-
}
|
|
12376
|
-
if (Object.keys(changes).length > 0) {
|
|
12377
|
-
console.info(`[${name}] changed`, changes);
|
|
12378
|
-
}
|
|
12379
|
-
prev.current = value;
|
|
12380
|
-
});
|
|
12381
|
-
}
|
|
12382
|
-
|
|
12383
|
-
// src/hooks/useMultiSelection.ts
|
|
12384
|
-
var import_react52 = require("react");
|
|
12385
|
-
function useMultiSelection({
|
|
12386
|
-
options: optionsList,
|
|
12387
|
-
value,
|
|
12388
|
-
onSelectionChange,
|
|
12389
|
-
initialSelection = [],
|
|
12390
|
-
isControlled
|
|
12391
|
-
}) {
|
|
12392
|
-
const [selection, setSelection] = useControlledState({
|
|
12393
|
-
value,
|
|
12394
|
-
onValueChange: onSelectionChange,
|
|
12395
|
-
defaultValue: [...initialSelection],
|
|
12396
|
-
isControlled
|
|
12397
|
-
});
|
|
12398
|
-
const isSelected = (0, import_react52.useCallback)((id) => selection.includes(id), [selection]);
|
|
12399
|
-
const toggleSelection = (0, import_react52.useCallback)(
|
|
12400
|
-
(id) => {
|
|
12401
|
-
const option = optionsList.find((o) => o.id === id);
|
|
12402
|
-
if (!option || option.disabled) return;
|
|
12403
|
-
setSelection((prev) => prev.includes(id) ? prev.filter((s) => s !== id) : [...prev, id]);
|
|
12404
|
-
},
|
|
12405
|
-
[optionsList, setSelection]
|
|
12406
|
-
);
|
|
12407
|
-
const setSelectionValue = (0, import_react52.useCallback)(
|
|
12408
|
-
(next) => setSelection(Array.from(next)),
|
|
12409
|
-
[setSelection]
|
|
12410
|
-
);
|
|
12411
|
-
return (0, import_react52.useMemo)(
|
|
12412
|
-
() => ({
|
|
12413
|
-
selection,
|
|
12414
|
-
setSelection: setSelectionValue,
|
|
12415
|
-
toggleSelection,
|
|
12416
|
-
isSelected
|
|
12417
|
-
}),
|
|
12418
|
-
[selection, setSelectionValue, toggleSelection, isSelected]
|
|
12419
|
-
);
|
|
12420
|
-
}
|
|
12421
|
-
|
|
12422
|
-
// src/hooks/useOutsideClick.ts
|
|
12423
|
-
var import_react53 = require("react");
|
|
12424
|
-
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12425
|
-
(0, import_react53.useEffect)(() => {
|
|
12426
|
-
if (!active) return;
|
|
12427
|
-
const listener = (event) => {
|
|
12428
|
-
if (event.target === null) return;
|
|
12429
|
-
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
12430
|
-
return;
|
|
12431
|
-
}
|
|
12432
|
-
onOutsideClick(event);
|
|
12433
|
-
};
|
|
12434
|
-
document.addEventListener("mousedown", listener);
|
|
12435
|
-
document.addEventListener("touchstart", listener);
|
|
12436
|
-
document.addEventListener("pointerdown", listener);
|
|
12437
|
-
return () => {
|
|
12438
|
-
document.removeEventListener("mousedown", listener);
|
|
12439
|
-
document.removeEventListener("touchstart", listener);
|
|
12440
|
-
document.removeEventListener("pointerdown", listener);
|
|
12441
|
-
};
|
|
12442
|
-
}, [refs, onOutsideClick, active]);
|
|
12443
|
-
};
|
|
12444
|
-
|
|
12445
|
-
// src/hooks/useOverwritableState.ts
|
|
12446
|
-
var import_react54 = require("react");
|
|
12447
|
-
var useOverwritableState = (overwriteValue, onChange) => {
|
|
12448
|
-
const [state, setState] = (0, import_react54.useState)(overwriteValue);
|
|
12449
|
-
(0, import_react54.useEffect)(() => {
|
|
12450
|
-
setState(overwriteValue);
|
|
12451
|
-
}, [overwriteValue]);
|
|
12452
|
-
const onChangeWrapper = (action) => {
|
|
12453
|
-
const resolved = resolveSetState(action, state);
|
|
12454
|
-
setState(resolved);
|
|
12455
|
-
onChange?.(resolved);
|
|
12456
|
-
};
|
|
12457
|
-
return [state, onChangeWrapper];
|
|
12458
|
-
};
|
|
12459
|
-
|
|
12460
|
-
// src/hooks/useRerender.ts
|
|
12461
|
-
var import_react55 = require("react");
|
|
12462
|
-
var useRerender = () => {
|
|
12463
|
-
return (0, import_react55.useReducer)(() => ({}), {})[1];
|
|
12464
|
-
};
|
|
12465
|
-
|
|
12466
12262
|
// src/hooks/useSearch.ts
|
|
12467
|
-
var
|
|
12263
|
+
var import_react47 = require("react");
|
|
12468
12264
|
|
|
12469
12265
|
// src/utils/simpleSearch.ts
|
|
12470
12266
|
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
@@ -12503,18 +12299,18 @@ function useSearch({
|
|
|
12503
12299
|
}) {
|
|
12504
12300
|
const toTagsResolved = toTags ?? defaultToTags;
|
|
12505
12301
|
const toTagsStable = useEventCallbackStabilizer(toTagsResolved);
|
|
12506
|
-
const searchResult = (0,
|
|
12302
|
+
const searchResult = (0, import_react47.useMemo)(() => {
|
|
12507
12303
|
const q = searchQuery.trim().toLowerCase();
|
|
12508
12304
|
if (!q) return items;
|
|
12509
12305
|
return MultiSearchWithMapping(searchQuery, [...items], (item) => toTagsStable(item));
|
|
12510
12306
|
}, [items, searchQuery, toTagsStable]);
|
|
12511
|
-
return (0,
|
|
12307
|
+
return (0, import_react47.useMemo)(() => ({
|
|
12512
12308
|
searchResult
|
|
12513
12309
|
}), [searchResult]);
|
|
12514
12310
|
}
|
|
12515
12311
|
|
|
12516
12312
|
// src/hooks/useTypeAheadSearch.ts
|
|
12517
|
-
var
|
|
12313
|
+
var import_react48 = require("react");
|
|
12518
12314
|
function defaultToString(value) {
|
|
12519
12315
|
return String(value);
|
|
12520
12316
|
}
|
|
@@ -12524,12 +12320,12 @@ function useTypeAheadSearch({
|
|
|
12524
12320
|
toString: toStringProp,
|
|
12525
12321
|
onResultChange
|
|
12526
12322
|
}) {
|
|
12527
|
-
const bufferRef = (0,
|
|
12528
|
-
const timeoutRef = (0,
|
|
12323
|
+
const bufferRef = (0, import_react48.useRef)("");
|
|
12324
|
+
const timeoutRef = (0, import_react48.useRef)(null);
|
|
12529
12325
|
const toString = toStringProp ?? defaultToString;
|
|
12530
12326
|
const toStringStable = useEventCallbackStabilizer(toString);
|
|
12531
12327
|
const onResultChangeStable = useEventCallbackStabilizer(onResultChange);
|
|
12532
|
-
const reset = (0,
|
|
12328
|
+
const reset = (0, import_react48.useCallback)(() => {
|
|
12533
12329
|
if (timeoutRef.current) {
|
|
12534
12330
|
clearTimeout(timeoutRef.current);
|
|
12535
12331
|
timeoutRef.current = null;
|
|
@@ -12537,10 +12333,10 @@ function useTypeAheadSearch({
|
|
|
12537
12333
|
bufferRef.current = "";
|
|
12538
12334
|
onResultChangeStable(null);
|
|
12539
12335
|
}, [onResultChangeStable]);
|
|
12540
|
-
(0,
|
|
12336
|
+
(0, import_react48.useEffect)(() => () => {
|
|
12541
12337
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12542
12338
|
}, []);
|
|
12543
|
-
const addToTypeAhead = (0,
|
|
12339
|
+
const addToTypeAhead = (0, import_react48.useCallback)((str) => {
|
|
12544
12340
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12545
12341
|
bufferRef.current += str;
|
|
12546
12342
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -12562,397 +12358,43 @@ function useTypeAheadSearch({
|
|
|
12562
12358
|
return { addToTypeAhead, reset };
|
|
12563
12359
|
}
|
|
12564
12360
|
|
|
12565
|
-
// src/
|
|
12566
|
-
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
const {
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
}
|
|
12596
|
-
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
}
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
return new Date(date);
|
|
12603
|
-
}
|
|
12604
|
-
if (hours < 0 || hours > 23) {
|
|
12605
|
-
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
12606
|
-
return new Date(date);
|
|
12607
|
-
}
|
|
12608
|
-
if (minutes < 0 || minutes > 59) {
|
|
12609
|
-
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
12610
|
-
return new Date(date);
|
|
12611
|
-
}
|
|
12612
|
-
if (seconds < 0 || seconds > 59) {
|
|
12613
|
-
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
12614
|
-
return new Date(date);
|
|
12615
|
-
}
|
|
12616
|
-
if (milliseconds < 0) {
|
|
12617
|
-
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
12618
|
-
return new Date(date);
|
|
12619
|
-
}
|
|
12620
|
-
const multiplier = isAdding ? 1 : -1;
|
|
12621
|
-
const newDate = new Date(date);
|
|
12622
|
-
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
12623
|
-
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
12624
|
-
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
12625
|
-
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
12626
|
-
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
12627
|
-
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
12628
|
-
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
12629
|
-
return newDate;
|
|
12630
|
-
};
|
|
12631
|
-
var addDuration = (date, duration) => {
|
|
12632
|
-
return changeDuration(date, duration, true);
|
|
12633
|
-
};
|
|
12634
|
-
var subtractDuration = (date, duration) => {
|
|
12635
|
-
return changeDuration(date, duration, false);
|
|
12636
|
-
};
|
|
12637
|
-
var between = (value, startDate, endDate) => {
|
|
12638
|
-
if (startDate && endDate) {
|
|
12639
|
-
console.assert(startDate <= endDate);
|
|
12640
|
-
return startDate <= value && value <= endDate;
|
|
12641
|
-
} else if (startDate) {
|
|
12642
|
-
return startDate <= value;
|
|
12643
|
-
} else if (endDate) {
|
|
12644
|
-
return endDate >= value;
|
|
12645
|
-
} else {
|
|
12646
|
-
return true;
|
|
12647
|
-
}
|
|
12648
|
-
};
|
|
12649
|
-
var equalDate = (date1, date2) => {
|
|
12650
|
-
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
12651
|
-
};
|
|
12652
|
-
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
12653
|
-
const month = date.getMonth();
|
|
12654
|
-
const year = date.getFullYear();
|
|
12655
|
-
const dayList = [];
|
|
12656
|
-
let currentDate = new Date(year, month, 1);
|
|
12657
|
-
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
12658
|
-
while (currentDate.getDay() !== weekStartIndex) {
|
|
12659
|
-
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
12660
|
-
}
|
|
12661
|
-
while (dayList.length < 7 * weeks) {
|
|
12662
|
-
const date2 = new Date(currentDate);
|
|
12663
|
-
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
12664
|
-
dayList.push(date2);
|
|
12665
|
-
currentDate = addDuration(currentDate, { days: 1 });
|
|
12666
|
-
}
|
|
12667
|
-
return equalSizeGroups(dayList, 7);
|
|
12668
|
-
};
|
|
12669
|
-
var formatAbsolute = (date, locale, format) => {
|
|
12670
|
-
let options;
|
|
12671
|
-
switch (format) {
|
|
12672
|
-
case "date":
|
|
12673
|
-
options = {
|
|
12674
|
-
year: "2-digit",
|
|
12675
|
-
month: "2-digit",
|
|
12676
|
-
day: "2-digit"
|
|
12677
|
-
};
|
|
12678
|
-
break;
|
|
12679
|
-
case "time":
|
|
12680
|
-
options = {
|
|
12681
|
-
hour: "2-digit",
|
|
12682
|
-
minute: "2-digit"
|
|
12683
|
-
};
|
|
12684
|
-
break;
|
|
12685
|
-
case "dateTime":
|
|
12686
|
-
options = {
|
|
12687
|
-
year: "numeric",
|
|
12688
|
-
month: "2-digit",
|
|
12689
|
-
day: "2-digit",
|
|
12690
|
-
hour: "2-digit",
|
|
12691
|
-
minute: "2-digit"
|
|
12692
|
-
};
|
|
12693
|
-
break;
|
|
12694
|
-
}
|
|
12695
|
-
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
12696
|
-
};
|
|
12697
|
-
var formatRelative = (date, locale) => {
|
|
12698
|
-
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
12699
|
-
const now = /* @__PURE__ */ new Date();
|
|
12700
|
-
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
12701
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
12702
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
12703
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
12704
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
12705
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
12706
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
12707
|
-
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
12708
|
-
};
|
|
12709
|
-
var toInputString = (date, format, precision = "minute", isLocalTime = true) => {
|
|
12710
|
-
const pad = (n, l = 2) => String(n).padStart(l, "0");
|
|
12711
|
-
const parts = isLocalTime ? {
|
|
12712
|
-
y: date.getFullYear(),
|
|
12713
|
-
m: date.getMonth() + 1,
|
|
12714
|
-
d: date.getDate(),
|
|
12715
|
-
h: date.getHours(),
|
|
12716
|
-
min: date.getMinutes(),
|
|
12717
|
-
s: date.getSeconds(),
|
|
12718
|
-
ms: date.getMilliseconds()
|
|
12719
|
-
} : {
|
|
12720
|
-
y: date.getUTCFullYear(),
|
|
12721
|
-
m: date.getUTCMonth() + 1,
|
|
12722
|
-
d: date.getUTCDate(),
|
|
12723
|
-
h: date.getUTCHours(),
|
|
12724
|
-
min: date.getUTCMinutes(),
|
|
12725
|
-
s: date.getUTCSeconds(),
|
|
12726
|
-
ms: date.getUTCMilliseconds()
|
|
12727
|
-
};
|
|
12728
|
-
const dateStr = `${pad(parts.y, 4)}-${pad(parts.m)}-${pad(parts.d)}`;
|
|
12729
|
-
let timeStr = `${pad(parts.h)}:${pad(parts.min)}`;
|
|
12730
|
-
if (precision === "second" || precision === "millisecond") {
|
|
12731
|
-
timeStr += `:${pad(parts.s)}`;
|
|
12732
|
-
}
|
|
12733
|
-
if (precision === "millisecond") {
|
|
12734
|
-
timeStr += `.${pad(parts.ms, 3)}`;
|
|
12735
|
-
}
|
|
12736
|
-
switch (format) {
|
|
12737
|
-
case "date":
|
|
12738
|
-
return dateStr;
|
|
12739
|
-
case "time":
|
|
12740
|
-
return timeStr;
|
|
12741
|
-
case "dateTime":
|
|
12742
|
-
return `${dateStr}T${timeStr}`;
|
|
12743
|
-
}
|
|
12744
|
-
};
|
|
12745
|
-
function tryParseDate(dateValue) {
|
|
12746
|
-
if (!dateValue) return null;
|
|
12747
|
-
if (dateValue instanceof Date) return dateValue;
|
|
12748
|
-
if (typeof dateValue === "string" || typeof dateValue === "number") {
|
|
12749
|
-
const parsed = new Date(dateValue);
|
|
12750
|
-
return isNaN(parsed.getTime()) ? null : parsed;
|
|
12751
|
-
}
|
|
12752
|
-
return null;
|
|
12753
|
-
}
|
|
12754
|
-
function normalizeToDateOnly(date) {
|
|
12755
|
-
const normalized = new Date(date);
|
|
12756
|
-
normalized.setHours(0, 0, 0, 0);
|
|
12757
|
-
return normalized;
|
|
12758
|
-
}
|
|
12759
|
-
function normalizeDatetime(dateTime) {
|
|
12760
|
-
const normalized = new Date(dateTime);
|
|
12761
|
-
normalized.setSeconds(0, 0);
|
|
12762
|
-
return normalized;
|
|
12763
|
-
}
|
|
12764
|
-
var DateUtils = {
|
|
12765
|
-
monthsList,
|
|
12766
|
-
weekDayList,
|
|
12767
|
-
equalDate,
|
|
12768
|
-
formatAbsolute,
|
|
12769
|
-
formatRelative,
|
|
12770
|
-
addDuration,
|
|
12771
|
-
subtractDuration,
|
|
12772
|
-
between,
|
|
12773
|
-
weeksForCalenderMonth,
|
|
12774
|
-
timesInSeconds,
|
|
12775
|
-
toInputString,
|
|
12776
|
-
tryParseDate,
|
|
12777
|
-
toOnlyDate: normalizeToDateOnly,
|
|
12778
|
-
/**
|
|
12779
|
-
* Normalizes a datetime by removing seconds and milliseconds.
|
|
12780
|
-
*/
|
|
12781
|
-
toDateTimeOnly: normalizeDatetime
|
|
12782
|
-
};
|
|
12783
|
-
|
|
12784
|
-
// src/hooks/useUpdatingDateString.ts
|
|
12785
|
-
var useUpdatingDateString = ({ absoluteFormat = "dateTime", localeOverride, date }) => {
|
|
12786
|
-
const { locale: contextLocale } = useLocale();
|
|
12787
|
-
const locale = localeOverride ?? contextLocale;
|
|
12788
|
-
const [dateAndTimeStrings, setDateAndTimeStrings] = (0, import_react58.useState)({
|
|
12789
|
-
compareDate: date,
|
|
12790
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
12791
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
12792
|
-
});
|
|
12793
|
-
(0, import_react58.useEffect)(() => {
|
|
12794
|
-
setDateAndTimeStrings({
|
|
12795
|
-
compareDate: date,
|
|
12796
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
12797
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
12798
|
-
});
|
|
12799
|
-
}, [date, absoluteFormat, locale]);
|
|
12800
|
-
(0, import_react58.useEffect)(() => {
|
|
12801
|
-
let timeoutId;
|
|
12802
|
-
const startTimer = () => {
|
|
12803
|
-
const now = /* @__PURE__ */ new Date();
|
|
12804
|
-
const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
|
|
12805
|
-
let delayInSeconds;
|
|
12806
|
-
if (diff < DateUtils.timesInSeconds.minute) {
|
|
12807
|
-
delayInSeconds = DateUtils.timesInSeconds.second;
|
|
12808
|
-
} else if (diff < DateUtils.timesInSeconds.hour) {
|
|
12809
|
-
delayInSeconds = DateUtils.timesInSeconds.minute;
|
|
12810
|
-
} else {
|
|
12811
|
-
delayInSeconds = DateUtils.timesInSeconds.hour;
|
|
12812
|
-
}
|
|
12813
|
-
timeoutId = setInterval(() => {
|
|
12814
|
-
setDateAndTimeStrings({
|
|
12815
|
-
compareDate: date,
|
|
12816
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
12817
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
12818
|
-
});
|
|
12819
|
-
}, delayInSeconds * 1e3 / 2);
|
|
12820
|
-
};
|
|
12821
|
-
startTimer();
|
|
12822
|
-
return () => clearInterval(timeoutId);
|
|
12823
|
-
}, [absoluteFormat, date, locale]);
|
|
12824
|
-
return {
|
|
12825
|
-
absolute: dateAndTimeStrings.absolute,
|
|
12826
|
-
relative: dateAndTimeStrings.relative
|
|
12827
|
-
};
|
|
12828
|
-
};
|
|
12829
|
-
|
|
12830
|
-
// src/utils/emailValidation.ts
|
|
12831
|
-
var validateEmail = (email) => {
|
|
12832
|
-
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
12833
|
-
};
|
|
12834
|
-
|
|
12835
|
-
// src/hooks/useValidators.ts
|
|
12836
|
-
var import_react59 = require("react");
|
|
12837
|
-
var notEmpty = (value) => {
|
|
12838
|
-
if (!value) {
|
|
12839
|
-
return "notEmpty";
|
|
12840
|
-
}
|
|
12841
|
-
};
|
|
12842
|
-
var boundsValidator = (length, bounds) => {
|
|
12843
|
-
const [min, max] = bounds;
|
|
12844
|
-
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
12845
|
-
return "range";
|
|
12846
|
-
}
|
|
12847
|
-
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
12848
|
-
return "lower";
|
|
12849
|
-
}
|
|
12850
|
-
if (max !== void 0 && length !== void 0 && length > max) {
|
|
12851
|
-
return "upper";
|
|
12852
|
-
}
|
|
12853
|
-
return "none";
|
|
12854
|
-
};
|
|
12855
|
-
var lengthValidator = (value, bounds) => {
|
|
12856
|
-
const mapping = {
|
|
12857
|
-
range: "outOfRangeString",
|
|
12858
|
-
lower: "tooShort",
|
|
12859
|
-
upper: "tooLong",
|
|
12860
|
-
none: void 0
|
|
12861
|
-
};
|
|
12862
|
-
return mapping[boundsValidator(value?.length, bounds)];
|
|
12863
|
-
};
|
|
12864
|
-
var selectionValidator = (value, bounds) => {
|
|
12865
|
-
const mapping = {
|
|
12866
|
-
range: "outOfRangeSelectionItems",
|
|
12867
|
-
lower: "tooFewSelectionItems",
|
|
12868
|
-
upper: "tooManySelectionItems",
|
|
12869
|
-
none: void 0
|
|
12870
|
-
};
|
|
12871
|
-
return mapping[boundsValidator(value?.length, bounds)];
|
|
12872
|
-
};
|
|
12873
|
-
var emailValidator = (value) => {
|
|
12874
|
-
if (!value || !validateEmail(value)) {
|
|
12875
|
-
return "invalidEmail";
|
|
12876
|
-
}
|
|
12877
|
-
};
|
|
12878
|
-
var UseValidators = {
|
|
12879
|
-
notEmpty,
|
|
12880
|
-
length: lengthValidator,
|
|
12881
|
-
email: emailValidator,
|
|
12882
|
-
selection: selectionValidator
|
|
12883
|
-
};
|
|
12884
|
-
var useTranslatedValidators = () => {
|
|
12885
|
-
const translation = useHightideTranslation();
|
|
12886
|
-
return (0, import_react59.useMemo)(() => ({
|
|
12887
|
-
notEmpty: (value) => {
|
|
12888
|
-
const result = notEmpty(value);
|
|
12889
|
-
if (result) {
|
|
12890
|
-
return translation(result);
|
|
12891
|
-
}
|
|
12892
|
-
},
|
|
12893
|
-
length: (value, length) => {
|
|
12894
|
-
const [min, max] = length;
|
|
12895
|
-
const result = lengthValidator(value, length);
|
|
12896
|
-
if (result) {
|
|
12897
|
-
return translation(result, { min, max });
|
|
12898
|
-
}
|
|
12899
|
-
},
|
|
12900
|
-
email: (value) => {
|
|
12901
|
-
const result = emailValidator(value ?? "");
|
|
12902
|
-
if (result) {
|
|
12903
|
-
return translation(result);
|
|
12904
|
-
}
|
|
12905
|
-
},
|
|
12906
|
-
selection: (value, length) => {
|
|
12907
|
-
const [min, max] = length;
|
|
12908
|
-
const result = selectionValidator(value, length);
|
|
12909
|
-
if (result) {
|
|
12910
|
-
return translation(
|
|
12911
|
-
result,
|
|
12912
|
-
{ min, max }
|
|
12913
|
-
);
|
|
12914
|
-
}
|
|
12915
|
-
}
|
|
12916
|
-
}), [translation]);
|
|
12917
|
-
};
|
|
12918
|
-
|
|
12919
|
-
// src/components/user-interaction/Select/useSelect.ts
|
|
12920
|
-
function useSelect({
|
|
12921
|
-
options,
|
|
12922
|
-
value: controlledValue,
|
|
12923
|
-
onValueChange,
|
|
12924
|
-
onEditComplete,
|
|
12925
|
-
initialValue = null,
|
|
12926
|
-
onClose,
|
|
12927
|
-
onIsOpenChange,
|
|
12928
|
-
initialIsOpen = false,
|
|
12929
|
-
typeAheadResetMs = 500
|
|
12930
|
-
}) {
|
|
12931
|
-
const [isOpen, setIsOpen] = (0, import_react60.useState)(initialIsOpen);
|
|
12932
|
-
const [searchQuery, setSearchQuery] = (0, import_react60.useState)("");
|
|
12933
|
-
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
12934
|
-
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
12935
|
-
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12936
|
-
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
12937
|
-
const onSelectionChangeWrapper = (0, import_react60.useCallback)((id) => {
|
|
12938
|
-
if (id === null) return;
|
|
12939
|
-
onValueChangeStable(id);
|
|
12940
|
-
onEditCompleteStable(id);
|
|
12941
|
-
setIsOpen(false);
|
|
12942
|
-
}, [onValueChangeStable, onEditCompleteStable, setIsOpen]);
|
|
12943
|
-
const { selection, selectValue } = useSingleSelection({
|
|
12944
|
-
options,
|
|
12945
|
-
selection: controlledValue,
|
|
12946
|
-
onSelectionChange: onSelectionChangeWrapper,
|
|
12947
|
-
initialSelection: initialValue
|
|
12948
|
-
});
|
|
12949
|
-
const { searchResult: visibleOptions } = useSearch({
|
|
12950
|
-
items: options,
|
|
12951
|
-
searchQuery,
|
|
12952
|
-
toTags: (0, import_react60.useCallback)((o) => [o.label], [])
|
|
12953
|
-
});
|
|
12954
|
-
const visibleOptionIds = (0, import_react60.useMemo)(() => visibleOptions.map((o) => o.id), [visibleOptions]);
|
|
12955
|
-
const enabledOptions = (0, import_react60.useMemo)(() => visibleOptions.filter((o) => !o.disabled), [visibleOptions]);
|
|
12361
|
+
// src/components/user-interaction/Select/useSelect.ts
|
|
12362
|
+
function useSelect({
|
|
12363
|
+
options,
|
|
12364
|
+
value: controlledValue,
|
|
12365
|
+
onValueChange,
|
|
12366
|
+
onEditComplete,
|
|
12367
|
+
initialValue = null,
|
|
12368
|
+
onClose,
|
|
12369
|
+
onIsOpenChange,
|
|
12370
|
+
initialIsOpen = false,
|
|
12371
|
+
typeAheadResetMs = 500
|
|
12372
|
+
}) {
|
|
12373
|
+
const [isOpen, setIsOpen] = (0, import_react49.useState)(initialIsOpen);
|
|
12374
|
+
const [searchQuery, setSearchQuery] = (0, import_react49.useState)("");
|
|
12375
|
+
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
12376
|
+
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
12377
|
+
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12378
|
+
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
12379
|
+
const onSelectionChangeWrapper = (0, import_react49.useCallback)((id) => {
|
|
12380
|
+
if (id === null) return;
|
|
12381
|
+
onValueChangeStable(id);
|
|
12382
|
+
onEditCompleteStable(id);
|
|
12383
|
+
setIsOpen(false);
|
|
12384
|
+
}, [onValueChangeStable, onEditCompleteStable, setIsOpen]);
|
|
12385
|
+
const { selection, selectValue } = useSingleSelection({
|
|
12386
|
+
options,
|
|
12387
|
+
selection: controlledValue,
|
|
12388
|
+
onSelectionChange: onSelectionChangeWrapper,
|
|
12389
|
+
initialSelection: initialValue
|
|
12390
|
+
});
|
|
12391
|
+
const { searchResult: visibleOptions } = useSearch({
|
|
12392
|
+
items: options,
|
|
12393
|
+
searchQuery,
|
|
12394
|
+
toTags: (0, import_react49.useCallback)((o) => [o.label], [])
|
|
12395
|
+
});
|
|
12396
|
+
const visibleOptionIds = (0, import_react49.useMemo)(() => visibleOptions.map((o) => o.id), [visibleOptions]);
|
|
12397
|
+
const enabledOptions = (0, import_react49.useMemo)(() => visibleOptions.filter((o) => !o.disabled), [visibleOptions]);
|
|
12956
12398
|
const {
|
|
12957
12399
|
highlightedId,
|
|
12958
12400
|
highlight: listNavHighlight,
|
|
@@ -12968,28 +12410,28 @@ function useSelect({
|
|
|
12968
12410
|
options: enabledOptions,
|
|
12969
12411
|
resetTimer: typeAheadResetMs,
|
|
12970
12412
|
toString: (o) => o.label ?? "",
|
|
12971
|
-
onResultChange: (0,
|
|
12413
|
+
onResultChange: (0, import_react49.useCallback)((option) => {
|
|
12972
12414
|
if (option) listNavHighlight(option.id);
|
|
12973
12415
|
}, [listNavHighlight])
|
|
12974
12416
|
});
|
|
12975
|
-
(0,
|
|
12417
|
+
(0, import_react49.useEffect)(() => {
|
|
12976
12418
|
if (!isOpen) typeAheadReset();
|
|
12977
12419
|
}, [isOpen, typeAheadReset]);
|
|
12978
|
-
const state = (0,
|
|
12420
|
+
const state = (0, import_react49.useMemo)(() => ({
|
|
12979
12421
|
value: selection,
|
|
12980
12422
|
highlightedValue: highlightedId,
|
|
12981
12423
|
isOpen,
|
|
12982
12424
|
searchQuery,
|
|
12983
12425
|
options
|
|
12984
12426
|
}), [selection, highlightedId, isOpen, searchQuery, options]);
|
|
12985
|
-
const computedState = (0,
|
|
12427
|
+
const computedState = (0, import_react49.useMemo)(() => ({
|
|
12986
12428
|
visibleOptionIds
|
|
12987
12429
|
}), [visibleOptionIds]);
|
|
12988
|
-
const highlightItem = (0,
|
|
12430
|
+
const highlightItem = (0, import_react49.useCallback)((value) => {
|
|
12989
12431
|
if (!enabledOptions.some((o) => o.id === value)) return;
|
|
12990
12432
|
listNavHighlight(value);
|
|
12991
12433
|
}, [enabledOptions, listNavHighlight]);
|
|
12992
|
-
const setIsOpenWrapper = (0,
|
|
12434
|
+
const setIsOpenWrapper = (0, import_react49.useCallback)((isOpen2, behavior) => {
|
|
12993
12435
|
behavior = behavior ?? "first";
|
|
12994
12436
|
if (isOpen2) {
|
|
12995
12437
|
if (selection == null) {
|
|
@@ -13008,11 +12450,11 @@ function useSelect({
|
|
|
13008
12450
|
setIsOpen(isOpen2);
|
|
13009
12451
|
onIsOpenChangeStable(isOpen2);
|
|
13010
12452
|
}, [setIsOpen, highlightItem, onCloseStable, setSearchQuery, onIsOpenChangeStable, selection, listNavFirst, listNavLast]);
|
|
13011
|
-
const toggleOpenWrapper = (0,
|
|
12453
|
+
const toggleOpenWrapper = (0, import_react49.useCallback)((behavior) => {
|
|
13012
12454
|
const next = !isOpen;
|
|
13013
12455
|
setIsOpenWrapper(next, behavior);
|
|
13014
12456
|
}, [isOpen, setIsOpenWrapper]);
|
|
13015
|
-
const actions = (0,
|
|
12457
|
+
const actions = (0, import_react49.useMemo)(() => ({
|
|
13016
12458
|
selectValue: (id) => selectValue(id),
|
|
13017
12459
|
setIsOpen: setIsOpenWrapper,
|
|
13018
12460
|
toggleOpen: toggleOpenWrapper,
|
|
@@ -13024,7 +12466,7 @@ function useSelect({
|
|
|
13024
12466
|
highlightItem,
|
|
13025
12467
|
handleTypeaheadKey: addToTypeAhead
|
|
13026
12468
|
}), [selectValue, setIsOpenWrapper, listNavFirst, listNavLast, listNavNext, listNavPrevious, highlightItem, addToTypeAhead, toggleOpenWrapper]);
|
|
13027
|
-
return (0,
|
|
12469
|
+
return (0, import_react49.useMemo)(() => ({
|
|
13028
12470
|
...state,
|
|
13029
12471
|
...computedState,
|
|
13030
12472
|
...actions
|
|
@@ -13043,10 +12485,10 @@ var DOMUtils = {
|
|
|
13043
12485
|
};
|
|
13044
12486
|
|
|
13045
12487
|
// src/components/layout/popup/PopUpContext.tsx
|
|
13046
|
-
var
|
|
13047
|
-
var PopUpContext = (0,
|
|
12488
|
+
var import_react50 = require("react");
|
|
12489
|
+
var PopUpContext = (0, import_react50.createContext)(null);
|
|
13048
12490
|
function usePopUpContext() {
|
|
13049
|
-
const context = (0,
|
|
12491
|
+
const context = (0, import_react50.useContext)(PopUpContext);
|
|
13050
12492
|
if (!context) {
|
|
13051
12493
|
throw new Error("usePopUpContext must be used within a <PopUpContext.Provider>");
|
|
13052
12494
|
}
|
|
@@ -13072,16 +12514,16 @@ function SelectRoot({
|
|
|
13072
12514
|
readOnly = false,
|
|
13073
12515
|
required = false
|
|
13074
12516
|
}) {
|
|
13075
|
-
const [triggerRef, setTriggerRef] = (0,
|
|
13076
|
-
const [options, setOptions] = (0,
|
|
13077
|
-
const generatedId = (0,
|
|
13078
|
-
const [ids, setIds] = (0,
|
|
12517
|
+
const [triggerRef, setTriggerRef] = (0, import_react51.useState)(null);
|
|
12518
|
+
const [options, setOptions] = (0, import_react51.useState)([]);
|
|
12519
|
+
const generatedId = (0, import_react51.useId)();
|
|
12520
|
+
const [ids, setIds] = (0, import_react51.useState)({
|
|
13079
12521
|
trigger: "select-" + generatedId,
|
|
13080
12522
|
content: "select-content-" + generatedId,
|
|
13081
12523
|
listbox: "select-listbox-" + generatedId,
|
|
13082
12524
|
searchInput: "select-search-" + generatedId
|
|
13083
12525
|
});
|
|
13084
|
-
const registerOption = (0,
|
|
12526
|
+
const registerOption = (0, import_react51.useCallback)(
|
|
13085
12527
|
(item) => {
|
|
13086
12528
|
setOptions((prev) => {
|
|
13087
12529
|
const next = prev.filter((o) => o.value !== item.value);
|
|
@@ -13093,31 +12535,31 @@ function SelectRoot({
|
|
|
13093
12535
|
},
|
|
13094
12536
|
[]
|
|
13095
12537
|
);
|
|
13096
|
-
const registerTrigger = (0,
|
|
12538
|
+
const registerTrigger = (0, import_react51.useCallback)((ref) => {
|
|
13097
12539
|
setTriggerRef(ref);
|
|
13098
12540
|
return () => {
|
|
13099
12541
|
setTriggerRef(null);
|
|
13100
12542
|
};
|
|
13101
12543
|
}, []);
|
|
13102
|
-
const compare = (0,
|
|
13103
|
-
const idToOptionMap = (0,
|
|
12544
|
+
const compare = (0, import_react51.useMemo)(() => compareFunction ?? Object.is, [compareFunction]);
|
|
12545
|
+
const idToOptionMap = (0, import_react51.useMemo)(() => {
|
|
13104
12546
|
return options.reduce((acc, o) => {
|
|
13105
12547
|
acc[o.id] = o;
|
|
13106
12548
|
return acc;
|
|
13107
12549
|
}, {});
|
|
13108
12550
|
}, [options]);
|
|
13109
|
-
const mappedValueId = (0,
|
|
12551
|
+
const mappedValueId = (0, import_react51.useMemo)(() => {
|
|
13110
12552
|
if (value === void 0) return void 0;
|
|
13111
12553
|
return options.find((o) => compare(o.value, value))?.id ?? null;
|
|
13112
12554
|
}, [options, value, compare]);
|
|
13113
|
-
const mappedInitialValueId = (0,
|
|
12555
|
+
const mappedInitialValueId = (0, import_react51.useMemo)(() => {
|
|
13114
12556
|
if (initialValue === void 0) return void 0;
|
|
13115
12557
|
return options.find((o) => compare(o.value, initialValue))?.id ?? null;
|
|
13116
12558
|
}, [options, initialValue, compare]);
|
|
13117
12559
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
13118
12560
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
13119
12561
|
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
13120
|
-
const onValueChangeWrapper = (0,
|
|
12562
|
+
const onValueChangeWrapper = (0, import_react51.useCallback)((value2) => {
|
|
13121
12563
|
const option = idToOptionMap[value2];
|
|
13122
12564
|
if (option === void 0) {
|
|
13123
12565
|
console.warn(`Attempted to select an option ${value2} that is not valid`);
|
|
@@ -13125,7 +12567,7 @@ function SelectRoot({
|
|
|
13125
12567
|
}
|
|
13126
12568
|
onValueChangeStable(option.value);
|
|
13127
12569
|
}, [onValueChangeStable, idToOptionMap]);
|
|
13128
|
-
const onEditCompleteWrapper = (0,
|
|
12570
|
+
const onEditCompleteWrapper = (0, import_react51.useCallback)((value2) => {
|
|
13129
12571
|
const option = idToOptionMap[value2];
|
|
13130
12572
|
if (option === void 0) {
|
|
13131
12573
|
console.warn(`Attempted to edit complete an option ${value2} that is not valid`);
|
|
@@ -13144,17 +12586,17 @@ function SelectRoot({
|
|
|
13144
12586
|
onIsOpenChange: onIsOpenChangeStable
|
|
13145
12587
|
});
|
|
13146
12588
|
const { setSearchQuery } = state;
|
|
13147
|
-
(0,
|
|
12589
|
+
(0, import_react51.useEffect)(() => {
|
|
13148
12590
|
if (showSearch === false) {
|
|
13149
12591
|
setSearchQuery("");
|
|
13150
12592
|
}
|
|
13151
12593
|
}, [showSearch, setSearchQuery]);
|
|
13152
|
-
const config = (0,
|
|
12594
|
+
const config = (0, import_react51.useMemo)(() => ({
|
|
13153
12595
|
iconAppearance,
|
|
13154
12596
|
ids,
|
|
13155
12597
|
setIds
|
|
13156
12598
|
}), [iconAppearance, ids, setIds]);
|
|
13157
|
-
const layout = (0,
|
|
12599
|
+
const layout = (0, import_react51.useMemo)(() => ({
|
|
13158
12600
|
triggerRef,
|
|
13159
12601
|
registerTrigger
|
|
13160
12602
|
}), [triggerRef, registerTrigger]);
|
|
@@ -13209,22 +12651,22 @@ function SelectRoot({
|
|
|
13209
12651
|
}
|
|
13210
12652
|
|
|
13211
12653
|
// src/components/user-interaction/Select/SelectButton.tsx
|
|
13212
|
-
var
|
|
12654
|
+
var import_react53 = require("react");
|
|
13213
12655
|
|
|
13214
12656
|
// src/components/user-interaction/Select/SelectOption.tsx
|
|
13215
12657
|
var import_clsx9 = __toESM(require("clsx"));
|
|
13216
12658
|
var import_lucide_react6 = require("lucide-react");
|
|
13217
|
-
var
|
|
12659
|
+
var import_react52 = require("react");
|
|
13218
12660
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
13219
|
-
var SelectOptionDisplayContext = (0,
|
|
12661
|
+
var SelectOptionDisplayContext = (0, import_react52.createContext)(null);
|
|
13220
12662
|
function useSelectOptionDisplayLocation() {
|
|
13221
|
-
const context = (0,
|
|
12663
|
+
const context = (0, import_react52.useContext)(SelectOptionDisplayContext);
|
|
13222
12664
|
if (!context) {
|
|
13223
12665
|
throw new Error("useSelectOptionDisplayLocation must be used within a SelectOptionDisplayContext");
|
|
13224
12666
|
}
|
|
13225
12667
|
return context;
|
|
13226
12668
|
}
|
|
13227
|
-
var SelectOption = (0,
|
|
12669
|
+
var SelectOption = (0, import_react52.forwardRef)(function SelectOption2({
|
|
13228
12670
|
children,
|
|
13229
12671
|
label,
|
|
13230
12672
|
value,
|
|
@@ -13234,12 +12676,12 @@ var SelectOption = (0, import_react63.forwardRef)(function SelectOption2({
|
|
|
13234
12676
|
}, ref) {
|
|
13235
12677
|
const context = useSelectContext();
|
|
13236
12678
|
const { registerOption } = context;
|
|
13237
|
-
const itemRef = (0,
|
|
12679
|
+
const itemRef = (0, import_react52.useRef)(null);
|
|
13238
12680
|
const display = children ?? label;
|
|
13239
12681
|
const iconAppearanceResolved = iconAppearance ?? context.config.iconAppearance;
|
|
13240
|
-
const generatedId = (0,
|
|
12682
|
+
const generatedId = (0, import_react52.useId)();
|
|
13241
12683
|
const optionId = props?.id ?? "select-option-" + generatedId;
|
|
13242
|
-
(0,
|
|
12684
|
+
(0, import_react52.useEffect)(() => {
|
|
13243
12685
|
return registerOption({
|
|
13244
12686
|
id: optionId,
|
|
13245
12687
|
value,
|
|
@@ -13307,7 +12749,7 @@ var SelectOption = (0, import_react63.forwardRef)(function SelectOption2({
|
|
|
13307
12749
|
|
|
13308
12750
|
// src/components/user-interaction/Select/SelectButton.tsx
|
|
13309
12751
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
13310
|
-
var SelectButton = (0,
|
|
12752
|
+
var SelectButton = (0, import_react53.forwardRef)(
|
|
13311
12753
|
function SelectButton2({
|
|
13312
12754
|
id,
|
|
13313
12755
|
placeholder,
|
|
@@ -13321,12 +12763,12 @@ var SelectButton = (0, import_react64.forwardRef)(
|
|
|
13321
12763
|
const { config, layout } = context;
|
|
13322
12764
|
const { setIds } = config;
|
|
13323
12765
|
const { registerTrigger } = layout;
|
|
13324
|
-
(0,
|
|
12766
|
+
(0, import_react53.useEffect)(() => {
|
|
13325
12767
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
13326
12768
|
}, [id, setIds]);
|
|
13327
|
-
const innerRef = (0,
|
|
13328
|
-
(0,
|
|
13329
|
-
(0,
|
|
12769
|
+
const innerRef = (0, import_react53.useRef)(null);
|
|
12770
|
+
(0, import_react53.useImperativeHandle)(ref, () => innerRef.current);
|
|
12771
|
+
(0, import_react53.useEffect)(() => {
|
|
13330
12772
|
const unregister = registerTrigger(innerRef);
|
|
13331
12773
|
return () => unregister();
|
|
13332
12774
|
}, [registerTrigger]);
|
|
@@ -13387,13 +12829,38 @@ var SelectButton = (0, import_react64.forwardRef)(
|
|
|
13387
12829
|
);
|
|
13388
12830
|
|
|
13389
12831
|
// src/components/user-interaction/Select/SelectContent.tsx
|
|
13390
|
-
var
|
|
12832
|
+
var import_react56 = require("react");
|
|
13391
12833
|
var import_clsx10 = __toESM(require("clsx"));
|
|
13392
12834
|
|
|
13393
12835
|
// src/components/layout/popup/PopUp.tsx
|
|
13394
|
-
var
|
|
12836
|
+
var import_react55 = require("react");
|
|
12837
|
+
|
|
12838
|
+
// src/hooks/useOutsideClick.ts
|
|
12839
|
+
var import_react54 = require("react");
|
|
12840
|
+
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12841
|
+
(0, import_react54.useEffect)(() => {
|
|
12842
|
+
if (!active) return;
|
|
12843
|
+
const listener = (event) => {
|
|
12844
|
+
if (event.target === null) return;
|
|
12845
|
+
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
12846
|
+
return;
|
|
12847
|
+
}
|
|
12848
|
+
onOutsideClick(event);
|
|
12849
|
+
};
|
|
12850
|
+
document.addEventListener("mousedown", listener);
|
|
12851
|
+
document.addEventListener("touchstart", listener);
|
|
12852
|
+
document.addEventListener("pointerdown", listener);
|
|
12853
|
+
return () => {
|
|
12854
|
+
document.removeEventListener("mousedown", listener);
|
|
12855
|
+
document.removeEventListener("touchstart", listener);
|
|
12856
|
+
document.removeEventListener("pointerdown", listener);
|
|
12857
|
+
};
|
|
12858
|
+
}, [refs, onOutsideClick, active]);
|
|
12859
|
+
};
|
|
12860
|
+
|
|
12861
|
+
// src/components/layout/popup/PopUp.tsx
|
|
13395
12862
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
13396
|
-
var PopUp = (0,
|
|
12863
|
+
var PopUp = (0, import_react55.forwardRef)(function PopUp2({
|
|
13397
12864
|
children,
|
|
13398
12865
|
isOpen: isOpenOverwrite,
|
|
13399
12866
|
focusTrapOptions,
|
|
@@ -13404,24 +12871,24 @@ var PopUp = (0, import_react65.forwardRef)(function PopUp2({
|
|
|
13404
12871
|
forceMount = false,
|
|
13405
12872
|
anchorExcludedFromOutsideClick = false,
|
|
13406
12873
|
...props
|
|
13407
|
-
},
|
|
13408
|
-
const context = (0,
|
|
12874
|
+
}, forwardRef34) {
|
|
12875
|
+
const context = (0, import_react55.useContext)(PopUpContext);
|
|
13409
12876
|
const isOpen = isOpenOverwrite ?? context?.isOpen ?? false;
|
|
13410
12877
|
const anchor = anchorOverwrite ?? context?.triggerRef ?? void 0;
|
|
13411
12878
|
const id = props.id ?? context?.popUpId;
|
|
13412
12879
|
const { refAssignment, isPresent, ref } = usePresenceRef({ isOpen });
|
|
13413
|
-
(0,
|
|
12880
|
+
(0, import_react55.useImperativeHandle)(forwardRef34, () => ref.current, [ref]);
|
|
13414
12881
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
13415
12882
|
const onOutsideClickStable = useEventCallbackStabilizer(onOutsideClick);
|
|
13416
|
-
const onCloseWrapper = (0,
|
|
12883
|
+
const onCloseWrapper = (0, import_react55.useCallback)(() => {
|
|
13417
12884
|
onCloseStable();
|
|
13418
12885
|
context?.setIsOpen(false);
|
|
13419
12886
|
}, [onCloseStable, context]);
|
|
13420
|
-
const { zIndex, tagPositions } = useOverlayRegistry({ isActive: isOpen, tags: (0,
|
|
12887
|
+
const { zIndex, tagPositions } = useOverlayRegistry({ isActive: isOpen, tags: (0, import_react55.useMemo)(() => ["popup"], []) });
|
|
13421
12888
|
const isInFront = tagPositions?.["popup"] === 0;
|
|
13422
12889
|
const isOutsideClickActive = isOpen && isInFront && (outsideClickOptions?.active ?? true);
|
|
13423
12890
|
useOutsideClick({
|
|
13424
|
-
onOutsideClick: (0,
|
|
12891
|
+
onOutsideClick: (0, import_react55.useCallback)((event) => {
|
|
13425
12892
|
if (event.defaultPrevented) return;
|
|
13426
12893
|
onCloseWrapper();
|
|
13427
12894
|
onOutsideClickStable(event);
|
|
@@ -13459,7 +12926,7 @@ var PopUp = (0, import_react65.forwardRef)(function PopUp2({
|
|
|
13459
12926
|
|
|
13460
12927
|
// src/components/user-interaction/Select/SelectContent.tsx
|
|
13461
12928
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
13462
|
-
var SelectContent = (0,
|
|
12929
|
+
var SelectContent = (0, import_react56.forwardRef)(function SelectContent2({
|
|
13463
12930
|
id,
|
|
13464
12931
|
options,
|
|
13465
12932
|
showSearch: showSearchOverride,
|
|
@@ -13467,18 +12934,18 @@ var SelectContent = (0, import_react66.forwardRef)(function SelectContent2({
|
|
|
13467
12934
|
...props
|
|
13468
12935
|
}, ref) {
|
|
13469
12936
|
const translation = useHightideTranslation();
|
|
13470
|
-
const innerRef = (0,
|
|
13471
|
-
const searchInputRef = (0,
|
|
13472
|
-
(0,
|
|
12937
|
+
const innerRef = (0, import_react56.useRef)(null);
|
|
12938
|
+
const searchInputRef = (0, import_react56.useRef)(null);
|
|
12939
|
+
(0, import_react56.useImperativeHandle)(ref, () => innerRef.current);
|
|
13473
12940
|
const context = useSelectContext();
|
|
13474
12941
|
const { config, handleTypeaheadKey, toggleSelection, highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId } = context;
|
|
13475
12942
|
const { setIds } = config;
|
|
13476
|
-
(0,
|
|
12943
|
+
(0, import_react56.useEffect)(() => {
|
|
13477
12944
|
if (id) setIds((prev) => ({ ...prev, content: id }));
|
|
13478
12945
|
}, [id, setIds]);
|
|
13479
12946
|
const showSearch = showSearchOverride ?? context.search.hasSearch;
|
|
13480
12947
|
const listboxAriaLabel = showSearch ? translation("searchResults") : void 0;
|
|
13481
|
-
const keyHandler = (0,
|
|
12948
|
+
const keyHandler = (0, import_react56.useCallback)(
|
|
13482
12949
|
(event) => {
|
|
13483
12950
|
switch (event.key) {
|
|
13484
12951
|
case "ArrowDown":
|
|
@@ -13587,7 +13054,7 @@ var SelectContent = (0, import_react66.forwardRef)(function SelectContent2({
|
|
|
13587
13054
|
|
|
13588
13055
|
// src/components/user-interaction/Select/Select.tsx
|
|
13589
13056
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
13590
|
-
var Select = (0,
|
|
13057
|
+
var Select = (0, import_react57.forwardRef)(function Select2({ children, contentPanelProps, buttonProps, ...props }, ref) {
|
|
13591
13058
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(SelectRoot, { ...props, children: [
|
|
13592
13059
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
13593
13060
|
SelectButton,
|
|
@@ -13654,13 +13121,13 @@ var import_lucide_react7 = require("lucide-react");
|
|
|
13654
13121
|
var import_clsx12 = __toESM(require("clsx"));
|
|
13655
13122
|
|
|
13656
13123
|
// src/global-contexts/ThemeContext.tsx
|
|
13657
|
-
var
|
|
13124
|
+
var import_react58 = require("react");
|
|
13658
13125
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
13659
13126
|
var themes = ["light", "dark", "system"];
|
|
13660
13127
|
var ThemeUtil = {
|
|
13661
13128
|
themes
|
|
13662
13129
|
};
|
|
13663
|
-
var ThemeContext = (0,
|
|
13130
|
+
var ThemeContext = (0, import_react58.createContext)(null);
|
|
13664
13131
|
var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
13665
13132
|
const {
|
|
13666
13133
|
value: storedTheme,
|
|
@@ -13668,8 +13135,8 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13668
13135
|
deleteValue: deleteStoredTheme
|
|
13669
13136
|
} = useStorage({ key: "theme", defaultValue: "system" });
|
|
13670
13137
|
const { config } = useHightideConfig();
|
|
13671
|
-
const [themePreference, setThemePreference] = (0,
|
|
13672
|
-
const resolvedTheme = (0,
|
|
13138
|
+
const [themePreference, setThemePreference] = (0, import_react58.useState)("system");
|
|
13139
|
+
const resolvedTheme = (0, import_react58.useMemo)(() => {
|
|
13673
13140
|
if (theme && theme !== "system") {
|
|
13674
13141
|
return theme;
|
|
13675
13142
|
}
|
|
@@ -13681,7 +13148,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13681
13148
|
}
|
|
13682
13149
|
return initialTheme ?? config.theme.initialTheme;
|
|
13683
13150
|
}, [config.theme.initialTheme, initialTheme, storedTheme, theme, themePreference]);
|
|
13684
|
-
(0,
|
|
13151
|
+
(0, import_react58.useEffect)(() => {
|
|
13685
13152
|
if (!theme) return;
|
|
13686
13153
|
if (theme === "system") {
|
|
13687
13154
|
deleteStoredTheme();
|
|
@@ -13689,18 +13156,18 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13689
13156
|
setStoredTheme(theme);
|
|
13690
13157
|
}
|
|
13691
13158
|
}, [theme, deleteStoredTheme, setStoredTheme]);
|
|
13692
|
-
(0,
|
|
13159
|
+
(0, import_react58.useEffect)(() => {
|
|
13693
13160
|
document.documentElement.setAttribute("data-theme", resolvedTheme);
|
|
13694
13161
|
}, [resolvedTheme]);
|
|
13695
|
-
const getPreference = (0,
|
|
13162
|
+
const getPreference = (0, import_react58.useCallback)(() => {
|
|
13696
13163
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
13697
13164
|
const prefersLight = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
13698
13165
|
setThemePreference(prefersDark ? "dark" : prefersLight ? "light" : "system");
|
|
13699
13166
|
}, []);
|
|
13700
|
-
(0,
|
|
13167
|
+
(0, import_react58.useEffect)(() => {
|
|
13701
13168
|
getPreference();
|
|
13702
13169
|
}, [getPreference]);
|
|
13703
|
-
(0,
|
|
13170
|
+
(0, import_react58.useEffect)(() => {
|
|
13704
13171
|
const darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
13705
13172
|
const lightQuery = window.matchMedia("(prefers-color-scheme: light)");
|
|
13706
13173
|
const noPrefQuery = window.matchMedia("(prefers-color-scheme: no-preference)");
|
|
@@ -13731,7 +13198,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13731
13198
|
);
|
|
13732
13199
|
};
|
|
13733
13200
|
var useTheme = () => {
|
|
13734
|
-
const context = (0,
|
|
13201
|
+
const context = (0, import_react58.useContext)(ThemeContext);
|
|
13735
13202
|
if (!context) {
|
|
13736
13203
|
throw new Error("useTheme must be used within ThemeContext. Try adding a ThemeProvider around your app.");
|
|
13737
13204
|
}
|
|
@@ -13811,16 +13278,16 @@ var ThemeDialog = ({
|
|
|
13811
13278
|
};
|
|
13812
13279
|
|
|
13813
13280
|
// src/components/layout/drawer/Drawer.tsx
|
|
13814
|
-
var
|
|
13281
|
+
var import_react61 = require("react");
|
|
13815
13282
|
|
|
13816
13283
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
13817
|
-
var
|
|
13284
|
+
var import_react60 = require("react");
|
|
13818
13285
|
|
|
13819
13286
|
// src/components/layout/drawer/DrawerContext.tsx
|
|
13820
|
-
var
|
|
13821
|
-
var DrawerContext = (0,
|
|
13287
|
+
var import_react59 = require("react");
|
|
13288
|
+
var DrawerContext = (0, import_react59.createContext)(null);
|
|
13822
13289
|
function useDrawerContext() {
|
|
13823
|
-
const context = (0,
|
|
13290
|
+
const context = (0, import_react59.useContext)(DrawerContext);
|
|
13824
13291
|
if (!context) {
|
|
13825
13292
|
throw new Error("useDrawerContext must be used within a <DrawerRoot>");
|
|
13826
13293
|
}
|
|
@@ -13829,7 +13296,7 @@ function useDrawerContext() {
|
|
|
13829
13296
|
|
|
13830
13297
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
13831
13298
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
13832
|
-
var DrawerContent = (0,
|
|
13299
|
+
var DrawerContent = (0, import_react60.forwardRef)(function DrawerContent2({
|
|
13833
13300
|
children,
|
|
13834
13301
|
alignment = "left",
|
|
13835
13302
|
containerClassName,
|
|
@@ -13838,14 +13305,14 @@ var DrawerContent = (0, import_react70.forwardRef)(function DrawerContent2({
|
|
|
13838
13305
|
...props
|
|
13839
13306
|
}, forwardedRef) {
|
|
13840
13307
|
const { isOpen } = useDrawerContext();
|
|
13841
|
-
const generatedId = (0,
|
|
13842
|
-
const ids = (0,
|
|
13308
|
+
const generatedId = (0, import_react60.useId)();
|
|
13309
|
+
const ids = (0, import_react60.useMemo)(() => ({
|
|
13843
13310
|
container: `dialog-container-${generatedId}`,
|
|
13844
13311
|
background: `dialog-background-${generatedId}`,
|
|
13845
13312
|
content: props.id ?? `dialog-content-${generatedId}`
|
|
13846
13313
|
}), [generatedId, props.id]);
|
|
13847
|
-
const ref = (0,
|
|
13848
|
-
(0,
|
|
13314
|
+
const ref = (0, import_react60.useRef)(null);
|
|
13315
|
+
(0, import_react60.useImperativeHandle)(forwardedRef, () => ref.current, [ref]);
|
|
13849
13316
|
const { isVisible, transitionState } = useTransitionState({ isOpen, ref });
|
|
13850
13317
|
useFocusTrap({
|
|
13851
13318
|
container: ref,
|
|
@@ -13853,7 +13320,7 @@ var DrawerContent = (0, import_react70.forwardRef)(function DrawerContent2({
|
|
|
13853
13320
|
});
|
|
13854
13321
|
const { zIndex, tagPositions, tagItemCounts } = useOverlayRegistry({
|
|
13855
13322
|
isActive: isVisible,
|
|
13856
|
-
tags: (0,
|
|
13323
|
+
tags: (0, import_react60.useMemo)(() => ["drawer"], [])
|
|
13857
13324
|
});
|
|
13858
13325
|
const depth = tagPositions && tagItemCounts ? (tagItemCounts["drawer"] ?? 0) - (tagPositions["drawer"] ?? 0) : 0;
|
|
13859
13326
|
const { setOpen } = useDrawerContext();
|
|
@@ -13948,7 +13415,7 @@ function DrawerRoot({
|
|
|
13948
13415
|
|
|
13949
13416
|
// src/components/layout/drawer/Drawer.tsx
|
|
13950
13417
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
13951
|
-
var Drawer = (0,
|
|
13418
|
+
var Drawer = (0, import_react61.forwardRef)(function Drawer2({
|
|
13952
13419
|
children,
|
|
13953
13420
|
isOpen = true,
|
|
13954
13421
|
alignment = "left",
|
|
@@ -14006,7 +13473,7 @@ var ErrorComponent = ({
|
|
|
14006
13473
|
};
|
|
14007
13474
|
|
|
14008
13475
|
// src/components/layout/loading/LoadingAndErrorComponent.tsx
|
|
14009
|
-
var
|
|
13476
|
+
var import_react62 = require("react");
|
|
14010
13477
|
|
|
14011
13478
|
// src/components/layout/loading/LoadingContainer.tsx
|
|
14012
13479
|
var import_clsx14 = require("clsx");
|
|
@@ -14027,8 +13494,8 @@ var LoadingAndErrorComponent = ({
|
|
|
14027
13494
|
minimumLoadingDuration = 200,
|
|
14028
13495
|
className
|
|
14029
13496
|
}) => {
|
|
14030
|
-
const [isInMinimumLoading, setIsInMinimumLoading] = (0,
|
|
14031
|
-
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = (0,
|
|
13497
|
+
const [isInMinimumLoading, setIsInMinimumLoading] = (0, import_react62.useState)(false);
|
|
13498
|
+
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = (0, import_react62.useState)(false);
|
|
14032
13499
|
if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {
|
|
14033
13500
|
setIsInMinimumLoading(true);
|
|
14034
13501
|
setTimeout(() => {
|
|
@@ -14091,8 +13558,8 @@ var BreadCrumbs = ({ crumbs }) => {
|
|
|
14091
13558
|
|
|
14092
13559
|
// src/components/layout/navigation/Navigation.tsx
|
|
14093
13560
|
var import_lucide_react10 = require("lucide-react");
|
|
14094
|
-
var
|
|
14095
|
-
var
|
|
13561
|
+
var import_react63 = require("react");
|
|
13562
|
+
var import_react64 = require("react");
|
|
14096
13563
|
var import_link2 = __toESM(require_link2());
|
|
14097
13564
|
var import_clsx17 = __toESM(require("clsx"));
|
|
14098
13565
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
@@ -14105,10 +13572,10 @@ var NavigationItemWithSubItem = ({
|
|
|
14105
13572
|
horizontalAlignment = "center",
|
|
14106
13573
|
...options
|
|
14107
13574
|
}) => {
|
|
14108
|
-
const [isOpen, setOpen] = (0,
|
|
14109
|
-
const containerRef = (0,
|
|
14110
|
-
const triggerRef = (0,
|
|
14111
|
-
const id = (0,
|
|
13575
|
+
const [isOpen, setOpen] = (0, import_react64.useState)(false);
|
|
13576
|
+
const containerRef = (0, import_react64.useRef)(null);
|
|
13577
|
+
const triggerRef = (0, import_react64.useRef)(null);
|
|
13578
|
+
const id = (0, import_react64.useId)();
|
|
14112
13579
|
const style = useAnchoredPosition({
|
|
14113
13580
|
active: isOpen,
|
|
14114
13581
|
container: containerRef,
|
|
@@ -14116,7 +13583,7 @@ var NavigationItemWithSubItem = ({
|
|
|
14116
13583
|
horizontalAlignment,
|
|
14117
13584
|
...options
|
|
14118
13585
|
});
|
|
14119
|
-
const onBlur = (0,
|
|
13586
|
+
const onBlur = (0, import_react64.useCallback)((event) => {
|
|
14120
13587
|
const nextFocus = event.relatedTarget;
|
|
14121
13588
|
if (!containerRef.current?.contains(nextFocus) && !triggerRef.current?.contains(nextFocus)) {
|
|
14122
13589
|
setOpen(false);
|
|
@@ -14182,10 +13649,10 @@ var NavigationItemList = ({ items, ...restProps }) => {
|
|
|
14182
13649
|
};
|
|
14183
13650
|
var Navigation = ({ ...props }) => {
|
|
14184
13651
|
const translation = useHightideTranslation();
|
|
14185
|
-
const [isMobileOpen, setIsMobileOpen] = (0,
|
|
14186
|
-
const id = (0,
|
|
14187
|
-
const menuRef = (0,
|
|
14188
|
-
(0,
|
|
13652
|
+
const [isMobileOpen, setIsMobileOpen] = (0, import_react64.useState)(false);
|
|
13653
|
+
const id = (0, import_react64.useId)();
|
|
13654
|
+
const menuRef = (0, import_react64.useRef)(null);
|
|
13655
|
+
(0, import_react63.useEffect)(() => {
|
|
14189
13656
|
menuRef.current?.focus();
|
|
14190
13657
|
}, [isMobileOpen]);
|
|
14191
13658
|
const { zIndex } = useOverlayRegistry({ isActive: isMobileOpen });
|
|
@@ -14253,7 +13720,7 @@ var Navigation = ({ ...props }) => {
|
|
|
14253
13720
|
// src/components/layout/navigation/Pagination.tsx
|
|
14254
13721
|
var import_lucide_react11 = require("lucide-react");
|
|
14255
13722
|
var import_clsx18 = __toESM(require("clsx"));
|
|
14256
|
-
var
|
|
13723
|
+
var import_react65 = require("react");
|
|
14257
13724
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
14258
13725
|
var Pagination = ({
|
|
14259
13726
|
pageIndex,
|
|
@@ -14262,11 +13729,11 @@ var Pagination = ({
|
|
|
14262
13729
|
...props
|
|
14263
13730
|
}) => {
|
|
14264
13731
|
const translation = useHightideTranslation();
|
|
14265
|
-
const [value, setValue] = (0,
|
|
13732
|
+
const [value, setValue] = (0, import_react65.useState)((pageIndex + 1).toString());
|
|
14266
13733
|
const noPages = pageCount === 0;
|
|
14267
13734
|
const onFirstPage = pageIndex === 0 && !noPages;
|
|
14268
13735
|
const onLastPage = pageIndex === pageCount - 1;
|
|
14269
|
-
(0,
|
|
13736
|
+
(0, import_react65.useEffect)(() => {
|
|
14270
13737
|
if (noPages) {
|
|
14271
13738
|
setValue("0");
|
|
14272
13739
|
} else {
|
|
@@ -14460,18 +13927,18 @@ var StepperBar = ({
|
|
|
14460
13927
|
};
|
|
14461
13928
|
|
|
14462
13929
|
// src/components/layout/popup/PopUpOpener.tsx
|
|
14463
|
-
var
|
|
13930
|
+
var import_react66 = require("react");
|
|
14464
13931
|
function PopUpOpener({ children }) {
|
|
14465
13932
|
const context = usePopUpContext();
|
|
14466
13933
|
const { setTriggerRef } = context;
|
|
14467
|
-
const ref = (0,
|
|
14468
|
-
(0,
|
|
13934
|
+
const ref = (0, import_react66.useRef)(null);
|
|
13935
|
+
(0, import_react66.useEffect)(() => {
|
|
14469
13936
|
setTriggerRef(ref);
|
|
14470
13937
|
return () => {
|
|
14471
13938
|
setTriggerRef(null);
|
|
14472
13939
|
};
|
|
14473
13940
|
}, [setTriggerRef]);
|
|
14474
|
-
const bag = (0,
|
|
13941
|
+
const bag = (0, import_react66.useMemo)(() => ({
|
|
14475
13942
|
open: () => context.setIsOpen(true),
|
|
14476
13943
|
close: () => context.setIsOpen(false),
|
|
14477
13944
|
toggleOpen: () => context.setIsOpen((prev) => !prev),
|
|
@@ -14489,7 +13956,7 @@ function PopUpOpener({ children }) {
|
|
|
14489
13956
|
}
|
|
14490
13957
|
|
|
14491
13958
|
// src/components/layout/popup/PopUpRoot.tsx
|
|
14492
|
-
var
|
|
13959
|
+
var import_react67 = require("react");
|
|
14493
13960
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
14494
13961
|
function PopUpRoot({
|
|
14495
13962
|
children,
|
|
@@ -14499,17 +13966,17 @@ function PopUpRoot({
|
|
|
14499
13966
|
popUpId: popUpIdOverwrite,
|
|
14500
13967
|
triggerId: triggerIdOverwrite
|
|
14501
13968
|
}) {
|
|
14502
|
-
const generatedPopUpId = (0,
|
|
14503
|
-
const generatedTriggerId = (0,
|
|
13969
|
+
const generatedPopUpId = (0, import_react67.useId)();
|
|
13970
|
+
const generatedTriggerId = (0, import_react67.useId)();
|
|
14504
13971
|
const [isOpen, setIsOpen] = useControlledState({
|
|
14505
13972
|
value: controlledIsOpen,
|
|
14506
13973
|
onValueChange: onIsOpenChange,
|
|
14507
13974
|
defaultValue: initialIsOpen
|
|
14508
13975
|
});
|
|
14509
|
-
const [triggerRef, setTriggerRef] = (0,
|
|
14510
|
-
const popUpId = (0,
|
|
14511
|
-
const triggerId = (0,
|
|
14512
|
-
const contextValue = (0,
|
|
13976
|
+
const [triggerRef, setTriggerRef] = (0, import_react67.useState)(null);
|
|
13977
|
+
const popUpId = (0, import_react67.useMemo)(() => popUpIdOverwrite ?? `pop-up-${generatedPopUpId}`, [popUpIdOverwrite, generatedPopUpId]);
|
|
13978
|
+
const triggerId = (0, import_react67.useMemo)(() => triggerIdOverwrite ?? `pop-up-trigger-${generatedTriggerId}`, [triggerIdOverwrite, generatedTriggerId]);
|
|
13979
|
+
const contextValue = (0, import_react67.useMemo)(() => ({
|
|
14513
13980
|
isOpen,
|
|
14514
13981
|
setIsOpen,
|
|
14515
13982
|
popUpId,
|
|
@@ -14696,31 +14163,31 @@ var FillerCell = ({ ...props }) => {
|
|
|
14696
14163
|
};
|
|
14697
14164
|
|
|
14698
14165
|
// src/components/layout/table/TableProvider.tsx
|
|
14699
|
-
var
|
|
14166
|
+
var import_react70 = require("react");
|
|
14700
14167
|
|
|
14701
14168
|
// src/components/layout/table/TableContext.tsx
|
|
14702
|
-
var
|
|
14703
|
-
var TableStateWithoutSizingContext = (0,
|
|
14169
|
+
var import_react68 = require("react");
|
|
14170
|
+
var TableStateWithoutSizingContext = (0, import_react68.createContext)(null);
|
|
14704
14171
|
var useTableStateWithoutSizingContext = () => {
|
|
14705
|
-
const context = (0,
|
|
14172
|
+
const context = (0, import_react68.useContext)(TableStateWithoutSizingContext);
|
|
14706
14173
|
if (!context) throw new Error("useTableStateWithoutSizingContext must be used within a <TableStateWithoutSizingContext.Provider> like <TableStateWithoutSizing>");
|
|
14707
14174
|
return context;
|
|
14708
14175
|
};
|
|
14709
|
-
var TableStateContext = (0,
|
|
14176
|
+
var TableStateContext = (0, import_react68.createContext)(null);
|
|
14710
14177
|
var useTableStateContext = () => {
|
|
14711
|
-
const context = (0,
|
|
14178
|
+
const context = (0, import_react68.useContext)(TableStateContext);
|
|
14712
14179
|
if (!context) throw new Error("useTableStateContext must be used within a <TableStateContext.Provider> like <TableState>");
|
|
14713
14180
|
return context;
|
|
14714
14181
|
};
|
|
14715
|
-
var TableContainerContext = (0,
|
|
14182
|
+
var TableContainerContext = (0, import_react68.createContext)(null);
|
|
14716
14183
|
var useTableContainerContext = () => {
|
|
14717
|
-
const context = (0,
|
|
14184
|
+
const context = (0, import_react68.useContext)(TableContainerContext);
|
|
14718
14185
|
if (!context) throw new Error("useTableContainerContext must be used within a <TableContainerContext.Provider> like <TableContainer>");
|
|
14719
14186
|
return context;
|
|
14720
14187
|
};
|
|
14721
|
-
var TableColumnDefinitionContext = (0,
|
|
14188
|
+
var TableColumnDefinitionContext = (0, import_react68.createContext)(null);
|
|
14722
14189
|
var useTableColumnDefinitionContext = () => {
|
|
14723
|
-
const context = (0,
|
|
14190
|
+
const context = (0, import_react68.useContext)(TableColumnDefinitionContext);
|
|
14724
14191
|
if (!context) throw new Error("useTableColumnDefinitionContext must be used within a <TableColumnDefinitionContext.Provider> like <TableColumnDefinition>");
|
|
14725
14192
|
return context;
|
|
14726
14193
|
};
|
|
@@ -14867,39 +14334,286 @@ function getDefaultOperator(dataType) {
|
|
|
14867
14334
|
case "number":
|
|
14868
14335
|
return "between";
|
|
14869
14336
|
case "date":
|
|
14870
|
-
return "between";
|
|
14337
|
+
return "between";
|
|
14338
|
+
case "dateTime":
|
|
14339
|
+
return "between";
|
|
14340
|
+
case "boolean":
|
|
14341
|
+
return "isTrue";
|
|
14342
|
+
case "multiTags":
|
|
14343
|
+
return "contains";
|
|
14344
|
+
case "singleTag":
|
|
14345
|
+
return "contains";
|
|
14346
|
+
case "unknownType":
|
|
14347
|
+
return "isNotUndefined";
|
|
14348
|
+
}
|
|
14349
|
+
}
|
|
14350
|
+
var FilterOperatorUtils = {
|
|
14351
|
+
operators: filterOperators,
|
|
14352
|
+
operatorsByCategory: filterOperatorsByCategory,
|
|
14353
|
+
getInfo: getOperatorInfo,
|
|
14354
|
+
getDefaultOperator,
|
|
14355
|
+
typeCheck: {
|
|
14356
|
+
all: isFilterOperator,
|
|
14357
|
+
text: isFilterOperatorText,
|
|
14358
|
+
number: isFilterOperatorNumber,
|
|
14359
|
+
date: isFilterOperatorDate,
|
|
14360
|
+
datetime: isFilterOperatorDatetime,
|
|
14361
|
+
boolean: isFilterOperatorBoolean,
|
|
14362
|
+
tags: isFilterOperatorTags,
|
|
14363
|
+
tagsSingle: isFilterOperatorTagsSingle,
|
|
14364
|
+
unknownType: isFilterOperatorUnknownType
|
|
14365
|
+
}
|
|
14366
|
+
};
|
|
14367
|
+
|
|
14368
|
+
// src/components/user-interaction/data/filter-function.ts
|
|
14369
|
+
var import_react69 = require("react");
|
|
14370
|
+
|
|
14371
|
+
// src/utils/date.ts
|
|
14372
|
+
var timesInSeconds = {
|
|
14373
|
+
second: 1,
|
|
14374
|
+
minute: 60,
|
|
14375
|
+
hour: 3600,
|
|
14376
|
+
day: 86400,
|
|
14377
|
+
week: 604800,
|
|
14378
|
+
monthImprecise: 2629800,
|
|
14379
|
+
// 30.4375 days
|
|
14380
|
+
yearImprecise: 31557600
|
|
14381
|
+
// 365.25 days
|
|
14382
|
+
};
|
|
14383
|
+
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14384
|
+
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14385
|
+
var changeDuration = (date, duration, isAdding) => {
|
|
14386
|
+
const {
|
|
14387
|
+
years = 0,
|
|
14388
|
+
months = 0,
|
|
14389
|
+
days = 0,
|
|
14390
|
+
hours = 0,
|
|
14391
|
+
minutes = 0,
|
|
14392
|
+
seconds = 0,
|
|
14393
|
+
milliseconds = 0
|
|
14394
|
+
} = duration;
|
|
14395
|
+
if (years < 0) {
|
|
14396
|
+
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14397
|
+
return new Date(date);
|
|
14398
|
+
}
|
|
14399
|
+
if (months < 0 || months > 11) {
|
|
14400
|
+
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14401
|
+
return new Date(date);
|
|
14402
|
+
}
|
|
14403
|
+
if (days < 0) {
|
|
14404
|
+
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14405
|
+
return new Date(date);
|
|
14406
|
+
}
|
|
14407
|
+
if (hours < 0 || hours > 23) {
|
|
14408
|
+
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14409
|
+
return new Date(date);
|
|
14410
|
+
}
|
|
14411
|
+
if (minutes < 0 || minutes > 59) {
|
|
14412
|
+
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14413
|
+
return new Date(date);
|
|
14414
|
+
}
|
|
14415
|
+
if (seconds < 0 || seconds > 59) {
|
|
14416
|
+
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14417
|
+
return new Date(date);
|
|
14418
|
+
}
|
|
14419
|
+
if (milliseconds < 0) {
|
|
14420
|
+
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14421
|
+
return new Date(date);
|
|
14422
|
+
}
|
|
14423
|
+
const multiplier = isAdding ? 1 : -1;
|
|
14424
|
+
const newDate = new Date(date);
|
|
14425
|
+
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14426
|
+
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14427
|
+
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14428
|
+
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14429
|
+
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14430
|
+
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14431
|
+
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14432
|
+
return newDate;
|
|
14433
|
+
};
|
|
14434
|
+
var addDuration = (date, duration) => {
|
|
14435
|
+
return changeDuration(date, duration, true);
|
|
14436
|
+
};
|
|
14437
|
+
var subtractDuration = (date, duration) => {
|
|
14438
|
+
return changeDuration(date, duration, false);
|
|
14439
|
+
};
|
|
14440
|
+
var between = (value, startDate, endDate) => {
|
|
14441
|
+
if (startDate && endDate) {
|
|
14442
|
+
console.assert(startDate <= endDate);
|
|
14443
|
+
return startDate <= value && value <= endDate;
|
|
14444
|
+
} else if (startDate) {
|
|
14445
|
+
return startDate <= value;
|
|
14446
|
+
} else if (endDate) {
|
|
14447
|
+
return endDate >= value;
|
|
14448
|
+
} else {
|
|
14449
|
+
return true;
|
|
14450
|
+
}
|
|
14451
|
+
};
|
|
14452
|
+
var equalDate = (date1, date2) => {
|
|
14453
|
+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14454
|
+
};
|
|
14455
|
+
var isLastMillisecondOfDay = (date) => {
|
|
14456
|
+
const next = new Date(date.getTime() + 1);
|
|
14457
|
+
return !equalDate(date, next);
|
|
14458
|
+
};
|
|
14459
|
+
var sameTime = (a, b, compareSeconds = false, compareMilliseconds = false) => {
|
|
14460
|
+
if (a.getHours() !== b.getHours() || a.getMinutes() !== b.getMinutes()) {
|
|
14461
|
+
return false;
|
|
14462
|
+
}
|
|
14463
|
+
if (compareSeconds && a.getSeconds() !== b.getSeconds()) {
|
|
14464
|
+
return false;
|
|
14465
|
+
}
|
|
14466
|
+
if (compareMilliseconds && a.getMilliseconds() !== b.getMilliseconds()) {
|
|
14467
|
+
return false;
|
|
14468
|
+
}
|
|
14469
|
+
return true;
|
|
14470
|
+
};
|
|
14471
|
+
var withTime = (datePart, timePart) => {
|
|
14472
|
+
const out = new Date(datePart);
|
|
14473
|
+
out.setHours(
|
|
14474
|
+
timePart.getHours(),
|
|
14475
|
+
timePart.getMinutes(),
|
|
14476
|
+
timePart.getSeconds(),
|
|
14477
|
+
timePart.getMilliseconds()
|
|
14478
|
+
);
|
|
14479
|
+
return out;
|
|
14480
|
+
};
|
|
14481
|
+
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14482
|
+
const month = date.getMonth();
|
|
14483
|
+
const year = date.getFullYear();
|
|
14484
|
+
const dayList = [];
|
|
14485
|
+
let currentDate = new Date(year, month, 1);
|
|
14486
|
+
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14487
|
+
while (currentDate.getDay() !== weekStartIndex) {
|
|
14488
|
+
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14489
|
+
}
|
|
14490
|
+
while (dayList.length < 7 * weeks) {
|
|
14491
|
+
const date2 = new Date(currentDate);
|
|
14492
|
+
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14493
|
+
dayList.push(date2);
|
|
14494
|
+
currentDate = addDuration(currentDate, { days: 1 });
|
|
14495
|
+
}
|
|
14496
|
+
return equalSizeGroups(dayList, 7);
|
|
14497
|
+
};
|
|
14498
|
+
var formatAbsolute = (date, locale, format) => {
|
|
14499
|
+
let options;
|
|
14500
|
+
switch (format) {
|
|
14501
|
+
case "date":
|
|
14502
|
+
options = {
|
|
14503
|
+
year: "2-digit",
|
|
14504
|
+
month: "2-digit",
|
|
14505
|
+
day: "2-digit"
|
|
14506
|
+
};
|
|
14507
|
+
break;
|
|
14508
|
+
case "time":
|
|
14509
|
+
options = {
|
|
14510
|
+
hour: "2-digit",
|
|
14511
|
+
minute: "2-digit"
|
|
14512
|
+
};
|
|
14513
|
+
break;
|
|
14514
|
+
case "dateTime":
|
|
14515
|
+
options = {
|
|
14516
|
+
year: "numeric",
|
|
14517
|
+
month: "2-digit",
|
|
14518
|
+
day: "2-digit",
|
|
14519
|
+
hour: "2-digit",
|
|
14520
|
+
minute: "2-digit"
|
|
14521
|
+
};
|
|
14522
|
+
break;
|
|
14523
|
+
}
|
|
14524
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14525
|
+
};
|
|
14526
|
+
var formatRelative = (date, locale) => {
|
|
14527
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14528
|
+
const now = /* @__PURE__ */ new Date();
|
|
14529
|
+
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14530
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14531
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
14532
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
14533
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
14534
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
14535
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
14536
|
+
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
14537
|
+
};
|
|
14538
|
+
var toInputString = (date, format, precision = "minute", isLocalTime = true) => {
|
|
14539
|
+
const pad = (n, l = 2) => String(n).padStart(l, "0");
|
|
14540
|
+
const parts = isLocalTime ? {
|
|
14541
|
+
y: date.getFullYear(),
|
|
14542
|
+
m: date.getMonth() + 1,
|
|
14543
|
+
d: date.getDate(),
|
|
14544
|
+
h: date.getHours(),
|
|
14545
|
+
min: date.getMinutes(),
|
|
14546
|
+
s: date.getSeconds(),
|
|
14547
|
+
ms: date.getMilliseconds()
|
|
14548
|
+
} : {
|
|
14549
|
+
y: date.getUTCFullYear(),
|
|
14550
|
+
m: date.getUTCMonth() + 1,
|
|
14551
|
+
d: date.getUTCDate(),
|
|
14552
|
+
h: date.getUTCHours(),
|
|
14553
|
+
min: date.getUTCMinutes(),
|
|
14554
|
+
s: date.getUTCSeconds(),
|
|
14555
|
+
ms: date.getUTCMilliseconds()
|
|
14556
|
+
};
|
|
14557
|
+
const dateStr = `${pad(parts.y, 4)}-${pad(parts.m)}-${pad(parts.d)}`;
|
|
14558
|
+
let timeStr = `${pad(parts.h)}:${pad(parts.min)}`;
|
|
14559
|
+
if (precision === "second" || precision === "millisecond") {
|
|
14560
|
+
timeStr += `:${pad(parts.s)}`;
|
|
14561
|
+
}
|
|
14562
|
+
if (precision === "millisecond") {
|
|
14563
|
+
timeStr += `.${pad(parts.ms, 3)}`;
|
|
14564
|
+
}
|
|
14565
|
+
switch (format) {
|
|
14566
|
+
case "date":
|
|
14567
|
+
return dateStr;
|
|
14568
|
+
case "time":
|
|
14569
|
+
return timeStr;
|
|
14871
14570
|
case "dateTime":
|
|
14872
|
-
return
|
|
14873
|
-
case "boolean":
|
|
14874
|
-
return "isTrue";
|
|
14875
|
-
case "multiTags":
|
|
14876
|
-
return "contains";
|
|
14877
|
-
case "singleTag":
|
|
14878
|
-
return "contains";
|
|
14879
|
-
case "unknownType":
|
|
14880
|
-
return "isNotUndefined";
|
|
14571
|
+
return `${dateStr}T${timeStr}`;
|
|
14881
14572
|
}
|
|
14882
|
-
}
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
all: isFilterOperator,
|
|
14890
|
-
text: isFilterOperatorText,
|
|
14891
|
-
number: isFilterOperatorNumber,
|
|
14892
|
-
date: isFilterOperatorDate,
|
|
14893
|
-
datetime: isFilterOperatorDatetime,
|
|
14894
|
-
boolean: isFilterOperatorBoolean,
|
|
14895
|
-
tags: isFilterOperatorTags,
|
|
14896
|
-
tagsSingle: isFilterOperatorTagsSingle,
|
|
14897
|
-
unknownType: isFilterOperatorUnknownType
|
|
14573
|
+
};
|
|
14574
|
+
function tryParseDate(dateValue) {
|
|
14575
|
+
if (!dateValue) return null;
|
|
14576
|
+
if (dateValue instanceof Date) return dateValue;
|
|
14577
|
+
if (typeof dateValue === "string" || typeof dateValue === "number") {
|
|
14578
|
+
const parsed = new Date(dateValue);
|
|
14579
|
+
return isNaN(parsed.getTime()) ? null : parsed;
|
|
14898
14580
|
}
|
|
14581
|
+
return null;
|
|
14582
|
+
}
|
|
14583
|
+
function normalizeToDateOnly(date) {
|
|
14584
|
+
const normalized = new Date(date);
|
|
14585
|
+
normalized.setHours(0, 0, 0, 0);
|
|
14586
|
+
return normalized;
|
|
14587
|
+
}
|
|
14588
|
+
function normalizeDatetime(dateTime) {
|
|
14589
|
+
const normalized = new Date(dateTime);
|
|
14590
|
+
normalized.setSeconds(0, 0);
|
|
14591
|
+
return normalized;
|
|
14592
|
+
}
|
|
14593
|
+
var DateUtils = {
|
|
14594
|
+
monthsList,
|
|
14595
|
+
weekDayList,
|
|
14596
|
+
equalDate,
|
|
14597
|
+
isLastMillisecondOfDay,
|
|
14598
|
+
sameTime,
|
|
14599
|
+
withTime,
|
|
14600
|
+
formatAbsolute,
|
|
14601
|
+
formatRelative,
|
|
14602
|
+
addDuration,
|
|
14603
|
+
subtractDuration,
|
|
14604
|
+
between,
|
|
14605
|
+
weeksForCalenderMonth,
|
|
14606
|
+
timesInSeconds,
|
|
14607
|
+
toInputString,
|
|
14608
|
+
tryParseDate,
|
|
14609
|
+
toOnlyDate: normalizeToDateOnly,
|
|
14610
|
+
/**
|
|
14611
|
+
* Normalizes a datetime by removing seconds and milliseconds.
|
|
14612
|
+
*/
|
|
14613
|
+
toDateTimeOnly: normalizeDatetime
|
|
14899
14614
|
};
|
|
14900
14615
|
|
|
14901
14616
|
// src/components/user-interaction/data/filter-function.ts
|
|
14902
|
-
var import_react79 = require("react");
|
|
14903
14617
|
var allowedOperatorsByDataType = {
|
|
14904
14618
|
text: ["equals", "notEquals", "contains", "notContains", "startsWith", "endsWith", "isUndefined", "isNotUndefined"],
|
|
14905
14619
|
number: ["equals", "notEquals", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "between", "notBetween", "isUndefined", "isNotUndefined"],
|
|
@@ -15252,7 +14966,7 @@ function tagToLabel(tags, value) {
|
|
|
15252
14966
|
function useFilterValueTranslation() {
|
|
15253
14967
|
const translation = useHightideTranslation();
|
|
15254
14968
|
const { locale } = useLocale();
|
|
15255
|
-
return (0,
|
|
14969
|
+
return (0, import_react69.useCallback)((value, options) => {
|
|
15256
14970
|
const p = value.parameter;
|
|
15257
14971
|
const tags = options?.tags;
|
|
15258
14972
|
const dateFormat = value.dataType === "dateTime" ? "dateTime" : "date";
|
|
@@ -15454,9 +15168,9 @@ var TableProvider = ({
|
|
|
15454
15168
|
}) => {
|
|
15455
15169
|
const onRowClickStable = useEventCallbackStabilizer(onRowClick);
|
|
15456
15170
|
const onFillerRowClickStable = useEventCallbackStabilizer(onFillerRowClick);
|
|
15457
|
-
const [registeredColumns, setRegisteredColumns] = (0,
|
|
15458
|
-
const containerRef = (0,
|
|
15459
|
-
const [, setTableState] = (0,
|
|
15171
|
+
const [registeredColumns, setRegisteredColumns] = (0, import_react70.useState)([]);
|
|
15172
|
+
const containerRef = (0, import_react70.useRef)(null);
|
|
15173
|
+
const [, setTableState] = (0, import_react70.useState)({
|
|
15460
15174
|
columnSizing: {},
|
|
15461
15175
|
columnOrder: [],
|
|
15462
15176
|
columnFilters: [],
|
|
@@ -15481,16 +15195,16 @@ var TableProvider = ({
|
|
|
15481
15195
|
pageSize: 10
|
|
15482
15196
|
}
|
|
15483
15197
|
});
|
|
15484
|
-
const [targetWidth, setTargetWidth] = (0,
|
|
15485
|
-
(0,
|
|
15198
|
+
const [targetWidth, setTargetWidth] = (0, import_react70.useState)(void 0);
|
|
15199
|
+
(0, import_react70.useLayoutEffect)(() => {
|
|
15486
15200
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
15487
15201
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
15488
15202
|
}, [containerRef]);
|
|
15489
|
-
useWindowResizeObserver((0,
|
|
15203
|
+
useWindowResizeObserver((0, import_react70.useCallback)(() => {
|
|
15490
15204
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
15491
15205
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
15492
15206
|
}, [containerRef]));
|
|
15493
|
-
const registerColumn = (0,
|
|
15207
|
+
const registerColumn = (0, import_react70.useCallback)((column) => {
|
|
15494
15208
|
setRegisteredColumns((prev) => {
|
|
15495
15209
|
return [...prev, column];
|
|
15496
15210
|
});
|
|
@@ -15500,7 +15214,7 @@ var TableProvider = ({
|
|
|
15500
15214
|
});
|
|
15501
15215
|
};
|
|
15502
15216
|
}, []);
|
|
15503
|
-
const columns = (0,
|
|
15217
|
+
const columns = (0, import_react70.useMemo)(() => {
|
|
15504
15218
|
const contextColumns = Array.from(registeredColumns.values());
|
|
15505
15219
|
if (columnsProp) {
|
|
15506
15220
|
return [...contextColumns, ...columnsProp];
|
|
@@ -15517,7 +15231,7 @@ var TableProvider = ({
|
|
|
15517
15231
|
defaultColumn: {
|
|
15518
15232
|
minSize: 60,
|
|
15519
15233
|
maxSize: 800,
|
|
15520
|
-
cell: (0,
|
|
15234
|
+
cell: (0, import_react70.useCallback)(({ cell }) => {
|
|
15521
15235
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TableCell, { children: String(cell.getValue()) });
|
|
15522
15236
|
}, []),
|
|
15523
15237
|
enableResizing: true,
|
|
@@ -15558,7 +15272,7 @@ var TableProvider = ({
|
|
|
15558
15272
|
});
|
|
15559
15273
|
const pagination = table.getState().pagination;
|
|
15560
15274
|
const pageCount = table.getPageCount();
|
|
15561
|
-
(0,
|
|
15275
|
+
(0, import_react70.useEffect)(() => {
|
|
15562
15276
|
if (pageCount === -1) {
|
|
15563
15277
|
return;
|
|
15564
15278
|
}
|
|
@@ -15566,20 +15280,20 @@ var TableProvider = ({
|
|
|
15566
15280
|
table.setPageIndex(pageCount - 1);
|
|
15567
15281
|
}
|
|
15568
15282
|
}, [table, pagination.pageIndex, pageCount]);
|
|
15569
|
-
(0,
|
|
15283
|
+
(0, import_react70.useEffect)(() => {
|
|
15570
15284
|
table.setColumnOrder((prev) => [...prev]);
|
|
15571
15285
|
}, [table, columns]);
|
|
15572
15286
|
const columnVisibility = table.getState().columnVisibility;
|
|
15573
15287
|
const columnOrder = table.getState().columnOrder;
|
|
15574
15288
|
const columnPinning = table.getState().columnPinning;
|
|
15575
|
-
(0,
|
|
15289
|
+
(0, import_react70.useEffect)(() => {
|
|
15576
15290
|
table.setColumnSizing((prev) => ({ ...prev }));
|
|
15577
15291
|
}, [table, targetWidth, columnVisibility, columnOrder, columnPinning]);
|
|
15578
|
-
const tableColumnDefinitionContextValue = (0,
|
|
15292
|
+
const tableColumnDefinitionContextValue = (0, import_react70.useMemo)(() => ({
|
|
15579
15293
|
table,
|
|
15580
15294
|
registerColumn
|
|
15581
15295
|
}), [table, registerColumn]);
|
|
15582
|
-
const tableContainerContextValue = (0,
|
|
15296
|
+
const tableContainerContextValue = (0, import_react70.useMemo)(() => ({
|
|
15583
15297
|
table,
|
|
15584
15298
|
containerRef
|
|
15585
15299
|
}), [table, containerRef]);
|
|
@@ -15588,7 +15302,7 @@ var TableProvider = ({
|
|
|
15588
15302
|
return rest;
|
|
15589
15303
|
})();
|
|
15590
15304
|
const rowModel = table.getRowModel();
|
|
15591
|
-
const tableStateWithoutSizingContextValue = (0,
|
|
15305
|
+
const tableStateWithoutSizingContextValue = (0, import_react70.useMemo)(() => ({
|
|
15592
15306
|
table,
|
|
15593
15307
|
isUsingFillerRows,
|
|
15594
15308
|
fillerRowCell,
|
|
@@ -15631,7 +15345,7 @@ var TableProvider = ({
|
|
|
15631
15345
|
]);
|
|
15632
15346
|
const columnSizing = table.getState().columnSizing;
|
|
15633
15347
|
const columnSizingInfo = table.getState().columnSizingInfo;
|
|
15634
|
-
const tableStateContextValue = (0,
|
|
15348
|
+
const tableStateContextValue = (0, import_react70.useMemo)(() => ({
|
|
15635
15349
|
...tableStateWithoutSizingContextValue,
|
|
15636
15350
|
sizeVars: ColumnSizeUtil.toSizeVars(columnSizing),
|
|
15637
15351
|
columnSizingInfo,
|
|
@@ -15642,10 +15356,10 @@ var TableProvider = ({
|
|
|
15642
15356
|
|
|
15643
15357
|
// src/components/layout/table/TableBody.tsx
|
|
15644
15358
|
var import_react_table2 = require("@tanstack/react-table");
|
|
15645
|
-
var
|
|
15359
|
+
var import_react71 = __toESM(require("react"));
|
|
15646
15360
|
var import_clsx20 = __toESM(require("clsx"));
|
|
15647
15361
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
15648
|
-
var TableBody =
|
|
15362
|
+
var TableBody = import_react71.default.memo(function TableBodyVisual() {
|
|
15649
15363
|
const { table, isUsingFillerRows, fillerRowCell, onRowClick, onFillerRowClick } = useTableStateWithoutSizingContext();
|
|
15650
15364
|
const rows = table.getRowModel().rows;
|
|
15651
15365
|
const columnOrder = table.getState().columnOrder;
|
|
@@ -15743,16 +15457,16 @@ var TableSortButton = ({
|
|
|
15743
15457
|
|
|
15744
15458
|
// src/components/layout/table/TableFilterButton.tsx
|
|
15745
15459
|
var import_lucide_react21 = require("lucide-react");
|
|
15746
|
-
var
|
|
15460
|
+
var import_react88 = require("react");
|
|
15747
15461
|
var import_react_table3 = require("@tanstack/react-table");
|
|
15748
15462
|
|
|
15749
15463
|
// src/components/user-interaction/data/FilterPopUp.tsx
|
|
15750
15464
|
var import_lucide_react20 = require("lucide-react");
|
|
15751
|
-
var
|
|
15465
|
+
var import_react87 = require("react");
|
|
15752
15466
|
|
|
15753
15467
|
// src/components/user-interaction/Checkbox.tsx
|
|
15754
15468
|
var import_lucide_react16 = require("lucide-react");
|
|
15755
|
-
var
|
|
15469
|
+
var import_react72 = require("react");
|
|
15756
15470
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
15757
15471
|
var Checkbox = ({
|
|
15758
15472
|
value: controlledValue,
|
|
@@ -15770,7 +15484,7 @@ var Checkbox = ({
|
|
|
15770
15484
|
}) => {
|
|
15771
15485
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15772
15486
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
15773
|
-
const onChangeWrapper = (0,
|
|
15487
|
+
const onChangeWrapper = (0, import_react72.useCallback)((value2) => {
|
|
15774
15488
|
onValueChangeStable(value2);
|
|
15775
15489
|
onEditCompleteStable(value2);
|
|
15776
15490
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -15814,12 +15528,12 @@ var Checkbox = ({
|
|
|
15814
15528
|
};
|
|
15815
15529
|
|
|
15816
15530
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
15817
|
-
var
|
|
15531
|
+
var import_react78 = require("react");
|
|
15818
15532
|
var import_lucide_react18 = require("lucide-react");
|
|
15819
15533
|
var import_clsx24 = __toESM(require("clsx"));
|
|
15820
15534
|
|
|
15821
15535
|
// src/components/user-interaction/date/TimePicker.tsx
|
|
15822
|
-
var
|
|
15536
|
+
var import_react73 = require("react");
|
|
15823
15537
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
15824
15538
|
var TimePicker = ({
|
|
15825
15539
|
value: controlledValue,
|
|
@@ -15838,11 +15552,11 @@ var TimePicker = ({
|
|
|
15838
15552
|
onValueChange,
|
|
15839
15553
|
defaultValue: initialValue
|
|
15840
15554
|
});
|
|
15841
|
-
const minuteRef = (0,
|
|
15842
|
-
const hourRef = (0,
|
|
15555
|
+
const minuteRef = (0, import_react73.useRef)(null);
|
|
15556
|
+
const hourRef = (0, import_react73.useRef)(null);
|
|
15843
15557
|
const isPM = value.getHours() > 11;
|
|
15844
15558
|
const hours = is24HourFormat ? range(24) : range(12);
|
|
15845
|
-
const minutes = (0,
|
|
15559
|
+
const minutes = (0, import_react73.useMemo)(() => {
|
|
15846
15560
|
const full = range(60);
|
|
15847
15561
|
switch (minuteIncrement) {
|
|
15848
15562
|
case "5min":
|
|
@@ -15855,7 +15569,7 @@ var TimePicker = ({
|
|
|
15855
15569
|
return full.filter((value2) => value2 % 30 === 0);
|
|
15856
15570
|
}
|
|
15857
15571
|
}, [minuteIncrement]);
|
|
15858
|
-
const seconds = (0,
|
|
15572
|
+
const seconds = (0, import_react73.useMemo)(() => {
|
|
15859
15573
|
const full = range(60);
|
|
15860
15574
|
switch (secondIncrement) {
|
|
15861
15575
|
case "1s":
|
|
@@ -15870,7 +15584,7 @@ var TimePicker = ({
|
|
|
15870
15584
|
return full.filter((value2) => value2 % 30 === 0);
|
|
15871
15585
|
}
|
|
15872
15586
|
}, [secondIncrement]);
|
|
15873
|
-
const milliseconds = (0,
|
|
15587
|
+
const milliseconds = (0, import_react73.useMemo)(() => {
|
|
15874
15588
|
const full = range(1e3);
|
|
15875
15589
|
switch (millisecondIncrement) {
|
|
15876
15590
|
case "1ms":
|
|
@@ -15891,17 +15605,17 @@ var TimePicker = ({
|
|
|
15891
15605
|
return full.filter((value2) => value2 % 500 === 0);
|
|
15892
15606
|
}
|
|
15893
15607
|
}, [millisecondIncrement]);
|
|
15894
|
-
const closestMinute = (0,
|
|
15895
|
-
const closestSecond = (0,
|
|
15896
|
-
const closestMillisecond = (0,
|
|
15608
|
+
const closestMinute = (0, import_react73.useMemo)(() => closestMatch(minutes, (item1, item2) => Math.abs(item1 - value.getMinutes()) < Math.abs(item2 - value.getMinutes())), [minutes, value]);
|
|
15609
|
+
const closestSecond = (0, import_react73.useMemo)(() => closestMatch(seconds, (item1, item2) => Math.abs(item1 - value.getSeconds()) < Math.abs(item2 - value.getSeconds())), [seconds, value]);
|
|
15610
|
+
const closestMillisecond = (0, import_react73.useMemo)(() => closestMatch(milliseconds, (item1, item2) => Math.abs(item1 - value.getMilliseconds()) < Math.abs(item2 - value.getMilliseconds())), [milliseconds, value]);
|
|
15897
15611
|
const hour = value.getHours();
|
|
15898
|
-
(0,
|
|
15612
|
+
(0, import_react73.useEffect)(() => {
|
|
15899
15613
|
minuteRef.current?.scrollIntoView({
|
|
15900
15614
|
behavior: "smooth",
|
|
15901
15615
|
block: "nearest"
|
|
15902
15616
|
});
|
|
15903
15617
|
}, [closestMinute]);
|
|
15904
|
-
(0,
|
|
15618
|
+
(0, import_react73.useEffect)(() => {
|
|
15905
15619
|
hourRef.current?.scrollIntoView({
|
|
15906
15620
|
behavior: "smooth",
|
|
15907
15621
|
block: "nearest"
|
|
@@ -16000,12 +15714,12 @@ var TimePicker = ({
|
|
|
16000
15714
|
};
|
|
16001
15715
|
|
|
16002
15716
|
// src/components/user-interaction/date/DatePicker.tsx
|
|
16003
|
-
var
|
|
15717
|
+
var import_react76 = require("react");
|
|
16004
15718
|
var import_lucide_react17 = require("lucide-react");
|
|
16005
15719
|
var import_clsx23 = __toESM(require("clsx"));
|
|
16006
15720
|
|
|
16007
15721
|
// src/components/user-interaction/date/DayPicker.tsx
|
|
16008
|
-
var
|
|
15722
|
+
var import_react74 = require("react");
|
|
16009
15723
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
16010
15724
|
var DayPicker = ({
|
|
16011
15725
|
displayedMonth: controlledDisplayedMonth,
|
|
@@ -16034,33 +15748,33 @@ var DayPicker = ({
|
|
|
16034
15748
|
});
|
|
16035
15749
|
const month = displayedMonth.getMonth();
|
|
16036
15750
|
const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
|
|
16037
|
-
const selectedButtonRef = (0,
|
|
16038
|
-
const isValueInDisplayedWeeks = (0,
|
|
15751
|
+
const selectedButtonRef = (0, import_react74.useRef)(null);
|
|
15752
|
+
const isValueInDisplayedWeeks = (0, import_react74.useMemo)(
|
|
16039
15753
|
() => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
|
|
16040
15754
|
[value, weeks]
|
|
16041
15755
|
);
|
|
16042
|
-
const firstDayOfMonth = (0,
|
|
15756
|
+
const firstDayOfMonth = (0, import_react74.useCallback)(
|
|
16043
15757
|
(date) => new Date(date.getFullYear(), date.getMonth(), 1),
|
|
16044
15758
|
[]
|
|
16045
15759
|
);
|
|
16046
15760
|
const focusTargetDate = value && isValueInDisplayedWeeks ? value : firstDayOfMonth(displayedMonth);
|
|
16047
|
-
(0,
|
|
15761
|
+
(0, import_react74.useEffect)(() => {
|
|
16048
15762
|
selectedButtonRef.current?.focus();
|
|
16049
15763
|
}, [focusTargetDate]);
|
|
16050
|
-
const end = (0,
|
|
15764
|
+
const end = (0, import_react74.useMemo)(() => {
|
|
16051
15765
|
if (!providedEnd) return;
|
|
16052
15766
|
return new Date(providedEnd.getFullYear(), providedEnd.getMonth(), providedEnd.getDate());
|
|
16053
15767
|
}, [providedEnd]);
|
|
16054
|
-
const start = (0,
|
|
15768
|
+
const start = (0, import_react74.useMemo)(() => {
|
|
16055
15769
|
if (!providedStart) return;
|
|
16056
15770
|
return new Date(providedStart.getFullYear(), providedStart.getMonth(), providedStart.getDate());
|
|
16057
15771
|
}, [providedStart]);
|
|
16058
|
-
const clampToRange = (0,
|
|
15772
|
+
const clampToRange = (0, import_react74.useCallback)((date) => {
|
|
16059
15773
|
if (start && date < start) return start;
|
|
16060
15774
|
if (end && date > end) return end;
|
|
16061
15775
|
return date;
|
|
16062
15776
|
}, [start, end]);
|
|
16063
|
-
const navigateTo = (0,
|
|
15777
|
+
const navigateTo = (0, import_react74.useCallback)((candidate) => {
|
|
16064
15778
|
const clamped = clampToRange(candidate);
|
|
16065
15779
|
if (!DateUtils.between(clamped, start, end)) return;
|
|
16066
15780
|
setValue(clamped);
|
|
@@ -16069,7 +15783,7 @@ var DayPicker = ({
|
|
|
16069
15783
|
setDisplayedMonth(firstDayOfMonth(clamped));
|
|
16070
15784
|
}
|
|
16071
15785
|
}, [clampToRange, start, end, setValue, onEditComplete, displayedMonth, setDisplayedMonth, firstDayOfMonth]);
|
|
16072
|
-
const onKeyDown = (0,
|
|
15786
|
+
const onKeyDown = (0, import_react74.useCallback)(
|
|
16073
15787
|
(event) => {
|
|
16074
15788
|
PropsUtil.aria.navigate({
|
|
16075
15789
|
left: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 1 })),
|
|
@@ -16126,10 +15840,10 @@ var DayPicker = ({
|
|
|
16126
15840
|
};
|
|
16127
15841
|
|
|
16128
15842
|
// src/components/user-interaction/date/YearMonthPicker.tsx
|
|
16129
|
-
var
|
|
15843
|
+
var import_react75 = require("react");
|
|
16130
15844
|
var import_clsx22 = __toESM(require("clsx"));
|
|
16131
15845
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
16132
|
-
var YearRow = (0,
|
|
15846
|
+
var YearRow = (0, import_react75.memo)(function YearRow2({
|
|
16133
15847
|
year,
|
|
16134
15848
|
selectedMonthIndex,
|
|
16135
15849
|
minTimestamp,
|
|
@@ -16137,15 +15851,15 @@ var YearRow = (0, import_react85.memo)(function YearRow2({
|
|
|
16137
15851
|
monthNames,
|
|
16138
15852
|
onSelect
|
|
16139
15853
|
}) {
|
|
16140
|
-
const ref = (0,
|
|
15854
|
+
const ref = (0, import_react75.useRef)(null);
|
|
16141
15855
|
const isSelectedYear = selectedMonthIndex !== void 0;
|
|
16142
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
16143
|
-
(0,
|
|
15856
|
+
const [isExpanded, setIsExpanded] = (0, import_react75.useState)(false);
|
|
15857
|
+
(0, import_react75.useEffect)(() => {
|
|
16144
15858
|
if (isSelectedYear) {
|
|
16145
15859
|
ref.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
16146
15860
|
}
|
|
16147
15861
|
}, [isSelectedYear]);
|
|
16148
|
-
const monthGrid = (0,
|
|
15862
|
+
const monthGrid = (0, import_react75.useMemo)(() => equalSizeGroups([...DateUtils.monthsList], 3), []);
|
|
16149
15863
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
16150
15864
|
ExpandableRoot,
|
|
16151
15865
|
{
|
|
@@ -16200,23 +15914,23 @@ var YearMonthPicker = ({
|
|
|
16200
15914
|
defaultValue: initialValue
|
|
16201
15915
|
});
|
|
16202
15916
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
16203
|
-
const monthNames = (0,
|
|
15917
|
+
const monthNames = (0, import_react75.useMemo)(() => {
|
|
16204
15918
|
const formatter = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
16205
15919
|
return Array.from({ length: 12 }, (_, i) => formatter.format(new Date(2e3, i, 1)));
|
|
16206
15920
|
}, [locale]);
|
|
16207
|
-
const years = (0,
|
|
15921
|
+
const years = (0, import_react75.useMemo)(
|
|
16208
15922
|
() => range([start.getFullYear(), end.getFullYear()], { exclusiveEnd: false }),
|
|
16209
15923
|
[start, end]
|
|
16210
15924
|
);
|
|
16211
|
-
const minTimestamp = (0,
|
|
15925
|
+
const minTimestamp = (0, import_react75.useMemo)(() => {
|
|
16212
15926
|
if (!start) return;
|
|
16213
15927
|
return new Date(start.getFullYear(), start.getMonth(), 1).getTime();
|
|
16214
15928
|
}, [start]);
|
|
16215
|
-
const maxTimestamp = (0,
|
|
15929
|
+
const maxTimestamp = (0, import_react75.useMemo)(() => {
|
|
16216
15930
|
if (!end) return;
|
|
16217
15931
|
return new Date(end.getFullYear(), end.getMonth() + 1, 0).getTime();
|
|
16218
15932
|
}, [end]);
|
|
16219
|
-
const handleSelect = (0,
|
|
15933
|
+
const handleSelect = (0, import_react75.useCallback)((newDate) => {
|
|
16220
15934
|
setValue(newDate);
|
|
16221
15935
|
onEditCompleteStable(newDate);
|
|
16222
15936
|
}, [onEditCompleteStable, setValue]);
|
|
@@ -16269,8 +15983,8 @@ var DatePicker = ({
|
|
|
16269
15983
|
onValueChange,
|
|
16270
15984
|
defaultValue: initialValue
|
|
16271
15985
|
});
|
|
16272
|
-
const [displayedMonth, setDisplayedMonth] = (0,
|
|
16273
|
-
const [displayMode, setDisplayMode] = (0,
|
|
15986
|
+
const [displayedMonth, setDisplayedMonth] = (0, import_react76.useState)(new Date(value.getFullYear(), value.getMonth(), 1));
|
|
15987
|
+
const [displayMode, setDisplayMode] = (0, import_react76.useState)(initialDisplay);
|
|
16274
15988
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: (0, import_clsx23.default)("flex-col-3", className), children: [
|
|
16275
15989
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex-row-2 items-center justify-between", children: [
|
|
16276
15990
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
@@ -16432,7 +16146,7 @@ var DateTimePicker = ({
|
|
|
16432
16146
|
};
|
|
16433
16147
|
|
|
16434
16148
|
// src/components/user-interaction/date/DateTimePickerDialog.tsx
|
|
16435
|
-
var
|
|
16149
|
+
var import_react77 = require("react");
|
|
16436
16150
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
16437
16151
|
var DateTimePickerDialog = ({
|
|
16438
16152
|
initialValue = null,
|
|
@@ -16460,8 +16174,8 @@ var DateTimePickerDialog = ({
|
|
|
16460
16174
|
onValueChange,
|
|
16461
16175
|
defaultValue: initialValue
|
|
16462
16176
|
});
|
|
16463
|
-
const [pickerState, setPickerState] = (0,
|
|
16464
|
-
(0,
|
|
16177
|
+
const [pickerState, setPickerState] = (0, import_react77.useState)(state ?? /* @__PURE__ */ new Date());
|
|
16178
|
+
(0, import_react77.useEffect)(() => {
|
|
16465
16179
|
setPickerState(state ?? /* @__PURE__ */ new Date());
|
|
16466
16180
|
}, [state]);
|
|
16467
16181
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
@@ -16536,7 +16250,7 @@ var DateTimePickerDialog = ({
|
|
|
16536
16250
|
|
|
16537
16251
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
16538
16252
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
16539
|
-
var DateTimeInput = (0,
|
|
16253
|
+
var DateTimeInput = (0, import_react78.forwardRef)(function DateTimeInput2({
|
|
16540
16254
|
id: inputId,
|
|
16541
16255
|
value,
|
|
16542
16256
|
initialValue = null,
|
|
@@ -16561,40 +16275,41 @@ var DateTimeInput = (0, import_react88.forwardRef)(function DateTimeInput2({
|
|
|
16561
16275
|
readOnly = false,
|
|
16562
16276
|
invalid = false,
|
|
16563
16277
|
required = false,
|
|
16278
|
+
actions = [],
|
|
16564
16279
|
...props
|
|
16565
16280
|
}, forwardedRef) {
|
|
16566
16281
|
const translation = useHightideTranslation();
|
|
16567
|
-
const [isOpen, setIsOpen] = (0,
|
|
16282
|
+
const [isOpen, setIsOpen] = (0, import_react78.useState)(false);
|
|
16568
16283
|
const [state, setState] = useControlledState({
|
|
16569
16284
|
value,
|
|
16570
16285
|
onValueChange,
|
|
16571
16286
|
defaultValue: initialValue
|
|
16572
16287
|
});
|
|
16573
|
-
const [dialogValue, setDialogValue] = (0,
|
|
16574
|
-
const [stringInputState, setStringInputState] = (0,
|
|
16288
|
+
const [dialogValue, setDialogValue] = (0, import_react78.useState)(state);
|
|
16289
|
+
const [stringInputState, setStringInputState] = (0, import_react78.useState)({
|
|
16575
16290
|
state: state ? DateUtils.toInputString(state, mode, precision) : "",
|
|
16576
16291
|
date: void 0
|
|
16577
16292
|
});
|
|
16578
|
-
(0,
|
|
16293
|
+
(0, import_react78.useEffect)(() => {
|
|
16579
16294
|
setDialogValue(state);
|
|
16580
16295
|
setStringInputState({
|
|
16581
16296
|
state: state ? DateUtils.toInputString(state, mode) : "",
|
|
16582
16297
|
date: void 0
|
|
16583
16298
|
});
|
|
16584
16299
|
}, [mode, state]);
|
|
16585
|
-
const changeOpenWrapper = (0,
|
|
16300
|
+
const changeOpenWrapper = (0, import_react78.useCallback)((isOpen2) => {
|
|
16586
16301
|
onDialogOpeningChange?.(isOpen2);
|
|
16587
16302
|
setIsOpen(isOpen2);
|
|
16588
16303
|
}, [onDialogOpeningChange]);
|
|
16589
|
-
const generatedId = (0,
|
|
16590
|
-
const ids = (0,
|
|
16304
|
+
const generatedId = (0, import_react78.useId)();
|
|
16305
|
+
const ids = (0, import_react78.useMemo)(() => ({
|
|
16591
16306
|
input: inputId ?? `date-time-input-${generatedId}`,
|
|
16592
16307
|
popup: `date-time-input-popup-${generatedId}`,
|
|
16593
16308
|
label: `date-time-input-label-${generatedId}`
|
|
16594
16309
|
}), [generatedId, inputId]);
|
|
16595
|
-
const innerRef = (0,
|
|
16596
|
-
(0,
|
|
16597
|
-
(0,
|
|
16310
|
+
const innerRef = (0, import_react78.useRef)(null);
|
|
16311
|
+
(0, import_react78.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
16312
|
+
(0, import_react78.useEffect)(() => {
|
|
16598
16313
|
if (readOnly || disabled) {
|
|
16599
16314
|
changeOpenWrapper(false);
|
|
16600
16315
|
}
|
|
@@ -16612,6 +16327,12 @@ var DateTimeInput = (0, import_react88.forwardRef)(function DateTimeInput2({
|
|
|
16612
16327
|
ref: innerRef,
|
|
16613
16328
|
id: ids.input,
|
|
16614
16329
|
value: stringInputState.state,
|
|
16330
|
+
onClick: (event) => {
|
|
16331
|
+
event.preventDefault();
|
|
16332
|
+
},
|
|
16333
|
+
onFocus: (event) => {
|
|
16334
|
+
event.preventDefault();
|
|
16335
|
+
},
|
|
16615
16336
|
onChange: (event) => {
|
|
16616
16337
|
const date = new Date(event.target.value ?? "");
|
|
16617
16338
|
const isValid = !isNaN(date.getTime());
|
|
@@ -16652,24 +16373,26 @@ var DateTimeInput = (0, import_react88.forwardRef)(function DateTimeInput2({
|
|
|
16652
16373
|
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props)
|
|
16653
16374
|
}
|
|
16654
16375
|
),
|
|
16655
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.
|
|
16656
|
-
|
|
16657
|
-
{
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16376
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "absolute right-1 top-1/2 -translate-y-1/2 flex-row-0", children: [
|
|
16377
|
+
actions,
|
|
16378
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Visibility, { isVisible: !readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
16379
|
+
IconButton,
|
|
16380
|
+
{
|
|
16381
|
+
tooltip: translation("sDateTimeSelect", { datetimeMode: mode }),
|
|
16382
|
+
coloringStyle: "text",
|
|
16383
|
+
color: "neutral",
|
|
16384
|
+
size: "sm",
|
|
16385
|
+
disabled,
|
|
16386
|
+
onClick: () => {
|
|
16387
|
+
changeOpenWrapper(true);
|
|
16388
|
+
},
|
|
16389
|
+
"aria-haspopup": "dialog",
|
|
16390
|
+
"aria-expanded": isOpen,
|
|
16391
|
+
"aria-controls": isOpen ? ids.popup : void 0,
|
|
16392
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_lucide_react18.CalendarIcon, { className: "size-5" })
|
|
16393
|
+
}
|
|
16394
|
+
) })
|
|
16395
|
+
] })
|
|
16673
16396
|
] }),
|
|
16674
16397
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
16675
16398
|
PopUp,
|
|
@@ -16720,22 +16443,63 @@ var DateTimeInput = (0, import_react88.forwardRef)(function DateTimeInput2({
|
|
|
16720
16443
|
});
|
|
16721
16444
|
|
|
16722
16445
|
// src/components/user-interaction/MultiSelect/MultiSelect.tsx
|
|
16723
|
-
var
|
|
16446
|
+
var import_react86 = require("react");
|
|
16724
16447
|
|
|
16725
16448
|
// src/components/user-interaction/MultiSelect/MultiSelectRoot.tsx
|
|
16726
|
-
var
|
|
16449
|
+
var import_react82 = require("react");
|
|
16727
16450
|
|
|
16728
16451
|
// src/components/user-interaction/MultiSelect/MultiSelectContext.tsx
|
|
16729
|
-
var
|
|
16730
|
-
var MultiSelectContext = (0,
|
|
16452
|
+
var import_react79 = require("react");
|
|
16453
|
+
var MultiSelectContext = (0, import_react79.createContext)(null);
|
|
16731
16454
|
function useMultiSelectContext() {
|
|
16732
|
-
const ctx = (0,
|
|
16455
|
+
const ctx = (0, import_react79.useContext)(MultiSelectContext);
|
|
16733
16456
|
if (!ctx) throw new Error("useMultiSelectContext must be used within MultiSelectRoot");
|
|
16734
16457
|
return ctx;
|
|
16735
16458
|
}
|
|
16736
16459
|
|
|
16737
16460
|
// src/components/user-interaction/MultiSelect/useMultiSelect.ts
|
|
16738
|
-
var
|
|
16461
|
+
var import_react81 = require("react");
|
|
16462
|
+
|
|
16463
|
+
// src/hooks/useMultiSelection.ts
|
|
16464
|
+
var import_react80 = require("react");
|
|
16465
|
+
function useMultiSelection({
|
|
16466
|
+
options: optionsList,
|
|
16467
|
+
value,
|
|
16468
|
+
onSelectionChange,
|
|
16469
|
+
initialSelection = [],
|
|
16470
|
+
isControlled
|
|
16471
|
+
}) {
|
|
16472
|
+
const [selection, setSelection] = useControlledState({
|
|
16473
|
+
value,
|
|
16474
|
+
onValueChange: onSelectionChange,
|
|
16475
|
+
defaultValue: [...initialSelection],
|
|
16476
|
+
isControlled
|
|
16477
|
+
});
|
|
16478
|
+
const isSelected = (0, import_react80.useCallback)((id) => selection.includes(id), [selection]);
|
|
16479
|
+
const toggleSelection = (0, import_react80.useCallback)(
|
|
16480
|
+
(id) => {
|
|
16481
|
+
const option = optionsList.find((o) => o.id === id);
|
|
16482
|
+
if (!option || option.disabled) return;
|
|
16483
|
+
setSelection((prev) => prev.includes(id) ? prev.filter((s) => s !== id) : [...prev, id]);
|
|
16484
|
+
},
|
|
16485
|
+
[optionsList, setSelection]
|
|
16486
|
+
);
|
|
16487
|
+
const setSelectionValue = (0, import_react80.useCallback)(
|
|
16488
|
+
(next) => setSelection(Array.from(next)),
|
|
16489
|
+
[setSelection]
|
|
16490
|
+
);
|
|
16491
|
+
return (0, import_react80.useMemo)(
|
|
16492
|
+
() => ({
|
|
16493
|
+
selection,
|
|
16494
|
+
setSelection: setSelectionValue,
|
|
16495
|
+
toggleSelection,
|
|
16496
|
+
isSelected
|
|
16497
|
+
}),
|
|
16498
|
+
[selection, setSelectionValue, toggleSelection, isSelected]
|
|
16499
|
+
);
|
|
16500
|
+
}
|
|
16501
|
+
|
|
16502
|
+
// src/components/user-interaction/MultiSelect/useMultiSelect.ts
|
|
16739
16503
|
function useMultiSelect({
|
|
16740
16504
|
options,
|
|
16741
16505
|
value: controlledValue,
|
|
@@ -16746,9 +16510,9 @@ function useMultiSelect({
|
|
|
16746
16510
|
initialIsOpen = false,
|
|
16747
16511
|
typeAheadResetMs = 500
|
|
16748
16512
|
}) {
|
|
16749
|
-
const [isOpen, setIsOpen] = (0,
|
|
16750
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
16751
|
-
const selectionOptions = (0,
|
|
16513
|
+
const [isOpen, setIsOpen] = (0, import_react81.useState)(initialIsOpen);
|
|
16514
|
+
const [searchQuery, setSearchQuery] = (0, import_react81.useState)("");
|
|
16515
|
+
const selectionOptions = (0, import_react81.useMemo)(
|
|
16752
16516
|
() => options.map((o) => ({ id: o.id, disabled: o.disabled })),
|
|
16753
16517
|
[options]
|
|
16754
16518
|
);
|
|
@@ -16764,13 +16528,13 @@ function useMultiSelect({
|
|
|
16764
16528
|
const { searchResult: visibleOptions } = useSearch({
|
|
16765
16529
|
items: options,
|
|
16766
16530
|
searchQuery,
|
|
16767
|
-
toTags: (0,
|
|
16531
|
+
toTags: (0, import_react81.useCallback)((o) => [o.label ?? ""], [])
|
|
16768
16532
|
});
|
|
16769
|
-
const visibleOptionIds = (0,
|
|
16533
|
+
const visibleOptionIds = (0, import_react81.useMemo)(
|
|
16770
16534
|
() => visibleOptions.map((o) => o.id),
|
|
16771
16535
|
[visibleOptions]
|
|
16772
16536
|
);
|
|
16773
|
-
const enabledOptions = (0,
|
|
16537
|
+
const enabledOptions = (0, import_react81.useMemo)(
|
|
16774
16538
|
() => visibleOptions.filter((o) => !o.disabled),
|
|
16775
16539
|
[visibleOptions]
|
|
16776
16540
|
);
|
|
@@ -16783,7 +16547,7 @@ function useMultiSelect({
|
|
|
16783
16547
|
options: enabledOptions,
|
|
16784
16548
|
resetTimer: typeAheadResetMs,
|
|
16785
16549
|
toString: (o) => o.label ?? "",
|
|
16786
|
-
onResultChange: (0,
|
|
16550
|
+
onResultChange: (0, import_react81.useCallback)(
|
|
16787
16551
|
(option) => {
|
|
16788
16552
|
if (option) listNav.highlight(option.id);
|
|
16789
16553
|
},
|
|
@@ -16791,14 +16555,14 @@ function useMultiSelect({
|
|
|
16791
16555
|
)
|
|
16792
16556
|
});
|
|
16793
16557
|
const { reset: typeAheadReset, addToTypeAhead } = typeAhead;
|
|
16794
|
-
(0,
|
|
16558
|
+
(0, import_react81.useEffect)(() => {
|
|
16795
16559
|
if (!isOpen) typeAheadReset();
|
|
16796
16560
|
}, [isOpen, typeAheadReset]);
|
|
16797
|
-
const highlightItem = (0,
|
|
16561
|
+
const highlightItem = (0, import_react81.useCallback)((id) => {
|
|
16798
16562
|
if (!enabledOptions.some((o) => o.id === id)) return;
|
|
16799
16563
|
listNavHighlight(id);
|
|
16800
16564
|
}, [enabledOptions, listNavHighlight]);
|
|
16801
|
-
const toggleSelectionValue = (0,
|
|
16565
|
+
const toggleSelectionValue = (0, import_react81.useCallback)((id, newIsSelected) => {
|
|
16802
16566
|
const next = newIsSelected ?? !isSelected(id);
|
|
16803
16567
|
if (next) {
|
|
16804
16568
|
toggleSelection(id);
|
|
@@ -16807,7 +16571,7 @@ function useMultiSelect({
|
|
|
16807
16571
|
}
|
|
16808
16572
|
highlightItem(id);
|
|
16809
16573
|
}, [toggleSelection, setSelection, highlightItem, isSelected, selection]);
|
|
16810
|
-
const setIsOpenWrapper = (0,
|
|
16574
|
+
const setIsOpenWrapper = (0, import_react81.useCallback)(
|
|
16811
16575
|
(open, behavior) => {
|
|
16812
16576
|
setIsOpen(open);
|
|
16813
16577
|
behavior = behavior ?? "first";
|
|
@@ -16838,13 +16602,13 @@ function useMultiSelect({
|
|
|
16838
16602
|
enabledOptions
|
|
16839
16603
|
]
|
|
16840
16604
|
);
|
|
16841
|
-
const toggleOpenWrapper = (0,
|
|
16605
|
+
const toggleOpenWrapper = (0, import_react81.useCallback)(
|
|
16842
16606
|
(behavior) => {
|
|
16843
16607
|
setIsOpenWrapper(!isOpen, behavior);
|
|
16844
16608
|
},
|
|
16845
16609
|
[isOpen, setIsOpenWrapper]
|
|
16846
16610
|
);
|
|
16847
|
-
const state = (0,
|
|
16611
|
+
const state = (0, import_react81.useMemo)(
|
|
16848
16612
|
() => ({
|
|
16849
16613
|
value: [...selection],
|
|
16850
16614
|
highlightedId: listNav.highlightedId,
|
|
@@ -16860,11 +16624,11 @@ function useMultiSelect({
|
|
|
16860
16624
|
options
|
|
16861
16625
|
]
|
|
16862
16626
|
);
|
|
16863
|
-
const computedState = (0,
|
|
16627
|
+
const computedState = (0, import_react81.useMemo)(
|
|
16864
16628
|
() => ({ visibleOptionIds }),
|
|
16865
16629
|
[visibleOptionIds]
|
|
16866
16630
|
);
|
|
16867
|
-
const actions = (0,
|
|
16631
|
+
const actions = (0, import_react81.useMemo)(
|
|
16868
16632
|
() => ({
|
|
16869
16633
|
setIsOpen: setIsOpenWrapper,
|
|
16870
16634
|
toggleOpen: toggleOpenWrapper,
|
|
@@ -16893,7 +16657,7 @@ function useMultiSelect({
|
|
|
16893
16657
|
addToTypeAhead
|
|
16894
16658
|
]
|
|
16895
16659
|
);
|
|
16896
|
-
return (0,
|
|
16660
|
+
return (0, import_react81.useMemo)(
|
|
16897
16661
|
() => ({
|
|
16898
16662
|
...state,
|
|
16899
16663
|
...computedState,
|
|
@@ -16921,16 +16685,16 @@ function MultiSelectRoot({
|
|
|
16921
16685
|
readOnly = false,
|
|
16922
16686
|
required = false
|
|
16923
16687
|
}) {
|
|
16924
|
-
const [triggerRef, setTriggerRef] = (0,
|
|
16925
|
-
const [options, setOptions] = (0,
|
|
16926
|
-
const generatedId = (0,
|
|
16927
|
-
const [ids, setIds] = (0,
|
|
16688
|
+
const [triggerRef, setTriggerRef] = (0, import_react82.useState)(null);
|
|
16689
|
+
const [options, setOptions] = (0, import_react82.useState)([]);
|
|
16690
|
+
const generatedId = (0, import_react82.useId)();
|
|
16691
|
+
const [ids, setIds] = (0, import_react82.useState)({
|
|
16928
16692
|
trigger: "multi-select-" + generatedId,
|
|
16929
16693
|
content: "multi-select-content-" + generatedId,
|
|
16930
16694
|
listbox: "multi-select-listbox-" + generatedId,
|
|
16931
16695
|
searchInput: "multi-select-search-" + generatedId
|
|
16932
16696
|
});
|
|
16933
|
-
const registerOption = (0,
|
|
16697
|
+
const registerOption = (0, import_react82.useCallback)((item) => {
|
|
16934
16698
|
setOptions((prev) => {
|
|
16935
16699
|
const next = prev.filter((o) => o.id !== item.id);
|
|
16936
16700
|
next.push(item);
|
|
@@ -16939,12 +16703,12 @@ function MultiSelectRoot({
|
|
|
16939
16703
|
});
|
|
16940
16704
|
return () => setOptions((prev) => prev.filter((o) => o.id !== item.id));
|
|
16941
16705
|
}, []);
|
|
16942
|
-
const registerTrigger = (0,
|
|
16706
|
+
const registerTrigger = (0, import_react82.useCallback)((ref) => {
|
|
16943
16707
|
setTriggerRef(ref);
|
|
16944
16708
|
return () => setTriggerRef(null);
|
|
16945
16709
|
}, []);
|
|
16946
|
-
const compare = (0,
|
|
16947
|
-
const idToOptionMap = (0,
|
|
16710
|
+
const compare = (0, import_react82.useMemo)(() => compareFunction ?? Object.is, [compareFunction]);
|
|
16711
|
+
const idToOptionMap = (0, import_react82.useMemo)(
|
|
16948
16712
|
() => options.reduce(
|
|
16949
16713
|
(acc, o) => {
|
|
16950
16714
|
acc[o.id] = o;
|
|
@@ -16954,22 +16718,22 @@ function MultiSelectRoot({
|
|
|
16954
16718
|
),
|
|
16955
16719
|
[options]
|
|
16956
16720
|
);
|
|
16957
|
-
const mappedValueIds = (0,
|
|
16721
|
+
const mappedValueIds = (0, import_react82.useMemo)(() => {
|
|
16958
16722
|
if (value == null) return void 0;
|
|
16959
16723
|
return value.map((v) => options.find((o) => compare(o.value, v))?.id).filter((id) => id !== void 0);
|
|
16960
16724
|
}, [options, value, compare]);
|
|
16961
|
-
const mappedInitialValueIds = (0,
|
|
16725
|
+
const mappedInitialValueIds = (0, import_react82.useMemo)(() => {
|
|
16962
16726
|
if (initialValue == null) return [];
|
|
16963
16727
|
return initialValue.map((v) => options.find((o) => compare(o.value, v))?.id).filter((id) => id !== void 0);
|
|
16964
16728
|
}, [options, initialValue, compare]);
|
|
16965
|
-
const onValueChangeStable = (0,
|
|
16729
|
+
const onValueChangeStable = (0, import_react82.useCallback)(
|
|
16966
16730
|
(ids2) => {
|
|
16967
16731
|
const values = ids2.map((id) => idToOptionMap[id]?.value).filter((v) => v != null);
|
|
16968
16732
|
onValueChange?.(values);
|
|
16969
16733
|
},
|
|
16970
16734
|
[idToOptionMap, onValueChange]
|
|
16971
16735
|
);
|
|
16972
|
-
const onEditCompleteStable = (0,
|
|
16736
|
+
const onEditCompleteStable = (0, import_react82.useCallback)(
|
|
16973
16737
|
(ids2) => {
|
|
16974
16738
|
const values = ids2.map((id) => idToOptionMap[id]?.value).filter((v) => v != null);
|
|
16975
16739
|
onEditComplete?.(values);
|
|
@@ -16986,12 +16750,12 @@ function MultiSelectRoot({
|
|
|
16986
16750
|
onClose
|
|
16987
16751
|
});
|
|
16988
16752
|
const { setSearchQuery } = state;
|
|
16989
|
-
(0,
|
|
16753
|
+
(0, import_react82.useEffect)(() => {
|
|
16990
16754
|
if (showSearch === false) {
|
|
16991
16755
|
setSearchQuery("");
|
|
16992
16756
|
}
|
|
16993
16757
|
}, [showSearch, setSearchQuery]);
|
|
16994
|
-
const contextValue = (0,
|
|
16758
|
+
const contextValue = (0, import_react82.useMemo)(() => {
|
|
16995
16759
|
const valueT = state.value.map((id) => idToOptionMap[id]?.value).filter((v) => v != null);
|
|
16996
16760
|
return {
|
|
16997
16761
|
invalid,
|
|
@@ -17062,16 +16826,16 @@ function MultiSelectRoot({
|
|
|
17062
16826
|
}
|
|
17063
16827
|
|
|
17064
16828
|
// src/components/user-interaction/MultiSelect/MultiSelectButton.tsx
|
|
17065
|
-
var
|
|
16829
|
+
var import_react84 = require("react");
|
|
17066
16830
|
|
|
17067
16831
|
// src/components/user-interaction/MultiSelect/MultiSelectOption.tsx
|
|
17068
16832
|
var import_clsx25 = __toESM(require("clsx"));
|
|
17069
16833
|
var import_lucide_react19 = require("lucide-react");
|
|
17070
|
-
var
|
|
16834
|
+
var import_react83 = require("react");
|
|
17071
16835
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
17072
|
-
var MultiSelectOptionDisplayContext = (0,
|
|
16836
|
+
var MultiSelectOptionDisplayContext = (0, import_react83.createContext)(null);
|
|
17073
16837
|
function useMultiSelectOptionDisplayLocation() {
|
|
17074
|
-
const context = (0,
|
|
16838
|
+
const context = (0, import_react83.useContext)(MultiSelectOptionDisplayContext);
|
|
17075
16839
|
if (!context) {
|
|
17076
16840
|
throw new Error(
|
|
17077
16841
|
"useMultiSelectOptionDisplayLocation must be used within a MultiSelectOptionDisplayContext"
|
|
@@ -17079,7 +16843,7 @@ function useMultiSelectOptionDisplayLocation() {
|
|
|
17079
16843
|
}
|
|
17080
16844
|
return context;
|
|
17081
16845
|
}
|
|
17082
|
-
var MultiSelectOption = (0,
|
|
16846
|
+
var MultiSelectOption = (0, import_react83.forwardRef)(function MultiSelectOption2({
|
|
17083
16847
|
children,
|
|
17084
16848
|
label,
|
|
17085
16849
|
value,
|
|
@@ -17089,12 +16853,12 @@ var MultiSelectOption = (0, import_react92.forwardRef)(function MultiSelectOptio
|
|
|
17089
16853
|
}, ref) {
|
|
17090
16854
|
const context = useMultiSelectContext();
|
|
17091
16855
|
const { registerOption } = context;
|
|
17092
|
-
const itemRef = (0,
|
|
16856
|
+
const itemRef = (0, import_react83.useRef)(null);
|
|
17093
16857
|
const display = children ?? label;
|
|
17094
16858
|
const iconAppearanceResolved = iconAppearance ?? context.config.iconAppearance;
|
|
17095
|
-
const generatedId = (0,
|
|
16859
|
+
const generatedId = (0, import_react83.useId)();
|
|
17096
16860
|
const optionId = props?.id ?? "multi-select-option-" + generatedId;
|
|
17097
|
-
(0,
|
|
16861
|
+
(0, import_react83.useEffect)(() => {
|
|
17098
16862
|
return registerOption({
|
|
17099
16863
|
id: optionId,
|
|
17100
16864
|
value,
|
|
@@ -17162,7 +16926,7 @@ var MultiSelectOption = (0, import_react92.forwardRef)(function MultiSelectOptio
|
|
|
17162
16926
|
|
|
17163
16927
|
// src/components/user-interaction/MultiSelect/MultiSelectButton.tsx
|
|
17164
16928
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
17165
|
-
var MultiSelectButton = (0,
|
|
16929
|
+
var MultiSelectButton = (0, import_react84.forwardRef)(function MultiSelectButton2({
|
|
17166
16930
|
id,
|
|
17167
16931
|
placeholder,
|
|
17168
16932
|
disabled: disabledOverride,
|
|
@@ -17175,12 +16939,12 @@ var MultiSelectButton = (0, import_react93.forwardRef)(function MultiSelectButto
|
|
|
17175
16939
|
const { config, layout } = context;
|
|
17176
16940
|
const { setIds } = config;
|
|
17177
16941
|
const { registerTrigger } = layout;
|
|
17178
|
-
(0,
|
|
16942
|
+
(0, import_react84.useEffect)(() => {
|
|
17179
16943
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
17180
16944
|
}, [id, setIds]);
|
|
17181
|
-
const innerRef = (0,
|
|
17182
|
-
(0,
|
|
17183
|
-
(0,
|
|
16945
|
+
const innerRef = (0, import_react84.useRef)(null);
|
|
16946
|
+
(0, import_react84.useImperativeHandle)(ref, () => innerRef.current);
|
|
16947
|
+
(0, import_react84.useEffect)(() => {
|
|
17184
16948
|
const unregister = registerTrigger(innerRef);
|
|
17185
16949
|
return () => unregister();
|
|
17186
16950
|
}, [registerTrigger]);
|
|
@@ -17243,23 +17007,23 @@ var MultiSelectButton = (0, import_react93.forwardRef)(function MultiSelectButto
|
|
|
17243
17007
|
});
|
|
17244
17008
|
|
|
17245
17009
|
// src/components/user-interaction/MultiSelect/MultiSelectContent.tsx
|
|
17246
|
-
var
|
|
17010
|
+
var import_react85 = require("react");
|
|
17247
17011
|
var import_clsx26 = __toESM(require("clsx"));
|
|
17248
17012
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
17249
|
-
var MultiSelectContent = (0,
|
|
17013
|
+
var MultiSelectContent = (0, import_react85.forwardRef)(function MultiSelectContent2({ id, options, showSearch: showSearchOverride, searchInputProps, ...props }, ref) {
|
|
17250
17014
|
const translation = useHightideTranslation();
|
|
17251
|
-
const innerRef = (0,
|
|
17252
|
-
const searchInputRef = (0,
|
|
17253
|
-
(0,
|
|
17015
|
+
const innerRef = (0, import_react85.useRef)(null);
|
|
17016
|
+
const searchInputRef = (0, import_react85.useRef)(null);
|
|
17017
|
+
(0, import_react85.useImperativeHandle)(ref, () => innerRef.current);
|
|
17254
17018
|
const context = useMultiSelectContext();
|
|
17255
17019
|
const { config, highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId, handleTypeaheadKey, toggleSelection } = context;
|
|
17256
17020
|
const { setIds } = config;
|
|
17257
|
-
(0,
|
|
17021
|
+
(0, import_react85.useEffect)(() => {
|
|
17258
17022
|
if (id) setIds((prev) => ({ ...prev, content: id }));
|
|
17259
17023
|
}, [id, setIds]);
|
|
17260
17024
|
const showSearch = showSearchOverride ?? context.search.hasSearch;
|
|
17261
17025
|
const listboxAriaLabel = showSearch ? translation("searchResults") : void 0;
|
|
17262
|
-
const keyHandler = (0,
|
|
17026
|
+
const keyHandler = (0, import_react85.useCallback)(
|
|
17263
17027
|
(event) => {
|
|
17264
17028
|
switch (event.key) {
|
|
17265
17029
|
case "ArrowDown":
|
|
@@ -17373,7 +17137,7 @@ var MultiSelectContent = (0, import_react94.forwardRef)(function MultiSelectCont
|
|
|
17373
17137
|
|
|
17374
17138
|
// src/components/user-interaction/MultiSelect/MultiSelect.tsx
|
|
17375
17139
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
17376
|
-
var MultiSelect = (0,
|
|
17140
|
+
var MultiSelect = (0, import_react86.forwardRef)(
|
|
17377
17141
|
function MultiSelect2({ children, contentPanelProps, buttonProps, ...props }, ref) {
|
|
17378
17142
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(MultiSelectRoot, { ...props, children: [
|
|
17379
17143
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MultiSelectButton, { ref, ...buttonProps }),
|
|
@@ -17399,14 +17163,13 @@ var FilterOperatorLabel = ({ operator }) => {
|
|
|
17399
17163
|
|
|
17400
17164
|
// src/components/user-interaction/data/FilterPopUp.tsx
|
|
17401
17165
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
17402
|
-
var FilterBasePopUp = (0,
|
|
17166
|
+
var FilterBasePopUp = (0, import_react87.forwardRef)(function FilterBasePopUp2({
|
|
17403
17167
|
children,
|
|
17404
17168
|
name,
|
|
17405
17169
|
operator,
|
|
17406
17170
|
onOperatorChange,
|
|
17407
17171
|
onRemove,
|
|
17408
17172
|
allowedOperators,
|
|
17409
|
-
hasValue,
|
|
17410
17173
|
noParameterRequired = false,
|
|
17411
17174
|
...props
|
|
17412
17175
|
}, ref) {
|
|
@@ -17436,28 +17199,30 @@ var FilterBasePopUp = (0, import_react96.forwardRef)(function FilterBasePopUp2({
|
|
|
17436
17199
|
}
|
|
17437
17200
|
)
|
|
17438
17201
|
] }),
|
|
17439
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.
|
|
17440
|
-
|
|
17441
|
-
|
|
17442
|
-
|
|
17443
|
-
|
|
17444
|
-
|
|
17445
|
-
|
|
17446
|
-
|
|
17447
|
-
|
|
17448
|
-
|
|
17449
|
-
|
|
17450
|
-
|
|
17451
|
-
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17202
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex-row-0 items-center", children: [
|
|
17203
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
17204
|
+
IconButton,
|
|
17205
|
+
{
|
|
17206
|
+
tooltip: translation("removeFilter"),
|
|
17207
|
+
onClick: onRemove,
|
|
17208
|
+
color: "negative",
|
|
17209
|
+
coloringStyle: "text",
|
|
17210
|
+
size: "sm",
|
|
17211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react20.TrashIcon, { className: "size-4" })
|
|
17212
|
+
}
|
|
17213
|
+
),
|
|
17214
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
17215
|
+
IconButton,
|
|
17216
|
+
{
|
|
17217
|
+
tooltip: translation("close"),
|
|
17218
|
+
onClick: props.onClose,
|
|
17219
|
+
color: "neutral",
|
|
17220
|
+
coloringStyle: "text",
|
|
17221
|
+
size: "sm",
|
|
17222
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react20.XIcon, { className: "size-4" })
|
|
17223
|
+
}
|
|
17224
|
+
)
|
|
17225
|
+
] })
|
|
17461
17226
|
] }),
|
|
17462
17227
|
children,
|
|
17463
17228
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Visibility, { isVisible: noParameterRequired, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex-row-0 items-center text-sm text-description h-element-sm", children: translation("noParameterRequired") }) })
|
|
@@ -17465,7 +17230,7 @@ var FilterBasePopUp = (0, import_react96.forwardRef)(function FilterBasePopUp2({
|
|
|
17465
17230
|
}
|
|
17466
17231
|
);
|
|
17467
17232
|
});
|
|
17468
|
-
var TextFilterPopUp = (0,
|
|
17233
|
+
var TextFilterPopUp = (0, import_react87.forwardRef)(function TextFilterPopUp2({
|
|
17469
17234
|
name,
|
|
17470
17235
|
value,
|
|
17471
17236
|
onValueChange,
|
|
@@ -17473,12 +17238,12 @@ var TextFilterPopUp = (0, import_react96.forwardRef)(function TextFilterPopUp2({
|
|
|
17473
17238
|
...props
|
|
17474
17239
|
}, ref) {
|
|
17475
17240
|
const translation = useHightideTranslation();
|
|
17476
|
-
const id = (0,
|
|
17241
|
+
const id = (0, import_react87.useId)();
|
|
17477
17242
|
const ids = {
|
|
17478
17243
|
search: `text-filter-search-${id}`,
|
|
17479
17244
|
caseSensitive: `text-filter-case-sensitive-${id}`
|
|
17480
17245
|
};
|
|
17481
|
-
const operator = (0,
|
|
17246
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17482
17247
|
const suggestion = value?.operator ?? "contains";
|
|
17483
17248
|
if (!FilterOperatorUtils.typeCheck.text(suggestion)) {
|
|
17484
17249
|
return "contains";
|
|
@@ -17497,7 +17262,6 @@ var TextFilterPopUp = (0, import_react96.forwardRef)(function TextFilterPopUp2({
|
|
|
17497
17262
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "text", parameter, operator: newOperator }),
|
|
17498
17263
|
onRemove,
|
|
17499
17264
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.text,
|
|
17500
|
-
hasValue: !!value,
|
|
17501
17265
|
noParameterRequired: !needsParameterInput,
|
|
17502
17266
|
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(Visibility, { isVisible: needsParameterInput, children: [
|
|
17503
17267
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex-col-1", children: [
|
|
@@ -17540,7 +17304,7 @@ var TextFilterPopUp = (0, import_react96.forwardRef)(function TextFilterPopUp2({
|
|
|
17540
17304
|
}
|
|
17541
17305
|
);
|
|
17542
17306
|
});
|
|
17543
|
-
var NumberFilterPopUp = (0,
|
|
17307
|
+
var NumberFilterPopUp = (0, import_react87.forwardRef)(function NumberFilterPopUp2({
|
|
17544
17308
|
name,
|
|
17545
17309
|
value,
|
|
17546
17310
|
onValueChange,
|
|
@@ -17548,13 +17312,13 @@ var NumberFilterPopUp = (0, import_react96.forwardRef)(function NumberFilterPopU
|
|
|
17548
17312
|
...props
|
|
17549
17313
|
}, ref) {
|
|
17550
17314
|
const translation = useHightideTranslation();
|
|
17551
|
-
const id = (0,
|
|
17315
|
+
const id = (0, import_react87.useId)();
|
|
17552
17316
|
const ids = {
|
|
17553
17317
|
min: `number-filter-min-${id}`,
|
|
17554
17318
|
max: `number-filter-max-${id}`,
|
|
17555
17319
|
compareValue: `number-filter-compare-value-${id}`
|
|
17556
17320
|
};
|
|
17557
|
-
const operator = (0,
|
|
17321
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17558
17322
|
const suggestion = value?.operator ?? "between";
|
|
17559
17323
|
if (!FilterOperatorUtils.typeCheck.number(suggestion)) {
|
|
17560
17324
|
return "between";
|
|
@@ -17576,7 +17340,6 @@ var NumberFilterPopUp = (0, import_react96.forwardRef)(function NumberFilterPopU
|
|
|
17576
17340
|
},
|
|
17577
17341
|
onRemove,
|
|
17578
17342
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.number,
|
|
17579
|
-
hasValue: !!value,
|
|
17580
17343
|
noParameterRequired: !needsParameterInput,
|
|
17581
17344
|
children: [
|
|
17582
17345
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(Visibility, { isVisible: needsRangeInput, children: [
|
|
@@ -17644,7 +17407,7 @@ var NumberFilterPopUp = (0, import_react96.forwardRef)(function NumberFilterPopU
|
|
|
17644
17407
|
}
|
|
17645
17408
|
);
|
|
17646
17409
|
});
|
|
17647
|
-
var DateFilterPopUp = (0,
|
|
17410
|
+
var DateFilterPopUp = (0, import_react87.forwardRef)(function DateFilterPopUp2({
|
|
17648
17411
|
name,
|
|
17649
17412
|
value,
|
|
17650
17413
|
onValueChange,
|
|
@@ -17652,13 +17415,13 @@ var DateFilterPopUp = (0, import_react96.forwardRef)(function DateFilterPopUp2({
|
|
|
17652
17415
|
...props
|
|
17653
17416
|
}, ref) {
|
|
17654
17417
|
const translation = useHightideTranslation();
|
|
17655
|
-
const id = (0,
|
|
17418
|
+
const id = (0, import_react87.useId)();
|
|
17656
17419
|
const ids = {
|
|
17657
17420
|
startDate: `date-filter-start-date-${id}`,
|
|
17658
17421
|
endDate: `date-filter-end-date-${id}`,
|
|
17659
17422
|
compareDate: `date-filter-compare-date-${id}`
|
|
17660
17423
|
};
|
|
17661
|
-
const operator = (0,
|
|
17424
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17662
17425
|
const suggestion = value?.operator ?? "between";
|
|
17663
17426
|
if (!FilterOperatorUtils.typeCheck.date(suggestion)) {
|
|
17664
17427
|
return "between";
|
|
@@ -17666,8 +17429,8 @@ var DateFilterPopUp = (0, import_react96.forwardRef)(function DateFilterPopUp2({
|
|
|
17666
17429
|
return suggestion;
|
|
17667
17430
|
}, [value]);
|
|
17668
17431
|
const parameter = value?.parameter ?? {};
|
|
17669
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0,
|
|
17670
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = (0,
|
|
17432
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0, import_react87.useState)(null);
|
|
17433
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = (0, import_react87.useState)(null);
|
|
17671
17434
|
const needsRangeInput = operator === "between" || operator === "notBetween";
|
|
17672
17435
|
const needsParameterInput = operator !== "isUndefined" && operator !== "isNotUndefined";
|
|
17673
17436
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
@@ -17680,7 +17443,6 @@ var DateFilterPopUp = (0, import_react96.forwardRef)(function DateFilterPopUp2({
|
|
|
17680
17443
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "date", parameter, operator: newOperator }),
|
|
17681
17444
|
onRemove,
|
|
17682
17445
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.date,
|
|
17683
|
-
hasValue: !!value,
|
|
17684
17446
|
noParameterRequired: !needsParameterInput,
|
|
17685
17447
|
children: [
|
|
17686
17448
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(Visibility, { isVisible: needsRangeInput, children: [
|
|
@@ -17787,7 +17549,7 @@ var DateFilterPopUp = (0, import_react96.forwardRef)(function DateFilterPopUp2({
|
|
|
17787
17549
|
}
|
|
17788
17550
|
);
|
|
17789
17551
|
});
|
|
17790
|
-
var DatetimeFilterPopUp = (0,
|
|
17552
|
+
var DatetimeFilterPopUp = (0, import_react87.forwardRef)(function DatetimeFilterPopUp2({
|
|
17791
17553
|
name,
|
|
17792
17554
|
value,
|
|
17793
17555
|
onValueChange,
|
|
@@ -17795,13 +17557,13 @@ var DatetimeFilterPopUp = (0, import_react96.forwardRef)(function DatetimeFilter
|
|
|
17795
17557
|
...props
|
|
17796
17558
|
}, ref) {
|
|
17797
17559
|
const translation = useHightideTranslation();
|
|
17798
|
-
const id = (0,
|
|
17560
|
+
const id = (0, import_react87.useId)();
|
|
17799
17561
|
const ids = {
|
|
17800
17562
|
startDate: `datetime-filter-start-date-${id}`,
|
|
17801
17563
|
endDate: `datetime-filter-end-date-${id}`,
|
|
17802
17564
|
compareDate: `datetime-filter-compare-date-${id}`
|
|
17803
17565
|
};
|
|
17804
|
-
const operator = (0,
|
|
17566
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17805
17567
|
const suggestion = value?.operator ?? "between";
|
|
17806
17568
|
if (!FilterOperatorUtils.typeCheck.datetime(suggestion)) {
|
|
17807
17569
|
return "between";
|
|
@@ -17809,8 +17571,8 @@ var DatetimeFilterPopUp = (0, import_react96.forwardRef)(function DatetimeFilter
|
|
|
17809
17571
|
return suggestion;
|
|
17810
17572
|
}, [value]);
|
|
17811
17573
|
const parameter = value?.parameter ?? {};
|
|
17812
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0,
|
|
17813
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = (0,
|
|
17574
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0, import_react87.useState)(null);
|
|
17575
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = (0, import_react87.useState)(null);
|
|
17814
17576
|
const needsRangeInput = operator === "between" || operator === "notBetween";
|
|
17815
17577
|
const needsParameterInput = operator !== "isUndefined" && operator !== "isNotUndefined";
|
|
17816
17578
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
@@ -17823,7 +17585,6 @@ var DatetimeFilterPopUp = (0, import_react96.forwardRef)(function DatetimeFilter
|
|
|
17823
17585
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "dateTime", parameter, operator: newOperator }),
|
|
17824
17586
|
onRemove,
|
|
17825
17587
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.dateTime,
|
|
17826
|
-
hasValue: !!value,
|
|
17827
17588
|
children: [
|
|
17828
17589
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17829
17590
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Visibility, { isVisible: needsRangeInput, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex-col-2 gap-2", children: [
|
|
@@ -17930,14 +17691,14 @@ var DatetimeFilterPopUp = (0, import_react96.forwardRef)(function DatetimeFilter
|
|
|
17930
17691
|
}
|
|
17931
17692
|
);
|
|
17932
17693
|
});
|
|
17933
|
-
var BooleanFilterPopUp = (0,
|
|
17694
|
+
var BooleanFilterPopUp = (0, import_react87.forwardRef)(function BooleanFilterPopUp2({
|
|
17934
17695
|
name,
|
|
17935
17696
|
value,
|
|
17936
17697
|
onValueChange,
|
|
17937
17698
|
onRemove,
|
|
17938
17699
|
...props
|
|
17939
17700
|
}, ref) {
|
|
17940
|
-
const operator = (0,
|
|
17701
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17941
17702
|
const suggestion = value?.operator ?? "isTrue";
|
|
17942
17703
|
if (!FilterOperatorUtils.typeCheck.boolean(suggestion)) {
|
|
17943
17704
|
return "isTrue";
|
|
@@ -17954,12 +17715,11 @@ var BooleanFilterPopUp = (0, import_react96.forwardRef)(function BooleanFilterPo
|
|
|
17954
17715
|
operator,
|
|
17955
17716
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "boolean", parameter, operator: newOperator }),
|
|
17956
17717
|
onRemove,
|
|
17957
|
-
allowedOperators: FilterOperatorUtils.operatorsByCategory.boolean
|
|
17958
|
-
hasValue: !!value
|
|
17718
|
+
allowedOperators: FilterOperatorUtils.operatorsByCategory.boolean
|
|
17959
17719
|
}
|
|
17960
17720
|
);
|
|
17961
17721
|
});
|
|
17962
|
-
var TagsFilterPopUp = (0,
|
|
17722
|
+
var TagsFilterPopUp = (0, import_react87.forwardRef)(function TagsFilterPopUp2({
|
|
17963
17723
|
name,
|
|
17964
17724
|
value,
|
|
17965
17725
|
onValueChange,
|
|
@@ -17968,7 +17728,7 @@ var TagsFilterPopUp = (0, import_react96.forwardRef)(function TagsFilterPopUp2({
|
|
|
17968
17728
|
...props
|
|
17969
17729
|
}, ref) {
|
|
17970
17730
|
const translation = useHightideTranslation();
|
|
17971
|
-
const operator = (0,
|
|
17731
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17972
17732
|
const suggestion = value?.operator ?? "contains";
|
|
17973
17733
|
if (!FilterOperatorUtils.typeCheck.tags(suggestion)) {
|
|
17974
17734
|
return "contains";
|
|
@@ -17991,7 +17751,6 @@ var TagsFilterPopUp = (0, import_react96.forwardRef)(function TagsFilterPopUp2({
|
|
|
17991
17751
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "multiTags", parameter, operator: newOperator }),
|
|
17992
17752
|
onRemove,
|
|
17993
17753
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.multiTags,
|
|
17994
|
-
hasValue: !!value,
|
|
17995
17754
|
children: [
|
|
17996
17755
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17997
17756
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Visibility, { isVisible: needsParameterInput, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
@@ -18014,7 +17773,7 @@ var TagsFilterPopUp = (0, import_react96.forwardRef)(function TagsFilterPopUp2({
|
|
|
18014
17773
|
}
|
|
18015
17774
|
);
|
|
18016
17775
|
});
|
|
18017
|
-
var TagsSingleFilterPopUp = (0,
|
|
17776
|
+
var TagsSingleFilterPopUp = (0, import_react87.forwardRef)(function TagsSingleFilterPopUp2({
|
|
18018
17777
|
name,
|
|
18019
17778
|
value,
|
|
18020
17779
|
onValueChange,
|
|
@@ -18023,7 +17782,7 @@ var TagsSingleFilterPopUp = (0, import_react96.forwardRef)(function TagsSingleFi
|
|
|
18023
17782
|
...props
|
|
18024
17783
|
}, ref) {
|
|
18025
17784
|
const translation = useHightideTranslation();
|
|
18026
|
-
const operator = (0,
|
|
17785
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
18027
17786
|
const suggestion = value?.operator ?? "contains";
|
|
18028
17787
|
if (!FilterOperatorUtils.typeCheck.tagsSingle(suggestion)) {
|
|
18029
17788
|
return "contains";
|
|
@@ -18048,7 +17807,6 @@ var TagsSingleFilterPopUp = (0, import_react96.forwardRef)(function TagsSingleFi
|
|
|
18048
17807
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "singleTag", parameter, operator: newOperator }),
|
|
18049
17808
|
onRemove,
|
|
18050
17809
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.singleTag,
|
|
18051
|
-
hasValue: !!value,
|
|
18052
17810
|
children: [
|
|
18053
17811
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
18054
17812
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Visibility, { isVisible: needsParameterInput && needsMultiSelect, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
@@ -18086,8 +17844,8 @@ var TagsSingleFilterPopUp = (0, import_react96.forwardRef)(function TagsSingleFi
|
|
|
18086
17844
|
}
|
|
18087
17845
|
);
|
|
18088
17846
|
});
|
|
18089
|
-
var GenericFilterPopUp = (0,
|
|
18090
|
-
const operator = (0,
|
|
17847
|
+
var GenericFilterPopUp = (0, import_react87.forwardRef)(function GenericFilterPopUp2({ name, value, onValueChange, ...props }, ref) {
|
|
17848
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
18091
17849
|
const suggestion = value?.operator ?? "isNotUndefined";
|
|
18092
17850
|
if (!FilterOperatorUtils.typeCheck.unknownType(suggestion)) {
|
|
18093
17851
|
return "isNotUndefined";
|
|
@@ -18103,12 +17861,11 @@ var GenericFilterPopUp = (0, import_react96.forwardRef)(function GenericFilterPo
|
|
|
18103
17861
|
operator,
|
|
18104
17862
|
onOperatorChange: (newOperator) => onValueChange({ ...value, operator: newOperator }),
|
|
18105
17863
|
onRemove: () => onValueChange({ ...value, operator: void 0 }),
|
|
18106
|
-
allowedOperators: FilterOperatorUtils.operatorsByCategory.unknownType
|
|
18107
|
-
hasValue: !!value
|
|
17864
|
+
allowedOperators: FilterOperatorUtils.operatorsByCategory.unknownType
|
|
18108
17865
|
}
|
|
18109
17866
|
);
|
|
18110
17867
|
});
|
|
18111
|
-
var FilterPopUp = (0,
|
|
17868
|
+
var FilterPopUp = (0, import_react87.forwardRef)(function FilterPopUp2({
|
|
18112
17869
|
name,
|
|
18113
17870
|
value,
|
|
18114
17871
|
onValueChange,
|
|
@@ -18145,18 +17902,18 @@ var TableFilterButton = ({
|
|
|
18145
17902
|
const translation = useHightideTranslation();
|
|
18146
17903
|
const column = header.column;
|
|
18147
17904
|
const columnFilterValue = column.getFilterValue();
|
|
18148
|
-
const [filterValue, setFilterValue] = (0,
|
|
17905
|
+
const [filterValue, setFilterValue] = (0, import_react88.useState)(columnFilterValue);
|
|
18149
17906
|
const hasFilter = !!filterValue;
|
|
18150
|
-
const anchorRef = (0,
|
|
18151
|
-
const containerRef = (0,
|
|
18152
|
-
const [isOpen, setIsOpen] = (0,
|
|
18153
|
-
const id = (0,
|
|
18154
|
-
const ids = (0,
|
|
17907
|
+
const anchorRef = (0, import_react88.useRef)(null);
|
|
17908
|
+
const containerRef = (0, import_react88.useRef)(null);
|
|
17909
|
+
const [isOpen, setIsOpen] = (0, import_react88.useState)(false);
|
|
17910
|
+
const id = (0, import_react88.useId)();
|
|
17911
|
+
const ids = (0, import_react88.useMemo)(() => ({
|
|
18155
17912
|
button: `table-filter-button-${id}`,
|
|
18156
17913
|
popup: `table-filter-popup-${id}`,
|
|
18157
17914
|
label: `table-filter-label-${id}`
|
|
18158
17915
|
}), [id]);
|
|
18159
|
-
(0,
|
|
17916
|
+
(0, import_react88.useEffect)(() => {
|
|
18160
17917
|
setFilterValue(columnFilterValue);
|
|
18161
17918
|
}, [columnFilterValue]);
|
|
18162
17919
|
const isTagsFilter = filterType === "multiTags" || filterType === "singleTag";
|
|
@@ -18217,7 +17974,7 @@ var TableFilterButton = ({
|
|
|
18217
17974
|
};
|
|
18218
17975
|
|
|
18219
17976
|
// src/components/layout/table/TableHeader.tsx
|
|
18220
|
-
var
|
|
17977
|
+
var import_react89 = require("react");
|
|
18221
17978
|
|
|
18222
17979
|
// src/components/user-interaction/data/data-types.tsx
|
|
18223
17980
|
var import_lucide_react22 = require("lucide-react");
|
|
@@ -18281,7 +18038,7 @@ var DataTypeUtils = {
|
|
|
18281
18038
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
18282
18039
|
var TableHeader = ({ isSticky = false }) => {
|
|
18283
18040
|
const { table } = useTableStateWithoutSizingContext();
|
|
18284
|
-
const handleResizeMove = (0,
|
|
18041
|
+
const handleResizeMove = (0, import_react89.useCallback)((e) => {
|
|
18285
18042
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
18286
18043
|
const currentX = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
18287
18044
|
const deltaOffset = currentX - (table.getState().columnSizingInfo.startOffset ?? 0);
|
|
@@ -18297,7 +18054,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
18297
18054
|
deltaOffset
|
|
18298
18055
|
}));
|
|
18299
18056
|
}, [table]);
|
|
18300
|
-
const handleResizeEnd = (0,
|
|
18057
|
+
const handleResizeEnd = (0, import_react89.useCallback)(() => {
|
|
18301
18058
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
18302
18059
|
const newWidth = (table.getState().columnSizingInfo.startSize ?? 0) + (table.getState().columnSizingInfo.deltaOffset ?? 0);
|
|
18303
18060
|
table.setColumnSizing((prev) => {
|
|
@@ -18315,7 +18072,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
18315
18072
|
startSize: null
|
|
18316
18073
|
});
|
|
18317
18074
|
}, [table]);
|
|
18318
|
-
(0,
|
|
18075
|
+
(0, import_react89.useEffect)(() => {
|
|
18319
18076
|
window.addEventListener("pointermove", handleResizeMove);
|
|
18320
18077
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
18321
18078
|
return () => {
|
|
@@ -18484,7 +18241,7 @@ var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props
|
|
|
18484
18241
|
};
|
|
18485
18242
|
|
|
18486
18243
|
// src/components/layout/table/TableWithSelectionProvider.tsx
|
|
18487
|
-
var
|
|
18244
|
+
var import_react90 = require("react");
|
|
18488
18245
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
18489
18246
|
var TableWithSelectionProvider = ({
|
|
18490
18247
|
children,
|
|
@@ -18497,7 +18254,7 @@ var TableWithSelectionProvider = ({
|
|
|
18497
18254
|
...props
|
|
18498
18255
|
}) => {
|
|
18499
18256
|
const translation = useHightideTranslation();
|
|
18500
|
-
const columnDef = (0,
|
|
18257
|
+
const columnDef = (0, import_react90.useMemo)(() => [
|
|
18501
18258
|
{
|
|
18502
18259
|
id: selectionRowId,
|
|
18503
18260
|
header: ({ table }) => {
|
|
@@ -18540,7 +18297,7 @@ var TableWithSelectionProvider = ({
|
|
|
18540
18297
|
TableProvider,
|
|
18541
18298
|
{
|
|
18542
18299
|
...props,
|
|
18543
|
-
fillerRowCell: (0,
|
|
18300
|
+
fillerRowCell: (0, import_react90.useCallback)((columnId, table) => {
|
|
18544
18301
|
if (columnId === selectionRowId) {
|
|
18545
18302
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Checkbox, { value: false, disabled: true });
|
|
18546
18303
|
}
|
|
@@ -18558,7 +18315,7 @@ var TableWithSelectionProvider = ({
|
|
|
18558
18315
|
rowSelection,
|
|
18559
18316
|
...state
|
|
18560
18317
|
},
|
|
18561
|
-
onRowClick: (0,
|
|
18318
|
+
onRowClick: (0, import_react90.useCallback)((row, table) => {
|
|
18562
18319
|
if (!disableClickRowClickSelection) {
|
|
18563
18320
|
row.toggleSelected();
|
|
18564
18321
|
}
|
|
@@ -18600,7 +18357,7 @@ var TableWithSelection = ({
|
|
|
18600
18357
|
};
|
|
18601
18358
|
|
|
18602
18359
|
// src/components/layout/table/TableColumn.tsx
|
|
18603
|
-
var
|
|
18360
|
+
var import_react91 = require("react");
|
|
18604
18361
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
18605
18362
|
var TableColumnComponent = ({
|
|
18606
18363
|
filterType,
|
|
@@ -18612,11 +18369,11 @@ var TableColumnComponent = ({
|
|
|
18612
18369
|
"TableColumn: For filterType === multiTags or singleTag, filterData.tags must be set.",
|
|
18613
18370
|
(filterType === "multiTags" || filterType === "singleTag") && props.meta?.filterData?.tags === void 0
|
|
18614
18371
|
);
|
|
18615
|
-
const [column] = (0,
|
|
18372
|
+
const [column] = (0, import_react91.useState)({
|
|
18616
18373
|
...props,
|
|
18617
18374
|
filterFn
|
|
18618
18375
|
});
|
|
18619
|
-
(0,
|
|
18376
|
+
(0, import_react91.useEffect)(() => {
|
|
18620
18377
|
const unsubscribe = registerColumn(column);
|
|
18621
18378
|
return () => {
|
|
18622
18379
|
unsubscribe();
|
|
@@ -18624,34 +18381,34 @@ var TableColumnComponent = ({
|
|
|
18624
18381
|
}, [registerColumn, column]);
|
|
18625
18382
|
return null;
|
|
18626
18383
|
};
|
|
18627
|
-
var TableColumnFactory = () => (0,
|
|
18384
|
+
var TableColumnFactory = () => (0, import_react91.memo)(
|
|
18628
18385
|
TableColumnComponent,
|
|
18629
18386
|
(prevProps, nextProps) => {
|
|
18630
18387
|
return prevProps.filterType === nextProps.filterType && prevProps.id === nextProps.id && prevProps["accessorKey"] === nextProps["accessorKey"] && prevProps.enableColumnFilter === nextProps.enableColumnFilter && prevProps.enableGlobalFilter === nextProps.enableGlobalFilter && prevProps.enableGrouping === nextProps.enableGrouping && prevProps.enableHiding === nextProps.enableHiding && prevProps.enablePinning === nextProps.enablePinning && prevProps.enableResizing === nextProps.enableResizing && prevProps.enableSorting === nextProps.enableSorting && prevProps.meta === nextProps.meta, prevProps.cell === nextProps.cell;
|
|
18631
18388
|
}
|
|
18632
18389
|
);
|
|
18633
18390
|
var TableColumn = (props) => {
|
|
18634
|
-
const TableColumnComponent2 = (0,
|
|
18391
|
+
const TableColumnComponent2 = (0, import_react91.useMemo)(() => TableColumnFactory(), []);
|
|
18635
18392
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TableColumnComponent2, { ...props });
|
|
18636
18393
|
};
|
|
18637
18394
|
|
|
18638
18395
|
// src/components/layout/table/TableColumnSwitcher.tsx
|
|
18639
|
-
var
|
|
18396
|
+
var import_react92 = require("react");
|
|
18640
18397
|
var import_lucide_react23 = require("lucide-react");
|
|
18641
18398
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
18642
18399
|
var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
18643
18400
|
const { table } = useTableStateWithoutSizingContext();
|
|
18644
18401
|
const translation = useHightideTranslation();
|
|
18645
|
-
const containerRef = (0,
|
|
18646
|
-
const generatedId = (0,
|
|
18647
|
-
const ids = (0,
|
|
18402
|
+
const containerRef = (0, import_react92.useRef)(null);
|
|
18403
|
+
const generatedId = (0, import_react92.useId)();
|
|
18404
|
+
const ids = (0, import_react92.useMemo)(() => ({
|
|
18648
18405
|
popup: props.id ?? `table-column-picker-popup-${generatedId}`,
|
|
18649
18406
|
label: `table-column-picker-label-${generatedId}`
|
|
18650
18407
|
}), [generatedId, props.id]);
|
|
18651
18408
|
const tableState = table.getState();
|
|
18652
18409
|
const columnOrder = tableState.columnOrder;
|
|
18653
18410
|
const columnPinning = tableState.columnPinning;
|
|
18654
|
-
const columns = (0,
|
|
18411
|
+
const columns = (0, import_react92.useMemo)(() => {
|
|
18655
18412
|
const allColumns = table.getAllColumns();
|
|
18656
18413
|
const leftPinned = [];
|
|
18657
18414
|
const unpinned = [];
|
|
@@ -18909,16 +18666,16 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
18909
18666
|
};
|
|
18910
18667
|
|
|
18911
18668
|
// src/components/user-interaction/Combobox/Combobox.tsx
|
|
18912
|
-
var
|
|
18669
|
+
var import_react98 = require("react");
|
|
18913
18670
|
|
|
18914
18671
|
// src/components/user-interaction/Combobox/ComboboxRoot.tsx
|
|
18915
|
-
var
|
|
18672
|
+
var import_react95 = require("react");
|
|
18916
18673
|
|
|
18917
18674
|
// src/components/user-interaction/Combobox/ComboboxContext.tsx
|
|
18918
|
-
var
|
|
18919
|
-
var ComboboxContext = (0,
|
|
18675
|
+
var import_react93 = require("react");
|
|
18676
|
+
var ComboboxContext = (0, import_react93.createContext)(null);
|
|
18920
18677
|
function useComboboxContext() {
|
|
18921
|
-
const ctx = (0,
|
|
18678
|
+
const ctx = (0, import_react93.useContext)(ComboboxContext);
|
|
18922
18679
|
if (ctx == null) {
|
|
18923
18680
|
throw new Error("useComboboxContext must be used within ComboboxRoot");
|
|
18924
18681
|
}
|
|
@@ -18926,7 +18683,7 @@ function useComboboxContext() {
|
|
|
18926
18683
|
}
|
|
18927
18684
|
|
|
18928
18685
|
// src/components/user-interaction/Combobox/useCombobox.ts
|
|
18929
|
-
var
|
|
18686
|
+
var import_react94 = require("react");
|
|
18930
18687
|
function useCombobox({
|
|
18931
18688
|
options,
|
|
18932
18689
|
searchQuery: controlledSearchQuery,
|
|
@@ -18941,36 +18698,36 @@ function useCombobox({
|
|
|
18941
18698
|
const { searchResult: visibleOptions } = useSearch({
|
|
18942
18699
|
items: options,
|
|
18943
18700
|
searchQuery: searchQuery ?? "",
|
|
18944
|
-
toTags: (0,
|
|
18701
|
+
toTags: (0, import_react94.useCallback)((o) => [o.label], [])
|
|
18945
18702
|
});
|
|
18946
|
-
const visibleOptionIds = (0,
|
|
18703
|
+
const visibleOptionIds = (0, import_react94.useMemo)(
|
|
18947
18704
|
() => visibleOptions.map((o) => o.id),
|
|
18948
18705
|
[visibleOptions]
|
|
18949
18706
|
);
|
|
18950
|
-
const enabledOptionIds = (0,
|
|
18707
|
+
const enabledOptionIds = (0, import_react94.useMemo)(
|
|
18951
18708
|
() => visibleOptions.filter((o) => !o.disabled).map((o) => o.id),
|
|
18952
18709
|
[visibleOptions]
|
|
18953
18710
|
);
|
|
18954
18711
|
const listNav = useListNavigation({ options: enabledOptionIds });
|
|
18955
|
-
const highlightItem = (0,
|
|
18712
|
+
const highlightItem = (0, import_react94.useCallback)(
|
|
18956
18713
|
(id) => {
|
|
18957
18714
|
if (!enabledOptionIds.includes(id)) return;
|
|
18958
18715
|
listNav.highlight(id);
|
|
18959
18716
|
},
|
|
18960
18717
|
[enabledOptionIds, listNav]
|
|
18961
18718
|
);
|
|
18962
|
-
const state = (0,
|
|
18719
|
+
const state = (0, import_react94.useMemo)(
|
|
18963
18720
|
() => ({
|
|
18964
18721
|
searchQuery: searchQuery ?? "",
|
|
18965
18722
|
highlightedId: listNav.highlightedId
|
|
18966
18723
|
}),
|
|
18967
18724
|
[searchQuery, listNav.highlightedId]
|
|
18968
18725
|
);
|
|
18969
|
-
const computedState = (0,
|
|
18726
|
+
const computedState = (0, import_react94.useMemo)(
|
|
18970
18727
|
() => ({ visibleOptionIds }),
|
|
18971
18728
|
[visibleOptionIds]
|
|
18972
18729
|
);
|
|
18973
|
-
const actions = (0,
|
|
18730
|
+
const actions = (0, import_react94.useMemo)(
|
|
18974
18731
|
() => ({
|
|
18975
18732
|
setSearchQuery,
|
|
18976
18733
|
highlightFirst: listNav.first,
|
|
@@ -18981,7 +18738,7 @@ function useCombobox({
|
|
|
18981
18738
|
}),
|
|
18982
18739
|
[setSearchQuery, listNav.first, listNav.last, listNav.next, listNav.previous, highlightItem]
|
|
18983
18740
|
);
|
|
18984
|
-
return (0,
|
|
18741
|
+
return (0, import_react94.useMemo)(
|
|
18985
18742
|
() => ({
|
|
18986
18743
|
...state,
|
|
18987
18744
|
...computedState,
|
|
@@ -18998,14 +18755,14 @@ function ComboboxRoot({
|
|
|
18998
18755
|
onItemClick,
|
|
18999
18756
|
...hookProps
|
|
19000
18757
|
}) {
|
|
19001
|
-
const [options, setOptions] = (0,
|
|
19002
|
-
const [listRef, setListRef] = (0,
|
|
19003
|
-
const generatedId = (0,
|
|
19004
|
-
const [ids, setIds] = (0,
|
|
18758
|
+
const [options, setOptions] = (0, import_react95.useState)([]);
|
|
18759
|
+
const [listRef, setListRef] = (0, import_react95.useState)(null);
|
|
18760
|
+
const generatedId = (0, import_react95.useId)();
|
|
18761
|
+
const [ids, setIds] = (0, import_react95.useState)({
|
|
19005
18762
|
trigger: `combobox-${generatedId}`,
|
|
19006
18763
|
listbox: `combobox-${generatedId}-listbox`
|
|
19007
18764
|
});
|
|
19008
|
-
const registerOption = (0,
|
|
18765
|
+
const registerOption = (0, import_react95.useCallback)(
|
|
19009
18766
|
(option) => {
|
|
19010
18767
|
setOptions((prev) => {
|
|
19011
18768
|
const next = prev.filter((o) => o.id !== option.id);
|
|
@@ -19017,11 +18774,11 @@ function ComboboxRoot({
|
|
|
19017
18774
|
},
|
|
19018
18775
|
[]
|
|
19019
18776
|
);
|
|
19020
|
-
const registerList = (0,
|
|
18777
|
+
const registerList = (0, import_react95.useCallback)((ref) => {
|
|
19021
18778
|
setListRef(() => ref);
|
|
19022
18779
|
return () => setListRef(null);
|
|
19023
18780
|
}, []);
|
|
19024
|
-
const hookOptions = (0,
|
|
18781
|
+
const hookOptions = (0, import_react95.useMemo)(
|
|
19025
18782
|
() => options.map((o) => ({
|
|
19026
18783
|
id: o.id,
|
|
19027
18784
|
label: o.label,
|
|
@@ -19030,38 +18787,38 @@ function ComboboxRoot({
|
|
|
19030
18787
|
[options]
|
|
19031
18788
|
);
|
|
19032
18789
|
const state = useCombobox({ ...hookProps, options: hookOptions });
|
|
19033
|
-
const idToOptionMap = (0,
|
|
18790
|
+
const idToOptionMap = (0, import_react95.useMemo)(() => {
|
|
19034
18791
|
return options.reduce((acc, o) => {
|
|
19035
18792
|
acc[o.id] = o;
|
|
19036
18793
|
return acc;
|
|
19037
18794
|
}, {});
|
|
19038
18795
|
}, [options]);
|
|
19039
|
-
const selectOption = (0,
|
|
18796
|
+
const selectOption = (0, import_react95.useCallback)(
|
|
19040
18797
|
(id) => {
|
|
19041
18798
|
const option = idToOptionMap[id];
|
|
19042
18799
|
if (option) onItemClick?.(option.value);
|
|
19043
18800
|
},
|
|
19044
18801
|
[idToOptionMap, onItemClick]
|
|
19045
18802
|
);
|
|
19046
|
-
const config = (0,
|
|
18803
|
+
const config = (0, import_react95.useMemo)(
|
|
19047
18804
|
() => ({ ids, setIds }),
|
|
19048
18805
|
[ids, setIds]
|
|
19049
18806
|
);
|
|
19050
|
-
const layout = (0,
|
|
18807
|
+
const layout = (0, import_react95.useMemo)(
|
|
19051
18808
|
() => ({
|
|
19052
18809
|
listRef: listRef ?? { current: null },
|
|
19053
18810
|
registerList
|
|
19054
18811
|
}),
|
|
19055
18812
|
[listRef, registerList]
|
|
19056
18813
|
);
|
|
19057
|
-
const search = (0,
|
|
18814
|
+
const search = (0, import_react95.useMemo)(
|
|
19058
18815
|
() => ({
|
|
19059
18816
|
searchQuery: state.searchQuery,
|
|
19060
18817
|
setSearchQuery: state.setSearchQuery
|
|
19061
18818
|
}),
|
|
19062
18819
|
[state.searchQuery, state.setSearchQuery]
|
|
19063
18820
|
);
|
|
19064
|
-
const contextValue = (0,
|
|
18821
|
+
const contextValue = (0, import_react95.useMemo)(
|
|
19065
18822
|
() => ({
|
|
19066
18823
|
highlightedId: state.highlightedId,
|
|
19067
18824
|
options,
|
|
@@ -19099,14 +18856,14 @@ function ComboboxRoot({
|
|
|
19099
18856
|
}
|
|
19100
18857
|
|
|
19101
18858
|
// src/components/user-interaction/Combobox/ComboboxInput.tsx
|
|
19102
|
-
var
|
|
18859
|
+
var import_react96 = require("react");
|
|
19103
18860
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
19104
|
-
var ComboboxInput = (0,
|
|
18861
|
+
var ComboboxInput = (0, import_react96.forwardRef)(
|
|
19105
18862
|
function ComboboxInput2(props, ref) {
|
|
19106
18863
|
const translation = useHightideTranslation();
|
|
19107
18864
|
const context = useComboboxContext();
|
|
19108
18865
|
const { highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId, selectOption } = context;
|
|
19109
|
-
const handleKeyDown = (0,
|
|
18866
|
+
const handleKeyDown = (0, import_react96.useCallback)(
|
|
19110
18867
|
(event) => {
|
|
19111
18868
|
props.onKeyDown?.(event);
|
|
19112
18869
|
switch (event.key) {
|
|
@@ -19158,17 +18915,17 @@ var ComboboxInput = (0, import_react105.forwardRef)(
|
|
|
19158
18915
|
);
|
|
19159
18916
|
|
|
19160
18917
|
// src/components/user-interaction/Combobox/ComboboxList.tsx
|
|
19161
|
-
var
|
|
18918
|
+
var import_react97 = require("react");
|
|
19162
18919
|
var import_clsx31 = __toESM(require("clsx"));
|
|
19163
18920
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
19164
|
-
var ComboboxList = (0,
|
|
18921
|
+
var ComboboxList = (0, import_react97.forwardRef)(
|
|
19165
18922
|
function ComboboxList2({ children, ...props }, ref) {
|
|
19166
18923
|
const translation = useHightideTranslation();
|
|
19167
18924
|
const context = useComboboxContext();
|
|
19168
18925
|
const { layout } = context;
|
|
19169
18926
|
const { registerList } = layout;
|
|
19170
|
-
const innerRef = (0,
|
|
19171
|
-
(0,
|
|
18927
|
+
const innerRef = (0, import_react97.useRef)(null);
|
|
18928
|
+
(0, import_react97.useEffect)(() => {
|
|
19172
18929
|
return registerList(innerRef);
|
|
19173
18930
|
}, [registerList]);
|
|
19174
18931
|
const setRefs = (node) => {
|
|
@@ -19210,7 +18967,7 @@ var ComboboxList = (0, import_react106.forwardRef)(
|
|
|
19210
18967
|
|
|
19211
18968
|
// src/components/user-interaction/Combobox/Combobox.tsx
|
|
19212
18969
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
19213
|
-
var Combobox = (0,
|
|
18970
|
+
var Combobox = (0, import_react98.forwardRef)(function Combobox2({
|
|
19214
18971
|
children,
|
|
19215
18972
|
onItemClick,
|
|
19216
18973
|
searchQuery,
|
|
@@ -19235,10 +18992,10 @@ var Combobox = (0, import_react107.forwardRef)(function Combobox2({
|
|
|
19235
18992
|
});
|
|
19236
18993
|
|
|
19237
18994
|
// src/components/user-interaction/Combobox/ComboboxOption.tsx
|
|
19238
|
-
var
|
|
18995
|
+
var import_react99 = require("react");
|
|
19239
18996
|
var import_clsx32 = __toESM(require("clsx"));
|
|
19240
18997
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
19241
|
-
var ComboboxOption = (0,
|
|
18998
|
+
var ComboboxOption = (0, import_react99.forwardRef)(function ComboboxOption2({
|
|
19242
18999
|
children,
|
|
19243
19000
|
value,
|
|
19244
19001
|
label,
|
|
@@ -19249,11 +19006,11 @@ var ComboboxOption = (0, import_react108.forwardRef)(function ComboboxOption2({
|
|
|
19249
19006
|
}, ref) {
|
|
19250
19007
|
const context = useComboboxContext();
|
|
19251
19008
|
const { registerOption } = context;
|
|
19252
|
-
const itemRef = (0,
|
|
19253
|
-
const generatedId = (0,
|
|
19009
|
+
const itemRef = (0, import_react99.useRef)(null);
|
|
19010
|
+
const generatedId = (0, import_react99.useId)();
|
|
19254
19011
|
const optionId = idProp ?? `combobox-option-${generatedId}`;
|
|
19255
19012
|
const resolvedDisplay = children ?? label;
|
|
19256
|
-
(0,
|
|
19013
|
+
(0, import_react99.useEffect)(() => {
|
|
19257
19014
|
return registerOption({
|
|
19258
19015
|
id: optionId,
|
|
19259
19016
|
value,
|
|
@@ -19263,7 +19020,7 @@ var ComboboxOption = (0, import_react108.forwardRef)(function ComboboxOption2({
|
|
|
19263
19020
|
ref: itemRef
|
|
19264
19021
|
});
|
|
19265
19022
|
}, [optionId, value, label, resolvedDisplay, disabled, registerOption]);
|
|
19266
|
-
(0,
|
|
19023
|
+
(0, import_react99.useEffect)(() => {
|
|
19267
19024
|
if (context.highlightedId === optionId) {
|
|
19268
19025
|
itemRef.current?.scrollIntoView?.({ behavior: "smooth", block: "nearest" });
|
|
19269
19026
|
}
|
|
@@ -19309,7 +19066,7 @@ var ComboboxOption = (0, import_react108.forwardRef)(function ComboboxOption2({
|
|
|
19309
19066
|
ComboboxOption.displayName = "ComboboxOption";
|
|
19310
19067
|
|
|
19311
19068
|
// src/components/user-interaction/CopyToClipboardWrapper.tsx
|
|
19312
|
-
var
|
|
19069
|
+
var import_react100 = require("react");
|
|
19313
19070
|
var import_clsx33 = require("clsx");
|
|
19314
19071
|
|
|
19315
19072
|
// src/utils/writeToClipboard.ts
|
|
@@ -19332,7 +19089,7 @@ var CopyToClipboardWrapper = ({
|
|
|
19332
19089
|
...props
|
|
19333
19090
|
}) => {
|
|
19334
19091
|
const translation = useHightideTranslation();
|
|
19335
|
-
const [isShowingConfirmation, setIsShowingConfirmation] = (0,
|
|
19092
|
+
const [isShowingConfirmation, setIsShowingConfirmation] = (0, import_react100.useState)(false);
|
|
19336
19093
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
19337
19094
|
TooltipRoot,
|
|
19338
19095
|
{
|
|
@@ -19381,7 +19138,7 @@ var CopyToClipboardWrapper = ({
|
|
|
19381
19138
|
};
|
|
19382
19139
|
|
|
19383
19140
|
// src/components/user-interaction/Menu.tsx
|
|
19384
|
-
var
|
|
19141
|
+
var import_react101 = require("react");
|
|
19385
19142
|
var import_clsx34 = __toESM(require("clsx"));
|
|
19386
19143
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
19387
19144
|
var MenuItem = ({
|
|
@@ -19407,8 +19164,8 @@ var Menu = ({
|
|
|
19407
19164
|
disabled = false,
|
|
19408
19165
|
...props
|
|
19409
19166
|
}) => {
|
|
19410
|
-
const triggerRef = (0,
|
|
19411
|
-
const [isOpen, setIsOpen] = (0,
|
|
19167
|
+
const triggerRef = (0, import_react101.useRef)(null);
|
|
19168
|
+
const [isOpen, setIsOpen] = (0, import_react101.useState)(false);
|
|
19412
19169
|
const bag = {
|
|
19413
19170
|
isOpen,
|
|
19414
19171
|
close: () => setIsOpen(false),
|
|
@@ -19416,7 +19173,7 @@ var Menu = ({
|
|
|
19416
19173
|
disabled
|
|
19417
19174
|
};
|
|
19418
19175
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
19419
|
-
trigger(bag, (0,
|
|
19176
|
+
trigger(bag, (0, import_react101.useCallback)((el) => triggerRef.current = el, [])),
|
|
19420
19177
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
19421
19178
|
PopUp,
|
|
19422
19179
|
{
|
|
@@ -19438,21 +19195,21 @@ var Menu = ({
|
|
|
19438
19195
|
};
|
|
19439
19196
|
|
|
19440
19197
|
// src/components/user-interaction/MultiSelect/MultiSelectChipDisplay.tsx
|
|
19441
|
-
var
|
|
19198
|
+
var import_react102 = require("react");
|
|
19442
19199
|
var import_lucide_react25 = require("lucide-react");
|
|
19443
19200
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
19444
|
-
var MultiSelectChipDisplayButton = (0,
|
|
19201
|
+
var MultiSelectChipDisplayButton = (0, import_react102.forwardRef)(function MultiSelectChipDisplayButton2({ id, ...props }, ref) {
|
|
19445
19202
|
const translation = useHightideTranslation();
|
|
19446
19203
|
const context = useMultiSelectContext();
|
|
19447
19204
|
const { config, layout } = context;
|
|
19448
19205
|
const { setIds } = config;
|
|
19449
19206
|
const { registerTrigger } = layout;
|
|
19450
|
-
(0,
|
|
19207
|
+
(0, import_react102.useEffect)(() => {
|
|
19451
19208
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
19452
19209
|
}, [id, setIds]);
|
|
19453
|
-
const innerRef = (0,
|
|
19454
|
-
(0,
|
|
19455
|
-
(0,
|
|
19210
|
+
const innerRef = (0, import_react102.useRef)(null);
|
|
19211
|
+
(0, import_react102.useImperativeHandle)(ref, () => innerRef.current);
|
|
19212
|
+
(0, import_react102.useEffect)(() => {
|
|
19456
19213
|
const unregister = registerTrigger(innerRef);
|
|
19457
19214
|
return () => unregister();
|
|
19458
19215
|
}, [registerTrigger]);
|
|
@@ -19527,7 +19284,7 @@ var MultiSelectChipDisplayButton = (0, import_react111.forwardRef)(function Mult
|
|
|
19527
19284
|
}
|
|
19528
19285
|
);
|
|
19529
19286
|
});
|
|
19530
|
-
var MultiSelectChipDisplay = (0,
|
|
19287
|
+
var MultiSelectChipDisplay = (0, import_react102.forwardRef)(
|
|
19531
19288
|
function MultiSelectChipDisplay2({
|
|
19532
19289
|
children,
|
|
19533
19290
|
contentPanelProps,
|
|
@@ -19542,7 +19299,7 @@ var MultiSelectChipDisplay = (0, import_react111.forwardRef)(
|
|
|
19542
19299
|
);
|
|
19543
19300
|
|
|
19544
19301
|
// src/components/user-interaction/ScrollPicker.tsx
|
|
19545
|
-
var
|
|
19302
|
+
var import_react103 = require("react");
|
|
19546
19303
|
var import_clsx35 = __toESM(require("clsx"));
|
|
19547
19304
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
19548
19305
|
var up = 1;
|
|
@@ -19563,7 +19320,7 @@ var ScrollPicker = ({
|
|
|
19563
19320
|
transition,
|
|
19564
19321
|
items,
|
|
19565
19322
|
lastTimeStamp
|
|
19566
|
-
}, setAnimation] = (0,
|
|
19323
|
+
}, setAnimation] = (0, import_react103.useState)({
|
|
19567
19324
|
targetIndex: selectedIndex,
|
|
19568
19325
|
currentIndex: disabled ? selectedIndex : 0,
|
|
19569
19326
|
velocity: 0,
|
|
@@ -19579,7 +19336,7 @@ var ScrollPicker = ({
|
|
|
19579
19336
|
const itemHeight = 40;
|
|
19580
19337
|
const distance = 8;
|
|
19581
19338
|
const containerHeight = itemHeight * (itemsShownCount - 2) + distance * (itemsShownCount - 2 + 1);
|
|
19582
|
-
const getDirection = (0,
|
|
19339
|
+
const getDirection = (0, import_react103.useCallback)((targetIndex, currentIndex2, transition2, length) => {
|
|
19583
19340
|
if (targetIndex === currentIndex2) {
|
|
19584
19341
|
return transition2 > 0 ? up : down;
|
|
19585
19342
|
}
|
|
@@ -19589,7 +19346,7 @@ var ScrollPicker = ({
|
|
|
19589
19346
|
}
|
|
19590
19347
|
return distanceForward >= length / 2 ? down : up;
|
|
19591
19348
|
}, []);
|
|
19592
|
-
const animate = (0,
|
|
19349
|
+
const animate = (0, import_react103.useCallback)((timestamp, startTime) => {
|
|
19593
19350
|
setAnimation((prevState) => {
|
|
19594
19351
|
const {
|
|
19595
19352
|
targetIndex,
|
|
@@ -19662,7 +19419,7 @@ var ScrollPicker = ({
|
|
|
19662
19419
|
};
|
|
19663
19420
|
});
|
|
19664
19421
|
}, [disabled, getDirection, onChange]);
|
|
19665
|
-
(0,
|
|
19422
|
+
(0, import_react103.useEffect)(() => {
|
|
19666
19423
|
requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp));
|
|
19667
19424
|
});
|
|
19668
19425
|
const opacity = (transition2, index, itemsCount) => {
|
|
@@ -19740,7 +19497,7 @@ var ScrollPicker = ({
|
|
|
19740
19497
|
};
|
|
19741
19498
|
|
|
19742
19499
|
// src/components/user-interaction/Switch.tsx
|
|
19743
|
-
var
|
|
19500
|
+
var import_react104 = require("react");
|
|
19744
19501
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
19745
19502
|
var Switch = ({
|
|
19746
19503
|
value: controlledValue,
|
|
@@ -19755,7 +19512,7 @@ var Switch = ({
|
|
|
19755
19512
|
}) => {
|
|
19756
19513
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
19757
19514
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
19758
|
-
const onChangeWrapper = (0,
|
|
19515
|
+
const onChangeWrapper = (0, import_react104.useCallback)((value2) => {
|
|
19759
19516
|
onValueChangeStable(!value2);
|
|
19760
19517
|
onEditCompleteStable(!value2);
|
|
19761
19518
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -19795,10 +19552,10 @@ var Switch = ({
|
|
|
19795
19552
|
};
|
|
19796
19553
|
|
|
19797
19554
|
// src/components/user-interaction/Textarea.tsx
|
|
19798
|
-
var
|
|
19555
|
+
var import_react105 = require("react");
|
|
19799
19556
|
var import_clsx36 = __toESM(require("clsx"));
|
|
19800
19557
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
19801
|
-
var Textarea = (0,
|
|
19558
|
+
var Textarea = (0, import_react105.forwardRef)(function Textarea2({
|
|
19802
19559
|
value: controlledValue,
|
|
19803
19560
|
initialValue,
|
|
19804
19561
|
invalid = false,
|
|
@@ -19814,7 +19571,7 @@ var Textarea = (0, import_react114.forwardRef)(function Textarea2({
|
|
|
19814
19571
|
});
|
|
19815
19572
|
const { restartTimer, clearTimer } = useDelay(saveDelayOptions);
|
|
19816
19573
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
19817
|
-
const onEditCompleteWrapper = (0,
|
|
19574
|
+
const onEditCompleteWrapper = (0, import_react105.useCallback)((text) => {
|
|
19818
19575
|
onEditCompleteStable(text);
|
|
19819
19576
|
clearTimer();
|
|
19820
19577
|
}, [onEditCompleteStable, clearTimer]);
|
|
@@ -19852,7 +19609,7 @@ var TextareaWithHeadline = ({
|
|
|
19852
19609
|
containerClassName,
|
|
19853
19610
|
...props
|
|
19854
19611
|
}) => {
|
|
19855
|
-
const genId = (0,
|
|
19612
|
+
const genId = (0, import_react105.useId)();
|
|
19856
19613
|
const usedId = id ?? genId;
|
|
19857
19614
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
19858
19615
|
"div",
|
|
@@ -19884,20 +19641,20 @@ var TextareaWithHeadline = ({
|
|
|
19884
19641
|
};
|
|
19885
19642
|
|
|
19886
19643
|
// src/components/user-interaction/data/FilterList.tsx
|
|
19887
|
-
var
|
|
19644
|
+
var import_react106 = require("react");
|
|
19888
19645
|
var import_lucide_react26 = require("lucide-react");
|
|
19889
19646
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
19890
19647
|
var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
19891
19648
|
const translation = useHightideTranslation();
|
|
19892
19649
|
const filterValueToLabel = useFilterValueTranslation();
|
|
19893
|
-
const activeIds = (0,
|
|
19894
|
-
const inactiveItems = (0,
|
|
19895
|
-
const itemRecord = (0,
|
|
19650
|
+
const activeIds = (0, import_react106.useMemo)(() => value.map((item) => item.id), [value]);
|
|
19651
|
+
const inactiveItems = (0, import_react106.useMemo)(() => availableItems.filter((item) => !activeIds.includes(item.id)).sort((a, b) => a.label.localeCompare(b.label)), [availableItems, activeIds]);
|
|
19652
|
+
const itemRecord = (0, import_react106.useMemo)(() => availableItems.reduce((acc, item) => {
|
|
19896
19653
|
acc[item.id] = item;
|
|
19897
19654
|
return acc;
|
|
19898
19655
|
}, {}), [availableItems]);
|
|
19899
|
-
const [editState, setEditState] = (0,
|
|
19900
|
-
const valueWithEditState = (0,
|
|
19656
|
+
const [editState, setEditState] = (0, import_react106.useState)(void 0);
|
|
19657
|
+
const valueWithEditState = (0, import_react106.useMemo)(() => {
|
|
19901
19658
|
let foundEditValue = false;
|
|
19902
19659
|
for (const item of value) {
|
|
19903
19660
|
if (item.id === editState?.id) {
|
|
@@ -19912,7 +19669,7 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19912
19669
|
}, [value, editState]);
|
|
19913
19670
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex-row-1 flex-wrap gap-y-1", children: [
|
|
19914
19671
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(PopUpRoot, { children: [
|
|
19915
|
-
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "
|
|
19672
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "md", children: [
|
|
19916
19673
|
translation("addFilter"),
|
|
19917
19674
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_lucide_react26.PlusIcon, { className: "size-4" })
|
|
19918
19675
|
] }) }),
|
|
@@ -19924,9 +19681,11 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19924
19681
|
if (!item) return;
|
|
19925
19682
|
const newValue = {
|
|
19926
19683
|
id: item.id,
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19684
|
+
value: {
|
|
19685
|
+
dataType: item.dataType,
|
|
19686
|
+
operator: FilterOperatorUtils.getDefaultOperator(item.dataType),
|
|
19687
|
+
parameter: {}
|
|
19688
|
+
}
|
|
19930
19689
|
};
|
|
19931
19690
|
setEditState(newValue);
|
|
19932
19691
|
setIsOpen(false);
|
|
@@ -19938,36 +19697,36 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19938
19697
|
}
|
|
19939
19698
|
) }) })
|
|
19940
19699
|
] }),
|
|
19941
|
-
valueWithEditState.map((
|
|
19942
|
-
const item = itemRecord[
|
|
19700
|
+
valueWithEditState.map((columnFilter) => {
|
|
19701
|
+
const item = itemRecord[columnFilter.id];
|
|
19943
19702
|
if (!item) return null;
|
|
19944
19703
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
19945
19704
|
PopUpRoot,
|
|
19946
19705
|
{
|
|
19947
|
-
isOpen: editState?.id ===
|
|
19706
|
+
isOpen: editState?.id === columnFilter.id,
|
|
19948
19707
|
onIsOpenChange: (isOpen) => {
|
|
19949
19708
|
if (!isOpen) {
|
|
19950
|
-
const isEditStateValid = editState ? FilterValueUtils.isValid(editState) : false;
|
|
19709
|
+
const isEditStateValid = editState ? FilterValueUtils.isValid(editState.value) : false;
|
|
19951
19710
|
if (isEditStateValid) {
|
|
19952
|
-
onValueChange(valueWithEditState.map((prevItem) => prevItem.id ===
|
|
19711
|
+
onValueChange(valueWithEditState.map((prevItem) => prevItem.id === columnFilter.id ? { ...prevItem, ...editState } : prevItem));
|
|
19953
19712
|
}
|
|
19954
19713
|
setEditState(void 0);
|
|
19955
19714
|
} else {
|
|
19956
|
-
const valueItem = value.find((prevItem) => prevItem.id ===
|
|
19715
|
+
const valueItem = value.find((prevItem) => prevItem.id === columnFilter.id);
|
|
19957
19716
|
if (!valueItem) return;
|
|
19958
19717
|
setEditState({ ...valueItem });
|
|
19959
19718
|
}
|
|
19960
19719
|
},
|
|
19961
19720
|
children: [
|
|
19962
|
-
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpOpener, { children: ({ toggleOpen, props, isOpen }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(Button, { ...props, onClick: toggleOpen, color: "primary", coloringStyle: "tonal", size: "
|
|
19963
|
-
item.label + ": " + filterValueToLabel(
|
|
19721
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpOpener, { children: ({ toggleOpen, props, isOpen }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(Button, { ...props, onClick: toggleOpen, color: "primary", coloringStyle: "tonal-outline", size: "md", children: [
|
|
19722
|
+
item.activeLabelBuilder ? item.activeLabelBuilder(columnFilter.value) : item.label + ": " + filterValueToLabel(columnFilter.value, { tags: item.tags }),
|
|
19964
19723
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(ExpansionIcon, { isExpanded: isOpen })
|
|
19965
19724
|
] }) }),
|
|
19966
|
-
|
|
19967
|
-
value: editState?.id ===
|
|
19968
|
-
onValueChange: (value2) => setEditState({ ...
|
|
19725
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpContext.Consumer, { children: ({ isOpen, setIsOpen }) => item.popUpBuilder ? item.popUpBuilder({
|
|
19726
|
+
value: editState?.id === columnFilter.id ? editState.value : columnFilter.value,
|
|
19727
|
+
onValueChange: (value2) => setEditState({ ...columnFilter, value: value2 }),
|
|
19969
19728
|
onRemove: () => {
|
|
19970
|
-
onValueChange(value.filter((prevItem) => prevItem.id !==
|
|
19729
|
+
onValueChange(value.filter((prevItem) => prevItem.id !== columnFilter.id));
|
|
19971
19730
|
setEditState(void 0);
|
|
19972
19731
|
},
|
|
19973
19732
|
dataType: item.dataType,
|
|
@@ -19975,25 +19734,26 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19975
19734
|
name: item.label,
|
|
19976
19735
|
isOpen,
|
|
19977
19736
|
close: () => setIsOpen(false)
|
|
19978
|
-
})
|
|
19737
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
19979
19738
|
FilterPopUp,
|
|
19980
19739
|
{
|
|
19981
19740
|
name: item.label,
|
|
19982
|
-
value: editState?.id ===
|
|
19741
|
+
value: editState?.id === columnFilter.id ? editState.value : columnFilter.value,
|
|
19983
19742
|
dataType: item.dataType,
|
|
19984
19743
|
tags: item.tags,
|
|
19985
19744
|
onValueChange: (value2) => {
|
|
19986
|
-
setEditState({ ...
|
|
19745
|
+
setEditState({ ...columnFilter, value: value2 });
|
|
19987
19746
|
},
|
|
19988
19747
|
onRemove: () => {
|
|
19989
|
-
onValueChange(value.filter((prevItem) => prevItem.id !==
|
|
19748
|
+
onValueChange(value.filter((prevItem) => prevItem.id !== columnFilter.id));
|
|
19990
19749
|
setEditState(void 0);
|
|
19991
|
-
}
|
|
19750
|
+
},
|
|
19751
|
+
onClose: () => setIsOpen(false)
|
|
19992
19752
|
}
|
|
19993
|
-
)
|
|
19753
|
+
) })
|
|
19994
19754
|
]
|
|
19995
19755
|
},
|
|
19996
|
-
|
|
19756
|
+
columnFilter.id
|
|
19997
19757
|
);
|
|
19998
19758
|
})
|
|
19999
19759
|
] });
|
|
@@ -20040,12 +19800,77 @@ var TimeDisplay = ({
|
|
|
20040
19800
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { children: fullString });
|
|
20041
19801
|
};
|
|
20042
19802
|
|
|
19803
|
+
// src/components/user-interaction/input/FlexibleDateTimeInput.tsx
|
|
19804
|
+
var import_react107 = require("react");
|
|
19805
|
+
var import_lucide_react27 = require("lucide-react");
|
|
19806
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
19807
|
+
var FlexibleDateTimeInput = (0, import_react107.forwardRef)(function FlexibleDateTimeInput2({
|
|
19808
|
+
defaultMode = "date",
|
|
19809
|
+
value: controlledValue,
|
|
19810
|
+
initialValue,
|
|
19811
|
+
onValueChange,
|
|
19812
|
+
fixedTime: fixedTimeOverride,
|
|
19813
|
+
actions = [],
|
|
19814
|
+
...props
|
|
19815
|
+
}, forwardedRef) {
|
|
19816
|
+
const translation = useHightideTranslation();
|
|
19817
|
+
const [value, setValue] = useControlledState({
|
|
19818
|
+
value: controlledValue,
|
|
19819
|
+
onValueChange,
|
|
19820
|
+
defaultValue: initialValue
|
|
19821
|
+
});
|
|
19822
|
+
const fixedTime = (0, import_react107.useMemo)(() => fixedTimeOverride ?? new Date(23, 59, 59, 999), [fixedTimeOverride]);
|
|
19823
|
+
const [preferredMode, setPreferredMode] = (0, import_react107.useState)(defaultMode);
|
|
19824
|
+
const mode = (0, import_react107.useMemo)(() => {
|
|
19825
|
+
if (!value) return preferredMode;
|
|
19826
|
+
if (DateUtils.sameTime(value, fixedTime, true, true)) {
|
|
19827
|
+
return "date";
|
|
19828
|
+
}
|
|
19829
|
+
return "dateTime";
|
|
19830
|
+
}, [preferredMode, value, fixedTime]);
|
|
19831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
19832
|
+
DateTimeInput,
|
|
19833
|
+
{
|
|
19834
|
+
...props,
|
|
19835
|
+
ref: forwardedRef,
|
|
19836
|
+
mode,
|
|
19837
|
+
value,
|
|
19838
|
+
onValueChange: setValue,
|
|
19839
|
+
actions: [
|
|
19840
|
+
...actions,
|
|
19841
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
19842
|
+
IconButton,
|
|
19843
|
+
{
|
|
19844
|
+
size: "sm",
|
|
19845
|
+
coloringStyle: "text",
|
|
19846
|
+
color: "neutral",
|
|
19847
|
+
tooltip: preferredMode === "date" ? translation("addTime") : translation("withoutTime"),
|
|
19848
|
+
onClick: () => {
|
|
19849
|
+
const newMode = preferredMode === "date" ? "dateTime" : "date";
|
|
19850
|
+
setPreferredMode((prev) => prev === "date" ? "dateTime" : "date");
|
|
19851
|
+
if (value) {
|
|
19852
|
+
if (newMode === "date") {
|
|
19853
|
+
setValue(DateUtils.withTime(value, fixedTime));
|
|
19854
|
+
} else {
|
|
19855
|
+
setValue(DateUtils.isLastMillisecondOfDay(value) ? new Date(value.getTime() - 1) : new Date(value.getTime() + 1));
|
|
19856
|
+
}
|
|
19857
|
+
}
|
|
19858
|
+
},
|
|
19859
|
+
children: preferredMode === "date" ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_lucide_react27.ClockPlus, { className: "size-5" }) : /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_lucide_react27.ClockFading, { className: "size-5" })
|
|
19860
|
+
},
|
|
19861
|
+
"date-mode"
|
|
19862
|
+
)
|
|
19863
|
+
]
|
|
19864
|
+
}
|
|
19865
|
+
);
|
|
19866
|
+
});
|
|
19867
|
+
|
|
20043
19868
|
// src/components/user-interaction/input/InsideLabelInput.tsx
|
|
20044
|
-
var
|
|
20045
|
-
var
|
|
19869
|
+
var import_react108 = require("react");
|
|
19870
|
+
var import_react109 = require("react");
|
|
20046
19871
|
var import_clsx37 = __toESM(require("clsx"));
|
|
20047
|
-
var
|
|
20048
|
-
var InsideLabelInput = (0,
|
|
19872
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
19873
|
+
var InsideLabelInput = (0, import_react109.forwardRef)(function InsideLabelInput2({
|
|
20049
19874
|
id: customId,
|
|
20050
19875
|
value: controlledValue,
|
|
20051
19876
|
initialValue,
|
|
@@ -20058,11 +19883,11 @@ var InsideLabelInput = (0, import_react117.forwardRef)(function InsideLabelInput
|
|
|
20058
19883
|
onValueChange,
|
|
20059
19884
|
defaultValue: initialValue
|
|
20060
19885
|
});
|
|
20061
|
-
const [isFocused, setIsFocused] = (0,
|
|
20062
|
-
const generatedId = (0,
|
|
19886
|
+
const [isFocused, setIsFocused] = (0, import_react109.useState)(false);
|
|
19887
|
+
const generatedId = (0, import_react108.useId)();
|
|
20063
19888
|
const id = customId ?? generatedId;
|
|
20064
|
-
return /* @__PURE__ */ (0,
|
|
20065
|
-
/* @__PURE__ */ (0,
|
|
19889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: (0, import_clsx37.default)("relative"), children: [
|
|
19890
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
20066
19891
|
Input,
|
|
20067
19892
|
{
|
|
20068
19893
|
...props,
|
|
@@ -20082,7 +19907,7 @@ var InsideLabelInput = (0, import_react117.forwardRef)(function InsideLabelInput
|
|
|
20082
19907
|
className: (0, import_clsx37.default)("h-14 px-4 pb-2 py-6.5", props.className)
|
|
20083
19908
|
}
|
|
20084
19909
|
),
|
|
20085
|
-
/* @__PURE__ */ (0,
|
|
19910
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
20086
19911
|
"label",
|
|
20087
19912
|
{
|
|
20088
19913
|
id: id + "-label",
|
|
@@ -20101,9 +19926,9 @@ var InsideLabelInput = (0, import_react117.forwardRef)(function InsideLabelInput
|
|
|
20101
19926
|
});
|
|
20102
19927
|
|
|
20103
19928
|
// src/components/user-interaction/input/SearchBar.tsx
|
|
20104
|
-
var
|
|
19929
|
+
var import_lucide_react28 = require("lucide-react");
|
|
20105
19930
|
var import_clsx38 = require("clsx");
|
|
20106
|
-
var
|
|
19931
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
20107
19932
|
var SearchBar = ({
|
|
20108
19933
|
value: controlledValue,
|
|
20109
19934
|
initialValue,
|
|
@@ -20119,8 +19944,8 @@ var SearchBar = ({
|
|
|
20119
19944
|
onValueChange,
|
|
20120
19945
|
defaultValue: initialValue
|
|
20121
19946
|
});
|
|
20122
|
-
return /* @__PURE__ */ (0,
|
|
20123
|
-
/* @__PURE__ */ (0,
|
|
19947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { ...containerProps, className: (0, import_clsx38.clsx)("relative", containerProps?.className), children: [
|
|
19948
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
20124
19949
|
Input,
|
|
20125
19950
|
{
|
|
20126
19951
|
...inputProps,
|
|
@@ -20131,7 +19956,7 @@ var SearchBar = ({
|
|
|
20131
19956
|
className: (0, import_clsx38.clsx)("pr-10 w-full", inputProps.className)
|
|
20132
19957
|
}
|
|
20133
19958
|
),
|
|
20134
|
-
/* @__PURE__ */ (0,
|
|
19959
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
20135
19960
|
IconButton,
|
|
20136
19961
|
{
|
|
20137
19962
|
...searchButtonProps,
|
|
@@ -20141,18 +19966,18 @@ var SearchBar = ({
|
|
|
20141
19966
|
coloringStyle: "text",
|
|
20142
19967
|
onClick: () => onSearch(value),
|
|
20143
19968
|
className: (0, import_clsx38.clsx)("absolute right-1.5 top-1/2 -translate-y-1/2", searchButtonProps?.className),
|
|
20144
|
-
children: /* @__PURE__ */ (0,
|
|
19969
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react28.Search, { className: "w-full h-full" })
|
|
20145
19970
|
}
|
|
20146
19971
|
)
|
|
20147
19972
|
] });
|
|
20148
19973
|
};
|
|
20149
19974
|
|
|
20150
19975
|
// src/components/user-interaction/input/ToggleableInput.tsx
|
|
20151
|
-
var
|
|
20152
|
-
var
|
|
19976
|
+
var import_react110 = require("react");
|
|
19977
|
+
var import_lucide_react29 = require("lucide-react");
|
|
20153
19978
|
var import_clsx39 = __toESM(require("clsx"));
|
|
20154
|
-
var
|
|
20155
|
-
var ToggleableInput = (0,
|
|
19979
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
19980
|
+
var ToggleableInput = (0, import_react110.forwardRef)(function ToggleableInput2({
|
|
20156
19981
|
value: controlledValue,
|
|
20157
19982
|
initialValue,
|
|
20158
19983
|
onValueChange,
|
|
@@ -20165,16 +19990,16 @@ var ToggleableInput = (0, import_react118.forwardRef)(function ToggleableInput2(
|
|
|
20165
19990
|
onValueChange,
|
|
20166
19991
|
defaultValue: initialValue
|
|
20167
19992
|
});
|
|
20168
|
-
const [isEditing, setIsEditing] = (0,
|
|
20169
|
-
const innerRef = (0,
|
|
20170
|
-
(0,
|
|
20171
|
-
(0,
|
|
19993
|
+
const [isEditing, setIsEditing] = (0, import_react110.useState)(initialState !== "display");
|
|
19994
|
+
const innerRef = (0, import_react110.useRef)(null);
|
|
19995
|
+
(0, import_react110.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
19996
|
+
(0, import_react110.useEffect)(() => {
|
|
20172
19997
|
if (isEditing) {
|
|
20173
19998
|
innerRef.current?.focus();
|
|
20174
19999
|
}
|
|
20175
20000
|
}, [isEditing]);
|
|
20176
|
-
return /* @__PURE__ */ (0,
|
|
20177
|
-
/* @__PURE__ */ (0,
|
|
20001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: (0, import_clsx39.default)("relative flex-row-2", { "flex-1": isEditing }), children: [
|
|
20002
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
20178
20003
|
Input,
|
|
20179
20004
|
{
|
|
20180
20005
|
...props,
|
|
@@ -20198,20 +20023,20 @@ var ToggleableInput = (0, import_react118.forwardRef)(function ToggleableInput2(
|
|
|
20198
20023
|
"data-name": props["data-name"] ?? "togglable-input"
|
|
20199
20024
|
}
|
|
20200
20025
|
),
|
|
20201
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
20202
|
-
/* @__PURE__ */ (0,
|
|
20203
|
-
/* @__PURE__ */ (0,
|
|
20026
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "absolute left-0 flex-row-2 items-center pointer-events-none touch-none w-full overflow-hidden", children: [
|
|
20027
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: (0, import_clsx39.default)(" truncate"), children: value }),
|
|
20028
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react29.Pencil, { className: (0, import_clsx39.default)(`size-force-4`, { "text-transparent": isEditing }) })
|
|
20204
20029
|
] })
|
|
20205
20030
|
] });
|
|
20206
20031
|
});
|
|
20207
20032
|
|
|
20208
20033
|
// src/components/user-interaction/properties/CheckboxProperty.tsx
|
|
20209
|
-
var
|
|
20034
|
+
var import_lucide_react31 = require("lucide-react");
|
|
20210
20035
|
|
|
20211
20036
|
// src/components/user-interaction/properties/PropertyBase.tsx
|
|
20212
20037
|
var import_clsx40 = __toESM(require("clsx"));
|
|
20213
|
-
var
|
|
20214
|
-
var
|
|
20038
|
+
var import_lucide_react30 = require("lucide-react");
|
|
20039
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
20215
20040
|
var PropertyBase = ({
|
|
20216
20041
|
name,
|
|
20217
20042
|
children,
|
|
@@ -20230,36 +20055,36 @@ var PropertyBase = ({
|
|
|
20230
20055
|
const isClearEnabled = allowClear && !readOnly;
|
|
20231
20056
|
const isRemoveEnabled = allowRemove && !readOnly;
|
|
20232
20057
|
const showActionsContainer = isClearEnabled || isRemoveEnabled;
|
|
20233
|
-
return /* @__PURE__ */ (0,
|
|
20058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
20234
20059
|
"div",
|
|
20235
20060
|
{
|
|
20236
20061
|
className: (0, import_clsx40.default)("group/property", className),
|
|
20237
20062
|
"data-name": "property-root",
|
|
20238
20063
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20239
20064
|
children: [
|
|
20240
|
-
/* @__PURE__ */ (0,
|
|
20065
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
20241
20066
|
"div",
|
|
20242
20067
|
{
|
|
20243
20068
|
"data-name": "property-title",
|
|
20244
20069
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20245
20070
|
children: [
|
|
20246
|
-
/* @__PURE__ */ (0,
|
|
20247
|
-
/* @__PURE__ */ (0,
|
|
20248
|
-
/* @__PURE__ */ (0,
|
|
20071
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Tooltip, { tooltip: name, containerClassName: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex-row-1 items-center", children: [
|
|
20072
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { "data-name": "property-title-icon", children: icon }),
|
|
20073
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { "data-name": "property-title-text", children: name })
|
|
20249
20074
|
] }) }),
|
|
20250
|
-
invalid && /* @__PURE__ */ (0,
|
|
20075
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react30.AlertTriangle, { className: "size-force-6" })
|
|
20251
20076
|
]
|
|
20252
20077
|
}
|
|
20253
20078
|
),
|
|
20254
|
-
/* @__PURE__ */ (0,
|
|
20079
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
20255
20080
|
"div",
|
|
20256
20081
|
{
|
|
20257
20082
|
"data-name": "property-content",
|
|
20258
20083
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20259
20084
|
children: [
|
|
20260
20085
|
children({ required, hasValue, invalid }),
|
|
20261
|
-
showActionsContainer && /* @__PURE__ */ (0,
|
|
20262
|
-
isClearEnabled && /* @__PURE__ */ (0,
|
|
20086
|
+
showActionsContainer && /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { "data-name": "property-actions", children: [
|
|
20087
|
+
isClearEnabled && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
20263
20088
|
IconButton,
|
|
20264
20089
|
{
|
|
20265
20090
|
tooltip: translation("clearValue"),
|
|
@@ -20268,10 +20093,10 @@ var PropertyBase = ({
|
|
|
20268
20093
|
color: "negative",
|
|
20269
20094
|
coloringStyle: "text",
|
|
20270
20095
|
size: "sm",
|
|
20271
|
-
children: /* @__PURE__ */ (0,
|
|
20096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react30.X, { className: "size-force-5" })
|
|
20272
20097
|
}
|
|
20273
20098
|
),
|
|
20274
|
-
isRemoveEnabled && /* @__PURE__ */ (0,
|
|
20099
|
+
isRemoveEnabled && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
20275
20100
|
IconButton,
|
|
20276
20101
|
{
|
|
20277
20102
|
tooltip: translation("removeProperty"),
|
|
@@ -20279,7 +20104,7 @@ var PropertyBase = ({
|
|
|
20279
20104
|
color: "negative",
|
|
20280
20105
|
coloringStyle: "text",
|
|
20281
20106
|
size: "sm",
|
|
20282
|
-
children: /* @__PURE__ */ (0,
|
|
20107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react30.Trash, { className: "size-force-5" })
|
|
20283
20108
|
}
|
|
20284
20109
|
)
|
|
20285
20110
|
] })
|
|
@@ -20292,7 +20117,7 @@ var PropertyBase = ({
|
|
|
20292
20117
|
};
|
|
20293
20118
|
|
|
20294
20119
|
// src/components/user-interaction/properties/CheckboxProperty.tsx
|
|
20295
|
-
var
|
|
20120
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
20296
20121
|
var CheckboxProperty = ({
|
|
20297
20122
|
value,
|
|
20298
20123
|
onValueChange,
|
|
@@ -20301,15 +20126,15 @@ var CheckboxProperty = ({
|
|
|
20301
20126
|
...baseProps
|
|
20302
20127
|
}) => {
|
|
20303
20128
|
const translation = useHightideTranslation();
|
|
20304
|
-
return /* @__PURE__ */ (0,
|
|
20129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
20305
20130
|
PropertyBase,
|
|
20306
20131
|
{
|
|
20307
20132
|
...baseProps,
|
|
20308
20133
|
hasValue: value !== void 0,
|
|
20309
20134
|
readOnly,
|
|
20310
|
-
icon: /* @__PURE__ */ (0,
|
|
20311
|
-
children: () => /* @__PURE__ */ (0,
|
|
20312
|
-
/* @__PURE__ */ (0,
|
|
20135
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_lucide_react31.Check, { size: 24 }),
|
|
20136
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex-row-2 items-center", children: [
|
|
20137
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
20313
20138
|
Button,
|
|
20314
20139
|
{
|
|
20315
20140
|
color: value ? "positive" : "neutral",
|
|
@@ -20322,7 +20147,7 @@ var CheckboxProperty = ({
|
|
|
20322
20147
|
children: translation("yes")
|
|
20323
20148
|
}
|
|
20324
20149
|
),
|
|
20325
|
-
/* @__PURE__ */ (0,
|
|
20150
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
20326
20151
|
Button,
|
|
20327
20152
|
{
|
|
20328
20153
|
color: !value && value !== void 0 ? "negative" : "neutral",
|
|
@@ -20341,8 +20166,8 @@ var CheckboxProperty = ({
|
|
|
20341
20166
|
};
|
|
20342
20167
|
|
|
20343
20168
|
// src/components/user-interaction/properties/DateProperty.tsx
|
|
20344
|
-
var
|
|
20345
|
-
var
|
|
20169
|
+
var import_lucide_react32 = require("lucide-react");
|
|
20170
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
20346
20171
|
var DateProperty = ({
|
|
20347
20172
|
value,
|
|
20348
20173
|
onValueChange,
|
|
@@ -20352,13 +20177,13 @@ var DateProperty = ({
|
|
|
20352
20177
|
...baseProps
|
|
20353
20178
|
}) => {
|
|
20354
20179
|
const hasValue = !!value;
|
|
20355
|
-
return /* @__PURE__ */ (0,
|
|
20180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
20356
20181
|
PropertyBase,
|
|
20357
20182
|
{
|
|
20358
20183
|
...baseProps,
|
|
20359
20184
|
hasValue,
|
|
20360
|
-
icon: /* @__PURE__ */ (0,
|
|
20361
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20185
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_lucide_react32.CalendarDays, { size: 24 }),
|
|
20186
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
20362
20187
|
DateTimeInput,
|
|
20363
20188
|
{
|
|
20364
20189
|
value,
|
|
@@ -20375,8 +20200,8 @@ var DateProperty = ({
|
|
|
20375
20200
|
};
|
|
20376
20201
|
|
|
20377
20202
|
// src/components/user-interaction/properties/MultiSelectProperty.tsx
|
|
20378
|
-
var
|
|
20379
|
-
var
|
|
20203
|
+
var import_lucide_react33 = require("lucide-react");
|
|
20204
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
20380
20205
|
var MultiSelectProperty = ({
|
|
20381
20206
|
children,
|
|
20382
20207
|
value,
|
|
@@ -20385,18 +20210,18 @@ var MultiSelectProperty = ({
|
|
|
20385
20210
|
...props
|
|
20386
20211
|
}) => {
|
|
20387
20212
|
const hasValue = value.length > 0;
|
|
20388
|
-
return /* @__PURE__ */ (0,
|
|
20213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
20389
20214
|
PropertyBase,
|
|
20390
20215
|
{
|
|
20391
20216
|
...props,
|
|
20392
20217
|
hasValue,
|
|
20393
|
-
icon: /* @__PURE__ */ (0,
|
|
20394
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20218
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_lucide_react33.List, { size: 24 }),
|
|
20219
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
20395
20220
|
"div",
|
|
20396
20221
|
{
|
|
20397
20222
|
"data-name": "property-input-wrapper",
|
|
20398
20223
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20399
|
-
children: /* @__PURE__ */ (0,
|
|
20224
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
20400
20225
|
MultiSelectChipDisplay,
|
|
20401
20226
|
{
|
|
20402
20227
|
value,
|
|
@@ -20422,8 +20247,8 @@ var MultiSelectProperty = ({
|
|
|
20422
20247
|
};
|
|
20423
20248
|
|
|
20424
20249
|
// src/components/user-interaction/properties/NumberProperty.tsx
|
|
20425
|
-
var
|
|
20426
|
-
var
|
|
20250
|
+
var import_lucide_react34 = require("lucide-react");
|
|
20251
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
20427
20252
|
var NumberProperty = ({
|
|
20428
20253
|
value,
|
|
20429
20254
|
onValueChange,
|
|
@@ -20435,20 +20260,20 @@ var NumberProperty = ({
|
|
|
20435
20260
|
}) => {
|
|
20436
20261
|
const translation = useHightideTranslation();
|
|
20437
20262
|
const hasValue = value !== void 0;
|
|
20438
|
-
return /* @__PURE__ */ (0,
|
|
20263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
20439
20264
|
PropertyBase,
|
|
20440
20265
|
{
|
|
20441
20266
|
...baseProps,
|
|
20442
20267
|
onValueClear,
|
|
20443
20268
|
hasValue,
|
|
20444
|
-
icon: /* @__PURE__ */ (0,
|
|
20445
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20269
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_lucide_react34.Binary, { size: 24 }),
|
|
20270
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
20446
20271
|
"div",
|
|
20447
20272
|
{
|
|
20448
20273
|
"data-name": "property-input-wrapper",
|
|
20449
20274
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20450
20275
|
children: [
|
|
20451
|
-
/* @__PURE__ */ (0,
|
|
20276
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
20452
20277
|
Input,
|
|
20453
20278
|
{
|
|
20454
20279
|
"data-name": "property-input",
|
|
@@ -20476,7 +20301,7 @@ var NumberProperty = ({
|
|
|
20476
20301
|
}
|
|
20477
20302
|
}
|
|
20478
20303
|
),
|
|
20479
|
-
suffix && /* @__PURE__ */ (0,
|
|
20304
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
20480
20305
|
"span",
|
|
20481
20306
|
{
|
|
20482
20307
|
"data-name": "property-suffix",
|
|
@@ -20492,8 +20317,8 @@ var NumberProperty = ({
|
|
|
20492
20317
|
};
|
|
20493
20318
|
|
|
20494
20319
|
// src/components/user-interaction/properties/SelectProperty.tsx
|
|
20495
|
-
var
|
|
20496
|
-
var
|
|
20320
|
+
var import_lucide_react35 = require("lucide-react");
|
|
20321
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
20497
20322
|
var SingleSelectProperty = ({
|
|
20498
20323
|
children,
|
|
20499
20324
|
value,
|
|
@@ -20502,18 +20327,18 @@ var SingleSelectProperty = ({
|
|
|
20502
20327
|
...props
|
|
20503
20328
|
}) => {
|
|
20504
20329
|
const hasValue = value !== void 0;
|
|
20505
|
-
return /* @__PURE__ */ (0,
|
|
20330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
20506
20331
|
PropertyBase,
|
|
20507
20332
|
{
|
|
20508
20333
|
...props,
|
|
20509
20334
|
hasValue,
|
|
20510
|
-
icon: /* @__PURE__ */ (0,
|
|
20511
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20335
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_lucide_react35.List, { size: 24 }),
|
|
20336
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
20512
20337
|
"div",
|
|
20513
20338
|
{
|
|
20514
20339
|
"data-name": "property-input-wrapper",
|
|
20515
20340
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20516
|
-
children: /* @__PURE__ */ (0,
|
|
20341
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
|
|
20517
20342
|
SelectRoot,
|
|
20518
20343
|
{
|
|
20519
20344
|
value,
|
|
@@ -20523,7 +20348,7 @@ var SingleSelectProperty = ({
|
|
|
20523
20348
|
},
|
|
20524
20349
|
disabled: props.readOnly,
|
|
20525
20350
|
children: [
|
|
20526
|
-
/* @__PURE__ */ (0,
|
|
20351
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
20527
20352
|
SelectButton,
|
|
20528
20353
|
{
|
|
20529
20354
|
className: "flex-row-2 w-full items-center justify-between",
|
|
@@ -20531,7 +20356,7 @@ var SingleSelectProperty = ({
|
|
|
20531
20356
|
"data-name": "property-input"
|
|
20532
20357
|
}
|
|
20533
20358
|
),
|
|
20534
|
-
/* @__PURE__ */ (0,
|
|
20359
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SelectContent, { children })
|
|
20535
20360
|
]
|
|
20536
20361
|
}
|
|
20537
20362
|
)
|
|
@@ -20541,99 +20366,382 @@ var SingleSelectProperty = ({
|
|
|
20541
20366
|
);
|
|
20542
20367
|
};
|
|
20543
20368
|
|
|
20544
|
-
// src/components/user-interaction/properties/TextProperty.tsx
|
|
20545
|
-
var
|
|
20546
|
-
var
|
|
20547
|
-
var TextProperty = ({
|
|
20548
|
-
value,
|
|
20549
|
-
readOnly,
|
|
20550
|
-
onValueChange,
|
|
20551
|
-
onEditComplete,
|
|
20552
|
-
...baseProps
|
|
20553
|
-
}) => {
|
|
20554
|
-
const translation = useHightideTranslation();
|
|
20555
|
-
const hasValue = value !== void 0;
|
|
20556
|
-
return /* @__PURE__ */ (0,
|
|
20557
|
-
PropertyBase,
|
|
20558
|
-
{
|
|
20559
|
-
...baseProps,
|
|
20560
|
-
hasValue,
|
|
20561
|
-
icon: /* @__PURE__ */ (0,
|
|
20562
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20563
|
-
Textarea,
|
|
20564
|
-
{
|
|
20565
|
-
"data-name": "property-input",
|
|
20566
|
-
className: "w-full",
|
|
20567
|
-
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20568
|
-
rows: 5,
|
|
20569
|
-
value: value ?? "",
|
|
20570
|
-
readOnly,
|
|
20571
|
-
placeholder: translation("text"),
|
|
20572
|
-
onValueChange: (value2) => onValueChange?.(value2),
|
|
20573
|
-
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
20574
|
-
}
|
|
20575
|
-
)
|
|
20369
|
+
// src/components/user-interaction/properties/TextProperty.tsx
|
|
20370
|
+
var import_lucide_react36 = require("lucide-react");
|
|
20371
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
20372
|
+
var TextProperty = ({
|
|
20373
|
+
value,
|
|
20374
|
+
readOnly,
|
|
20375
|
+
onValueChange,
|
|
20376
|
+
onEditComplete,
|
|
20377
|
+
...baseProps
|
|
20378
|
+
}) => {
|
|
20379
|
+
const translation = useHightideTranslation();
|
|
20380
|
+
const hasValue = value !== void 0;
|
|
20381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
20382
|
+
PropertyBase,
|
|
20383
|
+
{
|
|
20384
|
+
...baseProps,
|
|
20385
|
+
hasValue,
|
|
20386
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_lucide_react36.Text, { size: 24 }),
|
|
20387
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
20388
|
+
Textarea,
|
|
20389
|
+
{
|
|
20390
|
+
"data-name": "property-input",
|
|
20391
|
+
className: "w-full",
|
|
20392
|
+
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20393
|
+
rows: 5,
|
|
20394
|
+
value: value ?? "",
|
|
20395
|
+
readOnly,
|
|
20396
|
+
placeholder: translation("text"),
|
|
20397
|
+
onValueChange: (value2) => onValueChange?.(value2),
|
|
20398
|
+
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
20399
|
+
}
|
|
20400
|
+
)
|
|
20401
|
+
}
|
|
20402
|
+
);
|
|
20403
|
+
};
|
|
20404
|
+
|
|
20405
|
+
// src/components/utils/Polymorphic.tsx
|
|
20406
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
20407
|
+
var import_react111 = require("react");
|
|
20408
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
20409
|
+
var PolymorphicSlot = (0, import_react111.forwardRef)(function PolymorphicSlot2({
|
|
20410
|
+
children,
|
|
20411
|
+
asChild,
|
|
20412
|
+
defaultComponent = "div",
|
|
20413
|
+
...props
|
|
20414
|
+
}, ref) {
|
|
20415
|
+
const Component = asChild ? import_react_slot.Slot : defaultComponent;
|
|
20416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Component, { ...props, ref, children });
|
|
20417
|
+
});
|
|
20418
|
+
|
|
20419
|
+
// src/components/utils/Transition.tsx
|
|
20420
|
+
var import_react112 = require("react");
|
|
20421
|
+
function Transition({
|
|
20422
|
+
children,
|
|
20423
|
+
show,
|
|
20424
|
+
includeAnimation = true
|
|
20425
|
+
}) {
|
|
20426
|
+
const [isOpen, setIsOpen] = (0, import_react112.useState)(show);
|
|
20427
|
+
const [isTransitioning, setIsTransitioning] = (0, import_react112.useState)(!isOpen);
|
|
20428
|
+
const isUsingReducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : true;
|
|
20429
|
+
(0, import_react112.useEffect)(() => {
|
|
20430
|
+
setIsOpen(show);
|
|
20431
|
+
setIsTransitioning(true);
|
|
20432
|
+
}, [show]);
|
|
20433
|
+
const onAnimationEnd = () => setIsTransitioning(false);
|
|
20434
|
+
const bag = {
|
|
20435
|
+
isOpen,
|
|
20436
|
+
isTransitioning,
|
|
20437
|
+
isUsingReducedMotion,
|
|
20438
|
+
data: {
|
|
20439
|
+
"data-open": isOpen && !isTransitioning ? "" : void 0,
|
|
20440
|
+
"data-opening": isOpen && isTransitioning ? "" : void 0,
|
|
20441
|
+
"data-closing": !isOpen && isTransitioning ? "" : void 0,
|
|
20442
|
+
"data-closed": !isOpen && !isTransitioning ? "" : void 0
|
|
20443
|
+
},
|
|
20444
|
+
handlers: {
|
|
20445
|
+
onTransitionEnd: () => setIsTransitioning(false),
|
|
20446
|
+
onTransitionCancel: () => setIsTransitioning(false),
|
|
20447
|
+
onAnimationEnd: includeAnimation ? onAnimationEnd : void 0
|
|
20448
|
+
}
|
|
20449
|
+
};
|
|
20450
|
+
return BagFunctionUtil.resolve(children, bag);
|
|
20451
|
+
}
|
|
20452
|
+
|
|
20453
|
+
// src/global-contexts/HightideProvider.tsx
|
|
20454
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
20455
|
+
var HightideProvider = ({
|
|
20456
|
+
children,
|
|
20457
|
+
theme,
|
|
20458
|
+
locale,
|
|
20459
|
+
config
|
|
20460
|
+
}) => {
|
|
20461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(LocaleProvider, { ...locale, children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(ThemeProvider, { ...theme, children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(HightideConfigProvider, { ...config, children }) }) });
|
|
20462
|
+
};
|
|
20463
|
+
|
|
20464
|
+
// src/hooks/focus/useFocusGuards.ts
|
|
20465
|
+
var import_react113 = require("react");
|
|
20466
|
+
var selectorName = "data-hw-focus-guard";
|
|
20467
|
+
function FocusGuard() {
|
|
20468
|
+
const element = document.createElement("div");
|
|
20469
|
+
element.setAttribute(selectorName, "");
|
|
20470
|
+
element.tabIndex = 0;
|
|
20471
|
+
element.style.border = "none";
|
|
20472
|
+
element.style.outline = "none";
|
|
20473
|
+
element.style.boxShadow = "none";
|
|
20474
|
+
element.style.opacity = "0";
|
|
20475
|
+
element.style.position = "fixed";
|
|
20476
|
+
element.style.pointerEvents = "none";
|
|
20477
|
+
return element;
|
|
20478
|
+
}
|
|
20479
|
+
var FocusGuardsService = class _FocusGuardsService {
|
|
20480
|
+
constructor() {
|
|
20481
|
+
this.count = 0;
|
|
20482
|
+
}
|
|
20483
|
+
static getInstance() {
|
|
20484
|
+
if (!_FocusGuardsService.instance) {
|
|
20485
|
+
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
20486
|
+
}
|
|
20487
|
+
return _FocusGuardsService.instance;
|
|
20488
|
+
}
|
|
20489
|
+
add() {
|
|
20490
|
+
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
20491
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
20492
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
20493
|
+
this.count++;
|
|
20494
|
+
}
|
|
20495
|
+
remove() {
|
|
20496
|
+
if (this.count === 1) {
|
|
20497
|
+
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
20498
|
+
}
|
|
20499
|
+
this.count--;
|
|
20500
|
+
}
|
|
20501
|
+
};
|
|
20502
|
+
var useFocusGuards = () => {
|
|
20503
|
+
(0, import_react113.useEffect)(() => {
|
|
20504
|
+
FocusGuardsService.getInstance().add();
|
|
20505
|
+
return () => {
|
|
20506
|
+
FocusGuardsService.getInstance().remove();
|
|
20507
|
+
};
|
|
20508
|
+
}, []);
|
|
20509
|
+
};
|
|
20510
|
+
|
|
20511
|
+
// src/hooks/focus/useFocusOnceVisible.ts
|
|
20512
|
+
var import_react114 = __toESM(require("react"));
|
|
20513
|
+
var useFocusOnceVisible = (ref, disable = false) => {
|
|
20514
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react114.default.useState(false);
|
|
20515
|
+
(0, import_react114.useEffect)(() => {
|
|
20516
|
+
if (disable || hasUsedFocus) {
|
|
20517
|
+
return;
|
|
20518
|
+
}
|
|
20519
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
20520
|
+
if (entry.isIntersecting && !hasUsedFocus) {
|
|
20521
|
+
ref.current?.focus();
|
|
20522
|
+
setHasUsedFocus(hasUsedFocus);
|
|
20523
|
+
}
|
|
20524
|
+
}, {
|
|
20525
|
+
threshold: 0.1
|
|
20526
|
+
});
|
|
20527
|
+
if (ref.current) {
|
|
20528
|
+
observer.observe(ref.current);
|
|
20529
|
+
}
|
|
20530
|
+
return () => observer.disconnect();
|
|
20531
|
+
}, [disable, hasUsedFocus, ref]);
|
|
20532
|
+
};
|
|
20533
|
+
|
|
20534
|
+
// src/hooks/focus/useIsMounted.ts
|
|
20535
|
+
var import_react115 = require("react");
|
|
20536
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
20537
|
+
var useIsomorphicEffect = isClient ? import_react115.useLayoutEffect : import_react115.useEffect;
|
|
20538
|
+
var useIsMounted = () => {
|
|
20539
|
+
const [isMounted, setIsMounted] = (0, import_react115.useState)(false);
|
|
20540
|
+
useIsomorphicEffect(() => {
|
|
20541
|
+
setIsMounted(true);
|
|
20542
|
+
return () => {
|
|
20543
|
+
setIsMounted(false);
|
|
20544
|
+
};
|
|
20545
|
+
}, []);
|
|
20546
|
+
return isMounted;
|
|
20547
|
+
};
|
|
20548
|
+
|
|
20549
|
+
// src/hooks/useHandleRefs.ts
|
|
20550
|
+
var import_react116 = require("react");
|
|
20551
|
+
function useHandleRefs(handleRef) {
|
|
20552
|
+
const refs = (0, import_react116.useRef)([]);
|
|
20553
|
+
(0, import_react116.useEffect)(() => {
|
|
20554
|
+
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
20555
|
+
() => ({ current: null })
|
|
20556
|
+
);
|
|
20557
|
+
const values = Object.values(handleRef?.current ?? {});
|
|
20558
|
+
values.forEach((el, i) => {
|
|
20559
|
+
refs.current[i].current = el;
|
|
20560
|
+
});
|
|
20561
|
+
});
|
|
20562
|
+
return refs.current;
|
|
20563
|
+
}
|
|
20564
|
+
|
|
20565
|
+
// src/hooks/useLogUnstableDependencies.ts
|
|
20566
|
+
var import_react117 = __toESM(require("react"));
|
|
20567
|
+
function useLogUnstableDependencies(name, value) {
|
|
20568
|
+
const prev = import_react117.default.useRef(null);
|
|
20569
|
+
import_react117.default.useEffect(() => {
|
|
20570
|
+
if (!prev.current) {
|
|
20571
|
+
prev.current = value;
|
|
20572
|
+
return;
|
|
20576
20573
|
}
|
|
20577
|
-
|
|
20574
|
+
const changes = {};
|
|
20575
|
+
for (const key of Object.keys(value)) {
|
|
20576
|
+
if (prev.current[key] !== value[key]) {
|
|
20577
|
+
changes[key] = {
|
|
20578
|
+
prev: prev.current[key],
|
|
20579
|
+
next: value[key]
|
|
20580
|
+
};
|
|
20581
|
+
}
|
|
20582
|
+
}
|
|
20583
|
+
if (Object.keys(changes).length > 0) {
|
|
20584
|
+
console.info(`[${name}] changed`, changes);
|
|
20585
|
+
}
|
|
20586
|
+
prev.current = value;
|
|
20587
|
+
});
|
|
20588
|
+
}
|
|
20589
|
+
|
|
20590
|
+
// src/hooks/useOverwritableState.ts
|
|
20591
|
+
var import_react118 = require("react");
|
|
20592
|
+
var useOverwritableState = (overwriteValue, onChange) => {
|
|
20593
|
+
const [state, setState] = (0, import_react118.useState)(overwriteValue);
|
|
20594
|
+
(0, import_react118.useEffect)(() => {
|
|
20595
|
+
setState(overwriteValue);
|
|
20596
|
+
}, [overwriteValue]);
|
|
20597
|
+
const onChangeWrapper = (action) => {
|
|
20598
|
+
const resolved = resolveSetState(action, state);
|
|
20599
|
+
setState(resolved);
|
|
20600
|
+
onChange?.(resolved);
|
|
20601
|
+
};
|
|
20602
|
+
return [state, onChangeWrapper];
|
|
20578
20603
|
};
|
|
20579
20604
|
|
|
20580
|
-
// src/
|
|
20581
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
20605
|
+
// src/hooks/useRerender.ts
|
|
20582
20606
|
var import_react119 = require("react");
|
|
20583
|
-
var
|
|
20584
|
-
|
|
20585
|
-
|
|
20586
|
-
asChild,
|
|
20587
|
-
defaultComponent = "div",
|
|
20588
|
-
...props
|
|
20589
|
-
}, ref) {
|
|
20590
|
-
const Component = asChild ? import_react_slot.Slot : defaultComponent;
|
|
20591
|
-
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Component, { ...props, ref, children });
|
|
20592
|
-
});
|
|
20607
|
+
var useRerender = () => {
|
|
20608
|
+
return (0, import_react119.useReducer)(() => ({}), {})[1];
|
|
20609
|
+
};
|
|
20593
20610
|
|
|
20594
|
-
// src/
|
|
20611
|
+
// src/hooks/useUpdatingDateString.ts
|
|
20595
20612
|
var import_react120 = require("react");
|
|
20596
|
-
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20603
|
-
|
|
20613
|
+
var useUpdatingDateString = ({ absoluteFormat = "dateTime", localeOverride, date }) => {
|
|
20614
|
+
const { locale: contextLocale } = useLocale();
|
|
20615
|
+
const locale = localeOverride ?? contextLocale;
|
|
20616
|
+
const [dateAndTimeStrings, setDateAndTimeStrings] = (0, import_react120.useState)({
|
|
20617
|
+
compareDate: date,
|
|
20618
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20619
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20620
|
+
});
|
|
20604
20621
|
(0, import_react120.useEffect)(() => {
|
|
20605
|
-
|
|
20606
|
-
|
|
20607
|
-
|
|
20608
|
-
|
|
20609
|
-
|
|
20610
|
-
|
|
20611
|
-
|
|
20612
|
-
|
|
20613
|
-
|
|
20614
|
-
|
|
20615
|
-
|
|
20616
|
-
|
|
20617
|
-
|
|
20618
|
-
|
|
20619
|
-
|
|
20620
|
-
|
|
20621
|
-
|
|
20622
|
-
|
|
20623
|
-
|
|
20622
|
+
setDateAndTimeStrings({
|
|
20623
|
+
compareDate: date,
|
|
20624
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20625
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20626
|
+
});
|
|
20627
|
+
}, [date, absoluteFormat, locale]);
|
|
20628
|
+
(0, import_react120.useEffect)(() => {
|
|
20629
|
+
let timeoutId;
|
|
20630
|
+
const startTimer = () => {
|
|
20631
|
+
const now = /* @__PURE__ */ new Date();
|
|
20632
|
+
const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
|
|
20633
|
+
let delayInSeconds;
|
|
20634
|
+
if (diff < DateUtils.timesInSeconds.minute) {
|
|
20635
|
+
delayInSeconds = DateUtils.timesInSeconds.second;
|
|
20636
|
+
} else if (diff < DateUtils.timesInSeconds.hour) {
|
|
20637
|
+
delayInSeconds = DateUtils.timesInSeconds.minute;
|
|
20638
|
+
} else {
|
|
20639
|
+
delayInSeconds = DateUtils.timesInSeconds.hour;
|
|
20640
|
+
}
|
|
20641
|
+
timeoutId = setInterval(() => {
|
|
20642
|
+
setDateAndTimeStrings({
|
|
20643
|
+
compareDate: date,
|
|
20644
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20645
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20646
|
+
});
|
|
20647
|
+
}, delayInSeconds * 1e3 / 2);
|
|
20648
|
+
};
|
|
20649
|
+
startTimer();
|
|
20650
|
+
return () => clearInterval(timeoutId);
|
|
20651
|
+
}, [absoluteFormat, date, locale]);
|
|
20652
|
+
return {
|
|
20653
|
+
absolute: dateAndTimeStrings.absolute,
|
|
20654
|
+
relative: dateAndTimeStrings.relative
|
|
20624
20655
|
};
|
|
20625
|
-
|
|
20626
|
-
}
|
|
20656
|
+
};
|
|
20627
20657
|
|
|
20628
|
-
// src/
|
|
20629
|
-
var
|
|
20630
|
-
|
|
20631
|
-
|
|
20632
|
-
|
|
20633
|
-
|
|
20634
|
-
|
|
20635
|
-
|
|
20636
|
-
|
|
20658
|
+
// src/utils/emailValidation.ts
|
|
20659
|
+
var validateEmail = (email) => {
|
|
20660
|
+
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
20661
|
+
};
|
|
20662
|
+
|
|
20663
|
+
// src/hooks/useValidators.ts
|
|
20664
|
+
var import_react121 = require("react");
|
|
20665
|
+
var notEmpty = (value) => {
|
|
20666
|
+
if (!value) {
|
|
20667
|
+
return "notEmpty";
|
|
20668
|
+
}
|
|
20669
|
+
};
|
|
20670
|
+
var boundsValidator = (length, bounds) => {
|
|
20671
|
+
const [min, max] = bounds;
|
|
20672
|
+
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
20673
|
+
return "range";
|
|
20674
|
+
}
|
|
20675
|
+
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
20676
|
+
return "lower";
|
|
20677
|
+
}
|
|
20678
|
+
if (max !== void 0 && length !== void 0 && length > max) {
|
|
20679
|
+
return "upper";
|
|
20680
|
+
}
|
|
20681
|
+
return "none";
|
|
20682
|
+
};
|
|
20683
|
+
var lengthValidator = (value, bounds) => {
|
|
20684
|
+
const mapping = {
|
|
20685
|
+
range: "outOfRangeString",
|
|
20686
|
+
lower: "tooShort",
|
|
20687
|
+
upper: "tooLong",
|
|
20688
|
+
none: void 0
|
|
20689
|
+
};
|
|
20690
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
20691
|
+
};
|
|
20692
|
+
var selectionValidator = (value, bounds) => {
|
|
20693
|
+
const mapping = {
|
|
20694
|
+
range: "outOfRangeSelectionItems",
|
|
20695
|
+
lower: "tooFewSelectionItems",
|
|
20696
|
+
upper: "tooManySelectionItems",
|
|
20697
|
+
none: void 0
|
|
20698
|
+
};
|
|
20699
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
20700
|
+
};
|
|
20701
|
+
var emailValidator = (value) => {
|
|
20702
|
+
if (!value || !validateEmail(value)) {
|
|
20703
|
+
return "invalidEmail";
|
|
20704
|
+
}
|
|
20705
|
+
};
|
|
20706
|
+
var UseValidators = {
|
|
20707
|
+
notEmpty,
|
|
20708
|
+
length: lengthValidator,
|
|
20709
|
+
email: emailValidator,
|
|
20710
|
+
selection: selectionValidator
|
|
20711
|
+
};
|
|
20712
|
+
var useTranslatedValidators = () => {
|
|
20713
|
+
const translation = useHightideTranslation();
|
|
20714
|
+
return (0, import_react121.useMemo)(() => ({
|
|
20715
|
+
notEmpty: (value) => {
|
|
20716
|
+
const result = notEmpty(value);
|
|
20717
|
+
if (result) {
|
|
20718
|
+
return translation(result);
|
|
20719
|
+
}
|
|
20720
|
+
},
|
|
20721
|
+
length: (value, length) => {
|
|
20722
|
+
const [min, max] = length;
|
|
20723
|
+
const result = lengthValidator(value, length);
|
|
20724
|
+
if (result) {
|
|
20725
|
+
return translation(result, { min, max });
|
|
20726
|
+
}
|
|
20727
|
+
},
|
|
20728
|
+
email: (value) => {
|
|
20729
|
+
const result = emailValidator(value ?? "");
|
|
20730
|
+
if (result) {
|
|
20731
|
+
return translation(result);
|
|
20732
|
+
}
|
|
20733
|
+
},
|
|
20734
|
+
selection: (value, length) => {
|
|
20735
|
+
const [min, max] = length;
|
|
20736
|
+
const result = selectionValidator(value, length);
|
|
20737
|
+
if (result) {
|
|
20738
|
+
return translation(
|
|
20739
|
+
result,
|
|
20740
|
+
{ min, max }
|
|
20741
|
+
);
|
|
20742
|
+
}
|
|
20743
|
+
}
|
|
20744
|
+
}), [translation]);
|
|
20637
20745
|
};
|
|
20638
20746
|
|
|
20639
20747
|
// src/utils/builder.ts
|
|
@@ -20930,6 +21038,7 @@ var PromiseUtils = {
|
|
|
20930
21038
|
FilterOperatorUtils,
|
|
20931
21039
|
FilterPopUp,
|
|
20932
21040
|
FilterValueUtils,
|
|
21041
|
+
FlexibleDateTimeInput,
|
|
20933
21042
|
FocusTrap,
|
|
20934
21043
|
FocusTrapWrapper,
|
|
20935
21044
|
FormContext,
|