@helpwave/hightide 0.1.17 → 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 -10
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +79 -7
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +127 -26
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +126 -25
- 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 -29
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +18 -15
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +728 -435
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +728 -431
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +732 -439
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +731 -434
- 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 -42
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +114 -38
- 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 -464
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +920 -465
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +101 -19
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +101 -19
- 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 -244
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +686 -244
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +133 -47
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +133 -47
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +285 -186
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +270 -167
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +179 -79
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +160 -56
- 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/Input.js +0 -1
- package/dist/components/user-action/Input.js.map +1 -1
- package/dist/components/user-action/Input.mjs +0 -1
- package/dist/components/user-action/Input.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 -376
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +781 -357
- 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 -356
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +761 -350
- 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 -4
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +13 -4
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.js +2 -3
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +2 -3
- 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/useDelay.js +0 -1
- package/dist/hooks/useDelay.js.map +1 -1
- package/dist/hooks/useDelay.mjs +0 -1
- package/dist/hooks/useDelay.mjs.map +1 -1
- 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 -820
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1001 -719
- 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,28 +891,24 @@ 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);
|
|
456
903
|
}
|
|
457
904
|
}, [disabled, timer]);
|
|
458
|
-
console.log(timer);
|
|
459
905
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
460
906
|
}
|
|
461
907
|
|
|
462
|
-
// src/util/noop.ts
|
|
463
|
-
var noop = () => void 0;
|
|
464
|
-
|
|
465
908
|
// src/hooks/useFocusManagement.ts
|
|
466
|
-
import { useCallback as
|
|
909
|
+
import { useCallback as useCallback3 } from "react";
|
|
467
910
|
function useFocusManagement() {
|
|
468
|
-
const getFocusableElements =
|
|
911
|
+
const getFocusableElements = useCallback3(() => {
|
|
469
912
|
return Array.from(
|
|
470
913
|
document.querySelectorAll(
|
|
471
914
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -474,7 +917,7 @@ function useFocusManagement() {
|
|
|
474
917
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
475
918
|
);
|
|
476
919
|
}, []);
|
|
477
|
-
const getNextFocusElement =
|
|
920
|
+
const getNextFocusElement = useCallback3(() => {
|
|
478
921
|
const elements = getFocusableElements();
|
|
479
922
|
if (elements.length === 0) {
|
|
480
923
|
return void 0;
|
|
@@ -486,11 +929,11 @@ function useFocusManagement() {
|
|
|
486
929
|
}
|
|
487
930
|
return nextElement;
|
|
488
931
|
}, [getFocusableElements]);
|
|
489
|
-
const focusNext =
|
|
932
|
+
const focusNext = useCallback3(() => {
|
|
490
933
|
const nextElement = getNextFocusElement();
|
|
491
934
|
nextElement?.focus();
|
|
492
935
|
}, [getNextFocusElement]);
|
|
493
|
-
const getPreviousFocusElement =
|
|
936
|
+
const getPreviousFocusElement = useCallback3(() => {
|
|
494
937
|
const elements = getFocusableElements();
|
|
495
938
|
if (elements.length === 0) {
|
|
496
939
|
return void 0;
|
|
@@ -506,7 +949,7 @@ function useFocusManagement() {
|
|
|
506
949
|
}
|
|
507
950
|
return previousElement;
|
|
508
951
|
}, [getFocusableElements]);
|
|
509
|
-
const focusPrevious =
|
|
952
|
+
const focusPrevious = useCallback3(() => {
|
|
510
953
|
const previousElement = getPreviousFocusElement();
|
|
511
954
|
if (previousElement) previousElement.focus();
|
|
512
955
|
}, [getPreviousFocusElement]);
|
|
@@ -520,10 +963,10 @@ function useFocusManagement() {
|
|
|
520
963
|
}
|
|
521
964
|
|
|
522
965
|
// src/hooks/useFocusOnceVisible.ts
|
|
523
|
-
import React, { useEffect as
|
|
966
|
+
import React, { useEffect as useEffect8 } from "react";
|
|
524
967
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
525
968
|
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
526
|
-
|
|
969
|
+
useEffect8(() => {
|
|
527
970
|
if (disable || hasUsedFocus) {
|
|
528
971
|
return;
|
|
529
972
|
}
|
|
@@ -543,9 +986,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
543
986
|
};
|
|
544
987
|
|
|
545
988
|
// src/components/user-action/Input.tsx
|
|
546
|
-
import { jsx as
|
|
989
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
547
990
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
548
|
-
return
|
|
991
|
+
return clsx7(
|
|
549
992
|
"px-2 py-1.5 rounded-md border-2",
|
|
550
993
|
{
|
|
551
994
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -559,7 +1002,7 @@ var defaultEditCompleteOptions = {
|
|
|
559
1002
|
afterDelay: true,
|
|
560
1003
|
delay: 2500
|
|
561
1004
|
};
|
|
562
|
-
var Input =
|
|
1005
|
+
var Input = forwardRef3(function Input2({
|
|
563
1006
|
id,
|
|
564
1007
|
type = "text",
|
|
565
1008
|
value,
|
|
@@ -582,7 +1025,7 @@ var Input = forwardRef(function Input2({
|
|
|
582
1025
|
restartTimer,
|
|
583
1026
|
clearTimer
|
|
584
1027
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
585
|
-
const innerRef =
|
|
1028
|
+
const innerRef = useRef2(null);
|
|
586
1029
|
const { focusNext } = useFocusManagement();
|
|
587
1030
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
588
1031
|
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
@@ -593,9 +1036,9 @@ var Input = forwardRef(function Input2({
|
|
|
593
1036
|
focusNext();
|
|
594
1037
|
}
|
|
595
1038
|
};
|
|
596
|
-
return /* @__PURE__ */
|
|
597
|
-
label && /* @__PURE__ */
|
|
598
|
-
/* @__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(
|
|
599
1042
|
"input",
|
|
600
1043
|
{
|
|
601
1044
|
...restProps,
|
|
@@ -604,7 +1047,7 @@ var Input = forwardRef(function Input2({
|
|
|
604
1047
|
id,
|
|
605
1048
|
type,
|
|
606
1049
|
disabled,
|
|
607
|
-
className:
|
|
1050
|
+
className: clsx7(getInputClassName({ disabled }), className),
|
|
608
1051
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
609
1052
|
onBlur: (event) => {
|
|
610
1053
|
onBlur?.(event);
|
|
@@ -634,7 +1077,7 @@ var Input = forwardRef(function Input2({
|
|
|
634
1077
|
)
|
|
635
1078
|
] });
|
|
636
1079
|
});
|
|
637
|
-
var FormInput =
|
|
1080
|
+
var FormInput = forwardRef3(function FormInput2({
|
|
638
1081
|
id,
|
|
639
1082
|
labelText,
|
|
640
1083
|
errorText,
|
|
@@ -646,40 +1089,64 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
646
1089
|
disabled,
|
|
647
1090
|
...restProps
|
|
648
1091
|
}, ref) {
|
|
649
|
-
const input = /* @__PURE__ */
|
|
1092
|
+
const input = /* @__PURE__ */ jsx8(
|
|
650
1093
|
"input",
|
|
651
1094
|
{
|
|
652
1095
|
...restProps,
|
|
653
1096
|
ref,
|
|
654
1097
|
id,
|
|
655
1098
|
disabled,
|
|
656
|
-
className:
|
|
1099
|
+
className: clsx7(
|
|
657
1100
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
658
1101
|
className
|
|
659
1102
|
)
|
|
660
1103
|
}
|
|
661
1104
|
);
|
|
662
|
-
return /* @__PURE__ */
|
|
663
|
-
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: [
|
|
664
1107
|
labelText,
|
|
665
|
-
required && /* @__PURE__ */
|
|
1108
|
+
required && /* @__PURE__ */ jsx8("span", { className: "text-primary font-bold", children: "*" })
|
|
666
1109
|
] }),
|
|
667
1110
|
input,
|
|
668
|
-
errorText && /* @__PURE__ */
|
|
1111
|
+
errorText && /* @__PURE__ */ jsx8("label", { htmlFor: id, className: clsx7("text-negative", errorClassName), children: errorText })
|
|
669
1112
|
] });
|
|
670
1113
|
});
|
|
671
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
|
+
|
|
672
1139
|
// src/hooks/useSearch.ts
|
|
673
|
-
import { useEffect as
|
|
1140
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
|
|
674
1141
|
|
|
675
1142
|
// src/util/simpleSearch.ts
|
|
676
|
-
var
|
|
1143
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
677
1144
|
return objects.filter((object) => {
|
|
678
1145
|
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
679
1146
|
if (!mappedSearchKeywords) {
|
|
680
1147
|
return true;
|
|
681
1148
|
}
|
|
682
|
-
return !!mappedSearchKeywords.find((value) => value.includes(
|
|
1149
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
683
1150
|
});
|
|
684
1151
|
};
|
|
685
1152
|
|
|
@@ -687,212 +1154,163 @@ var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
|
687
1154
|
var useSearch = ({
|
|
688
1155
|
list,
|
|
689
1156
|
initialSearch,
|
|
690
|
-
searchMapping
|
|
1157
|
+
searchMapping,
|
|
1158
|
+
additionalSearchTags,
|
|
1159
|
+
isSearchInstant = true,
|
|
1160
|
+
sortingFunction,
|
|
1161
|
+
filter,
|
|
1162
|
+
disabled = false
|
|
691
1163
|
}) => {
|
|
692
|
-
const [
|
|
693
|
-
const [
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
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]);
|
|
701
1197
|
return {
|
|
702
|
-
result,
|
|
703
|
-
hasResult:
|
|
704
|
-
allItems:
|
|
705
|
-
|
|
1198
|
+
result: usedResult,
|
|
1199
|
+
hasResult: usedResult.length > 0,
|
|
1200
|
+
allItems: list,
|
|
1201
|
+
updateSearch,
|
|
706
1202
|
search,
|
|
707
1203
|
setSearch
|
|
708
1204
|
};
|
|
709
1205
|
};
|
|
710
1206
|
|
|
711
|
-
// src/components/
|
|
712
|
-
import { jsx as
|
|
713
|
-
var
|
|
714
|
-
en: {
|
|
715
|
-
nothingFound: "Nothing found"
|
|
716
|
-
},
|
|
717
|
-
de: {
|
|
718
|
-
nothingFound: "Nichts gefunden"
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
var SearchableList = ({
|
|
722
|
-
overwriteTranslation,
|
|
723
|
-
list,
|
|
724
|
-
initialSearch = "",
|
|
725
|
-
searchMapping,
|
|
726
|
-
autoFocus,
|
|
727
|
-
minimumItemsForSearch = 6,
|
|
728
|
-
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 = ({
|
|
729
1210
|
className,
|
|
730
|
-
|
|
731
|
-
}) => {
|
|
732
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
733
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
734
|
-
return /* @__PURE__ */ jsxs4("div", { className: clsx5("col gap-y-2", className), children: [
|
|
735
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs4("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
736
|
-
/* @__PURE__ */ jsx6(
|
|
737
|
-
Input,
|
|
738
|
-
{
|
|
739
|
-
value: search,
|
|
740
|
-
onChangeText: setSearch,
|
|
741
|
-
placeholder: translation("search"),
|
|
742
|
-
autoFocus,
|
|
743
|
-
className: "w-full"
|
|
744
|
-
}
|
|
745
|
-
),
|
|
746
|
-
/* @__PURE__ */ jsx6(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx6(Search, { className: "w-full h-full" }) })
|
|
747
|
-
] }),
|
|
748
|
-
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") })
|
|
749
|
-
] });
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
// src/components/layout-and-navigation/Tile.tsx
|
|
753
|
-
import clsx6 from "clsx";
|
|
754
|
-
import { Check } from "lucide-react";
|
|
755
|
-
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
756
|
-
var Tile = ({
|
|
1211
|
+
disabledClassName,
|
|
757
1212
|
title,
|
|
758
|
-
|
|
759
|
-
onClick,
|
|
760
|
-
isSelected = false,
|
|
761
|
-
isDisabled = false,
|
|
762
|
-
prefix,
|
|
763
|
-
suffix,
|
|
764
|
-
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
765
|
-
selectedClassName = " bg-primary/20",
|
|
766
|
-
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
767
|
-
className
|
|
1213
|
+
...restProps
|
|
768
1214
|
}) => {
|
|
769
|
-
return /* @__PURE__ */
|
|
770
|
-
|
|
1215
|
+
return /* @__PURE__ */ jsx10(
|
|
1216
|
+
Tile,
|
|
771
1217
|
{
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
[selectedClassName]: isSelected && !isDisabled,
|
|
777
|
-
[disabledClassName]: isDisabled
|
|
778
|
-
},
|
|
779
|
-
className
|
|
780
|
-
),
|
|
781
|
-
onClick: isDisabled ? void 0 : onClick,
|
|
782
|
-
children: [
|
|
783
|
-
prefix,
|
|
784
|
-
/* @__PURE__ */ jsxs5("div", { className: "col gap-y-0 w-full", children: [
|
|
785
|
-
/* @__PURE__ */ jsx7("h4", { className: clsx6(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
786
|
-
!!description && /* @__PURE__ */ jsx7("span", { className: clsx6(description.className ?? "textstyle-description"), children: description.value })
|
|
787
|
-
] }),
|
|
788
|
-
suffix ?? (isSelected ? /* @__PURE__ */ jsx7(Check, { size: 24 }) : void 0)
|
|
789
|
-
]
|
|
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" }
|
|
790
1222
|
}
|
|
791
1223
|
);
|
|
792
1224
|
};
|
|
793
|
-
|
|
794
|
-
// src/hooks/useOutsideClick.ts
|
|
795
|
-
import { useEffect as useEffect7 } from "react";
|
|
796
|
-
var useOutsideClick = (refs, handler) => {
|
|
797
|
-
useEffect7(() => {
|
|
798
|
-
const listener = (event) => {
|
|
799
|
-
if (event.target === null) return;
|
|
800
|
-
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
handler();
|
|
804
|
-
};
|
|
805
|
-
document.addEventListener("mousedown", listener);
|
|
806
|
-
document.addEventListener("touchstart", listener);
|
|
807
|
-
return () => {
|
|
808
|
-
document.removeEventListener("mousedown", listener);
|
|
809
|
-
document.removeEventListener("touchstart", listener);
|
|
810
|
-
};
|
|
811
|
-
}, [refs, handler]);
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
// src/components/user-action/Select.tsx
|
|
815
|
-
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
816
1225
|
var Select = ({
|
|
817
1226
|
value,
|
|
818
1227
|
label,
|
|
819
1228
|
options,
|
|
820
1229
|
onChange,
|
|
821
1230
|
hintText = "",
|
|
822
|
-
|
|
823
|
-
|
|
1231
|
+
selectedDisplayOverwrite,
|
|
1232
|
+
searchOptions,
|
|
1233
|
+
additionalItems,
|
|
824
1234
|
className,
|
|
825
|
-
|
|
1235
|
+
triggerClassName,
|
|
1236
|
+
hintTextClassName,
|
|
1237
|
+
...menuProps
|
|
826
1238
|
}) => {
|
|
827
|
-
const triggerRef = useRef2(null);
|
|
828
|
-
const menuRef = useRef2(null);
|
|
829
|
-
const [isOpen, setIsOpen] = useState6(false);
|
|
830
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
831
1239
|
const selectedOption = options.find((option) => option.value === value);
|
|
832
1240
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
833
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");
|
|
834
1242
|
}
|
|
835
1243
|
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
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
|
-
|
|
872
|
-
|
|
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,
|
|
873
1292
|
{
|
|
874
|
-
isSelected:
|
|
875
|
-
|
|
876
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
877
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1293
|
+
isSelected: option === selectedOption,
|
|
1294
|
+
title: { value: option.label },
|
|
878
1295
|
onClick: () => {
|
|
879
1296
|
onChange(option.value);
|
|
880
|
-
|
|
1297
|
+
close();
|
|
881
1298
|
},
|
|
882
|
-
|
|
1299
|
+
disabled: option.disabled
|
|
883
1300
|
},
|
|
884
1301
|
index
|
|
885
|
-
)
|
|
886
|
-
|
|
887
|
-
|
|
1302
|
+
)),
|
|
1303
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1304
|
+
] })
|
|
1305
|
+
] });
|
|
888
1306
|
}
|
|
889
|
-
|
|
890
|
-
|
|
1307
|
+
}
|
|
1308
|
+
)
|
|
891
1309
|
] });
|
|
892
1310
|
};
|
|
893
1311
|
|
|
894
1312
|
// src/components/properties/SelectProperty.tsx
|
|
895
|
-
import { jsx as
|
|
1313
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
896
1314
|
var SingleSelectProperty = ({
|
|
897
1315
|
overwriteTranslation,
|
|
898
1316
|
value,
|
|
@@ -901,11 +1319,12 @@ var SingleSelectProperty = ({
|
|
|
901
1319
|
readOnly = false,
|
|
902
1320
|
softRequired,
|
|
903
1321
|
onRemove,
|
|
1322
|
+
onAddNew,
|
|
904
1323
|
...selectProps
|
|
905
1324
|
}) => {
|
|
906
1325
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
907
1326
|
const hasValue = value !== void 0;
|
|
908
|
-
return /* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ jsx11(
|
|
909
1328
|
PropertyBase,
|
|
910
1329
|
{
|
|
911
1330
|
name,
|
|
@@ -913,22 +1332,45 @@ var SingleSelectProperty = ({
|
|
|
913
1332
|
readOnly,
|
|
914
1333
|
softRequired,
|
|
915
1334
|
hasValue,
|
|
916
|
-
icon: /* @__PURE__ */
|
|
917
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */
|
|
918
|
-
|
|
1335
|
+
icon: /* @__PURE__ */ jsx11(List, { size: 24 }),
|
|
1336
|
+
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx11(
|
|
1337
|
+
Select,
|
|
919
1338
|
{
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
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",
|
|
923
1368
|
{
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
options,
|
|
927
|
-
isDisabled: readOnly,
|
|
928
|
-
className: clsx8("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
929
|
-
hintText: `${translation("select")}...`
|
|
1369
|
+
"!bg-warning !text-surface-warning": softRequired2 && !hasValue,
|
|
1370
|
+
"!bg-property-title-background": !softRequired2 || hasValue
|
|
930
1371
|
}
|
|
931
|
-
)
|
|
1372
|
+
),
|
|
1373
|
+
hintTextClassName: softRequired2 && !hasValue ? "text-surface-warning" : void 0
|
|
932
1374
|
}
|
|
933
1375
|
)
|
|
934
1376
|
}
|