@ebay/ui-core-react 3.10.0 → 3.10.2
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/ebay-inline-notice/inline-notice.d.ts +2 -2
- package/ebay-inline-notice/inline-notice.d.ts.map +1 -1
- package/ebay-inline-notice/inline-notice.js +14 -2
- package/ebay-menu/README.md +1 -0
- package/ebay-menu/menu-item.d.ts +3 -0
- package/ebay-menu/menu-item.d.ts.map +1 -1
- package/ebay-menu/menu-item.js +11 -3
- package/ebay-menu/menu.d.ts.map +1 -1
- package/ebay-menu/menu.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
1
|
+
import React, { FC, ReactNode } from 'react';
|
|
2
2
|
import { NoticeStatus } from './types';
|
|
3
|
-
declare type Props = {
|
|
3
|
+
declare type Props = React.ComponentProps<'div'> & {
|
|
4
4
|
status?: NoticeStatus;
|
|
5
5
|
onNoticeShow?: () => void;
|
|
6
6
|
'aria-label': string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-notice.d.ts","sourceRoot":"","sources":["../../src/ebay-inline-notice/inline-notice.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"inline-notice.d.ts","sourceRoot":"","sources":["../../src/ebay-inline-notice/inline-notice.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,EAAa,SAAS,EAAE,MAAM,OAAO,CAAA;AAMvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,aAAK,KAAK,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACvC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB,CAAA;AAED,QAAA,MAAM,gBAAgB,EAAE,EAAE,CAAC,KAAK,CA0C/B,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -29,6 +29,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
__setModuleDefault(result, mod);
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
+
t[p[i]] = s[p[i]];
|
|
40
|
+
}
|
|
41
|
+
return t;
|
|
42
|
+
};
|
|
32
43
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
44
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
45
|
};
|
|
@@ -40,7 +51,8 @@ var notice_content_1 = __importDefault(require("../common/notice-utils/notice-co
|
|
|
40
51
|
var component_utils_1 = require("../common/component-utils");
|
|
41
52
|
var ebay_icon_1 = require("../ebay-icon");
|
|
42
53
|
var EbayInlineNotice = function (_a) {
|
|
43
|
-
var
|
|
54
|
+
var _b;
|
|
55
|
+
var className = _a.className, _c = _a.status, status = _c === void 0 ? 'general' : _c, children = _a.children, _d = _a.hidden, hidden = _d === void 0 ? false : _d, ariaLabel = _a["aria-label"], _e = _a.onNoticeShow, onNoticeShow = _e === void 0 ? function () { } : _e, rest = __rest(_a, ["className", "status", "children", "hidden", 'aria-label', "onNoticeShow"]);
|
|
44
56
|
react_1.useEffect(function () {
|
|
45
57
|
if (!hidden) {
|
|
46
58
|
onNoticeShow();
|
|
@@ -54,7 +66,7 @@ var EbayInlineNotice = function (_a) {
|
|
|
54
66
|
throw new Error("EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice");
|
|
55
67
|
}
|
|
56
68
|
var isGeneral = status === "general";
|
|
57
|
-
return (react_1.default.createElement("div", { className: classnames_1.default(className,
|
|
69
|
+
return (react_1.default.createElement("div", __assign({}, rest, { className: classnames_1.default(className, 'inline-notice', (_b = {}, _b["inline-notice--" + status] = !isGeneral, _b)) }),
|
|
58
70
|
!isGeneral ? (react_1.default.createElement("span", { className: "inline-notice__header" },
|
|
59
71
|
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: status + "FilledSmall", a11yText: ariaLabel, a11yVariant: "label" }))) : null,
|
|
60
72
|
react_1.default.createElement(notice_content_1.default, __assign({}, content.props, { type: "inline" }))));
|
package/ebay-menu/README.md
CHANGED
|
@@ -38,6 +38,7 @@ Name | Type | Required | Description
|
|
|
38
38
|
`checked` | Boolean | No | for type `radio`, `checkbox`: whether or not the item is checked
|
|
39
39
|
`disabled` | Boolean | No | makes the menu item disabled
|
|
40
40
|
`badgeNumber` | Number | No | used as the number to be placed in the badge
|
|
41
|
+
`badgeAriaLabel` | String | If `badgeNumber` provided | passed as the `aria-label` directly to the badge
|
|
41
42
|
|
|
42
43
|
## EbayMenuSeparator
|
|
43
44
|
Example:
|
package/ebay-menu/menu-item.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { EbayMenuType } from './types';
|
|
2
3
|
export declare type MenuItemProps = Omit<ComponentProps<'div'>, 'onKeyDown'> & {
|
|
4
|
+
type?: EbayMenuType;
|
|
3
5
|
focused?: boolean;
|
|
4
6
|
tabIndex?: number;
|
|
5
7
|
checked?: boolean;
|
|
6
8
|
value?: string;
|
|
7
9
|
disabled?: boolean;
|
|
8
10
|
badgeNumber?: number;
|
|
11
|
+
badgeAriaLabel?: string;
|
|
9
12
|
};
|
|
10
13
|
declare const EbayMenuItem: FC<MenuItemProps>;
|
|
11
14
|
export default EbayMenuItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../src/ebay-menu/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAqB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../src/ebay-menu/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAqB,MAAM,OAAO,CAAA;AAIpE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,oBAAY,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,GAAG;IACnE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,aAAa,CAyCnC,CAAA;AAUD,eAAe,YAAY,CAAA"}
|
package/ebay-menu/menu-item.js
CHANGED
|
@@ -49,7 +49,7 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
49
49
|
var ebay_badge_1 = require("../ebay-badge");
|
|
50
50
|
var ebay_icon_1 = require("../ebay-icon");
|
|
51
51
|
var EbayMenuItem = function (_a) {
|
|
52
|
-
var className = _a.className, checked = _a.checked, _b = _a.focused, focused = _b === void 0 ? false : _b, tabIndex = _a.tabIndex, disabled = _a.disabled, badgeNumber = _a.badgeNumber, children = _a.children, rest = __rest(_a, ["className", "checked", "focused", "tabIndex", "disabled", "badgeNumber", "children"]);
|
|
52
|
+
var className = _a.className, checked = _a.checked, type = _a.type, _b = _a.focused, focused = _b === void 0 ? false : _b, tabIndex = _a.tabIndex, disabled = _a.disabled, badgeNumber = _a.badgeNumber, badgeAriaLabel = _a.badgeAriaLabel, children = _a.children, rest = __rest(_a, ["className", "checked", "type", "focused", "tabIndex", "disabled", "badgeNumber", "badgeAriaLabel", "children"]);
|
|
53
53
|
var ref = react_1.useRef(null);
|
|
54
54
|
var hasBadge = badgeNumber !== undefined;
|
|
55
55
|
react_1.useEffect(function () {
|
|
@@ -57,10 +57,18 @@ var EbayMenuItem = function (_a) {
|
|
|
57
57
|
ref.current.focus();
|
|
58
58
|
}
|
|
59
59
|
}, [ref, focused]);
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
var checkable = ['radio', 'checkbox'];
|
|
61
|
+
return (react_1.default.createElement("div", __assign({ "aria-label": badgeAriaLabel }, rest, { ref: ref, className: classnames_1.default(className, 'menu__item', hasBadge && 'menu__item--badged'), role: roleFromType(type), "aria-checked": checkable.includes(type) ? checked : undefined, "aria-disabled": disabled, tabIndex: focused ? 0 : tabIndex }),
|
|
62
|
+
react_1.default.createElement("span", { "aria-hidden": hasBadge },
|
|
62
63
|
children,
|
|
63
64
|
hasBadge && react_1.default.createElement(ebay_badge_1.EbayBadge, { type: "menu", number: badgeNumber })),
|
|
64
65
|
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "tickSmall" })));
|
|
65
66
|
};
|
|
67
|
+
function roleFromType(type) {
|
|
68
|
+
var roles = {
|
|
69
|
+
radio: 'menuitemradio',
|
|
70
|
+
checkbox: 'menuitemcheckbox'
|
|
71
|
+
};
|
|
72
|
+
return roles[type] || 'menuitem';
|
|
73
|
+
}
|
|
66
74
|
exports.default = EbayMenuItem;
|
package/ebay-menu/menu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/ebay-menu/menu.tsx"],"names":[],"mappings":"AAAA,OAAc,EAEV,cAAc,EAAE,EAAE,EACrB,MAAM,OAAO,CAAA;AAMd,OAAO,EAAgB,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEtE,aAAK,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,CAAA;AACvE,aAAK,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;AACrD,aAAK,KAAK,GAAG,SAAS,GAAG;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACvB,CAAA;AAID,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/ebay-menu/menu.tsx"],"names":[],"mappings":"AAAA,OAAc,EAEV,cAAc,EAAE,EAAE,EACrB,MAAM,OAAO,CAAA;AAMd,OAAO,EAAgB,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEtE,aAAK,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,CAAA;AACvE,aAAK,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;AACrD,aAAK,KAAK,GAAG,SAAS,GAAG;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACvB,CAAA;AAID,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,KAAK,CAoGvB,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
package/ebay-menu/menu.js
CHANGED
|
@@ -109,7 +109,7 @@ var EbayMenu = function (_a) {
|
|
|
109
109
|
return (react_1.default.createElement("span", __assign({}, rest, { className: classnames_1.default(className, 'menu') }),
|
|
110
110
|
react_1.default.createElement("div", { className: "menu__items", role: "menu" }, childrenArray.map(function (child, i) {
|
|
111
111
|
var _a = child.props, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, _c = _a.onFocus, onFocus = _c === void 0 ? function () { } : _c, itemRest = __rest(_a, ["onClick", "onFocus"]);
|
|
112
|
-
return react_1.cloneElement(child, __assign(__assign({}, itemRest), { focused: i === focusedIndex, tabIndex: focusedIndex === undefined ? 0 : -1, checked: checkedIndexes[i], onFocus: function (e) {
|
|
112
|
+
return react_1.cloneElement(child, __assign(__assign({}, itemRest), { type: type, focused: i === focusedIndex, tabIndex: focusedIndex === undefined ? 0 : -1, checked: checkedIndexes[i], onFocus: function (e) {
|
|
113
113
|
setFocusedIndex(i);
|
|
114
114
|
onFocus(e);
|
|
115
115
|
}, onClick: function (e) {
|