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