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