@mezzanine-ui/react 1.0.0-beta.0 → 1.0.0-beta.2
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/Badge/Badge.js +2 -2
- package/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/Description/Description.d.ts +40 -0
- package/Description/Description.js +33 -0
- package/Description/DescriptionContent.d.ts +41 -0
- package/Description/DescriptionContent.js +14 -0
- package/Description/DescriptionGroup.d.ts +13 -0
- package/Description/DescriptionGroup.js +12 -0
- package/Description/DescriptionTitle.d.ts +45 -0
- package/Description/DescriptionTitle.js +17 -0
- package/Description/index.d.ts +8 -0
- package/Description/index.js +4 -0
- package/Dropdown/Dropdown.d.ts +128 -15
- package/Dropdown/Dropdown.js +273 -32
- package/Dropdown/DropdownAction.d.ts +50 -0
- package/Dropdown/DropdownAction.js +26 -0
- package/Dropdown/DropdownItem.d.ts +60 -0
- package/Dropdown/DropdownItem.js +318 -0
- package/Dropdown/DropdownItemCard.d.ts +96 -0
- package/Dropdown/DropdownItemCard.js +115 -0
- package/Dropdown/DropdownStatus.d.ts +22 -0
- package/Dropdown/dropdownKeydownHandler.d.ts +15 -0
- package/Dropdown/highlightText.d.ts +9 -0
- package/Dropdown/highlightText.js +32 -0
- package/Dropdown/index.d.ts +1 -1
- package/Form/FormControlContext.d.ts +2 -2
- package/Form/FormField.d.ts +56 -4
- package/Form/FormField.js +8 -6
- package/Form/FormHintText.d.ts +24 -1
- package/Form/FormHintText.js +4 -4
- package/Form/FormLabel.d.ts +6 -3
- package/Form/FormLabel.js +5 -3
- package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.js +1 -1
- package/Navigation/Navigation.d.ts +17 -14
- package/Navigation/Navigation.js +73 -41
- package/Navigation/NavigationFooter.d.ts +10 -0
- package/Navigation/NavigationFooter.js +28 -0
- package/Navigation/NavigationHeader.d.ts +14 -0
- package/Navigation/NavigationHeader.js +15 -0
- package/Navigation/NavigationIconButton.d.ts +15 -0
- package/Navigation/NavigationIconButton.js +12 -0
- package/Navigation/NavigationOption.d.ts +35 -0
- package/Navigation/NavigationOption.js +54 -0
- package/Navigation/NavigationOptionCategory.d.ts +6 -0
- package/Navigation/NavigationOptionCategory.js +29 -0
- package/Navigation/NavigationUserMenu.d.ts +8 -0
- package/Navigation/NavigationUserMenu.js +18 -0
- package/Navigation/context.d.ts +15 -0
- package/Navigation/context.js +7 -0
- package/Navigation/index.d.ts +12 -6
- package/Navigation/index.js +6 -3
- package/Navigation/useCurrentPathname.d.ts +1 -0
- package/Navigation/useCurrentPathname.js +14 -0
- package/Slider/useSlider.js +1 -1
- package/Table/Table.d.ts +53 -15
- package/Table/Table.js +178 -82
- package/Table/TableContext.d.ts +18 -42
- package/Table/components/TableActionsCell.d.ts +26 -0
- package/Table/components/TableActionsCell.js +78 -0
- package/Table/components/TableBody.d.ts +2 -5
- package/Table/components/TableBody.js +16 -19
- package/Table/components/TableBulkActions.d.ts +15 -0
- package/Table/components/TableBulkActions.js +44 -0
- package/Table/components/TableCell.d.ts +2 -0
- package/Table/components/TableCell.js +42 -10
- package/Table/components/TableColGroup.js +10 -112
- package/Table/components/TableColumnTitleMenu.d.ts +6 -0
- package/Table/components/TableColumnTitleMenu.js +20 -0
- package/Table/components/TableDragHandleCell.d.ts +2 -0
- package/Table/components/TableDragHandleCell.js +8 -1
- package/Table/components/TableExpandCell.d.ts +2 -0
- package/Table/components/TableExpandCell.js +8 -1
- package/Table/components/TableExpandedRow.js +3 -2
- package/Table/components/TableHeader.d.ts +2 -4
- package/Table/components/TableHeader.js +11 -14
- package/Table/components/TableResizeHandle.js +3 -7
- package/Table/components/TableRow.js +54 -20
- package/Table/components/TableSelectionCell.d.ts +5 -0
- package/Table/components/TableSelectionCell.js +12 -1
- package/Table/components/index.d.ts +1 -0
- package/Table/components/index.js +1 -0
- package/Table/hooks/index.d.ts +1 -1
- package/Table/hooks/index.js +1 -1
- package/Table/hooks/useTableDataSource.d.ts +2 -2
- package/Table/hooks/useTableExpansion.js +0 -6
- package/Table/hooks/useTableFixedOffsets.d.ts +1 -1
- package/Table/hooks/useTableFixedOffsets.js +19 -21
- package/Table/hooks/useTableResizedColumns.d.ts +2 -0
- package/Table/hooks/useTableResizedColumns.js +22 -0
- package/Table/hooks/useTableScroll.d.ts +3 -1
- package/Table/hooks/useTableScroll.js +25 -19
- package/Table/hooks/useTableSelection.js +32 -8
- package/Table/hooks/useTableVirtualization.d.ts +1 -1
- package/Table/index.d.ts +4 -4
- package/Table/index.js +5 -3
- package/Table/utils/calculateColumnWidths.d.ts +28 -0
- package/Table/utils/calculateColumnWidths.js +80 -0
- package/Table/utils/index.d.ts +2 -0
- package/Table/utils/index.js +1 -0
- package/Table/utils/useTableRowSelection.d.ts +5 -5
- package/Table/utils/useTableRowSelection.js +1 -1
- package/hooks/useElementHeight.d.ts +8 -0
- package/hooks/useElementHeight.js +41 -0
- package/index.d.ts +8 -6
- package/index.js +9 -3
- package/package.json +5 -4
- package/utils/format-number-with-commas.d.ts +4 -0
- package/utils/format-number-with-commas.js +27 -0
- package/utils/parse-number-with-commas.d.ts +4 -0
- package/utils/parse-number-with-commas.js +22 -0
- package/Navigation/NavigationContext.d.ts +0 -5
- package/Navigation/NavigationContext.js +0 -8
- package/Navigation/NavigationItem.d.ts +0 -31
- package/Navigation/NavigationItem.js +0 -23
- package/Navigation/NavigationSubMenu.d.ts +0 -22
- package/Navigation/NavigationSubMenu.js +0 -50
- package/Table/hooks/useTableColumns.d.ts +0 -8
- package/Table/hooks/useTableColumns.js +0 -91
package/Badge/Badge.js
CHANGED
|
@@ -15,11 +15,11 @@ const isCountVariant = (variant) => [
|
|
|
15
15
|
*/
|
|
16
16
|
const Badge = forwardRef(function Badge(props, ref) {
|
|
17
17
|
const { children, count, className, overflowCount, text, variant, ...rest } = props;
|
|
18
|
-
return (jsxs("div", { className: badgeClasses.container(!!children), children: [jsx("span", { ...rest, ref: ref, className: cx(badgeClasses.host, badgeClasses.variant(variant), { [badgeClasses.hide]: isCountVariant(variant) && count === 0 }, className), children: isCountVariant(variant)
|
|
18
|
+
return (jsxs("div", { className: badgeClasses.container(!!children), children: [children, jsx("span", { ...rest, ref: ref, className: cx(badgeClasses.host, badgeClasses.variant(variant), { [badgeClasses.hide]: isCountVariant(variant) && count === 0 }, className), children: isCountVariant(variant)
|
|
19
19
|
? overflowCount && count > overflowCount
|
|
20
20
|
? `${overflowCount}+`
|
|
21
21
|
: count
|
|
22
|
-
: text })
|
|
22
|
+
: text })] }));
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
export { Badge as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const BreadcrumbItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("..").ComponentPropsWithoutKeyAndRef<"button">, "label" | "component" | "current" | "options" | "href" | "target"
|
|
1
|
+
declare const BreadcrumbItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("..").ComponentPropsWithoutKeyAndRef<"button">, "expand" | "label" | "component" | "current" | "options" | "href" | "target"> & (import("./typings").BreadcrumbDropdownItemProps | import("./typings").BreadcrumbItemTextProps | import("./typings").BreadcrumbLinkItemProps), "component"> & {
|
|
2
2
|
component?: import("./typings").BreadcrumbItemComponent | undefined;
|
|
3
3
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
4
4
|
export default BreadcrumbItem;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DescriptionContentVariant, DescriptionOrientation } from '@mezzanine-ui/core/description';
|
|
2
|
+
import { DescriptionTitleProps } from './DescriptionTitle';
|
|
3
|
+
import { DescriptionContentProps } from './DescriptionContent';
|
|
4
|
+
import { BadgeProps } from '../Badge/typings';
|
|
5
|
+
import { ButtonProps } from '../Button';
|
|
6
|
+
import { ProgressProps } from '../Progress';
|
|
7
|
+
import { TagProps } from '../Tag/typings';
|
|
8
|
+
export interface DescriptionProps {
|
|
9
|
+
/**
|
|
10
|
+
* Custom class name for description
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Defines what is rendered as the description content
|
|
15
|
+
*/
|
|
16
|
+
contentProps: DescriptionContentProps | {
|
|
17
|
+
variant: Extract<DescriptionContentVariant, 'badge'>;
|
|
18
|
+
badge: BadgeProps;
|
|
19
|
+
} | {
|
|
20
|
+
variant: Extract<DescriptionContentVariant, 'button'>;
|
|
21
|
+
button: ButtonProps;
|
|
22
|
+
} | {
|
|
23
|
+
variant: Extract<DescriptionContentVariant, 'progress'>;
|
|
24
|
+
progress: ProgressProps;
|
|
25
|
+
} | {
|
|
26
|
+
variant: Extract<DescriptionContentVariant, 'tags'>;
|
|
27
|
+
tags: TagProps[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Define the layout direction between the title and the content
|
|
31
|
+
* @default 'horizontal'
|
|
32
|
+
*/
|
|
33
|
+
orientation?: DescriptionOrientation;
|
|
34
|
+
/**
|
|
35
|
+
* Props passed to the DescriptionTitle component
|
|
36
|
+
*/
|
|
37
|
+
titleProps: DescriptionTitleProps;
|
|
38
|
+
}
|
|
39
|
+
declare const Description: import("react").ForwardRefExoticComponent<DescriptionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
40
|
+
export default Description;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { descriptionClasses } from '@mezzanine-ui/core/description';
|
|
5
|
+
import DescriptionTitle from './DescriptionTitle.js';
|
|
6
|
+
import DescriptionContent from './DescriptionContent.js';
|
|
7
|
+
import Button from '../Button/Button.js';
|
|
8
|
+
import TagGroup from '../Tag/TagGroup.js';
|
|
9
|
+
import Tag from '../Tag/Tag.js';
|
|
10
|
+
import Progress from '../Progress/Progress.js';
|
|
11
|
+
import Badge from '../Badge/Badge.js';
|
|
12
|
+
import cx from 'clsx';
|
|
13
|
+
|
|
14
|
+
const Description = forwardRef(function Description(props, ref) {
|
|
15
|
+
const { className, contentProps, orientation = 'horizontal', titleProps, } = props;
|
|
16
|
+
const contentComponent = useMemo(() => {
|
|
17
|
+
switch (contentProps.variant) {
|
|
18
|
+
case 'badge':
|
|
19
|
+
return jsx(Badge, { ...contentProps.badge });
|
|
20
|
+
case 'button':
|
|
21
|
+
return jsx(Button, { ...contentProps.button });
|
|
22
|
+
case 'progress':
|
|
23
|
+
return jsx(Progress, { ...contentProps.progress });
|
|
24
|
+
case 'tags':
|
|
25
|
+
return (jsx(TagGroup, { children: contentProps.tags.map((tagProps, index) => (jsx(Tag, { ...tagProps }, `${tagProps.label}-${index}`))) }));
|
|
26
|
+
default:
|
|
27
|
+
return jsx(DescriptionContent, { ...contentProps });
|
|
28
|
+
}
|
|
29
|
+
}, [contentProps]);
|
|
30
|
+
return (jsxs("div", { className: cx(descriptionClasses.host, descriptionClasses.orientation(orientation), className), ref: ref, children: [jsx(DescriptionTitle, { ...titleProps }), contentComponent] }));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export { Description as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
2
|
+
import { DescriptionSize, DescriptionContentVariant } from '@mezzanine-ui/core/description';
|
|
3
|
+
interface DescriptionContentBaseProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom class name for content
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Content text
|
|
10
|
+
*/
|
|
11
|
+
children: string;
|
|
12
|
+
/**
|
|
13
|
+
* Control the text size of the content
|
|
14
|
+
* @default 'main'
|
|
15
|
+
*/
|
|
16
|
+
size?: DescriptionSize;
|
|
17
|
+
/**
|
|
18
|
+
* Define the style and behavior of the content
|
|
19
|
+
* @default 'normal'
|
|
20
|
+
*/
|
|
21
|
+
variant?: Extract<DescriptionContentVariant, 'normal' | 'statistic' | 'trend-up' | 'trend-down'>;
|
|
22
|
+
/**
|
|
23
|
+
* Custom icon rendered after the content text
|
|
24
|
+
*/
|
|
25
|
+
icon?: never;
|
|
26
|
+
/**
|
|
27
|
+
* Click handler for the icon.
|
|
28
|
+
*/
|
|
29
|
+
onClickIcon?: never;
|
|
30
|
+
}
|
|
31
|
+
interface DescriptionContentWithClickableIcon {
|
|
32
|
+
className?: string;
|
|
33
|
+
children: string;
|
|
34
|
+
size?: DescriptionSize;
|
|
35
|
+
variant: Extract<DescriptionContentVariant, 'with-icon'>;
|
|
36
|
+
icon: IconDefinition;
|
|
37
|
+
onClickIcon?: VoidFunction;
|
|
38
|
+
}
|
|
39
|
+
export type DescriptionContentProps = DescriptionContentBaseProps | DescriptionContentWithClickableIcon;
|
|
40
|
+
declare const DescriptionContent: import("react").ForwardRefExoticComponent<DescriptionContentProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
41
|
+
export default DescriptionContent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { CaretUpIcon, CaretDownIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import { descriptionClasses } from '@mezzanine-ui/core/description';
|
|
6
|
+
import Icon from '../Icon/Icon.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const DescriptionContent = forwardRef(function DescriptionContent(props, ref) {
|
|
10
|
+
const { className, children, icon, onClickIcon, size = 'main', variant = 'normal', } = props;
|
|
11
|
+
return (jsxs("span", { className: cx(descriptionClasses.contentHost, descriptionClasses.contentVariant(variant), descriptionClasses.contentSize(size), className), ref: ref, children: [variant === 'trend-up' && (jsx(Icon, { className: descriptionClasses.contentTrendUp, icon: CaretUpIcon, size: 16 })), variant === 'trend-down' && (jsx(Icon, { className: descriptionClasses.contentTrendDown, icon: CaretDownIcon, size: 16 })), children, variant === 'with-icon' && icon && (jsx(Icon, { className: descriptionClasses.contentIcon, icon: icon, size: 16, onClick: onClickIcon }))] }));
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { DescriptionContent as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export interface DescriptionGroupProps {
|
|
3
|
+
/**
|
|
4
|
+
* Custom class name for group
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Description elements to be grouped and displayed together
|
|
9
|
+
*/
|
|
10
|
+
children: ReactElement[];
|
|
11
|
+
}
|
|
12
|
+
declare const DescriptionGroup: import("react").ForwardRefExoticComponent<DescriptionGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export default DescriptionGroup;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { descriptionClasses } from '@mezzanine-ui/core/description';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const DescriptionGroup = forwardRef(function DescriptionGroup(props, ref) {
|
|
8
|
+
const { className, children } = props;
|
|
9
|
+
return (jsx("div", { className: cx(descriptionClasses.groupHost, className), ref: ref, children: children }));
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { DescriptionGroup as default };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
2
|
+
import { DescriptionWidthType } from '@mezzanine-ui/core/description';
|
|
3
|
+
import { BadgeDotVariant } from '@mezzanine-ui/core/badge';
|
|
4
|
+
import { Placement } from '@floating-ui/react-dom';
|
|
5
|
+
interface DescriptionTitleBaseProps {
|
|
6
|
+
/**
|
|
7
|
+
* Displays a badge dot alongside the title text
|
|
8
|
+
*/
|
|
9
|
+
badge?: BadgeDotVariant;
|
|
10
|
+
/**
|
|
11
|
+
* Custom class name for title
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Title text
|
|
16
|
+
*/
|
|
17
|
+
children: string;
|
|
18
|
+
/**
|
|
19
|
+
* Controls the layout width behavior of the title
|
|
20
|
+
* @default 'stretch'
|
|
21
|
+
*/
|
|
22
|
+
widthType?: DescriptionWidthType;
|
|
23
|
+
}
|
|
24
|
+
interface DescriptionTitleWithTooltip {
|
|
25
|
+
/**
|
|
26
|
+
* An icon displayed after the title text
|
|
27
|
+
*/
|
|
28
|
+
icon: IconDefinition;
|
|
29
|
+
/**
|
|
30
|
+
* Text content displayed in a tooltip when hovering over the icon
|
|
31
|
+
*/
|
|
32
|
+
tooltip: string;
|
|
33
|
+
/**
|
|
34
|
+
* Defines the placement of the tooltip relative to the icon
|
|
35
|
+
*/
|
|
36
|
+
tooltipPlacement?: Placement;
|
|
37
|
+
}
|
|
38
|
+
interface DescriptionTitleWithoutTooltip {
|
|
39
|
+
icon?: IconDefinition;
|
|
40
|
+
tooltip?: undefined;
|
|
41
|
+
tooltipPlacement?: undefined;
|
|
42
|
+
}
|
|
43
|
+
export type DescriptionTitleProps = (DescriptionTitleBaseProps & DescriptionTitleWithTooltip) | (DescriptionTitleBaseProps & DescriptionTitleWithoutTooltip);
|
|
44
|
+
declare const DescriptionTitle: import("react").ForwardRefExoticComponent<DescriptionTitleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
|
+
export default DescriptionTitle;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { descriptionClasses } from '@mezzanine-ui/core/description';
|
|
5
|
+
import Badge from '../Badge/Badge.js';
|
|
6
|
+
import Tooltip from '../Tooltip/Tooltip.js';
|
|
7
|
+
import Icon from '../Icon/Icon.js';
|
|
8
|
+
import cx from 'clsx';
|
|
9
|
+
|
|
10
|
+
const DescriptionTitle = forwardRef(function DescriptionTitle(props, ref) {
|
|
11
|
+
const { badge, className, children, icon, tooltip, tooltipPlacement, widthType = 'stretch', } = props;
|
|
12
|
+
return (jsxs("div", { className: cx(descriptionClasses.titleHost, descriptionClasses.titleWidth(widthType), className), ref: ref, children: [badge ? (jsx(Badge, { variant: badge, text: children, className: descriptionClasses.titleText })) : (jsx("span", { className: descriptionClasses.titleText, children: children })), icon ? (tooltip ? (jsx(Tooltip, { title: tooltip, options: {
|
|
13
|
+
placement: tooltipPlacement !== null && tooltipPlacement !== void 0 ? tooltipPlacement : 'top',
|
|
14
|
+
}, children: ({ onMouseEnter, onMouseLeave, ref }) => (jsx(Icon, { ref: ref, icon: icon, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, size: 16 })) })) : (jsx(Icon, { icon: icon, size: 16 }))) : null] }));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { DescriptionTitle as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Description } from './Description';
|
|
2
|
+
export type { DescriptionProps } from './Description';
|
|
3
|
+
export { default as DescriptionTitle } from './DescriptionTitle';
|
|
4
|
+
export type { DescriptionTitleProps } from './DescriptionTitle';
|
|
5
|
+
export { default as DescriptionContent } from './DescriptionContent';
|
|
6
|
+
export type { DescriptionContentProps } from './DescriptionContent';
|
|
7
|
+
export { default as DescriptionGroup } from './DescriptionGroup';
|
|
8
|
+
export type { DescriptionGroupProps } from './DescriptionGroup';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Description } from './Description.js';
|
|
2
|
+
export { default as DescriptionTitle } from './DescriptionTitle.js';
|
|
3
|
+
export { default as DescriptionContent } from './DescriptionContent.js';
|
|
4
|
+
export { default as DescriptionGroup } from './DescriptionGroup.js';
|
package/Dropdown/Dropdown.d.ts
CHANGED
|
@@ -1,25 +1,138 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { DropdownInputPosition, DropdownItemSharedProps, DropdownOption, DropdownType } from '@mezzanine-ui/core/dropdown/dropdown';
|
|
3
|
+
import { ButtonProps } from '../Button';
|
|
4
|
+
import { InputProps } from '../Input';
|
|
5
|
+
import { PopperPlacement } from '../Popper';
|
|
6
|
+
export interface DropdownProps extends DropdownItemSharedProps {
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* The text of the cancel button.
|
|
9
|
+
*/
|
|
10
|
+
actionCancelText?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The text of the clear button.
|
|
13
|
+
*/
|
|
14
|
+
actionClearText?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The text of the confirm button.
|
|
17
|
+
*/
|
|
18
|
+
actionConfirmText?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The custom action button props of the dropdown.
|
|
21
|
+
*/
|
|
22
|
+
actionCustomButtonProps?: ButtonProps;
|
|
23
|
+
/**
|
|
24
|
+
* The text of the custom action button.
|
|
25
|
+
*/
|
|
26
|
+
actionText?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The active option index for hover/focus state.
|
|
29
|
+
*/
|
|
30
|
+
activeIndex?: number | null;
|
|
31
|
+
/**
|
|
32
|
+
* The children of the dropdown.
|
|
33
|
+
* This can be a button or an input.
|
|
34
|
+
*/
|
|
35
|
+
children: ReactElement<ButtonProps> | ReactElement<InputProps>;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the dropdown is disabled.
|
|
38
|
+
*/
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The id of the dropdown.
|
|
42
|
+
*/
|
|
43
|
+
id?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The position of the input.
|
|
46
|
+
* @default 'outside'
|
|
47
|
+
*/
|
|
48
|
+
inputPosition?: DropdownInputPosition;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to match the input value.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
isMatchInputValue?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The listbox id of the dropdown.
|
|
56
|
+
*/
|
|
57
|
+
listboxId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The aria-label for the listbox.
|
|
60
|
+
* If not provided, a default label will be used when there are no options.
|
|
61
|
+
*/
|
|
62
|
+
listboxLabel?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The max height of the dropdown list.
|
|
65
|
+
*/
|
|
66
|
+
maxHeight?: number | string;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the dropdown is open (controlled).
|
|
69
|
+
*/
|
|
70
|
+
open?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Callback fired when the action cancel is clicked.
|
|
73
|
+
*/
|
|
74
|
+
onActionCancel?: () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Callback fired when the action clear is clicked.
|
|
77
|
+
*/
|
|
78
|
+
onActionClear?: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Callback fired when the action confirm is clicked.
|
|
81
|
+
*/
|
|
82
|
+
onActionConfirm?: () => void;
|
|
83
|
+
/**
|
|
84
|
+
* Callback fired when the action custom is clicked.
|
|
85
|
+
*/
|
|
86
|
+
onActionCustom?: () => void;
|
|
87
|
+
/**
|
|
88
|
+
* Callback fired when the dropdown is closed.
|
|
89
|
+
*/
|
|
90
|
+
onClose?: () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Callback fired when the item is hovered.
|
|
93
|
+
*/
|
|
94
|
+
onItemHover?: (index: number) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Callback fired when the dropdown is opened.
|
|
97
|
+
*/
|
|
98
|
+
onOpen?: () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Callback fired when the dropdown visibility changes.
|
|
101
|
+
*/
|
|
102
|
+
onVisibilityChange?: (open: boolean) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Callback fired when the item is selected.
|
|
105
|
+
*/
|
|
106
|
+
onSelect?: (option: DropdownOption) => void;
|
|
107
|
+
/**
|
|
108
|
+
* The options of the dropdown.
|
|
109
|
+
*/
|
|
110
|
+
options: DropdownOption[];
|
|
111
|
+
/**
|
|
112
|
+
* The placement of the dropdown.
|
|
113
|
+
*/
|
|
114
|
+
placement?: PopperPlacement;
|
|
115
|
+
/**
|
|
116
|
+
* Whether to set the same width as its anchor element.
|
|
117
|
+
* @default false
|
|
118
|
+
*/
|
|
119
|
+
sameWidth?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* If true, display a bar at the top of the dropdown action area.
|
|
8
122
|
* @default false
|
|
9
123
|
*/
|
|
10
|
-
|
|
124
|
+
showActionShowTopBar?: boolean;
|
|
11
125
|
/**
|
|
12
|
-
*
|
|
126
|
+
* Whether to show the actions.
|
|
13
127
|
*/
|
|
14
|
-
|
|
128
|
+
showDropdownActions?: boolean;
|
|
15
129
|
/**
|
|
16
|
-
* The
|
|
130
|
+
* The type of the dropdown.
|
|
17
131
|
*/
|
|
18
|
-
|
|
132
|
+
type?: DropdownType;
|
|
19
133
|
/**
|
|
20
|
-
*
|
|
134
|
+
* The z-index of the dropdown.
|
|
21
135
|
*/
|
|
22
|
-
|
|
136
|
+
zIndex?: number | string;
|
|
23
137
|
}
|
|
24
|
-
|
|
25
|
-
export default Dropdown;
|
|
138
|
+
export default function Dropdown(props: DropdownProps): import("react/jsx-runtime").JSX.Element;
|