@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
|
@@ -86,9 +86,9 @@ var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
// src/components/user-action/Select.tsx
|
|
89
|
-
import {
|
|
90
|
-
import { useEffect as
|
|
91
|
-
import
|
|
89
|
+
import { useCallback as useCallback5 } from "react";
|
|
90
|
+
import { useEffect as useEffect11, useState as useState9 } from "react";
|
|
91
|
+
import clsx8 from "clsx";
|
|
92
92
|
|
|
93
93
|
// src/components/user-action/Label.tsx
|
|
94
94
|
import clsx from "clsx";
|
|
@@ -108,22 +108,389 @@ var Label = ({
|
|
|
108
108
|
return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
// src/components/layout-and-navigation/
|
|
112
|
-
import
|
|
111
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
112
|
+
import clsx2 from "clsx";
|
|
113
|
+
import { Check } from "lucide-react";
|
|
114
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
115
|
+
var Tile = ({
|
|
116
|
+
title,
|
|
117
|
+
description,
|
|
118
|
+
onClick,
|
|
119
|
+
isSelected = false,
|
|
120
|
+
disabled = false,
|
|
121
|
+
prefix,
|
|
122
|
+
suffix,
|
|
123
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
124
|
+
selectedClassName = " bg-primary/20",
|
|
125
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
126
|
+
className
|
|
127
|
+
}) => {
|
|
128
|
+
return /* @__PURE__ */ jsxs(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
className: clsx2(
|
|
132
|
+
"flex-row-2 w-full items-center",
|
|
133
|
+
{
|
|
134
|
+
[normalClassName]: !!onClick && !disabled,
|
|
135
|
+
[selectedClassName]: isSelected && !disabled,
|
|
136
|
+
[disabledClassName]: disabled
|
|
137
|
+
},
|
|
138
|
+
className
|
|
139
|
+
),
|
|
140
|
+
onClick: disabled ? void 0 : onClick,
|
|
141
|
+
children: [
|
|
142
|
+
prefix,
|
|
143
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-col-0 w-full", children: [
|
|
144
|
+
/* @__PURE__ */ jsx3("h4", { className: clsx2(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
145
|
+
!!description && /* @__PURE__ */ jsx3("span", { className: clsx2(description.className ?? "textstyle-description"), children: description.value })
|
|
146
|
+
] }),
|
|
147
|
+
suffix ?? (isSelected ? /* @__PURE__ */ jsx3(Check, { size: 24 }) : void 0)
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
154
|
+
import { forwardRef, useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
|
|
155
|
+
import { ChevronDown } from "lucide-react";
|
|
156
|
+
import clsx3 from "clsx";
|
|
157
|
+
|
|
158
|
+
// src/util/noop.ts
|
|
159
|
+
var noop = () => void 0;
|
|
160
|
+
|
|
161
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
162
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
163
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
164
|
+
return /* @__PURE__ */ jsx4(
|
|
165
|
+
ChevronDown,
|
|
166
|
+
{
|
|
167
|
+
className: clsx3(
|
|
168
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
|
|
169
|
+
{ "rotate-180": isExpanded },
|
|
170
|
+
className
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
var Expandable = forwardRef(function Expandable2({
|
|
176
|
+
children,
|
|
177
|
+
label,
|
|
178
|
+
icon,
|
|
179
|
+
isExpanded = false,
|
|
180
|
+
onChange = noop,
|
|
181
|
+
clickOnlyOnHeader = true,
|
|
182
|
+
disabled = false,
|
|
183
|
+
className,
|
|
184
|
+
headerClassName,
|
|
185
|
+
contentClassName,
|
|
186
|
+
contentExpandedClassName
|
|
187
|
+
}, ref) {
|
|
188
|
+
const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx4(ExpansionIcon, { isExpanded: expanded }), []);
|
|
189
|
+
icon ??= defaultIcon;
|
|
190
|
+
return /* @__PURE__ */ jsxs2(
|
|
191
|
+
"div",
|
|
192
|
+
{
|
|
193
|
+
ref,
|
|
194
|
+
className: clsx3("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
195
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
196
|
+
children: [
|
|
197
|
+
/* @__PURE__ */ jsxs2(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
className: clsx3(
|
|
201
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
202
|
+
{
|
|
203
|
+
"group-hover:brightness-97": !isExpanded,
|
|
204
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
205
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
206
|
+
},
|
|
207
|
+
headerClassName
|
|
208
|
+
),
|
|
209
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
210
|
+
children: [
|
|
211
|
+
label,
|
|
212
|
+
icon(isExpanded)
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ jsx4(
|
|
217
|
+
"div",
|
|
218
|
+
{
|
|
219
|
+
className: clsx3(
|
|
220
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
221
|
+
{
|
|
222
|
+
[clsx3("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
|
|
223
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
224
|
+
},
|
|
225
|
+
contentClassName
|
|
226
|
+
),
|
|
227
|
+
children
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
});
|
|
234
|
+
var ExpandableUncontrolled = forwardRef(function ExpandableUncontrolled2({
|
|
235
|
+
isExpanded,
|
|
236
|
+
onChange = noop,
|
|
237
|
+
...props
|
|
238
|
+
}, ref) {
|
|
239
|
+
const [usedIsExpanded, setUsedIsExpanded] = useState3(isExpanded);
|
|
240
|
+
useEffect3(() => {
|
|
241
|
+
setUsedIsExpanded(isExpanded);
|
|
242
|
+
}, [isExpanded]);
|
|
243
|
+
return /* @__PURE__ */ jsx4(
|
|
244
|
+
Expandable,
|
|
245
|
+
{
|
|
246
|
+
...props,
|
|
247
|
+
ref,
|
|
248
|
+
isExpanded: usedIsExpanded,
|
|
249
|
+
onChange: (value) => {
|
|
250
|
+
onChange(value);
|
|
251
|
+
setUsedIsExpanded(value);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
// src/components/user-action/Menu.tsx
|
|
258
|
+
import {
|
|
259
|
+
useEffect as useEffect6,
|
|
260
|
+
useRef,
|
|
261
|
+
useState as useState5
|
|
262
|
+
} from "react";
|
|
113
263
|
import clsx4 from "clsx";
|
|
114
264
|
|
|
265
|
+
// src/hooks/useOutsideClick.ts
|
|
266
|
+
import { useEffect as useEffect4 } from "react";
|
|
267
|
+
var useOutsideClick = (refs, handler) => {
|
|
268
|
+
useEffect4(() => {
|
|
269
|
+
const listener = (event) => {
|
|
270
|
+
if (event.target === null) return;
|
|
271
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
handler();
|
|
275
|
+
};
|
|
276
|
+
document.addEventListener("mousedown", listener);
|
|
277
|
+
document.addEventListener("touchstart", listener);
|
|
278
|
+
return () => {
|
|
279
|
+
document.removeEventListener("mousedown", listener);
|
|
280
|
+
document.removeEventListener("touchstart", listener);
|
|
281
|
+
};
|
|
282
|
+
}, [refs, handler]);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
// src/hooks/useHoverState.ts
|
|
286
|
+
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
287
|
+
var defaultUseHoverStateProps = {
|
|
288
|
+
closingDelay: 200,
|
|
289
|
+
isDisabled: false
|
|
290
|
+
};
|
|
291
|
+
var useHoverState = (props = void 0) => {
|
|
292
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
293
|
+
const [isHovered, setIsHovered] = useState4(false);
|
|
294
|
+
const [timer, setTimer] = useState4();
|
|
295
|
+
const onMouseEnter = () => {
|
|
296
|
+
if (isDisabled) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
clearTimeout(timer);
|
|
300
|
+
setIsHovered(true);
|
|
301
|
+
};
|
|
302
|
+
const onMouseLeave = () => {
|
|
303
|
+
if (isDisabled) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
setTimer(setTimeout(() => {
|
|
307
|
+
setIsHovered(false);
|
|
308
|
+
}, closingDelay));
|
|
309
|
+
};
|
|
310
|
+
useEffect5(() => {
|
|
311
|
+
if (timer) {
|
|
312
|
+
return () => {
|
|
313
|
+
clearTimeout(timer);
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
useEffect5(() => {
|
|
318
|
+
if (timer) {
|
|
319
|
+
clearTimeout(timer);
|
|
320
|
+
}
|
|
321
|
+
}, [isDisabled]);
|
|
322
|
+
return {
|
|
323
|
+
isHovered,
|
|
324
|
+
setIsHovered,
|
|
325
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
330
|
+
var resolve = (children, bag) => {
|
|
331
|
+
if (typeof children === "function") {
|
|
332
|
+
return children(bag);
|
|
333
|
+
}
|
|
334
|
+
return children ?? void 0;
|
|
335
|
+
};
|
|
336
|
+
var BagFunctionUtil = {
|
|
337
|
+
resolve
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// src/hooks/usePopoverPosition.ts
|
|
341
|
+
var defaultPopoverPositionOptions = {
|
|
342
|
+
edgePadding: 16,
|
|
343
|
+
outerGap: 4,
|
|
344
|
+
horizontalAlignment: "leftInside",
|
|
345
|
+
verticalAlignment: "bottomOutside",
|
|
346
|
+
disabled: false
|
|
347
|
+
};
|
|
348
|
+
var usePopoverPosition = (trigger, options) => {
|
|
349
|
+
const {
|
|
350
|
+
edgePadding,
|
|
351
|
+
outerGap,
|
|
352
|
+
verticalAlignment,
|
|
353
|
+
horizontalAlignment,
|
|
354
|
+
disabled
|
|
355
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
356
|
+
if (disabled || !trigger) {
|
|
357
|
+
return {};
|
|
358
|
+
}
|
|
359
|
+
const left = {
|
|
360
|
+
leftOutside: trigger.left - outerGap,
|
|
361
|
+
leftInside: trigger.left,
|
|
362
|
+
rightOutside: trigger.right + outerGap,
|
|
363
|
+
rightInside: trigger.right,
|
|
364
|
+
center: trigger.left + trigger.width / 2
|
|
365
|
+
}[horizontalAlignment];
|
|
366
|
+
const top = {
|
|
367
|
+
topOutside: trigger.top - outerGap,
|
|
368
|
+
topInside: trigger.top,
|
|
369
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
370
|
+
bottomInside: trigger.bottom,
|
|
371
|
+
center: trigger.top + trigger.height / 2
|
|
372
|
+
}[verticalAlignment];
|
|
373
|
+
const translateX = {
|
|
374
|
+
leftOutside: "-100%",
|
|
375
|
+
leftInside: void 0,
|
|
376
|
+
rightOutside: void 0,
|
|
377
|
+
rightInside: "-100%",
|
|
378
|
+
center: "-50%"
|
|
379
|
+
}[horizontalAlignment];
|
|
380
|
+
const translateY = {
|
|
381
|
+
topOutside: "-100%",
|
|
382
|
+
topInside: void 0,
|
|
383
|
+
bottomOutside: void 0,
|
|
384
|
+
bottomInside: "-100%",
|
|
385
|
+
center: "-50%"
|
|
386
|
+
}[verticalAlignment];
|
|
387
|
+
return {
|
|
388
|
+
left: Math.max(left, edgePadding),
|
|
389
|
+
top: Math.max(top, edgePadding),
|
|
390
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// src/components/user-action/Menu.tsx
|
|
395
|
+
import { createPortal } from "react-dom";
|
|
396
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
397
|
+
function getScrollableParents(element) {
|
|
398
|
+
const scrollables = [];
|
|
399
|
+
let parent = element.parentElement;
|
|
400
|
+
while (parent) {
|
|
401
|
+
scrollables.push(parent);
|
|
402
|
+
parent = parent.parentElement;
|
|
403
|
+
}
|
|
404
|
+
return scrollables;
|
|
405
|
+
}
|
|
406
|
+
var Menu = ({
|
|
407
|
+
trigger,
|
|
408
|
+
children,
|
|
409
|
+
alignmentHorizontal = "leftInside",
|
|
410
|
+
alignmentVertical = "bottomOutside",
|
|
411
|
+
showOnHover = false,
|
|
412
|
+
disabled = false,
|
|
413
|
+
menuClassName = ""
|
|
414
|
+
}) => {
|
|
415
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
416
|
+
const triggerRef = useRef(null);
|
|
417
|
+
const menuRef = useRef(null);
|
|
418
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
419
|
+
const [isHidden, setIsHidden] = useState5(true);
|
|
420
|
+
const bag = {
|
|
421
|
+
isOpen,
|
|
422
|
+
close: () => setIsOpen(false),
|
|
423
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
424
|
+
disabled
|
|
425
|
+
};
|
|
426
|
+
const menuPosition = usePopoverPosition(
|
|
427
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
428
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
429
|
+
);
|
|
430
|
+
useEffect6(() => {
|
|
431
|
+
if (!isOpen) return;
|
|
432
|
+
const triggerEl = triggerRef.current;
|
|
433
|
+
if (!triggerEl) return;
|
|
434
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
435
|
+
const close = () => setIsOpen(false);
|
|
436
|
+
scrollableParents.forEach((parent) => {
|
|
437
|
+
parent.addEventListener("scroll", close);
|
|
438
|
+
});
|
|
439
|
+
window.addEventListener("resize", close);
|
|
440
|
+
return () => {
|
|
441
|
+
scrollableParents.forEach((parent) => {
|
|
442
|
+
parent.removeEventListener("scroll", close);
|
|
443
|
+
});
|
|
444
|
+
window.removeEventListener("resize", close);
|
|
445
|
+
};
|
|
446
|
+
}, [isOpen, setIsOpen]);
|
|
447
|
+
useEffect6(() => {
|
|
448
|
+
if (isOpen) {
|
|
449
|
+
setIsHidden(false);
|
|
450
|
+
}
|
|
451
|
+
}, [isOpen]);
|
|
452
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
453
|
+
trigger(bag, triggerRef),
|
|
454
|
+
createPortal(/* @__PURE__ */ jsx5(
|
|
455
|
+
"div",
|
|
456
|
+
{
|
|
457
|
+
ref: menuRef,
|
|
458
|
+
onClick: (e) => e.stopPropagation(),
|
|
459
|
+
className: clsx4(
|
|
460
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
461
|
+
{
|
|
462
|
+
"animate-pop-in": isOpen,
|
|
463
|
+
"animate-pop-out": !isOpen,
|
|
464
|
+
"hidden": isHidden
|
|
465
|
+
},
|
|
466
|
+
menuClassName
|
|
467
|
+
),
|
|
468
|
+
onAnimationEnd: () => {
|
|
469
|
+
if (!isOpen) {
|
|
470
|
+
setIsHidden(true);
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
style: {
|
|
474
|
+
...menuPosition
|
|
475
|
+
},
|
|
476
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
477
|
+
}
|
|
478
|
+
), document.body)
|
|
479
|
+
] });
|
|
480
|
+
};
|
|
481
|
+
|
|
115
482
|
// src/components/user-action/Input.tsx
|
|
116
|
-
import { forwardRef, useEffect as
|
|
117
|
-
import
|
|
483
|
+
import { forwardRef as forwardRef2, useEffect as useEffect9, useImperativeHandle, useRef as useRef2, useState as useState7 } from "react";
|
|
484
|
+
import clsx5 from "clsx";
|
|
118
485
|
|
|
119
486
|
// src/hooks/useDelay.ts
|
|
120
|
-
import { useEffect as
|
|
487
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
121
488
|
var defaultOptions = {
|
|
122
489
|
delay: 3e3,
|
|
123
490
|
disabled: false
|
|
124
491
|
};
|
|
125
492
|
function useDelay(options) {
|
|
126
|
-
const [timer, setTimer] =
|
|
493
|
+
const [timer, setTimer] = useState6(void 0);
|
|
127
494
|
const { delay, disabled } = {
|
|
128
495
|
...defaultOptions,
|
|
129
496
|
...options
|
|
@@ -142,12 +509,12 @@ function useDelay(options) {
|
|
|
142
509
|
setTimer(void 0);
|
|
143
510
|
}, delay));
|
|
144
511
|
};
|
|
145
|
-
|
|
512
|
+
useEffect7(() => {
|
|
146
513
|
return () => {
|
|
147
514
|
clearTimeout(timer);
|
|
148
515
|
};
|
|
149
516
|
}, [timer]);
|
|
150
|
-
|
|
517
|
+
useEffect7(() => {
|
|
151
518
|
if (disabled) {
|
|
152
519
|
clearTimeout(timer);
|
|
153
520
|
setTimer(void 0);
|
|
@@ -156,13 +523,10 @@ function useDelay(options) {
|
|
|
156
523
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
157
524
|
}
|
|
158
525
|
|
|
159
|
-
// src/util/noop.ts
|
|
160
|
-
var noop = () => void 0;
|
|
161
|
-
|
|
162
526
|
// src/hooks/useFocusManagement.ts
|
|
163
|
-
import { useCallback as
|
|
527
|
+
import { useCallback as useCallback3 } from "react";
|
|
164
528
|
function useFocusManagement() {
|
|
165
|
-
const getFocusableElements =
|
|
529
|
+
const getFocusableElements = useCallback3(() => {
|
|
166
530
|
return Array.from(
|
|
167
531
|
document.querySelectorAll(
|
|
168
532
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -171,7 +535,7 @@ function useFocusManagement() {
|
|
|
171
535
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
172
536
|
);
|
|
173
537
|
}, []);
|
|
174
|
-
const getNextFocusElement =
|
|
538
|
+
const getNextFocusElement = useCallback3(() => {
|
|
175
539
|
const elements = getFocusableElements();
|
|
176
540
|
if (elements.length === 0) {
|
|
177
541
|
return void 0;
|
|
@@ -183,11 +547,11 @@ function useFocusManagement() {
|
|
|
183
547
|
}
|
|
184
548
|
return nextElement;
|
|
185
549
|
}, [getFocusableElements]);
|
|
186
|
-
const focusNext =
|
|
550
|
+
const focusNext = useCallback3(() => {
|
|
187
551
|
const nextElement = getNextFocusElement();
|
|
188
552
|
nextElement?.focus();
|
|
189
553
|
}, [getNextFocusElement]);
|
|
190
|
-
const getPreviousFocusElement =
|
|
554
|
+
const getPreviousFocusElement = useCallback3(() => {
|
|
191
555
|
const elements = getFocusableElements();
|
|
192
556
|
if (elements.length === 0) {
|
|
193
557
|
return void 0;
|
|
@@ -203,7 +567,7 @@ function useFocusManagement() {
|
|
|
203
567
|
}
|
|
204
568
|
return previousElement;
|
|
205
569
|
}, [getFocusableElements]);
|
|
206
|
-
const focusPrevious =
|
|
570
|
+
const focusPrevious = useCallback3(() => {
|
|
207
571
|
const previousElement = getPreviousFocusElement();
|
|
208
572
|
if (previousElement) previousElement.focus();
|
|
209
573
|
}, [getPreviousFocusElement]);
|
|
@@ -217,10 +581,10 @@ function useFocusManagement() {
|
|
|
217
581
|
}
|
|
218
582
|
|
|
219
583
|
// src/hooks/useFocusOnceVisible.ts
|
|
220
|
-
import React, { useEffect as
|
|
584
|
+
import React, { useEffect as useEffect8 } from "react";
|
|
221
585
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
222
586
|
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
223
|
-
|
|
587
|
+
useEffect8(() => {
|
|
224
588
|
if (disable || hasUsedFocus) {
|
|
225
589
|
return;
|
|
226
590
|
}
|
|
@@ -240,9 +604,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
240
604
|
};
|
|
241
605
|
|
|
242
606
|
// src/components/user-action/Input.tsx
|
|
243
|
-
import { jsx as
|
|
607
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
244
608
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
245
|
-
return
|
|
609
|
+
return clsx5(
|
|
246
610
|
"px-2 py-1.5 rounded-md border-2",
|
|
247
611
|
{
|
|
248
612
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -256,7 +620,7 @@ var defaultEditCompleteOptions = {
|
|
|
256
620
|
afterDelay: true,
|
|
257
621
|
delay: 2500
|
|
258
622
|
};
|
|
259
|
-
var Input =
|
|
623
|
+
var Input = forwardRef2(function Input2({
|
|
260
624
|
id,
|
|
261
625
|
type = "text",
|
|
262
626
|
value,
|
|
@@ -279,7 +643,7 @@ var Input = forwardRef(function Input2({
|
|
|
279
643
|
restartTimer,
|
|
280
644
|
clearTimer
|
|
281
645
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
282
|
-
const innerRef =
|
|
646
|
+
const innerRef = useRef2(null);
|
|
283
647
|
const { focusNext } = useFocusManagement();
|
|
284
648
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
285
649
|
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
@@ -290,9 +654,9 @@ var Input = forwardRef(function Input2({
|
|
|
290
654
|
focusNext();
|
|
291
655
|
}
|
|
292
656
|
};
|
|
293
|
-
return /* @__PURE__ */
|
|
294
|
-
label && /* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
657
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5({ "w-full": expanded }, containerClassName), children: [
|
|
658
|
+
label && /* @__PURE__ */ jsx6(Label, { ...label, htmlFor: id, className: clsx5("mb-1", label.className) }),
|
|
659
|
+
/* @__PURE__ */ jsx6(
|
|
296
660
|
"input",
|
|
297
661
|
{
|
|
298
662
|
...restProps,
|
|
@@ -301,7 +665,7 @@ var Input = forwardRef(function Input2({
|
|
|
301
665
|
id,
|
|
302
666
|
type,
|
|
303
667
|
disabled,
|
|
304
|
-
className:
|
|
668
|
+
className: clsx5(getInputClassName({ disabled }), className),
|
|
305
669
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
306
670
|
onBlur: (event) => {
|
|
307
671
|
onBlur?.(event);
|
|
@@ -331,7 +695,7 @@ var Input = forwardRef(function Input2({
|
|
|
331
695
|
)
|
|
332
696
|
] });
|
|
333
697
|
});
|
|
334
|
-
var FormInput =
|
|
698
|
+
var FormInput = forwardRef2(function FormInput2({
|
|
335
699
|
id,
|
|
336
700
|
labelText,
|
|
337
701
|
errorText,
|
|
@@ -343,206 +707,33 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
343
707
|
disabled,
|
|
344
708
|
...restProps
|
|
345
709
|
}, ref) {
|
|
346
|
-
const input = /* @__PURE__ */
|
|
710
|
+
const input = /* @__PURE__ */ jsx6(
|
|
347
711
|
"input",
|
|
348
712
|
{
|
|
349
713
|
...restProps,
|
|
350
714
|
ref,
|
|
351
715
|
id,
|
|
352
716
|
disabled,
|
|
353
|
-
className:
|
|
717
|
+
className: clsx5(
|
|
354
718
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
355
719
|
className
|
|
356
720
|
)
|
|
357
721
|
}
|
|
358
722
|
);
|
|
359
|
-
return /* @__PURE__ */
|
|
360
|
-
labelText && /* @__PURE__ */
|
|
723
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5("flex flex-col gap-y-1", containerClassName), children: [
|
|
724
|
+
labelText && /* @__PURE__ */ jsxs4("label", { htmlFor: id, className: clsx5("textstyle-label-md", labelClassName), children: [
|
|
361
725
|
labelText,
|
|
362
|
-
required && /* @__PURE__ */
|
|
726
|
+
required && /* @__PURE__ */ jsx6("span", { className: "text-primary font-bold", children: "*" })
|
|
363
727
|
] }),
|
|
364
728
|
input,
|
|
365
|
-
errorText && /* @__PURE__ */
|
|
729
|
+
errorText && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: clsx5("text-negative", errorClassName), children: errorText })
|
|
366
730
|
] });
|
|
367
731
|
});
|
|
368
732
|
|
|
369
|
-
// src/components/user-action/Button.tsx
|
|
370
|
-
import clsx3 from "clsx";
|
|
371
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
372
|
-
var ButtonColorUtil = {
|
|
373
|
-
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
374
|
-
text: ["primary", "negative", "neutral"],
|
|
375
|
-
outline: ["primary"]
|
|
376
|
-
};
|
|
377
|
-
var IconButtonUtil = {
|
|
378
|
-
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
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"
|
|
390
|
-
};
|
|
391
|
-
var ButtonUtil = {
|
|
392
|
-
paddingMapping,
|
|
393
|
-
iconPaddingMapping
|
|
394
|
-
};
|
|
395
|
-
var SolidButton = ({
|
|
396
|
-
children,
|
|
397
|
-
disabled = false,
|
|
398
|
-
color = "primary",
|
|
399
|
-
size = "medium",
|
|
400
|
-
startIcon,
|
|
401
|
-
endIcon,
|
|
402
|
-
onClick,
|
|
403
|
-
className,
|
|
404
|
-
...restProps
|
|
405
|
-
}) => {
|
|
406
|
-
const colorClasses = {
|
|
407
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
408
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
409
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
410
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
411
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
412
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
413
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
414
|
-
}[color];
|
|
415
|
-
const iconColorClasses = {
|
|
416
|
-
primary: "text-button-solid-primary-icon",
|
|
417
|
-
secondary: "text-button-solid-secondary-icon",
|
|
418
|
-
tertiary: "text-button-solid-tertiary-icon",
|
|
419
|
-
positive: "text-button-solid-positive-icon",
|
|
420
|
-
warning: "text-button-solid-warning-icon",
|
|
421
|
-
negative: "text-button-solid-negative-icon",
|
|
422
|
-
neutral: "text-button-solid-neutral-icon"
|
|
423
|
-
}[color];
|
|
424
|
-
return /* @__PURE__ */ jsxs2(
|
|
425
|
-
"button",
|
|
426
|
-
{
|
|
427
|
-
onClick: disabled ? void 0 : onClick,
|
|
428
|
-
disabled: disabled || onClick === void 0,
|
|
429
|
-
className: clsx3(
|
|
430
|
-
{
|
|
431
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
432
|
-
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
433
|
-
},
|
|
434
|
-
ButtonUtil.paddingMapping[size],
|
|
435
|
-
className
|
|
436
|
-
),
|
|
437
|
-
...restProps,
|
|
438
|
-
children: [
|
|
439
|
-
startIcon && /* @__PURE__ */ jsx4(
|
|
440
|
-
"span",
|
|
441
|
-
{
|
|
442
|
-
className: clsx3({
|
|
443
|
-
[iconColorClasses]: !disabled,
|
|
444
|
-
[`text-disabled-icon`]: disabled
|
|
445
|
-
}),
|
|
446
|
-
children: startIcon
|
|
447
|
-
}
|
|
448
|
-
),
|
|
449
|
-
children,
|
|
450
|
-
endIcon && /* @__PURE__ */ jsx4(
|
|
451
|
-
"span",
|
|
452
|
-
{
|
|
453
|
-
className: clsx3({
|
|
454
|
-
[iconColorClasses]: !disabled,
|
|
455
|
-
[`text-disabled-icon`]: disabled
|
|
456
|
-
}),
|
|
457
|
-
children: endIcon
|
|
458
|
-
}
|
|
459
|
-
)
|
|
460
|
-
]
|
|
461
|
-
}
|
|
462
|
-
);
|
|
463
|
-
};
|
|
464
|
-
var IconButton = ({
|
|
465
|
-
children,
|
|
466
|
-
disabled = false,
|
|
467
|
-
color = "primary",
|
|
468
|
-
size = "medium",
|
|
469
|
-
onClick,
|
|
470
|
-
className,
|
|
471
|
-
...restProps
|
|
472
|
-
}) => {
|
|
473
|
-
const colorClasses = {
|
|
474
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
475
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
476
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
477
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
478
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
479
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
480
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
481
|
-
transparent: "bg-transparent"
|
|
482
|
-
}[color];
|
|
483
|
-
return /* @__PURE__ */ jsx4(
|
|
484
|
-
"button",
|
|
485
|
-
{
|
|
486
|
-
onClick: disabled ? void 0 : onClick,
|
|
487
|
-
disabled: disabled || onClick === void 0,
|
|
488
|
-
className: clsx3(
|
|
489
|
-
{
|
|
490
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
491
|
-
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
492
|
-
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
493
|
-
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
494
|
-
},
|
|
495
|
-
ButtonUtil.iconPaddingMapping[size],
|
|
496
|
-
className
|
|
497
|
-
),
|
|
498
|
-
...restProps,
|
|
499
|
-
children
|
|
500
|
-
}
|
|
501
|
-
);
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
// src/hooks/useSearch.ts
|
|
505
|
-
import { useEffect as useEffect6, useMemo, useState as useState5 } from "react";
|
|
506
|
-
|
|
507
|
-
// src/util/simpleSearch.ts
|
|
508
|
-
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
509
|
-
return objects.filter((object) => {
|
|
510
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
511
|
-
if (!mappedSearchKeywords) {
|
|
512
|
-
return true;
|
|
513
|
-
}
|
|
514
|
-
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
515
|
-
});
|
|
516
|
-
};
|
|
517
|
-
|
|
518
|
-
// src/hooks/useSearch.ts
|
|
519
|
-
var useSearch = ({
|
|
520
|
-
list,
|
|
521
|
-
initialSearch,
|
|
522
|
-
searchMapping
|
|
523
|
-
}) => {
|
|
524
|
-
const [items, setItems] = useState5(list);
|
|
525
|
-
const [search, setSearch] = useState5(initialSearch);
|
|
526
|
-
useEffect6(() => {
|
|
527
|
-
setItems(list);
|
|
528
|
-
}, [list]);
|
|
529
|
-
const result = useMemo(
|
|
530
|
-
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
531
|
-
[search, items, searchMapping]
|
|
532
|
-
);
|
|
533
|
-
return {
|
|
534
|
-
result,
|
|
535
|
-
hasResult: result.length > 0,
|
|
536
|
-
allItems: items,
|
|
537
|
-
setItems,
|
|
538
|
-
search,
|
|
539
|
-
setSearch
|
|
540
|
-
};
|
|
541
|
-
};
|
|
542
|
-
|
|
543
733
|
// src/localization/defaults/form.ts
|
|
544
734
|
var formTranslation = {
|
|
545
735
|
en: {
|
|
736
|
+
add: "Add",
|
|
546
737
|
all: "All",
|
|
547
738
|
apply: "Apply",
|
|
548
739
|
back: "Back",
|
|
@@ -555,6 +746,7 @@ var formTranslation = {
|
|
|
555
746
|
confirm: "Confirm",
|
|
556
747
|
copy: "Copy",
|
|
557
748
|
copied: "Copied",
|
|
749
|
+
create: "Create",
|
|
558
750
|
decline: "Decline",
|
|
559
751
|
delete: "Delete",
|
|
560
752
|
discard: "Discard",
|
|
@@ -597,6 +789,7 @@ var formTranslation = {
|
|
|
597
789
|
yes: "Yes"
|
|
598
790
|
},
|
|
599
791
|
de: {
|
|
792
|
+
add: "Hinzuf\xFCgen",
|
|
600
793
|
all: "Alle",
|
|
601
794
|
apply: "Anwenden",
|
|
602
795
|
back: "Zur\xFCck",
|
|
@@ -609,6 +802,7 @@ var formTranslation = {
|
|
|
609
802
|
confirm: "Best\xE4tigen",
|
|
610
803
|
copy: "Kopieren",
|
|
611
804
|
copied: "Kopiert",
|
|
805
|
+
create: "Erstellen",
|
|
612
806
|
decline: "Ablehnen",
|
|
613
807
|
delete: "L\xF6schen",
|
|
614
808
|
discard: "Verwerfen",
|
|
@@ -652,241 +846,346 @@ var formTranslation = {
|
|
|
652
846
|
}
|
|
653
847
|
};
|
|
654
848
|
|
|
655
|
-
// src/components/
|
|
656
|
-
import {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
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"]
|
|
664
857
|
};
|
|
665
|
-
var
|
|
666
|
-
|
|
667
|
-
list,
|
|
668
|
-
initialSearch = "",
|
|
669
|
-
searchMapping,
|
|
670
|
-
autoFocus,
|
|
671
|
-
minimumItemsForSearch = 6,
|
|
672
|
-
itemMapper,
|
|
673
|
-
className,
|
|
674
|
-
resultListClassName
|
|
675
|
-
}) => {
|
|
676
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
677
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
678
|
-
return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
|
|
679
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
680
|
-
/* @__PURE__ */ jsx5(
|
|
681
|
-
Input,
|
|
682
|
-
{
|
|
683
|
-
value: search,
|
|
684
|
-
onChangeText: setSearch,
|
|
685
|
-
placeholder: translation("search"),
|
|
686
|
-
autoFocus,
|
|
687
|
-
className: "w-full"
|
|
688
|
-
}
|
|
689
|
-
),
|
|
690
|
-
/* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
|
|
691
|
-
] }),
|
|
692
|
-
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") })
|
|
693
|
-
] });
|
|
858
|
+
var IconButtonUtil = {
|
|
859
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
694
860
|
};
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
var
|
|
701
|
-
|
|
702
|
-
|
|
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,
|
|
703
883
|
onClick,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
"
|
|
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",
|
|
715
907
|
{
|
|
716
|
-
|
|
717
|
-
|
|
908
|
+
ref,
|
|
909
|
+
onClick,
|
|
910
|
+
disabled,
|
|
911
|
+
className: clsx6(
|
|
718
912
|
{
|
|
719
|
-
|
|
720
|
-
[
|
|
721
|
-
[disabledClassName]: isDisabled
|
|
913
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
914
|
+
[clsx6(colorClasses, "hover:brightness-90")]: !disabled
|
|
722
915
|
},
|
|
916
|
+
ButtonUtil.paddingMapping[size],
|
|
723
917
|
className
|
|
724
918
|
),
|
|
725
|
-
|
|
919
|
+
...restProps,
|
|
726
920
|
children: [
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
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
|
+
)
|
|
733
942
|
]
|
|
734
943
|
}
|
|
735
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
|
+
);
|
|
736
982
|
};
|
|
737
983
|
|
|
738
|
-
// src/
|
|
739
|
-
import {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
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")
|
|
746
1002
|
}
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
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
|
+
};
|
|
756
1074
|
};
|
|
757
1075
|
|
|
758
1076
|
// src/components/user-action/Select.tsx
|
|
759
|
-
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
|
+
};
|
|
760
1094
|
var Select = ({
|
|
761
1095
|
value,
|
|
762
1096
|
label,
|
|
763
1097
|
options,
|
|
764
1098
|
onChange,
|
|
765
1099
|
hintText = "",
|
|
766
|
-
|
|
767
|
-
|
|
1100
|
+
selectedDisplayOverwrite,
|
|
1101
|
+
searchOptions,
|
|
1102
|
+
additionalItems,
|
|
768
1103
|
className,
|
|
769
|
-
|
|
1104
|
+
triggerClassName,
|
|
1105
|
+
hintTextClassName,
|
|
1106
|
+
...menuProps
|
|
770
1107
|
}) => {
|
|
771
|
-
const triggerRef = useRef2(null);
|
|
772
|
-
const menuRef = useRef2(null);
|
|
773
|
-
const [isOpen, setIsOpen] = useState6(false);
|
|
774
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
775
1108
|
const selectedOption = options.find((option) => option.value === value);
|
|
776
1109
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
777
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");
|
|
778
1111
|
}
|
|
779
1112
|
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
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,
|
|
817
1161
|
{
|
|
818
|
-
isSelected:
|
|
819
|
-
|
|
820
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
821
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1162
|
+
isSelected: option === selectedOption,
|
|
1163
|
+
title: { value: option.label },
|
|
822
1164
|
onClick: () => {
|
|
823
1165
|
onChange(option.value);
|
|
824
|
-
|
|
1166
|
+
close();
|
|
825
1167
|
},
|
|
826
|
-
|
|
1168
|
+
disabled: option.disabled
|
|
827
1169
|
},
|
|
828
1170
|
index
|
|
829
|
-
)
|
|
830
|
-
|
|
831
|
-
|
|
1171
|
+
)),
|
|
1172
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1173
|
+
] })
|
|
1174
|
+
] });
|
|
832
1175
|
}
|
|
833
|
-
|
|
834
|
-
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
835
1178
|
] });
|
|
836
1179
|
};
|
|
837
1180
|
|
|
838
1181
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
839
|
-
import { useEffect as
|
|
1182
|
+
import { useEffect as useEffect12, useRef as useRef3, useState as useState10 } from "react";
|
|
840
1183
|
import ReactDOM from "react-dom";
|
|
841
|
-
import
|
|
842
|
-
|
|
843
|
-
// src/hooks/useHoverState.ts
|
|
844
|
-
import { useEffect as useEffect9, useState as useState7 } from "react";
|
|
845
|
-
var defaultUseHoverStateProps = {
|
|
846
|
-
closingDelay: 200,
|
|
847
|
-
isDisabled: false
|
|
848
|
-
};
|
|
849
|
-
var useHoverState = (props = void 0) => {
|
|
850
|
-
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
851
|
-
const [isHovered, setIsHovered] = useState7(false);
|
|
852
|
-
const [timer, setTimer] = useState7();
|
|
853
|
-
const onMouseEnter = () => {
|
|
854
|
-
if (isDisabled) {
|
|
855
|
-
return;
|
|
856
|
-
}
|
|
857
|
-
clearTimeout(timer);
|
|
858
|
-
setIsHovered(true);
|
|
859
|
-
};
|
|
860
|
-
const onMouseLeave = () => {
|
|
861
|
-
if (isDisabled) {
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
setTimer(setTimeout(() => {
|
|
865
|
-
setIsHovered(false);
|
|
866
|
-
}, closingDelay));
|
|
867
|
-
};
|
|
868
|
-
useEffect9(() => {
|
|
869
|
-
if (timer) {
|
|
870
|
-
return () => {
|
|
871
|
-
clearTimeout(timer);
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
useEffect9(() => {
|
|
876
|
-
if (timer) {
|
|
877
|
-
clearTimeout(timer);
|
|
878
|
-
}
|
|
879
|
-
}, [isDisabled]);
|
|
880
|
-
return {
|
|
881
|
-
isHovered,
|
|
882
|
-
setIsHovered,
|
|
883
|
-
handlers: { onMouseEnter, onMouseLeave }
|
|
884
|
-
};
|
|
885
|
-
};
|
|
1184
|
+
import clsx10 from "clsx";
|
|
886
1185
|
|
|
887
1186
|
// src/components/user-action/Tooltip.tsx
|
|
888
|
-
import { clsx as
|
|
889
|
-
import { jsx as
|
|
1187
|
+
import { clsx as clsx9 } from "clsx";
|
|
1188
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
890
1189
|
var Tooltip = ({
|
|
891
1190
|
tooltip,
|
|
892
1191
|
children,
|
|
@@ -916,17 +1215,17 @@ var Tooltip = ({
|
|
|
916
1215
|
left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
|
|
917
1216
|
right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
|
|
918
1217
|
};
|
|
919
|
-
return /* @__PURE__ */
|
|
1218
|
+
return /* @__PURE__ */ jsxs8(
|
|
920
1219
|
"div",
|
|
921
1220
|
{
|
|
922
|
-
className:
|
|
1221
|
+
className: clsx9("relative inline-block", containerClassName),
|
|
923
1222
|
...handlers,
|
|
924
1223
|
children: [
|
|
925
1224
|
children,
|
|
926
|
-
isHovered && /* @__PURE__ */
|
|
1225
|
+
isHovered && /* @__PURE__ */ jsxs8(
|
|
927
1226
|
"div",
|
|
928
1227
|
{
|
|
929
|
-
className:
|
|
1228
|
+
className: clsx9(
|
|
930
1229
|
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
931
1230
|
animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
|
|
932
1231
|
positionClasses[position],
|
|
@@ -935,10 +1234,10 @@ var Tooltip = ({
|
|
|
935
1234
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
936
1235
|
children: [
|
|
937
1236
|
tooltip,
|
|
938
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ jsx10(
|
|
939
1238
|
"div",
|
|
940
1239
|
{
|
|
941
|
-
className:
|
|
1240
|
+
className: clsx9(`absolute w-0 h-0`, triangleClasses[position]),
|
|
942
1241
|
style: { ...triangleStyle[position], zIndex: zIndex + 1 }
|
|
943
1242
|
}
|
|
944
1243
|
)
|
|
@@ -952,24 +1251,24 @@ var Tooltip = ({
|
|
|
952
1251
|
|
|
953
1252
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
954
1253
|
import { X } from "lucide-react";
|
|
955
|
-
import { jsx as
|
|
1254
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
956
1255
|
var Overlay = ({
|
|
957
1256
|
children,
|
|
958
1257
|
isOpen,
|
|
959
1258
|
onBackgroundClick,
|
|
960
1259
|
backgroundClassName
|
|
961
1260
|
}) => {
|
|
962
|
-
const [root, setRoot] =
|
|
963
|
-
|
|
1261
|
+
const [root, setRoot] = useState10();
|
|
1262
|
+
useEffect12(() => {
|
|
964
1263
|
setRoot(document.body);
|
|
965
1264
|
}, []);
|
|
966
1265
|
if (!root || !isOpen) return null;
|
|
967
1266
|
return ReactDOM.createPortal(
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
1267
|
+
/* @__PURE__ */ jsxs9("div", { className: clsx10("fixed inset-0 z-[9999]"), children: [
|
|
1268
|
+
/* @__PURE__ */ jsx11(
|
|
970
1269
|
"div",
|
|
971
1270
|
{
|
|
972
|
-
className:
|
|
1271
|
+
className: clsx10("fixed inset-0 h-screen w-screen bg-overlay-shadow", backgroundClassName),
|
|
973
1272
|
onClick: onBackgroundClick
|
|
974
1273
|
}
|
|
975
1274
|
),
|
|
@@ -997,21 +1296,21 @@ var OverlayHeader = ({
|
|
|
997
1296
|
}) => {
|
|
998
1297
|
const translation = useTranslation([defaultModalHeaderTranslation], overwriteTranslation);
|
|
999
1298
|
const hasTitleRow = !!title || !!titleText || !!onClose;
|
|
1000
|
-
const titleRow = /* @__PURE__ */
|
|
1001
|
-
title ?? /* @__PURE__ */
|
|
1299
|
+
const titleRow = /* @__PURE__ */ jsxs9("div", { className: "flex-row-8 justify-between items-start", children: [
|
|
1300
|
+
title ?? /* @__PURE__ */ jsx11(
|
|
1002
1301
|
"h2",
|
|
1003
1302
|
{
|
|
1004
|
-
className:
|
|
1303
|
+
className: clsx10("textstyle-title-lg", {
|
|
1005
1304
|
"mb-1": description || descriptionText
|
|
1006
1305
|
}),
|
|
1007
1306
|
children: titleText
|
|
1008
1307
|
}
|
|
1009
1308
|
),
|
|
1010
|
-
!!onClose && /* @__PURE__ */
|
|
1309
|
+
!!onClose && /* @__PURE__ */ jsx11(Tooltip, { tooltip: translation("close"), children: /* @__PURE__ */ jsx11(IconButton, { color: "neutral", size: "small", onClick: onClose, children: /* @__PURE__ */ jsx11(X, { className: "w-full h-full" }) }) })
|
|
1011
1310
|
] });
|
|
1012
|
-
return /* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex-col-2", children: [
|
|
1013
1312
|
hasTitleRow && titleRow,
|
|
1014
|
-
description ?? (descriptionText && /* @__PURE__ */
|
|
1313
|
+
description ?? (descriptionText && /* @__PURE__ */ jsx11("span", { className: "textstyle-description", children: descriptionText }))
|
|
1015
1314
|
] });
|
|
1016
1315
|
};
|
|
1017
1316
|
var Modal = ({
|
|
@@ -1023,7 +1322,7 @@ var Modal = ({
|
|
|
1023
1322
|
headerProps
|
|
1024
1323
|
}) => {
|
|
1025
1324
|
const ref = useRef3(null);
|
|
1026
|
-
|
|
1325
|
+
useEffect12(() => {
|
|
1027
1326
|
if (!isOpen) return;
|
|
1028
1327
|
const modal = ref.current;
|
|
1029
1328
|
if (!modal) {
|
|
@@ -1060,25 +1359,25 @@ var Modal = ({
|
|
|
1060
1359
|
overlayStack = overlayStack.filter((m) => m !== modal);
|
|
1061
1360
|
};
|
|
1062
1361
|
}, [isOpen, onClose]);
|
|
1063
|
-
return /* @__PURE__ */
|
|
1362
|
+
return /* @__PURE__ */ jsx11(
|
|
1064
1363
|
Overlay,
|
|
1065
1364
|
{
|
|
1066
1365
|
isOpen,
|
|
1067
1366
|
onBackgroundClick: onClose,
|
|
1068
1367
|
backgroundClassName,
|
|
1069
|
-
children: /* @__PURE__ */
|
|
1368
|
+
children: /* @__PURE__ */ jsxs9(
|
|
1070
1369
|
"div",
|
|
1071
1370
|
{
|
|
1072
1371
|
ref,
|
|
1073
1372
|
tabIndex: -1,
|
|
1074
|
-
className:
|
|
1075
|
-
"fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2
|
|
1373
|
+
className: clsx10(
|
|
1374
|
+
"flex-col-2 fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 p-4 bg-overlay-background text-overlay-text rounded-xl shadow-xl animate-pop-in",
|
|
1076
1375
|
className
|
|
1077
1376
|
),
|
|
1078
1377
|
role: "dialog",
|
|
1079
1378
|
"aria-modal": true,
|
|
1080
1379
|
children: [
|
|
1081
|
-
/* @__PURE__ */
|
|
1380
|
+
/* @__PURE__ */ jsx11(OverlayHeader, { ...headerProps, onClose }),
|
|
1082
1381
|
children
|
|
1083
1382
|
]
|
|
1084
1383
|
}
|
|
@@ -1088,7 +1387,7 @@ var Modal = ({
|
|
|
1088
1387
|
};
|
|
1089
1388
|
|
|
1090
1389
|
// src/components/modals/LanguageModal.tsx
|
|
1091
|
-
import { jsx as
|
|
1390
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1092
1391
|
var defaultLanguageModalTranslation = {
|
|
1093
1392
|
en: {
|
|
1094
1393
|
language: "Language",
|
|
@@ -1111,7 +1410,7 @@ var LanguageModal = ({
|
|
|
1111
1410
|
}) => {
|
|
1112
1411
|
const { language, setLanguage } = useLanguage();
|
|
1113
1412
|
const translation = useTranslation([defaultLanguageModalTranslation], overwriteTranslation);
|
|
1114
|
-
return /* @__PURE__ */
|
|
1413
|
+
return /* @__PURE__ */ jsx12(
|
|
1115
1414
|
Modal,
|
|
1116
1415
|
{
|
|
1117
1416
|
headerProps: {
|
|
@@ -1121,8 +1420,8 @@ var LanguageModal = ({
|
|
|
1121
1420
|
},
|
|
1122
1421
|
onClose,
|
|
1123
1422
|
...modalProps,
|
|
1124
|
-
children: /* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1423
|
+
children: /* @__PURE__ */ jsxs10("div", { className: "w-64", children: [
|
|
1424
|
+
/* @__PURE__ */ jsx12(
|
|
1126
1425
|
Select,
|
|
1127
1426
|
{
|
|
1128
1427
|
className: "mt-2",
|
|
@@ -1131,7 +1430,7 @@ var LanguageModal = ({
|
|
|
1131
1430
|
onChange: (language2) => setLanguage(language2)
|
|
1132
1431
|
}
|
|
1133
1432
|
),
|
|
1134
|
-
/* @__PURE__ */
|
|
1433
|
+
/* @__PURE__ */ jsx12("div", { className: "flex-row-4 mt-3 justify-end", children: /* @__PURE__ */ jsx12(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation("done") }) })
|
|
1135
1434
|
] })
|
|
1136
1435
|
}
|
|
1137
1436
|
);
|