@helpwave/hightide 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +47 -23
- package/dist/index.d.ts +47 -23
- package/dist/index.js +363 -310
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +538 -478
- package/dist/index.mjs.map +1 -1
- package/dist/style/globals.css +78 -0
- package/dist/style/uncompiled/theme/components/date-time-input.css +7 -0
- package/dist/style/uncompiled/theme/components/index.css +2 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10104,13 +10104,13 @@ var DividerInserter = ({
|
|
|
10104
10104
|
};
|
|
10105
10105
|
|
|
10106
10106
|
// src/components/layout/Expandable.tsx
|
|
10107
|
-
import { useEffect as
|
|
10107
|
+
import { useEffect as useEffect14, useImperativeHandle as useImperativeHandle4, useRef as useRef11 } from "react";
|
|
10108
10108
|
import { useState as useState12 } from "react";
|
|
10109
|
-
import { createContext as createContext6, forwardRef as forwardRef7, useCallback as
|
|
10109
|
+
import { createContext as createContext6, forwardRef as forwardRef7, useCallback as useCallback10, useContext as useContext6, useId as useId5, useMemo as useMemo11 } from "react";
|
|
10110
10110
|
import clsx4 from "clsx";
|
|
10111
10111
|
|
|
10112
10112
|
// src/hooks/useControlledState.ts
|
|
10113
|
-
import { useState as useState11 } from "react";
|
|
10113
|
+
import { useCallback as useCallback9, useEffect as useEffect13, useRef as useRef10, useState as useState11 } from "react";
|
|
10114
10114
|
|
|
10115
10115
|
// src/utils/resolveSetState.ts
|
|
10116
10116
|
function resolveSetState(action, prev) {
|
|
@@ -10119,28 +10119,34 @@ function resolveSetState(action, prev) {
|
|
|
10119
10119
|
|
|
10120
10120
|
// src/hooks/useControlledState.ts
|
|
10121
10121
|
var useControlledState = ({
|
|
10122
|
-
value,
|
|
10122
|
+
value: controlledValue,
|
|
10123
10123
|
onValueChange,
|
|
10124
10124
|
defaultValue,
|
|
10125
10125
|
isControlled: isEnforcingControlled
|
|
10126
10126
|
}) => {
|
|
10127
|
-
const [internalValue, setInternalValue] = useState11(defaultValue);
|
|
10128
|
-
const [isControlled] = useState11(isEnforcingControlled ||
|
|
10127
|
+
const [internalValue, setInternalValue] = useState11(() => defaultValue);
|
|
10128
|
+
const [isControlled] = useState11(isEnforcingControlled || controlledValue !== void 0);
|
|
10129
10129
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
10130
10130
|
useLogOnce(
|
|
10131
10131
|
"useControlledState: Attempted to change from controlled to uncontrolled or vice versa.For a controlled state: isControlled === true OR value !== undefinedFor an uncontrolled state: isControlled === false OR value === undefined",
|
|
10132
|
-
isControlled !== (isEnforcingControlled ||
|
|
10132
|
+
isControlled !== (isEnforcingControlled || controlledValue !== void 0),
|
|
10133
10133
|
{ type: "error" }
|
|
10134
10134
|
);
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10135
|
+
const lastValue = useRef10(isControlled ? controlledValue : internalValue);
|
|
10136
|
+
useEffect13(() => {
|
|
10137
|
+
lastValue.current = isControlled ? controlledValue : internalValue;
|
|
10138
|
+
}, [isControlled, controlledValue, internalValue]);
|
|
10139
|
+
const setState = useCallback9((action) => {
|
|
10140
|
+
const resolved = resolveSetState(action, lastValue.current);
|
|
10141
|
+
if (resolved === lastValue.current) return;
|
|
10142
|
+
if (!isControlled) {
|
|
10143
|
+
lastValue.current = resolved;
|
|
10144
|
+
setInternalValue(resolved);
|
|
10145
|
+
}
|
|
10141
10146
|
onValueChangeStable(resolved);
|
|
10142
|
-
};
|
|
10143
|
-
|
|
10147
|
+
}, [onValueChangeStable, isControlled]);
|
|
10148
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
10149
|
+
return [value, setState];
|
|
10144
10150
|
};
|
|
10145
10151
|
|
|
10146
10152
|
// src/components/layout/Expandable.tsx
|
|
@@ -10174,7 +10180,7 @@ var ExpandableRoot = forwardRef7(function ExpandableRoot2({
|
|
|
10174
10180
|
onValueChange: onExpandedChange,
|
|
10175
10181
|
defaultValue: isInitialExpanded
|
|
10176
10182
|
});
|
|
10177
|
-
const toggle =
|
|
10183
|
+
const toggle = useCallback10(() => {
|
|
10178
10184
|
if (!disabled) {
|
|
10179
10185
|
setIsExpanded(!isExpanded);
|
|
10180
10186
|
}
|
|
@@ -10213,7 +10219,7 @@ var ExpandableHeader = forwardRef7(function ExpandableHeader2({
|
|
|
10213
10219
|
...props
|
|
10214
10220
|
}, ref) {
|
|
10215
10221
|
const { isExpanded, toggle, ids, setIds, disabled } = useExpandableContext();
|
|
10216
|
-
|
|
10222
|
+
useEffect14(() => {
|
|
10217
10223
|
if (props.id) {
|
|
10218
10224
|
setIds((prevState) => ({ ...prevState, header: props.id }));
|
|
10219
10225
|
}
|
|
@@ -10248,9 +10254,9 @@ var ExpandableContent = forwardRef7(function ExpandableContent2({
|
|
|
10248
10254
|
...props
|
|
10249
10255
|
}, forwardedRef) {
|
|
10250
10256
|
const { isExpanded, ids, setIds } = useExpandableContext();
|
|
10251
|
-
const ref =
|
|
10257
|
+
const ref = useRef11(null);
|
|
10252
10258
|
useImperativeHandle4(forwardedRef, () => ref.current, [ref]);
|
|
10253
|
-
|
|
10259
|
+
useEffect14(() => {
|
|
10254
10260
|
if (props.id) {
|
|
10255
10261
|
setIds((prevState) => ({ ...prevState, content: props.id }));
|
|
10256
10262
|
}
|
|
@@ -10308,11 +10314,11 @@ var FAQSection = ({
|
|
|
10308
10314
|
|
|
10309
10315
|
// src/components/layout/InifiniteScroll.tsx
|
|
10310
10316
|
import {
|
|
10311
|
-
useRef as
|
|
10317
|
+
useRef as useRef12,
|
|
10312
10318
|
useState as useState13,
|
|
10313
10319
|
useLayoutEffect as useLayoutEffect5,
|
|
10314
10320
|
useMemo as useMemo12,
|
|
10315
|
-
useCallback as
|
|
10321
|
+
useCallback as useCallback11
|
|
10316
10322
|
} from "react";
|
|
10317
10323
|
import clsx5 from "clsx";
|
|
10318
10324
|
import { ChevronDown as ChevronDown2, ChevronUp } from "lucide-react";
|
|
@@ -10334,8 +10340,8 @@ function InfiniteScroll({
|
|
|
10334
10340
|
throw new Error("InfiniteScroll: itemCount > 0 must hold");
|
|
10335
10341
|
}
|
|
10336
10342
|
const items = useMemo12(() => range(itemCount), [itemCount]);
|
|
10337
|
-
const containerRef =
|
|
10338
|
-
const snapshotRef =
|
|
10343
|
+
const containerRef = useRef12(null);
|
|
10344
|
+
const snapshotRef = useRef12({ scrollHeight: 0, scrollTop: 0, fromTop: false });
|
|
10339
10345
|
const [windowState, setWindowState] = useState13(() => {
|
|
10340
10346
|
let index = initialIndex;
|
|
10341
10347
|
if (index < 0) {
|
|
@@ -10348,14 +10354,14 @@ function InfiniteScroll({
|
|
|
10348
10354
|
end: Math.min(items.length, safeStart + bufferSize)
|
|
10349
10355
|
};
|
|
10350
10356
|
});
|
|
10351
|
-
const addToStart =
|
|
10357
|
+
const addToStart = useCallback11((amount = stepSize) => {
|
|
10352
10358
|
setWindowState((prev) => {
|
|
10353
10359
|
const newStart = Math.max(0, prev.start - amount);
|
|
10354
10360
|
const newEnd = Math.min(items.length, newStart + bufferSize);
|
|
10355
10361
|
return { start: newStart, end: newEnd };
|
|
10356
10362
|
});
|
|
10357
10363
|
}, [bufferSize, items.length, stepSize]);
|
|
10358
|
-
const addToEnd =
|
|
10364
|
+
const addToEnd = useCallback11((amount = stepSize) => {
|
|
10359
10365
|
setWindowState((prev) => {
|
|
10360
10366
|
const newEnd = Math.min(items.length, prev.end + amount);
|
|
10361
10367
|
const newStart = Math.max(0, newEnd - bufferSize);
|
|
@@ -10403,7 +10409,7 @@ function InfiniteScroll({
|
|
|
10403
10409
|
}
|
|
10404
10410
|
|
|
10405
10411
|
// src/components/layout/ListBox.tsx
|
|
10406
|
-
import React2, { createContext as createContext7, forwardRef as forwardRef8, useCallback as
|
|
10412
|
+
import React2, { createContext as createContext7, forwardRef as forwardRef8, useCallback as useCallback12, useContext as useContext7, useEffect as useEffect15, useRef as useRef13, useState as useState14 } from "react";
|
|
10407
10413
|
import { clsx as clsx6 } from "clsx";
|
|
10408
10414
|
|
|
10409
10415
|
// src/utils/match.ts
|
|
@@ -10431,9 +10437,9 @@ var ListBoxItem = forwardRef8(
|
|
|
10431
10437
|
onItemClick,
|
|
10432
10438
|
isSelected
|
|
10433
10439
|
} = useListBoxContext();
|
|
10434
|
-
const itemRef =
|
|
10440
|
+
const itemRef = useRef13(null);
|
|
10435
10441
|
const id = React2.useId();
|
|
10436
|
-
|
|
10442
|
+
useEffect15(() => {
|
|
10437
10443
|
registerItem({ id, value, disabled, ref: itemRef });
|
|
10438
10444
|
return () => unregisterItem(id);
|
|
10439
10445
|
}, [id, value, disabled, registerItem, unregisterItem]);
|
|
@@ -10491,9 +10497,9 @@ var ListBoxPrimitive = forwardRef8(
|
|
|
10491
10497
|
onValueChange: onSelectionChanged,
|
|
10492
10498
|
defaultValue: initialValue
|
|
10493
10499
|
});
|
|
10494
|
-
const itemsRef =
|
|
10500
|
+
const itemsRef = useRef13([]);
|
|
10495
10501
|
const [highlightedIndex, setHighlightedIndex] = useState14(void 0);
|
|
10496
|
-
const registerItem =
|
|
10502
|
+
const registerItem = useCallback12((item) => {
|
|
10497
10503
|
itemsRef.current.push(item);
|
|
10498
10504
|
itemsRef.current.sort((a, b) => {
|
|
10499
10505
|
const aEl = a.ref.current;
|
|
@@ -10502,14 +10508,14 @@ var ListBoxPrimitive = forwardRef8(
|
|
|
10502
10508
|
return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
10503
10509
|
});
|
|
10504
10510
|
}, []);
|
|
10505
|
-
const unregisterItem =
|
|
10511
|
+
const unregisterItem = useCallback12((id) => {
|
|
10506
10512
|
itemsRef.current = itemsRef.current.filter((i) => i.id !== id);
|
|
10507
10513
|
}, []);
|
|
10508
|
-
const isSelected =
|
|
10514
|
+
const isSelected = useCallback12(
|
|
10509
10515
|
(val) => (value ?? []).includes(val),
|
|
10510
10516
|
[value]
|
|
10511
10517
|
);
|
|
10512
|
-
const onItemClickedHandler =
|
|
10518
|
+
const onItemClickedHandler = useCallback12(
|
|
10513
10519
|
(id) => {
|
|
10514
10520
|
const index = itemsRef.current.findIndex((i) => i.id === id);
|
|
10515
10521
|
if (index === -1) {
|
|
@@ -10533,13 +10539,13 @@ var ListBoxPrimitive = forwardRef8(
|
|
|
10533
10539
|
},
|
|
10534
10540
|
[onItemClicked, isSelection, isMultiple, setValue, isSelected, value]
|
|
10535
10541
|
);
|
|
10536
|
-
const setHighlightedId =
|
|
10542
|
+
const setHighlightedId = useCallback12((id) => {
|
|
10537
10543
|
const index = itemsRef.current.findIndex((i) => i.id === id);
|
|
10538
10544
|
if (index !== -1) {
|
|
10539
10545
|
setHighlightedIndex(index);
|
|
10540
10546
|
}
|
|
10541
10547
|
}, []);
|
|
10542
|
-
|
|
10548
|
+
useEffect15(() => {
|
|
10543
10549
|
if (highlightedIndex !== void 0) {
|
|
10544
10550
|
itemsRef.current[highlightedIndex]?.ref.current?.scrollIntoView({ block: "nearest", behavior: "auto" });
|
|
10545
10551
|
}
|
|
@@ -10880,8 +10886,8 @@ var MarkdownInterpreter = ({ text, className }) => {
|
|
|
10880
10886
|
};
|
|
10881
10887
|
|
|
10882
10888
|
// src/components/layout/TabSwitcher.tsx
|
|
10883
|
-
import { useCallback as
|
|
10884
|
-
import { createContext as createContext8, useContext as useContext8, useEffect as
|
|
10889
|
+
import { useCallback as useCallback13, useId as useId6, useState as useState15 } from "react";
|
|
10890
|
+
import { createContext as createContext8, useContext as useContext8, useEffect as useEffect16, useRef as useRef14 } from "react";
|
|
10885
10891
|
import clsx7 from "clsx";
|
|
10886
10892
|
|
|
10887
10893
|
// src/utils/propsUtil.ts
|
|
@@ -11052,7 +11058,7 @@ function TabSwitcher({ children }) {
|
|
|
11052
11058
|
infos: []
|
|
11053
11059
|
});
|
|
11054
11060
|
const [portalState, setPortalState] = useState15(null);
|
|
11055
|
-
const subscribe =
|
|
11061
|
+
const subscribe = useCallback13((info) => {
|
|
11056
11062
|
const id = info.id;
|
|
11057
11063
|
setState((prevState) => {
|
|
11058
11064
|
const existingIndex = prevState.infos.findIndex((t) => t.id === id);
|
|
@@ -11073,10 +11079,10 @@ function TabSwitcher({ children }) {
|
|
|
11073
11079
|
});
|
|
11074
11080
|
};
|
|
11075
11081
|
}, []);
|
|
11076
|
-
const registerPortal =
|
|
11082
|
+
const registerPortal = useCallback13((state2) => {
|
|
11077
11083
|
setPortalState(state2);
|
|
11078
11084
|
}, []);
|
|
11079
|
-
const setActiveId =
|
|
11085
|
+
const setActiveId = useCallback13((activeId) => {
|
|
11080
11086
|
setState((prevState) => ({ ...prevState, activeId }));
|
|
11081
11087
|
}, []);
|
|
11082
11088
|
return /* @__PURE__ */ jsx25(
|
|
@@ -11102,7 +11108,7 @@ function TabSwitcher({ children }) {
|
|
|
11102
11108
|
function TabList({ ...props }) {
|
|
11103
11109
|
const { tabs } = useTabContext();
|
|
11104
11110
|
const { info, activeId, setActiveId: setActive } = tabs;
|
|
11105
|
-
const refs =
|
|
11111
|
+
const refs = useRef14({});
|
|
11106
11112
|
const onKeyDown = (e) => {
|
|
11107
11113
|
const idx = info.findIndex((tab) => tab.id === activeId);
|
|
11108
11114
|
if (idx === -1) return;
|
|
@@ -11159,8 +11165,8 @@ function TabView({ ...props }) {
|
|
|
11159
11165
|
const id = props.id ?? "tab-view-" + generated;
|
|
11160
11166
|
const { portal } = useTabContext();
|
|
11161
11167
|
const { setPortal } = portal;
|
|
11162
|
-
const ref =
|
|
11163
|
-
|
|
11168
|
+
const ref = useRef14(null);
|
|
11169
|
+
useEffect16(() => {
|
|
11164
11170
|
setPortal({ id, ref });
|
|
11165
11171
|
return () => setPortal(null);
|
|
11166
11172
|
}, [id, setPortal]);
|
|
@@ -11180,8 +11186,8 @@ function TabPanel({ label, forceMount = false, disabled = false, ...props }) {
|
|
|
11180
11186
|
const generatedId = useId6();
|
|
11181
11187
|
const id = props.id ?? "tab-panel-" + generatedId;
|
|
11182
11188
|
const labelId = "tab-list-button-" + generatedId;
|
|
11183
|
-
const ref =
|
|
11184
|
-
|
|
11189
|
+
const ref = useRef14(null);
|
|
11190
|
+
useEffect16(() => {
|
|
11185
11191
|
return subscribe({ id, label, labelId, disabled, ref });
|
|
11186
11192
|
}, [id, label, labelId, disabled, subscribe]);
|
|
11187
11193
|
const isActive = activeId === id;
|
|
@@ -11317,11 +11323,11 @@ var VerticalDivider = ({
|
|
|
11317
11323
|
};
|
|
11318
11324
|
|
|
11319
11325
|
// src/components/layout/dialog/Dialog.tsx
|
|
11320
|
-
import { forwardRef as forwardRef10, useCallback as
|
|
11326
|
+
import { forwardRef as forwardRef10, useCallback as useCallback16, useContext as useContext10, useId as useId8, useImperativeHandle as useImperativeHandle6, useMemo as useMemo13, useRef as useRef18 } from "react";
|
|
11321
11327
|
import { X } from "lucide-react";
|
|
11322
11328
|
|
|
11323
11329
|
// src/hooks/focus/useFocusTrap.ts
|
|
11324
|
-
import { useCallback as
|
|
11330
|
+
import { useCallback as useCallback14, useEffect as useEffect17, useId as useId7, useRef as useRef15, useState as useState16 } from "react";
|
|
11325
11331
|
var createFocusGuard = () => {
|
|
11326
11332
|
const div = document.createElement("div");
|
|
11327
11333
|
Object.assign(div.style, {
|
|
@@ -11437,10 +11443,10 @@ var useFocusTrap = ({
|
|
|
11437
11443
|
active,
|
|
11438
11444
|
initialFocus
|
|
11439
11445
|
}) => {
|
|
11440
|
-
const lastFocusRef =
|
|
11446
|
+
const lastFocusRef = useRef15(null);
|
|
11441
11447
|
const [paused, setPaused] = useState16(false);
|
|
11442
11448
|
const id = useId7();
|
|
11443
|
-
const focusElement =
|
|
11449
|
+
const focusElement = useCallback14(() => {
|
|
11444
11450
|
const containerElement = container.current;
|
|
11445
11451
|
if (initialFocus?.current) {
|
|
11446
11452
|
initialFocus.current.focus();
|
|
@@ -11454,7 +11460,7 @@ var useFocusTrap = ({
|
|
|
11454
11460
|
}
|
|
11455
11461
|
}
|
|
11456
11462
|
}, [container, initialFocus]);
|
|
11457
|
-
|
|
11463
|
+
useEffect17(() => {
|
|
11458
11464
|
if (active) {
|
|
11459
11465
|
let pause = function() {
|
|
11460
11466
|
setPaused(true);
|
|
@@ -11479,7 +11485,7 @@ var useFocusTrap = ({
|
|
|
11479
11485
|
};
|
|
11480
11486
|
}
|
|
11481
11487
|
}, [active, container, focusElement, id, initialFocus]);
|
|
11482
|
-
|
|
11488
|
+
useEffect17(() => {
|
|
11483
11489
|
if (active && !paused) {
|
|
11484
11490
|
let onKeyDown = function(event) {
|
|
11485
11491
|
const key = event.key;
|
|
@@ -11507,7 +11513,7 @@ var useFocusTrap = ({
|
|
|
11507
11513
|
};
|
|
11508
11514
|
|
|
11509
11515
|
// src/components/utils/FocusTrap.tsx
|
|
11510
|
-
import { useRef as
|
|
11516
|
+
import { useRef as useRef16 } from "react";
|
|
11511
11517
|
import { useImperativeHandle as useImperativeHandle5 } from "react";
|
|
11512
11518
|
import { forwardRef as forwardRef9 } from "react";
|
|
11513
11519
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
@@ -11522,24 +11528,24 @@ var FocusTrapWrapper = forwardRef9(function FocusTrap2({
|
|
|
11522
11528
|
initialFocus,
|
|
11523
11529
|
...props
|
|
11524
11530
|
}, forwardedRef) {
|
|
11525
|
-
const innerRef =
|
|
11531
|
+
const innerRef = useRef16(null);
|
|
11526
11532
|
useImperativeHandle5(forwardedRef, () => innerRef.current);
|
|
11527
11533
|
useFocusTrap({ container: innerRef, active, initialFocus });
|
|
11528
11534
|
return /* @__PURE__ */ jsx28("div", { ref: innerRef, ...props });
|
|
11529
11535
|
});
|
|
11530
11536
|
|
|
11531
11537
|
// src/hooks/usePresenceRef.ts
|
|
11532
|
-
import { useCallback as
|
|
11538
|
+
import { useCallback as useCallback15, useEffect as useEffect18, useRef as useRef17, useState as useState17 } from "react";
|
|
11533
11539
|
var usePresenceRef = ({
|
|
11534
11540
|
isOpen = true
|
|
11535
11541
|
}) => {
|
|
11536
11542
|
const [isPresent, setIsPresent] = useState17(false);
|
|
11537
|
-
const ref =
|
|
11538
|
-
const refAssignment =
|
|
11543
|
+
const ref = useRef17(null);
|
|
11544
|
+
const refAssignment = useCallback15((node) => {
|
|
11539
11545
|
ref.current = node;
|
|
11540
11546
|
setIsPresent((prev) => prev || !!node);
|
|
11541
11547
|
}, []);
|
|
11542
|
-
|
|
11548
|
+
useEffect18(() => {
|
|
11543
11549
|
if (!isOpen) {
|
|
11544
11550
|
setIsPresent(false);
|
|
11545
11551
|
}
|
|
@@ -11585,7 +11591,7 @@ var Dialog = forwardRef10(function Dialog2({
|
|
|
11585
11591
|
title: `dialog-title-${generatedId}`,
|
|
11586
11592
|
description: `dialog-description-${generatedId}`
|
|
11587
11593
|
}), [generatedId, props.id]);
|
|
11588
|
-
const containerRef =
|
|
11594
|
+
const containerRef = useRef18(null);
|
|
11589
11595
|
const context = useContext10(DialogContext);
|
|
11590
11596
|
const isOpen = isOpenOverwrite ?? context?.isOpen ?? false;
|
|
11591
11597
|
const isModal = isModalOverwrite ?? context?.isModal ?? true;
|
|
@@ -11594,7 +11600,7 @@ var Dialog = forwardRef10(function Dialog2({
|
|
|
11594
11600
|
});
|
|
11595
11601
|
useImperativeHandle6(forwardedRef, () => ref.current, [ref]);
|
|
11596
11602
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
11597
|
-
const onCloseWrapper =
|
|
11603
|
+
const onCloseWrapper = useCallback16(() => {
|
|
11598
11604
|
if (!isModal) return;
|
|
11599
11605
|
onCloseStable();
|
|
11600
11606
|
context?.setIsOpen(false);
|
|
@@ -11793,10 +11799,10 @@ var DiscardChangesDialog = ({
|
|
|
11793
11799
|
};
|
|
11794
11800
|
|
|
11795
11801
|
// src/components/user-interaction/input/Input.tsx
|
|
11796
|
-
import { forwardRef as forwardRef11, useImperativeHandle as useImperativeHandle7, useRef as
|
|
11802
|
+
import { forwardRef as forwardRef11, useImperativeHandle as useImperativeHandle7, useRef as useRef19 } from "react";
|
|
11797
11803
|
|
|
11798
11804
|
// src/hooks/useDelay.ts
|
|
11799
|
-
import { useEffect as
|
|
11805
|
+
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
11800
11806
|
var defaultOptions2 = {
|
|
11801
11807
|
delay: 3e3,
|
|
11802
11808
|
disabled: false
|
|
@@ -11821,12 +11827,12 @@ function useDelay(options) {
|
|
|
11821
11827
|
setTimer(void 0);
|
|
11822
11828
|
}, delay));
|
|
11823
11829
|
};
|
|
11824
|
-
|
|
11830
|
+
useEffect19(() => {
|
|
11825
11831
|
return () => {
|
|
11826
11832
|
clearTimeout(timer);
|
|
11827
11833
|
};
|
|
11828
11834
|
}, [timer]);
|
|
11829
|
-
|
|
11835
|
+
useEffect19(() => {
|
|
11830
11836
|
if (disabled) {
|
|
11831
11837
|
clearTimeout(timer);
|
|
11832
11838
|
setTimer(void 0);
|
|
@@ -11836,9 +11842,9 @@ function useDelay(options) {
|
|
|
11836
11842
|
}
|
|
11837
11843
|
|
|
11838
11844
|
// src/hooks/focus/useFocusManagement.ts
|
|
11839
|
-
import { useCallback as
|
|
11845
|
+
import { useCallback as useCallback17 } from "react";
|
|
11840
11846
|
function useFocusManagement() {
|
|
11841
|
-
const getFocusableElements =
|
|
11847
|
+
const getFocusableElements = useCallback17(() => {
|
|
11842
11848
|
return Array.from(
|
|
11843
11849
|
document.querySelectorAll(
|
|
11844
11850
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -11847,7 +11853,7 @@ function useFocusManagement() {
|
|
|
11847
11853
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
11848
11854
|
);
|
|
11849
11855
|
}, []);
|
|
11850
|
-
const getNextFocusElement =
|
|
11856
|
+
const getNextFocusElement = useCallback17(() => {
|
|
11851
11857
|
const elements = getFocusableElements();
|
|
11852
11858
|
if (elements.length === 0) {
|
|
11853
11859
|
return void 0;
|
|
@@ -11859,11 +11865,11 @@ function useFocusManagement() {
|
|
|
11859
11865
|
}
|
|
11860
11866
|
return nextElement;
|
|
11861
11867
|
}, [getFocusableElements]);
|
|
11862
|
-
const focusNext =
|
|
11868
|
+
const focusNext = useCallback17(() => {
|
|
11863
11869
|
const nextElement = getNextFocusElement();
|
|
11864
11870
|
nextElement?.focus();
|
|
11865
11871
|
}, [getNextFocusElement]);
|
|
11866
|
-
const getPreviousFocusElement =
|
|
11872
|
+
const getPreviousFocusElement = useCallback17(() => {
|
|
11867
11873
|
const elements = getFocusableElements();
|
|
11868
11874
|
if (elements.length === 0) {
|
|
11869
11875
|
return void 0;
|
|
@@ -11879,7 +11885,7 @@ function useFocusManagement() {
|
|
|
11879
11885
|
}
|
|
11880
11886
|
return previousElement;
|
|
11881
11887
|
}, [getFocusableElements]);
|
|
11882
|
-
const focusPrevious =
|
|
11888
|
+
const focusPrevious = useCallback17(() => {
|
|
11883
11889
|
const previousElement = getPreviousFocusElement();
|
|
11884
11890
|
if (previousElement) previousElement.focus();
|
|
11885
11891
|
}, [getPreviousFocusElement]);
|
|
@@ -11924,7 +11930,7 @@ var Input = forwardRef11(function Input2({
|
|
|
11924
11930
|
restartTimer,
|
|
11925
11931
|
clearTimer
|
|
11926
11932
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
11927
|
-
const innerRef =
|
|
11933
|
+
const innerRef = useRef19(null);
|
|
11928
11934
|
useImperativeHandle7(forwardedRef, () => innerRef.current);
|
|
11929
11935
|
const { focusNext } = useFocusManagement();
|
|
11930
11936
|
return /* @__PURE__ */ jsx33(
|
|
@@ -11992,7 +11998,7 @@ import {
|
|
|
11992
11998
|
} from "react";
|
|
11993
11999
|
|
|
11994
12000
|
// src/components/user-interaction/select/SelectContext.tsx
|
|
11995
|
-
import { createContext as createContext10, useCallback as
|
|
12001
|
+
import { createContext as createContext10, useCallback as useCallback18, useContext as useContext11, useEffect as useEffect20, useId as useId9, useMemo as useMemo15, useRef as useRef20, useState as useState19 } from "react";
|
|
11996
12002
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
11997
12003
|
var defaultToggleOpenOptions = {
|
|
11998
12004
|
highlightStartPositionBehavior: "first"
|
|
@@ -12033,7 +12039,7 @@ var PrimitveSelectRoot = ({
|
|
|
12033
12039
|
onValueChange: onValuesChange,
|
|
12034
12040
|
defaultValue: initialValues ?? []
|
|
12035
12041
|
});
|
|
12036
|
-
const triggerRef =
|
|
12042
|
+
const triggerRef = useRef20(null);
|
|
12037
12043
|
const generatedId = useId9();
|
|
12038
12044
|
const [ids, setIds] = useState19({
|
|
12039
12045
|
trigger: id ?? (isMultiSelect ? "multi-select-" + generatedId : "select-" + generatedId),
|
|
@@ -12064,7 +12070,7 @@ var PrimitveSelectRoot = ({
|
|
|
12064
12070
|
isMultiSelect,
|
|
12065
12071
|
iconAppearance
|
|
12066
12072
|
};
|
|
12067
|
-
const registerItem =
|
|
12073
|
+
const registerItem = useCallback18((item) => {
|
|
12068
12074
|
setInternalState((prev) => {
|
|
12069
12075
|
const updatedOptions = [...prev.options, item];
|
|
12070
12076
|
updatedOptions.sort((a, b) => {
|
|
@@ -12079,7 +12085,7 @@ var PrimitveSelectRoot = ({
|
|
|
12079
12085
|
};
|
|
12080
12086
|
});
|
|
12081
12087
|
}, []);
|
|
12082
|
-
const unregisterItem =
|
|
12088
|
+
const unregisterItem = useCallback18((value2) => {
|
|
12083
12089
|
setInternalState((prev) => {
|
|
12084
12090
|
const updatedOptions = prev.options.filter((i) => i.value !== value2);
|
|
12085
12091
|
return {
|
|
@@ -12128,10 +12134,10 @@ var PrimitveSelectRoot = ({
|
|
|
12128
12134
|
highlightedValue: value2
|
|
12129
12135
|
}));
|
|
12130
12136
|
};
|
|
12131
|
-
const registerTrigger =
|
|
12137
|
+
const registerTrigger = useCallback18((ref) => {
|
|
12132
12138
|
triggerRef.current = ref.current;
|
|
12133
12139
|
}, []);
|
|
12134
|
-
const unregisterTrigger =
|
|
12140
|
+
const unregisterTrigger = useCallback18(() => {
|
|
12135
12141
|
triggerRef.current = null;
|
|
12136
12142
|
}, []);
|
|
12137
12143
|
const toggleOpen = (isOpen, toggleOpenOptions) => {
|
|
@@ -12181,7 +12187,7 @@ var PrimitveSelectRoot = ({
|
|
|
12181
12187
|
highlightedValue
|
|
12182
12188
|
}));
|
|
12183
12189
|
};
|
|
12184
|
-
|
|
12190
|
+
useEffect20(() => {
|
|
12185
12191
|
if (!internalState.highlightedValue) return;
|
|
12186
12192
|
const highlighted = internalState.options.find((value2) => value2.value === internalState.highlightedValue);
|
|
12187
12193
|
if (highlighted) {
|
|
@@ -12245,17 +12251,17 @@ var MultiSelectRoot = ({ value, onValueChange, initialValue, onEditComplete, ...
|
|
|
12245
12251
|
};
|
|
12246
12252
|
|
|
12247
12253
|
// src/components/user-interaction/select/SelectComponents.tsx
|
|
12248
|
-
import { forwardRef as forwardRef13, useEffect as
|
|
12254
|
+
import { forwardRef as forwardRef13, useEffect as useEffect22, useImperativeHandle as useImperativeHandle9, useRef as useRef21 } from "react";
|
|
12249
12255
|
import clsx10 from "clsx";
|
|
12250
12256
|
import { CheckIcon } from "lucide-react";
|
|
12251
12257
|
|
|
12252
12258
|
// src/components/layout/popup/PopUp.tsx
|
|
12253
|
-
import { forwardRef as forwardRef12, useCallback as
|
|
12259
|
+
import { forwardRef as forwardRef12, useCallback as useCallback19, useContext as useContext13, useImperativeHandle as useImperativeHandle8, useMemo as useMemo16 } from "react";
|
|
12254
12260
|
|
|
12255
12261
|
// src/hooks/useOutsideClick.ts
|
|
12256
|
-
import { useEffect as
|
|
12262
|
+
import { useEffect as useEffect21 } from "react";
|
|
12257
12263
|
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12258
|
-
|
|
12264
|
+
useEffect21(() => {
|
|
12259
12265
|
if (!active) return;
|
|
12260
12266
|
const listener = (event) => {
|
|
12261
12267
|
if (event.target === null) return;
|
|
@@ -12308,13 +12314,13 @@ var PopUp = forwardRef12(function PopUp2({
|
|
|
12308
12314
|
useImperativeHandle8(forwardRef23, () => ref.current, [ref]);
|
|
12309
12315
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12310
12316
|
const onOutsideClickStable = useEventCallbackStabilizer(onOutsideClick);
|
|
12311
|
-
const onCloseWrapper =
|
|
12317
|
+
const onCloseWrapper = useCallback19(() => {
|
|
12312
12318
|
onCloseStable();
|
|
12313
12319
|
context?.setIsOpen(false);
|
|
12314
12320
|
}, [onCloseStable, context]);
|
|
12315
12321
|
const { zIndex, isInFront } = useOverlayRegistry({ isActive: isOpen, tags: useMemo16(() => ["popup"], []) });
|
|
12316
12322
|
useOutsideClick({
|
|
12317
|
-
onOutsideClick:
|
|
12323
|
+
onOutsideClick: useCallback19((event) => {
|
|
12318
12324
|
event.preventDefault();
|
|
12319
12325
|
onCloseWrapper();
|
|
12320
12326
|
onOutsideClickStable(event);
|
|
@@ -12356,10 +12362,10 @@ var SelectOption = forwardRef13(
|
|
|
12356
12362
|
function SelectOption2({ children, value, disabled = false, iconAppearance, className, ...restProps }, ref) {
|
|
12357
12363
|
const { state, config, item, trigger } = useSelectContext();
|
|
12358
12364
|
const { register, unregister, toggleSelection, highlightItem } = item;
|
|
12359
|
-
const itemRef =
|
|
12365
|
+
const itemRef = useRef21(null);
|
|
12360
12366
|
iconAppearance ??= config.iconAppearance;
|
|
12361
12367
|
const label = children ?? value;
|
|
12362
|
-
|
|
12368
|
+
useEffect22(() => {
|
|
12363
12369
|
register({
|
|
12364
12370
|
value,
|
|
12365
12371
|
label,
|
|
@@ -12439,7 +12445,7 @@ var SelectButton = forwardRef13(function SelectButton2({
|
|
|
12439
12445
|
const translation = useHightideTranslation();
|
|
12440
12446
|
const { state, trigger, setIds, ids } = useSelectContext();
|
|
12441
12447
|
const { register, unregister, toggleOpen } = trigger;
|
|
12442
|
-
|
|
12448
|
+
useEffect22(() => {
|
|
12443
12449
|
if (id) {
|
|
12444
12450
|
setIds((prev) => ({
|
|
12445
12451
|
...prev,
|
|
@@ -12447,9 +12453,9 @@ var SelectButton = forwardRef13(function SelectButton2({
|
|
|
12447
12453
|
}));
|
|
12448
12454
|
}
|
|
12449
12455
|
}, [id, setIds]);
|
|
12450
|
-
const innerRef =
|
|
12456
|
+
const innerRef = useRef21(null);
|
|
12451
12457
|
useImperativeHandle9(ref, () => innerRef.current);
|
|
12452
|
-
|
|
12458
|
+
useEffect22(() => {
|
|
12453
12459
|
register(innerRef);
|
|
12454
12460
|
return () => unregister();
|
|
12455
12461
|
}, [register, unregister]);
|
|
@@ -12507,10 +12513,10 @@ var SelectContent = forwardRef13(function SelectContent2({
|
|
|
12507
12513
|
options,
|
|
12508
12514
|
...props
|
|
12509
12515
|
}, ref) {
|
|
12510
|
-
const innerRef =
|
|
12516
|
+
const innerRef = useRef21(null);
|
|
12511
12517
|
useImperativeHandle9(ref, () => innerRef.current);
|
|
12512
12518
|
const { trigger, state, config, item, ids, setIds } = useSelectContext();
|
|
12513
|
-
|
|
12519
|
+
useEffect22(() => {
|
|
12514
12520
|
if (id) {
|
|
12515
12521
|
setIds((prev) => ({
|
|
12516
12522
|
...prev,
|
|
@@ -12655,7 +12661,7 @@ import { MonitorCog, MoonIcon, SunIcon } from "lucide-react";
|
|
|
12655
12661
|
import clsx12 from "clsx";
|
|
12656
12662
|
|
|
12657
12663
|
// src/global-contexts/ThemeContext.tsx
|
|
12658
|
-
import { createContext as createContext12, useCallback as
|
|
12664
|
+
import { createContext as createContext12, useCallback as useCallback20, useContext as useContext14, useEffect as useEffect23, useMemo as useMemo17, useState as useState20 } from "react";
|
|
12659
12665
|
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
12660
12666
|
var themes = ["light", "dark", "system"];
|
|
12661
12667
|
var ThemeUtil = {
|
|
@@ -12682,7 +12688,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
12682
12688
|
}
|
|
12683
12689
|
return initialTheme ?? config.theme.initialTheme;
|
|
12684
12690
|
}, [config.theme.initialTheme, initialTheme, storedTheme, theme, themePreference]);
|
|
12685
|
-
|
|
12691
|
+
useEffect23(() => {
|
|
12686
12692
|
if (!theme) return;
|
|
12687
12693
|
if (theme === "system") {
|
|
12688
12694
|
deleteStoredTheme();
|
|
@@ -12690,18 +12696,18 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
12690
12696
|
setStoredTheme(theme);
|
|
12691
12697
|
}
|
|
12692
12698
|
}, [theme, deleteStoredTheme, setStoredTheme]);
|
|
12693
|
-
|
|
12699
|
+
useEffect23(() => {
|
|
12694
12700
|
document.documentElement.setAttribute("data-theme", resolvedTheme);
|
|
12695
12701
|
}, [resolvedTheme]);
|
|
12696
|
-
const getPreference =
|
|
12702
|
+
const getPreference = useCallback20(() => {
|
|
12697
12703
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
12698
12704
|
const prefersLight = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
12699
12705
|
setThemePreference(prefersDark ? "dark" : prefersLight ? "light" : "system");
|
|
12700
12706
|
}, []);
|
|
12701
|
-
|
|
12707
|
+
useEffect23(() => {
|
|
12702
12708
|
getPreference();
|
|
12703
12709
|
}, [getPreference]);
|
|
12704
|
-
|
|
12710
|
+
useEffect23(() => {
|
|
12705
12711
|
const darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
12706
12712
|
const lightQuery = window.matchMedia("(prefers-color-scheme: light)");
|
|
12707
12713
|
const noPrefQuery = window.matchMedia("(prefers-color-scheme: no-preference)");
|
|
@@ -12804,7 +12810,7 @@ var ThemeDialog = ({
|
|
|
12804
12810
|
import { forwardRef as forwardRef16 } from "react";
|
|
12805
12811
|
|
|
12806
12812
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
12807
|
-
import { forwardRef as forwardRef15, useId as useId10, useImperativeHandle as useImperativeHandle10, useMemo as useMemo18, useRef as
|
|
12813
|
+
import { forwardRef as forwardRef15, useId as useId10, useImperativeHandle as useImperativeHandle10, useMemo as useMemo18, useRef as useRef22 } from "react";
|
|
12808
12814
|
|
|
12809
12815
|
// src/components/layout/drawer/DrawerContext.tsx
|
|
12810
12816
|
import { createContext as createContext13, useContext as useContext15 } from "react";
|
|
@@ -12834,7 +12840,7 @@ var DrawerContent = forwardRef15(function DrawerContent2({
|
|
|
12834
12840
|
background: `dialog-background-${generatedId}`,
|
|
12835
12841
|
content: props.id ?? `dialog-content-${generatedId}`
|
|
12836
12842
|
}), [generatedId, props.id]);
|
|
12837
|
-
const ref =
|
|
12843
|
+
const ref = useRef22(null);
|
|
12838
12844
|
useImperativeHandle10(forwardedRef, () => ref.current, [ref]);
|
|
12839
12845
|
const { isVisible, transitionState } = useTransitionState({ isOpen, ref });
|
|
12840
12846
|
useFocusTrap({
|
|
@@ -13082,8 +13088,8 @@ var BreadCrumbs = ({ crumbs }) => {
|
|
|
13082
13088
|
// src/components/layout/navigation/Navigation.tsx
|
|
13083
13089
|
var import_link2 = __toESM(require_link2());
|
|
13084
13090
|
import { Menu as MenuIcon, XIcon } from "lucide-react";
|
|
13085
|
-
import { useEffect as
|
|
13086
|
-
import { useCallback as
|
|
13091
|
+
import { useEffect as useEffect24 } from "react";
|
|
13092
|
+
import { useCallback as useCallback21, useId as useId11, useRef as useRef23, useState as useState22 } from "react";
|
|
13087
13093
|
import clsx17 from "clsx";
|
|
13088
13094
|
import { Fragment as Fragment5, jsx as jsx51, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
13089
13095
|
function isSubItem(item) {
|
|
@@ -13096,8 +13102,8 @@ var NavigationItemWithSubItem = ({
|
|
|
13096
13102
|
...options
|
|
13097
13103
|
}) => {
|
|
13098
13104
|
const [isOpen, setOpen] = useState22(false);
|
|
13099
|
-
const containerRef =
|
|
13100
|
-
const triggerRef =
|
|
13105
|
+
const containerRef = useRef23(null);
|
|
13106
|
+
const triggerRef = useRef23(null);
|
|
13101
13107
|
const id = useId11();
|
|
13102
13108
|
const style = useAnchoredPosition({
|
|
13103
13109
|
active: isOpen,
|
|
@@ -13106,7 +13112,7 @@ var NavigationItemWithSubItem = ({
|
|
|
13106
13112
|
horizontalAlignment,
|
|
13107
13113
|
...options
|
|
13108
13114
|
});
|
|
13109
|
-
const onBlur =
|
|
13115
|
+
const onBlur = useCallback21((event) => {
|
|
13110
13116
|
const nextFocus = event.relatedTarget;
|
|
13111
13117
|
if (!containerRef.current?.contains(nextFocus) && !triggerRef.current?.contains(nextFocus)) {
|
|
13112
13118
|
setOpen(false);
|
|
@@ -13174,8 +13180,8 @@ var Navigation = ({ ...props }) => {
|
|
|
13174
13180
|
const translation = useHightideTranslation();
|
|
13175
13181
|
const [isMobileOpen, setIsMobileOpen] = useState22(false);
|
|
13176
13182
|
const id = useId11();
|
|
13177
|
-
const menuRef =
|
|
13178
|
-
|
|
13183
|
+
const menuRef = useRef23(null);
|
|
13184
|
+
useEffect24(() => {
|
|
13179
13185
|
menuRef.current?.focus();
|
|
13180
13186
|
}, [isMobileOpen]);
|
|
13181
13187
|
const { zIndex } = useOverlayRegistry({ isActive: isMobileOpen });
|
|
@@ -13243,7 +13249,7 @@ var Navigation = ({ ...props }) => {
|
|
|
13243
13249
|
// src/components/layout/navigation/Pagination.tsx
|
|
13244
13250
|
import { ChevronFirst, ChevronLast, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
13245
13251
|
import clsx18 from "clsx";
|
|
13246
|
-
import { useEffect as
|
|
13252
|
+
import { useEffect as useEffect25, useState as useState23 } from "react";
|
|
13247
13253
|
import { jsx as jsx52, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
13248
13254
|
var Pagination = ({
|
|
13249
13255
|
pageIndex,
|
|
@@ -13256,7 +13262,7 @@ var Pagination = ({
|
|
|
13256
13262
|
const noPages = pageCount === 0;
|
|
13257
13263
|
const onFirstPage = pageIndex === 0 && !noPages;
|
|
13258
13264
|
const onLastPage = pageIndex === pageCount - 1;
|
|
13259
|
-
|
|
13265
|
+
useEffect25(() => {
|
|
13260
13266
|
if (noPages) {
|
|
13261
13267
|
setValue("0");
|
|
13262
13268
|
} else {
|
|
@@ -13450,12 +13456,12 @@ var StepperBar = ({
|
|
|
13450
13456
|
};
|
|
13451
13457
|
|
|
13452
13458
|
// src/components/layout/popup/PopUpOpener.tsx
|
|
13453
|
-
import { useEffect as
|
|
13459
|
+
import { useEffect as useEffect26, useMemo as useMemo19, useRef as useRef24 } from "react";
|
|
13454
13460
|
function PopUpOpener({ children }) {
|
|
13455
13461
|
const context = usePopUpContext();
|
|
13456
13462
|
const { setTriggerRef } = context;
|
|
13457
|
-
const ref =
|
|
13458
|
-
|
|
13463
|
+
const ref = useRef24(null);
|
|
13464
|
+
useEffect26(() => {
|
|
13459
13465
|
setTriggerRef(ref);
|
|
13460
13466
|
return () => {
|
|
13461
13467
|
setTriggerRef(null);
|
|
@@ -13686,7 +13692,7 @@ var FillerCell = ({ ...props }) => {
|
|
|
13686
13692
|
};
|
|
13687
13693
|
|
|
13688
13694
|
// src/components/layout/table/TableProvider.tsx
|
|
13689
|
-
import { useCallback as
|
|
13695
|
+
import { useCallback as useCallback22, useEffect as useEffect27, useLayoutEffect as useLayoutEffect6, useMemo as useMemo21, useRef as useRef25, useState as useState25 } from "react";
|
|
13690
13696
|
|
|
13691
13697
|
// src/components/layout/table/TableContext.tsx
|
|
13692
13698
|
import { createContext as createContext14, useContext as useContext16 } from "react";
|
|
@@ -14086,7 +14092,7 @@ var TableProvider = ({
|
|
|
14086
14092
|
const onRowClickStable = useEventCallbackStabilizer(onRowClick);
|
|
14087
14093
|
const onFillerRowClickStable = useEventCallbackStabilizer(onFillerRowClick);
|
|
14088
14094
|
const [registeredColumns, setRegisteredColumns] = useState25([]);
|
|
14089
|
-
const containerRef =
|
|
14095
|
+
const containerRef = useRef25(null);
|
|
14090
14096
|
const [, setTableState] = useState25({
|
|
14091
14097
|
columnSizing: {},
|
|
14092
14098
|
columnOrder: [],
|
|
@@ -14117,11 +14123,11 @@ var TableProvider = ({
|
|
|
14117
14123
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
14118
14124
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
14119
14125
|
}, [containerRef]);
|
|
14120
|
-
useWindowResizeObserver(
|
|
14126
|
+
useWindowResizeObserver(useCallback22(() => {
|
|
14121
14127
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
14122
14128
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
14123
14129
|
}, [containerRef]));
|
|
14124
|
-
const registerColumn =
|
|
14130
|
+
const registerColumn = useCallback22((column) => {
|
|
14125
14131
|
setRegisteredColumns((prev) => {
|
|
14126
14132
|
return [...prev, column];
|
|
14127
14133
|
});
|
|
@@ -14148,7 +14154,7 @@ var TableProvider = ({
|
|
|
14148
14154
|
defaultColumn: {
|
|
14149
14155
|
minSize: 60,
|
|
14150
14156
|
maxSize: 800,
|
|
14151
|
-
cell:
|
|
14157
|
+
cell: useCallback22(({ cell }) => {
|
|
14152
14158
|
return /* @__PURE__ */ jsx57(TableCell, { children: String(cell.getValue()) });
|
|
14153
14159
|
}, []),
|
|
14154
14160
|
enableResizing: true,
|
|
@@ -14189,7 +14195,7 @@ var TableProvider = ({
|
|
|
14189
14195
|
});
|
|
14190
14196
|
const pagination = table.getState().pagination;
|
|
14191
14197
|
const pageCount = table.getPageCount();
|
|
14192
|
-
|
|
14198
|
+
useEffect27(() => {
|
|
14193
14199
|
if (pageCount === -1) {
|
|
14194
14200
|
return;
|
|
14195
14201
|
}
|
|
@@ -14197,13 +14203,13 @@ var TableProvider = ({
|
|
|
14197
14203
|
table.setPageIndex(pageCount - 1);
|
|
14198
14204
|
}
|
|
14199
14205
|
}, [table, pagination.pageIndex, pageCount]);
|
|
14200
|
-
|
|
14206
|
+
useEffect27(() => {
|
|
14201
14207
|
table.setColumnOrder((prev) => [...prev]);
|
|
14202
14208
|
}, [table, columns]);
|
|
14203
14209
|
const columnVisibility = table.getState().columnVisibility;
|
|
14204
14210
|
const columnOrder = table.getState().columnOrder;
|
|
14205
14211
|
const columnPinning = table.getState().columnPinning;
|
|
14206
|
-
|
|
14212
|
+
useEffect27(() => {
|
|
14207
14213
|
table.setColumnSizing((prev) => ({ ...prev }));
|
|
14208
14214
|
}, [table, targetWidth, columnVisibility, columnOrder, columnPinning]);
|
|
14209
14215
|
const tableColumnDefinitionContextValue = useMemo21(() => ({
|
|
@@ -14321,7 +14327,7 @@ var TableBody = React5.memo(function TableBodyVisual() {
|
|
|
14321
14327
|
|
|
14322
14328
|
// src/components/layout/table/TableHeader.tsx
|
|
14323
14329
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
14324
|
-
import
|
|
14330
|
+
import clsx25 from "clsx";
|
|
14325
14331
|
|
|
14326
14332
|
// src/components/layout/table/TableSortButton.tsx
|
|
14327
14333
|
import { ChevronDown as ChevronDown3, ChevronsUpDown, ChevronUp as ChevronUp2 } from "lucide-react";
|
|
@@ -14374,188 +14380,15 @@ var TableSortButton = ({
|
|
|
14374
14380
|
|
|
14375
14381
|
// src/components/layout/table/TableFilterButton.tsx
|
|
14376
14382
|
import { FilterIcon } from "lucide-react";
|
|
14377
|
-
import { useEffect as
|
|
14383
|
+
import { useEffect as useEffect32, useId as useId15, useMemo as useMemo26, useRef as useRef30, useState as useState30 } from "react";
|
|
14378
14384
|
|
|
14379
14385
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
14380
|
-
import { forwardRef as forwardRef17, useCallback as
|
|
14386
|
+
import { forwardRef as forwardRef17, useCallback as useCallback25, useEffect as useEffect31, useId as useId13, useImperativeHandle as useImperativeHandle11, useMemo as useMemo24, useRef as useRef29, useState as useState28 } from "react";
|
|
14381
14387
|
import { CalendarIcon } from "lucide-react";
|
|
14382
|
-
import clsx25 from "clsx";
|
|
14383
|
-
|
|
14384
|
-
// src/utils/date.ts
|
|
14385
|
-
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14386
|
-
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14387
|
-
var formatDate = (date) => {
|
|
14388
|
-
const year = date.getFullYear().toString().padStart(4, "0");
|
|
14389
|
-
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
14390
|
-
const day = date.getDate().toString().padStart(2, "0");
|
|
14391
|
-
return `${year}-${month}-${day}`;
|
|
14392
|
-
};
|
|
14393
|
-
var formatDateTime = (date) => {
|
|
14394
|
-
const dateString = formatDate(date);
|
|
14395
|
-
const hours = date.getHours().toString().padStart(2, "0");
|
|
14396
|
-
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
14397
|
-
return `${dateString}T${hours}:${minutes}`;
|
|
14398
|
-
};
|
|
14399
|
-
var changeDuration = (date, duration, isAdding) => {
|
|
14400
|
-
const {
|
|
14401
|
-
years = 0,
|
|
14402
|
-
months = 0,
|
|
14403
|
-
days = 0,
|
|
14404
|
-
hours = 0,
|
|
14405
|
-
minutes = 0,
|
|
14406
|
-
seconds = 0,
|
|
14407
|
-
milliseconds = 0
|
|
14408
|
-
} = duration;
|
|
14409
|
-
if (years < 0) {
|
|
14410
|
-
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14411
|
-
return new Date(date);
|
|
14412
|
-
}
|
|
14413
|
-
if (months < 0 || months > 11) {
|
|
14414
|
-
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14415
|
-
return new Date(date);
|
|
14416
|
-
}
|
|
14417
|
-
if (days < 0) {
|
|
14418
|
-
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14419
|
-
return new Date(date);
|
|
14420
|
-
}
|
|
14421
|
-
if (hours < 0 || hours > 23) {
|
|
14422
|
-
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14423
|
-
return new Date(date);
|
|
14424
|
-
}
|
|
14425
|
-
if (minutes < 0 || minutes > 59) {
|
|
14426
|
-
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14427
|
-
return new Date(date);
|
|
14428
|
-
}
|
|
14429
|
-
if (seconds < 0 || seconds > 59) {
|
|
14430
|
-
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14431
|
-
return new Date(date);
|
|
14432
|
-
}
|
|
14433
|
-
if (milliseconds < 0) {
|
|
14434
|
-
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14435
|
-
return new Date(date);
|
|
14436
|
-
}
|
|
14437
|
-
const multiplier = isAdding ? 1 : -1;
|
|
14438
|
-
const newDate = new Date(date);
|
|
14439
|
-
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14440
|
-
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14441
|
-
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14442
|
-
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14443
|
-
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14444
|
-
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14445
|
-
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14446
|
-
return newDate;
|
|
14447
|
-
};
|
|
14448
|
-
var addDuration = (date, duration) => {
|
|
14449
|
-
return changeDuration(date, duration, true);
|
|
14450
|
-
};
|
|
14451
|
-
var subtractDuration = (date, duration) => {
|
|
14452
|
-
return changeDuration(date, duration, false);
|
|
14453
|
-
};
|
|
14454
|
-
var getBetweenDuration = (startDate, endDate) => {
|
|
14455
|
-
const durationInMilliseconds = endDate.getTime() - startDate.getTime();
|
|
14456
|
-
const millisecondsInSecond = 1e3;
|
|
14457
|
-
const millisecondsInMinute = 60 * millisecondsInSecond;
|
|
14458
|
-
const millisecondsInHour = 60 * millisecondsInMinute;
|
|
14459
|
-
const millisecondsInDay = 24 * millisecondsInHour;
|
|
14460
|
-
const millisecondsInMonth = 30 * millisecondsInDay;
|
|
14461
|
-
const years = Math.floor(durationInMilliseconds / (365.25 * millisecondsInDay));
|
|
14462
|
-
const months = Math.floor(durationInMilliseconds / millisecondsInMonth);
|
|
14463
|
-
const days = Math.floor(durationInMilliseconds / millisecondsInDay);
|
|
14464
|
-
const hours = Math.floor(durationInMilliseconds % millisecondsInDay / millisecondsInHour);
|
|
14465
|
-
const seconds = Math.floor(durationInMilliseconds % millisecondsInHour / millisecondsInSecond);
|
|
14466
|
-
const milliseconds = durationInMilliseconds % millisecondsInSecond;
|
|
14467
|
-
return {
|
|
14468
|
-
years,
|
|
14469
|
-
months,
|
|
14470
|
-
days,
|
|
14471
|
-
hours,
|
|
14472
|
-
seconds,
|
|
14473
|
-
milliseconds
|
|
14474
|
-
};
|
|
14475
|
-
};
|
|
14476
|
-
var isInTimeSpan = (value, startDate, endDate) => {
|
|
14477
|
-
if (startDate && endDate) {
|
|
14478
|
-
console.assert(startDate <= endDate);
|
|
14479
|
-
return startDate <= value && value <= endDate;
|
|
14480
|
-
} else if (startDate) {
|
|
14481
|
-
return startDate <= value;
|
|
14482
|
-
} else if (endDate) {
|
|
14483
|
-
return endDate >= value;
|
|
14484
|
-
} else {
|
|
14485
|
-
return true;
|
|
14486
|
-
}
|
|
14487
|
-
};
|
|
14488
|
-
var equalDate = (date1, date2) => {
|
|
14489
|
-
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14490
|
-
};
|
|
14491
|
-
var getWeeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14492
|
-
const month = date.getMonth();
|
|
14493
|
-
const year = date.getFullYear();
|
|
14494
|
-
const dayList = [];
|
|
14495
|
-
let currentDate = new Date(year, month, 1);
|
|
14496
|
-
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14497
|
-
while (currentDate.getDay() !== weekStartIndex) {
|
|
14498
|
-
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14499
|
-
}
|
|
14500
|
-
while (dayList.length < 7 * weeks) {
|
|
14501
|
-
const date2 = new Date(currentDate);
|
|
14502
|
-
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14503
|
-
dayList.push(date2);
|
|
14504
|
-
currentDate = addDuration(currentDate, { days: 1 });
|
|
14505
|
-
}
|
|
14506
|
-
return equalSizeGroups(dayList, 7);
|
|
14507
|
-
};
|
|
14508
|
-
var formatGerman = (date, showTime) => {
|
|
14509
|
-
const d = new Intl.DateTimeFormat("de-DE", {
|
|
14510
|
-
day: "2-digit",
|
|
14511
|
-
month: "2-digit",
|
|
14512
|
-
year: "numeric"
|
|
14513
|
-
}).format(date);
|
|
14514
|
-
if (!showTime) return d;
|
|
14515
|
-
const t = new Intl.DateTimeFormat("de-DE", {
|
|
14516
|
-
hour: "2-digit",
|
|
14517
|
-
minute: "2-digit"
|
|
14518
|
-
}).format(date);
|
|
14519
|
-
return `${d} um ${t} Uhr`;
|
|
14520
|
-
};
|
|
14521
|
-
var formatAbsolute = (date, locale, showTime) => {
|
|
14522
|
-
if (locale === "de-DE") {
|
|
14523
|
-
return formatGerman(date, showTime);
|
|
14524
|
-
}
|
|
14525
|
-
const options = {
|
|
14526
|
-
year: "numeric",
|
|
14527
|
-
month: "numeric",
|
|
14528
|
-
day: "numeric"
|
|
14529
|
-
};
|
|
14530
|
-
if (showTime) {
|
|
14531
|
-
options.hour = "numeric";
|
|
14532
|
-
options.minute = "numeric";
|
|
14533
|
-
}
|
|
14534
|
-
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14535
|
-
};
|
|
14536
|
-
var formatRelative = (date, locale, showTime) => {
|
|
14537
|
-
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14538
|
-
const now = /* @__PURE__ */ new Date();
|
|
14539
|
-
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14540
|
-
if (Math.abs(diffInSeconds) < 60) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14541
|
-
if (Math.abs(diffInSeconds) < 3600) return rtf.format(Math.round(diffInSeconds / 60), "minute");
|
|
14542
|
-
if (Math.abs(diffInSeconds) < 86400) return rtf.format(Math.round(diffInSeconds / 3600), "hour");
|
|
14543
|
-
if (Math.abs(diffInSeconds) < 604800) return rtf.format(Math.round(diffInSeconds / 86400), "day");
|
|
14544
|
-
return formatAbsolute(date, locale, showTime);
|
|
14545
|
-
};
|
|
14546
|
-
var DateUtils = {
|
|
14547
|
-
monthsList,
|
|
14548
|
-
weekDayList,
|
|
14549
|
-
equalDate,
|
|
14550
|
-
formatAbsolute,
|
|
14551
|
-
formatRelative
|
|
14552
|
-
};
|
|
14553
|
-
|
|
14554
|
-
// src/components/user-interaction/date/DateTimePicker.tsx
|
|
14555
14388
|
import clsx24 from "clsx";
|
|
14556
14389
|
|
|
14557
14390
|
// src/components/user-interaction/date/TimePicker.tsx
|
|
14558
|
-
import { useEffect as
|
|
14391
|
+
import { useEffect as useEffect28, useRef as useRef26 } from "react";
|
|
14559
14392
|
import { jsx as jsx60, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
14560
14393
|
var TimePicker = ({
|
|
14561
14394
|
value: controlledValue,
|
|
@@ -14571,8 +14404,8 @@ var TimePicker = ({
|
|
|
14571
14404
|
onValueChange,
|
|
14572
14405
|
defaultValue: initialValue
|
|
14573
14406
|
});
|
|
14574
|
-
const minuteRef =
|
|
14575
|
-
const hourRef =
|
|
14407
|
+
const minuteRef = useRef26(null);
|
|
14408
|
+
const hourRef = useRef26(null);
|
|
14576
14409
|
const isPM = value.getHours() > 11;
|
|
14577
14410
|
const hours = is24HourFormat ? range(24) : range(12);
|
|
14578
14411
|
let minutes = range(60);
|
|
@@ -14592,13 +14425,13 @@ var TimePicker = ({
|
|
|
14592
14425
|
}
|
|
14593
14426
|
const closestMinute = closestMatch(minutes, (item1, item2) => Math.abs(item1 - value.getMinutes()) < Math.abs(item2 - value.getMinutes()));
|
|
14594
14427
|
const hour = value.getHours();
|
|
14595
|
-
|
|
14428
|
+
useEffect28(() => {
|
|
14596
14429
|
minuteRef.current?.scrollIntoView({
|
|
14597
14430
|
behavior: "smooth",
|
|
14598
14431
|
block: "nearest"
|
|
14599
14432
|
});
|
|
14600
14433
|
}, [closestMinute]);
|
|
14601
|
-
|
|
14434
|
+
useEffect28(() => {
|
|
14602
14435
|
hourRef.current?.scrollIntoView({
|
|
14603
14436
|
behavior: "smooth",
|
|
14604
14437
|
block: "nearest"
|
|
@@ -14669,10 +14502,177 @@ var TimePicker = ({
|
|
|
14669
14502
|
// src/components/user-interaction/date/DatePicker.tsx
|
|
14670
14503
|
import { useState as useState27 } from "react";
|
|
14671
14504
|
import { ArrowDown, ArrowUp, Calendar, ChevronDown as ChevronDown4 } from "lucide-react";
|
|
14505
|
+
|
|
14506
|
+
// src/utils/date.ts
|
|
14507
|
+
var timesInSeconds = {
|
|
14508
|
+
second: 1,
|
|
14509
|
+
minute: 60,
|
|
14510
|
+
hour: 3600,
|
|
14511
|
+
day: 86400,
|
|
14512
|
+
week: 604800,
|
|
14513
|
+
monthImprecise: 2629800,
|
|
14514
|
+
// 30.4375 days
|
|
14515
|
+
yearImprecise: 31557600
|
|
14516
|
+
// 365.25 days
|
|
14517
|
+
};
|
|
14518
|
+
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14519
|
+
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14520
|
+
var changeDuration = (date, duration, isAdding) => {
|
|
14521
|
+
const {
|
|
14522
|
+
years = 0,
|
|
14523
|
+
months = 0,
|
|
14524
|
+
days = 0,
|
|
14525
|
+
hours = 0,
|
|
14526
|
+
minutes = 0,
|
|
14527
|
+
seconds = 0,
|
|
14528
|
+
milliseconds = 0
|
|
14529
|
+
} = duration;
|
|
14530
|
+
if (years < 0) {
|
|
14531
|
+
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14532
|
+
return new Date(date);
|
|
14533
|
+
}
|
|
14534
|
+
if (months < 0 || months > 11) {
|
|
14535
|
+
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14536
|
+
return new Date(date);
|
|
14537
|
+
}
|
|
14538
|
+
if (days < 0) {
|
|
14539
|
+
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14540
|
+
return new Date(date);
|
|
14541
|
+
}
|
|
14542
|
+
if (hours < 0 || hours > 23) {
|
|
14543
|
+
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14544
|
+
return new Date(date);
|
|
14545
|
+
}
|
|
14546
|
+
if (minutes < 0 || minutes > 59) {
|
|
14547
|
+
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14548
|
+
return new Date(date);
|
|
14549
|
+
}
|
|
14550
|
+
if (seconds < 0 || seconds > 59) {
|
|
14551
|
+
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14552
|
+
return new Date(date);
|
|
14553
|
+
}
|
|
14554
|
+
if (milliseconds < 0) {
|
|
14555
|
+
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14556
|
+
return new Date(date);
|
|
14557
|
+
}
|
|
14558
|
+
const multiplier = isAdding ? 1 : -1;
|
|
14559
|
+
const newDate = new Date(date);
|
|
14560
|
+
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14561
|
+
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14562
|
+
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14563
|
+
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14564
|
+
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14565
|
+
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14566
|
+
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14567
|
+
return newDate;
|
|
14568
|
+
};
|
|
14569
|
+
var addDuration = (date, duration) => {
|
|
14570
|
+
return changeDuration(date, duration, true);
|
|
14571
|
+
};
|
|
14572
|
+
var subtractDuration = (date, duration) => {
|
|
14573
|
+
return changeDuration(date, duration, false);
|
|
14574
|
+
};
|
|
14575
|
+
var between = (value, startDate, endDate) => {
|
|
14576
|
+
if (startDate && endDate) {
|
|
14577
|
+
console.assert(startDate <= endDate);
|
|
14578
|
+
return startDate <= value && value <= endDate;
|
|
14579
|
+
} else if (startDate) {
|
|
14580
|
+
return startDate <= value;
|
|
14581
|
+
} else if (endDate) {
|
|
14582
|
+
return endDate >= value;
|
|
14583
|
+
} else {
|
|
14584
|
+
return true;
|
|
14585
|
+
}
|
|
14586
|
+
};
|
|
14587
|
+
var equalDate = (date1, date2) => {
|
|
14588
|
+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14589
|
+
};
|
|
14590
|
+
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14591
|
+
const month = date.getMonth();
|
|
14592
|
+
const year = date.getFullYear();
|
|
14593
|
+
const dayList = [];
|
|
14594
|
+
let currentDate = new Date(year, month, 1);
|
|
14595
|
+
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14596
|
+
while (currentDate.getDay() !== weekStartIndex) {
|
|
14597
|
+
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14598
|
+
}
|
|
14599
|
+
while (dayList.length < 7 * weeks) {
|
|
14600
|
+
const date2 = new Date(currentDate);
|
|
14601
|
+
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14602
|
+
dayList.push(date2);
|
|
14603
|
+
currentDate = addDuration(currentDate, { days: 1 });
|
|
14604
|
+
}
|
|
14605
|
+
return equalSizeGroups(dayList, 7);
|
|
14606
|
+
};
|
|
14607
|
+
var formatAbsolute = (date, locale, format) => {
|
|
14608
|
+
let options;
|
|
14609
|
+
switch (format) {
|
|
14610
|
+
case "date":
|
|
14611
|
+
options = {
|
|
14612
|
+
year: "2-digit",
|
|
14613
|
+
month: "2-digit",
|
|
14614
|
+
day: "2-digit"
|
|
14615
|
+
};
|
|
14616
|
+
break;
|
|
14617
|
+
case "time":
|
|
14618
|
+
options = {
|
|
14619
|
+
hour: "2-digit",
|
|
14620
|
+
minute: "2-digit"
|
|
14621
|
+
};
|
|
14622
|
+
break;
|
|
14623
|
+
case "dateTime":
|
|
14624
|
+
options = {
|
|
14625
|
+
year: "numeric",
|
|
14626
|
+
month: "2-digit",
|
|
14627
|
+
day: "2-digit",
|
|
14628
|
+
hour: "2-digit",
|
|
14629
|
+
minute: "2-digit"
|
|
14630
|
+
};
|
|
14631
|
+
break;
|
|
14632
|
+
}
|
|
14633
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14634
|
+
};
|
|
14635
|
+
var formatRelative = (date, locale) => {
|
|
14636
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14637
|
+
const now = /* @__PURE__ */ new Date();
|
|
14638
|
+
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14639
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14640
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
14641
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
14642
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
14643
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
14644
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
14645
|
+
return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "year");
|
|
14646
|
+
};
|
|
14647
|
+
var toInputString = (date, format) => {
|
|
14648
|
+
switch (format) {
|
|
14649
|
+
case "date":
|
|
14650
|
+
return date.toISOString().split("T")[0];
|
|
14651
|
+
case "time":
|
|
14652
|
+
return date.toISOString().split("T")[1].split("Z")[0];
|
|
14653
|
+
case "dateTime":
|
|
14654
|
+
return date.toISOString();
|
|
14655
|
+
}
|
|
14656
|
+
};
|
|
14657
|
+
var DateUtils = {
|
|
14658
|
+
monthsList,
|
|
14659
|
+
weekDayList,
|
|
14660
|
+
equalDate,
|
|
14661
|
+
formatAbsolute,
|
|
14662
|
+
formatRelative,
|
|
14663
|
+
addDuration,
|
|
14664
|
+
subtractDuration,
|
|
14665
|
+
between,
|
|
14666
|
+
weeksForCalenderMonth,
|
|
14667
|
+
timesInSeconds,
|
|
14668
|
+
toInputString
|
|
14669
|
+
};
|
|
14670
|
+
|
|
14671
|
+
// src/components/user-interaction/date/DatePicker.tsx
|
|
14672
14672
|
import clsx23 from "clsx";
|
|
14673
14673
|
|
|
14674
14674
|
// src/components/user-interaction/date/DayPicker.tsx
|
|
14675
|
-
import { useCallback as
|
|
14675
|
+
import { useCallback as useCallback23, useEffect as useEffect29, useMemo as useMemo22, useRef as useRef27 } from "react";
|
|
14676
14676
|
import { jsx as jsx61, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
14677
14677
|
var DayPicker = ({
|
|
14678
14678
|
displayedMonth: controlledDisplayedMonth,
|
|
@@ -14700,18 +14700,18 @@ var DayPicker = ({
|
|
|
14700
14700
|
defaultValue: initialDisplayedMonth ?? value
|
|
14701
14701
|
});
|
|
14702
14702
|
const month = displayedMonth.getMonth();
|
|
14703
|
-
const weeks =
|
|
14704
|
-
const selectedButtonRef =
|
|
14703
|
+
const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
|
|
14704
|
+
const selectedButtonRef = useRef27(null);
|
|
14705
14705
|
const isValueInDisplayedWeeks = useMemo22(
|
|
14706
14706
|
() => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
|
|
14707
14707
|
[value, weeks]
|
|
14708
14708
|
);
|
|
14709
|
-
const firstDayOfMonth =
|
|
14709
|
+
const firstDayOfMonth = useCallback23(
|
|
14710
14710
|
(date) => new Date(date.getFullYear(), date.getMonth(), 1),
|
|
14711
14711
|
[]
|
|
14712
14712
|
);
|
|
14713
14713
|
const focusTargetDate = value && isValueInDisplayedWeeks ? value : firstDayOfMonth(displayedMonth);
|
|
14714
|
-
|
|
14714
|
+
useEffect29(() => {
|
|
14715
14715
|
selectedButtonRef.current?.focus();
|
|
14716
14716
|
}, [focusTargetDate]);
|
|
14717
14717
|
const end = useMemo22(() => {
|
|
@@ -14722,27 +14722,27 @@ var DayPicker = ({
|
|
|
14722
14722
|
if (!providedStart) return;
|
|
14723
14723
|
return new Date(providedStart.getFullYear(), providedStart.getMonth(), providedStart.getDate());
|
|
14724
14724
|
}, [providedStart]);
|
|
14725
|
-
const clampToRange =
|
|
14725
|
+
const clampToRange = useCallback23((date) => {
|
|
14726
14726
|
if (start && date < start) return start;
|
|
14727
14727
|
if (end && date > end) return end;
|
|
14728
14728
|
return date;
|
|
14729
14729
|
}, [start, end]);
|
|
14730
|
-
const navigateTo =
|
|
14730
|
+
const navigateTo = useCallback23((candidate) => {
|
|
14731
14731
|
const clamped = clampToRange(candidate);
|
|
14732
|
-
if (!
|
|
14732
|
+
if (!DateUtils.between(clamped, start, end)) return;
|
|
14733
14733
|
setValue(clamped);
|
|
14734
14734
|
onEditComplete?.(clamped);
|
|
14735
14735
|
if (clamped.getMonth() !== displayedMonth.getMonth() || clamped.getFullYear() !== displayedMonth.getFullYear()) {
|
|
14736
14736
|
setDisplayedMonth(firstDayOfMonth(clamped));
|
|
14737
14737
|
}
|
|
14738
14738
|
}, [clampToRange, start, end, setValue, onEditComplete, displayedMonth, setDisplayedMonth, firstDayOfMonth]);
|
|
14739
|
-
const onKeyDown =
|
|
14739
|
+
const onKeyDown = useCallback23(
|
|
14740
14740
|
(event) => {
|
|
14741
14741
|
PropsUtil.aria.navigate({
|
|
14742
|
-
left: () => focusTargetDate && navigateTo(subtractDuration(focusTargetDate, { days: 1 })),
|
|
14743
|
-
right: () => focusTargetDate && navigateTo(addDuration(focusTargetDate, { days: 1 })),
|
|
14744
|
-
up: () => focusTargetDate && navigateTo(subtractDuration(focusTargetDate, { days: 7 })),
|
|
14745
|
-
down: () => focusTargetDate && navigateTo(addDuration(focusTargetDate, { days: 7 }))
|
|
14742
|
+
left: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 1 })),
|
|
14743
|
+
right: () => focusTargetDate && navigateTo(DateUtils.addDuration(focusTargetDate, { days: 1 })),
|
|
14744
|
+
up: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 7 })),
|
|
14745
|
+
down: () => focusTargetDate && navigateTo(DateUtils.addDuration(focusTargetDate, { days: 7 }))
|
|
14746
14746
|
})(event);
|
|
14747
14747
|
},
|
|
14748
14748
|
[focusTargetDate, navigateTo]
|
|
@@ -14754,7 +14754,7 @@ var DayPicker = ({
|
|
|
14754
14754
|
const isFocused = !!focusTargetDate && DateUtils.equalDate(focusTargetDate, date);
|
|
14755
14755
|
const isToday = DateUtils.equalDate(/* @__PURE__ */ new Date(), date);
|
|
14756
14756
|
const isSameMonth = date.getMonth() === month;
|
|
14757
|
-
const isDayValid =
|
|
14757
|
+
const isDayValid = DateUtils.between(date, start, end);
|
|
14758
14758
|
return /* @__PURE__ */ jsx61(
|
|
14759
14759
|
"div",
|
|
14760
14760
|
{
|
|
@@ -14792,7 +14792,7 @@ var DayPicker = ({
|
|
|
14792
14792
|
};
|
|
14793
14793
|
|
|
14794
14794
|
// src/components/user-interaction/date/YearMonthPicker.tsx
|
|
14795
|
-
import { memo, useCallback as
|
|
14795
|
+
import { memo, useCallback as useCallback24, useEffect as useEffect30, useMemo as useMemo23, useRef as useRef28, useState as useState26 } from "react";
|
|
14796
14796
|
import clsx22 from "clsx";
|
|
14797
14797
|
import { jsx as jsx62, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
14798
14798
|
var YearRow = memo(function YearRow2({
|
|
@@ -14803,10 +14803,10 @@ var YearRow = memo(function YearRow2({
|
|
|
14803
14803
|
monthNames,
|
|
14804
14804
|
onSelect
|
|
14805
14805
|
}) {
|
|
14806
|
-
const ref =
|
|
14806
|
+
const ref = useRef28(null);
|
|
14807
14807
|
const isSelectedYear = selectedMonthIndex !== void 0;
|
|
14808
14808
|
const [isExpanded, setIsExpanded] = useState26(false);
|
|
14809
|
-
|
|
14809
|
+
useEffect30(() => {
|
|
14810
14810
|
if (isSelectedYear) {
|
|
14811
14811
|
ref.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
14812
14812
|
}
|
|
@@ -14848,8 +14848,8 @@ var YearRow = memo(function YearRow2({
|
|
|
14848
14848
|
}
|
|
14849
14849
|
);
|
|
14850
14850
|
});
|
|
14851
|
-
var defaultStart = subtractDuration(/* @__PURE__ */ new Date(), { years: 100 });
|
|
14852
|
-
var defaultEnd = addDuration(/* @__PURE__ */ new Date(), { years: 100 });
|
|
14851
|
+
var defaultStart = DateUtils.subtractDuration(/* @__PURE__ */ new Date(), { years: 100 });
|
|
14852
|
+
var defaultEnd = DateUtils.addDuration(/* @__PURE__ */ new Date(), { years: 100 });
|
|
14853
14853
|
var YearMonthPicker = ({
|
|
14854
14854
|
value: controlledValue,
|
|
14855
14855
|
initialValue = /* @__PURE__ */ new Date(),
|
|
@@ -14882,7 +14882,7 @@ var YearMonthPicker = ({
|
|
|
14882
14882
|
if (!end) return;
|
|
14883
14883
|
return new Date(end.getFullYear(), end.getMonth() + 1, 0).getTime();
|
|
14884
14884
|
}, [end]);
|
|
14885
|
-
const handleSelect =
|
|
14885
|
+
const handleSelect = useCallback24((newDate) => {
|
|
14886
14886
|
setValue(newDate);
|
|
14887
14887
|
onEditCompleteStable(newDate);
|
|
14888
14888
|
}, [onEditCompleteStable, setValue]);
|
|
@@ -14975,9 +14975,9 @@ var DatePicker = ({
|
|
|
14975
14975
|
{
|
|
14976
14976
|
tooltip: translation("time.previousMonth"),
|
|
14977
14977
|
size: "sm",
|
|
14978
|
-
disabled: !
|
|
14978
|
+
disabled: !DateUtils.between(DateUtils.subtractDuration(displayedMonth, { months: 1 }), start, end),
|
|
14979
14979
|
onClick: () => {
|
|
14980
|
-
setDisplayedMonth(subtractDuration(displayedMonth, { months: 1 }));
|
|
14980
|
+
setDisplayedMonth(DateUtils.subtractDuration(displayedMonth, { months: 1 }));
|
|
14981
14981
|
},
|
|
14982
14982
|
children: /* @__PURE__ */ jsx63(ArrowUp, { size: 20 })
|
|
14983
14983
|
}
|
|
@@ -14987,9 +14987,9 @@ var DatePicker = ({
|
|
|
14987
14987
|
{
|
|
14988
14988
|
tooltip: translation("time.nextMonth"),
|
|
14989
14989
|
size: "sm",
|
|
14990
|
-
disabled: !
|
|
14990
|
+
disabled: !DateUtils.between(DateUtils.addDuration(displayedMonth, { months: 1 }), start, end),
|
|
14991
14991
|
onClick: () => {
|
|
14992
|
-
setDisplayedMonth(addDuration(displayedMonth, { months: 1 }));
|
|
14992
|
+
setDisplayedMonth(DateUtils.addDuration(displayedMonth, { months: 1 }));
|
|
14993
14993
|
},
|
|
14994
14994
|
children: /* @__PURE__ */ jsx63(ArrowDown, { size: 20 })
|
|
14995
14995
|
}
|
|
@@ -15079,7 +15079,6 @@ var DateTimePicker = ({
|
|
|
15079
15079
|
...timePickerProps,
|
|
15080
15080
|
is24HourFormat,
|
|
15081
15081
|
minuteIncrement,
|
|
15082
|
-
className: clsx24({ "justify-between": mode === "time" }),
|
|
15083
15082
|
value,
|
|
15084
15083
|
onValueChange: setValue,
|
|
15085
15084
|
onEditComplete
|
|
@@ -15175,9 +15174,9 @@ var DateTimePickerDialog = ({
|
|
|
15175
15174
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
15176
15175
|
import { Fragment as Fragment7, jsx as jsx66, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
15177
15176
|
var DateTimeInput = forwardRef17(function DateTimeInput2({
|
|
15177
|
+
id: inputId,
|
|
15178
15178
|
value,
|
|
15179
15179
|
initialValue = null,
|
|
15180
|
-
placeholder,
|
|
15181
15180
|
onValueChange,
|
|
15182
15181
|
onEditComplete,
|
|
15183
15182
|
allowRemove = false,
|
|
@@ -15193,7 +15192,6 @@ var DateTimeInput = forwardRef17(function DateTimeInput2({
|
|
|
15193
15192
|
...props
|
|
15194
15193
|
}, forwardedRef) {
|
|
15195
15194
|
const translation = useHightideTranslation();
|
|
15196
|
-
const { locale } = useLocale();
|
|
15197
15195
|
const [isOpen, setIsOpen] = useState28(false);
|
|
15198
15196
|
const [state, setState] = useControlledState({
|
|
15199
15197
|
value,
|
|
@@ -15201,50 +15199,50 @@ var DateTimeInput = forwardRef17(function DateTimeInput2({
|
|
|
15201
15199
|
defaultValue: initialValue
|
|
15202
15200
|
});
|
|
15203
15201
|
const [dialogValue, setDialogValue] = useState28(state ?? /* @__PURE__ */ new Date());
|
|
15204
|
-
|
|
15202
|
+
const [dateString, setDateString] = useState28(state ? DateUtils.toInputString(state, mode) : "");
|
|
15203
|
+
useEffect31(() => {
|
|
15205
15204
|
setDialogValue(state ?? /* @__PURE__ */ new Date());
|
|
15206
|
-
|
|
15207
|
-
|
|
15205
|
+
setDateString(state ? DateUtils.toInputString(state, mode) : "");
|
|
15206
|
+
}, [mode, state]);
|
|
15207
|
+
const changeOpenWrapper = useCallback25((isOpen2) => {
|
|
15208
15208
|
onDialogOpeningChange?.(isOpen2);
|
|
15209
15209
|
setIsOpen(isOpen2);
|
|
15210
15210
|
}, [onDialogOpeningChange]);
|
|
15211
|
-
const
|
|
15211
|
+
const generatedId = useId13();
|
|
15212
15212
|
const ids = useMemo24(() => ({
|
|
15213
|
-
input: `date-time-input-${
|
|
15214
|
-
popup: `date-time-input-popup-${
|
|
15215
|
-
label: `date-time-input-label-${
|
|
15216
|
-
}), [
|
|
15217
|
-
const innerRef =
|
|
15213
|
+
input: inputId ?? `date-time-input-${generatedId}`,
|
|
15214
|
+
popup: `date-time-input-popup-${generatedId}`,
|
|
15215
|
+
label: `date-time-input-label-${generatedId}`
|
|
15216
|
+
}), [generatedId, inputId]);
|
|
15217
|
+
const innerRef = useRef29(null);
|
|
15218
15218
|
useImperativeHandle11(forwardedRef, () => innerRef.current);
|
|
15219
|
-
|
|
15219
|
+
useEffect31(() => {
|
|
15220
15220
|
if (readOnly || disabled) {
|
|
15221
15221
|
changeOpenWrapper(false);
|
|
15222
15222
|
}
|
|
15223
15223
|
}, [changeOpenWrapper, readOnly, disabled]);
|
|
15224
|
-
const clickHandler = PropsUtil.aria.click(() => changeOpenWrapper(true));
|
|
15225
15224
|
return /* @__PURE__ */ jsxs36(Fragment7, { children: [
|
|
15226
|
-
/* @__PURE__ */ jsxs36("div", { ...containerProps, className:
|
|
15225
|
+
/* @__PURE__ */ jsxs36("div", { ...containerProps, className: clsx24("relative w-full", containerProps?.className), children: [
|
|
15227
15226
|
/* @__PURE__ */ jsx66(
|
|
15228
|
-
"
|
|
15227
|
+
"input",
|
|
15229
15228
|
{
|
|
15230
15229
|
...props,
|
|
15231
15230
|
ref: innerRef,
|
|
15232
15231
|
id: ids.input,
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15232
|
+
value: dateString,
|
|
15233
|
+
onChange: (event) => {
|
|
15234
|
+
const date = event.target.valueAsDate;
|
|
15235
|
+
if (date) {
|
|
15236
|
+
setState(date);
|
|
15237
|
+
} else {
|
|
15238
|
+
setDateString(event.target.value);
|
|
15239
|
+
}
|
|
15236
15240
|
},
|
|
15237
|
-
|
|
15241
|
+
type: mode === "date" ? "date" : mode === "time" ? "time" : "datetime-local",
|
|
15238
15242
|
...PropsUtil.dataAttributes.interactionStates({ disabled, readOnly, invalid, required }),
|
|
15239
|
-
"data-value": PropsUtil.dataAttributes.bool(!!state),
|
|
15240
|
-
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props),
|
|
15241
|
-
tabIndex: 0,
|
|
15242
|
-
role: "combobox",
|
|
15243
|
-
"aria-haspopup": "dialog",
|
|
15244
|
-
"aria-expanded": isOpen,
|
|
15245
|
-
"aria-controls": isOpen ? ids.popup : void 0,
|
|
15246
15243
|
"data-name": props["data-name"] ?? "date-time-input",
|
|
15247
|
-
|
|
15244
|
+
"data-value": PropsUtil.dataAttributes.bool(!!state || !!dateString),
|
|
15245
|
+
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props)
|
|
15248
15246
|
}
|
|
15249
15247
|
),
|
|
15250
15248
|
/* @__PURE__ */ jsx66(Visibility, { isVisible: !readOnly, children: /* @__PURE__ */ jsx66(
|
|
@@ -15342,7 +15340,7 @@ import {
|
|
|
15342
15340
|
|
|
15343
15341
|
// src/components/user-interaction/Checkbox.tsx
|
|
15344
15342
|
import { Check as Check2, Minus as Minus2 } from "lucide-react";
|
|
15345
|
-
import { useCallback as
|
|
15343
|
+
import { useCallback as useCallback26 } from "react";
|
|
15346
15344
|
import { jsx as jsx68, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
15347
15345
|
var Checkbox = ({
|
|
15348
15346
|
value: controlledValue,
|
|
@@ -15360,7 +15358,7 @@ var Checkbox = ({
|
|
|
15360
15358
|
}) => {
|
|
15361
15359
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15362
15360
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
15363
|
-
const onChangeWrapper =
|
|
15361
|
+
const onChangeWrapper = useCallback26((value2) => {
|
|
15364
15362
|
onValueChangeStable(value2);
|
|
15365
15363
|
onEditCompleteStable(value2);
|
|
15366
15364
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -15376,16 +15374,16 @@ var Checkbox = ({
|
|
|
15376
15374
|
onClick: (event) => {
|
|
15377
15375
|
if (!disabled) {
|
|
15378
15376
|
setValue((prev) => !prev);
|
|
15379
|
-
props.onClick?.(event);
|
|
15380
15377
|
}
|
|
15378
|
+
props.onClick?.(event);
|
|
15381
15379
|
},
|
|
15382
15380
|
onKeyDown: (event) => {
|
|
15383
15381
|
if (disabled) return;
|
|
15384
15382
|
if (event.key === " " || event.key === "Enter") {
|
|
15385
15383
|
event.preventDefault();
|
|
15386
15384
|
setValue((prev) => !prev);
|
|
15387
|
-
props.onKeyDown?.(event);
|
|
15388
15385
|
}
|
|
15386
|
+
props.onKeyDown?.(event);
|
|
15389
15387
|
},
|
|
15390
15388
|
"data-checked": !indeterminate ? value : "indeterminate",
|
|
15391
15389
|
"data-size": size ?? void 0,
|
|
@@ -15726,6 +15724,12 @@ var NumberFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15726
15724
|
};
|
|
15727
15725
|
var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
15728
15726
|
const translation = useHightideTranslation();
|
|
15727
|
+
const id = useId14();
|
|
15728
|
+
const ids = {
|
|
15729
|
+
startDate: `date-filter-start-date-${id}`,
|
|
15730
|
+
endDate: `date-filter-end-date-${id}`,
|
|
15731
|
+
compareDate: `date-filter-compare-date-${id}`
|
|
15732
|
+
};
|
|
15729
15733
|
const operator = filterValue?.operator ?? "dateBetween";
|
|
15730
15734
|
const parameter = filterValue?.parameter ?? {};
|
|
15731
15735
|
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState29(null);
|
|
@@ -15753,11 +15757,12 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15753
15757
|
),
|
|
15754
15758
|
/* @__PURE__ */ jsx69("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
15755
15759
|
/* @__PURE__ */ jsx69(Visibility, { isVisible: needsRangeInput, children: /* @__PURE__ */ jsxs39("div", { className: "flex-col-2 gap-2", children: [
|
|
15760
|
+
/* @__PURE__ */ jsx69("label", { htmlFor: ids.startDate, className: "typography-label-md", children: translation("startDate") }),
|
|
15756
15761
|
/* @__PURE__ */ jsx69(
|
|
15757
15762
|
DateTimeInput,
|
|
15758
15763
|
{
|
|
15764
|
+
id: ids.startDate,
|
|
15759
15765
|
value: temporaryMinDateValue ?? parameter.min ?? null,
|
|
15760
|
-
placeholder: translation("startDate"),
|
|
15761
15766
|
onValueChange: (value) => setTemporaryMinDateValue(value),
|
|
15762
15767
|
onEditComplete: (value) => {
|
|
15763
15768
|
if (value && parameter.max && value > parameter.max) {
|
|
@@ -15786,11 +15791,12 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15786
15791
|
className: "min-w-64"
|
|
15787
15792
|
}
|
|
15788
15793
|
),
|
|
15794
|
+
/* @__PURE__ */ jsx69("label", { htmlFor: ids.endDate, className: "typography-label-md", children: translation("endDate") }),
|
|
15789
15795
|
/* @__PURE__ */ jsx69(
|
|
15790
15796
|
DateTimeInput,
|
|
15791
15797
|
{
|
|
15798
|
+
id: ids.endDate,
|
|
15792
15799
|
value: temporaryMaxDateValue ?? parameter.max ?? null,
|
|
15793
|
-
placeholder: translation("endDate"),
|
|
15794
15800
|
onValueChange: (value) => setTemporaryMaxDateValue(value),
|
|
15795
15801
|
onEditComplete: (value) => {
|
|
15796
15802
|
if (value && parameter.min && value < parameter.min) {
|
|
@@ -15819,27 +15825,36 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15819
15825
|
}
|
|
15820
15826
|
)
|
|
15821
15827
|
] }) }),
|
|
15822
|
-
/* @__PURE__ */
|
|
15823
|
-
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15828
|
+
/* @__PURE__ */ jsxs39(Visibility, { isVisible: !needsRangeInput && needsParameterInput, children: [
|
|
15829
|
+
/* @__PURE__ */ jsx69("label", { htmlFor: ids.compareDate, className: "typography-label-md", children: translation("date") }),
|
|
15830
|
+
/* @__PURE__ */ jsx69(
|
|
15831
|
+
DateTimeInput,
|
|
15832
|
+
{
|
|
15833
|
+
id: ids.compareDate,
|
|
15834
|
+
value: parameter.compareDate ?? null,
|
|
15835
|
+
onValueChange: (compareDate) => {
|
|
15836
|
+
onFilterValueChange({
|
|
15837
|
+
operator,
|
|
15838
|
+
parameter: { compareDate }
|
|
15839
|
+
});
|
|
15840
|
+
},
|
|
15841
|
+
allowRemove: true,
|
|
15842
|
+
outsideClickCloses: false,
|
|
15843
|
+
className: "min-w-64"
|
|
15844
|
+
}
|
|
15845
|
+
)
|
|
15846
|
+
] }),
|
|
15838
15847
|
/* @__PURE__ */ jsx69(Visibility, { isVisible: !needsParameterInput, children: /* @__PURE__ */ jsx69("span", { className: "text-sm text-description", children: translation("noParameterRequired") }) })
|
|
15839
15848
|
] });
|
|
15840
15849
|
};
|
|
15841
15850
|
var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
15842
15851
|
const translation = useHightideTranslation();
|
|
15852
|
+
const id = useId14();
|
|
15853
|
+
const ids = {
|
|
15854
|
+
startDate: `datetime-filter-start-date-${id}`,
|
|
15855
|
+
endDate: `datetime-filter-end-date-${id}`,
|
|
15856
|
+
compareDate: `datetime-filter-compare-date-${id}`
|
|
15857
|
+
};
|
|
15843
15858
|
const operator = filterValue?.operator ?? "dateTimeBetween";
|
|
15844
15859
|
const parameter = filterValue?.parameter ?? {};
|
|
15845
15860
|
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState29(null);
|
|
@@ -15867,12 +15882,13 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15867
15882
|
),
|
|
15868
15883
|
/* @__PURE__ */ jsx69("span", { className: "typography-label-lg font-semibold", children: translation("parameter") }),
|
|
15869
15884
|
/* @__PURE__ */ jsx69(Visibility, { isVisible: needsRangeInput, children: /* @__PURE__ */ jsxs39("div", { className: "flex-col-2 gap-2", children: [
|
|
15885
|
+
/* @__PURE__ */ jsx69("label", { htmlFor: ids.startDate, className: "typography-label-md", children: translation("startDate") }),
|
|
15870
15886
|
/* @__PURE__ */ jsx69(
|
|
15871
15887
|
DateTimeInput,
|
|
15872
15888
|
{
|
|
15889
|
+
id: ids.startDate,
|
|
15873
15890
|
mode: "dateTime",
|
|
15874
15891
|
value: temporaryMinDateValue ?? parameter.min ?? null,
|
|
15875
|
-
placeholder: translation("startDate"),
|
|
15876
15892
|
onValueChange: (value) => setTemporaryMinDateValue(value),
|
|
15877
15893
|
onEditComplete: (value) => {
|
|
15878
15894
|
if (value && parameter.max && value > parameter.max) {
|
|
@@ -15901,12 +15917,13 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15901
15917
|
className: "min-w-64"
|
|
15902
15918
|
}
|
|
15903
15919
|
),
|
|
15920
|
+
/* @__PURE__ */ jsx69("label", { htmlFor: ids.endDate, className: "typography-label-md", children: translation("endDate") }),
|
|
15904
15921
|
/* @__PURE__ */ jsx69(
|
|
15905
15922
|
DateTimeInput,
|
|
15906
15923
|
{
|
|
15924
|
+
id: ids.endDate,
|
|
15907
15925
|
mode: "dateTime",
|
|
15908
15926
|
value: temporaryMaxDateValue ?? parameter.max ?? null,
|
|
15909
|
-
placeholder: translation("endDate"),
|
|
15910
15927
|
onValueChange: (value) => setTemporaryMaxDateValue(value),
|
|
15911
15928
|
onEditComplete: (value) => {
|
|
15912
15929
|
if (value && parameter.min && value < parameter.min) {
|
|
@@ -15935,22 +15952,25 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15935
15952
|
}
|
|
15936
15953
|
)
|
|
15937
15954
|
] }) }),
|
|
15938
|
-
/* @__PURE__ */
|
|
15939
|
-
|
|
15940
|
-
|
|
15941
|
-
|
|
15942
|
-
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15955
|
+
/* @__PURE__ */ jsxs39(Visibility, { isVisible: !needsRangeInput && needsParameterInput, children: [
|
|
15956
|
+
/* @__PURE__ */ jsx69("label", { htmlFor: ids.compareDate, className: "typography-label-md", children: translation("date") }),
|
|
15957
|
+
/* @__PURE__ */ jsx69(
|
|
15958
|
+
DateTimeInput,
|
|
15959
|
+
{
|
|
15960
|
+
id: ids.compareDate,
|
|
15961
|
+
value: parameter.compareDatetime ?? null,
|
|
15962
|
+
onValueChange: (compareDatetime) => {
|
|
15963
|
+
onFilterValueChange({
|
|
15964
|
+
operator,
|
|
15965
|
+
parameter: { compareDatetime }
|
|
15966
|
+
});
|
|
15967
|
+
},
|
|
15968
|
+
allowRemove: true,
|
|
15969
|
+
outsideClickCloses: false,
|
|
15970
|
+
className: "min-w-64"
|
|
15971
|
+
}
|
|
15972
|
+
)
|
|
15973
|
+
] }),
|
|
15954
15974
|
/* @__PURE__ */ jsx69(Visibility, { isVisible: !needsParameterInput, children: /* @__PURE__ */ jsx69("span", { className: "text-sm text-description", children: translation("noParameterRequired") }) })
|
|
15955
15975
|
] });
|
|
15956
15976
|
};
|
|
@@ -16145,8 +16165,8 @@ var TableFilterButton = ({
|
|
|
16145
16165
|
const columnFilterValue = column.getFilterValue();
|
|
16146
16166
|
const [filterValue, setFilterValue] = useState30(columnFilterValue);
|
|
16147
16167
|
const hasFilter = !!filterValue;
|
|
16148
|
-
const anchorRef =
|
|
16149
|
-
const containerRef =
|
|
16168
|
+
const anchorRef = useRef30(null);
|
|
16169
|
+
const containerRef = useRef30(null);
|
|
16150
16170
|
const [isOpen, setIsOpen] = useState30(false);
|
|
16151
16171
|
const id = useId15();
|
|
16152
16172
|
const ids = useMemo26(() => ({
|
|
@@ -16154,7 +16174,7 @@ var TableFilterButton = ({
|
|
|
16154
16174
|
popup: `table-filter-popup-${id}`,
|
|
16155
16175
|
label: `table-filter-label-${id}`
|
|
16156
16176
|
}), [id]);
|
|
16157
|
-
|
|
16177
|
+
useEffect32(() => {
|
|
16158
16178
|
setFilterValue(columnFilterValue);
|
|
16159
16179
|
}, [columnFilterValue]);
|
|
16160
16180
|
const isTagsFilter = filterType === "multiTags" || filterType === "singleTag";
|
|
@@ -16229,11 +16249,11 @@ var TableFilterButton = ({
|
|
|
16229
16249
|
};
|
|
16230
16250
|
|
|
16231
16251
|
// src/components/layout/table/TableHeader.tsx
|
|
16232
|
-
import { useCallback as
|
|
16252
|
+
import { useCallback as useCallback27, useEffect as useEffect33 } from "react";
|
|
16233
16253
|
import { Fragment as Fragment9, jsx as jsx71, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
16234
16254
|
var TableHeader = ({ isSticky = false }) => {
|
|
16235
16255
|
const { table } = useTableStateWithoutSizingContext();
|
|
16236
|
-
const handleResizeMove =
|
|
16256
|
+
const handleResizeMove = useCallback27((e) => {
|
|
16237
16257
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
16238
16258
|
const currentX = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
16239
16259
|
const deltaOffset = currentX - (table.getState().columnSizingInfo.startOffset ?? 0);
|
|
@@ -16249,7 +16269,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
16249
16269
|
deltaOffset
|
|
16250
16270
|
}));
|
|
16251
16271
|
}, [table]);
|
|
16252
|
-
const handleResizeEnd =
|
|
16272
|
+
const handleResizeEnd = useCallback27(() => {
|
|
16253
16273
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
16254
16274
|
const newWidth = (table.getState().columnSizingInfo.startSize ?? 0) + (table.getState().columnSizingInfo.deltaOffset ?? 0);
|
|
16255
16275
|
table.setColumnSizing((prev) => {
|
|
@@ -16267,7 +16287,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
16267
16287
|
startSize: null
|
|
16268
16288
|
});
|
|
16269
16289
|
}, [table]);
|
|
16270
|
-
|
|
16290
|
+
useEffect33(() => {
|
|
16271
16291
|
window.addEventListener("pointermove", handleResizeMove);
|
|
16272
16292
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
16273
16293
|
return () => {
|
|
@@ -16287,14 +16307,14 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
16287
16307
|
},
|
|
16288
16308
|
header.id
|
|
16289
16309
|
)) }) }, headerGroup.id)),
|
|
16290
|
-
/* @__PURE__ */ jsx71("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx71("tr", { "data-name": "table-header-row", className:
|
|
16310
|
+
/* @__PURE__ */ jsx71("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx71("tr", { "data-name": "table-header-row", className: clsx25(table.options.meta?.headerRowClassName), children: headerGroup.headers.map((header) => {
|
|
16291
16311
|
return /* @__PURE__ */ jsxs41(
|
|
16292
16312
|
"th",
|
|
16293
16313
|
{
|
|
16294
16314
|
colSpan: header.colSpan,
|
|
16295
16315
|
"data-sticky": isSticky ? "" : void 0,
|
|
16296
16316
|
"data-name": "table-header-cell",
|
|
16297
|
-
className:
|
|
16317
|
+
className: clsx25("group/table-header-cell", header.column.columnDef.meta?.className),
|
|
16298
16318
|
children: [
|
|
16299
16319
|
/* @__PURE__ */ jsx71(Visibility, { isVisible: !header.isPlaceholder, children: /* @__PURE__ */ jsxs41("div", { className: "flex-row-1 items-center", children: [
|
|
16300
16320
|
/* @__PURE__ */ jsx71(Visibility, { isVisible: header.column.getCanSort(), children: /* @__PURE__ */ jsx71(
|
|
@@ -16394,7 +16414,7 @@ var TableDisplay = ({
|
|
|
16394
16414
|
};
|
|
16395
16415
|
|
|
16396
16416
|
// src/components/layout/table/TablePagination.tsx
|
|
16397
|
-
import
|
|
16417
|
+
import clsx26 from "clsx";
|
|
16398
16418
|
import { jsx as jsx73, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
16399
16419
|
var TablePaginationMenu = ({ ...props }) => {
|
|
16400
16420
|
const { table } = useTableStateWithoutSizingContext();
|
|
@@ -16429,14 +16449,14 @@ var TablePageSizeSelect = ({
|
|
|
16429
16449
|
);
|
|
16430
16450
|
};
|
|
16431
16451
|
var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props }) => {
|
|
16432
|
-
return /* @__PURE__ */ jsxs43("div", { ...props, className:
|
|
16452
|
+
return /* @__PURE__ */ jsxs43("div", { ...props, className: clsx26("container flex-col-2 sm:flex-row-8 items-center justify-center", props.className), children: [
|
|
16433
16453
|
/* @__PURE__ */ jsx73(TablePaginationMenu, {}),
|
|
16434
16454
|
/* @__PURE__ */ jsx73(Visibility, { isVisible: allowChangingPageSize, children: /* @__PURE__ */ jsx73(TablePageSizeSelect, { pageSizeOptions, buttonProps: { className: "h-10 min-w-24 max-w-24" } }) })
|
|
16435
16455
|
] });
|
|
16436
16456
|
};
|
|
16437
16457
|
|
|
16438
16458
|
// src/components/layout/table/TableWithSelectionProvider.tsx
|
|
16439
|
-
import { useCallback as
|
|
16459
|
+
import { useCallback as useCallback28, useMemo as useMemo27 } from "react";
|
|
16440
16460
|
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
16441
16461
|
var TableWithSelectionProvider = ({
|
|
16442
16462
|
children,
|
|
@@ -16492,7 +16512,7 @@ var TableWithSelectionProvider = ({
|
|
|
16492
16512
|
TableProvider,
|
|
16493
16513
|
{
|
|
16494
16514
|
...props,
|
|
16495
|
-
fillerRowCell:
|
|
16515
|
+
fillerRowCell: useCallback28((columnId, table) => {
|
|
16496
16516
|
if (columnId === selectionRowId) {
|
|
16497
16517
|
return /* @__PURE__ */ jsx74(Checkbox, { value: false, disabled: true });
|
|
16498
16518
|
}
|
|
@@ -16510,7 +16530,7 @@ var TableWithSelectionProvider = ({
|
|
|
16510
16530
|
rowSelection,
|
|
16511
16531
|
...state
|
|
16512
16532
|
},
|
|
16513
|
-
onRowClick:
|
|
16533
|
+
onRowClick: useCallback28((row, table) => {
|
|
16514
16534
|
if (!disableClickRowClickSelection) {
|
|
16515
16535
|
row.toggleSelected();
|
|
16516
16536
|
}
|
|
@@ -16522,11 +16542,11 @@ var TableWithSelectionProvider = ({
|
|
|
16522
16542
|
};
|
|
16523
16543
|
|
|
16524
16544
|
// src/components/layout/table/Table.tsx
|
|
16525
|
-
import
|
|
16545
|
+
import clsx27 from "clsx";
|
|
16526
16546
|
import { jsx as jsx75, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
16527
16547
|
var Table = ({ children, table, paginationOptions, displayProps, header, footer, ...props }) => {
|
|
16528
16548
|
const { showPagination = true, allowChangingPageSize, pageSizeOptions } = paginationOptions ?? {};
|
|
16529
|
-
return /* @__PURE__ */ jsx75("div", { ...props, className:
|
|
16549
|
+
return /* @__PURE__ */ jsx75("div", { ...props, className: clsx27("flex-col-3", props.className), children: /* @__PURE__ */ jsxs44(TableProvider, { ...table, children: [
|
|
16530
16550
|
header,
|
|
16531
16551
|
/* @__PURE__ */ jsx75(TableDisplay, { ...displayProps, children }),
|
|
16532
16552
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: showPagination, children: /* @__PURE__ */ jsx75(TablePagination, { allowChangingPageSize, pageSizeOptions }) }),
|
|
@@ -16543,7 +16563,7 @@ var TableWithSelection = ({
|
|
|
16543
16563
|
...props
|
|
16544
16564
|
}) => {
|
|
16545
16565
|
const { showPagination = true, allowChangingPageSize, pageSizeOptions } = paginationOptions ?? {};
|
|
16546
|
-
return /* @__PURE__ */ jsx75("div", { ...props, className:
|
|
16566
|
+
return /* @__PURE__ */ jsx75("div", { ...props, className: clsx27("flex-col-3", props.className), children: /* @__PURE__ */ jsxs44(TableWithSelectionProvider, { ...table, children: [
|
|
16547
16567
|
header,
|
|
16548
16568
|
/* @__PURE__ */ jsx75(TableDisplay, { ...displayProps, children }),
|
|
16549
16569
|
/* @__PURE__ */ jsx75(Visibility, { isVisible: showPagination, children: /* @__PURE__ */ jsx75(TablePagination, { allowChangingPageSize, pageSizeOptions }) }),
|
|
@@ -16552,7 +16572,7 @@ var TableWithSelection = ({
|
|
|
16552
16572
|
};
|
|
16553
16573
|
|
|
16554
16574
|
// src/components/layout/table/TableColumn.tsx
|
|
16555
|
-
import { memo as memo2, useEffect as
|
|
16575
|
+
import { memo as memo2, useEffect as useEffect34, useMemo as useMemo28, useState as useState31 } from "react";
|
|
16556
16576
|
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
16557
16577
|
var TableColumnComponent = ({
|
|
16558
16578
|
filterType,
|
|
@@ -16568,7 +16588,7 @@ var TableColumnComponent = ({
|
|
|
16568
16588
|
...props,
|
|
16569
16589
|
filterFn
|
|
16570
16590
|
});
|
|
16571
|
-
|
|
16591
|
+
useEffect34(() => {
|
|
16572
16592
|
const unsubscribe = registerColumn(column);
|
|
16573
16593
|
return () => {
|
|
16574
16594
|
unsubscribe();
|
|
@@ -16588,13 +16608,13 @@ var TableColumn = (props) => {
|
|
|
16588
16608
|
};
|
|
16589
16609
|
|
|
16590
16610
|
// src/components/layout/table/TableColumnSwitcher.tsx
|
|
16591
|
-
import { useMemo as useMemo29, useRef as
|
|
16611
|
+
import { useMemo as useMemo29, useRef as useRef31, useId as useId16 } from "react";
|
|
16592
16612
|
import { ChevronUp as ChevronUp3, ChevronDown as ChevronDown5, ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight5, Eye, EyeOff, Pin, PinOff, ArrowLeftRightIcon } from "lucide-react";
|
|
16593
16613
|
import { Fragment as Fragment10, jsx as jsx77, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
16594
16614
|
var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
16595
16615
|
const { table } = useTableStateWithoutSizingContext();
|
|
16596
16616
|
const translation = useHightideTranslation();
|
|
16597
|
-
const containerRef =
|
|
16617
|
+
const containerRef = useRef31(null);
|
|
16598
16618
|
const generatedId = useId16();
|
|
16599
16619
|
const ids = useMemo29(() => ({
|
|
16600
16620
|
popup: props.id ?? `table-column-picker-popup-${generatedId}`,
|
|
@@ -16862,7 +16882,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
16862
16882
|
|
|
16863
16883
|
// src/components/user-interaction/CopyToClipboardWrapper.tsx
|
|
16864
16884
|
import { useState as useState32 } from "react";
|
|
16865
|
-
import { clsx as
|
|
16885
|
+
import { clsx as clsx28 } from "clsx";
|
|
16866
16886
|
|
|
16867
16887
|
// src/utils/writeToClipboard.ts
|
|
16868
16888
|
var writeToClipboard = (text) => {
|
|
@@ -16901,7 +16921,7 @@ var CopyToClipboardWrapper = ({
|
|
|
16901
16921
|
"div",
|
|
16902
16922
|
{
|
|
16903
16923
|
ref: callbackRef,
|
|
16904
|
-
className:
|
|
16924
|
+
className: clsx28("w-fit hover:cursor-copy", containerClassName),
|
|
16905
16925
|
...disabled2 ? void 0 : props2,
|
|
16906
16926
|
onClick: () => {
|
|
16907
16927
|
if (disabled2) return;
|
|
@@ -16933,8 +16953,8 @@ var CopyToClipboardWrapper = ({
|
|
|
16933
16953
|
};
|
|
16934
16954
|
|
|
16935
16955
|
// src/components/user-interaction/Menu.tsx
|
|
16936
|
-
import { useCallback as
|
|
16937
|
-
import
|
|
16956
|
+
import { useCallback as useCallback29, useRef as useRef32, useState as useState33 } from "react";
|
|
16957
|
+
import clsx29 from "clsx";
|
|
16938
16958
|
import { Fragment as Fragment11, jsx as jsx79, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
16939
16959
|
var MenuItem = ({
|
|
16940
16960
|
children,
|
|
@@ -16944,7 +16964,7 @@ var MenuItem = ({
|
|
|
16944
16964
|
}) => /* @__PURE__ */ jsx79(
|
|
16945
16965
|
"div",
|
|
16946
16966
|
{
|
|
16947
|
-
className:
|
|
16967
|
+
className: clsx29("block px-3 py-1.5 first:rounded-t-md last:rounded-b-md text-sm font-semibold text-nowrap", {
|
|
16948
16968
|
"text-disabled cursor-not-allowed": isDisabled,
|
|
16949
16969
|
"text-menu-text hover:bg-primary/20": !isDisabled,
|
|
16950
16970
|
"cursor-pointer": !!onClick
|
|
@@ -16959,7 +16979,7 @@ var Menu = ({
|
|
|
16959
16979
|
disabled = false,
|
|
16960
16980
|
...props
|
|
16961
16981
|
}) => {
|
|
16962
|
-
const triggerRef =
|
|
16982
|
+
const triggerRef = useRef32(null);
|
|
16963
16983
|
const [isOpen, setIsOpen] = useState33(false);
|
|
16964
16984
|
const bag = {
|
|
16965
16985
|
isOpen,
|
|
@@ -16968,7 +16988,7 @@ var Menu = ({
|
|
|
16968
16988
|
disabled
|
|
16969
16989
|
};
|
|
16970
16990
|
return /* @__PURE__ */ jsxs47(Fragment11, { children: [
|
|
16971
|
-
trigger(bag,
|
|
16991
|
+
trigger(bag, useCallback29((el) => triggerRef.current = el, [])),
|
|
16972
16992
|
/* @__PURE__ */ jsx79(
|
|
16973
16993
|
PopUp,
|
|
16974
16994
|
{
|
|
@@ -16990,8 +17010,8 @@ var Menu = ({
|
|
|
16990
17010
|
};
|
|
16991
17011
|
|
|
16992
17012
|
// src/components/user-interaction/ScrollPicker.tsx
|
|
16993
|
-
import { useCallback as
|
|
16994
|
-
import
|
|
17013
|
+
import { useCallback as useCallback30, useEffect as useEffect35, useState as useState34 } from "react";
|
|
17014
|
+
import clsx30 from "clsx";
|
|
16995
17015
|
import { jsx as jsx80, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
16996
17016
|
var up = 1;
|
|
16997
17017
|
var down = -1;
|
|
@@ -17027,7 +17047,7 @@ var ScrollPicker = ({
|
|
|
17027
17047
|
const itemHeight = 40;
|
|
17028
17048
|
const distance = 8;
|
|
17029
17049
|
const containerHeight = itemHeight * (itemsShownCount - 2) + distance * (itemsShownCount - 2 + 1);
|
|
17030
|
-
const getDirection =
|
|
17050
|
+
const getDirection = useCallback30((targetIndex, currentIndex2, transition2, length) => {
|
|
17031
17051
|
if (targetIndex === currentIndex2) {
|
|
17032
17052
|
return transition2 > 0 ? up : down;
|
|
17033
17053
|
}
|
|
@@ -17037,7 +17057,7 @@ var ScrollPicker = ({
|
|
|
17037
17057
|
}
|
|
17038
17058
|
return distanceForward >= length / 2 ? down : up;
|
|
17039
17059
|
}, []);
|
|
17040
|
-
const animate =
|
|
17060
|
+
const animate = useCallback30((timestamp, startTime) => {
|
|
17041
17061
|
setAnimation((prevState) => {
|
|
17042
17062
|
const {
|
|
17043
17063
|
targetIndex,
|
|
@@ -17110,7 +17130,7 @@ var ScrollPicker = ({
|
|
|
17110
17130
|
};
|
|
17111
17131
|
});
|
|
17112
17132
|
}, [disabled, getDirection, onChange]);
|
|
17113
|
-
|
|
17133
|
+
useEffect35(() => {
|
|
17114
17134
|
requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp));
|
|
17115
17135
|
});
|
|
17116
17136
|
const opacity = (transition2, index, itemsCount) => {
|
|
@@ -17161,7 +17181,7 @@ var ScrollPicker = ({
|
|
|
17161
17181
|
children: shownItems.map(({ name, index }, arrayIndex) => /* @__PURE__ */ jsx80(
|
|
17162
17182
|
"div",
|
|
17163
17183
|
{
|
|
17164
|
-
className:
|
|
17184
|
+
className: clsx30(
|
|
17165
17185
|
`flex-col-2 items-center justify-center rounded-md`,
|
|
17166
17186
|
{
|
|
17167
17187
|
"text-primary font-bold": currentIndex === index,
|
|
@@ -17188,7 +17208,7 @@ var ScrollPicker = ({
|
|
|
17188
17208
|
};
|
|
17189
17209
|
|
|
17190
17210
|
// src/components/user-interaction/Switch.tsx
|
|
17191
|
-
import { useCallback as
|
|
17211
|
+
import { useCallback as useCallback31 } from "react";
|
|
17192
17212
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
17193
17213
|
var Switch = ({
|
|
17194
17214
|
value: controlledValue,
|
|
@@ -17203,7 +17223,7 @@ var Switch = ({
|
|
|
17203
17223
|
}) => {
|
|
17204
17224
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
17205
17225
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
17206
|
-
const onChangeWrapper =
|
|
17226
|
+
const onChangeWrapper = useCallback31((value2) => {
|
|
17207
17227
|
onValueChangeStable(!value2);
|
|
17208
17228
|
onEditCompleteStable(!value2);
|
|
17209
17229
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -17243,8 +17263,8 @@ var Switch = ({
|
|
|
17243
17263
|
};
|
|
17244
17264
|
|
|
17245
17265
|
// src/components/user-interaction/Textarea.tsx
|
|
17246
|
-
import { forwardRef as forwardRef19, useCallback as
|
|
17247
|
-
import
|
|
17266
|
+
import { forwardRef as forwardRef19, useCallback as useCallback32, useId as useId17 } from "react";
|
|
17267
|
+
import clsx31 from "clsx";
|
|
17248
17268
|
import { jsx as jsx82, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
17249
17269
|
var Textarea = forwardRef19(function Textarea2({
|
|
17250
17270
|
value: controlledValue,
|
|
@@ -17262,7 +17282,7 @@ var Textarea = forwardRef19(function Textarea2({
|
|
|
17262
17282
|
});
|
|
17263
17283
|
const { restartTimer, clearTimer } = useDelay(saveDelayOptions);
|
|
17264
17284
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
17265
|
-
const onEditCompleteWrapper =
|
|
17285
|
+
const onEditCompleteWrapper = useCallback32((text) => {
|
|
17266
17286
|
onEditCompleteStable(text);
|
|
17267
17287
|
clearTimer();
|
|
17268
17288
|
}, [onEditCompleteStable, clearTimer]);
|
|
@@ -17305,7 +17325,7 @@ var TextareaWithHeadline = ({
|
|
|
17305
17325
|
return /* @__PURE__ */ jsxs49(
|
|
17306
17326
|
"div",
|
|
17307
17327
|
{
|
|
17308
|
-
className:
|
|
17328
|
+
className: clsx31(
|
|
17309
17329
|
"group flex-col-3 border-2 rounded-lg",
|
|
17310
17330
|
{
|
|
17311
17331
|
"bg-input-background text-input-text hover:border-primary focus-within:border-primary": !disabled,
|
|
@@ -17314,13 +17334,13 @@ var TextareaWithHeadline = ({
|
|
|
17314
17334
|
containerClassName
|
|
17315
17335
|
),
|
|
17316
17336
|
children: [
|
|
17317
|
-
headline && /* @__PURE__ */ jsx82("label", { ...headlineProps, htmlFor: usedId, className:
|
|
17337
|
+
headline && /* @__PURE__ */ jsx82("label", { ...headlineProps, htmlFor: usedId, className: clsx31("typography-lable-md text-label", headlineProps.className), children: headline }),
|
|
17318
17338
|
/* @__PURE__ */ jsx82(
|
|
17319
17339
|
Textarea,
|
|
17320
17340
|
{
|
|
17321
17341
|
...props,
|
|
17322
17342
|
id: usedId,
|
|
17323
|
-
className:
|
|
17343
|
+
className: clsx31(
|
|
17324
17344
|
"border-transparent focus:ring-0 focus-visible:ring-0 resize-none h-32",
|
|
17325
17345
|
className
|
|
17326
17346
|
)
|
|
@@ -17375,7 +17395,7 @@ var TimeDisplay = ({
|
|
|
17375
17395
|
// src/components/user-interaction/input/InsideLabelInput.tsx
|
|
17376
17396
|
import { useId as useId18 } from "react";
|
|
17377
17397
|
import { forwardRef as forwardRef20, useState as useState35 } from "react";
|
|
17378
|
-
import
|
|
17398
|
+
import clsx32 from "clsx";
|
|
17379
17399
|
import { jsx as jsx84, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
17380
17400
|
var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
17381
17401
|
id: customId,
|
|
@@ -17393,7 +17413,7 @@ var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
|
17393
17413
|
const [isFocused, setIsFocused] = useState35(false);
|
|
17394
17414
|
const generatedId = useId18();
|
|
17395
17415
|
const id = customId ?? generatedId;
|
|
17396
|
-
return /* @__PURE__ */ jsxs50("div", { className:
|
|
17416
|
+
return /* @__PURE__ */ jsxs50("div", { className: clsx32("relative"), children: [
|
|
17397
17417
|
/* @__PURE__ */ jsx84(
|
|
17398
17418
|
Input,
|
|
17399
17419
|
{
|
|
@@ -17411,7 +17431,7 @@ var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
|
17411
17431
|
setIsFocused(false);
|
|
17412
17432
|
},
|
|
17413
17433
|
"aria-labelledby": id + "-label",
|
|
17414
|
-
className:
|
|
17434
|
+
className: clsx32("h-14 px-4 pb-2 py-6.5", props.className)
|
|
17415
17435
|
}
|
|
17416
17436
|
),
|
|
17417
17437
|
/* @__PURE__ */ jsx84(
|
|
@@ -17420,7 +17440,7 @@ var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
|
17420
17440
|
id: id + "-label",
|
|
17421
17441
|
"aria-hidden": true,
|
|
17422
17442
|
"data-display": isFocused || !!value ? "small" : "full",
|
|
17423
|
-
className:
|
|
17443
|
+
className: clsx32(
|
|
17424
17444
|
// margin left to account for the border which is ignored for absolute positions
|
|
17425
17445
|
"absolute left-4 ml-0.5 top-2 transition-all delay-25 pointer-events-none touch-none",
|
|
17426
17446
|
"data-[display=small]:top-2 data-[display=small]:h-force-4.5 data-[display=small]:typography-caption-sm data-[display=small]:overflow-y-hidden",
|
|
@@ -17434,7 +17454,7 @@ var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
|
17434
17454
|
|
|
17435
17455
|
// src/components/user-interaction/input/SearchBar.tsx
|
|
17436
17456
|
import { Search } from "lucide-react";
|
|
17437
|
-
import { clsx as
|
|
17457
|
+
import { clsx as clsx33 } from "clsx";
|
|
17438
17458
|
import { jsx as jsx85, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
17439
17459
|
var SearchBar = ({
|
|
17440
17460
|
value: controlledValue,
|
|
@@ -17451,7 +17471,7 @@ var SearchBar = ({
|
|
|
17451
17471
|
onValueChange,
|
|
17452
17472
|
defaultValue: initialValue
|
|
17453
17473
|
});
|
|
17454
|
-
return /* @__PURE__ */ jsxs51("div", { ...containerProps, className:
|
|
17474
|
+
return /* @__PURE__ */ jsxs51("div", { ...containerProps, className: clsx33("relative", containerProps?.className), children: [
|
|
17455
17475
|
/* @__PURE__ */ jsx85(
|
|
17456
17476
|
Input,
|
|
17457
17477
|
{
|
|
@@ -17460,7 +17480,7 @@ var SearchBar = ({
|
|
|
17460
17480
|
onValueChange: setValue,
|
|
17461
17481
|
onEditComplete: onSearch,
|
|
17462
17482
|
placeholder: inputProps.placeholder ?? translation("search"),
|
|
17463
|
-
className:
|
|
17483
|
+
className: clsx33("pr-10 w-full", inputProps.className)
|
|
17464
17484
|
}
|
|
17465
17485
|
),
|
|
17466
17486
|
/* @__PURE__ */ jsx85(
|
|
@@ -17472,7 +17492,7 @@ var SearchBar = ({
|
|
|
17472
17492
|
color: "neutral",
|
|
17473
17493
|
coloringStyle: "text",
|
|
17474
17494
|
onClick: () => onSearch(value),
|
|
17475
|
-
className:
|
|
17495
|
+
className: clsx33("absolute right-1.5 top-1/2 -translate-y-1/2", searchButtonProps?.className),
|
|
17476
17496
|
children: /* @__PURE__ */ jsx85(Search, { className: "w-full h-full" })
|
|
17477
17497
|
}
|
|
17478
17498
|
)
|
|
@@ -17480,9 +17500,9 @@ var SearchBar = ({
|
|
|
17480
17500
|
};
|
|
17481
17501
|
|
|
17482
17502
|
// src/components/user-interaction/input/ToggleableInput.tsx
|
|
17483
|
-
import { forwardRef as forwardRef21, useEffect as
|
|
17503
|
+
import { forwardRef as forwardRef21, useEffect as useEffect36, useImperativeHandle as useImperativeHandle12, useRef as useRef33, useState as useState36 } from "react";
|
|
17484
17504
|
import { Pencil } from "lucide-react";
|
|
17485
|
-
import
|
|
17505
|
+
import clsx34 from "clsx";
|
|
17486
17506
|
import { jsx as jsx86, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
17487
17507
|
var ToggleableInput = forwardRef21(function ToggleableInput2({
|
|
17488
17508
|
value: controlledValue,
|
|
@@ -17498,14 +17518,14 @@ var ToggleableInput = forwardRef21(function ToggleableInput2({
|
|
|
17498
17518
|
defaultValue: initialValue
|
|
17499
17519
|
});
|
|
17500
17520
|
const [isEditing, setIsEditing] = useState36(initialState !== "display");
|
|
17501
|
-
const innerRef =
|
|
17521
|
+
const innerRef = useRef33(null);
|
|
17502
17522
|
useImperativeHandle12(forwardedRef, () => innerRef.current);
|
|
17503
|
-
|
|
17523
|
+
useEffect36(() => {
|
|
17504
17524
|
if (isEditing) {
|
|
17505
17525
|
innerRef.current?.focus();
|
|
17506
17526
|
}
|
|
17507
17527
|
}, [isEditing]);
|
|
17508
|
-
return /* @__PURE__ */ jsxs52("div", { className:
|
|
17528
|
+
return /* @__PURE__ */ jsxs52("div", { className: clsx34("relative flex-row-2", { "flex-1": isEditing }), children: [
|
|
17509
17529
|
/* @__PURE__ */ jsx86(
|
|
17510
17530
|
Input,
|
|
17511
17531
|
{
|
|
@@ -17531,8 +17551,8 @@ var ToggleableInput = forwardRef21(function ToggleableInput2({
|
|
|
17531
17551
|
}
|
|
17532
17552
|
),
|
|
17533
17553
|
!isEditing && /* @__PURE__ */ jsxs52("div", { className: "absolute left-0 flex-row-2 items-center pointer-events-none touch-none w-full overflow-hidden", children: [
|
|
17534
|
-
/* @__PURE__ */ jsx86("span", { className:
|
|
17535
|
-
/* @__PURE__ */ jsx86(Pencil, { className:
|
|
17554
|
+
/* @__PURE__ */ jsx86("span", { className: clsx34(" truncate"), children: value }),
|
|
17555
|
+
/* @__PURE__ */ jsx86(Pencil, { className: clsx34(`size-force-4`, { "text-transparent": isEditing }) })
|
|
17536
17556
|
] })
|
|
17537
17557
|
] });
|
|
17538
17558
|
});
|
|
@@ -17541,7 +17561,7 @@ var ToggleableInput = forwardRef21(function ToggleableInput2({
|
|
|
17541
17561
|
import { Check as Check3 } from "lucide-react";
|
|
17542
17562
|
|
|
17543
17563
|
// src/components/user-interaction/properties/PropertyBase.tsx
|
|
17544
|
-
import
|
|
17564
|
+
import clsx35 from "clsx";
|
|
17545
17565
|
import { AlertTriangle, Trash, X as X3 } from "lucide-react";
|
|
17546
17566
|
import { jsx as jsx87, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
17547
17567
|
var PropertyBase = ({
|
|
@@ -17565,7 +17585,7 @@ var PropertyBase = ({
|
|
|
17565
17585
|
return /* @__PURE__ */ jsxs53(
|
|
17566
17586
|
"div",
|
|
17567
17587
|
{
|
|
17568
|
-
className:
|
|
17588
|
+
className: clsx35("group/property", className),
|
|
17569
17589
|
"data-name": "property-root",
|
|
17570
17590
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
17571
17591
|
children: [
|
|
@@ -17710,7 +17730,7 @@ var DateProperty = ({
|
|
|
17710
17730
|
import { List } from "lucide-react";
|
|
17711
17731
|
|
|
17712
17732
|
// src/components/user-interaction/select/MultiSelectChipDisplay.tsx
|
|
17713
|
-
import { forwardRef as forwardRef22, useEffect as
|
|
17733
|
+
import { forwardRef as forwardRef22, useEffect as useEffect37, useImperativeHandle as useImperativeHandle13, useRef as useRef34 } from "react";
|
|
17714
17734
|
import { XIcon as XIcon2, Plus } from "lucide-react";
|
|
17715
17735
|
import { jsx as jsx90, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
17716
17736
|
var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayButton2({
|
|
@@ -17720,7 +17740,7 @@ var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayB
|
|
|
17720
17740
|
const translation = useHightideTranslation();
|
|
17721
17741
|
const { state, trigger, item, ids, setIds } = useSelectContext();
|
|
17722
17742
|
const { register, unregister, toggleOpen } = trigger;
|
|
17723
|
-
|
|
17743
|
+
useEffect37(() => {
|
|
17724
17744
|
if (id) {
|
|
17725
17745
|
setIds((prev) => ({
|
|
17726
17746
|
...prev,
|
|
@@ -17728,9 +17748,9 @@ var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayB
|
|
|
17728
17748
|
}));
|
|
17729
17749
|
}
|
|
17730
17750
|
}, [id, setIds]);
|
|
17731
|
-
const innerRef =
|
|
17751
|
+
const innerRef = useRef34(null);
|
|
17732
17752
|
useImperativeHandle13(ref, () => innerRef.current);
|
|
17733
|
-
|
|
17753
|
+
useEffect37(() => {
|
|
17734
17754
|
register(innerRef);
|
|
17735
17755
|
return () => unregister();
|
|
17736
17756
|
}, [register, unregister]);
|
|
@@ -18016,7 +18036,7 @@ var TextProperty = ({
|
|
|
18016
18036
|
};
|
|
18017
18037
|
|
|
18018
18038
|
// src/components/utils/Transition.tsx
|
|
18019
|
-
import { useEffect as
|
|
18039
|
+
import { useEffect as useEffect38, useState as useState37 } from "react";
|
|
18020
18040
|
function Transition({
|
|
18021
18041
|
children,
|
|
18022
18042
|
show,
|
|
@@ -18025,7 +18045,7 @@ function Transition({
|
|
|
18025
18045
|
const [isOpen, setIsOpen] = useState37(show);
|
|
18026
18046
|
const [isTransitioning, setIsTransitioning] = useState37(!isOpen);
|
|
18027
18047
|
const isUsingReducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : true;
|
|
18028
|
-
|
|
18048
|
+
useEffect38(() => {
|
|
18029
18049
|
setIsOpen(show);
|
|
18030
18050
|
setIsTransitioning(true);
|
|
18031
18051
|
}, [show]);
|
|
@@ -18061,7 +18081,7 @@ var HightideProvider = ({
|
|
|
18061
18081
|
};
|
|
18062
18082
|
|
|
18063
18083
|
// src/hooks/focus/useFocusGuards.ts
|
|
18064
|
-
import { useEffect as
|
|
18084
|
+
import { useEffect as useEffect39 } from "react";
|
|
18065
18085
|
var selectorName = "data-hw-focus-guard";
|
|
18066
18086
|
function FocusGuard() {
|
|
18067
18087
|
const element = document.createElement("div");
|
|
@@ -18099,7 +18119,7 @@ var FocusGuardsService = class _FocusGuardsService {
|
|
|
18099
18119
|
}
|
|
18100
18120
|
};
|
|
18101
18121
|
var useFocusGuards = () => {
|
|
18102
|
-
|
|
18122
|
+
useEffect39(() => {
|
|
18103
18123
|
FocusGuardsService.getInstance().add();
|
|
18104
18124
|
return () => {
|
|
18105
18125
|
FocusGuardsService.getInstance().remove();
|
|
@@ -18108,10 +18128,10 @@ var useFocusGuards = () => {
|
|
|
18108
18128
|
};
|
|
18109
18129
|
|
|
18110
18130
|
// src/hooks/focus/useFocusOnceVisible.ts
|
|
18111
|
-
import React6, { useEffect as
|
|
18131
|
+
import React6, { useEffect as useEffect40 } from "react";
|
|
18112
18132
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
18113
18133
|
const [hasUsedFocus, setHasUsedFocus] = React6.useState(false);
|
|
18114
|
-
|
|
18134
|
+
useEffect40(() => {
|
|
18115
18135
|
if (disable || hasUsedFocus) {
|
|
18116
18136
|
return;
|
|
18117
18137
|
}
|
|
@@ -18131,9 +18151,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
18131
18151
|
};
|
|
18132
18152
|
|
|
18133
18153
|
// src/hooks/focus/useIsMounted.ts
|
|
18134
|
-
import { useEffect as
|
|
18154
|
+
import { useEffect as useEffect41, useLayoutEffect as useLayoutEffect7, useState as useState38 } from "react";
|
|
18135
18155
|
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
18136
|
-
var useIsomorphicEffect = isClient ? useLayoutEffect7 :
|
|
18156
|
+
var useIsomorphicEffect = isClient ? useLayoutEffect7 : useEffect41;
|
|
18137
18157
|
var useIsMounted = () => {
|
|
18138
18158
|
const [isMounted, setIsMounted] = useState38(false);
|
|
18139
18159
|
useIsomorphicEffect(() => {
|
|
@@ -18146,10 +18166,10 @@ var useIsMounted = () => {
|
|
|
18146
18166
|
};
|
|
18147
18167
|
|
|
18148
18168
|
// src/hooks/useHandleRefs.ts
|
|
18149
|
-
import { useEffect as
|
|
18169
|
+
import { useEffect as useEffect42, useRef as useRef35 } from "react";
|
|
18150
18170
|
function useHandleRefs(handleRef) {
|
|
18151
|
-
const refs =
|
|
18152
|
-
|
|
18171
|
+
const refs = useRef35([]);
|
|
18172
|
+
useEffect42(() => {
|
|
18153
18173
|
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
18154
18174
|
() => ({ current: null })
|
|
18155
18175
|
);
|
|
@@ -18187,10 +18207,10 @@ function useLogUnstableDependencies(name, value) {
|
|
|
18187
18207
|
}
|
|
18188
18208
|
|
|
18189
18209
|
// src/hooks/useOverwritableState.ts
|
|
18190
|
-
import { useEffect as
|
|
18210
|
+
import { useEffect as useEffect43, useState as useState39 } from "react";
|
|
18191
18211
|
var useOverwritableState = (overwriteValue, onChange) => {
|
|
18192
18212
|
const [state, setState] = useState39(overwriteValue);
|
|
18193
|
-
|
|
18213
|
+
useEffect43(() => {
|
|
18194
18214
|
setState(overwriteValue);
|
|
18195
18215
|
}, [overwriteValue]);
|
|
18196
18216
|
const onChangeWrapper = (action) => {
|
|
@@ -18208,7 +18228,7 @@ var useRerender = () => {
|
|
|
18208
18228
|
};
|
|
18209
18229
|
|
|
18210
18230
|
// src/hooks/useSearch.ts
|
|
18211
|
-
import { useCallback as
|
|
18231
|
+
import { useCallback as useCallback33, useEffect as useEffect44, useMemo as useMemo30, useState as useState40 } from "react";
|
|
18212
18232
|
|
|
18213
18233
|
// src/utils/simpleSearch.ts
|
|
18214
18234
|
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
@@ -18250,14 +18270,14 @@ var useSearch = ({
|
|
|
18250
18270
|
const [search, setSearch] = useState40(initialSearch ?? "");
|
|
18251
18271
|
const [result, setResult] = useState40(list);
|
|
18252
18272
|
const searchTags = useMemo30(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
18253
|
-
const updateSearch =
|
|
18273
|
+
const updateSearch = useCallback33((newSearch) => {
|
|
18254
18274
|
const usedSearch = newSearch ?? search;
|
|
18255
18275
|
if (newSearch) {
|
|
18256
18276
|
setSearch(search);
|
|
18257
18277
|
}
|
|
18258
18278
|
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
18259
18279
|
}, [searchTags, list, search, searchMapping]);
|
|
18260
|
-
|
|
18280
|
+
useEffect44(() => {
|
|
18261
18281
|
if (isSearchInstant) {
|
|
18262
18282
|
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
18263
18283
|
}
|
|
@@ -18290,6 +18310,53 @@ var useSearch = ({
|
|
|
18290
18310
|
};
|
|
18291
18311
|
};
|
|
18292
18312
|
|
|
18313
|
+
// src/hooks/useUpdatingDateStrings.ts
|
|
18314
|
+
import { useEffect as useEffect45, useState as useState41 } from "react";
|
|
18315
|
+
var useUpdatingDateTime = ({ absoluteFormat, localeOverride, date }) => {
|
|
18316
|
+
const { locale: contextLocale } = useLocale();
|
|
18317
|
+
const locale = localeOverride ?? contextLocale;
|
|
18318
|
+
const [dateAndTimeStrings, setDateAndTimeStrings] = useState41({
|
|
18319
|
+
compareDate: date,
|
|
18320
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
18321
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
18322
|
+
});
|
|
18323
|
+
useEffect45(() => {
|
|
18324
|
+
setDateAndTimeStrings({
|
|
18325
|
+
compareDate: date,
|
|
18326
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
18327
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
18328
|
+
});
|
|
18329
|
+
}, [date, absoluteFormat, locale]);
|
|
18330
|
+
useEffect45(() => {
|
|
18331
|
+
let timeoutId;
|
|
18332
|
+
const startTimer = () => {
|
|
18333
|
+
const now = /* @__PURE__ */ new Date();
|
|
18334
|
+
const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
|
|
18335
|
+
let delayInSeconds;
|
|
18336
|
+
if (diff < DateUtils.timesInSeconds.minute) {
|
|
18337
|
+
delayInSeconds = DateUtils.timesInSeconds.second;
|
|
18338
|
+
} else if (diff < DateUtils.timesInSeconds.hour) {
|
|
18339
|
+
delayInSeconds = DateUtils.timesInSeconds.minute;
|
|
18340
|
+
} else {
|
|
18341
|
+
delayInSeconds = DateUtils.timesInSeconds.hour;
|
|
18342
|
+
}
|
|
18343
|
+
timeoutId = setInterval(() => {
|
|
18344
|
+
setDateAndTimeStrings({
|
|
18345
|
+
compareDate: date,
|
|
18346
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
18347
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
18348
|
+
});
|
|
18349
|
+
}, delayInSeconds * 1e3 / 2);
|
|
18350
|
+
};
|
|
18351
|
+
startTimer();
|
|
18352
|
+
return () => clearInterval(timeoutId);
|
|
18353
|
+
}, [absoluteFormat, date, locale]);
|
|
18354
|
+
return {
|
|
18355
|
+
absolute: dateAndTimeStrings.absolute,
|
|
18356
|
+
relative: dateAndTimeStrings.relative
|
|
18357
|
+
};
|
|
18358
|
+
};
|
|
18359
|
+
|
|
18293
18360
|
// src/utils/emailValidation.ts
|
|
18294
18361
|
var validateEmail = (email) => {
|
|
18295
18362
|
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
@@ -18784,9 +18851,7 @@ export {
|
|
|
18784
18851
|
VerticalDivider,
|
|
18785
18852
|
Visibility,
|
|
18786
18853
|
YearMonthPicker,
|
|
18787
|
-
addDuration,
|
|
18788
18854
|
builder,
|
|
18789
|
-
changeDuration,
|
|
18790
18855
|
closestMatch,
|
|
18791
18856
|
createLoopingList,
|
|
18792
18857
|
createLoopingListWithIndex,
|
|
@@ -18799,21 +18864,15 @@ export {
|
|
|
18799
18864
|
filterTags,
|
|
18800
18865
|
filterTagsSingle,
|
|
18801
18866
|
filterText,
|
|
18802
|
-
formatDate,
|
|
18803
|
-
formatDateTime,
|
|
18804
|
-
getBetweenDuration,
|
|
18805
18867
|
getNeighbours,
|
|
18806
|
-
getWeeksForCalenderMonth,
|
|
18807
18868
|
hightideTranslation,
|
|
18808
18869
|
hightideTranslationLocales,
|
|
18809
|
-
isInTimeSpan,
|
|
18810
18870
|
isTableFilterCategory,
|
|
18811
18871
|
match,
|
|
18812
18872
|
mergeProps,
|
|
18813
18873
|
noop,
|
|
18814
18874
|
range,
|
|
18815
18875
|
resolveSetState,
|
|
18816
|
-
subtractDuration,
|
|
18817
18876
|
toSizeVars,
|
|
18818
18877
|
useAnchoredPosition,
|
|
18819
18878
|
useControlledState,
|
|
@@ -18859,6 +18918,7 @@ export {
|
|
|
18859
18918
|
useTooltip,
|
|
18860
18919
|
useTransitionState,
|
|
18861
18920
|
useTranslatedValidators,
|
|
18921
|
+
useUpdatingDateTime,
|
|
18862
18922
|
useWindowResizeObserver,
|
|
18863
18923
|
validateEmail,
|
|
18864
18924
|
writeToClipboard
|