@solid-design-system/components 3.10.1 → 3.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/es/input.js +1 -1
- package/dist/components/es/select.js +1 -1
- package/dist/components/umd/solid-components.js +2 -2
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/input/input.js +3 -3
- package/dist/package/components/select/select.js +1 -1
- package/dist/versioned-components/es/accordion-group.js +1 -1
- package/dist/versioned-components/es/accordion.js +1 -1
- package/dist/versioned-components/es/badge.js +1 -1
- package/dist/versioned-components/es/brandshape.js +1 -1
- package/dist/versioned-components/es/button.js +1 -1
- package/dist/versioned-components/es/carousel-item.js +1 -1
- package/dist/versioned-components/es/carousel.js +3 -3
- package/dist/versioned-components/es/checkbox-group.js +1 -1
- package/dist/versioned-components/es/checkbox.js +1 -1
- package/dist/versioned-components/es/dialog.js +1 -1
- package/dist/versioned-components/es/divider.js +1 -1
- package/dist/versioned-components/es/drawer.js +1 -1
- package/dist/versioned-components/es/dropdown.js +1 -1
- package/dist/versioned-components/es/flipcard.js +1 -1
- package/dist/versioned-components/es/form.js +1 -1
- package/dist/versioned-components/es/header.js +1 -1
- package/dist/versioned-components/es/icon.js +1 -1
- package/dist/versioned-components/es/include.js +1 -1
- package/dist/versioned-components/es/input.js +1 -1
- package/dist/versioned-components/es/link.js +1 -1
- package/dist/versioned-components/es/map-marker.js +1 -1
- package/dist/versioned-components/es/navigation-item.js +1 -1
- package/dist/versioned-components/es/notification.js +1 -1
- package/dist/versioned-components/es/option.js +1 -1
- package/dist/versioned-components/es/radio-button.js +1 -1
- package/dist/versioned-components/es/radio-group.js +1 -1
- package/dist/versioned-components/es/radio.js +1 -1
- package/dist/versioned-components/es/scrollable.js +1 -1
- package/dist/versioned-components/es/select.js +3 -3
- package/dist/versioned-components/es/solid-components2.js +1 -1
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/step-group.js +1 -1
- package/dist/versioned-components/es/step.js +1 -1
- package/dist/versioned-components/es/switch.js +1 -1
- package/dist/versioned-components/es/tab-group.js +1 -1
- package/dist/versioned-components/es/tab-panel.js +1 -1
- package/dist/versioned-components/es/tab.js +1 -1
- package/dist/versioned-components/es/tag.js +1 -1
- package/dist/versioned-components/es/teaser-media.js +1 -1
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-components/es/textarea.js +1 -1
- package/dist/versioned-components/es/tooltip.js +2 -2
- package/dist/versioned-components/es/video.js +1 -1
- package/dist/versioned-package/_components/button-group/button-group.d.ts +1 -1
- package/dist/versioned-package/_components/button-group/button-group.js +11 -11
- package/dist/versioned-package/components/accordion/accordion.d.ts +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 +3 -3
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +5 -5
- package/dist/versioned-package/components/dialog/dialog.d.ts +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/flipcard/flipcard.d.ts +1 -1
- package/dist/versioned-package/components/flipcard/flipcard.js +1 -1
- 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/map-marker/map-marker.d.ts +1 -1
- package/dist/versioned-package/components/map-marker/map-marker.js +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.js +3 -3
- package/dist/versioned-package/components/notification/notification.d.ts +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 +13 -13
- package/dist/versioned-package/components/scrollable/scrollable.d.ts +1 -1
- package/dist/versioned-package/components/scrollable/scrollable.js +3 -3
- package/dist/versioned-package/components/select/select.d.ts +4 -4
- package/dist/versioned-package/components/select/select.js +25 -25
- 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/step/step.d.ts +1 -1
- package/dist/versioned-package/components/step/step.js +5 -5
- package/dist/versioned-package/components/step-group/step-group.d.ts +1 -1
- package/dist/versioned-package/components/step-group/step-group.js +2 -2
- package/dist/versioned-package/components/switch/switch.d.ts +1 -1
- package/dist/versioned-package/components/switch/switch.js +1 -1
- package/dist/versioned-package/components/tab/tab.d.ts +1 -1
- package/dist/versioned-package/components/tab/tab.js +2 -2
- package/dist/versioned-package/components/tab-group/tab-group.d.ts +1 -1
- package/dist/versioned-package/components/tab-group/tab-group.js +13 -13
- package/dist/versioned-package/components/tab-panel/tab-panel.d.ts +1 -1
- package/dist/versioned-package/components/tab-panel/tab-panel.js +2 -2
- package/dist/versioned-package/components/tag/tag.d.ts +1 -1
- package/dist/versioned-package/components/tag/tag.js +2 -2
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/teaser-media/teaser-media.js +1 -1
- package/dist/versioned-package/components/textarea/textarea.d.ts +1 -1
- package/dist/versioned-package/components/textarea/textarea.js +2 -2
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +1 -1
- package/dist/versioned-package/components/tooltip/tooltip.js +5 -5
- package/dist/versioned-package/components/video/video.d.ts +1 -1
- package/dist/versioned-package/components/video/video.js +2 -2
- package/dist/versioned-package/internal/form.js +3 -3
- package/dist/versioned-package/styles/headline/headline.css.js +1 -1
- package/dist/versioned-package/utilities/autocomplete-config.js +4 -4
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +42 -42
- package/dist/web-types.json +43 -43
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./icon.js";import{S as t,L as e,x as s,t as i,c as l,i as a,e as o,n as r,a as n}from"./solid-components2.js";import{d as p}from"./default-value.js";import{F as h}from"./form.js";import{H as d}from"./slot.js";import{o as u}from"./if-defined.js";import{l as c}from"./live.js";import{r as y}from"./state.js";import{w as m}from"./watch.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 h(this),this.hasSlotController=new d(this,"help-text","label","left","right","message","placeholder"),this.localize=new e(this),this.hasFocus=!1,this.showValidStyle=!1,this.showInvalidStyle=!1,this.type="text",this.size="lg",this.value="",this.defaultValue="",this.placeholder="",this.label="",this.helpText="",this.clearable=!1,this.disabled=!1,this.readonly=!1,this.passwordToggle=!1,this.passwordVisible=!1,this.noSpinButtons=!1,this.form="",this.name="",this.title="",this.required=!1,this.styleOnValid=!1,this.spellcheck=!0}get valueAsDate(){var t;return(null==(t=this.input)?void 0:t.valueAsDate)??null}set valueAsDate(t){const e=document.createElement("input");e.type="date",e.valueAsDate=t,this.value=e.value}get valueAsNumber(){var t;return(null==(t=this.input)?void 0:t.valueAsNumber)??parseFloat(this.value)}set valueAsNumber(t){const e=document.createElement("input");e.type="number",e.valueAsNumber=t,this.value=e.value}get validity(){return this.input.validity}firstUpdated(){this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleChange(){this.value=this.input.value,this.emit("sd-change")}handleClearClick(t){this.value="",this.emit("sd-clear"),this.emit("sd-input"),this.emit("sd-change"),this.input.focus(),t.stopPropagation()}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}handleInput(){this.value=this.input.value,this.formControlController.updateValidity(),this.emit("sd-input")}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}handleKeyDown(t){const e=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;"Enter"===t.key&&!e&&setTimeout((()=>{!t.defaultPrevented&&!t.isComposing&&this.formControlController.submit()}))}handlePasswordToggle(){this.passwordVisible=!this.passwordVisible}handleDisabledChange(){this.formControlController.setValidity(this.disabled)}handleStepChange(){this.input.step=String(this.step),this.formControlController.updateValidity()}async handleValueChange(){await this.updateComplete,this.formControlController.updateValidity()}focus(t){this.input.focus(t)}blur(){this.input.blur()}select(){this.input.select()}setSelectionRange(t,e,s="none"){this.input.setSelectionRange(t,e,s)}setRangeText(t,e,s,i){this.input.setRangeText(t,e,s,i),this.value!==this.input.value&&(this.value=this.input.value)}showPicker(){"showPicker"in HTMLInputElement.prototype&&this.input.showPicker()}stepUp(){this.input.stepUp(),this.value!==this.input.value&&(this.value=this.input.value)}stepDown(){this.input.stepDown(),this.value!==this.input.value&&(this.value=this.input.value)}checkValidity(){var t;return null==(t=this.input)?void 0:t.checkValidity()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.input.reportValidity()}setCustomValidity(t){this.input.setCustomValidity(t),this.formControlController.updateValidity()}render(){const t=this.hasSlotController.test("label"),e=this.hasSlotController.test("help-text"),l=(this.hasSlotController.test("description"),this.hasSlotController.test("left")),a=this.hasSlotController.test("right"),o=!!this.label||!!t,r=!!this.helpText||!!e,n=this.clearable&&!this.readonly&&("number"==typeof this.value||this.value.length>0),p=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",h="sm"===this.size?"text-sm":"text-base",d={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"}[p],y={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"}[p],m=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 s`<div part="form-control" class="${i(this.disabled&&"pointer-events-none")}"><label part="form-control-label" id="label" class="${i("mb-2",o?"inline-block":"hidden",h)}" for="input" aria-hidden="${o?"false":"true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="relative w-full"><div part="border" class="${i("absolute w-full h-full pointer-events-none border rounded-default",y)}"></div><div part="base" class="${i("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",d)}">${l?s`<slot name="left" part="left" class="${i("inline-flex","sm"===this.size?"mr-1":"mr-2",m,v)}"></slot>`:""} <input part="input" id="input" class="${i("min-w-0 flex-grow focus:outline-none bg-transparent placeholder-neutral-700","sm"===this.size?"h-6":"h-8",h)}" type="${"password"===this.type&&this.passwordVisible?"text":this.type}" title="${this.title}" name="${u(this.name)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${u(this.placeholder)}" minlength="${u(this.minlength)}" maxlength="${u(this.maxlength)}" min="${u(this.min)}" max="${u(this.max)}" step="${u(this.step)}" .value="${c(this.value)}" autocapitalize="${u("password"===this.type?"off":this.autocapitalize)}" autocomplete="${u("password"===this.type?"off":this.autocomplete)}" autocorrect="${u("password"===this.type?"off":this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${this.spellcheck}" pattern="${u(this.pattern)}" enterkeyhint="${u(this.enterkeyhint)}" inputmode="${u(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @keydown="${this.handleKeyDown}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${n?s`<button part="clear-button" class="${i("flex justify-center ",b)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${i("text-neutral-500",v)}" library="system" name="closing-round"></sd-icon></slot></button>`:""} ${this.passwordToggle&&"password"===this.type?s`<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?s`<slot name="show-password-icon"><sd-icon class="${i(m,b,v)}" library="system" name="eye"></sd-icon></slot>`:s`<slot name="hide-password-icon"><sd-icon class="${i(m,b,v)}" library="system" name="eye-crossed-out"></sd-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":s`<sd-icon class="${i(m,b,v)}" library="system" name="calendar"></sd-icon>`} ${"time"===this.type?s`<sd-icon class="${i(m,b,v)}" library="system" name="clock"></sd-icon>`:""} ${"search"===this.type?s`<button class="flex items-center" type="button" tabindex="-1"><sd-icon class="${i(m,b,v)}" library="system" name="magnifying-glass"></sd-icon></button>`:""} ${this.showInvalidStyle?s`<sd-icon part="invalid-icon" class="${i("text-error",b,v)}" library="system" name="risk"></sd-icon>`:""} ${this.showValidStyle&&this.styleOnValid?s`<sd-icon class="${i("text-success flex-shrink-0",b,v)}" library="system" name="status-check" part="valid-icon"></sd-icon>`:""} ${a?s`<slot name="right" part="right" class="${i("inline-flex",m,b,v)}"></slot>`:""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${i("text-sm text-neutral-700",r?"block":"hidden")}" aria-hidden="${!r}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`}};x.styles=[l,t.styles,a`: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([o("#input")],x.prototype,"input",2),g([o("#invalid-message")],x.prototype,"invalidMessage",2),g([y()],x.prototype,"hasFocus",2),g([y()],x.prototype,"showValidStyle",2),g([y()],x.prototype,"showInvalidStyle",2),g([r({reflect:!0})],x.prototype,"type",2),g([r({reflect:!0})],x.prototype,"size",2),g([r()],x.prototype,"inputmode",2),g([r()],x.prototype,"value",2),g([p()],x.prototype,"defaultValue",2),g([r()],x.prototype,"placeholder",2),g([r()],x.prototype,"label",2),g([r({attribute:"help-text"})],x.prototype,"helpText",2),g([r({type:Boolean})],x.prototype,"clearable",2),g([r({type:Boolean,reflect:!0})],x.prototype,"disabled",2),g([r({type:Boolean,reflect:!0})],x.prototype,"readonly",2),g([r({attribute:"password-toggle",type:Boolean})],x.prototype,"passwordToggle",2),g([r({attribute:"password-visible",type:Boolean})],x.prototype,"passwordVisible",2),g([r({attribute:"no-spin-buttons",type:Boolean})],x.prototype,"noSpinButtons",2),g([r({type:Number})],x.prototype,"minlength",2),g([r({type:Number})],x.prototype,"maxlength",2),g([r()],x.prototype,"min",2),g([r()],x.prototype,"max",2),g([r({reflect:!0})],x.prototype,"form",2),g([r()],x.prototype,"name",2),g([r()],x.prototype,"title",2),g([r({type:Boolean,reflect:!0})],x.prototype,"required",2),g([r()],x.prototype,"pattern",2),g([r()],x.prototype,"step",2),g([r()],x.prototype,"autocapitalize",2),g([r()],x.prototype,"autocorrect",2),g([r()],x.prototype,"autocomplete",2),g([r({type:Boolean})],x.prototype,"autofocus",2),g([r()],x.prototype,"enterkeyhint",2),g([r({type:Boolean,reflect:!0,attribute:"style-on-valid"})],x.prototype,"styleOnValid",2),g([r({type:Boolean,converter:{fromAttribute:t=>!(!t||"false"===t),toAttribute:t=>t?"true":"false"}})],x.prototype,"spellcheck",2),g([m("disabled",{waitUntilFirstUpdate:!0})],x.prototype,"handleDisabledChange",1),g([m("step",{waitUntilFirstUpdate:!0})],x.prototype,"handleStepChange",1),g([m("value",{waitUntilFirstUpdate:!0})],x.prototype,"handleValueChange",1),x=g([n("sd-input")],x);export{x as default};
|
|
1
|
+
import"./icon.js";import{S as t,L as e,x as s,t as i,c as l,i as a,e as o,n as r,a as n}from"./solid-components2.js";import{d as p}from"./default-value.js";import{F as h}from"./form.js";import{H as d}from"./slot.js";import{o as u}from"./if-defined.js";import{l as c}from"./live.js";import{r as y}from"./state.js";import{w as m}from"./watch.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 h(this),this.hasSlotController=new d(this,"help-text","label","left","right","message","placeholder"),this.localize=new e(this),this.hasFocus=!1,this.showValidStyle=!1,this.showInvalidStyle=!1,this.type="text",this.size="lg",this.value="",this.defaultValue="",this.placeholder="",this.label="",this.helpText="",this.clearable=!1,this.disabled=!1,this.readonly=!1,this.passwordToggle=!1,this.passwordVisible=!1,this.noSpinButtons=!1,this.form="",this.name="",this.title="",this.required=!1,this.styleOnValid=!1,this.spellcheck=!0}get valueAsDate(){var t;return(null==(t=this.input)?void 0:t.valueAsDate)??null}set valueAsDate(t){const e=document.createElement("input");e.type="date",e.valueAsDate=t,this.value=e.value}get valueAsNumber(){var t;return(null==(t=this.input)?void 0:t.valueAsNumber)??parseFloat(this.value)}set valueAsNumber(t){const e=document.createElement("input");e.type="number",e.valueAsNumber=t,this.value=e.value}get validity(){return this.input.validity}firstUpdated(){this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleChange(){this.value=this.input.value,this.emit("sd-change")}handleClearClick(t){this.value="",this.emit("sd-clear"),this.emit("sd-input"),this.emit("sd-change"),this.input.focus(),t.stopPropagation()}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}handleInput(){this.value=this.input.value,this.formControlController.updateValidity(),this.emit("sd-input")}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}handleKeyDown(t){const e=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;"Enter"===t.key&&!e&&setTimeout((()=>{!t.defaultPrevented&&!t.isComposing&&this.formControlController.submit()}))}handlePasswordToggle(){this.passwordVisible=!this.passwordVisible}handleDisabledChange(){this.formControlController.setValidity(this.disabled)}handleStepChange(){this.input.step=String(this.step),this.formControlController.updateValidity()}async handleValueChange(){await this.updateComplete,this.formControlController.updateValidity()}focus(t){this.input.focus(t)}blur(){this.input.blur()}select(){this.input.select()}setSelectionRange(t,e,s="none"){this.input.setSelectionRange(t,e,s)}setRangeText(t,e,s,i){this.input.setRangeText(t,e,s,i),this.value!==this.input.value&&(this.value=this.input.value)}showPicker(){"showPicker"in HTMLInputElement.prototype&&this.input.showPicker()}stepUp(){this.input.stepUp(),this.value!==this.input.value&&(this.value=this.input.value)}stepDown(){this.input.stepDown(),this.value!==this.input.value&&(this.value=this.input.value)}checkValidity(){var t;return null==(t=this.input)?void 0:t.checkValidity()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.input.reportValidity()}setCustomValidity(t){this.input.setCustomValidity(t),this.formControlController.updateValidity()}render(){const t=this.hasSlotController.test("label"),e=this.hasSlotController.test("help-text"),l=(this.hasSlotController.test("description"),this.hasSlotController.test("left")),a=this.hasSlotController.test("right"),o=!!this.label||!!t,r=!!this.helpText||!!e,n=this.clearable&&!this.readonly&&("number"==typeof this.value||this.value.length>0),p=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",h="sm"===this.size?"text-sm":"text-base",d={disabled:"text-neutral-500",readonly:"text-black",activeInvalid:"text-error",activeValid:"text-black",active:"text-black",invalid:"text-error",valid:"text-black",default:"text-black"}[p],y={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"}[p],m=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 s`<div part="form-control" class="${i(this.disabled&&"pointer-events-none")}"><label part="form-control-label" id="label" class="${i("mb-2",o?"inline-block":"hidden",h)}" for="input" aria-hidden="${o?"false":"true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="relative w-full"><div part="border" class="${i("absolute w-full h-full pointer-events-none border rounded-default",y)}"></div><div part="base" class="${i("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",d)}">${l?s`<slot name="left" part="left" class="${i("inline-flex","sm"===this.size?"mr-1":"mr-2",m,v)}"></slot>`:""} <input part="input" id="input" class="${i("min-w-0 flex-grow focus:outline-none bg-transparent placeholder-neutral-700","sm"===this.size?"h-6":"h-8",h)}" type="${"password"===this.type&&this.passwordVisible?"text":this.type}" title="${this.title}" name="${u(this.name)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${u(this.placeholder)}" minlength="${u(this.minlength)}" maxlength="${u(this.maxlength)}" min="${u(this.min)}" max="${u(this.max)}" step="${u(this.step)}" .value="${c(this.value)}" autocapitalize="${u("password"===this.type?"off":this.autocapitalize)}" autocomplete="${u("password"===this.type?"off":this.autocomplete)}" autocorrect="${u("password"===this.type?"off":this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${this.spellcheck}" pattern="${u(this.pattern)}" enterkeyhint="${u(this.enterkeyhint)}" inputmode="${u(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @keydown="${this.handleKeyDown}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${n?s`<button part="clear-button" class="${i("flex justify-center ",b)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${i("icon-fill-neutral-800",v)}" library="system" name="closing-round"></sd-icon></slot></button>`:""} ${this.passwordToggle&&"password"===this.type?s`<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?s`<slot name="show-password-icon"><sd-icon class="${i(m,b,v)}" library="system" name="eye"></sd-icon></slot>`:s`<slot name="hide-password-icon"><sd-icon class="${i(m,b,v)}" library="system" name="eye-crossed-out"></sd-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":s`<sd-icon class="${i(m,b,v)}" library="system" name="calendar"></sd-icon>`} ${"time"===this.type?s`<sd-icon class="${i(m,b,v)}" library="system" name="clock"></sd-icon>`:""} ${"search"===this.type?s`<button class="flex items-center" type="button" tabindex="-1"><sd-icon class="${i(m,b,v)}" library="system" name="magnifying-glass"></sd-icon></button>`:""} ${this.showInvalidStyle?s`<sd-icon part="invalid-icon" class="${i("text-error",b,v)}" library="system" name="risk"></sd-icon>`:""} ${this.showValidStyle&&this.styleOnValid?s`<sd-icon class="${i("text-success flex-shrink-0",b,v)}" library="system" name="status-check" part="valid-icon"></sd-icon>`:""} ${a?s`<slot name="right" part="right" class="${i("inline-flex",m,b,v)}"></slot>`:""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${i("text-sm text-neutral-700",r?"block":"hidden")}" aria-hidden="${!r}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`}};x.styles=[l,t.styles,a`: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([o("#input")],x.prototype,"input",2),g([o("#invalid-message")],x.prototype,"invalidMessage",2),g([y()],x.prototype,"hasFocus",2),g([y()],x.prototype,"showValidStyle",2),g([y()],x.prototype,"showInvalidStyle",2),g([r({reflect:!0})],x.prototype,"type",2),g([r({reflect:!0})],x.prototype,"size",2),g([r()],x.prototype,"inputmode",2),g([r()],x.prototype,"value",2),g([p()],x.prototype,"defaultValue",2),g([r()],x.prototype,"placeholder",2),g([r()],x.prototype,"label",2),g([r({attribute:"help-text"})],x.prototype,"helpText",2),g([r({type:Boolean})],x.prototype,"clearable",2),g([r({type:Boolean,reflect:!0})],x.prototype,"disabled",2),g([r({type:Boolean,reflect:!0})],x.prototype,"readonly",2),g([r({attribute:"password-toggle",type:Boolean})],x.prototype,"passwordToggle",2),g([r({attribute:"password-visible",type:Boolean})],x.prototype,"passwordVisible",2),g([r({attribute:"no-spin-buttons",type:Boolean})],x.prototype,"noSpinButtons",2),g([r({type:Number})],x.prototype,"minlength",2),g([r({type:Number})],x.prototype,"maxlength",2),g([r()],x.prototype,"min",2),g([r()],x.prototype,"max",2),g([r({reflect:!0})],x.prototype,"form",2),g([r()],x.prototype,"name",2),g([r()],x.prototype,"title",2),g([r({type:Boolean,reflect:!0})],x.prototype,"required",2),g([r()],x.prototype,"pattern",2),g([r()],x.prototype,"step",2),g([r()],x.prototype,"autocapitalize",2),g([r()],x.prototype,"autocorrect",2),g([r()],x.prototype,"autocomplete",2),g([r({type:Boolean})],x.prototype,"autofocus",2),g([r()],x.prototype,"enterkeyhint",2),g([r({type:Boolean,reflect:!0,attribute:"style-on-valid"})],x.prototype,"styleOnValid",2),g([r({type:Boolean,converter:{fromAttribute:t=>!(!t||"false"===t),toAttribute:t=>t?"true":"false"}})],x.prototype,"spellcheck",2),g([m("disabled",{waitUntilFirstUpdate:!0})],x.prototype,"handleDisabledChange",1),g([m("step",{waitUntilFirstUpdate:!0})],x.prototype,"handleStepChange",1),g([m("value",{waitUntilFirstUpdate:!0})],x.prototype,"handleValueChange",1),x=g([n("sd-input")],x);export{x as default};
|
|
@@ -4,4 +4,4 @@ import{s as t,a as e,w as s}from"./event.js";import{S as i,L as o,x as l,t as a,
|
|
|
4
4
|
removable-indicator:tag__removable-indicator,
|
|
5
5
|
" size="${"sm"===this.size?"sm":"lg"}" removable @sd-remove="${e=>this.handleTagRemove(e,t)}">${t.getTextLabel()}</sd-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-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-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-input"),this.emit("sd-change")})))}handleClearMouseDown(t){t.stopPropagation(),t.preventDefault()}handleOptionClick(t){const e=t.target.closest("sd-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-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-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-option").then((()=>this.handleDefaultSlotChange()))}handleTagRemove(t,e){t.stopPropagation(),this.disabled||(this.toggleOptionSelection(e,!1),this.updateComplete.then((()=>{this.emit("sd-input"),this.emit("sd-change")})))}getAllOptions(){return[...this.querySelectorAll("sd-option")]}getFirstOption(){return this.querySelector("sd-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 l`<div @sd-remove="${e=>this.handleTagRemove(e,t)}">${"string"==typeof s?w(s):s}</div>`}return e===this.maxOptionsVisible?l`<sd-tag size="${"sm"===this.size?"sm":"lg"}" ?disabled="${this.disabled}">+${this.selectedOptions.length-e}</sd-tag>`:l``}))}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-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}=y(this,"select.show",{dir:this.localize.dir()});await e(this.popup.popup,s,i),this.currentOption&&x(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}=y(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,o=this.clearable&&!this.disabled&&this.value.length>0,n=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",r=this.disabled?"cursor-not-allowed":"cursor-pointer",h={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],d={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return l`<div part="form-control" class="${a("relative text-left",r,"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="${a("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"}[n])}"><div part="border" class="${a("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"}[n],this.open&&("bottom"===this.currentPlacement?"rounded-bl-none rounded-br-none":"rounded-tl-none rounded-tr-none"))}"></div><sd-popup @sd-current-placement="${this.handleCurrentPlacement}" class="${a("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="${a("relative w-full px-4 flex flex-row items-center rounded-default",this.open&&"shadow",{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="${a("appearance-none outline-none flex-grow bg-transparent w-full",r,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?l`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>`:""} <input class="${a("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10",r)}" 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}"> ${o?l`<button part="clear-button" class="${a("select__clear flex justify-center",h)}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.handleClearMouseDown}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${a("text-neutral-
|
|
7
|
+
"><div part="combobox" class="${a("relative w-full px-4 flex flex-row items-center rounded-default",this.open&&"shadow",{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="${a("appearance-none outline-none flex-grow bg-transparent w-full",r,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?l`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>`:""} <input class="${a("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10",r)}" 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}"> ${o?l`<button part="clear-button" class="${a("select__clear flex justify-center",h)}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.handleClearMouseDown}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${a("text-icon-fill-neutral-800",d)}" library="system" name="closing-round"></sd-icon></slot></button>`:""} ${this.showInvalidStyle?l`<sd-icon part="invalid-icon" class="${a(h,d)}" library="system" name="risk"></sd-icon>`:""} ${this.styleOnValid&&this.showValidStyle?l`<sd-icon part="valid-icon" class="${a("flex-shrink-0",h,d)}" library="system" name="status-check"></sd-icon>`:""}<slot name="expand-icon" part="expand-icon" class="${a("inline-flex ml-2 transition-all",this.open?"rotate-180":"rotate-0",this.disabled?"text-neutral-500":"text-primary",d)}"><sd-icon name="chevron-down" part="chevron" library="system" color="currentColor"></sd-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="${a("bg-white px-2 py-3 relative border-primary",this.open&&"shadow","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-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-icon":O,"sd-popup":n,"sd-tag":S},I.styles=[r,i.styles,h`:host{position:relative;display:block;width:100%}:host([required]) #label::after{content:' *'}sd-popup::part(popup){z-index:var(--sd-z-index-dropdown,900);overflow-y:scroll}sd-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-tag[size=lg]::part(base){padding-left:var(--sd-spacing-2,.5rem);padding-right:var(--sd-spacing-2,.5rem)}sd-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([g({selector:"sd-option"})],I.prototype,"_optionsInDefaultSlot",2),D([d("sd-popup")],I.prototype,"popup",2),D([d('[part="combobox"]')],I.prototype,"combobox",2),D([d('[part="display-input"]')],I.prototype,"displayInput",2),D([d(".value-input")],I.prototype,"valueInput",2),D([d('[part="listbox"]')],I.prototype,"listbox",2),D([d("#invalid-message")],I.prototype,"invalidMessage",2),D([f()],I.prototype,"hasHover",2),D([f()],I.prototype,"displayLabel",2),D([f()],I.prototype,"hasFocus",2),D([f()],I.prototype,"currentOption",2),D([f()],I.prototype,"selectedOptions",2),D([f()],I.prototype,"showValidStyle",2),D([f()],I.prototype,"showInvalidStyle",2),D([u()],I.prototype,"defaultValue",2),D([p({type:Boolean,reflect:!0})],I.prototype,"open",2),D([p({reflect:!0})],I.prototype,"size",2),D([p()],I.prototype,"label",2),D([p()],I.prototype,"placeholder",2),D([p({attribute:"help-text"})],I.prototype,"helpText",2),D([p({reflect:!0})],I.prototype,"placement",2),D([f()],I.prototype,"currentPlacement",2),D([p({type:Boolean})],I.prototype,"clearable",2),D([p({type:Boolean,reflect:!0})],I.prototype,"disabled",2),D([p({type:Boolean,reflect:!0})],I.prototype,"multiple",2),D([p({type:Boolean,reflect:!0})],I.prototype,"useTags",2),D([p({attribute:"max-options-visible",type:Number})],I.prototype,"maxOptionsVisible",2),D([p({reflect:!0})],I.prototype,"form",2),D([p()],I.prototype,"name",2),D([p({converter:{fromAttribute:t=>t.split(" "),toAttribute:t=>t.join(" ")}})],I.prototype,"value",2),D([p({type:Boolean,reflect:!0})],I.prototype,"required",2),D([p({type:Boolean,reflect:!0,attribute:"style-on-valid"})],I.prototype,"styleOnValid",2),D([p({type:Boolean})],I.prototype,"hoist",2),D([p()],I.prototype,"getTag",2),D([C("useTags",{waitUntilFirstUpdate:!0})],I.prototype,"handleUseTagsChange",1),D([C("disabled",{waitUntilFirstUpdate:!0})],I.prototype,"handleDisabledChange",1),D([C("open",{waitUntilFirstUpdate:!0})],I.prototype,"handleOpenChange",1),D([C("size",{waitUntilFirstUpdate:!0})],I.prototype,"applySizeToOptions",1),D([C("value",{waitUntilFirstUpdate:!0})],I.prototype,"handleValueChange",1),I=D([c("sd-select")],I),b("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),b("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});export{I as default};
|