@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
|
@@ -32,8 +32,8 @@ __export(MultiSelectProperty_exports, {
|
|
|
32
32
|
MultiSelectProperty: () => MultiSelectProperty
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(MultiSelectProperty_exports);
|
|
35
|
-
var
|
|
36
|
-
var
|
|
35
|
+
var import_lucide_react7 = require("lucide-react");
|
|
36
|
+
var import_clsx13 = __toESM(require("clsx"));
|
|
37
37
|
|
|
38
38
|
// src/localization/LanguageProvider.tsx
|
|
39
39
|
var import_react2 = require("react");
|
|
@@ -123,9 +123,9 @@ var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
// src/components/user-action/MultiSelect.tsx
|
|
126
|
-
var
|
|
127
|
-
var
|
|
128
|
-
var
|
|
126
|
+
var import_react16 = require("react");
|
|
127
|
+
var import_react17 = require("react");
|
|
128
|
+
var import_clsx11 = __toESM(require("clsx"));
|
|
129
129
|
|
|
130
130
|
// src/components/user-action/Label.tsx
|
|
131
131
|
var import_clsx = __toESM(require("clsx"));
|
|
@@ -145,22 +145,389 @@ var Label = ({
|
|
|
145
145
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { ...props, className: (0, import_clsx.default)(styleMapping[labelType], className), children: children ? children : name });
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
// src/components/
|
|
148
|
+
// src/components/user-action/Select.tsx
|
|
149
|
+
var import_react13 = require("react");
|
|
150
|
+
var import_react14 = require("react");
|
|
151
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
152
|
+
|
|
153
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
154
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
149
155
|
var import_lucide_react = require("lucide-react");
|
|
156
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
157
|
+
var Tile = ({
|
|
158
|
+
title,
|
|
159
|
+
description,
|
|
160
|
+
onClick,
|
|
161
|
+
isSelected = false,
|
|
162
|
+
disabled = false,
|
|
163
|
+
prefix,
|
|
164
|
+
suffix,
|
|
165
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
166
|
+
selectedClassName = " bg-primary/20",
|
|
167
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
168
|
+
className
|
|
169
|
+
}) => {
|
|
170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
className: (0, import_clsx2.default)(
|
|
174
|
+
"flex-row-2 w-full items-center",
|
|
175
|
+
{
|
|
176
|
+
[normalClassName]: !!onClick && !disabled,
|
|
177
|
+
[selectedClassName]: isSelected && !disabled,
|
|
178
|
+
[disabledClassName]: disabled
|
|
179
|
+
},
|
|
180
|
+
className
|
|
181
|
+
),
|
|
182
|
+
onClick: disabled ? void 0 : onClick,
|
|
183
|
+
children: [
|
|
184
|
+
prefix,
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-col-0 w-full", children: [
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { className: (0, import_clsx2.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
187
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: (0, import_clsx2.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
188
|
+
] }),
|
|
189
|
+
suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Check, { size: 24 }) : void 0)
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
196
|
+
var import_react3 = require("react");
|
|
197
|
+
var import_lucide_react2 = require("lucide-react");
|
|
198
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
199
|
+
|
|
200
|
+
// src/util/noop.ts
|
|
201
|
+
var noop = () => void 0;
|
|
202
|
+
|
|
203
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
204
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
205
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
207
|
+
import_lucide_react2.ChevronDown,
|
|
208
|
+
{
|
|
209
|
+
className: (0, import_clsx3.default)(
|
|
210
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
|
|
211
|
+
{ "rotate-180": isExpanded },
|
|
212
|
+
className
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
var Expandable = (0, import_react3.forwardRef)(function Expandable2({
|
|
218
|
+
children,
|
|
219
|
+
label,
|
|
220
|
+
icon,
|
|
221
|
+
isExpanded = false,
|
|
222
|
+
onChange = noop,
|
|
223
|
+
clickOnlyOnHeader = true,
|
|
224
|
+
disabled = false,
|
|
225
|
+
className,
|
|
226
|
+
headerClassName,
|
|
227
|
+
contentClassName
|
|
228
|
+
}, ref) {
|
|
229
|
+
const defaultIcon = (0, import_react3.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
|
|
230
|
+
icon ??= defaultIcon;
|
|
231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
232
|
+
"div",
|
|
233
|
+
{
|
|
234
|
+
ref,
|
|
235
|
+
className: (0, import_clsx3.default)("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
236
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
className: (0, import_clsx3.default)(
|
|
242
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
243
|
+
{
|
|
244
|
+
"group-hover:brightness-97": !isExpanded,
|
|
245
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
246
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
247
|
+
},
|
|
248
|
+
headerClassName
|
|
249
|
+
),
|
|
250
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
251
|
+
children: [
|
|
252
|
+
label,
|
|
253
|
+
icon(isExpanded)
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
className: (0, import_clsx3.default)(
|
|
261
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
262
|
+
{
|
|
263
|
+
"max-h-96 opacity-100 pb-2": isExpanded,
|
|
264
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
265
|
+
},
|
|
266
|
+
contentClassName
|
|
267
|
+
),
|
|
268
|
+
children
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
});
|
|
275
|
+
var ExpandableUncontrolled = (0, import_react3.forwardRef)(function ExpandableUncontrolled2({
|
|
276
|
+
isExpanded,
|
|
277
|
+
onChange = noop,
|
|
278
|
+
...props
|
|
279
|
+
}, ref) {
|
|
280
|
+
const [usedIsExpanded, setUsedIsExpanded] = (0, import_react3.useState)(isExpanded);
|
|
281
|
+
(0, import_react3.useEffect)(() => {
|
|
282
|
+
setUsedIsExpanded(isExpanded);
|
|
283
|
+
}, [isExpanded]);
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
285
|
+
Expandable,
|
|
286
|
+
{
|
|
287
|
+
...props,
|
|
288
|
+
ref,
|
|
289
|
+
isExpanded: usedIsExpanded,
|
|
290
|
+
onChange: (value) => {
|
|
291
|
+
onChange(value);
|
|
292
|
+
setUsedIsExpanded(value);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// src/components/user-action/Menu.tsx
|
|
299
|
+
var import_react6 = require("react");
|
|
150
300
|
var import_clsx4 = __toESM(require("clsx"));
|
|
151
301
|
|
|
302
|
+
// src/hooks/useOutsideClick.ts
|
|
303
|
+
var import_react4 = require("react");
|
|
304
|
+
var useOutsideClick = (refs, handler) => {
|
|
305
|
+
(0, import_react4.useEffect)(() => {
|
|
306
|
+
const listener = (event) => {
|
|
307
|
+
if (event.target === null) return;
|
|
308
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
handler();
|
|
312
|
+
};
|
|
313
|
+
document.addEventListener("mousedown", listener);
|
|
314
|
+
document.addEventListener("touchstart", listener);
|
|
315
|
+
return () => {
|
|
316
|
+
document.removeEventListener("mousedown", listener);
|
|
317
|
+
document.removeEventListener("touchstart", listener);
|
|
318
|
+
};
|
|
319
|
+
}, [refs, handler]);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/hooks/useHoverState.ts
|
|
323
|
+
var import_react5 = require("react");
|
|
324
|
+
var defaultUseHoverStateProps = {
|
|
325
|
+
closingDelay: 200,
|
|
326
|
+
isDisabled: false
|
|
327
|
+
};
|
|
328
|
+
var useHoverState = (props = void 0) => {
|
|
329
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
330
|
+
const [isHovered, setIsHovered] = (0, import_react5.useState)(false);
|
|
331
|
+
const [timer, setTimer] = (0, import_react5.useState)();
|
|
332
|
+
const onMouseEnter = () => {
|
|
333
|
+
if (isDisabled) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
clearTimeout(timer);
|
|
337
|
+
setIsHovered(true);
|
|
338
|
+
};
|
|
339
|
+
const onMouseLeave = () => {
|
|
340
|
+
if (isDisabled) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
setTimer(setTimeout(() => {
|
|
344
|
+
setIsHovered(false);
|
|
345
|
+
}, closingDelay));
|
|
346
|
+
};
|
|
347
|
+
(0, import_react5.useEffect)(() => {
|
|
348
|
+
if (timer) {
|
|
349
|
+
return () => {
|
|
350
|
+
clearTimeout(timer);
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
(0, import_react5.useEffect)(() => {
|
|
355
|
+
if (timer) {
|
|
356
|
+
clearTimeout(timer);
|
|
357
|
+
}
|
|
358
|
+
}, [isDisabled]);
|
|
359
|
+
return {
|
|
360
|
+
isHovered,
|
|
361
|
+
setIsHovered,
|
|
362
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
367
|
+
var resolve = (children, bag) => {
|
|
368
|
+
if (typeof children === "function") {
|
|
369
|
+
return children(bag);
|
|
370
|
+
}
|
|
371
|
+
return children ?? void 0;
|
|
372
|
+
};
|
|
373
|
+
var BagFunctionUtil = {
|
|
374
|
+
resolve
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
// src/hooks/usePopoverPosition.ts
|
|
378
|
+
var defaultPopoverPositionOptions = {
|
|
379
|
+
edgePadding: 16,
|
|
380
|
+
outerGap: 4,
|
|
381
|
+
horizontalAlignment: "leftInside",
|
|
382
|
+
verticalAlignment: "bottomOutside",
|
|
383
|
+
disabled: false
|
|
384
|
+
};
|
|
385
|
+
var usePopoverPosition = (trigger, options) => {
|
|
386
|
+
const {
|
|
387
|
+
edgePadding,
|
|
388
|
+
outerGap,
|
|
389
|
+
verticalAlignment,
|
|
390
|
+
horizontalAlignment,
|
|
391
|
+
disabled
|
|
392
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
393
|
+
if (disabled || !trigger) {
|
|
394
|
+
return {};
|
|
395
|
+
}
|
|
396
|
+
const left = {
|
|
397
|
+
leftOutside: trigger.left - outerGap,
|
|
398
|
+
leftInside: trigger.left,
|
|
399
|
+
rightOutside: trigger.right + outerGap,
|
|
400
|
+
rightInside: trigger.right,
|
|
401
|
+
center: trigger.left + trigger.width / 2
|
|
402
|
+
}[horizontalAlignment];
|
|
403
|
+
const top = {
|
|
404
|
+
topOutside: trigger.top - outerGap,
|
|
405
|
+
topInside: trigger.top,
|
|
406
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
407
|
+
bottomInside: trigger.bottom,
|
|
408
|
+
center: trigger.top + trigger.height / 2
|
|
409
|
+
}[verticalAlignment];
|
|
410
|
+
const translateX = {
|
|
411
|
+
leftOutside: "-100%",
|
|
412
|
+
leftInside: void 0,
|
|
413
|
+
rightOutside: void 0,
|
|
414
|
+
rightInside: "-100%",
|
|
415
|
+
center: "-50%"
|
|
416
|
+
}[horizontalAlignment];
|
|
417
|
+
const translateY = {
|
|
418
|
+
topOutside: "-100%",
|
|
419
|
+
topInside: void 0,
|
|
420
|
+
bottomOutside: void 0,
|
|
421
|
+
bottomInside: "-100%",
|
|
422
|
+
center: "-50%"
|
|
423
|
+
}[verticalAlignment];
|
|
424
|
+
return {
|
|
425
|
+
left: Math.max(left, edgePadding),
|
|
426
|
+
top: Math.max(top, edgePadding),
|
|
427
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// src/components/user-action/Menu.tsx
|
|
432
|
+
var import_react_dom = require("react-dom");
|
|
433
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
434
|
+
function getScrollableParents(element) {
|
|
435
|
+
const scrollables = [];
|
|
436
|
+
let parent = element.parentElement;
|
|
437
|
+
while (parent) {
|
|
438
|
+
scrollables.push(parent);
|
|
439
|
+
parent = parent.parentElement;
|
|
440
|
+
}
|
|
441
|
+
return scrollables;
|
|
442
|
+
}
|
|
443
|
+
var Menu = ({
|
|
444
|
+
trigger,
|
|
445
|
+
children,
|
|
446
|
+
alignmentHorizontal = "leftInside",
|
|
447
|
+
alignmentVertical = "bottomOutside",
|
|
448
|
+
showOnHover = false,
|
|
449
|
+
disabled = false,
|
|
450
|
+
menuClassName = ""
|
|
451
|
+
}) => {
|
|
452
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
453
|
+
const triggerRef = (0, import_react6.useRef)(null);
|
|
454
|
+
const menuRef = (0, import_react6.useRef)(null);
|
|
455
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
456
|
+
const [isHidden, setIsHidden] = (0, import_react6.useState)(true);
|
|
457
|
+
const bag = {
|
|
458
|
+
isOpen,
|
|
459
|
+
close: () => setIsOpen(false),
|
|
460
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
461
|
+
disabled
|
|
462
|
+
};
|
|
463
|
+
const menuPosition = usePopoverPosition(
|
|
464
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
465
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
466
|
+
);
|
|
467
|
+
(0, import_react6.useEffect)(() => {
|
|
468
|
+
if (!isOpen) return;
|
|
469
|
+
const triggerEl = triggerRef.current;
|
|
470
|
+
if (!triggerEl) return;
|
|
471
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
472
|
+
const close = () => setIsOpen(false);
|
|
473
|
+
scrollableParents.forEach((parent) => {
|
|
474
|
+
parent.addEventListener("scroll", close);
|
|
475
|
+
});
|
|
476
|
+
window.addEventListener("resize", close);
|
|
477
|
+
return () => {
|
|
478
|
+
scrollableParents.forEach((parent) => {
|
|
479
|
+
parent.removeEventListener("scroll", close);
|
|
480
|
+
});
|
|
481
|
+
window.removeEventListener("resize", close);
|
|
482
|
+
};
|
|
483
|
+
}, [isOpen, setIsOpen]);
|
|
484
|
+
(0, import_react6.useEffect)(() => {
|
|
485
|
+
if (isOpen) {
|
|
486
|
+
setIsHidden(false);
|
|
487
|
+
}
|
|
488
|
+
}, [isOpen]);
|
|
489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
490
|
+
trigger(bag, triggerRef),
|
|
491
|
+
(0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
492
|
+
"div",
|
|
493
|
+
{
|
|
494
|
+
ref: menuRef,
|
|
495
|
+
onClick: (e) => e.stopPropagation(),
|
|
496
|
+
className: (0, import_clsx4.default)(
|
|
497
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
498
|
+
{
|
|
499
|
+
"animate-pop-in": isOpen,
|
|
500
|
+
"animate-pop-out": !isOpen,
|
|
501
|
+
"hidden": isHidden
|
|
502
|
+
},
|
|
503
|
+
menuClassName
|
|
504
|
+
),
|
|
505
|
+
onAnimationEnd: () => {
|
|
506
|
+
if (!isOpen) {
|
|
507
|
+
setIsHidden(true);
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
style: {
|
|
511
|
+
...menuPosition
|
|
512
|
+
},
|
|
513
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
514
|
+
}
|
|
515
|
+
), document.body)
|
|
516
|
+
] });
|
|
517
|
+
};
|
|
518
|
+
|
|
152
519
|
// src/components/user-action/Input.tsx
|
|
153
|
-
var
|
|
154
|
-
var
|
|
520
|
+
var import_react10 = require("react");
|
|
521
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
155
522
|
|
|
156
523
|
// src/hooks/useDelay.ts
|
|
157
|
-
var
|
|
524
|
+
var import_react7 = require("react");
|
|
158
525
|
var defaultOptions = {
|
|
159
526
|
delay: 3e3,
|
|
160
527
|
disabled: false
|
|
161
528
|
};
|
|
162
529
|
function useDelay(options) {
|
|
163
|
-
const [timer, setTimer] = (0,
|
|
530
|
+
const [timer, setTimer] = (0, import_react7.useState)(void 0);
|
|
164
531
|
const { delay, disabled } = {
|
|
165
532
|
...defaultOptions,
|
|
166
533
|
...options
|
|
@@ -179,28 +546,24 @@ function useDelay(options) {
|
|
|
179
546
|
setTimer(void 0);
|
|
180
547
|
}, delay));
|
|
181
548
|
};
|
|
182
|
-
(0,
|
|
549
|
+
(0, import_react7.useEffect)(() => {
|
|
183
550
|
return () => {
|
|
184
551
|
clearTimeout(timer);
|
|
185
552
|
};
|
|
186
553
|
}, [timer]);
|
|
187
|
-
(0,
|
|
554
|
+
(0, import_react7.useEffect)(() => {
|
|
188
555
|
if (disabled) {
|
|
189
556
|
clearTimeout(timer);
|
|
190
557
|
setTimer(void 0);
|
|
191
558
|
}
|
|
192
559
|
}, [disabled, timer]);
|
|
193
|
-
console.log(timer);
|
|
194
560
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
195
561
|
}
|
|
196
562
|
|
|
197
|
-
// src/util/noop.ts
|
|
198
|
-
var noop = () => void 0;
|
|
199
|
-
|
|
200
563
|
// src/hooks/useFocusManagement.ts
|
|
201
|
-
var
|
|
564
|
+
var import_react8 = require("react");
|
|
202
565
|
function useFocusManagement() {
|
|
203
|
-
const getFocusableElements = (0,
|
|
566
|
+
const getFocusableElements = (0, import_react8.useCallback)(() => {
|
|
204
567
|
return Array.from(
|
|
205
568
|
document.querySelectorAll(
|
|
206
569
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -209,7 +572,7 @@ function useFocusManagement() {
|
|
|
209
572
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
210
573
|
);
|
|
211
574
|
}, []);
|
|
212
|
-
const getNextFocusElement = (0,
|
|
575
|
+
const getNextFocusElement = (0, import_react8.useCallback)(() => {
|
|
213
576
|
const elements = getFocusableElements();
|
|
214
577
|
if (elements.length === 0) {
|
|
215
578
|
return void 0;
|
|
@@ -221,11 +584,11 @@ function useFocusManagement() {
|
|
|
221
584
|
}
|
|
222
585
|
return nextElement;
|
|
223
586
|
}, [getFocusableElements]);
|
|
224
|
-
const focusNext = (0,
|
|
587
|
+
const focusNext = (0, import_react8.useCallback)(() => {
|
|
225
588
|
const nextElement = getNextFocusElement();
|
|
226
589
|
nextElement?.focus();
|
|
227
590
|
}, [getNextFocusElement]);
|
|
228
|
-
const getPreviousFocusElement = (0,
|
|
591
|
+
const getPreviousFocusElement = (0, import_react8.useCallback)(() => {
|
|
229
592
|
const elements = getFocusableElements();
|
|
230
593
|
if (elements.length === 0) {
|
|
231
594
|
return void 0;
|
|
@@ -241,7 +604,7 @@ function useFocusManagement() {
|
|
|
241
604
|
}
|
|
242
605
|
return previousElement;
|
|
243
606
|
}, [getFocusableElements]);
|
|
244
|
-
const focusPrevious = (0,
|
|
607
|
+
const focusPrevious = (0, import_react8.useCallback)(() => {
|
|
245
608
|
const previousElement = getPreviousFocusElement();
|
|
246
609
|
if (previousElement) previousElement.focus();
|
|
247
610
|
}, [getPreviousFocusElement]);
|
|
@@ -255,10 +618,10 @@ function useFocusManagement() {
|
|
|
255
618
|
}
|
|
256
619
|
|
|
257
620
|
// src/hooks/useFocusOnceVisible.ts
|
|
258
|
-
var
|
|
621
|
+
var import_react9 = __toESM(require("react"));
|
|
259
622
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
260
|
-
const [hasUsedFocus, setHasUsedFocus] =
|
|
261
|
-
(0,
|
|
623
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react9.default.useState(false);
|
|
624
|
+
(0, import_react9.useEffect)(() => {
|
|
262
625
|
if (disable || hasUsedFocus) {
|
|
263
626
|
return;
|
|
264
627
|
}
|
|
@@ -278,9 +641,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
278
641
|
};
|
|
279
642
|
|
|
280
643
|
// src/components/user-action/Input.tsx
|
|
281
|
-
var
|
|
644
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
282
645
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
283
|
-
return (0,
|
|
646
|
+
return (0, import_clsx5.default)(
|
|
284
647
|
"px-2 py-1.5 rounded-md border-2",
|
|
285
648
|
{
|
|
286
649
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -294,7 +657,7 @@ var defaultEditCompleteOptions = {
|
|
|
294
657
|
afterDelay: true,
|
|
295
658
|
delay: 2500
|
|
296
659
|
};
|
|
297
|
-
var Input = (0,
|
|
660
|
+
var Input = (0, import_react10.forwardRef)(function Input2({
|
|
298
661
|
id,
|
|
299
662
|
type = "text",
|
|
300
663
|
value,
|
|
@@ -317,10 +680,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
317
680
|
restartTimer,
|
|
318
681
|
clearTimer
|
|
319
682
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
320
|
-
const innerRef = (0,
|
|
683
|
+
const innerRef = (0, import_react10.useRef)(null);
|
|
321
684
|
const { focusNext } = useFocusManagement();
|
|
322
685
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
323
|
-
(0,
|
|
686
|
+
(0, import_react10.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
324
687
|
const handleKeyDown = (e) => {
|
|
325
688
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
326
689
|
e.preventDefault();
|
|
@@ -328,9 +691,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
328
691
|
focusNext();
|
|
329
692
|
}
|
|
330
693
|
};
|
|
331
|
-
return /* @__PURE__ */ (0,
|
|
332
|
-
label && /* @__PURE__ */ (0,
|
|
333
|
-
/* @__PURE__ */ (0,
|
|
694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)({ "w-full": expanded }, containerClassName), children: [
|
|
695
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx5.default)("mb-1", label.className) }),
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
334
697
|
"input",
|
|
335
698
|
{
|
|
336
699
|
...restProps,
|
|
@@ -339,7 +702,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
339
702
|
id,
|
|
340
703
|
type,
|
|
341
704
|
disabled,
|
|
342
|
-
className: (0,
|
|
705
|
+
className: (0, import_clsx5.default)(getInputClassName({ disabled }), className),
|
|
343
706
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
344
707
|
onBlur: (event) => {
|
|
345
708
|
onBlur?.(event);
|
|
@@ -369,7 +732,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
369
732
|
)
|
|
370
733
|
] });
|
|
371
734
|
});
|
|
372
|
-
var FormInput = (0,
|
|
735
|
+
var FormInput = (0, import_react10.forwardRef)(function FormInput2({
|
|
373
736
|
id,
|
|
374
737
|
labelText,
|
|
375
738
|
errorText,
|
|
@@ -381,114 +744,232 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
|
|
|
381
744
|
disabled,
|
|
382
745
|
...restProps
|
|
383
746
|
}, ref) {
|
|
384
|
-
const input = /* @__PURE__ */ (0,
|
|
747
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
385
748
|
"input",
|
|
386
749
|
{
|
|
387
750
|
...restProps,
|
|
388
751
|
ref,
|
|
389
752
|
id,
|
|
390
753
|
disabled,
|
|
391
|
-
className: (0,
|
|
754
|
+
className: (0, import_clsx5.default)(
|
|
392
755
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
393
756
|
className
|
|
394
757
|
)
|
|
395
758
|
}
|
|
396
759
|
);
|
|
397
|
-
return /* @__PURE__ */ (0,
|
|
398
|
-
labelText && /* @__PURE__ */ (0,
|
|
760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)("flex flex-col gap-y-1", containerClassName), children: [
|
|
761
|
+
labelText && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { htmlFor: id, className: (0, import_clsx5.default)("textstyle-label-md", labelClassName), children: [
|
|
399
762
|
labelText,
|
|
400
|
-
required && /* @__PURE__ */ (0,
|
|
763
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
401
764
|
] }),
|
|
402
765
|
input,
|
|
403
|
-
errorText && /* @__PURE__ */ (0,
|
|
766
|
+
errorText && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: (0, import_clsx5.default)("text-negative", errorClassName), children: errorText })
|
|
404
767
|
] });
|
|
405
768
|
});
|
|
406
769
|
|
|
407
|
-
// src/
|
|
408
|
-
var
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
"
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
770
|
+
// src/localization/defaults/form.ts
|
|
771
|
+
var formTranslation = {
|
|
772
|
+
en: {
|
|
773
|
+
add: "Add",
|
|
774
|
+
all: "All",
|
|
775
|
+
apply: "Apply",
|
|
776
|
+
back: "Back",
|
|
777
|
+
cancel: "Cancel",
|
|
778
|
+
change: "Change",
|
|
779
|
+
clear: "Clear",
|
|
780
|
+
click: "Click",
|
|
781
|
+
clickToCopy: "Click to Copy",
|
|
782
|
+
close: "Close",
|
|
783
|
+
confirm: "Confirm",
|
|
784
|
+
copy: "Copy",
|
|
785
|
+
copied: "Copied",
|
|
786
|
+
create: "Create",
|
|
787
|
+
decline: "Decline",
|
|
788
|
+
delete: "Delete",
|
|
789
|
+
discard: "Discard",
|
|
790
|
+
discardChanges: "Discard Changes",
|
|
791
|
+
done: "Done",
|
|
792
|
+
edit: "Edit",
|
|
793
|
+
enterText: "Enter text here",
|
|
794
|
+
error: "Error",
|
|
795
|
+
exit: "Exit",
|
|
796
|
+
fieldRequiredError: "This field is required.",
|
|
797
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
798
|
+
less: "Less",
|
|
799
|
+
loading: "Loading",
|
|
800
|
+
maxLengthError: "Maximum length exceeded.",
|
|
801
|
+
minLengthError: "Minimum length not met.",
|
|
802
|
+
more: "More",
|
|
803
|
+
next: "Next",
|
|
804
|
+
no: "No",
|
|
805
|
+
none: "None",
|
|
806
|
+
of: "of",
|
|
807
|
+
optional: "Optional",
|
|
808
|
+
pleaseWait: "Please wait...",
|
|
809
|
+
previous: "Previous",
|
|
810
|
+
remove: "Remove",
|
|
811
|
+
required: "Required",
|
|
812
|
+
reset: "Reset",
|
|
813
|
+
save: "Save",
|
|
814
|
+
saved: "Saved",
|
|
815
|
+
search: "Search",
|
|
816
|
+
select: "Select",
|
|
817
|
+
selectOption: "Select an option",
|
|
818
|
+
show: "Show",
|
|
819
|
+
showMore: "Show more",
|
|
820
|
+
showLess: "Show less",
|
|
821
|
+
submit: "Submit",
|
|
822
|
+
success: "Success",
|
|
823
|
+
update: "Update",
|
|
824
|
+
unsavedChanges: "Unsaved Changes",
|
|
825
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
826
|
+
yes: "Yes"
|
|
827
|
+
},
|
|
828
|
+
de: {
|
|
829
|
+
add: "Hinzuf\xFCgen",
|
|
830
|
+
all: "Alle",
|
|
831
|
+
apply: "Anwenden",
|
|
832
|
+
back: "Zur\xFCck",
|
|
833
|
+
cancel: "Abbrechen",
|
|
834
|
+
change: "\xC4ndern",
|
|
835
|
+
clear: "L\xF6schen",
|
|
836
|
+
click: "Klicken",
|
|
837
|
+
clickToCopy: "Zum kopieren klicken",
|
|
838
|
+
close: "Schlie\xDFen",
|
|
839
|
+
confirm: "Best\xE4tigen",
|
|
840
|
+
copy: "Kopieren",
|
|
841
|
+
copied: "Kopiert",
|
|
842
|
+
create: "Erstellen",
|
|
843
|
+
decline: "Ablehnen",
|
|
844
|
+
delete: "L\xF6schen",
|
|
845
|
+
discard: "Verwerfen",
|
|
846
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
847
|
+
done: "Fertig",
|
|
848
|
+
edit: "Bearbeiten",
|
|
849
|
+
enterText: "Text hier eingeben",
|
|
850
|
+
error: "Fehler",
|
|
851
|
+
exit: "Beenden",
|
|
852
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
853
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
854
|
+
less: "Weniger",
|
|
855
|
+
loading: "L\xE4dt",
|
|
856
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
857
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
858
|
+
more: "Mehr",
|
|
859
|
+
next: "Weiter",
|
|
860
|
+
no: "Nein",
|
|
861
|
+
none: "Nichts",
|
|
862
|
+
of: "von",
|
|
863
|
+
optional: "Optional",
|
|
864
|
+
pleaseWait: "Bitte warten...",
|
|
865
|
+
previous: "Vorherige",
|
|
866
|
+
remove: "Entfernen",
|
|
867
|
+
required: "Erforderlich",
|
|
868
|
+
reset: "Zur\xFCcksetzen",
|
|
869
|
+
save: "Speichern",
|
|
870
|
+
saved: "Gespeichert",
|
|
871
|
+
search: "Suche",
|
|
872
|
+
select: "Select",
|
|
873
|
+
selectOption: "Option ausw\xE4hlen",
|
|
874
|
+
show: "Anzeigen",
|
|
875
|
+
showMore: "Mehr anzeigen",
|
|
876
|
+
showLess: "Weniger anzeigen",
|
|
877
|
+
submit: "Abschicken",
|
|
878
|
+
success: "Erfolg",
|
|
879
|
+
update: "Update",
|
|
880
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
881
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
882
|
+
yes: "Ja"
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
// src/components/user-action/Button.tsx
|
|
887
|
+
var import_react11 = require("react");
|
|
888
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
889
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
890
|
+
var ButtonColorUtil = {
|
|
891
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
892
|
+
text: ["primary", "negative", "neutral"],
|
|
893
|
+
outline: ["primary"]
|
|
894
|
+
};
|
|
895
|
+
var IconButtonUtil = {
|
|
896
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
897
|
+
};
|
|
898
|
+
var paddingMapping = {
|
|
899
|
+
small: "btn-sm",
|
|
900
|
+
medium: "btn-md",
|
|
901
|
+
large: "btn-lg"
|
|
902
|
+
};
|
|
903
|
+
var iconPaddingMapping = {
|
|
904
|
+
tiny: "icon-btn-xs",
|
|
905
|
+
small: "icon-btn-sm",
|
|
906
|
+
medium: "icon-btn-md",
|
|
907
|
+
large: "icon-btn-lg"
|
|
908
|
+
};
|
|
909
|
+
var ButtonUtil = {
|
|
910
|
+
paddingMapping,
|
|
911
|
+
iconPaddingMapping
|
|
912
|
+
};
|
|
913
|
+
var SolidButton = (0, import_react11.forwardRef)(function SolidButton2({
|
|
914
|
+
children,
|
|
915
|
+
disabled = false,
|
|
916
|
+
color = "primary",
|
|
917
|
+
size = "medium",
|
|
918
|
+
startIcon,
|
|
919
|
+
endIcon,
|
|
920
|
+
onClick,
|
|
921
|
+
className,
|
|
922
|
+
...restProps
|
|
923
|
+
}, ref) {
|
|
924
|
+
const colorClasses = {
|
|
925
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
926
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
927
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
928
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
929
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
930
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
931
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
932
|
+
}[color];
|
|
933
|
+
const iconColorClasses = {
|
|
934
|
+
primary: "text-button-solid-primary-icon",
|
|
935
|
+
secondary: "text-button-solid-secondary-icon",
|
|
936
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
937
|
+
positive: "text-button-solid-positive-icon",
|
|
938
|
+
warning: "text-button-solid-warning-icon",
|
|
939
|
+
negative: "text-button-solid-negative-icon",
|
|
940
|
+
neutral: "text-button-solid-neutral-icon"
|
|
941
|
+
}[color];
|
|
942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
943
|
+
"button",
|
|
944
|
+
{
|
|
945
|
+
ref,
|
|
946
|
+
onClick,
|
|
947
|
+
disabled,
|
|
948
|
+
className: (0, import_clsx6.default)(
|
|
949
|
+
{
|
|
950
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
951
|
+
[(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
952
|
+
},
|
|
953
|
+
ButtonUtil.paddingMapping[size],
|
|
954
|
+
className
|
|
955
|
+
),
|
|
956
|
+
...restProps,
|
|
957
|
+
children: [
|
|
958
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
959
|
+
"span",
|
|
960
|
+
{
|
|
961
|
+
className: (0, import_clsx6.default)({
|
|
962
|
+
[iconColorClasses]: !disabled,
|
|
963
|
+
[`text-disabled-icon`]: disabled
|
|
483
964
|
}),
|
|
484
965
|
children: startIcon
|
|
485
966
|
}
|
|
486
967
|
),
|
|
487
968
|
children,
|
|
488
|
-
endIcon && /* @__PURE__ */ (0,
|
|
969
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
489
970
|
"span",
|
|
490
971
|
{
|
|
491
|
-
className: (0,
|
|
972
|
+
className: (0, import_clsx6.default)({
|
|
492
973
|
[iconColorClasses]: !disabled,
|
|
493
974
|
[`text-disabled-icon`]: disabled
|
|
494
975
|
}),
|
|
@@ -498,7 +979,7 @@ var SolidButton = ({
|
|
|
498
979
|
]
|
|
499
980
|
}
|
|
500
981
|
);
|
|
501
|
-
};
|
|
982
|
+
});
|
|
502
983
|
var TextButton = ({
|
|
503
984
|
children,
|
|
504
985
|
disabled = false,
|
|
@@ -520,25 +1001,25 @@ var TextButton = ({
|
|
|
520
1001
|
negative: "text-button-text-negative-icon",
|
|
521
1002
|
neutral: "text-button-text-neutral-icon"
|
|
522
1003
|
}[color];
|
|
523
|
-
return /* @__PURE__ */ (0,
|
|
1004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
524
1005
|
"button",
|
|
525
1006
|
{
|
|
526
|
-
onClick
|
|
527
|
-
disabled
|
|
528
|
-
className: (0,
|
|
1007
|
+
onClick,
|
|
1008
|
+
disabled,
|
|
1009
|
+
className: (0, import_clsx6.default)(
|
|
529
1010
|
{
|
|
530
1011
|
"text-disabled-text cursor-not-allowed": disabled,
|
|
531
|
-
[(0,
|
|
1012
|
+
[(0, import_clsx6.default)(colorClasses, "hover:bg-button-text-hover-background")]: !disabled
|
|
532
1013
|
},
|
|
533
1014
|
ButtonUtil.paddingMapping[size],
|
|
534
1015
|
className
|
|
535
1016
|
),
|
|
536
1017
|
...restProps,
|
|
537
1018
|
children: [
|
|
538
|
-
startIcon && /* @__PURE__ */ (0,
|
|
1019
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
539
1020
|
"span",
|
|
540
1021
|
{
|
|
541
|
-
className: (0,
|
|
1022
|
+
className: (0, import_clsx6.default)({
|
|
542
1023
|
[iconColorClasses]: !disabled,
|
|
543
1024
|
[`text-disabled-icon`]: disabled
|
|
544
1025
|
}),
|
|
@@ -546,10 +1027,10 @@ var TextButton = ({
|
|
|
546
1027
|
}
|
|
547
1028
|
),
|
|
548
1029
|
children,
|
|
549
|
-
endIcon && /* @__PURE__ */ (0,
|
|
1030
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
550
1031
|
"span",
|
|
551
1032
|
{
|
|
552
|
-
className: (0,
|
|
1033
|
+
className: (0, import_clsx6.default)({
|
|
553
1034
|
[iconColorClasses]: !disabled,
|
|
554
1035
|
[`text-disabled-icon`]: disabled
|
|
555
1036
|
}),
|
|
@@ -565,7 +1046,6 @@ var IconButton = ({
|
|
|
565
1046
|
disabled = false,
|
|
566
1047
|
color = "primary",
|
|
567
1048
|
size = "medium",
|
|
568
|
-
onClick,
|
|
569
1049
|
className,
|
|
570
1050
|
...restProps
|
|
571
1051
|
}) => {
|
|
@@ -579,17 +1059,16 @@ var IconButton = ({
|
|
|
579
1059
|
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
580
1060
|
transparent: "bg-transparent"
|
|
581
1061
|
}[color];
|
|
582
|
-
return /* @__PURE__ */ (0,
|
|
1062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
583
1063
|
"button",
|
|
584
1064
|
{
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
className: (0, import_clsx3.default)(
|
|
1065
|
+
disabled,
|
|
1066
|
+
className: (0, import_clsx6.default)(
|
|
588
1067
|
{
|
|
589
1068
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
590
1069
|
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
591
1070
|
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
592
|
-
[(0,
|
|
1071
|
+
[(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
593
1072
|
},
|
|
594
1073
|
ButtonUtil.iconPaddingMapping[size],
|
|
595
1074
|
className
|
|
@@ -600,17 +1079,41 @@ var IconButton = ({
|
|
|
600
1079
|
);
|
|
601
1080
|
};
|
|
602
1081
|
|
|
1082
|
+
// src/components/user-action/SearchBar.tsx
|
|
1083
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1084
|
+
var import_clsx7 = require("clsx");
|
|
1085
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1086
|
+
var SearchBar = ({
|
|
1087
|
+
placeholder,
|
|
1088
|
+
onSearch,
|
|
1089
|
+
disableOnSearch,
|
|
1090
|
+
containerClassName,
|
|
1091
|
+
...inputProps
|
|
1092
|
+
}) => {
|
|
1093
|
+
const translation = useTranslation([formTranslation]);
|
|
1094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.clsx)("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1096
|
+
Input,
|
|
1097
|
+
{
|
|
1098
|
+
...inputProps,
|
|
1099
|
+
placeholder: placeholder ?? translation("search")
|
|
1100
|
+
}
|
|
1101
|
+
),
|
|
1102
|
+
onSearch && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Search, { className: "w-full h-full" }) })
|
|
1103
|
+
] });
|
|
1104
|
+
};
|
|
1105
|
+
|
|
603
1106
|
// src/hooks/useSearch.ts
|
|
604
|
-
var
|
|
1107
|
+
var import_react12 = require("react");
|
|
605
1108
|
|
|
606
1109
|
// src/util/simpleSearch.ts
|
|
607
|
-
var
|
|
1110
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
608
1111
|
return objects.filter((object) => {
|
|
609
1112
|
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
610
1113
|
if (!mappedSearchKeywords) {
|
|
611
1114
|
return true;
|
|
612
1115
|
}
|
|
613
|
-
return !!mappedSearchKeywords.find((value) => value.includes(
|
|
1116
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
614
1117
|
});
|
|
615
1118
|
};
|
|
616
1119
|
|
|
@@ -618,225 +1121,78 @@ var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
|
618
1121
|
var useSearch = ({
|
|
619
1122
|
list,
|
|
620
1123
|
initialSearch,
|
|
621
|
-
searchMapping
|
|
1124
|
+
searchMapping,
|
|
1125
|
+
additionalSearchTags,
|
|
1126
|
+
isSearchInstant = true,
|
|
1127
|
+
sortingFunction,
|
|
1128
|
+
filter,
|
|
1129
|
+
disabled = false
|
|
622
1130
|
}) => {
|
|
623
|
-
const [
|
|
624
|
-
const [
|
|
625
|
-
(0,
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
1131
|
+
const [search, setSearch] = (0, import_react12.useState)(initialSearch ?? "");
|
|
1132
|
+
const [result, setResult] = (0, import_react12.useState)(list);
|
|
1133
|
+
const searchTags = (0, import_react12.useMemo)(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1134
|
+
const updateSearch = (0, import_react12.useCallback)((newSearch) => {
|
|
1135
|
+
const usedSearch = newSearch ?? search;
|
|
1136
|
+
if (newSearch) {
|
|
1137
|
+
setSearch(search);
|
|
1138
|
+
}
|
|
1139
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1140
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1141
|
+
(0, import_react12.useEffect)(() => {
|
|
1142
|
+
if (isSearchInstant) {
|
|
1143
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1144
|
+
}
|
|
1145
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1146
|
+
const filteredResult = (0, import_react12.useMemo)(() => {
|
|
1147
|
+
if (!filter) {
|
|
1148
|
+
return result;
|
|
1149
|
+
}
|
|
1150
|
+
return result.filter(filter);
|
|
1151
|
+
}, [result, filter]);
|
|
1152
|
+
const sortedAndFilteredResult = (0, import_react12.useMemo)(() => {
|
|
1153
|
+
if (!sortingFunction) {
|
|
1154
|
+
return filteredResult;
|
|
1155
|
+
}
|
|
1156
|
+
return filteredResult.sort(sortingFunction);
|
|
1157
|
+
}, [filteredResult, sortingFunction]);
|
|
1158
|
+
const usedResult = (0, import_react12.useMemo)(() => {
|
|
1159
|
+
if (!disabled) {
|
|
1160
|
+
return sortedAndFilteredResult;
|
|
1161
|
+
}
|
|
1162
|
+
return list;
|
|
1163
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
632
1164
|
return {
|
|
633
|
-
result,
|
|
634
|
-
hasResult:
|
|
635
|
-
allItems:
|
|
636
|
-
|
|
1165
|
+
result: usedResult,
|
|
1166
|
+
hasResult: usedResult.length > 0,
|
|
1167
|
+
allItems: list,
|
|
1168
|
+
updateSearch,
|
|
637
1169
|
search,
|
|
638
1170
|
setSearch
|
|
639
1171
|
};
|
|
640
1172
|
};
|
|
641
1173
|
|
|
642
|
-
// src/
|
|
643
|
-
var
|
|
644
|
-
|
|
645
|
-
all: "All",
|
|
646
|
-
apply: "Apply",
|
|
647
|
-
back: "Back",
|
|
648
|
-
cancel: "Cancel",
|
|
649
|
-
change: "Change",
|
|
650
|
-
clear: "Clear",
|
|
651
|
-
click: "Click",
|
|
652
|
-
clickToCopy: "Click to Copy",
|
|
653
|
-
close: "Close",
|
|
654
|
-
confirm: "Confirm",
|
|
655
|
-
copy: "Copy",
|
|
656
|
-
copied: "Copied",
|
|
657
|
-
decline: "Decline",
|
|
658
|
-
delete: "Delete",
|
|
659
|
-
discard: "Discard",
|
|
660
|
-
discardChanges: "Discard Changes",
|
|
661
|
-
done: "Done",
|
|
662
|
-
edit: "Edit",
|
|
663
|
-
enterText: "Enter text here",
|
|
664
|
-
error: "Error",
|
|
665
|
-
exit: "Exit",
|
|
666
|
-
fieldRequiredError: "This field is required.",
|
|
667
|
-
invalidEmailError: "Please enter a valid email address.",
|
|
668
|
-
less: "Less",
|
|
669
|
-
loading: "Loading",
|
|
670
|
-
maxLengthError: "Maximum length exceeded.",
|
|
671
|
-
minLengthError: "Minimum length not met.",
|
|
672
|
-
more: "More",
|
|
673
|
-
next: "Next",
|
|
674
|
-
no: "No",
|
|
675
|
-
none: "None",
|
|
676
|
-
of: "of",
|
|
677
|
-
optional: "Optional",
|
|
678
|
-
pleaseWait: "Please wait...",
|
|
679
|
-
previous: "Previous",
|
|
680
|
-
remove: "Remove",
|
|
681
|
-
required: "Required",
|
|
682
|
-
reset: "Reset",
|
|
683
|
-
save: "Save",
|
|
684
|
-
saved: "Saved",
|
|
685
|
-
search: "Search",
|
|
686
|
-
select: "Select",
|
|
687
|
-
selectOption: "Select an option",
|
|
688
|
-
show: "Show",
|
|
689
|
-
showMore: "Show more",
|
|
690
|
-
showLess: "Show less",
|
|
691
|
-
submit: "Submit",
|
|
692
|
-
success: "Success",
|
|
693
|
-
update: "Update",
|
|
694
|
-
unsavedChanges: "Unsaved Changes",
|
|
695
|
-
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
696
|
-
yes: "Yes"
|
|
697
|
-
},
|
|
698
|
-
de: {
|
|
699
|
-
all: "Alle",
|
|
700
|
-
apply: "Anwenden",
|
|
701
|
-
back: "Zur\xFCck",
|
|
702
|
-
cancel: "Abbrechen",
|
|
703
|
-
change: "\xC4ndern",
|
|
704
|
-
clear: "L\xF6schen",
|
|
705
|
-
click: "Klicken",
|
|
706
|
-
clickToCopy: "Zum kopieren klicken",
|
|
707
|
-
close: "Schlie\xDFen",
|
|
708
|
-
confirm: "Best\xE4tigen",
|
|
709
|
-
copy: "Kopieren",
|
|
710
|
-
copied: "Kopiert",
|
|
711
|
-
decline: "Ablehnen",
|
|
712
|
-
delete: "L\xF6schen",
|
|
713
|
-
discard: "Verwerfen",
|
|
714
|
-
discardChanges: "\xC4nderungen Verwerfen",
|
|
715
|
-
done: "Fertig",
|
|
716
|
-
edit: "Bearbeiten",
|
|
717
|
-
enterText: "Text hier eingeben",
|
|
718
|
-
error: "Fehler",
|
|
719
|
-
exit: "Beenden",
|
|
720
|
-
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
721
|
-
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
722
|
-
less: "Weniger",
|
|
723
|
-
loading: "L\xE4dt",
|
|
724
|
-
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
725
|
-
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
726
|
-
more: "Mehr",
|
|
727
|
-
next: "Weiter",
|
|
728
|
-
no: "Nein",
|
|
729
|
-
none: "Nichts",
|
|
730
|
-
of: "von",
|
|
731
|
-
optional: "Optional",
|
|
732
|
-
pleaseWait: "Bitte warten...",
|
|
733
|
-
previous: "Vorherige",
|
|
734
|
-
remove: "Entfernen",
|
|
735
|
-
required: "Erforderlich",
|
|
736
|
-
reset: "Zur\xFCcksetzen",
|
|
737
|
-
save: "Speichern",
|
|
738
|
-
saved: "Gespeichert",
|
|
739
|
-
search: "Suche",
|
|
740
|
-
select: "Select",
|
|
741
|
-
selectOption: "Option ausw\xE4hlen",
|
|
742
|
-
show: "Anzeigen",
|
|
743
|
-
showMore: "Mehr anzeigen",
|
|
744
|
-
showLess: "Weniger anzeigen",
|
|
745
|
-
submit: "Abschicken",
|
|
746
|
-
success: "Erfolg",
|
|
747
|
-
update: "Update",
|
|
748
|
-
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
749
|
-
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
750
|
-
yes: "Ja"
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
// src/components/layout-and-navigation/SearchableList.tsx
|
|
755
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
756
|
-
var defaultSearchableListTranslation = {
|
|
757
|
-
en: {
|
|
758
|
-
nothingFound: "Nothing found"
|
|
759
|
-
},
|
|
760
|
-
de: {
|
|
761
|
-
nothingFound: "Nichts gefunden"
|
|
762
|
-
}
|
|
763
|
-
};
|
|
764
|
-
var SearchableList = ({
|
|
765
|
-
overwriteTranslation,
|
|
766
|
-
list,
|
|
767
|
-
initialSearch = "",
|
|
768
|
-
searchMapping,
|
|
769
|
-
autoFocus,
|
|
770
|
-
minimumItemsForSearch = 6,
|
|
771
|
-
itemMapper,
|
|
1174
|
+
// src/components/user-action/Select.tsx
|
|
1175
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1176
|
+
var SelectTile = ({
|
|
772
1177
|
className,
|
|
773
|
-
|
|
774
|
-
}) => {
|
|
775
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
776
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
777
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("col gap-y-2", className), children: [
|
|
778
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
779
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
780
|
-
Input,
|
|
781
|
-
{
|
|
782
|
-
value: search,
|
|
783
|
-
onChangeText: setSearch,
|
|
784
|
-
placeholder: translation("search"),
|
|
785
|
-
autoFocus,
|
|
786
|
-
className: "w-full"
|
|
787
|
-
}
|
|
788
|
-
),
|
|
789
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Search, { className: "w-full h-full" }) })
|
|
790
|
-
] }),
|
|
791
|
-
hasResult ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_clsx4.default)("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
|
|
792
|
-
] });
|
|
793
|
-
};
|
|
794
|
-
|
|
795
|
-
// src/components/layout-and-navigation/Tile.tsx
|
|
796
|
-
var import_clsx5 = __toESM(require("clsx"));
|
|
797
|
-
var import_lucide_react2 = require("lucide-react");
|
|
798
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
799
|
-
var Tile = ({
|
|
1178
|
+
disabledClassName,
|
|
800
1179
|
title,
|
|
801
|
-
|
|
802
|
-
onClick,
|
|
803
|
-
isSelected = false,
|
|
804
|
-
isDisabled = false,
|
|
805
|
-
prefix,
|
|
806
|
-
suffix,
|
|
807
|
-
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
808
|
-
selectedClassName = " bg-primary/20",
|
|
809
|
-
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
810
|
-
className
|
|
1180
|
+
...restProps
|
|
811
1181
|
}) => {
|
|
812
|
-
return /* @__PURE__ */ (0,
|
|
813
|
-
|
|
1182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1183
|
+
Tile,
|
|
814
1184
|
{
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
[selectedClassName]: isSelected && !isDisabled,
|
|
820
|
-
[disabledClassName]: isDisabled
|
|
821
|
-
},
|
|
822
|
-
className
|
|
823
|
-
),
|
|
824
|
-
onClick: isDisabled ? void 0 : onClick,
|
|
825
|
-
children: [
|
|
826
|
-
prefix,
|
|
827
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "col gap-y-0 w-full", children: [
|
|
828
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { className: (0, import_clsx5.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
829
|
-
!!description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_clsx5.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
830
|
-
] }),
|
|
831
|
-
suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { size: 24 }) : void 0)
|
|
832
|
-
]
|
|
1185
|
+
...restProps,
|
|
1186
|
+
className: (0, import_clsx8.default)("px-2 py-1 rounded-md", className),
|
|
1187
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1188
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
833
1189
|
}
|
|
834
1190
|
);
|
|
835
1191
|
};
|
|
836
1192
|
|
|
837
1193
|
// src/components/layout-and-navigation/Chip.tsx
|
|
838
|
-
var
|
|
839
|
-
var
|
|
1194
|
+
var import_clsx9 = __toESM(require("clsx"));
|
|
1195
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
840
1196
|
var Chip = ({
|
|
841
1197
|
children,
|
|
842
1198
|
trailingIcon,
|
|
@@ -863,11 +1219,11 @@ var Chip = ({
|
|
|
863
1219
|
blue: "text-tag-blue-icon",
|
|
864
1220
|
pink: "text-tag-pink-icon"
|
|
865
1221
|
}[color];
|
|
866
|
-
return /* @__PURE__ */ (0,
|
|
1222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
867
1223
|
"div",
|
|
868
1224
|
{
|
|
869
1225
|
...restProps,
|
|
870
|
-
className: (0,
|
|
1226
|
+
className: (0, import_clsx9.default)(
|
|
871
1227
|
`row w-fit px-2 py-1`,
|
|
872
1228
|
colorMapping,
|
|
873
1229
|
{
|
|
@@ -878,7 +1234,7 @@ var Chip = ({
|
|
|
878
1234
|
),
|
|
879
1235
|
children: [
|
|
880
1236
|
children,
|
|
881
|
-
trailingIcon && /* @__PURE__ */ (0,
|
|
1237
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: colorMappingIcon, children: trailingIcon })
|
|
882
1238
|
]
|
|
883
1239
|
}
|
|
884
1240
|
);
|
|
@@ -887,7 +1243,7 @@ var ChipList = ({
|
|
|
887
1243
|
list,
|
|
888
1244
|
className = ""
|
|
889
1245
|
}) => {
|
|
890
|
-
return /* @__PURE__ */ (0,
|
|
1246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_clsx9.default)("flex flex-wrap gap-x-2 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
891
1247
|
Chip,
|
|
892
1248
|
{
|
|
893
1249
|
...value,
|
|
@@ -899,28 +1255,74 @@ var ChipList = ({
|
|
|
899
1255
|
)) });
|
|
900
1256
|
};
|
|
901
1257
|
|
|
902
|
-
// src/
|
|
903
|
-
var
|
|
904
|
-
var
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1258
|
+
// src/components/user-action/Checkbox.tsx
|
|
1259
|
+
var import_react15 = require("react");
|
|
1260
|
+
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
1261
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1262
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
1263
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1264
|
+
var checkboxSizeMapping = {
|
|
1265
|
+
small: "size-5",
|
|
1266
|
+
medium: "size-6",
|
|
1267
|
+
large: "size-8"
|
|
1268
|
+
};
|
|
1269
|
+
var checkboxIconSizeMapping = {
|
|
1270
|
+
small: "size-4",
|
|
1271
|
+
medium: "size-5",
|
|
1272
|
+
large: "size-7"
|
|
1273
|
+
};
|
|
1274
|
+
var Checkbox = ({
|
|
1275
|
+
id,
|
|
1276
|
+
label,
|
|
1277
|
+
checked,
|
|
1278
|
+
disabled,
|
|
1279
|
+
onChange,
|
|
1280
|
+
onChangeTristate,
|
|
1281
|
+
size = "medium",
|
|
1282
|
+
className = "",
|
|
1283
|
+
containerClassName
|
|
1284
|
+
}) => {
|
|
1285
|
+
const usedSizeClass = checkboxSizeMapping[size];
|
|
1286
|
+
const innerIconSize = checkboxIconSizeMapping[size];
|
|
1287
|
+
const propagateChange = (checked2) => {
|
|
1288
|
+
if (onChangeTristate) {
|
|
1289
|
+
onChangeTristate(checked2);
|
|
1290
|
+
}
|
|
1291
|
+
if (onChange) {
|
|
1292
|
+
onChange(checked2 === "indeterminate" ? false : checked2);
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
const changeValue = () => {
|
|
1296
|
+
const newValue = checked === "indeterminate" ? false : !checked;
|
|
1297
|
+
propagateChange(newValue);
|
|
1298
|
+
};
|
|
1299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: (0, import_clsx10.default)("group flex-row-2 items-center cursor-pointer", containerClassName), onClick: changeValue, children: [
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1301
|
+
CheckboxPrimitive.Root,
|
|
1302
|
+
{
|
|
1303
|
+
onCheckedChange: propagateChange,
|
|
1304
|
+
checked,
|
|
1305
|
+
disabled,
|
|
1306
|
+
id,
|
|
1307
|
+
className: (0, import_clsx10.default)(usedSizeClass, `items-center border-2 rounded outline-none `, {
|
|
1308
|
+
"text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
|
|
1309
|
+
"focus:border-primary group-hover:border-primary ": !disabled,
|
|
1310
|
+
"bg-surface": !disabled && !checked,
|
|
1311
|
+
"bg-primary/30 border-primary text-primary": !disabled && checked === true || checked === "indeterminate"
|
|
1312
|
+
}, className),
|
|
1313
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CheckboxPrimitive.Indicator, { children: [
|
|
1314
|
+
checked === true && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Check, { className: innerIconSize }),
|
|
1315
|
+
checked === "indeterminate" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Minus, { className: innerIconSize })
|
|
1316
|
+
] })
|
|
910
1317
|
}
|
|
911
|
-
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
document.addEventListener("touchstart", listener);
|
|
915
|
-
return () => {
|
|
916
|
-
document.removeEventListener("mousedown", listener);
|
|
917
|
-
document.removeEventListener("touchstart", listener);
|
|
918
|
-
};
|
|
919
|
-
}, [refs, handler]);
|
|
1318
|
+
),
|
|
1319
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Label, { ...label, className: (0, import_clsx10.default)(label.className), htmlFor: id })
|
|
1320
|
+
] });
|
|
920
1321
|
};
|
|
921
1322
|
|
|
922
1323
|
// src/components/user-action/MultiSelect.tsx
|
|
923
|
-
var
|
|
1324
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1325
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
924
1326
|
var defaultMultiSelectTranslation = {
|
|
925
1327
|
en: {
|
|
926
1328
|
selected: `{{amount}} selected`
|
|
@@ -931,89 +1333,107 @@ var defaultMultiSelectTranslation = {
|
|
|
931
1333
|
};
|
|
932
1334
|
var MultiSelect = ({
|
|
933
1335
|
overwriteTranslation,
|
|
934
|
-
options,
|
|
935
1336
|
label,
|
|
1337
|
+
options,
|
|
936
1338
|
onChange,
|
|
937
1339
|
hintText,
|
|
938
|
-
isDisabled = false,
|
|
939
|
-
isSearchEnabled = false,
|
|
940
1340
|
selectedDisplayOverwrite,
|
|
1341
|
+
searchOptions,
|
|
1342
|
+
additionalItems,
|
|
941
1343
|
useChipDisplay = false,
|
|
942
|
-
className
|
|
1344
|
+
className,
|
|
1345
|
+
triggerClassName,
|
|
1346
|
+
hintTextClassName,
|
|
1347
|
+
...menuProps
|
|
943
1348
|
}) => {
|
|
944
1349
|
const translation = useTranslation([formTranslation, defaultMultiSelectTranslation], overwriteTranslation);
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1350
|
+
const { result, search, setSearch } = useSearch({
|
|
1351
|
+
list: options,
|
|
1352
|
+
searchMapping: (0, import_react16.useCallback)((item) => item.searchTags, []),
|
|
1353
|
+
...searchOptions
|
|
1354
|
+
});
|
|
949
1355
|
const selectedItems = options.filter((value) => value.selected);
|
|
950
1356
|
const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
|
|
951
|
-
return /* @__PURE__ */ (0,
|
|
952
|
-
label && /* @__PURE__ */ (0,
|
|
1357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_clsx11.default)(className), children: [
|
|
1358
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
953
1359
|
Label,
|
|
954
1360
|
{
|
|
955
1361
|
...label,
|
|
956
1362
|
htmlFor: label.name,
|
|
957
|
-
className: (0,
|
|
1363
|
+
className: (0, import_clsx11.default)(" mb-1", label.className),
|
|
958
1364
|
labelType: label.labelType ?? "labelBig"
|
|
959
1365
|
}
|
|
960
1366
|
),
|
|
961
|
-
/* @__PURE__ */ (0,
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
"
|
|
971
|
-
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
972
|
-
}
|
|
973
|
-
),
|
|
974
|
-
onClick: () => setIsOpen(!isOpen),
|
|
975
|
-
disabled: isDisabled,
|
|
976
|
-
children: [
|
|
977
|
-
!isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? (useChipDisplay && selectedItems ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) : translation("selected", { replacements: { amount: selectedItems.length.toString() } })) }),
|
|
978
|
-
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "textstyle-description", children: hintText ?? translation("select") }),
|
|
979
|
-
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronUp, { size: 24, className: "min-w-6" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronDown, { className: "min-w-6" })
|
|
980
|
-
]
|
|
981
|
-
}
|
|
982
|
-
),
|
|
983
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
984
|
-
"div",
|
|
985
|
-
{
|
|
986
|
-
ref: menuRef,
|
|
987
|
-
className: "absolute w-full z-10 rounded-lg mt-0.5 bg-menu-background text-menu-text shadow-around-lg max-h-[500px] overflow-y-auto p-2",
|
|
988
|
-
children: [
|
|
989
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
990
|
-
SearchableList,
|
|
1367
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1368
|
+
Menu,
|
|
1369
|
+
{
|
|
1370
|
+
...menuProps,
|
|
1371
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1372
|
+
"button",
|
|
1373
|
+
{
|
|
1374
|
+
ref,
|
|
1375
|
+
className: (0, import_clsx11.default)(
|
|
1376
|
+
"btn-md justify-between w-full border-2 h-auto",
|
|
991
1377
|
{
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1378
|
+
"min-h-14": useChipDisplay,
|
|
1379
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1380
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1381
|
+
},
|
|
1382
|
+
triggerClassName
|
|
1383
|
+
),
|
|
1384
|
+
onClick: toggleOpen,
|
|
1385
|
+
disabled,
|
|
1386
|
+
children: useChipDisplay ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: isShowingHint ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { disabled, size: "small", color: "neutral", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Plus, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1387
|
+
!isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? translation("selected", { replacements: { amount: selectedItems.length.toString() } }) }),
|
|
1388
|
+
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: (0, import_clsx11.default)("textstyle-description", hintTextClassName), children: hintText ?? translation("select") }),
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ExpansionIcon, { isExpanded: isOpen })
|
|
1390
|
+
] })
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1393
|
+
menuClassName: (0, import_clsx11.default)("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1394
|
+
children: (bag) => {
|
|
1395
|
+
const { close } = bag;
|
|
1396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1397
|
+
!searchOptions?.disabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1398
|
+
SearchBar,
|
|
1399
|
+
{
|
|
1400
|
+
value: search,
|
|
1401
|
+
onChangeText: setSearch,
|
|
1402
|
+
autoFocus: true
|
|
1403
|
+
}
|
|
1404
|
+
),
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1406
|
+
result.map((option, index) => {
|
|
1407
|
+
const update = () => {
|
|
1408
|
+
onChange(options.map((value) => value.value === option.value ? {
|
|
1409
|
+
...option,
|
|
1410
|
+
selected: !value.selected
|
|
1411
|
+
} : value));
|
|
1412
|
+
};
|
|
1413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1414
|
+
SelectTile,
|
|
997
1415
|
{
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
},
|
|
1008
|
-
|
|
1416
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1417
|
+
Checkbox,
|
|
1418
|
+
{
|
|
1419
|
+
checked: option.selected,
|
|
1420
|
+
onChange: update,
|
|
1421
|
+
size: "small",
|
|
1422
|
+
disabled: option.disabled
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
title: { value: option.label },
|
|
1426
|
+
onClick: update,
|
|
1427
|
+
disabled: option.disabled
|
|
1009
1428
|
},
|
|
1010
1429
|
index
|
|
1011
|
-
)
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1430
|
+
);
|
|
1431
|
+
}),
|
|
1432
|
+
additionalItems && additionalItems({ ...bag, search })
|
|
1433
|
+
] }),
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-row-2 justify-between", children: [
|
|
1435
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-row-2", children: [
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1017
1437
|
SolidButton,
|
|
1018
1438
|
{
|
|
1019
1439
|
color: "neutral",
|
|
@@ -1028,7 +1448,7 @@ var MultiSelect = ({
|
|
|
1028
1448
|
children: translation("all")
|
|
1029
1449
|
}
|
|
1030
1450
|
),
|
|
1031
|
-
/* @__PURE__ */ (0,
|
|
1451
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1032
1452
|
SolidButton,
|
|
1033
1453
|
{
|
|
1034
1454
|
color: "neutral",
|
|
@@ -1043,19 +1463,19 @@ var MultiSelect = ({
|
|
|
1043
1463
|
}
|
|
1044
1464
|
)
|
|
1045
1465
|
] }),
|
|
1046
|
-
/* @__PURE__ */ (0,
|
|
1466
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SolidButton, { size: "small", onClick: close, children: "Done" })
|
|
1047
1467
|
] })
|
|
1048
|
-
]
|
|
1468
|
+
] });
|
|
1049
1469
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1470
|
+
}
|
|
1471
|
+
)
|
|
1052
1472
|
] });
|
|
1053
1473
|
};
|
|
1054
1474
|
|
|
1055
1475
|
// src/components/properties/PropertyBase.tsx
|
|
1056
|
-
var
|
|
1057
|
-
var
|
|
1058
|
-
var
|
|
1476
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1477
|
+
var import_clsx12 = __toESM(require("clsx"));
|
|
1478
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1059
1479
|
var PropertyBase = ({
|
|
1060
1480
|
overwriteTranslation,
|
|
1061
1481
|
name,
|
|
@@ -1069,36 +1489,44 @@ var PropertyBase = ({
|
|
|
1069
1489
|
}) => {
|
|
1070
1490
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1071
1491
|
const requiredAndNoValue = softRequired && !hasValue;
|
|
1072
|
-
return /* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_clsx12.default)("flex-row-0 group", className), children: [
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1074
1494
|
"div",
|
|
1075
1495
|
{
|
|
1076
|
-
className: (0,
|
|
1077
|
-
"
|
|
1078
|
-
|
|
1079
|
-
|
|
1496
|
+
className: (0, import_clsx12.default)(
|
|
1497
|
+
"flex-row-2 max-w-48 min-w-48 px-3 py-2 items-center rounded-l-xl border-2 border-r-0",
|
|
1498
|
+
{
|
|
1499
|
+
"bg-property-title-background text-property-title-text group-hover:border-primary": !requiredAndNoValue,
|
|
1500
|
+
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
1501
|
+
},
|
|
1502
|
+
className
|
|
1503
|
+
),
|
|
1080
1504
|
children: [
|
|
1081
|
-
icon,
|
|
1082
|
-
name
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "max-w-6 min-w-6 text-text-default", children: icon }),
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-semibold", children: name })
|
|
1083
1507
|
]
|
|
1084
1508
|
}
|
|
1085
1509
|
),
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1510
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1087
1511
|
"div",
|
|
1088
1512
|
{
|
|
1089
|
-
className: (0,
|
|
1090
|
-
"
|
|
1091
|
-
|
|
1092
|
-
|
|
1513
|
+
className: (0, import_clsx12.default)(
|
|
1514
|
+
"flex-row-2 grow px-3 py-2 justify-between items-center rounded-r-xl border-2 border-l-0 min-h-15",
|
|
1515
|
+
{
|
|
1516
|
+
"bg-surface group-hover:border-primary": !requiredAndNoValue,
|
|
1517
|
+
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
1518
|
+
},
|
|
1519
|
+
className
|
|
1520
|
+
),
|
|
1093
1521
|
children: [
|
|
1094
1522
|
input({ softRequired, hasValue }),
|
|
1095
|
-
requiredAndNoValue && /* @__PURE__ */ (0,
|
|
1096
|
-
onRemove && /* @__PURE__ */ (0,
|
|
1523
|
+
requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-warning", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.AlertTriangle, { size: 24 }) }),
|
|
1524
|
+
onRemove && hasValue && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1097
1525
|
TextButton,
|
|
1098
1526
|
{
|
|
1099
1527
|
onClick: onRemove,
|
|
1100
1528
|
color: "negative",
|
|
1101
|
-
className: (0,
|
|
1529
|
+
className: (0, import_clsx12.default)("items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
1102
1530
|
disabled: !hasValue || readOnly,
|
|
1103
1531
|
children: translation("remove")
|
|
1104
1532
|
}
|
|
@@ -1110,7 +1538,7 @@ var PropertyBase = ({
|
|
|
1110
1538
|
};
|
|
1111
1539
|
|
|
1112
1540
|
// src/components/properties/MultiSelectProperty.tsx
|
|
1113
|
-
var
|
|
1541
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1114
1542
|
var MultiSelectProperty = ({
|
|
1115
1543
|
overwriteTranslation,
|
|
1116
1544
|
options,
|
|
@@ -1118,11 +1546,12 @@ var MultiSelectProperty = ({
|
|
|
1118
1546
|
readOnly = false,
|
|
1119
1547
|
softRequired,
|
|
1120
1548
|
onRemove,
|
|
1549
|
+
onAddNew,
|
|
1121
1550
|
...multiSelectProps
|
|
1122
1551
|
}) => {
|
|
1123
1552
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1124
1553
|
const hasValue = options.some((value) => value.selected);
|
|
1125
|
-
return /* @__PURE__ */ (0,
|
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1126
1555
|
PropertyBase,
|
|
1127
1556
|
{
|
|
1128
1557
|
name,
|
|
@@ -1130,20 +1559,42 @@ var MultiSelectProperty = ({
|
|
|
1130
1559
|
readOnly,
|
|
1131
1560
|
softRequired,
|
|
1132
1561
|
hasValue,
|
|
1133
|
-
icon: /* @__PURE__ */ (0,
|
|
1134
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0,
|
|
1135
|
-
|
|
1562
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.List, { size: 24 }),
|
|
1563
|
+
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1564
|
+
MultiSelect,
|
|
1136
1565
|
{
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1566
|
+
...multiSelectProps,
|
|
1567
|
+
className: (0, import_clsx13.default)("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
1568
|
+
options,
|
|
1569
|
+
disabled: readOnly,
|
|
1570
|
+
useChipDisplay: true,
|
|
1571
|
+
hintText: `${translation("select")}...`,
|
|
1572
|
+
searchOptions: {
|
|
1573
|
+
sortingFunction: (a, b) => a.value.localeCompare(b.value),
|
|
1574
|
+
...multiSelectProps?.searchOptions
|
|
1575
|
+
},
|
|
1576
|
+
additionalItems: ({ close, search }) => {
|
|
1577
|
+
if (!onAddNew && !search.trim()) {
|
|
1578
|
+
return void 0;
|
|
1579
|
+
}
|
|
1580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1581
|
+
SelectTile,
|
|
1582
|
+
{
|
|
1583
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Plus, {}),
|
|
1584
|
+
title: { value: `${translation("add")} ${search.trim()}` },
|
|
1585
|
+
onClick: () => {
|
|
1586
|
+
onAddNew(search);
|
|
1587
|
+
close();
|
|
1588
|
+
},
|
|
1589
|
+
disabled: options.some((value) => value.value === search.trim())
|
|
1590
|
+
}
|
|
1591
|
+
);
|
|
1592
|
+
},
|
|
1593
|
+
triggerClassName: (0, import_clsx13.default)(
|
|
1594
|
+
"!border-none !p-0 !min-h-10",
|
|
1140
1595
|
{
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
options,
|
|
1144
|
-
isDisabled: readOnly,
|
|
1145
|
-
useChipDisplay: true,
|
|
1146
|
-
hintText: `${translation("select")}...`
|
|
1596
|
+
"!bg-warning !text-surface-warning": softRequired2 && !hasValue,
|
|
1597
|
+
"": !softRequired2 || hasValue
|
|
1147
1598
|
}
|
|
1148
1599
|
)
|
|
1149
1600
|
}
|