@helpwave/hightide 0.1.7 → 0.1.9
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.d.mts +3 -4
- package/dist/components/date/DatePicker.d.ts +3 -4
- package/dist/components/date/DatePicker.js +135 -33
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +135 -33
- 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/TimeDisplay.d.mts +5 -19
- package/dist/components/date/TimeDisplay.d.ts +5 -19
- package/dist/components/date/TimeDisplay.js +121 -37
- package/dist/components/date/TimeDisplay.js.map +1 -1
- package/dist/components/date/TimeDisplay.mjs +121 -37
- package/dist/components/date/TimeDisplay.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.d.mts +2 -5
- package/dist/components/dialogs/ConfirmDialog.d.ts +2 -5
- package/dist/components/dialogs/ConfirmDialog.js +157 -25
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +157 -25
- 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.d.mts +2 -3
- package/dist/components/layout-and-navigation/Overlay.d.ts +2 -3
- package/dist/components/layout-and-navigation/Overlay.js +152 -12
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +152 -12
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.d.mts +2 -3
- package/dist/components/layout-and-navigation/Pagination.d.ts +2 -3
- package/dist/components/layout-and-navigation/Pagination.js +145 -13
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +145 -13
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.d.mts +10 -8
- package/dist/components/layout-and-navigation/SearchableList.d.ts +10 -8
- package/dist/components/layout-and-navigation/SearchableList.js +261 -30
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +261 -30
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.d.mts +2 -5
- package/dist/components/layout-and-navigation/StepperBar.d.ts +2 -5
- package/dist/components/layout-and-navigation/StepperBar.js +149 -19
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +149 -19
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Table.js +146 -14
- package/dist/components/layout-and-navigation/Table.js.map +1 -1
- package/dist/components/layout-and-navigation/Table.mjs +146 -14
- package/dist/components/layout-and-navigation/Table.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.d.mts +3 -4
- package/dist/components/layout-and-navigation/TextImage.d.ts +3 -4
- package/dist/components/layout-and-navigation/TextImage.js +153 -19
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +153 -19
- package/dist/components/layout-and-navigation/TextImage.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/ErrorComponent.js +48 -8
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +48 -8
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.d.mts +1 -0
- package/dist/components/loading-states/LoadingAndErrorComponent.d.ts +1 -0
- package/dist/components/loading-states/LoadingAndErrorComponent.js +147 -15
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +147 -15
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.d.mts +2 -3
- package/dist/components/loading-states/LoadingAnimation.d.ts +2 -3
- package/dist/components/loading-states/LoadingAnimation.js +145 -13
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +145 -13
- package/dist/components/loading-states/LoadingAnimation.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.d.mts +2 -5
- package/dist/components/modals/ConfirmModal.d.ts +2 -5
- package/dist/components/modals/ConfirmModal.js +158 -28
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +158 -28
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.d.mts +2 -7
- package/dist/components/modals/DiscardChangesModal.d.ts +2 -7
- package/dist/components/modals/DiscardChangesModal.js +162 -48
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +162 -48
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.d.mts +1 -0
- package/dist/components/modals/InputModal.d.ts +1 -0
- package/dist/components/modals/InputModal.js +158 -28
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +158 -28
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.d.mts +3 -2
- package/dist/components/modals/LanguageModal.d.ts +3 -2
- package/dist/components/modals/LanguageModal.js +538 -166
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +537 -165
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.d.mts +5 -5
- package/dist/components/modals/ThemeModal.d.ts +5 -5
- package/dist/components/modals/ThemeModal.js +547 -176
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +544 -173
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.d.mts +3 -5
- package/dist/components/properties/CheckboxProperty.d.ts +3 -5
- package/dist/components/properties/CheckboxProperty.js +148 -26
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +148 -26
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.d.mts +1 -0
- package/dist/components/properties/DateProperty.d.ts +1 -0
- package/dist/components/properties/DateProperty.js +146 -14
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +146 -14
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +5 -5
- package/dist/components/properties/MultiSelectProperty.d.ts +5 -5
- package/dist/components/properties/MultiSelectProperty.js +626 -456
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +622 -452
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.d.mts +1 -0
- package/dist/components/properties/NumberProperty.d.ts +1 -0
- package/dist/components/properties/NumberProperty.js +148 -16
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +148 -16
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.d.mts +2 -3
- package/dist/components/properties/PropertyBase.d.ts +2 -3
- package/dist/components/properties/PropertyBase.js +146 -14
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +146 -14
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +5 -6
- package/dist/components/properties/SelectProperty.d.ts +5 -6
- package/dist/components/properties/SelectProperty.js +542 -279
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +542 -279
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.d.mts +2 -1
- package/dist/components/properties/TextProperty.d.ts +2 -1
- package/dist/components/properties/TextProperty.js +150 -18
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +150 -18
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.d.mts +4 -20
- package/dist/components/user-action/DateAndTimePicker.d.ts +4 -20
- package/dist/components/user-action/DateAndTimePicker.js +233 -71
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +233 -71
- 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 +13 -23
- package/dist/components/user-action/MultiSelect.d.ts +13 -23
- package/dist/components/user-action/MultiSelect.js +632 -325
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +629 -323
- 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 +447 -113
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +442 -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 +224 -207
- package/dist/css/uncompiled/globals.css +138 -74
- 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 +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +882 -758
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +836 -717
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +54 -0
- package/dist/localization/defaults/form.d.ts +54 -0
- package/dist/localization/defaults/form.js +127 -0
- package/dist/localization/defaults/form.js.map +1 -0
- package/dist/localization/defaults/form.mjs +103 -0
- package/dist/localization/defaults/form.mjs.map +1 -0
- package/dist/localization/defaults/time.d.mts +39 -0
- package/dist/localization/defaults/time.d.ts +39 -0
- package/dist/localization/defaults/time.js +101 -0
- package/dist/localization/defaults/time.js.map +1 -0
- package/dist/localization/defaults/time.mjs +76 -0
- package/dist/localization/defaults/time.mjs.map +1 -0
- package/dist/localization/useTranslation.d.mts +30 -6
- package/dist/localization/useTranslation.d.ts +30 -6
- package/dist/localization/useTranslation.js +46 -6
- package/dist/localization/useTranslation.js.map +1 -1
- package/dist/localization/useTranslation.mjs +46 -6
- package/dist/localization/useTranslation.mjs.map +1 -1
- package/dist/theming/useTheme.d.mts +4 -2
- package/dist/theming/useTheme.d.ts +4 -2
- package/dist/theming/useTheme.js +10 -2
- package/dist/theming/useTheme.js.map +1 -1
- package/dist/theming/useTheme.mjs +10 -2
- package/dist/theming/useTheme.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
|
@@ -26,22 +26,61 @@ var LanguageContext = createContext({
|
|
|
26
26
|
var useLanguage = () => useContext(LanguageContext);
|
|
27
27
|
|
|
28
28
|
// src/localization/useTranslation.ts
|
|
29
|
-
var useTranslation = (
|
|
30
|
-
const { language: languageProp, translation: overwrite } =
|
|
29
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
30
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
31
31
|
const { language: inferredLanguage } = useLanguage();
|
|
32
32
|
const usedLanguage = languageProp ?? inferredLanguage;
|
|
33
|
-
|
|
34
|
-
if (overwrite
|
|
35
|
-
|
|
33
|
+
const usedTranslations = [...translations];
|
|
34
|
+
if (overwrite) {
|
|
35
|
+
usedTranslations.push(overwrite);
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return (key, options) => {
|
|
38
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
39
|
+
try {
|
|
40
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
41
|
+
const translation = translations[i];
|
|
42
|
+
const localizedTranslation = translation[usedLanguage];
|
|
43
|
+
if (!localizedTranslation) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const value = localizedTranslation[key];
|
|
47
|
+
if (!value) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
let forProcessing;
|
|
51
|
+
if (typeof value !== "string") {
|
|
52
|
+
if (count <= 0 && value?.zero) {
|
|
53
|
+
forProcessing = value.zero;
|
|
54
|
+
} else if (count === 1 && value?.one) {
|
|
55
|
+
forProcessing = value.one;
|
|
56
|
+
} else if (count === 2 && value?.two) {
|
|
57
|
+
forProcessing = value.two;
|
|
58
|
+
} else if (count <= 10 && value?.few) {
|
|
59
|
+
forProcessing = value.few;
|
|
60
|
+
} else if (count > 10 && value?.many) {
|
|
61
|
+
forProcessing = value.many;
|
|
62
|
+
} else {
|
|
63
|
+
forProcessing = value.other;
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
forProcessing = value;
|
|
67
|
+
}
|
|
68
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
69
|
+
return replacements[placeholder] ?? `{{${placeholder}}}`;
|
|
70
|
+
});
|
|
71
|
+
return forProcessing;
|
|
72
|
+
}
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.error(e);
|
|
75
|
+
}
|
|
76
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
77
|
+
};
|
|
38
78
|
};
|
|
39
79
|
|
|
40
80
|
// src/components/user-action/Select.tsx
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import
|
|
44
|
-
import clsx3 from "clsx";
|
|
81
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
82
|
+
import { useEffect as useEffect7, useRef as useRef2, useState as useState6 } from "react";
|
|
83
|
+
import clsx6 from "clsx";
|
|
45
84
|
|
|
46
85
|
// src/components/user-action/Label.tsx
|
|
47
86
|
import clsx from "clsx";
|
|
@@ -61,15 +100,119 @@ var Label = ({
|
|
|
61
100
|
return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
62
101
|
};
|
|
63
102
|
|
|
103
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
104
|
+
import { Search } from "lucide-react";
|
|
105
|
+
import clsx4 from "clsx";
|
|
106
|
+
|
|
64
107
|
// src/components/user-action/Input.tsx
|
|
65
108
|
import { forwardRef, useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
66
109
|
import clsx2 from "clsx";
|
|
67
110
|
|
|
68
111
|
// src/hooks/useSaveDelay.ts
|
|
69
112
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
113
|
+
function useSaveDelay(setNotificationStatus, delay) {
|
|
114
|
+
const [updateTimer, setUpdateTimer] = useState3(void 0);
|
|
115
|
+
const [notificationTimer, setNotificationTimer] = useState3(void 0);
|
|
116
|
+
const restartTimer = (onSave) => {
|
|
117
|
+
clearTimeout(updateTimer);
|
|
118
|
+
setUpdateTimer(setTimeout(() => {
|
|
119
|
+
onSave();
|
|
120
|
+
setNotificationStatus(true);
|
|
121
|
+
clearTimeout(notificationTimer);
|
|
122
|
+
setNotificationTimer(setTimeout(() => {
|
|
123
|
+
setNotificationStatus(false);
|
|
124
|
+
clearTimeout(notificationTimer);
|
|
125
|
+
}, delay));
|
|
126
|
+
clearTimeout(updateTimer);
|
|
127
|
+
}, delay));
|
|
128
|
+
};
|
|
129
|
+
const clearUpdateTimer = (hasSaved = true) => {
|
|
130
|
+
clearTimeout(updateTimer);
|
|
131
|
+
if (hasSaved) {
|
|
132
|
+
setNotificationStatus(true);
|
|
133
|
+
clearTimeout(notificationTimer);
|
|
134
|
+
setNotificationTimer(setTimeout(() => {
|
|
135
|
+
setNotificationStatus(false);
|
|
136
|
+
clearTimeout(notificationTimer);
|
|
137
|
+
}, delay));
|
|
138
|
+
} else {
|
|
139
|
+
setNotificationStatus(false);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
useEffect3(() => {
|
|
143
|
+
return () => {
|
|
144
|
+
clearTimeout(updateTimer);
|
|
145
|
+
clearTimeout(notificationTimer);
|
|
146
|
+
};
|
|
147
|
+
}, []);
|
|
148
|
+
return { restartTimer, clearUpdateTimer };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// src/util/noop.ts
|
|
152
|
+
var noop = () => void 0;
|
|
70
153
|
|
|
71
154
|
// src/components/user-action/Input.tsx
|
|
72
155
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
156
|
+
var Input = ({
|
|
157
|
+
id,
|
|
158
|
+
type = "text",
|
|
159
|
+
value,
|
|
160
|
+
label,
|
|
161
|
+
onChange = noop,
|
|
162
|
+
onChangeText = noop,
|
|
163
|
+
onEditCompleted,
|
|
164
|
+
className = "",
|
|
165
|
+
expanded = true,
|
|
166
|
+
autoFocus,
|
|
167
|
+
onBlur,
|
|
168
|
+
containerClassName,
|
|
169
|
+
...restProps
|
|
170
|
+
}) => {
|
|
171
|
+
const {
|
|
172
|
+
restartTimer,
|
|
173
|
+
clearUpdateTimer
|
|
174
|
+
} = useSaveDelay(() => void 0, 3e3);
|
|
175
|
+
const ref = useRef(null);
|
|
176
|
+
useEffect4(() => {
|
|
177
|
+
if (autoFocus) {
|
|
178
|
+
ref.current?.focus();
|
|
179
|
+
}
|
|
180
|
+
}, [autoFocus]);
|
|
181
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
|
|
182
|
+
label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
|
|
183
|
+
/* @__PURE__ */ jsx3(
|
|
184
|
+
"input",
|
|
185
|
+
{
|
|
186
|
+
ref,
|
|
187
|
+
value,
|
|
188
|
+
id,
|
|
189
|
+
type,
|
|
190
|
+
className,
|
|
191
|
+
onBlur: (event) => {
|
|
192
|
+
if (onBlur) {
|
|
193
|
+
onBlur(event);
|
|
194
|
+
}
|
|
195
|
+
if (onEditCompleted) {
|
|
196
|
+
onEditCompleted(event.target.value);
|
|
197
|
+
clearUpdateTimer();
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
onChange: (e) => {
|
|
201
|
+
const value2 = e.target.value;
|
|
202
|
+
if (onEditCompleted) {
|
|
203
|
+
restartTimer(() => {
|
|
204
|
+
onEditCompleted(value2);
|
|
205
|
+
clearUpdateTimer();
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
onChange(e);
|
|
209
|
+
onChangeText(value2);
|
|
210
|
+
},
|
|
211
|
+
...restProps
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] });
|
|
215
|
+
};
|
|
73
216
|
var FormInput = forwardRef(function FormInput2({
|
|
74
217
|
id,
|
|
75
218
|
labelText,
|
|
@@ -106,102 +249,9 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
106
249
|
] });
|
|
107
250
|
});
|
|
108
251
|
|
|
109
|
-
// src/components/user-action/Select.tsx
|
|
110
|
-
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
111
|
-
var Select = ({
|
|
112
|
-
value,
|
|
113
|
-
label,
|
|
114
|
-
options,
|
|
115
|
-
onChange,
|
|
116
|
-
isHidingCurrentValue = true,
|
|
117
|
-
hintText = "",
|
|
118
|
-
showDisabledOptions = true,
|
|
119
|
-
isDisabled,
|
|
120
|
-
className,
|
|
121
|
-
textColor = "text-menu-text",
|
|
122
|
-
additionalItems,
|
|
123
|
-
selectedDisplayOverwrite
|
|
124
|
-
}) => {
|
|
125
|
-
let filteredOptions = isHidingCurrentValue ? options.filter((option) => option.value !== value) : options;
|
|
126
|
-
if (!showDisabledOptions) {
|
|
127
|
-
filteredOptions = filteredOptions.filter((value2) => !value2.disabled);
|
|
128
|
-
}
|
|
129
|
-
const selectedOption = options.find((option) => option.value === value);
|
|
130
|
-
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
131
|
-
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");
|
|
132
|
-
}
|
|
133
|
-
const borderColor = "border-menu-border";
|
|
134
|
-
return /* @__PURE__ */ jsxs2("div", { className: clsx3(className), children: [
|
|
135
|
-
label && /* @__PURE__ */ jsx4(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx3("mb-1", label.className) }),
|
|
136
|
-
/* @__PURE__ */ jsx4(Menu, { as: "div", className: "relative text-menu-text", children: ({ open }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
137
|
-
/* @__PURE__ */ jsxs2(
|
|
138
|
-
Menu.Button,
|
|
139
|
-
{
|
|
140
|
-
className: clsx3(
|
|
141
|
-
"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",
|
|
142
|
-
textColor,
|
|
143
|
-
borderColor,
|
|
144
|
-
{
|
|
145
|
-
"rounded-b-lg": !open,
|
|
146
|
-
"hover:border-primary": !isDisabled,
|
|
147
|
-
"bg-disabled-background cursor-not-allowed text-disabled": isDisabled
|
|
148
|
-
}
|
|
149
|
-
),
|
|
150
|
-
disabled: isDisabled,
|
|
151
|
-
children: [
|
|
152
|
-
/* @__PURE__ */ jsx4("span", { children: selectedDisplayOverwrite ?? selectedOption?.label ?? hintText }),
|
|
153
|
-
open ? /* @__PURE__ */ jsx4(ChevronUp, {}) : /* @__PURE__ */ jsx4(ChevronDown, {})
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
),
|
|
157
|
-
/* @__PURE__ */ jsxs2(
|
|
158
|
-
Menu.Items,
|
|
159
|
-
{
|
|
160
|
-
className: "absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto",
|
|
161
|
-
children: [
|
|
162
|
-
(additionalItems ?? []).map((item, index) => /* @__PURE__ */ jsx4(
|
|
163
|
-
"div",
|
|
164
|
-
{
|
|
165
|
-
className: clsx3(borderColor, "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0", {
|
|
166
|
-
"border-b-0 rounded-b-lg": filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1
|
|
167
|
-
}),
|
|
168
|
-
children: item
|
|
169
|
-
},
|
|
170
|
-
`additionalItems${index}`
|
|
171
|
-
)),
|
|
172
|
-
filteredOptions.map((option, index) => /* @__PURE__ */ jsx4(Menu.Item, { children: /* @__PURE__ */ jsx4(
|
|
173
|
-
"div",
|
|
174
|
-
{
|
|
175
|
-
className: clsx3(
|
|
176
|
-
"px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
|
|
177
|
-
option.className,
|
|
178
|
-
borderColor,
|
|
179
|
-
{
|
|
180
|
-
"brightness-90": option.value === value,
|
|
181
|
-
"brightness-95": index % 2 === 1,
|
|
182
|
-
"text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
|
|
183
|
-
"bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
|
|
184
|
-
"rounded-b-lg": index === filteredOptions.length - 1
|
|
185
|
-
}
|
|
186
|
-
),
|
|
187
|
-
onClick: () => {
|
|
188
|
-
if (!option.disabled) {
|
|
189
|
-
onChange(option.value);
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
children: option.label
|
|
193
|
-
}
|
|
194
|
-
) }, `item${index}`))
|
|
195
|
-
]
|
|
196
|
-
}
|
|
197
|
-
)
|
|
198
|
-
] }) })
|
|
199
|
-
] });
|
|
200
|
-
};
|
|
201
|
-
|
|
202
252
|
// src/components/user-action/Button.tsx
|
|
203
|
-
import
|
|
204
|
-
import { jsx as
|
|
253
|
+
import clsx3 from "clsx";
|
|
254
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
205
255
|
var paddingMapping = {
|
|
206
256
|
small: "btn-sm",
|
|
207
257
|
medium: "btn-md",
|
|
@@ -245,25 +295,25 @@ var SolidButton = ({
|
|
|
245
295
|
negative: "text-button-solid-negative-icon",
|
|
246
296
|
neutral: "text-button-solid-neutral-icon"
|
|
247
297
|
}[color];
|
|
248
|
-
return /* @__PURE__ */
|
|
298
|
+
return /* @__PURE__ */ jsxs2(
|
|
249
299
|
"button",
|
|
250
300
|
{
|
|
251
301
|
onClick: disabled ? void 0 : onClick,
|
|
252
302
|
disabled: disabled || onClick === void 0,
|
|
253
|
-
className:
|
|
303
|
+
className: clsx3(
|
|
254
304
|
{
|
|
255
305
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
256
|
-
[
|
|
306
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
257
307
|
},
|
|
258
308
|
ButtonUtil.paddingMapping[size],
|
|
259
309
|
className
|
|
260
310
|
),
|
|
261
311
|
...restProps,
|
|
262
312
|
children: [
|
|
263
|
-
startIcon && /* @__PURE__ */
|
|
313
|
+
startIcon && /* @__PURE__ */ jsx4(
|
|
264
314
|
"span",
|
|
265
315
|
{
|
|
266
|
-
className:
|
|
316
|
+
className: clsx3({
|
|
267
317
|
[iconColorClasses]: !disabled,
|
|
268
318
|
[`text-disabled-icon`]: disabled
|
|
269
319
|
}),
|
|
@@ -271,10 +321,10 @@ var SolidButton = ({
|
|
|
271
321
|
}
|
|
272
322
|
),
|
|
273
323
|
children,
|
|
274
|
-
endIcon && /* @__PURE__ */
|
|
324
|
+
endIcon && /* @__PURE__ */ jsx4(
|
|
275
325
|
"span",
|
|
276
326
|
{
|
|
277
|
-
className:
|
|
327
|
+
className: clsx3({
|
|
278
328
|
[iconColorClasses]: !disabled,
|
|
279
329
|
[`text-disabled-icon`]: disabled
|
|
280
330
|
}),
|
|
@@ -303,15 +353,15 @@ var IconButton = ({
|
|
|
303
353
|
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
304
354
|
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
305
355
|
}[color];
|
|
306
|
-
return /* @__PURE__ */
|
|
356
|
+
return /* @__PURE__ */ jsx4(
|
|
307
357
|
"button",
|
|
308
358
|
{
|
|
309
359
|
onClick: disabled ? void 0 : onClick,
|
|
310
360
|
disabled: disabled || onClick === void 0,
|
|
311
|
-
className:
|
|
361
|
+
className: clsx3(
|
|
312
362
|
{
|
|
313
363
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
314
|
-
[
|
|
364
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
315
365
|
},
|
|
316
366
|
ButtonUtil.iconPaddingMapping[size],
|
|
317
367
|
className
|
|
@@ -322,21 +372,343 @@ var IconButton = ({
|
|
|
322
372
|
);
|
|
323
373
|
};
|
|
324
374
|
|
|
375
|
+
// src/hooks/useSearch.ts
|
|
376
|
+
import { useEffect as useEffect5, useMemo, useState as useState5 } from "react";
|
|
377
|
+
|
|
378
|
+
// src/util/simpleSearch.ts
|
|
379
|
+
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
380
|
+
return objects.filter((object) => {
|
|
381
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
382
|
+
if (!mappedSearchKeywords) {
|
|
383
|
+
return true;
|
|
384
|
+
}
|
|
385
|
+
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
// src/hooks/useSearch.ts
|
|
390
|
+
var useSearch = ({
|
|
391
|
+
list,
|
|
392
|
+
initialSearch,
|
|
393
|
+
searchMapping
|
|
394
|
+
}) => {
|
|
395
|
+
const [items, setItems] = useState5(list);
|
|
396
|
+
const [search, setSearch] = useState5(initialSearch);
|
|
397
|
+
useEffect5(() => {
|
|
398
|
+
setItems(list);
|
|
399
|
+
}, [list]);
|
|
400
|
+
const result = useMemo(
|
|
401
|
+
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
402
|
+
[search, items, searchMapping]
|
|
403
|
+
);
|
|
404
|
+
return {
|
|
405
|
+
result,
|
|
406
|
+
hasResult: result.length > 0,
|
|
407
|
+
allItems: items,
|
|
408
|
+
setItems,
|
|
409
|
+
search,
|
|
410
|
+
setSearch
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
// src/localization/defaults/form.ts
|
|
415
|
+
var formTranslation = {
|
|
416
|
+
en: {
|
|
417
|
+
all: "All",
|
|
418
|
+
back: "Back",
|
|
419
|
+
cancel: "Cancel",
|
|
420
|
+
change: "Change",
|
|
421
|
+
clear: "Clear",
|
|
422
|
+
close: "Close",
|
|
423
|
+
confirm: "Confirm",
|
|
424
|
+
decline: "Decline",
|
|
425
|
+
delete: "Delete",
|
|
426
|
+
discard: "Discard",
|
|
427
|
+
discardChanges: "Discard Changes",
|
|
428
|
+
done: "Done",
|
|
429
|
+
edit: "Edit",
|
|
430
|
+
enterText: "Enter text here",
|
|
431
|
+
error: "Error",
|
|
432
|
+
exit: "Exit",
|
|
433
|
+
fieldRequiredError: "This field is required.",
|
|
434
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
435
|
+
less: "Less",
|
|
436
|
+
loading: "Loading",
|
|
437
|
+
maxLengthError: "Maximum length exceeded.",
|
|
438
|
+
minLengthError: "Minimum length not met.",
|
|
439
|
+
more: "More",
|
|
440
|
+
next: "Next",
|
|
441
|
+
no: "No",
|
|
442
|
+
none: "None",
|
|
443
|
+
of: "of",
|
|
444
|
+
optional: "Optional",
|
|
445
|
+
pleaseWait: "Please wait...",
|
|
446
|
+
previous: "Previous",
|
|
447
|
+
remove: "Remove",
|
|
448
|
+
required: "Required",
|
|
449
|
+
reset: "Reset",
|
|
450
|
+
save: "Save",
|
|
451
|
+
search: "Search",
|
|
452
|
+
select: "Select",
|
|
453
|
+
selectOption: "Select an option",
|
|
454
|
+
show: "Show",
|
|
455
|
+
showMore: "Show more",
|
|
456
|
+
showLess: "Show less",
|
|
457
|
+
submit: "Submit",
|
|
458
|
+
success: "Success",
|
|
459
|
+
update: "Update",
|
|
460
|
+
unsavedChanges: "Unsaved Changes",
|
|
461
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
462
|
+
yes: "Yes"
|
|
463
|
+
},
|
|
464
|
+
de: {
|
|
465
|
+
all: "Alle",
|
|
466
|
+
back: "Zur\xFCck",
|
|
467
|
+
cancel: "Abbrechen",
|
|
468
|
+
change: "\xC4ndern",
|
|
469
|
+
clear: "L\xF6schen",
|
|
470
|
+
close: "Schlie\xDFen",
|
|
471
|
+
confirm: "Best\xE4tigen",
|
|
472
|
+
decline: "Ablehnen",
|
|
473
|
+
delete: "L\xF6schen",
|
|
474
|
+
discard: "Verwerfen",
|
|
475
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
476
|
+
done: "Fertig",
|
|
477
|
+
edit: "Bearbeiten",
|
|
478
|
+
enterText: "Text hier eingeben",
|
|
479
|
+
error: "Fehler",
|
|
480
|
+
exit: "Beenden",
|
|
481
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
482
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
483
|
+
less: "Weniger",
|
|
484
|
+
loading: "L\xE4dt",
|
|
485
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
486
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
487
|
+
more: "Mehr",
|
|
488
|
+
next: "Weiter",
|
|
489
|
+
no: "Nein",
|
|
490
|
+
none: "Nichts",
|
|
491
|
+
of: "von",
|
|
492
|
+
optional: "Optional",
|
|
493
|
+
pleaseWait: "Bitte warten...",
|
|
494
|
+
previous: "Vorherige",
|
|
495
|
+
remove: "Entfernen",
|
|
496
|
+
required: "Erforderlich",
|
|
497
|
+
reset: "Zur\xFCcksetzen",
|
|
498
|
+
save: "Speichern",
|
|
499
|
+
search: "Suche",
|
|
500
|
+
select: "Select",
|
|
501
|
+
selectOption: "Option ausw\xE4hlen",
|
|
502
|
+
show: "Anzeigen",
|
|
503
|
+
showMore: "Mehr anzeigen",
|
|
504
|
+
showLess: "Weniger anzeigen",
|
|
505
|
+
submit: "Abschicken",
|
|
506
|
+
success: "Erfolg",
|
|
507
|
+
update: "Update",
|
|
508
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
509
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
510
|
+
yes: "Ja"
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
515
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
516
|
+
var defaultSearchableListTranslation = {
|
|
517
|
+
en: {
|
|
518
|
+
nothingFound: "Nothing found"
|
|
519
|
+
},
|
|
520
|
+
de: {
|
|
521
|
+
nothingFound: "Nichts gefunden"
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
var SearchableList = ({
|
|
525
|
+
overwriteTranslation,
|
|
526
|
+
list,
|
|
527
|
+
initialSearch = "",
|
|
528
|
+
searchMapping,
|
|
529
|
+
autoFocus,
|
|
530
|
+
minimumItemsForSearch = 6,
|
|
531
|
+
itemMapper,
|
|
532
|
+
className,
|
|
533
|
+
resultListClassName
|
|
534
|
+
}) => {
|
|
535
|
+
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
536
|
+
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
537
|
+
return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
|
|
538
|
+
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
539
|
+
/* @__PURE__ */ jsx5(
|
|
540
|
+
Input,
|
|
541
|
+
{
|
|
542
|
+
value: search,
|
|
543
|
+
onChangeText: setSearch,
|
|
544
|
+
placeholder: translation("search"),
|
|
545
|
+
autoFocus,
|
|
546
|
+
className: "w-full"
|
|
547
|
+
}
|
|
548
|
+
),
|
|
549
|
+
/* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
|
|
550
|
+
] }),
|
|
551
|
+
hasResult ? /* @__PURE__ */ jsx5("div", { className: clsx4("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ jsx5("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
|
|
552
|
+
] });
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
556
|
+
import clsx5 from "clsx";
|
|
557
|
+
import { Check } from "lucide-react";
|
|
558
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
559
|
+
var Tile = ({
|
|
560
|
+
title,
|
|
561
|
+
description,
|
|
562
|
+
onClick,
|
|
563
|
+
isSelected = false,
|
|
564
|
+
isDisabled = false,
|
|
565
|
+
prefix,
|
|
566
|
+
suffix,
|
|
567
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
568
|
+
selectedClassName = " bg-primary/20",
|
|
569
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
570
|
+
className
|
|
571
|
+
}) => {
|
|
572
|
+
return /* @__PURE__ */ jsxs4(
|
|
573
|
+
"div",
|
|
574
|
+
{
|
|
575
|
+
className: clsx5(
|
|
576
|
+
"row gap-x-2 w-full items-center",
|
|
577
|
+
{
|
|
578
|
+
[normalClassName]: !!onClick && !isDisabled,
|
|
579
|
+
[selectedClassName]: isSelected && !isDisabled,
|
|
580
|
+
[disabledClassName]: isDisabled
|
|
581
|
+
},
|
|
582
|
+
className
|
|
583
|
+
),
|
|
584
|
+
onClick: isDisabled ? void 0 : onClick,
|
|
585
|
+
children: [
|
|
586
|
+
prefix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0),
|
|
587
|
+
/* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
|
|
588
|
+
/* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
589
|
+
!!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
|
|
590
|
+
] }),
|
|
591
|
+
suffix
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
);
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
// src/hooks/useOutsideClick.ts
|
|
598
|
+
import { useEffect as useEffect6 } from "react";
|
|
599
|
+
var useOutsideClick = (refs, handler) => {
|
|
600
|
+
useEffect6(() => {
|
|
601
|
+
const listener = (event) => {
|
|
602
|
+
if (event.target === null) return;
|
|
603
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
handler();
|
|
607
|
+
};
|
|
608
|
+
document.addEventListener("mousedown", listener);
|
|
609
|
+
document.addEventListener("touchstart", listener);
|
|
610
|
+
return () => {
|
|
611
|
+
document.removeEventListener("mousedown", listener);
|
|
612
|
+
document.removeEventListener("touchstart", listener);
|
|
613
|
+
};
|
|
614
|
+
}, [refs, handler]);
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// src/components/user-action/Select.tsx
|
|
618
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
619
|
+
var Select = ({
|
|
620
|
+
value,
|
|
621
|
+
label,
|
|
622
|
+
options,
|
|
623
|
+
onChange,
|
|
624
|
+
hintText = "",
|
|
625
|
+
isDisabled,
|
|
626
|
+
isSearchEnabled = false,
|
|
627
|
+
className,
|
|
628
|
+
selectedDisplayOverwrite
|
|
629
|
+
}) => {
|
|
630
|
+
const triggerRef = useRef2(null);
|
|
631
|
+
const menuRef = useRef2(null);
|
|
632
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
633
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
634
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
635
|
+
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
636
|
+
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");
|
|
637
|
+
}
|
|
638
|
+
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
639
|
+
return /* @__PURE__ */ jsxs5("div", { className: clsx6(className), children: [
|
|
640
|
+
label && /* @__PURE__ */ jsx7(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx6("mb-1", label.className) }),
|
|
641
|
+
/* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
642
|
+
/* @__PURE__ */ jsxs5(
|
|
643
|
+
"button",
|
|
644
|
+
{
|
|
645
|
+
ref: triggerRef,
|
|
646
|
+
className: clsx6(
|
|
647
|
+
"btn-md justify-between w-full border-2",
|
|
648
|
+
{
|
|
649
|
+
"rounded-b-lg": !open,
|
|
650
|
+
"bg-menu-background border-menu-border hover:border-primary": !isDisabled,
|
|
651
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
652
|
+
}
|
|
653
|
+
),
|
|
654
|
+
onClick: () => setIsOpen(!isOpen),
|
|
655
|
+
disabled: isDisabled,
|
|
656
|
+
children: [
|
|
657
|
+
!isShowingHint && /* @__PURE__ */ jsx7("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
658
|
+
isShowingHint && /* @__PURE__ */ jsx7("span", { className: "textstyle-description", children: hintText }),
|
|
659
|
+
isOpen ? /* @__PURE__ */ jsx7(ChevronUp, {}) : /* @__PURE__ */ jsx7(ChevronDown, {})
|
|
660
|
+
]
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
isOpen && /* @__PURE__ */ jsx7(
|
|
664
|
+
"div",
|
|
665
|
+
{
|
|
666
|
+
ref: menuRef,
|
|
667
|
+
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",
|
|
668
|
+
children: /* @__PURE__ */ jsx7(
|
|
669
|
+
SearchableList,
|
|
670
|
+
{
|
|
671
|
+
list: options,
|
|
672
|
+
minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
|
|
673
|
+
searchMapping: (item) => item.searchTags,
|
|
674
|
+
itemMapper: (option, index) => /* @__PURE__ */ jsx7(
|
|
675
|
+
Tile,
|
|
676
|
+
{
|
|
677
|
+
isSelected: selectedOption?.value === option.value,
|
|
678
|
+
className: "px-2 py-1 rounded-md",
|
|
679
|
+
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
680
|
+
title: { value: option.label, className: "font-semibold" },
|
|
681
|
+
onClick: () => {
|
|
682
|
+
onChange(option.value);
|
|
683
|
+
setIsOpen(false);
|
|
684
|
+
},
|
|
685
|
+
isDisabled: option.disabled
|
|
686
|
+
},
|
|
687
|
+
index
|
|
688
|
+
)
|
|
689
|
+
}
|
|
690
|
+
)
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
] })
|
|
694
|
+
] });
|
|
695
|
+
};
|
|
696
|
+
|
|
325
697
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
326
|
-
import { useEffect as
|
|
698
|
+
import { useEffect as useEffect9, useRef as useRef3, useState as useState8 } from "react";
|
|
327
699
|
import ReactDOM from "react-dom";
|
|
328
|
-
import
|
|
700
|
+
import clsx8 from "clsx";
|
|
329
701
|
|
|
330
702
|
// src/hooks/useHoverState.ts
|
|
331
|
-
import { useEffect as
|
|
703
|
+
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
332
704
|
var defaultUseHoverStateProps = {
|
|
333
705
|
closingDelay: 200,
|
|
334
706
|
isDisabled: false
|
|
335
707
|
};
|
|
336
708
|
var useHoverState = (props = void 0) => {
|
|
337
709
|
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
338
|
-
const [isHovered, setIsHovered] =
|
|
339
|
-
const [timer, setTimer] =
|
|
710
|
+
const [isHovered, setIsHovered] = useState7(false);
|
|
711
|
+
const [timer, setTimer] = useState7();
|
|
340
712
|
const onMouseEnter = () => {
|
|
341
713
|
if (isDisabled) {
|
|
342
714
|
return;
|
|
@@ -352,14 +724,14 @@ var useHoverState = (props = void 0) => {
|
|
|
352
724
|
setIsHovered(false);
|
|
353
725
|
}, closingDelay));
|
|
354
726
|
};
|
|
355
|
-
|
|
727
|
+
useEffect8(() => {
|
|
356
728
|
if (timer) {
|
|
357
729
|
return () => {
|
|
358
730
|
clearTimeout(timer);
|
|
359
731
|
};
|
|
360
732
|
}
|
|
361
733
|
});
|
|
362
|
-
|
|
734
|
+
useEffect8(() => {
|
|
363
735
|
if (timer) {
|
|
364
736
|
clearTimeout(timer);
|
|
365
737
|
}
|
|
@@ -372,8 +744,8 @@ var useHoverState = (props = void 0) => {
|
|
|
372
744
|
};
|
|
373
745
|
|
|
374
746
|
// src/components/user-action/Tooltip.tsx
|
|
375
|
-
import { clsx as
|
|
376
|
-
import { jsx as
|
|
747
|
+
import { clsx as clsx7 } from "clsx";
|
|
748
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
377
749
|
var Tooltip = ({
|
|
378
750
|
tooltip,
|
|
379
751
|
children,
|
|
@@ -403,30 +775,30 @@ var Tooltip = ({
|
|
|
403
775
|
left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
|
|
404
776
|
right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
|
|
405
777
|
};
|
|
406
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ jsxs6(
|
|
407
779
|
"div",
|
|
408
780
|
{
|
|
409
|
-
className:
|
|
781
|
+
className: clsx7("relative inline-block", containerClassName),
|
|
410
782
|
...handlers,
|
|
411
783
|
children: [
|
|
412
784
|
children,
|
|
413
|
-
isHovered && /* @__PURE__ */
|
|
785
|
+
isHovered && /* @__PURE__ */ jsxs6(
|
|
414
786
|
"div",
|
|
415
787
|
{
|
|
416
|
-
className:
|
|
788
|
+
className: clsx7(
|
|
417
789
|
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
418
|
-
animate-tooltip-fade-in shadow-
|
|
790
|
+
animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
|
|
419
791
|
positionClasses[position],
|
|
420
792
|
tooltipClassName
|
|
421
793
|
),
|
|
422
794
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
423
795
|
children: [
|
|
424
796
|
tooltip,
|
|
425
|
-
/* @__PURE__ */
|
|
797
|
+
/* @__PURE__ */ jsx8(
|
|
426
798
|
"div",
|
|
427
799
|
{
|
|
428
|
-
className:
|
|
429
|
-
style: { ...triangleStyle[position], zIndex }
|
|
800
|
+
className: clsx7(`absolute w-0 h-0`, triangleClasses[position]),
|
|
801
|
+
style: { ...triangleStyle[position], zIndex: zIndex + 1 }
|
|
430
802
|
}
|
|
431
803
|
)
|
|
432
804
|
]
|
|
@@ -439,24 +811,24 @@ var Tooltip = ({
|
|
|
439
811
|
|
|
440
812
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
441
813
|
import { X } from "lucide-react";
|
|
442
|
-
import { jsx as
|
|
814
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
443
815
|
var Overlay = ({
|
|
444
816
|
children,
|
|
445
817
|
isOpen,
|
|
446
818
|
onBackgroundClick,
|
|
447
819
|
backgroundClassName
|
|
448
820
|
}) => {
|
|
449
|
-
const [root, setRoot] =
|
|
450
|
-
|
|
821
|
+
const [root, setRoot] = useState8();
|
|
822
|
+
useEffect9(() => {
|
|
451
823
|
setRoot(document.body);
|
|
452
824
|
}, []);
|
|
453
825
|
if (!root || !isOpen) return null;
|
|
454
826
|
return ReactDOM.createPortal(
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ jsxs7("div", { className: clsx8("fixed inset-0 z-[9999]"), children: [
|
|
828
|
+
/* @__PURE__ */ jsx9(
|
|
457
829
|
"div",
|
|
458
830
|
{
|
|
459
|
-
className:
|
|
831
|
+
className: clsx8("fixed inset-0 h-screen w-screen bg-black/30", backgroundClassName),
|
|
460
832
|
onClick: onBackgroundClick
|
|
461
833
|
}
|
|
462
834
|
),
|
|
@@ -468,10 +840,10 @@ var Overlay = ({
|
|
|
468
840
|
var overlayStack = [];
|
|
469
841
|
var defaultModalHeaderTranslation = {
|
|
470
842
|
en: {
|
|
471
|
-
|
|
843
|
+
...formTranslation.en
|
|
472
844
|
},
|
|
473
845
|
de: {
|
|
474
|
-
|
|
846
|
+
...formTranslation.de
|
|
475
847
|
}
|
|
476
848
|
};
|
|
477
849
|
var OverlayHeader = ({
|
|
@@ -482,23 +854,23 @@ var OverlayHeader = ({
|
|
|
482
854
|
description,
|
|
483
855
|
descriptionText = ""
|
|
484
856
|
}) => {
|
|
485
|
-
const translation = useTranslation(defaultModalHeaderTranslation, overwriteTranslation);
|
|
857
|
+
const translation = useTranslation([defaultModalHeaderTranslation], overwriteTranslation);
|
|
486
858
|
const hasTitleRow = !!title || !!titleText || !!onClose;
|
|
487
|
-
const titleRow = /* @__PURE__ */
|
|
488
|
-
title ?? /* @__PURE__ */
|
|
859
|
+
const titleRow = /* @__PURE__ */ jsxs7("div", { className: "row justify-between items-start gap-x-8", children: [
|
|
860
|
+
title ?? /* @__PURE__ */ jsx9(
|
|
489
861
|
"h2",
|
|
490
862
|
{
|
|
491
|
-
className:
|
|
863
|
+
className: clsx8("textstyle-title-lg", {
|
|
492
864
|
"mb-1": description || descriptionText
|
|
493
865
|
}),
|
|
494
866
|
children: titleText
|
|
495
867
|
}
|
|
496
868
|
),
|
|
497
|
-
!!onClose && /* @__PURE__ */
|
|
869
|
+
!!onClose && /* @__PURE__ */ jsx9(Tooltip, { tooltip: translation("close"), children: /* @__PURE__ */ jsx9(IconButton, { color: "neutral", size: "small", onClick: onClose, children: /* @__PURE__ */ jsx9(X, { className: "w-full h-full" }) }) })
|
|
498
870
|
] });
|
|
499
|
-
return /* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ jsxs7("div", { className: "col", children: [
|
|
500
872
|
hasTitleRow && titleRow,
|
|
501
|
-
description ?? (descriptionText && /* @__PURE__ */
|
|
873
|
+
description ?? (descriptionText && /* @__PURE__ */ jsx9("span", { className: "textstyle-description", children: descriptionText }))
|
|
502
874
|
] });
|
|
503
875
|
};
|
|
504
876
|
var Modal = ({
|
|
@@ -509,8 +881,8 @@ var Modal = ({
|
|
|
509
881
|
backgroundClassName,
|
|
510
882
|
headerProps
|
|
511
883
|
}) => {
|
|
512
|
-
const ref =
|
|
513
|
-
|
|
884
|
+
const ref = useRef3(null);
|
|
885
|
+
useEffect9(() => {
|
|
514
886
|
if (!isOpen) return;
|
|
515
887
|
const modal = ref.current;
|
|
516
888
|
if (!modal) {
|
|
@@ -547,25 +919,25 @@ var Modal = ({
|
|
|
547
919
|
overlayStack = overlayStack.filter((m) => m !== modal);
|
|
548
920
|
};
|
|
549
921
|
}, [isOpen, onClose]);
|
|
550
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ jsx9(
|
|
551
923
|
Overlay,
|
|
552
924
|
{
|
|
553
925
|
isOpen,
|
|
554
926
|
onBackgroundClick: onClose,
|
|
555
927
|
backgroundClassName,
|
|
556
|
-
children: /* @__PURE__ */
|
|
928
|
+
children: /* @__PURE__ */ jsxs7(
|
|
557
929
|
"div",
|
|
558
930
|
{
|
|
559
931
|
ref,
|
|
560
932
|
tabIndex: -1,
|
|
561
|
-
className:
|
|
933
|
+
className: clsx8(
|
|
562
934
|
"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",
|
|
563
935
|
className
|
|
564
936
|
),
|
|
565
937
|
role: "dialog",
|
|
566
938
|
"aria-modal": true,
|
|
567
939
|
children: [
|
|
568
|
-
/* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ jsx9(OverlayHeader, { ...headerProps, onClose }),
|
|
569
941
|
children
|
|
570
942
|
]
|
|
571
943
|
}
|
|
@@ -575,17 +947,17 @@ var Modal = ({
|
|
|
575
947
|
};
|
|
576
948
|
|
|
577
949
|
// src/components/modals/LanguageModal.tsx
|
|
578
|
-
import { jsx as
|
|
950
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
579
951
|
var defaultLanguageModalTranslation = {
|
|
580
952
|
en: {
|
|
581
|
-
|
|
582
|
-
|
|
953
|
+
language: "Language",
|
|
954
|
+
chooseLanguage: "Choose your language",
|
|
583
955
|
done: "Done",
|
|
584
956
|
...LanguageUtil.languagesLocalNames
|
|
585
957
|
},
|
|
586
958
|
de: {
|
|
587
|
-
|
|
588
|
-
|
|
959
|
+
language: "Sprache",
|
|
960
|
+
chooseLanguage: "W\xE4hle deine bevorzugte Sprache",
|
|
589
961
|
done: "Fertig",
|
|
590
962
|
...LanguageUtil.languagesLocalNames
|
|
591
963
|
}
|
|
@@ -597,19 +969,19 @@ var LanguageModal = ({
|
|
|
597
969
|
...modalProps
|
|
598
970
|
}) => {
|
|
599
971
|
const { language, setLanguage } = useLanguage();
|
|
600
|
-
const translation = useTranslation(defaultLanguageModalTranslation, overwriteTranslation);
|
|
601
|
-
return /* @__PURE__ */
|
|
972
|
+
const translation = useTranslation([defaultLanguageModalTranslation], overwriteTranslation);
|
|
973
|
+
return /* @__PURE__ */ jsx10(
|
|
602
974
|
Modal,
|
|
603
975
|
{
|
|
604
976
|
headerProps: {
|
|
605
977
|
...headerProps,
|
|
606
|
-
titleText: headerProps?.titleText ?? translation
|
|
607
|
-
descriptionText: headerProps?.descriptionText ?? translation
|
|
978
|
+
titleText: headerProps?.titleText ?? translation("language"),
|
|
979
|
+
descriptionText: headerProps?.descriptionText ?? translation("chooseLanguage")
|
|
608
980
|
},
|
|
609
981
|
onClose,
|
|
610
982
|
...modalProps,
|
|
611
|
-
children: /* @__PURE__ */
|
|
612
|
-
/* @__PURE__ */
|
|
983
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "w-64", children: [
|
|
984
|
+
/* @__PURE__ */ jsx10(
|
|
613
985
|
Select,
|
|
614
986
|
{
|
|
615
987
|
className: "mt-2",
|
|
@@ -618,7 +990,7 @@ var LanguageModal = ({
|
|
|
618
990
|
onChange: (language2) => setLanguage(language2)
|
|
619
991
|
}
|
|
620
992
|
),
|
|
621
|
-
/* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ jsx10("div", { className: "row mt-3 gap-x-4 justify-end", children: /* @__PURE__ */ jsx10(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation("done") }) })
|
|
622
994
|
] })
|
|
623
995
|
}
|
|
624
996
|
);
|