@helpwave/hightide 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/branding/HelpwaveBadge.js +7 -7
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +7 -7
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +65 -38
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +54 -27
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js +3 -3
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +3 -3
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +4 -4
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +4 -4
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +46 -19
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +44 -17
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +32 -28
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.js +2 -2
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Ring.js +2 -2
- package/dist/components/icons-and-geometry/Ring.js.map +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs +2 -2
- package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +84 -15
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.js +1 -1
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +7 -1
- package/dist/components/layout-and-navigation/Expandable.d.ts +7 -1
- package/dist/components/layout-and-navigation/Expandable.js +36 -9
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +36 -10
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +34 -11
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +36 -13
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +92 -19
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +82 -10
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +79 -7
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +127 -26
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +126 -25
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +22 -16
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +7 -3
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
- package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
- package/dist/components/layout-and-navigation/Tile.js +7 -7
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +7 -7
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +5 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +8 -6
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +8 -6
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +32 -28
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +18 -14
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +28 -24
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +18 -14
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +32 -29
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +18 -15
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +728 -435
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +728 -431
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +732 -439
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +731 -434
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +110 -35
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +110 -35
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +118 -42
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +114 -38
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
- package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
- package/dist/components/properties/MultiSelectProperty.js +915 -464
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +920 -465
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +101 -19
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +101 -19
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +103 -20
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +99 -16
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +9 -2
- package/dist/components/properties/SelectProperty.d.ts +9 -2
- package/dist/components/properties/SelectProperty.js +682 -244
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +686 -244
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +133 -47
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +133 -47
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +285 -186
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +270 -167
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +179 -79
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +160 -56
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +72 -3
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +72 -3
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +15 -2
- package/dist/components/user-action/Button.d.ts +15 -2
- package/dist/components/user-action/Button.js +12 -12
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +12 -12
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +6 -15
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +6 -15
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +79 -48
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +65 -34
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Input.js +0 -1
- package/dist/components/user-action/Input.js.map +1 -1
- package/dist/components/user-action/Input.mjs +0 -1
- package/dist/components/user-action/Input.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +11 -6
- package/dist/components/user-action/Menu.d.ts +11 -6
- package/dist/components/user-action/Menu.js +128 -31
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +134 -33
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +17 -7
- package/dist/components/user-action/MultiSelect.d.ts +17 -7
- package/dist/components/user-action/MultiSelect.js +796 -376
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +781 -357
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +2 -2
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +2 -2
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.d.mts +14 -0
- package/dist/components/user-action/SearchBar.d.ts +14 -0
- package/dist/components/user-action/SearchBar.js +673 -0
- package/dist/components/user-action/SearchBar.js.map +1 -0
- package/dist/components/user-action/SearchBar.mjs +637 -0
- package/dist/components/user-action/SearchBar.mjs.map +1 -0
- package/dist/components/user-action/Select.d.mts +18 -5
- package/dist/components/user-action/Select.d.ts +18 -5
- package/dist/components/user-action/Select.js +764 -356
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +761 -350
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +1 -1
- package/dist/components/user-action/Textarea.d.ts +1 -1
- package/dist/components/user-action/Textarea.js +13 -4
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +13 -4
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.js +2 -3
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +2 -3
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +251 -113
- package/dist/css/uncompiled/globals.css +19 -13
- package/dist/css/uncompiled/theme/colors-component.css +12 -3
- package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
- package/dist/css/uncompiled/utitlity/animation.css +70 -1
- package/dist/css/uncompiled/utitlity/general.css +16 -0
- package/dist/hooks/useDelay.js +0 -1
- package/dist/hooks/useDelay.js.map +1 -1
- package/dist/hooks/useDelay.mjs +0 -1
- package/dist/hooks/useDelay.mjs.map +1 -1
- package/dist/hooks/usePopoverPosition.d.mts +15 -0
- package/dist/hooks/usePopoverPosition.d.ts +15 -0
- package/dist/hooks/usePopoverPosition.js +81 -0
- package/dist/hooks/usePopoverPosition.js.map +1 -0
- package/dist/hooks/usePopoverPosition.mjs +57 -0
- package/dist/hooks/usePopoverPosition.mjs.map +1 -0
- package/dist/hooks/useSearch.d.mts +7 -2
- package/dist/hooks/useSearch.d.ts +7 -2
- package/dist/hooks/useSearch.js +44 -15
- package/dist/hooks/useSearch.js.map +1 -1
- package/dist/hooks/useSearch.mjs +45 -16
- package/dist/hooks/useSearch.mjs.map +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1102 -820
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1001 -719
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +2 -0
- package/dist/localization/defaults/form.d.ts +2 -0
- package/dist/localization/defaults/form.js +4 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +4 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/simpleSearch.d.mts +1 -1
- package/dist/util/simpleSearch.d.ts +1 -1
- package/dist/util/simpleSearch.js +4 -1
- package/dist/util/simpleSearch.js.map +1 -1
- package/dist/util/simpleSearch.mjs +4 -1
- package/dist/util/simpleSearch.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -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,388 @@ 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
|
+
}, ref) {
|
|
187
|
+
const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx4(ExpansionIcon, { isExpanded: expanded }), []);
|
|
188
|
+
icon ??= defaultIcon;
|
|
189
|
+
return /* @__PURE__ */ jsxs2(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
ref,
|
|
193
|
+
className: clsx3("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
194
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsxs2(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
className: clsx3(
|
|
200
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
201
|
+
{
|
|
202
|
+
"group-hover:brightness-97": !isExpanded,
|
|
203
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
204
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
205
|
+
},
|
|
206
|
+
headerClassName
|
|
207
|
+
),
|
|
208
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
209
|
+
children: [
|
|
210
|
+
label,
|
|
211
|
+
icon(isExpanded)
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ jsx4(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
className: clsx3(
|
|
219
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
220
|
+
{
|
|
221
|
+
"max-h-96 opacity-100 pb-2": isExpanded,
|
|
222
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
223
|
+
},
|
|
224
|
+
contentClassName
|
|
225
|
+
),
|
|
226
|
+
children
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
var ExpandableUncontrolled = forwardRef(function ExpandableUncontrolled2({
|
|
234
|
+
isExpanded,
|
|
235
|
+
onChange = noop,
|
|
236
|
+
...props
|
|
237
|
+
}, ref) {
|
|
238
|
+
const [usedIsExpanded, setUsedIsExpanded] = useState3(isExpanded);
|
|
239
|
+
useEffect3(() => {
|
|
240
|
+
setUsedIsExpanded(isExpanded);
|
|
241
|
+
}, [isExpanded]);
|
|
242
|
+
return /* @__PURE__ */ jsx4(
|
|
243
|
+
Expandable,
|
|
244
|
+
{
|
|
245
|
+
...props,
|
|
246
|
+
ref,
|
|
247
|
+
isExpanded: usedIsExpanded,
|
|
248
|
+
onChange: (value) => {
|
|
249
|
+
onChange(value);
|
|
250
|
+
setUsedIsExpanded(value);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// src/components/user-action/Menu.tsx
|
|
257
|
+
import {
|
|
258
|
+
useEffect as useEffect6,
|
|
259
|
+
useRef,
|
|
260
|
+
useState as useState5
|
|
261
|
+
} from "react";
|
|
113
262
|
import clsx4 from "clsx";
|
|
114
263
|
|
|
264
|
+
// src/hooks/useOutsideClick.ts
|
|
265
|
+
import { useEffect as useEffect4 } from "react";
|
|
266
|
+
var useOutsideClick = (refs, handler) => {
|
|
267
|
+
useEffect4(() => {
|
|
268
|
+
const listener = (event) => {
|
|
269
|
+
if (event.target === null) return;
|
|
270
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
handler();
|
|
274
|
+
};
|
|
275
|
+
document.addEventListener("mousedown", listener);
|
|
276
|
+
document.addEventListener("touchstart", listener);
|
|
277
|
+
return () => {
|
|
278
|
+
document.removeEventListener("mousedown", listener);
|
|
279
|
+
document.removeEventListener("touchstart", listener);
|
|
280
|
+
};
|
|
281
|
+
}, [refs, handler]);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// src/hooks/useHoverState.ts
|
|
285
|
+
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
286
|
+
var defaultUseHoverStateProps = {
|
|
287
|
+
closingDelay: 200,
|
|
288
|
+
isDisabled: false
|
|
289
|
+
};
|
|
290
|
+
var useHoverState = (props = void 0) => {
|
|
291
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
292
|
+
const [isHovered, setIsHovered] = useState4(false);
|
|
293
|
+
const [timer, setTimer] = useState4();
|
|
294
|
+
const onMouseEnter = () => {
|
|
295
|
+
if (isDisabled) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
clearTimeout(timer);
|
|
299
|
+
setIsHovered(true);
|
|
300
|
+
};
|
|
301
|
+
const onMouseLeave = () => {
|
|
302
|
+
if (isDisabled) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
setTimer(setTimeout(() => {
|
|
306
|
+
setIsHovered(false);
|
|
307
|
+
}, closingDelay));
|
|
308
|
+
};
|
|
309
|
+
useEffect5(() => {
|
|
310
|
+
if (timer) {
|
|
311
|
+
return () => {
|
|
312
|
+
clearTimeout(timer);
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
useEffect5(() => {
|
|
317
|
+
if (timer) {
|
|
318
|
+
clearTimeout(timer);
|
|
319
|
+
}
|
|
320
|
+
}, [isDisabled]);
|
|
321
|
+
return {
|
|
322
|
+
isHovered,
|
|
323
|
+
setIsHovered,
|
|
324
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
329
|
+
var resolve = (children, bag) => {
|
|
330
|
+
if (typeof children === "function") {
|
|
331
|
+
return children(bag);
|
|
332
|
+
}
|
|
333
|
+
return children ?? void 0;
|
|
334
|
+
};
|
|
335
|
+
var BagFunctionUtil = {
|
|
336
|
+
resolve
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// src/hooks/usePopoverPosition.ts
|
|
340
|
+
var defaultPopoverPositionOptions = {
|
|
341
|
+
edgePadding: 16,
|
|
342
|
+
outerGap: 4,
|
|
343
|
+
horizontalAlignment: "leftInside",
|
|
344
|
+
verticalAlignment: "bottomOutside",
|
|
345
|
+
disabled: false
|
|
346
|
+
};
|
|
347
|
+
var usePopoverPosition = (trigger, options) => {
|
|
348
|
+
const {
|
|
349
|
+
edgePadding,
|
|
350
|
+
outerGap,
|
|
351
|
+
verticalAlignment,
|
|
352
|
+
horizontalAlignment,
|
|
353
|
+
disabled
|
|
354
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
355
|
+
if (disabled || !trigger) {
|
|
356
|
+
return {};
|
|
357
|
+
}
|
|
358
|
+
const left = {
|
|
359
|
+
leftOutside: trigger.left - outerGap,
|
|
360
|
+
leftInside: trigger.left,
|
|
361
|
+
rightOutside: trigger.right + outerGap,
|
|
362
|
+
rightInside: trigger.right,
|
|
363
|
+
center: trigger.left + trigger.width / 2
|
|
364
|
+
}[horizontalAlignment];
|
|
365
|
+
const top = {
|
|
366
|
+
topOutside: trigger.top - outerGap,
|
|
367
|
+
topInside: trigger.top,
|
|
368
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
369
|
+
bottomInside: trigger.bottom,
|
|
370
|
+
center: trigger.top + trigger.height / 2
|
|
371
|
+
}[verticalAlignment];
|
|
372
|
+
const translateX = {
|
|
373
|
+
leftOutside: "-100%",
|
|
374
|
+
leftInside: void 0,
|
|
375
|
+
rightOutside: void 0,
|
|
376
|
+
rightInside: "-100%",
|
|
377
|
+
center: "-50%"
|
|
378
|
+
}[horizontalAlignment];
|
|
379
|
+
const translateY = {
|
|
380
|
+
topOutside: "-100%",
|
|
381
|
+
topInside: void 0,
|
|
382
|
+
bottomOutside: void 0,
|
|
383
|
+
bottomInside: "-100%",
|
|
384
|
+
center: "-50%"
|
|
385
|
+
}[verticalAlignment];
|
|
386
|
+
return {
|
|
387
|
+
left: Math.max(left, edgePadding),
|
|
388
|
+
top: Math.max(top, edgePadding),
|
|
389
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
// src/components/user-action/Menu.tsx
|
|
394
|
+
import { createPortal } from "react-dom";
|
|
395
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
396
|
+
function getScrollableParents(element) {
|
|
397
|
+
const scrollables = [];
|
|
398
|
+
let parent = element.parentElement;
|
|
399
|
+
while (parent) {
|
|
400
|
+
scrollables.push(parent);
|
|
401
|
+
parent = parent.parentElement;
|
|
402
|
+
}
|
|
403
|
+
return scrollables;
|
|
404
|
+
}
|
|
405
|
+
var Menu = ({
|
|
406
|
+
trigger,
|
|
407
|
+
children,
|
|
408
|
+
alignmentHorizontal = "leftInside",
|
|
409
|
+
alignmentVertical = "bottomOutside",
|
|
410
|
+
showOnHover = false,
|
|
411
|
+
disabled = false,
|
|
412
|
+
menuClassName = ""
|
|
413
|
+
}) => {
|
|
414
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
415
|
+
const triggerRef = useRef(null);
|
|
416
|
+
const menuRef = useRef(null);
|
|
417
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
418
|
+
const [isHidden, setIsHidden] = useState5(true);
|
|
419
|
+
const bag = {
|
|
420
|
+
isOpen,
|
|
421
|
+
close: () => setIsOpen(false),
|
|
422
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
423
|
+
disabled
|
|
424
|
+
};
|
|
425
|
+
const menuPosition = usePopoverPosition(
|
|
426
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
427
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
428
|
+
);
|
|
429
|
+
useEffect6(() => {
|
|
430
|
+
if (!isOpen) return;
|
|
431
|
+
const triggerEl = triggerRef.current;
|
|
432
|
+
if (!triggerEl) return;
|
|
433
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
434
|
+
const close = () => setIsOpen(false);
|
|
435
|
+
scrollableParents.forEach((parent) => {
|
|
436
|
+
parent.addEventListener("scroll", close);
|
|
437
|
+
});
|
|
438
|
+
window.addEventListener("resize", close);
|
|
439
|
+
return () => {
|
|
440
|
+
scrollableParents.forEach((parent) => {
|
|
441
|
+
parent.removeEventListener("scroll", close);
|
|
442
|
+
});
|
|
443
|
+
window.removeEventListener("resize", close);
|
|
444
|
+
};
|
|
445
|
+
}, [isOpen, setIsOpen]);
|
|
446
|
+
useEffect6(() => {
|
|
447
|
+
if (isOpen) {
|
|
448
|
+
setIsHidden(false);
|
|
449
|
+
}
|
|
450
|
+
}, [isOpen]);
|
|
451
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
452
|
+
trigger(bag, triggerRef),
|
|
453
|
+
createPortal(/* @__PURE__ */ jsx5(
|
|
454
|
+
"div",
|
|
455
|
+
{
|
|
456
|
+
ref: menuRef,
|
|
457
|
+
onClick: (e) => e.stopPropagation(),
|
|
458
|
+
className: clsx4(
|
|
459
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
460
|
+
{
|
|
461
|
+
"animate-pop-in": isOpen,
|
|
462
|
+
"animate-pop-out": !isOpen,
|
|
463
|
+
"hidden": isHidden
|
|
464
|
+
},
|
|
465
|
+
menuClassName
|
|
466
|
+
),
|
|
467
|
+
onAnimationEnd: () => {
|
|
468
|
+
if (!isOpen) {
|
|
469
|
+
setIsHidden(true);
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
style: {
|
|
473
|
+
...menuPosition
|
|
474
|
+
},
|
|
475
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
476
|
+
}
|
|
477
|
+
), document.body)
|
|
478
|
+
] });
|
|
479
|
+
};
|
|
480
|
+
|
|
115
481
|
// src/components/user-action/Input.tsx
|
|
116
|
-
import { forwardRef, useEffect as
|
|
117
|
-
import
|
|
482
|
+
import { forwardRef as forwardRef2, useEffect as useEffect9, useImperativeHandle, useRef as useRef2, useState as useState7 } from "react";
|
|
483
|
+
import clsx5 from "clsx";
|
|
118
484
|
|
|
119
485
|
// src/hooks/useDelay.ts
|
|
120
|
-
import { useEffect as
|
|
486
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
121
487
|
var defaultOptions = {
|
|
122
488
|
delay: 3e3,
|
|
123
489
|
disabled: false
|
|
124
490
|
};
|
|
125
491
|
function useDelay(options) {
|
|
126
|
-
const [timer, setTimer] =
|
|
492
|
+
const [timer, setTimer] = useState6(void 0);
|
|
127
493
|
const { delay, disabled } = {
|
|
128
494
|
...defaultOptions,
|
|
129
495
|
...options
|
|
@@ -142,28 +508,24 @@ function useDelay(options) {
|
|
|
142
508
|
setTimer(void 0);
|
|
143
509
|
}, delay));
|
|
144
510
|
};
|
|
145
|
-
|
|
511
|
+
useEffect7(() => {
|
|
146
512
|
return () => {
|
|
147
513
|
clearTimeout(timer);
|
|
148
514
|
};
|
|
149
515
|
}, [timer]);
|
|
150
|
-
|
|
516
|
+
useEffect7(() => {
|
|
151
517
|
if (disabled) {
|
|
152
518
|
clearTimeout(timer);
|
|
153
519
|
setTimer(void 0);
|
|
154
520
|
}
|
|
155
521
|
}, [disabled, timer]);
|
|
156
|
-
console.log(timer);
|
|
157
522
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
158
523
|
}
|
|
159
524
|
|
|
160
|
-
// src/util/noop.ts
|
|
161
|
-
var noop = () => void 0;
|
|
162
|
-
|
|
163
525
|
// src/hooks/useFocusManagement.ts
|
|
164
|
-
import { useCallback as
|
|
526
|
+
import { useCallback as useCallback3 } from "react";
|
|
165
527
|
function useFocusManagement() {
|
|
166
|
-
const getFocusableElements =
|
|
528
|
+
const getFocusableElements = useCallback3(() => {
|
|
167
529
|
return Array.from(
|
|
168
530
|
document.querySelectorAll(
|
|
169
531
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -172,7 +534,7 @@ function useFocusManagement() {
|
|
|
172
534
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
173
535
|
);
|
|
174
536
|
}, []);
|
|
175
|
-
const getNextFocusElement =
|
|
537
|
+
const getNextFocusElement = useCallback3(() => {
|
|
176
538
|
const elements = getFocusableElements();
|
|
177
539
|
if (elements.length === 0) {
|
|
178
540
|
return void 0;
|
|
@@ -184,11 +546,11 @@ function useFocusManagement() {
|
|
|
184
546
|
}
|
|
185
547
|
return nextElement;
|
|
186
548
|
}, [getFocusableElements]);
|
|
187
|
-
const focusNext =
|
|
549
|
+
const focusNext = useCallback3(() => {
|
|
188
550
|
const nextElement = getNextFocusElement();
|
|
189
551
|
nextElement?.focus();
|
|
190
552
|
}, [getNextFocusElement]);
|
|
191
|
-
const getPreviousFocusElement =
|
|
553
|
+
const getPreviousFocusElement = useCallback3(() => {
|
|
192
554
|
const elements = getFocusableElements();
|
|
193
555
|
if (elements.length === 0) {
|
|
194
556
|
return void 0;
|
|
@@ -204,7 +566,7 @@ function useFocusManagement() {
|
|
|
204
566
|
}
|
|
205
567
|
return previousElement;
|
|
206
568
|
}, [getFocusableElements]);
|
|
207
|
-
const focusPrevious =
|
|
569
|
+
const focusPrevious = useCallback3(() => {
|
|
208
570
|
const previousElement = getPreviousFocusElement();
|
|
209
571
|
if (previousElement) previousElement.focus();
|
|
210
572
|
}, [getPreviousFocusElement]);
|
|
@@ -218,10 +580,10 @@ function useFocusManagement() {
|
|
|
218
580
|
}
|
|
219
581
|
|
|
220
582
|
// src/hooks/useFocusOnceVisible.ts
|
|
221
|
-
import React, { useEffect as
|
|
583
|
+
import React, { useEffect as useEffect8 } from "react";
|
|
222
584
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
223
585
|
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
224
|
-
|
|
586
|
+
useEffect8(() => {
|
|
225
587
|
if (disable || hasUsedFocus) {
|
|
226
588
|
return;
|
|
227
589
|
}
|
|
@@ -241,9 +603,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
241
603
|
};
|
|
242
604
|
|
|
243
605
|
// src/components/user-action/Input.tsx
|
|
244
|
-
import { jsx as
|
|
606
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
245
607
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
246
|
-
return
|
|
608
|
+
return clsx5(
|
|
247
609
|
"px-2 py-1.5 rounded-md border-2",
|
|
248
610
|
{
|
|
249
611
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -257,7 +619,7 @@ var defaultEditCompleteOptions = {
|
|
|
257
619
|
afterDelay: true,
|
|
258
620
|
delay: 2500
|
|
259
621
|
};
|
|
260
|
-
var Input =
|
|
622
|
+
var Input = forwardRef2(function Input2({
|
|
261
623
|
id,
|
|
262
624
|
type = "text",
|
|
263
625
|
value,
|
|
@@ -280,7 +642,7 @@ var Input = forwardRef(function Input2({
|
|
|
280
642
|
restartTimer,
|
|
281
643
|
clearTimer
|
|
282
644
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
283
|
-
const innerRef =
|
|
645
|
+
const innerRef = useRef2(null);
|
|
284
646
|
const { focusNext } = useFocusManagement();
|
|
285
647
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
286
648
|
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
@@ -291,9 +653,9 @@ var Input = forwardRef(function Input2({
|
|
|
291
653
|
focusNext();
|
|
292
654
|
}
|
|
293
655
|
};
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
-
label && /* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5({ "w-full": expanded }, containerClassName), children: [
|
|
657
|
+
label && /* @__PURE__ */ jsx6(Label, { ...label, htmlFor: id, className: clsx5("mb-1", label.className) }),
|
|
658
|
+
/* @__PURE__ */ jsx6(
|
|
297
659
|
"input",
|
|
298
660
|
{
|
|
299
661
|
...restProps,
|
|
@@ -302,7 +664,7 @@ var Input = forwardRef(function Input2({
|
|
|
302
664
|
id,
|
|
303
665
|
type,
|
|
304
666
|
disabled,
|
|
305
|
-
className:
|
|
667
|
+
className: clsx5(getInputClassName({ disabled }), className),
|
|
306
668
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
307
669
|
onBlur: (event) => {
|
|
308
670
|
onBlur?.(event);
|
|
@@ -332,7 +694,7 @@ var Input = forwardRef(function Input2({
|
|
|
332
694
|
)
|
|
333
695
|
] });
|
|
334
696
|
});
|
|
335
|
-
var FormInput =
|
|
697
|
+
var FormInput = forwardRef2(function FormInput2({
|
|
336
698
|
id,
|
|
337
699
|
labelText,
|
|
338
700
|
errorText,
|
|
@@ -344,206 +706,33 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
344
706
|
disabled,
|
|
345
707
|
...restProps
|
|
346
708
|
}, ref) {
|
|
347
|
-
const input = /* @__PURE__ */
|
|
709
|
+
const input = /* @__PURE__ */ jsx6(
|
|
348
710
|
"input",
|
|
349
711
|
{
|
|
350
712
|
...restProps,
|
|
351
713
|
ref,
|
|
352
714
|
id,
|
|
353
715
|
disabled,
|
|
354
|
-
className:
|
|
716
|
+
className: clsx5(
|
|
355
717
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
356
718
|
className
|
|
357
719
|
)
|
|
358
720
|
}
|
|
359
721
|
);
|
|
360
|
-
return /* @__PURE__ */
|
|
361
|
-
labelText && /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5("flex flex-col gap-y-1", containerClassName), children: [
|
|
723
|
+
labelText && /* @__PURE__ */ jsxs4("label", { htmlFor: id, className: clsx5("textstyle-label-md", labelClassName), children: [
|
|
362
724
|
labelText,
|
|
363
|
-
required && /* @__PURE__ */
|
|
725
|
+
required && /* @__PURE__ */ jsx6("span", { className: "text-primary font-bold", children: "*" })
|
|
364
726
|
] }),
|
|
365
727
|
input,
|
|
366
|
-
errorText && /* @__PURE__ */
|
|
728
|
+
errorText && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: clsx5("text-negative", errorClassName), children: errorText })
|
|
367
729
|
] });
|
|
368
730
|
});
|
|
369
731
|
|
|
370
|
-
// src/components/user-action/Button.tsx
|
|
371
|
-
import clsx3 from "clsx";
|
|
372
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
373
|
-
var ButtonColorUtil = {
|
|
374
|
-
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
375
|
-
text: ["primary", "negative", "neutral"],
|
|
376
|
-
outline: ["primary"]
|
|
377
|
-
};
|
|
378
|
-
var IconButtonUtil = {
|
|
379
|
-
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
380
|
-
};
|
|
381
|
-
var paddingMapping = {
|
|
382
|
-
small: "btn-sm",
|
|
383
|
-
medium: "btn-md",
|
|
384
|
-
large: "btn-lg"
|
|
385
|
-
};
|
|
386
|
-
var iconPaddingMapping = {
|
|
387
|
-
tiny: "icon-btn-xs",
|
|
388
|
-
small: "icon-btn-sm",
|
|
389
|
-
medium: "icon-btn-md",
|
|
390
|
-
large: "icon-btn-lg"
|
|
391
|
-
};
|
|
392
|
-
var ButtonUtil = {
|
|
393
|
-
paddingMapping,
|
|
394
|
-
iconPaddingMapping
|
|
395
|
-
};
|
|
396
|
-
var SolidButton = ({
|
|
397
|
-
children,
|
|
398
|
-
disabled = false,
|
|
399
|
-
color = "primary",
|
|
400
|
-
size = "medium",
|
|
401
|
-
startIcon,
|
|
402
|
-
endIcon,
|
|
403
|
-
onClick,
|
|
404
|
-
className,
|
|
405
|
-
...restProps
|
|
406
|
-
}) => {
|
|
407
|
-
const colorClasses = {
|
|
408
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
409
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
410
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
411
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
412
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
413
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
414
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
415
|
-
}[color];
|
|
416
|
-
const iconColorClasses = {
|
|
417
|
-
primary: "text-button-solid-primary-icon",
|
|
418
|
-
secondary: "text-button-solid-secondary-icon",
|
|
419
|
-
tertiary: "text-button-solid-tertiary-icon",
|
|
420
|
-
positive: "text-button-solid-positive-icon",
|
|
421
|
-
warning: "text-button-solid-warning-icon",
|
|
422
|
-
negative: "text-button-solid-negative-icon",
|
|
423
|
-
neutral: "text-button-solid-neutral-icon"
|
|
424
|
-
}[color];
|
|
425
|
-
return /* @__PURE__ */ jsxs2(
|
|
426
|
-
"button",
|
|
427
|
-
{
|
|
428
|
-
onClick: disabled ? void 0 : onClick,
|
|
429
|
-
disabled: disabled || onClick === void 0,
|
|
430
|
-
className: clsx3(
|
|
431
|
-
{
|
|
432
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
433
|
-
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
434
|
-
},
|
|
435
|
-
ButtonUtil.paddingMapping[size],
|
|
436
|
-
className
|
|
437
|
-
),
|
|
438
|
-
...restProps,
|
|
439
|
-
children: [
|
|
440
|
-
startIcon && /* @__PURE__ */ jsx4(
|
|
441
|
-
"span",
|
|
442
|
-
{
|
|
443
|
-
className: clsx3({
|
|
444
|
-
[iconColorClasses]: !disabled,
|
|
445
|
-
[`text-disabled-icon`]: disabled
|
|
446
|
-
}),
|
|
447
|
-
children: startIcon
|
|
448
|
-
}
|
|
449
|
-
),
|
|
450
|
-
children,
|
|
451
|
-
endIcon && /* @__PURE__ */ jsx4(
|
|
452
|
-
"span",
|
|
453
|
-
{
|
|
454
|
-
className: clsx3({
|
|
455
|
-
[iconColorClasses]: !disabled,
|
|
456
|
-
[`text-disabled-icon`]: disabled
|
|
457
|
-
}),
|
|
458
|
-
children: endIcon
|
|
459
|
-
}
|
|
460
|
-
)
|
|
461
|
-
]
|
|
462
|
-
}
|
|
463
|
-
);
|
|
464
|
-
};
|
|
465
|
-
var IconButton = ({
|
|
466
|
-
children,
|
|
467
|
-
disabled = false,
|
|
468
|
-
color = "primary",
|
|
469
|
-
size = "medium",
|
|
470
|
-
onClick,
|
|
471
|
-
className,
|
|
472
|
-
...restProps
|
|
473
|
-
}) => {
|
|
474
|
-
const colorClasses = {
|
|
475
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
476
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
477
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
478
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
479
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
480
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
481
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
482
|
-
transparent: "bg-transparent"
|
|
483
|
-
}[color];
|
|
484
|
-
return /* @__PURE__ */ jsx4(
|
|
485
|
-
"button",
|
|
486
|
-
{
|
|
487
|
-
onClick: disabled ? void 0 : onClick,
|
|
488
|
-
disabled: disabled || onClick === void 0,
|
|
489
|
-
className: clsx3(
|
|
490
|
-
{
|
|
491
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
492
|
-
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
493
|
-
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
494
|
-
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
495
|
-
},
|
|
496
|
-
ButtonUtil.iconPaddingMapping[size],
|
|
497
|
-
className
|
|
498
|
-
),
|
|
499
|
-
...restProps,
|
|
500
|
-
children
|
|
501
|
-
}
|
|
502
|
-
);
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
// src/hooks/useSearch.ts
|
|
506
|
-
import { useEffect as useEffect6, useMemo, useState as useState5 } from "react";
|
|
507
|
-
|
|
508
|
-
// src/util/simpleSearch.ts
|
|
509
|
-
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
510
|
-
return objects.filter((object) => {
|
|
511
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
512
|
-
if (!mappedSearchKeywords) {
|
|
513
|
-
return true;
|
|
514
|
-
}
|
|
515
|
-
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
516
|
-
});
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
// src/hooks/useSearch.ts
|
|
520
|
-
var useSearch = ({
|
|
521
|
-
list,
|
|
522
|
-
initialSearch,
|
|
523
|
-
searchMapping
|
|
524
|
-
}) => {
|
|
525
|
-
const [items, setItems] = useState5(list);
|
|
526
|
-
const [search, setSearch] = useState5(initialSearch);
|
|
527
|
-
useEffect6(() => {
|
|
528
|
-
setItems(list);
|
|
529
|
-
}, [list]);
|
|
530
|
-
const result = useMemo(
|
|
531
|
-
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
532
|
-
[search, items, searchMapping]
|
|
533
|
-
);
|
|
534
|
-
return {
|
|
535
|
-
result,
|
|
536
|
-
hasResult: result.length > 0,
|
|
537
|
-
allItems: items,
|
|
538
|
-
setItems,
|
|
539
|
-
search,
|
|
540
|
-
setSearch
|
|
541
|
-
};
|
|
542
|
-
};
|
|
543
|
-
|
|
544
732
|
// src/localization/defaults/form.ts
|
|
545
733
|
var formTranslation = {
|
|
546
734
|
en: {
|
|
735
|
+
add: "Add",
|
|
547
736
|
all: "All",
|
|
548
737
|
apply: "Apply",
|
|
549
738
|
back: "Back",
|
|
@@ -556,6 +745,7 @@ var formTranslation = {
|
|
|
556
745
|
confirm: "Confirm",
|
|
557
746
|
copy: "Copy",
|
|
558
747
|
copied: "Copied",
|
|
748
|
+
create: "Create",
|
|
559
749
|
decline: "Decline",
|
|
560
750
|
delete: "Delete",
|
|
561
751
|
discard: "Discard",
|
|
@@ -598,6 +788,7 @@ var formTranslation = {
|
|
|
598
788
|
yes: "Yes"
|
|
599
789
|
},
|
|
600
790
|
de: {
|
|
791
|
+
add: "Hinzuf\xFCgen",
|
|
601
792
|
all: "Alle",
|
|
602
793
|
apply: "Anwenden",
|
|
603
794
|
back: "Zur\xFCck",
|
|
@@ -610,6 +801,7 @@ var formTranslation = {
|
|
|
610
801
|
confirm: "Best\xE4tigen",
|
|
611
802
|
copy: "Kopieren",
|
|
612
803
|
copied: "Kopiert",
|
|
804
|
+
create: "Erstellen",
|
|
613
805
|
decline: "Ablehnen",
|
|
614
806
|
delete: "L\xF6schen",
|
|
615
807
|
discard: "Verwerfen",
|
|
@@ -653,241 +845,346 @@ var formTranslation = {
|
|
|
653
845
|
}
|
|
654
846
|
};
|
|
655
847
|
|
|
656
|
-
// src/components/
|
|
657
|
-
import {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
}
|
|
848
|
+
// src/components/user-action/Button.tsx
|
|
849
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
850
|
+
import clsx6 from "clsx";
|
|
851
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
852
|
+
var ButtonColorUtil = {
|
|
853
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
854
|
+
text: ["primary", "negative", "neutral"],
|
|
855
|
+
outline: ["primary"]
|
|
665
856
|
};
|
|
666
|
-
var
|
|
667
|
-
|
|
668
|
-
list,
|
|
669
|
-
initialSearch = "",
|
|
670
|
-
searchMapping,
|
|
671
|
-
autoFocus,
|
|
672
|
-
minimumItemsForSearch = 6,
|
|
673
|
-
itemMapper,
|
|
674
|
-
className,
|
|
675
|
-
resultListClassName
|
|
676
|
-
}) => {
|
|
677
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
678
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
679
|
-
return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
|
|
680
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
681
|
-
/* @__PURE__ */ jsx5(
|
|
682
|
-
Input,
|
|
683
|
-
{
|
|
684
|
-
value: search,
|
|
685
|
-
onChangeText: setSearch,
|
|
686
|
-
placeholder: translation("search"),
|
|
687
|
-
autoFocus,
|
|
688
|
-
className: "w-full"
|
|
689
|
-
}
|
|
690
|
-
),
|
|
691
|
-
/* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
|
|
692
|
-
] }),
|
|
693
|
-
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") })
|
|
694
|
-
] });
|
|
857
|
+
var IconButtonUtil = {
|
|
858
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
695
859
|
};
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
var
|
|
702
|
-
|
|
703
|
-
|
|
860
|
+
var paddingMapping = {
|
|
861
|
+
small: "btn-sm",
|
|
862
|
+
medium: "btn-md",
|
|
863
|
+
large: "btn-lg"
|
|
864
|
+
};
|
|
865
|
+
var iconPaddingMapping = {
|
|
866
|
+
tiny: "icon-btn-xs",
|
|
867
|
+
small: "icon-btn-sm",
|
|
868
|
+
medium: "icon-btn-md",
|
|
869
|
+
large: "icon-btn-lg"
|
|
870
|
+
};
|
|
871
|
+
var ButtonUtil = {
|
|
872
|
+
paddingMapping,
|
|
873
|
+
iconPaddingMapping
|
|
874
|
+
};
|
|
875
|
+
var SolidButton = forwardRef3(function SolidButton2({
|
|
876
|
+
children,
|
|
877
|
+
disabled = false,
|
|
878
|
+
color = "primary",
|
|
879
|
+
size = "medium",
|
|
880
|
+
startIcon,
|
|
881
|
+
endIcon,
|
|
704
882
|
onClick,
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
"
|
|
883
|
+
className,
|
|
884
|
+
...restProps
|
|
885
|
+
}, ref) {
|
|
886
|
+
const colorClasses = {
|
|
887
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
888
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
889
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
890
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
891
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
892
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
893
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
894
|
+
}[color];
|
|
895
|
+
const iconColorClasses = {
|
|
896
|
+
primary: "text-button-solid-primary-icon",
|
|
897
|
+
secondary: "text-button-solid-secondary-icon",
|
|
898
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
899
|
+
positive: "text-button-solid-positive-icon",
|
|
900
|
+
warning: "text-button-solid-warning-icon",
|
|
901
|
+
negative: "text-button-solid-negative-icon",
|
|
902
|
+
neutral: "text-button-solid-neutral-icon"
|
|
903
|
+
}[color];
|
|
904
|
+
return /* @__PURE__ */ jsxs5(
|
|
905
|
+
"button",
|
|
716
906
|
{
|
|
717
|
-
|
|
718
|
-
|
|
907
|
+
ref,
|
|
908
|
+
onClick,
|
|
909
|
+
disabled,
|
|
910
|
+
className: clsx6(
|
|
719
911
|
{
|
|
720
|
-
|
|
721
|
-
[
|
|
722
|
-
[disabledClassName]: isDisabled
|
|
912
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
913
|
+
[clsx6(colorClasses, "hover:brightness-90")]: !disabled
|
|
723
914
|
},
|
|
915
|
+
ButtonUtil.paddingMapping[size],
|
|
724
916
|
className
|
|
725
917
|
),
|
|
726
|
-
|
|
918
|
+
...restProps,
|
|
727
919
|
children: [
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
920
|
+
startIcon && /* @__PURE__ */ jsx7(
|
|
921
|
+
"span",
|
|
922
|
+
{
|
|
923
|
+
className: clsx6({
|
|
924
|
+
[iconColorClasses]: !disabled,
|
|
925
|
+
[`text-disabled-icon`]: disabled
|
|
926
|
+
}),
|
|
927
|
+
children: startIcon
|
|
928
|
+
}
|
|
929
|
+
),
|
|
930
|
+
children,
|
|
931
|
+
endIcon && /* @__PURE__ */ jsx7(
|
|
932
|
+
"span",
|
|
933
|
+
{
|
|
934
|
+
className: clsx6({
|
|
935
|
+
[iconColorClasses]: !disabled,
|
|
936
|
+
[`text-disabled-icon`]: disabled
|
|
937
|
+
}),
|
|
938
|
+
children: endIcon
|
|
939
|
+
}
|
|
940
|
+
)
|
|
734
941
|
]
|
|
735
942
|
}
|
|
736
943
|
);
|
|
944
|
+
});
|
|
945
|
+
var IconButton = ({
|
|
946
|
+
children,
|
|
947
|
+
disabled = false,
|
|
948
|
+
color = "primary",
|
|
949
|
+
size = "medium",
|
|
950
|
+
className,
|
|
951
|
+
...restProps
|
|
952
|
+
}) => {
|
|
953
|
+
const colorClasses = {
|
|
954
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
955
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
956
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
957
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
958
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
959
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
960
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
961
|
+
transparent: "bg-transparent"
|
|
962
|
+
}[color];
|
|
963
|
+
return /* @__PURE__ */ jsx7(
|
|
964
|
+
"button",
|
|
965
|
+
{
|
|
966
|
+
disabled,
|
|
967
|
+
className: clsx6(
|
|
968
|
+
{
|
|
969
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
970
|
+
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
971
|
+
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
972
|
+
[clsx6(colorClasses, "hover:brightness-90")]: !disabled
|
|
973
|
+
},
|
|
974
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
975
|
+
className
|
|
976
|
+
),
|
|
977
|
+
...restProps,
|
|
978
|
+
children
|
|
979
|
+
}
|
|
980
|
+
);
|
|
737
981
|
};
|
|
738
982
|
|
|
739
|
-
// src/
|
|
740
|
-
import {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
983
|
+
// src/components/user-action/SearchBar.tsx
|
|
984
|
+
import { Search } from "lucide-react";
|
|
985
|
+
import { clsx as clsx7 } from "clsx";
|
|
986
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
987
|
+
var SearchBar = ({
|
|
988
|
+
placeholder,
|
|
989
|
+
onSearch,
|
|
990
|
+
disableOnSearch,
|
|
991
|
+
containerClassName,
|
|
992
|
+
...inputProps
|
|
993
|
+
}) => {
|
|
994
|
+
const translation = useTranslation([formTranslation]);
|
|
995
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
996
|
+
/* @__PURE__ */ jsx8(
|
|
997
|
+
Input,
|
|
998
|
+
{
|
|
999
|
+
...inputProps,
|
|
1000
|
+
placeholder: placeholder ?? translation("search")
|
|
747
1001
|
}
|
|
748
|
-
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
1002
|
+
),
|
|
1003
|
+
onSearch && /* @__PURE__ */ jsx8(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx8(Search, { className: "w-full h-full" }) })
|
|
1004
|
+
] });
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
// src/hooks/useSearch.ts
|
|
1008
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
|
|
1009
|
+
|
|
1010
|
+
// src/util/simpleSearch.ts
|
|
1011
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
1012
|
+
return objects.filter((object) => {
|
|
1013
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
1014
|
+
if (!mappedSearchKeywords) {
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
// src/hooks/useSearch.ts
|
|
1022
|
+
var useSearch = ({
|
|
1023
|
+
list,
|
|
1024
|
+
initialSearch,
|
|
1025
|
+
searchMapping,
|
|
1026
|
+
additionalSearchTags,
|
|
1027
|
+
isSearchInstant = true,
|
|
1028
|
+
sortingFunction,
|
|
1029
|
+
filter,
|
|
1030
|
+
disabled = false
|
|
1031
|
+
}) => {
|
|
1032
|
+
const [search, setSearch] = useState8(initialSearch ?? "");
|
|
1033
|
+
const [result, setResult] = useState8(list);
|
|
1034
|
+
const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1035
|
+
const updateSearch = useCallback4((newSearch) => {
|
|
1036
|
+
const usedSearch = newSearch ?? search;
|
|
1037
|
+
if (newSearch) {
|
|
1038
|
+
setSearch(search);
|
|
1039
|
+
}
|
|
1040
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1041
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1042
|
+
useEffect10(() => {
|
|
1043
|
+
if (isSearchInstant) {
|
|
1044
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1045
|
+
}
|
|
1046
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1047
|
+
const filteredResult = useMemo(() => {
|
|
1048
|
+
if (!filter) {
|
|
1049
|
+
return result;
|
|
1050
|
+
}
|
|
1051
|
+
return result.filter(filter);
|
|
1052
|
+
}, [result, filter]);
|
|
1053
|
+
const sortedAndFilteredResult = useMemo(() => {
|
|
1054
|
+
if (!sortingFunction) {
|
|
1055
|
+
return filteredResult;
|
|
1056
|
+
}
|
|
1057
|
+
return filteredResult.sort(sortingFunction);
|
|
1058
|
+
}, [filteredResult, sortingFunction]);
|
|
1059
|
+
const usedResult = useMemo(() => {
|
|
1060
|
+
if (!disabled) {
|
|
1061
|
+
return sortedAndFilteredResult;
|
|
1062
|
+
}
|
|
1063
|
+
return list;
|
|
1064
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
1065
|
+
return {
|
|
1066
|
+
result: usedResult,
|
|
1067
|
+
hasResult: usedResult.length > 0,
|
|
1068
|
+
allItems: list,
|
|
1069
|
+
updateSearch,
|
|
1070
|
+
search,
|
|
1071
|
+
setSearch
|
|
1072
|
+
};
|
|
757
1073
|
};
|
|
758
1074
|
|
|
759
1075
|
// src/components/user-action/Select.tsx
|
|
760
|
-
import { jsx as
|
|
1076
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1077
|
+
var SelectTile = ({
|
|
1078
|
+
className,
|
|
1079
|
+
disabledClassName,
|
|
1080
|
+
title,
|
|
1081
|
+
...restProps
|
|
1082
|
+
}) => {
|
|
1083
|
+
return /* @__PURE__ */ jsx9(
|
|
1084
|
+
Tile,
|
|
1085
|
+
{
|
|
1086
|
+
...restProps,
|
|
1087
|
+
className: clsx8("px-2 py-1 rounded-md", className),
|
|
1088
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1089
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
1090
|
+
}
|
|
1091
|
+
);
|
|
1092
|
+
};
|
|
761
1093
|
var Select = ({
|
|
762
1094
|
value,
|
|
763
1095
|
label,
|
|
764
1096
|
options,
|
|
765
1097
|
onChange,
|
|
766
1098
|
hintText = "",
|
|
767
|
-
|
|
768
|
-
|
|
1099
|
+
selectedDisplayOverwrite,
|
|
1100
|
+
searchOptions,
|
|
1101
|
+
additionalItems,
|
|
769
1102
|
className,
|
|
770
|
-
|
|
1103
|
+
triggerClassName,
|
|
1104
|
+
hintTextClassName,
|
|
1105
|
+
...menuProps
|
|
771
1106
|
}) => {
|
|
772
|
-
const triggerRef = useRef2(null);
|
|
773
|
-
const menuRef = useRef2(null);
|
|
774
|
-
const [isOpen, setIsOpen] = useState6(false);
|
|
775
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
776
1107
|
const selectedOption = options.find((option) => option.value === value);
|
|
777
1108
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
778
1109
|
console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
|
|
779
1110
|
}
|
|
780
1111
|
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
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
|
-
|
|
817
|
-
|
|
1112
|
+
const { result, search, setSearch } = useSearch({
|
|
1113
|
+
list: options,
|
|
1114
|
+
searchMapping: useCallback5((item) => item.searchTags, []),
|
|
1115
|
+
...searchOptions
|
|
1116
|
+
});
|
|
1117
|
+
return /* @__PURE__ */ jsxs7("div", { className: clsx8(className), children: [
|
|
1118
|
+
label && /* @__PURE__ */ jsx9(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx8("mb-1", label.className) }),
|
|
1119
|
+
/* @__PURE__ */ jsx9(
|
|
1120
|
+
Menu,
|
|
1121
|
+
{
|
|
1122
|
+
...menuProps,
|
|
1123
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsxs7(
|
|
1124
|
+
"button",
|
|
1125
|
+
{
|
|
1126
|
+
ref,
|
|
1127
|
+
className: clsx8(
|
|
1128
|
+
"btn-md justify-between w-full border-2",
|
|
1129
|
+
{
|
|
1130
|
+
"rounded-b-lg": !open,
|
|
1131
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1132
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1133
|
+
},
|
|
1134
|
+
triggerClassName
|
|
1135
|
+
),
|
|
1136
|
+
onClick: toggleOpen,
|
|
1137
|
+
disabled,
|
|
1138
|
+
children: [
|
|
1139
|
+
!isShowingHint && /* @__PURE__ */ jsx9("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
1140
|
+
isShowingHint && /* @__PURE__ */ jsx9("span", { className: clsx8("textstyle-description", hintTextClassName), children: hintText }),
|
|
1141
|
+
/* @__PURE__ */ jsx9(ExpansionIcon, { isExpanded: isOpen })
|
|
1142
|
+
]
|
|
1143
|
+
}
|
|
1144
|
+
),
|
|
1145
|
+
menuClassName: clsx8("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1146
|
+
children: (bag) => {
|
|
1147
|
+
const { close } = bag;
|
|
1148
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1149
|
+
!searchOptions?.disabled && /* @__PURE__ */ jsx9(
|
|
1150
|
+
SearchBar,
|
|
1151
|
+
{
|
|
1152
|
+
value: search,
|
|
1153
|
+
onChangeText: setSearch,
|
|
1154
|
+
autoFocus: true
|
|
1155
|
+
}
|
|
1156
|
+
),
|
|
1157
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1158
|
+
result.map((option, index) => /* @__PURE__ */ jsx9(
|
|
1159
|
+
SelectTile,
|
|
818
1160
|
{
|
|
819
|
-
isSelected:
|
|
820
|
-
|
|
821
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
822
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1161
|
+
isSelected: option === selectedOption,
|
|
1162
|
+
title: { value: option.label },
|
|
823
1163
|
onClick: () => {
|
|
824
1164
|
onChange(option.value);
|
|
825
|
-
|
|
1165
|
+
close();
|
|
826
1166
|
},
|
|
827
|
-
|
|
1167
|
+
disabled: option.disabled
|
|
828
1168
|
},
|
|
829
1169
|
index
|
|
830
|
-
)
|
|
831
|
-
|
|
832
|
-
|
|
1170
|
+
)),
|
|
1171
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1172
|
+
] })
|
|
1173
|
+
] });
|
|
833
1174
|
}
|
|
834
|
-
|
|
835
|
-
|
|
1175
|
+
}
|
|
1176
|
+
)
|
|
836
1177
|
] });
|
|
837
1178
|
};
|
|
838
1179
|
|
|
839
1180
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
840
|
-
import { useEffect as
|
|
1181
|
+
import { useEffect as useEffect12, useRef as useRef3, useState as useState10 } from "react";
|
|
841
1182
|
import ReactDOM from "react-dom";
|
|
842
|
-
import
|
|
843
|
-
|
|
844
|
-
// src/hooks/useHoverState.ts
|
|
845
|
-
import { useEffect as useEffect9, useState as useState7 } from "react";
|
|
846
|
-
var defaultUseHoverStateProps = {
|
|
847
|
-
closingDelay: 200,
|
|
848
|
-
isDisabled: false
|
|
849
|
-
};
|
|
850
|
-
var useHoverState = (props = void 0) => {
|
|
851
|
-
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
852
|
-
const [isHovered, setIsHovered] = useState7(false);
|
|
853
|
-
const [timer, setTimer] = useState7();
|
|
854
|
-
const onMouseEnter = () => {
|
|
855
|
-
if (isDisabled) {
|
|
856
|
-
return;
|
|
857
|
-
}
|
|
858
|
-
clearTimeout(timer);
|
|
859
|
-
setIsHovered(true);
|
|
860
|
-
};
|
|
861
|
-
const onMouseLeave = () => {
|
|
862
|
-
if (isDisabled) {
|
|
863
|
-
return;
|
|
864
|
-
}
|
|
865
|
-
setTimer(setTimeout(() => {
|
|
866
|
-
setIsHovered(false);
|
|
867
|
-
}, closingDelay));
|
|
868
|
-
};
|
|
869
|
-
useEffect9(() => {
|
|
870
|
-
if (timer) {
|
|
871
|
-
return () => {
|
|
872
|
-
clearTimeout(timer);
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
});
|
|
876
|
-
useEffect9(() => {
|
|
877
|
-
if (timer) {
|
|
878
|
-
clearTimeout(timer);
|
|
879
|
-
}
|
|
880
|
-
}, [isDisabled]);
|
|
881
|
-
return {
|
|
882
|
-
isHovered,
|
|
883
|
-
setIsHovered,
|
|
884
|
-
handlers: { onMouseEnter, onMouseLeave }
|
|
885
|
-
};
|
|
886
|
-
};
|
|
1183
|
+
import clsx10 from "clsx";
|
|
887
1184
|
|
|
888
1185
|
// src/components/user-action/Tooltip.tsx
|
|
889
|
-
import { clsx as
|
|
890
|
-
import { jsx as
|
|
1186
|
+
import { clsx as clsx9 } from "clsx";
|
|
1187
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
891
1188
|
var Tooltip = ({
|
|
892
1189
|
tooltip,
|
|
893
1190
|
children,
|
|
@@ -917,17 +1214,17 @@ var Tooltip = ({
|
|
|
917
1214
|
left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
|
|
918
1215
|
right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
|
|
919
1216
|
};
|
|
920
|
-
return /* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ jsxs8(
|
|
921
1218
|
"div",
|
|
922
1219
|
{
|
|
923
|
-
className:
|
|
1220
|
+
className: clsx9("relative inline-block", containerClassName),
|
|
924
1221
|
...handlers,
|
|
925
1222
|
children: [
|
|
926
1223
|
children,
|
|
927
|
-
isHovered && /* @__PURE__ */
|
|
1224
|
+
isHovered && /* @__PURE__ */ jsxs8(
|
|
928
1225
|
"div",
|
|
929
1226
|
{
|
|
930
|
-
className:
|
|
1227
|
+
className: clsx9(
|
|
931
1228
|
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
932
1229
|
animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
|
|
933
1230
|
positionClasses[position],
|
|
@@ -936,10 +1233,10 @@ var Tooltip = ({
|
|
|
936
1233
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
937
1234
|
children: [
|
|
938
1235
|
tooltip,
|
|
939
|
-
/* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ jsx10(
|
|
940
1237
|
"div",
|
|
941
1238
|
{
|
|
942
|
-
className:
|
|
1239
|
+
className: clsx9(`absolute w-0 h-0`, triangleClasses[position]),
|
|
943
1240
|
style: { ...triangleStyle[position], zIndex: zIndex + 1 }
|
|
944
1241
|
}
|
|
945
1242
|
)
|
|
@@ -953,24 +1250,24 @@ var Tooltip = ({
|
|
|
953
1250
|
|
|
954
1251
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
955
1252
|
import { X } from "lucide-react";
|
|
956
|
-
import { jsx as
|
|
1253
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
957
1254
|
var Overlay = ({
|
|
958
1255
|
children,
|
|
959
1256
|
isOpen,
|
|
960
1257
|
onBackgroundClick,
|
|
961
1258
|
backgroundClassName
|
|
962
1259
|
}) => {
|
|
963
|
-
const [root, setRoot] =
|
|
964
|
-
|
|
1260
|
+
const [root, setRoot] = useState10();
|
|
1261
|
+
useEffect12(() => {
|
|
965
1262
|
setRoot(document.body);
|
|
966
1263
|
}, []);
|
|
967
1264
|
if (!root || !isOpen) return null;
|
|
968
1265
|
return ReactDOM.createPortal(
|
|
969
|
-
/* @__PURE__ */
|
|
970
|
-
/* @__PURE__ */
|
|
1266
|
+
/* @__PURE__ */ jsxs9("div", { className: clsx10("fixed inset-0 z-[9999]"), children: [
|
|
1267
|
+
/* @__PURE__ */ jsx11(
|
|
971
1268
|
"div",
|
|
972
1269
|
{
|
|
973
|
-
className:
|
|
1270
|
+
className: clsx10("fixed inset-0 h-screen w-screen bg-overlay-shadow", backgroundClassName),
|
|
974
1271
|
onClick: onBackgroundClick
|
|
975
1272
|
}
|
|
976
1273
|
),
|
|
@@ -998,21 +1295,21 @@ var OverlayHeader = ({
|
|
|
998
1295
|
}) => {
|
|
999
1296
|
const translation = useTranslation([defaultModalHeaderTranslation], overwriteTranslation);
|
|
1000
1297
|
const hasTitleRow = !!title || !!titleText || !!onClose;
|
|
1001
|
-
const titleRow = /* @__PURE__ */
|
|
1002
|
-
title ?? /* @__PURE__ */
|
|
1298
|
+
const titleRow = /* @__PURE__ */ jsxs9("div", { className: "flex-row-8 justify-between items-start", children: [
|
|
1299
|
+
title ?? /* @__PURE__ */ jsx11(
|
|
1003
1300
|
"h2",
|
|
1004
1301
|
{
|
|
1005
|
-
className:
|
|
1302
|
+
className: clsx10("textstyle-title-lg", {
|
|
1006
1303
|
"mb-1": description || descriptionText
|
|
1007
1304
|
}),
|
|
1008
1305
|
children: titleText
|
|
1009
1306
|
}
|
|
1010
1307
|
),
|
|
1011
|
-
!!onClose && /* @__PURE__ */
|
|
1308
|
+
!!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" }) }) })
|
|
1012
1309
|
] });
|
|
1013
|
-
return /* @__PURE__ */
|
|
1310
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex-col-2", children: [
|
|
1014
1311
|
hasTitleRow && titleRow,
|
|
1015
|
-
description ?? (descriptionText && /* @__PURE__ */
|
|
1312
|
+
description ?? (descriptionText && /* @__PURE__ */ jsx11("span", { className: "textstyle-description", children: descriptionText }))
|
|
1016
1313
|
] });
|
|
1017
1314
|
};
|
|
1018
1315
|
var Modal = ({
|
|
@@ -1024,7 +1321,7 @@ var Modal = ({
|
|
|
1024
1321
|
headerProps
|
|
1025
1322
|
}) => {
|
|
1026
1323
|
const ref = useRef3(null);
|
|
1027
|
-
|
|
1324
|
+
useEffect12(() => {
|
|
1028
1325
|
if (!isOpen) return;
|
|
1029
1326
|
const modal = ref.current;
|
|
1030
1327
|
if (!modal) {
|
|
@@ -1061,25 +1358,25 @@ var Modal = ({
|
|
|
1061
1358
|
overlayStack = overlayStack.filter((m) => m !== modal);
|
|
1062
1359
|
};
|
|
1063
1360
|
}, [isOpen, onClose]);
|
|
1064
|
-
return /* @__PURE__ */
|
|
1361
|
+
return /* @__PURE__ */ jsx11(
|
|
1065
1362
|
Overlay,
|
|
1066
1363
|
{
|
|
1067
1364
|
isOpen,
|
|
1068
1365
|
onBackgroundClick: onClose,
|
|
1069
1366
|
backgroundClassName,
|
|
1070
|
-
children: /* @__PURE__ */
|
|
1367
|
+
children: /* @__PURE__ */ jsxs9(
|
|
1071
1368
|
"div",
|
|
1072
1369
|
{
|
|
1073
1370
|
ref,
|
|
1074
1371
|
tabIndex: -1,
|
|
1075
|
-
className:
|
|
1076
|
-
"fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2
|
|
1372
|
+
className: clsx10(
|
|
1373
|
+
"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",
|
|
1077
1374
|
className
|
|
1078
1375
|
),
|
|
1079
1376
|
role: "dialog",
|
|
1080
1377
|
"aria-modal": true,
|
|
1081
1378
|
children: [
|
|
1082
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ jsx11(OverlayHeader, { ...headerProps, onClose }),
|
|
1083
1380
|
children
|
|
1084
1381
|
]
|
|
1085
1382
|
}
|
|
@@ -1089,7 +1386,7 @@ var Modal = ({
|
|
|
1089
1386
|
};
|
|
1090
1387
|
|
|
1091
1388
|
// src/components/modals/LanguageModal.tsx
|
|
1092
|
-
import { jsx as
|
|
1389
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1093
1390
|
var defaultLanguageModalTranslation = {
|
|
1094
1391
|
en: {
|
|
1095
1392
|
language: "Language",
|
|
@@ -1112,7 +1409,7 @@ var LanguageModal = ({
|
|
|
1112
1409
|
}) => {
|
|
1113
1410
|
const { language, setLanguage } = useLanguage();
|
|
1114
1411
|
const translation = useTranslation([defaultLanguageModalTranslation], overwriteTranslation);
|
|
1115
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ jsx12(
|
|
1116
1413
|
Modal,
|
|
1117
1414
|
{
|
|
1118
1415
|
headerProps: {
|
|
@@ -1122,8 +1419,8 @@ var LanguageModal = ({
|
|
|
1122
1419
|
},
|
|
1123
1420
|
onClose,
|
|
1124
1421
|
...modalProps,
|
|
1125
|
-
children: /* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */
|
|
1422
|
+
children: /* @__PURE__ */ jsxs10("div", { className: "w-64", children: [
|
|
1423
|
+
/* @__PURE__ */ jsx12(
|
|
1127
1424
|
Select,
|
|
1128
1425
|
{
|
|
1129
1426
|
className: "mt-2",
|
|
@@ -1132,7 +1429,7 @@ var LanguageModal = ({
|
|
|
1132
1429
|
onChange: (language2) => setLanguage(language2)
|
|
1133
1430
|
}
|
|
1134
1431
|
),
|
|
1135
|
-
/* @__PURE__ */
|
|
1432
|
+
/* @__PURE__ */ jsx12("div", { className: "flex-row-4 mt-3 justify-end", children: /* @__PURE__ */ jsx12(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation("done") }) })
|
|
1136
1433
|
] })
|
|
1137
1434
|
}
|
|
1138
1435
|
);
|