@solid-design-system/components 2.8.2 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/es/accordion-group.js +1 -1
- package/dist/components/es/accordion.js +1 -1
- package/dist/components/es/button.js +1 -1
- package/dist/components/es/carousel.js +1 -1
- package/dist/components/es/checkbox-group.js +1 -1
- package/dist/components/es/checkbox.js +1 -1
- package/dist/components/es/dialog.js +1 -1
- package/dist/components/es/drawer.js +1 -1
- package/dist/components/es/icon.js +2 -2
- package/dist/components/es/input.js +1 -1
- package/dist/components/es/option.js +1 -1
- package/dist/components/es/popup.js +1 -1
- package/dist/components/es/query.js +1 -1
- package/dist/components/es/radio-group.js +1 -1
- package/dist/components/es/radio.js +1 -1
- package/dist/components/es/select.js +2 -2
- package/dist/components/es/solid-element.js +4 -4
- package/dist/components/es/switch.js +1 -1
- package/dist/components/es/textarea.js +1 -1
- package/dist/components/es/tooltip.js +1 -1
- package/dist/components/umd/solid-components.js +15 -15
- package/dist/custom-elements.json +1 -1
- package/dist/package/styles/tailwind.css.js +1 -1
- package/dist/versioned-components/es/accordion-group.js +1 -1
- package/dist/versioned-components/es/accordion.js +1 -1
- package/dist/versioned-components/es/badge.js +1 -1
- package/dist/versioned-components/es/brandshape.js +1 -1
- package/dist/versioned-components/es/button.js +1 -1
- package/dist/versioned-components/es/carousel-item.js +1 -1
- package/dist/versioned-components/es/carousel.js +3 -3
- package/dist/versioned-components/es/checkbox-group.js +1 -1
- package/dist/versioned-components/es/checkbox.js +1 -1
- package/dist/versioned-components/es/dialog.js +1 -1
- package/dist/versioned-components/es/divider.js +1 -1
- package/dist/versioned-components/es/drawer.js +1 -1
- package/dist/versioned-components/es/dropdown.js +1 -1
- package/dist/versioned-components/es/form.js +1 -1
- package/dist/versioned-components/es/header.js +1 -1
- package/dist/versioned-components/es/icon.js +2 -2
- package/dist/versioned-components/es/include.js +1 -1
- package/dist/versioned-components/es/input.js +1 -1
- package/dist/versioned-components/es/link.js +1 -1
- package/dist/versioned-components/es/navigation-item.js +1 -1
- package/dist/versioned-components/es/notification.js +1 -1
- package/dist/versioned-components/es/option.js +1 -1
- package/dist/versioned-components/es/popup.js +1 -1
- package/dist/versioned-components/es/query.js +1 -1
- package/dist/versioned-components/es/radio-button.js +1 -1
- package/dist/versioned-components/es/radio-group.js +1 -1
- package/dist/versioned-components/es/radio.js +1 -1
- package/dist/versioned-components/es/select.js +3 -3
- package/dist/versioned-components/es/solid-element.js +4 -4
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/switch.js +1 -1
- package/dist/versioned-components/es/tab-group.js +1 -1
- package/dist/versioned-components/es/tab-panel.js +1 -1
- package/dist/versioned-components/es/tab.js +1 -1
- package/dist/versioned-components/es/tag.js +1 -1
- package/dist/versioned-components/es/teaser-media.js +1 -1
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-components/es/textarea.js +1 -1
- package/dist/versioned-components/es/tooltip.js +2 -2
- package/dist/versioned-components/es/video.js +1 -1
- package/dist/versioned-package/_components/button-group/button-group.d.ts +1 -1
- package/dist/versioned-package/_components/button-group/button-group.js +11 -11
- package/dist/versioned-package/components/accordion/accordion.d.ts +1 -1
- package/dist/versioned-package/components/accordion/accordion.js +2 -2
- package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +1 -1
- package/dist/versioned-package/components/accordion-group/accordion-group.js +3 -3
- package/dist/versioned-package/components/badge/badge.d.ts +1 -1
- package/dist/versioned-package/components/badge/badge.js +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.d.ts +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.js +1 -1
- package/dist/versioned-package/components/button/button.d.ts +1 -1
- package/dist/versioned-package/components/button/button.js +4 -4
- package/dist/versioned-package/components/carousel/carousel.d.ts +1 -1
- package/dist/versioned-package/components/carousel/carousel.js +6 -6
- package/dist/versioned-package/components/carousel-item/carousel-item.d.ts +1 -1
- package/dist/versioned-package/components/carousel-item/carousel-item.js +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.d.ts +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.js +4 -4
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +5 -5
- package/dist/versioned-package/components/dialog/dialog.d.ts +1 -1
- package/dist/versioned-package/components/dialog/dialog.js +2 -2
- package/dist/versioned-package/components/divider/divider.d.ts +1 -1
- package/dist/versioned-package/components/divider/divider.js +2 -2
- package/dist/versioned-package/components/drawer/drawer.d.ts +1 -1
- package/dist/versioned-package/components/drawer/drawer.js +2 -2
- package/dist/versioned-package/components/dropdown/dropdown.d.ts +1 -1
- package/dist/versioned-package/components/dropdown/dropdown.js +8 -8
- package/dist/versioned-package/components/header/header.d.ts +1 -1
- package/dist/versioned-package/components/header/header.js +4 -4
- package/dist/versioned-package/components/icon/icon.d.ts +1 -1
- package/dist/versioned-package/components/icon/icon.js +1 -1
- package/dist/versioned-package/components/include/include.d.ts +1 -1
- package/dist/versioned-package/components/include/include.js +1 -1
- package/dist/versioned-package/components/input/input.d.ts +1 -1
- package/dist/versioned-package/components/input/input.js +4 -4
- package/dist/versioned-package/components/link/link.d.ts +1 -1
- package/dist/versioned-package/components/link/link.js +2 -2
- package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.js +3 -3
- package/dist/versioned-package/components/notification/notification.d.ts +1 -1
- package/dist/versioned-package/components/notification/notification.js +5 -5
- package/dist/versioned-package/components/option/option.d.ts +1 -1
- package/dist/versioned-package/components/option/option.js +2 -2
- package/dist/versioned-package/components/popup/popup.d.ts +1 -1
- package/dist/versioned-package/components/popup/popup.js +1 -1
- package/dist/versioned-package/components/radio/radio.d.ts +1 -1
- package/dist/versioned-package/components/radio/radio.js +2 -2
- package/dist/versioned-package/components/radio-button/radio-button.d.ts +1 -1
- package/dist/versioned-package/components/radio-button/radio-button.js +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.js +15 -15
- package/dist/versioned-package/components/select/select.d.ts +4 -4
- package/dist/versioned-package/components/select/select.js +28 -28
- package/dist/versioned-package/components/spinner/spinner.d.ts +1 -1
- package/dist/versioned-package/components/spinner/spinner.js +1 -1
- package/dist/versioned-package/components/switch/switch.d.ts +1 -1
- package/dist/versioned-package/components/switch/switch.js +2 -2
- package/dist/versioned-package/components/tab/tab.d.ts +1 -1
- package/dist/versioned-package/components/tab/tab.js +2 -2
- package/dist/versioned-package/components/tab-group/tab-group.d.ts +1 -1
- package/dist/versioned-package/components/tab-group/tab-group.js +15 -15
- package/dist/versioned-package/components/tab-panel/tab-panel.d.ts +1 -1
- package/dist/versioned-package/components/tab-panel/tab-panel.js +2 -2
- package/dist/versioned-package/components/tag/tag.d.ts +1 -1
- package/dist/versioned-package/components/tag/tag.js +2 -2
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/teaser-media/teaser-media.js +1 -1
- package/dist/versioned-package/components/textarea/textarea.d.ts +1 -1
- package/dist/versioned-package/components/textarea/textarea.js +3 -3
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +1 -1
- package/dist/versioned-package/components/tooltip/tooltip.js +5 -5
- package/dist/versioned-package/components/video/video.d.ts +1 -1
- package/dist/versioned-package/components/video/video.js +2 -2
- package/dist/versioned-package/internal/form.js +3 -3
- package/dist/versioned-package/styles/headline/headline.css.js +1 -1
- package/dist/versioned-package/styles/tailwind.css.js +1 -1
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +37 -37
- package/dist/web-types.json +38 -38
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./accordion.js";import{S as
|
|
1
|
+
import"./accordion.js";import{S as e,x as t,i as o,n as s,c as r}from"./solid-element.js";import{o as c}from"./query-assigned-elements.js";import{c as n}from"./component.styles.js";var a=Object.defineProperty,d=Object.getOwnPropertyDescriptor,i=(e,t,o,s)=>{for(var r,c=s>1?void 0:s?d(t,o):t,n=e.length-1;n>=0;n--)(r=e[n])&&(c=(s?r(t,o,c):r(c))||c);return s&&c&&a(t,o,c),c};let l=class extends e{constructor(){super(...arguments),this.closeOthers=!1,this.handleAccordionShow=e=>{this.closeOthers&&this._accordionsInDefaultSlot.forEach((t=>{t!==e.target&&t.parentNode===e.target.parentNode&&t.removeAttribute("open")}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("sd-show",this.handleAccordionShow)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("sd-show",this.handleAccordionShow)}render(){return t`<div part="base"><slot></slot></div>`}};l.styles=[n,e.styles,o`:host{display:block}::slotted(sd-accordion:not(:first-of-type)){margin-top:-1px}`],i([c({selector:"sd-accordion"})],l.prototype,"_accordionsInDefaultSlot",2),i([s({attribute:"close-others",type:Boolean})],l.prototype,"closeOthers",2),l=i([r("sd-accordion-group")],l);export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./icon.js";import{s as e,a as t,b as s,w as o}from"./event.js";import{S as i,x as a,i as r,n,c as h}from"./solid-element.js";import{g as d,s as l}from"./animation-registry.js";import{L as p}from"./solid-components2.js";import{e as c}from"./query.js";import{w as y}from"./watch.js";import{t as m}from"./classix.js";
|
|
1
|
+
import"./icon.js";import{s as e,a as t,b as s,w as o}from"./event.js";import{S as i,x as a,i as r,n,c as h}from"./solid-element.js";import{g as d,s as l}from"./animation-registry.js";import{L as p}from"./solid-components2.js";import{e as c}from"./query.js";import{w as y}from"./watch.js";import{t as m}from"./classix.js";var u=Object.defineProperty,f=Object.getOwnPropertyDescriptor,b=(e,t,s,o)=>{for(var i,a=o>1?void 0:o?f(t,s):t,r=e.length-1;r>=0;r--)(i=e[r])&&(a=(o?i(t,s,a):i(a))||a);return o&&a&&u(t,s,a),a};let w=class extends i{constructor(){super(...arguments),this.localize=new p(this),this.open=!1}firstUpdated(){this.body.hidden=!this.open,this.body.style.height=this.open?"auto":"0"}handleSummaryClick(){this.header.focus(),this.open?this.hide():this.show()}handleSummaryKeyDown(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),this.open?this.hide():this.show()),("ArrowUp"===e.key||"ArrowLeft"===e.key)&&(e.preventDefault(),this.hide()),("ArrowDown"===e.key||"ArrowRight"===e.key)&&(e.preventDefault(),this.show())}async handleOpenChange(){if(this.open){if(this.emit("sd-show",{cancelable:!0}).defaultPrevented)return void(this.open=!1);await e(this.body),this.body.hidden=!1;const{keyframes:o,options:i}=d(this,"accordion.show",{dir:this.localize.dir()});await t(this.body,s(o,this.body.scrollHeight),i),this.body.style.height="auto",this.emit("sd-after-show")}else{if(this.emit("sd-hide",{cancelable:!0}).defaultPrevented)return void(this.open=!0);await e(this.body);const{keyframes:o,options:i}=d(this,"accordion.hide",{dir:this.localize.dir()});await t(this.body,s(o,this.body.scrollHeight),i),this.body.hidden=!0,this.body.style.height="auto",this.emit("sd-after-hide")}}async show(){if(!this.open)return this.open=!0,o(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,o(this,"sd-after-hide")}render(){return a`<div part="base" class="border-y-[1px] border-neutral-400"><header part="header" id="header" class="${m("flex text-base gap-4 font-bold items-center cursor-pointer select-none px-4 py-3 focus-visible:focus-outline text-primary hover:bg-neutral-200 relative group")}" role="button" aria-expanded="${this.open?"true":"false"}" aria-controls="content" tabindex="0" @click="${this.handleSummaryClick}" @keydown="${this.handleSummaryKeyDown}"><div part="summary-border" class="${m(!this.open&&"opacity-0","w-1 bg-accent absolute left-0 transition-all h-[calc(100%-16px)] group-hover:h-full")}"></div><slot name="summary" part="summary" class="flex flex-auto items-center text-left">${this.summary}</slot><span part="summary-icon" class="${m("flex flex-grow-0 flex-shrink-0 flex-auto items-center transition-all ease-in-out duration-300 text-xl",this.open&&"rotate-180")}"><slot name="expand-icon" class="${m(this.open&&"hidden")}"><sd-icon library="system" name="chevron-down"></sd-icon></slot><slot name="collapse-icon" class="${m(!this.open&&"hidden")}"><sd-icon library="system" name="chevron-down"></sd-icon></slot></span></header><div part="content" id="content" class="overflow-hidden"><slot part="content__slot" class="block px-4 py-6" role="region" aria-labelledby="header"></slot></div></div>`}};w.styles=[i.styles,r`:host{display:block}`],b([c('[part="base"]')],w.prototype,"accordion",2),b([c('[part="header"]')],w.prototype,"header",2),b([c('[part="content"]')],w.prototype,"body",2),b([n({type:Boolean,reflect:!0})],w.prototype,"open",2),b([n()],w.prototype,"summary",2),b([y("open",{waitUntilFirstUpdate:!0})],w.prototype,"handleOpenChange",1),w=b([h("sd-accordion")],w),l("accordion.show",{keyframes:[{height:"0",opacity:"0"},{height:"auto",opacity:"1"}],options:{duration:300,easing:"ease"}}),l("accordion.hide",{keyframes:[{height:"auto",opacity:"1"},{height:"0",opacity:"0"}],options:{duration:300,easing:"ease"}});export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./spinner.js";import{S as t,i as e,n as r,c as i}from"./solid-element.js";import{F as o,v as
|
|
1
|
+
import"./spinner.js";import{S as t,i as e,n as r,c as i}from"./solid-element.js";import{F as o,v as a}from"./form.js";import{H as s}from"./slot.js";import{s as n,n as l}from"./static.js";import{o as d}from"./if-defined.js";import{r as p}from"./state.js";import{e as h}from"./query.js";import{o as c}from"./query-assigned-elements.js";import{w as m}from"./watch.js";import{c as u}from"./component.styles.js";import{t as b}from"./classix.js";var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,f=(t,e,r,i)=>{for(var o,a=i>1?void 0:i?y(e,r):e,s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i?o(e,r,a):o(a))||a);return i&&a&&v(e,r,a),a};let g=class extends t{constructor(){super(...arguments),this.formControlController=new o(this,{form:t=>{if(t.hasAttribute("form")){const e=t.getRootNode(),r=t.getAttribute("form");return e.getElementById(r)}return t.closest("form")}}),this.hasSlotController=new s(this,"[default]","icon-left","icon-right"),this.invalid=!1,this.title="",this.variant="primary",this.inverted=!1,this.size="lg",this.disabled=!1,this.loading=!1,this.type="button",this.name="",this.value="",this.href=""}get validity(){return this.isButton()?this.button.validity:a}get validationMessage(){return this.isButton()?this.button.validationMessage:""}firstUpdated(){this.isButton()&&this.formControlController.updateValidity()}handleBlur(){this.emit("sd-blur")}handleFocus(){this.emit("sd-focus")}handleClick(t){if(this.disabled||this.loading)return t.preventDefault(),void t.stopPropagation();"submit"===this.type&&this.formControlController.submit(this),"reset"===this.type&&this.formControlController.reset(this)}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t)}isButton(){return!this.href}isLink(){return!!this.href}handleDisabledChange(){this.isButton()&&this.formControlController.setValidity(this.disabled)}click(){this.button.click()}focus(t){this.button.focus(t)}blur(){this.button.blur()}checkValidity(){return!this.isButton()||this.button.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return!this.isButton()||this.button.reportValidity()}setCustomValidity(t){this.isButton()&&(this.button.setCustomValidity(t),this.formControlController.updateValidity())}render(){const t=this.isLink(),e=t?n`a`:n`button`,r={label:this.hasSlotController.test("[default]"),"icon-left":this.hasSlotController.test("icon-left"),"icon-right":this.hasSlotController.test("icon-right"),"icon-only":this._iconsInDefaultSlot.length>0};return l`<${e} part="base" class="${b("font-md leading-[calc(var(--tw-varspacing)-2px)] no-underline\n w-full h-varspacing whitespace-nowrap align-middle inline-flex items-stretch justify-center\n border transition-colors duration-200 ease-in-out rounded-md\n select-none cursor-[inherit]",this.inverted?"focus-visible:focus-outline-inverted":"focus-visible:focus-outline",this.loading&&"relative cursor-wait",this.disabled&&"cursor-not-allowed",r["icon-only"]&&"px-0 w-varspacing",{sm:"text-sm varspacing-8 px-4",md:"text-base varspacing-10 px-4",lg:"text-base varspacing-12 px-4"}[this.size],{primary:this.inverted?"text-primary bg-white border-transparent\n hover:text-primary-500 hover:bg-primary-100\n active:text-primary-800 active:bg-primary-200\n disabled:bg-neutral-600 disabled:text-white":"text-white bg-primary border-transparent\n hover:text-primary-100 hover:bg-primary-500\n active:text-primary-200 active:bg-primary-800\n disabled:bg-neutral-500",secondary:this.inverted?"text-white border-white\n hover:text-primary-100 hover:bg-primary-500 hover:border-primary-100\n active:text-primary-200 active:bg-primary-800 active:border-primary-200\n disabled:text-neutral-600 disabled:border-neutral-600":"text-primary border-primary\n hover:text-primary-500 hover:border-primary-500 hover:bg-primary-100\n active:text-primary-800 active:border-primary-800 active:bg-primary-200\n disabled:text-neutral-500 disabled:border-neutral-500",tertiary:this.inverted?"text-white border-transparent\n hover:text-primary-100 hover:bg-primary-500\n active:text-primary-200 active:bg-primary-800\n disabled:text-neutral-600":"text-primary border-transparent\n hover:text-primary-500 hover:bg-primary-100\n active:text-primary-800 active:bg-primary-200\n disabled:text-neutral-500",cta:`text-white bg-accent-500 border-transparent\n hover:bg-accent-550\n active:bg-accent-700\n ${this.inverted?"disabled:bg-neutral-600":"disabled:bg-neutral-500"} disabled:text-white`}[this.variant])}" ?disabled="${d(t?void 0:this.disabled)}" type="${d(t?void 0:this.type)}" title="${this.title}" name="${d(t?void 0:this.name)}" value="${d(t?void 0:this.value)}" href="${d(t?this.href:void 0)}" target="${d(t?this.target:void 0)}" download="${d(t?this.download:void 0)}" rel="${d(t&&this.target?"noreferrer noopener":void 0)}" role="${d(t?void 0:"button")}" aria-disabled="${this.disabled?"true":"false"}" tabindex="${this.disabled?"-1":"0"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" @invalid="${this.isButton()?this.handleInvalid:null}" @click="${this.handleClick}"><slot name="icon-left" part="icon-left" class="${b("flex flex-auto items-center pointer-events-none",r["icon-only"]&&"hidden",this.loading&&"invisible",r["icon-left"]&&{sm:"mr-1",md:"mr-2",lg:"mr-2"}[this.size])}"></slot><slot part="label" class="${b(r["icon-only"]?"flex flex-auto items-center pointer-events-none":"inline-block",this.loading&&"invisible")}"></slot><slot name="icon-right" part="icon-right" class="${b("flex flex-auto items-center pointer-events-none",this.loading&&"invisible",r["icon-only"]&&"hidden",r["icon-right"]&&{sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size])}"></slot>${this.loading?l`<sd-spinner class="${b("absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2")}"></sd-spinner>`:""}</${e}>`}};g.styles=[u,t.styles,e`:host{position:relative;display:inline-block;width:var(--sd-spacing-auto,auto);cursor:pointer}sd-spinner{--indicator-color:currentColor;--track-color:var(--tw-varcolor-200)}::slotted(sd-badge){pointer-events:none;position:absolute;top:var(--sd-spacing-0,0);right:var(--sd-spacing-0,0);--tw-translate-x:50%!important;--tw-translate-y:-50%!important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}::slotted(sd-icon),sd-spinner{font-size:calc(var(--tw-varspacing)/ 2)}`],f([h("a, button")],g.prototype,"button",2),f([c({selector:"sd-icon"})],g.prototype,"_iconsInDefaultSlot",2),f([p()],g.prototype,"invalid",2),f([r()],g.prototype,"title",2),f([r({reflect:!0})],g.prototype,"variant",2),f([r({type:Boolean,reflect:!0})],g.prototype,"inverted",2),f([r({reflect:!0})],g.prototype,"size",2),f([r({type:Boolean,reflect:!0})],g.prototype,"disabled",2),f([r({type:Boolean,reflect:!0})],g.prototype,"loading",2),f([r()],g.prototype,"type",2),f([r()],g.prototype,"name",2),f([r()],g.prototype,"value",2),f([r()],g.prototype,"href",2),f([r()],g.prototype,"target",2),f([r()],g.prototype,"download",2),f([r()],g.prototype,"form",2),f([r({attribute:"formaction"})],g.prototype,"formAction",2),f([r({attribute:"formenctype"})],g.prototype,"formEnctype",2),f([r({attribute:"formmethod"})],g.prototype,"formMethod",2),f([r({attribute:"formnovalidate",type:Boolean})],g.prototype,"formNoValidate",2),f([r({attribute:"formtarget"})],g.prototype,"formTarget",2),f([m("disabled",{waitUntilFirstUpdate:!0})],g.prototype,"handleDisabledChange",1),g=f([i("sd-button")],g);export{g as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./icon.js";import{AutoplayController as e}from"./autoplay-controller.js";import{S as t,x as i,r as s,i as o,n as r,c as a}from"./solid-element.js";import{L as l}from"./solid-components2.js";import{p as n}from"./event.js";import{r as c}from"./state.js";import{e as d}from"./query.js";import{ScrollController as p}from"./scroll-controller.js";import{w as h}from"./watch.js";import{c as u}from"./component.styles.js";import{t as g}from"./classix.js";import{I as v}from"./interactive.js";import m from"./carousel-item.js";
|
|
1
|
+
import"./icon.js";import{AutoplayController as e}from"./autoplay-controller.js";import{S as t,x as i,r as s,i as o,n as r,c as a}from"./solid-element.js";import{L as l}from"./solid-components2.js";import{p as n}from"./event.js";import{r as c}from"./state.js";import{e as d}from"./query.js";import{ScrollController as p}from"./scroll-controller.js";import{w as h}from"./watch.js";import{c as u}from"./component.styles.js";import{t as g}from"./classix.js";import{I as v}from"./interactive.js";import m from"./carousel-item.js";var b=Object.defineProperty,y=Object.getOwnPropertyDescriptor,f=(e,t,i,s)=>{for(var o,r=s>1?void 0:s?y(t,i):t,a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&b(t,i,r),r};let w=class extends t{constructor(){super(...arguments),this.variant="number",this.inverted=!1,this.loop=!1,this.autoplay=!1,this.slidesPerPage=1,this.slidesPerMove=1,this.activeSlide=0,this.pausedAutoplay=!1,this.autoplayController=new e(this,(()=>this.next())),this.scrollController=new p(this),this.slides=this.getElementsByTagName("sd-carousel-item"),this.intersectionObserverEntries=new Map,this.localize=new l(this),this.handleSlotChange=e=>{e.some((e=>[...e.addedNodes,...e.removedNodes].some((e=>m.isCarouselItem(e)&&!e.hasAttribute("data-clone")))))&&this.initializeSlides(),this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","region"),this.setAttribute("aria-label",this.localize.term("carousel"));const e=new IntersectionObserver((e=>{e.forEach((e=>{this.intersectionObserverEntries.set(e.target,e);const t=e.target;t.toggleAttribute("inert",!e.isIntersecting),t.classList.toggle("--in-view",e.isIntersecting),t.setAttribute("aria-hidden",e.isIntersecting?"false":"true")}))}),{root:this,threshold:.6});this.intersectionObserver=e,e.takeRecords().forEach((e=>{this.intersectionObserverEntries.set(e.target,e)}))}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver.disconnect(),this.mutationObserver.disconnect()}firstUpdated(){this.initializeSlides(),this.mutationObserver=new MutationObserver(this.handleSlotChange),this.mutationObserver.observe(this,{childList:!0,subtree:!1})}getPageCount(){return Math.ceil(this.getSlides().length/this.slidesPerPage)}getCurrentPage(){return Math.ceil(this.activeSlide/this.slidesPerPage)}getSlides({excludeClones:e=!0}={}){return[...this.slides].filter((t=>!e||!t.hasAttribute("data-clone")))}handleKeyDown(e){if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)){const t=e.target,i="rtl"===this.localize.dir(),s=null!==t.closest('[part~="pagination-item"]'),o="ArrowDown"===e.key||!i&&"ArrowRight"===e.key||i&&"ArrowLeft"===e.key,r="ArrowUp"===e.key||!i&&"ArrowLeft"===e.key||i&&"ArrowRight"===e.key;e.preventDefault(),r&&this.previous(),o&&this.next(),"Home"===e.key&&this.goToSlide(0),"End"===e.key&&this.goToSlide(this.getSlides().length-1),s&&this.updateComplete.then((()=>{var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector('[part~="pagination-item--active"]');t&&t.focus()}))}}handleScrollEnd(){const e=this.getSlides(),t=[...this.intersectionObserverEntries.values()].find((e=>e.isIntersecting));if(this.loop&&null!=t&&t.target.hasAttribute("data-clone")){const e=Number(t.target.getAttribute("data-clone"));this.goToSlide(e,"auto")}else t&&(this.activeSlide=e.indexOf(t.target))}handlePausedAutoplay(){this.pausedAutoplay?this.autoplayController.controlledPause():this.autoplay&&this.autoplayController.controlledResume()}initializeSlides(){const e=this.getSlides(),t=this.intersectionObserver;if(this.intersectionObserverEntries.clear(),this.getSlides({excludeClones:!1}).forEach(((e,i)=>{t.unobserve(e),e.classList.remove("--in-view"),e.classList.remove("--is-active"),e.setAttribute("aria-label",this.localize.term("slideNum",i+1)),e.hasAttribute("data-clone")&&e.remove()})),this.loop){const t=this.slidesPerPage,i=e.slice(-t),s=e.slice(0,t);i.reverse().forEach(((t,i)=>{const s=t.cloneNode(!0);s.setAttribute("data-clone",String(e.length-i-1)),this.prepend(s)})),s.forEach(((e,t)=>{const i=e.cloneNode(!0);i.setAttribute("data-clone",String(t)),this.append(i)}))}this.getSlides({excludeClones:!1}).forEach((e=>{t.observe(e)})),this.goToSlide(this.activeSlide,"auto")}handelSlideChange(){const e=this.getSlides();e.forEach(((e,t)=>{e.classList.toggle("--is-active",t===this.activeSlide)})),this.hasUpdated&&this.emit("sd-slide-change",{detail:{index:this.activeSlide,slide:e[this.activeSlide]}})}handleSlidesPerMoveChange(){const e=this.getSlides({excludeClones:!1}),t=this.slidesPerMove;e.forEach(((e,i)=>{Math.abs(i-t)%t==0?e.style.removeProperty("scroll-snap-align"):e.style.setProperty("scroll-snap-align","none")}))}handleAutoplayChange(){this.autoplayController.stop(),this.autoplay&&!this.pausedAutoplay&&this.autoplayController.start(3e3)}previous(e="smooth"){let t=this.activeSlide||this.activeSlide-this.slidesPerMove,i=!1;for(;!i&&t>0;)t-=1,i=Math.abs(t-this.slidesPerMove)%this.slidesPerMove==0;this.goToSlide(t,e)}next(e="smooth"){this.goToSlide(this.activeSlide+this.slidesPerMove,e)}goToSlide(e,t="smooth"){const{slidesPerPage:i,loop:s,scrollContainer:o}=this,r=this.getSlides(),a=this.getSlides({excludeClones:!1}),l=(e+r.length)%r.length;this.activeSlide=l;const c=function(e,t,i){return(e=>Object.is(e,-0)?0:e)(e<0?0:e>i?i:e)}
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google LLC
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./icon.js";import{S as t,x as e,i as s,n as o,c as
|
|
1
|
+
import"./icon.js";import{S as t,x as e,i as s,n as o,c as l}from"./solid-element.js";import{H as a}from"./slot.js";import{w as i}from"./watch.js";import{c as r}from"./component.styles.js";import{t as n}from"./classix.js";var c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,d=(t,e,s,o)=>{for(var l,a=o>1?void 0:o?h(e,s):e,i=t.length-1;i>=0;i--)(l=t[i])&&(a=(o?l(e,s,a):l(a))||a);return o&&a&&c(e,s,a),a};let p=class extends t{constructor(){super(...arguments),this.hasSlotController=new a(this,"label"),this.label="",this.size="lg",this.orientation="vertical"}getAllCheckboxes(){return[...this.querySelectorAll("sd-checkbox")]}async syncCheckboxElements(){const t=this.getAllCheckboxes();await Promise.all(t.map((async t=>{await t.updateComplete,t.size=this.size}))),t.some((t=>t.checked))||(t[0].tabIndex=0)}syncCheckboxes(){customElements.get("sd-checkbox")?this.syncCheckboxElements():customElements.whenDefined("sd-checkbox").then((()=>this.syncCheckboxes()))}handleSizeChange(){this.syncCheckboxes()}handleInvalid(){this.syncCheckboxes()}render(){const t=this.hasSlotController.test("label"),s=!!this.label||t,o=e`<slot @slotchange="${this.syncCheckboxes}"></slot>`;return e`<fieldset part="form-control" class="${n("border-0 p-0 m-0",{sm:"text-sm",lg:"text-base"}[this.size])}" role="group" aria-labelledby="label"><label part="form-control-label" id="label" class="${n("mb-2 p-0 font-bold leading-normal text-black",s?"flex":"hidden")}" aria-hidden="${s?"false":"true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${n({vertical:"flex flex-col",horizontal:"flex flex-row"}[this.orientation])}">${o}</div></fieldset>`}};p.styles=[r,t.styles,s`:host{display:block}:host([orientation=vertical]) ::slotted(sd-checkbox){margin-bottom:var(--sd-spacing-2,.5rem);display:flex}:host([orientation=vertical]) ::slotted(sd-checkbox:last-of-type){margin-bottom:var(--sd-spacing-0,0)}:host([orientation=horizontal]) ::slotted(sd-checkbox){margin-right:var(--sd-spacing-6,1.5rem)}:host([orientation=horizontal]) ::slotted(sd-checkbox:last-of-type){margin-right:var(--sd-spacing-0,0)}:host([orientation=horizontal]):host([size=sm]) ::slotted(sd-checkbox){margin-right:var(--sd-spacing-4,1rem)}:host([orientation=horizontal]):host([size=sm]) ::slotted(sd-checkbox:last-of-type){margin-right:var(--sd-spacing-0,0)}`],d([o()],p.prototype,"label",2),d([o({reflect:!0})],p.prototype,"size",2),d([o({reflect:!0})],p.prototype,"orientation",2),d([i("size",{waitUntilFirstUpdate:!0})],p.prototype,"handleSizeChange",1),d([i("invalid",{waitUntilFirstUpdate:!0})],p.prototype,"handleInvalid",1),p=d([l("sd-checkbox-group")],p);export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./icon.js";import{S as e,x as t,i,n as r,c as s}from"./solid-element.js";import{d as
|
|
1
|
+
import"./icon.js";import{S as e,x as t,i,n as r,c as s}from"./solid-element.js";import{d as l}from"./default-value.js";import{F as o}from"./form.js";import{o as a}from"./if-defined.js";import{l as n}from"./live.js";import{r as d}from"./state.js";import{e as h}from"./query.js";import{w as c}from"./watch.js";import{t as p}from"./classix.js";var u=Object.defineProperty,m=Object.getOwnPropertyDescriptor,b=(e,t,i,r)=>{for(var s,l=r>1?void 0:r?m(t,i):t,o=e.length-1;o>=0;o--)(s=e[o])&&(l=(r?s(t,i,l):s(l))||l);return r&&l&&u(t,i,l),l};let f=class extends e{constructor(){super(...arguments),this.formControlController=new o(this,{value:e=>e.checked?e.value||"on":void 0,defaultValue:e=>e.defaultChecked,setValue:(e,t)=>e.checked=t}),this.title="",this.name="",this.size="lg",this.disabled=!1,this.checked=!1,this.indeterminate=!1,this.defaultChecked=!1,this.form="",this.required=!1,this.showInvalidStyle=!1}get validity(){return this.input.validity}firstUpdated(){this.formControlController.updateValidity()}handleClick(){this.checked=!this.checked,this.indeterminate=!1,this.emit("sd-change")}handleBlur(){this.emit("sd-blur")}handleInput(){this.emit("sd-input")}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e),this.invalidMessage.textContent=e.target.validationMessage}handleFocus(){this.emit("sd-focus")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false"),this.formControlController.setValidity(this.disabled)}handleStateChange(){this.input.checked=this.checked,this.input.indeterminate=this.indeterminate,this.formControlController.updateValidity()}click(){this.input.click()}focus(e){this.input.focus(e)}blur(){this.input.blur()}checkValidity(){return this.input.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.input.reportValidity()}setCustomValidity(e){this.input.setCustomValidity(e),this.formControlController.updateValidity()}render(){const e=this.disabled&&this.indeterminate?"disabledIndeterminate":this.disabled&&this.checked?"disabledChecked":this.disabled?"disabled":this.showInvalidStyle&&this.indeterminate?"invalidIndeterminate":this.showInvalidStyle?"invalid":this.checked||this.indeterminate?"filled":"default";return t`<label part="base" class="${p("sd-checkbox group flex items-start text-base leading-normal text-black cursor-pointer",this.disabled&&"hover:cursor-not-allowed",{sm:"text-sm",lg:"text-base"}[this.size])}"><input class="peer absolute opacity-0 p-0 m-0 pointer-events-none" type="checkbox" title="${this.title}" name="${this.name}" value="${a(this.value)}" .indeterminate="${n(this.indeterminate)}" .checked="${n(this.checked)}" .disabled="${this.disabled}" .required="${this.required}" aria-checked="${this.checked?"true":"false"}" @click="${this.handleClick}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @blur="${this.handleBlur}" @focus="${this.handleFocus}"> <span id="control" part="control ${this.checked?" control--checked":"control--unchecked"} ${this.indeterminate?" control--indeterminate":""}" class="${p("relative flex flex-initial items-center justify-center border rounded-sm h-4 w-4\n peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2\n peer-focus-visible:outline-primary",{sm:"mt-[2px]",lg:"mt-[3px]"}[this.size],{disabledIndeterminate:"border-neutral-500 bg-neutral-500",disabledChecked:"border-neutral-500 bg-neutral-500",disabled:"border-neutral-500",invalidIndeterminate:"border-error bg-error group-hover:bg-error-400",invalid:"border-error group-hover:bg-neutral-200",filled:"border-accent hover:border-accent-550 group-hover:border-accent-550 bg-accent group-hover:bg-accent-550",default:"border-neutral-800 hover:bg-neutral-200 group-hover:bg-neutral-200 bg-white"}[e])}">${this.checked?t`<sd-icon part="checked-icon" class="text-white w-3 h-3" library="system" name="status-hook"></sd-icon>`:""} ${!this.checked&&this.indeterminate?t`<sd-icon part="indeterminate-icon" class="text-white w-3 h-3" library="system" name="status-minus"></sd-icon>`:""} </span><span part="label" id="label" class="${p("select-none inline-block ml-2",this.disabled?"text-neutral-500":this.showInvalidStyle?"text-error":"text-black")}"><slot></slot></span></label> ${this.formControlController.renderInvalidMessage()}`}};f.styles=[e.styles,i`:host{display:block}:host(:focus-visible){outline-width:0}:host([required]) #label::after{content:' *'}`],b([h('input[type="checkbox"]')],f.prototype,"input",2),b([h("#invalid-message")],f.prototype,"invalidMessage",2),b([r()],f.prototype,"title",2),b([r()],f.prototype,"name",2),b([r()],f.prototype,"value",2),b([r({reflect:!0})],f.prototype,"size",2),b([r({type:Boolean,reflect:!0})],f.prototype,"disabled",2),b([r({type:Boolean,reflect:!0})],f.prototype,"checked",2),b([r({type:Boolean,reflect:!0})],f.prototype,"indeterminate",2),b([l("checked")],f.prototype,"defaultChecked",2),b([r({reflect:!0})],f.prototype,"form",2),b([r({type:Boolean,reflect:!0})],f.prototype,"required",2),b([d()],f.prototype,"showInvalidStyle",2),b([c("disabled",{waitUntilFirstUpdate:!0})],f.prototype,"handleDisabledChange",1),b([c(["checked","indeterminate"],{waitUntilFirstUpdate:!0})],f.prototype,"handleStateChange",1),f=b([s("sd-checkbox")],f);export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./button.js";import"./icon.js";import{a as e,s as i,w as s}from"./event.js";import{S as t,x as a,r as o,i as n,n as
|
|
1
|
+
import"./button.js";import"./icon.js";import{a as e,s as i,w as s}from"./event.js";import{S as t,x as a,r as o,i as n,n as l,c as r}from"./solid-element.js";import{g as d,s as h}from"./animation-registry.js";import{H as c}from"./slot.js";import{L as p}from"./solid-components2.js";import{l as m,u as g}from"./scroll.js";import{e as f}from"./query.js";import{w as y}from"./watch.js";import{c as v}from"./component.styles.js";import{t as u}from"./classix.js";import{M as x}from"./modal.js";var w=Object.defineProperty,b=Object.getOwnPropertyDescriptor,z=(e,i,s,t)=>{for(var a,o=t>1?void 0:t?b(i,s):i,n=e.length-1;n>=0;n--)(a=e[n])&&(o=(t?a(i,s,o):a(o))||o);return t&&o&&w(i,s,o),o};let k=class extends t{constructor(){super(...arguments),this.hasSlotController=new c(this,"footer"),this.localize=new p(this),this.open=!1,this.headline="",this.noCloseButton=!1}connectedCallback(){super.connectedCallback(),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.modal=new x(this)}firstUpdated(){this.dialog.hidden=!this.open,this.open&&(this.addOpenListeners(),this.modal.activate(),m(this))}disconnectedCallback(){super.disconnectedCallback(),g(this)}requestClose(i){if(this.emit("sd-request-close",{cancelable:!0,detail:{source:i}}).defaultPrevented){const i=d(this,"dialog.denyClose",{dir:this.localize.dir()});e(this.panel,i.keyframes,i.options)}else this.hide()}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}handleDocumentKeyDown(e){this.open&&"Escape"===e.key&&(e.stopPropagation(),this.requestClose("keyboard"))}async handleOpenChange(){if(this.open){this.emit("sd-show"),this.addOpenListeners(),this.originalTrigger=document.activeElement,this.modal.activate(),m(this);const s=this.querySelector("[autofocus]");s&&s.removeAttribute("autofocus"),await Promise.all([i(this.dialog),i(this.overlay)]),this.dialog.hidden=!1,requestAnimationFrame((()=>{this.emit("sd-initial-focus",{cancelable:!0}).defaultPrevented||(s?s.focus({preventScroll:!0}):this.panel.focus({preventScroll:!0})),s&&s.setAttribute("autofocus","")}));const t=d(this,"dialog.show",{dir:this.localize.dir()}),a=d(this,"dialog.overlay.show",{dir:this.localize.dir()});await Promise.all([e(this.panel,t.keyframes,t.options),e(this.overlay,a.keyframes,a.options)]),this.emit("sd-after-show")}else{this.emit("sd-hide"),this.removeOpenListeners(),this.modal.deactivate(),await Promise.all([i(this.dialog),i(this.overlay)]);const s=d(this,"dialog.hide",{dir:this.localize.dir()}),t=d(this,"dialog.overlay.hide",{dir:this.localize.dir()});await Promise.all([e(this.overlay,t.keyframes,t.options).then((()=>{this.overlay.hidden=!0})),e(this.panel,s.keyframes,s.options).then((()=>{this.panel.hidden=!0}))]),this.dialog.hidden=!0,this.overlay.hidden=!1,this.panel.hidden=!1,g(this);const a=this.originalTrigger;"function"==typeof(null==a?void 0:a.focus)&&setTimeout((()=>a.focus())),this.emit("sd-after-hide")}}async show(){if(!this.open)return this.open=!0,s(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,s(this,"sd-after-hide")}render(){return a`<div part="base" class="${u("flex items-center justify-center fixed inset-0 z-dialog",this.hasSlotController.test("footer")&&"dialog--has-footer")}"><div part="overlay" class="fixed inset-0 bg-primary-800 opacity-90" @click="${()=>this.requestClose("overlay")}" tabindex="-1"></div><div part="panel" class="${u("flex flex-col z-20 bg-white focus:outline-none py-4 sm:py-8 relative gap-6",this.open&&"flex opacity-100")}" role="dialog" aria-modal="true" aria-hidden="${this.open?"false":"true"}" aria-label="${this.headline}" aria-labelledby="title" tabindex="0"><header part="header" class="flex flex-grow-0 flex-shrink-0 basis-auto px-6 sm:px-10"><h2 part="title" class="flex-auto m-0" id="title">${this.headline.length>0?a`<h4 class="sd-headline sd-headline--size-3xl leading-tight">${this.headline}</h4>`:a`<slot name="headline"></slot>`}</h2>${this.noCloseButton?"":a`<sd-button part="close-button" variant="tertiary" exportparts="base:close-button__base" class="${u("absolute top-2 right-2")}" name="x-lg" @click="${()=>this.requestClose("close-button")}" type="button"><sd-icon name="system/close" library="global-resources" color="currentColor"></sd-icon></sd-button>`}</header><main part="body" class="flex flex-auto overflow-auto w-full px-6 sm:px-10"><slot></slot></main><footer part="footer" class="flex flex-grow-0 flex-shrink-0 basis-auto ml-auto gap-4 px-6 sm:px-10"><slot name="footer"></slot></footer></div></div>`}};k.styles=[v,o(".sd-headline{display:flex;font-size:var(--sd-font-size-3xl,2rem);font-weight:700;gap:var(--sd-spacing-4,1rem);line-height:var(--sd-line-height-tight,120%);--tw-text-opacity:1;color:rgb(var(--sd-color-primary,0 53 142)/var(--tw-text-opacity))}@media (min-width:640px){.sd-headline{font-size:var(--sd-font-size-4xl,2.5rem)}}.sd-headline sd-icon{flex-shrink:0;font-size:3rem;--tw-text-opacity:1;color:rgb(var(--sd-color-primary,0 53 142)/var(--tw-text-opacity))}@media (min-width:640px){.sd-headline sd-icon{margin-top:var(--sd-spacing-2,.5rem)}}.sd-headline--size-3xl{font-size:var(--sd-font-size-2xl,1.75rem)}@media (min-width:640px){.sd-headline--size-3xl{font-size:var(--sd-font-size-3xl,2rem)}}.sd-headline--size-3xl sd-icon{margin-top:calc(var(--sd-spacing-1, .25rem)*-1)}@media (min-width:640px){.sd-headline--size-3xl sd-icon{margin-top:var(--sd-spacing-0,0)}}.sd-headline--size-base,.sd-headline--size-lg,.sd-headline--size-xl{gap:var(--sd-spacing-2,.5rem);--tw-text-opacity:1;color:rgb(var(--sd-color-black,24 24 24)/var(--tw-text-opacity))}.sd-headline--size-base sd-icon,.sd-headline--size-lg sd-icon,.sd-headline--size-xl sd-icon{font-size:2rem}.sd-headline--size-xl{font-size:var(--sd-font-size-xl,1.5rem)}.sd-headline--size-xl sd-icon{margin-top:var(--sd-spacing-0-5,.125rem)}@media (min-width:640px){.sd-headline--size-xl sd-icon{margin-top:var(--sd-spacing-0-5,.125rem)}}.sd-headline--size-base,.sd-headline--size-lg{line-height:var(--sd-line-height-normal,150%)}.sd-headline--size-lg{font-size:var(--sd-font-size-lg,1.25rem)}.sd-headline--size-lg sd-icon{margin-top:var(--sd-spacing-0,0)}@media (min-width:640px){.sd-headline--size-lg sd-icon{margin-top:var(--sd-spacing-0,0)}}.sd-headline--size-base{font-size:var(--sd-font-size-base,1rem);--tw-text-opacity:1;color:rgb(var(--sd-color-black,24 24 24)/var(--tw-text-opacity))}.sd-headline--size-base sd-icon{margin-top:calc(var(--sd-spacing-1, .25rem)*-1)}.sd-headline--size-base mark{color:inherit}.sd-headline--inverted,.sd-headline--inverted sd-icon{--tw-text-opacity:1;color:rgb(var(--sd-color-white,255 255 255)/var(--tw-text-opacity))}.sd-headline--inline{display:inline}.sd-headline--inline sd-icon{margin-right:var(--sd-spacing-2,.5rem);margin-top:calc(var(--sd-spacing-1, .25rem)*-1);vertical-align:middle}.sd-headline--inline.sd-headline--size-base sd-icon,.sd-headline--inline.sd-headline--size-lg sd-icon,.sd-headline--inline.sd-headline--size-xl sd-icon{margin-right:var(--sd-spacing-0-5,.125rem)}"),t.styles,n`:host{--width:662px}[part=panel]{width:var(--width);max-height:80vh}[part=body]{-webkit-overflow-scrolling:touch}@media (max-width:414px){:host{--width:335px}[part=footer]{width:100%}}`],z([f('[part="base"]')],k.prototype,"dialog",2),z([f('[part="panel"]')],k.prototype,"panel",2),z([f('[part="overlay"]')],k.prototype,"overlay",2),z([l({type:Boolean,reflect:!0})],k.prototype,"open",2),z([l({reflect:!0})],k.prototype,"headline",2),z([l({attribute:"no-close-button",type:Boolean,reflect:!0})],k.prototype,"noCloseButton",2),z([y("open",{waitUntilFirstUpdate:!0})],k.prototype,"handleOpenChange",1),k=z([r("sd-dialog")],k),h("dialog.show",{keyframes:[{opacity:0,scale:.8},{opacity:1,scale:1}],options:{duration:250,easing:"ease"}}),h("dialog.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.8}],options:{duration:250,easing:"ease"}}),h("dialog.denyClose",{keyframes:[{scale:1},{scale:1.02},{scale:1}],options:{duration:250}}),h("dialog.overlay.show",{keyframes:[{opacity:0},{opacity:1}],options:{duration:250}}),h("dialog.overlay.hide",{keyframes:[{opacity:1},{opacity:0}],options:{duration:250}});export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./button.js";import"./icon.js";import{a as
|
|
1
|
+
import"./button.js";import"./icon.js";import{a as e,s as t,w as a}from"./event.js";import{S as s,x as o,i,n as r,c as n}from"./solid-element.js";import{g as l,s as d}from"./animation-registry.js";import{H as h}from"./slot.js";import{o as p}from"./if-defined.js";import{L as c}from"./solid-components2.js";import{l as m,u as y}from"./scroll.js";import{e as f}from"./query.js";import{w as u}from"./watch.js";import{c as w}from"./component.styles.js";import{t as v}from"./classix.js";import{M as b}from"./modal.js";function g(e){return e.charAt(0).toUpperCase()+e.slice(1)}var x=Object.defineProperty,k=Object.getOwnPropertyDescriptor,j=(e,t,a,s)=>{for(var o,i=s>1?void 0:s?k(t,a):t,r=e.length-1;r>=0;r--)(o=e[r])&&(i=(s?o(t,a,i):o(i))||i);return s&&i&&x(t,a,i),i};let C=class extends s{constructor(){super(...arguments),this.hasSlotController=new h(this,"footer"),this.localize=new c(this),this.modal=new b(this),this.open=!1,this.label="",this.placement="end",this.contained=!1,this.noHeader=!1,this.handleDocumentKeyDown=e=>{this.open&&"Escape"===e.key&&(e.stopPropagation(),this.requestClose("keyboard"))}}firstUpdated(){this.drawer.hidden=!this.open,this.open&&(this.addOpenListeners(),this.contained||(this.modal.activate(),m(this)))}disconnectedCallback(){super.disconnectedCallback(),y(this)}requestClose(t){if(this.emit("sd-request-close",{cancelable:!0,detail:{source:t}}).defaultPrevented){const t=l(this,"drawer.denyClose",{dir:this.localize.dir()});e(this.panel,t.keyframes,t.options)}else this.hide()}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}async handleOpenChange(){if(this.open){this.emit("sd-show"),this.addOpenListeners(),this.originalTrigger=document.activeElement,this.contained||(this.modal.activate(),m(this));const a=this.querySelector("[autofocus]");a&&a.removeAttribute("autofocus"),await Promise.all([t(this.drawer),t(this.overlay)]),this.drawer.hidden=!1,requestAnimationFrame((()=>{this.emit("sd-initial-focus",{cancelable:!0}).defaultPrevented||(a?a.focus({preventScroll:!0}):this.panel.focus({preventScroll:!0})),a&&a.setAttribute("autofocus","")}));const s=l(this,`drawer.show${g(this.placement)}`,{dir:this.localize.dir()}),o=l(this,"drawer.overlay.show",{dir:this.localize.dir()});await Promise.all([e(this.panel,s.keyframes,s.options),e(this.overlay,o.keyframes,o.options)]),this.emit("sd-after-show")}else{this.emit("sd-hide"),this.removeOpenListeners(),this.contained||(this.modal.deactivate(),y(this)),await Promise.all([t(this.drawer),t(this.overlay)]);const a=l(this,`drawer.hide${g(this.placement)}`,{dir:this.localize.dir()}),s=l(this,"drawer.overlay.hide",{dir:this.localize.dir()});await Promise.all([e(this.overlay,s.keyframes,s.options).then((()=>{this.overlay.hidden=!0})),e(this.panel,a.keyframes,a.options).then((()=>{this.panel.hidden=!0}))]),this.drawer.hidden=!0,this.overlay.hidden=!1,this.panel.hidden=!1;const o=this.originalTrigger;"function"==typeof(null==o?void 0:o.focus)&&setTimeout((()=>o.focus())),this.emit("sd-after-hide")}}handleNoModalChange(){this.open&&!this.contained&&(this.modal.activate(),m(this)),this.open&&this.contained&&(this.modal.deactivate(),y(this))}async show(){if(!this.open)return this.open=!0,a(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,a(this,"sd-after-hide")}render(){return o`<div part="base" class="${v("top-0 start-0 w-full h-full pointer-events-none overflow-hidden",this.contained?"absolute":"fixed")}"><div part="overlay" class="${v("block top-0 left-0 right-0 bottom-0 bg-neutral-800/75 pointer-events-auto",this.contained?"absolute":"fixed")}" @click="${()=>this.requestClose("overlay")}" tabindex="-1"></div><div part="panel" class="${v("absolute flex flex-col z-10 max-w-full max-h-full bg-white shadow-lg overflow-auto pointer-events-auto focus:outline-none",{end:"top-0 end-0 bottom-auto start-auto w-[--width] h-full",start:"top-0 end-auto bottom-auto start-0 w-[--width] h-full"}[this.placement])}" role="dialog" aria-modal="true" aria-hidden="${this.open?"false":"true"}" aria-label="${this.label}" aria-labelledby="${p(this.noHeader?void 0:"title")}" tabindex="0">${this.noHeader?"":o`<header part="header" class="flex justify-between py-2 px-4 items-center flex-shrink-0" style="min-height:56px"><div part="title"><slot name="header" part="title" class="flex-auto text-xl m-0" id="title"></slot></div><div class="shrink-0 flex flex-wrap justify-end gap-1 ml-4 absolute top-2 right-2"><sd-button variant="tertiary" size="lg" part="close-button" @click="${()=>this.requestClose("close-button")}"><sd-icon name="close" library="system"></sd-icon></sd-button></div></header>`}<div part="body" class="flex-auto block px-4"><slot></slot></div><footer part="footer" class="${v(this.hasSlotController.test("footer")?"text-left p-4":"hidden")}"><slot name="footer"></slot></footer></div></div>`}};C.styles=[s.styles,w,i`:host{--width:25rem;display:contents}:host([contained]){z-index:initial}:host(:not([contained])){z-index:var(--sd-z-index-drawer,700)}[part=body]{-webkit-overflow-scrolling:touch;overflow-y:scroll;scrollbar-width:none}[part=body]::-webkit-scrollbar{height:var(--sd-spacing-0,0);width:var(--sd-spacing-0,0)}`],j([f("[part=base]")],C.prototype,"drawer",2),j([f("[part=panel]")],C.prototype,"panel",2),j([f("[part=overlay]")],C.prototype,"overlay",2),j([r({type:Boolean,reflect:!0})],C.prototype,"open",2),j([r({attribute:"label",reflect:!0})],C.prototype,"label",2),j([r({reflect:!0})],C.prototype,"placement",2),j([r({type:Boolean,reflect:!0})],C.prototype,"contained",2),j([r({attribute:"no-header",type:Boolean})],C.prototype,"noHeader",2),j([u("open",{waitUntilFirstUpdate:!0})],C.prototype,"handleOpenChange",1),j([u("contained",{waitUntilFirstUpdate:!0})],C.prototype,"handleNoModalChange",1),C=j([n("sd-drawer")],C),d("drawer.showStart",{keyframes:[{opacity:0,translate:"-100%"},{opacity:1,translate:"0"}],rtlKeyframes:[{opacity:0,translate:"100%"},{opacity:1,translate:"0"}],options:{duration:250,easing:"ease"}}),d("drawer.hideStart",{keyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"-100%"}],rtlKeyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"100%"}],options:{duration:250,easing:"ease"}}),d("drawer.showEnd",{keyframes:[{opacity:0,translate:"100%"},{opacity:1,translate:"0"}],rtlKeyframes:[{opacity:0,translate:"-100%"},{opacity:1,translate:"0"}],options:{duration:250,easing:"ease"}}),d("drawer.hideEnd",{keyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"100%"}],rtlKeyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"-100%"}],options:{duration:250,easing:"ease"}}),d("drawer.denyClose",{keyframes:[{scale:1},{scale:1.01},{scale:1}],options:{duration:250}}),d("drawer.overlay.show",{keyframes:[{opacity:0},{opacity:1}],options:{duration:250}}),d("drawer.overlay.hide",{keyframes:[{opacity:1},{opacity:0}],options:{duration:250}});export{C as default};
|
|
@@ -3,9 +3,9 @@ import{T as t,w as e,S as r,x as s,i,n as o,c as a}from"./solid-element.js";impo
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/class g extends u{constructor(e){if(super(e),this.
|
|
6
|
+
*/class g extends u{constructor(e){if(super(e),this.it=t,e.type!==m.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===t||null==r)return this._t=void 0,this.it=r;if(r===e)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}g.directiveName="unsafeHTML",g.resultType=1;const v=d(g);
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/class f extends g{}f.directiveName="unsafeSVG",f.resultType=2;const w=d(f);var x=Object.defineProperty,j=Object.getOwnPropertyDescriptor,C=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?j(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&x(e,r,o),o};let T,
|
|
11
|
+
*/class f extends g{}f.directiveName="unsafeSVG",f.resultType=2;const w=d(f);var x=Object.defineProperty,j=Object.getOwnPropertyDescriptor,C=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?j(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&x(e,r,o),o};let T,_=class extends r{constructor(){super(...arguments),this.svg="",this.label="",this.library="default",this.color="currentColor"}connectedCallback(){super.connectedCallback(),l(this)}firstUpdated(){this.setIcon()}disconnectedCallback(){super.disconnectedCallback(),n(this)}getUrl(){const t=c(this.library);return this.name&&t?t.resolver(this.name):this.src}handleLabelChange(){"string"==typeof this.label&&this.label.length>0?(this.setAttribute("role","img"),this.setAttribute("aria-label",this.label),this.removeAttribute("aria-hidden")):(this.removeAttribute("role"),this.removeAttribute("aria-label"),this.setAttribute("aria-hidden","true"))}async setIcon(){var t;const e=c(this.library),r=this.getUrl();if(T||(T=new DOMParser),r)try{const s=await p(r);if(r===this.getUrl())if(s.ok){const r=T.parseFromString(s.svg,"text/html").body.querySelector("svg");null!==r?(null==(t=null==e?void 0:e.mutator)||t.call(e,r),this.svg=r.outerHTML,this.emit("sd-load")):(this.svg="",this.emit("sd-error"))}else this.svg="",this.emit("sd-error")}catch{this.emit("sd-error")}else this.svg.length>0&&(this.svg="")}render(){return s`${w(this.svg)}`}};_.styles=[y,i`:host{width:1em;height:1em;box-sizing:content-box!important;display:inline-block}svg{display:block;height:100%;width:100%}:host([color=primary]) svg{--tw-text-opacity:1;color:rgb(var(--sd-color-primary,0 53 142) / var(--tw-text-opacity))}:host([color=white]) svg{--tw-text-opacity:1;color:rgb(var(--sd-color-white,255 255 255) / var(--tw-text-opacity))}`],C([h()],_.prototype,"svg",2),C([o({reflect:!0})],_.prototype,"name",2),C([o()],_.prototype,"src",2),C([o()],_.prototype,"label",2),C([o({reflect:!0})],_.prototype,"library",2),C([o({reflect:!0})],_.prototype,"color",2),C([b("label")],_.prototype,"handleLabelChange",1),C([b(["name","src","library"])],_.prototype,"setIcon",1),_=C([a("sd-icon")],_);const k=Object.freeze(Object.defineProperty({__proto__:null,get default(){return _}},Symbol.toStringTag,{value:"Module"}));export{_ as S,k as i,v as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./icon.js";import{S as t,x as e,i as s,n as i,c as l}from"./solid-element.js";import{d as a}from"./default-value.js";import{F as o}from"./form.js";import{H as r}from"./slot.js";import{o as n}from"./if-defined.js";import{l as p}from"./live.js";import{L as h}from"./solid-components2.js";import{r as d}from"./state.js";import{e as u}from"./query.js";import{w as c}from"./watch.js";import{c as y}from"./component.styles.js";import{t as m}from"./classix.js";import"./request.js";import"./request2.js";import"./directive.js";var b,v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,g=(t,e,s,i)=>{for(var l,a=i>1?void 0:i?f(e,s):e,o=t.length-1;o>=0;o--)(l=t[o])&&(a=(i?l(e,s,a):l(a))||a);return i&&a&&v(e,s,a),a};const w=!(null==(b=navigator.userAgentData)?void 0:b.brands.some((t=>t.brand.includes("Chromium"))))&&navigator.userAgent.includes("Firefox");let x=class extends t{constructor(){super(...arguments),this.formControlController=new o(this),this.hasSlotController=new r(this,"help-text","label","left","right","message","placeholder"),this.localize=new h(this),this.hasFocus=!1,this.showValidStyle=!1,this.showInvalidStyle=!1,this.type="text",this.size="lg",this.value="",this.defaultValue="",this.placeholder="",this.label="",this.helpText="",this.clearable=!1,this.disabled=!1,this.readonly=!1,this.passwordToggle=!1,this.passwordVisible=!1,this.noSpinButtons=!1,this.form="",this.name="",this.title="",this.required=!1,this.styleOnValid=!1,this.spellcheck=!0}get valueAsDate(){var t;return(null==(t=this.input)?void 0:t.valueAsDate)??null}set valueAsDate(t){const e=document.createElement("input");e.type="date",e.valueAsDate=t,this.value=e.value}get valueAsNumber(){var t;return(null==(t=this.input)?void 0:t.valueAsNumber)??parseFloat(this.value)}set valueAsNumber(t){const e=document.createElement("input");e.type="number",e.valueAsNumber=t,this.value=e.value}get validity(){return this.input.validity}firstUpdated(){this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleChange(){this.value=this.input.value,this.emit("sd-change")}handleClearClick(t){this.value="",this.emit("sd-clear"),this.emit("sd-input"),this.emit("sd-change"),this.input.focus(),t.stopPropagation()}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}handleInput(){this.value=this.input.value,this.formControlController.updateValidity(),this.emit("sd-input")}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}handleKeyDown(t){const e=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;"Enter"===t.key&&!e&&setTimeout((()=>{!t.defaultPrevented&&!t.isComposing&&this.formControlController.submit()}))}handlePasswordToggle(){this.passwordVisible=!this.passwordVisible}handleDisabledChange(){this.formControlController.setValidity(this.disabled)}handleStepChange(){this.input.step=String(this.step),this.formControlController.updateValidity()}async handleValueChange(){await this.updateComplete,this.formControlController.updateValidity()}focus(t){this.input.focus(t)}blur(){this.input.blur()}select(){this.input.select()}setSelectionRange(t,e,s="none"){this.input.setSelectionRange(t,e,s)}setRangeText(t,e,s,i){this.input.setRangeText(t,e,s,i),this.value!==this.input.value&&(this.value=this.input.value)}showPicker(){"showPicker"in HTMLInputElement.prototype&&this.input.showPicker()}stepUp(){this.input.stepUp(),this.value!==this.input.value&&(this.value=this.input.value)}stepDown(){this.input.stepDown(),this.value!==this.input.value&&(this.value=this.input.value)}checkValidity(){var t;return null==(t=this.input)?void 0:t.checkValidity()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.input.reportValidity()}setCustomValidity(t){this.input.setCustomValidity(t),this.formControlController.updateValidity()}render(){const t=this.hasSlotController.test("label"),s=this.hasSlotController.test("help-text"),i=(this.hasSlotController.test("description"),this.hasSlotController.test("left")),l=this.hasSlotController.test("right"),a=!!this.label||!!t,o=!!this.helpText||!!s,r=this.clearable&&!this.readonly&&("number"==typeof this.value||this.value.length>0),h=this.disabled?"disabled":this.readonly?"readonly":this.hasFocus&&this.showInvalidStyle?"activeInvalid":this.hasFocus&&this.styleOnValid&&this.showValidStyle?"activeValid":this.hasFocus?"active":this.showInvalidStyle?"invalid":this.styleOnValid&&this.showValidStyle?"valid":"default",d="sm"===this.size?"text-sm":"text-base",u={disabled:"text-neutral-500",readonly:"text-black",activeInvalid:"text-error",activeValid:"text-success",active:"text-black",invalid:"text-error",valid:"text-success",default:"text-black"}[h],c={disabled:"border-neutral-500",readonly:"border-neutral-800",activeInvalid:"border-error border-2",activeValid:"border-success border-2",active:"border-primary border-2",invalid:"border-error",valid:"border-success",default:"border-neutral-800"}[h],y=this.disabled?"text-neutral-500":"text-primary",b={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],v={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return e`<div part="form-control" class="${m(this.disabled&&"pointer-events-none")}"><label part="form-control-label" id="label" class="${m("mb-2",a?"inline-block":"hidden",d)}" for="input" aria-hidden="${a?"false":"true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="relative w-full"><div part="border" class="${m("absolute w-full h-full pointer-events-none border rounded-default",c)}"></div><div part="base" class="${m("px-4 flex flex-row items-center rounded-default transition-all bg-white","lg"===this.size?"py-2":"py-1",this.disabled||this.readonly?"":"hover:bg-neutral-200",this.readonly&&"bg-neutral-100",u)}">${i?e`<slot name="left" part="left" class="${m("inline-flex","sm"===this.size?"mr-1":"mr-2",y,v)}"></slot>`:""} <input part="input" id="input" class="${m("min-w-0 flex-grow focus:outline-none bg-transparent placeholder-neutral-700","sm"===this.size?"h-6":"h-8",d)}" type="${"password"===this.type&&this.passwordVisible?"text":this.type}" title="${this.title}" name="${n(this.name)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${n(this.placeholder)}" minlength="${n(this.minlength)}" maxlength="${n(this.maxlength)}" min="${n(this.min)}" max="${n(this.max)}" step="${n(this.step)}" .value="${p(this.value)}" autocapitalize="${n("password"===this.type?"off":this.autocapitalize)}" autocomplete="${n("password"===this.type?"off":this.autocomplete)}" autocorrect="${n("password"===this.type?"off":this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${this.spellcheck}" pattern="${n(this.pattern)}" enterkeyhint="${n(this.enterkeyhint)}" inputmode="${n(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @keydown="${this.handleKeyDown}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${r?e`<button part="clear-button" class="${m("flex justify-center ",b)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${m("text-neutral-500",v)}" library="system" name="closing-round"></sd-icon></slot></button>`:""} ${this.passwordToggle&&"password"===this.type?e`<button aria-label="${this.localize.term(this.passwordVisible?"hidePassword":"showPassword")}" part="password-toggle-button" class="flex items-center" type="button" @click="${this.handlePasswordToggle}" tabindex="-1">${this.passwordVisible?e`<slot name="show-password-icon"><sd-icon class="${m(y,b,v)}" library="system" name="eye"></sd-icon></slot>`:e`<slot name="hide-password-icon"><sd-icon class="${m(y,b,v)}" library="system" name="eye-crossed-out"></sd-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":e`<sd-icon class="${m(y,b,v)}" library="system" name="calendar"></sd-icon>`} ${"time"===this.type?e`<sd-icon class="${m(y,b,v)}" library="system" name="clock"></sd-icon>`:""} ${this.showInvalidStyle?e`<sd-icon part="invalid-icon" class="${m("text-error",b,v)}" library="system" name="risk"></sd-icon>`:""} ${this.showValidStyle&&this.styleOnValid?e`<sd-icon class="${m("text-success flex-shrink-0",b,v)}" library="system" name="confirm" part="valid-icon"></sd-icon>`:""} ${l?e`<slot name="right" part="right" class="${m("inline-flex",y,b,v)}"></slot>`:""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${m("text-sm text-neutral-700",o?"block":"hidden")}" aria-hidden="${!o}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`}};x.styles=[y,t.styles,s`:host{position:relative;box-sizing:border-box;display:inline-block;width:100%;text-align:left}:host([vertical]){display:block}:host([required]) #label::after{content:' *'}details summary::-webkit-details-marker{display:none}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}input[type=time]::-webkit-calendar-picker-indicator{background:0 0}details summary::-webkit-details-marker,input[type=date]::-webkit-calendar-picker-indicator,input[type=datetime-local]::-webkit-calendar-picker-indicator,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{display:none}`],g([u("#input")],x.prototype,"input",2),g([u("#invalid-message")],x.prototype,"invalidMessage",2),g([d()],x.prototype,"hasFocus",2),g([d()],x.prototype,"showValidStyle",2),g([d()],x.prototype,"showInvalidStyle",2),g([i({reflect:!0})],x.prototype,"type",2),g([i({reflect:!0})],x.prototype,"size",2),g([i()],x.prototype,"inputmode",2),g([i()],x.prototype,"value",2),g([a()],x.prototype,"defaultValue",2),g([i()],x.prototype,"placeholder",2),g([i()],x.prototype,"label",2),g([i({attribute:"help-text"})],x.prototype,"helpText",2),g([i({type:Boolean})],x.prototype,"clearable",2),g([i({type:Boolean,reflect:!0})],x.prototype,"disabled",2),g([i({type:Boolean,reflect:!0})],x.prototype,"readonly",2),g([i({attribute:"password-toggle",type:Boolean})],x.prototype,"passwordToggle",2),g([i({attribute:"password-visible",type:Boolean})],x.prototype,"passwordVisible",2),g([i({attribute:"no-spin-buttons",type:Boolean})],x.prototype,"noSpinButtons",2),g([i({type:Number})],x.prototype,"minlength",2),g([i({type:Number})],x.prototype,"maxlength",2),g([i({type:Number})],x.prototype,"min",2),g([i({type:Number})],x.prototype,"max",2),g([i({reflect:!0})],x.prototype,"form",2),g([i()],x.prototype,"name",2),g([i()],x.prototype,"title",2),g([i({type:Boolean,reflect:!0})],x.prototype,"required",2),g([i()],x.prototype,"pattern",2),g([i()],x.prototype,"step",2),g([i()],x.prototype,"autocapitalize",2),g([i()],x.prototype,"autocorrect",2),g([i()],x.prototype,"autocomplete",2),g([i({type:Boolean})],x.prototype,"autofocus",2),g([i()],x.prototype,"enterkeyhint",2),g([i({type:Boolean,reflect:!0,attribute:"style-on-valid"})],x.prototype,"styleOnValid",2),g([i({type:Boolean,converter:{fromAttribute:t=>!(!t||"false"===t),toAttribute:t=>t?"true":"false"}})],x.prototype,"spellcheck",2),g([c("disabled",{waitUntilFirstUpdate:!0})],x.prototype,"handleDisabledChange",1),g([c("step",{waitUntilFirstUpdate:!0})],x.prototype,"handleStepChange",1),g([c("value",{waitUntilFirstUpdate:!0})],x.prototype,"handleValueChange",1),x=g([l("sd-input")],x);export{x as default};
|
|
1
|
+
import"./icon.js";import{S as t,x as e,i as s,n as i,c as l}from"./solid-element.js";import{d as a}from"./default-value.js";import{F as o}from"./form.js";import{H as r}from"./slot.js";import{o as n}from"./if-defined.js";import{l as p}from"./live.js";import{L as h}from"./solid-components2.js";import{r as d}from"./state.js";import{e as u}from"./query.js";import{w as c}from"./watch.js";import{c as y}from"./component.styles.js";import{t as m}from"./classix.js";var b,v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,g=(t,e,s,i)=>{for(var l,a=i>1?void 0:i?f(e,s):e,o=t.length-1;o>=0;o--)(l=t[o])&&(a=(i?l(e,s,a):l(a))||a);return i&&a&&v(e,s,a),a};const w=!(null==(b=navigator.userAgentData)?void 0:b.brands.some((t=>t.brand.includes("Chromium"))))&&navigator.userAgent.includes("Firefox");let x=class extends t{constructor(){super(...arguments),this.formControlController=new o(this),this.hasSlotController=new r(this,"help-text","label","left","right","message","placeholder"),this.localize=new h(this),this.hasFocus=!1,this.showValidStyle=!1,this.showInvalidStyle=!1,this.type="text",this.size="lg",this.value="",this.defaultValue="",this.placeholder="",this.label="",this.helpText="",this.clearable=!1,this.disabled=!1,this.readonly=!1,this.passwordToggle=!1,this.passwordVisible=!1,this.noSpinButtons=!1,this.form="",this.name="",this.title="",this.required=!1,this.styleOnValid=!1,this.spellcheck=!0}get valueAsDate(){var t;return(null==(t=this.input)?void 0:t.valueAsDate)??null}set valueAsDate(t){const e=document.createElement("input");e.type="date",e.valueAsDate=t,this.value=e.value}get valueAsNumber(){var t;return(null==(t=this.input)?void 0:t.valueAsNumber)??parseFloat(this.value)}set valueAsNumber(t){const e=document.createElement("input");e.type="number",e.valueAsNumber=t,this.value=e.value}get validity(){return this.input.validity}firstUpdated(){this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleChange(){this.value=this.input.value,this.emit("sd-change")}handleClearClick(t){this.value="",this.emit("sd-clear"),this.emit("sd-input"),this.emit("sd-change"),this.input.focus(),t.stopPropagation()}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}handleInput(){this.value=this.input.value,this.formControlController.updateValidity(),this.emit("sd-input")}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}handleKeyDown(t){const e=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;"Enter"===t.key&&!e&&setTimeout((()=>{!t.defaultPrevented&&!t.isComposing&&this.formControlController.submit()}))}handlePasswordToggle(){this.passwordVisible=!this.passwordVisible}handleDisabledChange(){this.formControlController.setValidity(this.disabled)}handleStepChange(){this.input.step=String(this.step),this.formControlController.updateValidity()}async handleValueChange(){await this.updateComplete,this.formControlController.updateValidity()}focus(t){this.input.focus(t)}blur(){this.input.blur()}select(){this.input.select()}setSelectionRange(t,e,s="none"){this.input.setSelectionRange(t,e,s)}setRangeText(t,e,s,i){this.input.setRangeText(t,e,s,i),this.value!==this.input.value&&(this.value=this.input.value)}showPicker(){"showPicker"in HTMLInputElement.prototype&&this.input.showPicker()}stepUp(){this.input.stepUp(),this.value!==this.input.value&&(this.value=this.input.value)}stepDown(){this.input.stepDown(),this.value!==this.input.value&&(this.value=this.input.value)}checkValidity(){var t;return null==(t=this.input)?void 0:t.checkValidity()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.input.reportValidity()}setCustomValidity(t){this.input.setCustomValidity(t),this.formControlController.updateValidity()}render(){const t=this.hasSlotController.test("label"),s=this.hasSlotController.test("help-text"),i=(this.hasSlotController.test("description"),this.hasSlotController.test("left")),l=this.hasSlotController.test("right"),a=!!this.label||!!t,o=!!this.helpText||!!s,r=this.clearable&&!this.readonly&&("number"==typeof this.value||this.value.length>0),h=this.disabled?"disabled":this.readonly?"readonly":this.hasFocus&&this.showInvalidStyle?"activeInvalid":this.hasFocus&&this.styleOnValid&&this.showValidStyle?"activeValid":this.hasFocus?"active":this.showInvalidStyle?"invalid":this.styleOnValid&&this.showValidStyle?"valid":"default",d="sm"===this.size?"text-sm":"text-base",u={disabled:"text-neutral-500",readonly:"text-black",activeInvalid:"text-error",activeValid:"text-success",active:"text-black",invalid:"text-error",valid:"text-success",default:"text-black"}[h],c={disabled:"border-neutral-500",readonly:"border-neutral-800",activeInvalid:"border-error border-2",activeValid:"border-success border-2",active:"border-primary border-2",invalid:"border-error",valid:"border-success",default:"border-neutral-800"}[h],y=this.disabled?"text-neutral-500":"text-primary",b={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],v={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return e`<div part="form-control" class="${m(this.disabled&&"pointer-events-none")}"><label part="form-control-label" id="label" class="${m("mb-2",a?"inline-block":"hidden",d)}" for="input" aria-hidden="${a?"false":"true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="relative w-full"><div part="border" class="${m("absolute w-full h-full pointer-events-none border rounded-default",c)}"></div><div part="base" class="${m("px-4 flex flex-row items-center rounded-default transition-all bg-white","lg"===this.size?"py-2":"py-1",this.disabled||this.readonly?"":"hover:bg-neutral-200",this.readonly&&"bg-neutral-100",u)}">${i?e`<slot name="left" part="left" class="${m("inline-flex","sm"===this.size?"mr-1":"mr-2",y,v)}"></slot>`:""} <input part="input" id="input" class="${m("min-w-0 flex-grow focus:outline-none bg-transparent placeholder-neutral-700","sm"===this.size?"h-6":"h-8",d)}" type="${"password"===this.type&&this.passwordVisible?"text":this.type}" title="${this.title}" name="${n(this.name)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${n(this.placeholder)}" minlength="${n(this.minlength)}" maxlength="${n(this.maxlength)}" min="${n(this.min)}" max="${n(this.max)}" step="${n(this.step)}" .value="${p(this.value)}" autocapitalize="${n("password"===this.type?"off":this.autocapitalize)}" autocomplete="${n("password"===this.type?"off":this.autocomplete)}" autocorrect="${n("password"===this.type?"off":this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${this.spellcheck}" pattern="${n(this.pattern)}" enterkeyhint="${n(this.enterkeyhint)}" inputmode="${n(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @keydown="${this.handleKeyDown}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${r?e`<button part="clear-button" class="${m("flex justify-center ",b)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${m("text-neutral-500",v)}" library="system" name="closing-round"></sd-icon></slot></button>`:""} ${this.passwordToggle&&"password"===this.type?e`<button aria-label="${this.localize.term(this.passwordVisible?"hidePassword":"showPassword")}" part="password-toggle-button" class="flex items-center" type="button" @click="${this.handlePasswordToggle}" tabindex="-1">${this.passwordVisible?e`<slot name="show-password-icon"><sd-icon class="${m(y,b,v)}" library="system" name="eye"></sd-icon></slot>`:e`<slot name="hide-password-icon"><sd-icon class="${m(y,b,v)}" library="system" name="eye-crossed-out"></sd-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":e`<sd-icon class="${m(y,b,v)}" library="system" name="calendar"></sd-icon>`} ${"time"===this.type?e`<sd-icon class="${m(y,b,v)}" library="system" name="clock"></sd-icon>`:""} ${this.showInvalidStyle?e`<sd-icon part="invalid-icon" class="${m("text-error",b,v)}" library="system" name="risk"></sd-icon>`:""} ${this.showValidStyle&&this.styleOnValid?e`<sd-icon class="${m("text-success flex-shrink-0",b,v)}" library="system" name="confirm" part="valid-icon"></sd-icon>`:""} ${l?e`<slot name="right" part="right" class="${m("inline-flex",y,b,v)}"></slot>`:""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${m("text-sm text-neutral-700",o?"block":"hidden")}" aria-hidden="${!o}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`}};x.styles=[y,t.styles,s`:host{position:relative;box-sizing:border-box;display:inline-block;width:100%;text-align:left}:host([vertical]){display:block}:host([required]) #label::after{content:' *'}details summary::-webkit-details-marker{display:none}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}input[type=time]::-webkit-calendar-picker-indicator{background:0 0}details summary::-webkit-details-marker,input[type=date]::-webkit-calendar-picker-indicator,input[type=datetime-local]::-webkit-calendar-picker-indicator,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{display:none}`],g([u("#input")],x.prototype,"input",2),g([u("#invalid-message")],x.prototype,"invalidMessage",2),g([d()],x.prototype,"hasFocus",2),g([d()],x.prototype,"showValidStyle",2),g([d()],x.prototype,"showInvalidStyle",2),g([i({reflect:!0})],x.prototype,"type",2),g([i({reflect:!0})],x.prototype,"size",2),g([i()],x.prototype,"inputmode",2),g([i()],x.prototype,"value",2),g([a()],x.prototype,"defaultValue",2),g([i()],x.prototype,"placeholder",2),g([i()],x.prototype,"label",2),g([i({attribute:"help-text"})],x.prototype,"helpText",2),g([i({type:Boolean})],x.prototype,"clearable",2),g([i({type:Boolean,reflect:!0})],x.prototype,"disabled",2),g([i({type:Boolean,reflect:!0})],x.prototype,"readonly",2),g([i({attribute:"password-toggle",type:Boolean})],x.prototype,"passwordToggle",2),g([i({attribute:"password-visible",type:Boolean})],x.prototype,"passwordVisible",2),g([i({attribute:"no-spin-buttons",type:Boolean})],x.prototype,"noSpinButtons",2),g([i({type:Number})],x.prototype,"minlength",2),g([i({type:Number})],x.prototype,"maxlength",2),g([i({type:Number})],x.prototype,"min",2),g([i({type:Number})],x.prototype,"max",2),g([i({reflect:!0})],x.prototype,"form",2),g([i()],x.prototype,"name",2),g([i()],x.prototype,"title",2),g([i({type:Boolean,reflect:!0})],x.prototype,"required",2),g([i()],x.prototype,"pattern",2),g([i()],x.prototype,"step",2),g([i()],x.prototype,"autocapitalize",2),g([i()],x.prototype,"autocorrect",2),g([i()],x.prototype,"autocomplete",2),g([i({type:Boolean})],x.prototype,"autofocus",2),g([i()],x.prototype,"enterkeyhint",2),g([i({type:Boolean,reflect:!0,attribute:"style-on-valid"})],x.prototype,"styleOnValid",2),g([i({type:Boolean,converter:{fromAttribute:t=>!(!t||"false"===t),toAttribute:t=>t?"true":"false"}})],x.prototype,"spellcheck",2),g([c("disabled",{waitUntilFirstUpdate:!0})],x.prototype,"handleDisabledChange",1),g([c("step",{waitUntilFirstUpdate:!0})],x.prototype,"handleStepChange",1),g([c("value",{waitUntilFirstUpdate:!0})],x.prototype,"handleValueChange",1),x=g([l("sd-input")],x);export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./icon.js";import{S as e,x as t,i as s,n as l,c as a}from"./solid-element.js";import{H as o}from"./slot.js";import{L as r}from"./solid-components2.js";import{r as i}from"./state.js";import{e as n}from"./query.js";import{w as h}from"./watch.js";import{c}from"./component.styles.js";import{t as d}from"./classix.js";
|
|
1
|
+
import"./icon.js";import{S as e,x as t,i as s,n as l,c as a}from"./solid-element.js";import{H as o}from"./slot.js";import{L as r}from"./solid-components2.js";import{r as i}from"./state.js";import{e as n}from"./query.js";import{w as h}from"./watch.js";import{c}from"./component.styles.js";import{t as d}from"./classix.js";var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,b=(e,t,s,l)=>{for(var a,o=l>1?void 0:l?u(t,s):t,r=e.length-1;r>=0;r--)(a=e[r])&&(o=(l?a(t,s,o):a(o))||o);return l&&o&&p(t,s,o),o};let f=class extends e{constructor(){super(...arguments),this.hasSlotController=new o(this,"default","left","right"),this.localize=new r(this),this.current=!1,this.selected=!1,this.hasHover=!1,this.size="lg",this.checkbox=!1,this.disabled=!1,this.value=""}connectedCallback(){super.connectedCallback(),this.setAttribute("role","option"),this.setAttribute("aria-selected","false")}handleDefaultSlotChange(){const e=this.getTextLabel();typeof this.cachedTextLabel>"u"?this.cachedTextLabel=e:e!==this.cachedTextLabel&&(this.cachedTextLabel=e,this.emit("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false")}handleValueChange(){this.value.includes(" ")&&(console.error("Option values cannot include a space. All spaces have been replaced with underscores.",this),this.value=this.value.replace(/ /g,"_"))}getTextLabel(){return(this.textContent??"").trim()}render(){this.hasSlotController.test("default");const e=this.hasSlotController.test("left"),s=this.hasSlotController.test("right");return t`<div part="base" class="${d("px-4 flex items-center w-full transition-all text-left text-base relative text-black",{sm:"text-sm py-1",md:"text-base py-2",lg:"text-base py-3"}[this.size],this.disabled?"text-neutral-500 cursor-not-allowed":"cursor-pointer",this.hasHover&&!this.disabled?"bg-neutral-200":"",this.current&&"bg-neutral-200")}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><span class="${d("absolute w-full left-0 top-0 pointer-events-none transition-all duration-150 border-l-4 h-[calc(100%-8px)]",this.selected&&!this.checkbox?"border-accent":"border-transparent",this.disabled&&"border-neutral-500 top-1",!this.disabled&&this.hasHover?"h-full top-0":"top-1")}"></span> ${this.checkbox?t`<span id="control" part="control ${this.selected?" control--checked":"control--unchecked"}" class="${d("relative flex flex-initial items-center justify-center border rounded-sm h-4 w-4 mr-2",this.disabled?"border-neutral-500":this.selected?"bg-accent border-accent":"border-neutral-800")}">${this.selected?t`<sd-icon part="checked-icon" class="text-white w-3 h-3" library="system" name="status-hook"></sd-icon>`:""}</span>`:""} ${e?t`<slot name="left" part="left" class="inline-flex mr-2"></slot>`:""}<slot part="label" class="inline-block flex-grow" @slotchange="${this.handleDefaultSlotChange}"></slot>${s?t`<slot name="right" part="right" class="inline-flex ml-2"></slot>`:""}</div>`}};f.styles=[c,e.styles,s`:host{position:relative;display:block;width:100%;outline:2px solid transparent!important;outline-offset:2px!important}`],b([n('[part="base"]')],f.prototype,"defaultSlot",2),b([i()],f.prototype,"current",2),b([i()],f.prototype,"selected",2),b([i()],f.prototype,"hasHover",2),b([l({reflect:!0})],f.prototype,"size",2),b([l({type:Boolean,reflect:!0})],f.prototype,"checkbox",2),b([l({type:Boolean,reflect:!0})],f.prototype,"disabled",2),b([l({reflect:!0})],f.prototype,"value",2),b([h("disabled")],f.prototype,"handleDisabledChange",1),b([h("selected")],f.prototype,"handleSelectedChange",1),b([h("value")],f.prototype,"handleValueChange",1),f=b([a("sd-option")],f);export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as t,x as e,i as n,n as o,c as i}from"./solid-element.js";import{e as r}from"./query.js";import{c as a}from"./component.styles.js";import{t as s}from"./classix.js";const l=Math.min,c=Math.max,f=Math.round,u=Math.floor,p=t=>({x:t,y:t}),h={left:"right",right:"left",bottom:"top",top:"bottom"},d={start:"end",end:"start"};function m(t,e,n){return c(t,l(e,n))}function y(t,e){return"function"==typeof t?t(e):t}function g(t){return t.split("-")[0]}function w(t){return t.split("-")[1]}function b(t){return"x"===t?"y":"x"}function v(t){return"y"===t?"height":"width"}function x(t){return["top","bottom"].includes(g(t))?"y":"x"}function P(t){return b(x(t))}function E(t){return t.replace(/start|end/g,(t=>d[t]))}function z(t){return t.replace(/left|right|bottom|top/g,(t=>h[t]))}function R(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function S(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function T(t,e,n){let{reference:o,floating:i}=t;const r=x(e),a=P(e),s=v(a),l=g(e),c="y"===r,f=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,p=o[s]/2-i[s]/2;let h;switch(l){case"top":h={x:f,y:o.y-i.height};break;case"bottom":h={x:f,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:u};break;case"left":h={x:o.x-i.width,y:u};break;default:h={x:o.x,y:o.y}}switch(w(e)){case"start":h[a]-=p*(n&&c?-1:1);break;case"end":h[a]+=p*(n&&c?-1:1)}return h}async function L(t,e){var n;void 0===e&&(e={});const{x:o,y:i,platform:r,rects:a,elements:s,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:h=0}=y(e,t),d=R(h),m=s[p?"floating"===u?"reference":"floating":u],g=S(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(m)))||n?m:m.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:l})),w="floating"===u?{...a.floating,x:o,y:i}:a.reference,b=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),v=await(null==r.isElement?void 0:r.isElement(b))&&await(null==r.getScale?void 0:r.getScale(b))||{x:1,y:1},x=S(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({rect:w,offsetParent:b,strategy:l}):w);return{top:(g.top-x.top+d.top)/v.y,bottom:(x.bottom-g.bottom+d.bottom)/v.y,left:(g.left-x.left+d.left)/v.x,right:(x.right-g.right+d.right)/v.x}}const O=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){const{x:n,y:o}=e,i=await async function(t,e){const{placement:n,platform:o,elements:i}=t,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),a=g(n),s=w(n),l="y"===x(n),c=["left","top"].includes(a)?-1:1,f=r&&l?-1:1,u=y(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:d}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return s&&"number"==typeof d&&(h="end"===s?-1*d:d),l?{x:h*f,y:p*c}:{x:p*c,y:h*f}}(e,t);return{x:n+i.x,y:o+i.y,data:i}}}},A=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:o,platform:i,elements:r}=e,{apply:a=(()=>{}),...s}=y(t,e),f=await L(e,s),u=g(n),p=w(n),h="y"===x(n),{width:d,height:m}=o.floating;let b,v;"top"===u||"bottom"===u?(b=u,v=p===(await(null==i.isRTL?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(v=u,b="end"===p?"top":"bottom");const P=m-f[b],E=d-f[v],z=!e.middlewareData.shift;let R=P,S=E;if(h){const t=d-f.left-f.right;S=p||z?l(E,t):t}else{const t=m-f.top-f.bottom;R=p||z?l(P,t):t}if(z&&!p){const t=c(f.left,0),e=c(f.right,0),n=c(f.top,0),o=c(f.bottom,0);h?S=d-2*(0!==t||0!==e?t+e:c(f.left,f.right)):R=m-2*(0!==n||0!==o?n+o:c(f.top,f.bottom))}await a({...e,availableWidth:S,availableHeight:R});const T=await i.getDimensions(r.floating);return d!==T.width||m!==T.height?{reset:{rects:!0}}:{}}}};function k(t){return D(t)?(t.nodeName||"").toLowerCase():"#document"}function C(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function F(t){var e;return null==(e=(D(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function D(t){return t instanceof Node||t instanceof C(t).Node}function B(t){return t instanceof Element||t instanceof C(t).Element}function $(t){return t instanceof HTMLElement||t instanceof C(t).HTMLElement}function H(t){return!(typeof ShadowRoot>"u")&&(t instanceof ShadowRoot||t instanceof C(t).ShadowRoot)}function N(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=q(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(i)}function j(t){return["table","td","th"].includes(k(t))}function M(t){const e=W(),n=q(t);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((t=>(n.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(n.contain||"").includes(t)))}function W(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function V(t){return["html","body","#document"].includes(k(t))}function q(t){return C(t).getComputedStyle(t)}function I(t){return B(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function X(t){if("html"===k(t))return t;const e=t.assignedSlot||t.parentNode||H(t)&&t.host||F(t);return H(e)?e.host:e}function Y(t){const e=X(t);return V(e)?t.ownerDocument?t.ownerDocument.body:t.body:$(e)&&N(e)?e:Y(e)}function _(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=Y(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),a=C(i);return r?e.concat(a,a.visualViewport||[],N(i)?i:[],a.frameElement&&n?_(a.frameElement):[]):e.concat(i,_(i,[],n))}function G(t){const e=q(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=$(t),r=i?t.offsetWidth:n,a=i?t.offsetHeight:o,s=f(n)!==r||f(o)!==a;return s&&(n=r,o=a),{width:n,height:o,$:s}}function J(t){return B(t)?t:t.contextElement}function K(t){const e=J(t);if(!$(e))return p(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=G(e);let a=(r?f(n.width):n.width)/o,s=(r?f(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const Q=p(0);function U(t){const e=C(t);return W()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:Q}function Z(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const i=t.getBoundingClientRect(),r=J(t);let a=p(1);e&&(o?B(o)&&(a=K(o)):a=K(t));const s=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==C(t))&&e}(r,n,o)?U(r):p(0);let l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,f=i.width/a.x,u=i.height/a.y;if(r){const t=C(r),e=o&&B(o)?C(o):o;let n=t.frameElement;for(;n&&o&&e!==t;){const t=K(n),e=n.getBoundingClientRect(),o=q(n),i=e.left+(n.clientLeft+parseFloat(o.paddingLeft))*t.x,r=e.top+(n.clientTop+parseFloat(o.paddingTop))*t.y;l*=t.x,c*=t.y,f*=t.x,u*=t.y,l+=i,c+=r,n=C(n).frameElement}}return S({width:f,height:u,x:l,y:c})}function tt(t){return Z(F(t)).left+I(t).scrollLeft}function et(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=C(t),o=F(t),i=n.visualViewport;let r=o.clientWidth,a=o.clientHeight,s=0,l=0;if(i){r=i.width,a=i.height;const t=W();(!t||t&&"fixed"===e)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:r,height:a,x:s,y:l}}(t,n);else if("document"===e)o=function(t){const e=F(t),n=I(t),o=t.ownerDocument.body,i=c(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=c(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+tt(t);const s=-n.scrollTop;return"rtl"===q(o).direction&&(a+=c(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:a,y:s}}(F(t));else if(B(e))o=function(t,e){const n=Z(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=$(t)?K(t):p(1);return{width:t.clientWidth*r.x,height:t.clientHeight*r.y,x:i*r.x,y:o*r.y}}(e,n);else{const n=U(t);o={...e,x:e.x-n.x,y:e.y-n.y}}return S(o)}function nt(t,e){const n=X(t);return!(n===e||!B(n)||V(n))&&("fixed"===q(n).position||nt(n,e))}function ot(t,e){const n=e.get(t);if(n)return n;let o=_(t,[],!1).filter((t=>B(t)&&"body"!==k(t))),i=null;const r="fixed"===q(t).position;let a=r?X(t):t;for(;B(a)&&!V(a);){const e=q(a),n=M(a);!n&&"fixed"===e.position&&(i=null),(r?!n&&!i:!n&&"static"===e.position&&i&&["absolute","fixed"].includes(i.position)||N(a)&&!n&&nt(t,a))?o=o.filter((t=>t!==a)):i=e,a=X(a)}return e.set(t,o),o}function it(t,e,n){const o=$(e),i=F(e),r="fixed"===n,a=Z(t,!0,r,e);let s={scrollLeft:0,scrollTop:0};const l=p(0);if(o||!o&&!r)if(("body"!==k(e)||N(i))&&(s=I(e)),o){const t=Z(e,!0,r,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else i&&(l.x=tt(i));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function rt(t,e){return $(t)&&"fixed"!==q(t).position?e?e(t):t.offsetParent:null}function at(t,e){const n=C(t);if(!$(t))return n;let o=rt(t,e);for(;o&&j(o)&&"static"===q(o).position;)o=rt(o,e);return o&&("html"===k(o)||"body"===k(o)&&"static"===q(o).position&&!M(o))?n:o||function(t){let e=X(t);for(;$(e)&&!V(e);){if(M(e))return e;e=X(e)}return null}(t)||n}const st={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=$(n),r=F(n);if(n===r)return e;let a={scrollLeft:0,scrollTop:0},s=p(1);const l=p(0);if((i||!i&&"fixed"!==o)&&(("body"!==k(n)||N(r))&&(a=I(n)),$(n))){const t=Z(n);s=K(n),l.x=t.x+n.clientLeft,l.y=t.y+n.clientTop}return{width:e.width*s.x,height:e.height*s.y,x:e.x*s.x-a.scrollLeft*s.x+l.x,y:e.y*s.y-a.scrollTop*s.y+l.y}},getDocumentElement:F,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?ot(e,this._c):[].concat(n),o],a=r[0],s=r.reduce(((t,n)=>{const o=et(e,n,i);return t.top=c(o.top,t.top),t.right=l(o.right,t.right),t.bottom=l(o.bottom,t.bottom),t.left=c(o.left,t.left),t}),et(e,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:at,getElementRects:async function(t){let{reference:e,floating:n,strategy:o}=t;const i=this.getOffsetParent||at,r=this.getDimensions;return{reference:it(e,await i(n),o),floating:{x:0,y:0,...await r(n)}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){return G(t)},getScale:K,isElement:B,isRTL:function(t){return"rtl"===q(t).direction}};var lt=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,ft=(t,e,n,o)=>{for(var i,r=o>1?void 0:o?ct(e,n):e,a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o?i(e,n,r):i(r))||r);return o&&r&<(e,n,r),r};let ut=class extends t{constructor(){super(...arguments),this.active=!1,this.placement="top",this.strategy="absolute",this.distance=0,this.skidding=0,this.arrow=!1,this.arrowPlacement="anchor",this.arrowPadding=10,this.flip=!1,this.flipFallbackPlacements="",this.flipFallbackStrategy="best-fit",this.flipPadding=0,this.shift=!1,this.shiftPadding=0,this.autoSizePadding=0}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.start(),this.setupMutationObserver()}disconnectedCallback(){this.stop(),this.mutationObserver&&this.mutationObserver.disconnect()}async updated(t){super.updated(t),t.has("active")&&(this.active?this.start():this.stop()),t.has("anchor")&&this.handleAnchorChange(),this.active&&(await this.updateComplete,this.reposition())}setupMutationObserver(){this.mutationObserver=new MutationObserver((t=>this.handleCurrentPlacementChange(t))),this.mutationObserver.observe(this,{attributes:!0})}handleCurrentPlacementChange(t){return t.forEach((t=>{if("data-current-placement"===t.attributeName){const t=this.getAttribute("data-current-placement");this.emit("sd-current-placement",{detail:t})}}))}async handleAnchorChange(){if(await this.stop(),this.anchor&&"string"==typeof this.anchor){const t=this.getRootNode();this.anchorEl=t.getElementById(this.anchor)}else this.anchor instanceof HTMLElement?this.anchorEl=this.anchor:this.anchorEl=this.querySelector('[slot="anchor"]');if(this.anchorEl instanceof HTMLSlotElement&&(this.anchorEl=this.anchorEl.assignedElements({flatten:!0})[0]),!this.anchorEl)throw new Error("Invalid anchor element: no anchor could be found using the anchor slot or the anchor attribute.");this.start()}start(){this.anchorEl&&(this.cleanup=function(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:f=!1}=o,p=J(t),h=i||r?[...p?_(p):[],..._(e)]:[];h.forEach((t=>{i&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));const d=p&&s?function(t,e){let n,o=null;const i=F(t);function r(){clearTimeout(n),o&&o.disconnect(),o=null}return function a(s,f){void 0===s&&(s=!1),void 0===f&&(f=1),r();const{left:p,top:h,width:d,height:m}=t.getBoundingClientRect();if(s||e(),!d||!m)return;const y={rootMargin:-u(h)+"px "+-u(i.clientWidth-(p+d))+"px "+-u(i.clientHeight-(h+m))+"px "+-u(p)+"px",threshold:c(0,l(1,f))||1};let g=!0;function w(t){const e=t[0].intersectionRatio;if(e!==f){if(!g)return a();e?a(!1,e):n=setTimeout((()=>{a(!1,1e-7)}),100)}g=!1}try{o=new IntersectionObserver(w,{...y,root:i.ownerDocument})}catch{o=new IntersectionObserver(w,y)}o.observe(t)}(!0),r}(p,n):null;let m=-1,y=null;a&&(y=new ResizeObserver((t=>{let[o]=t;o&&o.target===p&&y&&(y.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{y&&y.observe(e)}))),n()})),p&&!f&&y.observe(p),y.observe(e));let g,w=f?Z(t):null;return f&&function e(){const o=Z(t);w&&(o.x!==w.x||o.y!==w.y||o.width!==w.width||o.height!==w.height)&&n(),w=o,g=requestAnimationFrame(e)}(),n(),()=>{h.forEach((t=>{i&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),d&&d(),y&&y.disconnect(),y=null,f&&cancelAnimationFrame(g)}}(this.anchorEl,this.popup,(()=>{this.reposition()})))}async stop(){return new Promise((t=>{this.cleanup?(this.cleanup(),this.cleanup=void 0,this.removeAttribute("data-current-placement"),this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height"),requestAnimationFrame((()=>t()))):t()}))}reposition(){if(!this.active||!this.anchorEl)return;const t=[O({mainAxis:this.distance,crossAxis:this.skidding})];this.sync?t.push(A({apply:({rects:t})=>{const e="width"===this.sync||"both"===this.sync,n="height"===this.sync||"both"===this.sync;this.popup.style.width=e?`${t.reference.width}px`:"",this.popup.style.height=n?`${t.reference.height}px`:""}})):(this.popup.style.width="",this.popup.style.height=""),this.flip&&t.push(function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:a,initialPlacement:s,platform:l,elements:c}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:m=!0,...b}=y(t,e);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const x=g(i),R=g(s)===s,S=await(null==l.isRTL?void 0:l.isRTL(c.floating)),T=p||(R||!m?[z(s)]:function(t){const e=z(t);return[E(t),e,E(e)]}(s));!p&&"none"!==d&&T.push(...function(t,e,n,o){const i=w(t);let r=function(t,e,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:o:e?o:i;case"left":case"right":return e?r:a;default:return[]}}(g(t),"start"===n,o);return i&&(r=r.map((t=>t+"-"+i)),e&&(r=r.concat(r.map(E)))),r}(s,m,d,S));const O=[s,...T],A=await L(e,b),k=[];let C=(null==(o=r.flip)?void 0:o.overflows)||[];if(f&&k.push(A[x]),u){const t=function(t,e,n){void 0===n&&(n=!1);const o=w(t),i=P(t),r=v(i);let a="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[r]>e.floating[r]&&(a=z(a)),[a,z(a)]}(i,a,S);k.push(A[t[0]],A[t[1]])}if(C=[...C,{placement:i,overflows:k}],!k.every((t=>t<=0))){var F,D;const t=((null==(F=r.flip)?void 0:F.index)||0)+1,e=O[t];if(e)return{data:{index:t,overflows:C},reset:{placement:e}};let n=null==(D=C.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:D.placement;if(!n)switch(h){case"bestFit":{var B;const t=null==(B=C.map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:B[0];t&&(n=t);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}}({boundary:this.flipBoundary,fallbackPlacements:this.flipFallbackPlacements,fallbackStrategy:"best-fit"===this.flipFallbackStrategy?"bestFit":"initialPlacement",padding:this.flipPadding})),this.shift&&t.push(function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:r=!0,crossAxis:a=!1,limiter:s={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...l}=y(t,e),c={x:n,y:o},f=await L(e,l),u=x(g(i)),p=b(u);let h=c[p],d=c[u];if(r){const t="y"===p?"bottom":"right";h=m(h+f["y"===p?"top":"left"],h,h-f[t])}if(a){const t="y"===u?"bottom":"right";d=m(d+f["y"===u?"top":"left"],d,d-f[t])}const w=s.fn({...e,[p]:h,[u]:d});return{...w,data:{x:w.x-n,y:w.y-o}}}}}({boundary:this.shiftBoundary,padding:this.shiftPadding})),this.autoSize?t.push(A({boundary:this.autoSizeBoundary,padding:this.autoSizePadding,apply:({availableWidth:t,availableHeight:e})=>{"vertical"===this.autoSize||"both"===this.autoSize?this.style.setProperty("--auto-size-available-height",`${e}px`):this.style.removeProperty("--auto-size-available-height"),"horizontal"===this.autoSize||"both"===this.autoSize?this.style.setProperty("--auto-size-available-width",`${t}px`):this.style.removeProperty("--auto-size-available-width")}})):(this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height")),this.arrow&&t.push((t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:a,elements:s,middlewareData:c}=e,{element:f,padding:u=0}=y(t,e)||{};if(null==f)return{};const p=R(u),h={x:n,y:o},d=P(i),g=v(d),b=await a.getDimensions(f),x="y"===d,E=x?"top":"left",z=x?"bottom":"right",S=x?"clientHeight":"clientWidth",T=r.reference[g]+r.reference[d]-h[d]-r.floating[g],L=h[d]-r.reference[d],O=await(null==a.getOffsetParent?void 0:a.getOffsetParent(f));let A=O?O[S]:0;(!A||!await(null==a.isElement?void 0:a.isElement(O)))&&(A=s.floating[S]||r.floating[g]);const k=T/2-L/2,C=A/2-b[g]/2-1,F=l(p[E],C),D=l(p[z],C),B=F,$=A-b[g]-D,H=A/2-b[g]/2+k,N=m(B,H,$),j=!c.arrow&&null!=w(i)&&H!=N&&r.reference[g]/2-(H<B?F:D)-b[g]/2<0,M=j?H<B?H-B:H-$:0;return{[d]:h[d]+M,data:{[d]:N,centerOffset:H-N-M,...j&&{alignmentOffset:M}},reset:j}}}))({element:this.arrowEl,padding:this.arrowPadding})),((t,e,n)=>{const o=new Map,i={platform:st,...n},r={...i.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:a}=n,s=r.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=T(c,o,l),p=o,h={},d=0;for(let n=0;n<s.length;n++){const{name:r,fn:m}=s[n],{x:y,y:g,data:w,reset:b}=await m({x:f,y:u,initialPlacement:o,placement:p,strategy:i,middlewareData:h,rects:c,platform:a,elements:{reference:t,floating:e}});f=y??f,u=g??u,h={...h,[r]:{...h[r],...w}},b&&d<=50&&(d++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:t,floating:e,strategy:i}):b.rects),({x:f,y:u}=T(c,p,l))),n=-1)}return{x:f,y:u,placement:p,strategy:i,middlewareData:h}})(t,e,{...i,platform:r})})(this.anchorEl,this.popup,{placement:this.placement,middleware:t,strategy:this.strategy}).then((({x:t,y:e,middlewareData:n,placement:o})=>{const i="rtl"===getComputedStyle(this).direction,r={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]];if(this.setAttribute("data-current-placement",o),Object.assign(this.popup.style,{left:`${t}px`,top:`${e}px`}),this.arrow){const t=n.arrow.x,e=n.arrow.y;let o="",a="",s="",l="";if("start"===this.arrowPlacement){const n="number"==typeof t?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";o="number"==typeof e?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"",a=i?n:"",l=i?"":n}else if("end"===this.arrowPlacement){const n="number"==typeof t?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";a=i?"":n,l=i?n:"",s="number"==typeof e?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:""}else"center"===this.arrowPlacement?(l="number"==typeof t?"calc(50% - var(--arrow-size-diagonal))":"",o="number"==typeof e?"calc(50% - var(--arrow-size-diagonal))":""):(l="number"==typeof t?`${t}px`:"",o="number"==typeof e?`${e}px`:"");Object.assign(this.arrowEl.style,{top:o,right:a,bottom:s,left:l,[r]:"calc(var(--arrow-size-diagonal) * -1)"})}})),this.emit("sd-reposition")}render(){return e`<slot name="anchor" @slotchange="${this.handleAnchorChange}"></slot><div part="popup" class="${s("isolate","fixed"!==this.strategy?"absolute":"fixed",!this.active&&"hidden")}"><slot></slot>${this.arrow?e`<div part="arrow" class="absolute rotate-45 -z-10" role="presentation"></div>`:""}</div>`}};ut.styles=[t.styles,a,n`:host{--arrow-color:var(--sd-color-neutral-1000);--arrow-size:6px;--arrow-size-diagonal:calc(var(--arrow-size) * 0.7071);--arrow-padding-offset:calc(var(--arrow-size-diagonal) - var(--arrow-size));display:contents}[part=popup]{max-width:var(--auto-size-available-width,none);max-height:var(--auto-size-available-height,none)}[part=arrow]{width:calc(var(--arrow-size-diagonal) * 2);height:calc(var(--arrow-size-diagonal) * 2);background:var(--arrow-color)}`],ft([r('[part="popup"]')],ut.prototype,"popup",2),ft([r('[part="arrow"]')],ut.prototype,"arrowEl",2),ft([o()],ut.prototype,"anchor",2),ft([o({type:Boolean,reflect:!0})],ut.prototype,"active",2),ft([o({reflect:!0})],ut.prototype,"placement",2),ft([o({reflect:!0})],ut.prototype,"strategy",2),ft([o({type:Number})],ut.prototype,"distance",2),ft([o({type:Number})],ut.prototype,"skidding",2),ft([o({type:Boolean})],ut.prototype,"arrow",2),ft([o({attribute:"arrow-placement"})],ut.prototype,"arrowPlacement",2),ft([o({attribute:"arrow-padding",type:Number})],ut.prototype,"arrowPadding",2),ft([o({type:Boolean})],ut.prototype,"flip",2),ft([o({attribute:"flip-fallback-placements",converter:{fromAttribute:t=>t.split(" ").map((t=>t.trim())).filter((t=>""!==t)),toAttribute:t=>t.join(" ")}})],ut.prototype,"flipFallbackPlacements",2),ft([o({attribute:"flip-fallback-strategy"})],ut.prototype,"flipFallbackStrategy",2),ft([o({type:Object})],ut.prototype,"flipBoundary",2),ft([o({attribute:"flip-padding",type:Number})],ut.prototype,"flipPadding",2),ft([o({type:Boolean})],ut.prototype,"shift",2),ft([o({type:Object})],ut.prototype,"shiftBoundary",2),ft([o({attribute:"shift-padding",type:Number})],ut.prototype,"shiftPadding",2),ft([o({attribute:"auto-size"})],ut.prototype,"autoSize",2),ft([o()],ut.prototype,"sync",2),ft([o({type:Object})],ut.prototype,"autoSizeBoundary",2),ft([o({attribute:"auto-size-padding",type:Number})],ut.prototype,"autoSizePadding",2),ut=ft([i("sd-popup")],ut);export{ut as default};
|
|
1
|
+
import{S as t,x as e,i as n,n as o,c as i}from"./solid-element.js";import{e as r}from"./query.js";import{c as a}from"./component.styles.js";import{t as s}from"./classix.js";const l=Math.min,c=Math.max,f=Math.round,u=Math.floor,h=t=>({x:t,y:t}),p={left:"right",right:"left",bottom:"top",top:"bottom"},d={start:"end",end:"start"};function m(t,e,n){return c(t,l(e,n))}function y(t,e){return"function"==typeof t?t(e):t}function g(t){return t.split("-")[0]}function w(t){return t.split("-")[1]}function b(t){return"x"===t?"y":"x"}function v(t){return"y"===t?"height":"width"}function x(t){return["top","bottom"].includes(g(t))?"y":"x"}function P(t){return b(x(t))}function E(t){return t.replace(/start|end/g,(t=>d[t]))}function z(t){return t.replace(/left|right|bottom|top/g,(t=>p[t]))}function R(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function S(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function O(t,e,n){let{reference:o,floating:i}=t;const r=x(e),a=P(e),s=v(a),l=g(e),c="y"===r,f=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,h=o[s]/2-i[s]/2;let p;switch(l){case"top":p={x:f,y:o.y-i.height};break;case"bottom":p={x:f,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:u};break;case"left":p={x:o.x-i.width,y:u};break;default:p={x:o.x,y:o.y}}switch(w(e)){case"start":p[a]-=h*(n&&c?-1:1);break;case"end":p[a]+=h*(n&&c?-1:1)}return p}async function T(t,e){var n;void 0===e&&(e={});const{x:o,y:i,platform:r,rects:a,elements:s,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=y(e,t),d=R(p),m=s[h?"floating"===u?"reference":"floating":u],g=S(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(m)))||n?m:m.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:l})),w="floating"===u?{...a.floating,x:o,y:i}:a.reference,b=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),v=await(null==r.isElement?void 0:r.isElement(b))&&await(null==r.getScale?void 0:r.getScale(b))||{x:1,y:1},x=S(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:b,strategy:l}):w);return{top:(g.top-x.top+d.top)/v.y,bottom:(x.bottom-g.bottom+d.bottom)/v.y,left:(g.left-x.left+d.left)/v.x,right:(x.right-g.right+d.right)/v.x}}const L=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:a,middlewareData:s}=e,l=await async function(t,e){const{placement:n,platform:o,elements:i}=t,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),a=g(n),s=w(n),l="y"===x(n),c=["left","top"].includes(a)?-1:1,f=r&&l?-1:1,u=y(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:d}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return s&&"number"==typeof d&&(p="end"===s?-1*d:d),l?{x:p*f,y:h*c}:{x:h*c,y:p*f}}(e,t);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:a}}}}};function A(t){return D(t)?(t.nodeName||"").toLowerCase():"#document"}function k(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function C(t){var e;return null==(e=(D(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function D(t){return t instanceof Node||t instanceof k(t).Node}function F(t){return t instanceof Element||t instanceof k(t).Element}function B(t){return t instanceof HTMLElement||t instanceof k(t).HTMLElement}function $(t){return!(typeof ShadowRoot>"u")&&(t instanceof ShadowRoot||t instanceof k(t).ShadowRoot)}function H(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=V(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(i)}function N(t){return["table","td","th"].includes(A(t))}function j(t){const e=M(),n=V(t);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((t=>(n.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(n.contain||"").includes(t)))}function M(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function W(t){return["html","body","#document"].includes(A(t))}function V(t){return k(t).getComputedStyle(t)}function q(t){return F(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function I(t){if("html"===A(t))return t;const e=t.assignedSlot||t.parentNode||$(t)&&t.host||C(t);return $(e)?e.host:e}function X(t){const e=I(t);return W(e)?t.ownerDocument?t.ownerDocument.body:t.body:B(e)&&H(e)?e:X(e)}function Y(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=X(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),a=k(i);return r?e.concat(a,a.visualViewport||[],H(i)?i:[],a.frameElement&&n?Y(a.frameElement):[]):e.concat(i,Y(i,[],n))}function _(t){const e=V(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=B(t),r=i?t.offsetWidth:n,a=i?t.offsetHeight:o,s=f(n)!==r||f(o)!==a;return s&&(n=r,o=a),{width:n,height:o,$:s}}function G(t){return F(t)?t:t.contextElement}function J(t){const e=G(t);if(!B(e))return h(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=_(e);let a=(r?f(n.width):n.width)/o,s=(r?f(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const K=h(0);function Q(t){const e=k(t);return M()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:K}function U(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const i=t.getBoundingClientRect(),r=G(t);let a=h(1);e&&(o?F(o)&&(a=J(o)):a=J(t));const s=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==k(t))&&e}(r,n,o)?Q(r):h(0);let l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,f=i.width/a.x,u=i.height/a.y;if(r){const t=k(r),e=o&&F(o)?k(o):o;let n=t,i=n.frameElement;for(;i&&o&&e!==n;){const t=J(i),e=i.getBoundingClientRect(),o=V(i),r=e.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x,a=e.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;l*=t.x,c*=t.y,f*=t.x,u*=t.y,l+=r,c+=a,n=k(i),i=n.frameElement}}return S({width:f,height:u,x:l,y:c})}const Z=[":popover-open",":modal"];function tt(t){return Z.some((e=>{try{return t.matches(e)}catch{return!1}}))}function et(t){return U(C(t)).left+q(t).scrollLeft}function nt(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=k(t),o=C(t),i=n.visualViewport;let r=o.clientWidth,a=o.clientHeight,s=0,l=0;if(i){r=i.width,a=i.height;const t=M();(!t||t&&"fixed"===e)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:r,height:a,x:s,y:l}}(t,n);else if("document"===e)o=function(t){const e=C(t),n=q(t),o=t.ownerDocument.body,i=c(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=c(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+et(t);const s=-n.scrollTop;return"rtl"===V(o).direction&&(a+=c(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:a,y:s}}(C(t));else if(F(e))o=function(t,e){const n=U(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=B(t)?J(t):h(1);return{width:t.clientWidth*r.x,height:t.clientHeight*r.y,x:i*r.x,y:o*r.y}}(e,n);else{const n=Q(t);o={...e,x:e.x-n.x,y:e.y-n.y}}return S(o)}function ot(t,e){const n=I(t);return!(n===e||!F(n)||W(n))&&("fixed"===V(n).position||ot(n,e))}function it(t,e){const n=e.get(t);if(n)return n;let o=Y(t,[],!1).filter((t=>F(t)&&"body"!==A(t))),i=null;const r="fixed"===V(t).position;let a=r?I(t):t;for(;F(a)&&!W(a);){const e=V(a),n=j(a);!n&&"fixed"===e.position&&(i=null),(r?!n&&!i:!n&&"static"===e.position&&i&&["absolute","fixed"].includes(i.position)||H(a)&&!n&&ot(t,a))?o=o.filter((t=>t!==a)):i=e,a=I(a)}return e.set(t,o),o}function rt(t,e,n){const o=B(e),i=C(e),r="fixed"===n,a=U(t,!0,r,e);let s={scrollLeft:0,scrollTop:0};const l=h(0);if(o||!o&&!r)if(("body"!==A(e)||H(i))&&(s=q(e)),o){const t=U(e,!0,r,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else i&&(l.x=et(i));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function at(t,e){return B(t)&&"fixed"!==V(t).position?e?e(t):t.offsetParent:null}function st(t,e){const n=k(t);if(!B(t)||tt(t))return n;let o=at(t,e);for(;o&&N(o)&&"static"===V(o).position;)o=at(o,e);return o&&("html"===A(o)||"body"===A(o)&&"static"===V(o).position&&!j(o))?n:o||function(t){let e=I(t);for(;B(e)&&!W(e);){if(j(e))return e;e=I(e)}return null}(t)||n}const lt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r="fixed"===i,a=C(o),s=!!e&&tt(e.floating);if(o===a||s&&r)return n;let l={scrollLeft:0,scrollTop:0},c=h(1);const f=h(0),u=B(o);if((u||!u&&!r)&&(("body"!==A(o)||H(a))&&(l=q(o)),B(o))){const t=U(o);c=J(o),f.x=t.x+o.clientLeft,f.y=t.y+o.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x,y:n.y*c.y-l.scrollTop*c.y+f.y}},getDocumentElement:C,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?it(e,this._c):[].concat(n),o],a=r[0],s=r.reduce(((t,n)=>{const o=nt(e,n,i);return t.top=c(o.top,t.top),t.right=l(o.right,t.right),t.bottom=l(o.bottom,t.bottom),t.left=c(o.left,t.left),t}),nt(e,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:st,getElementRects:async function(t){const e=this.getOffsetParent||st,n=this.getDimensions;return{reference:rt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,...await n(t.floating)}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=_(t);return{width:e,height:n}},getScale:J,isElement:F,isRTL:function(t){return"rtl"===V(t).direction}};const ct=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:o,platform:i,elements:r}=e,{apply:a=(()=>{}),...s}=y(t,e),f=await T(e,s),u=g(n),h=w(n),p="y"===x(n),{width:d,height:m}=o.floating;let b,v;"top"===u||"bottom"===u?(b=u,v=h===(await(null==i.isRTL?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(v=u,b="end"===h?"top":"bottom");const P=m-f[b],E=d-f[v],z=!e.middlewareData.shift;let R=P,S=E;if(p){const t=d-f.left-f.right;S=h||z?l(E,t):t}else{const t=m-f.top-f.bottom;R=h||z?l(P,t):t}if(z&&!h){const t=c(f.left,0),e=c(f.right,0),n=c(f.top,0),o=c(f.bottom,0);p?S=d-2*(0!==t||0!==e?t+e:c(f.left,f.right)):R=m-2*(0!==n||0!==o?n+o:c(f.top,f.bottom))}await a({...e,availableWidth:S,availableHeight:R});const O=await i.getDimensions(r.floating);return d!==O.width||m!==O.height?{reset:{rects:!0}}:{}}}};var ft=Object.defineProperty,ut=Object.getOwnPropertyDescriptor,ht=(t,e,n,o)=>{for(var i,r=o>1?void 0:o?ut(e,n):e,a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o?i(e,n,r):i(r))||r);return o&&r&&ft(e,n,r),r};let pt=class extends t{constructor(){super(...arguments),this.active=!1,this.placement="top",this.strategy="absolute",this.distance=0,this.skidding=0,this.arrow=!1,this.arrowPlacement="anchor",this.arrowPadding=10,this.flip=!1,this.flipFallbackPlacements="",this.flipFallbackStrategy="best-fit",this.flipPadding=0,this.shift=!1,this.shiftPadding=0,this.autoSizePadding=0}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.start(),this.setupMutationObserver()}disconnectedCallback(){this.stop(),this.mutationObserver&&this.mutationObserver.disconnect()}async updated(t){super.updated(t),t.has("active")&&(this.active?this.start():this.stop()),t.has("anchor")&&this.handleAnchorChange(),this.active&&(await this.updateComplete,this.reposition())}setupMutationObserver(){this.mutationObserver=new MutationObserver((t=>this.handleCurrentPlacementChange(t))),this.mutationObserver.observe(this,{attributes:!0})}handleCurrentPlacementChange(t){return t.forEach((t=>{if("data-current-placement"===t.attributeName){const t=this.getAttribute("data-current-placement");this.emit("sd-current-placement",{detail:t})}}))}async handleAnchorChange(){if(await this.stop(),this.anchor&&"string"==typeof this.anchor){const t=this.getRootNode();this.anchorEl=t.getElementById(this.anchor)}else this.anchor instanceof HTMLElement?this.anchorEl=this.anchor:this.anchorEl=this.querySelector('[slot="anchor"]');if(this.anchorEl instanceof HTMLSlotElement&&(this.anchorEl=this.anchorEl.assignedElements({flatten:!0})[0]),!this.anchorEl)throw new Error("Invalid anchor element: no anchor could be found using the anchor slot or the anchor attribute.");this.start()}start(){this.anchorEl&&(this.cleanup=function(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:f=!1}=o,h=G(t),p=i||r?[...h?Y(h):[],...Y(e)]:[];p.forEach((t=>{i&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));const d=h&&s?function(t,e){let n,o=null;const i=C(t);function r(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function a(s,f){void 0===s&&(s=!1),void 0===f&&(f=1),r();const{left:h,top:p,width:d,height:m}=t.getBoundingClientRect();if(s||e(),!d||!m)return;const y={rootMargin:-u(p)+"px "+-u(i.clientWidth-(h+d))+"px "+-u(i.clientHeight-(p+m))+"px "+-u(h)+"px",threshold:c(0,l(1,f))||1};let g=!0;function w(t){const e=t[0].intersectionRatio;if(e!==f){if(!g)return a();e?a(!1,e):n=setTimeout((()=>{a(!1,1e-7)}),100)}g=!1}try{o=new IntersectionObserver(w,{...y,root:i.ownerDocument})}catch{o=new IntersectionObserver(w,y)}o.observe(t)}(!0),r}(h,n):null;let m=-1,y=null;a&&(y=new ResizeObserver((t=>{let[o]=t;o&&o.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var t;null==(t=y)||t.observe(e)}))),n()})),h&&!f&&y.observe(h),y.observe(e));let g,w=f?U(t):null;return f&&function e(){const o=U(t);w&&(o.x!==w.x||o.y!==w.y||o.width!==w.width||o.height!==w.height)&&n(),w=o,g=requestAnimationFrame(e)}(),n(),()=>{var t;p.forEach((t=>{i&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==d||d(),null==(t=y)||t.disconnect(),y=null,f&&cancelAnimationFrame(g)}}(this.anchorEl,this.popup,(()=>{this.reposition()})))}async stop(){return new Promise((t=>{this.cleanup?(this.cleanup(),this.cleanup=void 0,this.removeAttribute("data-current-placement"),this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height"),requestAnimationFrame((()=>t()))):t()}))}reposition(){if(!this.active||!this.anchorEl)return;const t=[L({mainAxis:this.distance,crossAxis:this.skidding})];this.sync?t.push(ct({apply:({rects:t})=>{const e="width"===this.sync||"both"===this.sync,n="height"===this.sync||"both"===this.sync;this.popup.style.width=e?`${t.reference.width}px`:"",this.popup.style.height=n?`${t.reference.height}px`:""}})):(this.popup.style.width="",this.popup.style.height=""),this.flip&&t.push(function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:a,initialPlacement:s,platform:l,elements:c}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:m=!0,...b}=y(t,e);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const x=g(i),R=g(s)===s,S=await(null==l.isRTL?void 0:l.isRTL(c.floating)),O=h||(R||!m?[z(s)]:function(t){const e=z(t);return[E(t),e,E(e)]}(s));!h&&"none"!==d&&O.push(...function(t,e,n,o){const i=w(t);let r=function(t,e,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:o:e?o:i;case"left":case"right":return e?r:a;default:return[]}}(g(t),"start"===n,o);return i&&(r=r.map((t=>t+"-"+i)),e&&(r=r.concat(r.map(E)))),r}(s,m,d,S));const L=[s,...O],A=await T(e,b),k=[];let C=(null==(o=r.flip)?void 0:o.overflows)||[];if(f&&k.push(A[x]),u){const t=function(t,e,n){void 0===n&&(n=!1);const o=w(t),i=P(t),r=v(i);let a="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[r]>e.floating[r]&&(a=z(a)),[a,z(a)]}(i,a,S);k.push(A[t[0]],A[t[1]])}if(C=[...C,{placement:i,overflows:k}],!k.every((t=>t<=0))){var D,F;const t=((null==(D=r.flip)?void 0:D.index)||0)+1,e=L[t];if(e)return{data:{index:t,overflows:C},reset:{placement:e}};let n=null==(F=C.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:F.placement;if(!n)switch(p){case"bestFit":{var B;const t=null==(B=C.map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:B[0];t&&(n=t);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}}({boundary:this.flipBoundary,fallbackPlacements:this.flipFallbackPlacements,fallbackStrategy:"best-fit"===this.flipFallbackStrategy?"bestFit":"initialPlacement",padding:this.flipPadding})),this.shift&&t.push(function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:r=!0,crossAxis:a=!1,limiter:s={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...l}=y(t,e),c={x:n,y:o},f=await T(e,l),u=x(g(i)),h=b(u);let p=c[h],d=c[u];if(r){const t="y"===h?"bottom":"right";p=m(p+f["y"===h?"top":"left"],p,p-f[t])}if(a){const t="y"===u?"bottom":"right";d=m(d+f["y"===u?"top":"left"],d,d-f[t])}const w=s.fn({...e,[h]:p,[u]:d});return{...w,data:{x:w.x-n,y:w.y-o}}}}}({boundary:this.shiftBoundary,padding:this.shiftPadding})),this.autoSize?t.push(ct({boundary:this.autoSizeBoundary,padding:this.autoSizePadding,apply:({availableWidth:t,availableHeight:e})=>{"vertical"===this.autoSize||"both"===this.autoSize?this.style.setProperty("--auto-size-available-height",`${e}px`):this.style.removeProperty("--auto-size-available-height"),"horizontal"===this.autoSize||"both"===this.autoSize?this.style.setProperty("--auto-size-available-width",`${t}px`):this.style.removeProperty("--auto-size-available-width")}})):(this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height")),this.arrow&&t.push((t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:a,elements:s,middlewareData:c}=e,{element:f,padding:u=0}=y(t,e)||{};if(null==f)return{};const h=R(u),p={x:n,y:o},d=P(i),g=v(d),b=await a.getDimensions(f),x="y"===d,E=x?"top":"left",z=x?"bottom":"right",S=x?"clientHeight":"clientWidth",O=r.reference[g]+r.reference[d]-p[d]-r.floating[g],T=p[d]-r.reference[d],L=await(null==a.getOffsetParent?void 0:a.getOffsetParent(f));let A=L?L[S]:0;(!A||!await(null==a.isElement?void 0:a.isElement(L)))&&(A=s.floating[S]||r.floating[g]);const k=O/2-T/2,C=A/2-b[g]/2-1,D=l(h[E],C),F=l(h[z],C),B=D,$=A-b[g]-F,H=A/2-b[g]/2+k,N=m(B,H,$),j=!c.arrow&&null!=w(i)&&H!==N&&r.reference[g]/2-(H<B?D:F)-b[g]/2<0,M=j?H<B?H-B:H-$:0;return{[d]:p[d]+M,data:{[d]:N,centerOffset:H-N-M,...j&&{alignmentOffset:M}},reset:j}}}))({element:this.arrowEl,padding:this.arrowPadding})),((t,e,n)=>{const o=new Map,i={platform:lt,...n},r={...i.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:a}=n,s=r.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=O(c,o,l),h=o,p={},d=0;for(let n=0;n<s.length;n++){const{name:r,fn:m}=s[n],{x:y,y:g,data:w,reset:b}=await m({x:f,y:u,initialPlacement:o,placement:h,strategy:i,middlewareData:p,rects:c,platform:a,elements:{reference:t,floating:e}});f=y??f,u=g??u,p={...p,[r]:{...p[r],...w}},b&&d<=50&&(d++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:t,floating:e,strategy:i}):b.rects),({x:f,y:u}=O(c,h,l))),n=-1)}return{x:f,y:u,placement:h,strategy:i,middlewareData:p}})(t,e,{...i,platform:r})})(this.anchorEl,this.popup,{placement:this.placement,middleware:t,strategy:this.strategy}).then((({x:t,y:e,middlewareData:n,placement:o})=>{const i="rtl"===getComputedStyle(this).direction,r={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]];if(this.setAttribute("data-current-placement",o),Object.assign(this.popup.style,{left:`${t}px`,top:`${e}px`}),this.arrow){const t=n.arrow.x,e=n.arrow.y;let o="",a="",s="",l="";if("start"===this.arrowPlacement){const n="number"==typeof t?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";o="number"==typeof e?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"",a=i?n:"",l=i?"":n}else if("end"===this.arrowPlacement){const n="number"==typeof t?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";a=i?"":n,l=i?n:"",s="number"==typeof e?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:""}else"center"===this.arrowPlacement?(l="number"==typeof t?"calc(50% - var(--arrow-size-diagonal))":"",o="number"==typeof e?"calc(50% - var(--arrow-size-diagonal))":""):(l="number"==typeof t?`${t}px`:"",o="number"==typeof e?`${e}px`:"");Object.assign(this.arrowEl.style,{top:o,right:a,bottom:s,left:l,[r]:"calc(var(--arrow-size-diagonal) * -1)"})}})),this.emit("sd-reposition")}render(){return e`<slot name="anchor" @slotchange="${this.handleAnchorChange}"></slot><div part="popup" class="${s("isolate","fixed"!==this.strategy?"absolute":"fixed",!this.active&&"hidden")}"><slot></slot>${this.arrow?e`<div part="arrow" class="absolute rotate-45 -z-10" role="presentation"></div>`:""}</div>`}};pt.styles=[t.styles,a,n`:host{--arrow-color:var(--sd-color-neutral-1000);--arrow-size:6px;--arrow-size-diagonal:calc(var(--arrow-size) * 0.7071);--arrow-padding-offset:calc(var(--arrow-size-diagonal) - var(--arrow-size));display:contents}[part=popup]{max-width:var(--auto-size-available-width,none);max-height:var(--auto-size-available-height,none)}[part=arrow]{width:calc(var(--arrow-size-diagonal) * 2);height:calc(var(--arrow-size-diagonal) * 2);background:var(--arrow-color)}`],ht([r('[part="popup"]')],pt.prototype,"popup",2),ht([r('[part="arrow"]')],pt.prototype,"arrowEl",2),ht([o()],pt.prototype,"anchor",2),ht([o({type:Boolean,reflect:!0})],pt.prototype,"active",2),ht([o({reflect:!0})],pt.prototype,"placement",2),ht([o({reflect:!0})],pt.prototype,"strategy",2),ht([o({type:Number})],pt.prototype,"distance",2),ht([o({type:Number})],pt.prototype,"skidding",2),ht([o({type:Boolean})],pt.prototype,"arrow",2),ht([o({attribute:"arrow-placement"})],pt.prototype,"arrowPlacement",2),ht([o({attribute:"arrow-padding",type:Number})],pt.prototype,"arrowPadding",2),ht([o({type:Boolean})],pt.prototype,"flip",2),ht([o({attribute:"flip-fallback-placements",converter:{fromAttribute:t=>t.split(" ").map((t=>t.trim())).filter((t=>""!==t)),toAttribute:t=>t.join(" ")}})],pt.prototype,"flipFallbackPlacements",2),ht([o({attribute:"flip-fallback-strategy"})],pt.prototype,"flipFallbackStrategy",2),ht([o({type:Object})],pt.prototype,"flipBoundary",2),ht([o({attribute:"flip-padding",type:Number})],pt.prototype,"flipPadding",2),ht([o({type:Boolean})],pt.prototype,"shift",2),ht([o({type:Object})],pt.prototype,"shiftBoundary",2),ht([o({attribute:"shift-padding",type:Number})],pt.prototype,"shiftPadding",2),ht([o({attribute:"auto-size"})],pt.prototype,"autoSize",2),ht([o()],pt.prototype,"sync",2),ht([o({type:Object})],pt.prototype,"autoSizeBoundary",2),ht([o({attribute:"auto-size-padding",type:Number})],pt.prototype,"autoSizePadding",2),pt=ht([i("sd-popup")],pt);export{pt as default};
|
|
@@ -8,4 +8,4 @@ const e=(e,t,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&"object"!=
|
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/;function t(t,r){return(n,o,
|
|
11
|
+
*/;function t(t,r){return(n,o,l)=>{const s=e=>{var r;return(null==(r=e.renderRoot)?void 0:r.querySelector(t))??null};if(r){const{get:t,set:r}="object"==typeof o?n:l??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return e(n,o,{get(){let e=t.call(this);return void 0===e&&(e=s(this),(null!==e||this.hasUpdated)&&r.call(this,e)),e}})}return e(n,o,{get(){return s(this)}})}}export{e as a,t as e};
|