@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
|
@@ -30,12 +30,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var Select_exports = {};
|
|
31
31
|
__export(Select_exports, {
|
|
32
32
|
Select: () => Select,
|
|
33
|
+
SelectTile: () => SelectTile,
|
|
33
34
|
SelectUncontrolled: () => SelectUncontrolled
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(Select_exports);
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var import_react13 = require("react");
|
|
38
|
+
var import_react14 = require("react");
|
|
39
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
39
40
|
|
|
40
41
|
// src/components/user-action/Label.tsx
|
|
41
42
|
var import_clsx = __toESM(require("clsx"));
|
|
@@ -55,109 +56,384 @@ var Label = ({
|
|
|
55
56
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { ...props, className: (0, import_clsx.default)(styleMapping[labelType], className), children: children ? children : name });
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
// src/components/layout-and-navigation/
|
|
59
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
60
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
59
61
|
var import_lucide_react = require("lucide-react");
|
|
62
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
63
|
+
var Tile = ({
|
|
64
|
+
title,
|
|
65
|
+
description,
|
|
66
|
+
onClick,
|
|
67
|
+
isSelected = false,
|
|
68
|
+
disabled = false,
|
|
69
|
+
prefix,
|
|
70
|
+
suffix,
|
|
71
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
72
|
+
selectedClassName = " bg-primary/20",
|
|
73
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
74
|
+
className
|
|
75
|
+
}) => {
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: (0, import_clsx2.default)(
|
|
80
|
+
"flex-row-2 w-full items-center",
|
|
81
|
+
{
|
|
82
|
+
[normalClassName]: !!onClick && !disabled,
|
|
83
|
+
[selectedClassName]: isSelected && !disabled,
|
|
84
|
+
[disabledClassName]: disabled
|
|
85
|
+
},
|
|
86
|
+
className
|
|
87
|
+
),
|
|
88
|
+
onClick: disabled ? void 0 : onClick,
|
|
89
|
+
children: [
|
|
90
|
+
prefix,
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex-col-0 w-full", children: [
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h4", { className: (0, import_clsx2.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
93
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: (0, import_clsx2.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
94
|
+
] }),
|
|
95
|
+
suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Check, { size: 24 }) : void 0)
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
102
|
+
var import_react = require("react");
|
|
103
|
+
var import_lucide_react2 = require("lucide-react");
|
|
104
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
105
|
+
|
|
106
|
+
// src/util/noop.ts
|
|
107
|
+
var noop = () => void 0;
|
|
108
|
+
|
|
109
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
110
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
111
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
113
|
+
import_lucide_react2.ChevronDown,
|
|
114
|
+
{
|
|
115
|
+
className: (0, import_clsx3.default)(
|
|
116
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
|
|
117
|
+
{ "rotate-180": isExpanded },
|
|
118
|
+
className
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
var Expandable = (0, import_react.forwardRef)(function Expandable2({
|
|
124
|
+
children,
|
|
125
|
+
label,
|
|
126
|
+
icon,
|
|
127
|
+
isExpanded = false,
|
|
128
|
+
onChange = noop,
|
|
129
|
+
clickOnlyOnHeader = true,
|
|
130
|
+
disabled = false,
|
|
131
|
+
className,
|
|
132
|
+
headerClassName,
|
|
133
|
+
contentClassName
|
|
134
|
+
}, ref) {
|
|
135
|
+
const defaultIcon = (0, import_react.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
|
|
136
|
+
icon ??= defaultIcon;
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
ref,
|
|
141
|
+
className: (0, import_clsx3.default)("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
142
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
className: (0, import_clsx3.default)(
|
|
148
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
149
|
+
{
|
|
150
|
+
"group-hover:brightness-97": !isExpanded,
|
|
151
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
152
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
153
|
+
},
|
|
154
|
+
headerClassName
|
|
155
|
+
),
|
|
156
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
157
|
+
children: [
|
|
158
|
+
label,
|
|
159
|
+
icon(isExpanded)
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: (0, import_clsx3.default)(
|
|
167
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
168
|
+
{
|
|
169
|
+
"max-h-96 opacity-100 pb-2": isExpanded,
|
|
170
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
171
|
+
},
|
|
172
|
+
contentClassName
|
|
173
|
+
),
|
|
174
|
+
children
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
});
|
|
181
|
+
var ExpandableUncontrolled = (0, import_react.forwardRef)(function ExpandableUncontrolled2({
|
|
182
|
+
isExpanded,
|
|
183
|
+
onChange = noop,
|
|
184
|
+
...props
|
|
185
|
+
}, ref) {
|
|
186
|
+
const [usedIsExpanded, setUsedIsExpanded] = (0, import_react.useState)(isExpanded);
|
|
187
|
+
(0, import_react.useEffect)(() => {
|
|
188
|
+
setUsedIsExpanded(isExpanded);
|
|
189
|
+
}, [isExpanded]);
|
|
190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
191
|
+
Expandable,
|
|
192
|
+
{
|
|
193
|
+
...props,
|
|
194
|
+
ref,
|
|
195
|
+
isExpanded: usedIsExpanded,
|
|
196
|
+
onChange: (value) => {
|
|
197
|
+
onChange(value);
|
|
198
|
+
setUsedIsExpanded(value);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// src/components/user-action/Menu.tsx
|
|
205
|
+
var import_react4 = require("react");
|
|
60
206
|
var import_clsx4 = __toESM(require("clsx"));
|
|
61
207
|
|
|
62
|
-
// src/
|
|
208
|
+
// src/hooks/useOutsideClick.ts
|
|
63
209
|
var import_react2 = require("react");
|
|
210
|
+
var useOutsideClick = (refs, handler) => {
|
|
211
|
+
(0, import_react2.useEffect)(() => {
|
|
212
|
+
const listener = (event) => {
|
|
213
|
+
if (event.target === null) return;
|
|
214
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
handler();
|
|
218
|
+
};
|
|
219
|
+
document.addEventListener("mousedown", listener);
|
|
220
|
+
document.addEventListener("touchstart", listener);
|
|
221
|
+
return () => {
|
|
222
|
+
document.removeEventListener("mousedown", listener);
|
|
223
|
+
document.removeEventListener("touchstart", listener);
|
|
224
|
+
};
|
|
225
|
+
}, [refs, handler]);
|
|
226
|
+
};
|
|
64
227
|
|
|
65
|
-
// src/hooks/
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var languagesLocalNames = {
|
|
71
|
-
en: "English",
|
|
72
|
-
de: "Deutsch"
|
|
228
|
+
// src/hooks/useHoverState.ts
|
|
229
|
+
var import_react3 = require("react");
|
|
230
|
+
var defaultUseHoverStateProps = {
|
|
231
|
+
closingDelay: 200,
|
|
232
|
+
isDisabled: false
|
|
73
233
|
};
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
234
|
+
var useHoverState = (props = void 0) => {
|
|
235
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
236
|
+
const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
|
|
237
|
+
const [timer, setTimer] = (0, import_react3.useState)();
|
|
238
|
+
const onMouseEnter = () => {
|
|
239
|
+
if (isDisabled) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
clearTimeout(timer);
|
|
243
|
+
setIsHovered(true);
|
|
244
|
+
};
|
|
245
|
+
const onMouseLeave = () => {
|
|
246
|
+
if (isDisabled) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
setTimer(setTimeout(() => {
|
|
250
|
+
setIsHovered(false);
|
|
251
|
+
}, closingDelay));
|
|
252
|
+
};
|
|
253
|
+
(0, import_react3.useEffect)(() => {
|
|
254
|
+
if (timer) {
|
|
255
|
+
return () => {
|
|
256
|
+
clearTimeout(timer);
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
(0, import_react3.useEffect)(() => {
|
|
261
|
+
if (timer) {
|
|
262
|
+
clearTimeout(timer);
|
|
263
|
+
}
|
|
264
|
+
}, [isDisabled]);
|
|
265
|
+
return {
|
|
266
|
+
isHovered,
|
|
267
|
+
setIsHovered,
|
|
268
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
269
|
+
};
|
|
79
270
|
};
|
|
80
271
|
|
|
81
|
-
// src/
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
272
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
273
|
+
var resolve = (children, bag) => {
|
|
274
|
+
if (typeof children === "function") {
|
|
275
|
+
return children(bag);
|
|
276
|
+
}
|
|
277
|
+
return children ?? void 0;
|
|
278
|
+
};
|
|
279
|
+
var BagFunctionUtil = {
|
|
280
|
+
resolve
|
|
281
|
+
};
|
|
88
282
|
|
|
89
|
-
// src/
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
other: -1
|
|
283
|
+
// src/hooks/usePopoverPosition.ts
|
|
284
|
+
var defaultPopoverPositionOptions = {
|
|
285
|
+
edgePadding: 16,
|
|
286
|
+
outerGap: 4,
|
|
287
|
+
horizontalAlignment: "leftInside",
|
|
288
|
+
verticalAlignment: "bottomOutside",
|
|
289
|
+
disabled: false
|
|
97
290
|
};
|
|
98
|
-
var
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
291
|
+
var usePopoverPosition = (trigger, options) => {
|
|
292
|
+
const {
|
|
293
|
+
edgePadding,
|
|
294
|
+
outerGap,
|
|
295
|
+
verticalAlignment,
|
|
296
|
+
horizontalAlignment,
|
|
297
|
+
disabled
|
|
298
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
299
|
+
if (disabled || !trigger) {
|
|
300
|
+
return {};
|
|
105
301
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
302
|
+
const left = {
|
|
303
|
+
leftOutside: trigger.left - outerGap,
|
|
304
|
+
leftInside: trigger.left,
|
|
305
|
+
rightOutside: trigger.right + outerGap,
|
|
306
|
+
rightInside: trigger.right,
|
|
307
|
+
center: trigger.left + trigger.width / 2
|
|
308
|
+
}[horizontalAlignment];
|
|
309
|
+
const top = {
|
|
310
|
+
topOutside: trigger.top - outerGap,
|
|
311
|
+
topInside: trigger.top,
|
|
312
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
313
|
+
bottomInside: trigger.bottom,
|
|
314
|
+
center: trigger.top + trigger.height / 2
|
|
315
|
+
}[verticalAlignment];
|
|
316
|
+
const translateX = {
|
|
317
|
+
leftOutside: "-100%",
|
|
318
|
+
leftInside: void 0,
|
|
319
|
+
rightOutside: void 0,
|
|
320
|
+
rightInside: "-100%",
|
|
321
|
+
center: "-50%"
|
|
322
|
+
}[horizontalAlignment];
|
|
323
|
+
const translateY = {
|
|
324
|
+
topOutside: "-100%",
|
|
325
|
+
topInside: void 0,
|
|
326
|
+
bottomOutside: void 0,
|
|
327
|
+
bottomInside: "-100%",
|
|
328
|
+
center: "-50%"
|
|
329
|
+
}[verticalAlignment];
|
|
330
|
+
return {
|
|
331
|
+
left: Math.max(left, edgePadding),
|
|
332
|
+
top: Math.max(top, edgePadding),
|
|
333
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// src/components/user-action/Menu.tsx
|
|
338
|
+
var import_react_dom = require("react-dom");
|
|
339
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
340
|
+
function getScrollableParents(element) {
|
|
341
|
+
const scrollables = [];
|
|
342
|
+
let parent = element.parentElement;
|
|
343
|
+
while (parent) {
|
|
344
|
+
scrollables.push(parent);
|
|
345
|
+
parent = parent.parentElement;
|
|
346
|
+
}
|
|
347
|
+
return scrollables;
|
|
348
|
+
}
|
|
349
|
+
var Menu = ({
|
|
350
|
+
trigger,
|
|
351
|
+
children,
|
|
352
|
+
alignmentHorizontal = "leftInside",
|
|
353
|
+
alignmentVertical = "bottomOutside",
|
|
354
|
+
showOnHover = false,
|
|
355
|
+
disabled = false,
|
|
356
|
+
menuClassName = ""
|
|
357
|
+
}) => {
|
|
358
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
359
|
+
const triggerRef = (0, import_react4.useRef)(null);
|
|
360
|
+
const menuRef = (0, import_react4.useRef)(null);
|
|
361
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
362
|
+
const [isHidden, setIsHidden] = (0, import_react4.useState)(true);
|
|
363
|
+
const bag = {
|
|
364
|
+
isOpen,
|
|
365
|
+
close: () => setIsOpen(false),
|
|
366
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
367
|
+
disabled
|
|
368
|
+
};
|
|
369
|
+
const menuPosition = usePopoverPosition(
|
|
370
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
371
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
372
|
+
);
|
|
373
|
+
(0, import_react4.useEffect)(() => {
|
|
374
|
+
if (!isOpen) return;
|
|
375
|
+
const triggerEl = triggerRef.current;
|
|
376
|
+
if (!triggerEl) return;
|
|
377
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
378
|
+
const close = () => setIsOpen(false);
|
|
379
|
+
scrollableParents.forEach((parent) => {
|
|
380
|
+
parent.addEventListener("scroll", close);
|
|
381
|
+
});
|
|
382
|
+
window.addEventListener("resize", close);
|
|
383
|
+
return () => {
|
|
384
|
+
scrollableParents.forEach((parent) => {
|
|
385
|
+
parent.removeEventListener("scroll", close);
|
|
386
|
+
});
|
|
387
|
+
window.removeEventListener("resize", close);
|
|
388
|
+
};
|
|
389
|
+
}, [isOpen, setIsOpen]);
|
|
390
|
+
(0, import_react4.useEffect)(() => {
|
|
391
|
+
if (isOpen) {
|
|
392
|
+
setIsHidden(false);
|
|
393
|
+
}
|
|
394
|
+
}, [isOpen]);
|
|
395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
396
|
+
trigger(bag, triggerRef),
|
|
397
|
+
(0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
ref: menuRef,
|
|
401
|
+
onClick: (e) => e.stopPropagation(),
|
|
402
|
+
className: (0, import_clsx4.default)(
|
|
403
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
404
|
+
{
|
|
405
|
+
"animate-pop-in": isOpen,
|
|
406
|
+
"animate-pop-out": !isOpen,
|
|
407
|
+
"hidden": isHidden
|
|
408
|
+
},
|
|
409
|
+
menuClassName
|
|
410
|
+
),
|
|
411
|
+
onAnimationEnd: () => {
|
|
412
|
+
if (!isOpen) {
|
|
413
|
+
setIsHidden(true);
|
|
133
414
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
140
|
-
return forProcessing;
|
|
415
|
+
},
|
|
416
|
+
style: {
|
|
417
|
+
...menuPosition
|
|
418
|
+
},
|
|
419
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
141
420
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
return `{{${usedLanguage}:${key}}}`;
|
|
146
|
-
};
|
|
421
|
+
), document.body)
|
|
422
|
+
] });
|
|
147
423
|
};
|
|
148
424
|
|
|
149
425
|
// src/components/user-action/Input.tsx
|
|
150
|
-
var
|
|
151
|
-
var
|
|
426
|
+
var import_react8 = require("react");
|
|
427
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
152
428
|
|
|
153
429
|
// src/hooks/useDelay.ts
|
|
154
|
-
var
|
|
430
|
+
var import_react5 = require("react");
|
|
155
431
|
var defaultOptions = {
|
|
156
432
|
delay: 3e3,
|
|
157
433
|
disabled: false
|
|
158
434
|
};
|
|
159
435
|
function useDelay(options) {
|
|
160
|
-
const [timer, setTimer] = (0,
|
|
436
|
+
const [timer, setTimer] = (0, import_react5.useState)(void 0);
|
|
161
437
|
const { delay, disabled } = {
|
|
162
438
|
...defaultOptions,
|
|
163
439
|
...options
|
|
@@ -176,28 +452,24 @@ function useDelay(options) {
|
|
|
176
452
|
setTimer(void 0);
|
|
177
453
|
}, delay));
|
|
178
454
|
};
|
|
179
|
-
(0,
|
|
455
|
+
(0, import_react5.useEffect)(() => {
|
|
180
456
|
return () => {
|
|
181
457
|
clearTimeout(timer);
|
|
182
458
|
};
|
|
183
459
|
}, [timer]);
|
|
184
|
-
(0,
|
|
460
|
+
(0, import_react5.useEffect)(() => {
|
|
185
461
|
if (disabled) {
|
|
186
462
|
clearTimeout(timer);
|
|
187
463
|
setTimer(void 0);
|
|
188
464
|
}
|
|
189
465
|
}, [disabled, timer]);
|
|
190
|
-
console.log(timer);
|
|
191
466
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
192
467
|
}
|
|
193
468
|
|
|
194
|
-
// src/util/noop.ts
|
|
195
|
-
var noop = () => void 0;
|
|
196
|
-
|
|
197
469
|
// src/hooks/useFocusManagement.ts
|
|
198
|
-
var
|
|
470
|
+
var import_react6 = require("react");
|
|
199
471
|
function useFocusManagement() {
|
|
200
|
-
const getFocusableElements = (0,
|
|
472
|
+
const getFocusableElements = (0, import_react6.useCallback)(() => {
|
|
201
473
|
return Array.from(
|
|
202
474
|
document.querySelectorAll(
|
|
203
475
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -206,7 +478,7 @@ function useFocusManagement() {
|
|
|
206
478
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
207
479
|
);
|
|
208
480
|
}, []);
|
|
209
|
-
const getNextFocusElement = (0,
|
|
481
|
+
const getNextFocusElement = (0, import_react6.useCallback)(() => {
|
|
210
482
|
const elements = getFocusableElements();
|
|
211
483
|
if (elements.length === 0) {
|
|
212
484
|
return void 0;
|
|
@@ -218,11 +490,11 @@ function useFocusManagement() {
|
|
|
218
490
|
}
|
|
219
491
|
return nextElement;
|
|
220
492
|
}, [getFocusableElements]);
|
|
221
|
-
const focusNext = (0,
|
|
493
|
+
const focusNext = (0, import_react6.useCallback)(() => {
|
|
222
494
|
const nextElement = getNextFocusElement();
|
|
223
495
|
nextElement?.focus();
|
|
224
496
|
}, [getNextFocusElement]);
|
|
225
|
-
const getPreviousFocusElement = (0,
|
|
497
|
+
const getPreviousFocusElement = (0, import_react6.useCallback)(() => {
|
|
226
498
|
const elements = getFocusableElements();
|
|
227
499
|
if (elements.length === 0) {
|
|
228
500
|
return void 0;
|
|
@@ -238,7 +510,7 @@ function useFocusManagement() {
|
|
|
238
510
|
}
|
|
239
511
|
return previousElement;
|
|
240
512
|
}, [getFocusableElements]);
|
|
241
|
-
const focusPrevious = (0,
|
|
513
|
+
const focusPrevious = (0, import_react6.useCallback)(() => {
|
|
242
514
|
const previousElement = getPreviousFocusElement();
|
|
243
515
|
if (previousElement) previousElement.focus();
|
|
244
516
|
}, [getPreviousFocusElement]);
|
|
@@ -252,10 +524,10 @@ function useFocusManagement() {
|
|
|
252
524
|
}
|
|
253
525
|
|
|
254
526
|
// src/hooks/useFocusOnceVisible.ts
|
|
255
|
-
var
|
|
527
|
+
var import_react7 = __toESM(require("react"));
|
|
256
528
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
257
|
-
const [hasUsedFocus, setHasUsedFocus] =
|
|
258
|
-
(0,
|
|
529
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react7.default.useState(false);
|
|
530
|
+
(0, import_react7.useEffect)(() => {
|
|
259
531
|
if (disable || hasUsedFocus) {
|
|
260
532
|
return;
|
|
261
533
|
}
|
|
@@ -275,9 +547,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
275
547
|
};
|
|
276
548
|
|
|
277
549
|
// src/components/user-action/Input.tsx
|
|
278
|
-
var
|
|
550
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
279
551
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
280
|
-
return (0,
|
|
552
|
+
return (0, import_clsx5.default)(
|
|
281
553
|
"px-2 py-1.5 rounded-md border-2",
|
|
282
554
|
{
|
|
283
555
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -291,7 +563,7 @@ var defaultEditCompleteOptions = {
|
|
|
291
563
|
afterDelay: true,
|
|
292
564
|
delay: 2500
|
|
293
565
|
};
|
|
294
|
-
var Input = (0,
|
|
566
|
+
var Input = (0, import_react8.forwardRef)(function Input2({
|
|
295
567
|
id,
|
|
296
568
|
type = "text",
|
|
297
569
|
value,
|
|
@@ -314,10 +586,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
314
586
|
restartTimer,
|
|
315
587
|
clearTimer
|
|
316
588
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
317
|
-
const innerRef = (0,
|
|
589
|
+
const innerRef = (0, import_react8.useRef)(null);
|
|
318
590
|
const { focusNext } = useFocusManagement();
|
|
319
591
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
320
|
-
(0,
|
|
592
|
+
(0, import_react8.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
321
593
|
const handleKeyDown = (e) => {
|
|
322
594
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
323
595
|
e.preventDefault();
|
|
@@ -325,9 +597,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
325
597
|
focusNext();
|
|
326
598
|
}
|
|
327
599
|
};
|
|
328
|
-
return /* @__PURE__ */ (0,
|
|
329
|
-
label && /* @__PURE__ */ (0,
|
|
330
|
-
/* @__PURE__ */ (0,
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx5.default)({ "w-full": expanded }, containerClassName), children: [
|
|
601
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx5.default)("mb-1", label.className) }),
|
|
602
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
331
603
|
"input",
|
|
332
604
|
{
|
|
333
605
|
...restProps,
|
|
@@ -336,7 +608,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
336
608
|
id,
|
|
337
609
|
type,
|
|
338
610
|
disabled,
|
|
339
|
-
className: (0,
|
|
611
|
+
className: (0, import_clsx5.default)(getInputClassName({ disabled }), className),
|
|
340
612
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
341
613
|
onBlur: (event) => {
|
|
342
614
|
onBlur?.(event);
|
|
@@ -366,7 +638,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
366
638
|
)
|
|
367
639
|
] });
|
|
368
640
|
});
|
|
369
|
-
var FormInput = (0,
|
|
641
|
+
var FormInput = (0, import_react8.forwardRef)(function FormInput2({
|
|
370
642
|
id,
|
|
371
643
|
labelText,
|
|
372
644
|
errorText,
|
|
@@ -378,137 +650,120 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
|
|
|
378
650
|
disabled,
|
|
379
651
|
...restProps
|
|
380
652
|
}, ref) {
|
|
381
|
-
const input = /* @__PURE__ */ (0,
|
|
653
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
382
654
|
"input",
|
|
383
655
|
{
|
|
384
656
|
...restProps,
|
|
385
657
|
ref,
|
|
386
658
|
id,
|
|
387
659
|
disabled,
|
|
388
|
-
className: (0,
|
|
660
|
+
className: (0, import_clsx5.default)(
|
|
389
661
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
390
662
|
className
|
|
391
663
|
)
|
|
392
664
|
}
|
|
393
665
|
);
|
|
394
|
-
return /* @__PURE__ */ (0,
|
|
395
|
-
labelText && /* @__PURE__ */ (0,
|
|
666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx5.default)("flex flex-col gap-y-1", containerClassName), children: [
|
|
667
|
+
labelText && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: id, className: (0, import_clsx5.default)("textstyle-label-md", labelClassName), children: [
|
|
396
668
|
labelText,
|
|
397
|
-
required && /* @__PURE__ */ (0,
|
|
669
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
398
670
|
] }),
|
|
399
671
|
input,
|
|
400
|
-
errorText && /* @__PURE__ */ (0,
|
|
672
|
+
errorText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: id, className: (0, import_clsx5.default)("text-negative", errorClassName), children: errorText })
|
|
401
673
|
] });
|
|
402
674
|
});
|
|
403
675
|
|
|
404
|
-
// src/
|
|
405
|
-
var
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
676
|
+
// src/localization/LanguageProvider.tsx
|
|
677
|
+
var import_react10 = require("react");
|
|
678
|
+
|
|
679
|
+
// src/hooks/useLocalStorage.ts
|
|
680
|
+
var import_react9 = require("react");
|
|
681
|
+
|
|
682
|
+
// src/localization/util.ts
|
|
683
|
+
var languages = ["en", "de"];
|
|
684
|
+
var languagesLocalNames = {
|
|
685
|
+
en: "English",
|
|
686
|
+
de: "Deutsch"
|
|
411
687
|
};
|
|
412
|
-
var
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
medium: "btn-md",
|
|
418
|
-
large: "btn-lg"
|
|
419
|
-
};
|
|
420
|
-
var iconPaddingMapping = {
|
|
421
|
-
tiny: "icon-btn-xs",
|
|
422
|
-
small: "icon-btn-sm",
|
|
423
|
-
medium: "icon-btn-md",
|
|
424
|
-
large: "icon-btn-lg"
|
|
425
|
-
};
|
|
426
|
-
var ButtonUtil = {
|
|
427
|
-
paddingMapping,
|
|
428
|
-
iconPaddingMapping
|
|
429
|
-
};
|
|
430
|
-
var IconButton = ({
|
|
431
|
-
children,
|
|
432
|
-
disabled = false,
|
|
433
|
-
color = "primary",
|
|
434
|
-
size = "medium",
|
|
435
|
-
onClick,
|
|
436
|
-
className,
|
|
437
|
-
...restProps
|
|
438
|
-
}) => {
|
|
439
|
-
const colorClasses = {
|
|
440
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
441
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
442
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
443
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
444
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
445
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
446
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
447
|
-
transparent: "bg-transparent"
|
|
448
|
-
}[color];
|
|
449
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
450
|
-
"button",
|
|
451
|
-
{
|
|
452
|
-
onClick: disabled ? void 0 : onClick,
|
|
453
|
-
disabled: disabled || onClick === void 0,
|
|
454
|
-
className: (0, import_clsx3.default)(
|
|
455
|
-
{
|
|
456
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
457
|
-
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
458
|
-
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
459
|
-
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
460
|
-
},
|
|
461
|
-
ButtonUtil.iconPaddingMapping[size],
|
|
462
|
-
className
|
|
463
|
-
),
|
|
464
|
-
...restProps,
|
|
465
|
-
children
|
|
466
|
-
}
|
|
467
|
-
);
|
|
688
|
+
var DEFAULT_LANGUAGE = "en";
|
|
689
|
+
var LanguageUtil = {
|
|
690
|
+
languages,
|
|
691
|
+
DEFAULT_LANGUAGE,
|
|
692
|
+
languagesLocalNames
|
|
468
693
|
};
|
|
469
694
|
|
|
470
|
-
// src/
|
|
471
|
-
var
|
|
695
|
+
// src/localization/LanguageProvider.tsx
|
|
696
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
697
|
+
var LanguageContext = (0, import_react10.createContext)({
|
|
698
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
699
|
+
setLanguage: (v) => v
|
|
700
|
+
});
|
|
701
|
+
var useLanguage = () => (0, import_react10.useContext)(LanguageContext);
|
|
472
702
|
|
|
473
|
-
// src/
|
|
474
|
-
var
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
});
|
|
703
|
+
// src/localization/useTranslation.ts
|
|
704
|
+
var TranslationPluralCount = {
|
|
705
|
+
zero: 0,
|
|
706
|
+
one: 1,
|
|
707
|
+
two: 2,
|
|
708
|
+
few: 3,
|
|
709
|
+
many: 11,
|
|
710
|
+
other: -1
|
|
482
711
|
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
712
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
713
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
714
|
+
const { language: inferredLanguage } = useLanguage();
|
|
715
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
716
|
+
const usedTranslations = [...translations];
|
|
717
|
+
if (overwrite) {
|
|
718
|
+
usedTranslations.push(overwrite);
|
|
719
|
+
}
|
|
720
|
+
return (key, options) => {
|
|
721
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
722
|
+
try {
|
|
723
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
724
|
+
const translation = translations[i];
|
|
725
|
+
const localizedTranslation = translation[usedLanguage];
|
|
726
|
+
if (!localizedTranslation) {
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
const value = localizedTranslation[key];
|
|
730
|
+
if (!value) {
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
let forProcessing;
|
|
734
|
+
if (typeof value !== "string") {
|
|
735
|
+
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
736
|
+
forProcessing = value.zero;
|
|
737
|
+
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
738
|
+
forProcessing = value.one;
|
|
739
|
+
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
740
|
+
forProcessing = value.two;
|
|
741
|
+
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
742
|
+
forProcessing = value.few;
|
|
743
|
+
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
744
|
+
forProcessing = value.many;
|
|
745
|
+
} else {
|
|
746
|
+
forProcessing = value.other;
|
|
747
|
+
}
|
|
748
|
+
} else {
|
|
749
|
+
forProcessing = value;
|
|
750
|
+
}
|
|
751
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
752
|
+
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
753
|
+
});
|
|
754
|
+
return forProcessing;
|
|
755
|
+
}
|
|
756
|
+
} catch (e) {
|
|
757
|
+
console.error(e);
|
|
758
|
+
}
|
|
759
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
506
760
|
};
|
|
507
761
|
};
|
|
508
762
|
|
|
509
763
|
// src/localization/defaults/form.ts
|
|
510
764
|
var formTranslation = {
|
|
511
765
|
en: {
|
|
766
|
+
add: "Add",
|
|
512
767
|
all: "All",
|
|
513
768
|
apply: "Apply",
|
|
514
769
|
back: "Back",
|
|
@@ -521,6 +776,7 @@ var formTranslation = {
|
|
|
521
776
|
confirm: "Confirm",
|
|
522
777
|
copy: "Copy",
|
|
523
778
|
copied: "Copied",
|
|
779
|
+
create: "Create",
|
|
524
780
|
decline: "Decline",
|
|
525
781
|
delete: "Delete",
|
|
526
782
|
discard: "Discard",
|
|
@@ -563,6 +819,7 @@ var formTranslation = {
|
|
|
563
819
|
yes: "Yes"
|
|
564
820
|
},
|
|
565
821
|
de: {
|
|
822
|
+
add: "Hinzuf\xFCgen",
|
|
566
823
|
all: "Alle",
|
|
567
824
|
apply: "Anwenden",
|
|
568
825
|
back: "Zur\xFCck",
|
|
@@ -575,6 +832,7 @@ var formTranslation = {
|
|
|
575
832
|
confirm: "Best\xE4tigen",
|
|
576
833
|
copy: "Kopieren",
|
|
577
834
|
copied: "Kopiert",
|
|
835
|
+
create: "Erstellen",
|
|
578
836
|
decline: "Ablehnen",
|
|
579
837
|
delete: "L\xF6schen",
|
|
580
838
|
discard: "Verwerfen",
|
|
@@ -618,186 +876,335 @@ var formTranslation = {
|
|
|
618
876
|
}
|
|
619
877
|
};
|
|
620
878
|
|
|
621
|
-
// src/components/
|
|
622
|
-
var
|
|
623
|
-
var
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}
|
|
879
|
+
// src/components/user-action/Button.tsx
|
|
880
|
+
var import_react11 = require("react");
|
|
881
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
882
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
883
|
+
var ButtonColorUtil = {
|
|
884
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
885
|
+
text: ["primary", "negative", "neutral"],
|
|
886
|
+
outline: ["primary"]
|
|
630
887
|
};
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
list,
|
|
634
|
-
initialSearch = "",
|
|
635
|
-
searchMapping,
|
|
636
|
-
autoFocus,
|
|
637
|
-
minimumItemsForSearch = 6,
|
|
638
|
-
itemMapper,
|
|
639
|
-
className,
|
|
640
|
-
resultListClassName
|
|
641
|
-
}) => {
|
|
642
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
643
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
644
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("col gap-y-2", className), children: [
|
|
645
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
646
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
647
|
-
Input,
|
|
648
|
-
{
|
|
649
|
-
value: search,
|
|
650
|
-
onChangeText: setSearch,
|
|
651
|
-
placeholder: translation("search"),
|
|
652
|
-
autoFocus,
|
|
653
|
-
className: "w-full"
|
|
654
|
-
}
|
|
655
|
-
),
|
|
656
|
-
/* @__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" }) })
|
|
657
|
-
] }),
|
|
658
|
-
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") })
|
|
659
|
-
] });
|
|
888
|
+
var IconButtonUtil = {
|
|
889
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
660
890
|
};
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
var
|
|
667
|
-
|
|
668
|
-
|
|
891
|
+
var paddingMapping = {
|
|
892
|
+
small: "btn-sm",
|
|
893
|
+
medium: "btn-md",
|
|
894
|
+
large: "btn-lg"
|
|
895
|
+
};
|
|
896
|
+
var iconPaddingMapping = {
|
|
897
|
+
tiny: "icon-btn-xs",
|
|
898
|
+
small: "icon-btn-sm",
|
|
899
|
+
medium: "icon-btn-md",
|
|
900
|
+
large: "icon-btn-lg"
|
|
901
|
+
};
|
|
902
|
+
var ButtonUtil = {
|
|
903
|
+
paddingMapping,
|
|
904
|
+
iconPaddingMapping
|
|
905
|
+
};
|
|
906
|
+
var SolidButton = (0, import_react11.forwardRef)(function SolidButton2({
|
|
907
|
+
children,
|
|
908
|
+
disabled = false,
|
|
909
|
+
color = "primary",
|
|
910
|
+
size = "medium",
|
|
911
|
+
startIcon,
|
|
912
|
+
endIcon,
|
|
669
913
|
onClick,
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
"
|
|
914
|
+
className,
|
|
915
|
+
...restProps
|
|
916
|
+
}, ref) {
|
|
917
|
+
const colorClasses = {
|
|
918
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
919
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
920
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
921
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
922
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
923
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
924
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
925
|
+
}[color];
|
|
926
|
+
const iconColorClasses = {
|
|
927
|
+
primary: "text-button-solid-primary-icon",
|
|
928
|
+
secondary: "text-button-solid-secondary-icon",
|
|
929
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
930
|
+
positive: "text-button-solid-positive-icon",
|
|
931
|
+
warning: "text-button-solid-warning-icon",
|
|
932
|
+
negative: "text-button-solid-negative-icon",
|
|
933
|
+
neutral: "text-button-solid-neutral-icon"
|
|
934
|
+
}[color];
|
|
935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
936
|
+
"button",
|
|
681
937
|
{
|
|
682
|
-
|
|
683
|
-
|
|
938
|
+
ref,
|
|
939
|
+
onClick,
|
|
940
|
+
disabled,
|
|
941
|
+
className: (0, import_clsx6.default)(
|
|
684
942
|
{
|
|
685
|
-
|
|
686
|
-
[
|
|
687
|
-
[disabledClassName]: isDisabled
|
|
943
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
944
|
+
[(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
688
945
|
},
|
|
946
|
+
ButtonUtil.paddingMapping[size],
|
|
689
947
|
className
|
|
690
948
|
),
|
|
691
|
-
|
|
949
|
+
...restProps,
|
|
692
950
|
children: [
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
951
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
952
|
+
"span",
|
|
953
|
+
{
|
|
954
|
+
className: (0, import_clsx6.default)({
|
|
955
|
+
[iconColorClasses]: !disabled,
|
|
956
|
+
[`text-disabled-icon`]: disabled
|
|
957
|
+
}),
|
|
958
|
+
children: startIcon
|
|
959
|
+
}
|
|
960
|
+
),
|
|
961
|
+
children,
|
|
962
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
963
|
+
"span",
|
|
964
|
+
{
|
|
965
|
+
className: (0, import_clsx6.default)({
|
|
966
|
+
[iconColorClasses]: !disabled,
|
|
967
|
+
[`text-disabled-icon`]: disabled
|
|
968
|
+
}),
|
|
969
|
+
children: endIcon
|
|
970
|
+
}
|
|
971
|
+
)
|
|
699
972
|
]
|
|
700
973
|
}
|
|
701
974
|
);
|
|
975
|
+
});
|
|
976
|
+
var IconButton = ({
|
|
977
|
+
children,
|
|
978
|
+
disabled = false,
|
|
979
|
+
color = "primary",
|
|
980
|
+
size = "medium",
|
|
981
|
+
className,
|
|
982
|
+
...restProps
|
|
983
|
+
}) => {
|
|
984
|
+
const colorClasses = {
|
|
985
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
986
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
987
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
988
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
989
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
990
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
991
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
992
|
+
transparent: "bg-transparent"
|
|
993
|
+
}[color];
|
|
994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
995
|
+
"button",
|
|
996
|
+
{
|
|
997
|
+
disabled,
|
|
998
|
+
className: (0, import_clsx6.default)(
|
|
999
|
+
{
|
|
1000
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
1001
|
+
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
1002
|
+
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
1003
|
+
[(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
1004
|
+
},
|
|
1005
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
1006
|
+
className
|
|
1007
|
+
),
|
|
1008
|
+
...restProps,
|
|
1009
|
+
children
|
|
1010
|
+
}
|
|
1011
|
+
);
|
|
702
1012
|
};
|
|
703
1013
|
|
|
704
|
-
// src/
|
|
705
|
-
var
|
|
706
|
-
var
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
1014
|
+
// src/components/user-action/SearchBar.tsx
|
|
1015
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1016
|
+
var import_clsx7 = require("clsx");
|
|
1017
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1018
|
+
var SearchBar = ({
|
|
1019
|
+
placeholder,
|
|
1020
|
+
onSearch,
|
|
1021
|
+
disableOnSearch,
|
|
1022
|
+
containerClassName,
|
|
1023
|
+
...inputProps
|
|
1024
|
+
}) => {
|
|
1025
|
+
const translation = useTranslation([formTranslation]);
|
|
1026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.clsx)("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1028
|
+
Input,
|
|
1029
|
+
{
|
|
1030
|
+
...inputProps,
|
|
1031
|
+
placeholder: placeholder ?? translation("search")
|
|
712
1032
|
}
|
|
713
|
-
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
1033
|
+
),
|
|
1034
|
+
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" }) })
|
|
1035
|
+
] });
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
// src/hooks/useSearch.ts
|
|
1039
|
+
var import_react12 = require("react");
|
|
1040
|
+
|
|
1041
|
+
// src/util/simpleSearch.ts
|
|
1042
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
1043
|
+
return objects.filter((object) => {
|
|
1044
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
1045
|
+
if (!mappedSearchKeywords) {
|
|
1046
|
+
return true;
|
|
1047
|
+
}
|
|
1048
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
1049
|
+
});
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
// src/hooks/useSearch.ts
|
|
1053
|
+
var useSearch = ({
|
|
1054
|
+
list,
|
|
1055
|
+
initialSearch,
|
|
1056
|
+
searchMapping,
|
|
1057
|
+
additionalSearchTags,
|
|
1058
|
+
isSearchInstant = true,
|
|
1059
|
+
sortingFunction,
|
|
1060
|
+
filter,
|
|
1061
|
+
disabled = false
|
|
1062
|
+
}) => {
|
|
1063
|
+
const [search, setSearch] = (0, import_react12.useState)(initialSearch ?? "");
|
|
1064
|
+
const [result, setResult] = (0, import_react12.useState)(list);
|
|
1065
|
+
const searchTags = (0, import_react12.useMemo)(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1066
|
+
const updateSearch = (0, import_react12.useCallback)((newSearch) => {
|
|
1067
|
+
const usedSearch = newSearch ?? search;
|
|
1068
|
+
if (newSearch) {
|
|
1069
|
+
setSearch(search);
|
|
1070
|
+
}
|
|
1071
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1072
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1073
|
+
(0, import_react12.useEffect)(() => {
|
|
1074
|
+
if (isSearchInstant) {
|
|
1075
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1076
|
+
}
|
|
1077
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1078
|
+
const filteredResult = (0, import_react12.useMemo)(() => {
|
|
1079
|
+
if (!filter) {
|
|
1080
|
+
return result;
|
|
1081
|
+
}
|
|
1082
|
+
return result.filter(filter);
|
|
1083
|
+
}, [result, filter]);
|
|
1084
|
+
const sortedAndFilteredResult = (0, import_react12.useMemo)(() => {
|
|
1085
|
+
if (!sortingFunction) {
|
|
1086
|
+
return filteredResult;
|
|
1087
|
+
}
|
|
1088
|
+
return filteredResult.sort(sortingFunction);
|
|
1089
|
+
}, [filteredResult, sortingFunction]);
|
|
1090
|
+
const usedResult = (0, import_react12.useMemo)(() => {
|
|
1091
|
+
if (!disabled) {
|
|
1092
|
+
return sortedAndFilteredResult;
|
|
1093
|
+
}
|
|
1094
|
+
return list;
|
|
1095
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
1096
|
+
return {
|
|
1097
|
+
result: usedResult,
|
|
1098
|
+
hasResult: usedResult.length > 0,
|
|
1099
|
+
allItems: list,
|
|
1100
|
+
updateSearch,
|
|
1101
|
+
search,
|
|
1102
|
+
setSearch
|
|
1103
|
+
};
|
|
722
1104
|
};
|
|
723
1105
|
|
|
724
1106
|
// src/components/user-action/Select.tsx
|
|
725
|
-
var
|
|
1107
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1108
|
+
var SelectTile = ({
|
|
1109
|
+
className,
|
|
1110
|
+
disabledClassName,
|
|
1111
|
+
title,
|
|
1112
|
+
...restProps
|
|
1113
|
+
}) => {
|
|
1114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1115
|
+
Tile,
|
|
1116
|
+
{
|
|
1117
|
+
...restProps,
|
|
1118
|
+
className: (0, import_clsx8.default)("px-2 py-1 rounded-md", className),
|
|
1119
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1120
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
};
|
|
726
1124
|
var Select = ({
|
|
727
1125
|
value,
|
|
728
1126
|
label,
|
|
729
1127
|
options,
|
|
730
1128
|
onChange,
|
|
731
1129
|
hintText = "",
|
|
732
|
-
|
|
733
|
-
|
|
1130
|
+
selectedDisplayOverwrite,
|
|
1131
|
+
searchOptions,
|
|
1132
|
+
additionalItems,
|
|
734
1133
|
className,
|
|
735
|
-
|
|
1134
|
+
triggerClassName,
|
|
1135
|
+
hintTextClassName,
|
|
1136
|
+
...menuProps
|
|
736
1137
|
}) => {
|
|
737
|
-
const triggerRef = (0, import_react9.useRef)(null);
|
|
738
|
-
const menuRef = (0, import_react9.useRef)(null);
|
|
739
|
-
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
740
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
741
1138
|
const selectedOption = options.find((option) => option.value === value);
|
|
742
1139
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
743
1140
|
console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
|
|
744
1141
|
}
|
|
745
1142
|
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
1143
|
+
const { result, search, setSearch } = useSearch({
|
|
1144
|
+
list: options,
|
|
1145
|
+
searchMapping: (0, import_react13.useCallback)((item) => item.searchTags, []),
|
|
1146
|
+
...searchOptions
|
|
1147
|
+
});
|
|
1148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_clsx8.default)(className), children: [
|
|
1149
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx8.default)("mb-1", label.className) }),
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1151
|
+
Menu,
|
|
1152
|
+
{
|
|
1153
|
+
...menuProps,
|
|
1154
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1155
|
+
"button",
|
|
1156
|
+
{
|
|
1157
|
+
ref,
|
|
1158
|
+
className: (0, import_clsx8.default)(
|
|
1159
|
+
"btn-md justify-between w-full border-2",
|
|
1160
|
+
{
|
|
1161
|
+
"rounded-b-lg": !open,
|
|
1162
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1163
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1164
|
+
},
|
|
1165
|
+
triggerClassName
|
|
1166
|
+
),
|
|
1167
|
+
onClick: toggleOpen,
|
|
1168
|
+
disabled,
|
|
1169
|
+
children: [
|
|
1170
|
+
!isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
1171
|
+
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: (0, import_clsx8.default)("textstyle-description", hintTextClassName), children: hintText }),
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ExpansionIcon, { isExpanded: isOpen })
|
|
1173
|
+
]
|
|
1174
|
+
}
|
|
1175
|
+
),
|
|
1176
|
+
menuClassName: (0, import_clsx8.default)("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1177
|
+
children: (bag) => {
|
|
1178
|
+
const { close } = bag;
|
|
1179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1180
|
+
!searchOptions?.disabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1181
|
+
SearchBar,
|
|
1182
|
+
{
|
|
1183
|
+
value: search,
|
|
1184
|
+
onChangeText: setSearch,
|
|
1185
|
+
autoFocus: true
|
|
1186
|
+
}
|
|
1187
|
+
),
|
|
1188
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1189
|
+
result.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1190
|
+
SelectTile,
|
|
783
1191
|
{
|
|
784
|
-
isSelected:
|
|
785
|
-
|
|
786
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
787
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1192
|
+
isSelected: option === selectedOption,
|
|
1193
|
+
title: { value: option.label },
|
|
788
1194
|
onClick: () => {
|
|
789
1195
|
onChange(option.value);
|
|
790
|
-
|
|
1196
|
+
close();
|
|
791
1197
|
},
|
|
792
|
-
|
|
1198
|
+
disabled: option.disabled
|
|
793
1199
|
},
|
|
794
1200
|
index
|
|
795
|
-
)
|
|
796
|
-
|
|
797
|
-
|
|
1201
|
+
)),
|
|
1202
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1203
|
+
] })
|
|
1204
|
+
] });
|
|
798
1205
|
}
|
|
799
|
-
|
|
800
|
-
|
|
1206
|
+
}
|
|
1207
|
+
)
|
|
801
1208
|
] });
|
|
802
1209
|
};
|
|
803
1210
|
var SelectUncontrolled = ({
|
|
@@ -807,13 +1214,13 @@ var SelectUncontrolled = ({
|
|
|
807
1214
|
hintText,
|
|
808
1215
|
...props
|
|
809
1216
|
}) => {
|
|
810
|
-
const [selected, setSelected] = (0,
|
|
811
|
-
(0,
|
|
1217
|
+
const [selected, setSelected] = (0, import_react14.useState)(value);
|
|
1218
|
+
(0, import_react14.useEffect)(() => {
|
|
812
1219
|
if (options.find((options2) => options2.value === value)) {
|
|
813
1220
|
setSelected(value);
|
|
814
1221
|
}
|
|
815
1222
|
}, [options, value]);
|
|
816
|
-
return /* @__PURE__ */ (0,
|
|
1223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
817
1224
|
Select,
|
|
818
1225
|
{
|
|
819
1226
|
value: selected,
|
|
@@ -830,6 +1237,7 @@ var SelectUncontrolled = ({
|
|
|
830
1237
|
// Annotate the CommonJS export names for ESM import in node:
|
|
831
1238
|
0 && (module.exports = {
|
|
832
1239
|
Select,
|
|
1240
|
+
SelectTile,
|
|
833
1241
|
SelectUncontrolled
|
|
834
1242
|
});
|
|
835
1243
|
//# sourceMappingURL=Select.js.map
|