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