@ebay/ui-core-react 7.0.2 → 7.1.0-alpha.3
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/array.polyfill.flat-5BAolFdk.js +1 -0
- package/badge-CoHKfiPt.js +1 -0
- package/button-o4ao46WM.js +1 -0
- package/calendar-CPKqwJVQ.js +1 -0
- package/debounce-BQsYxxOL.js +1 -0
- package/dialog-previous-button-7ePoYWyj.js +1 -0
- package/drawer-BxxlJwkZ.js +1 -0
- package/ebay-alert-dialog.js +1 -0
- package/ebay-badge.js +1 -0
- package/ebay-breadcrumbs.js +1 -0
- package/ebay-button.js +1 -0
- package/ebay-calendar.js +1 -0
- package/ebay-carousel.js +1 -0
- package/ebay-checkbox.js +1 -0
- package/ebay-confirm-dialog.js +1 -0
- package/ebay-cta-button.js +1 -0
- package/ebay-date-textbox.js +1 -0
- package/ebay-dialog-base.js +1 -0
- package/ebay-drawer-dialog.js +1 -0
- package/ebay-eek.js +1 -0
- package/ebay-fake-menu-button.js +1 -0
- package/ebay-fake-menu.js +1 -0
- package/ebay-fake-tabs.js +1 -0
- package/ebay-field.js +1 -0
- package/ebay-fullscreen-dialog.js +1 -0
- package/ebay-icon-button.js +1 -0
- package/ebay-icon.js +1 -0
- package/ebay-infotip.js +1 -0
- package/ebay-inline-notice.js +1 -0
- package/ebay-lightbox-dialog.js +1 -0
- package/ebay-listbox-button.js +2 -0
- package/ebay-menu/menu.d.ts +1 -1
- package/ebay-menu/menu.d.ts.map +1 -1
- package/ebay-menu-button.js +1 -0
- package/ebay-menu.js +1 -0
- package/ebay-notice-base.js +1 -0
- package/ebay-page-notice.js +1 -0
- package/ebay-pagination.js +1 -0
- package/ebay-panel-dialog.js +1 -0
- package/ebay-progress-bar.js +1 -0
- package/ebay-progress-spinner.js +1 -0
- package/ebay-progress-stepper.js +1 -0
- package/ebay-radio.js +1 -0
- package/ebay-section-notice.js +1 -0
- package/ebay-section-title/index.d.ts.map +1 -1
- package/ebay-section-title.js +1 -0
- package/ebay-select.js +1 -0
- package/ebay-signal.js +1 -0
- package/ebay-snackbar-dialog.js +1 -0
- package/ebay-split-button.js +1 -0
- package/ebay-star-rating-select.js +1 -0
- package/ebay-star-rating.js +1 -0
- package/ebay-svg.js +1 -0
- package/ebay-switch.js +1 -0
- package/ebay-tabs.js +1 -0
- package/ebay-textbox.js +1 -0
- package/ebay-toast-dialog.js +1 -0
- package/ebay-tooltip.js +1 -0
- package/ebay-tourtip.js +1 -0
- package/ebay-video.js +1 -0
- package/hooks-Ctier7Yv.js +1 -0
- package/icon-DK6eEQD8.js +1 -0
- package/icon-button-BB6GFLm7.js +1 -0
- package/index-DbjwTbDP.js +1 -0
- package/label-CnrpYJ-g.js +1 -0
- package/menu-DZU8jEPV.js +1 -0
- package/menu-button-label-BcgasGA4.js +1 -0
- package/menu-item-DBi1NcrM.js +1 -0
- package/notice-content-9iF4T8uB.js +1 -0
- package/notice-content-C0ZStfuX.js +1 -0
- package/notice-footer-Cw1DMzoB.js +1 -0
- package/package.json +19 -8
- package/progress-spinner-CDgxI8R_.js +1 -0
- package/range-DOsPN0h5.js +1 -0
- package/textbox-WnB-9F4y.js +1 -0
- package/use-tooltip-BavqG36Z.js +1 -0
- package/utils-C9NL3q0j.js +1 -0
- package/common/component-utils/array.polyfill.flat.js +0 -32
- package/common/component-utils/forwardRef.js +0 -37
- package/common/component-utils/index.js +0 -18
- package/common/component-utils/usePrevious.js +0 -12
- package/common/component-utils/utils.js +0 -26
- package/common/debounce.js +0 -11
- package/common/event-utils/index.js +0 -123
- package/common/event-utils/types.js +0 -14
- package/common/event-utils/use-key-press.js +0 -33
- package/common/event-utils/use-roving-index.js +0 -35
- package/common/floating-label-utils/hooks.js +0 -133
- package/common/notice-utils/notice-content.js +0 -12
- package/common/notice-utils/notice-cta.js +0 -23
- package/common/notice-utils/notice-footer.js +0 -23
- package/common/notice-utils/notice-title.js +0 -24
- package/common/random-id.js +0 -5
- package/common/range.js +0 -5
- package/common/tooltip-utils/constants.js +0 -95
- package/common/tooltip-utils/index.js +0 -19
- package/common/tooltip-utils/tooltip-close-button.js +0 -8
- package/common/tooltip-utils/tooltip-content.js +0 -25
- package/common/tooltip-utils/tooltip-footer.js +0 -9
- package/common/tooltip-utils/tooltip-host.js +0 -24
- package/common/tooltip-utils/tooltip.js +0 -60
- package/common/tooltip-utils/types.js +0 -2
- package/common/tooltip-utils/use-tooltip.js +0 -27
- package/ebay-alert-dialog/alert-dialog.js +0 -55
- package/ebay-alert-dialog/index.js +0 -8
- package/ebay-badge/badge.js +0 -25
- package/ebay-badge/index.js +0 -8
- package/ebay-breadcrumbs/breadcrumb-item.js +0 -27
- package/ebay-breadcrumbs/breadcrumbs.js +0 -64
- package/ebay-breadcrumbs/index.js +0 -10
- package/ebay-button/button-cell.js +0 -29
- package/ebay-button/button-expand.js +0 -13
- package/ebay-button/button-loading.js +0 -11
- package/ebay-button/button-text.js +0 -9
- package/ebay-button/button.js +0 -95
- package/ebay-button/index.js +0 -10
- package/ebay-button/types.js +0 -2
- package/ebay-calendar/calendar.js +0 -306
- package/ebay-calendar/date-utils.js +0 -58
- package/ebay-calendar/index.js +0 -8
- package/ebay-carousel/carousel-control-button.js +0 -24
- package/ebay-carousel/carousel-item.js +0 -59
- package/ebay-carousel/carousel-list.js +0 -81
- package/ebay-carousel/carousel.js +0 -109
- package/ebay-carousel/helpers.js +0 -123
- package/ebay-carousel/index.js +0 -10
- package/ebay-carousel/scroll-to-transition.js +0 -102
- package/ebay-carousel/types.js +0 -2
- package/ebay-checkbox/checkbox.js +0 -77
- package/ebay-checkbox/index.js +0 -8
- package/ebay-confirm-dialog/confirm-dialog.js +0 -56
- package/ebay-confirm-dialog/index.js +0 -8
- package/ebay-cta-button/cta-button.js +0 -30
- package/ebay-cta-button/index.js +0 -8
- package/ebay-date-textbox/date-textbox.js +0 -179
- package/ebay-date-textbox/index.js +0 -8
- package/ebay-dialog-base/components/animation.js +0 -96
- package/ebay-dialog-base/components/dialog-actions.js +0 -8
- package/ebay-dialog-base/components/dialog-close-button.js +0 -8
- package/ebay-dialog-base/components/dialog-footer.js +0 -8
- package/ebay-dialog-base/components/dialog-header.js +0 -22
- package/ebay-dialog-base/components/dialog-previous-button.js +0 -24
- package/ebay-dialog-base/components/dialogBase.js +0 -152
- package/ebay-dialog-base/dialog-base-with-state.js +0 -63
- package/ebay-dialog-base/index.js +0 -18
- package/ebay-drawer-dialog/components/drawer.js +0 -104
- package/ebay-drawer-dialog/index.js +0 -8
- package/ebay-eek/eek-rating.js +0 -23
- package/ebay-eek/eek-util.js +0 -34
- package/ebay-eek/index.js +0 -8
- package/ebay-fake-menu/index.js +0 -12
- package/ebay-fake-menu/menu-item-separator.js +0 -23
- package/ebay-fake-menu/menu-item.js +0 -72
- package/ebay-fake-menu/menu.js +0 -57
- package/ebay-fake-menu-button/index.js +0 -14
- package/ebay-fake-menu-button/menu-button-item.js +0 -5
- package/ebay-fake-menu-button/menu-button-label.js +0 -8
- package/ebay-fake-menu-button/menu-button-separator.js +0 -23
- package/ebay-fake-menu-button/menu-button.js +0 -105
- package/ebay-fake-tabs/fake-tabs.js +0 -54
- package/ebay-fake-tabs/index.js +0 -10
- package/ebay-fake-tabs/tab.js +0 -24
- package/ebay-field/description.js +0 -26
- package/ebay-field/field.js +0 -12
- package/ebay-field/index.js +0 -12
- package/ebay-field/label.js +0 -29
- package/ebay-field/types.js +0 -2
- package/ebay-fullscreen-dialog/fullscreen-dialog.js +0 -25
- package/ebay-fullscreen-dialog/index.js +0 -8
- package/ebay-icon/icon.js +0 -98
- package/ebay-icon/index.js +0 -8
- package/ebay-icon/types.js +0 -3
- package/ebay-icon-button/icon-button.js +0 -40
- package/ebay-icon-button/index.js +0 -8
- package/ebay-infotip/ebay-infotip-content.js +0 -12
- package/ebay-infotip/ebay-infotip-heading.js +0 -23
- package/ebay-infotip/ebay-infotip-host.js +0 -28
- package/ebay-infotip/ebay-infotip.js +0 -79
- package/ebay-infotip/index.js +0 -14
- package/ebay-infotip/types.js +0 -2
- package/ebay-inline-notice/index.js +0 -10
- package/ebay-inline-notice/inline-notice.js +0 -66
- package/ebay-inline-notice/types.js +0 -2
- package/ebay-lightbox-dialog/index.js +0 -8
- package/ebay-lightbox-dialog/lightbox-dialog.js +0 -27
- package/ebay-listbox-button/index.js +0 -10
- package/ebay-listbox-button/listbox-button-option.js +0 -27
- package/ebay-listbox-button/listbox-button.js +0 -252
- package/ebay-menu/index.js +0 -27
- package/ebay-menu/menu-item-separator.js +0 -23
- package/ebay-menu/menu-item.js +0 -67
- package/ebay-menu/menu.js +0 -149
- package/ebay-menu/types.js +0 -2
- package/ebay-menu-button/index.js +0 -29
- package/ebay-menu-button/menu-button-item.js +0 -5
- package/ebay-menu-button/menu-button-label.js +0 -8
- package/ebay-menu-button/menu-button-separator.js +0 -23
- package/ebay-menu-button/menu-button.js +0 -132
- package/ebay-menu-button/types.js +0 -2
- package/ebay-notice-base/components/ebay-notice-content/index.js +0 -8
- package/ebay-notice-base/components/ebay-notice-content/notice-content.js +0 -4
- package/ebay-notice-base/components/ebay-notice-title/index.js +0 -8
- package/ebay-notice-base/components/ebay-notice-title/notice-title.js +0 -8
- package/ebay-notice-base/index.js +0 -7
- package/ebay-page-notice/index.js +0 -16
- package/ebay-page-notice/page-notice-cta.js +0 -9
- package/ebay-page-notice/page-notice-footer.js +0 -9
- package/ebay-page-notice/page-notice-title.js +0 -23
- package/ebay-page-notice/page-notice.js +0 -66
- package/ebay-pagination/const.js +0 -8
- package/ebay-pagination/helpers.js +0 -92
- package/ebay-pagination/index.js +0 -10
- package/ebay-pagination/pagination-item.js +0 -55
- package/ebay-pagination/pagination.js +0 -146
- package/ebay-pagination/types.js +0 -2
- package/ebay-panel-dialog/index.js +0 -8
- package/ebay-panel-dialog/panel-dialog.js +0 -27
- package/ebay-progress-bar/index.js +0 -8
- package/ebay-progress-bar/progress-bar.js +0 -23
- package/ebay-progress-spinner/index.js +0 -8
- package/ebay-progress-spinner/progress-spinner.js +0 -35
- package/ebay-progress-stepper/ebay-progress-step.js +0 -64
- package/ebay-progress-stepper/ebay-progress-stepper.js +0 -70
- package/ebay-progress-stepper/ebay-progress-title.js +0 -5
- package/ebay-progress-stepper/index.js +0 -12
- package/ebay-progress-stepper/types.js +0 -2
- package/ebay-radio/index.js +0 -8
- package/ebay-radio/radio.js +0 -71
- package/ebay-section-notice/index.js +0 -14
- package/ebay-section-notice/section-notice-footer.js +0 -9
- package/ebay-section-notice/section-notice-title.js +0 -23
- package/ebay-section-notice/section-notice.js +0 -82
- package/ebay-section-title/cta.js +0 -26
- package/ebay-section-title/index.js +0 -16
- package/ebay-section-title/info.js +0 -23
- package/ebay-section-title/overflow.js +0 -23
- package/ebay-section-title/section-title.js +0 -35
- package/ebay-section-title/subtitle.js +0 -23
- package/ebay-section-title/title.js +0 -23
- package/ebay-select/ebay-select-option.js +0 -22
- package/ebay-select/ebay-select.js +0 -129
- package/ebay-select/index.js +0 -10
- package/ebay-signal/index.js +0 -8
- package/ebay-signal/signal.js +0 -24
- package/ebay-snackbar-dialog/components/ebay-snackbar-dialog-action.js +0 -24
- package/ebay-snackbar-dialog/components/ebay-snackbar-dialog.js +0 -122
- package/ebay-snackbar-dialog/index.js +0 -7
- package/ebay-split-button/index.js +0 -23
- package/ebay-split-button/split-button.js +0 -30
- package/ebay-split-button/types.js +0 -2
- package/ebay-star-rating/index.js +0 -23
- package/ebay-star-rating/star-rating.js +0 -26
- package/ebay-star-rating-select/index.js +0 -23
- package/ebay-star-rating-select/star-rating-select.js +0 -82
- package/ebay-svg/index.js +0 -8
- package/ebay-svg/svg.js +0 -2548
- package/ebay-switch/ebay-switch.js +0 -61
- package/ebay-switch/index.js +0 -8
- package/ebay-tabs/index.js +0 -12
- package/ebay-tabs/tab-panel.js +0 -24
- package/ebay-tabs/tab.js +0 -24
- package/ebay-tabs/tabs.js +0 -90
- package/ebay-tabs/types.js +0 -2
- package/ebay-textbox/index.js +0 -16
- package/ebay-textbox/postfix-icon.js +0 -26
- package/ebay-textbox/postfix-text.js +0 -8
- package/ebay-textbox/prefix-icon.js +0 -23
- package/ebay-textbox/prefix-text.js +0 -8
- package/ebay-textbox/textbox.js +0 -147
- package/ebay-textbox/types.js +0 -2
- package/ebay-toast-dialog/components/toast.js +0 -26
- package/ebay-toast-dialog/index.js +0 -8
- package/ebay-tooltip/ebay-tooltip-content.js +0 -8
- package/ebay-tooltip/ebay-tooltip-host.js +0 -8
- package/ebay-tooltip/ebay-tooltip.js +0 -85
- package/ebay-tooltip/index.js +0 -14
- package/ebay-tourtip/ebay-tourtip-content.js +0 -8
- package/ebay-tourtip/ebay-tourtip-footer.js +0 -10
- package/ebay-tourtip/ebay-tourtip-heading.js +0 -24
- package/ebay-tourtip/ebay-tourtip-host.js +0 -8
- package/ebay-tourtip/ebay-tourtip.js +0 -70
- package/ebay-tourtip/index.js +0 -18
- package/ebay-video/const.js +0 -19
- package/ebay-video/controls.js +0 -40
- package/ebay-video/index.js +0 -25
- package/ebay-video/reportButton.js +0 -12
- package/ebay-video/source.js +0 -22
- package/ebay-video/types.js +0 -2
- package/ebay-video/video.js +0 -210
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const react_1 = __importDefault(require("react"));
|
|
18
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
-
const forwardRef_1 = require("../common/component-utils/forwardRef");
|
|
20
|
-
const ebay_icon_1 = require("../ebay-icon");
|
|
21
|
-
const ebay_button_1 = require("../ebay-button");
|
|
22
|
-
const EbayCtaButton = (_a) => {
|
|
23
|
-
var { size, children, fluid, truncate, forwardedRef, className: extraClasses } = _a, rest = __rest(_a, ["size", "children", "fluid", "truncate", "forwardedRef", "className"]);
|
|
24
|
-
const className = (0, classnames_1.default)(extraClasses, 'cta-btn', { 'cta-btn--large': size === 'large' }, { 'cta-btn--fluid': fluid }, { 'cta-btn--truncated': truncate });
|
|
25
|
-
return (react_1.default.createElement("a", Object.assign({}, rest, { className: className, ref: forwardedRef }),
|
|
26
|
-
react_1.default.createElement(ebay_button_1.EbayButtonCell, { type: "cta" },
|
|
27
|
-
react_1.default.createElement("span", null, children),
|
|
28
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "arrowRight24" }))));
|
|
29
|
-
};
|
|
30
|
-
exports.default = (0, forwardRef_1.withForwardRef)(EbayCtaButton);
|
package/ebay-cta-button/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EbayCtaButton = void 0;
|
|
7
|
-
var cta_button_1 = require("./cta-button");
|
|
8
|
-
Object.defineProperty(exports, "EbayCtaButton", { enumerable: true, get: function () { return __importDefault(cta_button_1).default; } });
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
const react_1 = __importStar(require("react"));
|
|
41
|
-
const makeup_expander_1 = __importDefault(require("makeup-expander"));
|
|
42
|
-
const calendar_1 = __importDefault(require("../ebay-calendar/calendar"));
|
|
43
|
-
const ebay_textbox_1 = require("../ebay-textbox");
|
|
44
|
-
const date_utils_1 = require("../ebay-calendar/date-utils");
|
|
45
|
-
const textbox_1 = require("../ebay-textbox/textbox");
|
|
46
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
47
|
-
const MIN_WIDTH_FOR_DOUBLE_PANE = 600;
|
|
48
|
-
const EbayDateTextbox = (_a) => {
|
|
49
|
-
var { className, inputPlaceholderText = 'YYYY-MM-DD', a11yOpenPopoverText = 'open calendar', range, value: controlledValue, rangeEnd: controlledRangeEnd, defaultValue, defaultRangeEnd, collapseOnSelect, onChange = () => { }, onInputChange = () => { }, onInputRangeEndChange = () => { } } = _a, rest = __rest(_a, ["className", "inputPlaceholderText", "a11yOpenPopoverText", "range", "value", "rangeEnd", "defaultValue", "defaultRangeEnd", "collapseOnSelect", "onChange", "onInputChange", "onInputRangeEndChange"]);
|
|
50
|
-
const expander = (0, react_1.useRef)();
|
|
51
|
-
const containerRef = (0, react_1.useRef)(null);
|
|
52
|
-
const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue || '');
|
|
53
|
-
const [internalRangeEnd, setInternalRangeEnd] = (0, react_1.useState)(defaultRangeEnd || '');
|
|
54
|
-
const valueToRender = (0, textbox_1.isControlled)(controlledValue) ? controlledValue : internalValue;
|
|
55
|
-
const rangeEndToRender = (0, textbox_1.isControlled)(controlledRangeEnd) ? controlledRangeEnd : internalRangeEnd;
|
|
56
|
-
const [firstSelected, setFirstSelected] = (0, react_1.useState)(() => (0, date_utils_1.dateArgToISO)(valueToRender));
|
|
57
|
-
const [secondSelected, setSecondSelected] = (0, react_1.useState)(() => (0, date_utils_1.dateArgToISO)(rangeEndToRender));
|
|
58
|
-
const [isPopoverOpen, setIsPopoverOpen] = (0, react_1.useState)(false);
|
|
59
|
-
const [numMonths, setNumMonths] = (0, react_1.useState)(1);
|
|
60
|
-
const openPopover = () => {
|
|
61
|
-
setIsPopoverOpen(true);
|
|
62
|
-
};
|
|
63
|
-
const closePopover = () => {
|
|
64
|
-
setIsPopoverOpen(false);
|
|
65
|
-
};
|
|
66
|
-
(0, react_1.useEffect)(() => {
|
|
67
|
-
if (!containerRef.current) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
expander.current = new makeup_expander_1.default(containerRef.current, {
|
|
71
|
-
hostSelector: '.ebay-date-textbox--main > .icon-btn',
|
|
72
|
-
contentSelector: '.date-textbox__popover',
|
|
73
|
-
expandOnClick: true,
|
|
74
|
-
autoCollapse: true
|
|
75
|
-
});
|
|
76
|
-
containerRef.current.addEventListener('expander-expand', openPopover);
|
|
77
|
-
containerRef.current.addEventListener('expander-collapse', closePopover);
|
|
78
|
-
const calculateNumMonths = () => {
|
|
79
|
-
setNumMonths(document.documentElement.clientWidth < MIN_WIDTH_FOR_DOUBLE_PANE ? 1 : 2);
|
|
80
|
-
};
|
|
81
|
-
calculateNumMonths();
|
|
82
|
-
window.addEventListener('resize', calculateNumMonths);
|
|
83
|
-
return () => {
|
|
84
|
-
var _a;
|
|
85
|
-
(_a = expander.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
86
|
-
window.removeEventListener('resize', calculateNumMonths);
|
|
87
|
-
};
|
|
88
|
-
}, []);
|
|
89
|
-
const handleInputChange = (event, index) => {
|
|
90
|
-
const date = new Date(event.target.value);
|
|
91
|
-
const iso = isNaN(date.getTime()) ? null : (0, date_utils_1.toISO)(date);
|
|
92
|
-
if (index === 0) {
|
|
93
|
-
setFirstSelected(iso);
|
|
94
|
-
setInternalValue(iso || '');
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
setSecondSelected(iso);
|
|
98
|
-
setInternalRangeEnd(iso || '');
|
|
99
|
-
}
|
|
100
|
-
if (range) {
|
|
101
|
-
onChange(event, {
|
|
102
|
-
rangeStart: index === 0 ? iso : firstSelected,
|
|
103
|
-
rangeEnd: index === 1 ? iso : secondSelected
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
onChange(event, {
|
|
108
|
-
selected: iso
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const handlePopoverSelect = (event, { iso }) => {
|
|
113
|
-
setFirstSelected(iso);
|
|
114
|
-
setInternalValue(iso);
|
|
115
|
-
if (range) {
|
|
116
|
-
const selected = firstSelected || secondSelected;
|
|
117
|
-
const eventData = {
|
|
118
|
-
rangeStart: iso,
|
|
119
|
-
rangeEnd: selected
|
|
120
|
-
};
|
|
121
|
-
if (firstSelected && secondSelected) {
|
|
122
|
-
// both were selected reset selection
|
|
123
|
-
setInternalRangeEnd('');
|
|
124
|
-
setSecondSelected(null);
|
|
125
|
-
eventData.rangeEnd = null;
|
|
126
|
-
}
|
|
127
|
-
else if (selected) {
|
|
128
|
-
// exactly one was selected; fiture out the order
|
|
129
|
-
if (selected < iso) {
|
|
130
|
-
setFirstSelected(selected);
|
|
131
|
-
setInternalValue(selected);
|
|
132
|
-
setInternalRangeEnd(iso);
|
|
133
|
-
setSecondSelected(iso);
|
|
134
|
-
eventData.rangeStart = selected;
|
|
135
|
-
eventData.rangeEnd = iso;
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
setFirstSelected(iso);
|
|
139
|
-
setInternalValue(iso);
|
|
140
|
-
setInternalRangeEnd(selected);
|
|
141
|
-
setSecondSelected(selected);
|
|
142
|
-
eventData.rangeStart = iso;
|
|
143
|
-
eventData.rangeEnd = selected;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
onChange(event, eventData);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
onChange(event, {
|
|
150
|
-
selected: iso
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
if (collapseOnSelect) {
|
|
154
|
-
expander.current.expanded = false;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
const handleInternalChange = (event, index) => {
|
|
158
|
-
if (index === 0) {
|
|
159
|
-
setInternalValue(event.target.value);
|
|
160
|
-
onInputChange(event);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
setInternalRangeEnd(event.target.value);
|
|
164
|
-
onInputRangeEndChange(event);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
const [rangeStartPlaceholder, mainPlaceholder] = Array.isArray(inputPlaceholderText)
|
|
168
|
-
? inputPlaceholderText
|
|
169
|
-
: [inputPlaceholderText, inputPlaceholderText];
|
|
170
|
-
return (react_1.default.createElement("span", { className: (0, classnames_1.default)('date-textbox', className), ref: containerRef },
|
|
171
|
-
range && (react_1.default.createElement(ebay_textbox_1.EbayTextbox, { value: valueToRender, placeholder: rangeStartPlaceholder, onInputChange: (event) => handleInternalChange(event, 0), onBlur: (event) => handleInputChange(event, 0) })),
|
|
172
|
-
react_1.default.createElement(ebay_textbox_1.EbayTextbox, { className: "ebay-date-textbox--main", placeholder: mainPlaceholder, value: range ? rangeEndToRender : valueToRender, onInputChange: (event) => handleInternalChange(event, range ? 1 : 0), onBlur: (event) => handleInputChange(event, range ? 1 : 0) },
|
|
173
|
-
react_1.default.createElement(ebay_textbox_1.EbayTextboxPostfixIcon, { name: "calendar24", buttonAriaLabel: a11yOpenPopoverText })),
|
|
174
|
-
react_1.default.createElement("div", { hidden: !isPopoverOpen, className: "date-textbox__popover" },
|
|
175
|
-
react_1.default.createElement(calendar_1.default, Object.assign({}, rest, { range: range, interactive: true, navigable: true, numMonths: numMonths, selected: firstSelected && secondSelected
|
|
176
|
-
? [firstSelected, secondSelected]
|
|
177
|
-
: firstSelected || secondSelected || undefined, onSelect: handlePopoverSelect })))));
|
|
178
|
-
};
|
|
179
|
-
exports.default = EbayDateTextbox;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EbayDateTextbox = void 0;
|
|
7
|
-
var date_textbox_1 = require("./date-textbox");
|
|
8
|
-
Object.defineProperty(exports, "EbayDateTextbox", { enumerable: true, get: function () { return __importDefault(date_textbox_1).default; } });
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useDialogAnimation = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useDialogAnimation({ open, classPrefix, transitionElement, dialogRef, dialogWindowRef, enabled, onTransitionEnd }) {
|
|
6
|
-
const firstRender = (0, react_1.useRef)(true);
|
|
7
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
8
|
-
if (!enabled) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
let transitionElements = [dialogWindowRef, dialogRef];
|
|
12
|
-
if (transitionElement === 'window') {
|
|
13
|
-
transitionElements = [dialogWindowRef];
|
|
14
|
-
}
|
|
15
|
-
else if (transitionElement === 'root') {
|
|
16
|
-
transitionElements = [dialogRef];
|
|
17
|
-
}
|
|
18
|
-
let cancelCurrentAnimation;
|
|
19
|
-
if (open) {
|
|
20
|
-
cancelCurrentAnimation = showAnimation({
|
|
21
|
-
dialog: dialogRef,
|
|
22
|
-
waitFor: transitionElements,
|
|
23
|
-
classPrefix,
|
|
24
|
-
onTransitionEnd
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
else if (!firstRender.current) {
|
|
28
|
-
cancelCurrentAnimation = hideAnimation({
|
|
29
|
-
dialog: dialogRef,
|
|
30
|
-
waitFor: transitionElements,
|
|
31
|
-
classPrefix,
|
|
32
|
-
onTransitionEnd
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
firstRender.current = false;
|
|
36
|
-
return () => {
|
|
37
|
-
if (cancelCurrentAnimation) {
|
|
38
|
-
cancelCurrentAnimation();
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}, [open, enabled]);
|
|
42
|
-
}
|
|
43
|
-
exports.useDialogAnimation = useDialogAnimation;
|
|
44
|
-
function showAnimation({ dialog, waitFor, classPrefix, onTransitionEnd }) {
|
|
45
|
-
return transition(dialog, waitFor, `${classPrefix}--show`, onTransitionEnd);
|
|
46
|
-
}
|
|
47
|
-
function hideAnimation({ dialog, waitFor, classPrefix, onTransitionEnd }) {
|
|
48
|
-
return transition(dialog, waitFor, `${classPrefix}--hide`, onTransitionEnd);
|
|
49
|
-
}
|
|
50
|
-
function transition(element, waitFor, className, onTransitionEnd) {
|
|
51
|
-
if (!element.current || !className) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
let ran = 0;
|
|
55
|
-
const pending = waitFor ? waitFor.length : 0;
|
|
56
|
-
const initClass = `${className}-init`;
|
|
57
|
-
element.current.classList.add(initClass);
|
|
58
|
-
return nextFrame(() => {
|
|
59
|
-
if (!element.current) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
element.current.classList.add(className);
|
|
63
|
-
element.current.classList.remove(initClass);
|
|
64
|
-
waitFor.forEach((ref) => {
|
|
65
|
-
const listener = () => {
|
|
66
|
-
var _a, _b;
|
|
67
|
-
if (++ran === pending) {
|
|
68
|
-
(_a = element.current) === null || _a === void 0 ? void 0 : _a.classList.remove(className);
|
|
69
|
-
onTransitionEnd();
|
|
70
|
-
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('transitionend', listener);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
ref.current.addEventListener('transitionend', listener, { once: true });
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function nextFrame(callback) {
|
|
78
|
-
let frame;
|
|
79
|
-
let cancelFrame;
|
|
80
|
-
if (window.requestAnimationFrame) {
|
|
81
|
-
frame = window.requestAnimationFrame(() => {
|
|
82
|
-
frame = window.requestAnimationFrame(callback);
|
|
83
|
-
});
|
|
84
|
-
cancelFrame = window.cancelAnimationFrame;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
frame = window.setTimeout(callback, 26); // 16ms to simulate RAF, 10ms to ensure called after the frame.
|
|
88
|
-
cancelFrame = window.clearTimeout;
|
|
89
|
-
}
|
|
90
|
-
return () => {
|
|
91
|
-
if (frame) {
|
|
92
|
-
cancelFrame(frame);
|
|
93
|
-
frame = undefined;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const EbayDialogActions = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
8
|
-
exports.default = EbayDialogActions;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const EbayDialogCloseButton = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
8
|
-
exports.default = EbayDialogCloseButton;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const EbayDialogFooter = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
8
|
-
exports.default = EbayDialogFooter;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const react_1 = __importDefault(require("react"));
|
|
18
|
-
const EbayDialogHeader = (_a) => {
|
|
19
|
-
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
20
|
-
return react_1.default.createElement("h2", Object.assign({}, rest), children);
|
|
21
|
-
};
|
|
22
|
-
exports.default = EbayDialogHeader;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const react_1 = __importDefault(require("react"));
|
|
18
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
-
const ebay_icon_button_1 = require("../../ebay-icon-button");
|
|
20
|
-
const EbayDialogPreviousButton = (_a) => {
|
|
21
|
-
var { className, icon } = _a, rest = __rest(_a, ["className", "icon"]);
|
|
22
|
-
return (react_1.default.createElement(ebay_icon_button_1.EbayIconButton, Object.assign({}, rest, { icon: icon || 'chevronLeft16', className: (0, classnames_1.default)(className, 'lightbox-dialog__prev') })));
|
|
23
|
-
};
|
|
24
|
-
exports.default = EbayDialogPreviousButton;
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.DialogBase = void 0;
|
|
41
|
-
const react_1 = __importStar(require("react"));
|
|
42
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
43
|
-
const screenreaderTrap = __importStar(require("makeup-screenreader-trap"));
|
|
44
|
-
const keyboardTrap = __importStar(require("makeup-keyboard-trap"));
|
|
45
|
-
const ebay_icon_1 = require("../../ebay-icon");
|
|
46
|
-
const random_id_1 = require("../../common/random-id");
|
|
47
|
-
const animation_1 = require("./animation");
|
|
48
|
-
const DialogBase = (_a) => {
|
|
49
|
-
var _b;
|
|
50
|
-
var { baseEl: Container = 'div', classPrefix = 'drawer-dialog', windowClass, windowType, mainId, top, header, buttonPosition = 'right', children, ariaLabelledby, a11yCloseText, onCloseBtnClick = () => { }, footer, actions, onScroll, open = false, onOpen = () => { }, onBackgroundClick = () => { }, ignoreEscape, closeButton, previousButton, isModal, role = 'dialog', focus, transitionElement, animated, closeButtonClass } = _a, props = __rest(_a, ["baseEl", "classPrefix", "windowClass", "windowType", "mainId", "top", "header", "buttonPosition", "children", "ariaLabelledby", "a11yCloseText", "onCloseBtnClick", "footer", "actions", "onScroll", "open", "onOpen", "onBackgroundClick", "ignoreEscape", "closeButton", "previousButton", "isModal", "role", "focus", "transitionElement", "animated", "closeButtonClass"]);
|
|
51
|
-
const dialogRef = (0, react_1.useRef)(null);
|
|
52
|
-
const drawerBaseEl = (0, react_1.useRef)(null);
|
|
53
|
-
const closeButtonRef = (0, react_1.useRef)(null);
|
|
54
|
-
const [rId, setRandomId] = (0, react_1.useState)('');
|
|
55
|
-
(0, react_1.useEffect)(() => {
|
|
56
|
-
setRandomId((0, random_id_1.randomId)());
|
|
57
|
-
}, []);
|
|
58
|
-
(0, react_1.useEffect)(() => {
|
|
59
|
-
let timeout;
|
|
60
|
-
const handleBackgroundClick = (e) => {
|
|
61
|
-
if (drawerBaseEl.current && !drawerBaseEl.current.contains(e.target)) {
|
|
62
|
-
onBackgroundClick(e);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
if (open && buttonPosition !== 'hidden') {
|
|
66
|
-
// On React 18 useEffect hooks runs synchronous instead of asynchronous as React 17 or prior
|
|
67
|
-
// causing the event listener to be attached to the document at the same time that the dialog
|
|
68
|
-
// opens. Adding a timeout so the event is attached after the click event that opened the modal
|
|
69
|
-
// is finished.
|
|
70
|
-
timeout = window.setTimeout(() => {
|
|
71
|
-
document.addEventListener('click', handleBackgroundClick, false);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return () => {
|
|
75
|
-
clearTimeout(timeout);
|
|
76
|
-
document.removeEventListener('click', handleBackgroundClick, false);
|
|
77
|
-
};
|
|
78
|
-
}, [onBackgroundClick, open]);
|
|
79
|
-
(0, react_1.useEffect)(() => {
|
|
80
|
-
if (open && isModal) {
|
|
81
|
-
screenreaderTrap.trap(drawerBaseEl.current);
|
|
82
|
-
keyboardTrap.trap(drawerBaseEl.current);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
screenreaderTrap.untrap();
|
|
86
|
-
keyboardTrap.untrap();
|
|
87
|
-
}
|
|
88
|
-
return () => {
|
|
89
|
-
screenreaderTrap.untrap();
|
|
90
|
-
keyboardTrap.untrap();
|
|
91
|
-
};
|
|
92
|
-
}, [open, isModal]);
|
|
93
|
-
(0, animation_1.useDialogAnimation)({
|
|
94
|
-
open,
|
|
95
|
-
classPrefix,
|
|
96
|
-
transitionElement,
|
|
97
|
-
dialogRef,
|
|
98
|
-
dialogWindowRef: drawerBaseEl,
|
|
99
|
-
enabled: animated,
|
|
100
|
-
onTransitionEnd: () => handleFocus(open)
|
|
101
|
-
});
|
|
102
|
-
const onKeyDown = (event) => {
|
|
103
|
-
if (!ignoreEscape && event.key === 'Escape') {
|
|
104
|
-
event.stopPropagation();
|
|
105
|
-
onCloseBtnClick(event);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
(0, react_1.useEffect)(() => {
|
|
109
|
-
// For animated dialogs we handle the focus on transitionEnd event
|
|
110
|
-
if (!animated) {
|
|
111
|
-
handleFocus(open);
|
|
112
|
-
}
|
|
113
|
-
if (open) {
|
|
114
|
-
onOpen();
|
|
115
|
-
}
|
|
116
|
-
}, [open]);
|
|
117
|
-
function handleFocus(isOpen) {
|
|
118
|
-
var _a, _b;
|
|
119
|
-
if (isOpen) {
|
|
120
|
-
if (focus) {
|
|
121
|
-
(_a = focus.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
122
|
-
}
|
|
123
|
-
else if (isModal) {
|
|
124
|
-
(_b = closeButtonRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
125
|
-
}
|
|
126
|
-
document.addEventListener('keydown', onKeyDown, false);
|
|
127
|
-
return () => document.removeEventListener('keydown', onKeyDown, false);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
const closeButtonContent = buttonPosition !== 'hidden' && (react_1.default.createElement("button", { ref: closeButtonRef, className: (0, classnames_1.default)(`icon-btn`, closeButtonClass, `${classPrefix}__close`, {
|
|
131
|
-
'icon-btn--transparent': classPrefix === `toast-dialog`
|
|
132
|
-
}), type: "button", "aria-label": a11yCloseText, onClick: onCloseBtnClick }, closeButton || react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "close16" })));
|
|
133
|
-
const windowClassName = windowType ? `${classPrefix}__${windowType}-window` : `${classPrefix}__window`;
|
|
134
|
-
const dialogTitleId = ((_b = header === null || header === void 0 ? void 0 : header.props) === null || _b === void 0 ? void 0 : _b.id) || `dialog-title-${rId}`;
|
|
135
|
-
const dialogLabelledBy = ariaLabelledby || dialogTitleId;
|
|
136
|
-
const dialogHeader = header ? (0, react_1.cloneElement)(header, Object.assign(Object.assign({}, header.props), { id: dialogTitleId })) : null;
|
|
137
|
-
return (react_1.default.createElement(Container, Object.assign({}, props, { "aria-labelledby": dialogLabelledBy, "aria-modal": "true", role: role, hidden: !open, className: (0, classnames_1.default)(classPrefix, props.className), "aria-live": !isModal ? 'polite' : undefined, ref: dialogRef, onKeyDown: onKeyDown }),
|
|
138
|
-
react_1.default.createElement("div", { className: (0, classnames_1.default)(windowClassName, windowClass), ref: drawerBaseEl },
|
|
139
|
-
top,
|
|
140
|
-
dialogHeader && (react_1.default.createElement("div", { className: `${classPrefix}__header` },
|
|
141
|
-
previousButton,
|
|
142
|
-
buttonPosition === 'right' && dialogHeader,
|
|
143
|
-
buttonPosition !== 'bottom' && closeButtonContent,
|
|
144
|
-
(buttonPosition === 'left' || buttonPosition === 'hidden') && dialogHeader)),
|
|
145
|
-
react_1.default.createElement("div", { id: mainId, className: `${classPrefix}__main`, onScroll: onScroll }, children),
|
|
146
|
-
actions ? (react_1.default.createElement("div", { className: `${classPrefix}__actions` }, actions)) : null,
|
|
147
|
-
footer || buttonPosition === 'bottom' ? (react_1.default.createElement("div", { className: `${classPrefix}__footer` },
|
|
148
|
-
footer,
|
|
149
|
-
buttonPosition === 'bottom' && closeButtonContent)) : null)));
|
|
150
|
-
};
|
|
151
|
-
exports.DialogBase = DialogBase;
|
|
152
|
-
exports.default = exports.DialogBase;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.DialogBaseWithState = void 0;
|
|
38
|
-
const react_1 = __importStar(require("react"));
|
|
39
|
-
const react_remove_scroll_1 = require("react-remove-scroll");
|
|
40
|
-
const dialogBase_1 = require("./components/dialogBase");
|
|
41
|
-
const index_1 = require("./index");
|
|
42
|
-
const DialogBaseWithState = (_a) => {
|
|
43
|
-
var { isModal, open, children, animated = true } = _a, rest = __rest(_a, ["isModal", "open", "children", "animated"]);
|
|
44
|
-
const shouldRenderModal = isModal !== false;
|
|
45
|
-
const childrenArray = react_1.Children.toArray(children);
|
|
46
|
-
const header = childrenArray.find((child) => child.type === index_1.EbayDialogHeader);
|
|
47
|
-
const footer = childrenArray.find((child) => child.type === index_1.EbayDialogFooter);
|
|
48
|
-
const actions = childrenArray.find((child) => child.type === index_1.EbayDialogActions);
|
|
49
|
-
const closeButton = childrenArray.find((child) => child.type === index_1.EbayDialogCloseButton);
|
|
50
|
-
const previousButton = childrenArray.find((child) => child.type === index_1.EbayDialogPreviousButton);
|
|
51
|
-
const content = childrenArray.filter((child) => ![
|
|
52
|
-
index_1.EbayDialogHeader,
|
|
53
|
-
index_1.EbayDialogFooter,
|
|
54
|
-
index_1.EbayDialogCloseButton,
|
|
55
|
-
index_1.EbayDialogActions,
|
|
56
|
-
index_1.EbayDialogPreviousButton
|
|
57
|
-
].some(c => c === child.type));
|
|
58
|
-
const dialogBase = (react_1.default.createElement(dialogBase_1.DialogBase, Object.assign({}, rest, { open: open, isModal: shouldRenderModal, header: header, footer: footer, actions: actions, closeButton: closeButton, previousButton: previousButton, animated: animated }), content));
|
|
59
|
-
const renderOverLay = () => shouldRenderModal ? (react_1.default.createElement(react_remove_scroll_1.RemoveScroll, { enabled: open }, dialogBase)) : dialogBase;
|
|
60
|
-
return animated || open ? renderOverLay() : null;
|
|
61
|
-
};
|
|
62
|
-
exports.DialogBaseWithState = DialogBaseWithState;
|
|
63
|
-
exports.default = exports.DialogBaseWithState;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EbayDialogPreviousButton = exports.EbayDialogActions = exports.DialogBaseWithState = exports.EbayDialogCloseButton = exports.EbayDialogFooter = exports.EbayDialogHeader = void 0;
|
|
7
|
-
var dialog_header_1 = require("./components/dialog-header");
|
|
8
|
-
Object.defineProperty(exports, "EbayDialogHeader", { enumerable: true, get: function () { return __importDefault(dialog_header_1).default; } });
|
|
9
|
-
var dialog_footer_1 = require("./components/dialog-footer");
|
|
10
|
-
Object.defineProperty(exports, "EbayDialogFooter", { enumerable: true, get: function () { return __importDefault(dialog_footer_1).default; } });
|
|
11
|
-
var dialog_close_button_1 = require("./components/dialog-close-button");
|
|
12
|
-
Object.defineProperty(exports, "EbayDialogCloseButton", { enumerable: true, get: function () { return __importDefault(dialog_close_button_1).default; } });
|
|
13
|
-
var dialog_base_with_state_1 = require("./dialog-base-with-state");
|
|
14
|
-
Object.defineProperty(exports, "DialogBaseWithState", { enumerable: true, get: function () { return __importDefault(dialog_base_with_state_1).default; } });
|
|
15
|
-
var dialog_actions_1 = require("./components/dialog-actions");
|
|
16
|
-
Object.defineProperty(exports, "EbayDialogActions", { enumerable: true, get: function () { return __importDefault(dialog_actions_1).default; } });
|
|
17
|
-
var dialog_previous_button_1 = require("./components/dialog-previous-button");
|
|
18
|
-
Object.defineProperty(exports, "EbayDialogPreviousButton", { enumerable: true, get: function () { return __importDefault(dialog_previous_button_1).default; } });
|