@helpwave/hightide 0.1.7 → 0.1.8
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.js +18 -20
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +18 -20
- 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/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.js +2 -2
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +2 -2
- 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.js +2 -2
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +2 -2
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.d.mts +7 -6
- package/dist/components/layout-and-navigation/SearchableList.d.ts +7 -6
- package/dist/components/layout-and-navigation/SearchableList.js +114 -21
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +114 -21
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +6 -6
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +6 -6
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Table.js +1 -1
- package/dist/components/layout-and-navigation/Table.js.map +1 -1
- package/dist/components/layout-and-navigation/Table.mjs +1 -1
- package/dist/components/layout-and-navigation/Table.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/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.js +2 -2
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +2 -2
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +2 -2
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +2 -2
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +2 -2
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +2 -2
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +384 -150
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +383 -149
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +385 -154
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +382 -151
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +1 -1
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +1 -1
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +1 -1
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +1 -1
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +1 -0
- package/dist/components/properties/MultiSelectProperty.d.ts +1 -0
- package/dist/components/properties/MultiSelectProperty.js +482 -430
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +478 -426
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +1 -1
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +1 -1
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +1 -1
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +1 -1
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +3 -3
- package/dist/components/properties/SelectProperty.d.ts +3 -3
- package/dist/components/properties/SelectProperty.js +404 -263
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +404 -263
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +1 -1
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +1 -1
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +18 -20
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +18 -20
- 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 +10 -16
- package/dist/components/user-action/MultiSelect.d.ts +10 -16
- package/dist/components/user-action/MultiSelect.js +485 -312
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +482 -310
- 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 +309 -113
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +304 -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 +213 -205
- package/dist/css/uncompiled/globals.css +136 -72
- 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 +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +555 -463
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +517 -427
- package/dist/index.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
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// src/components/user-action/Select.tsx
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import clsx3 from "clsx";
|
|
2
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
3
|
+
import { useEffect as useEffect7, useRef as useRef2, useState as useState6 } from "react";
|
|
4
|
+
import clsx6 from "clsx";
|
|
6
5
|
|
|
7
6
|
// src/components/user-action/Label.tsx
|
|
8
7
|
import clsx from "clsx";
|
|
@@ -22,23 +21,58 @@ var Label = ({
|
|
|
22
21
|
return /* @__PURE__ */ jsx("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
// src/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
25
|
+
import { Search } from "lucide-react";
|
|
26
|
+
import clsx4 from "clsx";
|
|
27
|
+
|
|
28
|
+
// src/localization/LanguageProvider.tsx
|
|
29
|
+
import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
|
|
30
|
+
|
|
31
|
+
// src/hooks/useLocalStorage.ts
|
|
32
|
+
import { useCallback, useEffect, useState } from "react";
|
|
33
|
+
|
|
34
|
+
// src/localization/util.ts
|
|
35
|
+
var languages = ["en", "de"];
|
|
36
|
+
var languagesLocalNames = {
|
|
37
|
+
en: "English",
|
|
38
|
+
de: "Deutsch"
|
|
39
|
+
};
|
|
40
|
+
var DEFAULT_LANGUAGE = "en";
|
|
41
|
+
var LanguageUtil = {
|
|
42
|
+
languages,
|
|
43
|
+
DEFAULT_LANGUAGE,
|
|
44
|
+
languagesLocalNames
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/localization/LanguageProvider.tsx
|
|
48
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
49
|
+
var LanguageContext = createContext({
|
|
50
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
51
|
+
setLanguage: (v) => v
|
|
52
|
+
});
|
|
53
|
+
var useLanguage = () => useContext(LanguageContext);
|
|
54
|
+
|
|
55
|
+
// src/localization/useTranslation.ts
|
|
56
|
+
var useTranslation = (defaults, translationOverwrite = {}) => {
|
|
57
|
+
const { language: languageProp, translation: overwrite } = translationOverwrite;
|
|
58
|
+
const { language: inferredLanguage } = useLanguage();
|
|
59
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
60
|
+
let defaultValues = defaults[usedLanguage];
|
|
61
|
+
if (overwrite && overwrite[usedLanguage]) {
|
|
62
|
+
defaultValues = { ...defaultValues, ...overwrite[usedLanguage] };
|
|
63
|
+
}
|
|
64
|
+
return defaultValues;
|
|
31
65
|
};
|
|
32
66
|
|
|
33
67
|
// src/components/user-action/Input.tsx
|
|
34
|
-
import { forwardRef, useEffect as
|
|
68
|
+
import { forwardRef, useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
35
69
|
import clsx2 from "clsx";
|
|
36
70
|
|
|
37
71
|
// src/hooks/useSaveDelay.ts
|
|
38
|
-
import { useEffect, useState } from "react";
|
|
72
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
39
73
|
function useSaveDelay(setNotificationStatus, delay) {
|
|
40
|
-
const [updateTimer, setUpdateTimer] =
|
|
41
|
-
const [notificationTimer, setNotificationTimer] =
|
|
74
|
+
const [updateTimer, setUpdateTimer] = useState3(void 0);
|
|
75
|
+
const [notificationTimer, setNotificationTimer] = useState3(void 0);
|
|
42
76
|
const restartTimer = (onSave) => {
|
|
43
77
|
clearTimeout(updateTimer);
|
|
44
78
|
setUpdateTimer(setTimeout(() => {
|
|
@@ -65,7 +99,7 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
65
99
|
setNotificationStatus(false);
|
|
66
100
|
}
|
|
67
101
|
};
|
|
68
|
-
|
|
102
|
+
useEffect3(() => {
|
|
69
103
|
return () => {
|
|
70
104
|
clearTimeout(updateTimer);
|
|
71
105
|
clearTimeout(notificationTimer);
|
|
@@ -78,7 +112,7 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
78
112
|
var noop = () => void 0;
|
|
79
113
|
|
|
80
114
|
// src/components/user-action/Input.tsx
|
|
81
|
-
import { jsx as
|
|
115
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
82
116
|
var Input = ({
|
|
83
117
|
id,
|
|
84
118
|
type = "text",
|
|
@@ -99,14 +133,14 @@ var Input = ({
|
|
|
99
133
|
clearUpdateTimer
|
|
100
134
|
} = useSaveDelay(() => void 0, 3e3);
|
|
101
135
|
const ref = useRef(null);
|
|
102
|
-
|
|
136
|
+
useEffect4(() => {
|
|
103
137
|
if (autoFocus) {
|
|
104
138
|
ref.current?.focus();
|
|
105
139
|
}
|
|
106
140
|
}, [autoFocus]);
|
|
107
141
|
return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
|
|
108
|
-
label && /* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
142
|
+
label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
|
|
143
|
+
/* @__PURE__ */ jsx3(
|
|
110
144
|
"input",
|
|
111
145
|
{
|
|
112
146
|
ref,
|
|
@@ -150,7 +184,7 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
150
184
|
required,
|
|
151
185
|
...restProps
|
|
152
186
|
}, ref) {
|
|
153
|
-
const input = /* @__PURE__ */
|
|
187
|
+
const input = /* @__PURE__ */ jsx3(
|
|
154
188
|
"input",
|
|
155
189
|
{
|
|
156
190
|
ref,
|
|
@@ -168,103 +202,288 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
168
202
|
return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
|
|
169
203
|
labelText && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: clsx2("textstyle-label-md", labelClassName), children: [
|
|
170
204
|
labelText,
|
|
171
|
-
required && /* @__PURE__ */
|
|
205
|
+
required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
|
|
172
206
|
] }),
|
|
173
207
|
input,
|
|
174
|
-
errorText && /* @__PURE__ */
|
|
208
|
+
errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
|
|
175
209
|
] });
|
|
176
210
|
});
|
|
177
211
|
|
|
212
|
+
// src/components/user-action/Button.tsx
|
|
213
|
+
import clsx3 from "clsx";
|
|
214
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
215
|
+
var paddingMapping = {
|
|
216
|
+
small: "btn-sm",
|
|
217
|
+
medium: "btn-md",
|
|
218
|
+
large: "btn-lg"
|
|
219
|
+
};
|
|
220
|
+
var iconPaddingMapping = {
|
|
221
|
+
small: "icon-btn-sm",
|
|
222
|
+
medium: "icon-btn-md",
|
|
223
|
+
large: "icon-btn-lg"
|
|
224
|
+
};
|
|
225
|
+
var ButtonUtil = {
|
|
226
|
+
paddingMapping,
|
|
227
|
+
iconPaddingMapping
|
|
228
|
+
};
|
|
229
|
+
var IconButton = ({
|
|
230
|
+
children,
|
|
231
|
+
disabled = false,
|
|
232
|
+
color = "primary",
|
|
233
|
+
size = "medium",
|
|
234
|
+
onClick,
|
|
235
|
+
className,
|
|
236
|
+
...restProps
|
|
237
|
+
}) => {
|
|
238
|
+
const colorClasses = {
|
|
239
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
240
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
241
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
242
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
243
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
244
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
245
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
246
|
+
}[color];
|
|
247
|
+
return /* @__PURE__ */ jsx4(
|
|
248
|
+
"button",
|
|
249
|
+
{
|
|
250
|
+
onClick: disabled ? void 0 : onClick,
|
|
251
|
+
disabled: disabled || onClick === void 0,
|
|
252
|
+
className: clsx3(
|
|
253
|
+
{
|
|
254
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
255
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
256
|
+
},
|
|
257
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
258
|
+
className
|
|
259
|
+
),
|
|
260
|
+
...restProps,
|
|
261
|
+
children
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// src/hooks/useSearch.ts
|
|
267
|
+
import { useEffect as useEffect5, useMemo, useState as useState5 } from "react";
|
|
268
|
+
|
|
269
|
+
// src/util/simpleSearch.ts
|
|
270
|
+
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
271
|
+
return objects.filter((object) => {
|
|
272
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
273
|
+
if (!mappedSearchKeywords) {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// src/hooks/useSearch.ts
|
|
281
|
+
var useSearch = ({
|
|
282
|
+
list,
|
|
283
|
+
initialSearch,
|
|
284
|
+
searchMapping
|
|
285
|
+
}) => {
|
|
286
|
+
const [items, setItems] = useState5(list);
|
|
287
|
+
const [search, setSearch] = useState5(initialSearch);
|
|
288
|
+
useEffect5(() => {
|
|
289
|
+
setItems(list);
|
|
290
|
+
}, [list]);
|
|
291
|
+
const result = useMemo(
|
|
292
|
+
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
293
|
+
[search, items, searchMapping]
|
|
294
|
+
);
|
|
295
|
+
return {
|
|
296
|
+
result,
|
|
297
|
+
hasResult: result.length > 0,
|
|
298
|
+
allItems: items,
|
|
299
|
+
setItems,
|
|
300
|
+
search,
|
|
301
|
+
setSearch
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
306
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
307
|
+
var defaultSearchableListTranslation = {
|
|
308
|
+
en: {
|
|
309
|
+
search: "Search",
|
|
310
|
+
nothingFound: "Nothing found"
|
|
311
|
+
},
|
|
312
|
+
de: {
|
|
313
|
+
search: "Suche",
|
|
314
|
+
nothingFound: "Nichts gefunden"
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
var SearchableList = ({
|
|
318
|
+
overwriteTranslation,
|
|
319
|
+
list,
|
|
320
|
+
initialSearch = "",
|
|
321
|
+
searchMapping,
|
|
322
|
+
autoFocus,
|
|
323
|
+
minimumItemsForSearch = 6,
|
|
324
|
+
itemMapper,
|
|
325
|
+
className,
|
|
326
|
+
resultListClassName
|
|
327
|
+
}) => {
|
|
328
|
+
const translation = useTranslation(defaultSearchableListTranslation, overwriteTranslation);
|
|
329
|
+
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
330
|
+
return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
|
|
331
|
+
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
332
|
+
/* @__PURE__ */ jsx5(
|
|
333
|
+
Input,
|
|
334
|
+
{
|
|
335
|
+
value: search,
|
|
336
|
+
onChangeText: setSearch,
|
|
337
|
+
placeholder: translation.search,
|
|
338
|
+
autoFocus,
|
|
339
|
+
className: "w-full"
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
/* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
|
|
343
|
+
] }),
|
|
344
|
+
hasResult ? /* @__PURE__ */ jsx5("div", { className: clsx4("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ jsx5("div", { className: "row text-description py-2 px-2", children: translation.nothingFound })
|
|
345
|
+
] });
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
349
|
+
import clsx5 from "clsx";
|
|
350
|
+
import { Check } from "lucide-react";
|
|
351
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
352
|
+
var Tile = ({
|
|
353
|
+
title,
|
|
354
|
+
description,
|
|
355
|
+
onClick,
|
|
356
|
+
isSelected = false,
|
|
357
|
+
isDisabled = false,
|
|
358
|
+
prefix,
|
|
359
|
+
suffix,
|
|
360
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
361
|
+
selectedClassName = " bg-primary/20",
|
|
362
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
363
|
+
className
|
|
364
|
+
}) => {
|
|
365
|
+
return /* @__PURE__ */ jsxs4(
|
|
366
|
+
"div",
|
|
367
|
+
{
|
|
368
|
+
className: clsx5(
|
|
369
|
+
"row gap-x-2 w-full items-center",
|
|
370
|
+
{
|
|
371
|
+
[normalClassName]: !!onClick && !isDisabled,
|
|
372
|
+
[selectedClassName]: isSelected && !isDisabled,
|
|
373
|
+
[disabledClassName]: isDisabled
|
|
374
|
+
},
|
|
375
|
+
className
|
|
376
|
+
),
|
|
377
|
+
onClick: isDisabled ? void 0 : onClick,
|
|
378
|
+
children: [
|
|
379
|
+
prefix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0),
|
|
380
|
+
/* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
|
|
381
|
+
/* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
382
|
+
!!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
|
|
383
|
+
] }),
|
|
384
|
+
suffix
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// src/hooks/useOutsideClick.ts
|
|
391
|
+
import { useEffect as useEffect6 } from "react";
|
|
392
|
+
var useOutsideClick = (refs, handler) => {
|
|
393
|
+
useEffect6(() => {
|
|
394
|
+
const listener = (event) => {
|
|
395
|
+
if (event.target === null) return;
|
|
396
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
handler();
|
|
400
|
+
};
|
|
401
|
+
document.addEventListener("mousedown", listener);
|
|
402
|
+
document.addEventListener("touchstart", listener);
|
|
403
|
+
return () => {
|
|
404
|
+
document.removeEventListener("mousedown", listener);
|
|
405
|
+
document.removeEventListener("touchstart", listener);
|
|
406
|
+
};
|
|
407
|
+
}, [refs, handler]);
|
|
408
|
+
};
|
|
409
|
+
|
|
178
410
|
// src/components/user-action/Select.tsx
|
|
179
|
-
import {
|
|
411
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
180
412
|
var Select = ({
|
|
181
413
|
value,
|
|
182
414
|
label,
|
|
183
415
|
options,
|
|
184
416
|
onChange,
|
|
185
|
-
isHidingCurrentValue = true,
|
|
186
417
|
hintText = "",
|
|
187
|
-
showDisabledOptions = true,
|
|
188
418
|
isDisabled,
|
|
419
|
+
isSearchEnabled = false,
|
|
189
420
|
className,
|
|
190
|
-
textColor = "text-menu-text",
|
|
191
|
-
additionalItems,
|
|
192
421
|
selectedDisplayOverwrite
|
|
193
422
|
}) => {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
423
|
+
const triggerRef = useRef2(null);
|
|
424
|
+
const menuRef = useRef2(null);
|
|
425
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
426
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
198
427
|
const selectedOption = options.find((option) => option.value === value);
|
|
199
428
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
200
429
|
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");
|
|
201
430
|
}
|
|
202
|
-
const
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
-
label && /* @__PURE__ */
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
|
|
431
|
+
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
432
|
+
return /* @__PURE__ */ jsxs5("div", { className: clsx6(className), children: [
|
|
433
|
+
label && /* @__PURE__ */ jsx7(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx6("mb-1", label.className) }),
|
|
434
|
+
/* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
435
|
+
/* @__PURE__ */ jsxs5(
|
|
436
|
+
"button",
|
|
208
437
|
{
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
borderColor,
|
|
438
|
+
ref: triggerRef,
|
|
439
|
+
className: clsx6(
|
|
440
|
+
"btn-md justify-between w-full border-2",
|
|
213
441
|
{
|
|
214
442
|
"rounded-b-lg": !open,
|
|
215
|
-
"hover:border-primary": !isDisabled,
|
|
216
|
-
"bg-disabled-background cursor-not-allowed
|
|
443
|
+
"bg-menu-background border-menu-border hover:border-primary": !isDisabled,
|
|
444
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
217
445
|
}
|
|
218
446
|
),
|
|
447
|
+
onClick: () => setIsOpen(!isOpen),
|
|
219
448
|
disabled: isDisabled,
|
|
220
449
|
children: [
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
-
|
|
450
|
+
!isShowingHint && /* @__PURE__ */ jsx7("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
451
|
+
isShowingHint && /* @__PURE__ */ jsx7("span", { className: "textstyle-description", children: hintText }),
|
|
452
|
+
isOpen ? /* @__PURE__ */ jsx7(ChevronUp, {}) : /* @__PURE__ */ jsx7(ChevronDown, {})
|
|
223
453
|
]
|
|
224
454
|
}
|
|
225
455
|
),
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
|
|
456
|
+
isOpen && /* @__PURE__ */ jsx7(
|
|
457
|
+
"div",
|
|
228
458
|
{
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
|
|
246
|
-
option.className,
|
|
247
|
-
borderColor,
|
|
248
|
-
{
|
|
249
|
-
"brightness-90": option.value === value,
|
|
250
|
-
"brightness-95": index % 2 === 1,
|
|
251
|
-
"text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
|
|
252
|
-
"bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
|
|
253
|
-
"rounded-b-lg": index === filteredOptions.length - 1
|
|
254
|
-
}
|
|
255
|
-
),
|
|
256
|
-
onClick: () => {
|
|
257
|
-
if (!option.disabled) {
|
|
459
|
+
ref: menuRef,
|
|
460
|
+
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",
|
|
461
|
+
children: /* @__PURE__ */ jsx7(
|
|
462
|
+
SearchableList,
|
|
463
|
+
{
|
|
464
|
+
list: options,
|
|
465
|
+
minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
|
|
466
|
+
searchMapping: (item) => item.searchTags,
|
|
467
|
+
itemMapper: (option, index) => /* @__PURE__ */ jsx7(
|
|
468
|
+
Tile,
|
|
469
|
+
{
|
|
470
|
+
isSelected: selectedOption?.value === option.value,
|
|
471
|
+
className: "px-2 py-1 rounded-md",
|
|
472
|
+
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
473
|
+
title: { value: option.label, className: "font-semibold" },
|
|
474
|
+
onClick: () => {
|
|
258
475
|
onChange(option.value);
|
|
259
|
-
|
|
476
|
+
setIsOpen(false);
|
|
477
|
+
},
|
|
478
|
+
isDisabled: option.disabled
|
|
260
479
|
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
480
|
+
index
|
|
481
|
+
)
|
|
482
|
+
}
|
|
483
|
+
)
|
|
265
484
|
}
|
|
266
485
|
)
|
|
267
|
-
] })
|
|
486
|
+
] })
|
|
268
487
|
] });
|
|
269
488
|
};
|
|
270
489
|
var SelectUncontrolled = ({
|
|
@@ -274,13 +493,13 @@ var SelectUncontrolled = ({
|
|
|
274
493
|
hintText,
|
|
275
494
|
...props
|
|
276
495
|
}) => {
|
|
277
|
-
const [selected, setSelected] =
|
|
278
|
-
|
|
496
|
+
const [selected, setSelected] = useState6(value);
|
|
497
|
+
useEffect7(() => {
|
|
279
498
|
if (options.find((options2) => options2.value === value)) {
|
|
280
499
|
setSelected(value);
|
|
281
500
|
}
|
|
282
501
|
}, [options, value]);
|
|
283
|
-
return /* @__PURE__ */
|
|
502
|
+
return /* @__PURE__ */ jsx7(
|
|
284
503
|
Select,
|
|
285
504
|
{
|
|
286
505
|
value: selected,
|
|
@@ -294,29 +513,7 @@ var SelectUncontrolled = ({
|
|
|
294
513
|
}
|
|
295
514
|
);
|
|
296
515
|
};
|
|
297
|
-
var SearchableSelect = ({
|
|
298
|
-
value,
|
|
299
|
-
options,
|
|
300
|
-
searchMapping,
|
|
301
|
-
...selectProps
|
|
302
|
-
}) => {
|
|
303
|
-
const [search, setSearch] = useState3("");
|
|
304
|
-
const filteredOptions = MultiSearchWithMapping(search, options, searchMapping);
|
|
305
|
-
return /* @__PURE__ */ jsx3(
|
|
306
|
-
Select,
|
|
307
|
-
{
|
|
308
|
-
value,
|
|
309
|
-
options: filteredOptions,
|
|
310
|
-
additionalItems: [/* @__PURE__ */ jsxs2("div", { className: "row gap-x-2 items-center", children: [
|
|
311
|
-
/* @__PURE__ */ jsx3(Input, { autoFocus: true, value: search, onChangeText: setSearch, className: "w-full" }),
|
|
312
|
-
/* @__PURE__ */ jsx3(Search, { className: "min-w-[1.5rem] min-h-[1.5rem]" })
|
|
313
|
-
] }, "selectSearch")],
|
|
314
|
-
...selectProps
|
|
315
|
-
}
|
|
316
|
-
);
|
|
317
|
-
};
|
|
318
516
|
export {
|
|
319
|
-
SearchableSelect,
|
|
320
517
|
Select,
|
|
321
518
|
SelectUncontrolled
|
|
322
519
|
};
|