@mezzanine-ui/react 1.0.0-beta.2 → 1.0.0-beta.4

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.
Files changed (193) hide show
  1. package/Anchor/Anchor.d.ts +51 -18
  2. package/Anchor/Anchor.js +15 -15
  3. package/Anchor/AnchorGroup.d.ts +34 -0
  4. package/Anchor/AnchorGroup.js +37 -0
  5. package/Anchor/AnchorItem.d.ts +30 -0
  6. package/Anchor/AnchorItem.js +65 -0
  7. package/Anchor/index.d.ts +2 -0
  8. package/Anchor/index.js +1 -0
  9. package/Anchor/utils.d.ts +13 -0
  10. package/Anchor/utils.js +95 -0
  11. package/AutoComplete/AutoComplete.d.ts +217 -0
  12. package/AutoComplete/AutoComplete.js +433 -0
  13. package/AutoComplete/index.d.ts +2 -0
  14. package/AutoComplete/index.js +1 -0
  15. package/AutoComplete/useAutoCompleteCreation.d.ts +33 -0
  16. package/AutoComplete/useAutoCompleteCreation.js +201 -0
  17. package/AutoComplete/useAutoCompleteKeyboard.d.ts +31 -0
  18. package/AutoComplete/useAutoCompleteKeyboard.js +149 -0
  19. package/AutoComplete/useAutoCompleteSearch.d.ts +16 -0
  20. package/AutoComplete/useAutoCompleteSearch.js +69 -0
  21. package/AutoComplete/useCreationTracker.d.ts +17 -0
  22. package/AutoComplete/useCreationTracker.js +47 -0
  23. package/Breadcrumb/Breadcrumb.js +16 -21
  24. package/Breadcrumb/BreadcrumbDropdown.d.ts +11 -0
  25. package/Breadcrumb/BreadcrumbDropdown.js +22 -0
  26. package/Breadcrumb/BreadcrumbItem.d.ts +2 -3
  27. package/Breadcrumb/BreadcrumbItem.js +13 -31
  28. package/Breadcrumb/BreadcrumbOverflowMenu.d.ts +7 -0
  29. package/Breadcrumb/BreadcrumbOverflowMenu.js +77 -0
  30. package/Breadcrumb/BreadcrumbOverflowMenuDropdown.d.ts +11 -0
  31. package/Breadcrumb/BreadcrumbOverflowMenuDropdown.js +21 -0
  32. package/Breadcrumb/BreadcrumbOverflowMenuItem.d.ts +3 -0
  33. package/Breadcrumb/BreadcrumbOverflowMenuItem.js +27 -0
  34. package/Breadcrumb/typings.d.ts +21 -39
  35. package/Button/Button.js +13 -11
  36. package/Button/index.d.ts +1 -1
  37. package/Button/typings.d.ts +27 -4
  38. package/Checkbox/index.d.ts +4 -5
  39. package/Checkbox/index.js +1 -5
  40. package/ContentHeader/ContentHeader.d.ts +160 -0
  41. package/ContentHeader/ContentHeader.js +54 -0
  42. package/ContentHeader/index.d.ts +2 -0
  43. package/ContentHeader/index.js +1 -0
  44. package/ContentHeader/utils.d.ts +23 -0
  45. package/ContentHeader/utils.js +215 -0
  46. package/Description/Description.d.ts +12 -22
  47. package/Description/Description.js +4 -24
  48. package/Dropdown/Dropdown.d.ts +46 -1
  49. package/Dropdown/Dropdown.js +99 -14
  50. package/Dropdown/DropdownAction.d.ts +1 -1
  51. package/Dropdown/DropdownAction.js +1 -4
  52. package/Dropdown/DropdownItem.d.ts +28 -1
  53. package/Dropdown/DropdownItem.js +56 -14
  54. package/Dropdown/DropdownItemCard.d.ts +2 -2
  55. package/Dropdown/DropdownItemCard.js +20 -16
  56. package/Dropdown/DropdownStatus.js +29 -0
  57. package/Dropdown/dropdownKeydownHandler.d.ts +2 -1
  58. package/Dropdown/dropdownKeydownHandler.js +73 -0
  59. package/Dropdown/highlightText.js +5 -1
  60. package/Dropdown/shortcutTextHandler.d.ts +24 -0
  61. package/Dropdown/shortcutTextHandler.js +171 -0
  62. package/Empty/Empty.js +2 -1
  63. package/Empty/icons/EmptyMainNotificationIcon.d.ts +4 -0
  64. package/Empty/icons/EmptyMainNotificationIcon.js +9 -0
  65. package/Empty/typings.d.ts +2 -2
  66. package/FilterArea/Filter.d.ts +32 -0
  67. package/FilterArea/Filter.js +23 -0
  68. package/FilterArea/FilterArea.d.ts +58 -0
  69. package/FilterArea/FilterArea.js +31 -0
  70. package/FilterArea/FilterLine.d.ts +11 -0
  71. package/FilterArea/FilterLine.js +13 -0
  72. package/FilterArea/index.d.ts +6 -0
  73. package/FilterArea/index.js +3 -0
  74. package/Form/FormField.js +3 -1
  75. package/Input/Input.d.ts +35 -7
  76. package/Input/Input.js +48 -14
  77. package/Input/index.d.ts +1 -1
  78. package/Modal/MediaPreviewModal.d.ts +54 -0
  79. package/Modal/MediaPreviewModal.js +158 -0
  80. package/Modal/Modal.d.ts +103 -11
  81. package/Modal/Modal.js +14 -9
  82. package/Modal/ModalBodyForVerification.d.ts +59 -0
  83. package/Modal/ModalBodyForVerification.js +99 -0
  84. package/Modal/ModalControl.d.ts +2 -2
  85. package/Modal/ModalControl.js +1 -1
  86. package/Modal/ModalFooter.d.ts +119 -1
  87. package/Modal/ModalFooter.js +15 -3
  88. package/Modal/ModalHeader.d.ts +26 -7
  89. package/Modal/ModalHeader.js +33 -7
  90. package/Modal/index.d.ts +6 -5
  91. package/Modal/index.js +2 -2
  92. package/Modal/useModalContainer.d.ts +12 -3
  93. package/Modal/useModalContainer.js +28 -6
  94. package/Navigation/Navigation.d.ts +7 -2
  95. package/Navigation/Navigation.js +36 -35
  96. package/Navigation/NavigationHeader.d.ts +4 -0
  97. package/Navigation/NavigationHeader.js +3 -2
  98. package/Navigation/NavigationOption.d.ts +8 -3
  99. package/Navigation/NavigationOption.js +46 -11
  100. package/Navigation/NavigationOptionCategory.js +1 -0
  101. package/Navigation/NavigationOverflowMenu.d.ts +6 -0
  102. package/Navigation/NavigationOverflowMenu.js +90 -0
  103. package/Navigation/NavigationOverflowMenuOption.d.ts +7 -0
  104. package/Navigation/NavigationOverflowMenuOption.js +68 -0
  105. package/Navigation/NavigationUserMenu.d.ts +4 -2
  106. package/Navigation/NavigationUserMenu.js +13 -5
  107. package/Navigation/context.d.ts +3 -2
  108. package/Navigation/useVisibleItems.d.ts +5 -0
  109. package/Navigation/useVisibleItems.js +54 -0
  110. package/NotificationCenter/NotificationCenter.d.ts +124 -0
  111. package/NotificationCenter/NotificationCenter.js +279 -0
  112. package/NotificationCenter/NotificationCenterDrawer.d.ts +109 -0
  113. package/NotificationCenter/index.d.ts +3 -0
  114. package/NotificationCenter/index.js +1 -0
  115. package/PageFooter/PageFooter.d.ts +19 -9
  116. package/PageFooter/PageFooter.js +10 -10
  117. package/PageHeader/PageHeader.d.ts +32 -25
  118. package/PageHeader/PageHeader.js +49 -43
  119. package/ResultState/ResultState.d.ts +9 -0
  120. package/ResultState/ResultState.js +36 -4
  121. package/Scrollbar/Scrollbar.d.ts +9 -0
  122. package/Scrollbar/Scrollbar.js +78 -0
  123. package/Scrollbar/index.d.ts +2 -0
  124. package/Scrollbar/index.js +1 -0
  125. package/Scrollbar/typings.d.ts +47 -0
  126. package/Select/SelectTrigger.js +5 -4
  127. package/Select/index.d.ts +0 -2
  128. package/Select/index.js +0 -1
  129. package/Select/typings.d.ts +6 -1
  130. package/Selection/Selection.js +1 -1
  131. package/Selection/SelectionGroup.d.ts +28 -0
  132. package/Slider/useSlider.js +1 -1
  133. package/Table/Table.d.ts +2 -120
  134. package/Table/Table.js +148 -53
  135. package/Table/TableContext.d.ts +11 -12
  136. package/Table/components/TableActionsCell.js +12 -4
  137. package/Table/components/TableBody.js +2 -1
  138. package/Table/components/TableBulkActions.js +1 -19
  139. package/Table/components/TableColGroup.d.ts +1 -4
  140. package/Table/components/TableColGroup.js +15 -16
  141. package/Table/components/TableCollectableCell.d.ts +17 -0
  142. package/Table/components/TableCollectableCell.js +54 -0
  143. package/Table/components/TableDragOrPinHandleCell.d.ts +20 -0
  144. package/Table/components/TableDragOrPinHandleCell.js +58 -0
  145. package/Table/components/TableExpandedRow.js +11 -2
  146. package/Table/components/TableHeader.js +12 -10
  147. package/Table/components/TableRow.js +38 -13
  148. package/Table/components/TableSelectionCell.js +1 -1
  149. package/Table/components/TableToggleableCell.d.ts +16 -0
  150. package/Table/components/TableToggleableCell.js +51 -0
  151. package/Table/components/index.d.ts +4 -1
  152. package/Table/components/index.js +3 -0
  153. package/Table/hooks/typings.d.ts +18 -4
  154. package/Table/hooks/useTableExpansion.d.ts +2 -2
  155. package/Table/hooks/useTableExpansion.js +5 -5
  156. package/Table/hooks/useTableFixedOffsets.d.ts +6 -2
  157. package/Table/hooks/useTableFixedOffsets.js +60 -26
  158. package/Table/hooks/useTableScroll.d.ts +9 -3
  159. package/Table/hooks/useTableScroll.js +34 -7
  160. package/Table/hooks/useTableVirtualization.d.ts +2 -1
  161. package/Table/hooks/useTableVirtualization.js +2 -8
  162. package/Table/index.d.ts +4 -3
  163. package/Table/index.js +3 -0
  164. package/Table/typings.d.ts +172 -0
  165. package/Table/utils/useTableRowSelection.js +13 -5
  166. package/Tag/TagGroup.d.ts +3 -0
  167. package/Tag/index.d.ts +2 -0
  168. package/Tag/index.js +1 -0
  169. package/Transition/Slide.d.ts +9 -2
  170. package/Transition/Slide.js +7 -4
  171. package/Tree/TreeNode.js +1 -1
  172. package/Upload/UploadPictureCard.js +1 -1
  173. package/index.d.ts +37 -21
  174. package/index.js +25 -11
  175. package/package.json +6 -4
  176. package/Modal/ModalActions.d.ts +0 -9
  177. package/Modal/ModalActions.js +0 -20
  178. package/Modal/ModalBody.d.ts +0 -7
  179. package/Modal/ModalBody.js +0 -14
  180. package/Notification/Notification.d.ts +0 -54
  181. package/Notification/Notification.js +0 -76
  182. package/Notification/index.d.ts +0 -3
  183. package/Notification/index.js +0 -1
  184. package/PageToolbar/PageToolbar.d.ts +0 -114
  185. package/PageToolbar/PageToolbar.js +0 -23
  186. package/PageToolbar/index.d.ts +0 -2
  187. package/PageToolbar/index.js +0 -1
  188. package/PageToolbar/utils.d.ts +0 -23
  189. package/PageToolbar/utils.js +0 -165
  190. package/Select/AutoComplete.d.ts +0 -107
  191. package/Select/AutoComplete.js +0 -114
  192. package/Table/components/TableDragHandleCell.d.ts +0 -11
  193. package/Table/components/TableDragHandleCell.js +0 -44
