@helpwave/hightide 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/branding/HelpwaveBadge.js +7 -7
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +7 -7
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +65 -38
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +54 -27
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js +3 -3
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +3 -3
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +4 -4
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +4 -4
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +46 -19
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +44 -17
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +32 -28
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.js +2 -2
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Ring.js +2 -2
- package/dist/components/icons-and-geometry/Ring.js.map +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs +2 -2
- package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +84 -15
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.js +1 -1
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +7 -1
- package/dist/components/layout-and-navigation/Expandable.d.ts +7 -1
- package/dist/components/layout-and-navigation/Expandable.js +36 -9
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +36 -10
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +34 -11
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +36 -13
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +92 -19
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +82 -9
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +79 -6
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +127 -25
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +126 -24
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +22 -16
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +7 -3
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
- package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
- package/dist/components/layout-and-navigation/Tile.js +7 -7
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +7 -7
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +5 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +8 -6
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +8 -6
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +32 -28
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +18 -14
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +28 -24
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +18 -14
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +32 -28
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +18 -14
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +728 -434
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +728 -430
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +732 -438
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +731 -433
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +110 -35
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +110 -35
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +118 -41
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +114 -37
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
- package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
- package/dist/components/properties/MultiSelectProperty.js +915 -463
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +920 -464
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +101 -18
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +101 -18
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +103 -20
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +99 -16
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +9 -2
- package/dist/components/properties/SelectProperty.d.ts +9 -2
- package/dist/components/properties/SelectProperty.js +682 -243
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +686 -243
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +133 -46
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +133 -46
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +285 -185
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +270 -166
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +179 -78
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +160 -55
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +72 -3
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +72 -3
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +15 -2
- package/dist/components/user-action/Button.d.ts +15 -2
- package/dist/components/user-action/Button.js +12 -12
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +12 -12
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +6 -15
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +6 -15
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +79 -48
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +65 -34
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +11 -6
- package/dist/components/user-action/Menu.d.ts +11 -6
- package/dist/components/user-action/Menu.js +128 -31
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +134 -33
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +17 -7
- package/dist/components/user-action/MultiSelect.d.ts +17 -7
- package/dist/components/user-action/MultiSelect.js +796 -375
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +781 -356
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +2 -2
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +2 -2
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.d.mts +14 -0
- package/dist/components/user-action/SearchBar.d.ts +14 -0
- package/dist/components/user-action/SearchBar.js +673 -0
- package/dist/components/user-action/SearchBar.js.map +1 -0
- package/dist/components/user-action/SearchBar.mjs +637 -0
- package/dist/components/user-action/SearchBar.mjs.map +1 -0
- package/dist/components/user-action/Select.d.mts +18 -5
- package/dist/components/user-action/Select.d.ts +18 -5
- package/dist/components/user-action/Select.js +764 -355
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +761 -349
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +1 -1
- package/dist/components/user-action/Textarea.d.ts +1 -1
- package/dist/components/user-action/Textarea.js +13 -3
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +13 -3
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.js +2 -2
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +2 -2
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +251 -113
- package/dist/css/uncompiled/globals.css +19 -13
- package/dist/css/uncompiled/theme/colors-component.css +12 -3
- package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
- package/dist/css/uncompiled/utitlity/animation.css +70 -1
- package/dist/css/uncompiled/utitlity/general.css +16 -0
- package/dist/hooks/usePopoverPosition.d.mts +15 -0
- package/dist/hooks/usePopoverPosition.d.ts +15 -0
- package/dist/hooks/usePopoverPosition.js +81 -0
- package/dist/hooks/usePopoverPosition.js.map +1 -0
- package/dist/hooks/usePopoverPosition.mjs +57 -0
- package/dist/hooks/usePopoverPosition.mjs.map +1 -0
- package/dist/hooks/useSearch.d.mts +7 -2
- package/dist/hooks/useSearch.d.ts +7 -2
- package/dist/hooks/useSearch.js +44 -15
- package/dist/hooks/useSearch.js.map +1 -1
- package/dist/hooks/useSearch.mjs +45 -16
- package/dist/hooks/useSearch.mjs.map +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1102 -819
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1001 -718
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +2 -0
- package/dist/localization/defaults/form.d.ts +2 -0
- package/dist/localization/defaults/form.js +4 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +4 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/simpleSearch.d.mts +1 -1
- package/dist/util/simpleSearch.d.ts +1 -1
- package/dist/util/simpleSearch.js +4 -1
- package/dist/util/simpleSearch.js.map +1 -1
- package/dist/util/simpleSearch.mjs +4 -1
- package/dist/util/simpleSearch.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -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,12 +546,12 @@ 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);
|
|
@@ -193,13 +560,10 @@ function useDelay(options) {
|
|
|
193
560
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
194
561
|
}
|
|
195
562
|
|
|
196
|
-
// src/util/noop.ts
|
|
197
|
-
var noop = () => void 0;
|
|
198
|
-
|
|
199
563
|
// src/hooks/useFocusManagement.ts
|
|
200
|
-
var
|
|
564
|
+
var import_react8 = require("react");
|
|
201
565
|
function useFocusManagement() {
|
|
202
|
-
const getFocusableElements = (0,
|
|
566
|
+
const getFocusableElements = (0, import_react8.useCallback)(() => {
|
|
203
567
|
return Array.from(
|
|
204
568
|
document.querySelectorAll(
|
|
205
569
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -208,7 +572,7 @@ function useFocusManagement() {
|
|
|
208
572
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
209
573
|
);
|
|
210
574
|
}, []);
|
|
211
|
-
const getNextFocusElement = (0,
|
|
575
|
+
const getNextFocusElement = (0, import_react8.useCallback)(() => {
|
|
212
576
|
const elements = getFocusableElements();
|
|
213
577
|
if (elements.length === 0) {
|
|
214
578
|
return void 0;
|
|
@@ -220,11 +584,11 @@ function useFocusManagement() {
|
|
|
220
584
|
}
|
|
221
585
|
return nextElement;
|
|
222
586
|
}, [getFocusableElements]);
|
|
223
|
-
const focusNext = (0,
|
|
587
|
+
const focusNext = (0, import_react8.useCallback)(() => {
|
|
224
588
|
const nextElement = getNextFocusElement();
|
|
225
589
|
nextElement?.focus();
|
|
226
590
|
}, [getNextFocusElement]);
|
|
227
|
-
const getPreviousFocusElement = (0,
|
|
591
|
+
const getPreviousFocusElement = (0, import_react8.useCallback)(() => {
|
|
228
592
|
const elements = getFocusableElements();
|
|
229
593
|
if (elements.length === 0) {
|
|
230
594
|
return void 0;
|
|
@@ -240,7 +604,7 @@ function useFocusManagement() {
|
|
|
240
604
|
}
|
|
241
605
|
return previousElement;
|
|
242
606
|
}, [getFocusableElements]);
|
|
243
|
-
const focusPrevious = (0,
|
|
607
|
+
const focusPrevious = (0, import_react8.useCallback)(() => {
|
|
244
608
|
const previousElement = getPreviousFocusElement();
|
|
245
609
|
if (previousElement) previousElement.focus();
|
|
246
610
|
}, [getPreviousFocusElement]);
|
|
@@ -254,10 +618,10 @@ function useFocusManagement() {
|
|
|
254
618
|
}
|
|
255
619
|
|
|
256
620
|
// src/hooks/useFocusOnceVisible.ts
|
|
257
|
-
var
|
|
621
|
+
var import_react9 = __toESM(require("react"));
|
|
258
622
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
259
|
-
const [hasUsedFocus, setHasUsedFocus] =
|
|
260
|
-
(0,
|
|
623
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react9.default.useState(false);
|
|
624
|
+
(0, import_react9.useEffect)(() => {
|
|
261
625
|
if (disable || hasUsedFocus) {
|
|
262
626
|
return;
|
|
263
627
|
}
|
|
@@ -277,9 +641,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
277
641
|
};
|
|
278
642
|
|
|
279
643
|
// src/components/user-action/Input.tsx
|
|
280
|
-
var
|
|
644
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
281
645
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
282
|
-
return (0,
|
|
646
|
+
return (0, import_clsx5.default)(
|
|
283
647
|
"px-2 py-1.5 rounded-md border-2",
|
|
284
648
|
{
|
|
285
649
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -293,7 +657,7 @@ var defaultEditCompleteOptions = {
|
|
|
293
657
|
afterDelay: true,
|
|
294
658
|
delay: 2500
|
|
295
659
|
};
|
|
296
|
-
var Input = (0,
|
|
660
|
+
var Input = (0, import_react10.forwardRef)(function Input2({
|
|
297
661
|
id,
|
|
298
662
|
type = "text",
|
|
299
663
|
value,
|
|
@@ -316,10 +680,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
316
680
|
restartTimer,
|
|
317
681
|
clearTimer
|
|
318
682
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
319
|
-
const innerRef = (0,
|
|
683
|
+
const innerRef = (0, import_react10.useRef)(null);
|
|
320
684
|
const { focusNext } = useFocusManagement();
|
|
321
685
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
322
|
-
(0,
|
|
686
|
+
(0, import_react10.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
323
687
|
const handleKeyDown = (e) => {
|
|
324
688
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
325
689
|
e.preventDefault();
|
|
@@ -327,9 +691,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
327
691
|
focusNext();
|
|
328
692
|
}
|
|
329
693
|
};
|
|
330
|
-
return /* @__PURE__ */ (0,
|
|
331
|
-
label && /* @__PURE__ */ (0,
|
|
332
|
-
/* @__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)(
|
|
333
697
|
"input",
|
|
334
698
|
{
|
|
335
699
|
...restProps,
|
|
@@ -338,7 +702,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
338
702
|
id,
|
|
339
703
|
type,
|
|
340
704
|
disabled,
|
|
341
|
-
className: (0,
|
|
705
|
+
className: (0, import_clsx5.default)(getInputClassName({ disabled }), className),
|
|
342
706
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
343
707
|
onBlur: (event) => {
|
|
344
708
|
onBlur?.(event);
|
|
@@ -368,7 +732,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
368
732
|
)
|
|
369
733
|
] });
|
|
370
734
|
});
|
|
371
|
-
var FormInput = (0,
|
|
735
|
+
var FormInput = (0, import_react10.forwardRef)(function FormInput2({
|
|
372
736
|
id,
|
|
373
737
|
labelText,
|
|
374
738
|
errorText,
|
|
@@ -380,114 +744,232 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
|
|
|
380
744
|
disabled,
|
|
381
745
|
...restProps
|
|
382
746
|
}, ref) {
|
|
383
|
-
const input = /* @__PURE__ */ (0,
|
|
747
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
384
748
|
"input",
|
|
385
749
|
{
|
|
386
750
|
...restProps,
|
|
387
751
|
ref,
|
|
388
752
|
id,
|
|
389
753
|
disabled,
|
|
390
|
-
className: (0,
|
|
754
|
+
className: (0, import_clsx5.default)(
|
|
391
755
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
392
756
|
className
|
|
393
757
|
)
|
|
394
758
|
}
|
|
395
759
|
);
|
|
396
|
-
return /* @__PURE__ */ (0,
|
|
397
|
-
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: [
|
|
398
762
|
labelText,
|
|
399
|
-
required && /* @__PURE__ */ (0,
|
|
763
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
400
764
|
] }),
|
|
401
765
|
input,
|
|
402
|
-
errorText && /* @__PURE__ */ (0,
|
|
766
|
+
errorText && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: (0, import_clsx5.default)("text-negative", errorClassName), children: errorText })
|
|
403
767
|
] });
|
|
404
768
|
});
|
|
405
769
|
|
|
406
|
-
// src/
|
|
407
|
-
var
|
|
408
|
-
|
|
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
|
-
|
|
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
|
|
482
964
|
}),
|
|
483
965
|
children: startIcon
|
|
484
966
|
}
|
|
485
967
|
),
|
|
486
968
|
children,
|
|
487
|
-
endIcon && /* @__PURE__ */ (0,
|
|
969
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
488
970
|
"span",
|
|
489
971
|
{
|
|
490
|
-
className: (0,
|
|
972
|
+
className: (0, import_clsx6.default)({
|
|
491
973
|
[iconColorClasses]: !disabled,
|
|
492
974
|
[`text-disabled-icon`]: disabled
|
|
493
975
|
}),
|
|
@@ -497,7 +979,7 @@ var SolidButton = ({
|
|
|
497
979
|
]
|
|
498
980
|
}
|
|
499
981
|
);
|
|
500
|
-
};
|
|
982
|
+
});
|
|
501
983
|
var TextButton = ({
|
|
502
984
|
children,
|
|
503
985
|
disabled = false,
|
|
@@ -519,25 +1001,25 @@ var TextButton = ({
|
|
|
519
1001
|
negative: "text-button-text-negative-icon",
|
|
520
1002
|
neutral: "text-button-text-neutral-icon"
|
|
521
1003
|
}[color];
|
|
522
|
-
return /* @__PURE__ */ (0,
|
|
1004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
523
1005
|
"button",
|
|
524
1006
|
{
|
|
525
|
-
onClick
|
|
526
|
-
disabled
|
|
527
|
-
className: (0,
|
|
1007
|
+
onClick,
|
|
1008
|
+
disabled,
|
|
1009
|
+
className: (0, import_clsx6.default)(
|
|
528
1010
|
{
|
|
529
1011
|
"text-disabled-text cursor-not-allowed": disabled,
|
|
530
|
-
[(0,
|
|
1012
|
+
[(0, import_clsx6.default)(colorClasses, "hover:bg-button-text-hover-background")]: !disabled
|
|
531
1013
|
},
|
|
532
1014
|
ButtonUtil.paddingMapping[size],
|
|
533
1015
|
className
|
|
534
1016
|
),
|
|
535
1017
|
...restProps,
|
|
536
1018
|
children: [
|
|
537
|
-
startIcon && /* @__PURE__ */ (0,
|
|
1019
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
538
1020
|
"span",
|
|
539
1021
|
{
|
|
540
|
-
className: (0,
|
|
1022
|
+
className: (0, import_clsx6.default)({
|
|
541
1023
|
[iconColorClasses]: !disabled,
|
|
542
1024
|
[`text-disabled-icon`]: disabled
|
|
543
1025
|
}),
|
|
@@ -545,10 +1027,10 @@ var TextButton = ({
|
|
|
545
1027
|
}
|
|
546
1028
|
),
|
|
547
1029
|
children,
|
|
548
|
-
endIcon && /* @__PURE__ */ (0,
|
|
1030
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
549
1031
|
"span",
|
|
550
1032
|
{
|
|
551
|
-
className: (0,
|
|
1033
|
+
className: (0, import_clsx6.default)({
|
|
552
1034
|
[iconColorClasses]: !disabled,
|
|
553
1035
|
[`text-disabled-icon`]: disabled
|
|
554
1036
|
}),
|
|
@@ -564,7 +1046,6 @@ var IconButton = ({
|
|
|
564
1046
|
disabled = false,
|
|
565
1047
|
color = "primary",
|
|
566
1048
|
size = "medium",
|
|
567
|
-
onClick,
|
|
568
1049
|
className,
|
|
569
1050
|
...restProps
|
|
570
1051
|
}) => {
|
|
@@ -578,17 +1059,16 @@ var IconButton = ({
|
|
|
578
1059
|
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
579
1060
|
transparent: "bg-transparent"
|
|
580
1061
|
}[color];
|
|
581
|
-
return /* @__PURE__ */ (0,
|
|
1062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
582
1063
|
"button",
|
|
583
1064
|
{
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
className: (0, import_clsx3.default)(
|
|
1065
|
+
disabled,
|
|
1066
|
+
className: (0, import_clsx6.default)(
|
|
587
1067
|
{
|
|
588
1068
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
589
1069
|
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
590
1070
|
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
591
|
-
[(0,
|
|
1071
|
+
[(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
592
1072
|
},
|
|
593
1073
|
ButtonUtil.iconPaddingMapping[size],
|
|
594
1074
|
className
|
|
@@ -599,17 +1079,41 @@ var IconButton = ({
|
|
|
599
1079
|
);
|
|
600
1080
|
};
|
|
601
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
|
+
|
|
602
1106
|
// src/hooks/useSearch.ts
|
|
603
|
-
var
|
|
1107
|
+
var import_react12 = require("react");
|
|
604
1108
|
|
|
605
1109
|
// src/util/simpleSearch.ts
|
|
606
|
-
var
|
|
1110
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
607
1111
|
return objects.filter((object) => {
|
|
608
1112
|
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
609
1113
|
if (!mappedSearchKeywords) {
|
|
610
1114
|
return true;
|
|
611
1115
|
}
|
|
612
|
-
return !!mappedSearchKeywords.find((value) => value.includes(
|
|
1116
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
613
1117
|
});
|
|
614
1118
|
};
|
|
615
1119
|
|
|
@@ -617,225 +1121,78 @@ var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
|
617
1121
|
var useSearch = ({
|
|
618
1122
|
list,
|
|
619
1123
|
initialSearch,
|
|
620
|
-
searchMapping
|
|
1124
|
+
searchMapping,
|
|
1125
|
+
additionalSearchTags,
|
|
1126
|
+
isSearchInstant = true,
|
|
1127
|
+
sortingFunction,
|
|
1128
|
+
filter,
|
|
1129
|
+
disabled = false
|
|
621
1130
|
}) => {
|
|
622
|
-
const [
|
|
623
|
-
const [
|
|
624
|
-
(0,
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
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]);
|
|
631
1164
|
return {
|
|
632
|
-
result,
|
|
633
|
-
hasResult:
|
|
634
|
-
allItems:
|
|
635
|
-
|
|
1165
|
+
result: usedResult,
|
|
1166
|
+
hasResult: usedResult.length > 0,
|
|
1167
|
+
allItems: list,
|
|
1168
|
+
updateSearch,
|
|
636
1169
|
search,
|
|
637
1170
|
setSearch
|
|
638
1171
|
};
|
|
639
1172
|
};
|
|
640
1173
|
|
|
641
|
-
// src/
|
|
642
|
-
var
|
|
643
|
-
|
|
644
|
-
all: "All",
|
|
645
|
-
apply: "Apply",
|
|
646
|
-
back: "Back",
|
|
647
|
-
cancel: "Cancel",
|
|
648
|
-
change: "Change",
|
|
649
|
-
clear: "Clear",
|
|
650
|
-
click: "Click",
|
|
651
|
-
clickToCopy: "Click to Copy",
|
|
652
|
-
close: "Close",
|
|
653
|
-
confirm: "Confirm",
|
|
654
|
-
copy: "Copy",
|
|
655
|
-
copied: "Copied",
|
|
656
|
-
decline: "Decline",
|
|
657
|
-
delete: "Delete",
|
|
658
|
-
discard: "Discard",
|
|
659
|
-
discardChanges: "Discard Changes",
|
|
660
|
-
done: "Done",
|
|
661
|
-
edit: "Edit",
|
|
662
|
-
enterText: "Enter text here",
|
|
663
|
-
error: "Error",
|
|
664
|
-
exit: "Exit",
|
|
665
|
-
fieldRequiredError: "This field is required.",
|
|
666
|
-
invalidEmailError: "Please enter a valid email address.",
|
|
667
|
-
less: "Less",
|
|
668
|
-
loading: "Loading",
|
|
669
|
-
maxLengthError: "Maximum length exceeded.",
|
|
670
|
-
minLengthError: "Minimum length not met.",
|
|
671
|
-
more: "More",
|
|
672
|
-
next: "Next",
|
|
673
|
-
no: "No",
|
|
674
|
-
none: "None",
|
|
675
|
-
of: "of",
|
|
676
|
-
optional: "Optional",
|
|
677
|
-
pleaseWait: "Please wait...",
|
|
678
|
-
previous: "Previous",
|
|
679
|
-
remove: "Remove",
|
|
680
|
-
required: "Required",
|
|
681
|
-
reset: "Reset",
|
|
682
|
-
save: "Save",
|
|
683
|
-
saved: "Saved",
|
|
684
|
-
search: "Search",
|
|
685
|
-
select: "Select",
|
|
686
|
-
selectOption: "Select an option",
|
|
687
|
-
show: "Show",
|
|
688
|
-
showMore: "Show more",
|
|
689
|
-
showLess: "Show less",
|
|
690
|
-
submit: "Submit",
|
|
691
|
-
success: "Success",
|
|
692
|
-
update: "Update",
|
|
693
|
-
unsavedChanges: "Unsaved Changes",
|
|
694
|
-
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
695
|
-
yes: "Yes"
|
|
696
|
-
},
|
|
697
|
-
de: {
|
|
698
|
-
all: "Alle",
|
|
699
|
-
apply: "Anwenden",
|
|
700
|
-
back: "Zur\xFCck",
|
|
701
|
-
cancel: "Abbrechen",
|
|
702
|
-
change: "\xC4ndern",
|
|
703
|
-
clear: "L\xF6schen",
|
|
704
|
-
click: "Klicken",
|
|
705
|
-
clickToCopy: "Zum kopieren klicken",
|
|
706
|
-
close: "Schlie\xDFen",
|
|
707
|
-
confirm: "Best\xE4tigen",
|
|
708
|
-
copy: "Kopieren",
|
|
709
|
-
copied: "Kopiert",
|
|
710
|
-
decline: "Ablehnen",
|
|
711
|
-
delete: "L\xF6schen",
|
|
712
|
-
discard: "Verwerfen",
|
|
713
|
-
discardChanges: "\xC4nderungen Verwerfen",
|
|
714
|
-
done: "Fertig",
|
|
715
|
-
edit: "Bearbeiten",
|
|
716
|
-
enterText: "Text hier eingeben",
|
|
717
|
-
error: "Fehler",
|
|
718
|
-
exit: "Beenden",
|
|
719
|
-
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
720
|
-
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
721
|
-
less: "Weniger",
|
|
722
|
-
loading: "L\xE4dt",
|
|
723
|
-
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
724
|
-
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
725
|
-
more: "Mehr",
|
|
726
|
-
next: "Weiter",
|
|
727
|
-
no: "Nein",
|
|
728
|
-
none: "Nichts",
|
|
729
|
-
of: "von",
|
|
730
|
-
optional: "Optional",
|
|
731
|
-
pleaseWait: "Bitte warten...",
|
|
732
|
-
previous: "Vorherige",
|
|
733
|
-
remove: "Entfernen",
|
|
734
|
-
required: "Erforderlich",
|
|
735
|
-
reset: "Zur\xFCcksetzen",
|
|
736
|
-
save: "Speichern",
|
|
737
|
-
saved: "Gespeichert",
|
|
738
|
-
search: "Suche",
|
|
739
|
-
select: "Select",
|
|
740
|
-
selectOption: "Option ausw\xE4hlen",
|
|
741
|
-
show: "Anzeigen",
|
|
742
|
-
showMore: "Mehr anzeigen",
|
|
743
|
-
showLess: "Weniger anzeigen",
|
|
744
|
-
submit: "Abschicken",
|
|
745
|
-
success: "Erfolg",
|
|
746
|
-
update: "Update",
|
|
747
|
-
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
748
|
-
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
749
|
-
yes: "Ja"
|
|
750
|
-
}
|
|
751
|
-
};
|
|
752
|
-
|
|
753
|
-
// src/components/layout-and-navigation/SearchableList.tsx
|
|
754
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
755
|
-
var defaultSearchableListTranslation = {
|
|
756
|
-
en: {
|
|
757
|
-
nothingFound: "Nothing found"
|
|
758
|
-
},
|
|
759
|
-
de: {
|
|
760
|
-
nothingFound: "Nichts gefunden"
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
var SearchableList = ({
|
|
764
|
-
overwriteTranslation,
|
|
765
|
-
list,
|
|
766
|
-
initialSearch = "",
|
|
767
|
-
searchMapping,
|
|
768
|
-
autoFocus,
|
|
769
|
-
minimumItemsForSearch = 6,
|
|
770
|
-
itemMapper,
|
|
1174
|
+
// src/components/user-action/Select.tsx
|
|
1175
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1176
|
+
var SelectTile = ({
|
|
771
1177
|
className,
|
|
772
|
-
|
|
773
|
-
}) => {
|
|
774
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
775
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
776
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("col gap-y-2", className), children: [
|
|
777
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
778
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
779
|
-
Input,
|
|
780
|
-
{
|
|
781
|
-
value: search,
|
|
782
|
-
onChangeText: setSearch,
|
|
783
|
-
placeholder: translation("search"),
|
|
784
|
-
autoFocus,
|
|
785
|
-
className: "w-full"
|
|
786
|
-
}
|
|
787
|
-
),
|
|
788
|
-
/* @__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" }) })
|
|
789
|
-
] }),
|
|
790
|
-
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") })
|
|
791
|
-
] });
|
|
792
|
-
};
|
|
793
|
-
|
|
794
|
-
// src/components/layout-and-navigation/Tile.tsx
|
|
795
|
-
var import_clsx5 = __toESM(require("clsx"));
|
|
796
|
-
var import_lucide_react2 = require("lucide-react");
|
|
797
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
798
|
-
var Tile = ({
|
|
1178
|
+
disabledClassName,
|
|
799
1179
|
title,
|
|
800
|
-
|
|
801
|
-
onClick,
|
|
802
|
-
isSelected = false,
|
|
803
|
-
isDisabled = false,
|
|
804
|
-
prefix,
|
|
805
|
-
suffix,
|
|
806
|
-
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
807
|
-
selectedClassName = " bg-primary/20",
|
|
808
|
-
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
809
|
-
className
|
|
1180
|
+
...restProps
|
|
810
1181
|
}) => {
|
|
811
|
-
return /* @__PURE__ */ (0,
|
|
812
|
-
|
|
1182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1183
|
+
Tile,
|
|
813
1184
|
{
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
[selectedClassName]: isSelected && !isDisabled,
|
|
819
|
-
[disabledClassName]: isDisabled
|
|
820
|
-
},
|
|
821
|
-
className
|
|
822
|
-
),
|
|
823
|
-
onClick: isDisabled ? void 0 : onClick,
|
|
824
|
-
children: [
|
|
825
|
-
prefix,
|
|
826
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "col gap-y-0 w-full", children: [
|
|
827
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { className: (0, import_clsx5.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
828
|
-
!!description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_clsx5.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
829
|
-
] }),
|
|
830
|
-
suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { size: 24 }) : void 0)
|
|
831
|
-
]
|
|
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" }
|
|
832
1189
|
}
|
|
833
1190
|
);
|
|
834
1191
|
};
|
|
835
1192
|
|
|
836
1193
|
// src/components/layout-and-navigation/Chip.tsx
|
|
837
|
-
var
|
|
838
|
-
var
|
|
1194
|
+
var import_clsx9 = __toESM(require("clsx"));
|
|
1195
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
839
1196
|
var Chip = ({
|
|
840
1197
|
children,
|
|
841
1198
|
trailingIcon,
|
|
@@ -862,11 +1219,11 @@ var Chip = ({
|
|
|
862
1219
|
blue: "text-tag-blue-icon",
|
|
863
1220
|
pink: "text-tag-pink-icon"
|
|
864
1221
|
}[color];
|
|
865
|
-
return /* @__PURE__ */ (0,
|
|
1222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
866
1223
|
"div",
|
|
867
1224
|
{
|
|
868
1225
|
...restProps,
|
|
869
|
-
className: (0,
|
|
1226
|
+
className: (0, import_clsx9.default)(
|
|
870
1227
|
`row w-fit px-2 py-1`,
|
|
871
1228
|
colorMapping,
|
|
872
1229
|
{
|
|
@@ -877,7 +1234,7 @@ var Chip = ({
|
|
|
877
1234
|
),
|
|
878
1235
|
children: [
|
|
879
1236
|
children,
|
|
880
|
-
trailingIcon && /* @__PURE__ */ (0,
|
|
1237
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: colorMappingIcon, children: trailingIcon })
|
|
881
1238
|
]
|
|
882
1239
|
}
|
|
883
1240
|
);
|
|
@@ -886,7 +1243,7 @@ var ChipList = ({
|
|
|
886
1243
|
list,
|
|
887
1244
|
className = ""
|
|
888
1245
|
}) => {
|
|
889
|
-
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)(
|
|
890
1247
|
Chip,
|
|
891
1248
|
{
|
|
892
1249
|
...value,
|
|
@@ -898,28 +1255,74 @@ var ChipList = ({
|
|
|
898
1255
|
)) });
|
|
899
1256
|
};
|
|
900
1257
|
|
|
901
|
-
// src/
|
|
902
|
-
var
|
|
903
|
-
var
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
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
|
+
] })
|
|
909
1317
|
}
|
|
910
|
-
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
document.addEventListener("touchstart", listener);
|
|
914
|
-
return () => {
|
|
915
|
-
document.removeEventListener("mousedown", listener);
|
|
916
|
-
document.removeEventListener("touchstart", listener);
|
|
917
|
-
};
|
|
918
|
-
}, [refs, handler]);
|
|
1318
|
+
),
|
|
1319
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Label, { ...label, className: (0, import_clsx10.default)(label.className), htmlFor: id })
|
|
1320
|
+
] });
|
|
919
1321
|
};
|
|
920
1322
|
|
|
921
1323
|
// src/components/user-action/MultiSelect.tsx
|
|
922
|
-
var
|
|
1324
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1325
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
923
1326
|
var defaultMultiSelectTranslation = {
|
|
924
1327
|
en: {
|
|
925
1328
|
selected: `{{amount}} selected`
|
|
@@ -930,89 +1333,107 @@ var defaultMultiSelectTranslation = {
|
|
|
930
1333
|
};
|
|
931
1334
|
var MultiSelect = ({
|
|
932
1335
|
overwriteTranslation,
|
|
933
|
-
options,
|
|
934
1336
|
label,
|
|
1337
|
+
options,
|
|
935
1338
|
onChange,
|
|
936
1339
|
hintText,
|
|
937
|
-
isDisabled = false,
|
|
938
|
-
isSearchEnabled = false,
|
|
939
1340
|
selectedDisplayOverwrite,
|
|
1341
|
+
searchOptions,
|
|
1342
|
+
additionalItems,
|
|
940
1343
|
useChipDisplay = false,
|
|
941
|
-
className
|
|
1344
|
+
className,
|
|
1345
|
+
triggerClassName,
|
|
1346
|
+
hintTextClassName,
|
|
1347
|
+
...menuProps
|
|
942
1348
|
}) => {
|
|
943
1349
|
const translation = useTranslation([formTranslation, defaultMultiSelectTranslation], overwriteTranslation);
|
|
944
|
-
const
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1350
|
+
const { result, search, setSearch } = useSearch({
|
|
1351
|
+
list: options,
|
|
1352
|
+
searchMapping: (0, import_react16.useCallback)((item) => item.searchTags, []),
|
|
1353
|
+
...searchOptions
|
|
1354
|
+
});
|
|
948
1355
|
const selectedItems = options.filter((value) => value.selected);
|
|
949
1356
|
const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
|
|
950
|
-
return /* @__PURE__ */ (0,
|
|
951
|
-
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)(
|
|
952
1359
|
Label,
|
|
953
1360
|
{
|
|
954
1361
|
...label,
|
|
955
1362
|
htmlFor: label.name,
|
|
956
|
-
className: (0,
|
|
1363
|
+
className: (0, import_clsx11.default)(" mb-1", label.className),
|
|
957
1364
|
labelType: label.labelType ?? "labelBig"
|
|
958
1365
|
}
|
|
959
1366
|
),
|
|
960
|
-
/* @__PURE__ */ (0,
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
"
|
|
970
|
-
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
|
|
971
|
-
}
|
|
972
|
-
),
|
|
973
|
-
onClick: () => setIsOpen(!isOpen),
|
|
974
|
-
disabled: isDisabled,
|
|
975
|
-
children: [
|
|
976
|
-
!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() } })) }),
|
|
977
|
-
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "textstyle-description", children: hintText ?? translation("select") }),
|
|
978
|
-
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" })
|
|
979
|
-
]
|
|
980
|
-
}
|
|
981
|
-
),
|
|
982
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
983
|
-
"div",
|
|
984
|
-
{
|
|
985
|
-
ref: menuRef,
|
|
986
|
-
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",
|
|
987
|
-
children: [
|
|
988
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
989
|
-
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",
|
|
990
1377
|
{
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
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,
|
|
996
1415
|
{
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
},
|
|
1007
|
-
|
|
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
|
|
1008
1428
|
},
|
|
1009
1429
|
index
|
|
1010
|
-
)
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
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)(
|
|
1016
1437
|
SolidButton,
|
|
1017
1438
|
{
|
|
1018
1439
|
color: "neutral",
|
|
@@ -1027,7 +1448,7 @@ var MultiSelect = ({
|
|
|
1027
1448
|
children: translation("all")
|
|
1028
1449
|
}
|
|
1029
1450
|
),
|
|
1030
|
-
/* @__PURE__ */ (0,
|
|
1451
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1031
1452
|
SolidButton,
|
|
1032
1453
|
{
|
|
1033
1454
|
color: "neutral",
|
|
@@ -1042,19 +1463,19 @@ var MultiSelect = ({
|
|
|
1042
1463
|
}
|
|
1043
1464
|
)
|
|
1044
1465
|
] }),
|
|
1045
|
-
/* @__PURE__ */ (0,
|
|
1466
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SolidButton, { size: "small", onClick: close, children: "Done" })
|
|
1046
1467
|
] })
|
|
1047
|
-
]
|
|
1468
|
+
] });
|
|
1048
1469
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1470
|
+
}
|
|
1471
|
+
)
|
|
1051
1472
|
] });
|
|
1052
1473
|
};
|
|
1053
1474
|
|
|
1054
1475
|
// src/components/properties/PropertyBase.tsx
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1057
|
-
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");
|
|
1058
1479
|
var PropertyBase = ({
|
|
1059
1480
|
overwriteTranslation,
|
|
1060
1481
|
name,
|
|
@@ -1068,36 +1489,44 @@ var PropertyBase = ({
|
|
|
1068
1489
|
}) => {
|
|
1069
1490
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1070
1491
|
const requiredAndNoValue = softRequired && !hasValue;
|
|
1071
|
-
return /* @__PURE__ */ (0,
|
|
1072
|
-
/* @__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)(
|
|
1073
1494
|
"div",
|
|
1074
1495
|
{
|
|
1075
|
-
className: (0,
|
|
1076
|
-
"
|
|
1077
|
-
|
|
1078
|
-
|
|
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
|
+
),
|
|
1079
1504
|
children: [
|
|
1080
|
-
icon,
|
|
1081
|
-
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 })
|
|
1082
1507
|
]
|
|
1083
1508
|
}
|
|
1084
1509
|
),
|
|
1085
|
-
/* @__PURE__ */ (0,
|
|
1510
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1086
1511
|
"div",
|
|
1087
1512
|
{
|
|
1088
|
-
className: (0,
|
|
1089
|
-
"
|
|
1090
|
-
|
|
1091
|
-
|
|
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
|
+
),
|
|
1092
1521
|
children: [
|
|
1093
1522
|
input({ softRequired, hasValue }),
|
|
1094
|
-
requiredAndNoValue && /* @__PURE__ */ (0,
|
|
1095
|
-
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)(
|
|
1096
1525
|
TextButton,
|
|
1097
1526
|
{
|
|
1098
1527
|
onClick: onRemove,
|
|
1099
1528
|
color: "negative",
|
|
1100
|
-
className: (0,
|
|
1529
|
+
className: (0, import_clsx12.default)("items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
1101
1530
|
disabled: !hasValue || readOnly,
|
|
1102
1531
|
children: translation("remove")
|
|
1103
1532
|
}
|
|
@@ -1109,7 +1538,7 @@ var PropertyBase = ({
|
|
|
1109
1538
|
};
|
|
1110
1539
|
|
|
1111
1540
|
// src/components/properties/MultiSelectProperty.tsx
|
|
1112
|
-
var
|
|
1541
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1113
1542
|
var MultiSelectProperty = ({
|
|
1114
1543
|
overwriteTranslation,
|
|
1115
1544
|
options,
|
|
@@ -1117,11 +1546,12 @@ var MultiSelectProperty = ({
|
|
|
1117
1546
|
readOnly = false,
|
|
1118
1547
|
softRequired,
|
|
1119
1548
|
onRemove,
|
|
1549
|
+
onAddNew,
|
|
1120
1550
|
...multiSelectProps
|
|
1121
1551
|
}) => {
|
|
1122
1552
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1123
1553
|
const hasValue = options.some((value) => value.selected);
|
|
1124
|
-
return /* @__PURE__ */ (0,
|
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1125
1555
|
PropertyBase,
|
|
1126
1556
|
{
|
|
1127
1557
|
name,
|
|
@@ -1129,20 +1559,42 @@ var MultiSelectProperty = ({
|
|
|
1129
1559
|
readOnly,
|
|
1130
1560
|
softRequired,
|
|
1131
1561
|
hasValue,
|
|
1132
|
-
icon: /* @__PURE__ */ (0,
|
|
1133
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ (0,
|
|
1134
|
-
|
|
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,
|
|
1135
1565
|
{
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
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",
|
|
1139
1595
|
{
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
options,
|
|
1143
|
-
isDisabled: readOnly,
|
|
1144
|
-
useChipDisplay: true,
|
|
1145
|
-
hintText: `${translation("select")}...`
|
|
1596
|
+
"!bg-warning !text-surface-warning": softRequired2 && !hasValue,
|
|
1597
|
+
"": !softRequired2 || hasValue
|
|
1146
1598
|
}
|
|
1147
1599
|
)
|
|
1148
1600
|
}
|