@mezzanine-ui/react 1.0.0-beta.6 → 1.0.0-beta.7

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 (142) hide show
  1. package/Accordion/Accordion.d.ts +23 -1
  2. package/Accordion/Accordion.js +59 -11
  3. package/Accordion/AccordionActions.d.ts +13 -0
  4. package/Accordion/AccordionActions.js +24 -0
  5. package/Accordion/AccordionContent.d.ts +9 -0
  6. package/Accordion/{AccordionDetails.js → AccordionContent.js} +4 -6
  7. package/Accordion/AccordionControlContext.d.ts +2 -2
  8. package/Accordion/AccordionGroup.d.ts +10 -0
  9. package/Accordion/AccordionGroup.js +26 -0
  10. package/Accordion/AccordionTitle.d.ts +14 -0
  11. package/Accordion/AccordionTitle.js +56 -0
  12. package/Accordion/index.d.ts +8 -4
  13. package/Accordion/index.js +4 -2
  14. package/AutoComplete/AutoComplete.d.ts +20 -6
  15. package/AutoComplete/AutoComplete.js +118 -30
  16. package/Backdrop/Backdrop.js +15 -19
  17. package/Calendar/CalendarDays.js +1 -1
  18. package/Card/BaseCard.d.ts +11 -0
  19. package/Card/BaseCard.js +48 -0
  20. package/Card/BaseCardSkeleton.d.ts +14 -0
  21. package/Card/BaseCardSkeleton.js +18 -0
  22. package/Card/CardGroup.d.ts +47 -0
  23. package/Card/CardGroup.js +147 -0
  24. package/Card/FourThumbnailCard.d.ts +14 -0
  25. package/Card/FourThumbnailCard.js +73 -0
  26. package/Card/FourThumbnailCardSkeleton.d.ts +14 -0
  27. package/Card/FourThumbnailCardSkeleton.js +20 -0
  28. package/Card/QuickActionCard.d.ts +12 -0
  29. package/Card/QuickActionCard.js +23 -0
  30. package/Card/QuickActionCardSkeleton.d.ts +14 -0
  31. package/Card/QuickActionCardSkeleton.js +18 -0
  32. package/Card/SingleThumbnailCard.d.ts +13 -0
  33. package/Card/SingleThumbnailCard.js +44 -0
  34. package/Card/SingleThumbnailCardSkeleton.d.ts +19 -0
  35. package/Card/SingleThumbnailCardSkeleton.js +18 -0
  36. package/Card/Thumbnail.d.ts +12 -0
  37. package/Card/Thumbnail.js +18 -0
  38. package/Card/ThumbnailCardInfo.d.ts +34 -0
  39. package/Card/ThumbnailCardInfo.js +43 -0
  40. package/Card/index.d.ts +43 -4
  41. package/Card/index.js +19 -2
  42. package/Card/typings.d.ts +442 -0
  43. package/Checkbox/Checkbox.d.ts +8 -0
  44. package/Checkbox/Checkbox.js +3 -2
  45. package/Checkbox/CheckboxGroup.js +1 -1
  46. package/ContentHeader/ContentHeader.d.ts +22 -70
  47. package/ContentHeader/ContentHeader.js +1 -1
  48. package/ContentHeader/ContentHeaderResponsive.d.ts +9 -0
  49. package/ContentHeader/ContentHeaderResponsive.js +7 -0
  50. package/ContentHeader/utils.d.ts +3 -3
  51. package/ContentHeader/utils.js +66 -20
  52. package/Cropper/Cropper.d.ts +66 -0
  53. package/Cropper/Cropper.js +115 -0
  54. package/Cropper/CropperElement.d.ts +10 -0
  55. package/Cropper/CropperElement.js +892 -0
  56. package/Cropper/index.d.ts +18 -0
  57. package/Cropper/index.js +8 -0
  58. package/Cropper/tools.d.ts +90 -0
  59. package/Cropper/tools.js +143 -0
  60. package/Cropper/typings.d.ts +69 -0
  61. package/Cropper/utils/cropper-calculations.d.ts +39 -0
  62. package/Cropper/utils/cropper-calculations.js +95 -0
  63. package/DateTimePicker/DateTimePicker.d.ts +1 -1
  64. package/DateTimePicker/DateTimePicker.js +14 -1
  65. package/Dropdown/Dropdown.d.ts +7 -1
  66. package/Dropdown/Dropdown.js +31 -14
  67. package/Dropdown/DropdownItem.d.ts +7 -1
  68. package/Dropdown/DropdownItem.js +36 -6
  69. package/Dropdown/DropdownItemCard.js +2 -1
  70. package/FloatingButton/FloatingButton.d.ts +21 -0
  71. package/FloatingButton/FloatingButton.js +18 -0
  72. package/FloatingButton/index.d.ts +2 -0
  73. package/FloatingButton/index.js +1 -0
  74. package/Form/FormField.d.ts +21 -10
  75. package/Form/FormField.js +12 -4
  76. package/Input/Input.js +9 -2
  77. package/Message/Message.js +1 -1
  78. package/MultipleDatePicker/MultipleDatePicker.js +2 -2
  79. package/Navigation/NavigationHeader.js +1 -1
  80. package/Picker/FormattedInput.d.ts +1 -1
  81. package/Picker/FormattedInput.js +2 -1
  82. package/Picker/PickerTriggerWithSeparator.d.ts +10 -0
  83. package/Picker/PickerTriggerWithSeparator.js +2 -2
  84. package/Picker/useDateInputFormatter.d.ts +6 -0
  85. package/Picker/useDateInputFormatter.js +4 -1
  86. package/Select/Select.d.ts +2 -8
  87. package/Select/Select.js +12 -33
  88. package/Select/SelectTrigger.js +21 -7
  89. package/Select/index.d.ts +0 -4
  90. package/Select/index.js +0 -2
  91. package/Select/typings.d.ts +0 -4
  92. package/Select/useSelectTriggerTags.d.ts +1 -1
  93. package/Select/useSelectTriggerTags.js +9 -6
  94. package/Separator/Separator.d.ts +14 -0
  95. package/Separator/Separator.js +17 -0
  96. package/Separator/index.d.ts +2 -0
  97. package/Separator/index.js +1 -0
  98. package/Table/utils/useTableRowSelection.js +6 -0
  99. package/Tag/TagGroup.d.ts +4 -2
  100. package/Tag/TagGroup.js +7 -4
  101. package/TextField/TextField.d.ts +1 -1
  102. package/TextField/TextField.js +63 -9
  103. package/TimePanel/TimePanelColumn.js +19 -12
  104. package/index.d.ts +27 -28
  105. package/index.js +23 -25
  106. package/package.json +4 -4
  107. package/Accordion/AccordionDetails.d.ts +0 -9
  108. package/Accordion/AccordionSummary.d.ts +0 -18
  109. package/Accordion/AccordionSummary.js +0 -51
  110. package/Alert/Alert.d.ts +0 -20
  111. package/Alert/Alert.js +0 -18
  112. package/Alert/index.d.ts +0 -3
  113. package/Alert/index.js +0 -1
  114. package/Card/Card.d.ts +0 -51
  115. package/Card/Card.js +0 -20
  116. package/Card/CardActions.d.ts +0 -34
  117. package/Card/CardActions.js +0 -15
  118. package/ConfirmActions/ConfirmActions.d.ts +0 -46
  119. package/ConfirmActions/ConfirmActions.js +0 -15
  120. package/ConfirmActions/index.d.ts +0 -2
  121. package/ConfirmActions/index.js +0 -1
  122. package/Select/Option.d.ts +0 -18
  123. package/Select/Option.js +0 -45
  124. package/Select/TreeSelect.d.ts +0 -72
  125. package/Select/TreeSelect.js +0 -205
  126. package/Tree/Tree.d.ts +0 -70
  127. package/Tree/Tree.js +0 -139
  128. package/Tree/TreeNode.d.ts +0 -40
  129. package/Tree/TreeNode.js +0 -50
  130. package/Tree/TreeNodeList.d.ts +0 -24
  131. package/Tree/TreeNodeList.js +0 -28
  132. package/Tree/getTreeNodeEntities.d.ts +0 -11
  133. package/Tree/getTreeNodeEntities.js +0 -92
  134. package/Tree/index.d.ts +0 -13
  135. package/Tree/index.js +0 -7
  136. package/Tree/toggleValue.d.ts +0 -4
  137. package/Tree/toggleValue.js +0 -19
  138. package/Tree/traverseTree.d.ts +0 -2
  139. package/Tree/traverseTree.js +0 -11
  140. package/Tree/typings.d.ts +0 -16
  141. package/Tree/useTreeExpandedValue.d.ts +0 -14
  142. package/Tree/useTreeExpandedValue.js +0 -33
