@mezzanine-ui/react 1.0.0-alpha.0 → 1.0.0-beta.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/Breadcrumb/Breadcrumb.js +40 -12
- package/Breadcrumb/typings.d.ts +8 -3
- package/Drawer/Drawer.d.ts +47 -6
- package/Drawer/Drawer.js +36 -11
- package/Empty/Empty.js +26 -3
- package/Empty/typings.d.ts +16 -7
- package/PageHeader/PageHeader.d.ts +5 -1
- package/PageHeader/PageHeader.js +8 -3
- package/PageToolbar/PageToolbar.d.ts +73 -26
- package/PageToolbar/PageToolbar.js +10 -101
- package/PageToolbar/utils.d.ts +23 -0
- package/PageToolbar/utils.js +165 -0
- package/Pagination/PaginationItem.js +1 -3
- package/Pagination/usePagination.js +0 -18
- package/Radio/Radio.d.ts +36 -3
- package/Radio/Radio.js +21 -11
- package/Radio/RadioGroup.d.ts +36 -7
- package/Radio/RadioGroup.js +5 -4
- package/Radio/RadioGroupContext.d.ts +2 -1
- package/Radio/index.d.ts +3 -3
- package/Tab/Tab.d.ts +32 -0
- package/Tab/Tab.js +57 -0
- package/Tab/TabItem.d.ts +27 -0
- package/Tab/TabItem.js +18 -0
- package/Tab/index.d.ts +4 -0
- package/Tab/index.js +2 -0
- package/Table/Table.d.ts +75 -94
- package/Table/Table.js +216 -161
- package/Table/TableContext.d.ts +114 -51
- package/Table/TableContext.js +21 -3
- package/Table/components/TableBody.d.ts +5 -0
- package/Table/components/TableBody.js +102 -0
- package/Table/components/TableCell.d.ts +17 -0
- package/Table/components/TableCell.js +74 -0
- package/Table/components/TableColGroup.d.ts +4 -0
- package/Table/components/TableColGroup.js +206 -0
- package/Table/components/TableDragHandleCell.d.ts +9 -0
- package/Table/components/TableDragHandleCell.js +37 -0
- package/Table/components/TableExpandCell.d.ts +11 -0
- package/Table/components/TableExpandCell.js +44 -0
- package/Table/components/TableExpandedRow.d.ts +9 -0
- package/Table/components/TableExpandedRow.js +46 -0
- package/Table/components/TableHeader.d.ts +4 -0
- package/Table/components/TableHeader.js +125 -0
- package/Table/components/TablePagination.d.ts +3 -0
- package/Table/components/TablePagination.js +11 -0
- package/Table/components/TableResizeHandle.d.ts +13 -0
- package/Table/components/TableResizeHandle.js +115 -0
- package/Table/components/TableRow.d.ts +12 -0
- package/Table/components/TableRow.js +126 -0
- package/Table/components/TableSelectionCell.d.ts +13 -0
- package/Table/components/TableSelectionCell.js +35 -0
- package/Table/components/index.d.ts +10 -0
- package/Table/components/index.js +10 -0
- package/Table/hooks/index.d.ts +9 -0
- package/Table/hooks/index.js +8 -0
- package/Table/hooks/typings.d.ts +14 -0
- package/Table/hooks/useTableColumns.d.ts +8 -0
- package/Table/hooks/useTableColumns.js +91 -0
- package/Table/hooks/useTableDataSource.d.ts +57 -0
- package/Table/hooks/useTableDataSource.js +183 -0
- package/Table/hooks/useTableExpansion.d.ts +7 -0
- package/Table/hooks/useTableExpansion.js +52 -0
- package/Table/hooks/useTableFixedOffsets.d.ts +29 -0
- package/Table/hooks/useTableFixedOffsets.js +241 -0
- package/Table/hooks/useTableScroll.d.ts +12 -0
- package/Table/hooks/useTableScroll.js +58 -0
- package/Table/hooks/useTableSelection.d.ts +7 -0
- package/Table/hooks/useTableSelection.js +94 -0
- package/Table/hooks/useTableSorting.d.ts +6 -0
- package/Table/hooks/useTableSorting.js +32 -0
- package/Table/hooks/useTableVirtualization.d.ts +22 -0
- package/Table/hooks/useTableVirtualization.js +115 -0
- package/Table/index.d.ts +7 -10
- package/Table/index.js +22 -6
- package/Table/utils/index.d.ts +2 -0
- package/Table/utils/index.js +1 -0
- package/Table/utils/useTableRowSelection.d.ts +18 -0
- package/Table/utils/useTableRowSelection.js +63 -0
- package/_internal/InputCheck/InputCheck.d.ts +15 -1
- package/_internal/InputCheck/InputCheck.js +6 -2
- package/_internal/InputCheck/InputCheckGroup.d.ts +11 -1
- package/_internal/InputCheck/InputCheckGroup.js +4 -2
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.d.ts +1 -1
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +1 -1
- package/index.d.ts +7 -5
- package/index.js +6 -9
- package/package.json +5 -4
- package/utils/flatten-children.d.ts +12 -0
- package/utils/flatten-children.js +37 -0
- package/utils/get-css-variable-value.d.ts +1 -0
- package/utils/get-css-variable-value.js +4 -1
- package/Table/TableBody.d.ts +0 -10
- package/Table/TableBody.js +0 -31
- package/Table/TableBodyRow.d.ts +0 -11
- package/Table/TableBodyRow.js +0 -65
- package/Table/TableCell.d.ts +0 -19
- package/Table/TableCell.js +0 -24
- package/Table/TableExpandedTable.d.ts +0 -11
- package/Table/TableExpandedTable.js +0 -29
- package/Table/TableHeader.d.ts +0 -3
- package/Table/TableHeader.js +0 -36
- package/Table/draggable/useTableDraggable.d.ts +0 -14
- package/Table/draggable/useTableDraggable.js +0 -64
- package/Table/editable/TableEditRenderWrapper.d.ts +0 -7
- package/Table/editable/TableEditRenderWrapper.js +0 -16
- package/Table/expandable/TableExpandable.d.ts +0 -27
- package/Table/expandable/TableExpandable.js +0 -24
- package/Table/pagination/TablePagination.d.ts +0 -10
- package/Table/pagination/TablePagination.js +0 -26
- package/Table/pagination/useTablePagination.d.ts +0 -8
- package/Table/pagination/useTablePagination.js +0 -30
- package/Table/refresh/TableRefresh.d.ts +0 -10
- package/Table/refresh/TableRefresh.js +0 -22
- package/Table/rowSelection/TableRowSelection.d.ts +0 -18
- package/Table/rowSelection/TableRowSelection.js +0 -93
- package/Table/rowSelection/useTableRowSelection.d.ts +0 -6
- package/Table/rowSelection/useTableRowSelection.js +0 -53
- package/Table/sorting/TableSortingIcon.d.ts +0 -10
- package/Table/sorting/TableSortingIcon.js +0 -33
- package/Table/sorting/useTableSorting.d.ts +0 -11
- package/Table/sorting/useTableSorting.js +0 -121
- package/Table/useTableFetchMore.d.ts +0 -10
- package/Table/useTableFetchMore.js +0 -50
- package/Table/useTableLoading.d.ts +0 -5
- package/Table/useTableLoading.js +0 -19
- package/Table/useTableScroll.d.ts +0 -592
- package/Table/useTableScroll.js +0 -296
- package/Tabs/Tab.d.ts +0 -18
- package/Tabs/Tab.js +0 -16
- package/Tabs/TabPane.d.ts +0 -14
- package/Tabs/TabPane.js +0 -19
- package/Tabs/Tabs.d.ts +0 -39
- package/Tabs/Tabs.js +0 -52
- package/Tabs/index.d.ts +0 -6
- package/Tabs/index.js +0 -3
- package/Tabs/useTabsOverflow.d.ts +0 -8
- package/Tabs/useTabsOverflow.js +0 -62
package/Breadcrumb/Breadcrumb.js
CHANGED
|
@@ -1,25 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef } from 'react';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import { SlashIcon } from '@mezzanine-ui/icons';
|
|
4
4
|
import { breadcrumbClasses } from '@mezzanine-ui/core/breadcrumb';
|
|
5
5
|
import BreadcrumbItem from './BreadcrumbItem.js';
|
|
6
|
+
import { flattenChildren } from '../utils/flatten-children.js';
|
|
6
7
|
import Icon from '../Icon/Icon.js';
|
|
7
8
|
import cx from 'clsx';
|
|
8
9
|
|
|
10
|
+
const renderItemWithProps = (item, appendProps) => {
|
|
11
|
+
if (isValidElement(item)) {
|
|
12
|
+
return cloneElement(item, appendProps);
|
|
13
|
+
}
|
|
14
|
+
return jsx(BreadcrumbItem, { ...item, ...appendProps });
|
|
15
|
+
};
|
|
16
|
+
const renderItems = (items, condensed) => {
|
|
17
|
+
if (!items) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const lastIndex = items.length - 1;
|
|
21
|
+
return (jsxs(Fragment, { children: [!condensed &&
|
|
22
|
+
lastIndex >= 0 &&
|
|
23
|
+
renderItemWithProps(items[0], { current: lastIndex === 0 }), !condensed && lastIndex >= 1 && (jsxs(Fragment, { children: [jsx(Icon, { icon: SlashIcon, size: 14 }), renderItemWithProps(items[1], { current: lastIndex === 1 })] })), !condensed && items.length <= 4 && (jsxs(Fragment, { children: [lastIndex >= 2 && (jsxs(Fragment, { children: [jsx(Icon, { icon: SlashIcon, size: 14 }), renderItemWithProps(items[2], { current: lastIndex === 2 })] })), lastIndex === 3 && (jsxs(Fragment, { children: [jsx(Icon, { icon: SlashIcon, size: 14 }), renderItemWithProps(items[3], { current: true })] }))] })), (items.length > 4 || condensed) && (jsxs(Fragment, { children: [!condensed && jsx(Icon, { icon: SlashIcon, size: 14 }), (!condensed || items.length > 2) && (jsxs(Fragment, { children: [jsx(BreadcrumbItem, { options: (condensed
|
|
24
|
+
? items.slice(0, lastIndex - 1)
|
|
25
|
+
: items.slice(2, lastIndex - 1)).map((item) => {
|
|
26
|
+
if (isValidElement(item)) {
|
|
27
|
+
const { props } = item;
|
|
28
|
+
return {
|
|
29
|
+
label: props.label,
|
|
30
|
+
href: props.href,
|
|
31
|
+
target: props.target,
|
|
32
|
+
id: props.id,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
label: item.label,
|
|
37
|
+
href: item.href,
|
|
38
|
+
target: item.target,
|
|
39
|
+
id: item.id,
|
|
40
|
+
};
|
|
41
|
+
}) }), jsx(Icon, { icon: SlashIcon, size: 14 })] })), lastIndex - 1 >= 0 && (jsxs(Fragment, { children: [renderItemWithProps(items[lastIndex - 1]), jsx(Icon, { icon: SlashIcon, size: 14 })] })), renderItemWithProps(items[lastIndex], { current: true })] }))] }));
|
|
42
|
+
};
|
|
9
43
|
/**
|
|
10
44
|
* The react component for `mezzanine` breadcrumb.
|
|
11
45
|
*/
|
|
12
46
|
const Breadcrumb = forwardRef(function Breadcrumb(props, ref) {
|
|
13
|
-
const { className, condensed, items, ...rest } = props;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
: items.slice(2, lastIndex - 1)).map((item) => ({
|
|
18
|
-
label: item.label,
|
|
19
|
-
href: item.href,
|
|
20
|
-
target: item.target,
|
|
21
|
-
id: item.id,
|
|
22
|
-
})) }), jsx(Icon, { icon: SlashIcon, size: 14 })] })), lastIndex - 1 >= 0 && (jsxs(Fragment, { children: [jsx(BreadcrumbItem, { ...items[lastIndex - 1] }), jsx(Icon, { icon: SlashIcon, size: 14 })] })), jsx(BreadcrumbItem, { ...items[lastIndex], current: true })] }))] }));
|
|
47
|
+
const { children, className, condensed, items, ...rest } = props;
|
|
48
|
+
const flatChildren = flattenChildren(children);
|
|
49
|
+
const itemFragment = renderItems(items || flatChildren, condensed);
|
|
50
|
+
return (jsx("nav", { ...rest, "aria-label": "Breadcrumb", className: cx(breadcrumbClasses.host, className), ref: ref, children: itemFragment }));
|
|
23
51
|
});
|
|
24
52
|
|
|
25
53
|
export { Breadcrumb as default };
|
package/Breadcrumb/typings.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import type { JSXElementConstructor } from 'react';
|
|
1
|
+
import type { JSXElementConstructor, ReactElement } from 'react';
|
|
2
2
|
import type { ComponentOverridableForwardRefComponentPropsFactory, NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type BreadcrumbProps = Omit<NativeElementPropsWithoutKeyAndRef<'nav'>, 'children'> & ({
|
|
4
4
|
/**
|
|
5
5
|
* Display only the last two items with an ellipsis dropdown for all previous items
|
|
6
6
|
*/
|
|
7
7
|
condensed?: boolean;
|
|
8
8
|
items: Array<BreadcrumbItemProps>;
|
|
9
|
-
|
|
9
|
+
children?: never;
|
|
10
|
+
} | {
|
|
11
|
+
condensed?: boolean;
|
|
12
|
+
items?: never;
|
|
13
|
+
children: ReactElement<BreadcrumbItemProps> | ReactElement<BreadcrumbItemProps>[];
|
|
14
|
+
});
|
|
10
15
|
export type BreadcrumbItemComponent = 'a' | 'button' | JSXElementConstructor<any>;
|
|
11
16
|
export type BreadcrumbItemProps<C extends BreadcrumbItemComponent = 'button'> = ComponentOverridableForwardRefComponentPropsFactory<BreadcrumbItemComponent, C, BreadcrumbDropdownItemProps | BreadcrumbItemTextProps | BreadcrumbLinkItemProps>;
|
|
12
17
|
export type BreadcrumbDropdownItemProps = Omit<NativeElementPropsWithoutKeyAndRef<'button'>, 'children'> & {
|
package/Drawer/Drawer.d.ts
CHANGED
|
@@ -1,12 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SlideFadeOverlayProps } from '../_internal/SlideFadeOverlay';
|
|
1
|
+
import { DrawerSize } from '@mezzanine-ui/core/drawer';
|
|
3
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
|
-
|
|
3
|
+
import { BackdropProps } from '../Backdrop';
|
|
4
|
+
export interface DrawerProps extends NativeElementPropsWithoutKeyAndRef<'div'>, Pick<BackdropProps, 'container' | 'disableCloseOnBackdropClick' | 'disablePortal' | 'onBackdropClick' | 'onClose' | 'open'> {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @default 'left'
|
|
6
|
+
* Text for the ghost action button in the bottom action area.
|
|
8
7
|
*/
|
|
9
|
-
|
|
8
|
+
bottomGhostActionText?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Click handler for the ghost action button in the bottom action area.
|
|
11
|
+
*/
|
|
12
|
+
bottomOnGhostActionClick?: VoidFunction;
|
|
13
|
+
/**
|
|
14
|
+
* Click handler for the primary action button in the bottom action area.
|
|
15
|
+
*/
|
|
16
|
+
bottomOnPrimaryActionClick?: VoidFunction;
|
|
17
|
+
/**
|
|
18
|
+
* Click handler for the secondary action button in the bottom action area.
|
|
19
|
+
*/
|
|
20
|
+
bottomOnSecondaryActionClick?: VoidFunction;
|
|
21
|
+
/**
|
|
22
|
+
* Text for the primary action button in the bottom action area.
|
|
23
|
+
*/
|
|
24
|
+
bottomPrimaryActionText?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Text for the secondary action button in the bottom action area.
|
|
27
|
+
*/
|
|
28
|
+
bottomSecondaryActionText?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Controls whether to disable closing drawer while escape key down.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
disableCloseOnEscapeKeyDown?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Title text displayed in the drawer header.
|
|
36
|
+
*/
|
|
37
|
+
headerTitle?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Controls whether to display the bottom action area.
|
|
40
|
+
*/
|
|
41
|
+
isBottomDisplay?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Controls whether to display the header area.
|
|
44
|
+
*/
|
|
45
|
+
isHeaderDisplay?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Controls the width of the drawer.
|
|
48
|
+
* @default 'medium'
|
|
49
|
+
*/
|
|
50
|
+
size?: DrawerSize;
|
|
10
51
|
}
|
|
11
52
|
declare const Drawer: import("react").ForwardRefExoticComponent<DrawerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
53
|
export default Drawer;
|
package/Drawer/Drawer.js
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef,
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useState } from 'react';
|
|
3
3
|
import { drawerClasses } from '@mezzanine-ui/core/drawer';
|
|
4
|
-
import
|
|
4
|
+
import { useDocumentEscapeKeyDown } from '../hooks/useDocumentEscapeKeyDown.js';
|
|
5
|
+
import useTopStack from '../_internal/SlideFadeOverlay/useTopStack.js';
|
|
6
|
+
import ClearActions from '../ClearActions/ClearActions.js';
|
|
7
|
+
import Button from '../Button/Button.js';
|
|
8
|
+
import { MOTION_EASING, MOTION_DURATION } from '@mezzanine-ui/system/motion';
|
|
9
|
+
import Backdrop from '../Backdrop/Backdrop.js';
|
|
10
|
+
import Slide from '../Transition/Slide.js';
|
|
5
11
|
import cx from 'clsx';
|
|
6
12
|
|
|
7
13
|
const Drawer = forwardRef((props, ref) => {
|
|
8
|
-
const {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const { bottomGhostActionText, bottomOnGhostActionClick, bottomOnPrimaryActionClick, bottomOnSecondaryActionClick, bottomPrimaryActionText, bottomSecondaryActionText, children, className, container, disableCloseOnBackdropClick = false, disableCloseOnEscapeKeyDown = false, disablePortal, headerTitle, isBottomDisplay, isHeaderDisplay, onBackdropClick, onClose, open, size = 'medium', ...rest } = props;
|
|
15
|
+
const [exited, setExited] = useState(true);
|
|
16
|
+
/**
|
|
17
|
+
* Escape keydown close: escape will only close the top drawer
|
|
18
|
+
*/
|
|
19
|
+
const checkIsOnTheTop = useTopStack(open);
|
|
20
|
+
useDocumentEscapeKeyDown(() => {
|
|
21
|
+
if (!open || disableCloseOnEscapeKeyDown || !onClose) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
return (event) => {
|
|
25
|
+
if (checkIsOnTheTop()) {
|
|
26
|
+
event.stopPropagation();
|
|
27
|
+
onClose();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}, [disableCloseOnEscapeKeyDown, checkIsOnTheTop, open, onClose]);
|
|
31
|
+
if (!open && exited) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return (jsx(Backdrop, { className: drawerClasses.overlay, container: container, disableCloseOnBackdropClick: disableCloseOnBackdropClick, disablePortal: disablePortal, onBackdropClick: onBackdropClick, onClose: onClose, open: open, role: "presentation", children: jsx(Slide, { duration: {
|
|
35
|
+
enter: MOTION_DURATION.moderate,
|
|
36
|
+
exit: MOTION_DURATION.moderate,
|
|
37
|
+
}, easing: {
|
|
38
|
+
enter: MOTION_EASING.entrance,
|
|
39
|
+
exit: MOTION_EASING.exit,
|
|
40
|
+
}, in: open, onEntered: () => setExited(false), onExited: () => setExited(true), ref: ref, children: jsxs("div", { ...rest, className: cx(drawerClasses.host, drawerClasses.right, drawerClasses.size(size), className), children: [isHeaderDisplay && (jsxs("div", { className: drawerClasses.header, children: [headerTitle, jsx(ClearActions, { onClick: onClose })] })), jsx("div", { className: drawerClasses.content, children: children }), isBottomDisplay && (jsxs("div", { className: drawerClasses.bottom, children: [jsx("div", { children: bottomGhostActionText && bottomOnGhostActionClick && (jsx(Button, { onClick: bottomOnGhostActionClick, type: "button", variant: "base-ghost", children: bottomGhostActionText })) }), jsxs("div", { className: drawerClasses['bottom__actions'], children: [bottomSecondaryActionText && bottomOnSecondaryActionClick && (jsx(Button, { onClick: bottomOnSecondaryActionClick, type: "button", variant: "base-secondary", children: bottomSecondaryActionText })), bottomPrimaryActionText && bottomOnPrimaryActionClick && (jsx(Button, { onClick: bottomOnPrimaryActionClick, type: "button", variant: "base-primary", children: bottomPrimaryActionText }))] })] }))] }) }) }));
|
|
16
41
|
});
|
|
17
42
|
|
|
18
43
|
export { Drawer as default };
|
package/Empty/Empty.js
CHANGED
|
@@ -7,6 +7,7 @@ import ButtonGroup from '../Button/ButtonGroup.js';
|
|
|
7
7
|
import { EmptyMainInitialDataIcon } from './icons/EmptyMainInitialDataIcon.js';
|
|
8
8
|
import { EmptyMainResultIcon } from './icons/EmptyMainResultIcon.js';
|
|
9
9
|
import { EmptyMainSystemIcon } from './icons/EmptyMainSystemIcon.js';
|
|
10
|
+
import { flattenChildren } from '../utils/flatten-children.js';
|
|
10
11
|
import Icon from '../Icon/Icon.js';
|
|
11
12
|
import cx from 'clsx';
|
|
12
13
|
|
|
@@ -33,12 +34,34 @@ const renderButtonOrElement = (button, size, variant) => {
|
|
|
33
34
|
return jsx(Button, { ...button, size: size, variant: variant });
|
|
34
35
|
};
|
|
35
36
|
const Empty = forwardRef(function Empty(props, ref) {
|
|
36
|
-
const { actions, className, description, pictogram, size = 'main', title, type = 'initial-data', ...rest } = props;
|
|
37
|
+
const { actions, children, className, description, pictogram, size = 'main', title, type = 'initial-data', ...rest } = props;
|
|
37
38
|
const icon = (size === 'main'
|
|
38
39
|
? mainIconMap[type]
|
|
39
40
|
: iconMap[type] && (jsx(Icon, { className: emptyClasses.icon, icon: iconMap[type] }))) || null;
|
|
40
|
-
const
|
|
41
|
-
|
|
41
|
+
const flatChildren = flattenChildren(children);
|
|
42
|
+
const fragmentButtons = actions &&
|
|
43
|
+
('secondaryButton' in actions ? (jsxs(Fragment, { children: [renderButtonOrElement(actions.secondaryButton, size, 'base-secondary'), renderButtonOrElement(actions.primaryButton, size, 'base-primary')] })) : (renderButtonOrElement(actions, size, 'base-secondary')));
|
|
44
|
+
const renderChildren = !fragmentButtons &&
|
|
45
|
+
flatChildren.length > 0 &&
|
|
46
|
+
flatChildren.map((child, index) => {
|
|
47
|
+
if (!isValidElement(child)) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
else if (child.type === Button) {
|
|
51
|
+
switch (index) {
|
|
52
|
+
case 0:
|
|
53
|
+
return renderButtonOrElement(child, size, 'base-secondary');
|
|
54
|
+
case 1:
|
|
55
|
+
return renderButtonOrElement(child, size, 'base-primary');
|
|
56
|
+
default:
|
|
57
|
+
console.warn('Only up to two Button components are allowed as children of Empty.');
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
console.warn('Only Button components are allowed as children of Empty.');
|
|
62
|
+
return null;
|
|
63
|
+
});
|
|
64
|
+
return (jsx("div", { ...rest, className: cx(emptyClasses.host, emptyClasses.size(size), className), ref: ref, children: jsxs("div", { className: emptyClasses.container, children: [pictogram ? jsx("div", { className: emptyClasses.icon, children: pictogram }) : icon, jsx("p", { className: emptyClasses.title, children: title }), description && jsx("p", { className: emptyClasses.description, children: description }), (actions || children) && size !== 'minor' && (jsx(ButtonGroup, { className: emptyClasses.actions, children: fragmentButtons || renderChildren }))] }) }));
|
|
42
65
|
});
|
|
43
66
|
|
|
44
67
|
export { Empty as default };
|
package/Empty/typings.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button';
|
|
3
3
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
4
|
export interface BaseEmptyProps {
|
|
5
5
|
/**
|
|
@@ -25,13 +25,22 @@ export interface CustomPictogramEmptyProps {
|
|
|
25
25
|
}
|
|
26
26
|
export interface MainOrSubEmptyProps {
|
|
27
27
|
/**
|
|
28
|
-
* Action buttons configuration for primary and secondary actions.
|
|
29
|
-
* Renders buttons in the order: secondary (left or only one), primary (right).
|
|
28
|
+
* Action buttons configuration for primary and secondary actions. <br />
|
|
29
|
+
* Renders buttons in the order: secondary (left or only one), primary (right). <br />
|
|
30
|
+
* If actions provided, children will be ignored. <br />
|
|
30
31
|
*/
|
|
31
32
|
actions?: {
|
|
32
|
-
primaryButton?: ButtonProps
|
|
33
|
-
secondaryButton: ButtonProps
|
|
34
|
-
} | ButtonProps
|
|
33
|
+
primaryButton?: ButtonProps;
|
|
34
|
+
secondaryButton: ButtonProps;
|
|
35
|
+
} | ButtonProps;
|
|
36
|
+
/**
|
|
37
|
+
* Child button elements for actions. <br />
|
|
38
|
+
* Can be a single Button element or an array of one or two Button elements. <br />
|
|
39
|
+
* When using children, the first Button is treated as secondary and the second as primary. <br />
|
|
40
|
+
* If only one Button is provided, it is treated as secondary. <br />
|
|
41
|
+
* If actions provided, children will be ignored. <br />
|
|
42
|
+
*/
|
|
43
|
+
children?: ReactElement<ButtonProps> | [ReactElement<ButtonProps>] | [ReactElement<ButtonProps>, ReactElement<ButtonProps>];
|
|
35
44
|
/**
|
|
36
45
|
* Optional description text displayed below the title.
|
|
37
46
|
* Provides additional context or details about the empty state.
|
|
@@ -4,12 +4,14 @@ import { ButtonProps } from '../Button';
|
|
|
4
4
|
import { PageToolbarProps } from '../PageToolbar';
|
|
5
5
|
import { TypographyProps } from '../Typography';
|
|
6
6
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
7
|
-
type PageHeaderChild = ReactElement<BreadcrumbProps> | ReactElement<PageToolbarProps> | ReactElement<ButtonProps> | ReactElement<HTMLAttributes<HTMLAnchorElement
|
|
7
|
+
type PageHeaderChild = ReactElement<BreadcrumbProps> | ReactElement<PageToolbarProps> | ReactElement<ButtonProps> | ReactElement<HTMLAttributes<HTMLAnchorElement>> | null | undefined | false;
|
|
8
8
|
/**
|
|
9
9
|
* Props for the PageHeader component.
|
|
10
10
|
* Extends native HTML header element props.
|
|
11
11
|
*/
|
|
12
12
|
export type PageHeaderProps = NativeElementPropsWithoutKeyAndRef<'header'> & {
|
|
13
|
+
/** Optional back button properties */
|
|
14
|
+
onBackClick?: () => void;
|
|
13
15
|
/** Optional description text displayed below the title */
|
|
14
16
|
description?: string;
|
|
15
17
|
/** Main title text for the page header */
|
|
@@ -24,6 +26,8 @@ export type PageHeaderProps = NativeElementPropsWithoutKeyAndRef<'header'> & {
|
|
|
24
26
|
* description, back button, and action toolbar.
|
|
25
27
|
*/
|
|
26
28
|
declare const PageHeader: import("react").ForwardRefExoticComponent<NativeElementPropsWithoutKeyAndRef<"header"> & {
|
|
29
|
+
/** Optional back button properties */
|
|
30
|
+
onBackClick?: () => void;
|
|
27
31
|
/** Optional description text displayed below the title */
|
|
28
32
|
description?: string;
|
|
29
33
|
/** Main title text for the page header */
|
package/PageHeader/PageHeader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef, Children, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import { ChevronLeftIcon } from '@mezzanine-ui/icons';
|
|
4
4
|
import { pageHeaderClasses } from '@mezzanine-ui/core/page-header';
|
|
@@ -57,9 +57,14 @@ const getBreadcrumbAndToolbar = (children) => {
|
|
|
57
57
|
* description, back button, and action toolbar.
|
|
58
58
|
*/
|
|
59
59
|
const PageHeader = forwardRef(function PageHeader(props, ref) {
|
|
60
|
-
const { children, className, description, title, titleComponent = 'h2', ...rest } = props;
|
|
60
|
+
const { children, className, description, onBackClick, title, titleComponent = 'h2', ...rest } = props;
|
|
61
61
|
const { backButtonOrLink, breadcrumb, pageToolbar } = getBreadcrumbAndToolbar(children);
|
|
62
|
-
|
|
62
|
+
// prop onBack takes precedence over backButtonOrLink
|
|
63
|
+
const backButton = onBackClick ? (jsx(Button, { icon: {
|
|
64
|
+
position: 'icon-only',
|
|
65
|
+
src: ChevronLeftIcon,
|
|
66
|
+
}, onClick: onBackClick, size: "sub", variant: "base-tertiary" })) : (backButtonOrLink);
|
|
67
|
+
return (jsxs("header", { ...rest, className: cx(pageHeaderClasses.host, className), ref: ref, children: [breadcrumb, jsxs("span", { className: pageHeaderClasses.headerContent, children: [jsxs("span", { className: pageHeaderClasses.pageTitleWithIcon, children: [backButton && jsx("div", { children: backButton }), jsxs("div", { className: pageHeaderClasses.pageTitleText, children: [jsx(Typography, { align: "left", color: "text-neutral-solid", component: titleComponent, variant: "h2", children: title }), description && (jsx(Typography, { align: "left", color: "text-neutral", component: "p", variant: "caption", children: description }))] })] }), pageToolbar] })] }));
|
|
63
68
|
});
|
|
64
69
|
|
|
65
70
|
export { PageHeader as default };
|
|
@@ -1,67 +1,114 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonProps } from '../Button';
|
|
3
3
|
import { SearchInputProps } from '../Input';
|
|
4
4
|
import { SelectProps } from '../Select';
|
|
5
5
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
6
|
+
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
6
7
|
type SegmentedControlProps = {
|
|
7
8
|
mock: 'SegmentedControlProps';
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
* Actions configuration for PageToolbar.
|
|
11
|
-
* Can be either an object with specific button types or a single button element/props.
|
|
12
|
-
*/
|
|
13
|
-
type PageToolbarActions = {
|
|
14
|
-
destructiveButton?: ReactElement<ButtonProps> | ButtonProps;
|
|
15
|
-
primaryButton?: ReactElement<ButtonProps> | ButtonProps;
|
|
16
|
-
secondaryButton?: ReactElement<ButtonProps> | ButtonProps;
|
|
17
|
-
} | ReactElement<ButtonProps> | ButtonProps;
|
|
10
|
+
type PageToolbarChild = ReactElement<SearchInputProps | SelectProps | SegmentedControlProps | ButtonProps> | null | false | undefined;
|
|
18
11
|
/**
|
|
19
12
|
* Props for the PageToolbar component.
|
|
13
|
+
*
|
|
14
|
+
* PageToolbar provides a flexible toolbar layout for page-level actions,
|
|
15
|
+
* including filter components, action buttons, and utility buttons.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <PageToolbar
|
|
20
|
+
* size="main"
|
|
21
|
+
* filter={{ variant: 'search', placeholder: 'Search...' }}
|
|
22
|
+
* actions={{
|
|
23
|
+
* primaryButton: { children: 'Save' },
|
|
24
|
+
* secondaryButton: { children: 'Cancel' },
|
|
25
|
+
* }}
|
|
26
|
+
* utilities={[{ icon: { src: settingsIcon }, title: 'Settings' }]}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
20
29
|
*/
|
|
21
|
-
export type PageToolbarProps = NativeElementPropsWithoutKeyAndRef<'div'> & {
|
|
30
|
+
export type PageToolbarProps = Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'children'> & {
|
|
22
31
|
/**
|
|
23
32
|
* Button configuration for primary, secondary, and destructive actions. <br />
|
|
24
33
|
* Automatically applies proper styling and order. <br />
|
|
25
34
|
*/
|
|
26
|
-
actions
|
|
35
|
+
actions?: {
|
|
36
|
+
destructiveButton?: ButtonProps;
|
|
37
|
+
primaryButton?: ButtonProps;
|
|
38
|
+
secondaryButton?: ButtonProps;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Children elements: <br />
|
|
42
|
+
* - Filter component (SearchInput, Select, or SegmentedControl) <br />
|
|
43
|
+
* - Action buttons `<Button />` <br />
|
|
44
|
+
* - Icon-only utility buttons `<Button icon="..." />` <br />
|
|
45
|
+
* <br />
|
|
46
|
+
* Can mix and match the above children. <br />
|
|
47
|
+
* The order of children does not matter as they will be arranged properly. <br />
|
|
48
|
+
* When conflicting with other props, props take priority over children. <br />
|
|
49
|
+
*/
|
|
50
|
+
children?: PageToolbarChild[] | PageToolbarChild;
|
|
27
51
|
/** Filter component (SearchInput, Select, or SegmentedControl) */
|
|
28
|
-
filter?:
|
|
52
|
+
filter?: {
|
|
53
|
+
variant: 'search' | 'select' | 'segmentedControl';
|
|
54
|
+
} & (SearchInputProps | SelectProps | SegmentedControlProps);
|
|
29
55
|
/**
|
|
30
56
|
* Size variant of the toolbar. <br />
|
|
31
57
|
* Affects the size of buttons and filter component. <br />
|
|
32
58
|
*/
|
|
33
59
|
size?: 'main' | 'sub';
|
|
34
60
|
/**
|
|
35
|
-
* Icon-only utility buttons `<Button
|
|
36
|
-
*
|
|
37
|
-
* Supports a single Button or a Fragment of Buttons. <br />
|
|
38
|
-
* `<> <Button ... /> <Button ... /> </>` <br />
|
|
61
|
+
* Icon-only utility buttons `<Button icon="..." />`. <br />
|
|
62
|
+
* They usually appear as smaller buttons with only an icon and no text.
|
|
39
63
|
*/
|
|
40
|
-
utilities?:
|
|
64
|
+
utilities?: (ButtonProps & {
|
|
65
|
+
icon: {
|
|
66
|
+
src: IconDefinition;
|
|
67
|
+
};
|
|
68
|
+
})[];
|
|
41
69
|
};
|
|
42
70
|
/**
|
|
43
71
|
* PageToolbar component provides a flexible toolbar with filter, action buttons, and utility icons.
|
|
44
72
|
* Commonly used in page headers for primary user actions.
|
|
45
73
|
*/
|
|
46
|
-
declare const PageToolbar: import("react").ForwardRefExoticComponent<NativeElementPropsWithoutKeyAndRef<"div"> & {
|
|
74
|
+
declare const PageToolbar: import("react").ForwardRefExoticComponent<Omit<NativeElementPropsWithoutKeyAndRef<"div">, "children"> & {
|
|
47
75
|
/**
|
|
48
76
|
* Button configuration for primary, secondary, and destructive actions. <br />
|
|
49
77
|
* Automatically applies proper styling and order. <br />
|
|
50
78
|
*/
|
|
51
|
-
actions
|
|
79
|
+
actions?: {
|
|
80
|
+
destructiveButton?: ButtonProps;
|
|
81
|
+
primaryButton?: ButtonProps;
|
|
82
|
+
secondaryButton?: ButtonProps;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Children elements: <br />
|
|
86
|
+
* - Filter component (SearchInput, Select, or SegmentedControl) <br />
|
|
87
|
+
* - Action buttons `<Button />` <br />
|
|
88
|
+
* - Icon-only utility buttons `<Button icon="..." />` <br />
|
|
89
|
+
* <br />
|
|
90
|
+
* Can mix and match the above children. <br />
|
|
91
|
+
* The order of children does not matter as they will be arranged properly. <br />
|
|
92
|
+
* When conflicting with other props, props take priority over children. <br />
|
|
93
|
+
*/
|
|
94
|
+
children?: PageToolbarChild[] | PageToolbarChild;
|
|
52
95
|
/** Filter component (SearchInput, Select, or SegmentedControl) */
|
|
53
|
-
filter?:
|
|
96
|
+
filter?: {
|
|
97
|
+
variant: "search" | "select" | "segmentedControl";
|
|
98
|
+
} & (SearchInputProps | SelectProps | SegmentedControlProps);
|
|
54
99
|
/**
|
|
55
100
|
* Size variant of the toolbar. <br />
|
|
56
101
|
* Affects the size of buttons and filter component. <br />
|
|
57
102
|
*/
|
|
58
103
|
size?: "main" | "sub";
|
|
59
104
|
/**
|
|
60
|
-
* Icon-only utility buttons `<Button
|
|
61
|
-
*
|
|
62
|
-
* Supports a single Button or a Fragment of Buttons. <br />
|
|
63
|
-
* `<> <Button ... /> <Button ... /> </>` <br />
|
|
105
|
+
* Icon-only utility buttons `<Button icon="..." />`. <br />
|
|
106
|
+
* They usually appear as smaller buttons with only an icon and no text.
|
|
64
107
|
*/
|
|
65
|
-
utilities?:
|
|
108
|
+
utilities?: (ButtonProps & {
|
|
109
|
+
icon: {
|
|
110
|
+
src: IconDefinition;
|
|
111
|
+
};
|
|
112
|
+
})[];
|
|
66
113
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
67
114
|
export default PageToolbar;
|
|
@@ -1,114 +1,23 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
3
|
import { pageToolbarClasses } from '@mezzanine-ui/core/page-toolbar';
|
|
4
|
-
import
|
|
4
|
+
import { renderFilterProp, renderActionsProp, renderIconButtonsProp, resolvePageToolbarChild } from './utils.js';
|
|
5
5
|
import ButtonGroup from '../Button/ButtonGroup.js';
|
|
6
|
-
import Tooltip from '../Tooltip/Tooltip.js';
|
|
7
6
|
import cx from 'clsx';
|
|
8
7
|
|
|
9
|
-
/**
|
|
10
|
-
* Renders a button from either ButtonProps or a React element.
|
|
11
|
-
* Applies the specified size and variant to the button.
|
|
12
|
-
*/
|
|
13
|
-
const renderButton = (button, size, variant) => {
|
|
14
|
-
if (!button) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
if (isValidElement(button)) {
|
|
18
|
-
return cloneElement(button, {
|
|
19
|
-
size,
|
|
20
|
-
variant,
|
|
21
|
-
key: variant,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return jsx(Button, { ...button, size: size, variant: variant }, variant);
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Clones filter component with the specified size prop.
|
|
28
|
-
*/
|
|
29
|
-
const withSize = (target, size) => {
|
|
30
|
-
if (!target) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
if (isValidElement(target)) {
|
|
34
|
-
return cloneElement(target, { size });
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Wraps an icon button with a Tooltip.
|
|
40
|
-
* Uses the button's title prop or children text as tooltip content.
|
|
41
|
-
*/
|
|
42
|
-
const createIconButtonWithTooltip = (child, size, index = 0) => {
|
|
43
|
-
const { children, title, ...childProps } = child.props;
|
|
44
|
-
const tooltipText = title || (typeof children === 'string' ? children : undefined);
|
|
45
|
-
return (jsx(Tooltip, { title: tooltipText, children: (tooltipProps) => cloneElement(child, {
|
|
46
|
-
...tooltipProps,
|
|
47
|
-
icon: childProps.icon
|
|
48
|
-
? {
|
|
49
|
-
...childProps.icon,
|
|
50
|
-
position: 'icon-only',
|
|
51
|
-
}
|
|
52
|
-
: undefined,
|
|
53
|
-
size,
|
|
54
|
-
title: undefined,
|
|
55
|
-
variant: 'base-secondary',
|
|
56
|
-
}) }, childProps.id || tooltipText || index));
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Renders utility icon buttons wrapped in tooltips.
|
|
60
|
-
* Handles both single Button elements and Fragment containing multiple Buttons.
|
|
61
|
-
*/
|
|
62
|
-
const renderIconButtons = (utilities, size) => {
|
|
63
|
-
if (!utilities) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
if (!isValidElement(utilities)) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
if (utilities.type === Fragment) {
|
|
70
|
-
const children = Children.map(utilities.props.children, (child, index) => {
|
|
71
|
-
if (!isValidElement(child) || child.type !== Button) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
return createIconButtonWithTooltip(child, size, index);
|
|
75
|
-
});
|
|
76
|
-
return children === null || children === void 0 ? void 0 : children.filter(Boolean);
|
|
77
|
-
}
|
|
78
|
-
if (utilities.type === Button) {
|
|
79
|
-
return createIconButtonWithTooltip(utilities, size);
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Renders action buttons based on the actions configuration.
|
|
85
|
-
* Supports both structured actions object and single button element/props.
|
|
86
|
-
*/
|
|
87
|
-
const renderActions = (actions, size) => {
|
|
88
|
-
if ('primaryButton' in actions ||
|
|
89
|
-
'secondaryButton' in actions ||
|
|
90
|
-
'destructiveButton' in actions) {
|
|
91
|
-
return [
|
|
92
|
-
renderButton(actions.destructiveButton, size, 'destructive-secondary'),
|
|
93
|
-
renderButton(actions.secondaryButton, size, 'base-secondary'),
|
|
94
|
-
renderButton(actions.primaryButton, size, 'base-primary'),
|
|
95
|
-
].filter(Boolean);
|
|
96
|
-
}
|
|
97
|
-
if (isValidElement(actions)) {
|
|
98
|
-
return renderButton(actions, size, 'base-primary');
|
|
99
|
-
}
|
|
100
|
-
return jsx(Button, { ...actions, size: size, variant: "base-primary" });
|
|
101
|
-
};
|
|
102
8
|
/**
|
|
103
9
|
* PageToolbar component provides a flexible toolbar with filter, action buttons, and utility icons.
|
|
104
10
|
* Commonly used in page headers for primary user actions.
|
|
105
11
|
*/
|
|
106
12
|
const PageToolbar = forwardRef(function PageToolbar(props, ref) {
|
|
107
|
-
const { actions, className, filter, size = 'main', utilities, ...rest } = props;
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
13
|
+
const { actions, children, className, filter, size = 'main', utilities, ...rest } = props;
|
|
14
|
+
const renderFilter = renderFilterProp(filter, size);
|
|
15
|
+
const renderActions = actions ? renderActionsProp(actions, size) : null;
|
|
16
|
+
const renderUtilities = utilities
|
|
17
|
+
? renderIconButtonsProp(utilities, size)
|
|
18
|
+
: null;
|
|
19
|
+
const { filter: filterFromChildren, actions: actionsFromChildren, utilities: utilitiesFromChildren, } = resolvePageToolbarChild(children, size);
|
|
20
|
+
return (jsxs("div", { ...rest, className: cx(pageToolbarClasses.host, pageToolbarClasses.size(size), className), ref: ref, children: [renderFilter || filterFromChildren, jsx(ButtonGroup, { children: renderActions || actionsFromChildren }), jsx(ButtonGroup, { children: renderUtilities || utilitiesFromChildren })] }));
|
|
112
21
|
});
|
|
113
22
|
|
|
114
23
|
export { PageToolbar as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps, ButtonGroupChild } from '../Button';
|
|
3
|
+
import { PageToolbarProps } from './PageToolbar';
|
|
4
|
+
type ToolbarButtonVariant = 'base-primary' | 'base-secondary' | 'destructive-secondary';
|
|
5
|
+
/**
|
|
6
|
+
* Renders a button from either ButtonProps or a React element.
|
|
7
|
+
* Applies the specified size and variant to the button.
|
|
8
|
+
*/
|
|
9
|
+
export declare const renderButton: (button: ButtonProps | ButtonGroupChild | undefined, size: ButtonProps["size"], variant: ToolbarButtonVariant) => ReactElement<ButtonProps> | null;
|
|
10
|
+
export declare const renderFilterProp: (prop: PageToolbarProps["filter"], size: "main" | "sub") => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export declare const renderIconButtonWithProps: (child: ReactElement<ButtonProps>, size: ButtonProps["size"]) => ReactElement<ButtonProps>;
|
|
12
|
+
export declare const renderIconButtonsProp: (utilities: PageToolbarProps["utilities"], size: ButtonProps["size"]) => ButtonGroupChild | ButtonGroupChild[];
|
|
13
|
+
/**
|
|
14
|
+
* Renders action buttons based on the actions configuration.
|
|
15
|
+
* Supports both structured actions object and single button element/props.
|
|
16
|
+
*/
|
|
17
|
+
export declare const renderActionsProp: (actions: PageToolbarProps["actions"], size: ButtonProps["size"]) => ButtonGroupChild | ButtonGroupChild[];
|
|
18
|
+
export declare const resolvePageToolbarChild: (children: PageToolbarProps["children"], size: "main" | "sub") => {
|
|
19
|
+
filter: null;
|
|
20
|
+
actions: [ButtonGroupChild, ButtonGroupChild, ButtonGroupChild];
|
|
21
|
+
utilities: ButtonGroupChild[];
|
|
22
|
+
};
|
|
23
|
+
export {};
|