@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
|
@@ -30,164 +30,93 @@ var LanguageContext = createContext({
|
|
|
30
30
|
var useLanguage = () => useContext(LanguageContext);
|
|
31
31
|
|
|
32
32
|
// src/localization/useTranslation.ts
|
|
33
|
-
var useTranslation = (
|
|
34
|
-
const { language: languageProp, translation: overwrite } =
|
|
33
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
34
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
35
35
|
const { language: inferredLanguage } = useLanguage();
|
|
36
36
|
const usedLanguage = languageProp ?? inferredLanguage;
|
|
37
|
-
|
|
38
|
-
if (overwrite
|
|
39
|
-
|
|
37
|
+
const usedTranslations = [...translations];
|
|
38
|
+
if (overwrite) {
|
|
39
|
+
usedTranslations.push(overwrite);
|
|
40
40
|
}
|
|
41
|
-
return
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
return (key, options) => {
|
|
42
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
43
|
+
try {
|
|
44
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
45
|
+
const translation = translations[i];
|
|
46
|
+
const localizedTranslation = translation[usedLanguage];
|
|
47
|
+
if (!localizedTranslation) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const value = localizedTranslation[key];
|
|
51
|
+
if (!value) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
let forProcessing;
|
|
55
|
+
if (typeof value !== "string") {
|
|
56
|
+
if (count <= 0 && value?.zero) {
|
|
57
|
+
forProcessing = value.zero;
|
|
58
|
+
} else if (count === 1 && value?.one) {
|
|
59
|
+
forProcessing = value.one;
|
|
60
|
+
} else if (count === 2 && value?.two) {
|
|
61
|
+
forProcessing = value.two;
|
|
62
|
+
} else if (count <= 10 && value?.few) {
|
|
63
|
+
forProcessing = value.few;
|
|
64
|
+
} else if (count > 10 && value?.many) {
|
|
65
|
+
forProcessing = value.many;
|
|
66
|
+
} else {
|
|
67
|
+
forProcessing = value.other;
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
forProcessing = value;
|
|
71
|
+
}
|
|
72
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
73
|
+
return replacements[placeholder] ?? `{{${placeholder}}}`;
|
|
74
|
+
});
|
|
75
|
+
return forProcessing;
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
console.error(e);
|
|
79
|
+
}
|
|
80
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
81
|
+
};
|
|
54
82
|
};
|
|
55
83
|
|
|
56
84
|
// src/components/user-action/MultiSelect.tsx
|
|
57
|
-
import
|
|
85
|
+
import { useEffect as useEffect7, useRef as useRef2, useState as useState6 } from "react";
|
|
86
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
87
|
+
import clsx7 from "clsx";
|
|
58
88
|
|
|
59
|
-
// src/components/user-action/
|
|
60
|
-
import { useRef } from "react";
|
|
89
|
+
// src/components/user-action/Label.tsx
|
|
61
90
|
import clsx from "clsx";
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const listener = (event) => {
|
|
68
|
-
if (event.target === null) return;
|
|
69
|
-
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
handler();
|
|
73
|
-
};
|
|
74
|
-
document.addEventListener("mousedown", listener);
|
|
75
|
-
document.addEventListener("touchstart", listener);
|
|
76
|
-
return () => {
|
|
77
|
-
document.removeEventListener("mousedown", listener);
|
|
78
|
-
document.removeEventListener("touchstart", listener);
|
|
79
|
-
};
|
|
80
|
-
}, [refs, handler]);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/hooks/useHoverState.ts
|
|
84
|
-
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
85
|
-
var defaultUseHoverStateProps = {
|
|
86
|
-
closingDelay: 200,
|
|
87
|
-
isDisabled: false
|
|
88
|
-
};
|
|
89
|
-
var useHoverState = (props = void 0) => {
|
|
90
|
-
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
91
|
-
const [isHovered, setIsHovered] = useState3(false);
|
|
92
|
-
const [timer, setTimer] = useState3();
|
|
93
|
-
const onMouseEnter = () => {
|
|
94
|
-
if (isDisabled) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
clearTimeout(timer);
|
|
98
|
-
setIsHovered(true);
|
|
99
|
-
};
|
|
100
|
-
const onMouseLeave = () => {
|
|
101
|
-
if (isDisabled) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
setTimer(setTimeout(() => {
|
|
105
|
-
setIsHovered(false);
|
|
106
|
-
}, closingDelay));
|
|
107
|
-
};
|
|
108
|
-
useEffect4(() => {
|
|
109
|
-
if (timer) {
|
|
110
|
-
return () => {
|
|
111
|
-
clearTimeout(timer);
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
useEffect4(() => {
|
|
116
|
-
if (timer) {
|
|
117
|
-
clearTimeout(timer);
|
|
118
|
-
}
|
|
119
|
-
}, [isDisabled]);
|
|
120
|
-
return {
|
|
121
|
-
isHovered,
|
|
122
|
-
setIsHovered,
|
|
123
|
-
handlers: { onMouseEnter, onMouseLeave }
|
|
124
|
-
};
|
|
91
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
92
|
+
var styleMapping = {
|
|
93
|
+
labelSmall: "textstyle-label-sm",
|
|
94
|
+
labelMedium: "textstyle-label-md",
|
|
95
|
+
labelBig: "textstyle-label-lg"
|
|
125
96
|
};
|
|
126
|
-
|
|
127
|
-
// src/components/user-action/Menu.tsx
|
|
128
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
129
|
-
var MenuItem = ({
|
|
130
|
-
children,
|
|
131
|
-
onClick,
|
|
132
|
-
alignment = "left",
|
|
133
|
-
className
|
|
134
|
-
}) => /* @__PURE__ */ jsx2(
|
|
135
|
-
"div",
|
|
136
|
-
{
|
|
137
|
-
className: clsx("block px-3 py-1 bg-menu-background text-menu-text hover:brightness-90", {
|
|
138
|
-
"text-right": alignment === "right",
|
|
139
|
-
"text-left": alignment === "left"
|
|
140
|
-
}, className),
|
|
141
|
-
onClick,
|
|
142
|
-
children
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
var Menu = ({
|
|
146
|
-
trigger,
|
|
97
|
+
var Label = ({
|
|
147
98
|
children,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
99
|
+
name,
|
|
100
|
+
labelType = "labelSmall",
|
|
101
|
+
className,
|
|
102
|
+
...props
|
|
151
103
|
}) => {
|
|
152
|
-
|
|
153
|
-
const triggerRef = useRef(null);
|
|
154
|
-
const menuRef = useRef(null);
|
|
155
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
156
|
-
return /* @__PURE__ */ jsxs(
|
|
157
|
-
"div",
|
|
158
|
-
{
|
|
159
|
-
className: "relative",
|
|
160
|
-
...handlers,
|
|
161
|
-
children: [
|
|
162
|
-
trigger(() => setIsOpen(!isOpen), triggerRef),
|
|
163
|
-
isOpen ? /* @__PURE__ */ jsx2(
|
|
164
|
-
"div",
|
|
165
|
-
{
|
|
166
|
-
ref: menuRef,
|
|
167
|
-
onClick: (e) => e.stopPropagation(),
|
|
168
|
-
className: clsx("absolute top-full mt-1 py-2 w-60 rounded-lg bg-menu-background text-menu-text ring-1 ring-slate-900/5 text-sm leading-6 font-semibold shadow-md z-[1]", {
|
|
169
|
-
" top-[8px]": alignment[0] === "t",
|
|
170
|
-
" bottom-[8px]": alignment[0] === "b",
|
|
171
|
-
" left-[-8px]": alignment[1] === "l",
|
|
172
|
-
" right-[-8px]": alignment[1] === "r"
|
|
173
|
-
}, menuClassName),
|
|
174
|
-
children
|
|
175
|
-
}
|
|
176
|
-
) : null
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
);
|
|
104
|
+
return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
180
105
|
};
|
|
181
106
|
|
|
107
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
108
|
+
import { Search } from "lucide-react";
|
|
109
|
+
import clsx4 from "clsx";
|
|
110
|
+
|
|
182
111
|
// src/components/user-action/Input.tsx
|
|
183
|
-
import { forwardRef, useEffect as
|
|
184
|
-
import
|
|
112
|
+
import { forwardRef, useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
113
|
+
import clsx2 from "clsx";
|
|
185
114
|
|
|
186
115
|
// src/hooks/useSaveDelay.ts
|
|
187
|
-
import { useEffect as
|
|
116
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
188
117
|
function useSaveDelay(setNotificationStatus, delay) {
|
|
189
|
-
const [updateTimer, setUpdateTimer] =
|
|
190
|
-
const [notificationTimer, setNotificationTimer] =
|
|
118
|
+
const [updateTimer, setUpdateTimer] = useState3(void 0);
|
|
119
|
+
const [notificationTimer, setNotificationTimer] = useState3(void 0);
|
|
191
120
|
const restartTimer = (onSave) => {
|
|
192
121
|
clearTimeout(updateTimer);
|
|
193
122
|
setUpdateTimer(setTimeout(() => {
|
|
@@ -214,7 +143,7 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
214
143
|
setNotificationStatus(false);
|
|
215
144
|
}
|
|
216
145
|
};
|
|
217
|
-
|
|
146
|
+
useEffect3(() => {
|
|
218
147
|
return () => {
|
|
219
148
|
clearTimeout(updateTimer);
|
|
220
149
|
clearTimeout(notificationTimer);
|
|
@@ -226,26 +155,8 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
226
155
|
// src/util/noop.ts
|
|
227
156
|
var noop = () => void 0;
|
|
228
157
|
|
|
229
|
-
// src/components/user-action/Label.tsx
|
|
230
|
-
import clsx2 from "clsx";
|
|
231
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
232
|
-
var styleMapping = {
|
|
233
|
-
labelSmall: "textstyle-label-sm",
|
|
234
|
-
labelMedium: "textstyle-label-md",
|
|
235
|
-
labelBig: "textstyle-label-lg"
|
|
236
|
-
};
|
|
237
|
-
var Label = ({
|
|
238
|
-
children,
|
|
239
|
-
name,
|
|
240
|
-
labelType = "labelSmall",
|
|
241
|
-
className,
|
|
242
|
-
...props
|
|
243
|
-
}) => {
|
|
244
|
-
return /* @__PURE__ */ jsx3("label", { ...props, className: clsx2(styleMapping[labelType], className), children: children ? children : name });
|
|
245
|
-
};
|
|
246
|
-
|
|
247
158
|
// src/components/user-action/Input.tsx
|
|
248
|
-
import { jsx as
|
|
159
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
249
160
|
var Input = ({
|
|
250
161
|
id,
|
|
251
162
|
type = "text",
|
|
@@ -265,15 +176,15 @@ var Input = ({
|
|
|
265
176
|
restartTimer,
|
|
266
177
|
clearUpdateTimer
|
|
267
178
|
} = useSaveDelay(() => void 0, 3e3);
|
|
268
|
-
const ref =
|
|
269
|
-
|
|
179
|
+
const ref = useRef(null);
|
|
180
|
+
useEffect4(() => {
|
|
270
181
|
if (autoFocus) {
|
|
271
182
|
ref.current?.focus();
|
|
272
183
|
}
|
|
273
184
|
}, [autoFocus]);
|
|
274
|
-
return /* @__PURE__ */
|
|
275
|
-
label && /* @__PURE__ */
|
|
276
|
-
/* @__PURE__ */
|
|
185
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
|
|
186
|
+
label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
|
|
187
|
+
/* @__PURE__ */ jsx3(
|
|
277
188
|
"input",
|
|
278
189
|
{
|
|
279
190
|
ref,
|
|
@@ -317,13 +228,13 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
317
228
|
required,
|
|
318
229
|
...restProps
|
|
319
230
|
}, ref) {
|
|
320
|
-
const input = /* @__PURE__ */
|
|
231
|
+
const input = /* @__PURE__ */ jsx3(
|
|
321
232
|
"input",
|
|
322
233
|
{
|
|
323
234
|
ref,
|
|
324
235
|
id,
|
|
325
236
|
...restProps,
|
|
326
|
-
className:
|
|
237
|
+
className: clsx2(
|
|
327
238
|
{
|
|
328
239
|
"focus:border-primary focus:ring-primary": !errorText,
|
|
329
240
|
"focus:border-negative focus:ring-negative text-negative": !!errorText
|
|
@@ -332,208 +243,422 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
332
243
|
)
|
|
333
244
|
}
|
|
334
245
|
);
|
|
335
|
-
return /* @__PURE__ */
|
|
336
|
-
labelText && /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
|
|
247
|
+
labelText && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: clsx2("textstyle-label-md", labelClassName), children: [
|
|
337
248
|
labelText,
|
|
338
|
-
required && /* @__PURE__ */
|
|
249
|
+
required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
|
|
339
250
|
] }),
|
|
340
251
|
input,
|
|
341
|
-
errorText && /* @__PURE__ */
|
|
252
|
+
errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
|
|
342
253
|
] });
|
|
343
254
|
});
|
|
344
255
|
|
|
345
|
-
// src/components/user-action/
|
|
346
|
-
import
|
|
347
|
-
import
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
small: "size-4",
|
|
353
|
-
medium: "size-6",
|
|
354
|
-
large: "size-8"
|
|
256
|
+
// src/components/user-action/Button.tsx
|
|
257
|
+
import clsx3 from "clsx";
|
|
258
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
259
|
+
var paddingMapping = {
|
|
260
|
+
small: "btn-sm",
|
|
261
|
+
medium: "btn-md",
|
|
262
|
+
large: "btn-lg"
|
|
355
263
|
};
|
|
356
|
-
var
|
|
357
|
-
small: "
|
|
358
|
-
medium: "
|
|
359
|
-
large: "
|
|
264
|
+
var iconPaddingMapping = {
|
|
265
|
+
small: "icon-btn-sm",
|
|
266
|
+
medium: "icon-btn-md",
|
|
267
|
+
large: "icon-btn-lg"
|
|
360
268
|
};
|
|
361
|
-
var
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
269
|
+
var ButtonUtil = {
|
|
270
|
+
paddingMapping,
|
|
271
|
+
iconPaddingMapping
|
|
272
|
+
};
|
|
273
|
+
var SolidButton = ({
|
|
274
|
+
children,
|
|
275
|
+
disabled = false,
|
|
276
|
+
color = "primary",
|
|
368
277
|
size = "medium",
|
|
369
|
-
|
|
370
|
-
|
|
278
|
+
startIcon,
|
|
279
|
+
endIcon,
|
|
280
|
+
onClick,
|
|
281
|
+
className,
|
|
282
|
+
...restProps
|
|
371
283
|
}) => {
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
284
|
+
const colorClasses = {
|
|
285
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
286
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
287
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
288
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
289
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
290
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
291
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
292
|
+
}[color];
|
|
293
|
+
const iconColorClasses = {
|
|
294
|
+
primary: "text-button-solid-primary-icon",
|
|
295
|
+
secondary: "text-button-solid-secondary-icon",
|
|
296
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
297
|
+
positive: "text-button-solid-positive-icon",
|
|
298
|
+
warning: "text-button-solid-warning-icon",
|
|
299
|
+
negative: "text-button-solid-negative-icon",
|
|
300
|
+
neutral: "text-button-solid-neutral-icon"
|
|
301
|
+
}[color];
|
|
302
|
+
return /* @__PURE__ */ jsxs2(
|
|
303
|
+
"button",
|
|
304
|
+
{
|
|
305
|
+
onClick: disabled ? void 0 : onClick,
|
|
306
|
+
disabled: disabled || onClick === void 0,
|
|
307
|
+
className: clsx3(
|
|
308
|
+
{
|
|
309
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
310
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
311
|
+
},
|
|
312
|
+
ButtonUtil.paddingMapping[size],
|
|
313
|
+
className
|
|
314
|
+
),
|
|
315
|
+
...restProps,
|
|
316
|
+
children: [
|
|
317
|
+
startIcon && /* @__PURE__ */ jsx4(
|
|
318
|
+
"span",
|
|
319
|
+
{
|
|
320
|
+
className: clsx3({
|
|
321
|
+
[iconColorClasses]: !disabled,
|
|
322
|
+
[`text-disabled-icon`]: disabled
|
|
323
|
+
}),
|
|
324
|
+
children: startIcon
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
children,
|
|
328
|
+
endIcon && /* @__PURE__ */ jsx4(
|
|
329
|
+
"span",
|
|
330
|
+
{
|
|
331
|
+
className: clsx3({
|
|
332
|
+
[iconColorClasses]: !disabled,
|
|
333
|
+
[`text-disabled-icon`]: disabled
|
|
334
|
+
}),
|
|
335
|
+
children: endIcon
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
]
|
|
377
339
|
}
|
|
378
|
-
|
|
379
|
-
|
|
340
|
+
);
|
|
341
|
+
};
|
|
342
|
+
var TextButton = ({
|
|
343
|
+
children,
|
|
344
|
+
disabled = false,
|
|
345
|
+
color = "neutral",
|
|
346
|
+
size = "medium",
|
|
347
|
+
startIcon,
|
|
348
|
+
endIcon,
|
|
349
|
+
onClick,
|
|
350
|
+
className,
|
|
351
|
+
...restProps
|
|
352
|
+
}) => {
|
|
353
|
+
const colorClasses = {
|
|
354
|
+
primary: "bg-transparent text-button-text-primary-text",
|
|
355
|
+
negative: "bg-transparent text-button-text-negative-text",
|
|
356
|
+
neutral: "bg-transparent text-button-text-neutral-text"
|
|
357
|
+
}[color];
|
|
358
|
+
const iconColorClasses = {
|
|
359
|
+
primary: "text-button-text-primary-icon",
|
|
360
|
+
negative: "text-button-text-negative-icon",
|
|
361
|
+
neutral: "text-button-text-neutral-icon"
|
|
362
|
+
}[color];
|
|
363
|
+
return /* @__PURE__ */ jsxs2(
|
|
364
|
+
"button",
|
|
365
|
+
{
|
|
366
|
+
onClick: disabled ? void 0 : onClick,
|
|
367
|
+
disabled: disabled || onClick === void 0,
|
|
368
|
+
className: clsx3(
|
|
369
|
+
{
|
|
370
|
+
"text-disabled-text cursor-not-allowed": disabled,
|
|
371
|
+
[clsx3(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
|
|
372
|
+
},
|
|
373
|
+
ButtonUtil.paddingMapping[size],
|
|
374
|
+
className
|
|
375
|
+
),
|
|
376
|
+
...restProps,
|
|
377
|
+
children: [
|
|
378
|
+
startIcon && /* @__PURE__ */ jsx4(
|
|
379
|
+
"span",
|
|
380
|
+
{
|
|
381
|
+
className: clsx3({
|
|
382
|
+
[iconColorClasses]: !disabled,
|
|
383
|
+
[`text-disabled-icon`]: disabled
|
|
384
|
+
}),
|
|
385
|
+
children: startIcon
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
children,
|
|
389
|
+
endIcon && /* @__PURE__ */ jsx4(
|
|
390
|
+
"span",
|
|
391
|
+
{
|
|
392
|
+
className: clsx3({
|
|
393
|
+
[iconColorClasses]: !disabled,
|
|
394
|
+
[`text-disabled-icon`]: disabled
|
|
395
|
+
}),
|
|
396
|
+
children: endIcon
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
]
|
|
380
400
|
}
|
|
401
|
+
);
|
|
402
|
+
};
|
|
403
|
+
var IconButton = ({
|
|
404
|
+
children,
|
|
405
|
+
disabled = false,
|
|
406
|
+
color = "primary",
|
|
407
|
+
size = "medium",
|
|
408
|
+
onClick,
|
|
409
|
+
className,
|
|
410
|
+
...restProps
|
|
411
|
+
}) => {
|
|
412
|
+
const colorClasses = {
|
|
413
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
414
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
415
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
416
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
417
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
418
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
419
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
420
|
+
}[color];
|
|
421
|
+
return /* @__PURE__ */ jsx4(
|
|
422
|
+
"button",
|
|
423
|
+
{
|
|
424
|
+
onClick: disabled ? void 0 : onClick,
|
|
425
|
+
disabled: disabled || onClick === void 0,
|
|
426
|
+
className: clsx3(
|
|
427
|
+
{
|
|
428
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
429
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
430
|
+
},
|
|
431
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
432
|
+
className
|
|
433
|
+
),
|
|
434
|
+
...restProps,
|
|
435
|
+
children
|
|
436
|
+
}
|
|
437
|
+
);
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// src/hooks/useSearch.ts
|
|
441
|
+
import { useEffect as useEffect5, useMemo, useState as useState5 } from "react";
|
|
442
|
+
|
|
443
|
+
// src/util/simpleSearch.ts
|
|
444
|
+
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
445
|
+
return objects.filter((object) => {
|
|
446
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
447
|
+
if (!mappedSearchKeywords) {
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
// src/hooks/useSearch.ts
|
|
455
|
+
var useSearch = ({
|
|
456
|
+
list,
|
|
457
|
+
initialSearch,
|
|
458
|
+
searchMapping
|
|
459
|
+
}) => {
|
|
460
|
+
const [items, setItems] = useState5(list);
|
|
461
|
+
const [search, setSearch] = useState5(initialSearch);
|
|
462
|
+
useEffect5(() => {
|
|
463
|
+
setItems(list);
|
|
464
|
+
}, [list]);
|
|
465
|
+
const result = useMemo(
|
|
466
|
+
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
467
|
+
[search, items, searchMapping]
|
|
468
|
+
);
|
|
469
|
+
return {
|
|
470
|
+
result,
|
|
471
|
+
hasResult: result.length > 0,
|
|
472
|
+
allItems: items,
|
|
473
|
+
setItems,
|
|
474
|
+
search,
|
|
475
|
+
setSearch
|
|
381
476
|
};
|
|
382
|
-
const changeValue = () => {
|
|
383
|
-
const newValue = checked === "indeterminate" ? false : !checked;
|
|
384
|
-
propagateChange(newValue);
|
|
385
|
-
};
|
|
386
|
-
return /* @__PURE__ */ jsxs3("div", { className: clsx4("row justify-center items-center", containerClassName), children: [
|
|
387
|
-
/* @__PURE__ */ jsx5(
|
|
388
|
-
CheckboxPrimitive.Root,
|
|
389
|
-
{
|
|
390
|
-
onCheckedChange: propagateChange,
|
|
391
|
-
checked,
|
|
392
|
-
disabled,
|
|
393
|
-
id,
|
|
394
|
-
className: clsx4(usedSizeClass, `items-center border-2 rounded outline-none focus:border-primary`, {
|
|
395
|
-
"text-disabled-text border-disabled-text bg-disabled-background": disabled,
|
|
396
|
-
"bg-surface": !disabled && !checked,
|
|
397
|
-
"bg-primary/30 border-primary text-primary": checked === true || checked === "indeterminate",
|
|
398
|
-
"hover:border-primary focus:hover:border-primary": !checked
|
|
399
|
-
}, className),
|
|
400
|
-
children: /* @__PURE__ */ jsxs3(CheckboxPrimitive.Indicator, { children: [
|
|
401
|
-
checked === true && /* @__PURE__ */ jsx5(Check, { className: innerIconSize }),
|
|
402
|
-
checked === "indeterminate" && /* @__PURE__ */ jsx5(Minus, { className: innerIconSize })
|
|
403
|
-
] })
|
|
404
|
-
}
|
|
405
|
-
),
|
|
406
|
-
label && /* @__PURE__ */ jsx5(
|
|
407
|
-
Label,
|
|
408
|
-
{
|
|
409
|
-
...label,
|
|
410
|
-
className: clsx4("cursor-pointer", label.className),
|
|
411
|
-
htmlFor: id,
|
|
412
|
-
onClick: changeValue
|
|
413
|
-
}
|
|
414
|
-
)
|
|
415
|
-
] });
|
|
416
477
|
};
|
|
417
478
|
|
|
418
|
-
// src/
|
|
419
|
-
|
|
420
|
-
var defaultMultiSelectTranslation = {
|
|
479
|
+
// src/localization/defaults/form.ts
|
|
480
|
+
var formTranslation = {
|
|
421
481
|
en: {
|
|
422
|
-
|
|
482
|
+
all: "All",
|
|
483
|
+
back: "Back",
|
|
484
|
+
cancel: "Cancel",
|
|
485
|
+
change: "Change",
|
|
486
|
+
clear: "Clear",
|
|
487
|
+
close: "Close",
|
|
488
|
+
confirm: "Confirm",
|
|
489
|
+
decline: "Decline",
|
|
490
|
+
delete: "Delete",
|
|
491
|
+
discard: "Discard",
|
|
492
|
+
discardChanges: "Discard Changes",
|
|
493
|
+
done: "Done",
|
|
494
|
+
edit: "Edit",
|
|
495
|
+
enterText: "Enter text here",
|
|
496
|
+
error: "Error",
|
|
497
|
+
exit: "Exit",
|
|
498
|
+
fieldRequiredError: "This field is required.",
|
|
499
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
500
|
+
less: "Less",
|
|
501
|
+
loading: "Loading",
|
|
502
|
+
maxLengthError: "Maximum length exceeded.",
|
|
503
|
+
minLengthError: "Minimum length not met.",
|
|
504
|
+
more: "More",
|
|
505
|
+
next: "Next",
|
|
506
|
+
no: "No",
|
|
507
|
+
none: "None",
|
|
508
|
+
of: "of",
|
|
509
|
+
optional: "Optional",
|
|
510
|
+
pleaseWait: "Please wait...",
|
|
511
|
+
previous: "Previous",
|
|
512
|
+
remove: "Remove",
|
|
513
|
+
required: "Required",
|
|
514
|
+
reset: "Reset",
|
|
515
|
+
save: "Save",
|
|
423
516
|
search: "Search",
|
|
424
|
-
|
|
517
|
+
select: "Select",
|
|
518
|
+
selectOption: "Select an option",
|
|
519
|
+
show: "Show",
|
|
520
|
+
showMore: "Show more",
|
|
521
|
+
showLess: "Show less",
|
|
522
|
+
submit: "Submit",
|
|
523
|
+
success: "Success",
|
|
524
|
+
update: "Update",
|
|
525
|
+
unsavedChanges: "Unsaved Changes",
|
|
526
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
527
|
+
yes: "Yes"
|
|
425
528
|
},
|
|
426
529
|
de: {
|
|
427
|
-
|
|
530
|
+
all: "Alle",
|
|
531
|
+
back: "Zur\xFCck",
|
|
532
|
+
cancel: "Abbrechen",
|
|
533
|
+
change: "\xC4ndern",
|
|
534
|
+
clear: "L\xF6schen",
|
|
535
|
+
close: "Schlie\xDFen",
|
|
536
|
+
confirm: "Best\xE4tigen",
|
|
537
|
+
decline: "Ablehnen",
|
|
538
|
+
delete: "L\xF6schen",
|
|
539
|
+
discard: "Verwerfen",
|
|
540
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
541
|
+
done: "Fertig",
|
|
542
|
+
edit: "Bearbeiten",
|
|
543
|
+
enterText: "Text hier eingeben",
|
|
544
|
+
error: "Fehler",
|
|
545
|
+
exit: "Beenden",
|
|
546
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
547
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
548
|
+
less: "Weniger",
|
|
549
|
+
loading: "L\xE4dt",
|
|
550
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
551
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
552
|
+
more: "Mehr",
|
|
553
|
+
next: "Weiter",
|
|
554
|
+
no: "Nein",
|
|
555
|
+
none: "Nichts",
|
|
556
|
+
of: "von",
|
|
557
|
+
optional: "Optional",
|
|
558
|
+
pleaseWait: "Bitte warten...",
|
|
559
|
+
previous: "Vorherige",
|
|
560
|
+
remove: "Entfernen",
|
|
561
|
+
required: "Erforderlich",
|
|
562
|
+
reset: "Zur\xFCcksetzen",
|
|
563
|
+
save: "Speichern",
|
|
428
564
|
search: "Suche",
|
|
429
|
-
|
|
565
|
+
select: "Select",
|
|
566
|
+
selectOption: "Option ausw\xE4hlen",
|
|
567
|
+
show: "Anzeigen",
|
|
568
|
+
showMore: "Mehr anzeigen",
|
|
569
|
+
showLess: "Weniger anzeigen",
|
|
570
|
+
submit: "Abschicken",
|
|
571
|
+
success: "Erfolg",
|
|
572
|
+
update: "Update",
|
|
573
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
574
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
575
|
+
yes: "Ja"
|
|
430
576
|
}
|
|
431
577
|
};
|
|
432
|
-
|
|
578
|
+
|
|
579
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
580
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
581
|
+
var defaultSearchableListTranslation = {
|
|
582
|
+
en: {
|
|
583
|
+
nothingFound: "Nothing found"
|
|
584
|
+
},
|
|
585
|
+
de: {
|
|
586
|
+
nothingFound: "Nichts gefunden"
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
var SearchableList = ({
|
|
433
590
|
overwriteTranslation,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
className = "",
|
|
443
|
-
triggerClassName = ""
|
|
591
|
+
list,
|
|
592
|
+
initialSearch = "",
|
|
593
|
+
searchMapping,
|
|
594
|
+
autoFocus,
|
|
595
|
+
minimumItemsForSearch = 6,
|
|
596
|
+
itemMapper,
|
|
597
|
+
className,
|
|
598
|
+
resultListClassName
|
|
444
599
|
}) => {
|
|
445
|
-
const translation = useTranslation(
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
return /* @__PURE__ */ jsxs4("div", { className: clsx5(className), children: [
|
|
463
|
-
label && /* @__PURE__ */ jsx6(
|
|
464
|
-
Label,
|
|
465
|
-
{
|
|
466
|
-
...label,
|
|
467
|
-
htmlFor: label.name,
|
|
468
|
-
className: clsx5(" mb-1", label.className),
|
|
469
|
-
labelType: label.labelType ?? "labelBig"
|
|
470
|
-
}
|
|
471
|
-
),
|
|
472
|
-
/* @__PURE__ */ jsxs4(
|
|
473
|
-
Menu,
|
|
474
|
-
{
|
|
475
|
-
alignment: "t_",
|
|
476
|
-
trigger: (onClick, ref) => /* @__PURE__ */ jsx6(
|
|
477
|
-
"div",
|
|
478
|
-
{
|
|
479
|
-
ref,
|
|
480
|
-
onClick: disabled ? void 0 : onClick,
|
|
481
|
-
className: clsx5(
|
|
482
|
-
borderColor,
|
|
483
|
-
"bg-menu-background text-menu-text inline-w-full justify-between items-center rounded-lg border-2 px-4 py-2 font-medium",
|
|
484
|
-
{
|
|
485
|
-
"hover:border-primary cursor-pointer": !disabled,
|
|
486
|
-
"bg-disabled-background text-disabled cursor-not-allowed": disabled
|
|
487
|
-
},
|
|
488
|
-
triggerClassName
|
|
489
|
-
),
|
|
490
|
-
children: selectedDisplay ? selectedDisplay({ items: options, disabled }) : menuButtonText
|
|
491
|
-
}
|
|
492
|
-
),
|
|
493
|
-
menuClassName: clsx5(
|
|
494
|
-
"!rounded-lg !shadow-lg !max-h-[500px] !min-w-[400px] !max-w-[70vh] !overflow-y-auto !border !border-2",
|
|
495
|
-
borderColor,
|
|
496
|
-
{ "!py-0": !enableSearch, "!pb-0": enableSearch }
|
|
497
|
-
),
|
|
498
|
-
children: [
|
|
499
|
-
enableSearch && /* @__PURE__ */ jsxs4("div", { className: "row gap-x-2 items-center px-2 py-2", children: [
|
|
500
|
-
/* @__PURE__ */ jsx6(Input, { autoFocus: true, className: "w-full", value: searchText, onChangeText: setSearchText }),
|
|
501
|
-
/* @__PURE__ */ jsx6(Search, {})
|
|
502
|
-
] }, "selectSearch"),
|
|
503
|
-
filteredOptions.map((option, index) => /* @__PURE__ */ jsx6(
|
|
504
|
-
MenuItem,
|
|
505
|
-
{
|
|
506
|
-
className: clsx5({
|
|
507
|
-
"cursor-not-allowed !bg-disabled-background !text-disabled-text hover:brightness-100": !!option.disabled,
|
|
508
|
-
"cursor-pointer": !option.disabled
|
|
509
|
-
}),
|
|
510
|
-
children: /* @__PURE__ */ jsxs4(
|
|
511
|
-
"div",
|
|
512
|
-
{
|
|
513
|
-
className: clsx5("overflow-hidden whitespace-nowrap text-ellipsis row items-center gap-x-2", option.className),
|
|
514
|
-
onClick: () => {
|
|
515
|
-
if (!option.disabled) {
|
|
516
|
-
onChange(options.map((value) => value.value === option.value ? {
|
|
517
|
-
...option,
|
|
518
|
-
selected: !value.selected
|
|
519
|
-
} : value));
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
|
-
children: [
|
|
523
|
-
/* @__PURE__ */ jsx6(Checkbox, { checked: option.selected, disabled: option.disabled, size: "small" }),
|
|
524
|
-
option.label
|
|
525
|
-
]
|
|
526
|
-
}
|
|
527
|
-
)
|
|
528
|
-
},
|
|
529
|
-
`item${index}`
|
|
530
|
-
))
|
|
531
|
-
]
|
|
532
|
-
}
|
|
533
|
-
)
|
|
600
|
+
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
601
|
+
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
602
|
+
return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
|
|
603
|
+
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
604
|
+
/* @__PURE__ */ jsx5(
|
|
605
|
+
Input,
|
|
606
|
+
{
|
|
607
|
+
value: search,
|
|
608
|
+
onChangeText: setSearch,
|
|
609
|
+
placeholder: translation("search"),
|
|
610
|
+
autoFocus,
|
|
611
|
+
className: "w-full"
|
|
612
|
+
}
|
|
613
|
+
),
|
|
614
|
+
/* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
|
|
615
|
+
] }),
|
|
616
|
+
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") })
|
|
534
617
|
] });
|
|
535
618
|
};
|
|
536
619
|
|
|
620
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
621
|
+
import clsx5 from "clsx";
|
|
622
|
+
import { Check } from "lucide-react";
|
|
623
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
624
|
+
var Tile = ({
|
|
625
|
+
title,
|
|
626
|
+
description,
|
|
627
|
+
onClick,
|
|
628
|
+
isSelected = false,
|
|
629
|
+
isDisabled = false,
|
|
630
|
+
prefix,
|
|
631
|
+
suffix,
|
|
632
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
633
|
+
selectedClassName = " bg-primary/20",
|
|
634
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
635
|
+
className
|
|
636
|
+
}) => {
|
|
637
|
+
return /* @__PURE__ */ jsxs4(
|
|
638
|
+
"div",
|
|
639
|
+
{
|
|
640
|
+
className: clsx5(
|
|
641
|
+
"row gap-x-2 w-full items-center",
|
|
642
|
+
{
|
|
643
|
+
[normalClassName]: !!onClick && !isDisabled,
|
|
644
|
+
[selectedClassName]: isSelected && !isDisabled,
|
|
645
|
+
[disabledClassName]: isDisabled
|
|
646
|
+
},
|
|
647
|
+
className
|
|
648
|
+
),
|
|
649
|
+
onClick: isDisabled ? void 0 : onClick,
|
|
650
|
+
children: [
|
|
651
|
+
prefix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0),
|
|
652
|
+
/* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
|
|
653
|
+
/* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
654
|
+
!!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
|
|
655
|
+
] }),
|
|
656
|
+
suffix
|
|
657
|
+
]
|
|
658
|
+
}
|
|
659
|
+
);
|
|
660
|
+
};
|
|
661
|
+
|
|
537
662
|
// src/components/layout-and-navigation/Chip.tsx
|
|
538
663
|
import clsx6 from "clsx";
|
|
539
664
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -599,99 +724,163 @@ var ChipList = ({
|
|
|
599
724
|
)) });
|
|
600
725
|
};
|
|
601
726
|
|
|
602
|
-
// src/
|
|
603
|
-
import {
|
|
604
|
-
|
|
727
|
+
// src/hooks/useOutsideClick.ts
|
|
728
|
+
import { useEffect as useEffect6 } from "react";
|
|
729
|
+
var useOutsideClick = (refs, handler) => {
|
|
730
|
+
useEffect6(() => {
|
|
731
|
+
const listener = (event) => {
|
|
732
|
+
if (event.target === null) return;
|
|
733
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
handler();
|
|
737
|
+
};
|
|
738
|
+
document.addEventListener("mousedown", listener);
|
|
739
|
+
document.addEventListener("touchstart", listener);
|
|
740
|
+
return () => {
|
|
741
|
+
document.removeEventListener("mousedown", listener);
|
|
742
|
+
document.removeEventListener("touchstart", listener);
|
|
743
|
+
};
|
|
744
|
+
}, [refs, handler]);
|
|
745
|
+
};
|
|
605
746
|
|
|
606
|
-
// src/components/user-action/
|
|
607
|
-
import clsx7 from "clsx";
|
|
747
|
+
// src/components/user-action/MultiSelect.tsx
|
|
608
748
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
609
|
-
var
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
medium: "icon-btn-md",
|
|
617
|
-
large: "icon-btn-lg"
|
|
618
|
-
};
|
|
619
|
-
var ButtonUtil = {
|
|
620
|
-
paddingMapping,
|
|
621
|
-
iconPaddingMapping
|
|
749
|
+
var defaultMultiSelectTranslation = {
|
|
750
|
+
en: {
|
|
751
|
+
selected: `{{amount}} selected`
|
|
752
|
+
},
|
|
753
|
+
de: {
|
|
754
|
+
selected: `{{amount}} ausgew\xE4hlt`
|
|
755
|
+
}
|
|
622
756
|
};
|
|
623
|
-
var
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
757
|
+
var MultiSelect = ({
|
|
758
|
+
overwriteTranslation,
|
|
759
|
+
options,
|
|
760
|
+
label,
|
|
761
|
+
onChange,
|
|
762
|
+
hintText,
|
|
763
|
+
isDisabled = false,
|
|
764
|
+
isSearchEnabled = false,
|
|
765
|
+
selectedDisplayOverwrite,
|
|
766
|
+
useChipDisplay = false,
|
|
767
|
+
className = ""
|
|
633
768
|
}) => {
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
769
|
+
const translation = useTranslation([formTranslation, defaultMultiSelectTranslation], overwriteTranslation);
|
|
770
|
+
const triggerRef = useRef2(null);
|
|
771
|
+
const menuRef = useRef2(null);
|
|
772
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
773
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
774
|
+
const selectedItems = options.filter((value) => value.selected);
|
|
775
|
+
const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
|
|
776
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7(className), children: [
|
|
777
|
+
label && /* @__PURE__ */ jsx8(
|
|
778
|
+
Label,
|
|
779
|
+
{
|
|
780
|
+
...label,
|
|
781
|
+
htmlFor: label.name,
|
|
782
|
+
className: clsx7(" mb-1", label.className),
|
|
783
|
+
labelType: label.labelType ?? "labelBig"
|
|
784
|
+
}
|
|
785
|
+
),
|
|
786
|
+
/* @__PURE__ */ jsxs6("div", { className: "relative", children: [
|
|
787
|
+
/* @__PURE__ */ jsxs6(
|
|
788
|
+
"button",
|
|
650
789
|
{
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
790
|
+
ref: triggerRef,
|
|
791
|
+
className: clsx7(
|
|
792
|
+
"btn-md justify-between w-full border-2 h-auto",
|
|
793
|
+
{
|
|
794
|
+
"rounded-b-lg": !open,
|
|
795
|
+
"bg-menu-background border-menu-border hover:border-primary": !isDisabled,
|
|
796
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
797
|
+
}
|
|
798
|
+
),
|
|
799
|
+
onClick: () => setIsOpen(!isOpen),
|
|
800
|
+
disabled: isDisabled,
|
|
801
|
+
children: [
|
|
802
|
+
!isShowingHint && /* @__PURE__ */ jsx8("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? (useChipDisplay && selectedItems ? /* @__PURE__ */ jsx8(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) : translation("selected", { replacements: { amount: selectedItems.length.toString() } })) }),
|
|
803
|
+
isShowingHint && /* @__PURE__ */ jsx8("span", { className: "textstyle-description", children: hintText ?? translation("select") }),
|
|
804
|
+
isOpen ? /* @__PURE__ */ jsx8(ChevronUp, { size: 24, className: "min-w-6" }) : /* @__PURE__ */ jsx8(ChevronDown, { className: "min-w-6" })
|
|
805
|
+
]
|
|
806
|
+
}
|
|
656
807
|
),
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
808
|
+
isOpen && /* @__PURE__ */ jsxs6(
|
|
809
|
+
"div",
|
|
810
|
+
{
|
|
811
|
+
ref: menuRef,
|
|
812
|
+
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",
|
|
813
|
+
children: [
|
|
814
|
+
/* @__PURE__ */ jsx8(
|
|
815
|
+
SearchableList,
|
|
816
|
+
{
|
|
817
|
+
list: options,
|
|
818
|
+
minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
|
|
819
|
+
searchMapping: (item) => item.searchTags,
|
|
820
|
+
itemMapper: (option, index) => /* @__PURE__ */ jsx8(
|
|
821
|
+
Tile,
|
|
822
|
+
{
|
|
823
|
+
isSelected: option.selected,
|
|
824
|
+
className: "px-2 py-1 rounded-md",
|
|
825
|
+
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
826
|
+
title: { value: option.label, className: "font-semibold" },
|
|
827
|
+
onClick: () => {
|
|
828
|
+
onChange(options.map((value) => value.value === option.value ? {
|
|
829
|
+
...option,
|
|
830
|
+
selected: !value.selected
|
|
831
|
+
} : value));
|
|
832
|
+
},
|
|
833
|
+
isDisabled: option.disabled
|
|
834
|
+
},
|
|
835
|
+
index
|
|
836
|
+
)
|
|
837
|
+
}
|
|
838
|
+
),
|
|
839
|
+
/* @__PURE__ */ jsxs6("div", { className: "row justify-between mt-2", children: [
|
|
840
|
+
/* @__PURE__ */ jsxs6("div", { className: "row gap-x-2", children: [
|
|
841
|
+
/* @__PURE__ */ jsx8(
|
|
842
|
+
SolidButton,
|
|
843
|
+
{
|
|
844
|
+
color: "neutral",
|
|
845
|
+
size: "small",
|
|
846
|
+
onClick: () => {
|
|
847
|
+
onChange(options.map((option) => ({
|
|
848
|
+
...option,
|
|
849
|
+
selected: !option.disabled
|
|
850
|
+
})));
|
|
851
|
+
},
|
|
852
|
+
disabled: options.every((value) => value.selected || value.disabled),
|
|
853
|
+
children: translation("all")
|
|
854
|
+
}
|
|
855
|
+
),
|
|
856
|
+
/* @__PURE__ */ jsx8(
|
|
857
|
+
SolidButton,
|
|
858
|
+
{
|
|
859
|
+
color: "neutral",
|
|
860
|
+
size: "small",
|
|
861
|
+
onClick: () => {
|
|
862
|
+
onChange(options.map((option) => ({
|
|
863
|
+
...option,
|
|
864
|
+
selected: false
|
|
865
|
+
})));
|
|
866
|
+
},
|
|
867
|
+
children: translation("none")
|
|
868
|
+
}
|
|
869
|
+
)
|
|
870
|
+
] }),
|
|
871
|
+
/* @__PURE__ */ jsx8(SolidButton, { size: "small", onClick: () => setIsOpen(false), children: "Done" })
|
|
872
|
+
] })
|
|
873
|
+
]
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
] })
|
|
877
|
+
] });
|
|
683
878
|
};
|
|
684
879
|
|
|
685
880
|
// src/components/properties/PropertyBase.tsx
|
|
881
|
+
import { AlertTriangle } from "lucide-react";
|
|
882
|
+
import clsx8 from "clsx";
|
|
686
883
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
687
|
-
var defaultPropertyBaseTranslation = {
|
|
688
|
-
en: {
|
|
689
|
-
remove: "Remove"
|
|
690
|
-
},
|
|
691
|
-
de: {
|
|
692
|
-
remove: "Entfernen"
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
884
|
var PropertyBase = ({
|
|
696
885
|
overwriteTranslation,
|
|
697
886
|
name,
|
|
@@ -703,7 +892,7 @@ var PropertyBase = ({
|
|
|
703
892
|
onRemove,
|
|
704
893
|
className = ""
|
|
705
894
|
}) => {
|
|
706
|
-
const translation = useTranslation(
|
|
895
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
707
896
|
const requiredAndNoValue = softRequired && !hasValue;
|
|
708
897
|
return /* @__PURE__ */ jsxs7("div", { className: clsx8("row gap-x-0 group", className), children: [
|
|
709
898
|
/* @__PURE__ */ jsxs7(
|
|
@@ -722,7 +911,7 @@ var PropertyBase = ({
|
|
|
722
911
|
/* @__PURE__ */ jsxs7(
|
|
723
912
|
"div",
|
|
724
913
|
{
|
|
725
|
-
className: clsx8("row grow justify-between items-center rounded-r-xl border-2 border-l-0", {
|
|
914
|
+
className: clsx8("row gap-x-0 grow justify-between items-center rounded-r-xl border-2 border-l-0", {
|
|
726
915
|
"bg-surface group-hover:border-primary": !requiredAndNoValue,
|
|
727
916
|
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
728
917
|
}, className),
|
|
@@ -736,7 +925,7 @@ var PropertyBase = ({
|
|
|
736
925
|
color: "negative",
|
|
737
926
|
className: clsx8("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
738
927
|
disabled: !hasValue || readOnly,
|
|
739
|
-
children: translation
|
|
928
|
+
children: translation("remove")
|
|
740
929
|
}
|
|
741
930
|
)
|
|
742
931
|
]
|
|
@@ -747,14 +936,6 @@ var PropertyBase = ({
|
|
|
747
936
|
|
|
748
937
|
// src/components/properties/MultiSelectProperty.tsx
|
|
749
938
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
750
|
-
var defaultMultiSelectPropertyTranslation = {
|
|
751
|
-
en: {
|
|
752
|
-
select: "Select"
|
|
753
|
-
},
|
|
754
|
-
de: {
|
|
755
|
-
select: "Ausw\xE4hlen"
|
|
756
|
-
}
|
|
757
|
-
};
|
|
758
939
|
var MultiSelectProperty = ({
|
|
759
940
|
overwriteTranslation,
|
|
760
941
|
options,
|
|
@@ -764,12 +945,8 @@ var MultiSelectProperty = ({
|
|
|
764
945
|
onRemove,
|
|
765
946
|
...multiSelectProps
|
|
766
947
|
}) => {
|
|
767
|
-
const translation = useTranslation(
|
|
948
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
768
949
|
const hasValue = options.some((value) => value.selected);
|
|
769
|
-
let triggerClassName;
|
|
770
|
-
if (softRequired && !hasValue) {
|
|
771
|
-
triggerClassName = "border-warning hover:brightness-90";
|
|
772
|
-
}
|
|
773
950
|
return /* @__PURE__ */ jsx10(
|
|
774
951
|
PropertyBase,
|
|
775
952
|
{
|
|
@@ -788,17 +965,10 @@ var MultiSelectProperty = ({
|
|
|
788
965
|
{
|
|
789
966
|
...multiSelectProps,
|
|
790
967
|
className: clsx9("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
791
|
-
triggerClassName,
|
|
792
|
-
selectedDisplay: ({ items }) => {
|
|
793
|
-
const selected = items.filter((value) => value.selected);
|
|
794
|
-
if (selected.length === 0) {
|
|
795
|
-
return /* @__PURE__ */ jsx10("span", { children: "Select" });
|
|
796
|
-
}
|
|
797
|
-
return /* @__PURE__ */ jsx10(ChipList, { list: selected.map((value) => ({ children: value.label })) });
|
|
798
|
-
},
|
|
799
968
|
options,
|
|
800
|
-
|
|
801
|
-
|
|
969
|
+
isDisabled: readOnly,
|
|
970
|
+
useChipDisplay: true,
|
|
971
|
+
hintText: `${translation("select")}...`
|
|
802
972
|
}
|
|
803
973
|
)
|
|
804
974
|
}
|