@helpwave/hightide 0.1.7 → 0.1.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/components/branding/HelpwaveBadge.js +30 -8
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +30 -8
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +18 -20
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +18 -20
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.d.mts +1 -1
- package/dist/components/date/DayPicker.d.ts +1 -1
- package/dist/components/date/DayPicker.js +23 -11
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +23 -11
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +106 -22
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +106 -22
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +2 -2
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +2 -2
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.js +2 -2
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.d.mts +1 -1
- package/dist/components/layout-and-navigation/Carousel.d.ts +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +86 -28
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +86 -28
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +3 -0
- package/dist/components/layout-and-navigation/Expandable.d.ts +3 -0
- package/dist/components/layout-and-navigation/Expandable.js +4 -3
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +4 -3
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +4 -3
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +4 -3
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +2 -2
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +2 -2
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.d.mts +7 -6
- package/dist/components/layout-and-navigation/SearchableList.d.ts +7 -6
- package/dist/components/layout-and-navigation/SearchableList.js +114 -21
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +114 -21
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +6 -6
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +6 -6
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Table.js +1 -1
- package/dist/components/layout-and-navigation/Table.js.map +1 -1
- package/dist/components/layout-and-navigation/Table.mjs +1 -1
- package/dist/components/layout-and-navigation/Table.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +10 -15
- package/dist/components/layout-and-navigation/Tile.d.ts +10 -15
- package/dist/components/layout-and-navigation/Tile.js +30 -8
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +30 -8
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ProgressIndicator.js +2 -2
- package/dist/components/loading-states/ProgressIndicator.js.map +1 -1
- package/dist/components/loading-states/ProgressIndicator.mjs +2 -2
- package/dist/components/loading-states/ProgressIndicator.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +2 -2
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +2 -2
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +2 -2
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +2 -2
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +2 -2
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +2 -2
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +384 -150
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +383 -149
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +385 -154
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +382 -151
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +1 -1
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +1 -1
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +1 -1
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +1 -1
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +1 -0
- package/dist/components/properties/MultiSelectProperty.d.ts +1 -0
- package/dist/components/properties/MultiSelectProperty.js +482 -430
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +478 -426
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +1 -1
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +1 -1
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +1 -1
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +1 -1
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +3 -3
- package/dist/components/properties/SelectProperty.d.ts +3 -3
- package/dist/components/properties/SelectProperty.js +404 -263
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +404 -263
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +1 -1
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +1 -1
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +18 -20
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +18 -20
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +14 -8
- package/dist/components/user-action/Menu.d.ts +14 -8
- package/dist/components/user-action/Menu.js +32 -11
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +32 -11
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +10 -16
- package/dist/components/user-action/MultiSelect.d.ts +10 -16
- package/dist/components/user-action/MultiSelect.js +485 -312
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +482 -310
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/Select.d.mts +5 -18
- package/dist/components/user-action/Select.d.ts +5 -18
- package/dist/components/user-action/Select.js +309 -113
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +304 -107
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Tooltip.js +2 -2
- package/dist/components/user-action/Tooltip.js.map +1 -1
- package/dist/components/user-action/Tooltip.mjs +2 -2
- package/dist/components/user-action/Tooltip.mjs.map +1 -1
- package/dist/css/globals.css +213 -205
- package/dist/css/uncompiled/globals.css +136 -72
- package/dist/hooks/useSearch.d.mts +17 -0
- package/dist/hooks/useSearch.d.ts +17 -0
- package/dist/hooks/useSearch.js +66 -0
- package/dist/hooks/useSearch.js.map +1 -0
- package/dist/hooks/useSearch.mjs +42 -0
- package/dist/hooks/useSearch.mjs.map +1 -0
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +555 -463
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +517 -427
- package/dist/index.mjs.map +1 -1
- package/dist/util/PropsWithFunctionChildren.d.mts +14 -0
- package/dist/util/PropsWithFunctionChildren.d.ts +14 -0
- package/dist/util/PropsWithFunctionChildren.js +38 -0
- package/dist/util/PropsWithFunctionChildren.js.map +1 -0
- package/dist/util/PropsWithFunctionChildren.mjs +14 -0
- package/dist/util/PropsWithFunctionChildren.mjs.map +1 -0
- package/dist/util/simpleSearch.d.mts +2 -2
- package/dist/util/simpleSearch.d.ts +2 -2
- package/dist/util/simpleSearch.js +4 -1
- package/dist/util/simpleSearch.js.map +1 -1
- package/dist/util/simpleSearch.mjs +4 -1
- package/dist/util/simpleSearch.mjs.map +1 -1
- package/package.json +1 -2
|
@@ -73,10 +73,9 @@ var useTranslation = (defaults, translationOverwrite = {}) => {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
// src/components/user-action/Select.tsx
|
|
76
|
-
var
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var import_clsx3 = __toESM(require("clsx"));
|
|
76
|
+
var import_lucide_react3 = require("lucide-react");
|
|
77
|
+
var import_react7 = require("react");
|
|
78
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
80
79
|
|
|
81
80
|
// src/components/user-action/Label.tsx
|
|
82
81
|
var import_clsx = __toESM(require("clsx"));
|
|
@@ -96,15 +95,119 @@ var Label = ({
|
|
|
96
95
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { ...props, className: (0, import_clsx.default)(styleMapping[labelType], className), children: children ? children : name });
|
|
97
96
|
};
|
|
98
97
|
|
|
98
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
99
|
+
var import_lucide_react = require("lucide-react");
|
|
100
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
101
|
+
|
|
99
102
|
// src/components/user-action/Input.tsx
|
|
100
103
|
var import_react4 = require("react");
|
|
101
104
|
var import_clsx2 = __toESM(require("clsx"));
|
|
102
105
|
|
|
103
106
|
// src/hooks/useSaveDelay.ts
|
|
104
107
|
var import_react3 = require("react");
|
|
108
|
+
function useSaveDelay(setNotificationStatus, delay) {
|
|
109
|
+
const [updateTimer, setUpdateTimer] = (0, import_react3.useState)(void 0);
|
|
110
|
+
const [notificationTimer, setNotificationTimer] = (0, import_react3.useState)(void 0);
|
|
111
|
+
const restartTimer = (onSave) => {
|
|
112
|
+
clearTimeout(updateTimer);
|
|
113
|
+
setUpdateTimer(setTimeout(() => {
|
|
114
|
+
onSave();
|
|
115
|
+
setNotificationStatus(true);
|
|
116
|
+
clearTimeout(notificationTimer);
|
|
117
|
+
setNotificationTimer(setTimeout(() => {
|
|
118
|
+
setNotificationStatus(false);
|
|
119
|
+
clearTimeout(notificationTimer);
|
|
120
|
+
}, delay));
|
|
121
|
+
clearTimeout(updateTimer);
|
|
122
|
+
}, delay));
|
|
123
|
+
};
|
|
124
|
+
const clearUpdateTimer = (hasSaved = true) => {
|
|
125
|
+
clearTimeout(updateTimer);
|
|
126
|
+
if (hasSaved) {
|
|
127
|
+
setNotificationStatus(true);
|
|
128
|
+
clearTimeout(notificationTimer);
|
|
129
|
+
setNotificationTimer(setTimeout(() => {
|
|
130
|
+
setNotificationStatus(false);
|
|
131
|
+
clearTimeout(notificationTimer);
|
|
132
|
+
}, delay));
|
|
133
|
+
} else {
|
|
134
|
+
setNotificationStatus(false);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
(0, import_react3.useEffect)(() => {
|
|
138
|
+
return () => {
|
|
139
|
+
clearTimeout(updateTimer);
|
|
140
|
+
clearTimeout(notificationTimer);
|
|
141
|
+
};
|
|
142
|
+
}, []);
|
|
143
|
+
return { restartTimer, clearUpdateTimer };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/util/noop.ts
|
|
147
|
+
var noop = () => void 0;
|
|
105
148
|
|
|
106
149
|
// src/components/user-action/Input.tsx
|
|
107
150
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
151
|
+
var Input = ({
|
|
152
|
+
id,
|
|
153
|
+
type = "text",
|
|
154
|
+
value,
|
|
155
|
+
label,
|
|
156
|
+
onChange = noop,
|
|
157
|
+
onChangeText = noop,
|
|
158
|
+
onEditCompleted,
|
|
159
|
+
className = "",
|
|
160
|
+
expanded = true,
|
|
161
|
+
autoFocus,
|
|
162
|
+
onBlur,
|
|
163
|
+
containerClassName,
|
|
164
|
+
...restProps
|
|
165
|
+
}) => {
|
|
166
|
+
const {
|
|
167
|
+
restartTimer,
|
|
168
|
+
clearUpdateTimer
|
|
169
|
+
} = useSaveDelay(() => void 0, 3e3);
|
|
170
|
+
const ref = (0, import_react4.useRef)(null);
|
|
171
|
+
(0, import_react4.useEffect)(() => {
|
|
172
|
+
if (autoFocus) {
|
|
173
|
+
ref.current?.focus();
|
|
174
|
+
}
|
|
175
|
+
}, [autoFocus]);
|
|
176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)({ "w-full": expanded }, containerClassName), children: [
|
|
177
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx2.default)("mb-1", label.className) }),
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
179
|
+
"input",
|
|
180
|
+
{
|
|
181
|
+
ref,
|
|
182
|
+
value,
|
|
183
|
+
id,
|
|
184
|
+
type,
|
|
185
|
+
className,
|
|
186
|
+
onBlur: (event) => {
|
|
187
|
+
if (onBlur) {
|
|
188
|
+
onBlur(event);
|
|
189
|
+
}
|
|
190
|
+
if (onEditCompleted) {
|
|
191
|
+
onEditCompleted(event.target.value);
|
|
192
|
+
clearUpdateTimer();
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
onChange: (e) => {
|
|
196
|
+
const value2 = e.target.value;
|
|
197
|
+
if (onEditCompleted) {
|
|
198
|
+
restartTimer(() => {
|
|
199
|
+
onEditCompleted(value2);
|
|
200
|
+
clearUpdateTimer();
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
onChange(e);
|
|
204
|
+
onChangeText(value2);
|
|
205
|
+
},
|
|
206
|
+
...restProps
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
] });
|
|
210
|
+
};
|
|
108
211
|
var FormInput = (0, import_react4.forwardRef)(function FormInput2({
|
|
109
212
|
id,
|
|
110
213
|
labelText,
|
|
@@ -141,102 +244,9 @@ var FormInput = (0, import_react4.forwardRef)(function FormInput2({
|
|
|
141
244
|
] });
|
|
142
245
|
});
|
|
143
246
|
|
|
144
|
-
// src/components/user-action/Select.tsx
|
|
145
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
146
|
-
var Select = ({
|
|
147
|
-
value,
|
|
148
|
-
label,
|
|
149
|
-
options,
|
|
150
|
-
onChange,
|
|
151
|
-
isHidingCurrentValue = true,
|
|
152
|
-
hintText = "",
|
|
153
|
-
showDisabledOptions = true,
|
|
154
|
-
isDisabled,
|
|
155
|
-
className,
|
|
156
|
-
textColor = "text-menu-text",
|
|
157
|
-
additionalItems,
|
|
158
|
-
selectedDisplayOverwrite
|
|
159
|
-
}) => {
|
|
160
|
-
let filteredOptions = isHidingCurrentValue ? options.filter((option) => option.value !== value) : options;
|
|
161
|
-
if (!showDisabledOptions) {
|
|
162
|
-
filteredOptions = filteredOptions.filter((value2) => !value2.disabled);
|
|
163
|
-
}
|
|
164
|
-
const selectedOption = options.find((option) => option.value === value);
|
|
165
|
-
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
166
|
-
console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
|
|
167
|
-
}
|
|
168
|
-
const borderColor = "border-menu-border";
|
|
169
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx3.default)(className), children: [
|
|
170
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx3.default)("mb-1", label.className) }),
|
|
171
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Menu, { as: "div", className: "relative text-menu-text", children: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
172
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
173
|
-
import_react5.Menu.Button,
|
|
174
|
-
{
|
|
175
|
-
className: (0, import_clsx3.default)(
|
|
176
|
-
"inline-flex w-full justify-between items-center rounded-t-lg border-2 px-4 py-2 font-medium bg-menu-background text-menu-text",
|
|
177
|
-
textColor,
|
|
178
|
-
borderColor,
|
|
179
|
-
{
|
|
180
|
-
"rounded-b-lg": !open,
|
|
181
|
-
"hover:border-primary": !isDisabled,
|
|
182
|
-
"bg-disabled-background cursor-not-allowed text-disabled": isDisabled
|
|
183
|
-
}
|
|
184
|
-
),
|
|
185
|
-
disabled: isDisabled,
|
|
186
|
-
children: [
|
|
187
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: selectedDisplayOverwrite ?? selectedOption?.label ?? hintText }),
|
|
188
|
-
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronDown, {})
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
),
|
|
192
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
193
|
-
import_react5.Menu.Items,
|
|
194
|
-
{
|
|
195
|
-
className: "absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto",
|
|
196
|
-
children: [
|
|
197
|
-
(additionalItems ?? []).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
198
|
-
"div",
|
|
199
|
-
{
|
|
200
|
-
className: (0, import_clsx3.default)(borderColor, "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0", {
|
|
201
|
-
"border-b-0 rounded-b-lg": filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1
|
|
202
|
-
}),
|
|
203
|
-
children: item
|
|
204
|
-
},
|
|
205
|
-
`additionalItems${index}`
|
|
206
|
-
)),
|
|
207
|
-
filteredOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Menu.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
208
|
-
"div",
|
|
209
|
-
{
|
|
210
|
-
className: (0, import_clsx3.default)(
|
|
211
|
-
"px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
|
|
212
|
-
option.className,
|
|
213
|
-
borderColor,
|
|
214
|
-
{
|
|
215
|
-
"brightness-90": option.value === value,
|
|
216
|
-
"brightness-95": index % 2 === 1,
|
|
217
|
-
"text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
|
|
218
|
-
"bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
|
|
219
|
-
"rounded-b-lg": index === filteredOptions.length - 1
|
|
220
|
-
}
|
|
221
|
-
),
|
|
222
|
-
onClick: () => {
|
|
223
|
-
if (!option.disabled) {
|
|
224
|
-
onChange(option.value);
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
children: option.label
|
|
228
|
-
}
|
|
229
|
-
) }, `item${index}`))
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
)
|
|
233
|
-
] }) })
|
|
234
|
-
] });
|
|
235
|
-
};
|
|
236
|
-
|
|
237
247
|
// src/components/user-action/Button.tsx
|
|
238
|
-
var
|
|
239
|
-
var
|
|
248
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
249
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
240
250
|
var paddingMapping = {
|
|
241
251
|
small: "btn-sm",
|
|
242
252
|
medium: "btn-md",
|
|
@@ -280,25 +290,25 @@ var SolidButton = ({
|
|
|
280
290
|
negative: "text-button-solid-negative-icon",
|
|
281
291
|
neutral: "text-button-solid-neutral-icon"
|
|
282
292
|
}[color];
|
|
283
|
-
return /* @__PURE__ */ (0,
|
|
293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
284
294
|
"button",
|
|
285
295
|
{
|
|
286
296
|
onClick: disabled ? void 0 : onClick,
|
|
287
297
|
disabled: disabled || onClick === void 0,
|
|
288
|
-
className: (0,
|
|
298
|
+
className: (0, import_clsx3.default)(
|
|
289
299
|
{
|
|
290
300
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
291
|
-
[(0,
|
|
301
|
+
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
292
302
|
},
|
|
293
303
|
ButtonUtil.paddingMapping[size],
|
|
294
304
|
className
|
|
295
305
|
),
|
|
296
306
|
...restProps,
|
|
297
307
|
children: [
|
|
298
|
-
startIcon && /* @__PURE__ */ (0,
|
|
308
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
299
309
|
"span",
|
|
300
310
|
{
|
|
301
|
-
className: (0,
|
|
311
|
+
className: (0, import_clsx3.default)({
|
|
302
312
|
[iconColorClasses]: !disabled,
|
|
303
313
|
[`text-disabled-icon`]: disabled
|
|
304
314
|
}),
|
|
@@ -306,10 +316,10 @@ var SolidButton = ({
|
|
|
306
316
|
}
|
|
307
317
|
),
|
|
308
318
|
children,
|
|
309
|
-
endIcon && /* @__PURE__ */ (0,
|
|
319
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
310
320
|
"span",
|
|
311
321
|
{
|
|
312
|
-
className: (0,
|
|
322
|
+
className: (0, import_clsx3.default)({
|
|
313
323
|
[iconColorClasses]: !disabled,
|
|
314
324
|
[`text-disabled-icon`]: disabled
|
|
315
325
|
}),
|
|
@@ -338,15 +348,15 @@ var IconButton = ({
|
|
|
338
348
|
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
339
349
|
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
340
350
|
}[color];
|
|
341
|
-
return /* @__PURE__ */ (0,
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
342
352
|
"button",
|
|
343
353
|
{
|
|
344
354
|
onClick: disabled ? void 0 : onClick,
|
|
345
355
|
disabled: disabled || onClick === void 0,
|
|
346
|
-
className: (0,
|
|
356
|
+
className: (0, import_clsx3.default)(
|
|
347
357
|
{
|
|
348
358
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
349
|
-
[(0,
|
|
359
|
+
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
350
360
|
},
|
|
351
361
|
ButtonUtil.iconPaddingMapping[size],
|
|
352
362
|
className
|
|
@@ -357,21 +367,245 @@ var IconButton = ({
|
|
|
357
367
|
);
|
|
358
368
|
};
|
|
359
369
|
|
|
370
|
+
// src/hooks/useSearch.ts
|
|
371
|
+
var import_react5 = require("react");
|
|
372
|
+
|
|
373
|
+
// src/util/simpleSearch.ts
|
|
374
|
+
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
375
|
+
return objects.filter((object) => {
|
|
376
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
377
|
+
if (!mappedSearchKeywords) {
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
// src/hooks/useSearch.ts
|
|
385
|
+
var useSearch = ({
|
|
386
|
+
list,
|
|
387
|
+
initialSearch,
|
|
388
|
+
searchMapping
|
|
389
|
+
}) => {
|
|
390
|
+
const [items, setItems] = (0, import_react5.useState)(list);
|
|
391
|
+
const [search, setSearch] = (0, import_react5.useState)(initialSearch);
|
|
392
|
+
(0, import_react5.useEffect)(() => {
|
|
393
|
+
setItems(list);
|
|
394
|
+
}, [list]);
|
|
395
|
+
const result = (0, import_react5.useMemo)(
|
|
396
|
+
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
397
|
+
[search, items, searchMapping]
|
|
398
|
+
);
|
|
399
|
+
return {
|
|
400
|
+
result,
|
|
401
|
+
hasResult: result.length > 0,
|
|
402
|
+
allItems: items,
|
|
403
|
+
setItems,
|
|
404
|
+
search,
|
|
405
|
+
setSearch
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
410
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
411
|
+
var defaultSearchableListTranslation = {
|
|
412
|
+
en: {
|
|
413
|
+
search: "Search",
|
|
414
|
+
nothingFound: "Nothing found"
|
|
415
|
+
},
|
|
416
|
+
de: {
|
|
417
|
+
search: "Suche",
|
|
418
|
+
nothingFound: "Nichts gefunden"
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
var SearchableList = ({
|
|
422
|
+
overwriteTranslation,
|
|
423
|
+
list,
|
|
424
|
+
initialSearch = "",
|
|
425
|
+
searchMapping,
|
|
426
|
+
autoFocus,
|
|
427
|
+
minimumItemsForSearch = 6,
|
|
428
|
+
itemMapper,
|
|
429
|
+
className,
|
|
430
|
+
resultListClassName
|
|
431
|
+
}) => {
|
|
432
|
+
const translation = useTranslation(defaultSearchableListTranslation, overwriteTranslation);
|
|
433
|
+
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("col gap-y-2", className), children: [
|
|
435
|
+
list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
436
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
437
|
+
Input,
|
|
438
|
+
{
|
|
439
|
+
value: search,
|
|
440
|
+
onChangeText: setSearch,
|
|
441
|
+
placeholder: translation.search,
|
|
442
|
+
autoFocus,
|
|
443
|
+
className: "w-full"
|
|
444
|
+
}
|
|
445
|
+
),
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Search, { className: "w-full h-full" }) })
|
|
447
|
+
] }),
|
|
448
|
+
hasResult ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_clsx4.default)("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "row text-description py-2 px-2", children: translation.nothingFound })
|
|
449
|
+
] });
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
453
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
454
|
+
var import_lucide_react2 = require("lucide-react");
|
|
455
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
456
|
+
var Tile = ({
|
|
457
|
+
title,
|
|
458
|
+
description,
|
|
459
|
+
onClick,
|
|
460
|
+
isSelected = false,
|
|
461
|
+
isDisabled = false,
|
|
462
|
+
prefix,
|
|
463
|
+
suffix,
|
|
464
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
465
|
+
selectedClassName = " bg-primary/20",
|
|
466
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
467
|
+
className
|
|
468
|
+
}) => {
|
|
469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
470
|
+
"div",
|
|
471
|
+
{
|
|
472
|
+
className: (0, import_clsx5.default)(
|
|
473
|
+
"row gap-x-2 w-full items-center",
|
|
474
|
+
{
|
|
475
|
+
[normalClassName]: !!onClick && !isDisabled,
|
|
476
|
+
[selectedClassName]: isSelected && !isDisabled,
|
|
477
|
+
[disabledClassName]: isDisabled
|
|
478
|
+
},
|
|
479
|
+
className
|
|
480
|
+
),
|
|
481
|
+
onClick: isDisabled ? void 0 : onClick,
|
|
482
|
+
children: [
|
|
483
|
+
prefix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { size: 24 }) : void 0),
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "col gap-y-0 w-full", children: [
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { className: (0, import_clsx5.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
486
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_clsx5.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
487
|
+
] }),
|
|
488
|
+
suffix
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
);
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
// src/hooks/useOutsideClick.ts
|
|
495
|
+
var import_react6 = require("react");
|
|
496
|
+
var useOutsideClick = (refs, handler) => {
|
|
497
|
+
(0, import_react6.useEffect)(() => {
|
|
498
|
+
const listener = (event) => {
|
|
499
|
+
if (event.target === null) return;
|
|
500
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
handler();
|
|
504
|
+
};
|
|
505
|
+
document.addEventListener("mousedown", listener);
|
|
506
|
+
document.addEventListener("touchstart", listener);
|
|
507
|
+
return () => {
|
|
508
|
+
document.removeEventListener("mousedown", listener);
|
|
509
|
+
document.removeEventListener("touchstart", listener);
|
|
510
|
+
};
|
|
511
|
+
}, [refs, handler]);
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
// src/components/user-action/Select.tsx
|
|
515
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
516
|
+
var Select = ({
|
|
517
|
+
value,
|
|
518
|
+
label,
|
|
519
|
+
options,
|
|
520
|
+
onChange,
|
|
521
|
+
hintText = "",
|
|
522
|
+
isDisabled,
|
|
523
|
+
isSearchEnabled = false,
|
|
524
|
+
className,
|
|
525
|
+
selectedDisplayOverwrite
|
|
526
|
+
}) => {
|
|
527
|
+
const triggerRef = (0, import_react7.useRef)(null);
|
|
528
|
+
const menuRef = (0, import_react7.useRef)(null);
|
|
529
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
530
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
531
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
532
|
+
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
533
|
+
console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
|
|
534
|
+
}
|
|
535
|
+
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: (0, import_clsx6.default)(className), children: [
|
|
537
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx6.default)("mb-1", label.className) }),
|
|
538
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
540
|
+
"button",
|
|
541
|
+
{
|
|
542
|
+
ref: triggerRef,
|
|
543
|
+
className: (0, import_clsx6.default)(
|
|
544
|
+
"btn-md justify-between w-full border-2",
|
|
545
|
+
{
|
|
546
|
+
"rounded-b-lg": !open,
|
|
547
|
+
"bg-menu-background border-menu-border hover:border-primary": !isDisabled,
|
|
548
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
549
|
+
}
|
|
550
|
+
),
|
|
551
|
+
onClick: () => setIsOpen(!isOpen),
|
|
552
|
+
disabled: isDisabled,
|
|
553
|
+
children: [
|
|
554
|
+
!isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
555
|
+
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "textstyle-description", children: hintText }),
|
|
556
|
+
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronDown, {})
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
),
|
|
560
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
561
|
+
"div",
|
|
562
|
+
{
|
|
563
|
+
ref: menuRef,
|
|
564
|
+
className: "absolute w-full z-10 rounded-lg mt-0.5 bg-menu-background text-menu-text shadow-around-md max-h-[500px] overflow-y-auto p-2",
|
|
565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
566
|
+
SearchableList,
|
|
567
|
+
{
|
|
568
|
+
list: options,
|
|
569
|
+
minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
|
|
570
|
+
searchMapping: (item) => item.searchTags,
|
|
571
|
+
itemMapper: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
572
|
+
Tile,
|
|
573
|
+
{
|
|
574
|
+
isSelected: selectedOption?.value === option.value,
|
|
575
|
+
className: "px-2 py-1 rounded-md",
|
|
576
|
+
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
577
|
+
title: { value: option.label, className: "font-semibold" },
|
|
578
|
+
onClick: () => {
|
|
579
|
+
onChange(option.value);
|
|
580
|
+
setIsOpen(false);
|
|
581
|
+
},
|
|
582
|
+
isDisabled: option.disabled
|
|
583
|
+
},
|
|
584
|
+
index
|
|
585
|
+
)
|
|
586
|
+
}
|
|
587
|
+
)
|
|
588
|
+
}
|
|
589
|
+
)
|
|
590
|
+
] })
|
|
591
|
+
] });
|
|
592
|
+
};
|
|
593
|
+
|
|
360
594
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
361
|
-
var
|
|
595
|
+
var import_react9 = require("react");
|
|
362
596
|
var import_react_dom = __toESM(require("react-dom"));
|
|
363
|
-
var
|
|
597
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
364
598
|
|
|
365
599
|
// src/hooks/useHoverState.ts
|
|
366
|
-
var
|
|
600
|
+
var import_react8 = require("react");
|
|
367
601
|
var defaultUseHoverStateProps = {
|
|
368
602
|
closingDelay: 200,
|
|
369
603
|
isDisabled: false
|
|
370
604
|
};
|
|
371
605
|
var useHoverState = (props = void 0) => {
|
|
372
606
|
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
373
|
-
const [isHovered, setIsHovered] = (0,
|
|
374
|
-
const [timer, setTimer] = (0,
|
|
607
|
+
const [isHovered, setIsHovered] = (0, import_react8.useState)(false);
|
|
608
|
+
const [timer, setTimer] = (0, import_react8.useState)();
|
|
375
609
|
const onMouseEnter = () => {
|
|
376
610
|
if (isDisabled) {
|
|
377
611
|
return;
|
|
@@ -387,14 +621,14 @@ var useHoverState = (props = void 0) => {
|
|
|
387
621
|
setIsHovered(false);
|
|
388
622
|
}, closingDelay));
|
|
389
623
|
};
|
|
390
|
-
(0,
|
|
624
|
+
(0, import_react8.useEffect)(() => {
|
|
391
625
|
if (timer) {
|
|
392
626
|
return () => {
|
|
393
627
|
clearTimeout(timer);
|
|
394
628
|
};
|
|
395
629
|
}
|
|
396
630
|
});
|
|
397
|
-
(0,
|
|
631
|
+
(0, import_react8.useEffect)(() => {
|
|
398
632
|
if (timer) {
|
|
399
633
|
clearTimeout(timer);
|
|
400
634
|
}
|
|
@@ -407,8 +641,8 @@ var useHoverState = (props = void 0) => {
|
|
|
407
641
|
};
|
|
408
642
|
|
|
409
643
|
// src/components/user-action/Tooltip.tsx
|
|
410
|
-
var
|
|
411
|
-
var
|
|
644
|
+
var import_clsx7 = require("clsx");
|
|
645
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
412
646
|
var Tooltip = ({
|
|
413
647
|
tooltip,
|
|
414
648
|
children,
|
|
@@ -438,30 +672,30 @@ var Tooltip = ({
|
|
|
438
672
|
left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
|
|
439
673
|
right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
|
|
440
674
|
};
|
|
441
|
-
return /* @__PURE__ */ (0,
|
|
675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
442
676
|
"div",
|
|
443
677
|
{
|
|
444
|
-
className: (0,
|
|
678
|
+
className: (0, import_clsx7.clsx)("relative inline-block", containerClassName),
|
|
445
679
|
...handlers,
|
|
446
680
|
children: [
|
|
447
681
|
children,
|
|
448
|
-
isHovered && /* @__PURE__ */ (0,
|
|
682
|
+
isHovered && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
449
683
|
"div",
|
|
450
684
|
{
|
|
451
|
-
className: (0,
|
|
685
|
+
className: (0, import_clsx7.clsx)(
|
|
452
686
|
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
453
|
-
animate-tooltip-fade-in shadow-
|
|
687
|
+
animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
|
|
454
688
|
positionClasses[position],
|
|
455
689
|
tooltipClassName
|
|
456
690
|
),
|
|
457
691
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
458
692
|
children: [
|
|
459
693
|
tooltip,
|
|
460
|
-
/* @__PURE__ */ (0,
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
461
695
|
"div",
|
|
462
696
|
{
|
|
463
|
-
className: (0,
|
|
464
|
-
style: { ...triangleStyle[position], zIndex }
|
|
697
|
+
className: (0, import_clsx7.clsx)(`absolute w-0 h-0`, triangleClasses[position]),
|
|
698
|
+
style: { ...triangleStyle[position], zIndex: zIndex + 1 }
|
|
465
699
|
}
|
|
466
700
|
)
|
|
467
701
|
]
|
|
@@ -473,25 +707,25 @@ var Tooltip = ({
|
|
|
473
707
|
};
|
|
474
708
|
|
|
475
709
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
476
|
-
var
|
|
477
|
-
var
|
|
710
|
+
var import_lucide_react4 = require("lucide-react");
|
|
711
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
478
712
|
var Overlay = ({
|
|
479
713
|
children,
|
|
480
714
|
isOpen,
|
|
481
715
|
onBackgroundClick,
|
|
482
716
|
backgroundClassName
|
|
483
717
|
}) => {
|
|
484
|
-
const [root, setRoot] = (0,
|
|
485
|
-
(0,
|
|
718
|
+
const [root, setRoot] = (0, import_react9.useState)();
|
|
719
|
+
(0, import_react9.useEffect)(() => {
|
|
486
720
|
setRoot(document.body);
|
|
487
721
|
}, []);
|
|
488
722
|
if (!root || !isOpen) return null;
|
|
489
723
|
return import_react_dom.default.createPortal(
|
|
490
|
-
/* @__PURE__ */ (0,
|
|
491
|
-
/* @__PURE__ */ (0,
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_clsx8.default)("fixed inset-0 z-[9999]"), children: [
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
492
726
|
"div",
|
|
493
727
|
{
|
|
494
|
-
className: (0,
|
|
728
|
+
className: (0, import_clsx8.default)("fixed inset-0 h-screen w-screen bg-black/30", backgroundClassName),
|
|
495
729
|
onClick: onBackgroundClick
|
|
496
730
|
}
|
|
497
731
|
),
|
|
@@ -519,21 +753,21 @@ var OverlayHeader = ({
|
|
|
519
753
|
}) => {
|
|
520
754
|
const translation = useTranslation(defaultModalHeaderTranslation, overwriteTranslation);
|
|
521
755
|
const hasTitleRow = !!title || !!titleText || !!onClose;
|
|
522
|
-
const titleRow = /* @__PURE__ */ (0,
|
|
523
|
-
title ?? /* @__PURE__ */ (0,
|
|
756
|
+
const titleRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "row justify-between items-start gap-x-8", children: [
|
|
757
|
+
title ?? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
524
758
|
"h2",
|
|
525
759
|
{
|
|
526
|
-
className: (0,
|
|
760
|
+
className: (0, import_clsx8.default)("textstyle-title-lg", {
|
|
527
761
|
"mb-1": description || descriptionText
|
|
528
762
|
}),
|
|
529
763
|
children: titleText
|
|
530
764
|
}
|
|
531
765
|
),
|
|
532
|
-
!!onClose && /* @__PURE__ */ (0,
|
|
766
|
+
!!onClose && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Tooltip, { tooltip: translation.close, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { color: "neutral", size: "small", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "w-full h-full" }) }) })
|
|
533
767
|
] });
|
|
534
|
-
return /* @__PURE__ */ (0,
|
|
768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "col", children: [
|
|
535
769
|
hasTitleRow && titleRow,
|
|
536
|
-
description ?? (descriptionText && /* @__PURE__ */ (0,
|
|
770
|
+
description ?? (descriptionText && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "textstyle-description", children: descriptionText }))
|
|
537
771
|
] });
|
|
538
772
|
};
|
|
539
773
|
var Modal = ({
|
|
@@ -544,8 +778,8 @@ var Modal = ({
|
|
|
544
778
|
backgroundClassName,
|
|
545
779
|
headerProps
|
|
546
780
|
}) => {
|
|
547
|
-
const ref = (0,
|
|
548
|
-
(0,
|
|
781
|
+
const ref = (0, import_react9.useRef)(null);
|
|
782
|
+
(0, import_react9.useEffect)(() => {
|
|
549
783
|
if (!isOpen) return;
|
|
550
784
|
const modal = ref.current;
|
|
551
785
|
if (!modal) {
|
|
@@ -582,25 +816,25 @@ var Modal = ({
|
|
|
582
816
|
overlayStack = overlayStack.filter((m) => m !== modal);
|
|
583
817
|
};
|
|
584
818
|
}, [isOpen, onClose]);
|
|
585
|
-
return /* @__PURE__ */ (0,
|
|
819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
586
820
|
Overlay,
|
|
587
821
|
{
|
|
588
822
|
isOpen,
|
|
589
823
|
onBackgroundClick: onClose,
|
|
590
824
|
backgroundClassName,
|
|
591
|
-
children: /* @__PURE__ */ (0,
|
|
825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
592
826
|
"div",
|
|
593
827
|
{
|
|
594
828
|
ref,
|
|
595
829
|
tabIndex: -1,
|
|
596
|
-
className: (0,
|
|
830
|
+
className: (0, import_clsx8.default)(
|
|
597
831
|
"fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 col p-4 bg-overlay-background text-overlay-text rounded-xl shadow-xl",
|
|
598
832
|
className
|
|
599
833
|
),
|
|
600
834
|
role: "dialog",
|
|
601
835
|
"aria-modal": true,
|
|
602
836
|
children: [
|
|
603
|
-
/* @__PURE__ */ (0,
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(OverlayHeader, { ...headerProps, onClose }),
|
|
604
838
|
children
|
|
605
839
|
]
|
|
606
840
|
}
|
|
@@ -610,7 +844,7 @@ var Modal = ({
|
|
|
610
844
|
};
|
|
611
845
|
|
|
612
846
|
// src/components/modals/LanguageModal.tsx
|
|
613
|
-
var
|
|
847
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
614
848
|
var defaultLanguageModalTranslation = {
|
|
615
849
|
en: {
|
|
616
850
|
title: "Language",
|
|
@@ -633,7 +867,7 @@ var LanguageModal = ({
|
|
|
633
867
|
}) => {
|
|
634
868
|
const { language, setLanguage } = useLanguage();
|
|
635
869
|
const translation = useTranslation(defaultLanguageModalTranslation, overwriteTranslation);
|
|
636
|
-
return /* @__PURE__ */ (0,
|
|
870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
637
871
|
Modal,
|
|
638
872
|
{
|
|
639
873
|
headerProps: {
|
|
@@ -643,8 +877,8 @@ var LanguageModal = ({
|
|
|
643
877
|
},
|
|
644
878
|
onClose,
|
|
645
879
|
...modalProps,
|
|
646
|
-
children: /* @__PURE__ */ (0,
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
880
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-64", children: [
|
|
881
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
648
882
|
Select,
|
|
649
883
|
{
|
|
650
884
|
className: "mt-2",
|
|
@@ -653,7 +887,7 @@ var LanguageModal = ({
|
|
|
653
887
|
onChange: (language2) => setLanguage(language2)
|
|
654
888
|
}
|
|
655
889
|
),
|
|
656
|
-
/* @__PURE__ */ (0,
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "row mt-3 gap-x-4 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation.done }) })
|
|
657
891
|
] })
|
|
658
892
|
}
|
|
659
893
|
);
|