@ebay/ui-core-react 7.4.0-alpha.9 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/array.polyfill.flat-5BAolFdk.js +1 -0
- package/badge-CoHKfiPt.js +1 -0
- package/button-DGuEBUDJ.js +1 -0
- package/calendar-lAu6VfAb.js +1 -0
- package/common/component-utils/forwardRef/index.js +1 -10
- package/common/component-utils/index.js +1 -9
- package/common/component-utils/utils/index.js +1 -25
- package/common/event-utils/index.js +1 -113
- package/common/floating-label-utils/hooks/index.js +1 -106
- package/common/notice-utils/notice-cta/index.js +1 -5
- package/common/random-id/index.js +1 -13
- package/common/tooltip-utils/constants/index.js +1 -97
- package/common/tooltip-utils/index.js +1 -11
- package/debounce-BQsYxxOL.js +1 -0
- package/dialog-previous-button-CpuFLkQp.js +1 -0
- package/drawer-rqXAEeqd.js +1 -0
- package/ebay-alert-dialog/index.js +1 -26
- package/ebay-badge/index.js +1 -4
- package/ebay-breadcrumbs/index.js +1 -47
- package/ebay-button/index.js +1 -5
- package/ebay-calendar/index.js +1 -4
- package/ebay-carousel/index.js +1 -345
- package/ebay-checkbox/index.js +1 -52
- package/ebay-confirm-dialog/index.js +1 -28
- package/ebay-cta-button/index.js +1 -22
- package/ebay-date-textbox/index.js +1 -140
- package/ebay-dialog-base/components/animation/index.js +1 -92
- package/ebay-dialog-base/components/dialog-footer/index.js +1 -4
- package/ebay-dialog-base/components/dialog-header/index.js +1 -4
- package/ebay-dialog-base/index.js +1 -13
- package/ebay-drawer-dialog/index.js +1 -4
- package/ebay-eek/index.js +1 -54
- package/ebay-fake-menu/index.js +1 -10
- package/ebay-fake-menu/menu-item/index.js +1 -49
- package/ebay-fake-menu-button/index.js +1 -7
- package/ebay-fake-menu-button/menu-button/index.js +1 -12
- package/ebay-fake-tabs/index.js +1 -30
- package/ebay-field/index.js +1 -21
- package/ebay-fullscreen-dialog/index.js +1 -10
- package/ebay-icon/index.js +1 -4
- package/ebay-icon/types.d.ts +1 -1
- package/ebay-icon/types.d.ts.map +1 -1
- package/ebay-icon-button/index.js +1 -4
- package/ebay-infotip/index.js +1 -76
- package/ebay-inline-notice/index.js +1 -36
- package/ebay-lightbox-dialog/index.js +1 -12
- package/ebay-listbox-button/index.d.ts +2 -1
- package/ebay-listbox-button/index.d.ts.map +1 -1
- package/ebay-listbox-button/index.js +2 -151
- package/ebay-listbox-button/listbox-button-option.d.ts +10 -0
- package/ebay-listbox-button/listbox-button-option.d.ts.map +1 -0
- package/ebay-listbox-button/listbox-button.d.ts +5 -15
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/ebay-menu/index.js +1 -9
- package/ebay-menu-button/index.js +1 -113
- package/ebay-notice-base/index.js +1 -7
- package/ebay-page-notice/index.js +1 -50
- package/ebay-pagination/index.js +1 -244
- package/ebay-panel-dialog/index.js +1 -12
- package/ebay-progress-bar/index.js +1 -6
- package/ebay-progress-spinner/index.js +1 -4
- package/ebay-progress-stepper/index.js +1 -72
- package/ebay-radio/index.js +1 -4
- package/ebay-radio/radio/index.js +1 -48
- package/ebay-section-notice/index.js +1 -69
- package/ebay-section-title/index.js +1 -38
- package/ebay-segmented-buttons/index.js +1 -46
- package/ebay-select/index.js +1 -98
- package/ebay-signal/index.js +1 -9
- package/ebay-snackbar-dialog/index.js +1 -81
- package/ebay-split-button/index.js +1 -22
- package/ebay-star-rating/index.js +1 -9
- package/ebay-star-rating-select/index.js +1 -55
- package/ebay-svg/index.js +1 -5189
- package/ebay-svg/symbols.d.ts.map +1 -1
- package/ebay-switch/index.js +1 -27
- package/ebay-tabs/index.js +1 -88
- package/ebay-textbox/index.js +1 -10
- package/ebay-toast-dialog/index.js +1 -9
- package/ebay-toggle-button/README.md +39 -0
- package/ebay-toggle-button/index.d.ts +3 -0
- package/ebay-toggle-button/index.d.ts.map +1 -0
- package/ebay-toggle-button/index.js +1 -0
- package/ebay-toggle-button/toggle-button.d.ts +5 -0
- package/ebay-toggle-button/toggle-button.d.ts.map +1 -0
- package/ebay-toggle-button/types.d.ts +23 -0
- package/ebay-toggle-button/types.d.ts.map +1 -0
- package/ebay-toggle-button-group/README.md +56 -0
- package/ebay-toggle-button-group/index.d.ts +3 -0
- package/ebay-toggle-button-group/index.d.ts.map +1 -0
- package/ebay-toggle-button-group/index.js +1 -0
- package/ebay-toggle-button-group/toggle-button-group.d.ts +5 -0
- package/ebay-toggle-button-group/toggle-button-group.d.ts.map +1 -0
- package/ebay-toggle-button-group/types.d.ts +20 -0
- package/ebay-toggle-button-group/types.d.ts.map +1 -0
- package/ebay-tooltip/index.js +1 -64
- package/ebay-tourtip/index.js +1 -54
- package/ebay-video/index.js +1 -229
- package/events/index.js +1 -18
- package/icon-TuxfQndO.js +1 -0
- package/icon-button-Cwaj-eT9.js +1 -0
- package/label-CnrpYJ-g.js +1 -0
- package/menu-CV-INYLM.js +1 -0
- package/menu-_LzP6yje.js +1 -0
- package/menu-button-BZ66jxvI.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 +2 -5
- package/progress-spinner-U2qOANON.js +1 -0
- package/range-DOsPN0h5.js +1 -0
- package/textbox-dUhinDwj.js +1 -0
- package/toggle-button-D8l0YB43.js +1 -0
- package/use-roving-index-DoAVBgsp.js +1 -0
- package/use-tooltip-CL3_zAeg.js +1 -0
- package/utils/index.js +1 -13
- package/array.polyfill.flat-DyxysTxZ.js +0 -21
- package/badge-CR5t7-2L.js +0 -8
- package/button-B4bZIgwB.js +0 -83
- package/calendar-D-DWjrMU.js +0 -333
- package/debounce-v8bWAUnY.js +0 -9
- package/dialog-previous-button-EC_Y6KaT.js +0 -370
- package/drawer-DBDktEBZ.js +0 -69
- package/ebay-listbox/README.md +0 -100
- package/ebay-listbox/index.d.ts +0 -4
- package/ebay-listbox/index.d.ts.map +0 -1
- package/ebay-listbox/index.js +0 -6
- package/ebay-listbox/listbox-option-description.d.ts +0 -4
- package/ebay-listbox/listbox-option-description.d.ts.map +0 -1
- package/ebay-listbox/listbox-option.d.ts +0 -10
- package/ebay-listbox/listbox-option.d.ts.map +0 -1
- package/ebay-listbox/listbox.d.ts +0 -22
- package/ebay-listbox/listbox.d.ts.map +0 -1
- package/icon-B17Di3YL.js +0 -56
- package/icon-button-BQWoMgX1.js +0 -31
- package/index-BXizW4ue.js +0 -89
- package/index-DcH7Tjjd.js +0 -272
- package/label-C0AS4fnO.js +0 -19
- package/listbox-DfOw_fJc.js +0 -662
- package/menu-Bsy48CE1.js +0 -163
- package/menu-button-CKGsgg6G.js +0 -89
- package/menu-fCOy6wBS.js +0 -29
- package/notice-content-BTXVxttv.js +0 -8
- package/notice-content-BhUeK1pd.js +0 -3
- package/notice-footer-CIQ8SM6N.js +0 -10
- package/progress-spinner-DOFKRtuu.js +0 -20
- package/range-C5qzyhg4.js +0 -3
- package/textbox-J291yCpJ.js +0 -136
- package/use-roving-index-CEM_UsCH.js +0 -58
- package/use-tooltip-7JxcZHJn.js +0 -92
- package/utils/scroll.d.ts +0 -2
- package/utils/scroll.d.ts.map +0 -1
package/icon-button-BQWoMgX1.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const React = require("react");
|
|
3
|
-
const classNames = require("classnames");
|
|
4
|
-
const icon = require("./icon-B17Di3YL.js");
|
|
5
|
-
const badge = require("./badge-CR5t7-2L.js");
|
|
6
|
-
const common_componentUtils_forwardRef = require("./common/component-utils/forwardRef/index.js");
|
|
7
|
-
require("./array.polyfill.flat-DyxysTxZ.js");
|
|
8
|
-
const EbayIconButton = ({ href, icon: icon$1, badgeNumber, badgeAriaLabel, transparent, className: extraClasses, forwardedRef, size, onEscape = () => {
|
|
9
|
-
}, onKeyDown = () => {
|
|
10
|
-
}, ...rest }) => {
|
|
11
|
-
const classPrefix = href ? "icon-link" : "icon-btn";
|
|
12
|
-
const className = classNames(extraClasses, classPrefix, size && `${classPrefix}--${size}`, {
|
|
13
|
-
[`${classPrefix}--badged`]: badgeNumber,
|
|
14
|
-
[`${classPrefix}--transparent`]: transparent
|
|
15
|
-
});
|
|
16
|
-
const children = React.createElement(
|
|
17
|
-
React.Fragment,
|
|
18
|
-
null,
|
|
19
|
-
React.createElement(icon.EbayIcon, { name: icon$1 }),
|
|
20
|
-
badgeNumber && React.createElement(badge.EbayBadge, { type: "icon", number: badgeNumber, "aria-label": badgeAriaLabel })
|
|
21
|
-
);
|
|
22
|
-
const keyDownHandler = (e) => {
|
|
23
|
-
if (e.key === "Escape" || e.key === "Esc") {
|
|
24
|
-
onEscape(e);
|
|
25
|
-
}
|
|
26
|
-
onKeyDown(e);
|
|
27
|
-
};
|
|
28
|
-
return href ? React.createElement("a", { ref: forwardedRef, className, href, onKeyDown: keyDownHandler, ...rest }, children) : React.createElement("button", { ref: forwardedRef, type: "button", className, onKeyDown: keyDownHandler, ...rest }, children);
|
|
29
|
-
};
|
|
30
|
-
const EbayIconButton$1 = common_componentUtils_forwardRef.withForwardRef(EbayIconButton);
|
|
31
|
-
exports.EbayIconButton = EbayIconButton$1;
|
package/index-BXizW4ue.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const sequenceMap = {};
|
|
3
|
-
const defaultPrefix = "nid";
|
|
4
|
-
const randomPortion = createRandomPortion(3);
|
|
5
|
-
function randomNumber(max) {
|
|
6
|
-
return Math.floor(Math.random() * max);
|
|
7
|
-
}
|
|
8
|
-
function createRandomPortion(size) {
|
|
9
|
-
const letters = "abcdefghijklmnopqrstuvwxyz";
|
|
10
|
-
const digits = "0123456789";
|
|
11
|
-
const allChars = letters + digits;
|
|
12
|
-
let portion = letters[randomNumber(25)];
|
|
13
|
-
for (let i = 1; i < size; i++) {
|
|
14
|
-
portion += allChars[randomNumber(35)];
|
|
15
|
-
}
|
|
16
|
-
return portion;
|
|
17
|
-
}
|
|
18
|
-
function src_default$1(el, prefix = defaultPrefix) {
|
|
19
|
-
const separator = prefix === "" ? "" : "-";
|
|
20
|
-
const key = `${prefix}${separator}${randomPortion}`;
|
|
21
|
-
sequenceMap[key] = sequenceMap[key] || 0;
|
|
22
|
-
if (!el.id) {
|
|
23
|
-
el.setAttribute("id", `${key}-${sequenceMap[key]++}`);
|
|
24
|
-
}
|
|
25
|
-
return el.id;
|
|
26
|
-
}
|
|
27
|
-
const focusExitEmitters = {};
|
|
28
|
-
function doFocusExit(el, fromElement, toElement) {
|
|
29
|
-
el.dispatchEvent(
|
|
30
|
-
new CustomEvent("focusExit", {
|
|
31
|
-
detail: { fromElement, toElement },
|
|
32
|
-
bubbles: false
|
|
33
|
-
// mirror the native mouseleave event
|
|
34
|
-
})
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
function onDocumentFocusIn(e) {
|
|
38
|
-
const newFocusElement = e.target;
|
|
39
|
-
const targetIsDescendant = this.el.contains(newFocusElement);
|
|
40
|
-
if (targetIsDescendant === true) {
|
|
41
|
-
this.currentFocusElement = newFocusElement;
|
|
42
|
-
} else {
|
|
43
|
-
window.removeEventListener("blur", this.onWindowBlurListener);
|
|
44
|
-
document.removeEventListener("focusin", this.onDocumentFocusInListener);
|
|
45
|
-
doFocusExit(this.el, this.currentFocusElement, newFocusElement);
|
|
46
|
-
this.currentFocusElement = null;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function onWindowBlur() {
|
|
50
|
-
doFocusExit(this.el, this.currentFocusElement, void 0);
|
|
51
|
-
}
|
|
52
|
-
function onWidgetFocusIn() {
|
|
53
|
-
document.addEventListener("focusin", this.onDocumentFocusInListener);
|
|
54
|
-
window.addEventListener("blur", this.onWindowBlurListener);
|
|
55
|
-
}
|
|
56
|
-
class FocusExitEmitter {
|
|
57
|
-
constructor(el) {
|
|
58
|
-
this.el = el;
|
|
59
|
-
this.currentFocusElement = null;
|
|
60
|
-
this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);
|
|
61
|
-
this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);
|
|
62
|
-
this.onWindowBlurListener = onWindowBlur.bind(this);
|
|
63
|
-
this.el.addEventListener("focusin", this.onWidgetFocusInListener);
|
|
64
|
-
}
|
|
65
|
-
removeEventListeners() {
|
|
66
|
-
window.removeEventListener("blur", this.onWindowBlurListener);
|
|
67
|
-
document.removeEventListener("focusin", this.onDocumentFocusInListener);
|
|
68
|
-
this.el.removeEventListener("focusin", this.onWidgetFocusInListener);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function addFocusExit(el) {
|
|
72
|
-
let exitEmitter = null;
|
|
73
|
-
src_default$1(el);
|
|
74
|
-
if (!focusExitEmitters[el.id]) {
|
|
75
|
-
exitEmitter = new FocusExitEmitter(el);
|
|
76
|
-
focusExitEmitters[el.id] = exitEmitter;
|
|
77
|
-
}
|
|
78
|
-
return exitEmitter;
|
|
79
|
-
}
|
|
80
|
-
function removeFocusExit(el) {
|
|
81
|
-
const exitEmitter = focusExitEmitters[el.id];
|
|
82
|
-
if (exitEmitter) {
|
|
83
|
-
exitEmitter.removeEventListeners();
|
|
84
|
-
delete focusExitEmitters[el.id];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.addFocusExit = addFocusExit;
|
|
88
|
-
exports.removeFocusExit = removeFocusExit;
|
|
89
|
-
exports.src_default = src_default$1;
|
package/index-DcH7Tjjd.js
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const index = require("./index-BXizW4ue.js");
|
|
3
|
-
const focusableElList = [
|
|
4
|
-
"a[href]",
|
|
5
|
-
"area[href]",
|
|
6
|
-
"button:not([disabled])",
|
|
7
|
-
"embed",
|
|
8
|
-
"iframe",
|
|
9
|
-
"input:not([disabled])",
|
|
10
|
-
"object",
|
|
11
|
-
"select:not([disabled])",
|
|
12
|
-
"textarea:not([disabled])",
|
|
13
|
-
"*[tabindex]",
|
|
14
|
-
"*[contenteditable]"
|
|
15
|
-
];
|
|
16
|
-
const focusableElSelector = focusableElList.join();
|
|
17
|
-
function src_default$1(el, keyboardOnly = false, callback) {
|
|
18
|
-
return getFocusables(el, keyboardOnly);
|
|
19
|
-
}
|
|
20
|
-
function getFocusables(el, keyboardOnly = false) {
|
|
21
|
-
let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));
|
|
22
|
-
focusableEls = focusableEls.filter(function(focusableEl) {
|
|
23
|
-
return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);
|
|
24
|
-
});
|
|
25
|
-
if (keyboardOnly === true) {
|
|
26
|
-
focusableEls = focusableEls.filter(function(focusableEl) {
|
|
27
|
-
return focusableEl.getAttribute("tabindex") !== "-1";
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return focusableEls;
|
|
31
|
-
}
|
|
32
|
-
const defaultOptions = {
|
|
33
|
-
alwaysDoFocusManagement: false,
|
|
34
|
-
ariaControls: true,
|
|
35
|
-
autoCollapse: false,
|
|
36
|
-
collapseOnFocusOut: false,
|
|
37
|
-
collapseOnMouseOut: false,
|
|
38
|
-
collapseOnClickOut: false,
|
|
39
|
-
contentSelector: ".expander__content",
|
|
40
|
-
expandedClass: null,
|
|
41
|
-
expandOnClick: false,
|
|
42
|
-
expandOnFocus: false,
|
|
43
|
-
expandOnHover: false,
|
|
44
|
-
focusManagement: null,
|
|
45
|
-
hostSelector: ".expander__host",
|
|
46
|
-
simulateSpacebarClick: false
|
|
47
|
-
};
|
|
48
|
-
function onHostKeyDown(e) {
|
|
49
|
-
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
50
|
-
this._keyboardClickFlag = true;
|
|
51
|
-
}
|
|
52
|
-
if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {
|
|
53
|
-
this.hostEl.click();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function onHostMouseDown() {
|
|
57
|
-
this._mouseClickFlag = true;
|
|
58
|
-
}
|
|
59
|
-
function onHostClick() {
|
|
60
|
-
this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
|
|
61
|
-
this._expandWasMouseClickActivated = this._mouseClickFlag;
|
|
62
|
-
this.expanded = !this.expanded;
|
|
63
|
-
}
|
|
64
|
-
function onHostFocus() {
|
|
65
|
-
this._expandWasFocusActivated = true;
|
|
66
|
-
this.expanded = true;
|
|
67
|
-
}
|
|
68
|
-
function onHostHover() {
|
|
69
|
-
clearTimeout(this._mouseLeft);
|
|
70
|
-
this._expandWasHoverActivated = true;
|
|
71
|
-
this.expanded = true;
|
|
72
|
-
}
|
|
73
|
-
function onFocusExit() {
|
|
74
|
-
this.expanded = false;
|
|
75
|
-
}
|
|
76
|
-
function onMouseLeave() {
|
|
77
|
-
clearTimeout(this._mouseLeft);
|
|
78
|
-
this._mouseLeft = setTimeout(() => {
|
|
79
|
-
this.expanded = false;
|
|
80
|
-
}, 300);
|
|
81
|
-
}
|
|
82
|
-
function _onDocumentClick(e) {
|
|
83
|
-
if (this.el.contains(e.target) === false) {
|
|
84
|
-
this.expanded = false;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function _onDocumentTouchStart() {
|
|
88
|
-
this.documentClick = true;
|
|
89
|
-
}
|
|
90
|
-
function _onDocumentTouchMove() {
|
|
91
|
-
this.documentClick = false;
|
|
92
|
-
}
|
|
93
|
-
function _onDocumentTouchEnd(e) {
|
|
94
|
-
if (this.documentClick === true) {
|
|
95
|
-
this.documentClick = false;
|
|
96
|
-
if (this.el.contains(e.target) === false) {
|
|
97
|
-
this.expanded = false;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function manageFocus(focusManagement, contentEl) {
|
|
102
|
-
if (focusManagement === "content") {
|
|
103
|
-
contentEl.setAttribute("tabindex", "-1");
|
|
104
|
-
contentEl.focus();
|
|
105
|
-
} else if (focusManagement === "focusable") {
|
|
106
|
-
src_default$1(contentEl)[0].focus();
|
|
107
|
-
} else if (focusManagement === "interactive") {
|
|
108
|
-
src_default$1(contentEl, true)[0].focus();
|
|
109
|
-
} else if (focusManagement !== null) {
|
|
110
|
-
const el = contentEl.querySelector(`#${focusManagement}`);
|
|
111
|
-
if (el) {
|
|
112
|
-
el.focus();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
class src_default {
|
|
117
|
-
constructor(el, selectedOptions) {
|
|
118
|
-
this.options = Object.assign({}, defaultOptions, selectedOptions);
|
|
119
|
-
this.el = el;
|
|
120
|
-
this.hostEl = el.querySelector(this.options.hostSelector);
|
|
121
|
-
this.contentEl = el.querySelector(this.options.contentSelector);
|
|
122
|
-
index.addFocusExit(this.el);
|
|
123
|
-
this._hostKeyDownListener = onHostKeyDown.bind(this);
|
|
124
|
-
this._hostMouseDownListener = onHostMouseDown.bind(this);
|
|
125
|
-
this._documentClickListener = _onDocumentClick.bind(this);
|
|
126
|
-
this._documentTouchStartListener = _onDocumentTouchStart.bind(this);
|
|
127
|
-
this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);
|
|
128
|
-
this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
|
|
129
|
-
this._hostClickListener = onHostClick.bind(this);
|
|
130
|
-
this._hostFocusListener = onHostFocus.bind(this);
|
|
131
|
-
this._hostHoverListener = onHostHover.bind(this);
|
|
132
|
-
this._focusExitListener = onFocusExit.bind(this);
|
|
133
|
-
this._mouseLeaveListener = onMouseLeave.bind(this);
|
|
134
|
-
if (this.hostEl.getAttribute("aria-expanded") === null) {
|
|
135
|
-
this.hostEl.setAttribute("aria-expanded", "false");
|
|
136
|
-
}
|
|
137
|
-
if (this.options.ariaControls === true) {
|
|
138
|
-
index.src_default(this.el, "expander");
|
|
139
|
-
this.contentEl.id = this.contentEl.id || `${this.el.id}-content`;
|
|
140
|
-
this.hostEl.setAttribute("aria-controls", this.contentEl.id);
|
|
141
|
-
}
|
|
142
|
-
this.expandOnClick = this.options.expandOnClick;
|
|
143
|
-
this.expandOnFocus = this.options.expandOnFocus;
|
|
144
|
-
this.expandOnHover = this.options.expandOnHover;
|
|
145
|
-
if (this.options.autoCollapse === false) {
|
|
146
|
-
this.collapseOnClickOut = this.options.collapseOnClickOut;
|
|
147
|
-
this.collapseOnFocusOut = this.options.collapseOnFocusOut;
|
|
148
|
-
this.collapseOnMouseOut = this.options.collapseOnMouseOut;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
set expandOnClick(bool) {
|
|
152
|
-
if (bool === true) {
|
|
153
|
-
this.hostEl.addEventListener("keydown", this._hostKeyDownListener);
|
|
154
|
-
this.hostEl.addEventListener("mousedown", this._hostMouseDownListener);
|
|
155
|
-
this.hostEl.addEventListener("click", this._hostClickListener);
|
|
156
|
-
if (this.options.autoCollapse === true) {
|
|
157
|
-
this.collapseOnClickOut = true;
|
|
158
|
-
this.collapseOnFocusOut = true;
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
this.hostEl.removeEventListener("click", this._hostClickListener);
|
|
162
|
-
this.hostEl.removeEventListener("mousedown", this._hostMouseDownListener);
|
|
163
|
-
this.hostEl.removeEventListener("keydown", this._hostKeyDownListener);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
set expandOnFocus(bool) {
|
|
167
|
-
if (bool === true) {
|
|
168
|
-
this.hostEl.addEventListener("focus", this._hostFocusListener);
|
|
169
|
-
if (this.options.autoCollapse === true) {
|
|
170
|
-
this.collapseOnClickOut = true;
|
|
171
|
-
this.collapseOnFocusOut = true;
|
|
172
|
-
}
|
|
173
|
-
} else {
|
|
174
|
-
this.hostEl.removeEventListener("focus", this._hostFocusListener);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
set expandOnHover(bool) {
|
|
178
|
-
if (bool === true) {
|
|
179
|
-
this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
|
|
180
|
-
this.contentEl.addEventListener("mouseenter", this._hostHoverListener);
|
|
181
|
-
if (this.options.autoCollapse === true) {
|
|
182
|
-
this.collapseOnMouseOut = true;
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
this.hostEl.removeEventListener("mouseenter", this._hostHoverListener);
|
|
186
|
-
this.contentEl.removeEventListener("mouseenter", this._hostHoverListener);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
set collapseOnClickOut(bool) {
|
|
190
|
-
if (bool === true) {
|
|
191
|
-
document.addEventListener("click", this._documentClickListener);
|
|
192
|
-
document.addEventListener("touchstart", this._documentTouchStartListener);
|
|
193
|
-
document.addEventListener("touchmove", this._documentTouchMoveListener);
|
|
194
|
-
document.addEventListener("touchend", this._documentTouchEndListener);
|
|
195
|
-
} else {
|
|
196
|
-
document.removeEventListener("click", this._documentClickListener);
|
|
197
|
-
document.removeEventListener("touchstart", this._documentTouchStartListener);
|
|
198
|
-
document.removeEventListener("touchmove", this._documentTouchMoveListener);
|
|
199
|
-
document.removeEventListener("touchend", this._documentTouchEndListener);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
set collapseOnFocusOut(bool) {
|
|
203
|
-
if (bool === true) {
|
|
204
|
-
this.el.addEventListener("focusExit", this._focusExitListener);
|
|
205
|
-
} else {
|
|
206
|
-
this.el.removeEventListener("focusExit", this._focusExitListener);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
set collapseOnMouseOut(bool) {
|
|
210
|
-
if (bool === true) {
|
|
211
|
-
this.el.addEventListener("mouseleave", this._mouseLeaveListener);
|
|
212
|
-
this.contentEl.addEventListener("mouseleave", this._mouseLeaveListener);
|
|
213
|
-
} else {
|
|
214
|
-
this.el.removeEventListener("mouseleave", this._mouseLeaveListener);
|
|
215
|
-
this.contentEl.removeEventListener("mouseleave", this._mouseLeaveListener);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
get expanded() {
|
|
219
|
-
return this.hostEl.getAttribute("aria-expanded") === "true";
|
|
220
|
-
}
|
|
221
|
-
set expanded(bool) {
|
|
222
|
-
if (bool === true && this.expanded === false) {
|
|
223
|
-
this.hostEl.setAttribute("aria-expanded", "true");
|
|
224
|
-
if (this.options.expandedClass) {
|
|
225
|
-
this.el.classList.add(this.options.expandedClass);
|
|
226
|
-
}
|
|
227
|
-
if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {
|
|
228
|
-
manageFocus(this.options.focusManagement, this.contentEl);
|
|
229
|
-
}
|
|
230
|
-
this.el.dispatchEvent(new CustomEvent("expander-expand", { bubbles: true, detail: this.contentEl }));
|
|
231
|
-
}
|
|
232
|
-
if (bool === false && this.expanded === true) {
|
|
233
|
-
this.hostEl.setAttribute("aria-expanded", "false");
|
|
234
|
-
if (this.options.expandedClass) {
|
|
235
|
-
this.el.classList.remove(this.options.expandedClass);
|
|
236
|
-
}
|
|
237
|
-
this.el.dispatchEvent(new CustomEvent("expander-collapse", { bubbles: true, detail: this.contentEl }));
|
|
238
|
-
}
|
|
239
|
-
this._expandWasKeyboardClickActivated = false;
|
|
240
|
-
this._expandWasMouseClickActivated = false;
|
|
241
|
-
this._expandWasFocusActivated = false;
|
|
242
|
-
this._expandWasHoverActivated = false;
|
|
243
|
-
this._keyboardClickFlag = false;
|
|
244
|
-
this._mouseClickFlag = false;
|
|
245
|
-
}
|
|
246
|
-
sleep() {
|
|
247
|
-
if (this._destroyed !== true) {
|
|
248
|
-
this.expandOnClick = false;
|
|
249
|
-
this.expandOnFocus = false;
|
|
250
|
-
this.expandOnHover = false;
|
|
251
|
-
this.collapseOnClickOut = false;
|
|
252
|
-
this.collapseOnFocusOut = false;
|
|
253
|
-
this.collapseOnMouseOut = false;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
destroy() {
|
|
257
|
-
this.sleep();
|
|
258
|
-
this._destroyed = true;
|
|
259
|
-
this._hostKeyDownListener = null;
|
|
260
|
-
this._hostMouseDownListener = null;
|
|
261
|
-
this._documentClickListener = null;
|
|
262
|
-
this._documentTouchStartListener = null;
|
|
263
|
-
this._documentTouchMoveListener = null;
|
|
264
|
-
this._documentTouchEndListener = null;
|
|
265
|
-
this._hostClickListener = null;
|
|
266
|
-
this._hostFocusListener = null;
|
|
267
|
-
this._hostHoverListener = null;
|
|
268
|
-
this._focusExitListener = null;
|
|
269
|
-
this._mouseLeaveListener = null;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
exports.src_default = src_default;
|
package/label-C0AS4fnO.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const React = require("react");
|
|
3
|
-
const classNames = require("classnames");
|
|
4
|
-
const Label = ({ className, children, stacked = false, required = false, position = "start", ...rest }) => {
|
|
5
|
-
const wrapperClassName = classNames(`field__label`, className, { "field__label--stacked": stacked }, { "field__label--end": position === "end" });
|
|
6
|
-
const requiredMark = required ? React.createElement(
|
|
7
|
-
React.Fragment,
|
|
8
|
-
null,
|
|
9
|
-
" ",
|
|
10
|
-
React.createElement("sup", null, "*")
|
|
11
|
-
) : null;
|
|
12
|
-
return React.createElement(
|
|
13
|
-
"label",
|
|
14
|
-
{ className: wrapperClassName, ...rest },
|
|
15
|
-
children,
|
|
16
|
-
requiredMark
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
exports.Label = Label;
|