@helpwave/hightide 0.1.11 → 0.1.13
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/date/DatePicker.js +37 -7
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +37 -7
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +27 -6
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +27 -6
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +36 -6
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +36 -6
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +16 -2
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +16 -2
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +42 -9
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +42 -9
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.js +1 -1
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +16 -2
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +16 -2
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.d.mts +6 -3
- package/dist/components/layout-and-navigation/Pagination.d.ts +6 -3
- package/dist/components/layout-and-navigation/Pagination.js +404 -19
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +404 -19
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +187 -67
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +183 -63
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +37 -5
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +37 -5
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +2 -0
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +2 -0
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +2 -0
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +2 -0
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +2 -0
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +2 -0
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +9 -0
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +9 -0
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +16 -2
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +16 -2
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +16 -2
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +16 -2
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.d.mts +1 -0
- package/dist/components/modals/InputModal.d.ts +1 -0
- package/dist/components/modals/InputModal.js +196 -76
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +189 -69
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +203 -83
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +192 -72
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +206 -86
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +193 -73
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +17 -5
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +17 -5
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +182 -65
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +179 -62
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.js +194 -74
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +187 -67
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +182 -65
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +179 -62
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +12 -1
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +12 -1
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.js +194 -74
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +187 -67
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +43 -34
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +43 -34
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/FillerRowElement.d.mts +8 -0
- package/dist/components/table/FillerRowElement.d.ts +8 -0
- package/dist/components/table/FillerRowElement.js +36 -0
- package/dist/components/table/FillerRowElement.js.map +1 -0
- package/dist/components/table/FillerRowElement.mjs +12 -0
- package/dist/components/table/FillerRowElement.mjs.map +1 -0
- package/dist/components/table/Filter.d.mts +5 -0
- package/dist/components/table/Filter.d.ts +5 -0
- package/dist/components/table/Filter.js +41 -0
- package/dist/components/table/Filter.js.map +1 -0
- package/dist/components/table/Filter.mjs +17 -0
- package/dist/components/table/Filter.mjs.map +1 -0
- package/dist/components/table/Table.d.mts +41 -0
- package/dist/components/table/Table.d.ts +41 -0
- package/dist/components/table/Table.js +1549 -0
- package/dist/components/table/Table.js.map +1 -0
- package/dist/components/table/Table.mjs +1520 -0
- package/dist/components/table/Table.mjs.map +1 -0
- package/dist/components/table/TableCell.d.mts +9 -0
- package/dist/components/table/TableCell.d.ts +9 -0
- package/dist/components/table/TableCell.js +37 -0
- package/dist/components/table/TableCell.js.map +1 -0
- package/dist/components/table/TableCell.mjs +13 -0
- package/dist/components/table/TableCell.mjs.map +1 -0
- package/dist/components/table/TableFilterButton.d.mts +11 -0
- package/dist/components/table/TableFilterButton.d.ts +11 -0
- package/dist/components/table/TableFilterButton.js +888 -0
- package/dist/components/table/TableFilterButton.js.map +1 -0
- package/dist/components/table/TableFilterButton.mjs +852 -0
- package/dist/components/table/TableFilterButton.mjs.map +1 -0
- package/dist/components/table/TableSortButton.d.mts +15 -0
- package/dist/components/table/TableSortButton.d.ts +15 -0
- package/dist/components/table/TableSortButton.js +136 -0
- package/dist/components/table/TableSortButton.js.map +1 -0
- package/dist/components/table/TableSortButton.mjs +102 -0
- package/dist/components/table/TableSortButton.mjs.map +1 -0
- package/dist/components/user-action/Button.d.mts +20 -5
- package/dist/components/user-action/Button.d.ts +20 -5
- package/dist/components/user-action/Button.js +12 -3
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +11 -3
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +5 -4
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +5 -4
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +41 -9
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +41 -9
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Input.d.mts +27 -7
- package/dist/components/user-action/Input.d.ts +27 -7
- package/dist/components/user-action/Input.js +173 -64
- package/dist/components/user-action/Input.js.map +1 -1
- package/dist/components/user-action/Input.mjs +172 -63
- package/dist/components/user-action/Input.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.js +195 -75
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +187 -67
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +26 -5
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +26 -5
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/Select.js +195 -75
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +187 -67
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +3 -1
- package/dist/components/user-action/Textarea.d.ts +3 -1
- package/dist/components/user-action/Textarea.js +31 -33
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +31 -33
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.d.mts +3 -1
- package/dist/components/user-action/ToggleableInput.d.ts +3 -1
- package/dist/components/user-action/ToggleableInput.js +31 -33
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +31 -33
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +431 -186
- package/dist/css/uncompiled/globals.css +36 -493
- package/dist/css/uncompiled/textstyles.css +69 -0
- package/dist/css/uncompiled/theme/colors-basic.css +72 -0
- package/dist/css/uncompiled/theme/colors-component.css +143 -0
- package/dist/css/uncompiled/theme/colors-semantic.css +99 -0
- package/dist/css/uncompiled/theme/index.css +5 -0
- package/dist/css/uncompiled/theme/theme.css +0 -0
- package/dist/css/uncompiled/theme/variants.css +3 -0
- package/dist/css/uncompiled/utitlity/animation.css +111 -0
- package/dist/css/uncompiled/utitlity/borderradius.css +23 -0
- package/dist/css/uncompiled/utitlity/general.css +11 -0
- package/dist/css/uncompiled/utitlity/index.css +4 -0
- package/dist/css/uncompiled/utitlity/shadow.css +29 -0
- package/dist/hooks/useDelay.d.mts +11 -0
- package/dist/hooks/useDelay.d.ts +11 -0
- package/dist/hooks/useDelay.js +64 -0
- package/dist/hooks/useDelay.js.map +1 -0
- package/dist/hooks/useDelay.mjs +40 -0
- package/dist/hooks/useDelay.mjs.map +1 -0
- package/dist/hooks/useFocusManagement.d.mts +9 -0
- package/dist/hooks/useFocusManagement.d.ts +9 -0
- package/dist/hooks/useFocusManagement.js +84 -0
- package/dist/hooks/useFocusManagement.js.map +1 -0
- package/dist/hooks/useFocusManagement.mjs +60 -0
- package/dist/hooks/useFocusManagement.mjs.map +1 -0
- package/dist/hooks/useFocusOnceVisible.d.mts +5 -0
- package/dist/hooks/useFocusOnceVisible.d.ts +5 -0
- package/dist/hooks/useFocusOnceVisible.js +60 -0
- package/dist/hooks/useFocusOnceVisible.js.map +1 -0
- package/dist/hooks/useFocusOnceVisible.mjs +26 -0
- package/dist/hooks/useFocusOnceVisible.mjs.map +1 -0
- package/dist/hooks/useRerender.d.mts +5 -0
- package/dist/hooks/useRerender.d.ts +5 -0
- package/dist/hooks/useRerender.js +33 -0
- package/dist/hooks/useRerender.js.map +1 -0
- package/dist/hooks/useRerender.mjs +9 -0
- package/dist/hooks/useRerender.mjs.map +1 -0
- package/dist/hooks/useResizeCallbackWrapper.d.mts +11 -0
- package/dist/hooks/useResizeCallbackWrapper.d.ts +11 -0
- package/dist/hooks/useResizeCallbackWrapper.js +38 -0
- package/dist/hooks/useResizeCallbackWrapper.js.map +1 -0
- package/dist/hooks/useResizeCallbackWrapper.mjs +14 -0
- package/dist/hooks/useResizeCallbackWrapper.mjs.map +1 -0
- package/dist/index.d.mts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +1428 -860
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1370 -799
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +1 -0
- package/dist/localization/defaults/form.d.ts +1 -0
- package/dist/localization/defaults/form.js +2 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +2 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/array.d.mts +11 -5
- package/dist/util/array.d.ts +11 -5
- package/dist/util/array.js +25 -4
- package/dist/util/array.js.map +1 -1
- package/dist/util/array.mjs +25 -4
- package/dist/util/array.mjs.map +1 -1
- package/dist/util/date.js.map +1 -1
- package/dist/util/date.mjs.map +1 -1
- package/dist/util/resolveSetState.d.mts +5 -0
- package/dist/util/resolveSetState.d.ts +5 -0
- package/dist/util/resolveSetState.js +32 -0
- package/dist/util/resolveSetState.js.map +1 -0
- package/dist/util/resolveSetState.mjs +8 -0
- package/dist/util/resolveSetState.mjs.map +1 -0
- package/package.json +4 -2
- package/dist/components/layout-and-navigation/Table.d.mts +0 -99
- package/dist/components/layout-and-navigation/Table.d.ts +0 -99
- package/dist/components/layout-and-navigation/Table.js +0 -688
- package/dist/components/layout-and-navigation/Table.js.map +0 -1
- package/dist/components/layout-and-navigation/Table.mjs +0 -645
- package/dist/components/layout-and-navigation/Table.mjs.map +0 -1
- package/dist/hooks/useSaveDelay.d.mts +0 -6
- package/dist/hooks/useSaveDelay.d.ts +0 -6
- package/dist/hooks/useSaveDelay.js +0 -67
- package/dist/hooks/useSaveDelay.js.map +0 -1
- package/dist/hooks/useSaveDelay.mjs +0 -43
- package/dist/hooks/useSaveDelay.mjs.map +0 -1
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
// src/components/user-action/Button.tsx
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var ButtonColorUtil = {
|
|
5
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
6
|
+
text: ["primary", "negative", "neutral"],
|
|
7
|
+
outline: ["primary"]
|
|
8
|
+
};
|
|
9
|
+
var IconButtonUtil = {
|
|
10
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
11
|
+
};
|
|
12
|
+
var paddingMapping = {
|
|
13
|
+
small: "btn-sm",
|
|
14
|
+
medium: "btn-md",
|
|
15
|
+
large: "btn-lg"
|
|
16
|
+
};
|
|
17
|
+
var iconPaddingMapping = {
|
|
18
|
+
tiny: "icon-btn-xs",
|
|
19
|
+
small: "icon-btn-sm",
|
|
20
|
+
medium: "icon-btn-md",
|
|
21
|
+
large: "icon-btn-lg"
|
|
22
|
+
};
|
|
23
|
+
var ButtonUtil = {
|
|
24
|
+
paddingMapping,
|
|
25
|
+
iconPaddingMapping
|
|
26
|
+
};
|
|
27
|
+
var SolidButton = ({
|
|
28
|
+
children,
|
|
29
|
+
disabled = false,
|
|
30
|
+
color = "primary",
|
|
31
|
+
size = "medium",
|
|
32
|
+
startIcon,
|
|
33
|
+
endIcon,
|
|
34
|
+
onClick,
|
|
35
|
+
className,
|
|
36
|
+
...restProps
|
|
37
|
+
}) => {
|
|
38
|
+
const colorClasses = {
|
|
39
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
40
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
41
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
42
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
43
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
44
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
45
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
46
|
+
}[color];
|
|
47
|
+
const iconColorClasses = {
|
|
48
|
+
primary: "text-button-solid-primary-icon",
|
|
49
|
+
secondary: "text-button-solid-secondary-icon",
|
|
50
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
51
|
+
positive: "text-button-solid-positive-icon",
|
|
52
|
+
warning: "text-button-solid-warning-icon",
|
|
53
|
+
negative: "text-button-solid-negative-icon",
|
|
54
|
+
neutral: "text-button-solid-neutral-icon"
|
|
55
|
+
}[color];
|
|
56
|
+
return /* @__PURE__ */ jsxs(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
onClick: disabled ? void 0 : onClick,
|
|
60
|
+
disabled: disabled || onClick === void 0,
|
|
61
|
+
className: clsx(
|
|
62
|
+
{
|
|
63
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
64
|
+
[clsx(colorClasses, "hover:brightness-90")]: !disabled
|
|
65
|
+
},
|
|
66
|
+
ButtonUtil.paddingMapping[size],
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
...restProps,
|
|
70
|
+
children: [
|
|
71
|
+
startIcon && /* @__PURE__ */ jsx(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
className: clsx({
|
|
75
|
+
[iconColorClasses]: !disabled,
|
|
76
|
+
[`text-disabled-icon`]: disabled
|
|
77
|
+
}),
|
|
78
|
+
children: startIcon
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
children,
|
|
82
|
+
endIcon && /* @__PURE__ */ jsx(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
className: clsx({
|
|
86
|
+
[iconColorClasses]: !disabled,
|
|
87
|
+
[`text-disabled-icon`]: disabled
|
|
88
|
+
}),
|
|
89
|
+
children: endIcon
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
var IconButton = ({
|
|
97
|
+
children,
|
|
98
|
+
disabled = false,
|
|
99
|
+
color = "primary",
|
|
100
|
+
size = "medium",
|
|
101
|
+
onClick,
|
|
102
|
+
className,
|
|
103
|
+
...restProps
|
|
104
|
+
}) => {
|
|
105
|
+
const colorClasses = {
|
|
106
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
107
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
108
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
109
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
110
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
111
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
112
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
113
|
+
transparent: "bg-transparent"
|
|
114
|
+
}[color];
|
|
115
|
+
return /* @__PURE__ */ jsx(
|
|
116
|
+
"button",
|
|
117
|
+
{
|
|
118
|
+
onClick: disabled ? void 0 : onClick,
|
|
119
|
+
disabled: disabled || onClick === void 0,
|
|
120
|
+
className: clsx(
|
|
121
|
+
{
|
|
122
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
123
|
+
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
124
|
+
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
125
|
+
[clsx(colorClasses, "hover:brightness-90")]: !disabled
|
|
126
|
+
},
|
|
127
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
128
|
+
className
|
|
129
|
+
),
|
|
130
|
+
...restProps,
|
|
131
|
+
children
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/components/user-action/Input.tsx
|
|
137
|
+
import { forwardRef, useEffect as useEffect3, useImperativeHandle, useRef, useState as useState2 } from "react";
|
|
138
|
+
import clsx3 from "clsx";
|
|
139
|
+
|
|
140
|
+
// src/hooks/useDelay.ts
|
|
141
|
+
import { useEffect, useState } from "react";
|
|
142
|
+
var defaultOptions = {
|
|
143
|
+
delay: 3e3,
|
|
144
|
+
disabled: false
|
|
145
|
+
};
|
|
146
|
+
function useDelay(options) {
|
|
147
|
+
const [timer, setTimer] = useState(void 0);
|
|
148
|
+
const { delay, disabled } = {
|
|
149
|
+
...defaultOptions,
|
|
150
|
+
...options
|
|
151
|
+
};
|
|
152
|
+
const restartTimer = (onDelayFinish) => {
|
|
153
|
+
if (disabled) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
clearTimeout(timer);
|
|
157
|
+
setTimer(setTimeout(() => {
|
|
158
|
+
onDelayFinish();
|
|
159
|
+
}, delay));
|
|
160
|
+
};
|
|
161
|
+
const clearTimer = () => {
|
|
162
|
+
clearTimeout(timer);
|
|
163
|
+
};
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
return () => {
|
|
166
|
+
clearTimeout(timer);
|
|
167
|
+
};
|
|
168
|
+
}, [timer]);
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
if (disabled) {
|
|
171
|
+
clearTimeout(timer);
|
|
172
|
+
}
|
|
173
|
+
}, [disabled, timer]);
|
|
174
|
+
return { restartTimer, clearTimer };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// src/util/noop.ts
|
|
178
|
+
var noop = () => void 0;
|
|
179
|
+
|
|
180
|
+
// src/components/user-action/Label.tsx
|
|
181
|
+
import clsx2 from "clsx";
|
|
182
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
183
|
+
var styleMapping = {
|
|
184
|
+
labelSmall: "textstyle-label-sm",
|
|
185
|
+
labelMedium: "textstyle-label-md",
|
|
186
|
+
labelBig: "textstyle-label-lg"
|
|
187
|
+
};
|
|
188
|
+
var Label = ({
|
|
189
|
+
children,
|
|
190
|
+
name,
|
|
191
|
+
labelType = "labelSmall",
|
|
192
|
+
className,
|
|
193
|
+
...props
|
|
194
|
+
}) => {
|
|
195
|
+
return /* @__PURE__ */ jsx2("label", { ...props, className: clsx2(styleMapping[labelType], className), children: children ? children : name });
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/hooks/useFocusManagement.ts
|
|
199
|
+
import { useCallback } from "react";
|
|
200
|
+
function useFocusManagement() {
|
|
201
|
+
const getFocusableElements = useCallback(() => {
|
|
202
|
+
return Array.from(
|
|
203
|
+
document.querySelectorAll(
|
|
204
|
+
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
205
|
+
)
|
|
206
|
+
).filter(
|
|
207
|
+
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
208
|
+
);
|
|
209
|
+
}, []);
|
|
210
|
+
const getNextFocusElement = useCallback(() => {
|
|
211
|
+
const elements = getFocusableElements();
|
|
212
|
+
if (elements.length === 0) {
|
|
213
|
+
return void 0;
|
|
214
|
+
}
|
|
215
|
+
let nextElement = elements[0];
|
|
216
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
217
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
218
|
+
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
219
|
+
}
|
|
220
|
+
return nextElement;
|
|
221
|
+
}, [getFocusableElements]);
|
|
222
|
+
const focusNext = useCallback(() => {
|
|
223
|
+
const nextElement = getNextFocusElement();
|
|
224
|
+
nextElement?.focus();
|
|
225
|
+
}, [getNextFocusElement]);
|
|
226
|
+
const getPreviousFocusElement = useCallback(() => {
|
|
227
|
+
const elements = getFocusableElements();
|
|
228
|
+
if (elements.length === 0) {
|
|
229
|
+
return void 0;
|
|
230
|
+
}
|
|
231
|
+
let previousElement = elements[0];
|
|
232
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
233
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
234
|
+
if (currentIndex === 0) {
|
|
235
|
+
previousElement = elements[elements.length - 1];
|
|
236
|
+
} else {
|
|
237
|
+
previousElement = elements[currentIndex - 1];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return previousElement;
|
|
241
|
+
}, [getFocusableElements]);
|
|
242
|
+
const focusPrevious = useCallback(() => {
|
|
243
|
+
const previousElement = getPreviousFocusElement();
|
|
244
|
+
if (previousElement) previousElement.focus();
|
|
245
|
+
}, [getPreviousFocusElement]);
|
|
246
|
+
return {
|
|
247
|
+
getFocusableElements,
|
|
248
|
+
getNextFocusElement,
|
|
249
|
+
getPreviousFocusElement,
|
|
250
|
+
focusNext,
|
|
251
|
+
focusPrevious
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/hooks/useFocusOnceVisible.ts
|
|
256
|
+
import React, { useEffect as useEffect2 } from "react";
|
|
257
|
+
var useFocusOnceVisible = (ref, disable = false) => {
|
|
258
|
+
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
259
|
+
useEffect2(() => {
|
|
260
|
+
if (disable || hasUsedFocus) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
264
|
+
if (entry.isIntersecting && !hasUsedFocus) {
|
|
265
|
+
ref.current?.focus();
|
|
266
|
+
setHasUsedFocus(hasUsedFocus);
|
|
267
|
+
}
|
|
268
|
+
}, {
|
|
269
|
+
threshold: 0.1
|
|
270
|
+
});
|
|
271
|
+
if (ref.current) {
|
|
272
|
+
observer.observe(ref.current);
|
|
273
|
+
}
|
|
274
|
+
return () => observer.disconnect();
|
|
275
|
+
}, [disable, hasUsedFocus, ref]);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// src/components/user-action/Input.tsx
|
|
279
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
280
|
+
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
281
|
+
return clsx3(
|
|
282
|
+
"px-2 py-1.5 rounded-md border-2",
|
|
283
|
+
{
|
|
284
|
+
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
285
|
+
"bg-on-negative text-negative border-negative-border hover:border-negative-border-hover": !disabled && hasError,
|
|
286
|
+
"bg-disabled-background text-disabled-text border-disabled-border": disabled
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
};
|
|
290
|
+
var defaultEditCompleteOptions = {
|
|
291
|
+
onBlur: true,
|
|
292
|
+
afterDelay: true,
|
|
293
|
+
delay: 2500
|
|
294
|
+
};
|
|
295
|
+
var Input = forwardRef(function Input2({
|
|
296
|
+
id,
|
|
297
|
+
type = "text",
|
|
298
|
+
value,
|
|
299
|
+
label,
|
|
300
|
+
onChange = noop,
|
|
301
|
+
onChangeText = noop,
|
|
302
|
+
onEditCompleted,
|
|
303
|
+
className = "",
|
|
304
|
+
allowEnterComplete = true,
|
|
305
|
+
expanded = true,
|
|
306
|
+
autoFocus = false,
|
|
307
|
+
onBlur,
|
|
308
|
+
editCompleteOptions,
|
|
309
|
+
containerClassName,
|
|
310
|
+
disabled,
|
|
311
|
+
...restProps
|
|
312
|
+
}, forwardedRef) {
|
|
313
|
+
const { onBlur: allowEditCompleteOnBlur, afterDelay, delay } = { ...defaultEditCompleteOptions, ...editCompleteOptions };
|
|
314
|
+
const {
|
|
315
|
+
restartTimer,
|
|
316
|
+
clearTimer
|
|
317
|
+
} = useDelay({ delay, disabled: !afterDelay });
|
|
318
|
+
const innerRef = useRef(null);
|
|
319
|
+
const { focusNext } = useFocusManagement();
|
|
320
|
+
useFocusOnceVisible(innerRef, !autoFocus);
|
|
321
|
+
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
322
|
+
const handleKeyDown = (e) => {
|
|
323
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
324
|
+
e.preventDefault();
|
|
325
|
+
innerRef.current?.blur();
|
|
326
|
+
focusNext();
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
return /* @__PURE__ */ jsxs2("div", { className: clsx3({ "w-full": expanded }, containerClassName), children: [
|
|
330
|
+
label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx3("mb-1", label.className) }),
|
|
331
|
+
/* @__PURE__ */ jsx3(
|
|
332
|
+
"input",
|
|
333
|
+
{
|
|
334
|
+
...restProps,
|
|
335
|
+
ref: innerRef,
|
|
336
|
+
value,
|
|
337
|
+
id,
|
|
338
|
+
type,
|
|
339
|
+
disabled,
|
|
340
|
+
className: clsx3(getInputClassName({ disabled }), className),
|
|
341
|
+
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
342
|
+
onBlur: (event) => {
|
|
343
|
+
onBlur?.(event);
|
|
344
|
+
if (onEditCompleted && allowEditCompleteOnBlur) {
|
|
345
|
+
onEditCompleted(event.target.value);
|
|
346
|
+
clearTimer();
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
onChange: (e) => {
|
|
350
|
+
const value2 = e.target.value;
|
|
351
|
+
if (onEditCompleted) {
|
|
352
|
+
restartTimer(() => {
|
|
353
|
+
if (innerRef.current) {
|
|
354
|
+
innerRef.current.blur();
|
|
355
|
+
if (!allowEditCompleteOnBlur) {
|
|
356
|
+
onEditCompleted(value2);
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
onEditCompleted(value2);
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
onChange(e);
|
|
364
|
+
onChangeText(value2);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] });
|
|
369
|
+
});
|
|
370
|
+
var FormInput = forwardRef(function FormInput2({
|
|
371
|
+
id,
|
|
372
|
+
labelText,
|
|
373
|
+
errorText,
|
|
374
|
+
className,
|
|
375
|
+
labelClassName,
|
|
376
|
+
errorClassName,
|
|
377
|
+
containerClassName,
|
|
378
|
+
required,
|
|
379
|
+
disabled,
|
|
380
|
+
...restProps
|
|
381
|
+
}, ref) {
|
|
382
|
+
const input = /* @__PURE__ */ jsx3(
|
|
383
|
+
"input",
|
|
384
|
+
{
|
|
385
|
+
...restProps,
|
|
386
|
+
ref,
|
|
387
|
+
id,
|
|
388
|
+
disabled,
|
|
389
|
+
className: clsx3(
|
|
390
|
+
getInputClassName({ disabled, hasError: !!errorText }),
|
|
391
|
+
className
|
|
392
|
+
)
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
return /* @__PURE__ */ jsxs2("div", { className: clsx3("flex flex-col gap-y-1", containerClassName), children: [
|
|
396
|
+
labelText && /* @__PURE__ */ jsxs2("label", { htmlFor: id, className: clsx3("textstyle-label-md", labelClassName), children: [
|
|
397
|
+
labelText,
|
|
398
|
+
required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
|
|
399
|
+
] }),
|
|
400
|
+
input,
|
|
401
|
+
errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx3("text-negative", errorClassName), children: errorText })
|
|
402
|
+
] });
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
// src/components/table/TableFilterButton.tsx
|
|
406
|
+
import { FilterIcon } from "lucide-react";
|
|
407
|
+
|
|
408
|
+
// src/components/user-action/Menu.tsx
|
|
409
|
+
import { useRef as useRef2 } from "react";
|
|
410
|
+
import clsx4 from "clsx";
|
|
411
|
+
|
|
412
|
+
// src/hooks/useOutsideClick.ts
|
|
413
|
+
import { useEffect as useEffect4 } from "react";
|
|
414
|
+
var useOutsideClick = (refs, handler) => {
|
|
415
|
+
useEffect4(() => {
|
|
416
|
+
const listener = (event) => {
|
|
417
|
+
if (event.target === null) return;
|
|
418
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
handler();
|
|
422
|
+
};
|
|
423
|
+
document.addEventListener("mousedown", listener);
|
|
424
|
+
document.addEventListener("touchstart", listener);
|
|
425
|
+
return () => {
|
|
426
|
+
document.removeEventListener("mousedown", listener);
|
|
427
|
+
document.removeEventListener("touchstart", listener);
|
|
428
|
+
};
|
|
429
|
+
}, [refs, handler]);
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// src/hooks/useHoverState.ts
|
|
433
|
+
import { useEffect as useEffect5, useState as useState3 } from "react";
|
|
434
|
+
var defaultUseHoverStateProps = {
|
|
435
|
+
closingDelay: 200,
|
|
436
|
+
isDisabled: false
|
|
437
|
+
};
|
|
438
|
+
var useHoverState = (props = void 0) => {
|
|
439
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
440
|
+
const [isHovered, setIsHovered] = useState3(false);
|
|
441
|
+
const [timer, setTimer] = useState3();
|
|
442
|
+
const onMouseEnter = () => {
|
|
443
|
+
if (isDisabled) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
clearTimeout(timer);
|
|
447
|
+
setIsHovered(true);
|
|
448
|
+
};
|
|
449
|
+
const onMouseLeave = () => {
|
|
450
|
+
if (isDisabled) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
setTimer(setTimeout(() => {
|
|
454
|
+
setIsHovered(false);
|
|
455
|
+
}, closingDelay));
|
|
456
|
+
};
|
|
457
|
+
useEffect5(() => {
|
|
458
|
+
if (timer) {
|
|
459
|
+
return () => {
|
|
460
|
+
clearTimeout(timer);
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
useEffect5(() => {
|
|
465
|
+
if (timer) {
|
|
466
|
+
clearTimeout(timer);
|
|
467
|
+
}
|
|
468
|
+
}, [isDisabled]);
|
|
469
|
+
return {
|
|
470
|
+
isHovered,
|
|
471
|
+
setIsHovered,
|
|
472
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
477
|
+
var resolve = (children, bag) => {
|
|
478
|
+
if (typeof children === "function") {
|
|
479
|
+
return children(bag);
|
|
480
|
+
}
|
|
481
|
+
return children ?? void 0;
|
|
482
|
+
};
|
|
483
|
+
var BagFunctionUtil = {
|
|
484
|
+
resolve
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
// src/components/user-action/Menu.tsx
|
|
488
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
489
|
+
var Menu = ({
|
|
490
|
+
trigger,
|
|
491
|
+
children,
|
|
492
|
+
alignment = "tl",
|
|
493
|
+
showOnHover = false,
|
|
494
|
+
menuClassName = ""
|
|
495
|
+
}) => {
|
|
496
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen, handlers } = useHoverState({ isDisabled: !showOnHover });
|
|
497
|
+
const triggerRef = useRef2(null);
|
|
498
|
+
const menuRef = useRef2(null);
|
|
499
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
500
|
+
const bag = { isOpen, close: () => setIsOpen(false) };
|
|
501
|
+
return /* @__PURE__ */ jsxs3(
|
|
502
|
+
"div",
|
|
503
|
+
{
|
|
504
|
+
className: "relative",
|
|
505
|
+
...handlers,
|
|
506
|
+
children: [
|
|
507
|
+
trigger(() => setIsOpen(!isOpen), triggerRef),
|
|
508
|
+
/* @__PURE__ */ jsx4(
|
|
509
|
+
"div",
|
|
510
|
+
{
|
|
511
|
+
ref: menuRef,
|
|
512
|
+
onClick: (e) => e.stopPropagation(),
|
|
513
|
+
className: clsx4(
|
|
514
|
+
"absolute top-full mt-1 min-w-40 rounded-lg bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
515
|
+
{
|
|
516
|
+
"top-0": alignment[0] === "t",
|
|
517
|
+
"bottom-0": alignment[0] === "b",
|
|
518
|
+
"left-0": alignment[1] === "l",
|
|
519
|
+
"right-0": alignment[1] === "r",
|
|
520
|
+
"hidden": !isOpen
|
|
521
|
+
},
|
|
522
|
+
menuClassName
|
|
523
|
+
),
|
|
524
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
525
|
+
}
|
|
526
|
+
)
|
|
527
|
+
]
|
|
528
|
+
}
|
|
529
|
+
);
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
// src/localization/LanguageProvider.tsx
|
|
533
|
+
import { createContext, useContext, useEffect as useEffect7, useState as useState5 } from "react";
|
|
534
|
+
|
|
535
|
+
// src/hooks/useLocalStorage.ts
|
|
536
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useState as useState4 } from "react";
|
|
537
|
+
|
|
538
|
+
// src/localization/util.ts
|
|
539
|
+
var languages = ["en", "de"];
|
|
540
|
+
var languagesLocalNames = {
|
|
541
|
+
en: "English",
|
|
542
|
+
de: "Deutsch"
|
|
543
|
+
};
|
|
544
|
+
var DEFAULT_LANGUAGE = "en";
|
|
545
|
+
var LanguageUtil = {
|
|
546
|
+
languages,
|
|
547
|
+
DEFAULT_LANGUAGE,
|
|
548
|
+
languagesLocalNames
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// src/localization/LanguageProvider.tsx
|
|
552
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
553
|
+
var LanguageContext = createContext({
|
|
554
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
555
|
+
setLanguage: (v) => v
|
|
556
|
+
});
|
|
557
|
+
var useLanguage = () => useContext(LanguageContext);
|
|
558
|
+
|
|
559
|
+
// src/localization/useTranslation.ts
|
|
560
|
+
var TranslationPluralCount = {
|
|
561
|
+
zero: 0,
|
|
562
|
+
one: 1,
|
|
563
|
+
two: 2,
|
|
564
|
+
few: 3,
|
|
565
|
+
many: 11,
|
|
566
|
+
other: -1
|
|
567
|
+
};
|
|
568
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
569
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
570
|
+
const { language: inferredLanguage } = useLanguage();
|
|
571
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
572
|
+
const usedTranslations = [...translations];
|
|
573
|
+
if (overwrite) {
|
|
574
|
+
usedTranslations.push(overwrite);
|
|
575
|
+
}
|
|
576
|
+
return (key, options) => {
|
|
577
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
578
|
+
try {
|
|
579
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
580
|
+
const translation = translations[i];
|
|
581
|
+
const localizedTranslation = translation[usedLanguage];
|
|
582
|
+
if (!localizedTranslation) {
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
const value = localizedTranslation[key];
|
|
586
|
+
if (!value) {
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
589
|
+
let forProcessing;
|
|
590
|
+
if (typeof value !== "string") {
|
|
591
|
+
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
592
|
+
forProcessing = value.zero;
|
|
593
|
+
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
594
|
+
forProcessing = value.one;
|
|
595
|
+
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
596
|
+
forProcessing = value.two;
|
|
597
|
+
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
598
|
+
forProcessing = value.few;
|
|
599
|
+
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
600
|
+
forProcessing = value.many;
|
|
601
|
+
} else {
|
|
602
|
+
forProcessing = value.other;
|
|
603
|
+
}
|
|
604
|
+
} else {
|
|
605
|
+
forProcessing = value;
|
|
606
|
+
}
|
|
607
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
608
|
+
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
609
|
+
});
|
|
610
|
+
return forProcessing;
|
|
611
|
+
}
|
|
612
|
+
} catch (e) {
|
|
613
|
+
console.error(e);
|
|
614
|
+
}
|
|
615
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
// src/localization/defaults/form.ts
|
|
620
|
+
var formTranslation = {
|
|
621
|
+
en: {
|
|
622
|
+
all: "All",
|
|
623
|
+
apply: "Apply",
|
|
624
|
+
back: "Back",
|
|
625
|
+
cancel: "Cancel",
|
|
626
|
+
change: "Change",
|
|
627
|
+
clear: "Clear",
|
|
628
|
+
close: "Close",
|
|
629
|
+
confirm: "Confirm",
|
|
630
|
+
decline: "Decline",
|
|
631
|
+
delete: "Delete",
|
|
632
|
+
discard: "Discard",
|
|
633
|
+
discardChanges: "Discard Changes",
|
|
634
|
+
done: "Done",
|
|
635
|
+
edit: "Edit",
|
|
636
|
+
enterText: "Enter text here",
|
|
637
|
+
error: "Error",
|
|
638
|
+
exit: "Exit",
|
|
639
|
+
fieldRequiredError: "This field is required.",
|
|
640
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
641
|
+
less: "Less",
|
|
642
|
+
loading: "Loading",
|
|
643
|
+
maxLengthError: "Maximum length exceeded.",
|
|
644
|
+
minLengthError: "Minimum length not met.",
|
|
645
|
+
more: "More",
|
|
646
|
+
next: "Next",
|
|
647
|
+
no: "No",
|
|
648
|
+
none: "None",
|
|
649
|
+
of: "of",
|
|
650
|
+
optional: "Optional",
|
|
651
|
+
pleaseWait: "Please wait...",
|
|
652
|
+
previous: "Previous",
|
|
653
|
+
remove: "Remove",
|
|
654
|
+
required: "Required",
|
|
655
|
+
reset: "Reset",
|
|
656
|
+
save: "Save",
|
|
657
|
+
search: "Search",
|
|
658
|
+
select: "Select",
|
|
659
|
+
selectOption: "Select an option",
|
|
660
|
+
show: "Show",
|
|
661
|
+
showMore: "Show more",
|
|
662
|
+
showLess: "Show less",
|
|
663
|
+
submit: "Submit",
|
|
664
|
+
success: "Success",
|
|
665
|
+
update: "Update",
|
|
666
|
+
unsavedChanges: "Unsaved Changes",
|
|
667
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
668
|
+
yes: "Yes"
|
|
669
|
+
},
|
|
670
|
+
de: {
|
|
671
|
+
all: "Alle",
|
|
672
|
+
apply: "Anwenden",
|
|
673
|
+
back: "Zur\xFCck",
|
|
674
|
+
cancel: "Abbrechen",
|
|
675
|
+
change: "\xC4ndern",
|
|
676
|
+
clear: "L\xF6schen",
|
|
677
|
+
close: "Schlie\xDFen",
|
|
678
|
+
confirm: "Best\xE4tigen",
|
|
679
|
+
decline: "Ablehnen",
|
|
680
|
+
delete: "L\xF6schen",
|
|
681
|
+
discard: "Verwerfen",
|
|
682
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
683
|
+
done: "Fertig",
|
|
684
|
+
edit: "Bearbeiten",
|
|
685
|
+
enterText: "Text hier eingeben",
|
|
686
|
+
error: "Fehler",
|
|
687
|
+
exit: "Beenden",
|
|
688
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
689
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
690
|
+
less: "Weniger",
|
|
691
|
+
loading: "L\xE4dt",
|
|
692
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
693
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
694
|
+
more: "Mehr",
|
|
695
|
+
next: "Weiter",
|
|
696
|
+
no: "Nein",
|
|
697
|
+
none: "Nichts",
|
|
698
|
+
of: "von",
|
|
699
|
+
optional: "Optional",
|
|
700
|
+
pleaseWait: "Bitte warten...",
|
|
701
|
+
previous: "Vorherige",
|
|
702
|
+
remove: "Entfernen",
|
|
703
|
+
required: "Erforderlich",
|
|
704
|
+
reset: "Zur\xFCcksetzen",
|
|
705
|
+
save: "Speichern",
|
|
706
|
+
search: "Suche",
|
|
707
|
+
select: "Select",
|
|
708
|
+
selectOption: "Option ausw\xE4hlen",
|
|
709
|
+
show: "Anzeigen",
|
|
710
|
+
showMore: "Mehr anzeigen",
|
|
711
|
+
showLess: "Weniger anzeigen",
|
|
712
|
+
submit: "Abschicken",
|
|
713
|
+
success: "Erfolg",
|
|
714
|
+
update: "Update",
|
|
715
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
716
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
717
|
+
yes: "Ja"
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
// src/components/table/TableFilterButton.tsx
|
|
722
|
+
import { useEffect as useEffect8, useState as useState6 } from "react";
|
|
723
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
724
|
+
var defaultTableFilterTranslation = {
|
|
725
|
+
en: {
|
|
726
|
+
filter: "Filter",
|
|
727
|
+
min: "Min",
|
|
728
|
+
max: "Max",
|
|
729
|
+
startDate: "Start",
|
|
730
|
+
endDate: "End",
|
|
731
|
+
text: "Text..."
|
|
732
|
+
},
|
|
733
|
+
de: {
|
|
734
|
+
filter: "Filter",
|
|
735
|
+
min: "Min",
|
|
736
|
+
max: "Max",
|
|
737
|
+
startDate: "Start",
|
|
738
|
+
endDate: "Ende",
|
|
739
|
+
text: "Text..."
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
var TableFilterButton = ({
|
|
743
|
+
filterType,
|
|
744
|
+
column
|
|
745
|
+
}) => {
|
|
746
|
+
const translation = useTranslation([formTranslation, defaultTableFilterTranslation]);
|
|
747
|
+
const columnFilterValue = column.getFilterValue();
|
|
748
|
+
const [filterValue, setFilterValue] = useState6(columnFilterValue);
|
|
749
|
+
const hasFilter = !!filterValue;
|
|
750
|
+
useEffect8(() => {
|
|
751
|
+
setFilterValue(columnFilterValue);
|
|
752
|
+
}, [columnFilterValue]);
|
|
753
|
+
return /* @__PURE__ */ jsx6(
|
|
754
|
+
Menu,
|
|
755
|
+
{
|
|
756
|
+
trigger: (onClick, ref) => /* @__PURE__ */ jsxs4("div", { ref, className: "relative", children: [
|
|
757
|
+
/* @__PURE__ */ jsx6(IconButton, { color: "neutral", size: "tiny", onClick, children: /* @__PURE__ */ jsx6(FilterIcon, {}) }),
|
|
758
|
+
hasFilter && /* @__PURE__ */ jsx6(
|
|
759
|
+
"div",
|
|
760
|
+
{
|
|
761
|
+
className: "absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-primary pointer-events-none",
|
|
762
|
+
"aria-hidden": true
|
|
763
|
+
}
|
|
764
|
+
)
|
|
765
|
+
] }),
|
|
766
|
+
children: ({ close }) => /* @__PURE__ */ jsxs4("div", { className: "col gap-y-1 p-2 items-start font-normal text-menu-text", children: [
|
|
767
|
+
/* @__PURE__ */ jsx6("h4", { className: "textstyle-title-sm", children: translation("filter") }),
|
|
768
|
+
filterType === "text" && /* @__PURE__ */ jsx6(
|
|
769
|
+
Input,
|
|
770
|
+
{
|
|
771
|
+
value: filterValue ?? "",
|
|
772
|
+
autoFocus: true,
|
|
773
|
+
placeholder: translation("text"),
|
|
774
|
+
onChangeText: setFilterValue,
|
|
775
|
+
className: "h-10"
|
|
776
|
+
}
|
|
777
|
+
),
|
|
778
|
+
filterType === "range" && /* @__PURE__ */ jsxs4("div", { className: "row gap-x-2 items-center", children: [
|
|
779
|
+
/* @__PURE__ */ jsx6(
|
|
780
|
+
Input,
|
|
781
|
+
{
|
|
782
|
+
value: filterValue?.[0] ?? "",
|
|
783
|
+
type: "number",
|
|
784
|
+
placeholder: translation("min"),
|
|
785
|
+
onChangeText: (text) => {
|
|
786
|
+
const num = Number(text);
|
|
787
|
+
setFilterValue((old) => [num, old?.[1]]);
|
|
788
|
+
},
|
|
789
|
+
className: "h-10 input-indicator-hidden w-40"
|
|
790
|
+
}
|
|
791
|
+
),
|
|
792
|
+
/* @__PURE__ */ jsx6("span", { className: "font-bold", children: "-" }),
|
|
793
|
+
/* @__PURE__ */ jsx6(
|
|
794
|
+
Input,
|
|
795
|
+
{
|
|
796
|
+
value: filterValue?.[1] ?? "",
|
|
797
|
+
type: "number",
|
|
798
|
+
placeholder: translation("max"),
|
|
799
|
+
onChangeText: (text) => {
|
|
800
|
+
const num = Number(text);
|
|
801
|
+
setFilterValue((old) => [old?.[0], num]);
|
|
802
|
+
},
|
|
803
|
+
className: "h-10 input-indicator-hidden w-40"
|
|
804
|
+
}
|
|
805
|
+
)
|
|
806
|
+
] }),
|
|
807
|
+
filterType === "dateRange" && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
808
|
+
/* @__PURE__ */ jsx6(
|
|
809
|
+
Input,
|
|
810
|
+
{
|
|
811
|
+
value: filterValue?.[0] ? filterValue?.[0].toISOString().slice(0, 16) : "",
|
|
812
|
+
type: "datetime-local",
|
|
813
|
+
placeholder: translation("startDate"),
|
|
814
|
+
onChangeText: (text) => {
|
|
815
|
+
const value = new Date(text);
|
|
816
|
+
setFilterValue((old) => [value, old?.[1]]);
|
|
817
|
+
},
|
|
818
|
+
className: "h-10 w-50"
|
|
819
|
+
}
|
|
820
|
+
),
|
|
821
|
+
/* @__PURE__ */ jsx6(
|
|
822
|
+
Input,
|
|
823
|
+
{
|
|
824
|
+
value: filterValue?.[1] ? filterValue?.[1].toISOString().slice(0, 16) : "",
|
|
825
|
+
type: "datetime-local",
|
|
826
|
+
placeholder: translation("endDate"),
|
|
827
|
+
onChangeText: (text) => {
|
|
828
|
+
const value = new Date(text);
|
|
829
|
+
setFilterValue((old) => [old?.[0], value]);
|
|
830
|
+
},
|
|
831
|
+
className: "h-10 w-50"
|
|
832
|
+
}
|
|
833
|
+
)
|
|
834
|
+
] }),
|
|
835
|
+
/* @__PURE__ */ jsxs4("div", { className: "row justify-end w-full", children: [
|
|
836
|
+
hasFilter && /* @__PURE__ */ jsx6(SolidButton, { color: "negative", size: "small", onClick: () => {
|
|
837
|
+
column.setFilterValue(void 0);
|
|
838
|
+
close();
|
|
839
|
+
}, children: translation("remove") }),
|
|
840
|
+
/* @__PURE__ */ jsx6(SolidButton, { size: "small", onClick: () => {
|
|
841
|
+
column.setFilterValue(filterValue);
|
|
842
|
+
close();
|
|
843
|
+
}, children: translation("apply") })
|
|
844
|
+
] })
|
|
845
|
+
] })
|
|
846
|
+
}
|
|
847
|
+
);
|
|
848
|
+
};
|
|
849
|
+
export {
|
|
850
|
+
TableFilterButton
|
|
851
|
+
};
|
|
852
|
+
//# sourceMappingURL=TableFilterButton.mjs.map
|