@ebay/ui-core-react 4.2.6 → 5.0.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/event-utils/index.d.ts +10 -7
- package/common/event-utils/index.d.ts.map +1 -1
- package/common/event-utils/index.js +11 -3
- package/common/event-utils/types.d.ts +7 -0
- package/common/event-utils/types.d.ts.map +1 -1
- package/common/event-utils/types.js +12 -0
- package/common/floating-label-utils/hooks.d.ts +2 -1
- package/common/floating-label-utils/hooks.d.ts.map +1 -1
- package/common/floating-label-utils/hooks.js +5 -4
- package/ebay-alert-dialog/README.md +3 -2
- package/ebay-alert-dialog/alert-dialog.d.ts +0 -1
- package/ebay-alert-dialog/alert-dialog.d.ts.map +1 -1
- package/ebay-alert-dialog/alert-dialog.js +1 -1
- package/ebay-breadcrumbs/README.md +1 -1
- package/ebay-breadcrumbs/breadcrumbs.d.ts +3 -2
- package/ebay-breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/ebay-breadcrumbs/breadcrumbs.js +1 -1
- package/ebay-button/README.md +4 -4
- package/ebay-carousel/carousel.js +1 -1
- package/ebay-checkbox/README.md +11 -10
- package/ebay-checkbox/checkbox.d.ts +15 -3
- package/ebay-checkbox/checkbox.d.ts.map +1 -1
- package/ebay-checkbox/checkbox.js +9 -4
- package/ebay-confirm-dialog/README.md +6 -6
- package/ebay-confirm-dialog/confirm-dialog.d.ts +0 -1
- package/ebay-confirm-dialog/confirm-dialog.d.ts.map +1 -1
- package/ebay-confirm-dialog/confirm-dialog.js +1 -1
- package/ebay-dialog-base/components/dialogBase.d.ts +3 -2
- package/ebay-dialog-base/components/dialogBase.d.ts.map +1 -1
- package/ebay-dialog-base/components/dialogBase.js +6 -3
- package/ebay-drawer-dialog/README.md +7 -6
- package/ebay-drawer-dialog/components/drawer.d.ts +3 -0
- package/ebay-drawer-dialog/components/drawer.d.ts.map +1 -1
- package/ebay-fake-menu/README.md +5 -5
- package/ebay-fake-menu/menu-item.d.ts +1 -1
- package/ebay-fake-menu/menu-item.d.ts.map +1 -1
- package/ebay-fake-menu/menu.d.ts +9 -5
- package/ebay-fake-menu/menu.d.ts.map +1 -1
- package/ebay-fake-menu/menu.js +2 -2
- package/ebay-fake-menu-button/README.md +9 -4
- package/ebay-fake-menu-button/menu-button.d.ts +9 -2
- package/ebay-fake-menu-button/menu-button.d.ts.map +1 -1
- package/ebay-fake-menu-button/menu-button.js +7 -5
- package/ebay-fullscreen-dialog/fullscreen-dialog.d.ts +0 -1
- package/ebay-fullscreen-dialog/fullscreen-dialog.d.ts.map +1 -1
- package/ebay-fullscreen-dialog/fullscreen-dialog.js +1 -1
- package/ebay-icon-button/README.md +9 -0
- package/ebay-icon-button/icon-button.d.ts +3 -1
- package/ebay-icon-button/icon-button.d.ts.map +1 -1
- package/ebay-icon-button/icon-button.js +8 -2
- package/ebay-lightbox-dialog/lightbox-dialog.d.ts +0 -1
- package/ebay-lightbox-dialog/lightbox-dialog.d.ts.map +1 -1
- package/ebay-lightbox-dialog/lightbox-dialog.js +1 -1
- package/ebay-listbox-button/README.md +8 -1
- package/ebay-listbox-button/listbox-button.d.ts +11 -3
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/ebay-listbox-button/listbox-button.js +41 -16
- package/ebay-menu/README.md +5 -4
- package/ebay-menu/menu-item.d.ts +1 -1
- package/ebay-menu/menu-item.d.ts.map +1 -1
- package/ebay-menu/menu.d.ts +4 -4
- package/ebay-menu/menu.d.ts.map +1 -1
- package/ebay-menu/menu.js +85 -42
- package/ebay-menu/types.d.ts +21 -12
- package/ebay-menu/types.d.ts.map +1 -1
- package/ebay-menu-button/README.md +2 -2
- package/ebay-menu-button/menu-button.d.ts +3 -3
- package/ebay-menu-button/menu-button.d.ts.map +1 -1
- package/ebay-menu-button/menu-button.js +18 -4
- package/ebay-page-notice/README.md +5 -1
- package/ebay-page-notice/index.d.ts +1 -1
- package/ebay-page-notice/index.d.ts.map +1 -1
- package/ebay-page-notice/page-notice.d.ts +5 -4
- package/ebay-page-notice/page-notice.d.ts.map +1 -1
- package/ebay-page-notice/page-notice.js +7 -8
- package/ebay-pagination/README.md +5 -5
- package/ebay-pagination/pagination-item.d.ts +8 -4
- package/ebay-pagination/pagination-item.d.ts.map +1 -1
- package/ebay-pagination/pagination-item.js +2 -1
- package/ebay-pagination/pagination.d.ts +8 -5
- package/ebay-pagination/pagination.d.ts.map +1 -1
- package/ebay-pagination/pagination.js +1 -1
- package/ebay-panel-dialog/panel-dialog.d.ts +0 -1
- package/ebay-panel-dialog/panel-dialog.d.ts.map +1 -1
- package/ebay-panel-dialog/panel-dialog.js +1 -1
- package/ebay-radio/README.md +7 -2
- package/ebay-radio/radio.d.ts +12 -3
- package/ebay-radio/radio.d.ts.map +1 -1
- package/ebay-radio/radio.js +7 -5
- package/ebay-section-notice/README.md +5 -0
- package/ebay-section-notice/index.d.ts +1 -1
- package/ebay-section-notice/index.d.ts.map +1 -1
- package/ebay-section-notice/section-notice.d.ts +6 -3
- package/ebay-section-notice/section-notice.d.ts.map +1 -1
- package/ebay-section-notice/section-notice.js +32 -4
- package/ebay-select/README.md +3 -1
- package/ebay-select/ebay-select.d.ts +7 -2
- package/ebay-select/ebay-select.d.ts.map +1 -1
- package/ebay-select/ebay-select.js +1 -1
- package/ebay-select/index.d.ts +1 -1
- package/ebay-select/index.d.ts.map +1 -1
- package/ebay-split-button/README.md +2 -2
- package/ebay-split-button/split-button.js +1 -1
- package/ebay-split-button/types.d.ts +2 -3
- package/ebay-split-button/types.d.ts.map +1 -1
- package/ebay-star-rating-select/README.md +8 -0
- package/ebay-star-rating-select/star-rating-select.d.ts +8 -4
- package/ebay-star-rating-select/star-rating-select.d.ts.map +1 -1
- package/ebay-star-rating-select/star-rating-select.js +8 -8
- package/ebay-switch/README.md +5 -1
- package/ebay-switch/ebay-switch.d.ts +7 -3
- package/ebay-switch/ebay-switch.d.ts.map +1 -1
- package/ebay-switch/ebay-switch.js +6 -3
- package/ebay-tabs/README.md +6 -10
- package/ebay-tabs/tab-panel.d.ts +0 -1
- package/ebay-tabs/tab-panel.d.ts.map +1 -1
- package/ebay-tabs/tab-panel.js +2 -2
- package/ebay-tabs/tab.d.ts +1 -7
- package/ebay-tabs/tab.d.ts.map +1 -1
- package/ebay-tabs/tab.js +2 -7
- package/ebay-tabs/tabs.d.ts +7 -1
- package/ebay-tabs/tabs.d.ts.map +1 -1
- package/ebay-tabs/tabs.js +12 -19
- package/ebay-textbox/README.md +16 -9
- package/ebay-textbox/postfix-icon.d.ts.map +1 -1
- package/ebay-textbox/postfix-icon.js +25 -3
- package/ebay-textbox/prefix-icon.d.ts.map +1 -1
- package/ebay-textbox/prefix-icon.js +24 -2
- package/ebay-textbox/textbox.d.ts +17 -7
- package/ebay-textbox/textbox.d.ts.map +1 -1
- package/ebay-textbox/textbox.js +47 -14
- package/ebay-textbox/types.d.ts +2 -2
- package/ebay-textbox/types.d.ts.map +1 -1
- package/ebay-video/README.md +7 -5
- package/ebay-video/controls.d.ts.map +1 -1
- package/ebay-video/controls.js +10 -4
- package/ebay-video/reportButton.d.ts +1 -5
- package/ebay-video/reportButton.d.ts.map +1 -1
- package/ebay-video/reportButton.js +3 -3
- package/ebay-video/video.d.ts +13 -10
- package/ebay-video/video.d.ts.map +1 -1
- package/ebay-video/video.js +4 -1
- package/package.json +1 -1
package/ebay-radio/radio.js
CHANGED
|
@@ -49,10 +49,12 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
49
49
|
var ebay_icon_1 = require("../ebay-icon");
|
|
50
50
|
var ebay_field_1 = require("../ebay-field");
|
|
51
51
|
var EbayRadio = function (_a) {
|
|
52
|
-
var _b = _a.size, size = _b === void 0 ? 'default' : _b, checked = _a.checked, defaultChecked = _a.defaultChecked, className = _a.className, style = _a.style, id = _a.id, _c = _a.onChange, onChange = _c === void 0 ? function () { } : _c, children = _a.children, rest = __rest(_a, ["size", "checked", "defaultChecked", "className", "style", "id", "onChange", "children"]);
|
|
53
|
-
var handleChange = function (e) {
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
var _b = _a.size, size = _b === void 0 ? 'default' : _b, checked = _a.checked, defaultChecked = _a.defaultChecked, className = _a.className, style = _a.style, id = _a.id, _c = _a.onChange, onChange = _c === void 0 ? function () { } : _c, _d = _a.onFocus, onFocus = _d === void 0 ? function () { } : _d, _e = _a.onKeyDown, onKeyDown = _e === void 0 ? function () { } : _e, children = _a.children, rest = __rest(_a, ["size", "checked", "defaultChecked", "className", "style", "id", "onChange", "onFocus", "onKeyDown", "children"]);
|
|
53
|
+
var handleChange = function (e) { var _a; return onChange(e, { value: (_a = e.target) === null || _a === void 0 ? void 0 : _a.value }); };
|
|
54
|
+
var handleFocus = function (e) { var _a; return onFocus(e, { value: (_a = e.target) === null || _a === void 0 ? void 0 : _a.value }); };
|
|
55
|
+
var handleKeyDown = function (e) {
|
|
56
|
+
var radioButton = e.target;
|
|
57
|
+
return onKeyDown(e, { value: radioButton === null || radioButton === void 0 ? void 0 : radioButton.value });
|
|
56
58
|
};
|
|
57
59
|
var containerClass = classnames_1.default('radio', className, { 'radio--large': size === 'large' });
|
|
58
60
|
var iconChecked = size === 'large' ?
|
|
@@ -65,7 +67,7 @@ var EbayRadio = function (_a) {
|
|
|
65
67
|
var ebayLabel = childrenArray.find(function (child) { return child.type === ebay_field_1.EbayLabel; });
|
|
66
68
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
67
69
|
react_1.default.createElement("span", { className: containerClass, style: __assign(__assign({}, style), { alignItems: 'center' }) },
|
|
68
|
-
react_1.default.createElement("input", __assign({}, rest, { id: id, className: "radio__control", type: "radio", defaultChecked: defaultChecked, checked: checked, onChange: handleChange })),
|
|
70
|
+
react_1.default.createElement("input", __assign({}, rest, { id: id, className: "radio__control", type: "radio", defaultChecked: defaultChecked, checked: checked, onChange: handleChange, onFocus: handleFocus, onKeyDown: handleKeyDown })),
|
|
69
71
|
react_1.default.createElement("span", { className: "radio__icon", hidden: true },
|
|
70
72
|
iconChecked,
|
|
71
73
|
iconUnChecked)),
|
|
@@ -45,3 +45,8 @@ import "@ebay/skin/section-notice";
|
|
|
45
45
|
| `aria-label` | String | No | The description of the notice itself for screen readers. Check out [this issue](https://github.com/eBay/skin/issues/1001) for more context. | - |
|
|
46
46
|
| `aria-roledescription` | String | No | Adds role description attribute to the section notice | `"Notice"` |
|
|
47
47
|
| `children` | React Node | No | The content to be displayed within the notice. **Must have the EbayNoticeContent within the children!** | - |
|
|
48
|
+
|
|
49
|
+
## Callbacks
|
|
50
|
+
| Name | Required | Description | Arguments |
|
|
51
|
+
|------|----------------------|-------------------|-----------|
|
|
52
|
+
| `onDismiss` | No | Triggered on notice dismiss | (Event) |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as EbaySectionNotice } from './section-notice';
|
|
1
|
+
export { default as EbaySectionNotice, SectionNoticeStatus, Props as EbaySectionNoticeProps } from './section-notice';
|
|
2
2
|
export { default as EbaySectionNoticeTitle } from './section-notice-title';
|
|
3
3
|
export { default as EbaySectionNoticeFooter } from './section-notice-footer';
|
|
4
4
|
export { EbayNoticeContent } from '../ebay-notice-base/components/ebay-notice-content';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-section-notice/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-section-notice/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,mBAAmB,EAAE,KAAK,IAAI,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACrH,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare type
|
|
3
|
-
|
|
1
|
+
import { ComponentProps, FC, KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
|
+
export declare type SectionNoticeStatus = 'general' | 'none' | 'attention' | 'confirmation' | 'information';
|
|
3
|
+
export declare type Props = ComponentProps<'section'> & {
|
|
4
|
+
status?: SectionNoticeStatus;
|
|
4
5
|
'aria-label'?: string;
|
|
5
6
|
'aria-roledescription'?: string;
|
|
6
7
|
className?: string;
|
|
8
|
+
a11yDismissText?: string;
|
|
9
|
+
onDismiss?: MouseEventHandler & KeyboardEventHandler;
|
|
7
10
|
};
|
|
8
11
|
declare const EbaySectionNotice: FC<Props>;
|
|
9
12
|
export default EbaySectionNotice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-notice.d.ts","sourceRoot":"","sources":["../../src/ebay-section-notice/section-notice.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"section-notice.d.ts","sourceRoot":"","sources":["../../src/ebay-section-notice/section-notice.tsx"],"names":[],"mappings":"AAAA,OAAc,EACV,cAAc,EACd,EAAE,EAEF,oBAAoB,EAEpB,iBAAiB,EAEpB,MAAM,OAAO,CAAA;AAOd,oBAAY,mBAAmB,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CAAA;AACnG,oBAAY,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG;IAC5C,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;CACxD,CAAA;AAED,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,KAAK,CAmDhC,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -10,6 +10,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
13
32
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
33
|
var t = {};
|
|
15
34
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,13 +44,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
44
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
45
|
};
|
|
27
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
var react_1 =
|
|
47
|
+
var react_1 = __importStar(require("react"));
|
|
29
48
|
var classnames_1 = __importDefault(require("classnames"));
|
|
30
49
|
var ebay_notice_content_1 = require("../ebay-notice-base/components/ebay-notice-content");
|
|
31
50
|
var notice_content_1 = __importDefault(require("../common/notice-utils/notice-content"));
|
|
32
51
|
var ebay_icon_1 = require("../ebay-icon");
|
|
52
|
+
var index_1 = require("./index");
|
|
33
53
|
var EbaySectionNotice = function (_a) {
|
|
34
|
-
var _b = _a.status, status = _b === void 0 ? 'general' : _b, children = _a.children, className = _a.className, ariaLabel = _a["aria-label"], _c = _a["aria-roledescription"], ariaRoleDescription = _c === void 0 ? 'Notice' : _c, rest = __rest(_a, ["status", "children", "className", 'aria-label', 'aria-roledescription']);
|
|
54
|
+
var _b = _a.status, status = _b === void 0 ? 'general' : _b, children = _a.children, className = _a.className, ariaLabel = _a["aria-label"], _c = _a["aria-roledescription"], ariaRoleDescription = _c === void 0 ? 'Notice' : _c, a11yDismissText = _a.a11yDismissText, _d = _a.onDismiss, onDismiss = _d === void 0 ? function () { } : _d, rest = __rest(_a, ["status", "children", "className", 'aria-label', 'aria-roledescription', "a11yDismissText", "onDismiss"]);
|
|
55
|
+
var _e = react_1.useState(false), dismissed = _e[0], setDismissed = _e[1];
|
|
35
56
|
var childrenArray = react_1.default.Children.toArray(children);
|
|
36
57
|
var content = childrenArray.find(function (_a) {
|
|
37
58
|
var type = _a.type;
|
|
@@ -41,10 +62,17 @@ var EbaySectionNotice = function (_a) {
|
|
|
41
62
|
if (!content) {
|
|
42
63
|
throw new Error("EbaySectionNotice: Please use a EbayNoticeContent that defines the content of the notice");
|
|
43
64
|
}
|
|
44
|
-
|
|
65
|
+
var handleDismissed = function (event) {
|
|
66
|
+
setDismissed(true);
|
|
67
|
+
onDismiss(event);
|
|
68
|
+
};
|
|
69
|
+
return dismissed ? null : (react_1.default.createElement("section", __assign({}, rest, { className: classnames_1.default(className, "section-notice", hasStatus && "section-notice--" + status), role: "region", "aria-label": !hasStatus ? ariaLabel : null, "aria-labelledby": hasStatus ? "section-notice-" + status : null, "aria-roledescription": ariaRoleDescription }),
|
|
45
70
|
hasStatus && (react_1.default.createElement("div", { className: "section-notice__header", id: "section-notice-" + status },
|
|
46
71
|
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: status + "Filled16", a11yText: ariaLabel, a11yVariant: "label" }))),
|
|
47
72
|
react_1.default.createElement(notice_content_1.default, __assign({}, content.props, { type: "section" })),
|
|
48
|
-
children
|
|
73
|
+
children,
|
|
74
|
+
a11yDismissText && (react_1.default.createElement(index_1.EbaySectionNoticeFooter, null,
|
|
75
|
+
react_1.default.createElement("button", { "aria-label": a11yDismissText, className: "fake-link page-notice__dismiss", onClick: handleDismissed },
|
|
76
|
+
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "close16" }))))));
|
|
49
77
|
};
|
|
50
78
|
exports.default = EbaySectionNotice;
|
package/ebay-select/README.md
CHANGED
|
@@ -48,11 +48,13 @@ https://reactjs.org/docs/forms.html#the-select-tag. Notice that the selected val
|
|
|
48
48
|
| `disabled` | String | No | passed to the `<select>` element, default is `false` |
|
|
49
49
|
| `className` | String | No | passed to the wrapper-element of the `<select>` element |
|
|
50
50
|
| `borderless` | String | No | whether button has borders, default is `false` |
|
|
51
|
-
| `onChange` | Function | No | { el, index, selected } |
|
|
52
51
|
| `floatingLabel` | String | No | Indicates that the select is a floating label type and renders it as a label |
|
|
53
52
|
| `inputSize` | String | No | `default` (default), `large` |
|
|
54
53
|
| `invalid` | Boolean | No | Indicates a field-level error with red border if true |
|
|
55
54
|
|
|
55
|
+
## Callbacks
|
|
56
|
+
| `onChange` | Function | No | Called on option change with arguments: `(ChangeEvent, { index: number, selected: string[] }` |
|
|
57
|
+
|
|
56
58
|
## EbaySelectOption Attributes
|
|
57
59
|
|
|
58
60
|
| Name | Type | Required | Description |
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { EbayChangeEventHandler } from '../common/event-utils/types';
|
|
2
3
|
declare type SelectValue = string | ReadonlyArray<string> | number;
|
|
4
|
+
export declare type ChangeEventProps = {
|
|
5
|
+
index: number;
|
|
6
|
+
selected: string[];
|
|
7
|
+
};
|
|
3
8
|
export declare type EbaySelectProps = Omit<ComponentProps<'select'>, 'onChange'> & {
|
|
4
9
|
borderless?: boolean;
|
|
5
10
|
defaultValue?: SelectValue;
|
|
6
|
-
onChange?:
|
|
11
|
+
onChange?: EbayChangeEventHandler<HTMLSelectElement, ChangeEventProps>;
|
|
7
12
|
floatingLabel?: string;
|
|
8
13
|
inputSize?: 'default' | 'large';
|
|
9
14
|
invalid?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebay-select.d.ts","sourceRoot":"","sources":["../../src/ebay-select/ebay-select.tsx"],"names":[],"mappings":"AAAA,OAAc,
|
|
1
|
+
{"version":3,"file":"ebay-select.d.ts","sourceRoot":"","sources":["../../src/ebay-select/ebay-select.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA6B,cAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAA;AAM1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAIpE,aAAK,WAAW,GAAG,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAC3D,oBAAY,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AACpE,oBAAY,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAiFnC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -71,7 +71,7 @@ var EbaySelect = function (_a) {
|
|
|
71
71
|
if (!isControlled(controlledValue)) {
|
|
72
72
|
setValue(newValue);
|
|
73
73
|
}
|
|
74
|
-
onChange(e, selectedIndex, newValue);
|
|
74
|
+
onChange(e, { index: selectedIndex, selected: [newValue] });
|
|
75
75
|
};
|
|
76
76
|
var handleBlur = function (event) {
|
|
77
77
|
onBlur(event);
|
package/ebay-select/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACxF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -48,5 +48,5 @@ Name | Type | Stateful | Required | Description | Data
|
|
|
48
48
|
`onBlur` | Function | - | No | triggered on blur
|
|
49
49
|
`onExpand` | Function | - | No | Called when content is expanded
|
|
50
50
|
`onCollapse` | Function | - | No | Called when content is collapsed
|
|
51
|
-
`onChange` | Function | - | No | Arguments: (index: number, checked:
|
|
52
|
-
`onSelect` | Function | - | No | Arguments: (index: number, checked:
|
|
51
|
+
`onChange` | Function | - | No | Arguments: (e: event, { index: number, checked: number[], checkedValues: string[] }) for type `radio`/`checkbox`
|
|
52
|
+
`onSelect` | Function | - | No | Arguments: (e: event, { index: number, checked: number[] }), not for use with type `radio`/`checkbox`
|
|
@@ -36,6 +36,6 @@ var EbaySplitButton = function (_a) {
|
|
|
36
36
|
var menuItems = component_utils_1.filterByType(children, menuItemComponents);
|
|
37
37
|
return (react_1.default.createElement("span", { className: "split-button" },
|
|
38
38
|
react_1.default.createElement(ebay_button_1.EbayButton, __assign({ "aria-label": bodyState === 'loading' ? a11yButtonLoadingText : undefined }, rest, { split: "start", bodyState: bodyState === 'expand' ? undefined : bodyState }), buttonLabel),
|
|
39
|
-
react_1.default.createElement(ebay_menu_button_1.EbayMenuButton, { priority: rest.priority, disabled: rest.disabled, transparent: rest.transparent, size: rest.size, type: type, split: "end", reverse: true, a11yText: a11yMenuText, onCollapse: onCollapse, onExpand: onExpand,
|
|
39
|
+
react_1.default.createElement(ebay_menu_button_1.EbayMenuButton, { priority: rest.priority, disabled: rest.disabled, transparent: rest.transparent, size: rest.size, type: type, split: "end", reverse: true, a11yText: a11yMenuText, onCollapse: onCollapse, onExpand: onExpand, onSelect: onSelect, onChange: onChange }, menuItems)));
|
|
40
40
|
};
|
|
41
41
|
exports.default = EbaySplitButton;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
2
|
import { EbayButtonProps } from '../ebay-button';
|
|
3
|
-
import {
|
|
4
|
-
import { EbayMenuButtonProps } from '../ebay-menu-button';
|
|
3
|
+
import { EbayMenuProps } from '../ebay-menu';
|
|
5
4
|
export declare type EbaySplitButtonProps = {
|
|
6
5
|
a11yMenuText?: string;
|
|
7
6
|
a11yButtonLoadingText?: string;
|
|
@@ -9,6 +8,6 @@ export declare type EbaySplitButtonProps = {
|
|
|
9
8
|
onExpand?: () => void;
|
|
10
9
|
};
|
|
11
10
|
declare type MenuEvents = 'onSelect' | 'onChange';
|
|
12
|
-
export declare type Props = EbaySplitButtonProps & Omit<EbayButtonProps, 'ref'> & Omit<ComponentProps<'button'>, 'type' | MenuEvents> & Omit<ComponentProps<'a'>, MenuEvents> & Omit<
|
|
11
|
+
export declare type Props = EbaySplitButtonProps & Omit<EbayButtonProps, 'ref'> & Omit<ComponentProps<'button'>, 'type' | MenuEvents> & Omit<ComponentProps<'a'>, MenuEvents> & Omit<EbayMenuProps, 'priority'>;
|
|
13
12
|
export {};
|
|
14
13
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-split-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-split-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,oBAAY,oBAAoB,GAAG;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAA;AAED,aAAK,UAAU,GAAG,UAAU,GAAG,UAAU,CAAA;AAEzC,oBAAY,KAAK,GACb,oBAAoB,GACpB,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,GAC5B,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,GACnD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GACrC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -35,3 +35,11 @@ Name | Type | Stateful | Description
|
|
|
35
35
|
| `a11yText` | String | No | Yes | container aria-label |
|
|
36
36
|
| `value` | String | No | Yes | The amount of stars to be filled. Can be "2-5" for 2 and a half stars.|
|
|
37
37
|
| `disabled` | Boolean | No | Rating stars are disabled or not
|
|
38
|
+
|
|
39
|
+
## Callbacks
|
|
40
|
+
|
|
41
|
+
| Name | Type | Required | Description | Data |
|
|
42
|
+
|------------|----------|----------|---------------------------|--------------------------------------|
|
|
43
|
+
| `onChange` | Function | No | triggered on value change | `(ChangeEvent, { value: number })` |
|
|
44
|
+
| `onFocus` | Function | No | triggered on focus | `(FocusEvent, { value: number })` |
|
|
45
|
+
| `onKeydown` | Function | No | triggered on keydown | `(KeyboardEvent, { value: number })` |
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { EbayChangeEventHandler, EbayFocusEventHandler, EbayKeyboardEventHandler } from '../common/event-utils/types';
|
|
3
|
+
export declare type EventProps = {
|
|
4
|
+
value: number;
|
|
5
|
+
};
|
|
2
6
|
declare type Props = ComponentProps<'div'> & {
|
|
3
7
|
a11yText?: string;
|
|
4
8
|
value?: string;
|
|
5
9
|
a11yStarText?: string[];
|
|
6
10
|
disabled?: boolean;
|
|
7
11
|
name?: string;
|
|
8
|
-
onKeyDown?:
|
|
9
|
-
onChange?:
|
|
10
|
-
onFocus?:
|
|
12
|
+
onKeyDown?: EbayKeyboardEventHandler<HTMLInputElement, EventProps>;
|
|
13
|
+
onChange?: EbayChangeEventHandler<HTMLInputElement, EventProps>;
|
|
14
|
+
onFocus?: EbayFocusEventHandler<HTMLInputElement, EventProps>;
|
|
11
15
|
};
|
|
12
16
|
declare const EbayStarRatingSelect: FC<Props>;
|
|
13
17
|
export default EbayStarRatingSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star-rating-select.d.ts","sourceRoot":"","sources":["../../src/ebay-star-rating-select/star-rating-select.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"star-rating-select.d.ts","sourceRoot":"","sources":["../../src/ebay-star-rating-select/star-rating-select.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAA;AAKtE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAErH,oBAAY,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAC1C,aAAK,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IACnE,QAAQ,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAChE,OAAO,CAAC,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;CACjE,CAAA;AASD,QAAA,MAAM,oBAAoB,EAAE,EAAE,CAAC,KAAK,CAgEnC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -58,27 +58,27 @@ var getValue = function (val) {
|
|
|
58
58
|
return value;
|
|
59
59
|
};
|
|
60
60
|
var EbayStarRatingSelect = function (_a) {
|
|
61
|
-
var _b = _a.value, value = _b === void 0 ? 0 : _b, a11yText = _a.a11yText, className = _a.className, _c = _a.a11yStarText, a11yStarText = _c === void 0 ? [] : _c, disabled = _a.disabled,
|
|
62
|
-
var
|
|
61
|
+
var _b = _a.value, value = _b === void 0 ? 0 : _b, a11yText = _a.a11yText, className = _a.className, _c = _a.a11yStarText, a11yStarText = _c === void 0 ? [] : _c, disabled = _a.disabled, _d = _a.onChange, onChange = _d === void 0 ? function () { } : _d, _e = _a.onFocus, onFocus = _e === void 0 ? function () { } : _e, _f = _a.onKeyDown, onKeyDown = _f === void 0 ? function () { } : _f, _g = _a.name, name = _g === void 0 ? "star-rating-" + random_id_1.randomId() : _g, rest = __rest(_a, ["value", "a11yText", "className", "a11yStarText", "disabled", "onChange", "onFocus", "onKeyDown", "name"]);
|
|
62
|
+
var _h = react_1.useState(getValue(value)), checkedValue = _h[0], setChecked = _h[1];
|
|
63
63
|
react_1.useEffect(function () {
|
|
64
64
|
setChecked(getValue(value));
|
|
65
65
|
}, [value]);
|
|
66
66
|
var handleKeyDown = function (i) { return function (e) {
|
|
67
|
-
if (!disabled
|
|
67
|
+
if (!disabled) {
|
|
68
68
|
setChecked(getValue(i));
|
|
69
|
-
onKeyDown(e, i);
|
|
69
|
+
onKeyDown(e, { value: i });
|
|
70
70
|
}
|
|
71
71
|
}; };
|
|
72
72
|
var handleClick = function (i) { return function (e) {
|
|
73
|
-
if (!disabled
|
|
73
|
+
if (!disabled) {
|
|
74
74
|
setChecked(getValue(i));
|
|
75
|
-
onChange(e, i);
|
|
75
|
+
onChange(e, { value: i });
|
|
76
76
|
}
|
|
77
77
|
}; };
|
|
78
78
|
var handleFocus = function (i) { return function (e) {
|
|
79
|
-
if (!disabled
|
|
79
|
+
if (!disabled) {
|
|
80
80
|
setChecked(getValue(i));
|
|
81
|
-
onFocus(e, i);
|
|
81
|
+
onFocus(e, { value: i });
|
|
82
82
|
}
|
|
83
83
|
}; };
|
|
84
84
|
return (react_1.default.createElement("div", __assign({ role: a11yText && 'radiogroup', "aria-label": a11yText, className: classnames_1.default('star-rating-select', className) }, rest), stars.map(function (i) { return (react_1.default.createElement("span", { className: "star-rating-select__radio", key: i },
|
package/ebay-switch/README.md
CHANGED
|
@@ -27,7 +27,11 @@ yarn add @ebay/ui-core-react
|
|
|
27
27
|
Name | Type | Stateful | Description
|
|
28
28
|
--- | --- | --- | ---
|
|
29
29
|
`disabled` | Boolean | No |
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
## Callbacks
|
|
32
|
+
Name | Data | Description
|
|
33
|
+
--- | --- | --- | ---
|
|
34
|
+
`onChange` | `(ChangeEvent, { value: string, checked: boolean }` | Triggered on change
|
|
31
35
|
|
|
32
36
|
Note: For this component, `className`/`style` are applied to the root tag, while all other HTML attributes are applied to the `input` tag.
|
|
33
37
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { FC,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { FC, ComponentProps } from 'react';
|
|
2
|
+
import { EbayChangeEventHandler } from '../common/event-utils/types';
|
|
3
|
+
declare type Props = Omit<ComponentProps<'input'>, 'onChange'> & {
|
|
4
|
+
onChange?: EbayChangeEventHandler<HTMLInputElement, {
|
|
5
|
+
value: string | number;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
}>;
|
|
4
8
|
};
|
|
5
9
|
declare const EbaySwitch: FC<Props>;
|
|
6
10
|
export default EbaySwitch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebay-switch.d.ts","sourceRoot":"","sources":["../../src/ebay-switch/ebay-switch.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ebay-switch.d.ts","sourceRoot":"","sources":["../../src/ebay-switch/ebay-switch.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,EAAE,EAAe,cAAc,EAAE,MAAM,OAAO,CAAA;AAEnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,aAAK,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IACrD,QAAQ,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACrG,CAAA;AAED,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,KAAK,CA0CzB,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -53,9 +53,12 @@ var EbaySwitch = function (_a) {
|
|
|
53
53
|
setChecked(!!checked);
|
|
54
54
|
}, [checked]);
|
|
55
55
|
var handleChange = function (e) {
|
|
56
|
-
var
|
|
57
|
-
onChange(e,
|
|
58
|
-
|
|
56
|
+
var _a = e.target || {}, _b = _a.value, inputValue = _b === void 0 ? '' : _b, _c = _a.checked, inputChecked = _c === void 0 ? false : _c;
|
|
57
|
+
onChange(e, {
|
|
58
|
+
value: inputValue,
|
|
59
|
+
checked: inputChecked
|
|
60
|
+
});
|
|
61
|
+
setChecked(inputChecked);
|
|
59
62
|
};
|
|
60
63
|
return (react_1.default.createElement("span", { className: "switch" },
|
|
61
64
|
react_1.default.createElement("input", __assign({}, rest, { className: classnames_1.default('switch__control', className), id: id, role: "switch", type: "checkbox", value: value, "aria-checked": isChecked, checked: isChecked, name: name, onChange: handleChange })),
|
package/ebay-tabs/README.md
CHANGED
|
@@ -28,15 +28,17 @@ import '@ebay/skin/tabs';
|
|
|
28
28
|
|
|
29
29
|
Name | Type | Stateful | Description
|
|
30
30
|
--- | --- | --- | ---
|
|
31
|
-
`index` |Number | Yes | 0-based index of selected tab heading and panel
|
|
31
|
+
`index` |Number | Yes | Deprecated, use `selectedIndex` instead. 0-based index of selected tab heading and panel
|
|
32
|
+
`selectedIndex` |Number | Yes | 0-based index of selected tab heading and panel
|
|
32
33
|
`activation` | Enum | Yes | whether to use automatic or manual activation when navigating by keyboard, can be `auto` (default) or `manual`
|
|
33
34
|
`size` | Enum | No | Whether to opt into larger font-size for tab headings, can be `medium` (default) or `large`
|
|
34
35
|
|
|
35
36
|
## Callbacks
|
|
36
37
|
|
|
37
|
-
Event
|
|
38
|
-
|
|
39
|
-
`onTabSelect` | `{ index }` |
|
|
38
|
+
| Event | Data | Description |
|
|
39
|
+
|---------------|-------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
|
40
|
+
| `onTabSelect` | `({ index: number })` | Triggered on tab selected. Deprecated, use onSelect instead. Will be removed in the next major release. |
|
|
41
|
+
| `onSelect` | `(ChangeEvent, { selectedIndex:number })` | Triggered on tab selected. |
|
|
40
42
|
|
|
41
43
|
## EbayTab
|
|
42
44
|
|
|
@@ -44,12 +46,6 @@ Event | Data | Description
|
|
|
44
46
|
<EbayTab>Tab 1</EbayTab>
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
### EbayTab Props
|
|
48
|
-
|
|
49
|
-
Name | Type | Stateful | Description
|
|
50
|
-
--- | --- | --- | ---
|
|
51
|
-
`href` | String | No | For use with `fake` tab component (links instead of real tabs)
|
|
52
|
-
|
|
53
49
|
## EbayTabPanel
|
|
54
50
|
```jsx harmony
|
|
55
51
|
<EbayTabPanel>Panel 1</EbayTabPanel>
|
package/ebay-tabs/tab-panel.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-panel.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tab-panel.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAGjD,aAAK,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"tab-panel.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tab-panel.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAGjD,aAAK,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAoB/B,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
package/ebay-tabs/tab-panel.js
CHANGED
|
@@ -28,8 +28,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
28
28
|
var react_1 = __importDefault(require("react"));
|
|
29
29
|
var classnames_1 = __importDefault(require("classnames"));
|
|
30
30
|
var TabPanel = function (_a) {
|
|
31
|
-
var children = _a.children, index = _a.index, parentId = _a.parentId, selected = _a.selected,
|
|
32
|
-
return
|
|
31
|
+
var children = _a.children, index = _a.index, parentId = _a.parentId, selected = _a.selected, className = _a.className, rest = __rest(_a, ["children", "index", "parentId", "selected", "className"]);
|
|
32
|
+
return (react_1.default.createElement("div", __assign({}, rest, { "aria-labelledby": "default-tab-" + index, className: classnames_1.default(className, 'tabs__panel'), id: (parentId || 'default') + "-tabpanel-" + index, role: "tabpanel", hidden: !selected }),
|
|
33
33
|
react_1.default.createElement("div", { className: "tabs__cell" }, children)));
|
|
34
34
|
};
|
|
35
35
|
exports.default = TabPanel;
|
package/ebay-tabs/tab.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { ComponentProps, FC, RefCallback } from 'react';
|
|
2
|
-
declare type TabProps = ComponentProps<'
|
|
2
|
+
declare type TabProps = ComponentProps<'div'> & {
|
|
3
3
|
index?: number;
|
|
4
4
|
parentId?: string;
|
|
5
5
|
selected?: boolean;
|
|
6
6
|
focused?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use EbayFakeTabs instead
|
|
9
|
-
*/
|
|
10
|
-
href?: string;
|
|
11
|
-
onClick?: () => void;
|
|
12
|
-
onKeyDown?: () => void;
|
|
13
7
|
refCallback?: RefCallback<HTMLElement>;
|
|
14
8
|
};
|
|
15
9
|
declare const Tab: FC<TabProps>;
|
package/ebay-tabs/tab.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tab.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAG9D,aAAK,QAAQ,GAAG,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tab.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAG9D,aAAK,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CAC1C,CAAA;AAED,QAAA,MAAM,GAAG,EAAE,EAAE,CAAC,QAAQ,CAwBrB,CAAA;AAED,eAAe,GAAG,CAAA"}
|
package/ebay-tabs/tab.js
CHANGED
|
@@ -28,13 +28,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
28
28
|
var react_1 = __importDefault(require("react"));
|
|
29
29
|
var classnames_1 = __importDefault(require("classnames"));
|
|
30
30
|
var Tab = function (_a) {
|
|
31
|
-
var children = _a.children, index = _a.index, parentId = _a.parentId, selected = _a.selected, focused = _a.focused,
|
|
32
|
-
|
|
33
|
-
* @deprecated Use EbayFakeTabs instead
|
|
34
|
-
*/
|
|
35
|
-
href = _a.href, className = _a.className, refCallback = _a.refCallback, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, _c = _a.onKeyDown, onKeyDown = _c === void 0 ? function () { } : _c, rest = __rest(_a, ["children", "index", "parentId", "selected", "focused", "href", "className", "refCallback", "onClick", "onKeyDown"]);
|
|
36
|
-
return href ? (react_1.default.createElement("li", __assign({}, rest, { className: classnames_1.default(className, 'fake-tabs__item', { 'fake-tabs__item--current': selected }) }),
|
|
37
|
-
react_1.default.createElement("a", { href: href, "aria-current": selected ? "page" : null }, children))) : (react_1.default.createElement("div", __assign({}, rest, { ref: refCallback, "aria-controls": (parentId || 'default') + "-tabpanel-" + index, "aria-selected": selected, className: classnames_1.default(className, 'tabs__item'), id: (parentId || 'default') + "-tab-" + index, role: "tab", tabIndex: focused ? 0 : -1, onClick: onClick, onKeyDown: onKeyDown }),
|
|
31
|
+
var children = _a.children, index = _a.index, parentId = _a.parentId, selected = _a.selected, focused = _a.focused, className = _a.className, refCallback = _a.refCallback, rest = __rest(_a, ["children", "index", "parentId", "selected", "focused", "className", "refCallback"]);
|
|
32
|
+
return (react_1.default.createElement("div", __assign({}, rest, { ref: refCallback, "aria-controls": (parentId || 'default') + "-tabpanel-" + index, "aria-selected": selected, className: classnames_1.default(className, 'tabs__item'), id: (parentId || 'default') + "-tab-" + index, role: "tab", tabIndex: focused ? 0 : -1 }),
|
|
38
33
|
react_1.default.createElement("span", null, children)));
|
|
39
34
|
};
|
|
40
35
|
exports.default = Tab;
|
package/ebay-tabs/tabs.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { ComponentProps, FC } from 'react';
|
|
2
2
|
import { Activation, Size } from './types';
|
|
3
|
-
declare type TabsProps = ComponentProps<'div'> & {
|
|
3
|
+
export declare type TabsProps = ComponentProps<'div'> & {
|
|
4
4
|
index?: number;
|
|
5
5
|
size?: Size;
|
|
6
6
|
activation?: Activation;
|
|
7
|
+
onSelect?: ({ selectedIndex: number }: {
|
|
8
|
+
selectedIndex: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use onSelect instead
|
|
12
|
+
*/
|
|
7
13
|
onTabSelect?: (index: number) => void;
|
|
8
14
|
};
|
|
9
15
|
declare const Tabs: FC<TabsProps>;
|
package/ebay-tabs/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,cAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,cAAc,EAAE,EAAE,EAAsC,MAAM,OAAO,CAAA;AAKnG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAI1C,oBAAY,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE;;KAAA,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA4FvB,CAAA;AAED,eAAe,IAAI,CAAA"}
|
package/ebay-tabs/tabs.js
CHANGED
|
@@ -36,15 +36,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
var react_1 = __importStar(require("react"));
|
|
37
37
|
var classnames_1 = __importDefault(require("classnames"));
|
|
38
38
|
var event_utils_1 = require("../common/event-utils");
|
|
39
|
+
var component_utils_1 = require("../common/component-utils");
|
|
39
40
|
var tab_1 = __importDefault(require("./tab"));
|
|
40
41
|
var tab_panel_1 = __importDefault(require("./tab-panel"));
|
|
41
|
-
var component_utils_1 = require("../common/component-utils");
|
|
42
42
|
var Tabs = function (_a) {
|
|
43
|
-
var id = _a.id, className = _a.className, _b = _a.index, index = _b === void 0 ? 0 : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, _d = _a.activation, activation = _d === void 0 ? 'auto' : _d, _e = _a.
|
|
43
|
+
var id = _a.id, className = _a.className, _b = _a.index, index = _b === void 0 ? 0 : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, _d = _a.activation, activation = _d === void 0 ? 'auto' : _d, _e = _a.onSelect, onSelect = _e === void 0 ? function () { } : _e, _f = _a.onTabSelect, onTabSelect = _f === void 0 ? function () { } : _f, children = _a.children;
|
|
44
44
|
var headings = [];
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
45
|
+
var _g = react_1.useState(index), selectedIndex = _g[0], setSelectedIndex = _g[1];
|
|
46
|
+
var _h = react_1.useState(index), focusedIndex = _h[0], setFocusedIndex = _h[1];
|
|
47
|
+
var handleSelect = function (i) {
|
|
48
|
+
onSelect({ selectedIndex: i });
|
|
48
49
|
onTabSelect(i);
|
|
49
50
|
setSelectedIndex(i);
|
|
50
51
|
};
|
|
@@ -56,7 +57,7 @@ var Tabs = function (_a) {
|
|
|
56
57
|
event_utils_1.handleActionKeydown(ev, function () {
|
|
57
58
|
ev.preventDefault();
|
|
58
59
|
if (activation === 'manual') {
|
|
59
|
-
|
|
60
|
+
handleSelect(i);
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
event_utils_1.handleLeftRightArrowsKeydown(ev, function () {
|
|
@@ -69,38 +70,30 @@ var Tabs = function (_a) {
|
|
|
69
70
|
setFocusedIndex(nextIndex);
|
|
70
71
|
(_a = headings[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
71
72
|
if (activation !== 'manual') {
|
|
72
|
-
|
|
73
|
+
handleSelect(nextIndex);
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
};
|
|
76
77
|
react_1.useEffect(function () {
|
|
77
|
-
|
|
78
|
+
handleSelect(index);
|
|
78
79
|
}, [index]);
|
|
79
|
-
var isFake = component_utils_1.filterBy(children, function (_a) {
|
|
80
|
-
var type = _a.type, props = _a.props;
|
|
81
|
-
return type === tab_1.default && props.href;
|
|
82
|
-
}).length > 0;
|
|
83
80
|
var isLarge = size === 'large';
|
|
84
81
|
var tabHeadings = component_utils_1.filterByType(children, tab_1.default).map(function (item, i) {
|
|
85
82
|
return react_1.cloneElement(item, __assign(__assign({}, item.props), { refCallback: function (ref) { headings[i] = ref; }, index: i, parentId: id, selected: selectedIndex === i, focused: focusedIndex === i, onClick: function () {
|
|
86
|
-
|
|
83
|
+
handleSelect(i);
|
|
87
84
|
setFocusedIndex(i);
|
|
88
85
|
}, onKeyDown: function (e) { onKeyDown(e, i); } }));
|
|
89
86
|
});
|
|
90
87
|
var tabPanels = component_utils_1.filterByType(children, tab_panel_1.default).map(function (item, i) {
|
|
91
|
-
var content = item.props.children;
|
|
92
88
|
var itemProps = {
|
|
93
89
|
index: i,
|
|
94
90
|
parentId: id,
|
|
95
91
|
selected: selectedIndex === i,
|
|
96
|
-
|
|
97
|
-
children: content
|
|
92
|
+
children: item.props.children
|
|
98
93
|
};
|
|
99
94
|
return react_1.cloneElement(item, itemProps);
|
|
100
95
|
});
|
|
101
|
-
return
|
|
102
|
-
react_1.default.createElement("ul", { className: classnames_1.default('fake-tabs__items', { 'fake-tabs__items--large': isLarge }) }, tabHeadings),
|
|
103
|
-
react_1.default.createElement("div", { className: "fake-tabs__content" }, tabPanels))) : (react_1.default.createElement("div", { id: id, className: classnames_1.default(className, 'tabs') },
|
|
96
|
+
return (react_1.default.createElement("div", { id: id, className: classnames_1.default(className, 'tabs') },
|
|
104
97
|
react_1.default.createElement("div", { className: classnames_1.default('tabs__items', { 'tabs__items--large': isLarge }), role: "tablist" }, tabHeadings),
|
|
105
98
|
react_1.default.createElement("div", { className: "tabs__content" }, tabPanels)));
|
|
106
99
|
};
|