@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/components/properties/SelectProperty.tsx
|
|
2
|
-
import { List } from "lucide-react";
|
|
3
|
-
import
|
|
2
|
+
import { List, Plus } from "lucide-react";
|
|
3
|
+
import clsx10 from "clsx";
|
|
4
4
|
|
|
5
5
|
// src/localization/LanguageProvider.tsx
|
|
6
6
|
import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -94,6 +94,7 @@ import { AlertTriangle } from "lucide-react";
|
|
|
94
94
|
import clsx2 from "clsx";
|
|
95
95
|
|
|
96
96
|
// src/components/user-action/Button.tsx
|
|
97
|
+
import { forwardRef } from "react";
|
|
97
98
|
import clsx from "clsx";
|
|
98
99
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
99
100
|
var ButtonColorUtil = {
|
|
@@ -119,6 +120,76 @@ var ButtonUtil = {
|
|
|
119
120
|
paddingMapping,
|
|
120
121
|
iconPaddingMapping
|
|
121
122
|
};
|
|
123
|
+
var SolidButton = forwardRef(function SolidButton2({
|
|
124
|
+
children,
|
|
125
|
+
disabled = false,
|
|
126
|
+
color = "primary",
|
|
127
|
+
size = "medium",
|
|
128
|
+
startIcon,
|
|
129
|
+
endIcon,
|
|
130
|
+
onClick,
|
|
131
|
+
className,
|
|
132
|
+
...restProps
|
|
133
|
+
}, ref) {
|
|
134
|
+
const colorClasses = {
|
|
135
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
136
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
137
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
138
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
139
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
140
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
141
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
142
|
+
}[color];
|
|
143
|
+
const iconColorClasses = {
|
|
144
|
+
primary: "text-button-solid-primary-icon",
|
|
145
|
+
secondary: "text-button-solid-secondary-icon",
|
|
146
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
147
|
+
positive: "text-button-solid-positive-icon",
|
|
148
|
+
warning: "text-button-solid-warning-icon",
|
|
149
|
+
negative: "text-button-solid-negative-icon",
|
|
150
|
+
neutral: "text-button-solid-neutral-icon"
|
|
151
|
+
}[color];
|
|
152
|
+
return /* @__PURE__ */ jsxs(
|
|
153
|
+
"button",
|
|
154
|
+
{
|
|
155
|
+
ref,
|
|
156
|
+
onClick,
|
|
157
|
+
disabled,
|
|
158
|
+
className: clsx(
|
|
159
|
+
{
|
|
160
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
161
|
+
[clsx(colorClasses, "hover:brightness-90")]: !disabled
|
|
162
|
+
},
|
|
163
|
+
ButtonUtil.paddingMapping[size],
|
|
164
|
+
className
|
|
165
|
+
),
|
|
166
|
+
...restProps,
|
|
167
|
+
children: [
|
|
168
|
+
startIcon && /* @__PURE__ */ jsx2(
|
|
169
|
+
"span",
|
|
170
|
+
{
|
|
171
|
+
className: clsx({
|
|
172
|
+
[iconColorClasses]: !disabled,
|
|
173
|
+
[`text-disabled-icon`]: disabled
|
|
174
|
+
}),
|
|
175
|
+
children: startIcon
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
children,
|
|
179
|
+
endIcon && /* @__PURE__ */ jsx2(
|
|
180
|
+
"span",
|
|
181
|
+
{
|
|
182
|
+
className: clsx({
|
|
183
|
+
[iconColorClasses]: !disabled,
|
|
184
|
+
[`text-disabled-icon`]: disabled
|
|
185
|
+
}),
|
|
186
|
+
children: endIcon
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
});
|
|
122
193
|
var TextButton = ({
|
|
123
194
|
children,
|
|
124
195
|
disabled = false,
|
|
@@ -143,8 +214,8 @@ var TextButton = ({
|
|
|
143
214
|
return /* @__PURE__ */ jsxs(
|
|
144
215
|
"button",
|
|
145
216
|
{
|
|
146
|
-
onClick
|
|
147
|
-
disabled
|
|
217
|
+
onClick,
|
|
218
|
+
disabled,
|
|
148
219
|
className: clsx(
|
|
149
220
|
{
|
|
150
221
|
"text-disabled-text cursor-not-allowed": disabled,
|
|
@@ -185,7 +256,6 @@ var IconButton = ({
|
|
|
185
256
|
disabled = false,
|
|
186
257
|
color = "primary",
|
|
187
258
|
size = "medium",
|
|
188
|
-
onClick,
|
|
189
259
|
className,
|
|
190
260
|
...restProps
|
|
191
261
|
}) => {
|
|
@@ -202,8 +272,7 @@ var IconButton = ({
|
|
|
202
272
|
return /* @__PURE__ */ jsx2(
|
|
203
273
|
"button",
|
|
204
274
|
{
|
|
205
|
-
|
|
206
|
-
disabled: disabled || onClick === void 0,
|
|
275
|
+
disabled,
|
|
207
276
|
className: clsx(
|
|
208
277
|
{
|
|
209
278
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
@@ -223,6 +292,7 @@ var IconButton = ({
|
|
|
223
292
|
// src/localization/defaults/form.ts
|
|
224
293
|
var formTranslation = {
|
|
225
294
|
en: {
|
|
295
|
+
add: "Add",
|
|
226
296
|
all: "All",
|
|
227
297
|
apply: "Apply",
|
|
228
298
|
back: "Back",
|
|
@@ -235,6 +305,7 @@ var formTranslation = {
|
|
|
235
305
|
confirm: "Confirm",
|
|
236
306
|
copy: "Copy",
|
|
237
307
|
copied: "Copied",
|
|
308
|
+
create: "Create",
|
|
238
309
|
decline: "Decline",
|
|
239
310
|
delete: "Delete",
|
|
240
311
|
discard: "Discard",
|
|
@@ -277,6 +348,7 @@ var formTranslation = {
|
|
|
277
348
|
yes: "Yes"
|
|
278
349
|
},
|
|
279
350
|
de: {
|
|
351
|
+
add: "Hinzuf\xFCgen",
|
|
280
352
|
all: "Alle",
|
|
281
353
|
apply: "Anwenden",
|
|
282
354
|
back: "Zur\xFCck",
|
|
@@ -289,6 +361,7 @@ var formTranslation = {
|
|
|
289
361
|
confirm: "Best\xE4tigen",
|
|
290
362
|
copy: "Kopieren",
|
|
291
363
|
copied: "Kopiert",
|
|
364
|
+
create: "Erstellen",
|
|
292
365
|
decline: "Ablehnen",
|
|
293
366
|
delete: "L\xF6schen",
|
|
294
367
|
discard: "Verwerfen",
|
|
@@ -347,36 +420,44 @@ var PropertyBase = ({
|
|
|
347
420
|
}) => {
|
|
348
421
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
349
422
|
const requiredAndNoValue = softRequired && !hasValue;
|
|
350
|
-
return /* @__PURE__ */ jsxs2("div", { className: clsx2("row
|
|
423
|
+
return /* @__PURE__ */ jsxs2("div", { className: clsx2("flex-row-0 group", className), children: [
|
|
351
424
|
/* @__PURE__ */ jsxs2(
|
|
352
425
|
"div",
|
|
353
426
|
{
|
|
354
|
-
className: clsx2(
|
|
355
|
-
"
|
|
356
|
-
|
|
357
|
-
|
|
427
|
+
className: clsx2(
|
|
428
|
+
"flex-row-2 max-w-48 min-w-48 px-3 py-2 items-center rounded-l-xl border-2 border-r-0",
|
|
429
|
+
{
|
|
430
|
+
"bg-property-title-background text-property-title-text group-hover:border-primary": !requiredAndNoValue,
|
|
431
|
+
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
432
|
+
},
|
|
433
|
+
className
|
|
434
|
+
),
|
|
358
435
|
children: [
|
|
359
|
-
icon,
|
|
360
|
-
name
|
|
436
|
+
/* @__PURE__ */ jsx3("div", { className: "max-w-6 min-w-6 text-text-default", children: icon }),
|
|
437
|
+
/* @__PURE__ */ jsx3("span", { className: "font-semibold", children: name })
|
|
361
438
|
]
|
|
362
439
|
}
|
|
363
440
|
),
|
|
364
441
|
/* @__PURE__ */ jsxs2(
|
|
365
442
|
"div",
|
|
366
443
|
{
|
|
367
|
-
className: clsx2(
|
|
368
|
-
"
|
|
369
|
-
|
|
370
|
-
|
|
444
|
+
className: clsx2(
|
|
445
|
+
"flex-row-2 grow px-3 py-2 justify-between items-center rounded-r-xl border-2 border-l-0 min-h-15",
|
|
446
|
+
{
|
|
447
|
+
"bg-surface group-hover:border-primary": !requiredAndNoValue,
|
|
448
|
+
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
449
|
+
},
|
|
450
|
+
className
|
|
451
|
+
),
|
|
371
452
|
children: [
|
|
372
453
|
input({ softRequired, hasValue }),
|
|
373
|
-
requiredAndNoValue && /* @__PURE__ */ jsx3("div", { className: "text-warning
|
|
374
|
-
onRemove && /* @__PURE__ */ jsx3(
|
|
454
|
+
requiredAndNoValue && /* @__PURE__ */ jsx3("div", { className: "text-warning", children: /* @__PURE__ */ jsx3(AlertTriangle, { size: 24 }) }),
|
|
455
|
+
onRemove && hasValue && /* @__PURE__ */ jsx3(
|
|
375
456
|
TextButton,
|
|
376
457
|
{
|
|
377
458
|
onClick: onRemove,
|
|
378
459
|
color: "negative",
|
|
379
|
-
className: clsx2("
|
|
460
|
+
className: clsx2("items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
380
461
|
disabled: !hasValue || readOnly,
|
|
381
462
|
children: translation("remove")
|
|
382
463
|
}
|
|
@@ -388,9 +469,9 @@ var PropertyBase = ({
|
|
|
388
469
|
};
|
|
389
470
|
|
|
390
471
|
// src/components/user-action/Select.tsx
|
|
391
|
-
import {
|
|
392
|
-
import { useEffect as
|
|
393
|
-
import
|
|
472
|
+
import { useCallback as useCallback5 } from "react";
|
|
473
|
+
import { useEffect as useEffect11, useState as useState9 } from "react";
|
|
474
|
+
import clsx9 from "clsx";
|
|
394
475
|
|
|
395
476
|
// src/components/user-action/Label.tsx
|
|
396
477
|
import clsx3 from "clsx";
|
|
@@ -410,22 +491,388 @@ var Label = ({
|
|
|
410
491
|
return /* @__PURE__ */ jsx4("label", { ...props, className: clsx3(styleMapping[labelType], className), children: children ? children : name });
|
|
411
492
|
};
|
|
412
493
|
|
|
413
|
-
// src/components/layout-and-navigation/
|
|
414
|
-
import
|
|
494
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
495
|
+
import clsx4 from "clsx";
|
|
496
|
+
import { Check } from "lucide-react";
|
|
497
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
498
|
+
var Tile = ({
|
|
499
|
+
title,
|
|
500
|
+
description,
|
|
501
|
+
onClick,
|
|
502
|
+
isSelected = false,
|
|
503
|
+
disabled = false,
|
|
504
|
+
prefix,
|
|
505
|
+
suffix,
|
|
506
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
507
|
+
selectedClassName = " bg-primary/20",
|
|
508
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
509
|
+
className
|
|
510
|
+
}) => {
|
|
511
|
+
return /* @__PURE__ */ jsxs3(
|
|
512
|
+
"div",
|
|
513
|
+
{
|
|
514
|
+
className: clsx4(
|
|
515
|
+
"flex-row-2 w-full items-center",
|
|
516
|
+
{
|
|
517
|
+
[normalClassName]: !!onClick && !disabled,
|
|
518
|
+
[selectedClassName]: isSelected && !disabled,
|
|
519
|
+
[disabledClassName]: disabled
|
|
520
|
+
},
|
|
521
|
+
className
|
|
522
|
+
),
|
|
523
|
+
onClick: disabled ? void 0 : onClick,
|
|
524
|
+
children: [
|
|
525
|
+
prefix,
|
|
526
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex-col-0 w-full", children: [
|
|
527
|
+
/* @__PURE__ */ jsx5("h4", { className: clsx4(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
528
|
+
!!description && /* @__PURE__ */ jsx5("span", { className: clsx4(description.className ?? "textstyle-description"), children: description.value })
|
|
529
|
+
] }),
|
|
530
|
+
suffix ?? (isSelected ? /* @__PURE__ */ jsx5(Check, { size: 24 }) : void 0)
|
|
531
|
+
]
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
537
|
+
import { forwardRef as forwardRef2, useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
|
|
538
|
+
import { ChevronDown } from "lucide-react";
|
|
415
539
|
import clsx5 from "clsx";
|
|
416
540
|
|
|
541
|
+
// src/util/noop.ts
|
|
542
|
+
var noop = () => void 0;
|
|
543
|
+
|
|
544
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
545
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
546
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
547
|
+
return /* @__PURE__ */ jsx6(
|
|
548
|
+
ChevronDown,
|
|
549
|
+
{
|
|
550
|
+
className: clsx5(
|
|
551
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
|
|
552
|
+
{ "rotate-180": isExpanded },
|
|
553
|
+
className
|
|
554
|
+
)
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
};
|
|
558
|
+
var Expandable = forwardRef2(function Expandable2({
|
|
559
|
+
children,
|
|
560
|
+
label,
|
|
561
|
+
icon,
|
|
562
|
+
isExpanded = false,
|
|
563
|
+
onChange = noop,
|
|
564
|
+
clickOnlyOnHeader = true,
|
|
565
|
+
disabled = false,
|
|
566
|
+
className,
|
|
567
|
+
headerClassName,
|
|
568
|
+
contentClassName
|
|
569
|
+
}, ref) {
|
|
570
|
+
const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx6(ExpansionIcon, { isExpanded: expanded }), []);
|
|
571
|
+
icon ??= defaultIcon;
|
|
572
|
+
return /* @__PURE__ */ jsxs4(
|
|
573
|
+
"div",
|
|
574
|
+
{
|
|
575
|
+
ref,
|
|
576
|
+
className: clsx5("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
577
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
578
|
+
children: [
|
|
579
|
+
/* @__PURE__ */ jsxs4(
|
|
580
|
+
"div",
|
|
581
|
+
{
|
|
582
|
+
className: clsx5(
|
|
583
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
584
|
+
{
|
|
585
|
+
"group-hover:brightness-97": !isExpanded,
|
|
586
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
587
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
588
|
+
},
|
|
589
|
+
headerClassName
|
|
590
|
+
),
|
|
591
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
592
|
+
children: [
|
|
593
|
+
label,
|
|
594
|
+
icon(isExpanded)
|
|
595
|
+
]
|
|
596
|
+
}
|
|
597
|
+
),
|
|
598
|
+
/* @__PURE__ */ jsx6(
|
|
599
|
+
"div",
|
|
600
|
+
{
|
|
601
|
+
className: clsx5(
|
|
602
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
603
|
+
{
|
|
604
|
+
"max-h-96 opacity-100 pb-2": isExpanded,
|
|
605
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
606
|
+
},
|
|
607
|
+
contentClassName
|
|
608
|
+
),
|
|
609
|
+
children
|
|
610
|
+
}
|
|
611
|
+
)
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
});
|
|
616
|
+
var ExpandableUncontrolled = forwardRef2(function ExpandableUncontrolled2({
|
|
617
|
+
isExpanded,
|
|
618
|
+
onChange = noop,
|
|
619
|
+
...props
|
|
620
|
+
}, ref) {
|
|
621
|
+
const [usedIsExpanded, setUsedIsExpanded] = useState3(isExpanded);
|
|
622
|
+
useEffect3(() => {
|
|
623
|
+
setUsedIsExpanded(isExpanded);
|
|
624
|
+
}, [isExpanded]);
|
|
625
|
+
return /* @__PURE__ */ jsx6(
|
|
626
|
+
Expandable,
|
|
627
|
+
{
|
|
628
|
+
...props,
|
|
629
|
+
ref,
|
|
630
|
+
isExpanded: usedIsExpanded,
|
|
631
|
+
onChange: (value) => {
|
|
632
|
+
onChange(value);
|
|
633
|
+
setUsedIsExpanded(value);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
);
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
// src/components/user-action/Menu.tsx
|
|
640
|
+
import {
|
|
641
|
+
useEffect as useEffect6,
|
|
642
|
+
useRef,
|
|
643
|
+
useState as useState5
|
|
644
|
+
} from "react";
|
|
645
|
+
import clsx6 from "clsx";
|
|
646
|
+
|
|
647
|
+
// src/hooks/useOutsideClick.ts
|
|
648
|
+
import { useEffect as useEffect4 } from "react";
|
|
649
|
+
var useOutsideClick = (refs, handler) => {
|
|
650
|
+
useEffect4(() => {
|
|
651
|
+
const listener = (event) => {
|
|
652
|
+
if (event.target === null) return;
|
|
653
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
handler();
|
|
657
|
+
};
|
|
658
|
+
document.addEventListener("mousedown", listener);
|
|
659
|
+
document.addEventListener("touchstart", listener);
|
|
660
|
+
return () => {
|
|
661
|
+
document.removeEventListener("mousedown", listener);
|
|
662
|
+
document.removeEventListener("touchstart", listener);
|
|
663
|
+
};
|
|
664
|
+
}, [refs, handler]);
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
// src/hooks/useHoverState.ts
|
|
668
|
+
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
669
|
+
var defaultUseHoverStateProps = {
|
|
670
|
+
closingDelay: 200,
|
|
671
|
+
isDisabled: false
|
|
672
|
+
};
|
|
673
|
+
var useHoverState = (props = void 0) => {
|
|
674
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
675
|
+
const [isHovered, setIsHovered] = useState4(false);
|
|
676
|
+
const [timer, setTimer] = useState4();
|
|
677
|
+
const onMouseEnter = () => {
|
|
678
|
+
if (isDisabled) {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
clearTimeout(timer);
|
|
682
|
+
setIsHovered(true);
|
|
683
|
+
};
|
|
684
|
+
const onMouseLeave = () => {
|
|
685
|
+
if (isDisabled) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
setTimer(setTimeout(() => {
|
|
689
|
+
setIsHovered(false);
|
|
690
|
+
}, closingDelay));
|
|
691
|
+
};
|
|
692
|
+
useEffect5(() => {
|
|
693
|
+
if (timer) {
|
|
694
|
+
return () => {
|
|
695
|
+
clearTimeout(timer);
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
useEffect5(() => {
|
|
700
|
+
if (timer) {
|
|
701
|
+
clearTimeout(timer);
|
|
702
|
+
}
|
|
703
|
+
}, [isDisabled]);
|
|
704
|
+
return {
|
|
705
|
+
isHovered,
|
|
706
|
+
setIsHovered,
|
|
707
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
708
|
+
};
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
712
|
+
var resolve = (children, bag) => {
|
|
713
|
+
if (typeof children === "function") {
|
|
714
|
+
return children(bag);
|
|
715
|
+
}
|
|
716
|
+
return children ?? void 0;
|
|
717
|
+
};
|
|
718
|
+
var BagFunctionUtil = {
|
|
719
|
+
resolve
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
// src/hooks/usePopoverPosition.ts
|
|
723
|
+
var defaultPopoverPositionOptions = {
|
|
724
|
+
edgePadding: 16,
|
|
725
|
+
outerGap: 4,
|
|
726
|
+
horizontalAlignment: "leftInside",
|
|
727
|
+
verticalAlignment: "bottomOutside",
|
|
728
|
+
disabled: false
|
|
729
|
+
};
|
|
730
|
+
var usePopoverPosition = (trigger, options) => {
|
|
731
|
+
const {
|
|
732
|
+
edgePadding,
|
|
733
|
+
outerGap,
|
|
734
|
+
verticalAlignment,
|
|
735
|
+
horizontalAlignment,
|
|
736
|
+
disabled
|
|
737
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
738
|
+
if (disabled || !trigger) {
|
|
739
|
+
return {};
|
|
740
|
+
}
|
|
741
|
+
const left = {
|
|
742
|
+
leftOutside: trigger.left - outerGap,
|
|
743
|
+
leftInside: trigger.left,
|
|
744
|
+
rightOutside: trigger.right + outerGap,
|
|
745
|
+
rightInside: trigger.right,
|
|
746
|
+
center: trigger.left + trigger.width / 2
|
|
747
|
+
}[horizontalAlignment];
|
|
748
|
+
const top = {
|
|
749
|
+
topOutside: trigger.top - outerGap,
|
|
750
|
+
topInside: trigger.top,
|
|
751
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
752
|
+
bottomInside: trigger.bottom,
|
|
753
|
+
center: trigger.top + trigger.height / 2
|
|
754
|
+
}[verticalAlignment];
|
|
755
|
+
const translateX = {
|
|
756
|
+
leftOutside: "-100%",
|
|
757
|
+
leftInside: void 0,
|
|
758
|
+
rightOutside: void 0,
|
|
759
|
+
rightInside: "-100%",
|
|
760
|
+
center: "-50%"
|
|
761
|
+
}[horizontalAlignment];
|
|
762
|
+
const translateY = {
|
|
763
|
+
topOutside: "-100%",
|
|
764
|
+
topInside: void 0,
|
|
765
|
+
bottomOutside: void 0,
|
|
766
|
+
bottomInside: "-100%",
|
|
767
|
+
center: "-50%"
|
|
768
|
+
}[verticalAlignment];
|
|
769
|
+
return {
|
|
770
|
+
left: Math.max(left, edgePadding),
|
|
771
|
+
top: Math.max(top, edgePadding),
|
|
772
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
773
|
+
};
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
// src/components/user-action/Menu.tsx
|
|
777
|
+
import { createPortal } from "react-dom";
|
|
778
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
779
|
+
function getScrollableParents(element) {
|
|
780
|
+
const scrollables = [];
|
|
781
|
+
let parent = element.parentElement;
|
|
782
|
+
while (parent) {
|
|
783
|
+
scrollables.push(parent);
|
|
784
|
+
parent = parent.parentElement;
|
|
785
|
+
}
|
|
786
|
+
return scrollables;
|
|
787
|
+
}
|
|
788
|
+
var Menu = ({
|
|
789
|
+
trigger,
|
|
790
|
+
children,
|
|
791
|
+
alignmentHorizontal = "leftInside",
|
|
792
|
+
alignmentVertical = "bottomOutside",
|
|
793
|
+
showOnHover = false,
|
|
794
|
+
disabled = false,
|
|
795
|
+
menuClassName = ""
|
|
796
|
+
}) => {
|
|
797
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
798
|
+
const triggerRef = useRef(null);
|
|
799
|
+
const menuRef = useRef(null);
|
|
800
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
801
|
+
const [isHidden, setIsHidden] = useState5(true);
|
|
802
|
+
const bag = {
|
|
803
|
+
isOpen,
|
|
804
|
+
close: () => setIsOpen(false),
|
|
805
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
806
|
+
disabled
|
|
807
|
+
};
|
|
808
|
+
const menuPosition = usePopoverPosition(
|
|
809
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
810
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
811
|
+
);
|
|
812
|
+
useEffect6(() => {
|
|
813
|
+
if (!isOpen) return;
|
|
814
|
+
const triggerEl = triggerRef.current;
|
|
815
|
+
if (!triggerEl) return;
|
|
816
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
817
|
+
const close = () => setIsOpen(false);
|
|
818
|
+
scrollableParents.forEach((parent) => {
|
|
819
|
+
parent.addEventListener("scroll", close);
|
|
820
|
+
});
|
|
821
|
+
window.addEventListener("resize", close);
|
|
822
|
+
return () => {
|
|
823
|
+
scrollableParents.forEach((parent) => {
|
|
824
|
+
parent.removeEventListener("scroll", close);
|
|
825
|
+
});
|
|
826
|
+
window.removeEventListener("resize", close);
|
|
827
|
+
};
|
|
828
|
+
}, [isOpen, setIsOpen]);
|
|
829
|
+
useEffect6(() => {
|
|
830
|
+
if (isOpen) {
|
|
831
|
+
setIsHidden(false);
|
|
832
|
+
}
|
|
833
|
+
}, [isOpen]);
|
|
834
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
835
|
+
trigger(bag, triggerRef),
|
|
836
|
+
createPortal(/* @__PURE__ */ jsx7(
|
|
837
|
+
"div",
|
|
838
|
+
{
|
|
839
|
+
ref: menuRef,
|
|
840
|
+
onClick: (e) => e.stopPropagation(),
|
|
841
|
+
className: clsx6(
|
|
842
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
843
|
+
{
|
|
844
|
+
"animate-pop-in": isOpen,
|
|
845
|
+
"animate-pop-out": !isOpen,
|
|
846
|
+
"hidden": isHidden
|
|
847
|
+
},
|
|
848
|
+
menuClassName
|
|
849
|
+
),
|
|
850
|
+
onAnimationEnd: () => {
|
|
851
|
+
if (!isOpen) {
|
|
852
|
+
setIsHidden(true);
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
style: {
|
|
856
|
+
...menuPosition
|
|
857
|
+
},
|
|
858
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
859
|
+
}
|
|
860
|
+
), document.body)
|
|
861
|
+
] });
|
|
862
|
+
};
|
|
863
|
+
|
|
417
864
|
// src/components/user-action/Input.tsx
|
|
418
|
-
import { forwardRef, useEffect as
|
|
419
|
-
import
|
|
865
|
+
import { forwardRef as forwardRef3, useEffect as useEffect9, useImperativeHandle, useRef as useRef2, useState as useState7 } from "react";
|
|
866
|
+
import clsx7 from "clsx";
|
|
420
867
|
|
|
421
868
|
// src/hooks/useDelay.ts
|
|
422
|
-
import { useEffect as
|
|
869
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
423
870
|
var defaultOptions = {
|
|
424
871
|
delay: 3e3,
|
|
425
872
|
disabled: false
|
|
426
873
|
};
|
|
427
874
|
function useDelay(options) {
|
|
428
|
-
const [timer, setTimer] =
|
|
875
|
+
const [timer, setTimer] = useState6(void 0);
|
|
429
876
|
const { delay, disabled } = {
|
|
430
877
|
...defaultOptions,
|
|
431
878
|
...options
|
|
@@ -444,12 +891,12 @@ function useDelay(options) {
|
|
|
444
891
|
setTimer(void 0);
|
|
445
892
|
}, delay));
|
|
446
893
|
};
|
|
447
|
-
|
|
894
|
+
useEffect7(() => {
|
|
448
895
|
return () => {
|
|
449
896
|
clearTimeout(timer);
|
|
450
897
|
};
|
|
451
898
|
}, [timer]);
|
|
452
|
-
|
|
899
|
+
useEffect7(() => {
|
|
453
900
|
if (disabled) {
|
|
454
901
|
clearTimeout(timer);
|
|
455
902
|
setTimer(void 0);
|
|
@@ -458,13 +905,10 @@ function useDelay(options) {
|
|
|
458
905
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
459
906
|
}
|
|
460
907
|
|
|
461
|
-
// src/util/noop.ts
|
|
462
|
-
var noop = () => void 0;
|
|
463
|
-
|
|
464
908
|
// src/hooks/useFocusManagement.ts
|
|
465
|
-
import { useCallback as
|
|
909
|
+
import { useCallback as useCallback3 } from "react";
|
|
466
910
|
function useFocusManagement() {
|
|
467
|
-
const getFocusableElements =
|
|
911
|
+
const getFocusableElements = useCallback3(() => {
|
|
468
912
|
return Array.from(
|
|
469
913
|
document.querySelectorAll(
|
|
470
914
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -473,7 +917,7 @@ function useFocusManagement() {
|
|
|
473
917
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
474
918
|
);
|
|
475
919
|
}, []);
|
|
476
|
-
const getNextFocusElement =
|
|
920
|
+
const getNextFocusElement = useCallback3(() => {
|
|
477
921
|
const elements = getFocusableElements();
|
|
478
922
|
if (elements.length === 0) {
|
|
479
923
|
return void 0;
|
|
@@ -485,11 +929,11 @@ function useFocusManagement() {
|
|
|
485
929
|
}
|
|
486
930
|
return nextElement;
|
|
487
931
|
}, [getFocusableElements]);
|
|
488
|
-
const focusNext =
|
|
932
|
+
const focusNext = useCallback3(() => {
|
|
489
933
|
const nextElement = getNextFocusElement();
|
|
490
934
|
nextElement?.focus();
|
|
491
935
|
}, [getNextFocusElement]);
|
|
492
|
-
const getPreviousFocusElement =
|
|
936
|
+
const getPreviousFocusElement = useCallback3(() => {
|
|
493
937
|
const elements = getFocusableElements();
|
|
494
938
|
if (elements.length === 0) {
|
|
495
939
|
return void 0;
|
|
@@ -505,7 +949,7 @@ function useFocusManagement() {
|
|
|
505
949
|
}
|
|
506
950
|
return previousElement;
|
|
507
951
|
}, [getFocusableElements]);
|
|
508
|
-
const focusPrevious =
|
|
952
|
+
const focusPrevious = useCallback3(() => {
|
|
509
953
|
const previousElement = getPreviousFocusElement();
|
|
510
954
|
if (previousElement) previousElement.focus();
|
|
511
955
|
}, [getPreviousFocusElement]);
|
|
@@ -519,10 +963,10 @@ function useFocusManagement() {
|
|
|
519
963
|
}
|
|
520
964
|
|
|
521
965
|
// src/hooks/useFocusOnceVisible.ts
|
|
522
|
-
import React, { useEffect as
|
|
966
|
+
import React, { useEffect as useEffect8 } from "react";
|
|
523
967
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
524
968
|
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
525
|
-
|
|
969
|
+
useEffect8(() => {
|
|
526
970
|
if (disable || hasUsedFocus) {
|
|
527
971
|
return;
|
|
528
972
|
}
|
|
@@ -542,9 +986,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
542
986
|
};
|
|
543
987
|
|
|
544
988
|
// src/components/user-action/Input.tsx
|
|
545
|
-
import { jsx as
|
|
989
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
546
990
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
547
|
-
return
|
|
991
|
+
return clsx7(
|
|
548
992
|
"px-2 py-1.5 rounded-md border-2",
|
|
549
993
|
{
|
|
550
994
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -558,7 +1002,7 @@ var defaultEditCompleteOptions = {
|
|
|
558
1002
|
afterDelay: true,
|
|
559
1003
|
delay: 2500
|
|
560
1004
|
};
|
|
561
|
-
var Input =
|
|
1005
|
+
var Input = forwardRef3(function Input2({
|
|
562
1006
|
id,
|
|
563
1007
|
type = "text",
|
|
564
1008
|
value,
|
|
@@ -581,7 +1025,7 @@ var Input = forwardRef(function Input2({
|
|
|
581
1025
|
restartTimer,
|
|
582
1026
|
clearTimer
|
|
583
1027
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
584
|
-
const innerRef =
|
|
1028
|
+
const innerRef = useRef2(null);
|
|
585
1029
|
const { focusNext } = useFocusManagement();
|
|
586
1030
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
587
1031
|
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
@@ -592,9 +1036,9 @@ var Input = forwardRef(function Input2({
|
|
|
592
1036
|
focusNext();
|
|
593
1037
|
}
|
|
594
1038
|
};
|
|
595
|
-
return /* @__PURE__ */
|
|
596
|
-
label && /* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
1039
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7({ "w-full": expanded }, containerClassName), children: [
|
|
1040
|
+
label && /* @__PURE__ */ jsx8(Label, { ...label, htmlFor: id, className: clsx7("mb-1", label.className) }),
|
|
1041
|
+
/* @__PURE__ */ jsx8(
|
|
598
1042
|
"input",
|
|
599
1043
|
{
|
|
600
1044
|
...restProps,
|
|
@@ -603,7 +1047,7 @@ var Input = forwardRef(function Input2({
|
|
|
603
1047
|
id,
|
|
604
1048
|
type,
|
|
605
1049
|
disabled,
|
|
606
|
-
className:
|
|
1050
|
+
className: clsx7(getInputClassName({ disabled }), className),
|
|
607
1051
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
608
1052
|
onBlur: (event) => {
|
|
609
1053
|
onBlur?.(event);
|
|
@@ -633,7 +1077,7 @@ var Input = forwardRef(function Input2({
|
|
|
633
1077
|
)
|
|
634
1078
|
] });
|
|
635
1079
|
});
|
|
636
|
-
var FormInput =
|
|
1080
|
+
var FormInput = forwardRef3(function FormInput2({
|
|
637
1081
|
id,
|
|
638
1082
|
labelText,
|
|
639
1083
|
errorText,
|
|
@@ -645,40 +1089,64 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
645
1089
|
disabled,
|
|
646
1090
|
...restProps
|
|
647
1091
|
}, ref) {
|
|
648
|
-
const input = /* @__PURE__ */
|
|
1092
|
+
const input = /* @__PURE__ */ jsx8(
|
|
649
1093
|
"input",
|
|
650
1094
|
{
|
|
651
1095
|
...restProps,
|
|
652
1096
|
ref,
|
|
653
1097
|
id,
|
|
654
1098
|
disabled,
|
|
655
|
-
className:
|
|
1099
|
+
className: clsx7(
|
|
656
1100
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
657
1101
|
className
|
|
658
1102
|
)
|
|
659
1103
|
}
|
|
660
1104
|
);
|
|
661
|
-
return /* @__PURE__ */
|
|
662
|
-
labelText && /* @__PURE__ */
|
|
1105
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7("flex flex-col gap-y-1", containerClassName), children: [
|
|
1106
|
+
labelText && /* @__PURE__ */ jsxs6("label", { htmlFor: id, className: clsx7("textstyle-label-md", labelClassName), children: [
|
|
663
1107
|
labelText,
|
|
664
|
-
required && /* @__PURE__ */
|
|
1108
|
+
required && /* @__PURE__ */ jsx8("span", { className: "text-primary font-bold", children: "*" })
|
|
665
1109
|
] }),
|
|
666
1110
|
input,
|
|
667
|
-
errorText && /* @__PURE__ */
|
|
1111
|
+
errorText && /* @__PURE__ */ jsx8("label", { htmlFor: id, className: clsx7("text-negative", errorClassName), children: errorText })
|
|
668
1112
|
] });
|
|
669
1113
|
});
|
|
670
1114
|
|
|
1115
|
+
// src/components/user-action/SearchBar.tsx
|
|
1116
|
+
import { Search } from "lucide-react";
|
|
1117
|
+
import { clsx as clsx8 } from "clsx";
|
|
1118
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1119
|
+
var SearchBar = ({
|
|
1120
|
+
placeholder,
|
|
1121
|
+
onSearch,
|
|
1122
|
+
disableOnSearch,
|
|
1123
|
+
containerClassName,
|
|
1124
|
+
...inputProps
|
|
1125
|
+
}) => {
|
|
1126
|
+
const translation = useTranslation([formTranslation]);
|
|
1127
|
+
return /* @__PURE__ */ jsxs7("div", { className: clsx8("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
1128
|
+
/* @__PURE__ */ jsx9(
|
|
1129
|
+
Input,
|
|
1130
|
+
{
|
|
1131
|
+
...inputProps,
|
|
1132
|
+
placeholder: placeholder ?? translation("search")
|
|
1133
|
+
}
|
|
1134
|
+
),
|
|
1135
|
+
onSearch && /* @__PURE__ */ jsx9(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx9(Search, { className: "w-full h-full" }) })
|
|
1136
|
+
] });
|
|
1137
|
+
};
|
|
1138
|
+
|
|
671
1139
|
// src/hooks/useSearch.ts
|
|
672
|
-
import { useEffect as
|
|
1140
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
|
|
673
1141
|
|
|
674
1142
|
// src/util/simpleSearch.ts
|
|
675
|
-
var
|
|
1143
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
676
1144
|
return objects.filter((object) => {
|
|
677
1145
|
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
678
1146
|
if (!mappedSearchKeywords) {
|
|
679
1147
|
return true;
|
|
680
1148
|
}
|
|
681
|
-
return !!mappedSearchKeywords.find((value) => value.includes(
|
|
1149
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
682
1150
|
});
|
|
683
1151
|
};
|
|
684
1152
|
|
|
@@ -686,212 +1154,163 @@ var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
|
686
1154
|
var useSearch = ({
|
|
687
1155
|
list,
|
|
688
1156
|
initialSearch,
|
|
689
|
-
searchMapping
|
|
1157
|
+
searchMapping,
|
|
1158
|
+
additionalSearchTags,
|
|
1159
|
+
isSearchInstant = true,
|
|
1160
|
+
sortingFunction,
|
|
1161
|
+
filter,
|
|
1162
|
+
disabled = false
|
|
690
1163
|
}) => {
|
|
691
|
-
const [
|
|
692
|
-
const [
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
1164
|
+
const [search, setSearch] = useState8(initialSearch ?? "");
|
|
1165
|
+
const [result, setResult] = useState8(list);
|
|
1166
|
+
const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1167
|
+
const updateSearch = useCallback4((newSearch) => {
|
|
1168
|
+
const usedSearch = newSearch ?? search;
|
|
1169
|
+
if (newSearch) {
|
|
1170
|
+
setSearch(search);
|
|
1171
|
+
}
|
|
1172
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1173
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1174
|
+
useEffect10(() => {
|
|
1175
|
+
if (isSearchInstant) {
|
|
1176
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1177
|
+
}
|
|
1178
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1179
|
+
const filteredResult = useMemo(() => {
|
|
1180
|
+
if (!filter) {
|
|
1181
|
+
return result;
|
|
1182
|
+
}
|
|
1183
|
+
return result.filter(filter);
|
|
1184
|
+
}, [result, filter]);
|
|
1185
|
+
const sortedAndFilteredResult = useMemo(() => {
|
|
1186
|
+
if (!sortingFunction) {
|
|
1187
|
+
return filteredResult;
|
|
1188
|
+
}
|
|
1189
|
+
return filteredResult.sort(sortingFunction);
|
|
1190
|
+
}, [filteredResult, sortingFunction]);
|
|
1191
|
+
const usedResult = useMemo(() => {
|
|
1192
|
+
if (!disabled) {
|
|
1193
|
+
return sortedAndFilteredResult;
|
|
1194
|
+
}
|
|
1195
|
+
return list;
|
|
1196
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
700
1197
|
return {
|
|
701
|
-
result,
|
|
702
|
-
hasResult:
|
|
703
|
-
allItems:
|
|
704
|
-
|
|
1198
|
+
result: usedResult,
|
|
1199
|
+
hasResult: usedResult.length > 0,
|
|
1200
|
+
allItems: list,
|
|
1201
|
+
updateSearch,
|
|
705
1202
|
search,
|
|
706
1203
|
setSearch
|
|
707
1204
|
};
|
|
708
1205
|
};
|
|
709
1206
|
|
|
710
|
-
// src/components/
|
|
711
|
-
import { jsx as
|
|
712
|
-
var
|
|
713
|
-
en: {
|
|
714
|
-
nothingFound: "Nothing found"
|
|
715
|
-
},
|
|
716
|
-
de: {
|
|
717
|
-
nothingFound: "Nichts gefunden"
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
var SearchableList = ({
|
|
721
|
-
overwriteTranslation,
|
|
722
|
-
list,
|
|
723
|
-
initialSearch = "",
|
|
724
|
-
searchMapping,
|
|
725
|
-
autoFocus,
|
|
726
|
-
minimumItemsForSearch = 6,
|
|
727
|
-
itemMapper,
|
|
1207
|
+
// src/components/user-action/Select.tsx
|
|
1208
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1209
|
+
var SelectTile = ({
|
|
728
1210
|
className,
|
|
729
|
-
|
|
730
|
-
}) => {
|
|
731
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
732
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
733
|
-
return /* @__PURE__ */ jsxs4("div", { className: clsx5("col gap-y-2", className), children: [
|
|
734
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs4("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
735
|
-
/* @__PURE__ */ jsx6(
|
|
736
|
-
Input,
|
|
737
|
-
{
|
|
738
|
-
value: search,
|
|
739
|
-
onChangeText: setSearch,
|
|
740
|
-
placeholder: translation("search"),
|
|
741
|
-
autoFocus,
|
|
742
|
-
className: "w-full"
|
|
743
|
-
}
|
|
744
|
-
),
|
|
745
|
-
/* @__PURE__ */ jsx6(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx6(Search, { className: "w-full h-full" }) })
|
|
746
|
-
] }),
|
|
747
|
-
hasResult ? /* @__PURE__ */ jsx6("div", { className: clsx5("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ jsx6("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
|
|
748
|
-
] });
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
// src/components/layout-and-navigation/Tile.tsx
|
|
752
|
-
import clsx6 from "clsx";
|
|
753
|
-
import { Check } from "lucide-react";
|
|
754
|
-
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
755
|
-
var Tile = ({
|
|
1211
|
+
disabledClassName,
|
|
756
1212
|
title,
|
|
757
|
-
|
|
758
|
-
onClick,
|
|
759
|
-
isSelected = false,
|
|
760
|
-
isDisabled = false,
|
|
761
|
-
prefix,
|
|
762
|
-
suffix,
|
|
763
|
-
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
764
|
-
selectedClassName = " bg-primary/20",
|
|
765
|
-
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
766
|
-
className
|
|
1213
|
+
...restProps
|
|
767
1214
|
}) => {
|
|
768
|
-
return /* @__PURE__ */
|
|
769
|
-
|
|
1215
|
+
return /* @__PURE__ */ jsx10(
|
|
1216
|
+
Tile,
|
|
770
1217
|
{
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
[selectedClassName]: isSelected && !isDisabled,
|
|
776
|
-
[disabledClassName]: isDisabled
|
|
777
|
-
},
|
|
778
|
-
className
|
|
779
|
-
),
|
|
780
|
-
onClick: isDisabled ? void 0 : onClick,
|
|
781
|
-
children: [
|
|
782
|
-
prefix,
|
|
783
|
-
/* @__PURE__ */ jsxs5("div", { className: "col gap-y-0 w-full", children: [
|
|
784
|
-
/* @__PURE__ */ jsx7("h4", { className: clsx6(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
785
|
-
!!description && /* @__PURE__ */ jsx7("span", { className: clsx6(description.className ?? "textstyle-description"), children: description.value })
|
|
786
|
-
] }),
|
|
787
|
-
suffix ?? (isSelected ? /* @__PURE__ */ jsx7(Check, { size: 24 }) : void 0)
|
|
788
|
-
]
|
|
1218
|
+
...restProps,
|
|
1219
|
+
className: clsx9("px-2 py-1 rounded-md", className),
|
|
1220
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1221
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
789
1222
|
}
|
|
790
1223
|
);
|
|
791
1224
|
};
|
|
792
|
-
|
|
793
|
-
// src/hooks/useOutsideClick.ts
|
|
794
|
-
import { useEffect as useEffect7 } from "react";
|
|
795
|
-
var useOutsideClick = (refs, handler) => {
|
|
796
|
-
useEffect7(() => {
|
|
797
|
-
const listener = (event) => {
|
|
798
|
-
if (event.target === null) return;
|
|
799
|
-
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
800
|
-
return;
|
|
801
|
-
}
|
|
802
|
-
handler();
|
|
803
|
-
};
|
|
804
|
-
document.addEventListener("mousedown", listener);
|
|
805
|
-
document.addEventListener("touchstart", listener);
|
|
806
|
-
return () => {
|
|
807
|
-
document.removeEventListener("mousedown", listener);
|
|
808
|
-
document.removeEventListener("touchstart", listener);
|
|
809
|
-
};
|
|
810
|
-
}, [refs, handler]);
|
|
811
|
-
};
|
|
812
|
-
|
|
813
|
-
// src/components/user-action/Select.tsx
|
|
814
|
-
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
815
1225
|
var Select = ({
|
|
816
1226
|
value,
|
|
817
1227
|
label,
|
|
818
1228
|
options,
|
|
819
1229
|
onChange,
|
|
820
1230
|
hintText = "",
|
|
821
|
-
|
|
822
|
-
|
|
1231
|
+
selectedDisplayOverwrite,
|
|
1232
|
+
searchOptions,
|
|
1233
|
+
additionalItems,
|
|
823
1234
|
className,
|
|
824
|
-
|
|
1235
|
+
triggerClassName,
|
|
1236
|
+
hintTextClassName,
|
|
1237
|
+
...menuProps
|
|
825
1238
|
}) => {
|
|
826
|
-
const triggerRef = useRef2(null);
|
|
827
|
-
const menuRef = useRef2(null);
|
|
828
|
-
const [isOpen, setIsOpen] = useState6(false);
|
|
829
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
830
1239
|
const selectedOption = options.find((option) => option.value === value);
|
|
831
1240
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
832
1241
|
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");
|
|
833
1242
|
}
|
|
834
1243
|
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
1244
|
+
const { result, search, setSearch } = useSearch({
|
|
1245
|
+
list: options,
|
|
1246
|
+
searchMapping: useCallback5((item) => item.searchTags, []),
|
|
1247
|
+
...searchOptions
|
|
1248
|
+
});
|
|
1249
|
+
return /* @__PURE__ */ jsxs8("div", { className: clsx9(className), children: [
|
|
1250
|
+
label && /* @__PURE__ */ jsx10(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx9("mb-1", label.className) }),
|
|
1251
|
+
/* @__PURE__ */ jsx10(
|
|
1252
|
+
Menu,
|
|
1253
|
+
{
|
|
1254
|
+
...menuProps,
|
|
1255
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsxs8(
|
|
1256
|
+
"button",
|
|
1257
|
+
{
|
|
1258
|
+
ref,
|
|
1259
|
+
className: clsx9(
|
|
1260
|
+
"btn-md justify-between w-full border-2",
|
|
1261
|
+
{
|
|
1262
|
+
"rounded-b-lg": !open,
|
|
1263
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1264
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1265
|
+
},
|
|
1266
|
+
triggerClassName
|
|
1267
|
+
),
|
|
1268
|
+
onClick: toggleOpen,
|
|
1269
|
+
disabled,
|
|
1270
|
+
children: [
|
|
1271
|
+
!isShowingHint && /* @__PURE__ */ jsx10("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
1272
|
+
isShowingHint && /* @__PURE__ */ jsx10("span", { className: clsx9("textstyle-description", hintTextClassName), children: hintText }),
|
|
1273
|
+
/* @__PURE__ */ jsx10(ExpansionIcon, { isExpanded: isOpen })
|
|
1274
|
+
]
|
|
1275
|
+
}
|
|
1276
|
+
),
|
|
1277
|
+
menuClassName: clsx9("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1278
|
+
children: (bag) => {
|
|
1279
|
+
const { close } = bag;
|
|
1280
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1281
|
+
!searchOptions?.disabled && /* @__PURE__ */ jsx10(
|
|
1282
|
+
SearchBar,
|
|
1283
|
+
{
|
|
1284
|
+
value: search,
|
|
1285
|
+
onChangeText: setSearch,
|
|
1286
|
+
autoFocus: true
|
|
1287
|
+
}
|
|
1288
|
+
),
|
|
1289
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1290
|
+
result.map((option, index) => /* @__PURE__ */ jsx10(
|
|
1291
|
+
SelectTile,
|
|
872
1292
|
{
|
|
873
|
-
isSelected:
|
|
874
|
-
|
|
875
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
876
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1293
|
+
isSelected: option === selectedOption,
|
|
1294
|
+
title: { value: option.label },
|
|
877
1295
|
onClick: () => {
|
|
878
1296
|
onChange(option.value);
|
|
879
|
-
|
|
1297
|
+
close();
|
|
880
1298
|
},
|
|
881
|
-
|
|
1299
|
+
disabled: option.disabled
|
|
882
1300
|
},
|
|
883
1301
|
index
|
|
884
|
-
)
|
|
885
|
-
|
|
886
|
-
|
|
1302
|
+
)),
|
|
1303
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1304
|
+
] })
|
|
1305
|
+
] });
|
|
887
1306
|
}
|
|
888
|
-
|
|
889
|
-
|
|
1307
|
+
}
|
|
1308
|
+
)
|
|
890
1309
|
] });
|
|
891
1310
|
};
|
|
892
1311
|
|
|
893
1312
|
// src/components/properties/SelectProperty.tsx
|
|
894
|
-
import { jsx as
|
|
1313
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
895
1314
|
var SingleSelectProperty = ({
|
|
896
1315
|
overwriteTranslation,
|
|
897
1316
|
value,
|
|
@@ -900,11 +1319,12 @@ var SingleSelectProperty = ({
|
|
|
900
1319
|
readOnly = false,
|
|
901
1320
|
softRequired,
|
|
902
1321
|
onRemove,
|
|
1322
|
+
onAddNew,
|
|
903
1323
|
...selectProps
|
|
904
1324
|
}) => {
|
|
905
1325
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
906
1326
|
const hasValue = value !== void 0;
|
|
907
|
-
return /* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ jsx11(
|
|
908
1328
|
PropertyBase,
|
|
909
1329
|
{
|
|
910
1330
|
name,
|
|
@@ -912,22 +1332,45 @@ var SingleSelectProperty = ({
|
|
|
912
1332
|
readOnly,
|
|
913
1333
|
softRequired,
|
|
914
1334
|
hasValue,
|
|
915
|
-
icon: /* @__PURE__ */
|
|
916
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */
|
|
917
|
-
|
|
1335
|
+
icon: /* @__PURE__ */ jsx11(List, { size: 24 }),
|
|
1336
|
+
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx11(
|
|
1337
|
+
Select,
|
|
918
1338
|
{
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1339
|
+
...selectProps,
|
|
1340
|
+
value,
|
|
1341
|
+
options,
|
|
1342
|
+
disabled: readOnly,
|
|
1343
|
+
className: clsx10("w-full"),
|
|
1344
|
+
hintText: `${translation("select")}...`,
|
|
1345
|
+
searchOptions: {
|
|
1346
|
+
sortingFunction: (a, b) => a.value.localeCompare(b.value),
|
|
1347
|
+
...selectProps?.searchOptions
|
|
1348
|
+
},
|
|
1349
|
+
additionalItems: ({ close, search }) => {
|
|
1350
|
+
if (!onAddNew && !search.trim()) {
|
|
1351
|
+
return void 0;
|
|
1352
|
+
}
|
|
1353
|
+
return /* @__PURE__ */ jsx11(
|
|
1354
|
+
SelectTile,
|
|
1355
|
+
{
|
|
1356
|
+
prefix: /* @__PURE__ */ jsx11(Plus, {}),
|
|
1357
|
+
title: { value: `${translation("add")} ${search.trim()}` },
|
|
1358
|
+
onClick: () => {
|
|
1359
|
+
onAddNew(search);
|
|
1360
|
+
close();
|
|
1361
|
+
},
|
|
1362
|
+
disabled: options.some((value2) => value2.value === search.trim())
|
|
1363
|
+
}
|
|
1364
|
+
);
|
|
1365
|
+
},
|
|
1366
|
+
triggerClassName: clsx10(
|
|
1367
|
+
"!border-none",
|
|
922
1368
|
{
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
options,
|
|
926
|
-
isDisabled: readOnly,
|
|
927
|
-
className: clsx8("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
928
|
-
hintText: `${translation("select")}...`
|
|
1369
|
+
"!bg-warning !text-surface-warning": softRequired2 && !hasValue,
|
|
1370
|
+
"!bg-property-title-background": !softRequired2 || hasValue
|
|
929
1371
|
}
|
|
930
|
-
)
|
|
1372
|
+
),
|
|
1373
|
+
hintTextClassName: softRequired2 && !hasValue ? "text-surface-warning" : void 0
|
|
931
1374
|
}
|
|
932
1375
|
)
|
|
933
1376
|
}
|