@conveyorhq/arrow-ds 1.125.0 → 1.127.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@conveyorhq/arrow-ds",
3
3
  "author": "Conveyor",
4
4
  "license": "MIT",
5
- "version": "1.125.0",
5
+ "version": "1.127.0",
6
6
  "description": "Arrow Design System",
7
7
  "repository": "https://github.com/conveyor/arrow-ds",
8
8
  "publishConfig": {
@@ -13,7 +13,7 @@ declare type AccordionGroupChildrenUnionType = AccordionGroupChildFunction | {
13
13
  children: React.ReactNode;
14
14
  };
15
15
  export declare type AccordionGroupProps = AccordionGroupOwnProps & AccordionGroupChildrenUnionType & Pick<StackProps, "spacing" | "className">;
16
- export declare const AccordionGroup: ({ children, spacing, defaultValue, disableAnimation, allowMultiple, className, ...rest }: AccordionGroupProps) => JSX.Element;
16
+ export declare const AccordionGroup: ({ children, spacing, defaultValue, disableAnimation, allowMultiple, allowToggle, className, ...rest }: AccordionGroupProps) => JSX.Element;
17
17
  export declare type AccordionItemProps = AccordionItemOwnProps & BoxProps;
18
18
  export declare const AccordionItem: ({ value, defaultIsOpen: defaultIsOpenProp, children, className, ...rest }: AccordionItemProps) => JSX.Element;
19
19
  declare type AccordionButtonChildProps = Omit<AccordionDisclosureProps, "onToggle">;
@@ -28,8 +28,9 @@ export declare const AccordionButton: React.ForwardRefExoticComponent<AccordionB
28
28
  export declare type AccordionIconProps = {
29
29
  className?: string;
30
30
  direction?: "up" | "down" | "left" | "right";
31
+ disabled?: boolean;
31
32
  } & Pick<IconProps, "color">;
32
- export declare const AccordionIcon: ({ className, direction, color, }: AccordionIconProps) => JSX.Element;
33
+ export declare const AccordionIcon: ({ className, direction, color, disabled, }: AccordionIconProps) => JSX.Element;
33
34
  export declare type AccordionContentProps = {
34
35
  children: React.ReactNode;
35
36
  maxHeight?: string;
@@ -41,10 +42,10 @@ export declare const AccordionContent: ({ children, maxHeight, style, className,
41
42
  export declare type AccordionProps = AccordionOwnProps & BoxProps;
42
43
  export declare const Accordion: {
43
44
  (props: AccordionProps): JSX.Element;
44
- Group: ({ children, spacing, defaultValue, disableAnimation, allowMultiple, className, ...rest }: AccordionGroupProps) => JSX.Element;
45
+ Group: ({ children, spacing, defaultValue, disableAnimation, allowMultiple, allowToggle, className, ...rest }: AccordionGroupProps) => JSX.Element;
45
46
  Item: ({ value, defaultIsOpen: defaultIsOpenProp, children, className, ...rest }: AccordionItemProps) => JSX.Element;
46
47
  Button: React.ForwardRefExoticComponent<AccordionButtonProps & React.RefAttributes<HTMLButtonElement>>;
47
- Icon: ({ className, direction, color, }: AccordionIconProps) => JSX.Element;
48
+ Icon: ({ className, direction, color, disabled, }: AccordionIconProps) => JSX.Element;
48
49
  Content: ({ children, maxHeight, style, className, scrollClassName, ...rest }: AccordionContentProps) => JSX.Element;
49
50
  };
50
51
  export {};
@@ -20,7 +20,7 @@ const Heading_1 = require("../Heading");
20
20
  const Icon_1 = require("../Icon");
21
21
  const context_1 = require("./context");
22
22
  const cn = utilities_1.bemHOF("Accordion");
23
- const AccordionGroup = ({ children, spacing = 0, defaultValue, disableAnimation, allowMultiple = true, className, ...rest }) => {
23
+ const AccordionGroup = ({ children, spacing = 0, defaultValue, disableAnimation, allowMultiple = true, allowToggle = true, className, ...rest }) => {
24
24
  const totalItems = react_1.default.Children.count(children);
25
25
  const [currentValue, setCurrentValue] = react_1.default.useState(defaultValue || "");
26
26
  const context = react_1.default.useMemo(() => ({
@@ -30,13 +30,21 @@ const AccordionGroup = ({ children, spacing = 0, defaultValue, disableAnimation,
30
30
  currentValue,
31
31
  setCurrentValue,
32
32
  allowMultiple,
33
- }), [defaultValue, disableAnimation, totalItems, currentValue, allowMultiple]);
33
+ allowToggle,
34
+ }), [
35
+ defaultValue,
36
+ disableAnimation,
37
+ totalItems,
38
+ currentValue,
39
+ allowMultiple,
40
+ allowToggle,
41
+ ]);
34
42
  return (react_1.default.createElement(context_1.AccordionGroupContext.Provider, { value: context },
35
43
  react_1.default.createElement(Stack_1.Stack, Object.assign({ orientation: types_1.ORIENTATION.VERTICAL, spacing: spacing, className: className }, rest), typeof children === "function" ? children({ currentValue }) : children)));
36
44
  };
37
45
  exports.AccordionGroup = AccordionGroup;
38
46
  const AccordionItem = ({ value, defaultIsOpen: defaultIsOpenProp, children, className, ...rest }) => {
39
- const { defaultValue, currentValue, setCurrentValue, allowMultiple, } = context_1.useAccordionGroupContext();
47
+ const { defaultValue, currentValue, setCurrentValue, allowMultiple, allowToggle, } = context_1.useAccordionGroupContext();
40
48
  const hasDefaultValue = typeof defaultValue === "undefined" ? false : defaultValue === value;
41
49
  const defaultIsOpen = typeof defaultIsOpenProp === "undefined"
42
50
  ? hasDefaultValue
@@ -57,6 +65,7 @@ const AccordionItem = ({ value, defaultIsOpen: defaultIsOpenProp, children, clas
57
65
  currentValue,
58
66
  setCurrentValue,
59
67
  allowMultiple,
68
+ allowToggle,
60
69
  }), [
61
70
  defaultIsOpen,
62
71
  isOpen,
@@ -69,6 +78,7 @@ const AccordionItem = ({ value, defaultIsOpen: defaultIsOpenProp, children, clas
69
78
  currentValue,
70
79
  setCurrentValue,
71
80
  allowMultiple,
81
+ allowToggle,
72
82
  ]);
73
83
  react_1.default.useEffect(() => {
74
84
  if (!allowMultiple && currentValue !== value) {
@@ -83,7 +93,7 @@ const AccordionItem = ({ value, defaultIsOpen: defaultIsOpenProp, children, clas
83
93
  exports.AccordionItem = AccordionItem;
84
94
  exports.AccordionButton = react_1.default.forwardRef((props, forwardedRef) => {
85
95
  const { children, className, onClick, disabled = false, ...rest } = props;
86
- const { buttonId, contentId, isOpen, onToggle, onClose, onOpen, value, setCurrentValue, } = context_1.useAccordionItemContext();
96
+ const { buttonId, contentId, isOpen, onToggle, onClose, onOpen, value, setCurrentValue, allowToggle, } = context_1.useAccordionItemContext();
87
97
  const buttonRef = react_1.default.useRef(null);
88
98
  const ref = react_merge_refs_1.default([forwardedRef, buttonRef]);
89
99
  return (react_1.default.createElement("button", Object.assign({ ref: ref, type: "button", className: className, id: buttonId, "aria-controls": contentId, "aria-expanded": isOpen, "aria-disabled": disabled, disabled: disabled, onClick: (event) => {
@@ -94,21 +104,24 @@ exports.AccordionButton = react_1.default.forwardRef((props, forwardedRef) => {
94
104
  if (setCurrentValue && value) {
95
105
  setCurrentValue(value);
96
106
  }
97
- if (onToggle) {
107
+ if (onToggle && allowToggle) {
98
108
  onToggle();
99
109
  }
110
+ if (onOpen && !allowToggle) {
111
+ onOpen();
112
+ }
100
113
  } }, rest), typeof children === "function"
101
114
  ? children({ isOpen, onClose, onOpen })
102
115
  : children));
103
116
  });
104
- const AccordionIcon = ({ className, direction = "down", color, }) => {
117
+ const AccordionIcon = ({ className, direction = "down", color, disabled = false, }) => {
105
118
  const icon = {
106
119
  up: Icon_1.ICON_TYPE.CHEVRON_UP,
107
120
  down: Icon_1.ICON_TYPE.CHEVRON_DOWN,
108
121
  left: Icon_1.ICON_TYPE.CHEVRON_LEFT,
109
122
  right: Icon_1.ICON_TYPE.CHEVRON_RIGHT,
110
123
  };
111
- return (react_1.default.createElement(Icon_1.Icon, { className: classnames_1.default([cn({ e: "icon" }), className]), "data-direction": direction, icon: icon[direction], color: color }));
124
+ return (react_1.default.createElement(Icon_1.Icon, { className: classnames_1.default([cn({ e: "icon" }), className]), "data-direction": disabled ? undefined : direction, icon: icon[direction], color: color }));
112
125
  };
113
126
  exports.AccordionIcon = AccordionIcon;
114
127
  const AccordionContent = ({ children, maxHeight, style, className, scrollClassName, ...rest }) => {
@@ -13,6 +13,7 @@ declare type AccordionItemContextType = AccordionItemOwnProps & AccordionDisclos
13
13
  currentValue?: string;
14
14
  setCurrentValue?(value: string): void;
15
15
  allowMultiple?: boolean;
16
+ allowToggle?: boolean;
16
17
  };
17
18
  export declare const AccordionItemContext: Context<AccordionItemContextType>;
18
19
  export declare function useAccordionItemContext(): AccordionItemContextType;
@@ -9,6 +9,7 @@ const defaultGroupContext = {
9
9
  currentValue: undefined,
10
10
  setCurrentValue: () => { },
11
11
  allowMultiple: true,
12
+ allowToggle: true,
12
13
  };
13
14
  exports.AccordionGroupContext = react_1.createContext(defaultGroupContext);
14
15
  function useAccordionGroupContext() {
@@ -29,6 +30,7 @@ const defaultContext = {
29
30
  currentValue: undefined,
30
31
  setCurrentValue: () => { },
31
32
  allowMultiple: true,
33
+ allowToggle: true,
32
34
  };
33
35
  exports.AccordionItemContext = react_1.createContext(defaultContext);
34
36
  function useAccordionItemContext() {
@@ -4,6 +4,7 @@ export declare type AccordionGroupOwnProps = {
4
4
  defaultValue?: string;
5
5
  disableAnimation?: boolean;
6
6
  allowMultiple?: boolean;
7
+ allowToggle?: boolean;
7
8
  };
8
9
  export declare type AccordionItemOwnProps = {
9
10
  defaultIsOpen?: boolean;
@@ -1 +1 @@
1
- export { Description } from "./Description";
1
+ export * from "./Description";
@@ -1,5 +1,13 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
2
12
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Description = void 0;
4
- var Description_1 = require("./Description");
5
- Object.defineProperty(exports, "Description", { enumerable: true, get: function () { return Description_1.Description; } });
13
+ __exportStar(require("./Description"), exports);
@@ -1,5 +1,5 @@
1
1
  import { HTMLProps } from "react";
2
- declare type HeadingProps = HTMLProps<HTMLHeadingElement>;
2
+ export declare type HeadingProps = HTMLProps<HTMLHeadingElement>;
3
3
  export declare const Heading: {
4
4
  (props: HeadingProps): JSX.Element;
5
5
  H1: (props: HeadingProps) => JSX.Element;
@@ -9,4 +9,3 @@ export declare const Heading: {
9
9
  H5: (props: HeadingProps) => JSX.Element;
10
10
  H6: (props: HeadingProps) => JSX.Element;
11
11
  };
12
- export {};
@@ -1 +1 @@
1
- export { Heading } from "./Heading";
1
+ export * from "./Heading";
@@ -1,5 +1,13 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
2
12
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Heading = void 0;
4
- var Heading_1 = require("./Heading");
5
- Object.defineProperty(exports, "Heading", { enumerable: true, get: function () { return Heading_1.Heading; } });
13
+ __exportStar(require("./Heading"), exports);
@@ -1,8 +1,10 @@
1
1
  import React, { HTMLAttributes, ReactNode } from "react";
2
2
  import { BoxProps } from "../Box";
3
3
  import { PortalProps, PortalRootElementType } from "../Portal";
4
+ import { DescriptionProps } from "../Description";
4
5
  import { CloseButtonProps } from "../CloseButton";
5
6
  import { StackProps } from "../Stack";
7
+ import { HeadingProps } from "../Heading";
6
8
  export declare enum MODAL_SIZE {
7
9
  DEFAULT = "default",
8
10
  LARGE = "large",
@@ -34,6 +36,9 @@ export interface ModalFooterMultiStepProps extends BoxProps {
34
36
  rightButtonLabel?: string;
35
37
  }
36
38
  export declare const ModalHeader: (props: BoxProps) => JSX.Element;
39
+ export declare const ModalTitle: (props: HeadingProps) => JSX.Element;
40
+ export declare const ModalSecondaryTitle: ({ className, ...rest }: HeadingProps) => JSX.Element;
41
+ export declare const ModalDescription: ({ className, ...rest }: DescriptionProps) => JSX.Element;
37
42
  export declare const ModalBody: (props: ModalBodyProps) => JSX.Element;
38
43
  export declare const ModalTabs: (props: StackProps) => JSX.Element;
39
44
  export declare const ModalFooter: (props: BoxProps) => JSX.Element;
@@ -81,6 +86,9 @@ export declare const Modal: {
81
86
  Screen: ({ className, style, ...rest }: HTMLAttributes<HTMLDivElement>) => JSX.Element;
82
87
  Tabs: (props: StackProps) => JSX.Element;
83
88
  Header: (props: BoxProps) => JSX.Element;
89
+ Title: (props: HeadingProps) => JSX.Element;
90
+ SecondaryTitle: ({ className, ...rest }: HeadingProps) => JSX.Element;
91
+ Description: ({ className, ...rest }: DescriptionProps) => JSX.Element;
84
92
  Body: (props: ModalBodyProps) => JSX.Element;
85
93
  Footer: (props: BoxProps) => JSX.Element;
86
94
  FooterMultiStep: ({ steps, currentStep, leftButtonLabel, rightButtonLabel, children, className, ...rest }: ModalFooterMultiStepProps) => JSX.Element;
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.Modal = exports.ModalScreen = exports.ModalContent = exports.ModalContainer = exports.ModalOverlay = exports.ModalPortal = exports.ModalRoot = exports.ModalClose = exports.ModalCloseButton = exports.ModalFooterMultiStep = exports.ModalFooter = exports.ModalTabs = exports.ModalBody = exports.ModalHeader = exports.MODAL_SIZE = void 0;
25
+ exports.Modal = exports.ModalScreen = exports.ModalContent = exports.ModalContainer = exports.ModalOverlay = exports.ModalPortal = exports.ModalRoot = exports.ModalClose = exports.ModalCloseButton = exports.ModalFooterMultiStep = exports.ModalFooter = exports.ModalTabs = exports.ModalBody = exports.ModalDescription = exports.ModalSecondaryTitle = exports.ModalTitle = exports.ModalHeader = exports.MODAL_SIZE = void 0;
26
26
  const react_1 = __importStar(require("react"));
27
27
  const classnames_1 = __importDefault(require("classnames"));
28
28
  const react_focus_lock_1 = __importDefault(require("react-focus-lock"));
@@ -52,6 +52,18 @@ const ModalHeader = (props) => {
52
52
  return (react_1.default.createElement(Flex_1.Flex, Object.assign({ className: classnames_1.default([bem_1.bem(cn, { e: "header" }), className]) }, rest)));
53
53
  };
54
54
  exports.ModalHeader = ModalHeader;
55
+ const ModalTitle = (props) => {
56
+ return react_1.default.createElement(Heading_1.Heading.H2, Object.assign({}, props));
57
+ };
58
+ exports.ModalTitle = ModalTitle;
59
+ const ModalSecondaryTitle = ({ className, ...rest }) => {
60
+ return (react_1.default.createElement(Heading_1.Heading.H5, Object.assign({ className: classnames_1.default("text-gray-600", className) }, rest)));
61
+ };
62
+ exports.ModalSecondaryTitle = ModalSecondaryTitle;
63
+ const ModalDescription = ({ className, ...rest }) => {
64
+ return (react_1.default.createElement(Description_1.Description, Object.assign({ className: classnames_1.default(bem_1.bem(cn, { e: "description" }), className) }, rest)));
65
+ };
66
+ exports.ModalDescription = ModalDescription;
55
67
  const ModalBody = (props) => {
56
68
  const { padded = true, className, ...rest } = props;
57
69
  return (react_1.default.createElement(Box_1.Box, Object.assign({ className: classnames_1.default([
@@ -196,11 +208,11 @@ const Modal = (props) => {
196
208
  className,
197
209
  ]) }, rest),
198
210
  !noHeader && showHeader && (react_1.default.createElement(exports.ModalHeader, null,
199
- title && react_1.default.createElement(Heading_1.Heading.H2, null, title),
211
+ title && react_1.default.createElement(exports.ModalTitle, null, title),
200
212
  react_1.default.createElement(Stack_1.Stack, { className: "flex-shrink-0", spacing: 5 },
201
- secondaryTitle && (react_1.default.createElement(Heading_1.Heading.H5, { className: "text-gray-600" }, secondaryTitle)),
213
+ secondaryTitle && (react_1.default.createElement(exports.ModalSecondaryTitle, null, secondaryTitle)),
202
214
  !hideCloseButton && react_1.default.createElement(exports.ModalCloseButton, null)))),
203
- description && (react_1.default.createElement(Description_1.Description, { className: bem_1.bem(cn, { e: "description" }) }, description)),
215
+ description && (react_1.default.createElement(exports.ModalDescription, null, description)),
204
216
  children)),
205
217
  react_1.default.createElement(exports.ModalScreen, null)))));
206
218
  };
@@ -213,6 +225,9 @@ exports.Modal.Content = exports.ModalContent;
213
225
  exports.Modal.Screen = exports.ModalScreen;
214
226
  exports.Modal.Tabs = exports.ModalTabs;
215
227
  exports.Modal.Header = exports.ModalHeader;
228
+ exports.Modal.Title = exports.ModalTitle;
229
+ exports.Modal.SecondaryTitle = exports.ModalSecondaryTitle;
230
+ exports.Modal.Description = exports.ModalDescription;
216
231
  exports.Modal.Body = exports.ModalBody;
217
232
  exports.Modal.Footer = exports.ModalFooter;
218
233
  exports.Modal.FooterMultiStep = exports.ModalFooterMultiStep;
@@ -51,6 +51,7 @@ export const AccordionGroup = ({
51
51
  defaultValue,
52
52
  disableAnimation,
53
53
  allowMultiple = true,
54
+ allowToggle = true,
54
55
  className,
55
56
  ...rest
56
57
  }: AccordionGroupProps) => {
@@ -64,8 +65,16 @@ export const AccordionGroup = ({
64
65
  currentValue,
65
66
  setCurrentValue,
66
67
  allowMultiple,
68
+ allowToggle,
67
69
  }),
68
- [defaultValue, disableAnimation, totalItems, currentValue, allowMultiple],
70
+ [
71
+ defaultValue,
72
+ disableAnimation,
73
+ totalItems,
74
+ currentValue,
75
+ allowMultiple,
76
+ allowToggle,
77
+ ],
69
78
  );
70
79
  return (
71
80
  <AccordionGroupContext.Provider value={context}>
@@ -99,6 +108,7 @@ export const AccordionItem = ({
99
108
  currentValue,
100
109
  setCurrentValue,
101
110
  allowMultiple,
111
+ allowToggle,
102
112
  } = useAccordionGroupContext();
103
113
 
104
114
  /**
@@ -131,6 +141,7 @@ export const AccordionItem = ({
131
141
  currentValue,
132
142
  setCurrentValue,
133
143
  allowMultiple,
144
+ allowToggle,
134
145
  }),
135
146
  [
136
147
  defaultIsOpen,
@@ -144,6 +155,7 @@ export const AccordionItem = ({
144
155
  currentValue,
145
156
  setCurrentValue,
146
157
  allowMultiple,
158
+ allowToggle,
147
159
  ],
148
160
  );
149
161
 
@@ -197,6 +209,7 @@ export const AccordionButton = React.forwardRef<
197
209
  onOpen,
198
210
  value,
199
211
  setCurrentValue,
212
+ allowToggle,
200
213
  } = useAccordionItemContext();
201
214
  const buttonRef = React.useRef<HTMLButtonElement>(null);
202
215
  const ref = mergeRefs<HTMLButtonElement>([forwardedRef, buttonRef]);
@@ -219,9 +232,12 @@ export const AccordionButton = React.forwardRef<
219
232
  if (setCurrentValue && value) {
220
233
  setCurrentValue(value);
221
234
  }
222
- if (onToggle) {
235
+ if (onToggle && allowToggle) {
223
236
  onToggle();
224
237
  }
238
+ if (onOpen && !allowToggle) {
239
+ onOpen();
240
+ }
225
241
  }}
226
242
  {...rest}
227
243
  >
@@ -243,12 +259,18 @@ export type AccordionIconProps = {
243
259
  * point down, unless direction=down, then it will point up
244
260
  */
245
261
  direction?: "up" | "down" | "left" | "right";
262
+ /**
263
+ * Prevent the icon from rotating when the accordion is opened or closed; the
264
+ * direction will always be what is specified in the `direction` prop
265
+ */
266
+ disabled?: boolean;
246
267
  } & Pick<IconProps, "color">;
247
268
 
248
269
  export const AccordionIcon = ({
249
270
  className,
250
271
  direction = "down",
251
272
  color,
273
+ disabled = false,
252
274
  }: AccordionIconProps) => {
253
275
  const icon = {
254
276
  up: ICON_TYPE.CHEVRON_UP,
@@ -260,7 +282,7 @@ export const AccordionIcon = ({
260
282
  return (
261
283
  <Icon
262
284
  className={classNames([cn({ e: "icon" }), className])}
263
- data-direction={direction}
285
+ data-direction={disabled ? undefined : direction}
264
286
  icon={icon[direction]}
265
287
  color={color}
266
288
  />
@@ -22,6 +22,7 @@ const defaultGroupContext: AccordionGroupContextType = {
22
22
  currentValue: undefined,
23
23
  setCurrentValue: () => {},
24
24
  allowMultiple: true,
25
+ allowToggle: true,
25
26
  };
26
27
 
27
28
  export const AccordionGroupContext: Context<AccordionGroupContextType> = createContext<AccordionGroupContextType>(
@@ -49,6 +50,7 @@ type AccordionItemContextType = AccordionItemOwnProps &
49
50
  currentValue?: string;
50
51
  setCurrentValue?(value: string): void;
51
52
  allowMultiple?: boolean;
53
+ allowToggle?: boolean;
52
54
  };
53
55
 
54
56
  const defaultContext: AccordionItemContextType = {
@@ -62,6 +64,7 @@ const defaultContext: AccordionItemContextType = {
62
64
  currentValue: undefined,
63
65
  setCurrentValue: () => {},
64
66
  allowMultiple: true,
67
+ allowToggle: true,
65
68
  };
66
69
 
67
70
  export const AccordionItemContext: Context<AccordionItemContextType> = createContext<AccordionItemContextType>(
@@ -14,6 +14,10 @@ export type AccordionGroupOwnProps = {
14
14
  * Whether or not multiple items can be expanded at once
15
15
  */
16
16
  allowMultiple?: boolean;
17
+ /**
18
+ * Allow any expanded accordion item to be collapsed
19
+ */
20
+ allowToggle?: boolean;
17
21
  };
18
22
 
19
23
  export type AccordionItemOwnProps = {
@@ -1 +1 @@
1
- export { Description } from "./Description";
1
+ export * from "./Description";
@@ -5,7 +5,7 @@ import { bem } from "../../utilities/bem";
5
5
 
6
6
  const cn = "Heading";
7
7
 
8
- type HeadingProps = HTMLProps<HTMLHeadingElement>;
8
+ export type HeadingProps = HTMLProps<HTMLHeadingElement>;
9
9
 
10
10
  export const Heading = (props: HeadingProps) => {
11
11
  const { children, className, ...rest } = props;
@@ -1 +1 @@
1
- export { Heading } from "./Heading";
1
+ export * from "./Heading";
@@ -16,14 +16,14 @@ import mergeRefs from "react-merge-refs";
16
16
  import { Box, BoxProps } from "../Box";
17
17
  import { Flex } from "../Flex";
18
18
  import { Portal, PortalProps, PortalRootElementType } from "../Portal";
19
- import { Description } from "../Description";
19
+ import { Description, DescriptionProps } from "../Description";
20
20
  import { CloseButton, CloseButtonProps } from "../CloseButton";
21
21
  import { Stack, StackProps } from "../Stack";
22
22
  import { KEY_CODE } from "../../types";
23
23
  import { useKeyPress, useOutsideClick } from "../../hooks";
24
24
  import { bem } from "../../utilities/bem";
25
25
  import { Tab } from "../Tab";
26
- import { Heading } from "../Heading";
26
+ import { Heading, HeadingProps } from "../Heading";
27
27
  import { ModalContext, useModalContext } from "./context";
28
28
 
29
29
  const cn = "Modal";
@@ -166,6 +166,25 @@ export const ModalHeader = (props: BoxProps) => {
166
166
  );
167
167
  };
168
168
 
169
+ export const ModalTitle = (props: HeadingProps) => {
170
+ return <Heading.H2 {...props} />;
171
+ };
172
+
173
+ export const ModalSecondaryTitle = ({ className, ...rest }: HeadingProps) => {
174
+ return (
175
+ <Heading.H5 className={classNames("text-gray-600", className)} {...rest} />
176
+ );
177
+ };
178
+
179
+ export const ModalDescription = ({ className, ...rest }: DescriptionProps) => {
180
+ return (
181
+ <Description
182
+ className={classNames(bem(cn, { e: "description" }), className)}
183
+ {...rest}
184
+ />
185
+ );
186
+ };
187
+
169
188
  export const ModalBody = (props: ModalBodyProps) => {
170
189
  const { padded = true, className, ...rest } = props;
171
190
  return (
@@ -510,13 +529,13 @@ export const Modal = (props: ModalProps) => {
510
529
  >
511
530
  {!noHeader && showHeader && (
512
531
  <ModalHeader>
513
- {title && <Heading.H2>{title}</Heading.H2>}
532
+ {title && <ModalTitle>{title}</ModalTitle>}
514
533
 
515
534
  <Stack className="flex-shrink-0" spacing={5}>
516
535
  {secondaryTitle && (
517
- <Heading.H5 className="text-gray-600">
536
+ <ModalSecondaryTitle>
518
537
  {secondaryTitle}
519
- </Heading.H5>
538
+ </ModalSecondaryTitle>
520
539
  )}
521
540
 
522
541
  {!hideCloseButton && <ModalCloseButton />}
@@ -525,9 +544,7 @@ export const Modal = (props: ModalProps) => {
525
544
  )}
526
545
 
527
546
  {description && (
528
- <Description className={bem(cn, { e: "description" })}>
529
- {description}
530
- </Description>
547
+ <ModalDescription>{description}</ModalDescription>
531
548
  )}
532
549
 
533
550
  {children}
@@ -549,6 +566,9 @@ Modal.Content = ModalContent;
549
566
  Modal.Screen = ModalScreen;
550
567
  Modal.Tabs = ModalTabs;
551
568
  Modal.Header = ModalHeader;
569
+ Modal.Title = ModalTitle;
570
+ Modal.SecondaryTitle = ModalSecondaryTitle;
571
+ Modal.Description = ModalDescription;
552
572
  Modal.Body = ModalBody;
553
573
  Modal.Footer = ModalFooter;
554
574
  Modal.FooterMultiStep = ModalFooterMultiStep;