@solid-design-system/components 3.6.0 → 3.7.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/option.js +1 -1
- package/dist/components/es/solid-components2.js +1 -1
- package/dist/components/umd/solid-components.js +2 -2
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/accordion/accordion.d.ts +2 -1
- package/dist/package/components/carousel/carousel.d.ts +2 -1
- package/dist/package/components/dialog/dialog.d.ts +2 -1
- package/dist/package/components/drawer/drawer.d.ts +2 -1
- package/dist/package/components/dropdown/dropdown.d.ts +2 -1
- package/dist/package/components/input/input.d.ts +2 -1
- package/dist/package/components/notification/notification.d.ts +2 -1
- package/dist/package/components/option/option.d.ts +0 -1
- package/dist/package/components/option/option.js +0 -2
- package/dist/package/components/select/select.d.ts +2 -1
- package/dist/package/components/spinner/spinner.d.ts +2 -1
- package/dist/package/components/tab-group/tab-group.d.ts +2 -1
- package/dist/package/components/tooltip/tooltip.d.ts +2 -1
- package/dist/package/utilities/localize.d.ts +10 -0
- package/dist/package/utilities/localize.js +45 -0
- 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 +1 -1
- 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/map-marker.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/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/scrollable.js +1 -1
- package/dist/versioned-components/es/select.js +3 -3
- package/dist/versioned-components/es/solid-components2.js +1 -1
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/step-group.js +1 -1
- package/dist/versioned-components/es/step.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 +3 -2
- 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 +3 -2
- 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 +3 -3
- 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 +3 -2
- 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 +3 -2
- package/dist/versioned-package/components/drawer/drawer.js +2 -2
- package/dist/versioned-package/components/dropdown/dropdown.d.ts +3 -2
- 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 +3 -2
- package/dist/versioned-package/components/input/input.js +2 -2
- 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/map-marker/map-marker.d.ts +1 -1
- package/dist/versioned-package/components/map-marker/map-marker.js +1 -1
- 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 +3 -2
- package/dist/versioned-package/components/notification/notification.js +5 -5
- package/dist/versioned-package/components/option/option.d.ts +1 -2
- package/dist/versioned-package/components/option/option.js +2 -4
- 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 +13 -13
- package/dist/versioned-package/components/scrollable/scrollable.d.ts +1 -1
- package/dist/versioned-package/components/scrollable/scrollable.js +3 -3
- package/dist/versioned-package/components/select/select.d.ts +6 -5
- package/dist/versioned-package/components/select/select.js +25 -25
- package/dist/versioned-package/components/spinner/spinner.d.ts +3 -2
- package/dist/versioned-package/components/spinner/spinner.js +1 -1
- package/dist/versioned-package/components/step/step.d.ts +1 -1
- package/dist/versioned-package/components/step/step.js +5 -5
- package/dist/versioned-package/components/step-group/step-group.d.ts +1 -1
- package/dist/versioned-package/components/step-group/step-group.js +2 -2
- package/dist/versioned-package/components/switch/switch.d.ts +1 -1
- package/dist/versioned-package/components/switch/switch.js +1 -1
- 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 +3 -2
- package/dist/versioned-package/components/tab-group/tab-group.js +13 -13
- 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 +2 -2
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +3 -2
- 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/utilities/autocomplete-config.js +4 -4
- package/dist/versioned-package/utilities/localize.d.ts +10 -0
- package/dist/versioned-package/utilities/localize.js +45 -0
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +41 -41
- package/dist/web-types.json +42 -50
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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-3-
|
|
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-3-7-0-button variant="tertiary" size="lg" part="close-button" @click="${()=>this.requestClose("close-button")}"><sd-3-7-0-icon name="close" library="system"></sd-3-7-0-icon></sd-3-7-0-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-3-7-0-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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./popup.js";import{w as e,s as t,a as n}from"./event.js";import{S as o,x as i,i as s,n as a,c as r}from"./solid-element.js";import{g as d,s as l}from"./animation-registry.js";import{g as p}from"./tabbable.js";import{L as h}from"./solid-components2.js";import{e as c}from"./query.js";import{s as u}from"./scroll.js";import{w as m}from"./watch.js";import{c as g}from"./component.styles.js";import{t as w}from"./classix.js";var y=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(e,t,n,o)=>{for(var i,s=o>1?void 0:o?f(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o?i(t,n,s):i(s))||s);return o&&s&&y(t,n,s),s};let b=class extends o{constructor(){super(...arguments),this.localize=new h(this),this.open=!1,this.rounded=!1,this.placement="bottom-start",this.disabled=!1,this.stayOpenOnSelect=!1,this.distance=0,this.skidding=0,this.noAutoSize=!1,this.noFlip=!1,this.hoist=!1}connectedCallback(){super.connectedCallback(),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.containingElement||(this.containingElement=this)}firstUpdated(){this.panel.hidden=!this.open,this.open&&(this.addOpenListeners(),this.popup.active=!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeOpenListeners(),this.hide()}focusOnTrigger(){const e=this.trigger.assignedElements({flatten:!0})[0];"function"==typeof(null==e?void 0:e.focus)&&e.focus()}getMenu(){return this.panel.assignedElements({flatten:!0}).find((e=>"sd-menu"===e.tagName.toLowerCase()))}handleKeyDown(e){this.open&&"Escape"===e.key&&(e.stopPropagation(),this.hide(),this.focusOnTrigger())}handleDocumentKeyDown(e){var t;if("Tab"===e.key){if(this.open&&"sd-menu-item"===(null==(t=document.activeElement)?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e,t,n,o,i,s,a,r,d,l,p,h;const c=(null==(i=null==(o=null==(n=null==(t=null==(e=document.activeElement)?void 0:e.shadowRoot)?void 0:t.activeElement)?void 0:n.shadowRoot)?void 0:o.activeElement)?void 0:i.getRootNode())instanceof ShadowRoot?null==(d=null==(r=null==(a=null==(s=document.activeElement)?void 0:s.shadowRoot)?void 0:a.activeElement)?void 0:r.shadowRoot)?void 0:d.activeElement:(null==(l=this.containingElement)?void 0:l.getRootNode())instanceof ShadowRoot?null==(h=null==(p=document.activeElement)?void 0:p.shadowRoot)?void 0:h.activeElement:document.activeElement;(!this.containingElement||(null==c?void 0:c.closest(this.containingElement.tagName.toLowerCase()))!==this.containingElement)&&this.hide()}))}}handleDocumentMouseDown(e){const t=e.composedPath();this.containingElement&&!t.includes(this.containingElement)&&this.hide()}handleMenuItemActivate(e){const t=e.target;u(t,this.panel)}handlePanelSelect(e){const t=e.target;!this.stayOpenOnSelect&&"sd-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){if("Escape"===e.key&&this.open)return e.stopPropagation(),this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void this.handleTriggerClick();const t=this.getMenu();if(t){const n=t.defaultSlot.assignedElements({flatten:!0}),o=n[0],i=n[n.length-1];["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(e.preventDefault(),this.open||this.show(),n.length>0&&requestAnimationFrame((()=>{("ArrowDown"===e.key||"Home"===e.key)&&(t.setCurrentItem(o),o.focus()),("ArrowUp"===e.key||"End"===e.key)&&(t.setCurrentItem(i),i.focus())})))}}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.assignedElements({flatten:!0}).find((e=>p(e).start));let t;if(e){switch(e.tagName.toLowerCase()){case"sd-3-
|
|
1
|
+
import"./popup.js";import{w as e,s as t,a as n}from"./event.js";import{S as o,x as i,i as s,n as a,c as r}from"./solid-element.js";import{g as d,s as l}from"./animation-registry.js";import{g as p}from"./tabbable.js";import{L as h}from"./solid-components2.js";import{e as c}from"./query.js";import{s as u}from"./scroll.js";import{w as m}from"./watch.js";import{c as g}from"./component.styles.js";import{t as w}from"./classix.js";var y=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(e,t,n,o)=>{for(var i,s=o>1?void 0:o?f(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o?i(t,n,s):i(s))||s);return o&&s&&y(t,n,s),s};let b=class extends o{constructor(){super(...arguments),this.localize=new h(this),this.open=!1,this.rounded=!1,this.placement="bottom-start",this.disabled=!1,this.stayOpenOnSelect=!1,this.distance=0,this.skidding=0,this.noAutoSize=!1,this.noFlip=!1,this.hoist=!1}connectedCallback(){super.connectedCallback(),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.containingElement||(this.containingElement=this)}firstUpdated(){this.panel.hidden=!this.open,this.open&&(this.addOpenListeners(),this.popup.active=!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeOpenListeners(),this.hide()}focusOnTrigger(){const e=this.trigger.assignedElements({flatten:!0})[0];"function"==typeof(null==e?void 0:e.focus)&&e.focus()}getMenu(){return this.panel.assignedElements({flatten:!0}).find((e=>"sd-menu"===e.tagName.toLowerCase()))}handleKeyDown(e){this.open&&"Escape"===e.key&&(e.stopPropagation(),this.hide(),this.focusOnTrigger())}handleDocumentKeyDown(e){var t;if("Tab"===e.key){if(this.open&&"sd-menu-item"===(null==(t=document.activeElement)?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e,t,n,o,i,s,a,r,d,l,p,h;const c=(null==(i=null==(o=null==(n=null==(t=null==(e=document.activeElement)?void 0:e.shadowRoot)?void 0:t.activeElement)?void 0:n.shadowRoot)?void 0:o.activeElement)?void 0:i.getRootNode())instanceof ShadowRoot?null==(d=null==(r=null==(a=null==(s=document.activeElement)?void 0:s.shadowRoot)?void 0:a.activeElement)?void 0:r.shadowRoot)?void 0:d.activeElement:(null==(l=this.containingElement)?void 0:l.getRootNode())instanceof ShadowRoot?null==(h=null==(p=document.activeElement)?void 0:p.shadowRoot)?void 0:h.activeElement:document.activeElement;(!this.containingElement||(null==c?void 0:c.closest(this.containingElement.tagName.toLowerCase()))!==this.containingElement)&&this.hide()}))}}handleDocumentMouseDown(e){const t=e.composedPath();this.containingElement&&!t.includes(this.containingElement)&&this.hide()}handleMenuItemActivate(e){const t=e.target;u(t,this.panel)}handlePanelSelect(e){const t=e.target;!this.stayOpenOnSelect&&"sd-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){if("Escape"===e.key&&this.open)return e.stopPropagation(),this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void this.handleTriggerClick();const t=this.getMenu();if(t){const n=t.defaultSlot.assignedElements({flatten:!0}),o=n[0],i=n[n.length-1];["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(e.preventDefault(),this.open||this.show(),n.length>0&&requestAnimationFrame((()=>{("ArrowDown"===e.key||"Home"===e.key)&&(t.setCurrentItem(o),o.focus()),("ArrowUp"===e.key||"End"===e.key)&&(t.setCurrentItem(i),i.focus())})))}}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.assignedElements({flatten:!0}).find((e=>p(e).start));let t;if(e){switch(e.tagName.toLowerCase()){case"sd-3-7-0-button":case"sd-3-7-0-icon-button":t=e.button;break;default:t=e}t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded",this.open?"true":"false")}}async show(){if(!this.open)return this.open=!0,e(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,e(this,"sd-after-hide")}reposition(){this.popup.reposition()}addOpenListeners(){this.panel.addEventListener("sd-activate",this.handleMenuItemActivate),this.panel.addEventListener("sd-3-7-0-select",this.handlePanelSelect),this.panel.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){this.panel&&(this.panel.removeEventListener("sd-activate",this.handleMenuItemActivate),this.panel.removeEventListener("sd-3-7-0-select",this.handlePanelSelect),this.panel.removeEventListener("keydown",this.handleKeyDown)),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}async handleOpenChange(){if(this.disabled)this.open=!1;else if(this.updateAccessibleTrigger(),this.open){this.emit("sd-show"),this.addOpenListeners(),await t(this),this.panel.hidden=!1,this.popup.active=!0;const{keyframes:e,options:o}=d(this,"dropdown.show",{dir:this.localize.dir()});await n(this.popup.popup,e,o),this.emit("sd-after-show")}else{this.emit("sd-hide"),this.removeOpenListeners(),await t(this);const{keyframes:e,options:o}=d(this,"dropdown.hide",{dir:this.localize.dir()});await n(this.popup.popup,e,o),this.panel.hidden=!0,this.popup.active=!1,this.emit("sd-after-hide")}}render(){return i`<sd-3-7-0-popup part="base" id="dropdown" placement="${this.placement}" distance="${this.rounded&&this.distance<1?1:this.distance}" skidding="${this.skidding}" strategy="${this.hoist?"fixed":"absolute"}" ?flip="${!this.noFlip}" shift auto-size="vertical" auto-size-padding="10" ?active="${this.open}"><slot name="trigger" slot="anchor" part="trigger" class="block" @click="${this.handleTriggerClick}" @keydown="${this.handleTriggerKeyDown}" @keyup="${this.handleTriggerKeyUp}" @slotchange="${this.handleTriggerSlotChange}"></slot><slot part="panel" class="${w("shadow bg-white",this.open?"block pointer-events-auto":"pointer-events-none",this.rounded&&"rounded-md")}" aria-hidden="${this.open?"false":"true"}" aria-labelledby="dropdown"></slot></sd-3-7-0-popup>`}};b.styles=[o.styles,g,s`:host{display:inline-block}#dropdown::part(popup){z-index:var(--sd-z-index-dropdown,900)}#dropdown[data-current-placement^=top]::part(popup){transform-origin:bottom}#dropdown[data-current-placement^=bottom]::part(popup){transform-origin:top}#dropdown[data-current-placement^=left]::part(popup){transform-origin:right}#dropdown[data-current-placement^=right]::part(popup){transform-origin:left}:host(:not([no-auto-size])) ::slotted(:not([slot=trigger])){overflow:auto;max-width:var(--auto-size-available-width)!important;max-height:var(--auto-size-available-height)!important}`],v([c("#dropdown")],b.prototype,"popup",2),v([c("[part=trigger]")],b.prototype,"trigger",2),v([c("[part=panel]")],b.prototype,"panel",2),v([a({type:Boolean,reflect:!0})],b.prototype,"open",2),v([a({type:Boolean,reflect:!0})],b.prototype,"rounded",2),v([a({reflect:!0})],b.prototype,"placement",2),v([a({type:Boolean,reflect:!0})],b.prototype,"disabled",2),v([a({attribute:"stay-open-on-select",type:Boolean,reflect:!0})],b.prototype,"stayOpenOnSelect",2),v([a({attribute:!1})],b.prototype,"containingElement",2),v([a({type:Number})],b.prototype,"distance",2),v([a({type:Number})],b.prototype,"skidding",2),v([a({type:Boolean,reflect:!0,attribute:"no-auto-size"})],b.prototype,"noAutoSize",2),v([a({type:Boolean,reflect:!0,attribute:"no-flip"})],b.prototype,"noFlip",2),v([a({type:Boolean})],b.prototype,"hoist",2),v([m("open",{waitUntilFirstUpdate:!0})],b.prototype,"handleOpenChange",1),b=v([r("sd-3-7-0-dropdown")],b),l("dropdown.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),l("dropdown.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as t}from"./solid-element.js";const e=new WeakMap,i=new WeakMap,s=new WeakMap,o=new WeakMap;class a{constructor(t,i){this.handleFormData=t=>{const e=this.options.disabled(this.host),i=this.options.name(this.host),s=this.options.value(this.host),o="sd-3-
|
|
1
|
+
import{x as t}from"./solid-element.js";const e=new WeakMap,i=new WeakMap,s=new WeakMap,o=new WeakMap;class a{constructor(t,i){this.handleFormData=t=>{const e=this.options.disabled(this.host),i=this.options.name(this.host),s=this.options.value(this.host),o="sd-3-7-0-button"===this.host.tagName.toLowerCase();!e&&!o&&"string"==typeof i&&i.length>0&&typeof s<"u"&&(Array.isArray(s)?s.forEach((e=>{t.formData.append(i,e.toString())})):t.formData.append(i,s.toString()))},this.handleFormSubmit=t=>{var i,s;const o=this.options.disabled(this.host),a=this.options.reportValidity;if(this.form&&!this.form.noValidate&&(null==(i=e.get(this.form))||i.forEach((t=>{this.setUserInteracted(t,!0)}))),this.form&&!this.form.noValidate&&!o&&!a(this.host)){t.preventDefault(),t.stopImmediatePropagation();const e=null==(s=this.form)?void 0:s.querySelectorAll("[data-invalid]");Array.from(e).filter((t=>"sd-3-7-0-radio-group"===t.tagName.toLowerCase())).forEach((t=>{var e,i;null==(i=null==(e=t.shadowRoot)?void 0:e.querySelector("input"))||i.dispatchEvent(new Event("invalid"))})),null!=e&&e.length&&e[0].focus()}},this.handleFormReset=()=>{this.options.setValue(this.host,this.options.defaultValue(this.host)),this.setUserInteracted(this.host,!1),o.set(this.host,[])},this.handleInteraction=t=>{const e=o.get(this.host);e.includes(t.type)||e.push(t.type),e.length===this.options.assumeInteractionOn.length&&this.setUserInteracted(this.host,!0)},this.fakeUserInteraction=()=>{this.setUserInteracted(this.host,!0)},(this.host=t).addController(this),this.options={form:t=>{if(t.hasAttribute("form")&&""!==t.getAttribute("form")){const e=t.getRootNode(),i=t.getAttribute("form");if(i)return e.getElementById(i)}return t.closest("form")},name:t=>t.name,value:t=>t.value,defaultValue:t=>t.defaultValue,disabled:t=>t.disabled??!1,reportValidity:t=>"function"!=typeof t.reportValidity||t.reportValidity(),setValue:(t,e)=>t.value=e,assumeInteractionOn:["sd-3-7-0-input"],...i}}hostConnected(){const t=this.options.form(this.host);t&&this.attachForm(t),o.set(this.host,[]),this.options.assumeInteractionOn.forEach((t=>{this.host.addEventListener(t,this.handleInteraction)}))}hostDisconnected(){this.detachForm(),o.delete(this.host),this.options.assumeInteractionOn.forEach((t=>{this.host.removeEventListener(t,this.handleInteraction)}))}hostUpdated(){var t;const e=this.options.form(this.host);e||this.detachForm(),e&&this.form!==e&&(this.detachForm(),this.attachForm(e)),this.host.hasUpdated&&(this.setValidity(null==(t=this.host)?void 0:t.validity.valid),this.updateValidityStyle())}attachForm(t){t?(this.form=t,e.has(this.form)?e.get(this.form).add(this.host):e.set(this.form,new Set([this.host])),this.form.addEventListener("formdata",this.handleFormData),this.form.addEventListener("submit",this.handleFormSubmit),this.form.addEventListener("reset",this.handleFormReset),i.has(this.form)||(i.set(this.form,this.form.reportValidity),this.form.reportValidity=()=>this.reportFormValidity())):this.form=void 0}detachForm(){var t;this.form&&(null==(t=e.get(this.form))||t.delete(this.host),this.form.removeEventListener("formdata",this.handleFormData),this.form.removeEventListener("submit",this.handleFormSubmit),this.form.removeEventListener("reset",this.handleFormReset),i.has(this.form)&&(this.form.reportValidity=i.get(this.form),i.delete(this.form))),this.form=void 0}reportFormValidity(){if(this.form&&!this.form.noValidate){const t=this.form.querySelectorAll("*");for(const e of t)if("function"==typeof e.reportValidity&&!e.reportValidity())return!1}return!0}setUserInteracted(t,e){s.set(t,e),t.requestUpdate()}doAction(t,e){if(this.form){const i=document.createElement("button");i.type=t,i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.clipPath="inset(50%)",i.style.overflow="hidden",i.style.whiteSpace="nowrap",e&&(i.name=e.name,i.value=e.value,["formaction","formenctype","formmethod","formnovalidate","formtarget"].forEach((t=>{e.hasAttribute(t)&&i.setAttribute(t,e.getAttribute(t))}))),this.form.append(i),i.click(),i.remove()}}updateValidityStyle(){this.host.hasAttribute("data-user-valid")&&this.host.checkValidity()?(void 0!==this.host.showValidStyle&&(this.host.showValidStyle=!0),this.host.showInvalidStyle=!1):this.host.hasAttribute("data-user-invalid")&&!this.host.checkValidity()?(void 0!==this.host.showValidStyle&&(this.host.showValidStyle=!1),this.host.showInvalidStyle=!0):(void 0!==this.host.showValidStyle&&(this.host.showValidStyle=!1),this.host.showInvalidStyle=!1)}getForm(){return this.form??null}renderInvalidMessage(){return t`<div id="invalid-message" class="text-error text-sm mt-2 text-left" part="invalid-message" aria-live="polite" ?hidden="${!this.host.showInvalidStyle}"></div>`}reset(t){this.doAction("reset",t)}submit(t){this.doAction("submit",t)}setValidity(t){var e;const i=this.host,o=!!s.get(i),a=!!i.required;null!=(e=this.form)&&e.noValidate?(i.removeAttribute("data-required"),i.removeAttribute("data-optional"),i.removeAttribute("data-invalid"),i.removeAttribute("data-valid"),i.removeAttribute("data-user-invalid"),i.removeAttribute("data-user-valid")):(i.toggleAttribute("data-required",a),i.toggleAttribute("data-optional",!a),i.toggleAttribute("data-invalid",!t),i.toggleAttribute("data-valid",t),i.toggleAttribute("data-user-invalid",!t&&o),i.toggleAttribute("data-user-valid",t&&o))}updateValidity(){const t=this.host;this.setValidity(null==t?void 0:t.validity.valid)}emitInvalidEvent(t){null==t||t.preventDefault();const e=new CustomEvent("sd-invalid",{bubbles:!1,composed:!1,cancelable:!0,detail:{}});t||e.preventDefault()}}const r=Object.freeze({badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:!0,valueMissing:!1}),h=Object.freeze({...r,valid:!1,valueMissing:!0}),n=Object.freeze({...r,valid:!1,customError:!0});export{a as F,h as a,n as c,r as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,x as t,i as r,n as s,c as a}from"./solid-element.js";import{d as i}from"./debounce.js";import{c as d}from"./component.styles.js";var l=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=(e,t,r,s)=>{for(var a,i=s>1?void 0:s?n(t,r):t,d=e.length-1;d>=0;d--)(a=e[d])&&(i=(s?a(t,r,i):a(i))||i);return s&&i&&l(t,r,i),i};let h=class extends e{constructor(){super(...arguments),this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setCalculatedHeightProperty=this.setCalculatedHeightProperty.bind(this),this.addResizeObserver=this.addResizeObserver.bind(this)}firstUpdated(){this.toggleHeightCalculation()}toggleHeightCalculation(){var e;this.fixed?(this.setCalculatedHeightProperty(),this.addResizeObserver()):(this.setCalculatedHeightProperty(),null==(e=this.resizeObserver)||e.disconnect(),this.resizeObserver=void 0)}disconnectedCallback(){super.disconnectedCallback()}updated(e){super.updated(e),e.has("fixed")&&this.toggleHeightCalculation()}onResize(){this.fixed&&this.setCalculatedHeightProperty()}addResizeObserver(){this.resizeObserver=new ResizeObserver((()=>{this.onResize()})),this.refHeaderElement&&this.resizeObserver.observe(this.refHeaderElement)}setCalculatedHeightProperty(){this.fixed&&this.refHeaderElement?document.documentElement.style.setProperty("--sd-3-
|
|
1
|
+
import{S as e,x as t,i as r,n as s,c as a}from"./solid-element.js";import{d as i}from"./debounce.js";import{c as d}from"./component.styles.js";var l=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=(e,t,r,s)=>{for(var a,i=s>1?void 0:s?n(t,r):t,d=e.length-1;d>=0;d--)(a=e[d])&&(i=(s?a(t,r,i):a(i))||i);return s&&i&&l(t,r,i),i};let h=class extends e{constructor(){super(...arguments),this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setCalculatedHeightProperty=this.setCalculatedHeightProperty.bind(this),this.addResizeObserver=this.addResizeObserver.bind(this)}firstUpdated(){this.toggleHeightCalculation()}toggleHeightCalculation(){var e;this.fixed?(this.setCalculatedHeightProperty(),this.addResizeObserver()):(this.setCalculatedHeightProperty(),null==(e=this.resizeObserver)||e.disconnect(),this.resizeObserver=void 0)}disconnectedCallback(){super.disconnectedCallback()}updated(e){super.updated(e),e.has("fixed")&&this.toggleHeightCalculation()}onResize(){this.fixed&&this.setCalculatedHeightProperty()}addResizeObserver(){this.resizeObserver=new ResizeObserver((()=>{this.onResize()})),this.refHeaderElement&&this.resizeObserver.observe(this.refHeaderElement)}setCalculatedHeightProperty(){this.fixed&&this.refHeaderElement?document.documentElement.style.setProperty("--sd-3-7-0-header-calculated-height",`${this.refHeaderElement.clientHeight}px`):document.documentElement.style.removeProperty("--sd-3-7-0-header-calculated-height")}render(){return t`<header class="w-full bg-white relative" role="banner" @slotchange="${this.handleSlotChange}"><div part="main" class="relative mx-auto my-0 box-border"><slot></slot></div></header>`}handleSlotChange(e){e.target.assignedElements().length>0&&(this.refHeaderElement=e.currentTarget,this.setCalculatedHeightProperty())}};h.styles=[e.styles,d,r`:host{display:block}:host([fixed]){position:fixed;left:var(--sd-spacing-0,0);top:var(--sd-spacing-0,0);width:100%}:host([fixed]) header::after{content:'';position:absolute;left:var(--sd-spacing-0,0);right:var(--sd-spacing-0,0);top:100%;height:var(--sd-spacing-2,.5rem);background:var(--gradient-vertical-black-40-transparent,linear-gradient(0deg,#18181800 50%,#18181866 100%))}[part=main]{width:var(--sd-3-7-0-header-inner-width);max-width:var(--sd-3-7-0-header-inner-max-width);padding:var(--sd-3-7-0-header-padding,12px 16px)}`],o([s({reflect:!0,type:Boolean})],h.prototype,"fixed",2),o([i(100)],h.prototype,"onResize",1),h=o([a("sd-3-7-0-header")],h);export{h as default};
|
|
@@ -8,4 +8,4 @@ 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
|
|
|
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,_=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-3-
|
|
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-3-7-0-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{S as t,x as e,i as r,n as s,c as o}from"./solid-element.js";import{requestInclude as i}from"./request2.js";import{w as a}from"./watch.js";import{c}from"./component.styles.js";var l=Object.defineProperty,n=Object.getOwnPropertyDescriptor,p=(t,e,r,s)=>{for(var o,i=s>1?void 0:s?n(e,r):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s?o(e,r,i):o(i))||i);return s&&i&&l(e,r,i),i};let d=class extends t{constructor(){super(...arguments),this.mode="cors",this.allowScripts=!1}executeScript(t){const e=document.createElement("script");[...t.attributes].forEach((t=>e.setAttribute(t.name,t.value))),e.textContent=t.textContent,t.parentNode.replaceChild(e,t)}async handleSrcChange(){try{const t=this.src,e=await i(t,this.mode);if(t!==this.src)return;if(!e.ok)return void this.emit("sd-error",{detail:{status:e.status}});this.innerHTML=e.html,this.allowScripts&&[...this.querySelectorAll("script")].forEach((t=>this.executeScript(t))),this.emit("sd-load")}catch{this.emit("sd-error",{detail:{status:-1}})}}render(){return e`<slot></slot>`}};d.styles=[c,r`:host{display:block}`],p([s()],d.prototype,"src",2),p([s()],d.prototype,"mode",2),p([s({attribute:"allow-scripts",type:Boolean})],d.prototype,"allowScripts",2),p([a("src")],d.prototype,"handleSrcChange",1),d=p([o("sd-3-
|
|
1
|
+
import{S as t,x as e,i as r,n as s,c as o}from"./solid-element.js";import{requestInclude as i}from"./request2.js";import{w as a}from"./watch.js";import{c}from"./component.styles.js";var l=Object.defineProperty,n=Object.getOwnPropertyDescriptor,p=(t,e,r,s)=>{for(var o,i=s>1?void 0:s?n(e,r):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s?o(e,r,i):o(i))||i);return s&&i&&l(e,r,i),i};let d=class extends t{constructor(){super(...arguments),this.mode="cors",this.allowScripts=!1}executeScript(t){const e=document.createElement("script");[...t.attributes].forEach((t=>e.setAttribute(t.name,t.value))),e.textContent=t.textContent,t.parentNode.replaceChild(e,t)}async handleSrcChange(){try{const t=this.src,e=await i(t,this.mode);if(t!==this.src)return;if(!e.ok)return void this.emit("sd-error",{detail:{status:e.status}});this.innerHTML=e.html,this.allowScripts&&[...this.querySelectorAll("script")].forEach((t=>this.executeScript(t))),this.emit("sd-load")}catch{this.emit("sd-error",{detail:{status:-1}})}}render(){return e`<slot></slot>`}};d.styles=[c,r`:host{display:block}`],p([s()],d.prototype,"src",2),p([s()],d.prototype,"mode",2),p([s({attribute:"allow-scripts",type:Boolean})],d.prototype,"allowScripts",2),p([a("src")],d.prototype,"handleSrcChange",1),d=p([o("sd-3-7-0-include")],d);export{d as default};
|
|
@@ -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";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-3-6-0-icon class="${m("text-neutral-500",v)}" library="system" name="closing-round"></sd-3-6-0-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-3-6-0-icon class="${m(y,b,v)}" library="system" name="eye"></sd-3-6-0-icon></slot>`:e`<slot name="hide-password-icon"><sd-3-6-0-icon class="${m(y,b,v)}" library="system" name="eye-crossed-out"></sd-3-6-0-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":e`<sd-3-6-0-icon class="${m(y,b,v)}" library="system" name="calendar"></sd-3-6-0-icon>`} ${"time"===this.type?e`<sd-3-6-0-icon class="${m(y,b,v)}" library="system" name="clock"></sd-3-6-0-icon>`:""} ${"search"===this.type?e`<button class="flex items-center" type="button" tabindex="-1"><sd-3-6-0-icon class="${m(y,b,v)}" library="system" name="magnifying-glass"></sd-3-6-0-icon></button>`:""} ${this.showInvalidStyle?e`<sd-3-6-0-icon part="invalid-icon" class="${m("text-error",b,v)}" library="system" name="risk"></sd-3-6-0-icon>`:""} ${this.showValidStyle&&this.styleOnValid?e`<sd-3-6-0-icon class="${m("text-success flex-shrink-0",b,v)}" library="system" name="status-check" part="valid-icon"></sd-3-6-0-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-3-6-0-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-3-7-0-icon class="${m("text-neutral-500",v)}" library="system" name="closing-round"></sd-3-7-0-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-3-7-0-icon class="${m(y,b,v)}" library="system" name="eye"></sd-3-7-0-icon></slot>`:e`<slot name="hide-password-icon"><sd-3-7-0-icon class="${m(y,b,v)}" library="system" name="eye-crossed-out"></sd-3-7-0-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":e`<sd-3-7-0-icon class="${m(y,b,v)}" library="system" name="calendar"></sd-3-7-0-icon>`} ${"time"===this.type?e`<sd-3-7-0-icon class="${m(y,b,v)}" library="system" name="clock"></sd-3-7-0-icon>`:""} ${"search"===this.type?e`<button class="flex items-center" type="button" tabindex="-1"><sd-3-7-0-icon class="${m(y,b,v)}" library="system" name="magnifying-glass"></sd-3-7-0-icon></button>`:""} ${this.showInvalidStyle?e`<sd-3-7-0-icon part="invalid-icon" class="${m("text-error",b,v)}" library="system" name="risk"></sd-3-7-0-icon>`:""} ${this.showValidStyle&&this.styleOnValid?e`<sd-3-7-0-icon class="${m("text-success flex-shrink-0",b,v)}" library="system" name="status-check" part="valid-icon"></sd-3-7-0-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-3-7-0-input")],x);export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as t,x as e,i as s,n as i,c as o}from"./solid-element.js";import{H as r}from"./slot.js";import{o as l}from"./if-defined.js";import{e as n}from"./query.js";import{t as a}from"./classix.js";var h=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=(t,e,s,i)=>{for(var o,r=i>1?void 0:i?d(e,s):e,l=t.length-1;l>=0;l--)(o=t[l])&&(r=(i?o(e,s,r):o(r))||r);return i&&r&&h(e,s,r),r};let c=class extends t{constructor(){super(...arguments),this.hasSlotController=new r(this,"[default]","icon-left","icon-right"),this.size="inherit",this.inverted=!1,this.standalone=!1,this.href=""}handleBlur(){this.emit("sd-blur")}handleFocus(){this.emit("sd-focus")}focus(t){this.button.focus(t)}blur(){this.button.blur()}render(){const t={label:this.hasSlotController.test("[default]"),"icon-left":this.hasSlotController.test("icon-left"),"icon-right":this.hasSlotController.test("icon-right")};return e`<a part="base" class="${a("inline",this.href?"cursor-pointer":"",{sm:"text-sm",lg:"text-base",inherit:""}[this.size],{disabled:this.inverted?"text-neutral-600":"text-neutral-500",enabled:this.inverted?"text-white hover:text-primary-200 active:text-primary-400 focus-visible:focus-outline-inverted":" text-primary hover:text-primary-500 active:text-primary-800 focus-visible:focus-outline"}[this.href?"enabled":"disabled"],this.standalone&&"flex items-start")}" href="${l(this.href||void 0)}" target="${l(this.target||void 0)}" download="${l(this.download||void 0)}" rel="${l(this.target?"noreferrer noopener":void 0)}" aria-disabled="${this.href?"false":"true"}" tabindex="${this.href?"0":"-1"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}"><slot name="icon-left" part="icon-left" class="${a("inline",t["icon-left"]&&(this.standalone?{sm:"mr-1",lg:"mr-2",inherit:"mr-[0.5em]"}[this.size]:"mr-[0.25em]"))}"></slot><span part="label" class="inline underline underline-offset-2"><slot></slot></span><slot name="icon-right" part="icon-right" class="${a("inline",t["icon-right"]&&(this.standalone?{sm:"ml-1",lg:"ml-2",inherit:"ml-[0.5em]"}[this.size]:"ml-[0.25em]"))}"></slot></a>`}};c.styles=[t.styles,s`::slotted(sd-3-
|
|
1
|
+
import{S as t,x as e,i as s,n as i,c as o}from"./solid-element.js";import{H as r}from"./slot.js";import{o as l}from"./if-defined.js";import{e as n}from"./query.js";import{t as a}from"./classix.js";var h=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=(t,e,s,i)=>{for(var o,r=i>1?void 0:i?d(e,s):e,l=t.length-1;l>=0;l--)(o=t[l])&&(r=(i?o(e,s,r):o(r))||r);return i&&r&&h(e,s,r),r};let c=class extends t{constructor(){super(...arguments),this.hasSlotController=new r(this,"[default]","icon-left","icon-right"),this.size="inherit",this.inverted=!1,this.standalone=!1,this.href=""}handleBlur(){this.emit("sd-blur")}handleFocus(){this.emit("sd-focus")}focus(t){this.button.focus(t)}blur(){this.button.blur()}render(){const t={label:this.hasSlotController.test("[default]"),"icon-left":this.hasSlotController.test("icon-left"),"icon-right":this.hasSlotController.test("icon-right")};return e`<a part="base" class="${a("inline",this.href?"cursor-pointer":"",{sm:"text-sm",lg:"text-base",inherit:""}[this.size],{disabled:this.inverted?"text-neutral-600":"text-neutral-500",enabled:this.inverted?"text-white hover:text-primary-200 active:text-primary-400 focus-visible:focus-outline-inverted":" text-primary hover:text-primary-500 active:text-primary-800 focus-visible:focus-outline"}[this.href?"enabled":"disabled"],this.standalone&&"flex items-start")}" href="${l(this.href||void 0)}" target="${l(this.target||void 0)}" download="${l(this.download||void 0)}" rel="${l(this.target?"noreferrer noopener":void 0)}" aria-disabled="${this.href?"false":"true"}" tabindex="${this.href?"0":"-1"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}"><slot name="icon-left" part="icon-left" class="${a("inline",t["icon-left"]&&(this.standalone?{sm:"mr-1",lg:"mr-2",inherit:"mr-[0.5em]"}[this.size]:"mr-[0.25em]"))}"></slot><span part="label" class="inline underline underline-offset-2"><slot></slot></span><slot name="icon-right" part="icon-right" class="${a("inline",t["icon-right"]&&(this.standalone?{sm:"ml-1",lg:"ml-2",inherit:"ml-[0.5em]"}[this.size]:"ml-[0.25em]"))}"></slot></a>`}};c.styles=[t.styles,s`::slotted(sd-3-7-0-icon){font-size:1.25em;margin-bottom:-.25em}:host([size=sm][standalone]) ::slotted(sd-3-7-0-icon){font-size:var(--sd-font-size-base,1rem)}:host([size=lg][standalone]) ::slotted(sd-3-7-0-icon){font-size:var(--sd-font-size-xl,1.5rem)}`],f([n("a")],c.prototype,"button",2),f([i({reflect:!0})],c.prototype,"size",2),f([i({type:Boolean,reflect:!0})],c.prototype,"inverted",2),f([i({type:Boolean,reflect:!0})],c.prototype,"standalone",2),f([i()],c.prototype,"href",2),f([i()],c.prototype,"target",2),f([i()],c.prototype,"download",2),c=f([o("sd-3-7-0-link")],c);export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as t,b as e,x as a,n as i,c as r}from"./solid-element.js";import{t as s}from"./classix.js";var l=Object.defineProperty,c=Object.getOwnPropertyDescriptor,n=(t,e,a,i)=>{for(var r,s=i>1?void 0:i?c(e,a):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(i?r(e,a,s):r(s))||s);return i&&s&&l(e,a,s),s};let o=class extends t{constructor(){super(...arguments),this.variant="main",this.state="default",this.animated=!1,this.marker={cluster:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><circle cx="25" cy="25" opacity="1" r="20"/><circle cx="25" cy="25" opacity=".3" r="25"/></svg>`,main:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 75"><path fill-rule="evenodd" d="M51 49A29 29 0 0 0 30 0 29 29 0 0 0 9 49l21 22 21-22ZM40 28a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z" clip-rule="evenodd"/></svg>`,place:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 75"><path fill-rule="evenodd" d="M51 49A29 29 0 0 0 30 0 29 29 0 0 0 9 49l21 22 21-22Z" clip-rule="evenodd"/></svg>`}}render(){return a`<div tabindex="0" class="${s("flex justify-center w-[calc(theme(width.12)*var(--map-marker-scaling,1))] focus:outline-primary focus:outline-offset-2","cluster"===this.variant?"h-[calc(theme(height.12)*var(--map-marker-scaling,1))]":"h-[calc(theme(height.16)*var(--map-marker-scaling,1))]")}"><div class="${s("inline-flex",this.animated&&("main"===this.variant||"place"===this.variant)&&"animate-bounce-once","cluster"===this.variant&&"hover"===this.state&&"scale-110 fill-primary-500","main"===this.variant&&"hover"===this.state&&"fill-accent-550","main"===this.variant&&"active"===this.state&&"fill-accent-700","place"===this.variant&&"default"===this.state&&"fill-white","place"===this.variant&&"hover"===this.state&&"fill-primary-100","place"===this.variant&&"active"===this.state&&"fill-primary-200",{cluster:"fill-primary transition-all duration-200 ease-in-out hover:scale-110 hover:fill-primary-500",main:"fill-accent *:drop-shadow-md hover:fill-accent-550 active:fill-accent-700",place:"hover:fill-primary-100 *:drop-shadow-md"}[this.variant])}">${this.marker[this.variant]}</div><div class="${s("absolute self-center pointer-events-none",{cluster:"text-white text-[calc(theme(fontSize.sm)*var(--map-marker-scaling,1))]",main:"",place:"text-[calc(theme(fontSize.3xl)*var(--map-marker-scaling,1))]"}[this.variant])}"><slot></slot></div></div>`}};n([i({reflect:!0})],o.prototype,"variant",2),n([i({reflect:!0})],o.prototype,"state",2),n([i({type:Boolean,reflect:!0})],o.prototype,"animated",2),o=n([r("sd-3-
|
|
1
|
+
import{S as t,b as e,x as a,n as i,c as r}from"./solid-element.js";import{t as s}from"./classix.js";var l=Object.defineProperty,c=Object.getOwnPropertyDescriptor,n=(t,e,a,i)=>{for(var r,s=i>1?void 0:i?c(e,a):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(i?r(e,a,s):r(s))||s);return i&&s&&l(e,a,s),s};let o=class extends t{constructor(){super(...arguments),this.variant="main",this.state="default",this.animated=!1,this.marker={cluster:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><circle cx="25" cy="25" opacity="1" r="20"/><circle cx="25" cy="25" opacity=".3" r="25"/></svg>`,main:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 75"><path fill-rule="evenodd" d="M51 49A29 29 0 0 0 30 0 29 29 0 0 0 9 49l21 22 21-22ZM40 28a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z" clip-rule="evenodd"/></svg>`,place:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 75"><path fill-rule="evenodd" d="M51 49A29 29 0 0 0 30 0 29 29 0 0 0 9 49l21 22 21-22Z" clip-rule="evenodd"/></svg>`}}render(){return a`<div tabindex="0" class="${s("flex justify-center w-[calc(theme(width.12)*var(--map-marker-scaling,1))] focus:outline-primary focus:outline-offset-2","cluster"===this.variant?"h-[calc(theme(height.12)*var(--map-marker-scaling,1))]":"h-[calc(theme(height.16)*var(--map-marker-scaling,1))]")}"><div class="${s("inline-flex",this.animated&&("main"===this.variant||"place"===this.variant)&&"animate-bounce-once","cluster"===this.variant&&"hover"===this.state&&"scale-110 fill-primary-500","main"===this.variant&&"hover"===this.state&&"fill-accent-550","main"===this.variant&&"active"===this.state&&"fill-accent-700","place"===this.variant&&"default"===this.state&&"fill-white","place"===this.variant&&"hover"===this.state&&"fill-primary-100","place"===this.variant&&"active"===this.state&&"fill-primary-200",{cluster:"fill-primary transition-all duration-200 ease-in-out hover:scale-110 hover:fill-primary-500",main:"fill-accent *:drop-shadow-md hover:fill-accent-550 active:fill-accent-700",place:"hover:fill-primary-100 *:drop-shadow-md"}[this.variant])}">${this.marker[this.variant]}</div><div class="${s("absolute self-center pointer-events-none",{cluster:"text-white text-[calc(theme(fontSize.sm)*var(--map-marker-scaling,1))]",main:"",place:"text-[calc(theme(fontSize.3xl)*var(--map-marker-scaling,1))]"}[this.variant])}"><slot></slot></div></div>`}};n([i({reflect:!0})],o.prototype,"variant",2),n([i({reflect:!0})],o.prototype,"state",2),n([i({type:Boolean,reflect:!0})],o.prototype,"animated",2),o=n([r("sd-3-7-0-map-marker")],o);export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as t,i as e,n as i,c as s}from"./solid-element.js";import{H as o}from"./slot.js";import{s as r,n as l}from"./static.js";import{o as a}from"./if-defined.js";import{c as n}from"./component.styles.js";import{t as d}from"./classix.js";var h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?c(e,i):e,l=t.length-1;l>=0;l--)(o=t[l])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&h(e,i,r),r};let u=class extends t{constructor(){super(...arguments),this.hasSlotController=new o(this,"[default]","description","children"),this.current=!1,this.disabled=!1,this.size="base",this.vertical=!1,this.chevron=!1,this.indented=!1,this.relaxed=!1,this.divider=!1,this.open=!1}isButton(){return!this.href&&!this.hasSlotController.test("children")}isLink(){return!!this.href}isAccordion(){return!this.href&&this.hasSlotController.test("children")}handleClickButton(t){this.disabled&&(t.preventDefault(),t.stopPropagation())}handleClickSummary(t){t.preventDefault(),t.stopPropagation(),this.disabled||(this.open?this.hideDetails():this.showDetails())}hideDetails(){this.open=!1,this.emit("sd-hide",{cancelable:!0})}showDetails(){this.open=!0,this.emit("sd-show",{cancelable:!0})}calculatePaddingX(){return this.relaxed&&this.indented?"pl-8 pr-4":this.relaxed?"px-4":this.indented?"pl-4":""}render(){const t=this.isLink(),e=this.isButton(),i=this.isAccordion(),s=(this.hasSlotController.test("[default]"),this.hasSlotController.test("main"),this.hasSlotController.test("description")),o=this.hasSlotController.test("children"),n=t?r`a`:i?r`summary`:r`button`,h=this.vertical?"pb-3":"pb-2",c=l`<${n} part="base" class="${d("px-4 hover:bg-neutral-200 group transition-all min-h-[48px] cursor-pointer relative focus-visible:focus-outline",{base:"text-base",lg:"text-lg",sm:"text-[14px]"}[this.size],this.disabled?"text-neutral-500 pointer-events-none":"text-primary",i?"flex flex-col":"inline-block w-full",this.divider&&this.vertical&&"mt-[1px]")}" aria-controls="${a(i?"navigation-item-details":void 0)}" aria-current="${a(this.current?"page":void 0)}" aria-disabled="${this.disabled}" ?disabled="${a(e?this.disabled:void 0)}" href="${a(t?this.href:void 0)}" target="${a(t?this.target:void 0)}" download="${a(t?this.download:void 0)}" rel="${a(t&&this.target?"noreferrer noopener":void 0)}" role="${t?"link":"button"}" tabindex="${this.disabled?"-1":"0"}" @click="${i?this.handleClickSummary:e?this.handleClickButton:void 0}"><div part="current-indicator" class="${d("absolute left-0 pointer-events-none transition-all duration-150",this.vertical?"w-1 h-[calc(100%-16px)] top-2 group-hover:h-full group-hover:top-0":"h-1 w-full bottom-0",this.current?"bg-accent":"bg-transparent",this.disabled&&"bg-neutral-500")}"></div><span part="content-area" class="${d("relative pt-3 inline-flex justify-between items-center",i?"grow":"w-full",s?"pb-1":h,this.calculatePaddingX())}">${this.divider&&this.vertical?l`<sd-3-
|
|
1
|
+
import{S as t,i as e,n as i,c as s}from"./solid-element.js";import{H as o}from"./slot.js";import{s as r,n as l}from"./static.js";import{o as a}from"./if-defined.js";import{c as n}from"./component.styles.js";import{t as d}from"./classix.js";var h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?c(e,i):e,l=t.length-1;l>=0;l--)(o=t[l])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&h(e,i,r),r};let u=class extends t{constructor(){super(...arguments),this.hasSlotController=new o(this,"[default]","description","children"),this.current=!1,this.disabled=!1,this.size="base",this.vertical=!1,this.chevron=!1,this.indented=!1,this.relaxed=!1,this.divider=!1,this.open=!1}isButton(){return!this.href&&!this.hasSlotController.test("children")}isLink(){return!!this.href}isAccordion(){return!this.href&&this.hasSlotController.test("children")}handleClickButton(t){this.disabled&&(t.preventDefault(),t.stopPropagation())}handleClickSummary(t){t.preventDefault(),t.stopPropagation(),this.disabled||(this.open?this.hideDetails():this.showDetails())}hideDetails(){this.open=!1,this.emit("sd-hide",{cancelable:!0})}showDetails(){this.open=!0,this.emit("sd-show",{cancelable:!0})}calculatePaddingX(){return this.relaxed&&this.indented?"pl-8 pr-4":this.relaxed?"px-4":this.indented?"pl-4":""}render(){const t=this.isLink(),e=this.isButton(),i=this.isAccordion(),s=(this.hasSlotController.test("[default]"),this.hasSlotController.test("main"),this.hasSlotController.test("description")),o=this.hasSlotController.test("children"),n=t?r`a`:i?r`summary`:r`button`,h=this.vertical?"pb-3":"pb-2",c=l`<${n} part="base" class="${d("px-4 hover:bg-neutral-200 group transition-all min-h-[48px] cursor-pointer relative focus-visible:focus-outline",{base:"text-base",lg:"text-lg",sm:"text-[14px]"}[this.size],this.disabled?"text-neutral-500 pointer-events-none":"text-primary",i?"flex flex-col":"inline-block w-full",this.divider&&this.vertical&&"mt-[1px]")}" aria-controls="${a(i?"navigation-item-details":void 0)}" aria-current="${a(this.current?"page":void 0)}" aria-disabled="${this.disabled}" ?disabled="${a(e?this.disabled:void 0)}" href="${a(t?this.href:void 0)}" target="${a(t?this.target:void 0)}" download="${a(t?this.download:void 0)}" rel="${a(t&&this.target?"noreferrer noopener":void 0)}" role="${t?"link":"button"}" tabindex="${this.disabled?"-1":"0"}" @click="${i?this.handleClickSummary:e?this.handleClickButton:void 0}"><div part="current-indicator" class="${d("absolute left-0 pointer-events-none transition-all duration-150",this.vertical?"w-1 h-[calc(100%-16px)] top-2 group-hover:h-full group-hover:top-0":"h-1 w-full bottom-0",this.current?"bg-accent":"bg-transparent",this.disabled&&"bg-neutral-500")}"></div><span part="content-area" class="${d("relative pt-3 inline-flex justify-between items-center",i?"grow":"w-full",s?"pb-1":h,this.calculatePaddingX())}">${this.divider&&this.vertical?l`<sd-3-7-0-divider part="divider" class="${d("w-full transition-all absolute -top-[1px] left-0",this.calculatePaddingX())}"></sd-3-7-0-divider>`:""} <span part="content-container" class="inline-flex items-center flex-auto"><slot part="content" class="inline"></slot></span>${(this.chevron||o)&&this.vertical?l`<sd-3-7-0-icon name="chevron-down" part="chevron" library="system" color="currentColor" class="${d("h-6 w-6 ml-2 transition-all",i?this.open?"rotate-180":"rotate-0":"rotate-[270deg]")}"></sd-3-7-0-icon>`:""} </span>${s&&this.vertical?l`<slot name="description" part="description" class="${d("inline-block text-sm text-left text-black",i?"grow":"w-full",h,this.calculatePaddingX())}"></slot>`:""}</${n}>`;return i?l`<details part="details" id="navigation-item-details" ?open="${this.open}" class="relative flex">${c}<slot name="children"></slot></details>`:l`${c}`}};u.styles=[n,t.styles,e`:host{position:relative;box-sizing:border-box;display:inline-block}:host([vertical]){display:block}details summary::-webkit-details-marker{display:none}`],p([i({reflect:!0})],u.prototype,"href",2),p([i()],u.prototype,"target",2),p([i()],u.prototype,"download",2),p([i({type:Boolean,reflect:!0})],u.prototype,"current",2),p([i({type:Boolean,reflect:!0})],u.prototype,"disabled",2),p([i({reflect:!0})],u.prototype,"size",2),p([i({type:Boolean,reflect:!0})],u.prototype,"vertical",2),p([i({type:Boolean,reflect:!0})],u.prototype,"chevron",2),p([i({type:Boolean,reflect:!0})],u.prototype,"indented",2),p([i({type:Boolean,reflect:!0})],u.prototype,"relaxed",2),p([i({type:Boolean,reflect:!0})],u.prototype,"divider",2),p([i({type:Boolean,reflect:!0})],u.prototype,"open",2),u=p([s("sd-3-7-0-navigation-item")],u);export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as t,a as i,w as e}from"./event.js";import{S as s,x as o,i as a,n as r,c as n}from"./solid-element.js";import{g as d,s as l}from"./animation-registry.js";import{L as c}from"./solid-components2.js";import{e as h}from"./query.js";import{w as p}from"./watch.js";import{c as m}from"./component.styles.js";import{t as u}from"./classix.js";var f=Object.defineProperty,y=Object.getOwnPropertyDescriptor,b=(t,i,e,s)=>{for(var o,a=s>1?void 0:s?y(i,e):i,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(s?o(i,e,a):o(a))||a);return s&&a&&f(i,e,a),a};const w=Object.assign(document.createElement("div"),{className:"sd-toast-stack sd-toast-stack--top-right"}),g=Object.assign(document.createElement("div"),{className:"sd-toast-stack sd-toast-stack--bottom-center"});let v=class extends s{constructor(){super(...arguments),this.localize=new c(this),this.open=!1,this.closable=!1,this.variant="info",this.toastStack="top-right",this.duration=1/0,this.durationIndicator=!1,this.remainingDuration=this.duration,this.startTime=Date.now()}firstUpdated(){this.base.hidden=!this.open}startAutoHide(){clearTimeout(this.autoHideTimeout),this.startTime=Date.now(),this.remainingDuration=this.duration,this.open&&this.duration<1/0&&(this.autoHideTimeout=window.setTimeout((()=>this.hide()),this.duration))}onHover(){clearTimeout(this.autoHideTimeout),this.duration<1/0&&(this.remainingDuration-=Date.now()-this.startTime)}onHoverEnd(){this.startTime=Date.now(),clearTimeout(this.autoHideTimeout),this.open&&this.duration<1/0&&(this.autoHideTimeout=window.setTimeout((()=>{this.hide()}),this.remainingDuration))}handleCloseClick(){this.hide()}async handleOpenChange(){if(this.open){this.emit("sd-show"),this.duration<1/0&&this.startAutoHide(),await t(this.base),this.base.hidden=!1;const{keyframes:e,options:s}=d(this,"notification.show",{dir:this.localize.dir()});await i(this.base,e,s),this.emit("sd-after-show")}else{this.emit("sd-hide"),clearTimeout(this.autoHideTimeout),await t(this.base);const{keyframes:e,options:s}=d(this,"notification.hide",{dir:this.localize.dir()});await i(this.base,e,s),this.base.hidden=!0,this.emit("sd-after-hide")}}handleDurationChange(){this.startAutoHide()}async show(){if(!this.open)return this.open=!0,e(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,e(this,"sd-after-hide")}async toast(){return new Promise((t=>{const i="bottom-center"===this.toastStack?g:w;null===i.parentElement&&document.body.append(i),i.appendChild(this),requestAnimationFrame((()=>{this.clientWidth,this.show()})),this.addEventListener("sd-after-hide",(()=>{i.removeChild(this),t(),null===i.querySelector("sd-3-
|
|
1
|
+
import{s as t,a as i,w as e}from"./event.js";import{S as s,x as o,i as a,n as r,c as n}from"./solid-element.js";import{g as d,s as l}from"./animation-registry.js";import{L as c}from"./solid-components2.js";import{e as h}from"./query.js";import{w as p}from"./watch.js";import{c as m}from"./component.styles.js";import{t as u}from"./classix.js";var f=Object.defineProperty,y=Object.getOwnPropertyDescriptor,b=(t,i,e,s)=>{for(var o,a=s>1?void 0:s?y(i,e):i,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(s?o(i,e,a):o(a))||a);return s&&a&&f(i,e,a),a};const w=Object.assign(document.createElement("div"),{className:"sd-toast-stack sd-toast-stack--top-right"}),g=Object.assign(document.createElement("div"),{className:"sd-toast-stack sd-toast-stack--bottom-center"});let v=class extends s{constructor(){super(...arguments),this.localize=new c(this),this.open=!1,this.closable=!1,this.variant="info",this.toastStack="top-right",this.duration=1/0,this.durationIndicator=!1,this.remainingDuration=this.duration,this.startTime=Date.now()}firstUpdated(){this.base.hidden=!this.open}startAutoHide(){clearTimeout(this.autoHideTimeout),this.startTime=Date.now(),this.remainingDuration=this.duration,this.open&&this.duration<1/0&&(this.autoHideTimeout=window.setTimeout((()=>this.hide()),this.duration))}onHover(){clearTimeout(this.autoHideTimeout),this.duration<1/0&&(this.remainingDuration-=Date.now()-this.startTime)}onHoverEnd(){this.startTime=Date.now(),clearTimeout(this.autoHideTimeout),this.open&&this.duration<1/0&&(this.autoHideTimeout=window.setTimeout((()=>{this.hide()}),this.remainingDuration))}handleCloseClick(){this.hide()}async handleOpenChange(){if(this.open){this.emit("sd-show"),this.duration<1/0&&this.startAutoHide(),await t(this.base),this.base.hidden=!1;const{keyframes:e,options:s}=d(this,"notification.show",{dir:this.localize.dir()});await i(this.base,e,s),this.emit("sd-after-show")}else{this.emit("sd-hide"),clearTimeout(this.autoHideTimeout),await t(this.base);const{keyframes:e,options:s}=d(this,"notification.hide",{dir:this.localize.dir()});await i(this.base,e,s),this.base.hidden=!0,this.emit("sd-after-hide")}}handleDurationChange(){this.startAutoHide()}async show(){if(!this.open)return this.open=!0,e(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,e(this,"sd-after-hide")}async toast(){return new Promise((t=>{const i="bottom-center"===this.toastStack?g:w;null===i.parentElement&&document.body.append(i),i.appendChild(this),requestAnimationFrame((()=>{this.clientWidth,this.show()})),this.addEventListener("sd-after-hide",(()=>{i.removeChild(this),t(),null===i.querySelector("sd-3-7-0-notification")&&i.remove()}),{once:!0})}))}render(){return o`<div part="base" class="${u("w-full overflow-hidden flex items-stretch relative m-2")}" role="alert" id="notification" aria-hidden="${this.open?"false":"true"}" @mouseenter="${this.onHover}" @mouseleave="${this.onHoverEnd}"><slot name="icon" part="icon" class="${u("min-w-min flex items-center px-3 justify-center",{info:"bg-info",success:"bg-success",warning:"bg-warning",error:"bg-error"}[this.variant])}"><sd-3-7-0-icon name="${{info:"info-circle",success:"confirm-circle",warning:"exclamation-circle",error:"warning"}[this.variant]||""}" library="system" class="h-6 w-6 text-white"></sd-3-7-0-icon></slot><div part="content" class="${u("h-full w-full p-1 gap-2 flex items-center justify-stretch bg-white","border-solid border-[1px] border-l-0 border-neutral-400")}"><slot part="message" class="block w-full pl-3 py-2" aria-live="polite"></slot>${this.closable?o`<sd-3-7-0-button size="md" variant="tertiary" part="close-button" class="ml-auto flex flex-[0_0_auto] items-stretch" label="${this.localize.term("close")}" @click="${this.handleCloseClick}"><sd-3-7-0-icon name="close" library="system" color="currentColor"></sd-3-7-0-icon></sd-3-7-0-button>`:""}</div>${this.durationIndicator?o`<div part="duration-indicator__elapsed" id="duration-indicator__elapsed" style="${`animation-duration: ${this.duration}ms`}" class="${u("absolute w-0 h-[2px] bottom-0 bg-primary z-10 animate-grow")}"></div><div part="duration-indicator__total" class="w-full h-[2px] bottom-0 absolute bg-neutral-400"></div>`:""}</div>`}};v.styles=[m,s.styles,a`:host{display:contents}#notification:hover #duration-indicator__elapsed{animation-play-state:paused!important}`],b([h('[part~="base"]')],v.prototype,"base",2),b([r({type:Boolean,reflect:!0})],v.prototype,"open",2),b([r({type:Boolean,reflect:!0})],v.prototype,"closable",2),b([r({reflect:!0})],v.prototype,"variant",2),b([r({reflect:!0,attribute:"toast-stack"})],v.prototype,"toastStack",2),b([r({type:Number})],v.prototype,"duration",2),b([r({type:Boolean,reflect:!0,attribute:"duration-indicator"})],v.prototype,"durationIndicator",2),b([p("open",{waitUntilFirstUpdate:!0})],v.prototype,"handleOpenChange",1),b([p("duration")],v.prototype,"handleDurationChange",1),v=b([n("sd-3-7-0-notification")],v),l("notification.show",{keyframes:[{opacity:0,scale:.8},{opacity:1,scale:1}],options:{duration:250,easing:"ease"}}),l("notification.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.8}],options:{duration:250,easing:"ease"}});export{v 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{
|
|
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{r}from"./state.js";import{e as i}from"./query.js";import{w as n}from"./watch.js";import{c as h}from"./component.styles.js";import{t as c}from"./classix.js";var d=Object.defineProperty,p=Object.getOwnPropertyDescriptor,u=(e,t,s,l)=>{for(var a,o=l>1?void 0:l?p(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&&d(t,s,o),o};let b=class extends e{constructor(){super(...arguments),this.hasSlotController=new o(this,"default","left","right"),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="${c("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="${c("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="${c("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-3-7-0-icon part="checked-icon" class="text-white w-3 h-3" library="system" name="status-check"></sd-3-7-0-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>`}};b.styles=[h,e.styles,s`:host{position:relative;display:block;width:100%;outline:2px solid transparent!important;outline-offset:2px!important}`],u([i('[part="base"]')],b.prototype,"defaultSlot",2),u([r()],b.prototype,"current",2),u([r()],b.prototype,"selected",2),u([r()],b.prototype,"hasHover",2),u([l({reflect:!0})],b.prototype,"size",2),u([l({type:Boolean,reflect:!0})],b.prototype,"checkbox",2),u([l({type:Boolean,reflect:!0})],b.prototype,"disabled",2),u([l({reflect:!0})],b.prototype,"value",2),u([n("disabled")],b.prototype,"handleDisabledChange",1),u([n("selected")],b.prototype,"handleSelectedChange",1),u([n("value")],b.prototype,"handleValueChange",1),b=u([a("sd-3-7-0-option")],b);export{b 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,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-3-6-0-popup")],pt);export{pt 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-3-7-0-popup")],pt);export{pt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as t,x as e,i as s,n as r,c as o}from"./solid-element.js";import{H as i}from"./slot.js";import{o as a}from"./if-defined.js";import{r as n}from"./state.js";import{e as d}from"./query.js";import{w as l}from"./watch.js";import{c as u}from"./component.styles.js";import{t as h}from"./classix.js";var c=Object.defineProperty,b=Object.getOwnPropertyDescriptor,p=(t,e,s,r)=>{for(var o,i=r>1?void 0:r?b(e,s):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,s,i):o(i))||i);return r&&i&&c(e,s,i),i};let m=class extends t{constructor(){super(...arguments),this.hasSlotController=new i(this,"[default]","icon"),this.hasFocus=!1,this.checked=!1,this.disabled=!1,this.size="lg"}connectedCallback(){super.connectedCallback(),this.setAttribute("role","presentation")}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleClick(t){if(this.disabled)return t.preventDefault(),void t.stopPropagation();this.checked=!0}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}focus(t){this.input.focus(t)}blur(){this.input.blur()}render(){const t=this.hasSlotController.test("[default]"),s=this.hasSlotController.test("icon"),r=`${this.size}-${t?"label":"no-label"}`;return e`<div part="base" role="presentation" class="relative"><button part="${"button"+(this.checked?" button--checked":"")}" role="radio" aria-checked="${this.checked}" class="${h("relative text-center border rounded-default transition-all ease-in-out duration-100 items-center justify-center focus-visible:focus-outline","sm"===this.size?"text-sm":"text-base",this.checked&&!this.disabled?"bg-primary border-primary text-white hover:bg-primary-500 hover:border-primary-500":this.disabled&&!this.checked?"border-neutral-500 text-neutral-500 hover:cursor-not-allowed":this.disabled&&this.checked?"bg-neutral-500 text-white hover:cursor-not-allowed":"bg-transparent text-primary border-primary hover:bg-primary-100 hover:border-primary-500 hover:text-primary-500 cursor-pointer",t&&"px-4",this.hasFocus&&"focused-class",t&&"button--has-label",s&&"button--has-icon flex gap-2",r)}" aria-disabled="${this.disabled}" type="button" value="${a(this.value)}" tabindex="${this.checked?"0":"-1"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" @click="${this.handleClick}"><slot name="icon" part="icon" class="${h(s&&"inline-flex relative items-center",{sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size])}" ?hidden="${!s}"></slot>${t?e`<slot part="label" class="button__label inline-flex relative items-center whitespace-nowrap"></slot>`:null}</button></div>`}};m.styles=[t.styles,u,s`:host{display:block;width:-moz-min-content;width:min-content}.hidden-input{all:unset;position:absolute;inset:var(--sd-spacing-0,0);z-index:-10;opacity:var(--sd-opacity-0,0);outline-style:dotted;outline-width:1px;outline-color:rgb(var(--sd-color-error,204 25 55) / 1)}.lg-label{height:var(--sd-spacing-12,3rem)}.lg-no-label{height:var(--sd-spacing-12,3rem);width:var(--sd-spacing-12,3rem)}.md-label{height:var(--sd-spacing-10,2.5rem)}.md-no-label{height:var(--sd-spacing-10,2.5rem);width:var(--sd-spacing-10,2.5rem)}.sm-label{height:var(--sd-spacing-8,2rem)}.sm-no-label{height:var(--sd-spacing-8,2rem);width:var(--sd-spacing-8,2rem)}:host(.sd-3-
|
|
1
|
+
import{S as t,x as e,i as s,n as r,c as o}from"./solid-element.js";import{H as i}from"./slot.js";import{o as a}from"./if-defined.js";import{r as n}from"./state.js";import{e as d}from"./query.js";import{w as l}from"./watch.js";import{c as u}from"./component.styles.js";import{t as h}from"./classix.js";var c=Object.defineProperty,b=Object.getOwnPropertyDescriptor,p=(t,e,s,r)=>{for(var o,i=r>1?void 0:r?b(e,s):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,s,i):o(i))||i);return r&&i&&c(e,s,i),i};let m=class extends t{constructor(){super(...arguments),this.hasSlotController=new i(this,"[default]","icon"),this.hasFocus=!1,this.checked=!1,this.disabled=!1,this.size="lg"}connectedCallback(){super.connectedCallback(),this.setAttribute("role","presentation")}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleClick(t){if(this.disabled)return t.preventDefault(),void t.stopPropagation();this.checked=!0}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}focus(t){this.input.focus(t)}blur(){this.input.blur()}render(){const t=this.hasSlotController.test("[default]"),s=this.hasSlotController.test("icon"),r=`${this.size}-${t?"label":"no-label"}`;return e`<div part="base" role="presentation" class="relative"><button part="${"button"+(this.checked?" button--checked":"")}" role="radio" aria-checked="${this.checked}" class="${h("relative text-center border rounded-default transition-all ease-in-out duration-100 items-center justify-center focus-visible:focus-outline","sm"===this.size?"text-sm":"text-base",this.checked&&!this.disabled?"bg-primary border-primary text-white hover:bg-primary-500 hover:border-primary-500":this.disabled&&!this.checked?"border-neutral-500 text-neutral-500 hover:cursor-not-allowed":this.disabled&&this.checked?"bg-neutral-500 text-white hover:cursor-not-allowed":"bg-transparent text-primary border-primary hover:bg-primary-100 hover:border-primary-500 hover:text-primary-500 cursor-pointer",t&&"px-4",this.hasFocus&&"focused-class",t&&"button--has-label",s&&"button--has-icon flex gap-2",r)}" aria-disabled="${this.disabled}" type="button" value="${a(this.value)}" tabindex="${this.checked?"0":"-1"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" @click="${this.handleClick}"><slot name="icon" part="icon" class="${h(s&&"inline-flex relative items-center",{sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size])}" ?hidden="${!s}"></slot>${t?e`<slot part="label" class="button__label inline-flex relative items-center whitespace-nowrap"></slot>`:null}</button></div>`}};m.styles=[t.styles,u,s`:host{display:block;width:-moz-min-content;width:min-content}.hidden-input{all:unset;position:absolute;inset:var(--sd-spacing-0,0);z-index:-10;opacity:var(--sd-opacity-0,0);outline-style:dotted;outline-width:1px;outline-color:rgb(var(--sd-color-error,204 25 55) / 1)}.lg-label{height:var(--sd-spacing-12,3rem)}.lg-no-label{height:var(--sd-spacing-12,3rem);width:var(--sd-spacing-12,3rem)}.md-label{height:var(--sd-spacing-10,2.5rem)}.md-no-label{height:var(--sd-spacing-10,2.5rem);width:var(--sd-spacing-10,2.5rem)}.sm-label{height:var(--sd-spacing-8,2rem)}.sm-no-label{height:var(--sd-spacing-8,2rem);width:var(--sd-spacing-8,2rem)}:host(.sd-3-7-0-button-group__button--first:not(.sd-3-7-0-button-group__button--last)) button{border-top-right-radius:var(--sd-border-radius-none,0);border-bottom-right-radius:var(--sd-border-radius-none,0)}:host(.sd-3-7-0-button-group__button--inner) button{border-radius:var(--sd-border-radius-none,0)}:host(.sd-3-7-0-button-group__button--last:not(.sd-3-7-0-button-group__button--first)) button{border-top-left-radius:var(--sd-border-radius-none,0);border-bottom-left-radius:var(--sd-border-radius-none,0)}:host(.sd-3-7-0-button-group__button:not(.sd-3-7-0-button-group__button--first)){margin-inline-start:-1px}:host(.sd-3-7-0-button-group__button--hover){z-index:10}:host(.sd-3-7-0-button-group__button--focus),:host(.sd-3-7-0-button-group__button[checked]){z-index:20}`],p([d(".button")],m.prototype,"input",2),p([d(".hidden-input")],m.prototype,"hiddenInput",2),p([n()],m.prototype,"hasFocus",2),p([r({type:Boolean,reflect:!0})],m.prototype,"checked",2),p([r()],m.prototype,"value",2),p([r({type:Boolean,reflect:!0})],m.prototype,"disabled",2),p([r({reflect:!0})],m.prototype,"size",2),p([l("disabled",{waitUntilFirstUpdate:!0})],m.prototype,"handleDisabledChange",1),m=p([o("sd-3-7-0-radio-button")],m);export{m as default};
|