@helpwave/hightide 0.0.15 → 0.0.16
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/index.d.mts +86 -2
- package/dist/index.d.ts +86 -2
- package/dist/index.js +5714 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5541 -0
- package/dist/index.mjs.map +1 -1
- package/dist/util/news.d.mts +9 -9
- package/dist/util/news.d.ts +9 -9
- package/package.json +11 -7
- package/dist/components/Span.d.mts +0 -2
- package/dist/components/Span.d.ts +0 -2
- package/dist/components/Span.js +0 -2
- package/dist/components/Span.js.map +0 -1
- package/dist/components/Span.mjs +0 -1
- package/dist/components/Span.mjs.map +0 -1
- package/dist/components/examples/InputGroupExample.d.mts +0 -11
- package/dist/components/examples/InputGroupExample.d.ts +0 -11
- package/dist/components/examples/InputGroupExample.js +0 -466
- package/dist/components/examples/InputGroupExample.js.map +0 -1
- package/dist/components/examples/InputGroupExample.mjs +0 -436
- package/dist/components/examples/InputGroupExample.mjs.map +0 -1
- package/dist/components/examples/MultiSelectExample.d.mts +0 -14
- package/dist/components/examples/MultiSelectExample.d.ts +0 -14
- package/dist/components/examples/MultiSelectExample.js +0 -661
- package/dist/components/examples/MultiSelectExample.js.map +0 -1
- package/dist/components/examples/MultiSelectExample.mjs +0 -631
- package/dist/components/examples/MultiSelectExample.mjs.map +0 -1
- package/dist/components/examples/SearchableSelectExample.d.mts +0 -13
- package/dist/components/examples/SearchableSelectExample.d.ts +0 -13
- package/dist/components/examples/SearchableSelectExample.js +0 -365
- package/dist/components/examples/SearchableSelectExample.js.map +0 -1
- package/dist/components/examples/SearchableSelectExample.mjs +0 -335
- package/dist/components/examples/SearchableSelectExample.mjs.map +0 -1
- package/dist/components/examples/SelectExample.d.mts +0 -9
- package/dist/components/examples/SelectExample.d.ts +0 -9
- package/dist/components/examples/SelectExample.js +0 -180
- package/dist/components/examples/SelectExample.js.map +0 -1
- package/dist/components/examples/SelectExample.mjs +0 -145
- package/dist/components/examples/SelectExample.mjs.map +0 -1
- package/dist/components/examples/StackingModals.d.mts +0 -8
- package/dist/components/examples/StackingModals.d.ts +0 -8
- package/dist/components/examples/StackingModals.js +0 -498
- package/dist/components/examples/StackingModals.js.map +0 -1
- package/dist/components/examples/StackingModals.mjs +0 -463
- package/dist/components/examples/StackingModals.mjs.map +0 -1
- package/dist/components/examples/TableExample.d.mts +0 -13
- package/dist/components/examples/TableExample.d.ts +0 -13
- package/dist/components/examples/TableExample.js +0 -853
- package/dist/components/examples/TableExample.js.map +0 -1
- package/dist/components/examples/TableExample.mjs +0 -823
- package/dist/components/examples/TableExample.mjs.map +0 -1
- package/dist/components/examples/TextareaExample.d.mts +0 -12
- package/dist/components/examples/TextareaExample.d.ts +0 -12
- package/dist/components/examples/TextareaExample.js +0 -176
- package/dist/components/examples/TextareaExample.js.map +0 -1
- package/dist/components/examples/TextareaExample.mjs +0 -141
- package/dist/components/examples/TextareaExample.mjs.map +0 -1
- package/dist/components/examples/TileExample.d.mts +0 -14
- package/dist/components/examples/TileExample.d.ts +0 -14
- package/dist/components/examples/TileExample.js +0 -79
- package/dist/components/examples/TileExample.js.map +0 -1
- package/dist/components/examples/TileExample.mjs +0 -44
- package/dist/components/examples/TileExample.mjs.map +0 -1
- package/dist/components/examples/Title.d.mts +0 -2
- package/dist/components/examples/Title.d.ts +0 -2
- package/dist/components/examples/Title.js +0 -2
- package/dist/components/examples/Title.js.map +0 -1
- package/dist/components/examples/Title.mjs +0 -1
- package/dist/components/examples/Title.mjs.map +0 -1
- package/dist/components/examples/date/DateTimePickerExample.d.mts +0 -18
- package/dist/components/examples/date/DateTimePickerExample.d.ts +0 -18
- package/dist/components/examples/date/DateTimePickerExample.js +0 -879
- package/dist/components/examples/date/DateTimePickerExample.js.map +0 -1
- package/dist/components/examples/date/DateTimePickerExample.mjs +0 -844
- package/dist/components/examples/date/DateTimePickerExample.mjs.map +0 -1
- package/dist/components/examples/properties/CheckboxPropertyExample.d.mts +0 -16
- package/dist/components/examples/properties/CheckboxPropertyExample.d.ts +0 -16
- package/dist/components/examples/properties/CheckboxPropertyExample.js +0 -349
- package/dist/components/examples/properties/CheckboxPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/CheckboxPropertyExample.mjs +0 -314
- package/dist/components/examples/properties/CheckboxPropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/DatePropertyExample.d.mts +0 -16
- package/dist/components/examples/properties/DatePropertyExample.d.ts +0 -16
- package/dist/components/examples/properties/DatePropertyExample.js +0 -460
- package/dist/components/examples/properties/DatePropertyExample.js.map +0 -1
- package/dist/components/examples/properties/DatePropertyExample.mjs +0 -430
- package/dist/components/examples/properties/DatePropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/MultiSelectPropertyExample.d.mts +0 -18
- package/dist/components/examples/properties/MultiSelectPropertyExample.d.ts +0 -18
- package/dist/components/examples/properties/MultiSelectPropertyExample.js +0 -848
- package/dist/components/examples/properties/MultiSelectPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/MultiSelectPropertyExample.mjs +0 -818
- package/dist/components/examples/properties/MultiSelectPropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/NumberPropertyExample.d.mts +0 -14
- package/dist/components/examples/properties/NumberPropertyExample.d.ts +0 -14
- package/dist/components/examples/properties/NumberPropertyExample.js +0 -456
- package/dist/components/examples/properties/NumberPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/NumberPropertyExample.mjs +0 -426
- package/dist/components/examples/properties/NumberPropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/SelectPropertyExample.d.mts +0 -17
- package/dist/components/examples/properties/SelectPropertyExample.d.ts +0 -17
- package/dist/components/examples/properties/SelectPropertyExample.js +0 -584
- package/dist/components/examples/properties/SelectPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/SelectPropertyExample.mjs +0 -554
- package/dist/components/examples/properties/SelectPropertyExample.mjs.map +0 -1
- package/dist/components/examples/properties/TextPropertyExample.d.mts +0 -16
- package/dist/components/examples/properties/TextPropertyExample.d.ts +0 -16
- package/dist/components/examples/properties/TextPropertyExample.js +0 -405
- package/dist/components/examples/properties/TextPropertyExample.js.map +0 -1
- package/dist/components/examples/properties/TextPropertyExample.mjs +0 -370
- package/dist/components/examples/properties/TextPropertyExample.mjs.map +0 -1
|
@@ -1,848 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/components/examples/properties/MultiSelectPropertyExample.tsx
|
|
31
|
-
var MultiSelectPropertyExample_exports = {};
|
|
32
|
-
__export(MultiSelectPropertyExample_exports, {
|
|
33
|
-
MultiSelectPropertyExample: () => MultiSelectPropertyExample
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(MultiSelectPropertyExample_exports);
|
|
36
|
-
var import_react10 = require("react");
|
|
37
|
-
|
|
38
|
-
// src/components/properties/MultiSelectProperty.tsx
|
|
39
|
-
var import_lucide_react4 = require("lucide-react");
|
|
40
|
-
var import_clsx8 = __toESM(require("clsx"));
|
|
41
|
-
|
|
42
|
-
// src/hooks/useLanguage.tsx
|
|
43
|
-
var import_react2 = require("react");
|
|
44
|
-
|
|
45
|
-
// src/hooks/useLocalStorage.tsx
|
|
46
|
-
var import_react = require("react");
|
|
47
|
-
|
|
48
|
-
// src/hooks/useLanguage.tsx
|
|
49
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
-
var DEFAULT_LANGUAGE = "en";
|
|
51
|
-
var LanguageContext = (0, import_react2.createContext)({ language: DEFAULT_LANGUAGE, setLanguage: (v) => v });
|
|
52
|
-
var useLanguage = () => (0, import_react2.useContext)(LanguageContext);
|
|
53
|
-
|
|
54
|
-
// src/hooks/useTranslation.ts
|
|
55
|
-
var useTranslation = (defaults, translationOverwrite = {}) => {
|
|
56
|
-
const { language: languageProp, translation: overwrite } = translationOverwrite;
|
|
57
|
-
const { language: inferredLanguage } = useLanguage();
|
|
58
|
-
const usedLanguage = languageProp ?? inferredLanguage;
|
|
59
|
-
let defaultValues = defaults[usedLanguage];
|
|
60
|
-
if (overwrite && overwrite[usedLanguage]) {
|
|
61
|
-
defaultValues = { ...defaultValues, ...overwrite[usedLanguage] };
|
|
62
|
-
}
|
|
63
|
-
return defaultValues;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// src/components/user-input/MultiSelect.tsx
|
|
67
|
-
var import_react9 = require("react");
|
|
68
|
-
var import_lucide_react2 = require("lucide-react");
|
|
69
|
-
|
|
70
|
-
// src/util/simpleSearch.ts
|
|
71
|
-
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
72
|
-
return objects.filter((object) => {
|
|
73
|
-
const mappedSearchKeywords = mapping(object).map((value) => value.toLowerCase().trim());
|
|
74
|
-
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// src/components/user-input/MultiSelect.tsx
|
|
79
|
-
var import_clsx4 = __toESM(require("clsx"));
|
|
80
|
-
|
|
81
|
-
// src/components/user-input/Menu.tsx
|
|
82
|
-
var import_react5 = require("react");
|
|
83
|
-
var import_clsx = __toESM(require("clsx"));
|
|
84
|
-
|
|
85
|
-
// src/hooks/useOutsideClick.ts
|
|
86
|
-
var import_react3 = require("react");
|
|
87
|
-
var useOutsideClick = (refs, handler) => {
|
|
88
|
-
(0, import_react3.useEffect)(() => {
|
|
89
|
-
const listener = (event) => {
|
|
90
|
-
if (event.target === null) return;
|
|
91
|
-
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
handler();
|
|
95
|
-
};
|
|
96
|
-
document.addEventListener("mousedown", listener);
|
|
97
|
-
document.addEventListener("touchstart", listener);
|
|
98
|
-
return () => {
|
|
99
|
-
document.removeEventListener("mousedown", listener);
|
|
100
|
-
document.removeEventListener("touchstart", listener);
|
|
101
|
-
};
|
|
102
|
-
}, [refs, handler]);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// src/hooks/useHoverState.ts
|
|
106
|
-
var import_react4 = require("react");
|
|
107
|
-
var defaultUseHoverStateProps = {
|
|
108
|
-
closingDelay: 200,
|
|
109
|
-
isDisabled: false
|
|
110
|
-
};
|
|
111
|
-
var useHoverState = (props = void 0) => {
|
|
112
|
-
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
113
|
-
const [isHovered, setIsHovered] = (0, import_react4.useState)(false);
|
|
114
|
-
const [timer, setTimer] = (0, import_react4.useState)();
|
|
115
|
-
const onMouseEnter = () => {
|
|
116
|
-
if (isDisabled) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
clearTimeout(timer);
|
|
120
|
-
setIsHovered(true);
|
|
121
|
-
};
|
|
122
|
-
const onMouseLeave = () => {
|
|
123
|
-
if (isDisabled) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
setTimer(setTimeout(() => {
|
|
127
|
-
setIsHovered(false);
|
|
128
|
-
}, closingDelay));
|
|
129
|
-
};
|
|
130
|
-
(0, import_react4.useEffect)(() => {
|
|
131
|
-
if (timer) {
|
|
132
|
-
return () => {
|
|
133
|
-
clearTimeout(timer);
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
(0, import_react4.useEffect)(() => {
|
|
138
|
-
if (timer) {
|
|
139
|
-
clearTimeout(timer);
|
|
140
|
-
}
|
|
141
|
-
}, [isDisabled]);
|
|
142
|
-
return {
|
|
143
|
-
isHovered,
|
|
144
|
-
setIsHovered,
|
|
145
|
-
handlers: { onMouseEnter, onMouseLeave }
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// src/components/user-input/Menu.tsx
|
|
150
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
151
|
-
var MenuItem = ({
|
|
152
|
-
children,
|
|
153
|
-
onClick,
|
|
154
|
-
alignment = "left",
|
|
155
|
-
className
|
|
156
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
157
|
-
"div",
|
|
158
|
-
{
|
|
159
|
-
className: (0, import_clsx.default)("block px-3 py-1 bg-menu-background text-menu-text hover:brightness-90", {
|
|
160
|
-
"text-right": alignment === "right",
|
|
161
|
-
"text-left": alignment === "left"
|
|
162
|
-
}, className),
|
|
163
|
-
onClick,
|
|
164
|
-
children
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
var Menu = ({
|
|
168
|
-
trigger,
|
|
169
|
-
children,
|
|
170
|
-
alignment = "tl",
|
|
171
|
-
showOnHover = false,
|
|
172
|
-
menuClassName = ""
|
|
173
|
-
}) => {
|
|
174
|
-
const { isHovered: isOpen, setIsHovered: setIsOpen, handlers } = useHoverState({ isDisabled: !showOnHover });
|
|
175
|
-
const triggerRef = (0, import_react5.useRef)(null);
|
|
176
|
-
const menuRef = (0, import_react5.useRef)(null);
|
|
177
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
178
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
179
|
-
"div",
|
|
180
|
-
{
|
|
181
|
-
className: "relative",
|
|
182
|
-
...handlers,
|
|
183
|
-
children: [
|
|
184
|
-
trigger(() => setIsOpen(!isOpen), triggerRef),
|
|
185
|
-
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
186
|
-
"div",
|
|
187
|
-
{
|
|
188
|
-
ref: menuRef,
|
|
189
|
-
onClick: (e) => e.stopPropagation(),
|
|
190
|
-
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]", {
|
|
191
|
-
" top-[8px]": alignment[0] === "t",
|
|
192
|
-
" bottom-[8px]": alignment[0] === "b",
|
|
193
|
-
" left-[-8px]": alignment[1] === "l",
|
|
194
|
-
" right-[-8px]": alignment[1] === "r"
|
|
195
|
-
}, menuClassName),
|
|
196
|
-
children
|
|
197
|
-
}
|
|
198
|
-
) : null
|
|
199
|
-
]
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
// src/components/user-input/Input.tsx
|
|
205
|
-
var import_react7 = require("react");
|
|
206
|
-
var import_clsx2 = __toESM(require("clsx"));
|
|
207
|
-
|
|
208
|
-
// src/hooks/useSaveDelay.ts
|
|
209
|
-
var import_react6 = require("react");
|
|
210
|
-
function useSaveDelay(setNotificationStatus, delay) {
|
|
211
|
-
const [updateTimer, setUpdateTimer] = (0, import_react6.useState)(void 0);
|
|
212
|
-
const [notificationTimer, setNotificationTimer] = (0, import_react6.useState)(void 0);
|
|
213
|
-
const restartTimer = (onSave) => {
|
|
214
|
-
clearTimeout(updateTimer);
|
|
215
|
-
setUpdateTimer(setTimeout(() => {
|
|
216
|
-
onSave();
|
|
217
|
-
setNotificationStatus(true);
|
|
218
|
-
clearTimeout(notificationTimer);
|
|
219
|
-
setNotificationTimer(setTimeout(() => {
|
|
220
|
-
setNotificationStatus(false);
|
|
221
|
-
clearTimeout(notificationTimer);
|
|
222
|
-
}, delay));
|
|
223
|
-
clearTimeout(updateTimer);
|
|
224
|
-
}, delay));
|
|
225
|
-
};
|
|
226
|
-
const clearUpdateTimer = (hasSaved = true) => {
|
|
227
|
-
clearTimeout(updateTimer);
|
|
228
|
-
if (hasSaved) {
|
|
229
|
-
setNotificationStatus(true);
|
|
230
|
-
clearTimeout(notificationTimer);
|
|
231
|
-
setNotificationTimer(setTimeout(() => {
|
|
232
|
-
setNotificationStatus(false);
|
|
233
|
-
clearTimeout(notificationTimer);
|
|
234
|
-
}, delay));
|
|
235
|
-
} else {
|
|
236
|
-
setNotificationStatus(false);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
(0, import_react6.useEffect)(() => {
|
|
240
|
-
return () => {
|
|
241
|
-
clearTimeout(updateTimer);
|
|
242
|
-
clearTimeout(notificationTimer);
|
|
243
|
-
};
|
|
244
|
-
}, []);
|
|
245
|
-
return { restartTimer, clearUpdateTimer };
|
|
246
|
-
}
|
|
247
|
-
var useSaveDelay_default = useSaveDelay;
|
|
248
|
-
|
|
249
|
-
// src/util/noop.ts
|
|
250
|
-
var noop = () => void 0;
|
|
251
|
-
|
|
252
|
-
// src/components/user-input/Label.tsx
|
|
253
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
254
|
-
var styleMapping = {
|
|
255
|
-
labelSmall: "textstyle-label-sm",
|
|
256
|
-
labelMedium: "textstyle-label-md",
|
|
257
|
-
labelBig: "textstyle-label-lg"
|
|
258
|
-
};
|
|
259
|
-
var Label = ({
|
|
260
|
-
children,
|
|
261
|
-
name,
|
|
262
|
-
labelType = "labelSmall",
|
|
263
|
-
...props
|
|
264
|
-
}) => {
|
|
265
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { ...props, children: children ? children : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styleMapping[labelType], children: name }) });
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
// src/components/user-input/Input.tsx
|
|
269
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
270
|
-
var ControlledInput = ({
|
|
271
|
-
id,
|
|
272
|
-
type = "text",
|
|
273
|
-
value,
|
|
274
|
-
label,
|
|
275
|
-
onChange = noop,
|
|
276
|
-
onChangeEvent = noop,
|
|
277
|
-
className = "",
|
|
278
|
-
onEditCompleted,
|
|
279
|
-
expanded = true,
|
|
280
|
-
onBlur,
|
|
281
|
-
containerClassName,
|
|
282
|
-
...restProps
|
|
283
|
-
}) => {
|
|
284
|
-
const {
|
|
285
|
-
restartTimer,
|
|
286
|
-
clearUpdateTimer
|
|
287
|
-
} = useSaveDelay_default(() => void 0, 3e3);
|
|
288
|
-
const ref = (0, import_react7.useRef)(null);
|
|
289
|
-
(0, import_react7.useEffect)(() => {
|
|
290
|
-
if (restProps.autoFocus) {
|
|
291
|
-
ref.current?.focus();
|
|
292
|
-
}
|
|
293
|
-
}, [restProps.autoFocus]);
|
|
294
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx2.default)({ "w-full": expanded }, containerClassName), children: [
|
|
295
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx2.default)("mb-1", label.className) }),
|
|
296
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
297
|
-
"input",
|
|
298
|
-
{
|
|
299
|
-
ref,
|
|
300
|
-
value,
|
|
301
|
-
id,
|
|
302
|
-
type,
|
|
303
|
-
className: (0, import_clsx2.default)("block bg-surface text-on-surface px-3 py-2 rounded-md w-full border-2 border-gray-200 hover:border-primary focus:outline-none focus:border-primary focus:ring-primary", className),
|
|
304
|
-
onBlur: (event) => {
|
|
305
|
-
if (onBlur) {
|
|
306
|
-
onBlur(event);
|
|
307
|
-
}
|
|
308
|
-
if (onEditCompleted) {
|
|
309
|
-
onEditCompleted(event.target.value, event);
|
|
310
|
-
clearUpdateTimer();
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
onChange: (e) => {
|
|
314
|
-
const value2 = e.target.value;
|
|
315
|
-
if (onEditCompleted) {
|
|
316
|
-
restartTimer(() => {
|
|
317
|
-
onEditCompleted(value2, e);
|
|
318
|
-
clearUpdateTimer();
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
onChange(value2, e);
|
|
322
|
-
onChangeEvent(e);
|
|
323
|
-
},
|
|
324
|
-
...restProps
|
|
325
|
-
}
|
|
326
|
-
)
|
|
327
|
-
] });
|
|
328
|
-
};
|
|
329
|
-
var FormInput = (0, import_react7.forwardRef)(function FormInput2({
|
|
330
|
-
id,
|
|
331
|
-
labelText,
|
|
332
|
-
errorText,
|
|
333
|
-
className,
|
|
334
|
-
labelClassName,
|
|
335
|
-
errorClassName,
|
|
336
|
-
containerClassName,
|
|
337
|
-
required,
|
|
338
|
-
...restProps
|
|
339
|
-
}, ref) {
|
|
340
|
-
const input = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
341
|
-
"input",
|
|
342
|
-
{
|
|
343
|
-
ref,
|
|
344
|
-
id,
|
|
345
|
-
...restProps,
|
|
346
|
-
className: (0, import_clsx2.default)(
|
|
347
|
-
"block bg-surface text-on-surface px-3 py-2 rounded-md w-full border-2 border-gray-200 hover:border-primary focus:outline-none focus:border-primary focus:ring-primary",
|
|
348
|
-
{
|
|
349
|
-
"focus:border-primary focus:ring-primary": !errorText,
|
|
350
|
-
"focus:border-negative focus:ring-negative text-negative": !!errorText
|
|
351
|
-
},
|
|
352
|
-
className
|
|
353
|
-
)
|
|
354
|
-
}
|
|
355
|
-
);
|
|
356
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx2.default)("flex flex-col gap-y-1", containerClassName), children: [
|
|
357
|
-
labelText && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { htmlFor: id, className: (0, import_clsx2.default)("textstyle-label-md", labelClassName), children: [
|
|
358
|
-
labelText,
|
|
359
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
360
|
-
] }),
|
|
361
|
-
input,
|
|
362
|
-
errorText && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: id, className: (0, import_clsx2.default)("text-negative", errorClassName), children: errorText })
|
|
363
|
-
] });
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
// src/components/user-input/Checkbox.tsx
|
|
367
|
-
var import_react8 = require("react");
|
|
368
|
-
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
369
|
-
var import_lucide_react = require("lucide-react");
|
|
370
|
-
var import_clsx3 = __toESM(require("clsx"));
|
|
371
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
372
|
-
var checkboxSizeMapping = {
|
|
373
|
-
small: "size-4",
|
|
374
|
-
medium: "size-6",
|
|
375
|
-
large: "size-8"
|
|
376
|
-
};
|
|
377
|
-
var checkboxIconSizeMapping = {
|
|
378
|
-
small: "size-3",
|
|
379
|
-
medium: "size-5",
|
|
380
|
-
large: "size-7"
|
|
381
|
-
};
|
|
382
|
-
var ControlledCheckbox = ({
|
|
383
|
-
id,
|
|
384
|
-
label,
|
|
385
|
-
checked,
|
|
386
|
-
disabled,
|
|
387
|
-
onChange,
|
|
388
|
-
onChangeTristate,
|
|
389
|
-
size = "medium",
|
|
390
|
-
className = "",
|
|
391
|
-
containerClassName
|
|
392
|
-
}) => {
|
|
393
|
-
const usedSizeClass = checkboxSizeMapping[size];
|
|
394
|
-
const innerIconSize = checkboxIconSizeMapping[size];
|
|
395
|
-
const propagateChange = (checked2) => {
|
|
396
|
-
if (onChangeTristate) {
|
|
397
|
-
onChangeTristate(checked2);
|
|
398
|
-
}
|
|
399
|
-
if (onChange) {
|
|
400
|
-
onChange(checked2 === "indeterminate" ? false : checked2);
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
const changeValue = () => {
|
|
404
|
-
const newValue = checked === "indeterminate" ? false : !checked;
|
|
405
|
-
propagateChange(newValue);
|
|
406
|
-
};
|
|
407
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx3.default)("row justify-center items-center", containerClassName), children: [
|
|
408
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
409
|
-
CheckboxPrimitive.Root,
|
|
410
|
-
{
|
|
411
|
-
onCheckedChange: propagateChange,
|
|
412
|
-
checked,
|
|
413
|
-
disabled,
|
|
414
|
-
id,
|
|
415
|
-
className: (0, import_clsx3.default)(usedSizeClass, `items-center border-2 rounded outline-none focus:border-primary`, {
|
|
416
|
-
"text-disabled-text border-disabled-text": disabled,
|
|
417
|
-
"border-on-background": !disabled,
|
|
418
|
-
"bg-primary/30 border-primary text-primary": checked === true || checked === "indeterminate",
|
|
419
|
-
"hover:border-gray-400 focus:hover:border-primary": !checked
|
|
420
|
-
}, className),
|
|
421
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(CheckboxPrimitive.Indicator, { children: [
|
|
422
|
-
checked === true && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Check, { className: innerIconSize }),
|
|
423
|
-
checked === "indeterminate" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Minus, { className: innerIconSize })
|
|
424
|
-
] })
|
|
425
|
-
}
|
|
426
|
-
),
|
|
427
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { ...label, className: (0, import_clsx3.default)("cursor-pointer", label.className), htmlFor: id, onClick: changeValue })
|
|
428
|
-
] });
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
// src/components/user-input/MultiSelect.tsx
|
|
432
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
433
|
-
var defaultMultiSelectTranslation = {
|
|
434
|
-
en: {
|
|
435
|
-
select: "Select",
|
|
436
|
-
search: "Search",
|
|
437
|
-
selected: "selected"
|
|
438
|
-
},
|
|
439
|
-
de: {
|
|
440
|
-
select: "Ausw\xE4hlen",
|
|
441
|
-
search: "Suche",
|
|
442
|
-
selected: "ausgew\xE4hlt"
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
var MultiSelect = ({
|
|
446
|
-
overwriteTranslation,
|
|
447
|
-
options,
|
|
448
|
-
onChange,
|
|
449
|
-
search,
|
|
450
|
-
disabled = false,
|
|
451
|
-
selectedDisplay,
|
|
452
|
-
label,
|
|
453
|
-
hintText,
|
|
454
|
-
showDisabledOptions = true,
|
|
455
|
-
className = "",
|
|
456
|
-
triggerClassName = ""
|
|
457
|
-
}) => {
|
|
458
|
-
const translation = useTranslation(defaultMultiSelectTranslation, overwriteTranslation);
|
|
459
|
-
const [searchText, setSearchText] = (0, import_react9.useState)(search?.initialSearch ?? "");
|
|
460
|
-
let filteredOptions = options;
|
|
461
|
-
const enableSearch = !!search;
|
|
462
|
-
if (enableSearch && !!searchText) {
|
|
463
|
-
filteredOptions = MultiSearchWithMapping(
|
|
464
|
-
searchText,
|
|
465
|
-
filteredOptions,
|
|
466
|
-
(value) => search.searchMapping(value)
|
|
467
|
-
);
|
|
468
|
-
}
|
|
469
|
-
if (!showDisabledOptions) {
|
|
470
|
-
filteredOptions = filteredOptions.filter((value) => !value.disabled);
|
|
471
|
-
}
|
|
472
|
-
const selectedItems = options.filter((value) => value.selected);
|
|
473
|
-
const menuButtonText = selectedItems.length === 0 ? hintText ?? translation.select : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: `${selectedItems.length} ${translation.selected}` });
|
|
474
|
-
const borderColor = "border-menu-border";
|
|
475
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx4.default)(className), children: [
|
|
476
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
477
|
-
Label,
|
|
478
|
-
{
|
|
479
|
-
...label,
|
|
480
|
-
htmlFor: label.name,
|
|
481
|
-
className: (0, import_clsx4.default)(" mb-1", label.className),
|
|
482
|
-
labelType: label.labelType ?? "labelBig"
|
|
483
|
-
}
|
|
484
|
-
),
|
|
485
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
486
|
-
Menu,
|
|
487
|
-
{
|
|
488
|
-
alignment: "t_",
|
|
489
|
-
trigger: (onClick, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
490
|
-
"div",
|
|
491
|
-
{
|
|
492
|
-
ref,
|
|
493
|
-
onClick: disabled ? void 0 : onClick,
|
|
494
|
-
className: (0, import_clsx4.default)(
|
|
495
|
-
borderColor,
|
|
496
|
-
"bg-menu-background text-menu-text inline-w-full justify-between items-center rounded-lg border-2 px-4 py-2 font-medium",
|
|
497
|
-
{
|
|
498
|
-
"hover:brightness-90 hover:border-primary cursor-pointer": !disabled,
|
|
499
|
-
"bg-disabled-background text-disabled cursor-not-allowed": disabled
|
|
500
|
-
},
|
|
501
|
-
triggerClassName
|
|
502
|
-
),
|
|
503
|
-
children: selectedDisplay ? selectedDisplay({ items: options, disabled }) : menuButtonText
|
|
504
|
-
}
|
|
505
|
-
),
|
|
506
|
-
menuClassName: (0, import_clsx4.default)(
|
|
507
|
-
"!rounded-lg !shadow-lg !max-h-[500px] !min-w-[400px] !max-w-[70vh] !overflow-y-auto !border !border-2",
|
|
508
|
-
borderColor,
|
|
509
|
-
{ "!py-0": !enableSearch, "!pb-0": enableSearch }
|
|
510
|
-
),
|
|
511
|
-
children: [
|
|
512
|
-
enableSearch && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "row gap-x-2 items-center px-2 py-2", children: [
|
|
513
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ControlledInput, { autoFocus: true, value: searchText, onChange: setSearchText }),
|
|
514
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Search, {})
|
|
515
|
-
] }, "selectSearch"),
|
|
516
|
-
filteredOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
517
|
-
MenuItem,
|
|
518
|
-
{
|
|
519
|
-
className: (0, import_clsx4.default)({
|
|
520
|
-
"cursor-not-allowed !bg-disabled-background !text-disabled-text hover:brightness-100": !!option.disabled,
|
|
521
|
-
"cursor-pointer": !option.disabled
|
|
522
|
-
}),
|
|
523
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
524
|
-
"div",
|
|
525
|
-
{
|
|
526
|
-
className: (0, import_clsx4.default)("overflow-hidden whitespace-nowrap text-ellipsis row items-center gap-x-2", option.className),
|
|
527
|
-
onClick: () => {
|
|
528
|
-
if (!option.disabled) {
|
|
529
|
-
onChange(options.map((value) => value.value === option.value ? {
|
|
530
|
-
...option,
|
|
531
|
-
selected: !value.selected
|
|
532
|
-
} : value));
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
children: [
|
|
536
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ControlledCheckbox, { checked: option.selected, disabled: option.disabled, size: "small" }),
|
|
537
|
-
option.label
|
|
538
|
-
]
|
|
539
|
-
}
|
|
540
|
-
)
|
|
541
|
-
},
|
|
542
|
-
`item${index}`
|
|
543
|
-
))
|
|
544
|
-
]
|
|
545
|
-
}
|
|
546
|
-
)
|
|
547
|
-
] });
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
// src/components/ChipList.tsx
|
|
551
|
-
var import_clsx5 = __toESM(require("clsx"));
|
|
552
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
553
|
-
var Chip = ({
|
|
554
|
-
children,
|
|
555
|
-
trailingIcon,
|
|
556
|
-
color = "default",
|
|
557
|
-
variant = "normal",
|
|
558
|
-
className = "",
|
|
559
|
-
...restProps
|
|
560
|
-
}) => {
|
|
561
|
-
const colorMapping = {
|
|
562
|
-
default: "text-tag-default-text bg-tag-default-background",
|
|
563
|
-
dark: "text-tag-dark-text bg-tag-dark-background",
|
|
564
|
-
red: "text-tag-red-text bg-tag-red-background",
|
|
565
|
-
yellow: "text-tag-yellow-text bg-tag-yellow-background",
|
|
566
|
-
green: "text-tag-green-text bg-tag-green-background",
|
|
567
|
-
blue: "text-tag-blue-text bg-tag-blue-background",
|
|
568
|
-
pink: "text-tag-pink-text bg-tag-pink-background"
|
|
569
|
-
}[color];
|
|
570
|
-
const colorMappingIcon = {
|
|
571
|
-
default: "text-tag-default-icon",
|
|
572
|
-
dark: "text-tag-dark-icon",
|
|
573
|
-
red: "text-tag-red-icon",
|
|
574
|
-
yellow: "text-tag-yellow-icon",
|
|
575
|
-
green: "text-tag-green-icon",
|
|
576
|
-
blue: "text-tag-blue-icon",
|
|
577
|
-
pink: "text-tag-pink-icon"
|
|
578
|
-
}[color];
|
|
579
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
580
|
-
"div",
|
|
581
|
-
{
|
|
582
|
-
...restProps,
|
|
583
|
-
className: (0, import_clsx5.default)(
|
|
584
|
-
`row w-fit px-2 py-1`,
|
|
585
|
-
colorMapping,
|
|
586
|
-
{
|
|
587
|
-
"rounded-md": variant === "normal",
|
|
588
|
-
"rounded-full": variant === "fullyRounded"
|
|
589
|
-
},
|
|
590
|
-
className
|
|
591
|
-
),
|
|
592
|
-
children: [
|
|
593
|
-
children,
|
|
594
|
-
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: colorMappingIcon, children: trailingIcon })
|
|
595
|
-
]
|
|
596
|
-
}
|
|
597
|
-
);
|
|
598
|
-
};
|
|
599
|
-
var ChipList = ({
|
|
600
|
-
list,
|
|
601
|
-
className = ""
|
|
602
|
-
}) => {
|
|
603
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: (0, import_clsx5.default)("flex flex-wrap gap-x-4 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
604
|
-
Chip,
|
|
605
|
-
{
|
|
606
|
-
...value,
|
|
607
|
-
color: value.color ?? "dark",
|
|
608
|
-
variant: value.variant ?? "normal",
|
|
609
|
-
children: value.children
|
|
610
|
-
},
|
|
611
|
-
index
|
|
612
|
-
)) });
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
// src/components/properties/PropertyBase.tsx
|
|
616
|
-
var import_lucide_react3 = require("lucide-react");
|
|
617
|
-
var import_clsx7 = __toESM(require("clsx"));
|
|
618
|
-
|
|
619
|
-
// src/components/Button.tsx
|
|
620
|
-
var import_clsx6 = __toESM(require("clsx"));
|
|
621
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
622
|
-
var ButtonSizePaddings = {
|
|
623
|
-
small: "btn-sm",
|
|
624
|
-
medium: "btn-md",
|
|
625
|
-
large: "btn-lg"
|
|
626
|
-
};
|
|
627
|
-
var TextButton = ({
|
|
628
|
-
children,
|
|
629
|
-
disabled = false,
|
|
630
|
-
color = "neutral",
|
|
631
|
-
size = "medium",
|
|
632
|
-
startIcon,
|
|
633
|
-
endIcon,
|
|
634
|
-
onClick,
|
|
635
|
-
className,
|
|
636
|
-
...restProps
|
|
637
|
-
}) => {
|
|
638
|
-
const colorClasses = {
|
|
639
|
-
negative: "bg-transparent text-button-text-negative-text",
|
|
640
|
-
neutral: "bg-transparent text-button-text-neutral-text"
|
|
641
|
-
}[color];
|
|
642
|
-
const iconColorClasses = {
|
|
643
|
-
negative: "text-button-text-negative-icon",
|
|
644
|
-
neutral: "text-button-text-neutral-icon"
|
|
645
|
-
}[color];
|
|
646
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
647
|
-
"button",
|
|
648
|
-
{
|
|
649
|
-
onClick: disabled ? void 0 : onClick,
|
|
650
|
-
disabled: disabled || onClick === void 0,
|
|
651
|
-
className: (0, import_clsx6.default)(
|
|
652
|
-
className,
|
|
653
|
-
{
|
|
654
|
-
"text-disabled-text": disabled,
|
|
655
|
-
[(0, import_clsx6.default)(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
|
|
656
|
-
},
|
|
657
|
-
ButtonSizePaddings[size]
|
|
658
|
-
),
|
|
659
|
-
...restProps,
|
|
660
|
-
children: [
|
|
661
|
-
startIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
662
|
-
"span",
|
|
663
|
-
{
|
|
664
|
-
className: (0, import_clsx6.default)({
|
|
665
|
-
[iconColorClasses]: !disabled,
|
|
666
|
-
[`text-disabled-icon`]: disabled
|
|
667
|
-
}),
|
|
668
|
-
children: startIcon
|
|
669
|
-
}
|
|
670
|
-
),
|
|
671
|
-
children,
|
|
672
|
-
endIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
673
|
-
"span",
|
|
674
|
-
{
|
|
675
|
-
className: (0, import_clsx6.default)({
|
|
676
|
-
[iconColorClasses]: !disabled,
|
|
677
|
-
[`text-disabled-icon`]: disabled
|
|
678
|
-
}),
|
|
679
|
-
children: endIcon
|
|
680
|
-
}
|
|
681
|
-
)
|
|
682
|
-
]
|
|
683
|
-
}
|
|
684
|
-
);
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
// src/components/properties/PropertyBase.tsx
|
|
688
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
689
|
-
var defaultPropertyBaseTranslation = {
|
|
690
|
-
en: {
|
|
691
|
-
remove: "Remove"
|
|
692
|
-
},
|
|
693
|
-
de: {
|
|
694
|
-
remove: "Entfernen"
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
var PropertyBase = ({
|
|
698
|
-
overwriteTranslation,
|
|
699
|
-
name,
|
|
700
|
-
input,
|
|
701
|
-
softRequired = false,
|
|
702
|
-
hasValue,
|
|
703
|
-
icon,
|
|
704
|
-
readOnly,
|
|
705
|
-
onRemove,
|
|
706
|
-
className = ""
|
|
707
|
-
}) => {
|
|
708
|
-
const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation);
|
|
709
|
-
const requiredAndNoValue = softRequired && !hasValue;
|
|
710
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_clsx7.default)("row gap-x-0 group", className), children: [
|
|
711
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
712
|
-
"div",
|
|
713
|
-
{
|
|
714
|
-
className: (0, import_clsx7.default)("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
|
|
715
|
-
"bg-gray-100 text-black group-hover:border-primary border-gray-400": !requiredAndNoValue,
|
|
716
|
-
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
717
|
-
}, className),
|
|
718
|
-
children: [
|
|
719
|
-
icon,
|
|
720
|
-
name
|
|
721
|
-
]
|
|
722
|
-
}
|
|
723
|
-
),
|
|
724
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
725
|
-
"div",
|
|
726
|
-
{
|
|
727
|
-
className: (0, import_clsx7.default)("row grow justify-between items-center rounded-r-xl border-2 border-l-0", {
|
|
728
|
-
"bg-white group-hover:border-primary border-gray-400": !requiredAndNoValue,
|
|
729
|
-
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
730
|
-
}, className),
|
|
731
|
-
children: [
|
|
732
|
-
input({ softRequired, hasValue }),
|
|
733
|
-
requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-warning pr-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.AlertTriangle, { size: 24 }) }),
|
|
734
|
-
onRemove && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
735
|
-
TextButton,
|
|
736
|
-
{
|
|
737
|
-
onClick: onRemove,
|
|
738
|
-
color: "negative",
|
|
739
|
-
className: (0, import_clsx7.default)("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
740
|
-
disabled: !hasValue || readOnly,
|
|
741
|
-
children: translation.remove
|
|
742
|
-
}
|
|
743
|
-
)
|
|
744
|
-
]
|
|
745
|
-
}
|
|
746
|
-
)
|
|
747
|
-
] });
|
|
748
|
-
};
|
|
749
|
-
|
|
750
|
-
// src/components/properties/MultiSelectProperty.tsx
|
|
751
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
752
|
-
var defaultMultiSelectPropertyTranslation = {
|
|
753
|
-
en: {
|
|
754
|
-
select: "Select"
|
|
755
|
-
},
|
|
756
|
-
de: {
|
|
757
|
-
select: "Ausw\xE4hlen"
|
|
758
|
-
}
|
|
759
|
-
};
|
|
760
|
-
var MultiSelectProperty = ({
|
|
761
|
-
overwriteTranslation,
|
|
762
|
-
options,
|
|
763
|
-
name,
|
|
764
|
-
readOnly = false,
|
|
765
|
-
softRequired,
|
|
766
|
-
onRemove,
|
|
767
|
-
...multiSelectProps
|
|
768
|
-
}) => {
|
|
769
|
-
const translation = useTranslation(defaultMultiSelectPropertyTranslation, overwriteTranslation);
|
|
770
|
-
const hasValue = options.some((value) => value.selected);
|
|
771
|
-
let triggerClassName;
|
|
772
|
-
if (softRequired && !hasValue) {
|
|
773
|
-
triggerClassName = "border-warning hover:brightness-90";
|
|
774
|
-
}
|
|
775
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
776
|
-
PropertyBase,
|
|
777
|
-
{
|
|
778
|
-
name,
|
|
779
|
-
onRemove,
|
|
780
|
-
readOnly,
|
|
781
|
-
softRequired,
|
|
782
|
-
hasValue,
|
|
783
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.List, { size: 16 }),
|
|
784
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
785
|
-
"div",
|
|
786
|
-
{
|
|
787
|
-
className: (0, import_clsx8.default)("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
|
|
788
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
789
|
-
MultiSelect,
|
|
790
|
-
{
|
|
791
|
-
...multiSelectProps,
|
|
792
|
-
className: (0, import_clsx8.default)("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
793
|
-
triggerClassName,
|
|
794
|
-
selectedDisplay: ({ items }) => {
|
|
795
|
-
const selected = items.filter((value) => value.selected);
|
|
796
|
-
if (selected.length === 0) {
|
|
797
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Select" });
|
|
798
|
-
}
|
|
799
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
800
|
-
ChipList,
|
|
801
|
-
{
|
|
802
|
-
list: selected.map((value) => ({ children: value.label }))
|
|
803
|
-
}
|
|
804
|
-
);
|
|
805
|
-
},
|
|
806
|
-
options,
|
|
807
|
-
disabled: readOnly,
|
|
808
|
-
hintText: `${translation.select}...`
|
|
809
|
-
}
|
|
810
|
-
)
|
|
811
|
-
}
|
|
812
|
-
)
|
|
813
|
-
}
|
|
814
|
-
);
|
|
815
|
-
};
|
|
816
|
-
|
|
817
|
-
// src/components/examples/properties/MultiSelectPropertyExample.tsx
|
|
818
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
819
|
-
var MultiSelectPropertyExample = ({
|
|
820
|
-
options,
|
|
821
|
-
hintText,
|
|
822
|
-
enableSearch,
|
|
823
|
-
...restProps
|
|
824
|
-
}) => {
|
|
825
|
-
const [usedOptions, setUsedOptions] = (0, import_react10.useState)(options);
|
|
826
|
-
(0, import_react10.useEffect)(() => {
|
|
827
|
-
setUsedOptions(options);
|
|
828
|
-
}, [options]);
|
|
829
|
-
(0, import_react10.useEffect)(() => {
|
|
830
|
-
setUsedOptions(options.map((value) => ({ ...value, selected: false })));
|
|
831
|
-
}, [hintText, options]);
|
|
832
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
833
|
-
MultiSelectProperty,
|
|
834
|
-
{
|
|
835
|
-
...restProps,
|
|
836
|
-
options: usedOptions,
|
|
837
|
-
search: enableSearch ? { initialSearch: "", searchMapping: (value) => [value.label] } : void 0,
|
|
838
|
-
onChange: setUsedOptions,
|
|
839
|
-
onRemove: () => setUsedOptions(usedOptions.map((value) => ({ ...value, selected: false }))),
|
|
840
|
-
hintText
|
|
841
|
-
}
|
|
842
|
-
);
|
|
843
|
-
};
|
|
844
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
845
|
-
0 && (module.exports = {
|
|
846
|
-
MultiSelectPropertyExample
|
|
847
|
-
});
|
|
848
|
-
//# sourceMappingURL=MultiSelectPropertyExample.js.map
|