@@ -1,40 +1,47 @@
1
- import { HTMLAttributes, ReactElement } from 'react';
1
+ import { ReactElement } from 'react';
2
2
  import { BreadcrumbProps } from '../Breadcrumb';
3
- import { ButtonProps } from '../Button';
4
- import { PageToolbarProps } from '../PageToolbar';
5
- import { TypographyProps } from '../Typography';
3
+ import { ContentHeaderProps } from '../ContentHeader';
6
4
  import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
7
- type PageHeaderChild = ReactElement<BreadcrumbProps> | ReactElement<PageToolbarProps> | ReactElement<ButtonProps> | ReactElement<HTMLAttributes<HTMLAnchorElement>> | null | undefined | false;
5
+ type PageHeaderChild = ReactElement<BreadcrumbProps> | ReactElement<ContentHeaderProps> | null | undefined | false;
8
6
  /**
9
7
  * Props for the PageHeader component.
10
8
  * Extends native HTML header element props.
11
9
  */
12
10
  export type PageHeaderProps = NativeElementPropsWithoutKeyAndRef<'header'> & {
13
- /** Optional back button properties */
14
- onBackClick?: () => void;
15
- /** Optional description text displayed below the title */
16
- description?: string;
17
- /** Main title text for the page header */
18
- title: string;
19
- /** HTML element type for the title (defaults to 'h2') */
20
- titleComponent?: TypographyProps['component'];
21
- /** Child components: Breadcrumb, PageToolbar, Button, or component with href prop */
11
+ /**
12
+ * Child components: Breadcrumb or ContentHeader
13
+ * */
22
14
  children?: PageHeaderChild | PageHeaderChild[];
23
15
  };
