@ebay/ui-core-react 6.2.1 → 6.3.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 +11 -13
- package/common/component-utils/forwardRef.js +4 -17
- package/common/component-utils/usePrevious.js +3 -3
- package/common/component-utils/utils.js +13 -26
- package/common/debounce.js +3 -7
- package/common/event-utils/index.js +8 -11
- package/common/event-utils/use-key-press.js +10 -12
- package/common/event-utils/use-roving-index.js +13 -24
- package/common/floating-label-utils/hooks.js +43 -53
- package/common/notice-utils/notice-content.js +5 -6
- package/common/notice-utils/notice-cta.js +5 -16
- package/common/notice-utils/notice-footer.js +5 -16
- package/common/notice-utils/notice-title.js +6 -17
- package/common/random-id.js +1 -1
- package/common/range.js +1 -4
- package/common/tooltip-utils/tooltip-close-button.js +1 -1
- package/common/tooltip-utils/tooltip-content.js +16 -28
- package/common/tooltip-utils/tooltip-footer.js +3 -6
- package/common/tooltip-utils/tooltip-host.js +5 -16
- package/common/tooltip-utils/tooltip.d.ts +1 -1
- package/common/tooltip-utils/tooltip.js +14 -26
- package/common/tooltip-utils/use-tooltip.js +8 -9
- package/ebay-alert-dialog/alert-dialog.js +11 -22
- package/ebay-badge/badge.js +6 -17
- package/ebay-breadcrumbs/breadcrumb-item.js +7 -18
- package/ebay-breadcrumbs/breadcrumbs.js +19 -30
- package/ebay-button/button-cell.js +5 -16
- package/ebay-button/button-expand.d.ts +4 -2
- package/ebay-button/button-expand.d.ts.map +1 -1
- package/ebay-button/button-expand.js +7 -10
- package/ebay-button/button-loading.js +5 -5
- package/ebay-button/button-text.js +3 -6
- package/ebay-button/button.d.ts +1 -1
- package/ebay-button/button.js +31 -43
- package/ebay-calendar/calendar.js +94 -111
- package/ebay-calendar/date-utils.js +9 -18
- package/ebay-carousel/carousel-control-button.js +9 -10
- package/ebay-carousel/carousel-item.d.ts +1 -1
- package/ebay-carousel/carousel-item.js +14 -25
- package/ebay-carousel/carousel-list.js +21 -22
- package/ebay-carousel/carousel.js +32 -44
- package/ebay-carousel/helpers.js +35 -47
- package/ebay-carousel/scroll-to-transition.js +15 -15
- package/ebay-checkbox/checkbox.js +21 -32
- package/ebay-confirm-dialog/confirm-dialog.js +11 -22
- package/ebay-cta-button/cta-button.d.ts +1 -1
- package/ebay-cta-button/cta-button.js +9 -20
- package/ebay-date-textbox/date-textbox.js +37 -53
- package/ebay-dialog-base/components/animation.d.ts +0 -1
- package/ebay-dialog-base/components/animation.d.ts.map +1 -1
- package/ebay-dialog-base/components/animation.js +25 -28
- package/ebay-dialog-base/components/dialog-actions.js +2 -5
- package/ebay-dialog-base/components/dialog-close-button.d.ts +5 -2
- package/ebay-dialog-base/components/dialog-close-button.d.ts.map +1 -1
- package/ebay-dialog-base/components/dialog-close-button.js +2 -5
- package/ebay-dialog-base/components/dialog-footer.js +2 -5
- package/ebay-dialog-base/components/dialog-header.js +4 -15
- package/ebay-dialog-base/components/dialog-previous-button.js +6 -17
- package/ebay-dialog-base/components/dialogBase.js +40 -51
- package/ebay-dialog-base/dialog-base-with-state.js +22 -35
- package/ebay-drawer-dialog/components/drawer.js +27 -50
- package/ebay-eek/eek-rating.js +8 -10
- package/ebay-eek/eek-util.d.ts +1 -1
- package/ebay-eek/eek-util.d.ts.map +1 -1
- package/ebay-eek/eek-util.js +7 -6
- package/ebay-fake-menu/menu-item-separator.js +5 -16
- package/ebay-fake-menu/menu-item.js +15 -26
- package/ebay-fake-menu/menu.js +11 -22
- package/ebay-fake-menu-button/menu-button-item.js +2 -2
- package/ebay-fake-menu-button/menu-button-label.d.ts +4 -2
- package/ebay-fake-menu-button/menu-button-label.d.ts.map +1 -1
- package/ebay-fake-menu-button/menu-button-label.js +2 -5
- package/ebay-fake-menu-button/menu-button-separator.js +5 -16
- package/ebay-fake-menu-button/menu-button.js +32 -45
- package/ebay-fake-tabs/fake-tabs.js +10 -23
- package/ebay-fake-tabs/tab.js +5 -16
- package/ebay-field/description.js +7 -19
- package/ebay-field/field.js +4 -5
- package/ebay-field/label.js +7 -18
- package/ebay-fullscreen-dialog/fullscreen-dialog.js +7 -18
- package/ebay-icon/icon.d.ts +1 -1
- package/ebay-icon/icon.js +17 -29
- package/ebay-icon-button/icon-button.d.ts +1 -1
- package/ebay-icon-button/icon-button.js +15 -27
- package/ebay-infotip/ebay-infotip-content.js +2 -5
- package/ebay-infotip/ebay-infotip-heading.js +5 -16
- package/ebay-infotip/ebay-infotip-host.d.ts +2 -2
- package/ebay-infotip/ebay-infotip-host.d.ts.map +1 -1
- package/ebay-infotip/ebay-infotip-host.js +10 -24
- package/ebay-infotip/ebay-infotip.d.ts.map +1 -1
- package/ebay-infotip/ebay-infotip.js +23 -34
- package/ebay-inline-notice/inline-notice.js +15 -27
- package/ebay-lightbox-dialog/lightbox-dialog.js +9 -21
- package/ebay-listbox-button/listbox-button-option.js +7 -18
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/ebay-listbox-button/listbox-button.js +79 -100
- package/ebay-menu/menu-item-separator.js +5 -16
- package/ebay-menu/menu-item.js +12 -23
- package/ebay-menu/menu.d.ts +1 -1
- package/ebay-menu/menu.js +37 -64
- package/ebay-menu-button/README.md +1 -1
- package/ebay-menu-button/menu-button-item.js +1 -1
- package/ebay-menu-button/menu-button-label.d.ts +4 -2
- package/ebay-menu-button/menu-button-label.d.ts.map +1 -1
- package/ebay-menu-button/menu-button-label.js +2 -5
- package/ebay-menu-button/menu-button-separator.js +5 -16
- package/ebay-menu-button/menu-button.js +46 -60
- package/ebay-notice-base/components/ebay-notice-content/notice-content.js +1 -1
- package/ebay-notice-base/components/ebay-notice-title/notice-title.d.ts +5 -2
- package/ebay-notice-base/components/ebay-notice-title/notice-title.d.ts.map +1 -1
- package/ebay-notice-base/components/ebay-notice-title/notice-title.js +2 -5
- package/ebay-page-notice/page-notice-cta.js +3 -6
- package/ebay-page-notice/page-notice-footer.js +3 -6
- package/ebay-page-notice/page-notice-title.js +5 -16
- package/ebay-page-notice/page-notice.js +16 -27
- package/ebay-pagination/helpers.js +21 -24
- package/ebay-pagination/pagination-item.d.ts +1 -1
- package/ebay-pagination/pagination-item.js +16 -27
- package/ebay-pagination/pagination.js +52 -81
- package/ebay-panel-dialog/panel-dialog.js +9 -21
- package/ebay-progress-bar/progress-bar.js +5 -16
- package/ebay-progress-spinner/progress-spinner.js +7 -18
- package/ebay-progress-stepper/ebay-progress-step.js +14 -25
- package/ebay-progress-stepper/ebay-progress-stepper.js +10 -21
- package/ebay-progress-stepper/ebay-progress-title.js +2 -5
- package/ebay-radio/radio.js +18 -29
- package/ebay-section-notice/section-notice-footer.js +3 -6
- package/ebay-section-notice/section-notice-title.js +5 -16
- package/ebay-section-notice/section-notice.js +24 -39
- package/ebay-section-title/cta.js +5 -16
- package/ebay-section-title/info.js +5 -16
- package/ebay-section-title/overflow.js +5 -16
- package/ebay-section-title/section-title.js +13 -24
- package/ebay-section-title/subtitle.js +5 -16
- package/ebay-section-title/title.js +5 -16
- package/ebay-select/ebay-select-option.js +4 -15
- package/ebay-select/ebay-select.d.ts +1 -1
- package/ebay-select/ebay-select.js +34 -45
- package/ebay-signal/signal.js +6 -17
- package/ebay-snackbar-dialog/components/ebay-snackbar-dialog-action.js +5 -16
- package/ebay-snackbar-dialog/components/ebay-snackbar-dialog.js +27 -38
- package/ebay-split-button/split-button.js +10 -21
- package/ebay-star-rating/star-rating.js +8 -19
- package/ebay-star-rating-select/star-rating-select.js +20 -31
- package/ebay-svg/svg.js +3 -3
- package/ebay-switch/ebay-switch.js +10 -21
- package/ebay-tabs/tab-panel.js +5 -16
- package/ebay-tabs/tab.js +5 -16
- package/ebay-tabs/tabs.js +26 -40
- package/ebay-textbox/postfix-icon.js +7 -18
- package/ebay-textbox/prefix-icon.js +5 -16
- package/ebay-textbox/textbox.d.ts +1 -1
- package/ebay-textbox/textbox.js +42 -53
- package/ebay-toast-dialog/components/toast.js +6 -17
- package/ebay-tooltip/ebay-tooltip-content.js +1 -1
- package/ebay-tooltip/ebay-tooltip-host.js +1 -1
- package/ebay-tooltip/ebay-tooltip.js +21 -32
- package/ebay-tourtip/ebay-tourtip-content.js +1 -1
- package/ebay-tourtip/ebay-tourtip-footer.js +4 -7
- package/ebay-tourtip/ebay-tourtip-heading.js +6 -17
- package/ebay-tourtip/ebay-tourtip-host.js +1 -1
- package/ebay-tourtip/ebay-tourtip.js +22 -33
- package/ebay-video/controls.d.ts.map +1 -1
- package/ebay-video/controls.js +23 -46
- package/ebay-video/reportButton.d.ts +7 -2
- package/ebay-video/reportButton.d.ts.map +1 -1
- package/ebay-video/reportButton.js +5 -8
- package/ebay-video/source.js +3 -14
- package/ebay-video/video.d.ts.map +1 -1
- package/ebay-video/video.js +54 -80
- package/package.json +23 -18
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -48,18 +37,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
48
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
38
|
};
|
|
50
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
42
|
+
const ebay_select_option_1 = __importDefault(require("./ebay-select-option"));
|
|
43
|
+
const ebay_icon_1 = require("../ebay-icon");
|
|
44
|
+
const component_utils_1 = require("../common/component-utils");
|
|
45
|
+
const hooks_1 = require("../common/floating-label-utils/hooks");
|
|
46
|
+
const isControlled = value => typeof value !== 'undefined';
|
|
47
|
+
const EbaySelect = (_a) => {
|
|
48
|
+
var { value: controlledValue, defaultValue, className, borderless, name, disabled, onChange = () => { }, onBlur = () => { }, onFocus = () => { }, floatingLabel, forwardedRef, children, inputSize, invalid } = _a, rest = __rest(_a, ["value", "defaultValue", "className", "borderless", "name", "disabled", "onChange", "onBlur", "onFocus", "floatingLabel", "forwardedRef", "children", "inputSize", "invalid"]);
|
|
49
|
+
const isFieldInvalid = invalid || rest['aria-invalid'] === 'true';
|
|
50
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
51
|
+
const { label, Container, onBlur: onFloatingLabelBlur, onFocus: onFloatingLabelFocus, ref } = (0, hooks_1.useFloatingLabel)({
|
|
63
52
|
ref: forwardedRef,
|
|
64
53
|
inputId: rest.id,
|
|
65
54
|
className: className,
|
|
@@ -68,37 +57,37 @@ var EbaySelect = function (_a) {
|
|
|
68
57
|
inputValue: controlledValue,
|
|
69
58
|
inputSize: inputSize,
|
|
70
59
|
invalid: isFieldInvalid
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
});
|
|
61
|
+
const handleSelectChange = (e) => {
|
|
62
|
+
const { value: newValue, selectedIndex } = e.target;
|
|
74
63
|
if (!isControlled(controlledValue)) {
|
|
75
64
|
setValue(newValue);
|
|
76
65
|
}
|
|
77
66
|
onChange(e, { index: selectedIndex, selected: [newValue] });
|
|
78
67
|
};
|
|
79
|
-
|
|
68
|
+
const handleBlur = (event) => {
|
|
80
69
|
onBlur(event);
|
|
81
70
|
onFloatingLabelBlur();
|
|
82
71
|
};
|
|
83
|
-
|
|
72
|
+
const handleFocus = (event) => {
|
|
84
73
|
onFocus(event);
|
|
85
74
|
onFloatingLabelFocus();
|
|
86
75
|
};
|
|
87
|
-
|
|
76
|
+
const selectClassName = (0, classnames_1.default)('select', className, {
|
|
88
77
|
'select--borderless': borderless,
|
|
89
|
-
'select--large': inputSize ===
|
|
78
|
+
'select--large': inputSize === `large`
|
|
90
79
|
});
|
|
91
80
|
return (react_1.default.createElement(Container, null,
|
|
92
81
|
label,
|
|
93
82
|
react_1.default.createElement("span", { className: selectClassName },
|
|
94
|
-
react_1.default.createElement("select",
|
|
83
|
+
react_1.default.createElement("select", Object.assign({}, rest, { name: name, value: isControlled(controlledValue) ? controlledValue : value, disabled: disabled, onChange: handleSelectChange, onBlur: handleBlur, onFocus: handleFocus, ref: ref }), options(children)),
|
|
95
84
|
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "chevronDown12", height: "8", width: "8" }))));
|
|
96
85
|
};
|
|
97
86
|
exports.default = (0, component_utils_1.withForwardRef)(EbaySelect);
|
|
98
87
|
function optionGroups(data) {
|
|
99
|
-
|
|
100
|
-
data.forEach(
|
|
101
|
-
|
|
88
|
+
const optGroups = {};
|
|
89
|
+
data.forEach(opt => {
|
|
90
|
+
const option = opt.props;
|
|
102
91
|
if (option.optgroup) {
|
|
103
92
|
if (!Object.prototype.hasOwnProperty.call(optGroups, option.optgroup)) {
|
|
104
93
|
optGroups[option.optgroup] = [];
|
|
@@ -109,21 +98,21 @@ function optionGroups(data) {
|
|
|
109
98
|
return optGroups;
|
|
110
99
|
}
|
|
111
100
|
function options(children) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
const renderedGroups = [];
|
|
102
|
+
const allOptions = [];
|
|
103
|
+
let optGroups = {};
|
|
104
|
+
let withinGroup = false;
|
|
105
|
+
const childrenOpts = (0, component_utils_1.filterByType)(children, ebay_select_option_1.default).map(c => (0, react_1.cloneElement)(c, {}));
|
|
117
106
|
if (childrenOpts) {
|
|
118
107
|
optGroups = optionGroups(childrenOpts);
|
|
119
|
-
|
|
120
|
-
childrenOpts.forEach(
|
|
121
|
-
|
|
108
|
+
let currentGroupName;
|
|
109
|
+
childrenOpts.forEach((option, idx) => {
|
|
110
|
+
const { value, optionClassName, children: optionChildren, optgroup } = option.props;
|
|
122
111
|
withinGroup = optgroup && renderedGroups.indexOf(optgroup) === -1;
|
|
123
112
|
if (withinGroup) { // This will always be true when the very first group is encountered.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
113
|
+
currentGroupName = optgroup;
|
|
114
|
+
const currentGroupOptions = optGroups[currentGroupName];
|
|
115
|
+
const opts = currentGroupOptions.map((groupOption) => (react_1.default.createElement(ebay_select_option_1.default, { key: `opt-${groupOption.value}`, value: groupOption.value, className: groupOption.optionClassName }, groupOption.children)));
|
|
127
116
|
allOptions.push(react_1.default.createElement("optgroup", { key: idx, label: optgroup }, opts));
|
|
128
117
|
renderedGroups.push(optgroup);
|
|
129
118
|
}
|
package/ebay-signal/signal.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
3
|
var t = {};
|
|
15
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,11 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
15
|
};
|
|
27
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
return react_1.default.createElement("span",
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
+
const EbaySignal = (_a) => {
|
|
20
|
+
var { status = 'neutral' } = _a, rest = __rest(_a, ["status"]);
|
|
21
|
+
const className = (0, classnames_1.default)(`signal signal--${status}`, rest.className);
|
|
22
|
+
return react_1.default.createElement("span", Object.assign({}, rest, { className: className }));
|
|
34
23
|
};
|
|
35
24
|
exports.default = EbaySignal;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
3
|
var t = {};
|
|
15
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -26,10 +15,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
15
|
};
|
|
27
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
17
|
exports.EbaySnackbarDialogAction = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
return (react_1.default.createElement("button",
|
|
18
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
+
const react_1 = __importDefault(require("react"));
|
|
20
|
+
const EbaySnackbarDialogAction = (_a) => {
|
|
21
|
+
var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
|
|
22
|
+
return (react_1.default.createElement("button", Object.assign({ className: (0, classnames_1.default)(className, 'fake-link') }, rest), children));
|
|
34
23
|
};
|
|
35
24
|
exports.EbaySnackbarDialogAction = EbaySnackbarDialogAction;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -49,74 +38,74 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
49
38
|
};
|
|
50
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
40
|
exports.EbaySnackbarDialog = void 0;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var
|
|
41
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
|
+
const ebay_dialog_base_1 = require("../../ebay-dialog-base");
|
|
44
|
+
const ebay_snackbar_dialog_action_1 = require("./ebay-snackbar-dialog-action");
|
|
45
|
+
const DEFAULT_TIMEOUT_LENGTH = 6000; // 6 seconds
|
|
46
|
+
const EbaySnackbarDialog = (_a) => {
|
|
47
|
+
var { className, onOpen = () => { }, onClose = () => { }, layout, open, children, onAction } = _a, rest = __rest(_a, ["className", "onOpen", "onClose", "layout", "open", "children", "onAction"]);
|
|
59
48
|
// We use this eventSet to track which event opened the snackbar and we make sure that
|
|
60
49
|
// we don't close the snackbar in an undesired moment.
|
|
61
50
|
// For example, the snackbar should stay open on focus even if the mouseLeave event happened.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
const eventSet = (0, react_1.useRef)(new Set());
|
|
52
|
+
const timeoutRef = (0, react_1.useRef)();
|
|
53
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(open);
|
|
54
|
+
const childrenArray = react_1.default.Children.toArray(children);
|
|
55
|
+
const action = childrenArray.find((child) => child.type === ebay_snackbar_dialog_action_1.EbaySnackbarDialogAction);
|
|
56
|
+
const content = childrenArray.filter((child) => child.type !== ebay_snackbar_dialog_action_1.EbaySnackbarDialogAction);
|
|
57
|
+
const cancelCurrentCloseRequest = () => {
|
|
69
58
|
clearTimeout(timeoutRef.current);
|
|
70
59
|
};
|
|
71
|
-
|
|
60
|
+
const closeDialog = () => {
|
|
72
61
|
setIsOpen(false);
|
|
73
62
|
onClose();
|
|
74
63
|
};
|
|
75
|
-
|
|
64
|
+
const requestToCloseDialog = () => {
|
|
76
65
|
// We will make a request to close the snackbar only
|
|
77
66
|
// when there is no pending opening event.
|
|
78
67
|
if (eventSet.current.size === 0) {
|
|
79
68
|
cancelCurrentCloseRequest();
|
|
80
|
-
timeoutRef.current = setTimeout(
|
|
69
|
+
timeoutRef.current = setTimeout(() => {
|
|
81
70
|
closeDialog();
|
|
82
71
|
}, DEFAULT_TIMEOUT_LENGTH);
|
|
83
72
|
}
|
|
84
73
|
};
|
|
85
|
-
|
|
74
|
+
const openDialog = () => {
|
|
86
75
|
setIsOpen(true);
|
|
87
76
|
onOpen();
|
|
88
77
|
requestToCloseDialog();
|
|
89
78
|
};
|
|
90
|
-
|
|
79
|
+
const handleFocus = () => {
|
|
91
80
|
cancelCurrentCloseRequest();
|
|
92
81
|
eventSet.current.add('focus');
|
|
93
82
|
};
|
|
94
|
-
|
|
83
|
+
const handleBlur = () => {
|
|
95
84
|
eventSet.current.delete('focus');
|
|
96
85
|
requestToCloseDialog();
|
|
97
86
|
};
|
|
98
|
-
|
|
87
|
+
const handleMouseEnter = () => {
|
|
99
88
|
cancelCurrentCloseRequest();
|
|
100
89
|
eventSet.current.add('mouseEnter');
|
|
101
90
|
};
|
|
102
|
-
|
|
91
|
+
const handleMouseLeave = () => {
|
|
103
92
|
eventSet.current.delete('mouseEnter');
|
|
104
93
|
requestToCloseDialog();
|
|
105
94
|
};
|
|
106
|
-
|
|
95
|
+
const handleAction = (event) => {
|
|
107
96
|
var _a, _b;
|
|
108
97
|
cancelCurrentCloseRequest();
|
|
109
98
|
onAction === null || onAction === void 0 ? void 0 : onAction(event);
|
|
110
99
|
(_b = (_a = action === null || action === void 0 ? void 0 : action.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
111
100
|
closeDialog();
|
|
112
101
|
};
|
|
113
|
-
(0, react_1.useEffect)(
|
|
102
|
+
(0, react_1.useEffect)(() => () => {
|
|
114
103
|
// On unmount of the component we
|
|
115
104
|
// cancel the close request
|
|
116
105
|
cancelCurrentCloseRequest();
|
|
117
|
-
}
|
|
106
|
+
}, []);
|
|
118
107
|
// This useEffect is to make sure that the internal state is in sync with the "open" property.
|
|
119
|
-
(0, react_1.useEffect)(
|
|
108
|
+
(0, react_1.useEffect)(() => {
|
|
120
109
|
if (open) {
|
|
121
110
|
openDialog();
|
|
122
111
|
}
|
|
@@ -124,7 +113,7 @@ var EbaySnackbarDialog = function (_a) {
|
|
|
124
113
|
closeDialog();
|
|
125
114
|
}
|
|
126
115
|
}, [open]);
|
|
127
|
-
return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState,
|
|
116
|
+
return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState, Object.assign({}, rest, { open: isOpen, isModal: false, baseEl: "aside", classPrefix: "snackbar-dialog", transitionElement: "root", a11yCloseText: "", buttonPosition: "hidden", className: (0, classnames_1.default)(className, 'snackbar-dialog--transition'), windowClass: layout === 'column' && 'snackbar-dialog__window--column', onFocus: handleFocus, onBlur: handleBlur, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }),
|
|
128
117
|
content,
|
|
129
118
|
action ? (react_1.default.createElement(ebay_dialog_base_1.EbayDialogActions, null, react_1.default.cloneElement(action, {
|
|
130
119
|
onClick: handleAction
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
3
|
var t = {};
|
|
15
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,17 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
15
|
};
|
|
27
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const component_utils_1 = require("../common/component-utils");
|
|
19
|
+
const ebay_button_1 = require("../ebay-button");
|
|
20
|
+
const ebay_menu_button_1 = require("../ebay-menu-button");
|
|
21
|
+
const EbaySplitButton = (_a) => {
|
|
22
|
+
var { a11yMenuText, children, type, bodyState, a11yButtonLoadingText, onCollapse, onExpand, onSelect = () => { }, onChange = () => { }, ref } = _a, rest = __rest(_a, ["a11yMenuText", "children", "type", "bodyState", "a11yButtonLoadingText", "onCollapse", "onExpand", "onSelect", "onChange", "ref"]);
|
|
23
|
+
const menuItemComponents = [ebay_menu_button_1.EbayMenuButtonItem, ebay_menu_button_1.EbayMenuButtonSeparator];
|
|
24
|
+
const buttonLabel = (0, component_utils_1.filterBy)(children, el => !menuItemComponents.includes(el.type));
|
|
25
|
+
const menuItems = (0, component_utils_1.filterByType)(children, menuItemComponents);
|
|
37
26
|
return (react_1.default.createElement("span", { className: "split-button" },
|
|
38
|
-
react_1.default.createElement(ebay_button_1.EbayButton,
|
|
27
|
+
react_1.default.createElement(ebay_button_1.EbayButton, Object.assign({ "aria-label": bodyState === 'loading' ? a11yButtonLoadingText : undefined }, rest, { split: "start", bodyState: bodyState === 'expand' ? undefined : bodyState }), buttonLabel),
|
|
39
28
|
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
29
|
};
|
|
41
30
|
exports.default = EbaySplitButton;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
3
|
var t = {};
|
|
15
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,13 +14,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
15
|
};
|
|
27
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
return (react_1.default.createElement("div",
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
+
const ebay_icon_1 = require("../ebay-icon");
|
|
20
|
+
const range_1 = require("../common/range");
|
|
21
|
+
const stars = (0, range_1.range)(1, 5);
|
|
22
|
+
const EbayStarRating = (_a) => {
|
|
23
|
+
var { value, a11yText, className } = _a, rest = __rest(_a, ["value", "a11yText", "className"]);
|
|
24
|
+
return (react_1.default.createElement("div", Object.assign({ role: "img", "aria-label": a11yText, className: (0, classnames_1.default)('star-rating', className), "data-stars": value }, rest), stars.map((i) => (react_1.default.createElement(ebay_icon_1.EbayIcon, { key: i, className: "star-rating__icon", name: "starDynamic" })))));
|
|
36
25
|
};
|
|
37
26
|
exports.default = EbayStarRating;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -48,46 +37,46 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
48
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
38
|
};
|
|
50
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
42
|
+
const ebay_icon_1 = require("../ebay-icon");
|
|
43
|
+
const range_1 = require("../common/range");
|
|
44
|
+
const random_id_1 = require("../common/random-id");
|
|
45
|
+
const stars = (0, range_1.range)(1, 5);
|
|
46
|
+
const getValue = (val) => {
|
|
47
|
+
let value = parseInt(val, 0) || 0;
|
|
59
48
|
if (value > 5) {
|
|
60
49
|
value = 0;
|
|
61
50
|
}
|
|
62
51
|
return value;
|
|
63
52
|
};
|
|
64
|
-
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
(0, react_1.useEffect)(
|
|
53
|
+
const EbayStarRatingSelect = (_a) => {
|
|
54
|
+
var { value = 0, a11yText, className, a11yStarText = [], disabled, onChange = () => { }, onFocus = () => { }, onKeyDown = () => { }, name = `star-rating-${(0, random_id_1.randomId)()}` } = _a, rest = __rest(_a, ["value", "a11yText", "className", "a11yStarText", "disabled", "onChange", "onFocus", "onKeyDown", "name"]);
|
|
55
|
+
const [checkedValue, setChecked] = (0, react_1.useState)(getValue(value));
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
68
57
|
setChecked(getValue(value));
|
|
69
58
|
}, [value]);
|
|
70
|
-
|
|
59
|
+
const handleKeyDown = (i) => (e) => {
|
|
71
60
|
if (!disabled) {
|
|
72
61
|
setChecked(getValue(i));
|
|
73
62
|
onKeyDown(e, { value: i });
|
|
74
63
|
}
|
|
75
|
-
};
|
|
76
|
-
|
|
64
|
+
};
|
|
65
|
+
const handleClick = (i) => (e) => {
|
|
77
66
|
if (!disabled) {
|
|
78
67
|
setChecked(getValue(i));
|
|
79
68
|
onChange(e, { value: i });
|
|
80
69
|
}
|
|
81
|
-
};
|
|
82
|
-
|
|
70
|
+
};
|
|
71
|
+
const handleFocus = (i) => (e) => {
|
|
83
72
|
if (!disabled) {
|
|
84
73
|
setChecked(getValue(i));
|
|
85
74
|
onFocus(e, { value: i });
|
|
86
75
|
}
|
|
87
|
-
};
|
|
88
|
-
return (react_1.default.createElement("div",
|
|
76
|
+
};
|
|
77
|
+
return (react_1.default.createElement("div", Object.assign({ role: a11yText && 'radiogroup', "aria-label": a11yText, className: (0, classnames_1.default)('star-rating-select', className) }, rest), stars.map((i) => (react_1.default.createElement("span", { className: "star-rating-select__radio", key: i },
|
|
89
78
|
react_1.default.createElement("input", { "aria-label": a11yStarText === null || a11yStarText === void 0 ? void 0 : a11yStarText[i - 1], className: (0, classnames_1.default)('star-rating-select__control', { 'star-rating-select__control--filled': i <= checkedValue }), type: "radio", name: name, value: i, disabled: disabled, defaultChecked: checkedValue === i, onClick: handleClick(i), onFocus: handleFocus(i), onKeyDown: handleKeyDown(i) }),
|
|
90
79
|
react_1.default.createElement("span", { className: "star-rating-select__radio-icon" },
|
|
91
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon, { className: "star-rating__icon", name: "starDynamic" }))))
|
|
80
|
+
react_1.default.createElement(ebay_icon_1.EbayIcon, { className: "star-rating__icon", name: "starDynamic" })))))));
|
|
92
81
|
};
|
|
93
82
|
exports.default = EbayStarRatingSelect;
|
package/ebay-svg/svg.js
CHANGED
|
@@ -6,8 +6,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const EbaySvg = () => (react_1.default.createElement("svg", { style: { position: 'absolute', height: '0px', width: '0px' } },
|
|
11
11
|
react_1.default.createElement("defs", null,
|
|
12
12
|
react_1.default.createElement("linearGradient", { id: "ref-ai-spectrum-16-colored", x1: "21.21", y1: "11.161", x2: "11.274", y2: "21.774", gradientUnits: "userSpaceOnUse" },
|
|
13
13
|
react_1.default.createElement("stop", { offset: ".098", stopColor: "#FFD80E" }),
|
|
@@ -2504,5 +2504,5 @@ var EbaySvg = function () { return (react_1.default.createElement("svg", { style
|
|
|
2504
2504
|
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M80 1.495c.272 0 .512.175.596.433l1.359 4.207h4.415a.625.625 0 0 1 .346 1.145l-3.55 2.364 1.366 4.036a.625.625 0 0 1-.953.71l-3.578-2.528-3.58 2.528a.625.625 0 0 1-.953-.71l1.366-4.035-3.56-2.364a.625.625 0 0 1 .346-1.146h4.434l1.352-4.206A.625.625 0 0 1 80 1.495Zm.003 2.663-1.037 3.227H75.69l2.635 1.75-1.058 3.127L80 10.332l2.731 1.93-1.058-3.126 2.63-1.75h-3.259l-1.042-3.228Z", fill: "#707070" }),
|
|
2505
2505
|
react_1.default.createElement("path", { d: "M79.406 1.929A.625.625 0 0 1 80 1.495v10.367l-3.58 2.528a.625.625 0 0 1-.952-.71l1.366-4.035-3.56-2.364a.625.625 0 0 1 .346-1.146h4.434l1.352-4.206Z", fill: "#191919" })),
|
|
2506
2506
|
react_1.default.createElement("symbol", { viewBox: "0 0 88 16", fill: "none", id: "star-rating-small-5" },
|
|
2507
|
-
react_1.default.createElement("path", { d: "M8.596 1.928a.625.625 0 0 0-1.19 0L6.055 6.136H1.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L8 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145H9.955l-1.36-4.207Zm18 0a.625.625 0 0 0-1.19 0l-1.351 4.207H19.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L26 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145h-4.415l-1.36-4.207Zm18 0a.625.625 0 0 0-1.19 0l-1.352 4.207H37.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L44 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145h-4.415l-1.36-4.207Zm18 0a.625.625 0 0 0-1.19 0l-1.352 4.207H55.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L62 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145h-4.415l-1.36-4.207Zm18 0a.625.625 0 0 0-1.19 0l-1.352 4.207H73.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L80 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145h-4.415l-1.36-4.207Z", fill: "#191919" }))));
|
|
2507
|
+
react_1.default.createElement("path", { d: "M8.596 1.928a.625.625 0 0 0-1.19 0L6.055 6.136H1.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L8 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145H9.955l-1.36-4.207Zm18 0a.625.625 0 0 0-1.19 0l-1.351 4.207H19.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L26 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145h-4.415l-1.36-4.207Zm18 0a.625.625 0 0 0-1.19 0l-1.352 4.207H37.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L44 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145h-4.415l-1.36-4.207Zm18 0a.625.625 0 0 0-1.19 0l-1.352 4.207H55.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L62 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145h-4.415l-1.36-4.207Zm18 0a.625.625 0 0 0-1.19 0l-1.352 4.207H73.62a.625.625 0 0 0-.346 1.146l3.56 2.364-1.366 4.035a.625.625 0 0 0 .953.71L80 11.862l3.578 2.528a.625.625 0 0 0 .953-.71l-1.366-4.036 3.55-2.364a.625.625 0 0 0-.346-1.145h-4.415l-1.36-4.207Z", fill: "#191919" }))));
|
|
2508
2508
|
exports.default = EbaySvg;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -48,17 +37,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
48
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
38
|
};
|
|
50
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
(0, react_1.useEffect)(
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
42
|
+
const isControlled = checked => typeof checked !== 'undefined';
|
|
43
|
+
const EbaySwitch = (_a) => {
|
|
44
|
+
var { id, value, name, className, checked, defaultChecked = false, onChange = () => { } } = _a, rest = __rest(_a, ["id", "value", "name", "className", "checked", "defaultChecked", "onChange"]);
|
|
45
|
+
const [isChecked, setChecked] = (0, react_1.useState)(defaultChecked);
|
|
46
|
+
(0, react_1.useEffect)(() => {
|
|
58
47
|
setChecked(!!checked);
|
|
59
48
|
}, [checked]);
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
const handleChange = (e) => {
|
|
50
|
+
const { value: inputValue = '', checked: inputChecked = false } = e.target || {};
|
|
62
51
|
onChange(e, {
|
|
63
52
|
value: inputValue,
|
|
64
53
|
checked: inputChecked
|
|
@@ -66,7 +55,7 @@ var EbaySwitch = function (_a) {
|
|
|
66
55
|
setChecked(inputChecked);
|
|
67
56
|
};
|
|
68
57
|
return (react_1.default.createElement("span", { className: "switch" },
|
|
69
|
-
react_1.default.createElement("input",
|
|
58
|
+
react_1.default.createElement("input", Object.assign({}, rest, { className: (0, classnames_1.default)('switch__control', className), id: id, role: "switch", type: "checkbox", value: value, "aria-checked": isControlled(checked) ? checked : isChecked, checked: isControlled(checked) ? checked : isChecked, name: name, onChange: handleChange })),
|
|
70
59
|
react_1.default.createElement("span", { className: "switch__button" })));
|
|
71
60
|
};
|
|
72
61
|
exports.default = EbaySwitch;
|
package/ebay-tabs/tab-panel.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
3
|
var t = {};
|
|
15
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,11 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
15
|
};
|
|
27
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
return (react_1.default.createElement("div",
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
+
const TabPanel = (_a) => {
|
|
20
|
+
var { children, index, parentId, selected, className } = _a, rest = __rest(_a, ["children", "index", "parentId", "selected", "className"]);
|
|
21
|
+
return (react_1.default.createElement("div", Object.assign({}, rest, { "aria-labelledby": `default-tab-${index}`, className: (0, classnames_1.default)(className, 'tabs__panel'), id: `${parentId || 'default'}-tabpanel-${index}`, role: "tabpanel", hidden: !selected }),
|
|
33
22
|
react_1.default.createElement("div", { className: "tabs__cell" }, children)));
|
|
34
23
|
};
|
|
35
24
|
exports.default = TabPanel;
|