@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,584 +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/SelectPropertyExample.tsx
|
|
31
|
-
var SelectPropertyExample_exports = {};
|
|
32
|
-
__export(SelectPropertyExample_exports, {
|
|
33
|
-
SingleSelectPropertyExample: () => SingleSelectPropertyExample
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(SelectPropertyExample_exports);
|
|
36
|
-
var import_react7 = require("react");
|
|
37
|
-
|
|
38
|
-
// src/components/properties/SelectProperty.tsx
|
|
39
|
-
var import_lucide_react4 = require("lucide-react");
|
|
40
|
-
var import_clsx5 = __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/SearchableSelect.tsx
|
|
67
|
-
var import_react6 = 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/Select.tsx
|
|
79
|
-
var import_react3 = require("@headlessui/react");
|
|
80
|
-
var import_lucide_react = require("lucide-react");
|
|
81
|
-
var import_clsx = __toESM(require("clsx"));
|
|
82
|
-
|
|
83
|
-
// src/components/user-input/Label.tsx
|
|
84
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
85
|
-
var styleMapping = {
|
|
86
|
-
labelSmall: "textstyle-label-sm",
|
|
87
|
-
labelMedium: "textstyle-label-md",
|
|
88
|
-
labelBig: "textstyle-label-lg"
|
|
89
|
-
};
|
|
90
|
-
var Label = ({
|
|
91
|
-
children,
|
|
92
|
-
name,
|
|
93
|
-
labelType = "labelSmall",
|
|
94
|
-
...props
|
|
95
|
-
}) => {
|
|
96
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { ...props, children: children ? children : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styleMapping[labelType], children: name }) });
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// src/components/user-input/Select.tsx
|
|
100
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
101
|
-
var Select = ({
|
|
102
|
-
value,
|
|
103
|
-
label,
|
|
104
|
-
options,
|
|
105
|
-
onChange,
|
|
106
|
-
isHidingCurrentValue = true,
|
|
107
|
-
hintText = "",
|
|
108
|
-
showDisabledOptions = true,
|
|
109
|
-
isDisabled,
|
|
110
|
-
className,
|
|
111
|
-
textColor = "text-menu-text",
|
|
112
|
-
hoverColor = "hover:brightness-90",
|
|
113
|
-
additionalItems,
|
|
114
|
-
selectedDisplayOverwrite
|
|
115
|
-
}) => {
|
|
116
|
-
let filteredOptions = isHidingCurrentValue ? options.filter((option) => option.value !== value) : options;
|
|
117
|
-
if (!showDisabledOptions) {
|
|
118
|
-
filteredOptions = filteredOptions.filter((value2) => !value2.disabled);
|
|
119
|
-
}
|
|
120
|
-
const selectedOption = options.find((option) => option.value === value);
|
|
121
|
-
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
122
|
-
console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
|
|
123
|
-
}
|
|
124
|
-
const borderColor = "border-menu-border";
|
|
125
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx.default)(className), children: [
|
|
126
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx.default)("mb-1", label.className) }),
|
|
127
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react3.Menu, { as: "div", className: "relative text-menu-text", children: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
129
|
-
import_react3.Menu.Button,
|
|
130
|
-
{
|
|
131
|
-
className: (0, import_clsx.default)(
|
|
132
|
-
"inline-flex w-full justify-between items-center rounded-t-lg border-2 px-4 py-2 font-medium bg-menu-background text-menu-text",
|
|
133
|
-
textColor,
|
|
134
|
-
borderColor,
|
|
135
|
-
{
|
|
136
|
-
"rounded-b-lg": !open,
|
|
137
|
-
[hoverColor]: !isDisabled,
|
|
138
|
-
"bg-disabled-background cursor-not-allowed text-disabled": isDisabled
|
|
139
|
-
}
|
|
140
|
-
),
|
|
141
|
-
disabled: isDisabled,
|
|
142
|
-
children: [
|
|
143
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: selectedDisplayOverwrite ?? selectedOption?.label ?? hintText }),
|
|
144
|
-
open ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.ChevronDown, {})
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
149
|
-
import_react3.Menu.Items,
|
|
150
|
-
{
|
|
151
|
-
className: "absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto",
|
|
152
|
-
children: [
|
|
153
|
-
(additionalItems ?? []).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
154
|
-
"div",
|
|
155
|
-
{
|
|
156
|
-
className: (0, import_clsx.default)(borderColor, "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0", {
|
|
157
|
-
"border-b-0 rounded-b-lg": filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1
|
|
158
|
-
}),
|
|
159
|
-
children: item
|
|
160
|
-
},
|
|
161
|
-
`additionalItems${index}`
|
|
162
|
-
)),
|
|
163
|
-
filteredOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react3.Menu.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
164
|
-
"div",
|
|
165
|
-
{
|
|
166
|
-
className: (0, import_clsx.default)(
|
|
167
|
-
"px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
|
|
168
|
-
option.className,
|
|
169
|
-
borderColor,
|
|
170
|
-
{
|
|
171
|
-
"brightness-90": option.value === value,
|
|
172
|
-
"brightness-95": index % 2 === 1,
|
|
173
|
-
"text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
|
|
174
|
-
"bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
|
|
175
|
-
"rounded-b-lg": index === filteredOptions.length - 1
|
|
176
|
-
}
|
|
177
|
-
),
|
|
178
|
-
onClick: () => {
|
|
179
|
-
if (!option.disabled) {
|
|
180
|
-
onChange(option.value);
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
children: option.label
|
|
184
|
-
}
|
|
185
|
-
) }, `item${index}`))
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
)
|
|
189
|
-
] }) })
|
|
190
|
-
] });
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
// src/components/user-input/Input.tsx
|
|
194
|
-
var import_react5 = require("react");
|
|
195
|
-
var import_clsx2 = __toESM(require("clsx"));
|
|
196
|
-
|
|
197
|
-
// src/hooks/useSaveDelay.ts
|
|
198
|
-
var import_react4 = require("react");
|
|
199
|
-
function useSaveDelay(setNotificationStatus, delay) {
|
|
200
|
-
const [updateTimer, setUpdateTimer] = (0, import_react4.useState)(void 0);
|
|
201
|
-
const [notificationTimer, setNotificationTimer] = (0, import_react4.useState)(void 0);
|
|
202
|
-
const restartTimer = (onSave) => {
|
|
203
|
-
clearTimeout(updateTimer);
|
|
204
|
-
setUpdateTimer(setTimeout(() => {
|
|
205
|
-
onSave();
|
|
206
|
-
setNotificationStatus(true);
|
|
207
|
-
clearTimeout(notificationTimer);
|
|
208
|
-
setNotificationTimer(setTimeout(() => {
|
|
209
|
-
setNotificationStatus(false);
|
|
210
|
-
clearTimeout(notificationTimer);
|
|
211
|
-
}, delay));
|
|
212
|
-
clearTimeout(updateTimer);
|
|
213
|
-
}, delay));
|
|
214
|
-
};
|
|
215
|
-
const clearUpdateTimer = (hasSaved = true) => {
|
|
216
|
-
clearTimeout(updateTimer);
|
|
217
|
-
if (hasSaved) {
|
|
218
|
-
setNotificationStatus(true);
|
|
219
|
-
clearTimeout(notificationTimer);
|
|
220
|
-
setNotificationTimer(setTimeout(() => {
|
|
221
|
-
setNotificationStatus(false);
|
|
222
|
-
clearTimeout(notificationTimer);
|
|
223
|
-
}, delay));
|
|
224
|
-
} else {
|
|
225
|
-
setNotificationStatus(false);
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
(0, import_react4.useEffect)(() => {
|
|
229
|
-
return () => {
|
|
230
|
-
clearTimeout(updateTimer);
|
|
231
|
-
clearTimeout(notificationTimer);
|
|
232
|
-
};
|
|
233
|
-
}, []);
|
|
234
|
-
return { restartTimer, clearUpdateTimer };
|
|
235
|
-
}
|
|
236
|
-
var useSaveDelay_default = useSaveDelay;
|
|
237
|
-
|
|
238
|
-
// src/util/noop.ts
|
|
239
|
-
var noop = () => void 0;
|
|
240
|
-
|
|
241
|
-
// src/components/user-input/Input.tsx
|
|
242
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
243
|
-
var ControlledInput = ({
|
|
244
|
-
id,
|
|
245
|
-
type = "text",
|
|
246
|
-
value,
|
|
247
|
-
label,
|
|
248
|
-
onChange = noop,
|
|
249
|
-
onChangeEvent = noop,
|
|
250
|
-
className = "",
|
|
251
|
-
onEditCompleted,
|
|
252
|
-
expanded = true,
|
|
253
|
-
onBlur,
|
|
254
|
-
containerClassName,
|
|
255
|
-
...restProps
|
|
256
|
-
}) => {
|
|
257
|
-
const {
|
|
258
|
-
restartTimer,
|
|
259
|
-
clearUpdateTimer
|
|
260
|
-
} = useSaveDelay_default(() => void 0, 3e3);
|
|
261
|
-
const ref = (0, import_react5.useRef)(null);
|
|
262
|
-
(0, import_react5.useEffect)(() => {
|
|
263
|
-
if (restProps.autoFocus) {
|
|
264
|
-
ref.current?.focus();
|
|
265
|
-
}
|
|
266
|
-
}, [restProps.autoFocus]);
|
|
267
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx2.default)({ "w-full": expanded }, containerClassName), children: [
|
|
268
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx2.default)("mb-1", label.className) }),
|
|
269
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
270
|
-
"input",
|
|
271
|
-
{
|
|
272
|
-
ref,
|
|
273
|
-
value,
|
|
274
|
-
id,
|
|
275
|
-
type,
|
|
276
|
-
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),
|
|
277
|
-
onBlur: (event) => {
|
|
278
|
-
if (onBlur) {
|
|
279
|
-
onBlur(event);
|
|
280
|
-
}
|
|
281
|
-
if (onEditCompleted) {
|
|
282
|
-
onEditCompleted(event.target.value, event);
|
|
283
|
-
clearUpdateTimer();
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
onChange: (e) => {
|
|
287
|
-
const value2 = e.target.value;
|
|
288
|
-
if (onEditCompleted) {
|
|
289
|
-
restartTimer(() => {
|
|
290
|
-
onEditCompleted(value2, e);
|
|
291
|
-
clearUpdateTimer();
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
onChange(value2, e);
|
|
295
|
-
onChangeEvent(e);
|
|
296
|
-
},
|
|
297
|
-
...restProps
|
|
298
|
-
}
|
|
299
|
-
)
|
|
300
|
-
] });
|
|
301
|
-
};
|
|
302
|
-
var FormInput = (0, import_react5.forwardRef)(function FormInput2({
|
|
303
|
-
id,
|
|
304
|
-
labelText,
|
|
305
|
-
errorText,
|
|
306
|
-
className,
|
|
307
|
-
labelClassName,
|
|
308
|
-
errorClassName,
|
|
309
|
-
containerClassName,
|
|
310
|
-
required,
|
|
311
|
-
...restProps
|
|
312
|
-
}, ref) {
|
|
313
|
-
const input = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
314
|
-
"input",
|
|
315
|
-
{
|
|
316
|
-
ref,
|
|
317
|
-
id,
|
|
318
|
-
...restProps,
|
|
319
|
-
className: (0, import_clsx2.default)(
|
|
320
|
-
"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",
|
|
321
|
-
{
|
|
322
|
-
"focus:border-primary focus:ring-primary": !errorText,
|
|
323
|
-
"focus:border-negative focus:ring-negative text-negative": !!errorText
|
|
324
|
-
},
|
|
325
|
-
className
|
|
326
|
-
)
|
|
327
|
-
}
|
|
328
|
-
);
|
|
329
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx2.default)("flex flex-col gap-y-1", containerClassName), children: [
|
|
330
|
-
labelText && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { htmlFor: id, className: (0, import_clsx2.default)("textstyle-label-md", labelClassName), children: [
|
|
331
|
-
labelText,
|
|
332
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
333
|
-
] }),
|
|
334
|
-
input,
|
|
335
|
-
errorText && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: id, className: (0, import_clsx2.default)("text-negative", errorClassName), children: errorText })
|
|
336
|
-
] });
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
// src/components/user-input/SearchableSelect.tsx
|
|
340
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
341
|
-
var SearchableSelect = ({
|
|
342
|
-
value,
|
|
343
|
-
options,
|
|
344
|
-
searchMapping,
|
|
345
|
-
...selectProps
|
|
346
|
-
}) => {
|
|
347
|
-
const [search, setSearch] = (0, import_react6.useState)("");
|
|
348
|
-
const filteredOptions = MultiSearchWithMapping(search, options, searchMapping);
|
|
349
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
350
|
-
Select,
|
|
351
|
-
{
|
|
352
|
-
value,
|
|
353
|
-
options: filteredOptions,
|
|
354
|
-
additionalItems: [/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row gap-x-2 items-center", children: [
|
|
355
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ControlledInput, { autoFocus: true, value: search, onChange: setSearch }),
|
|
356
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Search, {})
|
|
357
|
-
] }, "selectSearch")],
|
|
358
|
-
...selectProps
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
// src/components/properties/PropertyBase.tsx
|
|
364
|
-
var import_lucide_react3 = require("lucide-react");
|
|
365
|
-
var import_clsx4 = __toESM(require("clsx"));
|
|
366
|
-
|
|
367
|
-
// src/components/Button.tsx
|
|
368
|
-
var import_clsx3 = __toESM(require("clsx"));
|
|
369
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
370
|
-
var ButtonSizePaddings = {
|
|
371
|
-
small: "btn-sm",
|
|
372
|
-
medium: "btn-md",
|
|
373
|
-
large: "btn-lg"
|
|
374
|
-
};
|
|
375
|
-
var TextButton = ({
|
|
376
|
-
children,
|
|
377
|
-
disabled = false,
|
|
378
|
-
color = "neutral",
|
|
379
|
-
size = "medium",
|
|
380
|
-
startIcon,
|
|
381
|
-
endIcon,
|
|
382
|
-
onClick,
|
|
383
|
-
className,
|
|
384
|
-
...restProps
|
|
385
|
-
}) => {
|
|
386
|
-
const colorClasses = {
|
|
387
|
-
negative: "bg-transparent text-button-text-negative-text",
|
|
388
|
-
neutral: "bg-transparent text-button-text-neutral-text"
|
|
389
|
-
}[color];
|
|
390
|
-
const iconColorClasses = {
|
|
391
|
-
negative: "text-button-text-negative-icon",
|
|
392
|
-
neutral: "text-button-text-neutral-icon"
|
|
393
|
-
}[color];
|
|
394
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
395
|
-
"button",
|
|
396
|
-
{
|
|
397
|
-
onClick: disabled ? void 0 : onClick,
|
|
398
|
-
disabled: disabled || onClick === void 0,
|
|
399
|
-
className: (0, import_clsx3.default)(
|
|
400
|
-
className,
|
|
401
|
-
{
|
|
402
|
-
"text-disabled-text": disabled,
|
|
403
|
-
[(0, import_clsx3.default)(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
|
|
404
|
-
},
|
|
405
|
-
ButtonSizePaddings[size]
|
|
406
|
-
),
|
|
407
|
-
...restProps,
|
|
408
|
-
children: [
|
|
409
|
-
startIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
410
|
-
"span",
|
|
411
|
-
{
|
|
412
|
-
className: (0, import_clsx3.default)({
|
|
413
|
-
[iconColorClasses]: !disabled,
|
|
414
|
-
[`text-disabled-icon`]: disabled
|
|
415
|
-
}),
|
|
416
|
-
children: startIcon
|
|
417
|
-
}
|
|
418
|
-
),
|
|
419
|
-
children,
|
|
420
|
-
endIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
421
|
-
"span",
|
|
422
|
-
{
|
|
423
|
-
className: (0, import_clsx3.default)({
|
|
424
|
-
[iconColorClasses]: !disabled,
|
|
425
|
-
[`text-disabled-icon`]: disabled
|
|
426
|
-
}),
|
|
427
|
-
children: endIcon
|
|
428
|
-
}
|
|
429
|
-
)
|
|
430
|
-
]
|
|
431
|
-
}
|
|
432
|
-
);
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
// src/components/properties/PropertyBase.tsx
|
|
436
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
437
|
-
var defaultPropertyBaseTranslation = {
|
|
438
|
-
en: {
|
|
439
|
-
remove: "Remove"
|
|
440
|
-
},
|
|
441
|
-
de: {
|
|
442
|
-
remove: "Entfernen"
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
var PropertyBase = ({
|
|
446
|
-
overwriteTranslation,
|
|
447
|
-
name,
|
|
448
|
-
input,
|
|
449
|
-
softRequired = false,
|
|
450
|
-
hasValue,
|
|
451
|
-
icon,
|
|
452
|
-
readOnly,
|
|
453
|
-
onRemove,
|
|
454
|
-
className = ""
|
|
455
|
-
}) => {
|
|
456
|
-
const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation);
|
|
457
|
-
const requiredAndNoValue = softRequired && !hasValue;
|
|
458
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: (0, import_clsx4.default)("row gap-x-0 group", className), children: [
|
|
459
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
460
|
-
"div",
|
|
461
|
-
{
|
|
462
|
-
className: (0, import_clsx4.default)("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
|
|
463
|
-
"bg-gray-100 text-black group-hover:border-primary border-gray-400": !requiredAndNoValue,
|
|
464
|
-
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
465
|
-
}, className),
|
|
466
|
-
children: [
|
|
467
|
-
icon,
|
|
468
|
-
name
|
|
469
|
-
]
|
|
470
|
-
}
|
|
471
|
-
),
|
|
472
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
473
|
-
"div",
|
|
474
|
-
{
|
|
475
|
-
className: (0, import_clsx4.default)("row grow justify-between items-center rounded-r-xl border-2 border-l-0", {
|
|
476
|
-
"bg-white group-hover:border-primary border-gray-400": !requiredAndNoValue,
|
|
477
|
-
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
478
|
-
}, className),
|
|
479
|
-
children: [
|
|
480
|
-
input({ softRequired, hasValue }),
|
|
481
|
-
requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-warning pr-4", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.AlertTriangle, { size: 24 }) }),
|
|
482
|
-
onRemove && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
483
|
-
TextButton,
|
|
484
|
-
{
|
|
485
|
-
onClick: onRemove,
|
|
486
|
-
color: "negative",
|
|
487
|
-
className: (0, import_clsx4.default)("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
488
|
-
disabled: !hasValue || readOnly,
|
|
489
|
-
children: translation.remove
|
|
490
|
-
}
|
|
491
|
-
)
|
|
492
|
-
]
|
|
493
|
-
}
|
|
494
|
-
)
|
|
495
|
-
] });
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
// src/components/properties/SelectProperty.tsx
|
|
499
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
500
|
-
var defaultSingleSelectPropertyTranslation = {
|
|
501
|
-
en: {
|
|
502
|
-
select: "Select"
|
|
503
|
-
},
|
|
504
|
-
de: {
|
|
505
|
-
select: "Ausw\xE4hlen"
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
var SingleSelectProperty = ({
|
|
509
|
-
overwriteTranslation,
|
|
510
|
-
value,
|
|
511
|
-
options,
|
|
512
|
-
name,
|
|
513
|
-
readOnly = false,
|
|
514
|
-
softRequired,
|
|
515
|
-
onRemove,
|
|
516
|
-
...multiSelectProps
|
|
517
|
-
}) => {
|
|
518
|
-
const translation = useTranslation(defaultSingleSelectPropertyTranslation, overwriteTranslation);
|
|
519
|
-
const hasValue = value !== void 0;
|
|
520
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
521
|
-
PropertyBase,
|
|
522
|
-
{
|
|
523
|
-
name,
|
|
524
|
-
onRemove,
|
|
525
|
-
readOnly,
|
|
526
|
-
softRequired,
|
|
527
|
-
hasValue,
|
|
528
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.List, { size: 16 }),
|
|
529
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
530
|
-
"div",
|
|
531
|
-
{
|
|
532
|
-
className: (0, import_clsx5.default)("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
|
|
533
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
534
|
-
SearchableSelect,
|
|
535
|
-
{
|
|
536
|
-
...multiSelectProps,
|
|
537
|
-
value,
|
|
538
|
-
options,
|
|
539
|
-
isDisabled: readOnly,
|
|
540
|
-
className: (0, import_clsx5.default)("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
541
|
-
hintText: `${translation.select}...`
|
|
542
|
-
}
|
|
543
|
-
)
|
|
544
|
-
}
|
|
545
|
-
)
|
|
546
|
-
}
|
|
547
|
-
);
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
// src/components/examples/properties/SelectPropertyExample.tsx
|
|
551
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
552
|
-
var SingleSelectPropertyExample = ({
|
|
553
|
-
value,
|
|
554
|
-
options,
|
|
555
|
-
hintText,
|
|
556
|
-
...restProps
|
|
557
|
-
}) => {
|
|
558
|
-
const [usedValue, setUsedValue] = (0, import_react7.useState)(value);
|
|
559
|
-
(0, import_react7.useEffect)(() => {
|
|
560
|
-
setUsedValue(void 0);
|
|
561
|
-
}, [hintText]);
|
|
562
|
-
(0, import_react7.useEffect)(() => {
|
|
563
|
-
if (options.find((value1) => value1.value === value)) {
|
|
564
|
-
setUsedValue(value);
|
|
565
|
-
}
|
|
566
|
-
}, [value, options]);
|
|
567
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
568
|
-
SingleSelectProperty,
|
|
569
|
-
{
|
|
570
|
-
...restProps,
|
|
571
|
-
value: usedValue,
|
|
572
|
-
options,
|
|
573
|
-
searchMapping: (value1) => [value1.value],
|
|
574
|
-
onChange: setUsedValue,
|
|
575
|
-
onRemove: () => setUsedValue(void 0),
|
|
576
|
-
hintText
|
|
577
|
-
}
|
|
578
|
-
);
|
|
579
|
-
};
|
|
580
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
581
|
-
0 && (module.exports = {
|
|
582
|
-
SingleSelectPropertyExample
|
|
583
|
-
});
|
|
584
|
-
//# sourceMappingURL=SelectPropertyExample.js.map
|