@solid-design-system/components 2.11.7 → 2.11.8
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/custom-elements.json +1 -1
- package/dist/styles/solid-styles.css +1 -1
- package/dist/versioned-components/es/accordion-group.js +1 -1
- package/dist/versioned-components/es/accordion.js +1 -1
- package/dist/versioned-components/es/badge.js +1 -1
- package/dist/versioned-components/es/brandshape.js +1 -1
- package/dist/versioned-components/es/button.js +1 -1
- package/dist/versioned-components/es/carousel-item.js +1 -1
- package/dist/versioned-components/es/carousel.js +3 -3
- package/dist/versioned-components/es/checkbox-group.js +1 -1
- package/dist/versioned-components/es/checkbox.js +1 -1
- package/dist/versioned-components/es/dialog.js +1 -1
- package/dist/versioned-components/es/divider.js +1 -1
- package/dist/versioned-components/es/drawer.js +1 -1
- package/dist/versioned-components/es/dropdown.js +1 -1
- package/dist/versioned-components/es/form.js +1 -1
- package/dist/versioned-components/es/header.js +1 -1
- package/dist/versioned-components/es/icon.js +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/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/select.js +3 -3
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/switch.js +1 -1
- package/dist/versioned-components/es/tab-group.js +1 -1
- package/dist/versioned-components/es/tab-panel.js +1 -1
- package/dist/versioned-components/es/tab.js +1 -1
- package/dist/versioned-components/es/tag.js +1 -1
- package/dist/versioned-components/es/teaser-media.js +1 -1
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-components/es/textarea.js +1 -1
- package/dist/versioned-components/es/tooltip.js +2 -2
- package/dist/versioned-components/es/video.js +1 -1
- package/dist/versioned-package/_components/button-group/button-group.d.ts +1 -1
- package/dist/versioned-package/_components/button-group/button-group.js +11 -11
- package/dist/versioned-package/components/accordion/accordion.d.ts +1 -1
- package/dist/versioned-package/components/accordion/accordion.js +2 -2
- package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +1 -1
- package/dist/versioned-package/components/accordion-group/accordion-group.js +3 -3
- package/dist/versioned-package/components/badge/badge.d.ts +1 -1
- package/dist/versioned-package/components/badge/badge.js +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.d.ts +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.js +1 -1
- package/dist/versioned-package/components/button/button.d.ts +1 -1
- package/dist/versioned-package/components/button/button.js +4 -4
- package/dist/versioned-package/components/carousel/carousel.d.ts +1 -1
- package/dist/versioned-package/components/carousel/carousel.js +6 -6
- package/dist/versioned-package/components/carousel-item/carousel-item.d.ts +1 -1
- package/dist/versioned-package/components/carousel-item/carousel-item.js +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.d.ts +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.js +4 -4
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +5 -5
- package/dist/versioned-package/components/dialog/dialog.d.ts +1 -1
- package/dist/versioned-package/components/dialog/dialog.js +2 -2
- package/dist/versioned-package/components/divider/divider.d.ts +1 -1
- package/dist/versioned-package/components/divider/divider.js +2 -2
- package/dist/versioned-package/components/drawer/drawer.d.ts +1 -1
- package/dist/versioned-package/components/drawer/drawer.js +2 -2
- package/dist/versioned-package/components/dropdown/dropdown.d.ts +1 -1
- package/dist/versioned-package/components/dropdown/dropdown.js +8 -8
- package/dist/versioned-package/components/header/header.d.ts +1 -1
- package/dist/versioned-package/components/header/header.js +4 -4
- package/dist/versioned-package/components/icon/icon.d.ts +1 -1
- package/dist/versioned-package/components/icon/icon.js +1 -1
- package/dist/versioned-package/components/include/include.d.ts +1 -1
- package/dist/versioned-package/components/include/include.js +1 -1
- package/dist/versioned-package/components/input/input.d.ts +1 -1
- package/dist/versioned-package/components/input/input.js +4 -4
- package/dist/versioned-package/components/link/link.d.ts +1 -1
- package/dist/versioned-package/components/link/link.js +2 -2
- package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.js +3 -3
- package/dist/versioned-package/components/notification/notification.d.ts +1 -1
- package/dist/versioned-package/components/notification/notification.js +5 -5
- package/dist/versioned-package/components/option/option.d.ts +1 -1
- package/dist/versioned-package/components/option/option.js +2 -2
- package/dist/versioned-package/components/popup/popup.d.ts +1 -1
- package/dist/versioned-package/components/popup/popup.js +1 -1
- package/dist/versioned-package/components/radio/radio.d.ts +1 -1
- package/dist/versioned-package/components/radio/radio.js +2 -2
- package/dist/versioned-package/components/radio-button/radio-button.d.ts +1 -1
- package/dist/versioned-package/components/radio-button/radio-button.js +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.js +15 -15
- package/dist/versioned-package/components/select/select.d.ts +4 -4
- package/dist/versioned-package/components/select/select.js +28 -28
- package/dist/versioned-package/components/spinner/spinner.d.ts +1 -1
- package/dist/versioned-package/components/spinner/spinner.js +1 -1
- package/dist/versioned-package/components/switch/switch.d.ts +1 -1
- package/dist/versioned-package/components/switch/switch.js +2 -2
- package/dist/versioned-package/components/tab/tab.d.ts +1 -1
- package/dist/versioned-package/components/tab/tab.js +2 -2
- package/dist/versioned-package/components/tab-group/tab-group.d.ts +1 -1
- package/dist/versioned-package/components/tab-group/tab-group.js +15 -15
- package/dist/versioned-package/components/tab-panel/tab-panel.d.ts +1 -1
- package/dist/versioned-package/components/tab-panel/tab-panel.js +2 -2
- package/dist/versioned-package/components/tag/tag.d.ts +1 -1
- package/dist/versioned-package/components/tag/tag.js +2 -2
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/teaser-media/teaser-media.js +1 -1
- package/dist/versioned-package/components/textarea/textarea.d.ts +1 -1
- package/dist/versioned-package/components/textarea/textarea.js +3 -3
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +1 -1
- package/dist/versioned-package/components/tooltip/tooltip.js +5 -5
- package/dist/versioned-package/components/video/video.d.ts +1 -1
- package/dist/versioned-package/components/video/video.js +2 -2
- package/dist/versioned-package/internal/form.js +3 -3
- package/dist/versioned-package/styles/headline/headline.css.js +1 -1
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +37 -37
- package/dist/web-types.json +38 -38
- package/package.json +1 -1
|
@@ -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-2-11-
|
|
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-2-11-8-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-2-11-
|
|
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-2-11-8-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-2-11-7-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-2-11-7-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-2-11-7-icon class="${m("text-neutral-500",v)}" library="system" name="closing-round"></sd-2-11-7-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-2-11-7-icon class="${m(y,b,v)}" library="system" name="eye"></sd-2-11-7-icon></slot>`:e`<slot name="hide-password-icon"><sd-2-11-7-icon class="${m(y,b,v)}" library="system" name="eye-crossed-out"></sd-2-11-7-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":e`<sd-2-11-7-icon class="${m(y,b,v)}" library="system" name="calendar"></sd-2-11-7-icon>`} ${"time"===this.type?e`<sd-2-11-7-icon class="${m(y,b,v)}" library="system" name="clock"></sd-2-11-7-icon>`:""} ${this.showInvalidStyle?e`<sd-2-11-7-icon part="invalid-icon" class="${m("text-error",b,v)}" library="system" name="risk"></sd-2-11-7-icon>`:""} ${this.showValidStyle&&this.styleOnValid?e`<sd-2-11-7-icon class="${m("text-success flex-shrink-0",b,v)}" library="system" name="confirm" part="valid-icon"></sd-2-11-7-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-2-11-7-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-2-11-8-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-2-11-8-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-2-11-8-icon class="${m("text-neutral-500",v)}" library="system" name="closing-round"></sd-2-11-8-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-2-11-8-icon class="${m(y,b,v)}" library="system" name="eye"></sd-2-11-8-icon></slot>`:e`<slot name="hide-password-icon"><sd-2-11-8-icon class="${m(y,b,v)}" library="system" name="eye-crossed-out"></sd-2-11-8-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":e`<sd-2-11-8-icon class="${m(y,b,v)}" library="system" name="calendar"></sd-2-11-8-icon>`} ${"time"===this.type?e`<sd-2-11-8-icon class="${m(y,b,v)}" library="system" name="clock"></sd-2-11-8-icon>`:""} ${this.showInvalidStyle?e`<sd-2-11-8-icon part="invalid-icon" class="${m("text-error",b,v)}" library="system" name="risk"></sd-2-11-8-icon>`:""} ${this.showValidStyle&&this.styleOnValid?e`<sd-2-11-8-icon class="${m("text-success flex-shrink-0",b,v)}" library="system" name="confirm" part="valid-icon"></sd-2-11-8-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-2-11-8-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-2-11-
|
|
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-2-11-8-icon){font-size:1.25em;margin-bottom:-.25em}:host([size=sm][standalone]) ::slotted(sd-2-11-8-icon){font-size:var(--sd-font-size-base,1rem)}:host([size=lg][standalone]) ::slotted(sd-2-11-8-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-2-11-8-link")],c);export{c 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-2-11-
|
|
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-2-11-8-divider part="divider" class="${d("w-full transition-all absolute -top-[1px] left-0",this.calculatePaddingX())}"></sd-2-11-8-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-2-11-8-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-2-11-8-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-2-11-8-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-2-11-
|
|
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-2-11-8-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-2-11-8-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-2-11-8-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-2-11-8-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-2-11-8-icon name="close" library="system" color="currentColor"></sd-2-11-8-icon></sd-2-11-8-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-2-11-8-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{L as r}from"./solid-components2.js";import{r as i}from"./state.js";import{e as n}from"./query.js";import{w as h}from"./watch.js";import{c}from"./component.styles.js";import{t as d}from"./classix.js";var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,b=(e,t,s,l)=>{for(var a,o=l>1?void 0:l?u(t,s):t,r=e.length-1;r>=0;r--)(a=e[r])&&(o=(l?a(t,s,o):a(o))||o);return l&&o&&p(t,s,o),o};let f=class extends e{constructor(){super(...arguments),this.hasSlotController=new o(this,"default","left","right"),this.localize=new r(this),this.current=!1,this.selected=!1,this.hasHover=!1,this.size="lg",this.checkbox=!1,this.disabled=!1,this.value=""}connectedCallback(){super.connectedCallback(),this.setAttribute("role","option"),this.setAttribute("aria-selected","false")}handleDefaultSlotChange(){const e=this.getTextLabel();typeof this.cachedTextLabel>"u"?this.cachedTextLabel=e:e!==this.cachedTextLabel&&(this.cachedTextLabel=e,this.emit("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false")}handleValueChange(){this.value.includes(" ")&&(console.error("Option values cannot include a space. All spaces have been replaced with underscores.",this),this.value=this.value.replace(/ /g,"_"))}getTextLabel(){return(this.textContent??"").trim()}render(){this.hasSlotController.test("default");const e=this.hasSlotController.test("left"),s=this.hasSlotController.test("right");return t`<div part="base" class="${d("px-4 flex items-center w-full transition-all text-left text-base relative text-black",{sm:"text-sm py-1",md:"text-base py-2",lg:"text-base py-3"}[this.size],this.disabled?"text-neutral-500 cursor-not-allowed":"cursor-pointer",this.hasHover&&!this.disabled?"bg-neutral-200":"",this.current&&"bg-neutral-200")}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><span class="${d("absolute w-full left-0 top-0 pointer-events-none transition-all duration-150 border-l-4 h-[calc(100%-8px)]",this.selected&&!this.checkbox?"border-accent":"border-transparent",this.disabled&&"border-neutral-500 top-1",!this.disabled&&this.hasHover?"h-full top-0":"top-1")}"></span> ${this.checkbox?t`<span id="control" part="control ${this.selected?" control--checked":"control--unchecked"}" class="${d("relative flex flex-initial items-center justify-center border rounded-sm h-4 w-4 mr-2",this.disabled?"border-neutral-500":this.selected?"bg-accent border-accent":"border-neutral-800")}">${this.selected?t`<sd-2-11-
|
|
1
|
+
import"./icon.js";import{S as e,x as t,i as s,n as l,c as a}from"./solid-element.js";import{H as o}from"./slot.js";import{L as r}from"./solid-components2.js";import{r as i}from"./state.js";import{e as n}from"./query.js";import{w as h}from"./watch.js";import{c}from"./component.styles.js";import{t as d}from"./classix.js";var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,b=(e,t,s,l)=>{for(var a,o=l>1?void 0:l?u(t,s):t,r=e.length-1;r>=0;r--)(a=e[r])&&(o=(l?a(t,s,o):a(o))||o);return l&&o&&p(t,s,o),o};let f=class extends e{constructor(){super(...arguments),this.hasSlotController=new o(this,"default","left","right"),this.localize=new r(this),this.current=!1,this.selected=!1,this.hasHover=!1,this.size="lg",this.checkbox=!1,this.disabled=!1,this.value=""}connectedCallback(){super.connectedCallback(),this.setAttribute("role","option"),this.setAttribute("aria-selected","false")}handleDefaultSlotChange(){const e=this.getTextLabel();typeof this.cachedTextLabel>"u"?this.cachedTextLabel=e:e!==this.cachedTextLabel&&(this.cachedTextLabel=e,this.emit("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false")}handleValueChange(){this.value.includes(" ")&&(console.error("Option values cannot include a space. All spaces have been replaced with underscores.",this),this.value=this.value.replace(/ /g,"_"))}getTextLabel(){return(this.textContent??"").trim()}render(){this.hasSlotController.test("default");const e=this.hasSlotController.test("left"),s=this.hasSlotController.test("right");return t`<div part="base" class="${d("px-4 flex items-center w-full transition-all text-left text-base relative text-black",{sm:"text-sm py-1",md:"text-base py-2",lg:"text-base py-3"}[this.size],this.disabled?"text-neutral-500 cursor-not-allowed":"cursor-pointer",this.hasHover&&!this.disabled?"bg-neutral-200":"",this.current&&"bg-neutral-200")}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><span class="${d("absolute w-full left-0 top-0 pointer-events-none transition-all duration-150 border-l-4 h-[calc(100%-8px)]",this.selected&&!this.checkbox?"border-accent":"border-transparent",this.disabled&&"border-neutral-500 top-1",!this.disabled&&this.hasHover?"h-full top-0":"top-1")}"></span> ${this.checkbox?t`<span id="control" part="control ${this.selected?" control--checked":"control--unchecked"}" class="${d("relative flex flex-initial items-center justify-center border rounded-sm h-4 w-4 mr-2",this.disabled?"border-neutral-500":this.selected?"bg-accent border-accent":"border-neutral-800")}">${this.selected?t`<sd-2-11-8-icon part="checked-icon" class="text-white w-3 h-3" library="system" name="status-hook"></sd-2-11-8-icon>`:""}</span>`:""} ${e?t`<slot name="left" part="left" class="inline-flex mr-2"></slot>`:""}<slot part="label" class="inline-block flex-grow" @slotchange="${this.handleDefaultSlotChange}"></slot>${s?t`<slot name="right" part="right" class="inline-flex ml-2"></slot>`:""}</div>`}};f.styles=[c,e.styles,s`:host{position:relative;display:block;width:100%;outline:2px solid transparent!important;outline-offset:2px!important}`],b([n('[part="base"]')],f.prototype,"defaultSlot",2),b([i()],f.prototype,"current",2),b([i()],f.prototype,"selected",2),b([i()],f.prototype,"hasHover",2),b([l({reflect:!0})],f.prototype,"size",2),b([l({type:Boolean,reflect:!0})],f.prototype,"checkbox",2),b([l({type:Boolean,reflect:!0})],f.prototype,"disabled",2),b([l({reflect:!0})],f.prototype,"value",2),b([h("disabled")],f.prototype,"handleDisabledChange",1),b([h("selected")],f.prototype,"handleSelectedChange",1),b([h("value")],f.prototype,"handleValueChange",1),f=b([a("sd-2-11-8-option")],f);export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as t,x as e,i as n,n as o,c as i}from"./solid-element.js";import{e as r}from"./query.js";import{c as a}from"./component.styles.js";import{t as s}from"./classix.js";const l=Math.min,c=Math.max,f=Math.round,u=Math.floor,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-2-11-7-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-2-11-8-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-2-11-
|
|
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-2-11-8-button-group__button--first:not(.sd-2-11-8-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-2-11-8-button-group__button--inner) button{border-radius:var(--sd-border-radius-none,0)}:host(.sd-2-11-8-button-group__button--last:not(.sd-2-11-8-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-2-11-8-button-group__button:not(.sd-2-11-8-button-group__button--first)){margin-inline-start:-1px}:host(.sd-2-11-8-button-group__button--hover){z-index:10}:host(.sd-2-11-8-button-group__button--focus),:host(.sd-2-11-8-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-2-11-8-radio-button")],m);export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as t,n as e,S as o,x as s,c as i}from"./solid-element.js";import{F as a,c as l,a as r,v as n}from"./form.js";import{H as d}from"./slot.js";import{r as h}from"./state.js";import{e as u}from"./query.js";import{w as c}from"./watch.js";import{c as p}from"./component.styles.js";import{t as m}from"./classix.js";import g from"./radio.js";const b=t`${p}:host{display:inline-block}.button-group{display:flex;flex-wrap:nowrap}`;var f=Object.defineProperty,v=Object.getOwnPropertyDescriptor,y=(t,e,o,s)=>{for(var i,a=s>1?void 0:s?v(e,o):e,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(s?i(e,o,a):i(a))||a);return s&&a&&f(e,o,a),a};let C=class extends o{constructor(){super(...arguments),this.disableRole=!1,this.label=""}handleFocus(t){const e=w(t.target);null==e||e.classList.add("sd-2-11-
|
|
1
|
+
import{i as t,n as e,S as o,x as s,c as i}from"./solid-element.js";import{F as a,c as l,a as r,v as n}from"./form.js";import{H as d}from"./slot.js";import{r as h}from"./state.js";import{e as u}from"./query.js";import{w as c}from"./watch.js";import{c as p}from"./component.styles.js";import{t as m}from"./classix.js";import g from"./radio.js";const b=t`${p}:host{display:inline-block}.button-group{display:flex;flex-wrap:nowrap}`;var f=Object.defineProperty,v=Object.getOwnPropertyDescriptor,y=(t,e,o,s)=>{for(var i,a=s>1?void 0:s?v(e,o):e,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(s?i(e,o,a):i(a))||a);return s&&a&&f(e,o,a),a};let C=class extends o{constructor(){super(...arguments),this.disableRole=!1,this.label=""}handleFocus(t){const e=w(t.target);null==e||e.classList.add("sd-2-11-8-button-group__button--focus")}handleBlur(t){const e=w(t.target);null==e||e.classList.remove("sd-2-11-8-button-group__button--focus")}handleMouseOver(t){const e=w(t.target);null==e||e.classList.add("sd-2-11-8-button-group__button--hover")}handleMouseOut(t){const e=w(t.target);null==e||e.classList.remove("sd-2-11-8-button-group__button--hover")}handleSlotChange(){const t=[...this.defaultSlot.assignedElements({flatten:!0})];t.forEach((e=>{const o=t.indexOf(e),s=w(e);null!==s&&(s.classList.add("sd-2-11-8-button-group__button"),s.classList.toggle("sd-2-11-8-button-group__button--first",0===o),s.classList.toggle("sd-2-11-8-button-group__button--inner",o>0&&o<t.length-1),s.classList.toggle("sd-2-11-8-button-group__button--last",o===t.length-1),s.classList.toggle("sd-2-11-8-button-group__button--radio","sd-2-11-8-radio-button"===s.tagName.toLowerCase()))}))}render(){return s`<slot part="base" class="button-group" role="${this.disableRole?"presentation":"group"}" aria-label="${this.label}" @focusout="${this.handleBlur}" @focusin="${this.handleFocus}" @mouseover="${this.handleMouseOver}" @mouseout="${this.handleMouseOut}" @slotchange="${this.handleSlotChange}"></slot>`}};function w(t){const e="sd-2-11-8-button, sd-2-11-8-radio-button";return t.closest(e)??t.querySelector(e)}C.styles=b,y([u("slot")],C.prototype,"defaultSlot",2),y([h()],C.prototype,"disableRole",2),y([e()],C.prototype,"label",2),C=y([i("sd-2-11-8-button-group")],C);var x=Object.defineProperty,R=Object.getOwnPropertyDescriptor,k=(t,e,o,s)=>{for(var i,a=s>1?void 0:s?R(e,o):e,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(s?i(e,o,a):i(a))||a);return s&&a&&x(e,o,a),a};let I=class extends o{constructor(){super(...arguments),this.formControlController=new a(this),this.hasSlotController=new d(this,"label","error-text"),this.customValidityMessage="",this.hasButtonGroup=!1,this.defaultValue="",this.showInvalidStyle=!1,this.label="",this.boldLabel=!1,this.name="option",this.value="",this.size="lg",this.form="",this.required=!1,this.orientation="vertical"}get validity(){const t=this.required&&!this.value;return""!==this.customValidityMessage?l:t?r:n}get validationMessage(){const t=this.required&&!this.value;return""!==this.customValidityMessage?this.customValidityMessage:t?this.validationInput.validationMessage:""}connectedCallback(){super.connectedCallback(),this.defaultValue=this.value}firstUpdated(){this.formControlController.updateValidity()}getAllRadios(){return[...this.querySelectorAll("sd-2-11-8-radio, sd-2-11-8-radio-button")]}handleRadioClick(t){const e=t.target.closest("sd-2-11-8-radio, sd-2-11-8-radio-button"),o=this.getAllRadios(),s=this.value;e.disabled||(this.value=e.value,o.forEach((t=>t.checked=t===e)),this.value!==s&&(this.emit("sd-change"),this.emit("sd-2-11-8-input")))}handleKeyDown(t){if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key))return;const e=this.getAllRadios().filter((t=>!t.disabled)),o=e.find((t=>t.checked))??e[0],s=" "===t.key?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,i=this.value;let a=e.indexOf(o)+s;a<0&&(a=e.length-1),a>e.length-1&&(a=0),this.getAllRadios().forEach((t=>{t.checked=!1,this.hasButtonGroup||(t.tabIndex=-1)})),this.value=e[a].value,e[a].checked=!0,this.hasButtonGroup?e[a].shadowRoot.querySelector("button").focus():(e[a].tabIndex=0,e[a].focus()),this.value!==i&&(this.emit("sd-change"),this.emit("sd-2-11-8-input")),t.preventDefault()}focus(){const t=this.getAllRadios(),e=t.find((t=>t.checked))||t[0];e&&e.focus()}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}async syncRadioElements(){var t,e;const o=this.getAllRadios();if(await Promise.all(o.map((async t=>{await t.updateComplete,t.checked=t.value===this.value,t.size=this.size,t instanceof g&&(t.invalid=this.showInvalidStyle)}))),this.hasButtonGroup=o.some((t=>"sd-2-11-8-radio-button"===t.tagName.toLowerCase())),!o.some((t=>t.checked)))if(this.hasButtonGroup){const e=null==(t=o[0].shadowRoot)?void 0:t.querySelector("button");e&&(e.tabIndex=0)}else o[0].tabIndex=0;if(this.hasButtonGroup){const t=null==(e=this.shadowRoot)?void 0:e.querySelector("sd-2-11-8-button-group");t&&(t.disableRole=!0)}}syncRadios(){customElements.get("sd-2-11-8-radio")&&customElements.get("sd-2-11-8-radio-button")?this.syncRadioElements():(customElements.get("sd-2-11-8-radio")?this.syncRadioElements():customElements.whenDefined("sd-2-11-8-radio").then((()=>this.syncRadios())),customElements.get("sd-2-11-8-radio-button")?this.syncRadioElements():customElements.whenDefined("sd-2-11-8-radio-button").then((()=>this.syncRadios())))}updateCheckedRadio(){this.getAllRadios().forEach((t=>t.checked=t.value===this.value)),this.formControlController.setValidity(this.validity.valid)}handleSizeChange(){this.syncRadios()}handleInvalidChange(){this.syncRadios()}handleValueChange(){this.hasUpdated&&(this.updateCheckedRadio(),this.reportValidity())}checkValidity(){const t=this.required&&!this.value,e=""!==this.customValidityMessage;return!t&&!e||(this.formControlController.emitInvalidEvent(),!1)}getForm(){return this.formControlController.getForm()}reportValidity(){const t=this.validity.valid;return this.formControlController.setValidity(t),this.validationInput.hidden=!0,clearTimeout(this.validationTimeout),this.formControlController.fakeUserInteraction(),t||(this.validationInput.hidden=!1,this.validationInput.reportValidity(),this.validationTimeout=setTimeout((()=>this.validationInput.hidden=!0),1e4)),t}setCustomValidity(t=""){this.customValidityMessage=t,this.validationInput.setCustomValidity(t),this.formControlController.updateValidity()}render(){const t=this.hasSlotController.test("label"),e=!!this.label||!!t,o=s`<slot @slotchange="${this.syncRadios}" @click="${this.handleRadioClick}" @keydown="${this.handleKeyDown}"></slot>`;return s`<fieldset part="form-control" class="${m("border-0 p-0 m-0 flex flex-col",{sm:"text-sm",lg:"text-base"}[this.size])}" role="radiogroup" aria-labelledby="label" aria-errormessage="error-text"><label part="form-control-label" id="label" class="${m("mb-2 p-0 leading-normal text-black text-left",!e&&"hidden",this.boldLabel&&"font-bold")}" @click="${this.focus}" aria-hidden="${e?"false":"true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${m("flex",{vertical:"flex-col",horizontal:"flex-row"}[this.orientation])}"><div class="sr-only"><label><input id="validation-input" type="text" ?required="${this.required}" tabindex="-1" hidden @invalid="${this.handleInvalid}"></label></div>${this.hasButtonGroup?s`<sd-2-11-8-button-group part="button-group" exportparts="base:button-group__base" role="presentation">${o}</sd-2-11-8-button-group>`:o}</div></fieldset>${this.formControlController.renderInvalidMessage()}`}};I.dependencies={"sd-2-11-8-button-group":C},I.styles=[p,o.styles,t`:host{display:block}:host([orientation=vertical]) ::slotted(sd-2-11-8-radio){margin-bottom:var(--sd-spacing-2,.5rem);display:flex}:host([orientation=vertical]) ::slotted(sd-2-11-8-radio:last-of-type){margin-bottom:var(--sd-spacing-0,0)}:host([orientation=horizontal]) ::slotted(sd-2-11-8-radio){margin-right:var(--sd-spacing-6,1.5rem)}:host([orientation=horizontal]) ::slotted(sd-2-11-8-radio:last-of-type){margin-right:var(--sd-spacing-0,0)}:host([orientation=horizontal]):host([size=sm]) ::slotted(sd-2-11-8-radio){margin-right:var(--sd-spacing-4,1rem)}:host([orientation=horizontal]):host([size=sm]) ::slotted(sd-2-11-8-radio:last-of-type){margin-right:var(--sd-spacing-0,0)}:host([required]) #label::after{content:' *'}`],k([u("slot:not([name])")],I.prototype,"defaultSlot",2),k([u("#validation-input")],I.prototype,"validationInput",2),k([u("#invalid-message")],I.prototype,"invalidMessage",2),k([h()],I.prototype,"hasButtonGroup",2),k([h()],I.prototype,"defaultValue",2),k([h()],I.prototype,"showInvalidStyle",2),k([e()],I.prototype,"label",2),k([e({type:Boolean,reflect:!0})],I.prototype,"boldLabel",2),k([e()],I.prototype,"name",2),k([e({reflect:!0})],I.prototype,"value",2),k([e({reflect:!0})],I.prototype,"size",2),k([e({reflect:!0})],I.prototype,"form",2),k([e({type:Boolean,reflect:!0})],I.prototype,"required",2),k([e({reflect:!0})],I.prototype,"orientation",2),k([c("size",{waitUntilFirstUpdate:!0})],I.prototype,"handleSizeChange",1),k([c("showInvalidStyle",{waitUntilFirstUpdate:!0})],I.prototype,"handleInvalidChange",1),k([c("value")],I.prototype,"handleValueChange",1),I=k([i("sd-2-11-8-radio-group")],I);export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./icon.js";import{S as e,x as t,i as s,n as i,c as r}from"./solid-element.js";import{r as l}from"./state.js";import{w as a}from"./watch.js";import{t as o}from"./classix.js";var n=Object.defineProperty,h=Object.getOwnPropertyDescriptor,d=(e,t,s,i)=>{for(var r,l=i>1?void 0:i?h(t,s):t,a=e.length-1;a>=0;a--)(r=e[a])&&(l=(i?r(t,s,l):r(l))||l);return i&&l&&n(t,s,l),l};let c=class extends e{constructor(){super(...arguments),this.checked=!1,this.hasFocus=!1,this.size="lg",this.invalid=!1,this.disabled=!1}connectedCallback(){super.connectedCallback(),this.handleBlur=this.handleBlur.bind(this),this.handleClick=this.handleClick.bind(this),this.handleFocus=this.handleFocus.bind(this),this.setInitialAttributes(),this.addEventListeners()}disconnectedCallback(){this.removeEventListeners()}addEventListeners(){this.addEventListener("blur",this.handleBlur),this.addEventListener("click",this.handleClick),this.addEventListener("focus",this.handleFocus)}removeEventListeners(){this.removeEventListener("blur",this.handleBlur),this.removeEventListener("click",this.handleClick),this.removeEventListener("focus",this.handleFocus)}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleClick(){this.disabled||(this.checked=!0)}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}setInitialAttributes(){this.setAttribute("role","radio"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleCheckedChange(){this.setAttribute("aria-checked",this.checked?"true":"false"),this.setAttribute("tabindex",this.checked?"0":"-1")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}render(){return t`<span part="base" class="${o("sd-2-11-
|
|
1
|
+
import"./icon.js";import{S as e,x as t,i as s,n as i,c as r}from"./solid-element.js";import{r as l}from"./state.js";import{w as a}from"./watch.js";import{t as o}from"./classix.js";var n=Object.defineProperty,h=Object.getOwnPropertyDescriptor,d=(e,t,s,i)=>{for(var r,l=i>1?void 0:i?h(t,s):t,a=e.length-1;a>=0;a--)(r=e[a])&&(l=(i?r(t,s,l):r(l))||l);return i&&l&&n(t,s,l),l};let c=class extends e{constructor(){super(...arguments),this.checked=!1,this.hasFocus=!1,this.size="lg",this.invalid=!1,this.disabled=!1}connectedCallback(){super.connectedCallback(),this.handleBlur=this.handleBlur.bind(this),this.handleClick=this.handleClick.bind(this),this.handleFocus=this.handleFocus.bind(this),this.setInitialAttributes(),this.addEventListeners()}disconnectedCallback(){this.removeEventListeners()}addEventListeners(){this.addEventListener("blur",this.handleBlur),this.addEventListener("click",this.handleClick),this.addEventListener("focus",this.handleFocus)}removeEventListeners(){this.removeEventListener("blur",this.handleBlur),this.removeEventListener("click",this.handleClick),this.removeEventListener("focus",this.handleFocus)}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleClick(){this.disabled||(this.checked=!0)}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}setInitialAttributes(){this.setAttribute("role","radio"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleCheckedChange(){this.setAttribute("aria-checked",this.checked?"true":"false"),this.setAttribute("tabindex",this.checked?"0":"-1")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}render(){return t`<span part="base" class="${o("sd-2-11-8-radio group inline-flex items-start items-center text-base leading-normal text-black cursor-pointer align-middle",this.disabled&&"hover:cursor-not-allowed",{sm:"small-size text-sm",lg:"text-base"}[this.size])}"><span part="${this.checked?"control--checked":"control--unchecked"}" class="${o("flex-initial shrink-0 relative inline-flex items-center justify-center border rounded-full bg-white h-4 w-4",this.disabled?"border-neutral-500":this.invalid?"border-error hover:border-error-400 group-hover:border-error-400":this.checked?"border-accent hover:border-accent-550 group-hover:border-accent-550":"border-neutral-800 hover:bg-neutral-200 group-hover:bg-neutral-200")}">${this.checked?t`<span part="checked" class="${o("rounded-full inline-flex text-white border bg-accent h-2.5 w-2.5",this.disabled?"bg-neutral-500":this.invalid?"bg-error hover:bg-error-400 group-hover:bg-error-400":this.checked?"bg-accent hover:bg-accent-550 group-hover:bg-accent-550":"bg-neutral-800")}"></span>`:""}</span><slot part="label" class="${o("ml-2 select-none inline-block",this.disabled?"text-neutral-500":this.invalid?"text-error":"text-black")}"></slot></span>`}};c.styles=[e.styles,s`:host{display:block}:host(:focus-visible){outline:2px solid transparent;outline-offset:2px}:host(:focus-visible) [part=control--checked],:host(:focus-visible) [part=control--unchecked]{outline-style:solid;outline-width:2px;outline-offset:2px;outline-color:rgb(var(--sd-color-primary,0 53 142) / 1)}`],d([l()],c.prototype,"checked",2),d([l()],c.prototype,"hasFocus",2),d([i({reflect:!0})],c.prototype,"size",2),d([i({type:Boolean,reflect:!0})],c.prototype,"invalid",2),d([i({type:Boolean,reflect:!0})],c.prototype,"disabled",2),d([i()],c.prototype,"value",2),d([a("checked")],c.prototype,"handleCheckedChange",1),d([a("disabled",{waitUntilFirstUpdate:!0})],c.prototype,"handleDisabledChange",1),c=d([r("sd-2-11-8-radio")],c);export{c as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{s as t,a as e,w as s}from"./event.js";import{S as i,x as o,i as l,n as a,c as n}from"./solid-element.js";import{d as r}from"./default-value.js";import{F as h}from"./form.js";import{g as p,s as d}from"./animation-registry.js";import{H as c}from"./slot.js";import{L as u}from"./solid-components2.js";import{r as m}from"./state.js";import{e as y}from"./query.js";import{o as b}from"./query-assigned-elements.js";import{s as v}from"./scroll.js";import{o as f,S as g}from"./icon.js";import{w as x}from"./watch.js";import{c as w}from"./component.styles.js";import{t as O}from"./classix.js";import C from"./popup.js";import S from"./tag.js";var $=Object.defineProperty,k=Object.getOwnPropertyDescriptor,D=(t,e,s,i)=>{for(var o,l=i>1?void 0:i?k(e,s):e,a=t.length-1;a>=0;a--)(o=t[a])&&(l=(i?o(e,s,l):o(l))||l);return i&&l&&$(e,s,l),l};let I=class extends i{constructor(){super(...arguments),this.formControlController=new h(this,{assumeInteractionOn:["sd-blur","sd-2-11-
|
|
1
|
+
import{s as t,a as e,w as s}from"./event.js";import{S as i,x as o,i as l,n as a,c as n}from"./solid-element.js";import{d as r}from"./default-value.js";import{F as h}from"./form.js";import{g as p,s as d}from"./animation-registry.js";import{H as c}from"./slot.js";import{L as u}from"./solid-components2.js";import{r as m}from"./state.js";import{e as y}from"./query.js";import{o as b}from"./query-assigned-elements.js";import{s as v}from"./scroll.js";import{o as f,S as g}from"./icon.js";import{w as x}from"./watch.js";import{c as w}from"./component.styles.js";import{t as O}from"./classix.js";import C from"./popup.js";import S from"./tag.js";var $=Object.defineProperty,k=Object.getOwnPropertyDescriptor,D=(t,e,s,i)=>{for(var o,l=i>1?void 0:i?k(e,s):e,a=t.length-1;a>=0;a--)(o=t[a])&&(l=(i?o(e,s,l):o(l))||l);return i&&l&&$(e,s,l),l};let I=class extends i{constructor(){super(...arguments),this.formControlController=new h(this,{assumeInteractionOn:["sd-blur","sd-2-11-8-input"]}),this.hasSlotController=new c(this,"help-text","label"),this.localize=new u(this),this.typeToSelectString="",this.hasHover=!1,this.displayLabel="",this.hasFocus=!1,this.selectedOptions=[],this.showValidStyle=!1,this.showInvalidStyle=!1,this.defaultValue="",this.open=!1,this.size="lg",this.label="",this.placeholder=this.localize.term("selectDefaultPlaceholder"),this.helpText="",this.placement="bottom",this.currentPlacement=this.placement,this.clearable=!1,this.disabled=!1,this.multiple=!1,this.useTags=!1,this.maxOptionsVisible=3,this.form="",this.name="",this.value="",this.required=!1,this.styleOnValid=!1,this.hoist=!1,this.getTag=t=>o`<sd-2-11-8-tag ?disabled="${this.disabled}" part="tag" exportparts="
|
|
2
2
|
base:tag__base,
|
|
3
3
|
content:tag__content,
|
|
4
4
|
removable-indicator:tag__removable-indicator,
|
|
5
|
-
" size="${"sm"===this.size?"sm":"lg"}" removable @sd-remove="${e=>this.handleTagRemove(e,t)}">${t.getTextLabel()}</sd-2-11-7-tag>`,this.handleDocumentFocusIn=t=>{const e=t.composedPath();this&&!e.includes(this)&&this.hide()},this.handleDocumentKeyDown=t=>{const e=t.target,s=null!==e.closest(".select__clear"),i=null!==e.closest("sd-2-11-7-icon-button");if(!s&&!i){if("Escape"===t.key&&this.open&&(t.preventDefault(),t.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})),"Enter"===t.key||" "===t.key&&""===this.typeToSelectString)return t.preventDefault(),t.stopImmediatePropagation(),this.open?void(this.currentOption&&!this.currentOption.disabled&&(this.multiple?this.toggleOptionSelection(this.currentOption):this.setSelectedOptions(this.currentOption),this.updateComplete.then((()=>{this.emit("sd-2-11-7-input"),this.emit("sd-change")})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))):void this.show();if(["ArrowUp","ArrowDown","Home","End"].includes(t.key)){const e=this.getAllOptions(),s=e.indexOf(this.currentOption);let i=Math.max(0,s);if(t.preventDefault(),!this.open&&(this.show(),this.currentOption))return;"ArrowDown"===t.key?(i=s+1,i>e.length-1&&(i=0)):"ArrowUp"===t.key?(i=s-1,i<0&&(i=e.length-1)):"Home"===t.key?i=0:"End"===t.key&&(i=e.length-1),this.setCurrentOption(e[i])}if(1===t.key.length||"Backspace"===t.key){const e=this.getAllOptions();if(t.metaKey||t.ctrlKey||t.altKey)return;if(!this.open){if("Backspace"===t.key)return;this.show()}t.stopPropagation(),t.preventDefault(),clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=window.setTimeout((()=>this.typeToSelectString=""),1e3),"Backspace"===t.key?this.typeToSelectString=this.typeToSelectString.slice(0,-1):this.typeToSelectString+=t.key.toLowerCase();for(const t of e)if(t.getTextLabel().toLowerCase().startsWith(this.typeToSelectString)){this.setCurrentOption(t);break}}}},this.handleDocumentMouseDown=t=>{const e=t.composedPath();this&&!e.includes(this)&&this.hide()}}get validity(){return this.valueInput.validity}get validationMessage(){return this.valueInput.validationMessage}connectedCallback(){super.connectedCallback(),this.applySizeToOptions(),this.open=!1}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}handleFocus(){this.hasFocus=!0,this.displayInput.setSelectionRange(0,0),this.emit("sd-focus")}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleLabelClick(){this.displayInput.focus()}handleComboboxMouseDown(t){const e=t.composedPath().some((t=>t instanceof HTMLSlotElement&&"removable-indicator"===t.name));this.disabled||e||(t.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}handleComboboxKeyDown(t){t.stopPropagation(),this.handleDocumentKeyDown(t)}handleClearClick(t){t.stopPropagation(),""!==this.value&&(this.setSelectedOptions([]),this.displayInput.focus({preventScroll:!0}),this.updateComplete.then((()=>{this.emit("sd-clear"),this.emit("sd-2-11-7-input"),this.emit("sd-change")})))}handleClearMouseDown(t){t.stopPropagation(),t.preventDefault()}handleOptionClick(t){const e=t.target.closest("sd-2-11-7-option"),s=this.value;e&&!e.disabled&&(this.multiple?this.toggleOptionSelection(e):this.setSelectedOptions(e),this.updateComplete.then((()=>this.displayInput.focus({preventScroll:!0}))),this.value!==s&&this.updateComplete.then((()=>{this.emit("sd-2-11-7-input"),this.emit("sd-change")})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))}handleDefaultSlotChange(){const t=this.getAllOptions(),e=Array.isArray(this.value)?this.value:[this.value],s=[];customElements.get("sd-2-11-7-option")?(t.forEach((t=>{this.multiple&&(t.checkbox=!0),s.push(t.value)})),this.setSelectedOptions(t.filter((t=>e.includes(t.value))))):customElements.whenDefined("sd-2-11-7-option").then((()=>this.handleDefaultSlotChange()))}handleTagRemove(t,e){t.stopPropagation(),this.disabled||(this.toggleOptionSelection(e,!1),this.updateComplete.then((()=>{this.emit("sd-2-11-7-input"),this.emit("sd-change")})))}getAllOptions(){return[...this.querySelectorAll("sd-2-11-7-option")]}getFirstOption(){return this.querySelector("sd-2-11-7-option")}setCurrentOption(t){this.getAllOptions().forEach((t=>{t.current=!1,t.tabIndex=-1})),t&&(this.currentOption=t,t.current=!0,t.tabIndex=0,t.focus())}setSelectedOptions(t){const e=this.getAllOptions(),s=Array.isArray(t)?t:[t];e.forEach((t=>t.selected=!1)),s.length&&s.forEach((t=>t.selected=!0)),this.selectionChanged()}toggleOptionSelection(t,e){t.selected=!0===e||!1===e?e:!t.selected,this.selectionChanged()}selectionChanged(){var t,e;this.selectedOptions=this.getAllOptions().filter((t=>t.selected)),this.multiple?(this.value=this.selectedOptions.map((t=>t.value)),this.useTags||0===this.value.length?this.displayLabel="":this.displayLabel=this.localize.term("numOptionsSelected",this.selectedOptions.length)):(this.value=(null==(t=this.selectedOptions[0])?void 0:t.value)??"",this.displayLabel=(null==(e=this.selectedOptions[0])?void 0:e.getTextLabel())??""),this.updateComplete.then((()=>{this.formControlController.updateValidity()}))}get tags(){return this.selectedOptions.map(((t,e)=>{if(e<this.maxOptionsVisible||this.maxOptionsVisible<=0){const s=this.getTag(t,e);return o`<div @sd-remove="${e=>this.handleTagRemove(e,t)}">${"string"==typeof s?f(s):s}</div>`}return e===this.maxOptionsVisible?o`<sd-2-11-7-tag size="${"sm"===this.size?"sm":"lg"}" ?disabled="${this.disabled}">+${this.selectedOptions.length-e}</sd-2-11-7-tag>`:o``}))}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleCurrentPlacement(t){const e=t.detail;e&&(this.currentPlacement=e)}handleUseTagsChange(){const t=this.getAllOptions();customElements.get("sd-2-11-7-option")&&t.forEach((t=>{t.checkbox=this.multiple}))}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}async handleOpenChange(){if(this.open&&!this.disabled){this.setCurrentOption(this.selectedOptions[0]||this.getFirstOption()),this.emit("sd-show"),this.addOpenListeners(),await t(this),this.listbox.hidden=!1,this.popup.active=!0,requestAnimationFrame((()=>{this.setCurrentOption(this.currentOption)}));const{keyframes:s,options:i}=p(this,"select.show",{dir:this.localize.dir()});await e(this.popup.popup,s,i),this.currentOption&&v(this.currentOption,this.listbox,"vertical","auto"),this.emit("sd-after-show")}else{this.emit("sd-hide"),this.removeOpenListeners(),await t(this);const{keyframes:s,options:i}=p(this,"select.hide",{dir:this.localize.dir()});await e(this.popup.popup,s,i),this.listbox.hidden=!0,this.popup.active=!1,this.emit("sd-after-hide")}}applySizeToOptions(){this._optionsInDefaultSlot.forEach((t=>{t.size=this.size}))}handleValueChange(){const t=this.getAllOptions(),e=Array.isArray(this.value)?this.value:[this.value];this.setSelectedOptions(t.filter((t=>e.includes(t.value))))}async show(){if(!this.open&&!this.disabled)return this.open=!0,s(this,"sd-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,s(this,"sd-after-hide");this.open=!1}checkValidity(){var t;return null==(t=this.valueInput)?void 0:t.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.valueInput.reportValidity()}setCustomValidity(t){this.valueInput.setCustomValidity(t),this.formControlController.updateValidity()}focus(t){this.displayInput.focus(t)}blur(){this.displayInput.blur()}render(){this.hasSlotController.test("[default]");const t=this.hasSlotController.test("label"),e=(this.hasSlotController.test("clear-icon"),this.hasSlotController.test("expand-icon"),this.hasSlotController.test("help-text")),s=!!this.label||!!t,i=!!this.helpText||!!e,l=this.clearable&&!this.disabled&&this.value.length>0,a=this.disabled?"disabled":this.hasFocus&&this.showInvalidStyle?"activeInvalid":this.hasFocus&&this.styleOnValid&&this.showValidStyle?"activeValid":this.hasFocus||this.open?"active":this.showInvalidStyle?"invalid":this.styleOnValid&&this.showValidStyle?"valid":"default",n=this.disabled?"cursor-not-allowed":"cursor-pointer",r={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],h={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return o`<div part="form-control" class="${O("relative text-left",n,"sm"===this.size?"text-sm":"text-base",this.open&&"z-50")}"><label id="label" part="form-control-label" class="${s&&"inline-block mb-2"}" aria-hidden="${s?"false":"true"}" @click="${this.handleLabelClick}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${O("relative w-full bg-white",{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"}[a])}"><div part="border" class="${O("absolute top-0 w-full h-full pointer-events-none border rounded-default",this.hasHover&&"bg-neutral-200",{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"}[a],this.open&&("bottom"===this.currentPlacement?"rounded-bl-none rounded-br-none":"rounded-tl-none rounded-tr-none"))}"></div><sd-2-11-7-popup @sd-current-placement="${this.handleCurrentPlacement}" class="${O("inline-flex relative w-full","bottom"===this.currentPlacement?"origin-top":"origin-bottom")}" placement="${this.placement}" strategy="${this.hoist?"fixed":"absolute"}" flip shift sync="width" auto-size="vertical" auto-size-padding="10" exportparts="
|
|
5
|
+
" size="${"sm"===this.size?"sm":"lg"}" removable @sd-remove="${e=>this.handleTagRemove(e,t)}">${t.getTextLabel()}</sd-2-11-8-tag>`,this.handleDocumentFocusIn=t=>{const e=t.composedPath();this&&!e.includes(this)&&this.hide()},this.handleDocumentKeyDown=t=>{const e=t.target,s=null!==e.closest(".select__clear"),i=null!==e.closest("sd-2-11-8-icon-button");if(!s&&!i){if("Escape"===t.key&&this.open&&(t.preventDefault(),t.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})),"Enter"===t.key||" "===t.key&&""===this.typeToSelectString)return t.preventDefault(),t.stopImmediatePropagation(),this.open?void(this.currentOption&&!this.currentOption.disabled&&(this.multiple?this.toggleOptionSelection(this.currentOption):this.setSelectedOptions(this.currentOption),this.updateComplete.then((()=>{this.emit("sd-2-11-8-input"),this.emit("sd-change")})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))):void this.show();if(["ArrowUp","ArrowDown","Home","End"].includes(t.key)){const e=this.getAllOptions(),s=e.indexOf(this.currentOption);let i=Math.max(0,s);if(t.preventDefault(),!this.open&&(this.show(),this.currentOption))return;"ArrowDown"===t.key?(i=s+1,i>e.length-1&&(i=0)):"ArrowUp"===t.key?(i=s-1,i<0&&(i=e.length-1)):"Home"===t.key?i=0:"End"===t.key&&(i=e.length-1),this.setCurrentOption(e[i])}if(1===t.key.length||"Backspace"===t.key){const e=this.getAllOptions();if(t.metaKey||t.ctrlKey||t.altKey)return;if(!this.open){if("Backspace"===t.key)return;this.show()}t.stopPropagation(),t.preventDefault(),clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=window.setTimeout((()=>this.typeToSelectString=""),1e3),"Backspace"===t.key?this.typeToSelectString=this.typeToSelectString.slice(0,-1):this.typeToSelectString+=t.key.toLowerCase();for(const t of e)if(t.getTextLabel().toLowerCase().startsWith(this.typeToSelectString)){this.setCurrentOption(t);break}}}},this.handleDocumentMouseDown=t=>{const e=t.composedPath();this&&!e.includes(this)&&this.hide()}}get validity(){return this.valueInput.validity}get validationMessage(){return this.valueInput.validationMessage}connectedCallback(){super.connectedCallback(),this.applySizeToOptions(),this.open=!1}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}handleFocus(){this.hasFocus=!0,this.displayInput.setSelectionRange(0,0),this.emit("sd-focus")}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleLabelClick(){this.displayInput.focus()}handleComboboxMouseDown(t){const e=t.composedPath().some((t=>t instanceof HTMLSlotElement&&"removable-indicator"===t.name));this.disabled||e||(t.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}handleComboboxKeyDown(t){t.stopPropagation(),this.handleDocumentKeyDown(t)}handleClearClick(t){t.stopPropagation(),""!==this.value&&(this.setSelectedOptions([]),this.displayInput.focus({preventScroll:!0}),this.updateComplete.then((()=>{this.emit("sd-clear"),this.emit("sd-2-11-8-input"),this.emit("sd-change")})))}handleClearMouseDown(t){t.stopPropagation(),t.preventDefault()}handleOptionClick(t){const e=t.target.closest("sd-2-11-8-option"),s=this.value;e&&!e.disabled&&(this.multiple?this.toggleOptionSelection(e):this.setSelectedOptions(e),this.updateComplete.then((()=>this.displayInput.focus({preventScroll:!0}))),this.value!==s&&this.updateComplete.then((()=>{this.emit("sd-2-11-8-input"),this.emit("sd-change")})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))}handleDefaultSlotChange(){const t=this.getAllOptions(),e=Array.isArray(this.value)?this.value:[this.value],s=[];customElements.get("sd-2-11-8-option")?(t.forEach((t=>{this.multiple&&(t.checkbox=!0),s.push(t.value)})),this.setSelectedOptions(t.filter((t=>e.includes(t.value))))):customElements.whenDefined("sd-2-11-8-option").then((()=>this.handleDefaultSlotChange()))}handleTagRemove(t,e){t.stopPropagation(),this.disabled||(this.toggleOptionSelection(e,!1),this.updateComplete.then((()=>{this.emit("sd-2-11-8-input"),this.emit("sd-change")})))}getAllOptions(){return[...this.querySelectorAll("sd-2-11-8-option")]}getFirstOption(){return this.querySelector("sd-2-11-8-option")}setCurrentOption(t){this.getAllOptions().forEach((t=>{t.current=!1,t.tabIndex=-1})),t&&(this.currentOption=t,t.current=!0,t.tabIndex=0,t.focus())}setSelectedOptions(t){const e=this.getAllOptions(),s=Array.isArray(t)?t:[t];e.forEach((t=>t.selected=!1)),s.length&&s.forEach((t=>t.selected=!0)),this.selectionChanged()}toggleOptionSelection(t,e){t.selected=!0===e||!1===e?e:!t.selected,this.selectionChanged()}selectionChanged(){var t,e;this.selectedOptions=this.getAllOptions().filter((t=>t.selected)),this.multiple?(this.value=this.selectedOptions.map((t=>t.value)),this.useTags||0===this.value.length?this.displayLabel="":this.displayLabel=this.localize.term("numOptionsSelected",this.selectedOptions.length)):(this.value=(null==(t=this.selectedOptions[0])?void 0:t.value)??"",this.displayLabel=(null==(e=this.selectedOptions[0])?void 0:e.getTextLabel())??""),this.updateComplete.then((()=>{this.formControlController.updateValidity()}))}get tags(){return this.selectedOptions.map(((t,e)=>{if(e<this.maxOptionsVisible||this.maxOptionsVisible<=0){const s=this.getTag(t,e);return o`<div @sd-remove="${e=>this.handleTagRemove(e,t)}">${"string"==typeof s?f(s):s}</div>`}return e===this.maxOptionsVisible?o`<sd-2-11-8-tag size="${"sm"===this.size?"sm":"lg"}" ?disabled="${this.disabled}">+${this.selectedOptions.length-e}</sd-2-11-8-tag>`:o``}))}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleCurrentPlacement(t){const e=t.detail;e&&(this.currentPlacement=e)}handleUseTagsChange(){const t=this.getAllOptions();customElements.get("sd-2-11-8-option")&&t.forEach((t=>{t.checkbox=this.multiple}))}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}async handleOpenChange(){if(this.open&&!this.disabled){this.setCurrentOption(this.selectedOptions[0]||this.getFirstOption()),this.emit("sd-show"),this.addOpenListeners(),await t(this),this.listbox.hidden=!1,this.popup.active=!0,requestAnimationFrame((()=>{this.setCurrentOption(this.currentOption)}));const{keyframes:s,options:i}=p(this,"select.show",{dir:this.localize.dir()});await e(this.popup.popup,s,i),this.currentOption&&v(this.currentOption,this.listbox,"vertical","auto"),this.emit("sd-after-show")}else{this.emit("sd-hide"),this.removeOpenListeners(),await t(this);const{keyframes:s,options:i}=p(this,"select.hide",{dir:this.localize.dir()});await e(this.popup.popup,s,i),this.listbox.hidden=!0,this.popup.active=!1,this.emit("sd-after-hide")}}applySizeToOptions(){this._optionsInDefaultSlot.forEach((t=>{t.size=this.size}))}handleValueChange(){const t=this.getAllOptions(),e=Array.isArray(this.value)?this.value:[this.value];this.setSelectedOptions(t.filter((t=>e.includes(t.value))))}async show(){if(!this.open&&!this.disabled)return this.open=!0,s(this,"sd-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,s(this,"sd-after-hide");this.open=!1}checkValidity(){var t;return null==(t=this.valueInput)?void 0:t.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.valueInput.reportValidity()}setCustomValidity(t){this.valueInput.setCustomValidity(t),this.formControlController.updateValidity()}focus(t){this.displayInput.focus(t)}blur(){this.displayInput.blur()}render(){this.hasSlotController.test("[default]");const t=this.hasSlotController.test("label"),e=(this.hasSlotController.test("clear-icon"),this.hasSlotController.test("expand-icon"),this.hasSlotController.test("help-text")),s=!!this.label||!!t,i=!!this.helpText||!!e,l=this.clearable&&!this.disabled&&this.value.length>0,a=this.disabled?"disabled":this.hasFocus&&this.showInvalidStyle?"activeInvalid":this.hasFocus&&this.styleOnValid&&this.showValidStyle?"activeValid":this.hasFocus||this.open?"active":this.showInvalidStyle?"invalid":this.styleOnValid&&this.showValidStyle?"valid":"default",n=this.disabled?"cursor-not-allowed":"cursor-pointer",r={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],h={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return o`<div part="form-control" class="${O("relative text-left",n,"sm"===this.size?"text-sm":"text-base",this.open&&"z-50")}"><label id="label" part="form-control-label" class="${s&&"inline-block mb-2"}" aria-hidden="${s?"false":"true"}" @click="${this.handleLabelClick}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${O("relative w-full bg-white",{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"}[a])}"><div part="border" class="${O("absolute top-0 w-full h-full pointer-events-none border rounded-default",this.hasHover&&"bg-neutral-200",{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"}[a],this.open&&("bottom"===this.currentPlacement?"rounded-bl-none rounded-br-none":"rounded-tl-none rounded-tr-none"))}"></div><sd-2-11-8-popup @sd-current-placement="${this.handleCurrentPlacement}" class="${O("inline-flex relative w-full","bottom"===this.currentPlacement?"origin-top":"origin-bottom")}" placement="${this.placement}" strategy="${this.hoist?"fixed":"absolute"}" flip shift sync="width" auto-size="vertical" auto-size-padding="10" exportparts="
|
|
6
6
|
popup:popup__content,
|
|
7
|
-
"><div part="combobox" class="${O("relative w-full px-4 flex flex-row items-center rounded-default",{sm:"py-1 min-h-[32px]",md:"py-1 min-h-[40px]",lg:"py-2 min-h-[48px]"}[this.size])}" slot="anchor" @keydown="${this.handleComboboxKeyDown}" @mousedown="${this.handleComboboxMouseDown}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><input name="${this.name}" form="${this.form}" part="display-input" class="${O("appearance-none outline-none flex-grow bg-transparent w-full",n,this.multiple&&this.useTags&&this.value.length>0?"hidden":"")}" type="text" placeholder="${this.placeholder}" .disabled="${this.disabled}" .value="${this.displayLabel}" autocomplete="off" spellcheck="false" autocapitalize="off" readonly="readonly" aria-controls="listbox" aria-expanded="${this.open?"true":"false"}" aria-haspopup="listbox" aria-labelledby="label" aria-disabled="${this.disabled?"true":"false"}" aria-describedby="help-text" role="combobox" tabindex="0" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${this.multiple&&this.useTags?o`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>`:""} <input class="${O("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10",n)}" type="text" ?disabled="${this.disabled}" ?required="${this.required}" .value="${Array.isArray(this.value)?this.value.join(", "):this.value}" tabindex="-1" aria-hidden="true" @focus="${()=>this.focus()}" @invalid="${this.handleInvalid}"> ${l?o`<button part="clear-button" class="${O("select__clear flex justify-center",r)}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.handleClearMouseDown}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-2-11-
|
|
7
|
+
"><div part="combobox" class="${O("relative w-full px-4 flex flex-row items-center rounded-default",{sm:"py-1 min-h-[32px]",md:"py-1 min-h-[40px]",lg:"py-2 min-h-[48px]"}[this.size])}" slot="anchor" @keydown="${this.handleComboboxKeyDown}" @mousedown="${this.handleComboboxMouseDown}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><input name="${this.name}" form="${this.form}" part="display-input" class="${O("appearance-none outline-none flex-grow bg-transparent w-full",n,this.multiple&&this.useTags&&this.value.length>0?"hidden":"")}" type="text" placeholder="${this.placeholder}" .disabled="${this.disabled}" .value="${this.displayLabel}" autocomplete="off" spellcheck="false" autocapitalize="off" readonly="readonly" aria-controls="listbox" aria-expanded="${this.open?"true":"false"}" aria-haspopup="listbox" aria-labelledby="label" aria-disabled="${this.disabled?"true":"false"}" aria-describedby="help-text" role="combobox" tabindex="0" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${this.multiple&&this.useTags?o`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>`:""} <input class="${O("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10",n)}" type="text" ?disabled="${this.disabled}" ?required="${this.required}" .value="${Array.isArray(this.value)?this.value.join(", "):this.value}" tabindex="-1" aria-hidden="true" @focus="${()=>this.focus()}" @invalid="${this.handleInvalid}"> ${l?o`<button part="clear-button" class="${O("select__clear flex justify-center",r)}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.handleClearMouseDown}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-2-11-8-icon class="${O("text-neutral-500",h)}" library="system" name="closing-round"></sd-2-11-8-icon></slot></button>`:""} ${this.showInvalidStyle?o`<sd-2-11-8-icon part="invalid-icon" class="${O("text-error",r,h)}" library="system" name="risk"></sd-2-11-8-icon>`:""} ${this.styleOnValid&&this.showValidStyle?o`<sd-2-11-8-icon part="valid-icon" class="${O("text-success flex-shrink-0",r,h)}" library="system" name="confirm"></sd-2-11-8-icon>`:""}<slot name="expand-icon" part="expand-icon" class="${O("inline-flex ml-2 transition-all",this.open?"rotate-180":"rotate-0",h)}"><sd-2-11-8-icon name="chevron-down" part="chevron" library="system" color="currentColor"></sd-2-11-8-icon></slot></div><div id="listbox" role="listbox" aria-expanded="${this.open?"true":"false"}" aria-multiselectable="${this.multiple?"true":"false"}" aria-labelledby="label" part="listbox" class="${O("bg-white px-2 py-3 relative","bottom"===this.currentPlacement?"border-r-2 border-b-2 border-l-2 rounded-br-default rounded-bl-default":"border-r-2 border-t-2 border-l-2 rounded-tr-default rounded-tl-default")}" tabindex="-1" @mouseup="${this.handleOptionClick}" @slotchange="${this.handleDefaultSlotChange}"><slot></slot></div></sd-2-11-8-popup></div><div class="text-sm text-neutral-700" part="form-control-help-text" id="help-text" aria-hidden="${i?"false":"true"}"><slot name="help-text">${this.helpText}</slot></div></div>${this.formControlController.renderInvalidMessage()}`}};I.dependencies={"sd-2-11-8-icon":g,"sd-2-11-8-popup":C,"sd-2-11-8-tag":S},I.styles=[w,i.styles,l`:host{position:relative;display:block;width:100%}:host([required]) #label::after{content:' *'}sd-2-11-8-popup::part(popup){z-index:var(--sd-z-index-dropdown,900);overflow-y:scroll}sd-2-11-8-tag::part(base){border-radius:var(--sd-border-radius-default,.25rem);padding-left:var(--sd-spacing-1,.25rem);padding-right:var(--sd-spacing-1,.25rem)}sd-2-11-8-tag[size=lg]::part(base){padding-left:var(--sd-spacing-2,.5rem);padding-right:var(--sd-spacing-2,.5rem)}sd-2-11-8-tag[disabled=false]::part(base):hover{--tw-bg-opacity:1;background-color:rgb(var(--sd-color-primary-100,236 240 249) / var(--tw-bg-opacity))}`],D([b({selector:"sd-2-11-8-option"})],I.prototype,"_optionsInDefaultSlot",2),D([y("sd-2-11-8-popup")],I.prototype,"popup",2),D([y('[part="combobox"]')],I.prototype,"combobox",2),D([y('[part="display-input"]')],I.prototype,"displayInput",2),D([y(".value-input")],I.prototype,"valueInput",2),D([y('[part="listbox"]')],I.prototype,"listbox",2),D([y("#invalid-message")],I.prototype,"invalidMessage",2),D([m()],I.prototype,"hasHover",2),D([m()],I.prototype,"displayLabel",2),D([m()],I.prototype,"hasFocus",2),D([m()],I.prototype,"currentOption",2),D([m()],I.prototype,"selectedOptions",2),D([m()],I.prototype,"showValidStyle",2),D([m()],I.prototype,"showInvalidStyle",2),D([r()],I.prototype,"defaultValue",2),D([a({type:Boolean,reflect:!0})],I.prototype,"open",2),D([a({reflect:!0})],I.prototype,"size",2),D([a()],I.prototype,"label",2),D([a()],I.prototype,"placeholder",2),D([a({attribute:"help-text"})],I.prototype,"helpText",2),D([a({reflect:!0})],I.prototype,"placement",2),D([m()],I.prototype,"currentPlacement",2),D([a({type:Boolean})],I.prototype,"clearable",2),D([a({type:Boolean,reflect:!0})],I.prototype,"disabled",2),D([a({type:Boolean,reflect:!0})],I.prototype,"multiple",2),D([a({type:Boolean,reflect:!0})],I.prototype,"useTags",2),D([a({attribute:"max-options-visible",type:Number})],I.prototype,"maxOptionsVisible",2),D([a({reflect:!0})],I.prototype,"form",2),D([a()],I.prototype,"name",2),D([a({converter:{fromAttribute:t=>t.split(" "),toAttribute:t=>t.join(" ")}})],I.prototype,"value",2),D([a({type:Boolean,reflect:!0})],I.prototype,"required",2),D([a({type:Boolean,reflect:!0,attribute:"style-on-valid"})],I.prototype,"styleOnValid",2),D([a({type:Boolean})],I.prototype,"hoist",2),D([a()],I.prototype,"getTag",2),D([x("useTags",{waitUntilFirstUpdate:!0})],I.prototype,"handleUseTagsChange",1),D([x("disabled",{waitUntilFirstUpdate:!0})],I.prototype,"handleDisabledChange",1),D([x("open",{waitUntilFirstUpdate:!0})],I.prototype,"handleOpenChange",1),D([x("size",{waitUntilFirstUpdate:!0})],I.prototype,"applySizeToOptions",1),D([x("value",{waitUntilFirstUpdate:!0})],I.prototype,"handleValueChange",1),I=D([n("sd-2-11-8-select")],I),d("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),d("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,x as r,i as s,n as t,c as l}from"./solid-element.js";import{L as o}from"./solid-components2.js";import{t as i}from"./classix.js";var a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,c=(e,r,s,t)=>{for(var l,o=t>1?void 0:t?n(r,s):r,i=e.length-1;i>=0;i--)(l=e[i])&&(o=(t?l(r,s,o):l(o))||o);return t&&o&&a(r,s,o),o};let p=class extends e{constructor(){super(...arguments),this.color="currentColor",this.localize=new o(this)}render(){return r`<svg role="progressbar" viewBox="0 0 24 24" class="${i("animate-spin",{primary:"text-primary",white:"text-white",currentColor:""}[this.color])}" aria-label="${this.localize.term("loading")}"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12Z" class="opacity-20" fill="currentColor"/><mask id="mask0_5273_25391" style="mask-type:alpha" maskUnits="userSpaceOnUse"><path d="M24 12C24 5.37258 18.6274 0 12 0V12H24Z" fill="currentColor"/></mask><g mask="url(#mask0_5273_25391)"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12Z" fill="currentColor"/></g></svg>`}};p.styles=[e.styles,s`:host{display:inline-block;width:1em;height:1em}`],c([t({reflect:!0})],p.prototype,"color",2),p=c([l("sd-2-11-
|
|
1
|
+
import{S as e,x as r,i as s,n as t,c as l}from"./solid-element.js";import{L as o}from"./solid-components2.js";import{t as i}from"./classix.js";var a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,c=(e,r,s,t)=>{for(var l,o=t>1?void 0:t?n(r,s):r,i=e.length-1;i>=0;i--)(l=e[i])&&(o=(t?l(r,s,o):l(o))||o);return t&&o&&a(r,s,o),o};let p=class extends e{constructor(){super(...arguments),this.color="currentColor",this.localize=new o(this)}render(){return r`<svg role="progressbar" viewBox="0 0 24 24" class="${i("animate-spin",{primary:"text-primary",white:"text-white",currentColor:""}[this.color])}" aria-label="${this.localize.term("loading")}"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12Z" class="opacity-20" fill="currentColor"/><mask id="mask0_5273_25391" style="mask-type:alpha" maskUnits="userSpaceOnUse"><path d="M24 12C24 5.37258 18.6274 0 12 0V12H24Z" fill="currentColor"/></mask><g mask="url(#mask0_5273_25391)"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12Z" fill="currentColor"/></g></svg>`}};p.styles=[e.styles,s`:host{display:inline-block;width:1em;height:1em}`],c([t({reflect:!0})],p.prototype,"color",2),p=c([l("sd-2-11-8-spinner")],p);export{p as default};
|