@foris/avocado-suite 1.10.1 → 1.10.3
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 +10340 -9772
- package/dist/avocado-suite.umd.js +148 -148
- package/dist/components/contextual-navigation/ContextualNavigation.d.ts +4 -0
- package/dist/components/contextual-navigation/ContextualNavigation.test.d.ts +0 -0
- package/dist/components/contextual-navigation/components/contextual-nav-control/ContextualNavControl.d.ts +9 -0
- package/dist/components/contextual-navigation/components/contextual-nav-control/index.d.ts +1 -0
- package/dist/components/contextual-navigation/components/contextual-nav-icon/ContextualNavIcon.d.ts +12 -0
- package/dist/components/contextual-navigation/components/contextual-nav-icon/index.d.ts +1 -0
- package/dist/components/contextual-navigation/components/contextual-nav-item/ContextualNavItem.d.ts +11 -0
- package/dist/components/contextual-navigation/components/contextual-nav-item/index.d.ts +1 -0
- package/dist/components/contextual-navigation/components/contextual-nav-overflow/ContextualNavOverflow.d.ts +10 -0
- package/dist/components/contextual-navigation/components/contextual-nav-overflow/index.d.ts +1 -0
- package/dist/components/contextual-navigation/contextualNavigation.locale.d.ts +14 -0
- package/dist/components/contextual-navigation/hooks/useContextualNavigationCollapse.d.ts +11 -0
- package/dist/components/contextual-navigation/hooks/useContextualNavigationCollapse.test.d.ts +1 -0
- package/dist/components/contextual-navigation/index.d.ts +2 -0
- package/dist/components/contextual-navigation/types.d.ts +43 -0
- package/dist/components/contextual-navigation/utils/contextualNavigation.util.d.ts +3 -0
- package/dist/components/contextual-navigation/utils/contextualNavigation.util.test.d.ts +1 -0
- package/dist/components/matrix-table/MatrixTable.d.ts +76 -0
- package/dist/components/matrix-table/MatrixTable.test.d.ts +0 -0
- package/dist/components/matrix-table/index.d.ts +2 -0
- package/dist/index.d.ts +5 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import type { ContextualNavigationItem } from '../../types';
|
|
3
|
+
export type ContextualNavControlProps = HTMLAttributes<HTMLElement> & {
|
|
4
|
+
item: ContextualNavigationItem;
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
};
|
|
7
|
+
/** A link when the destination has an `href` and is enabled; a button otherwise. */
|
|
8
|
+
declare const ContextualNavControl: FC<ContextualNavControlProps>;
|
|
9
|
+
export default ContextualNavControl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ContextualNavControl';
|
package/dist/components/contextual-navigation/components/contextual-nav-icon/ContextualNavIcon.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { IconTypes } from '../../../../../../avocado-icons';
|
|
3
|
+
export type ContextualNavIconProps = {
|
|
4
|
+
name: IconTypes;
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
showBadge?: boolean;
|
|
8
|
+
/** Without it the badge is decorative and hidden from assistive technology. */
|
|
9
|
+
badgeAriaLabel?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const ContextualNavIcon: FC<ContextualNavIconProps>;
|
|
12
|
+
export default ContextualNavIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ContextualNavIcon';
|
package/dist/components/contextual-navigation/components/contextual-nav-item/ContextualNavItem.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { ContextualNavigationItem, ContextualNavigationProps } from '../../types';
|
|
3
|
+
export type ContextualNavItemProps = {
|
|
4
|
+
item: ContextualNavigationItem;
|
|
5
|
+
activeId?: string;
|
|
6
|
+
isCollapsed?: boolean;
|
|
7
|
+
isMobileOverflowHidden?: boolean;
|
|
8
|
+
onItemClick?: ContextualNavigationProps['onItemClick'];
|
|
9
|
+
};
|
|
10
|
+
declare const ContextualNavItem: FC<ContextualNavItemProps>;
|
|
11
|
+
export default ContextualNavItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ContextualNavItem';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { ContextualNavigationItem, ContextualNavigationProps } from '../../types';
|
|
3
|
+
export type ContextualNavOverflowProps = {
|
|
4
|
+
items: ContextualNavigationItem[];
|
|
5
|
+
activeId?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
onItemClick?: ContextualNavigationProps['onItemClick'];
|
|
8
|
+
};
|
|
9
|
+
declare const ContextualNavOverflow: FC<ContextualNavOverflowProps>;
|
|
10
|
+
export default ContextualNavOverflow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ContextualNavOverflow';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const CONTEXTUAL_NAVIGATION_STRINGS: {
|
|
2
|
+
en: {
|
|
3
|
+
navLabel: string;
|
|
4
|
+
expandNav: string;
|
|
5
|
+
collapseNav: string;
|
|
6
|
+
overflowLabel: string;
|
|
7
|
+
};
|
|
8
|
+
es: {
|
|
9
|
+
navLabel: string;
|
|
10
|
+
expandNav: string;
|
|
11
|
+
collapseNav: string;
|
|
12
|
+
overflowLabel: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type UseContextualNavigationCollapseParams = {
|
|
2
|
+
collapsed?: boolean;
|
|
3
|
+
defaultCollapsed?: boolean;
|
|
4
|
+
persistenceKey?: string;
|
|
5
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const useContextualNavigationCollapse: ({ collapsed, defaultCollapsed, persistenceKey, onCollapsedChange, }: UseContextualNavigationCollapseParams) => {
|
|
8
|
+
collapsed: boolean;
|
|
9
|
+
toggleCollapsed: () => void;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import type { IconTypes } from '../../../../avocado-icons';
|
|
3
|
+
export type ContextualNavigationItem = {
|
|
4
|
+
/** Unique id; matches `activeId` when this destination is current. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Visible label. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Leading icon. */
|
|
9
|
+
icon: IconTypes;
|
|
10
|
+
/** Destination URL. When set, the item renders as a link. */
|
|
11
|
+
href?: string;
|
|
12
|
+
/** Prevents activation and navigation. */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Shows a notification dot on the item. */
|
|
15
|
+
showBadge?: boolean;
|
|
16
|
+
/** Accessible name for the badge; required when `showBadge` is true. */
|
|
17
|
+
badgeAriaLabel?: string;
|
|
18
|
+
};
|
|
19
|
+
export type ContextualNavigationProps = {
|
|
20
|
+
/** Every destination, in groups separated by dividers on desktop. */
|
|
21
|
+
sections: ContextualNavigationItem[][];
|
|
22
|
+
/** Id of the current destination. */
|
|
23
|
+
activeId?: string;
|
|
24
|
+
/** Controlled collapsed state for the desktop sidebar. */
|
|
25
|
+
collapsed?: boolean;
|
|
26
|
+
/** Initial collapsed state when uncontrolled. */
|
|
27
|
+
defaultCollapsed?: boolean;
|
|
28
|
+
/** Called when the user toggles the desktop sidebar collapse control. */
|
|
29
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
30
|
+
/** `localStorage` key for persisting the collapsed state. */
|
|
31
|
+
persistenceKey?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Called when an item is activated, before native navigation.
|
|
34
|
+
* Call `event.preventDefault()` to take over navigation.
|
|
35
|
+
*/
|
|
36
|
+
onItemClick?: (item: ContextualNavigationItem, event: MouseEvent<HTMLElement>) => void;
|
|
37
|
+
/** Names the `nav` landmark — important when the page has more than one nav region. */
|
|
38
|
+
'aria-label'?: string;
|
|
39
|
+
/** Page content rendered beside or below the navigation. */
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
/** Extra class for the root element. Not applied when every section is empty, since only `children` renders. */
|
|
42
|
+
className?: string;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { HTMLAttributes, Key, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
/** Supported pinning edge, relative to the document direction. */
|
|
3
|
+
export type MatrixTablePinnedSide = 'start';
|
|
4
|
+
/**
|
|
5
|
+
* Inline alignment of a column's header and body cells. Logical, so `start` and
|
|
6
|
+
* `end` follow the document direction. Narrow numeric columns want `center`.
|
|
7
|
+
*/
|
|
8
|
+
export type MatrixTableAlign = 'start' | 'center' | 'end';
|
|
9
|
+
/** What a group column and a detail column declare in common. */
|
|
10
|
+
interface MatrixTableColumnBase {
|
|
11
|
+
/** Stable identity, unique across both groupColumns and columns. */
|
|
12
|
+
key: string;
|
|
13
|
+
/** Content of the column header. */
|
|
14
|
+
header: ReactNode;
|
|
15
|
+
/** Declared width in px. Applied to the `col`, the header cell and the body cell. */
|
|
16
|
+
width: number;
|
|
17
|
+
/**
|
|
18
|
+
* Pins the column at the logical start. Only a contiguous prefix of
|
|
19
|
+
* `groupColumns` followed by `columns` can be pinned; a later marker is
|
|
20
|
+
* ignored and warned about in development.
|
|
21
|
+
*/
|
|
22
|
+
pinned?: MatrixTablePinnedSide;
|
|
23
|
+
/**
|
|
24
|
+
* Alignment of this column's header and body cells. Defaults to the matrix
|
|
25
|
+
* defaults: `center` for detail columns, whose values are short and read as a
|
|
26
|
+
* grid, and `start` for group columns, which hold blocks of text.
|
|
27
|
+
*/
|
|
28
|
+
align?: MatrixTableAlign;
|
|
29
|
+
/** Class added to this column's header and body cells; modifiers may take precedence. */
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/** A column whose single cell spans every detail row of its group. */
|
|
33
|
+
export interface MatrixTableGroupColumn<TGroup> extends MatrixTableColumnBase {
|
|
34
|
+
/** Receives its own definition too, so one factory can serve many columns. */
|
|
35
|
+
renderGroupCell: (group: TGroup, column: MatrixTableGroupColumn<TGroup>) => ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/** A column that renders one cell per detail row. */
|
|
38
|
+
export interface MatrixTableColumn<TGroup, TRow> extends MatrixTableColumnBase {
|
|
39
|
+
/**
|
|
40
|
+
* Receives the row, its group and the column itself. The third argument is
|
|
41
|
+
* what lets a shared handler build a full payload — which row, which group,
|
|
42
|
+
* which column — without a closure per column.
|
|
43
|
+
*/
|
|
44
|
+
renderCell: (row: TRow, group: TGroup, column: MatrixTableColumn<TGroup, TRow>) => ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Renders the cell as the row's header (`th scope="row"`). Opt in for the
|
|
47
|
+
* value that names the row — a component name, a code — not for data.
|
|
48
|
+
*/
|
|
49
|
+
isRowHeader?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** Grouped matrix data and native attributes applied to the root div. */
|
|
52
|
+
export interface MatrixTableProps<TGroup, TRow> extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML'> {
|
|
53
|
+
/** Consumer-owned group data. Never mutated, never copied into state. */
|
|
54
|
+
groups: readonly TGroup[];
|
|
55
|
+
/** Columns rendered once per group, spanning its detail rows. */
|
|
56
|
+
groupColumns: readonly MatrixTableGroupColumn<TGroup>[];
|
|
57
|
+
/** Columns rendered once per detail row. The scrolling matrix axis. */
|
|
58
|
+
columns: readonly MatrixTableColumn<TGroup, TRow>[];
|
|
59
|
+
/** Stable identity, unique within groups. */
|
|
60
|
+
getGroupKey: (group: TGroup) => Key;
|
|
61
|
+
/** Detail rows belonging to a group; an empty collection is supported. */
|
|
62
|
+
getRows: (group: TGroup) => readonly TRow[];
|
|
63
|
+
/** Stable detail-row identity, unique within its group. */
|
|
64
|
+
getRowKey: (row: TRow, group: TGroup) => Key;
|
|
65
|
+
/** Accessible name of the table and of its scroll region. Required. */
|
|
66
|
+
accessibleLabel: string;
|
|
67
|
+
/** Content of a spanning body cell when groups is empty. */
|
|
68
|
+
emptyContent?: ReactNode;
|
|
69
|
+
/** Exposed as `aria-busy`. The component ships no loader and no copy. */
|
|
70
|
+
isBusy?: boolean;
|
|
71
|
+
/** Class added to the root div alongside the component's own class. */
|
|
72
|
+
className?: string;
|
|
73
|
+
}
|
|
74
|
+
/** A grouped matrix table; ref and native div attributes target the root container. */
|
|
75
|
+
declare const MatrixTable: <TGroup, TRow>(props: MatrixTableProps<TGroup, TRow> & RefAttributes<HTMLDivElement>) => ReactElement;
|
|
76
|
+
export default MatrixTable;
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ import DropdownButton from './components/dropdown-button/DropdownButton';
|
|
|
25
25
|
import Heading from './components/heading/Heading';
|
|
26
26
|
import Link from './components/link/Link';
|
|
27
27
|
import Loading from './components/loading/Loading';
|
|
28
|
+
import MatrixTable from './components/matrix-table';
|
|
28
29
|
import Menu from './components/menu/Menu';
|
|
29
30
|
import Modal from './components/modal/Modal';
|
|
30
31
|
import Pager from './components/pager/Pager';
|
|
@@ -60,13 +61,14 @@ import AccessPanel from './components/access-panel/AccessPanel';
|
|
|
60
61
|
import AccountMenu from './components/account-menu/AccountMenu';
|
|
61
62
|
import Header from './components/header/Header';
|
|
62
63
|
import HeaderNavigation from './components/header-navigation';
|
|
64
|
+
import ContextualNavigation from './components/contextual-navigation';
|
|
63
65
|
import NavList from './components/nav-list';
|
|
64
66
|
import { toast } from 'react-toastify';
|
|
65
67
|
/**
|
|
66
68
|
* Hooks
|
|
67
69
|
*/
|
|
68
70
|
export { useFloatingPortal } from './hooks/useFloatingPortal';
|
|
69
|
-
export { Banner, Beacon, Header, HeaderNavigation, Hotspot, NavList, Drawer, AccessPanel, AccountMenu, SidebarMenu, Weekly, WeeklyGroup, Accordion, Box, Breadcrumbs, Button, Card, CardAccordion, CardNotification, Checkbox, DataCard, DataTable, DatePicker, Divider, Dropzone, FileUpload, Donut, DonutLabels, DonutLegend, DropdownButton, Heading, Link, Loading, Menu, Modal, Pager, Pill, PreviewerMarkdown, Processing, ProgressBar, RadioButton, RoundButton, Select, SelectPagination, SkeletonBase, SkeletonCircle, Stepper, Switch, Tabs, Tag, Text, TextField, Textarea, ThemeProvider, ThemeStore, LocaleStore, Timer, Toaster, Tooltip, Table, toast, };
|
|
71
|
+
export { Banner, Beacon, Header, HeaderNavigation, ContextualNavigation, Hotspot, NavList, Drawer, AccessPanel, AccountMenu, SidebarMenu, Weekly, WeeklyGroup, Accordion, Box, Breadcrumbs, Button, Card, CardAccordion, CardNotification, Checkbox, DataCard, DataTable, DatePicker, Divider, Dropzone, FileUpload, Donut, DonutLabels, DonutLegend, DropdownButton, Heading, Link, Loading, MatrixTable, Menu, Modal, Pager, Pill, PreviewerMarkdown, Processing, ProgressBar, RadioButton, RoundButton, Select, SelectPagination, SkeletonBase, SkeletonCircle, Stepper, Switch, Tabs, Tag, Text, TextField, Textarea, ThemeProvider, ThemeStore, LocaleStore, Timer, Toaster, Tooltip, Table, toast, };
|
|
70
72
|
/**
|
|
71
73
|
* Types
|
|
72
74
|
*/
|
|
@@ -82,7 +84,9 @@ export type { DropzoneDisplay, DropzoneProps, DropzoneUploadStatus, } from './co
|
|
|
82
84
|
export type { FileUploadProps } from './components/file-upload/FileUpload';
|
|
83
85
|
export type { HeadingProps } from './components/heading/Heading';
|
|
84
86
|
export type { HeaderNavigationProps, HeaderNavigationVisual, } from './components/header-navigation';
|
|
87
|
+
export type { ContextualNavigationProps, ContextualNavigationItem, } from './components/contextual-navigation';
|
|
85
88
|
export type { LinkProps } from './components/link/Link';
|
|
89
|
+
export type { MatrixTableAlign, MatrixTableColumn, MatrixTableGroupColumn, MatrixTablePinnedSide, MatrixTableProps, } from './components/matrix-table';
|
|
86
90
|
export type { MenuItem } from './types/menu.types';
|
|
87
91
|
export type { RoundButtonProps } from './components/round-button/RoundButton';
|
|
88
92
|
export type { SelectProps } from './components/select/Select';
|