@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
|
@@ -32,8 +32,8 @@ __export(SelectProperty_exports, {
|
|
|
32
32
|
SingleSelectProperty: () => SingleSelectProperty
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(SelectProperty_exports);
|
|
35
|
-
var
|
|
36
|
-
var
|
|
35
|
+
var import_lucide_react5 = require("lucide-react");
|
|
36
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
37
37
|
|
|
38
38
|
// src/localization/LanguageProvider.tsx
|
|
39
39
|
var import_react2 = require("react");
|
|
@@ -63,26 +63,339 @@ var LanguageContext = (0, import_react2.createContext)({
|
|
|
63
63
|
var useLanguage = () => (0, import_react2.useContext)(LanguageContext);
|
|
64
64
|
|
|
65
65
|
// src/localization/useTranslation.ts
|
|
66
|
-
var useTranslation = (
|
|
67
|
-
const { language: languageProp, translation: overwrite } =
|
|
66
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
67
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
68
68
|
const { language: inferredLanguage } = useLanguage();
|
|
69
69
|
const usedLanguage = languageProp ?? inferredLanguage;
|
|
70
|
-
|
|
71
|
-
if (overwrite
|
|
72
|
-
|
|
70
|
+
const usedTranslations = [...translations];
|
|
71
|
+
if (overwrite) {
|
|
72
|
+
usedTranslations.push(overwrite);
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return (key, options) => {
|
|
75
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
76
|
+
try {
|
|
77
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
78
|
+
const translation = translations[i];
|
|
79
|
+
const localizedTranslation = translation[usedLanguage];
|
|
80
|
+
if (!localizedTranslation) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const value = localizedTranslation[key];
|
|
84
|
+
if (!value) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
let forProcessing;
|
|
88
|
+
if (typeof value !== "string") {
|
|
89
|
+
if (count <= 0 && value?.zero) {
|
|
90
|
+
forProcessing = value.zero;
|
|
91
|
+
} else if (count === 1 && value?.one) {
|
|
92
|
+
forProcessing = value.one;
|
|
93
|
+
} else if (count === 2 && value?.two) {
|
|
94
|
+
forProcessing = value.two;
|
|
95
|
+
} else if (count <= 10 && value?.few) {
|
|
96
|
+
forProcessing = value.few;
|
|
97
|
+
} else if (count > 10 && value?.many) {
|
|
98
|
+
forProcessing = value.many;
|
|
99
|
+
} else {
|
|
100
|
+
forProcessing = value.other;
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
forProcessing = value;
|
|
104
|
+
}
|
|
105
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
106
|
+
return replacements[placeholder] ?? `{{${placeholder}}}`;
|
|
107
|
+
});
|
|
108
|
+
return forProcessing;
|
|
109
|
+
}
|
|
110
|
+
} catch (e) {
|
|
111
|
+
console.error(e);
|
|
112
|
+
}
|
|
113
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
114
|
+
};
|
|
75
115
|
};
|
|
76
116
|
|
|
77
|
-
// src/components/
|
|
78
|
-
var import_react5 = require("@headlessui/react");
|
|
117
|
+
// src/components/properties/PropertyBase.tsx
|
|
79
118
|
var import_lucide_react = require("lucide-react");
|
|
80
|
-
var
|
|
81
|
-
var import_clsx3 = __toESM(require("clsx"));
|
|
119
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
82
120
|
|
|
83
|
-
// src/components/user-action/
|
|
121
|
+
// src/components/user-action/Button.tsx
|
|
84
122
|
var import_clsx = __toESM(require("clsx"));
|
|
85
123
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
124
|
+
var paddingMapping = {
|
|
125
|
+
small: "btn-sm",
|
|
126
|
+
medium: "btn-md",
|
|
127
|
+
large: "btn-lg"
|
|
128
|
+
};
|
|
129
|
+
var iconPaddingMapping = {
|
|
130
|
+
small: "icon-btn-sm",
|
|
131
|
+
medium: "icon-btn-md",
|
|
132
|
+
large: "icon-btn-lg"
|
|
133
|
+
};
|
|
134
|
+
var ButtonUtil = {
|
|
135
|
+
paddingMapping,
|
|
136
|
+
iconPaddingMapping
|
|
137
|
+
};
|
|
138
|
+
var TextButton = ({
|
|
139
|
+
children,
|
|
140
|
+
disabled = false,
|
|
141
|
+
color = "neutral",
|
|
142
|
+
size = "medium",
|
|
143
|
+
startIcon,
|
|
144
|
+
endIcon,
|
|
145
|
+
onClick,
|
|
146
|
+
className,
|
|
147
|
+
...restProps
|
|
148
|
+
}) => {
|
|
149
|
+
const colorClasses = {
|
|
150
|
+
primary: "bg-transparent text-button-text-primary-text",
|
|
151
|
+
negative: "bg-transparent text-button-text-negative-text",
|
|
152
|
+
neutral: "bg-transparent text-button-text-neutral-text"
|
|
153
|
+
}[color];
|
|
154
|
+
const iconColorClasses = {
|
|
155
|
+
primary: "text-button-text-primary-icon",
|
|
156
|
+
negative: "text-button-text-negative-icon",
|
|
157
|
+
neutral: "text-button-text-neutral-icon"
|
|
158
|
+
}[color];
|
|
159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
onClick: disabled ? void 0 : onClick,
|
|
163
|
+
disabled: disabled || onClick === void 0,
|
|
164
|
+
className: (0, import_clsx.default)(
|
|
165
|
+
{
|
|
166
|
+
"text-disabled-text cursor-not-allowed": disabled,
|
|
167
|
+
[(0, import_clsx.default)(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
|
|
168
|
+
},
|
|
169
|
+
ButtonUtil.paddingMapping[size],
|
|
170
|
+
className
|
|
171
|
+
),
|
|
172
|
+
...restProps,
|
|
173
|
+
children: [
|
|
174
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
175
|
+
"span",
|
|
176
|
+
{
|
|
177
|
+
className: (0, import_clsx.default)({
|
|
178
|
+
[iconColorClasses]: !disabled,
|
|
179
|
+
[`text-disabled-icon`]: disabled
|
|
180
|
+
}),
|
|
181
|
+
children: startIcon
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
children,
|
|
185
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
186
|
+
"span",
|
|
187
|
+
{
|
|
188
|
+
className: (0, import_clsx.default)({
|
|
189
|
+
[iconColorClasses]: !disabled,
|
|
190
|
+
[`text-disabled-icon`]: disabled
|
|
191
|
+
}),
|
|
192
|
+
children: endIcon
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
var IconButton = ({
|
|
200
|
+
children,
|
|
201
|
+
disabled = false,
|
|
202
|
+
color = "primary",
|
|
203
|
+
size = "medium",
|
|
204
|
+
onClick,
|
|
205
|
+
className,
|
|
206
|
+
...restProps
|
|
207
|
+
}) => {
|
|
208
|
+
const colorClasses = {
|
|
209
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
210
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
211
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
212
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
213
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
214
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
215
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
216
|
+
}[color];
|
|
217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
218
|
+
"button",
|
|
219
|
+
{
|
|
220
|
+
onClick: disabled ? void 0 : onClick,
|
|
221
|
+
disabled: disabled || onClick === void 0,
|
|
222
|
+
className: (0, import_clsx.default)(
|
|
223
|
+
{
|
|
224
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
225
|
+
[(0, import_clsx.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
226
|
+
},
|
|
227
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
228
|
+
className
|
|
229
|
+
),
|
|
230
|
+
...restProps,
|
|
231
|
+
children
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// src/localization/defaults/form.ts
|
|
237
|
+
var formTranslation = {
|
|
238
|
+
en: {
|
|
239
|
+
all: "All",
|
|
240
|
+
back: "Back",
|
|
241
|
+
cancel: "Cancel",
|
|
242
|
+
change: "Change",
|
|
243
|
+
clear: "Clear",
|
|
244
|
+
close: "Close",
|
|
245
|
+
confirm: "Confirm",
|
|
246
|
+
decline: "Decline",
|
|
247
|
+
delete: "Delete",
|
|
248
|
+
discard: "Discard",
|
|
249
|
+
discardChanges: "Discard Changes",
|
|
250
|
+
done: "Done",
|
|
251
|
+
edit: "Edit",
|
|
252
|
+
enterText: "Enter text here",
|
|
253
|
+
error: "Error",
|
|
254
|
+
exit: "Exit",
|
|
255
|
+
fieldRequiredError: "This field is required.",
|
|
256
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
257
|
+
less: "Less",
|
|
258
|
+
loading: "Loading",
|
|
259
|
+
maxLengthError: "Maximum length exceeded.",
|
|
260
|
+
minLengthError: "Minimum length not met.",
|
|
261
|
+
more: "More",
|
|
262
|
+
next: "Next",
|
|
263
|
+
no: "No",
|
|
264
|
+
none: "None",
|
|
265
|
+
of: "of",
|
|
266
|
+
optional: "Optional",
|
|
267
|
+
pleaseWait: "Please wait...",
|
|
268
|
+
previous: "Previous",
|
|
269
|
+
remove: "Remove",
|
|
270
|
+
required: "Required",
|
|
271
|
+
reset: "Reset",
|
|
272
|
+
save: "Save",
|
|
273
|
+
search: "Search",
|
|
274
|
+
select: "Select",
|
|
275
|
+
selectOption: "Select an option",
|
|
276
|
+
show: "Show",
|
|
277
|
+
showMore: "Show more",
|
|
278
|
+
showLess: "Show less",
|
|
279
|
+
submit: "Submit",
|
|
280
|
+
success: "Success",
|
|
281
|
+
update: "Update",
|
|
282
|
+
unsavedChanges: "Unsaved Changes",
|
|
283
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
284
|
+
yes: "Yes"
|
|
285
|
+
},
|
|
286
|
+
de: {
|
|
287
|
+
all: "Alle",
|
|
288
|
+
back: "Zur\xFCck",
|
|
289
|
+
cancel: "Abbrechen",
|
|
290
|
+
change: "\xC4ndern",
|
|
291
|
+
clear: "L\xF6schen",
|
|
292
|
+
close: "Schlie\xDFen",
|
|
293
|
+
confirm: "Best\xE4tigen",
|
|
294
|
+
decline: "Ablehnen",
|
|
295
|
+
delete: "L\xF6schen",
|
|
296
|
+
discard: "Verwerfen",
|
|
297
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
298
|
+
done: "Fertig",
|
|
299
|
+
edit: "Bearbeiten",
|
|
300
|
+
enterText: "Text hier eingeben",
|
|
301
|
+
error: "Fehler",
|
|
302
|
+
exit: "Beenden",
|
|
303
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
304
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
305
|
+
less: "Weniger",
|
|
306
|
+
loading: "L\xE4dt",
|
|
307
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
308
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
309
|
+
more: "Mehr",
|
|
310
|
+
next: "Weiter",
|
|
311
|
+
no: "Nein",
|
|
312
|
+
none: "Nichts",
|
|
313
|
+
of: "von",
|
|
314
|
+
optional: "Optional",
|
|
315
|
+
pleaseWait: "Bitte warten...",
|
|
316
|
+
previous: "Vorherige",
|
|
317
|
+
remove: "Entfernen",
|
|
318
|
+
required: "Erforderlich",
|
|
319
|
+
reset: "Zur\xFCcksetzen",
|
|
320
|
+
save: "Speichern",
|
|
321
|
+
search: "Suche",
|
|
322
|
+
select: "Select",
|
|
323
|
+
selectOption: "Option ausw\xE4hlen",
|
|
324
|
+
show: "Anzeigen",
|
|
325
|
+
showMore: "Mehr anzeigen",
|
|
326
|
+
showLess: "Weniger anzeigen",
|
|
327
|
+
submit: "Abschicken",
|
|
328
|
+
success: "Erfolg",
|
|
329
|
+
update: "Update",
|
|
330
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
331
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
332
|
+
yes: "Ja"
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// src/components/properties/PropertyBase.tsx
|
|
337
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
338
|
+
var PropertyBase = ({
|
|
339
|
+
overwriteTranslation,
|
|
340
|
+
name,
|
|
341
|
+
input,
|
|
342
|
+
softRequired = false,
|
|
343
|
+
hasValue,
|
|
344
|
+
icon,
|
|
345
|
+
readOnly,
|
|
346
|
+
onRemove,
|
|
347
|
+
className = ""
|
|
348
|
+
}) => {
|
|
349
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
350
|
+
const requiredAndNoValue = softRequired && !hasValue;
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)("row gap-x-0 group", className), children: [
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
353
|
+
"div",
|
|
354
|
+
{
|
|
355
|
+
className: (0, import_clsx2.default)("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
|
|
356
|
+
"bg-property-title-background property-title-text group-hover:border-primary": !requiredAndNoValue,
|
|
357
|
+
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
358
|
+
}, className),
|
|
359
|
+
children: [
|
|
360
|
+
icon,
|
|
361
|
+
name
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
366
|
+
"div",
|
|
367
|
+
{
|
|
368
|
+
className: (0, import_clsx2.default)("row gap-x-0 grow justify-between items-center rounded-r-xl border-2 border-l-0", {
|
|
369
|
+
"bg-surface group-hover:border-primary": !requiredAndNoValue,
|
|
370
|
+
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
371
|
+
}, className),
|
|
372
|
+
children: [
|
|
373
|
+
input({ softRequired, hasValue }),
|
|
374
|
+
requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-warning pr-4", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.AlertTriangle, { size: 24 }) }),
|
|
375
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
376
|
+
TextButton,
|
|
377
|
+
{
|
|
378
|
+
onClick: onRemove,
|
|
379
|
+
color: "negative",
|
|
380
|
+
className: (0, import_clsx2.default)("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
381
|
+
disabled: !hasValue || readOnly,
|
|
382
|
+
children: translation("remove")
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
)
|
|
388
|
+
] });
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// src/components/user-action/Select.tsx
|
|
392
|
+
var import_lucide_react4 = require("lucide-react");
|
|
393
|
+
var import_react7 = require("react");
|
|
394
|
+
var import_clsx7 = __toESM(require("clsx"));
|
|
395
|
+
|
|
396
|
+
// src/components/user-action/Label.tsx
|
|
397
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
398
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
86
399
|
var styleMapping = {
|
|
87
400
|
labelSmall: "textstyle-label-sm",
|
|
88
401
|
labelMedium: "textstyle-label-md",
|
|
@@ -95,20 +408,16 @@ var Label = ({
|
|
|
95
408
|
className,
|
|
96
409
|
...props
|
|
97
410
|
}) => {
|
|
98
|
-
return /* @__PURE__ */ (0,
|
|
411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { ...props, className: (0, import_clsx3.default)(styleMapping[labelType], className), children: children ? children : name });
|
|
99
412
|
};
|
|
100
413
|
|
|
101
|
-
// src/
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
const mappedSearchKeywords = mapping(object).map((value) => value.toLowerCase().trim());
|
|
105
|
-
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
106
|
-
});
|
|
107
|
-
};
|
|
414
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
415
|
+
var import_lucide_react2 = require("lucide-react");
|
|
416
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
108
417
|
|
|
109
418
|
// src/components/user-action/Input.tsx
|
|
110
419
|
var import_react4 = require("react");
|
|
111
|
-
var
|
|
420
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
112
421
|
|
|
113
422
|
// src/hooks/useSaveDelay.ts
|
|
114
423
|
var import_react3 = require("react");
|
|
@@ -154,7 +463,7 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
154
463
|
var noop = () => void 0;
|
|
155
464
|
|
|
156
465
|
// src/components/user-action/Input.tsx
|
|
157
|
-
var
|
|
466
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
158
467
|
var Input = ({
|
|
159
468
|
id,
|
|
160
469
|
type = "text",
|
|
@@ -180,9 +489,9 @@ var Input = ({
|
|
|
180
489
|
ref.current?.focus();
|
|
181
490
|
}
|
|
182
491
|
}, [autoFocus]);
|
|
183
|
-
return /* @__PURE__ */ (0,
|
|
184
|
-
label && /* @__PURE__ */ (0,
|
|
185
|
-
/* @__PURE__ */ (0,
|
|
492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)({ "w-full": expanded }, containerClassName), children: [
|
|
493
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx4.default)("mb-1", label.className) }),
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
186
495
|
"input",
|
|
187
496
|
{
|
|
188
497
|
ref,
|
|
@@ -226,13 +535,13 @@ var FormInput = (0, import_react4.forwardRef)(function FormInput2({
|
|
|
226
535
|
required,
|
|
227
536
|
...restProps
|
|
228
537
|
}, ref) {
|
|
229
|
-
const input = /* @__PURE__ */ (0,
|
|
538
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
230
539
|
"input",
|
|
231
540
|
{
|
|
232
541
|
ref,
|
|
233
542
|
id,
|
|
234
543
|
...restProps,
|
|
235
|
-
className: (0,
|
|
544
|
+
className: (0, import_clsx4.default)(
|
|
236
545
|
{
|
|
237
546
|
"focus:border-primary focus:ring-primary": !errorText,
|
|
238
547
|
"focus:border-negative focus:ring-negative text-negative": !!errorText
|
|
@@ -241,286 +550,240 @@ var FormInput = (0, import_react4.forwardRef)(function FormInput2({
|
|
|
241
550
|
)
|
|
242
551
|
}
|
|
243
552
|
);
|
|
244
|
-
return /* @__PURE__ */ (0,
|
|
245
|
-
labelText && /* @__PURE__ */ (0,
|
|
553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("flex flex-col gap-y-1", containerClassName), children: [
|
|
554
|
+
labelText && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: id, className: (0, import_clsx4.default)("textstyle-label-md", labelClassName), children: [
|
|
246
555
|
labelText,
|
|
247
|
-
required && /* @__PURE__ */ (0,
|
|
556
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
248
557
|
] }),
|
|
249
558
|
input,
|
|
250
|
-
errorText && /* @__PURE__ */ (0,
|
|
559
|
+
errorText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: id, className: (0, import_clsx4.default)("text-negative", errorClassName), children: errorText })
|
|
251
560
|
] });
|
|
252
561
|
});
|
|
253
562
|
|
|
563
|
+
// src/hooks/useSearch.ts
|
|
564
|
+
var import_react5 = require("react");
|
|
565
|
+
|
|
566
|
+
// src/util/simpleSearch.ts
|
|
567
|
+
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
568
|
+
return objects.filter((object) => {
|
|
569
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
570
|
+
if (!mappedSearchKeywords) {
|
|
571
|
+
return true;
|
|
572
|
+
}
|
|
573
|
+
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
// src/hooks/useSearch.ts
|
|
578
|
+
var useSearch = ({
|
|
579
|
+
list,
|
|
580
|
+
initialSearch,
|
|
581
|
+
searchMapping
|
|
582
|
+
}) => {
|
|
583
|
+
const [items, setItems] = (0, import_react5.useState)(list);
|
|
584
|
+
const [search, setSearch] = (0, import_react5.useState)(initialSearch);
|
|
585
|
+
(0, import_react5.useEffect)(() => {
|
|
586
|
+
setItems(list);
|
|
587
|
+
}, [list]);
|
|
588
|
+
const result = (0, import_react5.useMemo)(
|
|
589
|
+
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
590
|
+
[search, items, searchMapping]
|
|
591
|
+
);
|
|
592
|
+
return {
|
|
593
|
+
result,
|
|
594
|
+
hasResult: result.length > 0,
|
|
595
|
+
allItems: items,
|
|
596
|
+
setItems,
|
|
597
|
+
search,
|
|
598
|
+
setSearch
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
603
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
604
|
+
var defaultSearchableListTranslation = {
|
|
605
|
+
en: {
|
|
606
|
+
nothingFound: "Nothing found"
|
|
607
|
+
},
|
|
608
|
+
de: {
|
|
609
|
+
nothingFound: "Nichts gefunden"
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
var SearchableList = ({
|
|
613
|
+
overwriteTranslation,
|
|
614
|
+
list,
|
|
615
|
+
initialSearch = "",
|
|
616
|
+
searchMapping,
|
|
617
|
+
autoFocus,
|
|
618
|
+
minimumItemsForSearch = 6,
|
|
619
|
+
itemMapper,
|
|
620
|
+
className,
|
|
621
|
+
resultListClassName
|
|
622
|
+
}) => {
|
|
623
|
+
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
624
|
+
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)("col gap-y-2", className), children: [
|
|
626
|
+
list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
628
|
+
Input,
|
|
629
|
+
{
|
|
630
|
+
value: search,
|
|
631
|
+
onChangeText: setSearch,
|
|
632
|
+
placeholder: translation("search"),
|
|
633
|
+
autoFocus,
|
|
634
|
+
className: "w-full"
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Search, { className: "w-full h-full" }) })
|
|
638
|
+
] }),
|
|
639
|
+
hasResult ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: (0, import_clsx5.default)("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
|
|
640
|
+
] });
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
644
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
645
|
+
var import_lucide_react3 = require("lucide-react");
|
|
646
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
647
|
+
var Tile = ({
|
|
648
|
+
title,
|
|
649
|
+
description,
|
|
650
|
+
onClick,
|
|
651
|
+
isSelected = false,
|
|
652
|
+
isDisabled = false,
|
|
653
|
+
prefix,
|
|
654
|
+
suffix,
|
|
655
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
656
|
+
selectedClassName = " bg-primary/20",
|
|
657
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
658
|
+
className
|
|
659
|
+
}) => {
|
|
660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
661
|
+
"div",
|
|
662
|
+
{
|
|
663
|
+
className: (0, import_clsx6.default)(
|
|
664
|
+
"row gap-x-2 w-full items-center",
|
|
665
|
+
{
|
|
666
|
+
[normalClassName]: !!onClick && !isDisabled,
|
|
667
|
+
[selectedClassName]: isSelected && !isDisabled,
|
|
668
|
+
[disabledClassName]: isDisabled
|
|
669
|
+
},
|
|
670
|
+
className
|
|
671
|
+
),
|
|
672
|
+
onClick: isDisabled ? void 0 : onClick,
|
|
673
|
+
children: [
|
|
674
|
+
prefix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Check, { size: 24 }) : void 0),
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "col gap-y-0 w-full", children: [
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h4", { className: (0, import_clsx6.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
677
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: (0, import_clsx6.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
678
|
+
] }),
|
|
679
|
+
suffix
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
);
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// src/hooks/useOutsideClick.ts
|
|
686
|
+
var import_react6 = require("react");
|
|
687
|
+
var useOutsideClick = (refs, handler) => {
|
|
688
|
+
(0, import_react6.useEffect)(() => {
|
|
689
|
+
const listener = (event) => {
|
|
690
|
+
if (event.target === null) return;
|
|
691
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
handler();
|
|
695
|
+
};
|
|
696
|
+
document.addEventListener("mousedown", listener);
|
|
697
|
+
document.addEventListener("touchstart", listener);
|
|
698
|
+
return () => {
|
|
699
|
+
document.removeEventListener("mousedown", listener);
|
|
700
|
+
document.removeEventListener("touchstart", listener);
|
|
701
|
+
};
|
|
702
|
+
}, [refs, handler]);
|
|
703
|
+
};
|
|
704
|
+
|
|
254
705
|
// src/components/user-action/Select.tsx
|
|
255
|
-
var
|
|
706
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
256
707
|
var Select = ({
|
|
257
708
|
value,
|
|
258
709
|
label,
|
|
259
710
|
options,
|
|
260
711
|
onChange,
|
|
261
|
-
isHidingCurrentValue = true,
|
|
262
712
|
hintText = "",
|
|
263
|
-
showDisabledOptions = true,
|
|
264
713
|
isDisabled,
|
|
714
|
+
isSearchEnabled = false,
|
|
265
715
|
className,
|
|
266
|
-
textColor = "text-menu-text",
|
|
267
|
-
additionalItems,
|
|
268
716
|
selectedDisplayOverwrite
|
|
269
717
|
}) => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
718
|
+
const triggerRef = (0, import_react7.useRef)(null);
|
|
719
|
+
const menuRef = (0, import_react7.useRef)(null);
|
|
720
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
721
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
274
722
|
const selectedOption = options.find((option) => option.value === value);
|
|
275
723
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
276
724
|
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");
|
|
277
725
|
}
|
|
278
|
-
const
|
|
279
|
-
return /* @__PURE__ */ (0,
|
|
280
|
-
label && /* @__PURE__ */ (0,
|
|
281
|
-
/* @__PURE__ */ (0,
|
|
282
|
-
/* @__PURE__ */ (0,
|
|
283
|
-
|
|
726
|
+
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.default)(className), children: [
|
|
728
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx7.default)("mb-1", label.className) }),
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
731
|
+
"button",
|
|
284
732
|
{
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
borderColor,
|
|
733
|
+
ref: triggerRef,
|
|
734
|
+
className: (0, import_clsx7.default)(
|
|
735
|
+
"btn-md justify-between w-full border-2",
|
|
289
736
|
{
|
|
290
737
|
"rounded-b-lg": !open,
|
|
291
|
-
"hover:border-primary": !isDisabled,
|
|
292
|
-
"bg-disabled-background cursor-not-allowed
|
|
738
|
+
"bg-menu-background border-menu-border hover:border-primary": !isDisabled,
|
|
739
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
293
740
|
}
|
|
294
741
|
),
|
|
742
|
+
onClick: () => setIsOpen(!isOpen),
|
|
295
743
|
disabled: isDisabled,
|
|
296
744
|
children: [
|
|
297
|
-
/* @__PURE__ */ (0,
|
|
298
|
-
|
|
745
|
+
!isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
746
|
+
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "textstyle-description", children: hintText }),
|
|
747
|
+
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.ChevronDown, {})
|
|
299
748
|
]
|
|
300
749
|
}
|
|
301
750
|
),
|
|
302
|
-
/* @__PURE__ */ (0,
|
|
303
|
-
|
|
751
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
752
|
+
"div",
|
|
304
753
|
{
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
"px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
|
|
322
|
-
option.className,
|
|
323
|
-
borderColor,
|
|
324
|
-
{
|
|
325
|
-
"brightness-90": option.value === value,
|
|
326
|
-
"brightness-95": index % 2 === 1,
|
|
327
|
-
"text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
|
|
328
|
-
"bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
|
|
329
|
-
"rounded-b-lg": index === filteredOptions.length - 1
|
|
330
|
-
}
|
|
331
|
-
),
|
|
332
|
-
onClick: () => {
|
|
333
|
-
if (!option.disabled) {
|
|
754
|
+
ref: menuRef,
|
|
755
|
+
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",
|
|
756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
757
|
+
SearchableList,
|
|
758
|
+
{
|
|
759
|
+
list: options,
|
|
760
|
+
minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
|
|
761
|
+
searchMapping: (item) => item.searchTags,
|
|
762
|
+
itemMapper: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
763
|
+
Tile,
|
|
764
|
+
{
|
|
765
|
+
isSelected: selectedOption?.value === option.value,
|
|
766
|
+
className: "px-2 py-1 rounded-md",
|
|
767
|
+
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
768
|
+
title: { value: option.label, className: "font-semibold" },
|
|
769
|
+
onClick: () => {
|
|
334
770
|
onChange(option.value);
|
|
335
|
-
|
|
771
|
+
setIsOpen(false);
|
|
772
|
+
},
|
|
773
|
+
isDisabled: option.disabled
|
|
336
774
|
},
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
) }, `item${index}`))
|
|
340
|
-
]
|
|
341
|
-
}
|
|
342
|
-
)
|
|
343
|
-
] }) })
|
|
344
|
-
] });
|
|
345
|
-
};
|
|
346
|
-
var SearchableSelect = ({
|
|
347
|
-
value,
|
|
348
|
-
options,
|
|
349
|
-
searchMapping,
|
|
350
|
-
...selectProps
|
|
351
|
-
}) => {
|
|
352
|
-
const [search, setSearch] = (0, import_react6.useState)("");
|
|
353
|
-
const filteredOptions = MultiSearchWithMapping(search, options, searchMapping);
|
|
354
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
355
|
-
Select,
|
|
356
|
-
{
|
|
357
|
-
value,
|
|
358
|
-
options: filteredOptions,
|
|
359
|
-
additionalItems: [/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "row gap-x-2 items-center", children: [
|
|
360
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Input, { autoFocus: true, value: search, onChangeText: setSearch, className: "w-full" }),
|
|
361
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Search, { className: "min-w-[1.5rem] min-h-[1.5rem]" })
|
|
362
|
-
] }, "selectSearch")],
|
|
363
|
-
...selectProps
|
|
364
|
-
}
|
|
365
|
-
);
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
// src/components/properties/PropertyBase.tsx
|
|
369
|
-
var import_lucide_react2 = require("lucide-react");
|
|
370
|
-
var import_clsx5 = __toESM(require("clsx"));
|
|
371
|
-
|
|
372
|
-
// src/components/user-action/Button.tsx
|
|
373
|
-
var import_clsx4 = __toESM(require("clsx"));
|
|
374
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
375
|
-
var paddingMapping = {
|
|
376
|
-
small: "btn-sm",
|
|
377
|
-
medium: "btn-md",
|
|
378
|
-
large: "btn-lg"
|
|
379
|
-
};
|
|
380
|
-
var iconPaddingMapping = {
|
|
381
|
-
small: "icon-btn-sm",
|
|
382
|
-
medium: "icon-btn-md",
|
|
383
|
-
large: "icon-btn-lg"
|
|
384
|
-
};
|
|
385
|
-
var ButtonUtil = {
|
|
386
|
-
paddingMapping,
|
|
387
|
-
iconPaddingMapping
|
|
388
|
-
};
|
|
389
|
-
var TextButton = ({
|
|
390
|
-
children,
|
|
391
|
-
disabled = false,
|
|
392
|
-
color = "neutral",
|
|
393
|
-
size = "medium",
|
|
394
|
-
startIcon,
|
|
395
|
-
endIcon,
|
|
396
|
-
onClick,
|
|
397
|
-
className,
|
|
398
|
-
...restProps
|
|
399
|
-
}) => {
|
|
400
|
-
const colorClasses = {
|
|
401
|
-
primary: "bg-transparent text-button-text-primary-text",
|
|
402
|
-
negative: "bg-transparent text-button-text-negative-text",
|
|
403
|
-
neutral: "bg-transparent text-button-text-neutral-text"
|
|
404
|
-
}[color];
|
|
405
|
-
const iconColorClasses = {
|
|
406
|
-
primary: "text-button-text-primary-icon",
|
|
407
|
-
negative: "text-button-text-negative-icon",
|
|
408
|
-
neutral: "text-button-text-neutral-icon"
|
|
409
|
-
}[color];
|
|
410
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
411
|
-
"button",
|
|
412
|
-
{
|
|
413
|
-
onClick: disabled ? void 0 : onClick,
|
|
414
|
-
disabled: disabled || onClick === void 0,
|
|
415
|
-
className: (0, import_clsx4.default)(
|
|
416
|
-
{
|
|
417
|
-
"text-disabled-text cursor-not-allowed": disabled,
|
|
418
|
-
[(0, import_clsx4.default)(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
|
|
419
|
-
},
|
|
420
|
-
ButtonUtil.paddingMapping[size],
|
|
421
|
-
className
|
|
422
|
-
),
|
|
423
|
-
...restProps,
|
|
424
|
-
children: [
|
|
425
|
-
startIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
426
|
-
"span",
|
|
427
|
-
{
|
|
428
|
-
className: (0, import_clsx4.default)({
|
|
429
|
-
[iconColorClasses]: !disabled,
|
|
430
|
-
[`text-disabled-icon`]: disabled
|
|
431
|
-
}),
|
|
432
|
-
children: startIcon
|
|
433
|
-
}
|
|
434
|
-
),
|
|
435
|
-
children,
|
|
436
|
-
endIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
437
|
-
"span",
|
|
438
|
-
{
|
|
439
|
-
className: (0, import_clsx4.default)({
|
|
440
|
-
[iconColorClasses]: !disabled,
|
|
441
|
-
[`text-disabled-icon`]: disabled
|
|
442
|
-
}),
|
|
443
|
-
children: endIcon
|
|
444
|
-
}
|
|
445
|
-
)
|
|
446
|
-
]
|
|
447
|
-
}
|
|
448
|
-
);
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
// src/components/properties/PropertyBase.tsx
|
|
452
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
453
|
-
var defaultPropertyBaseTranslation = {
|
|
454
|
-
en: {
|
|
455
|
-
remove: "Remove"
|
|
456
|
-
},
|
|
457
|
-
de: {
|
|
458
|
-
remove: "Entfernen"
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
var PropertyBase = ({
|
|
462
|
-
overwriteTranslation,
|
|
463
|
-
name,
|
|
464
|
-
input,
|
|
465
|
-
softRequired = false,
|
|
466
|
-
hasValue,
|
|
467
|
-
icon,
|
|
468
|
-
readOnly,
|
|
469
|
-
onRemove,
|
|
470
|
-
className = ""
|
|
471
|
-
}) => {
|
|
472
|
-
const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation);
|
|
473
|
-
const requiredAndNoValue = softRequired && !hasValue;
|
|
474
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)("row gap-x-0 group", className), children: [
|
|
475
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
476
|
-
"div",
|
|
477
|
-
{
|
|
478
|
-
className: (0, import_clsx5.default)("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
|
|
479
|
-
"bg-property-title-background property-title-text group-hover:border-primary": !requiredAndNoValue,
|
|
480
|
-
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
481
|
-
}, className),
|
|
482
|
-
children: [
|
|
483
|
-
icon,
|
|
484
|
-
name
|
|
485
|
-
]
|
|
486
|
-
}
|
|
487
|
-
),
|
|
488
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
489
|
-
"div",
|
|
490
|
-
{
|
|
491
|
-
className: (0, import_clsx5.default)("row grow justify-between items-center rounded-r-xl border-2 border-l-0", {
|
|
492
|
-
"bg-surface group-hover:border-primary": !requiredAndNoValue,
|
|
493
|
-
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
494
|
-
}, className),
|
|
495
|
-
children: [
|
|
496
|
-
input({ softRequired, hasValue }),
|
|
497
|
-
requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "text-warning pr-4", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.AlertTriangle, { size: 24 }) }),
|
|
498
|
-
onRemove && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
499
|
-
TextButton,
|
|
500
|
-
{
|
|
501
|
-
onClick: onRemove,
|
|
502
|
-
color: "negative",
|
|
503
|
-
className: (0, import_clsx5.default)("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
504
|
-
disabled: !hasValue || readOnly,
|
|
505
|
-
children: translation.remove
|
|
775
|
+
index
|
|
776
|
+
)
|
|
506
777
|
}
|
|
507
778
|
)
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
)
|
|
779
|
+
}
|
|
780
|
+
)
|
|
781
|
+
] })
|
|
511
782
|
] });
|
|
512
783
|
};
|
|
513
784
|
|
|
514
785
|
// src/components/properties/SelectProperty.tsx
|
|
515
|
-
var
|
|
516
|
-
var defaultSingleSelectPropertyTranslation = {
|
|
517
|
-
en: {
|
|
518
|
-
select: "Select"
|
|
519
|
-
},
|
|
520
|
-
de: {
|
|
521
|
-
select: "Ausw\xE4hlen"
|
|
522
|
-
}
|
|
523
|
-
};
|
|
786
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
524
787
|
var SingleSelectProperty = ({
|
|
525
788
|
overwriteTranslation,
|
|
526
789
|
value,
|
|
@@ -529,11 +792,11 @@ var SingleSelectProperty = ({
|
|
|
529
792
|
readOnly = false,
|
|
530
793
|
softRequired,
|
|
531
794
|
onRemove,
|
|
532
|
-
...
|
|
795
|
+
...selectProps
|
|
533
796
|
}) => {
|
|
534
|
-
const translation = useTranslation(
|
|
797
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
535
798
|
const hasValue = value !== void 0;
|
|
536
|
-
return /* @__PURE__ */ (0,
|
|
799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
537
800
|
PropertyBase,
|
|
538
801
|
{
|
|
539
802
|
name,
|
|
@@ -541,20 +804,20 @@ var SingleSelectProperty = ({
|
|
|
541
804
|
readOnly,
|
|
542
805
|
softRequired,
|
|
543
806
|
hasValue,
|
|
544
|
-
icon: /* @__PURE__ */ (0,
|
|
545
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0,
|
|
807
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react5.List, { size: 16 }),
|
|
808
|
+
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
546
809
|
"div",
|
|
547
810
|
{
|
|
548
|
-
className: (0,
|
|
549
|
-
children: /* @__PURE__ */ (0,
|
|
550
|
-
|
|
811
|
+
className: (0, import_clsx8.default)("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
|
|
812
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
813
|
+
Select,
|
|
551
814
|
{
|
|
552
|
-
...
|
|
815
|
+
...selectProps,
|
|
553
816
|
value,
|
|
554
817
|
options,
|
|
555
818
|
isDisabled: readOnly,
|
|
556
|
-
className: (0,
|
|
557
|
-
hintText: `${translation
|
|
819
|
+
className: (0, import_clsx8.default)("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
820
|
+
hintText: `${translation("select")}...`
|
|
558
821
|
}
|
|
559
822
|
)
|
|
560
823
|
}
|