@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,64 +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 classnames_1 = __importDefault(require("classnames"));
|
|
42
|
-
const Breadcrumbs = (_a) => {
|
|
43
|
-
var { a11yHeadingText = 'Page navigation', a11yHeadingTag = 'h2', id = 'ebay-breadcrumb', children: breadcrumbItems = [], className, onSelect = () => { } } = _a, rest = __rest(_a, ["a11yHeadingText", "a11yHeadingTag", "id", "children", "className", "onSelect"]);
|
|
44
|
-
const headingId = `${id}-breadcrumbs-heading`;
|
|
45
|
-
const lastItemIndex = react_1.Children.count(breadcrumbItems) - 1;
|
|
46
|
-
const A11yHeadingTag = a11yHeadingTag;
|
|
47
|
-
const anyLink = react_1.Children.toArray(breadcrumbItems).some((item) => item.props.href);
|
|
48
|
-
const tag = anyLink ? 'a' : 'button';
|
|
49
|
-
return (react_1.default.createElement("nav", Object.assign({}, rest, { "aria-labelledby": headingId, className: (0, classnames_1.default)('breadcrumbs', className), role: "navigation" }),
|
|
50
|
-
react_1.default.createElement(A11yHeadingTag, { id: headingId, className: "clipped" }, a11yHeadingText),
|
|
51
|
-
react_1.default.createElement("ul", null, react_1.Children.map(breadcrumbItems, (item, index) => {
|
|
52
|
-
const isLastItem = index === lastItemIndex;
|
|
53
|
-
const { href, children } = item.props;
|
|
54
|
-
const itemProps = {
|
|
55
|
-
tag,
|
|
56
|
-
isLastItem,
|
|
57
|
-
href,
|
|
58
|
-
children,
|
|
59
|
-
onClick: event => onSelect(event)
|
|
60
|
-
};
|
|
61
|
-
return (0, react_1.cloneElement)(item, itemProps);
|
|
62
|
-
}))));
|
|
63
|
-
};
|
|
64
|
-
exports.default = Breadcrumbs;
|
|
@@ -1,10 +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.EbayBreadcrumbItem = exports.EbayBreadcrumbs = void 0;
|
|
7
|
-
var breadcrumbs_1 = require("./breadcrumbs");
|
|
8
|
-
Object.defineProperty(exports, "EbayBreadcrumbs", { enumerable: true, get: function () { return __importDefault(breadcrumbs_1).default; } });
|
|
9
|
-
var breadcrumb_item_1 = require("./breadcrumb-item");
|
|
10
|
-
Object.defineProperty(exports, "EbayBreadcrumbItem", { enumerable: true, get: function () { return __importDefault(breadcrumb_item_1).default; } });
|
|
@@ -1,29 +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 = {
|
|
19
|
-
cta: 'cta-',
|
|
20
|
-
fake: 'fake-',
|
|
21
|
-
expand: 'expand-',
|
|
22
|
-
default: ''
|
|
23
|
-
};
|
|
24
|
-
const EbayButtonCell = (_a) => {
|
|
25
|
-
var { type = 'default', children } = _a, rest = __rest(_a, ["type", "children"]);
|
|
26
|
-
return react_1.default.createElement("span", Object.assign({ className: `${classNames[type]}btn__cell` }, rest),
|
|
27
|
-
react_1.default.createElement(react_1.default.Fragment, null, children));
|
|
28
|
-
};
|
|
29
|
-
exports.default = EbayButtonCell;
|
|
@@ -1,13 +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 button_cell_1 = __importDefault(require("./button-cell"));
|
|
8
|
-
const button_text_1 = __importDefault(require("./button-text"));
|
|
9
|
-
const ebay_icon_1 = require("../ebay-icon");
|
|
10
|
-
const EbayButtonExpand = ({ children }) => children ? (react_1.default.createElement(button_cell_1.default, null,
|
|
11
|
-
react_1.default.createElement(button_text_1.default, null, children),
|
|
12
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "chevronDown12" }))) : (react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "chevronDown12" }));
|
|
13
|
-
exports.default = EbayButtonExpand;
|
|
@@ -1,11 +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 button_cell_1 = __importDefault(require("./button-cell"));
|
|
8
|
-
const ebay_progress_spinner_1 = require("../ebay-progress-spinner");
|
|
9
|
-
const EbayButtonLoading = () => (react_1.default.createElement(button_cell_1.default, null,
|
|
10
|
-
react_1.default.createElement(ebay_progress_spinner_1.EbayProgressSpinner, null)));
|
|
11
|
-
exports.default = EbayButtonLoading;
|
|
@@ -1,9 +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 classnames_1 = __importDefault(require("classnames"));
|
|
8
|
-
const EbayButtonText = ({ className, children }) => (react_1.default.createElement("span", { className: (0, classnames_1.default)(className, 'btn__text') }, children));
|
|
9
|
-
exports.default = EbayButtonText;
|
package/ebay-button/button.js
DELETED
|
@@ -1,95 +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 classnames_1 = __importDefault(require("classnames"));
|
|
42
|
-
const component_utils_1 = require("../common/component-utils");
|
|
43
|
-
const ebay_icon_1 = require("../ebay-icon");
|
|
44
|
-
const button_loading_1 = __importDefault(require("./button-loading"));
|
|
45
|
-
const button_expand_1 = __importDefault(require("./button-expand"));
|
|
46
|
-
const EbayButton = (_a) => {
|
|
47
|
-
var { priority = 'secondary', variant = 'standard', size = 'regular', bodyState, split, transparent = false, fluid = false, disabled, partiallyDisabled, children, onKeyDown = () => { }, onEscape = () => { }, truncate = false, href, className: extraClasses, forwardedRef, borderless, fixedHeight } = _a, rest = __rest(_a, ["priority", "variant", "size", "bodyState", "split", "transparent", "fluid", "disabled", "partiallyDisabled", "children", "onKeyDown", "onEscape", "truncate", "href", "className", "forwardedRef", "borderless", "fixedHeight"]);
|
|
48
|
-
const classPrefix = href ? 'fake-btn' : 'btn';
|
|
49
|
-
const priorityStyles = {
|
|
50
|
-
primary: `${classPrefix}--primary`,
|
|
51
|
-
secondary: `${classPrefix}--secondary`,
|
|
52
|
-
tertiary: `${classPrefix}--tertiary`,
|
|
53
|
-
none: ''
|
|
54
|
-
};
|
|
55
|
-
const sizeStyles = {
|
|
56
|
-
large: `${classPrefix}--large`,
|
|
57
|
-
small: `${classPrefix}--small`,
|
|
58
|
-
regular: '',
|
|
59
|
-
default: ''
|
|
60
|
-
};
|
|
61
|
-
const splitStyles = {
|
|
62
|
-
start: `${classPrefix}--split-start`,
|
|
63
|
-
end: `${classPrefix}--split-end`
|
|
64
|
-
};
|
|
65
|
-
const isDestructive = variant === 'destructive';
|
|
66
|
-
const isForm = variant === 'form';
|
|
67
|
-
const isLoading = bodyState === 'loading';
|
|
68
|
-
const isExpand = bodyState === 'expand';
|
|
69
|
-
const isSlim = isForm && (isIconOnly(children) || (isExpand && !children));
|
|
70
|
-
const className = (0, classnames_1.default)(classPrefix, extraClasses, priorityStyles[isForm || borderless ? 'none' : priority], sizeStyles[size], splitStyles[split], isDestructive && `${classPrefix}--destructive`, isForm && `${classPrefix}--form`, isSlim && `${classPrefix}--slim`, transparent && `${classPrefix}--transparent`, fluid && `${classPrefix}--fluid`, truncate && `${classPrefix}--truncated`, borderless && `${classPrefix}--borderless`, fixedHeight && (sizeStyles[size] ? `${sizeStyles[size]}-${fixedHeight}` : `${classPrefix}--fixed-height`));
|
|
71
|
-
const keyDownHandler = (e) => {
|
|
72
|
-
onKeyDown(e);
|
|
73
|
-
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
74
|
-
onEscape(e);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const bodyContent = getBodyContent(children, { isLoading, isExpand });
|
|
78
|
-
const ariaLive = isLoading ? `polite` : null;
|
|
79
|
-
return href ? (react_1.default.createElement("a", Object.assign({ className: className, href: disabled ? undefined : href, ref: forwardedRef, onKeyDown: keyDownHandler, "aria-live": ariaLive }, rest), bodyContent)) : (react_1.default.createElement("button", Object.assign({ disabled: disabled, "aria-disabled": partiallyDisabled, "aria-live": ariaLive, className: className, ref: forwardedRef, onKeyDown: keyDownHandler }, rest), bodyContent));
|
|
80
|
-
};
|
|
81
|
-
function getBodyContent(children, { isLoading, isExpand }) {
|
|
82
|
-
switch (true) {
|
|
83
|
-
case isLoading:
|
|
84
|
-
return react_1.default.createElement(button_loading_1.default, null);
|
|
85
|
-
case isExpand:
|
|
86
|
-
return react_1.default.createElement(button_expand_1.default, null, children);
|
|
87
|
-
default:
|
|
88
|
-
return children;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function isIconOnly(children) {
|
|
92
|
-
const childrenArray = react_1.Children.toArray(children);
|
|
93
|
-
return childrenArray.length === 1 && childrenArray[0].type === ebay_icon_1.EbayIcon;
|
|
94
|
-
}
|
|
95
|
-
exports.default = (0, component_utils_1.withForwardRef)(EbayButton);
|
package/ebay-button/index.js
DELETED
|
@@ -1,10 +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.EbayButtonCell = exports.EbayButton = void 0;
|
|
7
|
-
var button_1 = require("./button");
|
|
8
|
-
Object.defineProperty(exports, "EbayButton", { enumerable: true, get: function () { return __importDefault(button_1).default; } });
|
|
9
|
-
var button_cell_1 = require("./button-cell");
|
|
10
|
-
Object.defineProperty(exports, "EbayButtonCell", { enumerable: true, get: function () { return __importDefault(button_cell_1).default; } });
|
package/ebay-button/types.js
DELETED
|
@@ -1,306 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
const ebay_icon_button_1 = require("../ebay-icon-button");
|
|
31
|
-
const date_utils_1 = require("./date-utils");
|
|
32
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
33
|
-
const DAY_UPDATE_KEYMAP = {
|
|
34
|
-
ArrowRight: 1,
|
|
35
|
-
ArrowLeft: -1,
|
|
36
|
-
ArrowDown: 7,
|
|
37
|
-
ArrowUp: -7
|
|
38
|
-
};
|
|
39
|
-
const EbayCalendar = ({ selected, numMonths = 1, navigable, interactive, range, locale, disableBefore, disableAfter, disableWeekdays, disableList, a11ySelectedText = 'selected', a11yRangeStartText = 'start of range', a11yInRangeText = 'in range', a11yRangeEndText = 'end of range', a11ySeparator = '-', a11yTodayText = 'today', a11yDisabledText = 'inactive', getA11yShowMonthText = (monthTitle) => `Show ${monthTitle}`, linkBuilder, onMonthChange = () => { }, onFocus = () => { }, onSelect = () => { } }) => {
|
|
40
|
-
const todayISO = (0, date_utils_1.toISO)(new Date());
|
|
41
|
-
const { firstDayOfWeek, weekdayLabels } = (0, date_utils_1.getWeekdayInfo)((0, date_utils_1.localeOverride)(locale));
|
|
42
|
-
const containerRef = (0, react_1.useRef)(null);
|
|
43
|
-
const [offset, setOffset] = (0, react_1.useState)(0);
|
|
44
|
-
const [focusISO, setFocusISO] = (0, react_1.useState)(null);
|
|
45
|
-
const [tabIndexISO, setTabIndexISO] = (0, react_1.useState)(todayISO);
|
|
46
|
-
const baseISO = (0, react_1.useRef)(todayISO);
|
|
47
|
-
const getMonthDate = (monthOffset) => {
|
|
48
|
-
const baseDate = (0, date_utils_1.fromISO)(baseISO.current);
|
|
49
|
-
const date = new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + monthOffset));
|
|
50
|
-
return date;
|
|
51
|
-
};
|
|
52
|
-
const getFirstVisibleISO = () => (0, date_utils_1.toISO)(getMonthDate(offset));
|
|
53
|
-
const getLastVisibleISO = () => {
|
|
54
|
-
const baseDate = (0, date_utils_1.fromISO)(baseISO.current);
|
|
55
|
-
return (0, date_utils_1.toISO)(new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + offset + (numMonths || 1), 0)));
|
|
56
|
-
};
|
|
57
|
-
(0, react_1.useEffect)(() => {
|
|
58
|
-
if (selected) {
|
|
59
|
-
const selectedISOs = Array.isArray(selected) ? selected : [selected];
|
|
60
|
-
const currFirstISO = getFirstVisibleISO();
|
|
61
|
-
const currLastISO = getLastVisibleISO();
|
|
62
|
-
const selectedTimeInView = selectedISOs.find((iso) => iso >= currFirstISO && iso <= currLastISO);
|
|
63
|
-
if (selectedTimeInView === undefined) {
|
|
64
|
-
baseISO.current = selectedISOs[0];
|
|
65
|
-
setOffset(0);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, [selected]);
|
|
69
|
-
const calculateRangeDisplay = () => {
|
|
70
|
-
if (selected && range) {
|
|
71
|
-
let iso1;
|
|
72
|
-
let iso2;
|
|
73
|
-
if (Array.isArray(selected)) {
|
|
74
|
-
// Two elements are selected, we can use them as the ends of the range.
|
|
75
|
-
[iso1, iso2] = selected;
|
|
76
|
-
}
|
|
77
|
-
else if (focusISO) {
|
|
78
|
-
// One element is selected and the user is focused on a date,
|
|
79
|
-
// so we use the selected component and the focus date instead
|
|
80
|
-
iso1 = selected;
|
|
81
|
-
iso2 = focusISO;
|
|
82
|
-
}
|
|
83
|
-
if (iso1 && iso2) {
|
|
84
|
-
const [start, end] = [iso1, iso2].sort();
|
|
85
|
-
return {
|
|
86
|
-
rangeStart: start,
|
|
87
|
-
rangeEnd: end
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
rangeStart: null,
|
|
93
|
-
rangeEnd: null
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
const monthTitle = (date) => {
|
|
97
|
-
const formatter = new Intl.DateTimeFormat((0, date_utils_1.localeOverride)(locale), {
|
|
98
|
-
month: 'long',
|
|
99
|
-
year: 'numeric'
|
|
100
|
-
});
|
|
101
|
-
return formatter.format(new Date(date.getUTCFullYear(), date.getUTCMonth()));
|
|
102
|
-
};
|
|
103
|
-
const isDayDisabled = (iso) => (disableBefore && iso < disableBefore) ||
|
|
104
|
-
(disableAfter && iso > disableAfter) ||
|
|
105
|
-
(disableWeekdays && disableWeekdays.includes((0, date_utils_1.fromISO)(iso).getUTCDay())) ||
|
|
106
|
-
(disableList && disableList.includes(iso));
|
|
107
|
-
const getFirstActiveISO = () => {
|
|
108
|
-
let iso = getFirstVisibleISO();
|
|
109
|
-
const lastVisible = getLastVisibleISO();
|
|
110
|
-
while (iso <= lastVisible && isDayDisabled(iso)) {
|
|
111
|
-
iso = (0, date_utils_1.offsetISO)(iso, 1);
|
|
112
|
-
}
|
|
113
|
-
return iso > lastVisible ? null : iso;
|
|
114
|
-
};
|
|
115
|
-
const getLastActiveISO = () => {
|
|
116
|
-
let iso = getLastVisibleISO();
|
|
117
|
-
const firstVisible = getFirstVisibleISO();
|
|
118
|
-
while (iso >= firstVisible && isDayDisabled(iso)) {
|
|
119
|
-
iso = (0, date_utils_1.offsetISO)(iso, -1);
|
|
120
|
-
}
|
|
121
|
-
return iso < firstVisible ? null : iso;
|
|
122
|
-
};
|
|
123
|
-
const setTabindexAndFocus = (iso) => {
|
|
124
|
-
setTabIndexISO(iso);
|
|
125
|
-
setTimeout(() => {
|
|
126
|
-
var _a;
|
|
127
|
-
const elementToFocus = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-iso="${iso}"]`);
|
|
128
|
-
elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
const prevMonth = (focus) => {
|
|
132
|
-
if (disableBefore && getFirstVisibleISO() <= disableBefore) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
setOffset((currentOffset) => currentOffset - 1);
|
|
136
|
-
let newTabIndexISO = tabIndexISO;
|
|
137
|
-
const lastActiveISO = getLastActiveISO();
|
|
138
|
-
if (lastActiveISO && lastActiveISO < tabIndexISO) {
|
|
139
|
-
newTabIndexISO = lastActiveISO;
|
|
140
|
-
setTabIndexISO(lastActiveISO);
|
|
141
|
-
}
|
|
142
|
-
if (focus) {
|
|
143
|
-
setTabindexAndFocus(newTabIndexISO);
|
|
144
|
-
}
|
|
145
|
-
onMonthChange({
|
|
146
|
-
iso: (0, date_utils_1.toISO)(getMonthDate(offset))
|
|
147
|
-
});
|
|
148
|
-
return true;
|
|
149
|
-
};
|
|
150
|
-
const nextMonth = (focus) => {
|
|
151
|
-
if (disableAfter && getLastVisibleISO() >= disableAfter) {
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
setOffset((currentOffset) => currentOffset + 1);
|
|
155
|
-
let newTabIndexISO = tabIndexISO;
|
|
156
|
-
const firstActiveISO = getFirstActiveISO();
|
|
157
|
-
if (firstActiveISO && firstActiveISO > tabIndexISO) {
|
|
158
|
-
newTabIndexISO = firstActiveISO;
|
|
159
|
-
setTabIndexISO(firstActiveISO);
|
|
160
|
-
}
|
|
161
|
-
if (focus) {
|
|
162
|
-
setTabindexAndFocus(newTabIndexISO);
|
|
163
|
-
}
|
|
164
|
-
onMonthChange({
|
|
165
|
-
iso: (0, date_utils_1.toISO)(getMonthDate(offset + (numMonths || 1)))
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
const onKeyDown = (event) => {
|
|
169
|
-
const dayChange = DAY_UPDATE_KEYMAP[event.key];
|
|
170
|
-
if (dayChange) {
|
|
171
|
-
event.preventDefault();
|
|
172
|
-
let tries = 7;
|
|
173
|
-
let iso = tabIndexISO;
|
|
174
|
-
do {
|
|
175
|
-
iso = (0, date_utils_1.offsetISO)(iso, dayChange);
|
|
176
|
-
} while (tries-- > 0 && isDayDisabled(iso));
|
|
177
|
-
if (tries > 0) {
|
|
178
|
-
const firstVisible = getFirstVisibleISO();
|
|
179
|
-
const lastVisible = getLastVisibleISO();
|
|
180
|
-
if (iso < firstVisible) {
|
|
181
|
-
if (navigable) {
|
|
182
|
-
prevMonth();
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
iso = firstVisible;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
else if (iso > lastVisible) {
|
|
189
|
-
if (navigable) {
|
|
190
|
-
nextMonth();
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
iso = lastVisible;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
setTabindexAndFocus(iso);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
switch (event.key) {
|
|
201
|
-
case 'PageUp':
|
|
202
|
-
prevMonth(true);
|
|
203
|
-
break;
|
|
204
|
-
case 'PageDown':
|
|
205
|
-
nextMonth(true);
|
|
206
|
-
break;
|
|
207
|
-
case 'Home':
|
|
208
|
-
setTabindexAndFocus(getFirstActiveISO());
|
|
209
|
-
break;
|
|
210
|
-
case 'End':
|
|
211
|
-
setTabindexAndFocus(getLastActiveISO());
|
|
212
|
-
break;
|
|
213
|
-
default:
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
const onDaySelect = (event, iso) => {
|
|
218
|
-
onSelect(event, { iso });
|
|
219
|
-
};
|
|
220
|
-
const onDayFocus = (event, day) => {
|
|
221
|
-
setFocusISO(day);
|
|
222
|
-
setTabIndexISO(day);
|
|
223
|
-
onFocus(event, { iso: day });
|
|
224
|
-
};
|
|
225
|
-
const onDayBlur = () => {
|
|
226
|
-
setFocusISO(null);
|
|
227
|
-
};
|
|
228
|
-
const { rangeStart, rangeEnd } = calculateRangeDisplay();
|
|
229
|
-
const isDayInRange = (iso) => {
|
|
230
|
-
if (!rangeStart || !rangeEnd) {
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
if (iso < rangeStart || iso > rangeEnd) {
|
|
234
|
-
return false;
|
|
235
|
-
}
|
|
236
|
-
return true;
|
|
237
|
-
};
|
|
238
|
-
const monthDates = [...Array(numMonths)].map((_, i) => getMonthDate(offset + i));
|
|
239
|
-
return (react_1.default.createElement("div", { className: "calendar", ref: containerRef },
|
|
240
|
-
navigable && (react_1.default.createElement("div", { className: "calendar__header" },
|
|
241
|
-
react_1.default.createElement("div", { className: "calendar__header--inner" },
|
|
242
|
-
react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { transparent: true, size: "small", icon: "chevronLeft24", disabled: disableBefore && getFirstVisibleISO() <= disableBefore, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset - 1))), onClick: () => prevMonth() }),
|
|
243
|
-
monthDates.map((monthDate, i) => (react_1.default.createElement("h3", { key: i }, monthTitle(monthDate)))),
|
|
244
|
-
react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { transparent: true, size: "small", icon: "chevronRight24", disabled: disableAfter && getLastVisibleISO() >= disableAfter, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset + numMonths))), onClick: () => nextMonth() })))),
|
|
245
|
-
react_1.default.createElement("div", { className: "calendar__body" }, monthDates.map((monthDate, i) => {
|
|
246
|
-
const numBlankDays = (monthDate.getUTCDay() - firstDayOfWeek + 7) % 7;
|
|
247
|
-
const year = monthDate.getUTCFullYear();
|
|
248
|
-
const month = monthDate.getUTCMonth();
|
|
249
|
-
const daysInMont = new Date(year, month + 1, 0).getDate();
|
|
250
|
-
const calendarRows = [...Array(Math.ceil((numBlankDays + daysInMont) / 7))];
|
|
251
|
-
return (react_1.default.createElement("div", { key: i, className: "calendar__month" },
|
|
252
|
-
react_1.default.createElement("table", { onKeyDown: onKeyDown },
|
|
253
|
-
react_1.default.createElement("caption", null, monthTitle(monthDate)),
|
|
254
|
-
react_1.default.createElement("thead", null,
|
|
255
|
-
react_1.default.createElement("tr", null, weekdayLabels.map((dayName) => (react_1.default.createElement("th", { key: dayName, scope: "col" }, dayName))))),
|
|
256
|
-
react_1.default.createElement("tbody", null, calendarRows.map((_, row) => {
|
|
257
|
-
let startDate = row * 7 - numBlankDays + 1;
|
|
258
|
-
let endDate = startDate + 6;
|
|
259
|
-
const columns = [];
|
|
260
|
-
if (row === 0 && numBlankDays !== 0) {
|
|
261
|
-
startDate = 1;
|
|
262
|
-
columns.push(react_1.default.createElement("td", { key: "pre-column", colSpan: numBlankDays }));
|
|
263
|
-
}
|
|
264
|
-
else if (endDate > daysInMont) {
|
|
265
|
-
endDate = daysInMont;
|
|
266
|
-
}
|
|
267
|
-
for (let day = startDate; day <= endDate; day++) {
|
|
268
|
-
const dayISO = (0, date_utils_1.toISO)(new Date(Date.UTC(year, month, day)));
|
|
269
|
-
const isToday = dayISO === todayISO;
|
|
270
|
-
const isSelected = Array.isArray(selected)
|
|
271
|
-
? selected.some((iso) => iso === dayISO)
|
|
272
|
-
: selected === dayISO;
|
|
273
|
-
const isRangeStart = dayISO === rangeStart;
|
|
274
|
-
const isInRange = isDayInRange(dayISO);
|
|
275
|
-
const isRangeEnd = dayISO === rangeEnd;
|
|
276
|
-
const isDisabled = isDayDisabled(dayISO);
|
|
277
|
-
const a11yTexts = [
|
|
278
|
-
'',
|
|
279
|
-
isSelected && a11ySelectedText,
|
|
280
|
-
isRangeStart && a11yRangeStartText,
|
|
281
|
-
!isRangeStart && !isRangeEnd && isInRange && a11yInRangeText,
|
|
282
|
-
isRangeEnd && a11yRangeEndText,
|
|
283
|
-
!interactive && isToday && a11yTodayText,
|
|
284
|
-
!interactive && isDisabled && a11yDisabledText
|
|
285
|
-
].filter((value) => typeof value !== 'boolean' || value !== false);
|
|
286
|
-
const link = !interactive && !isDisabled && linkBuilder && linkBuilder(dayISO);
|
|
287
|
-
const NonInteractiveTag = link ? 'a' : 'span';
|
|
288
|
-
columns.push(react_1.default.createElement("td", { key: day, className: (0, classnames_1.default)({
|
|
289
|
-
'calendar__cell--selected': isSelected,
|
|
290
|
-
'calendar__range--start': isRangeStart,
|
|
291
|
-
'calendar__range': isInRange,
|
|
292
|
-
'calendar__range--end': isRangeEnd
|
|
293
|
-
}) }, interactive ? (react_1.default.createElement("button", { disabled: isDisabled, "aria-label": a11yTexts.length > 1
|
|
294
|
-
? `${day}${a11yTexts.join(a11ySeparator)}`
|
|
295
|
-
: undefined, tabIndex: tabIndexISO !== dayISO ? -1 : undefined, "aria-current": isToday ? 'date' : undefined, "aria-pressed": isSelected ? 'true' : undefined, onClick: (event) => onDaySelect(event, dayISO), onFocus: (event) => onDayFocus(event, dayISO), onMouseOver: (event) => onDayFocus(event, dayISO), onMouseOut: (event) => onDayBlur(), onBlur: () => onDayBlur(), "data-iso": dayISO }, day)) : (react_1.default.createElement(NonInteractiveTag, { className: (0, classnames_1.default)({
|
|
296
|
-
'calendar__cell--disabled': isDisabled,
|
|
297
|
-
'calendar__cell--current': isToday
|
|
298
|
-
}), href: link },
|
|
299
|
-
day,
|
|
300
|
-
a11yTexts.length > 1 && (react_1.default.createElement("span", { className: "clipped" }, a11yTexts.join(a11ySeparator)))))));
|
|
301
|
-
}
|
|
302
|
-
return (react_1.default.createElement("tr", { key: row }, columns));
|
|
303
|
-
})))));
|
|
304
|
-
}))));
|
|
305
|
-
};
|
|
306
|
-
exports.default = EbayCalendar;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.localeOverride = exports.offsetISO = exports.fromISO = exports.toISO = exports.dateArgToISO = exports.getWeekdayInfo = exports.findFirstDayOfWeek = void 0;
|
|
4
|
-
function findFirstDayOfWeek(localeName) {
|
|
5
|
-
// weekInfo only exists on some browsers, so we default to Sunday otherwise
|
|
6
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo
|
|
7
|
-
const locale = new Intl.Locale(localeName);
|
|
8
|
-
if (locale.weekInfo) {
|
|
9
|
-
return locale.weekInfo.firstDay;
|
|
10
|
-
}
|
|
11
|
-
return 0;
|
|
12
|
-
}
|
|
13
|
-
exports.findFirstDayOfWeek = findFirstDayOfWeek;
|
|
14
|
-
function getWeekdayInfo(localeName) {
|
|
15
|
-
const firstDayOfWeek = findFirstDayOfWeek(localeName);
|
|
16
|
-
const weekdayLabelFormatter = new Intl.DateTimeFormat(localeName, {
|
|
17
|
-
weekday: 'short'
|
|
18
|
-
});
|
|
19
|
-
const weekday = new Date(2022, 9, 2 + firstDayOfWeek); // October 2, 2022 was a Sunday
|
|
20
|
-
const weekdayLabels = [...Array(7)].map(() => {
|
|
21
|
-
const dayLabel = weekdayLabelFormatter.format(weekday);
|
|
22
|
-
weekday.setDate(weekday.getDate() + 1);
|
|
23
|
-
return dayLabel;
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
firstDayOfWeek,
|
|
27
|
-
weekdayLabels
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
exports.getWeekdayInfo = getWeekdayInfo;
|
|
31
|
-
function dateArgToISO(arg) {
|
|
32
|
-
if (!arg)
|
|
33
|
-
return undefined;
|
|
34
|
-
if (/^\d\d\d\d-\d\d-\d\d$/g.test(arg))
|
|
35
|
-
return arg;
|
|
36
|
-
return toISO(new Date(arg));
|
|
37
|
-
}
|
|
38
|
-
exports.dateArgToISO = dateArgToISO;
|
|
39
|
-
function toISO(date) {
|
|
40
|
-
if (isNaN(date.getTime()))
|
|
41
|
-
return;
|
|
42
|
-
return date.toISOString().slice(0, 10);
|
|
43
|
-
}
|
|
44
|
-
exports.toISO = toISO;
|
|
45
|
-
function fromISO(iso) {
|
|
46
|
-
return new Date(iso);
|
|
47
|
-
}
|
|
48
|
-
exports.fromISO = fromISO;
|
|
49
|
-
function offsetISO(iso, days) {
|
|
50
|
-
const date = fromISO(iso);
|
|
51
|
-
date.setUTCDate(date.getUTCDate() + days);
|
|
52
|
-
return toISO(date);
|
|
53
|
-
}
|
|
54
|
-
exports.offsetISO = offsetISO;
|
|
55
|
-
function localeOverride(locale) {
|
|
56
|
-
return locale || navigator.language;
|
|
57
|
-
}
|
|
58
|
-
exports.localeOverride = localeOverride;
|
package/ebay-calendar/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.EbayCalendar = void 0;
|
|
7
|
-
var calendar_1 = require("./calendar");
|
|
8
|
-
Object.defineProperty(exports, "EbayCalendar", { enumerable: true, get: function () { return __importDefault(calendar_1).default; } });
|
|
@@ -1,24 +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 classnames_1 = __importDefault(require("classnames"));
|
|
8
|
-
const ebay_icon_1 = require("../ebay-icon");
|
|
9
|
-
const icon = {
|
|
10
|
-
prev: 'chevronLeft12',
|
|
11
|
-
next: 'chevronRight12'
|
|
12
|
-
};
|
|
13
|
-
const typeToDirection = {
|
|
14
|
-
prev: 'LEFT',
|
|
15
|
-
next: 'RIGHT'
|
|
16
|
-
};
|
|
17
|
-
const CarouselControlButton = ({ type, label, hidden, disabled, onClick }) => {
|
|
18
|
-
const handleOnClick = (event) => {
|
|
19
|
-
onClick(event, { direction: typeToDirection[type] });
|
|
20
|
-
};
|
|
21
|
-
return (react_1.default.createElement("button", { className: (0, classnames_1.default)('carousel__control', `carousel__control--${type}`), "aria-label": label, "aria-disabled": disabled, disabled: disabled, onClick: handleOnClick },
|
|
22
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon, { className: (0, classnames_1.default)('icon', `icon--carousel-${type}`), focusable: false, name: icon[type], "aria-hidden": hidden })));
|
|
23
|
-
};
|
|
24
|
-
exports.default = CarouselControlButton;
|