@workday/canvas-kit-preview-react 6.3.0 → 7.0.0-alpha.0-next.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.
@@ -208,7 +208,7 @@ var MenuItem = /** @class */ (function (_super) {
208
208
  secondaryIconProps = setIconProps(secondaryIcon, isDisabled, isFocused);
209
209
  return (React.createElement(React.Fragment, null,
210
210
  hasDivider && React.createElement(Divider, null),
211
- React.createElement(Item, __assign({ ref: this.ref, tabIndex: -1, id: id, role: role, onClick: this.handleClick, "aria-disabled": !!isDisabled, isDisabled: !!isDisabled, isFocused: !!isFocused }, elemProps),
211
+ React.createElement(Item, __assign({ ref: this.ref, tabIndex: -1, id: id, role: role, onClick: this.handleClick, "aria-disabled": isDisabled ? true : undefined, isDisabled: !!isDisabled, isFocused: !!isFocused }, elemProps),
212
212
  icon && iconProps && React.createElement(StyledSystemIcon, __assign({}, iconProps)),
213
213
  React.createElement(LabelContainer, null, children),
214
214
  secondaryIcon && secondaryIconProps && (React.createElement(SecondaryStyledSystemIcon, __assign({}, secondaryIconProps))))));
@@ -66,8 +66,30 @@ export declare const SidePanelContext: React.Context<{
66
66
  }>;
67
67
  declare const SidePanel: {
68
68
  ({ as, children, collapsedWidth, expanded, expandedWidth, onAnimationEnd, onAnimationStart, onExpandedChange, onStateTransition, origin, variant, touched, ...elemProps }: SidePanelProps): JSX.Element;
69
- ToggleButton: ({ variant, icon, ...rest }: Pick<IconButtonProps, "value" | "children" | "theme" | "size" | "icon" | "shouldMirrorIcon" | "variant" | "onToggleChange" | "toggled"> & React.ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
69
+ ToggleButton: ({ variant, icon, tooltipTextExpand: expandLabel, tooltipTextCollapse: collapseLabel, ...rest }: IconButtonProps & {
70
+ /**
71
+ * The tooltip text to expand the side panel
72
+ * @default 'Expand'
73
+ */
74
+ tooltipTextExpand?: string | undefined;
75
+ /**
76
+ * The tooltip text to collapse the side panel
77
+ * @default 'Collapse'
78
+ */
79
+ tooltipTextCollapse?: string | undefined;
80
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
81
+ };
82
+ export declare type ToggleButtonProps = IconButtonProps & {
83
+ /**
84
+ * The tooltip text to expand the side panel
85
+ * @default 'Expand'
86
+ */
87
+ tooltipTextExpand?: string;
88
+ /**
89
+ * The tooltip text to collapse the side panel
90
+ * @default 'Collapse'
91
+ */
92
+ tooltipTextCollapse?: string;
70
93
  };
71
- export declare type ToggleButtonProps = Omit<IconButtonProps, 'aria-label'>;
72
94
  export default SidePanel;
73
95
  //# sourceMappingURL=SidePanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/SidePanel.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAa,eAAe,EAAC,MAAM,kCAAkC,CAAC;AAI7E,oBAAY,gBAAgB,GAAG,UAAU,GAAG,WAAW,CAAC;AACxD,oBAAY,yBAAyB,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;AAE9F,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E;;;;OAIG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD;;;;;;OAMG;IACH,iBAAiB,CAA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AIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAsCD,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC;AAEH,QAAA,MAAM,SAAS;;;QAmGb;;;WAGG;;QAEH;;;WAGG;;;CAXJ,CAAC;AAEF,oBAAY,iBAAiB,GAAG,eAAe,GAAG;IAChD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AA+CF,eAAe,SAAS,CAAC"}
@@ -40,6 +40,7 @@ var core_1 = require("@emotion/core");
40
40
  var button_1 = require("@workday/canvas-kit-react/button");
41
41
  var tokens_1 = require("@workday/canvas-kit-react/tokens");
42
42
  var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
43
+ var tooltip_1 = require("@workday/canvas-kit-react/tooltip");
43
44
  var createKeyframes = function (from, to) {
44
45
  var normalized = {
45
46
  from: typeof from === 'number' ? from + 'px' : from,
@@ -125,7 +126,7 @@ var SidePanel = function (_a) {
125
126
  * A toggle button styled specifically for the side panel container.
126
127
  */
127
128
  var ToggleButton = function (_a) {
128
- var _b = _a.variant, variant = _b === void 0 ? 'plain' : _b, _c = _a.icon, icon = _c === void 0 ? canvas_system_icons_web_1.transformationImportIcon : _c, rest = __rest(_a, ["variant", "icon"]);
129
+ var _b = _a.variant, variant = _b === void 0 ? 'plain' : _b, _c = _a.icon, icon = _c === void 0 ? canvas_system_icons_web_1.transformationImportIcon : _c, _d = _a.tooltipTextExpand, expandLabel = _d === void 0 ? 'Expand' : _d, _e = _a.tooltipTextCollapse, collapseLabel = _e === void 0 ? 'Collapse' : _e, rest = __rest(_a, ["variant", "icon", "tooltipTextExpand", "tooltipTextCollapse"]);
129
130
  var context = React.useContext(exports.SidePanelContext);
130
131
  var useRTLOrigin = function () {
131
132
  var isRTL = common_1.useIsRTL();
@@ -148,8 +149,8 @@ var ToggleButton = function (_a) {
148
149
  ? "scaleX(" + (rtlOrigin === 'left' ? '1' : '-1') + ")"
149
150
  : "scaleX(" + (rtlOrigin === 'left' ? '-1' : '1') + ")",
150
151
  });
151
- // @ts-ignore aria-label type error here. The user will decide to use aria-label or aria-labelledby
152
- return core_1.jsx(button_1.IconButton, __assign({ type: "button", css: buttonStyle, icon: icon, variant: variant }, rest));
152
+ return (core_1.jsx(tooltip_1.Tooltip, { title: context.state === 'collapsed' ? expandLabel : collapseLabel, type: "muted" },
153
+ core_1.jsx(button_1.IconButton, __assign({ type: "button", css: buttonStyle, icon: icon, variant: variant }, rest))));
153
154
  };
154
155
  SidePanel.ToggleButton = ToggleButton;
155
156
  exports.default = SidePanel;
@@ -196,7 +196,7 @@ var MenuItem = /** @class */ (function (_super) {
196
196
  secondaryIconProps = setIconProps(secondaryIcon, isDisabled, isFocused);
197
197
  return (React.createElement(React.Fragment, null,
198
198
  hasDivider && React.createElement(Divider, null),
199
- React.createElement(Item, __assign({ ref: this.ref, tabIndex: -1, id: id, role: role, onClick: this.handleClick, "aria-disabled": !!isDisabled, isDisabled: !!isDisabled, isFocused: !!isFocused }, elemProps),
199
+ React.createElement(Item, __assign({ ref: this.ref, tabIndex: -1, id: id, role: role, onClick: this.handleClick, "aria-disabled": isDisabled ? true : undefined, isDisabled: !!isDisabled, isFocused: !!isFocused }, elemProps),
200
200
  icon && iconProps && React.createElement(StyledSystemIcon, __assign({}, iconProps)),
201
201
  React.createElement(LabelContainer, null, children),
202
202
  secondaryIcon && secondaryIconProps && (React.createElement(SecondaryStyledSystemIcon, __assign({}, secondaryIconProps))))));
@@ -66,8 +66,30 @@ export declare const SidePanelContext: React.Context<{
66
66
  }>;
67
67
  declare const SidePanel: {
68
68
  ({ as, children, collapsedWidth, expanded, expandedWidth, onAnimationEnd, onAnimationStart, onExpandedChange, onStateTransition, origin, variant, touched, ...elemProps }: SidePanelProps): JSX.Element;
69
- ToggleButton: ({ variant, icon, ...rest }: Pick<IconButtonProps, "size" | "icon" | "children" | "value" | "theme" | "shouldMirrorIcon" | "variant" | "onToggleChange" | "toggled"> & React.ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
69
+ ToggleButton: ({ variant, icon, tooltipTextExpand: expandLabel, tooltipTextCollapse: collapseLabel, ...rest }: IconButtonProps & {
70
+ /**
71
+ * The tooltip text to expand the side panel
72
+ * @default 'Expand'
73
+ */
74
+ tooltipTextExpand?: string | undefined;
75
+ /**
76
+ * The tooltip text to collapse the side panel
77
+ * @default 'Collapse'
78
+ */
79
+ tooltipTextCollapse?: string | undefined;
80
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
81
+ };
82
+ export declare type ToggleButtonProps = IconButtonProps & {
83
+ /**
84
+ * The tooltip text to expand the side panel
85
+ * @default 'Expand'
86
+ */
87
+ tooltipTextExpand?: string;
88
+ /**
89
+ * The tooltip text to collapse the side panel
90
+ * @default 'Collapse'
91
+ */
92
+ tooltipTextCollapse?: string;
70
93
  };
71
- export declare type ToggleButtonProps = Omit<IconButtonProps, 'aria-label'>;
72
94
  export default SidePanel;
73
95
  //# sourceMappingURL=SidePanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/SidePanel.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAa,eAAe,EAAC,MAAM,kCAAkC,CAAC;AAI7E,oBAAY,gBAAgB,GAAG,UAAU,GAAG,WAAW,CAAC;AACxD,oBAAY,yBAAyB,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;AAE9F,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E;;;;OAIG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,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AAO,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,yBAAyB,KAAK,IAAI,CAAC;IAChE;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAsCD,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC;AAEH,QAAA,MAAM,SAAS;;;QAmGb;;;WAGG;;QAEH;;;WAGG;;;CAXJ,CAAC;AAEF,oBAAY,iBAAiB,GAAG,eAAe,GAAG;IAChD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AA+CF,eAAe,SAAS,CAAC"}
@@ -31,6 +31,7 @@ import { css, jsx, keyframes } from '@emotion/core';
31
31
  import { IconButton } from '@workday/canvas-kit-react/button';
32
32
  import { space, colors, depth } from '@workday/canvas-kit-react/tokens';
33
33
  import { transformationImportIcon } from '@workday/canvas-system-icons-web';
34
+ import { Tooltip } from '@workday/canvas-kit-react/tooltip';
34
35
  var createKeyframes = function (from, to) {
35
36
  var normalized = {
36
37
  from: typeof from === 'number' ? from + 'px' : from,
@@ -116,7 +117,7 @@ var SidePanel = function (_a) {
116
117
  * A toggle button styled specifically for the side panel container.
117
118
  */
118
119
  var ToggleButton = function (_a) {
119
- var _b = _a.variant, variant = _b === void 0 ? 'plain' : _b, _c = _a.icon, icon = _c === void 0 ? transformationImportIcon : _c, rest = __rest(_a, ["variant", "icon"]);
120
+ var _b = _a.variant, variant = _b === void 0 ? 'plain' : _b, _c = _a.icon, icon = _c === void 0 ? transformationImportIcon : _c, _d = _a.tooltipTextExpand, expandLabel = _d === void 0 ? 'Expand' : _d, _e = _a.tooltipTextCollapse, collapseLabel = _e === void 0 ? 'Collapse' : _e, rest = __rest(_a, ["variant", "icon", "tooltipTextExpand", "tooltipTextCollapse"]);
120
121
  var context = React.useContext(SidePanelContext);
121
122
  var useRTLOrigin = function () {
122
123
  var isRTL = useIsRTL();
@@ -139,8 +140,8 @@ var ToggleButton = function (_a) {
139
140
  ? "scaleX(" + (rtlOrigin === 'left' ? '1' : '-1') + ")"
140
141
  : "scaleX(" + (rtlOrigin === 'left' ? '-1' : '1') + ")",
141
142
  });
142
- // @ts-ignore aria-label type error here. The user will decide to use aria-label or aria-labelledby
143
- return jsx(IconButton, __assign({ type: "button", css: buttonStyle, icon: icon, variant: variant }, rest));
143
+ return (jsx(Tooltip, { title: context.state === 'collapsed' ? expandLabel : collapseLabel, type: "muted" },
144
+ jsx(IconButton, __assign({ type: "button", css: buttonStyle, icon: icon, variant: variant }, rest))));
144
145
  };
145
146
  SidePanel.ToggleButton = ToggleButton;
146
147
  export default SidePanel;
@@ -274,7 +274,7 @@ class MenuItem extends React.Component<MenuItemProps> {
274
274
  id={id}
275
275
  role={role}
276
276
  onClick={this.handleClick}
277
- aria-disabled={!!isDisabled}
277
+ aria-disabled={isDisabled ? true : undefined}
278
278
  isDisabled={!!isDisabled}
279
279
  isFocused={!!isFocused}
280
280
  {...elemProps}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-preview-react",
3
- "version": "6.3.0",
3
+ "version": "7.0.0-alpha.0-next.0+69f28d82",
4
4
  "description": "Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -54,15 +54,15 @@
54
54
  "dependencies": {
55
55
  "@emotion/core": "^10.0.28",
56
56
  "@emotion/styled": "^10.0.27",
57
- "@workday/canvas-kit-react": "^6.3.0",
57
+ "@workday/canvas-kit-react": "^7.0.0-alpha.0-next.0+69f28d82",
58
58
  "@workday/canvas-system-icons-web": "1.0.41",
59
59
  "@workday/design-assets-types": "^0.2.4"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@workday/canvas-accent-icons-web": "^1.0.0",
63
- "@workday/canvas-kit-labs-react": "^6.3.0",
63
+ "@workday/canvas-kit-labs-react": "^7.0.0-alpha.0-next.0+69f28d82",
64
64
  "formik": "^2.2.9",
65
65
  "yup": "^0.31.1"
66
66
  },
67
- "gitHead": "94d5ae2d79daa43b9c2ef5f8eef572fc89694d5e"
67
+ "gitHead": "69f28d82a0291ed45c2c9d3ef92e437d69033471"
68
68
  }
@@ -5,6 +5,7 @@ import {css, CSSObject, jsx, keyframes} from '@emotion/core';
5
5
  import {IconButton, IconButtonProps} from '@workday/canvas-kit-react/button';
6
6
  import {space, colors, depth} from '@workday/canvas-kit-react/tokens';
7
7
  import {transformationImportIcon} from '@workday/canvas-system-icons-web';
8
+ import {Tooltip} from '@workday/canvas-kit-react/tooltip';
8
9
 
9
10
  export type SidePanelVariant = 'standard' | 'alternate';
10
11
  export type SidePanelTransitionStates = 'collapsed' | 'collapsing' | 'expanded' | 'expanding';
@@ -206,7 +207,18 @@ const SidePanel = ({
206
207
  );
207
208
  };
208
209
 
209
- export type ToggleButtonProps = Omit<IconButtonProps, 'aria-label'>;
210
+ export type ToggleButtonProps = IconButtonProps & {
211
+ /**
212
+ * The tooltip text to expand the side panel
213
+ * @default 'Expand'
214
+ */
215
+ tooltipTextExpand?: string;
216
+ /**
217
+ * The tooltip text to collapse the side panel
218
+ * @default 'Collapse'
219
+ */
220
+ tooltipTextCollapse?: string;
221
+ };
210
222
 
211
223
  /**
212
224
  * A toggle button styled specifically for the side panel container.
@@ -214,6 +226,8 @@ export type ToggleButtonProps = Omit<IconButtonProps, 'aria-label'>;
214
226
  const ToggleButton = ({
215
227
  variant = 'plain',
216
228
  icon = transformationImportIcon,
229
+ tooltipTextExpand: expandLabel = 'Expand',
230
+ tooltipTextCollapse: collapseLabel = 'Collapse',
217
231
  ...rest
218
232
  }: ToggleButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
219
233
  const context = React.useContext(SidePanelContext);
@@ -243,8 +257,11 @@ const ToggleButton = ({
243
257
  : `scaleX(${rtlOrigin === 'left' ? '-1' : '1'})`,
244
258
  });
245
259
 
246
- // @ts-ignore aria-label type error here. The user will decide to use aria-label or aria-labelledby
247
- return <IconButton type="button" css={buttonStyle} icon={icon} variant={variant} {...rest} />;
260
+ return (
261
+ <Tooltip title={context.state === 'collapsed' ? expandLabel : collapseLabel} type="muted">
262
+ <IconButton type="button" css={buttonStyle} icon={icon} variant={variant} {...rest} />
263
+ </Tooltip>
264
+ );
248
265
  };
249
266
 
250
267
  SidePanel.ToggleButton = ToggleButton;
@@ -66,8 +66,30 @@ export declare const SidePanelContext: React.Context<{
66
66
  }>;
67
67
  declare const SidePanel: {
68
68
  ({ as, children, collapsedWidth, expanded, expandedWidth, onAnimationEnd, onAnimationStart, onExpandedChange, onStateTransition, origin, variant, touched, ...elemProps }: SidePanelProps): JSX.Element;
69
- ToggleButton: ({ variant, icon, ...rest }: Pick<IconButtonProps, "value" | "children" | "theme" | "size" | "icon" | "shouldMirrorIcon" | "variant" | "onToggleChange" | "toggled"> & React.ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
69
+ ToggleButton: ({ variant, icon, tooltipTextExpand: expandLabel, tooltipTextCollapse: collapseLabel, ...rest }: IconButtonProps & {
70
+ /**
71
+ * The tooltip text to expand the side panel
72
+ * @default 'Expand'
73
+ */
74
+ tooltipTextExpand?: string | undefined;
75
+ /**
76
+ * The tooltip text to collapse the side panel
77
+ * @default 'Collapse'
78
+ */
79
+ tooltipTextCollapse?: string | undefined;
80
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
81
+ };
82
+ export declare type ToggleButtonProps = IconButtonProps & {
83
+ /**
84
+ * The tooltip text to expand the side panel
85
+ * @default 'Expand'
86
+ */
87
+ tooltipTextExpand?: string;
88
+ /**
89
+ * The tooltip text to collapse the side panel
90
+ * @default 'Collapse'
91
+ */
92
+ tooltipTextCollapse?: string;
70
93
  };
71
- export declare type ToggleButtonProps = Pick<IconButtonProps, Exclude<keyof IconButtonProps, 'aria-label'>>;
72
94
  export default SidePanel;
73
95
  //# sourceMappingURL=SidePanel.d.ts.map
@@ -66,8 +66,30 @@ export declare const SidePanelContext: React.Context<{
66
66
  }>;
67
67
  declare const SidePanel: {
68
68
  ({ as, children, collapsedWidth, expanded, expandedWidth, onAnimationEnd, onAnimationStart, onExpandedChange, onStateTransition, origin, variant, touched, ...elemProps }: SidePanelProps): JSX.Element;
69
- ToggleButton: ({ variant, icon, ...rest }: Pick<IconButtonProps, "size" | "icon" | "children" | "value" | "theme" | "shouldMirrorIcon" | "variant" | "onToggleChange" | "toggled"> & React.ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
69
+ ToggleButton: ({ variant, icon, tooltipTextExpand: expandLabel, tooltipTextCollapse: collapseLabel, ...rest }: IconButtonProps & {
70
+ /**
71
+ * The tooltip text to expand the side panel
72
+ * @default 'Expand'
73
+ */
74
+ tooltipTextExpand?: string | undefined;
75
+ /**
76
+ * The tooltip text to collapse the side panel
77
+ * @default 'Collapse'
78
+ */
79
+ tooltipTextCollapse?: string | undefined;
80
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
81
+ };
82
+ export declare type ToggleButtonProps = IconButtonProps & {
83
+ /**
84
+ * The tooltip text to expand the side panel
85
+ * @default 'Expand'
86
+ */
87
+ tooltipTextExpand?: string;
88
+ /**
89
+ * The tooltip text to collapse the side panel
90
+ * @default 'Collapse'
91
+ */
92
+ tooltipTextCollapse?: string;
70
93
  };
71
- export declare type ToggleButtonProps = Pick<IconButtonProps, Exclude<keyof IconButtonProps, 'aria-label'>>;
72
94
  export default SidePanel;
73
95
  //# sourceMappingURL=SidePanel.d.ts.map