@foris/avocado-suite 1.15.0 → 1.16.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.
@@ -1,11 +1,16 @@
1
1
  import React from 'react';
2
2
  import { IconTypes, Color } from '../../../../avocado-icons';
3
- export interface PillProps {
4
- /** Optional Icon name */
5
- icon?: IconTypes;
6
- /** Overwrite icon original color */
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: React.ReactNode | string;
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
- /** Handle onClock event */
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 ReactNode, type FC } from 'react';
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;
@@ -0,0 +1,8 @@
1
+ export declare const MODAL_STRINGS: {
2
+ en: {
3
+ close: string;
4
+ };
5
+ es: {
6
+ close: string;
7
+ };
8
+ };
@@ -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;