@helpwave/hightide 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/branding/HelpwaveBadge.js +7 -7
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +7 -7
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +65 -38
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +54 -27
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js +3 -3
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +3 -3
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +4 -4
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +4 -4
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +46 -19
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +44 -17
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +32 -28
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.js +2 -2
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Ring.js +2 -2
- package/dist/components/icons-and-geometry/Ring.js.map +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs +2 -2
- package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +84 -15
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.js +1 -1
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +7 -1
- package/dist/components/layout-and-navigation/Expandable.d.ts +7 -1
- package/dist/components/layout-and-navigation/Expandable.js +36 -9
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +36 -10
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +34 -11
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +36 -13
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +92 -19
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +82 -10
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +79 -7
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +127 -26
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +126 -25
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +22 -16
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +7 -3
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
- package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
- package/dist/components/layout-and-navigation/Tile.js +7 -7
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +7 -7
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +5 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +8 -6
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +8 -6
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +32 -28
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +18 -14
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +28 -24
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +18 -14
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +32 -29
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +18 -15
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +728 -435
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +728 -431
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +732 -439
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +731 -434
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +110 -35
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +110 -35
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +118 -42
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +114 -38
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
- package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
- package/dist/components/properties/MultiSelectProperty.js +915 -464
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +920 -465
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +101 -19
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +101 -19
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +103 -20
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +99 -16
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +9 -2
- package/dist/components/properties/SelectProperty.d.ts +9 -2
- package/dist/components/properties/SelectProperty.js +682 -244
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +686 -244
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +133 -47
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +133 -47
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +285 -186
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +270 -167
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +179 -79
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +160 -56
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +72 -3
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +72 -3
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +15 -2
- package/dist/components/user-action/Button.d.ts +15 -2
- package/dist/components/user-action/Button.js +12 -12
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +12 -12
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +6 -15
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +6 -15
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +79 -48
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +65 -34
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Input.js +0 -1
- package/dist/components/user-action/Input.js.map +1 -1
- package/dist/components/user-action/Input.mjs +0 -1
- package/dist/components/user-action/Input.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +11 -6
- package/dist/components/user-action/Menu.d.ts +11 -6
- package/dist/components/user-action/Menu.js +128 -31
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +134 -33
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +17 -7
- package/dist/components/user-action/MultiSelect.d.ts +17 -7
- package/dist/components/user-action/MultiSelect.js +796 -376
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +781 -357
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +2 -2
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +2 -2
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.d.mts +14 -0
- package/dist/components/user-action/SearchBar.d.ts +14 -0
- package/dist/components/user-action/SearchBar.js +673 -0
- package/dist/components/user-action/SearchBar.js.map +1 -0
- package/dist/components/user-action/SearchBar.mjs +637 -0
- package/dist/components/user-action/SearchBar.mjs.map +1 -0
- package/dist/components/user-action/Select.d.mts +18 -5
- package/dist/components/user-action/Select.d.ts +18 -5
- package/dist/components/user-action/Select.js +764 -356
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +761 -350
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +1 -1
- package/dist/components/user-action/Textarea.d.ts +1 -1
- package/dist/components/user-action/Textarea.js +13 -4
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +13 -4
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.js +2 -3
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +2 -3
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +251 -113
- package/dist/css/uncompiled/globals.css +19 -13
- package/dist/css/uncompiled/theme/colors-component.css +12 -3
- package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
- package/dist/css/uncompiled/utitlity/animation.css +70 -1
- package/dist/css/uncompiled/utitlity/general.css +16 -0
- package/dist/hooks/useDelay.js +0 -1
- package/dist/hooks/useDelay.js.map +1 -1
- package/dist/hooks/useDelay.mjs +0 -1
- package/dist/hooks/useDelay.mjs.map +1 -1
- package/dist/hooks/usePopoverPosition.d.mts +15 -0
- package/dist/hooks/usePopoverPosition.d.ts +15 -0
- package/dist/hooks/usePopoverPosition.js +81 -0
- package/dist/hooks/usePopoverPosition.js.map +1 -0
- package/dist/hooks/usePopoverPosition.mjs +57 -0
- package/dist/hooks/usePopoverPosition.mjs.map +1 -0
- package/dist/hooks/useSearch.d.mts +7 -2
- package/dist/hooks/useSearch.d.ts +7 -2
- package/dist/hooks/useSearch.js +44 -15
- package/dist/hooks/useSearch.js.map +1 -1
- package/dist/hooks/useSearch.mjs +45 -16
- package/dist/hooks/useSearch.mjs.map +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1102 -820
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1001 -719
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +2 -0
- package/dist/localization/defaults/form.d.ts +2 -0
- package/dist/localization/defaults/form.js +4 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +4 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/simpleSearch.d.mts +1 -1
- package/dist/util/simpleSearch.d.ts +1 -1
- package/dist/util/simpleSearch.js +4 -1
- package/dist/util/simpleSearch.js.map +1 -1
- package/dist/util/simpleSearch.mjs +4 -1
- package/dist/util/simpleSearch.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/components/user-action/MultiSelect.tsx
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useCallback as useCallback6 } from "react";
|
|
3
|
+
import { useEffect as useEffect12, useState as useState11 } from "react";
|
|
4
4
|
|
|
5
5
|
// src/localization/LanguageProvider.tsx
|
|
6
6
|
import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -90,7 +90,7 @@ var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
// src/components/user-action/MultiSelect.tsx
|
|
93
|
-
import
|
|
93
|
+
import clsx11 from "clsx";
|
|
94
94
|
|
|
95
95
|
// src/components/user-action/Label.tsx
|
|
96
96
|
import clsx from "clsx";
|
|
@@ -110,22 +110,393 @@ var Label = ({
|
|
|
110
110
|
return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
// src/components/
|
|
114
|
-
import {
|
|
113
|
+
// src/components/user-action/Select.tsx
|
|
114
|
+
import { useCallback as useCallback5 } from "react";
|
|
115
|
+
import { useEffect as useEffect11, useState as useState9 } from "react";
|
|
116
|
+
import clsx8 from "clsx";
|
|
117
|
+
|
|
118
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
119
|
+
import clsx2 from "clsx";
|
|
120
|
+
import { Check } from "lucide-react";
|
|
121
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
122
|
+
var Tile = ({
|
|
123
|
+
title,
|
|
124
|
+
description,
|
|
125
|
+
onClick,
|
|
126
|
+
isSelected = false,
|
|
127
|
+
disabled = false,
|
|
128
|
+
prefix,
|
|
129
|
+
suffix,
|
|
130
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
131
|
+
selectedClassName = " bg-primary/20",
|
|
132
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
133
|
+
className
|
|
134
|
+
}) => {
|
|
135
|
+
return /* @__PURE__ */ jsxs(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
className: clsx2(
|
|
139
|
+
"flex-row-2 w-full items-center",
|
|
140
|
+
{
|
|
141
|
+
[normalClassName]: !!onClick && !disabled,
|
|
142
|
+
[selectedClassName]: isSelected && !disabled,
|
|
143
|
+
[disabledClassName]: disabled
|
|
144
|
+
},
|
|
145
|
+
className
|
|
146
|
+
),
|
|
147
|
+
onClick: disabled ? void 0 : onClick,
|
|
148
|
+
children: [
|
|
149
|
+
prefix,
|
|
150
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-col-0 w-full", children: [
|
|
151
|
+
/* @__PURE__ */ jsx3("h4", { className: clsx2(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
152
|
+
!!description && /* @__PURE__ */ jsx3("span", { className: clsx2(description.className ?? "textstyle-description"), children: description.value })
|
|
153
|
+
] }),
|
|
154
|
+
suffix ?? (isSelected ? /* @__PURE__ */ jsx3(Check, { size: 24 }) : void 0)
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
161
|
+
import { forwardRef, useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
|
|
162
|
+
import { ChevronDown } from "lucide-react";
|
|
163
|
+
import clsx3 from "clsx";
|
|
164
|
+
|
|
165
|
+
// src/util/noop.ts
|
|
166
|
+
var noop = () => void 0;
|
|
167
|
+
|
|
168
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
169
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
170
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
171
|
+
return /* @__PURE__ */ jsx4(
|
|
172
|
+
ChevronDown,
|
|
173
|
+
{
|
|
174
|
+
className: clsx3(
|
|
175
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
|
|
176
|
+
{ "rotate-180": isExpanded },
|
|
177
|
+
className
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
var Expandable = forwardRef(function Expandable2({
|
|
183
|
+
children,
|
|
184
|
+
label,
|
|
185
|
+
icon,
|
|
186
|
+
isExpanded = false,
|
|
187
|
+
onChange = noop,
|
|
188
|
+
clickOnlyOnHeader = true,
|
|
189
|
+
disabled = false,
|
|
190
|
+
className,
|
|
191
|
+
headerClassName,
|
|
192
|
+
contentClassName
|
|
193
|
+
}, ref) {
|
|
194
|
+
const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx4(ExpansionIcon, { isExpanded: expanded }), []);
|
|
195
|
+
icon ??= defaultIcon;
|
|
196
|
+
return /* @__PURE__ */ jsxs2(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
ref,
|
|
200
|
+
className: clsx3("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
201
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
202
|
+
children: [
|
|
203
|
+
/* @__PURE__ */ jsxs2(
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
className: clsx3(
|
|
207
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
208
|
+
{
|
|
209
|
+
"group-hover:brightness-97": !isExpanded,
|
|
210
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
211
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
212
|
+
},
|
|
213
|
+
headerClassName
|
|
214
|
+
),
|
|
215
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
216
|
+
children: [
|
|
217
|
+
label,
|
|
218
|
+
icon(isExpanded)
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
/* @__PURE__ */ jsx4(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
className: clsx3(
|
|
226
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
227
|
+
{
|
|
228
|
+
"max-h-96 opacity-100 pb-2": isExpanded,
|
|
229
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
230
|
+
},
|
|
231
|
+
contentClassName
|
|
232
|
+
),
|
|
233
|
+
children
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
});
|
|
240
|
+
var ExpandableUncontrolled = forwardRef(function ExpandableUncontrolled2({
|
|
241
|
+
isExpanded,
|
|
242
|
+
onChange = noop,
|
|
243
|
+
...props
|
|
244
|
+
}, ref) {
|
|
245
|
+
const [usedIsExpanded, setUsedIsExpanded] = useState3(isExpanded);
|
|
246
|
+
useEffect3(() => {
|
|
247
|
+
setUsedIsExpanded(isExpanded);
|
|
248
|
+
}, [isExpanded]);
|
|
249
|
+
return /* @__PURE__ */ jsx4(
|
|
250
|
+
Expandable,
|
|
251
|
+
{
|
|
252
|
+
...props,
|
|
253
|
+
ref,
|
|
254
|
+
isExpanded: usedIsExpanded,
|
|
255
|
+
onChange: (value) => {
|
|
256
|
+
onChange(value);
|
|
257
|
+
setUsedIsExpanded(value);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// src/components/user-action/Menu.tsx
|
|
264
|
+
import {
|
|
265
|
+
useEffect as useEffect6,
|
|
266
|
+
useRef,
|
|
267
|
+
useState as useState5
|
|
268
|
+
} from "react";
|
|
115
269
|
import clsx4 from "clsx";
|
|
116
270
|
|
|
271
|
+
// src/hooks/useOutsideClick.ts
|
|
272
|
+
import { useEffect as useEffect4 } from "react";
|
|
273
|
+
var useOutsideClick = (refs, handler) => {
|
|
274
|
+
useEffect4(() => {
|
|
275
|
+
const listener = (event) => {
|
|
276
|
+
if (event.target === null) return;
|
|
277
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
handler();
|
|
281
|
+
};
|
|
282
|
+
document.addEventListener("mousedown", listener);
|
|
283
|
+
document.addEventListener("touchstart", listener);
|
|
284
|
+
return () => {
|
|
285
|
+
document.removeEventListener("mousedown", listener);
|
|
286
|
+
document.removeEventListener("touchstart", listener);
|
|
287
|
+
};
|
|
288
|
+
}, [refs, handler]);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// src/hooks/useHoverState.ts
|
|
292
|
+
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
293
|
+
var defaultUseHoverStateProps = {
|
|
294
|
+
closingDelay: 200,
|
|
295
|
+
isDisabled: false
|
|
296
|
+
};
|
|
297
|
+
var useHoverState = (props = void 0) => {
|
|
298
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
299
|
+
const [isHovered, setIsHovered] = useState4(false);
|
|
300
|
+
const [timer, setTimer] = useState4();
|
|
301
|
+
const onMouseEnter = () => {
|
|
302
|
+
if (isDisabled) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
clearTimeout(timer);
|
|
306
|
+
setIsHovered(true);
|
|
307
|
+
};
|
|
308
|
+
const onMouseLeave = () => {
|
|
309
|
+
if (isDisabled) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
setTimer(setTimeout(() => {
|
|
313
|
+
setIsHovered(false);
|
|
314
|
+
}, closingDelay));
|
|
315
|
+
};
|
|
316
|
+
useEffect5(() => {
|
|
317
|
+
if (timer) {
|
|
318
|
+
return () => {
|
|
319
|
+
clearTimeout(timer);
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
useEffect5(() => {
|
|
324
|
+
if (timer) {
|
|
325
|
+
clearTimeout(timer);
|
|
326
|
+
}
|
|
327
|
+
}, [isDisabled]);
|
|
328
|
+
return {
|
|
329
|
+
isHovered,
|
|
330
|
+
setIsHovered,
|
|
331
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
336
|
+
var resolve = (children, bag) => {
|
|
337
|
+
if (typeof children === "function") {
|
|
338
|
+
return children(bag);
|
|
339
|
+
}
|
|
340
|
+
return children ?? void 0;
|
|
341
|
+
};
|
|
342
|
+
var BagFunctionUtil = {
|
|
343
|
+
resolve
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// src/hooks/usePopoverPosition.ts
|
|
347
|
+
var defaultPopoverPositionOptions = {
|
|
348
|
+
edgePadding: 16,
|
|
349
|
+
outerGap: 4,
|
|
350
|
+
horizontalAlignment: "leftInside",
|
|
351
|
+
verticalAlignment: "bottomOutside",
|
|
352
|
+
disabled: false
|
|
353
|
+
};
|
|
354
|
+
var usePopoverPosition = (trigger, options) => {
|
|
355
|
+
const {
|
|
356
|
+
edgePadding,
|
|
357
|
+
outerGap,
|
|
358
|
+
verticalAlignment,
|
|
359
|
+
horizontalAlignment,
|
|
360
|
+
disabled
|
|
361
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
362
|
+
if (disabled || !trigger) {
|
|
363
|
+
return {};
|
|
364
|
+
}
|
|
365
|
+
const left = {
|
|
366
|
+
leftOutside: trigger.left - outerGap,
|
|
367
|
+
leftInside: trigger.left,
|
|
368
|
+
rightOutside: trigger.right + outerGap,
|
|
369
|
+
rightInside: trigger.right,
|
|
370
|
+
center: trigger.left + trigger.width / 2
|
|
371
|
+
}[horizontalAlignment];
|
|
372
|
+
const top = {
|
|
373
|
+
topOutside: trigger.top - outerGap,
|
|
374
|
+
topInside: trigger.top,
|
|
375
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
376
|
+
bottomInside: trigger.bottom,
|
|
377
|
+
center: trigger.top + trigger.height / 2
|
|
378
|
+
}[verticalAlignment];
|
|
379
|
+
const translateX = {
|
|
380
|
+
leftOutside: "-100%",
|
|
381
|
+
leftInside: void 0,
|
|
382
|
+
rightOutside: void 0,
|
|
383
|
+
rightInside: "-100%",
|
|
384
|
+
center: "-50%"
|
|
385
|
+
}[horizontalAlignment];
|
|
386
|
+
const translateY = {
|
|
387
|
+
topOutside: "-100%",
|
|
388
|
+
topInside: void 0,
|
|
389
|
+
bottomOutside: void 0,
|
|
390
|
+
bottomInside: "-100%",
|
|
391
|
+
center: "-50%"
|
|
392
|
+
}[verticalAlignment];
|
|
393
|
+
return {
|
|
394
|
+
left: Math.max(left, edgePadding),
|
|
395
|
+
top: Math.max(top, edgePadding),
|
|
396
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
// src/components/user-action/Menu.tsx
|
|
401
|
+
import { createPortal } from "react-dom";
|
|
402
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
403
|
+
function getScrollableParents(element) {
|
|
404
|
+
const scrollables = [];
|
|
405
|
+
let parent = element.parentElement;
|
|
406
|
+
while (parent) {
|
|
407
|
+
scrollables.push(parent);
|
|
408
|
+
parent = parent.parentElement;
|
|
409
|
+
}
|
|
410
|
+
return scrollables;
|
|
411
|
+
}
|
|
412
|
+
var Menu = ({
|
|
413
|
+
trigger,
|
|
414
|
+
children,
|
|
415
|
+
alignmentHorizontal = "leftInside",
|
|
416
|
+
alignmentVertical = "bottomOutside",
|
|
417
|
+
showOnHover = false,
|
|
418
|
+
disabled = false,
|
|
419
|
+
menuClassName = ""
|
|
420
|
+
}) => {
|
|
421
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
422
|
+
const triggerRef = useRef(null);
|
|
423
|
+
const menuRef = useRef(null);
|
|
424
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
425
|
+
const [isHidden, setIsHidden] = useState5(true);
|
|
426
|
+
const bag = {
|
|
427
|
+
isOpen,
|
|
428
|
+
close: () => setIsOpen(false),
|
|
429
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
430
|
+
disabled
|
|
431
|
+
};
|
|
432
|
+
const menuPosition = usePopoverPosition(
|
|
433
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
434
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
435
|
+
);
|
|
436
|
+
useEffect6(() => {
|
|
437
|
+
if (!isOpen) return;
|
|
438
|
+
const triggerEl = triggerRef.current;
|
|
439
|
+
if (!triggerEl) return;
|
|
440
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
441
|
+
const close = () => setIsOpen(false);
|
|
442
|
+
scrollableParents.forEach((parent) => {
|
|
443
|
+
parent.addEventListener("scroll", close);
|
|
444
|
+
});
|
|
445
|
+
window.addEventListener("resize", close);
|
|
446
|
+
return () => {
|
|
447
|
+
scrollableParents.forEach((parent) => {
|
|
448
|
+
parent.removeEventListener("scroll", close);
|
|
449
|
+
});
|
|
450
|
+
window.removeEventListener("resize", close);
|
|
451
|
+
};
|
|
452
|
+
}, [isOpen, setIsOpen]);
|
|
453
|
+
useEffect6(() => {
|
|
454
|
+
if (isOpen) {
|
|
455
|
+
setIsHidden(false);
|
|
456
|
+
}
|
|
457
|
+
}, [isOpen]);
|
|
458
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
459
|
+
trigger(bag, triggerRef),
|
|
460
|
+
createPortal(/* @__PURE__ */ jsx5(
|
|
461
|
+
"div",
|
|
462
|
+
{
|
|
463
|
+
ref: menuRef,
|
|
464
|
+
onClick: (e) => e.stopPropagation(),
|
|
465
|
+
className: clsx4(
|
|
466
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
467
|
+
{
|
|
468
|
+
"animate-pop-in": isOpen,
|
|
469
|
+
"animate-pop-out": !isOpen,
|
|
470
|
+
"hidden": isHidden
|
|
471
|
+
},
|
|
472
|
+
menuClassName
|
|
473
|
+
),
|
|
474
|
+
onAnimationEnd: () => {
|
|
475
|
+
if (!isOpen) {
|
|
476
|
+
setIsHidden(true);
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
style: {
|
|
480
|
+
...menuPosition
|
|
481
|
+
},
|
|
482
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
483
|
+
}
|
|
484
|
+
), document.body)
|
|
485
|
+
] });
|
|
486
|
+
};
|
|
487
|
+
|
|
117
488
|
// src/components/user-action/Input.tsx
|
|
118
|
-
import { forwardRef, useEffect as
|
|
119
|
-
import
|
|
489
|
+
import { forwardRef as forwardRef2, useEffect as useEffect9, useImperativeHandle, useRef as useRef2, useState as useState7 } from "react";
|
|
490
|
+
import clsx5 from "clsx";
|
|
120
491
|
|
|
121
492
|
// src/hooks/useDelay.ts
|
|
122
|
-
import { useEffect as
|
|
493
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
123
494
|
var defaultOptions = {
|
|
124
495
|
delay: 3e3,
|
|
125
496
|
disabled: false
|
|
126
497
|
};
|
|
127
498
|
function useDelay(options) {
|
|
128
|
-
const [timer, setTimer] =
|
|
499
|
+
const [timer, setTimer] = useState6(void 0);
|
|
129
500
|
const { delay, disabled } = {
|
|
130
501
|
...defaultOptions,
|
|
131
502
|
...options
|
|
@@ -144,28 +515,24 @@ function useDelay(options) {
|
|
|
144
515
|
setTimer(void 0);
|
|
145
516
|
}, delay));
|
|
146
517
|
};
|
|
147
|
-
|
|
518
|
+
useEffect7(() => {
|
|
148
519
|
return () => {
|
|
149
520
|
clearTimeout(timer);
|
|
150
521
|
};
|
|
151
522
|
}, [timer]);
|
|
152
|
-
|
|
523
|
+
useEffect7(() => {
|
|
153
524
|
if (disabled) {
|
|
154
525
|
clearTimeout(timer);
|
|
155
526
|
setTimer(void 0);
|
|
156
527
|
}
|
|
157
528
|
}, [disabled, timer]);
|
|
158
|
-
console.log(timer);
|
|
159
529
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
160
530
|
}
|
|
161
531
|
|
|
162
|
-
// src/util/noop.ts
|
|
163
|
-
var noop = () => void 0;
|
|
164
|
-
|
|
165
532
|
// src/hooks/useFocusManagement.ts
|
|
166
|
-
import { useCallback as
|
|
533
|
+
import { useCallback as useCallback3 } from "react";
|
|
167
534
|
function useFocusManagement() {
|
|
168
|
-
const getFocusableElements =
|
|
535
|
+
const getFocusableElements = useCallback3(() => {
|
|
169
536
|
return Array.from(
|
|
170
537
|
document.querySelectorAll(
|
|
171
538
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -174,7 +541,7 @@ function useFocusManagement() {
|
|
|
174
541
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
175
542
|
);
|
|
176
543
|
}, []);
|
|
177
|
-
const getNextFocusElement =
|
|
544
|
+
const getNextFocusElement = useCallback3(() => {
|
|
178
545
|
const elements = getFocusableElements();
|
|
179
546
|
if (elements.length === 0) {
|
|
180
547
|
return void 0;
|
|
@@ -186,11 +553,11 @@ function useFocusManagement() {
|
|
|
186
553
|
}
|
|
187
554
|
return nextElement;
|
|
188
555
|
}, [getFocusableElements]);
|
|
189
|
-
const focusNext =
|
|
556
|
+
const focusNext = useCallback3(() => {
|
|
190
557
|
const nextElement = getNextFocusElement();
|
|
191
558
|
nextElement?.focus();
|
|
192
559
|
}, [getNextFocusElement]);
|
|
193
|
-
const getPreviousFocusElement =
|
|
560
|
+
const getPreviousFocusElement = useCallback3(() => {
|
|
194
561
|
const elements = getFocusableElements();
|
|
195
562
|
if (elements.length === 0) {
|
|
196
563
|
return void 0;
|
|
@@ -206,7 +573,7 @@ function useFocusManagement() {
|
|
|
206
573
|
}
|
|
207
574
|
return previousElement;
|
|
208
575
|
}, [getFocusableElements]);
|
|
209
|
-
const focusPrevious =
|
|
576
|
+
const focusPrevious = useCallback3(() => {
|
|
210
577
|
const previousElement = getPreviousFocusElement();
|
|
211
578
|
if (previousElement) previousElement.focus();
|
|
212
579
|
}, [getPreviousFocusElement]);
|
|
@@ -220,10 +587,10 @@ function useFocusManagement() {
|
|
|
220
587
|
}
|
|
221
588
|
|
|
222
589
|
// src/hooks/useFocusOnceVisible.ts
|
|
223
|
-
import React, { useEffect as
|
|
590
|
+
import React, { useEffect as useEffect8 } from "react";
|
|
224
591
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
225
592
|
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
226
|
-
|
|
593
|
+
useEffect8(() => {
|
|
227
594
|
if (disable || hasUsedFocus) {
|
|
228
595
|
return;
|
|
229
596
|
}
|
|
@@ -243,9 +610,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
243
610
|
};
|
|
244
611
|
|
|
245
612
|
// src/components/user-action/Input.tsx
|
|
246
|
-
import { jsx as
|
|
613
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
247
614
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
248
|
-
return
|
|
615
|
+
return clsx5(
|
|
249
616
|
"px-2 py-1.5 rounded-md border-2",
|
|
250
617
|
{
|
|
251
618
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -259,7 +626,7 @@ var defaultEditCompleteOptions = {
|
|
|
259
626
|
afterDelay: true,
|
|
260
627
|
delay: 2500
|
|
261
628
|
};
|
|
262
|
-
var Input =
|
|
629
|
+
var Input = forwardRef2(function Input2({
|
|
263
630
|
id,
|
|
264
631
|
type = "text",
|
|
265
632
|
value,
|
|
@@ -282,7 +649,7 @@ var Input = forwardRef(function Input2({
|
|
|
282
649
|
restartTimer,
|
|
283
650
|
clearTimer
|
|
284
651
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
285
|
-
const innerRef =
|
|
652
|
+
const innerRef = useRef2(null);
|
|
286
653
|
const { focusNext } = useFocusManagement();
|
|
287
654
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
288
655
|
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
@@ -293,9 +660,9 @@ var Input = forwardRef(function Input2({
|
|
|
293
660
|
focusNext();
|
|
294
661
|
}
|
|
295
662
|
};
|
|
296
|
-
return /* @__PURE__ */
|
|
297
|
-
label && /* @__PURE__ */
|
|
298
|
-
/* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5({ "w-full": expanded }, containerClassName), children: [
|
|
664
|
+
label && /* @__PURE__ */ jsx6(Label, { ...label, htmlFor: id, className: clsx5("mb-1", label.className) }),
|
|
665
|
+
/* @__PURE__ */ jsx6(
|
|
299
666
|
"input",
|
|
300
667
|
{
|
|
301
668
|
...restProps,
|
|
@@ -304,7 +671,7 @@ var Input = forwardRef(function Input2({
|
|
|
304
671
|
id,
|
|
305
672
|
type,
|
|
306
673
|
disabled,
|
|
307
|
-
className:
|
|
674
|
+
className: clsx5(getInputClassName({ disabled }), className),
|
|
308
675
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
309
676
|
onBlur: (event) => {
|
|
310
677
|
onBlur?.(event);
|
|
@@ -334,7 +701,7 @@ var Input = forwardRef(function Input2({
|
|
|
334
701
|
)
|
|
335
702
|
] });
|
|
336
703
|
});
|
|
337
|
-
var FormInput =
|
|
704
|
+
var FormInput = forwardRef2(function FormInput2({
|
|
338
705
|
id,
|
|
339
706
|
labelText,
|
|
340
707
|
errorText,
|
|
@@ -346,32 +713,149 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
346
713
|
disabled,
|
|
347
714
|
...restProps
|
|
348
715
|
}, ref) {
|
|
349
|
-
const input = /* @__PURE__ */
|
|
716
|
+
const input = /* @__PURE__ */ jsx6(
|
|
350
717
|
"input",
|
|
351
718
|
{
|
|
352
719
|
...restProps,
|
|
353
720
|
ref,
|
|
354
721
|
id,
|
|
355
722
|
disabled,
|
|
356
|
-
className:
|
|
723
|
+
className: clsx5(
|
|
357
724
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
358
725
|
className
|
|
359
726
|
)
|
|
360
727
|
}
|
|
361
728
|
);
|
|
362
|
-
return /* @__PURE__ */
|
|
363
|
-
labelText && /* @__PURE__ */
|
|
729
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5("flex flex-col gap-y-1", containerClassName), children: [
|
|
730
|
+
labelText && /* @__PURE__ */ jsxs4("label", { htmlFor: id, className: clsx5("textstyle-label-md", labelClassName), children: [
|
|
364
731
|
labelText,
|
|
365
|
-
required && /* @__PURE__ */
|
|
732
|
+
required && /* @__PURE__ */ jsx6("span", { className: "text-primary font-bold", children: "*" })
|
|
366
733
|
] }),
|
|
367
734
|
input,
|
|
368
|
-
errorText && /* @__PURE__ */
|
|
735
|
+
errorText && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: clsx5("text-negative", errorClassName), children: errorText })
|
|
369
736
|
] });
|
|
370
737
|
});
|
|
371
738
|
|
|
739
|
+
// src/localization/defaults/form.ts
|
|
740
|
+
var formTranslation = {
|
|
741
|
+
en: {
|
|
742
|
+
add: "Add",
|
|
743
|
+
all: "All",
|
|
744
|
+
apply: "Apply",
|
|
745
|
+
back: "Back",
|
|
746
|
+
cancel: "Cancel",
|
|
747
|
+
change: "Change",
|
|
748
|
+
clear: "Clear",
|
|
749
|
+
click: "Click",
|
|
750
|
+
clickToCopy: "Click to Copy",
|
|
751
|
+
close: "Close",
|
|
752
|
+
confirm: "Confirm",
|
|
753
|
+
copy: "Copy",
|
|
754
|
+
copied: "Copied",
|
|
755
|
+
create: "Create",
|
|
756
|
+
decline: "Decline",
|
|
757
|
+
delete: "Delete",
|
|
758
|
+
discard: "Discard",
|
|
759
|
+
discardChanges: "Discard Changes",
|
|
760
|
+
done: "Done",
|
|
761
|
+
edit: "Edit",
|
|
762
|
+
enterText: "Enter text here",
|
|
763
|
+
error: "Error",
|
|
764
|
+
exit: "Exit",
|
|
765
|
+
fieldRequiredError: "This field is required.",
|
|
766
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
767
|
+
less: "Less",
|
|
768
|
+
loading: "Loading",
|
|
769
|
+
maxLengthError: "Maximum length exceeded.",
|
|
770
|
+
minLengthError: "Minimum length not met.",
|
|
771
|
+
more: "More",
|
|
772
|
+
next: "Next",
|
|
773
|
+
no: "No",
|
|
774
|
+
none: "None",
|
|
775
|
+
of: "of",
|
|
776
|
+
optional: "Optional",
|
|
777
|
+
pleaseWait: "Please wait...",
|
|
778
|
+
previous: "Previous",
|
|
779
|
+
remove: "Remove",
|
|
780
|
+
required: "Required",
|
|
781
|
+
reset: "Reset",
|
|
782
|
+
save: "Save",
|
|
783
|
+
saved: "Saved",
|
|
784
|
+
search: "Search",
|
|
785
|
+
select: "Select",
|
|
786
|
+
selectOption: "Select an option",
|
|
787
|
+
show: "Show",
|
|
788
|
+
showMore: "Show more",
|
|
789
|
+
showLess: "Show less",
|
|
790
|
+
submit: "Submit",
|
|
791
|
+
success: "Success",
|
|
792
|
+
update: "Update",
|
|
793
|
+
unsavedChanges: "Unsaved Changes",
|
|
794
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
795
|
+
yes: "Yes"
|
|
796
|
+
},
|
|
797
|
+
de: {
|
|
798
|
+
add: "Hinzuf\xFCgen",
|
|
799
|
+
all: "Alle",
|
|
800
|
+
apply: "Anwenden",
|
|
801
|
+
back: "Zur\xFCck",
|
|
802
|
+
cancel: "Abbrechen",
|
|
803
|
+
change: "\xC4ndern",
|
|
804
|
+
clear: "L\xF6schen",
|
|
805
|
+
click: "Klicken",
|
|
806
|
+
clickToCopy: "Zum kopieren klicken",
|
|
807
|
+
close: "Schlie\xDFen",
|
|
808
|
+
confirm: "Best\xE4tigen",
|
|
809
|
+
copy: "Kopieren",
|
|
810
|
+
copied: "Kopiert",
|
|
811
|
+
create: "Erstellen",
|
|
812
|
+
decline: "Ablehnen",
|
|
813
|
+
delete: "L\xF6schen",
|
|
814
|
+
discard: "Verwerfen",
|
|
815
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
816
|
+
done: "Fertig",
|
|
817
|
+
edit: "Bearbeiten",
|
|
818
|
+
enterText: "Text hier eingeben",
|
|
819
|
+
error: "Fehler",
|
|
820
|
+
exit: "Beenden",
|
|
821
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
822
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
823
|
+
less: "Weniger",
|
|
824
|
+
loading: "L\xE4dt",
|
|
825
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
826
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
827
|
+
more: "Mehr",
|
|
828
|
+
next: "Weiter",
|
|
829
|
+
no: "Nein",
|
|
830
|
+
none: "Nichts",
|
|
831
|
+
of: "von",
|
|
832
|
+
optional: "Optional",
|
|
833
|
+
pleaseWait: "Bitte warten...",
|
|
834
|
+
previous: "Vorherige",
|
|
835
|
+
remove: "Entfernen",
|
|
836
|
+
required: "Erforderlich",
|
|
837
|
+
reset: "Zur\xFCcksetzen",
|
|
838
|
+
save: "Speichern",
|
|
839
|
+
saved: "Gespeichert",
|
|
840
|
+
search: "Suche",
|
|
841
|
+
select: "Select",
|
|
842
|
+
selectOption: "Option ausw\xE4hlen",
|
|
843
|
+
show: "Anzeigen",
|
|
844
|
+
showMore: "Mehr anzeigen",
|
|
845
|
+
showLess: "Weniger anzeigen",
|
|
846
|
+
submit: "Abschicken",
|
|
847
|
+
success: "Erfolg",
|
|
848
|
+
update: "Update",
|
|
849
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
850
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
851
|
+
yes: "Ja"
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
|
|
372
855
|
// src/components/user-action/Button.tsx
|
|
373
|
-
import
|
|
374
|
-
import
|
|
856
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
857
|
+
import clsx6 from "clsx";
|
|
858
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
375
859
|
var ButtonColorUtil = {
|
|
376
860
|
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
377
861
|
text: ["primary", "negative", "neutral"],
|
|
@@ -395,7 +879,7 @@ var ButtonUtil = {
|
|
|
395
879
|
paddingMapping,
|
|
396
880
|
iconPaddingMapping
|
|
397
881
|
};
|
|
398
|
-
var SolidButton = ({
|
|
882
|
+
var SolidButton = forwardRef3(function SolidButton2({
|
|
399
883
|
children,
|
|
400
884
|
disabled = false,
|
|
401
885
|
color = "primary",
|
|
@@ -405,7 +889,7 @@ var SolidButton = ({
|
|
|
405
889
|
onClick,
|
|
406
890
|
className,
|
|
407
891
|
...restProps
|
|
408
|
-
})
|
|
892
|
+
}, ref) {
|
|
409
893
|
const colorClasses = {
|
|
410
894
|
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
411
895
|
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
@@ -424,25 +908,26 @@ var SolidButton = ({
|
|
|
424
908
|
negative: "text-button-solid-negative-icon",
|
|
425
909
|
neutral: "text-button-solid-neutral-icon"
|
|
426
910
|
}[color];
|
|
427
|
-
return /* @__PURE__ */
|
|
911
|
+
return /* @__PURE__ */ jsxs5(
|
|
428
912
|
"button",
|
|
429
913
|
{
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
914
|
+
ref,
|
|
915
|
+
onClick,
|
|
916
|
+
disabled,
|
|
917
|
+
className: clsx6(
|
|
433
918
|
{
|
|
434
919
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
435
|
-
[
|
|
920
|
+
[clsx6(colorClasses, "hover:brightness-90")]: !disabled
|
|
436
921
|
},
|
|
437
922
|
ButtonUtil.paddingMapping[size],
|
|
438
923
|
className
|
|
439
924
|
),
|
|
440
925
|
...restProps,
|
|
441
926
|
children: [
|
|
442
|
-
startIcon && /* @__PURE__ */
|
|
927
|
+
startIcon && /* @__PURE__ */ jsx7(
|
|
443
928
|
"span",
|
|
444
929
|
{
|
|
445
|
-
className:
|
|
930
|
+
className: clsx6({
|
|
446
931
|
[iconColorClasses]: !disabled,
|
|
447
932
|
[`text-disabled-icon`]: disabled
|
|
448
933
|
}),
|
|
@@ -450,10 +935,10 @@ var SolidButton = ({
|
|
|
450
935
|
}
|
|
451
936
|
),
|
|
452
937
|
children,
|
|
453
|
-
endIcon && /* @__PURE__ */
|
|
938
|
+
endIcon && /* @__PURE__ */ jsx7(
|
|
454
939
|
"span",
|
|
455
940
|
{
|
|
456
|
-
className:
|
|
941
|
+
className: clsx6({
|
|
457
942
|
[iconColorClasses]: !disabled,
|
|
458
943
|
[`text-disabled-icon`]: disabled
|
|
459
944
|
}),
|
|
@@ -463,13 +948,12 @@ var SolidButton = ({
|
|
|
463
948
|
]
|
|
464
949
|
}
|
|
465
950
|
);
|
|
466
|
-
};
|
|
951
|
+
});
|
|
467
952
|
var IconButton = ({
|
|
468
953
|
children,
|
|
469
954
|
disabled = false,
|
|
470
955
|
color = "primary",
|
|
471
956
|
size = "medium",
|
|
472
|
-
onClick,
|
|
473
957
|
className,
|
|
474
958
|
...restProps
|
|
475
959
|
}) => {
|
|
@@ -483,17 +967,16 @@ var IconButton = ({
|
|
|
483
967
|
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
484
968
|
transparent: "bg-transparent"
|
|
485
969
|
}[color];
|
|
486
|
-
return /* @__PURE__ */
|
|
970
|
+
return /* @__PURE__ */ jsx7(
|
|
487
971
|
"button",
|
|
488
972
|
{
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
className: clsx3(
|
|
973
|
+
disabled,
|
|
974
|
+
className: clsx6(
|
|
492
975
|
{
|
|
493
976
|
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
494
977
|
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
495
978
|
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
496
|
-
[
|
|
979
|
+
[clsx6(colorClasses, "hover:brightness-90")]: !disabled
|
|
497
980
|
},
|
|
498
981
|
ButtonUtil.iconPaddingMapping[size],
|
|
499
982
|
className
|
|
@@ -504,17 +987,41 @@ var IconButton = ({
|
|
|
504
987
|
);
|
|
505
988
|
};
|
|
506
989
|
|
|
990
|
+
// src/components/user-action/SearchBar.tsx
|
|
991
|
+
import { Search } from "lucide-react";
|
|
992
|
+
import { clsx as clsx7 } from "clsx";
|
|
993
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
994
|
+
var SearchBar = ({
|
|
995
|
+
placeholder,
|
|
996
|
+
onSearch,
|
|
997
|
+
disableOnSearch,
|
|
998
|
+
containerClassName,
|
|
999
|
+
...inputProps
|
|
1000
|
+
}) => {
|
|
1001
|
+
const translation = useTranslation([formTranslation]);
|
|
1002
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
1003
|
+
/* @__PURE__ */ jsx8(
|
|
1004
|
+
Input,
|
|
1005
|
+
{
|
|
1006
|
+
...inputProps,
|
|
1007
|
+
placeholder: placeholder ?? translation("search")
|
|
1008
|
+
}
|
|
1009
|
+
),
|
|
1010
|
+
onSearch && /* @__PURE__ */ jsx8(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx8(Search, { className: "w-full h-full" }) })
|
|
1011
|
+
] });
|
|
1012
|
+
};
|
|
1013
|
+
|
|
507
1014
|
// src/hooks/useSearch.ts
|
|
508
|
-
import { useEffect as
|
|
1015
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
|
|
509
1016
|
|
|
510
1017
|
// src/util/simpleSearch.ts
|
|
511
|
-
var
|
|
1018
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
512
1019
|
return objects.filter((object) => {
|
|
513
1020
|
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
514
1021
|
if (!mappedSearchKeywords) {
|
|
515
1022
|
return true;
|
|
516
1023
|
}
|
|
517
|
-
return !!mappedSearchKeywords.find((value) => value.includes(
|
|
1024
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
518
1025
|
});
|
|
519
1026
|
};
|
|
520
1027
|
|
|
@@ -522,225 +1029,78 @@ var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
|
522
1029
|
var useSearch = ({
|
|
523
1030
|
list,
|
|
524
1031
|
initialSearch,
|
|
525
|
-
searchMapping
|
|
1032
|
+
searchMapping,
|
|
1033
|
+
additionalSearchTags,
|
|
1034
|
+
isSearchInstant = true,
|
|
1035
|
+
sortingFunction,
|
|
1036
|
+
filter,
|
|
1037
|
+
disabled = false
|
|
526
1038
|
}) => {
|
|
527
|
-
const [
|
|
528
|
-
const [
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
1039
|
+
const [search, setSearch] = useState8(initialSearch ?? "");
|
|
1040
|
+
const [result, setResult] = useState8(list);
|
|
1041
|
+
const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1042
|
+
const updateSearch = useCallback4((newSearch) => {
|
|
1043
|
+
const usedSearch = newSearch ?? search;
|
|
1044
|
+
if (newSearch) {
|
|
1045
|
+
setSearch(search);
|
|
1046
|
+
}
|
|
1047
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1048
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1049
|
+
useEffect10(() => {
|
|
1050
|
+
if (isSearchInstant) {
|
|
1051
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1052
|
+
}
|
|
1053
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1054
|
+
const filteredResult = useMemo(() => {
|
|
1055
|
+
if (!filter) {
|
|
1056
|
+
return result;
|
|
1057
|
+
}
|
|
1058
|
+
return result.filter(filter);
|
|
1059
|
+
}, [result, filter]);
|
|
1060
|
+
const sortedAndFilteredResult = useMemo(() => {
|
|
1061
|
+
if (!sortingFunction) {
|
|
1062
|
+
return filteredResult;
|
|
1063
|
+
}
|
|
1064
|
+
return filteredResult.sort(sortingFunction);
|
|
1065
|
+
}, [filteredResult, sortingFunction]);
|
|
1066
|
+
const usedResult = useMemo(() => {
|
|
1067
|
+
if (!disabled) {
|
|
1068
|
+
return sortedAndFilteredResult;
|
|
1069
|
+
}
|
|
1070
|
+
return list;
|
|
1071
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
536
1072
|
return {
|
|
537
|
-
result,
|
|
538
|
-
hasResult:
|
|
539
|
-
allItems:
|
|
540
|
-
|
|
1073
|
+
result: usedResult,
|
|
1074
|
+
hasResult: usedResult.length > 0,
|
|
1075
|
+
allItems: list,
|
|
1076
|
+
updateSearch,
|
|
541
1077
|
search,
|
|
542
1078
|
setSearch
|
|
543
1079
|
};
|
|
544
1080
|
};
|
|
545
1081
|
|
|
546
|
-
// src/
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
all: "All",
|
|
550
|
-
apply: "Apply",
|
|
551
|
-
back: "Back",
|
|
552
|
-
cancel: "Cancel",
|
|
553
|
-
change: "Change",
|
|
554
|
-
clear: "Clear",
|
|
555
|
-
click: "Click",
|
|
556
|
-
clickToCopy: "Click to Copy",
|
|
557
|
-
close: "Close",
|
|
558
|
-
confirm: "Confirm",
|
|
559
|
-
copy: "Copy",
|
|
560
|
-
copied: "Copied",
|
|
561
|
-
decline: "Decline",
|
|
562
|
-
delete: "Delete",
|
|
563
|
-
discard: "Discard",
|
|
564
|
-
discardChanges: "Discard Changes",
|
|
565
|
-
done: "Done",
|
|
566
|
-
edit: "Edit",
|
|
567
|
-
enterText: "Enter text here",
|
|
568
|
-
error: "Error",
|
|
569
|
-
exit: "Exit",
|
|
570
|
-
fieldRequiredError: "This field is required.",
|
|
571
|
-
invalidEmailError: "Please enter a valid email address.",
|
|
572
|
-
less: "Less",
|
|
573
|
-
loading: "Loading",
|
|
574
|
-
maxLengthError: "Maximum length exceeded.",
|
|
575
|
-
minLengthError: "Minimum length not met.",
|
|
576
|
-
more: "More",
|
|
577
|
-
next: "Next",
|
|
578
|
-
no: "No",
|
|
579
|
-
none: "None",
|
|
580
|
-
of: "of",
|
|
581
|
-
optional: "Optional",
|
|
582
|
-
pleaseWait: "Please wait...",
|
|
583
|
-
previous: "Previous",
|
|
584
|
-
remove: "Remove",
|
|
585
|
-
required: "Required",
|
|
586
|
-
reset: "Reset",
|
|
587
|
-
save: "Save",
|
|
588
|
-
saved: "Saved",
|
|
589
|
-
search: "Search",
|
|
590
|
-
select: "Select",
|
|
591
|
-
selectOption: "Select an option",
|
|
592
|
-
show: "Show",
|
|
593
|
-
showMore: "Show more",
|
|
594
|
-
showLess: "Show less",
|
|
595
|
-
submit: "Submit",
|
|
596
|
-
success: "Success",
|
|
597
|
-
update: "Update",
|
|
598
|
-
unsavedChanges: "Unsaved Changes",
|
|
599
|
-
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
600
|
-
yes: "Yes"
|
|
601
|
-
},
|
|
602
|
-
de: {
|
|
603
|
-
all: "Alle",
|
|
604
|
-
apply: "Anwenden",
|
|
605
|
-
back: "Zur\xFCck",
|
|
606
|
-
cancel: "Abbrechen",
|
|
607
|
-
change: "\xC4ndern",
|
|
608
|
-
clear: "L\xF6schen",
|
|
609
|
-
click: "Klicken",
|
|
610
|
-
clickToCopy: "Zum kopieren klicken",
|
|
611
|
-
close: "Schlie\xDFen",
|
|
612
|
-
confirm: "Best\xE4tigen",
|
|
613
|
-
copy: "Kopieren",
|
|
614
|
-
copied: "Kopiert",
|
|
615
|
-
decline: "Ablehnen",
|
|
616
|
-
delete: "L\xF6schen",
|
|
617
|
-
discard: "Verwerfen",
|
|
618
|
-
discardChanges: "\xC4nderungen Verwerfen",
|
|
619
|
-
done: "Fertig",
|
|
620
|
-
edit: "Bearbeiten",
|
|
621
|
-
enterText: "Text hier eingeben",
|
|
622
|
-
error: "Fehler",
|
|
623
|
-
exit: "Beenden",
|
|
624
|
-
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
625
|
-
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
626
|
-
less: "Weniger",
|
|
627
|
-
loading: "L\xE4dt",
|
|
628
|
-
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
629
|
-
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
630
|
-
more: "Mehr",
|
|
631
|
-
next: "Weiter",
|
|
632
|
-
no: "Nein",
|
|
633
|
-
none: "Nichts",
|
|
634
|
-
of: "von",
|
|
635
|
-
optional: "Optional",
|
|
636
|
-
pleaseWait: "Bitte warten...",
|
|
637
|
-
previous: "Vorherige",
|
|
638
|
-
remove: "Entfernen",
|
|
639
|
-
required: "Erforderlich",
|
|
640
|
-
reset: "Zur\xFCcksetzen",
|
|
641
|
-
save: "Speichern",
|
|
642
|
-
saved: "Gespeichert",
|
|
643
|
-
search: "Suche",
|
|
644
|
-
select: "Select",
|
|
645
|
-
selectOption: "Option ausw\xE4hlen",
|
|
646
|
-
show: "Anzeigen",
|
|
647
|
-
showMore: "Mehr anzeigen",
|
|
648
|
-
showLess: "Weniger anzeigen",
|
|
649
|
-
submit: "Abschicken",
|
|
650
|
-
success: "Erfolg",
|
|
651
|
-
update: "Update",
|
|
652
|
-
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
653
|
-
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
654
|
-
yes: "Ja"
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
|
|
658
|
-
// src/components/layout-and-navigation/SearchableList.tsx
|
|
659
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
660
|
-
var defaultSearchableListTranslation = {
|
|
661
|
-
en: {
|
|
662
|
-
nothingFound: "Nothing found"
|
|
663
|
-
},
|
|
664
|
-
de: {
|
|
665
|
-
nothingFound: "Nichts gefunden"
|
|
666
|
-
}
|
|
667
|
-
};
|
|
668
|
-
var SearchableList = ({
|
|
669
|
-
overwriteTranslation,
|
|
670
|
-
list,
|
|
671
|
-
initialSearch = "",
|
|
672
|
-
searchMapping,
|
|
673
|
-
autoFocus,
|
|
674
|
-
minimumItemsForSearch = 6,
|
|
675
|
-
itemMapper,
|
|
1082
|
+
// src/components/user-action/Select.tsx
|
|
1083
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1084
|
+
var SelectTile = ({
|
|
676
1085
|
className,
|
|
677
|
-
|
|
678
|
-
}) => {
|
|
679
|
-
const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
|
|
680
|
-
const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
|
|
681
|
-
return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
|
|
682
|
-
list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
|
|
683
|
-
/* @__PURE__ */ jsx5(
|
|
684
|
-
Input,
|
|
685
|
-
{
|
|
686
|
-
value: search,
|
|
687
|
-
onChangeText: setSearch,
|
|
688
|
-
placeholder: translation("search"),
|
|
689
|
-
autoFocus,
|
|
690
|
-
className: "w-full"
|
|
691
|
-
}
|
|
692
|
-
),
|
|
693
|
-
/* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
|
|
694
|
-
] }),
|
|
695
|
-
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") })
|
|
696
|
-
] });
|
|
697
|
-
};
|
|
698
|
-
|
|
699
|
-
// src/components/layout-and-navigation/Tile.tsx
|
|
700
|
-
import clsx5 from "clsx";
|
|
701
|
-
import { Check } from "lucide-react";
|
|
702
|
-
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
703
|
-
var Tile = ({
|
|
1086
|
+
disabledClassName,
|
|
704
1087
|
title,
|
|
705
|
-
|
|
706
|
-
onClick,
|
|
707
|
-
isSelected = false,
|
|
708
|
-
isDisabled = false,
|
|
709
|
-
prefix,
|
|
710
|
-
suffix,
|
|
711
|
-
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
712
|
-
selectedClassName = " bg-primary/20",
|
|
713
|
-
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
714
|
-
className
|
|
1088
|
+
...restProps
|
|
715
1089
|
}) => {
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
-
|
|
1090
|
+
return /* @__PURE__ */ jsx9(
|
|
1091
|
+
Tile,
|
|
718
1092
|
{
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
[selectedClassName]: isSelected && !isDisabled,
|
|
724
|
-
[disabledClassName]: isDisabled
|
|
725
|
-
},
|
|
726
|
-
className
|
|
727
|
-
),
|
|
728
|
-
onClick: isDisabled ? void 0 : onClick,
|
|
729
|
-
children: [
|
|
730
|
-
prefix,
|
|
731
|
-
/* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
|
|
732
|
-
/* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
733
|
-
!!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
|
|
734
|
-
] }),
|
|
735
|
-
suffix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0)
|
|
736
|
-
]
|
|
1093
|
+
...restProps,
|
|
1094
|
+
className: clsx8("px-2 py-1 rounded-md", className),
|
|
1095
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1096
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
737
1097
|
}
|
|
738
1098
|
);
|
|
739
1099
|
};
|
|
740
1100
|
|
|
741
1101
|
// src/components/layout-and-navigation/Chip.tsx
|
|
742
|
-
import
|
|
743
|
-
import { jsx as
|
|
1102
|
+
import clsx9 from "clsx";
|
|
1103
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
744
1104
|
var Chip = ({
|
|
745
1105
|
children,
|
|
746
1106
|
trailingIcon,
|
|
@@ -767,11 +1127,11 @@ var Chip = ({
|
|
|
767
1127
|
blue: "text-tag-blue-icon",
|
|
768
1128
|
pink: "text-tag-pink-icon"
|
|
769
1129
|
}[color];
|
|
770
|
-
return /* @__PURE__ */
|
|
1130
|
+
return /* @__PURE__ */ jsxs8(
|
|
771
1131
|
"div",
|
|
772
1132
|
{
|
|
773
1133
|
...restProps,
|
|
774
|
-
className:
|
|
1134
|
+
className: clsx9(
|
|
775
1135
|
`row w-fit px-2 py-1`,
|
|
776
1136
|
colorMapping,
|
|
777
1137
|
{
|
|
@@ -782,7 +1142,7 @@ var Chip = ({
|
|
|
782
1142
|
),
|
|
783
1143
|
children: [
|
|
784
1144
|
children,
|
|
785
|
-
trailingIcon && /* @__PURE__ */
|
|
1145
|
+
trailingIcon && /* @__PURE__ */ jsx10("span", { className: colorMappingIcon, children: trailingIcon })
|
|
786
1146
|
]
|
|
787
1147
|
}
|
|
788
1148
|
);
|
|
@@ -791,7 +1151,7 @@ var ChipList = ({
|
|
|
791
1151
|
list,
|
|
792
1152
|
className = ""
|
|
793
1153
|
}) => {
|
|
794
|
-
return /* @__PURE__ */
|
|
1154
|
+
return /* @__PURE__ */ jsx10("div", { className: clsx9("flex flex-wrap gap-x-2 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ jsx10(
|
|
795
1155
|
Chip,
|
|
796
1156
|
{
|
|
797
1157
|
...value,
|
|
@@ -803,28 +1163,74 @@ var ChipList = ({
|
|
|
803
1163
|
)) });
|
|
804
1164
|
};
|
|
805
1165
|
|
|
806
|
-
// src/
|
|
807
|
-
import {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1166
|
+
// src/components/user-action/Checkbox.tsx
|
|
1167
|
+
import { useState as useState10 } from "react";
|
|
1168
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
1169
|
+
import { Check as Check2, Minus } from "lucide-react";
|
|
1170
|
+
import clsx10 from "clsx";
|
|
1171
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1172
|
+
var checkboxSizeMapping = {
|
|
1173
|
+
small: "size-5",
|
|
1174
|
+
medium: "size-6",
|
|
1175
|
+
large: "size-8"
|
|
1176
|
+
};
|
|
1177
|
+
var checkboxIconSizeMapping = {
|
|
1178
|
+
small: "size-4",
|
|
1179
|
+
medium: "size-5",
|
|
1180
|
+
large: "size-7"
|
|
1181
|
+
};
|
|
1182
|
+
var Checkbox = ({
|
|
1183
|
+
id,
|
|
1184
|
+
label,
|
|
1185
|
+
checked,
|
|
1186
|
+
disabled,
|
|
1187
|
+
onChange,
|
|
1188
|
+
onChangeTristate,
|
|
1189
|
+
size = "medium",
|
|
1190
|
+
className = "",
|
|
1191
|
+
containerClassName
|
|
1192
|
+
}) => {
|
|
1193
|
+
const usedSizeClass = checkboxSizeMapping[size];
|
|
1194
|
+
const innerIconSize = checkboxIconSizeMapping[size];
|
|
1195
|
+
const propagateChange = (checked2) => {
|
|
1196
|
+
if (onChangeTristate) {
|
|
1197
|
+
onChangeTristate(checked2);
|
|
1198
|
+
}
|
|
1199
|
+
if (onChange) {
|
|
1200
|
+
onChange(checked2 === "indeterminate" ? false : checked2);
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
const changeValue = () => {
|
|
1204
|
+
const newValue = checked === "indeterminate" ? false : !checked;
|
|
1205
|
+
propagateChange(newValue);
|
|
1206
|
+
};
|
|
1207
|
+
return /* @__PURE__ */ jsxs9("div", { className: clsx10("group flex-row-2 items-center cursor-pointer", containerClassName), onClick: changeValue, children: [
|
|
1208
|
+
/* @__PURE__ */ jsx11(
|
|
1209
|
+
CheckboxPrimitive.Root,
|
|
1210
|
+
{
|
|
1211
|
+
onCheckedChange: propagateChange,
|
|
1212
|
+
checked,
|
|
1213
|
+
disabled,
|
|
1214
|
+
id,
|
|
1215
|
+
className: clsx10(usedSizeClass, `items-center border-2 rounded outline-none `, {
|
|
1216
|
+
"text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
|
|
1217
|
+
"focus:border-primary group-hover:border-primary ": !disabled,
|
|
1218
|
+
"bg-surface": !disabled && !checked,
|
|
1219
|
+
"bg-primary/30 border-primary text-primary": !disabled && checked === true || checked === "indeterminate"
|
|
1220
|
+
}, className),
|
|
1221
|
+
children: /* @__PURE__ */ jsxs9(CheckboxPrimitive.Indicator, { children: [
|
|
1222
|
+
checked === true && /* @__PURE__ */ jsx11(Check2, { className: innerIconSize }),
|
|
1223
|
+
checked === "indeterminate" && /* @__PURE__ */ jsx11(Minus, { className: innerIconSize })
|
|
1224
|
+
] })
|
|
814
1225
|
}
|
|
815
|
-
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
document.addEventListener("touchstart", listener);
|
|
819
|
-
return () => {
|
|
820
|
-
document.removeEventListener("mousedown", listener);
|
|
821
|
-
document.removeEventListener("touchstart", listener);
|
|
822
|
-
};
|
|
823
|
-
}, [refs, handler]);
|
|
1226
|
+
),
|
|
1227
|
+
label && /* @__PURE__ */ jsx11(Label, { ...label, className: clsx10(label.className), htmlFor: id })
|
|
1228
|
+
] });
|
|
824
1229
|
};
|
|
825
1230
|
|
|
826
1231
|
// src/components/user-action/MultiSelect.tsx
|
|
827
|
-
import {
|
|
1232
|
+
import { Plus } from "lucide-react";
|
|
1233
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
828
1234
|
var defaultMultiSelectTranslation = {
|
|
829
1235
|
en: {
|
|
830
1236
|
selected: `{{amount}} selected`
|
|
@@ -835,89 +1241,107 @@ var defaultMultiSelectTranslation = {
|
|
|
835
1241
|
};
|
|
836
1242
|
var MultiSelect = ({
|
|
837
1243
|
overwriteTranslation,
|
|
838
|
-
options,
|
|
839
1244
|
label,
|
|
1245
|
+
options,
|
|
840
1246
|
onChange,
|
|
841
1247
|
hintText,
|
|
842
|
-
isDisabled = false,
|
|
843
|
-
isSearchEnabled = false,
|
|
844
1248
|
selectedDisplayOverwrite,
|
|
1249
|
+
searchOptions,
|
|
1250
|
+
additionalItems,
|
|
845
1251
|
useChipDisplay = false,
|
|
846
|
-
className
|
|
1252
|
+
className,
|
|
1253
|
+
triggerClassName,
|
|
1254
|
+
hintTextClassName,
|
|
1255
|
+
...menuProps
|
|
847
1256
|
}) => {
|
|
848
1257
|
const translation = useTranslation([formTranslation, defaultMultiSelectTranslation], overwriteTranslation);
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
1258
|
+
const { result, search, setSearch } = useSearch({
|
|
1259
|
+
list: options,
|
|
1260
|
+
searchMapping: useCallback6((item) => item.searchTags, []),
|
|
1261
|
+
...searchOptions
|
|
1262
|
+
});
|
|
853
1263
|
const selectedItems = options.filter((value) => value.selected);
|
|
854
1264
|
const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
|
|
855
|
-
return /* @__PURE__ */
|
|
856
|
-
label && /* @__PURE__ */
|
|
1265
|
+
return /* @__PURE__ */ jsxs10("div", { className: clsx11(className), children: [
|
|
1266
|
+
label && /* @__PURE__ */ jsx12(
|
|
857
1267
|
Label,
|
|
858
1268
|
{
|
|
859
1269
|
...label,
|
|
860
1270
|
htmlFor: label.name,
|
|
861
|
-
className:
|
|
1271
|
+
className: clsx11(" mb-1", label.className),
|
|
862
1272
|
labelType: label.labelType ?? "labelBig"
|
|
863
1273
|
}
|
|
864
1274
|
),
|
|
865
|
-
/* @__PURE__ */
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
"
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1275
|
+
/* @__PURE__ */ jsx12(
|
|
1276
|
+
Menu,
|
|
1277
|
+
{
|
|
1278
|
+
...menuProps,
|
|
1279
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsx12(
|
|
1280
|
+
"button",
|
|
1281
|
+
{
|
|
1282
|
+
ref,
|
|
1283
|
+
className: clsx11(
|
|
1284
|
+
"btn-md justify-between w-full border-2 h-auto",
|
|
1285
|
+
{
|
|
1286
|
+
"min-h-14": useChipDisplay,
|
|
1287
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1288
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1289
|
+
},
|
|
1290
|
+
triggerClassName
|
|
1291
|
+
),
|
|
1292
|
+
onClick: toggleOpen,
|
|
1293
|
+
disabled,
|
|
1294
|
+
children: useChipDisplay ? /* @__PURE__ */ jsx12(Fragment3, { children: isShowingHint ? /* @__PURE__ */ jsx12(IconButton, { disabled, size: "small", color: "neutral", children: /* @__PURE__ */ jsx12(Plus, {}) }) : /* @__PURE__ */ jsx12(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1295
|
+
!isShowingHint && /* @__PURE__ */ jsx12("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? translation("selected", { replacements: { amount: selectedItems.length.toString() } }) }),
|
|
1296
|
+
isShowingHint && /* @__PURE__ */ jsx12("span", { className: clsx11("textstyle-description", hintTextClassName), children: hintText ?? translation("select") }),
|
|
1297
|
+
/* @__PURE__ */ jsx12(ExpansionIcon, { isExpanded: isOpen })
|
|
1298
|
+
] })
|
|
1299
|
+
}
|
|
1300
|
+
),
|
|
1301
|
+
menuClassName: clsx11("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1302
|
+
children: (bag) => {
|
|
1303
|
+
const { close } = bag;
|
|
1304
|
+
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1305
|
+
!searchOptions?.disabled && /* @__PURE__ */ jsx12(
|
|
1306
|
+
SearchBar,
|
|
895
1307
|
{
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
1308
|
+
value: search,
|
|
1309
|
+
onChangeText: setSearch,
|
|
1310
|
+
autoFocus: true
|
|
1311
|
+
}
|
|
1312
|
+
),
|
|
1313
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1314
|
+
result.map((option, index) => {
|
|
1315
|
+
const update = () => {
|
|
1316
|
+
onChange(options.map((value) => value.value === option.value ? {
|
|
1317
|
+
...option,
|
|
1318
|
+
selected: !value.selected
|
|
1319
|
+
} : value));
|
|
1320
|
+
};
|
|
1321
|
+
return /* @__PURE__ */ jsx12(
|
|
1322
|
+
SelectTile,
|
|
901
1323
|
{
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
},
|
|
912
|
-
|
|
1324
|
+
prefix: /* @__PURE__ */ jsx12(
|
|
1325
|
+
Checkbox,
|
|
1326
|
+
{
|
|
1327
|
+
checked: option.selected,
|
|
1328
|
+
onChange: update,
|
|
1329
|
+
size: "small",
|
|
1330
|
+
disabled: option.disabled
|
|
1331
|
+
}
|
|
1332
|
+
),
|
|
1333
|
+
title: { value: option.label },
|
|
1334
|
+
onClick: update,
|
|
1335
|
+
disabled: option.disabled
|
|
913
1336
|
},
|
|
914
1337
|
index
|
|
915
|
-
)
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1338
|
+
);
|
|
1339
|
+
}),
|
|
1340
|
+
additionalItems && additionalItems({ ...bag, search })
|
|
1341
|
+
] }),
|
|
1342
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-row-2 justify-between", children: [
|
|
1343
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-row-2", children: [
|
|
1344
|
+
/* @__PURE__ */ jsx12(
|
|
921
1345
|
SolidButton,
|
|
922
1346
|
{
|
|
923
1347
|
color: "neutral",
|
|
@@ -932,7 +1356,7 @@ var MultiSelect = ({
|
|
|
932
1356
|
children: translation("all")
|
|
933
1357
|
}
|
|
934
1358
|
),
|
|
935
|
-
/* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ jsx12(
|
|
936
1360
|
SolidButton,
|
|
937
1361
|
{
|
|
938
1362
|
color: "neutral",
|
|
@@ -947,12 +1371,12 @@ var MultiSelect = ({
|
|
|
947
1371
|
}
|
|
948
1372
|
)
|
|
949
1373
|
] }),
|
|
950
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ jsx12(SolidButton, { size: "small", onClick: close, children: "Done" })
|
|
951
1375
|
] })
|
|
952
|
-
]
|
|
1376
|
+
] });
|
|
953
1377
|
}
|
|
954
|
-
|
|
955
|
-
|
|
1378
|
+
}
|
|
1379
|
+
)
|
|
956
1380
|
] });
|
|
957
1381
|
};
|
|
958
1382
|
var MultiSelectUncontrolled = ({
|
|
@@ -960,11 +1384,11 @@ var MultiSelectUncontrolled = ({
|
|
|
960
1384
|
onChange,
|
|
961
1385
|
...props
|
|
962
1386
|
}) => {
|
|
963
|
-
const [usedOptions, setUsedOptions] =
|
|
964
|
-
|
|
1387
|
+
const [usedOptions, setUsedOptions] = useState11(options);
|
|
1388
|
+
useEffect12(() => {
|
|
965
1389
|
setUsedOptions(options);
|
|
966
1390
|
}, [options]);
|
|
967
|
-
return /* @__PURE__ */
|
|
1391
|
+
return /* @__PURE__ */ jsx12(
|
|
968
1392
|
MultiSelect,
|
|
969
1393
|
{
|
|
970
1394
|
...props,
|