@foris/avocado-suite 1.14.2 → 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 type { FC, HTMLAttributes } from 'react';
1
+ import type { FC, HTMLAttributes, ReactNode } from 'react';
2
2
  import type { Color, IconTypes } from '../../../../avocado-icons';
3
3
  import { type BreadcrumbItem } from '../breadcrumbs/Breadcrumbs';
4
4
  import type { MenuItem } from '../../types/menu.types';
@@ -26,20 +26,37 @@ export type HeaderNavigationImageBackground = {
26
26
  */
27
27
  overlayColor?: string;
28
28
  };
29
+ /** Overflow actions shown at the end of the title row. */
30
+ export type HeaderNavigationMenu = {
31
+ items: MenuItem[];
32
+ /** Accessible name for the trigger; defaults to the page title. */
33
+ label?: string;
34
+ disabled?: boolean;
35
+ };
29
36
  export type HeaderNavigationBackground = 'default' | 'brand' | HeaderNavigationImageBackground;
30
37
  /** Reusable page navigation, with content and actions supplied by its host. */
31
38
  export interface HeaderNavigationProps extends HTMLAttributes<HTMLElement> {
32
39
  /** Page title, rendered as the primary heading. */
33
40
  title: string;
34
- /** Optional explanation of the page's purpose. */
35
- description?: string;
41
+ /** Optional content shown above the title, below the breadcrumbs. */
42
+ topLabel?: ReactNode;
43
+ /** Optional content right after the title text, e.g. an info button. */
44
+ titleTrailing?: ReactNode;
45
+ /** Optional content at the end of the title row, e.g. view toggles. */
46
+ titleActions?: ReactNode;
47
+ /** Optional supporting copy below the title: text or inline content. */
48
+ description?: ReactNode;
36
49
  /** Navigation hierarchy; mobile shows the parent page. */
37
- breadcrumbsItems?: BreadcrumbItem[];
50
+ breadcrumbs?: BreadcrumbItem[];
38
51
  /** Optional overflow actions, without product-specific routing. */
52
+ menu?: HeaderNavigationMenu;
53
+ /** @deprecated Use `breadcrumbs`. */
54
+ breadcrumbsItems?: BreadcrumbItem[];
55
+ /** @deprecated Use `menu.items`. */
39
56
  menuItems?: MenuItem[];
40
- /** Accessible name for the overflow trigger; defaults to the page title. */
57
+ /** @deprecated Use `menu.label`. */
41
58
  menuLabel?: string;
42
- /** Disables the overflow trigger. */
59
+ /** @deprecated Use `menu.disabled`. */
43
60
  menuDisabled?: boolean;
44
61
  /** Gray by default, brand blue, or a full-bleed hero photograph. */
45
62
  background?: HeaderNavigationBackground;
@@ -0,0 +1,3 @@
1
+ import type { ReactNode } from 'react';
2
+ /** True when React would paint something, so optional slots skip empty wrappers. */
3
+ export declare const hasContent: (node: ReactNode) => boolean;
@@ -1,2 +1,2 @@
1
1
  export { default } from './HeaderNavigation';
2
- export type { HeaderNavigationBackground, HeaderNavigationImageBackground, HeaderNavigationProps, HeaderNavigationVisual, } from './HeaderNavigation';
2
+ export type { HeaderNavigationBackground, HeaderNavigationImageBackground, HeaderNavigationMenu, HeaderNavigationProps, HeaderNavigationVisual, } from './HeaderNavigation';
@@ -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;
package/dist/index.d.ts CHANGED
@@ -91,7 +91,7 @@ export type { BarChartProps, BarChartReferenceLine, BarChartSeries, } from './co
91
91
  export type { DonutProps, DonutSegment, DonutSize, DonutCenterMode, IDonutItem, } from './components/donut/Donut';
92
92
  export { toDonutLegendItems } from './components/donut/donut.util';
93
93
  export type { HeadingProps } from './components/heading/Heading';
94
- export type { HeaderNavigationBackground, HeaderNavigationImageBackground, HeaderNavigationProps, HeaderNavigationVisual, } from './components/header-navigation';
94
+ export type { HeaderNavigationBackground, HeaderNavigationImageBackground, HeaderNavigationMenu, HeaderNavigationProps, HeaderNavigationVisual, } from './components/header-navigation';
95
95
  export type { ContextualNavigationProps, ContextualNavigationItem, } from './components/contextual-navigation';
96
96
  export type { LinkProps } from './components/link/Link';
97
97
  export type { LineChartProps, LineChartRow, LineChartSeries, LineChartVariant, LineChartCurveType, LineChartReference, } from './components/line-chart';