@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
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
2
|
-
import clsx from 'clsx'
|
|
3
|
-
import { ChevronDown, ChevronUp } from 'lucide-react'
|
|
4
|
-
import type { ExpandableProps } from '../Expandable'
|
|
5
|
-
import { Expandable } from '../Expandable'
|
|
6
|
-
import { MarkdownInterpreter } from '../MarkdownInterpreter'
|
|
7
|
-
|
|
8
|
-
type ContentType = {
|
|
9
|
-
type: 'markdown',
|
|
10
|
-
value: string,
|
|
11
|
-
} | {
|
|
12
|
-
type: 'custom',
|
|
13
|
-
value: ReactNode,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type FAQItem = Pick<ExpandableProps, 'initialExpansion'| 'className'> & {
|
|
17
|
-
id: string,
|
|
18
|
-
title: string,
|
|
19
|
-
content: ContentType,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type FAQSectionProps = {
|
|
23
|
-
entries: FAQItem[],
|
|
24
|
-
expandableClassName?: string,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Description
|
|
29
|
-
*/
|
|
30
|
-
export const FAQSection = ({
|
|
31
|
-
entries,
|
|
32
|
-
expandableClassName
|
|
33
|
-
}: FAQSectionProps) => {
|
|
34
|
-
const chevronSize = 28
|
|
35
|
-
return (
|
|
36
|
-
<div className="col gap-y-4">
|
|
37
|
-
{entries.map(({ id, title, content, ...restProps }) => (
|
|
38
|
-
<Expandable
|
|
39
|
-
key={id}
|
|
40
|
-
{...restProps}
|
|
41
|
-
label={(<h3 id={id} className="textstyle-title-md">{title}</h3>)}
|
|
42
|
-
clickOnlyOnHeader={false}
|
|
43
|
-
icon={(expanded) => expanded ?
|
|
44
|
-
(<ChevronUp size={chevronSize} className="text-primary" style={{ minWidth: `${chevronSize}px` }}/>) :
|
|
45
|
-
(<ChevronDown size={chevronSize} className="text-primary"/>)
|
|
46
|
-
}
|
|
47
|
-
className={clsx('rounded-xl', expandableClassName)}
|
|
48
|
-
headerClassName="px-6 py-4"
|
|
49
|
-
>
|
|
50
|
-
<div className="mt-2 px-6 pb-4">
|
|
51
|
-
{content.type === 'markdown' ? (<MarkdownInterpreter text={content.value}/>) : content.value}
|
|
52
|
-
</div>
|
|
53
|
-
</Expandable>
|
|
54
|
-
))}
|
|
55
|
-
</div>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
2
|
-
import Image from 'next/image'
|
|
3
|
-
import clsx from 'clsx'
|
|
4
|
-
|
|
5
|
-
export type TileProps = {
|
|
6
|
-
title: { value: string, className?: string },
|
|
7
|
-
description?: { value: string, className?: string },
|
|
8
|
-
prefix?: ReactNode,
|
|
9
|
-
suffix?: ReactNode,
|
|
10
|
-
className?: string,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A component for creating a tile similar to the flutter ListTile
|
|
15
|
-
*/
|
|
16
|
-
export const Tile = ({
|
|
17
|
-
title,
|
|
18
|
-
description,
|
|
19
|
-
prefix,
|
|
20
|
-
suffix,
|
|
21
|
-
className
|
|
22
|
-
}: TileProps) => {
|
|
23
|
-
return (
|
|
24
|
-
<div className={clsx('row gap-x-4 w-full items-center', className)}>
|
|
25
|
-
{prefix}
|
|
26
|
-
<div className="col w-full">
|
|
27
|
-
<span className={clsx(title.className)}>{title.value}</span>
|
|
28
|
-
{!!description &&
|
|
29
|
-
<span className={clsx(description.className ?? 'textstyle-description')}>{description.value}</span>}
|
|
30
|
-
</div>
|
|
31
|
-
{suffix}
|
|
32
|
-
</div>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
type ImageLocation = 'prefix' | 'suffix'
|
|
37
|
-
type ImageSize = {
|
|
38
|
-
width: number,
|
|
39
|
-
height: number,
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type TileWithImageProps = Omit<TileProps, 'suffix' | 'prefix'> & {
|
|
43
|
-
url: string,
|
|
44
|
-
imageLocation?: ImageLocation,
|
|
45
|
-
imageSize?: ImageSize,
|
|
46
|
-
imageClassName?: string,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* A Tile with an image as prefix or suffix
|
|
51
|
-
*/
|
|
52
|
-
export const TileWithImage = ({
|
|
53
|
-
url,
|
|
54
|
-
imageLocation = 'prefix',
|
|
55
|
-
imageSize = { width: 24, height: 24 },
|
|
56
|
-
imageClassName = '',
|
|
57
|
-
...tileProps
|
|
58
|
-
}: TileWithImageProps) => {
|
|
59
|
-
const image = <Image src={url} alt="" {...imageSize} className={clsx(imageClassName)}/>
|
|
60
|
-
return (
|
|
61
|
-
<Tile
|
|
62
|
-
{...tileProps}
|
|
63
|
-
prefix={imageLocation === 'prefix' ? image : undefined}
|
|
64
|
-
suffix={imageLocation === 'suffix' ? image : undefined}
|
|
65
|
-
/>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import type { SolidButtonColor } from '../Button'
|
|
3
|
-
import { SolidButton } from '../Button'
|
|
4
|
-
import type { PropsForTranslation } from '../../hooks/useTranslation'
|
|
5
|
-
import { useTranslation } from '../../hooks/useTranslation'
|
|
6
|
-
import { Modal, type ModalProps } from './Modal'
|
|
7
|
-
|
|
8
|
-
type ConfirmDialogTranslation = {
|
|
9
|
-
confirm: string,
|
|
10
|
-
cancel: string,
|
|
11
|
-
decline: string,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type ConfirmDialogType = 'positive' | 'negative' | 'neutral'
|
|
15
|
-
|
|
16
|
-
const defaultConfirmDialogTranslation = {
|
|
17
|
-
en: {
|
|
18
|
-
confirm: 'Confirm',
|
|
19
|
-
cancel: 'Cancel',
|
|
20
|
-
decline: 'Decline'
|
|
21
|
-
},
|
|
22
|
-
de: {
|
|
23
|
-
confirm: 'Bestätigen',
|
|
24
|
-
cancel: 'Abbrechen',
|
|
25
|
-
decline: 'Ablehnen'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ButtonOverwriteType = {
|
|
30
|
-
text?: string,
|
|
31
|
-
color?: SolidButtonColor,
|
|
32
|
-
disabled?: boolean,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type ConfirmDialogProps = ModalProps & {
|
|
36
|
-
isShowingDecline?: boolean,
|
|
37
|
-
requireAnswer?: boolean,
|
|
38
|
-
onCancel?: () => void,
|
|
39
|
-
onConfirm: () => void,
|
|
40
|
-
onDecline?: () => void,
|
|
41
|
-
confirmType?: ConfirmDialogType,
|
|
42
|
-
/**
|
|
43
|
-
* Order: Cancel, Decline, Confirm
|
|
44
|
-
*/
|
|
45
|
-
buttonOverwrites?: [ButtonOverwriteType, ButtonOverwriteType, ButtonOverwriteType],
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* A Dialog for asking the user for Confirmation
|
|
50
|
-
*
|
|
51
|
-
* To require an answer omit the onBackgroundClick
|
|
52
|
-
*/
|
|
53
|
-
export const ConfirmDialog = ({
|
|
54
|
-
overwriteTranslation,
|
|
55
|
-
children,
|
|
56
|
-
onCancel,
|
|
57
|
-
onConfirm,
|
|
58
|
-
onDecline,
|
|
59
|
-
confirmType = 'positive',
|
|
60
|
-
buttonOverwrites,
|
|
61
|
-
...restProps
|
|
62
|
-
}: PropsForTranslation<ConfirmDialogTranslation, PropsWithChildren<ConfirmDialogProps>>) => {
|
|
63
|
-
const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation)
|
|
64
|
-
|
|
65
|
-
const mapping: Record<ConfirmDialogType, SolidButtonColor> = {
|
|
66
|
-
neutral: 'primary',
|
|
67
|
-
negative: 'negative',
|
|
68
|
-
positive: 'positive'
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<Modal {...restProps}>
|
|
73
|
-
{children}
|
|
74
|
-
<div className="row mt-3 gap-x-4 justify-end">
|
|
75
|
-
{onCancel && (
|
|
76
|
-
<SolidButton
|
|
77
|
-
color={buttonOverwrites?.[0].color ?? 'primary'}
|
|
78
|
-
onClick={onCancel}
|
|
79
|
-
disabled={buttonOverwrites?.[0].disabled ?? false}
|
|
80
|
-
>
|
|
81
|
-
{buttonOverwrites?.[0].text ?? translation.cancel}
|
|
82
|
-
</SolidButton>
|
|
83
|
-
)}
|
|
84
|
-
{onDecline && (
|
|
85
|
-
<SolidButton
|
|
86
|
-
color={buttonOverwrites?.[1].color ?? 'negative'}
|
|
87
|
-
onClick={onDecline}
|
|
88
|
-
|
|
89
|
-
disabled={buttonOverwrites?.[1].disabled ?? false}
|
|
90
|
-
>
|
|
91
|
-
{buttonOverwrites?.[1].text ?? translation.decline}
|
|
92
|
-
</SolidButton>
|
|
93
|
-
)}
|
|
94
|
-
<SolidButton
|
|
95
|
-
autoFocus
|
|
96
|
-
color={buttonOverwrites?.[2].color ?? mapping[confirmType]}
|
|
97
|
-
onClick={onConfirm}
|
|
98
|
-
disabled={buttonOverwrites?.[2].disabled ?? false}
|
|
99
|
-
>
|
|
100
|
-
{buttonOverwrites?.[2].text ?? translation.confirm}
|
|
101
|
-
</SolidButton>
|
|
102
|
-
</div>
|
|
103
|
-
</Modal>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import { SolidButton } from '../Button'
|
|
3
|
-
import type { PropsForTranslation } from '../../hooks/useTranslation'
|
|
4
|
-
import { useTranslation } from '../../hooks/useTranslation'
|
|
5
|
-
import { Modal, type ModalProps } from './Modal'
|
|
6
|
-
|
|
7
|
-
type DiscardChangesDialogTranslation = {
|
|
8
|
-
save: string,
|
|
9
|
-
cancel: string,
|
|
10
|
-
dontSave: string,
|
|
11
|
-
title: string,
|
|
12
|
-
description: string,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const defaultDiscardChangesDialogTranslation = {
|
|
16
|
-
en: {
|
|
17
|
-
save: 'Save',
|
|
18
|
-
cancel: 'Cancel',
|
|
19
|
-
dontSave: 'Don\'t save',
|
|
20
|
-
title: 'Unsaved Changes',
|
|
21
|
-
description: 'Do you want to save your changes?'
|
|
22
|
-
},
|
|
23
|
-
de: {
|
|
24
|
-
save: 'Speichern',
|
|
25
|
-
cancel: 'Abbrechen',
|
|
26
|
-
dontSave: 'Nicht Speichern',
|
|
27
|
-
title: 'Ungespeicherte Änderungen',
|
|
28
|
-
description: 'Möchtest du die Änderungen speichern?'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type DiscardChangesDialogProps = ModalProps & {
|
|
33
|
-
isShowingDecline?: boolean,
|
|
34
|
-
requireAnswer?: boolean,
|
|
35
|
-
onCancel: () => void,
|
|
36
|
-
onSave: () => void,
|
|
37
|
-
onDontSave: () => void,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const DiscardChangesDialog = ({
|
|
41
|
-
overwriteTranslation,
|
|
42
|
-
children,
|
|
43
|
-
title,
|
|
44
|
-
description,
|
|
45
|
-
onCancel,
|
|
46
|
-
onSave,
|
|
47
|
-
onDontSave,
|
|
48
|
-
...modalProps
|
|
49
|
-
}: PropsForTranslation<DiscardChangesDialogTranslation, PropsWithChildren<DiscardChangesDialogProps>>) => {
|
|
50
|
-
const translation = useTranslation(defaultDiscardChangesDialogTranslation, overwriteTranslation)
|
|
51
|
-
return (
|
|
52
|
-
<Modal
|
|
53
|
-
title={title ?? translation.title}
|
|
54
|
-
description={description ?? translation.description}
|
|
55
|
-
{...modalProps}
|
|
56
|
-
>
|
|
57
|
-
{children}
|
|
58
|
-
<div className="row mt-3 gap-x-4 justify-end">
|
|
59
|
-
<SolidButton color="positive" onClick={onSave}>
|
|
60
|
-
{translation.save}
|
|
61
|
-
</SolidButton>
|
|
62
|
-
<SolidButton color="negative" onClick={onDontSave}>
|
|
63
|
-
{translation.dontSave}
|
|
64
|
-
</SolidButton>
|
|
65
|
-
<SolidButton autoFocus color="primary" onClick={onCancel}>
|
|
66
|
-
{translation.cancel}
|
|
67
|
-
</SolidButton>
|
|
68
|
-
</div>
|
|
69
|
-
</Modal>
|
|
70
|
-
)
|
|
71
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Input } from '../user-input/Input'
|
|
2
|
-
import type { InputProps } from '../user-input/Input'
|
|
3
|
-
import type { ConfirmDialogProps } from './ConfirmDialog'
|
|
4
|
-
import { ConfirmDialog } from './ConfirmDialog'
|
|
5
|
-
|
|
6
|
-
export type InputModalProps = ConfirmDialogProps & {
|
|
7
|
-
inputs: InputProps[],
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A modal for receiving multiple inputs
|
|
12
|
-
*/
|
|
13
|
-
export const InputModal = ({
|
|
14
|
-
inputs,
|
|
15
|
-
buttonOverwrites,
|
|
16
|
-
...restProps
|
|
17
|
-
}: InputModalProps) => {
|
|
18
|
-
return (
|
|
19
|
-
<ConfirmDialog
|
|
20
|
-
buttonOverwrites={buttonOverwrites}
|
|
21
|
-
{...restProps}
|
|
22
|
-
>
|
|
23
|
-
{inputs.map((inputProps, index) => <Input key={`input ${index}`} {...inputProps}/>)}
|
|
24
|
-
</ConfirmDialog>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { type PropsWithChildren } from 'react'
|
|
2
|
-
import type { PropsForTranslation } from '../../hooks/useTranslation'
|
|
3
|
-
import { useTranslation } from '../../hooks/useTranslation'
|
|
4
|
-
import { Select } from '../user-input/Select'
|
|
5
|
-
import type { Languages } from '../../hooks/useLanguage'
|
|
6
|
-
import { useLanguage } from '../../hooks/useLanguage'
|
|
7
|
-
import { SolidButton } from '../Button'
|
|
8
|
-
import { Modal, type ModalProps } from './Modal'
|
|
9
|
-
|
|
10
|
-
const languageDetails = {
|
|
11
|
-
en: 'English',
|
|
12
|
-
de: 'Deutsch'
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type LanguageModalTranslation = {
|
|
16
|
-
message: string,
|
|
17
|
-
done: string,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const defaultConfirmDialogTranslation = {
|
|
21
|
-
en: {
|
|
22
|
-
message: 'Choose your language',
|
|
23
|
-
done: 'Done',
|
|
24
|
-
},
|
|
25
|
-
de: {
|
|
26
|
-
message: 'Wählen Sie Ihre Sprache',
|
|
27
|
-
done: 'Fertig',
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type LanguageModalProps = ModalProps & {
|
|
32
|
-
onDone: () => void,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A Modal for selecting the Language
|
|
37
|
-
*
|
|
38
|
-
* The State of open needs to be managed by the parent
|
|
39
|
-
*/
|
|
40
|
-
export const LanguageModal = ({
|
|
41
|
-
overwriteTranslation,
|
|
42
|
-
onDone,
|
|
43
|
-
onBackgroundClick,
|
|
44
|
-
...modalProps
|
|
45
|
-
}: PropsForTranslation<LanguageModalTranslation, PropsWithChildren<LanguageModalProps>>) => {
|
|
46
|
-
const { language, setLanguage } = useLanguage()
|
|
47
|
-
const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation)
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<Modal
|
|
51
|
-
titleText={translation.message}
|
|
52
|
-
onBackgroundClick={(eventData) => {
|
|
53
|
-
onDone()
|
|
54
|
-
|
|
55
|
-
if (onBackgroundClick) {
|
|
56
|
-
onBackgroundClick(eventData)
|
|
57
|
-
}
|
|
58
|
-
}}
|
|
59
|
-
{...modalProps}
|
|
60
|
-
>
|
|
61
|
-
<div className="w-[320px]">
|
|
62
|
-
<Select
|
|
63
|
-
className="mt-2"
|
|
64
|
-
value={language}
|
|
65
|
-
options={Object.entries(languageDetails).map(([tag, name]) => ({ label: name, value: tag }))}
|
|
66
|
-
onChange={(language: string) => setLanguage(language as Languages)}
|
|
67
|
-
/>
|
|
68
|
-
<div className="row mt-3 gap-x-4 justify-end">
|
|
69
|
-
<SolidButton autoFocus color="positive" onClick={onDone}>
|
|
70
|
-
{translation.done}
|
|
71
|
-
</SolidButton>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</Modal>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { useContext, useEffect, type MouseEventHandler, type PropsWithChildren, type ReactNode } from 'react'
|
|
2
|
-
import ReactDOM from 'react-dom'
|
|
3
|
-
import { X } from 'lucide-react'
|
|
4
|
-
import clsx from 'clsx'
|
|
5
|
-
import type { Languages } from '../../hooks/useLanguage'
|
|
6
|
-
import type { PropsForTranslation } from '../../hooks/useTranslation'
|
|
7
|
-
import { useTranslation } from '../../hooks/useTranslation'
|
|
8
|
-
import { Tooltip } from '../Tooltip'
|
|
9
|
-
import { ModalContext } from './ModalRegister'
|
|
10
|
-
|
|
11
|
-
type ModalHeaderTranslation = {
|
|
12
|
-
close: string,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const defaultModalHeaderTranslation: Record<Languages, ModalHeaderTranslation> = {
|
|
16
|
-
en: {
|
|
17
|
-
close: 'Close'
|
|
18
|
-
},
|
|
19
|
-
de: {
|
|
20
|
-
close: 'Schließen'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type ModalHeaderProps = {
|
|
25
|
-
onCloseClick?: () => void,
|
|
26
|
-
/** The title of the Modal. If you want to only set the text use `titleText` instead */
|
|
27
|
-
title?: ReactNode,
|
|
28
|
-
/** The title text of the Modal. If you want to set a custom title use `title` instead */
|
|
29
|
-
titleText?: string,
|
|
30
|
-
/** The description of the Modal. If you want to only set the text use `descriptionText` instead */
|
|
31
|
-
description?: ReactNode,
|
|
32
|
-
/** The description text of the Modal. If you want to set a custom description use `description` instead */
|
|
33
|
-
descriptionText?: string,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* A default Header to be used by modals to have a uniform design
|
|
38
|
-
*/
|
|
39
|
-
export const ModalHeader = ({
|
|
40
|
-
overwriteTranslation,
|
|
41
|
-
onCloseClick,
|
|
42
|
-
title,
|
|
43
|
-
titleText = '',
|
|
44
|
-
description,
|
|
45
|
-
descriptionText = ''
|
|
46
|
-
}: PropsForTranslation<ModalHeaderTranslation, ModalHeaderProps>) => {
|
|
47
|
-
const translation = useTranslation(defaultModalHeaderTranslation, overwriteTranslation)
|
|
48
|
-
return (
|
|
49
|
-
<div className="col">
|
|
50
|
-
<div className="row justify-between items-start gap-x-8">
|
|
51
|
-
{title ?? (
|
|
52
|
-
<span className={clsx('textstyle-title-lg', {
|
|
53
|
-
'mb-1': description || descriptionText,
|
|
54
|
-
})}>
|
|
55
|
-
{titleText}
|
|
56
|
-
</span>
|
|
57
|
-
)}
|
|
58
|
-
{!!onCloseClick && (
|
|
59
|
-
<Tooltip tooltip={translation.close}>
|
|
60
|
-
<button className="row bg-gray-200 hover:bg-gray-300 rounded-md p-1" onClick={onCloseClick}>
|
|
61
|
-
<X/>
|
|
62
|
-
</button>
|
|
63
|
-
</Tooltip>
|
|
64
|
-
)}
|
|
65
|
-
</div>
|
|
66
|
-
{description ?? (<span className="textstyle-description">{descriptionText}</span>)}
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export const modalRootName = 'modal-root'
|
|
72
|
-
|
|
73
|
-
export type ModalProps = {
|
|
74
|
-
id: string,
|
|
75
|
-
isOpen: boolean,
|
|
76
|
-
onBackgroundClick?: MouseEventHandler<HTMLDivElement>,
|
|
77
|
-
backgroundClassName?: string,
|
|
78
|
-
modalClassName?: string,
|
|
79
|
-
containerClassName?: string,
|
|
80
|
-
} & ModalHeaderProps
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* A Generic Modal Window
|
|
84
|
-
*
|
|
85
|
-
* The state needs to be managed by the parent of this component
|
|
86
|
-
*
|
|
87
|
-
* DO NOT Conditionally render this always use the isOpen to ensure that the ModalRegister is working properly
|
|
88
|
-
*/
|
|
89
|
-
export const Modal = ({
|
|
90
|
-
children,
|
|
91
|
-
id,
|
|
92
|
-
isOpen,
|
|
93
|
-
onBackgroundClick,
|
|
94
|
-
backgroundClassName = '',
|
|
95
|
-
modalClassName = '',
|
|
96
|
-
containerClassName = '',
|
|
97
|
-
...modalHeaderProps
|
|
98
|
-
}: PropsWithChildren<ModalProps>) => {
|
|
99
|
-
const modalRoot = typeof window !== 'undefined' ? document.getElementById(modalRootName) : null
|
|
100
|
-
const {
|
|
101
|
-
register,
|
|
102
|
-
addToRegister,
|
|
103
|
-
removeFromRegister
|
|
104
|
-
} = useContext(ModalContext)
|
|
105
|
-
|
|
106
|
-
if (!id) {
|
|
107
|
-
console.error('the id cannot be empty')
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (isOpen) {
|
|
112
|
-
addToRegister(id)
|
|
113
|
-
} else {
|
|
114
|
-
removeFromRegister(id)
|
|
115
|
-
}
|
|
116
|
-
}, [addToRegister, id, removeFromRegister, isOpen])
|
|
117
|
-
|
|
118
|
-
if (modalRoot === null || !isOpen) return null
|
|
119
|
-
|
|
120
|
-
const isLast = register.length < 1 || register[register.length - 1] === id
|
|
121
|
-
const isSecondLast = register.length < 2 || register[register.length - 2] === id
|
|
122
|
-
|
|
123
|
-
return ReactDOM.createPortal(
|
|
124
|
-
<div className={clsx('fixed inset-0 overflow-y-auto z-[99]', containerClassName)} id={id}>
|
|
125
|
-
{isLast && (
|
|
126
|
-
<div
|
|
127
|
-
className={clsx('fixed inset-0 h-screen w-screen', backgroundClassName, {
|
|
128
|
-
'bg-black/70': isLast && register.length === 1,
|
|
129
|
-
})}
|
|
130
|
-
onClick={onBackgroundClick}
|
|
131
|
-
/>
|
|
132
|
-
)}
|
|
133
|
-
<div
|
|
134
|
-
className={clsx('fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 col p-4 bg-white text-black rounded-xl shadow-xl', modalClassName)}>
|
|
135
|
-
<ModalHeader {...modalHeaderProps} />
|
|
136
|
-
{children}
|
|
137
|
-
</div>
|
|
138
|
-
{!isLast && (
|
|
139
|
-
<div
|
|
140
|
-
className={clsx('fixed inset-0 h-screen w-screen', backgroundClassName, {
|
|
141
|
-
'bg-black/70': isSecondLast && register.length > 1,
|
|
142
|
-
})}
|
|
143
|
-
/>
|
|
144
|
-
)}
|
|
145
|
-
</div>,
|
|
146
|
-
modalRoot,
|
|
147
|
-
id
|
|
148
|
-
)
|
|
149
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import { createContext, useState } from 'react'
|
|
3
|
-
import { noop } from '../../util/noop'
|
|
4
|
-
|
|
5
|
-
export type ModalContextType = {
|
|
6
|
-
register: string[],
|
|
7
|
-
addToRegister: (id: string) => void,
|
|
8
|
-
removeFromRegister: (id: string) => void,
|
|
9
|
-
}
|
|
10
|
-
export const ModalContext = createContext<ModalContextType>({
|
|
11
|
-
register: [],
|
|
12
|
-
addToRegister: noop,
|
|
13
|
-
removeFromRegister: noop,
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A Simple Wrapper for the context
|
|
18
|
-
*/
|
|
19
|
-
export const ModalRegister = ({
|
|
20
|
-
children
|
|
21
|
-
}: PropsWithChildren) => {
|
|
22
|
-
const [register, setRegister] = useState<string[]>([])
|
|
23
|
-
|
|
24
|
-
const inRegister = (id: string) => {
|
|
25
|
-
return !!register.find(value => value === id)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const addToRegister = (id: string) => {
|
|
29
|
-
if (!inRegister(id)) {
|
|
30
|
-
setRegister([...register, id])
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const removeFromRegister = (id: string) => {
|
|
35
|
-
if (inRegister(id)) {
|
|
36
|
-
setRegister(register.filter(value => value !== id))
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<ModalContext.Provider value={{ register, addToRegister, removeFromRegister }}>
|
|
42
|
-
{children}
|
|
43
|
-
</ModalContext.Provider>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Check } from 'lucide-react'
|
|
2
|
-
import { noop } from '../../util/noop'
|
|
3
|
-
import { Checkbox } from '../user-input/Checkbox'
|
|
4
|
-
import type { Languages } from '../../hooks/useLanguage'
|
|
5
|
-
import type { PropsForTranslation } from '../../hooks/useTranslation'
|
|
6
|
-
import { useTranslation } from '../../hooks/useTranslation'
|
|
7
|
-
import type { PropertyBaseProps } from './PropertyBase'
|
|
8
|
-
import { PropertyBase } from './PropertyBase'
|
|
9
|
-
|
|
10
|
-
type CheckboxPropertyTranslation = {
|
|
11
|
-
yes: string,
|
|
12
|
-
no: string,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const defaultCheckboxPropertyTranslation: Record<Languages, CheckboxPropertyTranslation> = {
|
|
16
|
-
en: {
|
|
17
|
-
yes: 'Yes',
|
|
18
|
-
no: 'No'
|
|
19
|
-
},
|
|
20
|
-
de: {
|
|
21
|
-
yes: 'Ja',
|
|
22
|
-
no: 'Nein'
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type CheckboxPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue' | 'onRemove'> & {
|
|
27
|
-
value?: boolean,
|
|
28
|
-
onChange?: (value: boolean) => void,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* An Input for a boolen properties
|
|
33
|
-
*/
|
|
34
|
-
export const CheckboxProperty = ({
|
|
35
|
-
overwriteTranslation,
|
|
36
|
-
value,
|
|
37
|
-
onChange = noop,
|
|
38
|
-
readOnly,
|
|
39
|
-
...baseProps
|
|
40
|
-
}: PropsForTranslation<CheckboxPropertyTranslation, CheckboxPropertyProps>) => {
|
|
41
|
-
const translation = useTranslation(defaultCheckboxPropertyTranslation, overwriteTranslation)
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<PropertyBase
|
|
45
|
-
{...baseProps}
|
|
46
|
-
hasValue={true}
|
|
47
|
-
readOnly={readOnly}
|
|
48
|
-
icon={<Check size={16}/>}
|
|
49
|
-
input={() => (
|
|
50
|
-
<div className="row py-2 px-4 items-center">
|
|
51
|
-
<Checkbox
|
|
52
|
-
// TODO make bigger as in #904
|
|
53
|
-
checked={value ?? true}
|
|
54
|
-
disabled={readOnly}
|
|
55
|
-
onChange={onChange}
|
|
56
|
-
label={{ name: `${translation.yes}/${translation.no}`, labelType: 'labelMedium' }}
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
)}
|
|
60
|
-
/>
|
|
61
|
-
)
|
|
62
|
-
}
|