@solid-design-system/components 3.21.0 → 3.22.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +0 -12
- package/README.md +4 -2
- package/dist/components/es/button.js +1 -1
- package/dist/components/umd/solid-components.js +1 -1
- package/dist/custom-elements.json +1 -1
- package/dist/package/_components/button-group/button-group.d.ts +1 -1
- package/dist/package/components/accordion/accordion.d.ts +1 -1
- package/dist/package/components/accordion-group/accordion-group.d.ts +1 -1
- package/dist/package/components/audio/audio.d.ts +1 -1
- package/dist/package/components/badge/badge.d.ts +1 -1
- package/dist/package/components/brandshape/brandshape.d.ts +1 -1
- package/dist/package/components/button/button.d.ts +1 -1
- package/dist/package/components/button/button.js +6 -6
- package/dist/package/components/carousel/carousel.d.ts +1 -1
- package/dist/package/components/carousel-item/carousel-item.d.ts +1 -1
- package/dist/package/components/checkbox/checkbox.d.ts +1 -1
- package/dist/package/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/package/components/dialog/dialog.d.ts +1 -1
- package/dist/package/components/divider/divider.d.ts +1 -1
- package/dist/package/components/drawer/drawer.d.ts +1 -1
- package/dist/package/components/dropdown/dropdown.d.ts +1 -1
- package/dist/package/components/expandable/expandable.d.ts +1 -1
- package/dist/package/components/flipcard/flipcard.d.ts +1 -1
- package/dist/package/components/header/header.d.ts +1 -1
- package/dist/package/components/icon/icon.d.ts +1 -1
- package/dist/package/components/include/include.d.ts +1 -1
- package/dist/package/components/input/input.d.ts +1 -1
- package/dist/package/components/link/link.d.ts +1 -1
- package/dist/package/components/map-marker/map-marker.d.ts +1 -1
- package/dist/package/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/package/components/notification/notification.d.ts +1 -1
- package/dist/package/components/option/option.d.ts +1 -1
- package/dist/package/components/popup/popup.d.ts +1 -1
- package/dist/package/components/quickfact/quickfact.d.ts +1 -1
- package/dist/package/components/radio/radio.d.ts +1 -1
- package/dist/package/components/radio-button/radio-button.d.ts +1 -1
- package/dist/package/components/radio-group/radio-group.d.ts +1 -1
- package/dist/package/components/scrollable/scrollable.d.ts +1 -1
- package/dist/package/components/spinner/spinner.d.ts +1 -1
- package/dist/package/components/step/step.d.ts +1 -1
- package/dist/package/components/step-group/step-group.d.ts +1 -1
- package/dist/package/components/switch/switch.d.ts +1 -1
- package/dist/package/components/tab/tab.d.ts +1 -1
- package/dist/package/components/tab-group/tab-group.d.ts +1 -1
- package/dist/package/components/tab-panel/tab-panel.d.ts +1 -1
- package/dist/package/components/tag/tag.d.ts +1 -1
- package/dist/package/components/teaser/teaser.d.ts +1 -1
- package/dist/package/components/teaser-media/teaser-media.d.ts +1 -1
- package/dist/package/components/textarea/textarea.d.ts +1 -1
- package/dist/package/components/tooltip/tooltip.d.ts +1 -1
- package/dist/package/components/video/video.d.ts +1 -1
- package/dist/package/internal/form.d.ts +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/audio.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/expandable.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/quickfact.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 +2 -2
- package/dist/versioned-package/_components/button-group/button-group.js +11 -11
- package/dist/versioned-package/components/accordion/accordion.d.ts +2 -2
- package/dist/versioned-package/components/accordion/accordion.js +2 -2
- package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +2 -2
- package/dist/versioned-package/components/accordion-group/accordion-group.js +3 -3
- package/dist/versioned-package/components/audio/audio.d.ts +2 -2
- package/dist/versioned-package/components/audio/audio.js +6 -6
- package/dist/versioned-package/components/badge/badge.d.ts +2 -2
- package/dist/versioned-package/components/badge/badge.js +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.d.ts +2 -2
- package/dist/versioned-package/components/brandshape/brandshape.js +1 -1
- package/dist/versioned-package/components/button/button.d.ts +2 -2
- package/dist/versioned-package/components/button/button.js +10 -10
- package/dist/versioned-package/components/carousel/carousel.d.ts +2 -2
- package/dist/versioned-package/components/carousel/carousel.js +6 -6
- package/dist/versioned-package/components/carousel-item/carousel-item.d.ts +2 -2
- package/dist/versioned-package/components/carousel-item/carousel-item.js +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.d.ts +2 -2
- package/dist/versioned-package/components/checkbox/checkbox.js +3 -3
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +2 -2
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +5 -5
- package/dist/versioned-package/components/dialog/dialog.d.ts +2 -2
- package/dist/versioned-package/components/dialog/dialog.js +2 -2
- package/dist/versioned-package/components/divider/divider.d.ts +2 -2
- package/dist/versioned-package/components/divider/divider.js +2 -2
- package/dist/versioned-package/components/drawer/drawer.d.ts +2 -2
- package/dist/versioned-package/components/drawer/drawer.js +2 -2
- package/dist/versioned-package/components/dropdown/dropdown.d.ts +2 -2
- package/dist/versioned-package/components/dropdown/dropdown.js +8 -8
- package/dist/versioned-package/components/expandable/expandable.d.ts +2 -2
- package/dist/versioned-package/components/expandable/expandable.js +2 -2
- package/dist/versioned-package/components/flipcard/flipcard.d.ts +2 -2
- package/dist/versioned-package/components/flipcard/flipcard.js +1 -1
- package/dist/versioned-package/components/header/header.d.ts +2 -2
- package/dist/versioned-package/components/header/header.js +4 -4
- package/dist/versioned-package/components/icon/icon.d.ts +2 -2
- package/dist/versioned-package/components/icon/icon.js +1 -1
- package/dist/versioned-package/components/include/include.d.ts +2 -2
- package/dist/versioned-package/components/include/include.js +1 -1
- package/dist/versioned-package/components/input/input.d.ts +2 -2
- package/dist/versioned-package/components/input/input.js +2 -2
- package/dist/versioned-package/components/link/link.d.ts +2 -2
- package/dist/versioned-package/components/link/link.js +2 -2
- package/dist/versioned-package/components/map-marker/map-marker.d.ts +2 -2
- package/dist/versioned-package/components/map-marker/map-marker.js +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +2 -2
- package/dist/versioned-package/components/navigation-item/navigation-item.js +5 -5
- package/dist/versioned-package/components/notification/notification.d.ts +2 -2
- package/dist/versioned-package/components/notification/notification.js +5 -5
- package/dist/versioned-package/components/option/option.d.ts +2 -2
- package/dist/versioned-package/components/option/option.js +2 -2
- package/dist/versioned-package/components/popup/popup.d.ts +2 -2
- package/dist/versioned-package/components/popup/popup.js +1 -1
- package/dist/versioned-package/components/quickfact/quickfact.d.ts +2 -2
- package/dist/versioned-package/components/quickfact/quickfact.js +2 -2
- package/dist/versioned-package/components/radio/radio.d.ts +2 -2
- package/dist/versioned-package/components/radio/radio.js +2 -2
- package/dist/versioned-package/components/radio-button/radio-button.d.ts +2 -2
- package/dist/versioned-package/components/radio-button/radio-button.js +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +3 -3
- package/dist/versioned-package/components/radio-group/radio-group.js +13 -13
- package/dist/versioned-package/components/scrollable/scrollable.d.ts +2 -2
- 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 +2 -2
- package/dist/versioned-package/components/spinner/spinner.js +1 -1
- package/dist/versioned-package/components/step/step.d.ts +2 -2
- package/dist/versioned-package/components/step/step.js +2 -2
- package/dist/versioned-package/components/step-group/step-group.d.ts +2 -2
- package/dist/versioned-package/components/step-group/step-group.js +2 -2
- package/dist/versioned-package/components/switch/switch.d.ts +2 -2
- package/dist/versioned-package/components/switch/switch.js +1 -1
- package/dist/versioned-package/components/tab/tab.d.ts +2 -2
- package/dist/versioned-package/components/tab/tab.js +2 -2
- package/dist/versioned-package/components/tab-group/tab-group.d.ts +2 -2
- package/dist/versioned-package/components/tab-group/tab-group.js +13 -13
- package/dist/versioned-package/components/tab-panel/tab-panel.d.ts +2 -2
- package/dist/versioned-package/components/tab-panel/tab-panel.js +2 -2
- package/dist/versioned-package/components/tag/tag.d.ts +2 -2
- package/dist/versioned-package/components/tag/tag.js +2 -2
- package/dist/versioned-package/components/teaser/teaser.d.ts +1 -1
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/teaser-media/teaser-media.d.ts +1 -1
- package/dist/versioned-package/components/teaser-media/teaser-media.js +1 -1
- package/dist/versioned-package/components/textarea/textarea.d.ts +2 -2
- package/dist/versioned-package/components/textarea/textarea.js +2 -2
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +2 -2
- package/dist/versioned-package/components/tooltip/tooltip.js +5 -5
- package/dist/versioned-package/components/video/video.d.ts +2 -2
- package/dist/versioned-package/components/video/video.js +2 -2
- package/dist/versioned-package/internal/form.d.ts +1 -1
- 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 +45 -45
- package/dist/web-types.json +46 -46
- package/package.json +6 -34
@@ -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 $=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:"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],y=this.disabled?"text-neutral-500":"text-primary",m={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],b={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return s`<div part="form-control" class="${i(this.disabled&&"pointer-events-none")}"><div class="flex items-center gap-1 mb-2"><label part="form-control-label" id="label" class="${i(o?"inline-block":"hidden",h)}" for="input" aria-hidden="${o?"false":"true"}"><slot name="label">${this.label}</slot></label><slot name="tooltip"></slot></div><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",d)}"></div><div part="base" class="${i("px-4 flex flex-row items-center rounded-default transition-all","lg"===this.size?"py-2":"py-1",this.disabled||this.readonly?"":"hover:bg-neutral-200",this.readonly?"bg-neutral-100":"bg-white","disabled"===p?"text-neutral-500":"text-black")}">${l?s`<slot name="left" part="left" class="${i("inline-flex","sm"===this.size?"mr-1":"mr-2",y,b)}"></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 ",m)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-3-21-0-icon class="${i("icon-fill-neutral-800",b)}" library="system" name="closing-round"></sd-3-21-0-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-3-21-0-icon class="${i(y,m,b)}" library="system" name="eye"></sd-3-21-0-icon></slot>`:s`<slot name="hide-password-icon"><sd-3-21-0-icon class="${i(y,m,b)}" library="system" name="eye-crossed-out"></sd-3-21-0-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":s`<sd-3-21-0-icon class="${i(y,m,b)}" library="system" name="calendar"></sd-3-21-0-icon>`} ${"time"===this.type?s`<sd-3-21-0-icon class="${i(y,m,b)}" library="system" name="clock"></sd-3-21-0-icon>`:""} ${"search"===this.type?s`<button class="flex items-center" type="button" tabindex="-1"><sd-3-21-0-icon class="${i(y,m,b)}" library="system" name="magnifying-glass"></sd-3-21-0-icon></button>`:""} ${this.showInvalidStyle?s`<sd-3-21-0-icon part="invalid-icon" class="${i("text-error",m,b)}" library="system" name="risk"></sd-3-21-0-icon>`:""} ${this.showValidStyle&&this.styleOnValid?s`<sd-3-21-0-icon class="${i("text-success flex-shrink-0",m,b)}" library="system" name="status-check" part="valid-icon"></sd-3-21-0-icon>`:""} ${a?s`<slot name="right" part="right" class="${i("inline-flex",y,m,b)}"></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()}`}};$.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")],$.prototype,"input",2),g([o("#invalid-message")],$.prototype,"invalidMessage",2),g([y()],$.prototype,"hasFocus",2),g([y()],$.prototype,"showValidStyle",2),g([y()],$.prototype,"showInvalidStyle",2),g([r({reflect:!0})],$.prototype,"type",2),g([r({reflect:!0})],$.prototype,"size",2),g([r()],$.prototype,"inputmode",2),g([r()],$.prototype,"value",2),g([p()],$.prototype,"defaultValue",2),g([r()],$.prototype,"placeholder",2),g([r()],$.prototype,"label",2),g([r({attribute:"help-text"})],$.prototype,"helpText",2),g([r({type:Boolean})],$.prototype,"clearable",2),g([r({type:Boolean,reflect:!0})],$.prototype,"disabled",2),g([r({type:Boolean,reflect:!0})],$.prototype,"readonly",2),g([r({attribute:"password-toggle",type:Boolean})],$.prototype,"passwordToggle",2),g([r({attribute:"password-visible",type:Boolean})],$.prototype,"passwordVisible",2),g([r({attribute:"no-spin-buttons",type:Boolean})],$.prototype,"noSpinButtons",2),g([r({type:Number})],$.prototype,"minlength",2),g([r({type:Number})],$.prototype,"maxlength",2),g([r()],$.prototype,"min",2),g([r()],$.prototype,"max",2),g([r({reflect:!0})],$.prototype,"form",2),g([r()],$.prototype,"name",2),g([r()],$.prototype,"title",2),g([r({type:Boolean,reflect:!0})],$.prototype,"required",2),g([r()],$.prototype,"pattern",2),g([r()],$.prototype,"step",2),g([r()],$.prototype,"autocapitalize",2),g([r()],$.prototype,"autocorrect",2),g([r()],$.prototype,"autocomplete",2),g([r({type:Boolean})],$.prototype,"autofocus",2),g([r()],$.prototype,"enterkeyhint",2),g([r({type:Boolean,reflect:!0,attribute:"style-on-valid"})],$.prototype,"styleOnValid",2),g([r({type:Boolean,converter:{fromAttribute:t=>!(!t||"false"===t),toAttribute:t=>t?"true":"false"}})],$.prototype,"spellcheck",2),g([m("disabled",{waitUntilFirstUpdate:!0})],$.prototype,"handleDisabledChange",1),g([m("step",{waitUntilFirstUpdate:!0})],$.prototype,"handleStepChange",1),g([m("value",{waitUntilFirstUpdate:!0})],$.prototype,"handleValueChange",1),$=g([n("sd-3-21-0-input")],$);export{$ 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 $=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:"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],y=this.disabled?"text-neutral-500":"text-primary",m={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],b={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return s`<div part="form-control" class="${i(this.disabled&&"pointer-events-none")}"><div class="flex items-center gap-1 mb-2"><label part="form-control-label" id="label" class="${i(o?"inline-block":"hidden",h)}" for="input" aria-hidden="${o?"false":"true"}"><slot name="label">${this.label}</slot></label><slot name="tooltip"></slot></div><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",d)}"></div><div part="base" class="${i("px-4 flex flex-row items-center rounded-default transition-all","lg"===this.size?"py-2":"py-1",this.disabled||this.readonly?"":"hover:bg-neutral-200",this.readonly?"bg-neutral-100":"bg-white","disabled"===p?"text-neutral-500":"text-black")}">${l?s`<slot name="left" part="left" class="${i("inline-flex","sm"===this.size?"mr-1":"mr-2",y,b)}"></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 ",m)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-3-22-0-icon class="${i("icon-fill-neutral-800",b)}" library="system" name="closing-round"></sd-3-22-0-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-3-22-0-icon class="${i(y,m,b)}" library="system" name="eye"></sd-3-22-0-icon></slot>`:s`<slot name="hide-password-icon"><sd-3-22-0-icon class="${i(y,m,b)}" library="system" name="eye-crossed-out"></sd-3-22-0-icon></slot>`}</button>`:""} ${"date"!==this.type&&"datetime-local"!==this.type||w?"":s`<sd-3-22-0-icon class="${i(y,m,b)}" library="system" name="calendar"></sd-3-22-0-icon>`} ${"time"===this.type?s`<sd-3-22-0-icon class="${i(y,m,b)}" library="system" name="clock"></sd-3-22-0-icon>`:""} ${"search"===this.type?s`<button class="flex items-center" type="button" tabindex="-1"><sd-3-22-0-icon class="${i(y,m,b)}" library="system" name="magnifying-glass"></sd-3-22-0-icon></button>`:""} ${this.showInvalidStyle?s`<sd-3-22-0-icon part="invalid-icon" class="${i("text-error",m,b)}" library="system" name="risk"></sd-3-22-0-icon>`:""} ${this.showValidStyle&&this.styleOnValid?s`<sd-3-22-0-icon class="${i("text-success flex-shrink-0",m,b)}" library="system" name="status-check" part="valid-icon"></sd-3-22-0-icon>`:""} ${a?s`<slot name="right" part="right" class="${i("inline-flex",y,m,b)}"></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()}`}};$.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")],$.prototype,"input",2),g([o("#invalid-message")],$.prototype,"invalidMessage",2),g([y()],$.prototype,"hasFocus",2),g([y()],$.prototype,"showValidStyle",2),g([y()],$.prototype,"showInvalidStyle",2),g([r({reflect:!0})],$.prototype,"type",2),g([r({reflect:!0})],$.prototype,"size",2),g([r()],$.prototype,"inputmode",2),g([r()],$.prototype,"value",2),g([p()],$.prototype,"defaultValue",2),g([r()],$.prototype,"placeholder",2),g([r()],$.prototype,"label",2),g([r({attribute:"help-text"})],$.prototype,"helpText",2),g([r({type:Boolean})],$.prototype,"clearable",2),g([r({type:Boolean,reflect:!0})],$.prototype,"disabled",2),g([r({type:Boolean,reflect:!0})],$.prototype,"readonly",2),g([r({attribute:"password-toggle",type:Boolean})],$.prototype,"passwordToggle",2),g([r({attribute:"password-visible",type:Boolean})],$.prototype,"passwordVisible",2),g([r({attribute:"no-spin-buttons",type:Boolean})],$.prototype,"noSpinButtons",2),g([r({type:Number})],$.prototype,"minlength",2),g([r({type:Number})],$.prototype,"maxlength",2),g([r()],$.prototype,"min",2),g([r()],$.prototype,"max",2),g([r({reflect:!0})],$.prototype,"form",2),g([r()],$.prototype,"name",2),g([r()],$.prototype,"title",2),g([r({type:Boolean,reflect:!0})],$.prototype,"required",2),g([r()],$.prototype,"pattern",2),g([r()],$.prototype,"step",2),g([r()],$.prototype,"autocapitalize",2),g([r()],$.prototype,"autocorrect",2),g([r()],$.prototype,"autocomplete",2),g([r({type:Boolean})],$.prototype,"autofocus",2),g([r()],$.prototype,"enterkeyhint",2),g([r({type:Boolean,reflect:!0,attribute:"style-on-valid"})],$.prototype,"styleOnValid",2),g([r({type:Boolean,converter:{fromAttribute:t=>!(!t||"false"===t),toAttribute:t=>t?"true":"false"}})],$.prototype,"spellcheck",2),g([m("disabled",{waitUntilFirstUpdate:!0})],$.prototype,"handleDisabledChange",1),g([m("step",{waitUntilFirstUpdate:!0})],$.prototype,"handleStepChange",1),g([m("value",{waitUntilFirstUpdate:!0})],$.prototype,"handleValueChange",1),$=g([n("sd-3-22-0-input")],$);export{$ as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{S as t,x as e,t as s,i,e as o,n as r,a as n}from"./solid-components2.js";import{H as l}from"./slot.js";import{o as a}from"./if-defined.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,n=t.length-1;n>=0;n--)(o=t[n])&&(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 l(this,"[default]","icon-left","icon-right"),this.standalone=!1,this.size="inherit",this.inverted=!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="${s("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="${a(this.href||void 0)}" target="${a(this.target||void 0)}" download="${a(this.download)}" rel="${a(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="${s("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="${s("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,i`::slotted(sd-3-
|
1
|
+
import{S as t,x as e,t as s,i,e as o,n as r,a as n}from"./solid-components2.js";import{H as l}from"./slot.js";import{o as a}from"./if-defined.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,n=t.length-1;n>=0;n--)(o=t[n])&&(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 l(this,"[default]","icon-left","icon-right"),this.standalone=!1,this.size="inherit",this.inverted=!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="${s("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="${a(this.href||void 0)}" target="${a(this.target||void 0)}" download="${a(this.download)}" rel="${a(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="${s("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="${s("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,i`::slotted(sd-3-22-0-icon){font-size:1.25em;margin-bottom:-.25em}:host([size=sm][standalone]) ::slotted(sd-3-22-0-icon){font-size:var(--sd-font-size-base,1rem)}:host([size=lg][standalone]) ::slotted(sd-3-22-0-icon){font-size:var(--sd-font-size-xl,1.5rem)}`],f([o("a")],c.prototype,"button",2),f([r({type:Boolean,reflect:!0})],c.prototype,"standalone",2),f([r({reflect:!0})],c.prototype,"size",2),f([r({type:Boolean,reflect:!0})],c.prototype,"inverted",2),f([r()],c.prototype,"href",2),f([r()],c.prototype,"target",2),f([r()],c.prototype,"download",2),c=f([n("sd-3-22-0-link")],c);export{c as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{S as t,b as a,t as e,c as i,i as r,n as s,a as n}from"./solid-components2.js";import{s as l,n as o}from"./static.js";import{o as c}from"./if-defined.js";var h=Object.defineProperty,v=Object.getOwnPropertyDescriptor,p=(t,a,e,i)=>{for(var r,s=i>1?void 0:i?v(a,e):a,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(i?r(a,e,s):r(s))||s);return i&&s&&h(a,e,s),s};let f=class extends t{constructor(){super(...arguments),this.variant="main",this.state="default",this.animated=!1,this.notInteractive=!1,this.href="",this.marker={cluster:a`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><circle cx="25" cy="25" opacity="1" r="20"/><circle cx="25" cy="25" opacity=".3" r="25"/></svg>`,main:a`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 75"><path d="M51 49A29 29 0 0 0 30 0 29 29 0 0 0 9 49l21 22 21-22Z"/><circle cx="30" cy="28" r="10" fill="#fff"/></svg>`,place:a`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 75"><path fill-rule="evenodd" d="M51 49A29 29 0 0 0 30 0 29 29 0 0 0 9 49l21 22 21-22Z" clip-rule="evenodd"/></svg>`}}handleBlur(){this.emit("sd-blur")}handleFocus(){this.emit("sd-focus")}isLink(){return!!this.href}render(){const t=this.isLink(),a=this.notInteractive?l`div`:t?l`a`:l`button`;return o`<${a} part="base" class="${e("flex justify-center",!this.notInteractive&&"focus:outline focus:outline-2 focus:outline-primary focus:outline-offset-2")}" href="${c(t?this.href:void 0)}" target="${c(t?this.target:void 0)}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" aria-labelledby="content"><div part="marker" class="${e("inline-flex",this.animated&&("main"===this.variant||"place"===this.variant)&&"animate-bounce-once","cluster"===this.variant&&"hover"===this.state&&"scale-110 fill-primary-500","cluster"===this.variant&&!this.notInteractive&&"transition-all duration-200 ease-in-out hover:scale-110 hover:fill-primary-500","main"===this.variant&&"hover"===this.state&&"fill-accent-550","main"===this.variant&&"active"===this.state&&"fill-accent-700","main"===this.variant&&!this.notInteractive&&"hover:fill-accent-550 active:fill-accent-700","place"===this.variant&&"default"===this.state&&"fill-white","place"===this.variant&&"hover"===this.state&&"fill-primary-100","place"===this.variant&&"active"===this.state&&"fill-primary-200","place"===this.variant&&!this.notInteractive&&"hover:fill-primary-100",{cluster:"fill-primary",main:"fill-accent *:drop-shadow-md",place:"*:drop-shadow-md"}[this.variant])}">${this.marker[this.variant]}</div><div id="content" part="content" class="${e("absolute self-center pointer-events-none","cluster"===this.variant&&"font-bold text-white")}"><slot></slot></div></${a}>`}};f.styles=[i,t.styles,r`:host{display:block}:host([variant=cluster]) [part=base],svg{width:calc(var(--sd-spacing-12,3rem) * var(--map-marker-scaling,1))}:host([variant=cluster]) [part=base]{height:calc(var(--sd-spacing-12,3rem) * var(--map-marker-scaling,1))}:host(:not([variant=cluster])) [part=base]{height:calc(var(--sd-spacing-16,4rem) * var(--map-marker-scaling,1))}:host([variant=cluster]) [part=content]{font-size:calc(var(--sd-font-size-sm,.875rem) * var(--map-marker-scaling,1))}:host([variant=place]) [part=content]{font-size:calc(var(--sd-font-size-3xl,2rem) * var(--map-marker-scaling,1))}`],p([s({reflect:!0})],f.prototype,"variant",2),p([s({reflect:!0})],f.prototype,"state",2),p([s({type:Boolean,reflect:!0})],f.prototype,"animated",2),p([s({type:Boolean,reflect:!0,attribute:"not-interactive"})],f.prototype,"notInteractive",2),p([s()],f.prototype,"href",2),p([s()],f.prototype,"target",2),f=p([n("sd-3-
|
1
|
+
import{S as t,b as a,t as e,c as i,i as r,n as s,a as n}from"./solid-components2.js";import{s as l,n as o}from"./static.js";import{o as c}from"./if-defined.js";var h=Object.defineProperty,v=Object.getOwnPropertyDescriptor,p=(t,a,e,i)=>{for(var r,s=i>1?void 0:i?v(a,e):a,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(i?r(a,e,s):r(s))||s);return i&&s&&h(a,e,s),s};let f=class extends t{constructor(){super(...arguments),this.variant="main",this.state="default",this.animated=!1,this.notInteractive=!1,this.href="",this.marker={cluster:a`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><circle cx="25" cy="25" opacity="1" r="20"/><circle cx="25" cy="25" opacity=".3" r="25"/></svg>`,main:a`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 75"><path d="M51 49A29 29 0 0 0 30 0 29 29 0 0 0 9 49l21 22 21-22Z"/><circle cx="30" cy="28" r="10" fill="#fff"/></svg>`,place:a`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 75"><path fill-rule="evenodd" d="M51 49A29 29 0 0 0 30 0 29 29 0 0 0 9 49l21 22 21-22Z" clip-rule="evenodd"/></svg>`}}handleBlur(){this.emit("sd-blur")}handleFocus(){this.emit("sd-focus")}isLink(){return!!this.href}render(){const t=this.isLink(),a=this.notInteractive?l`div`:t?l`a`:l`button`;return o`<${a} part="base" class="${e("flex justify-center",!this.notInteractive&&"focus:outline focus:outline-2 focus:outline-primary focus:outline-offset-2")}" href="${c(t?this.href:void 0)}" target="${c(t?this.target:void 0)}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" aria-labelledby="content"><div part="marker" class="${e("inline-flex",this.animated&&("main"===this.variant||"place"===this.variant)&&"animate-bounce-once","cluster"===this.variant&&"hover"===this.state&&"scale-110 fill-primary-500","cluster"===this.variant&&!this.notInteractive&&"transition-all duration-200 ease-in-out hover:scale-110 hover:fill-primary-500","main"===this.variant&&"hover"===this.state&&"fill-accent-550","main"===this.variant&&"active"===this.state&&"fill-accent-700","main"===this.variant&&!this.notInteractive&&"hover:fill-accent-550 active:fill-accent-700","place"===this.variant&&"default"===this.state&&"fill-white","place"===this.variant&&"hover"===this.state&&"fill-primary-100","place"===this.variant&&"active"===this.state&&"fill-primary-200","place"===this.variant&&!this.notInteractive&&"hover:fill-primary-100",{cluster:"fill-primary",main:"fill-accent *:drop-shadow-md",place:"*:drop-shadow-md"}[this.variant])}">${this.marker[this.variant]}</div><div id="content" part="content" class="${e("absolute self-center pointer-events-none","cluster"===this.variant&&"font-bold text-white")}"><slot></slot></div></${a}>`}};f.styles=[i,t.styles,r`:host{display:block}:host([variant=cluster]) [part=base],svg{width:calc(var(--sd-spacing-12,3rem) * var(--map-marker-scaling,1))}:host([variant=cluster]) [part=base]{height:calc(var(--sd-spacing-12,3rem) * var(--map-marker-scaling,1))}:host(:not([variant=cluster])) [part=base]{height:calc(var(--sd-spacing-16,4rem) * var(--map-marker-scaling,1))}:host([variant=cluster]) [part=content]{font-size:calc(var(--sd-font-size-sm,.875rem) * var(--map-marker-scaling,1))}:host([variant=place]) [part=content]{font-size:calc(var(--sd-font-size-3xl,2rem) * var(--map-marker-scaling,1))}`],p([s({reflect:!0})],f.prototype,"variant",2),p([s({reflect:!0})],f.prototype,"state",2),p([s({type:Boolean,reflect:!0})],f.prototype,"animated",2),p([s({type:Boolean,reflect:!0,attribute:"not-interactive"})],f.prototype,"notInteractive",2),p([s()],f.prototype,"href",2),p([s()],f.prototype,"target",2),f=p([n("sd-3-22-0-map-marker")],f);export{f as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{S as t,t as e,c as i,r as s,i as r,n as a,a as o}from"./solid-components2.js";import{H as l}from"./slot.js";import{s as n,n as d}from"./static.js";import{o as h}from"./if-defined.js";import{I as c}from"./interactive.js";var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,v=(t,e,i,s)=>{for(var r,a=s>1?void 0:s?u(e,i):e,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s?r(e,i,a):r(a))||a);return s&&a&&p(e,i,a),a};let f=class extends t{constructor(){super(...arguments),this.hasSlotController=new l(this,"[default]","description","children"),this.vertical=!1,this.size="base",this.current=!1,this.disabled=!1,this.chevron=!1,this.relaxed=!1,this.divider=!1,this.indented=!1,this.open=!1,this.separated=!1}get isButton(){return!this.href&&!this.hasSlotController.test("children")}get isLink(){return!!this.href}get 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})}get calculatePaddingX(){return this.relaxed&&this.indented?"pl-8 pr-4":this.relaxed?"px-4":this.indented?"pl-4":""}get tag(){return this.isAccordion&&!this.isLink?n`summary`:this.separated?n`div`:this.isLink?n`a`:n`button`}render(){const t=this.tag,i=this.isLink,s=this.isButton,r=this.isAccordion,a=(this.hasSlotController.test("[default]"),this.hasSlotController.test("main"),this.hasSlotController.test("description")),o=this.hasSlotController.test("children"),l=this.vertical?"pb-3":"pb-2",n=d`<${t} part="base" class="${e("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",r?"flex flex-col":"inline-block w-full",this.divider&&this.vertical&&"mt-0.25",!this.vertical&&"inline-flex items-center",!this.separated&&"hover:bg-neutral-200 group transition-all min-h-[48px] px-4")}" aria-controls="${h(r?"navigation-item-details":void 0)}" aria-current="${h(this.current?"page":void 0)}" aria-disabled="${this.disabled}" ?disabled="${h(s?this.disabled:void 0)}" href="${h(i?this.href:void 0)}" target="${h(i?this.target:void 0)}" download="${h(i?this.download:void 0)}" rel="${h(i&&this.target?"noreferrer noopener":void 0)}" role="${i?"link":"button"}" tabindex="${this.disabled||this.separated?"-1":"0"}" @click="${this.separated?void 0:r?this.handleClickSummary:s?this.handleClickButton:void 0}"><div part="current-indicator" class="${e("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="${e("relative pt-3 inline-flex justify-between items-center",r?"grow":"w-full",a||this.separated?"pb-1":l,this.calculatePaddingX)}">${this.divider&&this.vertical?d`<sd-3-
|
1
|
+
import{S as t,t as e,c as i,r as s,i as r,n as a,a as o}from"./solid-components2.js";import{H as l}from"./slot.js";import{s as n,n as d}from"./static.js";import{o as h}from"./if-defined.js";import{I as c}from"./interactive.js";var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,v=(t,e,i,s)=>{for(var r,a=s>1?void 0:s?u(e,i):e,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s?r(e,i,a):r(a))||a);return s&&a&&p(e,i,a),a};let f=class extends t{constructor(){super(...arguments),this.hasSlotController=new l(this,"[default]","description","children"),this.vertical=!1,this.size="base",this.current=!1,this.disabled=!1,this.chevron=!1,this.relaxed=!1,this.divider=!1,this.indented=!1,this.open=!1,this.separated=!1}get isButton(){return!this.href&&!this.hasSlotController.test("children")}get isLink(){return!!this.href}get 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})}get calculatePaddingX(){return this.relaxed&&this.indented?"pl-8 pr-4":this.relaxed?"px-4":this.indented?"pl-4":""}get tag(){return this.isAccordion&&!this.isLink?n`summary`:this.separated?n`div`:this.isLink?n`a`:n`button`}render(){const t=this.tag,i=this.isLink,s=this.isButton,r=this.isAccordion,a=(this.hasSlotController.test("[default]"),this.hasSlotController.test("main"),this.hasSlotController.test("description")),o=this.hasSlotController.test("children"),l=this.vertical?"pb-3":"pb-2",n=d`<${t} part="base" class="${e("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",r?"flex flex-col":"inline-block w-full",this.divider&&this.vertical&&"mt-0.25",!this.vertical&&"inline-flex items-center",!this.separated&&"hover:bg-neutral-200 group transition-all min-h-[48px] px-4")}" aria-controls="${h(r?"navigation-item-details":void 0)}" aria-current="${h(this.current?"page":void 0)}" aria-disabled="${this.disabled}" ?disabled="${h(s?this.disabled:void 0)}" href="${h(i?this.href:void 0)}" target="${h(i?this.target:void 0)}" download="${h(i?this.download:void 0)}" rel="${h(i&&this.target?"noreferrer noopener":void 0)}" role="${i?"link":"button"}" tabindex="${this.disabled||this.separated?"-1":"0"}" @click="${this.separated?void 0:r?this.handleClickSummary:s?this.handleClickButton:void 0}"><div part="current-indicator" class="${e("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="${e("relative pt-3 inline-flex justify-between items-center",r?"grow":"w-full",a||this.separated?"pb-1":l,this.calculatePaddingX)}">${this.divider&&this.vertical?d`<sd-3-22-0-divider part="divider" class="${e("w-full transition-all absolute -top-0.25 left-0",this.calculatePaddingX)}"></sd-3-22-0-divider>`:""} <span part="content-container" class="inline-flex items-center flex-auto">${this.separated?d`<a class="${e("mr-4 w-full inline-flex items-center pl-4 cursor-pointer relative focus-visible:focus-outline hover:bg-neutral-200 group transition-all min-h-[48px]",!a&&"py-4")}" href="${h(i?this.href:void 0)}" target="${h(i?this.target:void 0)}" download="${h(i?this.download:void 0)}"><slot part="content" class="inline"></slot></a>`:d`<slot part="content" class="inline"></slot>`} </span>${(this.chevron||o)&&this.vertical?this.separated?d`<button type="button" title="toggle-details" class="sd-interactive sd-interactive--reset" @click="${this.handleClickSummary}"><sd-3-22-0-icon name="chevron-down" part="chevron" library="system" color="currentColor" class="${e("mr-4 h-6 w-6 transition-all",r||this.separated?this.open?"rotate-180":"rotate-0":"rotate-[270deg]")}"></sd-3-22-0-icon></button>`:d`<sd-3-22-0-icon name="chevron-down" part="chevron" library="system" color="currentColor" class="${e("h-6 w-6 ml-2 transition-all",r?this.open?"rotate-180":"rotate-0":"rotate-[270deg]")}"></sd-3-22-0-icon>`:""} </span>${a&&this.vertical?d`<slot name="description" part="description" class="${e("inline-block text-sm text-left text-black",r||this.separated?"grow":"w-full",this.separated?"px-4":this.calculatePaddingX,l)}"></slot>`:""}</${t}>`;return r?d`<details aria-expanded="${this.open}" part="details" id="navigation-item-details" ?open="${this.open}" class="relative flex">${n}<slot name="children"></slot></details>`:this.separated?d`<div part="details" id="navigation-item-details" class="relative flex flex-col">${n}${this.open?d`<slot name="children"></slot>`:""}</div>`:d`${n}`}};f.styles=[i,t.styles,s(c),r`:host{position:relative;box-sizing:border-box;display:inline-block}:host([vertical]){display:block}details summary::-webkit-details-marker{display:none}`],v([a({type:Boolean,reflect:!0})],f.prototype,"vertical",2),v([a({reflect:!0})],f.prototype,"size",2),v([a({reflect:!0})],f.prototype,"href",2),v([a()],f.prototype,"target",2),v([a()],f.prototype,"download",2),v([a({type:Boolean,reflect:!0})],f.prototype,"current",2),v([a({type:Boolean,reflect:!0})],f.prototype,"disabled",2),v([a({type:Boolean,reflect:!0})],f.prototype,"chevron",2),v([a({type:Boolean,reflect:!0})],f.prototype,"relaxed",2),v([a({type:Boolean,reflect:!0})],f.prototype,"divider",2),v([a({type:Boolean,reflect:!0})],f.prototype,"indented",2),v([a({type:Boolean,reflect:!0})],f.prototype,"open",2),v([a({type:Boolean,reflect:!0})],f.prototype,"separated",2),f=v([o("sd-3-22-0-navigation-item")],f);export{f as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{s as t,a as i}from"./animate.js";import{S as e,L as s,x as a,t as o,c as n,i as r,e as d,n as l,a as c}from"./solid-components2.js";import{g as h,s as u}from"./animation-registry.js";import{w as p}from"./event.js";import{w as m}from"./watch.js";var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,y=(t,i,e,s)=>{for(var a,o=s>1?void 0:s?b(i,e):i,n=t.length-1;n>=0;n--)(a=t[n])&&(o=(s?a(i,e,o):a(o))||o);return s&&o&&f(i,e,o),o};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 e{constructor(){super(...arguments),this.localize=new s(this),this.variant="info",this.open=!1,this.closable=!1,this.duration=1/0,this.durationIndicator=!1,this.toastStack="top-right",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}=h(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}=h(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,p(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,p(this,"sd-after-hide")}async toast(){return new Promise((t=>{const i="bottom-center"===this.toastStack?g:w;null===i.parentElement&&document.body.append(i),i.appendChild(this),requestAnimationFrame((()=>{this.clientWidth,this.show()})),this.addEventListener("sd-after-hide",(()=>{i.removeChild(this),t(),null===i.querySelector("sd-3-
|
1
|
+
import{s as t,a as i}from"./animate.js";import{S as e,L as s,x as a,t as o,c as n,i as r,e as d,n as l,a as c}from"./solid-components2.js";import{g as h,s as u}from"./animation-registry.js";import{w as p}from"./event.js";import{w as m}from"./watch.js";var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,y=(t,i,e,s)=>{for(var a,o=s>1?void 0:s?b(i,e):i,n=t.length-1;n>=0;n--)(a=t[n])&&(o=(s?a(i,e,o):a(o))||o);return s&&o&&f(i,e,o),o};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 e{constructor(){super(...arguments),this.localize=new s(this),this.variant="info",this.open=!1,this.closable=!1,this.duration=1/0,this.durationIndicator=!1,this.toastStack="top-right",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}=h(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}=h(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,p(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,p(this,"sd-after-hide")}async toast(){return new Promise((t=>{const i="bottom-center"===this.toastStack?g:w;null===i.parentElement&&document.body.append(i),i.appendChild(this),requestAnimationFrame((()=>{this.clientWidth,this.show()})),this.addEventListener("sd-after-hide",(()=>{i.removeChild(this),t(),null===i.querySelector("sd-3-22-0-notification")&&i.remove()}),{once:!0})}))}render(){return a`<div part="base" class="${o("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="${o("min-w-min flex items-center px-3 justify-center",{info:"bg-info",success:"bg-success",warning:"bg-warning",error:"bg-error"}[this.variant])}"><sd-3-22-0-icon name="${{info:"info-circle",success:"confirm-circle",warning:"exclamation-circle",error:"warning"}[this.variant]||""}" library="system" class="h-6 w-6 text-white"></sd-3-22-0-icon></slot><div part="content" class="${o("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?a`<sd-3-22-0-button size="md" variant="tertiary" part="close-button" class="ml-auto flex flex-[0_0_auto] items-stretch" @click="${this.handleCloseClick}"><sd-3-22-0-icon label="${this.localize.term("close")}" name="close" library="system" color="currentColor"></sd-3-22-0-icon></sd-3-22-0-button>`:""}</div>${this.durationIndicator?a`<div part="duration-indicator__elapsed" id="duration-indicator__elapsed" style="${`animation-duration: ${this.duration}ms`}" class="${o("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=[n,e.styles,r`:host{display:contents}#notification:hover #duration-indicator__elapsed{animation-play-state:paused!important}`],y([d('[part~="base"]')],v.prototype,"base",2),y([l({reflect:!0})],v.prototype,"variant",2),y([l({type:Boolean,reflect:!0})],v.prototype,"open",2),y([l({type:Boolean,reflect:!0})],v.prototype,"closable",2),y([l({type:Number})],v.prototype,"duration",2),y([l({type:Boolean,reflect:!0,attribute:"duration-indicator"})],v.prototype,"durationIndicator",2),y([l({reflect:!0,attribute:"toast-stack"})],v.prototype,"toastStack",2),y([m("open",{waitUntilFirstUpdate:!0})],v.prototype,"handleOpenChange",1),y([m("duration")],v.prototype,"handleDurationChange",1),v=y([c("sd-3-22-0-notification")],v),u("notification.show",{keyframes:[{opacity:0,scale:.8},{opacity:1,scale:1}],options:{duration:250,easing:"ease"}}),u("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,t as s,c as l,i as a,e as o,n as r,a as i}from"./solid-components2.js";import{H as n}from"./slot.js";import{r as h}from"./state.js";import{w as c}from"./watch.js";var d=Object.defineProperty,p=Object.getOwnPropertyDescriptor,u=(e,t,s,l)=>{for(var a,o=l>1?void 0:l?p(t,s):t,r=e.length-1;r>=0;r--)(a=e[r])&&(o=(l?a(t,s,o):a(o))||o);return l&&o&&d(t,s,o),o};let b=class extends e{constructor(){super(...arguments),this.hasSlotController=new n(this,"default","left","right"),this.current=!1,this.selected=!1,this.hasHover=!1,this.size="lg",this.checkbox=!1,this.disabled=!1,this.value=""}connectedCallback(){super.connectedCallback(),this.setAttribute("role","option"),this.setAttribute("aria-selected","false")}handleDefaultSlotChange(){const e=this.getTextLabel();typeof this.cachedTextLabel>"u"?this.cachedTextLabel=e:e!==this.cachedTextLabel&&(this.cachedTextLabel=e,this.emit("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false")}handleValueChange(){this.value.includes(" ")&&(console.error("Option values cannot include a space. All spaces have been replaced with underscores.",this),this.value=this.value.replace(/ /g,"_"))}getTextLabel(){return(this.textContent??"").trim()}render(){this.hasSlotController.test("default");const e=this.hasSlotController.test("left"),l=this.hasSlotController.test("right");return t`<div part="base" class="${s("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="${s("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="${s("relative flex flex-shrink-0 items-center justify-center border rounded-sm h-4 w-4 mr-2",this.disabled?"border-neutral-500":this.selected?"bg-accent border-accent":"border-neutral-800")}">${this.selected?t`<sd-3-
|
1
|
+
import"./icon.js";import{S as e,x as t,t as s,c as l,i as a,e as o,n as r,a as i}from"./solid-components2.js";import{H as n}from"./slot.js";import{r as h}from"./state.js";import{w as c}from"./watch.js";var d=Object.defineProperty,p=Object.getOwnPropertyDescriptor,u=(e,t,s,l)=>{for(var a,o=l>1?void 0:l?p(t,s):t,r=e.length-1;r>=0;r--)(a=e[r])&&(o=(l?a(t,s,o):a(o))||o);return l&&o&&d(t,s,o),o};let b=class extends e{constructor(){super(...arguments),this.hasSlotController=new n(this,"default","left","right"),this.current=!1,this.selected=!1,this.hasHover=!1,this.size="lg",this.checkbox=!1,this.disabled=!1,this.value=""}connectedCallback(){super.connectedCallback(),this.setAttribute("role","option"),this.setAttribute("aria-selected","false")}handleDefaultSlotChange(){const e=this.getTextLabel();typeof this.cachedTextLabel>"u"?this.cachedTextLabel=e:e!==this.cachedTextLabel&&(this.cachedTextLabel=e,this.emit("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false")}handleValueChange(){this.value.includes(" ")&&(console.error("Option values cannot include a space. All spaces have been replaced with underscores.",this),this.value=this.value.replace(/ /g,"_"))}getTextLabel(){return(this.textContent??"").trim()}render(){this.hasSlotController.test("default");const e=this.hasSlotController.test("left"),l=this.hasSlotController.test("right");return t`<div part="base" class="${s("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="${s("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="${s("relative flex flex-shrink-0 items-center justify-center border rounded-sm h-4 w-4 mr-2",this.disabled?"border-neutral-500":this.selected?"bg-accent border-accent":"border-neutral-800")}">${this.selected?t`<sd-3-22-0-icon part="checked-icon" class="text-white w-3 h-3" library="system" name="status-check"></sd-3-22-0-icon>`:""}</span>`:""} ${e?t`<slot name="left" part="left" class="inline-flex mr-2"></slot>`:""}<slot part="label" class="inline-block flex-grow" @slotchange="${this.handleDefaultSlotChange}"></slot>${l?t`<slot name="right" part="right" class="inline-flex ml-2"></slot>`:""}</div>`}};b.styles=[l,e.styles,a`:host{position:relative;display:block;width:100%;outline:2px solid transparent!important;outline-offset:2px!important}`],u([o('[part="base"]')],b.prototype,"defaultSlot",2),u([h()],b.prototype,"current",2),u([h()],b.prototype,"selected",2),u([h()],b.prototype,"hasHover",2),u([r({reflect:!0})],b.prototype,"size",2),u([r({type:Boolean,reflect:!0})],b.prototype,"checkbox",2),u([r({type:Boolean,reflect:!0})],b.prototype,"disabled",2),u([r({reflect:!0})],b.prototype,"value",2),u([c("disabled")],b.prototype,"handleDisabledChange",1),u([c("selected")],b.prototype,"handleSelectedChange",1),u([c("value")],b.prototype,"handleValueChange",1),b=u([i("sd-3-22-0-option")],b);export{b as default};
|
@@ -1 +1 @@
|
|
1
|
-
import"./icon.js";import{x as e,t,i as a,n as s,a as i}from"./solid-components2.js";import{o}from"./if-defined.js";import{s as n}from"./animation-registry.js";import r from"./accordion.js";var l=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c=(e,t,a,s)=>{for(var i,o=s>1?void 0:s?d(t,a):t,n=e.length-1;n>=0;n--)(i=e[n])&&(o=(s?i(t,a,o):i(o))||o);return s&&o&&l(t,a,o),o};let p=class extends r{constructor(){super(...arguments),this.expandable=!1}render(){return e`<div part="base" class="sm:p-6"><header part="header" id="header" class="${t("text-base font-bold items-center focus-visible:focus-outline text-primary relative group flex flex-row hover:bg-transparent gap-3 pb-3 pt-0 px-0 sm:flex-col sm:gap-4 sm:pb-8",this.expandable&&"cursor-pointer select-none")}" role="${o(this.expandable?"button":void 0)}" aria-expanded="${o(this.expandable?this.open?"true":"false":void 0)}" aria-controls="${o(this.expandable?"content":void 0)}" tabindex="${this.expandable?"0":"-1"}" @click="${this.expandable?this.handleSummaryClick:null}" @keydown="${this.expandable?this.handleSummaryKeyDown:null}"><div part="icon" class="${t("flex flex-grow-0 flex-shrink-0 flex-auto items-center",!this.expandable&&"cursor-default")}"><slot name="icon"></slot></div><slot name="summary" part="summary" class="${t("flex flex-auto items-start text-left text-base leading-normal font-normal sm:leading-tight sm:text-3xl sm:text-center",this.expandable?"text-primary":"text-black cursor-default")}">${this.summary}</slot><span part="summary-icon" class="${t("flex flex-grow-0 flex-shrink-0 flex-auto self-start sm:self-center transition-all ease-in-out duration-300 text-xl sm:text-4xl sm:mt-2",this.open&&"rotate-180",!this.expandable&&"hidden")}"><slot name="expand-icon" class="${t(this.open&&"hidden")}"><sd-3-
|
1
|
+
import"./icon.js";import{x as e,t,i as a,n as s,a as i}from"./solid-components2.js";import{o}from"./if-defined.js";import{s as n}from"./animation-registry.js";import r from"./accordion.js";var l=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c=(e,t,a,s)=>{for(var i,o=s>1?void 0:s?d(t,a):t,n=e.length-1;n>=0;n--)(i=e[n])&&(o=(s?i(t,a,o):i(o))||o);return s&&o&&l(t,a,o),o};let p=class extends r{constructor(){super(...arguments),this.expandable=!1}render(){return e`<div part="base" class="sm:p-6"><header part="header" id="header" class="${t("text-base font-bold items-center focus-visible:focus-outline text-primary relative group flex flex-row hover:bg-transparent gap-3 pb-3 pt-0 px-0 sm:flex-col sm:gap-4 sm:pb-8",this.expandable&&"cursor-pointer select-none")}" role="${o(this.expandable?"button":void 0)}" aria-expanded="${o(this.expandable?this.open?"true":"false":void 0)}" aria-controls="${o(this.expandable?"content":void 0)}" tabindex="${this.expandable?"0":"-1"}" @click="${this.expandable?this.handleSummaryClick:null}" @keydown="${this.expandable?this.handleSummaryKeyDown:null}"><div part="icon" class="${t("flex flex-grow-0 flex-shrink-0 flex-auto items-center",!this.expandable&&"cursor-default")}"><slot name="icon"></slot></div><slot name="summary" part="summary" class="${t("flex flex-auto items-start text-left text-base leading-normal font-normal sm:leading-tight sm:text-3xl sm:text-center",this.expandable?"text-primary":"text-black cursor-default")}">${this.summary}</slot><span part="summary-icon" class="${t("flex flex-grow-0 flex-shrink-0 flex-auto self-start sm:self-center transition-all ease-in-out duration-300 text-xl sm:text-4xl sm:mt-2",this.open&&"rotate-180",!this.expandable&&"hidden")}"><slot name="expand-icon" class="${t(this.open&&"hidden")}"><sd-3-22-0-icon library="system" name="chevron-down"></sd-3-22-0-icon></slot><slot name="collapse-icon" class="${t(!this.open&&"hidden")}"><sd-3-22-0-icon library="system" name="chevron-down"></sd-3-22-0-icon></slot></span></header><div part="content" id="content" class="${t("overflow-hidden",!this.expandable&&"hidden")}"><slot part="content__slot" class="block" role="region" aria-labelledby="header"></slot></div></div>`}};p.styles=[r.styles,a`:host{display:block}@media (min-width:640px){[part=summary-icon]{font-size:var(--sd-spacing-12,3rem)}}[part=icon]{font-size:var(--sd-spacing-12,3rem)}@media (min-width:640px){[part=icon]{font-size:var(--sd-spacing-24,6rem)}}`],c([s({type:Boolean,reflect:!0})],p.prototype,"expandable",2),p=c([i("sd-3-22-0-quickfact")],p),n("quickfact.show",{keyframes:[{height:"0",opacity:"0"},{height:"auto",opacity:"1"}],options:{duration:300,easing:"ease"}}),n("quickfact.hide",{keyframes:[{height:"auto",opacity:"1"},{height:"0",opacity:"0"}],options:{duration:300,easing:"ease"}});export{p as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{S as t,x as e,t as s,c as r,i as o,e as i,n as a,a as n}from"./solid-components2.js";import{H as d}from"./slot.js";import{o as l}from"./if-defined.js";import{r as u}from"./state.js";import{w as h}from"./watch.js";var b=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=(t,e,s,r)=>{for(var o,i=r>1?void 0:r?c(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&&b(e,s,i),i};let m=class extends t{constructor(){super(...arguments),this.hasSlotController=new d(this,"[default]","icon"),this.hasFocus=!1,this.size="lg",this.disabled=!1,this.checked=!1}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]"),r=this.hasSlotController.test("icon"),o=`${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="${s("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 border-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",r&&"button--has-icon flex gap-2",o)}" aria-disabled="${this.disabled}" type="button" value="${l(this.value)}" tabindex="${this.checked?"0":"-1"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" @click="${this.handleClick}"><slot name="icon" part="icon" class="${s(r&&"inline-flex relative items-center",{sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size])}" ?hidden="${!r}"></slot>${t?e`<slot part="label" class="button__label inline-flex relative items-center whitespace-nowrap"></slot>`:null}</button></div>`}};m.styles=[t.styles,r,o`:host{display:block;width:-moz-min-content;width:min-content}.hidden-input{all:unset;position:absolute;inset:var(--sd-spacing-0,0);z-index:-10;opacity:var(--sd-opacity-0,0);outline-style:dotted;outline-width:1px;outline-color:rgb(var(--sd-color-error,204 25 55) / 1)}.lg-label{height:var(--sd-spacing-12,3rem)}.lg-no-label{height:var(--sd-spacing-12,3rem);width:var(--sd-spacing-12,3rem)}.md-label{height:var(--sd-spacing-10,2.5rem)}.md-no-label{height:var(--sd-spacing-10,2.5rem);width:var(--sd-spacing-10,2.5rem)}.sm-label{height:var(--sd-spacing-8,2rem)}.sm-no-label{height:var(--sd-spacing-8,2rem);width:var(--sd-spacing-8,2rem)}:host(.sd-3-
|
1
|
+
import{S as t,x as e,t as s,c as r,i as o,e as i,n as a,a as n}from"./solid-components2.js";import{H as d}from"./slot.js";import{o as l}from"./if-defined.js";import{r as u}from"./state.js";import{w as h}from"./watch.js";var b=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=(t,e,s,r)=>{for(var o,i=r>1?void 0:r?c(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&&b(e,s,i),i};let m=class extends t{constructor(){super(...arguments),this.hasSlotController=new d(this,"[default]","icon"),this.hasFocus=!1,this.size="lg",this.disabled=!1,this.checked=!1}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]"),r=this.hasSlotController.test("icon"),o=`${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="${s("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 border-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",r&&"button--has-icon flex gap-2",o)}" aria-disabled="${this.disabled}" type="button" value="${l(this.value)}" tabindex="${this.checked?"0":"-1"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" @click="${this.handleClick}"><slot name="icon" part="icon" class="${s(r&&"inline-flex relative items-center",{sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size])}" ?hidden="${!r}"></slot>${t?e`<slot part="label" class="button__label inline-flex relative items-center whitespace-nowrap"></slot>`:null}</button></div>`}};m.styles=[t.styles,r,o`:host{display:block;width:-moz-min-content;width:min-content}.hidden-input{all:unset;position:absolute;inset:var(--sd-spacing-0,0);z-index:-10;opacity:var(--sd-opacity-0,0);outline-style:dotted;outline-width:1px;outline-color:rgb(var(--sd-color-error,204 25 55) / 1)}.lg-label{height:var(--sd-spacing-12,3rem)}.lg-no-label{height:var(--sd-spacing-12,3rem);width:var(--sd-spacing-12,3rem)}.md-label{height:var(--sd-spacing-10,2.5rem)}.md-no-label{height:var(--sd-spacing-10,2.5rem);width:var(--sd-spacing-10,2.5rem)}.sm-label{height:var(--sd-spacing-8,2rem)}.sm-no-label{height:var(--sd-spacing-8,2rem);width:var(--sd-spacing-8,2rem)}:host(.sd-3-22-0-button-group__button--first:not(.sd-3-22-0-button-group__button--last)) button{border-top-right-radius:var(--sd-border-radius-none,0);border-bottom-right-radius:var(--sd-border-radius-none,0)}:host(.sd-3-22-0-button-group__button--inner) button{border-radius:var(--sd-border-radius-none,0)}:host(.sd-3-22-0-button-group__button--last:not(.sd-3-22-0-button-group__button--first)) button{border-top-left-radius:var(--sd-border-radius-none,0);border-bottom-left-radius:var(--sd-border-radius-none,0)}:host(.sd-3-22-0-button-group__button:not(.sd-3-22-0-button-group__button--first)){margin-inline-start:-1px}:host(.sd-3-22-0-button-group__button--hover){z-index:10}:host(.sd-3-22-0-button-group__button--focus),:host(.sd-3-22-0-button-group__button[checked]){z-index:20}`],p([i(".button")],m.prototype,"input",2),p([i(".hidden-input")],m.prototype,"hiddenInput",2),p([u()],m.prototype,"hasFocus",2),p([a({reflect:!0})],m.prototype,"size",2),p([a({type:Boolean,reflect:!0})],m.prototype,"disabled",2),p([a({type:Boolean,reflect:!0})],m.prototype,"checked",2),p([a()],m.prototype,"value",2),p([h("disabled",{waitUntilFirstUpdate:!0})],m.prototype,"handleDisabledChange",1),m=p([n("sd-3-22-0-radio-button")],m);export{m as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{i as t,c as e,e as o,n as s,S as i,x as a,a as l,t as r}from"./solid-components2.js";import{F as n,c as d,a as h,v as u}from"./form.js";import{H as c}from"./slot.js";import{r as p}from"./state.js";import{w as g}from"./watch.js";import m from"./radio.js";const b=t`${e}: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 i{constructor(){super(...arguments),this.disableRole=!1,this.label=""}handleFocus(t){const e=w(t.target);null==e||e.classList.add("sd-3-
|
1
|
+
import{i as t,c as e,e as o,n as s,S as i,x as a,a as l,t as r}from"./solid-components2.js";import{F as n,c as d,a as h,v as u}from"./form.js";import{H as c}from"./slot.js";import{r as p}from"./state.js";import{w as g}from"./watch.js";import m from"./radio.js";const b=t`${e}: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 i{constructor(){super(...arguments),this.disableRole=!1,this.label=""}handleFocus(t){const e=w(t.target);null==e||e.classList.add("sd-3-22-0-button-group__button--focus")}handleBlur(t){const e=w(t.target);null==e||e.classList.remove("sd-3-22-0-button-group__button--focus")}handleMouseOver(t){const e=w(t.target);null==e||e.classList.add("sd-3-22-0-button-group__button--hover")}handleMouseOut(t){const e=w(t.target);null==e||e.classList.remove("sd-3-22-0-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-3-22-0-button-group__button"),s.classList.toggle("sd-3-22-0-button-group__button--first",0===o),s.classList.toggle("sd-3-22-0-button-group__button--inner",o>0&&o<t.length-1),s.classList.toggle("sd-3-22-0-button-group__button--last",o===t.length-1),s.classList.toggle("sd-3-22-0-button-group__button--radio","sd-3-22-0-radio-button"===s.tagName.toLowerCase()))}))}render(){return a`<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-3-22-0-button, sd-3-22-0-radio-button";return t.closest(e)??t.querySelector(e)}C.styles=b,y([o("slot")],C.prototype,"defaultSlot",2),y([p()],C.prototype,"disableRole",2),y([s()],C.prototype,"label",2),C=y([l("sd-3-22-0-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 i{constructor(){super(...arguments),this.formControlController=new n(this),this.hasSlotController=new c(this,"label","error-text"),this.customValidityMessage="",this.hasButtonGroup=!1,this.defaultValue="",this.showInvalidStyle=!1,this.size="lg",this.required=!1,this.orientation="vertical",this.label="",this.boldLabel=!1,this.name="option",this.value="",this.form=""}get validity(){const t=this.required&&!this.value;return""!==this.customValidityMessage?d:t?h:u}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-3-22-0-radio, sd-3-22-0-radio-button")]}handleRadioClick(t){const e=t.target.closest("sd-3-22-0-radio, sd-3-22-0-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-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-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 m&&(t.invalid=this.showInvalidStyle)}))),this.hasButtonGroup=o.some((t=>"sd-3-22-0-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-3-22-0-button-group");t&&(t.disableRole=!0)}}syncRadios(){customElements.get("sd-3-22-0-radio")&&customElements.get("sd-3-22-0-radio-button")?this.syncRadioElements():(customElements.get("sd-3-22-0-radio")?this.syncRadioElements():customElements.whenDefined("sd-3-22-0-radio").then((()=>this.syncRadios())),customElements.get("sd-3-22-0-radio-button")?this.syncRadioElements():customElements.whenDefined("sd-3-22-0-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=a`<slot @slotchange="${this.syncRadios}" @click="${this.handleRadioClick}" @keydown="${this.handleKeyDown}"></slot>`;return a`<fieldset part="form-control" class="${r("border-0 p-0 m-0 flex flex-col",{sm:"text-sm",md:"text-base",lg:"text-base"}[this.size])}" role="radiogroup" aria-labelledby="label" aria-errormessage="error-text"><div class="flex items-center gap-1 mb-2"><label part="form-control-label" id="label" class="${r("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><slot name="tooltip"></slot></div><div part="form-control-input" class="${r("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?a`<sd-3-22-0-button-group part="button-group" exportparts="base:button-group__base" role="presentation">${o}</sd-3-22-0-button-group>`:o}</div></fieldset>${this.formControlController.renderInvalidMessage()}`}};I.dependencies={"sd-3-22-0-button-group":C},I.styles=[e,i.styles,t`:host{display:block}:host([orientation=vertical]) ::slotted(sd-3-22-0-radio){margin-bottom:var(--sd-spacing-2,.5rem);display:flex}:host([orientation=vertical]) ::slotted(sd-3-22-0-radio:last-of-type){margin-bottom:var(--sd-spacing-0,0)}:host([orientation=horizontal]) ::slotted(sd-3-22-0-radio){margin-right:var(--sd-spacing-6,1.5rem)}:host([orientation=horizontal]) ::slotted(sd-3-22-0-radio:last-of-type){margin-right:var(--sd-spacing-0,0)}:host([orientation=horizontal]):host([size=sm]) ::slotted(sd-3-22-0-radio){margin-right:var(--sd-spacing-4,1rem)}:host([orientation=horizontal]):host([size=sm]) ::slotted(sd-3-22-0-radio:last-of-type){margin-right:var(--sd-spacing-0,0)}:host([required]) #label::after{content:' *'}`],k([o("slot:not([name])")],I.prototype,"defaultSlot",2),k([o("#validation-input")],I.prototype,"validationInput",2),k([o("#invalid-message")],I.prototype,"invalidMessage",2),k([p()],I.prototype,"hasButtonGroup",2),k([p()],I.prototype,"defaultValue",2),k([p()],I.prototype,"showInvalidStyle",2),k([s({reflect:!0})],I.prototype,"size",2),k([s({type:Boolean,reflect:!0})],I.prototype,"required",2),k([s({reflect:!0})],I.prototype,"orientation",2),k([s()],I.prototype,"label",2),k([s({type:Boolean,reflect:!0})],I.prototype,"boldLabel",2),k([s()],I.prototype,"name",2),k([s({reflect:!0})],I.prototype,"value",2),k([s({reflect:!0})],I.prototype,"form",2),k([g("size",{waitUntilFirstUpdate:!0})],I.prototype,"handleSizeChange",1),k([g("showInvalidStyle",{waitUntilFirstUpdate:!0})],I.prototype,"handleInvalidChange",1),k([g("value")],I.prototype,"handleValueChange",1),I=k([l("sd-3-22-0-radio-group")],I);export{I as default};
|
@@ -1 +1 @@
|
|
1
|
-
import"./icon.js";import{S as e,x as t,t as s,i,n as r,a}from"./solid-components2.js";import{r as l}from"./state.js";import{w as o}from"./watch.js";var n=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h=(e,t,s,i)=>{for(var r,a=i>1?void 0:i?d(t,s):t,l=e.length-1;l>=0;l--)(r=e[l])&&(a=(i?r(t,s,a):r(a))||a);return i&&a&&n(t,s,a),a};let c=class extends e{constructor(){super(...arguments),this.checked=!1,this.hasFocus=!1,this.size="lg",this.disabled=!1,this.invalid=!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="${s("sd-3-
|
1
|
+
import"./icon.js";import{S as e,x as t,t as s,i,n as r,a}from"./solid-components2.js";import{r as l}from"./state.js";import{w as o}from"./watch.js";var n=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h=(e,t,s,i)=>{for(var r,a=i>1?void 0:i?d(t,s):t,l=e.length-1;l>=0;l--)(r=e[l])&&(a=(i?r(t,s,a):r(a))||a);return i&&a&&n(t,s,a),a};let c=class extends e{constructor(){super(...arguments),this.checked=!1,this.hasFocus=!1,this.size="lg",this.disabled=!1,this.invalid=!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="${s("sd-3-22-0-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",md:"text-base",lg:"text-base"}[this.size])}"><span part="${this.checked?"control--checked":"control--unchecked"}" class="${s("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="${s("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="${s("ml-2 select-none inline-block",this.disabled?"text-neutral-500":this.invalid?"text-error":"text-black")}"></slot></span>`}};c.styles=[e.styles,i`:host{display:block;width:-moz-max-content;width:max-content}: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)}`],h([l()],c.prototype,"checked",2),h([l()],c.prototype,"hasFocus",2),h([r({reflect:!0})],c.prototype,"size",2),h([r({type:Boolean,reflect:!0})],c.prototype,"disabled",2),h([r()],c.prototype,"value",2),h([r({type:Boolean,reflect:!0})],c.prototype,"invalid",2),h([o("checked")],c.prototype,"handleCheckedChange",1),h([o("disabled",{waitUntilFirstUpdate:!0})],c.prototype,"handleDisabledChange",1),c=h([a("sd-3-22-0-radio")],c);export{c as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{S as t,x as l,t as o,r as e,c as r,i as s,n as i,a as n}from"./solid-components2.js";import{r as a}from"./state.js";import{I as c}from"./interactive.js";var d=Object.defineProperty,h=Object.getOwnPropertyDescriptor,b=(t,l,o,e)=>{for(var r,s=e>1?void 0:e?h(l,o):l,i=t.length-1;i>=0;i--)(r=t[i])&&(s=(e?r(l,o,s):r(s))||s);return e&&s&&d(l,o,s),s};let u=class extends t{constructor(){super(...arguments),this.orientation="horizontal",this.scrollbars=!1,this.buttons=!1,this.shadows=!1,this.inset=!1,this.step=150,this.canScroll={left:!1,right:!1,up:!1,down:!1},this.isScrollHorizontalEnabled=!1,this.isScrollVerticalEnabled=!1,this.scrollContainer=null}connectedCallback(){super.connectedCallback(),this.updateScrollEnabledFlags(),this.resizeObserver=new ResizeObserver((()=>{this.updateScrollIndicatorVisibility()})),this.updateComplete.then((()=>{this.scrollContainer=this.renderRoot.querySelector(".scroll-container"),this.scrollContainer&&this.resizeObserver.observe(this.scrollContainer)}))}disconnectedCallback(){super.disconnectedCallback(),this.scrollContainer&&this.resizeObserver.unobserve(this.scrollContainer)}updated(t){super.updated(t),(t.has("orientation")||t.has("buttons")||t.has("shadows"))&&(this.updateScrollEnabledFlags(),this.updateScrollIndicatorVisibility())}updateScrollEnabledFlags(){const t=this.orientation;this.isScrollHorizontalEnabled="horizontal"===t||"auto"===t,this.isScrollVerticalEnabled="vertical"===t||"auto"===t}get container(){return this.renderRoot.querySelector(".scroll-container")}updateScrollIndicatorVisibility(){const t=this.container;if(t){const l=this.isScrollHorizontalEnabled&&t.scrollLeft>0,o=this.isScrollHorizontalEnabled&&t.scrollLeft+t.clientWidth<t.scrollWidth-1,e=this.isScrollVerticalEnabled&&t.scrollTop>0,r=this.isScrollVerticalEnabled&&t.scrollTop+t.clientHeight<t.scrollHeight-1;this.canScroll={left:l,right:o,up:e,down:r},(l||e)&&this.dispatchEvent(new CustomEvent("start")),(o||r)&&this.dispatchEvent(new CustomEvent("end"))}}handleScroll(t){var l;const o="left"===t||"up"===t?-this.step:this.step,e={behavior:"smooth"};e["left"===t||"right"===t?"left":"top"]=o,null==(l=this.scrollContainer)||l.scrollBy(e);const r=`button-${t}`;this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0}))}render(){const t="relative p-0 border-0 bg-transparent cursor-pointer w-5 h-5 flex items-center justify-center sd-interactive rounded-md flex text-lg",e="scroll-shadow absolute z-10 pointer-events-none";return l`<div part="base" class="${o("scroll-container flex overflow-hidden flex-1","horizontal"===this.orientation&&"scroll-horizontal flex-row whitespace-nowrap items-center overflow-x-scroll overflow-y-hidden","vertical"===this.orientation&&"scroll-vertical justify-items-center overflow-y-scroll overflow-x-hidden","auto"===this.orientation&&"scroll-auto overflow-auto",this.scrollbars?"show-scrollbars":"hide-scrollbars",this.inset?"p-4":"")}" @scroll="${this.updateScrollIndicatorVisibility}"><div part="scroll-content" class="flex-1"><slot></slot></div></div>${this.buttons?l`${this.isScrollHorizontalEnabled?l`${this.canScroll.left?l`<div part="button-left" class="absolute z-10 flex items-center justify-center top-0 left-0 h-full w-8"><button part="button-start" class="${o(t)}" @click="${()=>this.handleScroll("left")}"><slot name="icon-start"><sd-3-
|
1
|
+
import{S as t,x as l,t as o,r as e,c as r,i as s,n as i,a as n}from"./solid-components2.js";import{r as a}from"./state.js";import{I as c}from"./interactive.js";var d=Object.defineProperty,h=Object.getOwnPropertyDescriptor,b=(t,l,o,e)=>{for(var r,s=e>1?void 0:e?h(l,o):l,i=t.length-1;i>=0;i--)(r=t[i])&&(s=(e?r(l,o,s):r(s))||s);return e&&s&&d(l,o,s),s};let u=class extends t{constructor(){super(...arguments),this.orientation="horizontal",this.scrollbars=!1,this.buttons=!1,this.shadows=!1,this.inset=!1,this.step=150,this.canScroll={left:!1,right:!1,up:!1,down:!1},this.isScrollHorizontalEnabled=!1,this.isScrollVerticalEnabled=!1,this.scrollContainer=null}connectedCallback(){super.connectedCallback(),this.updateScrollEnabledFlags(),this.resizeObserver=new ResizeObserver((()=>{this.updateScrollIndicatorVisibility()})),this.updateComplete.then((()=>{this.scrollContainer=this.renderRoot.querySelector(".scroll-container"),this.scrollContainer&&this.resizeObserver.observe(this.scrollContainer)}))}disconnectedCallback(){super.disconnectedCallback(),this.scrollContainer&&this.resizeObserver.unobserve(this.scrollContainer)}updated(t){super.updated(t),(t.has("orientation")||t.has("buttons")||t.has("shadows"))&&(this.updateScrollEnabledFlags(),this.updateScrollIndicatorVisibility())}updateScrollEnabledFlags(){const t=this.orientation;this.isScrollHorizontalEnabled="horizontal"===t||"auto"===t,this.isScrollVerticalEnabled="vertical"===t||"auto"===t}get container(){return this.renderRoot.querySelector(".scroll-container")}updateScrollIndicatorVisibility(){const t=this.container;if(t){const l=this.isScrollHorizontalEnabled&&t.scrollLeft>0,o=this.isScrollHorizontalEnabled&&t.scrollLeft+t.clientWidth<t.scrollWidth-1,e=this.isScrollVerticalEnabled&&t.scrollTop>0,r=this.isScrollVerticalEnabled&&t.scrollTop+t.clientHeight<t.scrollHeight-1;this.canScroll={left:l,right:o,up:e,down:r},(l||e)&&this.dispatchEvent(new CustomEvent("start")),(o||r)&&this.dispatchEvent(new CustomEvent("end"))}}handleScroll(t){var l;const o="left"===t||"up"===t?-this.step:this.step,e={behavior:"smooth"};e["left"===t||"right"===t?"left":"top"]=o,null==(l=this.scrollContainer)||l.scrollBy(e);const r=`button-${t}`;this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0}))}render(){const t="relative p-0 border-0 bg-transparent cursor-pointer w-5 h-5 flex items-center justify-center sd-interactive rounded-md flex text-lg",e="scroll-shadow absolute z-10 pointer-events-none";return l`<div part="base" class="${o("scroll-container flex overflow-hidden flex-1","horizontal"===this.orientation&&"scroll-horizontal flex-row whitespace-nowrap items-center overflow-x-scroll overflow-y-hidden","vertical"===this.orientation&&"scroll-vertical justify-items-center overflow-y-scroll overflow-x-hidden","auto"===this.orientation&&"scroll-auto overflow-auto",this.scrollbars?"show-scrollbars":"hide-scrollbars",this.inset?"p-4":"")}" @scroll="${this.updateScrollIndicatorVisibility}"><div part="scroll-content" class="flex-1"><slot></slot></div></div>${this.buttons?l`${this.isScrollHorizontalEnabled?l`${this.canScroll.left?l`<div part="button-left" class="absolute z-10 flex items-center justify-center top-0 left-0 h-full w-8"><button part="button-start" class="${o(t)}" @click="${()=>this.handleScroll("left")}"><slot name="icon-start"><sd-3-22-0-icon library="system" name="chevron-up" class="rotate-[-90deg]"></sd-3-22-0-icon></slot></button></div>`:null} ${this.canScroll.right?l`<div part="button-right" class="absolute z-10 flex items-center justify-center top-0 right-0 h-full w-8"><button part="button-end" class="${o(t)}" @click="${()=>this.handleScroll("right")}"><slot name="icon-end"><sd-3-22-0-icon library="system" name="chevron-down" class="rotate-[-90deg]"></sd-3-22-0-icon></slot></button></div>`:null}`:null} ${this.isScrollVerticalEnabled?l`${this.canScroll.up?l`<div part="button-top" class="absolute z-10 flex items-center justify-center top-0 left-0 w-full h-8"><button part="button-start" class="${o(t)}" @click="${()=>this.handleScroll("up")}"><slot name="icon-start"><sd-3-22-0-icon library="system" name="chevron-up"></sd-3-22-0-icon></slot></button></div>`:null} ${this.canScroll.down?l`<div part="button-bottom" class="absolute z-10 flex items-center justify-center bottom-0 left-0 w-full h-8"><button part="button-end" class="${o(t)}" @click="${()=>this.handleScroll("down")}"><slot name="icon-end"><sd-3-22-0-icon library="system" name="chevron-down"></sd-3-22-0-icon></slot></button></div>`:null}`:null}`:null} ${this.shadows?l`${this.isScrollHorizontalEnabled?l`${this.canScroll.left?l`<div part="shadow-left" class="${e} left top-0 left-0 w-[6px] h-full"></div>`:null} ${this.canScroll.right?l`<div part="shadow-right" class="${e} right top-0 right-0 w-[6px] h-full"></div>`:null}`:null} ${this.isScrollVerticalEnabled?l`${this.canScroll.up?l`<div part="shadow-top" class="${e} top top-0 left-0 w-full h-[6px]"></div>`:null} ${this.canScroll.down?l`<div part="shadow-bottom" class="${e} bottom bottom-0 left-0 w-full h-[6px]"></div>`:null}`:null}`:null}`}};u.styles=[t.styles,e(c),r,s`:host{--gradient-color:rgba(255, 255, 255, 0);--gradient:var(--gradient-color) 0%,#fff 80%,#fff 100%;position:relative;display:flex;overflow:hidden}.hide-scrollbars{scrollbar-width:none;-ms-overflow-style:none}.hide-scrollbars::-webkit-scrollbar{display:none}.scroll-container::-webkit-scrollbar-thumb{background-color:transparent}.scroll-container:hover::-webkit-scrollbar-thumb{background:var(--background-neutral-400,#c3c3c3);border-radius:var(--sd-border-radius-sm,.125rem)}.scroll-container::-webkit-scrollbar{height:var(--sd-spacing-1,.25rem);width:var(--sd-spacing-1,.25rem)}.scroll-auto{overflow:auto}[part=button-left]{background:linear-gradient(270deg,var(--gradient))}[part=button-right]{background:linear-gradient(90deg,var(--gradient))}[part=button-top]{background:linear-gradient(0deg,var(--gradient))}[part=button-bottom]{background:linear-gradient(180deg,var(--gradient))}[part=shadow-left]{background:linear-gradient(270deg,rgba(24,24,24,0) 50%,rgba(24,24,24,.4) 100%)}[part=shadow-right]{background:linear-gradient(90deg,rgba(24,24,24,0) 50%,rgba(24,24,24,.4) 100%)}[part=shadow-top]{background:linear-gradient(0deg,rgba(24,24,24,0) 50%,rgba(24,24,24,.4) 100%)}[part=shadow-bottom]{background:linear-gradient(180deg,rgba(24,24,24,0) 50%,rgba(24,24,24,.4) 100%)}.sd-3-22-0-icon--top{align-self:flex-start}.sd-3-22-0-icon--down{align-self:flex-end}`],b([i({type:String,reflect:!0})],u.prototype,"orientation",2),b([i({type:Boolean,reflect:!0})],u.prototype,"scrollbars",2),b([i({type:Boolean,reflect:!0})],u.prototype,"buttons",2),b([i({type:Boolean,reflect:!0})],u.prototype,"shadows",2),b([i({type:Boolean,reflect:!0})],u.prototype,"inset",2),b([i({type:Number,reflect:!0})],u.prototype,"step",2),b([a()],u.prototype,"canScroll",2),b([a()],u.prototype,"isScrollHorizontalEnabled",2),b([a()],u.prototype,"isScrollVerticalEnabled",2),u=b([n("sd-3-22-0-scrollable")],u);export{u as default};
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import{s as t,a as e}from"./animate.js";import{S as s,L as i,x as o,t as l,j as a,c as n,i as r,e as h,n as p,a as d}from"./solid-components2.js";import{d as c}from"./default-value.js";import{F as u}from"./form.js";import{g as m,s as y}from"./animation-registry.js";import{H as b}from"./slot.js";import{r as v}from"./state.js";import{o as f}from"./query-assigned-elements.js";import{s as g}from"./scroll.js";import{o as x,S as w}from"./icon.js";import{w as O}from"./event.js";import{w as C}from"./watch.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 s{constructor(){super(...arguments),this.formControlController=new u(this,{assumeInteractionOn:["sd-blur","sd-3-
|
1
|
+
import{s as t,a as e}from"./animate.js";import{S as s,L as i,x as o,t as l,j as a,c as n,i as r,e as h,n as p,a as d}from"./solid-components2.js";import{d as c}from"./default-value.js";import{F as u}from"./form.js";import{g as m,s as y}from"./animation-registry.js";import{H as b}from"./slot.js";import{r as v}from"./state.js";import{o as f}from"./query-assigned-elements.js";import{s as g}from"./scroll.js";import{o as x,S as w}from"./icon.js";import{w as O}from"./event.js";import{w as C}from"./watch.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 s{constructor(){super(...arguments),this.formControlController=new u(this,{assumeInteractionOn:["sd-blur","sd-3-22-0-input"]}),this.hasSlotController=new b(this,"help-text","label"),this.localize=new i(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.placement="bottom",this.label="",this.placeholder=this.localize.term("selectDefaultPlaceholder"),this.disabled=!1,this.helpText="",this.currentPlacement=this.placement,this.clearable=!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-3-22-0-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-3-21-0-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-3-21-0-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-3-21-0-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-3-21-0-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-3-21-0-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-3-21-0-option")]}getFirstOption(){return this.querySelector("sd-3-21-0-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?x(s):s}</div>`}return e===this.maxOptionsVisible?o`<sd-3-21-0-tag size="${"sm"===this.size?"sm":"lg"}" ?disabled="${this.disabled}">+${this.selectedOptions.length-e}</sd-3-21-0-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-3-21-0-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}=m(this,"select.show",{dir:this.localize.dir()});await e(this.popup.popup,s,i),this.currentOption&&g(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}=m(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,O(this,"sd-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,O(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,a=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],p={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return o`<div part="form-control" class="${l("relative text-left",r,"sm"===this.size?"text-sm":"text-base",this.open&&"z-50")}"><div class="flex items-center gap-1 mb-2"><label id="label" part="form-control-label" class="${s&&"inline-block"}" aria-hidden="${s?"false":"true"}" @click="${this.handleLabelClick}"><slot name="label">${this.label}</slot></label><slot name="tooltip"></slot></div><div part="form-control-input" class="${l("relative w-full bg-white","disabled"===n?"text-neutral-500":"text-black")}"><div part="border" class="${l("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-3-21-0-popup @sd-current-placement="${this.handleCurrentPlacement}" class="${l("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-3-22-0-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-3-22-0-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-3-22-0-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-3-22-0-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-3-22-0-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-3-22-0-option")]}getFirstOption(){return this.querySelector("sd-3-22-0-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?x(s):s}</div>`}return e===this.maxOptionsVisible?o`<sd-3-22-0-tag size="${"sm"===this.size?"sm":"lg"}" ?disabled="${this.disabled}">+${this.selectedOptions.length-e}</sd-3-22-0-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-3-22-0-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}=m(this,"select.show",{dir:this.localize.dir()});await e(this.popup.popup,s,i),this.currentOption&&g(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}=m(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,O(this,"sd-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,O(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,a=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],p={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return o`<div part="form-control" class="${l("relative text-left",r,"sm"===this.size?"text-sm":"text-base",this.open&&"z-50")}"><div class="flex items-center gap-1 mb-2"><label id="label" part="form-control-label" class="${s&&"inline-block"}" aria-hidden="${s?"false":"true"}" @click="${this.handleLabelClick}"><slot name="label">${this.label}</slot></label><slot name="tooltip"></slot></div><div part="form-control-input" class="${l("relative w-full bg-white","disabled"===n?"text-neutral-500":"text-black")}"><div part="border" class="${l("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-3-22-0-popup @sd-current-placement="${this.handleCurrentPlacement}" class="${l("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="${l("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="${l("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?o`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>`:""} <input class="${l("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}"> ${a?o`<button part="clear-button" class="${l("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-3-
|
7
|
+
"><div part="combobox" class="${l("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="${l("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?o`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>`:""} <input class="${l("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}"> ${a?o`<button part="clear-button" class="${l("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-3-22-0-icon class="${l("text-icon-fill-neutral-800",p)}" library="system" name="closing-round"></sd-3-22-0-icon></slot></button>`:""} ${this.showInvalidStyle?o`<sd-3-22-0-icon part="invalid-icon" class="${l(h,p,"text-error")}" library="system" name="risk"></sd-3-22-0-icon>`:""} ${this.styleOnValid&&this.showValidStyle?o`<sd-3-22-0-icon part="valid-icon" class="${l("flex-shrink-0 text-success",h,p)}" library="system" name="status-check"></sd-3-22-0-icon>`:""}<slot name="expand-icon" part="expand-icon" class="${l("inline-flex ml-2 transition-all",this.open?"rotate-180":"rotate-0",this.disabled?"text-neutral-500":"text-primary",p)}"><sd-3-22-0-icon name="chevron-down" part="chevron" library="system" color="currentColor"></sd-3-22-0-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="${l("bg-white px-2 py-3 relative border-primary overflow-y-auto",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-3-22-0-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-3-22-0-icon":w,"sd-3-22-0-popup":a,"sd-3-22-0-tag":S},I.styles=[n,s.styles,r`:host{position:relative;display:block;width:100%}:host([required]) #label::after{content:' *'}[part=listbox]{max-height:var(--auto-size-available-height,auto)}sd-3-22-0-popup::part(popup){z-index:var(--sd-z-index-dropdown,900);overflow-y:scroll}sd-3-22-0-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-3-22-0-tag[size=lg]::part(base){padding-left:var(--sd-spacing-2,.5rem);padding-right:var(--sd-spacing-2,.5rem)}sd-3-22-0-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([f({selector:"sd-3-22-0-option"})],I.prototype,"_optionsInDefaultSlot",2),D([h("sd-3-22-0-popup")],I.prototype,"popup",2),D([h('[part="combobox"]')],I.prototype,"combobox",2),D([h('[part="display-input"]')],I.prototype,"displayInput",2),D([h(".value-input")],I.prototype,"valueInput",2),D([h('[part="listbox"]')],I.prototype,"listbox",2),D([h("#invalid-message")],I.prototype,"invalidMessage",2),D([v()],I.prototype,"hasHover",2),D([v()],I.prototype,"displayLabel",2),D([v()],I.prototype,"hasFocus",2),D([v()],I.prototype,"currentOption",2),D([v()],I.prototype,"selectedOptions",2),D([v()],I.prototype,"showValidStyle",2),D([v()],I.prototype,"showInvalidStyle",2),D([c()],I.prototype,"defaultValue",2),D([p({type:Boolean,reflect:!0})],I.prototype,"open",2),D([p({reflect:!0})],I.prototype,"size",2),D([p({reflect:!0})],I.prototype,"placement",2),D([p()],I.prototype,"label",2),D([p()],I.prototype,"placeholder",2),D([p({type:Boolean,reflect:!0})],I.prototype,"disabled",2),D([p({attribute:"help-text"})],I.prototype,"helpText",2),D([v()],I.prototype,"currentPlacement",2),D([p({type:Boolean})],I.prototype,"clearable",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([d("sd-3-22-0-select")],I),y("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),y("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});export{I as default};
|