@helpwave/hightide 0.8.6 → 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 +18 -8
- package/dist/index.d.ts +18 -8
- package/dist/index.js +6761 -6747
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1288 -1274
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -9563,21 +9563,23 @@ var Tooltip = ({
|
|
|
9563
9563
|
containerClassName,
|
|
9564
9564
|
alignment,
|
|
9565
9565
|
isAnimated,
|
|
9566
|
-
|
|
9566
|
+
onIsShownChange,
|
|
9567
|
+
displayProps
|
|
9567
9568
|
}) => {
|
|
9568
9569
|
return /* @__PURE__ */ jsxs6(
|
|
9569
9570
|
TooltipRoot,
|
|
9570
9571
|
{
|
|
9571
9572
|
isInitiallyShown,
|
|
9573
|
+
onIsShownChange,
|
|
9572
9574
|
appearDelay,
|
|
9573
9575
|
disabled,
|
|
9574
9576
|
children: [
|
|
9575
|
-
/* @__PURE__ */ jsx16(TooltipTrigger, { children: ({ props
|
|
9577
|
+
/* @__PURE__ */ jsx16(TooltipTrigger, { children: ({ props, callbackRef, disabled: disabled2 }) => /* @__PURE__ */ jsx16(
|
|
9576
9578
|
"div",
|
|
9577
9579
|
{
|
|
9578
9580
|
ref: callbackRef,
|
|
9579
9581
|
className: containerClassName,
|
|
9580
|
-
...disabled2 ? void 0 :
|
|
9582
|
+
...disabled2 ? void 0 : props,
|
|
9581
9583
|
children
|
|
9582
9584
|
}
|
|
9583
9585
|
) }),
|
|
@@ -9586,7 +9588,7 @@ var Tooltip = ({
|
|
|
9586
9588
|
{
|
|
9587
9589
|
alignment,
|
|
9588
9590
|
isAnimated,
|
|
9589
|
-
...
|
|
9591
|
+
...displayProps,
|
|
9590
9592
|
children: tooltip
|
|
9591
9593
|
}
|
|
9592
9594
|
)
|
|
@@ -10146,7 +10148,7 @@ var useControlledState = ({
|
|
|
10146
10148
|
onValueChangeStable(resolved);
|
|
10147
10149
|
}, [onValueChangeStable, isControlled]);
|
|
10148
10150
|
const value = isControlled ? controlledValue : internalValue;
|
|
10149
|
-
return [value, setState];
|
|
10151
|
+
return [value, setState, isControlled];
|
|
10150
10152
|
};
|
|
10151
10153
|
|
|
10152
10154
|
// src/components/layout/Expandable.tsx
|
|
@@ -10280,9 +10282,10 @@ var Expandable = forwardRef7(function Expandable2({
|
|
|
10280
10282
|
trigger,
|
|
10281
10283
|
triggerProps,
|
|
10282
10284
|
contentProps,
|
|
10283
|
-
contentExpandedClassName
|
|
10285
|
+
contentExpandedClassName,
|
|
10286
|
+
...props
|
|
10284
10287
|
}, ref) {
|
|
10285
|
-
return /* @__PURE__ */ jsxs9(ExpandableRoot, { ref, children: [
|
|
10288
|
+
return /* @__PURE__ */ jsxs9(ExpandableRoot, { ref, ...props, children: [
|
|
10286
10289
|
/* @__PURE__ */ jsx20(ExpandableHeader, { ...triggerProps, children: trigger }),
|
|
10287
10290
|
/* @__PURE__ */ jsx20(ExpandableContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsx20(
|
|
10288
10291
|
ExpandableContent,
|
|
@@ -10886,8 +10889,8 @@ var MarkdownInterpreter = ({ text, className }) => {
|
|
|
10886
10889
|
};
|
|
10887
10890
|
|
|
10888
10891
|
// src/components/layout/TabSwitcher.tsx
|
|
10889
|
-
import { useCallback as
|
|
10890
|
-
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";
|
|
10891
10894
|
import clsx7 from "clsx";
|
|
10892
10895
|
|
|
10893
10896
|
// src/utils/propsUtil.ts
|
|
@@ -11024,310 +11027,136 @@ var PropsUtil = {
|
|
|
11024
11027
|
|
|
11025
11028
|
// src/components/layout/TabSwitcher.tsx
|
|
11026
11029
|
import { createPortal as createPortal2 } from "react-dom";
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
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;
|
|
11037
11045
|
}
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
const currentIndex = sortedInfos.findIndex((t) => t.id === currentActiveId);
|
|
11042
|
-
const startIndex = currentIndex >= 0 ? (currentIndex + 1) % sortedInfos.length : 0;
|
|
11043
|
-
for (let i = 0; i < sortedInfos.length; i++) {
|
|
11044
|
-
const idx = (startIndex + i) % sortedInfos.length;
|
|
11045
|
-
if (!sortedInfos[idx].disabled) return sortedInfos[idx].id;
|
|
11046
|
+
var FocusGuardsService = class _FocusGuardsService {
|
|
11047
|
+
constructor() {
|
|
11048
|
+
this.count = 0;
|
|
11046
11049
|
}
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
}
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
return { activeId, infos: ordered };
|
|
11070
|
-
});
|
|
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();
|
|
11071
11072
|
return () => {
|
|
11072
|
-
|
|
11073
|
-
const infos = prevState.infos.filter((t) => t.id !== id);
|
|
11074
|
-
const activeTab = prevState.activeId !== null ? infos.find((t) => t.id === prevState.activeId) : null;
|
|
11075
|
-
const activeIsUnregisteredOrDisabled = prevState.activeId === id || activeTab?.disabled === true;
|
|
11076
|
-
const nextId = prevState.activeId === id ? getNextEnabledIdInOrder(prevState.infos, id) : getNextEnabledIdInOrder(infos, prevState.activeId);
|
|
11077
|
-
const activeId = activeIsUnregisteredOrDisabled ? nextId : prevState.activeId;
|
|
11078
|
-
return { activeId, infos };
|
|
11079
|
-
});
|
|
11073
|
+
FocusGuardsService.getInstance().remove();
|
|
11080
11074
|
};
|
|
11081
11075
|
}, []);
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
|
|
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
|
+
);
|
|
11087
11089
|
}, []);
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
{
|
|
11091
|
-
|
|
11092
|
-
tabs: {
|
|
11093
|
-
activeId: state.activeId,
|
|
11094
|
-
setActiveId,
|
|
11095
|
-
subscribe,
|
|
11096
|
-
info: state.infos
|
|
11097
|
-
},
|
|
11098
|
-
portal: {
|
|
11099
|
-
id: portalState?.id ?? null,
|
|
11100
|
-
element: portalState?.ref.current ?? null,
|
|
11101
|
-
setPortal: registerPortal
|
|
11102
|
-
}
|
|
11103
|
-
},
|
|
11104
|
-
children
|
|
11090
|
+
const getNextFocusElement = useCallback13(() => {
|
|
11091
|
+
const elements = getFocusableElements();
|
|
11092
|
+
if (elements.length === 0) {
|
|
11093
|
+
return void 0;
|
|
11105
11094
|
}
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
const { info, activeId, setActiveId: setActive } = tabs;
|
|
11111
|
-
const refs = useRef14({});
|
|
11112
|
-
const onKeyDown = (e) => {
|
|
11113
|
-
const idx = info.findIndex((tab) => tab.id === activeId);
|
|
11114
|
-
if (idx === -1) return;
|
|
11115
|
-
const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
11116
|
-
if (step === 0) return;
|
|
11117
|
-
let nextIdx = idx;
|
|
11118
|
-
for (let i = 0; i < info.length; i++) {
|
|
11119
|
-
nextIdx = (nextIdx + step + info.length) % info.length;
|
|
11120
|
-
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];
|
|
11121
11099
|
}
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
onKeyDown,
|
|
11133
|
-
role: "tablist",
|
|
11134
|
-
"aria-orientation": "horizontal",
|
|
11135
|
-
style: { "--tab-count": info.length, ...props.style },
|
|
11136
|
-
children: info.map((tabInfo) => {
|
|
11137
|
-
const isDisabled = !!tabInfo.disabled;
|
|
11138
|
-
const isActive = activeId === tabInfo.id;
|
|
11139
|
-
return /* @__PURE__ */ jsx25(
|
|
11140
|
-
"li",
|
|
11141
|
-
{
|
|
11142
|
-
ref: (el) => {
|
|
11143
|
-
refs.current[tabInfo.id] = el;
|
|
11144
|
-
},
|
|
11145
|
-
id: tabInfo.labelId,
|
|
11146
|
-
...isDisabled ? {} : PropsUtil.aria.click(() => setActive(tabInfo.id)),
|
|
11147
|
-
"data-name": "tab-list-item",
|
|
11148
|
-
"data-active": PropsUtil.dataAttributes.bool(isActive),
|
|
11149
|
-
"data-disabled": PropsUtil.dataAttributes.bool(isDisabled),
|
|
11150
|
-
role: "tab",
|
|
11151
|
-
"aria-selected": isActive,
|
|
11152
|
-
"aria-disabled": isDisabled,
|
|
11153
|
-
"aria-controls": activeId,
|
|
11154
|
-
tabIndex: isActive && !isDisabled ? 0 : -1,
|
|
11155
|
-
children: tabInfo.label
|
|
11156
|
-
},
|
|
11157
|
-
tabInfo.id
|
|
11158
|
-
);
|
|
11159
|
-
})
|
|
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;
|
|
11160
11110
|
}
|
|
11161
|
-
|
|
11162
|
-
|
|
11163
|
-
|
|
11164
|
-
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
useEffect16(() => {
|
|
11170
|
-
setPortal({ id, ref });
|
|
11171
|
-
return () => setPortal(null);
|
|
11172
|
-
}, [id, setPortal]);
|
|
11173
|
-
return /* @__PURE__ */ jsx25(
|
|
11174
|
-
"div",
|
|
11175
|
-
{
|
|
11176
|
-
...props,
|
|
11177
|
-
ref,
|
|
11178
|
-
id,
|
|
11179
|
-
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
|
+
}
|
|
11180
11119
|
}
|
|
11181
|
-
|
|
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
|
+
};
|
|
11182
11133
|
}
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
const
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
return subscribe({ id, label, labelId, disabled, ref });
|
|
11192
|
-
}, [id, label, labelId, disabled, subscribe]);
|
|
11193
|
-
const isActive = activeId === id;
|
|
11194
|
-
const content = /* @__PURE__ */ jsx25(
|
|
11195
|
-
"div",
|
|
11196
|
-
{
|
|
11197
|
-
...props,
|
|
11198
|
-
ref,
|
|
11199
|
-
id,
|
|
11200
|
-
hidden: !isActive,
|
|
11201
|
-
"data-name": props["data-name"] ?? "tab-panel",
|
|
11202
|
-
"data-disabled": PropsUtil.dataAttributes.bool(disabled),
|
|
11203
|
-
role: "tabpanel",
|
|
11204
|
-
"aria-labelledby": labelId,
|
|
11205
|
-
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;
|
|
11206
11142
|
}
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
}
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
onShowMoreClicked,
|
|
11222
|
-
color = "primary",
|
|
11223
|
-
badge,
|
|
11224
|
-
contentClassName = "",
|
|
11225
|
-
className = ""
|
|
11226
|
-
}) => {
|
|
11227
|
-
const translation = useHightideTranslation();
|
|
11228
|
-
const chipColorMapping = {
|
|
11229
|
-
primary: "text-text-image-primary-background bg-text-image-primary-text",
|
|
11230
|
-
secondary: "text-text-image-secondary-background bg-text-image-secondary-text",
|
|
11231
|
-
dark: "text-text-image-dark-background bg-text-image-dark-text"
|
|
11232
|
-
};
|
|
11233
|
-
const colorMapping = {
|
|
11234
|
-
primary: "text-text-image-primary-text bg-linear-to-r from-30% from-text-image-primary-background to-text-image-primary-background/55",
|
|
11235
|
-
secondary: "text-text-image-secondary-text bg-linear-to-r from-30% from-text-image-secondary-background to-text-image-secondary-background/55",
|
|
11236
|
-
dark: "text-text-image-dark-text bg-linear-to-r from-30% from-text-image-dark-background to-text-image-dark-background/55"
|
|
11237
|
-
};
|
|
11238
|
-
return /* @__PURE__ */ jsx26(
|
|
11239
|
-
"div",
|
|
11240
|
-
{
|
|
11241
|
-
className: clsx8("rounded-2xl w-full", className),
|
|
11242
|
-
style: {
|
|
11243
|
-
backgroundImage: `url(${imageUrl})`,
|
|
11244
|
-
backgroundSize: "cover"
|
|
11245
|
-
},
|
|
11246
|
-
children: /* @__PURE__ */ jsxs12(
|
|
11247
|
-
"div",
|
|
11248
|
-
{
|
|
11249
|
-
className: clsx8(`flex-col-2 px-6 py-12 rounded-2xl h-full`, colorMapping[color], contentClassName),
|
|
11250
|
-
children: [
|
|
11251
|
-
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 }) }),
|
|
11252
|
-
/* @__PURE__ */ jsxs12("div", { className: "flex-col-1 overflow-hidden", children: [
|
|
11253
|
-
/* @__PURE__ */ jsx26("span", { className: "typography-title-lg", children: title }),
|
|
11254
|
-
/* @__PURE__ */ jsx26("span", { className: "text-ellipsis overflow-hidden", children: description })
|
|
11255
|
-
] }),
|
|
11256
|
-
onShowMoreClicked && /* @__PURE__ */ jsx26("div", { className: "flex-row-2 mt-2 underline", children: /* @__PURE__ */ jsx26(
|
|
11257
|
-
Button,
|
|
11258
|
-
{
|
|
11259
|
-
color: "neutral",
|
|
11260
|
-
coloringStyle: "text",
|
|
11261
|
-
onClick: onShowMoreClicked,
|
|
11262
|
-
children: translation("showMore")
|
|
11263
|
-
}
|
|
11264
|
-
) })
|
|
11265
|
-
]
|
|
11266
|
-
}
|
|
11267
|
-
)
|
|
11268
|
-
}
|
|
11269
|
-
);
|
|
11270
|
-
};
|
|
11271
|
-
|
|
11272
|
-
// src/components/layout/VerticalDivider.tsx
|
|
11273
|
-
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
11274
|
-
var VerticalDivider = ({
|
|
11275
|
-
width = 1,
|
|
11276
|
-
height = 100,
|
|
11277
|
-
strokeWidth = 4,
|
|
11278
|
-
dashGap = 4,
|
|
11279
|
-
dashLength = 4
|
|
11280
|
-
}) => {
|
|
11281
|
-
return /* @__PURE__ */ jsx27("div", { style: { width: width + "px", height: height + "px" }, children: /* @__PURE__ */ jsxs13(
|
|
11282
|
-
"svg",
|
|
11283
|
-
{
|
|
11284
|
-
width,
|
|
11285
|
-
height,
|
|
11286
|
-
viewBox: `0 0 ${width} ${height}`,
|
|
11287
|
-
fill: "none",
|
|
11288
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
11289
|
-
children: [
|
|
11290
|
-
/* @__PURE__ */ jsx27(
|
|
11291
|
-
"line",
|
|
11292
|
-
{
|
|
11293
|
-
opacity: "0.5",
|
|
11294
|
-
x1: width / 2,
|
|
11295
|
-
y1: height,
|
|
11296
|
-
x2: width / 2,
|
|
11297
|
-
y2: "0",
|
|
11298
|
-
stroke: "url(#paint_linear)",
|
|
11299
|
-
strokeWidth,
|
|
11300
|
-
strokeDasharray: `${dashLength} ${dashLength + dashGap}`,
|
|
11301
|
-
strokeLinecap: "round"
|
|
11302
|
-
}
|
|
11303
|
-
),
|
|
11304
|
-
/* @__PURE__ */ jsx27("defs", { children: /* @__PURE__ */ jsxs13(
|
|
11305
|
-
"linearGradient",
|
|
11306
|
-
{
|
|
11307
|
-
id: "paint_linear",
|
|
11308
|
-
x1: width / 2,
|
|
11309
|
-
y1: "0",
|
|
11310
|
-
x2: width / 2,
|
|
11311
|
-
y2: height,
|
|
11312
|
-
gradientUnits: "userSpaceOnUse",
|
|
11313
|
-
children: [
|
|
11314
|
-
/* @__PURE__ */ jsx27("stop", { stopOpacity: "0", stopColor: "currentColor" }),
|
|
11315
|
-
/* @__PURE__ */ jsx27("stop", { offset: "0.5", stopColor: "currentColor" }),
|
|
11316
|
-
/* @__PURE__ */ jsx27("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0" })
|
|
11317
|
-
]
|
|
11318
|
-
}
|
|
11319
|
-
) })
|
|
11320
|
-
]
|
|
11321
|
-
}
|
|
11322
|
-
) });
|
|
11323
|
-
};
|
|
11324
|
-
|
|
11325
|
-
// src/components/layout/dialog/Dialog.tsx
|
|
11326
|
-
import { forwardRef as forwardRef10, useCallback as useCallback16, useContext as useContext10, useId as useId8, useImperativeHandle as useImperativeHandle6, useMemo as useMemo13, useRef as useRef18 } from "react";
|
|
11327
|
-
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
|
+
};
|
|
11328
11157
|
|
|
11329
11158
|
// src/hooks/focus/useFocusTrap.ts
|
|
11330
|
-
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";
|
|
11331
11160
|
var createFocusGuard = () => {
|
|
11332
11161
|
const div = document.createElement("div");
|
|
11333
11162
|
Object.assign(div.style, {
|
|
@@ -11443,9 +11272,9 @@ var useFocusTrap = ({
|
|
|
11443
11272
|
active,
|
|
11444
11273
|
initialFocus
|
|
11445
11274
|
}) => {
|
|
11446
|
-
const lastFocusRef =
|
|
11447
|
-
const [paused, setPaused] =
|
|
11448
|
-
const id =
|
|
11275
|
+
const lastFocusRef = useRef14(null);
|
|
11276
|
+
const [paused, setPaused] = useState15(false);
|
|
11277
|
+
const id = useId6();
|
|
11449
11278
|
const focusElement = useCallback14(() => {
|
|
11450
11279
|
const containerElement = container.current;
|
|
11451
11280
|
if (initialFocus?.current) {
|
|
@@ -11460,7 +11289,7 @@ var useFocusTrap = ({
|
|
|
11460
11289
|
}
|
|
11461
11290
|
}
|
|
11462
11291
|
}, [container, initialFocus]);
|
|
11463
|
-
|
|
11292
|
+
useEffect18(() => {
|
|
11464
11293
|
if (active) {
|
|
11465
11294
|
let pause = function() {
|
|
11466
11295
|
setPaused(true);
|
|
@@ -11485,7 +11314,7 @@ var useFocusTrap = ({
|
|
|
11485
11314
|
};
|
|
11486
11315
|
}
|
|
11487
11316
|
}, [active, container, focusElement, id, initialFocus]);
|
|
11488
|
-
|
|
11317
|
+
useEffect18(() => {
|
|
11489
11318
|
if (active && !paused) {
|
|
11490
11319
|
let onKeyDown = function(event) {
|
|
11491
11320
|
const key = event.key;
|
|
@@ -11512,40 +11341,152 @@ var useFocusTrap = ({
|
|
|
11512
11341
|
}, [active, paused, container, initialFocus, focusElement]);
|
|
11513
11342
|
};
|
|
11514
11343
|
|
|
11515
|
-
// src/
|
|
11516
|
-
import {
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
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
|
+
});
|
|
11523
11411
|
});
|
|
11524
|
-
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];
|
|
11525
11476
|
};
|
|
11526
|
-
var FocusTrapWrapper = forwardRef9(function FocusTrap2({
|
|
11527
|
-
active,
|
|
11528
|
-
initialFocus,
|
|
11529
|
-
...props
|
|
11530
|
-
}, forwardedRef) {
|
|
11531
|
-
const innerRef = useRef16(null);
|
|
11532
|
-
useImperativeHandle5(forwardedRef, () => innerRef.current);
|
|
11533
|
-
useFocusTrap({ container: innerRef, active, initialFocus });
|
|
11534
|
-
return /* @__PURE__ */ jsx28("div", { ref: innerRef, ...props });
|
|
11535
|
-
});
|
|
11536
11477
|
|
|
11537
11478
|
// src/hooks/usePresenceRef.ts
|
|
11538
|
-
import { useCallback as useCallback15, useEffect as
|
|
11479
|
+
import { useCallback as useCallback15, useEffect as useEffect24, useRef as useRef16, useState as useState19 } from "react";
|
|
11539
11480
|
var usePresenceRef = ({
|
|
11540
11481
|
isOpen = true
|
|
11541
11482
|
}) => {
|
|
11542
|
-
const [isPresent, setIsPresent] =
|
|
11543
|
-
const ref =
|
|
11483
|
+
const [isPresent, setIsPresent] = useState19(false);
|
|
11484
|
+
const ref = useRef16(null);
|
|
11544
11485
|
const refAssignment = useCallback15((node) => {
|
|
11545
11486
|
ref.current = node;
|
|
11546
11487
|
setIsPresent((prev) => prev || !!node);
|
|
11547
11488
|
}, []);
|
|
11548
|
-
|
|
11489
|
+
useEffect24(() => {
|
|
11549
11490
|
if (!isOpen) {
|
|
11550
11491
|
setIsPresent(false);
|
|
11551
11492
|
}
|
|
@@ -11557,24 +11498,752 @@ var usePresenceRef = ({
|
|
|
11557
11498
|
};
|
|
11558
11499
|
};
|
|
11559
11500
|
|
|
11560
|
-
// src/
|
|
11561
|
-
import {
|
|
11562
|
-
var
|
|
11563
|
-
|
|
11564
|
-
|
|
11565
|
-
if (!context) {
|
|
11566
|
-
throw new Error("useDialogContext must be used within a <DialogContext.Provider>");
|
|
11567
|
-
}
|
|
11568
|
-
return context;
|
|
11569
|
-
}
|
|
11501
|
+
// src/hooks/useRerender.ts
|
|
11502
|
+
import { useReducer as useReducer2 } from "react";
|
|
11503
|
+
var useRerender = () => {
|
|
11504
|
+
return useReducer2(() => ({}), {})[1];
|
|
11505
|
+
};
|
|
11570
11506
|
|
|
11571
|
-
// src/
|
|
11572
|
-
import {
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
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,
|
|
11578
12247
|
isModal: isModalOverwrite = true,
|
|
11579
12248
|
onClose,
|
|
11580
12249
|
backgroundClassName,
|
|
@@ -11584,14 +12253,14 @@ var Dialog = forwardRef10(function Dialog2({
|
|
|
11584
12253
|
}, forwardedRef) {
|
|
11585
12254
|
const translation = useHightideTranslation();
|
|
11586
12255
|
const generatedId = useId8();
|
|
11587
|
-
const ids =
|
|
12256
|
+
const ids = useMemo15(() => ({
|
|
11588
12257
|
container: `dialog-container-${generatedId}`,
|
|
11589
12258
|
background: `dialog-background-${generatedId}`,
|
|
11590
12259
|
content: props.id ?? `dialog-content-${generatedId}`,
|
|
11591
12260
|
title: `dialog-title-${generatedId}`,
|
|
11592
12261
|
description: `dialog-description-${generatedId}`
|
|
11593
12262
|
}), [generatedId, props.id]);
|
|
11594
|
-
const containerRef =
|
|
12263
|
+
const containerRef = useRef19(null);
|
|
11595
12264
|
const context = useContext10(DialogContext);
|
|
11596
12265
|
const isOpen = isOpenOverwrite ?? context?.isOpen ?? false;
|
|
11597
12266
|
const isModal = isModalOverwrite ?? context?.isModal ?? true;
|
|
@@ -11600,7 +12269,7 @@ var Dialog = forwardRef10(function Dialog2({
|
|
|
11600
12269
|
});
|
|
11601
12270
|
useImperativeHandle6(forwardedRef, () => ref.current, [ref]);
|
|
11602
12271
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
11603
|
-
const onCloseWrapper =
|
|
12272
|
+
const onCloseWrapper = useCallback18(() => {
|
|
11604
12273
|
if (!isModal) return;
|
|
11605
12274
|
onCloseStable();
|
|
11606
12275
|
context?.setIsOpen(false);
|
|
@@ -11684,10 +12353,10 @@ var Dialog = forwardRef10(function Dialog2({
|
|
|
11684
12353
|
});
|
|
11685
12354
|
|
|
11686
12355
|
// src/components/layout/dialog/DialogOpener.tsx
|
|
11687
|
-
import { useMemo as
|
|
12356
|
+
import { useMemo as useMemo16 } from "react";
|
|
11688
12357
|
function DialogOpenerWrapper({ children }) {
|
|
11689
12358
|
const context = useDialogContext();
|
|
11690
|
-
const bag =
|
|
12359
|
+
const bag = useMemo16(() => ({
|
|
11691
12360
|
open: () => context.setIsOpen(true),
|
|
11692
12361
|
close: () => context.setIsOpen(false),
|
|
11693
12362
|
toggleOpen: () => context.setIsOpen((prev) => !prev),
|
|
@@ -11788,117 +12457,18 @@ var DiscardChangesDialog = ({
|
|
|
11788
12457
|
{
|
|
11789
12458
|
...props,
|
|
11790
12459
|
titleElement: titleOverwrite ?? translation("unsavedChanges"),
|
|
11791
|
-
description: descriptionOverwrite ?? translation("unsavedChangesSaveQuestion"),
|
|
11792
|
-
onConfirm: onSave,
|
|
11793
|
-
onCancel,
|
|
11794
|
-
onDecline: onDontSave,
|
|
11795
|
-
buttonOverwrites: [{ text: translation("cancel") }, { text: translation("discardChanges") }, { text: translation("save") }],
|
|
11796
|
-
children
|
|
11797
|
-
}
|
|
11798
|
-
);
|
|
11799
|
-
};
|
|
11800
|
-
|
|
11801
|
-
// src/components/user-interaction/input/Input.tsx
|
|
11802
|
-
import { forwardRef as forwardRef11, useImperativeHandle as useImperativeHandle7, useRef as useRef19 } from "react";
|
|
11803
|
-
|
|
11804
|
-
// src/hooks/useDelay.ts
|
|
11805
|
-
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
11806
|
-
var defaultOptions2 = {
|
|
11807
|
-
delay: 3e3,
|
|
11808
|
-
disabled: false
|
|
11809
|
-
};
|
|
11810
|
-
function useDelay(options) {
|
|
11811
|
-
const [timer, setTimer] = useState18(void 0);
|
|
11812
|
-
const { delay, disabled } = {
|
|
11813
|
-
...defaultOptions2,
|
|
11814
|
-
...options
|
|
11815
|
-
};
|
|
11816
|
-
const clearTimer = () => {
|
|
11817
|
-
clearTimeout(timer);
|
|
11818
|
-
setTimer(void 0);
|
|
11819
|
-
};
|
|
11820
|
-
const restartTimer = (onDelayFinish) => {
|
|
11821
|
-
if (disabled) {
|
|
11822
|
-
return;
|
|
11823
|
-
}
|
|
11824
|
-
clearTimeout(timer);
|
|
11825
|
-
setTimer(setTimeout(() => {
|
|
11826
|
-
onDelayFinish();
|
|
11827
|
-
setTimer(void 0);
|
|
11828
|
-
}, delay));
|
|
11829
|
-
};
|
|
11830
|
-
useEffect19(() => {
|
|
11831
|
-
return () => {
|
|
11832
|
-
clearTimeout(timer);
|
|
11833
|
-
};
|
|
11834
|
-
}, [timer]);
|
|
11835
|
-
useEffect19(() => {
|
|
11836
|
-
if (disabled) {
|
|
11837
|
-
clearTimeout(timer);
|
|
11838
|
-
setTimer(void 0);
|
|
11839
|
-
}
|
|
11840
|
-
}, [disabled, timer]);
|
|
11841
|
-
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
11842
|
-
}
|
|
11843
|
-
|
|
11844
|
-
// src/hooks/focus/useFocusManagement.ts
|
|
11845
|
-
import { useCallback as useCallback17 } from "react";
|
|
11846
|
-
function useFocusManagement() {
|
|
11847
|
-
const getFocusableElements = useCallback17(() => {
|
|
11848
|
-
return Array.from(
|
|
11849
|
-
document.querySelectorAll(
|
|
11850
|
-
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
11851
|
-
)
|
|
11852
|
-
).filter(
|
|
11853
|
-
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
11854
|
-
);
|
|
11855
|
-
}, []);
|
|
11856
|
-
const getNextFocusElement = useCallback17(() => {
|
|
11857
|
-
const elements = getFocusableElements();
|
|
11858
|
-
if (elements.length === 0) {
|
|
11859
|
-
return void 0;
|
|
11860
|
-
}
|
|
11861
|
-
let nextElement = elements[0];
|
|
11862
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
11863
|
-
const currentIndex = elements.indexOf(document.activeElement);
|
|
11864
|
-
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
11865
|
-
}
|
|
11866
|
-
return nextElement;
|
|
11867
|
-
}, [getFocusableElements]);
|
|
11868
|
-
const focusNext = useCallback17(() => {
|
|
11869
|
-
const nextElement = getNextFocusElement();
|
|
11870
|
-
nextElement?.focus();
|
|
11871
|
-
}, [getNextFocusElement]);
|
|
11872
|
-
const getPreviousFocusElement = useCallback17(() => {
|
|
11873
|
-
const elements = getFocusableElements();
|
|
11874
|
-
if (elements.length === 0) {
|
|
11875
|
-
return void 0;
|
|
11876
|
-
}
|
|
11877
|
-
let previousElement = elements[0];
|
|
11878
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
11879
|
-
const currentIndex = elements.indexOf(document.activeElement);
|
|
11880
|
-
if (currentIndex === 0) {
|
|
11881
|
-
previousElement = elements[elements.length - 1];
|
|
11882
|
-
} else {
|
|
11883
|
-
previousElement = elements[currentIndex - 1];
|
|
11884
|
-
}
|
|
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
|
|
11885
12466
|
}
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
const focusPrevious = useCallback17(() => {
|
|
11889
|
-
const previousElement = getPreviousFocusElement();
|
|
11890
|
-
if (previousElement) previousElement.focus();
|
|
11891
|
-
}, [getPreviousFocusElement]);
|
|
11892
|
-
return {
|
|
11893
|
-
getFocusableElements,
|
|
11894
|
-
getNextFocusElement,
|
|
11895
|
-
getPreviousFocusElement,
|
|
11896
|
-
focusNext,
|
|
11897
|
-
focusPrevious
|
|
11898
|
-
};
|
|
11899
|
-
}
|
|
12467
|
+
);
|
|
12468
|
+
};
|
|
11900
12469
|
|
|
11901
12470
|
// src/components/user-interaction/input/Input.tsx
|
|
12471
|
+
import { forwardRef as forwardRef11, useImperativeHandle as useImperativeHandle7, useRef as useRef20 } from "react";
|
|
11902
12472
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
11903
12473
|
var defaultEditCompleteOptions = {
|
|
11904
12474
|
allowEnterComplete: false,
|
|
@@ -11930,7 +12500,7 @@ var Input = forwardRef11(function Input2({
|
|
|
11930
12500
|
restartTimer,
|
|
11931
12501
|
clearTimer
|
|
11932
12502
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
11933
|
-
const innerRef =
|
|
12503
|
+
const innerRef = useRef20(null);
|
|
11934
12504
|
useImperativeHandle7(forwardedRef, () => innerRef.current);
|
|
11935
12505
|
const { focusNext } = useFocusManagement();
|
|
11936
12506
|
return /* @__PURE__ */ jsx33(
|
|
@@ -11998,7 +12568,7 @@ import {
|
|
|
11998
12568
|
} from "react";
|
|
11999
12569
|
|
|
12000
12570
|
// src/components/user-interaction/select/SelectContext.tsx
|
|
12001
|
-
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";
|
|
12002
12572
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
12003
12573
|
var defaultToggleOpenOptions = {
|
|
12004
12574
|
highlightStartPositionBehavior: "first"
|
|
@@ -12039,21 +12609,21 @@ var PrimitveSelectRoot = ({
|
|
|
12039
12609
|
onValueChange: onValuesChange,
|
|
12040
12610
|
defaultValue: initialValues ?? []
|
|
12041
12611
|
});
|
|
12042
|
-
const triggerRef =
|
|
12612
|
+
const triggerRef = useRef21(null);
|
|
12043
12613
|
const generatedId = useId9();
|
|
12044
|
-
const [ids, setIds] =
|
|
12614
|
+
const [ids, setIds] = useState23({
|
|
12045
12615
|
trigger: id ?? (isMultiSelect ? "multi-select-" + generatedId : "select-" + generatedId),
|
|
12046
12616
|
content: isMultiSelect ? "multi-select-content-" + generatedId : "select-content-" + generatedId
|
|
12047
12617
|
});
|
|
12048
|
-
const [internalState, setInternalState] =
|
|
12618
|
+
const [internalState, setInternalState] = useState23({
|
|
12049
12619
|
isOpen: initialIsOpen,
|
|
12050
12620
|
options: []
|
|
12051
12621
|
});
|
|
12052
|
-
const selectedValues =
|
|
12622
|
+
const selectedValues = useMemo17(
|
|
12053
12623
|
() => isMultiSelect ? values ?? [] : [value].filter(Boolean),
|
|
12054
12624
|
[isMultiSelect, value, values]
|
|
12055
12625
|
);
|
|
12056
|
-
const selectedOptions =
|
|
12626
|
+
const selectedOptions = useMemo17(
|
|
12057
12627
|
() => selectedValues.map((value2) => internalState.options.find((option) => value2 === option.value)).filter(Boolean),
|
|
12058
12628
|
[selectedValues, internalState.options]
|
|
12059
12629
|
);
|
|
@@ -12070,7 +12640,7 @@ var PrimitveSelectRoot = ({
|
|
|
12070
12640
|
isMultiSelect,
|
|
12071
12641
|
iconAppearance
|
|
12072
12642
|
};
|
|
12073
|
-
const registerItem =
|
|
12643
|
+
const registerItem = useCallback19((item) => {
|
|
12074
12644
|
setInternalState((prev) => {
|
|
12075
12645
|
const updatedOptions = [...prev.options, item];
|
|
12076
12646
|
updatedOptions.sort((a, b) => {
|
|
@@ -12085,7 +12655,7 @@ var PrimitveSelectRoot = ({
|
|
|
12085
12655
|
};
|
|
12086
12656
|
});
|
|
12087
12657
|
}, []);
|
|
12088
|
-
const unregisterItem =
|
|
12658
|
+
const unregisterItem = useCallback19((value2) => {
|
|
12089
12659
|
setInternalState((prev) => {
|
|
12090
12660
|
const updatedOptions = prev.options.filter((i) => i.value !== value2);
|
|
12091
12661
|
return {
|
|
@@ -12134,10 +12704,10 @@ var PrimitveSelectRoot = ({
|
|
|
12134
12704
|
highlightedValue: value2
|
|
12135
12705
|
}));
|
|
12136
12706
|
};
|
|
12137
|
-
const registerTrigger =
|
|
12707
|
+
const registerTrigger = useCallback19((ref) => {
|
|
12138
12708
|
triggerRef.current = ref.current;
|
|
12139
12709
|
}, []);
|
|
12140
|
-
const unregisterTrigger =
|
|
12710
|
+
const unregisterTrigger = useCallback19(() => {
|
|
12141
12711
|
triggerRef.current = null;
|
|
12142
12712
|
}, []);
|
|
12143
12713
|
const toggleOpen = (isOpen, toggleOpenOptions) => {
|
|
@@ -12187,7 +12757,7 @@ var PrimitveSelectRoot = ({
|
|
|
12187
12757
|
highlightedValue
|
|
12188
12758
|
}));
|
|
12189
12759
|
};
|
|
12190
|
-
|
|
12760
|
+
useEffect28(() => {
|
|
12191
12761
|
if (!internalState.highlightedValue) return;
|
|
12192
12762
|
const highlighted = internalState.options.find((value2) => value2.value === internalState.highlightedValue);
|
|
12193
12763
|
if (highlighted) {
|
|
@@ -12251,35 +12821,12 @@ var MultiSelectRoot = ({ value, onValueChange, initialValue, onEditComplete, ...
|
|
|
12251
12821
|
};
|
|
12252
12822
|
|
|
12253
12823
|
// src/components/user-interaction/select/SelectComponents.tsx
|
|
12254
|
-
import { forwardRef as forwardRef13, useEffect as
|
|
12824
|
+
import { forwardRef as forwardRef13, useEffect as useEffect29, useImperativeHandle as useImperativeHandle9, useRef as useRef22 } from "react";
|
|
12255
12825
|
import clsx10 from "clsx";
|
|
12256
12826
|
import { CheckIcon } from "lucide-react";
|
|
12257
12827
|
|
|
12258
12828
|
// src/components/layout/popup/PopUp.tsx
|
|
12259
|
-
import { forwardRef as forwardRef12, useCallback as
|
|
12260
|
-
|
|
12261
|
-
// src/hooks/useOutsideClick.ts
|
|
12262
|
-
import { useEffect as useEffect21 } from "react";
|
|
12263
|
-
var useOutsideClick = ({ refs, onOutsideClick, active = true }) => {
|
|
12264
|
-
useEffect21(() => {
|
|
12265
|
-
if (!active) return;
|
|
12266
|
-
const listener = (event) => {
|
|
12267
|
-
if (event.target === null) return;
|
|
12268
|
-
if (refs.some((ref) => ref.current && ref.current.contains(event.target))) {
|
|
12269
|
-
return;
|
|
12270
|
-
}
|
|
12271
|
-
onOutsideClick(event);
|
|
12272
|
-
};
|
|
12273
|
-
document.addEventListener("mousedown", listener);
|
|
12274
|
-
document.addEventListener("touchstart", listener);
|
|
12275
|
-
document.addEventListener("pointerdown", listener);
|
|
12276
|
-
return () => {
|
|
12277
|
-
document.removeEventListener("mousedown", listener);
|
|
12278
|
-
document.removeEventListener("touchstart", listener);
|
|
12279
|
-
document.removeEventListener("pointerdown", listener);
|
|
12280
|
-
};
|
|
12281
|
-
}, [refs, onOutsideClick, active]);
|
|
12282
|
-
};
|
|
12829
|
+
import { forwardRef as forwardRef12, useCallback as useCallback20, useContext as useContext13, useImperativeHandle as useImperativeHandle8, useMemo as useMemo18 } from "react";
|
|
12283
12830
|
|
|
12284
12831
|
// src/components/layout/popup/PopUpContext.tsx
|
|
12285
12832
|
import { createContext as createContext11, useContext as useContext12 } from "react";
|
|
@@ -12314,13 +12861,13 @@ var PopUp = forwardRef12(function PopUp2({
|
|
|
12314
12861
|
useImperativeHandle8(forwardRef23, () => ref.current, [ref]);
|
|
12315
12862
|
const onCloseStable = useEventCallbackStabilizer(onClose);
|
|
12316
12863
|
const onOutsideClickStable = useEventCallbackStabilizer(onOutsideClick);
|
|
12317
|
-
const onCloseWrapper =
|
|
12864
|
+
const onCloseWrapper = useCallback20(() => {
|
|
12318
12865
|
onCloseStable();
|
|
12319
12866
|
context?.setIsOpen(false);
|
|
12320
12867
|
}, [onCloseStable, context]);
|
|
12321
|
-
const { zIndex, isInFront } = useOverlayRegistry({ isActive: isOpen, tags:
|
|
12868
|
+
const { zIndex, isInFront } = useOverlayRegistry({ isActive: isOpen, tags: useMemo18(() => ["popup"], []) });
|
|
12322
12869
|
useOutsideClick({
|
|
12323
|
-
onOutsideClick:
|
|
12870
|
+
onOutsideClick: useCallback20((event) => {
|
|
12324
12871
|
event.preventDefault();
|
|
12325
12872
|
onCloseWrapper();
|
|
12326
12873
|
onOutsideClickStable(event);
|
|
@@ -12362,10 +12909,10 @@ var SelectOption = forwardRef13(
|
|
|
12362
12909
|
function SelectOption2({ children, value, disabled = false, iconAppearance, className, ...restProps }, ref) {
|
|
12363
12910
|
const { state, config, item, trigger } = useSelectContext();
|
|
12364
12911
|
const { register, unregister, toggleSelection, highlightItem } = item;
|
|
12365
|
-
const itemRef =
|
|
12912
|
+
const itemRef = useRef22(null);
|
|
12366
12913
|
iconAppearance ??= config.iconAppearance;
|
|
12367
12914
|
const label = children ?? value;
|
|
12368
|
-
|
|
12915
|
+
useEffect29(() => {
|
|
12369
12916
|
register({
|
|
12370
12917
|
value,
|
|
12371
12918
|
label,
|
|
@@ -12445,7 +12992,7 @@ var SelectButton = forwardRef13(function SelectButton2({
|
|
|
12445
12992
|
const translation = useHightideTranslation();
|
|
12446
12993
|
const { state, trigger, setIds, ids } = useSelectContext();
|
|
12447
12994
|
const { register, unregister, toggleOpen } = trigger;
|
|
12448
|
-
|
|
12995
|
+
useEffect29(() => {
|
|
12449
12996
|
if (id) {
|
|
12450
12997
|
setIds((prev) => ({
|
|
12451
12998
|
...prev,
|
|
@@ -12453,9 +13000,9 @@ var SelectButton = forwardRef13(function SelectButton2({
|
|
|
12453
13000
|
}));
|
|
12454
13001
|
}
|
|
12455
13002
|
}, [id, setIds]);
|
|
12456
|
-
const innerRef =
|
|
13003
|
+
const innerRef = useRef22(null);
|
|
12457
13004
|
useImperativeHandle9(ref, () => innerRef.current);
|
|
12458
|
-
|
|
13005
|
+
useEffect29(() => {
|
|
12459
13006
|
register(innerRef);
|
|
12460
13007
|
return () => unregister();
|
|
12461
13008
|
}, [register, unregister]);
|
|
@@ -12513,10 +13060,10 @@ var SelectContent = forwardRef13(function SelectContent2({
|
|
|
12513
13060
|
options,
|
|
12514
13061
|
...props
|
|
12515
13062
|
}, ref) {
|
|
12516
|
-
const innerRef =
|
|
13063
|
+
const innerRef = useRef22(null);
|
|
12517
13064
|
useImperativeHandle9(ref, () => innerRef.current);
|
|
12518
13065
|
const { trigger, state, config, item, ids, setIds } = useSelectContext();
|
|
12519
|
-
|
|
13066
|
+
useEffect29(() => {
|
|
12520
13067
|
if (id) {
|
|
12521
13068
|
setIds((prev) => ({
|
|
12522
13069
|
...prev,
|
|
@@ -12661,7 +13208,7 @@ import { MonitorCog, MoonIcon, SunIcon } from "lucide-react";
|
|
|
12661
13208
|
import clsx12 from "clsx";
|
|
12662
13209
|
|
|
12663
13210
|
// src/global-contexts/ThemeContext.tsx
|
|
12664
|
-
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";
|
|
12665
13212
|
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
12666
13213
|
var themes = ["light", "dark", "system"];
|
|
12667
13214
|
var ThemeUtil = {
|
|
@@ -12675,8 +13222,8 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
12675
13222
|
deleteValue: deleteStoredTheme
|
|
12676
13223
|
} = useStorage({ key: "theme", defaultValue: "system" });
|
|
12677
13224
|
const { config } = useHightideConfig();
|
|
12678
|
-
const [themePreference, setThemePreference] =
|
|
12679
|
-
const resolvedTheme =
|
|
13225
|
+
const [themePreference, setThemePreference] = useState24("system");
|
|
13226
|
+
const resolvedTheme = useMemo19(() => {
|
|
12680
13227
|
if (theme && theme !== "system") {
|
|
12681
13228
|
return theme;
|
|
12682
13229
|
}
|
|
@@ -12688,7 +13235,7 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
12688
13235
|
}
|
|
12689
13236
|
return initialTheme ?? config.theme.initialTheme;
|
|
12690
13237
|
}, [config.theme.initialTheme, initialTheme, storedTheme, theme, themePreference]);
|
|
12691
|
-
|
|
13238
|
+
useEffect30(() => {
|
|
12692
13239
|
if (!theme) return;
|
|
12693
13240
|
if (theme === "system") {
|
|
12694
13241
|
deleteStoredTheme();
|
|
@@ -12696,18 +13243,18 @@ var ThemeProvider = ({ children, theme, initialTheme }) => {
|
|
|
12696
13243
|
setStoredTheme(theme);
|
|
12697
13244
|
}
|
|
12698
13245
|
}, [theme, deleteStoredTheme, setStoredTheme]);
|
|
12699
|
-
|
|
13246
|
+
useEffect30(() => {
|
|
12700
13247
|
document.documentElement.setAttribute("data-theme", resolvedTheme);
|
|
12701
13248
|
}, [resolvedTheme]);
|
|
12702
|
-
const getPreference =
|
|
13249
|
+
const getPreference = useCallback21(() => {
|
|
12703
13250
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
12704
13251
|
const prefersLight = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
12705
13252
|
setThemePreference(prefersDark ? "dark" : prefersLight ? "light" : "system");
|
|
12706
13253
|
}, []);
|
|
12707
|
-
|
|
13254
|
+
useEffect30(() => {
|
|
12708
13255
|
getPreference();
|
|
12709
13256
|
}, [getPreference]);
|
|
12710
|
-
|
|
13257
|
+
useEffect30(() => {
|
|
12711
13258
|
const darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
12712
13259
|
const lightQuery = window.matchMedia("(prefers-color-scheme: light)");
|
|
12713
13260
|
const noPrefQuery = window.matchMedia("(prefers-color-scheme: no-preference)");
|
|
@@ -12810,7 +13357,7 @@ var ThemeDialog = ({
|
|
|
12810
13357
|
import { forwardRef as forwardRef16 } from "react";
|
|
12811
13358
|
|
|
12812
13359
|
// src/components/layout/drawer/DrawerContent.tsx
|
|
12813
|
-
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";
|
|
12814
13361
|
|
|
12815
13362
|
// src/components/layout/drawer/DrawerContext.tsx
|
|
12816
13363
|
import { createContext as createContext13, useContext as useContext15 } from "react";
|
|
@@ -12835,12 +13382,12 @@ var DrawerContent = forwardRef15(function DrawerContent2({
|
|
|
12835
13382
|
}, forwardedRef) {
|
|
12836
13383
|
const { isOpen } = useDrawerContext();
|
|
12837
13384
|
const generatedId = useId10();
|
|
12838
|
-
const ids =
|
|
13385
|
+
const ids = useMemo20(() => ({
|
|
12839
13386
|
container: `dialog-container-${generatedId}`,
|
|
12840
13387
|
background: `dialog-background-${generatedId}`,
|
|
12841
13388
|
content: props.id ?? `dialog-content-${generatedId}`
|
|
12842
13389
|
}), [generatedId, props.id]);
|
|
12843
|
-
const ref =
|
|
13390
|
+
const ref = useRef23(null);
|
|
12844
13391
|
useImperativeHandle10(forwardedRef, () => ref.current, [ref]);
|
|
12845
13392
|
const { isVisible, transitionState } = useTransitionState({ isOpen, ref });
|
|
12846
13393
|
useFocusTrap({
|
|
@@ -12849,7 +13396,7 @@ var DrawerContent = forwardRef15(function DrawerContent2({
|
|
|
12849
13396
|
});
|
|
12850
13397
|
const { zIndex, tagPositions, tagItemCounts } = useOverlayRegistry({
|
|
12851
13398
|
isActive: isVisible,
|
|
12852
|
-
tags:
|
|
13399
|
+
tags: useMemo20(() => ["drawer"], [])
|
|
12853
13400
|
});
|
|
12854
13401
|
const depth = tagPositions && tagItemCounts ? (tagItemCounts["drawer"] ?? 0) - (tagPositions["drawer"] ?? 0) : 0;
|
|
12855
13402
|
const { setOpen } = useDrawerContext();
|
|
@@ -13002,7 +13549,7 @@ var ErrorComponent = ({
|
|
|
13002
13549
|
};
|
|
13003
13550
|
|
|
13004
13551
|
// src/components/layout/loading/LoadingAndErrorComponent.tsx
|
|
13005
|
-
import { useState as
|
|
13552
|
+
import { useState as useState25 } from "react";
|
|
13006
13553
|
|
|
13007
13554
|
// src/components/layout/loading/LoadingContainer.tsx
|
|
13008
13555
|
import { clsx as clsx14 } from "clsx";
|
|
@@ -13023,8 +13570,8 @@ var LoadingAndErrorComponent = ({
|
|
|
13023
13570
|
minimumLoadingDuration = 200,
|
|
13024
13571
|
className
|
|
13025
13572
|
}) => {
|
|
13026
|
-
const [isInMinimumLoading, setIsInMinimumLoading] =
|
|
13027
|
-
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] =
|
|
13573
|
+
const [isInMinimumLoading, setIsInMinimumLoading] = useState25(false);
|
|
13574
|
+
const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = useState25(false);
|
|
13028
13575
|
if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {
|
|
13029
13576
|
setIsInMinimumLoading(true);
|
|
13030
13577
|
setTimeout(() => {
|
|
@@ -13088,8 +13635,8 @@ var BreadCrumbs = ({ crumbs }) => {
|
|
|
13088
13635
|
// src/components/layout/navigation/Navigation.tsx
|
|
13089
13636
|
var import_link2 = __toESM(require_link2());
|
|
13090
13637
|
import { Menu as MenuIcon, XIcon } from "lucide-react";
|
|
13091
|
-
import { useEffect as
|
|
13092
|
-
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";
|
|
13093
13640
|
import clsx17 from "clsx";
|
|
13094
13641
|
import { Fragment as Fragment5, jsx as jsx51, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
13095
13642
|
function isSubItem(item) {
|
|
@@ -13101,9 +13648,9 @@ var NavigationItemWithSubItem = ({
|
|
|
13101
13648
|
horizontalAlignment = "center",
|
|
13102
13649
|
...options
|
|
13103
13650
|
}) => {
|
|
13104
|
-
const [isOpen, setOpen] =
|
|
13105
|
-
const containerRef =
|
|
13106
|
-
const triggerRef =
|
|
13651
|
+
const [isOpen, setOpen] = useState26(false);
|
|
13652
|
+
const containerRef = useRef24(null);
|
|
13653
|
+
const triggerRef = useRef24(null);
|
|
13107
13654
|
const id = useId11();
|
|
13108
13655
|
const style = useAnchoredPosition({
|
|
13109
13656
|
active: isOpen,
|
|
@@ -13112,7 +13659,7 @@ var NavigationItemWithSubItem = ({
|
|
|
13112
13659
|
horizontalAlignment,
|
|
13113
13660
|
...options
|
|
13114
13661
|
});
|
|
13115
|
-
const onBlur =
|
|
13662
|
+
const onBlur = useCallback22((event) => {
|
|
13116
13663
|
const nextFocus = event.relatedTarget;
|
|
13117
13664
|
if (!containerRef.current?.contains(nextFocus) && !triggerRef.current?.contains(nextFocus)) {
|
|
13118
13665
|
setOpen(false);
|
|
@@ -13178,10 +13725,10 @@ var NavigationItemList = ({ items, ...restProps }) => {
|
|
|
13178
13725
|
};
|
|
13179
13726
|
var Navigation = ({ ...props }) => {
|
|
13180
13727
|
const translation = useHightideTranslation();
|
|
13181
|
-
const [isMobileOpen, setIsMobileOpen] =
|
|
13728
|
+
const [isMobileOpen, setIsMobileOpen] = useState26(false);
|
|
13182
13729
|
const id = useId11();
|
|
13183
|
-
const menuRef =
|
|
13184
|
-
|
|
13730
|
+
const menuRef = useRef24(null);
|
|
13731
|
+
useEffect31(() => {
|
|
13185
13732
|
menuRef.current?.focus();
|
|
13186
13733
|
}, [isMobileOpen]);
|
|
13187
13734
|
const { zIndex } = useOverlayRegistry({ isActive: isMobileOpen });
|
|
@@ -13249,7 +13796,7 @@ var Navigation = ({ ...props }) => {
|
|
|
13249
13796
|
// src/components/layout/navigation/Pagination.tsx
|
|
13250
13797
|
import { ChevronFirst, ChevronLast, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
13251
13798
|
import clsx18 from "clsx";
|
|
13252
|
-
import { useEffect as
|
|
13799
|
+
import { useEffect as useEffect32, useState as useState27 } from "react";
|
|
13253
13800
|
import { jsx as jsx52, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
13254
13801
|
var Pagination = ({
|
|
13255
13802
|
pageIndex,
|
|
@@ -13258,11 +13805,11 @@ var Pagination = ({
|
|
|
13258
13805
|
...props
|
|
13259
13806
|
}) => {
|
|
13260
13807
|
const translation = useHightideTranslation();
|
|
13261
|
-
const [value, setValue] =
|
|
13808
|
+
const [value, setValue] = useState27((pageIndex + 1).toString());
|
|
13262
13809
|
const noPages = pageCount === 0;
|
|
13263
13810
|
const onFirstPage = pageIndex === 0 && !noPages;
|
|
13264
13811
|
const onLastPage = pageIndex === pageCount - 1;
|
|
13265
|
-
|
|
13812
|
+
useEffect32(() => {
|
|
13266
13813
|
if (noPages) {
|
|
13267
13814
|
setValue("0");
|
|
13268
13815
|
} else {
|
|
@@ -13456,18 +14003,18 @@ var StepperBar = ({
|
|
|
13456
14003
|
};
|
|
13457
14004
|
|
|
13458
14005
|
// src/components/layout/popup/PopUpOpener.tsx
|
|
13459
|
-
import { useEffect as
|
|
14006
|
+
import { useEffect as useEffect33, useMemo as useMemo21, useRef as useRef25 } from "react";
|
|
13460
14007
|
function PopUpOpener({ children }) {
|
|
13461
14008
|
const context = usePopUpContext();
|
|
13462
14009
|
const { setTriggerRef } = context;
|
|
13463
|
-
const ref =
|
|
13464
|
-
|
|
14010
|
+
const ref = useRef25(null);
|
|
14011
|
+
useEffect33(() => {
|
|
13465
14012
|
setTriggerRef(ref);
|
|
13466
14013
|
return () => {
|
|
13467
14014
|
setTriggerRef(null);
|
|
13468
14015
|
};
|
|
13469
14016
|
}, [setTriggerRef]);
|
|
13470
|
-
const bag =
|
|
14017
|
+
const bag = useMemo21(() => ({
|
|
13471
14018
|
open: () => context.setIsOpen(true),
|
|
13472
14019
|
close: () => context.setIsOpen(false),
|
|
13473
14020
|
toggleOpen: () => context.setIsOpen((prev) => !prev),
|
|
@@ -13485,7 +14032,7 @@ function PopUpOpener({ children }) {
|
|
|
13485
14032
|
}
|
|
13486
14033
|
|
|
13487
14034
|
// src/components/layout/popup/PopUpRoot.tsx
|
|
13488
|
-
import { useId as useId12, useMemo as
|
|
14035
|
+
import { useId as useId12, useMemo as useMemo22, useState as useState28 } from "react";
|
|
13489
14036
|
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
13490
14037
|
function PopUpRoot({
|
|
13491
14038
|
children,
|
|
@@ -13502,10 +14049,10 @@ function PopUpRoot({
|
|
|
13502
14049
|
onValueChange: onIsOpenChange,
|
|
13503
14050
|
defaultValue: initialIsOpen
|
|
13504
14051
|
});
|
|
13505
|
-
const [triggerRef, setTriggerRef] =
|
|
13506
|
-
const popUpId =
|
|
13507
|
-
const triggerId =
|
|
13508
|
-
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(() => ({
|
|
13509
14056
|
isOpen,
|
|
13510
14057
|
setIsOpen,
|
|
13511
14058
|
popUpId,
|
|
@@ -13692,7 +14239,7 @@ var FillerCell = ({ ...props }) => {
|
|
|
13692
14239
|
};
|
|
13693
14240
|
|
|
13694
14241
|
// src/components/layout/table/TableProvider.tsx
|
|
13695
|
-
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";
|
|
13696
14243
|
|
|
13697
14244
|
// src/components/layout/table/TableContext.tsx
|
|
13698
14245
|
import { createContext as createContext14, useContext as useContext16 } from "react";
|
|
@@ -14091,9 +14638,9 @@ var TableProvider = ({
|
|
|
14091
14638
|
}) => {
|
|
14092
14639
|
const onRowClickStable = useEventCallbackStabilizer(onRowClick);
|
|
14093
14640
|
const onFillerRowClickStable = useEventCallbackStabilizer(onFillerRowClick);
|
|
14094
|
-
const [registeredColumns, setRegisteredColumns] =
|
|
14095
|
-
const containerRef =
|
|
14096
|
-
const [, setTableState] =
|
|
14641
|
+
const [registeredColumns, setRegisteredColumns] = useState29([]);
|
|
14642
|
+
const containerRef = useRef26(null);
|
|
14643
|
+
const [, setTableState] = useState29({
|
|
14097
14644
|
columnSizing: {},
|
|
14098
14645
|
columnOrder: [],
|
|
14099
14646
|
columnFilters: [],
|
|
@@ -14118,16 +14665,16 @@ var TableProvider = ({
|
|
|
14118
14665
|
pageSize: 10
|
|
14119
14666
|
}
|
|
14120
14667
|
});
|
|
14121
|
-
const [targetWidth, setTargetWidth] =
|
|
14122
|
-
|
|
14668
|
+
const [targetWidth, setTargetWidth] = useState29(void 0);
|
|
14669
|
+
useLayoutEffect7(() => {
|
|
14123
14670
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
14124
14671
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
14125
14672
|
}, [containerRef]);
|
|
14126
|
-
useWindowResizeObserver(
|
|
14673
|
+
useWindowResizeObserver(useCallback23(() => {
|
|
14127
14674
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
14128
14675
|
setTargetWidth(width !== void 0 ? Math.floor(width) : void 0);
|
|
14129
14676
|
}, [containerRef]));
|
|
14130
|
-
const registerColumn =
|
|
14677
|
+
const registerColumn = useCallback23((column) => {
|
|
14131
14678
|
setRegisteredColumns((prev) => {
|
|
14132
14679
|
return [...prev, column];
|
|
14133
14680
|
});
|
|
@@ -14137,7 +14684,7 @@ var TableProvider = ({
|
|
|
14137
14684
|
});
|
|
14138
14685
|
};
|
|
14139
14686
|
}, []);
|
|
14140
|
-
const columns =
|
|
14687
|
+
const columns = useMemo23(() => {
|
|
14141
14688
|
const contextColumns = Array.from(registeredColumns.values());
|
|
14142
14689
|
if (columnsProp) {
|
|
14143
14690
|
return [...contextColumns, ...columnsProp];
|
|
@@ -14154,7 +14701,7 @@ var TableProvider = ({
|
|
|
14154
14701
|
defaultColumn: {
|
|
14155
14702
|
minSize: 60,
|
|
14156
14703
|
maxSize: 800,
|
|
14157
|
-
cell:
|
|
14704
|
+
cell: useCallback23(({ cell }) => {
|
|
14158
14705
|
return /* @__PURE__ */ jsx57(TableCell, { children: String(cell.getValue()) });
|
|
14159
14706
|
}, []),
|
|
14160
14707
|
enableResizing: true,
|
|
@@ -14195,7 +14742,7 @@ var TableProvider = ({
|
|
|
14195
14742
|
});
|
|
14196
14743
|
const pagination = table.getState().pagination;
|
|
14197
14744
|
const pageCount = table.getPageCount();
|
|
14198
|
-
|
|
14745
|
+
useEffect34(() => {
|
|
14199
14746
|
if (pageCount === -1) {
|
|
14200
14747
|
return;
|
|
14201
14748
|
}
|
|
@@ -14203,20 +14750,20 @@ var TableProvider = ({
|
|
|
14203
14750
|
table.setPageIndex(pageCount - 1);
|
|
14204
14751
|
}
|
|
14205
14752
|
}, [table, pagination.pageIndex, pageCount]);
|
|
14206
|
-
|
|
14753
|
+
useEffect34(() => {
|
|
14207
14754
|
table.setColumnOrder((prev) => [...prev]);
|
|
14208
14755
|
}, [table, columns]);
|
|
14209
14756
|
const columnVisibility = table.getState().columnVisibility;
|
|
14210
14757
|
const columnOrder = table.getState().columnOrder;
|
|
14211
14758
|
const columnPinning = table.getState().columnPinning;
|
|
14212
|
-
|
|
14759
|
+
useEffect34(() => {
|
|
14213
14760
|
table.setColumnSizing((prev) => ({ ...prev }));
|
|
14214
14761
|
}, [table, targetWidth, columnVisibility, columnOrder, columnPinning]);
|
|
14215
|
-
const tableColumnDefinitionContextValue =
|
|
14762
|
+
const tableColumnDefinitionContextValue = useMemo23(() => ({
|
|
14216
14763
|
table,
|
|
14217
14764
|
registerColumn
|
|
14218
14765
|
}), [table, registerColumn]);
|
|
14219
|
-
const tableContainerContextValue =
|
|
14766
|
+
const tableContainerContextValue = useMemo23(() => ({
|
|
14220
14767
|
table,
|
|
14221
14768
|
containerRef
|
|
14222
14769
|
}), [table, containerRef]);
|
|
@@ -14225,7 +14772,7 @@ var TableProvider = ({
|
|
|
14225
14772
|
return rest;
|
|
14226
14773
|
})();
|
|
14227
14774
|
const rowModel = table.getRowModel();
|
|
14228
|
-
const tableStateWithoutSizingContextValue =
|
|
14775
|
+
const tableStateWithoutSizingContextValue = useMemo23(() => ({
|
|
14229
14776
|
table,
|
|
14230
14777
|
isUsingFillerRows,
|
|
14231
14778
|
fillerRowCell,
|
|
@@ -14268,7 +14815,7 @@ var TableProvider = ({
|
|
|
14268
14815
|
]);
|
|
14269
14816
|
const columnSizing = table.getState().columnSizing;
|
|
14270
14817
|
const columnSizingInfo = table.getState().columnSizingInfo;
|
|
14271
|
-
const tableStateContextValue =
|
|
14818
|
+
const tableStateContextValue = useMemo23(() => ({
|
|
14272
14819
|
...tableStateWithoutSizingContextValue,
|
|
14273
14820
|
sizeVars: ColumnSizeUtil.toSizeVars(columnSizing),
|
|
14274
14821
|
columnSizingInfo,
|
|
@@ -14279,10 +14826,10 @@ var TableProvider = ({
|
|
|
14279
14826
|
|
|
14280
14827
|
// src/components/layout/table/TableBody.tsx
|
|
14281
14828
|
import { flexRender } from "@tanstack/react-table";
|
|
14282
|
-
import
|
|
14829
|
+
import React7 from "react";
|
|
14283
14830
|
import clsx20 from "clsx";
|
|
14284
14831
|
import { jsx as jsx58, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
14285
|
-
var TableBody =
|
|
14832
|
+
var TableBody = React7.memo(function TableBodyVisual() {
|
|
14286
14833
|
const { table, isUsingFillerRows, fillerRowCell, onRowClick, onFillerRowClick } = useTableStateWithoutSizingContext();
|
|
14287
14834
|
const rows = table.getRowModel().rows;
|
|
14288
14835
|
const columnOrder = table.getState().columnOrder;
|
|
@@ -14380,15 +14927,15 @@ var TableSortButton = ({
|
|
|
14380
14927
|
|
|
14381
14928
|
// src/components/layout/table/TableFilterButton.tsx
|
|
14382
14929
|
import { FilterIcon } from "lucide-react";
|
|
14383
|
-
import { useEffect as
|
|
14930
|
+
import { useEffect as useEffect39, useId as useId15, useMemo as useMemo28, useRef as useRef31, useState as useState34 } from "react";
|
|
14384
14931
|
|
|
14385
14932
|
// src/components/user-interaction/input/DateTimeInput.tsx
|
|
14386
|
-
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";
|
|
14387
14934
|
import { CalendarIcon } from "lucide-react";
|
|
14388
14935
|
import clsx24 from "clsx";
|
|
14389
14936
|
|
|
14390
14937
|
// src/components/user-interaction/date/TimePicker.tsx
|
|
14391
|
-
import { useEffect as
|
|
14938
|
+
import { useEffect as useEffect35, useRef as useRef27 } from "react";
|
|
14392
14939
|
import { jsx as jsx60, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
14393
14940
|
var TimePicker = ({
|
|
14394
14941
|
value: controlledValue,
|
|
@@ -14404,8 +14951,8 @@ var TimePicker = ({
|
|
|
14404
14951
|
onValueChange,
|
|
14405
14952
|
defaultValue: initialValue
|
|
14406
14953
|
});
|
|
14407
|
-
const minuteRef =
|
|
14408
|
-
const hourRef =
|
|
14954
|
+
const minuteRef = useRef27(null);
|
|
14955
|
+
const hourRef = useRef27(null);
|
|
14409
14956
|
const isPM = value.getHours() > 11;
|
|
14410
14957
|
const hours = is24HourFormat ? range(24) : range(12);
|
|
14411
14958
|
let minutes = range(60);
|
|
@@ -14425,13 +14972,13 @@ var TimePicker = ({
|
|
|
14425
14972
|
}
|
|
14426
14973
|
const closestMinute = closestMatch(minutes, (item1, item2) => Math.abs(item1 - value.getMinutes()) < Math.abs(item2 - value.getMinutes()));
|
|
14427
14974
|
const hour = value.getHours();
|
|
14428
|
-
|
|
14975
|
+
useEffect35(() => {
|
|
14429
14976
|
minuteRef.current?.scrollIntoView({
|
|
14430
14977
|
behavior: "smooth",
|
|
14431
14978
|
block: "nearest"
|
|
14432
14979
|
});
|
|
14433
14980
|
}, [closestMinute]);
|
|
14434
|
-
|
|
14981
|
+
useEffect35(() => {
|
|
14435
14982
|
hourRef.current?.scrollIntoView({
|
|
14436
14983
|
behavior: "smooth",
|
|
14437
14984
|
block: "nearest"
|
|
@@ -14500,179 +15047,12 @@ var TimePicker = ({
|
|
|
14500
15047
|
};
|
|
14501
15048
|
|
|
14502
15049
|
// src/components/user-interaction/date/DatePicker.tsx
|
|
14503
|
-
import { useState as
|
|
15050
|
+
import { useState as useState31 } from "react";
|
|
14504
15051
|
import { ArrowDown, ArrowUp, Calendar, ChevronDown as ChevronDown4 } from "lucide-react";
|
|
14505
|
-
|
|
14506
|
-
// src/utils/date.ts
|
|
14507
|
-
var timesInSeconds = {
|
|
14508
|
-
second: 1,
|
|
14509
|
-
minute: 60,
|
|
14510
|
-
hour: 3600,
|
|
14511
|
-
day: 86400,
|
|
14512
|
-
week: 604800,
|
|
14513
|
-
monthImprecise: 2629800,
|
|
14514
|
-
// 30.4375 days
|
|
14515
|
-
yearImprecise: 31557600
|
|
14516
|
-
// 365.25 days
|
|
14517
|
-
};
|
|
14518
|
-
var monthsList = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
14519
|
-
var weekDayList = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14520
|
-
var changeDuration = (date, duration, isAdding) => {
|
|
14521
|
-
const {
|
|
14522
|
-
years = 0,
|
|
14523
|
-
months = 0,
|
|
14524
|
-
days = 0,
|
|
14525
|
-
hours = 0,
|
|
14526
|
-
minutes = 0,
|
|
14527
|
-
seconds = 0,
|
|
14528
|
-
milliseconds = 0
|
|
14529
|
-
} = duration;
|
|
14530
|
-
if (years < 0) {
|
|
14531
|
-
console.error(`Range error years must be greater than 0: received ${years}`);
|
|
14532
|
-
return new Date(date);
|
|
14533
|
-
}
|
|
14534
|
-
if (months < 0 || months > 11) {
|
|
14535
|
-
console.error(`Range error month must be 0 <= month <= 11: received ${months}`);
|
|
14536
|
-
return new Date(date);
|
|
14537
|
-
}
|
|
14538
|
-
if (days < 0) {
|
|
14539
|
-
console.error(`Range error days must be greater than 0: received ${days}`);
|
|
14540
|
-
return new Date(date);
|
|
14541
|
-
}
|
|
14542
|
-
if (hours < 0 || hours > 23) {
|
|
14543
|
-
console.error(`Range error hours must be 0 <= hours <= 23: received ${hours}`);
|
|
14544
|
-
return new Date(date);
|
|
14545
|
-
}
|
|
14546
|
-
if (minutes < 0 || minutes > 59) {
|
|
14547
|
-
console.error(`Range error minutes must be 0 <= minutes <= 59: received ${minutes}`);
|
|
14548
|
-
return new Date(date);
|
|
14549
|
-
}
|
|
14550
|
-
if (seconds < 0 || seconds > 59) {
|
|
14551
|
-
console.error(`Range error seconds must be 0 <= seconds <= 59: received ${seconds}`);
|
|
14552
|
-
return new Date(date);
|
|
14553
|
-
}
|
|
14554
|
-
if (milliseconds < 0) {
|
|
14555
|
-
console.error(`Range error seconds must be greater than 0: received ${milliseconds}`);
|
|
14556
|
-
return new Date(date);
|
|
14557
|
-
}
|
|
14558
|
-
const multiplier = isAdding ? 1 : -1;
|
|
14559
|
-
const newDate = new Date(date);
|
|
14560
|
-
newDate.setFullYear(newDate.getFullYear() + multiplier * years);
|
|
14561
|
-
newDate.setMonth(newDate.getMonth() + multiplier * months);
|
|
14562
|
-
newDate.setDate(newDate.getDate() + multiplier * days);
|
|
14563
|
-
newDate.setHours(newDate.getHours() + multiplier * hours);
|
|
14564
|
-
newDate.setMinutes(newDate.getMinutes() + multiplier * minutes);
|
|
14565
|
-
newDate.setSeconds(newDate.getSeconds() + multiplier * seconds);
|
|
14566
|
-
newDate.setMilliseconds(newDate.getMilliseconds() + multiplier * milliseconds);
|
|
14567
|
-
return newDate;
|
|
14568
|
-
};
|
|
14569
|
-
var addDuration = (date, duration) => {
|
|
14570
|
-
return changeDuration(date, duration, true);
|
|
14571
|
-
};
|
|
14572
|
-
var subtractDuration = (date, duration) => {
|
|
14573
|
-
return changeDuration(date, duration, false);
|
|
14574
|
-
};
|
|
14575
|
-
var between = (value, startDate, endDate) => {
|
|
14576
|
-
if (startDate && endDate) {
|
|
14577
|
-
console.assert(startDate <= endDate);
|
|
14578
|
-
return startDate <= value && value <= endDate;
|
|
14579
|
-
} else if (startDate) {
|
|
14580
|
-
return startDate <= value;
|
|
14581
|
-
} else if (endDate) {
|
|
14582
|
-
return endDate >= value;
|
|
14583
|
-
} else {
|
|
14584
|
-
return true;
|
|
14585
|
-
}
|
|
14586
|
-
};
|
|
14587
|
-
var equalDate = (date1, date2) => {
|
|
14588
|
-
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
|
|
14589
|
-
};
|
|
14590
|
-
var weeksForCalenderMonth = (date, weekStart, weeks = 6) => {
|
|
14591
|
-
const month = date.getMonth();
|
|
14592
|
-
const year = date.getFullYear();
|
|
14593
|
-
const dayList = [];
|
|
14594
|
-
let currentDate = new Date(year, month, 1);
|
|
14595
|
-
const weekStartIndex = weekDayList.indexOf(weekStart);
|
|
14596
|
-
while (currentDate.getDay() !== weekStartIndex) {
|
|
14597
|
-
currentDate = subtractDuration(currentDate, { days: 1 });
|
|
14598
|
-
}
|
|
14599
|
-
while (dayList.length < 7 * weeks) {
|
|
14600
|
-
const date2 = new Date(currentDate);
|
|
14601
|
-
date2.setHours(date2.getHours(), date2.getMinutes());
|
|
14602
|
-
dayList.push(date2);
|
|
14603
|
-
currentDate = addDuration(currentDate, { days: 1 });
|
|
14604
|
-
}
|
|
14605
|
-
return equalSizeGroups(dayList, 7);
|
|
14606
|
-
};
|
|
14607
|
-
var formatAbsolute = (date, locale, format) => {
|
|
14608
|
-
let options;
|
|
14609
|
-
switch (format) {
|
|
14610
|
-
case "date":
|
|
14611
|
-
options = {
|
|
14612
|
-
year: "2-digit",
|
|
14613
|
-
month: "2-digit",
|
|
14614
|
-
day: "2-digit"
|
|
14615
|
-
};
|
|
14616
|
-
break;
|
|
14617
|
-
case "time":
|
|
14618
|
-
options = {
|
|
14619
|
-
hour: "2-digit",
|
|
14620
|
-
minute: "2-digit"
|
|
14621
|
-
};
|
|
14622
|
-
break;
|
|
14623
|
-
case "dateTime":
|
|
14624
|
-
options = {
|
|
14625
|
-
year: "numeric",
|
|
14626
|
-
month: "2-digit",
|
|
14627
|
-
day: "2-digit",
|
|
14628
|
-
hour: "2-digit",
|
|
14629
|
-
minute: "2-digit"
|
|
14630
|
-
};
|
|
14631
|
-
break;
|
|
14632
|
-
}
|
|
14633
|
-
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
14634
|
-
};
|
|
14635
|
-
var formatRelative = (date, locale) => {
|
|
14636
|
-
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
14637
|
-
const now = /* @__PURE__ */ new Date();
|
|
14638
|
-
const diffInSeconds = (date.getTime() - now.getTime()) / 1e3;
|
|
14639
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.minute) return rtf.format(Math.round(diffInSeconds), "second");
|
|
14640
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.hour) return rtf.format(Math.round(diffInSeconds / timesInSeconds.minute), "minute");
|
|
14641
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.day) return rtf.format(Math.round(diffInSeconds / timesInSeconds.hour), "hour");
|
|
14642
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.week) return rtf.format(Math.round(diffInSeconds / timesInSeconds.day), "day");
|
|
14643
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.monthImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.week), "week");
|
|
14644
|
-
if (Math.abs(diffInSeconds) < timesInSeconds.yearImprecise) return rtf.format(Math.round(diffInSeconds / timesInSeconds.monthImprecise), "month");
|
|
14645
|
-
return rtf.format(Math.round(diffInSeconds / timesInSeconds.yearImprecise), "year");
|
|
14646
|
-
};
|
|
14647
|
-
var toInputString = (date, format) => {
|
|
14648
|
-
switch (format) {
|
|
14649
|
-
case "date":
|
|
14650
|
-
return date.toISOString().split("T")[0];
|
|
14651
|
-
case "time":
|
|
14652
|
-
return date.toISOString().split("T")[1].split("Z")[0];
|
|
14653
|
-
case "dateTime":
|
|
14654
|
-
return date.toISOString();
|
|
14655
|
-
}
|
|
14656
|
-
};
|
|
14657
|
-
var DateUtils = {
|
|
14658
|
-
monthsList,
|
|
14659
|
-
weekDayList,
|
|
14660
|
-
equalDate,
|
|
14661
|
-
formatAbsolute,
|
|
14662
|
-
formatRelative,
|
|
14663
|
-
addDuration,
|
|
14664
|
-
subtractDuration,
|
|
14665
|
-
between,
|
|
14666
|
-
weeksForCalenderMonth,
|
|
14667
|
-
timesInSeconds,
|
|
14668
|
-
toInputString
|
|
14669
|
-
};
|
|
14670
|
-
|
|
14671
|
-
// src/components/user-interaction/date/DatePicker.tsx
|
|
14672
15052
|
import clsx23 from "clsx";
|
|
14673
15053
|
|
|
14674
15054
|
// src/components/user-interaction/date/DayPicker.tsx
|
|
14675
|
-
import { useCallback as
|
|
15055
|
+
import { useCallback as useCallback24, useEffect as useEffect36, useMemo as useMemo24, useRef as useRef28 } from "react";
|
|
14676
15056
|
import { jsx as jsx61, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
14677
15057
|
var DayPicker = ({
|
|
14678
15058
|
displayedMonth: controlledDisplayedMonth,
|
|
@@ -14701,33 +15081,33 @@ var DayPicker = ({
|
|
|
14701
15081
|
});
|
|
14702
15082
|
const month = displayedMonth.getMonth();
|
|
14703
15083
|
const weeks = DateUtils.weeksForCalenderMonth(displayedMonth, weekStart);
|
|
14704
|
-
const selectedButtonRef =
|
|
14705
|
-
const isValueInDisplayedWeeks =
|
|
15084
|
+
const selectedButtonRef = useRef28(null);
|
|
15085
|
+
const isValueInDisplayedWeeks = useMemo24(
|
|
14706
15086
|
() => !!value && weeks.some((week) => week.some((d) => DateUtils.equalDate(value, d))),
|
|
14707
15087
|
[value, weeks]
|
|
14708
15088
|
);
|
|
14709
|
-
const firstDayOfMonth =
|
|
15089
|
+
const firstDayOfMonth = useCallback24(
|
|
14710
15090
|
(date) => new Date(date.getFullYear(), date.getMonth(), 1),
|
|
14711
15091
|
[]
|
|
14712
15092
|
);
|
|
14713
15093
|
const focusTargetDate = value && isValueInDisplayedWeeks ? value : firstDayOfMonth(displayedMonth);
|
|
14714
|
-
|
|
15094
|
+
useEffect36(() => {
|
|
14715
15095
|
selectedButtonRef.current?.focus();
|
|
14716
15096
|
}, [focusTargetDate]);
|
|
14717
|
-
const end =
|
|
15097
|
+
const end = useMemo24(() => {
|
|
14718
15098
|
if (!providedEnd) return;
|
|
14719
15099
|
return new Date(providedEnd.getFullYear(), providedEnd.getMonth(), providedEnd.getDate());
|
|
14720
15100
|
}, [providedEnd]);
|
|
14721
|
-
const start =
|
|
15101
|
+
const start = useMemo24(() => {
|
|
14722
15102
|
if (!providedStart) return;
|
|
14723
15103
|
return new Date(providedStart.getFullYear(), providedStart.getMonth(), providedStart.getDate());
|
|
14724
15104
|
}, [providedStart]);
|
|
14725
|
-
const clampToRange =
|
|
15105
|
+
const clampToRange = useCallback24((date) => {
|
|
14726
15106
|
if (start && date < start) return start;
|
|
14727
15107
|
if (end && date > end) return end;
|
|
14728
15108
|
return date;
|
|
14729
15109
|
}, [start, end]);
|
|
14730
|
-
const navigateTo =
|
|
15110
|
+
const navigateTo = useCallback24((candidate) => {
|
|
14731
15111
|
const clamped = clampToRange(candidate);
|
|
14732
15112
|
if (!DateUtils.between(clamped, start, end)) return;
|
|
14733
15113
|
setValue(clamped);
|
|
@@ -14736,7 +15116,7 @@ var DayPicker = ({
|
|
|
14736
15116
|
setDisplayedMonth(firstDayOfMonth(clamped));
|
|
14737
15117
|
}
|
|
14738
15118
|
}, [clampToRange, start, end, setValue, onEditComplete, displayedMonth, setDisplayedMonth, firstDayOfMonth]);
|
|
14739
|
-
const onKeyDown =
|
|
15119
|
+
const onKeyDown = useCallback24(
|
|
14740
15120
|
(event) => {
|
|
14741
15121
|
PropsUtil.aria.navigate({
|
|
14742
15122
|
left: () => focusTargetDate && navigateTo(DateUtils.subtractDuration(focusTargetDate, { days: 1 })),
|
|
@@ -14792,7 +15172,7 @@ var DayPicker = ({
|
|
|
14792
15172
|
};
|
|
14793
15173
|
|
|
14794
15174
|
// src/components/user-interaction/date/YearMonthPicker.tsx
|
|
14795
|
-
import { memo, useCallback as
|
|
15175
|
+
import { memo, useCallback as useCallback25, useEffect as useEffect37, useMemo as useMemo25, useRef as useRef29, useState as useState30 } from "react";
|
|
14796
15176
|
import clsx22 from "clsx";
|
|
14797
15177
|
import { jsx as jsx62, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
14798
15178
|
var YearRow = memo(function YearRow2({
|
|
@@ -14803,15 +15183,15 @@ var YearRow = memo(function YearRow2({
|
|
|
14803
15183
|
monthNames,
|
|
14804
15184
|
onSelect
|
|
14805
15185
|
}) {
|
|
14806
|
-
const ref =
|
|
15186
|
+
const ref = useRef29(null);
|
|
14807
15187
|
const isSelectedYear = selectedMonthIndex !== void 0;
|
|
14808
|
-
const [isExpanded, setIsExpanded] =
|
|
14809
|
-
|
|
15188
|
+
const [isExpanded, setIsExpanded] = useState30(false);
|
|
15189
|
+
useEffect37(() => {
|
|
14810
15190
|
if (isSelectedYear) {
|
|
14811
15191
|
ref.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
14812
15192
|
}
|
|
14813
15193
|
}, [isSelectedYear]);
|
|
14814
|
-
const monthGrid =
|
|
15194
|
+
const monthGrid = useMemo25(() => equalSizeGroups([...DateUtils.monthsList], 3), []);
|
|
14815
15195
|
return /* @__PURE__ */ jsxs32(
|
|
14816
15196
|
ExpandableRoot,
|
|
14817
15197
|
{
|
|
@@ -14866,23 +15246,23 @@ var YearMonthPicker = ({
|
|
|
14866
15246
|
defaultValue: initialValue
|
|
14867
15247
|
});
|
|
14868
15248
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
14869
|
-
const monthNames =
|
|
15249
|
+
const monthNames = useMemo25(() => {
|
|
14870
15250
|
const formatter = new Intl.DateTimeFormat(locale, { month: "short" });
|
|
14871
15251
|
return Array.from({ length: 12 }, (_, i) => formatter.format(new Date(2e3, i, 1)));
|
|
14872
15252
|
}, [locale]);
|
|
14873
|
-
const years =
|
|
15253
|
+
const years = useMemo25(
|
|
14874
15254
|
() => range([start.getFullYear(), end.getFullYear()], { exclusiveEnd: false }),
|
|
14875
15255
|
[start, end]
|
|
14876
15256
|
);
|
|
14877
|
-
const minTimestamp =
|
|
15257
|
+
const minTimestamp = useMemo25(() => {
|
|
14878
15258
|
if (!start) return;
|
|
14879
15259
|
return new Date(start.getFullYear(), start.getMonth(), 1).getTime();
|
|
14880
15260
|
}, [start]);
|
|
14881
|
-
const maxTimestamp =
|
|
15261
|
+
const maxTimestamp = useMemo25(() => {
|
|
14882
15262
|
if (!end) return;
|
|
14883
15263
|
return new Date(end.getFullYear(), end.getMonth() + 1, 0).getTime();
|
|
14884
15264
|
}, [end]);
|
|
14885
|
-
const handleSelect =
|
|
15265
|
+
const handleSelect = useCallback25((newDate) => {
|
|
14886
15266
|
setValue(newDate);
|
|
14887
15267
|
onEditCompleteStable(newDate);
|
|
14888
15268
|
}, [onEditCompleteStable, setValue]);
|
|
@@ -14935,8 +15315,8 @@ var DatePicker = ({
|
|
|
14935
15315
|
onValueChange,
|
|
14936
15316
|
defaultValue: initialValue
|
|
14937
15317
|
});
|
|
14938
|
-
const [displayedMonth, setDisplayedMonth] =
|
|
14939
|
-
const [displayMode, setDisplayMode] =
|
|
15318
|
+
const [displayedMonth, setDisplayedMonth] = useState31(new Date(value.getFullYear(), value.getMonth(), 1));
|
|
15319
|
+
const [displayMode, setDisplayMode] = useState31(initialDisplay);
|
|
14940
15320
|
return /* @__PURE__ */ jsxs33("div", { className: clsx23("flex-col-3", className), children: [
|
|
14941
15321
|
/* @__PURE__ */ jsxs33("div", { className: "flex-row-2 items-center justify-between", children: [
|
|
14942
15322
|
/* @__PURE__ */ jsxs33(
|
|
@@ -15192,31 +15572,31 @@ var DateTimeInput = forwardRef17(function DateTimeInput2({
|
|
|
15192
15572
|
...props
|
|
15193
15573
|
}, forwardedRef) {
|
|
15194
15574
|
const translation = useHightideTranslation();
|
|
15195
|
-
const [isOpen, setIsOpen] =
|
|
15575
|
+
const [isOpen, setIsOpen] = useState32(false);
|
|
15196
15576
|
const [state, setState] = useControlledState({
|
|
15197
15577
|
value,
|
|
15198
15578
|
onValueChange,
|
|
15199
15579
|
defaultValue: initialValue
|
|
15200
15580
|
});
|
|
15201
|
-
const [dialogValue, setDialogValue] =
|
|
15202
|
-
const [dateString, setDateString] =
|
|
15203
|
-
|
|
15581
|
+
const [dialogValue, setDialogValue] = useState32(state ?? /* @__PURE__ */ new Date());
|
|
15582
|
+
const [dateString, setDateString] = useState32(state ? DateUtils.toInputString(state, mode) : "");
|
|
15583
|
+
useEffect38(() => {
|
|
15204
15584
|
setDialogValue(state ?? /* @__PURE__ */ new Date());
|
|
15205
15585
|
setDateString(state ? DateUtils.toInputString(state, mode) : "");
|
|
15206
15586
|
}, [mode, state]);
|
|
15207
|
-
const changeOpenWrapper =
|
|
15587
|
+
const changeOpenWrapper = useCallback26((isOpen2) => {
|
|
15208
15588
|
onDialogOpeningChange?.(isOpen2);
|
|
15209
15589
|
setIsOpen(isOpen2);
|
|
15210
15590
|
}, [onDialogOpeningChange]);
|
|
15211
15591
|
const generatedId = useId13();
|
|
15212
|
-
const ids =
|
|
15592
|
+
const ids = useMemo26(() => ({
|
|
15213
15593
|
input: inputId ?? `date-time-input-${generatedId}`,
|
|
15214
15594
|
popup: `date-time-input-popup-${generatedId}`,
|
|
15215
15595
|
label: `date-time-input-label-${generatedId}`
|
|
15216
15596
|
}), [generatedId, inputId]);
|
|
15217
|
-
const innerRef =
|
|
15597
|
+
const innerRef = useRef30(null);
|
|
15218
15598
|
useImperativeHandle11(forwardedRef, () => innerRef.current);
|
|
15219
|
-
|
|
15599
|
+
useEffect38(() => {
|
|
15220
15600
|
if (readOnly || disabled) {
|
|
15221
15601
|
changeOpenWrapper(false);
|
|
15222
15602
|
}
|
|
@@ -15304,7 +15684,7 @@ var DateTimeInput = forwardRef17(function DateTimeInput2({
|
|
|
15304
15684
|
});
|
|
15305
15685
|
|
|
15306
15686
|
// src/components/layout/table/TableFilterPopups.tsx
|
|
15307
|
-
import { useId as useId14, useMemo as
|
|
15687
|
+
import { useId as useId14, useMemo as useMemo27, useState as useState33 } from "react";
|
|
15308
15688
|
|
|
15309
15689
|
// src/components/user-interaction/select/MultiSelect.tsx
|
|
15310
15690
|
import { forwardRef as forwardRef18 } from "react";
|
|
@@ -15340,7 +15720,7 @@ import {
|
|
|
15340
15720
|
|
|
15341
15721
|
// src/components/user-interaction/Checkbox.tsx
|
|
15342
15722
|
import { Check as Check2, Minus as Minus2 } from "lucide-react";
|
|
15343
|
-
import { useCallback as
|
|
15723
|
+
import { useCallback as useCallback27 } from "react";
|
|
15344
15724
|
import { jsx as jsx68, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
15345
15725
|
var Checkbox = ({
|
|
15346
15726
|
value: controlledValue,
|
|
@@ -15358,7 +15738,7 @@ var Checkbox = ({
|
|
|
15358
15738
|
}) => {
|
|
15359
15739
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
15360
15740
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
15361
|
-
const onChangeWrapper =
|
|
15741
|
+
const onChangeWrapper = useCallback27((value2) => {
|
|
15362
15742
|
onValueChangeStable(value2);
|
|
15363
15743
|
onEditCompleteStable(value2);
|
|
15364
15744
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -15581,7 +15961,7 @@ var TextFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15581
15961
|
const operator = filterValue?.operator ?? "textContains";
|
|
15582
15962
|
const parameter = filterValue?.parameter ?? {};
|
|
15583
15963
|
const id = useId14();
|
|
15584
|
-
const availableOperators =
|
|
15964
|
+
const availableOperators = useMemo27(() => [
|
|
15585
15965
|
...TableFilterOperator.text,
|
|
15586
15966
|
...TableFilterOperator.generic
|
|
15587
15967
|
], []);
|
|
@@ -15641,7 +16021,7 @@ var NumberFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15641
16021
|
const translation = useHightideTranslation();
|
|
15642
16022
|
const operator = filterValue?.operator ?? "numberBetween";
|
|
15643
16023
|
const parameter = filterValue?.parameter ?? {};
|
|
15644
|
-
const availableOperators =
|
|
16024
|
+
const availableOperators = useMemo27(() => [
|
|
15645
16025
|
...TableFilterOperator.number,
|
|
15646
16026
|
...TableFilterOperator.generic
|
|
15647
16027
|
], []);
|
|
@@ -15732,9 +16112,9 @@ var DateFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15732
16112
|
};
|
|
15733
16113
|
const operator = filterValue?.operator ?? "dateBetween";
|
|
15734
16114
|
const parameter = filterValue?.parameter ?? {};
|
|
15735
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] =
|
|
15736
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] =
|
|
15737
|
-
const availableOperators =
|
|
16115
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState33(null);
|
|
16116
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = useState33(null);
|
|
16117
|
+
const availableOperators = useMemo27(() => [
|
|
15738
16118
|
...TableFilterOperator.date,
|
|
15739
16119
|
...TableFilterOperator.generic
|
|
15740
16120
|
], []);
|
|
@@ -15857,9 +16237,9 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15857
16237
|
};
|
|
15858
16238
|
const operator = filterValue?.operator ?? "dateTimeBetween";
|
|
15859
16239
|
const parameter = filterValue?.parameter ?? {};
|
|
15860
|
-
const [temporaryMinDateValue, setTemporaryMinDateValue] =
|
|
15861
|
-
const [temporaryMaxDateValue, setTemporaryMaxDateValue] =
|
|
15862
|
-
const availableOperators =
|
|
16240
|
+
const [temporaryMinDateValue, setTemporaryMinDateValue] = useState33(null);
|
|
16241
|
+
const [temporaryMaxDateValue, setTemporaryMaxDateValue] = useState33(null);
|
|
16242
|
+
const availableOperators = useMemo27(() => [
|
|
15863
16243
|
...TableFilterOperator.dateTime,
|
|
15864
16244
|
...TableFilterOperator.generic
|
|
15865
16245
|
], []);
|
|
@@ -15976,7 +16356,7 @@ var DatetimeFilter = ({ filterValue, onFilterValueChange }) => {
|
|
|
15976
16356
|
};
|
|
15977
16357
|
var BooleanFilter = ({ filterValue, onFilterValueChange }) => {
|
|
15978
16358
|
const operator = filterValue?.operator ?? "booleanIsTrue";
|
|
15979
|
-
const availableOperators =
|
|
16359
|
+
const availableOperators = useMemo27(() => [
|
|
15980
16360
|
...TableFilterOperator.boolean,
|
|
15981
16361
|
...TableFilterOperator.generic
|
|
15982
16362
|
], []);
|
|
@@ -16000,11 +16380,11 @@ var TagsFilter = ({ columnId, filterValue, onFilterValueChange }) => {
|
|
|
16000
16380
|
const { table } = useTableStateWithoutSizingContext();
|
|
16001
16381
|
const operator = filterValue?.operator ?? "tagsContains";
|
|
16002
16382
|
const parameter = filterValue?.parameter ?? {};
|
|
16003
|
-
const availableOperators =
|
|
16383
|
+
const availableOperators = useMemo27(() => [
|
|
16004
16384
|
...TableFilterOperator.multiTags,
|
|
16005
16385
|
...TableFilterOperator.generic
|
|
16006
16386
|
], []);
|
|
16007
|
-
const availableTags =
|
|
16387
|
+
const availableTags = useMemo27(() => {
|
|
16008
16388
|
const column = table.getColumn(columnId);
|
|
16009
16389
|
if (!column) return [];
|
|
16010
16390
|
return column.columnDef.meta?.filterData?.tags ?? [];
|
|
@@ -16051,11 +16431,11 @@ var TagsSingleFilter = ({ columnId, filterValue, onFilterValueChange }) => {
|
|
|
16051
16431
|
const { table } = useTableStateWithoutSizingContext();
|
|
16052
16432
|
const operator = filterValue?.operator ?? "tagsSingleContains";
|
|
16053
16433
|
const parameter = filterValue?.parameter ?? {};
|
|
16054
|
-
const availableOperators =
|
|
16434
|
+
const availableOperators = useMemo27(() => [
|
|
16055
16435
|
...TableFilterOperator.singleTag,
|
|
16056
16436
|
...TableFilterOperator.generic
|
|
16057
16437
|
], []);
|
|
16058
|
-
const availableTags =
|
|
16438
|
+
const availableTags = useMemo27(() => {
|
|
16059
16439
|
const column = table.getColumn(columnId);
|
|
16060
16440
|
if (!column) return [];
|
|
16061
16441
|
return column.columnDef.meta?.filterData?.tags ?? [];
|
|
@@ -16114,7 +16494,7 @@ var TagsSingleFilter = ({ columnId, filterValue, onFilterValueChange }) => {
|
|
|
16114
16494
|
};
|
|
16115
16495
|
var GenericFilter = ({ filterValue, onFilterValueChange }) => {
|
|
16116
16496
|
const operator = filterValue?.operator ?? "notUndefined";
|
|
16117
|
-
const availableOperators =
|
|
16497
|
+
const availableOperators = useMemo27(() => [
|
|
16118
16498
|
...TableFilterOperator.generic
|
|
16119
16499
|
], []);
|
|
16120
16500
|
return /* @__PURE__ */ jsx69("div", { className: "flex-col-2 gap-2", children: /* @__PURE__ */ jsx69(
|
|
@@ -16163,18 +16543,18 @@ var TableFilterButton = ({
|
|
|
16163
16543
|
}) => {
|
|
16164
16544
|
const translation = useHightideTranslation();
|
|
16165
16545
|
const columnFilterValue = column.getFilterValue();
|
|
16166
|
-
const [filterValue, setFilterValue] =
|
|
16546
|
+
const [filterValue, setFilterValue] = useState34(columnFilterValue);
|
|
16167
16547
|
const hasFilter = !!filterValue;
|
|
16168
|
-
const anchorRef =
|
|
16169
|
-
const containerRef =
|
|
16170
|
-
const [isOpen, setIsOpen] =
|
|
16548
|
+
const anchorRef = useRef31(null);
|
|
16549
|
+
const containerRef = useRef31(null);
|
|
16550
|
+
const [isOpen, setIsOpen] = useState34(false);
|
|
16171
16551
|
const id = useId15();
|
|
16172
|
-
const ids =
|
|
16552
|
+
const ids = useMemo28(() => ({
|
|
16173
16553
|
button: `table-filter-button-${id}`,
|
|
16174
16554
|
popup: `table-filter-popup-${id}`,
|
|
16175
16555
|
label: `table-filter-label-${id}`
|
|
16176
16556
|
}), [id]);
|
|
16177
|
-
|
|
16557
|
+
useEffect39(() => {
|
|
16178
16558
|
setFilterValue(columnFilterValue);
|
|
16179
16559
|
}, [columnFilterValue]);
|
|
16180
16560
|
const isTagsFilter = filterType === "multiTags" || filterType === "singleTag";
|
|
@@ -16249,11 +16629,11 @@ var TableFilterButton = ({
|
|
|
16249
16629
|
};
|
|
16250
16630
|
|
|
16251
16631
|
// src/components/layout/table/TableHeader.tsx
|
|
16252
|
-
import { useCallback as
|
|
16632
|
+
import { useCallback as useCallback28, useEffect as useEffect40 } from "react";
|
|
16253
16633
|
import { Fragment as Fragment9, jsx as jsx71, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
16254
16634
|
var TableHeader = ({ isSticky = false }) => {
|
|
16255
16635
|
const { table } = useTableStateWithoutSizingContext();
|
|
16256
|
-
const handleResizeMove =
|
|
16636
|
+
const handleResizeMove = useCallback28((e) => {
|
|
16257
16637
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
16258
16638
|
const currentX = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
16259
16639
|
const deltaOffset = currentX - (table.getState().columnSizingInfo.startOffset ?? 0);
|
|
@@ -16269,7 +16649,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
16269
16649
|
deltaOffset
|
|
16270
16650
|
}));
|
|
16271
16651
|
}, [table]);
|
|
16272
|
-
const handleResizeEnd =
|
|
16652
|
+
const handleResizeEnd = useCallback28(() => {
|
|
16273
16653
|
if (!table.getState().columnSizingInfo.isResizingColumn) return;
|
|
16274
16654
|
const newWidth = (table.getState().columnSizingInfo.startSize ?? 0) + (table.getState().columnSizingInfo.deltaOffset ?? 0);
|
|
16275
16655
|
table.setColumnSizing((prev) => {
|
|
@@ -16287,7 +16667,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
16287
16667
|
startSize: null
|
|
16288
16668
|
});
|
|
16289
16669
|
}, [table]);
|
|
16290
|
-
|
|
16670
|
+
useEffect40(() => {
|
|
16291
16671
|
window.addEventListener("pointermove", handleResizeMove);
|
|
16292
16672
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
16293
16673
|
return () => {
|
|
@@ -16456,7 +16836,7 @@ var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props
|
|
|
16456
16836
|
};
|
|
16457
16837
|
|
|
16458
16838
|
// src/components/layout/table/TableWithSelectionProvider.tsx
|
|
16459
|
-
import { useCallback as
|
|
16839
|
+
import { useCallback as useCallback29, useMemo as useMemo29 } from "react";
|
|
16460
16840
|
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
16461
16841
|
var TableWithSelectionProvider = ({
|
|
16462
16842
|
children,
|
|
@@ -16469,7 +16849,7 @@ var TableWithSelectionProvider = ({
|
|
|
16469
16849
|
...props
|
|
16470
16850
|
}) => {
|
|
16471
16851
|
const translation = useHightideTranslation();
|
|
16472
|
-
const columnDef =
|
|
16852
|
+
const columnDef = useMemo29(() => [
|
|
16473
16853
|
{
|
|
16474
16854
|
id: selectionRowId,
|
|
16475
16855
|
header: ({ table }) => {
|
|
@@ -16512,7 +16892,7 @@ var TableWithSelectionProvider = ({
|
|
|
16512
16892
|
TableProvider,
|
|
16513
16893
|
{
|
|
16514
16894
|
...props,
|
|
16515
|
-
fillerRowCell:
|
|
16895
|
+
fillerRowCell: useCallback29((columnId, table) => {
|
|
16516
16896
|
if (columnId === selectionRowId) {
|
|
16517
16897
|
return /* @__PURE__ */ jsx74(Checkbox, { value: false, disabled: true });
|
|
16518
16898
|
}
|
|
@@ -16530,7 +16910,7 @@ var TableWithSelectionProvider = ({
|
|
|
16530
16910
|
rowSelection,
|
|
16531
16911
|
...state
|
|
16532
16912
|
},
|
|
16533
|
-
onRowClick:
|
|
16913
|
+
onRowClick: useCallback29((row, table) => {
|
|
16534
16914
|
if (!disableClickRowClickSelection) {
|
|
16535
16915
|
row.toggleSelected();
|
|
16536
16916
|
}
|
|
@@ -16572,7 +16952,7 @@ var TableWithSelection = ({
|
|
|
16572
16952
|
};
|
|
16573
16953
|
|
|
16574
16954
|
// src/components/layout/table/TableColumn.tsx
|
|
16575
|
-
import { memo as memo2, useEffect as
|
|
16955
|
+
import { memo as memo2, useEffect as useEffect41, useMemo as useMemo30, useState as useState35 } from "react";
|
|
16576
16956
|
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
16577
16957
|
var TableColumnComponent = ({
|
|
16578
16958
|
filterType,
|
|
@@ -16584,11 +16964,11 @@ var TableColumnComponent = ({
|
|
|
16584
16964
|
"TableColumn: For filterType === multiTags or singleTag, filterData.tags must be set.",
|
|
16585
16965
|
(filterType === "multiTags" || filterType === "singleTag") && props.meta?.filterData?.tags === void 0
|
|
16586
16966
|
);
|
|
16587
|
-
const [column] =
|
|
16967
|
+
const [column] = useState35({
|
|
16588
16968
|
...props,
|
|
16589
16969
|
filterFn
|
|
16590
16970
|
});
|
|
16591
|
-
|
|
16971
|
+
useEffect41(() => {
|
|
16592
16972
|
const unsubscribe = registerColumn(column);
|
|
16593
16973
|
return () => {
|
|
16594
16974
|
unsubscribe();
|
|
@@ -16603,27 +16983,27 @@ var TableColumnFactory = () => memo2(
|
|
|
16603
16983
|
}
|
|
16604
16984
|
);
|
|
16605
16985
|
var TableColumn = (props) => {
|
|
16606
|
-
const TableColumnComponent2 =
|
|
16986
|
+
const TableColumnComponent2 = useMemo30(() => TableColumnFactory(), []);
|
|
16607
16987
|
return /* @__PURE__ */ jsx76(TableColumnComponent2, { ...props });
|
|
16608
16988
|
};
|
|
16609
16989
|
|
|
16610
16990
|
// src/components/layout/table/TableColumnSwitcher.tsx
|
|
16611
|
-
import { useMemo as
|
|
16991
|
+
import { useMemo as useMemo31, useRef as useRef32, useId as useId16 } from "react";
|
|
16612
16992
|
import { ChevronUp as ChevronUp3, ChevronDown as ChevronDown5, ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight5, Eye, EyeOff, Pin, PinOff, ArrowLeftRightIcon } from "lucide-react";
|
|
16613
16993
|
import { Fragment as Fragment10, jsx as jsx77, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
16614
16994
|
var TableColumnSwitcherPopUp = ({ ...props }) => {
|
|
16615
16995
|
const { table } = useTableStateWithoutSizingContext();
|
|
16616
16996
|
const translation = useHightideTranslation();
|
|
16617
|
-
const containerRef =
|
|
16997
|
+
const containerRef = useRef32(null);
|
|
16618
16998
|
const generatedId = useId16();
|
|
16619
|
-
const ids =
|
|
16999
|
+
const ids = useMemo31(() => ({
|
|
16620
17000
|
popup: props.id ?? `table-column-picker-popup-${generatedId}`,
|
|
16621
17001
|
label: `table-column-picker-label-${generatedId}`
|
|
16622
17002
|
}), [generatedId, props.id]);
|
|
16623
17003
|
const tableState = table.getState();
|
|
16624
17004
|
const columnOrder = tableState.columnOrder;
|
|
16625
17005
|
const columnPinning = tableState.columnPinning;
|
|
16626
|
-
const columns =
|
|
17006
|
+
const columns = useMemo31(() => {
|
|
16627
17007
|
const allColumns = table.getAllColumns();
|
|
16628
17008
|
const leftPinned = [];
|
|
16629
17009
|
const unpinned = [];
|
|
@@ -16881,7 +17261,7 @@ var TableColumnSwitcher = ({ buttonProps, ...props }) => {
|
|
|
16881
17261
|
};
|
|
16882
17262
|
|
|
16883
17263
|
// src/components/user-interaction/CopyToClipboardWrapper.tsx
|
|
16884
|
-
import { useState as
|
|
17264
|
+
import { useState as useState36 } from "react";
|
|
16885
17265
|
import { clsx as clsx28 } from "clsx";
|
|
16886
17266
|
|
|
16887
17267
|
// src/utils/writeToClipboard.ts
|
|
@@ -16904,7 +17284,7 @@ var CopyToClipboardWrapper = ({
|
|
|
16904
17284
|
...props
|
|
16905
17285
|
}) => {
|
|
16906
17286
|
const translation = useHightideTranslation();
|
|
16907
|
-
const [isShowingConfirmation, setIsShowingConfirmation] =
|
|
17287
|
+
const [isShowingConfirmation, setIsShowingConfirmation] = useState36(false);
|
|
16908
17288
|
return /* @__PURE__ */ jsxs46(
|
|
16909
17289
|
TooltipRoot,
|
|
16910
17290
|
{
|
|
@@ -16953,7 +17333,7 @@ var CopyToClipboardWrapper = ({
|
|
|
16953
17333
|
};
|
|
16954
17334
|
|
|
16955
17335
|
// src/components/user-interaction/Menu.tsx
|
|
16956
|
-
import { useCallback as
|
|
17336
|
+
import { useCallback as useCallback30, useRef as useRef33, useState as useState37 } from "react";
|
|
16957
17337
|
import clsx29 from "clsx";
|
|
16958
17338
|
import { Fragment as Fragment11, jsx as jsx79, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
16959
17339
|
var MenuItem = ({
|
|
@@ -16979,8 +17359,8 @@ var Menu = ({
|
|
|
16979
17359
|
disabled = false,
|
|
16980
17360
|
...props
|
|
16981
17361
|
}) => {
|
|
16982
|
-
const triggerRef =
|
|
16983
|
-
const [isOpen, setIsOpen] =
|
|
17362
|
+
const triggerRef = useRef33(null);
|
|
17363
|
+
const [isOpen, setIsOpen] = useState37(false);
|
|
16984
17364
|
const bag = {
|
|
16985
17365
|
isOpen,
|
|
16986
17366
|
close: () => setIsOpen(false),
|
|
@@ -16988,7 +17368,7 @@ var Menu = ({
|
|
|
16988
17368
|
disabled
|
|
16989
17369
|
};
|
|
16990
17370
|
return /* @__PURE__ */ jsxs47(Fragment11, { children: [
|
|
16991
|
-
trigger(bag,
|
|
17371
|
+
trigger(bag, useCallback30((el) => triggerRef.current = el, [])),
|
|
16992
17372
|
/* @__PURE__ */ jsx79(
|
|
16993
17373
|
PopUp,
|
|
16994
17374
|
{
|
|
@@ -17010,7 +17390,7 @@ var Menu = ({
|
|
|
17010
17390
|
};
|
|
17011
17391
|
|
|
17012
17392
|
// src/components/user-interaction/ScrollPicker.tsx
|
|
17013
|
-
import { useCallback as
|
|
17393
|
+
import { useCallback as useCallback31, useEffect as useEffect42, useState as useState38 } from "react";
|
|
17014
17394
|
import clsx30 from "clsx";
|
|
17015
17395
|
import { jsx as jsx80, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
17016
17396
|
var up = 1;
|
|
@@ -17031,7 +17411,7 @@ var ScrollPicker = ({
|
|
|
17031
17411
|
transition,
|
|
17032
17412
|
items,
|
|
17033
17413
|
lastTimeStamp
|
|
17034
|
-
}, setAnimation] =
|
|
17414
|
+
}, setAnimation] = useState38({
|
|
17035
17415
|
targetIndex: selectedIndex,
|
|
17036
17416
|
currentIndex: disabled ? selectedIndex : 0,
|
|
17037
17417
|
velocity: 0,
|
|
@@ -17047,7 +17427,7 @@ var ScrollPicker = ({
|
|
|
17047
17427
|
const itemHeight = 40;
|
|
17048
17428
|
const distance = 8;
|
|
17049
17429
|
const containerHeight = itemHeight * (itemsShownCount - 2) + distance * (itemsShownCount - 2 + 1);
|
|
17050
|
-
const getDirection =
|
|
17430
|
+
const getDirection = useCallback31((targetIndex, currentIndex2, transition2, length) => {
|
|
17051
17431
|
if (targetIndex === currentIndex2) {
|
|
17052
17432
|
return transition2 > 0 ? up : down;
|
|
17053
17433
|
}
|
|
@@ -17057,7 +17437,7 @@ var ScrollPicker = ({
|
|
|
17057
17437
|
}
|
|
17058
17438
|
return distanceForward >= length / 2 ? down : up;
|
|
17059
17439
|
}, []);
|
|
17060
|
-
const animate =
|
|
17440
|
+
const animate = useCallback31((timestamp, startTime) => {
|
|
17061
17441
|
setAnimation((prevState) => {
|
|
17062
17442
|
const {
|
|
17063
17443
|
targetIndex,
|
|
@@ -17130,7 +17510,7 @@ var ScrollPicker = ({
|
|
|
17130
17510
|
};
|
|
17131
17511
|
});
|
|
17132
17512
|
}, [disabled, getDirection, onChange]);
|
|
17133
|
-
|
|
17513
|
+
useEffect42(() => {
|
|
17134
17514
|
requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp));
|
|
17135
17515
|
});
|
|
17136
17516
|
const opacity = (transition2, index, itemsCount) => {
|
|
@@ -17208,7 +17588,7 @@ var ScrollPicker = ({
|
|
|
17208
17588
|
};
|
|
17209
17589
|
|
|
17210
17590
|
// src/components/user-interaction/Switch.tsx
|
|
17211
|
-
import { useCallback as
|
|
17591
|
+
import { useCallback as useCallback32 } from "react";
|
|
17212
17592
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
17213
17593
|
var Switch = ({
|
|
17214
17594
|
value: controlledValue,
|
|
@@ -17223,7 +17603,7 @@ var Switch = ({
|
|
|
17223
17603
|
}) => {
|
|
17224
17604
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
17225
17605
|
const onValueChangeStable = useEventCallbackStabilizer(onValueChange);
|
|
17226
|
-
const onChangeWrapper =
|
|
17606
|
+
const onChangeWrapper = useCallback32((value2) => {
|
|
17227
17607
|
onValueChangeStable(!value2);
|
|
17228
17608
|
onEditCompleteStable(!value2);
|
|
17229
17609
|
}, [onValueChangeStable, onEditCompleteStable]);
|
|
@@ -17263,7 +17643,7 @@ var Switch = ({
|
|
|
17263
17643
|
};
|
|
17264
17644
|
|
|
17265
17645
|
// src/components/user-interaction/Textarea.tsx
|
|
17266
|
-
import { forwardRef as forwardRef19, useCallback as
|
|
17646
|
+
import { forwardRef as forwardRef19, useCallback as useCallback33, useId as useId17 } from "react";
|
|
17267
17647
|
import clsx31 from "clsx";
|
|
17268
17648
|
import { jsx as jsx82, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
17269
17649
|
var Textarea = forwardRef19(function Textarea2({
|
|
@@ -17282,7 +17662,7 @@ var Textarea = forwardRef19(function Textarea2({
|
|
|
17282
17662
|
});
|
|
17283
17663
|
const { restartTimer, clearTimer } = useDelay(saveDelayOptions);
|
|
17284
17664
|
const onEditCompleteStable = useEventCallbackStabilizer(onEditComplete);
|
|
17285
|
-
const onEditCompleteWrapper =
|
|
17665
|
+
const onEditCompleteWrapper = useCallback33((text) => {
|
|
17286
17666
|
onEditCompleteStable(text);
|
|
17287
17667
|
clearTimer();
|
|
17288
17668
|
}, [onEditCompleteStable, clearTimer]);
|
|
@@ -17394,7 +17774,7 @@ var TimeDisplay = ({
|
|
|
17394
17774
|
|
|
17395
17775
|
// src/components/user-interaction/input/InsideLabelInput.tsx
|
|
17396
17776
|
import { useId as useId18 } from "react";
|
|
17397
|
-
import { forwardRef as forwardRef20, useState as
|
|
17777
|
+
import { forwardRef as forwardRef20, useState as useState39 } from "react";
|
|
17398
17778
|
import clsx32 from "clsx";
|
|
17399
17779
|
import { jsx as jsx84, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
17400
17780
|
var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
@@ -17410,7 +17790,7 @@ var InsideLabelInput = forwardRef20(function InsideLabelInput2({
|
|
|
17410
17790
|
onValueChange,
|
|
17411
17791
|
defaultValue: initialValue
|
|
17412
17792
|
});
|
|
17413
|
-
const [isFocused, setIsFocused] =
|
|
17793
|
+
const [isFocused, setIsFocused] = useState39(false);
|
|
17414
17794
|
const generatedId = useId18();
|
|
17415
17795
|
const id = customId ?? generatedId;
|
|
17416
17796
|
return /* @__PURE__ */ jsxs50("div", { className: clsx32("relative"), children: [
|
|
@@ -17500,7 +17880,7 @@ var SearchBar = ({
|
|
|
17500
17880
|
};
|
|
17501
17881
|
|
|
17502
17882
|
// src/components/user-interaction/input/ToggleableInput.tsx
|
|
17503
|
-
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";
|
|
17504
17884
|
import { Pencil } from "lucide-react";
|
|
17505
17885
|
import clsx34 from "clsx";
|
|
17506
17886
|
import { jsx as jsx86, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
@@ -17517,10 +17897,10 @@ var ToggleableInput = forwardRef21(function ToggleableInput2({
|
|
|
17517
17897
|
onValueChange,
|
|
17518
17898
|
defaultValue: initialValue
|
|
17519
17899
|
});
|
|
17520
|
-
const [isEditing, setIsEditing] =
|
|
17521
|
-
const innerRef =
|
|
17900
|
+
const [isEditing, setIsEditing] = useState40(initialState !== "display");
|
|
17901
|
+
const innerRef = useRef34(null);
|
|
17522
17902
|
useImperativeHandle12(forwardedRef, () => innerRef.current);
|
|
17523
|
-
|
|
17903
|
+
useEffect43(() => {
|
|
17524
17904
|
if (isEditing) {
|
|
17525
17905
|
innerRef.current?.focus();
|
|
17526
17906
|
}
|
|
@@ -17730,7 +18110,7 @@ var DateProperty = ({
|
|
|
17730
18110
|
import { List } from "lucide-react";
|
|
17731
18111
|
|
|
17732
18112
|
// src/components/user-interaction/select/MultiSelectChipDisplay.tsx
|
|
17733
|
-
import { forwardRef as forwardRef22, useEffect as
|
|
18113
|
+
import { forwardRef as forwardRef22, useEffect as useEffect44, useImperativeHandle as useImperativeHandle13, useRef as useRef35 } from "react";
|
|
17734
18114
|
import { XIcon as XIcon2, Plus } from "lucide-react";
|
|
17735
18115
|
import { jsx as jsx90, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
17736
18116
|
var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayButton2({
|
|
@@ -17740,7 +18120,7 @@ var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayB
|
|
|
17740
18120
|
const translation = useHightideTranslation();
|
|
17741
18121
|
const { state, trigger, item, ids, setIds } = useSelectContext();
|
|
17742
18122
|
const { register, unregister, toggleOpen } = trigger;
|
|
17743
|
-
|
|
18123
|
+
useEffect44(() => {
|
|
17744
18124
|
if (id) {
|
|
17745
18125
|
setIds((prev) => ({
|
|
17746
18126
|
...prev,
|
|
@@ -17748,9 +18128,9 @@ var MultiSelectChipDisplayButton = forwardRef22(function MultiSelectChipDisplayB
|
|
|
17748
18128
|
}));
|
|
17749
18129
|
}
|
|
17750
18130
|
}, [id, setIds]);
|
|
17751
|
-
const innerRef =
|
|
18131
|
+
const innerRef = useRef35(null);
|
|
17752
18132
|
useImperativeHandle13(ref, () => innerRef.current);
|
|
17753
|
-
|
|
18133
|
+
useEffect44(() => {
|
|
17754
18134
|
register(innerRef);
|
|
17755
18135
|
return () => unregister();
|
|
17756
18136
|
}, [register, unregister]);
|
|
@@ -17987,463 +18367,97 @@ var SingleSelectProperty = ({
|
|
|
17987
18367
|
className: "flex-row-2 w-full items-center justify-between",
|
|
17988
18368
|
hideExpansionIcon: true,
|
|
17989
18369
|
"data-name": "property-input"
|
|
17990
|
-
}
|
|
17991
|
-
),
|
|
17992
|
-
/* @__PURE__ */ jsx93(SelectContent, { children })
|
|
17993
|
-
]
|
|
17994
|
-
}
|
|
17995
|
-
)
|
|
17996
|
-
}
|
|
17997
|
-
)
|
|
17998
|
-
}
|
|
17999
|
-
);
|
|
18000
|
-
};
|
|
18001
|
-
|
|
18002
|
-
// src/components/user-interaction/properties/TextProperty.tsx
|
|
18003
|
-
import { Text } from "lucide-react";
|
|
18004
|
-
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
18005
|
-
var TextProperty = ({
|
|
18006
|
-
value,
|
|
18007
|
-
readOnly,
|
|
18008
|
-
onValueChange,
|
|
18009
|
-
onEditComplete,
|
|
18010
|
-
...baseProps
|
|
18011
|
-
}) => {
|
|
18012
|
-
const translation = useHightideTranslation();
|
|
18013
|
-
const hasValue = value !== void 0;
|
|
18014
|
-
return /* @__PURE__ */ jsx94(
|
|
18015
|
-
PropertyBase,
|
|
18016
|
-
{
|
|
18017
|
-
...baseProps,
|
|
18018
|
-
hasValue,
|
|
18019
|
-
icon: /* @__PURE__ */ jsx94(Text, { size: 24 }),
|
|
18020
|
-
children: ({ invalid }) => /* @__PURE__ */ jsx94(
|
|
18021
|
-
Textarea,
|
|
18022
|
-
{
|
|
18023
|
-
"data-name": "property-input",
|
|
18024
|
-
className: "w-full",
|
|
18025
|
-
"data-invalid": PropsUtil.dataAttributes.bool(invalid),
|
|
18026
|
-
rows: 5,
|
|
18027
|
-
value: value ?? "",
|
|
18028
|
-
readOnly,
|
|
18029
|
-
placeholder: translation("text"),
|
|
18030
|
-
onValueChange: (value2) => onValueChange?.(value2),
|
|
18031
|
-
onEditComplete: (value2) => onEditComplete?.(value2)
|
|
18032
|
-
}
|
|
18033
|
-
)
|
|
18034
|
-
}
|
|
18035
|
-
);
|
|
18036
|
-
};
|
|
18037
|
-
|
|
18038
|
-
// src/components/utils/Transition.tsx
|
|
18039
|
-
import { useEffect as useEffect38, useState as useState37 } from "react";
|
|
18040
|
-
function Transition({
|
|
18041
|
-
children,
|
|
18042
|
-
show,
|
|
18043
|
-
includeAnimation = true
|
|
18044
|
-
}) {
|
|
18045
|
-
const [isOpen, setIsOpen] = useState37(show);
|
|
18046
|
-
const [isTransitioning, setIsTransitioning] = useState37(!isOpen);
|
|
18047
|
-
const isUsingReducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : true;
|
|
18048
|
-
useEffect38(() => {
|
|
18049
|
-
setIsOpen(show);
|
|
18050
|
-
setIsTransitioning(true);
|
|
18051
|
-
}, [show]);
|
|
18052
|
-
const onAnimationEnd = () => setIsTransitioning(false);
|
|
18053
|
-
const bag = {
|
|
18054
|
-
isOpen,
|
|
18055
|
-
isTransitioning,
|
|
18056
|
-
isUsingReducedMotion,
|
|
18057
|
-
data: {
|
|
18058
|
-
"data-open": isOpen && !isTransitioning ? "" : void 0,
|
|
18059
|
-
"data-opening": isOpen && isTransitioning ? "" : void 0,
|
|
18060
|
-
"data-closing": !isOpen && isTransitioning ? "" : void 0,
|
|
18061
|
-
"data-closed": !isOpen && !isTransitioning ? "" : void 0
|
|
18062
|
-
},
|
|
18063
|
-
handlers: {
|
|
18064
|
-
onTransitionEnd: () => setIsTransitioning(false),
|
|
18065
|
-
onTransitionCancel: () => setIsTransitioning(false),
|
|
18066
|
-
onAnimationEnd: includeAnimation ? onAnimationEnd : void 0
|
|
18067
|
-
}
|
|
18068
|
-
};
|
|
18069
|
-
return BagFunctionUtil.resolve(children, bag);
|
|
18070
|
-
}
|
|
18071
|
-
|
|
18072
|
-
// src/global-contexts/HightideProvider.tsx
|
|
18073
|
-
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
18074
|
-
var HightideProvider = ({
|
|
18075
|
-
children,
|
|
18076
|
-
theme,
|
|
18077
|
-
locale,
|
|
18078
|
-
config
|
|
18079
|
-
}) => {
|
|
18080
|
-
return /* @__PURE__ */ jsx95(LocaleProvider, { ...locale, children: /* @__PURE__ */ jsx95(ThemeProvider, { ...theme, children: /* @__PURE__ */ jsx95(HightideConfigProvider, { ...config, children }) }) });
|
|
18081
|
-
};
|
|
18082
|
-
|
|
18083
|
-
// src/hooks/focus/useFocusGuards.ts
|
|
18084
|
-
import { useEffect as useEffect39 } from "react";
|
|
18085
|
-
var selectorName = "data-hw-focus-guard";
|
|
18086
|
-
function FocusGuard() {
|
|
18087
|
-
const element = document.createElement("div");
|
|
18088
|
-
element.setAttribute(selectorName, "");
|
|
18089
|
-
element.tabIndex = 0;
|
|
18090
|
-
element.style.border = "none";
|
|
18091
|
-
element.style.outline = "none";
|
|
18092
|
-
element.style.boxShadow = "none";
|
|
18093
|
-
element.style.opacity = "0";
|
|
18094
|
-
element.style.position = "fixed";
|
|
18095
|
-
element.style.pointerEvents = "none";
|
|
18096
|
-
return element;
|
|
18097
|
-
}
|
|
18098
|
-
var FocusGuardsService = class _FocusGuardsService {
|
|
18099
|
-
constructor() {
|
|
18100
|
-
this.count = 0;
|
|
18101
|
-
}
|
|
18102
|
-
static getInstance() {
|
|
18103
|
-
if (!_FocusGuardsService.instance) {
|
|
18104
|
-
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
18105
|
-
}
|
|
18106
|
-
return _FocusGuardsService.instance;
|
|
18107
|
-
}
|
|
18108
|
-
add() {
|
|
18109
|
-
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
18110
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
18111
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
18112
|
-
this.count++;
|
|
18113
|
-
}
|
|
18114
|
-
remove() {
|
|
18115
|
-
if (this.count === 1) {
|
|
18116
|
-
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
18117
|
-
}
|
|
18118
|
-
this.count--;
|
|
18119
|
-
}
|
|
18120
|
-
};
|
|
18121
|
-
var useFocusGuards = () => {
|
|
18122
|
-
useEffect39(() => {
|
|
18123
|
-
FocusGuardsService.getInstance().add();
|
|
18124
|
-
return () => {
|
|
18125
|
-
FocusGuardsService.getInstance().remove();
|
|
18126
|
-
};
|
|
18127
|
-
}, []);
|
|
18128
|
-
};
|
|
18129
|
-
|
|
18130
|
-
// src/hooks/focus/useFocusOnceVisible.ts
|
|
18131
|
-
import React6, { useEffect as useEffect40 } from "react";
|
|
18132
|
-
var useFocusOnceVisible = (ref, disable = false) => {
|
|
18133
|
-
const [hasUsedFocus, setHasUsedFocus] = React6.useState(false);
|
|
18134
|
-
useEffect40(() => {
|
|
18135
|
-
if (disable || hasUsedFocus) {
|
|
18136
|
-
return;
|
|
18137
|
-
}
|
|
18138
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
18139
|
-
if (entry.isIntersecting && !hasUsedFocus) {
|
|
18140
|
-
ref.current?.focus();
|
|
18141
|
-
setHasUsedFocus(hasUsedFocus);
|
|
18142
|
-
}
|
|
18143
|
-
}, {
|
|
18144
|
-
threshold: 0.1
|
|
18145
|
-
});
|
|
18146
|
-
if (ref.current) {
|
|
18147
|
-
observer.observe(ref.current);
|
|
18148
|
-
}
|
|
18149
|
-
return () => observer.disconnect();
|
|
18150
|
-
}, [disable, hasUsedFocus, ref]);
|
|
18151
|
-
};
|
|
18152
|
-
|
|
18153
|
-
// src/hooks/focus/useIsMounted.ts
|
|
18154
|
-
import { useEffect as useEffect41, useLayoutEffect as useLayoutEffect7, useState as useState38 } from "react";
|
|
18155
|
-
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
18156
|
-
var useIsomorphicEffect = isClient ? useLayoutEffect7 : useEffect41;
|
|
18157
|
-
var useIsMounted = () => {
|
|
18158
|
-
const [isMounted, setIsMounted] = useState38(false);
|
|
18159
|
-
useIsomorphicEffect(() => {
|
|
18160
|
-
setIsMounted(true);
|
|
18161
|
-
return () => {
|
|
18162
|
-
setIsMounted(false);
|
|
18163
|
-
};
|
|
18164
|
-
}, []);
|
|
18165
|
-
return isMounted;
|
|
18166
|
-
};
|
|
18167
|
-
|
|
18168
|
-
// src/hooks/useHandleRefs.ts
|
|
18169
|
-
import { useEffect as useEffect42, useRef as useRef35 } from "react";
|
|
18170
|
-
function useHandleRefs(handleRef) {
|
|
18171
|
-
const refs = useRef35([]);
|
|
18172
|
-
useEffect42(() => {
|
|
18173
|
-
refs.current = Object.keys(handleRef?.current ?? {}).map(
|
|
18174
|
-
() => ({ current: null })
|
|
18175
|
-
);
|
|
18176
|
-
const values = Object.values(handleRef?.current ?? {});
|
|
18177
|
-
values.forEach((el, i) => {
|
|
18178
|
-
refs.current[i].current = el;
|
|
18179
|
-
});
|
|
18180
|
-
});
|
|
18181
|
-
return refs.current;
|
|
18182
|
-
}
|
|
18183
|
-
|
|
18184
|
-
// src/hooks/useLogUnstableDependencies.ts
|
|
18185
|
-
import React7 from "react";
|
|
18186
|
-
function useLogUnstableDependencies(name, value) {
|
|
18187
|
-
const prev = React7.useRef(null);
|
|
18188
|
-
React7.useEffect(() => {
|
|
18189
|
-
if (!prev.current) {
|
|
18190
|
-
prev.current = value;
|
|
18191
|
-
return;
|
|
18192
|
-
}
|
|
18193
|
-
const changes = {};
|
|
18194
|
-
for (const key of Object.keys(value)) {
|
|
18195
|
-
if (prev.current[key] !== value[key]) {
|
|
18196
|
-
changes[key] = {
|
|
18197
|
-
prev: prev.current[key],
|
|
18198
|
-
next: value[key]
|
|
18199
|
-
};
|
|
18200
|
-
}
|
|
18201
|
-
}
|
|
18202
|
-
if (Object.keys(changes).length > 0) {
|
|
18203
|
-
console.info(`[${name}] changed`, changes);
|
|
18204
|
-
}
|
|
18205
|
-
prev.current = value;
|
|
18206
|
-
});
|
|
18207
|
-
}
|
|
18208
|
-
|
|
18209
|
-
// src/hooks/useOverwritableState.ts
|
|
18210
|
-
import { useEffect as useEffect43, useState as useState39 } from "react";
|
|
18211
|
-
var useOverwritableState = (overwriteValue, onChange) => {
|
|
18212
|
-
const [state, setState] = useState39(overwriteValue);
|
|
18213
|
-
useEffect43(() => {
|
|
18214
|
-
setState(overwriteValue);
|
|
18215
|
-
}, [overwriteValue]);
|
|
18216
|
-
const onChangeWrapper = (action) => {
|
|
18217
|
-
const resolved = resolveSetState(action, state);
|
|
18218
|
-
setState(resolved);
|
|
18219
|
-
onChange?.(resolved);
|
|
18220
|
-
};
|
|
18221
|
-
return [state, onChangeWrapper];
|
|
18222
|
-
};
|
|
18223
|
-
|
|
18224
|
-
// src/hooks/useRerender.ts
|
|
18225
|
-
import { useReducer as useReducer2 } from "react";
|
|
18226
|
-
var useRerender = () => {
|
|
18227
|
-
return useReducer2(() => ({}), {})[1];
|
|
18228
|
-
};
|
|
18229
|
-
|
|
18230
|
-
// src/hooks/useSearch.ts
|
|
18231
|
-
import { useCallback as useCallback33, useEffect as useEffect44, useMemo as useMemo30, useState as useState40 } from "react";
|
|
18232
|
-
|
|
18233
|
-
// src/utils/simpleSearch.ts
|
|
18234
|
-
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
18235
|
-
return objects.filter((object) => {
|
|
18236
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
18237
|
-
if (!mappedSearchKeywords) {
|
|
18238
|
-
return true;
|
|
18239
|
-
}
|
|
18240
|
-
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
18241
|
-
});
|
|
18242
|
-
};
|
|
18243
|
-
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
18244
|
-
return objects.filter((object) => {
|
|
18245
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
18246
|
-
if (!mappedSearchKeywords) {
|
|
18247
|
-
return true;
|
|
18370
|
+
}
|
|
18371
|
+
),
|
|
18372
|
+
/* @__PURE__ */ jsx93(SelectContent, { children })
|
|
18373
|
+
]
|
|
18374
|
+
}
|
|
18375
|
+
)
|
|
18376
|
+
}
|
|
18377
|
+
)
|
|
18248
18378
|
}
|
|
18249
|
-
|
|
18250
|
-
});
|
|
18251
|
-
};
|
|
18252
|
-
var SimpleSearchWithMapping = (search, objects, mapping) => {
|
|
18253
|
-
return MultiSearchWithMapping(search, objects, (value) => [mapping(value)]);
|
|
18254
|
-
};
|
|
18255
|
-
var SimpleSearch = (search, objects) => {
|
|
18256
|
-
return SimpleSearchWithMapping(search, objects, (value) => value);
|
|
18379
|
+
);
|
|
18257
18380
|
};
|
|
18258
18381
|
|
|
18259
|
-
// src/
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
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
|
|
18269
18391
|
}) => {
|
|
18270
|
-
const
|
|
18271
|
-
const
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
if (!sortingFunction) {
|
|
18293
|
-
return filteredResult;
|
|
18294
|
-
}
|
|
18295
|
-
return filteredResult.sort(sortingFunction);
|
|
18296
|
-
}, [filteredResult, sortingFunction]);
|
|
18297
|
-
const usedResult = useMemo30(() => {
|
|
18298
|
-
if (!disabled) {
|
|
18299
|
-
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
|
+
)
|
|
18300
18414
|
}
|
|
18301
|
-
|
|
18302
|
-
}, [disabled, list, sortedAndFilteredResult]);
|
|
18303
|
-
return {
|
|
18304
|
-
result: usedResult,
|
|
18305
|
-
hasResult: usedResult.length > 0,
|
|
18306
|
-
allItems: list,
|
|
18307
|
-
updateSearch,
|
|
18308
|
-
search,
|
|
18309
|
-
setSearch
|
|
18310
|
-
};
|
|
18415
|
+
);
|
|
18311
18416
|
};
|
|
18312
18417
|
|
|
18313
|
-
// src/
|
|
18418
|
+
// src/components/utils/Transition.tsx
|
|
18314
18419
|
import { useEffect as useEffect45, useState as useState41 } from "react";
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
useEffect45(() => {
|
|
18324
|
-
setDateAndTimeStrings({
|
|
18325
|
-
compareDate: date,
|
|
18326
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
18327
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
18328
|
-
});
|
|
18329
|
-
}, [date, absoluteFormat, locale]);
|
|
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;
|
|
18330
18428
|
useEffect45(() => {
|
|
18331
|
-
|
|
18332
|
-
|
|
18333
|
-
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
setDateAndTimeStrings({
|
|
18345
|
-
compareDate: date,
|
|
18346
|
-
absolute: DateUtils.formatAbsolute(date, locale, absoluteFormat),
|
|
18347
|
-
relative: DateUtils.formatRelative(date, locale)
|
|
18348
|
-
});
|
|
18349
|
-
}, delayInSeconds * 1e3 / 2);
|
|
18350
|
-
};
|
|
18351
|
-
startTimer();
|
|
18352
|
-
return () => clearInterval(timeoutId);
|
|
18353
|
-
}, [absoluteFormat, date, locale]);
|
|
18354
|
-
return {
|
|
18355
|
-
absolute: dateAndTimeStrings.absolute,
|
|
18356
|
-
relative: dateAndTimeStrings.relative
|
|
18357
|
-
};
|
|
18358
|
-
};
|
|
18359
|
-
|
|
18360
|
-
// src/utils/emailValidation.ts
|
|
18361
|
-
var validateEmail = (email) => {
|
|
18362
|
-
return /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email);
|
|
18363
|
-
};
|
|
18364
|
-
|
|
18365
|
-
// src/hooks/useValidators.ts
|
|
18366
|
-
import { useMemo as useMemo31 } from "react";
|
|
18367
|
-
var notEmpty = (value) => {
|
|
18368
|
-
if (!value) {
|
|
18369
|
-
return "notEmpty";
|
|
18370
|
-
}
|
|
18371
|
-
};
|
|
18372
|
-
var boundsValidator = (length, bounds) => {
|
|
18373
|
-
const [min, max] = bounds;
|
|
18374
|
-
if (min !== void 0 && max !== void 0 && (length === void 0 || length < min || length > max)) {
|
|
18375
|
-
return "range";
|
|
18376
|
-
}
|
|
18377
|
-
if (min !== void 0 && (length === void 0 || length < min)) {
|
|
18378
|
-
return "lower";
|
|
18379
|
-
}
|
|
18380
|
-
if (max !== void 0 && length !== void 0 && length > max) {
|
|
18381
|
-
return "upper";
|
|
18382
|
-
}
|
|
18383
|
-
return "none";
|
|
18384
|
-
};
|
|
18385
|
-
var lengthValidator = (value, bounds) => {
|
|
18386
|
-
const mapping = {
|
|
18387
|
-
range: "outOfRangeString",
|
|
18388
|
-
lower: "tooShort",
|
|
18389
|
-
upper: "tooLong",
|
|
18390
|
-
none: void 0
|
|
18391
|
-
};
|
|
18392
|
-
return mapping[boundsValidator(value?.length, bounds)];
|
|
18393
|
-
};
|
|
18394
|
-
var selectionValidator = (value, bounds) => {
|
|
18395
|
-
const mapping = {
|
|
18396
|
-
range: "outOfRangeSelectionItems",
|
|
18397
|
-
lower: "tooFewSelectionItems",
|
|
18398
|
-
upper: "tooManySelectionItems",
|
|
18399
|
-
none: void 0
|
|
18400
|
-
};
|
|
18401
|
-
return mapping[boundsValidator(value?.length, bounds)];
|
|
18402
|
-
};
|
|
18403
|
-
var emailValidator = (value) => {
|
|
18404
|
-
if (!value || !validateEmail(value)) {
|
|
18405
|
-
return "invalidEmail";
|
|
18406
|
-
}
|
|
18407
|
-
};
|
|
18408
|
-
var UseValidators = {
|
|
18409
|
-
notEmpty,
|
|
18410
|
-
length: lengthValidator,
|
|
18411
|
-
email: emailValidator,
|
|
18412
|
-
selection: selectionValidator
|
|
18413
|
-
};
|
|
18414
|
-
var useTranslatedValidators = () => {
|
|
18415
|
-
const translation = useHightideTranslation();
|
|
18416
|
-
return useMemo31(() => ({
|
|
18417
|
-
notEmpty: (value) => {
|
|
18418
|
-
const result = notEmpty(value);
|
|
18419
|
-
if (result) {
|
|
18420
|
-
return translation(result);
|
|
18421
|
-
}
|
|
18422
|
-
},
|
|
18423
|
-
length: (value, length) => {
|
|
18424
|
-
const [min, max] = length;
|
|
18425
|
-
const result = lengthValidator(value, length);
|
|
18426
|
-
if (result) {
|
|
18427
|
-
return translation(result, { min, max });
|
|
18428
|
-
}
|
|
18429
|
-
},
|
|
18430
|
-
email: (value) => {
|
|
18431
|
-
const result = emailValidator(value ?? "");
|
|
18432
|
-
if (result) {
|
|
18433
|
-
return translation(result);
|
|
18434
|
-
}
|
|
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
|
|
18435
18442
|
},
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
return translation(
|
|
18441
|
-
result,
|
|
18442
|
-
{ min, max }
|
|
18443
|
-
);
|
|
18444
|
-
}
|
|
18443
|
+
handlers: {
|
|
18444
|
+
onTransitionEnd: () => setIsTransitioning(false),
|
|
18445
|
+
onTransitionCancel: () => setIsTransitioning(false),
|
|
18446
|
+
onAnimationEnd: includeAnimation ? onAnimationEnd : void 0
|
|
18445
18447
|
}
|
|
18446
|
-
}
|
|
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 }) }) });
|
|
18447
18461
|
};
|
|
18448
18462
|
|
|
18449
18463
|
// src/utils/builder.ts
|