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