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