@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,6 +1,6 @@
|
|
|
1
1
|
// src/components/user-action/MultiSelect.tsx
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
2
|
+
import { useEffect as useEffect7, useRef as useRef2, useState as useState6 } from "react";
|
|
3
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
4
4
|
|
|
5
5
|
// src/localization/LanguageProvider.tsx
|
|
6
6
|
import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -41,149 +41,40 @@ var useTranslation = (defaults, translationOverwrite = {}) => {
|
|
|
41
41
|
return defaultValues;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
// src/util/simpleSearch.ts
|
|
45
|
-
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
46
|
-
return objects.filter((object) => {
|
|
47
|
-
const mappedSearchKeywords = mapping(object).map((value) => value.toLowerCase().trim());
|
|
48
|
-
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
44
|
// src/components/user-action/MultiSelect.tsx
|
|
53
|
-
import
|
|
45
|
+
import clsx7 from "clsx";
|
|
54
46
|
|
|
55
|
-
// src/components/user-action/
|
|
56
|
-
import { useRef } from "react";
|
|
47
|
+
// src/components/user-action/Label.tsx
|
|
57
48
|
import clsx from "clsx";
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const listener = (event) => {
|
|
64
|
-
if (event.target === null) return;
|
|
65
|
-
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
handler();
|
|
69
|
-
};
|
|
70
|
-
document.addEventListener("mousedown", listener);
|
|
71
|
-
document.addEventListener("touchstart", listener);
|
|
72
|
-
return () => {
|
|
73
|
-
document.removeEventListener("mousedown", listener);
|
|
74
|
-
document.removeEventListener("touchstart", listener);
|
|
75
|
-
};
|
|
76
|
-
}, [refs, handler]);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// src/hooks/useHoverState.ts
|
|
80
|
-
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
81
|
-
var defaultUseHoverStateProps = {
|
|
82
|
-
closingDelay: 200,
|
|
83
|
-
isDisabled: false
|
|
84
|
-
};
|
|
85
|
-
var useHoverState = (props = void 0) => {
|
|
86
|
-
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
87
|
-
const [isHovered, setIsHovered] = useState3(false);
|
|
88
|
-
const [timer, setTimer] = useState3();
|
|
89
|
-
const onMouseEnter = () => {
|
|
90
|
-
if (isDisabled) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
clearTimeout(timer);
|
|
94
|
-
setIsHovered(true);
|
|
95
|
-
};
|
|
96
|
-
const onMouseLeave = () => {
|
|
97
|
-
if (isDisabled) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
setTimer(setTimeout(() => {
|
|
101
|
-
setIsHovered(false);
|
|
102
|
-
}, closingDelay));
|
|
103
|
-
};
|
|
104
|
-
useEffect4(() => {
|
|
105
|
-
if (timer) {
|
|
106
|
-
return () => {
|
|
107
|
-
clearTimeout(timer);
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
useEffect4(() => {
|
|
112
|
-
if (timer) {
|
|
113
|
-
clearTimeout(timer);
|
|
114
|
-
}
|
|
115
|
-
}, [isDisabled]);
|
|
116
|
-
return {
|
|
117
|
-
isHovered,
|
|
118
|
-
setIsHovered,
|
|
119
|
-
handlers: { onMouseEnter, onMouseLeave }
|
|
120
|
-
};
|
|
49
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
50
|
+
var styleMapping = {
|
|
51
|
+
labelSmall: "textstyle-label-sm",
|
|
52
|
+
labelMedium: "textstyle-label-md",
|
|
53
|
+
labelBig: "textstyle-label-lg"
|
|
121
54
|
};
|
|
122
|
-
|
|
123
|
-
// src/components/user-action/Menu.tsx
|
|
124
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
125
|
-
var MenuItem = ({
|
|
126
|
-
children,
|
|
127
|
-
onClick,
|
|
128
|
-
alignment = "left",
|
|
129
|
-
className
|
|
130
|
-
}) => /* @__PURE__ */ jsx2(
|
|
131
|
-
"div",
|
|
132
|
-
{
|
|
133
|
-
className: clsx("block px-3 py-1 bg-menu-background text-menu-text hover:brightness-90", {
|
|
134
|
-
"text-right": alignment === "right",
|
|
135
|
-
"text-left": alignment === "left"
|
|
136
|
-
}, className),
|
|
137
|
-
onClick,
|
|
138
|
-
children
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
var Menu = ({
|
|
142
|
-
trigger,
|
|
55
|
+
var Label = ({
|
|
143
56
|
children,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
57
|
+
name,
|
|
58
|
+
labelType = "labelSmall",
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
147
61
|
}) => {
|
|
148
|
-
|
|
149
|
-
const triggerRef = useRef(null);
|
|
150
|
-
const menuRef = useRef(null);
|
|
151
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
152
|
-
return /* @__PURE__ */ jsxs(
|
|
153
|
-
"div",
|
|
154
|
-
{
|
|
155
|
-
className: "relative",
|
|
156
|
-
...handlers,
|
|
157
|
-
children: [
|
|
158
|
-
trigger(() => setIsOpen(!isOpen), triggerRef),
|
|
159
|
-
isOpen ? /* @__PURE__ */ jsx2(
|
|
160
|
-
"div",
|
|
161
|
-
{
|
|
162
|
-
ref: menuRef,
|
|
163
|
-
onClick: (e) => e.stopPropagation(),
|
|
164
|
-
className: clsx("absolute top-full mt-1 py-2 w-60 rounded-lg bg-menu-background text-menu-text ring-1 ring-slate-900/5 text-sm leading-6 font-semibold shadow-md z-[1]", {
|
|
165
|
-
" top-[8px]": alignment[0] === "t",
|
|
166
|
-
" bottom-[8px]": alignment[0] === "b",
|
|
167
|
-
" left-[-8px]": alignment[1] === "l",
|
|
168
|
-
" right-[-8px]": alignment[1] === "r"
|
|
169
|
-
}, menuClassName),
|
|
170
|
-
children
|
|
171
|
-
}
|
|
172
|
-
) : null
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
);
|
|
62
|
+
return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
176
63
|
};
|
|
177
64
|
|
|
65
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
66
|
+
import { Search } from "lucide-react";
|
|
67
|
+
import clsx4 from "clsx";
|
|
68
|
+
|
|
178
69
|
// src/components/user-action/Input.tsx
|
|
179
|
-
import { forwardRef, useEffect as
|
|
180
|
-
import
|
|
70
|
+
import { forwardRef, useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
71
|
+
import clsx2 from "clsx";
|
|
181
72
|
|
|
182
73
|
// src/hooks/useSaveDelay.ts
|
|
183
|
-
import { useEffect as
|
|
74
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
184
75
|
function useSaveDelay(setNotificationStatus, delay) {
|
|
185
|
-
const [updateTimer, setUpdateTimer] =
|
|
186
|
-
const [notificationTimer, setNotificationTimer] =
|
|
76
|
+
const [updateTimer, setUpdateTimer] = useState3(void 0);
|
|
77
|
+
const [notificationTimer, setNotificationTimer] = useState3(void 0);
|
|
187
78
|
const restartTimer = (onSave) => {
|
|
188
79
|
clearTimeout(updateTimer);
|
|
189
80
|
setUpdateTimer(setTimeout(() => {
|
|
@@ -210,7 +101,7 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
210
101
|
setNotificationStatus(false);
|
|
211
102
|
}
|
|
212
103
|
};
|
|
213
|
-
|
|
104
|
+
useEffect3(() => {
|
|
214
105
|
return () => {
|
|
215
106
|
clearTimeout(updateTimer);
|
|
216
107
|
clearTimeout(notificationTimer);
|
|
@@ -222,26 +113,8 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
222
113
|
// src/util/noop.ts
|
|
223
114
|
var noop = () => void 0;
|
|
224
115
|
|
|
225
|
-
// src/components/user-action/Label.tsx
|
|
226
|
-
import clsx2 from "clsx";
|
|
227
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
228
|
-
var styleMapping = {
|
|
229
|
-
labelSmall: "textstyle-label-sm",
|
|
230
|
-
labelMedium: "textstyle-label-md",
|
|
231
|
-
labelBig: "textstyle-label-lg"
|
|
232
|
-
};
|
|
233
|
-
var Label = ({
|
|
234
|
-
children,
|
|
235
|
-
name,
|
|
236
|
-
labelType = "labelSmall",
|
|
237
|
-
className,
|
|
238
|
-
...props
|
|
239
|
-
}) => {
|
|
240
|
-
return /* @__PURE__ */ jsx3("label", { ...props, className: clsx2(styleMapping[labelType], className), children: children ? children : name });
|
|
241
|
-
};
|
|
242
|
-
|
|
243
116
|
// src/components/user-action/Input.tsx
|
|
244
|
-
import { jsx as
|
|
117
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
245
118
|
var Input = ({
|
|
246
119
|
id,
|
|
247
120
|
type = "text",
|
|
@@ -261,15 +134,15 @@ var Input = ({
|
|
|
261
134
|
restartTimer,
|
|
262
135
|
clearUpdateTimer
|
|
263
136
|
} = useSaveDelay(() => void 0, 3e3);
|
|
264
|
-
const ref =
|
|
265
|
-
|
|
137
|
+
const ref = useRef(null);
|
|
138
|
+
useEffect4(() => {
|
|
266
139
|
if (autoFocus) {
|
|
267
140
|
ref.current?.focus();
|
|
268
141
|
}
|
|
269
142
|
}, [autoFocus]);
|
|
270
|
-
return /* @__PURE__ */
|
|
271
|
-
label && /* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
|
|
144
|
+
label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
|
|
145
|
+
/* @__PURE__ */ jsx3(
|
|
273
146
|
"input",
|
|
274
147
|
{
|
|
275
148
|
ref,
|
|
@@ -313,13 +186,13 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
313
186
|
required,
|
|
314
187
|
...restProps
|
|
315
188
|
}, ref) {
|
|
316
|
-
const input = /* @__PURE__ */
|
|
189
|
+
const input = /* @__PURE__ */ jsx3(
|
|
317
190
|
"input",
|
|
318
191
|
{
|
|
319
192
|
ref,
|
|
320
193
|
id,
|
|
321
194
|
...restProps,
|
|
322
|
-
className:
|
|
195
|
+
className: clsx2(
|
|
323
196
|
{
|
|
324
197
|
"focus:border-primary focus:ring-primary": !errorText,
|
|
325
198
|
"focus:border-negative focus:ring-negative text-negative": !!errorText
|
|
@@ -328,91 +201,350 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
328
201
|
)
|
|
329
202
|
}
|
|
330
203
|
);
|
|
331
|
-
return /* @__PURE__ */
|
|
332
|
-
labelText && /* @__PURE__ */
|
|
204
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
|
|
205
|
+
labelText && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: clsx2("textstyle-label-md", labelClassName), children: [
|
|
333
206
|
labelText,
|
|
334
|
-
required && /* @__PURE__ */
|
|
207
|
+
required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
|
|
335
208
|
] }),
|
|
336
209
|
input,
|
|
337
|
-
errorText && /* @__PURE__ */
|
|
210
|
+
errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
|
|
338
211
|
] });
|
|
339
212
|
});
|
|
340
213
|
|
|
341
|
-
// src/components/user-action/
|
|
342
|
-
import
|
|
343
|
-
import
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
small: "size-4",
|
|
349
|
-
medium: "size-6",
|
|
350
|
-
large: "size-8"
|
|
214
|
+
// src/components/user-action/Button.tsx
|
|
215
|
+
import clsx3 from "clsx";
|
|
216
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
217
|
+
var paddingMapping = {
|
|
218
|
+
small: "btn-sm",
|
|
219
|
+
medium: "btn-md",
|
|
220
|
+
large: "btn-lg"
|
|
351
221
|
};
|
|
352
|
-
var
|
|
353
|
-
small: "
|
|
354
|
-
medium: "
|
|
355
|
-
large: "
|
|
222
|
+
var iconPaddingMapping = {
|
|
223
|
+
small: "icon-btn-sm",
|
|
224
|
+
medium: "icon-btn-md",
|
|
225
|
+
large: "icon-btn-lg"
|
|
356
226
|
};
|
|
357
|
-
var
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
227
|
+
var ButtonUtil = {
|
|
228
|
+
paddingMapping,
|
|
229
|
+
iconPaddingMapping
|
|
230
|
+
};
|
|
231
|
+
var SolidButton = ({
|
|
232
|
+
children,
|
|
233
|
+
disabled = false,
|
|
234
|
+
color = "primary",
|
|
364
235
|
size = "medium",
|
|
365
|
-
|
|
366
|
-
|
|
236
|
+
startIcon,
|
|
237
|
+
endIcon,
|
|
238
|
+
onClick,
|
|
239
|
+
className,
|
|
240
|
+
...restProps
|
|
367
241
|
}) => {
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
242
|
+
const colorClasses = {
|
|
243
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
244
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
245
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
246
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
247
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
248
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
249
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
250
|
+
}[color];
|
|
251
|
+
const iconColorClasses = {
|
|
252
|
+
primary: "text-button-solid-primary-icon",
|
|
253
|
+
secondary: "text-button-solid-secondary-icon",
|
|
254
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
255
|
+
positive: "text-button-solid-positive-icon",
|
|
256
|
+
warning: "text-button-solid-warning-icon",
|
|
257
|
+
negative: "text-button-solid-negative-icon",
|
|
258
|
+
neutral: "text-button-solid-neutral-icon"
|
|
259
|
+
}[color];
|
|
260
|
+
return /* @__PURE__ */ jsxs2(
|
|
261
|
+
"button",
|
|
262
|
+
{
|
|
263
|
+
onClick: disabled ? void 0 : onClick,
|
|
264
|
+
disabled: disabled || onClick === void 0,
|
|
265
|
+
className: clsx3(
|
|
266
|
+
{
|
|
267
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
268
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
269
|
+
},
|
|
270
|
+
ButtonUtil.paddingMapping[size],
|
|
271
|
+
className
|
|
272
|
+
),
|
|
273
|
+
...restProps,
|
|
274
|
+
children: [
|
|
275
|
+
startIcon && /* @__PURE__ */ jsx4(
|
|
276
|
+
"span",
|
|
277
|
+
{
|
|
278
|
+
className: clsx3({
|
|
279
|
+
[iconColorClasses]: !disabled,
|
|
280
|
+
[`text-disabled-icon`]: disabled
|
|
281
|
+
}),
|
|
282
|
+
children: startIcon
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
children,
|
|
286
|
+
endIcon && /* @__PURE__ */ jsx4(
|
|
287
|
+
"span",
|
|
288
|
+
{
|
|
289
|
+
className: clsx3({
|
|
290
|
+
[iconColorClasses]: !disabled,
|
|
291
|
+
[`text-disabled-icon`]: disabled
|
|
292
|
+
}),
|
|
293
|
+
children: endIcon
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
]
|
|
373
297
|
}
|
|
374
|
-
|
|
375
|
-
|
|
298
|
+
);
|
|
299
|
+
};
|
|
300
|
+
var IconButton = ({
|
|
301
|
+
children,
|
|
302
|
+
disabled = false,
|
|
303
|
+
color = "primary",
|
|
304
|
+
size = "medium",
|
|
305
|
+
onClick,
|
|
306
|
+
className,
|
|
307
|
+
...restProps
|
|
308
|
+
}) => {
|
|
309
|
+
const colorClasses = {
|
|
310
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
311
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
312
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
313
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
314
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
315
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
316
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
317
|
+
}[color];
|
|
318
|
+
return /* @__PURE__ */ jsx4(
|
|
319
|
+
"button",
|
|
320
|
+
{
|
|
321
|
+
onClick: disabled ? void 0 : onClick,
|
|
322
|
+
disabled: disabled || onClick === void 0,
|
|
323
|
+
className: clsx3(
|
|
324
|
+
{
|
|
325
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
326
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
327
|
+
},
|
|
328
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
329
|
+
className
|
|
330
|
+
),
|
|
331
|
+
...restProps,
|
|
332
|
+
children
|
|
376
333
|
}
|
|
334
|
+
);
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// src/hooks/useSearch.ts
|
|
338
|
+
import { useEffect as useEffect5, useMemo, useState as useState5 } from "react";
|
|
339
|
+
|
|
340
|
+
// src/util/simpleSearch.ts
|
|
341
|
+
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
342
|
+
return objects.filter((object) => {
|
|
343
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
344
|
+
if (!mappedSearchKeywords) {
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
// src/hooks/useSearch.ts
|
|
352
|
+
var useSearch = ({
|
|
353
|
+
list,
|
|
354
|
+
initialSearch,
|
|
355
|
+
searchMapping
|
|
356
|
+
}) => {
|
|
357
|
+
const [items, setItems] = useState5(list);
|
|
358
|
+
const [search, setSearch] = useState5(initialSearch);
|
|
359
|
+
useEffect5(() => {
|
|
360
|
+
setItems(list);
|
|
361
|
+
}, [list]);
|
|
362
|
+
const result = useMemo(
|
|
363
|
+
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
364
|
+
[search, items, searchMapping]
|
|
365
|
+
);
|
|
366
|
+
return {
|
|
367
|
+
result,
|
|
368
|
+
hasResult: result.length > 0,
|
|
369
|
+
allItems: items,
|
|
370
|
+
setItems,
|
|
371
|
+
search,
|
|
372
|
+
setSearch
|
|
377
373
|
};
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
// src/components/layout-and-navigation/SearchableList.tsx
|
|
377
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
378
|
+
var defaultSearchableListTranslation = {
|
|
379
|
+
en: {
|
|
380
|
+
search: "Search",
|
|
381
|
+
nothingFound: "Nothing found"
|
|
382
|
+
},
|
|
383
|
+
de: {
|
|
384
|
+
search: "Suche",
|
|
385
|
+
nothingFound: "Nichts gefunden"
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
var SearchableList = ({
|
|
389
|
+
overwriteTranslation,
|
|
390
|
+
list,
|
|
391
|
+
initialSearch = "",
|
|
392
|
+
searchMapping,
|
|
393
|
+
autoFocus,
|
|
394
|
+
minimumItemsForSearch = 6,
|
|
395
|
+
itemMapper,
|
|
396
|
+
className,
|
|
397
|
+
resultListClassName
|
|
398
|
+
}) => {
|
|
399
|
+
const translation = useTranslation(defaultSearchableListTranslation, overwriteTranslation);
|
|
400
|
+
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
401
|
+
return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
|
|
402
|
+
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
403
|
+
/* @__PURE__ */ jsx5(
|
|
404
|
+
Input,
|
|
405
|
+
{
|
|
406
|
+
value: search,
|
|
407
|
+
onChangeText: setSearch,
|
|
408
|
+
placeholder: translation.search,
|
|
409
|
+
autoFocus,
|
|
410
|
+
className: "w-full"
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
/* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
|
|
414
|
+
] }),
|
|
415
|
+
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 })
|
|
411
416
|
] });
|
|
412
417
|
};
|
|
413
418
|
|
|
414
|
-
// src/components/
|
|
419
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
420
|
+
import clsx5 from "clsx";
|
|
421
|
+
import { Check } from "lucide-react";
|
|
415
422
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
423
|
+
var Tile = ({
|
|
424
|
+
title,
|
|
425
|
+
description,
|
|
426
|
+
onClick,
|
|
427
|
+
isSelected = false,
|
|
428
|
+
isDisabled = false,
|
|
429
|
+
prefix,
|
|
430
|
+
suffix,
|
|
431
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
432
|
+
selectedClassName = " bg-primary/20",
|
|
433
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
434
|
+
className
|
|
435
|
+
}) => {
|
|
436
|
+
return /* @__PURE__ */ jsxs4(
|
|
437
|
+
"div",
|
|
438
|
+
{
|
|
439
|
+
className: clsx5(
|
|
440
|
+
"row gap-x-2 w-full items-center",
|
|
441
|
+
{
|
|
442
|
+
[normalClassName]: !!onClick && !isDisabled,
|
|
443
|
+
[selectedClassName]: isSelected && !isDisabled,
|
|
444
|
+
[disabledClassName]: isDisabled
|
|
445
|
+
},
|
|
446
|
+
className
|
|
447
|
+
),
|
|
448
|
+
onClick: isDisabled ? void 0 : onClick,
|
|
449
|
+
children: [
|
|
450
|
+
prefix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0),
|
|
451
|
+
/* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
|
|
452
|
+
/* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
453
|
+
!!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
|
|
454
|
+
] }),
|
|
455
|
+
suffix
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// src/components/layout-and-navigation/Chip.tsx
|
|
462
|
+
import clsx6 from "clsx";
|
|
463
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
464
|
+
var Chip = ({
|
|
465
|
+
children,
|
|
466
|
+
trailingIcon,
|
|
467
|
+
color = "default",
|
|
468
|
+
variant = "normal",
|
|
469
|
+
className = "",
|
|
470
|
+
...restProps
|
|
471
|
+
}) => {
|
|
472
|
+
const colorMapping = {
|
|
473
|
+
default: "text-tag-default-text bg-tag-default-background",
|
|
474
|
+
dark: "text-tag-dark-text bg-tag-dark-background",
|
|
475
|
+
red: "text-tag-red-text bg-tag-red-background",
|
|
476
|
+
yellow: "text-tag-yellow-text bg-tag-yellow-background",
|
|
477
|
+
green: "text-tag-green-text bg-tag-green-background",
|
|
478
|
+
blue: "text-tag-blue-text bg-tag-blue-background",
|
|
479
|
+
pink: "text-tag-pink-text bg-tag-pink-background"
|
|
480
|
+
}[color];
|
|
481
|
+
const colorMappingIcon = {
|
|
482
|
+
default: "text-tag-default-icon",
|
|
483
|
+
dark: "text-tag-dark-icon",
|
|
484
|
+
red: "text-tag-red-icon",
|
|
485
|
+
yellow: "text-tag-yellow-icon",
|
|
486
|
+
green: "text-tag-green-icon",
|
|
487
|
+
blue: "text-tag-blue-icon",
|
|
488
|
+
pink: "text-tag-pink-icon"
|
|
489
|
+
}[color];
|
|
490
|
+
return /* @__PURE__ */ jsxs5(
|
|
491
|
+
"div",
|
|
492
|
+
{
|
|
493
|
+
...restProps,
|
|
494
|
+
className: clsx6(
|
|
495
|
+
`row w-fit px-2 py-1`,
|
|
496
|
+
colorMapping,
|
|
497
|
+
{
|
|
498
|
+
"rounded-md": variant === "normal",
|
|
499
|
+
"rounded-full": variant === "fullyRounded"
|
|
500
|
+
},
|
|
501
|
+
className
|
|
502
|
+
),
|
|
503
|
+
children: [
|
|
504
|
+
children,
|
|
505
|
+
trailingIcon && /* @__PURE__ */ jsx7("span", { className: colorMappingIcon, children: trailingIcon })
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
);
|
|
509
|
+
};
|
|
510
|
+
var ChipList = ({
|
|
511
|
+
list,
|
|
512
|
+
className = ""
|
|
513
|
+
}) => {
|
|
514
|
+
return /* @__PURE__ */ jsx7("div", { className: clsx6("flex flex-wrap gap-x-4 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ jsx7(
|
|
515
|
+
Chip,
|
|
516
|
+
{
|
|
517
|
+
...value,
|
|
518
|
+
color: value.color ?? "dark",
|
|
519
|
+
variant: value.variant ?? "normal",
|
|
520
|
+
children: value.children
|
|
521
|
+
},
|
|
522
|
+
index
|
|
523
|
+
)) });
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
// src/hooks/useOutsideClick.ts
|
|
527
|
+
import { useEffect as useEffect6 } from "react";
|
|
528
|
+
var useOutsideClick = (refs, handler) => {
|
|
529
|
+
useEffect6(() => {
|
|
530
|
+
const listener = (event) => {
|
|
531
|
+
if (event.target === null) return;
|
|
532
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
handler();
|
|
536
|
+
};
|
|
537
|
+
document.addEventListener("mousedown", listener);
|
|
538
|
+
document.addEventListener("touchstart", listener);
|
|
539
|
+
return () => {
|
|
540
|
+
document.removeEventListener("mousedown", listener);
|
|
541
|
+
document.removeEventListener("touchstart", listener);
|
|
542
|
+
};
|
|
543
|
+
}, [refs, handler]);
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
// src/components/user-action/MultiSelect.tsx
|
|
547
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
416
548
|
var defaultMultiSelectTranslation = {
|
|
417
549
|
en: {
|
|
418
550
|
select: "Select",
|
|
@@ -428,108 +560,148 @@ var defaultMultiSelectTranslation = {
|
|
|
428
560
|
var MultiSelect = ({
|
|
429
561
|
overwriteTranslation,
|
|
430
562
|
options,
|
|
431
|
-
onChange,
|
|
432
|
-
search,
|
|
433
|
-
disabled = false,
|
|
434
|
-
selectedDisplay,
|
|
435
563
|
label,
|
|
564
|
+
onChange,
|
|
436
565
|
hintText,
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
566
|
+
isDisabled = false,
|
|
567
|
+
isSearchEnabled = false,
|
|
568
|
+
selectedDisplayOverwrite,
|
|
569
|
+
useChipDisplay = false,
|
|
570
|
+
className = ""
|
|
440
571
|
}) => {
|
|
441
572
|
const translation = useTranslation(defaultMultiSelectTranslation, overwriteTranslation);
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
filteredOptions = MultiSearchWithMapping(
|
|
447
|
-
searchText,
|
|
448
|
-
filteredOptions,
|
|
449
|
-
(value) => search.searchMapping(value)
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
if (!showDisabledOptions) {
|
|
453
|
-
filteredOptions = filteredOptions.filter((value) => !value.disabled);
|
|
454
|
-
}
|
|
573
|
+
const triggerRef = useRef2(null);
|
|
574
|
+
const menuRef = useRef2(null);
|
|
575
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
576
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
455
577
|
const selectedItems = options.filter((value) => value.selected);
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
label && /* @__PURE__ */ jsx6(
|
|
578
|
+
const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
|
|
579
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7(className), children: [
|
|
580
|
+
label && /* @__PURE__ */ jsx8(
|
|
460
581
|
Label,
|
|
461
582
|
{
|
|
462
583
|
...label,
|
|
463
584
|
htmlFor: label.name,
|
|
464
|
-
className:
|
|
585
|
+
className: clsx7(" mb-1", label.className),
|
|
465
586
|
labelType: label.labelType ?? "labelBig"
|
|
466
587
|
}
|
|
467
588
|
),
|
|
468
|
-
/* @__PURE__ */
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
ref,
|
|
476
|
-
onClick: disabled ? void 0 : onClick,
|
|
477
|
-
className: clsx5(
|
|
478
|
-
borderColor,
|
|
479
|
-
"bg-menu-background text-menu-text inline-w-full justify-between items-center rounded-lg border-2 px-4 py-2 font-medium",
|
|
480
|
-
{
|
|
481
|
-
"hover:border-primary cursor-pointer": !disabled,
|
|
482
|
-
"bg-disabled-background text-disabled cursor-not-allowed": disabled
|
|
483
|
-
},
|
|
484
|
-
triggerClassName
|
|
485
|
-
),
|
|
486
|
-
children: selectedDisplay ? selectedDisplay({ items: options, disabled }) : menuButtonText
|
|
487
|
-
}
|
|
488
|
-
),
|
|
489
|
-
menuClassName: clsx5(
|
|
490
|
-
"!rounded-lg !shadow-lg !max-h-[500px] !min-w-[400px] !max-w-[70vh] !overflow-y-auto !border !border-2",
|
|
491
|
-
borderColor,
|
|
492
|
-
{ "!py-0": !enableSearch, "!pb-0": enableSearch }
|
|
493
|
-
),
|
|
494
|
-
children: [
|
|
495
|
-
enableSearch && /* @__PURE__ */ jsxs4("div", { className: "row gap-x-2 items-center px-2 py-2", children: [
|
|
496
|
-
/* @__PURE__ */ jsx6(Input, { autoFocus: true, className: "w-full", value: searchText, onChangeText: setSearchText }),
|
|
497
|
-
/* @__PURE__ */ jsx6(Search, {})
|
|
498
|
-
] }, "selectSearch"),
|
|
499
|
-
filteredOptions.map((option, index) => /* @__PURE__ */ jsx6(
|
|
500
|
-
MenuItem,
|
|
589
|
+
/* @__PURE__ */ jsxs6("div", { className: "relative", children: [
|
|
590
|
+
/* @__PURE__ */ jsxs6(
|
|
591
|
+
"button",
|
|
592
|
+
{
|
|
593
|
+
ref: triggerRef,
|
|
594
|
+
className: clsx7(
|
|
595
|
+
"btn-md justify-between w-full border-2 h-auto",
|
|
501
596
|
{
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
597
|
+
"rounded-b-lg": !open,
|
|
598
|
+
"bg-menu-background border-menu-border hover:border-primary": !isDisabled,
|
|
599
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
onClick: () => setIsOpen(!isOpen),
|
|
603
|
+
disabled: isDisabled,
|
|
604
|
+
children: [
|
|
605
|
+
!isShowingHint && /* @__PURE__ */ jsx8("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? (useChipDisplay && selectedItems ? /* @__PURE__ */ jsx8(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) : `${selectedItems.length} ${translation.selected}`) }),
|
|
606
|
+
isShowingHint && /* @__PURE__ */ jsx8("span", { className: "textstyle-description", children: hintText ?? translation.select }),
|
|
607
|
+
isOpen ? /* @__PURE__ */ jsx8(ChevronUp, { size: 24, className: "min-w-6" }) : /* @__PURE__ */ jsx8(ChevronDown, { className: "min-w-6" })
|
|
608
|
+
]
|
|
609
|
+
}
|
|
610
|
+
),
|
|
611
|
+
isOpen && /* @__PURE__ */ jsxs6(
|
|
612
|
+
"div",
|
|
613
|
+
{
|
|
614
|
+
ref: menuRef,
|
|
615
|
+
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",
|
|
616
|
+
children: [
|
|
617
|
+
/* @__PURE__ */ jsx8(
|
|
618
|
+
SearchableList,
|
|
619
|
+
{
|
|
620
|
+
list: options,
|
|
621
|
+
minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
|
|
622
|
+
searchMapping: (item) => item.searchTags,
|
|
623
|
+
itemMapper: (option, index) => /* @__PURE__ */ jsx8(
|
|
624
|
+
Tile,
|
|
625
|
+
{
|
|
626
|
+
isSelected: option.selected,
|
|
627
|
+
className: "px-2 py-1 rounded-md",
|
|
628
|
+
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
629
|
+
title: { value: option.label, className: "font-semibold" },
|
|
630
|
+
onClick: () => {
|
|
512
631
|
onChange(options.map((value) => value.value === option.value ? {
|
|
513
632
|
...option,
|
|
514
633
|
selected: !value.selected
|
|
515
634
|
} : value));
|
|
516
|
-
}
|
|
635
|
+
},
|
|
636
|
+
isDisabled: option.disabled
|
|
517
637
|
},
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
638
|
+
index
|
|
639
|
+
)
|
|
640
|
+
}
|
|
641
|
+
),
|
|
642
|
+
/* @__PURE__ */ jsxs6("div", { className: "row justify-between mt-2", children: [
|
|
643
|
+
/* @__PURE__ */ jsxs6("div", { className: "row gap-x-2", children: [
|
|
644
|
+
/* @__PURE__ */ jsx8(
|
|
645
|
+
SolidButton,
|
|
646
|
+
{
|
|
647
|
+
color: "neutral",
|
|
648
|
+
size: "small",
|
|
649
|
+
onClick: () => {
|
|
650
|
+
onChange(options.map((option) => ({
|
|
651
|
+
...option,
|
|
652
|
+
selected: !option.disabled
|
|
653
|
+
})));
|
|
654
|
+
},
|
|
655
|
+
disabled: options.every((value) => value.selected || value.disabled),
|
|
656
|
+
children: "All"
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ jsx8(
|
|
660
|
+
SolidButton,
|
|
661
|
+
{
|
|
662
|
+
color: "neutral",
|
|
663
|
+
size: "small",
|
|
664
|
+
onClick: () => {
|
|
665
|
+
onChange(options.map((option) => ({
|
|
666
|
+
...option,
|
|
667
|
+
selected: false
|
|
668
|
+
})));
|
|
669
|
+
},
|
|
670
|
+
children: "None"
|
|
671
|
+
}
|
|
672
|
+
)
|
|
673
|
+
] }),
|
|
674
|
+
/* @__PURE__ */ jsx8(SolidButton, { size: "small", onClick: () => setIsOpen(false), children: "Done" })
|
|
675
|
+
] })
|
|
676
|
+
]
|
|
677
|
+
}
|
|
678
|
+
)
|
|
679
|
+
] })
|
|
530
680
|
] });
|
|
531
681
|
};
|
|
682
|
+
var MultiSelectUncontrolled = ({
|
|
683
|
+
options,
|
|
684
|
+
onChange,
|
|
685
|
+
...props
|
|
686
|
+
}) => {
|
|
687
|
+
const [usedOptions, setUsedOptions] = useState6(options);
|
|
688
|
+
useEffect7(() => {
|
|
689
|
+
setUsedOptions(options);
|
|
690
|
+
}, [options]);
|
|
691
|
+
return /* @__PURE__ */ jsx8(
|
|
692
|
+
MultiSelect,
|
|
693
|
+
{
|
|
694
|
+
...props,
|
|
695
|
+
options: usedOptions,
|
|
696
|
+
onChange: (options2) => {
|
|
697
|
+
setUsedOptions(options2);
|
|
698
|
+
onChange(options2);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
);
|
|
702
|
+
};
|
|
532
703
|
export {
|
|
533
|
-
MultiSelect
|
|
704
|
+
MultiSelect,
|
|
705
|
+
MultiSelectUncontrolled
|
|
534
706
|
};
|
|
535
707
|
//# sourceMappingURL=MultiSelect.mjs.map
|