@helpwave/hightide 0.1.18 → 0.1.20
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 +67 -39
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +56 -28
- 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 +48 -20
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +46 -18
- 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 +10 -1
- package/dist/components/layout-and-navigation/Expandable.d.ts +10 -1
- package/dist/components/layout-and-navigation/Expandable.js +38 -10
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +38 -11
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +36 -12
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +38 -14
- 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.d.mts +5 -10
- package/dist/components/loading-states/LoadingAndErrorComponent.d.ts +5 -10
- package/dist/components/loading-states/LoadingAndErrorComponent.js +14 -327
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +15 -318
- 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/loading-states/LoadingContainer.d.mts +8 -0
- package/dist/components/loading-states/LoadingContainer.d.ts +8 -0
- package/dist/components/loading-states/LoadingContainer.js +34 -0
- package/dist/components/loading-states/LoadingContainer.js.map +1 -0
- package/dist/components/loading-states/LoadingContainer.mjs +10 -0
- package/dist/components/loading-states/LoadingContainer.mjs.map +1 -0
- 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 +729 -434
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +729 -430
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +733 -438
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +732 -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 +916 -463
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +921 -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 +683 -243
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +687 -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 +81 -49
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +67 -35
- 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 +797 -375
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +782 -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 +765 -355
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +762 -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 +284 -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 +96 -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 +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1197 -902
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1048 -754
- 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,389 @@ 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
|
+
contentExpandedClassName
|
|
570
|
+
}, ref) {
|
|
571
|
+
const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx6(ExpansionIcon, { isExpanded: expanded }), []);
|
|
572
|
+
icon ??= defaultIcon;
|
|
573
|
+
return /* @__PURE__ */ jsxs4(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
ref,
|
|
577
|
+
className: clsx5("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
578
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
579
|
+
children: [
|
|
580
|
+
/* @__PURE__ */ jsxs4(
|
|
581
|
+
"div",
|
|
582
|
+
{
|
|
583
|
+
className: clsx5(
|
|
584
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
585
|
+
{
|
|
586
|
+
"group-hover:brightness-97": !isExpanded,
|
|
587
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
588
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
589
|
+
},
|
|
590
|
+
headerClassName
|
|
591
|
+
),
|
|
592
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
593
|
+
children: [
|
|
594
|
+
label,
|
|
595
|
+
icon(isExpanded)
|
|
596
|
+
]
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ jsx6(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
className: clsx5(
|
|
603
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
604
|
+
{
|
|
605
|
+
[clsx5("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
|
|
606
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
607
|
+
},
|
|
608
|
+
contentClassName
|
|
609
|
+
),
|
|
610
|
+
children
|
|
611
|
+
}
|
|
612
|
+
)
|
|
613
|
+
]
|
|
614
|
+
}
|
|
615
|
+
);
|
|
616
|
+
});
|
|
617
|
+
var ExpandableUncontrolled = forwardRef2(function ExpandableUncontrolled2({
|
|
618
|
+
isExpanded,
|
|
619
|
+
onChange = noop,
|
|
620
|
+
...props
|
|
621
|
+
}, ref) {
|
|
622
|
+
const [usedIsExpanded, setUsedIsExpanded] = useState3(isExpanded);
|
|
623
|
+
useEffect3(() => {
|
|
624
|
+
setUsedIsExpanded(isExpanded);
|
|
625
|
+
}, [isExpanded]);
|
|
626
|
+
return /* @__PURE__ */ jsx6(
|
|
627
|
+
Expandable,
|
|
628
|
+
{
|
|
629
|
+
...props,
|
|
630
|
+
ref,
|
|
631
|
+
isExpanded: usedIsExpanded,
|
|
632
|
+
onChange: (value) => {
|
|
633
|
+
onChange(value);
|
|
634
|
+
setUsedIsExpanded(value);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
);
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
// src/components/user-action/Menu.tsx
|
|
641
|
+
import {
|
|
642
|
+
useEffect as useEffect6,
|
|
643
|
+
useRef,
|
|
644
|
+
useState as useState5
|
|
645
|
+
} from "react";
|
|
646
|
+
import clsx6 from "clsx";
|
|
647
|
+
|
|
648
|
+
// src/hooks/useOutsideClick.ts
|
|
649
|
+
import { useEffect as useEffect4 } from "react";
|
|
650
|
+
var useOutsideClick = (refs, handler) => {
|
|
651
|
+
useEffect4(() => {
|
|
652
|
+
const listener = (event) => {
|
|
653
|
+
if (event.target === null) return;
|
|
654
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
handler();
|
|
658
|
+
};
|
|
659
|
+
document.addEventListener("mousedown", listener);
|
|
660
|
+
document.addEventListener("touchstart", listener);
|
|
661
|
+
return () => {
|
|
662
|
+
document.removeEventListener("mousedown", listener);
|
|
663
|
+
document.removeEventListener("touchstart", listener);
|
|
664
|
+
};
|
|
665
|
+
}, [refs, handler]);
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
// src/hooks/useHoverState.ts
|
|
669
|
+
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
670
|
+
var defaultUseHoverStateProps = {
|
|
671
|
+
closingDelay: 200,
|
|
672
|
+
isDisabled: false
|
|
673
|
+
};
|
|
674
|
+
var useHoverState = (props = void 0) => {
|
|
675
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
676
|
+
const [isHovered, setIsHovered] = useState4(false);
|
|
677
|
+
const [timer, setTimer] = useState4();
|
|
678
|
+
const onMouseEnter = () => {
|
|
679
|
+
if (isDisabled) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
clearTimeout(timer);
|
|
683
|
+
setIsHovered(true);
|
|
684
|
+
};
|
|
685
|
+
const onMouseLeave = () => {
|
|
686
|
+
if (isDisabled) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
setTimer(setTimeout(() => {
|
|
690
|
+
setIsHovered(false);
|
|
691
|
+
}, closingDelay));
|
|
692
|
+
};
|
|
693
|
+
useEffect5(() => {
|
|
694
|
+
if (timer) {
|
|
695
|
+
return () => {
|
|
696
|
+
clearTimeout(timer);
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
useEffect5(() => {
|
|
701
|
+
if (timer) {
|
|
702
|
+
clearTimeout(timer);
|
|
703
|
+
}
|
|
704
|
+
}, [isDisabled]);
|
|
705
|
+
return {
|
|
706
|
+
isHovered,
|
|
707
|
+
setIsHovered,
|
|
708
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
709
|
+
};
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
713
|
+
var resolve = (children, bag) => {
|
|
714
|
+
if (typeof children === "function") {
|
|
715
|
+
return children(bag);
|
|
716
|
+
}
|
|
717
|
+
return children ?? void 0;
|
|
718
|
+
};
|
|
719
|
+
var BagFunctionUtil = {
|
|
720
|
+
resolve
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
// src/hooks/usePopoverPosition.ts
|
|
724
|
+
var defaultPopoverPositionOptions = {
|
|
725
|
+
edgePadding: 16,
|
|
726
|
+
outerGap: 4,
|
|
727
|
+
horizontalAlignment: "leftInside",
|
|
728
|
+
verticalAlignment: "bottomOutside",
|
|
729
|
+
disabled: false
|
|
730
|
+
};
|
|
731
|
+
var usePopoverPosition = (trigger, options) => {
|
|
732
|
+
const {
|
|
733
|
+
edgePadding,
|
|
734
|
+
outerGap,
|
|
735
|
+
verticalAlignment,
|
|
736
|
+
horizontalAlignment,
|
|
737
|
+
disabled
|
|
738
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
739
|
+
if (disabled || !trigger) {
|
|
740
|
+
return {};
|
|
741
|
+
}
|
|
742
|
+
const left = {
|
|
743
|
+
leftOutside: trigger.left - outerGap,
|
|
744
|
+
leftInside: trigger.left,
|
|
745
|
+
rightOutside: trigger.right + outerGap,
|
|
746
|
+
rightInside: trigger.right,
|
|
747
|
+
center: trigger.left + trigger.width / 2
|
|
748
|
+
}[horizontalAlignment];
|
|
749
|
+
const top = {
|
|
750
|
+
topOutside: trigger.top - outerGap,
|
|
751
|
+
topInside: trigger.top,
|
|
752
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
753
|
+
bottomInside: trigger.bottom,
|
|
754
|
+
center: trigger.top + trigger.height / 2
|
|
755
|
+
}[verticalAlignment];
|
|
756
|
+
const translateX = {
|
|
757
|
+
leftOutside: "-100%",
|
|
758
|
+
leftInside: void 0,
|
|
759
|
+
rightOutside: void 0,
|
|
760
|
+
rightInside: "-100%",
|
|
761
|
+
center: "-50%"
|
|
762
|
+
}[horizontalAlignment];
|
|
763
|
+
const translateY = {
|
|
764
|
+
topOutside: "-100%",
|
|
765
|
+
topInside: void 0,
|
|
766
|
+
bottomOutside: void 0,
|
|
767
|
+
bottomInside: "-100%",
|
|
768
|
+
center: "-50%"
|
|
769
|
+
}[verticalAlignment];
|
|
770
|
+
return {
|
|
771
|
+
left: Math.max(left, edgePadding),
|
|
772
|
+
top: Math.max(top, edgePadding),
|
|
773
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
// src/components/user-action/Menu.tsx
|
|
778
|
+
import { createPortal } from "react-dom";
|
|
779
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
780
|
+
function getScrollableParents(element) {
|
|
781
|
+
const scrollables = [];
|
|
782
|
+
let parent = element.parentElement;
|
|
783
|
+
while (parent) {
|
|
784
|
+
scrollables.push(parent);
|
|
785
|
+
parent = parent.parentElement;
|
|
786
|
+
}
|
|
787
|
+
return scrollables;
|
|
788
|
+
}
|
|
789
|
+
var Menu = ({
|
|
790
|
+
trigger,
|
|
791
|
+
children,
|
|
792
|
+
alignmentHorizontal = "leftInside",
|
|
793
|
+
alignmentVertical = "bottomOutside",
|
|
794
|
+
showOnHover = false,
|
|
795
|
+
disabled = false,
|
|
796
|
+
menuClassName = ""
|
|
797
|
+
}) => {
|
|
798
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
799
|
+
const triggerRef = useRef(null);
|
|
800
|
+
const menuRef = useRef(null);
|
|
801
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
802
|
+
const [isHidden, setIsHidden] = useState5(true);
|
|
803
|
+
const bag = {
|
|
804
|
+
isOpen,
|
|
805
|
+
close: () => setIsOpen(false),
|
|
806
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
807
|
+
disabled
|
|
808
|
+
};
|
|
809
|
+
const menuPosition = usePopoverPosition(
|
|
810
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
811
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
812
|
+
);
|
|
813
|
+
useEffect6(() => {
|
|
814
|
+
if (!isOpen) return;
|
|
815
|
+
const triggerEl = triggerRef.current;
|
|
816
|
+
if (!triggerEl) return;
|
|
817
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
818
|
+
const close = () => setIsOpen(false);
|
|
819
|
+
scrollableParents.forEach((parent) => {
|
|
820
|
+
parent.addEventListener("scroll", close);
|
|
821
|
+
});
|
|
822
|
+
window.addEventListener("resize", close);
|
|
823
|
+
return () => {
|
|
824
|
+
scrollableParents.forEach((parent) => {
|
|
825
|
+
parent.removeEventListener("scroll", close);
|
|
826
|
+
});
|
|
827
|
+
window.removeEventListener("resize", close);
|
|
828
|
+
};
|
|
829
|
+
}, [isOpen, setIsOpen]);
|
|
830
|
+
useEffect6(() => {
|
|
831
|
+
if (isOpen) {
|
|
832
|
+
setIsHidden(false);
|
|
833
|
+
}
|
|
834
|
+
}, [isOpen]);
|
|
835
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
836
|
+
trigger(bag, triggerRef),
|
|
837
|
+
createPortal(/* @__PURE__ */ jsx7(
|
|
838
|
+
"div",
|
|
839
|
+
{
|
|
840
|
+
ref: menuRef,
|
|
841
|
+
onClick: (e) => e.stopPropagation(),
|
|
842
|
+
className: clsx6(
|
|
843
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
844
|
+
{
|
|
845
|
+
"animate-pop-in": isOpen,
|
|
846
|
+
"animate-pop-out": !isOpen,
|
|
847
|
+
"hidden": isHidden
|
|
848
|
+
},
|
|
849
|
+
menuClassName
|
|
850
|
+
),
|
|
851
|
+
onAnimationEnd: () => {
|
|
852
|
+
if (!isOpen) {
|
|
853
|
+
setIsHidden(true);
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
style: {
|
|
857
|
+
...menuPosition
|
|
858
|
+
},
|
|
859
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
860
|
+
}
|
|
861
|
+
), document.body)
|
|
862
|
+
] });
|
|
863
|
+
};
|
|
864
|
+
|
|
417
865
|
// src/components/user-action/Input.tsx
|
|
418
|
-
import { forwardRef, useEffect as
|
|
419
|
-
import
|
|
866
|
+
import { forwardRef as forwardRef3, useEffect as useEffect9, useImperativeHandle, useRef as useRef2, useState as useState7 } from "react";
|
|
867
|
+
import clsx7 from "clsx";
|
|
420
868
|
|
|
421
869
|
// src/hooks/useDelay.ts
|
|
422
|
-
import { useEffect as
|
|
870
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
423
871
|
var defaultOptions = {
|
|
424
872
|
delay: 3e3,
|
|
425
873
|
disabled: false
|
|
426
874
|
};
|
|
427
875
|
function useDelay(options) {
|
|
428
|
-
const [timer, setTimer] =
|
|
876
|
+
const [timer, setTimer] = useState6(void 0);
|
|
429
877
|
const { delay, disabled } = {
|
|
430
878
|
...defaultOptions,
|
|
431
879
|
...options
|
|
@@ -444,12 +892,12 @@ function useDelay(options) {
|
|
|
444
892
|
setTimer(void 0);
|
|
445
893
|
}, delay));
|
|
446
894
|
};
|
|
447
|
-
|
|
895
|
+
useEffect7(() => {
|
|
448
896
|
return () => {
|
|
449
897
|
clearTimeout(timer);
|
|
450
898
|
};
|
|
451
899
|
}, [timer]);
|
|
452
|
-
|
|
900
|
+
useEffect7(() => {
|
|
453
901
|
if (disabled) {
|
|
454
902
|
clearTimeout(timer);
|
|
455
903
|
setTimer(void 0);
|
|
@@ -458,13 +906,10 @@ function useDelay(options) {
|
|
|
458
906
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
459
907
|
}
|
|
460
908
|
|
|
461
|
-
// src/util/noop.ts
|
|
462
|
-
var noop = () => void 0;
|
|
463
|
-
|
|
464
909
|
// src/hooks/useFocusManagement.ts
|
|
465
|
-
import { useCallback as
|
|
910
|
+
import { useCallback as useCallback3 } from "react";
|
|
466
911
|
function useFocusManagement() {
|
|
467
|
-
const getFocusableElements =
|
|
912
|
+
const getFocusableElements = useCallback3(() => {
|
|
468
913
|
return Array.from(
|
|
469
914
|
document.querySelectorAll(
|
|
470
915
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -473,7 +918,7 @@ function useFocusManagement() {
|
|
|
473
918
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
474
919
|
);
|
|
475
920
|
}, []);
|
|
476
|
-
const getNextFocusElement =
|
|
921
|
+
const getNextFocusElement = useCallback3(() => {
|
|
477
922
|
const elements = getFocusableElements();
|
|
478
923
|
if (elements.length === 0) {
|
|
479
924
|
return void 0;
|
|
@@ -485,11 +930,11 @@ function useFocusManagement() {
|
|
|
485
930
|
}
|
|
486
931
|
return nextElement;
|
|
487
932
|
}, [getFocusableElements]);
|
|
488
|
-
const focusNext =
|
|
933
|
+
const focusNext = useCallback3(() => {
|
|
489
934
|
const nextElement = getNextFocusElement();
|
|
490
935
|
nextElement?.focus();
|
|
491
936
|
}, [getNextFocusElement]);
|
|
492
|
-
const getPreviousFocusElement =
|
|
937
|
+
const getPreviousFocusElement = useCallback3(() => {
|
|
493
938
|
const elements = getFocusableElements();
|
|
494
939
|
if (elements.length === 0) {
|
|
495
940
|
return void 0;
|
|
@@ -505,7 +950,7 @@ function useFocusManagement() {
|
|
|
505
950
|
}
|
|
506
951
|
return previousElement;
|
|
507
952
|
}, [getFocusableElements]);
|
|
508
|
-
const focusPrevious =
|
|
953
|
+
const focusPrevious = useCallback3(() => {
|
|
509
954
|
const previousElement = getPreviousFocusElement();
|
|
510
955
|
if (previousElement) previousElement.focus();
|
|
511
956
|
}, [getPreviousFocusElement]);
|
|
@@ -519,10 +964,10 @@ function useFocusManagement() {
|
|
|
519
964
|
}
|
|
520
965
|
|
|
521
966
|
// src/hooks/useFocusOnceVisible.ts
|
|
522
|
-
import React, { useEffect as
|
|
967
|
+
import React, { useEffect as useEffect8 } from "react";
|
|
523
968
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
524
969
|
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
525
|
-
|
|
970
|
+
useEffect8(() => {
|
|
526
971
|
if (disable || hasUsedFocus) {
|
|
527
972
|
return;
|
|
528
973
|
}
|
|
@@ -542,9 +987,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
542
987
|
};
|
|
543
988
|
|
|
544
989
|
// src/components/user-action/Input.tsx
|
|
545
|
-
import { jsx as
|
|
990
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
546
991
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
547
|
-
return
|
|
992
|
+
return clsx7(
|
|
548
993
|
"px-2 py-1.5 rounded-md border-2",
|
|
549
994
|
{
|
|
550
995
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -558,7 +1003,7 @@ var defaultEditCompleteOptions = {
|
|
|
558
1003
|
afterDelay: true,
|
|
559
1004
|
delay: 2500
|
|
560
1005
|
};
|
|
561
|
-
var Input =
|
|
1006
|
+
var Input = forwardRef3(function Input2({
|
|
562
1007
|
id,
|
|
563
1008
|
type = "text",
|
|
564
1009
|
value,
|
|
@@ -581,7 +1026,7 @@ var Input = forwardRef(function Input2({
|
|
|
581
1026
|
restartTimer,
|
|
582
1027
|
clearTimer
|
|
583
1028
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
584
|
-
const innerRef =
|
|
1029
|
+
const innerRef = useRef2(null);
|
|
585
1030
|
const { focusNext } = useFocusManagement();
|
|
586
1031
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
587
1032
|
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
@@ -592,9 +1037,9 @@ var Input = forwardRef(function Input2({
|
|
|
592
1037
|
focusNext();
|
|
593
1038
|
}
|
|
594
1039
|
};
|
|
595
|
-
return /* @__PURE__ */
|
|
596
|
-
label && /* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
1040
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7({ "w-full": expanded }, containerClassName), children: [
|
|
1041
|
+
label && /* @__PURE__ */ jsx8(Label, { ...label, htmlFor: id, className: clsx7("mb-1", label.className) }),
|
|
1042
|
+
/* @__PURE__ */ jsx8(
|
|
598
1043
|
"input",
|
|
599
1044
|
{
|
|
600
1045
|
...restProps,
|
|
@@ -603,7 +1048,7 @@ var Input = forwardRef(function Input2({
|
|
|
603
1048
|
id,
|
|
604
1049
|
type,
|
|
605
1050
|
disabled,
|
|
606
|
-
className:
|
|
1051
|
+
className: clsx7(getInputClassName({ disabled }), className),
|
|
607
1052
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
608
1053
|
onBlur: (event) => {
|
|
609
1054
|
onBlur?.(event);
|
|
@@ -633,7 +1078,7 @@ var Input = forwardRef(function Input2({
|
|
|
633
1078
|
)
|
|
634
1079
|
] });
|
|
635
1080
|
});
|
|
636
|
-
var FormInput =
|
|
1081
|
+
var FormInput = forwardRef3(function FormInput2({
|
|
637
1082
|
id,
|
|
638
1083
|
labelText,
|
|
639
1084
|
errorText,
|
|
@@ -645,40 +1090,64 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
645
1090
|
disabled,
|
|
646
1091
|
...restProps
|
|
647
1092
|
}, ref) {
|
|
648
|
-
const input = /* @__PURE__ */
|
|
1093
|
+
const input = /* @__PURE__ */ jsx8(
|
|
649
1094
|
"input",
|
|
650
1095
|
{
|
|
651
1096
|
...restProps,
|
|
652
1097
|
ref,
|
|
653
1098
|
id,
|
|
654
1099
|
disabled,
|
|
655
|
-
className:
|
|
1100
|
+
className: clsx7(
|
|
656
1101
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
657
1102
|
className
|
|
658
1103
|
)
|
|
659
1104
|
}
|
|
660
1105
|
);
|
|
661
|
-
return /* @__PURE__ */
|
|
662
|
-
labelText && /* @__PURE__ */
|
|
1106
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7("flex flex-col gap-y-1", containerClassName), children: [
|
|
1107
|
+
labelText && /* @__PURE__ */ jsxs6("label", { htmlFor: id, className: clsx7("textstyle-label-md", labelClassName), children: [
|
|
663
1108
|
labelText,
|
|
664
|
-
required && /* @__PURE__ */
|
|
1109
|
+
required && /* @__PURE__ */ jsx8("span", { className: "text-primary font-bold", children: "*" })
|
|
665
1110
|
] }),
|
|
666
1111
|
input,
|
|
667
|
-
errorText && /* @__PURE__ */
|
|
1112
|
+
errorText && /* @__PURE__ */ jsx8("label", { htmlFor: id, className: clsx7("text-negative", errorClassName), children: errorText })
|
|
668
1113
|
] });
|
|
669
1114
|
});
|
|
670
1115
|
|
|
1116
|
+
// src/components/user-action/SearchBar.tsx
|
|
1117
|
+
import { Search } from "lucide-react";
|
|
1118
|
+
import { clsx as clsx8 } from "clsx";
|
|
1119
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1120
|
+
var SearchBar = ({
|
|
1121
|
+
placeholder,
|
|
1122
|
+
onSearch,
|
|
1123
|
+
disableOnSearch,
|
|
1124
|
+
containerClassName,
|
|
1125
|
+
...inputProps
|
|
1126
|
+
}) => {
|
|
1127
|
+
const translation = useTranslation([formTranslation]);
|
|
1128
|
+
return /* @__PURE__ */ jsxs7("div", { className: clsx8("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
1129
|
+
/* @__PURE__ */ jsx9(
|
|
1130
|
+
Input,
|
|
1131
|
+
{
|
|
1132
|
+
...inputProps,
|
|
1133
|
+
placeholder: placeholder ?? translation("search")
|
|
1134
|
+
}
|
|
1135
|
+
),
|
|
1136
|
+
onSearch && /* @__PURE__ */ jsx9(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx9(Search, { className: "w-full h-full" }) })
|
|
1137
|
+
] });
|
|
1138
|
+
};
|
|
1139
|
+
|
|
671
1140
|
// src/hooks/useSearch.ts
|
|
672
|
-
import { useEffect as
|
|
1141
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
|
|
673
1142
|
|
|
674
1143
|
// src/util/simpleSearch.ts
|
|
675
|
-
var
|
|
1144
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
676
1145
|
return objects.filter((object) => {
|
|
677
1146
|
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
678
1147
|
if (!mappedSearchKeywords) {
|
|
679
1148
|
return true;
|
|
680
1149
|
}
|
|
681
|
-
return !!mappedSearchKeywords.find((value) => value.includes(
|
|
1150
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
682
1151
|
});
|
|
683
1152
|
};
|
|
684
1153
|
|
|
@@ -686,212 +1155,163 @@ var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
|
686
1155
|
var useSearch = ({
|
|
687
1156
|
list,
|
|
688
1157
|
initialSearch,
|
|
689
|
-
searchMapping
|
|
1158
|
+
searchMapping,
|
|
1159
|
+
additionalSearchTags,
|
|
1160
|
+
isSearchInstant = true,
|
|
1161
|
+
sortingFunction,
|
|
1162
|
+
filter,
|
|
1163
|
+
disabled = false
|
|
690
1164
|
}) => {
|
|
691
|
-
const [
|
|
692
|
-
const [
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
1165
|
+
const [search, setSearch] = useState8(initialSearch ?? "");
|
|
1166
|
+
const [result, setResult] = useState8(list);
|
|
1167
|
+
const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1168
|
+
const updateSearch = useCallback4((newSearch) => {
|
|
1169
|
+
const usedSearch = newSearch ?? search;
|
|
1170
|
+
if (newSearch) {
|
|
1171
|
+
setSearch(search);
|
|
1172
|
+
}
|
|
1173
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1174
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1175
|
+
useEffect10(() => {
|
|
1176
|
+
if (isSearchInstant) {
|
|
1177
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1178
|
+
}
|
|
1179
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1180
|
+
const filteredResult = useMemo(() => {
|
|
1181
|
+
if (!filter) {
|
|
1182
|
+
return result;
|
|
1183
|
+
}
|
|
1184
|
+
return result.filter(filter);
|
|
1185
|
+
}, [result, filter]);
|
|
1186
|
+
const sortedAndFilteredResult = useMemo(() => {
|
|
1187
|
+
if (!sortingFunction) {
|
|
1188
|
+
return filteredResult;
|
|
1189
|
+
}
|
|
1190
|
+
return filteredResult.sort(sortingFunction);
|
|
1191
|
+
}, [filteredResult, sortingFunction]);
|
|
1192
|
+
const usedResult = useMemo(() => {
|
|
1193
|
+
if (!disabled) {
|
|
1194
|
+
return sortedAndFilteredResult;
|
|
1195
|
+
}
|
|
1196
|
+
return list;
|
|
1197
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
700
1198
|
return {
|
|
701
|
-
result,
|
|
702
|
-
hasResult:
|
|
703
|
-
allItems:
|
|
704
|
-
|
|
1199
|
+
result: usedResult,
|
|
1200
|
+
hasResult: usedResult.length > 0,
|
|
1201
|
+
allItems: list,
|
|
1202
|
+
updateSearch,
|
|
705
1203
|
search,
|
|
706
1204
|
setSearch
|
|
707
1205
|
};
|
|
708
1206
|
};
|
|
709
1207
|
|
|
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,
|
|
1208
|
+
// src/components/user-action/Select.tsx
|
|
1209
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1210
|
+
var SelectTile = ({
|
|
728
1211
|
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 = ({
|
|
1212
|
+
disabledClassName,
|
|
756
1213
|
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
|
|
1214
|
+
...restProps
|
|
767
1215
|
}) => {
|
|
768
|
-
return /* @__PURE__ */
|
|
769
|
-
|
|
1216
|
+
return /* @__PURE__ */ jsx10(
|
|
1217
|
+
Tile,
|
|
770
1218
|
{
|
|
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
|
-
]
|
|
1219
|
+
...restProps,
|
|
1220
|
+
className: clsx9("px-2 py-1 rounded-md", className),
|
|
1221
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1222
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
789
1223
|
}
|
|
790
1224
|
);
|
|
791
1225
|
};
|
|
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
1226
|
var Select = ({
|
|
816
1227
|
value,
|
|
817
1228
|
label,
|
|
818
1229
|
options,
|
|
819
1230
|
onChange,
|
|
820
1231
|
hintText = "",
|
|
821
|
-
|
|
822
|
-
|
|
1232
|
+
selectedDisplayOverwrite,
|
|
1233
|
+
searchOptions,
|
|
1234
|
+
additionalItems,
|
|
823
1235
|
className,
|
|
824
|
-
|
|
1236
|
+
triggerClassName,
|
|
1237
|
+
hintTextClassName,
|
|
1238
|
+
...menuProps
|
|
825
1239
|
}) => {
|
|
826
|
-
const triggerRef = useRef2(null);
|
|
827
|
-
const menuRef = useRef2(null);
|
|
828
|
-
const [isOpen, setIsOpen] = useState6(false);
|
|
829
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
830
1240
|
const selectedOption = options.find((option) => option.value === value);
|
|
831
1241
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
832
1242
|
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
1243
|
}
|
|
834
1244
|
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
|
-
|
|
1245
|
+
const { result, search, setSearch } = useSearch({
|
|
1246
|
+
list: options,
|
|
1247
|
+
searchMapping: useCallback5((item) => item.searchTags, []),
|
|
1248
|
+
...searchOptions
|
|
1249
|
+
});
|
|
1250
|
+
return /* @__PURE__ */ jsxs8("div", { className: clsx9(className), children: [
|
|
1251
|
+
label && /* @__PURE__ */ jsx10(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx9("mb-1", label.className) }),
|
|
1252
|
+
/* @__PURE__ */ jsx10(
|
|
1253
|
+
Menu,
|
|
1254
|
+
{
|
|
1255
|
+
...menuProps,
|
|
1256
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsxs8(
|
|
1257
|
+
"button",
|
|
1258
|
+
{
|
|
1259
|
+
ref,
|
|
1260
|
+
className: clsx9(
|
|
1261
|
+
"btn-md justify-between w-full border-2",
|
|
1262
|
+
{
|
|
1263
|
+
"rounded-b-lg": !open,
|
|
1264
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1265
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1266
|
+
},
|
|
1267
|
+
triggerClassName
|
|
1268
|
+
),
|
|
1269
|
+
onClick: toggleOpen,
|
|
1270
|
+
disabled,
|
|
1271
|
+
children: [
|
|
1272
|
+
!isShowingHint && /* @__PURE__ */ jsx10("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
1273
|
+
isShowingHint && /* @__PURE__ */ jsx10("span", { className: clsx9("textstyle-description", hintTextClassName), children: hintText }),
|
|
1274
|
+
/* @__PURE__ */ jsx10(ExpansionIcon, { isExpanded: isOpen })
|
|
1275
|
+
]
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
menuClassName: clsx9("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1279
|
+
children: (bag) => {
|
|
1280
|
+
const { close } = bag;
|
|
1281
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1282
|
+
!searchOptions?.disabled && /* @__PURE__ */ jsx10(
|
|
1283
|
+
SearchBar,
|
|
1284
|
+
{
|
|
1285
|
+
value: search,
|
|
1286
|
+
onChangeText: setSearch,
|
|
1287
|
+
autoFocus: true
|
|
1288
|
+
}
|
|
1289
|
+
),
|
|
1290
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1291
|
+
result.map((option, index) => /* @__PURE__ */ jsx10(
|
|
1292
|
+
SelectTile,
|
|
872
1293
|
{
|
|
873
|
-
isSelected:
|
|
874
|
-
|
|
875
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
876
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1294
|
+
isSelected: option === selectedOption,
|
|
1295
|
+
title: { value: option.label },
|
|
877
1296
|
onClick: () => {
|
|
878
1297
|
onChange(option.value);
|
|
879
|
-
|
|
1298
|
+
close();
|
|
880
1299
|
},
|
|
881
|
-
|
|
1300
|
+
disabled: option.disabled
|
|
882
1301
|
},
|
|
883
1302
|
index
|
|
884
|
-
)
|
|
885
|
-
|
|
886
|
-
|
|
1303
|
+
)),
|
|
1304
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1305
|
+
] })
|
|
1306
|
+
] });
|
|
887
1307
|
}
|
|
888
|
-
|
|
889
|
-
|
|
1308
|
+
}
|
|
1309
|
+
)
|
|
890
1310
|
] });
|
|
891
1311
|
};
|
|
892
1312
|
|
|
893
1313
|
// src/components/properties/SelectProperty.tsx
|
|
894
|
-
import { jsx as
|
|
1314
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
895
1315
|
var SingleSelectProperty = ({
|
|
896
1316
|
overwriteTranslation,
|
|
897
1317
|
value,
|
|
@@ -900,11 +1320,12 @@ var SingleSelectProperty = ({
|
|
|
900
1320
|
readOnly = false,
|
|
901
1321
|
softRequired,
|
|
902
1322
|
onRemove,
|
|
1323
|
+
onAddNew,
|
|
903
1324
|
...selectProps
|
|
904
1325
|
}) => {
|
|
905
1326
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
906
1327
|
const hasValue = value !== void 0;
|
|
907
|
-
return /* @__PURE__ */
|
|
1328
|
+
return /* @__PURE__ */ jsx11(
|
|
908
1329
|
PropertyBase,
|
|
909
1330
|
{
|
|
910
1331
|
name,
|
|
@@ -912,22 +1333,45 @@ var SingleSelectProperty = ({
|
|
|
912
1333
|
readOnly,
|
|
913
1334
|
softRequired,
|
|
914
1335
|
hasValue,
|
|
915
|
-
icon: /* @__PURE__ */
|
|
916
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */
|
|
917
|
-
|
|
1336
|
+
icon: /* @__PURE__ */ jsx11(List, { size: 24 }),
|
|
1337
|
+
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx11(
|
|
1338
|
+
Select,
|
|
918
1339
|
{
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1340
|
+
...selectProps,
|
|
1341
|
+
value,
|
|
1342
|
+
options,
|
|
1343
|
+
disabled: readOnly,
|
|
1344
|
+
className: clsx10("w-full"),
|
|
1345
|
+
hintText: `${translation("select")}...`,
|
|
1346
|
+
searchOptions: {
|
|
1347
|
+
sortingFunction: (a, b) => a.value.localeCompare(b.value),
|
|
1348
|
+
...selectProps?.searchOptions
|
|
1349
|
+
},
|
|
1350
|
+
additionalItems: ({ close, search }) => {
|
|
1351
|
+
if (!onAddNew && !search.trim()) {
|
|
1352
|
+
return void 0;
|
|
1353
|
+
}
|
|
1354
|
+
return /* @__PURE__ */ jsx11(
|
|
1355
|
+
SelectTile,
|
|
1356
|
+
{
|
|
1357
|
+
prefix: /* @__PURE__ */ jsx11(Plus, {}),
|
|
1358
|
+
title: { value: `${translation("add")} ${search.trim()}` },
|
|
1359
|
+
onClick: () => {
|
|
1360
|
+
onAddNew(search);
|
|
1361
|
+
close();
|
|
1362
|
+
},
|
|
1363
|
+
disabled: options.some((value2) => value2.value === search.trim())
|
|
1364
|
+
}
|
|
1365
|
+
);
|
|
1366
|
+
},
|
|
1367
|
+
triggerClassName: clsx10(
|
|
1368
|
+
"!border-none",
|
|
922
1369
|
{
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
options,
|
|
926
|
-
isDisabled: readOnly,
|
|
927
|
-
className: clsx8("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
928
|
-
hintText: `${translation("select")}...`
|
|
1370
|
+
"!bg-warning !text-surface-warning": softRequired2 && !hasValue,
|
|
1371
|
+
"!bg-property-title-background": !softRequired2 || hasValue
|
|
929
1372
|
}
|
|
930
|
-
)
|
|
1373
|
+
),
|
|
1374
|
+
hintTextClassName: softRequired2 && !hasValue ? "text-surface-warning" : void 0
|
|
931
1375
|
}
|
|
932
1376
|
)
|
|
933
1377
|
}
|