@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
package/ebay-tabs/tab.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 Tab = (_a) => {
|
|
20
|
+
var { children, index, parentId, selected, focused, className, refCallback } = _a, rest = __rest(_a, ["children", "index", "parentId", "selected", "focused", "className", "refCallback"]);
|
|
21
|
+
return (react_1.default.createElement("div", Object.assign({}, rest, { ref: refCallback, "aria-controls": `${parentId || 'default'}-tabpanel-${index}`, "aria-selected": selected, className: (0, classnames_1.default)(className, 'tabs__item'), id: `${parentId || 'default'}-tab-${index}`, role: "tab", tabIndex: focused ? 0 : -1 }),
|
|
33
22
|
react_1.default.createElement("span", null, children)));
|
|
34
23
|
};
|
|
35
24
|
exports.default = Tab;
|
package/ebay-tabs/tabs.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 __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);
|
|
@@ -37,18 +26,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
27
|
};
|
|
39
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var handleSelect = function (i) {
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
31
|
+
const event_utils_1 = require("../common/event-utils");
|
|
32
|
+
const component_utils_1 = require("../common/component-utils");
|
|
33
|
+
const tab_1 = __importDefault(require("./tab"));
|
|
34
|
+
const tab_panel_1 = __importDefault(require("./tab-panel"));
|
|
35
|
+
const Tabs = ({ id, className, index = 0, size = 'medium', activation = 'auto', onSelect = () => { }, onTabSelect = () => { }, children }) => {
|
|
36
|
+
const headings = [];
|
|
37
|
+
const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(index);
|
|
38
|
+
const [focusedIndex, setFocusedIndex] = (0, react_1.useState)(index);
|
|
39
|
+
const handleSelect = (i) => {
|
|
52
40
|
onSelect({ selectedIndex: i });
|
|
53
41
|
onTabSelect(i);
|
|
54
42
|
setSelectedIndex(i);
|
|
@@ -57,20 +45,20 @@ var Tabs = function (_a) {
|
|
|
57
45
|
* Handle a11y for heading
|
|
58
46
|
* https://ebay.gitbooks.io/mindpatterns/content/disclosure/tabs.html
|
|
59
47
|
*/
|
|
60
|
-
|
|
61
|
-
(0, event_utils_1.handleActionKeydown)(ev,
|
|
48
|
+
const onKeyDown = (ev, i) => {
|
|
49
|
+
(0, event_utils_1.handleActionKeydown)(ev, () => {
|
|
62
50
|
ev.preventDefault();
|
|
63
51
|
if (activation === 'manual') {
|
|
64
52
|
handleSelect(i);
|
|
65
53
|
}
|
|
66
54
|
});
|
|
67
|
-
(0, event_utils_1.handleLeftRightArrowsKeydown)(ev,
|
|
55
|
+
(0, event_utils_1.handleLeftRightArrowsKeydown)(ev, () => {
|
|
68
56
|
var _a;
|
|
69
57
|
ev.preventDefault();
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
const len = (0, component_utils_1.filterByType)(children, tab_1.default).length;
|
|
59
|
+
const direction = ['Left', 'ArrowLeft'].includes(ev.key) ? -1 : 1;
|
|
60
|
+
const currentIndex = focusedIndex === undefined ? selectedIndex : focusedIndex;
|
|
61
|
+
const nextIndex = (currentIndex + len + direction) % len;
|
|
74
62
|
setFocusedIndex(nextIndex);
|
|
75
63
|
(_a = headings[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
76
64
|
if (activation !== 'manual') {
|
|
@@ -78,18 +66,16 @@ var Tabs = function (_a) {
|
|
|
78
66
|
}
|
|
79
67
|
});
|
|
80
68
|
};
|
|
81
|
-
(0, react_1.useEffect)(
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
82
70
|
handleSelect(index);
|
|
83
71
|
}, [index]);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var tabPanels = (0, component_utils_1.filterByType)(children, tab_panel_1.default).map(function (item, i) {
|
|
92
|
-
var itemProps = {
|
|
72
|
+
const isLarge = size === 'large';
|
|
73
|
+
const tabHeadings = (0, component_utils_1.filterByType)(children, tab_1.default).map((item, i) => (0, react_1.cloneElement)(item, Object.assign(Object.assign({}, item.props), { refCallback: ref => { headings[i] = ref; }, index: i, parentId: id, selected: selectedIndex === i, focused: focusedIndex === i, onClick: () => {
|
|
74
|
+
handleSelect(i);
|
|
75
|
+
setFocusedIndex(i);
|
|
76
|
+
}, onKeyDown: e => { onKeyDown(e, i); } })));
|
|
77
|
+
const tabPanels = (0, component_utils_1.filterByType)(children, tab_panel_1.default).map((item, i) => {
|
|
78
|
+
const itemProps = {
|
|
93
79
|
index: i,
|
|
94
80
|
parentId: id,
|
|
95
81
|
selected: selectedIndex === i,
|
|
@@ -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
|
-
var
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const ebay_icon_1 = require("../ebay-icon");
|
|
19
|
+
const ebay_icon_button_1 = require("../ebay-icon-button");
|
|
20
|
+
const EbayTextboxPostfixIcon = (_a) => {
|
|
21
|
+
var { name, buttonAriaLabel, onClick = () => { } } = _a, rest = __rest(_a, ["name", "buttonAriaLabel", "onClick"]);
|
|
33
22
|
return buttonAriaLabel ?
|
|
34
|
-
react_1.default.createElement(ebay_icon_button_1.EbayIconButton,
|
|
35
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon,
|
|
23
|
+
react_1.default.createElement(ebay_icon_button_1.EbayIconButton, Object.assign({ "aria-label": buttonAriaLabel, icon: name, transparent: true, onClick: onClick }, rest)) :
|
|
24
|
+
react_1.default.createElement(ebay_icon_1.EbayIcon, Object.assign({ name: name }, rest));
|
|
36
25
|
};
|
|
37
26
|
exports.default = EbayTextboxPostfixIcon;
|
|
@@ -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,10 +14,10 @@ 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 name = _a
|
|
32
|
-
return (react_1.default.createElement(ebay_icon_1.EbayIcon,
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const ebay_icon_1 = require("../ebay-icon");
|
|
19
|
+
const EbayTextboxPrefixIcon = (_a) => {
|
|
20
|
+
var { name } = _a, rest = __rest(_a, ["name"]);
|
|
21
|
+
return (react_1.default.createElement(ebay_icon_1.EbayIcon, Object.assign({ name: name }, rest)));
|
|
33
22
|
};
|
|
34
23
|
exports.default = EbayTextboxPrefixIcon;
|
|
@@ -26,6 +26,6 @@ export type EbayTextboxProps = {
|
|
|
26
26
|
forwardedRef?: Ref<HTMLTextAreaElement | HTMLInputElement>;
|
|
27
27
|
opaqueLabel?: boolean;
|
|
28
28
|
} & Omit<TextInputProps, 'onFocus' | 'onBlur' | 'onChange' | 'onKeyPress' | 'onKeyUp' | 'onKeyDown' | 'onInvalid'>;
|
|
29
|
-
declare const _default: React.ForwardRefExoticComponent<
|
|
29
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<EbayTextboxProps, "ref"> & React.RefAttributes<React.FC<EbayTextboxProps>>>;
|
|
30
30
|
export default _default;
|
|
31
31
|
//# sourceMappingURL=textbox.d.ts.map
|
package/ebay-textbox/textbox.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 __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,39 +38,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
49
38
|
};
|
|
50
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
40
|
exports.isControlled = void 0;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
43
|
+
const component_utils_1 = require("../common/component-utils");
|
|
44
|
+
const index_1 = require("./index");
|
|
45
|
+
const hooks_1 = require("../common/floating-label-utils/hooks");
|
|
46
|
+
const isControlled = (value) => typeof value !== 'undefined';
|
|
58
47
|
exports.isControlled = isControlled;
|
|
59
|
-
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
const EbayTextbox = (_a) => {
|
|
49
|
+
var { type = 'text', invalid, fluid, multiline, onChange = () => { }, onInputChange = () => { }, onFocus = () => { }, onBlur = () => { }, onKeyPress = () => { }, onKeyUp = () => { }, onKeyDown = () => { }, onInvalid = () => { }, onFloatingLabelInit = () => { }, onButtonClick = () => { }, autoFocus, defaultValue = '', value: controlledValue, forwardedRef, inputSize = 'default', floatingLabel, children, placeholder, opaqueLabel } = _a, rest = __rest(_a, ["type", "invalid", "fluid", "multiline", "onChange", "onInputChange", "onFocus", "onBlur", "onKeyPress", "onKeyUp", "onKeyDown", "onInvalid", "onFloatingLabelInit", "onButtonClick", "autoFocus", "defaultValue", "value", "forwardedRef", "inputSize", "floatingLabel", "children", "placeholder", "opaqueLabel"]);
|
|
50
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
51
|
+
const [inputValue, setInputValue] = (0, react_1.useState)(defaultValue);
|
|
52
|
+
const { label, Container, onBlur: onFloatingLabelBlur, onFocus: onFloatingLabelFocus, ref, placeholder: floatingLabelPlaceholder } = (0, hooks_1.useFloatingLabel)({
|
|
64
53
|
ref: forwardedRef,
|
|
65
54
|
inputId: rest.id,
|
|
66
55
|
className: rest.className,
|
|
67
56
|
disabled: rest.disabled,
|
|
68
57
|
label: floatingLabel,
|
|
69
|
-
inputSize
|
|
58
|
+
inputSize,
|
|
70
59
|
inputValue: controlledValue || inputValue,
|
|
71
|
-
placeholder
|
|
72
|
-
invalid
|
|
73
|
-
type
|
|
74
|
-
opaqueLabel
|
|
60
|
+
placeholder,
|
|
61
|
+
invalid,
|
|
62
|
+
type,
|
|
63
|
+
opaqueLabel,
|
|
75
64
|
onMount: onFloatingLabelInit
|
|
76
|
-
})
|
|
77
|
-
|
|
65
|
+
});
|
|
66
|
+
const handleFocus = (event) => {
|
|
78
67
|
var _a;
|
|
79
68
|
onFocus(event, { value: ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) || defaultValue });
|
|
80
69
|
onFloatingLabelFocus();
|
|
81
70
|
};
|
|
82
|
-
|
|
71
|
+
const handleBlur = (event) => {
|
|
83
72
|
var _a;
|
|
84
|
-
|
|
73
|
+
const newValue = (_a = event.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
85
74
|
onBlur(event, { value: newValue });
|
|
86
75
|
if (newValue !== value) {
|
|
87
76
|
onChange(event, { value: newValue });
|
|
@@ -89,56 +78,56 @@ var EbayTextbox = function (_a) {
|
|
|
89
78
|
}
|
|
90
79
|
onFloatingLabelBlur();
|
|
91
80
|
};
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
const handleKeyPress = (event) => {
|
|
82
|
+
const textbox = event.target;
|
|
94
83
|
onKeyPress(event, { value: textbox === null || textbox === void 0 ? void 0 : textbox.value });
|
|
95
84
|
};
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
const handleKeyUp = (event) => {
|
|
86
|
+
const textbox = event.target;
|
|
98
87
|
onKeyUp(event, { value: textbox === null || textbox === void 0 ? void 0 : textbox.value });
|
|
99
88
|
};
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
const handleKeyDown = (event) => {
|
|
90
|
+
const textbox = event.target;
|
|
102
91
|
onKeyDown(event, { value: textbox === null || textbox === void 0 ? void 0 : textbox.value });
|
|
103
92
|
};
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
const handleInvalid = (event) => {
|
|
94
|
+
const textbox = event.target;
|
|
106
95
|
onInvalid(event, { value: textbox === null || textbox === void 0 ? void 0 : textbox.value });
|
|
107
96
|
};
|
|
108
|
-
|
|
109
|
-
onButtonClick(event, { value
|
|
97
|
+
const handleButtonClick = (event) => {
|
|
98
|
+
onButtonClick(event, { value });
|
|
110
99
|
};
|
|
111
|
-
(0, react_1.useEffect)(
|
|
100
|
+
(0, react_1.useEffect)(() => {
|
|
112
101
|
if (autoFocus) {
|
|
113
102
|
handleFocus();
|
|
114
103
|
}
|
|
115
104
|
}, []);
|
|
116
|
-
|
|
105
|
+
const handleInputChange = (e) => {
|
|
117
106
|
var _a;
|
|
118
|
-
|
|
107
|
+
const newValue = (_a = e.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
119
108
|
if (!(0, exports.isControlled)(controlledValue)) {
|
|
120
109
|
setInputValue(newValue);
|
|
121
110
|
}
|
|
122
111
|
onInputChange(e, { value: newValue });
|
|
123
112
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
const Input = multiline ? 'textarea' : 'input';
|
|
114
|
+
const Wrapper = fluid ? 'div' : 'span';
|
|
115
|
+
const prefixIcon = (0, component_utils_1.findComponent)(children, index_1.EbayTextboxPrefixIcon);
|
|
116
|
+
const postfixIcon = (0, component_utils_1.findComponent)(children, index_1.EbayTextboxPostfixIcon);
|
|
117
|
+
const inputClassName = (0, classnames_1.default)('textbox__control', {
|
|
129
118
|
'textbox__control--fluid': fluid,
|
|
130
119
|
'textbox__control--large': inputSize === 'large'
|
|
131
120
|
});
|
|
132
|
-
|
|
121
|
+
const wrapperClassName = (0, classnames_1.default)('textbox', rest.className, {
|
|
133
122
|
'textbox--icon-end': postfixIcon
|
|
134
123
|
});
|
|
135
124
|
return (react_1.default.createElement(Container, null,
|
|
136
125
|
label,
|
|
137
126
|
react_1.default.createElement(Wrapper, { className: wrapperClassName },
|
|
138
127
|
prefixIcon,
|
|
139
|
-
react_1.default.createElement(Input,
|
|
140
|
-
postfixIcon && (0, react_1.cloneElement)(postfixIcon,
|
|
141
|
-
|
|
128
|
+
react_1.default.createElement(Input, Object.assign({}, rest, { className: inputClassName, type: type, "aria-invalid": invalid, value: (0, exports.isControlled)(controlledValue) ? controlledValue : inputValue, onChange: handleInputChange, onBlur: handleBlur, onFocus: handleFocus, onKeyPress: handleKeyPress, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onInvalid: handleInvalid, autoFocus: autoFocus, ref: ref, placeholder: floatingLabelPlaceholder })),
|
|
129
|
+
postfixIcon && (0, react_1.cloneElement)(postfixIcon, Object.assign(Object.assign({}, postfixIcon.props), { onClick: (e) => {
|
|
130
|
+
const { onClick: iconClick = () => { } } = postfixIcon.props;
|
|
142
131
|
iconClick(e);
|
|
143
132
|
handleButtonClick(e);
|
|
144
133
|
} })))));
|
|
@@ -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,12 +15,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
15
|
};
|
|
27
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
17
|
exports.EbayToast = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState,
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const ebay_dialog_base_1 = require("../../ebay-dialog-base");
|
|
21
|
+
const EbayToast = (_a) => {
|
|
22
|
+
var { className, onClose = () => { } } = _a, rest = __rest(_a, ["className", "onClose"]);
|
|
23
|
+
return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState, Object.assign({}, rest, { isModal: false, baseEl: "aside", classPrefix: "toast-dialog", buttonPosition: "right", transitionElement: "root", className: (0, classnames_1.default)(className, 'toast-dialog--transition'), onCloseBtnClick: onClose })));
|
|
35
24
|
};
|
|
36
25
|
exports.EbayToast = EbayToast;
|
|
37
26
|
exports.default = exports.EbayToast;
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
* This Component is used only for finding it as a child of EbayTooltip
|
|
5
5
|
* and pass the properties to TooltipContent
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const EbayTooltipContent = () => null;
|
|
8
8
|
exports.default = EbayTooltipContent;
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
* This Component is used only for finding it as a child of EbayTooltip
|
|
5
5
|
* and pass the properties to TooltipHost
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const EbayTooltipHost = () => null;
|
|
8
8
|
exports.default = EbayTooltipHost;
|
|
@@ -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,49 +37,49 @@ 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
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const component_utils_1 = require("../common/component-utils");
|
|
42
|
+
const tooltip_utils_1 = require("../common/tooltip-utils");
|
|
43
|
+
const ebay_tooltip_content_1 = __importDefault(require("./ebay-tooltip-content"));
|
|
44
|
+
const ebay_tooltip_host_1 = __importDefault(require("./ebay-tooltip-host"));
|
|
45
|
+
const EbayTooltip = (_a) => {
|
|
46
|
+
var { className, pointer, overlayStyle, noHover, onFocus = () => { }, onBlur = () => { }, onMouseEnter = () => { }, onMouseLeave = () => { }, onExpand, onCollapse, children } = _a, rest = __rest(_a, ["className", "pointer", "overlayStyle", "noHover", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "onExpand", "onCollapse", "children"]);
|
|
47
|
+
const { isExpanded, expandTooltip, collapseTooltip } = (0, tooltip_utils_1.useTooltip)({ onCollapse, onExpand });
|
|
48
|
+
const timeoutRef = (0, react_1.useRef)();
|
|
49
|
+
const handleOnMouseEnter = (event) => {
|
|
61
50
|
onMouseEnter(event);
|
|
62
51
|
if (!noHover) {
|
|
63
52
|
clearTimeout(timeoutRef.current);
|
|
64
53
|
expandTooltip();
|
|
65
54
|
}
|
|
66
55
|
};
|
|
67
|
-
|
|
56
|
+
const handleOnMouseLeave = (event) => {
|
|
68
57
|
onMouseLeave(event);
|
|
69
58
|
if (!noHover) {
|
|
70
59
|
clearTimeout(timeoutRef.current);
|
|
71
|
-
timeoutRef.current = setTimeout(
|
|
60
|
+
timeoutRef.current = setTimeout(() => {
|
|
72
61
|
collapseTooltip();
|
|
73
62
|
}, 300);
|
|
74
63
|
}
|
|
75
64
|
};
|
|
76
|
-
|
|
65
|
+
const handleOnFocus = (event) => {
|
|
77
66
|
onFocus(event);
|
|
78
67
|
expandTooltip();
|
|
79
68
|
};
|
|
80
|
-
|
|
69
|
+
const handleOnBlur = (event) => {
|
|
81
70
|
onBlur(event);
|
|
82
71
|
collapseTooltip();
|
|
83
72
|
};
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
const content = (0, component_utils_1.findComponent)(children, ebay_tooltip_content_1.default);
|
|
74
|
+
const host = (0, component_utils_1.findComponent)(children, ebay_tooltip_host_1.default);
|
|
86
75
|
if (!host) {
|
|
87
|
-
throw new Error(
|
|
76
|
+
throw new Error(`EbayTooltip: Please use a EbayTooltipHost that defines the host of the tooltip`);
|
|
88
77
|
}
|
|
89
78
|
if (!content) {
|
|
90
|
-
throw new Error(
|
|
79
|
+
throw new Error(`EbayTooltip: Please use a EbayTooltipContent that defines the content of the tooltip`);
|
|
91
80
|
}
|
|
92
|
-
return (react_1.default.createElement(tooltip_utils_1.Tooltip,
|
|
93
|
-
react_1.default.createElement(tooltip_utils_1.TooltipHost,
|
|
94
|
-
react_1.default.createElement(tooltip_utils_1.TooltipContent,
|
|
81
|
+
return (react_1.default.createElement(tooltip_utils_1.Tooltip, Object.assign({}, rest, { className: className, type: "tooltip", isExpanded: isExpanded, onFocus: handleOnFocus, onBlur: handleOnBlur, onMouseEnter: handleOnMouseEnter, onMouseLeave: handleOnMouseLeave }),
|
|
82
|
+
react_1.default.createElement(tooltip_utils_1.TooltipHost, Object.assign({}, host.props)),
|
|
83
|
+
react_1.default.createElement(tooltip_utils_1.TooltipContent, Object.assign({}, content.props, { type: "tooltip", style: overlayStyle, pointer: pointer }))));
|
|
95
84
|
};
|
|
96
85
|
exports.default = EbayTooltip;
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
* This Component is used only for finding it as a child of EbayTooltip
|
|
5
5
|
* and pass the properties to TourtipContent
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const EbayTourtipContent = () => null;
|
|
8
8
|
exports.default = EbayTourtipContent;
|
|
@@ -3,11 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
index !== undefined && (react_1.default.createElement("span", { className: "tourtip__index" }, index)),
|
|
11
|
-
children));
|
|
12
|
-
};
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const EbayTourtipFooter = ({ index, children }) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
8
|
+
index !== undefined && (react_1.default.createElement("span", { className: "tourtip__index" }, index)),
|
|
9
|
+
children));
|
|
13
10
|
exports.default = EbayTourtipFooter;
|
|
@@ -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(HeadingTag,
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
+
const EbayTourtipHeading = (_a) => {
|
|
20
|
+
var { as, children, className } = _a, props = __rest(_a, ["as", "children", "className"]);
|
|
21
|
+
const HeadingTag = as || 'h2';
|
|
22
|
+
return (react_1.default.createElement(HeadingTag, Object.assign({}, props, { className: (0, classnames_1.default)(`tourtip__heading`, className) }), children));
|
|
34
23
|
};
|
|
35
24
|
exports.default = EbayTourtipHeading;
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
* This Component is used only for finding it as a child of EbayTooltip
|
|
5
5
|
* and pass the properties to TourtipHost
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const EbayTourtipHost = () => null;
|
|
8
8
|
exports.default = EbayTourtipHost;
|