@workday/canvas-kit-preview-react 14.0.0-alpha.1148-next.0 → 14.0.0-alpha.1149-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.
- package/dist/commonjs/color-picker/lib/ColorPicker.js +1 -1
- package/dist/commonjs/color-picker/lib/parts/ColorReset.js +1 -1
- package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +1 -1
- package/dist/commonjs/divider/lib/Divider.js +1 -1
- package/dist/commonjs/index.d.ts +0 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +0 -1
- package/dist/commonjs/information-highlight/lib/InformationHighlight.js +7 -7
- package/dist/commonjs/information-highlight/lib/parts/Body.js +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Heading.js +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Link.js +1 -1
- package/dist/commonjs/loading-sparkles/lib/LoadingSparkles.js +2 -2
- package/dist/commonjs/multi-select/lib/MultiSelectInput.js +3 -3
- package/dist/commonjs/pill/lib/Pill.js +3 -3
- package/dist/commonjs/pill/lib/PillAvatar.js +1 -1
- package/dist/commonjs/pill/lib/PillCount.js +1 -1
- package/dist/commonjs/pill/lib/PillIcon.js +1 -1
- package/dist/commonjs/pill/lib/PillIconButton.js +1 -1
- package/dist/commonjs/pill/lib/PillLabel.js +1 -1
- package/dist/commonjs/radio/lib/RadioGroup.js +3 -3
- package/dist/commonjs/radio/lib/RadioLabel.js +1 -1
- package/dist/commonjs/radio/lib/RadioText.js +4 -4
- package/dist/commonjs/radio/lib/StyledRadioButton.js +5 -5
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +4 -4
- package/dist/commonjs/side-panel/lib/SidePanel.js +7 -7
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +11 -11
- package/dist/commonjs/status-indicator/lib/StatusIndicator.js +13 -13
- package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +1 -1
- package/dist/es6/color-picker/lib/ColorPicker.js +1 -1
- package/dist/es6/color-picker/lib/parts/ColorReset.js +1 -1
- package/dist/es6/color-picker/lib/parts/SwatchBook.js +1 -1
- package/dist/es6/divider/lib/Divider.js +1 -1
- package/dist/es6/index.d.ts +0 -1
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +0 -1
- package/dist/es6/information-highlight/lib/InformationHighlight.js +7 -7
- package/dist/es6/information-highlight/lib/parts/Body.js +1 -1
- package/dist/es6/information-highlight/lib/parts/Heading.js +1 -1
- package/dist/es6/information-highlight/lib/parts/Link.js +1 -1
- package/dist/es6/loading-sparkles/lib/LoadingSparkles.js +2 -2
- package/dist/es6/multi-select/lib/MultiSelectInput.js +3 -3
- package/dist/es6/pill/lib/Pill.js +3 -3
- package/dist/es6/pill/lib/PillAvatar.js +1 -1
- package/dist/es6/pill/lib/PillCount.js +1 -1
- package/dist/es6/pill/lib/PillIcon.js +1 -1
- package/dist/es6/pill/lib/PillIconButton.js +1 -1
- package/dist/es6/pill/lib/PillLabel.js +1 -1
- package/dist/es6/radio/lib/RadioGroup.js +3 -3
- package/dist/es6/radio/lib/RadioLabel.js +1 -1
- package/dist/es6/radio/lib/RadioText.js +4 -4
- package/dist/es6/radio/lib/StyledRadioButton.js +5 -5
- package/dist/es6/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/es6/segmented-control/lib/SegmentedControlList.js +4 -4
- package/dist/es6/side-panel/lib/SidePanel.js +7 -7
- package/dist/es6/side-panel/lib/SidePanelToggleButton.js +11 -11
- package/dist/es6/status-indicator/lib/StatusIndicator.js +13 -13
- package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +1 -1
- package/index.ts +0 -1
- package/package.json +4 -4
- package/dist/commonjs/menu/index.d.ts +0 -3
- package/dist/commonjs/menu/index.d.ts.map +0 -1
- package/dist/commonjs/menu/index.js +0 -18
- package/dist/commonjs/menu/lib/Menu.d.ts +0 -78
- package/dist/commonjs/menu/lib/Menu.d.ts.map +0 -1
- package/dist/commonjs/menu/lib/Menu.js +0 -277
- package/dist/commonjs/menu/lib/MenuItem.d.ts +0 -75
- package/dist/commonjs/menu/lib/MenuItem.d.ts.map +0 -1
- package/dist/commonjs/menu/lib/MenuItem.js +0 -249
- package/dist/es6/menu/index.d.ts +0 -3
- package/dist/es6/menu/index.d.ts.map +0 -1
- package/dist/es6/menu/index.js +0 -2
- package/dist/es6/menu/lib/Menu.d.ts +0 -78
- package/dist/es6/menu/lib/Menu.d.ts.map +0 -1
- package/dist/es6/menu/lib/Menu.js +0 -247
- package/dist/es6/menu/lib/MenuItem.d.ts +0 -75
- package/dist/es6/menu/lib/MenuItem.d.ts.map +0 -1
- package/dist/es6/menu/lib/MenuItem.js +0 -219
- package/menu/index.ts +0 -2
- package/menu/lib/Menu.tsx +0 -368
- package/menu/lib/MenuItem.tsx +0 -351
- package/menu/package.json +0 -6
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.DeprecatedMenuItem = void 0;
|
|
30
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
-
const React = __importStar(require("react"));
|
|
32
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
33
|
-
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
34
|
-
const icon_1 = require("@workday/canvas-kit-react/icon");
|
|
35
|
-
const Item = (0, styled_1.default)('li')({
|
|
36
|
-
...tokens_1.type.levels.subtext.large,
|
|
37
|
-
padding: `${tokens_1.space.xxs} ${tokens_1.space.s}`,
|
|
38
|
-
height: tokens_1.space.xl,
|
|
39
|
-
boxSizing: 'border-box',
|
|
40
|
-
cursor: 'pointer',
|
|
41
|
-
color: tokens_1.colors.blackPepper300,
|
|
42
|
-
display: 'flex',
|
|
43
|
-
flexDirection: 'row',
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
transition: 'background-color 80ms, color 80ms',
|
|
46
|
-
'&:focus': {
|
|
47
|
-
outline: 'none',
|
|
48
|
-
},
|
|
49
|
-
}, ({ isHeader }) => {
|
|
50
|
-
return { pointerEvents: isHeader ? 'none' : 'all' };
|
|
51
|
-
}, ({ isFocused, isDisabled }) => {
|
|
52
|
-
if (!isFocused && !isDisabled) {
|
|
53
|
-
return {
|
|
54
|
-
backgroundColor: 'inherit',
|
|
55
|
-
'&:hover': {
|
|
56
|
-
backgroundColor: tokens_1.commonColors.hoverBackground,
|
|
57
|
-
color: tokens_1.colors.blackPepper300,
|
|
58
|
-
'.wd-icon-fill, .wd-icon-accent, .wd-icon-accent2': {
|
|
59
|
-
fill: tokens_1.iconColors.hover,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
else if (isDisabled && !isFocused) {
|
|
65
|
-
return {
|
|
66
|
-
color: tokens_1.colors.licorice100,
|
|
67
|
-
cursor: 'default',
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
// Is focused or focused and disabled
|
|
72
|
-
return {
|
|
73
|
-
backgroundColor: isDisabled ? tokens_1.colors.blueberry200 : tokens_1.commonColors.focusBackground,
|
|
74
|
-
color: tokens_1.typeColors.inverse,
|
|
75
|
-
'span .wd-icon-background ~ .wd-icon-accent, .wd-icon-background ~ .wd-icon-accent2': {
|
|
76
|
-
fill: isDisabled ? tokens_1.iconColors.disabled : tokens_1.iconColors.active,
|
|
77
|
-
},
|
|
78
|
-
'&:hover': {
|
|
79
|
-
'span .wd-icon-fill, span .wd-icon-accent, span .wd-icon-accent2': {
|
|
80
|
-
fill: tokens_1.iconColors.inverse,
|
|
81
|
-
},
|
|
82
|
-
'span .wd-icon-background ~ .wd-icon-accent, span .wd-icon-background ~ .wd-icon-accent2': {
|
|
83
|
-
fill: isDisabled ? tokens_1.iconColors.disabled : tokens_1.iconColors.active,
|
|
84
|
-
},
|
|
85
|
-
'span .wd-icon-background': {
|
|
86
|
-
fill: tokens_1.iconColors.inverse,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
[`[data-whatinput='mouse'] &,
|
|
90
|
-
[data-whatinput='touch'] &,
|
|
91
|
-
[data-whatinput='pointer'] &`]: {
|
|
92
|
-
backgroundColor: 'inherit',
|
|
93
|
-
color: tokens_1.colors.blackPepper300,
|
|
94
|
-
'span .wd-icon-background ~ .wd-icon-accent, span .wd-icon-background ~ .wd-icon-accent2': {
|
|
95
|
-
fill: tokens_1.iconColors.standard,
|
|
96
|
-
},
|
|
97
|
-
'&:hover': {
|
|
98
|
-
backgroundColor: tokens_1.commonColors.hoverBackground,
|
|
99
|
-
'span .wd-icon-fill, span .wd-icon-accent, span .wd-icon-accent2': {
|
|
100
|
-
fill: tokens_1.iconColors.hover,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
'.wd-icon-fill, .wd-icon-accent, .wd-icon-accent2': {
|
|
104
|
-
fill: tokens_1.iconColors.standard,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const LabelContainer = (0, styled_1.default)('span')({
|
|
111
|
-
flex: '1 1 auto',
|
|
112
|
-
overflow: 'hidden',
|
|
113
|
-
whiteSpace: 'nowrap',
|
|
114
|
-
textOverflow: 'ellipsis',
|
|
115
|
-
});
|
|
116
|
-
const Divider = (0, styled_1.default)('hr')({
|
|
117
|
-
display: 'block',
|
|
118
|
-
height: 1,
|
|
119
|
-
border: 0,
|
|
120
|
-
borderTop: `1px solid ${tokens_1.colors.soap400}`,
|
|
121
|
-
margin: `${tokens_1.space.xxs} 0`,
|
|
122
|
-
});
|
|
123
|
-
const iconSize = 24;
|
|
124
|
-
const iconPadding = 16;
|
|
125
|
-
const StyledSystemIcon = (0, styled_1.default)(icon_1.SystemIcon)({
|
|
126
|
-
minWidth: iconSize + iconPadding, // gives padding between LabelContainer, no matter the direction
|
|
127
|
-
});
|
|
128
|
-
const SecondaryStyledSystemIcon = (0, styled_1.default)(icon_1.SystemIcon)({
|
|
129
|
-
display: `flex`,
|
|
130
|
-
minWidth: iconSize + iconPadding,
|
|
131
|
-
justifyContent: `flex-end`,
|
|
132
|
-
});
|
|
133
|
-
let iconProps = null;
|
|
134
|
-
let secondaryIconProps = null;
|
|
135
|
-
const setIconProps = (icon, isDisabled, isFocused) => {
|
|
136
|
-
if (!icon) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
let props = {
|
|
140
|
-
icon: icon,
|
|
141
|
-
size: iconSize,
|
|
142
|
-
};
|
|
143
|
-
if (isDisabled) {
|
|
144
|
-
props = {
|
|
145
|
-
...props,
|
|
146
|
-
fill: tokens_1.iconColors.disabled,
|
|
147
|
-
fillHover: tokens_1.iconColors.disabled,
|
|
148
|
-
accent: tokens_1.iconColors.disabled,
|
|
149
|
-
accentHover: tokens_1.iconColors.disabled,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
if (isFocused) {
|
|
153
|
-
props = {
|
|
154
|
-
...props,
|
|
155
|
-
fill: tokens_1.iconColors.inverse,
|
|
156
|
-
fillHover: tokens_1.iconColors.inverse,
|
|
157
|
-
accent: tokens_1.iconColors.inverse,
|
|
158
|
-
accentHover: tokens_1.iconColors.inverse,
|
|
159
|
-
background: tokens_1.iconColors.inverse,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
return props;
|
|
163
|
-
};
|
|
164
|
-
const scrollIntoViewIfNeeded = (elem, centerIfNeeded = true) => {
|
|
165
|
-
const parent = elem.parentElement;
|
|
166
|
-
if (elem && parent) {
|
|
167
|
-
const parentComputedStyle = window.getComputedStyle(parent, null), parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'), 10), parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue('border-left-width'), 10), overTop = elem.offsetTop - parent.offsetTop < parent.scrollTop, overBottom = elem.offsetTop - parent.offsetTop + elem.clientHeight - parentBorderTopWidth >
|
|
168
|
-
parent.scrollTop + parent.clientHeight, overLeft = elem.offsetLeft - parent.offsetLeft < parent.scrollLeft, overRight = elem.offsetLeft - parent.offsetLeft + elem.clientWidth - parentBorderLeftWidth >
|
|
169
|
-
parent.scrollLeft + parent.clientWidth, alignWithTop = overTop && !overBottom;
|
|
170
|
-
if ((overTop || overBottom) && centerIfNeeded) {
|
|
171
|
-
parent.scrollTop =
|
|
172
|
-
elem.offsetTop -
|
|
173
|
-
parent.offsetTop -
|
|
174
|
-
parent.clientHeight / 2 -
|
|
175
|
-
parentBorderTopWidth +
|
|
176
|
-
elem.clientHeight / 2;
|
|
177
|
-
}
|
|
178
|
-
if ((overLeft || overRight) && centerIfNeeded) {
|
|
179
|
-
parent.scrollLeft =
|
|
180
|
-
elem.offsetLeft -
|
|
181
|
-
parent.offsetLeft -
|
|
182
|
-
parent.clientWidth / 2 -
|
|
183
|
-
parentBorderLeftWidth +
|
|
184
|
-
elem.clientWidth / 2;
|
|
185
|
-
}
|
|
186
|
-
if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {
|
|
187
|
-
elem.scrollIntoView(alignWithTop);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
/**
|
|
192
|
-
* `DeprecatedMenuItem` renders an `<li>` element with the correct attributes to ensure it is
|
|
193
|
-
* accessible. If you choose to implement your own custom menu items, be sure to use semantic `<li>`
|
|
194
|
-
* elements with the following attributes:
|
|
195
|
-
*
|
|
196
|
-
* - `role="menuitem"`
|
|
197
|
-
* - `tabindex={-1}`
|
|
198
|
-
* - `id`s following this pattern: `${MenuId}-${index}`
|
|
199
|
-
*
|
|
200
|
-
* Undocumented props are spread to the underlying `<li>` element.
|
|
201
|
-
*
|
|
202
|
-
* @deprecated ⚠️ `DeprecatedMenuItem` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
|
|
203
|
-
*
|
|
204
|
-
*/
|
|
205
|
-
class DeprecatedMenuItem extends React.Component {
|
|
206
|
-
constructor() {
|
|
207
|
-
super(...arguments);
|
|
208
|
-
this.ref = React.createRef();
|
|
209
|
-
this.componentDidUpdate = (prevProps) => {
|
|
210
|
-
if (!prevProps.isFocused && this.props.isFocused) {
|
|
211
|
-
if (this.ref.current) {
|
|
212
|
-
scrollIntoViewIfNeeded(this.ref.current);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
this.handleClick = (event) => {
|
|
217
|
-
if (this.props.isDisabled) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
if (this.props.onClick) {
|
|
221
|
-
this.props.onClick(event);
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
componentDidMount() {
|
|
226
|
-
console.warn(`This component is being deprecated and will be removed in a future major version.\n
|
|
227
|
-
For more information, please see the V8 upgrade guide:\n
|
|
228
|
-
https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v8-0--docs#menu-preview
|
|
229
|
-
`);
|
|
230
|
-
}
|
|
231
|
-
render() {
|
|
232
|
-
const { onClick, children, id, icon, secondaryIcon, hasDivider, isDisabled, isFocused, isHeader, role, ...elemProps } = this.props;
|
|
233
|
-
iconProps = setIconProps(icon, isDisabled, isFocused);
|
|
234
|
-
secondaryIconProps = setIconProps(secondaryIcon, isDisabled, isFocused);
|
|
235
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [hasDivider && (0, jsx_runtime_1.jsx)(Divider, { "aria-hidden": "true" }), (0, jsx_runtime_1.jsxs)(Item, { ref: this.ref, tabIndex: -1, id: id, role: isHeader ? 'presentation' : role, "aria-hidden": isHeader ? true : undefined, onClick: this.handleClick, "aria-disabled": isDisabled ? true : undefined, isDisabled: !!isDisabled, isFocused: !!isFocused, isHeader: !!isHeader, ...elemProps, children: [icon && iconProps && (0, jsx_runtime_1.jsx)(StyledSystemIcon, { ...iconProps }), (0, jsx_runtime_1.jsx)(LabelContainer, { children: children }), secondaryIcon && secondaryIconProps && ((0, jsx_runtime_1.jsx)(SecondaryStyledSystemIcon, { ...secondaryIconProps }))] })] }));
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
exports.DeprecatedMenuItem = DeprecatedMenuItem;
|
|
239
|
-
/**
|
|
240
|
-
* If we destructure props, shouldClose will be undefined because the value is only applied for the render method only.
|
|
241
|
-
* We have to use defaultProps so that the value of shouldClose is applied for every method and therefore references in the Menu component.
|
|
242
|
-
* For reference: https://github.com/Workday/canvas-kit/blob/f6d4d29e9bb2eb2af0b204e6f4ce2e5ed5a98e57/modules/_labs/menu/react/lib/Menu.tsx#L259,
|
|
243
|
-
*/
|
|
244
|
-
// TODO: Remove this ts-ignore when we convert to a functional component
|
|
245
|
-
// @ts-ignore
|
|
246
|
-
DeprecatedMenuItem.defaultProps = {
|
|
247
|
-
shouldClose: true,
|
|
248
|
-
role: 'menuitem',
|
|
249
|
-
};
|
package/dist/es6/menu/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../menu/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
package/dist/es6/menu/index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DeprecatedMenuItemProps } from './MenuItem';
|
|
3
|
-
import { GrowthBehavior } from '@workday/canvas-kit-react/common';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated ⚠️ `DeprecatedMenuProps` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
|
|
6
|
-
*/
|
|
7
|
-
export interface DeprecatedMenuProps extends GrowthBehavior, React.HTMLAttributes<HTMLUListElement> {
|
|
8
|
-
/**
|
|
9
|
-
* The DeprecatedMenuItem children of the DeprecatedMenu (must be at least one). Also accepts other components which share the same interface as `DeprecatedMenuItem`.
|
|
10
|
-
*/
|
|
11
|
-
children?: React.ReactElement<DeprecatedMenuItemProps> | React.ReactElement<DeprecatedMenuItemProps>[];
|
|
12
|
-
/**
|
|
13
|
-
* If true, set the DeprecatedMenu to the open state. Useful for showing and hiding the DeprecatedMenu from a parent component such as a menu button.
|
|
14
|
-
* @default true
|
|
15
|
-
*/
|
|
16
|
-
isOpen?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The width of the DeprecatedMenu. If no value is provided, the DeprecatedMenu will collapse around its content.
|
|
19
|
-
*/
|
|
20
|
-
width?: number | string;
|
|
21
|
-
/**
|
|
22
|
-
* The function called when a menu item is selected.
|
|
23
|
-
*/
|
|
24
|
-
onSelect?: () => void;
|
|
25
|
-
/**
|
|
26
|
-
* The function called when the DeprecatedMenu should close. This is called after a menu item is selected or if the escape shortcut key is used. This will not fire if the menu item sets `shouldClose` to false.
|
|
27
|
-
*/
|
|
28
|
-
onClose?: () => void;
|
|
29
|
-
/**
|
|
30
|
-
* The zero-based index of the menu item which should initially receive focus.
|
|
31
|
-
*/
|
|
32
|
-
initialSelectedItem?: number;
|
|
33
|
-
/**
|
|
34
|
-
* The unique id of the DeprecatedMenu used for ARIA and HTML `id` attributes.
|
|
35
|
-
*/
|
|
36
|
-
id?: string;
|
|
37
|
-
/**
|
|
38
|
-
* The HTML `id` of the element that labels the DeprecatedMenu. Often used with menu buttons.
|
|
39
|
-
*/
|
|
40
|
-
'aria-labelledby'?: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @deprecated ⚠️ `DeprecatedMenuState` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
|
|
45
|
-
*/
|
|
46
|
-
export interface DeprecatedMenuState {
|
|
47
|
-
selectedItemIndex: number;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* `DeprecatedMenu` renders a styled `<ul role="menu">` element within a {@link Card} and follows
|
|
51
|
-
* the [Active Menu
|
|
52
|
-
* pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html)
|
|
53
|
-
* using `aria-activedescendant`.
|
|
54
|
-
*
|
|
55
|
-
* Undocumented props are spread to the underlying `<ul>` element.
|
|
56
|
-
*
|
|
57
|
-
* @deprecated ⚠️ Deprecated Menu has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
|
|
58
|
-
*/
|
|
59
|
-
export declare class DeprecatedMenu extends React.Component<DeprecatedMenuProps, DeprecatedMenuState> {
|
|
60
|
-
private id;
|
|
61
|
-
private animateId;
|
|
62
|
-
private menuRef;
|
|
63
|
-
private firstCharacters;
|
|
64
|
-
constructor(props: DeprecatedMenuProps);
|
|
65
|
-
componentDidUpdate(prevProps: DeprecatedMenuProps): void;
|
|
66
|
-
componentDidMount(): void;
|
|
67
|
-
componentWillUnmount(): void;
|
|
68
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
69
|
-
getNormalizedItemIndex: (index: number | undefined) => number;
|
|
70
|
-
setNormalizedItemIndex: (index: number | undefined) => void;
|
|
71
|
-
private handleKeyboardShortcuts;
|
|
72
|
-
private handleClick;
|
|
73
|
-
private getIndexFirstChars;
|
|
74
|
-
private setFirstCharacters;
|
|
75
|
-
private getInitialSelectedItem;
|
|
76
|
-
private setInitialSelectedItem;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../menu/lib/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AAGnD,OAAO,EAAC,cAAc,EAAmB,MAAM,kCAAkC,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,mBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,EACL,KAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC,GAC3C,KAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC,EAAE,CAAC;IAClD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAYD;;;;;;;;;GASG;AACH,qBAAa,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAC3F,OAAO,CAAC,EAAE,CAAsB;IAChC,OAAO,CAAC,SAAS,CAAU;IAE3B,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,eAAe,CAAY;gBAEvB,KAAK,EAAE,mBAAmB;IAetC,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IAejD,iBAAiB;IAYjB,oBAAoB;IAIb,MAAM;IAyDN,sBAAsB,UAAW,MAAM,GAAG,SAAS,KAAG,MAAM,CAQjE;IAEK,sBAAsB,UAAW,MAAM,GAAG,SAAS,KAAG,IAAI,CAE/D;IAEF,OAAO,CAAC,uBAAuB,CA+E7B;IAEF,OAAO,CAAC,WAAW,CAoBjB;IAEF,OAAO,CAAC,kBAAkB,CAWxB;IAEF,OAAO,CAAC,kBAAkB,CA8BxB;IAEF,OAAO,CAAC,sBAAsB,CAU5B;IAEF,OAAO,CAAC,sBAAsB,CAG5B;CACH"}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
|
-
import { Card } from '@workday/canvas-kit-react/card';
|
|
5
|
-
import { commonColors, space, borderRadius } from '@workday/canvas-kit-react/tokens';
|
|
6
|
-
import { generateUniqueId } from '@workday/canvas-kit-react/common';
|
|
7
|
-
const List = styled('ul')({
|
|
8
|
-
background: commonColors.background,
|
|
9
|
-
borderRadius: borderRadius.m,
|
|
10
|
-
padding: 0,
|
|
11
|
-
margin: `${space.xxs} 0`,
|
|
12
|
-
'&:focus-visible, &.focus': {
|
|
13
|
-
outline: 'none',
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* `DeprecatedMenu` renders a styled `<ul role="menu">` element within a {@link Card} and follows
|
|
18
|
-
* the [Active Menu
|
|
19
|
-
* pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html)
|
|
20
|
-
* using `aria-activedescendant`.
|
|
21
|
-
*
|
|
22
|
-
* Undocumented props are spread to the underlying `<ul>` element.
|
|
23
|
-
*
|
|
24
|
-
* @deprecated ⚠️ Deprecated Menu has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
|
|
25
|
-
*/
|
|
26
|
-
export class DeprecatedMenu extends React.Component {
|
|
27
|
-
constructor(props) {
|
|
28
|
-
super(props);
|
|
29
|
-
this.id = generateUniqueId();
|
|
30
|
-
this.getNormalizedItemIndex = (index) => {
|
|
31
|
-
const itemCount = React.Children.count(this.props.children);
|
|
32
|
-
const firstItem = 0;
|
|
33
|
-
const lastItem = itemCount - 1;
|
|
34
|
-
if (!index) {
|
|
35
|
-
return firstItem;
|
|
36
|
-
}
|
|
37
|
-
return index < 0 ? firstItem : index >= itemCount ? lastItem : index;
|
|
38
|
-
};
|
|
39
|
-
this.setNormalizedItemIndex = (index) => {
|
|
40
|
-
this.setState({ selectedItemIndex: this.getNormalizedItemIndex(index) });
|
|
41
|
-
};
|
|
42
|
-
this.handleKeyboardShortcuts = (event) => {
|
|
43
|
-
if (event.ctrlKey || event.altKey || event.metaKey) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const children = React.Children.toArray(this.props.children);
|
|
47
|
-
let nextSelectedIndex = 0;
|
|
48
|
-
let isShortcut = false;
|
|
49
|
-
const interactiveItems = children.filter(child => {
|
|
50
|
-
var _a;
|
|
51
|
-
return !((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.isHeader);
|
|
52
|
-
});
|
|
53
|
-
const interactiveItemCount = interactiveItems.length;
|
|
54
|
-
const firstIndex = 0;
|
|
55
|
-
const lastIndex = interactiveItemCount - 1;
|
|
56
|
-
if (event.key.length === 1 && event.key.match(/\S/)) {
|
|
57
|
-
let start = this.state.selectedItemIndex + 1;
|
|
58
|
-
let searchIndex;
|
|
59
|
-
if (start === children.length) {
|
|
60
|
-
start = 0;
|
|
61
|
-
}
|
|
62
|
-
searchIndex = this.getIndexFirstChars(start, event.key.toLowerCase());
|
|
63
|
-
if (searchIndex === -1) {
|
|
64
|
-
searchIndex = this.getIndexFirstChars(0, event.key.toLowerCase(), start);
|
|
65
|
-
}
|
|
66
|
-
if (searchIndex > -1) {
|
|
67
|
-
isShortcut = true;
|
|
68
|
-
nextSelectedIndex = searchIndex;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
switch (event.key) {
|
|
73
|
-
case 'ArrowUp':
|
|
74
|
-
case 'ArrowDown':
|
|
75
|
-
const direction = event.key === 'ArrowUp' ? -1 : 1;
|
|
76
|
-
isShortcut = true;
|
|
77
|
-
const nextIndex = this.state.selectedItemIndex + direction;
|
|
78
|
-
nextSelectedIndex =
|
|
79
|
-
nextIndex < 0 ? lastIndex : nextIndex >= interactiveItemCount ? firstIndex : nextIndex;
|
|
80
|
-
break;
|
|
81
|
-
case 'Home':
|
|
82
|
-
case 'End':
|
|
83
|
-
const skipTo = event.key === 'Home' ? firstIndex : lastIndex;
|
|
84
|
-
isShortcut = true;
|
|
85
|
-
nextSelectedIndex = skipTo;
|
|
86
|
-
break;
|
|
87
|
-
case 'Tab':
|
|
88
|
-
if (this.props.onClose) {
|
|
89
|
-
this.props.onClose();
|
|
90
|
-
}
|
|
91
|
-
break;
|
|
92
|
-
case 'Escape':
|
|
93
|
-
case 'Esc': // IE/Edge specific value
|
|
94
|
-
isShortcut = true;
|
|
95
|
-
if (this.props.onClose) {
|
|
96
|
-
this.props.onClose();
|
|
97
|
-
}
|
|
98
|
-
break;
|
|
99
|
-
case 'Spacebar':
|
|
100
|
-
case ' ':
|
|
101
|
-
case 'Enter':
|
|
102
|
-
nextSelectedIndex = this.state.selectedItemIndex;
|
|
103
|
-
const child = interactiveItems[this.state.selectedItemIndex];
|
|
104
|
-
this.handleClick(event, child.props);
|
|
105
|
-
isShortcut = true;
|
|
106
|
-
break;
|
|
107
|
-
default:
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (isShortcut) {
|
|
111
|
-
this.setNormalizedItemIndex(nextSelectedIndex);
|
|
112
|
-
event.stopPropagation();
|
|
113
|
-
event.preventDefault();
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
this.handleClick = (event, menuItemProps) => {
|
|
117
|
-
/* istanbul ignore next line for coverage */
|
|
118
|
-
if (menuItemProps.isDisabled) {
|
|
119
|
-
// You should only hit this point if you are using a custom DeprecatedMenuItem implementation.
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (menuItemProps.onClick) {
|
|
123
|
-
menuItemProps.onClick(event);
|
|
124
|
-
}
|
|
125
|
-
if (this.props.onSelect) {
|
|
126
|
-
this.props.onSelect();
|
|
127
|
-
}
|
|
128
|
-
if (this.props.onClose) {
|
|
129
|
-
if (menuItemProps.shouldClose) {
|
|
130
|
-
this.props.onClose();
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
this.getIndexFirstChars = (startIndex, character, lastIndex = this.firstCharacters.length) => {
|
|
135
|
-
for (let i = startIndex; i < lastIndex; i++) {
|
|
136
|
-
if (character === this.firstCharacters[i]) {
|
|
137
|
-
return i;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return -1;
|
|
141
|
-
};
|
|
142
|
-
this.setFirstCharacters = () => {
|
|
143
|
-
const getFirstCharacter = (child) => {
|
|
144
|
-
let character = '';
|
|
145
|
-
if (!child || typeof child === 'boolean') {
|
|
146
|
-
character = '';
|
|
147
|
-
}
|
|
148
|
-
else if (typeof child === 'string' || typeof child === 'number') {
|
|
149
|
-
character = child.toString().trim().substring(0, 1).toLowerCase();
|
|
150
|
-
}
|
|
151
|
-
else if (Array.isArray(child) && child[0]) {
|
|
152
|
-
// TODO test React.ReactNodeArray
|
|
153
|
-
character = getFirstCharacter(child[0]);
|
|
154
|
-
}
|
|
155
|
-
else if ('props' in child) {
|
|
156
|
-
const { children } = child.props;
|
|
157
|
-
if (Array.isArray(children)) {
|
|
158
|
-
character = getFirstCharacter(children[0]);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
character = getFirstCharacter(children);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return character;
|
|
165
|
-
};
|
|
166
|
-
const firstCharacters = React.Children.map(this.props.children, child => {
|
|
167
|
-
var _a;
|
|
168
|
-
if ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.isHeader) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
return getFirstCharacter(child);
|
|
172
|
-
});
|
|
173
|
-
this.firstCharacters = firstCharacters;
|
|
174
|
-
};
|
|
175
|
-
this.getInitialSelectedItem = () => {
|
|
176
|
-
let selected = this.props.initialSelectedItem || 0;
|
|
177
|
-
selected = selected < 0 ? React.Children.count(this.props.children) + selected : selected;
|
|
178
|
-
if (selected < 0) {
|
|
179
|
-
selected = 0;
|
|
180
|
-
}
|
|
181
|
-
else if (selected > React.Children.count(this.props.children) - 1) {
|
|
182
|
-
selected = React.Children.count(this.props.children) - 1;
|
|
183
|
-
}
|
|
184
|
-
return selected;
|
|
185
|
-
};
|
|
186
|
-
this.setInitialSelectedItem = () => {
|
|
187
|
-
const selected = this.getInitialSelectedItem();
|
|
188
|
-
this.setState({ selectedItemIndex: selected });
|
|
189
|
-
};
|
|
190
|
-
this.menuRef = React.createRef();
|
|
191
|
-
const selected = this.getInitialSelectedItem();
|
|
192
|
-
// We track the active menu item by index so we can avoid setting a bunch of refs
|
|
193
|
-
// for doing things like selecting an item by first character (or really calling .focus() at all)
|
|
194
|
-
// It allows us to use the activedescendant design pattern
|
|
195
|
-
// https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html
|
|
196
|
-
this.state = {
|
|
197
|
-
selectedItemIndex: selected,
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
componentDidUpdate(prevProps) {
|
|
201
|
-
if (this.props.children !== prevProps.children) {
|
|
202
|
-
this.setFirstCharacters();
|
|
203
|
-
this.setInitialSelectedItem();
|
|
204
|
-
}
|
|
205
|
-
if (this.props.isOpen && !prevProps.isOpen) {
|
|
206
|
-
this.setInitialSelectedItem();
|
|
207
|
-
}
|
|
208
|
-
this.animateId = requestAnimationFrame(() => {
|
|
209
|
-
if (this.props.isOpen && this.menuRef.current) {
|
|
210
|
-
this.menuRef.current.focus();
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
componentDidMount() {
|
|
215
|
-
console.warn(`This component is being deprecated and will be removed in a future major version.\n
|
|
216
|
-
For more information, please see the V8 upgrade guide:\n
|
|
217
|
-
https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v8-0--docs#menu-preview
|
|
218
|
-
`);
|
|
219
|
-
this.setFirstCharacters();
|
|
220
|
-
this.setInitialSelectedItem();
|
|
221
|
-
}
|
|
222
|
-
componentWillUnmount() {
|
|
223
|
-
cancelAnimationFrame(this.animateId);
|
|
224
|
-
}
|
|
225
|
-
render() {
|
|
226
|
-
// TODO: Standardize on prop spread location (see #150)
|
|
227
|
-
const { id = this.id, isOpen = true, children, 'aria-labelledby': ariaLabelledby, grow, width, onSelect, onClose, initialSelectedItem, ...elemProps } = this.props;
|
|
228
|
-
const { selectedItemIndex } = this.state;
|
|
229
|
-
const cardWidth = grow ? '100%' : width;
|
|
230
|
-
let interactiveItemIndex = null;
|
|
231
|
-
return (_jsx(Card, { display: "inline-block", padding: space.zero, width: cardWidth, depth: 3, children: _jsx(Card.Body, { children: _jsx(List, { role: "menu", tabIndex: 0, id: id, "aria-labelledby": ariaLabelledby, "aria-activedescendant": `${id}-${selectedItemIndex}`, onKeyDown: this.handleKeyboardShortcuts, ref: this.menuRef, ...elemProps, children: React.Children.map(children, menuItem => {
|
|
232
|
-
if (!React.isValidElement(menuItem)) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
let itemId;
|
|
236
|
-
if (!menuItem.props.isHeader) {
|
|
237
|
-
interactiveItemIndex = (interactiveItemIndex !== null && interactiveItemIndex !== void 0 ? interactiveItemIndex : -1) + 1;
|
|
238
|
-
itemId = `${id}-${interactiveItemIndex}`;
|
|
239
|
-
}
|
|
240
|
-
return (_jsx(React.Fragment, { children: React.cloneElement(menuItem, {
|
|
241
|
-
onClick: (event) => this.handleClick(event, menuItem.props),
|
|
242
|
-
id: itemId,
|
|
243
|
-
isFocused: selectedItemIndex === interactiveItemIndex && !menuItem.props.isHeader,
|
|
244
|
-
}) }, itemId));
|
|
245
|
-
}) }) }) }));
|
|
246
|
-
}
|
|
247
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated ⚠️ `DeprecatedMenuItemProps` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
|
|
5
|
-
*/
|
|
6
|
-
export interface DeprecatedMenuItemProps extends React.LiHTMLAttributes<HTMLLIElement> {
|
|
7
|
-
/**
|
|
8
|
-
* The function called when the DeprecatedMenuItem is clicked. If the item is a child of the DeprecatedMenu component, this callback will be decorated with the onSelect and onClose DeprecatedMenu callbacks. This callback will not fire if the item is disabled (see below).
|
|
9
|
-
*/
|
|
10
|
-
onClick?: (event: React.MouseEvent) => void;
|
|
11
|
-
/**
|
|
12
|
-
* The unique id for the DeprecatedMenuItem used for ARIA attributes. If the item is a child of the `DeprecatedMenu` component, this property will be generated and overridden.
|
|
13
|
-
*/
|
|
14
|
-
id?: string;
|
|
15
|
-
/**
|
|
16
|
-
* The icon of the DeprecatedMenuItem. This icon is displayed before what you supplied for the children.
|
|
17
|
-
*/
|
|
18
|
-
icon?: CanvasSystemIcon;
|
|
19
|
-
/**
|
|
20
|
-
* The secondary icon of the DeprecatedMenuItem. This icon is displayed after what you supplied for the children.
|
|
21
|
-
*/
|
|
22
|
-
secondaryIcon?: CanvasSystemIcon;
|
|
23
|
-
/**
|
|
24
|
-
* If true, render a top border on the DeprecatedMenuItem.
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
hasDivider?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* If true, render a header to group data, this menu item will not be intractable.
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
isHeader?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* If true, set the DeprecatedMenuItem to the disabled state so it is not clickable.
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
|
-
isDisabled?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* If true, set the DeprecatedMenuItem to be the currently selected item. If the item is a child of the DeprecatedMenu component, this property will be generated and overridden.
|
|
40
|
-
* @default false
|
|
41
|
-
*/
|
|
42
|
-
isFocused?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* The role of the DeprecatedMenuItem. Use this to override the role of the item (e.g. you can use this element as an option in a Combobox).
|
|
45
|
-
* @default menuItem
|
|
46
|
-
*/
|
|
47
|
-
role?: string;
|
|
48
|
-
/**
|
|
49
|
-
* If true, allow the onClose DeprecatedMenu callback to be fired after the DeprecatedMenuItem has been clicked.
|
|
50
|
-
* @default true
|
|
51
|
-
*/
|
|
52
|
-
shouldClose?: boolean;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* `DeprecatedMenuItem` renders an `<li>` element with the correct attributes to ensure it is
|
|
56
|
-
* accessible. If you choose to implement your own custom menu items, be sure to use semantic `<li>`
|
|
57
|
-
* elements with the following attributes:
|
|
58
|
-
*
|
|
59
|
-
* - `role="menuitem"`
|
|
60
|
-
* - `tabindex={-1}`
|
|
61
|
-
* - `id`s following this pattern: `${MenuId}-${index}`
|
|
62
|
-
*
|
|
63
|
-
* Undocumented props are spread to the underlying `<li>` element.
|
|
64
|
-
*
|
|
65
|
-
* @deprecated ⚠️ `DeprecatedMenuItem` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
export declare class DeprecatedMenuItem extends React.Component<DeprecatedMenuItemProps> {
|
|
69
|
-
ref: React.RefObject<HTMLLIElement>;
|
|
70
|
-
componentDidMount(): void;
|
|
71
|
-
componentDidUpdate: (prevProps: DeprecatedMenuItemProps) => void;
|
|
72
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
73
|
-
private handleClick;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=MenuItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../menu/lib/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC;IACpF;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA6LD;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAmB,SAAQ,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC;IAC9E,GAAG,iCAAoC;IAEvC,iBAAiB;IASjB,kBAAkB,cAAe,uBAAuB,UAMtD;IAEF,MAAM;IA4CN,OAAO,CAAC,WAAW,CAOjB;CACH"}
|