@@ -1,5 +1,13 @@
1
+ import React from 'react';
1
2
  import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
3
+ import { AccordionTitleProps } from './AccordionTitle';
2
4
  export interface AccordionProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onChange'> {
5
+ /**
6
+ * The content of the component. <br />
7
+ * The first child will be treated as the title of the accordion, and the rest will be treated as the content of the accordion.
8
+ * You can also use `title` prop to set the title of the accordion, then all children will be treated as the content of the accordion.
9
+ */
10
+ children: React.ReactNode;
3
11
  /**
4
12
  * If true, expands the accordion by default.
5
13
  * @default false
@@ -18,6 +26,20 @@ export interface AccordionProps extends Omit<NativeElementPropsWithoutKeyAndRef<
18
26
  * Callback fired when the expand/collapse state is changed.
19
27
  */
20
28
  onChange?(e: boolean): void;
29
+ /**
30
+ * The size of accordion.
31
+ * @default 'main'
32
+ */
33
+ size?: 'main' | 'sub';
34
+ /**
35
+ * The title of accordion.
36
+ */
37
+ title?: string;
38
+ /**
39
+ * The actions displayed on the right side of the accordion title. <br />
40
+ * Only `Button` or `Dropdown` is allowed.
41
+ */
42
+ actions?: AccordionTitleProps['actions'];
21
43
  }
