73 lines
8.8 KiB
JavaScript
73 lines
8.8 KiB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),c=require("react"),p=require("./create-component-D9KTUrcf.js"),t=require("./class-map-DV5418hw.js"),y=require("./query-assigned-elements-BYttmtWz.js"),d=require("./item-DvSwYnPq.js");require("./ripple-DoKzzEey.js");const v=require("./animation-A38fZ1oY.js"),a=require("./static-B9XIUGOk.js"),f=require("./delegate-4958lG3m.js");/**
|
|
* @license
|
|
* Copyright 2021 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/const b=new Set(Object.values(d.NavigableKeys));let h=class extends t.r{get items(){return this.listController.items}constructor(){super(),this.listController=new d.ListController({isItem:e=>e.hasAttribute("md-list-item"),getPossibleItems:()=>this.slotItems,isRtl:()=>getComputedStyle(this).direction==="rtl",deactivateItem:e=>{e.tabIndex=-1},activateItem:e=>{e.tabIndex=0},isNavigableKey:e=>b.has(e),isActivatable:e=>!e.disabled&&e.type!=="text"}),this.internals=this.attachInternals(),this.internals.role="list",this.addEventListener("keydown",this.listController.handleKeydown)}render(){return t.x`
|
|
<slot
|
|
@deactivate-items=${this.listController.onDeactivateItems}
|
|
@request-activation=${this.listController.onRequestActivation}
|
|
@slotchange=${this.listController.onSlotchange}>
|
|
</slot>
|
|
`}activateNextItem(){return this.listController.activateNextItem()}activatePreviousItem(){return this.listController.activatePreviousItem()}};t.__decorate([y.o({flatten:!0})],h.prototype,"slotItems",void 0);/**
|
|
* @license
|
|
* Copyright 2024 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/const x=t.i$1`:host{background:var(--md-list-container-color, var(--md-sys-color-surface, #fef7ff));color:unset;display:flex;flex-direction:column;outline:none;padding:8px 0;position:relative}
|
|
`;/**
|
|
* @license
|
|
* Copyright 2021 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/let l=class extends h{};l.styles=[x];l=t.__decorate([t.t$1("md-list")],l);/**
|
|
* @license
|
|
* Copyright 2022 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/const $=f.mixinDelegatesAria(t.r);class s extends ${constructor(){super(...arguments),this.disabled=!1,this.type="text",this.isListItem=!0,this.href="",this.target=""}get isDisabled(){return this.disabled&&this.type!=="link"}willUpdate(e){this.href&&(this.type="link"),super.willUpdate(e)}render(){return this.renderListItem(t.x`
|
|
<md-item>
|
|
<div slot="container">
|
|
${this.renderRipple()} ${this.renderFocusRing()}
|
|
</div>
|
|
<slot name="start" slot="start"></slot>
|
|
<slot name="end" slot="end"></slot>
|
|
${this.renderBody()}
|
|
</md-item>
|
|
`)}renderListItem(e){const o=this.type==="link";let r;switch(this.type){case"link":r=a.i`a`;break;case"button":r=a.i`button`;break;default:case"text":r=a.i`li`;break}const u=this.type!=="text",g=o&&this.target?this.target:t.E;return a.u`
|
|
<${r}
|
|
id="item"
|
|
tabindex="${this.isDisabled||!u?-1:0}"
|
|
?disabled=${this.isDisabled}
|
|
role="listitem"
|
|
aria-selected=${this.ariaSelected||t.E}
|
|
aria-checked=${this.ariaChecked||t.E}
|
|
aria-expanded=${this.ariaExpanded||t.E}
|
|
aria-haspopup=${this.ariaHasPopup||t.E}
|
|
class="list-item ${t.e$1(this.getRenderClasses())}"
|
|
href=${this.href||t.E}
|
|
target=${g}
|
|
@focus=${this.onFocus}
|
|
>${e}</${r}>
|
|
`}renderRipple(){return this.type==="text"?t.E:t.x` <md-ripple
|
|
part="ripple"
|
|
for="item"
|
|
?disabled=${this.isDisabled}></md-ripple>`}renderFocusRing(){return this.type==="text"?t.E:t.x` <md-focus-ring
|
|
@visibility-changed=${this.onFocusRingVisibilityChanged}
|
|
part="focus-ring"
|
|
for="item"
|
|
inward></md-focus-ring>`}onFocusRingVisibilityChanged(e){}getRenderClasses(){return{disabled:this.isDisabled}}renderBody(){return t.x`
|
|
<slot></slot>
|
|
<slot name="overline" slot="overline"></slot>
|
|
<slot name="headline" slot="headline"></slot>
|
|
<slot name="supporting-text" slot="supporting-text"></slot>
|
|
<slot
|
|
name="trailing-supporting-text"
|
|
slot="trailing-supporting-text"></slot>
|
|
`}onFocus(){this.tabIndex===-1&&this.dispatchEvent(d.createRequestActivationEvent())}focus(){var e;(e=this.listItemRoot)==null||e.focus()}}s.shadowRootOptions={...t.r.shadowRootOptions,delegatesFocus:!0};t.__decorate([t.n({type:Boolean,reflect:!0})],s.prototype,"disabled",void 0);t.__decorate([t.n({reflect:!0})],s.prototype,"type",void 0);t.__decorate([t.n({type:Boolean,attribute:"md-list-item",reflect:!0})],s.prototype,"isListItem",void 0);t.__decorate([t.n()],s.prototype,"href",void 0);t.__decorate([t.n()],s.prototype,"target",void 0);t.__decorate([v.e$1(".list-item")],s.prototype,"listItemRoot",void 0);/**
|
|
* @license
|
|
* Copyright 2024 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/const I=t.i$1`:host{display:flex;-webkit-tap-highlight-color:rgba(0,0,0,0);--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}:host(:is([type=button]:not([disabled]),[type=link])){cursor:pointer}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;cursor:inherit;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0);width:100%}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}@media(forced-colors: active){.disabled slot{color:GrayText}.list-item.disabled{color:GrayText;opacity:1}}
|
|
`;/**
|
|
* @license
|
|
* Copyright 2022 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/let n=class extends s{};n.styles=[I];n=t.__decorate([t.t$1("md-list-item")],n);const w=p.o({react:c,tagName:"md-list",elementClass:l}),_=i=>{const{children:e,...o}=i;return m.jsx(w,{...o,children:e})},C=p.o({react:c,tagName:"md-list-item",elementClass:n}),L=i=>{const{children:e,...o}=i,r=i.type||"text";return m.jsx(C,{...o,type:r,children:e})};exports.List=_;exports.ListItem=L;
|