@ahrowe/ui 0.31.0 → 0.33.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/card/Card.mjs +1 -1
- package/dist/esm/common/card/Card.mjs.map +1 -1
- package/dist/esm/common/card/card.types.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 +1 -1
- package/dist/esm/common/datePicker/components/datePickerMonth/datePickerMonth.mjs.map +1 -1
- package/dist/esm/common/datePicker/datePicker.mjs +1 -1
- package/dist/esm/common/datePicker/datePicker.mjs.map +1 -1
- package/dist/esm/common/drawer/drawer.mjs +1 -1
- package/dist/esm/common/drawer/drawer.mjs.map +1 -1
- package/dist/esm/common/dropdown/dropdown.mjs +1 -1
- package/dist/esm/common/dropdown/dropdown.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/fab/components/fabBase/fabBase.mjs +1 -1
- package/dist/esm/common/fab/components/fabBase/fabBase.mjs.map +1 -1
- package/dist/esm/common/fab/fab.mjs +1 -1
- package/dist/esm/common/fab/fab.mjs.map +1 -1
- package/dist/esm/common/infiniteBlock/infiniteBlock.mjs +1 -1
- package/dist/esm/common/infiniteBlock/infiniteBlock.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/progressBar/progressBar.mjs +1 -1
- package/dist/esm/common/progressBar/progressBar.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/searchInput/searchInput.mjs +1 -1
- package/dist/esm/common/searchInput/searchInput.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/card/card.types.d.ts +6 -1
- package/dist/types/common/carousel/carousel.types.d.ts +13 -0
- package/dist/types/common/chip/chip.types.d.ts +13 -2
- package/dist/types/common/colorPicker/colorPicker.d.ts +1 -1
- package/dist/types/common/colorPicker/colorPicker.types.d.ts +13 -1
- package/dist/types/common/configProvider/configProvider.types.d.ts +26 -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 +13 -4
- package/dist/types/common/datePicker/components/datePickerMonth/datePickerMonth.d.ts +2 -14
- package/dist/types/common/datePicker/components/datePickerMonth/datePickerMonth.types.d.ts +23 -0
- package/dist/types/common/datePicker/datePicker.d.ts +1 -22
- package/dist/types/common/datePicker/datePicker.types.d.ts +60 -0
- package/dist/types/common/datePicker/index.d.ts +1 -0
- package/dist/types/common/drawer/drawer.d.ts +1 -1
- package/dist/types/common/drawer/drawer.types.d.ts +7 -1
- package/dist/types/common/dropdown/dropdown.types.d.ts +6 -6
- package/dist/types/common/emptyState/emptyState.d.ts +1 -1
- package/dist/types/common/emptyState/emptyState.types.d.ts +13 -1
- package/dist/types/common/fab/components/fabBase/fabBase.d.ts +1 -1
- package/dist/types/common/fab/components/fabBase/fabBase.types.d.ts +3 -1
- package/dist/types/common/fab/fab.d.ts +1 -1
- package/dist/types/common/fab/fab.types.d.ts +6 -1
- package/dist/types/common/infiniteBlock/infiniteBlock.d.ts +1 -1
- package/dist/types/common/infiniteBlock/infiniteBlock.types.d.ts +2 -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 +15 -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/progressBar/progressBar.d.ts +1 -1
- package/dist/types/common/progressBar/progressBar.types.d.ts +6 -1
- package/dist/types/common/roomDrawer/roomDrawer.types.d.ts +6 -0
- package/dist/types/common/searchInput/searchInput.d.ts +1 -1
- package/dist/types/common/searchInput/searchInput.types.d.ts +13 -1
- 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/Card.md +2 -0
- package/docs/Carousel.md +2 -0
- package/docs/Chip.md +5 -1
- package/docs/ColorPicker.md +4 -0
- package/docs/ConfigProvider.md +23 -0
- package/docs/ConfirmModal.md +7 -5
- package/docs/DatePicker.md +6 -1
- package/docs/Drawer.md +2 -0
- package/docs/Dropdown.md +2 -0
- package/docs/EmptyState.md +4 -0
- package/docs/Fab.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 +8 -2
- package/docs/OtpInput.md +2 -0
- package/docs/Pagination.md +2 -0
- package/docs/ProgressBar.md +2 -0
- package/docs/RoomDrawer.md +2 -0
- package/docs/SearchInput.md +4 -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
|
@@ -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
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { NumericFormatProps } from 'react-number-format';
|
|
3
3
|
import { FormValidator } from '../../services/formValidation';
|
|
4
|
+
import { SlotClassNames, SlotStyles } from '../types/slots.types';
|
|
4
5
|
/**
|
|
5
6
|
* How the stepper buttons are laid out.
|
|
6
7
|
*
|
|
@@ -10,6 +11,14 @@ import { FormValidator } from '../../services/formValidation';
|
|
|
10
11
|
* - `auto` — `split` on a coarse (touch) pointer, `stacked` otherwise.
|
|
11
12
|
*/
|
|
12
13
|
export type NumberInputArrowsLayout = 'auto' | 'stacked' | 'split';
|
|
14
|
+
/** Text NumberInput renders of its own, for translating it. */
|
|
15
|
+
export interface NumberInputLabels {
|
|
16
|
+
/** The step-up button, read out by screen readers (default `Increase`). */
|
|
17
|
+
increase?: string;
|
|
18
|
+
/** The step-down button, read out by screen readers (default `Decrease`). */
|
|
19
|
+
decrease?: string;
|
|
20
|
+
}
|
|
21
|
+
export type NumberInputSlots = 'root' | 'input' | 'arrows' | 'increaseButton' | 'decreaseButton';
|
|
13
22
|
export interface NumberInputProps extends Omit<NumericFormatProps, 'onValueChange' | 'value' | 'customInput' | 'onChange' | 'step' | 'onKeyDown' | 'min' | 'max'> {
|
|
14
23
|
value?: number | string;
|
|
15
24
|
onChange?: (value: number | undefined) => void;
|
|
@@ -52,10 +61,14 @@ export interface NumberInputProps extends Omit<NumericFormatProps, 'onValueChang
|
|
|
52
61
|
/** Stepper layout. Default `'auto'`. */
|
|
53
62
|
arrowsLayout?: NumberInputArrowsLayout;
|
|
54
63
|
/** Accessible name for the increase button. Default `'Increase'`. */
|
|
55
|
-
increaseLabel?: string;
|
|
56
64
|
/** Accessible name for the decrease button. Default `'Decrease'`. */
|
|
57
|
-
decreaseLabel?: string;
|
|
58
65
|
readOnly?: boolean;
|
|
59
66
|
isRequired?: boolean;
|
|
60
67
|
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
68
|
+
/** Overrides the text NumberInput renders of its own. Merged per key. */
|
|
69
|
+
labels?: NumberInputLabels;
|
|
70
|
+
/** Classes for the inner elements. See `NumberInputSlots`. */
|
|
71
|
+
classNames?: SlotClassNames<NumberInputSlots>;
|
|
72
|
+
/** Inline styles for the inner elements. See `NumberInputSlots`. */
|
|
73
|
+
styles?: SlotStyles<NumberInputSlots>;
|
|
61
74
|
}
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ProgressBarProps } from './progressBar.types';
|
|
3
3
|
export declare function getContrastColor(hexColor: string): string;
|
|
4
|
-
declare function ProgressBar({ className, total, progress, style, ...rest }: ProgressBarProps): ReactElement;
|
|
4
|
+
declare function ProgressBar({ className, total, progress, style, classNames, styles: slotStyles, ...rest }: ProgressBarProps): ReactElement;
|
|
5
5
|
export default ProgressBar;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import { HtmlProps } from '../types/slots.types';
|
|
1
|
+
import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';
|
|
2
2
|
export interface Progress {
|
|
3
3
|
amount: number;
|
|
4
4
|
label?: string;
|
|
5
5
|
color?: string;
|
|
6
6
|
class?: string;
|
|
7
7
|
}
|
|
8
|
+
export type ProgressBarSlots = 'root' | 'fill' | 'label';
|
|
8
9
|
export interface ProgressBarProps extends HtmlProps {
|
|
9
10
|
className?: string | undefined;
|
|
10
11
|
total?: number;
|
|
11
12
|
progress?: number | Progress | Progress[];
|
|
12
13
|
style?: React.CSSProperties | undefined;
|
|
14
|
+
/** Classes for the inner elements. See `ProgressBarSlots`. */
|
|
15
|
+
classNames?: SlotClassNames<ProgressBarSlots>;
|
|
16
|
+
/** Inline styles for the inner elements. See `ProgressBarSlots`. */
|
|
17
|
+
styles?: SlotStyles<ProgressBarSlots>;
|
|
13
18
|
}
|
|
@@ -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;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { SearchInputProps } from './searchInput.types';
|
|
3
|
-
export default function SearchInput({ value, onChange, onDebounce, placeholder, label, debounceMs, totalAmount, showAmount, className, width, ...rest }: SearchInputProps): ReactElement;
|
|
3
|
+
export default function SearchInput({ value, onChange, onDebounce, placeholder, label, debounceMs, totalAmount, showAmount, className, width, style, classNames, styles: slotStyles, labels, ...rest }: SearchInputProps): ReactElement;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { HtmlProps } from '../types/slots.types';
|
|
1
|
+
import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';
|
|
2
|
+
export type SearchInputSlots = 'root' | 'input' | 'resultCount';
|
|
3
|
+
/** Text SearchInput renders of its own, for translating it. */
|
|
4
|
+
export interface SearchInputLabels {
|
|
5
|
+
/** The result count, given the number (default `12 results`). */
|
|
6
|
+
results?: (count: number) => string;
|
|
7
|
+
}
|
|
2
8
|
export interface SearchInputProps extends Omit<HtmlProps, 'onChange'> {
|
|
3
9
|
value: string;
|
|
4
10
|
onChange: (value: string) => void;
|
|
@@ -10,4 +16,10 @@ export interface SearchInputProps extends Omit<HtmlProps, 'onChange'> {
|
|
|
10
16
|
showAmount?: boolean;
|
|
11
17
|
className?: string;
|
|
12
18
|
width?: number | string;
|
|
19
|
+
/** Classes for the inner elements. See `SearchInputSlots`. */
|
|
20
|
+
classNames?: SlotClassNames<SearchInputSlots>;
|
|
21
|
+
/** Inline styles for the inner elements. See `SearchInputSlots`. */
|
|
22
|
+
styles?: SlotStyles<SearchInputSlots>;
|
|
23
|
+
/** Overrides the text SearchInput renders of its own. Merged per key. */
|
|
24
|
+
labels?: SearchInputLabels;
|
|
13
25
|
}
|
|
@@ -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;
|
|
@@ -3,6 +3,11 @@ import { SlotClassNames, SlotStyles } from '../types/slots.types';
|
|
|
3
3
|
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
4
4
|
export type ToastType = 'default' | 'info' | 'success' | 'error' | 'warn';
|
|
5
5
|
export type ToastSlots = 'root' | 'icon' | 'content' | 'closeButton' | 'progressBar';
|
|
6
|
+
/** Text Toast renders of its own, for translating it. */
|
|
7
|
+
export interface ToastLabels {
|
|
8
|
+
/** The dismiss button, read out by screen readers. */
|
|
9
|
+
close?: string;
|
|
10
|
+
}
|
|
6
11
|
export interface ToastContextConfig {
|
|
7
12
|
position?: ToastPosition;
|
|
8
13
|
/** Duration in ms. 0 = persistent. */
|
|
@@ -13,6 +18,11 @@ export interface ToastContextConfig {
|
|
|
13
18
|
allowStacking?: boolean;
|
|
14
19
|
/** Pause the auto-dismiss timer while the toast is hovered or focused. */
|
|
15
20
|
pauseOnHover?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Overrides the text a toast renders of its own. Set on `ToastProvider` for
|
|
23
|
+
* the whole app, or per toast through `showToast` options.
|
|
24
|
+
*/
|
|
25
|
+
labels?: ToastLabels;
|
|
16
26
|
}
|
|
17
27
|
export interface ToastOptions extends ToastContextConfig {
|
|
18
28
|
type?: ToastType;
|
|
@@ -22,7 +32,7 @@ export interface ToastOptions extends ToastContextConfig {
|
|
|
22
32
|
export interface ToastProviderProps extends ToastContextConfig {
|
|
23
33
|
children: ReactNode;
|
|
24
34
|
}
|
|
25
|
-
export interface ToastItem {
|
|
35
|
+
export interface ToastItem extends Pick<ToastOptions, 'labels'> {
|
|
26
36
|
id: string;
|
|
27
37
|
content: ReactNode;
|
|
28
38
|
options: ResolvedToastOptions;
|
|
@@ -3,6 +3,6 @@ import { ToastContextConfig } from './toast.types';
|
|
|
3
3
|
interface ToastProviderProps extends ToastContextConfig {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
}
|
|
6
|
-
declare function ToastProvider({ children, position, duration, showRemainingTime, showCloseButton, allowStacking, pauseOnHover, }: ToastProviderProps): React.JSX.Element;
|
|
6
|
+
declare function ToastProvider({ children, position, duration, showRemainingTime, showCloseButton, allowStacking, pauseOnHover, labels, }: ToastProviderProps): React.JSX.Element;
|
|
7
7
|
export default ToastProvider;
|
|
8
8
|
export type { ToastProviderProps };
|
|
@@ -25,6 +25,11 @@ export interface FlatTreeNode {
|
|
|
25
25
|
posInSet: number;
|
|
26
26
|
}
|
|
27
27
|
export type TreeSlots = 'root' | 'node' | 'toggle' | 'icon' | 'label' | 'empty';
|
|
28
|
+
/** Text Tree renders of its own, for translating it. */
|
|
29
|
+
export interface TreeLabels {
|
|
30
|
+
/** Shown when `nodes` is empty (default `Nothing here`). */
|
|
31
|
+
empty?: string;
|
|
32
|
+
}
|
|
28
33
|
export interface TreeProps extends Omit<HtmlProps<HTMLDivElement>, 'onSelect'> {
|
|
29
34
|
nodes: TreeNode[];
|
|
30
35
|
/** Controlled set of expanded branch keys. Omit for uncontrolled. */
|
|
@@ -51,12 +56,12 @@ export interface TreeProps extends Omit<HtmlProps<HTMLDivElement>, 'onSelect'> {
|
|
|
51
56
|
height?: number | string;
|
|
52
57
|
/** Row height used by the windowed renderer before measurement (default `32`). */
|
|
53
58
|
estimatedRowHeight?: number;
|
|
54
|
-
/** Shown when `nodes` is empty (default `'Nothing here'`). */
|
|
55
|
-
emptyLabel?: string;
|
|
56
59
|
disabled?: boolean;
|
|
57
60
|
'aria-label'?: string;
|
|
58
61
|
className?: string;
|
|
59
62
|
style?: CSSProperties;
|
|
60
63
|
classNames?: SlotClassNames<TreeSlots>;
|
|
61
64
|
styles?: SlotStyles<TreeSlots>;
|
|
65
|
+
/** Overrides the text Tree renders of its own. Merged per key. */
|
|
66
|
+
labels?: TreeLabels;
|
|
62
67
|
}
|
|
@@ -116,6 +116,19 @@ export interface TreeDropTarget {
|
|
|
116
116
|
*/
|
|
117
117
|
position: TreeDropPosition;
|
|
118
118
|
}
|
|
119
|
+
/** Text VirtualList renders of its own, for translating it. */
|
|
120
|
+
export interface VirtualListLabels {
|
|
121
|
+
/** A row's select checkbox, read out by screen readers. */
|
|
122
|
+
selectRow?: string;
|
|
123
|
+
/** The header's select-all checkbox, read out by screen readers. */
|
|
124
|
+
selectAllRows?: string;
|
|
125
|
+
/** The gear that opens the column menu, read out by screen readers. */
|
|
126
|
+
toggleColumns?: string;
|
|
127
|
+
/** The badge on the gear, given how many columns the user has hidden. */
|
|
128
|
+
columnsHidden?: (count: number) => string;
|
|
129
|
+
/** The entry in the column menu that undoes the user's column widths. */
|
|
130
|
+
resetColumnWidths?: ReactNode;
|
|
131
|
+
}
|
|
119
132
|
export interface VirtualListProps<T> extends HtmlProps {
|
|
120
133
|
items: T[];
|
|
121
134
|
/** Render function for list mode (no columns). Ignored when `columns` is provided. */
|
|
@@ -210,12 +223,8 @@ export interface VirtualListProps<T> extends HtmlProps {
|
|
|
210
223
|
resizableColumns?: boolean;
|
|
211
224
|
/** Controlled column widths in px, keyed by column key. */
|
|
212
225
|
columnWidths?: Record<string, number>;
|
|
213
|
-
/**
|
|
214
|
-
|
|
215
|
-
* `'Reset column widths'`). The only text this component renders itself, so
|
|
216
|
-
* it is also the only one a localised app has to pass.
|
|
217
|
-
*/
|
|
218
|
-
resetColumnWidthsLabel?: ReactNode;
|
|
226
|
+
/** Overrides the text VirtualList renders of its own. Merged per key. */
|
|
227
|
+
labels?: VirtualListLabels;
|
|
219
228
|
/** Called with the full width map whenever the user resizes or auto-fits a column. */
|
|
220
229
|
onColumnWidthsChange?: (widths: Record<string, number>) => void;
|
|
221
230
|
/** Show the gear column-toggle button in the header. Default: true when columns present. */
|
|
@@ -2,7 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { UseColumnsResult } from './useColumns';
|
|
3
3
|
import { UseColumnResizeResult } from './useColumnResize';
|
|
4
4
|
import { SlotClassNames, SlotStyles } from '../types/slots.types';
|
|
5
|
-
import { VirtualListColumn, VirtualListSlots, VirtualListSort } from './virtualList.types';
|
|
5
|
+
import { VirtualListColumn, VirtualListLabels, VirtualListSlots, VirtualListSort } from './virtualList.types';
|
|
6
6
|
interface VirtualListHeaderProps<T> {
|
|
7
7
|
headerRef: React.RefObject<HTMLDivElement | null>;
|
|
8
8
|
/** Every column, including hidden ones: the toggle menu lists them all. */
|
|
@@ -15,7 +15,7 @@ interface VirtualListHeaderProps<T> {
|
|
|
15
15
|
allSelected: boolean;
|
|
16
16
|
someSelected: boolean;
|
|
17
17
|
onSelectAll: () => void;
|
|
18
|
-
|
|
18
|
+
labels: Required<VirtualListLabels>;
|
|
19
19
|
classNames?: SlotClassNames<VirtualListSlots>;
|
|
20
20
|
styles?: SlotStyles<VirtualListSlots>;
|
|
21
21
|
}
|
|
@@ -31,5 +31,5 @@ interface VirtualListHeaderProps<T> {
|
|
|
31
31
|
* keys resizes, Alt+Home and Alt+End take the column to its minimum or to its
|
|
32
32
|
* content width.
|
|
33
33
|
*/
|
|
34
|
-
declare function VirtualListHeader<T>({ headerRef, columns, cols, resize, sort, onSort, multiSelect, allSelected, someSelected, onSelectAll,
|
|
34
|
+
declare function VirtualListHeader<T>({ headerRef, columns, cols, resize, sort, onSort, multiSelect, allSelected, someSelected, onSelectAll, labels, classNames, styles: slotStyles, }: VirtualListHeaderProps<T>): React.JSX.Element;
|
|
35
35
|
export default VirtualListHeader;
|
package/docs/ActionButtons.md
CHANGED
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
import { ActionButtons, ButtonStyleType } from '@ahrowe/ui';
|
|
11
11
|
|
|
12
12
|
<ActionButtons
|
|
13
|
-
|
|
14
|
-
cancelLabel="Discard"
|
|
13
|
+
labels={{ submit: 'Save', cancel: 'Discard' }}
|
|
15
14
|
onSubmit={handleSave}
|
|
16
15
|
onClose={handleClose}
|
|
17
16
|
isSubmitButtonLoading={isSaving}
|
|
@@ -19,7 +18,7 @@ import { ActionButtons, ButtonStyleType } from '@ahrowe/ui';
|
|
|
19
18
|
|
|
20
19
|
// Destructive action
|
|
21
20
|
<ActionButtons
|
|
22
|
-
|
|
21
|
+
labels={{ submit: 'Delete' }}
|
|
23
22
|
submitButtonStyle={ButtonStyleType.Delete}
|
|
24
23
|
onSubmit={handleDelete}
|
|
25
24
|
onClose={onClose}
|
|
@@ -27,7 +26,7 @@ import { ActionButtons, ButtonStyleType } from '@ahrowe/ui';
|
|
|
27
26
|
|
|
28
27
|
// Stacked, full-width buttons, a common mobile default
|
|
29
28
|
<ActionButtons
|
|
30
|
-
|
|
29
|
+
labels={{ submit: 'Save' }}
|
|
31
30
|
onSubmit={handleSave}
|
|
32
31
|
onClose={handleClose}
|
|
33
32
|
stackButtons
|
|
@@ -40,8 +39,8 @@ import { ActionButtons, ButtonStyleType } from '@ahrowe/ui';
|
|
|
40
39
|
|------|------|-------------|
|
|
41
40
|
| `onSubmit` | `() => void` | Primary button click |
|
|
42
41
|
| `onClose` | `() => void` | Secondary button click |
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
42
|
+
| `labels.submit` | `ReactNode \| string` | Primary button label |
|
|
43
|
+
| `labels.cancel` | `ReactNode \| string` | Secondary button label |
|
|
45
44
|
| `submitButtonStyle` | `ButtonStyleType` | `Primary` (default), `Delete`, `Default` |
|
|
46
45
|
| `isSubmitButtonLoading` | `boolean` | Shows spinner on primary button |
|
|
47
46
|
| `isSubmitButtonDisabled` | `boolean` | |
|
|
@@ -53,3 +52,5 @@ import { ActionButtons, ButtonStyleType } from '@ahrowe/ui';
|
|
|
53
52
|
| `stackButtons` | `boolean` | Stack the buttons vertically, each stretched to full width (default `false`). A common mobile default, easy to set globally via `ConfigProvider` |
|
|
54
53
|
|
|
55
54
|
**Slots:** `root` `submitButton` `cancelButton`
|
|
55
|
+
|
|
56
|
+
**Labels:** `submit` `cancel` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; keys merge individually. Type: `ActionButtonsLabels`.
|
package/docs/Alert.md
CHANGED
|
@@ -65,6 +65,8 @@ import { faRocket } from '@fortawesome/free-solid-svg-icons';
|
|
|
65
65
|
|
|
66
66
|
**Slots:** `root` `icon` `content` `title` `description` `closeButton`
|
|
67
67
|
|
|
68
|
+
**Labels:** `dismiss` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; they merge per key. Type: `AlertLabels`.
|
|
69
|
+
|
|
68
70
|
## Sizing
|
|
69
71
|
|
|
70
72
|
Every length in an alert is `em`, so the padding, the icon, the close button and the accent bar keep their ratios to the body copy at any base font.
|
package/docs/Breadcrumb.md
CHANGED
|
@@ -106,3 +106,5 @@ function Example() {
|
|
|
106
106
|
**Global defaults:** adopts `ConfigProvider`, e.g. `defaultProps={{ Breadcrumb: { separator: '/' } }}`. See [ConfigProvider.md](ConfigProvider.md).
|
|
107
107
|
|
|
108
108
|
**Slots:** `root` `list` `item` `link` `icon` `separator` `current` `ellipsis` `hiddenList` `hiddenItem`
|
|
109
|
+
|
|
110
|
+
**Labels:** `showHidden` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; they merge per key. Type: `BreadcrumbLabels`.
|
package/docs/Card.md
CHANGED
|
@@ -82,3 +82,5 @@ All sub-components are optional — use only what you need. Stacked sub-componen
|
|
|
82
82
|
Card is spaced by its font: the padding, the header's gap and thumbnail, the gap between title and subtitle, and the action row all scale with the theme's text size. The title is `1.125em` — 18px at a 16px base — rather than a fixed size, so it stays proportional to the body text beneath it.
|
|
83
83
|
|
|
84
84
|
`CardMedia` bleeds to the card's edges with a negative margin that has to stay equal to the padding, so change the two together.
|
|
85
|
+
|
|
86
|
+
**Slots:** `root` `content`
|
package/docs/Carousel.md
CHANGED
|
@@ -103,3 +103,5 @@ Slides announce themselves as the panel each dot controls, or as "slide 2 of 5"
|
|
|
103
103
|
**Global defaults:** adopts `ConfigProvider`, e.g. `defaultProps={{ Carousel: { autoPlay: true } }}`. See [ConfigProvider.md](ConfigProvider.md).
|
|
104
104
|
|
|
105
105
|
**Slots:** `root` `track` `slide` `prevButton` `nextButton` `dots` `dot`
|
|
106
|
+
|
|
107
|
+
**Labels:** `previous` `next` `slides` `goToSlide(slide)` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; they merge per key. Type: `CarouselLabels`.
|
package/docs/Chip.md
CHANGED
|
@@ -56,7 +56,7 @@ import { Chip, ChipContainer, ChipStyleType } from '@ahrowe/ui';
|
|
|
56
56
|
| `text` | `string` | Chip label |
|
|
57
57
|
| `styleType` | `ChipStyleType` | Colour variant (default `Default`) |
|
|
58
58
|
| `thumbnail` | `string` | Avatar image URL |
|
|
59
|
-
| `
|
|
59
|
+
| `labels.remove` | `string` | Accessible name for the remove button. Default: `'Remove'` |
|
|
60
60
|
| `showRemoveIcon` | `boolean` | Show × icon |
|
|
61
61
|
| `onRemove` | `() => void` | Remove button handler |
|
|
62
62
|
| `onClick` | `() => void` | Makes chip clickable |
|
|
@@ -66,3 +66,7 @@ import { Chip, ChipContainer, ChipStyleType } from '@ahrowe/ui';
|
|
|
66
66
|
| Prop | Type | Description |
|
|
67
67
|
|------|------|-------------|
|
|
68
68
|
| `inline` | `boolean` | Inline layout (default wraps) |
|
|
69
|
+
|
|
70
|
+
**Labels:** `remove` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; keys merge individually. Type: `ChipLabels`.
|
|
71
|
+
|
|
72
|
+
**Slots:** `root` `inner` `thumbnail` `text` `removeIcon`
|
package/docs/ColorPicker.md
CHANGED
|
@@ -50,3 +50,7 @@ Parsing uses the browser's own colour engine, which means it needs a DOM with a
|
|
|
50
50
|
The inline swatch tracks the theme's text size, since it sits beside a label: `--swatch-size` falls back to `2em`, i.e. 32px at a 16px base, and the gap, the hex overlay and the transparency checkerboard scale with it.
|
|
51
51
|
|
|
52
52
|
The picker panel deliberately does not. It is a floating control surface with its own fixed layout — a saturation area, sliders and a hex field — and it holds together at a large base font rather than needing to grow with it.
|
|
53
|
+
|
|
54
|
+
**Labels:** `pickFromScreen` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; they merge per key. Type: `ColorPickerLabels`.
|
|
55
|
+
|
|
56
|
+
**Slots:** `root` `swatch` `panel` `gradient` `hueSlider` `alphaSlider` `hexInput` `eyeDropper`
|
package/docs/ConfigProvider.md
CHANGED
|
@@ -114,3 +114,26 @@ Each entry is a `Partial<...Props>`, so any of that component's props can be def
|
|
|
114
114
|
`Textarea`, `NumberInput`, and `DatePicker` are built on top of `Input`, so they **also** inherit `Input` defaults for the props they forward to it. Their own component-keyed defaults take precedence for props they handle themselves. Example: with `Input: { alwaysFloatLabel: true }` set, every `Textarea` / `NumberInput` / `DatePicker` floats its label too, without needing a separate entry.
|
|
115
115
|
|
|
116
116
|
The `ComponentDefaults` type is the source of truth for which keys are currently supported — more components adopt it over time.
|
|
117
|
+
|
|
118
|
+
## Translating the components
|
|
119
|
+
|
|
120
|
+
Every string a component renders of its own is set through its `labels` prop, and a `ConfigProvider` sets them for the whole app at once:
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
<ConfigProvider
|
|
124
|
+
defaultProps={{
|
|
125
|
+
Alert: { labels: { dismiss: 'Schließen' } },
|
|
126
|
+
Modal: { labels: { close: 'Schließen' } },
|
|
127
|
+
Pagination: { labels: { goToPage: (page) => `Zu Seite ${page}` } },
|
|
128
|
+
VirtualList: { labels: { selectRow: 'Zeile auswählen', selectAllRows: 'Alle Zeilen auswählen' } },
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<App />
|
|
132
|
+
</ConfigProvider>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Labels merge per key**, unlike every other default here. An instance that overrides one string keeps the provider's translations for the rest, so `<Alert labels={{ dismiss: 'Weg damit' }} />` under the provider above does not lose anything else Alert might have been given. Anything the component does not produce itself, a `title`, a column `label`, a button's children, is already yours and never appears in `labels`.
|
|
136
|
+
|
|
137
|
+
`ColorPicker` and `VirtualList` appear in `ComponentDefaults` with their labels only: the first is configured elsewhere, the second has generic props that a per-key default map cannot express. `Toast` is not there at all, because `ToastProvider` is already its app-wide configuration and carries `labels` itself.
|
|
138
|
+
|
|
139
|
+
Each component's doc lists its own keys under **Labels:**.
|
package/docs/ConfirmModal.md
CHANGED
|
@@ -38,9 +38,9 @@ const [isOpen, setIsOpen] = useState(false);
|
|
|
38
38
|
| `content` | `ReactNode` | Dialog body |
|
|
39
39
|
| `onConfirm` | `() => void \| Promise<void>` | Called when user confirms |
|
|
40
40
|
| `onClose` | `(didSubmit: boolean) => void` | Called on both confirm and cancel |
|
|
41
|
-
| `
|
|
41
|
+
| `labels.submit` | `string` | Confirm button label (default `'Confirm'`) |
|
|
42
42
|
| `isDelete` | `boolean` | Render the confirm button with the destructive (delete) style |
|
|
43
|
-
| `actionButtonsProps` | `ActionButtonsProps` | Overrides passed through to the underlying `ActionButtons` (wins over `
|
|
43
|
+
| `actionButtonsProps` | `ActionButtonsProps` | Overrides passed through to the underlying `ActionButtons` (wins over `labels.submit` / `isDelete`) |
|
|
44
44
|
| `children` | `ReactNode` | Alternative to `content` prop |
|
|
45
45
|
|
|
46
46
|
**Destructive action:**
|
|
@@ -51,16 +51,18 @@ const [isOpen, setIsOpen] = useState(false);
|
|
|
51
51
|
title="Delete item?"
|
|
52
52
|
content="This action cannot be undone."
|
|
53
53
|
isDelete
|
|
54
|
-
|
|
54
|
+
labels={{ submit: 'Delete' }}
|
|
55
55
|
onConfirm={async () => { await deleteItem(); }}
|
|
56
56
|
onClose={() => setIsOpen(false)}
|
|
57
57
|
/>
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
**Global defaults:** `ConfirmModal` supports `ConfigProvider` — set a default `
|
|
60
|
+
**Global defaults:** `ConfirmModal` supports `ConfigProvider` — set a default `labels.submit` (or any other prop) app-wide:
|
|
61
61
|
|
|
62
62
|
```tsx
|
|
63
|
-
<ConfigProvider defaultProps={{ ConfirmModal: {
|
|
63
|
+
<ConfigProvider defaultProps={{ ConfirmModal: { labels: { submit: 'OK' } } }}>
|
|
64
64
|
<App />
|
|
65
65
|
</ConfigProvider>
|
|
66
66
|
```
|
|
67
|
+
|
|
68
|
+
**Labels:** `submit` `cancel` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; keys merge individually. Type: `ConfirmModalLabels`.
|
package/docs/DatePicker.md
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
**Keyboard:** the day grid uses a roving tab stop (the selected day, or today, or the 1st — one Tab reaches it, not every day individually); arrow keys move by day (`←`/`→`) or by week (`↑`/`↓`), crossing into the adjacent month automatically when they run past the edge, and Enter/Space selects the focused day.
|
|
8
8
|
|
|
9
|
-
**Import:** `import { DatePicker } from '@ahrowe/ui'`
|
|
9
|
+
**Import:** `import { DatePicker } from '@ahrowe/ui'`
|
|
10
|
+
**Types:** `import type { DatePickerProps } from '@ahrowe/ui'`
|
|
10
11
|
|
|
11
12
|
```tsx
|
|
12
13
|
import { DatePicker, FormValidator } from '@ahrowe/ui';
|
|
@@ -79,3 +80,7 @@ const dateValidator = new FormValidator<Date | null>(null);
|
|
|
79
80
|
| `showClearButton` | `boolean` | Show a clear/reset button |
|
|
80
81
|
| `startDate` | `Date` | Range highlight start |
|
|
81
82
|
| `endDate` | `Date` | Range highlight end |
|
|
83
|
+
|
|
84
|
+
**Slots:** `root` `input` `header` `monthDropdown` `yearDropdown` `calendar` `clearButton`
|
|
85
|
+
|
|
86
|
+
The root also takes the full native attribute set (`id`, `data-*`, `aria-*`, `title`, event handlers). `onChange` and `onSelect` report a `Date`, so the native handlers of those names are not available.
|
package/docs/Drawer.md
CHANGED
|
@@ -62,3 +62,5 @@ function Example() {
|
|
|
62
62
|
- It's an **inline** element with `height: 100%` and a `width` transition — place it in a flex/grid layout next to your main content; it doesn't overlay.
|
|
63
63
|
- When `openedWidth` is omitted, the open width tracks the content's `scrollWidth` via a `ResizeObserver`, so it grows/shrinks with dynamic content.
|
|
64
64
|
- For a full-screen overlay dialog instead, use `Modal`; for a collapsing scroll header, see `Overscroll`.
|
|
65
|
+
|
|
66
|
+
**Slots:** `root` `content` `inner`
|
package/docs/Dropdown.md
CHANGED
|
@@ -65,3 +65,5 @@ const statusValidator = new FormValidator('', [Validators.required()]);
|
|
|
65
65
|
The list is rendered through a portal and tracks the trigger across scroll, so it always escapes clipping ancestors (cards, scroll containers, virtualized lists). It flips to open upward automatically when there's no room below, and shifts horizontally to stay within the viewport when the trigger sits near the left or right edge of the screen. It hides (without closing) if the trigger itself scrolls behind a clipping ancestor, reappearing once it's back in view. It also re-measures when its own content changes size while open, so a list that shrinks (e.g. filtered down to fewer entries) stays anchored to the trigger instead of hanging above it.
|
|
66
66
|
|
|
67
67
|
**Bottom sheet:** `presentation={Presentation.Sheet}` drops the anchoring entirely and pins the list to the bottom of the screen instead, full width up to 560px, behind a backdrop, scrolling internally past 70% of the viewport height and lifting itself above an open on-screen keyboard, shrinking to fit the space that leaves rather than running off the top of the screen. Tapping the backdrop closes the list without also pressing whatever sits behind it. It is the same list with the same keyboard handling, so selection, highlighting and infinite scroll are unchanged. `Presentation.Auto` does that only when the pointer is coarse *and* the screen is under 768px wide. The default is `Presentation.Default`. A whole app can opt in with `<ConfigProvider defaultProps={{ Dropdown: { presentation: Presentation.Auto } }}>`, or for every sheet-capable component at once with `<ConfigProvider presentation={Presentation.Auto}>` — see [ConfigProvider.md](ConfigProvider.md).
|
|
68
|
+
|
|
69
|
+
**Slots:** `root` `label` `field` `control` `icon` `placeholder` `list` `option`
|
package/docs/EmptyState.md
CHANGED
|
@@ -28,3 +28,7 @@ import { faInbox } from '@fortawesome/free-solid-svg-icons';
|
|
|
28
28
|
| `icon` | `IconDefinition \| ReactElement` | Icon shown above the message — FontAwesome icon or any React element |
|
|
29
29
|
| `children` | `ReactNode` | Message body (defaults to `"No entries available"`) |
|
|
30
30
|
| `className` | `string` | Root element class |
|
|
31
|
+
|
|
32
|
+
**Labels:** `empty` — the text this component renders of its own. Pass `labels` to override it, on the component or app-wide through `ConfigProvider`; keys merge individually. Type: `EmptyStateLabels`.
|
|
33
|
+
|
|
34
|
+
**Slots:** `root` `icon` `text`
|
package/docs/Fab.md
CHANGED
|
@@ -57,3 +57,5 @@ import { faPlus, faPen, faCamera } from '@fortawesome/free-solid-svg-icons';
|
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
`--fab-icon-size` is independent of `--fab-size`, so enlarging the button does not enlarge the glyph; set both. It applies to the speed-dial entries as well as the main button.
|
|
60
|
+
|
|
61
|
+
**Slots:** `root` `backdrop` `button` `icon` `menu` `menuEntry` `menuEntryLabel`
|
|
@@ -38,7 +38,7 @@ function ProfileForm({ user, onSaved }) {
|
|
|
38
38
|
<Input label="Name" formValidator={form.group.name} />
|
|
39
39
|
<Input label="Email" type={InputType.Email} formValidator={form.group.email} />
|
|
40
40
|
<ActionButtons
|
|
41
|
-
|
|
41
|
+
labels={{ submit: 'Save' }}
|
|
42
42
|
onSubmit={form.submit}
|
|
43
43
|
isSubmitButtonLoading={form.isSubmitting}
|
|
44
44
|
isSubmitButtonDisabled={!form.isDirty}
|
package/docs/Input.md
CHANGED
|
@@ -125,6 +125,8 @@ The stored value is the formatted one, spaces included, so strip them before a l
|
|
|
125
125
|
|
|
126
126
|
**Slots:** `label` `container` `input` `suffix` `upperRightLabel` `fieldset`
|
|
127
127
|
|
|
128
|
+
**Labels:** `clear` `clearSearch` `showPassword` `hidePassword` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; they merge per key. Type: `InputLabels`.
|
|
129
|
+
|
|
128
130
|
## Browser autofill
|
|
129
131
|
|
|
130
132
|
`autoComplete` is the plain HTML attribute and is passed straight through — use `'one-time-code'`, `'new-password'`, `'street-address'` and the rest as you would on a bare `<input>`. Input does **not** set it: autofill and password managers are usability and accessibility features, and a plain field has no suggestion list of its own for them to collide with.
|
package/docs/KlipyPicker.md
CHANGED
|
@@ -41,3 +41,5 @@ import { KlipyPicker } from '@ahrowe/ui';
|
|
|
41
41
|
| `selected` | `string \| null` | Currently selected GIF id (for visual highlight) |
|
|
42
42
|
| `onSelect` | `(preview: KlipyResult \| null) => void \| Promise<void>` | Fires when a GIF is picked; `null` when cleared |
|
|
43
43
|
| `className` | `string` | Root element class |
|
|
44
|
+
|
|
45
|
+
**Labels:** `search` — the text this component renders of its own. Pass `labels` to override it, on the component or app-wide through `ConfigProvider`; keys merge individually. Type: `KlipyPickerLabels`.
|