@helpwave/hightide 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +32 -4
- package/dist/index.d.ts +32 -4
- package/dist/index.js +1475 -1224
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1383 -1134
- package/dist/index.mjs.map +1 -1
- package/dist/style/globals.css +3 -0
- package/package.json +3 -1
package/dist/index.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,
|
|
@@ -6924,6 +6925,7 @@ __export(index_exports, {
|
|
|
6924
6925
|
SimpleSearch: () => SimpleSearch,
|
|
6925
6926
|
SimpleSearchWithMapping: () => SimpleSearchWithMapping,
|
|
6926
6927
|
SingleSelectProperty: () => SingleSelectProperty,
|
|
6928
|
+
SortingList: () => SortingList,
|
|
6927
6929
|
StepperBar: () => StepperBar,
|
|
6928
6930
|
StorageListener: () => StorageListener,
|
|
6929
6931
|
Switch: () => Switch,
|
|
@@ -8297,9 +8299,9 @@ var AnchoredFloatingContainer = (0, import_react12.forwardRef)(function Floating
|
|
|
8297
8299
|
options = {},
|
|
8298
8300
|
active = true,
|
|
8299
8301
|
...props
|
|
8300
|
-
},
|
|
8302
|
+
}, forwardRef34) {
|
|
8301
8303
|
const innerRef = (0, import_react12.useRef)(null);
|
|
8302
|
-
(0, import_react12.useImperativeHandle)(
|
|
8304
|
+
(0, import_react12.useImperativeHandle)(forwardRef34, () => innerRef.current);
|
|
8303
8305
|
const position = useAnchoredPosition({
|
|
8304
8306
|
...options,
|
|
8305
8307
|
container: innerRef,
|
|
@@ -8603,6 +8605,8 @@ var hightideTranslation = {
|
|
|
8603
8605
|
"de-DE": {
|
|
8604
8606
|
"add": `Hinzuf\xFCgen`,
|
|
8605
8607
|
"addFilter": `Filter hinzuf\xFCgen`,
|
|
8608
|
+
"addSorting": `Sortierung hinzuf\xFCgen`,
|
|
8609
|
+
"addTime": `Uhrzeit hinzuf\xFCgen`,
|
|
8606
8610
|
"after": `Nach`,
|
|
8607
8611
|
"age": `Alter`,
|
|
8608
8612
|
"all": `Alle`,
|
|
@@ -8813,6 +8817,8 @@ var hightideTranslation = {
|
|
|
8813
8817
|
"slideOf": ({ index, length }) => {
|
|
8814
8818
|
return `Slide ${index} von ${length} slides`;
|
|
8815
8819
|
},
|
|
8820
|
+
"sortAsc": `ASC`,
|
|
8821
|
+
"sortDesc": `DESC`,
|
|
8816
8822
|
"sorting": `Sortierung`,
|
|
8817
8823
|
"sSortingState": ({ sortDirection }) => {
|
|
8818
8824
|
return import_internationalization.TranslationGen.resolveSelect(sortDirection, {
|
|
@@ -8963,11 +8969,14 @@ var hightideTranslation = {
|
|
|
8963
8969
|
"update": `Update`,
|
|
8964
8970
|
"value": `Wert`,
|
|
8965
8971
|
"welcome": `Willkommen`,
|
|
8972
|
+
"withoutTime": `Ohne Uhrzeit`,
|
|
8966
8973
|
"yes": `Ja`
|
|
8967
8974
|
},
|
|
8968
8975
|
"en-US": {
|
|
8969
8976
|
"add": `Add`,
|
|
8970
8977
|
"addFilter": `Add filter`,
|
|
8978
|
+
"addSorting": `Add sorting`,
|
|
8979
|
+
"addTime": `Add Time`,
|
|
8971
8980
|
"after": `After`,
|
|
8972
8981
|
"age": `Age`,
|
|
8973
8982
|
"all": `All`,
|
|
@@ -9178,6 +9187,8 @@ var hightideTranslation = {
|
|
|
9178
9187
|
"slideOf": ({ index, length }) => {
|
|
9179
9188
|
return `Slide ${index} of ${length} slides`;
|
|
9180
9189
|
},
|
|
9190
|
+
"sortAsc": `ASC`,
|
|
9191
|
+
"sortDesc": `DESC`,
|
|
9181
9192
|
"sorting": `Sorting`,
|
|
9182
9193
|
"sSortingState": ({ sortDirection }) => {
|
|
9183
9194
|
return import_internationalization.TranslationGen.resolveSelect(sortDirection, {
|
|
@@ -9328,6 +9339,7 @@ var hightideTranslation = {
|
|
|
9328
9339
|
"update": `Update`,
|
|
9329
9340
|
"value": `Value`,
|
|
9330
9341
|
"welcome": `Welcome`,
|
|
9342
|
+
"withoutTime": `Without Time`,
|
|
9331
9343
|
"yes": `Yes`
|
|
9332
9344
|
}
|
|
9333
9345
|
};
|
|
@@ -9849,7 +9861,7 @@ var TooltipDisplay = (0, import_react19.forwardRef)(function TooltipAnchoredFloa
|
|
|
9849
9861
|
isAnimated: isAnimatedOverwrite,
|
|
9850
9862
|
anchor: anchorOverwrite,
|
|
9851
9863
|
...props
|
|
9852
|
-
},
|
|
9864
|
+
}, forwardRef34) {
|
|
9853
9865
|
const { config } = useHightideConfig();
|
|
9854
9866
|
const tooltipContext = (0, import_react19.useContext)(TooltipContext);
|
|
9855
9867
|
const disabled = disabledOverwrite ?? tooltipContext?.disabled;
|
|
@@ -9865,7 +9877,7 @@ var TooltipDisplay = (0, import_react19.forwardRef)(function TooltipAnchoredFloa
|
|
|
9865
9877
|
[isAnimatedOverwrite, config.tooltip.isAnimated]
|
|
9866
9878
|
);
|
|
9867
9879
|
const container = (0, import_react21.useRef)(null);
|
|
9868
|
-
(0, import_react19.useImperativeHandle)(
|
|
9880
|
+
(0, import_react19.useImperativeHandle)(forwardRef34, () => container.current);
|
|
9869
9881
|
const isActive = !disabled && isShown;
|
|
9870
9882
|
const { isVisible, transitionState } = useTransitionState(
|
|
9871
9883
|
(0, import_react21.useMemo)(() => ({ isOpen: isShown, ref: container }), [isShown])
|
|
@@ -12113,10 +12125,10 @@ var InputDialog = ({
|
|
|
12113
12125
|
};
|
|
12114
12126
|
|
|
12115
12127
|
// src/components/user-interaction/Select/Select.tsx
|
|
12116
|
-
var
|
|
12128
|
+
var import_react57 = require("react");
|
|
12117
12129
|
|
|
12118
12130
|
// src/components/user-interaction/Select/SelectRoot.tsx
|
|
12119
|
-
var
|
|
12131
|
+
var import_react51 = require("react");
|
|
12120
12132
|
|
|
12121
12133
|
// src/components/user-interaction/Select/SelectContext.tsx
|
|
12122
12134
|
var import_react44 = require("react");
|
|
@@ -12128,7 +12140,7 @@ function useSelectContext() {
|
|
|
12128
12140
|
}
|
|
12129
12141
|
|
|
12130
12142
|
// src/components/user-interaction/Select/useSelect.ts
|
|
12131
|
-
var
|
|
12143
|
+
var import_react49 = require("react");
|
|
12132
12144
|
|
|
12133
12145
|
// src/hooks/useSingleSelection.ts
|
|
12134
12146
|
var import_react45 = require("react");
|
|
@@ -12254,217 +12266,8 @@ function useListNavigation({
|
|
|
12254
12266
|
}), [resolvedHighlightId, highlight, first, last, next, previous]);
|
|
12255
12267
|
}
|
|
12256
12268
|
|
|
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
12269
|
// src/hooks/useSearch.ts
|
|
12467
|
-
var
|
|
12270
|
+
var import_react47 = require("react");
|
|
12468
12271
|
|
|
12469
12272
|
// src/utils/simpleSearch.ts
|
|
12470
12273
|
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
@@ -12503,18 +12306,18 @@ function useSearch({
|
|
|
12503
12306
|
}) {
|
|
12504
12307
|
const toTagsResolved = toTags ?? defaultToTags;
|
|
12505
12308
|
const toTagsStable = useEventCallbackStabilizer(toTagsResolved);
|
|
12506
|
-
const searchResult = (0,
|
|
12309
|
+
const searchResult = (0, import_react47.useMemo)(() => {
|
|
12507
12310
|
const q = searchQuery.trim().toLowerCase();
|
|
12508
12311
|
if (!q) return items;
|
|
12509
12312
|
return MultiSearchWithMapping(searchQuery, [...items], (item) => toTagsStable(item));
|
|
12510
12313
|
}, [items, searchQuery, toTagsStable]);
|
|
12511
|
-
return (0,
|
|
12314
|
+
return (0, import_react47.useMemo)(() => ({
|
|
12512
12315
|
searchResult
|
|
12513
12316
|
}), [searchResult]);
|
|
12514
12317
|
}
|
|
12515
12318
|
|
|
12516
12319
|
// src/hooks/useTypeAheadSearch.ts
|
|
12517
|
-
var
|
|
12320
|
+
var import_react48 = require("react");
|
|
12518
12321
|
function defaultToString(value) {
|
|
12519
12322
|
return String(value);
|
|
12520
12323
|
}
|
|
@@ -12524,12 +12327,12 @@ function useTypeAheadSearch({
|
|
|
12524
12327
|
toString: toStringProp,
|
|
12525
12328
|
onResultChange
|
|
12526
12329
|
}) {
|
|
12527
|
-
const bufferRef = (0,
|
|
12528
|
-
const timeoutRef = (0,
|
|
12330
|
+
const bufferRef = (0, import_react48.useRef)("");
|
|
12331
|
+
const timeoutRef = (0, import_react48.useRef)(null);
|
|
12529
12332
|
const toString = toStringProp ?? defaultToString;
|
|
12530
12333
|
const toStringStable = useEventCallbackStabilizer(toString);
|
|
12531
12334
|
const onResultChangeStable = useEventCallbackStabilizer(onResultChange);
|
|
12532
|
-
const reset = (0,
|
|
12335
|
+
const reset = (0, import_react48.useCallback)(() => {
|
|
12533
12336
|
if (timeoutRef.current) {
|
|
12534
12337
|
clearTimeout(timeoutRef.current);
|
|
12535
12338
|
timeoutRef.current = null;
|
|
@@ -12537,10 +12340,10 @@ function useTypeAheadSearch({
|
|
|
12537
12340
|
bufferRef.current = "";
|
|
12538
12341
|
onResultChangeStable(null);
|
|
12539
12342
|
}, [onResultChangeStable]);
|
|
12540
|
-
(0,
|
|
12343
|
+
(0, import_react48.useEffect)(() => () => {
|
|
12541
12344
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12542
12345
|
}, []);
|
|
12543
|
-
const addToTypeAhead = (0,
|
|
12346
|
+
const addToTypeAhead = (0, import_react48.useCallback)((str) => {
|
|
12544
12347
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12545
12348
|
bufferRef.current += str;
|
|
12546
12349
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -12562,397 +12365,43 @@ function useTypeAheadSearch({
|
|
|
12562
12365
|
return { addToTypeAhead, reset };
|
|
12563
12366
|
}
|
|
12564
12367
|
|
|
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]);
|
|
12368
|
+
// src/components/user-interaction/Select/useSelect.ts
|
|
12369
|
+
function useSelect({
|
|
12370
|
+
options,
|
|
12371
|
+
value: controlledValue,
|
|
12372
|
+
onValueChange,
|
|
12373
|
+
onEditComplete,
|
|
12374
|
+
initialValue = null,
|
|
12375
|
+
onClose,
|
|
12376
|
+
onIsOpenChange,
|
|
12377
|
+
initialIsOpen = false,
|
|
12378
|
+
typeAheadResetMs = 500
|
|
12379
|
+
}) {
|
|
12380
|
+
const [isOpen, setIsOpen] = (0, import_react49.useState)(initialIsOpen);
|
|
12381
|
+
const [searchQuery, setSearchQuery] = (0, import_react49.useState)("");
|
|
12382
|
+
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
12383
|
+
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
12384
|
+
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12385
|
+
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
12386
|
+
const onSelectionChangeWrapper = (0, import_react49.useCallback)((id) => {
|
|
12387
|
+
if (id === null) return;
|
|
12388
|
+
onValueChangeStable(id);
|
|
12389
|
+
onEditCompleteStable(id);
|
|
12390
|
+
setIsOpen(false);
|
|
12391
|
+
}, [onValueChangeStable, onEditCompleteStable, setIsOpen]);
|
|
12392
|
+
const { selection, selectValue } = useSingleSelection({
|
|
12393
|
+
options,
|
|
12394
|
+
selection: controlledValue,
|
|
12395
|
+
onSelectionChange: onSelectionChangeWrapper,
|
|
12396
|
+
initialSelection: initialValue
|
|
12397
|
+
});
|
|
12398
|
+
const { searchResult: visibleOptions } = useSearch({
|
|
12399
|
+
items: options,
|
|
12400
|
+
searchQuery,
|
|
12401
|
+
toTags: (0, import_react49.useCallback)((o) => [o.label], [])
|
|
12402
|
+
});
|
|
12403
|
+
const visibleOptionIds = (0, import_react49.useMemo)(() => visibleOptions.map((o) => o.id), [visibleOptions]);
|
|
12404
|
+
const enabledOptions = (0, import_react49.useMemo)(() => visibleOptions.filter((o) => !o.disabled), [visibleOptions]);
|
|
12956
12405
|
const {
|
|
12957
12406
|
highlightedId,
|
|
12958
12407
|
highlight: listNavHighlight,
|
|
@@ -12968,28 +12417,28 @@ function useSelect({
|
|
|
12968
12417
|
options: enabledOptions,
|
|
12969
12418
|
resetTimer: typeAheadResetMs,
|
|
12970
12419
|
toString: (o) => o.label ?? "",
|
|
12971
|
-
onResultChange: (0,
|
|
12420
|
+
onResultChange: (0, import_react49.useCallback)((option) => {
|
|
12972
12421
|
if (option) listNavHighlight(option.id);
|
|
12973
12422
|
}, [listNavHighlight])
|
|
12974
12423
|
});
|
|
12975
|
-
(0,
|
|
12424
|
+
(0, import_react49.useEffect)(() => {
|
|
12976
12425
|
if (!isOpen) typeAheadReset();
|
|
12977
12426
|
}, [isOpen, typeAheadReset]);
|
|
12978
|
-
const state = (0,
|
|
12427
|
+
const state = (0, import_react49.useMemo)(() => ({
|
|
12979
12428
|
value: selection,
|
|
12980
12429
|
highlightedValue: highlightedId,
|
|
12981
12430
|
isOpen,
|
|
12982
12431
|
searchQuery,
|
|
12983
12432
|
options
|
|
12984
12433
|
}), [selection, highlightedId, isOpen, searchQuery, options]);
|
|
12985
|
-
const computedState = (0,
|
|
12434
|
+
const computedState = (0, import_react49.useMemo)(() => ({
|
|
12986
12435
|
visibleOptionIds
|
|
12987
12436
|
}), [visibleOptionIds]);
|
|
12988
|
-
const highlightItem = (0,
|
|
12437
|
+
const highlightItem = (0, import_react49.useCallback)((value) => {
|
|
12989
12438
|
if (!enabledOptions.some((o) => o.id === value)) return;
|
|
12990
12439
|
listNavHighlight(value);
|
|
12991
12440
|
}, [enabledOptions, listNavHighlight]);
|
|
12992
|
-
const setIsOpenWrapper = (0,
|
|
12441
|
+
const setIsOpenWrapper = (0, import_react49.useCallback)((isOpen2, behavior) => {
|
|
12993
12442
|
behavior = behavior ?? "first";
|
|
12994
12443
|
if (isOpen2) {
|
|
12995
12444
|
if (selection == null) {
|
|
@@ -13008,11 +12457,11 @@ function useSelect({
|
|
|
13008
12457
|
setIsOpen(isOpen2);
|
|
13009
12458
|
onIsOpenChangeStable(isOpen2);
|
|
13010
12459
|
}, [setIsOpen, highlightItem, onCloseStable, setSearchQuery, onIsOpenChangeStable, selection, listNavFirst, listNavLast]);
|
|
13011
|
-
const toggleOpenWrapper = (0,
|
|
12460
|
+
const toggleOpenWrapper = (0, import_react49.useCallback)((behavior) => {
|
|
13012
12461
|
const next = !isOpen;
|
|
13013
12462
|
setIsOpenWrapper(next, behavior);
|
|
13014
12463
|
}, [isOpen, setIsOpenWrapper]);
|
|
13015
|
-
const actions = (0,
|
|
12464
|
+
const actions = (0, import_react49.useMemo)(() => ({
|
|
13016
12465
|
selectValue: (id) => selectValue(id),
|
|
13017
12466
|
setIsOpen: setIsOpenWrapper,
|
|
13018
12467
|
toggleOpen: toggleOpenWrapper,
|
|
@@ -13024,7 +12473,7 @@ function useSelect({
|
|
|
13024
12473
|
highlightItem,
|
|
13025
12474
|
handleTypeaheadKey: addToTypeAhead
|
|
13026
12475
|
}), [selectValue, setIsOpenWrapper, listNavFirst, listNavLast, listNavNext, listNavPrevious, highlightItem, addToTypeAhead, toggleOpenWrapper]);
|
|
13027
|
-
return (0,
|
|
12476
|
+
return (0, import_react49.useMemo)(() => ({
|
|
13028
12477
|
...state,
|
|
13029
12478
|
...computedState,
|
|
13030
12479
|
...actions
|
|
@@ -13043,10 +12492,10 @@ var DOMUtils = {
|
|
|
13043
12492
|
};
|
|
13044
12493
|
|
|
13045
12494
|
// src/components/layout/popup/PopUpContext.tsx
|
|
13046
|
-
var
|
|
13047
|
-
var PopUpContext = (0,
|
|
12495
|
+
var import_react50 = require("react");
|
|
12496
|
+
var PopUpContext = (0, import_react50.createContext)(null);
|
|
13048
12497
|
function usePopUpContext() {
|
|
13049
|
-
const context = (0,
|
|
12498
|
+
const context = (0, import_react50.useContext)(PopUpContext);
|
|
13050
12499
|
if (!context) {
|
|
13051
12500
|
throw new Error("usePopUpContext must be used within a <PopUpContext.Provider>");
|
|
13052
12501
|
}
|
|
@@ -13072,16 +12521,16 @@ function SelectRoot({
|
|
|
13072
12521
|
readOnly = false,
|
|
13073
12522
|
required = false
|
|
13074
12523
|
}) {
|
|
13075
|
-
const [triggerRef, setTriggerRef] = (0,
|
|
13076
|
-
const [options, setOptions] = (0,
|
|
13077
|
-
const generatedId = (0,
|
|
13078
|
-
const [ids, setIds] = (0,
|
|
12524
|
+
const [triggerRef, setTriggerRef] = (0, import_react51.useState)(null);
|
|
12525
|
+
const [options, setOptions] = (0, import_react51.useState)([]);
|
|
12526
|
+
const generatedId = (0, import_react51.useId)();
|
|
12527
|
+
const [ids, setIds] = (0, import_react51.useState)({
|
|
13079
12528
|
trigger: "select-" + generatedId,
|
|
13080
12529
|
content: "select-content-" + generatedId,
|
|
13081
12530
|
listbox: "select-listbox-" + generatedId,
|
|
13082
12531
|
searchInput: "select-search-" + generatedId
|
|
13083
12532
|
});
|
|
13084
|
-
const registerOption = (0,
|
|
12533
|
+
const registerOption = (0, import_react51.useCallback)(
|
|
13085
12534
|
(item) => {
|
|
13086
12535
|
setOptions((prev) => {
|
|
13087
12536
|
const next = prev.filter((o) => o.value !== item.value);
|
|
@@ -13093,31 +12542,31 @@ function SelectRoot({
|
|
|
13093
12542
|
},
|
|
13094
12543
|
[]
|
|
13095
12544
|
);
|
|
13096
|
-
const registerTrigger = (0,
|
|
12545
|
+
const registerTrigger = (0, import_react51.useCallback)((ref) => {
|
|
13097
12546
|
setTriggerRef(ref);
|
|
13098
12547
|
return () => {
|
|
13099
12548
|
setTriggerRef(null);
|
|
13100
12549
|
};
|
|
13101
12550
|
}, []);
|
|
13102
|
-
const compare = (0,
|
|
13103
|
-
const idToOptionMap = (0,
|
|
12551
|
+
const compare = (0, import_react51.useMemo)(() => compareFunction ?? Object.is, [compareFunction]);
|
|
12552
|
+
const idToOptionMap = (0, import_react51.useMemo)(() => {
|
|
13104
12553
|
return options.reduce((acc, o) => {
|
|
13105
12554
|
acc[o.id] = o;
|
|
13106
12555
|
return acc;
|
|
13107
12556
|
}, {});
|
|
13108
12557
|
}, [options]);
|
|
13109
|
-
const mappedValueId = (0,
|
|
12558
|
+
const mappedValueId = (0, import_react51.useMemo)(() => {
|
|
13110
12559
|
if (value === void 0) return void 0;
|
|
13111
12560
|
return options.find((o) => compare(o.value, value))?.id ?? null;
|
|
13112
12561
|
}, [options, value, compare]);
|
|
13113
|
-
const mappedInitialValueId = (0,
|
|
12562
|
+
const mappedInitialValueId = (0, import_react51.useMemo)(() => {
|
|
13114
12563
|
if (initialValue === void 0) return void 0;
|
|
13115
12564
|
return options.find((o) => compare(o.value, initialValue))?.id ?? null;
|
|
13116
12565
|
}, [options, initialValue, compare]);
|
|
13117
12566
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
13118
12567
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
13119
12568
|
const onIsOpenChangeStable = useEventCallbackStabilizer(onIsOpenChange);
|
|
13120
|
-
const onValueChangeWrapper = (0,
|
|
12569
|
+
const onValueChangeWrapper = (0, import_react51.useCallback)((value2) => {
|
|
13121
12570
|
const option = idToOptionMap[value2];
|
|
13122
12571
|
if (option === void 0) {
|
|
13123
12572
|
console.warn(`Attempted to select an option ${value2} that is not valid`);
|
|
@@ -13125,7 +12574,7 @@ function SelectRoot({
|
|
|
13125
12574
|
}
|
|
13126
12575
|
onValueChangeStable(option.value);
|
|
13127
12576
|
}, [onValueChangeStable, idToOptionMap]);
|
|
13128
|
-
const onEditCompleteWrapper = (0,
|
|
12577
|
+
const onEditCompleteWrapper = (0, import_react51.useCallback)((value2) => {
|
|
13129
12578
|
const option = idToOptionMap[value2];
|
|
13130
12579
|
if (option === void 0) {
|
|
13131
12580
|
console.warn(`Attempted to edit complete an option ${value2} that is not valid`);
|
|
@@ -13144,17 +12593,17 @@ function SelectRoot({
|
|
|
13144
12593
|
onIsOpenChange: onIsOpenChangeStable
|
|
13145
12594
|
});
|
|
13146
12595
|
const { setSearchQuery } = state;
|
|
13147
|
-
(0,
|
|
12596
|
+
(0, import_react51.useEffect)(() => {
|
|
13148
12597
|
if (showSearch === false) {
|
|
13149
12598
|
setSearchQuery("");
|
|
13150
12599
|
}
|
|
13151
12600
|
}, [showSearch, setSearchQuery]);
|
|
13152
|
-
const config = (0,
|
|
12601
|
+
const config = (0, import_react51.useMemo)(() => ({
|
|
13153
12602
|
iconAppearance,
|
|
13154
12603
|
ids,
|
|
13155
12604
|
setIds
|
|
13156
12605
|
}), [iconAppearance, ids, setIds]);
|
|
13157
|
-
const layout = (0,
|
|
12606
|
+
const layout = (0, import_react51.useMemo)(() => ({
|
|
13158
12607
|
triggerRef,
|
|
13159
12608
|
registerTrigger
|
|
13160
12609
|
}), [triggerRef, registerTrigger]);
|
|
@@ -13209,22 +12658,22 @@ function SelectRoot({
|
|
|
13209
12658
|
}
|
|
13210
12659
|
|
|
13211
12660
|
// src/components/user-interaction/Select/SelectButton.tsx
|
|
13212
|
-
var
|
|
12661
|
+
var import_react53 = require("react");
|
|
13213
12662
|
|
|
13214
12663
|
// src/components/user-interaction/Select/SelectOption.tsx
|
|
13215
12664
|
var import_clsx9 = __toESM(require("clsx"));
|
|
13216
12665
|
var import_lucide_react6 = require("lucide-react");
|
|
13217
|
-
var
|
|
12666
|
+
var import_react52 = require("react");
|
|
13218
12667
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
13219
|
-
var SelectOptionDisplayContext = (0,
|
|
12668
|
+
var SelectOptionDisplayContext = (0, import_react52.createContext)(null);
|
|
13220
12669
|
function useSelectOptionDisplayLocation() {
|
|
13221
|
-
const context = (0,
|
|
12670
|
+
const context = (0, import_react52.useContext)(SelectOptionDisplayContext);
|
|
13222
12671
|
if (!context) {
|
|
13223
12672
|
throw new Error("useSelectOptionDisplayLocation must be used within a SelectOptionDisplayContext");
|
|
13224
12673
|
}
|
|
13225
12674
|
return context;
|
|
13226
12675
|
}
|
|
13227
|
-
var SelectOption = (0,
|
|
12676
|
+
var SelectOption = (0, import_react52.forwardRef)(function SelectOption2({
|
|
13228
12677
|
children,
|
|
13229
12678
|
label,
|
|
13230
12679
|
value,
|
|
@@ -13234,12 +12683,12 @@ var SelectOption = (0, import_react63.forwardRef)(function SelectOption2({
|
|
|
13234
12683
|
}, ref) {
|
|
13235
12684
|
const context = useSelectContext();
|
|
13236
12685
|
const { registerOption } = context;
|
|
13237
|
-
const itemRef = (0,
|
|
12686
|
+
const itemRef = (0, import_react52.useRef)(null);
|
|
13238
12687
|
const display = children ?? label;
|
|
13239
12688
|
const iconAppearanceResolved = iconAppearance ?? context.config.iconAppearance;
|
|
13240
|
-
const generatedId = (0,
|
|
12689
|
+
const generatedId = (0, import_react52.useId)();
|
|
13241
12690
|
const optionId = props?.id ?? "select-option-" + generatedId;
|
|
13242
|
-
(0,
|
|
12691
|
+
(0, import_react52.useEffect)(() => {
|
|
13243
12692
|
return registerOption({
|
|
13244
12693
|
id: optionId,
|
|
13245
12694
|
value,
|
|
@@ -13307,7 +12756,7 @@ var SelectOption = (0, import_react63.forwardRef)(function SelectOption2({
|
|
|
13307
12756
|
|
|
13308
12757
|
// src/components/user-interaction/Select/SelectButton.tsx
|
|
13309
12758
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
13310
|
-
var SelectButton = (0,
|
|
12759
|
+
var SelectButton = (0, import_react53.forwardRef)(
|
|
13311
12760
|
function SelectButton2({
|
|
13312
12761
|
id,
|
|
13313
12762
|
placeholder,
|
|
@@ -13321,12 +12770,12 @@ var SelectButton = (0, import_react64.forwardRef)(
|
|
|
13321
12770
|
const { config, layout } = context;
|
|
13322
12771
|
const { setIds } = config;
|
|
13323
12772
|
const { registerTrigger } = layout;
|
|
13324
|
-
(0,
|
|
12773
|
+
(0, import_react53.useEffect)(() => {
|
|
13325
12774
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
13326
12775
|
}, [id, setIds]);
|
|
13327
|
-
const innerRef = (0,
|
|
13328
|
-
(0,
|
|
13329
|
-
(0,
|
|
12776
|
+
const innerRef = (0, import_react53.useRef)(null);
|
|
12777
|
+
(0, import_react53.useImperativeHandle)(ref, () => innerRef.current);
|
|
12778
|
+
(0, import_react53.useEffect)(() => {
|
|
13330
12779
|
const unregister = registerTrigger(innerRef);
|
|
13331
12780
|
return () => unregister();
|
|
13332
12781
|
}, [registerTrigger]);
|
|
@@ -13387,13 +12836,38 @@ var SelectButton = (0, import_react64.forwardRef)(
|
|
|
13387
12836
|
);
|
|
13388
12837
|
|
|
13389
12838
|
// src/components/user-interaction/Select/SelectContent.tsx
|
|
13390
|
-
var
|
|
12839
|
+
var import_react56 = require("react");
|
|
13391
12840
|
var import_clsx10 = __toESM(require("clsx"));
|
|
13392
12841
|
|
|
13393
12842
|
// src/components/layout/popup/PopUp.tsx
|
|
13394
|
-
var
|
|
12843
|
+
var import_react55 = require("react");
|
|
12844
|
+
|
|
12845
|
+
// src/hooks/useOutsideClick.ts
|
|
12846
|
+
var import_react54 = require("react");
|
|
12847
|
+
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12848
|
+
(0, import_react54.useEffect)(() => {
|
|
12849
|
+
if (!active) return;
|
|
12850
|
+
const listener = (event) => {
|
|
12851
|
+
if (event.target === null) return;
|
|
12852
|
+
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
12853
|
+
return;
|
|
12854
|
+
}
|
|
12855
|
+
onOutsideClick(event);
|
|
12856
|
+
};
|
|
12857
|
+
document.addEventListener("mousedown", listener);
|
|
12858
|
+
document.addEventListener("touchstart", listener);
|
|
12859
|
+
document.addEventListener("pointerdown", listener);
|
|
12860
|
+
return () => {
|
|
12861
|
+
document.removeEventListener("mousedown", listener);
|
|
12862
|
+
document.removeEventListener("touchstart", listener);
|
|
12863
|
+
document.removeEventListener("pointerdown", listener);
|
|
12864
|
+
};
|
|
12865
|
+
}, [refs, onOutsideClick, active]);
|
|
12866
|
+
};
|
|
12867
|
+
|
|
12868
|
+
// src/components/layout/popup/PopUp.tsx
|
|
13395
12869
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
13396
|
-
var PopUp = (0,
|
|
12870
|
+
var PopUp = (0, import_react55.forwardRef)(function PopUp2({
|
|
13397
12871
|
children,
|
|
13398
12872
|
isOpen: isOpenOverwrite,
|
|
13399
12873
|
focusTrapOptions,
|
|
@@ -13404,24 +12878,24 @@ var PopUp = (0, import_react65.forwardRef)(function PopUp2({
|
|
|
13404
12878
|
forceMount = false,
|
|
13405
12879
|
anchorExcludedFromOutsideClick = false,
|
|
13406
12880
|
...props
|
|
13407
|
-
},
|
|
13408
|
-
const context = (0,
|
|
12881
|
+
}, forwardRef34) {
|
|
12882
|
+
const context = (0, import_react55.useContext)(PopUpContext);
|
|
13409
12883
|
const isOpen = isOpenOverwrite ?? context?.isOpen ?? false;
|
|
13410
12884
|
const anchor = anchorOverwrite ?? context?.triggerRef ?? void 0;
|
|
13411
12885
|
const id = props.id ?? context?.popUpId;
|
|
13412
12886
|
const { refAssignment, isPresent, ref } = usePresenceRef({ isOpen });
|
|
13413
|
-
(0,
|
|
12887
|
+
(0, import_react55.useImperativeHandle)(forwardRef34, () => ref.current, [ref]);
|
|
13414
12888
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
13415
12889
|
const onOutsideClickStable = useEventCallbackStabilizer(onOutsideClick);
|
|
13416
|
-
const onCloseWrapper = (0,
|
|
12890
|
+
const onCloseWrapper = (0, import_react55.useCallback)(() => {
|
|
13417
12891
|
onCloseStable();
|
|
13418
12892
|
context?.setIsOpen(false);
|
|
13419
12893
|
}, [onCloseStable, context]);
|
|
13420
|
-
const { zIndex, tagPositions } = useOverlayRegistry({ isActive: isOpen, tags: (0,
|
|
12894
|
+
const { zIndex, tagPositions } = useOverlayRegistry({ isActive: isOpen, tags: (0, import_react55.useMemo)(() => ["popup"], []) });
|
|
13421
12895
|
const isInFront = tagPositions?.["popup"] === 0;
|
|
13422
12896
|
const isOutsideClickActive = isOpen && isInFront && (outsideClickOptions?.active ?? true);
|
|
13423
12897
|
useOutsideClick({
|
|
13424
|
-
onOutsideClick: (0,
|
|
12898
|
+
onOutsideClick: (0, import_react55.useCallback)((event) => {
|
|
13425
12899
|
if (event.defaultPrevented) return;
|
|
13426
12900
|
onCloseWrapper();
|
|
13427
12901
|
onOutsideClickStable(event);
|
|
@@ -13459,7 +12933,7 @@ var PopUp = (0, import_react65.forwardRef)(function PopUp2({
|
|
|
13459
12933
|
|
|
13460
12934
|
// src/components/user-interaction/Select/SelectContent.tsx
|
|
13461
12935
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
13462
|
-
var SelectContent = (0,
|
|
12936
|
+
var SelectContent = (0, import_react56.forwardRef)(function SelectContent2({
|
|
13463
12937
|
id,
|
|
13464
12938
|
options,
|
|
13465
12939
|
showSearch: showSearchOverride,
|
|
@@ -13467,18 +12941,18 @@ var SelectContent = (0, import_react66.forwardRef)(function SelectContent2({
|
|
|
13467
12941
|
...props
|
|
13468
12942
|
}, ref) {
|
|
13469
12943
|
const translation = useHightideTranslation();
|
|
13470
|
-
const innerRef = (0,
|
|
13471
|
-
const searchInputRef = (0,
|
|
13472
|
-
(0,
|
|
12944
|
+
const innerRef = (0, import_react56.useRef)(null);
|
|
12945
|
+
const searchInputRef = (0, import_react56.useRef)(null);
|
|
12946
|
+
(0, import_react56.useImperativeHandle)(ref, () => innerRef.current);
|
|
13473
12947
|
const context = useSelectContext();
|
|
13474
12948
|
const { config, handleTypeaheadKey, toggleSelection, highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId } = context;
|
|
13475
12949
|
const { setIds } = config;
|
|
13476
|
-
(0,
|
|
12950
|
+
(0, import_react56.useEffect)(() => {
|
|
13477
12951
|
if (id) setIds((prev) => ({ ...prev, content: id }));
|
|
13478
12952
|
}, [id, setIds]);
|
|
13479
12953
|
const showSearch = showSearchOverride ?? context.search.hasSearch;
|
|
13480
12954
|
const listboxAriaLabel = showSearch ? translation("searchResults") : void 0;
|
|
13481
|
-
const keyHandler = (0,
|
|
12955
|
+
const keyHandler = (0, import_react56.useCallback)(
|
|
13482
12956
|
(event) => {
|
|
13483
12957
|
switch (event.key) {
|
|
13484
12958
|
case "ArrowDown":
|
|
@@ -13587,7 +13061,7 @@ var SelectContent = (0, import_react66.forwardRef)(function SelectContent2({
|
|
|
13587
13061
|
|
|
13588
13062
|
// src/components/user-interaction/Select/Select.tsx
|
|
13589
13063
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
13590
|
-
var Select = (0,
|
|
13064
|
+
var Select = (0, import_react57.forwardRef)(function Select2({ children, contentPanelProps, buttonProps, ...props }, ref) {
|
|
13591
13065
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(SelectRoot, { ...props, children: [
|
|
13592
13066
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
13593
13067
|
SelectButton,
|
|
@@ -13654,13 +13128,13 @@ var import_lucide_react7 = require("lucide-react");
|
|
|
13654
13128
|
var import_clsx12 = __toESM(require("clsx"));
|
|
13655
13129
|
|
|
13656
13130
|
// src/global-contexts/ThemeContext.tsx
|
|
13657
|
-
var
|
|
13131
|
+
var import_react58 = require("react");
|
|
13658
13132
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
13659
13133
|
var themes = ["light", "dark", "system"];
|
|
13660
13134
|
var ThemeUtil = {
|
|
13661
13135
|
themes
|
|
13662
13136
|
};
|
|
13663
|
-
var ThemeContext = (0,
|
|
13137
|
+
var ThemeContext = (0, import_react58.createContext)(null);
|
|
13664
13138
|
var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
13665
13139
|
const {
|
|
13666
13140
|
value: storedTheme,
|
|
@@ -13668,8 +13142,8 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13668
13142
|
deleteValue: deleteStoredTheme
|
|
13669
13143
|
} = useStorage({ key: "theme", defaultValue: "system" });
|
|
13670
13144
|
const { config } = useHightideConfig();
|
|
13671
|
-
const [themePreference, setThemePreference] = (0,
|
|
13672
|
-
const resolvedTheme = (0,
|
|
13145
|
+
const [themePreference, setThemePreference] = (0, import_react58.useState)("system");
|
|
13146
|
+
const resolvedTheme = (0, import_react58.useMemo)(() => {
|
|
13673
13147
|
if (theme && theme !== "system") {
|
|
13674
13148
|
return theme;
|
|
13675
13149
|
}
|
|
@@ -13681,7 +13155,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13681
13155
|
}
|
|
13682
13156
|
return initialTheme ?? config.theme.initialTheme;
|
|
13683
13157
|
}, [config.theme.initialTheme, initialTheme, storedTheme, theme, themePreference]);
|
|
13684
|
-
(0,
|
|
13158
|
+
(0, import_react58.useEffect)(() => {
|
|
13685
13159
|
if (!theme) return;
|
|
13686
13160
|
if (theme === "system") {
|
|
13687
13161
|
deleteStoredTheme();
|
|
@@ -13689,18 +13163,18 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13689
13163
|
setStoredTheme(theme);
|
|
13690
13164
|
}
|
|
13691
13165
|
}, [theme, deleteStoredTheme, setStoredTheme]);
|
|
13692
|
-
(0,
|
|
13166
|
+
(0, import_react58.useEffect)(() => {
|
|
13693
13167
|
document.documentElement.setAttribute("data-theme", resolvedTheme);
|
|
13694
13168
|
}, [resolvedTheme]);
|
|
13695
|
-
const getPreference = (0,
|
|
13169
|
+
const getPreference = (0, import_react58.useCallback)(() => {
|
|
13696
13170
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
13697
13171
|
const prefersLight = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
13698
13172
|
setThemePreference(prefersDark ? "dark" : prefersLight ? "light" : "system");
|
|
13699
13173
|
}, []);
|
|
13700
|
-
(0,
|
|
13174
|
+
(0, import_react58.useEffect)(() => {
|
|
13701
13175
|
getPreference();
|
|
13702
13176
|
}, [getPreference]);
|
|
13703
|
-
(0,
|
|
13177
|
+
(0, import_react58.useEffect)(() => {
|
|
13704
13178
|
const darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
13705
13179
|
const lightQuery = window.matchMedia("(prefers-color-scheme: light)");
|
|
13706
13180
|
const noPrefQuery = window.matchMedia("(prefers-color-scheme: no-preference)");
|
|
@@ -13731,7 +13205,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
13731
13205
|
);
|
|
13732
13206
|
};
|
|
13733
13207
|
var useTheme = () => {
|
|
13734
|
-
const context = (0,
|
|
13208
|
+
const context = (0, import_react58.useContext)(ThemeContext);
|
|
13735
13209
|
if (!context) {
|
|
13736
13210
|
throw new Error("useTheme must be used within ThemeContext. Try adding a ThemeProvider around your app.");
|
|
13737
13211
|
}
|
|
@@ -13811,16 +13285,16 @@ var ThemeDialog = ({
|
|
|
13811
13285
|
};
|
|
13812
13286
|
|
|
13813
13287
|
// src/components/layout/drawer/Drawer.tsx
|
|
13814
|
-
var
|
|
13288
|
+
var import_react61 = require("react");
|
|
13815
13289
|
|
|
13816
13290
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
13817
|
-
var
|
|
13291
|
+
var import_react60 = require("react");
|
|
13818
13292
|
|
|
13819
13293
|
// src/components/layout/drawer/DrawerContext.tsx
|
|
13820
|
-
var
|
|
13821
|
-
var DrawerContext = (0,
|
|
13294
|
+
var import_react59 = require("react");
|
|
13295
|
+
var DrawerContext = (0, import_react59.createContext)(null);
|
|
13822
13296
|
function useDrawerContext() {
|
|
13823
|
-
const context = (0,
|
|
13297
|
+
const context = (0, import_react59.useContext)(DrawerContext);
|
|
13824
13298
|
if (!context) {
|
|
13825
13299
|
throw new Error("useDrawerContext must be used within a <DrawerRoot>");
|
|
13826
13300
|
}
|
|
@@ -13829,7 +13303,7 @@ function useDrawerContext() {
|
|
|
13829
13303
|
|
|
13830
13304
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
13831
13305
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
13832
|
-
var DrawerContent = (0,
|
|
13306
|
+
var DrawerContent = (0, import_react60.forwardRef)(function DrawerContent2({
|
|
13833
13307
|
children,
|
|
13834
13308
|
alignment = "left",
|
|
13835
13309
|
containerClassName,
|
|
@@ -13838,14 +13312,14 @@ var DrawerContent = (0, import_react70.forwardRef)(function DrawerContent2({
|
|
|
13838
13312
|
...props
|
|
13839
13313
|
}, forwardedRef) {
|
|
13840
13314
|
const { isOpen } = useDrawerContext();
|
|
13841
|
-
const generatedId = (0,
|
|
13842
|
-
const ids = (0,
|
|
13315
|
+
const generatedId = (0, import_react60.useId)();
|
|
13316
|
+
const ids = (0, import_react60.useMemo)(() => ({
|
|
13843
13317
|
container: `dialog-container-${generatedId}`,
|
|
13844
13318
|
background: `dialog-background-${generatedId}`,
|
|
13845
13319
|
content: props.id ?? `dialog-content-${generatedId}`
|
|
13846
13320
|
}), [generatedId, props.id]);
|
|
13847
|
-
const ref = (0,
|
|
13848
|
-
(0,
|
|
13321
|
+
const ref = (0, import_react60.useRef)(null);
|
|
13322
|
+
(0, import_react60.useImperativeHandle)(forwardedRef, () => ref.current, [ref]);
|
|
13849
13323
|
const { isVisible, transitionState } = useTransitionState({ isOpen, ref });
|
|
13850
13324
|
useFocusTrap({
|
|
13851
13325
|
container: ref,
|
|
@@ -13853,7 +13327,7 @@ var DrawerContent = (0, import_react70.forwardRef)(function DrawerContent2({
|
|
|
13853
13327
|
});
|
|
13854
13328
|
const { zIndex, tagPositions, tagItemCounts } = useOverlayRegistry({
|
|
13855
13329
|
isActive: isVisible,
|
|
13856
|
-
tags: (0,
|
|
13330
|
+
tags: (0, import_react60.useMemo)(() => ["drawer"], [])
|
|
13857
13331
|
});
|
|
13858
13332
|
const depth = tagPositions && tagItemCounts ? (tagItemCounts["drawer"] ?? 0) - (tagPositions["drawer"] ?? 0) : 0;
|
|
13859
13333
|
const { setOpen } = useDrawerContext();
|
|
@@ -13948,7 +13422,7 @@ function DrawerRoot({
|
|
|
13948
13422
|
|
|
13949
13423
|
// src/components/layout/drawer/Drawer.tsx
|
|
13950
13424
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
13951
|
-
var Drawer = (0,
|
|
13425
|
+
var Drawer = (0, import_react61.forwardRef)(function Drawer2({
|
|
13952
13426
|
children,
|
|
13953
13427
|
isOpen = true,
|
|
13954
13428
|
alignment = "left",
|
|
@@ -14006,7 +13480,7 @@ var ErrorComponent = ({
|
|
|
14006
13480
|
};
|
|
14007
13481
|
|
|
14008
13482
|
// src/components/layout/loading/LoadingAndErrorComponent.tsx
|
|
14009
|
-
var
|
|
13483
|
+
var import_react62 = require("react");
|
|
14010
13484
|
|
|
14011
13485
|
// src/components/layout/loading/LoadingContainer.tsx
|
|
14012
13486
|
var import_clsx14 = require("clsx");
|
|
@@ -14027,8 +13501,8 @@ var LoadingAndErrorComponent = ({
|
|
|
14027
13501
|
minimumLoadingDuration = 200,
|
|
14028
13502
|
className
|
|
14029
13503
|
}) => {
|
|
14030
|
-
const [isInMinimumLoading, setIsInMinimumLoading] = (0,
|
|
14031
|
-
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = (0,
|
|
13504
|
+
const [isInMinimumLoading, setIsInMinimumLoading] = (0, import_react62.useState)(false);
|
|
13505
|
+
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = (0, import_react62.useState)(false);
|
|
14032
13506
|
if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {
|
|
14033
13507
|
setIsInMinimumLoading(true);
|
|
14034
13508
|
setTimeout(() => {
|
|
@@ -14091,8 +13565,8 @@ var BreadCrumbs = ({ crumbs }) => {
|
|
|
14091
13565
|
|
|
14092
13566
|
// src/components/layout/navigation/Navigation.tsx
|
|
14093
13567
|
var import_lucide_react10 = require("lucide-react");
|
|
14094
|
-
var
|
|
14095
|
-
var
|
|
13568
|
+
var import_react63 = require("react");
|
|
13569
|
+
var import_react64 = require("react");
|
|
14096
13570
|
var import_link2 = __toESM(require_link2());
|
|
14097
13571
|
var import_clsx17 = __toESM(require("clsx"));
|
|
14098
13572
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
@@ -14105,10 +13579,10 @@ var NavigationItemWithSubItem = ({
|
|
|
14105
13579
|
horizontalAlignment = "center",
|
|
14106
13580
|
...options
|
|
14107
13581
|
}) => {
|
|
14108
|
-
const [isOpen, setOpen] = (0,
|
|
14109
|
-
const containerRef = (0,
|
|
14110
|
-
const triggerRef = (0,
|
|
14111
|
-
const id = (0,
|
|
13582
|
+
const [isOpen, setOpen] = (0, import_react64.useState)(false);
|
|
13583
|
+
const containerRef = (0, import_react64.useRef)(null);
|
|
13584
|
+
const triggerRef = (0, import_react64.useRef)(null);
|
|
13585
|
+
const id = (0, import_react64.useId)();
|
|
14112
13586
|
const style = useAnchoredPosition({
|
|
14113
13587
|
active: isOpen,
|
|
14114
13588
|
container: containerRef,
|
|
@@ -14116,7 +13590,7 @@ var NavigationItemWithSubItem = ({
|
|
|
14116
13590
|
horizontalAlignment,
|
|
14117
13591
|
...options
|
|
14118
13592
|
});
|
|
14119
|
-
const onBlur = (0,
|
|
13593
|
+
const onBlur = (0, import_react64.useCallback)((event) => {
|
|
14120
13594
|
const nextFocus = event.relatedTarget;
|
|
14121
13595
|
if (!containerRef.current?.contains(nextFocus) && !triggerRef.current?.contains(nextFocus)) {
|
|
14122
13596
|
setOpen(false);
|
|
@@ -14182,10 +13656,10 @@ var NavigationItemList = ({ items, ...restProps }) => {
|
|
|
14182
13656
|
};
|
|
14183
13657
|
var Navigation = ({ ...props }) => {
|
|
14184
13658
|
const translation = useHightideTranslation();
|
|
14185
|
-
const [isMobileOpen, setIsMobileOpen] = (0,
|
|
14186
|
-
const id = (0,
|
|
14187
|
-
const menuRef = (0,
|
|
14188
|
-
(0,
|
|
13659
|
+
const [isMobileOpen, setIsMobileOpen] = (0, import_react64.useState)(false);
|
|
13660
|
+
const id = (0, import_react64.useId)();
|
|
13661
|
+
const menuRef = (0, import_react64.useRef)(null);
|
|
13662
|
+
(0, import_react63.useEffect)(() => {
|
|
14189
13663
|
menuRef.current?.focus();
|
|
14190
13664
|
}, [isMobileOpen]);
|
|
14191
13665
|
const { zIndex } = useOverlayRegistry({ isActive: isMobileOpen });
|
|
@@ -14253,7 +13727,7 @@ var Navigation = ({ ...props }) => {
|
|
|
14253
13727
|
// src/components/layout/navigation/Pagination.tsx
|
|
14254
13728
|
var import_lucide_react11 = require("lucide-react");
|
|
14255
13729
|
var import_clsx18 = __toESM(require("clsx"));
|
|
14256
|
-
var
|
|
13730
|
+
var import_react65 = require("react");
|
|
14257
13731
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
14258
13732
|
var Pagination = ({
|
|
14259
13733
|
pageIndex,
|
|
@@ -14262,11 +13736,11 @@ var Pagination = ({
|
|
|
14262
13736
|
...props
|
|
14263
13737
|
}) => {
|
|
14264
13738
|
const translation = useHightideTranslation();
|
|
14265
|
-
const [value, setValue] = (0,
|
|
13739
|
+
const [value, setValue] = (0, import_react65.useState)((pageIndex + 1).toString());
|
|
14266
13740
|
const noPages = pageCount === 0;
|
|
14267
13741
|
const onFirstPage = pageIndex === 0 && !noPages;
|
|
14268
13742
|
const onLastPage = pageIndex === pageCount - 1;
|
|
14269
|
-
(0,
|
|
13743
|
+
(0, import_react65.useEffect)(() => {
|
|
14270
13744
|
if (noPages) {
|
|
14271
13745
|
setValue("0");
|
|
14272
13746
|
} else {
|
|
@@ -14460,18 +13934,18 @@ var StepperBar = ({
|
|
|
14460
13934
|
};
|
|
14461
13935
|
|
|
14462
13936
|
// src/components/layout/popup/PopUpOpener.tsx
|
|
14463
|
-
var
|
|
13937
|
+
var import_react66 = require("react");
|
|
14464
13938
|
function PopUpOpener({ children }) {
|
|
14465
13939
|
const context = usePopUpContext();
|
|
14466
13940
|
const { setTriggerRef } = context;
|
|
14467
|
-
const ref = (0,
|
|
14468
|
-
(0,
|
|
13941
|
+
const ref = (0, import_react66.useRef)(null);
|
|
13942
|
+
(0, import_react66.useEffect)(() => {
|
|
14469
13943
|
setTriggerRef(ref);
|
|
14470
13944
|
return () => {
|
|
14471
13945
|
setTriggerRef(null);
|
|
14472
13946
|
};
|
|
14473
13947
|
}, [setTriggerRef]);
|
|
14474
|
-
const bag = (0,
|
|
13948
|
+
const bag = (0, import_react66.useMemo)(() => ({
|
|
14475
13949
|
open: () => context.setIsOpen(true),
|
|
14476
13950
|
close: () => context.setIsOpen(false),
|
|
14477
13951
|
toggleOpen: () => context.setIsOpen((prev) => !prev),
|
|
@@ -14489,7 +13963,7 @@ function PopUpOpener({ children }) {
|
|
|
14489
13963
|
}
|
|
14490
13964
|
|
|
14491
13965
|
// src/components/layout/popup/PopUpRoot.tsx
|
|
14492
|
-
var
|
|
13966
|
+
var import_react67 = require("react");
|
|
14493
13967
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
14494
13968
|
function PopUpRoot({
|
|
14495
13969
|
children,
|
|
@@ -14499,17 +13973,17 @@ function PopUpRoot({
|
|
|
14499
13973
|
popUpId: popUpIdOverwrite,
|
|
14500
13974
|
triggerId: triggerIdOverwrite
|
|
14501
13975
|
}) {
|
|
14502
|
-
const generatedPopUpId = (0,
|
|
14503
|
-
const generatedTriggerId = (0,
|
|
13976
|
+
const generatedPopUpId = (0, import_react67.useId)();
|
|
13977
|
+
const generatedTriggerId = (0, import_react67.useId)();
|
|
14504
13978
|
const [isOpen, setIsOpen] = useControlledState({
|
|
14505
13979
|
value: controlledIsOpen,
|
|
14506
13980
|
onValueChange: onIsOpenChange,
|
|
14507
13981
|
defaultValue: initialIsOpen
|
|
14508
13982
|
});
|
|
14509
|
-
const [triggerRef, setTriggerRef] = (0,
|
|
14510
|
-
const popUpId = (0,
|
|
14511
|
-
const triggerId = (0,
|
|
14512
|
-
const contextValue = (0,
|
|
13983
|
+
const [triggerRef, setTriggerRef] = (0, import_react67.useState)(null);
|
|
13984
|
+
const popUpId = (0, import_react67.useMemo)(() => popUpIdOverwrite ?? `pop-up-${generatedPopUpId}`, [popUpIdOverwrite, generatedPopUpId]);
|
|
13985
|
+
const triggerId = (0, import_react67.useMemo)(() => triggerIdOverwrite ?? `pop-up-trigger-${generatedTriggerId}`, [triggerIdOverwrite, generatedTriggerId]);
|
|
13986
|
+
const contextValue = (0, import_react67.useMemo)(() => ({
|
|
14513
13987
|
isOpen,
|
|
14514
13988
|
setIsOpen,
|
|
14515
13989
|
popUpId,
|
|
@@ -14696,31 +14170,31 @@ var FillerCell = ({ ...props }) => {
|
|
|
14696
14170
|
};
|
|
14697
14171
|
|
|
14698
14172
|
// src/components/layout/table/TableProvider.tsx
|
|
14699
|
-
var
|
|
14173
|
+
var import_react70 = require("react");
|
|
14700
14174
|
|
|
14701
14175
|
// src/components/layout/table/TableContext.tsx
|
|
14702
|
-
var
|
|
14703
|
-
var TableStateWithoutSizingContext = (0,
|
|
14176
|
+
var import_react68 = require("react");
|
|
14177
|
+
var TableStateWithoutSizingContext = (0, import_react68.createContext)(null);
|
|
14704
14178
|
var useTableStateWithoutSizingContext = () => {
|
|
14705
|
-
const context = (0,
|
|
14179
|
+
const context = (0, import_react68.useContext)(TableStateWithoutSizingContext);
|
|
14706
14180
|
if (!context) throw new Error("useTableStateWithoutSizingContext must be used within a <TableStateWithoutSizingContext.Provider> like <TableStateWithoutSizing>");
|
|
14707
14181
|
return context;
|
|
14708
14182
|
};
|
|
14709
|
-
var TableStateContext = (0,
|
|
14183
|
+
var TableStateContext = (0, import_react68.createContext)(null);
|
|
14710
14184
|
var useTableStateContext = () => {
|
|
14711
|
-
const context = (0,
|
|
14185
|
+
const context = (0, import_react68.useContext)(TableStateContext);
|
|
14712
14186
|
if (!context) throw new Error("useTableStateContext must be used within a <TableStateContext.Provider> like <TableState>");
|
|
14713
14187
|
return context;
|
|
14714
14188
|
};
|
|
14715
|
-
var TableContainerContext = (0,
|
|
14189
|
+
var TableContainerContext = (0, import_react68.createContext)(null);
|
|
14716
14190
|
var useTableContainerContext = () => {
|
|
14717
|
-
const context = (0,
|
|
14191
|
+
const context = (0, import_react68.useContext)(TableContainerContext);
|
|
14718
14192
|
if (!context) throw new Error("useTableContainerContext must be used within a <TableContainerContext.Provider> like <TableContainer>");
|
|
14719
14193
|
return context;
|
|
14720
14194
|
};
|
|
14721
|
-
var TableColumnDefinitionContext = (0,
|
|
14195
|
+
var TableColumnDefinitionContext = (0, import_react68.createContext)(null);
|
|
14722
14196
|
var useTableColumnDefinitionContext = () => {
|
|
14723
|
-
const context = (0,
|
|
14197
|
+
const context = (0, import_react68.useContext)(TableColumnDefinitionContext);
|
|
14724
14198
|
if (!context) throw new Error("useTableColumnDefinitionContext must be used within a <TableColumnDefinitionContext.Provider> like <TableColumnDefinition>");
|
|
14725
14199
|
return context;
|
|
14726
14200
|
};
|
|
@@ -14899,7 +14373,254 @@ var FilterOperatorUtils = {
|
|
|
14899
14373
|
};
|
|
14900
14374
|
|
|
14901
14375
|
// src/components/user-interaction/data/filter-function.ts
|
|
14902
|
-
var
|
|
14376
|
+
var import_react69 = require("react");
|
|
14377
|
+
|
|
14378
|
+
// src/utils/date.ts
|
|
14379
|
+
var timesInSeconds = {
|
|
14380
|
+
second: 1,
|
|
14381
|
+
minute: 60,
|
|
14382
|
+
hour: 3600,
|
|
14383
|
+
day: 86400,
|
|
14384
|
+
week: 604800,
|
|
14385
|
+
monthImprecise: 2629800,
|
|
14386
|
+
// 30.4375 days
|
|
14387
|
+
yearImprecise: 31557600
|
|
14388
|
+
// 365.25 days
|
|
14389
|
+
};
|
|
14390
|
+
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14391
|
+
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14392
|
+
var changeDuration = (date, duration, isAdding) => {
|
|
14393
|
+
const {
|
|
14394
|
+
years = 0,
|
|
14395
|
+
months = 0,
|
|
14396
|
+
days = 0,
|
|
14397
|
+
hours = 0,
|
|
14398
|
+
minutes = 0,
|
|
14399
|
+
seconds = 0,
|
|
14400
|
+
milliseconds = 0
|
|
14401
|
+
} = duration;
|
|
14402
|
+
if (years < 0) {
|
|
14403
|
+
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14404
|
+
return new Date(date);
|
|
14405
|
+
}
|
|
14406
|
+
if (months < 0 || months > 11) {
|
|
14407
|
+
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14408
|
+
return new Date(date);
|
|
14409
|
+
}
|
|
14410
|
+
if (days < 0) {
|
|
14411
|
+
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14412
|
+
return new Date(date);
|
|
14413
|
+
}
|
|
14414
|
+
if (hours < 0 || hours > 23) {
|
|
14415
|
+
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14416
|
+
return new Date(date);
|
|
14417
|
+
}
|
|
14418
|
+
if (minutes < 0 || minutes > 59) {
|
|
14419
|
+
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14420
|
+
return new Date(date);
|
|
14421
|
+
}
|
|
14422
|
+
if (seconds < 0 || seconds > 59) {
|
|
14423
|
+
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14424
|
+
return new Date(date);
|
|
14425
|
+
}
|
|
14426
|
+
if (milliseconds < 0) {
|
|
14427
|
+
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14428
|
+
return new Date(date);
|
|
14429
|
+
}
|
|
14430
|
+
const multiplier = isAdding ? 1 : -1;
|
|
14431
|
+
const newDate = new Date(date);
|
|
14432
|
+
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14433
|
+
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14434
|
+
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14435
|
+
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14436
|
+
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14437
|
+
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14438
|
+
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14439
|
+
return newDate;
|
|
14440
|
+
};
|
|
14441
|
+
var addDuration = (date, duration) => {
|
|
14442
|
+
return changeDuration(date, duration, true);
|
|
14443
|
+
};
|
|
14444
|
+
var subtractDuration = (date, duration) => {
|
|
14445
|
+
return changeDuration(date, duration, false);
|
|
14446
|
+
};
|
|
14447
|
+
var between = (value, startDate, endDate) => {
|
|
14448
|
+
if (startDate && endDate) {
|
|
14449
|
+
console.assert(startDate <= endDate);
|
|
14450
|
+
return startDate <= value && value <= endDate;
|
|
14451
|
+
} else if (startDate) {
|
|
14452
|
+
return startDate <= value;
|
|
14453
|
+
} else if (endDate) {
|
|
14454
|
+
return endDate >= value;
|
|
14455
|
+
} else {
|
|
14456
|
+
return true;
|
|
14457
|
+
}
|
|
14458
|
+
};
|
|
14459
|
+
var equalDate = (date1, date2) => {
|
|
14460
|
+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14461
|
+
};
|
|
14462
|
+
var isLastMillisecondOfDay = (date) => {
|
|
14463
|
+
const next = new Date(date.getTime() + 1);
|
|
14464
|
+
return !equalDate(date, next);
|
|
14465
|
+
};
|
|
14466
|
+
var sameTime = (a, b, compareSeconds = false, compareMilliseconds = false) => {
|
|
14467
|
+
if (a.getHours() !== b.getHours() || a.getMinutes() !== b.getMinutes()) {
|
|
14468
|
+
return false;
|
|
14469
|
+
}
|
|
14470
|
+
if (compareSeconds && a.getSeconds() !== b.getSeconds()) {
|
|
14471
|
+
return false;
|
|
14472
|
+
}
|
|
14473
|
+
if (compareMilliseconds && a.getMilliseconds() !== b.getMilliseconds()) {
|
|
14474
|
+
return false;
|
|
14475
|
+
}
|
|
14476
|
+
return true;
|
|
14477
|
+
};
|
|
14478
|
+
var withTime = (datePart, timePart) => {
|
|
14479
|
+
const out = new Date(datePart);
|
|
14480
|
+
out.setHours(
|
|
14481
|
+
timePart.getHours(),
|
|
14482
|
+
timePart.getMinutes(),
|
|
14483
|
+
timePart.getSeconds(),
|
|
14484
|
+
timePart.getMilliseconds()
|
|
14485
|
+
);
|
|
14486
|
+
return out;
|
|
14487
|
+
};
|
|
14488
|
+
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14489
|
+
const month = date.getMonth();
|
|
14490
|
+
const year = date.getFullYear();
|
|
14491
|
+
const dayList = [];
|
|
14492
|
+
let currentDate = new Date(year, month, 1);
|
|
14493
|
+
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14494
|
+
while (currentDate.getDay() !== weekStartIndex) {
|
|
14495
|
+
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14496
|
+
}
|
|
14497
|
+
while (dayList.length < 7 * weeks) {
|
|
14498
|
+
const date2 = new Date(currentDate);
|
|
14499
|
+
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14500
|
+
dayList.push(date2);
|
|
14501
|
+
currentDate = addDuration(currentDate, { days: 1 });
|
|
14502
|
+
}
|
|
14503
|
+
return equalSizeGroups(dayList, 7);
|
|
14504
|
+
};
|
|
14505
|
+
var formatAbsolute = (date, locale, format) => {
|
|
14506
|
+
let options;
|
|
14507
|
+
switch (format) {
|
|
14508
|
+
case "date":
|
|
14509
|
+
options = {
|
|
14510
|
+
year: "2-digit",
|
|
14511
|
+
month: "2-digit",
|
|
14512
|
+
day: "2-digit"
|
|
14513
|
+
};
|
|
14514
|
+
break;
|
|
14515
|
+
case "time":
|
|
14516
|
+
options = {
|
|
14517
|
+
hour: "2-digit",
|
|
14518
|
+
minute: "2-digit"
|
|
14519
|
+
};
|
|
14520
|
+
break;
|
|
14521
|
+
case "dateTime":
|
|
14522
|
+
options = {
|
|
14523
|
+
year: "numeric",
|
|
14524
|
+
month: "2-digit",
|
|
14525
|
+
day: "2-digit",
|
|
14526
|
+
hour: "2-digit",
|
|
14527
|
+
minute: "2-digit"
|
|
14528
|
+
};
|
|
14529
|
+
break;
|
|
14530
|
+
}
|
|
14531
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14532
|
+
};
|
|
14533
|
+
var formatRelative = (date, locale) => {
|
|
14534
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14535
|
+
const now = /* @__PURE__ */ new Date();
|
|
14536
|
+
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14537
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14538
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
14539
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
14540
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
14541
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
14542
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
14543
|
+
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
14544
|
+
};
|
|
14545
|
+
var toInputString = (date, format, precision = "minute", isLocalTime = true) => {
|
|
14546
|
+
const pad = (n, l = 2) => String(n).padStart(l, "0");
|
|
14547
|
+
const parts = isLocalTime ? {
|
|
14548
|
+
y: date.getFullYear(),
|
|
14549
|
+
m: date.getMonth() + 1,
|
|
14550
|
+
d: date.getDate(),
|
|
14551
|
+
h: date.getHours(),
|
|
14552
|
+
min: date.getMinutes(),
|
|
14553
|
+
s: date.getSeconds(),
|
|
14554
|
+
ms: date.getMilliseconds()
|
|
14555
|
+
} : {
|
|
14556
|
+
y: date.getUTCFullYear(),
|
|
14557
|
+
m: date.getUTCMonth() + 1,
|
|
14558
|
+
d: date.getUTCDate(),
|
|
14559
|
+
h: date.getUTCHours(),
|
|
14560
|
+
min: date.getUTCMinutes(),
|
|
14561
|
+
s: date.getUTCSeconds(),
|
|
14562
|
+
ms: date.getUTCMilliseconds()
|
|
14563
|
+
};
|
|
14564
|
+
const dateStr = `${pad(parts.y, 4)}-${pad(parts.m)}-${pad(parts.d)}`;
|
|
14565
|
+
let timeStr = `${pad(parts.h)}:${pad(parts.min)}`;
|
|
14566
|
+
if (precision === "second" || precision === "millisecond") {
|
|
14567
|
+
timeStr += `:${pad(parts.s)}`;
|
|
14568
|
+
}
|
|
14569
|
+
if (precision === "millisecond") {
|
|
14570
|
+
timeStr += `.${pad(parts.ms, 3)}`;
|
|
14571
|
+
}
|
|
14572
|
+
switch (format) {
|
|
14573
|
+
case "date":
|
|
14574
|
+
return dateStr;
|
|
14575
|
+
case "time":
|
|
14576
|
+
return timeStr;
|
|
14577
|
+
case "dateTime":
|
|
14578
|
+
return `${dateStr}T${timeStr}`;
|
|
14579
|
+
}
|
|
14580
|
+
};
|
|
14581
|
+
function tryParseDate(dateValue) {
|
|
14582
|
+
if (!dateValue) return null;
|
|
14583
|
+
if (dateValue instanceof Date) return dateValue;
|
|
14584
|
+
if (typeof dateValue === "string" || typeof dateValue === "number") {
|
|
14585
|
+
const parsed = new Date(dateValue);
|
|
14586
|
+
return isNaN(parsed.getTime()) ? null : parsed;
|
|
14587
|
+
}
|
|
14588
|
+
return null;
|
|
14589
|
+
}
|
|
14590
|
+
function normalizeToDateOnly(date) {
|
|
14591
|
+
const normalized = new Date(date);
|
|
14592
|
+
normalized.setHours(0, 0, 0, 0);
|
|
14593
|
+
return normalized;
|
|
14594
|
+
}
|
|
14595
|
+
function normalizeDatetime(dateTime) {
|
|
14596
|
+
const normalized = new Date(dateTime);
|
|
14597
|
+
normalized.setSeconds(0, 0);
|
|
14598
|
+
return normalized;
|
|
14599
|
+
}
|
|
14600
|
+
var DateUtils = {
|
|
14601
|
+
monthsList,
|
|
14602
|
+
weekDayList,
|
|
14603
|
+
equalDate,
|
|
14604
|
+
isLastMillisecondOfDay,
|
|
14605
|
+
sameTime,
|
|
14606
|
+
withTime,
|
|
14607
|
+
formatAbsolute,
|
|
14608
|
+
formatRelative,
|
|
14609
|
+
addDuration,
|
|
14610
|
+
subtractDuration,
|
|
14611
|
+
between,
|
|
14612
|
+
weeksForCalenderMonth,
|
|
14613
|
+
timesInSeconds,
|
|
14614
|
+
toInputString,
|
|
14615
|
+
tryParseDate,
|
|
14616
|
+
toOnlyDate: normalizeToDateOnly,
|
|
14617
|
+
/**
|
|
14618
|
+
* Normalizes a datetime by removing seconds and milliseconds.
|
|
14619
|
+
*/
|
|
14620
|
+
toDateTimeOnly: normalizeDatetime
|
|
14621
|
+
};
|
|
14622
|
+
|
|
14623
|
+
// src/components/user-interaction/data/filter-function.ts
|
|
14903
14624
|
var allowedOperatorsByDataType = {
|
|
14904
14625
|
text: ["equals", "notEquals", "contains", "notContains", "startsWith", "endsWith", "isUndefined", "isNotUndefined"],
|
|
14905
14626
|
number: ["equals", "notEquals", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "between", "notBetween", "isUndefined", "isNotUndefined"],
|
|
@@ -15252,7 +14973,7 @@ function tagToLabel(tags, value) {
|
|
|
15252
14973
|
function useFilterValueTranslation() {
|
|
15253
14974
|
const translation = useHightideTranslation();
|
|
15254
14975
|
const { locale } = useLocale();
|
|
15255
|
-
return (0,
|
|
14976
|
+
return (0, import_react69.useCallback)((value, options) => {
|
|
15256
14977
|
const p = value.parameter;
|
|
15257
14978
|
const tags = options?.tags;
|
|
15258
14979
|
const dateFormat = value.dataType === "dateTime" ? "dateTime" : "date";
|
|
@@ -15454,9 +15175,9 @@ var TableProvider = ({
|
|
|
15454
15175
|
}) => {
|
|
15455
15176
|
const onRowClickStable = useEventCallbackStabilizer(onRowClick);
|
|
15456
15177
|
const onFillerRowClickStable = useEventCallbackStabilizer(onFillerRowClick);
|
|
15457
|
-
const [registeredColumns, setRegisteredColumns] = (0,
|
|
15458
|
-
const containerRef = (0,
|
|
15459
|
-
const [, setTableState] = (0,
|
|
15178
|
+
const [registeredColumns, setRegisteredColumns] = (0, import_react70.useState)([]);
|
|
15179
|
+
const containerRef = (0, import_react70.useRef)(null);
|
|
15180
|
+
const [, setTableState] = (0, import_react70.useState)({
|
|
15460
15181
|
columnSizing: {},
|
|
15461
15182
|
columnOrder: [],
|
|
15462
15183
|
columnFilters: [],
|
|
@@ -15481,16 +15202,16 @@ var TableProvider = ({
|
|
|
15481
15202
|
pageSize: 10
|
|
15482
15203
|
}
|
|
15483
15204
|
});
|
|
15484
|
-
const [targetWidth, setTargetWidth] = (0,
|
|
15485
|
-
(0,
|
|
15205
|
+
const [targetWidth, setTargetWidth] = (0, import_react70.useState)(void 0);
|
|
15206
|
+
(0, import_react70.useLayoutEffect)(() => {
|
|
15486
15207
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
15487
15208
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
15488
15209
|
}, [containerRef]);
|
|
15489
|
-
useWindowResizeObserver((0,
|
|
15210
|
+
useWindowResizeObserver((0, import_react70.useCallback)(() => {
|
|
15490
15211
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
15491
15212
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
15492
15213
|
}, [containerRef]));
|
|
15493
|
-
const registerColumn = (0,
|
|
15214
|
+
const registerColumn = (0, import_react70.useCallback)((column) => {
|
|
15494
15215
|
setRegisteredColumns((prev) => {
|
|
15495
15216
|
return [...prev, column];
|
|
15496
15217
|
});
|
|
@@ -15500,7 +15221,7 @@ var TableProvider = ({
|
|
|
15500
15221
|
});
|
|
15501
15222
|
};
|
|
15502
15223
|
}, []);
|
|
15503
|
-
const columns = (0,
|
|
15224
|
+
const columns = (0, import_react70.useMemo)(() => {
|
|
15504
15225
|
const contextColumns = Array.from(registeredColumns.values());
|
|
15505
15226
|
if (columnsProp) {
|
|
15506
15227
|
return [...contextColumns, ...columnsProp];
|
|
@@ -15517,7 +15238,7 @@ var TableProvider = ({
|
|
|
15517
15238
|
defaultColumn: {
|
|
15518
15239
|
minSize: 60,
|
|
15519
15240
|
maxSize: 800,
|
|
15520
|
-
cell: (0,
|
|
15241
|
+
cell: (0, import_react70.useCallback)(({ cell }) => {
|
|
15521
15242
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TableCell, { children: String(cell.getValue()) });
|
|
15522
15243
|
}, []),
|
|
15523
15244
|
enableResizing: true,
|
|
@@ -15558,7 +15279,7 @@ var TableProvider = ({
|
|
|
15558
15279
|
});
|
|
15559
15280
|
const pagination = table.getState().pagination;
|
|
15560
15281
|
const pageCount = table.getPageCount();
|
|
15561
|
-
(0,
|
|
15282
|
+
(0, import_react70.useEffect)(() => {
|
|
15562
15283
|
if (pageCount === -1) {
|
|
15563
15284
|
return;
|
|
15564
15285
|
}
|
|
@@ -15566,20 +15287,20 @@ var TableProvider = ({
|
|
|
15566
15287
|
table.setPageIndex(pageCount - 1);
|
|
15567
15288
|
}
|
|
15568
15289
|
}, [table, pagination.pageIndex, pageCount]);
|
|
15569
|
-
(0,
|
|
15290
|
+
(0, import_react70.useEffect)(() => {
|
|
15570
15291
|
table.setColumnOrder((prev) => [...prev]);
|
|
15571
15292
|
}, [table, columns]);
|
|
15572
15293
|
const columnVisibility = table.getState().columnVisibility;
|
|
15573
15294
|
const columnOrder = table.getState().columnOrder;
|
|
15574
15295
|
const columnPinning = table.getState().columnPinning;
|
|
15575
|
-
(0,
|
|
15296
|
+
(0, import_react70.useEffect)(() => {
|
|
15576
15297
|
table.setColumnSizing((prev) => ({ ...prev }));
|
|
15577
15298
|
}, [table, targetWidth, columnVisibility, columnOrder, columnPinning]);
|
|
15578
|
-
const tableColumnDefinitionContextValue = (0,
|
|
15299
|
+
const tableColumnDefinitionContextValue = (0, import_react70.useMemo)(() => ({
|
|
15579
15300
|
table,
|
|
15580
15301
|
registerColumn
|
|
15581
15302
|
}), [table, registerColumn]);
|
|
15582
|
-
const tableContainerContextValue = (0,
|
|
15303
|
+
const tableContainerContextValue = (0, import_react70.useMemo)(() => ({
|
|
15583
15304
|
table,
|
|
15584
15305
|
containerRef
|
|
15585
15306
|
}), [table, containerRef]);
|
|
@@ -15588,7 +15309,7 @@ var TableProvider = ({
|
|
|
15588
15309
|
return rest;
|
|
15589
15310
|
})();
|
|
15590
15311
|
const rowModel = table.getRowModel();
|
|
15591
|
-
const tableStateWithoutSizingContextValue = (0,
|
|
15312
|
+
const tableStateWithoutSizingContextValue = (0, import_react70.useMemo)(() => ({
|
|
15592
15313
|
table,
|
|
15593
15314
|
isUsingFillerRows,
|
|
15594
15315
|
fillerRowCell,
|
|
@@ -15631,7 +15352,7 @@ var TableProvider = ({
|
|
|
15631
15352
|
]);
|
|
15632
15353
|
const columnSizing = table.getState().columnSizing;
|
|
15633
15354
|
const columnSizingInfo = table.getState().columnSizingInfo;
|
|
15634
|
-
const tableStateContextValue = (0,
|
|
15355
|
+
const tableStateContextValue = (0, import_react70.useMemo)(() => ({
|
|
15635
15356
|
...tableStateWithoutSizingContextValue,
|
|
15636
15357
|
sizeVars: ColumnSizeUtil.toSizeVars(columnSizing),
|
|
15637
15358
|
columnSizingInfo,
|
|
@@ -15642,10 +15363,10 @@ var TableProvider = ({
|
|
|
15642
15363
|
|
|
15643
15364
|
// src/components/layout/table/TableBody.tsx
|
|
15644
15365
|
var import_react_table2 = require("@tanstack/react-table");
|
|
15645
|
-
var
|
|
15366
|
+
var import_react71 = __toESM(require("react"));
|
|
15646
15367
|
var import_clsx20 = __toESM(require("clsx"));
|
|
15647
15368
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
15648
|
-
var TableBody =
|
|
15369
|
+
var TableBody = import_react71.default.memo(function TableBodyVisual() {
|
|
15649
15370
|
const { table, isUsingFillerRows, fillerRowCell, onRowClick, onFillerRowClick } = useTableStateWithoutSizingContext();
|
|
15650
15371
|
const rows = table.getRowModel().rows;
|
|
15651
15372
|
const columnOrder = table.getState().columnOrder;
|
|
@@ -15743,16 +15464,16 @@ var TableSortButton = ({
|
|
|
15743
15464
|
|
|
15744
15465
|
// src/components/layout/table/TableFilterButton.tsx
|
|
15745
15466
|
var import_lucide_react21 = require("lucide-react");
|
|
15746
|
-
var
|
|
15467
|
+
var import_react88 = require("react");
|
|
15747
15468
|
var import_react_table3 = require("@tanstack/react-table");
|
|
15748
15469
|
|
|
15749
15470
|
// src/components/user-interaction/data/FilterPopUp.tsx
|
|
15750
15471
|
var import_lucide_react20 = require("lucide-react");
|
|
15751
|
-
var
|
|
15472
|
+
var import_react87 = require("react");
|
|
15752
15473
|
|
|
15753
15474
|
// src/components/user-interaction/Checkbox.tsx
|
|
15754
15475
|
var import_lucide_react16 = require("lucide-react");
|
|
15755
|
-
var
|
|
15476
|
+
var import_react72 = require("react");
|
|
15756
15477
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
15757
15478
|
var Checkbox = ({
|
|
15758
15479
|
value: controlledValue,
|
|
@@ -15770,7 +15491,7 @@ var Checkbox = ({
|
|
|
15770
15491
|
}) => {
|
|
15771
15492
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15772
15493
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
15773
|
-
const onChangeWrapper = (0,
|
|
15494
|
+
const onChangeWrapper = (0, import_react72.useCallback)((value2) => {
|
|
15774
15495
|
onValueChangeStable(value2);
|
|
15775
15496
|
onEditCompleteStable(value2);
|
|
15776
15497
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -15814,12 +15535,12 @@ var Checkbox = ({
|
|
|
15814
15535
|
};
|
|
15815
15536
|
|
|
15816
15537
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
15817
|
-
var
|
|
15538
|
+
var import_react78 = require("react");
|
|
15818
15539
|
var import_lucide_react18 = require("lucide-react");
|
|
15819
15540
|
var import_clsx24 = __toESM(require("clsx"));
|
|
15820
15541
|
|
|
15821
15542
|
// src/components/user-interaction/date/TimePicker.tsx
|
|
15822
|
-
var
|
|
15543
|
+
var import_react73 = require("react");
|
|
15823
15544
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
15824
15545
|
var TimePicker = ({
|
|
15825
15546
|
value: controlledValue,
|
|
@@ -15838,11 +15559,11 @@ var TimePicker = ({
|
|
|
15838
15559
|
onValueChange,
|
|
15839
15560
|
defaultValue: initialValue
|
|
15840
15561
|
});
|
|
15841
|
-
const minuteRef = (0,
|
|
15842
|
-
const hourRef = (0,
|
|
15562
|
+
const minuteRef = (0, import_react73.useRef)(null);
|
|
15563
|
+
const hourRef = (0, import_react73.useRef)(null);
|
|
15843
15564
|
const isPM = value.getHours() > 11;
|
|
15844
15565
|
const hours = is24HourFormat ? range(24) : range(12);
|
|
15845
|
-
const minutes = (0,
|
|
15566
|
+
const minutes = (0, import_react73.useMemo)(() => {
|
|
15846
15567
|
const full = range(60);
|
|
15847
15568
|
switch (minuteIncrement) {
|
|
15848
15569
|
case "5min":
|
|
@@ -15855,7 +15576,7 @@ var TimePicker = ({
|
|
|
15855
15576
|
return full.filter((value2) => value2 % 30 === 0);
|
|
15856
15577
|
}
|
|
15857
15578
|
}, [minuteIncrement]);
|
|
15858
|
-
const seconds = (0,
|
|
15579
|
+
const seconds = (0, import_react73.useMemo)(() => {
|
|
15859
15580
|
const full = range(60);
|
|
15860
15581
|
switch (secondIncrement) {
|
|
15861
15582
|
case "1s":
|
|
@@ -15870,7 +15591,7 @@ var TimePicker = ({
|
|
|
15870
15591
|
return full.filter((value2) => value2 % 30 === 0);
|
|
15871
15592
|
}
|
|
15872
15593
|
}, [secondIncrement]);
|
|
15873
|
-
const milliseconds = (0,
|
|
15594
|
+
const milliseconds = (0, import_react73.useMemo)(() => {
|
|
15874
15595
|
const full = range(1e3);
|
|
15875
15596
|
switch (millisecondIncrement) {
|
|
15876
15597
|
case "1ms":
|
|
@@ -15891,17 +15612,17 @@ var TimePicker = ({
|
|
|
15891
15612
|
return full.filter((value2) => value2 % 500 === 0);
|
|
15892
15613
|
}
|
|
15893
15614
|
}, [millisecondIncrement]);
|
|
15894
|
-
const closestMinute = (0,
|
|
15895
|
-
const closestSecond = (0,
|
|
15896
|
-
const closestMillisecond = (0,
|
|
15615
|
+
const closestMinute = (0, import_react73.useMemo)(() => closestMatch(minutes, (item1, item2) => Math.abs(item1 - value.getMinutes()) < Math.abs(item2 - value.getMinutes())), [minutes, value]);
|
|
15616
|
+
const closestSecond = (0, import_react73.useMemo)(() => closestMatch(seconds, (item1, item2) => Math.abs(item1 - value.getSeconds()) < Math.abs(item2 - value.getSeconds())), [seconds, value]);
|
|
15617
|
+
const closestMillisecond = (0, import_react73.useMemo)(() => closestMatch(milliseconds, (item1, item2) => Math.abs(item1 - value.getMilliseconds()) < Math.abs(item2 - value.getMilliseconds())), [milliseconds, value]);
|
|
15897
15618
|
const hour = value.getHours();
|
|
15898
|
-
(0,
|
|
15619
|
+
(0, import_react73.useEffect)(() => {
|
|
15899
15620
|
minuteRef.current?.scrollIntoView({
|
|
15900
15621
|
behavior: "smooth",
|
|
15901
15622
|
block: "nearest"
|
|
15902
15623
|
});
|
|
15903
15624
|
}, [closestMinute]);
|
|
15904
|
-
(0,
|
|
15625
|
+
(0, import_react73.useEffect)(() => {
|
|
15905
15626
|
hourRef.current?.scrollIntoView({
|
|
15906
15627
|
behavior: "smooth",
|
|
15907
15628
|
block: "nearest"
|
|
@@ -16000,12 +15721,12 @@ var TimePicker = ({
|
|
|
16000
15721
|
};
|
|
16001
15722
|
|
|
16002
15723
|
// src/components/user-interaction/date/DatePicker.tsx
|
|
16003
|
-
var
|
|
15724
|
+
var import_react76 = require("react");
|
|
16004
15725
|
var import_lucide_react17 = require("lucide-react");
|
|
16005
15726
|
var import_clsx23 = __toESM(require("clsx"));
|
|
16006
15727
|
|
|
16007
15728
|
// src/components/user-interaction/date/DayPicker.tsx
|
|
16008
|
-
var
|
|
15729
|
+
var import_react74 = require("react");
|
|
16009
15730
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
16010
15731
|
var DayPicker = ({
|
|
16011
15732
|
displayedMonth: controlledDisplayedMonth,
|
|
@@ -16034,33 +15755,33 @@ var DayPicker = ({
|
|
|
16034
15755
|
});
|
|
16035
15756
|
const month = displayedMonth.getMonth();
|
|
16036
15757
|
const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
|
|
16037
|
-
const selectedButtonRef = (0,
|
|
16038
|
-
const isValueInDisplayedWeeks = (0,
|
|
15758
|
+
const selectedButtonRef = (0, import_react74.useRef)(null);
|
|
15759
|
+
const isValueInDisplayedWeeks = (0, import_react74.useMemo)(
|
|
16039
15760
|
() => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
|
|
16040
15761
|
[value, weeks]
|
|
16041
15762
|
);
|
|
16042
|
-
const firstDayOfMonth = (0,
|
|
15763
|
+
const firstDayOfMonth = (0, import_react74.useCallback)(
|
|
16043
15764
|
(date) => new Date(date.getFullYear(), date.getMonth(), 1),
|
|
16044
15765
|
[]
|
|
16045
15766
|
);
|
|
16046
15767
|
const focusTargetDate = value && isValueInDisplayedWeeks ? value : firstDayOfMonth(displayedMonth);
|
|
16047
|
-
(0,
|
|
15768
|
+
(0, import_react74.useEffect)(() => {
|
|
16048
15769
|
selectedButtonRef.current?.focus();
|
|
16049
15770
|
}, [focusTargetDate]);
|
|
16050
|
-
const end = (0,
|
|
15771
|
+
const end = (0, import_react74.useMemo)(() => {
|
|
16051
15772
|
if (!providedEnd) return;
|
|
16052
15773
|
return new Date(providedEnd.getFullYear(), providedEnd.getMonth(), providedEnd.getDate());
|
|
16053
15774
|
}, [providedEnd]);
|
|
16054
|
-
const start = (0,
|
|
15775
|
+
const start = (0, import_react74.useMemo)(() => {
|
|
16055
15776
|
if (!providedStart) return;
|
|
16056
15777
|
return new Date(providedStart.getFullYear(), providedStart.getMonth(), providedStart.getDate());
|
|
16057
15778
|
}, [providedStart]);
|
|
16058
|
-
const clampToRange = (0,
|
|
15779
|
+
const clampToRange = (0, import_react74.useCallback)((date) => {
|
|
16059
15780
|
if (start && date < start) return start;
|
|
16060
15781
|
if (end && date > end) return end;
|
|
16061
15782
|
return date;
|
|
16062
15783
|
}, [start, end]);
|
|
16063
|
-
const navigateTo = (0,
|
|
15784
|
+
const navigateTo = (0, import_react74.useCallback)((candidate) => {
|
|
16064
15785
|
const clamped = clampToRange(candidate);
|
|
16065
15786
|
if (!DateUtils.between(clamped, start, end)) return;
|
|
16066
15787
|
setValue(clamped);
|
|
@@ -16069,7 +15790,7 @@ var DayPicker = ({
|
|
|
16069
15790
|
setDisplayedMonth(firstDayOfMonth(clamped));
|
|
16070
15791
|
}
|
|
16071
15792
|
}, [clampToRange, start, end, setValue, onEditComplete, displayedMonth, setDisplayedMonth, firstDayOfMonth]);
|
|
16072
|
-
const onKeyDown = (0,
|
|
15793
|
+
const onKeyDown = (0, import_react74.useCallback)(
|
|
16073
15794
|
(event) => {
|
|
16074
15795
|
PropsUtil.aria.navigate({
|
|
16075
15796
|
left: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 1 })),
|
|
@@ -16126,10 +15847,10 @@ var DayPicker = ({
|
|
|
16126
15847
|
};
|
|
16127
15848
|
|
|
16128
15849
|
// src/components/user-interaction/date/YearMonthPicker.tsx
|
|
16129
|
-
var
|
|
15850
|
+
var import_react75 = require("react");
|
|
16130
15851
|
var import_clsx22 = __toESM(require("clsx"));
|
|
16131
15852
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
16132
|
-
var YearRow = (0,
|
|
15853
|
+
var YearRow = (0, import_react75.memo)(function YearRow2({
|
|
16133
15854
|
year,
|
|
16134
15855
|
selectedMonthIndex,
|
|
16135
15856
|
minTimestamp,
|
|
@@ -16137,15 +15858,15 @@ var YearRow = (0, import_react85.memo)(function YearRow2({
|
|
|
16137
15858
|
monthNames,
|
|
16138
15859
|
onSelect
|
|
16139
15860
|
}) {
|
|
16140
|
-
const ref = (0,
|
|
15861
|
+
const ref = (0, import_react75.useRef)(null);
|
|
16141
15862
|
const isSelectedYear = selectedMonthIndex !== void 0;
|
|
16142
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
16143
|
-
(0,
|
|
15863
|
+
const [isExpanded, setIsExpanded] = (0, import_react75.useState)(false);
|
|
15864
|
+
(0, import_react75.useEffect)(() => {
|
|
16144
15865
|
if (isSelectedYear) {
|
|
16145
15866
|
ref.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
16146
15867
|
}
|
|
16147
15868
|
}, [isSelectedYear]);
|
|
16148
|
-
const monthGrid = (0,
|
|
15869
|
+
const monthGrid = (0, import_react75.useMemo)(() => equalSizeGroups([...DateUtils.monthsList], 3), []);
|
|
16149
15870
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
16150
15871
|
ExpandableRoot,
|
|
16151
15872
|
{
|
|
@@ -16200,23 +15921,23 @@ var YearMonthPicker = ({
|
|
|
16200
15921
|
defaultValue: initialValue
|
|
16201
15922
|
});
|
|
16202
15923
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
16203
|
-
const monthNames = (0,
|
|
15924
|
+
const monthNames = (0, import_react75.useMemo)(() => {
|
|
16204
15925
|
const formatter = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
16205
15926
|
return Array.from({ length: 12 }, (_, i) => formatter.format(new Date(2e3, i, 1)));
|
|
16206
15927
|
}, [locale]);
|
|
16207
|
-
const years = (0,
|
|
15928
|
+
const years = (0, import_react75.useMemo)(
|
|
16208
15929
|
() => range([start.getFullYear(), end.getFullYear()], { exclusiveEnd: false }),
|
|
16209
15930
|
[start, end]
|
|
16210
15931
|
);
|
|
16211
|
-
const minTimestamp = (0,
|
|
15932
|
+
const minTimestamp = (0, import_react75.useMemo)(() => {
|
|
16212
15933
|
if (!start) return;
|
|
16213
15934
|
return new Date(start.getFullYear(), start.getMonth(), 1).getTime();
|
|
16214
15935
|
}, [start]);
|
|
16215
|
-
const maxTimestamp = (0,
|
|
15936
|
+
const maxTimestamp = (0, import_react75.useMemo)(() => {
|
|
16216
15937
|
if (!end) return;
|
|
16217
15938
|
return new Date(end.getFullYear(), end.getMonth() + 1, 0).getTime();
|
|
16218
15939
|
}, [end]);
|
|
16219
|
-
const handleSelect = (0,
|
|
15940
|
+
const handleSelect = (0, import_react75.useCallback)((newDate) => {
|
|
16220
15941
|
setValue(newDate);
|
|
16221
15942
|
onEditCompleteStable(newDate);
|
|
16222
15943
|
}, [onEditCompleteStable, setValue]);
|
|
@@ -16269,8 +15990,8 @@ var DatePicker = ({
|
|
|
16269
15990
|
onValueChange,
|
|
16270
15991
|
defaultValue: initialValue
|
|
16271
15992
|
});
|
|
16272
|
-
const [displayedMonth, setDisplayedMonth] = (0,
|
|
16273
|
-
const [displayMode, setDisplayMode] = (0,
|
|
15993
|
+
const [displayedMonth, setDisplayedMonth] = (0, import_react76.useState)(new Date(value.getFullYear(), value.getMonth(), 1));
|
|
15994
|
+
const [displayMode, setDisplayMode] = (0, import_react76.useState)(initialDisplay);
|
|
16274
15995
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: (0, import_clsx23.default)("flex-col-3", className), children: [
|
|
16275
15996
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex-row-2 items-center justify-between", children: [
|
|
16276
15997
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
@@ -16432,7 +16153,7 @@ var DateTimePicker = ({
|
|
|
16432
16153
|
};
|
|
16433
16154
|
|
|
16434
16155
|
// src/components/user-interaction/date/DateTimePickerDialog.tsx
|
|
16435
|
-
var
|
|
16156
|
+
var import_react77 = require("react");
|
|
16436
16157
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
16437
16158
|
var DateTimePickerDialog = ({
|
|
16438
16159
|
initialValue = null,
|
|
@@ -16460,8 +16181,8 @@ var DateTimePickerDialog = ({
|
|
|
16460
16181
|
onValueChange,
|
|
16461
16182
|
defaultValue: initialValue
|
|
16462
16183
|
});
|
|
16463
|
-
const [pickerState, setPickerState] = (0,
|
|
16464
|
-
(0,
|
|
16184
|
+
const [pickerState, setPickerState] = (0, import_react77.useState)(state ?? /* @__PURE__ */ new Date());
|
|
16185
|
+
(0, import_react77.useEffect)(() => {
|
|
16465
16186
|
setPickerState(state ?? /* @__PURE__ */ new Date());
|
|
16466
16187
|
}, [state]);
|
|
16467
16188
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
@@ -16536,7 +16257,7 @@ var DateTimePickerDialog = ({
|
|
|
16536
16257
|
|
|
16537
16258
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
16538
16259
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
16539
|
-
var DateTimeInput = (0,
|
|
16260
|
+
var DateTimeInput = (0, import_react78.forwardRef)(function DateTimeInput2({
|
|
16540
16261
|
id: inputId,
|
|
16541
16262
|
value,
|
|
16542
16263
|
initialValue = null,
|
|
@@ -16561,40 +16282,41 @@ var DateTimeInput = (0, import_react88.forwardRef)(function DateTimeInput2({
|
|
|
16561
16282
|
readOnly = false,
|
|
16562
16283
|
invalid = false,
|
|
16563
16284
|
required = false,
|
|
16285
|
+
actions = [],
|
|
16564
16286
|
...props
|
|
16565
16287
|
}, forwardedRef) {
|
|
16566
16288
|
const translation = useHightideTranslation();
|
|
16567
|
-
const [isOpen, setIsOpen] = (0,
|
|
16289
|
+
const [isOpen, setIsOpen] = (0, import_react78.useState)(false);
|
|
16568
16290
|
const [state, setState] = useControlledState({
|
|
16569
16291
|
value,
|
|
16570
16292
|
onValueChange,
|
|
16571
16293
|
defaultValue: initialValue
|
|
16572
16294
|
});
|
|
16573
|
-
const [dialogValue, setDialogValue] = (0,
|
|
16574
|
-
const [stringInputState, setStringInputState] = (0,
|
|
16295
|
+
const [dialogValue, setDialogValue] = (0, import_react78.useState)(state);
|
|
16296
|
+
const [stringInputState, setStringInputState] = (0, import_react78.useState)({
|
|
16575
16297
|
state: state ? DateUtils.toInputString(state, mode, precision) : "",
|
|
16576
16298
|
date: void 0
|
|
16577
16299
|
});
|
|
16578
|
-
(0,
|
|
16300
|
+
(0, import_react78.useEffect)(() => {
|
|
16579
16301
|
setDialogValue(state);
|
|
16580
16302
|
setStringInputState({
|
|
16581
16303
|
state: state ? DateUtils.toInputString(state, mode) : "",
|
|
16582
16304
|
date: void 0
|
|
16583
16305
|
});
|
|
16584
16306
|
}, [mode, state]);
|
|
16585
|
-
const changeOpenWrapper = (0,
|
|
16307
|
+
const changeOpenWrapper = (0, import_react78.useCallback)((isOpen2) => {
|
|
16586
16308
|
onDialogOpeningChange?.(isOpen2);
|
|
16587
16309
|
setIsOpen(isOpen2);
|
|
16588
16310
|
}, [onDialogOpeningChange]);
|
|
16589
|
-
const generatedId = (0,
|
|
16590
|
-
const ids = (0,
|
|
16311
|
+
const generatedId = (0, import_react78.useId)();
|
|
16312
|
+
const ids = (0, import_react78.useMemo)(() => ({
|
|
16591
16313
|
input: inputId ?? `date-time-input-${generatedId}`,
|
|
16592
16314
|
popup: `date-time-input-popup-${generatedId}`,
|
|
16593
16315
|
label: `date-time-input-label-${generatedId}`
|
|
16594
16316
|
}), [generatedId, inputId]);
|
|
16595
|
-
const innerRef = (0,
|
|
16596
|
-
(0,
|
|
16597
|
-
(0,
|
|
16317
|
+
const innerRef = (0, import_react78.useRef)(null);
|
|
16318
|
+
(0, import_react78.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
16319
|
+
(0, import_react78.useEffect)(() => {
|
|
16598
16320
|
if (readOnly || disabled) {
|
|
16599
16321
|
changeOpenWrapper(false);
|
|
16600
16322
|
}
|
|
@@ -16612,6 +16334,12 @@ var DateTimeInput = (0, import_react88.forwardRef)(function DateTimeInput2({
|
|
|
16612
16334
|
ref: innerRef,
|
|
16613
16335
|
id: ids.input,
|
|
16614
16336
|
value: stringInputState.state,
|
|
16337
|
+
onClick: (event) => {
|
|
16338
|
+
event.preventDefault();
|
|
16339
|
+
},
|
|
16340
|
+
onFocus: (event) => {
|
|
16341
|
+
event.preventDefault();
|
|
16342
|
+
},
|
|
16615
16343
|
onChange: (event) => {
|
|
16616
16344
|
const date = new Date(event.target.value ?? "");
|
|
16617
16345
|
const isValid = !isNaN(date.getTime());
|
|
@@ -16652,24 +16380,26 @@ var DateTimeInput = (0, import_react88.forwardRef)(function DateTimeInput2({
|
|
|
16652
16380
|
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props)
|
|
16653
16381
|
}
|
|
16654
16382
|
),
|
|
16655
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.
|
|
16656
|
-
|
|
16657
|
-
{
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16383
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "absolute right-1 top-1/2 -translate-y-1/2 flex-row-0", children: [
|
|
16384
|
+
actions,
|
|
16385
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Visibility, { isVisible: !readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
16386
|
+
IconButton,
|
|
16387
|
+
{
|
|
16388
|
+
tooltip: translation("sDateTimeSelect", { datetimeMode: mode }),
|
|
16389
|
+
coloringStyle: "text",
|
|
16390
|
+
color: "neutral",
|
|
16391
|
+
size: "sm",
|
|
16392
|
+
disabled,
|
|
16393
|
+
onClick: () => {
|
|
16394
|
+
changeOpenWrapper(true);
|
|
16395
|
+
},
|
|
16396
|
+
"aria-haspopup": "dialog",
|
|
16397
|
+
"aria-expanded": isOpen,
|
|
16398
|
+
"aria-controls": isOpen ? ids.popup : void 0,
|
|
16399
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_lucide_react18.CalendarIcon, { className: "size-5" })
|
|
16400
|
+
}
|
|
16401
|
+
) })
|
|
16402
|
+
] })
|
|
16673
16403
|
] }),
|
|
16674
16404
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
16675
16405
|
PopUp,
|
|
@@ -16720,22 +16450,63 @@ var DateTimeInput = (0, import_react88.forwardRef)(function DateTimeInput2({
|
|
|
16720
16450
|
});
|
|
16721
16451
|
|
|
16722
16452
|
// src/components/user-interaction/MultiSelect/MultiSelect.tsx
|
|
16723
|
-
var
|
|
16453
|
+
var import_react86 = require("react");
|
|
16724
16454
|
|
|
16725
16455
|
// src/components/user-interaction/MultiSelect/MultiSelectRoot.tsx
|
|
16726
|
-
var
|
|
16456
|
+
var import_react82 = require("react");
|
|
16727
16457
|
|
|
16728
16458
|
// src/components/user-interaction/MultiSelect/MultiSelectContext.tsx
|
|
16729
|
-
var
|
|
16730
|
-
var MultiSelectContext = (0,
|
|
16459
|
+
var import_react79 = require("react");
|
|
16460
|
+
var MultiSelectContext = (0, import_react79.createContext)(null);
|
|
16731
16461
|
function useMultiSelectContext() {
|
|
16732
|
-
const ctx = (0,
|
|
16462
|
+
const ctx = (0, import_react79.useContext)(MultiSelectContext);
|
|
16733
16463
|
if (!ctx) throw new Error("useMultiSelectContext must be used within MultiSelectRoot");
|
|
16734
16464
|
return ctx;
|
|
16735
16465
|
}
|
|
16736
16466
|
|
|
16737
16467
|
// src/components/user-interaction/MultiSelect/useMultiSelect.ts
|
|
16738
|
-
var
|
|
16468
|
+
var import_react81 = require("react");
|
|
16469
|
+
|
|
16470
|
+
// src/hooks/useMultiSelection.ts
|
|
16471
|
+
var import_react80 = require("react");
|
|
16472
|
+
function useMultiSelection({
|
|
16473
|
+
options: optionsList,
|
|
16474
|
+
value,
|
|
16475
|
+
onSelectionChange,
|
|
16476
|
+
initialSelection = [],
|
|
16477
|
+
isControlled
|
|
16478
|
+
}) {
|
|
16479
|
+
const [selection, setSelection] = useControlledState({
|
|
16480
|
+
value,
|
|
16481
|
+
onValueChange: onSelectionChange,
|
|
16482
|
+
defaultValue: [...initialSelection],
|
|
16483
|
+
isControlled
|
|
16484
|
+
});
|
|
16485
|
+
const isSelected = (0, import_react80.useCallback)((id) => selection.includes(id), [selection]);
|
|
16486
|
+
const toggleSelection = (0, import_react80.useCallback)(
|
|
16487
|
+
(id) => {
|
|
16488
|
+
const option = optionsList.find((o) => o.id === id);
|
|
16489
|
+
if (!option || option.disabled) return;
|
|
16490
|
+
setSelection((prev) => prev.includes(id) ? prev.filter((s) => s !== id) : [...prev, id]);
|
|
16491
|
+
},
|
|
16492
|
+
[optionsList, setSelection]
|
|
16493
|
+
);
|
|
16494
|
+
const setSelectionValue = (0, import_react80.useCallback)(
|
|
16495
|
+
(next) => setSelection(Array.from(next)),
|
|
16496
|
+
[setSelection]
|
|
16497
|
+
);
|
|
16498
|
+
return (0, import_react80.useMemo)(
|
|
16499
|
+
() => ({
|
|
16500
|
+
selection,
|
|
16501
|
+
setSelection: setSelectionValue,
|
|
16502
|
+
toggleSelection,
|
|
16503
|
+
isSelected
|
|
16504
|
+
}),
|
|
16505
|
+
[selection, setSelectionValue, toggleSelection, isSelected]
|
|
16506
|
+
);
|
|
16507
|
+
}
|
|
16508
|
+
|
|
16509
|
+
// src/components/user-interaction/MultiSelect/useMultiSelect.ts
|
|
16739
16510
|
function useMultiSelect({
|
|
16740
16511
|
options,
|
|
16741
16512
|
value: controlledValue,
|
|
@@ -16746,9 +16517,9 @@ function useMultiSelect({
|
|
|
16746
16517
|
initialIsOpen = false,
|
|
16747
16518
|
typeAheadResetMs = 500
|
|
16748
16519
|
}) {
|
|
16749
|
-
const [isOpen, setIsOpen] = (0,
|
|
16750
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
16751
|
-
const selectionOptions = (0,
|
|
16520
|
+
const [isOpen, setIsOpen] = (0, import_react81.useState)(initialIsOpen);
|
|
16521
|
+
const [searchQuery, setSearchQuery] = (0, import_react81.useState)("");
|
|
16522
|
+
const selectionOptions = (0, import_react81.useMemo)(
|
|
16752
16523
|
() => options.map((o) => ({ id: o.id, disabled: o.disabled })),
|
|
16753
16524
|
[options]
|
|
16754
16525
|
);
|
|
@@ -16764,13 +16535,13 @@ function useMultiSelect({
|
|
|
16764
16535
|
const { searchResult: visibleOptions } = useSearch({
|
|
16765
16536
|
items: options,
|
|
16766
16537
|
searchQuery,
|
|
16767
|
-
toTags: (0,
|
|
16538
|
+
toTags: (0, import_react81.useCallback)((o) => [o.label ?? ""], [])
|
|
16768
16539
|
});
|
|
16769
|
-
const visibleOptionIds = (0,
|
|
16540
|
+
const visibleOptionIds = (0, import_react81.useMemo)(
|
|
16770
16541
|
() => visibleOptions.map((o) => o.id),
|
|
16771
16542
|
[visibleOptions]
|
|
16772
16543
|
);
|
|
16773
|
-
const enabledOptions = (0,
|
|
16544
|
+
const enabledOptions = (0, import_react81.useMemo)(
|
|
16774
16545
|
() => visibleOptions.filter((o) => !o.disabled),
|
|
16775
16546
|
[visibleOptions]
|
|
16776
16547
|
);
|
|
@@ -16783,7 +16554,7 @@ function useMultiSelect({
|
|
|
16783
16554
|
options: enabledOptions,
|
|
16784
16555
|
resetTimer: typeAheadResetMs,
|
|
16785
16556
|
toString: (o) => o.label ?? "",
|
|
16786
|
-
onResultChange: (0,
|
|
16557
|
+
onResultChange: (0, import_react81.useCallback)(
|
|
16787
16558
|
(option) => {
|
|
16788
16559
|
if (option) listNav.highlight(option.id);
|
|
16789
16560
|
},
|
|
@@ -16791,14 +16562,14 @@ function useMultiSelect({
|
|
|
16791
16562
|
)
|
|
16792
16563
|
});
|
|
16793
16564
|
const { reset: typeAheadReset, addToTypeAhead } = typeAhead;
|
|
16794
|
-
(0,
|
|
16565
|
+
(0, import_react81.useEffect)(() => {
|
|
16795
16566
|
if (!isOpen) typeAheadReset();
|
|
16796
16567
|
}, [isOpen, typeAheadReset]);
|
|
16797
|
-
const highlightItem = (0,
|
|
16568
|
+
const highlightItem = (0, import_react81.useCallback)((id) => {
|
|
16798
16569
|
if (!enabledOptions.some((o) => o.id === id)) return;
|
|
16799
16570
|
listNavHighlight(id);
|
|
16800
16571
|
}, [enabledOptions, listNavHighlight]);
|
|
16801
|
-
const toggleSelectionValue = (0,
|
|
16572
|
+
const toggleSelectionValue = (0, import_react81.useCallback)((id, newIsSelected) => {
|
|
16802
16573
|
const next = newIsSelected ?? !isSelected(id);
|
|
16803
16574
|
if (next) {
|
|
16804
16575
|
toggleSelection(id);
|
|
@@ -16807,7 +16578,7 @@ function useMultiSelect({
|
|
|
16807
16578
|
}
|
|
16808
16579
|
highlightItem(id);
|
|
16809
16580
|
}, [toggleSelection, setSelection, highlightItem, isSelected, selection]);
|
|
16810
|
-
const setIsOpenWrapper = (0,
|
|
16581
|
+
const setIsOpenWrapper = (0, import_react81.useCallback)(
|
|
16811
16582
|
(open, behavior) => {
|
|
16812
16583
|
setIsOpen(open);
|
|
16813
16584
|
behavior = behavior ?? "first";
|
|
@@ -16838,13 +16609,13 @@ function useMultiSelect({
|
|
|
16838
16609
|
enabledOptions
|
|
16839
16610
|
]
|
|
16840
16611
|
);
|
|
16841
|
-
const toggleOpenWrapper = (0,
|
|
16612
|
+
const toggleOpenWrapper = (0, import_react81.useCallback)(
|
|
16842
16613
|
(behavior) => {
|
|
16843
16614
|
setIsOpenWrapper(!isOpen, behavior);
|
|
16844
16615
|
},
|
|
16845
16616
|
[isOpen, setIsOpenWrapper]
|
|
16846
16617
|
);
|
|
16847
|
-
const state = (0,
|
|
16618
|
+
const state = (0, import_react81.useMemo)(
|
|
16848
16619
|
() => ({
|
|
16849
16620
|
value: [...selection],
|
|
16850
16621
|
highlightedId: listNav.highlightedId,
|
|
@@ -16860,11 +16631,11 @@ function useMultiSelect({
|
|
|
16860
16631
|
options
|
|
16861
16632
|
]
|
|
16862
16633
|
);
|
|
16863
|
-
const computedState = (0,
|
|
16634
|
+
const computedState = (0, import_react81.useMemo)(
|
|
16864
16635
|
() => ({ visibleOptionIds }),
|
|
16865
16636
|
[visibleOptionIds]
|
|
16866
16637
|
);
|
|
16867
|
-
const actions = (0,
|
|
16638
|
+
const actions = (0, import_react81.useMemo)(
|
|
16868
16639
|
() => ({
|
|
16869
16640
|
setIsOpen: setIsOpenWrapper,
|
|
16870
16641
|
toggleOpen: toggleOpenWrapper,
|
|
@@ -16893,7 +16664,7 @@ function useMultiSelect({
|
|
|
16893
16664
|
addToTypeAhead
|
|
16894
16665
|
]
|
|
16895
16666
|
);
|
|
16896
|
-
return (0,
|
|
16667
|
+
return (0, import_react81.useMemo)(
|
|
16897
16668
|
() => ({
|
|
16898
16669
|
...state,
|
|
16899
16670
|
...computedState,
|
|
@@ -16921,16 +16692,16 @@ function MultiSelectRoot({
|
|
|
16921
16692
|
readOnly = false,
|
|
16922
16693
|
required = false
|
|
16923
16694
|
}) {
|
|
16924
|
-
const [triggerRef, setTriggerRef] = (0,
|
|
16925
|
-
const [options, setOptions] = (0,
|
|
16926
|
-
const generatedId = (0,
|
|
16927
|
-
const [ids, setIds] = (0,
|
|
16695
|
+
const [triggerRef, setTriggerRef] = (0, import_react82.useState)(null);
|
|
16696
|
+
const [options, setOptions] = (0, import_react82.useState)([]);
|
|
16697
|
+
const generatedId = (0, import_react82.useId)();
|
|
16698
|
+
const [ids, setIds] = (0, import_react82.useState)({
|
|
16928
16699
|
trigger: "multi-select-" + generatedId,
|
|
16929
16700
|
content: "multi-select-content-" + generatedId,
|
|
16930
16701
|
listbox: "multi-select-listbox-" + generatedId,
|
|
16931
16702
|
searchInput: "multi-select-search-" + generatedId
|
|
16932
16703
|
});
|
|
16933
|
-
const registerOption = (0,
|
|
16704
|
+
const registerOption = (0, import_react82.useCallback)((item) => {
|
|
16934
16705
|
setOptions((prev) => {
|
|
16935
16706
|
const next = prev.filter((o) => o.id !== item.id);
|
|
16936
16707
|
next.push(item);
|
|
@@ -16939,12 +16710,12 @@ function MultiSelectRoot({
|
|
|
16939
16710
|
});
|
|
16940
16711
|
return () => setOptions((prev) => prev.filter((o) => o.id !== item.id));
|
|
16941
16712
|
}, []);
|
|
16942
|
-
const registerTrigger = (0,
|
|
16713
|
+
const registerTrigger = (0, import_react82.useCallback)((ref) => {
|
|
16943
16714
|
setTriggerRef(ref);
|
|
16944
16715
|
return () => setTriggerRef(null);
|
|
16945
16716
|
}, []);
|
|
16946
|
-
const compare = (0,
|
|
16947
|
-
const idToOptionMap = (0,
|
|
16717
|
+
const compare = (0, import_react82.useMemo)(() => compareFunction ?? Object.is, [compareFunction]);
|
|
16718
|
+
const idToOptionMap = (0, import_react82.useMemo)(
|
|
16948
16719
|
() => options.reduce(
|
|
16949
16720
|
(acc, o) => {
|
|
16950
16721
|
acc[o.id] = o;
|
|
@@ -16954,22 +16725,22 @@ function MultiSelectRoot({
|
|
|
16954
16725
|
),
|
|
16955
16726
|
[options]
|
|
16956
16727
|
);
|
|
16957
|
-
const mappedValueIds = (0,
|
|
16728
|
+
const mappedValueIds = (0, import_react82.useMemo)(() => {
|
|
16958
16729
|
if (value == null) return void 0;
|
|
16959
16730
|
return value.map((v) => options.find((o) => compare(o.value, v))?.id).filter((id) => id !== void 0);
|
|
16960
16731
|
}, [options, value, compare]);
|
|
16961
|
-
const mappedInitialValueIds = (0,
|
|
16732
|
+
const mappedInitialValueIds = (0, import_react82.useMemo)(() => {
|
|
16962
16733
|
if (initialValue == null) return [];
|
|
16963
16734
|
return initialValue.map((v) => options.find((o) => compare(o.value, v))?.id).filter((id) => id !== void 0);
|
|
16964
16735
|
}, [options, initialValue, compare]);
|
|
16965
|
-
const onValueChangeStable = (0,
|
|
16736
|
+
const onValueChangeStable = (0, import_react82.useCallback)(
|
|
16966
16737
|
(ids2) => {
|
|
16967
16738
|
const values = ids2.map((id) => idToOptionMap[id]?.value).filter((v) => v != null);
|
|
16968
16739
|
onValueChange?.(values);
|
|
16969
16740
|
},
|
|
16970
16741
|
[idToOptionMap, onValueChange]
|
|
16971
16742
|
);
|
|
16972
|
-
const onEditCompleteStable = (0,
|
|
16743
|
+
const onEditCompleteStable = (0, import_react82.useCallback)(
|
|
16973
16744
|
(ids2) => {
|
|
16974
16745
|
const values = ids2.map((id) => idToOptionMap[id]?.value).filter((v) => v != null);
|
|
16975
16746
|
onEditComplete?.(values);
|
|
@@ -16986,12 +16757,12 @@ function MultiSelectRoot({
|
|
|
16986
16757
|
onClose
|
|
16987
16758
|
});
|
|
16988
16759
|
const { setSearchQuery } = state;
|
|
16989
|
-
(0,
|
|
16760
|
+
(0, import_react82.useEffect)(() => {
|
|
16990
16761
|
if (showSearch === false) {
|
|
16991
16762
|
setSearchQuery("");
|
|
16992
16763
|
}
|
|
16993
16764
|
}, [showSearch, setSearchQuery]);
|
|
16994
|
-
const contextValue = (0,
|
|
16765
|
+
const contextValue = (0, import_react82.useMemo)(() => {
|
|
16995
16766
|
const valueT = state.value.map((id) => idToOptionMap[id]?.value).filter((v) => v != null);
|
|
16996
16767
|
return {
|
|
16997
16768
|
invalid,
|
|
@@ -17062,16 +16833,16 @@ function MultiSelectRoot({
|
|
|
17062
16833
|
}
|
|
17063
16834
|
|
|
17064
16835
|
// src/components/user-interaction/MultiSelect/MultiSelectButton.tsx
|
|
17065
|
-
var
|
|
16836
|
+
var import_react84 = require("react");
|
|
17066
16837
|
|
|
17067
16838
|
// src/components/user-interaction/MultiSelect/MultiSelectOption.tsx
|
|
17068
16839
|
var import_clsx25 = __toESM(require("clsx"));
|
|
17069
16840
|
var import_lucide_react19 = require("lucide-react");
|
|
17070
|
-
var
|
|
16841
|
+
var import_react83 = require("react");
|
|
17071
16842
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
17072
|
-
var MultiSelectOptionDisplayContext = (0,
|
|
16843
|
+
var MultiSelectOptionDisplayContext = (0, import_react83.createContext)(null);
|
|
17073
16844
|
function useMultiSelectOptionDisplayLocation() {
|
|
17074
|
-
const context = (0,
|
|
16845
|
+
const context = (0, import_react83.useContext)(MultiSelectOptionDisplayContext);
|
|
17075
16846
|
if (!context) {
|
|
17076
16847
|
throw new Error(
|
|
17077
16848
|
"useMultiSelectOptionDisplayLocation must be used within a MultiSelectOptionDisplayContext"
|
|
@@ -17079,7 +16850,7 @@ function useMultiSelectOptionDisplayLocation() {
|
|
|
17079
16850
|
}
|
|
17080
16851
|
return context;
|
|
17081
16852
|
}
|
|
17082
|
-
var MultiSelectOption = (0,
|
|
16853
|
+
var MultiSelectOption = (0, import_react83.forwardRef)(function MultiSelectOption2({
|
|
17083
16854
|
children,
|
|
17084
16855
|
label,
|
|
17085
16856
|
value,
|
|
@@ -17089,12 +16860,12 @@ var MultiSelectOption = (0, import_react92.forwardRef)(function MultiSelectOptio
|
|
|
17089
16860
|
}, ref) {
|
|
17090
16861
|
const context = useMultiSelectContext();
|
|
17091
16862
|
const { registerOption } = context;
|
|
17092
|
-
const itemRef = (0,
|
|
16863
|
+
const itemRef = (0, import_react83.useRef)(null);
|
|
17093
16864
|
const display = children ?? label;
|
|
17094
16865
|
const iconAppearanceResolved = iconAppearance ?? context.config.iconAppearance;
|
|
17095
|
-
const generatedId = (0,
|
|
16866
|
+
const generatedId = (0, import_react83.useId)();
|
|
17096
16867
|
const optionId = props?.id ?? "multi-select-option-" + generatedId;
|
|
17097
|
-
(0,
|
|
16868
|
+
(0, import_react83.useEffect)(() => {
|
|
17098
16869
|
return registerOption({
|
|
17099
16870
|
id: optionId,
|
|
17100
16871
|
value,
|
|
@@ -17162,7 +16933,7 @@ var MultiSelectOption = (0, import_react92.forwardRef)(function MultiSelectOptio
|
|
|
17162
16933
|
|
|
17163
16934
|
// src/components/user-interaction/MultiSelect/MultiSelectButton.tsx
|
|
17164
16935
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
17165
|
-
var MultiSelectButton = (0,
|
|
16936
|
+
var MultiSelectButton = (0, import_react84.forwardRef)(function MultiSelectButton2({
|
|
17166
16937
|
id,
|
|
17167
16938
|
placeholder,
|
|
17168
16939
|
disabled: disabledOverride,
|
|
@@ -17175,12 +16946,12 @@ var MultiSelectButton = (0, import_react93.forwardRef)(function MultiSelectButto
|
|
|
17175
16946
|
const { config, layout } = context;
|
|
17176
16947
|
const { setIds } = config;
|
|
17177
16948
|
const { registerTrigger } = layout;
|
|
17178
|
-
(0,
|
|
16949
|
+
(0, import_react84.useEffect)(() => {
|
|
17179
16950
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
17180
16951
|
}, [id, setIds]);
|
|
17181
|
-
const innerRef = (0,
|
|
17182
|
-
(0,
|
|
17183
|
-
(0,
|
|
16952
|
+
const innerRef = (0, import_react84.useRef)(null);
|
|
16953
|
+
(0, import_react84.useImperativeHandle)(ref, () => innerRef.current);
|
|
16954
|
+
(0, import_react84.useEffect)(() => {
|
|
17184
16955
|
const unregister = registerTrigger(innerRef);
|
|
17185
16956
|
return () => unregister();
|
|
17186
16957
|
}, [registerTrigger]);
|
|
@@ -17243,23 +17014,23 @@ var MultiSelectButton = (0, import_react93.forwardRef)(function MultiSelectButto
|
|
|
17243
17014
|
});
|
|
17244
17015
|
|
|
17245
17016
|
// src/components/user-interaction/MultiSelect/MultiSelectContent.tsx
|
|
17246
|
-
var
|
|
17017
|
+
var import_react85 = require("react");
|
|
17247
17018
|
var import_clsx26 = __toESM(require("clsx"));
|
|
17248
17019
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
17249
|
-
var MultiSelectContent = (0,
|
|
17020
|
+
var MultiSelectContent = (0, import_react85.forwardRef)(function MultiSelectContent2({ id, options, showSearch: showSearchOverride, searchInputProps, ...props }, ref) {
|
|
17250
17021
|
const translation = useHightideTranslation();
|
|
17251
|
-
const innerRef = (0,
|
|
17252
|
-
const searchInputRef = (0,
|
|
17253
|
-
(0,
|
|
17022
|
+
const innerRef = (0, import_react85.useRef)(null);
|
|
17023
|
+
const searchInputRef = (0, import_react85.useRef)(null);
|
|
17024
|
+
(0, import_react85.useImperativeHandle)(ref, () => innerRef.current);
|
|
17254
17025
|
const context = useMultiSelectContext();
|
|
17255
17026
|
const { config, highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId, handleTypeaheadKey, toggleSelection } = context;
|
|
17256
17027
|
const { setIds } = config;
|
|
17257
|
-
(0,
|
|
17028
|
+
(0, import_react85.useEffect)(() => {
|
|
17258
17029
|
if (id) setIds((prev) => ({ ...prev, content: id }));
|
|
17259
17030
|
}, [id, setIds]);
|
|
17260
17031
|
const showSearch = showSearchOverride ?? context.search.hasSearch;
|
|
17261
17032
|
const listboxAriaLabel = showSearch ? translation("searchResults") : void 0;
|
|
17262
|
-
const keyHandler = (0,
|
|
17033
|
+
const keyHandler = (0, import_react85.useCallback)(
|
|
17263
17034
|
(event) => {
|
|
17264
17035
|
switch (event.key) {
|
|
17265
17036
|
case "ArrowDown":
|
|
@@ -17373,7 +17144,7 @@ var MultiSelectContent = (0, import_react94.forwardRef)(function MultiSelectCont
|
|
|
17373
17144
|
|
|
17374
17145
|
// src/components/user-interaction/MultiSelect/MultiSelect.tsx
|
|
17375
17146
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
17376
|
-
var MultiSelect = (0,
|
|
17147
|
+
var MultiSelect = (0, import_react86.forwardRef)(
|
|
17377
17148
|
function MultiSelect2({ children, contentPanelProps, buttonProps, ...props }, ref) {
|
|
17378
17149
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(MultiSelectRoot, { ...props, children: [
|
|
17379
17150
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MultiSelectButton, { ref, ...buttonProps }),
|
|
@@ -17399,14 +17170,13 @@ var FilterOperatorLabel = ({ operator }) => {
|
|
|
17399
17170
|
|
|
17400
17171
|
// src/components/user-interaction/data/FilterPopUp.tsx
|
|
17401
17172
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
17402
|
-
var FilterBasePopUp = (0,
|
|
17173
|
+
var FilterBasePopUp = (0, import_react87.forwardRef)(function FilterBasePopUp2({
|
|
17403
17174
|
children,
|
|
17404
17175
|
name,
|
|
17405
17176
|
operator,
|
|
17406
17177
|
onOperatorChange,
|
|
17407
17178
|
onRemove,
|
|
17408
17179
|
allowedOperators,
|
|
17409
|
-
hasValue,
|
|
17410
17180
|
noParameterRequired = false,
|
|
17411
17181
|
...props
|
|
17412
17182
|
}, ref) {
|
|
@@ -17436,28 +17206,30 @@ var FilterBasePopUp = (0, import_react96.forwardRef)(function FilterBasePopUp2({
|
|
|
17436
17206
|
}
|
|
17437
17207
|
)
|
|
17438
17208
|
] }),
|
|
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
|
-
|
|
17209
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex-row-0 items-center", children: [
|
|
17210
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
17211
|
+
IconButton,
|
|
17212
|
+
{
|
|
17213
|
+
tooltip: translation("removeFilter"),
|
|
17214
|
+
onClick: onRemove,
|
|
17215
|
+
color: "negative",
|
|
17216
|
+
coloringStyle: "text",
|
|
17217
|
+
size: "sm",
|
|
17218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react20.TrashIcon, { className: "size-4" })
|
|
17219
|
+
}
|
|
17220
|
+
),
|
|
17221
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
17222
|
+
IconButton,
|
|
17223
|
+
{
|
|
17224
|
+
tooltip: translation("close"),
|
|
17225
|
+
onClick: props.onClose,
|
|
17226
|
+
color: "neutral",
|
|
17227
|
+
coloringStyle: "text",
|
|
17228
|
+
size: "sm",
|
|
17229
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react20.XIcon, { className: "size-4" })
|
|
17230
|
+
}
|
|
17231
|
+
)
|
|
17232
|
+
] })
|
|
17461
17233
|
] }),
|
|
17462
17234
|
children,
|
|
17463
17235
|
/* @__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 +17237,7 @@ var FilterBasePopUp = (0, import_react96.forwardRef)(function FilterBasePopUp2({
|
|
|
17465
17237
|
}
|
|
17466
17238
|
);
|
|
17467
17239
|
});
|
|
17468
|
-
var TextFilterPopUp = (0,
|
|
17240
|
+
var TextFilterPopUp = (0, import_react87.forwardRef)(function TextFilterPopUp2({
|
|
17469
17241
|
name,
|
|
17470
17242
|
value,
|
|
17471
17243
|
onValueChange,
|
|
@@ -17473,12 +17245,12 @@ var TextFilterPopUp = (0, import_react96.forwardRef)(function TextFilterPopUp2({
|
|
|
17473
17245
|
...props
|
|
17474
17246
|
}, ref) {
|
|
17475
17247
|
const translation = useHightideTranslation();
|
|
17476
|
-
const id = (0,
|
|
17248
|
+
const id = (0, import_react87.useId)();
|
|
17477
17249
|
const ids = {
|
|
17478
17250
|
search: `text-filter-search-${id}`,
|
|
17479
17251
|
caseSensitive: `text-filter-case-sensitive-${id}`
|
|
17480
17252
|
};
|
|
17481
|
-
const operator = (0,
|
|
17253
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17482
17254
|
const suggestion = value?.operator ?? "contains";
|
|
17483
17255
|
if (!FilterOperatorUtils.typeCheck.text(suggestion)) {
|
|
17484
17256
|
return "contains";
|
|
@@ -17497,7 +17269,6 @@ var TextFilterPopUp = (0, import_react96.forwardRef)(function TextFilterPopUp2({
|
|
|
17497
17269
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "text", parameter, operator: newOperator }),
|
|
17498
17270
|
onRemove,
|
|
17499
17271
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.text,
|
|
17500
|
-
hasValue: !!value,
|
|
17501
17272
|
noParameterRequired: !needsParameterInput,
|
|
17502
17273
|
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(Visibility, { isVisible: needsParameterInput, children: [
|
|
17503
17274
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex-col-1", children: [
|
|
@@ -17540,7 +17311,7 @@ var TextFilterPopUp = (0, import_react96.forwardRef)(function TextFilterPopUp2({
|
|
|
17540
17311
|
}
|
|
17541
17312
|
);
|
|
17542
17313
|
});
|
|
17543
|
-
var NumberFilterPopUp = (0,
|
|
17314
|
+
var NumberFilterPopUp = (0, import_react87.forwardRef)(function NumberFilterPopUp2({
|
|
17544
17315
|
name,
|
|
17545
17316
|
value,
|
|
17546
17317
|
onValueChange,
|
|
@@ -17548,13 +17319,13 @@ var NumberFilterPopUp = (0, import_react96.forwardRef)(function NumberFilterPopU
|
|
|
17548
17319
|
...props
|
|
17549
17320
|
}, ref) {
|
|
17550
17321
|
const translation = useHightideTranslation();
|
|
17551
|
-
const id = (0,
|
|
17322
|
+
const id = (0, import_react87.useId)();
|
|
17552
17323
|
const ids = {
|
|
17553
17324
|
min: `number-filter-min-${id}`,
|
|
17554
17325
|
max: `number-filter-max-${id}`,
|
|
17555
17326
|
compareValue: `number-filter-compare-value-${id}`
|
|
17556
17327
|
};
|
|
17557
|
-
const operator = (0,
|
|
17328
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17558
17329
|
const suggestion = value?.operator ?? "between";
|
|
17559
17330
|
if (!FilterOperatorUtils.typeCheck.number(suggestion)) {
|
|
17560
17331
|
return "between";
|
|
@@ -17576,7 +17347,6 @@ var NumberFilterPopUp = (0, import_react96.forwardRef)(function NumberFilterPopU
|
|
|
17576
17347
|
},
|
|
17577
17348
|
onRemove,
|
|
17578
17349
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.number,
|
|
17579
|
-
hasValue: !!value,
|
|
17580
17350
|
noParameterRequired: !needsParameterInput,
|
|
17581
17351
|
children: [
|
|
17582
17352
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(Visibility, { isVisible: needsRangeInput, children: [
|
|
@@ -17644,7 +17414,7 @@ var NumberFilterPopUp = (0, import_react96.forwardRef)(function NumberFilterPopU
|
|
|
17644
17414
|
}
|
|
17645
17415
|
);
|
|
17646
17416
|
});
|
|
17647
|
-
var DateFilterPopUp = (0,
|
|
17417
|
+
var DateFilterPopUp = (0, import_react87.forwardRef)(function DateFilterPopUp2({
|
|
17648
17418
|
name,
|
|
17649
17419
|
value,
|
|
17650
17420
|
onValueChange,
|
|
@@ -17652,13 +17422,13 @@ var DateFilterPopUp = (0, import_react96.forwardRef)(function DateFilterPopUp2({
|
|
|
17652
17422
|
...props
|
|
17653
17423
|
}, ref) {
|
|
17654
17424
|
const translation = useHightideTranslation();
|
|
17655
|
-
const id = (0,
|
|
17425
|
+
const id = (0, import_react87.useId)();
|
|
17656
17426
|
const ids = {
|
|
17657
17427
|
startDate: `date-filter-start-date-${id}`,
|
|
17658
17428
|
endDate: `date-filter-end-date-${id}`,
|
|
17659
17429
|
compareDate: `date-filter-compare-date-${id}`
|
|
17660
17430
|
};
|
|
17661
|
-
const operator = (0,
|
|
17431
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17662
17432
|
const suggestion = value?.operator ?? "between";
|
|
17663
17433
|
if (!FilterOperatorUtils.typeCheck.date(suggestion)) {
|
|
17664
17434
|
return "between";
|
|
@@ -17666,8 +17436,8 @@ var DateFilterPopUp = (0, import_react96.forwardRef)(function DateFilterPopUp2({
|
|
|
17666
17436
|
return suggestion;
|
|
17667
17437
|
}, [value]);
|
|
17668
17438
|
const parameter = value?.parameter ?? {};
|
|
17669
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0,
|
|
17670
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = (0,
|
|
17439
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0, import_react87.useState)(null);
|
|
17440
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = (0, import_react87.useState)(null);
|
|
17671
17441
|
const needsRangeInput = operator === "between" || operator === "notBetween";
|
|
17672
17442
|
const needsParameterInput = operator !== "isUndefined" && operator !== "isNotUndefined";
|
|
17673
17443
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
@@ -17680,7 +17450,6 @@ var DateFilterPopUp = (0, import_react96.forwardRef)(function DateFilterPopUp2({
|
|
|
17680
17450
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "date", parameter, operator: newOperator }),
|
|
17681
17451
|
onRemove,
|
|
17682
17452
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.date,
|
|
17683
|
-
hasValue: !!value,
|
|
17684
17453
|
noParameterRequired: !needsParameterInput,
|
|
17685
17454
|
children: [
|
|
17686
17455
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(Visibility, { isVisible: needsRangeInput, children: [
|
|
@@ -17787,7 +17556,7 @@ var DateFilterPopUp = (0, import_react96.forwardRef)(function DateFilterPopUp2({
|
|
|
17787
17556
|
}
|
|
17788
17557
|
);
|
|
17789
17558
|
});
|
|
17790
|
-
var DatetimeFilterPopUp = (0,
|
|
17559
|
+
var DatetimeFilterPopUp = (0, import_react87.forwardRef)(function DatetimeFilterPopUp2({
|
|
17791
17560
|
name,
|
|
17792
17561
|
value,
|
|
17793
17562
|
onValueChange,
|
|
@@ -17795,13 +17564,13 @@ var DatetimeFilterPopUp = (0, import_react96.forwardRef)(function DatetimeFilter
|
|
|
17795
17564
|
...props
|
|
17796
17565
|
}, ref) {
|
|
17797
17566
|
const translation = useHightideTranslation();
|
|
17798
|
-
const id = (0,
|
|
17567
|
+
const id = (0, import_react87.useId)();
|
|
17799
17568
|
const ids = {
|
|
17800
17569
|
startDate: `datetime-filter-start-date-${id}`,
|
|
17801
17570
|
endDate: `datetime-filter-end-date-${id}`,
|
|
17802
17571
|
compareDate: `datetime-filter-compare-date-${id}`
|
|
17803
17572
|
};
|
|
17804
|
-
const operator = (0,
|
|
17573
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17805
17574
|
const suggestion = value?.operator ?? "between";
|
|
17806
17575
|
if (!FilterOperatorUtils.typeCheck.datetime(suggestion)) {
|
|
17807
17576
|
return "between";
|
|
@@ -17809,8 +17578,8 @@ var DatetimeFilterPopUp = (0, import_react96.forwardRef)(function DatetimeFilter
|
|
|
17809
17578
|
return suggestion;
|
|
17810
17579
|
}, [value]);
|
|
17811
17580
|
const parameter = value?.parameter ?? {};
|
|
17812
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0,
|
|
17813
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = (0,
|
|
17581
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = (0, import_react87.useState)(null);
|
|
17582
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = (0, import_react87.useState)(null);
|
|
17814
17583
|
const needsRangeInput = operator === "between" || operator === "notBetween";
|
|
17815
17584
|
const needsParameterInput = operator !== "isUndefined" && operator !== "isNotUndefined";
|
|
17816
17585
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
@@ -17823,7 +17592,6 @@ var DatetimeFilterPopUp = (0, import_react96.forwardRef)(function DatetimeFilter
|
|
|
17823
17592
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "dateTime", parameter, operator: newOperator }),
|
|
17824
17593
|
onRemove,
|
|
17825
17594
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.dateTime,
|
|
17826
|
-
hasValue: !!value,
|
|
17827
17595
|
children: [
|
|
17828
17596
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17829
17597
|
/* @__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 +17698,14 @@ var DatetimeFilterPopUp = (0, import_react96.forwardRef)(function DatetimeFilter
|
|
|
17930
17698
|
}
|
|
17931
17699
|
);
|
|
17932
17700
|
});
|
|
17933
|
-
var BooleanFilterPopUp = (0,
|
|
17701
|
+
var BooleanFilterPopUp = (0, import_react87.forwardRef)(function BooleanFilterPopUp2({
|
|
17934
17702
|
name,
|
|
17935
17703
|
value,
|
|
17936
17704
|
onValueChange,
|
|
17937
17705
|
onRemove,
|
|
17938
17706
|
...props
|
|
17939
17707
|
}, ref) {
|
|
17940
|
-
const operator = (0,
|
|
17708
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17941
17709
|
const suggestion = value?.operator ?? "isTrue";
|
|
17942
17710
|
if (!FilterOperatorUtils.typeCheck.boolean(suggestion)) {
|
|
17943
17711
|
return "isTrue";
|
|
@@ -17954,12 +17722,11 @@ var BooleanFilterPopUp = (0, import_react96.forwardRef)(function BooleanFilterPo
|
|
|
17954
17722
|
operator,
|
|
17955
17723
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "boolean", parameter, operator: newOperator }),
|
|
17956
17724
|
onRemove,
|
|
17957
|
-
allowedOperators: FilterOperatorUtils.operatorsByCategory.boolean
|
|
17958
|
-
hasValue: !!value
|
|
17725
|
+
allowedOperators: FilterOperatorUtils.operatorsByCategory.boolean
|
|
17959
17726
|
}
|
|
17960
17727
|
);
|
|
17961
17728
|
});
|
|
17962
|
-
var TagsFilterPopUp = (0,
|
|
17729
|
+
var TagsFilterPopUp = (0, import_react87.forwardRef)(function TagsFilterPopUp2({
|
|
17963
17730
|
name,
|
|
17964
17731
|
value,
|
|
17965
17732
|
onValueChange,
|
|
@@ -17968,7 +17735,7 @@ var TagsFilterPopUp = (0, import_react96.forwardRef)(function TagsFilterPopUp2({
|
|
|
17968
17735
|
...props
|
|
17969
17736
|
}, ref) {
|
|
17970
17737
|
const translation = useHightideTranslation();
|
|
17971
|
-
const operator = (0,
|
|
17738
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
17972
17739
|
const suggestion = value?.operator ?? "contains";
|
|
17973
17740
|
if (!FilterOperatorUtils.typeCheck.tags(suggestion)) {
|
|
17974
17741
|
return "contains";
|
|
@@ -17991,7 +17758,6 @@ var TagsFilterPopUp = (0, import_react96.forwardRef)(function TagsFilterPopUp2({
|
|
|
17991
17758
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "multiTags", parameter, operator: newOperator }),
|
|
17992
17759
|
onRemove,
|
|
17993
17760
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.multiTags,
|
|
17994
|
-
hasValue: !!value,
|
|
17995
17761
|
children: [
|
|
17996
17762
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
17997
17763
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Visibility, { isVisible: needsParameterInput, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
@@ -18014,7 +17780,7 @@ var TagsFilterPopUp = (0, import_react96.forwardRef)(function TagsFilterPopUp2({
|
|
|
18014
17780
|
}
|
|
18015
17781
|
);
|
|
18016
17782
|
});
|
|
18017
|
-
var TagsSingleFilterPopUp = (0,
|
|
17783
|
+
var TagsSingleFilterPopUp = (0, import_react87.forwardRef)(function TagsSingleFilterPopUp2({
|
|
18018
17784
|
name,
|
|
18019
17785
|
value,
|
|
18020
17786
|
onValueChange,
|
|
@@ -18023,7 +17789,7 @@ var TagsSingleFilterPopUp = (0, import_react96.forwardRef)(function TagsSingleFi
|
|
|
18023
17789
|
...props
|
|
18024
17790
|
}, ref) {
|
|
18025
17791
|
const translation = useHightideTranslation();
|
|
18026
|
-
const operator = (0,
|
|
17792
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
18027
17793
|
const suggestion = value?.operator ?? "contains";
|
|
18028
17794
|
if (!FilterOperatorUtils.typeCheck.tagsSingle(suggestion)) {
|
|
18029
17795
|
return "contains";
|
|
@@ -18048,7 +17814,6 @@ var TagsSingleFilterPopUp = (0, import_react96.forwardRef)(function TagsSingleFi
|
|
|
18048
17814
|
onOperatorChange: (newOperator) => onValueChange({ dataType: "singleTag", parameter, operator: newOperator }),
|
|
18049
17815
|
onRemove,
|
|
18050
17816
|
allowedOperators: FilterOperatorUtils.operatorsByCategory.singleTag,
|
|
18051
|
-
hasValue: !!value,
|
|
18052
17817
|
children: [
|
|
18053
17818
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
18054
17819
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Visibility, { isVisible: needsParameterInput && needsMultiSelect, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
@@ -18086,8 +17851,8 @@ var TagsSingleFilterPopUp = (0, import_react96.forwardRef)(function TagsSingleFi
|
|
|
18086
17851
|
}
|
|
18087
17852
|
);
|
|
18088
17853
|
});
|
|
18089
|
-
var GenericFilterPopUp = (0,
|
|
18090
|
-
const operator = (0,
|
|
17854
|
+
var GenericFilterPopUp = (0, import_react87.forwardRef)(function GenericFilterPopUp2({ name, value, onValueChange, ...props }, ref) {
|
|
17855
|
+
const operator = (0, import_react87.useMemo)(() => {
|
|
18091
17856
|
const suggestion = value?.operator ?? "isNotUndefined";
|
|
18092
17857
|
if (!FilterOperatorUtils.typeCheck.unknownType(suggestion)) {
|
|
18093
17858
|
return "isNotUndefined";
|
|
@@ -18103,12 +17868,11 @@ var GenericFilterPopUp = (0, import_react96.forwardRef)(function GenericFilterPo
|
|
|
18103
17868
|
operator,
|
|
18104
17869
|
onOperatorChange: (newOperator) => onValueChange({ ...value, operator: newOperator }),
|
|
18105
17870
|
onRemove: () => onValueChange({ ...value, operator: void 0 }),
|
|
18106
|
-
allowedOperators: FilterOperatorUtils.operatorsByCategory.unknownType
|
|
18107
|
-
hasValue: !!value
|
|
17871
|
+
allowedOperators: FilterOperatorUtils.operatorsByCategory.unknownType
|
|
18108
17872
|
}
|
|
18109
17873
|
);
|
|
18110
17874
|
});
|
|
18111
|
-
var FilterPopUp = (0,
|
|
17875
|
+
var FilterPopUp = (0, import_react87.forwardRef)(function FilterPopUp2({
|
|
18112
17876
|
name,
|
|
18113
17877
|
value,
|
|
18114
17878
|
onValueChange,
|
|
@@ -18145,18 +17909,18 @@ var TableFilterButton = ({
|
|
|
18145
17909
|
const translation = useHightideTranslation();
|
|
18146
17910
|
const column = header.column;
|
|
18147
17911
|
const columnFilterValue = column.getFilterValue();
|
|
18148
|
-
const [filterValue, setFilterValue] = (0,
|
|
17912
|
+
const [filterValue, setFilterValue] = (0, import_react88.useState)(columnFilterValue);
|
|
18149
17913
|
const hasFilter = !!filterValue;
|
|
18150
|
-
const anchorRef = (0,
|
|
18151
|
-
const containerRef = (0,
|
|
18152
|
-
const [isOpen, setIsOpen] = (0,
|
|
18153
|
-
const id = (0,
|
|
18154
|
-
const ids = (0,
|
|
17914
|
+
const anchorRef = (0, import_react88.useRef)(null);
|
|
17915
|
+
const containerRef = (0, import_react88.useRef)(null);
|
|
17916
|
+
const [isOpen, setIsOpen] = (0, import_react88.useState)(false);
|
|
17917
|
+
const id = (0, import_react88.useId)();
|
|
17918
|
+
const ids = (0, import_react88.useMemo)(() => ({
|
|
18155
17919
|
button: `table-filter-button-${id}`,
|
|
18156
17920
|
popup: `table-filter-popup-${id}`,
|
|
18157
17921
|
label: `table-filter-label-${id}`
|
|
18158
17922
|
}), [id]);
|
|
18159
|
-
(0,
|
|
17923
|
+
(0, import_react88.useEffect)(() => {
|
|
18160
17924
|
setFilterValue(columnFilterValue);
|
|
18161
17925
|
}, [columnFilterValue]);
|
|
18162
17926
|
const isTagsFilter = filterType === "multiTags" || filterType === "singleTag";
|
|
@@ -18217,7 +17981,7 @@ var TableFilterButton = ({
|
|
|
18217
17981
|
};
|
|
18218
17982
|
|
|
18219
17983
|
// src/components/layout/table/TableHeader.tsx
|
|
18220
|
-
var
|
|
17984
|
+
var import_react89 = require("react");
|
|
18221
17985
|
|
|
18222
17986
|
// src/components/user-interaction/data/data-types.tsx
|
|
18223
17987
|
var import_lucide_react22 = require("lucide-react");
|
|
@@ -18281,7 +18045,7 @@ var DataTypeUtils = {
|
|
|
18281
18045
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
18282
18046
|
var TableHeader = ({ isSticky = false }) => {
|
|
18283
18047
|
const { table } = useTableStateWithoutSizingContext();
|
|
18284
|
-
const handleResizeMove = (0,
|
|
18048
|
+
const handleResizeMove = (0, import_react89.useCallback)((e) => {
|
|
18285
18049
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
18286
18050
|
const currentX = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
18287
18051
|
const deltaOffset = currentX - (table.getState().columnSizingInfo.startOffset ?? 0);
|
|
@@ -18297,7 +18061,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
18297
18061
|
deltaOffset
|
|
18298
18062
|
}));
|
|
18299
18063
|
}, [table]);
|
|
18300
|
-
const handleResizeEnd = (0,
|
|
18064
|
+
const handleResizeEnd = (0, import_react89.useCallback)(() => {
|
|
18301
18065
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
18302
18066
|
const newWidth = (table.getState().columnSizingInfo.startSize ?? 0) + (table.getState().columnSizingInfo.deltaOffset ?? 0);
|
|
18303
18067
|
table.setColumnSizing((prev) => {
|
|
@@ -18315,7 +18079,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
18315
18079
|
startSize: null
|
|
18316
18080
|
});
|
|
18317
18081
|
}, [table]);
|
|
18318
|
-
(0,
|
|
18082
|
+
(0, import_react89.useEffect)(() => {
|
|
18319
18083
|
window.addEventListener("pointermove", handleResizeMove);
|
|
18320
18084
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
18321
18085
|
return () => {
|
|
@@ -18344,7 +18108,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
18344
18108
|
"data-name": "table-header-cell",
|
|
18345
18109
|
className: (0, import_clsx28.default)("group/table-header-cell", header.column.columnDef.meta?.className),
|
|
18346
18110
|
children: [
|
|
18347
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Visibility, { isVisible: !header.isPlaceholder, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex-row-1 items-center", children: [
|
|
18111
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Visibility, { isVisible: !header.isPlaceholder, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex-row-1 items-center truncate", children: [
|
|
18348
18112
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Visibility, { isVisible: header.column.getCanSort(), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
18349
18113
|
TableSortButton,
|
|
18350
18114
|
{
|
|
@@ -18484,7 +18248,7 @@ var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props
|
|
|
18484
18248
|
};
|
|
18485
18249
|
|
|
18486
18250
|
// src/components/layout/table/TableWithSelectionProvider.tsx
|
|
18487
|
-
var
|
|
18251
|
+
var import_react90 = require("react");
|
|
18488
18252
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
18489
18253
|
var TableWithSelectionProvider = ({
|
|
18490
18254
|
children,
|
|
@@ -18497,7 +18261,7 @@ var TableWithSelectionProvider = ({
|
|
|
18497
18261
|
...props
|
|
18498
18262
|
}) => {
|
|
18499
18263
|
const translation = useHightideTranslation();
|
|
18500
|
-
const columnDef = (0,
|
|
18264
|
+
const columnDef = (0, import_react90.useMemo)(() => [
|
|
18501
18265
|
{
|
|
18502
18266
|
id: selectionRowId,
|
|
18503
18267
|
header: ({ table }) => {
|
|
@@ -18540,7 +18304,7 @@ var TableWithSelectionProvider = ({
|
|
|
18540
18304
|
TableProvider,
|
|
18541
18305
|
{
|
|
18542
18306
|
...props,
|
|
18543
|
-
fillerRowCell: (0,
|
|
18307
|
+
fillerRowCell: (0, import_react90.useCallback)((columnId, table) => {
|
|
18544
18308
|
if (columnId === selectionRowId) {
|
|
18545
18309
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Checkbox, { value: false, disabled: true });
|
|
18546
18310
|
}
|
|
@@ -18558,7 +18322,7 @@ var TableWithSelectionProvider = ({
|
|
|
18558
18322
|
rowSelection,
|
|
18559
18323
|
...state
|
|
18560
18324
|
},
|
|
18561
|
-
onRowClick: (0,
|
|
18325
|
+
onRowClick: (0, import_react90.useCallback)((row, table) => {
|
|
18562
18326
|
if (!disableClickRowClickSelection) {
|
|
18563
18327
|
row.toggleSelected();
|
|
18564
18328
|
}
|
|
@@ -18600,7 +18364,7 @@ var TableWithSelection = ({
|
|
|
18600
18364
|
};
|
|
18601
18365
|
|
|
18602
18366
|
// src/components/layout/table/TableColumn.tsx
|
|
18603
|
-
var
|
|
18367
|
+
var import_react91 = require("react");
|
|
18604
18368
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
18605
18369
|
var TableColumnComponent = ({
|
|
18606
18370
|
filterType,
|
|
@@ -18612,11 +18376,11 @@ var TableColumnComponent = ({
|
|
|
18612
18376
|
"TableColumn: For filterType === multiTags or singleTag, filterData.tags must be set.",
|
|
18613
18377
|
(filterType === "multiTags" || filterType === "singleTag") && props.meta?.filterData?.tags === void 0
|
|
18614
18378
|
);
|
|
18615
|
-
const [column] = (0,
|
|
18379
|
+
const [column] = (0, import_react91.useState)({
|
|
18616
18380
|
...props,
|
|
18617
18381
|
filterFn
|
|
18618
18382
|
});
|
|
18619
|
-
(0,
|
|
18383
|
+
(0, import_react91.useEffect)(() => {
|
|
18620
18384
|
const unsubscribe = registerColumn(column);
|
|
18621
18385
|
return () => {
|
|
18622
18386
|
unsubscribe();
|
|
@@ -18624,34 +18388,36 @@ var TableColumnComponent = ({
|
|
|
18624
18388
|
}, [registerColumn, column]);
|
|
18625
18389
|
return null;
|
|
18626
18390
|
};
|
|
18627
|
-
var TableColumnFactory = () => (0,
|
|
18391
|
+
var TableColumnFactory = () => (0, import_react91.memo)(
|
|
18628
18392
|
TableColumnComponent,
|
|
18629
18393
|
(prevProps, nextProps) => {
|
|
18630
18394
|
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
18395
|
}
|
|
18632
18396
|
);
|
|
18633
18397
|
var TableColumn = (props) => {
|
|
18634
|
-
const TableColumnComponent2 = (0,
|
|
18398
|
+
const TableColumnComponent2 = (0, import_react91.useMemo)(() => TableColumnFactory(), []);
|
|
18635
18399
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TableColumnComponent2, { ...props });
|
|
18636
18400
|
};
|
|
18637
18401
|
|
|
18638
18402
|
// src/components/layout/table/TableColumnSwitcher.tsx
|
|
18639
|
-
var
|
|
18403
|
+
var import_react92 = require("react");
|
|
18640
18404
|
var import_lucide_react23 = require("lucide-react");
|
|
18641
18405
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
18642
18406
|
var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
18643
18407
|
const { table } = useTableStateWithoutSizingContext();
|
|
18644
18408
|
const translation = useHightideTranslation();
|
|
18645
|
-
const containerRef = (0,
|
|
18646
|
-
const generatedId = (0,
|
|
18647
|
-
const ids = (0,
|
|
18409
|
+
const containerRef = (0, import_react92.useRef)(null);
|
|
18410
|
+
const generatedId = (0, import_react92.useId)();
|
|
18411
|
+
const ids = (0, import_react92.useMemo)(() => ({
|
|
18648
18412
|
popup: props.id ?? `table-column-picker-popup-${generatedId}`,
|
|
18649
18413
|
label: `table-column-picker-label-${generatedId}`
|
|
18650
18414
|
}), [generatedId, props.id]);
|
|
18415
|
+
const enableHiding = table.options.enableHiding !== false;
|
|
18416
|
+
const enableColumnPinning = table.options.enableColumnPinning !== false;
|
|
18651
18417
|
const tableState = table.getState();
|
|
18652
18418
|
const columnOrder = tableState.columnOrder;
|
|
18653
18419
|
const columnPinning = tableState.columnPinning;
|
|
18654
|
-
const columns = (0,
|
|
18420
|
+
const columns = (0, import_react92.useMemo)(() => {
|
|
18655
18421
|
const allColumns = table.getAllColumns();
|
|
18656
18422
|
const leftPinned = [];
|
|
18657
18423
|
const unpinned = [];
|
|
@@ -18852,7 +18618,7 @@ var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
|
18852
18618
|
] }) }),
|
|
18853
18619
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "flex-1 typography-label-lg", children: getColumnHeader(columnId) }),
|
|
18854
18620
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
18855
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
18621
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Visibility, { isVisible: enableHiding, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
18856
18622
|
IconButton,
|
|
18857
18623
|
{
|
|
18858
18624
|
tooltip: translation("changeVisibility"),
|
|
@@ -18864,8 +18630,8 @@ var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
|
18864
18630
|
"aria-label": isVisible ? translation("hideColumn") : translation("showColumn"),
|
|
18865
18631
|
children: isVisible ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react23.Eye, { className: "size-4" }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react23.EyeOff, { className: "size-4" })
|
|
18866
18632
|
}
|
|
18867
|
-
),
|
|
18868
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
18633
|
+
) }),
|
|
18634
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Visibility, { isVisible: enableColumnPinning, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
18869
18635
|
IconButton,
|
|
18870
18636
|
{
|
|
18871
18637
|
tooltip: translation("changePinning"),
|
|
@@ -18883,7 +18649,7 @@ var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
|
18883
18649
|
"aria-label": isPinned ? translation("unpin") : translation("pinLeft"),
|
|
18884
18650
|
children: !isPinned ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react23.PinOff, { className: "size-4" }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react23.Pin, { className: "size-4" })
|
|
18885
18651
|
}
|
|
18886
|
-
)
|
|
18652
|
+
) })
|
|
18887
18653
|
] })
|
|
18888
18654
|
] }, columnId);
|
|
18889
18655
|
}) })
|
|
@@ -18901,7 +18667,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
18901
18667
|
color: "neutral",
|
|
18902
18668
|
tooltip: translation("changeColumnDisplay"),
|
|
18903
18669
|
...buttonProps,
|
|
18904
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react23.
|
|
18670
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react23.Columns3Cog, { className: "size-5" })
|
|
18905
18671
|
}
|
|
18906
18672
|
) }),
|
|
18907
18673
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TableColumnSwitcherPopUp, { ...props })
|
|
@@ -18909,16 +18675,16 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
18909
18675
|
};
|
|
18910
18676
|
|
|
18911
18677
|
// src/components/user-interaction/Combobox/Combobox.tsx
|
|
18912
|
-
var
|
|
18678
|
+
var import_react98 = require("react");
|
|
18913
18679
|
|
|
18914
18680
|
// src/components/user-interaction/Combobox/ComboboxRoot.tsx
|
|
18915
|
-
var
|
|
18681
|
+
var import_react95 = require("react");
|
|
18916
18682
|
|
|
18917
18683
|
// src/components/user-interaction/Combobox/ComboboxContext.tsx
|
|
18918
|
-
var
|
|
18919
|
-
var ComboboxContext = (0,
|
|
18684
|
+
var import_react93 = require("react");
|
|
18685
|
+
var ComboboxContext = (0, import_react93.createContext)(null);
|
|
18920
18686
|
function useComboboxContext() {
|
|
18921
|
-
const ctx = (0,
|
|
18687
|
+
const ctx = (0, import_react93.useContext)(ComboboxContext);
|
|
18922
18688
|
if (ctx == null) {
|
|
18923
18689
|
throw new Error("useComboboxContext must be used within ComboboxRoot");
|
|
18924
18690
|
}
|
|
@@ -18926,7 +18692,7 @@ function useComboboxContext() {
|
|
|
18926
18692
|
}
|
|
18927
18693
|
|
|
18928
18694
|
// src/components/user-interaction/Combobox/useCombobox.ts
|
|
18929
|
-
var
|
|
18695
|
+
var import_react94 = require("react");
|
|
18930
18696
|
function useCombobox({
|
|
18931
18697
|
options,
|
|
18932
18698
|
searchQuery: controlledSearchQuery,
|
|
@@ -18941,36 +18707,36 @@ function useCombobox({
|
|
|
18941
18707
|
const { searchResult: visibleOptions } = useSearch({
|
|
18942
18708
|
items: options,
|
|
18943
18709
|
searchQuery: searchQuery ?? "",
|
|
18944
|
-
toTags: (0,
|
|
18710
|
+
toTags: (0, import_react94.useCallback)((o) => [o.label], [])
|
|
18945
18711
|
});
|
|
18946
|
-
const visibleOptionIds = (0,
|
|
18712
|
+
const visibleOptionIds = (0, import_react94.useMemo)(
|
|
18947
18713
|
() => visibleOptions.map((o) => o.id),
|
|
18948
18714
|
[visibleOptions]
|
|
18949
18715
|
);
|
|
18950
|
-
const enabledOptionIds = (0,
|
|
18716
|
+
const enabledOptionIds = (0, import_react94.useMemo)(
|
|
18951
18717
|
() => visibleOptions.filter((o) => !o.disabled).map((o) => o.id),
|
|
18952
18718
|
[visibleOptions]
|
|
18953
18719
|
);
|
|
18954
18720
|
const listNav = useListNavigation({ options: enabledOptionIds });
|
|
18955
|
-
const highlightItem = (0,
|
|
18721
|
+
const highlightItem = (0, import_react94.useCallback)(
|
|
18956
18722
|
(id) => {
|
|
18957
18723
|
if (!enabledOptionIds.includes(id)) return;
|
|
18958
18724
|
listNav.highlight(id);
|
|
18959
18725
|
},
|
|
18960
18726
|
[enabledOptionIds, listNav]
|
|
18961
18727
|
);
|
|
18962
|
-
const state = (0,
|
|
18728
|
+
const state = (0, import_react94.useMemo)(
|
|
18963
18729
|
() => ({
|
|
18964
18730
|
searchQuery: searchQuery ?? "",
|
|
18965
18731
|
highlightedId: listNav.highlightedId
|
|
18966
18732
|
}),
|
|
18967
18733
|
[searchQuery, listNav.highlightedId]
|
|
18968
18734
|
);
|
|
18969
|
-
const computedState = (0,
|
|
18735
|
+
const computedState = (0, import_react94.useMemo)(
|
|
18970
18736
|
() => ({ visibleOptionIds }),
|
|
18971
18737
|
[visibleOptionIds]
|
|
18972
18738
|
);
|
|
18973
|
-
const actions = (0,
|
|
18739
|
+
const actions = (0, import_react94.useMemo)(
|
|
18974
18740
|
() => ({
|
|
18975
18741
|
setSearchQuery,
|
|
18976
18742
|
highlightFirst: listNav.first,
|
|
@@ -18981,7 +18747,7 @@ function useCombobox({
|
|
|
18981
18747
|
}),
|
|
18982
18748
|
[setSearchQuery, listNav.first, listNav.last, listNav.next, listNav.previous, highlightItem]
|
|
18983
18749
|
);
|
|
18984
|
-
return (0,
|
|
18750
|
+
return (0, import_react94.useMemo)(
|
|
18985
18751
|
() => ({
|
|
18986
18752
|
...state,
|
|
18987
18753
|
...computedState,
|
|
@@ -18998,14 +18764,14 @@ function ComboboxRoot({
|
|
|
18998
18764
|
onItemClick,
|
|
18999
18765
|
...hookProps
|
|
19000
18766
|
}) {
|
|
19001
|
-
const [options, setOptions] = (0,
|
|
19002
|
-
const [listRef, setListRef] = (0,
|
|
19003
|
-
const generatedId = (0,
|
|
19004
|
-
const [ids, setIds] = (0,
|
|
18767
|
+
const [options, setOptions] = (0, import_react95.useState)([]);
|
|
18768
|
+
const [listRef, setListRef] = (0, import_react95.useState)(null);
|
|
18769
|
+
const generatedId = (0, import_react95.useId)();
|
|
18770
|
+
const [ids, setIds] = (0, import_react95.useState)({
|
|
19005
18771
|
trigger: `combobox-${generatedId}`,
|
|
19006
18772
|
listbox: `combobox-${generatedId}-listbox`
|
|
19007
18773
|
});
|
|
19008
|
-
const registerOption = (0,
|
|
18774
|
+
const registerOption = (0, import_react95.useCallback)(
|
|
19009
18775
|
(option) => {
|
|
19010
18776
|
setOptions((prev) => {
|
|
19011
18777
|
const next = prev.filter((o) => o.id !== option.id);
|
|
@@ -19017,11 +18783,11 @@ function ComboboxRoot({
|
|
|
19017
18783
|
},
|
|
19018
18784
|
[]
|
|
19019
18785
|
);
|
|
19020
|
-
const registerList = (0,
|
|
18786
|
+
const registerList = (0, import_react95.useCallback)((ref) => {
|
|
19021
18787
|
setListRef(() => ref);
|
|
19022
18788
|
return () => setListRef(null);
|
|
19023
18789
|
}, []);
|
|
19024
|
-
const hookOptions = (0,
|
|
18790
|
+
const hookOptions = (0, import_react95.useMemo)(
|
|
19025
18791
|
() => options.map((o) => ({
|
|
19026
18792
|
id: o.id,
|
|
19027
18793
|
label: o.label,
|
|
@@ -19030,38 +18796,38 @@ function ComboboxRoot({
|
|
|
19030
18796
|
[options]
|
|
19031
18797
|
);
|
|
19032
18798
|
const state = useCombobox({ ...hookProps, options: hookOptions });
|
|
19033
|
-
const idToOptionMap = (0,
|
|
18799
|
+
const idToOptionMap = (0, import_react95.useMemo)(() => {
|
|
19034
18800
|
return options.reduce((acc, o) => {
|
|
19035
18801
|
acc[o.id] = o;
|
|
19036
18802
|
return acc;
|
|
19037
18803
|
}, {});
|
|
19038
18804
|
}, [options]);
|
|
19039
|
-
const selectOption = (0,
|
|
18805
|
+
const selectOption = (0, import_react95.useCallback)(
|
|
19040
18806
|
(id) => {
|
|
19041
18807
|
const option = idToOptionMap[id];
|
|
19042
18808
|
if (option) onItemClick?.(option.value);
|
|
19043
18809
|
},
|
|
19044
18810
|
[idToOptionMap, onItemClick]
|
|
19045
18811
|
);
|
|
19046
|
-
const config = (0,
|
|
18812
|
+
const config = (0, import_react95.useMemo)(
|
|
19047
18813
|
() => ({ ids, setIds }),
|
|
19048
18814
|
[ids, setIds]
|
|
19049
18815
|
);
|
|
19050
|
-
const layout = (0,
|
|
18816
|
+
const layout = (0, import_react95.useMemo)(
|
|
19051
18817
|
() => ({
|
|
19052
18818
|
listRef: listRef ?? { current: null },
|
|
19053
18819
|
registerList
|
|
19054
18820
|
}),
|
|
19055
18821
|
[listRef, registerList]
|
|
19056
18822
|
);
|
|
19057
|
-
const search = (0,
|
|
18823
|
+
const search = (0, import_react95.useMemo)(
|
|
19058
18824
|
() => ({
|
|
19059
18825
|
searchQuery: state.searchQuery,
|
|
19060
18826
|
setSearchQuery: state.setSearchQuery
|
|
19061
18827
|
}),
|
|
19062
18828
|
[state.searchQuery, state.setSearchQuery]
|
|
19063
18829
|
);
|
|
19064
|
-
const contextValue = (0,
|
|
18830
|
+
const contextValue = (0, import_react95.useMemo)(
|
|
19065
18831
|
() => ({
|
|
19066
18832
|
highlightedId: state.highlightedId,
|
|
19067
18833
|
options,
|
|
@@ -19099,14 +18865,14 @@ function ComboboxRoot({
|
|
|
19099
18865
|
}
|
|
19100
18866
|
|
|
19101
18867
|
// src/components/user-interaction/Combobox/ComboboxInput.tsx
|
|
19102
|
-
var
|
|
18868
|
+
var import_react96 = require("react");
|
|
19103
18869
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
19104
|
-
var ComboboxInput = (0,
|
|
18870
|
+
var ComboboxInput = (0, import_react96.forwardRef)(
|
|
19105
18871
|
function ComboboxInput2(props, ref) {
|
|
19106
18872
|
const translation = useHightideTranslation();
|
|
19107
18873
|
const context = useComboboxContext();
|
|
19108
18874
|
const { highlightNext, highlightPrevious, highlightFirst, highlightLast, highlightedId, selectOption } = context;
|
|
19109
|
-
const handleKeyDown = (0,
|
|
18875
|
+
const handleKeyDown = (0, import_react96.useCallback)(
|
|
19110
18876
|
(event) => {
|
|
19111
18877
|
props.onKeyDown?.(event);
|
|
19112
18878
|
switch (event.key) {
|
|
@@ -19158,17 +18924,17 @@ var ComboboxInput = (0, import_react105.forwardRef)(
|
|
|
19158
18924
|
);
|
|
19159
18925
|
|
|
19160
18926
|
// src/components/user-interaction/Combobox/ComboboxList.tsx
|
|
19161
|
-
var
|
|
18927
|
+
var import_react97 = require("react");
|
|
19162
18928
|
var import_clsx31 = __toESM(require("clsx"));
|
|
19163
18929
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
19164
|
-
var ComboboxList = (0,
|
|
18930
|
+
var ComboboxList = (0, import_react97.forwardRef)(
|
|
19165
18931
|
function ComboboxList2({ children, ...props }, ref) {
|
|
19166
18932
|
const translation = useHightideTranslation();
|
|
19167
18933
|
const context = useComboboxContext();
|
|
19168
18934
|
const { layout } = context;
|
|
19169
18935
|
const { registerList } = layout;
|
|
19170
|
-
const innerRef = (0,
|
|
19171
|
-
(0,
|
|
18936
|
+
const innerRef = (0, import_react97.useRef)(null);
|
|
18937
|
+
(0, import_react97.useEffect)(() => {
|
|
19172
18938
|
return registerList(innerRef);
|
|
19173
18939
|
}, [registerList]);
|
|
19174
18940
|
const setRefs = (node) => {
|
|
@@ -19210,7 +18976,7 @@ var ComboboxList = (0, import_react106.forwardRef)(
|
|
|
19210
18976
|
|
|
19211
18977
|
// src/components/user-interaction/Combobox/Combobox.tsx
|
|
19212
18978
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
19213
|
-
var Combobox = (0,
|
|
18979
|
+
var Combobox = (0, import_react98.forwardRef)(function Combobox2({
|
|
19214
18980
|
children,
|
|
19215
18981
|
onItemClick,
|
|
19216
18982
|
searchQuery,
|
|
@@ -19235,10 +19001,10 @@ var Combobox = (0, import_react107.forwardRef)(function Combobox2({
|
|
|
19235
19001
|
});
|
|
19236
19002
|
|
|
19237
19003
|
// src/components/user-interaction/Combobox/ComboboxOption.tsx
|
|
19238
|
-
var
|
|
19004
|
+
var import_react99 = require("react");
|
|
19239
19005
|
var import_clsx32 = __toESM(require("clsx"));
|
|
19240
19006
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
19241
|
-
var ComboboxOption = (0,
|
|
19007
|
+
var ComboboxOption = (0, import_react99.forwardRef)(function ComboboxOption2({
|
|
19242
19008
|
children,
|
|
19243
19009
|
value,
|
|
19244
19010
|
label,
|
|
@@ -19249,11 +19015,11 @@ var ComboboxOption = (0, import_react108.forwardRef)(function ComboboxOption2({
|
|
|
19249
19015
|
}, ref) {
|
|
19250
19016
|
const context = useComboboxContext();
|
|
19251
19017
|
const { registerOption } = context;
|
|
19252
|
-
const itemRef = (0,
|
|
19253
|
-
const generatedId = (0,
|
|
19018
|
+
const itemRef = (0, import_react99.useRef)(null);
|
|
19019
|
+
const generatedId = (0, import_react99.useId)();
|
|
19254
19020
|
const optionId = idProp ?? `combobox-option-${generatedId}`;
|
|
19255
19021
|
const resolvedDisplay = children ?? label;
|
|
19256
|
-
(0,
|
|
19022
|
+
(0, import_react99.useEffect)(() => {
|
|
19257
19023
|
return registerOption({
|
|
19258
19024
|
id: optionId,
|
|
19259
19025
|
value,
|
|
@@ -19263,7 +19029,7 @@ var ComboboxOption = (0, import_react108.forwardRef)(function ComboboxOption2({
|
|
|
19263
19029
|
ref: itemRef
|
|
19264
19030
|
});
|
|
19265
19031
|
}, [optionId, value, label, resolvedDisplay, disabled, registerOption]);
|
|
19266
|
-
(0,
|
|
19032
|
+
(0, import_react99.useEffect)(() => {
|
|
19267
19033
|
if (context.highlightedId === optionId) {
|
|
19268
19034
|
itemRef.current?.scrollIntoView?.({ behavior: "smooth", block: "nearest" });
|
|
19269
19035
|
}
|
|
@@ -19309,7 +19075,7 @@ var ComboboxOption = (0, import_react108.forwardRef)(function ComboboxOption2({
|
|
|
19309
19075
|
ComboboxOption.displayName = "ComboboxOption";
|
|
19310
19076
|
|
|
19311
19077
|
// src/components/user-interaction/CopyToClipboardWrapper.tsx
|
|
19312
|
-
var
|
|
19078
|
+
var import_react100 = require("react");
|
|
19313
19079
|
var import_clsx33 = require("clsx");
|
|
19314
19080
|
|
|
19315
19081
|
// src/utils/writeToClipboard.ts
|
|
@@ -19332,7 +19098,7 @@ var CopyToClipboardWrapper = ({
|
|
|
19332
19098
|
...props
|
|
19333
19099
|
}) => {
|
|
19334
19100
|
const translation = useHightideTranslation();
|
|
19335
|
-
const [isShowingConfirmation, setIsShowingConfirmation] = (0,
|
|
19101
|
+
const [isShowingConfirmation, setIsShowingConfirmation] = (0, import_react100.useState)(false);
|
|
19336
19102
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
19337
19103
|
TooltipRoot,
|
|
19338
19104
|
{
|
|
@@ -19381,7 +19147,7 @@ var CopyToClipboardWrapper = ({
|
|
|
19381
19147
|
};
|
|
19382
19148
|
|
|
19383
19149
|
// src/components/user-interaction/Menu.tsx
|
|
19384
|
-
var
|
|
19150
|
+
var import_react101 = require("react");
|
|
19385
19151
|
var import_clsx34 = __toESM(require("clsx"));
|
|
19386
19152
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
19387
19153
|
var MenuItem = ({
|
|
@@ -19407,8 +19173,8 @@ var Menu = ({
|
|
|
19407
19173
|
disabled = false,
|
|
19408
19174
|
...props
|
|
19409
19175
|
}) => {
|
|
19410
|
-
const triggerRef = (0,
|
|
19411
|
-
const [isOpen, setIsOpen] = (0,
|
|
19176
|
+
const triggerRef = (0, import_react101.useRef)(null);
|
|
19177
|
+
const [isOpen, setIsOpen] = (0, import_react101.useState)(false);
|
|
19412
19178
|
const bag = {
|
|
19413
19179
|
isOpen,
|
|
19414
19180
|
close: () => setIsOpen(false),
|
|
@@ -19416,7 +19182,7 @@ var Menu = ({
|
|
|
19416
19182
|
disabled
|
|
19417
19183
|
};
|
|
19418
19184
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
19419
|
-
trigger(bag, (0,
|
|
19185
|
+
trigger(bag, (0, import_react101.useCallback)((el) => triggerRef.current = el, [])),
|
|
19420
19186
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
19421
19187
|
PopUp,
|
|
19422
19188
|
{
|
|
@@ -19438,21 +19204,21 @@ var Menu = ({
|
|
|
19438
19204
|
};
|
|
19439
19205
|
|
|
19440
19206
|
// src/components/user-interaction/MultiSelect/MultiSelectChipDisplay.tsx
|
|
19441
|
-
var
|
|
19207
|
+
var import_react102 = require("react");
|
|
19442
19208
|
var import_lucide_react25 = require("lucide-react");
|
|
19443
19209
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
19444
|
-
var MultiSelectChipDisplayButton = (0,
|
|
19210
|
+
var MultiSelectChipDisplayButton = (0, import_react102.forwardRef)(function MultiSelectChipDisplayButton2({ id, ...props }, ref) {
|
|
19445
19211
|
const translation = useHightideTranslation();
|
|
19446
19212
|
const context = useMultiSelectContext();
|
|
19447
19213
|
const { config, layout } = context;
|
|
19448
19214
|
const { setIds } = config;
|
|
19449
19215
|
const { registerTrigger } = layout;
|
|
19450
|
-
(0,
|
|
19216
|
+
(0, import_react102.useEffect)(() => {
|
|
19451
19217
|
if (id) setIds((prev) => ({ ...prev, trigger: id }));
|
|
19452
19218
|
}, [id, setIds]);
|
|
19453
|
-
const innerRef = (0,
|
|
19454
|
-
(0,
|
|
19455
|
-
(0,
|
|
19219
|
+
const innerRef = (0, import_react102.useRef)(null);
|
|
19220
|
+
(0, import_react102.useImperativeHandle)(ref, () => innerRef.current);
|
|
19221
|
+
(0, import_react102.useEffect)(() => {
|
|
19456
19222
|
const unregister = registerTrigger(innerRef);
|
|
19457
19223
|
return () => unregister();
|
|
19458
19224
|
}, [registerTrigger]);
|
|
@@ -19527,7 +19293,7 @@ var MultiSelectChipDisplayButton = (0, import_react111.forwardRef)(function Mult
|
|
|
19527
19293
|
}
|
|
19528
19294
|
);
|
|
19529
19295
|
});
|
|
19530
|
-
var MultiSelectChipDisplay = (0,
|
|
19296
|
+
var MultiSelectChipDisplay = (0, import_react102.forwardRef)(
|
|
19531
19297
|
function MultiSelectChipDisplay2({
|
|
19532
19298
|
children,
|
|
19533
19299
|
contentPanelProps,
|
|
@@ -19542,7 +19308,7 @@ var MultiSelectChipDisplay = (0, import_react111.forwardRef)(
|
|
|
19542
19308
|
);
|
|
19543
19309
|
|
|
19544
19310
|
// src/components/user-interaction/ScrollPicker.tsx
|
|
19545
|
-
var
|
|
19311
|
+
var import_react103 = require("react");
|
|
19546
19312
|
var import_clsx35 = __toESM(require("clsx"));
|
|
19547
19313
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
19548
19314
|
var up = 1;
|
|
@@ -19563,7 +19329,7 @@ var ScrollPicker = ({
|
|
|
19563
19329
|
transition,
|
|
19564
19330
|
items,
|
|
19565
19331
|
lastTimeStamp
|
|
19566
|
-
}, setAnimation] = (0,
|
|
19332
|
+
}, setAnimation] = (0, import_react103.useState)({
|
|
19567
19333
|
targetIndex: selectedIndex,
|
|
19568
19334
|
currentIndex: disabled ? selectedIndex : 0,
|
|
19569
19335
|
velocity: 0,
|
|
@@ -19579,7 +19345,7 @@ var ScrollPicker = ({
|
|
|
19579
19345
|
const itemHeight = 40;
|
|
19580
19346
|
const distance = 8;
|
|
19581
19347
|
const containerHeight = itemHeight * (itemsShownCount - 2) + distance * (itemsShownCount - 2 + 1);
|
|
19582
|
-
const getDirection = (0,
|
|
19348
|
+
const getDirection = (0, import_react103.useCallback)((targetIndex, currentIndex2, transition2, length) => {
|
|
19583
19349
|
if (targetIndex === currentIndex2) {
|
|
19584
19350
|
return transition2 > 0 ? up : down;
|
|
19585
19351
|
}
|
|
@@ -19589,7 +19355,7 @@ var ScrollPicker = ({
|
|
|
19589
19355
|
}
|
|
19590
19356
|
return distanceForward >= length / 2 ? down : up;
|
|
19591
19357
|
}, []);
|
|
19592
|
-
const animate = (0,
|
|
19358
|
+
const animate = (0, import_react103.useCallback)((timestamp, startTime) => {
|
|
19593
19359
|
setAnimation((prevState) => {
|
|
19594
19360
|
const {
|
|
19595
19361
|
targetIndex,
|
|
@@ -19662,7 +19428,7 @@ var ScrollPicker = ({
|
|
|
19662
19428
|
};
|
|
19663
19429
|
});
|
|
19664
19430
|
}, [disabled, getDirection, onChange]);
|
|
19665
|
-
(0,
|
|
19431
|
+
(0, import_react103.useEffect)(() => {
|
|
19666
19432
|
requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp));
|
|
19667
19433
|
});
|
|
19668
19434
|
const opacity = (transition2, index, itemsCount) => {
|
|
@@ -19740,7 +19506,7 @@ var ScrollPicker = ({
|
|
|
19740
19506
|
};
|
|
19741
19507
|
|
|
19742
19508
|
// src/components/user-interaction/Switch.tsx
|
|
19743
|
-
var
|
|
19509
|
+
var import_react104 = require("react");
|
|
19744
19510
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
19745
19511
|
var Switch = ({
|
|
19746
19512
|
value: controlledValue,
|
|
@@ -19755,7 +19521,7 @@ var Switch = ({
|
|
|
19755
19521
|
}) => {
|
|
19756
19522
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
19757
19523
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
19758
|
-
const onChangeWrapper = (0,
|
|
19524
|
+
const onChangeWrapper = (0, import_react104.useCallback)((value2) => {
|
|
19759
19525
|
onValueChangeStable(!value2);
|
|
19760
19526
|
onEditCompleteStable(!value2);
|
|
19761
19527
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -19795,10 +19561,10 @@ var Switch = ({
|
|
|
19795
19561
|
};
|
|
19796
19562
|
|
|
19797
19563
|
// src/components/user-interaction/Textarea.tsx
|
|
19798
|
-
var
|
|
19564
|
+
var import_react105 = require("react");
|
|
19799
19565
|
var import_clsx36 = __toESM(require("clsx"));
|
|
19800
19566
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
19801
|
-
var Textarea = (0,
|
|
19567
|
+
var Textarea = (0, import_react105.forwardRef)(function Textarea2({
|
|
19802
19568
|
value: controlledValue,
|
|
19803
19569
|
initialValue,
|
|
19804
19570
|
invalid = false,
|
|
@@ -19814,7 +19580,7 @@ var Textarea = (0, import_react114.forwardRef)(function Textarea2({
|
|
|
19814
19580
|
});
|
|
19815
19581
|
const { restartTimer, clearTimer } = useDelay(saveDelayOptions);
|
|
19816
19582
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
19817
|
-
const onEditCompleteWrapper = (0,
|
|
19583
|
+
const onEditCompleteWrapper = (0, import_react105.useCallback)((text) => {
|
|
19818
19584
|
onEditCompleteStable(text);
|
|
19819
19585
|
clearTimer();
|
|
19820
19586
|
}, [onEditCompleteStable, clearTimer]);
|
|
@@ -19852,7 +19618,7 @@ var TextareaWithHeadline = ({
|
|
|
19852
19618
|
containerClassName,
|
|
19853
19619
|
...props
|
|
19854
19620
|
}) => {
|
|
19855
|
-
const genId = (0,
|
|
19621
|
+
const genId = (0, import_react105.useId)();
|
|
19856
19622
|
const usedId = id ?? genId;
|
|
19857
19623
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
19858
19624
|
"div",
|
|
@@ -19884,20 +19650,20 @@ var TextareaWithHeadline = ({
|
|
|
19884
19650
|
};
|
|
19885
19651
|
|
|
19886
19652
|
// src/components/user-interaction/data/FilterList.tsx
|
|
19887
|
-
var
|
|
19653
|
+
var import_react106 = require("react");
|
|
19888
19654
|
var import_lucide_react26 = require("lucide-react");
|
|
19889
19655
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
19890
19656
|
var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
19891
19657
|
const translation = useHightideTranslation();
|
|
19892
19658
|
const filterValueToLabel = useFilterValueTranslation();
|
|
19893
|
-
const activeIds = (0,
|
|
19894
|
-
const inactiveItems = (0,
|
|
19895
|
-
const itemRecord = (0,
|
|
19659
|
+
const activeIds = (0, import_react106.useMemo)(() => value.map((item) => item.id), [value]);
|
|
19660
|
+
const inactiveItems = (0, import_react106.useMemo)(() => availableItems.filter((item) => !activeIds.includes(item.id)).sort((a, b) => a.label.localeCompare(b.label)), [availableItems, activeIds]);
|
|
19661
|
+
const itemRecord = (0, import_react106.useMemo)(() => availableItems.reduce((acc, item) => {
|
|
19896
19662
|
acc[item.id] = item;
|
|
19897
19663
|
return acc;
|
|
19898
19664
|
}, {}), [availableItems]);
|
|
19899
|
-
const [editState, setEditState] = (0,
|
|
19900
|
-
const valueWithEditState = (0,
|
|
19665
|
+
const [editState, setEditState] = (0, import_react106.useState)(void 0);
|
|
19666
|
+
const valueWithEditState = (0, import_react106.useMemo)(() => {
|
|
19901
19667
|
let foundEditValue = false;
|
|
19902
19668
|
for (const item of value) {
|
|
19903
19669
|
if (item.id === editState?.id) {
|
|
@@ -19910,9 +19676,9 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19910
19676
|
}
|
|
19911
19677
|
return value;
|
|
19912
19678
|
}, [value, editState]);
|
|
19913
|
-
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex-row-
|
|
19679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex-row-2 flex-wrap gap-y-2", children: [
|
|
19914
19680
|
/* @__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: "sm", children: [
|
|
19681
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "sm", className: "min-w-36", children: [
|
|
19916
19682
|
translation("addFilter"),
|
|
19917
19683
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_lucide_react26.PlusIcon, { className: "size-4" })
|
|
19918
19684
|
] }) }),
|
|
@@ -19961,11 +19727,11 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19961
19727
|
}
|
|
19962
19728
|
},
|
|
19963
19729
|
children: [
|
|
19964
|
-
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpOpener, { children: ({ toggleOpen, props
|
|
19965
|
-
|
|
19966
|
-
|
|
19967
|
-
] }) }),
|
|
19968
|
-
|
|
19730
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Button, { ...props, onClick: toggleOpen, color: "primary", coloringStyle: "tonal-outline", size: "sm", children: item.activeLabelBuilder ? item.activeLabelBuilder(columnFilter.value) : /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
19731
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "font-bold", children: item.label }),
|
|
19732
|
+
filterValueToLabel(columnFilter.value, { tags: item.tags })
|
|
19733
|
+
] }) }) }),
|
|
19734
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PopUpContext.Consumer, { children: ({ isOpen, setIsOpen }) => item.popUpBuilder ? item.popUpBuilder({
|
|
19969
19735
|
value: editState?.id === columnFilter.id ? editState.value : columnFilter.value,
|
|
19970
19736
|
onValueChange: (value2) => setEditState({ ...columnFilter, value: value2 }),
|
|
19971
19737
|
onRemove: () => {
|
|
@@ -19977,7 +19743,7 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19977
19743
|
name: item.label,
|
|
19978
19744
|
isOpen,
|
|
19979
19745
|
close: () => setIsOpen(false)
|
|
19980
|
-
})
|
|
19746
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
19981
19747
|
FilterPopUp,
|
|
19982
19748
|
{
|
|
19983
19749
|
name: item.label,
|
|
@@ -19990,9 +19756,10 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
19990
19756
|
onRemove: () => {
|
|
19991
19757
|
onValueChange(value.filter((prevItem) => prevItem.id !== columnFilter.id));
|
|
19992
19758
|
setEditState(void 0);
|
|
19993
|
-
}
|
|
19759
|
+
},
|
|
19760
|
+
onClose: () => setIsOpen(false)
|
|
19994
19761
|
}
|
|
19995
|
-
)
|
|
19762
|
+
) })
|
|
19996
19763
|
]
|
|
19997
19764
|
},
|
|
19998
19765
|
columnFilter.id
|
|
@@ -20001,8 +19768,142 @@ var FilterList = ({ value, onValueChange, availableItems }) => {
|
|
|
20001
19768
|
] });
|
|
20002
19769
|
};
|
|
20003
19770
|
|
|
19771
|
+
// src/components/user-interaction/data/SortingList.tsx
|
|
19772
|
+
var import_react107 = require("react");
|
|
19773
|
+
var import_lucide_react27 = require("lucide-react");
|
|
19774
|
+
var import_clsx37 = __toESM(require("clsx"));
|
|
19775
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
19776
|
+
var SortingList = ({ sorting, onSortingChange, availableItems }) => {
|
|
19777
|
+
const translation = useHightideTranslation();
|
|
19778
|
+
const activeIds = (0, import_react107.useMemo)(() => sorting.map((item) => item.id), [sorting]);
|
|
19779
|
+
const inactiveItems = (0, import_react107.useMemo)(
|
|
19780
|
+
() => availableItems.filter((item) => !activeIds.includes(item.id)).sort((a, b) => a.label.localeCompare(b.label)),
|
|
19781
|
+
[availableItems, activeIds]
|
|
19782
|
+
);
|
|
19783
|
+
const itemRecord = (0, import_react107.useMemo)(
|
|
19784
|
+
() => availableItems.reduce(
|
|
19785
|
+
(acc, item) => {
|
|
19786
|
+
acc[item.id] = item;
|
|
19787
|
+
return acc;
|
|
19788
|
+
},
|
|
19789
|
+
{}
|
|
19790
|
+
),
|
|
19791
|
+
[availableItems]
|
|
19792
|
+
);
|
|
19793
|
+
const setSortDirection = (columnId, desc) => {
|
|
19794
|
+
onSortingChange(sorting.map((s) => s.id === columnId ? { ...s, desc } : s));
|
|
19795
|
+
};
|
|
19796
|
+
const removeSort = (columnId) => {
|
|
19797
|
+
onSortingChange(sorting.filter((s) => s.id !== columnId));
|
|
19798
|
+
};
|
|
19799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex-row-2 flex-wrap gap-y-2", children: [
|
|
19800
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(PopUpRoot, { children: [
|
|
19801
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Button, { ...props, onClick: toggleOpen, color: "neutral", size: "sm", className: "min-w-36", children: [
|
|
19802
|
+
translation("addSorting"),
|
|
19803
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react27.PlusIcon, { className: "size-4" })
|
|
19804
|
+
] }) }),
|
|
19805
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(PopUp, { className: "flex-col-2 p-2", children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(PopUpContext.Consumer, { children: ({ setIsOpen }) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
19806
|
+
Combobox,
|
|
19807
|
+
{
|
|
19808
|
+
onItemClick: (id) => {
|
|
19809
|
+
const item = itemRecord[id];
|
|
19810
|
+
if (!item) return;
|
|
19811
|
+
onSortingChange([...sorting, { id: item.id, desc: false }]);
|
|
19812
|
+
setIsOpen(false);
|
|
19813
|
+
},
|
|
19814
|
+
children: inactiveItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(ComboboxOption, { value: item.id, label: item.label, children: [
|
|
19815
|
+
DataTypeUtils.toIcon(item.dataType),
|
|
19816
|
+
item.label
|
|
19817
|
+
] }, item.id))
|
|
19818
|
+
}
|
|
19819
|
+
) }) })
|
|
19820
|
+
] }),
|
|
19821
|
+
sorting.map((columnSort) => {
|
|
19822
|
+
const item = itemRecord[columnSort.id];
|
|
19823
|
+
if (!item) return null;
|
|
19824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(PopUpRoot, { children: [
|
|
19825
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(PopUpOpener, { children: ({ toggleOpen, props }) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Button, { ...props, onClick: toggleOpen, color: "secondary", coloringStyle: "tonal-outline", size: "sm", children: [
|
|
19826
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "font-bold", children: item.label }),
|
|
19827
|
+
columnSort.desc ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react27.ArrowDownWideNarrow, { className: "size-5" }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react27.ArrowUpNarrowWide, { className: "size-5" })
|
|
19828
|
+
] }) }),
|
|
19829
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(PopUpContext.Consumer, { children: ({ setIsOpen }) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
19830
|
+
PopUp,
|
|
19831
|
+
{
|
|
19832
|
+
className: (0, import_clsx37.default)("flex-col-3 p-3 min-w-64"),
|
|
19833
|
+
onClose: () => setIsOpen(false),
|
|
19834
|
+
children: [
|
|
19835
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex-row-4 justify-between w-full items-center gap-2", children: [
|
|
19836
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "typography-title-sm font-semibold", children: item.label }),
|
|
19837
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex-row-0 shrink-0 items-center", children: [
|
|
19838
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
19839
|
+
IconButton,
|
|
19840
|
+
{
|
|
19841
|
+
tooltip: translation("removeFilter"),
|
|
19842
|
+
onClick: () => {
|
|
19843
|
+
removeSort(columnSort.id);
|
|
19844
|
+
setIsOpen(false);
|
|
19845
|
+
},
|
|
19846
|
+
color: "negative",
|
|
19847
|
+
coloringStyle: "text",
|
|
19848
|
+
size: "sm",
|
|
19849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react27.TrashIcon, { className: "size-4" })
|
|
19850
|
+
}
|
|
19851
|
+
),
|
|
19852
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
19853
|
+
IconButton,
|
|
19854
|
+
{
|
|
19855
|
+
tooltip: translation("close"),
|
|
19856
|
+
onClick: () => setIsOpen(false),
|
|
19857
|
+
color: "neutral",
|
|
19858
|
+
coloringStyle: "text",
|
|
19859
|
+
size: "sm",
|
|
19860
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react27.XIcon, { className: "size-4" })
|
|
19861
|
+
}
|
|
19862
|
+
)
|
|
19863
|
+
] })
|
|
19864
|
+
] }),
|
|
19865
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex-row-1 w-full gap-2", children: [
|
|
19866
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
19867
|
+
Button,
|
|
19868
|
+
{
|
|
19869
|
+
type: "button",
|
|
19870
|
+
className: "flex-1 flex-row-1 items-center justify-center gap-2",
|
|
19871
|
+
color: columnSort.desc ? "neutral" : "primary",
|
|
19872
|
+
coloringStyle: "solid",
|
|
19873
|
+
size: "md",
|
|
19874
|
+
onClick: () => setSortDirection(columnSort.id, false),
|
|
19875
|
+
children: [
|
|
19876
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react27.ArrowUpNarrowWide, { className: "size-4" }),
|
|
19877
|
+
translation("sortAsc")
|
|
19878
|
+
]
|
|
19879
|
+
}
|
|
19880
|
+
),
|
|
19881
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
19882
|
+
Button,
|
|
19883
|
+
{
|
|
19884
|
+
type: "button",
|
|
19885
|
+
className: "flex-1 flex-row-1 items-center justify-center gap-2",
|
|
19886
|
+
color: columnSort.desc ? "primary" : "neutral",
|
|
19887
|
+
coloringStyle: "solid",
|
|
19888
|
+
size: "md",
|
|
19889
|
+
onClick: () => setSortDirection(columnSort.id, true),
|
|
19890
|
+
children: [
|
|
19891
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react27.ArrowDownWideNarrow, { className: "size-4" }),
|
|
19892
|
+
translation("sortDesc")
|
|
19893
|
+
]
|
|
19894
|
+
}
|
|
19895
|
+
)
|
|
19896
|
+
] })
|
|
19897
|
+
]
|
|
19898
|
+
}
|
|
19899
|
+
) })
|
|
19900
|
+
] }, columnSort.id);
|
|
19901
|
+
})
|
|
19902
|
+
] });
|
|
19903
|
+
};
|
|
19904
|
+
|
|
20004
19905
|
// src/components/user-interaction/date/TimeDisplay.tsx
|
|
20005
|
-
var
|
|
19906
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
20006
19907
|
var TimeDisplay = ({
|
|
20007
19908
|
date,
|
|
20008
19909
|
mode = "daysFromToday"
|
|
@@ -20039,15 +19940,80 @@ var TimeDisplay = ({
|
|
|
20039
19940
|
} else {
|
|
20040
19941
|
fullString = `${date.getDate()}. ${monthToTranslation[date.getMonth()]} ${date.getFullYear()}`;
|
|
20041
19942
|
}
|
|
20042
|
-
return /* @__PURE__ */ (0,
|
|
19943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { children: fullString });
|
|
20043
19944
|
};
|
|
20044
19945
|
|
|
19946
|
+
// src/components/user-interaction/input/FlexibleDateTimeInput.tsx
|
|
19947
|
+
var import_react108 = require("react");
|
|
19948
|
+
var import_lucide_react28 = require("lucide-react");
|
|
19949
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
19950
|
+
var FlexibleDateTimeInput = (0, import_react108.forwardRef)(function FlexibleDateTimeInput2({
|
|
19951
|
+
defaultMode = "date",
|
|
19952
|
+
value: controlledValue,
|
|
19953
|
+
initialValue,
|
|
19954
|
+
onValueChange,
|
|
19955
|
+
fixedTime: fixedTimeOverride,
|
|
19956
|
+
actions = [],
|
|
19957
|
+
...props
|
|
19958
|
+
}, forwardedRef) {
|
|
19959
|
+
const translation = useHightideTranslation();
|
|
19960
|
+
const [value, setValue] = useControlledState({
|
|
19961
|
+
value: controlledValue,
|
|
19962
|
+
onValueChange,
|
|
19963
|
+
defaultValue: initialValue
|
|
19964
|
+
});
|
|
19965
|
+
const fixedTime = (0, import_react108.useMemo)(() => fixedTimeOverride ?? new Date(23, 59, 59, 999), [fixedTimeOverride]);
|
|
19966
|
+
const [preferredMode, setPreferredMode] = (0, import_react108.useState)(defaultMode);
|
|
19967
|
+
const mode = (0, import_react108.useMemo)(() => {
|
|
19968
|
+
if (!value) return preferredMode;
|
|
19969
|
+
if (DateUtils.sameTime(value, fixedTime, true, true)) {
|
|
19970
|
+
return "date";
|
|
19971
|
+
}
|
|
19972
|
+
return "dateTime";
|
|
19973
|
+
}, [preferredMode, value, fixedTime]);
|
|
19974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
19975
|
+
DateTimeInput,
|
|
19976
|
+
{
|
|
19977
|
+
...props,
|
|
19978
|
+
ref: forwardedRef,
|
|
19979
|
+
mode,
|
|
19980
|
+
value,
|
|
19981
|
+
onValueChange: setValue,
|
|
19982
|
+
actions: [
|
|
19983
|
+
...actions,
|
|
19984
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
19985
|
+
IconButton,
|
|
19986
|
+
{
|
|
19987
|
+
size: "sm",
|
|
19988
|
+
coloringStyle: "text",
|
|
19989
|
+
color: "neutral",
|
|
19990
|
+
tooltip: preferredMode === "date" ? translation("addTime") : translation("withoutTime"),
|
|
19991
|
+
onClick: () => {
|
|
19992
|
+
const newMode = preferredMode === "date" ? "dateTime" : "date";
|
|
19993
|
+
setPreferredMode((prev) => prev === "date" ? "dateTime" : "date");
|
|
19994
|
+
if (value) {
|
|
19995
|
+
if (newMode === "date") {
|
|
19996
|
+
setValue(DateUtils.withTime(value, fixedTime));
|
|
19997
|
+
} else {
|
|
19998
|
+
setValue(DateUtils.isLastMillisecondOfDay(value) ? new Date(value.getTime() - 1) : new Date(value.getTime() + 1));
|
|
19999
|
+
}
|
|
20000
|
+
}
|
|
20001
|
+
},
|
|
20002
|
+
children: preferredMode === "date" ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react28.ClockPlus, { className: "size-5" }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react28.ClockFading, { className: "size-5" })
|
|
20003
|
+
},
|
|
20004
|
+
"date-mode"
|
|
20005
|
+
)
|
|
20006
|
+
]
|
|
20007
|
+
}
|
|
20008
|
+
);
|
|
20009
|
+
});
|
|
20010
|
+
|
|
20045
20011
|
// src/components/user-interaction/input/InsideLabelInput.tsx
|
|
20046
|
-
var
|
|
20047
|
-
var
|
|
20048
|
-
var
|
|
20049
|
-
var
|
|
20050
|
-
var InsideLabelInput = (0,
|
|
20012
|
+
var import_react109 = require("react");
|
|
20013
|
+
var import_react110 = require("react");
|
|
20014
|
+
var import_clsx38 = __toESM(require("clsx"));
|
|
20015
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
20016
|
+
var InsideLabelInput = (0, import_react110.forwardRef)(function InsideLabelInput2({
|
|
20051
20017
|
id: customId,
|
|
20052
20018
|
value: controlledValue,
|
|
20053
20019
|
initialValue,
|
|
@@ -20060,11 +20026,11 @@ var InsideLabelInput = (0, import_react117.forwardRef)(function InsideLabelInput
|
|
|
20060
20026
|
onValueChange,
|
|
20061
20027
|
defaultValue: initialValue
|
|
20062
20028
|
});
|
|
20063
|
-
const [isFocused, setIsFocused] = (0,
|
|
20064
|
-
const generatedId = (0,
|
|
20029
|
+
const [isFocused, setIsFocused] = (0, import_react110.useState)(false);
|
|
20030
|
+
const generatedId = (0, import_react109.useId)();
|
|
20065
20031
|
const id = customId ?? generatedId;
|
|
20066
|
-
return /* @__PURE__ */ (0,
|
|
20067
|
-
/* @__PURE__ */ (0,
|
|
20032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_clsx38.default)("relative"), children: [
|
|
20033
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
20068
20034
|
Input,
|
|
20069
20035
|
{
|
|
20070
20036
|
...props,
|
|
@@ -20081,16 +20047,16 @@ var InsideLabelInput = (0, import_react117.forwardRef)(function InsideLabelInput
|
|
|
20081
20047
|
setIsFocused(false);
|
|
20082
20048
|
},
|
|
20083
20049
|
"aria-labelledby": id + "-label",
|
|
20084
|
-
className: (0,
|
|
20050
|
+
className: (0, import_clsx38.default)("h-14 px-4 pb-2 py-6.5", props.className)
|
|
20085
20051
|
}
|
|
20086
20052
|
),
|
|
20087
|
-
/* @__PURE__ */ (0,
|
|
20053
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
20088
20054
|
"label",
|
|
20089
20055
|
{
|
|
20090
20056
|
id: id + "-label",
|
|
20091
20057
|
"aria-hidden": true,
|
|
20092
20058
|
"data-display": isFocused || !!value ? "small" : "full",
|
|
20093
|
-
className: (0,
|
|
20059
|
+
className: (0, import_clsx38.default)(
|
|
20094
20060
|
// margin left to account for the border which is ignored for absolute positions
|
|
20095
20061
|
"absolute left-4 ml-0.5 top-2 transition-all delay-25 pointer-events-none touch-none",
|
|
20096
20062
|
"data-[display=small]:top-2 data-[display=small]:h-force-4.5 data-[display=small]:typography-caption-sm data-[display=small]:overflow-y-hidden",
|
|
@@ -20103,9 +20069,9 @@ var InsideLabelInput = (0, import_react117.forwardRef)(function InsideLabelInput
|
|
|
20103
20069
|
});
|
|
20104
20070
|
|
|
20105
20071
|
// src/components/user-interaction/input/SearchBar.tsx
|
|
20106
|
-
var
|
|
20107
|
-
var
|
|
20108
|
-
var
|
|
20072
|
+
var import_lucide_react29 = require("lucide-react");
|
|
20073
|
+
var import_clsx39 = require("clsx");
|
|
20074
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
20109
20075
|
var SearchBar = ({
|
|
20110
20076
|
value: controlledValue,
|
|
20111
20077
|
initialValue,
|
|
@@ -20121,8 +20087,8 @@ var SearchBar = ({
|
|
|
20121
20087
|
onValueChange,
|
|
20122
20088
|
defaultValue: initialValue
|
|
20123
20089
|
});
|
|
20124
|
-
return /* @__PURE__ */ (0,
|
|
20125
|
-
/* @__PURE__ */ (0,
|
|
20090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { ...containerProps, className: (0, import_clsx39.clsx)("relative", containerProps?.className), children: [
|
|
20091
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
20126
20092
|
Input,
|
|
20127
20093
|
{
|
|
20128
20094
|
...inputProps,
|
|
@@ -20130,10 +20096,10 @@ var SearchBar = ({
|
|
|
20130
20096
|
onValueChange: setValue,
|
|
20131
20097
|
onEditComplete: onSearch,
|
|
20132
20098
|
placeholder: inputProps.placeholder ?? translation("search"),
|
|
20133
|
-
className: (0,
|
|
20099
|
+
className: (0, import_clsx39.clsx)("pr-10 w-full", inputProps.className)
|
|
20134
20100
|
}
|
|
20135
20101
|
),
|
|
20136
|
-
/* @__PURE__ */ (0,
|
|
20102
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
20137
20103
|
IconButton,
|
|
20138
20104
|
{
|
|
20139
20105
|
...searchButtonProps,
|
|
@@ -20142,19 +20108,19 @@ var SearchBar = ({
|
|
|
20142
20108
|
color: "neutral",
|
|
20143
20109
|
coloringStyle: "text",
|
|
20144
20110
|
onClick: () => onSearch(value),
|
|
20145
|
-
className: (0,
|
|
20146
|
-
children: /* @__PURE__ */ (0,
|
|
20111
|
+
className: (0, import_clsx39.clsx)("absolute right-1.5 top-1/2 -translate-y-1/2", searchButtonProps?.className),
|
|
20112
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react29.Search, { className: "w-full h-full" })
|
|
20147
20113
|
}
|
|
20148
20114
|
)
|
|
20149
20115
|
] });
|
|
20150
20116
|
};
|
|
20151
20117
|
|
|
20152
20118
|
// src/components/user-interaction/input/ToggleableInput.tsx
|
|
20153
|
-
var
|
|
20154
|
-
var
|
|
20155
|
-
var
|
|
20156
|
-
var
|
|
20157
|
-
var ToggleableInput = (0,
|
|
20119
|
+
var import_react111 = require("react");
|
|
20120
|
+
var import_lucide_react30 = require("lucide-react");
|
|
20121
|
+
var import_clsx40 = __toESM(require("clsx"));
|
|
20122
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
20123
|
+
var ToggleableInput = (0, import_react111.forwardRef)(function ToggleableInput2({
|
|
20158
20124
|
value: controlledValue,
|
|
20159
20125
|
initialValue,
|
|
20160
20126
|
onValueChange,
|
|
@@ -20167,16 +20133,16 @@ var ToggleableInput = (0, import_react118.forwardRef)(function ToggleableInput2(
|
|
|
20167
20133
|
onValueChange,
|
|
20168
20134
|
defaultValue: initialValue
|
|
20169
20135
|
});
|
|
20170
|
-
const [isEditing, setIsEditing] = (0,
|
|
20171
|
-
const innerRef = (0,
|
|
20172
|
-
(0,
|
|
20173
|
-
(0,
|
|
20136
|
+
const [isEditing, setIsEditing] = (0, import_react111.useState)(initialState !== "display");
|
|
20137
|
+
const innerRef = (0, import_react111.useRef)(null);
|
|
20138
|
+
(0, import_react111.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
20139
|
+
(0, import_react111.useEffect)(() => {
|
|
20174
20140
|
if (isEditing) {
|
|
20175
20141
|
innerRef.current?.focus();
|
|
20176
20142
|
}
|
|
20177
20143
|
}, [isEditing]);
|
|
20178
|
-
return /* @__PURE__ */ (0,
|
|
20179
|
-
/* @__PURE__ */ (0,
|
|
20144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: (0, import_clsx40.default)("relative flex-row-2", { "flex-1": isEditing }), children: [
|
|
20145
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
20180
20146
|
Input,
|
|
20181
20147
|
{
|
|
20182
20148
|
...props,
|
|
@@ -20200,20 +20166,20 @@ var ToggleableInput = (0, import_react118.forwardRef)(function ToggleableInput2(
|
|
|
20200
20166
|
"data-name": props["data-name"] ?? "togglable-input"
|
|
20201
20167
|
}
|
|
20202
20168
|
),
|
|
20203
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
20204
|
-
/* @__PURE__ */ (0,
|
|
20205
|
-
/* @__PURE__ */ (0,
|
|
20169
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "absolute left-0 flex-row-2 items-center pointer-events-none touch-none w-full overflow-hidden", children: [
|
|
20170
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: (0, import_clsx40.default)(" truncate"), children: value }),
|
|
20171
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react30.Pencil, { className: (0, import_clsx40.default)(`size-force-4`, { "text-transparent": isEditing }) })
|
|
20206
20172
|
] })
|
|
20207
20173
|
] });
|
|
20208
20174
|
});
|
|
20209
20175
|
|
|
20210
20176
|
// src/components/user-interaction/properties/CheckboxProperty.tsx
|
|
20211
|
-
var
|
|
20177
|
+
var import_lucide_react32 = require("lucide-react");
|
|
20212
20178
|
|
|
20213
20179
|
// src/components/user-interaction/properties/PropertyBase.tsx
|
|
20214
|
-
var
|
|
20215
|
-
var
|
|
20216
|
-
var
|
|
20180
|
+
var import_clsx41 = __toESM(require("clsx"));
|
|
20181
|
+
var import_lucide_react31 = require("lucide-react");
|
|
20182
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
20217
20183
|
var PropertyBase = ({
|
|
20218
20184
|
name,
|
|
20219
20185
|
children,
|
|
@@ -20232,36 +20198,36 @@ var PropertyBase = ({
|
|
|
20232
20198
|
const isClearEnabled = allowClear && !readOnly;
|
|
20233
20199
|
const isRemoveEnabled = allowRemove && !readOnly;
|
|
20234
20200
|
const showActionsContainer = isClearEnabled || isRemoveEnabled;
|
|
20235
|
-
return /* @__PURE__ */ (0,
|
|
20201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
20236
20202
|
"div",
|
|
20237
20203
|
{
|
|
20238
|
-
className: (0,
|
|
20204
|
+
className: (0, import_clsx41.default)("group/property", className),
|
|
20239
20205
|
"data-name": "property-root",
|
|
20240
20206
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20241
20207
|
children: [
|
|
20242
|
-
/* @__PURE__ */ (0,
|
|
20208
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
20243
20209
|
"div",
|
|
20244
20210
|
{
|
|
20245
20211
|
"data-name": "property-title",
|
|
20246
20212
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20247
20213
|
children: [
|
|
20248
|
-
/* @__PURE__ */ (0,
|
|
20249
|
-
/* @__PURE__ */ (0,
|
|
20250
|
-
/* @__PURE__ */ (0,
|
|
20214
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Tooltip, { tooltip: name, containerClassName: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex-row-1 items-center", children: [
|
|
20215
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { "data-name": "property-title-icon", children: icon }),
|
|
20216
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { "data-name": "property-title-text", children: name })
|
|
20251
20217
|
] }) }),
|
|
20252
|
-
invalid && /* @__PURE__ */ (0,
|
|
20218
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_lucide_react31.AlertTriangle, { className: "size-force-6" })
|
|
20253
20219
|
]
|
|
20254
20220
|
}
|
|
20255
20221
|
),
|
|
20256
|
-
/* @__PURE__ */ (0,
|
|
20222
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
20257
20223
|
"div",
|
|
20258
20224
|
{
|
|
20259
20225
|
"data-name": "property-content",
|
|
20260
20226
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20261
20227
|
children: [
|
|
20262
20228
|
children({ required, hasValue, invalid }),
|
|
20263
|
-
showActionsContainer && /* @__PURE__ */ (0,
|
|
20264
|
-
isClearEnabled && /* @__PURE__ */ (0,
|
|
20229
|
+
showActionsContainer && /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { "data-name": "property-actions", children: [
|
|
20230
|
+
isClearEnabled && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
20265
20231
|
IconButton,
|
|
20266
20232
|
{
|
|
20267
20233
|
tooltip: translation("clearValue"),
|
|
@@ -20270,10 +20236,10 @@ var PropertyBase = ({
|
|
|
20270
20236
|
color: "negative",
|
|
20271
20237
|
coloringStyle: "text",
|
|
20272
20238
|
size: "sm",
|
|
20273
|
-
children: /* @__PURE__ */ (0,
|
|
20239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_lucide_react31.X, { className: "size-force-5" })
|
|
20274
20240
|
}
|
|
20275
20241
|
),
|
|
20276
|
-
isRemoveEnabled && /* @__PURE__ */ (0,
|
|
20242
|
+
isRemoveEnabled && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
20277
20243
|
IconButton,
|
|
20278
20244
|
{
|
|
20279
20245
|
tooltip: translation("removeProperty"),
|
|
@@ -20281,7 +20247,7 @@ var PropertyBase = ({
|
|
|
20281
20247
|
color: "negative",
|
|
20282
20248
|
coloringStyle: "text",
|
|
20283
20249
|
size: "sm",
|
|
20284
|
-
children: /* @__PURE__ */ (0,
|
|
20250
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_lucide_react31.Trash, { className: "size-force-5" })
|
|
20285
20251
|
}
|
|
20286
20252
|
)
|
|
20287
20253
|
] })
|
|
@@ -20294,7 +20260,7 @@ var PropertyBase = ({
|
|
|
20294
20260
|
};
|
|
20295
20261
|
|
|
20296
20262
|
// src/components/user-interaction/properties/CheckboxProperty.tsx
|
|
20297
|
-
var
|
|
20263
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
20298
20264
|
var CheckboxProperty = ({
|
|
20299
20265
|
value,
|
|
20300
20266
|
onValueChange,
|
|
@@ -20303,15 +20269,15 @@ var CheckboxProperty = ({
|
|
|
20303
20269
|
...baseProps
|
|
20304
20270
|
}) => {
|
|
20305
20271
|
const translation = useHightideTranslation();
|
|
20306
|
-
return /* @__PURE__ */ (0,
|
|
20272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
20307
20273
|
PropertyBase,
|
|
20308
20274
|
{
|
|
20309
20275
|
...baseProps,
|
|
20310
20276
|
hasValue: value !== void 0,
|
|
20311
20277
|
readOnly,
|
|
20312
|
-
icon: /* @__PURE__ */ (0,
|
|
20313
|
-
children: () => /* @__PURE__ */ (0,
|
|
20314
|
-
/* @__PURE__ */ (0,
|
|
20278
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_lucide_react32.Check, { size: 24 }),
|
|
20279
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex-row-2 items-center", children: [
|
|
20280
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
20315
20281
|
Button,
|
|
20316
20282
|
{
|
|
20317
20283
|
color: value ? "positive" : "neutral",
|
|
@@ -20324,7 +20290,7 @@ var CheckboxProperty = ({
|
|
|
20324
20290
|
children: translation("yes")
|
|
20325
20291
|
}
|
|
20326
20292
|
),
|
|
20327
|
-
/* @__PURE__ */ (0,
|
|
20293
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
20328
20294
|
Button,
|
|
20329
20295
|
{
|
|
20330
20296
|
color: !value && value !== void 0 ? "negative" : "neutral",
|
|
@@ -20343,8 +20309,8 @@ var CheckboxProperty = ({
|
|
|
20343
20309
|
};
|
|
20344
20310
|
|
|
20345
20311
|
// src/components/user-interaction/properties/DateProperty.tsx
|
|
20346
|
-
var
|
|
20347
|
-
var
|
|
20312
|
+
var import_lucide_react33 = require("lucide-react");
|
|
20313
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
20348
20314
|
var DateProperty = ({
|
|
20349
20315
|
value,
|
|
20350
20316
|
onValueChange,
|
|
@@ -20354,13 +20320,13 @@ var DateProperty = ({
|
|
|
20354
20320
|
...baseProps
|
|
20355
20321
|
}) => {
|
|
20356
20322
|
const hasValue = !!value;
|
|
20357
|
-
return /* @__PURE__ */ (0,
|
|
20323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
20358
20324
|
PropertyBase,
|
|
20359
20325
|
{
|
|
20360
20326
|
...baseProps,
|
|
20361
20327
|
hasValue,
|
|
20362
|
-
icon: /* @__PURE__ */ (0,
|
|
20363
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20328
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_lucide_react33.CalendarDays, { size: 24 }),
|
|
20329
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
20364
20330
|
DateTimeInput,
|
|
20365
20331
|
{
|
|
20366
20332
|
value,
|
|
@@ -20377,8 +20343,8 @@ var DateProperty = ({
|
|
|
20377
20343
|
};
|
|
20378
20344
|
|
|
20379
20345
|
// src/components/user-interaction/properties/MultiSelectProperty.tsx
|
|
20380
|
-
var
|
|
20381
|
-
var
|
|
20346
|
+
var import_lucide_react34 = require("lucide-react");
|
|
20347
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
20382
20348
|
var MultiSelectProperty = ({
|
|
20383
20349
|
children,
|
|
20384
20350
|
value,
|
|
@@ -20387,18 +20353,18 @@ var MultiSelectProperty = ({
|
|
|
20387
20353
|
...props
|
|
20388
20354
|
}) => {
|
|
20389
20355
|
const hasValue = value.length > 0;
|
|
20390
|
-
return /* @__PURE__ */ (0,
|
|
20356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
20391
20357
|
PropertyBase,
|
|
20392
20358
|
{
|
|
20393
20359
|
...props,
|
|
20394
20360
|
hasValue,
|
|
20395
|
-
icon: /* @__PURE__ */ (0,
|
|
20396
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20361
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_lucide_react34.List, { size: 24 }),
|
|
20362
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
20397
20363
|
"div",
|
|
20398
20364
|
{
|
|
20399
20365
|
"data-name": "property-input-wrapper",
|
|
20400
20366
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20401
|
-
children: /* @__PURE__ */ (0,
|
|
20367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
20402
20368
|
MultiSelectChipDisplay,
|
|
20403
20369
|
{
|
|
20404
20370
|
value,
|
|
@@ -20424,8 +20390,8 @@ var MultiSelectProperty = ({
|
|
|
20424
20390
|
};
|
|
20425
20391
|
|
|
20426
20392
|
// src/components/user-interaction/properties/NumberProperty.tsx
|
|
20427
|
-
var
|
|
20428
|
-
var
|
|
20393
|
+
var import_lucide_react35 = require("lucide-react");
|
|
20394
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
20429
20395
|
var NumberProperty = ({
|
|
20430
20396
|
value,
|
|
20431
20397
|
onValueChange,
|
|
@@ -20437,20 +20403,20 @@ var NumberProperty = ({
|
|
|
20437
20403
|
}) => {
|
|
20438
20404
|
const translation = useHightideTranslation();
|
|
20439
20405
|
const hasValue = value !== void 0;
|
|
20440
|
-
return /* @__PURE__ */ (0,
|
|
20406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
20441
20407
|
PropertyBase,
|
|
20442
20408
|
{
|
|
20443
20409
|
...baseProps,
|
|
20444
20410
|
onValueClear,
|
|
20445
20411
|
hasValue,
|
|
20446
|
-
icon: /* @__PURE__ */ (0,
|
|
20447
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20412
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_lucide_react35.Binary, { size: 24 }),
|
|
20413
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
|
|
20448
20414
|
"div",
|
|
20449
20415
|
{
|
|
20450
20416
|
"data-name": "property-input-wrapper",
|
|
20451
20417
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20452
20418
|
children: [
|
|
20453
|
-
/* @__PURE__ */ (0,
|
|
20419
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
20454
20420
|
Input,
|
|
20455
20421
|
{
|
|
20456
20422
|
"data-name": "property-input",
|
|
@@ -20478,7 +20444,7 @@ var NumberProperty = ({
|
|
|
20478
20444
|
}
|
|
20479
20445
|
}
|
|
20480
20446
|
),
|
|
20481
|
-
suffix && /* @__PURE__ */ (0,
|
|
20447
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
20482
20448
|
"span",
|
|
20483
20449
|
{
|
|
20484
20450
|
"data-name": "property-suffix",
|
|
@@ -20494,8 +20460,8 @@ var NumberProperty = ({
|
|
|
20494
20460
|
};
|
|
20495
20461
|
|
|
20496
20462
|
// src/components/user-interaction/properties/SelectProperty.tsx
|
|
20497
|
-
var
|
|
20498
|
-
var
|
|
20463
|
+
var import_lucide_react36 = require("lucide-react");
|
|
20464
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
20499
20465
|
var SingleSelectProperty = ({
|
|
20500
20466
|
children,
|
|
20501
20467
|
value,
|
|
@@ -20504,18 +20470,18 @@ var SingleSelectProperty = ({
|
|
|
20504
20470
|
...props
|
|
20505
20471
|
}) => {
|
|
20506
20472
|
const hasValue = value !== void 0;
|
|
20507
|
-
return /* @__PURE__ */ (0,
|
|
20473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
20508
20474
|
PropertyBase,
|
|
20509
20475
|
{
|
|
20510
20476
|
...props,
|
|
20511
20477
|
hasValue,
|
|
20512
|
-
icon: /* @__PURE__ */ (0,
|
|
20513
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20478
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_lucide_react36.List, { size: 24 }),
|
|
20479
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
20514
20480
|
"div",
|
|
20515
20481
|
{
|
|
20516
20482
|
"data-name": "property-input-wrapper",
|
|
20517
20483
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20518
|
-
children: /* @__PURE__ */ (0,
|
|
20484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
|
|
20519
20485
|
SelectRoot,
|
|
20520
20486
|
{
|
|
20521
20487
|
value,
|
|
@@ -20525,7 +20491,7 @@ var SingleSelectProperty = ({
|
|
|
20525
20491
|
},
|
|
20526
20492
|
disabled: props.readOnly,
|
|
20527
20493
|
children: [
|
|
20528
|
-
/* @__PURE__ */ (0,
|
|
20494
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
20529
20495
|
SelectButton,
|
|
20530
20496
|
{
|
|
20531
20497
|
className: "flex-row-2 w-full items-center justify-between",
|
|
@@ -20533,7 +20499,7 @@ var SingleSelectProperty = ({
|
|
|
20533
20499
|
"data-name": "property-input"
|
|
20534
20500
|
}
|
|
20535
20501
|
),
|
|
20536
|
-
/* @__PURE__ */ (0,
|
|
20502
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(SelectContent, { children })
|
|
20537
20503
|
]
|
|
20538
20504
|
}
|
|
20539
20505
|
)
|
|
@@ -20543,99 +20509,382 @@ var SingleSelectProperty = ({
|
|
|
20543
20509
|
);
|
|
20544
20510
|
};
|
|
20545
20511
|
|
|
20546
|
-
// src/components/user-interaction/properties/TextProperty.tsx
|
|
20547
|
-
var
|
|
20548
|
-
var
|
|
20549
|
-
var TextProperty = ({
|
|
20550
|
-
value,
|
|
20551
|
-
readOnly,
|
|
20552
|
-
onValueChange,
|
|
20553
|
-
onEditComplete,
|
|
20554
|
-
...baseProps
|
|
20555
|
-
}) => {
|
|
20556
|
-
const translation = useHightideTranslation();
|
|
20557
|
-
const hasValue = value !== void 0;
|
|
20558
|
-
return /* @__PURE__ */ (0,
|
|
20559
|
-
PropertyBase,
|
|
20560
|
-
{
|
|
20561
|
-
...baseProps,
|
|
20562
|
-
hasValue,
|
|
20563
|
-
icon: /* @__PURE__ */ (0,
|
|
20564
|
-
children: ({ invalid }) => /* @__PURE__ */ (0,
|
|
20565
|
-
Textarea,
|
|
20566
|
-
{
|
|
20567
|
-
"data-name": "property-input",
|
|
20568
|
-
className: "w-full",
|
|
20569
|
-
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20570
|
-
rows: 5,
|
|
20571
|
-
value: value ?? "",
|
|
20572
|
-
readOnly,
|
|
20573
|
-
placeholder: translation("text"),
|
|
20574
|
-
onValueChange: (value2) => onValueChange?.(value2),
|
|
20575
|
-
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
20576
|
-
}
|
|
20577
|
-
)
|
|
20512
|
+
// src/components/user-interaction/properties/TextProperty.tsx
|
|
20513
|
+
var import_lucide_react37 = require("lucide-react");
|
|
20514
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
20515
|
+
var TextProperty = ({
|
|
20516
|
+
value,
|
|
20517
|
+
readOnly,
|
|
20518
|
+
onValueChange,
|
|
20519
|
+
onEditComplete,
|
|
20520
|
+
...baseProps
|
|
20521
|
+
}) => {
|
|
20522
|
+
const translation = useHightideTranslation();
|
|
20523
|
+
const hasValue = value !== void 0;
|
|
20524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
20525
|
+
PropertyBase,
|
|
20526
|
+
{
|
|
20527
|
+
...baseProps,
|
|
20528
|
+
hasValue,
|
|
20529
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_lucide_react37.Text, { size: 24 }),
|
|
20530
|
+
children: ({ invalid }) => /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
20531
|
+
Textarea,
|
|
20532
|
+
{
|
|
20533
|
+
"data-name": "property-input",
|
|
20534
|
+
className: "w-full",
|
|
20535
|
+
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
20536
|
+
rows: 5,
|
|
20537
|
+
value: value ?? "",
|
|
20538
|
+
readOnly,
|
|
20539
|
+
placeholder: translation("text"),
|
|
20540
|
+
onValueChange: (value2) => onValueChange?.(value2),
|
|
20541
|
+
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
20542
|
+
}
|
|
20543
|
+
)
|
|
20544
|
+
}
|
|
20545
|
+
);
|
|
20546
|
+
};
|
|
20547
|
+
|
|
20548
|
+
// src/components/utils/Polymorphic.tsx
|
|
20549
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
20550
|
+
var import_react112 = require("react");
|
|
20551
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
20552
|
+
var PolymorphicSlot = (0, import_react112.forwardRef)(function PolymorphicSlot2({
|
|
20553
|
+
children,
|
|
20554
|
+
asChild,
|
|
20555
|
+
defaultComponent = "div",
|
|
20556
|
+
...props
|
|
20557
|
+
}, ref) {
|
|
20558
|
+
const Component = asChild ? import_react_slot.Slot : defaultComponent;
|
|
20559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(Component, { ...props, ref, children });
|
|
20560
|
+
});
|
|
20561
|
+
|
|
20562
|
+
// src/components/utils/Transition.tsx
|
|
20563
|
+
var import_react113 = require("react");
|
|
20564
|
+
function Transition({
|
|
20565
|
+
children,
|
|
20566
|
+
show,
|
|
20567
|
+
includeAnimation = true
|
|
20568
|
+
}) {
|
|
20569
|
+
const [isOpen, setIsOpen] = (0, import_react113.useState)(show);
|
|
20570
|
+
const [isTransitioning, setIsTransitioning] = (0, import_react113.useState)(!isOpen);
|
|
20571
|
+
const isUsingReducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : true;
|
|
20572
|
+
(0, import_react113.useEffect)(() => {
|
|
20573
|
+
setIsOpen(show);
|
|
20574
|
+
setIsTransitioning(true);
|
|
20575
|
+
}, [show]);
|
|
20576
|
+
const onAnimationEnd = () => setIsTransitioning(false);
|
|
20577
|
+
const bag = {
|
|
20578
|
+
isOpen,
|
|
20579
|
+
isTransitioning,
|
|
20580
|
+
isUsingReducedMotion,
|
|
20581
|
+
data: {
|
|
20582
|
+
"data-open": isOpen && !isTransitioning ? "" : void 0,
|
|
20583
|
+
"data-opening": isOpen && isTransitioning ? "" : void 0,
|
|
20584
|
+
"data-closing": !isOpen && isTransitioning ? "" : void 0,
|
|
20585
|
+
"data-closed": !isOpen && !isTransitioning ? "" : void 0
|
|
20586
|
+
},
|
|
20587
|
+
handlers: {
|
|
20588
|
+
onTransitionEnd: () => setIsTransitioning(false),
|
|
20589
|
+
onTransitionCancel: () => setIsTransitioning(false),
|
|
20590
|
+
onAnimationEnd: includeAnimation ? onAnimationEnd : void 0
|
|
20591
|
+
}
|
|
20592
|
+
};
|
|
20593
|
+
return BagFunctionUtil.resolve(children, bag);
|
|
20594
|
+
}
|
|
20595
|
+
|
|
20596
|
+
// src/global-contexts/HightideProvider.tsx
|
|
20597
|
+
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
20598
|
+
var HightideProvider = ({
|
|
20599
|
+
children,
|
|
20600
|
+
theme,
|
|
20601
|
+
locale,
|
|
20602
|
+
config
|
|
20603
|
+
}) => {
|
|
20604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(LocaleProvider, { ...locale, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ThemeProvider, { ...theme, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(HightideConfigProvider, { ...config, children }) }) });
|
|
20605
|
+
};
|
|
20606
|
+
|
|
20607
|
+
// src/hooks/focus/useFocusGuards.ts
|
|
20608
|
+
var import_react114 = require("react");
|
|
20609
|
+
var selectorName = "data-hw-focus-guard";
|
|
20610
|
+
function FocusGuard() {
|
|
20611
|
+
const element = document.createElement("div");
|
|
20612
|
+
element.setAttribute(selectorName, "");
|
|
20613
|
+
element.tabIndex = 0;
|
|
20614
|
+
element.style.border = "none";
|
|
20615
|
+
element.style.outline = "none";
|
|
20616
|
+
element.style.boxShadow = "none";
|
|
20617
|
+
element.style.opacity = "0";
|
|
20618
|
+
element.style.position = "fixed";
|
|
20619
|
+
element.style.pointerEvents = "none";
|
|
20620
|
+
return element;
|
|
20621
|
+
}
|
|
20622
|
+
var FocusGuardsService = class _FocusGuardsService {
|
|
20623
|
+
constructor() {
|
|
20624
|
+
this.count = 0;
|
|
20625
|
+
}
|
|
20626
|
+
static getInstance() {
|
|
20627
|
+
if (!_FocusGuardsService.instance) {
|
|
20628
|
+
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
20629
|
+
}
|
|
20630
|
+
return _FocusGuardsService.instance;
|
|
20631
|
+
}
|
|
20632
|
+
add() {
|
|
20633
|
+
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
20634
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
20635
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
20636
|
+
this.count++;
|
|
20637
|
+
}
|
|
20638
|
+
remove() {
|
|
20639
|
+
if (this.count === 1) {
|
|
20640
|
+
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
20641
|
+
}
|
|
20642
|
+
this.count--;
|
|
20643
|
+
}
|
|
20644
|
+
};
|
|
20645
|
+
var useFocusGuards = () => {
|
|
20646
|
+
(0, import_react114.useEffect)(() => {
|
|
20647
|
+
FocusGuardsService.getInstance().add();
|
|
20648
|
+
return () => {
|
|
20649
|
+
FocusGuardsService.getInstance().remove();
|
|
20650
|
+
};
|
|
20651
|
+
}, []);
|
|
20652
|
+
};
|
|
20653
|
+
|
|
20654
|
+
// src/hooks/focus/useFocusOnceVisible.ts
|
|
20655
|
+
var import_react115 = __toESM(require("react"));
|
|
20656
|
+
var useFocusOnceVisible = (ref, disable = false) => {
|
|
20657
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react115.default.useState(false);
|
|
20658
|
+
(0, import_react115.useEffect)(() => {
|
|
20659
|
+
if (disable || hasUsedFocus) {
|
|
20660
|
+
return;
|
|
20661
|
+
}
|
|
20662
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
20663
|
+
if (entry.isIntersecting && !hasUsedFocus) {
|
|
20664
|
+
ref.current?.focus();
|
|
20665
|
+
setHasUsedFocus(hasUsedFocus);
|
|
20666
|
+
}
|
|
20667
|
+
}, {
|
|
20668
|
+
threshold: 0.1
|
|
20669
|
+
});
|
|
20670
|
+
if (ref.current) {
|
|
20671
|
+
observer.observe(ref.current);
|
|
20672
|
+
}
|
|
20673
|
+
return () => observer.disconnect();
|
|
20674
|
+
}, [disable, hasUsedFocus, ref]);
|
|
20675
|
+
};
|
|
20676
|
+
|
|
20677
|
+
// src/hooks/focus/useIsMounted.ts
|
|
20678
|
+
var import_react116 = require("react");
|
|
20679
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
20680
|
+
var useIsomorphicEffect = isClient ? import_react116.useLayoutEffect : import_react116.useEffect;
|
|
20681
|
+
var useIsMounted = () => {
|
|
20682
|
+
const [isMounted, setIsMounted] = (0, import_react116.useState)(false);
|
|
20683
|
+
useIsomorphicEffect(() => {
|
|
20684
|
+
setIsMounted(true);
|
|
20685
|
+
return () => {
|
|
20686
|
+
setIsMounted(false);
|
|
20687
|
+
};
|
|
20688
|
+
}, []);
|
|
20689
|
+
return isMounted;
|
|
20690
|
+
};
|
|
20691
|
+
|
|
20692
|
+
// src/hooks/useHandleRefs.ts
|
|
20693
|
+
var import_react117 = require("react");
|
|
20694
|
+
function useHandleRefs(handleRef) {
|
|
20695
|
+
const refs = (0, import_react117.useRef)([]);
|
|
20696
|
+
(0, import_react117.useEffect)(() => {
|
|
20697
|
+
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
20698
|
+
() => ({ current: null })
|
|
20699
|
+
);
|
|
20700
|
+
const values = Object.values(handleRef?.current ?? {});
|
|
20701
|
+
values.forEach((el, i) => {
|
|
20702
|
+
refs.current[i].current = el;
|
|
20703
|
+
});
|
|
20704
|
+
});
|
|
20705
|
+
return refs.current;
|
|
20706
|
+
}
|
|
20707
|
+
|
|
20708
|
+
// src/hooks/useLogUnstableDependencies.ts
|
|
20709
|
+
var import_react118 = __toESM(require("react"));
|
|
20710
|
+
function useLogUnstableDependencies(name, value) {
|
|
20711
|
+
const prev = import_react118.default.useRef(null);
|
|
20712
|
+
import_react118.default.useEffect(() => {
|
|
20713
|
+
if (!prev.current) {
|
|
20714
|
+
prev.current = value;
|
|
20715
|
+
return;
|
|
20578
20716
|
}
|
|
20579
|
-
|
|
20580
|
-
|
|
20717
|
+
const changes = {};
|
|
20718
|
+
for (const key of Object.keys(value)) {
|
|
20719
|
+
if (prev.current[key] !== value[key]) {
|
|
20720
|
+
changes[key] = {
|
|
20721
|
+
prev: prev.current[key],
|
|
20722
|
+
next: value[key]
|
|
20723
|
+
};
|
|
20724
|
+
}
|
|
20725
|
+
}
|
|
20726
|
+
if (Object.keys(changes).length > 0) {
|
|
20727
|
+
console.info(`[${name}] changed`, changes);
|
|
20728
|
+
}
|
|
20729
|
+
prev.current = value;
|
|
20730
|
+
});
|
|
20731
|
+
}
|
|
20581
20732
|
|
|
20582
|
-
// src/
|
|
20583
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
20733
|
+
// src/hooks/useOverwritableState.ts
|
|
20584
20734
|
var import_react119 = require("react");
|
|
20585
|
-
var
|
|
20586
|
-
|
|
20587
|
-
|
|
20588
|
-
|
|
20589
|
-
|
|
20590
|
-
|
|
20591
|
-
|
|
20592
|
-
|
|
20593
|
-
|
|
20594
|
-
}
|
|
20735
|
+
var useOverwritableState = (overwriteValue, onChange) => {
|
|
20736
|
+
const [state, setState] = (0, import_react119.useState)(overwriteValue);
|
|
20737
|
+
(0, import_react119.useEffect)(() => {
|
|
20738
|
+
setState(overwriteValue);
|
|
20739
|
+
}, [overwriteValue]);
|
|
20740
|
+
const onChangeWrapper = (action) => {
|
|
20741
|
+
const resolved = resolveSetState(action, state);
|
|
20742
|
+
setState(resolved);
|
|
20743
|
+
onChange?.(resolved);
|
|
20744
|
+
};
|
|
20745
|
+
return [state, onChangeWrapper];
|
|
20746
|
+
};
|
|
20595
20747
|
|
|
20596
|
-
// src/
|
|
20748
|
+
// src/hooks/useRerender.ts
|
|
20597
20749
|
var import_react120 = require("react");
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20603
|
-
|
|
20604
|
-
|
|
20605
|
-
const
|
|
20606
|
-
|
|
20607
|
-
|
|
20608
|
-
|
|
20609
|
-
|
|
20610
|
-
|
|
20611
|
-
|
|
20612
|
-
|
|
20613
|
-
|
|
20614
|
-
|
|
20615
|
-
|
|
20616
|
-
|
|
20617
|
-
|
|
20618
|
-
|
|
20619
|
-
|
|
20620
|
-
|
|
20621
|
-
|
|
20622
|
-
|
|
20623
|
-
|
|
20624
|
-
|
|
20625
|
-
|
|
20750
|
+
var useRerender = () => {
|
|
20751
|
+
return (0, import_react120.useReducer)(() => ({}), {})[1];
|
|
20752
|
+
};
|
|
20753
|
+
|
|
20754
|
+
// src/hooks/useUpdatingDateString.ts
|
|
20755
|
+
var import_react121 = require("react");
|
|
20756
|
+
var useUpdatingDateString = ({ absoluteFormat = "dateTime", localeOverride, date }) => {
|
|
20757
|
+
const { locale: contextLocale } = useLocale();
|
|
20758
|
+
const locale = localeOverride ?? contextLocale;
|
|
20759
|
+
const [dateAndTimeStrings, setDateAndTimeStrings] = (0, import_react121.useState)({
|
|
20760
|
+
compareDate: date,
|
|
20761
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20762
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20763
|
+
});
|
|
20764
|
+
(0, import_react121.useEffect)(() => {
|
|
20765
|
+
setDateAndTimeStrings({
|
|
20766
|
+
compareDate: date,
|
|
20767
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20768
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20769
|
+
});
|
|
20770
|
+
}, [date, absoluteFormat, locale]);
|
|
20771
|
+
(0, import_react121.useEffect)(() => {
|
|
20772
|
+
let timeoutId;
|
|
20773
|
+
const startTimer = () => {
|
|
20774
|
+
const now = /* @__PURE__ */ new Date();
|
|
20775
|
+
const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
|
|
20776
|
+
let delayInSeconds;
|
|
20777
|
+
if (diff < DateUtils.timesInSeconds.minute) {
|
|
20778
|
+
delayInSeconds = DateUtils.timesInSeconds.second;
|
|
20779
|
+
} else if (diff < DateUtils.timesInSeconds.hour) {
|
|
20780
|
+
delayInSeconds = DateUtils.timesInSeconds.minute;
|
|
20781
|
+
} else {
|
|
20782
|
+
delayInSeconds = DateUtils.timesInSeconds.hour;
|
|
20783
|
+
}
|
|
20784
|
+
timeoutId = setInterval(() => {
|
|
20785
|
+
setDateAndTimeStrings({
|
|
20786
|
+
compareDate: date,
|
|
20787
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
20788
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
20789
|
+
});
|
|
20790
|
+
}, delayInSeconds * 1e3 / 2);
|
|
20791
|
+
};
|
|
20792
|
+
startTimer();
|
|
20793
|
+
return () => clearInterval(timeoutId);
|
|
20794
|
+
}, [absoluteFormat, date, locale]);
|
|
20795
|
+
return {
|
|
20796
|
+
absolute: dateAndTimeStrings.absolute,
|
|
20797
|
+
relative: dateAndTimeStrings.relative
|
|
20626
20798
|
};
|
|
20627
|
-
|
|
20628
|
-
}
|
|
20799
|
+
};
|
|
20629
20800
|
|
|
20630
|
-
// src/
|
|
20631
|
-
var
|
|
20632
|
-
|
|
20633
|
-
|
|
20634
|
-
|
|
20635
|
-
|
|
20636
|
-
|
|
20637
|
-
|
|
20638
|
-
|
|
20801
|
+
// src/utils/emailValidation.ts
|
|
20802
|
+
var validateEmail = (email) => {
|
|
20803
|
+
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
20804
|
+
};
|
|
20805
|
+
|
|
20806
|
+
// src/hooks/useValidators.ts
|
|
20807
|
+
var import_react122 = require("react");
|
|
20808
|
+
var notEmpty = (value) => {
|
|
20809
|
+
if (!value) {
|
|
20810
|
+
return "notEmpty";
|
|
20811
|
+
}
|
|
20812
|
+
};
|
|
20813
|
+
var boundsValidator = (length, bounds) => {
|
|
20814
|
+
const [min, max] = bounds;
|
|
20815
|
+
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
20816
|
+
return "range";
|
|
20817
|
+
}
|
|
20818
|
+
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
20819
|
+
return "lower";
|
|
20820
|
+
}
|
|
20821
|
+
if (max !== void 0 && length !== void 0 && length > max) {
|
|
20822
|
+
return "upper";
|
|
20823
|
+
}
|
|
20824
|
+
return "none";
|
|
20825
|
+
};
|
|
20826
|
+
var lengthValidator = (value, bounds) => {
|
|
20827
|
+
const mapping = {
|
|
20828
|
+
range: "outOfRangeString",
|
|
20829
|
+
lower: "tooShort",
|
|
20830
|
+
upper: "tooLong",
|
|
20831
|
+
none: void 0
|
|
20832
|
+
};
|
|
20833
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
20834
|
+
};
|
|
20835
|
+
var selectionValidator = (value, bounds) => {
|
|
20836
|
+
const mapping = {
|
|
20837
|
+
range: "outOfRangeSelectionItems",
|
|
20838
|
+
lower: "tooFewSelectionItems",
|
|
20839
|
+
upper: "tooManySelectionItems",
|
|
20840
|
+
none: void 0
|
|
20841
|
+
};
|
|
20842
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
20843
|
+
};
|
|
20844
|
+
var emailValidator = (value) => {
|
|
20845
|
+
if (!value || !validateEmail(value)) {
|
|
20846
|
+
return "invalidEmail";
|
|
20847
|
+
}
|
|
20848
|
+
};
|
|
20849
|
+
var UseValidators = {
|
|
20850
|
+
notEmpty,
|
|
20851
|
+
length: lengthValidator,
|
|
20852
|
+
email: emailValidator,
|
|
20853
|
+
selection: selectionValidator
|
|
20854
|
+
};
|
|
20855
|
+
var useTranslatedValidators = () => {
|
|
20856
|
+
const translation = useHightideTranslation();
|
|
20857
|
+
return (0, import_react122.useMemo)(() => ({
|
|
20858
|
+
notEmpty: (value) => {
|
|
20859
|
+
const result = notEmpty(value);
|
|
20860
|
+
if (result) {
|
|
20861
|
+
return translation(result);
|
|
20862
|
+
}
|
|
20863
|
+
},
|
|
20864
|
+
length: (value, length) => {
|
|
20865
|
+
const [min, max] = length;
|
|
20866
|
+
const result = lengthValidator(value, length);
|
|
20867
|
+
if (result) {
|
|
20868
|
+
return translation(result, { min, max });
|
|
20869
|
+
}
|
|
20870
|
+
},
|
|
20871
|
+
email: (value) => {
|
|
20872
|
+
const result = emailValidator(value ?? "");
|
|
20873
|
+
if (result) {
|
|
20874
|
+
return translation(result);
|
|
20875
|
+
}
|
|
20876
|
+
},
|
|
20877
|
+
selection: (value, length) => {
|
|
20878
|
+
const [min, max] = length;
|
|
20879
|
+
const result = selectionValidator(value, length);
|
|
20880
|
+
if (result) {
|
|
20881
|
+
return translation(
|
|
20882
|
+
result,
|
|
20883
|
+
{ min, max }
|
|
20884
|
+
);
|
|
20885
|
+
}
|
|
20886
|
+
}
|
|
20887
|
+
}), [translation]);
|
|
20639
20888
|
};
|
|
20640
20889
|
|
|
20641
20890
|
// src/utils/builder.ts
|
|
@@ -20932,6 +21181,7 @@ var PromiseUtils = {
|
|
|
20932
21181
|
FilterOperatorUtils,
|
|
20933
21182
|
FilterPopUp,
|
|
20934
21183
|
FilterValueUtils,
|
|
21184
|
+
FlexibleDateTimeInput,
|
|
20935
21185
|
FocusTrap,
|
|
20936
21186
|
FocusTrapWrapper,
|
|
20937
21187
|
FormContext,
|
|
@@ -21006,6 +21256,7 @@ var PromiseUtils = {
|
|
|
21006
21256
|
SimpleSearch,
|
|
21007
21257
|
SimpleSearchWithMapping,
|
|
21008
21258
|
SingleSelectProperty,
|
|
21259
|
+
SortingList,
|
|
21009
21260
|
StepperBar,
|
|
21010
21261
|
StorageListener,
|
|
21011
21262
|
Switch,
|