@foris/avocado-suite 1.15.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 +10225 -9924
- package/dist/avocado-suite.umd.js +151 -151
- package/dist/components/Pill/Pill.d.ts +15 -6
- package/dist/components/checkbox/Checkbox.d.ts +4 -0
- package/dist/components/link/Link.d.ts +3 -3
- package/dist/components/modal/Modal.d.ts +18 -1
- package/dist/components/modal/modal.locale.d.ts +8 -0
- package/dist/components/select/Select.d.ts +2 -0
- package/dist/components/select/components/SelectIndicators.d.ts +1 -0
- package/dist/components/select/components/SelectInput.d.ts +5 -0
- 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/dist/utils/aria/mergeIds.d.ts +2 -0
- package/dist/utils/aria/mergeIds.test.d.ts +1 -0
- package/dist/utils/focus/containTab.d.ts +5 -0
- package/dist/utils/focus/useDialogFocus.d.ts +13 -0
- package/dist/utils/focus/useDialogFocus.test.d.ts +1 -0
- package/package.json +2 -2
- package/dist/components/drawer/utils/drawerKeyboard.d.ts +0 -3
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconTypes, Color } from '../../../../avocado-icons';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export type PillStatus = 'neutral' | 'info' | 'success' | 'warning' | 'error';
|
|
4
|
+
export interface PillProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'> {
|
|
5
|
+
/** Root element. Use `span` inside buttons or running text */
|
|
6
|
+
as?: 'div' | 'span';
|
|
7
|
+
/** Colors the pill from the theme tokens of the status. `color` and `textColor` take precedence */
|
|
8
|
+
status?: PillStatus;
|
|
9
|
+
/** Avocado icon name, or an element (e.g. a Lucide icon) rendered hidden from assistive technology */
|
|
10
|
+
icon?: IconTypes | React.ReactElement;
|
|
11
|
+
/** Overwrite icon original color. Applies to avocado icon names only */
|
|
7
12
|
iconColor?: `${Color}`;
|
|
8
|
-
/** Icon filled state */
|
|
13
|
+
/** Icon filled state. Applies to avocado icon names only */
|
|
9
14
|
iconFilled?: boolean;
|
|
10
15
|
/** Overwrite pill original color */
|
|
11
16
|
color?: `${Color}`;
|
|
@@ -13,8 +18,12 @@ export interface PillProps {
|
|
|
13
18
|
textColor?: `${Color}`;
|
|
14
19
|
/** Controls pill outlined state */
|
|
15
20
|
outlined?: boolean;
|
|
21
|
+
/** Renders the pill as a count badge showing this number instead of `children` */
|
|
22
|
+
count?: number;
|
|
23
|
+
/** Highest count shown; a greater `count` renders as `{max}+` */
|
|
24
|
+
max?: number;
|
|
16
25
|
/** content pill */
|
|
17
|
-
children
|
|
26
|
+
children?: React.ReactNode | string;
|
|
18
27
|
/** overwrite className */
|
|
19
28
|
className?: string;
|
|
20
29
|
}
|
|
@@ -10,6 +10,10 @@ export interface CheckboxProps extends React.DetailedHTMLProps<React.InputHTMLAt
|
|
|
10
10
|
labelRight?: ReactNode | string;
|
|
11
11
|
/** disabled state */
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
/** Help text shown below the checkbox and linked to it */
|
|
14
|
+
helpText?: string;
|
|
15
|
+
/** Error message shown below the checkbox; marks it invalid */
|
|
16
|
+
error?: string;
|
|
13
17
|
ref?: any;
|
|
14
18
|
}
|
|
15
19
|
declare const Checkbox: FC<CheckboxProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, MouseEvent } from 'react';
|
|
2
2
|
import { IconTypes } from '../../../../avocado-icons';
|
|
3
3
|
export interface LinkProps extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
4
4
|
/** Render content link */
|
|
@@ -17,8 +17,8 @@ export interface LinkProps extends React.DetailedHTMLProps<React.AnchorHTMLAttri
|
|
|
17
17
|
inverse?: boolean;
|
|
18
18
|
/** Use size 'sm' or 'md'. Default 'md' */
|
|
19
19
|
size?: 'sm' | 'md';
|
|
20
|
-
/**
|
|
21
|
-
onClick?: () => void;
|
|
20
|
+
/** Receives the click event; call `preventDefault()` to route in-app. Not called when disabled */
|
|
21
|
+
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
22
22
|
}
|
|
23
23
|
declare const Link: FC<LinkProps>;
|
|
24
24
|
export default Link;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
2
|
import { type Color } from '../../../../avocado-icons';
|
|
3
|
+
import { type FocusTarget } from '../../utils/focus/useDialogFocus';
|
|
3
4
|
type HeaderStatusColor = 'warning' | 'danger' | Extract<keyof typeof Color, 'palette_1_50' | 'palette_2_50' | 'palette_3_50' | 'palette_4_50' | 'palette_5_50' | 'palette_6_50' | 'palette_7_50' | 'palette_8_50' | 'palette_9_50' | 'palette_10_50' | 'palette_11_50' | 'palette_12_50' | 'palette_13_50' | 'palette_14_50' | 'palette_15_50' | 'palette_16_50' | 'palette_17_50' | 'palette_18_50'>;
|
|
4
5
|
export interface ModalProps {
|
|
5
6
|
/** Footer actions or buttons */
|
|
@@ -20,6 +21,22 @@ export interface ModalProps {
|
|
|
20
21
|
open: boolean;
|
|
21
22
|
/** Header bordered */
|
|
22
23
|
headerBordered?: boolean;
|
|
24
|
+
/** `alertdialog` for destructive or urgent confirmations */
|
|
25
|
+
role?: 'dialog' | 'alertdialog';
|
|
26
|
+
/** Accessible name when `header` is not a string */
|
|
27
|
+
accessibleLabel?: string;
|
|
28
|
+
/** Id of the element that describes the dialog */
|
|
29
|
+
describedBy?: string;
|
|
30
|
+
/** Accessible name of the close button. Defaults to a localized "Close" */
|
|
31
|
+
closeLabel?: string;
|
|
32
|
+
/** Element focused on open, as a ref or a function. Defaults to the first focusable element */
|
|
33
|
+
initialFocus?: FocusTarget;
|
|
34
|
+
/** Element focused on close when the opener is no longer in the document */
|
|
35
|
+
finalFocus?: () => HTMLElement | null;
|
|
36
|
+
/** Ignores Escape */
|
|
37
|
+
disableEscape?: boolean;
|
|
38
|
+
/** Ignores every close request and disables the close button */
|
|
39
|
+
closeDisabled?: boolean;
|
|
23
40
|
}
|
|
24
41
|
declare const Modal: FC<ModalProps>;
|
|
25
42
|
export default Modal;
|
|
@@ -7,6 +7,8 @@ export interface SelectProps extends Props {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
/** Error option */
|
|
9
9
|
error?: string | boolean;
|
|
10
|
+
/** Help text shown below the select. Hidden while a string `error` is shown */
|
|
11
|
+
helpText?: string;
|
|
10
12
|
/** Text to be displayed representing the option */
|
|
11
13
|
label?: string;
|
|
12
14
|
/** [react-select] Array of options that populate the select menu */
|
|
@@ -2,6 +2,7 @@ import { ClearIndicatorProps, DropdownIndicatorProps } from 'react-select';
|
|
|
2
2
|
export declare const ClearIndicator: (props: ClearIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare const DropdownIndicator: (props: DropdownIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
interface ErrorIndicator {
|
|
5
|
+
id?: string;
|
|
5
6
|
message: string;
|
|
6
7
|
}
|
|
7
8
|
export declare const ErrorIndicator: (props: ErrorIndicator) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputProps } from 'react-select';
|
|
3
|
+
/** Space-separated ids of the help and error texts that describe the input */
|
|
4
|
+
export declare const SelectDescriptionContext: import("react").Context<string | undefined>;
|
|
5
|
+
export declare const SelectInput: (props: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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>;
|