@helpwave/hightide 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/branding/HelpwaveBadge.js +7 -7
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +7 -7
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +67 -39
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +56 -28
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js +3 -3
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +3 -3
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +4 -4
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +4 -4
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +48 -20
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +46 -18
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +32 -28
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.js +2 -2
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Ring.js +2 -2
- package/dist/components/icons-and-geometry/Ring.js.map +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs +2 -2
- package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +84 -15
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.js +1 -1
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +10 -1
- package/dist/components/layout-and-navigation/Expandable.d.ts +10 -1
- package/dist/components/layout-and-navigation/Expandable.js +38 -10
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +38 -11
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +36 -12
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +38 -14
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +92 -19
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +82 -9
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +79 -6
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +127 -25
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +126 -24
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +22 -16
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +7 -3
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
- package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
- package/dist/components/layout-and-navigation/Tile.js +7 -7
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +7 -7
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.d.mts +5 -10
- package/dist/components/loading-states/LoadingAndErrorComponent.d.ts +5 -10
- package/dist/components/loading-states/LoadingAndErrorComponent.js +14 -327
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +15 -318
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +5 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +8 -6
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +8 -6
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/loading-states/LoadingContainer.d.mts +8 -0
- package/dist/components/loading-states/LoadingContainer.d.ts +8 -0
- package/dist/components/loading-states/LoadingContainer.js +34 -0
- package/dist/components/loading-states/LoadingContainer.js.map +1 -0
- package/dist/components/loading-states/LoadingContainer.mjs +10 -0
- package/dist/components/loading-states/LoadingContainer.mjs.map +1 -0
- package/dist/components/modals/ConfirmModal.js +32 -28
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +18 -14
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +28 -24
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +18 -14
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +32 -28
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +18 -14
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +729 -434
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +729 -430
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +733 -438
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +732 -433
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +110 -35
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +110 -35
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +118 -41
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +114 -37
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
- package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
- package/dist/components/properties/MultiSelectProperty.js +916 -463
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +921 -464
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +101 -18
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +101 -18
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +103 -20
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +99 -16
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +9 -2
- package/dist/components/properties/SelectProperty.d.ts +9 -2
- package/dist/components/properties/SelectProperty.js +683 -243
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +687 -243
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +133 -46
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +133 -46
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +285 -185
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +270 -166
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +179 -78
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +160 -55
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +72 -3
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +72 -3
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +15 -2
- package/dist/components/user-action/Button.d.ts +15 -2
- package/dist/components/user-action/Button.js +12 -12
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +12 -12
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +6 -15
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +6 -15
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +81 -49
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +67 -35
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +11 -6
- package/dist/components/user-action/Menu.d.ts +11 -6
- package/dist/components/user-action/Menu.js +128 -31
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +134 -33
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +17 -7
- package/dist/components/user-action/MultiSelect.d.ts +17 -7
- package/dist/components/user-action/MultiSelect.js +797 -375
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +782 -356
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +2 -2
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +2 -2
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.d.mts +14 -0
- package/dist/components/user-action/SearchBar.d.ts +14 -0
- package/dist/components/user-action/SearchBar.js +673 -0
- package/dist/components/user-action/SearchBar.js.map +1 -0
- package/dist/components/user-action/SearchBar.mjs +637 -0
- package/dist/components/user-action/SearchBar.mjs.map +1 -0
- package/dist/components/user-action/Select.d.mts +18 -5
- package/dist/components/user-action/Select.d.ts +18 -5
- package/dist/components/user-action/Select.js +765 -355
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +762 -349
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +1 -1
- package/dist/components/user-action/Textarea.d.ts +1 -1
- package/dist/components/user-action/Textarea.js +13 -3
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +13 -3
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.js +2 -2
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +2 -2
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +284 -113
- package/dist/css/uncompiled/globals.css +19 -13
- package/dist/css/uncompiled/theme/colors-component.css +12 -3
- package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
- package/dist/css/uncompiled/utitlity/animation.css +96 -1
- package/dist/css/uncompiled/utitlity/general.css +16 -0
- package/dist/hooks/usePopoverPosition.d.mts +15 -0
- package/dist/hooks/usePopoverPosition.d.ts +15 -0
- package/dist/hooks/usePopoverPosition.js +81 -0
- package/dist/hooks/usePopoverPosition.js.map +1 -0
- package/dist/hooks/usePopoverPosition.mjs +57 -0
- package/dist/hooks/usePopoverPosition.mjs.map +1 -0
- package/dist/hooks/useSearch.d.mts +7 -2
- package/dist/hooks/useSearch.d.ts +7 -2
- package/dist/hooks/useSearch.js +44 -15
- package/dist/hooks/useSearch.js.map +1 -1
- package/dist/hooks/useSearch.mjs +45 -16
- package/dist/hooks/useSearch.mjs.map +1 -1
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1197 -902
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1048 -754
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +2 -0
- package/dist/localization/defaults/form.d.ts +2 -0
- package/dist/localization/defaults/form.js +4 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +4 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/simpleSearch.d.mts +1 -1
- package/dist/util/simpleSearch.d.ts +1 -1
- package/dist/util/simpleSearch.js +4 -1
- package/dist/util/simpleSearch.js.map +1 -1
- package/dist/util/simpleSearch.mjs +4 -1
- package/dist/util/simpleSearch.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -121,9 +121,9 @@ var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
// src/components/user-action/Select.tsx
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
var
|
|
124
|
+
var import_react13 = require("react");
|
|
125
|
+
var import_react14 = require("react");
|
|
126
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
127
127
|
|
|
128
128
|
// src/components/user-action/Label.tsx
|
|
129
129
|
var import_clsx = __toESM(require("clsx"));
|
|
@@ -143,22 +143,385 @@ var Label = ({
|
|
|
143
143
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { ...props, className: (0, import_clsx.default)(styleMapping[labelType], className), children: children ? children : name });
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
// src/components/layout-and-navigation/
|
|
146
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
147
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
147
148
|
var import_lucide_react = require("lucide-react");
|
|
149
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
150
|
+
var Tile = ({
|
|
151
|
+
title,
|
|
152
|
+
description,
|
|
153
|
+
onClick,
|
|
154
|
+
isSelected = false,
|
|
155
|
+
disabled = false,
|
|
156
|
+
prefix,
|
|
157
|
+
suffix,
|
|
158
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
159
|
+
selectedClassName = " bg-primary/20",
|
|
160
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
161
|
+
className
|
|
162
|
+
}) => {
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: (0, import_clsx2.default)(
|
|
167
|
+
"flex-row-2 w-full items-center",
|
|
168
|
+
{
|
|
169
|
+
[normalClassName]: !!onClick && !disabled,
|
|
170
|
+
[selectedClassName]: isSelected && !disabled,
|
|
171
|
+
[disabledClassName]: disabled
|
|
172
|
+
},
|
|
173
|
+
className
|
|
174
|
+
),
|
|
175
|
+
onClick: disabled ? void 0 : onClick,
|
|
176
|
+
children: [
|
|
177
|
+
prefix,
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-col-0 w-full", children: [
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { className: (0, import_clsx2.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
180
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: (0, import_clsx2.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
181
|
+
] }),
|
|
182
|
+
suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Check, { size: 24 }) : void 0)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
189
|
+
var import_react3 = require("react");
|
|
190
|
+
var import_lucide_react2 = require("lucide-react");
|
|
191
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
192
|
+
|
|
193
|
+
// src/util/noop.ts
|
|
194
|
+
var noop = () => void 0;
|
|
195
|
+
|
|
196
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
197
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
198
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
200
|
+
import_lucide_react2.ChevronDown,
|
|
201
|
+
{
|
|
202
|
+
className: (0, import_clsx3.default)(
|
|
203
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
|
|
204
|
+
{ "rotate-180": isExpanded },
|
|
205
|
+
className
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
var Expandable = (0, import_react3.forwardRef)(function Expandable2({
|
|
211
|
+
children,
|
|
212
|
+
label,
|
|
213
|
+
icon,
|
|
214
|
+
isExpanded = false,
|
|
215
|
+
onChange = noop,
|
|
216
|
+
clickOnlyOnHeader = true,
|
|
217
|
+
disabled = false,
|
|
218
|
+
className,
|
|
219
|
+
headerClassName,
|
|
220
|
+
contentClassName,
|
|
221
|
+
contentExpandedClassName
|
|
222
|
+
}, ref) {
|
|
223
|
+
const defaultIcon = (0, import_react3.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
|
|
224
|
+
icon ??= defaultIcon;
|
|
225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
ref,
|
|
229
|
+
className: (0, import_clsx3.default)("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
230
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
231
|
+
children: [
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
className: (0, import_clsx3.default)(
|
|
236
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
237
|
+
{
|
|
238
|
+
"group-hover:brightness-97": !isExpanded,
|
|
239
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
240
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
241
|
+
},
|
|
242
|
+
headerClassName
|
|
243
|
+
),
|
|
244
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
245
|
+
children: [
|
|
246
|
+
label,
|
|
247
|
+
icon(isExpanded)
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
252
|
+
"div",
|
|
253
|
+
{
|
|
254
|
+
className: (0, import_clsx3.default)(
|
|
255
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
256
|
+
{
|
|
257
|
+
[(0, import_clsx3.default)("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
|
|
258
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
259
|
+
},
|
|
260
|
+
contentClassName
|
|
261
|
+
),
|
|
262
|
+
children
|
|
263
|
+
}
|
|
264
|
+
)
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
});
|
|
269
|
+
var ExpandableUncontrolled = (0, import_react3.forwardRef)(function ExpandableUncontrolled2({
|
|
270
|
+
isExpanded,
|
|
271
|
+
onChange = noop,
|
|
272
|
+
...props
|
|
273
|
+
}, ref) {
|
|
274
|
+
const [usedIsExpanded, setUsedIsExpanded] = (0, import_react3.useState)(isExpanded);
|
|
275
|
+
(0, import_react3.useEffect)(() => {
|
|
276
|
+
setUsedIsExpanded(isExpanded);
|
|
277
|
+
}, [isExpanded]);
|
|
278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
279
|
+
Expandable,
|
|
280
|
+
{
|
|
281
|
+
...props,
|
|
282
|
+
ref,
|
|
283
|
+
isExpanded: usedIsExpanded,
|
|
284
|
+
onChange: (value) => {
|
|
285
|
+
onChange(value);
|
|
286
|
+
setUsedIsExpanded(value);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// src/components/user-action/Menu.tsx
|
|
293
|
+
var import_react6 = require("react");
|
|
148
294
|
var import_clsx4 = __toESM(require("clsx"));
|
|
149
295
|
|
|
296
|
+
// src/hooks/useOutsideClick.ts
|
|
297
|
+
var import_react4 = require("react");
|
|
298
|
+
var useOutsideClick = (refs, handler) => {
|
|
299
|
+
(0, import_react4.useEffect)(() => {
|
|
300
|
+
const listener = (event) => {
|
|
301
|
+
if (event.target === null) return;
|
|
302
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
handler();
|
|
306
|
+
};
|
|
307
|
+
document.addEventListener("mousedown", listener);
|
|
308
|
+
document.addEventListener("touchstart", listener);
|
|
309
|
+
return () => {
|
|
310
|
+
document.removeEventListener("mousedown", listener);
|
|
311
|
+
document.removeEventListener("touchstart", listener);
|
|
312
|
+
};
|
|
313
|
+
}, [refs, handler]);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
// src/hooks/useHoverState.ts
|
|
317
|
+
var import_react5 = require("react");
|
|
318
|
+
var defaultUseHoverStateProps = {
|
|
319
|
+
closingDelay: 200,
|
|
320
|
+
isDisabled: false
|
|
321
|
+
};
|
|
322
|
+
var useHoverState = (props = void 0) => {
|
|
323
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
324
|
+
const [isHovered, setIsHovered] = (0, import_react5.useState)(false);
|
|
325
|
+
const [timer, setTimer] = (0, import_react5.useState)();
|
|
326
|
+
const onMouseEnter = () => {
|
|
327
|
+
if (isDisabled) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
clearTimeout(timer);
|
|
331
|
+
setIsHovered(true);
|
|
332
|
+
};
|
|
333
|
+
const onMouseLeave = () => {
|
|
334
|
+
if (isDisabled) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
setTimer(setTimeout(() => {
|
|
338
|
+
setIsHovered(false);
|
|
339
|
+
}, closingDelay));
|
|
340
|
+
};
|
|
341
|
+
(0, import_react5.useEffect)(() => {
|
|
342
|
+
if (timer) {
|
|
343
|
+
return () => {
|
|
344
|
+
clearTimeout(timer);
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
(0, import_react5.useEffect)(() => {
|
|
349
|
+
if (timer) {
|
|
350
|
+
clearTimeout(timer);
|
|
351
|
+
}
|
|
352
|
+
}, [isDisabled]);
|
|
353
|
+
return {
|
|
354
|
+
isHovered,
|
|
355
|
+
setIsHovered,
|
|
356
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
361
|
+
var resolve = (children, bag) => {
|
|
362
|
+
if (typeof children === "function") {
|
|
363
|
+
return children(bag);
|
|
364
|
+
}
|
|
365
|
+
return children ?? void 0;
|
|
366
|
+
};
|
|
367
|
+
var BagFunctionUtil = {
|
|
368
|
+
resolve
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
// src/hooks/usePopoverPosition.ts
|
|
372
|
+
var defaultPopoverPositionOptions = {
|
|
373
|
+
edgePadding: 16,
|
|
374
|
+
outerGap: 4,
|
|
375
|
+
horizontalAlignment: "leftInside",
|
|
376
|
+
verticalAlignment: "bottomOutside",
|
|
377
|
+
disabled: false
|
|
378
|
+
};
|
|
379
|
+
var usePopoverPosition = (trigger, options) => {
|
|
380
|
+
const {
|
|
381
|
+
edgePadding,
|
|
382
|
+
outerGap,
|
|
383
|
+
verticalAlignment,
|
|
384
|
+
horizontalAlignment,
|
|
385
|
+
disabled
|
|
386
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
387
|
+
if (disabled || !trigger) {
|
|
388
|
+
return {};
|
|
389
|
+
}
|
|
390
|
+
const left = {
|
|
391
|
+
leftOutside: trigger.left - outerGap,
|
|
392
|
+
leftInside: trigger.left,
|
|
393
|
+
rightOutside: trigger.right + outerGap,
|
|
394
|
+
rightInside: trigger.right,
|
|
395
|
+
center: trigger.left + trigger.width / 2
|
|
396
|
+
}[horizontalAlignment];
|
|
397
|
+
const top = {
|
|
398
|
+
topOutside: trigger.top - outerGap,
|
|
399
|
+
topInside: trigger.top,
|
|
400
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
401
|
+
bottomInside: trigger.bottom,
|
|
402
|
+
center: trigger.top + trigger.height / 2
|
|
403
|
+
}[verticalAlignment];
|
|
404
|
+
const translateX = {
|
|
405
|
+
leftOutside: "-100%",
|
|
406
|
+
leftInside: void 0,
|
|
407
|
+
rightOutside: void 0,
|
|
408
|
+
rightInside: "-100%",
|
|
409
|
+
center: "-50%"
|
|
410
|
+
}[horizontalAlignment];
|
|
411
|
+
const translateY = {
|
|
412
|
+
topOutside: "-100%",
|
|
413
|
+
topInside: void 0,
|
|
414
|
+
bottomOutside: void 0,
|
|
415
|
+
bottomInside: "-100%",
|
|
416
|
+
center: "-50%"
|
|
417
|
+
}[verticalAlignment];
|
|
418
|
+
return {
|
|
419
|
+
left: Math.max(left, edgePadding),
|
|
420
|
+
top: Math.max(top, edgePadding),
|
|
421
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
// src/components/user-action/Menu.tsx
|
|
426
|
+
var import_react_dom = require("react-dom");
|
|
427
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
428
|
+
function getScrollableParents(element) {
|
|
429
|
+
const scrollables = [];
|
|
430
|
+
let parent = element.parentElement;
|
|
431
|
+
while (parent) {
|
|
432
|
+
scrollables.push(parent);
|
|
433
|
+
parent = parent.parentElement;
|
|
434
|
+
}
|
|
435
|
+
return scrollables;
|
|
436
|
+
}
|
|
437
|
+
var Menu = ({
|
|
438
|
+
trigger,
|
|
439
|
+
children,
|
|
440
|
+
alignmentHorizontal = "leftInside",
|
|
441
|
+
alignmentVertical = "bottomOutside",
|
|
442
|
+
showOnHover = false,
|
|
443
|
+
disabled = false,
|
|
444
|
+
menuClassName = ""
|
|
445
|
+
}) => {
|
|
446
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
447
|
+
const triggerRef = (0, import_react6.useRef)(null);
|
|
448
|
+
const menuRef = (0, import_react6.useRef)(null);
|
|
449
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
450
|
+
const [isHidden, setIsHidden] = (0, import_react6.useState)(true);
|
|
451
|
+
const bag = {
|
|
452
|
+
isOpen,
|
|
453
|
+
close: () => setIsOpen(false),
|
|
454
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
455
|
+
disabled
|
|
456
|
+
};
|
|
457
|
+
const menuPosition = usePopoverPosition(
|
|
458
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
459
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
460
|
+
);
|
|
461
|
+
(0, import_react6.useEffect)(() => {
|
|
462
|
+
if (!isOpen) return;
|
|
463
|
+
const triggerEl = triggerRef.current;
|
|
464
|
+
if (!triggerEl) return;
|
|
465
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
466
|
+
const close = () => setIsOpen(false);
|
|
467
|
+
scrollableParents.forEach((parent) => {
|
|
468
|
+
parent.addEventListener("scroll", close);
|
|
469
|
+
});
|
|
470
|
+
window.addEventListener("resize", close);
|
|
471
|
+
return () => {
|
|
472
|
+
scrollableParents.forEach((parent) => {
|
|
473
|
+
parent.removeEventListener("scroll", close);
|
|
474
|
+
});
|
|
475
|
+
window.removeEventListener("resize", close);
|
|
476
|
+
};
|
|
477
|
+
}, [isOpen, setIsOpen]);
|
|
478
|
+
(0, import_react6.useEffect)(() => {
|
|
479
|
+
if (isOpen) {
|
|
480
|
+
setIsHidden(false);
|
|
481
|
+
}
|
|
482
|
+
}, [isOpen]);
|
|
483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
484
|
+
trigger(bag, triggerRef),
|
|
485
|
+
(0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
486
|
+
"div",
|
|
487
|
+
{
|
|
488
|
+
ref: menuRef,
|
|
489
|
+
onClick: (e) => e.stopPropagation(),
|
|
490
|
+
className: (0, import_clsx4.default)(
|
|
491
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
492
|
+
{
|
|
493
|
+
"animate-pop-in": isOpen,
|
|
494
|
+
"animate-pop-out": !isOpen,
|
|
495
|
+
"hidden": isHidden
|
|
496
|
+
},
|
|
497
|
+
menuClassName
|
|
498
|
+
),
|
|
499
|
+
onAnimationEnd: () => {
|
|
500
|
+
if (!isOpen) {
|
|
501
|
+
setIsHidden(true);
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
style: {
|
|
505
|
+
...menuPosition
|
|
506
|
+
},
|
|
507
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
508
|
+
}
|
|
509
|
+
), document.body)
|
|
510
|
+
] });
|
|
511
|
+
};
|
|
512
|
+
|
|
150
513
|
// src/components/user-action/Input.tsx
|
|
151
|
-
var
|
|
152
|
-
var
|
|
514
|
+
var import_react10 = require("react");
|
|
515
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
153
516
|
|
|
154
517
|
// src/hooks/useDelay.ts
|
|
155
|
-
var
|
|
518
|
+
var import_react7 = require("react");
|
|
156
519
|
var defaultOptions = {
|
|
157
520
|
delay: 3e3,
|
|
158
521
|
disabled: false
|
|
159
522
|
};
|
|
160
523
|
function useDelay(options) {
|
|
161
|
-
const [timer, setTimer] = (0,
|
|
524
|
+
const [timer, setTimer] = (0, import_react7.useState)(void 0);
|
|
162
525
|
const { delay, disabled } = {
|
|
163
526
|
...defaultOptions,
|
|
164
527
|
...options
|
|
@@ -177,12 +540,12 @@ function useDelay(options) {
|
|
|
177
540
|
setTimer(void 0);
|
|
178
541
|
}, delay));
|
|
179
542
|
};
|
|
180
|
-
(0,
|
|
543
|
+
(0, import_react7.useEffect)(() => {
|
|
181
544
|
return () => {
|
|
182
545
|
clearTimeout(timer);
|
|
183
546
|
};
|
|
184
547
|
}, [timer]);
|
|
185
|
-
(0,
|
|
548
|
+
(0, import_react7.useEffect)(() => {
|
|
186
549
|
if (disabled) {
|
|
187
550
|
clearTimeout(timer);
|
|
188
551
|
setTimer(void 0);
|
|
@@ -191,13 +554,10 @@ function useDelay(options) {
|
|
|
191
554
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
192
555
|
}
|
|
193
556
|
|
|
194
|
-
// src/util/noop.ts
|
|
195
|
-
var noop = () => void 0;
|
|
196
|
-
|
|
197
557
|
// src/hooks/useFocusManagement.ts
|
|
198
|
-
var
|
|
558
|
+
var import_react8 = require("react");
|
|
199
559
|
function useFocusManagement() {
|
|
200
|
-
const getFocusableElements = (0,
|
|
560
|
+
const getFocusableElements = (0, import_react8.useCallback)(() => {
|
|
201
561
|
return Array.from(
|
|
202
562
|
document.querySelectorAll(
|
|
203
563
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -206,7 +566,7 @@ function useFocusManagement() {
|
|
|
206
566
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
207
567
|
);
|
|
208
568
|
}, []);
|
|
209
|
-
const getNextFocusElement = (0,
|
|
569
|
+
const getNextFocusElement = (0, import_react8.useCallback)(() => {
|
|
210
570
|
const elements = getFocusableElements();
|
|
211
571
|
if (elements.length === 0) {
|
|
212
572
|
return void 0;
|
|
@@ -218,11 +578,11 @@ function useFocusManagement() {
|
|
|
218
578
|
}
|
|
219
579
|
return nextElement;
|
|
220
580
|
}, [getFocusableElements]);
|
|
221
|
-
const focusNext = (0,
|
|
581
|
+
const focusNext = (0, import_react8.useCallback)(() => {
|
|
222
582
|
const nextElement = getNextFocusElement();
|
|
223
583
|
nextElement?.focus();
|
|
224
584
|
}, [getNextFocusElement]);
|
|
225
|
-
const getPreviousFocusElement = (0,
|
|
585
|
+
const getPreviousFocusElement = (0, import_react8.useCallback)(() => {
|
|
226
586
|
const elements = getFocusableElements();
|
|
227
587
|
if (elements.length === 0) {
|
|
228
588
|
return void 0;
|
|
@@ -238,7 +598,7 @@ function useFocusManagement() {
|
|
|
238
598
|
}
|
|
239
599
|
return previousElement;
|
|
240
600
|
}, [getFocusableElements]);
|
|
241
|
-
const focusPrevious = (0,
|
|
601
|
+
const focusPrevious = (0, import_react8.useCallback)(() => {
|
|
242
602
|
const previousElement = getPreviousFocusElement();
|
|
243
603
|
if (previousElement) previousElement.focus();
|
|
244
604
|
}, [getPreviousFocusElement]);
|
|
@@ -252,10 +612,10 @@ function useFocusManagement() {
|
|
|
252
612
|
}
|
|
253
613
|
|
|
254
614
|
// src/hooks/useFocusOnceVisible.ts
|
|
255
|
-
var
|
|
615
|
+
var import_react9 = __toESM(require("react"));
|
|
256
616
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
257
|
-
const [hasUsedFocus, setHasUsedFocus] =
|
|
258
|
-
(0,
|
|
617
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react9.default.useState(false);
|
|
618
|
+
(0, import_react9.useEffect)(() => {
|
|
259
619
|
if (disable || hasUsedFocus) {
|
|
260
620
|
return;
|
|
261
621
|
}
|
|
@@ -275,9 +635,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
275
635
|
};
|
|
276
636
|
|
|
277
637
|
// src/components/user-action/Input.tsx
|
|
278
|
-
var
|
|
638
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
279
639
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
280
|
-
return (0,
|
|
640
|
+
return (0, import_clsx5.default)(
|
|
281
641
|
"px-2 py-1.5 rounded-md border-2",
|
|
282
642
|
{
|
|
283
643
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -291,7 +651,7 @@ var defaultEditCompleteOptions = {
|
|
|
291
651
|
afterDelay: true,
|
|
292
652
|
delay: 2500
|
|
293
653
|
};
|
|
294
|
-
var Input = (0,
|
|
654
|
+
var Input = (0, import_react10.forwardRef)(function Input2({
|
|
295
655
|
id,
|
|
296
656
|
type = "text",
|
|
297
657
|
value,
|
|
@@ -314,10 +674,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
314
674
|
restartTimer,
|
|
315
675
|
clearTimer
|
|
316
676
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
317
|
-
const innerRef = (0,
|
|
677
|
+
const innerRef = (0, import_react10.useRef)(null);
|
|
318
678
|
const { focusNext } = useFocusManagement();
|
|
319
679
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
320
|
-
(0,
|
|
680
|
+
(0, import_react10.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
321
681
|
const handleKeyDown = (e) => {
|
|
322
682
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
323
683
|
e.preventDefault();
|
|
@@ -325,9 +685,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
325
685
|
focusNext();
|
|
326
686
|
}
|
|
327
687
|
};
|
|
328
|
-
return /* @__PURE__ */ (0,
|
|
329
|
-
label && /* @__PURE__ */ (0,
|
|
330
|
-
/* @__PURE__ */ (0,
|
|
688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)({ "w-full": expanded }, containerClassName), children: [
|
|
689
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx5.default)("mb-1", label.className) }),
|
|
690
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
331
691
|
"input",
|
|
332
692
|
{
|
|
333
693
|
...restProps,
|
|
@@ -336,7 +696,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
336
696
|
id,
|
|
337
697
|
type,
|
|
338
698
|
disabled,
|
|
339
|
-
className: (0,
|
|
699
|
+
className: (0, import_clsx5.default)(getInputClassName({ disabled }), className),
|
|
340
700
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
341
701
|
onBlur: (event) => {
|
|
342
702
|
onBlur?.(event);
|
|
@@ -366,7 +726,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
|
|
|
366
726
|
)
|
|
367
727
|
] });
|
|
368
728
|
});
|
|
369
|
-
var FormInput = (0,
|
|
729
|
+
var FormInput = (0, import_react10.forwardRef)(function FormInput2({
|
|
370
730
|
id,
|
|
371
731
|
labelText,
|
|
372
732
|
errorText,
|
|
@@ -378,206 +738,33 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
|
|
|
378
738
|
disabled,
|
|
379
739
|
...restProps
|
|
380
740
|
}, ref) {
|
|
381
|
-
const input = /* @__PURE__ */ (0,
|
|
741
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
382
742
|
"input",
|
|
383
743
|
{
|
|
384
744
|
...restProps,
|
|
385
745
|
ref,
|
|
386
746
|
id,
|
|
387
747
|
disabled,
|
|
388
|
-
className: (0,
|
|
748
|
+
className: (0, import_clsx5.default)(
|
|
389
749
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
390
750
|
className
|
|
391
751
|
)
|
|
392
752
|
}
|
|
393
753
|
);
|
|
394
|
-
return /* @__PURE__ */ (0,
|
|
395
|
-
labelText && /* @__PURE__ */ (0,
|
|
754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)("flex flex-col gap-y-1", containerClassName), children: [
|
|
755
|
+
labelText && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { htmlFor: id, className: (0, import_clsx5.default)("textstyle-label-md", labelClassName), children: [
|
|
396
756
|
labelText,
|
|
397
|
-
required && /* @__PURE__ */ (0,
|
|
757
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-primary font-bold", children: "*" })
|
|
398
758
|
] }),
|
|
399
759
|
input,
|
|
400
|
-
errorText && /* @__PURE__ */ (0,
|
|
760
|
+
errorText && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: (0, import_clsx5.default)("text-negative", errorClassName), children: errorText })
|
|
401
761
|
] });
|
|
402
762
|
});
|
|
403
763
|
|
|
404
|
-
// src/components/user-action/Button.tsx
|
|
405
|
-
var import_clsx3 = __toESM(require("clsx"));
|
|
406
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
407
|
-
var ButtonColorUtil = {
|
|
408
|
-
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
409
|
-
text: ["primary", "negative", "neutral"],
|
|
410
|
-
outline: ["primary"]
|
|
411
|
-
};
|
|
412
|
-
var IconButtonUtil = {
|
|
413
|
-
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
414
|
-
};
|
|
415
|
-
var paddingMapping = {
|
|
416
|
-
small: "btn-sm",
|
|
417
|
-
medium: "btn-md",
|
|
418
|
-
large: "btn-lg"
|
|
419
|
-
};
|
|
420
|
-
var iconPaddingMapping = {
|
|
421
|
-
tiny: "icon-btn-xs",
|
|
422
|
-
small: "icon-btn-sm",
|
|
423
|
-
medium: "icon-btn-md",
|
|
424
|
-
large: "icon-btn-lg"
|
|
425
|
-
};
|
|
426
|
-
var ButtonUtil = {
|
|
427
|
-
paddingMapping,
|
|
428
|
-
iconPaddingMapping
|
|
429
|
-
};
|
|
430
|
-
var SolidButton = ({
|
|
431
|
-
children,
|
|
432
|
-
disabled = false,
|
|
433
|
-
color = "primary",
|
|
434
|
-
size = "medium",
|
|
435
|
-
startIcon,
|
|
436
|
-
endIcon,
|
|
437
|
-
onClick,
|
|
438
|
-
className,
|
|
439
|
-
...restProps
|
|
440
|
-
}) => {
|
|
441
|
-
const colorClasses = {
|
|
442
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
443
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
444
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
445
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
446
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
447
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
448
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
449
|
-
}[color];
|
|
450
|
-
const iconColorClasses = {
|
|
451
|
-
primary: "text-button-solid-primary-icon",
|
|
452
|
-
secondary: "text-button-solid-secondary-icon",
|
|
453
|
-
tertiary: "text-button-solid-tertiary-icon",
|
|
454
|
-
positive: "text-button-solid-positive-icon",
|
|
455
|
-
warning: "text-button-solid-warning-icon",
|
|
456
|
-
negative: "text-button-solid-negative-icon",
|
|
457
|
-
neutral: "text-button-solid-neutral-icon"
|
|
458
|
-
}[color];
|
|
459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
460
|
-
"button",
|
|
461
|
-
{
|
|
462
|
-
onClick: disabled ? void 0 : onClick,
|
|
463
|
-
disabled: disabled || onClick === void 0,
|
|
464
|
-
className: (0, import_clsx3.default)(
|
|
465
|
-
{
|
|
466
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
467
|
-
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
468
|
-
},
|
|
469
|
-
ButtonUtil.paddingMapping[size],
|
|
470
|
-
className
|
|
471
|
-
),
|
|
472
|
-
...restProps,
|
|
473
|
-
children: [
|
|
474
|
-
startIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
475
|
-
"span",
|
|
476
|
-
{
|
|
477
|
-
className: (0, import_clsx3.default)({
|
|
478
|
-
[iconColorClasses]: !disabled,
|
|
479
|
-
[`text-disabled-icon`]: disabled
|
|
480
|
-
}),
|
|
481
|
-
children: startIcon
|
|
482
|
-
}
|
|
483
|
-
),
|
|
484
|
-
children,
|
|
485
|
-
endIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
486
|
-
"span",
|
|
487
|
-
{
|
|
488
|
-
className: (0, import_clsx3.default)({
|
|
489
|
-
[iconColorClasses]: !disabled,
|
|
490
|
-
[`text-disabled-icon`]: disabled
|
|
491
|
-
}),
|
|
492
|
-
children: endIcon
|
|
493
|
-
}
|
|
494
|
-
)
|
|
495
|
-
]
|
|
496
|
-
}
|
|
497
|
-
);
|
|
498
|
-
};
|
|
499
|
-
var IconButton = ({
|
|
500
|
-
children,
|
|
501
|
-
disabled = false,
|
|
502
|
-
color = "primary",
|
|
503
|
-
size = "medium",
|
|
504
|
-
onClick,
|
|
505
|
-
className,
|
|
506
|
-
...restProps
|
|
507
|
-
}) => {
|
|
508
|
-
const colorClasses = {
|
|
509
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
510
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
511
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
512
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
513
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
514
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
515
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
516
|
-
transparent: "bg-transparent"
|
|
517
|
-
}[color];
|
|
518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
519
|
-
"button",
|
|
520
|
-
{
|
|
521
|
-
onClick: disabled ? void 0 : onClick,
|
|
522
|
-
disabled: disabled || onClick === void 0,
|
|
523
|
-
className: (0, import_clsx3.default)(
|
|
524
|
-
{
|
|
525
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
526
|
-
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
527
|
-
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
528
|
-
[(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
529
|
-
},
|
|
530
|
-
ButtonUtil.iconPaddingMapping[size],
|
|
531
|
-
className
|
|
532
|
-
),
|
|
533
|
-
...restProps,
|
|
534
|
-
children
|
|
535
|
-
}
|
|
536
|
-
);
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
// src/hooks/useSearch.ts
|
|
540
|
-
var import_react7 = require("react");
|
|
541
|
-
|
|
542
|
-
// src/util/simpleSearch.ts
|
|
543
|
-
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
544
|
-
return objects.filter((object) => {
|
|
545
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
546
|
-
if (!mappedSearchKeywords) {
|
|
547
|
-
return true;
|
|
548
|
-
}
|
|
549
|
-
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
550
|
-
});
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
// src/hooks/useSearch.ts
|
|
554
|
-
var useSearch = ({
|
|
555
|
-
list,
|
|
556
|
-
initialSearch,
|
|
557
|
-
searchMapping
|
|
558
|
-
}) => {
|
|
559
|
-
const [items, setItems] = (0, import_react7.useState)(list);
|
|
560
|
-
const [search, setSearch] = (0, import_react7.useState)(initialSearch);
|
|
561
|
-
(0, import_react7.useEffect)(() => {
|
|
562
|
-
setItems(list);
|
|
563
|
-
}, [list]);
|
|
564
|
-
const result = (0, import_react7.useMemo)(
|
|
565
|
-
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
566
|
-
[search, items, searchMapping]
|
|
567
|
-
);
|
|
568
|
-
return {
|
|
569
|
-
result,
|
|
570
|
-
hasResult: result.length > 0,
|
|
571
|
-
allItems: items,
|
|
572
|
-
setItems,
|
|
573
|
-
search,
|
|
574
|
-
setSearch
|
|
575
|
-
};
|
|
576
|
-
};
|
|
577
|
-
|
|
578
764
|
// src/localization/defaults/form.ts
|
|
579
765
|
var formTranslation = {
|
|
580
766
|
en: {
|
|
767
|
+
add: "Add",
|
|
581
768
|
all: "All",
|
|
582
769
|
apply: "Apply",
|
|
583
770
|
back: "Back",
|
|
@@ -590,6 +777,7 @@ var formTranslation = {
|
|
|
590
777
|
confirm: "Confirm",
|
|
591
778
|
copy: "Copy",
|
|
592
779
|
copied: "Copied",
|
|
780
|
+
create: "Create",
|
|
593
781
|
decline: "Decline",
|
|
594
782
|
delete: "Delete",
|
|
595
783
|
discard: "Discard",
|
|
@@ -632,6 +820,7 @@ var formTranslation = {
|
|
|
632
820
|
yes: "Yes"
|
|
633
821
|
},
|
|
634
822
|
de: {
|
|
823
|
+
add: "Hinzuf\xFCgen",
|
|
635
824
|
all: "Alle",
|
|
636
825
|
apply: "Anwenden",
|
|
637
826
|
back: "Zur\xFCck",
|
|
@@ -644,6 +833,7 @@ var formTranslation = {
|
|
|
644
833
|
confirm: "Best\xE4tigen",
|
|
645
834
|
copy: "Kopieren",
|
|
646
835
|
copied: "Kopiert",
|
|
836
|
+
create: "Erstellen",
|
|
647
837
|
decline: "Ablehnen",
|
|
648
838
|
delete: "L\xF6schen",
|
|
649
839
|
discard: "Verwerfen",
|
|
@@ -687,241 +877,346 @@ var formTranslation = {
|
|
|
687
877
|
}
|
|
688
878
|
};
|
|
689
879
|
|
|
690
|
-
// src/components/
|
|
691
|
-
var
|
|
692
|
-
var
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
880
|
+
// src/components/user-action/Button.tsx
|
|
881
|
+
var import_react11 = require("react");
|
|
882
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
883
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
884
|
+
var ButtonColorUtil = {
|
|
885
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
886
|
+
text: ["primary", "negative", "neutral"],
|
|
887
|
+
outline: ["primary"]
|
|
888
|
+
};
|
|
889
|
+
var IconButtonUtil = {
|
|
890
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
891
|
+
};
|
|
892
|
+
var paddingMapping = {
|
|
893
|
+
small: "btn-sm",
|
|
894
|
+
medium: "btn-md",
|
|
895
|
+
large: "btn-lg"
|
|
896
|
+
};
|
|
897
|
+
var iconPaddingMapping = {
|
|
898
|
+
tiny: "icon-btn-xs",
|
|
899
|
+
small: "icon-btn-sm",
|
|
900
|
+
medium: "icon-btn-md",
|
|
901
|
+
large: "icon-btn-lg"
|
|
902
|
+
};
|
|
903
|
+
var ButtonUtil = {
|
|
904
|
+
paddingMapping,
|
|
905
|
+
iconPaddingMapping
|
|
699
906
|
};
|
|
700
|
-
var
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
907
|
+
var SolidButton = (0, import_react11.forwardRef)(function SolidButton2({
|
|
908
|
+
children,
|
|
909
|
+
disabled = false,
|
|
910
|
+
color = "primary",
|
|
911
|
+
size = "medium",
|
|
912
|
+
startIcon,
|
|
913
|
+
endIcon,
|
|
914
|
+
onClick,
|
|
708
915
|
className,
|
|
709
|
-
|
|
710
|
-
})
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
916
|
+
...restProps
|
|
917
|
+
}, ref) {
|
|
918
|
+
const colorClasses = {
|
|
919
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
920
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
921
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
922
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
923
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
924
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
925
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
926
|
+
}[color];
|
|
927
|
+
const iconColorClasses = {
|
|
928
|
+
primary: "text-button-solid-primary-icon",
|
|
929
|
+
secondary: "text-button-solid-secondary-icon",
|
|
930
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
931
|
+
positive: "text-button-solid-positive-icon",
|
|
932
|
+
warning: "text-button-solid-warning-icon",
|
|
933
|
+
negative: "text-button-solid-negative-icon",
|
|
934
|
+
neutral: "text-button-solid-neutral-icon"
|
|
935
|
+
}[color];
|
|
936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
937
|
+
"button",
|
|
938
|
+
{
|
|
939
|
+
ref,
|
|
940
|
+
onClick,
|
|
941
|
+
disabled,
|
|
942
|
+
className: (0, import_clsx6.default)(
|
|
717
943
|
{
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
}
|
|
944
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
945
|
+
[(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
946
|
+
},
|
|
947
|
+
ButtonUtil.paddingMapping[size],
|
|
948
|
+
className
|
|
724
949
|
),
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
950
|
+
...restProps,
|
|
951
|
+
children: [
|
|
952
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
953
|
+
"span",
|
|
954
|
+
{
|
|
955
|
+
className: (0, import_clsx6.default)({
|
|
956
|
+
[iconColorClasses]: !disabled,
|
|
957
|
+
[`text-disabled-icon`]: disabled
|
|
958
|
+
}),
|
|
959
|
+
children: startIcon
|
|
960
|
+
}
|
|
961
|
+
),
|
|
962
|
+
children,
|
|
963
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
964
|
+
"span",
|
|
965
|
+
{
|
|
966
|
+
className: (0, import_clsx6.default)({
|
|
967
|
+
[iconColorClasses]: !disabled,
|
|
968
|
+
[`text-disabled-icon`]: disabled
|
|
969
|
+
}),
|
|
970
|
+
children: endIcon
|
|
971
|
+
}
|
|
972
|
+
)
|
|
973
|
+
]
|
|
974
|
+
}
|
|
975
|
+
);
|
|
976
|
+
});
|
|
977
|
+
var IconButton = ({
|
|
978
|
+
children,
|
|
979
|
+
disabled = false,
|
|
980
|
+
color = "primary",
|
|
981
|
+
size = "medium",
|
|
982
|
+
className,
|
|
983
|
+
...restProps
|
|
747
984
|
}) => {
|
|
748
|
-
|
|
749
|
-
"
|
|
985
|
+
const colorClasses = {
|
|
986
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
987
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
988
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
989
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
990
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
991
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
992
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
993
|
+
transparent: "bg-transparent"
|
|
994
|
+
}[color];
|
|
995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
996
|
+
"button",
|
|
750
997
|
{
|
|
751
|
-
|
|
752
|
-
|
|
998
|
+
disabled,
|
|
999
|
+
className: (0, import_clsx6.default)(
|
|
753
1000
|
{
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
1001
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
1002
|
+
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
1003
|
+
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
1004
|
+
[(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
|
|
757
1005
|
},
|
|
1006
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
758
1007
|
className
|
|
759
1008
|
),
|
|
760
|
-
|
|
761
|
-
children
|
|
762
|
-
prefix,
|
|
763
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "col gap-y-0 w-full", children: [
|
|
764
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { className: (0, import_clsx5.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
765
|
-
!!description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_clsx5.default)(description.className ?? "textstyle-description"), children: description.value })
|
|
766
|
-
] }),
|
|
767
|
-
suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { size: 24 }) : void 0)
|
|
768
|
-
]
|
|
1009
|
+
...restProps,
|
|
1010
|
+
children
|
|
769
1011
|
}
|
|
770
1012
|
);
|
|
771
1013
|
};
|
|
772
1014
|
|
|
773
|
-
// src/
|
|
774
|
-
var
|
|
775
|
-
var
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
1015
|
+
// src/components/user-action/SearchBar.tsx
|
|
1016
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1017
|
+
var import_clsx7 = require("clsx");
|
|
1018
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1019
|
+
var SearchBar = ({
|
|
1020
|
+
placeholder,
|
|
1021
|
+
onSearch,
|
|
1022
|
+
disableOnSearch,
|
|
1023
|
+
containerClassName,
|
|
1024
|
+
...inputProps
|
|
1025
|
+
}) => {
|
|
1026
|
+
const translation = useTranslation([formTranslation]);
|
|
1027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.clsx)("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1029
|
+
Input,
|
|
1030
|
+
{
|
|
1031
|
+
...inputProps,
|
|
1032
|
+
placeholder: placeholder ?? translation("search")
|
|
781
1033
|
}
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
1034
|
+
),
|
|
1035
|
+
onSearch && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Search, { className: "w-full h-full" }) })
|
|
1036
|
+
] });
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
// src/hooks/useSearch.ts
|
|
1040
|
+
var import_react12 = require("react");
|
|
1041
|
+
|
|
1042
|
+
// src/util/simpleSearch.ts
|
|
1043
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
1044
|
+
return objects.filter((object) => {
|
|
1045
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
1046
|
+
if (!mappedSearchKeywords) {
|
|
1047
|
+
return true;
|
|
1048
|
+
}
|
|
1049
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
1050
|
+
});
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
// src/hooks/useSearch.ts
|
|
1054
|
+
var useSearch = ({
|
|
1055
|
+
list,
|
|
1056
|
+
initialSearch,
|
|
1057
|
+
searchMapping,
|
|
1058
|
+
additionalSearchTags,
|
|
1059
|
+
isSearchInstant = true,
|
|
1060
|
+
sortingFunction,
|
|
1061
|
+
filter,
|
|
1062
|
+
disabled = false
|
|
1063
|
+
}) => {
|
|
1064
|
+
const [search, setSearch] = (0, import_react12.useState)(initialSearch ?? "");
|
|
1065
|
+
const [result, setResult] = (0, import_react12.useState)(list);
|
|
1066
|
+
const searchTags = (0, import_react12.useMemo)(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1067
|
+
const updateSearch = (0, import_react12.useCallback)((newSearch) => {
|
|
1068
|
+
const usedSearch = newSearch ?? search;
|
|
1069
|
+
if (newSearch) {
|
|
1070
|
+
setSearch(search);
|
|
1071
|
+
}
|
|
1072
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1073
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1074
|
+
(0, import_react12.useEffect)(() => {
|
|
1075
|
+
if (isSearchInstant) {
|
|
1076
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1077
|
+
}
|
|
1078
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1079
|
+
const filteredResult = (0, import_react12.useMemo)(() => {
|
|
1080
|
+
if (!filter) {
|
|
1081
|
+
return result;
|
|
1082
|
+
}
|
|
1083
|
+
return result.filter(filter);
|
|
1084
|
+
}, [result, filter]);
|
|
1085
|
+
const sortedAndFilteredResult = (0, import_react12.useMemo)(() => {
|
|
1086
|
+
if (!sortingFunction) {
|
|
1087
|
+
return filteredResult;
|
|
1088
|
+
}
|
|
1089
|
+
return filteredResult.sort(sortingFunction);
|
|
1090
|
+
}, [filteredResult, sortingFunction]);
|
|
1091
|
+
const usedResult = (0, import_react12.useMemo)(() => {
|
|
1092
|
+
if (!disabled) {
|
|
1093
|
+
return sortedAndFilteredResult;
|
|
1094
|
+
}
|
|
1095
|
+
return list;
|
|
1096
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
1097
|
+
return {
|
|
1098
|
+
result: usedResult,
|
|
1099
|
+
hasResult: usedResult.length > 0,
|
|
1100
|
+
allItems: list,
|
|
1101
|
+
updateSearch,
|
|
1102
|
+
search,
|
|
1103
|
+
setSearch
|
|
1104
|
+
};
|
|
791
1105
|
};
|
|
792
1106
|
|
|
793
1107
|
// src/components/user-action/Select.tsx
|
|
794
|
-
var
|
|
1108
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1109
|
+
var SelectTile = ({
|
|
1110
|
+
className,
|
|
1111
|
+
disabledClassName,
|
|
1112
|
+
title,
|
|
1113
|
+
...restProps
|
|
1114
|
+
}) => {
|
|
1115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1116
|
+
Tile,
|
|
1117
|
+
{
|
|
1118
|
+
...restProps,
|
|
1119
|
+
className: (0, import_clsx8.default)("px-2 py-1 rounded-md", className),
|
|
1120
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1121
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
1122
|
+
}
|
|
1123
|
+
);
|
|
1124
|
+
};
|
|
795
1125
|
var Select = ({
|
|
796
1126
|
value,
|
|
797
1127
|
label,
|
|
798
1128
|
options,
|
|
799
1129
|
onChange,
|
|
800
1130
|
hintText = "",
|
|
801
|
-
|
|
802
|
-
|
|
1131
|
+
selectedDisplayOverwrite,
|
|
1132
|
+
searchOptions,
|
|
1133
|
+
additionalItems,
|
|
803
1134
|
className,
|
|
804
|
-
|
|
1135
|
+
triggerClassName,
|
|
1136
|
+
hintTextClassName,
|
|
1137
|
+
...menuProps
|
|
805
1138
|
}) => {
|
|
806
|
-
const triggerRef = (0, import_react9.useRef)(null);
|
|
807
|
-
const menuRef = (0, import_react9.useRef)(null);
|
|
808
|
-
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
809
|
-
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
810
1139
|
const selectedOption = options.find((option) => option.value === value);
|
|
811
1140
|
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
812
1141
|
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");
|
|
813
1142
|
}
|
|
814
1143
|
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1144
|
+
const { result, search, setSearch } = useSearch({
|
|
1145
|
+
list: options,
|
|
1146
|
+
searchMapping: (0, import_react13.useCallback)((item) => item.searchTags, []),
|
|
1147
|
+
...searchOptions
|
|
1148
|
+
});
|
|
1149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_clsx8.default)(className), children: [
|
|
1150
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx8.default)("mb-1", label.className) }),
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1152
|
+
Menu,
|
|
1153
|
+
{
|
|
1154
|
+
...menuProps,
|
|
1155
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1156
|
+
"button",
|
|
1157
|
+
{
|
|
1158
|
+
ref,
|
|
1159
|
+
className: (0, import_clsx8.default)(
|
|
1160
|
+
"btn-md justify-between w-full border-2",
|
|
1161
|
+
{
|
|
1162
|
+
"rounded-b-lg": !open,
|
|
1163
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1164
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1165
|
+
},
|
|
1166
|
+
triggerClassName
|
|
1167
|
+
),
|
|
1168
|
+
onClick: toggleOpen,
|
|
1169
|
+
disabled,
|
|
1170
|
+
children: [
|
|
1171
|
+
!isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
1172
|
+
isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: (0, import_clsx8.default)("textstyle-description", hintTextClassName), children: hintText }),
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ExpansionIcon, { isExpanded: isOpen })
|
|
1174
|
+
]
|
|
1175
|
+
}
|
|
1176
|
+
),
|
|
1177
|
+
menuClassName: (0, import_clsx8.default)("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1178
|
+
children: (bag) => {
|
|
1179
|
+
const { close } = bag;
|
|
1180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1181
|
+
!searchOptions?.disabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1182
|
+
SearchBar,
|
|
1183
|
+
{
|
|
1184
|
+
value: search,
|
|
1185
|
+
onChangeText: setSearch,
|
|
1186
|
+
autoFocus: true
|
|
1187
|
+
}
|
|
1188
|
+
),
|
|
1189
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1190
|
+
result.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1191
|
+
SelectTile,
|
|
852
1192
|
{
|
|
853
|
-
isSelected:
|
|
854
|
-
|
|
855
|
-
disabledClassName: "text-disabled-text cursor-not-allowed",
|
|
856
|
-
title: { value: option.label, className: "font-semibold" },
|
|
1193
|
+
isSelected: option === selectedOption,
|
|
1194
|
+
title: { value: option.label },
|
|
857
1195
|
onClick: () => {
|
|
858
1196
|
onChange(option.value);
|
|
859
|
-
|
|
1197
|
+
close();
|
|
860
1198
|
},
|
|
861
|
-
|
|
1199
|
+
disabled: option.disabled
|
|
862
1200
|
},
|
|
863
1201
|
index
|
|
864
|
-
)
|
|
865
|
-
|
|
866
|
-
|
|
1202
|
+
)),
|
|
1203
|
+
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1204
|
+
] })
|
|
1205
|
+
] });
|
|
867
1206
|
}
|
|
868
|
-
|
|
869
|
-
|
|
1207
|
+
}
|
|
1208
|
+
)
|
|
870
1209
|
] });
|
|
871
1210
|
};
|
|
872
1211
|
|
|
873
1212
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
874
|
-
var
|
|
875
|
-
var
|
|
876
|
-
var
|
|
877
|
-
|
|
878
|
-
// src/hooks/useHoverState.ts
|
|
879
|
-
var import_react10 = require("react");
|
|
880
|
-
var defaultUseHoverStateProps = {
|
|
881
|
-
closingDelay: 200,
|
|
882
|
-
isDisabled: false
|
|
883
|
-
};
|
|
884
|
-
var useHoverState = (props = void 0) => {
|
|
885
|
-
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
886
|
-
const [isHovered, setIsHovered] = (0, import_react10.useState)(false);
|
|
887
|
-
const [timer, setTimer] = (0, import_react10.useState)();
|
|
888
|
-
const onMouseEnter = () => {
|
|
889
|
-
if (isDisabled) {
|
|
890
|
-
return;
|
|
891
|
-
}
|
|
892
|
-
clearTimeout(timer);
|
|
893
|
-
setIsHovered(true);
|
|
894
|
-
};
|
|
895
|
-
const onMouseLeave = () => {
|
|
896
|
-
if (isDisabled) {
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
setTimer(setTimeout(() => {
|
|
900
|
-
setIsHovered(false);
|
|
901
|
-
}, closingDelay));
|
|
902
|
-
};
|
|
903
|
-
(0, import_react10.useEffect)(() => {
|
|
904
|
-
if (timer) {
|
|
905
|
-
return () => {
|
|
906
|
-
clearTimeout(timer);
|
|
907
|
-
};
|
|
908
|
-
}
|
|
909
|
-
});
|
|
910
|
-
(0, import_react10.useEffect)(() => {
|
|
911
|
-
if (timer) {
|
|
912
|
-
clearTimeout(timer);
|
|
913
|
-
}
|
|
914
|
-
}, [isDisabled]);
|
|
915
|
-
return {
|
|
916
|
-
isHovered,
|
|
917
|
-
setIsHovered,
|
|
918
|
-
handlers: { onMouseEnter, onMouseLeave }
|
|
919
|
-
};
|
|
920
|
-
};
|
|
1213
|
+
var import_react15 = require("react");
|
|
1214
|
+
var import_react_dom2 = __toESM(require("react-dom"));
|
|
1215
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
921
1216
|
|
|
922
1217
|
// src/components/user-action/Tooltip.tsx
|
|
923
|
-
var
|
|
924
|
-
var
|
|
1218
|
+
var import_clsx9 = require("clsx");
|
|
1219
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
925
1220
|
var Tooltip = ({
|
|
926
1221
|
tooltip,
|
|
927
1222
|
children,
|
|
@@ -951,17 +1246,17 @@ var Tooltip = ({
|
|
|
951
1246
|
left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
|
|
952
1247
|
right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
|
|
953
1248
|
};
|
|
954
|
-
return /* @__PURE__ */ (0,
|
|
1249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
955
1250
|
"div",
|
|
956
1251
|
{
|
|
957
|
-
className: (0,
|
|
1252
|
+
className: (0, import_clsx9.clsx)("relative inline-block", containerClassName),
|
|
958
1253
|
...handlers,
|
|
959
1254
|
children: [
|
|
960
1255
|
children,
|
|
961
|
-
isHovered && /* @__PURE__ */ (0,
|
|
1256
|
+
isHovered && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
962
1257
|
"div",
|
|
963
1258
|
{
|
|
964
|
-
className: (0,
|
|
1259
|
+
className: (0, import_clsx9.clsx)(
|
|
965
1260
|
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
966
1261
|
animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
|
|
967
1262
|
positionClasses[position],
|
|
@@ -970,10 +1265,10 @@ var Tooltip = ({
|
|
|
970
1265
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
971
1266
|
children: [
|
|
972
1267
|
tooltip,
|
|
973
|
-
/* @__PURE__ */ (0,
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
974
1269
|
"div",
|
|
975
1270
|
{
|
|
976
|
-
className: (0,
|
|
1271
|
+
className: (0, import_clsx9.clsx)(`absolute w-0 h-0`, triangleClasses[position]),
|
|
977
1272
|
style: { ...triangleStyle[position], zIndex: zIndex + 1 }
|
|
978
1273
|
}
|
|
979
1274
|
)
|
|
@@ -987,24 +1282,24 @@ var Tooltip = ({
|
|
|
987
1282
|
|
|
988
1283
|
// src/components/layout-and-navigation/Overlay.tsx
|
|
989
1284
|
var import_lucide_react4 = require("lucide-react");
|
|
990
|
-
var
|
|
1285
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
991
1286
|
var Overlay = ({
|
|
992
1287
|
children,
|
|
993
1288
|
isOpen,
|
|
994
1289
|
onBackgroundClick,
|
|
995
1290
|
backgroundClassName
|
|
996
1291
|
}) => {
|
|
997
|
-
const [root, setRoot] = (0,
|
|
998
|
-
(0,
|
|
1292
|
+
const [root, setRoot] = (0, import_react15.useState)();
|
|
1293
|
+
(0, import_react15.useEffect)(() => {
|
|
999
1294
|
setRoot(document.body);
|
|
1000
1295
|
}, []);
|
|
1001
1296
|
if (!root || !isOpen) return null;
|
|
1002
|
-
return
|
|
1003
|
-
/* @__PURE__ */ (0,
|
|
1004
|
-
/* @__PURE__ */ (0,
|
|
1297
|
+
return import_react_dom2.default.createPortal(
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: (0, import_clsx10.default)("fixed inset-0 z-[9999]"), children: [
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1005
1300
|
"div",
|
|
1006
1301
|
{
|
|
1007
|
-
className: (0,
|
|
1302
|
+
className: (0, import_clsx10.default)("fixed inset-0 h-screen w-screen bg-overlay-shadow", backgroundClassName),
|
|
1008
1303
|
onClick: onBackgroundClick
|
|
1009
1304
|
}
|
|
1010
1305
|
),
|
|
@@ -1032,21 +1327,21 @@ var OverlayHeader = ({
|
|
|
1032
1327
|
}) => {
|
|
1033
1328
|
const translation = useTranslation([defaultModalHeaderTranslation], overwriteTranslation);
|
|
1034
1329
|
const hasTitleRow = !!title || !!titleText || !!onClose;
|
|
1035
|
-
const titleRow = /* @__PURE__ */ (0,
|
|
1036
|
-
title ?? /* @__PURE__ */ (0,
|
|
1330
|
+
const titleRow = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex-row-8 justify-between items-start", children: [
|
|
1331
|
+
title ?? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1037
1332
|
"h2",
|
|
1038
1333
|
{
|
|
1039
|
-
className: (0,
|
|
1334
|
+
className: (0, import_clsx10.default)("textstyle-title-lg", {
|
|
1040
1335
|
"mb-1": description || descriptionText
|
|
1041
1336
|
}),
|
|
1042
1337
|
children: titleText
|
|
1043
1338
|
}
|
|
1044
1339
|
),
|
|
1045
|
-
!!onClose && /* @__PURE__ */ (0,
|
|
1340
|
+
!!onClose && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Tooltip, { tooltip: translation("close"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { color: "neutral", size: "small", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.X, { className: "w-full h-full" }) }) })
|
|
1046
1341
|
] });
|
|
1047
|
-
return /* @__PURE__ */ (0,
|
|
1342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex-col-2", children: [
|
|
1048
1343
|
hasTitleRow && titleRow,
|
|
1049
|
-
description ?? (descriptionText && /* @__PURE__ */ (0,
|
|
1344
|
+
description ?? (descriptionText && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "textstyle-description", children: descriptionText }))
|
|
1050
1345
|
] });
|
|
1051
1346
|
};
|
|
1052
1347
|
var Modal = ({
|
|
@@ -1057,8 +1352,8 @@ var Modal = ({
|
|
|
1057
1352
|
backgroundClassName,
|
|
1058
1353
|
headerProps
|
|
1059
1354
|
}) => {
|
|
1060
|
-
const ref = (0,
|
|
1061
|
-
(0,
|
|
1355
|
+
const ref = (0, import_react15.useRef)(null);
|
|
1356
|
+
(0, import_react15.useEffect)(() => {
|
|
1062
1357
|
if (!isOpen) return;
|
|
1063
1358
|
const modal = ref.current;
|
|
1064
1359
|
if (!modal) {
|
|
@@ -1095,25 +1390,25 @@ var Modal = ({
|
|
|
1095
1390
|
overlayStack = overlayStack.filter((m) => m !== modal);
|
|
1096
1391
|
};
|
|
1097
1392
|
}, [isOpen, onClose]);
|
|
1098
|
-
return /* @__PURE__ */ (0,
|
|
1393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1099
1394
|
Overlay,
|
|
1100
1395
|
{
|
|
1101
1396
|
isOpen,
|
|
1102
1397
|
onBackgroundClick: onClose,
|
|
1103
1398
|
backgroundClassName,
|
|
1104
|
-
children: /* @__PURE__ */ (0,
|
|
1399
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1105
1400
|
"div",
|
|
1106
1401
|
{
|
|
1107
1402
|
ref,
|
|
1108
1403
|
tabIndex: -1,
|
|
1109
|
-
className: (0,
|
|
1110
|
-
"fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2
|
|
1404
|
+
className: (0, import_clsx10.default)(
|
|
1405
|
+
"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",
|
|
1111
1406
|
className
|
|
1112
1407
|
),
|
|
1113
1408
|
role: "dialog",
|
|
1114
1409
|
"aria-modal": true,
|
|
1115
1410
|
children: [
|
|
1116
|
-
/* @__PURE__ */ (0,
|
|
1411
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(OverlayHeader, { ...headerProps, onClose }),
|
|
1117
1412
|
children
|
|
1118
1413
|
]
|
|
1119
1414
|
}
|
|
@@ -1123,8 +1418,8 @@ var Modal = ({
|
|
|
1123
1418
|
};
|
|
1124
1419
|
|
|
1125
1420
|
// src/theming/useTheme.tsx
|
|
1126
|
-
var
|
|
1127
|
-
var
|
|
1421
|
+
var import_react16 = require("react");
|
|
1422
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1128
1423
|
var themes = ["light", "dark"];
|
|
1129
1424
|
var defaultThemeTypeTranslation = {
|
|
1130
1425
|
en: {
|
|
@@ -1148,14 +1443,14 @@ var ThemeUtil = {
|
|
|
1148
1443
|
themes,
|
|
1149
1444
|
translation: defaultThemeTypeTranslation
|
|
1150
1445
|
};
|
|
1151
|
-
var ThemeContext = (0,
|
|
1446
|
+
var ThemeContext = (0, import_react16.createContext)({
|
|
1152
1447
|
theme: "light",
|
|
1153
1448
|
setTheme: noop
|
|
1154
1449
|
});
|
|
1155
|
-
var useTheme = () => (0,
|
|
1450
|
+
var useTheme = () => (0, import_react16.useContext)(ThemeContext);
|
|
1156
1451
|
|
|
1157
1452
|
// src/components/modals/ThemeModal.tsx
|
|
1158
|
-
var
|
|
1453
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1159
1454
|
var defaultConfirmDialogTranslation = {
|
|
1160
1455
|
en: {
|
|
1161
1456
|
chooseTheme: "Choose your preferred theme"
|
|
@@ -1172,7 +1467,7 @@ var ThemeModal = ({
|
|
|
1172
1467
|
}) => {
|
|
1173
1468
|
const { theme, setTheme } = useTheme();
|
|
1174
1469
|
const translation = useTranslation([defaultConfirmDialogTranslation, formTranslation, ThemeUtil.translation], overwriteTranslation);
|
|
1175
|
-
return /* @__PURE__ */ (0,
|
|
1470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1176
1471
|
Modal,
|
|
1177
1472
|
{
|
|
1178
1473
|
headerProps: {
|
|
@@ -1182,8 +1477,8 @@ var ThemeModal = ({
|
|
|
1182
1477
|
},
|
|
1183
1478
|
onClose,
|
|
1184
1479
|
...modalProps,
|
|
1185
|
-
children: /* @__PURE__ */ (0,
|
|
1186
|
-
/* @__PURE__ */ (0,
|
|
1480
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w-64", children: [
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1187
1482
|
Select,
|
|
1188
1483
|
{
|
|
1189
1484
|
className: "mt-2",
|
|
@@ -1192,7 +1487,7 @@ var ThemeModal = ({
|
|
|
1192
1487
|
onChange: (theme2) => setTheme(theme2)
|
|
1193
1488
|
}
|
|
1194
1489
|
),
|
|
1195
|
-
/* @__PURE__ */ (0,
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex-row-4 mt-3 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation("done") }) })
|
|
1196
1491
|
] })
|
|
1197
1492
|
}
|
|
1198
1493
|
);
|