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