@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
|
@@ -61,22 +61,61 @@ var LanguageContext = (0, import_react2.createContext)({
|
|
|
61
61
|
var useLanguage = () => (0, import_react2.useContext)(LanguageContext);
|
|
62
62
|
|
|
63
63
|
// src/localization/useTranslation.ts
|
|
64
|
-
var useTranslation = (
|
|
65
|
-
const { language: languageProp, translation: overwrite } =
|
|
64
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
65
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
66
66
|
const { language: inferredLanguage } = useLanguage();
|
|
67
67
|
const usedLanguage = languageProp ?? inferredLanguage;
|
|
68
|
-
|
|
69
|
-
if (overwrite
|
|
70
|
-
|
|
68
|
+
const usedTranslations = [...translations];
|
|
69
|
+
if (overwrite) {
|
|
70
|
+
usedTranslations.push(overwrite);
|
|
71
71
|
}
|
|
72
|
-
return
|
|
72
|
+
return (key, options) => {
|
|
73
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
74
|
+
try {
|
|
75
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
76
|
+
const translation = translations[i];
|
|
77
|
+
const localizedTranslation = translation[usedLanguage];
|
|
78
|
+
if (!localizedTranslation) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const value = localizedTranslation[key];
|
|
82
|
+
if (!value) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
let forProcessing;
|
|
86
|
+
if (typeof value !== "string") {
|
|
87
|
+
if (count <= 0 && value?.zero) {
|
|
88
|
+
forProcessing = value.zero;
|
|
89
|
+
} else if (count === 1 && value?.one) {
|
|
90
|
+
forProcessing = value.one;
|
|
91
|
+
} else if (count === 2 && value?.two) {
|
|
92
|
+
forProcessing = value.two;
|
|
93
|
+
} else if (count <= 10 && value?.few) {
|
|
94
|
+
forProcessing = value.few;
|
|
95
|
+
} else if (count > 10 && value?.many) {
|
|
96
|
+
forProcessing = value.many;
|
|
97
|
+
} else {
|
|
98
|
+
forProcessing = value.other;
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
forProcessing = value;
|
|
102
|
+
}
|
|
103
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
104
|
+
return replacements[placeholder] ?? `{{${placeholder}}}`;
|
|
105
|
+
});
|
|
106
|
+
return forProcessing;
|
|
107
|
+
}
|
|
108
|
+
} catch (e) {
|
|
109
|
+
console.error(e);
|
|
110
|
+
}
|
|
111
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
112
|
+
};
|
|
73
113
|
};
|
|
74
114
|
|
|
75
115
|
// src/components/user-action/Select.tsx
|
|
76
|
-
var
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var import_clsx3 = __toESM(require("clsx"));
|
|
116
|
+
var import_lucide_react3 = require("lucide-react");
|
|
117
|
+
var import_react7 = require("react");
|
|
118
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
80
119
|
|
|
81
120
|
// src/components/user-action/Label.tsx
|
|
82
121
|
var import_clsx = __toESM(require("clsx"));
|
|
@@ -96,15 +135,119 @@ var Label = ({
|
|
|
96
135
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { ...props, className: (0, import_clsx.default)(styleMapping[labelType], className), children: children ? children : name });
|
|
97
136
|
};
|
|
98
137
|
|
|
138
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
139
|
+
var import_lucide_react = require("lucide-react");
|
|
140
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
141
|
+
|
|
99
142
|
// src/components/user-action/Input.tsx
|
|
100
143
|
var import_react4 = require("react");
|
|
101
144
|
var import_clsx2 = __toESM(require("clsx"));
|
|
102
145
|
|
|
103
146
|
// src/hooks/useSaveDelay.ts
|
|
104
147
|
var import_react3 = require("react");
|
|
148
|
+
function useSaveDelay(setNotificationStatus, delay) {
|
|
149
|
+
const [updateTimer, setUpdateTimer] = (0, import_react3.useState)(void 0);
|
|
150
|
+
const [notificationTimer, setNotificationTimer] = (0, import_react3.useState)(void 0);
|
|
151
|
+
const restartTimer = (onSave) => {
|
|
152
|
+
clearTimeout(updateTimer);
|
|
153
|
+
setUpdateTimer(setTimeout(() => {
|
|
154
|
+
onSave();
|
|
155
|
+
setNotificationStatus(true);
|
|
156
|
+
clearTimeout(notificationTimer);
|
|
157
|
+
setNotificationTimer(setTimeout(() => {
|
|
158
|
+
setNotificationStatus(false);
|
|
159
|
+
clearTimeout(notificationTimer);
|
|
160
|
+
}, delay));
|
|
161
|
+
clearTimeout(updateTimer);
|
|
162
|
+
}, delay));
|
|
163
|
+
};
|
|
164
|
+
const clearUpdateTimer = (hasSaved = true) => {
|
|
165
|
+
clearTimeout(updateTimer);
|
|
166
|
+
if (hasSaved) {
|
|
167
|
+
setNotificationStatus(true);
|
|
168
|
+
clearTimeout(notificationTimer);
|
|
169
|
+
setNotificationTimer(setTimeout(() => {
|
|
170
|
+
setNotificationStatus(false);
|
|
171
|
+
clearTimeout(notificationTimer);
|
|
172
|
+
}, delay));
|
|
173
|
+
} else {
|
|
174
|
+
setNotificationStatus(false);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
(0, import_react3.useEffect)(() => {
|
|
178
|
+
return () => {
|
|
179
|
+
clearTimeout(updateTimer);
|
|
180
|
+
clearTimeout(notificationTimer);
|
|
181
|
+
};
|
|
182
|
+
}, []);
|
|
183
|
+
return { restartTimer, clearUpdateTimer };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// src/util/noop.ts
|
|
187
|
+
var noop = () => void 0;
|
|
105
188
|
|
|
106
189
|
// src/components/user-action/Input.tsx
|
|
107
190
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
191
|
+
var Input = ({
|
|
192
|
+
id,
|
|
193
|
+
type = "text",
|
|
194
|
+
value,
|
|
195
|
+
label,
|
|
196
|
+
onChange = noop,
|
|
197
|
+
onChangeText = noop,
|
|
198
|
+
onEditCompleted,
|
|
199
|
+
className = "",
|
|
200
|
+
expanded = true,
|
|
201
|
+
autoFocus,
|
|
202
|
+
onBlur,
|
|
203
|
+
containerClassName,
|
|
204
|
+
...restProps
|
|
205
|
+
}) => {
|
|
206
|
+
const {
|
|
207
|
+
restartTimer,
|
|
208
|
+
clearUpdateTimer
|
|
209
|
+
} = useSaveDelay(() => void 0, 3e3);
|
|
210
|
+
const ref = (0, import_react4.useRef)(null);
|
|
211
|
+
(0, import_react4.useEffect)(() => {
|
|
212
|
+
if (autoFocus) {
|
|
213
|
+
ref.current?.focus();
|
|
214
|
+
}
|
|
215
|
+
}, [autoFocus]);
|
|
216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)({ "w-full": expanded }, containerClassName), children: [
|
|
217
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx2.default)("mb-1", label.className) }),
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
219
|
+
"input",
|
|
220
|
+
{
|
|
221
|
+
ref,
|
|
222
|
+
value,
|
|
223
|
+
id,
|
|
224
|
+
type,
|
|
225
|
+
className,
|
|
226
|
+
onBlur: (event) => {
|
|
227
|
+
if (onBlur) {
|
|
228
|
+
onBlur(event);
|
|
229
|
+
}
|
|
230
|
+
if (onEditCompleted) {
|
|
231
|
+
onEditCompleted(event.target.value);
|
|
232
|
+
clearUpdateTimer();
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
onChange: (e) => {
|
|
236
|
+
const value2 = e.target.value;
|
|
237
|
+
if (onEditCompleted) {
|
|
238
|
+
restartTimer(() => {
|
|
239
|
+
onEditCompleted(value2);
|
|
240
|
+
clearUpdateTimer();
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
onChange(e);
|
|
244
|
+
onChangeText(value2);
|
|
245
|
+
},
|
|
246
|
+
...restProps
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
] });
|
|
250
|
+
};
|
|
108
251
|
var FormInput = (0, import_react4.forwardRef)(function FormInput2({
|
|
109
252
|
id,
|
|
110
253
|
labelText,
|
|
@@ -141,102 +284,9 @@ var FormInput = (0, import_react4.forwardRef)(function FormInput2({
|
|
|
141
284
|
] });
|
|
142
285
|
});
|
|
143
286
|
|
|
144
|
-
// src/components/user-action/Select.tsx
|
|
145
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
146
|
-
var Select = ({
|
|
147
|
-
value,
|
|
148
|
-
label,
|
|
149
|
-
options,
|
|
150
|
-
onChange,
|
|
151
|
-
isHidingCurrentValue = true,
|
|
152
|
-
hintText = "",
|
|
153
|
-
showDisabledOptions = true,
|
|
154
|
-
isDisabled,
|
|
155
|
-
className,
|
|
156
|
-
textColor = "text-menu-text",
|
|
157
|
-
additionalItems,
|
|
158
|
-
selectedDisplayOverwrite
|
|
159
|
-
}) => {
|
|
160
|
-
let filteredOptions = isHidingCurrentValue ? options.filter((option) => option.value !== value) : options;
|
|
161
|
-
if (!showDisabledOptions) {
|
|
162
|
-
filteredOptions = filteredOptions.filter((value2) => !value2.disabled);
|
|
163
|
-
}
|
|
164
|
-
const selectedOption = options.find((option) => option.value === value);
|
|
165
|
-
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
166
|
-
console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
|
|
167
|
-
}
|
|
168
|
-
const borderColor = "border-menu-border";
|
|
169
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx3.default)(className), children: [
|
|
170
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx3.default)("mb-1", label.className) }),
|
|
171
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Menu, { as: "div", className: "relative text-menu-text", children: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
172
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
173
|
-
import_react5.Menu.Button,
|
|
174
|
-
{
|
|
175
|
-
className: (0, import_clsx3.default)(
|
|
176
|
-
"inline-flex w-full justify-between items-center rounded-t-lg border-2 px-4 py-2 font-medium bg-menu-background text-menu-text",
|
|
177
|
-
textColor,
|
|
178
|
-
borderColor,
|
|
179
|
-
{
|
|
180
|
-
"rounded-b-lg": !open,
|
|
181
|
-
"hover:border-primary": !isDisabled,
|
|
182
|
-
"bg-disabled-background cursor-not-allowed text-disabled": isDisabled
|
|
183
|
-
}
|
|
184
|
-
),
|
|
185
|
-
disabled: isDisabled,
|
|
186
|
-
children: [
|
|
187
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: selectedDisplayOverwrite ?? selectedOption?.label ?? hintText }),
|
|
188
|
-
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronDown, {})
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
),
|
|
192
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
193
|
-
import_react5.Menu.Items,
|
|
194
|
-
{
|
|
195
|
-
className: "absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto",
|
|
196
|
-
children: [
|
|
197
|
-
(additionalItems ?? []).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
198
|
-
"div",
|
|
199
|
-
{
|
|
200
|
-
className: (0, import_clsx3.default)(borderColor, "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0", {
|
|
201
|
-
"border-b-0 rounded-b-lg": filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1
|
|
202
|
-
}),
|
|
203
|
-
children: item
|
|
204
|
-
},
|
|
205
|
-
`additionalItems${index}`
|
|
206
|
-
)),
|
|
207
|
-
filteredOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Menu.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
208
|
-
"div",
|
|
209
|
-
{
|
|
210
|
-
className: (0, import_clsx3.default)(
|
|
211
|
-
"px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
|
|
212
|
-
option.className,
|
|
213
|
-
borderColor,
|
|
214
|
-
{
|
|
215
|
-
"brightness-90": option.value === value,
|
|
216
|
-
"brightness-95": index % 2 === 1,
|
|
217
|
-
"text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
|
|
218
|
-
"bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
|
|
219
|
-
"rounded-b-lg": index === filteredOptions.length - 1
|
|
220
|
-
}
|
|
221
|
-
),
|
|
222
|
-
onClick: () => {
|
|
223
|
-
if (!option.disabled) {
|
|
224
|
-
onChange(option.value);
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
children: option.label
|
|
228
|
-
}
|
|
229
|
-
) }, `item${index}`))
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
)
|
|
233
|
-
] }) })
|
|
234
|
-
] });
|
|
235
|
-
};
|
|
236
|
-
|
|
237
287
|
// src/components/user-action/Button.tsx
|
|
238
|
-
var
|
|
239
|
-
var
|
|
288
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
289
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
240
290
|
var paddingMapping = {
|
|
241
291
|
small: "btn-sm",
|
|
242
292
|
medium: "btn-md",
|
|
@@ -280,25 +330,25 @@ var SolidButton = ({
|
|
|
280
330
|
negative: "text-button-solid-negative-icon",
|
|
281
331
|
neutral: "text-button-solid-neutral-icon"
|
|
282
332
|
}[color];
|
|
283
|
-
return /* @__PURE__ */ (0,
|
|
333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
284
334
|
"button",
|
|
285
335
|
{
|
|
286
336
|
onClick: disabled ? void 0 : onClick,
|
|
287
337
|
disabled: disabled || onClick === void 0,
|
|
288
|
-
className: (0,
|
|
338
|
+
className: (0, import_clsx3.default)(
|
|
289
339
|
{
|
|
290
340
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
291
|
-
[(0,
|
|
341
|
+
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
292
342
|
},
|
|
293
343
|
ButtonUtil.paddingMapping[size],
|
|
294
344
|
className
|
|
295
345
|
),
|
|
296
346
|
...restProps,
|
|
297
347
|
children: [
|
|
298
|
-
startIcon && /* @__PURE__ */ (0,
|
|
348
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
299
349
|
"span",
|
|
300
350
|
{
|
|
301
|
-
className: (0,
|
|
351
|
+
className: (0, import_clsx3.default)({
|
|
302
352
|
[iconColorClasses]: !disabled,
|
|
303
353
|
[`text-disabled-icon`]: disabled
|
|
304
354
|
}),
|
|
@@ -306,10 +356,10 @@ var SolidButton = ({
|
|
|
306
356
|
}
|
|
307
357
|
),
|
|
308
358
|
children,
|
|
309
|
-
endIcon && /* @__PURE__ */ (0,
|
|
359
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
310
360
|
"span",
|
|
311
361
|
{
|
|
312
|
-
className: (0,
|
|
362
|
+
className: (0, import_clsx3.default)({
|
|
313
363
|
[iconColorClasses]: !disabled,
|
|
314
364
|
[`text-disabled-icon`]: disabled
|
|
315
365
|
}),
|
|
@@ -338,15 +388,15 @@ var IconButton = ({
|
|
|
338
388
|
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
339
389
|
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
340
390
|
}[color];
|
|
341
|
-
return /* @__PURE__ */ (0,
|
|
391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
342
392
|
"button",
|
|
343
393
|
{
|
|
344
394
|
onClick: disabled ? void 0 : onClick,
|
|
345
395
|
disabled: disabled || onClick === void 0,
|
|
346
|
-
className: (0,
|
|
396
|
+
className: (0, import_clsx3.default)(
|
|
347
397
|
{
|
|
348
398
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
349
|
-
[(0,
|
|
399
|
+
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
350
400
|
},
|
|
351
401
|
ButtonUtil.iconPaddingMapping[size],
|
|
352
402
|
className
|
|
@@ -357,21 +407,343 @@ var IconButton = ({
|
|
|
357
407
|
);
|
|
358
408
|
};
|
|
359
409
|
|
|
410
|
+
// src/hooks/useSearch.ts
|
|
411
|
+
var import_react5 = require("react");
|
|
412
|
+
|
|
413
|
+
// src/util/simpleSearch.ts
|
|
414
|
+
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
415
|
+
return objects.filter((object) => {
|
|
416
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
417
|
+
if (!mappedSearchKeywords) {
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// src/hooks/useSearch.ts
|
|
425
|
+
var useSearch = ({
|
|
426
|
+
list,
|
|
427
|
+
initialSearch,
|
|
428
|
+
searchMapping
|
|
429
|
+
}) => {
|
|
430
|
+
const [items, setItems] = (0, import_react5.useState)(list);
|
|
431
|
+
const [search, setSearch] = (0, import_react5.useState)(initialSearch);
|
|
432
|
+
(0, import_react5.useEffect)(() => {
|
|
433
|
+
setItems(list);
|
|
434
|
+
}, [list]);
|
|
435
|
+
const result = (0, import_react5.useMemo)(
|
|
436
|
+
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
437
|
+
[search, items, searchMapping]
|
|
438
|
+
);
|
|
439
|
+
return {
|
|
440
|
+
result,
|
|
441
|
+
hasResult: result.length > 0,
|
|
442
|
+
allItems: items,
|
|
443
|
+
setItems,
|
|
444
|
+
search,
|
|
445
|
+
setSearch
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// src/localization/defaults/form.ts
|
|
450
|
+
var formTranslation = {
|
|
451
|
+
en: {
|
|
452
|
+
all: "All",
|
|
453
|
+
back: "Back",
|
|
454
|
+
cancel: "Cancel",
|
|
455
|
+
change: "Change",
|
|
456
|
+
clear: "Clear",
|
|
457
|
+
close: "Close",
|
|
458
|
+
confirm: "Confirm",
|
|
459
|
+
decline: "Decline",
|
|
460
|
+
delete: "Delete",
|
|
461
|
+
discard: "Discard",
|
|
462
|
+
discardChanges: "Discard Changes",
|
|
463
|
+
done: "Done",
|
|
464
|
+
edit: "Edit",
|
|
465
|
+
enterText: "Enter text here",
|
|
466
|
+
error: "Error",
|
|
467
|
+
exit: "Exit",
|
|
468
|
+
fieldRequiredError: "This field is required.",
|
|
469
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
470
|
+
less: "Less",
|
|
471
|
+
loading: "Loading",
|
|
472
|
+
maxLengthError: "Maximum length exceeded.",
|
|
473
|
+
minLengthError: "Minimum length not met.",
|
|
474
|
+
more: "More",
|
|
475
|
+
next: "Next",
|
|
476
|
+
no: "No",
|
|
477
|
+
none: "None",
|
|
478
|
+
of: "of",
|
|
479
|
+
optional: "Optional",
|
|
480
|
+
pleaseWait: "Please wait...",
|
|
481
|
+
previous: "Previous",
|
|
482
|
+
remove: "Remove",
|
|
483
|
+
required: "Required",
|
|
484
|
+
reset: "Reset",
|
|
485
|
+
save: "Save",
|
|
486
|
+
search: "Search",
|
|
487
|
+
select: "Select",
|
|
488
|
+
selectOption: "Select an option",
|
|
489
|
+
show: "Show",
|
|
490
|
+
showMore: "Show more",
|
|
491
|
+
showLess: "Show less",
|
|
492
|
+
submit: "Submit",
|
|
493
|
+
success: "Success",
|
|
494
|
+
update: "Update",
|
|
495
|
+
unsavedChanges: "Unsaved Changes",
|
|
496
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
497
|
+
yes: "Yes"
|
|
498
|
+
},
|
|
499
|
+
de: {
|
|
500
|
+
all: "Alle",
|
|
501
|
+
back: "Zur\xFCck",
|
|
502
|
+
cancel: "Abbrechen",
|
|
503
|
+
change: "\xC4ndern",
|
|
504
|
+
clear: "L\xF6schen",
|
|
505
|
+
close: "Schlie\xDFen",
|
|
506
|
+
confirm: "Best\xE4tigen",
|
|
507
|
+
decline: "Ablehnen",
|
|
508
|
+
delete: "L\xF6schen",
|
|
509
|
+
discard: "Verwerfen",
|
|
510
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
511
|
+
done: "Fertig",
|
|
512
|
+
edit: "Bearbeiten",
|
|
513
|
+
enterText: "Text hier eingeben",
|
|
514
|
+
error: "Fehler",
|
|
515
|
+
exit: "Beenden",
|
|
516
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
517
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
518
|
+
less: "Weniger",
|
|
519
|
+
loading: "L\xE4dt",
|
|
520
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
521
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
522
|
+
more: "Mehr",
|
|
523
|
+
next: "Weiter",
|
|
524
|
+
no: "Nein",
|
|
525
|
+
none: "Nichts",
|
|
526
|
+
of: "von",
|
|
527
|
+
optional: "Optional",
|
|
528
|
+
pleaseWait: "Bitte warten...",
|
|
529
|
+
previous: "Vorherige",
|
|
530
|
+
remove: "Entfernen",
|
|
531
|
+
required: "Erforderlich",
|
|
532
|
+
reset: "Zur\xFCcksetzen",
|
|
533
|
+
save: "Speichern",
|
|
534
|
+
search: "Suche",
|
|
535
|
+
select: "Select",
|
|
536
|
+
selectOption: "Option ausw\xE4hlen",
|
|
537
|
+
show: "Anzeigen",
|
|
538
|
+
showMore: "Mehr anzeigen",
|
|
539
|
+
showLess: "Weniger anzeigen",
|
|
540
|
+
submit: "Abschicken",
|
|
541
|
+
success: "Erfolg",
|
|
542
|
+
update: "Update",
|
|
543
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
544
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
545
|
+
yes: "Ja"
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
550
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
551
|
+
var defaultSearchableListTranslation = {
|
|
552
|
+
en: {
|
|
553
|
+
nothingFound: "Nothing found"
|
|
554
|
+
},
|
|
555
|
+
de: {
|
|
556
|
+
nothingFound: "Nichts gefunden"
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
var SearchableList = ({
|
|
560
|
+
overwriteTranslation,
|
|
561
|
+
list,
|
|
562
|
+
initialSearch = "",
|
|
563
|
+
searchMapping,
|
|
564
|
+
autoFocus,
|
|
565
|
+
minimumItemsForSearch = 6,
|
|
566
|
+
itemMapper,
|
|
567
|
+
className,
|
|
568
|
+
resultListClassName
|
|
569
|
+
}) => {
|
|
570
|
+
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
571
|
+
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("col gap-y-2", className), children: [
|
|
573
|
+
list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
575
|
+
Input,
|
|
576
|
+
{
|
|
577
|
+
value: search,
|
|
578
|
+
onChangeText: setSearch,
|
|
579
|
+
placeholder: translation("search"),
|
|
580
|
+
autoFocus,
|
|
581
|
+
className: "w-full"
|
|
582
|
+
}
|
|
583
|
+
),
|
|
584
|
+
/* @__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" }) })
|
|
585
|
+
] }),
|
|
586
|
+
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") })
|
|
587
|
+
] });
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
591
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
592
|
+
var import_lucide_react2 = require("lucide-react");
|
|
593
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
594
|
+
var Tile = ({
|
|
595
|
+
title,
|
|
596
|
+
description,
|
|
597
|
+
onClick,
|
|
598
|
+
isSelected = false,
|
|
599
|
+
isDisabled = false,
|
|
600
|
+
prefix,
|
|
601
|
+
suffix,
|
|
602
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
603
|
+
selectedClassName = " bg-primary/20",
|
|
604
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
605
|
+
className
|
|
606
|
+
}) => {
|
|
607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
608
|
+
"div",
|
|
609
|
+
{
|
|
610
|
+
className: (0, import_clsx5.default)(
|
|
611
|
+
"row gap-x-2 w-full items-center",
|
|
612
|
+
{
|
|
613
|
+
[normalClassName]: !!onClick && !isDisabled,
|
|
614
|
+
[selectedClassName]: isSelected && !isDisabled,
|
|
615
|
+
[disabledClassName]: isDisabled
|
|
616
|
+
},
|
|
617
|
+
className
|
|
618
|
+
),
|
|
619
|
+
onClick: isDisabled ? void 0 : onClick,
|
|
620
|
+
children: [
|
|
621
|
+
prefix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { size: 24 }) : void 0),
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "col gap-y-0 w-full", children: [
|
|
623
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { className: (0, import_clsx5.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
624
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_clsx5.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
625
|
+
] }),
|
|
626
|
+
suffix
|
|
627
|
+
]
|
|
628
|
+
}
|
|
629
|
+
);
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
// src/hooks/useOutsideClick.ts
|
|
633
|
+
var import_react6 = require("react");
|
|
634
|
+
var useOutsideClick = (refs, handler) => {
|
|
635
|
+
(0, import_react6.useEffect)(() => {
|
|
636
|
+
const listener = (event) => {
|
|
637
|
+
if (event.target === null) return;
|
|
638
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
handler();
|
|
642
|
+
};
|
|
643
|
+
document.addEventListener("mousedown", listener);
|
|
644
|
+
document.addEventListener("touchstart", listener);
|
|
645
|
+
return () => {
|
|
646
|
+
document.removeEventListener("mousedown", listener);
|
|
647
|
+
document.removeEventListener("touchstart", listener);
|
|
648
|
+
};
|
|
649
|
+
}, [refs, handler]);
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
// src/components/user-action/Select.tsx
|
|
653
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
654
|
+
var Select = ({
|
|
655
|
+
value,
|
|
656
|
+
label,
|
|
657
|
+
options,
|
|
658
|
+
onChange,
|
|
659
|
+
hintText = "",
|
|
660
|
+
isDisabled,
|
|
661
|
+
isSearchEnabled = false,
|
|
662
|
+
className,
|
|
663
|
+
selectedDisplayOverwrite
|
|
664
|
+
}) => {
|
|
665
|
+
const triggerRef = (0, import_react7.useRef)(null);
|
|
666
|
+
const menuRef = (0, import_react7.useRef)(null);
|
|
667
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
668
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
669
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
670
|
+
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
671
|
+
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");
|
|
672
|
+
}
|
|
673
|
+
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: (0, import_clsx6.default)(className), children: [
|
|
675
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx6.default)("mb-1", label.className) }),
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
678
|
+
"button",
|
|
679
|
+
{
|
|
680
|
+
ref: triggerRef,
|
|
681
|
+
className: (0, import_clsx6.default)(
|
|
682
|
+
"btn-md justify-between w-full border-2",
|
|
683
|
+
{
|
|
684
|
+
"rounded-b-lg": !open,
|
|
685
|
+
"bg-menu-background border-menu-border hover:border-primary": !isDisabled,
|
|
686
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
687
|
+
}
|
|
688
|
+
),
|
|
689
|
+
onClick: () => setIsOpen(!isOpen),
|
|
690
|
+
disabled: isDisabled,
|
|
691
|
+
children: [
|
|
692
|
+
!isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
693
|
+
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "textstyle-description", children: hintText }),
|
|
694
|
+
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronDown, {})
|
|
695
|
+
]
|
|
696
|
+
}
|
|
697
|
+
),
|
|
698
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
699
|
+
"div",
|
|
700
|
+
{
|
|
701
|
+
ref: menuRef,
|
|
702
|
+
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",
|
|
703
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
704
|
+
SearchableList,
|
|
705
|
+
{
|
|
706
|
+
list: options,
|
|
707
|
+
minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
|
|
708
|
+
searchMapping: (item) => item.searchTags,
|
|
709
|
+
itemMapper: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
710
|
+
Tile,
|
|
711
|
+
{
|
|
712
|
+
isSelected: selectedOption?.value === option.value,
|
|
713
|
+
className: "px-2 py-1 rounded-md",
|
|
714
|
+
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
715
|
+
title: { value: option.label, className: "font-semibold" },
|
|
716
|
+
onClick: () => {
|
|
717
|
+
onChange(option.value);
|
|
718
|
+
setIsOpen(false);
|
|
719
|
+
},
|
|
720
|
+
isDisabled: option.disabled
|
|
721
|
+
},
|
|
722
|
+
index
|
|
723
|
+
)
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
}
|
|
727
|
+
)
|
|
728
|
+
] })
|
|
729
|
+
] });
|
|
730
|
+
};
|
|
731
|
+
|
|
360
732
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
361
|
-
var
|
|
733
|
+
var import_react9 = require("react");
|
|
362
734
|
var import_react_dom = __toESM(require("react-dom"));
|
|
363
|
-
var
|
|
735
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
364
736
|
|
|
365
737
|
// src/hooks/useHoverState.ts
|
|
366
|
-
var
|
|
738
|
+
var import_react8 = require("react");
|
|
367
739
|
var defaultUseHoverStateProps = {
|
|
368
740
|
closingDelay: 200,
|
|
369
741
|
isDisabled: false
|
|
370
742
|
};
|
|
371
743
|
var useHoverState = (props = void 0) => {
|
|
372
744
|
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
373
|
-
const [isHovered, setIsHovered] = (0,
|
|
374
|
-
const [timer, setTimer] = (0,
|
|
745
|
+
const [isHovered, setIsHovered] = (0, import_react8.useState)(false);
|
|
746
|
+
const [timer, setTimer] = (0, import_react8.useState)();
|
|
375
747
|
const onMouseEnter = () => {
|
|
376
748
|
if (isDisabled) {
|
|
377
749
|
return;
|
|
@@ -387,14 +759,14 @@ var useHoverState = (props = void 0) => {
|
|
|
387
759
|
setIsHovered(false);
|
|
388
760
|
}, closingDelay));
|
|
389
761
|
};
|
|
390
|
-
(0,
|
|
762
|
+
(0, import_react8.useEffect)(() => {
|
|
391
763
|
if (timer) {
|
|
392
764
|
return () => {
|
|
393
765
|
clearTimeout(timer);
|
|
394
766
|
};
|
|
395
767
|
}
|
|
396
768
|
});
|
|
397
|
-
(0,
|
|
769
|
+
(0, import_react8.useEffect)(() => {
|
|
398
770
|
if (timer) {
|
|
399
771
|
clearTimeout(timer);
|
|
400
772
|
}
|
|
@@ -407,8 +779,8 @@ var useHoverState = (props = void 0) => {
|
|
|
407
779
|
};
|
|
408
780
|
|
|
409
781
|
// src/components/user-action/Tooltip.tsx
|
|
410
|
-
var
|
|
411
|
-
var
|
|
782
|
+
var import_clsx7 = require("clsx");
|
|
783
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
412
784
|
var Tooltip = ({
|
|
413
785
|
tooltip,
|
|
414
786
|
children,
|
|
@@ -438,30 +810,30 @@ var Tooltip = ({
|
|
|
438
810
|
left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
|
|
439
811
|
right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
|
|
440
812
|
};
|
|
441
|
-
return /* @__PURE__ */ (0,
|
|
813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
442
814
|
"div",
|
|
443
815
|
{
|
|
444
|
-
className: (0,
|
|
816
|
+
className: (0, import_clsx7.clsx)("relative inline-block", containerClassName),
|
|
445
817
|
...handlers,
|
|
446
818
|
children: [
|
|
447
819
|
children,
|
|
448
|
-
isHovered && /* @__PURE__ */ (0,
|
|
820
|
+
isHovered && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
449
821
|
"div",
|
|
450
822
|
{
|
|
451
|
-
className: (0,
|
|
823
|
+
className: (0, import_clsx7.clsx)(
|
|
452
824
|
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
453
|
-
animate-tooltip-fade-in shadow-
|
|
825
|
+
animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
|
|
454
826
|
positionClasses[position],
|
|
455
827
|
tooltipClassName
|
|
456
828
|
),
|
|
457
829
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
458
830
|
children: [
|
|
459
831
|
tooltip,
|
|
460
|
-
/* @__PURE__ */ (0,
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
461
833
|
"div",
|
|
462
834
|
{
|
|
463
|
-
className: (0,
|
|
464
|
-
style: { ...triangleStyle[position], zIndex }
|
|
835
|
+
className: (0, import_clsx7.clsx)(`absolute w-0 h-0`, triangleClasses[position]),
|
|
836
|
+
style: { ...triangleStyle[position], zIndex: zIndex + 1 }
|
|
465
837
|
}
|
|
466
838
|
)
|
|
467
839
|
]
|
|
@@ -473,25 +845,25 @@ var Tooltip = ({
|
|
|
473
845
|
};
|
|
474
846
|
|
|
475
847
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
476
|
-
var
|
|
477
|
-
var
|
|
848
|
+
var import_lucide_react4 = require("lucide-react");
|
|
849
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
478
850
|
var Overlay = ({
|
|
479
851
|
children,
|
|
480
852
|
isOpen,
|
|
481
853
|
onBackgroundClick,
|
|
482
854
|
backgroundClassName
|
|
483
855
|
}) => {
|
|
484
|
-
const [root, setRoot] = (0,
|
|
485
|
-
(0,
|
|
856
|
+
const [root, setRoot] = (0, import_react9.useState)();
|
|
857
|
+
(0, import_react9.useEffect)(() => {
|
|
486
858
|
setRoot(document.body);
|
|
487
859
|
}, []);
|
|
488
860
|
if (!root || !isOpen) return null;
|
|
489
861
|
return import_react_dom.default.createPortal(
|
|
490
|
-
/* @__PURE__ */ (0,
|
|
491
|
-
/* @__PURE__ */ (0,
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_clsx8.default)("fixed inset-0 z-[9999]"), children: [
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
492
864
|
"div",
|
|
493
865
|
{
|
|
494
|
-
className: (0,
|
|
866
|
+
className: (0, import_clsx8.default)("fixed inset-0 h-screen w-screen bg-black/30", backgroundClassName),
|
|
495
867
|
onClick: onBackgroundClick
|
|
496
868
|
}
|
|
497
869
|
),
|
|
@@ -503,10 +875,10 @@ var Overlay = ({
|
|
|
503
875
|
var overlayStack = [];
|
|
504
876
|
var defaultModalHeaderTranslation = {
|
|
505
877
|
en: {
|
|
506
|
-
|
|
878
|
+
...formTranslation.en
|
|
507
879
|
},
|
|
508
880
|
de: {
|
|
509
|
-
|
|
881
|
+
...formTranslation.de
|
|
510
882
|
}
|
|
511
883
|
};
|
|
512
884
|
var OverlayHeader = ({
|
|
@@ -517,23 +889,23 @@ var OverlayHeader = ({
|
|
|
517
889
|
description,
|
|
518
890
|
descriptionText = ""
|
|
519
891
|
}) => {
|
|
520
|
-
const translation = useTranslation(defaultModalHeaderTranslation, overwriteTranslation);
|
|
892
|
+
const translation = useTranslation([defaultModalHeaderTranslation], overwriteTranslation);
|
|
521
893
|
const hasTitleRow = !!title || !!titleText || !!onClose;
|
|
522
|
-
const titleRow = /* @__PURE__ */ (0,
|
|
523
|
-
title ?? /* @__PURE__ */ (0,
|
|
894
|
+
const titleRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "row justify-between items-start gap-x-8", children: [
|
|
895
|
+
title ?? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
524
896
|
"h2",
|
|
525
897
|
{
|
|
526
|
-
className: (0,
|
|
898
|
+
className: (0, import_clsx8.default)("textstyle-title-lg", {
|
|
527
899
|
"mb-1": description || descriptionText
|
|
528
900
|
}),
|
|
529
901
|
children: titleText
|
|
530
902
|
}
|
|
531
903
|
),
|
|
532
|
-
!!onClose && /* @__PURE__ */ (0,
|
|
904
|
+
!!onClose && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Tooltip, { tooltip: translation("close"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { color: "neutral", size: "small", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "w-full h-full" }) }) })
|
|
533
905
|
] });
|
|
534
|
-
return /* @__PURE__ */ (0,
|
|
906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "col", children: [
|
|
535
907
|
hasTitleRow && titleRow,
|
|
536
|
-
description ?? (descriptionText && /* @__PURE__ */ (0,
|
|
908
|
+
description ?? (descriptionText && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "textstyle-description", children: descriptionText }))
|
|
537
909
|
] });
|
|
538
910
|
};
|
|
539
911
|
var Modal = ({
|
|
@@ -544,8 +916,8 @@ var Modal = ({
|
|
|
544
916
|
backgroundClassName,
|
|
545
917
|
headerProps
|
|
546
918
|
}) => {
|
|
547
|
-
const ref = (0,
|
|
548
|
-
(0,
|
|
919
|
+
const ref = (0, import_react9.useRef)(null);
|
|
920
|
+
(0, import_react9.useEffect)(() => {
|
|
549
921
|
if (!isOpen) return;
|
|
550
922
|
const modal = ref.current;
|
|
551
923
|
if (!modal) {
|
|
@@ -582,25 +954,25 @@ var Modal = ({
|
|
|
582
954
|
overlayStack = overlayStack.filter((m) => m !== modal);
|
|
583
955
|
};
|
|
584
956
|
}, [isOpen, onClose]);
|
|
585
|
-
return /* @__PURE__ */ (0,
|
|
957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
586
958
|
Overlay,
|
|
587
959
|
{
|
|
588
960
|
isOpen,
|
|
589
961
|
onBackgroundClick: onClose,
|
|
590
962
|
backgroundClassName,
|
|
591
|
-
children: /* @__PURE__ */ (0,
|
|
963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
592
964
|
"div",
|
|
593
965
|
{
|
|
594
966
|
ref,
|
|
595
967
|
tabIndex: -1,
|
|
596
|
-
className: (0,
|
|
968
|
+
className: (0, import_clsx8.default)(
|
|
597
969
|
"fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 col p-4 bg-overlay-background text-overlay-text rounded-xl shadow-xl",
|
|
598
970
|
className
|
|
599
971
|
),
|
|
600
972
|
role: "dialog",
|
|
601
973
|
"aria-modal": true,
|
|
602
974
|
children: [
|
|
603
|
-
/* @__PURE__ */ (0,
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(OverlayHeader, { ...headerProps, onClose }),
|
|
604
976
|
children
|
|
605
977
|
]
|
|
606
978
|
}
|
|
@@ -610,17 +982,17 @@ var Modal = ({
|
|
|
610
982
|
};
|
|
611
983
|
|
|
612
984
|
// src/components/modals/LanguageModal.tsx
|
|
613
|
-
var
|
|
985
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
614
986
|
var defaultLanguageModalTranslation = {
|
|
615
987
|
en: {
|
|
616
|
-
|
|
617
|
-
|
|
988
|
+
language: "Language",
|
|
989
|
+
chooseLanguage: "Choose your language",
|
|
618
990
|
done: "Done",
|
|
619
991
|
...LanguageUtil.languagesLocalNames
|
|
620
992
|
},
|
|
621
993
|
de: {
|
|
622
|
-
|
|
623
|
-
|
|
994
|
+
language: "Sprache",
|
|
995
|
+
chooseLanguage: "W\xE4hle deine bevorzugte Sprache",
|
|
624
996
|
done: "Fertig",
|
|
625
997
|
...LanguageUtil.languagesLocalNames
|
|
626
998
|
}
|
|
@@ -632,19 +1004,19 @@ var LanguageModal = ({
|
|
|
632
1004
|
...modalProps
|
|
633
1005
|
}) => {
|
|
634
1006
|
const { language, setLanguage } = useLanguage();
|
|
635
|
-
const translation = useTranslation(defaultLanguageModalTranslation, overwriteTranslation);
|
|
636
|
-
return /* @__PURE__ */ (0,
|
|
1007
|
+
const translation = useTranslation([defaultLanguageModalTranslation], overwriteTranslation);
|
|
1008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
637
1009
|
Modal,
|
|
638
1010
|
{
|
|
639
1011
|
headerProps: {
|
|
640
1012
|
...headerProps,
|
|
641
|
-
titleText: headerProps?.titleText ?? translation
|
|
642
|
-
descriptionText: headerProps?.descriptionText ?? translation
|
|
1013
|
+
titleText: headerProps?.titleText ?? translation("language"),
|
|
1014
|
+
descriptionText: headerProps?.descriptionText ?? translation("chooseLanguage")
|
|
643
1015
|
},
|
|
644
1016
|
onClose,
|
|
645
1017
|
...modalProps,
|
|
646
|
-
children: /* @__PURE__ */ (0,
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
1018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-64", children: [
|
|
1019
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
648
1020
|
Select,
|
|
649
1021
|
{
|
|
650
1022
|
className: "mt-2",
|
|
@@ -653,7 +1025,7 @@ var LanguageModal = ({
|
|
|
653
1025
|
onChange: (language2) => setLanguage(language2)
|
|
654
1026
|
}
|
|
655
1027
|
),
|
|
656
|
-
/* @__PURE__ */ (0,
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "row mt-3 gap-x-4 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation("done") }) })
|
|
657
1029
|
] })
|
|
658
1030
|
}
|
|
659
1031
|
);
|