@foris/avocado-suite 1.16.0 → 1.17.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/avocado-suite.es.js +7712 -7555
- package/dist/avocado-suite.umd.js +34 -34
- package/dist/components/switch/Switch.d.ts +3 -3
- package/dist/components/tabs/Tabs.d.ts +23 -5
- package/dist/components/tag/Tag.d.ts +14 -3
- package/dist/components/text-field/TextField.d.ts +8 -0
- package/dist/components/text-field/textField.locale.d.ts +8 -0
- package/dist/components/tooltip/Tooltip.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
export interface SwitchProps {
|
|
1
|
+
import type { AriaAttributes, FC, InputHTMLAttributes } from 'react';
|
|
2
|
+
export interface SwitchProps extends AriaAttributes, Pick<InputHTMLAttributes<HTMLInputElement>, 'id' | 'name'> {
|
|
3
3
|
/** Indicates if the switch is on */
|
|
4
4
|
checked: boolean;
|
|
5
5
|
/** overwrite className */
|
|
6
6
|
className?: string;
|
|
7
7
|
/** Disables the switch if true */
|
|
8
8
|
disabled?: boolean;
|
|
9
|
-
/** Optional label displayed next to the switch */
|
|
9
|
+
/** Optional label displayed next to the switch; without it, name the switch with `aria-label` or `aria-labelledby` */
|
|
10
10
|
label?: string;
|
|
11
11
|
/** Callback fired when the switch state changes */
|
|
12
12
|
onChange: (checked: boolean) => void;
|
|
@@ -1,18 +1,36 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
1
|
+
import { FC, KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { IconTypes } from '../../../../avocado-icons';
|
|
2
3
|
export interface TabItemProps {
|
|
3
|
-
|
|
4
|
+
/** Panel content. Route tabs render no panel, so the page renders it */
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
/** Number shown after the label, as part of the tab's accessible name */
|
|
7
|
+
count?: number;
|
|
4
8
|
disabled?: boolean;
|
|
9
|
+
/** Link target. When every item has one, the tabs render as a `nav` of links */
|
|
10
|
+
href?: string;
|
|
11
|
+
/** Decorative icon shown before the label */
|
|
12
|
+
icon?: IconTypes;
|
|
5
13
|
label: ReactNode;
|
|
6
14
|
}
|
|
15
|
+
type TabClickEvent = MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>;
|
|
7
16
|
export interface TabsProps {
|
|
8
|
-
/**
|
|
17
|
+
/** Accessible name of the tab list */
|
|
18
|
+
'aria-label'?: string;
|
|
19
|
+
/** Content at the end of the tab row, outside the tab list (e.g. a toolbar) */
|
|
20
|
+
actions?: ReactNode;
|
|
21
|
+
/** Current index. Route tabs always follow it when it is set */
|
|
9
22
|
activeIndex?: number;
|
|
10
23
|
/** Overwrite className */
|
|
11
24
|
className?: string;
|
|
25
|
+
/** Base for the tab and panel ids. Defaults to a generated id */
|
|
26
|
+
id?: string;
|
|
12
27
|
/** Configure tabs content */
|
|
13
28
|
items: TabItemProps[];
|
|
14
|
-
/**
|
|
15
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Called when a tab is activated, by click or by the arrow keys. Route tabs can call
|
|
31
|
+
* `event.preventDefault()` to navigate client-side.
|
|
32
|
+
*/
|
|
33
|
+
onClick?: (index: number, event: TabClickEvent) => void;
|
|
16
34
|
/**
|
|
17
35
|
* Keeps the outgoing panel's height as the incoming panel's `min-height` on every switch,
|
|
18
36
|
* so the page does not jump. The `min-height` only grows while `Tabs` stays mounted.
|
|
@@ -5,8 +5,8 @@ declare const variants: {
|
|
|
5
5
|
readonly Filled: "filled";
|
|
6
6
|
};
|
|
7
7
|
export type TagType = (typeof variants)[keyof typeof variants];
|
|
8
|
-
export type TagSize = '
|
|
9
|
-
export interface ITag {
|
|
8
|
+
export type TagSize = 'md' | 'sm';
|
|
9
|
+
export interface ITag extends Omit<React.AriaAttributes, 'aria-pressed'> {
|
|
10
10
|
/** Content of the component tag */
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
/** Overwrite className */
|
|
@@ -17,8 +17,19 @@ export interface ITag {
|
|
|
17
17
|
type?: TagType;
|
|
18
18
|
/** Icon name */
|
|
19
19
|
icon?: IconTypes;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Shows the active style only, with no toggle semantics.
|
|
22
|
+
* @deprecated Use `pressed`, which also sets `aria-pressed`.
|
|
23
|
+
*/
|
|
21
24
|
active?: boolean;
|
|
25
|
+
/** Toggle state: sets `aria-pressed` on the button and shows the active style when true */
|
|
26
|
+
pressed?: boolean;
|
|
27
|
+
/** Number shown after the label, read as part of the tag's name */
|
|
28
|
+
count?: number;
|
|
29
|
+
/** Tag size */
|
|
30
|
+
size?: TagSize;
|
|
31
|
+
/** Native title of the tag button */
|
|
32
|
+
title?: string;
|
|
22
33
|
/** Action when clicking on the component */
|
|
23
34
|
onClick?: () => void;
|
|
24
35
|
/** Action when clicking on the icon of the component */
|
|
@@ -3,12 +3,20 @@ import type { IconTypes } from '../../../../avocado-icons';
|
|
|
3
3
|
export interface TextFieldProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
4
4
|
/** If allow to remove input content with clear icon */
|
|
5
5
|
allowClear?: boolean;
|
|
6
|
+
/** Accessible name of the clear button. Defaults to a localized "Clear" */
|
|
7
|
+
clearLabel?: string;
|
|
6
8
|
/** Overwrite className */
|
|
7
9
|
className?: string;
|
|
10
|
+
/** Supporting text shown under the input; it stays visible next to a status text */
|
|
11
|
+
helpText?: string;
|
|
8
12
|
/** Set the icon */
|
|
9
13
|
icon?: IconTypes;
|
|
14
|
+
/** Side of the input where the icon is placed */
|
|
15
|
+
iconPosition?: 'left' | 'right';
|
|
10
16
|
/** Set top label */
|
|
11
17
|
label?: string;
|
|
18
|
+
/** Show a "current / max" counter; unlike the native `maxLength`, it does not cut the text */
|
|
19
|
+
maxCount?: number;
|
|
12
20
|
/** Set validation status */
|
|
13
21
|
status?: 'error' | 'warning' | 'blocked' | 'unsaved';
|
|
14
22
|
/** Set display for validation status */
|
|
@@ -20,6 +20,8 @@ export interface TooltipProps {
|
|
|
20
20
|
notShowArrow?: boolean;
|
|
21
21
|
/** The placement of the popper relative to its reference */
|
|
22
22
|
placement?: keyof typeof PlacementEnum;
|
|
23
|
+
/** `rich` wraps longer content on the surface color, for a help popover */
|
|
24
|
+
variant?: 'default' | 'rich';
|
|
23
25
|
visible?: boolean;
|
|
24
26
|
}
|
|
25
27
|
declare const Tooltip: FC<TooltipProps>;
|