@rededor/cura 1.8.2-alpha.0 → 2.0.0-alpha.4
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/dist/cjs/{cura-accordion_20.cjs.entry.js → cura-accordion_21.cjs.entry.js} +1815 -20
- package/dist/cjs/cura-accordion_21.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-modal.cjs.entry.js +10 -2
- package/dist/cjs/cura-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/cura.cjs.js +1 -1
- package/dist/cjs/index-BK9MSAiE.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/cura-dropdown-search/cura-dropdown-search.css +1 -1
- package/dist/collection/components/cura-dropdown-search/cura-dropdown-search.js +24 -4
- package/dist/collection/components/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
- package/dist/collection/components/cura-modal/cura-modal.js +30 -2
- package/dist/collection/components/cura-modal/cura-modal.js.map +1 -1
- package/dist/collection/components/cura-modal/cura-modal.stories.js +10 -0
- package/dist/collection/components/cura-modal/cura-modal.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +1 -1
- package/dist/collection/components/forms/cura-select/cura-select.css +3 -148
- package/dist/collection/components/forms/cura-select/cura-select.js +103 -11
- package/dist/collection/components/forms/cura-select/cura-select.js.map +1 -1
- package/dist/collection/components/forms/cura-select-options/cura-select-option.css +15 -0
- package/dist/components/cura-calendar.js +1 -1
- package/dist/components/cura-dropdown-search.js +25 -5
- package/dist/components/cura-dropdown-search.js.map +1 -1
- package/dist/components/cura-input-date.js +3 -3
- package/dist/components/cura-modal.js +11 -2
- package/dist/components/cura-modal.js.map +1 -1
- package/dist/components/cura-select-option.js +1 -1
- package/dist/components/cura-select.js +1 -1
- package/dist/components/p-CvdWbsfO.js +2147 -0
- package/dist/components/p-CvdWbsfO.js.map +1 -0
- package/dist/components/p-D1cPOZpG.js.map +1 -1
- package/dist/components/{p-BGnJiNyu.js → p-DETZu2ie.js} +4 -4
- package/dist/components/{p-BGnJiNyu.js.map → p-DETZu2ie.js.map} +1 -1
- package/dist/components/{p-DpIu_Oxz.js → p-Dt450DkQ.js} +3 -3
- package/dist/components/p-Dt450DkQ.js.map +1 -0
- package/dist/cura/cura-modal.entry.esm.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/p-2ab58335.entry.js +2 -0
- package/dist/cura/p-2ab58335.entry.js.map +1 -0
- package/dist/cura/p-5ed7ce95.entry.js +2 -0
- package/dist/cura/p-5ed7ce95.entry.js.map +1 -0
- package/dist/cura/p-PPMZr_VE.js.map +1 -1
- package/dist/esm/{cura-accordion_20.entry.js → cura-accordion_21.entry.js} +1815 -21
- package/dist/esm/cura-accordion_21.entry.js.map +1 -0
- package/dist/esm/cura-modal.entry.js +10 -2
- package/dist/esm/cura-modal.entry.js.map +1 -1
- package/dist/esm/cura.js +1 -1
- package/dist/esm/index-OdKytJIH.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cura-dropdown-search/cura-dropdown-search.d.ts +2 -0
- package/dist/types/components/cura-modal/cura-modal.d.ts +5 -0
- package/dist/types/components/cura-modal/cura-modal.stories.d.ts +11 -0
- package/dist/types/components/forms/cura-select/cura-select.d.ts +21 -0
- package/dist/types/components.d.ts +10 -0
- package/package.json +3 -2
- package/dist/cjs/cura-accordion_20.cjs.entry.js.map +0 -1
- package/dist/cjs/cura-card.cjs.entry.js +0 -81
- package/dist/cjs/cura-card.cjs.entry.js.map +0 -1
- package/dist/cjs/cura-card.entry.cjs.js.map +0 -1
- package/dist/components/p-BTt-pVTn.js +0 -442
- package/dist/components/p-BTt-pVTn.js.map +0 -1
- package/dist/components/p-DpIu_Oxz.js.map +0 -1
- package/dist/cura/cura-card.entry.esm.js.map +0 -1
- package/dist/cura/p-d8aeca82.entry.js +0 -2
- package/dist/cura/p-d8aeca82.entry.js.map +0 -1
- package/dist/cura/p-deb0b764.entry.js +0 -2
- package/dist/cura/p-deb0b764.entry.js.map +0 -1
- package/dist/cura/p-df7cb250.entry.js +0 -2
- package/dist/cura/p-df7cb250.entry.js.map +0 -1
- package/dist/esm/cura-accordion_20.entry.js.map +0 -1
- package/dist/esm/cura-card.entry.js +0 -79
- package/dist/esm/cura-card.entry.js.map +0 -1
|
@@ -557,6 +557,78 @@ const CuraButtonTransparent = class {
|
|
|
557
557
|
};
|
|
558
558
|
CuraButtonTransparent.style = curaButtonTransparentCss;
|
|
559
559
|
|
|
560
|
+
const curaCardCss = ":host{display:block;box-sizing:border-box;font-size:var(--font-size);font-family:var(--font-family)}:host ::slotted(*){display:flex;align-items:center;justify-content:center;font-size:var(--font-size);font-family:var(--font-family)}a{display:block;text-decoration:none !important;color:inherit}.solid{background-color:var(--neutral-purewhite);border:2px solid var(--neutral-base);border-radius:12px;overflow:hidden;padding:0px;box-shadow:none}.solid ::slotted(*){border-radius:0}.solid.hasPadding{padding:20px}.solid.hasPadding ::slotted(*){border-radius:4px !important}.solid.hasShadow{border:2px solid var(--neutral-base);box-shadow:0px 1px 4px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16))}.solid.cardLink{background-color:var(--neutral-purewhite);border:2px solid var(--primary-base);border-radius:12px;padding:0px;box-shadow:none;cursor:pointer}.solid.cardLink ::slotted(*){border-radius:0px}.solid.cardLink:hover{border:2px solid var(--primary-lighter) !important}.solid.cardLink.hasPadding{padding:20px}.solid.cardLink.hasPadding ::slotted(*){border-radius:4px !important}.solid.cardLink.hasPadding:hover{border:2px solid var(--primary-lighter) !important}.solid.cardLink.hasShadow{border:2px solid var(--primary-base);box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16))}.solid.cardLink:not(.hasPadding).hasShadow ::slotted(*){border-radius:12px !important}.solid.cardLink.dark{background-color:var(--neutral-purewhite);border:2px solid var(--neutral-purewhite)}.solid.cardLink.dark:hover{border:2px solid var(--primary-lighter)}.transparent{background-color:transparent;border:0;border-radius:12px;padding:0px;overflow:hidden}.transparent ::slotted(*){border-radius:12px}.transparent.hasPadding{padding:20px}.transparent.hasPadding ::slotted(*){border-radius:4px}.transparent.cardLink{background-color:transparent;border:2px solid var(--primary-base);overflow:hidden;border-radius:12px;padding:0px;box-shadow:none}.transparent.cardLink ::slotted(*){border-radius:0px !important}.transparent.cardLink:hover{border:2px solid var(--primary-lighter) !important}.transparent.cardLink.light{background-color:var(--neutral-purewhite);border:2px solid var(--primary-base)}.transparent.cardLink.light ::slotted(*){border-radius:12px !important}.transparent.cardLink.light:hover{border-color:var(--primary-lighter) !important}.transparent.cardLink.dark{background-color:transparent;border:2px solid var(--neutral-purewhite)}.transparent.cardLink.dark:hover{border:0}.transparent.cardLink.hasPadding{padding:20px}.transparent.cardLink.hasPadding ::slotted(*){border-radius:4px !important}";
|
|
561
|
+
|
|
562
|
+
const CuraCard = class {
|
|
563
|
+
constructor(hostRef) {
|
|
564
|
+
registerInstance(this, hostRef);
|
|
565
|
+
/**
|
|
566
|
+
* Determines whether the card should have padding.
|
|
567
|
+
* @type {boolean}
|
|
568
|
+
* @default false
|
|
569
|
+
*/
|
|
570
|
+
this.hasPadding = true;
|
|
571
|
+
/**
|
|
572
|
+
* Determines whether the card should have a shadow effect.
|
|
573
|
+
* @type {boolean}
|
|
574
|
+
* @default false
|
|
575
|
+
*/
|
|
576
|
+
this.hasShadow = false;
|
|
577
|
+
/**
|
|
578
|
+
* Sets the type of the card background.
|
|
579
|
+
* - 'solid': A solid background.
|
|
580
|
+
* - 'transparent': A transparent background.
|
|
581
|
+
* @type {'solid' | 'transparent'}
|
|
582
|
+
* @default 'solid'
|
|
583
|
+
*/
|
|
584
|
+
this.type = 'solid';
|
|
585
|
+
/**
|
|
586
|
+
* Sets the color mode of the card.
|
|
587
|
+
* - 'light': Light mode for the card.
|
|
588
|
+
* - 'dark': Dark mode for the card.
|
|
589
|
+
* @type {'light' | 'dark'}
|
|
590
|
+
* @default 'light'
|
|
591
|
+
*/
|
|
592
|
+
this.colorMode = 'light';
|
|
593
|
+
/**
|
|
594
|
+
* The target attribute for the link.
|
|
595
|
+
* Applicable only if `href` is set.
|
|
596
|
+
* @type {string}
|
|
597
|
+
* @default '_self'
|
|
598
|
+
*/
|
|
599
|
+
this.target = '_self';
|
|
600
|
+
this.styles = {};
|
|
601
|
+
}
|
|
602
|
+
connectedCallback() {
|
|
603
|
+
this.weights = window.CuraAPI.theme.fonts.getWeights();
|
|
604
|
+
this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();
|
|
605
|
+
this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);
|
|
606
|
+
this.styles['--neutral-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);
|
|
607
|
+
this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);
|
|
608
|
+
this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor(`neutral-dark`);
|
|
609
|
+
this.styles['--neutral-black'] = window.CuraAPI.theme.colors.getColor(`neutral-black`);
|
|
610
|
+
this.styles['--neutral-black-shadow'] = window.CuraAPI.theme.colors.getColor(`neutral-black`, 0.16);
|
|
611
|
+
this.styles['--primary-lighter'] = window.CuraAPI.theme.colors.getColor(`primary-lighter`);
|
|
612
|
+
this.styles['--primary-base'] = window.CuraAPI.theme.colors.getColor(`primary-base`);
|
|
613
|
+
this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();
|
|
614
|
+
this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();
|
|
615
|
+
this.styles['--font-weight-medium'] = this.weights.medium;
|
|
616
|
+
}
|
|
617
|
+
getClasses() {
|
|
618
|
+
const classes = {};
|
|
619
|
+
classes[this.type] = true;
|
|
620
|
+
classes[`cardLink`] = this.href;
|
|
621
|
+
classes[this.colorMode] = true;
|
|
622
|
+
classes[`hasPadding`] = this.hasPadding;
|
|
623
|
+
classes[`hasShadow`] = this.hasShadow;
|
|
624
|
+
return classes;
|
|
625
|
+
}
|
|
626
|
+
render() {
|
|
627
|
+
return (h(Host, { key: '9478ce754c108db722dbc5bcbb00a0884b6c6f38', role: this.href ? 'link' : 'div' }, this.href ? (h("a", { class: this.getClasses(), target: this.target, style: this.styles, href: this.href }, h("slot", null))) : (h("div", { class: this.getClasses(), style: this.styles }, h("slot", null)))));
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
CuraCard.style = curaCardCss;
|
|
631
|
+
|
|
560
632
|
function checkMobile() {
|
|
561
633
|
return (window === null || window === void 0 ? void 0 : window.innerWidth) < Static.breakpoints.medium.min;
|
|
562
634
|
}
|
|
@@ -648,7 +720,7 @@ class FixedElementScrollBehavior {
|
|
|
648
720
|
}
|
|
649
721
|
}
|
|
650
722
|
|
|
651
|
-
const curaDropdownSearchCss = ":host{display:block;box-sizing:border-box;position:relative}:host .component-controls{display:flex;align-items:center;justify-content:center;gap:calc(var(--cura-spacing-base) * 1px)}:host .component-controls #button-back{padding:0 0 0 calc(var(--cura-spacing-base) * 3px);width:max-content}:host .component-container{box-sizing:border-box;width:100%;position:relative;display:grid;grid-template-columns:1fr;grid-template-rows:min-content 1fr}:host .component-container.zoom{position:fixed;top:0;left:0;width:100vw;background:var(--purewhite);height:var(--height);z-index:9999;overscroll-behavior:contain}:host .component-container.zoom .component-controls{border-bottom:2px solid var(--primary);padding:calc(var(--cura-spacing-base) * 3px) 0}:host .component-container.zoom.error .component-controls{border-bottom:2px solid var(--error-dark);background-color:var(--error-lighter)}:host .component-container .dropdown-container{box-sizing:border-box;width:100%;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column;padding:calc(var(--cura-spacing-base) * 3px);overscroll-behavior:contain}:host .component-container:not(.zoom) .dropdown-container{box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16));position:absolute;bottom:0;left:0;transform:translateY(100%);max-height:var(--max-height);background-color:var(--purewhite);border-radius:0px 0px calc(var(--cura-spacing-base) * 1px) calc(var(--cura-spacing-base) * 1px);border-bottom:2px solid var(--neutral-light);border-left:2px solid var(--neutral-light);border-right:2px solid var(--neutral-light);display:none;z-index:9997}:host .component-container:not(.zoom).dropdown-visible ::part(cura-input-field){border-radius:4px 4px 0px 0px}:host .component-container:not(.zoom).dropdown-visible ::part(cura-input-text-helper){height:0px;overflow:hidden;margin-top:0px}:host .component-container:not(.zoom).dropdown-visible .dropdown-container{display:block}";
|
|
723
|
+
const curaDropdownSearchCss = ":host{display:block;box-sizing:border-box;position:relative}:host .component-controls{display:flex;align-items:center;justify-content:center;gap:calc(var(--cura-spacing-base) * 1px)}:host .component-controls #button-back{padding:0 0 0 calc(var(--cura-spacing-base) * 3px);width:max-content}:host .component-container{box-sizing:border-box;width:100%;position:relative;display:grid;grid-template-columns:1fr;grid-template-rows:min-content 1fr}:host .component-container.zoom{position:fixed;top:var(--top-offset, 0);left:0;width:100vw;background:var(--purewhite);height:var(--height);z-index:9999;overscroll-behavior:contain}:host .component-container.zoom .component-controls{border-bottom:2px solid var(--primary);padding:calc(var(--cura-spacing-base) * 3px) 0}:host .component-container.zoom.error .component-controls{border-bottom:2px solid var(--error-dark);background-color:var(--error-lighter)}:host .component-container .dropdown-container{box-sizing:border-box;width:100%;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column;padding:calc(var(--cura-spacing-base) * 3px);overscroll-behavior:contain}:host .component-container:not(.zoom) .dropdown-container{box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16));position:absolute;bottom:0;left:0;transform:translateY(100%);max-height:var(--max-height);background-color:var(--purewhite);border-radius:0px 0px calc(var(--cura-spacing-base) * 1px) calc(var(--cura-spacing-base) * 1px);border-bottom:2px solid var(--neutral-light);border-left:2px solid var(--neutral-light);border-right:2px solid var(--neutral-light);display:none;z-index:9997}:host .component-container:not(.zoom).dropdown-visible ::part(cura-input-field){border-radius:4px 4px 0px 0px}:host .component-container:not(.zoom).dropdown-visible ::part(cura-input-text-helper){height:0px;overflow:hidden;margin-top:0px}:host .component-container:not(.zoom).dropdown-visible .dropdown-container{display:block}";
|
|
652
724
|
|
|
653
725
|
const CuraDropdownSearch = class {
|
|
654
726
|
constructor(hostRef) {
|
|
@@ -724,6 +796,13 @@ const CuraDropdownSearch = class {
|
|
|
724
796
|
this.setZoomHeight();
|
|
725
797
|
}, this.resizeTimeoutMs);
|
|
726
798
|
};
|
|
799
|
+
this.handleVisualViewportChange = () => {
|
|
800
|
+
if (!this.zoomState)
|
|
801
|
+
return;
|
|
802
|
+
if (this.viewportTimeout)
|
|
803
|
+
clearTimeout(this.viewportTimeout);
|
|
804
|
+
this.viewportTimeout = setTimeout(() => this.setZoomHeight(), this.resizeTimeoutMs);
|
|
805
|
+
};
|
|
727
806
|
this.handleFocus = () => {
|
|
728
807
|
if (this.focusTimeout)
|
|
729
808
|
clearTimeout(this.focusTimeout);
|
|
@@ -822,6 +901,10 @@ const CuraDropdownSearch = class {
|
|
|
822
901
|
this.styles['--font-weight-medium'] = this.weights.medium;
|
|
823
902
|
window === null || window === void 0 ? void 0 : window.addEventListener('resize', this.handleWindowResize);
|
|
824
903
|
window === null || window === void 0 ? void 0 : window.addEventListener('orientationchange', this.handleWindowResize);
|
|
904
|
+
if (window === null || window === void 0 ? void 0 : window.visualViewport) {
|
|
905
|
+
window.visualViewport.addEventListener('resize', this.handleVisualViewportChange);
|
|
906
|
+
window.visualViewport.addEventListener('scroll', this.handleVisualViewportChange);
|
|
907
|
+
}
|
|
825
908
|
this.isMobile = checkMobile();
|
|
826
909
|
}
|
|
827
910
|
componentDidLoad() {
|
|
@@ -838,6 +921,10 @@ const CuraDropdownSearch = class {
|
|
|
838
921
|
removeAllListeners() {
|
|
839
922
|
window === null || window === void 0 ? void 0 : window.removeEventListener('resize', this.handleWindowResize);
|
|
840
923
|
window === null || window === void 0 ? void 0 : window.removeEventListener('orientationchange', this.handleWindowResize);
|
|
924
|
+
if (window === null || window === void 0 ? void 0 : window.visualViewport) {
|
|
925
|
+
window.visualViewport.removeEventListener('resize', this.handleVisualViewportChange);
|
|
926
|
+
window.visualViewport.removeEventListener('scroll', this.handleVisualViewportChange);
|
|
927
|
+
}
|
|
841
928
|
this.host.removeEventListener('actionclick', this.handleOptionActionClick);
|
|
842
929
|
this.host.removeEventListener('selectoption', this.handleSelectOption);
|
|
843
930
|
}
|
|
@@ -942,9 +1029,14 @@ const CuraDropdownSearch = class {
|
|
|
942
1029
|
setTimeout(() => { this.zoomState = false; }, 300);
|
|
943
1030
|
}
|
|
944
1031
|
setZoomHeight() {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1032
|
+
if (window === null || window === void 0 ? void 0 : window.visualViewport) {
|
|
1033
|
+
const height = `${window.visualViewport.height}px`;
|
|
1034
|
+
const topOffset = `${window.visualViewport.offsetTop}px`;
|
|
1035
|
+
this.styles = Object.assign(Object.assign({}, this.styles), { '--height': height, '--top-offset': topOffset });
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
const h = window ? `${window.innerHeight}px` : '100vh';
|
|
1039
|
+
this.styles = Object.assign(Object.assign({}, this.styles), { '--height': h, '--top-offset': '0px' });
|
|
948
1040
|
}
|
|
949
1041
|
getClasses() {
|
|
950
1042
|
return {
|
|
@@ -961,7 +1053,7 @@ const CuraDropdownSearch = class {
|
|
|
961
1053
|
};
|
|
962
1054
|
}
|
|
963
1055
|
render() {
|
|
964
|
-
return (h(Host, { key: '
|
|
1056
|
+
return (h(Host, { key: '6313c87b8faed7e0ddb00cf3fc40c4693712630d', style: this.getHostCSSProperties(), role: "search", "aria-label": this.label, "aria-required": this.required, "aria-disabled": this.disabled, "aria-expanded": this.zoomState }, h("div", { key: '5c052f24e62ee31aa83b4dfbfb0c0eccca506c03', class: this.getClasses(), style: this.styles }, h("div", { key: '8b71f51e5a49d8c84a623ae4ef75f22d2daff692', class: "component-controls" }, this.isMobile && this.zoomState ? (h("cura-button-transparent", { fontColor: "dark", onClick: () => this.handleBackClick(), iconName: "arrowLeft", size: "large", iconOnly: true, color: "primary", id: "button-back" })) : '', h("cura-input-text", { key: '96cf125a4c7f58a312ed6a45cd9dec62a279dc3b', disabled: this.disabled, label: this.label, part: "cura-input-field", mode: this.zoomState ? 'transparent' : 'default', required: this.required, iconName: this.icon || 'search', value: this.value, status: this.status, onValueChange: (ev) => this.handleInputValueChange(ev), onInput: (ev) => this._preventEvent(ev), onFocus: () => this.handleFocus(), onClick: (ev) => this._preventEvent(ev), onBlur: () => this.handleBlur(), onFocusout: () => this.handleFocusout(), onInputClear: (ev) => this.handleInputClear(ev), placeholder: this.placeholder, size: this.size, onKeyDown: (ev) => this.handleKeyDown(ev) }, h("slot", { key: 'e7ee08e0fb309f3931c82bfbcca9ff4f104f1397', name: "helperText" }))), h("div", { key: 'e9364997fcad9c019c3e20f7d46a6e6ab3e8462b', class: "dropdown-container", onMouseOver: () => this.handleDropdownMouseOver() }, h("slot", { key: '627eb3f588059c29194656d9e85fdfc2b9115804', onSlotchange: () => this.handleSlotChange() })))));
|
|
965
1057
|
}
|
|
966
1058
|
get host() { return getElement(this); }
|
|
967
1059
|
};
|
|
@@ -5432,7 +5524,1621 @@ const CuraParagraph = class {
|
|
|
5432
5524
|
};
|
|
5433
5525
|
CuraParagraph.style = curaParagraphCss;
|
|
5434
5526
|
|
|
5435
|
-
const curaSelectCss = ":host{display:block;position:relative;font-family:var(--font-family)}.wrapper{width:100%;user-select:none;text-align:left !important}.wrapper cura-label{margin-bottom:8px}.wrapper .helper-text{margin-top:8px;color:var(--neutral-dark)}.wrapper .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper .cura-input-field .feedback-icon{padding-left:12px}.wrapper .cura-input-field .up-down-icon{order:3;padding-right:6px;cursor:pointer;pointer-events:all}.wrapper .cura-input-field .up-down-button{background-color:transparent;border:none}.wrapper .cura-input-field input{padding:0px 12px 0px 8px;cursor:pointer}.wrapper .cura-input-field.open{border-radius:4px 4px 0 0 !important}.wrapper.transparent{background-color:transparent;padding:0px;max-height:80px}.wrapper.transparent .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;background-color:transparent !important;border:none !important;border-radius:0;height:27px}.wrapper.transparent .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.transparent .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.transparent .cura-input-field .feedback-icon{padding-left:12px}.wrapper.transparent .cura-input-field input{color:var(--neutral-black) !important;font-size:16px;font-weight:var(--font-weight-bold) !important;padding:0}.wrapper.transparent .cura-input-field input::placeholder{color:var(--neutral-black)}.wrapper.transparent .cura-input-field .feedback-icon{order:3;margin:0 20px 0 0}.wrapper.transparent:focus-within .cura-input-field{border:none !important;background-color:transparent !important}.wrapper.transparent:focus-within .cura-input-field input{border:none !important;outline:none}.wrapper.transparent .helper-text{margin-top:0px}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field{border-color:var(--neutral-dark)}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field input{color:var(--neutral-dark)}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper:focus-within:not(.selection) .cura-input-field{border:2px solid var(--info-base) !important;background-color:var(--neutral-purewhite);outline:none}.wrapper:focus-within:not(.selection) .cura-input-field input{color:var(--neutral-black) !important}.wrapper:focus-within.selection .cura-input-field{border-radius:4px 4px 0px 0px}.wrapper.success .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.success .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.success .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.success .cura-input-field .feedback-icon{padding-left:12px}.wrapper.success .cura-input-field input{color:var(--success-darker) !important}.wrapper.success .cura-input-field input::placeholder{color:var(--success-darker) !important}.wrapper.success:not(.transparent) .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;border:2px solid var(--success-dark) !important;background-color:var(--success-lighter) !important}.wrapper.success:not(.transparent) .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.success:not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.success:not(.transparent) .cura-input-field .feedback-icon{padding-left:12px}.wrapper.error .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.error .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.error .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.error .cura-input-field .feedback-icon{padding-left:12px}.wrapper.error .cura-input-field input{color:var(--error-darker) !important}.wrapper.error .cura-input-field input::placeholder{color:var(--error-darker) !important}.wrapper.error:not(.transparent) .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;border:2px solid var(--error-dark) !important;background-color:var(--error-lighter) !important}.wrapper.error:not(.transparent) .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.error:not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.error:not(.transparent) .cura-input-field .feedback-icon{padding-left:12px}.wrapper.small .cura-input-field{width:100%;height:32px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.small .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:12px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.small .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.small .cura-input-field .feedback-icon{padding-left:12px}.wrapper.small .cura-input-field input{line-height:13px;letter-spacing:0.72px}.wrapper.small .helper-text{margin-top:8px;color:var(--neutral-dark);font-weight:var(--font-weight-regular)}.wrapper.small.label .menu{top:53px}.wrapper.small .menu{top:33px}.wrapper.medium .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.medium .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.medium .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.medium .cura-input-field .feedback-icon{padding-left:12px}.wrapper.medium .cura-input-field input{line-height:16px;letter-spacing:0.56px}.wrapper.medium .helper-text{margin-top:8px;color:var(--neutral-dark);font-weight:var(--font-weight-regular)}.wrapper.medium.label .menu{top:61px}.wrapper.medium .menu{top:40px}.wrapper.large .cura-input-field{width:100%;height:44px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.large .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:16px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.large .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.large .cura-input-field .feedback-icon{padding-left:12px}.wrapper.large .helper-text{margin-top:8px;color:var(--neutral-dark);font-weight:var(--font-weight-bold)}.wrapper.large.label .menu{top:69px}.wrapper.large .menu{top:47px}.wrapper.disabled .cura-input-field{background-color:var(--neutral-white);border:2px solid var(--neutral-base)}.wrapper.disabled .cura-input-field input{color:var(--neutral-medium)}.wrapper.disabled .cura-input-field input::placeholder{color:var(--neutral-medium)}.required{color:red}.menu{position:absolute;left:0;right:-1px;background:#fff;border:2px solid var(--neutral-light);border-radius:4px;z-index:1000;max-height:var(--max-height);overflow:hidden;border-top:transparent;align-items:center;scrollbar-color:var(--neutral-medium) var(--neutral-black-20);overflow-y:auto;box-shadow:0px 4px 8px 0px rgba(38, 38, 38, 0.16)}.menu.open{border-radius:0 !important;padding:12px}";
|
|
5527
|
+
/**
|
|
5528
|
+
* Custom positioning reference element.
|
|
5529
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
5530
|
+
*/
|
|
5531
|
+
|
|
5532
|
+
const min = Math.min;
|
|
5533
|
+
const max = Math.max;
|
|
5534
|
+
const round = Math.round;
|
|
5535
|
+
const floor = Math.floor;
|
|
5536
|
+
const createCoords = v => ({
|
|
5537
|
+
x: v,
|
|
5538
|
+
y: v
|
|
5539
|
+
});
|
|
5540
|
+
const oppositeSideMap = {
|
|
5541
|
+
left: 'right',
|
|
5542
|
+
right: 'left',
|
|
5543
|
+
bottom: 'top',
|
|
5544
|
+
top: 'bottom'
|
|
5545
|
+
};
|
|
5546
|
+
const oppositeAlignmentMap = {
|
|
5547
|
+
start: 'end',
|
|
5548
|
+
end: 'start'
|
|
5549
|
+
};
|
|
5550
|
+
function clamp(start, value, end) {
|
|
5551
|
+
return max(start, min(value, end));
|
|
5552
|
+
}
|
|
5553
|
+
function evaluate(value, param) {
|
|
5554
|
+
return typeof value === 'function' ? value(param) : value;
|
|
5555
|
+
}
|
|
5556
|
+
function getSide(placement) {
|
|
5557
|
+
return placement.split('-')[0];
|
|
5558
|
+
}
|
|
5559
|
+
function getAlignment(placement) {
|
|
5560
|
+
return placement.split('-')[1];
|
|
5561
|
+
}
|
|
5562
|
+
function getOppositeAxis(axis) {
|
|
5563
|
+
return axis === 'x' ? 'y' : 'x';
|
|
5564
|
+
}
|
|
5565
|
+
function getAxisLength(axis) {
|
|
5566
|
+
return axis === 'y' ? 'height' : 'width';
|
|
5567
|
+
}
|
|
5568
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
5569
|
+
function getSideAxis(placement) {
|
|
5570
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
5571
|
+
}
|
|
5572
|
+
function getAlignmentAxis(placement) {
|
|
5573
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
5574
|
+
}
|
|
5575
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
5576
|
+
if (rtl === void 0) {
|
|
5577
|
+
rtl = false;
|
|
5578
|
+
}
|
|
5579
|
+
const alignment = getAlignment(placement);
|
|
5580
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
5581
|
+
const length = getAxisLength(alignmentAxis);
|
|
5582
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
5583
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
5584
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
5585
|
+
}
|
|
5586
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
5587
|
+
}
|
|
5588
|
+
function getExpandedPlacements(placement) {
|
|
5589
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
5590
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
5591
|
+
}
|
|
5592
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
5593
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
5594
|
+
}
|
|
5595
|
+
const lrPlacement = ['left', 'right'];
|
|
5596
|
+
const rlPlacement = ['right', 'left'];
|
|
5597
|
+
const tbPlacement = ['top', 'bottom'];
|
|
5598
|
+
const btPlacement = ['bottom', 'top'];
|
|
5599
|
+
function getSideList(side, isStart, rtl) {
|
|
5600
|
+
switch (side) {
|
|
5601
|
+
case 'top':
|
|
5602
|
+
case 'bottom':
|
|
5603
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
5604
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
5605
|
+
case 'left':
|
|
5606
|
+
case 'right':
|
|
5607
|
+
return isStart ? tbPlacement : btPlacement;
|
|
5608
|
+
default:
|
|
5609
|
+
return [];
|
|
5610
|
+
}
|
|
5611
|
+
}
|
|
5612
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
5613
|
+
const alignment = getAlignment(placement);
|
|
5614
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
5615
|
+
if (alignment) {
|
|
5616
|
+
list = list.map(side => side + "-" + alignment);
|
|
5617
|
+
if (flipAlignment) {
|
|
5618
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
5619
|
+
}
|
|
5620
|
+
}
|
|
5621
|
+
return list;
|
|
5622
|
+
}
|
|
5623
|
+
function getOppositePlacement(placement) {
|
|
5624
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
5625
|
+
}
|
|
5626
|
+
function expandPaddingObject(padding) {
|
|
5627
|
+
return {
|
|
5628
|
+
top: 0,
|
|
5629
|
+
right: 0,
|
|
5630
|
+
bottom: 0,
|
|
5631
|
+
left: 0,
|
|
5632
|
+
...padding
|
|
5633
|
+
};
|
|
5634
|
+
}
|
|
5635
|
+
function getPaddingObject(padding) {
|
|
5636
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
5637
|
+
top: padding,
|
|
5638
|
+
right: padding,
|
|
5639
|
+
bottom: padding,
|
|
5640
|
+
left: padding
|
|
5641
|
+
};
|
|
5642
|
+
}
|
|
5643
|
+
function rectToClientRect(rect) {
|
|
5644
|
+
const {
|
|
5645
|
+
x,
|
|
5646
|
+
y,
|
|
5647
|
+
width,
|
|
5648
|
+
height
|
|
5649
|
+
} = rect;
|
|
5650
|
+
return {
|
|
5651
|
+
width,
|
|
5652
|
+
height,
|
|
5653
|
+
top: y,
|
|
5654
|
+
left: x,
|
|
5655
|
+
right: x + width,
|
|
5656
|
+
bottom: y + height,
|
|
5657
|
+
x,
|
|
5658
|
+
y
|
|
5659
|
+
};
|
|
5660
|
+
}
|
|
5661
|
+
|
|
5662
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
5663
|
+
let {
|
|
5664
|
+
reference,
|
|
5665
|
+
floating
|
|
5666
|
+
} = _ref;
|
|
5667
|
+
const sideAxis = getSideAxis(placement);
|
|
5668
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
5669
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
5670
|
+
const side = getSide(placement);
|
|
5671
|
+
const isVertical = sideAxis === 'y';
|
|
5672
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
5673
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
5674
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
5675
|
+
let coords;
|
|
5676
|
+
switch (side) {
|
|
5677
|
+
case 'top':
|
|
5678
|
+
coords = {
|
|
5679
|
+
x: commonX,
|
|
5680
|
+
y: reference.y - floating.height
|
|
5681
|
+
};
|
|
5682
|
+
break;
|
|
5683
|
+
case 'bottom':
|
|
5684
|
+
coords = {
|
|
5685
|
+
x: commonX,
|
|
5686
|
+
y: reference.y + reference.height
|
|
5687
|
+
};
|
|
5688
|
+
break;
|
|
5689
|
+
case 'right':
|
|
5690
|
+
coords = {
|
|
5691
|
+
x: reference.x + reference.width,
|
|
5692
|
+
y: commonY
|
|
5693
|
+
};
|
|
5694
|
+
break;
|
|
5695
|
+
case 'left':
|
|
5696
|
+
coords = {
|
|
5697
|
+
x: reference.x - floating.width,
|
|
5698
|
+
y: commonY
|
|
5699
|
+
};
|
|
5700
|
+
break;
|
|
5701
|
+
default:
|
|
5702
|
+
coords = {
|
|
5703
|
+
x: reference.x,
|
|
5704
|
+
y: reference.y
|
|
5705
|
+
};
|
|
5706
|
+
}
|
|
5707
|
+
switch (getAlignment(placement)) {
|
|
5708
|
+
case 'start':
|
|
5709
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
5710
|
+
break;
|
|
5711
|
+
case 'end':
|
|
5712
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
5713
|
+
break;
|
|
5714
|
+
}
|
|
5715
|
+
return coords;
|
|
5716
|
+
}
|
|
5717
|
+
|
|
5718
|
+
/**
|
|
5719
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
5720
|
+
* next to a given reference element.
|
|
5721
|
+
*
|
|
5722
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
5723
|
+
* write one for the platform you are using Floating UI with.
|
|
5724
|
+
*/
|
|
5725
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
5726
|
+
const {
|
|
5727
|
+
placement = 'bottom',
|
|
5728
|
+
strategy = 'absolute',
|
|
5729
|
+
middleware = [],
|
|
5730
|
+
platform
|
|
5731
|
+
} = config;
|
|
5732
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
5733
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
5734
|
+
let rects = await platform.getElementRects({
|
|
5735
|
+
reference,
|
|
5736
|
+
floating,
|
|
5737
|
+
strategy
|
|
5738
|
+
});
|
|
5739
|
+
let {
|
|
5740
|
+
x,
|
|
5741
|
+
y
|
|
5742
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
5743
|
+
let statefulPlacement = placement;
|
|
5744
|
+
let middlewareData = {};
|
|
5745
|
+
let resetCount = 0;
|
|
5746
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
5747
|
+
const {
|
|
5748
|
+
name,
|
|
5749
|
+
fn
|
|
5750
|
+
} = validMiddleware[i];
|
|
5751
|
+
const {
|
|
5752
|
+
x: nextX,
|
|
5753
|
+
y: nextY,
|
|
5754
|
+
data,
|
|
5755
|
+
reset
|
|
5756
|
+
} = await fn({
|
|
5757
|
+
x,
|
|
5758
|
+
y,
|
|
5759
|
+
initialPlacement: placement,
|
|
5760
|
+
placement: statefulPlacement,
|
|
5761
|
+
strategy,
|
|
5762
|
+
middlewareData,
|
|
5763
|
+
rects,
|
|
5764
|
+
platform,
|
|
5765
|
+
elements: {
|
|
5766
|
+
reference,
|
|
5767
|
+
floating
|
|
5768
|
+
}
|
|
5769
|
+
});
|
|
5770
|
+
x = nextX != null ? nextX : x;
|
|
5771
|
+
y = nextY != null ? nextY : y;
|
|
5772
|
+
middlewareData = {
|
|
5773
|
+
...middlewareData,
|
|
5774
|
+
[name]: {
|
|
5775
|
+
...middlewareData[name],
|
|
5776
|
+
...data
|
|
5777
|
+
}
|
|
5778
|
+
};
|
|
5779
|
+
if (reset && resetCount <= 50) {
|
|
5780
|
+
resetCount++;
|
|
5781
|
+
if (typeof reset === 'object') {
|
|
5782
|
+
if (reset.placement) {
|
|
5783
|
+
statefulPlacement = reset.placement;
|
|
5784
|
+
}
|
|
5785
|
+
if (reset.rects) {
|
|
5786
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
5787
|
+
reference,
|
|
5788
|
+
floating,
|
|
5789
|
+
strategy
|
|
5790
|
+
}) : reset.rects;
|
|
5791
|
+
}
|
|
5792
|
+
({
|
|
5793
|
+
x,
|
|
5794
|
+
y
|
|
5795
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
5796
|
+
}
|
|
5797
|
+
i = -1;
|
|
5798
|
+
}
|
|
5799
|
+
}
|
|
5800
|
+
return {
|
|
5801
|
+
x,
|
|
5802
|
+
y,
|
|
5803
|
+
placement: statefulPlacement,
|
|
5804
|
+
strategy,
|
|
5805
|
+
middlewareData
|
|
5806
|
+
};
|
|
5807
|
+
};
|
|
5808
|
+
|
|
5809
|
+
/**
|
|
5810
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
5811
|
+
* element is overflowing a given clipping boundary on each side.
|
|
5812
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
5813
|
+
* - negative = how many pixels left before it will overflow
|
|
5814
|
+
* - 0 = lies flush with the boundary
|
|
5815
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
5816
|
+
*/
|
|
5817
|
+
async function detectOverflow(state, options) {
|
|
5818
|
+
var _await$platform$isEle;
|
|
5819
|
+
if (options === void 0) {
|
|
5820
|
+
options = {};
|
|
5821
|
+
}
|
|
5822
|
+
const {
|
|
5823
|
+
x,
|
|
5824
|
+
y,
|
|
5825
|
+
platform,
|
|
5826
|
+
rects,
|
|
5827
|
+
elements,
|
|
5828
|
+
strategy
|
|
5829
|
+
} = state;
|
|
5830
|
+
const {
|
|
5831
|
+
boundary = 'clippingAncestors',
|
|
5832
|
+
rootBoundary = 'viewport',
|
|
5833
|
+
elementContext = 'floating',
|
|
5834
|
+
altBoundary = false,
|
|
5835
|
+
padding = 0
|
|
5836
|
+
} = evaluate(options, state);
|
|
5837
|
+
const paddingObject = getPaddingObject(padding);
|
|
5838
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
5839
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
5840
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
5841
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
5842
|
+
boundary,
|
|
5843
|
+
rootBoundary,
|
|
5844
|
+
strategy
|
|
5845
|
+
}));
|
|
5846
|
+
const rect = elementContext === 'floating' ? {
|
|
5847
|
+
x,
|
|
5848
|
+
y,
|
|
5849
|
+
width: rects.floating.width,
|
|
5850
|
+
height: rects.floating.height
|
|
5851
|
+
} : rects.reference;
|
|
5852
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
5853
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
5854
|
+
x: 1,
|
|
5855
|
+
y: 1
|
|
5856
|
+
} : {
|
|
5857
|
+
x: 1,
|
|
5858
|
+
y: 1
|
|
5859
|
+
};
|
|
5860
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
5861
|
+
elements,
|
|
5862
|
+
rect,
|
|
5863
|
+
offsetParent,
|
|
5864
|
+
strategy
|
|
5865
|
+
}) : rect);
|
|
5866
|
+
return {
|
|
5867
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
5868
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
5869
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
5870
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
5871
|
+
};
|
|
5872
|
+
}
|
|
5873
|
+
|
|
5874
|
+
/**
|
|
5875
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
5876
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
5877
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
5878
|
+
* @see https://floating-ui.com/docs/flip
|
|
5879
|
+
*/
|
|
5880
|
+
const flip$1 = function (options) {
|
|
5881
|
+
if (options === void 0) {
|
|
5882
|
+
options = {};
|
|
5883
|
+
}
|
|
5884
|
+
return {
|
|
5885
|
+
name: 'flip',
|
|
5886
|
+
options,
|
|
5887
|
+
async fn(state) {
|
|
5888
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
5889
|
+
const {
|
|
5890
|
+
placement,
|
|
5891
|
+
middlewareData,
|
|
5892
|
+
rects,
|
|
5893
|
+
initialPlacement,
|
|
5894
|
+
platform,
|
|
5895
|
+
elements
|
|
5896
|
+
} = state;
|
|
5897
|
+
const {
|
|
5898
|
+
mainAxis: checkMainAxis = true,
|
|
5899
|
+
crossAxis: checkCrossAxis = true,
|
|
5900
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
5901
|
+
fallbackStrategy = 'bestFit',
|
|
5902
|
+
fallbackAxisSideDirection = 'none',
|
|
5903
|
+
flipAlignment = true,
|
|
5904
|
+
...detectOverflowOptions
|
|
5905
|
+
} = evaluate(options, state);
|
|
5906
|
+
|
|
5907
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
5908
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
5909
|
+
// work.
|
|
5910
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
5911
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
5912
|
+
return {};
|
|
5913
|
+
}
|
|
5914
|
+
const side = getSide(placement);
|
|
5915
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
5916
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
5917
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
5918
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
5919
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
5920
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
5921
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
5922
|
+
}
|
|
5923
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
5924
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
5925
|
+
const overflows = [];
|
|
5926
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
5927
|
+
if (checkMainAxis) {
|
|
5928
|
+
overflows.push(overflow[side]);
|
|
5929
|
+
}
|
|
5930
|
+
if (checkCrossAxis) {
|
|
5931
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
5932
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
5933
|
+
}
|
|
5934
|
+
overflowsData = [...overflowsData, {
|
|
5935
|
+
placement,
|
|
5936
|
+
overflows
|
|
5937
|
+
}];
|
|
5938
|
+
|
|
5939
|
+
// One or more sides is overflowing.
|
|
5940
|
+
if (!overflows.every(side => side <= 0)) {
|
|
5941
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
5942
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
5943
|
+
const nextPlacement = placements[nextIndex];
|
|
5944
|
+
if (nextPlacement) {
|
|
5945
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
5946
|
+
if (!ignoreCrossAxisOverflow ||
|
|
5947
|
+
// We leave the current main axis only if every placement on that axis
|
|
5948
|
+
// overflows the main axis.
|
|
5949
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
5950
|
+
// Try next placement and re-run the lifecycle.
|
|
5951
|
+
return {
|
|
5952
|
+
data: {
|
|
5953
|
+
index: nextIndex,
|
|
5954
|
+
overflows: overflowsData
|
|
5955
|
+
},
|
|
5956
|
+
reset: {
|
|
5957
|
+
placement: nextPlacement
|
|
5958
|
+
}
|
|
5959
|
+
};
|
|
5960
|
+
}
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5963
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
5964
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
5965
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
5966
|
+
|
|
5967
|
+
// Otherwise fallback.
|
|
5968
|
+
if (!resetPlacement) {
|
|
5969
|
+
switch (fallbackStrategy) {
|
|
5970
|
+
case 'bestFit':
|
|
5971
|
+
{
|
|
5972
|
+
var _overflowsData$filter2;
|
|
5973
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
5974
|
+
if (hasFallbackAxisSideDirection) {
|
|
5975
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
5976
|
+
return currentSideAxis === initialSideAxis ||
|
|
5977
|
+
// Create a bias to the `y` side axis due to horizontal
|
|
5978
|
+
// reading directions favoring greater width.
|
|
5979
|
+
currentSideAxis === 'y';
|
|
5980
|
+
}
|
|
5981
|
+
return true;
|
|
5982
|
+
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
5983
|
+
if (placement) {
|
|
5984
|
+
resetPlacement = placement;
|
|
5985
|
+
}
|
|
5986
|
+
break;
|
|
5987
|
+
}
|
|
5988
|
+
case 'initialPlacement':
|
|
5989
|
+
resetPlacement = initialPlacement;
|
|
5990
|
+
break;
|
|
5991
|
+
}
|
|
5992
|
+
}
|
|
5993
|
+
if (placement !== resetPlacement) {
|
|
5994
|
+
return {
|
|
5995
|
+
reset: {
|
|
5996
|
+
placement: resetPlacement
|
|
5997
|
+
}
|
|
5998
|
+
};
|
|
5999
|
+
}
|
|
6000
|
+
}
|
|
6001
|
+
return {};
|
|
6002
|
+
}
|
|
6003
|
+
};
|
|
6004
|
+
};
|
|
6005
|
+
|
|
6006
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
6007
|
+
|
|
6008
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
6009
|
+
// Derivable.
|
|
6010
|
+
|
|
6011
|
+
async function convertValueToCoords(state, options) {
|
|
6012
|
+
const {
|
|
6013
|
+
placement,
|
|
6014
|
+
platform,
|
|
6015
|
+
elements
|
|
6016
|
+
} = state;
|
|
6017
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
6018
|
+
const side = getSide(placement);
|
|
6019
|
+
const alignment = getAlignment(placement);
|
|
6020
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
6021
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
6022
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
6023
|
+
const rawValue = evaluate(options, state);
|
|
6024
|
+
|
|
6025
|
+
// eslint-disable-next-line prefer-const
|
|
6026
|
+
let {
|
|
6027
|
+
mainAxis,
|
|
6028
|
+
crossAxis,
|
|
6029
|
+
alignmentAxis
|
|
6030
|
+
} = typeof rawValue === 'number' ? {
|
|
6031
|
+
mainAxis: rawValue,
|
|
6032
|
+
crossAxis: 0,
|
|
6033
|
+
alignmentAxis: null
|
|
6034
|
+
} : {
|
|
6035
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
6036
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
6037
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
6038
|
+
};
|
|
6039
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
6040
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
6041
|
+
}
|
|
6042
|
+
return isVertical ? {
|
|
6043
|
+
x: crossAxis * crossAxisMulti,
|
|
6044
|
+
y: mainAxis * mainAxisMulti
|
|
6045
|
+
} : {
|
|
6046
|
+
x: mainAxis * mainAxisMulti,
|
|
6047
|
+
y: crossAxis * crossAxisMulti
|
|
6048
|
+
};
|
|
6049
|
+
}
|
|
6050
|
+
|
|
6051
|
+
/**
|
|
6052
|
+
* Modifies the placement by translating the floating element along the
|
|
6053
|
+
* specified axes.
|
|
6054
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
6055
|
+
* object may be passed.
|
|
6056
|
+
* @see https://floating-ui.com/docs/offset
|
|
6057
|
+
*/
|
|
6058
|
+
const offset$1 = function (options) {
|
|
6059
|
+
if (options === void 0) {
|
|
6060
|
+
options = 0;
|
|
6061
|
+
}
|
|
6062
|
+
return {
|
|
6063
|
+
name: 'offset',
|
|
6064
|
+
options,
|
|
6065
|
+
async fn(state) {
|
|
6066
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
6067
|
+
const {
|
|
6068
|
+
x,
|
|
6069
|
+
y,
|
|
6070
|
+
placement,
|
|
6071
|
+
middlewareData
|
|
6072
|
+
} = state;
|
|
6073
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
6074
|
+
|
|
6075
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
6076
|
+
// then we don't need to change the positioning coordinates.
|
|
6077
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
6078
|
+
return {};
|
|
6079
|
+
}
|
|
6080
|
+
return {
|
|
6081
|
+
x: x + diffCoords.x,
|
|
6082
|
+
y: y + diffCoords.y,
|
|
6083
|
+
data: {
|
|
6084
|
+
...diffCoords,
|
|
6085
|
+
placement
|
|
6086
|
+
}
|
|
6087
|
+
};
|
|
6088
|
+
}
|
|
6089
|
+
};
|
|
6090
|
+
};
|
|
6091
|
+
|
|
6092
|
+
/**
|
|
6093
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
6094
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
6095
|
+
* @see https://floating-ui.com/docs/shift
|
|
6096
|
+
*/
|
|
6097
|
+
const shift$1 = function (options) {
|
|
6098
|
+
if (options === void 0) {
|
|
6099
|
+
options = {};
|
|
6100
|
+
}
|
|
6101
|
+
return {
|
|
6102
|
+
name: 'shift',
|
|
6103
|
+
options,
|
|
6104
|
+
async fn(state) {
|
|
6105
|
+
const {
|
|
6106
|
+
x,
|
|
6107
|
+
y,
|
|
6108
|
+
placement
|
|
6109
|
+
} = state;
|
|
6110
|
+
const {
|
|
6111
|
+
mainAxis: checkMainAxis = true,
|
|
6112
|
+
crossAxis: checkCrossAxis = false,
|
|
6113
|
+
limiter = {
|
|
6114
|
+
fn: _ref => {
|
|
6115
|
+
let {
|
|
6116
|
+
x,
|
|
6117
|
+
y
|
|
6118
|
+
} = _ref;
|
|
6119
|
+
return {
|
|
6120
|
+
x,
|
|
6121
|
+
y
|
|
6122
|
+
};
|
|
6123
|
+
}
|
|
6124
|
+
},
|
|
6125
|
+
...detectOverflowOptions
|
|
6126
|
+
} = evaluate(options, state);
|
|
6127
|
+
const coords = {
|
|
6128
|
+
x,
|
|
6129
|
+
y
|
|
6130
|
+
};
|
|
6131
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
6132
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
6133
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
6134
|
+
let mainAxisCoord = coords[mainAxis];
|
|
6135
|
+
let crossAxisCoord = coords[crossAxis];
|
|
6136
|
+
if (checkMainAxis) {
|
|
6137
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
6138
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
6139
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
6140
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
6141
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
6142
|
+
}
|
|
6143
|
+
if (checkCrossAxis) {
|
|
6144
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
6145
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
6146
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
6147
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
6148
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
6149
|
+
}
|
|
6150
|
+
const limitedCoords = limiter.fn({
|
|
6151
|
+
...state,
|
|
6152
|
+
[mainAxis]: mainAxisCoord,
|
|
6153
|
+
[crossAxis]: crossAxisCoord
|
|
6154
|
+
});
|
|
6155
|
+
return {
|
|
6156
|
+
...limitedCoords,
|
|
6157
|
+
data: {
|
|
6158
|
+
x: limitedCoords.x - x,
|
|
6159
|
+
y: limitedCoords.y - y,
|
|
6160
|
+
enabled: {
|
|
6161
|
+
[mainAxis]: checkMainAxis,
|
|
6162
|
+
[crossAxis]: checkCrossAxis
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
};
|
|
6166
|
+
}
|
|
6167
|
+
};
|
|
6168
|
+
};
|
|
6169
|
+
|
|
6170
|
+
/**
|
|
6171
|
+
* Provides data that allows you to change the size of the floating element —
|
|
6172
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
6173
|
+
* width of the reference element.
|
|
6174
|
+
* @see https://floating-ui.com/docs/size
|
|
6175
|
+
*/
|
|
6176
|
+
const size$1 = function (options) {
|
|
6177
|
+
if (options === void 0) {
|
|
6178
|
+
options = {};
|
|
6179
|
+
}
|
|
6180
|
+
return {
|
|
6181
|
+
name: 'size',
|
|
6182
|
+
options,
|
|
6183
|
+
async fn(state) {
|
|
6184
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
6185
|
+
const {
|
|
6186
|
+
placement,
|
|
6187
|
+
rects,
|
|
6188
|
+
platform,
|
|
6189
|
+
elements
|
|
6190
|
+
} = state;
|
|
6191
|
+
const {
|
|
6192
|
+
apply = () => {},
|
|
6193
|
+
...detectOverflowOptions
|
|
6194
|
+
} = evaluate(options, state);
|
|
6195
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
6196
|
+
const side = getSide(placement);
|
|
6197
|
+
const alignment = getAlignment(placement);
|
|
6198
|
+
const isYAxis = getSideAxis(placement) === 'y';
|
|
6199
|
+
const {
|
|
6200
|
+
width,
|
|
6201
|
+
height
|
|
6202
|
+
} = rects.floating;
|
|
6203
|
+
let heightSide;
|
|
6204
|
+
let widthSide;
|
|
6205
|
+
if (side === 'top' || side === 'bottom') {
|
|
6206
|
+
heightSide = side;
|
|
6207
|
+
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
6208
|
+
} else {
|
|
6209
|
+
widthSide = side;
|
|
6210
|
+
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
6211
|
+
}
|
|
6212
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
6213
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
6214
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
6215
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
6216
|
+
const noShift = !state.middlewareData.shift;
|
|
6217
|
+
let availableHeight = overflowAvailableHeight;
|
|
6218
|
+
let availableWidth = overflowAvailableWidth;
|
|
6219
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
6220
|
+
availableWidth = maximumClippingWidth;
|
|
6221
|
+
}
|
|
6222
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
6223
|
+
availableHeight = maximumClippingHeight;
|
|
6224
|
+
}
|
|
6225
|
+
if (noShift && !alignment) {
|
|
6226
|
+
const xMin = max(overflow.left, 0);
|
|
6227
|
+
const xMax = max(overflow.right, 0);
|
|
6228
|
+
const yMin = max(overflow.top, 0);
|
|
6229
|
+
const yMax = max(overflow.bottom, 0);
|
|
6230
|
+
if (isYAxis) {
|
|
6231
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
6232
|
+
} else {
|
|
6233
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
6234
|
+
}
|
|
6235
|
+
}
|
|
6236
|
+
await apply({
|
|
6237
|
+
...state,
|
|
6238
|
+
availableWidth,
|
|
6239
|
+
availableHeight
|
|
6240
|
+
});
|
|
6241
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
6242
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
6243
|
+
return {
|
|
6244
|
+
reset: {
|
|
6245
|
+
rects: true
|
|
6246
|
+
}
|
|
6247
|
+
};
|
|
6248
|
+
}
|
|
6249
|
+
return {};
|
|
6250
|
+
}
|
|
6251
|
+
};
|
|
6252
|
+
};
|
|
6253
|
+
|
|
6254
|
+
function hasWindow() {
|
|
6255
|
+
return typeof window !== 'undefined';
|
|
6256
|
+
}
|
|
6257
|
+
function getNodeName(node) {
|
|
6258
|
+
if (isNode(node)) {
|
|
6259
|
+
return (node.nodeName || '').toLowerCase();
|
|
6260
|
+
}
|
|
6261
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
6262
|
+
// returning `#document` an infinite loop won't occur.
|
|
6263
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
6264
|
+
return '#document';
|
|
6265
|
+
}
|
|
6266
|
+
function getWindow(node) {
|
|
6267
|
+
var _node$ownerDocument;
|
|
6268
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
6269
|
+
}
|
|
6270
|
+
function getDocumentElement(node) {
|
|
6271
|
+
var _ref;
|
|
6272
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
6273
|
+
}
|
|
6274
|
+
function isNode(value) {
|
|
6275
|
+
if (!hasWindow()) {
|
|
6276
|
+
return false;
|
|
6277
|
+
}
|
|
6278
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
6279
|
+
}
|
|
6280
|
+
function isElement(value) {
|
|
6281
|
+
if (!hasWindow()) {
|
|
6282
|
+
return false;
|
|
6283
|
+
}
|
|
6284
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
6285
|
+
}
|
|
6286
|
+
function isHTMLElement(value) {
|
|
6287
|
+
if (!hasWindow()) {
|
|
6288
|
+
return false;
|
|
6289
|
+
}
|
|
6290
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
6291
|
+
}
|
|
6292
|
+
function isShadowRoot(value) {
|
|
6293
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
6294
|
+
return false;
|
|
6295
|
+
}
|
|
6296
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
6297
|
+
}
|
|
6298
|
+
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
6299
|
+
function isOverflowElement(element) {
|
|
6300
|
+
const {
|
|
6301
|
+
overflow,
|
|
6302
|
+
overflowX,
|
|
6303
|
+
overflowY,
|
|
6304
|
+
display
|
|
6305
|
+
} = getComputedStyle$1(element);
|
|
6306
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
6307
|
+
}
|
|
6308
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
6309
|
+
function isTableElement(element) {
|
|
6310
|
+
return tableElements.has(getNodeName(element));
|
|
6311
|
+
}
|
|
6312
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
6313
|
+
function isTopLayer(element) {
|
|
6314
|
+
return topLayerSelectors.some(selector => {
|
|
6315
|
+
try {
|
|
6316
|
+
return element.matches(selector);
|
|
6317
|
+
} catch (_e) {
|
|
6318
|
+
return false;
|
|
6319
|
+
}
|
|
6320
|
+
});
|
|
6321
|
+
}
|
|
6322
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
6323
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
6324
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
6325
|
+
function isContainingBlock(elementOrCss) {
|
|
6326
|
+
const webkit = isWebKit();
|
|
6327
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
6328
|
+
|
|
6329
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
6330
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
6331
|
+
return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
|
|
6332
|
+
}
|
|
6333
|
+
function getContainingBlock(element) {
|
|
6334
|
+
let currentNode = getParentNode(element);
|
|
6335
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
6336
|
+
if (isContainingBlock(currentNode)) {
|
|
6337
|
+
return currentNode;
|
|
6338
|
+
} else if (isTopLayer(currentNode)) {
|
|
6339
|
+
return null;
|
|
6340
|
+
}
|
|
6341
|
+
currentNode = getParentNode(currentNode);
|
|
6342
|
+
}
|
|
6343
|
+
return null;
|
|
6344
|
+
}
|
|
6345
|
+
function isWebKit() {
|
|
6346
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
6347
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
6348
|
+
}
|
|
6349
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
6350
|
+
function isLastTraversableNode(node) {
|
|
6351
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
6352
|
+
}
|
|
6353
|
+
function getComputedStyle$1(element) {
|
|
6354
|
+
return getWindow(element).getComputedStyle(element);
|
|
6355
|
+
}
|
|
6356
|
+
function getNodeScroll(element) {
|
|
6357
|
+
if (isElement(element)) {
|
|
6358
|
+
return {
|
|
6359
|
+
scrollLeft: element.scrollLeft,
|
|
6360
|
+
scrollTop: element.scrollTop
|
|
6361
|
+
};
|
|
6362
|
+
}
|
|
6363
|
+
return {
|
|
6364
|
+
scrollLeft: element.scrollX,
|
|
6365
|
+
scrollTop: element.scrollY
|
|
6366
|
+
};
|
|
6367
|
+
}
|
|
6368
|
+
function getParentNode(node) {
|
|
6369
|
+
if (getNodeName(node) === 'html') {
|
|
6370
|
+
return node;
|
|
6371
|
+
}
|
|
6372
|
+
const result =
|
|
6373
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
6374
|
+
node.assignedSlot ||
|
|
6375
|
+
// DOM Element detected.
|
|
6376
|
+
node.parentNode ||
|
|
6377
|
+
// ShadowRoot detected.
|
|
6378
|
+
isShadowRoot(node) && node.host ||
|
|
6379
|
+
// Fallback.
|
|
6380
|
+
getDocumentElement(node);
|
|
6381
|
+
return isShadowRoot(result) ? result.host : result;
|
|
6382
|
+
}
|
|
6383
|
+
function getNearestOverflowAncestor(node) {
|
|
6384
|
+
const parentNode = getParentNode(node);
|
|
6385
|
+
if (isLastTraversableNode(parentNode)) {
|
|
6386
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
6387
|
+
}
|
|
6388
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
6389
|
+
return parentNode;
|
|
6390
|
+
}
|
|
6391
|
+
return getNearestOverflowAncestor(parentNode);
|
|
6392
|
+
}
|
|
6393
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
6394
|
+
var _node$ownerDocument2;
|
|
6395
|
+
if (list === void 0) {
|
|
6396
|
+
list = [];
|
|
6397
|
+
}
|
|
6398
|
+
if (traverseIframes === void 0) {
|
|
6399
|
+
traverseIframes = true;
|
|
6400
|
+
}
|
|
6401
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
6402
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
6403
|
+
const win = getWindow(scrollableAncestor);
|
|
6404
|
+
if (isBody) {
|
|
6405
|
+
const frameElement = getFrameElement(win);
|
|
6406
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
6407
|
+
}
|
|
6408
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
6409
|
+
}
|
|
6410
|
+
function getFrameElement(win) {
|
|
6411
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
6412
|
+
}
|
|
6413
|
+
|
|
6414
|
+
function getCssDimensions(element) {
|
|
6415
|
+
const css = getComputedStyle$1(element);
|
|
6416
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
6417
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
6418
|
+
let width = parseFloat(css.width) || 0;
|
|
6419
|
+
let height = parseFloat(css.height) || 0;
|
|
6420
|
+
const hasOffset = isHTMLElement(element);
|
|
6421
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
6422
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
6423
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
6424
|
+
if (shouldFallback) {
|
|
6425
|
+
width = offsetWidth;
|
|
6426
|
+
height = offsetHeight;
|
|
6427
|
+
}
|
|
6428
|
+
return {
|
|
6429
|
+
width,
|
|
6430
|
+
height,
|
|
6431
|
+
$: shouldFallback
|
|
6432
|
+
};
|
|
6433
|
+
}
|
|
6434
|
+
|
|
6435
|
+
function unwrapElement(element) {
|
|
6436
|
+
return !isElement(element) ? element.contextElement : element;
|
|
6437
|
+
}
|
|
6438
|
+
|
|
6439
|
+
function getScale(element) {
|
|
6440
|
+
const domElement = unwrapElement(element);
|
|
6441
|
+
if (!isHTMLElement(domElement)) {
|
|
6442
|
+
return createCoords(1);
|
|
6443
|
+
}
|
|
6444
|
+
const rect = domElement.getBoundingClientRect();
|
|
6445
|
+
const {
|
|
6446
|
+
width,
|
|
6447
|
+
height,
|
|
6448
|
+
$
|
|
6449
|
+
} = getCssDimensions(domElement);
|
|
6450
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
6451
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
6452
|
+
|
|
6453
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
6454
|
+
|
|
6455
|
+
if (!x || !Number.isFinite(x)) {
|
|
6456
|
+
x = 1;
|
|
6457
|
+
}
|
|
6458
|
+
if (!y || !Number.isFinite(y)) {
|
|
6459
|
+
y = 1;
|
|
6460
|
+
}
|
|
6461
|
+
return {
|
|
6462
|
+
x,
|
|
6463
|
+
y
|
|
6464
|
+
};
|
|
6465
|
+
}
|
|
6466
|
+
|
|
6467
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
6468
|
+
function getVisualOffsets(element) {
|
|
6469
|
+
const win = getWindow(element);
|
|
6470
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
6471
|
+
return noOffsets;
|
|
6472
|
+
}
|
|
6473
|
+
return {
|
|
6474
|
+
x: win.visualViewport.offsetLeft,
|
|
6475
|
+
y: win.visualViewport.offsetTop
|
|
6476
|
+
};
|
|
6477
|
+
}
|
|
6478
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
6479
|
+
if (isFixed === void 0) {
|
|
6480
|
+
isFixed = false;
|
|
6481
|
+
}
|
|
6482
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
6483
|
+
return false;
|
|
6484
|
+
}
|
|
6485
|
+
return isFixed;
|
|
6486
|
+
}
|
|
6487
|
+
|
|
6488
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
6489
|
+
if (includeScale === void 0) {
|
|
6490
|
+
includeScale = false;
|
|
6491
|
+
}
|
|
6492
|
+
if (isFixedStrategy === void 0) {
|
|
6493
|
+
isFixedStrategy = false;
|
|
6494
|
+
}
|
|
6495
|
+
const clientRect = element.getBoundingClientRect();
|
|
6496
|
+
const domElement = unwrapElement(element);
|
|
6497
|
+
let scale = createCoords(1);
|
|
6498
|
+
if (includeScale) {
|
|
6499
|
+
if (offsetParent) {
|
|
6500
|
+
if (isElement(offsetParent)) {
|
|
6501
|
+
scale = getScale(offsetParent);
|
|
6502
|
+
}
|
|
6503
|
+
} else {
|
|
6504
|
+
scale = getScale(element);
|
|
6505
|
+
}
|
|
6506
|
+
}
|
|
6507
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
6508
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
6509
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
6510
|
+
let width = clientRect.width / scale.x;
|
|
6511
|
+
let height = clientRect.height / scale.y;
|
|
6512
|
+
if (domElement) {
|
|
6513
|
+
const win = getWindow(domElement);
|
|
6514
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
6515
|
+
let currentWin = win;
|
|
6516
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
6517
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
6518
|
+
const iframeScale = getScale(currentIFrame);
|
|
6519
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
6520
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
6521
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
6522
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
6523
|
+
x *= iframeScale.x;
|
|
6524
|
+
y *= iframeScale.y;
|
|
6525
|
+
width *= iframeScale.x;
|
|
6526
|
+
height *= iframeScale.y;
|
|
6527
|
+
x += left;
|
|
6528
|
+
y += top;
|
|
6529
|
+
currentWin = getWindow(currentIFrame);
|
|
6530
|
+
currentIFrame = getFrameElement(currentWin);
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
return rectToClientRect({
|
|
6534
|
+
width,
|
|
6535
|
+
height,
|
|
6536
|
+
x,
|
|
6537
|
+
y
|
|
6538
|
+
});
|
|
6539
|
+
}
|
|
6540
|
+
|
|
6541
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
6542
|
+
// incorrect for RTL.
|
|
6543
|
+
function getWindowScrollBarX(element, rect) {
|
|
6544
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
6545
|
+
if (!rect) {
|
|
6546
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
6547
|
+
}
|
|
6548
|
+
return rect.left + leftScroll;
|
|
6549
|
+
}
|
|
6550
|
+
|
|
6551
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
6552
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
6553
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
6554
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
6555
|
+
return {
|
|
6556
|
+
x,
|
|
6557
|
+
y
|
|
6558
|
+
};
|
|
6559
|
+
}
|
|
6560
|
+
|
|
6561
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
6562
|
+
let {
|
|
6563
|
+
elements,
|
|
6564
|
+
rect,
|
|
6565
|
+
offsetParent,
|
|
6566
|
+
strategy
|
|
6567
|
+
} = _ref;
|
|
6568
|
+
const isFixed = strategy === 'fixed';
|
|
6569
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
6570
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
6571
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
6572
|
+
return rect;
|
|
6573
|
+
}
|
|
6574
|
+
let scroll = {
|
|
6575
|
+
scrollLeft: 0,
|
|
6576
|
+
scrollTop: 0
|
|
6577
|
+
};
|
|
6578
|
+
let scale = createCoords(1);
|
|
6579
|
+
const offsets = createCoords(0);
|
|
6580
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
6581
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
6582
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
6583
|
+
scroll = getNodeScroll(offsetParent);
|
|
6584
|
+
}
|
|
6585
|
+
if (isHTMLElement(offsetParent)) {
|
|
6586
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
6587
|
+
scale = getScale(offsetParent);
|
|
6588
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
6589
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
6590
|
+
}
|
|
6591
|
+
}
|
|
6592
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
6593
|
+
return {
|
|
6594
|
+
width: rect.width * scale.x,
|
|
6595
|
+
height: rect.height * scale.y,
|
|
6596
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
6597
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
6598
|
+
};
|
|
6599
|
+
}
|
|
6600
|
+
|
|
6601
|
+
function getClientRects(element) {
|
|
6602
|
+
return Array.from(element.getClientRects());
|
|
6603
|
+
}
|
|
6604
|
+
|
|
6605
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
6606
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
6607
|
+
function getDocumentRect(element) {
|
|
6608
|
+
const html = getDocumentElement(element);
|
|
6609
|
+
const scroll = getNodeScroll(element);
|
|
6610
|
+
const body = element.ownerDocument.body;
|
|
6611
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
6612
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
6613
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
6614
|
+
const y = -scroll.scrollTop;
|
|
6615
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
6616
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
6617
|
+
}
|
|
6618
|
+
return {
|
|
6619
|
+
width,
|
|
6620
|
+
height,
|
|
6621
|
+
x,
|
|
6622
|
+
y
|
|
6623
|
+
};
|
|
6624
|
+
}
|
|
6625
|
+
|
|
6626
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
6627
|
+
// calculation is affected by unusual styles.
|
|
6628
|
+
// Most scrollbars leave 15-18px of space.
|
|
6629
|
+
const SCROLLBAR_MAX = 25;
|
|
6630
|
+
function getViewportRect(element, strategy) {
|
|
6631
|
+
const win = getWindow(element);
|
|
6632
|
+
const html = getDocumentElement(element);
|
|
6633
|
+
const visualViewport = win.visualViewport;
|
|
6634
|
+
let width = html.clientWidth;
|
|
6635
|
+
let height = html.clientHeight;
|
|
6636
|
+
let x = 0;
|
|
6637
|
+
let y = 0;
|
|
6638
|
+
if (visualViewport) {
|
|
6639
|
+
width = visualViewport.width;
|
|
6640
|
+
height = visualViewport.height;
|
|
6641
|
+
const visualViewportBased = isWebKit();
|
|
6642
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
6643
|
+
x = visualViewport.offsetLeft;
|
|
6644
|
+
y = visualViewport.offsetTop;
|
|
6645
|
+
}
|
|
6646
|
+
}
|
|
6647
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
6648
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
6649
|
+
// visual width of the <html> but this is not considered in the size
|
|
6650
|
+
// of `html.clientWidth`.
|
|
6651
|
+
if (windowScrollbarX <= 0) {
|
|
6652
|
+
const doc = html.ownerDocument;
|
|
6653
|
+
const body = doc.body;
|
|
6654
|
+
const bodyStyles = getComputedStyle(body);
|
|
6655
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
6656
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
6657
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
6658
|
+
width -= clippingStableScrollbarWidth;
|
|
6659
|
+
}
|
|
6660
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
6661
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
6662
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
6663
|
+
width += windowScrollbarX;
|
|
6664
|
+
}
|
|
6665
|
+
return {
|
|
6666
|
+
width,
|
|
6667
|
+
height,
|
|
6668
|
+
x,
|
|
6669
|
+
y
|
|
6670
|
+
};
|
|
6671
|
+
}
|
|
6672
|
+
|
|
6673
|
+
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
6674
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
6675
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
6676
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
6677
|
+
const top = clientRect.top + element.clientTop;
|
|
6678
|
+
const left = clientRect.left + element.clientLeft;
|
|
6679
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
6680
|
+
const width = element.clientWidth * scale.x;
|
|
6681
|
+
const height = element.clientHeight * scale.y;
|
|
6682
|
+
const x = left * scale.x;
|
|
6683
|
+
const y = top * scale.y;
|
|
6684
|
+
return {
|
|
6685
|
+
width,
|
|
6686
|
+
height,
|
|
6687
|
+
x,
|
|
6688
|
+
y
|
|
6689
|
+
};
|
|
6690
|
+
}
|
|
6691
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
6692
|
+
let rect;
|
|
6693
|
+
if (clippingAncestor === 'viewport') {
|
|
6694
|
+
rect = getViewportRect(element, strategy);
|
|
6695
|
+
} else if (clippingAncestor === 'document') {
|
|
6696
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
6697
|
+
} else if (isElement(clippingAncestor)) {
|
|
6698
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
6699
|
+
} else {
|
|
6700
|
+
const visualOffsets = getVisualOffsets(element);
|
|
6701
|
+
rect = {
|
|
6702
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
6703
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
6704
|
+
width: clippingAncestor.width,
|
|
6705
|
+
height: clippingAncestor.height
|
|
6706
|
+
};
|
|
6707
|
+
}
|
|
6708
|
+
return rectToClientRect(rect);
|
|
6709
|
+
}
|
|
6710
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
6711
|
+
const parentNode = getParentNode(element);
|
|
6712
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
6713
|
+
return false;
|
|
6714
|
+
}
|
|
6715
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
6716
|
+
}
|
|
6717
|
+
|
|
6718
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
6719
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
6720
|
+
// of the given element up the tree.
|
|
6721
|
+
function getClippingElementAncestors(element, cache) {
|
|
6722
|
+
const cachedResult = cache.get(element);
|
|
6723
|
+
if (cachedResult) {
|
|
6724
|
+
return cachedResult;
|
|
6725
|
+
}
|
|
6726
|
+
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
6727
|
+
let currentContainingBlockComputedStyle = null;
|
|
6728
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
6729
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
6730
|
+
|
|
6731
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
6732
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
6733
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
6734
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
6735
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
6736
|
+
currentContainingBlockComputedStyle = null;
|
|
6737
|
+
}
|
|
6738
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
6739
|
+
if (shouldDropCurrentNode) {
|
|
6740
|
+
// Drop non-containing blocks.
|
|
6741
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
6742
|
+
} else {
|
|
6743
|
+
// Record last containing block for next iteration.
|
|
6744
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
6745
|
+
}
|
|
6746
|
+
currentNode = getParentNode(currentNode);
|
|
6747
|
+
}
|
|
6748
|
+
cache.set(element, result);
|
|
6749
|
+
return result;
|
|
6750
|
+
}
|
|
6751
|
+
|
|
6752
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
6753
|
+
// clipping ancestors.
|
|
6754
|
+
function getClippingRect(_ref) {
|
|
6755
|
+
let {
|
|
6756
|
+
element,
|
|
6757
|
+
boundary,
|
|
6758
|
+
rootBoundary,
|
|
6759
|
+
strategy
|
|
6760
|
+
} = _ref;
|
|
6761
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
6762
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
6763
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
6764
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
6765
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
6766
|
+
accRect.top = max(rect.top, accRect.top);
|
|
6767
|
+
accRect.right = min(rect.right, accRect.right);
|
|
6768
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
6769
|
+
accRect.left = max(rect.left, accRect.left);
|
|
6770
|
+
return accRect;
|
|
6771
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
6772
|
+
return {
|
|
6773
|
+
width: clippingRect.right - clippingRect.left,
|
|
6774
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
6775
|
+
x: clippingRect.left,
|
|
6776
|
+
y: clippingRect.top
|
|
6777
|
+
};
|
|
6778
|
+
}
|
|
6779
|
+
|
|
6780
|
+
function getDimensions(element) {
|
|
6781
|
+
const {
|
|
6782
|
+
width,
|
|
6783
|
+
height
|
|
6784
|
+
} = getCssDimensions(element);
|
|
6785
|
+
return {
|
|
6786
|
+
width,
|
|
6787
|
+
height
|
|
6788
|
+
};
|
|
6789
|
+
}
|
|
6790
|
+
|
|
6791
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
6792
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
6793
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
6794
|
+
const isFixed = strategy === 'fixed';
|
|
6795
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
6796
|
+
let scroll = {
|
|
6797
|
+
scrollLeft: 0,
|
|
6798
|
+
scrollTop: 0
|
|
6799
|
+
};
|
|
6800
|
+
const offsets = createCoords(0);
|
|
6801
|
+
|
|
6802
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
6803
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
6804
|
+
function setLeftRTLScrollbarOffset() {
|
|
6805
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
6806
|
+
}
|
|
6807
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
6808
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
6809
|
+
scroll = getNodeScroll(offsetParent);
|
|
6810
|
+
}
|
|
6811
|
+
if (isOffsetParentAnElement) {
|
|
6812
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
6813
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
6814
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
6815
|
+
} else if (documentElement) {
|
|
6816
|
+
setLeftRTLScrollbarOffset();
|
|
6817
|
+
}
|
|
6818
|
+
}
|
|
6819
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
6820
|
+
setLeftRTLScrollbarOffset();
|
|
6821
|
+
}
|
|
6822
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
6823
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
6824
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
6825
|
+
return {
|
|
6826
|
+
x,
|
|
6827
|
+
y,
|
|
6828
|
+
width: rect.width,
|
|
6829
|
+
height: rect.height
|
|
6830
|
+
};
|
|
6831
|
+
}
|
|
6832
|
+
|
|
6833
|
+
function isStaticPositioned(element) {
|
|
6834
|
+
return getComputedStyle$1(element).position === 'static';
|
|
6835
|
+
}
|
|
6836
|
+
|
|
6837
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
6838
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
6839
|
+
return null;
|
|
6840
|
+
}
|
|
6841
|
+
if (polyfill) {
|
|
6842
|
+
return polyfill(element);
|
|
6843
|
+
}
|
|
6844
|
+
let rawOffsetParent = element.offsetParent;
|
|
6845
|
+
|
|
6846
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
6847
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
6848
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
6849
|
+
// non-static.
|
|
6850
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
6851
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
6852
|
+
}
|
|
6853
|
+
return rawOffsetParent;
|
|
6854
|
+
}
|
|
6855
|
+
|
|
6856
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
6857
|
+
// such as table ancestors and cross browser bugs.
|
|
6858
|
+
function getOffsetParent(element, polyfill) {
|
|
6859
|
+
const win = getWindow(element);
|
|
6860
|
+
if (isTopLayer(element)) {
|
|
6861
|
+
return win;
|
|
6862
|
+
}
|
|
6863
|
+
if (!isHTMLElement(element)) {
|
|
6864
|
+
let svgOffsetParent = getParentNode(element);
|
|
6865
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
6866
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
6867
|
+
return svgOffsetParent;
|
|
6868
|
+
}
|
|
6869
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
6870
|
+
}
|
|
6871
|
+
return win;
|
|
6872
|
+
}
|
|
6873
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
6874
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
6875
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
6876
|
+
}
|
|
6877
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
6878
|
+
return win;
|
|
6879
|
+
}
|
|
6880
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
6881
|
+
}
|
|
6882
|
+
|
|
6883
|
+
const getElementRects = async function (data) {
|
|
6884
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
6885
|
+
const getDimensionsFn = this.getDimensions;
|
|
6886
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
6887
|
+
return {
|
|
6888
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
6889
|
+
floating: {
|
|
6890
|
+
x: 0,
|
|
6891
|
+
y: 0,
|
|
6892
|
+
width: floatingDimensions.width,
|
|
6893
|
+
height: floatingDimensions.height
|
|
6894
|
+
}
|
|
6895
|
+
};
|
|
6896
|
+
};
|
|
6897
|
+
|
|
6898
|
+
function isRTL(element) {
|
|
6899
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
6900
|
+
}
|
|
6901
|
+
|
|
6902
|
+
const platform = {
|
|
6903
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
6904
|
+
getDocumentElement,
|
|
6905
|
+
getClippingRect,
|
|
6906
|
+
getOffsetParent,
|
|
6907
|
+
getElementRects,
|
|
6908
|
+
getClientRects,
|
|
6909
|
+
getDimensions,
|
|
6910
|
+
getScale,
|
|
6911
|
+
isElement,
|
|
6912
|
+
isRTL
|
|
6913
|
+
};
|
|
6914
|
+
|
|
6915
|
+
function rectsAreEqual(a, b) {
|
|
6916
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
6917
|
+
}
|
|
6918
|
+
|
|
6919
|
+
// https://samthor.au/2021/observing-dom/
|
|
6920
|
+
function observeMove(element, onMove) {
|
|
6921
|
+
let io = null;
|
|
6922
|
+
let timeoutId;
|
|
6923
|
+
const root = getDocumentElement(element);
|
|
6924
|
+
function cleanup() {
|
|
6925
|
+
var _io;
|
|
6926
|
+
clearTimeout(timeoutId);
|
|
6927
|
+
(_io = io) == null || _io.disconnect();
|
|
6928
|
+
io = null;
|
|
6929
|
+
}
|
|
6930
|
+
function refresh(skip, threshold) {
|
|
6931
|
+
if (skip === void 0) {
|
|
6932
|
+
skip = false;
|
|
6933
|
+
}
|
|
6934
|
+
if (threshold === void 0) {
|
|
6935
|
+
threshold = 1;
|
|
6936
|
+
}
|
|
6937
|
+
cleanup();
|
|
6938
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
6939
|
+
const {
|
|
6940
|
+
left,
|
|
6941
|
+
top,
|
|
6942
|
+
width,
|
|
6943
|
+
height
|
|
6944
|
+
} = elementRectForRootMargin;
|
|
6945
|
+
if (!skip) {
|
|
6946
|
+
onMove();
|
|
6947
|
+
}
|
|
6948
|
+
if (!width || !height) {
|
|
6949
|
+
return;
|
|
6950
|
+
}
|
|
6951
|
+
const insetTop = floor(top);
|
|
6952
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
6953
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
6954
|
+
const insetLeft = floor(left);
|
|
6955
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
6956
|
+
const options = {
|
|
6957
|
+
rootMargin,
|
|
6958
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
6959
|
+
};
|
|
6960
|
+
let isFirstUpdate = true;
|
|
6961
|
+
function handleObserve(entries) {
|
|
6962
|
+
const ratio = entries[0].intersectionRatio;
|
|
6963
|
+
if (ratio !== threshold) {
|
|
6964
|
+
if (!isFirstUpdate) {
|
|
6965
|
+
return refresh();
|
|
6966
|
+
}
|
|
6967
|
+
if (!ratio) {
|
|
6968
|
+
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
6969
|
+
// to prevent an infinite loop of updates.
|
|
6970
|
+
timeoutId = setTimeout(() => {
|
|
6971
|
+
refresh(false, 1e-7);
|
|
6972
|
+
}, 1000);
|
|
6973
|
+
} else {
|
|
6974
|
+
refresh(false, ratio);
|
|
6975
|
+
}
|
|
6976
|
+
}
|
|
6977
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
6978
|
+
// It's possible that even though the ratio is reported as 1, the
|
|
6979
|
+
// element is not actually fully within the IntersectionObserver's root
|
|
6980
|
+
// area anymore. This can happen under performance constraints. This may
|
|
6981
|
+
// be a bug in the browser's IntersectionObserver implementation. To
|
|
6982
|
+
// work around this, we compare the element's bounding rect now with
|
|
6983
|
+
// what it was at the time we created the IntersectionObserver. If they
|
|
6984
|
+
// are not equal then the element moved, so we refresh.
|
|
6985
|
+
refresh();
|
|
6986
|
+
}
|
|
6987
|
+
isFirstUpdate = false;
|
|
6988
|
+
}
|
|
6989
|
+
|
|
6990
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
6991
|
+
// error.
|
|
6992
|
+
try {
|
|
6993
|
+
io = new IntersectionObserver(handleObserve, {
|
|
6994
|
+
...options,
|
|
6995
|
+
// Handle <iframe>s
|
|
6996
|
+
root: root.ownerDocument
|
|
6997
|
+
});
|
|
6998
|
+
} catch (_e) {
|
|
6999
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
7000
|
+
}
|
|
7001
|
+
io.observe(element);
|
|
7002
|
+
}
|
|
7003
|
+
refresh(true);
|
|
7004
|
+
return cleanup;
|
|
7005
|
+
}
|
|
7006
|
+
|
|
7007
|
+
/**
|
|
7008
|
+
* Automatically updates the position of the floating element when necessary.
|
|
7009
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
7010
|
+
* visible on the screen.
|
|
7011
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
7012
|
+
* removed from the DOM or hidden from the screen.
|
|
7013
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
7014
|
+
*/
|
|
7015
|
+
function autoUpdate(reference, floating, update, options) {
|
|
7016
|
+
if (options === void 0) {
|
|
7017
|
+
options = {};
|
|
7018
|
+
}
|
|
7019
|
+
const {
|
|
7020
|
+
ancestorScroll = true,
|
|
7021
|
+
ancestorResize = true,
|
|
7022
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
7023
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
7024
|
+
animationFrame = false
|
|
7025
|
+
} = options;
|
|
7026
|
+
const referenceEl = unwrapElement(reference);
|
|
7027
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
7028
|
+
ancestors.forEach(ancestor => {
|
|
7029
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
7030
|
+
passive: true
|
|
7031
|
+
});
|
|
7032
|
+
ancestorResize && ancestor.addEventListener('resize', update);
|
|
7033
|
+
});
|
|
7034
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
7035
|
+
let reobserveFrame = -1;
|
|
7036
|
+
let resizeObserver = null;
|
|
7037
|
+
if (elementResize) {
|
|
7038
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
7039
|
+
let [firstEntry] = _ref;
|
|
7040
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
7041
|
+
// Prevent update loops when using the `size` middleware.
|
|
7042
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
7043
|
+
resizeObserver.unobserve(floating);
|
|
7044
|
+
cancelAnimationFrame(reobserveFrame);
|
|
7045
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
7046
|
+
var _resizeObserver;
|
|
7047
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
7048
|
+
});
|
|
7049
|
+
}
|
|
7050
|
+
update();
|
|
7051
|
+
});
|
|
7052
|
+
if (referenceEl && !animationFrame) {
|
|
7053
|
+
resizeObserver.observe(referenceEl);
|
|
7054
|
+
}
|
|
7055
|
+
resizeObserver.observe(floating);
|
|
7056
|
+
}
|
|
7057
|
+
let frameId;
|
|
7058
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
7059
|
+
if (animationFrame) {
|
|
7060
|
+
frameLoop();
|
|
7061
|
+
}
|
|
7062
|
+
function frameLoop() {
|
|
7063
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
7064
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
7065
|
+
update();
|
|
7066
|
+
}
|
|
7067
|
+
prevRefRect = nextRefRect;
|
|
7068
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
7069
|
+
}
|
|
7070
|
+
update();
|
|
7071
|
+
return () => {
|
|
7072
|
+
var _resizeObserver2;
|
|
7073
|
+
ancestors.forEach(ancestor => {
|
|
7074
|
+
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
7075
|
+
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
7076
|
+
});
|
|
7077
|
+
cleanupIo == null || cleanupIo();
|
|
7078
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
7079
|
+
resizeObserver = null;
|
|
7080
|
+
if (animationFrame) {
|
|
7081
|
+
cancelAnimationFrame(frameId);
|
|
7082
|
+
}
|
|
7083
|
+
};
|
|
7084
|
+
}
|
|
7085
|
+
|
|
7086
|
+
/**
|
|
7087
|
+
* Modifies the placement by translating the floating element along the
|
|
7088
|
+
* specified axes.
|
|
7089
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
7090
|
+
* object may be passed.
|
|
7091
|
+
* @see https://floating-ui.com/docs/offset
|
|
7092
|
+
*/
|
|
7093
|
+
const offset = offset$1;
|
|
7094
|
+
|
|
7095
|
+
/**
|
|
7096
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
7097
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
7098
|
+
* @see https://floating-ui.com/docs/shift
|
|
7099
|
+
*/
|
|
7100
|
+
const shift = shift$1;
|
|
7101
|
+
|
|
7102
|
+
/**
|
|
7103
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
7104
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
7105
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
7106
|
+
* @see https://floating-ui.com/docs/flip
|
|
7107
|
+
*/
|
|
7108
|
+
const flip = flip$1;
|
|
7109
|
+
|
|
7110
|
+
/**
|
|
7111
|
+
* Provides data that allows you to change the size of the floating element —
|
|
7112
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
7113
|
+
* width of the reference element.
|
|
7114
|
+
* @see https://floating-ui.com/docs/size
|
|
7115
|
+
*/
|
|
7116
|
+
const size = size$1;
|
|
7117
|
+
|
|
7118
|
+
/**
|
|
7119
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
7120
|
+
* next to a given reference element.
|
|
7121
|
+
*/
|
|
7122
|
+
const computePosition = (reference, floating, options) => {
|
|
7123
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
7124
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
7125
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
7126
|
+
const cache = new Map();
|
|
7127
|
+
const mergedOptions = {
|
|
7128
|
+
platform,
|
|
7129
|
+
...options
|
|
7130
|
+
};
|
|
7131
|
+
const platformWithCache = {
|
|
7132
|
+
...mergedOptions.platform,
|
|
7133
|
+
_c: cache
|
|
7134
|
+
};
|
|
7135
|
+
return computePosition$1(reference, floating, {
|
|
7136
|
+
...mergedOptions,
|
|
7137
|
+
platform: platformWithCache
|
|
7138
|
+
});
|
|
7139
|
+
};
|
|
7140
|
+
|
|
7141
|
+
const curaSelectCss = ":host{display:block;position:relative;font-family:var(--font-family)}.wrapper{width:100%;user-select:none;text-align:left !important}.wrapper cura-label{margin-bottom:8px}.wrapper .helper-text{margin-top:8px;color:var(--neutral-dark)}.wrapper .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper .cura-input-field .feedback-icon{padding-left:12px}.wrapper .cura-input-field .up-down-icon{order:3;padding-right:6px;cursor:pointer;pointer-events:all}.wrapper .cura-input-field .up-down-button{background-color:transparent;border:none}.wrapper .cura-input-field input{padding:0px 12px 0px 8px;cursor:pointer}.wrapper .cura-input-field.open{border-radius:4px 4px 0 0 !important}.wrapper.transparent{background-color:transparent;padding:0px;max-height:80px}.wrapper.transparent .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;background-color:transparent !important;border:none !important;border-radius:0;height:27px}.wrapper.transparent .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.transparent .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.transparent .cura-input-field .feedback-icon{padding-left:12px}.wrapper.transparent .cura-input-field input{color:var(--neutral-black) !important;font-size:16px;font-weight:var(--font-weight-bold) !important;padding:0}.wrapper.transparent .cura-input-field input::placeholder{color:var(--neutral-black)}.wrapper.transparent .cura-input-field .feedback-icon{order:3;margin:0 20px 0 0}.wrapper.transparent:focus-within .cura-input-field{border:none !important;background-color:transparent !important}.wrapper.transparent:focus-within .cura-input-field input{border:none !important;outline:none}.wrapper.transparent .helper-text{margin-top:0px}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field{border-color:var(--neutral-dark)}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field input{color:var(--neutral-dark)}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper:focus-within:not(.selection) .cura-input-field{border:2px solid var(--info-base) !important;background-color:var(--neutral-purewhite);outline:none}.wrapper:focus-within:not(.selection) .cura-input-field input{color:var(--neutral-black) !important}.wrapper:focus-within.selection .cura-input-field{border-radius:4px 4px 0px 0px}.wrapper.success .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.success .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.success .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.success .cura-input-field .feedback-icon{padding-left:12px}.wrapper.success .cura-input-field input{color:var(--success-darker) !important}.wrapper.success .cura-input-field input::placeholder{color:var(--success-darker) !important}.wrapper.success:not(.transparent) .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;border:2px solid var(--success-dark) !important;background-color:var(--success-lighter) !important}.wrapper.success:not(.transparent) .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.success:not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.success:not(.transparent) .cura-input-field .feedback-icon{padding-left:12px}.wrapper.error .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.error .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.error .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.error .cura-input-field .feedback-icon{padding-left:12px}.wrapper.error .cura-input-field input{color:var(--error-darker) !important}.wrapper.error .cura-input-field input::placeholder{color:var(--error-darker) !important}.wrapper.error:not(.transparent) .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;border:2px solid var(--error-dark) !important;background-color:var(--error-lighter) !important}.wrapper.error:not(.transparent) .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.error:not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.error:not(.transparent) .cura-input-field .feedback-icon{padding-left:12px}.wrapper.disabled .cura-input-field{background-color:var(--neutral-white);border:2px solid var(--neutral-base)}.wrapper.disabled .cura-input-field input{color:var(--neutral-medium)}.wrapper.disabled .cura-input-field input::placeholder{color:var(--neutral-medium)}.required{color:red}.menu{position:fixed;left:0;top:0;box-sizing:border-box;background:#fff;border:2px solid var(--neutral-light);border-radius:4px;z-index:1000;max-height:var(--max-height);overflow:hidden;border-top:transparent;align-items:center;scrollbar-color:var(--neutral-medium) var(--neutral-black-20);overflow-y:auto;box-shadow:0px 4px 8px 0px rgba(38, 38, 38, 0.16)}.menu.open{border-radius:0 !important;padding:12px}";
|
|
5436
7142
|
|
|
5437
7143
|
const CuraSelect = class {
|
|
5438
7144
|
constructor(hostRef) {
|
|
@@ -5517,8 +7223,17 @@ const CuraSelect = class {
|
|
|
5517
7223
|
* Default: false
|
|
5518
7224
|
*/
|
|
5519
7225
|
this.isOpen = false;
|
|
7226
|
+
this.isPositioned = false;
|
|
7227
|
+
this.menuStyle = {
|
|
7228
|
+
top: '0px',
|
|
7229
|
+
left: '0px',
|
|
7230
|
+
width: '0px',
|
|
7231
|
+
maxHeight: this.maxHeight,
|
|
7232
|
+
};
|
|
5520
7233
|
this.activeIndex = -1;
|
|
7234
|
+
this.preferredPlacement = 'bottom';
|
|
5521
7235
|
this.textInput = '';
|
|
7236
|
+
this.floatingPlacement = 'bottom-start';
|
|
5522
7237
|
/**
|
|
5523
7238
|
* Styles to be applied to the component.
|
|
5524
7239
|
*/
|
|
@@ -5551,7 +7266,7 @@ const CuraSelect = class {
|
|
|
5551
7266
|
var _a;
|
|
5552
7267
|
const { code: keyCode } = event;
|
|
5553
7268
|
if (!this.isOpen && keyCode === 'ArrowDown') {
|
|
5554
|
-
this.
|
|
7269
|
+
this.openMenu();
|
|
5555
7270
|
this.activeIndex = 0;
|
|
5556
7271
|
return;
|
|
5557
7272
|
}
|
|
@@ -5567,12 +7282,17 @@ const CuraSelect = class {
|
|
|
5567
7282
|
(_a = this.options[this.activeIndex]) === null || _a === void 0 ? void 0 : _a.click();
|
|
5568
7283
|
}
|
|
5569
7284
|
if (keyCode === 'Escape') {
|
|
5570
|
-
this.
|
|
7285
|
+
this.closeMenu();
|
|
5571
7286
|
}
|
|
5572
7287
|
};
|
|
5573
7288
|
this.handleInputChange = (e) => {
|
|
5574
7289
|
this.textInput = e.target.value;
|
|
5575
|
-
|
|
7290
|
+
if (this.searchBehavior) {
|
|
7291
|
+
if (this.textInput.length > 0 && !this.isOpen)
|
|
7292
|
+
this.openMenu();
|
|
7293
|
+
if (this.textInput.length === 0 && this.isOpen)
|
|
7294
|
+
this.closeMenu();
|
|
7295
|
+
}
|
|
5576
7296
|
this.internals.setFormValue(this.textInput);
|
|
5577
7297
|
};
|
|
5578
7298
|
this.handleClick = (event) => {
|
|
@@ -5581,14 +7301,20 @@ const CuraSelect = class {
|
|
|
5581
7301
|
const target = event.target;
|
|
5582
7302
|
if (target.tagName === 'CURA-SELECT-OPTION')
|
|
5583
7303
|
return this.onOptiselected(event);
|
|
5584
|
-
this.isOpen
|
|
7304
|
+
this.isOpen ? this.closeMenu() : this.openMenu();
|
|
5585
7305
|
};
|
|
5586
7306
|
this.handleClickOutside = (event) => {
|
|
5587
|
-
const
|
|
7307
|
+
const path = (event.composedPath && event.composedPath()) || [];
|
|
7308
|
+
const clickedOutside = !path.includes(this.host) && !(this.menuElement && path.includes(this.menuElement));
|
|
5588
7309
|
if (clickedOutside) {
|
|
5589
|
-
this.
|
|
7310
|
+
this.closeMenu();
|
|
5590
7311
|
}
|
|
5591
7312
|
};
|
|
7313
|
+
this.handleViewportChange = () => {
|
|
7314
|
+
if (!this.isOpen)
|
|
7315
|
+
return;
|
|
7316
|
+
this.updateMenuPosition();
|
|
7317
|
+
};
|
|
5592
7318
|
}
|
|
5593
7319
|
updateOptionHighlights(newActiveINdex) {
|
|
5594
7320
|
this.options.forEach((option, index) => (option.active = index === newActiveINdex));
|
|
@@ -5660,6 +7386,7 @@ const CuraSelect = class {
|
|
|
5660
7386
|
// this.initializeOptions();
|
|
5661
7387
|
this.setupMutationObserver();
|
|
5662
7388
|
this.addOutsideClickListener();
|
|
7389
|
+
this.addPositionListeners();
|
|
5663
7390
|
}
|
|
5664
7391
|
/**
|
|
5665
7392
|
* Lifecycle method called when the component is connected to the DOM.
|
|
@@ -5673,9 +7400,11 @@ const CuraSelect = class {
|
|
|
5673
7400
|
* Disconnects the MutationObserver if it exists.
|
|
5674
7401
|
*/
|
|
5675
7402
|
disconnectedCallback() {
|
|
5676
|
-
var _a;
|
|
7403
|
+
var _a, _b;
|
|
5677
7404
|
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
5678
7405
|
this.removeOutsideClickListener();
|
|
7406
|
+
this.removePositionListeners();
|
|
7407
|
+
(_b = this.cleanupAutoUpdate) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
5679
7408
|
}
|
|
5680
7409
|
initializeOptions() {
|
|
5681
7410
|
var _a;
|
|
@@ -5744,7 +7473,7 @@ const CuraSelect = class {
|
|
|
5744
7473
|
this.internals.setFormValue(this.value);
|
|
5745
7474
|
if (this.textInput !== selectedOptionElement.textContent) {
|
|
5746
7475
|
this.textInput = selectedOptionElement.textContent;
|
|
5747
|
-
this.
|
|
7476
|
+
this.closeMenu();
|
|
5748
7477
|
this.selected.emit(selectedOptionElement.value);
|
|
5749
7478
|
}
|
|
5750
7479
|
}
|
|
@@ -5799,20 +7528,85 @@ const CuraSelect = class {
|
|
|
5799
7528
|
const icon = { default: this.iconName, success: 'checkCircle', error: 'alertCircle' }[this.status];
|
|
5800
7529
|
return h("cura-icon", { class: "feedback-icon", name: icon, iconset: "default", size: this.size === 'large' ? 20 : 16, color: this.getColor('icon'), style: this.styles });
|
|
5801
7530
|
}
|
|
7531
|
+
openMenu() {
|
|
7532
|
+
this.isOpen = true;
|
|
7533
|
+
this.isPositioned = false;
|
|
7534
|
+
requestAnimationFrame(() => this.setupFloating());
|
|
7535
|
+
}
|
|
7536
|
+
closeMenu() {
|
|
7537
|
+
var _a;
|
|
7538
|
+
this.isOpen = false;
|
|
7539
|
+
this.isPositioned = false;
|
|
7540
|
+
(_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7541
|
+
}
|
|
5802
7542
|
addOutsideClickListener() {
|
|
5803
7543
|
document.addEventListener('click', this.handleClickOutside);
|
|
5804
7544
|
}
|
|
5805
7545
|
removeOutsideClickListener() {
|
|
5806
7546
|
document.removeEventListener('click', this.handleClickOutside);
|
|
5807
7547
|
}
|
|
7548
|
+
addPositionListeners() {
|
|
7549
|
+
window.addEventListener('resize', this.handleViewportChange, { passive: true });
|
|
7550
|
+
window.addEventListener('scroll', this.handleViewportChange, true);
|
|
7551
|
+
}
|
|
7552
|
+
removePositionListeners() {
|
|
7553
|
+
window.removeEventListener('resize', this.handleViewportChange);
|
|
7554
|
+
window.removeEventListener('scroll', this.handleViewportChange, true);
|
|
7555
|
+
}
|
|
7556
|
+
parseMaxHeight() {
|
|
7557
|
+
const numeric = parseFloat(this.maxHeight);
|
|
7558
|
+
return Number.isFinite(numeric) ? numeric : 285;
|
|
7559
|
+
}
|
|
7560
|
+
setupFloating() {
|
|
7561
|
+
var _a;
|
|
7562
|
+
if (!this.inputWrapper || !this.menuElement)
|
|
7563
|
+
return;
|
|
7564
|
+
(_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7565
|
+
this.cleanupAutoUpdate = autoUpdate(this.inputWrapper, this.menuElement, () => {
|
|
7566
|
+
this.updateMenuPosition();
|
|
7567
|
+
});
|
|
7568
|
+
this.updateMenuPosition();
|
|
7569
|
+
}
|
|
7570
|
+
updateMenuPosition() {
|
|
7571
|
+
if (!this.inputWrapper || !this.menuElement)
|
|
7572
|
+
return;
|
|
7573
|
+
computePosition(this.inputWrapper, this.menuElement, {
|
|
7574
|
+
strategy: 'fixed',
|
|
7575
|
+
placement: this.floatingPlacement,
|
|
7576
|
+
middleware: [
|
|
7577
|
+
offset(0),
|
|
7578
|
+
flip(),
|
|
7579
|
+
shift({ padding: 8 }),
|
|
7580
|
+
size({
|
|
7581
|
+
apply: ({ rects, availableHeight }) => {
|
|
7582
|
+
this.menuStyle = Object.assign(Object.assign({}, this.menuStyle), { width: `${rects.reference.width}px`, maxHeight: `${Math.min(availableHeight, this.parseMaxHeight())}px` });
|
|
7583
|
+
},
|
|
7584
|
+
}),
|
|
7585
|
+
],
|
|
7586
|
+
}).then(({ x, y, placement }) => {
|
|
7587
|
+
this.preferredPlacement = placement.startsWith('top') ? 'top' : 'bottom';
|
|
7588
|
+
this.menuStyle = Object.assign(Object.assign({}, this.menuStyle), { top: `${y}px`, left: `${x}px` });
|
|
7589
|
+
this.isPositioned = true;
|
|
7590
|
+
});
|
|
7591
|
+
}
|
|
5808
7592
|
render() {
|
|
5809
|
-
return (h(Host, { key: '
|
|
7593
|
+
return (h(Host, { key: '8a05e5365062b5a2da4f10d7e3ca04f9d3136fba', style: this.styles, role: "combobox", "aria-label": this.label, "aria-required": String(this.required), "aria-disabled": String(this.disabled), "aria-invalid": String(this.status === 'error') }, h("div", { key: 'ab28fd73d68ccdc5ad6dd6cc7f79d879eaf25818', class: this.getClasses(), onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), onClick: this.handleClick }, this.label && (h("cura-label", { key: '5405aa3706b07640fdfdaa681ad22ea9c5fd9997', class: "label", weight: "bold", size: this.size === 'large' ? 'small' : 'xsmall', color: this.getColor('label') }, this.label, " ", this.required && h("span", { key: '39b37aefbf4e61572607d891eb63c737c332793c', class: "required" }, "* "))), h("div", { key: 'c339ab1ff49699fb0a348a169ba7f545b89bd593', class: {
|
|
5810
7594
|
'cura-input-field': true,
|
|
5811
7595
|
'open': this.isOpen,
|
|
5812
|
-
} }, this.renderIcon(), h("input", { key: '
|
|
7596
|
+
}, ref: el => (this.inputWrapper = el) }, this.renderIcon(), h("input", { key: '5118ad409b6b9c48c856670857d3cae26d28fd46', type: "text", autocomplete: "off", onFocus: () => (this.isFocused = true), onBlur: () => (this.isFocused = false), onKeyDown: this.handleKeyNavigation, "aria-required": String(this.required), "aria-disabled": String(this.disabled), "aria-invalid": String(this.status === 'error'), onInput: this.handleInputChange, style: this.styles, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.textInput, readonly: this.searchBehavior ? null : true }), h("button", { key: '53bddc2b1e56462a9181ce99749d98568f1c5dd9', class: "up-down-button" }, h("cura-icon", { key: '01cb20504d2e0506e7210d33e3ca75978a598eff', name: this.isOpen ? 'up' : 'down', class: "up-down-icon", color: this.disabled ? 'neutral-dark' : 'primary-base', size: 16, iconset: "default" }))), h("cura-label", { key: '550c24779f690ebd16bec881770b200ce06f5390', class: "helper-text", size: "xsmall", color: this.getColor('text'), weight: this.mode === 'transparent' ? 'bold' : 'regular' }, h("slot", { key: '530f64f99df6328d3a49a449f8f924e57bb03f21' })), this.isOpen && (h("div", { key: '3ee7a6439c98a0837a3f39d27646ed7a55c630b3', class: {
|
|
5813
7597
|
menu: true,
|
|
5814
7598
|
open: this.isOpen,
|
|
5815
|
-
|
|
7599
|
+
[this.preferredPlacement]: true,
|
|
7600
|
+
}, ref: el => (this.menuElement = el), style: {
|
|
7601
|
+
'--max-height': this.maxHeight,
|
|
7602
|
+
top: this.menuStyle.top,
|
|
7603
|
+
left: this.menuStyle.left,
|
|
7604
|
+
width: this.menuStyle.width,
|
|
7605
|
+
maxHeight: this.menuStyle.maxHeight,
|
|
7606
|
+
visibility: this.isPositioned ? 'visible' : 'hidden',
|
|
7607
|
+
opacity: this.isPositioned ? '1' : '0',
|
|
7608
|
+
pointerEvents: this.isPositioned ? 'auto' : 'none',
|
|
7609
|
+
} }, h("slot", { key: '84c3bb501966175635102b2ccbfa0cf43d2112f1', name: "option" }))))));
|
|
5816
7610
|
}
|
|
5817
7611
|
static get formAssociated() { return true; }
|
|
5818
7612
|
get host() { return getElement(this); }
|
|
@@ -5824,7 +7618,7 @@ const CuraSelect = class {
|
|
|
5824
7618
|
};
|
|
5825
7619
|
CuraSelect.style = curaSelectCss;
|
|
5826
7620
|
|
|
5827
|
-
const curaSelectOptionCss = ":host{display:block}.item{display:flex;padding:12px 8px;cursor:pointer;justify-content:space-between;align-items:center;box-sizing:border-box;background:var(--neutral-purewhite)}.item.selected{background-color:var(--primary-lighter-50);border-bottom:1px solid var(--primary-light)}.item:hover:not(.selected){background:var(--neutral-white)
|
|
7621
|
+
const curaSelectOptionCss = ":host{display:block}.item{display:flex;padding:12px 8px;cursor:pointer;justify-content:space-between;align-items:center;box-sizing:border-box;background:var(--neutral-purewhite);border-bottom:1px solid transparent}.item.selected{background-color:var(--primary-lighter-50);border-bottom:1px solid var(--primary-light)}.item:hover:not(.selected){background:var(--neutral-white)}.item:hover:not(.selected){border-bottom:1px solid var(--neutral-light)}.item.active{background:var(--neutral-white) !important}.item.active{border-bottom:1px solid var(--neutral-light)}.item.selected.active{background-color:var(--primary-lighter-50) !important;box-shadow:none}:host(:last-of-type) .item{border-bottom:none}:host(:last-of-type) .item:hover,:host(:last-of-type) .item.active,:host(:last-of-type) .item.selected{border-bottom:none}";
|
|
5828
7622
|
|
|
5829
7623
|
const CuraSelectOption = class {
|
|
5830
7624
|
constructor(hostRef) {
|
|
@@ -6001,7 +7795,7 @@ const CuraTabsGroup = class {
|
|
|
6001
7795
|
};
|
|
6002
7796
|
CuraTabsGroup.style = curaTabsGroupCss;
|
|
6003
7797
|
|
|
6004
|
-
export { CuraAccordion as cura_accordion, CuraAccordionItem as cura_accordion_item, CuraAvatar as cura_avatar, CuraDistance as cura_badge_distance, CuraButton as cura_button, CuraButtonTransparent as cura_button_transparent, CuraDropdownSearch as cura_dropdown_search, CuraDropdownSearchCategory as cura_dropdown_search_category, CuraDropdownSearchOption as cura_dropdown_search_option, CuraHeading as cura_heading, CuraIcon as cura_icon, CuraInputText as cura_input_text, CuraLabel as cura_label, CuraLoaderCircle as cura_loader_circle, CuraPageTemplate as cura_page_template, CuraParagraph as cura_paragraph, CuraSelect as cura_select, CuraSelectOption as cura_select_option, CuraTabs as cura_tabs, CuraTabsGroup as cura_tabs_group };
|
|
6005
|
-
//# sourceMappingURL=cura-accordion.cura-accordion-item.cura-avatar.cura-badge-distance.cura-button.cura-button-transparent.cura-dropdown-search.cura-dropdown-search-category.cura-dropdown-search-option.cura-heading.cura-icon.cura-input-text.cura-label.cura-loader-circle.cura-page-template.cura-paragraph.cura-select.cura-select-option.cura-tabs.cura-tabs-group.entry.js.map
|
|
7798
|
+
export { CuraAccordion as cura_accordion, CuraAccordionItem as cura_accordion_item, CuraAvatar as cura_avatar, CuraDistance as cura_badge_distance, CuraButton as cura_button, CuraButtonTransparent as cura_button_transparent, CuraCard as cura_card, CuraDropdownSearch as cura_dropdown_search, CuraDropdownSearchCategory as cura_dropdown_search_category, CuraDropdownSearchOption as cura_dropdown_search_option, CuraHeading as cura_heading, CuraIcon as cura_icon, CuraInputText as cura_input_text, CuraLabel as cura_label, CuraLoaderCircle as cura_loader_circle, CuraPageTemplate as cura_page_template, CuraParagraph as cura_paragraph, CuraSelect as cura_select, CuraSelectOption as cura_select_option, CuraTabs as cura_tabs, CuraTabsGroup as cura_tabs_group };
|
|
7799
|
+
//# sourceMappingURL=cura-accordion.cura-accordion-item.cura-avatar.cura-badge-distance.cura-button.cura-button-transparent.cura-card.cura-dropdown-search.cura-dropdown-search-category.cura-dropdown-search-option.cura-heading.cura-icon.cura-input-text.cura-label.cura-loader-circle.cura-page-template.cura-paragraph.cura-select.cura-select-option.cura-tabs.cura-tabs-group.entry.js.map
|
|
6006
7800
|
|
|
6007
|
-
//# sourceMappingURL=cura-
|
|
7801
|
+
//# sourceMappingURL=cura-accordion_21.entry.js.map
|