@helpwave/hightide 0.1.18 → 0.1.19
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 +7 -7
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +7 -7
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +65 -38
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +54 -27
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js +3 -3
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +3 -3
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +4 -4
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +4 -4
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +46 -19
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +44 -17
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +32 -28
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
- 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/icons-and-geometry/Ring.js +2 -2
- package/dist/components/icons-and-geometry/Ring.js.map +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs +2 -2
- package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +84 -15
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.js +1 -1
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +7 -1
- package/dist/components/layout-and-navigation/Expandable.d.ts +7 -1
- package/dist/components/layout-and-navigation/Expandable.js +36 -9
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +36 -10
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +34 -11
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +36 -13
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +92 -19
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +82 -9
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +79 -6
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +127 -25
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +126 -24
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +22 -16
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +7 -3
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
- package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
- package/dist/components/layout-and-navigation/Tile.js +7 -7
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +7 -7
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +5 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +8 -6
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +8 -6
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +32 -28
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +18 -14
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +28 -24
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +18 -14
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +32 -28
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +18 -14
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +728 -434
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +728 -430
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +732 -438
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +731 -433
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +110 -35
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +110 -35
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +118 -41
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +114 -37
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
- package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
- package/dist/components/properties/MultiSelectProperty.js +915 -463
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +920 -464
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +101 -18
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +101 -18
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +103 -20
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +99 -16
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +9 -2
- package/dist/components/properties/SelectProperty.d.ts +9 -2
- package/dist/components/properties/SelectProperty.js +682 -243
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +686 -243
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +133 -46
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +133 -46
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +285 -185
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +270 -166
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +179 -78
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +160 -55
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +72 -3
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +72 -3
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +15 -2
- package/dist/components/user-action/Button.d.ts +15 -2
- package/dist/components/user-action/Button.js +12 -12
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +12 -12
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +6 -15
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +6 -15
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +79 -48
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +65 -34
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +11 -6
- package/dist/components/user-action/Menu.d.ts +11 -6
- package/dist/components/user-action/Menu.js +128 -31
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +134 -33
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +17 -7
- package/dist/components/user-action/MultiSelect.d.ts +17 -7
- package/dist/components/user-action/MultiSelect.js +796 -375
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +781 -356
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +2 -2
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +2 -2
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.d.mts +14 -0
- package/dist/components/user-action/SearchBar.d.ts +14 -0
- package/dist/components/user-action/SearchBar.js +673 -0
- package/dist/components/user-action/SearchBar.js.map +1 -0
- package/dist/components/user-action/SearchBar.mjs +637 -0
- package/dist/components/user-action/SearchBar.mjs.map +1 -0
- package/dist/components/user-action/Select.d.mts +18 -5
- package/dist/components/user-action/Select.d.ts +18 -5
- package/dist/components/user-action/Select.js +764 -355
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +761 -349
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +1 -1
- package/dist/components/user-action/Textarea.d.ts +1 -1
- package/dist/components/user-action/Textarea.js +13 -3
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +13 -3
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.js +2 -2
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +2 -2
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +251 -113
- package/dist/css/uncompiled/globals.css +19 -13
- package/dist/css/uncompiled/theme/colors-component.css +12 -3
- package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
- package/dist/css/uncompiled/utitlity/animation.css +70 -1
- package/dist/css/uncompiled/utitlity/general.css +16 -0
- package/dist/hooks/usePopoverPosition.d.mts +15 -0
- package/dist/hooks/usePopoverPosition.d.ts +15 -0
- package/dist/hooks/usePopoverPosition.js +81 -0
- package/dist/hooks/usePopoverPosition.js.map +1 -0
- package/dist/hooks/usePopoverPosition.mjs +57 -0
- package/dist/hooks/usePopoverPosition.mjs.map +1 -0
- package/dist/hooks/useSearch.d.mts +7 -2
- package/dist/hooks/useSearch.d.ts +7 -2
- package/dist/hooks/useSearch.js +44 -15
- package/dist/hooks/useSearch.js.map +1 -1
- package/dist/hooks/useSearch.mjs +45 -16
- package/dist/hooks/useSearch.mjs.map +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1102 -819
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1001 -718
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +2 -0
- package/dist/localization/defaults/form.d.ts +2 -0
- package/dist/localization/defaults/form.js +4 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +4 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/simpleSearch.d.mts +1 -1
- package/dist/util/simpleSearch.d.ts +1 -1
- 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 -1
|
@@ -33,7 +33,7 @@ __export(SelectProperty_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(SelectProperty_exports);
|
|
35
35
|
var import_lucide_react5 = require("lucide-react");
|
|
36
|
-
var
|
|
36
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
37
37
|
|
|
38
38
|
// src/localization/LanguageProvider.tsx
|
|
39
39
|
var import_react2 = require("react");
|
|
@@ -127,6 +127,7 @@ var import_lucide_react = require("lucide-react");
|
|
|
127
127
|
var import_clsx2 = __toESM(require("clsx"));
|
|
128
128
|
|
|
129
129
|
// src/components/user-action/Button.tsx
|
|
130
|
+
var import_react3 = require("react");
|
|
130
131
|
var import_clsx = __toESM(require("clsx"));
|
|
131
132
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
132
133
|
var ButtonColorUtil = {
|
|
@@ -152,6 +153,76 @@ var ButtonUtil = {
|
|
|
152
153
|
paddingMapping,
|
|
153
154
|
iconPaddingMapping
|
|
154
155
|
};
|
|
156
|
+
var SolidButton = (0, import_react3.forwardRef)(function SolidButton2({
|
|
157
|
+
children,
|
|
158
|
+
disabled = false,
|
|
159
|
+
color = "primary",
|
|
160
|
+
size = "medium",
|
|
161
|
+
startIcon,
|
|
162
|
+
endIcon,
|
|
163
|
+
onClick,
|
|
164
|
+
className,
|
|
165
|
+
...restProps
|
|
166
|
+
}, ref) {
|
|
167
|
+
const colorClasses = {
|
|
168
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
169
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
170
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
171
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
172
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
173
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
174
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
175
|
+
}[color];
|
|
176
|
+
const iconColorClasses = {
|
|
177
|
+
primary: "text-button-solid-primary-icon",
|
|
178
|
+
secondary: "text-button-solid-secondary-icon",
|
|
179
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
180
|
+
positive: "text-button-solid-positive-icon",
|
|
181
|
+
warning: "text-button-solid-warning-icon",
|
|
182
|
+
negative: "text-button-solid-negative-icon",
|
|
183
|
+
neutral: "text-button-solid-neutral-icon"
|
|
184
|
+
}[color];
|
|
185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
186
|
+
"button",
|
|
187
|
+
{
|
|
188
|
+
ref,
|
|
189
|
+
onClick,
|
|
190
|
+
disabled,
|
|
191
|
+
className: (0, import_clsx.default)(
|
|
192
|
+
{
|
|
193
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
194
|
+
[(0, import_clsx.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
195
|
+
},
|
|
196
|
+
ButtonUtil.paddingMapping[size],
|
|
197
|
+
className
|
|
198
|
+
),
|
|
199
|
+
...restProps,
|
|
200
|
+
children: [
|
|
201
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
202
|
+
"span",
|
|
203
|
+
{
|
|
204
|
+
className: (0, import_clsx.default)({
|
|
205
|
+
[iconColorClasses]: !disabled,
|
|
206
|
+
[`text-disabled-icon`]: disabled
|
|
207
|
+
}),
|
|
208
|
+
children: startIcon
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
children,
|
|
212
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
213
|
+
"span",
|
|
214
|
+
{
|
|
215
|
+
className: (0, import_clsx.default)({
|
|
216
|
+
[iconColorClasses]: !disabled,
|
|
217
|
+
[`text-disabled-icon`]: disabled
|
|
218
|
+
}),
|
|
219
|
+
children: endIcon
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
});
|
|
155
226
|
var TextButton = ({
|
|
156
227
|
children,
|
|
157
228
|
disabled = false,
|
|
@@ -176,8 +247,8 @@ var TextButton = ({
|
|
|
176
247
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
177
248
|
"button",
|
|
178
249
|
{
|
|
179
|
-
onClick
|
|
180
|
-
disabled
|
|
250
|
+
onClick,
|
|
251
|
+
disabled,
|
|
181
252
|
className: (0, import_clsx.default)(
|
|
182
253
|
{
|
|
183
254
|
"text-disabled-text cursor-not-allowed": disabled,
|
|
@@ -218,7 +289,6 @@ var IconButton = ({
|
|
|
218
289
|
disabled = false,
|
|
219
290
|
color = "primary",
|
|
220
291
|
size = "medium",
|
|
221
|
-
onClick,
|
|
222
292
|
className,
|
|
223
293
|
...restProps
|
|
224
294
|
}) => {
|
|
@@ -235,8 +305,7 @@ var IconButton = ({
|
|
|
235
305
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
236
306
|
"button",
|
|
237
307
|
{
|
|
238
|
-
|
|
239
|
-
disabled: disabled || onClick === void 0,
|
|
308
|
+
disabled,
|
|
240
309
|
className: (0, import_clsx.default)(
|
|
241
310
|
{
|
|
242
311
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
@@ -256,6 +325,7 @@ var IconButton = ({
|
|
|
256
325
|
// src/localization/defaults/form.ts
|
|
257
326
|
var formTranslation = {
|
|
258
327
|
en: {
|
|
328
|
+
add: "Add",
|
|
259
329
|
all: "All",
|
|
260
330
|
apply: "Apply",
|
|
261
331
|
back: "Back",
|
|
@@ -268,6 +338,7 @@ var formTranslation = {
|
|
|
268
338
|
confirm: "Confirm",
|
|
269
339
|
copy: "Copy",
|
|
270
340
|
copied: "Copied",
|
|
341
|
+
create: "Create",
|
|
271
342
|
decline: "Decline",
|
|
272
343
|
delete: "Delete",
|
|
273
344
|
discard: "Discard",
|
|
@@ -310,6 +381,7 @@ var formTranslation = {
|
|
|
310
381
|
yes: "Yes"
|
|
311
382
|
},
|
|
312
383
|
de: {
|
|
384
|
+
add: "Hinzuf\xFCgen",
|
|
313
385
|
all: "Alle",
|
|
314
386
|
apply: "Anwenden",
|
|
315
387
|
back: "Zur\xFCck",
|
|
@@ -322,6 +394,7 @@ var formTranslation = {
|
|
|
322
394
|
confirm: "Best\xE4tigen",
|
|
323
395
|
copy: "Kopieren",
|
|
324
396
|
copied: "Kopiert",
|
|
397
|
+
create: "Erstellen",
|
|
325
398
|
decline: "Ablehnen",
|
|
326
399
|
delete: "L\xF6schen",
|
|
327
400
|
discard: "Verwerfen",
|
|
@@ -380,36 +453,44 @@ var PropertyBase = ({
|
|
|
380
453
|
}) => {
|
|
381
454
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
382
455
|
const requiredAndNoValue = softRequired && !hasValue;
|
|
383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)("row
|
|
456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)("flex-row-0 group", className), children: [
|
|
384
457
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
385
458
|
"div",
|
|
386
459
|
{
|
|
387
|
-
className: (0, import_clsx2.default)(
|
|
388
|
-
"
|
|
389
|
-
|
|
390
|
-
|
|
460
|
+
className: (0, import_clsx2.default)(
|
|
461
|
+
"flex-row-2 max-w-48 min-w-48 px-3 py-2 items-center rounded-l-xl border-2 border-r-0",
|
|
462
|
+
{
|
|
463
|
+
"bg-property-title-background text-property-title-text group-hover:border-primary": !requiredAndNoValue,
|
|
464
|
+
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
465
|
+
},
|
|
466
|
+
className
|
|
467
|
+
),
|
|
391
468
|
children: [
|
|
392
|
-
icon,
|
|
393
|
-
name
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "max-w-6 min-w-6 text-text-default", children: icon }),
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "font-semibold", children: name })
|
|
394
471
|
]
|
|
395
472
|
}
|
|
396
473
|
),
|
|
397
474
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
398
475
|
"div",
|
|
399
476
|
{
|
|
400
|
-
className: (0, import_clsx2.default)(
|
|
401
|
-
"
|
|
402
|
-
|
|
403
|
-
|
|
477
|
+
className: (0, import_clsx2.default)(
|
|
478
|
+
"flex-row-2 grow px-3 py-2 justify-between items-center rounded-r-xl border-2 border-l-0 min-h-15",
|
|
479
|
+
{
|
|
480
|
+
"bg-surface group-hover:border-primary": !requiredAndNoValue,
|
|
481
|
+
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
482
|
+
},
|
|
483
|
+
className
|
|
484
|
+
),
|
|
404
485
|
children: [
|
|
405
486
|
input({ softRequired, hasValue }),
|
|
406
|
-
requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-warning
|
|
407
|
-
onRemove && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
487
|
+
requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-warning", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.AlertTriangle, { size: 24 }) }),
|
|
488
|
+
onRemove && hasValue && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
408
489
|
TextButton,
|
|
409
490
|
{
|
|
410
491
|
onClick: onRemove,
|
|
411
492
|
color: "negative",
|
|
412
|
-
className: (0, import_clsx2.default)("
|
|
493
|
+
className: (0, import_clsx2.default)("items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
413
494
|
disabled: !hasValue || readOnly,
|
|
414
495
|
children: translation("remove")
|
|
415
496
|
}
|
|
@@ -421,9 +502,9 @@ var PropertyBase = ({
|
|
|
421
502
|
};
|
|
422
503
|
|
|
423
504
|
// src/components/user-action/Select.tsx
|
|
424
|
-
var
|
|
425
|
-
var
|
|
426
|
-
var
|
|
505
|
+
var import_react13 = require("react");
|
|
506
|
+
var import_react14 = require("react");
|
|
507
|
+
var import_clsx9 = __toESM(require("clsx"));
|
|
427
508
|
|
|
428
509
|
// src/components/user-action/Label.tsx
|
|
429
510
|
var import_clsx3 = __toESM(require("clsx"));
|
|
@@ -443,22 +524,384 @@ var Label = ({
|
|
|
443
524
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { ...props, className: (0, import_clsx3.default)(styleMapping[labelType], className), children: children ? children : name });
|
|
444
525
|
};
|
|
445
526
|
|
|
446
|
-
// src/components/layout-and-navigation/
|
|
527
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
528
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
447
529
|
var import_lucide_react2 = require("lucide-react");
|
|
530
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
531
|
+
var Tile = ({
|
|
532
|
+
title,
|
|
533
|
+
description,
|
|
534
|
+
onClick,
|
|
535
|
+
isSelected = false,
|
|
536
|
+
disabled = false,
|
|
537
|
+
prefix,
|
|
538
|
+
suffix,
|
|
539
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
540
|
+
selectedClassName = " bg-primary/20",
|
|
541
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
542
|
+
className
|
|
543
|
+
}) => {
|
|
544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
545
|
+
"div",
|
|
546
|
+
{
|
|
547
|
+
className: (0, import_clsx4.default)(
|
|
548
|
+
"flex-row-2 w-full items-center",
|
|
549
|
+
{
|
|
550
|
+
[normalClassName]: !!onClick && !disabled,
|
|
551
|
+
[selectedClassName]: isSelected && !disabled,
|
|
552
|
+
[disabledClassName]: disabled
|
|
553
|
+
},
|
|
554
|
+
className
|
|
555
|
+
),
|
|
556
|
+
onClick: disabled ? void 0 : onClick,
|
|
557
|
+
children: [
|
|
558
|
+
prefix,
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-col-0 w-full", children: [
|
|
560
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h4", { className: (0, import_clsx4.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
561
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: (0, import_clsx4.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
562
|
+
] }),
|
|
563
|
+
suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Check, { size: 24 }) : void 0)
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
570
|
+
var import_react4 = require("react");
|
|
571
|
+
var import_lucide_react3 = require("lucide-react");
|
|
448
572
|
var import_clsx5 = __toESM(require("clsx"));
|
|
449
573
|
|
|
450
|
-
// src/
|
|
574
|
+
// src/util/noop.ts
|
|
575
|
+
var noop = () => void 0;
|
|
576
|
+
|
|
577
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
578
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
579
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
581
|
+
import_lucide_react3.ChevronDown,
|
|
582
|
+
{
|
|
583
|
+
className: (0, import_clsx5.default)(
|
|
584
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
|
|
585
|
+
{ "rotate-180": isExpanded },
|
|
586
|
+
className
|
|
587
|
+
)
|
|
588
|
+
}
|
|
589
|
+
);
|
|
590
|
+
};
|
|
591
|
+
var Expandable = (0, import_react4.forwardRef)(function Expandable2({
|
|
592
|
+
children,
|
|
593
|
+
label,
|
|
594
|
+
icon,
|
|
595
|
+
isExpanded = false,
|
|
596
|
+
onChange = noop,
|
|
597
|
+
clickOnlyOnHeader = true,
|
|
598
|
+
disabled = false,
|
|
599
|
+
className,
|
|
600
|
+
headerClassName,
|
|
601
|
+
contentClassName
|
|
602
|
+
}, ref) {
|
|
603
|
+
const defaultIcon = (0, import_react4.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
|
|
604
|
+
icon ??= defaultIcon;
|
|
605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
606
|
+
"div",
|
|
607
|
+
{
|
|
608
|
+
ref,
|
|
609
|
+
className: (0, import_clsx5.default)("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
610
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
611
|
+
children: [
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
613
|
+
"div",
|
|
614
|
+
{
|
|
615
|
+
className: (0, import_clsx5.default)(
|
|
616
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
617
|
+
{
|
|
618
|
+
"group-hover:brightness-97": !isExpanded,
|
|
619
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
620
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
621
|
+
},
|
|
622
|
+
headerClassName
|
|
623
|
+
),
|
|
624
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
625
|
+
children: [
|
|
626
|
+
label,
|
|
627
|
+
icon(isExpanded)
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
),
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
632
|
+
"div",
|
|
633
|
+
{
|
|
634
|
+
className: (0, import_clsx5.default)(
|
|
635
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
636
|
+
{
|
|
637
|
+
"max-h-96 opacity-100 pb-2": isExpanded,
|
|
638
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
639
|
+
},
|
|
640
|
+
contentClassName
|
|
641
|
+
),
|
|
642
|
+
children
|
|
643
|
+
}
|
|
644
|
+
)
|
|
645
|
+
]
|
|
646
|
+
}
|
|
647
|
+
);
|
|
648
|
+
});
|
|
649
|
+
var ExpandableUncontrolled = (0, import_react4.forwardRef)(function ExpandableUncontrolled2({
|
|
650
|
+
isExpanded,
|
|
651
|
+
onChange = noop,
|
|
652
|
+
...props
|
|
653
|
+
}, ref) {
|
|
654
|
+
const [usedIsExpanded, setUsedIsExpanded] = (0, import_react4.useState)(isExpanded);
|
|
655
|
+
(0, import_react4.useEffect)(() => {
|
|
656
|
+
setUsedIsExpanded(isExpanded);
|
|
657
|
+
}, [isExpanded]);
|
|
658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
659
|
+
Expandable,
|
|
660
|
+
{
|
|
661
|
+
...props,
|
|
662
|
+
ref,
|
|
663
|
+
isExpanded: usedIsExpanded,
|
|
664
|
+
onChange: (value) => {
|
|
665
|
+
onChange(value);
|
|
666
|
+
setUsedIsExpanded(value);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
// src/components/user-action/Menu.tsx
|
|
673
|
+
var import_react7 = require("react");
|
|
674
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
675
|
+
|
|
676
|
+
// src/hooks/useOutsideClick.ts
|
|
677
|
+
var import_react5 = require("react");
|
|
678
|
+
var useOutsideClick = (refs, handler) => {
|
|
679
|
+
(0, import_react5.useEffect)(() => {
|
|
680
|
+
const listener = (event) => {
|
|
681
|
+
if (event.target === null) return;
|
|
682
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
handler();
|
|
686
|
+
};
|
|
687
|
+
document.addEventListener("mousedown", listener);
|
|
688
|
+
document.addEventListener("touchstart", listener);
|
|
689
|
+
return () => {
|
|
690
|
+
document.removeEventListener("mousedown", listener);
|
|
691
|
+
document.removeEventListener("touchstart", listener);
|
|
692
|
+
};
|
|
693
|
+
}, [refs, handler]);
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
// src/hooks/useHoverState.ts
|
|
451
697
|
var import_react6 = require("react");
|
|
452
|
-
var
|
|
698
|
+
var defaultUseHoverStateProps = {
|
|
699
|
+
closingDelay: 200,
|
|
700
|
+
isDisabled: false
|
|
701
|
+
};
|
|
702
|
+
var useHoverState = (props = void 0) => {
|
|
703
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
704
|
+
const [isHovered, setIsHovered] = (0, import_react6.useState)(false);
|
|
705
|
+
const [timer, setTimer] = (0, import_react6.useState)();
|
|
706
|
+
const onMouseEnter = () => {
|
|
707
|
+
if (isDisabled) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
clearTimeout(timer);
|
|
711
|
+
setIsHovered(true);
|
|
712
|
+
};
|
|
713
|
+
const onMouseLeave = () => {
|
|
714
|
+
if (isDisabled) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
setTimer(setTimeout(() => {
|
|
718
|
+
setIsHovered(false);
|
|
719
|
+
}, closingDelay));
|
|
720
|
+
};
|
|
721
|
+
(0, import_react6.useEffect)(() => {
|
|
722
|
+
if (timer) {
|
|
723
|
+
return () => {
|
|
724
|
+
clearTimeout(timer);
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
(0, import_react6.useEffect)(() => {
|
|
729
|
+
if (timer) {
|
|
730
|
+
clearTimeout(timer);
|
|
731
|
+
}
|
|
732
|
+
}, [isDisabled]);
|
|
733
|
+
return {
|
|
734
|
+
isHovered,
|
|
735
|
+
setIsHovered,
|
|
736
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
737
|
+
};
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
741
|
+
var resolve = (children, bag) => {
|
|
742
|
+
if (typeof children === "function") {
|
|
743
|
+
return children(bag);
|
|
744
|
+
}
|
|
745
|
+
return children ?? void 0;
|
|
746
|
+
};
|
|
747
|
+
var BagFunctionUtil = {
|
|
748
|
+
resolve
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
// src/hooks/usePopoverPosition.ts
|
|
752
|
+
var defaultPopoverPositionOptions = {
|
|
753
|
+
edgePadding: 16,
|
|
754
|
+
outerGap: 4,
|
|
755
|
+
horizontalAlignment: "leftInside",
|
|
756
|
+
verticalAlignment: "bottomOutside",
|
|
757
|
+
disabled: false
|
|
758
|
+
};
|
|
759
|
+
var usePopoverPosition = (trigger, options) => {
|
|
760
|
+
const {
|
|
761
|
+
edgePadding,
|
|
762
|
+
outerGap,
|
|
763
|
+
verticalAlignment,
|
|
764
|
+
horizontalAlignment,
|
|
765
|
+
disabled
|
|
766
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
767
|
+
if (disabled || !trigger) {
|
|
768
|
+
return {};
|
|
769
|
+
}
|
|
770
|
+
const left = {
|
|
771
|
+
leftOutside: trigger.left - outerGap,
|
|
772
|
+
leftInside: trigger.left,
|
|
773
|
+
rightOutside: trigger.right + outerGap,
|
|
774
|
+
rightInside: trigger.right,
|
|
775
|
+
center: trigger.left + trigger.width / 2
|
|
776
|
+
}[horizontalAlignment];
|
|
777
|
+
const top = {
|
|
778
|
+
topOutside: trigger.top - outerGap,
|
|
779
|
+
topInside: trigger.top,
|
|
780
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
781
|
+
bottomInside: trigger.bottom,
|
|
782
|
+
center: trigger.top + trigger.height / 2
|
|
783
|
+
}[verticalAlignment];
|
|
784
|
+
const translateX = {
|
|
785
|
+
leftOutside: "-100%",
|
|
786
|
+
leftInside: void 0,
|
|
787
|
+
rightOutside: void 0,
|
|
788
|
+
rightInside: "-100%",
|
|
789
|
+
center: "-50%"
|
|
790
|
+
}[horizontalAlignment];
|
|
791
|
+
const translateY = {
|
|
792
|
+
topOutside: "-100%",
|
|
793
|
+
topInside: void 0,
|
|
794
|
+
bottomOutside: void 0,
|
|
795
|
+
bottomInside: "-100%",
|
|
796
|
+
center: "-50%"
|
|
797
|
+
}[verticalAlignment];
|
|
798
|
+
return {
|
|
799
|
+
left: Math.max(left, edgePadding),
|
|
800
|
+
top: Math.max(top, edgePadding),
|
|
801
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
802
|
+
};
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
// src/components/user-action/Menu.tsx
|
|
806
|
+
var import_react_dom = require("react-dom");
|
|
807
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
808
|
+
function getScrollableParents(element) {
|
|
809
|
+
const scrollables = [];
|
|
810
|
+
let parent = element.parentElement;
|
|
811
|
+
while (parent) {
|
|
812
|
+
scrollables.push(parent);
|
|
813
|
+
parent = parent.parentElement;
|
|
814
|
+
}
|
|
815
|
+
return scrollables;
|
|
816
|
+
}
|
|
817
|
+
var Menu = ({
|
|
818
|
+
trigger,
|
|
819
|
+
children,
|
|
820
|
+
alignmentHorizontal = "leftInside",
|
|
821
|
+
alignmentVertical = "bottomOutside",
|
|
822
|
+
showOnHover = false,
|
|
823
|
+
disabled = false,
|
|
824
|
+
menuClassName = ""
|
|
825
|
+
}) => {
|
|
826
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
827
|
+
const triggerRef = (0, import_react7.useRef)(null);
|
|
828
|
+
const menuRef = (0, import_react7.useRef)(null);
|
|
829
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
830
|
+
const [isHidden, setIsHidden] = (0, import_react7.useState)(true);
|
|
831
|
+
const bag = {
|
|
832
|
+
isOpen,
|
|
833
|
+
close: () => setIsOpen(false),
|
|
834
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
835
|
+
disabled
|
|
836
|
+
};
|
|
837
|
+
const menuPosition = usePopoverPosition(
|
|
838
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
839
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
840
|
+
);
|
|
841
|
+
(0, import_react7.useEffect)(() => {
|
|
842
|
+
if (!isOpen) return;
|
|
843
|
+
const triggerEl = triggerRef.current;
|
|
844
|
+
if (!triggerEl) return;
|
|
845
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
846
|
+
const close = () => setIsOpen(false);
|
|
847
|
+
scrollableParents.forEach((parent) => {
|
|
848
|
+
parent.addEventListener("scroll", close);
|
|
849
|
+
});
|
|
850
|
+
window.addEventListener("resize", close);
|
|
851
|
+
return () => {
|
|
852
|
+
scrollableParents.forEach((parent) => {
|
|
853
|
+
parent.removeEventListener("scroll", close);
|
|
854
|
+
});
|
|
855
|
+
window.removeEventListener("resize", close);
|
|
856
|
+
};
|
|
857
|
+
}, [isOpen, setIsOpen]);
|
|
858
|
+
(0, import_react7.useEffect)(() => {
|
|
859
|
+
if (isOpen) {
|
|
860
|
+
setIsHidden(false);
|
|
861
|
+
}
|
|
862
|
+
}, [isOpen]);
|
|
863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
864
|
+
trigger(bag, triggerRef),
|
|
865
|
+
(0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
ref: menuRef,
|
|
869
|
+
onClick: (e) => e.stopPropagation(),
|
|
870
|
+
className: (0, import_clsx6.default)(
|
|
871
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
872
|
+
{
|
|
873
|
+
"animate-pop-in": isOpen,
|
|
874
|
+
"animate-pop-out": !isOpen,
|
|
875
|
+
"hidden": isHidden
|
|
876
|
+
},
|
|
877
|
+
menuClassName
|
|
878
|
+
),
|
|
879
|
+
onAnimationEnd: () => {
|
|
880
|
+
if (!isOpen) {
|
|
881
|
+
setIsHidden(true);
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
style: {
|
|
885
|
+
...menuPosition
|
|
886
|
+
},
|
|
887
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
888
|
+
}
|
|
889
|
+
), document.body)
|
|
890
|
+
] });
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
// src/components/user-action/Input.tsx
|
|
894
|
+
var import_react11 = require("react");
|
|
895
|
+
var import_clsx7 = __toESM(require("clsx"));
|
|
453
896
|
|
|
454
897
|
// src/hooks/useDelay.ts
|
|
455
|
-
var
|
|
898
|
+
var import_react8 = require("react");
|
|
456
899
|
var defaultOptions = {
|
|
457
900
|
delay: 3e3,
|
|
458
901
|
disabled: false
|
|
459
902
|
};
|
|
460
903
|
function useDelay(options) {
|
|
461
|
-
const [timer, setTimer] = (0,
|
|
904
|
+
const [timer, setTimer] = (0, import_react8.useState)(void 0);
|
|
462
905
|
const { delay, disabled } = {
|
|
463
906
|
...defaultOptions,
|
|
464
907
|
...options
|
|
@@ -477,12 +920,12 @@ function useDelay(options) {
|
|
|
477
920
|
setTimer(void 0);
|
|
478
921
|
}, delay));
|
|
479
922
|
};
|
|
480
|
-
(0,
|
|
923
|
+
(0, import_react8.useEffect)(() => {
|
|
481
924
|
return () => {
|
|
482
925
|
clearTimeout(timer);
|
|
483
926
|
};
|
|
484
927
|
}, [timer]);
|
|
485
|
-
(0,
|
|
928
|
+
(0, import_react8.useEffect)(() => {
|
|
486
929
|
if (disabled) {
|
|
487
930
|
clearTimeout(timer);
|
|
488
931
|
setTimer(void 0);
|
|
@@ -491,13 +934,10 @@ function useDelay(options) {
|
|
|
491
934
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
492
935
|
}
|
|
493
936
|
|
|
494
|
-
// src/util/noop.ts
|
|
495
|
-
var noop = () => void 0;
|
|
496
|
-
|
|
497
937
|
// src/hooks/useFocusManagement.ts
|
|
498
|
-
var
|
|
938
|
+
var import_react9 = require("react");
|
|
499
939
|
function useFocusManagement() {
|
|
500
|
-
const getFocusableElements = (0,
|
|
940
|
+
const getFocusableElements = (0, import_react9.useCallback)(() => {
|
|
501
941
|
return Array.from(
|
|
502
942
|
document.querySelectorAll(
|
|
503
943
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -506,7 +946,7 @@ function useFocusManagement() {
|
|
|
506
946
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
507
947
|
);
|
|
508
948
|
}, []);
|
|
509
|
-
const getNextFocusElement = (0,
|
|
949
|
+
const getNextFocusElement = (0, import_react9.useCallback)(() => {
|
|
510
950
|
const elements = getFocusableElements();
|
|
511
951
|
if (elements.length === 0) {
|
|
512
952
|
return void 0;
|
|
@@ -518,11 +958,11 @@ function useFocusManagement() {
|
|
|
518
958
|
}
|
|
519
959
|
return nextElement;
|
|
520
960
|
}, [getFocusableElements]);
|
|
521
|
-
const focusNext = (0,
|
|
961
|
+
const focusNext = (0, import_react9.useCallback)(() => {
|
|
522
962
|
const nextElement = getNextFocusElement();
|
|
523
963
|
nextElement?.focus();
|
|
524
964
|
}, [getNextFocusElement]);
|
|
525
|
-
const getPreviousFocusElement = (0,
|
|
965
|
+
const getPreviousFocusElement = (0, import_react9.useCallback)(() => {
|
|
526
966
|
const elements = getFocusableElements();
|
|
527
967
|
if (elements.length === 0) {
|
|
528
968
|
return void 0;
|
|
@@ -538,7 +978,7 @@ function useFocusManagement() {
|
|
|
538
978
|
}
|
|
539
979
|
return previousElement;
|
|
540
980
|
}, [getFocusableElements]);
|
|
541
|
-
const focusPrevious = (0,
|
|
981
|
+
const focusPrevious = (0, import_react9.useCallback)(() => {
|
|
542
982
|
const previousElement = getPreviousFocusElement();
|
|
543
983
|
if (previousElement) previousElement.focus();
|
|
544
984
|
}, [getPreviousFocusElement]);
|
|
@@ -552,10 +992,10 @@ function useFocusManagement() {
|
|
|
552
992
|
}
|
|
553
993
|
|
|
554
994
|
// src/hooks/useFocusOnceVisible.ts
|
|
555
|
-
var
|
|
995
|
+
var import_react10 = __toESM(require("react"));
|
|
556
996
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
557
|
-
const [hasUsedFocus, setHasUsedFocus] =
|
|
558
|
-
(0,
|
|
997
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react10.default.useState(false);
|
|
998
|
+
(0, import_react10.useEffect)(() => {
|
|
559
999
|
if (disable || hasUsedFocus) {
|
|
560
1000
|
return;
|
|
561
1001
|
}
|
|
@@ -575,9 +1015,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
575
1015
|
};
|
|
576
1016
|
|
|
577
1017
|
// src/components/user-action/Input.tsx
|
|
578
|
-
var
|
|
1018
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
579
1019
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
580
|
-
return (0,
|
|
1020
|
+
return (0, import_clsx7.default)(
|
|
581
1021
|
"px-2 py-1.5 rounded-md border-2",
|
|
582
1022
|
{
|
|
583
1023
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -591,7 +1031,7 @@ var defaultEditCompleteOptions = {
|
|
|
591
1031
|
afterDelay: true,
|
|
592
1032
|
delay: 2500
|
|
593
1033
|
};
|
|
594
|
-
var Input = (0,
|
|
1034
|
+
var Input = (0, import_react11.forwardRef)(function Input2({
|
|
595
1035
|
id,
|
|
596
1036
|
type = "text",
|
|
597
1037
|
value,
|
|
@@ -614,10 +1054,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
614
1054
|
restartTimer,
|
|
615
1055
|
clearTimer
|
|
616
1056
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
617
|
-
const innerRef = (0,
|
|
1057
|
+
const innerRef = (0, import_react11.useRef)(null);
|
|
618
1058
|
const { focusNext } = useFocusManagement();
|
|
619
1059
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
620
|
-
(0,
|
|
1060
|
+
(0, import_react11.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
621
1061
|
const handleKeyDown = (e) => {
|
|
622
1062
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
623
1063
|
e.preventDefault();
|
|
@@ -625,9 +1065,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
625
1065
|
focusNext();
|
|
626
1066
|
}
|
|
627
1067
|
};
|
|
628
|
-
return /* @__PURE__ */ (0,
|
|
629
|
-
label && /* @__PURE__ */ (0,
|
|
630
|
-
/* @__PURE__ */ (0,
|
|
1068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.default)({ "w-full": expanded }, containerClassName), children: [
|
|
1069
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx7.default)("mb-1", label.className) }),
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
631
1071
|
"input",
|
|
632
1072
|
{
|
|
633
1073
|
...restProps,
|
|
@@ -636,7 +1076,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
636
1076
|
id,
|
|
637
1077
|
type,
|
|
638
1078
|
disabled,
|
|
639
|
-
className: (0,
|
|
1079
|
+
className: (0, import_clsx7.default)(getInputClassName({ disabled }), className),
|
|
640
1080
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
641
1081
|
onBlur: (event) => {
|
|
642
1082
|
onBlur?.(event);
|
|
@@ -666,7 +1106,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
666
1106
|
)
|
|
667
1107
|
] });
|
|
668
1108
|
});
|
|
669
|
-
var FormInput = (0,
|
|
1109
|
+
var FormInput = (0, import_react11.forwardRef)(function FormInput2({
|
|
670
1110
|
id,
|
|
671
1111
|
labelText,
|
|
672
1112
|
errorText,
|
|
@@ -678,40 +1118,64 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
|
|
|
678
1118
|
disabled,
|
|
679
1119
|
...restProps
|
|
680
1120
|
}, ref) {
|
|
681
|
-
const input = /* @__PURE__ */ (0,
|
|
1121
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
682
1122
|
"input",
|
|
683
1123
|
{
|
|
684
1124
|
...restProps,
|
|
685
1125
|
ref,
|
|
686
1126
|
id,
|
|
687
1127
|
disabled,
|
|
688
|
-
className: (0,
|
|
1128
|
+
className: (0, import_clsx7.default)(
|
|
689
1129
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
690
1130
|
className
|
|
691
1131
|
)
|
|
692
1132
|
}
|
|
693
1133
|
);
|
|
694
|
-
return /* @__PURE__ */ (0,
|
|
695
|
-
labelText && /* @__PURE__ */ (0,
|
|
1134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.default)("flex flex-col gap-y-1", containerClassName), children: [
|
|
1135
|
+
labelText && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { htmlFor: id, className: (0, import_clsx7.default)("textstyle-label-md", labelClassName), children: [
|
|
696
1136
|
labelText,
|
|
697
|
-
required && /* @__PURE__ */ (0,
|
|
1137
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
698
1138
|
] }),
|
|
699
1139
|
input,
|
|
700
|
-
errorText && /* @__PURE__ */ (0,
|
|
1140
|
+
errorText && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { htmlFor: id, className: (0, import_clsx7.default)("text-negative", errorClassName), children: errorText })
|
|
701
1141
|
] });
|
|
702
1142
|
});
|
|
703
1143
|
|
|
1144
|
+
// src/components/user-action/SearchBar.tsx
|
|
1145
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1146
|
+
var import_clsx8 = require("clsx");
|
|
1147
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1148
|
+
var SearchBar = ({
|
|
1149
|
+
placeholder,
|
|
1150
|
+
onSearch,
|
|
1151
|
+
disableOnSearch,
|
|
1152
|
+
containerClassName,
|
|
1153
|
+
...inputProps
|
|
1154
|
+
}) => {
|
|
1155
|
+
const translation = useTranslation([formTranslation]);
|
|
1156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_clsx8.clsx)("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1158
|
+
Input,
|
|
1159
|
+
{
|
|
1160
|
+
...inputProps,
|
|
1161
|
+
placeholder: placeholder ?? translation("search")
|
|
1162
|
+
}
|
|
1163
|
+
),
|
|
1164
|
+
onSearch && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Search, { className: "w-full h-full" }) })
|
|
1165
|
+
] });
|
|
1166
|
+
};
|
|
1167
|
+
|
|
704
1168
|
// src/hooks/useSearch.ts
|
|
705
|
-
var
|
|
1169
|
+
var import_react12 = require("react");
|
|
706
1170
|
|
|
707
1171
|
// src/util/simpleSearch.ts
|
|
708
|
-
var
|
|
1172
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
709
1173
|
return objects.filter((object) => {
|
|
710
1174
|
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
711
1175
|
if (!mappedSearchKeywords) {
|
|
712
1176
|
return true;
|
|
713
1177
|
}
|
|
714
|
-
return !!mappedSearchKeywords.find((value) => value.includes(
|
|
1178
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
715
1179
|
});
|
|
716
1180
|
};
|
|
717
1181
|
|
|
@@ -719,212 +1183,163 @@ var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
|
719
1183
|
var useSearch = ({
|
|
720
1184
|
list,
|
|
721
1185
|
initialSearch,
|
|
722
|
-
searchMapping
|
|
1186
|
+
searchMapping,
|
|
1187
|
+
additionalSearchTags,
|
|
1188
|
+
isSearchInstant = true,
|
|
1189
|
+
sortingFunction,
|
|
1190
|
+
filter,
|
|
1191
|
+
disabled = false
|
|
723
1192
|
}) => {
|
|
724
|
-
const [
|
|
725
|
-
const [
|
|
726
|
-
(0,
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
1193
|
+
const [search, setSearch] = (0, import_react12.useState)(initialSearch ?? "");
|
|
1194
|
+
const [result, setResult] = (0, import_react12.useState)(list);
|
|
1195
|
+
const searchTags = (0, import_react12.useMemo)(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1196
|
+
const updateSearch = (0, import_react12.useCallback)((newSearch) => {
|
|
1197
|
+
const usedSearch = newSearch ?? search;
|
|
1198
|
+
if (newSearch) {
|
|
1199
|
+
setSearch(search);
|
|
1200
|
+
}
|
|
1201
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1202
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1203
|
+
(0, import_react12.useEffect)(() => {
|
|
1204
|
+
if (isSearchInstant) {
|
|
1205
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1206
|
+
}
|
|
1207
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1208
|
+
const filteredResult = (0, import_react12.useMemo)(() => {
|
|
1209
|
+
if (!filter) {
|
|
1210
|
+
return result;
|
|
1211
|
+
}
|
|
1212
|
+
return result.filter(filter);
|
|
1213
|
+
}, [result, filter]);
|
|
1214
|
+
const sortedAndFilteredResult = (0, import_react12.useMemo)(() => {
|
|
1215
|
+
if (!sortingFunction) {
|
|
1216
|
+
return filteredResult;
|
|
1217
|
+
}
|
|
1218
|
+
return filteredResult.sort(sortingFunction);
|
|
1219
|
+
}, [filteredResult, sortingFunction]);
|
|
1220
|
+
const usedResult = (0, import_react12.useMemo)(() => {
|
|
1221
|
+
if (!disabled) {
|
|
1222
|
+
return sortedAndFilteredResult;
|
|
1223
|
+
}
|
|
1224
|
+
return list;
|
|
1225
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
733
1226
|
return {
|
|
734
|
-
result,
|
|
735
|
-
hasResult:
|
|
736
|
-
allItems:
|
|
737
|
-
|
|
1227
|
+
result: usedResult,
|
|
1228
|
+
hasResult: usedResult.length > 0,
|
|
1229
|
+
allItems: list,
|
|
1230
|
+
updateSearch,
|
|
738
1231
|
search,
|
|
739
1232
|
setSearch
|
|
740
1233
|
};
|
|
741
1234
|
};
|
|
742
1235
|
|
|
743
|
-
// src/components/
|
|
744
|
-
var
|
|
745
|
-
var
|
|
746
|
-
en: {
|
|
747
|
-
nothingFound: "Nothing found"
|
|
748
|
-
},
|
|
749
|
-
de: {
|
|
750
|
-
nothingFound: "Nichts gefunden"
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
var SearchableList = ({
|
|
754
|
-
overwriteTranslation,
|
|
755
|
-
list,
|
|
756
|
-
initialSearch = "",
|
|
757
|
-
searchMapping,
|
|
758
|
-
autoFocus,
|
|
759
|
-
minimumItemsForSearch = 6,
|
|
760
|
-
itemMapper,
|
|
1236
|
+
// src/components/user-action/Select.tsx
|
|
1237
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1238
|
+
var SelectTile = ({
|
|
761
1239
|
className,
|
|
762
|
-
|
|
763
|
-
}) => {
|
|
764
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
765
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
766
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)("col gap-y-2", className), children: [
|
|
767
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
768
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
769
|
-
Input,
|
|
770
|
-
{
|
|
771
|
-
value: search,
|
|
772
|
-
onChangeText: setSearch,
|
|
773
|
-
placeholder: translation("search"),
|
|
774
|
-
autoFocus,
|
|
775
|
-
className: "w-full"
|
|
776
|
-
}
|
|
777
|
-
),
|
|
778
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Search, { className: "w-full h-full" }) })
|
|
779
|
-
] }),
|
|
780
|
-
hasResult ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: (0, import_clsx5.default)("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
|
|
781
|
-
] });
|
|
782
|
-
};
|
|
783
|
-
|
|
784
|
-
// src/components/layout-and-navigation/Tile.tsx
|
|
785
|
-
var import_clsx6 = __toESM(require("clsx"));
|
|
786
|
-
var import_lucide_react3 = require("lucide-react");
|
|
787
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
788
|
-
var Tile = ({
|
|
1240
|
+
disabledClassName,
|
|
789
1241
|
title,
|
|
790
|
-
|
|
791
|
-
onClick,
|
|
792
|
-
isSelected = false,
|
|
793
|
-
isDisabled = false,
|
|
794
|
-
prefix,
|
|
795
|
-
suffix,
|
|
796
|
-
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
797
|
-
selectedClassName = " bg-primary/20",
|
|
798
|
-
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
799
|
-
className
|
|
1242
|
+
...restProps
|
|
800
1243
|
}) => {
|
|
801
|
-
return /* @__PURE__ */ (0,
|
|
802
|
-
|
|
1244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1245
|
+
Tile,
|
|
803
1246
|
{
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
[selectedClassName]: isSelected && !isDisabled,
|
|
809
|
-
[disabledClassName]: isDisabled
|
|
810
|
-
},
|
|
811
|
-
className
|
|
812
|
-
),
|
|
813
|
-
onClick: isDisabled ? void 0 : onClick,
|
|
814
|
-
children: [
|
|
815
|
-
prefix,
|
|
816
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "col gap-y-0 w-full", children: [
|
|
817
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h4", { className: (0, import_clsx6.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
818
|
-
!!description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: (0, import_clsx6.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
819
|
-
] }),
|
|
820
|
-
suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Check, { size: 24 }) : void 0)
|
|
821
|
-
]
|
|
1247
|
+
...restProps,
|
|
1248
|
+
className: (0, import_clsx9.default)("px-2 py-1 rounded-md", className),
|
|
1249
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1250
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
822
1251
|
}
|
|
823
1252
|
);
|
|
824
1253
|
};
|
|
825
|
-
|
|
826
|
-
// src/hooks/useOutsideClick.ts
|
|
827
|
-
var import_react8 = require("react");
|
|
828
|
-
var useOutsideClick = (refs, handler) => {
|
|
829
|
-
(0, import_react8.useEffect)(() => {
|
|
830
|
-
const listener = (event) => {
|
|
831
|
-
if (event.target === null) return;
|
|
832
|
-
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
833
|
-
return;
|
|
834
|
-
}
|
|
835
|
-
handler();
|
|
836
|
-
};
|
|
837
|
-
document.addEventListener("mousedown", listener);
|
|
838
|
-
document.addEventListener("touchstart", listener);
|
|
839
|
-
return () => {
|
|
840
|
-
document.removeEventListener("mousedown", listener);
|
|
841
|
-
document.removeEventListener("touchstart", listener);
|
|
842
|
-
};
|
|
843
|
-
}, [refs, handler]);
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
// src/components/user-action/Select.tsx
|
|
847
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
848
1254
|
var Select = ({
|
|
849
1255
|
value,
|
|
850
1256
|
label,
|
|
851
1257
|
options,
|
|
852
1258
|
onChange,
|
|
853
1259
|
hintText = "",
|
|
854
|
-
|
|
855
|
-
|
|
1260
|
+
selectedDisplayOverwrite,
|
|
1261
|
+
searchOptions,
|
|
1262
|
+
additionalItems,
|
|
856
1263
|
className,
|
|
857
|
-
|
|
1264
|
+
triggerClassName,
|
|
1265
|
+
hintTextClassName,
|
|
1266
|
+
...menuProps
|
|
858
1267
|
}) => {
|
|
859
|
-
const triggerRef = (0, import_react9.useRef)(null);
|
|
860
|
-
const menuRef = (0, import_react9.useRef)(null);
|
|
861
|
-
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
862
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
863
1268
|
const selectedOption = options.find((option) => option.value === value);
|
|
864
1269
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
865
1270
|
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");
|
|
866
1271
|
}
|
|
867
1272
|
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1273
|
+
const { result, search, setSearch } = useSearch({
|
|
1274
|
+
list: options,
|
|
1275
|
+
searchMapping: (0, import_react13.useCallback)((item) => item.searchTags, []),
|
|
1276
|
+
...searchOptions
|
|
1277
|
+
});
|
|
1278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: (0, import_clsx9.default)(className), children: [
|
|
1279
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx9.default)("mb-1", label.className) }),
|
|
1280
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1281
|
+
Menu,
|
|
1282
|
+
{
|
|
1283
|
+
...menuProps,
|
|
1284
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1285
|
+
"button",
|
|
1286
|
+
{
|
|
1287
|
+
ref,
|
|
1288
|
+
className: (0, import_clsx9.default)(
|
|
1289
|
+
"btn-md justify-between w-full border-2",
|
|
1290
|
+
{
|
|
1291
|
+
"rounded-b-lg": !open,
|
|
1292
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1293
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1294
|
+
},
|
|
1295
|
+
triggerClassName
|
|
1296
|
+
),
|
|
1297
|
+
onClick: toggleOpen,
|
|
1298
|
+
disabled,
|
|
1299
|
+
children: [
|
|
1300
|
+
!isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
1301
|
+
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: (0, import_clsx9.default)("textstyle-description", hintTextClassName), children: hintText }),
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ExpansionIcon, { isExpanded: isOpen })
|
|
1303
|
+
]
|
|
1304
|
+
}
|
|
1305
|
+
),
|
|
1306
|
+
menuClassName: (0, import_clsx9.default)("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1307
|
+
children: (bag) => {
|
|
1308
|
+
const { close } = bag;
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1310
|
+
!searchOptions?.disabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1311
|
+
SearchBar,
|
|
1312
|
+
{
|
|
1313
|
+
value: search,
|
|
1314
|
+
onChangeText: setSearch,
|
|
1315
|
+
autoFocus: true
|
|
1316
|
+
}
|
|
1317
|
+
),
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1319
|
+
result.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1320
|
+
SelectTile,
|
|
905
1321
|
{
|
|
906
|
-
isSelected:
|
|
907
|
-
|
|
908
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
909
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1322
|
+
isSelected: option === selectedOption,
|
|
1323
|
+
title: { value: option.label },
|
|
910
1324
|
onClick: () => {
|
|
911
1325
|
onChange(option.value);
|
|
912
|
-
|
|
1326
|
+
close();
|
|
913
1327
|
},
|
|
914
|
-
|
|
1328
|
+
disabled: option.disabled
|
|
915
1329
|
},
|
|
916
1330
|
index
|
|
917
|
-
)
|
|
918
|
-
|
|
919
|
-
|
|
1331
|
+
)),
|
|
1332
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1333
|
+
] })
|
|
1334
|
+
] });
|
|
920
1335
|
}
|
|
921
|
-
|
|
922
|
-
|
|
1336
|
+
}
|
|
1337
|
+
)
|
|
923
1338
|
] });
|
|
924
1339
|
};
|
|
925
1340
|
|
|
926
1341
|
// src/components/properties/SelectProperty.tsx
|
|
927
|
-
var
|
|
1342
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
928
1343
|
var SingleSelectProperty = ({
|
|
929
1344
|
overwriteTranslation,
|
|
930
1345
|
value,
|
|
@@ -933,11 +1348,12 @@ var SingleSelectProperty = ({
|
|
|
933
1348
|
readOnly = false,
|
|
934
1349
|
softRequired,
|
|
935
1350
|
onRemove,
|
|
1351
|
+
onAddNew,
|
|
936
1352
|
...selectProps
|
|
937
1353
|
}) => {
|
|
938
1354
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
939
1355
|
const hasValue = value !== void 0;
|
|
940
|
-
return /* @__PURE__ */ (0,
|
|
1356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
941
1357
|
PropertyBase,
|
|
942
1358
|
{
|
|
943
1359
|
name,
|
|
@@ -945,22 +1361,45 @@ var SingleSelectProperty = ({
|
|
|
945
1361
|
readOnly,
|
|
946
1362
|
softRequired,
|
|
947
1363
|
hasValue,
|
|
948
|
-
icon: /* @__PURE__ */ (0,
|
|
949
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0,
|
|
950
|
-
|
|
1364
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.List, { size: 24 }),
|
|
1365
|
+
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1366
|
+
Select,
|
|
951
1367
|
{
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1368
|
+
...selectProps,
|
|
1369
|
+
value,
|
|
1370
|
+
options,
|
|
1371
|
+
disabled: readOnly,
|
|
1372
|
+
className: (0, import_clsx10.default)("w-full"),
|
|
1373
|
+
hintText: `${translation("select")}...`,
|
|
1374
|
+
searchOptions: {
|
|
1375
|
+
sortingFunction: (a, b) => a.value.localeCompare(b.value),
|
|
1376
|
+
...selectProps?.searchOptions
|
|
1377
|
+
},
|
|
1378
|
+
additionalItems: ({ close, search }) => {
|
|
1379
|
+
if (!onAddNew && !search.trim()) {
|
|
1380
|
+
return void 0;
|
|
1381
|
+
}
|
|
1382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1383
|
+
SelectTile,
|
|
1384
|
+
{
|
|
1385
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Plus, {}),
|
|
1386
|
+
title: { value: `${translation("add")} ${search.trim()}` },
|
|
1387
|
+
onClick: () => {
|
|
1388
|
+
onAddNew(search);
|
|
1389
|
+
close();
|
|
1390
|
+
},
|
|
1391
|
+
disabled: options.some((value2) => value2.value === search.trim())
|
|
1392
|
+
}
|
|
1393
|
+
);
|
|
1394
|
+
},
|
|
1395
|
+
triggerClassName: (0, import_clsx10.default)(
|
|
1396
|
+
"!border-none",
|
|
955
1397
|
{
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
options,
|
|
959
|
-
isDisabled: readOnly,
|
|
960
|
-
className: (0, import_clsx8.default)("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
961
|
-
hintText: `${translation("select")}...`
|
|
1398
|
+
"!bg-warning !text-surface-warning": softRequired2 && !hasValue,
|
|
1399
|
+
"!bg-property-title-background": !softRequired2 || hasValue
|
|
962
1400
|
}
|
|
963
|
-
)
|
|
1401
|
+
),
|
|
1402
|
+
hintTextClassName: softRequired2 && !hasValue ? "text-surface-warning" : void 0
|
|
964
1403
|
}
|
|
965
1404
|
)
|
|
966
1405
|
}
|