24
16
  /**
25
- * PageHeader component displays a page title with optional breadcrumb navigation,
26
- * description, back button, and action toolbar.
17
+ * PageHeader component
18
+ *
19
+ * Used to display the page header, typically containing a `<Breadcrumb />` and a `<ContentHeader />`.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <PageHeader>
24
+ * <Breadcrumb
25
+ * links={[
26
+ * { id: '1', children: 'Home', href: '/' },
27
+ * { id: '2', children: 'Page Header' },
28
+ * ]}
29
+ * />
30
+ *
31
+ * <ContentHeader
32
+ * title="Page Title"
33
+ * description="This is the page description."
34
+ * >
35
+ * <Button variant="base-secondary">Secondary</Button>
36
+ * <Button>Primary</Button>
37
+ * </ContentHeader>
38
+ * </PageHeader>
39
+ * ```
27
40
  */
28
41
  declare const PageHeader: import("react").ForwardRefExoticComponent<NativeElementPropsWithoutKeyAndRef<"header"> & {
29
- /** Optional back button properties */
30
- onBackClick?: () => void;
31
- /** Optional description text displayed below the title */
32
- description?: string;
33
- /** Main title text for the page header */
34
- title: string;
35
- /** HTML element type for the title (defaults to 'h2') */
36
- titleComponent?: TypographyProps["component"];
37
- /** Child components: Breadcrumb, PageToolbar, Button, or component with href prop */
42
+ /**
43
+ * Child components: Breadcrumb or ContentHeader
44
+ * */
38
45
  children?: PageHeaderChild | PageHeaderChild[];
39
46
  } & import("react").RefAttributes<HTMLElement>>;
40
47
  export default PageHeader;
@@ -1,70 +1,76 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef, Children, isValidElement, cloneElement } from 'react';
3
- import { ChevronLeftIcon } from '@mezzanine-ui/icons';
1
+ import { jsxs } from 'react/jsx-runtime';
2
+ import { forwardRef, isValidElement, cloneElement } from 'react';
4
3
  import { pageHeaderClasses } from '@mezzanine-ui/core/page-header';
