@ahrowe/ui 0.31.0 → 0.32.0
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/esm/common/actionButtons/actionButtons.mjs +1 -1
- package/dist/esm/common/actionButtons/actionButtons.mjs.map +1 -1
- package/dist/esm/common/alert/alert.mjs +1 -1
- package/dist/esm/common/alert/alert.mjs.map +1 -1
- package/dist/esm/common/alert/alert.types.mjs.map +1 -1
- package/dist/esm/common/breadcrumb/breadcrumb.mjs +1 -1
- package/dist/esm/common/breadcrumb/breadcrumb.mjs.map +1 -1
- package/dist/esm/common/carousel/carousel.mjs +1 -1
- package/dist/esm/common/carousel/carousel.mjs.map +1 -1
- package/dist/esm/common/chip/chip.mjs +1 -1
- package/dist/esm/common/chip/chip.mjs.map +1 -1
- package/dist/esm/common/chip/chip.types.mjs.map +1 -1
- package/dist/esm/common/colorPicker/colorPicker.mjs +1 -1
- package/dist/esm/common/colorPicker/colorPicker.mjs.map +1 -1
- package/dist/esm/common/configProvider/useLabels.mjs +2 -0
- package/dist/esm/common/configProvider/useLabels.mjs.map +1 -0
- package/dist/esm/common/confirmModal/confirmModal.mjs +1 -1
- package/dist/esm/common/confirmModal/confirmModal.mjs.map +1 -1
- package/dist/esm/common/datePicker/components/datePickerMonth/datePickerMonth.mjs.map +1 -1
- package/dist/esm/common/datePicker/datePicker.mjs.map +1 -1
- package/dist/esm/common/emptyState/emptyState.mjs +1 -1
- package/dist/esm/common/emptyState/emptyState.mjs.map +1 -1
- package/dist/esm/common/input/input.mjs +1 -1
- package/dist/esm/common/input/input.mjs.map +1 -1
- package/dist/esm/common/input/input.types.mjs.map +1 -1
- package/dist/esm/common/klipyPicker/klipyPicker.mjs +1 -1
- package/dist/esm/common/klipyPicker/klipyPicker.mjs.map +1 -1
- package/dist/esm/common/modal/modal.mjs +1 -1
- package/dist/esm/common/modal/modal.mjs.map +1 -1
- package/dist/esm/common/multiSelect/multiSelect.mjs +1 -1
- package/dist/esm/common/multiSelect/multiSelect.mjs.map +1 -1
- package/dist/esm/common/numberInput/numberInput.mjs +1 -1
- package/dist/esm/common/numberInput/numberInput.mjs.map +1 -1
- package/dist/esm/common/otpInput/otpInput.mjs +1 -1
- package/dist/esm/common/otpInput/otpInput.mjs.map +1 -1
- package/dist/esm/common/otpInput/otpInput.types.mjs.map +1 -1
- package/dist/esm/common/pagination/pagination.mjs +1 -1
- package/dist/esm/common/pagination/pagination.mjs.map +1 -1
- package/dist/esm/common/roomDrawer/roomDrawer.mjs +1 -1
- package/dist/esm/common/roomDrawer/roomDrawer.mjs.map +1 -1
- package/dist/esm/common/splitButton/splitButton.mjs +1 -1
- package/dist/esm/common/splitButton/splitButton.mjs.map +1 -1
- package/dist/esm/common/timer/timer.mjs +1 -1
- package/dist/esm/common/timer/timer.mjs.map +1 -1
- package/dist/esm/common/toast/toast.mjs +1 -1
- package/dist/esm/common/toast/toast.mjs.map +1 -1
- package/dist/esm/common/toast/toastProvider.mjs +1 -1
- package/dist/esm/common/toast/toastProvider.mjs.map +1 -1
- package/dist/esm/common/tree/tree.mjs +1 -1
- package/dist/esm/common/tree/tree.mjs.map +1 -1
- package/dist/esm/common/virtualList/virtualList.mjs +1 -1
- package/dist/esm/common/virtualList/virtualList.mjs.map +1 -1
- package/dist/esm/common/virtualList/virtualListHeader.mjs +1 -1
- package/dist/esm/common/virtualList/virtualListHeader.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/types/common/actionButtons/actionButtons.types.d.ts +9 -2
- package/dist/types/common/alert/alert.types.d.ts +7 -0
- package/dist/types/common/breadcrumb/breadcrumb.types.d.ts +7 -0
- package/dist/types/common/carousel/carousel.types.d.ts +13 -0
- package/dist/types/common/chip/chip.types.d.ts +7 -1
- package/dist/types/common/colorPicker/colorPicker.d.ts +1 -1
- package/dist/types/common/colorPicker/colorPicker.types.d.ts +7 -0
- package/dist/types/common/configProvider/configProvider.types.d.ts +22 -1
- package/dist/types/common/configProvider/index.d.ts +1 -0
- package/dist/types/common/configProvider/useLabels.d.ts +22 -0
- package/dist/types/common/confirmModal/confirmModal.types.d.ts +9 -2
- package/dist/types/common/datePicker/components/datePickerMonth/datePickerMonth.d.ts +1 -13
- package/dist/types/common/datePicker/components/datePickerMonth/datePickerMonth.types.d.ts +20 -0
- package/dist/types/common/datePicker/datePicker.d.ts +1 -22
- package/dist/types/common/datePicker/datePicker.types.d.ts +51 -0
- package/dist/types/common/datePicker/index.d.ts +1 -0
- package/dist/types/common/emptyState/emptyState.d.ts +1 -1
- package/dist/types/common/emptyState/emptyState.types.d.ts +7 -0
- package/dist/types/common/input/input.types.d.ts +13 -0
- package/dist/types/common/klipyPicker/klipyPicker.d.ts +1 -1
- package/dist/types/common/klipyPicker/klipyPicker.types.d.ts +7 -0
- package/dist/types/common/modal/modal.types.d.ts +7 -0
- package/dist/types/common/multiSelect/multiSelect.types.d.ts +13 -6
- package/dist/types/common/numberInput/numberInput.types.d.ts +9 -2
- package/dist/types/common/otpInput/otpInput.types.d.ts +9 -0
- package/dist/types/common/pagination/pagination.types.d.ts +15 -0
- package/dist/types/common/roomDrawer/roomDrawer.types.d.ts +6 -0
- package/dist/types/common/splitButton/splitButton.types.d.ts +7 -0
- package/dist/types/common/timer/timer.types.d.ts +7 -0
- package/dist/types/common/toast/toast.d.ts +4 -2
- package/dist/types/common/toast/toast.types.d.ts +11 -1
- package/dist/types/common/toast/toastProvider.d.ts +1 -1
- package/dist/types/common/tree/tree.types.d.ts +7 -2
- package/dist/types/common/virtualList/virtualList.types.d.ts +15 -6
- package/dist/types/common/virtualList/virtualListHeader.d.ts +3 -3
- package/docs/ActionButtons.md +7 -6
- package/docs/Alert.md +2 -0
- package/docs/Breadcrumb.md +2 -0
- package/docs/Carousel.md +2 -0
- package/docs/Chip.md +3 -1
- package/docs/ColorPicker.md +2 -0
- package/docs/ConfigProvider.md +23 -0
- package/docs/ConfirmModal.md +7 -5
- package/docs/DatePicker.md +2 -1
- package/docs/EmptyState.md +2 -0
- package/docs/FormValidatorGroup.md +1 -1
- package/docs/Input.md +2 -0
- package/docs/KlipyPicker.md +2 -0
- package/docs/Modal.md +2 -0
- package/docs/MultiSelect.md +7 -5
- package/docs/NumberInput.md +4 -2
- package/docs/OtpInput.md +2 -0
- package/docs/Pagination.md +2 -0
- package/docs/RoomDrawer.md +2 -0
- package/docs/SplitButton.md +2 -0
- package/docs/Timer.md +2 -0
- package/docs/Toast.md +2 -0
- package/docs/Tree.md +3 -1
- package/docs/VirtualList.md +3 -2
- package/docs/Wizard.md +1 -2
- package/package.json +1 -1
|
@@ -3,11 +3,16 @@ import { ButtonStyleType } from '../button';
|
|
|
3
3
|
import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';
|
|
4
4
|
import { IconContent } from '../types/icon.types';
|
|
5
5
|
export type ActionButtonsSlots = 'root' | 'submitButton' | 'cancelButton';
|
|
6
|
+
/** Text ActionButtons renders of its own, for translating it. */
|
|
7
|
+
export interface ActionButtonsLabels {
|
|
8
|
+
/** The confirming button (default `Save`). */
|
|
9
|
+
submit?: ReactElement | number | string;
|
|
10
|
+
/** The dismissing button (default `Cancel`). */
|
|
11
|
+
cancel?: ReactElement | number | string;
|
|
12
|
+
}
|
|
6
13
|
export interface ActionButtonsProps extends HtmlProps {
|
|
7
14
|
onSubmit?: () => void;
|
|
8
15
|
onClose?: () => void;
|
|
9
|
-
submitLabel?: ReactElement | number | string;
|
|
10
|
-
cancelLabel?: ReactElement | number | string;
|
|
11
16
|
submitButtonStyle?: ButtonStyleType;
|
|
12
17
|
isSubmitButtonLoading?: boolean;
|
|
13
18
|
isSubmitButtonDisabled?: boolean;
|
|
@@ -24,4 +29,6 @@ export interface ActionButtonsProps extends HtmlProps {
|
|
|
24
29
|
style?: CSSProperties;
|
|
25
30
|
classNames?: SlotClassNames<ActionButtonsSlots>;
|
|
26
31
|
styles?: SlotStyles<ActionButtonsSlots>;
|
|
32
|
+
/** Overrides the text ActionButtons renders of its own. Merged per key. */
|
|
33
|
+
labels?: ActionButtonsLabels;
|
|
27
34
|
}
|
|
@@ -9,6 +9,11 @@ export declare enum AlertStyleType {
|
|
|
9
9
|
Error = "error"
|
|
10
10
|
}
|
|
11
11
|
export type AlertSlots = 'root' | 'icon' | 'content' | 'title' | 'description' | 'closeButton';
|
|
12
|
+
/** Text Alert renders of its own, for translating it. */
|
|
13
|
+
export interface AlertLabels {
|
|
14
|
+
/** Close button, read out by screen readers. */
|
|
15
|
+
dismiss?: string;
|
|
16
|
+
}
|
|
12
17
|
export interface AlertProps extends Omit<HtmlProps, 'title'> {
|
|
13
18
|
title?: ReactNode;
|
|
14
19
|
children?: ReactNode;
|
|
@@ -20,4 +25,6 @@ export interface AlertProps extends Omit<HtmlProps, 'title'> {
|
|
|
20
25
|
style?: CSSProperties;
|
|
21
26
|
classNames?: SlotClassNames<AlertSlots>;
|
|
22
27
|
styles?: SlotStyles<AlertSlots>;
|
|
28
|
+
/** Overrides the text Alert renders of its own. Merged per key. */
|
|
29
|
+
labels?: AlertLabels;
|
|
23
30
|
}
|
|
@@ -10,6 +10,11 @@ export interface BreadcrumbItem {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export type BreadcrumbSlots = 'root' | 'list' | 'item' | 'link' | 'icon' | 'separator' | 'current' | 'ellipsis' | 'hiddenList' | 'hiddenItem';
|
|
13
|
+
/** Text Breadcrumb renders of its own, for translating it. */
|
|
14
|
+
export interface BreadcrumbLabels {
|
|
15
|
+
/** Button that reveals the collapsed middle items, and its tooltip. */
|
|
16
|
+
showHidden?: string;
|
|
17
|
+
}
|
|
13
18
|
export interface BreadcrumbProps extends HtmlProps {
|
|
14
19
|
items: BreadcrumbItem[];
|
|
15
20
|
separator?: ReactNode;
|
|
@@ -23,4 +28,6 @@ export interface BreadcrumbProps extends HtmlProps {
|
|
|
23
28
|
style?: CSSProperties;
|
|
24
29
|
classNames?: SlotClassNames<BreadcrumbSlots>;
|
|
25
30
|
styles?: SlotStyles<BreadcrumbSlots>;
|
|
31
|
+
/** Overrides the text Breadcrumb renders of its own. Merged per key. */
|
|
32
|
+
labels?: BreadcrumbLabels;
|
|
26
33
|
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';
|
|
3
3
|
export type CarouselSlots = 'root' | 'track' | 'slide' | 'prevButton' | 'nextButton' | 'dots' | 'dot';
|
|
4
|
+
/** Text Carousel renders of its own, for translating it. */
|
|
5
|
+
export interface CarouselLabels {
|
|
6
|
+
/** Button to the previous slide, and its tooltip. */
|
|
7
|
+
previous?: string;
|
|
8
|
+
/** Button to the next slide, and its tooltip. */
|
|
9
|
+
next?: string;
|
|
10
|
+
/** The dot strip, read out by screen readers. */
|
|
11
|
+
slides?: string;
|
|
12
|
+
/** One dot, given its 1-based slide number. */
|
|
13
|
+
goToSlide?: (slide: number) => string;
|
|
14
|
+
}
|
|
4
15
|
export interface CarouselProps extends Omit<HtmlProps, 'onChange'> {
|
|
5
16
|
children?: ReactNode;
|
|
6
17
|
currentIndex?: number;
|
|
@@ -19,4 +30,6 @@ export interface CarouselProps extends Omit<HtmlProps, 'onChange'> {
|
|
|
19
30
|
style?: CSSProperties;
|
|
20
31
|
classNames?: SlotClassNames<CarouselSlots>;
|
|
21
32
|
styles?: SlotStyles<CarouselSlots>;
|
|
33
|
+
/** Overrides the text Carousel renders of its own. Merged per key. */
|
|
34
|
+
labels?: CarouselLabels;
|
|
22
35
|
}
|
|
@@ -6,6 +6,11 @@ export declare enum ChipStyleType {
|
|
|
6
6
|
Warn = "warn",
|
|
7
7
|
Error = "error"
|
|
8
8
|
}
|
|
9
|
+
/** Text Chip renders of its own, for translating it. */
|
|
10
|
+
export interface ChipLabels {
|
|
11
|
+
/** The remove button, read out by screen readers (default `Remove`). */
|
|
12
|
+
remove?: string;
|
|
13
|
+
}
|
|
9
14
|
export interface ChipProps extends HtmlProps {
|
|
10
15
|
className?: string;
|
|
11
16
|
text?: string;
|
|
@@ -13,9 +18,10 @@ export interface ChipProps extends HtmlProps {
|
|
|
13
18
|
styleType?: ChipStyleType;
|
|
14
19
|
showRemoveIcon?: boolean;
|
|
15
20
|
/** Accessible name for the remove button. Default `'Remove'`. */
|
|
16
|
-
removeLabel?: string;
|
|
17
21
|
onClick?: () => void;
|
|
18
22
|
onRemove?: () => void;
|
|
23
|
+
/** Overrides the text Chip renders of its own. Merged per key. */
|
|
24
|
+
labels?: ChipLabels;
|
|
19
25
|
}
|
|
20
26
|
export interface ChipContainerProps extends HtmlProps {
|
|
21
27
|
className?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ColorPickerProps } from './colorPicker.types';
|
|
3
|
-
declare function ColorPicker({ className, value, onChange, showInput, showAlpha, inline, ...rest }: ColorPickerProps): ReactElement;
|
|
3
|
+
declare function ColorPicker({ className, value, onChange, showInput, showAlpha, inline, labels, ...rest }: ColorPickerProps): ReactElement;
|
|
4
4
|
export default ColorPicker;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { HtmlProps } from '../types/slots.types';
|
|
2
|
+
/** Text ColorPicker renders of its own, for translating it. */
|
|
3
|
+
export interface ColorPickerLabels {
|
|
4
|
+
/** The eyedropper button, read out by screen readers. */
|
|
5
|
+
pickFromScreen?: string;
|
|
6
|
+
}
|
|
2
7
|
export interface ColorPickerProps extends Omit<HtmlProps, 'onChange'> {
|
|
3
8
|
className?: string;
|
|
4
9
|
value?: string;
|
|
@@ -6,4 +11,6 @@ export interface ColorPickerProps extends Omit<HtmlProps, 'onChange'> {
|
|
|
6
11
|
showInput?: boolean;
|
|
7
12
|
showAlpha?: boolean;
|
|
8
13
|
inline?: boolean;
|
|
14
|
+
/** Overrides the text ColorPicker renders of its own. Merged per key. */
|
|
15
|
+
labels?: ColorPickerLabels;
|
|
9
16
|
}
|
|
@@ -7,7 +7,11 @@ import { InputDropdownProps } from '../inputDropdown/inputDropdown.types';
|
|
|
7
7
|
import { CheckboxProps } from '../checkbox/checkbox.types';
|
|
8
8
|
import { SwitchProps } from '../switch/switch.types';
|
|
9
9
|
import { RadioGroupProps } from '../radioGroup/radioGroup.types';
|
|
10
|
-
import { DatePickerProps } from '../datePicker/datePicker';
|
|
10
|
+
import { DatePickerProps } from '../datePicker/datePicker.types';
|
|
11
|
+
import { ColorPickerLabels } from '../colorPicker/colorPicker.types';
|
|
12
|
+
import { EmptyStateLabels } from '../emptyState/emptyState.types';
|
|
13
|
+
import { KlipyPickerLabels } from '../klipyPicker/klipyPicker.types';
|
|
14
|
+
import { VirtualListLabels } from '../virtualList/virtualList.types';
|
|
11
15
|
import { ButtonProps } from '../button/button.types';
|
|
12
16
|
import { ActionButtonsProps } from '../actionButtons/actionButtons.types';
|
|
13
17
|
import { ConfirmModalProps } from '../confirmModal/confirmModal.types';
|
|
@@ -52,6 +56,23 @@ import { ModalProps } from '../modal/modal.types';
|
|
|
52
56
|
* own component-keyed defaults take precedence for props they handle themselves.
|
|
53
57
|
*/
|
|
54
58
|
export interface ComponentDefaults {
|
|
59
|
+
/**
|
|
60
|
+
* Labels only. These components take no other global defaults: `ColorPicker`
|
|
61
|
+
* and `Toast` are configured elsewhere, and `VirtualList`'s props are generic,
|
|
62
|
+
* which a per-key default map can't express.
|
|
63
|
+
*/
|
|
64
|
+
ColorPicker?: {
|
|
65
|
+
labels?: ColorPickerLabels;
|
|
66
|
+
};
|
|
67
|
+
EmptyState?: {
|
|
68
|
+
labels?: EmptyStateLabels;
|
|
69
|
+
};
|
|
70
|
+
KlipyPicker?: {
|
|
71
|
+
labels?: KlipyPickerLabels;
|
|
72
|
+
};
|
|
73
|
+
VirtualList?: {
|
|
74
|
+
labels?: VirtualListLabels;
|
|
75
|
+
};
|
|
55
76
|
Input?: Partial<InputProps>;
|
|
56
77
|
Textarea?: Partial<TextareaProps>;
|
|
57
78
|
NumberInput?: Partial<NumberInputProps>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default } from './configProvider';
|
|
2
2
|
export { useComponentDefaults } from './useComponentDefaults';
|
|
3
|
+
export { useLabels } from './useLabels';
|
|
3
4
|
export { usePresentationDefault } from './usePresentationDefault';
|
|
4
5
|
export type { ComponentDefaults, ConfigProviderProps } from './configProvider.types';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentDefaults } from './configProvider.types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the text a component renders of its own, per key, from three places:
|
|
4
|
+
* the component's built-in English, the nearest `ConfigProvider`, and the
|
|
5
|
+
* instance's `labels` prop, in that order of increasing precedence.
|
|
6
|
+
*
|
|
7
|
+
* Per key is the point, and the reason this exists next to `useComponentDefaults`
|
|
8
|
+
* rather than relying on it. That one fills in whole props: a `labels` object on
|
|
9
|
+
* an instance would replace the provider's entirely, so translating an app once
|
|
10
|
+
* and overriding a single string on one instance would silently drop every other
|
|
11
|
+
* translation for that component.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const DEFAULT_LABELS: Required<ModalLabels> = { close: 'Close' };
|
|
15
|
+
*
|
|
16
|
+
* function Modal({ labels, ...rest }: ModalProps) {
|
|
17
|
+
* const text = useLabels('Modal', labels, DEFAULT_LABELS);
|
|
18
|
+
* // text.close
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useLabels<L extends object>(component: keyof ComponentDefaults, labels: Partial<L> | undefined, defaults: L): L;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ActionButtonsProps } from '../actionButtons';
|
|
3
|
+
/** Text ConfirmModal renders of its own, for translating it. */
|
|
4
|
+
export interface ConfirmModalLabels {
|
|
5
|
+
/** The confirming button (default `Confirm`). */
|
|
6
|
+
submit?: string;
|
|
7
|
+
/** The dismissing button (default `Cancel`). */
|
|
8
|
+
cancel?: string;
|
|
9
|
+
}
|
|
3
10
|
export interface ConfirmModalProps {
|
|
4
11
|
children?: ReactNode;
|
|
5
12
|
className?: string;
|
|
@@ -8,8 +15,8 @@ export interface ConfirmModalProps {
|
|
|
8
15
|
title?: string;
|
|
9
16
|
content?: ReactNode;
|
|
10
17
|
isOpen?: boolean;
|
|
11
|
-
submitLabel?: string;
|
|
12
|
-
cancelLabel?: string;
|
|
13
18
|
isDelete?: boolean;
|
|
14
19
|
actionButtonsProps?: ActionButtonsProps;
|
|
20
|
+
/** Overrides the text ConfirmModal renders of its own. Merged per key. */
|
|
21
|
+
labels?: ConfirmModalLabels;
|
|
15
22
|
}
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
className?: string;
|
|
3
|
-
month?: number;
|
|
4
|
-
year?: number;
|
|
5
|
-
onSelect?: (date: Date) => void;
|
|
6
|
-
selectionStart?: Date;
|
|
7
|
-
selectionEnd?: Date;
|
|
8
|
-
minDate?: Date | null;
|
|
9
|
-
maxDate?: Date | null;
|
|
10
|
-
/** Called to shift the displayed month by ±1 when arrow navigation runs past its edge. */
|
|
11
|
-
onNavigateMonth?: (delta: 1 | -1) => void;
|
|
12
|
-
}
|
|
1
|
+
import { DatePickerMonthProps } from './datePickerMonth.types';
|
|
13
2
|
export default function DatePickerMonth({ className, month, year, onSelect, selectionStart, selectionEnd, minDate, maxDate, onNavigateMonth, }: DatePickerMonthProps): import("react").JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface DatePickerMonthProps {
|
|
2
|
+
/** Class on the root element. */
|
|
3
|
+
className?: string;
|
|
4
|
+
/** Month to display, 1 to 12. */
|
|
5
|
+
month?: number;
|
|
6
|
+
/** Year to display. */
|
|
7
|
+
year?: number;
|
|
8
|
+
/** Called with the day that was picked. */
|
|
9
|
+
onSelect?: (date: Date) => void;
|
|
10
|
+
/** First day of the highlighted range, and the day that starts with the tab stop. */
|
|
11
|
+
selectionStart?: Date;
|
|
12
|
+
/** Last day of the highlighted range. */
|
|
13
|
+
selectionEnd?: Date;
|
|
14
|
+
/** Days before this are not selectable. */
|
|
15
|
+
minDate?: Date | null;
|
|
16
|
+
/** Days after this are not selectable. */
|
|
17
|
+
maxDate?: Date | null;
|
|
18
|
+
/** Called to shift the displayed month by ±1 when arrow navigation runs past its edge. */
|
|
19
|
+
onNavigateMonth?: (delta: 1 | -1) => void;
|
|
20
|
+
}
|
|
@@ -1,24 +1,3 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface DatePickerProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
selected?: Date;
|
|
6
|
-
onSelect?: (date: Date | null) => void;
|
|
7
|
-
formValidator?: FormValidator | null;
|
|
8
|
-
noInput?: boolean;
|
|
9
|
-
noHeader?: boolean;
|
|
10
|
-
isModal?: boolean;
|
|
11
|
-
isInline?: boolean;
|
|
12
|
-
onChange?: (date: Date | null) => void;
|
|
13
|
-
minDate?: Date | null;
|
|
14
|
-
maxDate?: Date | null;
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
showClearButton?: boolean;
|
|
17
|
-
label?: string;
|
|
18
|
-
isValid?: boolean;
|
|
19
|
-
errorMessage?: string;
|
|
20
|
-
isRequired?: boolean;
|
|
21
|
-
startDate?: Date;
|
|
22
|
-
endDate?: Date;
|
|
23
|
-
}
|
|
2
|
+
import { DatePickerProps } from './datePicker.types';
|
|
24
3
|
export default function DatePicker(props: DatePickerProps): React.JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FormValidator } from '../../services/formValidation';
|
|
3
|
+
export interface DatePickerProps {
|
|
4
|
+
/** Class on the root element. */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Selected date, controlled. Ignored while a `formValidator` owns the value. */
|
|
7
|
+
selected?: Date;
|
|
8
|
+
/** Floating label on the input. */
|
|
9
|
+
label?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Called when a day is picked in the calendar, after `onChange`. Picking also
|
|
12
|
+
* closes the picker.
|
|
13
|
+
*/
|
|
14
|
+
onSelect?: (date: Date | null) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Called whenever the value changes, whether picked in the calendar or typed
|
|
17
|
+
* into the input. `null` when the field was cleared or holds no valid date.
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (date: Date | null) => void;
|
|
20
|
+
/** Hands the value to a validator, which then owns it. See docs/FormValidator.md. */
|
|
21
|
+
formValidator?: FormValidator | null;
|
|
22
|
+
/** Earliest selectable date. Also bounds the year dropdown. */
|
|
23
|
+
minDate?: Date | null;
|
|
24
|
+
/** Latest selectable date. Also bounds the year dropdown. */
|
|
25
|
+
maxDate?: Date | null;
|
|
26
|
+
/**
|
|
27
|
+
* Start of a highlighted range. Defaults to the selected date, so two pickers
|
|
28
|
+
* sharing a start and an end highlight the span between them.
|
|
29
|
+
*/
|
|
30
|
+
startDate?: Date;
|
|
31
|
+
/** End of the highlighted range. */
|
|
32
|
+
endDate?: Date;
|
|
33
|
+
/** Render the calendar in place instead of in a popover. */
|
|
34
|
+
isInline?: boolean;
|
|
35
|
+
/** Open the calendar in a modal, with the input read-only. */
|
|
36
|
+
isModal?: boolean;
|
|
37
|
+
/** Drop the text input and show the calendar alone. */
|
|
38
|
+
noInput?: boolean;
|
|
39
|
+
/** Drop the month and year navigation above the calendar. */
|
|
40
|
+
noHeader?: boolean;
|
|
41
|
+
/** Show a button that clears the value. */
|
|
42
|
+
showClearButton?: boolean;
|
|
43
|
+
/** Rendered under the calendar, inside the popover or modal. */
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
/** Marks the field invalid. A `formValidator` decides this for itself. */
|
|
46
|
+
isValid?: boolean;
|
|
47
|
+
/** Message for the error tooltip, shown while the field is focused or hovered. */
|
|
48
|
+
errorMessage?: string;
|
|
49
|
+
/** Appends ` *` to the label. Implied by a `required` validator on `formValidator`. */
|
|
50
|
+
isRequired?: boolean;
|
|
51
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { EmptyStateProps } from './emptyState.types';
|
|
3
|
-
export default function EmptyState({ className, icon, children, ...rest }: EmptyStateProps): ReactElement;
|
|
3
|
+
export default function EmptyState({ className, icon, children, labels, ...rest }: EmptyStateProps): ReactElement;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { IconContent } from '../types/icon.types';
|
|
3
3
|
import { HtmlProps } from '../types/slots.types';
|
|
4
|
+
/** Text EmptyState renders of its own, for translating it. */
|
|
5
|
+
export interface EmptyStateLabels {
|
|
6
|
+
/** Shown when no `children` are given. */
|
|
7
|
+
empty?: string;
|
|
8
|
+
}
|
|
4
9
|
export interface EmptyStateProps extends HtmlProps {
|
|
5
10
|
className?: string;
|
|
6
11
|
icon?: IconContent;
|
|
7
12
|
children?: ReactNode;
|
|
13
|
+
/** Overrides the text EmptyState renders of its own. Merged per key. */
|
|
14
|
+
labels?: EmptyStateLabels;
|
|
8
15
|
}
|
|
@@ -17,6 +17,17 @@ export declare enum InputIconPosition {
|
|
|
17
17
|
}
|
|
18
18
|
export type InputSlots = 'label' | 'container' | 'input' | 'suffix' | 'upperRightLabel' | 'fieldset';
|
|
19
19
|
type OverriddenInputAttributes = 'onChange' | 'onFocus' | 'onBlur' | 'onMouseEnter' | 'onMouseLeave' | 'onClick' | 'type' | 'value' | 'min' | 'max' | 'autoComplete';
|
|
20
|
+
/** Text Input renders of its own, for translating it. */
|
|
21
|
+
export interface InputLabels {
|
|
22
|
+
/** Clear button on a search input, read out by screen readers. */
|
|
23
|
+
clear?: string;
|
|
24
|
+
/** Reveals a password, read out by screen readers. */
|
|
25
|
+
showPassword?: string;
|
|
26
|
+
/** Hides a password again. */
|
|
27
|
+
hidePassword?: string;
|
|
28
|
+
/** Clears a search input, read out by screen readers. */
|
|
29
|
+
clearSearch?: string;
|
|
30
|
+
}
|
|
20
31
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, OverriddenInputAttributes>, DataProps {
|
|
21
32
|
onMouseEnter?: ((event: React.MouseEvent) => void) | null;
|
|
22
33
|
onMouseLeave?: ((event: React.MouseEvent) => void) | null;
|
|
@@ -62,5 +73,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
62
73
|
autoResize?: boolean;
|
|
63
74
|
classNames?: SlotClassNames<InputSlots>;
|
|
64
75
|
styles?: SlotStyles<InputSlots>;
|
|
76
|
+
/** Overrides the text Input renders of its own. Merged per key. */
|
|
77
|
+
labels?: InputLabels;
|
|
65
78
|
}
|
|
66
79
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { KlipyPickerProps } from './klipyPicker.types';
|
|
3
|
-
export default function KlipyPicker({ className, token, isModal, onSelect, selected, }: KlipyPickerProps): ReactElement;
|
|
3
|
+
export default function KlipyPicker({ className, token, isModal, onSelect, selected, labels, }: KlipyPickerProps): ReactElement;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { KlipyResult } from '../../services/klipy';
|
|
2
|
+
/** Text KlipyPicker renders of its own, for translating it. */
|
|
3
|
+
export interface KlipyPickerLabels {
|
|
4
|
+
/** Floating label on the search field. */
|
|
5
|
+
search?: string;
|
|
6
|
+
}
|
|
2
7
|
export interface KlipyPickerProps {
|
|
3
8
|
className?: string;
|
|
4
9
|
token?: string;
|
|
5
10
|
isModal?: boolean;
|
|
6
11
|
onSelect?: (preview: KlipyResult | null) => void | Promise<void>;
|
|
7
12
|
selected?: string | null;
|
|
13
|
+
/** Overrides the text KlipyPicker renders of its own. Merged per key. */
|
|
14
|
+
labels?: KlipyPickerLabels;
|
|
8
15
|
}
|
|
@@ -2,6 +2,11 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';
|
|
3
3
|
import { Presentation } from '../floatingMenu/floatingMenu.types';
|
|
4
4
|
export type ModalSlots = 'container' | 'backdrop' | 'modal' | 'header' | 'title' | 'closeButton' | 'body';
|
|
5
|
+
/** Text Modal renders of its own, for translating it. */
|
|
6
|
+
export interface ModalLabels {
|
|
7
|
+
/** Close button, read out by screen readers. */
|
|
8
|
+
close?: string;
|
|
9
|
+
}
|
|
5
10
|
export interface ModalProps extends HtmlProps<HTMLDivElement> {
|
|
6
11
|
children?: React.ReactNode;
|
|
7
12
|
title?: string;
|
|
@@ -18,4 +23,6 @@ export interface ModalProps extends HtmlProps<HTMLDivElement> {
|
|
|
18
23
|
presentation?: Presentation;
|
|
19
24
|
classNames?: SlotClassNames<ModalSlots>;
|
|
20
25
|
styles?: SlotStyles<ModalSlots>;
|
|
26
|
+
/** Overrides the text Modal renders of its own. Merged per key. */
|
|
27
|
+
labels?: ModalLabels;
|
|
21
28
|
}
|
|
@@ -11,6 +11,17 @@ export interface MultiSelectItem {
|
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
}
|
|
13
13
|
export type MultiSelectSlots = 'root' | 'label' | 'fieldset' | 'control' | 'values' | 'chip' | 'placeholder' | 'clearButton' | 'icon' | 'panel' | 'search' | 'options' | 'option' | 'optionCheck' | 'optionLabel' | 'empty';
|
|
14
|
+
/** Text MultiSelect renders of its own, for translating it. */
|
|
15
|
+
export interface MultiSelectLabels {
|
|
16
|
+
/** Button that empties the selection, read out by screen readers. */
|
|
17
|
+
clearSelection?: string;
|
|
18
|
+
/** Entry that creates a value from what was typed (default `Add "<value>"`). */
|
|
19
|
+
create?: (value: string) => string;
|
|
20
|
+
/** Placeholder in the search field (default `Search…`). */
|
|
21
|
+
searchPlaceholder?: string;
|
|
22
|
+
/** Shown when nothing matches the search (default `No matches`). */
|
|
23
|
+
empty?: string;
|
|
24
|
+
}
|
|
14
25
|
export interface MultiSelectProps extends Omit<HtmlProps<HTMLDivElement>, 'onChange' | 'value' | 'defaultValue'> {
|
|
15
26
|
/** The selectable options. */
|
|
16
27
|
items: MultiSelectItem[];
|
|
@@ -34,12 +45,6 @@ export interface MultiSelectProps extends Omit<HtmlProps<HTMLDivElement>, 'onCha
|
|
|
34
45
|
* value becomes its own key, so `onChange` reports it as a plain string.
|
|
35
46
|
*/
|
|
36
47
|
allowCustomValues?: boolean;
|
|
37
|
-
/** Label for the row that adds a typed value (default `Add "…"`). */
|
|
38
|
-
createLabel?: (value: string) => string;
|
|
39
|
-
/** Placeholder for the search box (default `'Search…'`). */
|
|
40
|
-
searchPlaceholder?: string;
|
|
41
|
-
/** Text shown in the panel when no option matches (default `'No matches'`). */
|
|
42
|
-
emptyLabel?: string;
|
|
43
48
|
/** Cap the number of selections. Unselected options disable once the cap is reached. */
|
|
44
49
|
maxSelected?: number;
|
|
45
50
|
/** Show a button that clears the whole selection (default `true`). */
|
|
@@ -59,4 +64,6 @@ export interface MultiSelectProps extends Omit<HtmlProps<HTMLDivElement>, 'onCha
|
|
|
59
64
|
style?: CSSProperties;
|
|
60
65
|
classNames?: SlotClassNames<MultiSelectSlots>;
|
|
61
66
|
styles?: SlotStyles<MultiSelectSlots>;
|
|
67
|
+
/** Overrides the text MultiSelect renders of its own. Merged per key. */
|
|
68
|
+
labels?: MultiSelectLabels;
|
|
62
69
|
}
|
|
@@ -10,6 +10,13 @@ import { FormValidator } from '../../services/formValidation';
|
|
|
10
10
|
* - `auto` — `split` on a coarse (touch) pointer, `stacked` otherwise.
|
|
11
11
|
*/
|
|
12
12
|
export type NumberInputArrowsLayout = 'auto' | 'stacked' | 'split';
|
|
13
|
+
/** Text NumberInput renders of its own, for translating it. */
|
|
14
|
+
export interface NumberInputLabels {
|
|
15
|
+
/** The step-up button, read out by screen readers (default `Increase`). */
|
|
16
|
+
increase?: string;
|
|
17
|
+
/** The step-down button, read out by screen readers (default `Decrease`). */
|
|
18
|
+
decrease?: string;
|
|
19
|
+
}
|
|
13
20
|
export interface NumberInputProps extends Omit<NumericFormatProps, 'onValueChange' | 'value' | 'customInput' | 'onChange' | 'step' | 'onKeyDown' | 'min' | 'max'> {
|
|
14
21
|
value?: number | string;
|
|
15
22
|
onChange?: (value: number | undefined) => void;
|
|
@@ -52,10 +59,10 @@ export interface NumberInputProps extends Omit<NumericFormatProps, 'onValueChang
|
|
|
52
59
|
/** Stepper layout. Default `'auto'`. */
|
|
53
60
|
arrowsLayout?: NumberInputArrowsLayout;
|
|
54
61
|
/** Accessible name for the increase button. Default `'Increase'`. */
|
|
55
|
-
increaseLabel?: string;
|
|
56
62
|
/** Accessible name for the decrease button. Default `'Decrease'`. */
|
|
57
|
-
decreaseLabel?: string;
|
|
58
63
|
readOnly?: boolean;
|
|
59
64
|
isRequired?: boolean;
|
|
60
65
|
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
66
|
+
/** Overrides the text NumberInput renders of its own. Merged per key. */
|
|
67
|
+
labels?: NumberInputLabels;
|
|
61
68
|
}
|
|
@@ -8,6 +8,13 @@ export declare enum OtpInputCharset {
|
|
|
8
8
|
/** Letters and digits. */
|
|
9
9
|
Alphanumeric = "alphanumeric"
|
|
10
10
|
}
|
|
11
|
+
/** Text OtpInput renders of its own, for translating it. */
|
|
12
|
+
export interface OtpInputLabels {
|
|
13
|
+
/** The group of boxes, used when no `label` is given. */
|
|
14
|
+
field?: string;
|
|
15
|
+
/** One box, given its 1-based position and how many there are. */
|
|
16
|
+
digit?: (position: number, length: number) => string;
|
|
17
|
+
}
|
|
11
18
|
export interface OtpInputProps extends Omit<HtmlProps, 'onChange'> {
|
|
12
19
|
/** Number of character boxes. Default 6. */
|
|
13
20
|
length?: number;
|
|
@@ -46,4 +53,6 @@ export interface OtpInputProps extends Omit<HtmlProps, 'onChange'> {
|
|
|
46
53
|
style?: React.CSSProperties;
|
|
47
54
|
classNames?: SlotClassNames<OtpInputSlots>;
|
|
48
55
|
styles?: SlotStyles<OtpInputSlots>;
|
|
56
|
+
/** Overrides the text OtpInput renders of its own. Merged per key. */
|
|
57
|
+
labels?: OtpInputLabels;
|
|
49
58
|
}
|
|
@@ -2,6 +2,19 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
import { IconContent } from '../types/icon.types';
|
|
3
3
|
import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';
|
|
4
4
|
export type PaginationSlots = 'root' | 'item' | 'control' | 'ellipsis';
|
|
5
|
+
/** Text Pagination renders of its own, for translating it. */
|
|
6
|
+
export interface PaginationLabels {
|
|
7
|
+
/** One page button, given its number. */
|
|
8
|
+
goToPage?: (page: number) => string;
|
|
9
|
+
/** Jump to the first page. */
|
|
10
|
+
first?: string;
|
|
11
|
+
/** Step back one page. */
|
|
12
|
+
previous?: string;
|
|
13
|
+
/** Step forward one page. */
|
|
14
|
+
next?: string;
|
|
15
|
+
/** Jump to the last page. */
|
|
16
|
+
last?: string;
|
|
17
|
+
}
|
|
5
18
|
export interface PaginationProps extends Omit<HtmlProps<HTMLElement>, 'onChange'> {
|
|
6
19
|
/** Total number of pages. Nothing renders below `1`. */
|
|
7
20
|
total: number;
|
|
@@ -27,4 +40,6 @@ export interface PaginationProps extends Omit<HtmlProps<HTMLElement>, 'onChange'
|
|
|
27
40
|
style?: CSSProperties;
|
|
28
41
|
classNames?: SlotClassNames<PaginationSlots>;
|
|
29
42
|
styles?: SlotStyles<PaginationSlots>;
|
|
43
|
+
/** Overrides the text Pagination renders of its own. Merged per key. */
|
|
44
|
+
labels?: PaginationLabels;
|
|
30
45
|
}
|
|
@@ -29,6 +29,12 @@ export interface RoomDrawerChangeMeta {
|
|
|
29
29
|
}
|
|
30
30
|
/** Every string the drawer's own chrome renders, for localisation. */
|
|
31
31
|
export interface RoomDrawerLabels {
|
|
32
|
+
/** The toolbar, read out by screen readers. */
|
|
33
|
+
tools?: string;
|
|
34
|
+
/** Tooltip on the storey height field. */
|
|
35
|
+
storeyHeightHint?: string;
|
|
36
|
+
/** Tooltip on an opening's sill height field. */
|
|
37
|
+
sillHeightHint?: string;
|
|
32
38
|
select?: string;
|
|
33
39
|
wall?: string;
|
|
34
40
|
rect?: string;
|
|
@@ -11,6 +11,11 @@ export interface SplitButtonAction {
|
|
|
11
11
|
icon?: IconContent;
|
|
12
12
|
}
|
|
13
13
|
export type SplitButtonSlots = 'root' | 'primaryButton' | 'triggerButton' | 'menu' | 'menuItem';
|
|
14
|
+
/** Text SplitButton renders of its own, for translating it. */
|
|
15
|
+
export interface SplitButtonLabels {
|
|
16
|
+
/** The button opening the menu, read out by screen readers. */
|
|
17
|
+
moreActions?: string;
|
|
18
|
+
}
|
|
14
19
|
export interface SplitButtonProps extends HtmlProps {
|
|
15
20
|
children?: ReactNode;
|
|
16
21
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => Promise<void> | void;
|
|
@@ -25,4 +30,6 @@ export interface SplitButtonProps extends HtmlProps {
|
|
|
25
30
|
style?: CSSProperties;
|
|
26
31
|
classNames?: SlotClassNames<SplitButtonSlots>;
|
|
27
32
|
styles?: SlotStyles<SplitButtonSlots>;
|
|
33
|
+
/** Overrides the text SplitButton renders of its own. Merged per key. */
|
|
34
|
+
labels?: SplitButtonLabels;
|
|
28
35
|
}
|
|
@@ -22,6 +22,11 @@ export interface TimerHandle {
|
|
|
22
22
|
/** Current remaining time in ms, read synchronously. */
|
|
23
23
|
getRemainingMs: () => number;
|
|
24
24
|
}
|
|
25
|
+
/** Text Timer renders of its own, for translating it. */
|
|
26
|
+
export interface TimerLabels {
|
|
27
|
+
/** Tooltip on the cancel button. */
|
|
28
|
+
cancel?: string;
|
|
29
|
+
}
|
|
25
30
|
export interface TimerProps extends HtmlProps {
|
|
26
31
|
/** Starting duration in seconds. Changing this prop while mounted resets the timer to the new duration. */
|
|
27
32
|
durationSeconds: number;
|
|
@@ -98,4 +103,6 @@ export interface TimerProps extends HtmlProps {
|
|
|
98
103
|
style?: CSSProperties;
|
|
99
104
|
classNames?: SlotClassNames<TimerSlots>;
|
|
100
105
|
styles?: SlotStyles<TimerSlots>;
|
|
106
|
+
/** Overrides the text Timer renders of its own. Merged per key. */
|
|
107
|
+
labels?: TimerLabels;
|
|
101
108
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { ToastItem } from './toast.types';
|
|
2
|
+
import { ToastItem, ToastLabels } from './toast.types';
|
|
3
3
|
interface ToastProps {
|
|
4
4
|
item: ToastItem;
|
|
5
5
|
isBottom: boolean;
|
|
6
6
|
onDismiss: (id: string) => void;
|
|
7
|
+
/** Already resolved by the provider: defaults, provider, then this toast's own. */
|
|
8
|
+
labels: Required<ToastLabels>;
|
|
7
9
|
}
|
|
8
|
-
declare function Toast({ item, isBottom, onDismiss }: ToastProps): React.JSX.Element;
|
|
10
|
+
declare function Toast({ item, isBottom, onDismiss, labels }: ToastProps): React.JSX.Element;
|
|
9
11
|
export default Toast;
|