@helpwave/hightide 0.8.7 → 0.8.8
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 +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +6730 -6719
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1284 -1273
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10148,7 +10148,7 @@ var useControlledState = ({
|
|
|
10148
10148
|
onValueChangeStable(resolved);
|
|
10149
10149
|
}, [onValueChangeStable, isControlled]);
|
|
10150
10150
|
const value = isControlled ? controlledValue : internalValue;
|
|
10151
|
-
return [value, setState];
|
|
10151
|
+
return [value, setState, isControlled];
|
|
10152
10152
|
};
|
|
10153
10153
|
|
|
10154
10154
|
// src/components/layout/Expandable.tsx
|
|
@@ -10889,8 +10889,8 @@ var MarkdownInterpreter = ({ text, className }) => {
|
|
|
10889
10889
|
};
|
|
10890
10890
|
|
|
10891
10891
|
// src/components/layout/TabSwitcher.tsx
|
|
10892
|
-
import { useCallback as
|
|
10893
|
-
import { createContext as createContext8, useContext as useContext8, useEffect as
|
|
10892
|
+
import { useCallback as useCallback17, useId as useId7, useState as useState22 } from "react";
|
|
10893
|
+
import { createContext as createContext8, useContext as useContext8, useEffect as useEffect27, useRef as useRef17 } from "react";
|
|
10894
10894
|
import clsx7 from "clsx";
|
|
10895
10895
|
|
|
10896
10896
|
// src/utils/propsUtil.ts
|
|
@@ -11027,310 +11027,136 @@ var PropsUtil = {
|
|
|
11027
11027
|
|
|
11028
11028
|
// src/components/layout/TabSwitcher.tsx
|
|
11029
11029
|
import { createPortal as createPortal2 } from "react-dom";
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11030
|
+
|
|
11031
|
+
// src/hooks/focus/useFocusGuards.ts
|
|
11032
|
+
import { useEffect as useEffect16 } from "react";
|
|
11033
|
+
var selectorName = "data-hw-focus-guard";
|
|
11034
|
+
function FocusGuard() {
|
|
11035
|
+
const element = document.createElement("div");
|
|
11036
|
+
element.setAttribute(selectorName, "");
|
|
11037
|
+
element.tabIndex = 0;
|
|
11038
|
+
element.style.border = "none";
|
|
11039
|
+
element.style.outline = "none";
|
|
11040
|
+
element.style.boxShadow = "none";
|
|
11041
|
+
element.style.opacity = "0";
|
|
11042
|
+
element.style.position = "fixed";
|
|
11043
|
+
element.style.pointerEvents = "none";
|
|
11044
|
+
return element;
|
|
11040
11045
|
}
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
const currentIndex = sortedInfos.findIndex((t) => t.id === currentActiveId);
|
|
11045
|
-
const startIndex = currentIndex >= 0 ? (currentIndex + 1) % sortedInfos.length : 0;
|
|
11046
|
-
for (let i = 0; i < sortedInfos.length; i++) {
|
|
11047
|
-
const idx = (startIndex + i) % sortedInfos.length;
|
|
11048
|
-
if (!sortedInfos[idx].disabled) return sortedInfos[idx].id;
|
|
11046
|
+
var FocusGuardsService = class _FocusGuardsService {
|
|
11047
|
+
constructor() {
|
|
11048
|
+
this.count = 0;
|
|
11049
11049
|
}
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
}
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
return { activeId, infos: ordered };
|
|
11073
|
-
});
|
|
11050
|
+
static getInstance() {
|
|
11051
|
+
if (!_FocusGuardsService.instance) {
|
|
11052
|
+
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
11053
|
+
}
|
|
11054
|
+
return _FocusGuardsService.instance;
|
|
11055
|
+
}
|
|
11056
|
+
add() {
|
|
11057
|
+
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
11058
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
11059
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
11060
|
+
this.count++;
|
|
11061
|
+
}
|
|
11062
|
+
remove() {
|
|
11063
|
+
if (this.count === 1) {
|
|
11064
|
+
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
11065
|
+
}
|
|
11066
|
+
this.count--;
|
|
11067
|
+
}
|
|
11068
|
+
};
|
|
11069
|
+
var useFocusGuards = () => {
|
|
11070
|
+
useEffect16(() => {
|
|
11071
|
+
FocusGuardsService.getInstance().add();
|
|
11074
11072
|
return () => {
|
|
11075
|
-
|
|
11076
|
-
const infos = prevState.infos.filter((t) => t.id !== id);
|
|
11077
|
-
const activeTab = prevState.activeId !== null ? infos.find((t) => t.id === prevState.activeId) : null;
|
|
11078
|
-
const activeIsUnregisteredOrDisabled = prevState.activeId === id || activeTab?.disabled === true;
|
|
11079
|
-
const nextId = prevState.activeId === id ? getNextEnabledIdInOrder(prevState.infos, id) : getNextEnabledIdInOrder(infos, prevState.activeId);
|
|
11080
|
-
const activeId = activeIsUnregisteredOrDisabled ? nextId : prevState.activeId;
|
|
11081
|
-
return { activeId, infos };
|
|
11082
|
-
});
|
|
11073
|
+
FocusGuardsService.getInstance().remove();
|
|
11083
11074
|
};
|
|
11084
11075
|
}, []);
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11076
|
+
};
|
|
11077
|
+
|
|
11078
|
+
// src/hooks/focus/useFocusManagement.ts
|
|
11079
|
+
import { useCallback as useCallback13 } from "react";
|
|
11080
|
+
function useFocusManagement() {
|
|
11081
|
+
const getFocusableElements = useCallback13(() => {
|
|
11082
|
+
return Array.from(
|
|
11083
|
+
document.querySelectorAll(
|
|
11084
|
+
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
11085
|
+
)
|
|
11086
|
+
).filter(
|
|
11087
|
+
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
11088
|
+
);
|
|
11090
11089
|
}, []);
|
|
11091
|
-
|
|
11092
|
-
|
|
11093
|
-
{
|
|
11094
|
-
|
|
11095
|
-
tabs: {
|
|
11096
|
-
activeId: state.activeId,
|
|
11097
|
-
setActiveId,
|
|
11098
|
-
subscribe,
|
|
11099
|
-
info: state.infos
|
|
11100
|
-
},
|
|
11101
|
-
portal: {
|
|
11102
|
-
id: portalState?.id ?? null,
|
|
11103
|
-
element: portalState?.ref.current ?? null,
|
|
11104
|
-
setPortal: registerPortal
|
|
11105
|
-
}
|
|
11106
|
-
},
|
|
11107
|
-
children
|
|
11090
|
+
const getNextFocusElement = useCallback13(() => {
|
|
11091
|
+
const elements = getFocusableElements();
|
|
11092
|
+
if (elements.length === 0) {
|
|
11093
|
+
return void 0;
|
|
11108
11094
|
}
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
const { info, activeId, setActiveId: setActive } = tabs;
|
|
11114
|
-
const refs = useRef14({});
|
|
11115
|
-
const onKeyDown = (e) => {
|
|
11116
|
-
const idx = info.findIndex((tab) => tab.id === activeId);
|
|
11117
|
-
if (idx === -1) return;
|
|
11118
|
-
const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
11119
|
-
if (step === 0) return;
|
|
11120
|
-
let nextIdx = idx;
|
|
11121
|
-
for (let i = 0; i < info.length; i++) {
|
|
11122
|
-
nextIdx = (nextIdx + step + info.length) % info.length;
|
|
11123
|
-
if (!info[nextIdx].disabled) break;
|
|
11095
|
+
let nextElement = elements[0];
|
|
11096
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
11097
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
11098
|
+
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
11124
11099
|
}
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
onKeyDown,
|
|
11136
|
-
role: "tablist",
|
|
11137
|
-
"aria-orientation": "horizontal",
|
|
11138
|
-
style: { "--tab-count": info.length, ...props.style },
|
|
11139
|
-
children: info.map((tabInfo) => {
|
|
11140
|
-
const isDisabled = !!tabInfo.disabled;
|
|
11141
|
-
const isActive = activeId === tabInfo.id;
|
|
11142
|
-
return /* @__PURE__ */ jsx25(
|
|
11143
|
-
"li",
|
|
11144
|
-
{
|
|
11145
|
-
ref: (el) => {
|
|
11146
|
-
refs.current[tabInfo.id] = el;
|
|
11147
|
-
},
|
|
11148
|
-
id: tabInfo.labelId,
|
|
11149
|
-
...isDisabled ? {} : PropsUtil.aria.click(() => setActive(tabInfo.id)),
|
|
11150
|
-
"data-name": "tab-list-item",
|
|
11151
|
-
"data-active": PropsUtil.dataAttributes.bool(isActive),
|
|
11152
|
-
"data-disabled": PropsUtil.dataAttributes.bool(isDisabled),
|
|
11153
|
-
role: "tab",
|
|
11154
|
-
"aria-selected": isActive,
|
|
11155
|
-
"aria-disabled": isDisabled,
|
|
11156
|
-
"aria-controls": activeId,
|
|
11157
|
-
tabIndex: isActive && !isDisabled ? 0 : -1,
|
|
11158
|
-
children: tabInfo.label
|
|
11159
|
-
},
|
|
11160
|
-
tabInfo.id
|
|
11161
|
-
);
|
|
11162
|
-
})
|
|
11100
|
+
return nextElement;
|
|
11101
|
+
}, [getFocusableElements]);
|
|
11102
|
+
const focusNext = useCallback13(() => {
|
|
11103
|
+
const nextElement = getNextFocusElement();
|
|
11104
|
+
nextElement?.focus();
|
|
11105
|
+
}, [getNextFocusElement]);
|
|
11106
|
+
const getPreviousFocusElement = useCallback13(() => {
|
|
11107
|
+
const elements = getFocusableElements();
|
|
11108
|
+
if (elements.length === 0) {
|
|
11109
|
+
return void 0;
|
|
11163
11110
|
}
|
|
11164
|
-
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
useEffect16(() => {
|
|
11173
|
-
setPortal({ id, ref });
|
|
11174
|
-
return () => setPortal(null);
|
|
11175
|
-
}, [id, setPortal]);
|
|
11176
|
-
return /* @__PURE__ */ jsx25(
|
|
11177
|
-
"div",
|
|
11178
|
-
{
|
|
11179
|
-
...props,
|
|
11180
|
-
ref,
|
|
11181
|
-
id,
|
|
11182
|
-
className: clsx7("tab-view", props.className)
|
|
11111
|
+
let previousElement = elements[0];
|
|
11112
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
11113
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
11114
|
+
if (currentIndex === 0) {
|
|
11115
|
+
previousElement = elements[elements.length - 1];
|
|
11116
|
+
} else {
|
|
11117
|
+
previousElement = elements[currentIndex - 1];
|
|
11118
|
+
}
|
|
11183
11119
|
}
|
|
11184
|
-
|
|
11120
|
+
return previousElement;
|
|
11121
|
+
}, [getFocusableElements]);
|
|
11122
|
+
const focusPrevious = useCallback13(() => {
|
|
11123
|
+
const previousElement = getPreviousFocusElement();
|
|
11124
|
+
if (previousElement) previousElement.focus();
|
|
11125
|
+
}, [getPreviousFocusElement]);
|
|
11126
|
+
return {
|
|
11127
|
+
getFocusableElements,
|
|
11128
|
+
getNextFocusElement,
|
|
11129
|
+
getPreviousFocusElement,
|
|
11130
|
+
focusNext,
|
|
11131
|
+
focusPrevious
|
|
11132
|
+
};
|
|
11185
11133
|
}
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
const
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
return subscribe({ id, label, labelId, disabled, ref });
|
|
11195
|
-
}, [id, label, labelId, disabled, subscribe]);
|
|
11196
|
-
const isActive = activeId === id;
|
|
11197
|
-
const content = /* @__PURE__ */ jsx25(
|
|
11198
|
-
"div",
|
|
11199
|
-
{
|
|
11200
|
-
...props,
|
|
11201
|
-
ref,
|
|
11202
|
-
id,
|
|
11203
|
-
hidden: !isActive,
|
|
11204
|
-
"data-name": props["data-name"] ?? "tab-panel",
|
|
11205
|
-
"data-disabled": PropsUtil.dataAttributes.bool(disabled),
|
|
11206
|
-
role: "tabpanel",
|
|
11207
|
-
"aria-labelledby": labelId,
|
|
11208
|
-
children: /* @__PURE__ */ jsx25(Visibility, { isVisible: isActive || forceMount, children: props.children })
|
|
11134
|
+
|
|
11135
|
+
// src/hooks/focus/useFocusOnceVisible.ts
|
|
11136
|
+
import React3, { useEffect as useEffect17 } from "react";
|
|
11137
|
+
var useFocusOnceVisible = (ref, disable = false) => {
|
|
11138
|
+
const [hasUsedFocus, setHasUsedFocus] = React3.useState(false);
|
|
11139
|
+
useEffect17(() => {
|
|
11140
|
+
if (disable || hasUsedFocus) {
|
|
11141
|
+
return;
|
|
11209
11142
|
}
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
}
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
onShowMoreClicked,
|
|
11225
|
-
color = "primary",
|
|
11226
|
-
badge,
|
|
11227
|
-
contentClassName = "",
|
|
11228
|
-
className = ""
|
|
11229
|
-
}) => {
|
|
11230
|
-
const translation = useHightideTranslation();
|
|
11231
|
-
const chipColorMapping = {
|
|
11232
|
-
primary: "text-text-image-primary-background bg-text-image-primary-text",
|
|
11233
|
-
secondary: "text-text-image-secondary-background bg-text-image-secondary-text",
|
|
11234
|
-
dark: "text-text-image-dark-background bg-text-image-dark-text"
|
|
11235
|
-
};
|
|
11236
|
-
const colorMapping = {
|
|
11237
|
-
primary: "text-text-image-primary-text bg-linear-to-r from-30% from-text-image-primary-background to-text-image-primary-background/55",
|
|
11238
|
-
secondary: "text-text-image-secondary-text bg-linear-to-r from-30% from-text-image-secondary-background to-text-image-secondary-background/55",
|
|
11239
|
-
dark: "text-text-image-dark-text bg-linear-to-r from-30% from-text-image-dark-background to-text-image-dark-background/55"
|
|
11240
|
-
};
|
|
11241
|
-
return /* @__PURE__ */ jsx26(
|
|
11242
|
-
"div",
|
|
11243
|
-
{
|
|
11244
|
-
className: clsx8("rounded-2xl w-full", className),
|
|
11245
|
-
style: {
|
|
11246
|
-
backgroundImage: `url(${imageUrl})`,
|
|
11247
|
-
backgroundSize: "cover"
|
|
11248
|
-
},
|
|
11249
|
-
children: /* @__PURE__ */ jsxs12(
|
|
11250
|
-
"div",
|
|
11251
|
-
{
|
|
11252
|
-
className: clsx8(`flex-col-2 px-6 py-12 rounded-2xl h-full`, colorMapping[color], contentClassName),
|
|
11253
|
-
children: [
|
|
11254
|
-
badge && /* @__PURE__ */ jsx26("div", { className: clsx8(`chip-full mb-2 py-2 px-4 w-fit`, chipColorMapping[color]), children: /* @__PURE__ */ jsx26("span", { className: "text-lg font-bold", children: badge }) }),
|
|
11255
|
-
/* @__PURE__ */ jsxs12("div", { className: "flex-col-1 overflow-hidden", children: [
|
|
11256
|
-
/* @__PURE__ */ jsx26("span", { className: "typography-title-lg", children: title }),
|
|
11257
|
-
/* @__PURE__ */ jsx26("span", { className: "text-ellipsis overflow-hidden", children: description })
|
|
11258
|
-
] }),
|
|
11259
|
-
onShowMoreClicked && /* @__PURE__ */ jsx26("div", { className: "flex-row-2 mt-2 underline", children: /* @__PURE__ */ jsx26(
|
|
11260
|
-
Button,
|
|
11261
|
-
{
|
|
11262
|
-
color: "neutral",
|
|
11263
|
-
coloringStyle: "text",
|
|
11264
|
-
onClick: onShowMoreClicked,
|
|
11265
|
-
children: translation("showMore")
|
|
11266
|
-
}
|
|
11267
|
-
) })
|
|
11268
|
-
]
|
|
11269
|
-
}
|
|
11270
|
-
)
|
|
11271
|
-
}
|
|
11272
|
-
);
|
|
11273
|
-
};
|
|
11274
|
-
|
|
11275
|
-
// src/components/layout/VerticalDivider.tsx
|
|
11276
|
-
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
11277
|
-
var VerticalDivider = ({
|
|
11278
|
-
width = 1,
|
|
11279
|
-
height = 100,
|
|
11280
|
-
strokeWidth = 4,
|
|
11281
|
-
dashGap = 4,
|
|
11282
|
-
dashLength = 4
|
|
11283
|
-
}) => {
|
|
11284
|
-
return /* @__PURE__ */ jsx27("div", { style: { width: width + "px", height: height + "px" }, children: /* @__PURE__ */ jsxs13(
|
|
11285
|
-
"svg",
|
|
11286
|
-
{
|
|
11287
|
-
width,
|
|
11288
|
-
height,
|
|
11289
|
-
viewBox: `0 0 ${width} ${height}`,
|
|
11290
|
-
fill: "none",
|
|
11291
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
11292
|
-
children: [
|
|
11293
|
-
/* @__PURE__ */ jsx27(
|
|
11294
|
-
"line",
|
|
11295
|
-
{
|
|
11296
|
-
opacity: "0.5",
|
|
11297
|
-
x1: width / 2,
|
|
11298
|
-
y1: height,
|
|
11299
|
-
x2: width / 2,
|
|
11300
|
-
y2: "0",
|
|
11301
|
-
stroke: "url(#paint_linear)",
|
|
11302
|
-
strokeWidth,
|
|
11303
|
-
strokeDasharray: `${dashLength} ${dashLength + dashGap}`,
|
|
11304
|
-
strokeLinecap: "round"
|
|
11305
|
-
}
|
|
11306
|
-
),
|
|
11307
|
-
/* @__PURE__ */ jsx27("defs", { children: /* @__PURE__ */ jsxs13(
|
|
11308
|
-
"linearGradient",
|
|
11309
|
-
{
|
|
11310
|
-
id: "paint_linear",
|
|
11311
|
-
x1: width / 2,
|
|
11312
|
-
y1: "0",
|
|
11313
|
-
x2: width / 2,
|
|
11314
|
-
y2: height,
|
|
11315
|
-
gradientUnits: "userSpaceOnUse",
|
|
11316
|
-
children: [
|
|
11317
|
-
/* @__PURE__ */ jsx27("stop", { stopOpacity: "0", stopColor: "currentColor" }),
|
|
11318
|
-
/* @__PURE__ */ jsx27("stop", { offset: "0.5", stopColor: "currentColor" }),
|
|
11319
|
-
/* @__PURE__ */ jsx27("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0" })
|
|
11320
|
-
]
|
|
11321
|
-
}
|
|
11322
|
-
) })
|
|
11323
|
-
]
|
|
11324
|
-
}
|
|
11325
|
-
) });
|
|
11326
|
-
};
|
|
11327
|
-
|
|
11328
|
-
// src/components/layout/dialog/Dialog.tsx
|
|
11329
|
-
import { forwardRef as forwardRef10, useCallback as useCallback16, useContext as useContext10, useId as useId8, useImperativeHandle as useImperativeHandle6, useMemo as useMemo13, useRef as useRef18 } from "react";
|
|
11330
|
-
import { X } from "lucide-react";
|
|
11143
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
11144
|
+
if (entry.isIntersecting && !hasUsedFocus) {
|
|
11145
|
+
ref.current?.focus();
|
|
11146
|
+
setHasUsedFocus(hasUsedFocus);
|
|
11147
|
+
}
|
|
11148
|
+
}, {
|
|
11149
|
+
threshold: 0.1
|
|
11150
|
+
});
|
|
11151
|
+
if (ref.current) {
|
|
11152
|
+
observer.observe(ref.current);
|
|
11153
|
+
}
|
|
11154
|
+
return () => observer.disconnect();
|
|
11155
|
+
}, [disable, hasUsedFocus, ref]);
|
|
11156
|
+
};
|
|
11331
11157
|
|
|
11332
11158
|
// src/hooks/focus/useFocusTrap.ts
|
|
11333
|
-
import { useCallback as useCallback14, useEffect as
|
|
11159
|
+
import { useCallback as useCallback14, useEffect as useEffect18, useId as useId6, useRef as useRef14, useState as useState15 } from "react";
|
|
11334
11160
|
var createFocusGuard = () => {
|
|
11335
11161
|
const div = document.createElement("div");
|
|
11336
11162
|
Object.assign(div.style, {
|
|
@@ -11446,9 +11272,9 @@ var useFocusTrap = ({
|
|
|
11446
11272
|
active,
|
|
11447
11273
|
initialFocus
|
|
11448
11274
|
}) => {
|
|
11449
|
-
const lastFocusRef =
|
|
11450
|
-
const [paused, setPaused] =
|
|
11451
|
-
const id =
|
|
11275
|
+
const lastFocusRef = useRef14(null);
|
|
11276
|
+
const [paused, setPaused] = useState15(false);
|
|
11277
|
+
const id = useId6();
|
|
11452
11278
|
const focusElement = useCallback14(() => {
|
|
11453
11279
|
const containerElement = container.current;
|
|
11454
11280
|
if (initialFocus?.current) {
|
|
@@ -11463,7 +11289,7 @@ var useFocusTrap = ({
|
|
|
11463
11289
|
}
|
|
11464
11290
|
}
|
|
11465
11291
|
}, [container, initialFocus]);
|
|
11466
|
-
|
|
11292
|
+
useEffect18(() => {
|
|
11467
11293
|
if (active) {
|
|
11468
11294
|
let pause = function() {
|
|
11469
11295
|
setPaused(true);
|
|
@@ -11488,7 +11314,7 @@ var useFocusTrap = ({
|
|
|
11488
11314
|
};
|
|
11489
11315
|
}
|
|
11490
11316
|
}, [active, container, focusElement, id, initialFocus]);
|
|
11491
|
-
|
|
11317
|
+
useEffect18(() => {
|
|
11492
11318
|
if (active && !paused) {
|
|
11493
11319
|
let onKeyDown = function(event) {
|
|
11494
11320
|
const key = event.key;
|
|
@@ -11515,40 +11341,152 @@ var useFocusTrap = ({
|
|
|
11515
11341
|
}, [active, paused, container, initialFocus, focusElement]);
|
|
11516
11342
|
};
|
|
11517
11343
|
|
|
11518
|
-
// src/
|
|
11519
|
-
import {
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11344
|
+
// src/hooks/focus/useIsMounted.ts
|
|
11345
|
+
import { useEffect as useEffect19, useLayoutEffect as useLayoutEffect6, useState as useState16 } from "react";
|
|
11346
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
11347
|
+
var useIsomorphicEffect = isClient ? useLayoutEffect6 : useEffect19;
|
|
11348
|
+
var useIsMounted = () => {
|
|
11349
|
+
const [isMounted, setIsMounted] = useState16(false);
|
|
11350
|
+
useIsomorphicEffect(() => {
|
|
11351
|
+
setIsMounted(true);
|
|
11352
|
+
return () => {
|
|
11353
|
+
setIsMounted(false);
|
|
11354
|
+
};
|
|
11355
|
+
}, []);
|
|
11356
|
+
return isMounted;
|
|
11357
|
+
};
|
|
11358
|
+
|
|
11359
|
+
// src/hooks/useDelay.ts
|
|
11360
|
+
import { useEffect as useEffect20, useState as useState17 } from "react";
|
|
11361
|
+
var defaultOptions2 = {
|
|
11362
|
+
delay: 3e3,
|
|
11363
|
+
disabled: false
|
|
11364
|
+
};
|
|
11365
|
+
function useDelay(options) {
|
|
11366
|
+
const [timer, setTimer] = useState17(void 0);
|
|
11367
|
+
const { delay, disabled } = {
|
|
11368
|
+
...defaultOptions2,
|
|
11369
|
+
...options
|
|
11370
|
+
};
|
|
11371
|
+
const clearTimer = () => {
|
|
11372
|
+
clearTimeout(timer);
|
|
11373
|
+
setTimer(void 0);
|
|
11374
|
+
};
|
|
11375
|
+
const restartTimer = (onDelayFinish) => {
|
|
11376
|
+
if (disabled) {
|
|
11377
|
+
return;
|
|
11378
|
+
}
|
|
11379
|
+
clearTimeout(timer);
|
|
11380
|
+
setTimer(setTimeout(() => {
|
|
11381
|
+
onDelayFinish();
|
|
11382
|
+
setTimer(void 0);
|
|
11383
|
+
}, delay));
|
|
11384
|
+
};
|
|
11385
|
+
useEffect20(() => {
|
|
11386
|
+
return () => {
|
|
11387
|
+
clearTimeout(timer);
|
|
11388
|
+
};
|
|
11389
|
+
}, [timer]);
|
|
11390
|
+
useEffect20(() => {
|
|
11391
|
+
if (disabled) {
|
|
11392
|
+
clearTimeout(timer);
|
|
11393
|
+
setTimer(void 0);
|
|
11394
|
+
}
|
|
11395
|
+
}, [disabled, timer]);
|
|
11396
|
+
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
11397
|
+
}
|
|
11398
|
+
|
|
11399
|
+
// src/hooks/useHandleRefs.ts
|
|
11400
|
+
import { useEffect as useEffect21, useRef as useRef15 } from "react";
|
|
11401
|
+
function useHandleRefs(handleRef) {
|
|
11402
|
+
const refs = useRef15([]);
|
|
11403
|
+
useEffect21(() => {
|
|
11404
|
+
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
11405
|
+
() => ({ current: null })
|
|
11406
|
+
);
|
|
11407
|
+
const values = Object.values(handleRef?.current ?? {});
|
|
11408
|
+
values.forEach((el, i) => {
|
|
11409
|
+
refs.current[i].current = el;
|
|
11410
|
+
});
|
|
11526
11411
|
});
|
|
11527
|
-
return
|
|
11412
|
+
return refs.current;
|
|
11413
|
+
}
|
|
11414
|
+
|
|
11415
|
+
// src/hooks/useLogUnstableDependencies.ts
|
|
11416
|
+
import React4 from "react";
|
|
11417
|
+
function useLogUnstableDependencies(name, value) {
|
|
11418
|
+
const prev = React4.useRef(null);
|
|
11419
|
+
React4.useEffect(() => {
|
|
11420
|
+
if (!prev.current) {
|
|
11421
|
+
prev.current = value;
|
|
11422
|
+
return;
|
|
11423
|
+
}
|
|
11424
|
+
const changes = {};
|
|
11425
|
+
for (const key of Object.keys(value)) {
|
|
11426
|
+
if (prev.current[key] !== value[key]) {
|
|
11427
|
+
changes[key] = {
|
|
11428
|
+
prev: prev.current[key],
|
|
11429
|
+
next: value[key]
|
|
11430
|
+
};
|
|
11431
|
+
}
|
|
11432
|
+
}
|
|
11433
|
+
if (Object.keys(changes).length > 0) {
|
|
11434
|
+
console.info(`[${name}] changed`, changes);
|
|
11435
|
+
}
|
|
11436
|
+
prev.current = value;
|
|
11437
|
+
});
|
|
11438
|
+
}
|
|
11439
|
+
|
|
11440
|
+
// src/hooks/useOutsideClick.ts
|
|
11441
|
+
import { useEffect as useEffect22 } from "react";
|
|
11442
|
+
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
11443
|
+
useEffect22(() => {
|
|
11444
|
+
if (!active) return;
|
|
11445
|
+
const listener = (event) => {
|
|
11446
|
+
if (event.target === null) return;
|
|
11447
|
+
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
11448
|
+
return;
|
|
11449
|
+
}
|
|
11450
|
+
onOutsideClick(event);
|
|
11451
|
+
};
|
|
11452
|
+
document.addEventListener("mousedown", listener);
|
|
11453
|
+
document.addEventListener("touchstart", listener);
|
|
11454
|
+
document.addEventListener("pointerdown", listener);
|
|
11455
|
+
return () => {
|
|
11456
|
+
document.removeEventListener("mousedown", listener);
|
|
11457
|
+
document.removeEventListener("touchstart", listener);
|
|
11458
|
+
document.removeEventListener("pointerdown", listener);
|
|
11459
|
+
};
|
|
11460
|
+
}, [refs, onOutsideClick, active]);
|
|
11461
|
+
};
|
|
11462
|
+
|
|
11463
|
+
// src/hooks/useOverwritableState.ts
|
|
11464
|
+
import { useEffect as useEffect23, useState as useState18 } from "react";
|
|
11465
|
+
var useOverwritableState = (overwriteValue, onChange) => {
|
|
11466
|
+
const [state, setState] = useState18(overwriteValue);
|
|
11467
|
+
useEffect23(() => {
|
|
11468
|
+
setState(overwriteValue);
|
|
11469
|
+
}, [overwriteValue]);
|
|
11470
|
+
const onChangeWrapper = (action) => {
|
|
11471
|
+
const resolved = resolveSetState(action, state);
|
|
11472
|
+
setState(resolved);
|
|
11473
|
+
onChange?.(resolved);
|
|
11474
|
+
};
|
|
11475
|
+
return [state, onChangeWrapper];
|
|
11528
11476
|
};
|
|
11529
|
-
var FocusTrapWrapper = forwardRef9(function FocusTrap2({
|
|
11530
|
-
active,
|
|
11531
|
-
initialFocus,
|
|
11532
|
-
...props
|
|
11533
|
-
}, forwardedRef) {
|
|
11534
|
-
const innerRef = useRef16(null);
|
|
11535
|
-
useImperativeHandle5(forwardedRef, () => innerRef.current);
|
|
11536
|
-
useFocusTrap({ container: innerRef, active, initialFocus });
|
|
11537
|
-
return /* @__PURE__ */ jsx28("div", { ref: innerRef, ...props });
|
|
11538
|
-
});
|
|
11539
11477
|
|
|
11540
11478
|
// src/hooks/usePresenceRef.ts
|
|
11541
|
-
import { useCallback as useCallback15, useEffect as
|
|
11479
|
+
import { useCallback as useCallback15, useEffect as useEffect24, useRef as useRef16, useState as useState19 } from "react";
|
|
11542
11480
|
var usePresenceRef = ({
|
|
11543
11481
|
isOpen = true
|
|
11544
11482
|
}) => {
|
|
11545
|
-
const [isPresent, setIsPresent] =
|
|
11546
|
-
const ref =
|
|
11483
|
+
const [isPresent, setIsPresent] = useState19(false);
|
|
11484
|
+
const ref = useRef16(null);
|
|
11547
11485
|
const refAssignment = useCallback15((node) => {
|
|
11548
11486
|
ref.current = node;
|
|
11549
11487
|
setIsPresent((prev) => prev || !!node);
|
|
11550
11488
|
}, []);
|
|
11551
|
-
|
|
11489
|
+
useEffect24(() => {
|
|
11552
11490
|
if (!isOpen) {
|
|
11553
11491
|
setIsPresent(false);
|
|
11554
11492
|
}
|
|
@@ -11560,41 +11498,769 @@ var usePresenceRef = ({
|
|
|
11560
11498
|
};
|
|
11561
11499
|
};
|
|
11562
11500
|
|
|
11563
|
-
// src/
|
|
11564
|
-
import {
|
|
11565
|
-
var
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
if (!context) {
|
|
11569
|
-
throw new Error("useDialogContext must be used within a <DialogContext.Provider>");
|
|
11570
|
-
}
|
|
11571
|
-
return context;
|
|
11572
|
-
}
|
|
11501
|
+
// src/hooks/useRerender.ts
|
|
11502
|
+
import { useReducer as useReducer2 } from "react";
|
|
11503
|
+
var useRerender = () => {
|
|
11504
|
+
return useReducer2(() => ({}), {})[1];
|
|
11505
|
+
};
|
|
11573
11506
|
|
|
11574
|
-
// src/
|
|
11575
|
-
import {
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11507
|
+
// src/hooks/useSearch.ts
|
|
11508
|
+
import { useCallback as useCallback16, useEffect as useEffect25, useMemo as useMemo13, useState as useState20 } from "react";
|
|
11509
|
+
|
|
11510
|
+
// src/utils/simpleSearch.ts
|
|
11511
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
11512
|
+
return objects.filter((object) => {
|
|
11513
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
11514
|
+
if (!mappedSearchKeywords) {
|
|
11515
|
+
return true;
|
|
11516
|
+
}
|
|
11517
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
11518
|
+
});
|
|
11519
|
+
};
|
|
11520
|
+
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
11521
|
+
return objects.filter((object) => {
|
|
11522
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
11523
|
+
if (!mappedSearchKeywords) {
|
|
11524
|
+
return true;
|
|
11525
|
+
}
|
|
11526
|
+
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
11527
|
+
});
|
|
11528
|
+
};
|
|
11529
|
+
var SimpleSearchWithMapping = (search, objects, mapping) => {
|
|
11530
|
+
return MultiSearchWithMapping(search, objects, (value) => [mapping(value)]);
|
|
11531
|
+
};
|
|
11532
|
+
var SimpleSearch = (search, objects) => {
|
|
11533
|
+
return SimpleSearchWithMapping(search, objects, (value) => value);
|
|
11534
|
+
};
|
|
11535
|
+
|
|
11536
|
+
// src/hooks/useSearch.ts
|
|
11537
|
+
var useSearch = ({
|
|
11538
|
+
list,
|
|
11539
|
+
initialSearch,
|
|
11540
|
+
searchMapping,
|
|
11541
|
+
additionalSearchTags,
|
|
11542
|
+
isSearchInstant = true,
|
|
11543
|
+
sortingFunction,
|
|
11544
|
+
filter,
|
|
11545
|
+
disabled = false
|
|
11546
|
+
}) => {
|
|
11547
|
+
const [search, setSearch] = useState20(initialSearch ?? "");
|
|
11548
|
+
const [result, setResult] = useState20(list);
|
|
11549
|
+
const searchTags = useMemo13(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
11550
|
+
const updateSearch = useCallback16((newSearch) => {
|
|
11551
|
+
const usedSearch = newSearch ?? search;
|
|
11552
|
+
if (newSearch) {
|
|
11553
|
+
setSearch(search);
|
|
11554
|
+
}
|
|
11555
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
11556
|
+
}, [searchTags, list, search, searchMapping]);
|
|
11557
|
+
useEffect25(() => {
|
|
11558
|
+
if (isSearchInstant) {
|
|
11559
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
11560
|
+
}
|
|
11561
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
11562
|
+
const filteredResult = useMemo13(() => {
|
|
11563
|
+
if (!filter) {
|
|
11564
|
+
return result;
|
|
11565
|
+
}
|
|
11566
|
+
return result.filter(filter);
|
|
11567
|
+
}, [result, filter]);
|
|
11568
|
+
const sortedAndFilteredResult = useMemo13(() => {
|
|
11569
|
+
if (!sortingFunction) {
|
|
11570
|
+
return filteredResult;
|
|
11571
|
+
}
|
|
11572
|
+
return filteredResult.sort(sortingFunction);
|
|
11573
|
+
}, [filteredResult, sortingFunction]);
|
|
11574
|
+
const usedResult = useMemo13(() => {
|
|
11575
|
+
if (!disabled) {
|
|
11576
|
+
return sortedAndFilteredResult;
|
|
11577
|
+
}
|
|
11578
|
+
return list;
|
|
11579
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
11580
|
+
return {
|
|
11581
|
+
result: usedResult,
|
|
11582
|
+
hasResult: usedResult.length > 0,
|
|
11583
|
+
allItems: list,
|
|
11584
|
+
updateSearch,
|
|
11585
|
+
search,
|
|
11586
|
+
setSearch
|
|
11587
|
+
};
|
|
11588
|
+
};
|
|
11589
|
+
|
|
11590
|
+
// src/hooks/useUpdatingDateString.ts
|
|
11591
|
+
import { useEffect as useEffect26, useState as useState21 } from "react";
|
|
11592
|
+
|
|
11593
|
+
// src/utils/date.ts
|
|
11594
|
+
var timesInSeconds = {
|
|
11595
|
+
second: 1,
|
|
11596
|
+
minute: 60,
|
|
11597
|
+
hour: 3600,
|
|
11598
|
+
day: 86400,
|
|
11599
|
+
week: 604800,
|
|
11600
|
+
monthImprecise: 2629800,
|
|
11601
|
+
// 30.4375 days
|
|
11602
|
+
yearImprecise: 31557600
|
|
11603
|
+
// 365.25 days
|
|
11604
|
+
};
|
|
11605
|
+
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
11606
|
+
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
11607
|
+
var changeDuration = (date, duration, isAdding) => {
|
|
11608
|
+
const {
|
|
11609
|
+
years = 0,
|
|
11610
|
+
months = 0,
|
|
11611
|
+
days = 0,
|
|
11612
|
+
hours = 0,
|
|
11613
|
+
minutes = 0,
|
|
11614
|
+
seconds = 0,
|
|
11615
|
+
milliseconds = 0
|
|
11616
|
+
} = duration;
|
|
11617
|
+
if (years < 0) {
|
|
11618
|
+
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
11619
|
+
return new Date(date);
|
|
11620
|
+
}
|
|
11621
|
+
if (months < 0 || months > 11) {
|
|
11622
|
+
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
11623
|
+
return new Date(date);
|
|
11624
|
+
}
|
|
11625
|
+
if (days < 0) {
|
|
11626
|
+
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
11627
|
+
return new Date(date);
|
|
11628
|
+
}
|
|
11629
|
+
if (hours < 0 || hours > 23) {
|
|
11630
|
+
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
11631
|
+
return new Date(date);
|
|
11632
|
+
}
|
|
11633
|
+
if (minutes < 0 || minutes > 59) {
|
|
11634
|
+
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
11635
|
+
return new Date(date);
|
|
11636
|
+
}
|
|
11637
|
+
if (seconds < 0 || seconds > 59) {
|
|
11638
|
+
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
11639
|
+
return new Date(date);
|
|
11640
|
+
}
|
|
11641
|
+
if (milliseconds < 0) {
|
|
11642
|
+
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
11643
|
+
return new Date(date);
|
|
11644
|
+
}
|
|
11645
|
+
const multiplier = isAdding ? 1 : -1;
|
|
11646
|
+
const newDate = new Date(date);
|
|
11647
|
+
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
11648
|
+
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
11649
|
+
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
11650
|
+
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
11651
|
+
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
11652
|
+
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
11653
|
+
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
11654
|
+
return newDate;
|
|
11655
|
+
};
|
|
11656
|
+
var addDuration = (date, duration) => {
|
|
11657
|
+
return changeDuration(date, duration, true);
|
|
11658
|
+
};
|
|
11659
|
+
var subtractDuration = (date, duration) => {
|
|
11660
|
+
return changeDuration(date, duration, false);
|
|
11661
|
+
};
|
|
11662
|
+
var between = (value, startDate, endDate) => {
|
|
11663
|
+
if (startDate && endDate) {
|
|
11664
|
+
console.assert(startDate <= endDate);
|
|
11665
|
+
return startDate <= value && value <= endDate;
|
|
11666
|
+
} else if (startDate) {
|
|
11667
|
+
return startDate <= value;
|
|
11668
|
+
} else if (endDate) {
|
|
11669
|
+
return endDate >= value;
|
|
11670
|
+
} else {
|
|
11671
|
+
return true;
|
|
11672
|
+
}
|
|
11673
|
+
};
|
|
11674
|
+
var equalDate = (date1, date2) => {
|
|
11675
|
+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
11676
|
+
};
|
|
11677
|
+
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
11678
|
+
const month = date.getMonth();
|
|
11679
|
+
const year = date.getFullYear();
|
|
11680
|
+
const dayList = [];
|
|
11681
|
+
let currentDate = new Date(year, month, 1);
|
|
11682
|
+
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
11683
|
+
while (currentDate.getDay() !== weekStartIndex) {
|
|
11684
|
+
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
11685
|
+
}
|
|
11686
|
+
while (dayList.length < 7 * weeks) {
|
|
11687
|
+
const date2 = new Date(currentDate);
|
|
11688
|
+
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
11689
|
+
dayList.push(date2);
|
|
11690
|
+
currentDate = addDuration(currentDate, { days: 1 });
|
|
11691
|
+
}
|
|
11692
|
+
return equalSizeGroups(dayList, 7);
|
|
11693
|
+
};
|
|
11694
|
+
var formatAbsolute = (date, locale, format) => {
|
|
11695
|
+
let options;
|
|
11696
|
+
switch (format) {
|
|
11697
|
+
case "date":
|
|
11698
|
+
options = {
|
|
11699
|
+
year: "2-digit",
|
|
11700
|
+
month: "2-digit",
|
|
11701
|
+
day: "2-digit"
|
|
11702
|
+
};
|
|
11703
|
+
break;
|
|
11704
|
+
case "time":
|
|
11705
|
+
options = {
|
|
11706
|
+
hour: "2-digit",
|
|
11707
|
+
minute: "2-digit"
|
|
11708
|
+
};
|
|
11709
|
+
break;
|
|
11710
|
+
case "dateTime":
|
|
11711
|
+
options = {
|
|
11712
|
+
year: "numeric",
|
|
11713
|
+
month: "2-digit",
|
|
11714
|
+
day: "2-digit",
|
|
11715
|
+
hour: "2-digit",
|
|
11716
|
+
minute: "2-digit"
|
|
11717
|
+
};
|
|
11718
|
+
break;
|
|
11719
|
+
}
|
|
11720
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
11721
|
+
};
|
|
11722
|
+
var formatRelative = (date, locale) => {
|
|
11723
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
11724
|
+
const now = /* @__PURE__ */ new Date();
|
|
11725
|
+
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
11726
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
11727
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
11728
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
11729
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
11730
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
11731
|
+
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
11732
|
+
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
11733
|
+
};
|
|
11734
|
+
var toInputString = (date, format) => {
|
|
11735
|
+
switch (format) {
|
|
11736
|
+
case "date":
|
|
11737
|
+
return date.toISOString().split("T")[0];
|
|
11738
|
+
case "time":
|
|
11739
|
+
return date.toISOString().split("T")[1].split("Z")[0];
|
|
11740
|
+
case "dateTime":
|
|
11741
|
+
return date.toISOString();
|
|
11742
|
+
}
|
|
11743
|
+
};
|
|
11744
|
+
var DateUtils = {
|
|
11745
|
+
monthsList,
|
|
11746
|
+
weekDayList,
|
|
11747
|
+
equalDate,
|
|
11748
|
+
formatAbsolute,
|
|
11749
|
+
formatRelative,
|
|
11750
|
+
addDuration,
|
|
11751
|
+
subtractDuration,
|
|
11752
|
+
between,
|
|
11753
|
+
weeksForCalenderMonth,
|
|
11754
|
+
timesInSeconds,
|
|
11755
|
+
toInputString
|
|
11756
|
+
};
|
|
11757
|
+
|
|
11758
|
+
// src/hooks/useUpdatingDateString.ts
|
|
11759
|
+
var useUpdatingDateString = ({ absoluteFormat = "dateTime", localeOverride, date }) => {
|
|
11760
|
+
const { locale: contextLocale } = useLocale();
|
|
11761
|
+
const locale = localeOverride ?? contextLocale;
|
|
11762
|
+
const [dateAndTimeStrings, setDateAndTimeStrings] = useState21({
|
|
11763
|
+
compareDate: date,
|
|
11764
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
11765
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
11766
|
+
});
|
|
11767
|
+
useEffect26(() => {
|
|
11768
|
+
setDateAndTimeStrings({
|
|
11769
|
+
compareDate: date,
|
|
11770
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
11771
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
11772
|
+
});
|
|
11773
|
+
}, [date, absoluteFormat, locale]);
|
|
11774
|
+
useEffect26(() => {
|
|
11775
|
+
let timeoutId;
|
|
11776
|
+
const startTimer = () => {
|
|
11777
|
+
const now = /* @__PURE__ */ new Date();
|
|
11778
|
+
const diff = Math.abs((date.getTime() - now.getTime()) / 1e3);
|
|
11779
|
+
let delayInSeconds;
|
|
11780
|
+
if (diff < DateUtils.timesInSeconds.minute) {
|
|
11781
|
+
delayInSeconds = DateUtils.timesInSeconds.second;
|
|
11782
|
+
} else if (diff < DateUtils.timesInSeconds.hour) {
|
|
11783
|
+
delayInSeconds = DateUtils.timesInSeconds.minute;
|
|
11784
|
+
} else {
|
|
11785
|
+
delayInSeconds = DateUtils.timesInSeconds.hour;
|
|
11786
|
+
}
|
|
11787
|
+
timeoutId = setInterval(() => {
|
|
11788
|
+
setDateAndTimeStrings({
|
|
11789
|
+
compareDate: date,
|
|
11790
|
+
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
11791
|
+
relative: DateUtils.formatRelative(date, locale)
|
|
11792
|
+
});
|
|
11793
|
+
}, delayInSeconds * 1e3 / 2);
|
|
11794
|
+
};
|
|
11795
|
+
startTimer();
|
|
11796
|
+
return () => clearInterval(timeoutId);
|
|
11797
|
+
}, [absoluteFormat, date, locale]);
|
|
11798
|
+
return {
|
|
11799
|
+
absolute: dateAndTimeStrings.absolute,
|
|
11800
|
+
relative: dateAndTimeStrings.relative
|
|
11801
|
+
};
|
|
11802
|
+
};
|
|
11803
|
+
|
|
11804
|
+
// src/utils/emailValidation.ts
|
|
11805
|
+
var validateEmail = (email) => {
|
|
11806
|
+
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
11807
|
+
};
|
|
11808
|
+
|
|
11809
|
+
// src/hooks/useValidators.ts
|
|
11810
|
+
import { useMemo as useMemo14 } from "react";
|
|
11811
|
+
var notEmpty = (value) => {
|
|
11812
|
+
if (!value) {
|
|
11813
|
+
return "notEmpty";
|
|
11814
|
+
}
|
|
11815
|
+
};
|
|
11816
|
+
var boundsValidator = (length, bounds) => {
|
|
11817
|
+
const [min, max] = bounds;
|
|
11818
|
+
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
11819
|
+
return "range";
|
|
11820
|
+
}
|
|
11821
|
+
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
11822
|
+
return "lower";
|
|
11823
|
+
}
|
|
11824
|
+
if (max !== void 0 && length !== void 0 && length > max) {
|
|
11825
|
+
return "upper";
|
|
11826
|
+
}
|
|
11827
|
+
return "none";
|
|
11828
|
+
};
|
|
11829
|
+
var lengthValidator = (value, bounds) => {
|
|
11830
|
+
const mapping = {
|
|
11831
|
+
range: "outOfRangeString",
|
|
11832
|
+
lower: "tooShort",
|
|
11833
|
+
upper: "tooLong",
|
|
11834
|
+
none: void 0
|
|
11835
|
+
};
|
|
11836
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
11837
|
+
};
|
|
11838
|
+
var selectionValidator = (value, bounds) => {
|
|
11839
|
+
const mapping = {
|
|
11840
|
+
range: "outOfRangeSelectionItems",
|
|
11841
|
+
lower: "tooFewSelectionItems",
|
|
11842
|
+
upper: "tooManySelectionItems",
|
|
11843
|
+
none: void 0
|
|
11844
|
+
};
|
|
11845
|
+
return mapping[boundsValidator(value?.length, bounds)];
|
|
11846
|
+
};
|
|
11847
|
+
var emailValidator = (value) => {
|
|
11848
|
+
if (!value || !validateEmail(value)) {
|
|
11849
|
+
return "invalidEmail";
|
|
11850
|
+
}
|
|
11851
|
+
};
|
|
11852
|
+
var UseValidators = {
|
|
11853
|
+
notEmpty,
|
|
11854
|
+
length: lengthValidator,
|
|
11855
|
+
email: emailValidator,
|
|
11856
|
+
selection: selectionValidator
|
|
11857
|
+
};
|
|
11858
|
+
var useTranslatedValidators = () => {
|
|
11859
|
+
const translation = useHightideTranslation();
|
|
11860
|
+
return useMemo14(() => ({
|
|
11861
|
+
notEmpty: (value) => {
|
|
11862
|
+
const result = notEmpty(value);
|
|
11863
|
+
if (result) {
|
|
11864
|
+
return translation(result);
|
|
11865
|
+
}
|
|
11866
|
+
},
|
|
11867
|
+
length: (value, length) => {
|
|
11868
|
+
const [min, max] = length;
|
|
11869
|
+
const result = lengthValidator(value, length);
|
|
11870
|
+
if (result) {
|
|
11871
|
+
return translation(result, { min, max });
|
|
11872
|
+
}
|
|
11873
|
+
},
|
|
11874
|
+
email: (value) => {
|
|
11875
|
+
const result = emailValidator(value ?? "");
|
|
11876
|
+
if (result) {
|
|
11877
|
+
return translation(result);
|
|
11878
|
+
}
|
|
11879
|
+
},
|
|
11880
|
+
selection: (value, length) => {
|
|
11881
|
+
const [min, max] = length;
|
|
11882
|
+
const result = selectionValidator(value, length);
|
|
11883
|
+
if (result) {
|
|
11884
|
+
return translation(
|
|
11885
|
+
result,
|
|
11886
|
+
{ min, max }
|
|
11887
|
+
);
|
|
11888
|
+
}
|
|
11889
|
+
}
|
|
11890
|
+
}), [translation]);
|
|
11891
|
+
};
|
|
11892
|
+
|
|
11893
|
+
// src/components/layout/TabSwitcher.tsx
|
|
11894
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
11895
|
+
function sortByDomOrder(infos) {
|
|
11896
|
+
return infos.slice().sort((a, b) => {
|
|
11897
|
+
const elA = a.ref.current;
|
|
11898
|
+
const elB = b.ref.current;
|
|
11899
|
+
if (!elA && !elB) return 0;
|
|
11900
|
+
if (!elA) return 1;
|
|
11901
|
+
if (!elB) return -1;
|
|
11902
|
+
return elA.compareDocumentPosition(elB) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
11903
|
+
});
|
|
11904
|
+
}
|
|
11905
|
+
var TabContext = createContext8(null);
|
|
11906
|
+
function useTabContext() {
|
|
11907
|
+
const context = useContext8(TabContext);
|
|
11908
|
+
if (!context) throw new Error("useTabContext must be used inside a <TabView>");
|
|
11909
|
+
return context;
|
|
11910
|
+
}
|
|
11911
|
+
function TabSwitcher({ children, activeId: controlledActiveId, onActiveIdChange, initialActiveId }) {
|
|
11912
|
+
const [activeId, setActiveId] = useControlledState({
|
|
11913
|
+
value: controlledActiveId,
|
|
11914
|
+
defaultValue: initialActiveId ?? null,
|
|
11915
|
+
onValueChange: onActiveIdChange
|
|
11916
|
+
});
|
|
11917
|
+
const [tabInfos, setTabInfos] = useState22([]);
|
|
11918
|
+
const [portalState, setPortalState] = useState22(null);
|
|
11919
|
+
const subscribe = useCallback17((info) => {
|
|
11920
|
+
const id = info.id;
|
|
11921
|
+
setTabInfos((prevState) => {
|
|
11922
|
+
const existingIndex = prevState.findIndex((t) => t.id === id);
|
|
11923
|
+
const infos = existingIndex >= 0 ? prevState.map((t, i) => i === existingIndex ? { ...t, ...info } : t) : [...prevState, info];
|
|
11924
|
+
return sortByDomOrder(infos);
|
|
11925
|
+
});
|
|
11926
|
+
return () => {
|
|
11927
|
+
setTabInfos((prevState) => {
|
|
11928
|
+
return prevState.filter((t) => t.id !== id);
|
|
11929
|
+
});
|
|
11930
|
+
};
|
|
11931
|
+
}, []);
|
|
11932
|
+
useEffect27(() => {
|
|
11933
|
+
const active = tabInfos.find((value) => value.id === activeId);
|
|
11934
|
+
if (!active || !active.disabled) return;
|
|
11935
|
+
const firstEnabled = tabInfos.find((value) => !value.disabled);
|
|
11936
|
+
if (firstEnabled) {
|
|
11937
|
+
setActiveId(firstEnabled.id);
|
|
11938
|
+
} else {
|
|
11939
|
+
setActiveId(null);
|
|
11940
|
+
}
|
|
11941
|
+
}, [activeId, setActiveId, tabInfos]);
|
|
11942
|
+
const registerPortal = useCallback17((state) => {
|
|
11943
|
+
setPortalState(state);
|
|
11944
|
+
}, []);
|
|
11945
|
+
const changeActiveId = useCallback17((activeId2) => {
|
|
11946
|
+
const info = tabInfos.find((value) => value.id === activeId2);
|
|
11947
|
+
if (info && info.disabled) return;
|
|
11948
|
+
setActiveId(activeId2);
|
|
11949
|
+
}, [setActiveId, tabInfos]);
|
|
11950
|
+
const resolvedActiveId = () => {
|
|
11951
|
+
const active = tabInfos.find((value) => value.id === activeId);
|
|
11952
|
+
if (!!active && !active.disabled) return activeId;
|
|
11953
|
+
const firstEnabled = tabInfos.find((value) => !value.disabled);
|
|
11954
|
+
if (firstEnabled) return firstEnabled.id;
|
|
11955
|
+
return tabInfos[0]?.id ?? null;
|
|
11956
|
+
};
|
|
11957
|
+
return /* @__PURE__ */ jsx25(
|
|
11958
|
+
TabContext.Provider,
|
|
11959
|
+
{
|
|
11960
|
+
value: {
|
|
11961
|
+
tabs: {
|
|
11962
|
+
activeId: resolvedActiveId(),
|
|
11963
|
+
setActiveId: changeActiveId,
|
|
11964
|
+
subscribe,
|
|
11965
|
+
infos: tabInfos
|
|
11966
|
+
},
|
|
11967
|
+
portal: {
|
|
11968
|
+
id: portalState?.id ?? null,
|
|
11969
|
+
element: portalState?.ref.current ?? null,
|
|
11970
|
+
setPortal: registerPortal
|
|
11971
|
+
}
|
|
11972
|
+
},
|
|
11973
|
+
children
|
|
11974
|
+
}
|
|
11975
|
+
);
|
|
11976
|
+
}
|
|
11977
|
+
function TabList({ ...props }) {
|
|
11978
|
+
const { tabs } = useTabContext();
|
|
11979
|
+
const { infos, activeId, setActiveId: setActive } = tabs;
|
|
11980
|
+
const refs = useRef17({});
|
|
11981
|
+
const onKeyDown = (e) => {
|
|
11982
|
+
const idx = infos.findIndex((tab) => tab.id === activeId);
|
|
11983
|
+
if (idx === -1) return;
|
|
11984
|
+
const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
11985
|
+
if (step === 0) return;
|
|
11986
|
+
let nextIdx = idx;
|
|
11987
|
+
for (let i = 0; i < infos.length; i++) {
|
|
11988
|
+
nextIdx = (nextIdx + step + infos.length) % infos.length;
|
|
11989
|
+
if (!infos[nextIdx].disabled) break;
|
|
11990
|
+
}
|
|
11991
|
+
if (infos[nextIdx].disabled) return;
|
|
11992
|
+
const nextId = infos[nextIdx].id;
|
|
11993
|
+
setActive(nextId);
|
|
11994
|
+
refs.current[nextId]?.focus();
|
|
11995
|
+
};
|
|
11996
|
+
return /* @__PURE__ */ jsx25(
|
|
11997
|
+
"ul",
|
|
11998
|
+
{
|
|
11999
|
+
...props,
|
|
12000
|
+
"data-name": props["data-name"] ?? "tab-list",
|
|
12001
|
+
onKeyDown,
|
|
12002
|
+
role: "tablist",
|
|
12003
|
+
"aria-orientation": "horizontal",
|
|
12004
|
+
style: { "--tab-count": infos.length, ...props.style },
|
|
12005
|
+
children: infos.map((tabInfo) => {
|
|
12006
|
+
const isDisabled = !!tabInfo.disabled;
|
|
12007
|
+
const isActive = activeId === tabInfo.id;
|
|
12008
|
+
return /* @__PURE__ */ jsx25(
|
|
12009
|
+
"li",
|
|
12010
|
+
{
|
|
12011
|
+
ref: (el) => {
|
|
12012
|
+
refs.current[tabInfo.id] = el;
|
|
12013
|
+
},
|
|
12014
|
+
id: tabInfo.labelId,
|
|
12015
|
+
...isDisabled ? {} : PropsUtil.aria.click(() => setActive(tabInfo.id)),
|
|
12016
|
+
"data-name": "tab-list-item",
|
|
12017
|
+
"data-active": PropsUtil.dataAttributes.bool(isActive),
|
|
12018
|
+
"data-disabled": PropsUtil.dataAttributes.bool(isDisabled),
|
|
12019
|
+
role: "tab",
|
|
12020
|
+
"aria-selected": isActive,
|
|
12021
|
+
"aria-disabled": isDisabled,
|
|
12022
|
+
"aria-controls": tabInfo.id,
|
|
12023
|
+
tabIndex: isActive && !isDisabled ? 0 : -1,
|
|
12024
|
+
children: tabInfo.label
|
|
12025
|
+
},
|
|
12026
|
+
tabInfo.id
|
|
12027
|
+
);
|
|
12028
|
+
})
|
|
12029
|
+
}
|
|
12030
|
+
);
|
|
12031
|
+
}
|
|
12032
|
+
function TabView({ ...props }) {
|
|
12033
|
+
const generated = useId7();
|
|
12034
|
+
const id = props.id ?? "tab-view-" + generated;
|
|
12035
|
+
const { portal } = useTabContext();
|
|
12036
|
+
const { setPortal } = portal;
|
|
12037
|
+
const ref = useRef17(null);
|
|
12038
|
+
useEffect27(() => {
|
|
12039
|
+
setPortal({ id, ref });
|
|
12040
|
+
return () => setPortal(null);
|
|
12041
|
+
}, [id, setPortal]);
|
|
12042
|
+
return /* @__PURE__ */ jsx25(
|
|
12043
|
+
"div",
|
|
12044
|
+
{
|
|
12045
|
+
...props,
|
|
12046
|
+
ref,
|
|
12047
|
+
id,
|
|
12048
|
+
className: clsx7("tab-view", props.className)
|
|
12049
|
+
}
|
|
12050
|
+
);
|
|
12051
|
+
}
|
|
12052
|
+
function TabPanel({ label, forceMount = false, disabled = false, initiallyActive = false, ...props }) {
|
|
12053
|
+
const { tabs, portal } = useTabContext();
|
|
12054
|
+
const { subscribe, activeId, setActiveId } = tabs;
|
|
12055
|
+
const generatedId = useId7();
|
|
12056
|
+
const id = props.id ?? "tab-panel-" + generatedId;
|
|
12057
|
+
const labelId = "tab-list-button-" + generatedId;
|
|
12058
|
+
const ref = useRef17(null);
|
|
12059
|
+
useEffect27(() => {
|
|
12060
|
+
return subscribe({ id, label, labelId, disabled, ref });
|
|
12061
|
+
}, [id, label, labelId, disabled, subscribe]);
|
|
12062
|
+
const [hasAnnouncedIntialliyActive, setHasAnnouncedIntialliyActive] = useState22(false);
|
|
12063
|
+
useEffect27(() => {
|
|
12064
|
+
if (!hasAnnouncedIntialliyActive) {
|
|
12065
|
+
if (initiallyActive) {
|
|
12066
|
+
setActiveId(id);
|
|
12067
|
+
}
|
|
12068
|
+
setHasAnnouncedIntialliyActive(true);
|
|
12069
|
+
}
|
|
12070
|
+
}, [hasAnnouncedIntialliyActive, id, initiallyActive, setActiveId]);
|
|
12071
|
+
const isActive = activeId === id;
|
|
12072
|
+
const content = /* @__PURE__ */ jsx25(
|
|
12073
|
+
"div",
|
|
12074
|
+
{
|
|
12075
|
+
...props,
|
|
12076
|
+
ref,
|
|
12077
|
+
id,
|
|
12078
|
+
hidden: !isActive,
|
|
12079
|
+
"data-name": props["data-name"] ?? "tab-panel",
|
|
12080
|
+
"data-disabled": PropsUtil.dataAttributes.bool(disabled),
|
|
12081
|
+
role: "tabpanel",
|
|
12082
|
+
"aria-labelledby": labelId,
|
|
12083
|
+
children: /* @__PURE__ */ jsx25(Visibility, { isVisible: isActive || forceMount, children: props.children })
|
|
12084
|
+
}
|
|
12085
|
+
);
|
|
12086
|
+
if (portal.element) {
|
|
12087
|
+
return createPortal2(content, portal.element);
|
|
12088
|
+
}
|
|
12089
|
+
return content;
|
|
12090
|
+
}
|
|
12091
|
+
|
|
12092
|
+
// src/components/layout/TextImage.tsx
|
|
12093
|
+
import clsx8 from "clsx";
|
|
12094
|
+
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
12095
|
+
var TextImage = ({
|
|
12096
|
+
title,
|
|
12097
|
+
description,
|
|
12098
|
+
imageUrl,
|
|
12099
|
+
onShowMoreClicked,
|
|
12100
|
+
color = "primary",
|
|
12101
|
+
badge,
|
|
12102
|
+
contentClassName = "",
|
|
12103
|
+
className = ""
|
|
12104
|
+
}) => {
|
|
12105
|
+
const translation = useHightideTranslation();
|
|
12106
|
+
const chipColorMapping = {
|
|
12107
|
+
primary: "text-text-image-primary-background bg-text-image-primary-text",
|
|
12108
|
+
secondary: "text-text-image-secondary-background bg-text-image-secondary-text",
|
|
12109
|
+
dark: "text-text-image-dark-background bg-text-image-dark-text"
|
|
12110
|
+
};
|
|
12111
|
+
const colorMapping = {
|
|
12112
|
+
primary: "text-text-image-primary-text bg-linear-to-r from-30% from-text-image-primary-background to-text-image-primary-background/55",
|
|
12113
|
+
secondary: "text-text-image-secondary-text bg-linear-to-r from-30% from-text-image-secondary-background to-text-image-secondary-background/55",
|
|
12114
|
+
dark: "text-text-image-dark-text bg-linear-to-r from-30% from-text-image-dark-background to-text-image-dark-background/55"
|
|
12115
|
+
};
|
|
12116
|
+
return /* @__PURE__ */ jsx26(
|
|
12117
|
+
"div",
|
|
12118
|
+
{
|
|
12119
|
+
className: clsx8("rounded-2xl w-full", className),
|
|
12120
|
+
style: {
|
|
12121
|
+
backgroundImage: `url(${imageUrl})`,
|
|
12122
|
+
backgroundSize: "cover"
|
|
12123
|
+
},
|
|
12124
|
+
children: /* @__PURE__ */ jsxs12(
|
|
12125
|
+
"div",
|
|
12126
|
+
{
|
|
12127
|
+
className: clsx8(`flex-col-2 px-6 py-12 rounded-2xl h-full`, colorMapping[color], contentClassName),
|
|
12128
|
+
children: [
|
|
12129
|
+
badge && /* @__PURE__ */ jsx26("div", { className: clsx8(`chip-full mb-2 py-2 px-4 w-fit`, chipColorMapping[color]), children: /* @__PURE__ */ jsx26("span", { className: "text-lg font-bold", children: badge }) }),
|
|
12130
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-col-1 overflow-hidden", children: [
|
|
12131
|
+
/* @__PURE__ */ jsx26("span", { className: "typography-title-lg", children: title }),
|
|
12132
|
+
/* @__PURE__ */ jsx26("span", { className: "text-ellipsis overflow-hidden", children: description })
|
|
12133
|
+
] }),
|
|
12134
|
+
onShowMoreClicked && /* @__PURE__ */ jsx26("div", { className: "flex-row-2 mt-2 underline", children: /* @__PURE__ */ jsx26(
|
|
12135
|
+
Button,
|
|
12136
|
+
{
|
|
12137
|
+
color: "neutral",
|
|
12138
|
+
coloringStyle: "text",
|
|
12139
|
+
onClick: onShowMoreClicked,
|
|
12140
|
+
children: translation("showMore")
|
|
12141
|
+
}
|
|
12142
|
+
) })
|
|
12143
|
+
]
|
|
12144
|
+
}
|
|
12145
|
+
)
|
|
12146
|
+
}
|
|
12147
|
+
);
|
|
12148
|
+
};
|
|
12149
|
+
|
|
12150
|
+
// src/components/layout/VerticalDivider.tsx
|
|
12151
|
+
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
12152
|
+
var VerticalDivider = ({
|
|
12153
|
+
width = 1,
|
|
12154
|
+
height = 100,
|
|
12155
|
+
strokeWidth = 4,
|
|
12156
|
+
dashGap = 4,
|
|
12157
|
+
dashLength = 4
|
|
12158
|
+
}) => {
|
|
12159
|
+
return /* @__PURE__ */ jsx27("div", { style: { width: width + "px", height: height + "px" }, children: /* @__PURE__ */ jsxs13(
|
|
12160
|
+
"svg",
|
|
12161
|
+
{
|
|
12162
|
+
width,
|
|
12163
|
+
height,
|
|
12164
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
12165
|
+
fill: "none",
|
|
12166
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12167
|
+
children: [
|
|
12168
|
+
/* @__PURE__ */ jsx27(
|
|
12169
|
+
"line",
|
|
12170
|
+
{
|
|
12171
|
+
opacity: "0.5",
|
|
12172
|
+
x1: width / 2,
|
|
12173
|
+
y1: height,
|
|
12174
|
+
x2: width / 2,
|
|
12175
|
+
y2: "0",
|
|
12176
|
+
stroke: "url(#paint_linear)",
|
|
12177
|
+
strokeWidth,
|
|
12178
|
+
strokeDasharray: `${dashLength} ${dashLength + dashGap}`,
|
|
12179
|
+
strokeLinecap: "round"
|
|
12180
|
+
}
|
|
12181
|
+
),
|
|
12182
|
+
/* @__PURE__ */ jsx27("defs", { children: /* @__PURE__ */ jsxs13(
|
|
12183
|
+
"linearGradient",
|
|
12184
|
+
{
|
|
12185
|
+
id: "paint_linear",
|
|
12186
|
+
x1: width / 2,
|
|
12187
|
+
y1: "0",
|
|
12188
|
+
x2: width / 2,
|
|
12189
|
+
y2: height,
|
|
12190
|
+
gradientUnits: "userSpaceOnUse",
|
|
12191
|
+
children: [
|
|
12192
|
+
/* @__PURE__ */ jsx27("stop", { stopOpacity: "0", stopColor: "currentColor" }),
|
|
12193
|
+
/* @__PURE__ */ jsx27("stop", { offset: "0.5", stopColor: "currentColor" }),
|
|
12194
|
+
/* @__PURE__ */ jsx27("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0" })
|
|
12195
|
+
]
|
|
12196
|
+
}
|
|
12197
|
+
) })
|
|
12198
|
+
]
|
|
12199
|
+
}
|
|
12200
|
+
) });
|
|
12201
|
+
};
|
|
12202
|
+
|
|
12203
|
+
// src/components/layout/dialog/Dialog.tsx
|
|
12204
|
+
import { forwardRef as forwardRef10, useCallback as useCallback18, useContext as useContext10, useId as useId8, useImperativeHandle as useImperativeHandle6, useMemo as useMemo15, useRef as useRef19 } from "react";
|
|
12205
|
+
import { X } from "lucide-react";
|
|
12206
|
+
|
|
12207
|
+
// src/components/utils/FocusTrap.tsx
|
|
12208
|
+
import { useRef as useRef18 } from "react";
|
|
12209
|
+
import { useImperativeHandle as useImperativeHandle5 } from "react";
|
|
12210
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
12211
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
12212
|
+
var FocusTrap = ({ children, ...props }) => {
|
|
12213
|
+
useFocusTrap({
|
|
12214
|
+
...props
|
|
12215
|
+
});
|
|
12216
|
+
return children;
|
|
12217
|
+
};
|
|
12218
|
+
var FocusTrapWrapper = forwardRef9(function FocusTrap2({
|
|
12219
|
+
active,
|
|
12220
|
+
initialFocus,
|
|
12221
|
+
...props
|
|
12222
|
+
}, forwardedRef) {
|
|
12223
|
+
const innerRef = useRef18(null);
|
|
12224
|
+
useImperativeHandle5(forwardedRef, () => innerRef.current);
|
|
12225
|
+
useFocusTrap({ container: innerRef, active, initialFocus });
|
|
12226
|
+
return /* @__PURE__ */ jsx28("div", { ref: innerRef, ...props });
|
|
12227
|
+
});
|
|
12228
|
+
|
|
12229
|
+
// src/components/layout/dialog/DialogContext.tsx
|
|
12230
|
+
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
12231
|
+
var DialogContext = createContext9(null);
|
|
12232
|
+
function useDialogContext() {
|
|
12233
|
+
const context = useContext9(DialogContext);
|
|
12234
|
+
if (!context) {
|
|
12235
|
+
throw new Error("useDialogContext must be used within a <DialogContext.Provider>");
|
|
12236
|
+
}
|
|
12237
|
+
return context;
|
|
12238
|
+
}
|
|
12239
|
+
|
|
12240
|
+
// src/components/layout/dialog/Dialog.tsx
|
|
12241
|
+
import { jsx as jsx29, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
12242
|
+
var Dialog = forwardRef10(function Dialog2({
|
|
12243
|
+
children,
|
|
12244
|
+
isOpen: isOpenOverwrite,
|
|
12245
|
+
titleElement,
|
|
12246
|
+
description,
|
|
12247
|
+
isModal: isModalOverwrite = true,
|
|
12248
|
+
onClose,
|
|
12249
|
+
backgroundClassName,
|
|
12250
|
+
position = "center",
|
|
12251
|
+
containerClassName,
|
|
11586
12252
|
...props
|
|
11587
12253
|
}, forwardedRef) {
|
|
11588
12254
|
const translation = useHightideTranslation();
|
|
11589
12255
|
const generatedId = useId8();
|
|
11590
|
-
const ids =
|
|
12256
|
+
const ids = useMemo15(() => ({
|
|
11591
12257
|
container: `dialog-container-${generatedId}`,
|
|
11592
12258
|
background: `dialog-background-${generatedId}`,
|
|
11593
12259
|
content: props.id ?? `dialog-content-${generatedId}`,
|
|
11594
12260
|
title: `dialog-title-${generatedId}`,
|
|
11595
12261
|
description: `dialog-description-${generatedId}`
|
|
11596
12262
|
}), [generatedId, props.id]);
|
|
11597
|
-
const containerRef =
|
|
12263
|
+
const containerRef = useRef19(null);
|
|
11598
12264
|
const context = useContext10(DialogContext);
|
|
11599
12265
|
const isOpen = isOpenOverwrite ?? context?.isOpen ?? false;
|
|
11600
12266
|
const isModal = isModalOverwrite ?? context?.isModal ?? true;
|
|
@@ -11603,7 +12269,7 @@ var Dialog = forwardRef10(function Dialog2({
|
|
|
11603
12269
|
});
|
|
11604
12270
|
useImperativeHandle6(forwardedRef, () => ref.current, [ref]);
|
|
11605
12271
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
11606
|
-
const onCloseWrapper =
|
|
12272
|
+
const onCloseWrapper = useCallback18(() => {
|
|
11607
12273
|
if (!isModal) return;
|
|
11608
12274
|
onCloseStable();
|
|
11609
12275
|
context?.setIsOpen(false);
|
|
@@ -11687,10 +12353,10 @@ var Dialog = forwardRef10(function Dialog2({
|
|
|
11687
12353
|
});
|
|
11688
12354
|
|
|
11689
12355
|
// src/components/layout/dialog/DialogOpener.tsx
|
|
11690
|
-
import { useMemo as
|
|
12356
|
+
import { useMemo as useMemo16 } from "react";
|
|
11691
12357
|
function DialogOpenerWrapper({ children }) {
|
|
11692
12358
|
const context = useDialogContext();
|
|
11693
|
-
const bag =
|
|
12359
|
+
const bag = useMemo16(() => ({
|
|
11694
12360
|
open: () => context.setIsOpen(true),
|
|
11695
12361
|
close: () => context.setIsOpen(false),
|
|
11696
12362
|
toggleOpen: () => context.setIsOpen((prev) => !prev),
|
|
@@ -11791,117 +12457,18 @@ var DiscardChangesDialog = ({
|
|
|
11791
12457
|
{
|
|
11792
12458
|
...props,
|
|
11793
12459
|
titleElement: titleOverwrite ?? translation("unsavedChanges"),
|
|
11794
|
-
description: descriptionOverwrite ?? translation("unsavedChangesSaveQuestion"),
|
|
11795
|
-
onConfirm: onSave,
|
|
11796
|
-
onCancel,
|
|
11797
|
-
onDecline: onDontSave,
|
|
11798
|
-
buttonOverwrites: [{ text: translation("cancel") }, { text: translation("discardChanges") }, { text: translation("save") }],
|
|
11799
|
-
children
|
|
11800
|
-
}
|
|
11801
|
-
);
|
|
11802
|
-
};
|
|
11803
|
-
|
|
11804
|
-
// src/components/user-interaction/input/Input.tsx
|
|
11805
|
-
import { forwardRef as forwardRef11, useImperativeHandle as useImperativeHandle7, useRef as useRef19 } from "react";
|
|
11806
|
-
|
|
11807
|
-
// src/hooks/useDelay.ts
|
|
11808
|
-
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
11809
|
-
var defaultOptions2 = {
|
|
11810
|
-
delay: 3e3,
|
|
11811
|
-
disabled: false
|
|
11812
|
-
};
|
|
11813
|
-
function useDelay(options) {
|
|
11814
|
-
const [timer, setTimer] = useState18(void 0);
|
|
11815
|
-
const { delay, disabled } = {
|
|
11816
|
-
...defaultOptions2,
|
|
11817
|
-
...options
|
|
11818
|
-
};
|
|
11819
|
-
const clearTimer = () => {
|
|
11820
|
-
clearTimeout(timer);
|
|
11821
|
-
setTimer(void 0);
|
|
11822
|
-
};
|
|
11823
|
-
const restartTimer = (onDelayFinish) => {
|
|
11824
|
-
if (disabled) {
|
|
11825
|
-
return;
|
|
11826
|
-
}
|
|
11827
|
-
clearTimeout(timer);
|
|
11828
|
-
setTimer(setTimeout(() => {
|
|
11829
|
-
onDelayFinish();
|
|
11830
|
-
setTimer(void 0);
|
|
11831
|
-
}, delay));
|
|
11832
|
-
};
|
|
11833
|
-
useEffect19(() => {
|
|
11834
|
-
return () => {
|
|
11835
|
-
clearTimeout(timer);
|
|
11836
|
-
};
|
|
11837
|
-
}, [timer]);
|
|
11838
|
-
useEffect19(() => {
|
|
11839
|
-
if (disabled) {
|
|
11840
|
-
clearTimeout(timer);
|
|
11841
|
-
setTimer(void 0);
|
|
11842
|
-
}
|
|
11843
|
-
}, [disabled, timer]);
|
|
11844
|
-
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
11845
|
-
}
|
|
11846
|
-
|
|
11847
|
-
// src/hooks/focus/useFocusManagement.ts
|
|
11848
|
-
import { useCallback as useCallback17 } from "react";
|
|
11849
|
-
function useFocusManagement() {
|
|
11850
|
-
const getFocusableElements = useCallback17(() => {
|
|
11851
|
-
return Array.from(
|
|
11852
|
-
document.querySelectorAll(
|
|
11853
|
-
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
11854
|
-
)
|
|
11855
|
-
).filter(
|
|
11856
|
-
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
11857
|
-
);
|
|
11858
|
-
}, []);
|
|
11859
|
-
const getNextFocusElement = useCallback17(() => {
|
|
11860
|
-
const elements = getFocusableElements();
|
|
11861
|
-
if (elements.length === 0) {
|
|
11862
|
-
return void 0;
|
|
11863
|
-
}
|
|
11864
|
-
let nextElement = elements[0];
|
|
11865
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
11866
|
-
const currentIndex = elements.indexOf(document.activeElement);
|
|
11867
|
-
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
11868
|
-
}
|
|
11869
|
-
return nextElement;
|
|
11870
|
-
}, [getFocusableElements]);
|
|
11871
|
-
const focusNext = useCallback17(() => {
|
|
11872
|
-
const nextElement = getNextFocusElement();
|
|
11873
|
-
nextElement?.focus();
|
|
11874
|
-
}, [getNextFocusElement]);
|
|
11875
|
-
const getPreviousFocusElement = useCallback17(() => {
|
|
11876
|
-
const elements = getFocusableElements();
|
|
11877
|
-
if (elements.length === 0) {
|
|
11878
|
-
return void 0;
|
|
11879
|
-
}
|
|
11880
|
-
let previousElement = elements[0];
|
|
11881
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
11882
|
-
const currentIndex = elements.indexOf(document.activeElement);
|
|
11883
|
-
if (currentIndex === 0) {
|
|
11884
|
-
previousElement = elements[elements.length - 1];
|
|
11885
|
-
} else {
|
|
11886
|
-
previousElement = elements[currentIndex - 1];
|
|
11887
|
-
}
|
|
12460
|
+
description: descriptionOverwrite ?? translation("unsavedChangesSaveQuestion"),
|
|
12461
|
+
onConfirm: onSave,
|
|
12462
|
+
onCancel,
|
|
12463
|
+
onDecline: onDontSave,
|
|
12464
|
+
buttonOverwrites: [{ text: translation("cancel") }, { text: translation("discardChanges") }, { text: translation("save") }],
|
|
12465
|
+
children
|
|
11888
12466
|
}
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
const focusPrevious = useCallback17(() => {
|
|
11892
|
-
const previousElement = getPreviousFocusElement();
|
|
11893
|
-
if (previousElement) previousElement.focus();
|
|
11894
|
-
}, [getPreviousFocusElement]);
|
|
11895
|
-
return {
|
|
11896
|
-
getFocusableElements,
|
|
11897
|
-
getNextFocusElement,
|
|
11898
|
-
getPreviousFocusElement,
|
|
11899
|
-
focusNext,
|
|
11900
|
-
focusPrevious
|
|
11901
|
-
};
|
|
11902
|
-
}
|
|
12467
|
+
);
|
|
12468
|
+
};
|
|
11903
12469
|
|
|
11904
12470
|
// src/components/user-interaction/input/Input.tsx
|
|
12471
|
+
import { forwardRef as forwardRef11, useImperativeHandle as useImperativeHandle7, useRef as useRef20 } from "react";
|
|
11905
12472
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
11906
12473
|
var defaultEditCompleteOptions = {
|
|
11907
12474
|
allowEnterComplete: false,
|
|
@@ -11933,7 +12500,7 @@ var Input = forwardRef11(function Input2({
|
|
|
11933
12500
|
restartTimer,
|
|
11934
12501
|
clearTimer
|
|
11935
12502
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
11936
|
-
const innerRef =
|
|
12503
|
+
const innerRef = useRef20(null);
|
|
11937
12504
|
useImperativeHandle7(forwardedRef, () => innerRef.current);
|
|
11938
12505
|
const { focusNext } = useFocusManagement();
|
|
11939
12506
|
return /* @__PURE__ */ jsx33(
|
|
@@ -12001,7 +12568,7 @@ import {
|
|
|
12001
12568
|
} from "react";
|
|
12002
12569
|
|
|
12003
12570
|
// src/components/user-interaction/select/SelectContext.tsx
|
|
12004
|
-
import { createContext as createContext10, useCallback as
|
|
12571
|
+
import { createContext as createContext10, useCallback as useCallback19, useContext as useContext11, useEffect as useEffect28, useId as useId9, useMemo as useMemo17, useRef as useRef21, useState as useState23 } from "react";
|
|
12005
12572
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
12006
12573
|
var defaultToggleOpenOptions = {
|
|
12007
12574
|
highlightStartPositionBehavior: "first"
|
|
@@ -12042,21 +12609,21 @@ var PrimitveSelectRoot = ({
|
|
|
12042
12609
|
onValueChange: onValuesChange,
|
|
12043
12610
|
defaultValue: initialValues ?? []
|
|
12044
12611
|
});
|
|
12045
|
-
const triggerRef =
|
|
12612
|
+
const triggerRef = useRef21(null);
|
|
12046
12613
|
const generatedId = useId9();
|
|
12047
|
-
const [ids, setIds] =
|
|
12614
|
+
const [ids, setIds] = useState23({
|
|
12048
12615
|
trigger: id ?? (isMultiSelect ? "multi-select-" + generatedId : "select-" + generatedId),
|
|
12049
12616
|
content: isMultiSelect ? "multi-select-content-" + generatedId : "select-content-" + generatedId
|
|
12050
12617
|
});
|
|
12051
|
-
const [internalState, setInternalState] =
|
|
12618
|
+
const [internalState, setInternalState] = useState23({
|
|
12052
12619
|
isOpen: initialIsOpen,
|
|
12053
12620
|
options: []
|
|
12054
12621
|
});
|
|
12055
|
-
const selectedValues =
|
|
12622
|
+
const selectedValues = useMemo17(
|
|
12056
12623
|
() => isMultiSelect ? values ?? [] : [value].filter(Boolean),
|
|
12057
12624
|
[isMultiSelect, value, values]
|
|
12058
12625
|
);
|
|
12059
|
-
const selectedOptions =
|
|
12626
|
+
const selectedOptions = useMemo17(
|
|
12060
12627
|
() => selectedValues.map((value2) => internalState.options.find((option) => value2 === option.value)).filter(Boolean),
|
|
12061
12628
|
[selectedValues, internalState.options]
|
|
12062
12629
|
);
|
|
@@ -12073,7 +12640,7 @@ var PrimitveSelectRoot = ({
|
|
|
12073
12640
|
isMultiSelect,
|
|
12074
12641
|
iconAppearance
|
|
12075
12642
|
};
|
|
12076
|
-
const registerItem =
|
|
12643
|
+
const registerItem = useCallback19((item) => {
|
|
12077
12644
|
setInternalState((prev) => {
|
|
12078
12645
|
const updatedOptions = [...prev.options, item];
|
|
12079
12646
|
updatedOptions.sort((a, b) => {
|
|
@@ -12088,7 +12655,7 @@ var PrimitveSelectRoot = ({
|
|
|
12088
12655
|
};
|
|
12089
12656
|
});
|
|
12090
12657
|
}, []);
|
|
12091
|
-
const unregisterItem =
|
|
12658
|
+
const unregisterItem = useCallback19((value2) => {
|
|
12092
12659
|
setInternalState((prev) => {
|
|
12093
12660
|
const updatedOptions = prev.options.filter((i) => i.value !== value2);
|
|
12094
12661
|
return {
|
|
@@ -12137,10 +12704,10 @@ var PrimitveSelectRoot = ({
|
|
|
12137
12704
|
highlightedValue: value2
|
|
12138
12705
|
}));
|
|
12139
12706
|
};
|
|
12140
|
-
const registerTrigger =
|
|
12707
|
+
const registerTrigger = useCallback19((ref) => {
|
|
12141
12708
|
triggerRef.current = ref.current;
|
|
12142
12709
|
}, []);
|
|
12143
|
-
const unregisterTrigger =
|
|
12710
|
+
const unregisterTrigger = useCallback19(() => {
|
|
12144
12711
|
triggerRef.current = null;
|
|
12145
12712
|
}, []);
|
|
12146
12713
|
const toggleOpen = (isOpen, toggleOpenOptions) => {
|
|
@@ -12190,7 +12757,7 @@ var PrimitveSelectRoot = ({
|
|
|
12190
12757
|
highlightedValue
|
|
12191
12758
|
}));
|
|
12192
12759
|
};
|
|
12193
|
-
|
|
12760
|
+
useEffect28(() => {
|
|
12194
12761
|
if (!internalState.highlightedValue) return;
|
|
12195
12762
|
const highlighted = internalState.options.find((value2) => value2.value === internalState.highlightedValue);
|
|
12196
12763
|
if (highlighted) {
|
|
@@ -12254,35 +12821,12 @@ var MultiSelectRoot = ({ value, onValueChange, initialValue, onEditComplete, ...
|
|
|
12254
12821
|
};
|
|
12255
12822
|
|
|
12256
12823
|
// src/components/user-interaction/select/SelectComponents.tsx
|
|
12257
|
-
import { forwardRef as forwardRef13, useEffect as
|
|
12824
|
+
import { forwardRef as forwardRef13, useEffect as useEffect29, useImperativeHandle as useImperativeHandle9, useRef as useRef22 } from "react";
|
|
12258
12825
|
import clsx10 from "clsx";
|
|
12259
12826
|
import { CheckIcon } from "lucide-react";
|
|
12260
12827
|
|
|
12261
12828
|
// src/components/layout/popup/PopUp.tsx
|
|
12262
|
-
import { forwardRef as forwardRef12, useCallback as
|
|
12263
|
-
|
|
12264
|
-
// src/hooks/useOutsideClick.ts
|
|
12265
|
-
import { useEffect as useEffect21 } from "react";
|
|
12266
|
-
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12267
|
-
useEffect21(() => {
|
|
12268
|
-
if (!active) return;
|
|
12269
|
-
const listener = (event) => {
|
|
12270
|
-
if (event.target === null) return;
|
|
12271
|
-
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
12272
|
-
return;
|
|
12273
|
-
}
|
|
12274
|
-
onOutsideClick(event);
|
|
12275
|
-
};
|
|
12276
|
-
document.addEventListener("mousedown", listener);
|
|
12277
|
-
document.addEventListener("touchstart", listener);
|
|
12278
|
-
document.addEventListener("pointerdown", listener);
|
|
12279
|
-
return () => {
|
|
12280
|
-
document.removeEventListener("mousedown", listener);
|
|
12281
|
-
document.removeEventListener("touchstart", listener);
|
|
12282
|
-
document.removeEventListener("pointerdown", listener);
|
|
12283
|
-
};
|
|
12284
|
-
}, [refs, onOutsideClick, active]);
|
|
12285
|
-
};
|
|
12829
|
+
import { forwardRef as forwardRef12, useCallback as useCallback20, useContext as useContext13, useImperativeHandle as useImperativeHandle8, useMemo as useMemo18 } from "react";
|
|
12286
12830
|
|
|
12287
12831
|
// src/components/layout/popup/PopUpContext.tsx
|
|
12288
12832
|
import { createContext as createContext11, useContext as useContext12 } from "react";
|
|
@@ -12317,13 +12861,13 @@ var PopUp = forwardRef12(function PopUp2({
|
|
|
12317
12861
|
useImperativeHandle8(forwardRef23, () => ref.current, [ref]);
|
|
12318
12862
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12319
12863
|
const onOutsideClickStable = useEventCallbackStabilizer(onOutsideClick);
|
|
12320
|
-
const onCloseWrapper =
|
|
12864
|
+
const onCloseWrapper = useCallback20(() => {
|
|
12321
12865
|
onCloseStable();
|
|
12322
12866
|
context?.setIsOpen(false);
|
|
12323
12867
|
}, [onCloseStable, context]);
|
|
12324
|
-
const { zIndex, isInFront } = useOverlayRegistry({ isActive: isOpen, tags:
|
|
12868
|
+
const { zIndex, isInFront } = useOverlayRegistry({ isActive: isOpen, tags: useMemo18(() => ["popup"], []) });
|
|
12325
12869
|
useOutsideClick({
|
|
12326
|
-
onOutsideClick:
|
|
12870
|
+
onOutsideClick: useCallback20((event) => {
|
|
12327
12871
|
event.preventDefault();
|
|
12328
12872
|
onCloseWrapper();
|
|
12329
12873
|
onOutsideClickStable(event);
|
|
@@ -12365,10 +12909,10 @@ var SelectOption = forwardRef13(
|
|
|
12365
12909
|
function SelectOption2({ children, value, disabled = false, iconAppearance, className, ...restProps }, ref) {
|
|
12366
12910
|
const { state, config, item, trigger } = useSelectContext();
|
|
12367
12911
|
const { register, unregister, toggleSelection, highlightItem } = item;
|
|
12368
|
-
const itemRef =
|
|
12912
|
+
const itemRef = useRef22(null);
|
|
12369
12913
|
iconAppearance ??= config.iconAppearance;
|
|
12370
12914
|
const label = children ?? value;
|
|
12371
|
-
|
|
12915
|
+
useEffect29(() => {
|
|
12372
12916
|
register({
|
|
12373
12917
|
value,
|
|
12374
12918
|
label,
|
|
@@ -12448,7 +12992,7 @@ var SelectButton = forwardRef13(function SelectButton2({
|
|
|
12448
12992
|
const translation = useHightideTranslation();
|
|
12449
12993
|
const { state, trigger, setIds, ids } = useSelectContext();
|
|
12450
12994
|
const { register, unregister, toggleOpen } = trigger;
|
|
12451
|
-
|
|
12995
|
+
useEffect29(() => {
|
|
12452
12996
|
if (id) {
|
|
12453
12997
|
setIds((prev) => ({
|
|
12454
12998
|
...prev,
|
|
@@ -12456,9 +13000,9 @@ var SelectButton = forwardRef13(function SelectButton2({
|
|
|
12456
13000
|
}));
|
|
12457
13001
|
}
|
|
12458
13002
|
}, [id, setIds]);
|
|
12459
|
-
const innerRef =
|
|
13003
|
+
const innerRef = useRef22(null);
|
|
12460
13004
|
useImperativeHandle9(ref, () => innerRef.current);
|
|
12461
|
-
|
|
13005
|
+
useEffect29(() => {
|
|
12462
13006
|
register(innerRef);
|
|
12463
13007
|
return () => unregister();
|
|
12464
13008
|
}, [register, unregister]);
|
|
@@ -12516,10 +13060,10 @@ var SelectContent = forwardRef13(function SelectContent2({
|
|
|
12516
13060
|
options,
|
|
12517
13061
|
...props
|
|
12518
13062
|
}, ref) {
|
|
12519
|
-
const innerRef =
|
|
13063
|
+
const innerRef = useRef22(null);
|
|
12520
13064
|
useImperativeHandle9(ref, () => innerRef.current);
|
|
12521
13065
|
const { trigger, state, config, item, ids, setIds } = useSelectContext();
|
|
12522
|
-
|
|
13066
|
+
useEffect29(() => {
|
|
12523
13067
|
if (id) {
|
|
12524
13068
|
setIds((prev) => ({
|
|
12525
13069
|
...prev,
|
|
@@ -12664,7 +13208,7 @@ import { MonitorCog, MoonIcon, SunIcon } from "lucide-react";
|
|
|
12664
13208
|
import clsx12 from "clsx";
|
|
12665
13209
|
|
|
12666
13210
|
// src/global-contexts/ThemeContext.tsx
|
|
12667
|
-
import { createContext as createContext12, useCallback as
|
|
13211
|
+
import { createContext as createContext12, useCallback as useCallback21, useContext as useContext14, useEffect as useEffect30, useMemo as useMemo19, useState as useState24 } from "react";
|
|
12668
13212
|
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
12669
13213
|
var themes = ["light", "dark", "system"];
|
|
12670
13214
|
var ThemeUtil = {
|
|
@@ -12678,8 +13222,8 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
12678
13222
|
deleteValue: deleteStoredTheme
|
|
12679
13223
|
} = useStorage({ key: "theme", defaultValue: "system" });
|
|
12680
13224
|
const { config } = useHightideConfig();
|
|
12681
|
-
const [themePreference, setThemePreference] =
|
|
12682
|
-
const resolvedTheme =
|
|
13225
|
+
const [themePreference, setThemePreference] = useState24("system");
|
|
13226
|
+
const resolvedTheme = useMemo19(() => {
|
|
12683
13227
|
if (theme && theme !== "system") {
|
|
12684
13228
|
return theme;
|
|
12685
13229
|
}
|
|
@@ -12691,7 +13235,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
12691
13235
|
}
|
|
12692
13236
|
return initialTheme ?? config.theme.initialTheme;
|
|
12693
13237
|
}, [config.theme.initialTheme, initialTheme, storedTheme, theme, themePreference]);
|
|
12694
|
-
|
|
13238
|
+
useEffect30(() => {
|
|
12695
13239
|
if (!theme) return;
|
|
12696
13240
|
if (theme === "system") {
|
|
12697
13241
|
deleteStoredTheme();
|
|
@@ -12699,18 +13243,18 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
12699
13243
|
setStoredTheme(theme);
|
|
12700
13244
|
}
|
|
12701
13245
|
}, [theme, deleteStoredTheme, setStoredTheme]);
|
|
12702
|
-
|
|
13246
|
+
useEffect30(() => {
|
|
12703
13247
|
document.documentElement.setAttribute("data-theme", resolvedTheme);
|
|
12704
13248
|
}, [resolvedTheme]);
|
|
12705
|
-
const getPreference =
|
|
13249
|
+
const getPreference = useCallback21(() => {
|
|
12706
13250
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
12707
13251
|
const prefersLight = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
12708
13252
|
setThemePreference(prefersDark ? "dark" : prefersLight ? "light" : "system");
|
|
12709
13253
|
}, []);
|
|
12710
|
-
|
|
13254
|
+
useEffect30(() => {
|
|
12711
13255
|
getPreference();
|
|
12712
13256
|
}, [getPreference]);
|
|
12713
|
-
|
|
13257
|
+
useEffect30(() => {
|
|
12714
13258
|
const darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
12715
13259
|
const lightQuery = window.matchMedia("(prefers-color-scheme: light)");
|
|
12716
13260
|
const noPrefQuery = window.matchMedia("(prefers-color-scheme: no-preference)");
|
|
@@ -12813,7 +13357,7 @@ var ThemeDialog = ({
|
|
|
12813
13357
|
import { forwardRef as forwardRef16 } from "react";
|
|
12814
13358
|
|
|
12815
13359
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
12816
|
-
import { forwardRef as forwardRef15, useId as useId10, useImperativeHandle as useImperativeHandle10, useMemo as
|
|
13360
|
+
import { forwardRef as forwardRef15, useId as useId10, useImperativeHandle as useImperativeHandle10, useMemo as useMemo20, useRef as useRef23 } from "react";
|
|
12817
13361
|
|
|
12818
13362
|
// src/components/layout/drawer/DrawerContext.tsx
|
|
12819
13363
|
import { createContext as createContext13, useContext as useContext15 } from "react";
|
|
@@ -12838,12 +13382,12 @@ var DrawerContent = forwardRef15(function DrawerContent2({
|
|
|
12838
13382
|
}, forwardedRef) {
|
|
12839
13383
|
const { isOpen } = useDrawerContext();
|
|
12840
13384
|
const generatedId = useId10();
|
|
12841
|
-
const ids =
|
|
13385
|
+
const ids = useMemo20(() => ({
|
|
12842
13386
|
container: `dialog-container-${generatedId}`,
|
|
12843
13387
|
background: `dialog-background-${generatedId}`,
|
|
12844
13388
|
content: props.id ?? `dialog-content-${generatedId}`
|
|
12845
13389
|
}), [generatedId, props.id]);
|
|
12846
|
-
const ref =
|
|
13390
|
+
const ref = useRef23(null);
|
|
12847
13391
|
useImperativeHandle10(forwardedRef, () => ref.current, [ref]);
|
|
12848
13392
|
const { isVisible, transitionState } = useTransitionState({ isOpen, ref });
|
|
12849
13393
|
useFocusTrap({
|
|
@@ -12852,7 +13396,7 @@ var DrawerContent = forwardRef15(function DrawerContent2({
|
|
|
12852
13396
|
});
|
|
12853
13397
|
const { zIndex, tagPositions, tagItemCounts } = useOverlayRegistry({
|
|
12854
13398
|
isActive: isVisible,
|
|
12855
|
-
tags:
|
|
13399
|
+
tags: useMemo20(() => ["drawer"], [])
|
|
12856
13400
|
});
|
|
12857
13401
|
const depth = tagPositions && tagItemCounts ? (tagItemCounts["drawer"] ?? 0) - (tagPositions["drawer"] ?? 0) : 0;
|
|
12858
13402
|
const { setOpen } = useDrawerContext();
|
|
@@ -13005,7 +13549,7 @@ var ErrorComponent = ({
|
|
|
13005
13549
|
};
|
|
13006
13550
|
|
|
13007
13551
|
// src/components/layout/loading/LoadingAndErrorComponent.tsx
|
|
13008
|
-
import { useState as
|
|
13552
|
+
import { useState as useState25 } from "react";
|
|
13009
13553
|
|
|
13010
13554
|
// src/components/layout/loading/LoadingContainer.tsx
|
|
13011
13555
|
import { clsx as clsx14 } from "clsx";
|
|
@@ -13026,8 +13570,8 @@ var LoadingAndErrorComponent = ({
|
|
|
13026
13570
|
minimumLoadingDuration = 200,
|
|
13027
13571
|
className
|
|
13028
13572
|
}) => {
|
|
13029
|
-
const [isInMinimumLoading, setIsInMinimumLoading] =
|
|
13030
|
-
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] =
|
|
13573
|
+
const [isInMinimumLoading, setIsInMinimumLoading] = useState25(false);
|
|
13574
|
+
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = useState25(false);
|
|
13031
13575
|
if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {
|
|
13032
13576
|
setIsInMinimumLoading(true);
|
|
13033
13577
|
setTimeout(() => {
|
|
@@ -13091,8 +13635,8 @@ var BreadCrumbs = ({ crumbs }) => {
|
|
|
13091
13635
|
// src/components/layout/navigation/Navigation.tsx
|
|
13092
13636
|
var import_link2 = __toESM(require_link2());
|
|
13093
13637
|
import { Menu as MenuIcon, XIcon } from "lucide-react";
|
|
13094
|
-
import { useEffect as
|
|
13095
|
-
import { useCallback as
|
|
13638
|
+
import { useEffect as useEffect31 } from "react";
|
|
13639
|
+
import { useCallback as useCallback22, useId as useId11, useRef as useRef24, useState as useState26 } from "react";
|
|
13096
13640
|
import clsx17 from "clsx";
|
|
13097
13641
|
import { Fragment as Fragment5, jsx as jsx51, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
13098
13642
|
function isSubItem(item) {
|
|
@@ -13104,9 +13648,9 @@ var NavigationItemWithSubItem = ({
|
|
|
13104
13648
|
horizontalAlignment = "center",
|
|
13105
13649
|
...options
|
|
13106
13650
|
}) => {
|
|
13107
|
-
const [isOpen, setOpen] =
|
|
13108
|
-
const containerRef =
|
|
13109
|
-
const triggerRef =
|
|
13651
|
+
const [isOpen, setOpen] = useState26(false);
|
|
13652
|
+
const containerRef = useRef24(null);
|
|
13653
|
+
const triggerRef = useRef24(null);
|
|
13110
13654
|
const id = useId11();
|
|
13111
13655
|
const style = useAnchoredPosition({
|
|
13112
13656
|
active: isOpen,
|
|
@@ -13115,7 +13659,7 @@ var NavigationItemWithSubItem = ({
|
|
|
13115
13659
|
horizontalAlignment,
|
|
13116
13660
|
...options
|
|
13117
13661
|
});
|
|
13118
|
-
const onBlur =
|
|
13662
|
+
const onBlur = useCallback22((event) => {
|
|
13119
13663
|
const nextFocus = event.relatedTarget;
|
|
13120
13664
|
if (!containerRef.current?.contains(nextFocus) && !triggerRef.current?.contains(nextFocus)) {
|
|
13121
13665
|
setOpen(false);
|
|
@@ -13181,10 +13725,10 @@ var NavigationItemList = ({ items, ...restProps }) => {
|
|
|
13181
13725
|
};
|
|
13182
13726
|
var Navigation = ({ ...props }) => {
|
|
13183
13727
|
const translation = useHightideTranslation();
|
|
13184
|
-
const [isMobileOpen, setIsMobileOpen] =
|
|
13728
|
+
const [isMobileOpen, setIsMobileOpen] = useState26(false);
|
|
13185
13729
|
const id = useId11();
|
|
13186
|
-
const menuRef =
|
|
13187
|
-
|
|
13730
|
+
const menuRef = useRef24(null);
|
|
13731
|
+
useEffect31(() => {
|
|
13188
13732
|
menuRef.current?.focus();
|
|
13189
13733
|
}, [isMobileOpen]);
|
|
13190
13734
|
const { zIndex } = useOverlayRegistry({ isActive: isMobileOpen });
|
|
@@ -13252,7 +13796,7 @@ var Navigation = ({ ...props }) => {
|
|
|
13252
13796
|
// src/components/layout/navigation/Pagination.tsx
|
|
13253
13797
|
import { ChevronFirst, ChevronLast, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
13254
13798
|
import clsx18 from "clsx";
|
|
13255
|
-
import { useEffect as
|
|
13799
|
+
import { useEffect as useEffect32, useState as useState27 } from "react";
|
|
13256
13800
|
import { jsx as jsx52, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
13257
13801
|
var Pagination = ({
|
|
13258
13802
|
pageIndex,
|
|
@@ -13261,11 +13805,11 @@ var Pagination = ({
|
|
|
13261
13805
|
...props
|
|
13262
13806
|
}) => {
|
|
13263
13807
|
const translation = useHightideTranslation();
|
|
13264
|
-
const [value, setValue] =
|
|
13808
|
+
const [value, setValue] = useState27((pageIndex + 1).toString());
|
|
13265
13809
|
const noPages = pageCount === 0;
|
|
13266
13810
|
const onFirstPage = pageIndex === 0 && !noPages;
|
|
13267
13811
|
const onLastPage = pageIndex === pageCount - 1;
|
|
13268
|
-
|
|
13812
|
+
useEffect32(() => {
|
|
13269
13813
|
if (noPages) {
|
|
13270
13814
|
setValue("0");
|
|
13271
13815
|
} else {
|
|
@@ -13459,18 +14003,18 @@ var StepperBar = ({
|
|
|
13459
14003
|
};
|
|
13460
14004
|
|
|
13461
14005
|
// src/components/layout/popup/PopUpOpener.tsx
|
|
13462
|
-
import { useEffect as
|
|
14006
|
+
import { useEffect as useEffect33, useMemo as useMemo21, useRef as useRef25 } from "react";
|
|
13463
14007
|
function PopUpOpener({ children }) {
|
|
13464
14008
|
const context = usePopUpContext();
|
|
13465
14009
|
const { setTriggerRef } = context;
|
|
13466
|
-
const ref =
|
|
13467
|
-
|
|
14010
|
+
const ref = useRef25(null);
|
|
14011
|
+
useEffect33(() => {
|
|
13468
14012
|
setTriggerRef(ref);
|
|
13469
14013
|
return () => {
|
|
13470
14014
|
setTriggerRef(null);
|
|
13471
14015
|
};
|
|
13472
14016
|
}, [setTriggerRef]);
|
|
13473
|
-
const bag =
|
|
14017
|
+
const bag = useMemo21(() => ({
|
|
13474
14018
|
open: () => context.setIsOpen(true),
|
|
13475
14019
|
close: () => context.setIsOpen(false),
|
|
13476
14020
|
toggleOpen: () => context.setIsOpen((prev) => !prev),
|
|
@@ -13488,7 +14032,7 @@ function PopUpOpener({ children }) {
|
|
|
13488
14032
|
}
|
|
13489
14033
|
|
|
13490
14034
|
// src/components/layout/popup/PopUpRoot.tsx
|
|
13491
|
-
import { useId as useId12, useMemo as
|
|
14035
|
+
import { useId as useId12, useMemo as useMemo22, useState as useState28 } from "react";
|
|
13492
14036
|
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
13493
14037
|
function PopUpRoot({
|
|
13494
14038
|
children,
|
|
@@ -13505,10 +14049,10 @@ function PopUpRoot({
|
|
|
13505
14049
|
onValueChange: onIsOpenChange,
|
|
13506
14050
|
defaultValue: initialIsOpen
|
|
13507
14051
|
});
|
|
13508
|
-
const [triggerRef, setTriggerRef] =
|
|
13509
|
-
const popUpId =
|
|
13510
|
-
const triggerId =
|
|
13511
|
-
const contextValue =
|
|
14052
|
+
const [triggerRef, setTriggerRef] = useState28(null);
|
|
14053
|
+
const popUpId = useMemo22(() => popUpIdOverwrite ?? `pop-up-${generatedPopUpId}`, [popUpIdOverwrite, generatedPopUpId]);
|
|
14054
|
+
const triggerId = useMemo22(() => triggerIdOverwrite ?? `pop-up-trigger-${generatedTriggerId}`, [triggerIdOverwrite, generatedTriggerId]);
|
|
14055
|
+
const contextValue = useMemo22(() => ({
|
|
13512
14056
|
isOpen,
|
|
13513
14057
|
setIsOpen,
|
|
13514
14058
|
popUpId,
|
|
@@ -13695,7 +14239,7 @@ var FillerCell = ({ ...props }) => {
|
|
|
13695
14239
|
};
|
|
13696
14240
|
|
|
13697
14241
|
// src/components/layout/table/TableProvider.tsx
|
|
13698
|
-
import { useCallback as
|
|
14242
|
+
import { useCallback as useCallback23, useEffect as useEffect34, useLayoutEffect as useLayoutEffect7, useMemo as useMemo23, useRef as useRef26, useState as useState29 } from "react";
|
|
13699
14243
|
|
|
13700
14244
|
// src/components/layout/table/TableContext.tsx
|
|
13701
14245
|
import { createContext as createContext14, useContext as useContext16 } from "react";
|
|
@@ -14094,9 +14638,9 @@ var TableProvider = ({
|
|
|
14094
14638
|
}) => {
|
|
14095
14639
|
const onRowClickStable = useEventCallbackStabilizer(onRowClick);
|
|
14096
14640
|
const onFillerRowClickStable = useEventCallbackStabilizer(onFillerRowClick);
|
|
14097
|
-
const [registeredColumns, setRegisteredColumns] =
|
|
14098
|
-
const containerRef =
|
|
14099
|
-
const [, setTableState] =
|
|
14641
|
+
const [registeredColumns, setRegisteredColumns] = useState29([]);
|
|
14642
|
+
const containerRef = useRef26(null);
|
|
14643
|
+
const [, setTableState] = useState29({
|
|
14100
14644
|
columnSizing: {},
|
|
14101
14645
|
columnOrder: [],
|
|
14102
14646
|
columnFilters: [],
|
|
@@ -14121,16 +14665,16 @@ var TableProvider = ({
|
|
|
14121
14665
|
pageSize: 10
|
|
14122
14666
|
}
|
|
14123
14667
|
});
|
|
14124
|
-
const [targetWidth, setTargetWidth] =
|
|
14125
|
-
|
|
14668
|
+
const [targetWidth, setTargetWidth] = useState29(void 0);
|
|
14669
|
+
useLayoutEffect7(() => {
|
|
14126
14670
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
14127
14671
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
14128
14672
|
}, [containerRef]);
|
|
14129
|
-
useWindowResizeObserver(
|
|
14673
|
+
useWindowResizeObserver(useCallback23(() => {
|
|
14130
14674
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
14131
14675
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
14132
14676
|
}, [containerRef]));
|
|
14133
|
-
const registerColumn =
|
|
14677
|
+
const registerColumn = useCallback23((column) => {
|
|
14134
14678
|
setRegisteredColumns((prev) => {
|
|
14135
14679
|
return [...prev, column];
|
|
14136
14680
|
});
|
|
@@ -14140,7 +14684,7 @@ var TableProvider = ({
|
|
|
14140
14684
|
});
|
|
14141
14685
|
};
|
|
14142
14686
|
}, []);
|
|
14143
|
-
const columns =
|
|
14687
|
+
const columns = useMemo23(() => {
|
|
14144
14688
|
const contextColumns = Array.from(registeredColumns.values());
|
|
14145
14689
|
if (columnsProp) {
|
|
14146
14690
|
return [...contextColumns, ...columnsProp];
|
|
@@ -14157,7 +14701,7 @@ var TableProvider = ({
|
|
|
14157
14701
|
defaultColumn: {
|
|
14158
14702
|
minSize: 60,
|
|
14159
14703
|
maxSize: 800,
|
|
14160
|
-
cell:
|
|
14704
|
+
cell: useCallback23(({ cell }) => {
|
|
14161
14705
|
return /* @__PURE__ */ jsx57(TableCell, { children: String(cell.getValue()) });
|
|
14162
14706
|
}, []),
|
|
14163
14707
|
enableResizing: true,
|
|
@@ -14198,7 +14742,7 @@ var TableProvider = ({
|
|
|
14198
14742
|
});
|
|
14199
14743
|
const pagination = table.getState().pagination;
|
|
14200
14744
|
const pageCount = table.getPageCount();
|
|
14201
|
-
|
|
14745
|
+
useEffect34(() => {
|
|
14202
14746
|
if (pageCount === -1) {
|
|
14203
14747
|
return;
|
|
14204
14748
|
}
|
|
@@ -14206,20 +14750,20 @@ var TableProvider = ({
|
|
|
14206
14750
|
table.setPageIndex(pageCount - 1);
|
|
14207
14751
|
}
|
|
14208
14752
|
}, [table, pagination.pageIndex, pageCount]);
|
|
14209
|
-
|
|
14753
|
+
useEffect34(() => {
|
|
14210
14754
|
table.setColumnOrder((prev) => [...prev]);
|
|
14211
14755
|
}, [table, columns]);
|
|
14212
14756
|
const columnVisibility = table.getState().columnVisibility;
|
|
14213
14757
|
const columnOrder = table.getState().columnOrder;
|
|
14214
14758
|
const columnPinning = table.getState().columnPinning;
|
|
14215
|
-
|
|
14759
|
+
useEffect34(() => {
|
|
14216
14760
|
table.setColumnSizing((prev) => ({ ...prev }));
|
|
14217
14761
|
}, [table, targetWidth, columnVisibility, columnOrder, columnPinning]);
|
|
14218
|
-
const tableColumnDefinitionContextValue =
|
|
14762
|
+
const tableColumnDefinitionContextValue = useMemo23(() => ({
|
|
14219
14763
|
table,
|
|
14220
14764
|
registerColumn
|
|
14221
14765
|
}), [table, registerColumn]);
|
|
14222
|
-
const tableContainerContextValue =
|
|
14766
|
+
const tableContainerContextValue = useMemo23(() => ({
|
|
14223
14767
|
table,
|
|
14224
14768
|
containerRef
|
|
14225
14769
|
}), [table, containerRef]);
|
|
@@ -14228,7 +14772,7 @@ var TableProvider = ({
|
|
|
14228
14772
|
return rest;
|
|
14229
14773
|
})();
|
|
14230
14774
|
const rowModel = table.getRowModel();
|
|
14231
|
-
const tableStateWithoutSizingContextValue =
|
|
14775
|
+
const tableStateWithoutSizingContextValue = useMemo23(() => ({
|
|
14232
14776
|
table,
|
|
14233
14777
|
isUsingFillerRows,
|
|
14234
14778
|
fillerRowCell,
|
|
@@ -14271,7 +14815,7 @@ var TableProvider = ({
|
|
|
14271
14815
|
]);
|
|
14272
14816
|
const columnSizing = table.getState().columnSizing;
|
|
14273
14817
|
const columnSizingInfo = table.getState().columnSizingInfo;
|
|
14274
|
-
const tableStateContextValue =
|
|
14818
|
+
const tableStateContextValue = useMemo23(() => ({
|
|
14275
14819
|
...tableStateWithoutSizingContextValue,
|
|
14276
14820
|
sizeVars: ColumnSizeUtil.toSizeVars(columnSizing),
|
|
14277
14821
|
columnSizingInfo,
|
|
@@ -14282,10 +14826,10 @@ var TableProvider = ({
|
|
|
14282
14826
|
|
|
14283
14827
|
// src/components/layout/table/TableBody.tsx
|
|
14284
14828
|
import { flexRender } from "@tanstack/react-table";
|
|
14285
|
-
import
|
|
14829
|
+
import React7 from "react";
|
|
14286
14830
|
import clsx20 from "clsx";
|
|
14287
14831
|
import { jsx as jsx58, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
14288
|
-
var TableBody =
|
|
14832
|
+
var TableBody = React7.memo(function TableBodyVisual() {
|
|
14289
14833
|
const { table, isUsingFillerRows, fillerRowCell, onRowClick, onFillerRowClick } = useTableStateWithoutSizingContext();
|
|
14290
14834
|
const rows = table.getRowModel().rows;
|
|
14291
14835
|
const columnOrder = table.getState().columnOrder;
|
|
@@ -14383,15 +14927,15 @@ var TableSortButton = ({
|
|
|
14383
14927
|
|
|
14384
14928
|
// src/components/layout/table/TableFilterButton.tsx
|
|
14385
14929
|
import { FilterIcon } from "lucide-react";
|
|
14386
|
-
import { useEffect as
|
|
14930
|
+
import { useEffect as useEffect39, useId as useId15, useMemo as useMemo28, useRef as useRef31, useState as useState34 } from "react";
|
|
14387
14931
|
|
|
14388
14932
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
14389
|
-
import { forwardRef as forwardRef17, useCallback as
|
|
14933
|
+
import { forwardRef as forwardRef17, useCallback as useCallback26, useEffect as useEffect38, useId as useId13, useImperativeHandle as useImperativeHandle11, useMemo as useMemo26, useRef as useRef30, useState as useState32 } from "react";
|
|
14390
14934
|
import { CalendarIcon } from "lucide-react";
|
|
14391
14935
|
import clsx24 from "clsx";
|
|
14392
14936
|
|
|
14393
14937
|
// src/components/user-interaction/date/TimePicker.tsx
|
|
14394
|
-
import { useEffect as
|
|
14938
|
+
import { useEffect as useEffect35, useRef as useRef27 } from "react";
|
|
14395
14939
|
import { jsx as jsx60, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
14396
14940
|
var TimePicker = ({
|
|
14397
14941
|
value: controlledValue,
|
|
@@ -14407,8 +14951,8 @@ var TimePicker = ({
|
|
|
14407
14951
|
onValueChange,
|
|
14408
14952
|
defaultValue: initialValue
|
|
14409
14953
|
});
|
|
14410
|
-
const minuteRef =
|
|
14411
|
-
const hourRef =
|
|
14954
|
+
const minuteRef = useRef27(null);
|
|
14955
|
+
const hourRef = useRef27(null);
|
|
14412
14956
|
const isPM = value.getHours() > 11;
|
|
14413
14957
|
const hours = is24HourFormat ? range(24) : range(12);
|
|
14414
14958
|
let minutes = range(60);
|
|
@@ -14428,13 +14972,13 @@ var TimePicker = ({
|
|
|
14428
14972
|
}
|
|
14429
14973
|
const closestMinute = closestMatch(minutes, (item1, item2) => Math.abs(item1 - value.getMinutes()) < Math.abs(item2 - value.getMinutes()));
|
|
14430
14974
|
const hour = value.getHours();
|
|
14431
|
-
|
|
14975
|
+
useEffect35(() => {
|
|
14432
14976
|
minuteRef.current?.scrollIntoView({
|
|
14433
14977
|
behavior: "smooth",
|
|
14434
14978
|
block: "nearest"
|
|
14435
14979
|
});
|
|
14436
14980
|
}, [closestMinute]);
|
|
14437
|
-
|
|
14981
|
+
useEffect35(() => {
|
|
14438
14982
|
hourRef.current?.scrollIntoView({
|
|
14439
14983
|
behavior: "smooth",
|
|
14440
14984
|
block: "nearest"
|
|
@@ -14503,179 +15047,12 @@ var TimePicker = ({
|
|
|
14503
15047
|
};
|
|
14504
15048
|
|
|
14505
15049
|
// src/components/user-interaction/date/DatePicker.tsx
|
|
14506
|
-
import { useState as
|
|
15050
|
+
import { useState as useState31 } from "react";
|
|
14507
15051
|
import { ArrowDown, ArrowUp, Calendar, ChevronDown as ChevronDown4 } from "lucide-react";
|
|
14508
|
-
|
|
14509
|
-
// src/utils/date.ts
|
|
14510
|
-
var timesInSeconds = {
|
|
14511
|
-
second: 1,
|
|
14512
|
-
minute: 60,
|
|
14513
|
-
hour: 3600,
|
|
14514
|
-
day: 86400,
|
|
14515
|
-
week: 604800,
|
|
14516
|
-
monthImprecise: 2629800,
|
|
14517
|
-
// 30.4375 days
|
|
14518
|
-
yearImprecise: 31557600
|
|
14519
|
-
// 365.25 days
|
|
14520
|
-
};
|
|
14521
|
-
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14522
|
-
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14523
|
-
var changeDuration = (date, duration, isAdding) => {
|
|
14524
|
-
const {
|
|
14525
|
-
years = 0,
|
|
14526
|
-
months = 0,
|
|
14527
|
-
days = 0,
|
|
14528
|
-
hours = 0,
|
|
14529
|
-
minutes = 0,
|
|
14530
|
-
seconds = 0,
|
|
14531
|
-
milliseconds = 0
|
|
14532
|
-
} = duration;
|
|
14533
|
-
if (years < 0) {
|
|
14534
|
-
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14535
|
-
return new Date(date);
|
|
14536
|
-
}
|
|
14537
|
-
if (months < 0 || months > 11) {
|
|
14538
|
-
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14539
|
-
return new Date(date);
|
|
14540
|
-
}
|
|
14541
|
-
if (days < 0) {
|
|
14542
|
-
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14543
|
-
return new Date(date);
|
|
14544
|
-
}
|
|
14545
|
-
if (hours < 0 || hours > 23) {
|
|
14546
|
-
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14547
|
-
return new Date(date);
|
|
14548
|
-
}
|
|
14549
|
-
if (minutes < 0 || minutes > 59) {
|
|
14550
|
-
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14551
|
-
return new Date(date);
|
|
14552
|
-
}
|
|
14553
|
-
if (seconds < 0 || seconds > 59) {
|
|
14554
|
-
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14555
|
-
return new Date(date);
|
|
14556
|
-
}
|
|
14557
|
-
if (milliseconds < 0) {
|
|
14558
|
-
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14559
|
-
return new Date(date);
|
|
14560
|
-
}
|
|
14561
|
-
const multiplier = isAdding ? 1 : -1;
|
|
14562
|
-
const newDate = new Date(date);
|
|
14563
|
-
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14564
|
-
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14565
|
-
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14566
|
-
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14567
|
-
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14568
|
-
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14569
|
-
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14570
|
-
return newDate;
|
|
14571
|
-
};
|
|
14572
|
-
var addDuration = (date, duration) => {
|
|
14573
|
-
return changeDuration(date, duration, true);
|
|
14574
|
-
};
|
|
14575
|
-
var subtractDuration = (date, duration) => {
|
|
14576
|
-
return changeDuration(date, duration, false);
|
|
14577
|
-
};
|
|
14578
|
-
var between = (value, startDate, endDate) => {
|
|
14579
|
-
if (startDate && endDate) {
|
|
14580
|
-
console.assert(startDate <= endDate);
|
|
14581
|
-
return startDate <= value && value <= endDate;
|
|
14582
|
-
} else if (startDate) {
|
|
14583
|
-
return startDate <= value;
|
|
14584
|
-
} else if (endDate) {
|
|
14585
|
-
return endDate >= value;
|
|
14586
|
-
} else {
|
|
14587
|
-
return true;
|
|
14588
|
-
}
|
|
14589
|
-
};
|
|
14590
|
-
var equalDate = (date1, date2) => {
|
|
14591
|
-
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14592
|
-
};
|
|
14593
|
-
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14594
|
-
const month = date.getMonth();
|
|
14595
|
-
const year = date.getFullYear();
|
|
14596
|
-
const dayList = [];
|
|
14597
|
-
let currentDate = new Date(year, month, 1);
|
|
14598
|
-
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14599
|
-
while (currentDate.getDay() !== weekStartIndex) {
|
|
14600
|
-
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14601
|
-
}
|
|
14602
|
-
while (dayList.length < 7 * weeks) {
|
|
14603
|
-
const date2 = new Date(currentDate);
|
|
14604
|
-
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14605
|
-
dayList.push(date2);
|
|
14606
|
-
currentDate = addDuration(currentDate, { days: 1 });
|
|
14607
|
-
}
|
|
14608
|
-
return equalSizeGroups(dayList, 7);
|
|
14609
|
-
};
|
|
14610
|
-
var formatAbsolute = (date, locale, format) => {
|
|
14611
|
-
let options;
|
|
14612
|
-
switch (format) {
|
|
14613
|
-
case "date":
|
|
14614
|
-
options = {
|
|
14615
|
-
year: "2-digit",
|
|
14616
|
-
month: "2-digit",
|
|
14617
|
-
day: "2-digit"
|
|
14618
|
-
};
|
|
14619
|
-
break;
|
|
14620
|
-
case "time":
|
|
14621
|
-
options = {
|
|
14622
|
-
hour: "2-digit",
|
|
14623
|
-
minute: "2-digit"
|
|
14624
|
-
};
|
|
14625
|
-
break;
|
|
14626
|
-
case "dateTime":
|
|
14627
|
-
options = {
|
|
14628
|
-
year: "numeric",
|
|
14629
|
-
month: "2-digit",
|
|
14630
|
-
day: "2-digit",
|
|
14631
|
-
hour: "2-digit",
|
|
14632
|
-
minute: "2-digit"
|
|
14633
|
-
};
|
|
14634
|
-
break;
|
|
14635
|
-
}
|
|
14636
|
-
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14637
|
-
};
|
|
14638
|
-
var formatRelative = (date, locale) => {
|
|
14639
|
-
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14640
|
-
const now = /* @__PURE__ */ new Date();
|
|
14641
|
-
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14642
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14643
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
14644
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
14645
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
14646
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
14647
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
14648
|
-
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
14649
|
-
};
|
|
14650
|
-
var toInputString = (date, format) => {
|
|
14651
|
-
switch (format) {
|
|
14652
|
-
case "date":
|
|
14653
|
-
return date.toISOString().split("T")[0];
|
|
14654
|
-
case "time":
|
|
14655
|
-
return date.toISOString().split("T")[1].split("Z")[0];
|
|
14656
|
-
case "dateTime":
|
|
14657
|
-
return date.toISOString();
|
|
14658
|
-
}
|
|
14659
|
-
};
|
|
14660
|
-
var DateUtils = {
|
|
14661
|
-
monthsList,
|
|
14662
|
-
weekDayList,
|
|
14663
|
-
equalDate,
|
|
14664
|
-
formatAbsolute,
|
|
14665
|
-
formatRelative,
|
|
14666
|
-
addDuration,
|
|
14667
|
-
subtractDuration,
|
|
14668
|
-
between,
|
|
14669
|
-
weeksForCalenderMonth,
|
|
14670
|
-
timesInSeconds,
|
|
14671
|
-
toInputString
|
|
14672
|
-
};
|
|
14673
|
-
|
|
14674
|
-
// src/components/user-interaction/date/DatePicker.tsx
|
|
14675
15052
|
import clsx23 from "clsx";
|
|
14676
15053
|
|
|
14677
15054
|
// src/components/user-interaction/date/DayPicker.tsx
|
|
14678
|
-
import { useCallback as
|
|
15055
|
+
import { useCallback as useCallback24, useEffect as useEffect36, useMemo as useMemo24, useRef as useRef28 } from "react";
|
|
14679
15056
|
import { jsx as jsx61, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
14680
15057
|
var DayPicker = ({
|
|
14681
15058
|
displayedMonth: controlledDisplayedMonth,
|
|
@@ -14704,33 +15081,33 @@ var DayPicker = ({
|
|
|
14704
15081
|
});
|
|
14705
15082
|
const month = displayedMonth.getMonth();
|
|
14706
15083
|
const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
|
|
14707
|
-
const selectedButtonRef =
|
|
14708
|
-
const isValueInDisplayedWeeks =
|
|
15084
|
+
const selectedButtonRef = useRef28(null);
|
|
15085
|
+
const isValueInDisplayedWeeks = useMemo24(
|
|
14709
15086
|
() => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
|
|
14710
15087
|
[value, weeks]
|
|
14711
15088
|
);
|
|
14712
|
-
const firstDayOfMonth =
|
|
15089
|
+
const firstDayOfMonth = useCallback24(
|
|
14713
15090
|
(date) => new Date(date.getFullYear(), date.getMonth(), 1),
|
|
14714
15091
|
[]
|
|
14715
15092
|
);
|
|
14716
15093
|
const focusTargetDate = value && isValueInDisplayedWeeks ? value : firstDayOfMonth(displayedMonth);
|
|
14717
|
-
|
|
15094
|
+
useEffect36(() => {
|
|
14718
15095
|
selectedButtonRef.current?.focus();
|
|
14719
15096
|
}, [focusTargetDate]);
|
|
14720
|
-
const end =
|
|
15097
|
+
const end = useMemo24(() => {
|
|
14721
15098
|
if (!providedEnd) return;
|
|
14722
15099
|
return new Date(providedEnd.getFullYear(), providedEnd.getMonth(), providedEnd.getDate());
|
|
14723
15100
|
}, [providedEnd]);
|
|
14724
|
-
const start =
|
|
15101
|
+
const start = useMemo24(() => {
|
|
14725
15102
|
if (!providedStart) return;
|
|
14726
15103
|
return new Date(providedStart.getFullYear(), providedStart.getMonth(), providedStart.getDate());
|
|
14727
15104
|
}, [providedStart]);
|
|
14728
|
-
const clampToRange =
|
|
15105
|
+
const clampToRange = useCallback24((date) => {
|
|
14729
15106
|
if (start && date < start) return start;
|
|
14730
15107
|
if (end && date > end) return end;
|
|
14731
15108
|
return date;
|
|
14732
15109
|
}, [start, end]);
|
|
14733
|
-
const navigateTo =
|
|
15110
|
+
const navigateTo = useCallback24((candidate) => {
|
|
14734
15111
|
const clamped = clampToRange(candidate);
|
|
14735
15112
|
if (!DateUtils.between(clamped, start, end)) return;
|
|
14736
15113
|
setValue(clamped);
|
|
@@ -14739,7 +15116,7 @@ var DayPicker = ({
|
|
|
14739
15116
|
setDisplayedMonth(firstDayOfMonth(clamped));
|
|
14740
15117
|
}
|
|
14741
15118
|
}, [clampToRange, start, end, setValue, onEditComplete, displayedMonth, setDisplayedMonth, firstDayOfMonth]);
|
|
14742
|
-
const onKeyDown =
|
|
15119
|
+
const onKeyDown = useCallback24(
|
|
14743
15120
|
(event) => {
|
|
14744
15121
|
PropsUtil.aria.navigate({
|
|
14745
15122
|
left: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 1 })),
|
|
@@ -14795,7 +15172,7 @@ var DayPicker = ({
|
|
|
14795
15172
|
};
|
|
14796
15173
|
|
|
14797
15174
|
// src/components/user-interaction/date/YearMonthPicker.tsx
|
|
14798
|
-
import { memo, useCallback as
|
|
15175
|
+
import { memo, useCallback as useCallback25, useEffect as useEffect37, useMemo as useMemo25, useRef as useRef29, useState as useState30 } from "react";
|
|
14799
15176
|
import clsx22 from "clsx";
|
|
14800
15177
|
import { jsx as jsx62, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
14801
15178
|
var YearRow = memo(function YearRow2({
|
|
@@ -14806,15 +15183,15 @@ var YearRow = memo(function YearRow2({
|
|
|
14806
15183
|
monthNames,
|
|
14807
15184
|
onSelect
|
|
14808
15185
|
}) {
|
|
14809
|
-
const ref =
|
|
15186
|
+
const ref = useRef29(null);
|
|
14810
15187
|
const isSelectedYear = selectedMonthIndex !== void 0;
|
|
14811
|
-
const [isExpanded, setIsExpanded] =
|
|
14812
|
-
|
|
15188
|
+
const [isExpanded, setIsExpanded] = useState30(false);
|
|
15189
|
+
useEffect37(() => {
|
|
14813
15190
|
if (isSelectedYear) {
|
|
14814
15191
|
ref.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
14815
15192
|
}
|
|
14816
15193
|
}, [isSelectedYear]);
|
|
14817
|
-
const monthGrid =
|
|
15194
|
+
const monthGrid = useMemo25(() => equalSizeGroups([...DateUtils.monthsList], 3), []);
|
|
14818
15195
|
return /* @__PURE__ */ jsxs32(
|
|
14819
15196
|
ExpandableRoot,
|
|
14820
15197
|
{
|
|
@@ -14869,23 +15246,23 @@ var YearMonthPicker = ({
|
|
|
14869
15246
|
defaultValue: initialValue
|
|
14870
15247
|
});
|
|
14871
15248
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
14872
|
-
const monthNames =
|
|
15249
|
+
const monthNames = useMemo25(() => {
|
|
14873
15250
|
const formatter = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
14874
15251
|
return Array.from({ length: 12 }, (_, i) => formatter.format(new Date(2e3, i, 1)));
|
|
14875
15252
|
}, [locale]);
|
|
14876
|
-
const years =
|
|
15253
|
+
const years = useMemo25(
|
|
14877
15254
|
() => range([start.getFullYear(), end.getFullYear()], { exclusiveEnd: false }),
|
|
14878
15255
|
[start, end]
|
|
14879
15256
|
);
|
|
14880
|
-
const minTimestamp =
|
|
15257
|
+
const minTimestamp = useMemo25(() => {
|
|
14881
15258
|
if (!start) return;
|
|
14882
15259
|
return new Date(start.getFullYear(), start.getMonth(), 1).getTime();
|
|
14883
15260
|
}, [start]);
|
|
14884
|
-
const maxTimestamp =
|
|
15261
|
+
const maxTimestamp = useMemo25(() => {
|
|
14885
15262
|
if (!end) return;
|
|
14886
15263
|
return new Date(end.getFullYear(), end.getMonth() + 1, 0).getTime();
|
|
14887
15264
|
}, [end]);
|
|
14888
|
-
const handleSelect =
|
|
15265
|
+
const handleSelect = useCallback25((newDate) => {
|
|
14889
15266
|
setValue(newDate);
|
|
14890
15267
|
onEditCompleteStable(newDate);
|
|
14891
15268
|
}, [onEditCompleteStable, setValue]);
|
|
@@ -14938,8 +15315,8 @@ var DatePicker = ({
|
|
|
14938
15315
|
onValueChange,
|
|
14939
15316
|
defaultValue: initialValue
|
|
14940
15317
|
});
|
|
14941
|
-
const [displayedMonth, setDisplayedMonth] =
|
|
14942
|
-
const [displayMode, setDisplayMode] =
|
|
15318
|
+
const [displayedMonth, setDisplayedMonth] = useState31(new Date(value.getFullYear(), value.getMonth(), 1));
|
|
15319
|
+
const [displayMode, setDisplayMode] = useState31(initialDisplay);
|
|
14943
15320
|
return /* @__PURE__ */ jsxs33("div", { className: clsx23("flex-col-3", className), children: [
|
|
14944
15321
|
/* @__PURE__ */ jsxs33("div", { className: "flex-row-2 items-center justify-between", children: [
|
|
14945
15322
|
/* @__PURE__ */ jsxs33(
|
|
@@ -15195,31 +15572,31 @@ var DateTimeInput = forwardRef17(function DateTimeInput2({
|
|
|
15195
15572
|
...props
|
|
15196
15573
|
}, forwardedRef) {
|
|
15197
15574
|
const translation = useHightideTranslation();
|
|
15198
|
-
const [isOpen, setIsOpen] =
|
|
15575
|
+
const [isOpen, setIsOpen] = useState32(false);
|
|
15199
15576
|
const [state, setState] = useControlledState({
|
|
15200
15577
|
value,
|
|
15201
15578
|
onValueChange,
|
|
15202
15579
|
defaultValue: initialValue
|
|
15203
15580
|
});
|
|
15204
|
-
const [dialogValue, setDialogValue] =
|
|
15205
|
-
const [dateString, setDateString] =
|
|
15206
|
-
|
|
15581
|
+
const [dialogValue, setDialogValue] = useState32(state ?? /* @__PURE__ */ new Date());
|
|
15582
|
+
const [dateString, setDateString] = useState32(state ? DateUtils.toInputString(state, mode) : "");
|
|
15583
|
+
useEffect38(() => {
|
|
15207
15584
|
setDialogValue(state ?? /* @__PURE__ */ new Date());
|
|
15208
15585
|
setDateString(state ? DateUtils.toInputString(state, mode) : "");
|
|
15209
15586
|
}, [mode, state]);
|
|
15210
|
-
const changeOpenWrapper =
|
|
15587
|
+
const changeOpenWrapper = useCallback26((isOpen2) => {
|
|
15211
15588
|
onDialogOpeningChange?.(isOpen2);
|
|
15212
15589
|
setIsOpen(isOpen2);
|
|
15213
15590
|
}, [onDialogOpeningChange]);
|
|
15214
15591
|
const generatedId = useId13();
|
|
15215
|
-
const ids =
|
|
15592
|
+
const ids = useMemo26(() => ({
|
|
15216
15593
|
input: inputId ?? `date-time-input-${generatedId}`,
|
|
15217
15594
|
popup: `date-time-input-popup-${generatedId}`,
|
|
15218
15595
|
label: `date-time-input-label-${generatedId}`
|
|
15219
15596
|
}), [generatedId, inputId]);
|
|
15220
|
-
const innerRef =
|
|
15597
|
+
const innerRef = useRef30(null);
|
|
15221
15598
|
useImperativeHandle11(forwardedRef, () => innerRef.current);
|
|
15222
|
-
|
|
15599
|
+
useEffect38(() => {
|
|
15223
15600
|
if (readOnly || disabled) {
|
|
15224
15601
|
changeOpenWrapper(false);
|
|
15225
15602
|
}
|
|
@@ -15307,7 +15684,7 @@ var DateTimeInput = forwardRef17(function DateTimeInput2({
|
|
|
15307
15684
|
});
|
|
15308
15685
|
|
|
15309
15686
|
// src/components/layout/table/TableFilterPopups.tsx
|
|
15310
|
-
import { useId as useId14, useMemo as
|
|
15687
|
+
import { useId as useId14, useMemo as useMemo27, useState as useState33 } from "react";
|
|
15311
15688
|
|
|
15312
15689
|
// src/components/user-interaction/select/MultiSelect.tsx
|
|
15313
15690
|
import { forwardRef as forwardRef18 } from "react";
|
|
@@ -15343,7 +15720,7 @@ import {
|
|
|
15343
15720
|
|
|
15344
15721
|
// src/components/user-interaction/Checkbox.tsx
|
|
15345
15722
|
import { Check as Check2, Minus as Minus2 } from "lucide-react";
|
|
15346
|
-
import { useCallback as
|
|
15723
|
+
import { useCallback as useCallback27 } from "react";
|
|
15347
15724
|
import { jsx as jsx68, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
15348
15725
|
var Checkbox = ({
|
|
15349
15726
|
value: controlledValue,
|
|
@@ -15361,7 +15738,7 @@ var Checkbox = ({
|
|
|
15361
15738
|
}) => {
|
|
15362
15739
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15363
15740
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
15364
|
-
const onChangeWrapper =
|
|
15741
|
+
const onChangeWrapper = useCallback27((value2) => {
|
|
15365
15742
|
onValueChangeStable(value2);
|
|
15366
15743
|
onEditCompleteStable(value2);
|
|
15367
15744
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -15584,7 +15961,7 @@ var TextFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15584
15961
|
const operator = filterValue?.operator ?? "textContains";
|
|
15585
15962
|
const parameter = filterValue?.parameter ?? {};
|
|
15586
15963
|
const id = useId14();
|
|
15587
|
-
const availableOperators =
|
|
15964
|
+
const availableOperators = useMemo27(() => [
|
|
15588
15965
|
...TableFilterOperator.text,
|
|
15589
15966
|
...TableFilterOperator.generic
|
|
15590
15967
|
], []);
|
|
@@ -15644,7 +16021,7 @@ var NumberFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15644
16021
|
const translation = useHightideTranslation();
|
|
15645
16022
|
const operator = filterValue?.operator ?? "numberBetween";
|
|
15646
16023
|
const parameter = filterValue?.parameter ?? {};
|
|
15647
|
-
const availableOperators =
|
|
16024
|
+
const availableOperators = useMemo27(() => [
|
|
15648
16025
|
...TableFilterOperator.number,
|
|
15649
16026
|
...TableFilterOperator.generic
|
|
15650
16027
|
], []);
|
|
@@ -15735,9 +16112,9 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15735
16112
|
};
|
|
15736
16113
|
const operator = filterValue?.operator ?? "dateBetween";
|
|
15737
16114
|
const parameter = filterValue?.parameter ?? {};
|
|
15738
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] =
|
|
15739
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] =
|
|
15740
|
-
const availableOperators =
|
|
16115
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState33(null);
|
|
16116
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = useState33(null);
|
|
16117
|
+
const availableOperators = useMemo27(() => [
|
|
15741
16118
|
...TableFilterOperator.date,
|
|
15742
16119
|
...TableFilterOperator.generic
|
|
15743
16120
|
], []);
|
|
@@ -15860,9 +16237,9 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15860
16237
|
};
|
|
15861
16238
|
const operator = filterValue?.operator ?? "dateTimeBetween";
|
|
15862
16239
|
const parameter = filterValue?.parameter ?? {};
|
|
15863
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] =
|
|
15864
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] =
|
|
15865
|
-
const availableOperators =
|
|
16240
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState33(null);
|
|
16241
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = useState33(null);
|
|
16242
|
+
const availableOperators = useMemo27(() => [
|
|
15866
16243
|
...TableFilterOperator.dateTime,
|
|
15867
16244
|
...TableFilterOperator.generic
|
|
15868
16245
|
], []);
|
|
@@ -15979,7 +16356,7 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15979
16356
|
};
|
|
15980
16357
|
var BooleanFilter = ({ filterValue, onFilterValueChange }) => {
|
|
15981
16358
|
const operator = filterValue?.operator ?? "booleanIsTrue";
|
|
15982
|
-
const availableOperators =
|
|
16359
|
+
const availableOperators = useMemo27(() => [
|
|
15983
16360
|
...TableFilterOperator.boolean,
|
|
15984
16361
|
...TableFilterOperator.generic
|
|
15985
16362
|
], []);
|
|
@@ -16003,11 +16380,11 @@ var TagsFilter = ({ columnId, filterValue, onFilterValueChange }) => {
|
|
|
16003
16380
|
const { table } = useTableStateWithoutSizingContext();
|
|
16004
16381
|
const operator = filterValue?.operator ?? "tagsContains";
|
|
16005
16382
|
const parameter = filterValue?.parameter ?? {};
|
|
16006
|
-
const availableOperators =
|
|
16383
|
+
const availableOperators = useMemo27(() => [
|
|
16007
16384
|
...TableFilterOperator.multiTags,
|
|
16008
16385
|
...TableFilterOperator.generic
|
|
16009
16386
|
], []);
|
|
16010
|
-
const availableTags =
|
|
16387
|
+
const availableTags = useMemo27(() => {
|
|
16011
16388
|
const column = table.getColumn(columnId);
|
|
16012
16389
|
if (!column) return [];
|
|
16013
16390
|
return column.columnDef.meta?.filterData?.tags ?? [];
|
|
@@ -16054,11 +16431,11 @@ var TagsSingleFilter = ({ columnId, filterValue, onFilterValueChange }) => {
|
|
|
16054
16431
|
const { table } = useTableStateWithoutSizingContext();
|
|
16055
16432
|
const operator = filterValue?.operator ?? "tagsSingleContains";
|
|
16056
16433
|
const parameter = filterValue?.parameter ?? {};
|
|
16057
|
-
const availableOperators =
|
|
16434
|
+
const availableOperators = useMemo27(() => [
|
|
16058
16435
|
...TableFilterOperator.singleTag,
|
|
16059
16436
|
...TableFilterOperator.generic
|
|
16060
16437
|
], []);
|
|
16061
|
-
const availableTags =
|
|
16438
|
+
const availableTags = useMemo27(() => {
|
|
16062
16439
|
const column = table.getColumn(columnId);
|
|
16063
16440
|
if (!column) return [];
|
|
16064
16441
|
return column.columnDef.meta?.filterData?.tags ?? [];
|
|
@@ -16117,7 +16494,7 @@ var TagsSingleFilter = ({ columnId, filterValue, onFilterValueChange }) => {
|
|
|
16117
16494
|
};
|
|
16118
16495
|
var GenericFilter = ({ filterValue, onFilterValueChange }) => {
|
|
16119
16496
|
const operator = filterValue?.operator ?? "notUndefined";
|
|
16120
|
-
const availableOperators =
|
|
16497
|
+
const availableOperators = useMemo27(() => [
|
|
16121
16498
|
...TableFilterOperator.generic
|
|
16122
16499
|
], []);
|
|
16123
16500
|
return /* @__PURE__ */ jsx69("div", { className: "flex-col-2 gap-2", children: /* @__PURE__ */ jsx69(
|
|
@@ -16166,18 +16543,18 @@ var TableFilterButton = ({
|
|
|
16166
16543
|
}) => {
|
|
16167
16544
|
const translation = useHightideTranslation();
|
|
16168
16545
|
const columnFilterValue = column.getFilterValue();
|
|
16169
|
-
const [filterValue, setFilterValue] =
|
|
16546
|
+
const [filterValue, setFilterValue] = useState34(columnFilterValue);
|
|
16170
16547
|
const hasFilter = !!filterValue;
|
|
16171
|
-
const anchorRef =
|
|
16172
|
-
const containerRef =
|
|
16173
|
-
const [isOpen, setIsOpen] =
|
|
16548
|
+
const anchorRef = useRef31(null);
|
|
16549
|
+
const containerRef = useRef31(null);
|
|
16550
|
+
const [isOpen, setIsOpen] = useState34(false);
|
|
16174
16551
|
const id = useId15();
|
|
16175
|
-
const ids =
|
|
16552
|
+
const ids = useMemo28(() => ({
|
|
16176
16553
|
button: `table-filter-button-${id}`,
|
|
16177
16554
|
popup: `table-filter-popup-${id}`,
|
|
16178
16555
|
label: `table-filter-label-${id}`
|
|
16179
16556
|
}), [id]);
|
|
16180
|
-
|
|
16557
|
+
useEffect39(() => {
|
|
16181
16558
|
setFilterValue(columnFilterValue);
|
|
16182
16559
|
}, [columnFilterValue]);
|
|
16183
16560
|
const isTagsFilter = filterType === "multiTags" || filterType === "singleTag";
|
|
@@ -16252,11 +16629,11 @@ var TableFilterButton = ({
|
|
|
16252
16629
|
};
|
|
16253
16630
|
|
|
16254
16631
|
// src/components/layout/table/TableHeader.tsx
|
|
16255
|
-
import { useCallback as
|
|
16632
|
+
import { useCallback as useCallback28, useEffect as useEffect40 } from "react";
|
|
16256
16633
|
import { Fragment as Fragment9, jsx as jsx71, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
16257
16634
|
var TableHeader = ({ isSticky = false }) => {
|
|
16258
16635
|
const { table } = useTableStateWithoutSizingContext();
|
|
16259
|
-
const handleResizeMove =
|
|
16636
|
+
const handleResizeMove = useCallback28((e) => {
|
|
16260
16637
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
16261
16638
|
const currentX = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
16262
16639
|
const deltaOffset = currentX - (table.getState().columnSizingInfo.startOffset ?? 0);
|
|
@@ -16272,7 +16649,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
16272
16649
|
deltaOffset
|
|
16273
16650
|
}));
|
|
16274
16651
|
}, [table]);
|
|
16275
|
-
const handleResizeEnd =
|
|
16652
|
+
const handleResizeEnd = useCallback28(() => {
|
|
16276
16653
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
16277
16654
|
const newWidth = (table.getState().columnSizingInfo.startSize ?? 0) + (table.getState().columnSizingInfo.deltaOffset ?? 0);
|
|
16278
16655
|
table.setColumnSizing((prev) => {
|
|
@@ -16290,7 +16667,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
16290
16667
|
startSize: null
|
|
16291
16668
|
});
|
|
16292
16669
|
}, [table]);
|
|
16293
|
-
|
|
16670
|
+
useEffect40(() => {
|
|
16294
16671
|
window.addEventListener("pointermove", handleResizeMove);
|
|
16295
16672
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
16296
16673
|
return () => {
|
|
@@ -16459,7 +16836,7 @@ var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props
|
|
|
16459
16836
|
};
|
|
16460
16837
|
|
|
16461
16838
|
// src/components/layout/table/TableWithSelectionProvider.tsx
|
|
16462
|
-
import { useCallback as
|
|
16839
|
+
import { useCallback as useCallback29, useMemo as useMemo29 } from "react";
|
|
16463
16840
|
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
16464
16841
|
var TableWithSelectionProvider = ({
|
|
16465
16842
|
children,
|
|
@@ -16472,7 +16849,7 @@ var TableWithSelectionProvider = ({
|
|
|
16472
16849
|
...props
|
|
16473
16850
|
}) => {
|
|
16474
16851
|
const translation = useHightideTranslation();
|
|
16475
|
-
const columnDef =
|
|
16852
|
+
const columnDef = useMemo29(() => [
|
|
16476
16853
|
{
|
|
16477
16854
|
id: selectionRowId,
|
|
16478
16855
|
header: ({ table }) => {
|
|
@@ -16515,7 +16892,7 @@ var TableWithSelectionProvider = ({
|
|
|
16515
16892
|
TableProvider,
|
|
16516
16893
|
{
|
|
16517
16894
|
...props,
|
|
16518
|
-
fillerRowCell:
|
|
16895
|
+
fillerRowCell: useCallback29((columnId, table) => {
|
|
16519
16896
|
if (columnId === selectionRowId) {
|
|
16520
16897
|
return /* @__PURE__ */ jsx74(Checkbox, { value: false, disabled: true });
|
|
16521
16898
|
}
|
|
@@ -16533,7 +16910,7 @@ var TableWithSelectionProvider = ({
|
|
|
16533
16910
|
rowSelection,
|
|
16534
16911
|
...state
|
|
16535
16912
|
},
|
|
16536
|
-
onRowClick:
|
|
16913
|
+
onRowClick: useCallback29((row, table) => {
|
|
16537
16914
|
if (!disableClickRowClickSelection) {
|
|
16538
16915
|
row.toggleSelected();
|
|
16539
16916
|
}
|
|
@@ -16575,7 +16952,7 @@ var TableWithSelection = ({
|
|
|
16575
16952
|
};
|
|
16576
16953
|
|
|
16577
16954
|
// src/components/layout/table/TableColumn.tsx
|
|
16578
|
-
import { memo as memo2, useEffect as
|
|
16955
|
+
import { memo as memo2, useEffect as useEffect41, useMemo as useMemo30, useState as useState35 } from "react";
|
|
16579
16956
|
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
16580
16957
|
var TableColumnComponent = ({
|
|
16581
16958
|
filterType,
|
|
@@ -16587,11 +16964,11 @@ var TableColumnComponent = ({
|
|
|
16587
16964
|
"TableColumn: For filterType === multiTags or singleTag, filterData.tags must be set.",
|
|
16588
16965
|
(filterType === "multiTags" || filterType === "singleTag") && props.meta?.filterData?.tags === void 0
|
|
16589
16966
|
);
|
|
16590
|
-
const [column] =
|
|
16967
|
+
const [column] = useState35({
|
|
16591
16968
|
...props,
|
|
16592
16969
|
filterFn
|
|
16593
16970
|
});
|
|
16594
|
-
|
|
16971
|
+
useEffect41(() => {
|
|
16595
16972
|
const unsubscribe = registerColumn(column);
|
|
16596
16973
|
return () => {
|
|
16597
16974
|
unsubscribe();
|
|
@@ -16606,27 +16983,27 @@ var TableColumnFactory = () => memo2(
|
|
|
16606
16983
|
}
|
|
16607
16984
|
);
|
|
16608
16985
|
var TableColumn = (props) => {
|
|
16609
|
-
const TableColumnComponent2 =
|
|
16986
|
+
const TableColumnComponent2 = useMemo30(() => TableColumnFactory(), []);
|
|
16610
16987
|
return /* @__PURE__ */ jsx76(TableColumnComponent2, { ...props });
|
|
16611
16988
|
};
|
|
16612
16989
|
|
|
16613
16990
|
// src/components/layout/table/TableColumnSwitcher.tsx
|
|
16614
|
-
import { useMemo as
|
|
16991
|
+
import { useMemo as useMemo31, useRef as useRef32, useId as useId16 } from "react";
|
|
16615
16992
|
import { ChevronUp as ChevronUp3, ChevronDown as ChevronDown5, ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight5, Eye, EyeOff, Pin, PinOff, ArrowLeftRightIcon } from "lucide-react";
|
|
16616
16993
|
import { Fragment as Fragment10, jsx as jsx77, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
16617
16994
|
var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
16618
16995
|
const { table } = useTableStateWithoutSizingContext();
|
|
16619
16996
|
const translation = useHightideTranslation();
|
|
16620
|
-
const containerRef =
|
|
16997
|
+
const containerRef = useRef32(null);
|
|
16621
16998
|
const generatedId = useId16();
|
|
16622
|
-
const ids =
|
|
16999
|
+
const ids = useMemo31(() => ({
|
|
16623
17000
|
popup: props.id ?? `table-column-picker-popup-${generatedId}`,
|
|
16624
17001
|
label: `table-column-picker-label-${generatedId}`
|
|
16625
17002
|
}), [generatedId, props.id]);
|
|
16626
17003
|
const tableState = table.getState();
|
|
16627
17004
|
const columnOrder = tableState.columnOrder;
|
|
16628
17005
|
const columnPinning = tableState.columnPinning;
|
|
16629
|
-
const columns =
|
|
17006
|
+
const columns = useMemo31(() => {
|
|
16630
17007
|
const allColumns = table.getAllColumns();
|
|
16631
17008
|
const leftPinned = [];
|
|
16632
17009
|
const unpinned = [];
|
|
@@ -16884,7 +17261,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
16884
17261
|
};
|
|
16885
17262
|
|
|
16886
17263
|
// src/components/user-interaction/CopyToClipboardWrapper.tsx
|
|
16887
|
-
import { useState as
|
|
17264
|
+
import { useState as useState36 } from "react";
|
|
16888
17265
|
import { clsx as clsx28 } from "clsx";
|
|
16889
17266
|
|
|
16890
17267
|
// src/utils/writeToClipboard.ts
|
|
@@ -16907,7 +17284,7 @@ var CopyToClipboardWrapper = ({
|
|
|
16907
17284
|
...props
|
|
16908
17285
|
}) => {
|
|
16909
17286
|
const translation = useHightideTranslation();
|
|
16910
|
-
const [isShowingConfirmation, setIsShowingConfirmation] =
|
|
17287
|
+
const [isShowingConfirmation, setIsShowingConfirmation] = useState36(false);
|
|
16911
17288
|
return /* @__PURE__ */ jsxs46(
|
|
16912
17289
|
TooltipRoot,
|
|
16913
17290
|
{
|
|
@@ -16956,7 +17333,7 @@ var CopyToClipboardWrapper = ({
|
|
|
16956
17333
|
};
|
|
16957
17334
|
|
|
16958
17335
|
// src/components/user-interaction/Menu.tsx
|
|
16959
|
-
import { useCallback as
|
|
17336
|
+
import { useCallback as useCallback30, useRef as useRef33, useState as useState37 } from "react";
|
|
16960
17337
|
import clsx29 from "clsx";
|
|
16961
17338
|
import { Fragment as Fragment11, jsx as jsx79, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
16962
17339
|
var MenuItem = ({
|
|
@@ -16982,8 +17359,8 @@ var Menu = ({
|
|
|
16982
17359
|
disabled = false,
|
|
16983
17360
|
...props
|
|
16984
17361
|
}) => {
|
|
16985
|
-
const triggerRef =
|
|
16986
|
-
const [isOpen, setIsOpen] =
|
|
17362
|
+
const triggerRef = useRef33(null);
|
|
17363
|
+
const [isOpen, setIsOpen] = useState37(false);
|
|
16987
17364
|
const bag = {
|
|
16988
17365
|
isOpen,
|
|
16989
17366
|
close: () => setIsOpen(false),
|
|
@@ -16991,7 +17368,7 @@ var Menu = ({
|
|
|
16991
17368
|
disabled
|
|
16992
17369
|
};
|
|
16993
17370
|
return /* @__PURE__ */ jsxs47(Fragment11, { children: [
|
|
16994
|
-
trigger(bag,
|
|
17371
|
+
trigger(bag, useCallback30((el) => triggerRef.current = el, [])),
|
|
16995
17372
|
/* @__PURE__ */ jsx79(
|
|
16996
17373
|
PopUp,
|
|
16997
17374
|
{
|
|
@@ -17013,7 +17390,7 @@ var Menu = ({
|
|
|
17013
17390
|
};
|
|
17014
17391
|
|
|
17015
17392
|
// src/components/user-interaction/ScrollPicker.tsx
|
|
17016
|
-
import { useCallback as
|
|
17393
|
+
import { useCallback as useCallback31, useEffect as useEffect42, useState as useState38 } from "react";
|
|
17017
17394
|
import clsx30 from "clsx";
|
|
17018
17395
|
import { jsx as jsx80, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
17019
17396
|
var up = 1;
|
|
@@ -17034,7 +17411,7 @@ var ScrollPicker = ({
|
|
|
17034
17411
|
transition,
|
|
17035
17412
|
items,
|
|
17036
17413
|
lastTimeStamp
|
|
17037
|
-
}, setAnimation] =
|
|
17414
|
+
}, setAnimation] = useState38({
|
|
17038
17415
|
targetIndex: selectedIndex,
|
|
17039
17416
|
currentIndex: disabled ? selectedIndex : 0,
|
|
17040
17417
|
velocity: 0,
|
|
@@ -17050,7 +17427,7 @@ var ScrollPicker = ({
|
|
|
17050
17427
|
const itemHeight = 40;
|
|
17051
17428
|
const distance = 8;
|
|
17052
17429
|
const containerHeight = itemHeight * (itemsShownCount - 2) + distance * (itemsShownCount - 2 + 1);
|
|
17053
|
-
const getDirection =
|
|
17430
|
+
const getDirection = useCallback31((targetIndex, currentIndex2, transition2, length) => {
|
|
17054
17431
|
if (targetIndex === currentIndex2) {
|
|
17055
17432
|
return transition2 > 0 ? up : down;
|
|
17056
17433
|
}
|
|
@@ -17060,7 +17437,7 @@ var ScrollPicker = ({
|
|
|
17060
17437
|
}
|
|
17061
17438
|
return distanceForward >= length / 2 ? down : up;
|
|
17062
17439
|
}, []);
|
|
17063
|
-
const animate =
|
|
17440
|
+
const animate = useCallback31((timestamp, startTime) => {
|
|
17064
17441
|
setAnimation((prevState) => {
|
|
17065
17442
|
const {
|
|
17066
17443
|
targetIndex,
|
|
@@ -17133,7 +17510,7 @@ var ScrollPicker = ({
|
|
|
17133
17510
|
};
|
|
17134
17511
|
});
|
|
17135
17512
|
}, [disabled, getDirection, onChange]);
|
|
17136
|
-
|
|
17513
|
+
useEffect42(() => {
|
|
17137
17514
|
requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp));
|
|
17138
17515
|
});
|
|
17139
17516
|
const opacity = (transition2, index, itemsCount) => {
|
|
@@ -17211,7 +17588,7 @@ var ScrollPicker = ({
|
|
|
17211
17588
|
};
|
|
17212
17589
|
|
|
17213
17590
|
// src/components/user-interaction/Switch.tsx
|
|
17214
|
-
import { useCallback as
|
|
17591
|
+
import { useCallback as useCallback32 } from "react";
|
|
17215
17592
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
17216
17593
|
var Switch = ({
|
|
17217
17594
|
value: controlledValue,
|
|
@@ -17226,7 +17603,7 @@ var Switch = ({
|
|
|
17226
17603
|
}) => {
|
|
17227
17604
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
17228
17605
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
17229
|
-
const onChangeWrapper =
|
|
17606
|
+
const onChangeWrapper = useCallback32((value2) => {
|
|
17230
17607
|
onValueChangeStable(!value2);
|
|
17231
17608
|
onEditCompleteStable(!value2);
|
|
17232
17609
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -17266,7 +17643,7 @@ var Switch = ({
|
|
|
17266
17643
|
};
|
|
17267
17644
|
|
|
17268
17645
|
// src/components/user-interaction/Textarea.tsx
|
|
17269
|
-
import { forwardRef as forwardRef19, useCallback as
|
|
17646
|
+
import { forwardRef as forwardRef19, useCallback as useCallback33, useId as useId17 } from "react";
|
|
17270
17647
|
import clsx31 from "clsx";
|
|
17271
17648
|
import { jsx as jsx82, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
17272
17649
|
var Textarea = forwardRef19(function Textarea2({
|
|
@@ -17285,7 +17662,7 @@ var Textarea = forwardRef19(function Textarea2({
|
|
|
17285
17662
|
});
|
|
17286
17663
|
const { restartTimer, clearTimer } = useDelay(saveDelayOptions);
|
|
17287
17664
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
17288
|
-
const onEditCompleteWrapper =
|
|
17665
|
+
const onEditCompleteWrapper = useCallback33((text) => {
|
|
17289
17666
|
onEditCompleteStable(text);
|
|
17290
17667
|
clearTimer();
|
|
17291
17668
|
}, [onEditCompleteStable, clearTimer]);
|
|
@@ -17397,7 +17774,7 @@ var TimeDisplay = ({
|
|
|
17397
17774
|
|
|
17398
17775
|
// src/components/user-interaction/input/InsideLabelInput.tsx
|
|
17399
17776
|
import { useId as useId18 } from "react";
|
|
17400
|
-
import { forwardRef as forwardRef20, useState as
|
|
17777
|
+
import { forwardRef as forwardRef20, useState as useState39 } from "react";
|
|
17401
17778
|
import clsx32 from "clsx";
|
|
17402
17779
|
import { jsx as jsx84, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
17403
17780
|
var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
@@ -17413,7 +17790,7 @@ var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
|
17413
17790
|
onValueChange,
|
|
17414
17791
|
defaultValue: initialValue
|
|
17415
17792
|
});
|
|
17416
|
-
const [isFocused, setIsFocused] =
|
|
17793
|
+
const [isFocused, setIsFocused] = useState39(false);
|
|
17417
17794
|
const generatedId = useId18();
|
|
17418
17795
|
const id = customId ?? generatedId;
|
|
17419
17796
|
return /* @__PURE__ */ jsxs50("div", { className: clsx32("relative"), children: [
|
|
@@ -17503,7 +17880,7 @@ var SearchBar = ({
|
|
|
17503
17880
|
};
|
|
17504
17881
|
|
|
17505
17882
|
// src/components/user-interaction/input/ToggleableInput.tsx
|
|
17506
|
-
import { forwardRef as forwardRef21, useEffect as
|
|
17883
|
+
import { forwardRef as forwardRef21, useEffect as useEffect43, useImperativeHandle as useImperativeHandle12, useRef as useRef34, useState as useState40 } from "react";
|
|
17507
17884
|
import { Pencil } from "lucide-react";
|
|
17508
17885
|
import clsx34 from "clsx";
|
|
17509
17886
|
import { jsx as jsx86, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
@@ -17520,10 +17897,10 @@ var ToggleableInput = forwardRef21(function ToggleableInput2({
|
|
|
17520
17897
|
onValueChange,
|
|
17521
17898
|
defaultValue: initialValue
|
|
17522
17899
|
});
|
|
17523
|
-
const [isEditing, setIsEditing] =
|
|
17524
|
-
const innerRef =
|
|
17900
|
+
const [isEditing, setIsEditing] = useState40(initialState !== "display");
|
|
17901
|
+
const innerRef = useRef34(null);
|
|
17525
17902
|
useImperativeHandle12(forwardedRef, () => innerRef.current);
|
|
17526
|
-
|
|
17903
|
+
useEffect43(() => {
|
|
17527
17904
|
if (isEditing) {
|
|
17528
17905
|
innerRef.current?.focus();
|
|
17529
17906
|
}
|
|
@@ -17733,7 +18110,7 @@ var DateProperty = ({
|
|
|
17733
18110
|
import { List } from "lucide-react";
|
|
17734
18111
|
|
|
17735
18112
|
// src/components/user-interaction/select/MultiSelectChipDisplay.tsx
|
|
17736
|
-
import { forwardRef as forwardRef22, useEffect as
|
|
18113
|
+
import { forwardRef as forwardRef22, useEffect as useEffect44, useImperativeHandle as useImperativeHandle13, useRef as useRef35 } from "react";
|
|
17737
18114
|
import { XIcon as XIcon2, Plus } from "lucide-react";
|
|
17738
18115
|
import { jsx as jsx90, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
17739
18116
|
var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayButton2({
|
|
@@ -17743,7 +18120,7 @@ var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayB
|
|
|
17743
18120
|
const translation = useHightideTranslation();
|
|
17744
18121
|
const { state, trigger, item, ids, setIds } = useSelectContext();
|
|
17745
18122
|
const { register, unregister, toggleOpen } = trigger;
|
|
17746
|
-
|
|
18123
|
+
useEffect44(() => {
|
|
17747
18124
|
if (id) {
|
|
17748
18125
|
setIds((prev) => ({
|
|
17749
18126
|
...prev,
|
|
@@ -17751,9 +18128,9 @@ var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayB
|
|
|
17751
18128
|
}));
|
|
17752
18129
|
}
|
|
17753
18130
|
}, [id, setIds]);
|
|
17754
|
-
const innerRef =
|
|
18131
|
+
const innerRef = useRef35(null);
|
|
17755
18132
|
useImperativeHandle13(ref, () => innerRef.current);
|
|
17756
|
-
|
|
18133
|
+
useEffect44(() => {
|
|
17757
18134
|
register(innerRef);
|
|
17758
18135
|
return () => unregister();
|
|
17759
18136
|
}, [register, unregister]);
|
|
@@ -17990,463 +18367,97 @@ var SingleSelectProperty = ({
|
|
|
17990
18367
|
className: "flex-row-2 w-full items-center justify-between",
|
|
17991
18368
|
hideExpansionIcon: true,
|
|
17992
18369
|
"data-name": "property-input"
|
|
17993
|
-
}
|
|
17994
|
-
),
|
|
17995
|
-
/* @__PURE__ */ jsx93(SelectContent, { children })
|
|
17996
|
-
]
|
|
17997
|
-
}
|
|
17998
|
-
)
|
|
17999
|
-
}
|
|
18000
|
-
)
|
|
18001
|
-
}
|
|
18002
|
-
);
|
|
18003
|
-
};
|
|
18004
|
-
|
|
18005
|
-
// src/components/user-interaction/properties/TextProperty.tsx
|
|
18006
|
-
import { Text } from "lucide-react";
|
|
18007
|
-
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
18008
|
-
var TextProperty = ({
|
|
18009
|
-
value,
|
|
18010
|
-
readOnly,
|
|
18011
|
-
onValueChange,
|
|
18012
|
-
onEditComplete,
|
|
18013
|
-
...baseProps
|
|
18014
|
-
}) => {
|
|
18015
|
-
const translation = useHightideTranslation();
|
|
18016
|
-
const hasValue = value !== void 0;
|
|
18017
|
-
return /* @__PURE__ */ jsx94(
|
|
18018
|
-
PropertyBase,
|
|
18019
|
-
{
|
|
18020
|
-
...baseProps,
|
|
18021
|
-
hasValue,
|
|
18022
|
-
icon: /* @__PURE__ */ jsx94(Text, { size: 24 }),
|
|
18023
|
-
children: ({ invalid }) => /* @__PURE__ */ jsx94(
|
|
18024
|
-
Textarea,
|
|
18025
|
-
{
|
|
18026
|
-
"data-name": "property-input",
|
|
18027
|
-
className: "w-full",
|
|
18028
|
-
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
18029
|
-
rows: 5,
|
|
18030
|
-
value: value ?? "",
|
|
18031
|
-
readOnly,
|
|
18032
|
-
placeholder: translation("text"),
|
|
18033
|
-
onValueChange: (value2) => onValueChange?.(value2),
|
|
18034
|
-
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
18035
|
-
}
|
|
18036
|
-
)
|
|
18037
|
-
}
|
|
18038
|
-
);
|
|
18039
|
-
};
|
|
18040
|
-
|
|
18041
|
-
// src/components/utils/Transition.tsx
|
|
18042
|
-
import { useEffect as useEffect38, useState as useState37 } from "react";
|
|
18043
|
-
function Transition({
|
|
18044
|
-
children,
|
|
18045
|
-
show,
|
|
18046
|
-
includeAnimation = true
|
|
18047
|
-
}) {
|
|
18048
|
-
const [isOpen, setIsOpen] = useState37(show);
|
|
18049
|
-
const [isTransitioning, setIsTransitioning] = useState37(!isOpen);
|
|
18050
|
-
const isUsingReducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : true;
|
|
18051
|
-
useEffect38(() => {
|
|
18052
|
-
setIsOpen(show);
|
|
18053
|
-
setIsTransitioning(true);
|
|
18054
|
-
}, [show]);
|
|
18055
|
-
const onAnimationEnd = () => setIsTransitioning(false);
|
|
18056
|
-
const bag = {
|
|
18057
|
-
isOpen,
|
|
18058
|
-
isTransitioning,
|
|
18059
|
-
isUsingReducedMotion,
|
|
18060
|
-
data: {
|
|
18061
|
-
"data-open": isOpen && !isTransitioning ? "" : void 0,
|
|
18062
|
-
"data-opening": isOpen && isTransitioning ? "" : void 0,
|
|
18063
|
-
"data-closing": !isOpen && isTransitioning ? "" : void 0,
|
|
18064
|
-
"data-closed": !isOpen && !isTransitioning ? "" : void 0
|
|
18065
|
-
},
|
|
18066
|
-
handlers: {
|
|
18067
|
-
onTransitionEnd: () => setIsTransitioning(false),
|
|
18068
|
-
onTransitionCancel: () => setIsTransitioning(false),
|
|
18069
|
-
onAnimationEnd: includeAnimation ? onAnimationEnd : void 0
|
|
18070
|
-
}
|
|
18071
|
-
};
|
|
18072
|
-
return BagFunctionUtil.resolve(children, bag);
|
|
18073
|
-
}
|
|
18074
|
-
|
|
18075
|
-
// src/global-contexts/HightideProvider.tsx
|
|
18076
|
-
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
18077
|
-
var HightideProvider = ({
|
|
18078
|
-
children,
|
|
18079
|
-
theme,
|
|
18080
|
-
locale,
|
|
18081
|
-
config
|
|
18082
|
-
}) => {
|
|
18083
|
-
return /* @__PURE__ */ jsx95(LocaleProvider, { ...locale, children: /* @__PURE__ */ jsx95(ThemeProvider, { ...theme, children: /* @__PURE__ */ jsx95(HightideConfigProvider, { ...config, children }) }) });
|
|
18084
|
-
};
|
|
18085
|
-
|
|
18086
|
-
// src/hooks/focus/useFocusGuards.ts
|
|
18087
|
-
import { useEffect as useEffect39 } from "react";
|
|
18088
|
-
var selectorName = "data-hw-focus-guard";
|
|
18089
|
-
function FocusGuard() {
|
|
18090
|
-
const element = document.createElement("div");
|
|
18091
|
-
element.setAttribute(selectorName, "");
|
|
18092
|
-
element.tabIndex = 0;
|
|
18093
|
-
element.style.border = "none";
|
|
18094
|
-
element.style.outline = "none";
|
|
18095
|
-
element.style.boxShadow = "none";
|
|
18096
|
-
element.style.opacity = "0";
|
|
18097
|
-
element.style.position = "fixed";
|
|
18098
|
-
element.style.pointerEvents = "none";
|
|
18099
|
-
return element;
|
|
18100
|
-
}
|
|
18101
|
-
var FocusGuardsService = class _FocusGuardsService {
|
|
18102
|
-
constructor() {
|
|
18103
|
-
this.count = 0;
|
|
18104
|
-
}
|
|
18105
|
-
static getInstance() {
|
|
18106
|
-
if (!_FocusGuardsService.instance) {
|
|
18107
|
-
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
18108
|
-
}
|
|
18109
|
-
return _FocusGuardsService.instance;
|
|
18110
|
-
}
|
|
18111
|
-
add() {
|
|
18112
|
-
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
18113
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
18114
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
18115
|
-
this.count++;
|
|
18116
|
-
}
|
|
18117
|
-
remove() {
|
|
18118
|
-
if (this.count === 1) {
|
|
18119
|
-
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
18120
|
-
}
|
|
18121
|
-
this.count--;
|
|
18122
|
-
}
|
|
18123
|
-
};
|
|
18124
|
-
var useFocusGuards = () => {
|
|
18125
|
-
useEffect39(() => {
|
|
18126
|
-
FocusGuardsService.getInstance().add();
|
|
18127
|
-
return () => {
|
|
18128
|
-
FocusGuardsService.getInstance().remove();
|
|
18129
|
-
};
|
|
18130
|
-
}, []);
|
|
18131
|
-
};
|
|
18132
|
-
|
|
18133
|
-
// src/hooks/focus/useFocusOnceVisible.ts
|
|
18134
|
-
import React6, { useEffect as useEffect40 } from "react";
|
|
18135
|
-
var useFocusOnceVisible = (ref, disable = false) => {
|
|
18136
|
-
const [hasUsedFocus, setHasUsedFocus] = React6.useState(false);
|
|
18137
|
-
useEffect40(() => {
|
|
18138
|
-
if (disable || hasUsedFocus) {
|
|
18139
|
-
return;
|
|
18140
|
-
}
|
|
18141
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
18142
|
-
if (entry.isIntersecting && !hasUsedFocus) {
|
|
18143
|
-
ref.current?.focus();
|
|
18144
|
-
setHasUsedFocus(hasUsedFocus);
|
|
18145
|
-
}
|
|
18146
|
-
}, {
|
|
18147
|
-
threshold: 0.1
|
|
18148
|
-
});
|
|
18149
|
-
if (ref.current) {
|
|
18150
|
-
observer.observe(ref.current);
|
|
18151
|
-
}
|
|
18152
|
-
return () => observer.disconnect();
|
|
18153
|
-
}, [disable, hasUsedFocus, ref]);
|
|
18154
|
-
};
|
|
18155
|
-
|
|
18156
|
-
// src/hooks/focus/useIsMounted.ts
|
|
18157
|
-
import { useEffect as useEffect41, useLayoutEffect as useLayoutEffect7, useState as useState38 } from "react";
|
|
18158
|
-
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
18159
|
-
var useIsomorphicEffect = isClient ? useLayoutEffect7 : useEffect41;
|
|
18160
|
-
var useIsMounted = () => {
|
|
18161
|
-
const [isMounted, setIsMounted] = useState38(false);
|
|
18162
|
-
useIsomorphicEffect(() => {
|
|
18163
|
-
setIsMounted(true);
|
|
18164
|
-
return () => {
|
|
18165
|
-
setIsMounted(false);
|
|
18166
|
-
};
|
|
18167
|
-
}, []);
|
|
18168
|
-
return isMounted;
|
|
18169
|
-
};
|
|
18170
|
-
|
|
18171
|
-
// src/hooks/useHandleRefs.ts
|
|
18172
|
-
import { useEffect as useEffect42, useRef as useRef35 } from "react";
|
|
18173
|
-
function useHandleRefs(handleRef) {
|
|
18174
|
-
const refs = useRef35([]);
|
|
18175
|
-
useEffect42(() => {
|
|
18176
|
-
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
18177
|
-
() => ({ current: null })
|
|
18178
|
-
);
|
|
18179
|
-
const values = Object.values(handleRef?.current ?? {});
|
|
18180
|
-
values.forEach((el, i) => {
|
|
18181
|
-
refs.current[i].current = el;
|
|
18182
|
-
});
|
|
18183
|
-
});
|
|
18184
|
-
return refs.current;
|
|
18185
|
-
}
|
|
18186
|
-
|
|
18187
|
-
// src/hooks/useLogUnstableDependencies.ts
|
|
18188
|
-
import React7 from "react";
|
|
18189
|
-
function useLogUnstableDependencies(name, value) {
|
|
18190
|
-
const prev = React7.useRef(null);
|
|
18191
|
-
React7.useEffect(() => {
|
|
18192
|
-
if (!prev.current) {
|
|
18193
|
-
prev.current = value;
|
|
18194
|
-
return;
|
|
18195
|
-
}
|
|
18196
|
-
const changes = {};
|
|
18197
|
-
for (const key of Object.keys(value)) {
|
|
18198
|
-
if (prev.current[key] !== value[key]) {
|
|
18199
|
-
changes[key] = {
|
|
18200
|
-
prev: prev.current[key],
|
|
18201
|
-
next: value[key]
|
|
18202
|
-
};
|
|
18203
|
-
}
|
|
18204
|
-
}
|
|
18205
|
-
if (Object.keys(changes).length > 0) {
|
|
18206
|
-
console.info(`[${name}] changed`, changes);
|
|
18207
|
-
}
|
|
18208
|
-
prev.current = value;
|
|
18209
|
-
});
|
|
18210
|
-
}
|
|
18211
|
-
|
|
18212
|
-
// src/hooks/useOverwritableState.ts
|
|
18213
|
-
import { useEffect as useEffect43, useState as useState39 } from "react";
|
|
18214
|
-
var useOverwritableState = (overwriteValue, onChange) => {
|
|
18215
|
-
const [state, setState] = useState39(overwriteValue);
|
|
18216
|
-
useEffect43(() => {
|
|
18217
|
-
setState(overwriteValue);
|
|
18218
|
-
}, [overwriteValue]);
|
|
18219
|
-
const onChangeWrapper = (action) => {
|
|
18220
|
-
const resolved = resolveSetState(action, state);
|
|
18221
|
-
setState(resolved);
|
|
18222
|
-
onChange?.(resolved);
|
|
18223
|
-
};
|
|
18224
|
-
return [state, onChangeWrapper];
|
|
18225
|
-
};
|
|
18226
|
-
|
|
18227
|
-
// src/hooks/useRerender.ts
|
|
18228
|
-
import { useReducer as useReducer2 } from "react";
|
|
18229
|
-
var useRerender = () => {
|
|
18230
|
-
return useReducer2(() => ({}), {})[1];
|
|
18231
|
-
};
|
|
18232
|
-
|
|
18233
|
-
// src/hooks/useSearch.ts
|
|
18234
|
-
import { useCallback as useCallback33, useEffect as useEffect44, useMemo as useMemo30, useState as useState40 } from "react";
|
|
18235
|
-
|
|
18236
|
-
// src/utils/simpleSearch.ts
|
|
18237
|
-
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
18238
|
-
return objects.filter((object) => {
|
|
18239
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
18240
|
-
if (!mappedSearchKeywords) {
|
|
18241
|
-
return true;
|
|
18242
|
-
}
|
|
18243
|
-
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
18244
|
-
});
|
|
18245
|
-
};
|
|
18246
|
-
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
18247
|
-
return objects.filter((object) => {
|
|
18248
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
18249
|
-
if (!mappedSearchKeywords) {
|
|
18250
|
-
return true;
|
|
18370
|
+
}
|
|
18371
|
+
),
|
|
18372
|
+
/* @__PURE__ */ jsx93(SelectContent, { children })
|
|
18373
|
+
]
|
|
18374
|
+
}
|
|
18375
|
+
)
|
|
18376
|
+
}
|
|
18377
|
+
)
|
|
18251
18378
|
}
|
|
18252
|
-
|
|
18253
|
-
});
|
|
18254
|
-
};
|
|
18255
|
-
var SimpleSearchWithMapping = (search, objects, mapping) => {
|
|
18256
|
-
return MultiSearchWithMapping(search, objects, (value) => [mapping(value)]);
|
|
18257
|
-
};
|
|
18258
|
-
var SimpleSearch = (search, objects) => {
|
|
18259
|
-
return SimpleSearchWithMapping(search, objects, (value) => value);
|
|
18379
|
+
);
|
|
18260
18380
|
};
|
|
18261
18381
|
|
|
18262
|
-
// src/
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
disabled = false
|
|
18382
|
+
// src/components/user-interaction/properties/TextProperty.tsx
|
|
18383
|
+
import { Text } from "lucide-react";
|
|
18384
|
+
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
18385
|
+
var TextProperty = ({
|
|
18386
|
+
value,
|
|
18387
|
+
readOnly,
|
|
18388
|
+
onValueChange,
|
|
18389
|
+
onEditComplete,
|
|
18390
|
+
...baseProps
|
|
18272
18391
|
}) => {
|
|
18273
|
-
const
|
|
18274
|
-
const
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
if (!sortingFunction) {
|
|
18296
|
-
return filteredResult;
|
|
18297
|
-
}
|
|
18298
|
-
return filteredResult.sort(sortingFunction);
|
|
18299
|
-
}, [filteredResult, sortingFunction]);
|
|
18300
|
-
const usedResult = useMemo30(() => {
|
|
18301
|
-
if (!disabled) {
|
|
18302
|
-
return sortedAndFilteredResult;
|
|
18392
|
+
const translation = useHightideTranslation();
|
|
18393
|
+
const hasValue = value !== void 0;
|
|
18394
|
+
return /* @__PURE__ */ jsx94(
|
|
18395
|
+
PropertyBase,
|
|
18396
|
+
{
|
|
18397
|
+
...baseProps,
|
|
18398
|
+
hasValue,
|
|
18399
|
+
icon: /* @__PURE__ */ jsx94(Text, { size: 24 }),
|
|
18400
|
+
children: ({ invalid }) => /* @__PURE__ */ jsx94(
|
|
18401
|
+
Textarea,
|
|
18402
|
+
{
|
|
18403
|
+
"data-name": "property-input",
|
|
18404
|
+
className: "w-full",
|
|
18405
|
+
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
18406
|
+
rows: 5,
|
|
18407
|
+
value: value ?? "",
|
|
18408
|
+
readOnly,
|
|
18409
|
+
placeholder: translation("text"),
|
|
18410
|
+
onValueChange: (value2) => onValueChange?.(value2),
|
|
18411
|
+
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
18412
|
+
}
|
|
18413
|
+
)
|
|
18303
18414
|
}
|
|
18304
|
-
|
|
18305
|
-
}, [disabled, list, sortedAndFilteredResult]);
|
|
18306
|
-
return {
|
|
18307
|
-
result: usedResult,
|
|
18308
|
-
hasResult: usedResult.length > 0,
|
|
18309
|
-
allItems: list,
|
|
18310
|
-
updateSearch,
|
|
18311
|
-
search,
|
|
18312
|
-
setSearch
|
|
18313
|
-
};
|
|
18415
|
+
);
|
|
18314
18416
|
};
|
|
18315
18417
|
|
|
18316
|
-
// src/
|
|
18418
|
+
// src/components/utils/Transition.tsx
|
|
18317
18419
|
import { useEffect as useEffect45, useState as useState41 } from "react";
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
18326
|
-
useEffect45(() => {
|
|
18327
|
-
setDateAndTimeStrings({
|
|
18328
|
-
compareDate: date,
|
|
18329
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
18330
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
18331
|
-
});
|
|
18332
|
-
}, [date, absoluteFormat, locale]);
|
|
18420
|
+
function Transition({
|
|
18421
|
+
children,
|
|
18422
|
+
show,
|
|
18423
|
+
includeAnimation = true
|
|
18424
|
+
}) {
|
|
18425
|
+
const [isOpen, setIsOpen] = useState41(show);
|
|
18426
|
+
const [isTransitioning, setIsTransitioning] = useState41(!isOpen);
|
|
18427
|
+
const isUsingReducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : true;
|
|
18333
18428
|
useEffect45(() => {
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
setDateAndTimeStrings({
|
|
18348
|
-
compareDate: date,
|
|
18349
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
18350
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
18351
|
-
});
|
|
18352
|
-
}, delayInSeconds * 1e3 / 2);
|
|
18353
|
-
};
|
|
18354
|
-
startTimer();
|
|
18355
|
-
return () => clearInterval(timeoutId);
|
|
18356
|
-
}, [absoluteFormat, date, locale]);
|
|
18357
|
-
return {
|
|
18358
|
-
absolute: dateAndTimeStrings.absolute,
|
|
18359
|
-
relative: dateAndTimeStrings.relative
|
|
18360
|
-
};
|
|
18361
|
-
};
|
|
18362
|
-
|
|
18363
|
-
// src/utils/emailValidation.ts
|
|
18364
|
-
var validateEmail = (email) => {
|
|
18365
|
-
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
18366
|
-
};
|
|
18367
|
-
|
|
18368
|
-
// src/hooks/useValidators.ts
|
|
18369
|
-
import { useMemo as useMemo31 } from "react";
|
|
18370
|
-
var notEmpty = (value) => {
|
|
18371
|
-
if (!value) {
|
|
18372
|
-
return "notEmpty";
|
|
18373
|
-
}
|
|
18374
|
-
};
|
|
18375
|
-
var boundsValidator = (length, bounds) => {
|
|
18376
|
-
const [min, max] = bounds;
|
|
18377
|
-
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
18378
|
-
return "range";
|
|
18379
|
-
}
|
|
18380
|
-
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
18381
|
-
return "lower";
|
|
18382
|
-
}
|
|
18383
|
-
if (max !== void 0 && length !== void 0 && length > max) {
|
|
18384
|
-
return "upper";
|
|
18385
|
-
}
|
|
18386
|
-
return "none";
|
|
18387
|
-
};
|
|
18388
|
-
var lengthValidator = (value, bounds) => {
|
|
18389
|
-
const mapping = {
|
|
18390
|
-
range: "outOfRangeString",
|
|
18391
|
-
lower: "tooShort",
|
|
18392
|
-
upper: "tooLong",
|
|
18393
|
-
none: void 0
|
|
18394
|
-
};
|
|
18395
|
-
return mapping[boundsValidator(value?.length, bounds)];
|
|
18396
|
-
};
|
|
18397
|
-
var selectionValidator = (value, bounds) => {
|
|
18398
|
-
const mapping = {
|
|
18399
|
-
range: "outOfRangeSelectionItems",
|
|
18400
|
-
lower: "tooFewSelectionItems",
|
|
18401
|
-
upper: "tooManySelectionItems",
|
|
18402
|
-
none: void 0
|
|
18403
|
-
};
|
|
18404
|
-
return mapping[boundsValidator(value?.length, bounds)];
|
|
18405
|
-
};
|
|
18406
|
-
var emailValidator = (value) => {
|
|
18407
|
-
if (!value || !validateEmail(value)) {
|
|
18408
|
-
return "invalidEmail";
|
|
18409
|
-
}
|
|
18410
|
-
};
|
|
18411
|
-
var UseValidators = {
|
|
18412
|
-
notEmpty,
|
|
18413
|
-
length: lengthValidator,
|
|
18414
|
-
email: emailValidator,
|
|
18415
|
-
selection: selectionValidator
|
|
18416
|
-
};
|
|
18417
|
-
var useTranslatedValidators = () => {
|
|
18418
|
-
const translation = useHightideTranslation();
|
|
18419
|
-
return useMemo31(() => ({
|
|
18420
|
-
notEmpty: (value) => {
|
|
18421
|
-
const result = notEmpty(value);
|
|
18422
|
-
if (result) {
|
|
18423
|
-
return translation(result);
|
|
18424
|
-
}
|
|
18425
|
-
},
|
|
18426
|
-
length: (value, length) => {
|
|
18427
|
-
const [min, max] = length;
|
|
18428
|
-
const result = lengthValidator(value, length);
|
|
18429
|
-
if (result) {
|
|
18430
|
-
return translation(result, { min, max });
|
|
18431
|
-
}
|
|
18432
|
-
},
|
|
18433
|
-
email: (value) => {
|
|
18434
|
-
const result = emailValidator(value ?? "");
|
|
18435
|
-
if (result) {
|
|
18436
|
-
return translation(result);
|
|
18437
|
-
}
|
|
18429
|
+
setIsOpen(show);
|
|
18430
|
+
setIsTransitioning(true);
|
|
18431
|
+
}, [show]);
|
|
18432
|
+
const onAnimationEnd = () => setIsTransitioning(false);
|
|
18433
|
+
const bag = {
|
|
18434
|
+
isOpen,
|
|
18435
|
+
isTransitioning,
|
|
18436
|
+
isUsingReducedMotion,
|
|
18437
|
+
data: {
|
|
18438
|
+
"data-open": isOpen && !isTransitioning ? "" : void 0,
|
|
18439
|
+
"data-opening": isOpen && isTransitioning ? "" : void 0,
|
|
18440
|
+
"data-closing": !isOpen && isTransitioning ? "" : void 0,
|
|
18441
|
+
"data-closed": !isOpen && !isTransitioning ? "" : void 0
|
|
18438
18442
|
},
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
return translation(
|
|
18444
|
-
result,
|
|
18445
|
-
{ min, max }
|
|
18446
|
-
);
|
|
18447
|
-
}
|
|
18443
|
+
handlers: {
|
|
18444
|
+
onTransitionEnd: () => setIsTransitioning(false),
|
|
18445
|
+
onTransitionCancel: () => setIsTransitioning(false),
|
|
18446
|
+
onAnimationEnd: includeAnimation ? onAnimationEnd : void 0
|
|
18448
18447
|
}
|
|
18449
|
-
}
|
|
18448
|
+
};
|
|
18449
|
+
return BagFunctionUtil.resolve(children, bag);
|
|
18450
|
+
}
|
|
18451
|
+
|
|
18452
|
+
// src/global-contexts/HightideProvider.tsx
|
|
18453
|
+
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
18454
|
+
var HightideProvider = ({
|
|
18455
|
+
children,
|
|
18456
|
+
theme,
|
|
18457
|
+
locale,
|
|
18458
|
+
config
|
|
18459
|
+
}) => {
|
|
18460
|
+
return /* @__PURE__ */ jsx95(LocaleProvider, { ...locale, children: /* @__PURE__ */ jsx95(ThemeProvider, { ...theme, children: /* @__PURE__ */ jsx95(HightideConfigProvider, { ...config, children }) }) });
|
|
18450
18461
|
};
|
|
18451
18462
|
|
|
18452
18463
|
// src/utils/builder.ts
|