5
- import Button from '../Button/Button.js';
6
- import Typography from '../Typography/Typography.js';
4
+ import { flattenChildren } from '../utils/flatten-children.js';
7
5
  import Breadcrumb from '../Breadcrumb/Breadcrumb.js';
8
- import PageToolbar from '../PageToolbar/PageToolbar.js';
6
+ import ContentHeader from '../ContentHeader/ContentHeader.js';
9
7
  import cx from 'clsx';
10
8
 
11
9
  const getBreadcrumbAndToolbar = (children) => {
12
10
  let breadcrumb;
13
- let pageToolbar;
14
- let backButtonOrLink;
15
- const childrenArray = Children.toArray(children);
11
+ let contentHeader;
12
+ const childrenArray = flattenChildren(children);
16
13
  if (children) {
17
14
  childrenArray.forEach((child) => {
18
15
  if (!isValidElement(child))
19
16
  return;
20
17
  if (child.type === Breadcrumb) {
18
+ if (breadcrumb) {
19
+ console.warn('[Mezzanine][PageHeader] only accepts one Breadcrumb as its child.');
20
+ }
21
21
  breadcrumb = child;
22
22
  }
23
- else if (child.type === PageToolbar) {
24
- pageToolbar = cloneElement(child, {
23
+ else if (child.type === ContentHeader) {
24
+ if (contentHeader) {
25
+ console.warn('[Mezzanine][PageHeader] only accepts one ContentHeader as its child.');
26
+ }
27
+ const sizeProp = child.props.size;
28
+ if (sizeProp !== undefined && sizeProp !== 'main') {
29
+ console.warn('[Mezzanine][PageHeader] ContentHeader size prop will be overridden to "main".');
30
+ }
31
+ contentHeader = cloneElement(child, {
25
32
  size: 'main',
26
33
  });
27
34
  }
28
- else if (child.type === Button) {
29
- backButtonOrLink = cloneElement(child, {
30
- icon: {
31
- position: 'icon-only',
32
- src: ChevronLeftIcon,
33
- },
34
- size: 'sub',
35
- variant: 'base-tertiary',
36
- });
37
- }
38
- else if (child.type === 'a') {
39
- backButtonOrLink = cloneElement(child, {
40
- children: (jsx(Button, { component: 'div', icon: {
41
- position: 'icon-only',
42
- src: ChevronLeftIcon,
43
- }, size: "sub", variant: "base-tertiary" })),
44
- });
45
- }
46
35
  else {
47
- if (process.env.NODE_ENV !== 'production') {
48
- console.warn('PageHeader only accepts Breadcrumb, PageToolbar, Button or component with href prop as its children.');
49
- }
36
+ console.warn('[Mezzanine][PageHeader] only accepts Breadcrumb or ContentHeader as its children.');
50
37
  }
51
38
  });
52
39
  }
53
- return { breadcrumb, backButtonOrLink, pageToolbar };
40
+ if (!contentHeader) {
41
+ console.error('[Mezzanine][PageHeader] requires a ContentHeader as its child.');
42
+ }
43
+ return { breadcrumb, contentHeader };
54
44
  };
55
45
  /**
56
- * PageHeader component displays a page title with optional breadcrumb navigation,
57
- * description, back button, and action toolbar.
46
+ * PageHeader component
47
+ *
48
+ * Used to display the page header, typically containing a `<Breadcrumb />` and a `<ContentHeader />`.
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * <PageHeader>
53
+ * <Breadcrumb
54
+ * links={[
55
+ * { id: '1', children: 'Home', href: '/' },
56
+ * { id: '2', children: 'Page Header' },
57
+ * ]}
58
+ * />
59
+ *
60
+ * <ContentHeader
61
+ * title="Page Title"
62
+ * description="This is the page description."
63
+ * >
64
+ * <Button variant="base-secondary">Secondary</Button>
65
+ * <Button>Primary</Button>
66
+ * </ContentHeader>
67
+ * </PageHeader>
68
+ * ```
58
69
  */
59
70
  const PageHeader = forwardRef(function PageHeader(props, ref) {
60
- const { children, className, description, onBackClick, title, titleComponent = 'h2', ...rest } = props;
61
- const { backButtonOrLink, breadcrumb, pageToolbar } = getBreadcrumbAndToolbar(children);
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] })] }));
71
+ const { children, className, ...rest } = props;
72
+ const { breadcrumb, contentHeader } = getBreadcrumbAndToolbar(children);
73
+ return (jsxs("header", { ...rest, className: cx(pageHeaderClasses.host, className), ref: ref, children: [breadcrumb, contentHeader] }));
68
74
  });
69
75
 
70
76
  export { PageHeader as default };
@@ -1,4 +1,5 @@
1
1
  import type { ResultStateSize, ResultStateType } from '@mezzanine-ui/core/result-state';
2
+ import { ReactElement } from 'react';
2
3
  import type { ButtonProps } from '../Button';
3
4
  import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
4
5
  /**
@@ -26,6 +27,14 @@ export interface ResultStateProps extends NativeElementPropsWithoutKeyAndRef<'di
26
27
  * - Two buttons: Both `secondaryButton` and `primaryButton`
27
28
  */
28
29
  actions?: ResultStateActions;
