@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
|
@@ -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,12 +452,12 @@ 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);
|
|
@@ -190,13 +466,10 @@ function useDelay(options) {
|
|
|
190
466
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
191
467
|
}
|
|
192
468
|
|
|
193
|
-
// src/util/noop.ts
|
|
194
|
-
var noop = () => void 0;
|
|
195
|
-
|
|
196
469
|
// src/hooks/useFocusManagement.ts
|
|
197
|
-
var
|
|
470
|
+
var import_react6 = require("react");
|
|
198
471
|
function useFocusManagement() {
|
|
199
|
-
const getFocusableElements = (0,
|
|
472
|
+
const getFocusableElements = (0, import_react6.useCallback)(() => {
|
|
200
473
|
return Array.from(
|
|
201
474
|
document.querySelectorAll(
|
|
202
475
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -205,7 +478,7 @@ function useFocusManagement() {
|
|
|
205
478
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
206
479
|
);
|
|
207
480
|
}, []);
|
|
208
|
-
const getNextFocusElement = (0,
|
|
481
|
+
const getNextFocusElement = (0, import_react6.useCallback)(() => {
|
|
209
482
|
const elements = getFocusableElements();
|
|
210
483
|
if (elements.length === 0) {
|
|
211
484
|
return void 0;
|
|
@@ -217,11 +490,11 @@ function useFocusManagement() {
|
|
|
217
490
|
}
|
|
218
491
|
return nextElement;
|
|
219
492
|
}, [getFocusableElements]);
|
|
220
|
-
const focusNext = (0,
|
|
493
|
+
const focusNext = (0, import_react6.useCallback)(() => {
|
|
221
494
|
const nextElement = getNextFocusElement();
|
|
222
495
|
nextElement?.focus();
|
|
223
496
|
}, [getNextFocusElement]);
|
|
224
|
-
const getPreviousFocusElement = (0,
|
|
497
|
+
const getPreviousFocusElement = (0, import_react6.useCallback)(() => {
|
|
225
498
|
const elements = getFocusableElements();
|
|
226
499
|
if (elements.length === 0) {
|
|
227
500
|
return void 0;
|
|
@@ -237,7 +510,7 @@ function useFocusManagement() {
|
|
|
237
510
|
}
|
|
238
511
|
return previousElement;
|
|
239
512
|
}, [getFocusableElements]);
|
|
240
|
-
const focusPrevious = (0,
|
|
513
|
+
const focusPrevious = (0, import_react6.useCallback)(() => {
|
|
241
514
|
const previousElement = getPreviousFocusElement();
|
|
242
515
|
if (previousElement) previousElement.focus();
|
|
243
516
|
}, [getPreviousFocusElement]);
|
|
@@ -251,10 +524,10 @@ function useFocusManagement() {
|
|
|
251
524
|
}
|
|
252
525
|
|
|
253
526
|
// src/hooks/useFocusOnceVisible.ts
|
|
254
|
-
var
|
|
527
|
+
var import_react7 = __toESM(require("react"));
|
|
255
528
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
256
|
-
const [hasUsedFocus, setHasUsedFocus] =
|
|
257
|
-
(0,
|
|
529
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react7.default.useState(false);
|
|
530
|
+
(0, import_react7.useEffect)(() => {
|
|
258
531
|
if (disable || hasUsedFocus) {
|
|
259
532
|
return;
|
|
260
533
|
}
|
|
@@ -274,9 +547,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
274
547
|
};
|
|
275
548
|
|
|
276
549
|
// src/components/user-action/Input.tsx
|
|
277
|
-
var
|
|
550
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
278
551
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
279
|
-
return (0,
|
|
552
|
+
return (0, import_clsx5.default)(
|
|
280
553
|
"px-2 py-1.5 rounded-md border-2",
|
|
281
554
|
{
|
|
282
555
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -290,7 +563,7 @@ var defaultEditCompleteOptions = {
|
|
|
290
563
|
afterDelay: true,
|
|
291
564
|
delay: 2500
|
|
292
565
|
};
|
|
293
|
-
var Input = (0,
|
|
566
|
+
var Input = (0, import_react8.forwardRef)(function Input2({
|
|
294
567
|
id,
|
|
295
568
|
type = "text",
|
|
296
569
|
value,
|
|
@@ -313,10 +586,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
313
586
|
restartTimer,
|
|
314
587
|
clearTimer
|
|
315
588
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
316
|
-
const innerRef = (0,
|
|
589
|
+
const innerRef = (0, import_react8.useRef)(null);
|
|
317
590
|
const { focusNext } = useFocusManagement();
|
|
318
591
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
319
|
-
(0,
|
|
592
|
+
(0, import_react8.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
320
593
|
const handleKeyDown = (e) => {
|
|
321
594
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
322
595
|
e.preventDefault();
|
|
@@ -324,9 +597,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
324
597
|
focusNext();
|
|
325
598
|
}
|
|
326
599
|
};
|
|
327
|
-
return /* @__PURE__ */ (0,
|
|
328
|
-
label && /* @__PURE__ */ (0,
|
|
329
|
-
/* @__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)(
|
|
330
603
|
"input",
|
|
331
604
|
{
|
|
332
605
|
...restProps,
|
|
@@ -335,7 +608,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
335
608
|
id,
|
|
336
609
|
type,
|
|
337
610
|
disabled,
|
|
338
|
-
className: (0,
|
|
611
|
+
className: (0, import_clsx5.default)(getInputClassName({ disabled }), className),
|
|
339
612
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
340
613
|
onBlur: (event) => {
|
|
341
614
|
onBlur?.(event);
|
|
@@ -365,7 +638,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
365
638
|
)
|
|
366
639
|
] });
|
|
367
640
|
});
|
|
368
|
-
var FormInput = (0,
|
|
641
|
+
var FormInput = (0, import_react8.forwardRef)(function FormInput2({
|
|
369
642
|
id,
|
|
370
643
|
labelText,
|
|
371
644
|
errorText,
|
|
@@ -377,137 +650,120 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
|
|
|
377
650
|
disabled,
|
|
378
651
|
...restProps
|
|
379
652
|
}, ref) {
|
|
380
|
-
const input = /* @__PURE__ */ (0,
|
|
653
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
381
654
|
"input",
|
|
382
655
|
{
|
|
383
656
|
...restProps,
|
|
384
657
|
ref,
|
|
385
658
|
id,
|
|
386
659
|
disabled,
|
|
387
|
-
className: (0,
|
|
660
|
+
className: (0, import_clsx5.default)(
|
|
388
661
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
389
662
|
className
|
|
390
663
|
)
|
|
391
664
|
}
|
|
392
665
|
);
|
|
393
|
-
return /* @__PURE__ */ (0,
|
|
394
|
-
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: [
|
|
395
668
|
labelText,
|
|
396
|
-
required && /* @__PURE__ */ (0,
|
|
669
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
397
670
|
] }),
|
|
398
671
|
input,
|
|
399
|
-
errorText && /* @__PURE__ */ (0,
|
|
672
|
+
errorText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: id, className: (0, import_clsx5.default)("text-negative", errorClassName), children: errorText })
|
|
400
673
|
] });
|
|
401
674
|
});
|
|
402
675
|
|
|
403
|
-
// src/
|
|
404
|
-
var
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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"
|
|
410
687
|
};
|
|
411
|
-
var
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
medium: "btn-md",
|
|
417
|
-
large: "btn-lg"
|
|
418
|
-
};
|
|
419
|
-
var iconPaddingMapping = {
|
|
420
|
-
tiny: "icon-btn-xs",
|
|
421
|
-
small: "icon-btn-sm",
|
|
422
|
-
medium: "icon-btn-md",
|
|
423
|
-
large: "icon-btn-lg"
|
|
424
|
-
};
|
|
425
|
-
var ButtonUtil = {
|
|
426
|
-
paddingMapping,
|
|
427
|
-
iconPaddingMapping
|
|
428
|
-
};
|
|
429
|
-
var IconButton = ({
|
|
430
|
-
children,
|
|
431
|
-
disabled = false,
|
|
432
|
-
color = "primary",
|
|
433
|
-
size = "medium",
|
|
434
|
-
onClick,
|
|
435
|
-
className,
|
|
436
|
-
...restProps
|
|
437
|
-
}) => {
|
|
438
|
-
const colorClasses = {
|
|
439
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
440
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
441
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
442
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
443
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
444
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
445
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
446
|
-
transparent: "bg-transparent"
|
|
447
|
-
}[color];
|
|
448
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
449
|
-
"button",
|
|
450
|
-
{
|
|
451
|
-
onClick: disabled ? void 0 : onClick,
|
|
452
|
-
disabled: disabled || onClick === void 0,
|
|
453
|
-
className: (0, import_clsx3.default)(
|
|
454
|
-
{
|
|
455
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
456
|
-
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
457
|
-
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
458
|
-
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
459
|
-
},
|
|
460
|
-
ButtonUtil.iconPaddingMapping[size],
|
|
461
|
-
className
|
|
462
|
-
),
|
|
463
|
-
...restProps,
|
|
464
|
-
children
|
|
465
|
-
}
|
|
466
|
-
);
|
|
688
|
+
var DEFAULT_LANGUAGE = "en";
|
|
689
|
+
var LanguageUtil = {
|
|
690
|
+
languages,
|
|
691
|
+
DEFAULT_LANGUAGE,
|
|
692
|
+
languagesLocalNames
|
|
467
693
|
};
|
|
468
694
|
|
|
469
|
-
// src/
|
|
470
|
-
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);
|
|
471
702
|
|
|
472
|
-
// src/
|
|
473
|
-
var
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
});
|
|
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
|
|
481
711
|
};
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
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}}}`;
|
|
505
760
|
};
|
|
506
761
|
};
|
|
507
762
|
|
|
508
763
|
// src/localization/defaults/form.ts
|
|
509
764
|
var formTranslation = {
|
|
510
765
|
en: {
|
|
766
|
+
add: "Add",
|
|
511
767
|
all: "All",
|
|
512
768
|
apply: "Apply",
|
|
513
769
|
back: "Back",
|
|
@@ -520,6 +776,7 @@ var formTranslation = {
|
|
|
520
776
|
confirm: "Confirm",
|
|
521
777
|
copy: "Copy",
|
|
522
778
|
copied: "Copied",
|
|
779
|
+
create: "Create",
|
|
523
780
|
decline: "Decline",
|
|
524
781
|
delete: "Delete",
|
|
525
782
|
discard: "Discard",
|
|
@@ -562,6 +819,7 @@ var formTranslation = {
|
|
|
562
819
|
yes: "Yes"
|
|
563
820
|
},
|
|
564
821
|
de: {
|
|
822
|
+
add: "Hinzuf\xFCgen",
|
|
565
823
|
all: "Alle",
|
|
566
824
|
apply: "Anwenden",
|
|
567
825
|
back: "Zur\xFCck",
|
|
@@ -574,6 +832,7 @@ var formTranslation = {
|
|
|
574
832
|
confirm: "Best\xE4tigen",
|
|
575
833
|
copy: "Kopieren",
|
|
576
834
|
copied: "Kopiert",
|
|
835
|
+
create: "Erstellen",
|
|
577
836
|
decline: "Ablehnen",
|
|
578
837
|
delete: "L\xF6schen",
|
|
579
838
|
discard: "Verwerfen",
|
|
@@ -617,186 +876,335 @@ var formTranslation = {
|
|
|
617
876
|
}
|
|
618
877
|
};
|
|
619
878
|
|
|
620
|
-
// src/components/
|
|
621
|
-
var
|
|
622
|
-
var
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}
|
|
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"]
|
|
629
887
|
};
|
|
630
|
-
var
|
|
631
|
-
|
|
632
|
-
list,
|
|
633
|
-
initialSearch = "",
|
|
634
|
-
searchMapping,
|
|
635
|
-
autoFocus,
|
|
636
|
-
minimumItemsForSearch = 6,
|
|
637
|
-
itemMapper,
|
|
638
|
-
className,
|
|
639
|
-
resultListClassName
|
|
640
|
-
}) => {
|
|
641
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
642
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
643
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("col gap-y-2", className), children: [
|
|
644
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
645
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
646
|
-
Input,
|
|
647
|
-
{
|
|
648
|
-
value: search,
|
|
649
|
-
onChangeText: setSearch,
|
|
650
|
-
placeholder: translation("search"),
|
|
651
|
-
autoFocus,
|
|
652
|
-
className: "w-full"
|
|
653
|
-
}
|
|
654
|
-
),
|
|
655
|
-
/* @__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" }) })
|
|
656
|
-
] }),
|
|
657
|
-
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") })
|
|
658
|
-
] });
|
|
888
|
+
var IconButtonUtil = {
|
|
889
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
659
890
|
};
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
var
|
|
666
|
-
|
|
667
|
-
|
|
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,
|
|
668
913
|
onClick,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
"
|
|
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",
|
|
680
937
|
{
|
|
681
|
-
|
|
682
|
-
|
|
938
|
+
ref,
|
|
939
|
+
onClick,
|
|
940
|
+
disabled,
|
|
941
|
+
className: (0, import_clsx6.default)(
|
|
683
942
|
{
|
|
684
|
-
|
|
685
|
-
[
|
|
686
|
-
[disabledClassName]: isDisabled
|
|
943
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
944
|
+
[(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
687
945
|
},
|
|
946
|
+
ButtonUtil.paddingMapping[size],
|
|
688
947
|
className
|
|
689
948
|
),
|
|
690
|
-
|
|
949
|
+
...restProps,
|
|
691
950
|
children: [
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
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
|
+
)
|
|
698
972
|
]
|
|
699
973
|
}
|
|
700
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
|
+
);
|
|
701
1012
|
};
|
|
702
1013
|
|
|
703
|
-
// src/
|
|
704
|
-
var
|
|
705
|
-
var
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
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")
|
|
711
1032
|
}
|
|
712
|
-
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
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
|
+
};
|
|
721
1104
|
};
|
|
722
1105
|
|
|
723
1106
|
// src/components/user-action/Select.tsx
|
|
724
|
-
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
|
+
};
|
|
725
1124
|
var Select = ({
|
|
726
1125
|
value,
|
|
727
1126
|
label,
|
|
728
1127
|
options,
|
|
729
1128
|
onChange,
|
|
730
1129
|
hintText = "",
|
|
731
|
-
|
|
732
|
-
|
|
1130
|
+
selectedDisplayOverwrite,
|
|
1131
|
+
searchOptions,
|
|
1132
|
+
additionalItems,
|
|
733
1133
|
className,
|
|
734
|
-
|
|
1134
|
+
triggerClassName,
|
|
1135
|
+
hintTextClassName,
|
|
1136
|
+
...menuProps
|
|
735
1137
|
}) => {
|
|
736
|
-
const triggerRef = (0, import_react9.useRef)(null);
|
|
737
|
-
const menuRef = (0, import_react9.useRef)(null);
|
|
738
|
-
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
739
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
740
1138
|
const selectedOption = options.find((option) => option.value === value);
|
|
741
1139
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
742
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");
|
|
743
1141
|
}
|
|
744
1142
|
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
745
|
-
|
|
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
|
-
|
|
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,
|
|
782
1191
|
{
|
|
783
|
-
isSelected:
|
|
784
|
-
|
|
785
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
786
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1192
|
+
isSelected: option === selectedOption,
|
|
1193
|
+
title: { value: option.label },
|
|
787
1194
|
onClick: () => {
|
|
788
1195
|
onChange(option.value);
|
|
789
|
-
|
|
1196
|
+
close();
|
|
790
1197
|
},
|
|
791
|
-
|
|
1198
|
+
disabled: option.disabled
|
|
792
1199
|
},
|
|
793
1200
|
index
|
|
794
|
-
)
|
|
795
|
-
|
|
796
|
-
|
|
1201
|
+
)),
|
|
1202
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1203
|
+
] })
|
|
1204
|
+
] });
|
|
797
1205
|
}
|
|
798
|
-
|
|
799
|
-
|
|
1206
|
+
}
|
|
1207
|
+
)
|
|
800
1208
|
] });
|
|
801
1209
|
};
|
|
802
1210
|
var SelectUncontrolled = ({
|
|
@@ -806,13 +1214,13 @@ var SelectUncontrolled = ({
|
|
|
806
1214
|
hintText,
|
|
807
1215
|
...props
|
|
808
1216
|
}) => {
|
|
809
|
-
const [selected, setSelected] = (0,
|
|
810
|
-
(0,
|
|
1217
|
+
const [selected, setSelected] = (0, import_react14.useState)(value);
|
|
1218
|
+
(0, import_react14.useEffect)(() => {
|
|
811
1219
|
if (options.find((options2) => options2.value === value)) {
|
|
812
1220
|
setSelected(value);
|
|
813
1221
|
}
|
|
814
1222
|
}, [options, value]);
|
|
815
|
-
return /* @__PURE__ */ (0,
|
|
1223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
816
1224
|
Select,
|
|
817
1225
|
{
|
|
818
1226
|
value: selected,
|
|
@@ -829,6 +1237,7 @@ var SelectUncontrolled = ({
|
|
|
829
1237
|
// Annotate the CommonJS export names for ESM import in node:
|
|
830
1238
|
0 && (module.exports = {
|
|
831
1239
|
Select,
|
|
1240
|
+
SelectTile,
|
|
832
1241
|
SelectUncontrolled
|
|
833
1242
|
});
|
|
834
1243
|
//# sourceMappingURL=Select.js.map
|