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