30
+ /**
31
+ * Child button elements for actions. <br />
32
+ * Can be a single Button element or an array of one or two Button elements. <br />
33
+ * When using children, the first Button is treated as secondary and the second as primary. <br />
34
+ * If only one Button is provided, it is treated as secondary. <br />
35
+ * If actions provided, children will be ignored. <br />
36
+ */
37
+ children?: ReactElement<ButtonProps> | [ReactElement<ButtonProps>] | [ReactElement<ButtonProps>, ReactElement<ButtonProps>];
29
38
  /**
30
39
  * Optional description text displayed below the title.
31
40
  * Provides additional context or details about the result state.
@@ -1,9 +1,10 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { resultStateClasses } from '@mezzanine-ui/core/result-state';
3
- import { forwardRef, useMemo } from 'react';
3
+ import { forwardRef, useMemo, isValidElement, cloneElement } from 'react';
4
4
  import { DangerousFilledIcon, ErrorFilledIcon, WarningFilledIcon, QuestionFilledIcon, CheckedFilledIcon, InfoFilledIcon } from '@mezzanine-ui/icons';
5
5
  import Button from '../Button/Button.js';
6
6
  import ButtonGroup from '../Button/ButtonGroup.js';
7
+ import { flattenChildren } from '../utils/flatten-children.js';
7
8
  import Icon from '../Icon/Icon.js';
8
9
  import cx from 'clsx';
9
10
 
@@ -15,10 +16,41 @@ const iconMap = {
15
16
  error: ErrorFilledIcon,
16
17
  failure: DangerousFilledIcon,
17
18
  };
19
+ const renderButtonOrElement = (button, size, variant) => {
20
+ if (!button)
21
+ return null;
22
+ if (isValidElement(button)) {
23
+ return cloneElement(button, { size, variant });
24
+ }
25
+ return jsx(Button, { ...button, size: size, variant: variant });
26
+ };
18
27
  const ResultState = forwardRef(function ResultState(props, ref) {
19
- const { actions, className, description, size = 'main', title, type = 'information', ...rest } = props;
28
+ const { actions, className, children, description, size = 'main', title, type = 'information', ...rest } = props;
20
29
  const icon = useMemo(() => iconMap[type], [type]);
21
- return (jsx("div", { ...rest, ref: ref, className: cx(resultStateClasses.host, resultStateClasses.type(type), resultStateClasses.size(size), className), children: jsxs("div", { className: resultStateClasses.container, children: [jsx(Icon, { className: resultStateClasses.icon, icon: icon }), jsx("h3", { className: resultStateClasses.title, children: title }), description && jsx("p", { className: resultStateClasses.description, children: description }), ((actions === null || actions === void 0 ? void 0 : actions.secondaryButton) || (actions === null || actions === void 0 ? void 0 : actions.primaryButton)) && (jsxs(ButtonGroup, { className: resultStateClasses.actions, children: [(actions === null || actions === void 0 ? void 0 : actions.secondaryButton) && (jsx(Button, { size: size, variant: "base-secondary", ...actions.secondaryButton })), (actions === null || actions === void 0 ? void 0 : actions.primaryButton) && (jsx(Button, { size: size, variant: "base-primary", ...actions.primaryButton }))] }))] }) }));
30
+ const flatChildren = flattenChildren(children);
31
+ const fragmentButtons = actions &&
32
+ ('secondaryButton' in actions ? (jsxs(Fragment, { children: [renderButtonOrElement(actions.secondaryButton, size, 'base-secondary'), renderButtonOrElement(actions.primaryButton, size, 'base-primary')] })) : (renderButtonOrElement(actions, size, 'base-secondary')));
33
+ const renderChildren = !fragmentButtons &&
34
+ flatChildren.length > 0 &&
35
+ flatChildren.map((child, index) => {
36
+ if (!isValidElement(child)) {
37
+ return null;
38
+ }
39
+ else if (child.type === Button) {
40
+ switch (index) {
41
+ case 0:
42
+ return renderButtonOrElement(child, size, 'base-secondary');
43
+ case 1:
44
+ return renderButtonOrElement(child, size, 'base-primary');
45
+ default:
46
+ console.warn('Only up to two Button components are allowed as children of ResultState.');
47
+ return null;
48
+ }
49
+ }
50
+ console.warn('Only Button components are allowed as children of ResultState.');
51
+ return null;
52
+ });
53
+ return (jsx("div", { ...rest, ref: ref, className: cx(resultStateClasses.host, resultStateClasses.type(type), resultStateClasses.size(size), className), children: jsxs("div", { className: resultStateClasses.container, children: [jsx(Icon, { className: resultStateClasses.icon, icon: icon }), jsx("h3", { className: resultStateClasses.title, children: title }), description && jsx("p", { className: resultStateClasses.description, children: description }), actions || children ? (jsx(ButtonGroup, { className: resultStateClasses.actions, children: fragmentButtons || renderChildren })) : null] }) }));
22
54
  });
23
55
 
24
56
  export { ResultState as default };
@@ -0,0 +1,9 @@
1
+ import 'overlayscrollbars/overlayscrollbars.css';
2
+ import { OverlayScrollbarsComponentRef } from 'overlayscrollbars-react';
3
+ import type { ScrollbarProps } from './typings';
4
+ /**
5
+ * The react component for `mezzanine` scrollbar.
6
+ * A customizable scrollbar container that provides consistent styling across all browsers
7
+ */
8
+ declare const Scrollbar: import("react").ForwardRefExoticComponent<ScrollbarProps & import("react").RefAttributes<OverlayScrollbarsComponentRef<"div">>>;
9
+ export default Scrollbar;
@@ -0,0 +1,78 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { forwardRef, useEffect, useMemo, useCallback } from 'react';
3
+ import { OverlayScrollbars, ClickScrollPlugin } from 'overlayscrollbars';
4
+ import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
5
+ import { scrollbarClasses } from '@mezzanine-ui/core/scrollbar';
6
+ import cx from 'clsx';
7
+
8
+ /**
9
+ * The react component for `mezzanine` scrollbar.
10
+ * A customizable scrollbar container that provides consistent styling across all browsers
11
+ */
12
+ const Scrollbar = forwardRef(function Scrollbar(props, ref) {
13
+ const { children, className, defer = true, disabled = false, events, maxHeight, maxWidth, onViewportReady, options, style, ...rest } = props;
14
+ // Register ClickScrollPlugin once (required for clickScroll option to work)
15
+ useEffect(() => {
16
+ OverlayScrollbars.plugin(ClickScrollPlugin);
17
+ }, []);
18
+ const mergedOptions = useMemo(() => ({
19
+ ...options,
20
+ overflow: {
21
+ x: 'scroll',
22
+ y: 'scroll',
23
+ },
24
+ scrollbars: {
25
+ autoHide: 'scroll',
26
+ autoHideDelay: 600,
27
+ clickScroll: true,
28
+ ...options === null || options === void 0 ? void 0 : options.scrollbars,
29
+ },
30
+ }), [options]);
31
+ const containerStyle = useMemo(() => ({
32
+ ...style,
33
+ maxHeight,
34
+ maxWidth,
35
+ }), [maxHeight, maxWidth, style]);
36
+ // Merge events with onViewportReady callback
37
+ const mergedEvents = useMemo(() => {
38
+ if (!onViewportReady && !events)
39
+ return undefined;
40
+ return {
41
+ ...events,
42
+ initialized: (instance) => {
43
+ const { viewport } = instance.elements();
44
+ onViewportReady === null || onViewportReady === void 0 ? void 0 : onViewportReady(viewport, instance);
45
+ if (events && typeof events !== 'boolean' && events.initialized) {
46
+ const initializedHandler = events.initialized;
47
+ if (Array.isArray(initializedHandler)) {
48
+ initializedHandler.forEach((handler) => handler(instance));
49
+ }
50
+ else {
51
+ initializedHandler(instance);
52
+ }
53
+ }
54
+ },
55
+ };
56
+ }, [events, onViewportReady]);
57
+ // Callback ref for disabled mode - triggers onViewportReady with the div element
58
+ const disabledRef = useCallback((element) => {
59
+ // Forward to user ref if provided
60
+ if (typeof ref === 'function') {
61
+ ref(element);
62
+ }
63
+ else if (ref) {
64
+ ref.current = element;
65
+ }
66
+ // Call onViewportReady with the div element (no OverlayScrollbars instance)
67
+ if (element && onViewportReady) {
68
+ onViewportReady(element);
69
+ }
70
+ }, [onViewportReady, ref]);
71
+ // When disabled, render a plain div instead of OverlayScrollbarsComponent
72
+ if (disabled) {
73
+ return (jsx("div", { ...rest, ref: disabledRef, className: className, style: containerStyle, children: children }));
74
+ }
75
+ return (jsx(OverlayScrollbarsComponent, { ...rest, ref: ref, className: cx(scrollbarClasses.host, className), defer: defer, element: "div", events: mergedEvents, options: mergedOptions, style: containerStyle, children: children }));
76
+ });
77
+
78
+ export { Scrollbar as default };
@@ -0,0 +1,2 @@
1
+ export type { ScrollbarProps } from './typings';
2
+ export { default } from './Scrollbar';
@@ -0,0 +1 @@
1
+ export { default } from './Scrollbar.js';
@@ -0,0 +1,47 @@
1
+ import type { OverlayScrollbars, PartialOptions } from 'overlayscrollbars';
2
+ import type { OverlayScrollbarsComponentProps } from 'overlayscrollbars-react';
3
+ import type { CSSProperties, ReactNode } from 'react';
4
+ import type { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
5
+ export interface ScrollbarProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'children'> {
6
+ /**
7
+ * The content to be rendered inside the scrollable container.
8
+ */
9
+ children?: ReactNode;
10
+ /**
11
+ * Whether to defer the initialization of OverlayScrollbars.
12
+ * This can improve initial render performance.
13
+ * @default true
14
+ */
15
+ defer?: boolean | object;
16
+ /**
17
+ * When true, disables the custom scrollbar and renders as a plain div.
18
+ * Useful for nested contexts where custom scrollbar is not needed.
19
+ * @default false
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * The maximum height of the scrollable container.
24
+ * Can be a CSS value string (e.g., '300px', '50vh') or a number (treated as pixels).
25
+ */
26
+ maxHeight?: CSSProperties['maxHeight'];
27
+ /**
28
+ * The maximum width of the scrollable container.
29
+ * Can be a CSS value string (e.g., '500px', '100%') or a number (treated as pixels).
30
+ */
31
+ maxWidth?: CSSProperties['maxWidth'];
32
+ /**
33
+ * Additional options to pass to OverlayScrollbars.
34
+ * @see https://kingsora.github.io/OverlayScrollbars/#!documentation/options
35
+ */
36
+ options?: PartialOptions;
37
+ /**
38
+ * Event handlers for OverlayScrollbars events.
39
+ * @see https://kingsora.github.io/OverlayScrollbars/#!documentation/events
40
+ */
41
+ events?: OverlayScrollbarsComponentProps['events'];
42
+ /**
43
+ * Callback fired when the scrollbar is initialized.
44
+ * Provides access to the viewport element for external integrations (e.g., virtualization, DnD).
45
+ */
46
+ onViewportReady?: (viewport: HTMLDivElement, instance?: OverlayScrollbars) => void;
47
+ }
@@ -11,7 +11,7 @@ import cx from 'clsx';
11
11
  const isMultipleSelection = (props) => props.mode === 'multiple';
12
12
  function SelectTriggerComponent(props) {
13
13
  var _a, _b, _c;
14
- const { active, className, disabled, forceHideSuffixActionIcon, inputProps, innerRef, inputRef, mode = 'single', onTagClose, overflowStrategy = 'counter', placeholder, readOnly, required, searchText, size = 'main', showTextInputAfterTags = false, suffixAction, suffixActionIcon: suffixActionIconProp, type = 'default', onClick, ...restTextFieldProps } = props;
14
+ const { active, className, disabled, forceHideSuffixActionIcon, inputProps, innerRef, inputRef, isForceClearable = false, mode = 'single', onTagClose, overflowStrategy = 'counter', placeholder, readOnly, required, searchText, size = 'main', showTextInputAfterTags = false, suffixAction, suffixActionIcon: suffixActionIconProp, type = 'default', onClick, ...restTextFieldProps } = props;
15
15
  /** Render value to string for single selection trigger input */
16
16
  const renderValue = () => {
17
17
  var _a, _b;
@@ -46,9 +46,10 @@ function SelectTriggerComponent(props) {
46
46
  return (jsxs(TextField, { ref: innerRef, ...interactiveProps, ...restTextFieldProps, onClick: onClick, active: active, className: cx(selectClasses.trigger, selectClasses.triggerMode(mode), selectClasses.triggerSelected(Array.isArray(props.value) ? (_a = props.value) === null || _a === void 0 ? void 0 : _a.length : props.value), {
47
47
  [selectClasses.triggerReadOnly]: readOnly,
48
48
  [selectClasses.triggerDisabled]: disabled,
49
- }, className), error: type === 'error', size: size, suffix: forceHideSuffixActionIcon ? undefined : suffixActionIcon, clearable: mode === 'multiple' &&
50
- Array.isArray(props.value) &&
51
- !!props.value.length, children: [jsx("input", { ...inputProps, ref: inputRef, "aria-autocomplete": "list", "aria-haspopup": "listbox", autoComplete: "off", className: cx(selectClasses.triggerInput, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className), disabled: disabled, placeholder: placeholder, readOnly: (_b = inputProps === null || inputProps === void 0 ? void 0 : inputProps.readOnly) !== null && _b !== void 0 ? _b : true, required: required, type: "text", value: renderValue() }), isMultipleSelection(props) && ((_c = props.value) === null || _c === void 0 ? void 0 : _c.length) && (jsx(SelectTriggerTags, { disabled: disabled, overflowStrategy: overflowStrategy, inputProps: inputProps, inputRef: inputRef, onTagClose: onTagClose, readOnly: readOnly, required: required, searchText: searchText, size: size, showTextInputAfterTags: showTextInputAfterTags, value: props.value }))] }));
49
+ }, className), error: type === 'error', size: size, suffix: forceHideSuffixActionIcon ? undefined : suffixActionIcon, clearable: isForceClearable ||
50
+ (mode === 'multiple' &&
51
+ Array.isArray(props.value) &&
52
+ !!props.value.length), children: [jsx("input", { ...inputProps, ref: inputRef, "aria-autocomplete": "list", "aria-haspopup": "listbox", autoComplete: "off", className: cx(selectClasses.triggerInput, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className), disabled: disabled, placeholder: placeholder, readOnly: (_b = inputProps === null || inputProps === void 0 ? void 0 : inputProps.readOnly) !== null && _b !== void 0 ? _b : true, required: required, type: "text", value: renderValue() }), isMultipleSelection(props) && ((_c = props.value) === null || _c === void 0 ? void 0 : _c.length) && (jsx(SelectTriggerTags, { disabled: disabled, overflowStrategy: overflowStrategy, inputProps: inputProps, inputRef: inputRef, onTagClose: onTagClose, readOnly: readOnly, required: required, searchText: searchText, size: size, showTextInputAfterTags: showTextInputAfterTags, value: props.value }))] }));
52
53
  }
