@rededor/cura 1.8.3-alpha.0 → 2.0.0-alpha.5
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} +1705 -20
- package/dist/cjs/cura-accordion_21.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-alert.cjs.entry.js +4 -3
- package/dist/cjs/cura-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-alert.entry.cjs.js.map +1 -1
- package/dist/cjs/cura.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/cura-alert/cura-alert.js +4 -3
- package/dist/collection/components/cura-alert/cura-alert.js.map +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/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-alert.js +4 -3
- package/dist/components/cura-alert.js.map +1 -1
- 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-select-option.js +1 -1
- package/dist/components/cura-select.js +1 -1
- package/dist/components/p-Cs5scX1L.js +2037 -0
- package/dist/components/p-Cs5scX1L.js.map +1 -0
- package/dist/components/{p-BGnJiNyu.js → p-D6PpdPRJ.js} +4 -4
- package/dist/components/{p-BGnJiNyu.js.map → p-D6PpdPRJ.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-alert.entry.esm.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/p-6dfc7c02.entry.js +2 -0
- package/dist/cura/p-6dfc7c02.entry.js.map +1 -0
- package/dist/cura/p-bdfe9af2.entry.js +2 -0
- package/dist/cura/p-bdfe9af2.entry.js.map +1 -0
- package/dist/esm/{cura-accordion_20.entry.js → cura-accordion_21.entry.js} +1705 -21
- package/dist/esm/cura-accordion_21.entry.js.map +1 -0
- package/dist/esm/cura-alert.entry.js +4 -3
- package/dist/esm/cura-alert.entry.js.map +1 -1
- package/dist/esm/cura.js +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/forms/cura-select/cura-select.d.ts +21 -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-6feba852.entry.js +0 -2
- package/dist/cura/p-6feba852.entry.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/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,1511 @@ 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
|
+
function getSideAxis(placement) {
|
|
5571
|
+
return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
|
|
5572
|
+
}
|
|
5573
|
+
function getAlignmentAxis(placement) {
|
|
5574
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
5575
|
+
}
|
|
5576
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
5577
|
+
if (rtl === void 0) {
|
|
5578
|
+
rtl = false;
|
|
5579
|
+
}
|
|
5580
|
+
const alignment = getAlignment(placement);
|
|
5581
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
5582
|
+
const length = getAxisLength(alignmentAxis);
|
|
5583
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
5584
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
5585
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
5586
|
+
}
|
|
5587
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
5588
|
+
}
|
|
5589
|
+
function getExpandedPlacements(placement) {
|
|
5590
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
5591
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
5592
|
+
}
|
|
5593
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
5594
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
5595
|
+
}
|
|
5596
|
+
function getSideList(side, isStart, rtl) {
|
|
5597
|
+
const lr = ['left', 'right'];
|
|
5598
|
+
const rl = ['right', 'left'];
|
|
5599
|
+
const tb = ['top', 'bottom'];
|
|
5600
|
+
const bt = ['bottom', 'top'];
|
|
5601
|
+
switch (side) {
|
|
5602
|
+
case 'top':
|
|
5603
|
+
case 'bottom':
|
|
5604
|
+
if (rtl) return isStart ? rl : lr;
|
|
5605
|
+
return isStart ? lr : rl;
|
|
5606
|
+
case 'left':
|
|
5607
|
+
case 'right':
|
|
5608
|
+
return isStart ? tb : bt;
|
|
5609
|
+
default:
|
|
5610
|
+
return [];
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
5614
|
+
const alignment = getAlignment(placement);
|
|
5615
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
5616
|
+
if (alignment) {
|
|
5617
|
+
list = list.map(side => side + "-" + alignment);
|
|
5618
|
+
if (flipAlignment) {
|
|
5619
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
5620
|
+
}
|
|
5621
|
+
}
|
|
5622
|
+
return list;
|
|
5623
|
+
}
|
|
5624
|
+
function getOppositePlacement(placement) {
|
|
5625
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
5626
|
+
}
|
|
5627
|
+
function expandPaddingObject(padding) {
|
|
5628
|
+
return {
|
|
5629
|
+
top: 0,
|
|
5630
|
+
right: 0,
|
|
5631
|
+
bottom: 0,
|
|
5632
|
+
left: 0,
|
|
5633
|
+
...padding
|
|
5634
|
+
};
|
|
5635
|
+
}
|
|
5636
|
+
function getPaddingObject(padding) {
|
|
5637
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
5638
|
+
top: padding,
|
|
5639
|
+
right: padding,
|
|
5640
|
+
bottom: padding,
|
|
5641
|
+
left: padding
|
|
5642
|
+
};
|
|
5643
|
+
}
|
|
5644
|
+
function rectToClientRect(rect) {
|
|
5645
|
+
const {
|
|
5646
|
+
x,
|
|
5647
|
+
y,
|
|
5648
|
+
width,
|
|
5649
|
+
height
|
|
5650
|
+
} = rect;
|
|
5651
|
+
return {
|
|
5652
|
+
width,
|
|
5653
|
+
height,
|
|
5654
|
+
top: y,
|
|
5655
|
+
left: x,
|
|
5656
|
+
right: x + width,
|
|
5657
|
+
bottom: y + height,
|
|
5658
|
+
x,
|
|
5659
|
+
y
|
|
5660
|
+
};
|
|
5661
|
+
}
|
|
5662
|
+
|
|
5663
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
5664
|
+
let {
|
|
5665
|
+
reference,
|
|
5666
|
+
floating
|
|
5667
|
+
} = _ref;
|
|
5668
|
+
const sideAxis = getSideAxis(placement);
|
|
5669
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
5670
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
5671
|
+
const side = getSide(placement);
|
|
5672
|
+
const isVertical = sideAxis === 'y';
|
|
5673
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
5674
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
5675
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
5676
|
+
let coords;
|
|
5677
|
+
switch (side) {
|
|
5678
|
+
case 'top':
|
|
5679
|
+
coords = {
|
|
5680
|
+
x: commonX,
|
|
5681
|
+
y: reference.y - floating.height
|
|
5682
|
+
};
|
|
5683
|
+
break;
|
|
5684
|
+
case 'bottom':
|
|
5685
|
+
coords = {
|
|
5686
|
+
x: commonX,
|
|
5687
|
+
y: reference.y + reference.height
|
|
5688
|
+
};
|
|
5689
|
+
break;
|
|
5690
|
+
case 'right':
|
|
5691
|
+
coords = {
|
|
5692
|
+
x: reference.x + reference.width,
|
|
5693
|
+
y: commonY
|
|
5694
|
+
};
|
|
5695
|
+
break;
|
|
5696
|
+
case 'left':
|
|
5697
|
+
coords = {
|
|
5698
|
+
x: reference.x - floating.width,
|
|
5699
|
+
y: commonY
|
|
5700
|
+
};
|
|
5701
|
+
break;
|
|
5702
|
+
default:
|
|
5703
|
+
coords = {
|
|
5704
|
+
x: reference.x,
|
|
5705
|
+
y: reference.y
|
|
5706
|
+
};
|
|
5707
|
+
}
|
|
5708
|
+
switch (getAlignment(placement)) {
|
|
5709
|
+
case 'start':
|
|
5710
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
5711
|
+
break;
|
|
5712
|
+
case 'end':
|
|
5713
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
5714
|
+
break;
|
|
5715
|
+
}
|
|
5716
|
+
return coords;
|
|
5717
|
+
}
|
|
5718
|
+
|
|
5719
|
+
/**
|
|
5720
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
5721
|
+
* next to a given reference element.
|
|
5722
|
+
*
|
|
5723
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
5724
|
+
* write one for the platform you are using Floating UI with.
|
|
5725
|
+
*/
|
|
5726
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
5727
|
+
const {
|
|
5728
|
+
placement = 'bottom',
|
|
5729
|
+
strategy = 'absolute',
|
|
5730
|
+
middleware = [],
|
|
5731
|
+
platform
|
|
5732
|
+
} = config;
|
|
5733
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
5734
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
5735
|
+
let rects = await platform.getElementRects({
|
|
5736
|
+
reference,
|
|
5737
|
+
floating,
|
|
5738
|
+
strategy
|
|
5739
|
+
});
|
|
5740
|
+
let {
|
|
5741
|
+
x,
|
|
5742
|
+
y
|
|
5743
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
5744
|
+
let statefulPlacement = placement;
|
|
5745
|
+
let middlewareData = {};
|
|
5746
|
+
let resetCount = 0;
|
|
5747
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
5748
|
+
const {
|
|
5749
|
+
name,
|
|
5750
|
+
fn
|
|
5751
|
+
} = validMiddleware[i];
|
|
5752
|
+
const {
|
|
5753
|
+
x: nextX,
|
|
5754
|
+
y: nextY,
|
|
5755
|
+
data,
|
|
5756
|
+
reset
|
|
5757
|
+
} = await fn({
|
|
5758
|
+
x,
|
|
5759
|
+
y,
|
|
5760
|
+
initialPlacement: placement,
|
|
5761
|
+
placement: statefulPlacement,
|
|
5762
|
+
strategy,
|
|
5763
|
+
middlewareData,
|
|
5764
|
+
rects,
|
|
5765
|
+
platform,
|
|
5766
|
+
elements: {
|
|
5767
|
+
reference,
|
|
5768
|
+
floating
|
|
5769
|
+
}
|
|
5770
|
+
});
|
|
5771
|
+
x = nextX != null ? nextX : x;
|
|
5772
|
+
y = nextY != null ? nextY : y;
|
|
5773
|
+
middlewareData = {
|
|
5774
|
+
...middlewareData,
|
|
5775
|
+
[name]: {
|
|
5776
|
+
...middlewareData[name],
|
|
5777
|
+
...data
|
|
5778
|
+
}
|
|
5779
|
+
};
|
|
5780
|
+
if (reset && resetCount <= 50) {
|
|
5781
|
+
resetCount++;
|
|
5782
|
+
if (typeof reset === 'object') {
|
|
5783
|
+
if (reset.placement) {
|
|
5784
|
+
statefulPlacement = reset.placement;
|
|
5785
|
+
}
|
|
5786
|
+
if (reset.rects) {
|
|
5787
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
5788
|
+
reference,
|
|
5789
|
+
floating,
|
|
5790
|
+
strategy
|
|
5791
|
+
}) : reset.rects;
|
|
5792
|
+
}
|
|
5793
|
+
({
|
|
5794
|
+
x,
|
|
5795
|
+
y
|
|
5796
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
5797
|
+
}
|
|
5798
|
+
i = -1;
|
|
5799
|
+
}
|
|
5800
|
+
}
|
|
5801
|
+
return {
|
|
5802
|
+
x,
|
|
5803
|
+
y,
|
|
5804
|
+
placement: statefulPlacement,
|
|
5805
|
+
strategy,
|
|
5806
|
+
middlewareData
|
|
5807
|
+
};
|
|
5808
|
+
};
|
|
5809
|
+
|
|
5810
|
+
/**
|
|
5811
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
5812
|
+
* element is overflowing a given clipping boundary on each side.
|
|
5813
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
5814
|
+
* - negative = how many pixels left before it will overflow
|
|
5815
|
+
* - 0 = lies flush with the boundary
|
|
5816
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
5817
|
+
*/
|
|
5818
|
+
async function detectOverflow(state, options) {
|
|
5819
|
+
var _await$platform$isEle;
|
|
5820
|
+
if (options === void 0) {
|
|
5821
|
+
options = {};
|
|
5822
|
+
}
|
|
5823
|
+
const {
|
|
5824
|
+
x,
|
|
5825
|
+
y,
|
|
5826
|
+
platform,
|
|
5827
|
+
rects,
|
|
5828
|
+
elements,
|
|
5829
|
+
strategy
|
|
5830
|
+
} = state;
|
|
5831
|
+
const {
|
|
5832
|
+
boundary = 'clippingAncestors',
|
|
5833
|
+
rootBoundary = 'viewport',
|
|
5834
|
+
elementContext = 'floating',
|
|
5835
|
+
altBoundary = false,
|
|
5836
|
+
padding = 0
|
|
5837
|
+
} = evaluate(options, state);
|
|
5838
|
+
const paddingObject = getPaddingObject(padding);
|
|
5839
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
5840
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
5841
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
5842
|
+
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))),
|
|
5843
|
+
boundary,
|
|
5844
|
+
rootBoundary,
|
|
5845
|
+
strategy
|
|
5846
|
+
}));
|
|
5847
|
+
const rect = elementContext === 'floating' ? {
|
|
5848
|
+
x,
|
|
5849
|
+
y,
|
|
5850
|
+
width: rects.floating.width,
|
|
5851
|
+
height: rects.floating.height
|
|
5852
|
+
} : rects.reference;
|
|
5853
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
5854
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
5855
|
+
x: 1,
|
|
5856
|
+
y: 1
|
|
5857
|
+
} : {
|
|
5858
|
+
x: 1,
|
|
5859
|
+
y: 1
|
|
5860
|
+
};
|
|
5861
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
5862
|
+
elements,
|
|
5863
|
+
rect,
|
|
5864
|
+
offsetParent,
|
|
5865
|
+
strategy
|
|
5866
|
+
}) : rect);
|
|
5867
|
+
return {
|
|
5868
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
5869
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
5870
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
5871
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
5872
|
+
};
|
|
5873
|
+
}
|
|
5874
|
+
|
|
5875
|
+
/**
|
|
5876
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
5877
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
5878
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
5879
|
+
* @see https://floating-ui.com/docs/flip
|
|
5880
|
+
*/
|
|
5881
|
+
const flip$1 = function (options) {
|
|
5882
|
+
if (options === void 0) {
|
|
5883
|
+
options = {};
|
|
5884
|
+
}
|
|
5885
|
+
return {
|
|
5886
|
+
name: 'flip',
|
|
5887
|
+
options,
|
|
5888
|
+
async fn(state) {
|
|
5889
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
5890
|
+
const {
|
|
5891
|
+
placement,
|
|
5892
|
+
middlewareData,
|
|
5893
|
+
rects,
|
|
5894
|
+
initialPlacement,
|
|
5895
|
+
platform,
|
|
5896
|
+
elements
|
|
5897
|
+
} = state;
|
|
5898
|
+
const {
|
|
5899
|
+
mainAxis: checkMainAxis = true,
|
|
5900
|
+
crossAxis: checkCrossAxis = true,
|
|
5901
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
5902
|
+
fallbackStrategy = 'bestFit',
|
|
5903
|
+
fallbackAxisSideDirection = 'none',
|
|
5904
|
+
flipAlignment = true,
|
|
5905
|
+
...detectOverflowOptions
|
|
5906
|
+
} = evaluate(options, state);
|
|
5907
|
+
|
|
5908
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
5909
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
5910
|
+
// work.
|
|
5911
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
5912
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
5913
|
+
return {};
|
|
5914
|
+
}
|
|
5915
|
+
const side = getSide(placement);
|
|
5916
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
5917
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
5918
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
5919
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
5920
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
5921
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
5922
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
5923
|
+
}
|
|
5924
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
5925
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
5926
|
+
const overflows = [];
|
|
5927
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
5928
|
+
if (checkMainAxis) {
|
|
5929
|
+
overflows.push(overflow[side]);
|
|
5930
|
+
}
|
|
5931
|
+
if (checkCrossAxis) {
|
|
5932
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
5933
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
5934
|
+
}
|
|
5935
|
+
overflowsData = [...overflowsData, {
|
|
5936
|
+
placement,
|
|
5937
|
+
overflows
|
|
5938
|
+
}];
|
|
5939
|
+
|
|
5940
|
+
// One or more sides is overflowing.
|
|
5941
|
+
if (!overflows.every(side => side <= 0)) {
|
|
5942
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
5943
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
5944
|
+
const nextPlacement = placements[nextIndex];
|
|
5945
|
+
if (nextPlacement) {
|
|
5946
|
+
// Try next placement and re-run the lifecycle.
|
|
5947
|
+
return {
|
|
5948
|
+
data: {
|
|
5949
|
+
index: nextIndex,
|
|
5950
|
+
overflows: overflowsData
|
|
5951
|
+
},
|
|
5952
|
+
reset: {
|
|
5953
|
+
placement: nextPlacement
|
|
5954
|
+
}
|
|
5955
|
+
};
|
|
5956
|
+
}
|
|
5957
|
+
|
|
5958
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
5959
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
5960
|
+
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;
|
|
5961
|
+
|
|
5962
|
+
// Otherwise fallback.
|
|
5963
|
+
if (!resetPlacement) {
|
|
5964
|
+
switch (fallbackStrategy) {
|
|
5965
|
+
case 'bestFit':
|
|
5966
|
+
{
|
|
5967
|
+
var _overflowsData$filter2;
|
|
5968
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
5969
|
+
if (hasFallbackAxisSideDirection) {
|
|
5970
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
5971
|
+
return currentSideAxis === initialSideAxis ||
|
|
5972
|
+
// Create a bias to the `y` side axis due to horizontal
|
|
5973
|
+
// reading directions favoring greater width.
|
|
5974
|
+
currentSideAxis === 'y';
|
|
5975
|
+
}
|
|
5976
|
+
return true;
|
|
5977
|
+
}).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];
|
|
5978
|
+
if (placement) {
|
|
5979
|
+
resetPlacement = placement;
|
|
5980
|
+
}
|
|
5981
|
+
break;
|
|
5982
|
+
}
|
|
5983
|
+
case 'initialPlacement':
|
|
5984
|
+
resetPlacement = initialPlacement;
|
|
5985
|
+
break;
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
if (placement !== resetPlacement) {
|
|
5989
|
+
return {
|
|
5990
|
+
reset: {
|
|
5991
|
+
placement: resetPlacement
|
|
5992
|
+
}
|
|
5993
|
+
};
|
|
5994
|
+
}
|
|
5995
|
+
}
|
|
5996
|
+
return {};
|
|
5997
|
+
}
|
|
5998
|
+
};
|
|
5999
|
+
};
|
|
6000
|
+
|
|
6001
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
6002
|
+
// Derivable.
|
|
6003
|
+
|
|
6004
|
+
async function convertValueToCoords(state, options) {
|
|
6005
|
+
const {
|
|
6006
|
+
placement,
|
|
6007
|
+
platform,
|
|
6008
|
+
elements
|
|
6009
|
+
} = state;
|
|
6010
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
6011
|
+
const side = getSide(placement);
|
|
6012
|
+
const alignment = getAlignment(placement);
|
|
6013
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
6014
|
+
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
6015
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
6016
|
+
const rawValue = evaluate(options, state);
|
|
6017
|
+
|
|
6018
|
+
// eslint-disable-next-line prefer-const
|
|
6019
|
+
let {
|
|
6020
|
+
mainAxis,
|
|
6021
|
+
crossAxis,
|
|
6022
|
+
alignmentAxis
|
|
6023
|
+
} = typeof rawValue === 'number' ? {
|
|
6024
|
+
mainAxis: rawValue,
|
|
6025
|
+
crossAxis: 0,
|
|
6026
|
+
alignmentAxis: null
|
|
6027
|
+
} : {
|
|
6028
|
+
mainAxis: 0,
|
|
6029
|
+
crossAxis: 0,
|
|
6030
|
+
alignmentAxis: null,
|
|
6031
|
+
...rawValue
|
|
6032
|
+
};
|
|
6033
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
6034
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
6035
|
+
}
|
|
6036
|
+
return isVertical ? {
|
|
6037
|
+
x: crossAxis * crossAxisMulti,
|
|
6038
|
+
y: mainAxis * mainAxisMulti
|
|
6039
|
+
} : {
|
|
6040
|
+
x: mainAxis * mainAxisMulti,
|
|
6041
|
+
y: crossAxis * crossAxisMulti
|
|
6042
|
+
};
|
|
6043
|
+
}
|
|
6044
|
+
|
|
6045
|
+
/**
|
|
6046
|
+
* Modifies the placement by translating the floating element along the
|
|
6047
|
+
* specified axes.
|
|
6048
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
6049
|
+
* object may be passed.
|
|
6050
|
+
* @see https://floating-ui.com/docs/offset
|
|
6051
|
+
*/
|
|
6052
|
+
const offset$1 = function (options) {
|
|
6053
|
+
if (options === void 0) {
|
|
6054
|
+
options = 0;
|
|
6055
|
+
}
|
|
6056
|
+
return {
|
|
6057
|
+
name: 'offset',
|
|
6058
|
+
options,
|
|
6059
|
+
async fn(state) {
|
|
6060
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
6061
|
+
const {
|
|
6062
|
+
x,
|
|
6063
|
+
y,
|
|
6064
|
+
placement,
|
|
6065
|
+
middlewareData
|
|
6066
|
+
} = state;
|
|
6067
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
6068
|
+
|
|
6069
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
6070
|
+
// then we don't need to change the positioning coordinates.
|
|
6071
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
6072
|
+
return {};
|
|
6073
|
+
}
|
|
6074
|
+
return {
|
|
6075
|
+
x: x + diffCoords.x,
|
|
6076
|
+
y: y + diffCoords.y,
|
|
6077
|
+
data: {
|
|
6078
|
+
...diffCoords,
|
|
6079
|
+
placement
|
|
6080
|
+
}
|
|
6081
|
+
};
|
|
6082
|
+
}
|
|
6083
|
+
};
|
|
6084
|
+
};
|
|
6085
|
+
|
|
6086
|
+
/**
|
|
6087
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
6088
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
6089
|
+
* @see https://floating-ui.com/docs/shift
|
|
6090
|
+
*/
|
|
6091
|
+
const shift$1 = function (options) {
|
|
6092
|
+
if (options === void 0) {
|
|
6093
|
+
options = {};
|
|
6094
|
+
}
|
|
6095
|
+
return {
|
|
6096
|
+
name: 'shift',
|
|
6097
|
+
options,
|
|
6098
|
+
async fn(state) {
|
|
6099
|
+
const {
|
|
6100
|
+
x,
|
|
6101
|
+
y,
|
|
6102
|
+
placement
|
|
6103
|
+
} = state;
|
|
6104
|
+
const {
|
|
6105
|
+
mainAxis: checkMainAxis = true,
|
|
6106
|
+
crossAxis: checkCrossAxis = false,
|
|
6107
|
+
limiter = {
|
|
6108
|
+
fn: _ref => {
|
|
6109
|
+
let {
|
|
6110
|
+
x,
|
|
6111
|
+
y
|
|
6112
|
+
} = _ref;
|
|
6113
|
+
return {
|
|
6114
|
+
x,
|
|
6115
|
+
y
|
|
6116
|
+
};
|
|
6117
|
+
}
|
|
6118
|
+
},
|
|
6119
|
+
...detectOverflowOptions
|
|
6120
|
+
} = evaluate(options, state);
|
|
6121
|
+
const coords = {
|
|
6122
|
+
x,
|
|
6123
|
+
y
|
|
6124
|
+
};
|
|
6125
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
6126
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
6127
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
6128
|
+
let mainAxisCoord = coords[mainAxis];
|
|
6129
|
+
let crossAxisCoord = coords[crossAxis];
|
|
6130
|
+
if (checkMainAxis) {
|
|
6131
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
6132
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
6133
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
6134
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
6135
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
6136
|
+
}
|
|
6137
|
+
if (checkCrossAxis) {
|
|
6138
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
6139
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
6140
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
6141
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
6142
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
6143
|
+
}
|
|
6144
|
+
const limitedCoords = limiter.fn({
|
|
6145
|
+
...state,
|
|
6146
|
+
[mainAxis]: mainAxisCoord,
|
|
6147
|
+
[crossAxis]: crossAxisCoord
|
|
6148
|
+
});
|
|
6149
|
+
return {
|
|
6150
|
+
...limitedCoords,
|
|
6151
|
+
data: {
|
|
6152
|
+
x: limitedCoords.x - x,
|
|
6153
|
+
y: limitedCoords.y - y
|
|
6154
|
+
}
|
|
6155
|
+
};
|
|
6156
|
+
}
|
|
6157
|
+
};
|
|
6158
|
+
};
|
|
6159
|
+
|
|
6160
|
+
/**
|
|
6161
|
+
* Provides data that allows you to change the size of the floating element —
|
|
6162
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
6163
|
+
* width of the reference element.
|
|
6164
|
+
* @see https://floating-ui.com/docs/size
|
|
6165
|
+
*/
|
|
6166
|
+
const size$1 = function (options) {
|
|
6167
|
+
if (options === void 0) {
|
|
6168
|
+
options = {};
|
|
6169
|
+
}
|
|
6170
|
+
return {
|
|
6171
|
+
name: 'size',
|
|
6172
|
+
options,
|
|
6173
|
+
async fn(state) {
|
|
6174
|
+
const {
|
|
6175
|
+
placement,
|
|
6176
|
+
rects,
|
|
6177
|
+
platform,
|
|
6178
|
+
elements
|
|
6179
|
+
} = state;
|
|
6180
|
+
const {
|
|
6181
|
+
apply = () => {},
|
|
6182
|
+
...detectOverflowOptions
|
|
6183
|
+
} = evaluate(options, state);
|
|
6184
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
6185
|
+
const side = getSide(placement);
|
|
6186
|
+
const alignment = getAlignment(placement);
|
|
6187
|
+
const isYAxis = getSideAxis(placement) === 'y';
|
|
6188
|
+
const {
|
|
6189
|
+
width,
|
|
6190
|
+
height
|
|
6191
|
+
} = rects.floating;
|
|
6192
|
+
let heightSide;
|
|
6193
|
+
let widthSide;
|
|
6194
|
+
if (side === 'top' || side === 'bottom') {
|
|
6195
|
+
heightSide = side;
|
|
6196
|
+
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
6197
|
+
} else {
|
|
6198
|
+
widthSide = side;
|
|
6199
|
+
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
6200
|
+
}
|
|
6201
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
6202
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
6203
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
6204
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
6205
|
+
const noShift = !state.middlewareData.shift;
|
|
6206
|
+
let availableHeight = overflowAvailableHeight;
|
|
6207
|
+
let availableWidth = overflowAvailableWidth;
|
|
6208
|
+
if (isYAxis) {
|
|
6209
|
+
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
6210
|
+
} else {
|
|
6211
|
+
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
6212
|
+
}
|
|
6213
|
+
if (noShift && !alignment) {
|
|
6214
|
+
const xMin = max(overflow.left, 0);
|
|
6215
|
+
const xMax = max(overflow.right, 0);
|
|
6216
|
+
const yMin = max(overflow.top, 0);
|
|
6217
|
+
const yMax = max(overflow.bottom, 0);
|
|
6218
|
+
if (isYAxis) {
|
|
6219
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
6220
|
+
} else {
|
|
6221
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
6222
|
+
}
|
|
6223
|
+
}
|
|
6224
|
+
await apply({
|
|
6225
|
+
...state,
|
|
6226
|
+
availableWidth,
|
|
6227
|
+
availableHeight
|
|
6228
|
+
});
|
|
6229
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
6230
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
6231
|
+
return {
|
|
6232
|
+
reset: {
|
|
6233
|
+
rects: true
|
|
6234
|
+
}
|
|
6235
|
+
};
|
|
6236
|
+
}
|
|
6237
|
+
return {};
|
|
6238
|
+
}
|
|
6239
|
+
};
|
|
6240
|
+
};
|
|
6241
|
+
|
|
6242
|
+
function getNodeName(node) {
|
|
6243
|
+
if (isNode(node)) {
|
|
6244
|
+
return (node.nodeName || '').toLowerCase();
|
|
6245
|
+
}
|
|
6246
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
6247
|
+
// returning `#document` an infinite loop won't occur.
|
|
6248
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
6249
|
+
return '#document';
|
|
6250
|
+
}
|
|
6251
|
+
function getWindow(node) {
|
|
6252
|
+
var _node$ownerDocument;
|
|
6253
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
6254
|
+
}
|
|
6255
|
+
function getDocumentElement(node) {
|
|
6256
|
+
var _ref;
|
|
6257
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
6258
|
+
}
|
|
6259
|
+
function isNode(value) {
|
|
6260
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
6261
|
+
}
|
|
6262
|
+
function isElement(value) {
|
|
6263
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
6264
|
+
}
|
|
6265
|
+
function isHTMLElement(value) {
|
|
6266
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
6267
|
+
}
|
|
6268
|
+
function isShadowRoot(value) {
|
|
6269
|
+
// Browsers without `ShadowRoot` support.
|
|
6270
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
6271
|
+
return false;
|
|
6272
|
+
}
|
|
6273
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
6274
|
+
}
|
|
6275
|
+
function isOverflowElement(element) {
|
|
6276
|
+
const {
|
|
6277
|
+
overflow,
|
|
6278
|
+
overflowX,
|
|
6279
|
+
overflowY,
|
|
6280
|
+
display
|
|
6281
|
+
} = getComputedStyle(element);
|
|
6282
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
6283
|
+
}
|
|
6284
|
+
function isTableElement(element) {
|
|
6285
|
+
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
6286
|
+
}
|
|
6287
|
+
function isTopLayer(element) {
|
|
6288
|
+
return [':popover-open', ':modal'].some(selector => {
|
|
6289
|
+
try {
|
|
6290
|
+
return element.matches(selector);
|
|
6291
|
+
} catch (e) {
|
|
6292
|
+
return false;
|
|
6293
|
+
}
|
|
6294
|
+
});
|
|
6295
|
+
}
|
|
6296
|
+
function isContainingBlock(elementOrCss) {
|
|
6297
|
+
const webkit = isWebKit();
|
|
6298
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
6299
|
+
|
|
6300
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
6301
|
+
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
6302
|
+
}
|
|
6303
|
+
function getContainingBlock(element) {
|
|
6304
|
+
let currentNode = getParentNode(element);
|
|
6305
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
6306
|
+
if (isContainingBlock(currentNode)) {
|
|
6307
|
+
return currentNode;
|
|
6308
|
+
} else if (isTopLayer(currentNode)) {
|
|
6309
|
+
return null;
|
|
6310
|
+
}
|
|
6311
|
+
currentNode = getParentNode(currentNode);
|
|
6312
|
+
}
|
|
6313
|
+
return null;
|
|
6314
|
+
}
|
|
6315
|
+
function isWebKit() {
|
|
6316
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
6317
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
6318
|
+
}
|
|
6319
|
+
function isLastTraversableNode(node) {
|
|
6320
|
+
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
6321
|
+
}
|
|
6322
|
+
function getComputedStyle(element) {
|
|
6323
|
+
return getWindow(element).getComputedStyle(element);
|
|
6324
|
+
}
|
|
6325
|
+
function getNodeScroll(element) {
|
|
6326
|
+
if (isElement(element)) {
|
|
6327
|
+
return {
|
|
6328
|
+
scrollLeft: element.scrollLeft,
|
|
6329
|
+
scrollTop: element.scrollTop
|
|
6330
|
+
};
|
|
6331
|
+
}
|
|
6332
|
+
return {
|
|
6333
|
+
scrollLeft: element.scrollX,
|
|
6334
|
+
scrollTop: element.scrollY
|
|
6335
|
+
};
|
|
6336
|
+
}
|
|
6337
|
+
function getParentNode(node) {
|
|
6338
|
+
if (getNodeName(node) === 'html') {
|
|
6339
|
+
return node;
|
|
6340
|
+
}
|
|
6341
|
+
const result =
|
|
6342
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
6343
|
+
node.assignedSlot ||
|
|
6344
|
+
// DOM Element detected.
|
|
6345
|
+
node.parentNode ||
|
|
6346
|
+
// ShadowRoot detected.
|
|
6347
|
+
isShadowRoot(node) && node.host ||
|
|
6348
|
+
// Fallback.
|
|
6349
|
+
getDocumentElement(node);
|
|
6350
|
+
return isShadowRoot(result) ? result.host : result;
|
|
6351
|
+
}
|
|
6352
|
+
function getNearestOverflowAncestor(node) {
|
|
6353
|
+
const parentNode = getParentNode(node);
|
|
6354
|
+
if (isLastTraversableNode(parentNode)) {
|
|
6355
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
6356
|
+
}
|
|
6357
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
6358
|
+
return parentNode;
|
|
6359
|
+
}
|
|
6360
|
+
return getNearestOverflowAncestor(parentNode);
|
|
6361
|
+
}
|
|
6362
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
6363
|
+
var _node$ownerDocument2;
|
|
6364
|
+
if (list === void 0) {
|
|
6365
|
+
list = [];
|
|
6366
|
+
}
|
|
6367
|
+
if (traverseIframes === void 0) {
|
|
6368
|
+
traverseIframes = true;
|
|
6369
|
+
}
|
|
6370
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
6371
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
6372
|
+
const win = getWindow(scrollableAncestor);
|
|
6373
|
+
if (isBody) {
|
|
6374
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
6375
|
+
}
|
|
6376
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
6377
|
+
}
|
|
6378
|
+
|
|
6379
|
+
function getCssDimensions(element) {
|
|
6380
|
+
const css = getComputedStyle(element);
|
|
6381
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
6382
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
6383
|
+
let width = parseFloat(css.width) || 0;
|
|
6384
|
+
let height = parseFloat(css.height) || 0;
|
|
6385
|
+
const hasOffset = isHTMLElement(element);
|
|
6386
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
6387
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
6388
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
6389
|
+
if (shouldFallback) {
|
|
6390
|
+
width = offsetWidth;
|
|
6391
|
+
height = offsetHeight;
|
|
6392
|
+
}
|
|
6393
|
+
return {
|
|
6394
|
+
width,
|
|
6395
|
+
height,
|
|
6396
|
+
$: shouldFallback
|
|
6397
|
+
};
|
|
6398
|
+
}
|
|
6399
|
+
|
|
6400
|
+
function unwrapElement(element) {
|
|
6401
|
+
return !isElement(element) ? element.contextElement : element;
|
|
6402
|
+
}
|
|
6403
|
+
|
|
6404
|
+
function getScale(element) {
|
|
6405
|
+
const domElement = unwrapElement(element);
|
|
6406
|
+
if (!isHTMLElement(domElement)) {
|
|
6407
|
+
return createCoords(1);
|
|
6408
|
+
}
|
|
6409
|
+
const rect = domElement.getBoundingClientRect();
|
|
6410
|
+
const {
|
|
6411
|
+
width,
|
|
6412
|
+
height,
|
|
6413
|
+
$
|
|
6414
|
+
} = getCssDimensions(domElement);
|
|
6415
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
6416
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
6417
|
+
|
|
6418
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
6419
|
+
|
|
6420
|
+
if (!x || !Number.isFinite(x)) {
|
|
6421
|
+
x = 1;
|
|
6422
|
+
}
|
|
6423
|
+
if (!y || !Number.isFinite(y)) {
|
|
6424
|
+
y = 1;
|
|
6425
|
+
}
|
|
6426
|
+
return {
|
|
6427
|
+
x,
|
|
6428
|
+
y
|
|
6429
|
+
};
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6432
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
6433
|
+
function getVisualOffsets(element) {
|
|
6434
|
+
const win = getWindow(element);
|
|
6435
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
6436
|
+
return noOffsets;
|
|
6437
|
+
}
|
|
6438
|
+
return {
|
|
6439
|
+
x: win.visualViewport.offsetLeft,
|
|
6440
|
+
y: win.visualViewport.offsetTop
|
|
6441
|
+
};
|
|
6442
|
+
}
|
|
6443
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
6444
|
+
if (isFixed === void 0) {
|
|
6445
|
+
isFixed = false;
|
|
6446
|
+
}
|
|
6447
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
6448
|
+
return false;
|
|
6449
|
+
}
|
|
6450
|
+
return isFixed;
|
|
6451
|
+
}
|
|
6452
|
+
|
|
6453
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
6454
|
+
if (includeScale === void 0) {
|
|
6455
|
+
includeScale = false;
|
|
6456
|
+
}
|
|
6457
|
+
if (isFixedStrategy === void 0) {
|
|
6458
|
+
isFixedStrategy = false;
|
|
6459
|
+
}
|
|
6460
|
+
const clientRect = element.getBoundingClientRect();
|
|
6461
|
+
const domElement = unwrapElement(element);
|
|
6462
|
+
let scale = createCoords(1);
|
|
6463
|
+
if (includeScale) {
|
|
6464
|
+
if (offsetParent) {
|
|
6465
|
+
if (isElement(offsetParent)) {
|
|
6466
|
+
scale = getScale(offsetParent);
|
|
6467
|
+
}
|
|
6468
|
+
} else {
|
|
6469
|
+
scale = getScale(element);
|
|
6470
|
+
}
|
|
6471
|
+
}
|
|
6472
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
6473
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
6474
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
6475
|
+
let width = clientRect.width / scale.x;
|
|
6476
|
+
let height = clientRect.height / scale.y;
|
|
6477
|
+
if (domElement) {
|
|
6478
|
+
const win = getWindow(domElement);
|
|
6479
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
6480
|
+
let currentWin = win;
|
|
6481
|
+
let currentIFrame = currentWin.frameElement;
|
|
6482
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
6483
|
+
const iframeScale = getScale(currentIFrame);
|
|
6484
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
6485
|
+
const css = getComputedStyle(currentIFrame);
|
|
6486
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
6487
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
6488
|
+
x *= iframeScale.x;
|
|
6489
|
+
y *= iframeScale.y;
|
|
6490
|
+
width *= iframeScale.x;
|
|
6491
|
+
height *= iframeScale.y;
|
|
6492
|
+
x += left;
|
|
6493
|
+
y += top;
|
|
6494
|
+
currentWin = getWindow(currentIFrame);
|
|
6495
|
+
currentIFrame = currentWin.frameElement;
|
|
6496
|
+
}
|
|
6497
|
+
}
|
|
6498
|
+
return rectToClientRect({
|
|
6499
|
+
width,
|
|
6500
|
+
height,
|
|
6501
|
+
x,
|
|
6502
|
+
y
|
|
6503
|
+
});
|
|
6504
|
+
}
|
|
6505
|
+
|
|
6506
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
6507
|
+
let {
|
|
6508
|
+
elements,
|
|
6509
|
+
rect,
|
|
6510
|
+
offsetParent,
|
|
6511
|
+
strategy
|
|
6512
|
+
} = _ref;
|
|
6513
|
+
const isFixed = strategy === 'fixed';
|
|
6514
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
6515
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
6516
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
6517
|
+
return rect;
|
|
6518
|
+
}
|
|
6519
|
+
let scroll = {
|
|
6520
|
+
scrollLeft: 0,
|
|
6521
|
+
scrollTop: 0
|
|
6522
|
+
};
|
|
6523
|
+
let scale = createCoords(1);
|
|
6524
|
+
const offsets = createCoords(0);
|
|
6525
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
6526
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
6527
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
6528
|
+
scroll = getNodeScroll(offsetParent);
|
|
6529
|
+
}
|
|
6530
|
+
if (isHTMLElement(offsetParent)) {
|
|
6531
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
6532
|
+
scale = getScale(offsetParent);
|
|
6533
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
6534
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
return {
|
|
6538
|
+
width: rect.width * scale.x,
|
|
6539
|
+
height: rect.height * scale.y,
|
|
6540
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
6541
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
6542
|
+
};
|
|
6543
|
+
}
|
|
6544
|
+
|
|
6545
|
+
function getClientRects(element) {
|
|
6546
|
+
return Array.from(element.getClientRects());
|
|
6547
|
+
}
|
|
6548
|
+
|
|
6549
|
+
function getWindowScrollBarX(element) {
|
|
6550
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
6551
|
+
// incorrect for RTL.
|
|
6552
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
6553
|
+
}
|
|
6554
|
+
|
|
6555
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
6556
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
6557
|
+
function getDocumentRect(element) {
|
|
6558
|
+
const html = getDocumentElement(element);
|
|
6559
|
+
const scroll = getNodeScroll(element);
|
|
6560
|
+
const body = element.ownerDocument.body;
|
|
6561
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
6562
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
6563
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
6564
|
+
const y = -scroll.scrollTop;
|
|
6565
|
+
if (getComputedStyle(body).direction === 'rtl') {
|
|
6566
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
6567
|
+
}
|
|
6568
|
+
return {
|
|
6569
|
+
width,
|
|
6570
|
+
height,
|
|
6571
|
+
x,
|
|
6572
|
+
y
|
|
6573
|
+
};
|
|
6574
|
+
}
|
|
6575
|
+
|
|
6576
|
+
function getViewportRect(element, strategy) {
|
|
6577
|
+
const win = getWindow(element);
|
|
6578
|
+
const html = getDocumentElement(element);
|
|
6579
|
+
const visualViewport = win.visualViewport;
|
|
6580
|
+
let width = html.clientWidth;
|
|
6581
|
+
let height = html.clientHeight;
|
|
6582
|
+
let x = 0;
|
|
6583
|
+
let y = 0;
|
|
6584
|
+
if (visualViewport) {
|
|
6585
|
+
width = visualViewport.width;
|
|
6586
|
+
height = visualViewport.height;
|
|
6587
|
+
const visualViewportBased = isWebKit();
|
|
6588
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
6589
|
+
x = visualViewport.offsetLeft;
|
|
6590
|
+
y = visualViewport.offsetTop;
|
|
6591
|
+
}
|
|
6592
|
+
}
|
|
6593
|
+
return {
|
|
6594
|
+
width,
|
|
6595
|
+
height,
|
|
6596
|
+
x,
|
|
6597
|
+
y
|
|
6598
|
+
};
|
|
6599
|
+
}
|
|
6600
|
+
|
|
6601
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
6602
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
6603
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
6604
|
+
const top = clientRect.top + element.clientTop;
|
|
6605
|
+
const left = clientRect.left + element.clientLeft;
|
|
6606
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
6607
|
+
const width = element.clientWidth * scale.x;
|
|
6608
|
+
const height = element.clientHeight * scale.y;
|
|
6609
|
+
const x = left * scale.x;
|
|
6610
|
+
const y = top * scale.y;
|
|
6611
|
+
return {
|
|
6612
|
+
width,
|
|
6613
|
+
height,
|
|
6614
|
+
x,
|
|
6615
|
+
y
|
|
6616
|
+
};
|
|
6617
|
+
}
|
|
6618
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
6619
|
+
let rect;
|
|
6620
|
+
if (clippingAncestor === 'viewport') {
|
|
6621
|
+
rect = getViewportRect(element, strategy);
|
|
6622
|
+
} else if (clippingAncestor === 'document') {
|
|
6623
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
6624
|
+
} else if (isElement(clippingAncestor)) {
|
|
6625
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
6626
|
+
} else {
|
|
6627
|
+
const visualOffsets = getVisualOffsets(element);
|
|
6628
|
+
rect = {
|
|
6629
|
+
...clippingAncestor,
|
|
6630
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
6631
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
6632
|
+
};
|
|
6633
|
+
}
|
|
6634
|
+
return rectToClientRect(rect);
|
|
6635
|
+
}
|
|
6636
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
6637
|
+
const parentNode = getParentNode(element);
|
|
6638
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
6639
|
+
return false;
|
|
6640
|
+
}
|
|
6641
|
+
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
6642
|
+
}
|
|
6643
|
+
|
|
6644
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
6645
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
6646
|
+
// of the given element up the tree.
|
|
6647
|
+
function getClippingElementAncestors(element, cache) {
|
|
6648
|
+
const cachedResult = cache.get(element);
|
|
6649
|
+
if (cachedResult) {
|
|
6650
|
+
return cachedResult;
|
|
6651
|
+
}
|
|
6652
|
+
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
6653
|
+
let currentContainingBlockComputedStyle = null;
|
|
6654
|
+
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
6655
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
6656
|
+
|
|
6657
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
6658
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
6659
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
6660
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
6661
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
6662
|
+
currentContainingBlockComputedStyle = null;
|
|
6663
|
+
}
|
|
6664
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
6665
|
+
if (shouldDropCurrentNode) {
|
|
6666
|
+
// Drop non-containing blocks.
|
|
6667
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
6668
|
+
} else {
|
|
6669
|
+
// Record last containing block for next iteration.
|
|
6670
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
6671
|
+
}
|
|
6672
|
+
currentNode = getParentNode(currentNode);
|
|
6673
|
+
}
|
|
6674
|
+
cache.set(element, result);
|
|
6675
|
+
return result;
|
|
6676
|
+
}
|
|
6677
|
+
|
|
6678
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
6679
|
+
// clipping ancestors.
|
|
6680
|
+
function getClippingRect(_ref) {
|
|
6681
|
+
let {
|
|
6682
|
+
element,
|
|
6683
|
+
boundary,
|
|
6684
|
+
rootBoundary,
|
|
6685
|
+
strategy
|
|
6686
|
+
} = _ref;
|
|
6687
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
6688
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
6689
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
6690
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
6691
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
6692
|
+
accRect.top = max(rect.top, accRect.top);
|
|
6693
|
+
accRect.right = min(rect.right, accRect.right);
|
|
6694
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
6695
|
+
accRect.left = max(rect.left, accRect.left);
|
|
6696
|
+
return accRect;
|
|
6697
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
6698
|
+
return {
|
|
6699
|
+
width: clippingRect.right - clippingRect.left,
|
|
6700
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
6701
|
+
x: clippingRect.left,
|
|
6702
|
+
y: clippingRect.top
|
|
6703
|
+
};
|
|
6704
|
+
}
|
|
6705
|
+
|
|
6706
|
+
function getDimensions(element) {
|
|
6707
|
+
const {
|
|
6708
|
+
width,
|
|
6709
|
+
height
|
|
6710
|
+
} = getCssDimensions(element);
|
|
6711
|
+
return {
|
|
6712
|
+
width,
|
|
6713
|
+
height
|
|
6714
|
+
};
|
|
6715
|
+
}
|
|
6716
|
+
|
|
6717
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
6718
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
6719
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
6720
|
+
const isFixed = strategy === 'fixed';
|
|
6721
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
6722
|
+
let scroll = {
|
|
6723
|
+
scrollLeft: 0,
|
|
6724
|
+
scrollTop: 0
|
|
6725
|
+
};
|
|
6726
|
+
const offsets = createCoords(0);
|
|
6727
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
6728
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
6729
|
+
scroll = getNodeScroll(offsetParent);
|
|
6730
|
+
}
|
|
6731
|
+
if (isOffsetParentAnElement) {
|
|
6732
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
6733
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
6734
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
6735
|
+
} else if (documentElement) {
|
|
6736
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
6737
|
+
}
|
|
6738
|
+
}
|
|
6739
|
+
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
6740
|
+
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
6741
|
+
return {
|
|
6742
|
+
x,
|
|
6743
|
+
y,
|
|
6744
|
+
width: rect.width,
|
|
6745
|
+
height: rect.height
|
|
6746
|
+
};
|
|
6747
|
+
}
|
|
6748
|
+
|
|
6749
|
+
function isStaticPositioned(element) {
|
|
6750
|
+
return getComputedStyle(element).position === 'static';
|
|
6751
|
+
}
|
|
6752
|
+
|
|
6753
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
6754
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
6755
|
+
return null;
|
|
6756
|
+
}
|
|
6757
|
+
if (polyfill) {
|
|
6758
|
+
return polyfill(element);
|
|
6759
|
+
}
|
|
6760
|
+
return element.offsetParent;
|
|
6761
|
+
}
|
|
6762
|
+
|
|
6763
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
6764
|
+
// such as table ancestors and cross browser bugs.
|
|
6765
|
+
function getOffsetParent(element, polyfill) {
|
|
6766
|
+
const win = getWindow(element);
|
|
6767
|
+
if (isTopLayer(element)) {
|
|
6768
|
+
return win;
|
|
6769
|
+
}
|
|
6770
|
+
if (!isHTMLElement(element)) {
|
|
6771
|
+
let svgOffsetParent = getParentNode(element);
|
|
6772
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
6773
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
6774
|
+
return svgOffsetParent;
|
|
6775
|
+
}
|
|
6776
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
6777
|
+
}
|
|
6778
|
+
return win;
|
|
6779
|
+
}
|
|
6780
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
6781
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
6782
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
6783
|
+
}
|
|
6784
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
6785
|
+
return win;
|
|
6786
|
+
}
|
|
6787
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
6788
|
+
}
|
|
6789
|
+
|
|
6790
|
+
const getElementRects = async function (data) {
|
|
6791
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
6792
|
+
const getDimensionsFn = this.getDimensions;
|
|
6793
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
6794
|
+
return {
|
|
6795
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
6796
|
+
floating: {
|
|
6797
|
+
x: 0,
|
|
6798
|
+
y: 0,
|
|
6799
|
+
width: floatingDimensions.width,
|
|
6800
|
+
height: floatingDimensions.height
|
|
6801
|
+
}
|
|
6802
|
+
};
|
|
6803
|
+
};
|
|
6804
|
+
|
|
6805
|
+
function isRTL(element) {
|
|
6806
|
+
return getComputedStyle(element).direction === 'rtl';
|
|
6807
|
+
}
|
|
6808
|
+
|
|
6809
|
+
const platform = {
|
|
6810
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
6811
|
+
getDocumentElement,
|
|
6812
|
+
getClippingRect,
|
|
6813
|
+
getOffsetParent,
|
|
6814
|
+
getElementRects,
|
|
6815
|
+
getClientRects,
|
|
6816
|
+
getDimensions,
|
|
6817
|
+
getScale,
|
|
6818
|
+
isElement,
|
|
6819
|
+
isRTL
|
|
6820
|
+
};
|
|
6821
|
+
|
|
6822
|
+
// https://samthor.au/2021/observing-dom/
|
|
6823
|
+
function observeMove(element, onMove) {
|
|
6824
|
+
let io = null;
|
|
6825
|
+
let timeoutId;
|
|
6826
|
+
const root = getDocumentElement(element);
|
|
6827
|
+
function cleanup() {
|
|
6828
|
+
var _io;
|
|
6829
|
+
clearTimeout(timeoutId);
|
|
6830
|
+
(_io = io) == null || _io.disconnect();
|
|
6831
|
+
io = null;
|
|
6832
|
+
}
|
|
6833
|
+
function refresh(skip, threshold) {
|
|
6834
|
+
if (skip === void 0) {
|
|
6835
|
+
skip = false;
|
|
6836
|
+
}
|
|
6837
|
+
if (threshold === void 0) {
|
|
6838
|
+
threshold = 1;
|
|
6839
|
+
}
|
|
6840
|
+
cleanup();
|
|
6841
|
+
const {
|
|
6842
|
+
left,
|
|
6843
|
+
top,
|
|
6844
|
+
width,
|
|
6845
|
+
height
|
|
6846
|
+
} = element.getBoundingClientRect();
|
|
6847
|
+
if (!skip) {
|
|
6848
|
+
onMove();
|
|
6849
|
+
}
|
|
6850
|
+
if (!width || !height) {
|
|
6851
|
+
return;
|
|
6852
|
+
}
|
|
6853
|
+
const insetTop = floor(top);
|
|
6854
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
6855
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
6856
|
+
const insetLeft = floor(left);
|
|
6857
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
6858
|
+
const options = {
|
|
6859
|
+
rootMargin,
|
|
6860
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
6861
|
+
};
|
|
6862
|
+
let isFirstUpdate = true;
|
|
6863
|
+
function handleObserve(entries) {
|
|
6864
|
+
const ratio = entries[0].intersectionRatio;
|
|
6865
|
+
if (ratio !== threshold) {
|
|
6866
|
+
if (!isFirstUpdate) {
|
|
6867
|
+
return refresh();
|
|
6868
|
+
}
|
|
6869
|
+
if (!ratio) {
|
|
6870
|
+
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
6871
|
+
// to prevent an infinite loop of updates.
|
|
6872
|
+
timeoutId = setTimeout(() => {
|
|
6873
|
+
refresh(false, 1e-7);
|
|
6874
|
+
}, 1000);
|
|
6875
|
+
} else {
|
|
6876
|
+
refresh(false, ratio);
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6879
|
+
isFirstUpdate = false;
|
|
6880
|
+
}
|
|
6881
|
+
|
|
6882
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
6883
|
+
// error.
|
|
6884
|
+
try {
|
|
6885
|
+
io = new IntersectionObserver(handleObserve, {
|
|
6886
|
+
...options,
|
|
6887
|
+
// Handle <iframe>s
|
|
6888
|
+
root: root.ownerDocument
|
|
6889
|
+
});
|
|
6890
|
+
} catch (e) {
|
|
6891
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
6892
|
+
}
|
|
6893
|
+
io.observe(element);
|
|
6894
|
+
}
|
|
6895
|
+
refresh(true);
|
|
6896
|
+
return cleanup;
|
|
6897
|
+
}
|
|
6898
|
+
|
|
6899
|
+
/**
|
|
6900
|
+
* Automatically updates the position of the floating element when necessary.
|
|
6901
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
6902
|
+
* visible on the screen.
|
|
6903
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
6904
|
+
* removed from the DOM or hidden from the screen.
|
|
6905
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
6906
|
+
*/
|
|
6907
|
+
function autoUpdate(reference, floating, update, options) {
|
|
6908
|
+
if (options === void 0) {
|
|
6909
|
+
options = {};
|
|
6910
|
+
}
|
|
6911
|
+
const {
|
|
6912
|
+
ancestorScroll = true,
|
|
6913
|
+
ancestorResize = true,
|
|
6914
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
6915
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
6916
|
+
animationFrame = false
|
|
6917
|
+
} = options;
|
|
6918
|
+
const referenceEl = unwrapElement(reference);
|
|
6919
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
6920
|
+
ancestors.forEach(ancestor => {
|
|
6921
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
6922
|
+
passive: true
|
|
6923
|
+
});
|
|
6924
|
+
ancestorResize && ancestor.addEventListener('resize', update);
|
|
6925
|
+
});
|
|
6926
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
6927
|
+
let reobserveFrame = -1;
|
|
6928
|
+
let resizeObserver = null;
|
|
6929
|
+
if (elementResize) {
|
|
6930
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
6931
|
+
let [firstEntry] = _ref;
|
|
6932
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
6933
|
+
// Prevent update loops when using the `size` middleware.
|
|
6934
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
6935
|
+
resizeObserver.unobserve(floating);
|
|
6936
|
+
cancelAnimationFrame(reobserveFrame);
|
|
6937
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
6938
|
+
var _resizeObserver;
|
|
6939
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
6940
|
+
});
|
|
6941
|
+
}
|
|
6942
|
+
update();
|
|
6943
|
+
});
|
|
6944
|
+
if (referenceEl && !animationFrame) {
|
|
6945
|
+
resizeObserver.observe(referenceEl);
|
|
6946
|
+
}
|
|
6947
|
+
resizeObserver.observe(floating);
|
|
6948
|
+
}
|
|
6949
|
+
let frameId;
|
|
6950
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
6951
|
+
if (animationFrame) {
|
|
6952
|
+
frameLoop();
|
|
6953
|
+
}
|
|
6954
|
+
function frameLoop() {
|
|
6955
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
6956
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
6957
|
+
update();
|
|
6958
|
+
}
|
|
6959
|
+
prevRefRect = nextRefRect;
|
|
6960
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
6961
|
+
}
|
|
6962
|
+
update();
|
|
6963
|
+
return () => {
|
|
6964
|
+
var _resizeObserver2;
|
|
6965
|
+
ancestors.forEach(ancestor => {
|
|
6966
|
+
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
6967
|
+
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
6968
|
+
});
|
|
6969
|
+
cleanupIo == null || cleanupIo();
|
|
6970
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
6971
|
+
resizeObserver = null;
|
|
6972
|
+
if (animationFrame) {
|
|
6973
|
+
cancelAnimationFrame(frameId);
|
|
6974
|
+
}
|
|
6975
|
+
};
|
|
6976
|
+
}
|
|
6977
|
+
|
|
6978
|
+
/**
|
|
6979
|
+
* Modifies the placement by translating the floating element along the
|
|
6980
|
+
* specified axes.
|
|
6981
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
6982
|
+
* object may be passed.
|
|
6983
|
+
* @see https://floating-ui.com/docs/offset
|
|
6984
|
+
*/
|
|
6985
|
+
const offset = offset$1;
|
|
6986
|
+
|
|
6987
|
+
/**
|
|
6988
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
6989
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
6990
|
+
* @see https://floating-ui.com/docs/shift
|
|
6991
|
+
*/
|
|
6992
|
+
const shift = shift$1;
|
|
6993
|
+
|
|
6994
|
+
/**
|
|
6995
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
6996
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
6997
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
6998
|
+
* @see https://floating-ui.com/docs/flip
|
|
6999
|
+
*/
|
|
7000
|
+
const flip = flip$1;
|
|
7001
|
+
|
|
7002
|
+
/**
|
|
7003
|
+
* Provides data that allows you to change the size of the floating element —
|
|
7004
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
7005
|
+
* width of the reference element.
|
|
7006
|
+
* @see https://floating-ui.com/docs/size
|
|
7007
|
+
*/
|
|
7008
|
+
const size = size$1;
|
|
7009
|
+
|
|
7010
|
+
/**
|
|
7011
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
7012
|
+
* next to a given reference element.
|
|
7013
|
+
*/
|
|
7014
|
+
const computePosition = (reference, floating, options) => {
|
|
7015
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
7016
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
7017
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
7018
|
+
const cache = new Map();
|
|
7019
|
+
const mergedOptions = {
|
|
7020
|
+
platform,
|
|
7021
|
+
...options
|
|
7022
|
+
};
|
|
7023
|
+
const platformWithCache = {
|
|
7024
|
+
...mergedOptions.platform,
|
|
7025
|
+
_c: cache
|
|
7026
|
+
};
|
|
7027
|
+
return computePosition$1(reference, floating, {
|
|
7028
|
+
...mergedOptions,
|
|
7029
|
+
platform: platformWithCache
|
|
7030
|
+
});
|
|
7031
|
+
};
|
|
7032
|
+
|
|
7033
|
+
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
7034
|
|
|
5439
7035
|
const CuraSelect = class {
|
|
5440
7036
|
constructor(hostRef) {
|
|
@@ -5519,8 +7115,17 @@ const CuraSelect = class {
|
|
|
5519
7115
|
* Default: false
|
|
5520
7116
|
*/
|
|
5521
7117
|
this.isOpen = false;
|
|
7118
|
+
this.isPositioned = false;
|
|
7119
|
+
this.menuStyle = {
|
|
7120
|
+
top: '0px',
|
|
7121
|
+
left: '0px',
|
|
7122
|
+
width: '0px',
|
|
7123
|
+
maxHeight: this.maxHeight,
|
|
7124
|
+
};
|
|
5522
7125
|
this.activeIndex = -1;
|
|
7126
|
+
this.preferredPlacement = 'bottom';
|
|
5523
7127
|
this.textInput = '';
|
|
7128
|
+
this.floatingPlacement = 'bottom-start';
|
|
5524
7129
|
/**
|
|
5525
7130
|
* Styles to be applied to the component.
|
|
5526
7131
|
*/
|
|
@@ -5553,7 +7158,7 @@ const CuraSelect = class {
|
|
|
5553
7158
|
var _a;
|
|
5554
7159
|
const { code: keyCode } = event;
|
|
5555
7160
|
if (!this.isOpen && keyCode === 'ArrowDown') {
|
|
5556
|
-
this.
|
|
7161
|
+
this.openMenu();
|
|
5557
7162
|
this.activeIndex = 0;
|
|
5558
7163
|
return;
|
|
5559
7164
|
}
|
|
@@ -5569,12 +7174,17 @@ const CuraSelect = class {
|
|
|
5569
7174
|
(_a = this.options[this.activeIndex]) === null || _a === void 0 ? void 0 : _a.click();
|
|
5570
7175
|
}
|
|
5571
7176
|
if (keyCode === 'Escape') {
|
|
5572
|
-
this.
|
|
7177
|
+
this.closeMenu();
|
|
5573
7178
|
}
|
|
5574
7179
|
};
|
|
5575
7180
|
this.handleInputChange = (e) => {
|
|
5576
7181
|
this.textInput = e.target.value;
|
|
5577
|
-
|
|
7182
|
+
if (this.searchBehavior) {
|
|
7183
|
+
if (this.textInput.length > 0 && !this.isOpen)
|
|
7184
|
+
this.openMenu();
|
|
7185
|
+
if (this.textInput.length === 0 && this.isOpen)
|
|
7186
|
+
this.closeMenu();
|
|
7187
|
+
}
|
|
5578
7188
|
this.internals.setFormValue(this.textInput);
|
|
5579
7189
|
};
|
|
5580
7190
|
this.handleClick = (event) => {
|
|
@@ -5583,14 +7193,20 @@ const CuraSelect = class {
|
|
|
5583
7193
|
const target = event.target;
|
|
5584
7194
|
if (target.tagName === 'CURA-SELECT-OPTION')
|
|
5585
7195
|
return this.onOptiselected(event);
|
|
5586
|
-
this.isOpen
|
|
7196
|
+
this.isOpen ? this.closeMenu() : this.openMenu();
|
|
5587
7197
|
};
|
|
5588
7198
|
this.handleClickOutside = (event) => {
|
|
5589
|
-
const
|
|
7199
|
+
const path = (event.composedPath && event.composedPath()) || [];
|
|
7200
|
+
const clickedOutside = !path.includes(this.host) && !(this.menuElement && path.includes(this.menuElement));
|
|
5590
7201
|
if (clickedOutside) {
|
|
5591
|
-
this.
|
|
7202
|
+
this.closeMenu();
|
|
5592
7203
|
}
|
|
5593
7204
|
};
|
|
7205
|
+
this.handleViewportChange = () => {
|
|
7206
|
+
if (!this.isOpen)
|
|
7207
|
+
return;
|
|
7208
|
+
this.updateMenuPosition();
|
|
7209
|
+
};
|
|
5594
7210
|
}
|
|
5595
7211
|
updateOptionHighlights(newActiveINdex) {
|
|
5596
7212
|
this.options.forEach((option, index) => (option.active = index === newActiveINdex));
|
|
@@ -5662,6 +7278,7 @@ const CuraSelect = class {
|
|
|
5662
7278
|
// this.initializeOptions();
|
|
5663
7279
|
this.setupMutationObserver();
|
|
5664
7280
|
this.addOutsideClickListener();
|
|
7281
|
+
this.addPositionListeners();
|
|
5665
7282
|
}
|
|
5666
7283
|
/**
|
|
5667
7284
|
* Lifecycle method called when the component is connected to the DOM.
|
|
@@ -5675,9 +7292,11 @@ const CuraSelect = class {
|
|
|
5675
7292
|
* Disconnects the MutationObserver if it exists.
|
|
5676
7293
|
*/
|
|
5677
7294
|
disconnectedCallback() {
|
|
5678
|
-
var _a;
|
|
7295
|
+
var _a, _b;
|
|
5679
7296
|
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
5680
7297
|
this.removeOutsideClickListener();
|
|
7298
|
+
this.removePositionListeners();
|
|
7299
|
+
(_b = this.cleanupAutoUpdate) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
5681
7300
|
}
|
|
5682
7301
|
initializeOptions() {
|
|
5683
7302
|
var _a;
|
|
@@ -5746,7 +7365,7 @@ const CuraSelect = class {
|
|
|
5746
7365
|
this.internals.setFormValue(this.value);
|
|
5747
7366
|
if (this.textInput !== selectedOptionElement.textContent) {
|
|
5748
7367
|
this.textInput = selectedOptionElement.textContent;
|
|
5749
|
-
this.
|
|
7368
|
+
this.closeMenu();
|
|
5750
7369
|
this.selected.emit(selectedOptionElement.value);
|
|
5751
7370
|
}
|
|
5752
7371
|
}
|
|
@@ -5801,20 +7420,85 @@ const CuraSelect = class {
|
|
|
5801
7420
|
const icon = { default: this.iconName, success: 'checkCircle', error: 'alertCircle' }[this.status];
|
|
5802
7421
|
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
7422
|
}
|
|
7423
|
+
openMenu() {
|
|
7424
|
+
this.isOpen = true;
|
|
7425
|
+
this.isPositioned = false;
|
|
7426
|
+
requestAnimationFrame(() => this.setupFloating());
|
|
7427
|
+
}
|
|
7428
|
+
closeMenu() {
|
|
7429
|
+
var _a;
|
|
7430
|
+
this.isOpen = false;
|
|
7431
|
+
this.isPositioned = false;
|
|
7432
|
+
(_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7433
|
+
}
|
|
5804
7434
|
addOutsideClickListener() {
|
|
5805
7435
|
document.addEventListener('click', this.handleClickOutside);
|
|
5806
7436
|
}
|
|
5807
7437
|
removeOutsideClickListener() {
|
|
5808
7438
|
document.removeEventListener('click', this.handleClickOutside);
|
|
5809
7439
|
}
|
|
7440
|
+
addPositionListeners() {
|
|
7441
|
+
window.addEventListener('resize', this.handleViewportChange, { passive: true });
|
|
7442
|
+
window.addEventListener('scroll', this.handleViewportChange, true);
|
|
7443
|
+
}
|
|
7444
|
+
removePositionListeners() {
|
|
7445
|
+
window.removeEventListener('resize', this.handleViewportChange);
|
|
7446
|
+
window.removeEventListener('scroll', this.handleViewportChange, true);
|
|
7447
|
+
}
|
|
7448
|
+
parseMaxHeight() {
|
|
7449
|
+
const numeric = parseFloat(this.maxHeight);
|
|
7450
|
+
return Number.isFinite(numeric) ? numeric : 285;
|
|
7451
|
+
}
|
|
7452
|
+
setupFloating() {
|
|
7453
|
+
var _a;
|
|
7454
|
+
if (!this.inputWrapper || !this.menuElement)
|
|
7455
|
+
return;
|
|
7456
|
+
(_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7457
|
+
this.cleanupAutoUpdate = autoUpdate(this.inputWrapper, this.menuElement, () => {
|
|
7458
|
+
this.updateMenuPosition();
|
|
7459
|
+
});
|
|
7460
|
+
this.updateMenuPosition();
|
|
7461
|
+
}
|
|
7462
|
+
updateMenuPosition() {
|
|
7463
|
+
if (!this.inputWrapper || !this.menuElement)
|
|
7464
|
+
return;
|
|
7465
|
+
computePosition(this.inputWrapper, this.menuElement, {
|
|
7466
|
+
strategy: 'fixed',
|
|
7467
|
+
placement: this.floatingPlacement,
|
|
7468
|
+
middleware: [
|
|
7469
|
+
offset(0),
|
|
7470
|
+
flip(),
|
|
7471
|
+
shift({ padding: 8 }),
|
|
7472
|
+
size({
|
|
7473
|
+
apply: ({ rects, availableHeight }) => {
|
|
7474
|
+
this.menuStyle = Object.assign(Object.assign({}, this.menuStyle), { width: `${rects.reference.width}px`, maxHeight: `${Math.min(availableHeight, this.parseMaxHeight())}px` });
|
|
7475
|
+
},
|
|
7476
|
+
}),
|
|
7477
|
+
],
|
|
7478
|
+
}).then(({ x, y, placement }) => {
|
|
7479
|
+
this.preferredPlacement = placement.startsWith('top') ? 'top' : 'bottom';
|
|
7480
|
+
this.menuStyle = Object.assign(Object.assign({}, this.menuStyle), { top: `${y}px`, left: `${x}px` });
|
|
7481
|
+
this.isPositioned = true;
|
|
7482
|
+
});
|
|
7483
|
+
}
|
|
5810
7484
|
render() {
|
|
5811
|
-
return (index.h(index.Host, { key: '
|
|
7485
|
+
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
7486
|
'cura-input-field': true,
|
|
5813
7487
|
'open': this.isOpen,
|
|
5814
|
-
} }, this.renderIcon(), index.h("input", { key: '
|
|
7488
|
+
}, 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
7489
|
menu: true,
|
|
5816
7490
|
open: this.isOpen,
|
|
5817
|
-
|
|
7491
|
+
[this.preferredPlacement]: true,
|
|
7492
|
+
}, ref: el => (this.menuElement = el), style: {
|
|
7493
|
+
'--max-height': this.maxHeight,
|
|
7494
|
+
top: this.menuStyle.top,
|
|
7495
|
+
left: this.menuStyle.left,
|
|
7496
|
+
width: this.menuStyle.width,
|
|
7497
|
+
maxHeight: this.menuStyle.maxHeight,
|
|
7498
|
+
visibility: this.isPositioned ? 'visible' : 'hidden',
|
|
7499
|
+
opacity: this.isPositioned ? '1' : '0',
|
|
7500
|
+
pointerEvents: this.isPositioned ? 'auto' : 'none',
|
|
7501
|
+
} }, index.h("slot", { key: '84c3bb501966175635102b2ccbfa0cf43d2112f1', name: "option" }))))));
|
|
5818
7502
|
}
|
|
5819
7503
|
static get formAssociated() { return true; }
|
|
5820
7504
|
get host() { return index.getElement(this); }
|
|
@@ -5826,7 +7510,7 @@ const CuraSelect = class {
|
|
|
5826
7510
|
};
|
|
5827
7511
|
CuraSelect.style = curaSelectCss;
|
|
5828
7512
|
|
|
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)
|
|
7513
|
+
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
7514
|
|
|
5831
7515
|
const CuraSelectOption = class {
|
|
5832
7516
|
constructor(hostRef) {
|
|
@@ -6009,6 +7693,7 @@ exports.cura_avatar = CuraAvatar;
|
|
|
6009
7693
|
exports.cura_badge_distance = CuraDistance;
|
|
6010
7694
|
exports.cura_button = CuraButton;
|
|
6011
7695
|
exports.cura_button_transparent = CuraButtonTransparent;
|
|
7696
|
+
exports.cura_card = CuraCard;
|
|
6012
7697
|
exports.cura_dropdown_search = CuraDropdownSearch;
|
|
6013
7698
|
exports.cura_dropdown_search_category = CuraDropdownSearchCategory;
|
|
6014
7699
|
exports.cura_dropdown_search_option = CuraDropdownSearchOption;
|
|
@@ -6023,6 +7708,6 @@ exports.cura_select = CuraSelect;
|
|
|
6023
7708
|
exports.cura_select_option = CuraSelectOption;
|
|
6024
7709
|
exports.cura_tabs = CuraTabs;
|
|
6025
7710
|
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
|
|
7711
|
+
//# 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
7712
|
|
|
6028
|
-
//# sourceMappingURL=cura-
|
|
7713
|
+
//# sourceMappingURL=cura-accordion_21.cjs.entry.js.map
|