@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,18 +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
|
+
}
|
|
105
145
|
|
|
106
146
|
// src/util/noop.ts
|
|
107
147
|
var noop = () => void 0;
|
|
108
148
|
|
|
109
149
|
// src/components/user-action/Input.tsx
|
|
110
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
|
+
};
|
|
111
211
|
var FormInput = (0, import_react4.forwardRef)(function FormInput2({
|
|
112
212
|
id,
|
|
113
213
|
labelText,
|
|
@@ -144,102 +244,9 @@ var FormInput = (0, import_react4.forwardRef)(function FormInput2({
|
|
|
144
244
|
] });
|
|
145
245
|
});
|
|
146
246
|
|
|
147
|
-
// src/components/user-action/Select.tsx
|
|
148
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
149
|
-
var Select = ({
|
|
150
|
-
value,
|
|
151
|
-
label,
|
|
152
|
-
options,
|
|
153
|
-
onChange,
|
|
154
|
-
isHidingCurrentValue = true,
|
|
155
|
-
hintText = "",
|
|
156
|
-
showDisabledOptions = true,
|
|
157
|
-
isDisabled,
|
|
158
|
-
className,
|
|
159
|
-
textColor = "text-menu-text",
|
|
160
|
-
additionalItems,
|
|
161
|
-
selectedDisplayOverwrite
|
|
162
|
-
}) => {
|
|
163
|
-
let filteredOptions = isHidingCurrentValue ? options.filter((option) => option.value !== value) : options;
|
|
164
|
-
if (!showDisabledOptions) {
|
|
165
|
-
filteredOptions = filteredOptions.filter((value2) => !value2.disabled);
|
|
166
|
-
}
|
|
167
|
-
const selectedOption = options.find((option) => option.value === value);
|
|
168
|
-
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
169
|
-
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");
|
|
170
|
-
}
|
|
171
|
-
const borderColor = "border-menu-border";
|
|
172
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx3.default)(className), children: [
|
|
173
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx3.default)("mb-1", label.className) }),
|
|
174
|
-
/* @__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: [
|
|
175
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
176
|
-
import_react5.Menu.Button,
|
|
177
|
-
{
|
|
178
|
-
className: (0, import_clsx3.default)(
|
|
179
|
-
"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",
|
|
180
|
-
textColor,
|
|
181
|
-
borderColor,
|
|
182
|
-
{
|
|
183
|
-
"rounded-b-lg": !open,
|
|
184
|
-
"hover:border-primary": !isDisabled,
|
|
185
|
-
"bg-disabled-background cursor-not-allowed text-disabled": isDisabled
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
disabled: isDisabled,
|
|
189
|
-
children: [
|
|
190
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: selectedDisplayOverwrite ?? selectedOption?.label ?? hintText }),
|
|
191
|
-
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronDown, {})
|
|
192
|
-
]
|
|
193
|
-
}
|
|
194
|
-
),
|
|
195
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
196
|
-
import_react5.Menu.Items,
|
|
197
|
-
{
|
|
198
|
-
className: "absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto",
|
|
199
|
-
children: [
|
|
200
|
-
(additionalItems ?? []).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
201
|
-
"div",
|
|
202
|
-
{
|
|
203
|
-
className: (0, import_clsx3.default)(borderColor, "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0", {
|
|
204
|
-
"border-b-0 rounded-b-lg": filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1
|
|
205
|
-
}),
|
|
206
|
-
children: item
|
|
207
|
-
},
|
|
208
|
-
`additionalItems${index}`
|
|
209
|
-
)),
|
|
210
|
-
filteredOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Menu.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
211
|
-
"div",
|
|
212
|
-
{
|
|
213
|
-
className: (0, import_clsx3.default)(
|
|
214
|
-
"px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
|
|
215
|
-
option.className,
|
|
216
|
-
borderColor,
|
|
217
|
-
{
|
|
218
|
-
"brightness-90": option.value === value,
|
|
219
|
-
"brightness-95": index % 2 === 1,
|
|
220
|
-
"text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
|
|
221
|
-
"bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
|
|
222
|
-
"rounded-b-lg": index === filteredOptions.length - 1
|
|
223
|
-
}
|
|
224
|
-
),
|
|
225
|
-
onClick: () => {
|
|
226
|
-
if (!option.disabled) {
|
|
227
|
-
onChange(option.value);
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
children: option.label
|
|
231
|
-
}
|
|
232
|
-
) }, `item${index}`))
|
|
233
|
-
]
|
|
234
|
-
}
|
|
235
|
-
)
|
|
236
|
-
] }) })
|
|
237
|
-
] });
|
|
238
|
-
};
|
|
239
|
-
|
|
240
247
|
// src/components/user-action/Button.tsx
|
|
241
|
-
var
|
|
242
|
-
var
|
|
248
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
249
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
243
250
|
var paddingMapping = {
|
|
244
251
|
small: "btn-sm",
|
|
245
252
|
medium: "btn-md",
|
|
@@ -283,25 +290,25 @@ var SolidButton = ({
|
|
|
283
290
|
negative: "text-button-solid-negative-icon",
|
|
284
291
|
neutral: "text-button-solid-neutral-icon"
|
|
285
292
|
}[color];
|
|
286
|
-
return /* @__PURE__ */ (0,
|
|
293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
287
294
|
"button",
|
|
288
295
|
{
|
|
289
296
|
onClick: disabled ? void 0 : onClick,
|
|
290
297
|
disabled: disabled || onClick === void 0,
|
|
291
|
-
className: (0,
|
|
298
|
+
className: (0, import_clsx3.default)(
|
|
292
299
|
{
|
|
293
300
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
294
|
-
[(0,
|
|
301
|
+
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
295
302
|
},
|
|
296
303
|
ButtonUtil.paddingMapping[size],
|
|
297
304
|
className
|
|
298
305
|
),
|
|
299
306
|
...restProps,
|
|
300
307
|
children: [
|
|
301
|
-
startIcon && /* @__PURE__ */ (0,
|
|
308
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
302
309
|
"span",
|
|
303
310
|
{
|
|
304
|
-
className: (0,
|
|
311
|
+
className: (0, import_clsx3.default)({
|
|
305
312
|
[iconColorClasses]: !disabled,
|
|
306
313
|
[`text-disabled-icon`]: disabled
|
|
307
314
|
}),
|
|
@@ -309,10 +316,10 @@ var SolidButton = ({
|
|
|
309
316
|
}
|
|
310
317
|
),
|
|
311
318
|
children,
|
|
312
|
-
endIcon && /* @__PURE__ */ (0,
|
|
319
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
313
320
|
"span",
|
|
314
321
|
{
|
|
315
|
-
className: (0,
|
|
322
|
+
className: (0, import_clsx3.default)({
|
|
316
323
|
[iconColorClasses]: !disabled,
|
|
317
324
|
[`text-disabled-icon`]: disabled
|
|
318
325
|
}),
|
|
@@ -341,15 +348,15 @@ var IconButton = ({
|
|
|
341
348
|
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
342
349
|
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
343
350
|
}[color];
|
|
344
|
-
return /* @__PURE__ */ (0,
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
345
352
|
"button",
|
|
346
353
|
{
|
|
347
354
|
onClick: disabled ? void 0 : onClick,
|
|
348
355
|
disabled: disabled || onClick === void 0,
|
|
349
|
-
className: (0,
|
|
356
|
+
className: (0, import_clsx3.default)(
|
|
350
357
|
{
|
|
351
358
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
352
|
-
[(0,
|
|
359
|
+
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
353
360
|
},
|
|
354
361
|
ButtonUtil.iconPaddingMapping[size],
|
|
355
362
|
className
|
|
@@ -360,21 +367,245 @@ var IconButton = ({
|
|
|
360
367
|
);
|
|
361
368
|
};
|
|
362
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
|
+
|
|
363
594
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
364
|
-
var
|
|
595
|
+
var import_react9 = require("react");
|
|
365
596
|
var import_react_dom = __toESM(require("react-dom"));
|
|
366
|
-
var
|
|
597
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
367
598
|
|
|
368
599
|
// src/hooks/useHoverState.ts
|
|
369
|
-
var
|
|
600
|
+
var import_react8 = require("react");
|
|
370
601
|
var defaultUseHoverStateProps = {
|
|
371
602
|
closingDelay: 200,
|
|
372
603
|
isDisabled: false
|
|
373
604
|
};
|
|
374
605
|
var useHoverState = (props = void 0) => {
|
|
375
606
|
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
376
|
-
const [isHovered, setIsHovered] = (0,
|
|
377
|
-
const [timer, setTimer] = (0,
|
|
607
|
+
const [isHovered, setIsHovered] = (0, import_react8.useState)(false);
|
|
608
|
+
const [timer, setTimer] = (0, import_react8.useState)();
|
|
378
609
|
const onMouseEnter = () => {
|
|
379
610
|
if (isDisabled) {
|
|
380
611
|
return;
|
|
@@ -390,14 +621,14 @@ var useHoverState = (props = void 0) => {
|
|
|
390
621
|
setIsHovered(false);
|
|
391
622
|
}, closingDelay));
|
|
392
623
|
};
|
|
393
|
-
(0,
|
|
624
|
+
(0, import_react8.useEffect)(() => {
|
|
394
625
|
if (timer) {
|
|
395
626
|
return () => {
|
|
396
627
|
clearTimeout(timer);
|
|
397
628
|
};
|
|
398
629
|
}
|
|
399
630
|
});
|
|
400
|
-
(0,
|
|
631
|
+
(0, import_react8.useEffect)(() => {
|
|
401
632
|
if (timer) {
|
|
402
633
|
clearTimeout(timer);
|
|
403
634
|
}
|
|
@@ -410,8 +641,8 @@ var useHoverState = (props = void 0) => {
|
|
|
410
641
|
};
|
|
411
642
|
|
|
412
643
|
// src/components/user-action/Tooltip.tsx
|
|
413
|
-
var
|
|
414
|
-
var
|
|
644
|
+
var import_clsx7 = require("clsx");
|
|
645
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
415
646
|
var Tooltip = ({
|
|
416
647
|
tooltip,
|
|
417
648
|
children,
|
|
@@ -441,30 +672,30 @@ var Tooltip = ({
|
|
|
441
672
|
left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
|
|
442
673
|
right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
|
|
443
674
|
};
|
|
444
|
-
return /* @__PURE__ */ (0,
|
|
675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
445
676
|
"div",
|
|
446
677
|
{
|
|
447
|
-
className: (0,
|
|
678
|
+
className: (0, import_clsx7.clsx)("relative inline-block", containerClassName),
|
|
448
679
|
...handlers,
|
|
449
680
|
children: [
|
|
450
681
|
children,
|
|
451
|
-
isHovered && /* @__PURE__ */ (0,
|
|
682
|
+
isHovered && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
452
683
|
"div",
|
|
453
684
|
{
|
|
454
|
-
className: (0,
|
|
685
|
+
className: (0, import_clsx7.clsx)(
|
|
455
686
|
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
456
|
-
animate-tooltip-fade-in shadow-
|
|
687
|
+
animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
|
|
457
688
|
positionClasses[position],
|
|
458
689
|
tooltipClassName
|
|
459
690
|
),
|
|
460
691
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
461
692
|
children: [
|
|
462
693
|
tooltip,
|
|
463
|
-
/* @__PURE__ */ (0,
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
464
695
|
"div",
|
|
465
696
|
{
|
|
466
|
-
className: (0,
|
|
467
|
-
style: { ...triangleStyle[position], zIndex }
|
|
697
|
+
className: (0, import_clsx7.clsx)(`absolute w-0 h-0`, triangleClasses[position]),
|
|
698
|
+
style: { ...triangleStyle[position], zIndex: zIndex + 1 }
|
|
468
699
|
}
|
|
469
700
|
)
|
|
470
701
|
]
|
|
@@ -476,25 +707,25 @@ var Tooltip = ({
|
|
|
476
707
|
};
|
|
477
708
|
|
|
478
709
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
479
|
-
var
|
|
480
|
-
var
|
|
710
|
+
var import_lucide_react4 = require("lucide-react");
|
|
711
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
481
712
|
var Overlay = ({
|
|
482
713
|
children,
|
|
483
714
|
isOpen,
|
|
484
715
|
onBackgroundClick,
|
|
485
716
|
backgroundClassName
|
|
486
717
|
}) => {
|
|
487
|
-
const [root, setRoot] = (0,
|
|
488
|
-
(0,
|
|
718
|
+
const [root, setRoot] = (0, import_react9.useState)();
|
|
719
|
+
(0, import_react9.useEffect)(() => {
|
|
489
720
|
setRoot(document.body);
|
|
490
721
|
}, []);
|
|
491
722
|
if (!root || !isOpen) return null;
|
|
492
723
|
return import_react_dom.default.createPortal(
|
|
493
|
-
/* @__PURE__ */ (0,
|
|
494
|
-
/* @__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)(
|
|
495
726
|
"div",
|
|
496
727
|
{
|
|
497
|
-
className: (0,
|
|
728
|
+
className: (0, import_clsx8.default)("fixed inset-0 h-screen w-screen bg-black/30", backgroundClassName),
|
|
498
729
|
onClick: onBackgroundClick
|
|
499
730
|
}
|
|
500
731
|
),
|
|
@@ -522,21 +753,21 @@ var OverlayHeader = ({
|
|
|
522
753
|
}) => {
|
|
523
754
|
const translation = useTranslation(defaultModalHeaderTranslation, overwriteTranslation);
|
|
524
755
|
const hasTitleRow = !!title || !!titleText || !!onClose;
|
|
525
|
-
const titleRow = /* @__PURE__ */ (0,
|
|
526
|
-
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)(
|
|
527
758
|
"h2",
|
|
528
759
|
{
|
|
529
|
-
className: (0,
|
|
760
|
+
className: (0, import_clsx8.default)("textstyle-title-lg", {
|
|
530
761
|
"mb-1": description || descriptionText
|
|
531
762
|
}),
|
|
532
763
|
children: titleText
|
|
533
764
|
}
|
|
534
765
|
),
|
|
535
|
-
!!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" }) }) })
|
|
536
767
|
] });
|
|
537
|
-
return /* @__PURE__ */ (0,
|
|
768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "col", children: [
|
|
538
769
|
hasTitleRow && titleRow,
|
|
539
|
-
description ?? (descriptionText && /* @__PURE__ */ (0,
|
|
770
|
+
description ?? (descriptionText && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "textstyle-description", children: descriptionText }))
|
|
540
771
|
] });
|
|
541
772
|
};
|
|
542
773
|
var Modal = ({
|
|
@@ -547,8 +778,8 @@ var Modal = ({
|
|
|
547
778
|
backgroundClassName,
|
|
548
779
|
headerProps
|
|
549
780
|
}) => {
|
|
550
|
-
const ref = (0,
|
|
551
|
-
(0,
|
|
781
|
+
const ref = (0, import_react9.useRef)(null);
|
|
782
|
+
(0, import_react9.useEffect)(() => {
|
|
552
783
|
if (!isOpen) return;
|
|
553
784
|
const modal = ref.current;
|
|
554
785
|
if (!modal) {
|
|
@@ -585,25 +816,25 @@ var Modal = ({
|
|
|
585
816
|
overlayStack = overlayStack.filter((m) => m !== modal);
|
|
586
817
|
};
|
|
587
818
|
}, [isOpen, onClose]);
|
|
588
|
-
return /* @__PURE__ */ (0,
|
|
819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
589
820
|
Overlay,
|
|
590
821
|
{
|
|
591
822
|
isOpen,
|
|
592
823
|
onBackgroundClick: onClose,
|
|
593
824
|
backgroundClassName,
|
|
594
|
-
children: /* @__PURE__ */ (0,
|
|
825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
595
826
|
"div",
|
|
596
827
|
{
|
|
597
828
|
ref,
|
|
598
829
|
tabIndex: -1,
|
|
599
|
-
className: (0,
|
|
830
|
+
className: (0, import_clsx8.default)(
|
|
600
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",
|
|
601
832
|
className
|
|
602
833
|
),
|
|
603
834
|
role: "dialog",
|
|
604
835
|
"aria-modal": true,
|
|
605
836
|
children: [
|
|
606
|
-
/* @__PURE__ */ (0,
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(OverlayHeader, { ...headerProps, onClose }),
|
|
607
838
|
children
|
|
608
839
|
]
|
|
609
840
|
}
|
|
@@ -613,8 +844,8 @@ var Modal = ({
|
|
|
613
844
|
};
|
|
614
845
|
|
|
615
846
|
// src/theming/useTheme.tsx
|
|
616
|
-
var
|
|
617
|
-
var
|
|
847
|
+
var import_react10 = require("react");
|
|
848
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
618
849
|
var themes = ["light", "dark"];
|
|
619
850
|
var defaultThemeTypeTranslation = {
|
|
620
851
|
en: {
|
|
@@ -630,14 +861,14 @@ var ThemeUtil = {
|
|
|
630
861
|
themes,
|
|
631
862
|
translation: defaultThemeTypeTranslation
|
|
632
863
|
};
|
|
633
|
-
var ThemeContext = (0,
|
|
864
|
+
var ThemeContext = (0, import_react10.createContext)({
|
|
634
865
|
theme: "light",
|
|
635
866
|
setTheme: noop
|
|
636
867
|
});
|
|
637
|
-
var useTheme = () => (0,
|
|
868
|
+
var useTheme = () => (0, import_react10.useContext)(ThemeContext);
|
|
638
869
|
|
|
639
870
|
// src/components/modals/ThemeModal.tsx
|
|
640
|
-
var
|
|
871
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
641
872
|
var defaultConfirmDialogTranslation = {
|
|
642
873
|
en: {
|
|
643
874
|
title: "Theme",
|
|
@@ -660,7 +891,7 @@ var ThemeModal = ({
|
|
|
660
891
|
}) => {
|
|
661
892
|
const { theme, setTheme } = useTheme();
|
|
662
893
|
const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation);
|
|
663
|
-
return /* @__PURE__ */ (0,
|
|
894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
664
895
|
Modal,
|
|
665
896
|
{
|
|
666
897
|
headerProps: {
|
|
@@ -670,8 +901,8 @@ var ThemeModal = ({
|
|
|
670
901
|
},
|
|
671
902
|
onClose,
|
|
672
903
|
...modalProps,
|
|
673
|
-
children: /* @__PURE__ */ (0,
|
|
674
|
-
/* @__PURE__ */ (0,
|
|
904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w-64", children: [
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
675
906
|
Select,
|
|
676
907
|
{
|
|
677
908
|
className: "mt-2",
|
|
@@ -680,7 +911,7 @@ var ThemeModal = ({
|
|
|
680
911
|
onChange: (theme2) => setTheme(theme2)
|
|
681
912
|
}
|
|
682
913
|
),
|
|
683
|
-
/* @__PURE__ */ (0,
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "row mt-3 gap-x-4 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation.done }) })
|
|
684
915
|
] })
|
|
685
916
|
}
|
|
686
917
|
);
|