53
54
  const SelectTrigger = forwardRef((props, ref) => {
54
55
  if (props.mode === 'multiple') {
package/Select/index.d.ts CHANGED
@@ -12,5 +12,3 @@ export { default as OptionGroup } from '../Menu/MenuItemGroup';
12
12
  export type { MenuItemGroupProps as OptionGroupProps } from '../Menu/MenuItemGroup';
13
13
  export type { TreeSelectProps } from './TreeSelect';
14
14
  export { default as TreeSelect } from './TreeSelect';
15
- export type { AutoCompleteProps } from './AutoComplete';
16
- export { default as AutoComplete } from './AutoComplete';
package/Select/index.js CHANGED
@@ -5,4 +5,3 @@ export { default } from './Select.js';
5
5
  export { default as Option } from './Option.js';
6
6
  export { default as OptionGroup } from '../Menu/MenuItemGroup.js';
7
7
  export { default as TreeSelect } from './TreeSelect.js';
8
- export { default as AutoComplete } from './AutoComplete.js';
@@ -1,6 +1,6 @@
1
+ import { SelectTriggerType } from '@mezzanine-ui/core/select';
1
2
  import { ReactElement, Ref } from 'react';
2
3
  import Icon, { IconProps } from '../Icon';
3
- import { SelectTriggerType } from '@mezzanine-ui/core/select';
4
4
  import { TextFieldProps } from '../TextField';
5
5
  import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
6
6
  export interface SelectValue<T = string> {
@@ -48,6 +48,11 @@ export interface SelectTriggerBaseProps extends Omit<TextFieldProps, 'active' |
48
48
  onTagClose?: (target: SelectValue) => void;
49
49
  /** Placeholder text when not selected */
50
50
  placeholder?: string;
51
+ /**
52
+ * Whether to force show clearable icon regardless of value state.
53
+ * @default false
54
+ */
55
+ isForceClearable?: boolean;
51
56
  /**
52
57
  * Whether the input is readonly.
53
58
  * @default false
@@ -36,7 +36,7 @@ const Selection = forwardRef(function Selection(props, ref) {
36
36
  [selectionClasses.readonly]: readonly,
37
37
  }, className), ...(disabled && { 'aria-disabled': true }), ...(onClick && { onClick }), children: [jsxs("div", { className: selectionClasses.container, children: [haveImage
38
38
  ? jsx("img", { src: image, alt: text, className: selectionClasses.selectionImage, style: { objectFit: imageObjectFit } })
39
- : jsx(Icon, { "aria-hidden": "true", className: selectionClasses.icon, color: "neutral-solid", icon: customIcon || FileIcon, size: SELECTION_ICON_SIZE }), jsxs("div", { className: selectionClasses.content, children: [jsx(Typography, { id: textId, color: "text-neutral-solid", variant: "body-highlight", className: selectionClasses.text, children: text }), supportingText && (jsx(Typography, { id: supportingTextId, color: "text-neutral", variant: "caption", className: selectionClasses.supportingText, children: supportingText }))] })] }), !readonly && (jsx("input", { ref: inputRefProp, type: selector, name: name, id: inputId, className: selectionClasses.input, disabled: disabled, ...(checkedProp !== undefined
39
+ : jsx(Icon, { "aria-hidden": "true", className: selectionClasses.icon, color: "neutral-solid", icon: customIcon || FileIcon, size: SELECTION_ICON_SIZE }), jsxs("div", { className: selectionClasses.content, children: [jsx(Typography, { className: selectionClasses.text, color: "text-neutral-solid", display: "block", ellipsis: true, id: textId, variant: "body-highlight", children: text }), supportingText && (jsx(Typography, { className: selectionClasses.supportingText, color: "text-neutral", display: "block", ellipsis: true, id: supportingTextId, variant: "caption", children: supportingText }))] })] }), !readonly && (jsx("input", { ref: inputRefProp, type: selector, name: name, id: inputId, className: selectionClasses.input, disabled: disabled, ...(checkedProp !== undefined
40
40
  ? { checked: checkedProp }
41
41
  : { defaultChecked }), value: value, onChange: onInputChange, ...(isRadioOrCheckbox && checkedProp !== undefined
42
42
  ? { 'aria-checked': checkedProp }
@@ -0,0 +1,28 @@
1
+ import { ComponentProps, ReactElement } from 'react';
2
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
3
+ import Selection, { SelectionProps } from './Selection';
4
+ export interface SelectionGroupBaseProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'children'> {
5
+ /**
6
+ * The class name of the selection group.
7
+ */
8
+ className?: string;
9
+ }
10
+ export interface SelectionGroupProps extends SelectionGroupBaseProps {
11
+ /**
12
+ * The selections in the group.
13
+ * Only Selection components are allowed.
14
+ * When provided, will take priority over selections prop.
15
+ */
16
+ children?: ReactElement<ComponentProps<typeof Selection>> | ReactElement<ComponentProps<typeof Selection>>[];
17
+ /**
18
+ * The selections array.
19
+ * When provided, Selection components will be automatically rendered.
20
+ * Will be ignored if children is provided.
21
+ */
22
+ selections?: SelectionProps[];
23
+ }
24
+ /**
25
+ * The react component for `mezzanine` selection group.
26
+ */
27
+ declare const SelectionGroup: import("react").ForwardRefExoticComponent<SelectionGroupProps & import("react").RefAttributes<HTMLDivElement>>;
28
+ export default SelectionGroup;
@@ -1,4 +1,4 @@
1
- import { isRangeSlider, fixRangeSliderValue, fixSingleSliderValue, toSliderCssVars, getPercentage, sortSliderValue, findClosetValueIndex, getSliderRect, getValueFromClientX, roundToStep } from '@mezzanine-ui/core/slider';
1
+ import { isRangeSlider, fixRangeSliderValue, fixSingleSliderValue, toSliderCssVars, getPercentage, findClosetValueIndex, sortSliderValue, getSliderRect, getValueFromClientX, roundToStep } from '@mezzanine-ui/core/slider';
2
2
  import { useRef, useState } from 'react';
3
3
  import { useDocumentEvents } from '../hooks/useDocumentEvents.js';
4
4