22
- declare const Accordion: import("react").ForwardRefExoticComponent<AccordionProps & import("react").RefAttributes<HTMLDivElement>>;
44
+ declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
23
45
  export default Accordion;
@@ -1,12 +1,54 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef, useState, useCallback, Children, useMemo } from 'react';
2
+ import React, { forwardRef, useState, useCallback, useMemo, cloneElement } from 'react';
3
3
  import { accordionClasses } from '@mezzanine-ui/core/accordion';
4
4
  import { AccordionControlContext } from './AccordionControlContext.js';
5
+ import { MOTION_EASING, MOTION_DURATION } from '@mezzanine-ui/system/motion';
6
+ import AccordionTitle from './AccordionTitle.js';
7
+ import { flattenChildren } from '../utils/flatten-children.js';
8
+ import AccordionContent from './AccordionContent.js';
9
+ import Fade from '../Transition/Fade.js';
5
10
  import cx from 'clsx';
6
11
 
12
+ const resolveChildren = (children) => {
13
+ let title = null;
14
+ let content = null;
15
+ const restContentChildren = [];
16
+ flattenChildren(children).forEach((child) => {
17
+ if (React.isValidElement(child) && child.type === AccordionTitle) {
18
+ if (title) {
19
+ console.warn('[Mezzanine][Accordion] Only one AccordionTitle is allowed as children of Accordion.');
20
+ }
21
+ title = child;
22
+ }
23
+ else if (React.isValidElement(child) && child.type === AccordionContent) {
24
+ if (content) {
25
+ console.warn('[Mezzanine][Accordion] Only one AccordionContent is allowed as children of Accordion.');
26
+ }
27
+ content = child;
28
+ }
29
+ else {
30
+ restContentChildren.push(child);
31
+ }
32
+ });
33
+ if (restContentChildren.length > 0) {
34
+ if (content || title) {
35
+ console.warn('[Mezzanine][Accordion] When <AccordionTitle> or <AccordionContent> is used as children. Please wrap other children with AccordionContent.');
36
+ }
37
+ if (!content) {
38
+ content = jsx(AccordionContent, {});
39
+ }
40
+ content = cloneElement(content, {
41
+ children: [content.props.children, ...restContentChildren],
42
+ });
43
+ }
44
+ return {
45
+ title,
46
+ content,
47
+ };
48
+ };
7
49
  const Accordion = forwardRef(function Accordion(props, ref) {
8
- const { className, children: childrenProp, defaultExpanded = false, disabled = false, expanded: expandedProp, onChange, ...rest } = props;
9
- const [expanded, toggleExpanded] = useState(defaultExpanded || false);
50
+ const { actions, children: childrenProp, className, defaultExpanded = false, disabled = false, expanded: expandedProp, onChange, size = 'main', title, ...rest } = props;
51
+ const [expanded, toggleExpanded] = useState(defaultExpanded !== null && defaultExpanded !== void 0 ? defaultExpanded : false);
10
52
  const onToggleExpanded = useCallback((newStatus) => {
11
53
  if (typeof onChange === 'function') {
12
54
  onChange(newStatus);
@@ -15,20 +57,26 @@ const Accordion = forwardRef(function Accordion(props, ref) {
15
57
  toggleExpanded(newStatus);
16
58
  }
17
59
  }, [onChange]);
18
- const [summary, ...children] = Children.toArray(childrenProp);
60
+ const { title: resolvedTitle, content: resolvedContent } = useMemo(() => resolveChildren(childrenProp), [childrenProp]);
19
61
  const contextValue = useMemo(() => {
20
- var _a, _b;
62
+ var _a, _b, _c;
21
63
  return ({
22
- detailsId: ((_a = summary === null || summary === void 0 ? void 0 : summary.props) === null || _a === void 0 ? void 0 : _a.id)
23
- ? `${summary.props.id}-details`
64
+ contentId: resolvedTitle && ((_a = resolvedTitle === null || resolvedTitle === void 0 ? void 0 : resolvedTitle.props) === null || _a === void 0 ? void 0 : _a.id)
65
+ ? `${resolvedTitle.props.id}-content`
24
66
  : undefined,
25
67
  disabled,
26
- expanded: expandedProp || expanded,
27
- summaryId: (_b = summary === null || summary === void 0 ? void 0 : summary.props) === null || _b === void 0 ? void 0 : _b.id,
68
+ expanded: expandedProp !== null && expandedProp !== void 0 ? expandedProp : expanded,
69
+ titleId: (_c = (resolvedTitle && ((_b = resolvedTitle === null || resolvedTitle === void 0 ? void 0 : resolvedTitle.props) === null || _b === void 0 ? void 0 : _b.id))) !== null && _c !== void 0 ? _c : undefined,
28
70
  toggleExpanded: onToggleExpanded,
29
71
  });
30
- }, [disabled, expandedProp, expanded, onToggleExpanded, summary]);
31
- return (jsx("div", { ...rest, ref: ref, className: cx(accordionClasses.host, className), children: jsxs(AccordionControlContext.Provider, { value: contextValue, children: [summary, children] }) }));
72
+ }, [disabled, expandedProp, expanded, onToggleExpanded, resolvedTitle]);
73
+ return (jsx("div", { ...rest, ref: ref, className: cx(accordionClasses.host, accordionClasses.size(size), className), children: jsxs(AccordionControlContext.Provider, { value: contextValue, children: [title ? (jsx(AccordionTitle, { actions: actions, children: title })) : (resolvedTitle), jsx(Fade, { duration: {
74
+ enter: MOTION_DURATION.moderate,
75
+ exit: MOTION_DURATION.moderate,
76
+ }, easing: {
77
+ enter: MOTION_EASING.entrance,
78
+ exit: MOTION_EASING.exit,
79
+ }, in: expandedProp !== null && expandedProp !== void 0 ? expandedProp : expanded, children: jsx("div", { children: resolvedContent }) })] }) }));
32
80
  });
