@helpwave/hightide 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/branding/HelpwaveBadge.js +7 -7
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +7 -7
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +65 -38
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +54 -27
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js +3 -3
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +3 -3
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +4 -4
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +4 -4
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +46 -19
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +44 -17
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +32 -28
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.js +2 -2
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Ring.js +2 -2
- package/dist/components/icons-and-geometry/Ring.js.map +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs +2 -2
- package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +84 -15
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.js +1 -1
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +7 -1
- package/dist/components/layout-and-navigation/Expandable.d.ts +7 -1
- package/dist/components/layout-and-navigation/Expandable.js +36 -9
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +36 -10
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +34 -11
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +36 -13
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +92 -19
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +82 -9
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +79 -6
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +127 -25
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +126 -24
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +22 -16
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +7 -3
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
- package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
- package/dist/components/layout-and-navigation/Tile.js +7 -7
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +7 -7
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +5 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +8 -6
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +8 -6
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +32 -28
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +18 -14
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +28 -24
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +18 -14
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +32 -28
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +18 -14
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +728 -434
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +728 -430
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +732 -438
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +731 -433
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +110 -35
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +110 -35
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +118 -41
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +114 -37
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
- package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
- package/dist/components/properties/MultiSelectProperty.js +915 -463
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +920 -464
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +101 -18
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +101 -18
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +103 -20
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +99 -16
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +9 -2
- package/dist/components/properties/SelectProperty.d.ts +9 -2
- package/dist/components/properties/SelectProperty.js +682 -243
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +686 -243
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +133 -46
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +133 -46
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +285 -185
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +270 -166
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +179 -78
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +160 -55
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +72 -3
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +72 -3
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +15 -2
- package/dist/components/user-action/Button.d.ts +15 -2
- package/dist/components/user-action/Button.js +12 -12
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +12 -12
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +6 -15
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +6 -15
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +79 -48
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +65 -34
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +11 -6
- package/dist/components/user-action/Menu.d.ts +11 -6
- package/dist/components/user-action/Menu.js +128 -31
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +134 -33
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +17 -7
- package/dist/components/user-action/MultiSelect.d.ts +17 -7
- package/dist/components/user-action/MultiSelect.js +796 -375
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +781 -356
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +2 -2
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +2 -2
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.d.mts +14 -0
- package/dist/components/user-action/SearchBar.d.ts +14 -0
- package/dist/components/user-action/SearchBar.js +673 -0
- package/dist/components/user-action/SearchBar.js.map +1 -0
- package/dist/components/user-action/SearchBar.mjs +637 -0
- package/dist/components/user-action/SearchBar.mjs.map +1 -0
- package/dist/components/user-action/Select.d.mts +18 -5
- package/dist/components/user-action/Select.d.ts +18 -5
- package/dist/components/user-action/Select.js +764 -355
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +761 -349
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +1 -1
- package/dist/components/user-action/Textarea.d.ts +1 -1
- package/dist/components/user-action/Textarea.js +13 -3
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +13 -3
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.js +2 -2
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +2 -2
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +251 -113
- package/dist/css/uncompiled/globals.css +19 -13
- package/dist/css/uncompiled/theme/colors-component.css +12 -3
- package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
- package/dist/css/uncompiled/utitlity/animation.css +70 -1
- package/dist/css/uncompiled/utitlity/general.css +16 -0
- package/dist/hooks/usePopoverPosition.d.mts +15 -0
- package/dist/hooks/usePopoverPosition.d.ts +15 -0
- package/dist/hooks/usePopoverPosition.js +81 -0
- package/dist/hooks/usePopoverPosition.js.map +1 -0
- package/dist/hooks/usePopoverPosition.mjs +57 -0
- package/dist/hooks/usePopoverPosition.mjs.map +1 -0
- package/dist/hooks/useSearch.d.mts +7 -2
- package/dist/hooks/useSearch.d.ts +7 -2
- package/dist/hooks/useSearch.js +44 -15
- package/dist/hooks/useSearch.js.map +1 -1
- package/dist/hooks/useSearch.mjs +45 -16
- package/dist/hooks/useSearch.mjs.map +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1102 -819
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1001 -718
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +2 -0
- package/dist/localization/defaults/form.d.ts +2 -0
- package/dist/localization/defaults/form.js +4 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +4 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/simpleSearch.d.mts +1 -1
- package/dist/util/simpleSearch.d.ts +1 -1
- package/dist/util/simpleSearch.js +4 -1
- package/dist/util/simpleSearch.js.map +1 -1
- package/dist/util/simpleSearch.mjs +4 -1
- package/dist/util/simpleSearch.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -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,12 +508,12 @@ 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);
|
|
@@ -156,13 +522,10 @@ function useDelay(options) {
|
|
|
156
522
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
157
523
|
}
|
|
158
524
|
|
|
159
|
-
// src/util/noop.ts
|
|
160
|
-
var noop = () => void 0;
|
|
161
|
-
|
|
162
525
|
// src/hooks/useFocusManagement.ts
|
|
163
|
-
import { useCallback as
|
|
526
|
+
import { useCallback as useCallback3 } from "react";
|
|
164
527
|
function useFocusManagement() {
|
|
165
|
-
const getFocusableElements =
|
|
528
|
+
const getFocusableElements = useCallback3(() => {
|
|
166
529
|
return Array.from(
|
|
167
530
|
document.querySelectorAll(
|
|
168
531
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -171,7 +534,7 @@ function useFocusManagement() {
|
|
|
171
534
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
172
535
|
);
|
|
173
536
|
}, []);
|
|
174
|
-
const getNextFocusElement =
|
|
537
|
+
const getNextFocusElement = useCallback3(() => {
|
|
175
538
|
const elements = getFocusableElements();
|
|
176
539
|
if (elements.length === 0) {
|
|
177
540
|
return void 0;
|
|
@@ -183,11 +546,11 @@ function useFocusManagement() {
|
|
|
183
546
|
}
|
|
184
547
|
return nextElement;
|
|
185
548
|
}, [getFocusableElements]);
|
|
186
|
-
const focusNext =
|
|
549
|
+
const focusNext = useCallback3(() => {
|
|
187
550
|
const nextElement = getNextFocusElement();
|
|
188
551
|
nextElement?.focus();
|
|
189
552
|
}, [getNextFocusElement]);
|
|
190
|
-
const getPreviousFocusElement =
|
|
553
|
+
const getPreviousFocusElement = useCallback3(() => {
|
|
191
554
|
const elements = getFocusableElements();
|
|
192
555
|
if (elements.length === 0) {
|
|
193
556
|
return void 0;
|
|
@@ -203,7 +566,7 @@ function useFocusManagement() {
|
|
|
203
566
|
}
|
|
204
567
|
return previousElement;
|
|
205
568
|
}, [getFocusableElements]);
|
|
206
|
-
const focusPrevious =
|
|
569
|
+
const focusPrevious = useCallback3(() => {
|
|
207
570
|
const previousElement = getPreviousFocusElement();
|
|
208
571
|
if (previousElement) previousElement.focus();
|
|
209
572
|
}, [getPreviousFocusElement]);
|
|
@@ -217,10 +580,10 @@ function useFocusManagement() {
|
|
|
217
580
|
}
|
|
218
581
|
|
|
219
582
|
// src/hooks/useFocusOnceVisible.ts
|
|
220
|
-
import React, { useEffect as
|
|
583
|
+
import React, { useEffect as useEffect8 } from "react";
|
|
221
584
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
222
585
|
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
223
|
-
|
|
586
|
+
useEffect8(() => {
|
|
224
587
|
if (disable || hasUsedFocus) {
|
|
225
588
|
return;
|
|
226
589
|
}
|
|
@@ -240,9 +603,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
240
603
|
};
|
|
241
604
|
|
|
242
605
|
// src/components/user-action/Input.tsx
|
|
243
|
-
import { jsx as
|
|
606
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
244
607
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
245
|
-
return
|
|
608
|
+
return clsx5(
|
|
246
609
|
"px-2 py-1.5 rounded-md border-2",
|
|
247
610
|
{
|
|
248
611
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -256,7 +619,7 @@ var defaultEditCompleteOptions = {
|
|
|
256
619
|
afterDelay: true,
|
|
257
620
|
delay: 2500
|
|
258
621
|
};
|
|
259
|
-
var Input =
|
|
622
|
+
var Input = forwardRef2(function Input2({
|
|
260
623
|
id,
|
|
261
624
|
type = "text",
|
|
262
625
|
value,
|
|
@@ -279,7 +642,7 @@ var Input = forwardRef(function Input2({
|
|
|
279
642
|
restartTimer,
|
|
280
643
|
clearTimer
|
|
281
644
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
282
|
-
const innerRef =
|
|
645
|
+
const innerRef = useRef2(null);
|
|
283
646
|
const { focusNext } = useFocusManagement();
|
|
284
647
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
285
648
|
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
@@ -290,9 +653,9 @@ var Input = forwardRef(function Input2({
|
|
|
290
653
|
focusNext();
|
|
291
654
|
}
|
|
292
655
|
};
|
|
293
|
-
return /* @__PURE__ */
|
|
294
|
-
label && /* @__PURE__ */
|
|
295
|
-
/* @__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(
|
|
296
659
|
"input",
|
|
297
660
|
{
|
|
298
661
|
...restProps,
|
|
@@ -301,7 +664,7 @@ var Input = forwardRef(function Input2({
|
|
|
301
664
|
id,
|
|
302
665
|
type,
|
|
303
666
|
disabled,
|
|
304
|
-
className:
|
|
667
|
+
className: clsx5(getInputClassName({ disabled }), className),
|
|
305
668
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
306
669
|
onBlur: (event) => {
|
|
307
670
|
onBlur?.(event);
|
|
@@ -331,7 +694,7 @@ var Input = forwardRef(function Input2({
|
|
|
331
694
|
)
|
|
332
695
|
] });
|
|
333
696
|
});
|
|
334
|
-
var FormInput =
|
|
697
|
+
var FormInput = forwardRef2(function FormInput2({
|
|
335
698
|
id,
|
|
336
699
|
labelText,
|
|
337
700
|
errorText,
|
|
@@ -343,206 +706,33 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
343
706
|
disabled,
|
|
344
707
|
...restProps
|
|
345
708
|
}, ref) {
|
|
346
|
-
const input = /* @__PURE__ */
|
|
709
|
+
const input = /* @__PURE__ */ jsx6(
|
|
347
710
|
"input",
|
|
348
711
|
{
|
|
349
712
|
...restProps,
|
|
350
713
|
ref,
|
|
351
714
|
id,
|
|
352
715
|
disabled,
|
|
353
|
-
className:
|
|
716
|
+
className: clsx5(
|
|
354
717
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
355
718
|
className
|
|
356
719
|
)
|
|
357
720
|
}
|
|
358
721
|
);
|
|
359
|
-
return /* @__PURE__ */
|
|
360
|
-
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: [
|
|
361
724
|
labelText,
|
|
362
|
-
required && /* @__PURE__ */
|
|
725
|
+
required && /* @__PURE__ */ jsx6("span", { className: "text-primary font-bold", children: "*" })
|
|
363
726
|
] }),
|
|
364
727
|
input,
|
|
365
|
-
errorText && /* @__PURE__ */
|
|
728
|
+
errorText && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: clsx5("text-negative", errorClassName), children: errorText })
|
|
366
729
|
] });
|
|
367
730
|
});
|
|
368
731
|
|
|
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
732
|
// src/localization/defaults/form.ts
|
|
544
733
|
var formTranslation = {
|
|
545
734
|
en: {
|
|
735
|
+
add: "Add",
|
|
546
736
|
all: "All",
|
|
547
737
|
apply: "Apply",
|
|
548
738
|
back: "Back",
|
|
@@ -555,6 +745,7 @@ var formTranslation = {
|
|
|
555
745
|
confirm: "Confirm",
|
|
556
746
|
copy: "Copy",
|
|
557
747
|
copied: "Copied",
|
|
748
|
+
create: "Create",
|
|
558
749
|
decline: "Decline",
|
|
559
750
|
delete: "Delete",
|
|
560
751
|
discard: "Discard",
|
|
@@ -597,6 +788,7 @@ var formTranslation = {
|
|
|
597
788
|
yes: "Yes"
|
|
598
789
|
},
|
|
599
790
|
de: {
|
|
791
|
+
add: "Hinzuf\xFCgen",
|
|
600
792
|
all: "Alle",
|
|
601
793
|
apply: "Anwenden",
|
|
602
794
|
back: "Zur\xFCck",
|
|
@@ -609,6 +801,7 @@ var formTranslation = {
|
|
|
609
801
|
confirm: "Best\xE4tigen",
|
|
610
802
|
copy: "Kopieren",
|
|
611
803
|
copied: "Kopiert",
|
|
804
|
+
create: "Erstellen",
|
|
612
805
|
decline: "Ablehnen",
|
|
613
806
|
delete: "L\xF6schen",
|
|
614
807
|
discard: "Verwerfen",
|
|
@@ -652,241 +845,346 @@ var formTranslation = {
|
|
|
652
845
|
}
|
|
653
846
|
};
|
|
654
847
|
|
|
655
|
-
// src/components/
|
|
656
|
-
import {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
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"]
|
|
664
856
|
};
|
|
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
|
-
] });
|
|
857
|
+
var IconButtonUtil = {
|
|
858
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
694
859
|
};
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
var
|
|
701
|
-
|
|
702
|
-
|
|
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,
|
|
703
882
|
onClick,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
"
|
|
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",
|
|
715
906
|
{
|
|
716
|
-
|
|
717
|
-
|
|
907
|
+
ref,
|
|
908
|
+
onClick,
|
|
909
|
+
disabled,
|
|
910
|
+
className: clsx6(
|
|
718
911
|
{
|
|
719
|
-
|
|
720
|
-
[
|
|
721
|
-
[disabledClassName]: isDisabled
|
|
912
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
913
|
+
[clsx6(colorClasses, "hover:brightness-90")]: !disabled
|
|
722
914
|
},
|
|
915
|
+
ButtonUtil.paddingMapping[size],
|
|
723
916
|
className
|
|
724
917
|
),
|
|
725
|
-
|
|
918
|
+
...restProps,
|
|
726
919
|
children: [
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
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
|
+
)
|
|
733
941
|
]
|
|
734
942
|
}
|
|
735
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
|
+
);
|
|
736
981
|
};
|
|
737
982
|
|
|
738
|
-
// src/
|
|
739
|
-
import {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
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")
|
|
746
1001
|
}
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
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
|
+
};
|
|
756
1073
|
};
|
|
757
1074
|
|
|
758
1075
|
// src/components/user-action/Select.tsx
|
|
759
|
-
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
|
+
};
|
|
760
1093
|
var Select = ({
|
|
761
1094
|
value,
|
|
762
1095
|
label,
|
|
763
1096
|
options,
|
|
764
1097
|
onChange,
|
|
765
1098
|
hintText = "",
|
|
766
|
-
|
|
767
|
-
|
|
1099
|
+
selectedDisplayOverwrite,
|
|
1100
|
+
searchOptions,
|
|
1101
|
+
additionalItems,
|
|
768
1102
|
className,
|
|
769
|
-
|
|
1103
|
+
triggerClassName,
|
|
1104
|
+
hintTextClassName,
|
|
1105
|
+
...menuProps
|
|
770
1106
|
}) => {
|
|
771
|
-
const triggerRef = useRef2(null);
|
|
772
|
-
const menuRef = useRef2(null);
|
|
773
|
-
const [isOpen, setIsOpen] = useState6(false);
|
|
774
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
775
1107
|
const selectedOption = options.find((option) => option.value === value);
|
|
776
1108
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
777
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");
|
|
778
1110
|
}
|
|
779
1111
|
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
|
-
|
|
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,
|
|
817
1160
|
{
|
|
818
|
-
isSelected:
|
|
819
|
-
|
|
820
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
821
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1161
|
+
isSelected: option === selectedOption,
|
|
1162
|
+
title: { value: option.label },
|
|
822
1163
|
onClick: () => {
|
|
823
1164
|
onChange(option.value);
|
|
824
|
-
|
|
1165
|
+
close();
|
|
825
1166
|
},
|
|
826
|
-
|
|
1167
|
+
disabled: option.disabled
|
|
827
1168
|
},
|
|
828
1169
|
index
|
|
829
|
-
)
|
|
830
|
-
|
|
831
|
-
|
|
1170
|
+
)),
|
|
1171
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1172
|
+
] })
|
|
1173
|
+
] });
|
|
832
1174
|
}
|
|
833
|
-
|
|
834
|
-
|
|
1175
|
+
}
|
|
1176
|
+
)
|
|
835
1177
|
] });
|
|
836
1178
|
};
|
|
837
1179
|
|
|
838
1180
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
839
|
-
import { useEffect as
|
|
1181
|
+
import { useEffect as useEffect12, useRef as useRef3, useState as useState10 } from "react";
|
|
840
1182
|
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
|
-
};
|
|
1183
|
+
import clsx10 from "clsx";
|
|
886
1184
|
|
|
887
1185
|
// src/components/user-action/Tooltip.tsx
|
|
888
|
-
import { clsx as
|
|
889
|
-
import { jsx as
|
|
1186
|
+
import { clsx as clsx9 } from "clsx";
|
|
1187
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
890
1188
|
var Tooltip = ({
|
|
891
1189
|
tooltip,
|
|
892
1190
|
children,
|
|
@@ -916,17 +1214,17 @@ var Tooltip = ({
|
|
|
916
1214
|
left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
|
|
917
1215
|
right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
|
|
918
1216
|
};
|
|
919
|
-
return /* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ jsxs8(
|
|
920
1218
|
"div",
|
|
921
1219
|
{
|
|
922
|
-
className:
|
|
1220
|
+
className: clsx9("relative inline-block", containerClassName),
|
|
923
1221
|
...handlers,
|
|
924
1222
|
children: [
|
|
925
1223
|
children,
|
|
926
|
-
isHovered && /* @__PURE__ */
|
|
1224
|
+
isHovered && /* @__PURE__ */ jsxs8(
|
|
927
1225
|
"div",
|
|
928
1226
|
{
|
|
929
|
-
className:
|
|
1227
|
+
className: clsx9(
|
|
930
1228
|
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
931
1229
|
animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
|
|
932
1230
|
positionClasses[position],
|
|
@@ -935,10 +1233,10 @@ var Tooltip = ({
|
|
|
935
1233
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
936
1234
|
children: [
|
|
937
1235
|
tooltip,
|
|
938
|
-
/* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ jsx10(
|
|
939
1237
|
"div",
|
|
940
1238
|
{
|
|
941
|
-
className:
|
|
1239
|
+
className: clsx9(`absolute w-0 h-0`, triangleClasses[position]),
|
|
942
1240
|
style: { ...triangleStyle[position], zIndex: zIndex + 1 }
|
|
943
1241
|
}
|
|
944
1242
|
)
|
|
@@ -952,24 +1250,24 @@ var Tooltip = ({
|
|
|
952
1250
|
|
|
953
1251
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
954
1252
|
import { X } from "lucide-react";
|
|
955
|
-
import { jsx as
|
|
1253
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
956
1254
|
var Overlay = ({
|
|
957
1255
|
children,
|
|
958
1256
|
isOpen,
|
|
959
1257
|
onBackgroundClick,
|
|
960
1258
|
backgroundClassName
|
|
961
1259
|
}) => {
|
|
962
|
-
const [root, setRoot] =
|
|
963
|
-
|
|
1260
|
+
const [root, setRoot] = useState10();
|
|
1261
|
+
useEffect12(() => {
|
|
964
1262
|
setRoot(document.body);
|
|
965
1263
|
}, []);
|
|
966
1264
|
if (!root || !isOpen) return null;
|
|
967
1265
|
return ReactDOM.createPortal(
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
1266
|
+
/* @__PURE__ */ jsxs9("div", { className: clsx10("fixed inset-0 z-[9999]"), children: [
|
|
1267
|
+
/* @__PURE__ */ jsx11(
|
|
970
1268
|
"div",
|
|
971
1269
|
{
|
|
972
|
-
className:
|
|
1270
|
+
className: clsx10("fixed inset-0 h-screen w-screen bg-overlay-shadow", backgroundClassName),
|
|
973
1271
|
onClick: onBackgroundClick
|
|
974
1272
|
}
|
|
975
1273
|
),
|
|
@@ -997,21 +1295,21 @@ var OverlayHeader = ({
|
|
|
997
1295
|
}) => {
|
|
998
1296
|
const translation = useTranslation([defaultModalHeaderTranslation], overwriteTranslation);
|
|
999
1297
|
const hasTitleRow = !!title || !!titleText || !!onClose;
|
|
1000
|
-
const titleRow = /* @__PURE__ */
|
|
1001
|
-
title ?? /* @__PURE__ */
|
|
1298
|
+
const titleRow = /* @__PURE__ */ jsxs9("div", { className: "flex-row-8 justify-between items-start", children: [
|
|
1299
|
+
title ?? /* @__PURE__ */ jsx11(
|
|
1002
1300
|
"h2",
|
|
1003
1301
|
{
|
|
1004
|
-
className:
|
|
1302
|
+
className: clsx10("textstyle-title-lg", {
|
|
1005
1303
|
"mb-1": description || descriptionText
|
|
1006
1304
|
}),
|
|
1007
1305
|
children: titleText
|
|
1008
1306
|
}
|
|
1009
1307
|
),
|
|
1010
|
-
!!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" }) }) })
|
|
1011
1309
|
] });
|
|
1012
|
-
return /* @__PURE__ */
|
|
1310
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex-col-2", children: [
|
|
1013
1311
|
hasTitleRow && titleRow,
|
|
1014
|
-
description ?? (descriptionText && /* @__PURE__ */
|
|
1312
|
+
description ?? (descriptionText && /* @__PURE__ */ jsx11("span", { className: "textstyle-description", children: descriptionText }))
|
|
1015
1313
|
] });
|
|
1016
1314
|
};
|
|
1017
1315
|
var Modal = ({
|
|
@@ -1023,7 +1321,7 @@ var Modal = ({
|
|
|
1023
1321
|
headerProps
|
|
1024
1322
|
}) => {
|
|
1025
1323
|
const ref = useRef3(null);
|
|
1026
|
-
|
|
1324
|
+
useEffect12(() => {
|
|
1027
1325
|
if (!isOpen) return;
|
|
1028
1326
|
const modal = ref.current;
|
|
1029
1327
|
if (!modal) {
|
|
@@ -1060,25 +1358,25 @@ var Modal = ({
|
|
|
1060
1358
|
overlayStack = overlayStack.filter((m) => m !== modal);
|
|
1061
1359
|
};
|
|
1062
1360
|
}, [isOpen, onClose]);
|
|
1063
|
-
return /* @__PURE__ */
|
|
1361
|
+
return /* @__PURE__ */ jsx11(
|
|
1064
1362
|
Overlay,
|
|
1065
1363
|
{
|
|
1066
1364
|
isOpen,
|
|
1067
1365
|
onBackgroundClick: onClose,
|
|
1068
1366
|
backgroundClassName,
|
|
1069
|
-
children: /* @__PURE__ */
|
|
1367
|
+
children: /* @__PURE__ */ jsxs9(
|
|
1070
1368
|
"div",
|
|
1071
1369
|
{
|
|
1072
1370
|
ref,
|
|
1073
1371
|
tabIndex: -1,
|
|
1074
|
-
className:
|
|
1075
|
-
"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",
|
|
1076
1374
|
className
|
|
1077
1375
|
),
|
|
1078
1376
|
role: "dialog",
|
|
1079
1377
|
"aria-modal": true,
|
|
1080
1378
|
children: [
|
|
1081
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ jsx11(OverlayHeader, { ...headerProps, onClose }),
|
|
1082
1380
|
children
|
|
1083
1381
|
]
|
|
1084
1382
|
}
|
|
@@ -1088,7 +1386,7 @@ var Modal = ({
|
|
|
1088
1386
|
};
|
|
1089
1387
|
|
|
1090
1388
|
// src/components/modals/LanguageModal.tsx
|
|
1091
|
-
import { jsx as
|
|
1389
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1092
1390
|
var defaultLanguageModalTranslation = {
|
|
1093
1391
|
en: {
|
|
1094
1392
|
language: "Language",
|
|
@@ -1111,7 +1409,7 @@ var LanguageModal = ({
|
|
|
1111
1409
|
}) => {
|
|
1112
1410
|
const { language, setLanguage } = useLanguage();
|
|
1113
1411
|
const translation = useTranslation([defaultLanguageModalTranslation], overwriteTranslation);
|
|
1114
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ jsx12(
|
|
1115
1413
|
Modal,
|
|
1116
1414
|
{
|
|
1117
1415
|
headerProps: {
|
|
@@ -1121,8 +1419,8 @@ var LanguageModal = ({
|
|
|
1121
1419
|
},
|
|
1122
1420
|
onClose,
|
|
1123
1421
|
...modalProps,
|
|
1124
|
-
children: /* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1422
|
+
children: /* @__PURE__ */ jsxs10("div", { className: "w-64", children: [
|
|
1423
|
+
/* @__PURE__ */ jsx12(
|
|
1126
1424
|
Select,
|
|
1127
1425
|
{
|
|
1128
1426
|
className: "mt-2",
|
|
@@ -1131,7 +1429,7 @@ var LanguageModal = ({
|
|
|
1131
1429
|
onChange: (language2) => setLanguage(language2)
|
|
1132
1430
|
}
|
|
1133
1431
|
),
|
|
1134
|
-
/* @__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") }) })
|
|
1135
1433
|
] })
|
|
1136
1434
|
}
|
|
1137
1435
|
);
|