@ebay/ui-core-react 5.7.0 → 5.9.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/common/component-utils/array.polyfill.flat.js +1 -0
- package/common/debounce.d.ts +1 -1
- package/common/debounce.d.ts.map +1 -1
- package/common/debounce.js +5 -18
- package/ebay-carousel/carousel.d.ts +1 -1
- package/ebay-carousel/carousel.d.ts.map +1 -1
- package/ebay-carousel/index.d.ts +1 -1
- package/ebay-carousel/index.d.ts.map +1 -1
- package/ebay-fake-menu/README.md +6 -3
- package/ebay-fake-menu/index.d.ts +1 -1
- package/ebay-fake-menu/index.d.ts.map +1 -1
- package/ebay-fake-menu/menu-item.d.ts +5 -1
- package/ebay-fake-menu/menu-item.d.ts.map +1 -1
- package/ebay-fake-menu/menu-item.js +20 -4
- package/ebay-menu/README.md +7 -7
- package/ebay-pagination/pagination.js +2 -2
- package/package.json +1 -1
package/common/debounce.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function debounce
|
|
1
|
+
export declare function debounce<F extends (...args: Parameters<F>) => ReturnType<F>>(fn: F, ms: number): (...args: Parameters<F>) => void;
|
|
2
2
|
//# sourceMappingURL=debounce.d.ts.map
|
package/common/debounce.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/common/debounce.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/common/debounce.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,SAAQ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,EACvE,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,MAAM,GACX,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAOlC"}
|
package/common/debounce.js
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.debounce = void 0;
|
|
13
4
|
function debounce(fn, ms) {
|
|
14
|
-
var _this = this;
|
|
15
5
|
var timer;
|
|
16
6
|
return function () {
|
|
7
|
+
var args = [];
|
|
8
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9
|
+
args[_i] = arguments[_i];
|
|
10
|
+
}
|
|
17
11
|
clearTimeout(timer);
|
|
18
|
-
timer = setTimeout(function () {
|
|
19
|
-
var args = [];
|
|
20
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
21
|
-
args[_i] = arguments[_i];
|
|
22
|
-
}
|
|
23
|
-
timer = null;
|
|
24
|
-
fn.apply.apply(fn, __spreadArray([_this], args, false));
|
|
25
|
-
}, ms);
|
|
12
|
+
timer = setTimeout(function () { return fn.apply(void 0, args); }, ms);
|
|
26
13
|
};
|
|
27
14
|
}
|
|
28
15
|
exports.debounce = debounce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../src/ebay-carousel/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAY,cAAc,EAAE,EAAE,EAA+C,MAAM,OAAO,CAAA;AAQxG,
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../src/ebay-carousel/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAY,cAAc,EAAE,EAAE,EAA+C,MAAM,OAAO,CAAA;AAQxG,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE;;KAAA,KAAK,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE;;KAAA,KAAK,IAAI,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAA;IAC9C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAA;CAClD,CAAC;AAMF,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,aAAa,CA0GnC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
package/ebay-carousel/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-carousel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-carousel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAA"}
|
package/ebay-fake-menu/README.md
CHANGED
|
@@ -29,10 +29,13 @@ import '@ebay/skin/menu';
|
|
|
29
29
|
|
|
30
30
|
## EbayFakeMenuItem Props
|
|
31
31
|
|
|
32
|
-
Name | Type
|
|
33
|
-
---
|
|
34
|
-
`href` | String
|
|
32
|
+
Name | Type | Required | Description
|
|
33
|
+
--- |---------| --- | ---
|
|
34
|
+
`href` | String | No | Redirection link on click
|
|
35
|
+
`type` | String | No | Set to `button` to render menu-item as a button instead of a link
|
|
35
36
|
`current` | Boolean | No | Whether or not the href is the current href of the page
|
|
37
|
+
`badgeNumber` | Number | No | Used as a number to be placed inside the badge
|
|
38
|
+
`badgeAriaLabel` | Number | No | Only if `badgeNumber` provided, passed as the `aria-label` directly to the badge
|
|
36
39
|
|
|
37
40
|
## EbayFakeMenuSeparator
|
|
38
41
|
Example:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as EbayFakeMenu } from './menu';
|
|
2
|
-
export { default as EbayFakeMenuItem, EbayFakeMenuItemProps } from './menu-item';
|
|
2
|
+
export { default as EbayFakeMenuItem, EbayFakeMenuItemProps, EbayMenuItemType } from './menu-item';
|
|
3
3
|
export { default as EbayFakeMenuSeparator } from './menu-item-separator';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-fake-menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-fake-menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAClG,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { ComponentProps, FC } from 'react';
|
|
2
|
-
export type
|
|
2
|
+
export type EbayMenuItemType = 'button';
|
|
3
|
+
export type EbayFakeMenuItemProps = Omit<ComponentProps<'a'>, 'onKeyDown' | 'onMouseDown'> & Omit<ComponentProps<'button'>, 'onKeyDown' | 'onMouseDown'> & {
|
|
3
4
|
current?: boolean;
|
|
4
5
|
disabled?: boolean;
|
|
5
6
|
autoFocus?: boolean;
|
|
7
|
+
type?: EbayMenuItemType;
|
|
8
|
+
badgeNumber?: number;
|
|
9
|
+
badgeAriaLabel?: string;
|
|
6
10
|
};
|
|
7
11
|
declare const EbayMenuItem: FC<EbayFakeMenuItemProps>;
|
|
8
12
|
export default EbayMenuItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../src/ebay-fake-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-fake-menu/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAqB,MAAM,OAAO,CAAA;AAKpE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAA;AACvC,MAAM,MAAM,qBAAqB,GAC7B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,GACtD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,GAC3D;IACI,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAA;AAEL,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,qBAAqB,CA+D3C,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -51,17 +51,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
51
51
|
var react_1 = __importStar(require("react"));
|
|
52
52
|
var classnames_1 = __importDefault(require("classnames"));
|
|
53
53
|
var ebay_icon_1 = require("../ebay-icon");
|
|
54
|
+
var ebay_badge_1 = require("../ebay-badge");
|
|
54
55
|
var EbayMenuItem = function (_a) {
|
|
55
|
-
var className = _a.className, current = _a.current, disabled = _a.disabled, autoFocus = _a.autoFocus, children = _a.children, rest = __rest(_a, ["className", "current", "disabled", "autoFocus", "children"]);
|
|
56
|
+
var className = _a.className, current = _a.current, disabled = _a.disabled, autoFocus = _a.autoFocus, type = _a.type, badgeNumber = _a.badgeNumber, badgeAriaLabel = _a.badgeAriaLabel, children = _a.children, rest = __rest(_a, ["className", "current", "disabled", "autoFocus", "type", "badgeNumber", "badgeAriaLabel", "children"]);
|
|
56
57
|
var ref = (0, react_1.useRef)();
|
|
58
|
+
var hasBadge = badgeNumber !== undefined;
|
|
57
59
|
(0, react_1.useEffect)(function () {
|
|
58
60
|
var _a;
|
|
59
61
|
if (autoFocus) {
|
|
60
62
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
61
63
|
}
|
|
62
64
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
var itemProps = __assign(__assign({}, rest), { ref: ref, className: (0, classnames_1.default)(className, 'fake-menu__item', hasBadge && 'menu__item--badged'), 'aria-label': badgeAriaLabel });
|
|
66
|
+
var tick = react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "tick16" });
|
|
67
|
+
// todo: remove this workaround when Skin team fixes https://github.com/eBay/skin/issues/2208
|
|
68
|
+
var badgeStyleFix = {
|
|
69
|
+
marginLeft: 'var(--spacing-100)',
|
|
70
|
+
marginRight: 'var(--spacing-100)'
|
|
71
|
+
};
|
|
72
|
+
var badge = hasBadge && react_1.default.createElement(ebay_badge_1.EbayBadge, { type: "menu", number: badgeNumber, style: badgeStyleFix });
|
|
73
|
+
return type === 'button' ? (react_1.default.createElement("button", __assign({}, itemProps, { type: "button", disabled: disabled }),
|
|
74
|
+
react_1.default.createElement("span", null,
|
|
75
|
+
children,
|
|
76
|
+
badge),
|
|
77
|
+
tick)) : (react_1.default.createElement("a", __assign({}, itemProps, { "aria-disabled": disabled ? 'true' : undefined }),
|
|
78
|
+
react_1.default.createElement("span", null,
|
|
79
|
+
children,
|
|
80
|
+
badge),
|
|
81
|
+
tick));
|
|
66
82
|
};
|
|
67
83
|
exports.default = EbayMenuItem;
|
package/ebay-menu/README.md
CHANGED
|
@@ -33,13 +33,13 @@ Name | Type | Required | Description
|
|
|
33
33
|
|
|
34
34
|
## EbayMenuItem Props
|
|
35
35
|
|
|
36
|
-
Name | Type | Required
|
|
37
|
-
--- | ---
|
|
38
|
-
`value` | String | No
|
|
39
|
-
`checked` | Boolean | No
|
|
40
|
-
`disabled` | Boolean | No
|
|
41
|
-
`badgeNumber` | Number | No
|
|
42
|
-
`badgeAriaLabel` | String |
|
|
36
|
+
Name | Type | Required | Description
|
|
37
|
+
--- | --- |---------------------------------| ---
|
|
38
|
+
`value` | String | No | for type `radio`, `checkbox`: the value to use with callbacks for `checkedValues[]`
|
|
39
|
+
`checked` | Boolean | No | for type `radio`, `checkbox`: whether or not the item is checked
|
|
40
|
+
`disabled` | Boolean | No | makes the menu item disabled
|
|
41
|
+
`badgeNumber` | Number | No | used as the number to be placed in the badge
|
|
42
|
+
`badgeAriaLabel` | String | Only if `badgeNumber` provided, passed as the `aria-label` directly to the badge
|
|
43
43
|
|
|
44
44
|
## EbayMenuSeparator
|
|
45
45
|
Example:
|
|
@@ -98,9 +98,9 @@ var EbayPagination = function (_a) {
|
|
|
98
98
|
(0, react_1.useEffect)(function () {
|
|
99
99
|
var debouncedUpdate = (0, debounce_1.debounce)(updatePages, 16);
|
|
100
100
|
updatePages();
|
|
101
|
-
window.addEventListener('resize', debouncedUpdate);
|
|
101
|
+
window.addEventListener('resize', function () { return debouncedUpdate(); });
|
|
102
102
|
return function () {
|
|
103
|
-
window.removeEventListener('resize', debouncedUpdate);
|
|
103
|
+
window.removeEventListener('resize', function () { return debouncedUpdate(); });
|
|
104
104
|
};
|
|
105
105
|
}, [children]);
|
|
106
106
|
var createChildItems = function (itemType) {
|