33
81
 
34
82
  export { Accordion as default };
@@ -0,0 +1,13 @@
1
+ import { ReactElement } from 'react';
2
+ import { ButtonGroupProps, ButtonProps } from '../Button';
3
+ import { DropdownProps } from '../Dropdown';
4
+ type AccordionActionsChild = ReactElement<DropdownProps> | ReactElement<ButtonProps> | null | undefined | false;
5
+ export interface AccordionActionsProps extends Omit<ButtonGroupProps, 'children'> {
6
+ /**
7
+ * The content of the component. <br />
8
+ * Only `Button` or `Dropdown` is allowed.
9
+ */
10
+ children?: AccordionActionsChild | AccordionActionsChild[];
11
+ }
12
+ declare const AccordionActions: React.FC<AccordionActionsProps>;
13
+ export default AccordionActions;
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { isValidElement } from 'react';
4
+ import Button from '../Button/Button.js';
5
+ import ButtonGroup from '../Button/ButtonGroup.js';
6
+ import { flattenChildren } from '../utils/flatten-children.js';
7
+ import { accordionClasses } from '@mezzanine-ui/core/accordion';
8
+ import Dropdown from '../Dropdown/Dropdown.js';
9
+ import cx from 'clsx';
10
+
11
+ const AccordionActions = ({ children, className, ...rest }) => {
12
+ const filteredChildren = flattenChildren(children).map((child) => {
13
+ if (isValidElement(child) &&
14
+ child.type !== Button &&
15
+ child.type !== Dropdown) {
16
+ console.warn('[Mezzanine][Accordion] Only Button or Dropdown is allowed as the child of AccordionActions.');
17
+ return null;
18
+ }
19
+ return child;
20
+ });
21
+ return (jsx(ButtonGroup, { className: cx(accordionClasses.titleActions, className), ...rest, children: filteredChildren }));
22
+ };
23
+
24
+ export { AccordionActions as default };
@@ -0,0 +1,9 @@
1
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
2
+ export interface AccordionContentProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
3
+ /**
4
+ * If true, expands the content, otherwise collapse it.
5
+ */
6
+ expanded?: boolean;
7
+ }
8
+ declare const AccordionContent: import("react").ForwardRefExoticComponent<AccordionContentProps & import("react").RefAttributes<HTMLDivElement>>;
9
+ export default AccordionContent;
@@ -6,9 +6,9 @@ import { AccordionControlContext } from './AccordionControlContext.js';
6
6
  import Collapse from '../Transition/Collapse.js';
