@helpwave/hightide 0.0.9 → 0.0.12
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/README.md +1 -1
- package/dist/coloring/shading.d.ts +2 -0
- package/dist/coloring/shading.js +40 -0
- package/dist/coloring/types.d.ts +11 -0
- package/dist/coloring/types.js +1 -0
- package/dist/components/Avatar.d.ts +14 -0
- package/dist/components/Avatar.js +35 -0
- package/dist/components/AvatarGroup.d.ts +10 -0
- package/dist/components/AvatarGroup.js +13 -0
- package/dist/components/BreadCrumb.d.ts +16 -0
- package/dist/components/BreadCrumb.js +12 -0
- package/dist/components/Button.d.ts +41 -0
- package/dist/components/Button.js +84 -0
- package/dist/components/ChipList.d.ts +21 -0
- package/dist/components/ChipList.js +38 -0
- package/dist/components/Circle.d.ts +6 -0
- package/dist/components/Circle.js +10 -0
- package/dist/components/ErrorComponent.d.ts +13 -0
- package/dist/components/ErrorComponent.js +19 -0
- package/dist/components/Expandable.d.ts +30 -0
- package/dist/components/Expandable.js +16 -0
- package/dist/components/HelpwaveBadge.d.ts +11 -0
- package/dist/components/HelpwaveBadge.js +14 -0
- package/dist/components/HideableContentSection.d.ts +10 -0
- package/dist/components/HideableContentSection.js +15 -0
- package/dist/components/InputGroup.d.ts +13 -0
- package/dist/components/InputGroup.js +33 -0
- package/dist/components/LoadingAndErrorComponent.d.ts +17 -0
- package/dist/components/LoadingAndErrorComponent.js +25 -0
- package/dist/components/LoadingAnimation.d.ts +13 -0
- package/dist/components/LoadingAnimation.js +19 -0
- package/dist/components/LoadingButton.d.ts +6 -0
- package/dist/components/LoadingButton.js +10 -0
- package/dist/components/MarkdownInterpreter.d.ts +25 -0
- package/dist/components/MarkdownInterpreter.js +190 -0
- package/dist/components/Pagination.d.ts +14 -0
- package/dist/components/Pagination.js +25 -0
- package/dist/components/Profile.d.ts +28 -0
- package/dist/components/Profile.js +45 -0
- package/dist/components/ProgressIndicator.d.ts +21 -0
- package/dist/components/ProgressIndicator.js +24 -0
- package/dist/components/Ring.d.ts +31 -0
- package/dist/components/Ring.js +113 -0
- package/dist/components/SearchableList.d.ts +18 -0
- package/dist/components/SearchableList.js +27 -0
- package/dist/components/SortButton.d.ts +10 -0
- package/dist/components/SortButton.js +9 -0
- package/dist/components/Span.js +1 -0
- package/dist/components/StepperBar.d.ts +23 -0
- package/dist/components/StepperBar.js +47 -0
- package/dist/components/Table.d.ts +87 -0
- package/dist/components/Table.js +187 -0
- package/dist/components/TechRadar.d.ts +36 -0
- package/dist/components/TechRadar.js +191 -0
- package/dist/components/TextImage.d.ts +20 -0
- package/dist/components/TextImage.js +31 -0
- package/dist/components/TimeDisplay.d.ts +30 -0
- package/dist/components/TimeDisplay.js +83 -0
- package/dist/components/Tooltip.d.ts +34 -0
- package/dist/components/Tooltip.js +38 -0
- package/dist/components/VerticalDivider.d.ts +11 -0
- package/dist/components/VerticalDivider.js +7 -0
- package/dist/components/date/DatePicker.d.ts +26 -0
- package/dist/components/date/DatePicker.js +58 -0
- package/dist/components/date/DayPicker.d.ts +16 -0
- package/dist/components/date/DayPicker.js +37 -0
- package/dist/components/date/TimePicker.d.ts +12 -0
- package/dist/components/date/TimePicker.js +79 -0
- package/dist/components/date/YearMonthPicker.d.ts +11 -0
- package/dist/components/date/YearMonthPicker.js +59 -0
- package/dist/components/examples/InputGroupExample.d.ts +6 -0
- package/dist/components/examples/InputGroupExample.js +21 -0
- package/dist/components/examples/MultiSelectExample.d.ts +7 -0
- package/dist/components/examples/MultiSelectExample.js +27 -0
- package/dist/components/examples/SearchableSelectExample.d.ts +6 -0
- package/dist/components/examples/SearchableSelectExample.js +17 -0
- package/dist/components/examples/SelectExample.d.ts +4 -0
- package/dist/components/examples/SelectExample.js +15 -0
- package/dist/components/examples/StackingModals.d.ts +4 -0
- package/dist/components/examples/StackingModals.js +15 -0
- package/dist/components/examples/TableExample.d.ts +9 -0
- package/dist/components/examples/TableExample.js +92 -0
- package/dist/components/examples/TextareaExample.d.ts +6 -0
- package/dist/components/examples/TextareaExample.js +10 -0
- package/dist/components/examples/TileExample.d.ts +9 -0
- package/dist/components/examples/TileExample.js +9 -0
- package/dist/components/examples/Title.js +1 -0
- package/dist/components/examples/date/DateTimePickerExample.d.ts +10 -0
- package/dist/components/examples/date/DateTimePickerExample.js +21 -0
- package/dist/components/examples/properties/CheckboxPropertyExample.d.ts +8 -0
- package/dist/components/examples/properties/CheckboxPropertyExample.js +13 -0
- package/dist/components/examples/properties/DatePropertyExample.d.ts +8 -0
- package/dist/components/examples/properties/DatePropertyExample.js +23 -0
- package/dist/components/examples/properties/MultiSelectPropertyExample.d.ts +8 -0
- package/dist/components/examples/properties/MultiSelectPropertyExample.js +16 -0
- package/dist/components/examples/properties/NumberPropertyExample.d.ts +6 -0
- package/dist/components/examples/properties/NumberPropertyExample.js +13 -0
- package/dist/components/examples/properties/SelectPropertyExample.d.ts +6 -0
- package/dist/components/examples/properties/SelectPropertyExample.js +18 -0
- package/dist/components/examples/properties/TextPropertyExample.d.ts +8 -0
- package/dist/components/examples/properties/TextPropertyExample.js +13 -0
- package/dist/components/icons/Helpwave.d.ts +10 -0
- package/dist/components/icons/Helpwave.js +20 -0
- package/dist/components/icons/Tag.d.ts +10 -0
- package/dist/components/icons/Tag.js +12 -0
- package/dist/components/layout/Carousel.d.ts +22 -0
- package/dist/components/layout/Carousel.js +233 -0
- package/dist/components/layout/DividerInserter.d.ts +11 -0
- package/dist/components/layout/DividerInserter.js +20 -0
- package/dist/components/layout/FAQSection.d.ts +23 -0
- package/dist/components/layout/FAQSection.js +14 -0
- package/dist/components/layout/Tile.d.ts +34 -0
- package/dist/components/layout/Tile.js +18 -0
- package/dist/components/modals/ConfirmDialog.d.ts +34 -0
- package/dist/components/modals/ConfirmDialog.js +31 -0
- package/dist/components/modals/DiscardChangesDialog.d.ts +19 -0
- package/dist/components/modals/DiscardChangesDialog.js +24 -0
- package/dist/components/modals/InputModal.d.ts +9 -0
- package/dist/components/modals/InputModal.js +9 -0
- package/dist/components/modals/LanguageModal.d.ts +17 -0
- package/dist/components/modals/LanguageModal.js +35 -0
- package/dist/components/modals/Modal.d.ts +38 -0
- package/dist/components/modals/Modal.js +57 -0
- package/dist/components/modals/ModalRegister.d.ts +11 -0
- package/dist/components/modals/ModalRegister.js +28 -0
- package/dist/components/properties/CheckboxProperty.d.ts +15 -0
- package/dist/components/properties/CheckboxProperty.js +27 -0
- package/dist/components/properties/DateProperty.d.ts +11 -0
- package/dist/components/properties/DateProperty.js +22 -0
- package/dist/components/properties/MultiSelectProperty.d.ts +12 -0
- package/dist/components/properties/MultiSelectProperty.js +33 -0
- package/dist/components/properties/NumberProperty.d.ts +16 -0
- package/dist/components/properties/NumberProperty.js +42 -0
- package/dist/components/properties/PropertyBase.d.ts +23 -0
- package/dist/components/properties/PropertyBase.js +27 -0
- package/dist/components/properties/SelectProperty.d.ts +12 -0
- package/dist/components/properties/SelectProperty.js +22 -0
- package/dist/components/properties/TextProperty.d.ts +15 -0
- package/dist/components/properties/TextProperty.js +37 -0
- package/dist/components/user-input/Checkbox.d.ts +37 -0
- package/dist/components/user-input/Checkbox.js +63 -0
- package/dist/components/user-input/DateAndTimePicker.d.ts +39 -0
- package/dist/components/user-input/DateAndTimePicker.js +65 -0
- package/dist/components/user-input/Input.d.ts +61 -0
- package/dist/components/user-input/Input.js +61 -0
- package/dist/components/user-input/Label.d.ts +12 -0
- package/dist/components/user-input/Label.js +12 -0
- package/dist/components/user-input/Menu.d.ts +21 -0
- package/dist/components/user-input/Menu.js +26 -0
- package/dist/components/user-input/MultiSelect.d.ts +39 -0
- package/dist/components/user-input/MultiSelect.js +57 -0
- package/dist/components/user-input/ScrollPicker.d.ts +11 -0
- package/dist/components/user-input/ScrollPicker.js +151 -0
- package/dist/components/user-input/SearchableSelect.d.ts +8 -0
- package/dist/components/user-input/SearchableSelect.js +14 -0
- package/dist/components/user-input/Select.d.ts +32 -0
- package/dist/components/user-input/Select.js +48 -0
- package/dist/components/user-input/Textarea.d.ts +20 -0
- package/dist/components/user-input/Textarea.js +33 -0
- package/dist/components/user-input/ToggleableInput.d.ts +32 -0
- package/dist/components/user-input/ToggleableInput.js +40 -0
- package/dist/css/globals.css +2450 -0
- package/dist/hooks/useHoverState.d.ts +40 -0
- package/dist/hooks/useHoverState.js +46 -0
- package/dist/hooks/useLanguage.d.ts +17 -0
- package/dist/hooks/useLanguage.js +51 -0
- package/dist/hooks/useLocalStorage.d.ts +4 -0
- package/dist/hooks/useLocalStorage.js +24 -0
- package/dist/hooks/useOutsideClick.d.ts +2 -0
- package/dist/hooks/useOutsideClick.js +22 -0
- package/dist/hooks/useSaveDelay.d.ts +5 -0
- package/dist/hooks/useSaveDelay.js +41 -0
- package/dist/hooks/useTheme.d.ts +16 -0
- package/dist/hooks/useTheme.js +32 -0
- package/dist/hooks/useTranslation.d.ts +24 -0
- package/dist/hooks/useTranslation.js +11 -0
- package/dist/util/array.d.ts +23 -0
- package/dist/util/array.js +103 -0
- package/{util/builder.ts → dist/util/builder.d.ts} +1 -4
- package/dist/util/builder.js +9 -0
- package/dist/util/date.d.ts +28 -0
- package/dist/util/date.js +133 -0
- package/dist/util/easeFunctions.d.ts +9 -0
- package/dist/util/easeFunctions.js +30 -0
- package/dist/util/emailValidation.d.ts +1 -0
- package/dist/util/emailValidation.js +3 -0
- package/dist/util/loopingArray.d.ts +23 -0
- package/dist/util/loopingArray.js +67 -0
- package/dist/util/math.d.ts +1 -0
- package/dist/util/math.js +3 -0
- package/dist/util/news.d.ts +98 -0
- package/dist/util/news.js +27 -0
- package/dist/util/noop.d.ts +1 -0
- package/dist/util/noop.js +1 -0
- package/{util/simpleSearch.ts → dist/util/simpleSearch.d.ts} +4 -21
- package/dist/util/simpleSearch.js +62 -0
- package/dist/util/storage.d.ts +15 -0
- package/dist/util/storage.js +32 -0
- package/dist/util/types.d.ts +1 -0
- package/dist/util/types.js +1 -0
- package/package.json +7 -8
- package/coloring/shading.ts +0 -46
- package/coloring/types.ts +0 -13
- package/components/Avatar.tsx +0 -58
- package/components/AvatarGroup.tsx +0 -48
- package/components/BreadCrumb.tsx +0 -35
- package/components/Button.tsx +0 -236
- package/components/ChipList.tsx +0 -89
- package/components/Circle.tsx +0 -27
- package/components/ErrorComponent.tsx +0 -40
- package/components/Expandable.tsx +0 -61
- package/components/HelpwaveBadge.tsx +0 -35
- package/components/HideableContentSection.tsx +0 -43
- package/components/InputGroup.tsx +0 -72
- package/components/LoadingAndErrorComponent.tsx +0 -47
- package/components/LoadingAnimation.tsx +0 -40
- package/components/LoadingButton.tsx +0 -27
- package/components/MarkdownInterpreter.tsx +0 -278
- package/components/Pagination.tsx +0 -65
- package/components/Profile.tsx +0 -124
- package/components/ProgressIndicator.tsx +0 -58
- package/components/Ring.tsx +0 -286
- package/components/SearchableList.tsx +0 -69
- package/components/SortButton.tsx +0 -33
- package/components/StepperBar.tsx +0 -124
- package/components/Table.tsx +0 -330
- package/components/TechRadar.tsx +0 -247
- package/components/TextImage.tsx +0 -86
- package/components/TimeDisplay.tsx +0 -121
- package/components/Tooltip.tsx +0 -92
- package/components/VerticalDivider.tsx +0 -51
- package/components/date/DatePicker.tsx +0 -164
- package/components/date/DayPicker.tsx +0 -95
- package/components/date/TimePicker.tsx +0 -167
- package/components/date/YearMonthPicker.tsx +0 -130
- package/components/examples/InputGroupExample.tsx +0 -58
- package/components/examples/MultiSelectExample.tsx +0 -57
- package/components/examples/SearchableSelectExample.tsx +0 -34
- package/components/examples/SelectExample.tsx +0 -28
- package/components/examples/StackingModals.tsx +0 -54
- package/components/examples/TableExample.tsx +0 -159
- package/components/examples/TextareaExample.tsx +0 -23
- package/components/examples/TileExample.tsx +0 -25
- package/components/examples/date/DateTimePickerExample.tsx +0 -53
- package/components/examples/properties/CheckboxPropertyExample.tsx +0 -29
- package/components/examples/properties/DatePropertyExample.tsx +0 -44
- package/components/examples/properties/MultiSelectPropertyExample.tsx +0 -39
- package/components/examples/properties/NumberPropertyExample.tsx +0 -28
- package/components/examples/properties/SelectPropertyExample.tsx +0 -39
- package/components/examples/properties/TextPropertyExample.tsx +0 -30
- package/components/icons/Helpwave.tsx +0 -51
- package/components/icons/Tag.tsx +0 -29
- package/components/layout/Carousel.tsx +0 -396
- package/components/layout/DividerInserter.tsx +0 -37
- package/components/layout/FAQSection.tsx +0 -57
- package/components/layout/Tile.tsx +0 -67
- package/components/modals/ConfirmDialog.tsx +0 -105
- package/components/modals/DiscardChangesDialog.tsx +0 -71
- package/components/modals/InputModal.tsx +0 -26
- package/components/modals/LanguageModal.tsx +0 -76
- package/components/modals/Modal.tsx +0 -149
- package/components/modals/ModalRegister.tsx +0 -45
- package/components/properties/CheckboxProperty.tsx +0 -62
- package/components/properties/DateProperty.tsx +0 -58
- package/components/properties/MultiSelectProperty.tsx +0 -82
- package/components/properties/NumberProperty.tsx +0 -86
- package/components/properties/PropertyBase.tsx +0 -84
- package/components/properties/SelectProperty.tsx +0 -67
- package/components/properties/TextProperty.tsx +0 -81
- package/components/user-input/Checkbox.tsx +0 -139
- package/components/user-input/DateAndTimePicker.tsx +0 -156
- package/components/user-input/Input.tsx +0 -192
- package/components/user-input/Label.tsx +0 -32
- package/components/user-input/Menu.tsx +0 -75
- package/components/user-input/MultiSelect.tsx +0 -158
- package/components/user-input/ScrollPicker.tsx +0 -240
- package/components/user-input/SearchableSelect.tsx +0 -36
- package/components/user-input/Select.tsx +0 -132
- package/components/user-input/Textarea.tsx +0 -86
- package/components/user-input/ToggleableInput.tsx +0 -115
- package/globals.css +0 -488
- package/hooks/useHoverState.ts +0 -88
- package/hooks/useLanguage.tsx +0 -78
- package/hooks/useLocalStorage.tsx +0 -33
- package/hooks/useOutsideClick.ts +0 -25
- package/hooks/useSaveDelay.ts +0 -46
- package/hooks/useTheme.tsx +0 -57
- package/hooks/useTranslation.ts +0 -43
- package/index.ts +0 -0
- package/util/array.ts +0 -115
- package/util/date.ts +0 -180
- package/util/easeFunctions.ts +0 -37
- package/util/emailValidation.ts +0 -3
- package/util/loopingArray.ts +0 -94
- package/util/math.ts +0 -3
- package/util/news.ts +0 -43
- package/util/noop.ts +0 -1
- package/util/storage.ts +0 -37
- package/util/types.ts +0 -4
- /package/{components/Span.tsx → dist/components/Span.d.ts} +0 -0
- /package/{components/examples/Title.tsx → dist/components/examples/Title.d.ts} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from '../hooks/useTranslation';
|
|
3
|
+
import { Helpwave } from './icons/Helpwave';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
const defaultLoadingAnimationTranslation = {
|
|
6
|
+
en: {
|
|
7
|
+
loading: 'Loading data'
|
|
8
|
+
},
|
|
9
|
+
de: {
|
|
10
|
+
loading: 'Lade Daten'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A Component to show when loading data
|
|
15
|
+
*/
|
|
16
|
+
export const LoadingAnimation = ({ overwriteTranslation, loadingText, classname }) => {
|
|
17
|
+
const translation = useTranslation(defaultLoadingAnimationTranslation, overwriteTranslation);
|
|
18
|
+
return (_jsxs("div", { className: clsx('col items-center justify-center w-full h-24', classname), children: [_jsx(Helpwave, { animate: "loading" }), loadingText !== null && loadingText !== void 0 ? loadingText : `${translation.loading}...`] }));
|
|
19
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SolidButtonProps } from './Button';
|
|
2
|
+
type LoadingButtonProps = {
|
|
3
|
+
isLoading?: boolean;
|
|
4
|
+
} & SolidButtonProps;
|
|
5
|
+
export declare const LoadingButton: ({ isLoading, size, onClick, ...rest }: LoadingButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { Helpwave } from './icons/Helpwave';
|
|
4
|
+
import { ButtonSizePaddings } from './Button';
|
|
5
|
+
import { SolidButton } from './Button';
|
|
6
|
+
import { noop } from '../util/noop';
|
|
7
|
+
export const LoadingButton = ({ isLoading = false, size = 'medium', onClick, ...rest }) => {
|
|
8
|
+
const paddingClass = ButtonSizePaddings[size];
|
|
9
|
+
return (_jsxs("div", { className: "inline-block relative", children: [isLoading && (_jsx("div", { className: clsx('absolute inset-0 row items-center justify-center bg-white/40', paddingClass), children: _jsx(Helpwave, { animate: "loading", className: "text-white" }) })), _jsx(SolidButton, { ...rest, disabled: rest.disabled, onClick: isLoading ? noop : onClick })] }));
|
|
10
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type ASTNodeModifierType = 'none' | 'italic' | 'bold' | 'underline' | 'font-space' | 'primary' | 'secondary' | 'warn' | 'positive' | 'negative';
|
|
2
|
+
declare const astNodeInserterType: readonly ["helpwave", "newline"];
|
|
3
|
+
type ASTNodeInserterType = typeof astNodeInserterType[number];
|
|
4
|
+
type ASTNodeDefaultType = 'text';
|
|
5
|
+
type ASTNode = {
|
|
6
|
+
type: ASTNodeModifierType;
|
|
7
|
+
children: ASTNode[];
|
|
8
|
+
} | {
|
|
9
|
+
type: ASTNodeInserterType;
|
|
10
|
+
} | {
|
|
11
|
+
type: ASTNodeDefaultType;
|
|
12
|
+
text: string;
|
|
13
|
+
};
|
|
14
|
+
export type ASTNodeInterpreterProps = {
|
|
15
|
+
node: ASTNode;
|
|
16
|
+
isRoot?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const ASTNodeInterpreter: ({ node, isRoot, className, }: ASTNodeInterpreterProps) => string | import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
export type MarkdownInterpreterProps = {
|
|
21
|
+
text: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const MarkdownInterpreter: ({ text, className }: MarkdownInterpreterProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
const astNodeInserterType = ['helpwave', 'newline'];
|
|
3
|
+
export const ASTNodeInterpreter = ({ node, isRoot = false, className = '', }) => {
|
|
4
|
+
switch (node.type) {
|
|
5
|
+
case 'newline':
|
|
6
|
+
return _jsx("br", {});
|
|
7
|
+
case 'text':
|
|
8
|
+
return isRoot ? _jsx("span", { className: className, children: node.text }) : node.text;
|
|
9
|
+
case 'helpwave':
|
|
10
|
+
return (_jsx("span", { className: "font-bold font-space no-underline", children: "helpwave" }));
|
|
11
|
+
case 'none':
|
|
12
|
+
return isRoot ? (_jsx("span", { className: className, children: node.children.map((value, index) => (_jsx(ASTNodeInterpreter, { node: value }, index))) })) :
|
|
13
|
+
_jsx(_Fragment, { children: node.children.map((value, index) => _jsx(ASTNodeInterpreter, { node: value }, index)) });
|
|
14
|
+
case 'bold':
|
|
15
|
+
return _jsx("b", { children: node.children.map((value, index) => _jsx(ASTNodeInterpreter, { node: value }, index)) });
|
|
16
|
+
case 'italic':
|
|
17
|
+
return _jsx("i", { children: node.children.map((value, index) => _jsx(ASTNodeInterpreter, { node: value }, index)) });
|
|
18
|
+
case 'underline':
|
|
19
|
+
return (_jsx("u", { children: node.children.map((value, index) => (_jsx(ASTNodeInterpreter, { node: value }, index))) }));
|
|
20
|
+
case 'font-space':
|
|
21
|
+
return (_jsx("span", { className: "font-space", children: node.children.map((value, index) => (_jsx(ASTNodeInterpreter, { node: value }, index))) }));
|
|
22
|
+
case 'primary':
|
|
23
|
+
return (_jsx("span", { className: "text-primary", children: node.children.map((value, index) => (_jsx(ASTNodeInterpreter, { node: value }, index))) }));
|
|
24
|
+
case 'secondary':
|
|
25
|
+
return (_jsx("span", { className: "text-secondary", children: node.children.map((value, index) => (_jsx(ASTNodeInterpreter, { node: value }, index))) }));
|
|
26
|
+
case 'warn':
|
|
27
|
+
return (_jsx("span", { className: "text-warning", children: node.children.map((value, index) => (_jsx(ASTNodeInterpreter, { node: value }, index))) }));
|
|
28
|
+
case 'positive':
|
|
29
|
+
return (_jsx("span", { className: "text-positive", children: node.children.map((value, index) => (_jsx(ASTNodeInterpreter, { node: value }, index))) }));
|
|
30
|
+
case 'negative':
|
|
31
|
+
return (_jsx("span", { className: "text-negative", children: node.children.map((value, index) => (_jsx(ASTNodeInterpreter, { node: value }, index))) }));
|
|
32
|
+
default:
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const modifierIdentifierMapping = [
|
|
37
|
+
{ id: 'i', name: 'italic' },
|
|
38
|
+
{ id: 'b', name: 'bold' },
|
|
39
|
+
{ id: 'u', name: 'underline' },
|
|
40
|
+
{ id: 'space', name: 'font-space' },
|
|
41
|
+
{ id: 'primary', name: 'primary' },
|
|
42
|
+
{ id: 'secondary', name: 'secondary' },
|
|
43
|
+
{ id: 'warn', name: 'warn' },
|
|
44
|
+
{ id: 'positive', name: 'positive' },
|
|
45
|
+
{ id: 'negative', name: 'negative' },
|
|
46
|
+
];
|
|
47
|
+
const inserterIdentifierMapping = [
|
|
48
|
+
{ id: 'helpwave', name: 'helpwave' },
|
|
49
|
+
{ id: 'newline', name: 'newline' }
|
|
50
|
+
];
|
|
51
|
+
const parseMarkdown = (text, commandStart = '\\', open = '{', close = '}') => {
|
|
52
|
+
let start = text.indexOf(commandStart);
|
|
53
|
+
const children = [];
|
|
54
|
+
// parse the text step by step
|
|
55
|
+
while (text !== '') {
|
|
56
|
+
if (start === -1) {
|
|
57
|
+
children.push({
|
|
58
|
+
type: 'text',
|
|
59
|
+
text
|
|
60
|
+
});
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
children.push(parseMarkdown(text.substring(0, start)));
|
|
64
|
+
text = text.substring(start);
|
|
65
|
+
if (text.length <= 1) {
|
|
66
|
+
children.push({
|
|
67
|
+
type: 'text',
|
|
68
|
+
text
|
|
69
|
+
});
|
|
70
|
+
text = '';
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const simpleReplace = [commandStart, open, close];
|
|
74
|
+
if (simpleReplace.some(value => text[1] === value)) {
|
|
75
|
+
children.push({
|
|
76
|
+
type: 'text',
|
|
77
|
+
text: simpleReplace.find(value => text[1] === value)
|
|
78
|
+
});
|
|
79
|
+
text = text.substring(2);
|
|
80
|
+
start = text.indexOf(commandStart);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const inserter = inserterIdentifierMapping.find(value => text.substring(1).startsWith(value.id));
|
|
84
|
+
if (inserter) {
|
|
85
|
+
children.push({
|
|
86
|
+
type: inserter.name,
|
|
87
|
+
});
|
|
88
|
+
text = text.substring(inserter.id.length + 1);
|
|
89
|
+
start = text.indexOf(commandStart);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const modifier = modifierIdentifierMapping.find(value => text.substring(1).startsWith(value.id));
|
|
93
|
+
if (modifier) {
|
|
94
|
+
// check brackets
|
|
95
|
+
if (text[modifier.id.length + 1] !== open) {
|
|
96
|
+
children.push({
|
|
97
|
+
type: 'text',
|
|
98
|
+
text: text.substring(0, modifier.id.length + 1)
|
|
99
|
+
});
|
|
100
|
+
text = text.substring(modifier.id.length + 2);
|
|
101
|
+
start = text.indexOf(commandStart);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
let closing = -1;
|
|
105
|
+
let index = modifier.id.length + 2;
|
|
106
|
+
let counter = 1;
|
|
107
|
+
let escaping = false;
|
|
108
|
+
while (index < text.length) {
|
|
109
|
+
if (text[index] === open && !escaping) {
|
|
110
|
+
counter++;
|
|
111
|
+
}
|
|
112
|
+
if (text[index] === close && !escaping) {
|
|
113
|
+
counter--;
|
|
114
|
+
if (counter === 0) {
|
|
115
|
+
closing = index;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
escaping = text[index] === commandStart;
|
|
120
|
+
index++;
|
|
121
|
+
}
|
|
122
|
+
if (closing !== -1) {
|
|
123
|
+
children.push({
|
|
124
|
+
type: modifier.name,
|
|
125
|
+
children: [parseMarkdown(text.substring(modifier.id.length + 2, closing))]
|
|
126
|
+
});
|
|
127
|
+
text = text.substring(closing + 1);
|
|
128
|
+
start = text.indexOf(commandStart);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// nothing could be applied to command start
|
|
133
|
+
children.push({
|
|
134
|
+
type: 'text',
|
|
135
|
+
text: text[0]
|
|
136
|
+
});
|
|
137
|
+
text = text.substring(1);
|
|
138
|
+
start = text.indexOf(commandStart);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
type: 'none',
|
|
142
|
+
children
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const optimizeTree = (node) => {
|
|
146
|
+
var _a;
|
|
147
|
+
if (node.type === 'text') {
|
|
148
|
+
return !node.text ? undefined : node;
|
|
149
|
+
}
|
|
150
|
+
if (astNodeInserterType.some(value => value === node.type)) {
|
|
151
|
+
return node;
|
|
152
|
+
}
|
|
153
|
+
const currentNode = node;
|
|
154
|
+
if (currentNode.children.length === 0) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
let children = [];
|
|
158
|
+
for (let i = 0; i < currentNode.children.length; i++) {
|
|
159
|
+
const child = optimizeTree(currentNode.children[i]);
|
|
160
|
+
if (!child) {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (child.type === 'none') {
|
|
164
|
+
children.push(...child.children);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
children.push(child);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
currentNode.children = children;
|
|
171
|
+
children = [];
|
|
172
|
+
for (let i = 0; i < currentNode.children.length; i++) {
|
|
173
|
+
const child = currentNode.children[i];
|
|
174
|
+
if (child) {
|
|
175
|
+
if (child.type === 'text' && ((_a = children[children.length - 1]) === null || _a === void 0 ? void 0 : _a.type) === 'text') {
|
|
176
|
+
children[children.length - 1].text += child.text;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
children.push(child);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
currentNode.children = children;
|
|
184
|
+
return currentNode;
|
|
185
|
+
};
|
|
186
|
+
export const MarkdownInterpreter = ({ text, className }) => {
|
|
187
|
+
const tree = parseMarkdown(text);
|
|
188
|
+
const optimizedTree = optimizeTree(tree);
|
|
189
|
+
return _jsx(ASTNodeInterpreter, { node: optimizedTree, isRoot: true, className: className });
|
|
190
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PropsForTranslation } from '../hooks/useTranslation';
|
|
2
|
+
type PaginationTranslation = {
|
|
3
|
+
of: string;
|
|
4
|
+
};
|
|
5
|
+
export type PaginationProps = {
|
|
6
|
+
page: number;
|
|
7
|
+
numberOfPages: number;
|
|
8
|
+
onPageChanged: (page: number) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A Component showing the pagination allowing first, before, next and last page navigation
|
|
12
|
+
*/
|
|
13
|
+
export declare const Pagination: ({ overwriteTranslation, page, numberOfPages, onPageChanged }: PropsForTranslation<PaginationTranslation, PaginationProps>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLast, ChevronLeft, ChevronFirst, ChevronRight } from 'lucide-react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useTranslation } from '../hooks/useTranslation';
|
|
5
|
+
const defaultPaginationTranslations = {
|
|
6
|
+
en: {
|
|
7
|
+
of: 'of'
|
|
8
|
+
},
|
|
9
|
+
de: {
|
|
10
|
+
of: 'von'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A Component showing the pagination allowing first, before, next and last page navigation
|
|
15
|
+
*/
|
|
16
|
+
export const Pagination = ({ overwriteTranslation, page, numberOfPages, onPageChanged }) => {
|
|
17
|
+
const translation = useTranslation(defaultPaginationTranslations, overwriteTranslation);
|
|
18
|
+
const changePage = (page) => {
|
|
19
|
+
onPageChanged(page);
|
|
20
|
+
};
|
|
21
|
+
const noPages = numberOfPages === 0;
|
|
22
|
+
const onFirstPage = page === 0 && !noPages;
|
|
23
|
+
const onLastPage = page === numberOfPages - 1;
|
|
24
|
+
return (_jsxs("div", { className: clsx('row', { 'opacity-30': noPages }), children: [_jsx("button", { onClick: () => changePage(0), disabled: onFirstPage, children: _jsx(ChevronFirst, { className: clsx({ 'opacity-30': onFirstPage }) }) }), _jsx("button", { onClick: () => changePage(page - 1), disabled: onFirstPage, children: _jsx(ChevronLeft, { className: clsx({ 'opacity-30': onFirstPage }) }) }), _jsxs("div", { className: "min-w-[80px] justify-center mx-2", children: [_jsx("span", { className: "select-none text-right flex-1", children: noPages ? 0 : page + 1 }), _jsx("span", { className: "select-none mx-2", children: translation.of }), _jsx("span", { className: "select-none text-left flex-1", children: numberOfPages })] }), _jsx("button", { onClick: () => changePage(page + 1), disabled: onLastPage || noPages, children: _jsx(ChevronRight, { className: clsx({ 'opacity-30': onLastPage }) }) }), _jsx("button", { onClick: () => changePage(numberOfPages - 1), disabled: onLastPage || noPages, children: _jsx(ChevronLast, { className: clsx({ 'opacity-30': onLastPage }) }) })] }));
|
|
25
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
type SocialType = 'mail' | 'github' | 'linkedin' | 'website' | 'medium';
|
|
3
|
+
export type SocialIconProps = {
|
|
4
|
+
type: SocialType;
|
|
5
|
+
url: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
};
|
|
8
|
+
export type ProfileProps = HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
name: string;
|
|
10
|
+
imageUrl: string;
|
|
11
|
+
badge?: ReactNode;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
roleBadge?: string;
|
|
15
|
+
role?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The list of tags for the
|
|
18
|
+
*/
|
|
19
|
+
tags?: string[];
|
|
20
|
+
info?: string;
|
|
21
|
+
socials?: SocialIconProps[];
|
|
22
|
+
imageClassName?: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A Component for showing a Profile
|
|
26
|
+
*/
|
|
27
|
+
export declare const Profile: ({ name, imageUrl, badge, prefix, suffix, roleBadge, role, tags, info, socials, className, imageClassName, ...divProps }: ProfileProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import Image from 'next/image';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { Github, Globe, Linkedin, Mail } from 'lucide-react';
|
|
6
|
+
import { Helpwave } from './icons/Helpwave';
|
|
7
|
+
import { Chip } from './ChipList';
|
|
8
|
+
/**
|
|
9
|
+
* A Component for showing a lin
|
|
10
|
+
*/
|
|
11
|
+
const SocialIcon = ({ type, url, size = 24 }) => {
|
|
12
|
+
let icon;
|
|
13
|
+
switch (type) {
|
|
14
|
+
case 'mail':
|
|
15
|
+
icon = _jsx(Mail, { size: size });
|
|
16
|
+
break;
|
|
17
|
+
case 'linkedin':
|
|
18
|
+
// TODO find an alternative icon
|
|
19
|
+
icon = _jsx(Linkedin, { size: size });
|
|
20
|
+
break;
|
|
21
|
+
case 'github':
|
|
22
|
+
// TODO find an alternative icon
|
|
23
|
+
icon = _jsx(Github, { size: size });
|
|
24
|
+
break;
|
|
25
|
+
case 'website':
|
|
26
|
+
icon = _jsx(Globe, { size: size });
|
|
27
|
+
break;
|
|
28
|
+
case 'medium':
|
|
29
|
+
icon = _jsx(Globe, { size: size }); // TODO find an appropriate medium svg
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
icon = _jsx(Helpwave, { size: 24 });
|
|
33
|
+
}
|
|
34
|
+
return (_jsx(Link, { href: url, target: "_blank", children: _jsx(Chip, { color: "dark", className: "!p-2", children: icon }) }));
|
|
35
|
+
};
|
|
36
|
+
// TODO add colors for dark-mode
|
|
37
|
+
/**
|
|
38
|
+
* A Component for showing a Profile
|
|
39
|
+
*/
|
|
40
|
+
export const Profile = ({ name, imageUrl, badge, prefix, suffix, roleBadge, role, tags, info, socials, className, imageClassName, ...divProps }) => {
|
|
41
|
+
return (_jsxs("div", { ...divProps, className: clsx(`col items-center text-center rounded-3xl p-3 pb-4 bg-white text-gray-900 w-min shadow-around-lg`, className), children: [_jsxs("div", { className: "relative mb-6", children: [_jsx("div", { className: clsx('relative rounded-xl row items-center justify-center overflow-hidden', imageClassName), children: _jsx(Image, { src: imageUrl, alt: "", className: clsx('z-[2] object-cover', imageClassName), width: 0, height: 0, style: { width: 'auto', height: 'auto' } }) }), _jsx("div", { className: "absolute top-[6px] left-[6px] z-[3]", children: badge }), roleBadge && (_jsx("div", { className: "absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-2/3 z-[4] rounded-md", children: _jsx(Chip, { color: "dark", className: "font-bold px-3", children: roleBadge }) }))] }), prefix && _jsx("span", { className: "font-semibold", children: prefix }), _jsx("h2", { id: name, className: "textstyle-title-md", children: name }), suffix && _jsx("span", { className: "text-sm mb-1", children: suffix }), role && _jsx("span", { className: "font-space font-bold text-sm", children: role }), tags && (_jsx("div", { className: "flex flex-wrap mx-4 mt-2 gap-x-2 justify-center", children: tags.map((tag, index) => _jsx("span", { className: "textstyle-description text-sm", children: `#${tag}` }, index)) })), info && _jsx("span", { className: "mt-2 text-sm", children: info }), socials && (_jsx("div", { className: "flex flex-wrap grow items-end justify-center gap-x-4 gap-y-2 mt-4", children: socials.map((socialIconProps, index) => {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_jsx(SocialIcon, { ...socialIconProps, size: (_a = socialIconProps.size) !== null && _a !== void 0 ? _a : 20 }, index));
|
|
44
|
+
}) }))] }));
|
|
45
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ProgressIndicatorProps = {
|
|
2
|
+
progress: number;
|
|
3
|
+
strokeWidth?: number;
|
|
4
|
+
size?: keyof typeof sizeMapping;
|
|
5
|
+
direction?: 'clockwise' | 'counterclockwise';
|
|
6
|
+
rotation?: number;
|
|
7
|
+
};
|
|
8
|
+
declare const sizeMapping: {
|
|
9
|
+
small: number;
|
|
10
|
+
medium: number;
|
|
11
|
+
big: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A progress indicator
|
|
15
|
+
*
|
|
16
|
+
* Start rotation is 3 o'clock and fills counterclockwise
|
|
17
|
+
*
|
|
18
|
+
* Progress is given from 0 to 1
|
|
19
|
+
*/
|
|
20
|
+
export declare const ProgressIndicator: ({ progress, strokeWidth, size, direction, rotation }: ProgressIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const sizeMapping = { small: 16, medium: 24, big: 48 };
|
|
3
|
+
/**
|
|
4
|
+
* A progress indicator
|
|
5
|
+
*
|
|
6
|
+
* Start rotation is 3 o'clock and fills counterclockwise
|
|
7
|
+
*
|
|
8
|
+
* Progress is given from 0 to 1
|
|
9
|
+
*/
|
|
10
|
+
export const ProgressIndicator = ({ progress, strokeWidth = 5, size = 'medium', direction = 'counterclockwise', rotation = 0 }) => {
|
|
11
|
+
const currentSize = sizeMapping[size];
|
|
12
|
+
const center = currentSize / 2;
|
|
13
|
+
const radius = center - strokeWidth / 2;
|
|
14
|
+
const arcLength = 2 * Math.PI * radius;
|
|
15
|
+
const arcOffset = arcLength * progress;
|
|
16
|
+
if (direction === 'clockwise') {
|
|
17
|
+
rotation += 360 * progress;
|
|
18
|
+
}
|
|
19
|
+
return (_jsxs("svg", { style: {
|
|
20
|
+
height: `${currentSize}px`,
|
|
21
|
+
width: `${currentSize}px`,
|
|
22
|
+
transform: `rotate(${rotation}deg)`
|
|
23
|
+
}, children: [_jsx("circle", { cx: center, cy: center, r: radius, fill: "transparent", strokeWidth: strokeWidth, className: "stroke-primary" }), _jsx("circle", { cx: center, cy: center, r: radius, fill: "transparent", strokeWidth: strokeWidth, strokeDasharray: arcLength, strokeDashoffset: arcOffset, className: "stroke-gray-300" })] }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export type RingProps = {
|
|
3
|
+
innerSize: number;
|
|
4
|
+
width: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const Ring: ({ innerSize, width, className, }: RingProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export type AnimatedRingProps = RingProps & {
|
|
9
|
+
fillAnimationDuration?: number;
|
|
10
|
+
repeating?: boolean;
|
|
11
|
+
onAnimationFinished?: () => void;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
};
|
|
14
|
+
export declare const AnimatedRing: ({ innerSize, width, className, fillAnimationDuration, repeating, onAnimationFinished, style, }: AnimatedRingProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export type RingWaveProps = Omit<AnimatedRingProps, 'innerSize'> & {
|
|
16
|
+
startInnerSize: number;
|
|
17
|
+
endInnerSize: number;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
};
|
|
20
|
+
export declare const RingWave: ({ startInnerSize, endInnerSize, width, className, fillAnimationDuration, repeating, onAnimationFinished, style }: RingWaveProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export type RadialRingsProps = {
|
|
22
|
+
circle1ClassName?: string;
|
|
23
|
+
circle2ClassName?: string;
|
|
24
|
+
circle3ClassName?: string;
|
|
25
|
+
waveWidth?: number;
|
|
26
|
+
waveBaseColor?: string;
|
|
27
|
+
sizeCircle1?: number;
|
|
28
|
+
sizeCircle2?: number;
|
|
29
|
+
sizeCircle3?: number;
|
|
30
|
+
};
|
|
31
|
+
export declare const RadialRings: ({ circle1ClassName, circle2ClassName, circle3ClassName, waveWidth, waveBaseColor, sizeCircle1, sizeCircle2, sizeCircle3 }: RadialRingsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { noop } from '../util/noop';
|
|
4
|
+
import { Circle } from './Circle';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
export const Ring = ({ innerSize = 20, width = 7, className = 'outline-primary', }) => {
|
|
7
|
+
return (_jsx("div", { className: clsx(`bg-transparent rounded-full outline`, className), style: {
|
|
8
|
+
width: `${innerSize}px`,
|
|
9
|
+
height: `${innerSize}px`,
|
|
10
|
+
outlineWidth: `${width}px`,
|
|
11
|
+
} }));
|
|
12
|
+
};
|
|
13
|
+
export const AnimatedRing = ({ innerSize, width, className, fillAnimationDuration = 3, repeating = false, onAnimationFinished = noop, style, }) => {
|
|
14
|
+
const [currentWidth, setCurrentWidth] = useState(0);
|
|
15
|
+
const milliseconds = 1000 * fillAnimationDuration;
|
|
16
|
+
const animate = useCallback((timestamp, startTime) => {
|
|
17
|
+
const progress = Math.min((timestamp - startTime) / milliseconds, 1);
|
|
18
|
+
const newWidth = Math.min(width * progress, width);
|
|
19
|
+
setCurrentWidth(newWidth);
|
|
20
|
+
if (progress < 1) {
|
|
21
|
+
requestAnimationFrame((newTimestamp) => animate(newTimestamp, startTime));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
onAnimationFinished();
|
|
25
|
+
if (repeating) {
|
|
26
|
+
setCurrentWidth(0);
|
|
27
|
+
requestAnimationFrame((newTimestamp) => animate(newTimestamp, newTimestamp));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}, [milliseconds, onAnimationFinished, repeating, width]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (currentWidth < width) {
|
|
33
|
+
requestAnimationFrame((timestamp) => animate(timestamp, timestamp));
|
|
34
|
+
}
|
|
35
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
36
|
+
return (_jsx("div", { className: "row items-center justify-center", style: {
|
|
37
|
+
width: `${innerSize + 2 * width}px`,
|
|
38
|
+
height: `${innerSize + 2 * width}px`,
|
|
39
|
+
...style,
|
|
40
|
+
}, children: _jsx(Ring, { innerSize: innerSize, width: currentWidth, className: className }) }));
|
|
41
|
+
};
|
|
42
|
+
export const RingWave = ({ startInnerSize = 20, endInnerSize = 30, width, className, fillAnimationDuration = 3, repeating = false, onAnimationFinished = noop, style }) => {
|
|
43
|
+
const [currentInnerSize, setCurrentInnerSize] = useState(startInnerSize);
|
|
44
|
+
const distance = endInnerSize - startInnerSize;
|
|
45
|
+
const milliseconds = 1000 * fillAnimationDuration;
|
|
46
|
+
const animate = useCallback((timestamp, startTime) => {
|
|
47
|
+
const progress = Math.min((timestamp - startTime) / milliseconds, 1);
|
|
48
|
+
const newInnerSize = Math.min(startInnerSize + distance * progress, endInnerSize);
|
|
49
|
+
setCurrentInnerSize(newInnerSize);
|
|
50
|
+
if (progress < 1) {
|
|
51
|
+
requestAnimationFrame((newTimestamp) => animate(newTimestamp, startTime));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
onAnimationFinished();
|
|
55
|
+
if (repeating) {
|
|
56
|
+
setCurrentInnerSize(startInnerSize);
|
|
57
|
+
requestAnimationFrame((newTimestamp) => animate(newTimestamp, newTimestamp));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, [distance, endInnerSize, milliseconds, onAnimationFinished, repeating, startInnerSize]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (currentInnerSize < endInnerSize) {
|
|
63
|
+
requestAnimationFrame((timestamp) => animate(timestamp, timestamp));
|
|
64
|
+
}
|
|
65
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
66
|
+
return (_jsx("div", { className: "row items-center justify-center", style: {
|
|
67
|
+
width: `${endInnerSize + 2 * width}px`,
|
|
68
|
+
height: `${endInnerSize + 2 * width}px`,
|
|
69
|
+
...style
|
|
70
|
+
}, children: _jsx(Ring, { innerSize: currentInnerSize, width: width, className: className }) }));
|
|
71
|
+
};
|
|
72
|
+
// TODO use fixed colors here to avoid artifacts
|
|
73
|
+
export const RadialRings = ({ circle1ClassName = 'bg-primary/90 outline-primary/90', circle2ClassName = 'bg-primary/60 outline-primary/60', circle3ClassName = 'bg-primary/40 outline-primary/40', waveWidth = 10, waveBaseColor = 'outline-white/20', sizeCircle1 = 100, sizeCircle2 = 200, sizeCircle3 = 300 }) => {
|
|
74
|
+
const [currentRing, setCurrentRing] = useState(0);
|
|
75
|
+
const size = sizeCircle3;
|
|
76
|
+
return (_jsxs("div", { className: "relative", style: {
|
|
77
|
+
width: `${sizeCircle3}px`,
|
|
78
|
+
height: `${sizeCircle3}px`,
|
|
79
|
+
}, children: [_jsx(Circle, { radius: sizeCircle1 / 2, className: clsx(circle1ClassName, `absolute z-[10] -translate-y-1/2 -translate-x-1/2`), style: {
|
|
80
|
+
left: `${size / 2}px`,
|
|
81
|
+
top: `${size / 2}px`
|
|
82
|
+
} }), currentRing === 0 ? (_jsx(AnimatedRing, { innerSize: sizeCircle1, width: (sizeCircle2 - sizeCircle1) / 2, onAnimationFinished: () => currentRing === 0 ? setCurrentRing(1) : null, repeating: true, className: clsx(circle2ClassName, { 'opacity-5': currentRing !== 0 }), style: {
|
|
83
|
+
left: `${size / 2}px`,
|
|
84
|
+
top: `${size / 2}px`,
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
translate: `-50% -50%`,
|
|
87
|
+
zIndex: 9
|
|
88
|
+
} })) : null, currentRing === 2 ? (_jsx(RingWave, { startInnerSize: sizeCircle1 - waveWidth, endInnerSize: sizeCircle2, width: waveWidth, repeating: true, className: clsx(waveBaseColor, `opacity-5`), style: {
|
|
89
|
+
left: `${size / 2}px`,
|
|
90
|
+
top: `${size / 2}px`,
|
|
91
|
+
position: 'absolute',
|
|
92
|
+
translate: `-50% -50%`,
|
|
93
|
+
zIndex: 9,
|
|
94
|
+
} })) : null, _jsx(Circle, { radius: sizeCircle2 / 2, className: clsx(circle2ClassName, { 'opacity-20': currentRing < 1 }, `absolute z-[8] -translate-y-1/2 -translate-x-1/2`), style: {
|
|
95
|
+
left: `${size / 2}px`,
|
|
96
|
+
top: `${size / 2}px`
|
|
97
|
+
} }), currentRing === 1 ? (_jsx(AnimatedRing, { innerSize: sizeCircle2 - 1, width: (sizeCircle3 - sizeCircle2) / 2, onAnimationFinished: () => currentRing === 1 ? setCurrentRing(2) : null, repeating: true, className: clsx(circle3ClassName), style: {
|
|
98
|
+
left: `${size / 2}px`,
|
|
99
|
+
top: `${size / 2}px`,
|
|
100
|
+
position: 'absolute',
|
|
101
|
+
translate: `-50% -50%`,
|
|
102
|
+
zIndex: 7,
|
|
103
|
+
} })) : null, currentRing === 2 ? (_jsx(RingWave, { startInnerSize: sizeCircle2, endInnerSize: sizeCircle3 - waveWidth, width: waveWidth, repeating: true, className: clsx(waveBaseColor, `opacity-5`), style: {
|
|
104
|
+
left: `${size / 2}px`,
|
|
105
|
+
top: `${size / 2}px`,
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
translate: `-50% -50%`,
|
|
108
|
+
zIndex: 7,
|
|
109
|
+
} })) : null, _jsx(Circle, { radius: sizeCircle3 / 2, className: clsx(circle3ClassName, { 'opacity-20': currentRing < 2 }, `absolute z-[6] -translate-y-1/2 -translate-x-1/2`), style: {
|
|
110
|
+
left: `${size / 2}px`,
|
|
111
|
+
top: `${size / 2}px`
|
|
112
|
+
} })] }));
|
|
113
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PropsForTranslation } from '../hooks/useTranslation';
|
|
3
|
+
type SearchableListTranslation = {
|
|
4
|
+
search: string;
|
|
5
|
+
nothingFound: string;
|
|
6
|
+
};
|
|
7
|
+
export type SearchableListProps<T> = {
|
|
8
|
+
list: T[];
|
|
9
|
+
initialSearch?: string;
|
|
10
|
+
searchMapping: (value: T) => string[];
|
|
11
|
+
itemMapper: (value: T) => ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A component for searching a list
|
|
16
|
+
*/
|
|
17
|
+
export declare const SearchableList: <T>({ overwriteTranslation, list, initialSearch, searchMapping, itemMapper, className }: PropsForTranslation<SearchableListTranslation, SearchableListProps<T>>) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Search } from 'lucide-react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useTranslation } from '../hooks/useTranslation';
|
|
6
|
+
import { MultiSearchWithMapping } from '../util/simpleSearch';
|
|
7
|
+
import { Input } from './user-input/Input';
|
|
8
|
+
const defaultSearchableListTranslation = {
|
|
9
|
+
en: {
|
|
10
|
+
search: 'Search',
|
|
11
|
+
nothingFound: 'Nothing found'
|
|
12
|
+
},
|
|
13
|
+
de: {
|
|
14
|
+
search: 'Suche',
|
|
15
|
+
nothingFound: 'Nichts gefunden'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A component for searching a list
|
|
20
|
+
*/
|
|
21
|
+
export const SearchableList = ({ overwriteTranslation, list, initialSearch = '', searchMapping, itemMapper, className }) => {
|
|
22
|
+
const translation = useTranslation(defaultSearchableListTranslation, overwriteTranslation);
|
|
23
|
+
const [search, setSearch] = useState(initialSearch);
|
|
24
|
+
useEffect(() => setSearch(initialSearch), [initialSearch]);
|
|
25
|
+
const filteredEntries = useMemo(() => MultiSearchWithMapping(search, list, searchMapping), [search, list, searchMapping]);
|
|
26
|
+
return (_jsxs("div", { className: clsx('col gap-y-2', className), children: [_jsxs("div", { className: "row justify-between gap-x-2 items-center", children: [_jsx("div", { className: "flex-1", children: _jsx(Input, { value: search, onChange: setSearch, placeholder: translation.search }) }), _jsx(Search, { size: 20 })] }), filteredEntries.length > 0 && (_jsx("div", { className: "col gap-y-1", children: filteredEntries.map(itemMapper) })), !filteredEntries.length && _jsx("div", { className: "row justify-center", children: translation.nothingFound })] }));
|
|
27
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TextButtonProps } from './Button';
|
|
2
|
+
import type { TableSortingType } from './Table';
|
|
3
|
+
export type SortButtonProps = Omit<TextButtonProps, 'onClick'> & {
|
|
4
|
+
ascending?: TableSortingType;
|
|
5
|
+
onClick: (newTableSorting: TableSortingType) => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A Extension of the normal button that displays the sorting state right of the content
|
|
9
|
+
*/
|
|
10
|
+
export declare const SortButton: ({ children, ascending, color, onClick, ...buttonProps }: SortButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown, ChevronsUpDown, ChevronUp } from 'lucide-react';
|
|
3
|
+
import { TextButton } from './Button';
|
|
4
|
+
/**
|
|
5
|
+
* A Extension of the normal button that displays the sorting state right of the content
|
|
6
|
+
*/
|
|
7
|
+
export const SortButton = ({ children, ascending, color, onClick, ...buttonProps }) => {
|
|
8
|
+
return (_jsx(TextButton, { color: color, onClick: () => onClick(ascending === 'descending' ? 'ascending' : 'descending'), ...buttonProps, children: _jsxs("div", { className: "row gap-x-2", children: [children, ascending === 'ascending' ? _jsx(ChevronUp, {}) : (!ascending ? _jsx(ChevronsUpDown, {}) : _jsx(ChevronDown, {}))] }) }));
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|