@helpwave/hightide 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/branding/HelpwaveBadge.js +7 -7
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +7 -7
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +65 -38
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +54 -27
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js +3 -3
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +3 -3
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +4 -4
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +4 -4
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +46 -19
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +44 -17
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +32 -28
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.js +2 -2
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Ring.js +2 -2
- package/dist/components/icons-and-geometry/Ring.js.map +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs +2 -2
- package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +84 -15
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.js +1 -1
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +7 -1
- package/dist/components/layout-and-navigation/Expandable.d.ts +7 -1
- package/dist/components/layout-and-navigation/Expandable.js +36 -9
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +36 -10
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +34 -11
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +36 -13
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +92 -19
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +82 -9
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +79 -6
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +127 -25
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +126 -24
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +22 -16
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +7 -3
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
- package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
- package/dist/components/layout-and-navigation/Tile.js +7 -7
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +7 -7
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +6 -2
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +5 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +8 -6
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +8 -6
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +32 -28
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +18 -14
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +28 -24
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +18 -14
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +32 -28
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +18 -14
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +728 -434
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +728 -430
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +732 -438
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +731 -433
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +110 -35
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +110 -35
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +118 -41
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +114 -37
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
- package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
- package/dist/components/properties/MultiSelectProperty.js +915 -463
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +920 -464
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +101 -18
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +101 -18
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +103 -20
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +99 -16
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +9 -2
- package/dist/components/properties/SelectProperty.d.ts +9 -2
- package/dist/components/properties/SelectProperty.js +682 -243
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +686 -243
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +133 -46
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +133 -46
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +285 -185
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +270 -166
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +179 -78
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +160 -55
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +72 -3
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +72 -3
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +15 -2
- package/dist/components/user-action/Button.d.ts +15 -2
- package/dist/components/user-action/Button.js +12 -12
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +12 -12
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +6 -15
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +6 -15
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +79 -48
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +65 -34
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +11 -6
- package/dist/components/user-action/Menu.d.ts +11 -6
- package/dist/components/user-action/Menu.js +128 -31
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +134 -33
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +17 -7
- package/dist/components/user-action/MultiSelect.d.ts +17 -7
- package/dist/components/user-action/MultiSelect.js +796 -375
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +781 -356
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +2 -2
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +2 -2
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.d.mts +14 -0
- package/dist/components/user-action/SearchBar.d.ts +14 -0
- package/dist/components/user-action/SearchBar.js +673 -0
- package/dist/components/user-action/SearchBar.js.map +1 -0
- package/dist/components/user-action/SearchBar.mjs +637 -0
- package/dist/components/user-action/SearchBar.mjs.map +1 -0
- package/dist/components/user-action/Select.d.mts +18 -5
- package/dist/components/user-action/Select.d.ts +18 -5
- package/dist/components/user-action/Select.js +764 -355
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +761 -349
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +1 -1
- package/dist/components/user-action/Textarea.d.ts +1 -1
- package/dist/components/user-action/Textarea.js +13 -3
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +13 -3
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.js +2 -2
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +2 -2
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +251 -113
- package/dist/css/uncompiled/globals.css +19 -13
- package/dist/css/uncompiled/theme/colors-component.css +12 -3
- package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
- package/dist/css/uncompiled/utitlity/animation.css +70 -1
- package/dist/css/uncompiled/utitlity/general.css +16 -0
- package/dist/hooks/usePopoverPosition.d.mts +15 -0
- package/dist/hooks/usePopoverPosition.d.ts +15 -0
- package/dist/hooks/usePopoverPosition.js +81 -0
- package/dist/hooks/usePopoverPosition.js.map +1 -0
- package/dist/hooks/usePopoverPosition.mjs +57 -0
- package/dist/hooks/usePopoverPosition.mjs.map +1 -0
- package/dist/hooks/useSearch.d.mts +7 -2
- package/dist/hooks/useSearch.d.ts +7 -2
- package/dist/hooks/useSearch.js +44 -15
- package/dist/hooks/useSearch.js.map +1 -1
- package/dist/hooks/useSearch.mjs +45 -16
- package/dist/hooks/useSearch.mjs.map +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1102 -819
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1001 -718
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +2 -0
- package/dist/localization/defaults/form.d.ts +2 -0
- package/dist/localization/defaults/form.js +4 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +4 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/simpleSearch.d.mts +1 -1
- package/dist/util/simpleSearch.d.ts +1 -1
- package/dist/util/simpleSearch.js +4 -1
- package/dist/util/simpleSearch.js.map +1 -1
- package/dist/util/simpleSearch.mjs +4 -1
- package/dist/util/simpleSearch.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/components/properties/MultiSelectProperty.tsx
|
|
2
|
-
import { List } from "lucide-react";
|
|
3
|
-
import
|
|
2
|
+
import { List, Plus as Plus2 } from "lucide-react";
|
|
3
|
+
import clsx13 from "clsx";
|
|
4
4
|
|
|
5
5
|
// src/localization/LanguageProvider.tsx
|
|
6
6
|
import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -90,9 +90,9 @@ var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
// src/components/user-action/MultiSelect.tsx
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import
|
|
93
|
+
import { useCallback as useCallback6 } from "react";
|
|
94
|
+
import { useEffect as useEffect12, useState as useState11 } from "react";
|
|
95
|
+
import clsx11 from "clsx";
|
|
96
96
|
|
|
97
97
|
// src/components/user-action/Label.tsx
|
|
98
98
|
import clsx from "clsx";
|
|
@@ -112,22 +112,393 @@ var Label = ({
|
|
|
112
112
|
return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
// src/components/
|
|
116
|
-
import {
|
|
115
|
+
// src/components/user-action/Select.tsx
|
|
116
|
+
import { useCallback as useCallback5 } from "react";
|
|
117
|
+
import { useEffect as useEffect11, useState as useState9 } from "react";
|
|
118
|
+
import clsx8 from "clsx";
|
|
119
|
+
|
|
120
|
+
// src/components/layout-and-navigation/Tile.tsx
|
|
121
|
+
import clsx2 from "clsx";
|
|
122
|
+
import { Check } from "lucide-react";
|
|
123
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
124
|
+
var Tile = ({
|
|
125
|
+
title,
|
|
126
|
+
description,
|
|
127
|
+
onClick,
|
|
128
|
+
isSelected = false,
|
|
129
|
+
disabled = false,
|
|
130
|
+
prefix,
|
|
131
|
+
suffix,
|
|
132
|
+
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
133
|
+
selectedClassName = " bg-primary/20",
|
|
134
|
+
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
135
|
+
className
|
|
136
|
+
}) => {
|
|
137
|
+
return /* @__PURE__ */ jsxs(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: clsx2(
|
|
141
|
+
"flex-row-2 w-full items-center",
|
|
142
|
+
{
|
|
143
|
+
[normalClassName]: !!onClick && !disabled,
|
|
144
|
+
[selectedClassName]: isSelected && !disabled,
|
|
145
|
+
[disabledClassName]: disabled
|
|
146
|
+
},
|
|
147
|
+
className
|
|
148
|
+
),
|
|
149
|
+
onClick: disabled ? void 0 : onClick,
|
|
150
|
+
children: [
|
|
151
|
+
prefix,
|
|
152
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-col-0 w-full", children: [
|
|
153
|
+
/* @__PURE__ */ jsx3("h4", { className: clsx2(title.className ?? "textstyle-title-normal"), children: title.value }),
|
|
154
|
+
!!description && /* @__PURE__ */ jsx3("span", { className: clsx2(description.className ?? "textstyle-description"), children: description.value })
|
|
155
|
+
] }),
|
|
156
|
+
suffix ?? (isSelected ? /* @__PURE__ */ jsx3(Check, { size: 24 }) : void 0)
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
163
|
+
import { forwardRef, useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
|
|
164
|
+
import { ChevronDown } from "lucide-react";
|
|
165
|
+
import clsx3 from "clsx";
|
|
166
|
+
|
|
167
|
+
// src/util/noop.ts
|
|
168
|
+
var noop = () => void 0;
|
|
169
|
+
|
|
170
|
+
// src/components/layout-and-navigation/Expandable.tsx
|
|
171
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
172
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
173
|
+
return /* @__PURE__ */ jsx4(
|
|
174
|
+
ChevronDown,
|
|
175
|
+
{
|
|
176
|
+
className: clsx3(
|
|
177
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
|
|
178
|
+
{ "rotate-180": isExpanded },
|
|
179
|
+
className
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
var Expandable = forwardRef(function Expandable2({
|
|
185
|
+
children,
|
|
186
|
+
label,
|
|
187
|
+
icon,
|
|
188
|
+
isExpanded = false,
|
|
189
|
+
onChange = noop,
|
|
190
|
+
clickOnlyOnHeader = true,
|
|
191
|
+
disabled = false,
|
|
192
|
+
className,
|
|
193
|
+
headerClassName,
|
|
194
|
+
contentClassName
|
|
195
|
+
}, ref) {
|
|
196
|
+
const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx4(ExpansionIcon, { isExpanded: expanded }), []);
|
|
197
|
+
icon ??= defaultIcon;
|
|
198
|
+
return /* @__PURE__ */ jsxs2(
|
|
199
|
+
"div",
|
|
200
|
+
{
|
|
201
|
+
ref,
|
|
202
|
+
className: clsx3("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
203
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ jsxs2(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
className: clsx3(
|
|
209
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
210
|
+
{
|
|
211
|
+
"group-hover:brightness-97": !isExpanded,
|
|
212
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
213
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
214
|
+
},
|
|
215
|
+
headerClassName
|
|
216
|
+
),
|
|
217
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
218
|
+
children: [
|
|
219
|
+
label,
|
|
220
|
+
icon(isExpanded)
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
/* @__PURE__ */ jsx4(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
className: clsx3(
|
|
228
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
229
|
+
{
|
|
230
|
+
"max-h-96 opacity-100 pb-2": isExpanded,
|
|
231
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
232
|
+
},
|
|
233
|
+
contentClassName
|
|
234
|
+
),
|
|
235
|
+
children
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
var ExpandableUncontrolled = forwardRef(function ExpandableUncontrolled2({
|
|
243
|
+
isExpanded,
|
|
244
|
+
onChange = noop,
|
|
245
|
+
...props
|
|
246
|
+
}, ref) {
|
|
247
|
+
const [usedIsExpanded, setUsedIsExpanded] = useState3(isExpanded);
|
|
248
|
+
useEffect3(() => {
|
|
249
|
+
setUsedIsExpanded(isExpanded);
|
|
250
|
+
}, [isExpanded]);
|
|
251
|
+
return /* @__PURE__ */ jsx4(
|
|
252
|
+
Expandable,
|
|
253
|
+
{
|
|
254
|
+
...props,
|
|
255
|
+
ref,
|
|
256
|
+
isExpanded: usedIsExpanded,
|
|
257
|
+
onChange: (value) => {
|
|
258
|
+
onChange(value);
|
|
259
|
+
setUsedIsExpanded(value);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// src/components/user-action/Menu.tsx
|
|
266
|
+
import {
|
|
267
|
+
useEffect as useEffect6,
|
|
268
|
+
useRef,
|
|
269
|
+
useState as useState5
|
|
270
|
+
} from "react";
|
|
117
271
|
import clsx4 from "clsx";
|
|
118
272
|
|
|
273
|
+
// src/hooks/useOutsideClick.ts
|
|
274
|
+
import { useEffect as useEffect4 } from "react";
|
|
275
|
+
var useOutsideClick = (refs, handler) => {
|
|
276
|
+
useEffect4(() => {
|
|
277
|
+
const listener = (event) => {
|
|
278
|
+
if (event.target === null) return;
|
|
279
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
handler();
|
|
283
|
+
};
|
|
284
|
+
document.addEventListener("mousedown", listener);
|
|
285
|
+
document.addEventListener("touchstart", listener);
|
|
286
|
+
return () => {
|
|
287
|
+
document.removeEventListener("mousedown", listener);
|
|
288
|
+
document.removeEventListener("touchstart", listener);
|
|
289
|
+
};
|
|
290
|
+
}, [refs, handler]);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// src/hooks/useHoverState.ts
|
|
294
|
+
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
295
|
+
var defaultUseHoverStateProps = {
|
|
296
|
+
closingDelay: 200,
|
|
297
|
+
isDisabled: false
|
|
298
|
+
};
|
|
299
|
+
var useHoverState = (props = void 0) => {
|
|
300
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
301
|
+
const [isHovered, setIsHovered] = useState4(false);
|
|
302
|
+
const [timer, setTimer] = useState4();
|
|
303
|
+
const onMouseEnter = () => {
|
|
304
|
+
if (isDisabled) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
clearTimeout(timer);
|
|
308
|
+
setIsHovered(true);
|
|
309
|
+
};
|
|
310
|
+
const onMouseLeave = () => {
|
|
311
|
+
if (isDisabled) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
setTimer(setTimeout(() => {
|
|
315
|
+
setIsHovered(false);
|
|
316
|
+
}, closingDelay));
|
|
317
|
+
};
|
|
318
|
+
useEffect5(() => {
|
|
319
|
+
if (timer) {
|
|
320
|
+
return () => {
|
|
321
|
+
clearTimeout(timer);
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
useEffect5(() => {
|
|
326
|
+
if (timer) {
|
|
327
|
+
clearTimeout(timer);
|
|
328
|
+
}
|
|
329
|
+
}, [isDisabled]);
|
|
330
|
+
return {
|
|
331
|
+
isHovered,
|
|
332
|
+
setIsHovered,
|
|
333
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
338
|
+
var resolve = (children, bag) => {
|
|
339
|
+
if (typeof children === "function") {
|
|
340
|
+
return children(bag);
|
|
341
|
+
}
|
|
342
|
+
return children ?? void 0;
|
|
343
|
+
};
|
|
344
|
+
var BagFunctionUtil = {
|
|
345
|
+
resolve
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// src/hooks/usePopoverPosition.ts
|
|
349
|
+
var defaultPopoverPositionOptions = {
|
|
350
|
+
edgePadding: 16,
|
|
351
|
+
outerGap: 4,
|
|
352
|
+
horizontalAlignment: "leftInside",
|
|
353
|
+
verticalAlignment: "bottomOutside",
|
|
354
|
+
disabled: false
|
|
355
|
+
};
|
|
356
|
+
var usePopoverPosition = (trigger, options) => {
|
|
357
|
+
const {
|
|
358
|
+
edgePadding,
|
|
359
|
+
outerGap,
|
|
360
|
+
verticalAlignment,
|
|
361
|
+
horizontalAlignment,
|
|
362
|
+
disabled
|
|
363
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
364
|
+
if (disabled || !trigger) {
|
|
365
|
+
return {};
|
|
366
|
+
}
|
|
367
|
+
const left = {
|
|
368
|
+
leftOutside: trigger.left - outerGap,
|
|
369
|
+
leftInside: trigger.left,
|
|
370
|
+
rightOutside: trigger.right + outerGap,
|
|
371
|
+
rightInside: trigger.right,
|
|
372
|
+
center: trigger.left + trigger.width / 2
|
|
373
|
+
}[horizontalAlignment];
|
|
374
|
+
const top = {
|
|
375
|
+
topOutside: trigger.top - outerGap,
|
|
376
|
+
topInside: trigger.top,
|
|
377
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
378
|
+
bottomInside: trigger.bottom,
|
|
379
|
+
center: trigger.top + trigger.height / 2
|
|
380
|
+
}[verticalAlignment];
|
|
381
|
+
const translateX = {
|
|
382
|
+
leftOutside: "-100%",
|
|
383
|
+
leftInside: void 0,
|
|
384
|
+
rightOutside: void 0,
|
|
385
|
+
rightInside: "-100%",
|
|
386
|
+
center: "-50%"
|
|
387
|
+
}[horizontalAlignment];
|
|
388
|
+
const translateY = {
|
|
389
|
+
topOutside: "-100%",
|
|
390
|
+
topInside: void 0,
|
|
391
|
+
bottomOutside: void 0,
|
|
392
|
+
bottomInside: "-100%",
|
|
393
|
+
center: "-50%"
|
|
394
|
+
}[verticalAlignment];
|
|
395
|
+
return {
|
|
396
|
+
left: Math.max(left, edgePadding),
|
|
397
|
+
top: Math.max(top, edgePadding),
|
|
398
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
// src/components/user-action/Menu.tsx
|
|
403
|
+
import { createPortal } from "react-dom";
|
|
404
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
405
|
+
function getScrollableParents(element) {
|
|
406
|
+
const scrollables = [];
|
|
407
|
+
let parent = element.parentElement;
|
|
408
|
+
while (parent) {
|
|
409
|
+
scrollables.push(parent);
|
|
410
|
+
parent = parent.parentElement;
|
|
411
|
+
}
|
|
412
|
+
return scrollables;
|
|
413
|
+
}
|
|
414
|
+
var Menu = ({
|
|
415
|
+
trigger,
|
|
416
|
+
children,
|
|
417
|
+
alignmentHorizontal = "leftInside",
|
|
418
|
+
alignmentVertical = "bottomOutside",
|
|
419
|
+
showOnHover = false,
|
|
420
|
+
disabled = false,
|
|
421
|
+
menuClassName = ""
|
|
422
|
+
}) => {
|
|
423
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
424
|
+
const triggerRef = useRef(null);
|
|
425
|
+
const menuRef = useRef(null);
|
|
426
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
427
|
+
const [isHidden, setIsHidden] = useState5(true);
|
|
428
|
+
const bag = {
|
|
429
|
+
isOpen,
|
|
430
|
+
close: () => setIsOpen(false),
|
|
431
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
432
|
+
disabled
|
|
433
|
+
};
|
|
434
|
+
const menuPosition = usePopoverPosition(
|
|
435
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
436
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
437
|
+
);
|
|
438
|
+
useEffect6(() => {
|
|
439
|
+
if (!isOpen) return;
|
|
440
|
+
const triggerEl = triggerRef.current;
|
|
441
|
+
if (!triggerEl) return;
|
|
442
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
443
|
+
const close = () => setIsOpen(false);
|
|
444
|
+
scrollableParents.forEach((parent) => {
|
|
445
|
+
parent.addEventListener("scroll", close);
|
|
446
|
+
});
|
|
447
|
+
window.addEventListener("resize", close);
|
|
448
|
+
return () => {
|
|
449
|
+
scrollableParents.forEach((parent) => {
|
|
450
|
+
parent.removeEventListener("scroll", close);
|
|
451
|
+
});
|
|
452
|
+
window.removeEventListener("resize", close);
|
|
453
|
+
};
|
|
454
|
+
}, [isOpen, setIsOpen]);
|
|
455
|
+
useEffect6(() => {
|
|
456
|
+
if (isOpen) {
|
|
457
|
+
setIsHidden(false);
|
|
458
|
+
}
|
|
459
|
+
}, [isOpen]);
|
|
460
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
461
|
+
trigger(bag, triggerRef),
|
|
462
|
+
createPortal(/* @__PURE__ */ jsx5(
|
|
463
|
+
"div",
|
|
464
|
+
{
|
|
465
|
+
ref: menuRef,
|
|
466
|
+
onClick: (e) => e.stopPropagation(),
|
|
467
|
+
className: clsx4(
|
|
468
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
469
|
+
{
|
|
470
|
+
"animate-pop-in": isOpen,
|
|
471
|
+
"animate-pop-out": !isOpen,
|
|
472
|
+
"hidden": isHidden
|
|
473
|
+
},
|
|
474
|
+
menuClassName
|
|
475
|
+
),
|
|
476
|
+
onAnimationEnd: () => {
|
|
477
|
+
if (!isOpen) {
|
|
478
|
+
setIsHidden(true);
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
style: {
|
|
482
|
+
...menuPosition
|
|
483
|
+
},
|
|
484
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
485
|
+
}
|
|
486
|
+
), document.body)
|
|
487
|
+
] });
|
|
488
|
+
};
|
|
489
|
+
|
|
119
490
|
// src/components/user-action/Input.tsx
|
|
120
|
-
import { forwardRef, useEffect as
|
|
121
|
-
import
|
|
491
|
+
import { forwardRef as forwardRef2, useEffect as useEffect9, useImperativeHandle, useRef as useRef2, useState as useState7 } from "react";
|
|
492
|
+
import clsx5 from "clsx";
|
|
122
493
|
|
|
123
494
|
// src/hooks/useDelay.ts
|
|
124
|
-
import { useEffect as
|
|
495
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
125
496
|
var defaultOptions = {
|
|
126
497
|
delay: 3e3,
|
|
127
498
|
disabled: false
|
|
128
499
|
};
|
|
129
500
|
function useDelay(options) {
|
|
130
|
-
const [timer, setTimer] =
|
|
501
|
+
const [timer, setTimer] = useState6(void 0);
|
|
131
502
|
const { delay, disabled } = {
|
|
132
503
|
...defaultOptions,
|
|
133
504
|
...options
|
|
@@ -146,12 +517,12 @@ function useDelay(options) {
|
|
|
146
517
|
setTimer(void 0);
|
|
147
518
|
}, delay));
|
|
148
519
|
};
|
|
149
|
-
|
|
520
|
+
useEffect7(() => {
|
|
150
521
|
return () => {
|
|
151
522
|
clearTimeout(timer);
|
|
152
523
|
};
|
|
153
524
|
}, [timer]);
|
|
154
|
-
|
|
525
|
+
useEffect7(() => {
|
|
155
526
|
if (disabled) {
|
|
156
527
|
clearTimeout(timer);
|
|
157
528
|
setTimer(void 0);
|
|
@@ -160,13 +531,10 @@ function useDelay(options) {
|
|
|
160
531
|
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
161
532
|
}
|
|
162
533
|
|
|
163
|
-
// src/util/noop.ts
|
|
164
|
-
var noop = () => void 0;
|
|
165
|
-
|
|
166
534
|
// src/hooks/useFocusManagement.ts
|
|
167
|
-
import { useCallback as
|
|
535
|
+
import { useCallback as useCallback3 } from "react";
|
|
168
536
|
function useFocusManagement() {
|
|
169
|
-
const getFocusableElements =
|
|
537
|
+
const getFocusableElements = useCallback3(() => {
|
|
170
538
|
return Array.from(
|
|
171
539
|
document.querySelectorAll(
|
|
172
540
|
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
@@ -175,7 +543,7 @@ function useFocusManagement() {
|
|
|
175
543
|
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
176
544
|
);
|
|
177
545
|
}, []);
|
|
178
|
-
const getNextFocusElement =
|
|
546
|
+
const getNextFocusElement = useCallback3(() => {
|
|
179
547
|
const elements = getFocusableElements();
|
|
180
548
|
if (elements.length === 0) {
|
|
181
549
|
return void 0;
|
|
@@ -187,11 +555,11 @@ function useFocusManagement() {
|
|
|
187
555
|
}
|
|
188
556
|
return nextElement;
|
|
189
557
|
}, [getFocusableElements]);
|
|
190
|
-
const focusNext =
|
|
558
|
+
const focusNext = useCallback3(() => {
|
|
191
559
|
const nextElement = getNextFocusElement();
|
|
192
560
|
nextElement?.focus();
|
|
193
561
|
}, [getNextFocusElement]);
|
|
194
|
-
const getPreviousFocusElement =
|
|
562
|
+
const getPreviousFocusElement = useCallback3(() => {
|
|
195
563
|
const elements = getFocusableElements();
|
|
196
564
|
if (elements.length === 0) {
|
|
197
565
|
return void 0;
|
|
@@ -207,7 +575,7 @@ function useFocusManagement() {
|
|
|
207
575
|
}
|
|
208
576
|
return previousElement;
|
|
209
577
|
}, [getFocusableElements]);
|
|
210
|
-
const focusPrevious =
|
|
578
|
+
const focusPrevious = useCallback3(() => {
|
|
211
579
|
const previousElement = getPreviousFocusElement();
|
|
212
580
|
if (previousElement) previousElement.focus();
|
|
213
581
|
}, [getPreviousFocusElement]);
|
|
@@ -221,10 +589,10 @@ function useFocusManagement() {
|
|
|
221
589
|
}
|
|
222
590
|
|
|
223
591
|
// src/hooks/useFocusOnceVisible.ts
|
|
224
|
-
import React, { useEffect as
|
|
592
|
+
import React, { useEffect as useEffect8 } from "react";
|
|
225
593
|
var useFocusOnceVisible = (ref, disable = false) => {
|
|
226
594
|
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
227
|
-
|
|
595
|
+
useEffect8(() => {
|
|
228
596
|
if (disable || hasUsedFocus) {
|
|
229
597
|
return;
|
|
230
598
|
}
|
|
@@ -244,9 +612,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
|
|
|
244
612
|
};
|
|
245
613
|
|
|
246
614
|
// src/components/user-action/Input.tsx
|
|
247
|
-
import { jsx as
|
|
615
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
248
616
|
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
249
|
-
return
|
|
617
|
+
return clsx5(
|
|
250
618
|
"px-2 py-1.5 rounded-md border-2",
|
|
251
619
|
{
|
|
252
620
|
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
@@ -260,7 +628,7 @@ var defaultEditCompleteOptions = {
|
|
|
260
628
|
afterDelay: true,
|
|
261
629
|
delay: 2500
|
|
262
630
|
};
|
|
263
|
-
var Input =
|
|
631
|
+
var Input = forwardRef2(function Input2({
|
|
264
632
|
id,
|
|
265
633
|
type = "text",
|
|
266
634
|
value,
|
|
@@ -283,7 +651,7 @@ var Input = forwardRef(function Input2({
|
|
|
283
651
|
restartTimer,
|
|
284
652
|
clearTimer
|
|
285
653
|
} = useDelay({ delay, disabled: !afterDelay });
|
|
286
|
-
const innerRef =
|
|
654
|
+
const innerRef = useRef2(null);
|
|
287
655
|
const { focusNext } = useFocusManagement();
|
|
288
656
|
useFocusOnceVisible(innerRef, !autoFocus);
|
|
289
657
|
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
@@ -294,9 +662,9 @@ var Input = forwardRef(function Input2({
|
|
|
294
662
|
focusNext();
|
|
295
663
|
}
|
|
296
664
|
};
|
|
297
|
-
return /* @__PURE__ */
|
|
298
|
-
label && /* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */
|
|
665
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5({ "w-full": expanded }, containerClassName), children: [
|
|
666
|
+
label && /* @__PURE__ */ jsx6(Label, { ...label, htmlFor: id, className: clsx5("mb-1", label.className) }),
|
|
667
|
+
/* @__PURE__ */ jsx6(
|
|
300
668
|
"input",
|
|
301
669
|
{
|
|
302
670
|
...restProps,
|
|
@@ -305,7 +673,7 @@ var Input = forwardRef(function Input2({
|
|
|
305
673
|
id,
|
|
306
674
|
type,
|
|
307
675
|
disabled,
|
|
308
|
-
className:
|
|
676
|
+
className: clsx5(getInputClassName({ disabled }), className),
|
|
309
677
|
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
310
678
|
onBlur: (event) => {
|
|
311
679
|
onBlur?.(event);
|
|
@@ -335,7 +703,7 @@ var Input = forwardRef(function Input2({
|
|
|
335
703
|
)
|
|
336
704
|
] });
|
|
337
705
|
});
|
|
338
|
-
var FormInput =
|
|
706
|
+
var FormInput = forwardRef2(function FormInput2({
|
|
339
707
|
id,
|
|
340
708
|
labelText,
|
|
341
709
|
errorText,
|
|
@@ -347,267 +715,33 @@ var FormInput = forwardRef(function FormInput2({
|
|
|
347
715
|
disabled,
|
|
348
716
|
...restProps
|
|
349
717
|
}, ref) {
|
|
350
|
-
const input = /* @__PURE__ */
|
|
718
|
+
const input = /* @__PURE__ */ jsx6(
|
|
351
719
|
"input",
|
|
352
720
|
{
|
|
353
721
|
...restProps,
|
|
354
722
|
ref,
|
|
355
723
|
id,
|
|
356
724
|
disabled,
|
|
357
|
-
className:
|
|
725
|
+
className: clsx5(
|
|
358
726
|
getInputClassName({ disabled, hasError: !!errorText }),
|
|
359
727
|
className
|
|
360
728
|
)
|
|
361
729
|
}
|
|
362
730
|
);
|
|
363
|
-
return /* @__PURE__ */
|
|
364
|
-
labelText && /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5("flex flex-col gap-y-1", containerClassName), children: [
|
|
732
|
+
labelText && /* @__PURE__ */ jsxs4("label", { htmlFor: id, className: clsx5("textstyle-label-md", labelClassName), children: [
|
|
365
733
|
labelText,
|
|
366
|
-
required && /* @__PURE__ */
|
|
734
|
+
required && /* @__PURE__ */ jsx6("span", { className: "text-primary font-bold", children: "*" })
|
|
367
735
|
] }),
|
|
368
736
|
input,
|
|
369
|
-
errorText && /* @__PURE__ */
|
|
737
|
+
errorText && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: clsx5("text-negative", errorClassName), children: errorText })
|
|
370
738
|
] });
|
|
371
739
|
});
|
|
372
740
|
|
|
373
|
-
// src/components/user-action/Button.tsx
|
|
374
|
-
import clsx3 from "clsx";
|
|
375
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
376
|
-
var ButtonColorUtil = {
|
|
377
|
-
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
378
|
-
text: ["primary", "negative", "neutral"],
|
|
379
|
-
outline: ["primary"]
|
|
380
|
-
};
|
|
381
|
-
var IconButtonUtil = {
|
|
382
|
-
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
383
|
-
};
|
|
384
|
-
var paddingMapping = {
|
|
385
|
-
small: "btn-sm",
|
|
386
|
-
medium: "btn-md",
|
|
387
|
-
large: "btn-lg"
|
|
388
|
-
};
|
|
389
|
-
var iconPaddingMapping = {
|
|
390
|
-
tiny: "icon-btn-xs",
|
|
391
|
-
small: "icon-btn-sm",
|
|
392
|
-
medium: "icon-btn-md",
|
|
393
|
-
large: "icon-btn-lg"
|
|
394
|
-
};
|
|
395
|
-
var ButtonUtil = {
|
|
396
|
-
paddingMapping,
|
|
397
|
-
iconPaddingMapping
|
|
398
|
-
};
|
|
399
|
-
var SolidButton = ({
|
|
400
|
-
children,
|
|
401
|
-
disabled = false,
|
|
402
|
-
color = "primary",
|
|
403
|
-
size = "medium",
|
|
404
|
-
startIcon,
|
|
405
|
-
endIcon,
|
|
406
|
-
onClick,
|
|
407
|
-
className,
|
|
408
|
-
...restProps
|
|
409
|
-
}) => {
|
|
410
|
-
const colorClasses = {
|
|
411
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
412
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
413
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
414
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
415
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
416
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
417
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
418
|
-
}[color];
|
|
419
|
-
const iconColorClasses = {
|
|
420
|
-
primary: "text-button-solid-primary-icon",
|
|
421
|
-
secondary: "text-button-solid-secondary-icon",
|
|
422
|
-
tertiary: "text-button-solid-tertiary-icon",
|
|
423
|
-
positive: "text-button-solid-positive-icon",
|
|
424
|
-
warning: "text-button-solid-warning-icon",
|
|
425
|
-
negative: "text-button-solid-negative-icon",
|
|
426
|
-
neutral: "text-button-solid-neutral-icon"
|
|
427
|
-
}[color];
|
|
428
|
-
return /* @__PURE__ */ jsxs2(
|
|
429
|
-
"button",
|
|
430
|
-
{
|
|
431
|
-
onClick: disabled ? void 0 : onClick,
|
|
432
|
-
disabled: disabled || onClick === void 0,
|
|
433
|
-
className: clsx3(
|
|
434
|
-
{
|
|
435
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
436
|
-
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
437
|
-
},
|
|
438
|
-
ButtonUtil.paddingMapping[size],
|
|
439
|
-
className
|
|
440
|
-
),
|
|
441
|
-
...restProps,
|
|
442
|
-
children: [
|
|
443
|
-
startIcon && /* @__PURE__ */ jsx4(
|
|
444
|
-
"span",
|
|
445
|
-
{
|
|
446
|
-
className: clsx3({
|
|
447
|
-
[iconColorClasses]: !disabled,
|
|
448
|
-
[`text-disabled-icon`]: disabled
|
|
449
|
-
}),
|
|
450
|
-
children: startIcon
|
|
451
|
-
}
|
|
452
|
-
),
|
|
453
|
-
children,
|
|
454
|
-
endIcon && /* @__PURE__ */ jsx4(
|
|
455
|
-
"span",
|
|
456
|
-
{
|
|
457
|
-
className: clsx3({
|
|
458
|
-
[iconColorClasses]: !disabled,
|
|
459
|
-
[`text-disabled-icon`]: disabled
|
|
460
|
-
}),
|
|
461
|
-
children: endIcon
|
|
462
|
-
}
|
|
463
|
-
)
|
|
464
|
-
]
|
|
465
|
-
}
|
|
466
|
-
);
|
|
467
|
-
};
|
|
468
|
-
var TextButton = ({
|
|
469
|
-
children,
|
|
470
|
-
disabled = false,
|
|
471
|
-
color = "neutral",
|
|
472
|
-
size = "medium",
|
|
473
|
-
startIcon,
|
|
474
|
-
endIcon,
|
|
475
|
-
onClick,
|
|
476
|
-
className,
|
|
477
|
-
...restProps
|
|
478
|
-
}) => {
|
|
479
|
-
const colorClasses = {
|
|
480
|
-
primary: "bg-transparent text-button-text-primary-text",
|
|
481
|
-
negative: "bg-transparent text-button-text-negative-text",
|
|
482
|
-
neutral: "bg-transparent text-button-text-neutral-text"
|
|
483
|
-
}[color];
|
|
484
|
-
const iconColorClasses = {
|
|
485
|
-
primary: "text-button-text-primary-icon",
|
|
486
|
-
negative: "text-button-text-negative-icon",
|
|
487
|
-
neutral: "text-button-text-neutral-icon"
|
|
488
|
-
}[color];
|
|
489
|
-
return /* @__PURE__ */ jsxs2(
|
|
490
|
-
"button",
|
|
491
|
-
{
|
|
492
|
-
onClick: disabled ? void 0 : onClick,
|
|
493
|
-
disabled: disabled || onClick === void 0,
|
|
494
|
-
className: clsx3(
|
|
495
|
-
{
|
|
496
|
-
"text-disabled-text cursor-not-allowed": disabled,
|
|
497
|
-
[clsx3(colorClasses, "hover:bg-button-text-hover-background")]: !disabled
|
|
498
|
-
},
|
|
499
|
-
ButtonUtil.paddingMapping[size],
|
|
500
|
-
className
|
|
501
|
-
),
|
|
502
|
-
...restProps,
|
|
503
|
-
children: [
|
|
504
|
-
startIcon && /* @__PURE__ */ jsx4(
|
|
505
|
-
"span",
|
|
506
|
-
{
|
|
507
|
-
className: clsx3({
|
|
508
|
-
[iconColorClasses]: !disabled,
|
|
509
|
-
[`text-disabled-icon`]: disabled
|
|
510
|
-
}),
|
|
511
|
-
children: startIcon
|
|
512
|
-
}
|
|
513
|
-
),
|
|
514
|
-
children,
|
|
515
|
-
endIcon && /* @__PURE__ */ jsx4(
|
|
516
|
-
"span",
|
|
517
|
-
{
|
|
518
|
-
className: clsx3({
|
|
519
|
-
[iconColorClasses]: !disabled,
|
|
520
|
-
[`text-disabled-icon`]: disabled
|
|
521
|
-
}),
|
|
522
|
-
children: endIcon
|
|
523
|
-
}
|
|
524
|
-
)
|
|
525
|
-
]
|
|
526
|
-
}
|
|
527
|
-
);
|
|
528
|
-
};
|
|
529
|
-
var IconButton = ({
|
|
530
|
-
children,
|
|
531
|
-
disabled = false,
|
|
532
|
-
color = "primary",
|
|
533
|
-
size = "medium",
|
|
534
|
-
onClick,
|
|
535
|
-
className,
|
|
536
|
-
...restProps
|
|
537
|
-
}) => {
|
|
538
|
-
const colorClasses = {
|
|
539
|
-
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
540
|
-
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
541
|
-
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
542
|
-
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
543
|
-
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
544
|
-
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
545
|
-
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
546
|
-
transparent: "bg-transparent"
|
|
547
|
-
}[color];
|
|
548
|
-
return /* @__PURE__ */ jsx4(
|
|
549
|
-
"button",
|
|
550
|
-
{
|
|
551
|
-
onClick: disabled ? void 0 : onClick,
|
|
552
|
-
disabled: disabled || onClick === void 0,
|
|
553
|
-
className: clsx3(
|
|
554
|
-
{
|
|
555
|
-
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
556
|
-
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
557
|
-
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
558
|
-
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
559
|
-
},
|
|
560
|
-
ButtonUtil.iconPaddingMapping[size],
|
|
561
|
-
className
|
|
562
|
-
),
|
|
563
|
-
...restProps,
|
|
564
|
-
children
|
|
565
|
-
}
|
|
566
|
-
);
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
// src/hooks/useSearch.ts
|
|
570
|
-
import { useEffect as useEffect6, useMemo, useState as useState5 } from "react";
|
|
571
|
-
|
|
572
|
-
// src/util/simpleSearch.ts
|
|
573
|
-
var MultiSearchWithMapping = (search, objects, mapping) => {
|
|
574
|
-
return objects.filter((object) => {
|
|
575
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
576
|
-
if (!mappedSearchKeywords) {
|
|
577
|
-
return true;
|
|
578
|
-
}
|
|
579
|
-
return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
|
|
580
|
-
});
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
// src/hooks/useSearch.ts
|
|
584
|
-
var useSearch = ({
|
|
585
|
-
list,
|
|
586
|
-
initialSearch,
|
|
587
|
-
searchMapping
|
|
588
|
-
}) => {
|
|
589
|
-
const [items, setItems] = useState5(list);
|
|
590
|
-
const [search, setSearch] = useState5(initialSearch);
|
|
591
|
-
useEffect6(() => {
|
|
592
|
-
setItems(list);
|
|
593
|
-
}, [list]);
|
|
594
|
-
const result = useMemo(
|
|
595
|
-
() => MultiSearchWithMapping(search, items, searchMapping),
|
|
596
|
-
[search, items, searchMapping]
|
|
597
|
-
);
|
|
598
|
-
return {
|
|
599
|
-
result,
|
|
600
|
-
hasResult: result.length > 0,
|
|
601
|
-
allItems: items,
|
|
602
|
-
setItems,
|
|
603
|
-
search,
|
|
604
|
-
setSearch
|
|
605
|
-
};
|
|
606
|
-
};
|
|
607
|
-
|
|
608
741
|
// src/localization/defaults/form.ts
|
|
609
742
|
var formTranslation = {
|
|
610
743
|
en: {
|
|
744
|
+
add: "Add",
|
|
611
745
|
all: "All",
|
|
612
746
|
apply: "Apply",
|
|
613
747
|
back: "Back",
|
|
@@ -620,6 +754,7 @@ var formTranslation = {
|
|
|
620
754
|
confirm: "Confirm",
|
|
621
755
|
copy: "Copy",
|
|
622
756
|
copied: "Copied",
|
|
757
|
+
create: "Create",
|
|
623
758
|
decline: "Decline",
|
|
624
759
|
delete: "Delete",
|
|
625
760
|
discard: "Discard",
|
|
@@ -662,6 +797,7 @@ var formTranslation = {
|
|
|
662
797
|
yes: "Yes"
|
|
663
798
|
},
|
|
664
799
|
de: {
|
|
800
|
+
add: "Hinzuf\xFCgen",
|
|
665
801
|
all: "Alle",
|
|
666
802
|
apply: "Anwenden",
|
|
667
803
|
back: "Zur\xFCck",
|
|
@@ -674,6 +810,7 @@ var formTranslation = {
|
|
|
674
810
|
confirm: "Best\xE4tigen",
|
|
675
811
|
copy: "Kopieren",
|
|
676
812
|
copied: "Kopiert",
|
|
813
|
+
create: "Erstellen",
|
|
677
814
|
decline: "Ablehnen",
|
|
678
815
|
delete: "L\xF6schen",
|
|
679
816
|
discard: "Verwerfen",
|
|
@@ -717,92 +854,316 @@ var formTranslation = {
|
|
|
717
854
|
}
|
|
718
855
|
};
|
|
719
856
|
|
|
720
|
-
// src/components/
|
|
721
|
-
import {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
857
|
+
// src/components/user-action/Button.tsx
|
|
858
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
859
|
+
import clsx6 from "clsx";
|
|
860
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
861
|
+
var ButtonColorUtil = {
|
|
862
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
863
|
+
text: ["primary", "negative", "neutral"],
|
|
864
|
+
outline: ["primary"]
|
|
729
865
|
};
|
|
730
|
-
var
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
866
|
+
var IconButtonUtil = {
|
|
867
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
868
|
+
};
|
|
869
|
+
var paddingMapping = {
|
|
870
|
+
small: "btn-sm",
|
|
871
|
+
medium: "btn-md",
|
|
872
|
+
large: "btn-lg"
|
|
873
|
+
};
|
|
874
|
+
var iconPaddingMapping = {
|
|
875
|
+
tiny: "icon-btn-xs",
|
|
876
|
+
small: "icon-btn-sm",
|
|
877
|
+
medium: "icon-btn-md",
|
|
878
|
+
large: "icon-btn-lg"
|
|
879
|
+
};
|
|
880
|
+
var ButtonUtil = {
|
|
881
|
+
paddingMapping,
|
|
882
|
+
iconPaddingMapping
|
|
883
|
+
};
|
|
884
|
+
var SolidButton = forwardRef3(function SolidButton2({
|
|
885
|
+
children,
|
|
886
|
+
disabled = false,
|
|
887
|
+
color = "primary",
|
|
888
|
+
size = "medium",
|
|
889
|
+
startIcon,
|
|
890
|
+
endIcon,
|
|
891
|
+
onClick,
|
|
738
892
|
className,
|
|
739
|
-
|
|
740
|
-
})
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
893
|
+
...restProps
|
|
894
|
+
}, ref) {
|
|
895
|
+
const colorClasses = {
|
|
896
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
897
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
898
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
899
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
900
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
901
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
902
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
903
|
+
}[color];
|
|
904
|
+
const iconColorClasses = {
|
|
905
|
+
primary: "text-button-solid-primary-icon",
|
|
906
|
+
secondary: "text-button-solid-secondary-icon",
|
|
907
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
908
|
+
positive: "text-button-solid-positive-icon",
|
|
909
|
+
warning: "text-button-solid-warning-icon",
|
|
910
|
+
negative: "text-button-solid-negative-icon",
|
|
911
|
+
neutral: "text-button-solid-neutral-icon"
|
|
912
|
+
}[color];
|
|
913
|
+
return /* @__PURE__ */ jsxs5(
|
|
914
|
+
"button",
|
|
915
|
+
{
|
|
916
|
+
ref,
|
|
917
|
+
onClick,
|
|
918
|
+
disabled,
|
|
919
|
+
className: clsx6(
|
|
747
920
|
{
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
}
|
|
921
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
922
|
+
[clsx6(colorClasses, "hover:brightness-90")]: !disabled
|
|
923
|
+
},
|
|
924
|
+
ButtonUtil.paddingMapping[size],
|
|
925
|
+
className
|
|
754
926
|
),
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
927
|
+
...restProps,
|
|
928
|
+
children: [
|
|
929
|
+
startIcon && /* @__PURE__ */ jsx7(
|
|
930
|
+
"span",
|
|
931
|
+
{
|
|
932
|
+
className: clsx6({
|
|
933
|
+
[iconColorClasses]: !disabled,
|
|
934
|
+
[`text-disabled-icon`]: disabled
|
|
935
|
+
}),
|
|
936
|
+
children: startIcon
|
|
937
|
+
}
|
|
938
|
+
),
|
|
939
|
+
children,
|
|
940
|
+
endIcon && /* @__PURE__ */ jsx7(
|
|
941
|
+
"span",
|
|
942
|
+
{
|
|
943
|
+
className: clsx6({
|
|
944
|
+
[iconColorClasses]: !disabled,
|
|
945
|
+
[`text-disabled-icon`]: disabled
|
|
946
|
+
}),
|
|
947
|
+
children: endIcon
|
|
948
|
+
}
|
|
949
|
+
)
|
|
950
|
+
]
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
});
|
|
954
|
+
var TextButton = ({
|
|
955
|
+
children,
|
|
956
|
+
disabled = false,
|
|
957
|
+
color = "neutral",
|
|
958
|
+
size = "medium",
|
|
959
|
+
startIcon,
|
|
960
|
+
endIcon,
|
|
768
961
|
onClick,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
prefix,
|
|
772
|
-
suffix,
|
|
773
|
-
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
774
|
-
selectedClassName = " bg-primary/20",
|
|
775
|
-
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
776
|
-
className
|
|
962
|
+
className,
|
|
963
|
+
...restProps
|
|
777
964
|
}) => {
|
|
778
|
-
|
|
779
|
-
"
|
|
965
|
+
const colorClasses = {
|
|
966
|
+
primary: "bg-transparent text-button-text-primary-text",
|
|
967
|
+
negative: "bg-transparent text-button-text-negative-text",
|
|
968
|
+
neutral: "bg-transparent text-button-text-neutral-text"
|
|
969
|
+
}[color];
|
|
970
|
+
const iconColorClasses = {
|
|
971
|
+
primary: "text-button-text-primary-icon",
|
|
972
|
+
negative: "text-button-text-negative-icon",
|
|
973
|
+
neutral: "text-button-text-neutral-icon"
|
|
974
|
+
}[color];
|
|
975
|
+
return /* @__PURE__ */ jsxs5(
|
|
976
|
+
"button",
|
|
780
977
|
{
|
|
781
|
-
|
|
782
|
-
|
|
978
|
+
onClick,
|
|
979
|
+
disabled,
|
|
980
|
+
className: clsx6(
|
|
783
981
|
{
|
|
784
|
-
|
|
785
|
-
[
|
|
786
|
-
[disabledClassName]: isDisabled
|
|
982
|
+
"text-disabled-text cursor-not-allowed": disabled,
|
|
983
|
+
[clsx6(colorClasses, "hover:bg-button-text-hover-background")]: !disabled
|
|
787
984
|
},
|
|
985
|
+
ButtonUtil.paddingMapping[size],
|
|
788
986
|
className
|
|
789
987
|
),
|
|
790
|
-
|
|
988
|
+
...restProps,
|
|
791
989
|
children: [
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
990
|
+
startIcon && /* @__PURE__ */ jsx7(
|
|
991
|
+
"span",
|
|
992
|
+
{
|
|
993
|
+
className: clsx6({
|
|
994
|
+
[iconColorClasses]: !disabled,
|
|
995
|
+
[`text-disabled-icon`]: disabled
|
|
996
|
+
}),
|
|
997
|
+
children: startIcon
|
|
998
|
+
}
|
|
999
|
+
),
|
|
1000
|
+
children,
|
|
1001
|
+
endIcon && /* @__PURE__ */ jsx7(
|
|
1002
|
+
"span",
|
|
1003
|
+
{
|
|
1004
|
+
className: clsx6({
|
|
1005
|
+
[iconColorClasses]: !disabled,
|
|
1006
|
+
[`text-disabled-icon`]: disabled
|
|
1007
|
+
}),
|
|
1008
|
+
children: endIcon
|
|
1009
|
+
}
|
|
1010
|
+
)
|
|
798
1011
|
]
|
|
799
1012
|
}
|
|
800
1013
|
);
|
|
801
1014
|
};
|
|
1015
|
+
var IconButton = ({
|
|
1016
|
+
children,
|
|
1017
|
+
disabled = false,
|
|
1018
|
+
color = "primary",
|
|
1019
|
+
size = "medium",
|
|
1020
|
+
className,
|
|
1021
|
+
...restProps
|
|
1022
|
+
}) => {
|
|
1023
|
+
const colorClasses = {
|
|
1024
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
1025
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
1026
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
1027
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
1028
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
1029
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
1030
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
1031
|
+
transparent: "bg-transparent"
|
|
1032
|
+
}[color];
|
|
1033
|
+
return /* @__PURE__ */ jsx7(
|
|
1034
|
+
"button",
|
|
1035
|
+
{
|
|
1036
|
+
disabled,
|
|
1037
|
+
className: clsx6(
|
|
1038
|
+
{
|
|
1039
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
1040
|
+
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
1041
|
+
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
1042
|
+
[clsx6(colorClasses, "hover:brightness-90")]: !disabled
|
|
1043
|
+
},
|
|
1044
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
1045
|
+
className
|
|
1046
|
+
),
|
|
1047
|
+
...restProps,
|
|
1048
|
+
children
|
|
1049
|
+
}
|
|
1050
|
+
);
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
// src/components/user-action/SearchBar.tsx
|
|
1054
|
+
import { Search } from "lucide-react";
|
|
1055
|
+
import { clsx as clsx7 } from "clsx";
|
|
1056
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1057
|
+
var SearchBar = ({
|
|
1058
|
+
placeholder,
|
|
1059
|
+
onSearch,
|
|
1060
|
+
disableOnSearch,
|
|
1061
|
+
containerClassName,
|
|
1062
|
+
...inputProps
|
|
1063
|
+
}) => {
|
|
1064
|
+
const translation = useTranslation([formTranslation]);
|
|
1065
|
+
return /* @__PURE__ */ jsxs6("div", { className: clsx7("flex-row-2 justify-between items-center", containerClassName), children: [
|
|
1066
|
+
/* @__PURE__ */ jsx8(
|
|
1067
|
+
Input,
|
|
1068
|
+
{
|
|
1069
|
+
...inputProps,
|
|
1070
|
+
placeholder: placeholder ?? translation("search")
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
onSearch && /* @__PURE__ */ jsx8(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx8(Search, { className: "w-full h-full" }) })
|
|
1074
|
+
] });
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
// src/hooks/useSearch.ts
|
|
1078
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
|
|
1079
|
+
|
|
1080
|
+
// src/util/simpleSearch.ts
|
|
1081
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
1082
|
+
return objects.filter((object) => {
|
|
1083
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
1084
|
+
if (!mappedSearchKeywords) {
|
|
1085
|
+
return true;
|
|
1086
|
+
}
|
|
1087
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
1088
|
+
});
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
// src/hooks/useSearch.ts
|
|
1092
|
+
var useSearch = ({
|
|
1093
|
+
list,
|
|
1094
|
+
initialSearch,
|
|
1095
|
+
searchMapping,
|
|
1096
|
+
additionalSearchTags,
|
|
1097
|
+
isSearchInstant = true,
|
|
1098
|
+
sortingFunction,
|
|
1099
|
+
filter,
|
|
1100
|
+
disabled = false
|
|
1101
|
+
}) => {
|
|
1102
|
+
const [search, setSearch] = useState8(initialSearch ?? "");
|
|
1103
|
+
const [result, setResult] = useState8(list);
|
|
1104
|
+
const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1105
|
+
const updateSearch = useCallback4((newSearch) => {
|
|
1106
|
+
const usedSearch = newSearch ?? search;
|
|
1107
|
+
if (newSearch) {
|
|
1108
|
+
setSearch(search);
|
|
1109
|
+
}
|
|
1110
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1111
|
+
}, [searchTags, list, search, searchMapping]);
|
|
1112
|
+
useEffect10(() => {
|
|
1113
|
+
if (isSearchInstant) {
|
|
1114
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1115
|
+
}
|
|
1116
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1117
|
+
const filteredResult = useMemo(() => {
|
|
1118
|
+
if (!filter) {
|
|
1119
|
+
return result;
|
|
1120
|
+
}
|
|
1121
|
+
return result.filter(filter);
|
|
1122
|
+
}, [result, filter]);
|
|
1123
|
+
const sortedAndFilteredResult = useMemo(() => {
|
|
1124
|
+
if (!sortingFunction) {
|
|
1125
|
+
return filteredResult;
|
|
1126
|
+
}
|
|
1127
|
+
return filteredResult.sort(sortingFunction);
|
|
1128
|
+
}, [filteredResult, sortingFunction]);
|
|
1129
|
+
const usedResult = useMemo(() => {
|
|
1130
|
+
if (!disabled) {
|
|
1131
|
+
return sortedAndFilteredResult;
|
|
1132
|
+
}
|
|
1133
|
+
return list;
|
|
1134
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
1135
|
+
return {
|
|
1136
|
+
result: usedResult,
|
|
1137
|
+
hasResult: usedResult.length > 0,
|
|
1138
|
+
allItems: list,
|
|
1139
|
+
updateSearch,
|
|
1140
|
+
search,
|
|
1141
|
+
setSearch
|
|
1142
|
+
};
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
// src/components/user-action/Select.tsx
|
|
1146
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1147
|
+
var SelectTile = ({
|
|
1148
|
+
className,
|
|
1149
|
+
disabledClassName,
|
|
1150
|
+
title,
|
|
1151
|
+
...restProps
|
|
1152
|
+
}) => {
|
|
1153
|
+
return /* @__PURE__ */ jsx9(
|
|
1154
|
+
Tile,
|
|
1155
|
+
{
|
|
1156
|
+
...restProps,
|
|
1157
|
+
className: clsx8("px-2 py-1 rounded-md", className),
|
|
1158
|
+
disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
|
|
1159
|
+
title: { ...title, className: title.className ?? "font-semibold" }
|
|
1160
|
+
}
|
|
1161
|
+
);
|
|
1162
|
+
};
|
|
802
1163
|
|
|
803
1164
|
// src/components/layout-and-navigation/Chip.tsx
|
|
804
|
-
import
|
|
805
|
-
import { jsx as
|
|
1165
|
+
import clsx9 from "clsx";
|
|
1166
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
806
1167
|
var Chip = ({
|
|
807
1168
|
children,
|
|
808
1169
|
trailingIcon,
|
|
@@ -829,11 +1190,11 @@ var Chip = ({
|
|
|
829
1190
|
blue: "text-tag-blue-icon",
|
|
830
1191
|
pink: "text-tag-pink-icon"
|
|
831
1192
|
}[color];
|
|
832
|
-
return /* @__PURE__ */
|
|
1193
|
+
return /* @__PURE__ */ jsxs8(
|
|
833
1194
|
"div",
|
|
834
1195
|
{
|
|
835
1196
|
...restProps,
|
|
836
|
-
className:
|
|
1197
|
+
className: clsx9(
|
|
837
1198
|
`row w-fit px-2 py-1`,
|
|
838
1199
|
colorMapping,
|
|
839
1200
|
{
|
|
@@ -844,7 +1205,7 @@ var Chip = ({
|
|
|
844
1205
|
),
|
|
845
1206
|
children: [
|
|
846
1207
|
children,
|
|
847
|
-
trailingIcon && /* @__PURE__ */
|
|
1208
|
+
trailingIcon && /* @__PURE__ */ jsx10("span", { className: colorMappingIcon, children: trailingIcon })
|
|
848
1209
|
]
|
|
849
1210
|
}
|
|
850
1211
|
);
|
|
@@ -853,7 +1214,7 @@ var ChipList = ({
|
|
|
853
1214
|
list,
|
|
854
1215
|
className = ""
|
|
855
1216
|
}) => {
|
|
856
|
-
return /* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ jsx10("div", { className: clsx9("flex flex-wrap gap-x-2 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ jsx10(
|
|
857
1218
|
Chip,
|
|
858
1219
|
{
|
|
859
1220
|
...value,
|
|
@@ -865,28 +1226,74 @@ var ChipList = ({
|
|
|
865
1226
|
)) });
|
|
866
1227
|
};
|
|
867
1228
|
|
|
868
|
-
// src/
|
|
869
|
-
import {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1229
|
+
// src/components/user-action/Checkbox.tsx
|
|
1230
|
+
import { useState as useState10 } from "react";
|
|
1231
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
1232
|
+
import { Check as Check2, Minus } from "lucide-react";
|
|
1233
|
+
import clsx10 from "clsx";
|
|
1234
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1235
|
+
var checkboxSizeMapping = {
|
|
1236
|
+
small: "size-5",
|
|
1237
|
+
medium: "size-6",
|
|
1238
|
+
large: "size-8"
|
|
1239
|
+
};
|
|
1240
|
+
var checkboxIconSizeMapping = {
|
|
1241
|
+
small: "size-4",
|
|
1242
|
+
medium: "size-5",
|
|
1243
|
+
large: "size-7"
|
|
1244
|
+
};
|
|
1245
|
+
var Checkbox = ({
|
|
1246
|
+
id,
|
|
1247
|
+
label,
|
|
1248
|
+
checked,
|
|
1249
|
+
disabled,
|
|
1250
|
+
onChange,
|
|
1251
|
+
onChangeTristate,
|
|
1252
|
+
size = "medium",
|
|
1253
|
+
className = "",
|
|
1254
|
+
containerClassName
|
|
1255
|
+
}) => {
|
|
1256
|
+
const usedSizeClass = checkboxSizeMapping[size];
|
|
1257
|
+
const innerIconSize = checkboxIconSizeMapping[size];
|
|
1258
|
+
const propagateChange = (checked2) => {
|
|
1259
|
+
if (onChangeTristate) {
|
|
1260
|
+
onChangeTristate(checked2);
|
|
1261
|
+
}
|
|
1262
|
+
if (onChange) {
|
|
1263
|
+
onChange(checked2 === "indeterminate" ? false : checked2);
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
const changeValue = () => {
|
|
1267
|
+
const newValue = checked === "indeterminate" ? false : !checked;
|
|
1268
|
+
propagateChange(newValue);
|
|
1269
|
+
};
|
|
1270
|
+
return /* @__PURE__ */ jsxs9("div", { className: clsx10("group flex-row-2 items-center cursor-pointer", containerClassName), onClick: changeValue, children: [
|
|
1271
|
+
/* @__PURE__ */ jsx11(
|
|
1272
|
+
CheckboxPrimitive.Root,
|
|
1273
|
+
{
|
|
1274
|
+
onCheckedChange: propagateChange,
|
|
1275
|
+
checked,
|
|
1276
|
+
disabled,
|
|
1277
|
+
id,
|
|
1278
|
+
className: clsx10(usedSizeClass, `items-center border-2 rounded outline-none `, {
|
|
1279
|
+
"text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
|
|
1280
|
+
"focus:border-primary group-hover:border-primary ": !disabled,
|
|
1281
|
+
"bg-surface": !disabled && !checked,
|
|
1282
|
+
"bg-primary/30 border-primary text-primary": !disabled && checked === true || checked === "indeterminate"
|
|
1283
|
+
}, className),
|
|
1284
|
+
children: /* @__PURE__ */ jsxs9(CheckboxPrimitive.Indicator, { children: [
|
|
1285
|
+
checked === true && /* @__PURE__ */ jsx11(Check2, { className: innerIconSize }),
|
|
1286
|
+
checked === "indeterminate" && /* @__PURE__ */ jsx11(Minus, { className: innerIconSize })
|
|
1287
|
+
] })
|
|
876
1288
|
}
|
|
877
|
-
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
document.addEventListener("touchstart", listener);
|
|
881
|
-
return () => {
|
|
882
|
-
document.removeEventListener("mousedown", listener);
|
|
883
|
-
document.removeEventListener("touchstart", listener);
|
|
884
|
-
};
|
|
885
|
-
}, [refs, handler]);
|
|
1289
|
+
),
|
|
1290
|
+
label && /* @__PURE__ */ jsx11(Label, { ...label, className: clsx10(label.className), htmlFor: id })
|
|
1291
|
+
] });
|
|
886
1292
|
};
|
|
887
1293
|
|
|
888
1294
|
// src/components/user-action/MultiSelect.tsx
|
|
889
|
-
import {
|
|
1295
|
+
import { Plus } from "lucide-react";
|
|
1296
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
890
1297
|
var defaultMultiSelectTranslation = {
|
|
891
1298
|
en: {
|
|
892
1299
|
selected: `{{amount}} selected`
|
|
@@ -897,89 +1304,107 @@ var defaultMultiSelectTranslation = {
|
|
|
897
1304
|
};
|
|
898
1305
|
var MultiSelect = ({
|
|
899
1306
|
overwriteTranslation,
|
|
900
|
-
options,
|
|
901
1307
|
label,
|
|
1308
|
+
options,
|
|
902
1309
|
onChange,
|
|
903
1310
|
hintText,
|
|
904
|
-
isDisabled = false,
|
|
905
|
-
isSearchEnabled = false,
|
|
906
1311
|
selectedDisplayOverwrite,
|
|
1312
|
+
searchOptions,
|
|
1313
|
+
additionalItems,
|
|
907
1314
|
useChipDisplay = false,
|
|
908
|
-
className
|
|
1315
|
+
className,
|
|
1316
|
+
triggerClassName,
|
|
1317
|
+
hintTextClassName,
|
|
1318
|
+
...menuProps
|
|
909
1319
|
}) => {
|
|
910
1320
|
const translation = useTranslation([formTranslation, defaultMultiSelectTranslation], overwriteTranslation);
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1321
|
+
const { result, search, setSearch } = useSearch({
|
|
1322
|
+
list: options,
|
|
1323
|
+
searchMapping: useCallback6((item) => item.searchTags, []),
|
|
1324
|
+
...searchOptions
|
|
1325
|
+
});
|
|
915
1326
|
const selectedItems = options.filter((value) => value.selected);
|
|
916
1327
|
const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
|
|
917
|
-
return /* @__PURE__ */
|
|
918
|
-
label && /* @__PURE__ */
|
|
1328
|
+
return /* @__PURE__ */ jsxs10("div", { className: clsx11(className), children: [
|
|
1329
|
+
label && /* @__PURE__ */ jsx12(
|
|
919
1330
|
Label,
|
|
920
1331
|
{
|
|
921
1332
|
...label,
|
|
922
1333
|
htmlFor: label.name,
|
|
923
|
-
className:
|
|
1334
|
+
className: clsx11(" mb-1", label.className),
|
|
924
1335
|
labelType: label.labelType ?? "labelBig"
|
|
925
1336
|
}
|
|
926
1337
|
),
|
|
927
|
-
/* @__PURE__ */
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
"
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1338
|
+
/* @__PURE__ */ jsx12(
|
|
1339
|
+
Menu,
|
|
1340
|
+
{
|
|
1341
|
+
...menuProps,
|
|
1342
|
+
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsx12(
|
|
1343
|
+
"button",
|
|
1344
|
+
{
|
|
1345
|
+
ref,
|
|
1346
|
+
className: clsx11(
|
|
1347
|
+
"btn-md justify-between w-full border-2 h-auto",
|
|
1348
|
+
{
|
|
1349
|
+
"min-h-14": useChipDisplay,
|
|
1350
|
+
"bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
|
|
1351
|
+
"bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
|
|
1352
|
+
},
|
|
1353
|
+
triggerClassName
|
|
1354
|
+
),
|
|
1355
|
+
onClick: toggleOpen,
|
|
1356
|
+
disabled,
|
|
1357
|
+
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: [
|
|
1358
|
+
!isShowingHint && /* @__PURE__ */ jsx12("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? translation("selected", { replacements: { amount: selectedItems.length.toString() } }) }),
|
|
1359
|
+
isShowingHint && /* @__PURE__ */ jsx12("span", { className: clsx11("textstyle-description", hintTextClassName), children: hintText ?? translation("select") }),
|
|
1360
|
+
/* @__PURE__ */ jsx12(ExpansionIcon, { isExpanded: isOpen })
|
|
1361
|
+
] })
|
|
1362
|
+
}
|
|
1363
|
+
),
|
|
1364
|
+
menuClassName: clsx11("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1365
|
+
children: (bag) => {
|
|
1366
|
+
const { close } = bag;
|
|
1367
|
+
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1368
|
+
!searchOptions?.disabled && /* @__PURE__ */ jsx12(
|
|
1369
|
+
SearchBar,
|
|
957
1370
|
{
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1371
|
+
value: search,
|
|
1372
|
+
onChangeText: setSearch,
|
|
1373
|
+
autoFocus: true
|
|
1374
|
+
}
|
|
1375
|
+
),
|
|
1376
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1377
|
+
result.map((option, index) => {
|
|
1378
|
+
const update = () => {
|
|
1379
|
+
onChange(options.map((value) => value.value === option.value ? {
|
|
1380
|
+
...option,
|
|
1381
|
+
selected: !value.selected
|
|
1382
|
+
} : value));
|
|
1383
|
+
};
|
|
1384
|
+
return /* @__PURE__ */ jsx12(
|
|
1385
|
+
SelectTile,
|
|
963
1386
|
{
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
},
|
|
974
|
-
|
|
1387
|
+
prefix: /* @__PURE__ */ jsx12(
|
|
1388
|
+
Checkbox,
|
|
1389
|
+
{
|
|
1390
|
+
checked: option.selected,
|
|
1391
|
+
onChange: update,
|
|
1392
|
+
size: "small",
|
|
1393
|
+
disabled: option.disabled
|
|
1394
|
+
}
|
|
1395
|
+
),
|
|
1396
|
+
title: { value: option.label },
|
|
1397
|
+
onClick: update,
|
|
1398
|
+
disabled: option.disabled
|
|
975
1399
|
},
|
|
976
1400
|
index
|
|
977
|
-
)
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1401
|
+
);
|
|
1402
|
+
}),
|
|
1403
|
+
additionalItems && additionalItems({ ...bag, search })
|
|
1404
|
+
] }),
|
|
1405
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-row-2 justify-between", children: [
|
|
1406
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-row-2", children: [
|
|
1407
|
+
/* @__PURE__ */ jsx12(
|
|
983
1408
|
SolidButton,
|
|
984
1409
|
{
|
|
985
1410
|
color: "neutral",
|
|
@@ -994,7 +1419,7 @@ var MultiSelect = ({
|
|
|
994
1419
|
children: translation("all")
|
|
995
1420
|
}
|
|
996
1421
|
),
|
|
997
|
-
/* @__PURE__ */
|
|
1422
|
+
/* @__PURE__ */ jsx12(
|
|
998
1423
|
SolidButton,
|
|
999
1424
|
{
|
|
1000
1425
|
color: "neutral",
|
|
@@ -1009,19 +1434,19 @@ var MultiSelect = ({
|
|
|
1009
1434
|
}
|
|
1010
1435
|
)
|
|
1011
1436
|
] }),
|
|
1012
|
-
/* @__PURE__ */
|
|
1437
|
+
/* @__PURE__ */ jsx12(SolidButton, { size: "small", onClick: close, children: "Done" })
|
|
1013
1438
|
] })
|
|
1014
|
-
]
|
|
1439
|
+
] });
|
|
1015
1440
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1441
|
+
}
|
|
1442
|
+
)
|
|
1018
1443
|
] });
|
|
1019
1444
|
};
|
|
1020
1445
|
|
|
1021
1446
|
// src/components/properties/PropertyBase.tsx
|
|
1022
1447
|
import { AlertTriangle } from "lucide-react";
|
|
1023
|
-
import
|
|
1024
|
-
import { jsx as
|
|
1448
|
+
import clsx12 from "clsx";
|
|
1449
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1025
1450
|
var PropertyBase = ({
|
|
1026
1451
|
overwriteTranslation,
|
|
1027
1452
|
name,
|
|
@@ -1035,36 +1460,44 @@ var PropertyBase = ({
|
|
|
1035
1460
|
}) => {
|
|
1036
1461
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1037
1462
|
const requiredAndNoValue = softRequired && !hasValue;
|
|
1038
|
-
return /* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ jsxs11("div", { className: clsx12("flex-row-0 group", className), children: [
|
|
1464
|
+
/* @__PURE__ */ jsxs11(
|
|
1040
1465
|
"div",
|
|
1041
1466
|
{
|
|
1042
|
-
className:
|
|
1043
|
-
"
|
|
1044
|
-
|
|
1045
|
-
|
|
1467
|
+
className: clsx12(
|
|
1468
|
+
"flex-row-2 max-w-48 min-w-48 px-3 py-2 items-center rounded-l-xl border-2 border-r-0",
|
|
1469
|
+
{
|
|
1470
|
+
"bg-property-title-background text-property-title-text group-hover:border-primary": !requiredAndNoValue,
|
|
1471
|
+
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
1472
|
+
},
|
|
1473
|
+
className
|
|
1474
|
+
),
|
|
1046
1475
|
children: [
|
|
1047
|
-
icon,
|
|
1048
|
-
name
|
|
1476
|
+
/* @__PURE__ */ jsx13("div", { className: "max-w-6 min-w-6 text-text-default", children: icon }),
|
|
1477
|
+
/* @__PURE__ */ jsx13("span", { className: "font-semibold", children: name })
|
|
1049
1478
|
]
|
|
1050
1479
|
}
|
|
1051
1480
|
),
|
|
1052
|
-
/* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ jsxs11(
|
|
1053
1482
|
"div",
|
|
1054
1483
|
{
|
|
1055
|
-
className:
|
|
1056
|
-
"
|
|
1057
|
-
|
|
1058
|
-
|
|
1484
|
+
className: clsx12(
|
|
1485
|
+
"flex-row-2 grow px-3 py-2 justify-between items-center rounded-r-xl border-2 border-l-0 min-h-15",
|
|
1486
|
+
{
|
|
1487
|
+
"bg-surface group-hover:border-primary": !requiredAndNoValue,
|
|
1488
|
+
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
1489
|
+
},
|
|
1490
|
+
className
|
|
1491
|
+
),
|
|
1059
1492
|
children: [
|
|
1060
1493
|
input({ softRequired, hasValue }),
|
|
1061
|
-
requiredAndNoValue && /* @__PURE__ */
|
|
1062
|
-
onRemove && /* @__PURE__ */
|
|
1494
|
+
requiredAndNoValue && /* @__PURE__ */ jsx13("div", { className: "text-warning", children: /* @__PURE__ */ jsx13(AlertTriangle, { size: 24 }) }),
|
|
1495
|
+
onRemove && hasValue && /* @__PURE__ */ jsx13(
|
|
1063
1496
|
TextButton,
|
|
1064
1497
|
{
|
|
1065
1498
|
onClick: onRemove,
|
|
1066
1499
|
color: "negative",
|
|
1067
|
-
className:
|
|
1500
|
+
className: clsx12("items-center", { "!text-transparent": !hasValue || readOnly }),
|
|
1068
1501
|
disabled: !hasValue || readOnly,
|
|
1069
1502
|
children: translation("remove")
|
|
1070
1503
|
}
|
|
@@ -1076,7 +1509,7 @@ var PropertyBase = ({
|
|
|
1076
1509
|
};
|
|
1077
1510
|
|
|
1078
1511
|
// src/components/properties/MultiSelectProperty.tsx
|
|
1079
|
-
import { jsx as
|
|
1512
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1080
1513
|
var MultiSelectProperty = ({
|
|
1081
1514
|
overwriteTranslation,
|
|
1082
1515
|
options,
|
|
@@ -1084,11 +1517,12 @@ var MultiSelectProperty = ({
|
|
|
1084
1517
|
readOnly = false,
|
|
1085
1518
|
softRequired,
|
|
1086
1519
|
onRemove,
|
|
1520
|
+
onAddNew,
|
|
1087
1521
|
...multiSelectProps
|
|
1088
1522
|
}) => {
|
|
1089
1523
|
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1090
1524
|
const hasValue = options.some((value) => value.selected);
|
|
1091
|
-
return /* @__PURE__ */
|
|
1525
|
+
return /* @__PURE__ */ jsx14(
|
|
1092
1526
|
PropertyBase,
|
|
1093
1527
|
{
|
|
1094
1528
|
name,
|
|
@@ -1096,20 +1530,42 @@ var MultiSelectProperty = ({
|
|
|
1096
1530
|
readOnly,
|
|
1097
1531
|
softRequired,
|
|
1098
1532
|
hasValue,
|
|
1099
|
-
icon: /* @__PURE__ */
|
|
1100
|
-
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */
|
|
1101
|
-
|
|
1533
|
+
icon: /* @__PURE__ */ jsx14(List, { size: 24 }),
|
|
1534
|
+
input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx14(
|
|
1535
|
+
MultiSelect,
|
|
1102
1536
|
{
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1537
|
+
...multiSelectProps,
|
|
1538
|
+
className: clsx13("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
|
|
1539
|
+
options,
|
|
1540
|
+
disabled: readOnly,
|
|
1541
|
+
useChipDisplay: true,
|
|
1542
|
+
hintText: `${translation("select")}...`,
|
|
1543
|
+
searchOptions: {
|
|
1544
|
+
sortingFunction: (a, b) => a.value.localeCompare(b.value),
|
|
1545
|
+
...multiSelectProps?.searchOptions
|
|
1546
|
+
},
|
|
1547
|
+
additionalItems: ({ close, search }) => {
|
|
1548
|
+
if (!onAddNew && !search.trim()) {
|
|
1549
|
+
return void 0;
|
|
1550
|
+
}
|
|
1551
|
+
return /* @__PURE__ */ jsx14(
|
|
1552
|
+
SelectTile,
|
|
1553
|
+
{
|
|
1554
|
+
prefix: /* @__PURE__ */ jsx14(Plus2, {}),
|
|
1555
|
+
title: { value: `${translation("add")} ${search.trim()}` },
|
|
1556
|
+
onClick: () => {
|
|
1557
|
+
onAddNew(search);
|
|
1558
|
+
close();
|
|
1559
|
+
},
|
|
1560
|
+
disabled: options.some((value) => value.value === search.trim())
|
|
1561
|
+
}
|
|
1562
|
+
);
|
|
1563
|
+
},
|
|
1564
|
+
triggerClassName: clsx13(
|
|
1565
|
+
"!border-none !p-0 !min-h-10",
|
|
1106
1566
|
{
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
options,
|
|
1110
|
-
isDisabled: readOnly,
|
|
1111
|
-
useChipDisplay: true,
|
|
1112
|
-
hintText: `${translation("select")}...`
|
|
1567
|
+
"!bg-warning !text-surface-warning": softRequired2 && !hasValue,
|
|
1568
|
+
"": !softRequired2 || hasValue
|
|
1113
1569
|
}
|
|
1114
1570
|
)
|
|
1115
1571
|
}
|