7
7
  import cx from 'clsx';
8
8
 
9
- const AccordionDetails = forwardRef(function AccordionDetails(props, ref) {
9
+ const AccordionContent = forwardRef(function AccordionContent(props, ref) {
10
10
  const { className, children, expanded: expandedProp, ...rest } = props;
11
- const { detailsId, expanded, summaryId } = useContext(AccordionControlContext) || {};
11
+ const { contentId: detailsId, expanded, titleId: summaryId, } = useContext(AccordionControlContext) || {};
12
12
  const ariaProps = useMemo(() => {
13
13
  if (summaryId && detailsId) {
14
14
  return {
@@ -18,9 +18,7 @@ const AccordionDetails = forwardRef(function AccordionDetails(props, ref) {
18
18
  }
19
19
  return {};
20
20
  }, [summaryId, detailsId]);
21
- return (jsx(Collapse, { style: { width: '100%' }, in: expandedProp || expanded, children: jsx("div", { ...rest, ...ariaProps, ref: ref, className: cx(accordionClasses.details, {
22
- [accordionClasses.detailsExpanded]: expandedProp || expanded,
23
- }, className), role: "region", children: children }) }));
21
+ return (jsx(Collapse, { style: { width: '100%' }, in: expandedProp || expanded, children: jsx("div", { ...rest, ...ariaProps, ref: ref, className: cx(accordionClasses.content, className), role: "region", children: children }) }));
24
22
  });
25
23
 
26
- export { AccordionDetails as default };
24
+ export { AccordionContent as default };
@@ -1,8 +1,8 @@
1
1
  export interface AccordionControlContextValue {
2
- detailsId?: string;
2
+ contentId?: string;
3
3
  disabled: boolean;
4
4
  expanded: boolean;
5
- summaryId?: string;
5
+ titleId?: string;
6
6
  toggleExpanded(e: boolean): void;
7
7
  }
8
8
  export declare const AccordionControlContext: import("react").Context<AccordionControlContextValue | undefined>;
@@ -0,0 +1,10 @@
1
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
2
+ export interface AccordionGroupProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
3
+ /**
4
+ * The size of accordion group, which will be passed to each Accordion in the group.
5
+ * @default 'main'
6
+ */
7
+ size?: 'main' | 'sub';
8
+ }
9
+ declare const AccordionGroup: import("react").ForwardRefExoticComponent<AccordionGroupProps & import("react").RefAttributes<HTMLDivElement>>;
10
+ export default AccordionGroup;
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { forwardRef, useMemo, isValidElement } from 'react';
4
+ import { accordionGroupClasses } from '@mezzanine-ui/core/accordion';
5
+ import { flattenChildren } from '../utils/flatten-children.js';
6
+ import Accordion from './Accordion.js';
7
+ import cx from 'clsx';
8
+
9
+ const AccordionGroup = forwardRef(function AccordionGroup(props, ref) {
10
+ const { className, children, size, ...rest } = props;
11
+ const childrenWithSize = useMemo(() => flattenChildren(children).map((child) => {
12
+ if (isValidElement(child) && child.type === Accordion) {
13
+ return {
14
+ ...child,
15
+ props: {
16
+ ...child.props,
17
+ size,
18
+ },
19
+ };
20
+ }
21
+ return child;
22
+ }), [children, size]);
23
+ return (jsx("div", { ...rest, ref: ref, className: cx(accordionGroupClasses.host, className), children: childrenWithSize }));
24
+ });
25
+
26
+ export { AccordionGroup as default };
@@ -0,0 +1,14 @@
1
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
2
+ import { AccordionActionsProps } from './AccordionActions';
3
+ export interface AccordionTitleProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
4
+ /**
5
+ * Custom ChevronRight icon className.
6
+ */
7
+ iconClassName?: string;
8
+ /**
9
+ * Custom suffix actions.
10
+ */
11
+ actions?: AccordionActionsProps;
12
+ }
13
+ declare const AccordionTitle: import("react").ForwardRefExoticComponent<AccordionTitleProps & import("react").RefAttributes<HTMLDivElement>>;
14
+ export default AccordionTitle;
@@ -0,0 +1,56 @@
1
+ 'use client';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { forwardRef, useContext, useCallback, useMemo, isValidElement } from 'react';
4
+ import { ChevronRightIcon } from '@mezzanine-ui/icons';
5
+ import { accordionClasses } from '@mezzanine-ui/core/accordion';
6
+ import { AccordionControlContext } from './AccordionControlContext.js';
7
+ import { flattenChildren } from '../utils/flatten-children.js';
8
+ import AccordionActions from './AccordionActions.js';
9
+ import Rotate from '../Transition/Rotate.js';
10
+ import Icon from '../Icon/Icon.js';
11
+ import cx from 'clsx';
12
+
13
+ const resolveChildren = (children) => {
14
+ const mainPartChildren = [];
15
+ const actionsChildren = [];
16
+ flattenChildren(children).forEach((child) => {
17
+ if (isValidElement(child) && child.type === AccordionActions) {
18
+ actionsChildren.push(child);
19
+ }
20
+ else {
21
+ mainPartChildren.push(child);
22
+ }
23
+ });
24
+ return { mainPartChildren, actionsChildren };
25
+ };
26
+ const AccordionTitle = forwardRef(function AccordionTitle(props, ref) {
27
+ const { className, children, iconClassName: iconClassNameProp, actions: suffixActions, ...rest } = props;
28
+ const { contentId, disabled, expanded, toggleExpanded } = useContext(AccordionControlContext) || {};
29
+ const onToggle = useCallback((e) => {
30
+ e.stopPropagation();
31
+ if (typeof toggleExpanded === 'function' && !disabled) {
32
+ toggleExpanded(!expanded);
33
+ }
34
+ }, [disabled, expanded, toggleExpanded]);
35
+ const ariaProps = useMemo(() => {
36
+ let result = {
37
+ 'aria-expanded': expanded,
38
+ };
39
+ if (contentId) {
40
+ result = {
41
+ ...result,
42
+ 'aria-controls': contentId,
43
+ };
44
+ }
45
+ return result;
46
+ }, [contentId, expanded]);
47
+ const { mainPartChildren, actionsChildren } = useMemo(() => resolveChildren(children), [children]);
48
+ return (jsxs("div", { ...rest, ref: ref, className: cx(accordionClasses.title, {
49
+ [accordionClasses.titleExpanded]: expanded,
50
+ [accordionClasses.titleDisabled]: disabled,
51
+ }, className), children: [jsxs("button", { className: accordionClasses.titleMainPart, onClick: onToggle, type: "button", ...ariaProps, children: [jsx(Rotate, { in: expanded, degrees: -90, children: jsx(Icon, { size: 16, className: cx(accordionClasses.titleIcon, {
52
+ [accordionClasses.titleIconDisabled]: disabled,
53
+ }, iconClassNameProp), icon: ChevronRightIcon }) }), mainPartChildren] }), suffixActions ? (jsx(AccordionActions, { ...suffixActions })) : (actionsChildren)] }));
54
+ });
55
+
56
+ export { AccordionTitle as default };
@@ -1,6 +1,10 @@
1
1
  export type { AccordionProps } from './Accordion';
2
2
  export { default } from './Accordion';
3
- export { default as AccordionSummary } from './AccordionSummary';
4
- export type { AccordionSummaryProps } from './AccordionSummary';
5
- export { default as AccordionDetails } from './AccordionDetails';
6
- export type { AccordionDetailsProps } from './AccordionDetails';
3
+ export { default as AccordionTitle } from './AccordionTitle';
4
+ export type { AccordionTitleProps } from './AccordionTitle';
5
+ export { default as AccordionContent } from './AccordionContent';
6
+ export type { AccordionContentProps } from './AccordionContent';
7
+ export { default as AccordionActions } from './AccordionActions';
8
+ export type { AccordionActionsProps } from './AccordionActions';
9
+ export { default as AccordionGroup } from './AccordionGroup';
10
+ export type { AccordionGroupProps } from './AccordionGroup';
@@ -1,3 +1,5 @@
1
1
  export { default } from './Accordion.js';
2
- export { default as AccordionSummary } from './AccordionSummary.js';
3
- export { default as AccordionDetails } from './AccordionDetails.js';
2
+ export { default as AccordionTitle } from './AccordionTitle.js';
3
+ export { default as AccordionContent } from './AccordionContent.js';
4
+ export { default as AccordionActions } from './AccordionActions.js';
5
+ export { default as AccordionGroup } from './AccordionGroup.js';
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, RefObject, SetStateAction } from 'react';
2
2
  import { AutoCompleteSelector } from '@mezzanine-ui/core/autocomplete';
3
- import { DropdownInputPosition } from '@mezzanine-ui/core/dropdown/dropdown';
3
+ import { DropdownInputPosition, DropdownLoadingPosition } from '@mezzanine-ui/core/dropdown/dropdown';
4
4
  import { PopperProps } from '../Popper';
5
5
  import type { SelectTriggerInputProps, SelectTriggerProps } from '../Select/typings';
6
6
  import { SelectValue } from '../Select/typings';
@@ -19,6 +19,11 @@ export interface AutoCompleteBaseProps extends Omit<SelectTriggerProps, 'active'
19
19
  * @default false
20
20
  */
21
21
  asyncData?: boolean;
22
+ /**
23
+ * Whether to clear search text when leaving the textfield/dropdown scope.
24
+ * @default true
25
+ */
26
+ clearSearchText?: boolean;
22
27
  /**
23
28
  * Characters that can be used to separate multiple items when creating.
24
29
  * When these characters are entered, they will trigger item creation.
@@ -40,11 +45,6 @@ export interface AutoCompleteBaseProps extends Omit<SelectTriggerProps, 'active'
40
45
  * @important When using with react-hook-form or native forms, this prop is recommended.
41
46
  */
42
47
  id?: string;
43
- /**
44
- * Whether to keep search text visible after blur when no value is selected.
45
- * @default false
46
- */
47
- keepSearchTextOnBlur?: boolean;
48
48
  /**
49
49
  * The position of the input.
50
50
  * @default 'outside'
@@ -63,6 +63,12 @@ export interface AutoCompleteBaseProps extends Omit<SelectTriggerProps, 'active'
63
63
  * The text of the dropdown loading status.
64
64
  */
65
65
  loadingText?: string;
66
+ /**
67
+ * The position to display the loading status.
68
+ * Only takes effect when `loading` is true.
69
+ * @default 'bottom'
70
+ */
71
+ loadingPosition?: DropdownLoadingPosition;
66
72
  /**
67
73
  * The max height of the dropdown list.
68
74
  */
@@ -177,6 +183,14 @@ export type AutoCompleteMultipleProps = AutoCompleteBaseProps & {
177
183
  * The change event handler of input element.
178
184
  */
179
185
  onChange?(newOptions: SelectValue[]): void;
186
+ /**
187
+ * Tag overflow strategy:
188
+ * - counter: collapse extra tags into a counter tag showing the remaining count.
189
+ * - wrap: wrap to new lines to display all tags.
190
+ * @default 'counter'
191
+ *
192
+ */
193
+ overflowStrategy?: 'counter' | 'wrap';
180
194
  /**
181
195
  * The selector of input.
182
196
  * @default 'input'