@pg-labs-incubator/cobweb 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/package.json +7 -4
  2. package/target/esbuild/action/action.css +1 -1
  3. package/target/esbuild/action/base.jsx +1 -1
  4. package/target/esbuild/action/button.jsx +3 -3
  5. package/target/esbuild/action/fab-menu-context.jsx +1 -1
  6. package/target/esbuild/action/fab-menu.jsx +3 -3
  7. package/target/esbuild/action/fab.jsx +3 -3
  8. package/target/esbuild/action/group.jsx +7 -7
  9. package/target/esbuild/action/icon-button.jsx +3 -3
  10. package/target/esbuild/action/index.jsx +1 -1
  11. package/target/esbuild/action/split-button.jsx +4 -4
  12. package/target/esbuild/color/contrast.jsx +1 -1
  13. package/target/esbuild/color/dynamic.jsx +1 -1
  14. package/target/esbuild/color/hct.jsx +1 -1
  15. package/target/esbuild/color/index.jsx +1 -1
  16. package/target/esbuild/color/palette.jsx +1 -1
  17. package/target/esbuild/color/scheme.jsx +1 -1
  18. package/target/esbuild/color/temperature.jsx +1 -1
  19. package/target/esbuild/container/card.jsx +1 -1
  20. package/target/esbuild/container/elevation-shadow.jsx +1 -1
  21. package/target/esbuild/container/index.jsx +1 -1
  22. package/target/esbuild/dom/client.jsx +1 -1
  23. package/target/esbuild/dom/index.jsx +1 -1
  24. package/target/esbuild/dom/server.jsx +1 -1
  25. package/target/esbuild/dom/types.jsx +1 -1
  26. package/target/esbuild/feedback/badge.jsx +6 -6
  27. package/target/esbuild/feedback/focus.jsx +1 -1
  28. package/target/esbuild/feedback/index.jsx +1 -1
  29. package/target/esbuild/feedback/loading.jsx +3 -3
  30. package/target/esbuild/feedback/observe.jsx +1 -1
  31. package/target/esbuild/feedback/progress.jsx +9 -9
  32. package/target/esbuild/feedback/snackbar.jsx +6 -6
  33. package/target/esbuild/feedback/tooltip.jsx +6 -6
  34. package/target/esbuild/icon/icon.jsx +1 -1
  35. package/target/esbuild/icon/index.jsx +1 -1
  36. package/target/esbuild/index.jsx +1 -1
  37. package/target/esbuild/input/autocomplete.jsx +2 -2
  38. package/target/esbuild/input/base.jsx +2 -2
  39. package/target/esbuild/input/date-picker.jsx +19 -19
  40. package/target/esbuild/input/date-time.jsx +3 -3
  41. package/target/esbuild/input/index.jsx +1 -1
  42. package/target/esbuild/input/paired-input.jsx +1 -1
  43. package/target/esbuild/input/picker-dialog.jsx +3 -3
  44. package/target/esbuild/input/select.jsx +4 -4
  45. package/target/esbuild/input/slider.jsx +7 -7
  46. package/target/esbuild/input/text-field.jsx +4 -4
  47. package/target/esbuild/input/time-picker.jsx +5 -5
  48. package/target/esbuild/motion/follow-height.jsx +1 -0
  49. package/target/esbuild/motion/frame.jsx +1 -1
  50. package/target/esbuild/motion/index.jsx +1 -1
  51. package/target/esbuild/motion/material.jsx +1 -1
  52. package/target/esbuild/motion/motion.jsx +1 -1
  53. package/target/esbuild/motion/spring.jsx +1 -1
  54. package/target/esbuild/motion/transition.jsx +1 -1
  55. package/target/esbuild/motion/velocity.jsx +1 -1
  56. package/target/esbuild/navigation/app-bar.jsx +8 -8
  57. package/target/esbuild/navigation/base.jsx +1 -1
  58. package/target/esbuild/navigation/drawer.jsx +7 -7
  59. package/target/esbuild/navigation/index.jsx +1 -1
  60. package/target/esbuild/navigation/navigation.jsx +12 -12
  61. package/target/esbuild/navigation/scroll.jsx +1 -1
  62. package/target/esbuild/navigation/search.jsx +4 -4
  63. package/target/esbuild/navigation/tabs.jsx +3 -3
  64. package/target/esbuild/navigation/toolbar.jsx +3 -3
  65. package/target/esbuild/selection/base.jsx +1 -1
  66. package/target/esbuild/selection/checkbox.jsx +4 -4
  67. package/target/esbuild/selection/chip.jsx +5 -5
  68. package/target/esbuild/selection/index.jsx +1 -1
  69. package/target/esbuild/selection/radio.jsx +3 -3
  70. package/target/esbuild/selection/segmented.jsx +4 -4
  71. package/target/esbuild/selection/switch.jsx +3 -3
  72. package/target/esbuild/shape/corner-rounding.jsx +1 -1
  73. package/target/esbuild/shape/cubic.jsx +1 -1
  74. package/target/esbuild/shape/index.jsx +1 -1
  75. package/target/esbuild/shape/material-shapes.jsx +1 -1
  76. package/target/esbuild/shape/morph.jsx +1 -1
  77. package/target/esbuild/shape/path.jsx +1 -1
  78. package/target/esbuild/shape/point.jsx +1 -1
  79. package/target/esbuild/shape/rounded-polygon.jsx +1 -1
  80. package/target/esbuild/shape/shapes.jsx +1 -1
  81. package/target/esbuild/spacing/index.jsx +1 -1
  82. package/target/esbuild/state/component.css +1 -1
  83. package/target/esbuild/state/component.jsx +1 -1
  84. package/target/esbuild/state/controller.jsx +1 -1
  85. package/target/esbuild/state/index.jsx +1 -1
  86. package/target/esbuild/state/ripple.jsx +1 -1
  87. package/target/esbuild/state/state.jsx +1 -1
  88. package/target/esbuild/state/style.jsx +1 -1
  89. package/target/esbuild/surface/carousel-layout.jsx +1 -1
  90. package/target/esbuild/surface/carousel.jsx +2 -2
  91. package/target/esbuild/surface/dialog.jsx +5 -5
  92. package/target/esbuild/surface/divider.jsx +1 -1
  93. package/target/esbuild/surface/drag.jsx +1 -1
  94. package/target/esbuild/surface/gestures.jsx +3 -3
  95. package/target/esbuild/surface/index.jsx +1 -1
  96. package/target/esbuild/surface/interactive.jsx +1 -1
  97. package/target/esbuild/surface/list-patterns.jsx +3 -3
  98. package/target/esbuild/surface/list.jsx +2 -2
  99. package/target/esbuild/surface/menu.jsx +3 -3
  100. package/target/esbuild/surface/scaffold.jsx +7 -7
  101. package/target/esbuild/surface/sheet.jsx +5 -5
  102. package/target/esbuild/surface/side-sheet.jsx +2 -2
  103. package/target/esbuild/surface/slots.jsx +1 -1
  104. package/target/esbuild/surface/surface.jsx +1 -1
  105. package/target/esbuild/text/index.jsx +1 -1
  106. package/target/esbuild/text/text.jsx +2 -2
  107. package/target/esbuild/text/typography.jsx +1 -1
  108. package/target/esbuild/util/box-side.jsx +1 -1
  109. package/target/esbuild/util/debug.jsx +1 -1
  110. package/target/esbuild/util/dom.jsx +1 -1
  111. package/target/esbuild/util/environment.jsx +1 -0
  112. package/target/esbuild/util/event.jsx +1 -1
  113. package/target/esbuild/util/index.jsx +1 -1
  114. package/target/esbuild/util/preconditions.jsx +1 -1
  115. package/target/esbuild/util/reactive.jsx +1 -1
  116. package/target/node/color.js +1 -0
  117. package/target/node/shape.js +1 -0
  118. package/target/tsc/motion/follow-height.d.ts +51 -0
  119. package/target/tsc/motion/index.d.ts +7 -3
  120. package/target/tsc/motion/spring.d.ts +3 -3
  121. package/target/tsc/shape/index.d.ts +1 -1
  122. package/target/tsc/shape/material-shapes.d.ts +56 -0
  123. package/target/tsc/shape/path.d.ts +16 -0
  124. package/target/tsc/util/environment.d.ts +14 -0
  125. package/target/tsc/util/index.d.ts +2 -1
  126. package/target/tsc/util/preconditions.d.ts +0 -14
@@ -1,4 +1,4 @@
1
- import{createComponent as D,createContext as k,onCleanup as z,onMount as H,untrack as f,useContext as R}from"solid-js";import{defineDomComponent as S}from"..";import{DomController as E}from"../dom/client";import{deferAfterDelegatedCancellation as v}from"../util";import{carouselKeylinesAt as _,carouselMaxScroll as O,carouselSnapOffset as N,carouselStrategy as B,placeCarouselItem as F}from"./carousel-layout";import{hasNestedInteractive as $,isElementNode as V}from"./interactive";import"./carousel.css";const X=240,J=40,q=8,G=9/16,U=16/9,K=150,g=.5,L="cw-carousel-label-change",W="data-cw-carousel-slide",p="data-cw-carousel-generated-label",A="cw-Carousel-controls",Z=`${A} cw-Carousel-controls-hidden`,M=k();function I(s){return s===void 0||!Number.isFinite(s)?void 0:Math.max(0,Math.trunc(s))}function C(s){return s!==void 0&&Number.isFinite(s)?Math.trunc(s):0}function w(s){return f(()=>C("index"in s?s.index:"activeIndex"in s?s.activeIndex:s.defaultIndex))}function T(s){return s===void 0||!Number.isFinite(s)?1:Math.max(G,Math.min(U,s))}function j(s){return s==="multi-browse"||s==="hero"||s==="center-aligned-hero"||s==="uncontained"}function P(s,e){const t=I(e.itemCount),i=Math.max(0,w(e)),n=t===void 0?i:Math.min(i,Math.max(0,t-1)),o=e.loop===!0;return<div{...s}aria-label={s["aria-label"]??e.label??"Carousel"}aria-roledescription="carousel"classList={{...s.classList,"cw-Carousel":!0,[`_cw-Carousel-${e.orientation??"horizontal"}`]:!0}}data-cw-carousel-layout={e.layout??"full-screen"}data-cw-carousel-orientation={e.orientation??"horizontal"}data-cw-carousel-snap={e.snap===!0?"true":"false"}role="region">
1
+ import{createComponent as D,createContext as k,onCleanup as z,onMount as H,untrack as f,useContext as R}from"solid-js";import{defineDomComponent as S}from"..";import{DomController as E}from"../dom/client";import{deferAfterDelegatedCancellation as v}from"../util";import{carouselKeylinesAt as _,carouselMaxScroll as O,carouselSnapOffset as N,carouselStrategy as B,placeCarouselItem as F}from"./carousel-layout";import{hasNestedInteractive as $,isElementNode as V}from"./interactive";import"./carousel.css";const X=240,J=40,q=8,G=9/16,U=16/9,K=150,g=0.5,L="cw-carousel-label-change",W="data-cw-carousel-slide",p="data-cw-carousel-generated-label",A="cw-Carousel-controls",Z=`${A} cw-Carousel-controls-hidden`,M=k();function I(s){return s===void 0||!Number.isFinite(s)?void 0:Math.max(0,Math.trunc(s));}function C(s){return s!==void 0&&Number.isFinite(s)?Math.trunc(s):0;}function w(s){return f(()=>C("index"in s?s.index:"activeIndex"in s?s.activeIndex:s.defaultIndex));}function T(s){return s===void 0||!Number.isFinite(s)?1:Math.max(G,Math.min(U,s));}function j(s){return s==="multi-browse"||s==="hero"||s==="center-aligned-hero"||s==="uncontained";}function P(s,e){const t=I(e.itemCount),i=Math.max(0,w(e)),n=t===void 0?i:Math.min(i,Math.max(0,t-1)),o=e.loop===!0;return<div{...s}aria-label={s["aria-label"]??e.label??"Carousel"}aria-roledescription="carousel"classList={{...s.classList,"cw-Carousel":!0,[`_cw-Carousel-${e.orientation??"horizontal"}`]:!0}}data-cw-carousel-layout={e.layout??"full-screen"}data-cw-carousel-orientation={e.orientation??"horizontal"}data-cw-carousel-snap={e.snap===!0?"true":"false"}role="region">
2
2
  <div class={e.showControls===!1?Z:A}>
3
3
  <button aria-label={e.previousLabel??"Previous"}class="cw-Carousel-previous"data-cw-carousel-previous disabled={t!==void 0&&!o&&n<=0}type="button">{e.previousLabel??"Previous"}</button>
4
4
  <button aria-label={e.nextLabel??"Next"}class="cw-Carousel-next"data-cw-carousel-next disabled={t!==void 0&&!o&&n>=t-1}type="button">{e.nextLabel??"Next"}</button>
@@ -7,4 +7,4 @@ import{createComponent as D,createContext as k,onCleanup as z,onMount as H,untra
7
7
  <div class="cw-Carousel-viewport"data-cw-carousel-viewport tabIndex={0}>
8
8
  <div class="cw-Carousel-track"data-cw-carousel-track>{s.children}</div>
9
9
  </div>
10
- </div>}class Y extends E{#o;#t;#f;#E;#a;#u;#m;#i;#e;#h;#n;#r;#c;#p;#w;#b;#l;#d;#v;#s;#L;#A;#y;#C;constructor(e){super(e,{styleElementIsFunction:!0}),this.#o="index"in e||"activeIndex"in e,this.#t=null,this.#f=null,this.#E=null,this.#a=null,this.#u=null,this.#m=null,this.#i=[],this.#e=Math.max(0,w(e)),this.#h=void 0,this.#n=f(()=>e.orientation??"horizontal"),this.#r=!1,this.#c=void 0,this.#p=0,this.#w=[],this.#b=new Set,this.#l=void 0,this.#d=void 0,this.#v=!1,this.#s=void 0,this.#L=!1,this.#A=0,this.#y=void 0,this.#C=void 0,H(()=>this.#g()),z(()=>this.#ee())}#x(){return this.props.layout??"full-screen"}#M(){const e=this.#t;return e===null?0:this.#n==="vertical"?e.scrollTop:e.scrollLeft*(this.#r?-1:1)}#q(){const e=this.#f;this.#i=e===null?[]:Array.from(e.children).filter(t=>t.hasAttribute(W)),this.#b.clear()}#g(){this.#t?.isConnected===!0&&(this.#C===void 0&&this.#Q(),this.#q(),this.#I(),this.#O(),this.#$())}#I(){const e=this.#t,t=this.#x(),i=this.#n==="vertical",n=this.#i;if(e===null)return;const o=e.ownerDocument.defaultView,r=i?e.clientHeight:e.clientWidth,d=Math.max(J,this.props.itemSize??X),h=Math.max(0,this.props.itemGap??q),m=i?"scroll-margin-block-start":"scroll-margin-inline-start",b=i?"scroll-margin-inline-start":"scroll-margin-block-start";this.#A=r,this.#r=!i&&o?.getComputedStyle(e).direction==="rtl",this.#c=!j(t)||r<=0?void 0:B(t,r,d,h,n.length),e.style.setProperty("--cw-carousel-item-gap",`${h}px`),e.style.setProperty("--cw-carousel-item-size",`${this.#c?.itemSize??d}px`);const c=this.#c;if(c!==void 0){const l=c.itemSize+c.itemSpacing;this.#p=O(c,n.length),this.#w=n.map((u,y)=>{const x=N(c,y,n.length);return u.style.setProperty(m,`${x}px`),u.style.removeProperty(b),Math.min(this.#p,Math.max(0,y*l-x))});for(const u of n)u.style.visibility="hidden",u.inert=!0;this.#T();return}this.#p=0;for(const l of n)l.style.removeProperty(m),l.style.removeProperty(b),l.style.removeProperty("--cw-carousel-item-offset"),l.style.removeProperty("--cw-carousel-item-inset"),l.style.removeProperty("visibility");const a=this.#f?.getBoundingClientRect();this.#w=a===void 0?[]:n.map(l=>{const u=l.getBoundingClientRect();return i?u.top-a.top:this.#r?a.right-u.right:u.left-a.left})}#T(){const e=this.#c,t=this.#i;if(e===void 0)return;const i=Math.max(0,Math.min(this.#p,this.#M())),n=_(e,i,this.#p),o=e.itemSize+e.itemSpacing,r=n.length,d=Math.max(0,Math.floor(i/o)-r),h=Math.ceil((i+e.availableSpace)/o),m=Math.min(t.length-1,h+r),b=this.#r?-1:1,c=new Set;for(let a=d;a<=m;a++){const l=F(e,n,a,i),u=t[a];l.visible&&(u.style.setProperty("--cw-carousel-item-offset",`${l.translation*b}px`),u.style.setProperty("--cw-carousel-item-inset",`${Math.max(0,(e.itemSize-l.maskSize)/2)}px`),this.#b.has(a)||(u.style.removeProperty("visibility"),u.inert=!1),c.add(a))}for(const a of this.#b){const l=t[a];l!==void 0&&!c.has(a)&&(l.style.visibility="hidden",l.inert=!0)}this.#b=c}#_(){const e=this.#w,t=this.#M();let i=0,n=e.length-1;for(;i<n;){const o=Math.floor((i+n)/2);e[o]<t?i=o+1:n=o}return i>0&&t-e[i-1]<e[i]-t?i-1:i}#O(){const e=this.#i,t=this.#x(),i=this.#c!==void 0;this.#o&&(this.#e=C(this.props.index??this.props.activeIndex)),this.#e=Math.max(0,Math.min(this.#e,e.length-1));for(const[n,o]of e.entries())(!o.hasAttribute("aria-label")||o.hasAttribute(p))&&(o.setAttribute("aria-label",`Slide ${n+1} of ${e.length}`),o.setAttribute(p,"true")),o.setAttribute("aria-current",n===this.#e?"true":"false"),t==="full-screen"?o.inert=n!==this.#e:i||(o.inert=!1);this.#D()}#P(e,t){const i=this.#x()==="full-screen";for(const[n,o]of[[e,!1],[t,!0]]){const r=this.#i[n];r!==void 0&&(r.setAttribute("aria-current",o?"true":"false"),i&&(r.inert=!o))}this.#D()}#D(){const e=this.props.loop===!0,t=this.#i.length;this.#a!==null&&(this.#a.disabled=t===0||!e&&this.#e<=0),this.#u!==null&&(this.#u.disabled=t===0||!e&&this.#e>=t-1)}#k(e,t,i){const n=this.#i.length,o=this.props.loop===!0?(e%n+n)%n:Math.max(0,Math.min(e,n-1)),r=this.#e;if(!(n===0||o===r)){if(this.#o){this.#S(o,t);return}this.#e=o,this.#P(r,o),this.#z(i),this.#S(o,t)}}#S(e,t){f(()=>this.props.onIndexChange?.(e,t))}#z(e){const t=this.#t,i=this.#i[this.#e],n=t?.ownerDocument.defaultView;if(t===null||i===void 0||n==null)return;const o=n.matchMedia("(prefers-reduced-motion: reduce)").matches;this.#N(o?"auto":"smooth"),e&&(i.inert=!1,i.style.removeProperty("visibility"),i.focus({preventScroll:!0}))}#N(e){const t=this.#t,i=this.#i[this.#e],n=this.#n==="vertical";if(t===null||i===void 0)return;if(this.#c!==void 0){const h=this.#w[this.#e]??0,m=this.#r?-h:h;if(Math.abs(h-this.#M())<g)return;this.#B(),t.scrollTo(n?{behavior:e,top:h}:{behavior:e,left:m});return}const o=t.getBoundingClientRect(),r=i.getBoundingClientRect(),d=n?r.top-o.top:this.#r?r.right-o.right:r.left-o.left;!Number.isFinite(d)||Math.abs(d)<g||(this.#B(),t.scrollBy({behavior:e,left:n?0:d,top:n?d:0}))}#B(){this.#v=!0,this.#F()}#F(){const e=this.#t?.ownerDocument.defaultView;this.#s!==void 0&&e?.clearTimeout(this.#s),this.#s=e?.setTimeout(this.#J,K)}#$(){const e=this.#t?.ownerDocument.defaultView;e!=null&&(this.#d!==void 0&&e.cancelAnimationFrame(this.#d),this.#d=e.requestAnimationFrame(()=>{this.#d=void 0,this.#N("auto"),this.#T()}))}#V(){this.#l=void 0,this.#T(),this.#v||this.#X()}#X(){const e=this.#i.length===0?this.#e:this.#_(),t=this.#e;if(!(e===t&&this.#h===void 0)){if(this.#o){e!==(this.#h??t)&&(this.#h=e===t?void 0:e,e!==t&&this.#S(e));return}this.#e=e,this.#P(t,e),this.#S(e)}}#G=()=>{const e=this.#t?.ownerDocument.defaultView;(this.#v||!this.#L)&&this.#F(),!(this.#l!==void 0||e==null)&&(this.#l=e.requestAnimationFrame(()=>this.#V()))};#J=()=>{const e=this.#t?.ownerDocument.defaultView;if(this.#s!==void 0&&e?.clearTimeout(this.#s),this.#s=void 0,this.#l!==void 0&&(e?.cancelAnimationFrame(this.#l),this.#V()),this.#v){this.#v=!1,this.#X();return}!this.#o||this.#i.length===0||(this.#h=void 0,this.#_()!==this.#e&&this.#z(!1))};#U=e=>v(e,this.#t,()=>this.#k(this.#e-1,e,!1),!1);#K=e=>v(e,this.#t,()=>this.#k(this.#e+1,e,!1),!1);#W=e=>{f(()=>this.props.onShowAll?.(e))};#Z=()=>{this.#x()==="uncontained-multi-aspect-ratio"&&this.#I(),this.#O()};#j=e=>{const t=this.#t,i=this.#n==="horizontal",n=i?this.#r?"ArrowLeft":"ArrowRight":"ArrowDown",o=i?this.#r?"ArrowRight":"ArrowLeft":"ArrowUp";if(e.defaultPrevented||t===null||e.target!==t&&V(e.target)&&$(e.target,t,e.composedPath()))return;const r=e.key==="Home"?0:e.key==="End"?this.#i.length-1:e.key===n?this.#e+1:e.key===o?this.#e-1:void 0;r!==void 0&&v(e,t,()=>this.#k(r,e,!0))};applyComponentProps(){const e=super.readProps(["activeIndex","index","itemGap","itemSize","label","layout","loop","nextLabel","onShowAll","orientation","previousLabel","showAllLabel","showControls","snap","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Carousel";let i=e.layoutChanged||e.itemSizeChanged||e.itemGapChanged;e.snapChanged&&super.setAttribute("data-cw-carousel-snap",e.snap===!0?"true":"false"),e.layoutChanged&&super.setAttribute("data-cw-carousel-layout",e.layout??"full-screen"),e.orientationChanged&&(this.#n=e.orientation??"horizontal",super.setAttribute("data-cw-carousel-orientation",this.#n),super.setClass("orientation",`_cw-Carousel-${this.#n}`),i=!0),super.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t),this.#m!==null&&(e.onShowAllChanged||e.showAllLabelChanged)&&(this.#m.hidden=e.onShowAll===void 0,this.#m.textContent=e.showAllLabel??"Show all"),e.previousLabelChanged&&this.#a!==null&&(this.#a.setAttribute("aria-label",e.previousLabel??"Previous"),this.#a.textContent=e.previousLabel??"Previous"),e.nextLabelChanged&&this.#u!==null&&(this.#u.setAttribute("aria-label",e.nextLabel??"Next"),this.#u.textContent=e.nextLabel??"Next"),e.showControlsChanged&&this.#E?.classList.toggle("cw-Carousel-controls-hidden",e.showControls===!1),i?this.#g():e.loopChanged&&this.#D(),this.#o&&(e.indexChanged||e.activeIndexChanged)&&this.#Y(C("index"in this.props?e.index:e.activeIndex))}#Y(e){const t=Math.max(0,Math.min(e,this.#i.length-1)),i=this.#e,n=t===this.#h;this.#h=void 0,!(this.#i.length===0||t===i)&&(this.#e=t,this.#P(i,t),n||this.#z(!1))}#H(e,t){const i=t?"addEventListener":"removeEventListener",n=this.#t;n?.[i]("scroll",this.#G,{passive:!0}),n?.[i]("scrollend",this.#J),n?.[i]("keydown",this.#j),this.#a?.[i]("click",this.#U),this.#u?.[i]("click",this.#K),this.#m?.[i]("click",this.#W),e?.[i](L,this.#Z)}#R(){this.#y?.disconnect(),this.#C?.disconnect(),this.#y=void 0,this.#C=void 0}#Q(){const e=this.#t,t=e?.ownerDocument.defaultView;this.#R(),!(t==null||e===null||this.#f===null)&&(this.#y=new t.MutationObserver(()=>this.#g()),this.#y.observe(this.#f,{childList:!0}),this.#C=new t.ResizeObserver(()=>{(this.#n==="vertical"?e.clientHeight:e.clientWidth)!==this.#A&&(this.#I(),this.#$())}),this.#C.observe(e))}onStyleElementChanged(e){this.#H(super.styleElement,!1),super.onStyleElementChanged(e),this.#t=e?.querySelector("[data-cw-carousel-viewport]")??null,this.#f=this.#t?.querySelector(":scope > [data-cw-carousel-track]")??null,this.#E=e?.querySelector(".cw-Carousel-controls")??null,this.#a=e?.querySelector("[data-cw-carousel-previous]")??null,this.#u=e?.querySelector("[data-cw-carousel-next]")??null,this.#m=e?.querySelector(".cw-Carousel-showAll")??null,this.#L=this.#t!==null&&"onscrollend"in this.#t,this.#H(e,!0),this.#R(),this.#g()}render(e){return f(()=>P({children:e},{index:this.#e,itemCount:this.props.itemCount,label:this.props["attr:aria-label"]??this.props.label,layout:this.props.layout,loop:this.props.loop,nextLabel:this.props.nextLabel,onShowAll:this.props.onShowAll,orientation:this.#n,previousLabel:this.props.previousLabel,showAllLabel:this.props.showAllLabel,showControls:this.props.showControls,snap:this.props.snap}))}#ee(){const e=this.#t?.ownerDocument.defaultView;this.#s!==void 0&&e?.clearTimeout(this.#s),this.#l!==void 0&&e?.cancelAnimationFrame(this.#l),this.#d!==void 0&&e?.cancelAnimationFrame(this.#d),this.#s=void 0,this.#l=void 0,this.#d=void 0,this.#R(),this.#H(super.styleElement,!1),this.#i=[],this.#b.clear()}}const Q=S(()=>P,()=>Y),de=s=>D(M.Provider,{value:f(()=>{const e=I(s.itemCount),t=Math.max(0,w(s));let i=0;return{layout:s.layout??"full-screen",currentIndex:e===void 0?t:Math.min(t,Math.max(0,e-1)),itemCount:e,nextItemIndex:()=>i++}}),get children(){return f(()=>Q(s))}});function ee(s,e){const t=R(M),i=t?.nextItemIndex()??0,n=s["aria-label"]??e.label,o=t===void 0?void 0:i===t.currentIndex?"true":"false",r=t?.itemCount===void 0?`Slide ${i+1}`:`Slide ${i+1} of ${t.itemCount}`;return<div{...s}aria-current={o}aria-label={n??r}aria-roledescription="slide"classList={{...s.classList,"cw-Carousel-slide":!0}}data-cw-carousel-generated-label={n===void 0?"true":void 0}data-cw-carousel-slide="true"inert={t?.layout==="full-screen"&&i!==t.currentIndex}role="group"style={{...s.style,"--cw-carousel-aspect-ratio":T(e.aspectRatio)}}tabIndex={-1}><div class="cw-Carousel-mask">{s.children}</div></div>}class te extends E{constructor(e){super(e,{styleElementIsFunction:!0})}#o(){super.styleElement?.dispatchEvent(new Event(L,{bubbles:!0}))}applyComponentProps(){const e=super.readProps(["aspectRatio","label","attr:aria-label"]),t=e["attr:aria-label"]??e.label,i=super.styleElement,n=i?.hasAttribute(p)===!0,o=t===void 0?n&&i?.hasAttribute("aria-label")===!0:!n&&i?.getAttribute("aria-label")===t;e.aspectRatioChanged&&(super.setStyle("--cw-carousel-aspect-ratio",T(e.aspectRatio)),this.#o()),!o&&(t===void 0?(super.setAttribute("aria-label",void 0),i?.setAttribute(p,"true")):(i?.removeAttribute(p),super.setAttribute("aria-label",t)),this.#o())}render(e){return<div aria-roledescription="slide"class="cw-Carousel-slide"data-cw-carousel-slide="true"role="group"tabIndex={-1}><div class="cw-Carousel-mask">{e}</div></div>}}const ie=S(()=>ee,()=>te),he=ie;export{de as Carousel,Y as CarouselController,ie as CarouselItem,he as CarouselSlide};
10
+ </div>;}class Y extends E{#o;#t;#f;#E;#a;#u;#m;#i;#e;#h;#n;#r;#c;#p;#w;#b;#l;#d;#v;#s;#L;#A;#y;#C;constructor(e){super(e,{styleElementIsFunction:!0}),this.#o="index"in e||"activeIndex"in e,this.#t=null,this.#f=null,this.#E=null,this.#a=null,this.#u=null,this.#m=null,this.#i=[],this.#e=Math.max(0,w(e)),this.#h=void 0,this.#n=f(()=>e.orientation??"horizontal"),this.#r=!1,this.#c=void 0,this.#p=0,this.#w=[],this.#b=/* @__PURE__ */new Set(),this.#l=void 0,this.#d=void 0,this.#v=!1,this.#s=void 0,this.#L=!1,this.#A=0,this.#y=void 0,this.#C=void 0,H(()=>this.#g()),z(()=>this.#ee());}#x(){return this.props.layout??"full-screen";}#M(){const e=this.#t;return e===null?0:this.#n==="vertical"?e.scrollTop:e.scrollLeft*(this.#r?-1:1);}#q(){const e=this.#f;this.#i=e===null?[]:Array.from(e.children).filter(t=>t.hasAttribute(W)),this.#b.clear();}#g(){this.#t?.isConnected===!0&&(this.#C===void 0&&this.#Q(),this.#q(),this.#I(),this.#O(),this.#$());}#I(){const e=this.#t,t=this.#x(),i=this.#n==="vertical",n=this.#i;if(e===null)return;const o=e.ownerDocument.defaultView,r=i?e.clientHeight:e.clientWidth,d=Math.max(J,this.props.itemSize??X),h=Math.max(0,this.props.itemGap??q),m=i?"scroll-margin-block-start":"scroll-margin-inline-start",b=i?"scroll-margin-inline-start":"scroll-margin-block-start";this.#A=r,this.#r=!i&&o?.getComputedStyle(e).direction==="rtl",this.#c=!j(t)||r<=0?void 0:B(t,r,d,h,n.length),e.style.setProperty("--cw-carousel-item-gap",`${h}px`),e.style.setProperty("--cw-carousel-item-size",`${this.#c?.itemSize??d}px`);const c=this.#c;if(c!==void 0){const l=c.itemSize+c.itemSpacing;this.#p=O(c,n.length),this.#w=n.map((u,y)=>{const x=N(c,y,n.length);return u.style.setProperty(m,`${x}px`),u.style.removeProperty(b),Math.min(this.#p,Math.max(0,y*l-x));});for(const u of n)u.style.visibility="hidden",u.inert=!0;this.#T();return;}this.#p=0;for(const l of n)l.style.removeProperty(m),l.style.removeProperty(b),l.style.removeProperty("--cw-carousel-item-offset"),l.style.removeProperty("--cw-carousel-item-inset"),l.style.removeProperty("visibility");const a=this.#f?.getBoundingClientRect();this.#w=a===void 0?[]:n.map(l=>{const u=l.getBoundingClientRect();return i?u.top-a.top:this.#r?a.right-u.right:u.left-a.left;});}#T(){const e=this.#c,t=this.#i;if(e===void 0)return;const i=Math.max(0,Math.min(this.#p,this.#M())),n=_(e,i,this.#p),o=e.itemSize+e.itemSpacing,r=n.length,d=Math.max(0,Math.floor(i/o)-r),h=Math.ceil((i+e.availableSpace)/o),m=Math.min(t.length-1,h+r),b=this.#r?-1:1,c=/* @__PURE__ */new Set();for(let a=d;a<=m;a++){const l=F(e,n,a,i),u=t[a];l.visible&&(u.style.setProperty("--cw-carousel-item-offset",`${l.translation*b}px`),u.style.setProperty("--cw-carousel-item-inset",`${Math.max(0,(e.itemSize-l.maskSize)/2)}px`),this.#b.has(a)||(u.style.removeProperty("visibility"),u.inert=!1),c.add(a));}for(const a of this.#b){const l=t[a];l!==void 0&&!c.has(a)&&(l.style.visibility="hidden",l.inert=!0);}this.#b=c;}#_(){const e=this.#w,t=this.#M();let i=0,n=e.length-1;for(;i<n;){const o=Math.floor((i+n)/2);e[o]<t?i=o+1:n=o;}return i>0&&t-e[i-1]<e[i]-t?i-1:i;}#O(){const e=this.#i,t=this.#x(),i=this.#c!==void 0;this.#o&&(this.#e=C(this.props.index??this.props.activeIndex)),this.#e=Math.max(0,Math.min(this.#e,e.length-1));for(const[n,o]of e.entries())(!o.hasAttribute("aria-label")||o.hasAttribute(p))&&(o.setAttribute("aria-label",`Slide ${n+1} of ${e.length}`),o.setAttribute(p,"true")),o.setAttribute("aria-current",n===this.#e?"true":"false"),t==="full-screen"?o.inert=n!==this.#e:i||(o.inert=!1);this.#D();}#P(e,t){const i=this.#x()==="full-screen";for(const[n,o]of[[e,!1],[t,!0]]){const r=this.#i[n];r!==void 0&&(r.setAttribute("aria-current",o?"true":"false"),i&&(r.inert=!o));}this.#D();}#D(){const e=this.props.loop===!0,t=this.#i.length;this.#a!==null&&(this.#a.disabled=t===0||!e&&this.#e<=0),this.#u!==null&&(this.#u.disabled=t===0||!e&&this.#e>=t-1);}#k(e,t,i){const n=this.#i.length,o=this.props.loop===!0?(e%n+n)%n:Math.max(0,Math.min(e,n-1)),r=this.#e;if(!(n===0||o===r)){if(this.#o){this.#S(o,t);return;}this.#e=o,this.#P(r,o),this.#z(i),this.#S(o,t);}}#S(e,t){f(()=>this.props.onIndexChange?.(e,t));}#z(e){const t=this.#t,i=this.#i[this.#e],n=t?.ownerDocument.defaultView;if(t===null||i===void 0||n==null)return;const o=n.matchMedia("(prefers-reduced-motion: reduce)").matches;this.#N(o?"auto":"smooth"),e&&(i.inert=!1,i.style.removeProperty("visibility"),i.focus({preventScroll:!0}));}#N(e){const t=this.#t,i=this.#i[this.#e],n=this.#n==="vertical";if(t===null||i===void 0)return;if(this.#c!==void 0){const h=this.#w[this.#e]??0,m=this.#r?-h:h;if(Math.abs(h-this.#M())<g)return;this.#B(),t.scrollTo(n?{behavior:e,top:h}:{behavior:e,left:m});return;}const o=t.getBoundingClientRect(),r=i.getBoundingClientRect(),d=n?r.top-o.top:this.#r?r.right-o.right:r.left-o.left;!Number.isFinite(d)||Math.abs(d)<g||(this.#B(),t.scrollBy({behavior:e,left:n?0:d,top:n?d:0}));}#B(){this.#v=!0,this.#F();}#F(){const e=this.#t?.ownerDocument.defaultView;this.#s!==void 0&&e?.clearTimeout(this.#s),this.#s=e?.setTimeout(this.#J,K);}#$(){const e=this.#t?.ownerDocument.defaultView;e!=null&&(this.#d!==void 0&&e.cancelAnimationFrame(this.#d),this.#d=e.requestAnimationFrame(()=>{this.#d=void 0,this.#N("auto"),this.#T();}));}#V(){this.#l=void 0,this.#T(),this.#v||this.#X();}#X(){const e=this.#i.length===0?this.#e:this.#_(),t=this.#e;if(!(e===t&&this.#h===void 0)){if(this.#o){e!==(this.#h??t)&&(this.#h=e===t?void 0:e,e!==t&&this.#S(e));return;}this.#e=e,this.#P(t,e),this.#S(e);}}#G=()=>{const e=this.#t?.ownerDocument.defaultView;(this.#v||!this.#L)&&this.#F(),!(this.#l!==void 0||e==null)&&(this.#l=e.requestAnimationFrame(()=>this.#V()));};#J=()=>{const e=this.#t?.ownerDocument.defaultView;if(this.#s!==void 0&&e?.clearTimeout(this.#s),this.#s=void 0,this.#l!==void 0&&(e?.cancelAnimationFrame(this.#l),this.#V()),this.#v){this.#v=!1,this.#X();return;}!this.#o||this.#i.length===0||(this.#h=void 0,this.#_()!==this.#e&&this.#z(!1));};#U=e=>v(e,this.#t,()=>this.#k(this.#e-1,e,!1),!1);#K=e=>v(e,this.#t,()=>this.#k(this.#e+1,e,!1),!1);#W=e=>{f(()=>this.props.onShowAll?.(e));};#Z=()=>{this.#x()==="uncontained-multi-aspect-ratio"&&this.#I(),this.#O();};#j=e=>{const t=this.#t,i=this.#n==="horizontal",n=i?this.#r?"ArrowLeft":"ArrowRight":"ArrowDown",o=i?this.#r?"ArrowRight":"ArrowLeft":"ArrowUp";if(e.defaultPrevented||t===null||e.target!==t&&V(e.target)&&$(e.target,t,e.composedPath()))return;const r=e.key==="Home"?0:e.key==="End"?this.#i.length-1:e.key===n?this.#e+1:e.key===o?this.#e-1:void 0;r!==void 0&&v(e,t,()=>this.#k(r,e,!0));};applyComponentProps(){const e=super.readProps(["activeIndex","index","itemGap","itemSize","label","layout","loop","nextLabel","onShowAll","orientation","previousLabel","showAllLabel","showControls","snap","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Carousel";let i=e.layoutChanged||e.itemSizeChanged||e.itemGapChanged;e.snapChanged&&super.setAttribute("data-cw-carousel-snap",e.snap===!0?"true":"false"),e.layoutChanged&&super.setAttribute("data-cw-carousel-layout",e.layout??"full-screen"),e.orientationChanged&&(this.#n=e.orientation??"horizontal",super.setAttribute("data-cw-carousel-orientation",this.#n),super.setClass("orientation",`_cw-Carousel-${this.#n}`),i=!0),super.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t),this.#m!==null&&(e.onShowAllChanged||e.showAllLabelChanged)&&(this.#m.hidden=e.onShowAll===void 0,this.#m.textContent=e.showAllLabel??"Show all"),e.previousLabelChanged&&this.#a!==null&&(this.#a.setAttribute("aria-label",e.previousLabel??"Previous"),this.#a.textContent=e.previousLabel??"Previous"),e.nextLabelChanged&&this.#u!==null&&(this.#u.setAttribute("aria-label",e.nextLabel??"Next"),this.#u.textContent=e.nextLabel??"Next"),e.showControlsChanged&&this.#E?.classList.toggle("cw-Carousel-controls-hidden",e.showControls===!1),i?this.#g():e.loopChanged&&this.#D(),this.#o&&(e.indexChanged||e.activeIndexChanged)&&this.#Y(C("index"in this.props?e.index:e.activeIndex));}#Y(e){const t=Math.max(0,Math.min(e,this.#i.length-1)),i=this.#e,n=t===this.#h;this.#h=void 0,!(this.#i.length===0||t===i)&&(this.#e=t,this.#P(i,t),n||this.#z(!1));}#H(e,t){const i=t?"addEventListener":"removeEventListener",n=this.#t;n?.[i]("scroll",this.#G,{passive:!0}),n?.[i]("scrollend",this.#J),n?.[i]("keydown",this.#j),this.#a?.[i]("click",this.#U),this.#u?.[i]("click",this.#K),this.#m?.[i]("click",this.#W),e?.[i](L,this.#Z);}#R(){this.#y?.disconnect(),this.#C?.disconnect(),this.#y=void 0,this.#C=void 0;}#Q(){const e=this.#t,t=e?.ownerDocument.defaultView;this.#R(),!(t==null||e===null||this.#f===null)&&(this.#y=new t.MutationObserver(()=>this.#g()),this.#y.observe(this.#f,{childList:!0}),this.#C=new t.ResizeObserver(()=>{(this.#n==="vertical"?e.clientHeight:e.clientWidth)!==this.#A&&(this.#I(),this.#$());}),this.#C.observe(e));}onStyleElementChanged(e){this.#H(super.styleElement,!1),super.onStyleElementChanged(e),this.#t=e?.querySelector("[data-cw-carousel-viewport]")??null,this.#f=this.#t?.querySelector(":scope > [data-cw-carousel-track]")??null,this.#E=e?.querySelector(".cw-Carousel-controls")??null,this.#a=e?.querySelector("[data-cw-carousel-previous]")??null,this.#u=e?.querySelector("[data-cw-carousel-next]")??null,this.#m=e?.querySelector(".cw-Carousel-showAll")??null,this.#L=this.#t!==null&&"onscrollend"in this.#t,this.#H(e,!0),this.#R(),this.#g();}render(e){return f(()=>P({children:e},{index:this.#e,itemCount:this.props.itemCount,label:this.props["attr:aria-label"]??this.props.label,layout:this.props.layout,loop:this.props.loop,nextLabel:this.props.nextLabel,onShowAll:this.props.onShowAll,orientation:this.#n,previousLabel:this.props.previousLabel,showAllLabel:this.props.showAllLabel,showControls:this.props.showControls,snap:this.props.snap}));}#ee(){const e=this.#t?.ownerDocument.defaultView;this.#s!==void 0&&e?.clearTimeout(this.#s),this.#l!==void 0&&e?.cancelAnimationFrame(this.#l),this.#d!==void 0&&e?.cancelAnimationFrame(this.#d),this.#s=void 0,this.#l=void 0,this.#d=void 0,this.#R(),this.#H(super.styleElement,!1),this.#i=[],this.#b.clear();}}const Q=/* @__PURE__ */S(()=>P,()=>Y),de=s=>D(M.Provider,{value:f(()=>{const e=I(s.itemCount),t=Math.max(0,w(s));let i=0;return{layout:s.layout??"full-screen",currentIndex:e===void 0?t:Math.min(t,Math.max(0,e-1)),itemCount:e,nextItemIndex:()=>i++};}),get children(){return f(()=>Q(s));}});function ee(s,e){const t=R(M),i=t?.nextItemIndex()??0,n=s["aria-label"]??e.label,o=t===void 0?void 0:i===t.currentIndex?"true":"false",r=t?.itemCount===void 0?`Slide ${i+1}`:`Slide ${i+1} of ${t.itemCount}`;return<div{...s}aria-current={o}aria-label={n??r}aria-roledescription="slide"classList={{...s.classList,"cw-Carousel-slide":!0}}data-cw-carousel-generated-label={n===void 0?"true":void 0}data-cw-carousel-slide="true"inert={t?.layout==="full-screen"&&i!==t.currentIndex}role="group"style={{...s.style,"--cw-carousel-aspect-ratio":T(e.aspectRatio)}}tabIndex={-1}><div class="cw-Carousel-mask">{s.children}</div></div>;}class te extends E{constructor(e){super(e,{styleElementIsFunction:!0});}#o(){super.styleElement?.dispatchEvent(new Event(L,{bubbles:!0}));}applyComponentProps(){const e=super.readProps(["aspectRatio","label","attr:aria-label"]),t=e["attr:aria-label"]??e.label,i=super.styleElement,n=i?.hasAttribute(p)===!0,o=t===void 0?n&&i?.hasAttribute("aria-label")===!0:!n&&i?.getAttribute("aria-label")===t;e.aspectRatioChanged&&(super.setStyle("--cw-carousel-aspect-ratio",T(e.aspectRatio)),this.#o()),!o&&(t===void 0?(super.setAttribute("aria-label",void 0),i?.setAttribute(p,"true")):(i?.removeAttribute(p),super.setAttribute("aria-label",t)),this.#o());}render(e){return<div aria-roledescription="slide"class="cw-Carousel-slide"data-cw-carousel-slide="true"role="group"tabIndex={-1}><div class="cw-Carousel-mask">{e}</div></div>;}}const ie=/* @__PURE__ */S(()=>ee,()=>te),he=ie;export{de as Carousel,Y as CarouselController,ie as CarouselItem,he as CarouselSlide};
@@ -1,4 +1,4 @@
1
- import{createUniqueId as l,untrack as F}from"solid-js";import{insert as _}from"solid-js/web";import{defineDomComponent as w}from"..";import{Button as D}from"../action/button";import{IconButton as T}from"../action/icon-button";import{ELEVATION_SHADOW_CSS_CLASS as v}from"../container/elevation-shadow";import{DomController as H}from"../dom/client";import{isElementNode as y,isTopModalLayer as R,registerModalLayer as X,transitionTimeOf as J}from"../navigation/base";import{deferAfterDelegatedCancellation as q}from"../util/event";import{resolveSurfaceSlots as P}from"./slots";import"../container/elevation-shadow.css";import"./surface.css";const N="a[href], area[href], button, input:not([type=hidden]), select, textarea, summary, iframe, [contenteditable]:not([contenteditable=false]), [tabindex]",k="data-cw-dialog-action",M="cw-AlertDialog-noDismiss",I="cw-FullScreenDialog-noConfirm",$="cw-FullScreenDialog-scrolled";let O;function z(){return O??=typeof CSS<"u"&&CSS.supports("overlay","auto"),O}function E(n){const e=n.getRootNode().activeElement;return y(e)?e:null}function L(n,e){return!n.hidden&&!n.matches(":disabled")&&n.getAttribute("aria-disabled")!=="true"&&(!e||!n.hasAttribute("tabindex")||n.tabIndex>=0)&&n.closest("[hidden], [inert], [aria-hidden='true']")===null&&n.checkVisibility({visibilityProperty:!0})}function S(n,e){const t=Array.from(n.querySelectorAll(N));return e&&t.reverse(),t.find(i=>L(i,!0))}function B(n,e){const t=e.target,i=y(t)?t.closest(`[${k}]`):null;return n===null||i?.closest("dialog")!==n?null:i.getAttribute(k)}function K(n){const e=n,t={};for(const i of Object.keys(e))["children","aria-describedby","aria-label","aria-labelledby","aria-modal"].includes(i)||(t[i]=e[i]);return t}function C(n){return("open"in n?n.open:n.defaultOpen)===!0}function A(n,e,t){const i=n,s=i["aria-label"],o=i["aria-labelledby"]??(s===void 0?t.labelledBy:void 0);return{...K(n),"aria-describedby":i["aria-describedby"]??t.describedBy,"aria-label":s??(o===void 0?e.label??t.label:void 0),"aria-labelledby":o,"aria-modal":"aria-modal"in i?i["aria-modal"]:e.modal!==!1?"true":void 0,classList:{...n.classList,...t.classes},open:C(e),role:e.role??t.role,tabIndex:e.tabIndex}}function V(n,e){return<dialog{...A(n,e,{classes:{[v]:!0,"cw-Dialog":!0,"cw-Dialog-open":C(e)},label:"Dialog",role:"dialog"})}>{n.children}</dialog>}class x extends H{#n;#o;#l;#t;#r;#u;#e;#i;#s;#a;#h;#b;#D;#f;#m;#v;#d;#c;#y;constructor(e,t="cw-Dialog"){super(e,{styleElementIsFunction:!0}),this.#n=t,this.#o="open"in e,this.#l="attr:aria-modal"in e,this.#e=null,this.#i=F(()=>(this.#o?e.open:e.defaultOpen)===!0),this.#s=F(()=>e.modal!==!1),this.#a=!1,this.#h=null,this.#b=0,this.#D=!1,this.#f=!1,this.#m=void 0,this.#v=!1,this.#d=void 0,this.#c=void 0,this.#y=!1;const i=super.consumeProps([],["onOpenChange","onClose","onCancel"]);this.#t=i.onOpenChange,this.#r=i.onClose,this.#u=i.onCancel}defaultRole(){return"dialog"}defaultLabel(){return this.props.label??"Dialog"}defaultLabelledBy(){}defaultDescribedBy(){}allowDismiss(e,t){return!0}requestDismiss(e,t){this.allowDismiss(e,t)&&this.close(e,t)}onOpenStateChanged(e){}onShown(){}isOpen(){return this.#i}open(){this.#C(!0,!0,"programmatic")}close(e="programmatic",t){this.#C(!1,!0,e,t)}toggle(){this.#i?this.close():this.open()}#E(e,t,i){this.#t?.(e,t,i)}#T(e){this.#i=e,super.setClass(`${this.#n}-open`,e),this.onOpenStateChanged(e)}#C(e,t,i,s){const o=e!==this.#i;if(t&&this.#o){o&&this.#E(e,s,i);return}!o&&(this.#e===null||(this.#e.open&&this.#c===void 0)===e)||(this.#T(e),e?this.#p():this.#_(),t&&o&&this.#E(e,s,i))}#p(){const e=this.#e;if(!(e===null||!this.#i)){if(!e.isConnected){this.#H(e);return}if(this.#S(),this.#M()&&this.#a===this.#s){this.#P(e);return}if(this.#h===null){const t=E(e);t!==null&&!e.contains(t)&&(this.#h=t)}if(e.open){if(this.#a===this.#s)return;this.#a?(this.#b++,e.close()):e.removeAttribute("open")}this.#s&&this.props.returnFocus===!1&&E(e)?.blur();try{this.#s?e.showModal():e.show(),this.#a=this.#s}catch{e.setAttribute("open",""),this.#a=!1}this.#P(e)}}#P(e){this.#R(),this.#d?.(),this.#d=this.#s?X(e):void 0,this.onShown()}#_(){const e=this.#e;if(this.#S(),this.#d?.(),this.#d=void 0,e!==null){if(e.open&&!z()){super.setClass(`_${this.#n}-closing`,!0);const t=J(e,["display"]),i=e.ownerDocument.defaultView;if(t>0&&i!==null){this.#c=i.setTimeout(()=>this.#g(e),t);return}super.setClass(`_${this.#n}-closing`,!1)}this.#g(e)}}#g(e){const t=this.#L(e);if(this.#M(),e.open)try{e.close()}catch{e.removeAttribute("open")}this.#a=!1,this.#I(t)}#M(){const e=this.#c;return e===void 0?!1:(this.#c=void 0,this.#e?.ownerDocument.defaultView?.clearTimeout(e),super.setClass(`_${this.#n}-closing`,!1),!0)}#H(e){const t=()=>{const i=e.ownerDocument.defaultView;this.#m=void 0,!(!this.#f||this.#e!==e)&&(e.isConnected?(this.#f=!1,this.#p()):i!==null&&(this.#m=i.requestAnimationFrame(t)))};this.#f||(this.#f=!0,queueMicrotask(t))}#S(){const e=this.#m;this.#f=!1,this.#m=void 0,e!==void 0&&this.#e?.ownerDocument.defaultView?.cancelAnimationFrame(e)}#L(e){const t=E(e);return t===null||t===e.ownerDocument.body||e.contains(t)}#I(e){const t=this.#h;this.#h=null,!(t===null||!e||this.props.returnFocus===!1)&&queueMicrotask(()=>{const i=this.#e;t.isConnected&&(i===null||this.#L(i))&&t.focus()})}#R(){this.#D||(this.#D=!0,queueMicrotask(()=>{const e=this.#e,t=this.props.initialFocus;let i=null;if(this.#D=!1,!this.#i||e===null)return;if(typeof t=="string")try{i=e.querySelector(t)}catch{}else y(t)&&e.contains(t)&&(i=t);(i!==null&&L(i,!1)?i:Array.from(e.querySelectorAll("[autofocus]")).find(o=>L(o,!1))??S(e,!1)??e).focus()}))}#X(e,t){const i=S(e,!1),s=S(e,!0),o=E(e);i===void 0||s===void 0?(t.preventDefault(),e.focus()):(t.shiftKey?o===i||o===e:o===s)&&(t.preventDefault(),(t.shiftKey?s:i).focus())}#B(e){const t=this.#e,i=t?.getBoundingClientRect();return t!==null&&e.target===t&&i!==void 0&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)}#w=e=>{const t=this.#e;if(this.#c!==void 0){e.preventDefault();return}t!==null&&this.#s&&!R(t)||(this.#u?.(e),!e.defaultPrevented&&(this.requestDismiss("cancel",e),e.preventDefault()))};#A=e=>{const t=this.#e;if(this.#b>0){this.#b--;return}if(this.#r?.(e),t!==null&&!t.open&&this.#c!==void 0&&this.#g(t),!(t===null||t.open||!this.#i)){if(this.#d?.(),this.#d=void 0,this.#a=!1,this.#o){this.#E(!1,e,"close"),queueMicrotask(()=>this.#p());return}this.#T(!1),this.#E(!1,e,"close"),this.#I(this.#L(t))}};#x=e=>{this.#v=this.#B(e)};#F=e=>{const t=this.#v;this.#v=!1,t&&this.#i&&this.props.closeOnBackdrop!==!1&&this.#B(e)&&this.requestDismiss("backdrop",e)};#k=e=>{const t=this.#e;if(!(t===null||e.defaultPrevented||!this.#i||!y(e.target)||e.target.closest("dialog")!==t))if(e.key==="Escape"){if(e.isTrusted&&this.#a)return;q(e,t,()=>{const i=t.ownerDocument.defaultView?.Event??Event;this.#e===t&&this.#i&&t.dispatchEvent(new i("cancel",{cancelable:!0}))})}else e.key==="Tab"&&this.#s&&this.#X(t,e)};#O(e,t){this.#e?.getAttribute(e)!==(t??null)&&super.setAttribute(e,t)}applyComponentProps(){const e=super.readProps(["attr:aria-describedby","attr:aria-label","attr:aria-labelledby","label","modal","open","role","tabIndex"]),t=e["attr:aria-label"],i=e["attr:aria-labelledby"]??(t===void 0?this.defaultLabelledBy():void 0);e.modalChanged&&(this.#s=e.modal!==!1,this.#l||super.setAttribute("aria-modal",this.#s?"true":void 0),this.#p()),e.roleChanged&&super.setAttribute("role",e.role??this.defaultRole()),e.tabIndexChanged&&super.setAttribute("tabindex",e.tabIndex),this.#O("aria-label",t??(i===void 0?this.defaultLabel():void 0)),this.#O("aria-labelledby",i),this.#O("aria-describedby",e["attr:aria-describedby"]??this.defaultDescribedBy()),this.#y||(this.#y=!0,super.setClass(`${this.#n}-open`,this.#i)),e.openChanged&&this.#o&&this.#C(e.open===!0,!1,"programmatic")}onStyleElementChanged(e){const t=this.#e;super.onStyleElementChanged(e),t!==null&&(this.#c!==void 0&&this.#g(t),t.removeEventListener("cancel",this.#w),t.removeEventListener("close",this.#A),t.removeEventListener("click",this.#F),t.removeEventListener("keydown",this.#k),t.removeEventListener("pointerdown",this.#x)),this.#e=e,this.#e!==null&&(this.#e.addEventListener("cancel",this.#w),this.#e.addEventListener("close",this.#A),this.#e.addEventListener("click",this.#F),this.#e.addEventListener("keydown",this.#k),this.#e.addEventListener("pointerdown",this.#x),this.#p())}render(e){const t=<dialog class={`cw-Dialog ${v}`}/>;return _(t,e),t}onControllerCleanup(){const e=this.#e;if(this.#i=!1,this.#S(),this.#d?.(),this.#d=void 0,e!==null&&(this.#c!==void 0&&this.#g(e),e.removeEventListener("cancel",this.#w),e.removeEventListener("close",this.#A),e.removeEventListener("click",this.#F),e.removeEventListener("keydown",this.#k),e.removeEventListener("pointerdown",this.#x),e.open))try{e.close()}catch{e.removeAttribute("open")}super.onControllerCleanup()}}const he=w(()=>V,()=>x),U=["children","confirmLabel","dismissLabel","icon","supportingText","text","title"];function j(n,e){const t=l(),i=l();return<dialog{...A(n,e,{classes:{[v]:!0,[M]:e.showDismiss===!1,"cw-AlertDialog":!0,"cw-Dialog":!0,"cw-Dialog-open":C(e)},describedBy:i,label:e.title===void 0?"Alert dialog":void 0,labelledBy:e.label===void 0&&e.title!==void 0?t:void 0,role:"alertdialog"})}>
1
+ import{createUniqueId as l,untrack as F}from"solid-js";import{insert as _}from"solid-js/web";import{defineDomComponent as w}from"..";import{Button as D}from"../action/button";import{IconButton as T}from"../action/icon-button";import{ELEVATION_SHADOW_CSS_CLASS as v}from"../container/elevation-shadow";import{DomController as H}from"../dom/client";import{isElementNode as y,isTopModalLayer as R,registerModalLayer as X,transitionTimeOf as J}from"../navigation/base";import{deferAfterDelegatedCancellation as q}from"../util/event";import{resolveSurfaceSlots as P}from"./slots";import"../container/elevation-shadow.css";import"./surface.css";const N="a[href], area[href], button, input:not([type=hidden]), select, textarea, summary, iframe, [contenteditable]:not([contenteditable=false]), [tabindex]",k="data-cw-dialog-action",M="cw-AlertDialog-noDismiss",I="cw-FullScreenDialog-noConfirm",$="cw-FullScreenDialog-scrolled";let O;function z(){return O??=typeof CSS<"u"&&CSS.supports("overlay","auto"),O;}function E(n){const e=n.getRootNode().activeElement;return y(e)?e:null;}function L(n,e){return!n.hidden&&!n.matches(":disabled")&&n.getAttribute("aria-disabled")!=="true"&&(!e||!n.hasAttribute("tabindex")||n.tabIndex>=0)&&n.closest("[hidden], [inert], [aria-hidden='true']")===null&&n.checkVisibility({visibilityProperty:!0});}function S(n,e){const t=Array.from(n.querySelectorAll(N));return e&&t.reverse(),t.find(i=>L(i,!0));}function B(n,e){const t=e.target,i=y(t)?t.closest(`[${k}]`):null;return n===null||i?.closest("dialog")!==n?null:i.getAttribute(k);}function K(n){const e=n,t={};for(const i of Object.keys(e))["children","aria-describedby","aria-label","aria-labelledby","aria-modal"].includes(i)||(t[i]=e[i]);return t;}function C(n){return("open"in n?n.open:n.defaultOpen)===!0;}function A(n,e,t){const i=n,s=i["aria-label"],o=i["aria-labelledby"]??(s===void 0?t.labelledBy:void 0);return{...K(n),"aria-describedby":i["aria-describedby"]??t.describedBy,"aria-label":s??(o===void 0?e.label??t.label:void 0),"aria-labelledby":o,"aria-modal":"aria-modal"in i?i["aria-modal"]:e.modal!==!1?"true":void 0,classList:{...n.classList,...t.classes},open:C(e),role:e.role??t.role,tabIndex:e.tabIndex};}function V(n,e){return<dialog{...A(n,e,{classes:{[v]:!0,"cw-Dialog":!0,"cw-Dialog-open":C(e)},label:"Dialog",role:"dialog"})}>{n.children}</dialog>;}class x extends H{#n;#o;#l;#t;#r;#u;#e;#i;#s;#a;#h;#b;#D;#f;#m;#v;#d;#c;#y;constructor(e,t="cw-Dialog"){super(e,{styleElementIsFunction:!0}),this.#n=t,this.#o="open"in e,this.#l="attr:aria-modal"in e,this.#e=null,this.#i=F(()=>(this.#o?e.open:e.defaultOpen)===!0),this.#s=F(()=>e.modal!==!1),this.#a=!1,this.#h=null,this.#b=0,this.#D=!1,this.#f=!1,this.#m=void 0,this.#v=!1,this.#d=void 0,this.#c=void 0,this.#y=!1;const i=super.consumeProps([],["onOpenChange","onClose","onCancel"]);this.#t=i.onOpenChange,this.#r=i.onClose,this.#u=i.onCancel;}defaultRole(){return"dialog";}defaultLabel(){return this.props.label??"Dialog";}defaultLabelledBy(){}defaultDescribedBy(){}allowDismiss(e,t){return!0;}requestDismiss(e,t){this.allowDismiss(e,t)&&this.close(e,t);}onOpenStateChanged(e){}onShown(){}isOpen(){return this.#i;}open(){this.#C(!0,!0,"programmatic");}close(e="programmatic",t){this.#C(!1,!0,e,t);}toggle(){this.#i?this.close():this.open();}#E(e,t,i){this.#t?.(e,t,i);}#T(e){this.#i=e,super.setClass(`${this.#n}-open`,e),this.onOpenStateChanged(e);}#C(e,t,i,s){const o=e!==this.#i;if(t&&this.#o){o&&this.#E(e,s,i);return;}!o&&(this.#e===null||(this.#e.open&&this.#c===void 0)===e)||(this.#T(e),e?this.#p():this.#_(),t&&o&&this.#E(e,s,i));}#p(){const e=this.#e;if(!(e===null||!this.#i)){if(!e.isConnected){this.#H(e);return;}if(this.#S(),this.#M()&&this.#a===this.#s){this.#P(e);return;}if(this.#h===null){const t=E(e);t!==null&&!e.contains(t)&&(this.#h=t);}if(e.open){if(this.#a===this.#s)return;this.#a?(this.#b++,e.close()):e.removeAttribute("open");}this.#s&&this.props.returnFocus===!1&&E(e)?.blur();try{this.#s?e.showModal():e.show(),this.#a=this.#s;}catch{e.setAttribute("open",""),this.#a=!1;}this.#P(e);}}#P(e){this.#R(),this.#d?.(),this.#d=this.#s?X(e):void 0,this.onShown();}#_(){const e=this.#e;if(this.#S(),this.#d?.(),this.#d=void 0,e!==null){if(e.open&&!z()){super.setClass(`_${this.#n}-closing`,!0);const t=J(e,["display"]),i=e.ownerDocument.defaultView;if(t>0&&i!==null){this.#c=i.setTimeout(()=>this.#g(e),t);return;}super.setClass(`_${this.#n}-closing`,!1);}this.#g(e);}}#g(e){const t=this.#L(e);if(this.#M(),e.open)try{e.close();}catch{e.removeAttribute("open");}this.#a=!1,this.#I(t);}#M(){const e=this.#c;return e===void 0?!1:(this.#c=void 0,this.#e?.ownerDocument.defaultView?.clearTimeout(e),super.setClass(`_${this.#n}-closing`,!1),!0);}#H(e){const t=()=>{const i=e.ownerDocument.defaultView;this.#m=void 0,!(!this.#f||this.#e!==e)&&(e.isConnected?(this.#f=!1,this.#p()):i!==null&&(this.#m=i.requestAnimationFrame(t)));};this.#f||(this.#f=!0,queueMicrotask(t));}#S(){const e=this.#m;this.#f=!1,this.#m=void 0,e!==void 0&&this.#e?.ownerDocument.defaultView?.cancelAnimationFrame(e);}#L(e){const t=E(e);return t===null||t===e.ownerDocument.body||e.contains(t);}#I(e){const t=this.#h;this.#h=null,!(t===null||!e||this.props.returnFocus===!1)&&queueMicrotask(()=>{const i=this.#e;t.isConnected&&(i===null||this.#L(i))&&t.focus();});}#R(){this.#D||(this.#D=!0,queueMicrotask(()=>{const e=this.#e,t=this.props.initialFocus;let i=null;if(this.#D=!1,!this.#i||e===null)return;if(typeof t=="string")try{i=e.querySelector(t);}catch{}else y(t)&&e.contains(t)&&(i=t);(i!==null&&L(i,!1)?i:Array.from(e.querySelectorAll("[autofocus]")).find(o=>L(o,!1))??S(e,!1)??e).focus();}));}#X(e,t){const i=S(e,!1),s=S(e,!0),o=E(e);i===void 0||s===void 0?(t.preventDefault(),e.focus()):(t.shiftKey?o===i||o===e:o===s)&&(t.preventDefault(),(t.shiftKey?s:i).focus());}#B(e){const t=this.#e,i=t?.getBoundingClientRect();return t!==null&&e.target===t&&i!==void 0&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom);}#w=e=>{const t=this.#e;if(this.#c!==void 0){e.preventDefault();return;}t!==null&&this.#s&&!R(t)||(this.#u?.(e),!e.defaultPrevented&&(this.requestDismiss("cancel",e),e.preventDefault()));};#A=e=>{const t=this.#e;if(this.#b>0){this.#b--;return;}if(this.#r?.(e),t!==null&&!t.open&&this.#c!==void 0&&this.#g(t),!(t===null||t.open||!this.#i)){if(this.#d?.(),this.#d=void 0,this.#a=!1,this.#o){this.#E(!1,e,"close"),queueMicrotask(()=>this.#p());return;}this.#T(!1),this.#E(!1,e,"close"),this.#I(this.#L(t));}};#x=e=>{this.#v=this.#B(e);};#F=e=>{const t=this.#v;this.#v=!1,t&&this.#i&&this.props.closeOnBackdrop!==!1&&this.#B(e)&&this.requestDismiss("backdrop",e);};#k=e=>{const t=this.#e;if(!(t===null||e.defaultPrevented||!this.#i||!y(e.target)||e.target.closest("dialog")!==t))if(e.key==="Escape"){if(e.isTrusted&&this.#a)return;q(e,t,()=>{const i=t.ownerDocument.defaultView?.Event??Event;this.#e===t&&this.#i&&t.dispatchEvent(new i("cancel",{cancelable:!0}));});}else e.key==="Tab"&&this.#s&&this.#X(t,e);};#O(e,t){this.#e?.getAttribute(e)!==(t??null)&&super.setAttribute(e,t);}applyComponentProps(){const e=super.readProps(["attr:aria-describedby","attr:aria-label","attr:aria-labelledby","label","modal","open","role","tabIndex"]),t=e["attr:aria-label"],i=e["attr:aria-labelledby"]??(t===void 0?this.defaultLabelledBy():void 0);e.modalChanged&&(this.#s=e.modal!==!1,this.#l||super.setAttribute("aria-modal",this.#s?"true":void 0),this.#p()),e.roleChanged&&super.setAttribute("role",e.role??this.defaultRole()),e.tabIndexChanged&&super.setAttribute("tabindex",e.tabIndex),this.#O("aria-label",t??(i===void 0?this.defaultLabel():void 0)),this.#O("aria-labelledby",i),this.#O("aria-describedby",e["attr:aria-describedby"]??this.defaultDescribedBy()),this.#y||(this.#y=!0,super.setClass(`${this.#n}-open`,this.#i)),e.openChanged&&this.#o&&this.#C(e.open===!0,!1,"programmatic");}onStyleElementChanged(e){const t=this.#e;super.onStyleElementChanged(e),t!==null&&(this.#c!==void 0&&this.#g(t),t.removeEventListener("cancel",this.#w),t.removeEventListener("close",this.#A),t.removeEventListener("click",this.#F),t.removeEventListener("keydown",this.#k),t.removeEventListener("pointerdown",this.#x)),this.#e=e,this.#e!==null&&(this.#e.addEventListener("cancel",this.#w),this.#e.addEventListener("close",this.#A),this.#e.addEventListener("click",this.#F),this.#e.addEventListener("keydown",this.#k),this.#e.addEventListener("pointerdown",this.#x),this.#p());}render(e){const t=<dialog class={`cw-Dialog ${v}`}/>;return _(t,e),t;}onControllerCleanup(){const e=this.#e;if(this.#i=!1,this.#S(),this.#d?.(),this.#d=void 0,e!==null&&(this.#c!==void 0&&this.#g(e),e.removeEventListener("cancel",this.#w),e.removeEventListener("close",this.#A),e.removeEventListener("click",this.#F),e.removeEventListener("keydown",this.#k),e.removeEventListener("pointerdown",this.#x),e.open))try{e.close();}catch{e.removeAttribute("open");}super.onControllerCleanup();}}const he=/* @__PURE__ */w(()=>V,()=>x),U=["children","confirmLabel","dismissLabel","icon","supportingText","text","title"];function j(n,e){const t=l(),i=l();return<dialog{...A(n,e,{classes:{[v]:!0,[M]:e.showDismiss===!1,"cw-AlertDialog":!0,"cw-Dialog":!0,"cw-Dialog-open":C(e)},describedBy:i,label:e.title===void 0?"Alert dialog":void 0,labelledBy:e.label===void 0&&e.title!==void 0?t:void 0,role:"alertdialog"})}>
2
2
  <div class="cw-AlertDialog-icon">{e.icon}</div>
3
3
  <h2 class="cw-AlertDialog-title"id={t}>{e.title}</h2>
4
4
  <div class="cw-AlertDialog-text"id={i}>
@@ -8,7 +8,7 @@ import{createUniqueId as l,untrack as F}from"solid-js";import{insert as _}from"s
8
8
  <D attr:data-cw-dialog-action="dismiss"class="cw-AlertDialog-dismiss"size="sm"variant="text">{e.dismissLabel??"Cancel"}</D>
9
9
  <D attr:data-cw-dialog-action="confirm"class="cw-AlertDialog-confirm"size="sm"variant="text">{e.confirmLabel??"OK"}</D>
10
10
  </div>
11
- </dialog>}class G extends x{#n;#o;#l;#t;constructor(e){super(e),this.#l=l(),this.#t=l();const t=super.consumeProps([],["onConfirm","onDismiss"]);this.#n=t.onConfirm,this.#o=t.onDismiss}defaultRole(){return"alertdialog"}defaultLabel(){return this.props.label??(this.props.title===void 0?"Alert dialog":void 0)}defaultLabelledBy(){return this.props.label===void 0&&this.props.title!==void 0?this.#l:void 0}defaultDescribedBy(){return this.#t}#r=e=>{const t=B(this.styleElement,e);t==="confirm"?(this.#n?.(e),e.defaultPrevented||this.close("confirm",e)):t==="dismiss"&&(this.#o?.(e),e.defaultPrevented||this.close("dismiss",e))};applyComponentProps(){const e=super.readProps(["showDismiss"]);super.applyComponentProps(),e.showDismissChanged&&super.setClass(M,e.showDismiss===!1)}onStyleElementChanged(e){this.styleElement?.removeEventListener("click",this.#r),super.onStyleElementChanged(e),e?.addEventListener("click",this.#r)}render(e){const t=this.props,i=this.#l,s=this.#t;return<dialog class={`cw-Dialog cw-AlertDialog ${v}`}>
11
+ </dialog>;}class G extends x{#n;#o;#l;#t;constructor(e){super(e),this.#l=l(),this.#t=l();const t=super.consumeProps([],["onConfirm","onDismiss"]);this.#n=t.onConfirm,this.#o=t.onDismiss;}defaultRole(){return"alertdialog";}defaultLabel(){return this.props.label??(this.props.title===void 0?"Alert dialog":void 0);}defaultLabelledBy(){return this.props.label===void 0&&this.props.title!==void 0?this.#l:void 0;}defaultDescribedBy(){return this.#t;}#r=e=>{const t=B(this.styleElement,e);t==="confirm"?(this.#n?.(e),e.defaultPrevented||this.close("confirm",e)):t==="dismiss"&&(this.#o?.(e),e.defaultPrevented||this.close("dismiss",e));};applyComponentProps(){const e=super.readProps(["showDismiss"]);super.applyComponentProps(),e.showDismissChanged&&super.setClass(M,e.showDismiss===!1);}onStyleElementChanged(e){this.styleElement?.removeEventListener("click",this.#r),super.onStyleElementChanged(e),e?.addEventListener("click",this.#r);}render(e){const t=this.props,i=this.#l,s=this.#t;return<dialog class={`cw-Dialog cw-AlertDialog ${v}`}>
12
12
  <div class="cw-AlertDialog-icon">{t.icon}</div>
13
13
  <h2 class="cw-AlertDialog-title"id={i}>{t.title}</h2>
14
14
  <div class="cw-AlertDialog-text"id={s}>
@@ -18,18 +18,18 @@ import{createUniqueId as l,untrack as F}from"solid-js";import{insert as _}from"s
18
18
  <D attr:data-cw-dialog-action="dismiss"class="cw-AlertDialog-dismiss"size="sm"variant="text">{t.dismissLabel??"Cancel"}</D>
19
19
  <D attr:data-cw-dialog-action="confirm"class="cw-AlertDialog-confirm"size="sm"variant="text">{t.confirmLabel??"OK"}</D>
20
20
  </div>
21
- </dialog>}onControllerCleanup(){this.styleElement?.removeEventListener("click",this.#r),super.onControllerCleanup()}}const Y=w(()=>j,()=>G),me=n=>Y(P(n,U)),Q=["children","closeIcon","confirmLabel","title"];function W(n,e){const t=l();return<dialog{...A(n,e,{classes:{[I]:e.confirmLabel===void 0,"cw-FullScreenDialog":!0,"cw-FullScreenDialog-open":C(e)},label:e.title===void 0?"Dialog":void 0,labelledBy:e.label===void 0&&e.title!==void 0?t:void 0,role:"dialog"})}>
21
+ </dialog>;}onControllerCleanup(){this.styleElement?.removeEventListener("click",this.#r),super.onControllerCleanup();}}const Y=/* @__PURE__ */w(()=>j,()=>G),me=n=>Y(P(n,U)),Q=["children","closeIcon","confirmLabel","title"];function W(n,e){const t=l();return<dialog{...A(n,e,{classes:{[I]:e.confirmLabel===void 0,"cw-FullScreenDialog":!0,"cw-FullScreenDialog-open":C(e)},label:e.title===void 0?"Dialog":void 0,labelledBy:e.label===void 0&&e.title!==void 0?t:void 0,role:"dialog"})}>
22
22
  <div class={`cw-FullScreenDialog-header ${v}`}>
23
23
  <T attr:aria-label={e.closeLabel??"Close"}attr:data-cw-dialog-action="dismiss"class="cw-FullScreenDialog-close"size="sm">{e.closeIcon??"close"}</T>
24
24
  <h2 class="cw-FullScreenDialog-title"id={t}>{e.title}</h2>
25
25
  <D attr:data-cw-dialog-action="confirm"class="cw-FullScreenDialog-confirm"size="sm"variant="text">{e.confirmLabel}</D>
26
26
  </div>
27
27
  <div class="cw-FullScreenDialog-content">{n.children}</div>
28
- </dialog>}class Z extends x{#n;#o;#l;#t;#r;constructor(e){super(e,"cw-FullScreenDialog"),this.#l=l(),this.#t=null,this.#r=!1;const t=super.consumeProps([],["onConfirm","onDismiss"]);this.#n=t.onConfirm,this.#o=t.onDismiss}defaultLabel(){return this.props.label??(this.props.title===void 0?"Dialog":void 0)}defaultLabelledBy(){return this.props.label===void 0&&this.props.title!==void 0?this.#l:void 0}#u=e=>{const t=B(this.styleElement,e);t==="confirm"?(this.#n?.(e),e.defaultPrevented||this.close("confirm",e)):t==="dismiss"&&(this.#o?.(e),e.defaultPrevented||this.close("dismiss",e))};#e=()=>{const e=(this.#t?.scrollTop??0)>0;e!==this.#r&&(this.#r=e,super.setClass($,e))};applyComponentProps(){const e=super.readProps(["confirmLabel"]);super.applyComponentProps(),e.confirmLabelChanged&&super.setClass(I,e.confirmLabel===void 0)}onStyleElementChanged(e){this.styleElement?.removeEventListener("click",this.#u),this.#t?.removeEventListener("scroll",this.#e),super.onStyleElementChanged(e),this.#t=e?.querySelector(".cw-FullScreenDialog-content")??null,e?.addEventListener("click",this.#u),this.#t?.addEventListener("scroll",this.#e,{passive:!0})}render(e){const t=this.props,i=this.#l;return<dialog class="cw-FullScreenDialog">
28
+ </dialog>;}class Z extends x{#n;#o;#l;#t;#r;constructor(e){super(e,"cw-FullScreenDialog"),this.#l=l(),this.#t=null,this.#r=!1;const t=super.consumeProps([],["onConfirm","onDismiss"]);this.#n=t.onConfirm,this.#o=t.onDismiss;}defaultLabel(){return this.props.label??(this.props.title===void 0?"Dialog":void 0);}defaultLabelledBy(){return this.props.label===void 0&&this.props.title!==void 0?this.#l:void 0;}#u=e=>{const t=B(this.styleElement,e);t==="confirm"?(this.#n?.(e),e.defaultPrevented||this.close("confirm",e)):t==="dismiss"&&(this.#o?.(e),e.defaultPrevented||this.close("dismiss",e));};#e=()=>{const e=(this.#t?.scrollTop??0)>0;e!==this.#r&&(this.#r=e,super.setClass($,e));};applyComponentProps(){const e=super.readProps(["confirmLabel"]);super.applyComponentProps(),e.confirmLabelChanged&&super.setClass(I,e.confirmLabel===void 0);}onStyleElementChanged(e){this.styleElement?.removeEventListener("click",this.#u),this.#t?.removeEventListener("scroll",this.#e),super.onStyleElementChanged(e),this.#t=e?.querySelector(".cw-FullScreenDialog-content")??null,e?.addEventListener("click",this.#u),this.#t?.addEventListener("scroll",this.#e,{passive:!0});}render(e){const t=this.props,i=this.#l;return<dialog class="cw-FullScreenDialog">
29
29
  <div class={`cw-FullScreenDialog-header ${v}`}>
30
30
  <T attr:aria-label={t.closeLabel??"Close"}attr:data-cw-dialog-action="dismiss"class="cw-FullScreenDialog-close"size="sm">{t.closeIcon??"close"}</T>
31
31
  <h2 class="cw-FullScreenDialog-title"id={i}>{t.title}</h2>
32
32
  <D attr:data-cw-dialog-action="confirm"class="cw-FullScreenDialog-confirm"size="sm"variant="text">{t.confirmLabel}</D>
33
33
  </div>
34
34
  <div class="cw-FullScreenDialog-content">{e}</div>
35
- </dialog>}onControllerCleanup(){this.styleElement?.removeEventListener("click",this.#u),this.#t?.removeEventListener("scroll",this.#e),super.onControllerCleanup()}}const ee=w(()=>W,()=>Z),pe=n=>ee(P(n,Q));export{me as AlertDialog,G as AlertDialogController,he as Dialog,x as DialogController,pe as FullScreenDialog,Z as FullScreenDialogController,B as actionOf,E as activeElementOf,A as dialogAttributesOf,C as isInitiallyOpen};
35
+ </dialog>;}onControllerCleanup(){this.styleElement?.removeEventListener("click",this.#u),this.#t?.removeEventListener("scroll",this.#e),super.onControllerCleanup();}}const ee=/* @__PURE__ */w(()=>W,()=>Z),pe=n=>ee(P(n,Q));export{me as AlertDialog,G as AlertDialogController,he as Dialog,x as DialogController,pe as FullScreenDialog,Z as FullScreenDialogController,B as actionOf,E as activeElementOf,A as dialogAttributesOf,C as isInitiallyOpen};
@@ -1 +1 @@
1
- import{insert as s}from"solid-js/web";import{defineDomComponent as a}from"..";import{DomController as d}from"../dom/client";import"./surface.css";function r(i,e){return i===!0?"vertical":e??"horizontal"}function o(i){return typeof i!="number"?i:Number.isFinite(i)?`${Math.max(0,i)}px`:void 0}function c(i,e){const t=r(e.vertical,e.orientation),n=e.semantic!==!1;return<div aria-orientation={n&&t==="vertical"?"vertical":void 0}{...i}classList={{...i.classList,[`_cw-Divider-${t}`]:!0,[`_cw-Divider-inset-${e.inset??"none"}`]:!0,"cw-Divider":!0}}role={n?"separator":void 0}style={{...i.style,"--_cw-Divider-thickness":o(e.thickness)}}/>}class m extends d{#e;constructor(e){super(e,{styleElementIsFunction:!0}),this.#e="attr:aria-orientation"in e}applyComponentProps(){const e=super.readProps(["inset","orientation","semantic","thickness","vertical"]),t=r(e.vertical,e.orientation),n=e.semantic!==!1;(e.orientationChanged||e.verticalChanged)&&super.setClass("orientation",`_cw-Divider-${t}`),e.insetChanged&&super.setClass("inset",`_cw-Divider-inset-${e.inset??"none"}`),e.semanticChanged&&super.setAttribute("role",n?"separator":void 0),!this.#e&&(e.semanticChanged||e.orientationChanged||e.verticalChanged)&&super.setAttribute("aria-orientation",n&&t==="vertical"?"vertical":void 0),e.thicknessChanged&&super.setStyle("--_cw-Divider-thickness",o(e.thickness))}render(e){const t=<div class="cw-Divider"/>;return s(t,e),t}}const f=a(()=>c,()=>m);export{f as Divider,m as DividerController};
1
+ import{insert as s}from"solid-js/web";import{defineDomComponent as a}from"..";import{DomController as d}from"../dom/client";import"./surface.css";function r(i,e){return i===!0?"vertical":e??"horizontal";}function o(i){return typeof i!="number"?i:Number.isFinite(i)?`${Math.max(0,i)}px`:void 0;}function c(i,e){const t=r(e.vertical,e.orientation),n=e.semantic!==!1;return<div aria-orientation={n&&t==="vertical"?"vertical":void 0}{...i}classList={{...i.classList,[`_cw-Divider-${t}`]:!0,[`_cw-Divider-inset-${e.inset??"none"}`]:!0,"cw-Divider":!0}}role={n?"separator":void 0}style={{...i.style,"--_cw-Divider-thickness":o(e.thickness)}}/>;}class m extends d{#e;constructor(e){super(e,{styleElementIsFunction:!0}),this.#e="attr:aria-orientation"in e;}applyComponentProps(){const e=super.readProps(["inset","orientation","semantic","thickness","vertical"]),t=r(e.vertical,e.orientation),n=e.semantic!==!1;(e.orientationChanged||e.verticalChanged)&&super.setClass("orientation",`_cw-Divider-${t}`),e.insetChanged&&super.setClass("inset",`_cw-Divider-inset-${e.inset??"none"}`),e.semanticChanged&&super.setAttribute("role",n?"separator":void 0),!this.#e&&(e.semanticChanged||e.orientationChanged||e.verticalChanged)&&super.setAttribute("aria-orientation",n&&t==="vertical"?"vertical":void 0),e.thicknessChanged&&super.setStyle("--_cw-Divider-thickness",o(e.thickness));}render(e){const t=<div class="cw-Divider"/>;return s(t,e),t;}}const f=/* @__PURE__ */a(()=>c,()=>m);export{f as Divider,m as DividerController};
@@ -1 +1 @@
1
- import{VelocityTracker as l}from"../motion";const u=125,m=8e3,b=40;function i(t,e,n){let r=e,o=1/0;for(const a of t){const s=n===!1?e-a:a-e,c=n===void 0?Math.abs(s):s<0?1/0:s;c<=o&&(r=a,o=c)}return r}function E(t,e,n,r){if(n===0)return i(t,e);const o=n>0;if(Math.abs(n)>=u)return i(t,e,o);const a=i(t,e,!1),s=i(t,e,!0);return Math.abs((o?a:s)-e)>=r===o?s:a}function d(t){const e=typeof t.getCoalescedEvents=="function"?t.getCoalescedEvents():[];return e.length>0?e:[t]}class p{#e;#t;constructor(){this.#e=new l,this.#t=0}reset(){this.#e.resetTracking()}track(e,n){for(const r of d(e))this.#e.addDataPoint(r.timeStamp,n(r));this.#t=e.timeStamp}release(e){return e.timeStamp-this.#t>b?0:this.#e.calculateVelocity(m)}}export{p as DragVelocity,u as FLING_VELOCITY_THRESHOLD,m as MAX_FLING_VELOCITY,b as POINTER_STOPPED_MSEC,i as closestAnchorOf,d as coalescedEventsOf,E as settleTargetOf};
1
+ import{VelocityTracker as l}from"../motion";const u=125,m=8e3,b=40;function i(t,e,n){let r=e,o=1/0;for(const a of t){const s=n===!1?e-a:a-e,c=n===void 0?Math.abs(s):s<0?1/0:s;c<=o&&(r=a,o=c);}return r;}function E(t,e,n,r){if(n===0)return i(t,e);const o=n>0;if(Math.abs(n)>=u)return i(t,e,o);const a=i(t,e,!1),s=i(t,e,!0);return Math.abs((o?a:s)-e)>=r===o?s:a;}function d(t){const e=typeof t.getCoalescedEvents=="function"?t.getCoalescedEvents():[];return e.length>0?e:[t];}class p{#e;#t;constructor(){this.#e=new l(),this.#t=0;}reset(){this.#e.resetTracking();}track(e,n){for(const r of d(e))this.#e.addDataPoint(r.timeStamp,n(r));this.#t=e.timeStamp;}release(e){return e.timeStamp-this.#t>b?0:this.#e.calculateVelocity(m);}}export{p as DragVelocity,u as FLING_VELOCITY_THRESHOLD,m as MAX_FLING_VELOCITY,b as POINTER_STOPPED_MSEC,i as closestAnchorOf,d as coalescedEventsOf,E as settleTargetOf};
@@ -1,7 +1,7 @@
1
- import{createSignal as u,onCleanup as f,untrack as h}from"solid-js";import{defineDomComponent as c}from"..";import{ELEVATION_SHADOW_CSS_CLASS as v}from"../container/elevation-shadow";import{DomController as p}from"../dom/client";import{CircularProgressIndicator as E}from"../feedback/progress";import{applySpringMotion as y,subscribeMotionFrames as g}from"../motion";import{DragVelocity as T,settleTargetOf as P}from"./drag";import"../container/elevation-shadow.css";import"./gestures.css";import{Carousel as $,CarouselController as G,CarouselItem as j,CarouselSlide as B}from"./carousel";const l=8,S=56,w=.05,d="--cw-swipe-offset",D=160,L=24,C=80,R=40,I=2,M="a[href], area[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary, [contenteditable]:not([contenteditable=false]), [tabindex]:not([tabindex='-1'])";function x(n){return n!==null&&typeof n=="object"&&n.nodeType===1&&n.matches("input, textarea, select, [contenteditable]:not([contenteditable=false])")}function m(n,e){return<div{...n}classList={{...n.classList,"cw-SwipeToDismiss":!0,"cw-SwipeToDismiss-disabled":e.disabled===!0,[`_cw-SwipeToDismiss-${e.axis??"horizontal"}`]:!0}}data-cw-swipe-axis={e.axis??"horizontal"}>
1
+ import{createSignal as u,onCleanup as f,untrack as h}from"solid-js";import{defineDomComponent as c}from"..";import{ELEVATION_SHADOW_CSS_CLASS as v}from"../container/elevation-shadow";import{DomController as p}from"../dom/client";import{CircularProgressIndicator as E}from"../feedback/progress";import{applySpringMotion as y,subscribeMotionFrames as g}from"../motion";import{DragVelocity as T,settleTargetOf as P}from"./drag";import"../container/elevation-shadow.css";import"./gestures.css";import{Carousel as $,CarouselController as G,CarouselItem as j,CarouselSlide as B}from"./carousel";const l=8,S=56,w=0.05,d="--cw-swipe-offset",D=160,L=24,C=80,R=40,I=2,M="a[href], area[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary, [contenteditable]:not([contenteditable=false]), [tabindex]:not([tabindex='-1'])";function x(n){return n!==null&&typeof n=="object"&&n.nodeType===1&&n.matches("input, textarea, select, [contenteditable]:not([contenteditable=false])");}function m(n,e){return<div{...n}classList={{...n.classList,"cw-SwipeToDismiss":!0,"cw-SwipeToDismiss-disabled":e.disabled===!0,[`_cw-SwipeToDismiss-${e.axis??"horizontal"}`]:!0}}data-cw-swipe-axis={e.axis??"horizontal"}>
2
2
  <div aria-hidden="true"class="cw-SwipeToDismiss-background"inert>{e.background}</div>
3
3
  <div class="cw-SwipeToDismiss-content">{n.children}</div>
4
- </div>}class O extends p{#t;#u;#a;#h;#p;#i;#b;#e;#n;#o;#s;#m;#f;#d;#l;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t=null,this.#u=null,this.#a=h(()=>e.axis??"horizontal"),this.#h=void 0,this.#p=!1,this.#i=0,this.#b=0,this.#e=0,this.#n=0,this.#o=new T,this.#s=void 0,this.#m=0,this.#f=void 0,this.#d=void 0,this.#l=!1,f(()=>{this.#w(),this.#y(),this.#R(this.#t,!1)})}offset(){return this.#s?.value??this.#e}dismiss(e){this.#C(e??(this.#a==="horizontal"?"start":"up"))}reset(){this.#w(),this.#y(),this.#l=!1,this.#e=0,this.#t?.classList.remove("cw-SwipeToDismiss-dismissed"),this.#t?.removeAttribute("aria-hidden"),this.#T(void 0),this.#u!==null&&(this.#u.inert=!1)}#r=(e,t=!1)=>this.#a==="horizontal"!==t?e.clientX:e.clientY;#v(e){const t=e.getBoundingClientRect();return this.#a==="horizontal"?t.width:t.height}#T(e){e===void 0?this.#u?.style.removeProperty(d):this.#u?.style.setProperty(d,`${e}px`)}#L(){const e=this.#t;return e?.ownerDocument.defaultView?.getComputedStyle(e).direction==="rtl"}#P(e){return this.#a==="vertical"?e<0?"up":"down":e<0!==this.#L()?"start":"end"}#E(e,t,i){const s=this.#u,o=s?.ownerDocument.defaultView,a=this.#s?.playState==="running"?this.#s:void 0;if(s===null)return;if(this.#m=e,this.#f=i,a!==void 0){a.retarget(e);return}const r=y(s,d,this.#e,e,{role:"spatial",speed:"default",unit:"px",velocity:t});this.#s=r,o!=null&&r.playState==="running"&&this.props.onOffsetChange!==void 0&&(this.#d=g(o,this.#S)),r.finished.then(()=>this.#I(r),()=>{})}#S=()=>{const e=this.#s;e!==void 0&&h(()=>this.props.onOffsetChange?.(e.value))};#I(e){const t=this.#m,i=this.#f;e===this.#s&&(this.#d?.(),this.#d=void 0,this.#s=void 0,this.#f=void 0,this.#e=t,h(()=>this.props.onOffsetChange?.(t)),t!==0&&this.#M(this.#P(t),i))}#w(){const e=this.#s;this.#d?.(),this.#d=void 0,this.#s=void 0,this.#f=void 0,e!==void 0&&(e.cancel(),this.#e=e.value)}#C(e,t){const i=this.#t,s=this.#L();if(i===null||this.#l||this.props.disabled===!0)return;const o=e==="up"||e==="start"&&!s||e==="end"&&s;this.#y(),this.#n=this.#v(i),this.#E(o?-this.#n:this.#n,0,t)}#M(e,t){const i=this.#t,s=this.#u;i===null||s===null||(this.#l=!0,this.#D(),i.classList.add("cw-SwipeToDismiss-dismissed"),i.setAttribute("aria-hidden","true"),s.inert=!0,h(()=>this.props.onDismiss?.(e,t)))}#D(){const e=this.#t,t=e?.ownerDocument,i=t?.activeElement;if(e===null||t===void 0||i==null||!e.contains(i))return;const s=Array.from(t.querySelectorAll(M)).filter(r=>!e.contains(r)&&r.closest("[inert]")===null&&r.checkVisibility({visibilityProperty:!0})),o=s.findIndex(r=>(e.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING)!==0),a=o<0?s[s.length-1]:s[o];a===void 0?i.blur():a.focus()}#c(e){try{this.#t?.setPointerCapture(e)}catch{return this.#g(),!1}return this.#p=!0,this.#t?.classList.add("cw-SwipeToDismiss-dragging"),!0}#y(){const e=this.#h;if(this.#h=void 0,e!==void 0&&this.#p)try{this.#t?.releasePointerCapture(e)}catch{}this.#p=!1,this.#t?.classList.remove("cw-SwipeToDismiss-dragging")}#g(){this.#l||(this.#w(),this.#y(),this.#e=0,this.#T(void 0))}#H=e=>{const t=this.#t,i=this.#s?.playState==="running";t===null||this.props.disabled===!0||this.#l||this.#h!==void 0||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0||(this.#w(),this.#h=e.pointerId,this.#n=this.#v(t),this.#i=this.#r(e)-this.#e,this.#b=this.#r(e,!0),this.#o.reset(),this.#o.track(e,this.#r),i&&this.#c(e.pointerId))};#x=e=>{if(this.#h!==e.pointerId)return;const t=this.#r(e)-this.#i;if(this.#o.track(e,this.#r),!this.#p){const i=this.#r(e,!0)-this.#b;if(Math.abs(i)>l&&Math.abs(i)>Math.abs(t)){this.#g();return}if(Math.abs(t)<=l||!this.#c(e.pointerId))return}this.#e=Math.max(-this.#n,Math.min(this.#n,t)),this.#T(this.#e),h(()=>this.props.onOffsetChange?.(this.#e,e))};#O(e,t){const i=this.props.threshold,s=this.#n,a=i!==void 0&&Number.isFinite(i)?Math.min(1,Math.max(w,i))*s:Math.min(S,s);if(this.#h!==e.pointerId)return;if(!this.#p){this.#h=void 0;return}const r=t?0:this.#o.release(e);this.#y(),t?this.#E(0,r):this.#E(P([-s,0,s],this.#e,r,a),r,e)}#_=e=>this.#O(e,!1);#A=e=>this.#O(e,!0);#X=e=>{!this.#p&&this.#h===e.pointerId&&(this.#h=void 0)};#k=e=>{e.key!=="Delete"||e.defaultPrevented||e.repeat||x(e.target)||this.props.disabled===!0||this.#l||(e.preventDefault(),this.#C(this.#a==="horizontal"?"start":"up",e))};#R(e,t){const i=t?"addEventListener":"removeEventListener";e?.[i]("pointerdown",this.#H),e?.[i]("pointermove",this.#x),e?.[i]("pointerup",this.#_),e?.[i]("pointercancel",this.#A),e?.[i]("lostpointercapture",this.#A),e?.[i]("pointerleave",this.#X),e?.[i]("keydown",this.#k)}applyComponentProps(){const e=super.readProps(["axis","disabled"]);e.axisChanged&&(this.#g(),this.#a=e.axis??"horizontal",super.setClass("axis",`_cw-SwipeToDismiss-${this.#a}`),super.setAttribute("data-cw-swipe-axis",this.#a)),e.disabledChanged&&(e.disabled===!0&&this.#g(),super.setClass("cw-SwipeToDismiss-disabled",e.disabled===!0))}onStyleElementChanged(e){this.#g(),this.#R(this.#t,!1),super.onStyleElementChanged(e),this.#t=e,this.#u=e?.querySelector(":scope > .cw-SwipeToDismiss-content")??null,this.#R(this.#t,!0)}render(e){const t=this.props;return h(()=>m({children:e},{axis:t.axis,get background(){return t.background},disabled:t.disabled}))}}const V=c(()=>m,()=>O);function A(n,e){return<E attr:aria-hidden="true"indeterminate={e()}size={24}strokeWidth={2.5}value={Math.min(1,n())}/>}function b(n,e,t,i){const s=("refreshing"in e?e.refreshing:e.defaultRefreshing)===!0;return<div{...n}aria-busy={s?"true":"false"}aria-disabled={e.disabled===!0?"true":void 0}aria-keyshortcuts="Enter"aria-label={n["aria-label"]??e.label??"Pull to refresh"}classList={{...n.classList,"cw-PullToRefresh":!0,"cw-PullToRefresh-at-start":!0,"cw-PullToRefresh-disabled":e.disabled===!0,"cw-PullToRefresh-refreshing":s}}data-cw-pull-to-refresh="true"role="region"tabIndex={e.tabIndex??0}>
4
+ </div>;}class O extends p{#t;#u;#a;#h;#p;#i;#b;#e;#n;#o;#s;#m;#f;#d;#l;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t=null,this.#u=null,this.#a=h(()=>e.axis??"horizontal"),this.#h=void 0,this.#p=!1,this.#i=0,this.#b=0,this.#e=0,this.#n=0,this.#o=new T(),this.#s=void 0,this.#m=0,this.#f=void 0,this.#d=void 0,this.#l=!1,f(()=>{this.#w(),this.#y(),this.#R(this.#t,!1);});}offset(){return this.#s?.value??this.#e;}dismiss(e){this.#C(e??(this.#a==="horizontal"?"start":"up"));}reset(){this.#w(),this.#y(),this.#l=!1,this.#e=0,this.#t?.classList.remove("cw-SwipeToDismiss-dismissed"),this.#t?.removeAttribute("aria-hidden"),this.#T(void 0),this.#u!==null&&(this.#u.inert=!1);}#r=(e,t=!1)=>this.#a==="horizontal"!==t?e.clientX:e.clientY;#v(e){const t=e.getBoundingClientRect();return this.#a==="horizontal"?t.width:t.height;}#T(e){e===void 0?this.#u?.style.removeProperty(d):this.#u?.style.setProperty(d,`${e}px`);}#L(){const e=this.#t;return e?.ownerDocument.defaultView?.getComputedStyle(e).direction==="rtl";}#P(e){return this.#a==="vertical"?e<0?"up":"down":e<0!==this.#L()?"start":"end";}#E(e,t,i){const s=this.#u,o=s?.ownerDocument.defaultView,a=this.#s?.playState==="running"?this.#s:void 0;if(s===null)return;if(this.#m=e,this.#f=i,a!==void 0){a.retarget(e);return;}const r=y(s,d,this.#e,e,{role:"spatial",speed:"default",unit:"px",velocity:t});this.#s=r,o!=null&&r.playState==="running"&&this.props.onOffsetChange!==void 0&&(this.#d=g(o,this.#S)),r.finished.then(()=>this.#I(r),()=>{});}#S=()=>{const e=this.#s;e!==void 0&&h(()=>this.props.onOffsetChange?.(e.value));};#I(e){const t=this.#m,i=this.#f;e===this.#s&&(this.#d?.(),this.#d=void 0,this.#s=void 0,this.#f=void 0,this.#e=t,h(()=>this.props.onOffsetChange?.(t)),t!==0&&this.#M(this.#P(t),i));}#w(){const e=this.#s;this.#d?.(),this.#d=void 0,this.#s=void 0,this.#f=void 0,e!==void 0&&(e.cancel(),this.#e=e.value);}#C(e,t){const i=this.#t,s=this.#L();if(i===null||this.#l||this.props.disabled===!0)return;const o=e==="up"||e==="start"&&!s||e==="end"&&s;this.#y(),this.#n=this.#v(i),this.#E(o?-this.#n:this.#n,0,t);}#M(e,t){const i=this.#t,s=this.#u;i===null||s===null||(this.#l=!0,this.#D(),i.classList.add("cw-SwipeToDismiss-dismissed"),i.setAttribute("aria-hidden","true"),s.inert=!0,h(()=>this.props.onDismiss?.(e,t)));}#D(){const e=this.#t,t=e?.ownerDocument,i=t?.activeElement;if(e===null||t===void 0||i==null||!e.contains(i))return;const s=Array.from(t.querySelectorAll(M)).filter(r=>!e.contains(r)&&r.closest("[inert]")===null&&r.checkVisibility({visibilityProperty:!0})),o=s.findIndex(r=>(e.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING)!==0),a=o<0?s[s.length-1]:s[o];a===void 0?i.blur():a.focus();}#c(e){try{this.#t?.setPointerCapture(e);}catch{return this.#g(),!1;}return this.#p=!0,this.#t?.classList.add("cw-SwipeToDismiss-dragging"),!0;}#y(){const e=this.#h;if(this.#h=void 0,e!==void 0&&this.#p)try{this.#t?.releasePointerCapture(e);}catch{}this.#p=!1,this.#t?.classList.remove("cw-SwipeToDismiss-dragging");}#g(){this.#l||(this.#w(),this.#y(),this.#e=0,this.#T(void 0));}#H=e=>{const t=this.#t,i=this.#s?.playState==="running";t===null||this.props.disabled===!0||this.#l||this.#h!==void 0||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0||(this.#w(),this.#h=e.pointerId,this.#n=this.#v(t),this.#i=this.#r(e)-this.#e,this.#b=this.#r(e,!0),this.#o.reset(),this.#o.track(e,this.#r),i&&this.#c(e.pointerId));};#x=e=>{if(this.#h!==e.pointerId)return;const t=this.#r(e)-this.#i;if(this.#o.track(e,this.#r),!this.#p){const i=this.#r(e,!0)-this.#b;if(Math.abs(i)>l&&Math.abs(i)>Math.abs(t)){this.#g();return;}if(Math.abs(t)<=l||!this.#c(e.pointerId))return;}this.#e=Math.max(-this.#n,Math.min(this.#n,t)),this.#T(this.#e),h(()=>this.props.onOffsetChange?.(this.#e,e));};#O(e,t){const i=this.props.threshold,s=this.#n,a=i!==void 0&&Number.isFinite(i)?Math.min(1,Math.max(w,i))*s:Math.min(S,s);if(this.#h!==e.pointerId)return;if(!this.#p){this.#h=void 0;return;}const r=t?0:this.#o.release(e);this.#y(),t?this.#E(0,r):this.#E(P([-s,0,s],this.#e,r,a),r,e);}#_=e=>this.#O(e,!1);#A=e=>this.#O(e,!0);#X=e=>{!this.#p&&this.#h===e.pointerId&&(this.#h=void 0);};#k=e=>{e.key!=="Delete"||e.defaultPrevented||e.repeat||x(e.target)||this.props.disabled===!0||this.#l||(e.preventDefault(),this.#C(this.#a==="horizontal"?"start":"up",e));};#R(e,t){const i=t?"addEventListener":"removeEventListener";e?.[i]("pointerdown",this.#H),e?.[i]("pointermove",this.#x),e?.[i]("pointerup",this.#_),e?.[i]("pointercancel",this.#A),e?.[i]("lostpointercapture",this.#A),e?.[i]("pointerleave",this.#X),e?.[i]("keydown",this.#k);}applyComponentProps(){const e=super.readProps(["axis","disabled"]);e.axisChanged&&(this.#g(),this.#a=e.axis??"horizontal",super.setClass("axis",`_cw-SwipeToDismiss-${this.#a}`),super.setAttribute("data-cw-swipe-axis",this.#a)),e.disabledChanged&&(e.disabled===!0&&this.#g(),super.setClass("cw-SwipeToDismiss-disabled",e.disabled===!0));}onStyleElementChanged(e){this.#g(),this.#R(this.#t,!1),super.onStyleElementChanged(e),this.#t=e,this.#u=e?.querySelector(":scope > .cw-SwipeToDismiss-content")??null,this.#R(this.#t,!0);}render(e){const t=this.props;return h(()=>m({children:e},{axis:t.axis,get background(){return t.background;},disabled:t.disabled}));}}const V=/* @__PURE__ */c(()=>m,()=>O);function A(n,e){return<E attr:aria-hidden="true"indeterminate={e()}size={24}strokeWidth={2.5}value={Math.min(1,n())}/>;}function b(n,e,t,i){const s=("refreshing"in e?e.refreshing:e.defaultRefreshing)===!0;return<div{...n}aria-busy={s?"true":"false"}aria-disabled={e.disabled===!0?"true":void 0}aria-keyshortcuts="Enter"aria-label={n["aria-label"]??e.label??"Pull to refresh"}classList={{...n.classList,"cw-PullToRefresh":!0,"cw-PullToRefresh-at-start":!0,"cw-PullToRefresh-disabled":e.disabled===!0,"cw-PullToRefresh-refreshing":s}}data-cw-pull-to-refresh="true"role="region"tabIndex={e.tabIndex??0}>
5
5
  <div class={`cw-PullToRefresh-indicator ${v}`}>{e.indicator??A(t??(()=>s?1:0),i??(()=>s))}</div>
6
6
  <div class="cw-PullToRefresh-content">{n.children}</div>
7
- </div>}class H extends p{#t;#u;#a;#h;#p;#i;#b;#e;#n;#o;#s;#m;#f;#d;#l;#r;#v;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t="refreshing"in e,this.#e=h(()=>(this.#t?e.refreshing:e.defaultRefreshing)===!0);const[t,i]=u(this.#e?1:0),[s,o]=u(this.#e);this.#u=t,this.#a=i,this.#h=s,this.#p=o,this.#i=null,this.#b=null,this.#n=void 0,this.#o=void 0,this.#s=!1,this.#m=0,this.#f=0,this.#d=0,this.#l=0,this.#r=!1,this.#v=!1,f(()=>{this.#l++,this.#r=!1,this.#c(),this.#F(this.#i,!1)})}complete(e){!this.#t&&this.#e&&this.#P(!1,e)}#T(){const e=this.props.threshold;return e===void 0||!Number.isFinite(e)?D:Math.max(L,e)}#L(e){const t=this.#b;if(this.#a(e??(this.#e?1:0)),t===null)return;if(e===void 0){t.style.removeProperty("transform");return}const i=Math.min(I,Math.max(0,e-1)),s=Math.min(1,e)+i-i*i/4;t.style.transform=`translateY(${s*C-R}px)`}#P(e,t,i=!0){this.#e=e,this.#p(e),this.#a(e?1:0),super.setClass("cw-PullToRefresh-refreshing",e),super.setAttribute("aria-busy",e?"true":"false"),i&&this.#E(e,t)}#E(e,t){h(()=>this.props.onRefreshingChange?.(e,t))}#S(e,t){e===this.#l&&(this.#r=!1,this.#t?this.#e&&this.#v&&this.#E(!1,t):this.#P(!1),this.#v=!1)}#I(e){if(this.props.disabled===!0||this.#e||this.#r)return;const t=++this.#l;let i;this.#r=!0,this.#t?this.#E(!0,e):this.#P(!0,e);try{i=h(()=>this.props.onRefresh?.(e))}catch(s){throw this.#S(t,e),s}i instanceof Promise?i.then(()=>this.#S(t,e),()=>this.#S(t,e)):queueMicrotask(()=>this.#S(t,e))}#w(){return this.#b?.getAnimations().some(e=>"transitionProperty"in e&&e.transitionProperty==="transform"&&e.playState==="running")===!0}#C(){return this.props.disabled!==!0&&!this.#e&&!this.#r&&this.#n===void 0&&this.#o===void 0&&this.#i!==null&&this.#i.scrollTop<=0&&!this.#w()}#M(e,t,i){const s=t-this.#m,o=e-this.#f;if(!this.#s){const a=Math.abs(o);if(s<-l||a>l&&a>Math.abs(s))return this.#c(),!1;if(s<=l)return!1;if(!i())return this.#c(),!1;this.#s=!0,this.#i?.classList.add("cw-PullToRefresh-dragging")}return this.#d=Math.max(0,s),this.#L(this.#d/this.#T()),!0}#D(e,t){const i=this.#d,s=this.#s;this.#c(),s&&!t&&i>=this.#T()&&this.#I(e)}#c(){const e=this.#n;if(e!==void 0&&this.#s)try{this.#i?.releasePointerCapture(e)}catch{}this.#n=void 0,this.#o=void 0,this.#s=!1,this.#d=0,this.#i?.classList.remove("cw-PullToRefresh-dragging"),this.#L(void 0)}#y=e=>{e.pointerType==="touch"||!e.isPrimary||e.button!==0||!this.#C()||(this.#n=e.pointerId,this.#m=e.clientY,this.#f=e.clientX)};#g=e=>{const t=this.#i;e.pointerId!==this.#n||t===null||this.#M(e.clientX,e.clientY,()=>{try{return t.setPointerCapture(e.pointerId),!0}catch{return!1}})};#H=e=>{e.pointerId===this.#n&&this.#D(e,!1)};#x=e=>{e.pointerId===this.#n&&this.#D(e,!0)};#O=e=>{!this.#s&&e.pointerId===this.#n&&this.#c()};#_(e){return Array.from(e.touches).find(t=>t.identifier===this.#o)??Array.from(e.changedTouches).find(t=>t.identifier===this.#o)}#A=e=>{const t=e.touches[0];e.touches.length!==1||t===void 0||!this.#C()||(this.#o=t.identifier,this.#m=t.clientY,this.#f=t.clientX)};#X=e=>{const t=this.#o===void 0?void 0:this.#_(e);if(t===void 0||this.#i===null)return;const i=t.clientY-this.#m,s=t.clientX-this.#f;i>0&&i>=Math.abs(s)&&e.cancelable&&e.preventDefault(),this.#M(t.clientX,t.clientY,()=>!0)&&e.cancelable&&e.preventDefault()};#k=e=>{Array.from(e.changedTouches).some(t=>t.identifier===this.#o)&&this.#D(e,!1)};#R=e=>{Array.from(e.changedTouches).some(t=>t.identifier===this.#o)&&this.#D(e,!0)};#z=e=>{e.key!=="Enter"||e.defaultPrevented||e.repeat||e.target!==this.#i||this.props.disabled===!0||this.#e||this.#r||(e.preventDefault(),this.#I(e))};#N=()=>{this.#i?.classList.toggle("cw-PullToRefresh-at-start",this.#i.scrollTop<=0)};#F(e,t){const i=t?"addEventListener":"removeEventListener";e?.[i]("scroll",this.#N,{passive:!0}),e?.[i]("pointerdown",this.#y),e?.[i]("pointermove",this.#g),e?.[i]("pointerup",this.#H),e?.[i]("pointercancel",this.#x),e?.[i]("lostpointercapture",this.#x),e?.[i]("pointerleave",this.#O),e?.[i]("touchstart",this.#A,{passive:!0}),e?.[i]("touchmove",this.#X,{passive:!1}),e?.[i]("touchend",this.#k),e?.[i]("touchcancel",this.#R),e?.[i]("keydown",this.#z)}applyComponentProps(){const e=super.readProps(["disabled","label","refreshing","tabIndex","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Pull to refresh";if(super.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t),e.tabIndexChanged&&super.setAttribute("tabindex",e.tabIndex??0),e.disabledChanged&&(e.disabled===!0&&this.#c(),super.setAttribute("aria-disabled",e.disabled===!0?"true":void 0),super.setClass("cw-PullToRefresh-disabled",e.disabled===!0)),!this.#t||!e.refreshingChanged)return;const i=e.refreshing===!0;this.#P(i,void 0,!1),i&&this.#c(),this.#r&&(i?this.#v=!0:(this.#r=!1,this.#v=!1,this.#l++))}onStyleElementChanged(e){this.#c(),this.#F(this.#i,!1),super.onStyleElementChanged(e),this.#i=e,this.#b=e?.querySelector(":scope > .cw-PullToRefresh-indicator")??null,this.#F(this.#i,!0),this.#N()}render(e){const t=this.props;return h(()=>b({children:e},{defaultRefreshing:this.#e,disabled:t.disabled,get indicator(){return t.indicator},label:t["attr:aria-label"]??t.label,tabIndex:t.tabIndex},this.#u,this.#h))}}const q=c(()=>b,()=>H);export{$ as Carousel,G as CarouselController,j as CarouselItem,B as CarouselSlide,q as PullToRefresh,H as PullToRefreshController,V as SwipeToDismiss,O as SwipeToDismissController};
7
+ </div>;}class H extends p{#t;#u;#a;#h;#p;#i;#b;#e;#n;#o;#s;#m;#f;#d;#l;#r;#v;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t="refreshing"in e,this.#e=h(()=>(this.#t?e.refreshing:e.defaultRefreshing)===!0);const[t,i]=u(this.#e?1:0),[s,o]=u(this.#e);this.#u=t,this.#a=i,this.#h=s,this.#p=o,this.#i=null,this.#b=null,this.#n=void 0,this.#o=void 0,this.#s=!1,this.#m=0,this.#f=0,this.#d=0,this.#l=0,this.#r=!1,this.#v=!1,f(()=>{this.#l++,this.#r=!1,this.#c(),this.#F(this.#i,!1);});}complete(e){!this.#t&&this.#e&&this.#P(!1,e);}#T(){const e=this.props.threshold;return e===void 0||!Number.isFinite(e)?D:Math.max(L,e);}#L(e){const t=this.#b;if(this.#a(e??(this.#e?1:0)),t===null)return;if(e===void 0){t.style.removeProperty("transform");return;}const i=Math.min(I,Math.max(0,e-1)),s=Math.min(1,e)+i-i*i/4;t.style.transform=`translateY(${s*C-R}px)`;}#P(e,t,i=!0){this.#e=e,this.#p(e),this.#a(e?1:0),super.setClass("cw-PullToRefresh-refreshing",e),super.setAttribute("aria-busy",e?"true":"false"),i&&this.#E(e,t);}#E(e,t){h(()=>this.props.onRefreshingChange?.(e,t));}#S(e,t){e===this.#l&&(this.#r=!1,this.#t?this.#e&&this.#v&&this.#E(!1,t):this.#P(!1),this.#v=!1);}#I(e){if(this.props.disabled===!0||this.#e||this.#r)return;const t=++this.#l;let i;this.#r=!0,this.#t?this.#E(!0,e):this.#P(!0,e);try{i=h(()=>this.props.onRefresh?.(e));}catch(s){throw this.#S(t,e),s;}i instanceof Promise?i.then(()=>this.#S(t,e),()=>this.#S(t,e)):queueMicrotask(()=>this.#S(t,e));}#w(){return this.#b?.getAnimations().some(e=>"transitionProperty"in e&&e.transitionProperty==="transform"&&e.playState==="running")===!0;}#C(){return this.props.disabled!==!0&&!this.#e&&!this.#r&&this.#n===void 0&&this.#o===void 0&&this.#i!==null&&this.#i.scrollTop<=0&&!this.#w();}#M(e,t,i){const s=t-this.#m,o=e-this.#f;if(!this.#s){const a=Math.abs(o);if(s<-l||a>l&&a>Math.abs(s))return this.#c(),!1;if(s<=l)return!1;if(!i())return this.#c(),!1;this.#s=!0,this.#i?.classList.add("cw-PullToRefresh-dragging");}return this.#d=Math.max(0,s),this.#L(this.#d/this.#T()),!0;}#D(e,t){const i=this.#d,s=this.#s;this.#c(),s&&!t&&i>=this.#T()&&this.#I(e);}#c(){const e=this.#n;if(e!==void 0&&this.#s)try{this.#i?.releasePointerCapture(e);}catch{}this.#n=void 0,this.#o=void 0,this.#s=!1,this.#d=0,this.#i?.classList.remove("cw-PullToRefresh-dragging"),this.#L(void 0);}#y=e=>{e.pointerType==="touch"||!e.isPrimary||e.button!==0||!this.#C()||(this.#n=e.pointerId,this.#m=e.clientY,this.#f=e.clientX);};#g=e=>{const t=this.#i;e.pointerId!==this.#n||t===null||this.#M(e.clientX,e.clientY,()=>{try{return t.setPointerCapture(e.pointerId),!0;}catch{return!1;}});};#H=e=>{e.pointerId===this.#n&&this.#D(e,!1);};#x=e=>{e.pointerId===this.#n&&this.#D(e,!0);};#O=e=>{!this.#s&&e.pointerId===this.#n&&this.#c();};#_(e){return Array.from(e.touches).find(t=>t.identifier===this.#o)??Array.from(e.changedTouches).find(t=>t.identifier===this.#o);}#A=e=>{const t=e.touches[0];e.touches.length!==1||t===void 0||!this.#C()||(this.#o=t.identifier,this.#m=t.clientY,this.#f=t.clientX);};#X=e=>{const t=this.#o===void 0?void 0:this.#_(e);if(t===void 0||this.#i===null)return;const i=t.clientY-this.#m,s=t.clientX-this.#f;i>0&&i>=Math.abs(s)&&e.cancelable&&e.preventDefault(),this.#M(t.clientX,t.clientY,()=>!0)&&e.cancelable&&e.preventDefault();};#k=e=>{Array.from(e.changedTouches).some(t=>t.identifier===this.#o)&&this.#D(e,!1);};#R=e=>{Array.from(e.changedTouches).some(t=>t.identifier===this.#o)&&this.#D(e,!0);};#z=e=>{e.key!=="Enter"||e.defaultPrevented||e.repeat||e.target!==this.#i||this.props.disabled===!0||this.#e||this.#r||(e.preventDefault(),this.#I(e));};#N=()=>{this.#i?.classList.toggle("cw-PullToRefresh-at-start",this.#i.scrollTop<=0);};#F(e,t){const i=t?"addEventListener":"removeEventListener";e?.[i]("scroll",this.#N,{passive:!0}),e?.[i]("pointerdown",this.#y),e?.[i]("pointermove",this.#g),e?.[i]("pointerup",this.#H),e?.[i]("pointercancel",this.#x),e?.[i]("lostpointercapture",this.#x),e?.[i]("pointerleave",this.#O),e?.[i]("touchstart",this.#A,{passive:!0}),e?.[i]("touchmove",this.#X,{passive:!1}),e?.[i]("touchend",this.#k),e?.[i]("touchcancel",this.#R),e?.[i]("keydown",this.#z);}applyComponentProps(){const e=super.readProps(["disabled","label","refreshing","tabIndex","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Pull to refresh";if(super.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t),e.tabIndexChanged&&super.setAttribute("tabindex",e.tabIndex??0),e.disabledChanged&&(e.disabled===!0&&this.#c(),super.setAttribute("aria-disabled",e.disabled===!0?"true":void 0),super.setClass("cw-PullToRefresh-disabled",e.disabled===!0)),!this.#t||!e.refreshingChanged)return;const i=e.refreshing===!0;this.#P(i,void 0,!1),i&&this.#c(),this.#r&&(i?this.#v=!0:(this.#r=!1,this.#v=!1,this.#l++));}onStyleElementChanged(e){this.#c(),this.#F(this.#i,!1),super.onStyleElementChanged(e),this.#i=e,this.#b=e?.querySelector(":scope > .cw-PullToRefresh-indicator")??null,this.#F(this.#i,!0),this.#N();}render(e){const t=this.props;return h(()=>b({children:e},{defaultRefreshing:this.#e,disabled:t.disabled,get indicator(){return t.indicator;},label:t["attr:aria-label"]??t.label,tabIndex:t.tabIndex},this.#u,this.#h));}}const q=/* @__PURE__ */c(()=>b,()=>H);export{$ as Carousel,G as CarouselController,j as CarouselItem,B as CarouselSlide,q as PullToRefresh,H as PullToRefreshController,V as SwipeToDismiss,O as SwipeToDismissController};
@@ -1 +1 @@
1
- import"./surface.css";import{Surface as t,SurfaceController as l}from"./surface";import{Divider as i,DividerController as p}from"./divider";import{List as n,ListController as m,ListItem as f,ListItemController as d}from"./list";import{ExpandedListItem as u,ExpandedListItemController as P,RevealListItem as C,RevealListItemController as x,ReorderableList as c,ReorderableListController as M,ReorderHandle as h}from"./list-patterns";import{AlertDialog as L,AlertDialogController as D,Dialog as g,DialogController as R,FullScreenDialog as B,FullScreenDialogController as y}from"./dialog";import{Menu as w,MenuCheckboxItem as v,MenuCheckboxItemController as T,MenuController as A,MenuGroup as E,MenuGroupController as F,MenuItem as H,MenuItemController as k,MenuRadioItem as z,MenuRadioItemController as G,SubMenu as O}from"./menu";import{BottomSheet as j,BottomSheetController as q,ModalBottomSheet as J,ModalBottomSheetController as K}from"./sheet";import{BottomSheetScaffold as Q,ListDetailPaneScaffold as U,ListDetailPaneScaffoldController as V,Scaffold as X,ScaffoldController as Y,SupportingPaneScaffold as Z,SupportingPaneScaffoldController as _,createWindowSizeClass as $,windowSizeClassOf as ee}from"./scaffold";import{ModalSideSheet as re,SideSheetController as te,StandardSideSheet as le}from"./side-sheet";import{Carousel as ie,CarouselController as pe,CarouselItem as ae,CarouselSlide as ne}from"./carousel";import{PullToRefresh as fe,PullToRefreshController as de,SwipeToDismiss as Se,SwipeToDismissController as ue}from"./gestures";export{L as AlertDialog,D as AlertDialogController,j as BottomSheet,q as BottomSheetController,Q as BottomSheetScaffold,ie as Carousel,pe as CarouselController,ae as CarouselItem,ne as CarouselSlide,g as Dialog,R as DialogController,i as Divider,p as DividerController,u as ExpandedListItem,P as ExpandedListItemController,B as FullScreenDialog,y as FullScreenDialogController,n as List,m as ListController,U as ListDetailPaneScaffold,V as ListDetailPaneScaffoldController,f as ListItem,d as ListItemController,w as Menu,v as MenuCheckboxItem,T as MenuCheckboxItemController,A as MenuController,E as MenuGroup,F as MenuGroupController,H as MenuItem,k as MenuItemController,z as MenuRadioItem,G as MenuRadioItemController,J as ModalBottomSheet,K as ModalBottomSheetController,re as ModalSideSheet,fe as PullToRefresh,de as PullToRefreshController,h as ReorderHandle,c as ReorderableList,M as ReorderableListController,C as RevealListItem,x as RevealListItemController,X as Scaffold,Y as ScaffoldController,te as SideSheetController,le as StandardSideSheet,O as SubMenu,Z as SupportingPaneScaffold,_ as SupportingPaneScaffoldController,t as Surface,l as SurfaceController,Se as SwipeToDismiss,ue as SwipeToDismissController,$ as createWindowSizeClass,ee as windowSizeClassOf};
1
+ import"./surface.css";import{Surface as t,SurfaceController as l}from"./surface";import{Divider as i,DividerController as p}from"./divider";import{List as n,ListController as m,ListItem as f,ListItemController as d}from"./list";import{ExpandedListItem as u,ExpandedListItemController as P,RevealListItem as C,RevealListItemController as x,ReorderableList as c,ReorderableListController as M,ReorderHandle as h}from"./list-patterns";import{AlertDialog as L,AlertDialogController as D,Dialog as g,DialogController as R,FullScreenDialog as B,FullScreenDialogController as y}from"./dialog";import{Menu as w,MenuCheckboxItem as v,MenuCheckboxItemController as T,MenuController as A,MenuGroup as E,MenuGroupController as F,MenuItem as H,MenuItemController as k,MenuRadioItem as z,MenuRadioItemController as G,SubMenu as O}from"./menu";import{BottomSheet as j,BottomSheetController as q,ModalBottomSheet as J,ModalBottomSheetController as K}from"./sheet";import{BottomSheetScaffold as Q,ListDetailPaneScaffold as U,ListDetailPaneScaffoldController as V,Scaffold as X,ScaffoldController as Y,SupportingPaneScaffold as Z,SupportingPaneScaffoldController as _,createWindowSizeClass as $,windowSizeClassOf as ee}from"./scaffold";import{ModalSideSheet as re,SideSheetController as te,StandardSideSheet as le}from"./side-sheet";import{Carousel as ie,CarouselController as pe,CarouselItem as ae,CarouselSlide as ne}from"./carousel";import{PullToRefresh as fe,PullToRefreshController as de,SwipeToDismiss as Se,SwipeToDismissController as ue}from"./gestures";export{L as AlertDialog,D as AlertDialogController,j as BottomSheet,q as BottomSheetController,Q as BottomSheetScaffold,ie as Carousel,pe as CarouselController,ae as CarouselItem,ne as CarouselSlide,g as Dialog,R as DialogController,i as Divider,p as DividerController,u as ExpandedListItem,P as ExpandedListItemController,B as FullScreenDialog,y as FullScreenDialogController,n as List,m as ListController,U as ListDetailPaneScaffold,V as ListDetailPaneScaffoldController,f as ListItem,d as ListItemController,w as Menu,v as MenuCheckboxItem,T as MenuCheckboxItemController,A as MenuController,E as MenuGroup,F as MenuGroupController,H as MenuItem,k as MenuItemController,z as MenuRadioItem,G as MenuRadioItemController,J as ModalBottomSheet,K as ModalBottomSheetController,re as ModalSideSheet,fe as PullToRefresh,de as PullToRefreshController,h as ReorderHandle,c as ReorderableList,M as ReorderableListController,C as RevealListItem,x as RevealListItemController,X as Scaffold,Y as ScaffoldController,te as SideSheetController,le as StandardSideSheet,O as SubMenu,Z as SupportingPaneScaffold,_ as SupportingPaneScaffoldController,t as Surface,l as SurfaceController,Se as SwipeToDismiss,ue as SwipeToDismissController,$ as createWindowSizeClass,ee as windowSizeClassOf};
@@ -1 +1 @@
1
- const l="button, a[href], area[href], input, select, textarea, label, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable=false]), [tabindex]:not([tabindex='-1']), [role=button], [role=link], [role=checkbox], [role=radio], [role=switch], [role=slider], [role=scrollbar], [role=spinbutton], [role=textbox], [role=combobox], [role=menuitem], [role=menuitemcheckbox], [role=menuitemradio], [role=tab], [role=option], [role=treeitem], [role=gridcell], [role=listbox], [aria-controls], [aria-haspopup]";function i(e){return e!==null&&typeof e=="object"&&e.nodeType===1}function a(e,r,n){let t=e;if(n!==void 0)for(const o of n){if(o===r)break;if(i(o)&&o.matches(l))return!0}for(;t!==null&&t!==r;){if(t.matches(l))return!0;t=t.parentElement}return!1}export{a as hasNestedInteractive,i as isElementNode};
1
+ const l="button, a[href], area[href], input, select, textarea, label, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable=false]), [tabindex]:not([tabindex='-1']), [role=button], [role=link], [role=checkbox], [role=radio], [role=switch], [role=slider], [role=scrollbar], [role=spinbutton], [role=textbox], [role=combobox], [role=menuitem], [role=menuitemcheckbox], [role=menuitemradio], [role=tab], [role=option], [role=treeitem], [role=gridcell], [role=listbox], [aria-controls], [aria-haspopup]";function i(e){return e!==null&&typeof e=="object"&&e.nodeType===1;}function a(e,r,n){let t=e;if(n!==void 0)for(const o of n){if(o===r)break;if(i(o)&&o.matches(l))return!0;}for(;t!==null&&t!==r;){if(t.matches(l))return!0;t=t.parentElement;}return!1;}export{a as hasNestedInteractive,i as isElementNode};
@@ -10,7 +10,7 @@ import{createUniqueId as P,mergeProps as C,onCleanup as L,onMount as J,untrack a
10
10
  </summary>
11
11
  <div class="cw-ExpandedListItem-body">{r.children}</div>
12
12
  </details>
13
- </li>}class K extends g{#t;#i;#s;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t="open"in e,this.#i=null,this.#s=l(()=>(this.#t?e.open:e.defaultOpen)===!0),L(()=>this.#n(this.styleElement,!1))}#e=e=>{const t=this.#i,n=l(()=>this.props.disabled===!0);t===null||t.open===this.#s||(n||l(()=>this.props.onOpenChange?.(t.open,e)),!this.#t&&!n?this.#s=t.open:this.#s=l(()=>this.#t?this.props.open===!0:this.#s),t.open=this.#s)};#r=e=>{e.type==="keydown"&&!["Enter"," "].includes(e.key)||l(()=>this.props.disabled===!0)&&c(e.target)&&e.target.closest("summary")?.parentElement===this.#i&&e.preventDefault()};#n(e,t){const n=t?"addEventListener":"removeEventListener";this.#i?.[n]("toggle",this.#e),e?.[n]("click",this.#r),e?.[n]("keydown",this.#r)}applyComponentProps(){const e=super.readProps(["disabled","open","supportingText"]),t=this.#i?.querySelector(":scope > summary");this.#t&&e.openChanged&&(this.#s=e.open===!0),this.#i!==null&&this.#i.open!==this.#s&&(this.#i.open=this.#s),e.disabledChanged&&e.disabled===!0?(t?.setAttribute("aria-disabled","true"),t?.setAttribute("tabindex","-1")):e.disabledChanged&&(t?.removeAttribute("aria-disabled"),t?.removeAttribute("tabindex")),e.supportingTextChanged&&t?.querySelector(".cw-ListItem-supporting")?.toggleAttribute("hidden",e.supportingText===void 0)}onStyleElementChanged(e){this.#n(super.styleElement,!1),super.onStyleElementChanged(e),this.#i=e?.querySelector(":scope > details")??null,this.#n(e,!0)}render(e){const t=this.props;return l(()=>H({children:e},{defaultOpen:this.#s,disabled:t.disabled,get headline(){return t.headline},get leading(){return t.leading},get supportingText(){return t.supportingText}}))}}const G=f(()=>H,()=>K),Le=r=>G(x(r,["children","headline","leading","supportingText"]));function A(r,e,t){const n=("expanded"in e?e.expanded:e.defaultExpanded)===!0,s=l(()=>e.supportingText===void 0),i=e.hideLabel??"Hide actions",o=e.revealLabel??"Show actions";return<li{...r}classList={{...r.classList,"cw-RevealListItem":!0,"cw-RevealListItem-expanded":n}}>
13
+ </li>;}class K extends g{#t;#i;#s;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t="open"in e,this.#i=null,this.#s=l(()=>(this.#t?e.open:e.defaultOpen)===!0),L(()=>this.#n(this.styleElement,!1));}#e=e=>{const t=this.#i,n=l(()=>this.props.disabled===!0);t===null||t.open===this.#s||(n||l(()=>this.props.onOpenChange?.(t.open,e)),!this.#t&&!n?this.#s=t.open:this.#s=l(()=>this.#t?this.props.open===!0:this.#s),t.open=this.#s);};#r=e=>{e.type==="keydown"&&!["Enter"," "].includes(e.key)||l(()=>this.props.disabled===!0)&&c(e.target)&&e.target.closest("summary")?.parentElement===this.#i&&e.preventDefault();};#n(e,t){const n=t?"addEventListener":"removeEventListener";this.#i?.[n]("toggle",this.#e),e?.[n]("click",this.#r),e?.[n]("keydown",this.#r);}applyComponentProps(){const e=super.readProps(["disabled","open","supportingText"]),t=this.#i?.querySelector(":scope > summary");this.#t&&e.openChanged&&(this.#s=e.open===!0),this.#i!==null&&this.#i.open!==this.#s&&(this.#i.open=this.#s),e.disabledChanged&&e.disabled===!0?(t?.setAttribute("aria-disabled","true"),t?.setAttribute("tabindex","-1")):e.disabledChanged&&(t?.removeAttribute("aria-disabled"),t?.removeAttribute("tabindex")),e.supportingTextChanged&&t?.querySelector(".cw-ListItem-supporting")?.toggleAttribute("hidden",e.supportingText===void 0);}onStyleElementChanged(e){this.#n(super.styleElement,!1),super.onStyleElementChanged(e),this.#i=e?.querySelector(":scope > details")??null,this.#n(e,!0);}render(e){const t=this.props;return l(()=>H({children:e},{defaultOpen:this.#s,disabled:t.disabled,get headline(){return t.headline;},get leading(){return t.leading;},get supportingText(){return t.supportingText;}}));}}const G=/* @__PURE__ */f(()=>H,()=>K),Le=r=>G(x(r,["children","headline","leading","supportingText"]));function A(r,e,t){const n=("expanded"in e?e.expanded:e.defaultExpanded)===!0,s=l(()=>e.supportingText===void 0),i=e.hideLabel??"Hide actions",o=e.revealLabel??"Show actions";return<li{...r}classList={{...r.classList,"cw-RevealListItem":!0,"cw-RevealListItem-expanded":n}}>
14
14
  <div class="cw-RevealListItem-row">
15
15
  <span class="cw-ListItem-leading">{e.leading}</span>
16
16
  <span class="cw-ListItem-content">
@@ -20,7 +20,7 @@ import{createUniqueId as P,mergeProps as C,onCleanup as L,onMount as J,untrack a
20
20
  <button aria-controls={t}aria-expanded={n?"true":"false"}aria-label={n?i:o}class="cw-RevealListItem-toggle"disabled={e.disabled===!0}type="button"><R autoMirror name={z}/></button>
21
21
  </div>
22
22
  <div aria-hidden={n?void 0:"true"}class="cw-RevealListItem-actions"id={t}inert={!n}>{e.actions}</div>
23
- </li>}class W extends g{#t;#i;#s;#e;#r;#n;#l;#d;#u;#o;#p;#L;#v;#b;#a;#m;#w;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t=`cw-reveal-${P()}`,this.#i="expanded"in e,this.#s=new M,this.#e=l(()=>(this.#i?e.expanded:e.defaultExpanded)===!0),this.#r=null,this.#n=null,this.#l=0,this.#d=this.#e?1:0,this.#u=0,this.#o=void 0,this.#p=!1,this.#L=0,this.#v=0,this.#b=!1,this.#a=void 0,this.#m=void 0,this.#w=!1,J(()=>this.#M()),L(()=>{this.#w=!0,this.#c(),this.#a?.cancel(),this.#m?.disconnect(),this.#g(this.styleElement,!1)})}#E(e,t,n=0){!this.#w&&e!==this.#e&&l(()=>this.props.disabled!==!0)&&(l(()=>this.props.onExpandedChange?.(e,t)),this.#i||(this.#e=e),this.#y()),this.#f(n)}#y(){const e=this.#r,t=this.#n,n=this.#e,s=l(()=>this.props.hideLabel??"Hide actions"),i=l(()=>this.props.revealLabel??"Show actions");super.setClass("cw-RevealListItem-expanded",n),e?.setAttribute("aria-expanded",n?"true":"false"),e?.setAttribute("aria-label",n?s:i),t!==null&&(!n&&t.contains(t.ownerDocument.activeElement)&&e?.focus(),t.inert=!n,t.toggleAttribute("aria-hidden",!n))}#R(e){this.#d=e,super.setStyle(I,`${e}`)}#f(e){const t=this.styleElement,n=this.#e?1:0,s=this.#a?.playState==="running"?this.#a:void 0;if(t===null)return;if(s!==void 0){s.retarget(n);return}if(this.#d===n&&e===0){this.#R(n);return}const i=T(t,I,this.#d,n,{role:"spatial",speed:"default",velocity:e});this.#a=i,super.setClass("cw-RevealListItem-settling",!0),i.finished.then(()=>{i===this.#a&&(this.#a=void 0,this.#d=i.value,super.setClass("cw-RevealListItem-settling",!1))},()=>{})}#x(){const e=this.#a;this.#a=void 0,e!==void 0&&(e.cancel(),this.#d=e.value,super.setClass("cw-RevealListItem-settling",!1))}#c(){const e=this.#o;if(this.#o=void 0,e!==void 0&&this.#p)try{this.styleElement?.releasePointerCapture(e)}catch{}this.#p=!1,super.setClass("cw-RevealListItem-dragging",!1)}#h=e=>{e.defaultPrevented||!c(e.target)||e.target.closest(".cw-RevealListItem-toggle")!==this.#r||m(e,this.styleElement,()=>this.#E(!this.#e,e),!1)};#P=e=>{e.key==="Escape"&&this.#e&&m(e,this.styleElement,()=>this.#E(!1,e))};#C=e=>{const t=this.styleElement;t===null||l(()=>this.props.disabled===!0)||this.#o!==void 0||!e.isPrimary||e.button!==0||!c(e.target)||V(e.target,t,e.composedPath())||(this.#x(),this.#o=e.pointerId,this.#L=e.clientX,this.#v=e.clientY,this.#u=this.#d,this.#b=t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl",this.#s.reset(),this.#s.track(e,this.#I))};#I=e=>this.#b?e.clientX:-e.clientX;#D=e=>{const t=this.styleElement,n=(e.clientX-this.#L)*(this.#b?1:-1);if(!(this.#o!==e.pointerId||t===null)){if(this.#s.track(e,this.#I),!this.#p){if(Math.abs(e.clientY-this.#v)>Math.max(E,Math.abs(n))){this.#c(),this.#f(0);return}if(Math.abs(n)<E||this.#l===0)return;try{t.setPointerCapture(e.pointerId)}catch{this.#c(),this.#f(0);return}this.#p=!0,super.setClass("cw-RevealListItem-dragging",!0)}this.#R(Math.max(0,Math.min(1,this.#u+n/this.#l)))}};#T=e=>{const t=this.#l,n=this.#p,s=this.#s.release(e);if(this.#o===e.pointerId){if(this.#c(),!n){this.#f(0);return}this.#E(_([0,t],this.#d*t,s,t/2)>0,e,s/t)}};#S=e=>{this.#o===e.pointerId&&(this.#c(),this.#f(0))};#g(e,t){const n=t?"addEventListener":"removeEventListener";e?.[n]("click",this.#h),e?.[n]("keydown",this.#P),e?.[n]("pointerdown",this.#C),e?.[n]("pointermove",this.#D),e?.[n]("pointerup",this.#T),e?.[n]("pointercancel",this.#S),e?.[n]("lostpointercapture",this.#S)}#M(){const e=this.#n,t=e?.isConnected===!0?e.ownerDocument.defaultView:null;this.#m?.disconnect(),this.#m=void 0,!(e===null||t==null)&&(this.#m=new t.ResizeObserver(()=>{this.#l=e.offsetWidth,super.setStyle(N,`${this.#l}px`)}),this.#m.observe(e))}applyComponentProps(){const e=super.readProps(["disabled","expanded","hideLabel","revealLabel","supportingText"]);e.disabledChanged&&(e.disabled===!0&&this.#o!==void 0&&(this.#c(),this.#f(0)),this.#r!==null&&(this.#r.disabled=e.disabled===!0)),e.supportingTextChanged&&this.styleElement?.querySelector(".cw-RevealListItem-row .cw-ListItem-supporting")?.toggleAttribute("hidden",e.supportingText===void 0),this.#i&&e.expandedChanged&&this.#e!==(e.expanded===!0)?(this.#e=e.expanded===!0,this.#y(),this.#o===void 0&&this.#f(0)):(e.hideLabelChanged||e.revealLabelChanged)&&this.#y()}onStyleElementChanged(e){this.#c(),this.#x(),this.#g(super.styleElement,!1),super.onStyleElementChanged(e),this.#r=e?.querySelector(".cw-RevealListItem-toggle")??null,this.#n=e?.querySelector(":scope > .cw-RevealListItem-actions")??null,this.#g(e,!0),this.#M(),this.#n!==null&&(this.#n.id===""&&(this.#n.id=this.#t),this.#r?.setAttribute("aria-controls",this.#n.id),this.#y())}render(e){const t=this.props;return l(()=>A({children:e},{get actions(){return t.actions},defaultExpanded:this.#e,disabled:t.disabled,get headline(){return t.headline},hideLabel:t.hideLabel,get leading(){return t.leading},revealLabel:t.revealLabel,get supportingText(){return t.supportingText}},this.#t))}}const j=f(()=>(r,e)=>A(r,e,`cw-reveal-${P()}`),()=>W),ge=r=>j(x(r,["actions","children","headline","leading","supportingText"]));function k(r){let e=r;for(;typeof e=="function";)e=e();return e??<R name={F}/>}function Z(r,e){return<button{...r}aria-keyshortcuts="Space ArrowUp ArrowDown Home End Escape"aria-label={r["aria-label"]??e.label??"Reorder item"}aria-pressed="false"classList={{...r.classList,"cw-ReorderHandle":!0}}data-cw-reorder-handle="true"disabled={e.disabled===!0}type="button">{k(r.children)}</button>}class Q extends g{constructor(e){super(e,{styleElementIsFunction:!0})}applyComponentProps(){const e=super.readProps(["disabled","label","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Reorder item";e.disabledChanged&&super.setAttribute("disabled",e.disabled===!0),this.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t)}render(e){const t=<button aria-keyshortcuts="Space ArrowUp ArrowDown Home End Escape"aria-pressed="false"class="cw-ReorderHandle"data-cw-reorder-handle="true"type="button"/>;return D(t,()=>k(e)),t}}const ve=f(()=>Z,()=>Q);function ee(r,e){return<>
23
+ </li>;}class W extends g{#t;#i;#s;#e;#r;#n;#l;#d;#u;#o;#p;#L;#v;#b;#a;#m;#w;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t=`cw-reveal-${P()}`,this.#i="expanded"in e,this.#s=new M(),this.#e=l(()=>(this.#i?e.expanded:e.defaultExpanded)===!0),this.#r=null,this.#n=null,this.#l=0,this.#d=this.#e?1:0,this.#u=0,this.#o=void 0,this.#p=!1,this.#L=0,this.#v=0,this.#b=!1,this.#a=void 0,this.#m=void 0,this.#w=!1,J(()=>this.#M()),L(()=>{this.#w=!0,this.#c(),this.#a?.cancel(),this.#m?.disconnect(),this.#g(this.styleElement,!1);});}#E(e,t,n=0){!this.#w&&e!==this.#e&&l(()=>this.props.disabled!==!0)&&(l(()=>this.props.onExpandedChange?.(e,t)),this.#i||(this.#e=e),this.#y()),this.#f(n);}#y(){const e=this.#r,t=this.#n,n=this.#e,s=l(()=>this.props.hideLabel??"Hide actions"),i=l(()=>this.props.revealLabel??"Show actions");super.setClass("cw-RevealListItem-expanded",n),e?.setAttribute("aria-expanded",n?"true":"false"),e?.setAttribute("aria-label",n?s:i),t!==null&&(!n&&t.contains(t.ownerDocument.activeElement)&&e?.focus(),t.inert=!n,t.toggleAttribute("aria-hidden",!n));}#R(e){this.#d=e,super.setStyle(I,`${e}`);}#f(e){const t=this.styleElement,n=this.#e?1:0,s=this.#a?.playState==="running"?this.#a:void 0;if(t===null)return;if(s!==void 0){s.retarget(n);return;}if(this.#d===n&&e===0){this.#R(n);return;}const i=T(t,I,this.#d,n,{role:"spatial",speed:"default",velocity:e});this.#a=i,super.setClass("cw-RevealListItem-settling",!0),i.finished.then(()=>{i===this.#a&&(this.#a=void 0,this.#d=i.value,super.setClass("cw-RevealListItem-settling",!1));},()=>{});}#x(){const e=this.#a;this.#a=void 0,e!==void 0&&(e.cancel(),this.#d=e.value,super.setClass("cw-RevealListItem-settling",!1));}#c(){const e=this.#o;if(this.#o=void 0,e!==void 0&&this.#p)try{this.styleElement?.releasePointerCapture(e);}catch{}this.#p=!1,super.setClass("cw-RevealListItem-dragging",!1);}#h=e=>{e.defaultPrevented||!c(e.target)||e.target.closest(".cw-RevealListItem-toggle")!==this.#r||m(e,this.styleElement,()=>this.#E(!this.#e,e),!1);};#P=e=>{e.key==="Escape"&&this.#e&&m(e,this.styleElement,()=>this.#E(!1,e));};#C=e=>{const t=this.styleElement;t===null||l(()=>this.props.disabled===!0)||this.#o!==void 0||!e.isPrimary||e.button!==0||!c(e.target)||V(e.target,t,e.composedPath())||(this.#x(),this.#o=e.pointerId,this.#L=e.clientX,this.#v=e.clientY,this.#u=this.#d,this.#b=t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl",this.#s.reset(),this.#s.track(e,this.#I));};#I=e=>this.#b?e.clientX:-e.clientX;#D=e=>{const t=this.styleElement,n=(e.clientX-this.#L)*(this.#b?1:-1);if(!(this.#o!==e.pointerId||t===null)){if(this.#s.track(e,this.#I),!this.#p){if(Math.abs(e.clientY-this.#v)>Math.max(E,Math.abs(n))){this.#c(),this.#f(0);return;}if(Math.abs(n)<E||this.#l===0)return;try{t.setPointerCapture(e.pointerId);}catch{this.#c(),this.#f(0);return;}this.#p=!0,super.setClass("cw-RevealListItem-dragging",!0);}this.#R(Math.max(0,Math.min(1,this.#u+n/this.#l)));}};#T=e=>{const t=this.#l,n=this.#p,s=this.#s.release(e);if(this.#o===e.pointerId){if(this.#c(),!n){this.#f(0);return;}this.#E(_([0,t],this.#d*t,s,t/2)>0,e,s/t);}};#S=e=>{this.#o===e.pointerId&&(this.#c(),this.#f(0));};#g(e,t){const n=t?"addEventListener":"removeEventListener";e?.[n]("click",this.#h),e?.[n]("keydown",this.#P),e?.[n]("pointerdown",this.#C),e?.[n]("pointermove",this.#D),e?.[n]("pointerup",this.#T),e?.[n]("pointercancel",this.#S),e?.[n]("lostpointercapture",this.#S);}#M(){const e=this.#n,t=e?.isConnected===!0?e.ownerDocument.defaultView:null;this.#m?.disconnect(),this.#m=void 0,!(e===null||t==null)&&(this.#m=new t.ResizeObserver(()=>{this.#l=e.offsetWidth,super.setStyle(N,`${this.#l}px`);}),this.#m.observe(e));}applyComponentProps(){const e=super.readProps(["disabled","expanded","hideLabel","revealLabel","supportingText"]);e.disabledChanged&&(e.disabled===!0&&this.#o!==void 0&&(this.#c(),this.#f(0)),this.#r!==null&&(this.#r.disabled=e.disabled===!0)),e.supportingTextChanged&&this.styleElement?.querySelector(".cw-RevealListItem-row .cw-ListItem-supporting")?.toggleAttribute("hidden",e.supportingText===void 0),this.#i&&e.expandedChanged&&this.#e!==(e.expanded===!0)?(this.#e=e.expanded===!0,this.#y(),this.#o===void 0&&this.#f(0)):(e.hideLabelChanged||e.revealLabelChanged)&&this.#y();}onStyleElementChanged(e){this.#c(),this.#x(),this.#g(super.styleElement,!1),super.onStyleElementChanged(e),this.#r=e?.querySelector(".cw-RevealListItem-toggle")??null,this.#n=e?.querySelector(":scope > .cw-RevealListItem-actions")??null,this.#g(e,!0),this.#M(),this.#n!==null&&(this.#n.id===""&&(this.#n.id=this.#t),this.#r?.setAttribute("aria-controls",this.#n.id),this.#y());}render(e){const t=this.props;return l(()=>A({children:e},{get actions(){return t.actions;},defaultExpanded:this.#e,disabled:t.disabled,get headline(){return t.headline;},hideLabel:t.hideLabel,get leading(){return t.leading;},revealLabel:t.revealLabel,get supportingText(){return t.supportingText;}},this.#t));}}const j=/* @__PURE__ */f(()=>(r,e)=>A(r,e,`cw-reveal-${P()}`),()=>W),ge=r=>j(x(r,["actions","children","headline","leading","supportingText"]));function k(r){let e=r;for(;typeof e=="function";)e=e();return e??<R name={F}/>;}function Z(r,e){return<button{...r}aria-keyshortcuts="Space ArrowUp ArrowDown Home End Escape"aria-label={r["aria-label"]??e.label??"Reorder item"}aria-pressed="false"classList={{...r.classList,"cw-ReorderHandle":!0}}data-cw-reorder-handle="true"disabled={e.disabled===!0}type="button">{k(r.children)}</button>;}class Q extends g{constructor(e){super(e,{styleElementIsFunction:!0});}applyComponentProps(){const e=super.readProps(["disabled","label","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Reorder item";e.disabledChanged&&super.setAttribute("disabled",e.disabled===!0),this.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t);}render(e){const t=<button aria-keyshortcuts="Space ArrowUp ArrowDown Home End Escape"aria-pressed="false"class="cw-ReorderHandle"data-cw-reorder-handle="true"type="button"/>;return D(t,()=>k(e)),t;}}const ve=/* @__PURE__ */f(()=>Z,()=>Q);function ee(r,e){return<>
24
24
  <div aria-atomic="true"aria-live="polite"class="cw-ReorderableList-status"role="status"/>
25
25
  <ul{...r}aria-disabled={e.disabled===!0?"true":void 0}classList={{...r.classList,"cw-List":!0,"cw-ReorderableList":!0}}data-cw-list-selection-mode="none"data-cw-list-variant={e.variant??"standard"}role="list">{r.children}</ul>
26
- </>}class te extends ${#t;#i;#s;#e;#r;#n;#l;#d;#u;#o;#p;constructor(e){const t=C(e,{selectionMode:"none"});super(t),this.#t=l(()=>e),this.#i=new M,this.#s=null,this.#e=void 0,this.#r=void 0,this.#n=void 0,this.#l=null,this.#d=0,this.#u=void 0,this.#o=void 0,this.#p=!1,L(()=>{this.#p=!0,this.#h(),this.#o?.cancel(),this.#g(this.styleElement,!1)})}#L(){return Array.from(this.styleElement?.children??[]).filter(e=>e.hasAttribute("data-cw-list-value"))}#v(e){return this.#L().find(t=>t.dataset.cwListValue===e)}#b(e){const n=(c(e)?e:null)?.closest("[data-cw-reorder-handle]")??null,s=n?.closest("[data-cw-list-value]");if(!(n===null||n.disabled||s?.parentElement!==this.styleElement))return s.dataset.cwListValue}#a(e,t=!1){const n=this.#e,s=this.#t.values;if(n===void 0||this.#s===null)return;const i=s.indexOf(n)+1;this.#s.textContent=l(()=>this.#t.announcement?.(n,i,s.length,e,t))??(t?"Cancelled. Restored the original order.":e?`${n}, position ${i} of ${s.length}. ${q}`:`${n}, dropped at position ${i} of ${s.length}.`)}#m(e,t,n){const s=this.#t.values,i=s.indexOf(e),o=Math.max(0,Math.min(s.length-1,t)),a=s.slice();return this.#p||i<0||i===o||new Set(s).size!==s.length?!1:(a.splice(i,1),a.splice(o,0,e),l(()=>this.#t.onReorder(a,n)),!0)}#w(e){this.#h(),this.#e=e,this.#r=this.#t.values.slice(),this.#E(),this.#a(!0)}#E(){for(const e of this.#L()){const t=e.dataset.cwListValue===this.#e;e.classList.toggle("cw-ReorderableList-moving",t),e.classList.toggle(B,t),e.querySelector("[data-cw-reorder-handle]")?.setAttribute("aria-pressed",t?"true":"false")}}#y(e){const t=this.styleElement,n=this.#L(),s=n.indexOf(e),i=t.ownerDocument.defaultView,o=Number.parseFloat(i?.getComputedStyle(t).rowGap??"")||0,a=t.getBoundingClientRect().top,u=n.map(d=>d.getBoundingClientRect()),h=u[s],O=n.filter(d=>d!==e),S=u.filter((d,X)=>X!==s),b={row:e,from:s,others:O,centers:S.map(d=>d.top+d.height/2),extents:S.map(d=>d.height+o),extent:h.height+o,center:h.top+h.height/2,start:h.top-a,size:h.height,pointerStart:this.#d,insertion:s,offset:0};return t.classList.add("cw-ReorderableList-dragging"),t.style.setProperty("--cw-reorder-shift",`${b.extent}px`),this.#R(b),b}#R(e){const t=this.styleElement;let n=e.start;for(let s=e.from;s<e.insertion;s++)n+=e.extents[s];for(let s=e.insertion;s<e.from;s++)n-=e.extents[s];t?.style.setProperty("--cw-reorder-slot-start",`${n}px`),t?.style.setProperty("--cw-reorder-slot-size",`${e.size}px`)}#f(e,t){const n=e.center+t-e.pointerStart,s=e.insertion;let i=0;for(;i<e.centers.length&&e.centers[i]<n;)i++;if(e.offset=t-e.pointerStart,e.row.style.setProperty(p,`${e.offset}px`),i!==s){e.insertion=i;for(let o=Math.min(s,i);o<Math.max(s,i);o++){const a=e.others[o],u=o>=e.from&&o<i,h=o<e.from&&o>=i;a.classList.toggle("cw-ReorderableList-shiftedUp",u),a.classList.toggle("cw-ReorderableList-shiftedDown",h)}this.#R(e)}}#x(e){const t=this.styleElement;t?.classList.remove("cw-ReorderableList-dragging");for(const n of e.others)n.classList.remove("cw-ReorderableList-shiftedUp","cw-ReorderableList-shiftedDown");t?.style.removeProperty("--cw-reorder-shift"),t?.style.removeProperty("--cw-reorder-slot-start"),t?.style.removeProperty("--cw-reorder-slot-size")}#c(e,t,n){const s=Number.parseFloat(e.style.getPropertyValue(p))||0,i=t-(e.getBoundingClientRect().top-s);this.#o?.cancel(),e.classList.add("cw-ReorderableList-settling"),e.style.setProperty(p,`${i}px`);const o=T(e,p,i,0,{role:"spatial",speed:"fast",unit:"px",velocity:n});this.#o=o,o.finished.then(()=>{e.classList.remove("cw-ReorderableList-settling"),e.style.removeProperty(p)},()=>{e.classList.remove("cw-ReorderableList-settling"),e.style.removeProperty(p)})}#h(){const e=this.#n,t=this.#u;if(this.#n=void 0,e!==void 0&&t!==void 0)try{this.#l?.releasePointerCapture(e)}catch{}t!==void 0&&this.#x(t),this.#u=void 0,this.#e=void 0,this.#r=void 0,this.#l=null,this.#E()}#P=e=>{const t=this.#b(e.target);e.defaultPrevented||t===void 0||this.#t.disabled===!0||m(e,this.styleElement,()=>{if(!(this.#p||this.#t.disabled===!0)){if(this.#e!==t){this.#w(t);return}this.#a(!1),this.#h()}},!1)};#C=e=>{const t=this.#e;this.#t.disabled===!0||t===void 0||this.#b(e.target)!==t||!Y.includes(e.key)||m(e,this.styleElement,()=>{const n=this.#t.values,s=n.indexOf(t);if(this.#e===t){if(e.key==="Escape"){this.#r!==void 0&&l(()=>this.#t.onReorder(this.#r,e)),this.#a(!1,!0),this.#h();return}this.#m(t,e.key==="Home"?0:e.key==="End"?n.length-1:s+(e.key==="ArrowDown"?1:-1),e),queueMicrotask(()=>{this.#v(t)?.querySelector("[data-cw-reorder-handle]")?.focus(),this.#E(),this.#a(this.#e===t)})}})};#I=e=>{const t=this.#b(e.target);this.#t.disabled===!0||this.#n!==void 0||!e.isPrimary||e.button!==0||t===void 0||!c(e.target)||(this.#e!==t&&(this.#h(),this.#e=t),this.#n=e.pointerId,this.#l=e.target.closest("[data-cw-reorder-handle]"),this.#d=e.clientY,this.#i.reset(),this.#i.track(e,n=>n.clientY))};#D=e=>{const t=this.#e,n=t===void 0?void 0:this.#v(t);if(!(e.pointerId!==this.#n||this.#l===null||n===void 0)){if(this.#i.track(e,s=>s.clientY),this.#u===void 0){if(Math.abs(e.clientY-this.#d)<E)return;try{this.#l.setPointerCapture(e.pointerId)}catch{this.#h();return}this.#o?.cancel(),this.#E(),this.#u=this.#y(n)}this.#f(this.#u,e.clientY)}};#T=e=>{const t=this.#u,n=this.#e,s=this.#l,i=u=>{u.preventDefault(),u.stopImmediatePropagation()};if(e.pointerId!==this.#n)return;if(t===void 0||n===void 0){this.#n=void 0,this.#l=null,t===void 0&&this.#r===void 0&&(this.#e=void 0);return}const o=t.row.getBoundingClientRect().top,a=this.#i.release(e);this.#x(t),this.#u=void 0,this.#m(n,t.insertion,e),this.#a(!1),this.#h(),this.#c(t.row,o,a),s?.addEventListener("click",i,{capture:!0,once:!0}),s?.ownerDocument.defaultView?.setTimeout(()=>s.removeEventListener("click",i,!0),0)};#S=e=>{const t=this.#u;if(e.pointerId!==this.#n)return;if(t===void 0){this.#h();return}const n=t.row.getBoundingClientRect().top;this.#h(),this.#c(t.row,n,0)};#g(e,t){const n=t?"addEventListener":"removeEventListener";e?.[n]("click",this.#P),e?.[n]("keydown",this.#C),e?.[n]("pointerdown",this.#I),e?.[n]("pointermove",this.#D),e?.[n]("pointerup",this.#T),e?.[n]("pointercancel",this.#S),e?.[n]("lostpointercapture",this.#S)}applyComponentProps(){const e=this.#t.disabled===!0,t=this.#t.values;super.applyComponentProps(),super.setClass("cw-ReorderableList",!0),super.setAttribute("aria-disabled",e?"true":void 0),(e||this.#e!==void 0&&!t.includes(this.#e))&&l(()=>this.#h())}onStyleElementChanged(e){this.#h(),this.#g(super.styleElement,!1),super.onStyleElementChanged(e),this.#g(e,!0)}render(e){const t=<div aria-atomic="true"aria-live="polite"class="cw-ReorderableList-status"role="status"/>,n=<ul class="cw-List cw-ReorderableList"data-cw-list-selection-mode="none"role="list"/>;return this.#s=t,D(n,e),[t,n]}}const ne=f(()=>ee,()=>te),ye=r=>{const e=C({variant:"standard"},x(r,["children"]));return ne(e)};export{Le as ExpandedListItem,K as ExpandedListItemController,ve as ReorderHandle,ye as ReorderableList,te as ReorderableListController,ge as RevealListItem,W as RevealListItemController};
26
+ </>;}class te extends ${#t;#i;#s;#e;#r;#n;#l;#d;#u;#o;#p;constructor(e){const t=C(e,{selectionMode:"none"});super(t),this.#t=l(()=>e),this.#i=new M(),this.#s=null,this.#e=void 0,this.#r=void 0,this.#n=void 0,this.#l=null,this.#d=0,this.#u=void 0,this.#o=void 0,this.#p=!1,L(()=>{this.#p=!0,this.#h(),this.#o?.cancel(),this.#g(this.styleElement,!1);});}#L(){return Array.from(this.styleElement?.children??[]).filter(e=>e.hasAttribute("data-cw-list-value"));}#v(e){return this.#L().find(t=>t.dataset.cwListValue===e);}#b(e){const n=(c(e)?e:null)?.closest("[data-cw-reorder-handle]")??null,s=n?.closest("[data-cw-list-value]");if(!(n===null||n.disabled||s?.parentElement!==this.styleElement))return s.dataset.cwListValue;}#a(e,t=!1){const n=this.#e,s=this.#t.values;if(n===void 0||this.#s===null)return;const i=s.indexOf(n)+1;this.#s.textContent=l(()=>this.#t.announcement?.(n,i,s.length,e,t))??(t?"Cancelled. Restored the original order.":e?`${n}, position ${i} of ${s.length}. ${q}`:`${n}, dropped at position ${i} of ${s.length}.`);}#m(e,t,n){const s=this.#t.values,i=s.indexOf(e),o=Math.max(0,Math.min(s.length-1,t)),a=s.slice();return this.#p||i<0||i===o||new Set(s).size!==s.length?!1:(a.splice(i,1),a.splice(o,0,e),l(()=>this.#t.onReorder(a,n)),!0);}#w(e){this.#h(),this.#e=e,this.#r=this.#t.values.slice(),this.#E(),this.#a(!0);}#E(){for(const e of this.#L()){const t=e.dataset.cwListValue===this.#e;e.classList.toggle("cw-ReorderableList-moving",t),e.classList.toggle(B,t),e.querySelector("[data-cw-reorder-handle]")?.setAttribute("aria-pressed",t?"true":"false");}}#y(e){const t=this.styleElement,n=this.#L(),s=n.indexOf(e),i=t.ownerDocument.defaultView,o=Number.parseFloat(i?.getComputedStyle(t).rowGap??"")||0,a=t.getBoundingClientRect().top,u=n.map(d=>d.getBoundingClientRect()),h=u[s],O=n.filter(d=>d!==e),S=u.filter((d,X)=>X!==s),b={row:e,from:s,others:O,centers:S.map(d=>d.top+d.height/2),extents:S.map(d=>d.height+o),extent:h.height+o,center:h.top+h.height/2,start:h.top-a,size:h.height,pointerStart:this.#d,insertion:s,offset:0};return t.classList.add("cw-ReorderableList-dragging"),t.style.setProperty("--cw-reorder-shift",`${b.extent}px`),this.#R(b),b;}#R(e){const t=this.styleElement;let n=e.start;for(let s=e.from;s<e.insertion;s++)n+=e.extents[s];for(let s=e.insertion;s<e.from;s++)n-=e.extents[s];t?.style.setProperty("--cw-reorder-slot-start",`${n}px`),t?.style.setProperty("--cw-reorder-slot-size",`${e.size}px`);}#f(e,t){const n=e.center+t-e.pointerStart,s=e.insertion;let i=0;for(;i<e.centers.length&&e.centers[i]<n;)i++;if(e.offset=t-e.pointerStart,e.row.style.setProperty(p,`${e.offset}px`),i!==s){e.insertion=i;for(let o=Math.min(s,i);o<Math.max(s,i);o++){const a=e.others[o],u=o>=e.from&&o<i,h=o<e.from&&o>=i;a.classList.toggle("cw-ReorderableList-shiftedUp",u),a.classList.toggle("cw-ReorderableList-shiftedDown",h);}this.#R(e);}}#x(e){const t=this.styleElement;t?.classList.remove("cw-ReorderableList-dragging");for(const n of e.others)n.classList.remove("cw-ReorderableList-shiftedUp","cw-ReorderableList-shiftedDown");t?.style.removeProperty("--cw-reorder-shift"),t?.style.removeProperty("--cw-reorder-slot-start"),t?.style.removeProperty("--cw-reorder-slot-size");}#c(e,t,n){const s=Number.parseFloat(e.style.getPropertyValue(p))||0,i=t-(e.getBoundingClientRect().top-s);this.#o?.cancel(),e.classList.add("cw-ReorderableList-settling"),e.style.setProperty(p,`${i}px`);const o=T(e,p,i,0,{role:"spatial",speed:"fast",unit:"px",velocity:n});this.#o=o,o.finished.then(()=>{e.classList.remove("cw-ReorderableList-settling"),e.style.removeProperty(p);},()=>{e.classList.remove("cw-ReorderableList-settling"),e.style.removeProperty(p);});}#h(){const e=this.#n,t=this.#u;if(this.#n=void 0,e!==void 0&&t!==void 0)try{this.#l?.releasePointerCapture(e);}catch{}t!==void 0&&this.#x(t),this.#u=void 0,this.#e=void 0,this.#r=void 0,this.#l=null,this.#E();}#P=e=>{const t=this.#b(e.target);e.defaultPrevented||t===void 0||this.#t.disabled===!0||m(e,this.styleElement,()=>{if(!(this.#p||this.#t.disabled===!0)){if(this.#e!==t){this.#w(t);return;}this.#a(!1),this.#h();}},!1);};#C=e=>{const t=this.#e;this.#t.disabled===!0||t===void 0||this.#b(e.target)!==t||!Y.includes(e.key)||m(e,this.styleElement,()=>{const n=this.#t.values,s=n.indexOf(t);if(this.#e===t){if(e.key==="Escape"){this.#r!==void 0&&l(()=>this.#t.onReorder(this.#r,e)),this.#a(!1,!0),this.#h();return;}this.#m(t,e.key==="Home"?0:e.key==="End"?n.length-1:s+(e.key==="ArrowDown"?1:-1),e),queueMicrotask(()=>{this.#v(t)?.querySelector("[data-cw-reorder-handle]")?.focus(),this.#E(),this.#a(this.#e===t);});}});};#I=e=>{const t=this.#b(e.target);this.#t.disabled===!0||this.#n!==void 0||!e.isPrimary||e.button!==0||t===void 0||!c(e.target)||(this.#e!==t&&(this.#h(),this.#e=t),this.#n=e.pointerId,this.#l=e.target.closest("[data-cw-reorder-handle]"),this.#d=e.clientY,this.#i.reset(),this.#i.track(e,n=>n.clientY));};#D=e=>{const t=this.#e,n=t===void 0?void 0:this.#v(t);if(!(e.pointerId!==this.#n||this.#l===null||n===void 0)){if(this.#i.track(e,s=>s.clientY),this.#u===void 0){if(Math.abs(e.clientY-this.#d)<E)return;try{this.#l.setPointerCapture(e.pointerId);}catch{this.#h();return;}this.#o?.cancel(),this.#E(),this.#u=this.#y(n);}this.#f(this.#u,e.clientY);}};#T=e=>{const t=this.#u,n=this.#e,s=this.#l,i=u=>{u.preventDefault(),u.stopImmediatePropagation();};if(e.pointerId!==this.#n)return;if(t===void 0||n===void 0){this.#n=void 0,this.#l=null,t===void 0&&this.#r===void 0&&(this.#e=void 0);return;}const o=t.row.getBoundingClientRect().top,a=this.#i.release(e);this.#x(t),this.#u=void 0,this.#m(n,t.insertion,e),this.#a(!1),this.#h(),this.#c(t.row,o,a),s?.addEventListener("click",i,{capture:!0,once:!0}),s?.ownerDocument.defaultView?.setTimeout(()=>s.removeEventListener("click",i,!0),0);};#S=e=>{const t=this.#u;if(e.pointerId!==this.#n)return;if(t===void 0){this.#h();return;}const n=t.row.getBoundingClientRect().top;this.#h(),this.#c(t.row,n,0);};#g(e,t){const n=t?"addEventListener":"removeEventListener";e?.[n]("click",this.#P),e?.[n]("keydown",this.#C),e?.[n]("pointerdown",this.#I),e?.[n]("pointermove",this.#D),e?.[n]("pointerup",this.#T),e?.[n]("pointercancel",this.#S),e?.[n]("lostpointercapture",this.#S);}applyComponentProps(){const e=this.#t.disabled===!0,t=this.#t.values;super.applyComponentProps(),super.setClass("cw-ReorderableList",!0),super.setAttribute("aria-disabled",e?"true":void 0),(e||this.#e!==void 0&&!t.includes(this.#e))&&l(()=>this.#h());}onStyleElementChanged(e){this.#h(),this.#g(super.styleElement,!1),super.onStyleElementChanged(e),this.#g(e,!0);}render(e){const t=<div aria-atomic="true"aria-live="polite"class="cw-ReorderableList-status"role="status"/>,n=<ul class="cw-List cw-ReorderableList"data-cw-list-selection-mode="none"role="list"/>;return this.#s=t,D(n,e),[t,n];}}const ne=/* @__PURE__ */f(()=>ee,()=>te),ye=r=>{const e=C({variant:"standard"},x(r,["children"]));return ne(e);};export{Le as ExpandedListItem,K as ExpandedListItemController,ve as ReorderHandle,ye as ReorderableList,te as ReorderableListController,ge as RevealListItem,W as RevealListItemController};
@@ -1,4 +1,4 @@
1
- import{createComponent as L,createContext as w,onCleanup as b,onMount as M,untrack as d,useContext as x}from"solid-js";import{insert as V}from"solid-js/web";import{defineDomComponent as E}from"..";import{DomController as A}from"../dom/client";import{FocusState as H,HoverState as k,PressState as D}from"../state";import{InteractableController as P}from"../state/controller";import{deferAfterDelegatedCancellation as p}from"../util";import{hasNestedInteractive as v,isElementNode as m}from"./interactive";import{resolveSurfaceSlots as B}from"./slots";import"./surface.css";import"./list.css";const S={option:!1,selected:!1,valueless:!1,focusStop:!1},J=H|k|D,X=["aria-disabled","class","data-cw-list-value","hidden","inert","style"],O=["hidden","inert"],y=w(),u=new WeakMap;function C(s){return d(()=>{const e=s.overline!==void 0,t=s.supportingContent!==void 0||s.supportingText!==void 0;return s.lines!==void 0?s.lines:e&&t?3:e||t?2:1})}function I(s){return`_cw-ListItem-leading-${s}`}function c(s){if(s.closest("[hidden], [inert]")!==null||s.getClientRects().length===0||s.ownerDocument.defaultView?.getComputedStyle(s).visibility!=="visible")return!1;for(let e=s.closest("fieldset[disabled]");e!==null;e=e.parentElement?.closest("fieldset[disabled]")??null)if(e.querySelector(":scope > legend")?.contains(s)!==!0)return!1;return!0}function R(s,e){return s.option===e.option&&s.selected===e.selected&&s.valueless===e.valueless&&s.focusStop===e.focusStop}function N(s,e){const t=e.selectionMode??"none";return<ul{...s}aria-multiselectable={t==="multiple"?"true":void 0}classList={{...s.classList,"cw-List":!0,"cw-List-dense":e.dense===!0}}data-cw-list-selection-mode={t}data-cw-list-variant={e.variant??"baseline"}role={t==="none"?"list":"listbox"}>{s.children}</ul>}class _ extends A{#s;#d;#e;#l;#n;#r;#t;#i;#u;#o;#c;#a;constructor(e){super(e,{styleElementIsFunction:!0}),this.#s="selectedValue"in e,this.#d="selectedValues"in e,this.#e="none",this.#l=d(()=>"selectedValue"in e?e.selectedValue:e.defaultSelectedValue),this.#n=d(()=>new Set(e.selectedValues??[])),this.#r=d(()=>this.#s||e.defaultSelectedValue!==void 0),this.#t=void 0,this.#i=!1,this.#u=new WeakMap,this.#o=void 0,this.#c=!1,this.#a=0,M(()=>this.#f()),b(()=>{this.#a++,this.#o?.disconnect(),this.#m(this.styleElement,!1)})}#g(){const e=this.styleElement;return e===null?[]:Array.from(e.children).filter(t=>t.hasAttribute("data-cw-list-item"))}#L(e){return e!==void 0&&(this.#e==="single"?this.#l===e:this.#e==="multiple"&&this.#n.has(e))}#b(e){const t=u.get(e);return t===void 0||t.disabled()||this.#e!=="none"&&t.value()===void 0}#S(e){if(!(this.#r||this.#e==="none")){this.#r=!0;for(const t of e){const n=u.get(t),i=n?.value();i===void 0||n?.initiallySelected()!==!0||(this.#e==="single"&&!this.#s?this.#l??=i:this.#e==="multiple"&&!this.#d&&this.#n.add(i))}}}#y(e){const t=this.#t,n=e.find(l=>this.#L(u.get(l)?.value())),i=l=>!this.#b(l)&&c(l);let o;return t!==void 0&&e.includes(t)&&!this.#i&&c(t)?t:(o=n!==void 0&&i(n)?n:e.find(i),this.#i=o===void 0,o??=e.find(c),this.#i&&=o!==void 0,o)}#f(){const e=this.styleElement,t=this.#g(),n=this.#e!=="none",i=e?.ownerDocument.activeElement,o=this.#t;if(e?.isConnected===!0){this.#c||this.#C(e,t),this.#S(t);for(const l of t){const a=u.get(l)?.value();this.#h(l,n?{option:n,selected:this.#L(a),valueless:a===void 0,focusStop:l===o}:S)}if(this.#t=n?this.#y(t):void 0,this.#t!==o)for(const l of[o,this.#t]){const a=l===void 0?void 0:this.#u.get(l);l!==void 0&&a!==void 0&&t.includes(l)&&this.#h(l,{...a,focusStop:l===this.#t})}n&&m(i)&&t.includes(i)&&i!==this.#t&&!c(i)&&this.#t?.focus(),this.#o?.takeRecords()}}#h(e,t){const n=this.#u.get(e);n!==void 0&&R(n,t)||(this.#u.set(e,t),u.get(e)?.update(t))}#E(e){const t=this.#t,n=t===void 0?void 0:this.#u.get(t),i=this.#u.get(e);e===t||i?.option!==!0||(this.#t=e,this.#i=!1,t!==void 0&&n!==void 0&&this.#h(t,{...n,focusStop:!1}),this.#h(e,{...i,focusStop:!0}),this.#o?.takeRecords())}#C(e,t){const n=e.ownerDocument.defaultView?.MutationObserver,i={attributeFilter:O,attributes:!0},o={attributeFilter:X,attributes:!0};if(n!==void 0){this.#o??=new n(this.#I),this.#o.disconnect(),this.#o.observe(e,{...i,childList:!0});for(const l of t)this.#o.observe(l,o);for(let l=e.parentElement;l!==null;l=l.parentElement)this.#o.observe(l,i);this.#c=!0}}#I=e=>{const t=this.styleElement,n=this.#t;let i=!1,o=!1;for(const l of e){const a=l.target;l.type==="childList"&&(this.#c=!1),l.type==="childList"||a===t||a.contains(t)||l.attributeName==="data-cw-list-value"||l.attributeName==="aria-disabled"?i=!0:(a===n||n===void 0||this.#i)&&(o=!0)}(i||o&&this.#e!=="none"&&(n===void 0||this.#i||!c(n)))&&this.#f()};#v(e,t){const n=u.get(e),i=n?.value();let o;if(!(this.#e==="none"||n===void 0||i===void 0||this.#b(e))){if(this.#e==="multiple")o=!this.#n.has(i),!this.#d&&o?this.#n.add(i):this.#d||this.#n.delete(i);else{if(this.#l===i)return;o=!0,this.#s||(this.#l=i)}this.#f(),d(()=>{const l=this.props.onSelectionChange,a=this.props.onChange;n.notifySelection(o,t),l?.(i,o,t),a!==l&&a?.(i,o,t)})}}#p(e){const n=(m(e.target)?e.target:null)?.closest("[data-cw-list-item]")??null;return n!==null&&n.parentElement===this.styleElement?n:void 0}#T=e=>{const t=this.#p(e),n=this.styleElement,i=this.#a;t===void 0||e.defaultPrevented||!m(e.target)||e.target.closest(".cw-ListItem-action")===null&&v(e.target,t,e.composedPath())||p(e,n,()=>{!e.defaultPrevented&&this.#a===i&&t.parentElement===this.styleElement&&this.#v(t,e)},!1)};#w=e=>{const t=this.#p(e);t!==void 0&&e.target===t&&this.#E(t)};#M=e=>{const t=this.#p(e),n=this.#g(),i=this.styleElement,o=this.#a,l=t===void 0?-1:n.indexOf(t),a=e.key==="ArrowDown"||e.key==="ArrowRight"?1:e.key==="ArrowUp"||e.key==="ArrowLeft"?-1:0;let r;if(t===void 0||e.target!==t||this.#e==="none"||l<0)return;if((e.key==="Enter"||e.key===" ")&&!e.repeat){p(e,i,()=>{this.#a===o&&t.parentElement===this.styleElement&&this.#v(t,e)});return}if(e.key==="Home"||e.key==="End")r=(e.key==="Home"?n:n.slice().reverse()).find(c);else if(a!==0)for(let h=1;h<n.length&&r===void 0;h++){const g=n[(l+(a+n.length)*h)%n.length];c(g)&&(r=g)}if(r===void 0)return;const f=r;p(e,i,()=>{this.#a!==o||f.parentElement!==this.styleElement||(this.#E(f),f.focus())})};#m(e,t){const n=t?"addEventListener":"removeEventListener";e?.[n]("click",this.#T),e?.[n]("focusin",this.#w),e?.[n]("keydown",this.#M)}applyComponentProps(){const e=super.readProps(["dense","selectedValue","selectedValues","selectionMode","variant"]);e.variantChanged&&super.setAttribute("data-cw-list-variant",e.variant??"baseline"),e.denseChanged&&super.setClass("cw-List-dense",e.dense===!0),e.selectionModeChanged&&(this.#e=e.selectionMode??"none",super.setAttribute("aria-multiselectable",this.#e==="multiple"?"true":void 0),super.setAttribute("data-cw-list-selection-mode",this.#e),super.setAttribute("role",this.#e==="none"?"list":"listbox")),e.selectedValueChanged&&this.#s&&(this.#l=e.selectedValue),e.selectedValuesChanged&&this.#d&&(this.#n=new Set(e.selectedValues??[])),(e.selectionModeChanged||e.selectedValueChanged||e.selectedValuesChanged)&&this.#f()}onStyleElementChanged(e){this.#a++,this.#o?.disconnect(),this.#c=!1,this.#t=void 0,this.#i=!1,this.#m(super.styleElement,!1),super.onStyleElementChanged(e),this.#m(e,!0)}render(e){const t=<ul class="cw-List"/>;return V(t,e),t}}const F=E(()=>N,()=>_),se=s=>L(y.Provider,{value:d(()=>({mode:s.selectionMode??"none",selectedValue:"selectedValue"in s?s.selectedValue:s.defaultSelectedValue,selectedValueKnown:"selectedValue"in s||s.defaultSelectedValue!==void 0,selectedValues:s.selectedValues,focusStopAssigned:!1})),get children(){return L(F,s)}});function K(s,e,t,n){const i=d(()=>s.onActivate!==void 0),o=d(()=>s.overline===void 0),l=d(()=>s.supportingContent===void 0&&s.supportingText===void 0),a=<>
1
+ import{createComponent as L,createContext as w,onCleanup as b,onMount as M,untrack as d,useContext as x}from"solid-js";import{insert as V}from"solid-js/web";import{defineDomComponent as E}from"..";import{DomController as A}from"../dom/client";import{FocusState as H,HoverState as k,PressState as D}from"../state";import{InteractableController as P}from"../state/controller";import{deferAfterDelegatedCancellation as p}from"../util";import{hasNestedInteractive as v,isElementNode as m}from"./interactive";import{resolveSurfaceSlots as B}from"./slots";import"./surface.css";import"./list.css";const S={option:!1,selected:!1,valueless:!1,focusStop:!1},J=H|k|D,X=["aria-disabled","class","data-cw-list-value","hidden","inert","style"],O=["hidden","inert"],y=w(),u=/* @__PURE__ */new WeakMap();function C(s){return d(()=>{const e=s.overline!==void 0,t=s.supportingContent!==void 0||s.supportingText!==void 0;return s.lines!==void 0?s.lines:e&&t?3:e||t?2:1;});}function I(s){return`_cw-ListItem-leading-${s}`;}function c(s){if(s.closest("[hidden], [inert]")!==null||s.getClientRects().length===0||s.ownerDocument.defaultView?.getComputedStyle(s).visibility!=="visible")return!1;for(let e=s.closest("fieldset[disabled]");e!==null;e=e.parentElement?.closest("fieldset[disabled]")??null)if(e.querySelector(":scope > legend")?.contains(s)!==!0)return!1;return!0;}function R(s,e){return s.option===e.option&&s.selected===e.selected&&s.valueless===e.valueless&&s.focusStop===e.focusStop;}function N(s,e){const t=e.selectionMode??"none";return<ul{...s}aria-multiselectable={t==="multiple"?"true":void 0}classList={{...s.classList,"cw-List":!0,"cw-List-dense":e.dense===!0}}data-cw-list-selection-mode={t}data-cw-list-variant={e.variant??"baseline"}role={t==="none"?"list":"listbox"}>{s.children}</ul>;}class _ extends A{#s;#d;#e;#l;#n;#r;#t;#i;#u;#o;#c;#a;constructor(e){super(e,{styleElementIsFunction:!0}),this.#s="selectedValue"in e,this.#d="selectedValues"in e,this.#e="none",this.#l=d(()=>"selectedValue"in e?e.selectedValue:e.defaultSelectedValue),this.#n=d(()=>new Set(e.selectedValues??[])),this.#r=d(()=>this.#s||e.defaultSelectedValue!==void 0),this.#t=void 0,this.#i=!1,this.#u=/* @__PURE__ */new WeakMap(),this.#o=void 0,this.#c=!1,this.#a=0,M(()=>this.#f()),b(()=>{this.#a++,this.#o?.disconnect(),this.#m(this.styleElement,!1);});}#g(){const e=this.styleElement;return e===null?[]:Array.from(e.children).filter(t=>t.hasAttribute("data-cw-list-item"));}#L(e){return e!==void 0&&(this.#e==="single"?this.#l===e:this.#e==="multiple"&&this.#n.has(e));}#b(e){const t=u.get(e);return t===void 0||t.disabled()||this.#e!=="none"&&t.value()===void 0;}#S(e){if(!(this.#r||this.#e==="none")){this.#r=!0;for(const t of e){const n=u.get(t),i=n?.value();i===void 0||n?.initiallySelected()!==!0||(this.#e==="single"&&!this.#s?this.#l??=i:this.#e==="multiple"&&!this.#d&&this.#n.add(i));}}}#y(e){const t=this.#t,n=e.find(l=>this.#L(u.get(l)?.value())),i=l=>!this.#b(l)&&c(l);let o;return t!==void 0&&e.includes(t)&&!this.#i&&c(t)?t:(o=n!==void 0&&i(n)?n:e.find(i),this.#i=o===void 0,o??=e.find(c),this.#i&&=o!==void 0,o);}#f(){const e=this.styleElement,t=this.#g(),n=this.#e!=="none",i=e?.ownerDocument.activeElement,o=this.#t;if(e?.isConnected===!0){this.#c||this.#C(e,t),this.#S(t);for(const l of t){const a=u.get(l)?.value();this.#h(l,n?{option:n,selected:this.#L(a),valueless:a===void 0,focusStop:l===o}:S);}if(this.#t=n?this.#y(t):void 0,this.#t!==o)for(const l of[o,this.#t]){const a=l===void 0?void 0:this.#u.get(l);l!==void 0&&a!==void 0&&t.includes(l)&&this.#h(l,{...a,focusStop:l===this.#t});}n&&m(i)&&t.includes(i)&&i!==this.#t&&!c(i)&&this.#t?.focus(),this.#o?.takeRecords();}}#h(e,t){const n=this.#u.get(e);n!==void 0&&R(n,t)||(this.#u.set(e,t),u.get(e)?.update(t));}#E(e){const t=this.#t,n=t===void 0?void 0:this.#u.get(t),i=this.#u.get(e);e===t||i?.option!==!0||(this.#t=e,this.#i=!1,t!==void 0&&n!==void 0&&this.#h(t,{...n,focusStop:!1}),this.#h(e,{...i,focusStop:!0}),this.#o?.takeRecords());}#C(e,t){const n=e.ownerDocument.defaultView?.MutationObserver,i={attributeFilter:O,attributes:!0},o={attributeFilter:X,attributes:!0};if(n!==void 0){this.#o??=new n(this.#I),this.#o.disconnect(),this.#o.observe(e,{...i,childList:!0});for(const l of t)this.#o.observe(l,o);for(let l=e.parentElement;l!==null;l=l.parentElement)this.#o.observe(l,i);this.#c=!0;}}#I=e=>{const t=this.styleElement,n=this.#t;let i=!1,o=!1;for(const l of e){const a=l.target;l.type==="childList"&&(this.#c=!1),l.type==="childList"||a===t||a.contains(t)||l.attributeName==="data-cw-list-value"||l.attributeName==="aria-disabled"?i=!0:(a===n||n===void 0||this.#i)&&(o=!0);}(i||o&&this.#e!=="none"&&(n===void 0||this.#i||!c(n)))&&this.#f();};#v(e,t){const n=u.get(e),i=n?.value();let o;if(!(this.#e==="none"||n===void 0||i===void 0||this.#b(e))){if(this.#e==="multiple")o=!this.#n.has(i),!this.#d&&o?this.#n.add(i):this.#d||this.#n.delete(i);else{if(this.#l===i)return;o=!0,this.#s||(this.#l=i);}this.#f(),d(()=>{const l=this.props.onSelectionChange,a=this.props.onChange;n.notifySelection(o,t),l?.(i,o,t),a!==l&&a?.(i,o,t);});}}#p(e){const n=(m(e.target)?e.target:null)?.closest("[data-cw-list-item]")??null;return n!==null&&n.parentElement===this.styleElement?n:void 0;}#T=e=>{const t=this.#p(e),n=this.styleElement,i=this.#a;t===void 0||e.defaultPrevented||!m(e.target)||e.target.closest(".cw-ListItem-action")===null&&v(e.target,t,e.composedPath())||p(e,n,()=>{!e.defaultPrevented&&this.#a===i&&t.parentElement===this.styleElement&&this.#v(t,e);},!1);};#w=e=>{const t=this.#p(e);t!==void 0&&e.target===t&&this.#E(t);};#M=e=>{const t=this.#p(e),n=this.#g(),i=this.styleElement,o=this.#a,l=t===void 0?-1:n.indexOf(t),a=e.key==="ArrowDown"||e.key==="ArrowRight"?1:e.key==="ArrowUp"||e.key==="ArrowLeft"?-1:0;let r;if(t===void 0||e.target!==t||this.#e==="none"||l<0)return;if((e.key==="Enter"||e.key===" ")&&!e.repeat){p(e,i,()=>{this.#a===o&&t.parentElement===this.styleElement&&this.#v(t,e);});return;}if(e.key==="Home"||e.key==="End")r=(e.key==="Home"?n:n.slice().reverse()).find(c);else if(a!==0)for(let h=1;h<n.length&&r===void 0;h++){const g=n[(l+(a+n.length)*h)%n.length];c(g)&&(r=g);}if(r===void 0)return;const f=r;p(e,i,()=>{this.#a!==o||f.parentElement!==this.styleElement||(this.#E(f),f.focus());});};#m(e,t){const n=t?"addEventListener":"removeEventListener";e?.[n]("click",this.#T),e?.[n]("focusin",this.#w),e?.[n]("keydown",this.#M);}applyComponentProps(){const e=super.readProps(["dense","selectedValue","selectedValues","selectionMode","variant"]);e.variantChanged&&super.setAttribute("data-cw-list-variant",e.variant??"baseline"),e.denseChanged&&super.setClass("cw-List-dense",e.dense===!0),e.selectionModeChanged&&(this.#e=e.selectionMode??"none",super.setAttribute("aria-multiselectable",this.#e==="multiple"?"true":void 0),super.setAttribute("data-cw-list-selection-mode",this.#e),super.setAttribute("role",this.#e==="none"?"list":"listbox")),e.selectedValueChanged&&this.#s&&(this.#l=e.selectedValue),e.selectedValuesChanged&&this.#d&&(this.#n=new Set(e.selectedValues??[])),(e.selectionModeChanged||e.selectedValueChanged||e.selectedValuesChanged)&&this.#f();}onStyleElementChanged(e){this.#a++,this.#o?.disconnect(),this.#c=!1,this.#t=void 0,this.#i=!1,this.#m(super.styleElement,!1),super.onStyleElementChanged(e),this.#m(e,!0);}render(e){const t=<ul class="cw-List"/>;return V(t,e),t;}}const F=/* @__PURE__ */E(()=>N,()=>_),se=s=>L(y.Provider,{value:d(()=>({mode:s.selectionMode??"none",selectedValue:"selectedValue"in s?s.selectedValue:s.defaultSelectedValue,selectedValueKnown:"selectedValue"in s||s.defaultSelectedValue!==void 0,selectedValues:s.selectedValues,focusStopAssigned:!1})),get children(){return L(F,s);}});function K(s,e,t,n){const i=d(()=>s.onActivate!==void 0),o=d(()=>s.overline===void 0),l=d(()=>s.supportingContent===void 0&&s.supportingText===void 0),a=<>
2
2
  <span class="cw-ListItem-overline"hidden={o}>{s.overline}</span>
3
3
  <span class="cw-ListItem-headline">{s.headline??e}</span>
4
4
  <span class="cw-ListItem-supporting"hidden={l}>{s.supportingContent??s.supportingText}</span>
@@ -6,4 +6,4 @@ import{createComponent as L,createContext as w,onCleanup as b,onMount as M,untra
6
6
  <span class="cw-ListItem-leading">{s.leading??s.leadingContent}</span>
7
7
  {i?<button class="cw-ListItem-action cw-ListItem-content"disabled={n}tabIndex={t?-1:void 0}type="button">{a}</button>:<span class="cw-ListItem-content">{a}</span>}
8
8
  <span class="cw-ListItem-trailing">{s.trailing??s.trailingContent}</span>
9
- </span>}function T(s,e){const t=x(y),n=t?.mode==="single"||t?.mode==="multiple",i=e.value,o=e.disabled===!0||n&&i===void 0,l=("selected"in e?e.selected:e.defaultSelected)===!0,a=t?.mode==="single"?t.selectedValueKnown:t?.selectedValues!==void 0,r=n&&(a?t.mode==="single"?i===t.selectedValue:i!==void 0&&t.selectedValues?.includes(i)===!0:l),f=n&&!o&&!t.focusStopAssigned&&(r||!a),h=C(e);return f&&(t.focusStopAssigned=!0),<li{...s}aria-disabled={o?"true":void 0}aria-selected={n?r?"true":"false":void 0}classList={{...s.classList,"cw-ListItem":!0,"cw-ListItem-disabled":o,"cw-ListItem-selectable":n,"cw-ListItem-selected":n&&r,[I(e.leadingType)]:e.leadingType!==void 0,[`_cw-ListItem-lines-${h}`]:!0}}data-cw-list-item="true"data-cw-list-lines={h.toString()}data-cw-list-value={i}role={n?"option":void 0}tabIndex={n?f?0:-1:e.onActivate!==void 0?void 0:e.tabIndex}>{K(e,s.children,n,o)}</li>}class U extends P{#s;#d;#e;#l;#n;constructor(e){super(e,{baseInteractionCssClassName:"cw-ListItem",styleElementIsFunction:!0}),this.#s=d(()=>e.onActivate!==void 0),this.#d={value:()=>d(()=>this.props.value),initiallySelected:()=>d(()=>("selected"in this.props?this.props.selected:this.props.defaultSelected)===!0),disabled:()=>d(()=>this.props.disabled===!0),update:t=>{this.#e=t,this.#r()},notifySelection:(t,n)=>d(()=>this.props.onSelectedChange?.(t,n))},this.#e=S,this.#l=null,this.#n=!1,b(()=>this.#n=!0)}#r(){const e=this.#e,t=d(()=>this.props.disabled===!0)||e.valueless,n=this.#l;super.setAttribute("role",e.option?"option":void 0),super.setAttribute("aria-selected",e.option?`${e.selected}`:void 0),super.setAttribute("aria-disabled",t?"true":void 0),super.setAttribute("tabindex",e.option?e.focusStop?0:-1:this.#s?void 0:d(()=>this.props.tabIndex)),super.setClass("cw-ListItem-disabled",t),super.setClass("cw-ListItem-selectable",e.option),super.setClass("cw-ListItem-selected",e.option&&e.selected),super.setEnabledInteractionStates(!t&&(e.option||this.#s)?J:0),n!==null&&(n.disabled=t,e.option?n.tabIndex=-1:n.removeAttribute("tabindex"))}#t=e=>{const t=this.styleElement;!this.#s||t===null||d(()=>this.props.disabled===!0)||!m(e.target)||e.target.closest("[data-cw-list-item]")!==t||e.target.closest(".cw-ListItem-action")===null&&v(e.target,t,e.composedPath())||p(e,t,()=>{!this.#n&&this.styleElement===t&&d(()=>this.props.disabled!==!0)&&d(()=>this.props.onActivate?.(e))},!1)};#i=e=>{const t=this.styleElement;e.defaultPrevented||!this.#s||e.target!==t||e.repeat||e.key!=="Enter"&&e.key!==" "||d(()=>this.props.disabled===!0)||p(e,t,()=>{!this.#n&&this.styleElement===t&&d(()=>this.props.disabled!==!0)&&d(()=>this.props.onActivate?.(e))},!this.#e.option)};applyComponentProps(){const e=super.readProps(["disabled","leadingType","lines","overline","supportingContent","supportingText","tabIndex","value"]),t=this.styleElement;if(e.leadingTypeChanged&&super.setClass("leadingType",e.leadingType===void 0?void 0:I(e.leadingType)),e.linesChanged||e.overlineChanged||e.supportingContentChanged||e.supportingTextChanged){const n=C(e);super.setClass("lines",`_cw-ListItem-lines-${n}`),super.setAttribute("data-cw-list-lines",n.toString()),t?.querySelector(":scope .cw-ListItem-overline")?.toggleAttribute("hidden",e.overline===void 0),t?.querySelector(":scope .cw-ListItem-supporting")?.toggleAttribute("hidden",e.supportingContent===void 0&&e.supportingText===void 0)}e.valueChanged&&super.setAttribute("data-cw-list-value",e.value),(e.disabledChanged||e.tabIndexChanged)&&this.#r()}onStyleElementChanged(e){const t=super.styleElement;t!==null&&(u.delete(t),t.removeEventListener("click",this.#t),t.removeEventListener("keydown",this.#i)),super.onStyleElementChanged(e),this.#l=e?.querySelector(".cw-ListItem-action")??null,e!==null&&(u.set(e,this.#d),e.addEventListener("click",this.#t),e.addEventListener("keydown",this.#i))}render(e){const t=this.props;return d(()=>T({children:e},{..."selected"in t?{selected:t.selected}:{},defaultSelected:t.defaultSelected,disabled:t.disabled,get headline(){return t.headline},get leading(){return t.leading},get leadingContent(){return t.leadingContent},leadingType:t.leadingType,lines:t.lines,onActivate:t.onActivate,get overline(){return t.overline},get supportingContent(){return t.supportingContent},get supportingText(){return t.supportingText},tabIndex:t.tabIndex,get trailing(){return t.trailing},get trailingContent(){return t.trailingContent},value:t.value}))}}const q=E(()=>T,()=>U),ie=s=>q(B(s,["children","headline","leading","leadingContent","overline","supportingContent","supportingText","trailing","trailingContent"]));export{se as List,_ as ListController,ie as ListItem,U as ListItemController};
9
+ </span>;}function T(s,e){const t=x(y),n=t?.mode==="single"||t?.mode==="multiple",i=e.value,o=e.disabled===!0||n&&i===void 0,l=("selected"in e?e.selected:e.defaultSelected)===!0,a=t?.mode==="single"?t.selectedValueKnown:t?.selectedValues!==void 0,r=n&&(a?t.mode==="single"?i===t.selectedValue:i!==void 0&&t.selectedValues?.includes(i)===!0:l),f=n&&!o&&!t.focusStopAssigned&&(r||!a),h=C(e);return f&&(t.focusStopAssigned=!0),<li{...s}aria-disabled={o?"true":void 0}aria-selected={n?r?"true":"false":void 0}classList={{...s.classList,"cw-ListItem":!0,"cw-ListItem-disabled":o,"cw-ListItem-selectable":n,"cw-ListItem-selected":n&&r,[I(e.leadingType)]:e.leadingType!==void 0,[`_cw-ListItem-lines-${h}`]:!0}}data-cw-list-item="true"data-cw-list-lines={h.toString()}data-cw-list-value={i}role={n?"option":void 0}tabIndex={n?f?0:-1:e.onActivate!==void 0?void 0:e.tabIndex}>{K(e,s.children,n,o)}</li>;}class U extends P{#s;#d;#e;#l;#n;constructor(e){super(e,{baseInteractionCssClassName:"cw-ListItem",styleElementIsFunction:!0}),this.#s=d(()=>e.onActivate!==void 0),this.#d={value:()=>d(()=>this.props.value),initiallySelected:()=>d(()=>("selected"in this.props?this.props.selected:this.props.defaultSelected)===!0),disabled:()=>d(()=>this.props.disabled===!0),update:t=>{this.#e=t,this.#r();},notifySelection:(t,n)=>d(()=>this.props.onSelectedChange?.(t,n))},this.#e=S,this.#l=null,this.#n=!1,b(()=>this.#n=!0);}#r(){const e=this.#e,t=d(()=>this.props.disabled===!0)||e.valueless,n=this.#l;super.setAttribute("role",e.option?"option":void 0),super.setAttribute("aria-selected",e.option?`${e.selected}`:void 0),super.setAttribute("aria-disabled",t?"true":void 0),super.setAttribute("tabindex",e.option?e.focusStop?0:-1:this.#s?void 0:d(()=>this.props.tabIndex)),super.setClass("cw-ListItem-disabled",t),super.setClass("cw-ListItem-selectable",e.option),super.setClass("cw-ListItem-selected",e.option&&e.selected),super.setEnabledInteractionStates(!t&&(e.option||this.#s)?J:0),n!==null&&(n.disabled=t,e.option?n.tabIndex=-1:n.removeAttribute("tabindex"));}#t=e=>{const t=this.styleElement;!this.#s||t===null||d(()=>this.props.disabled===!0)||!m(e.target)||e.target.closest("[data-cw-list-item]")!==t||e.target.closest(".cw-ListItem-action")===null&&v(e.target,t,e.composedPath())||p(e,t,()=>{!this.#n&&this.styleElement===t&&d(()=>this.props.disabled!==!0)&&d(()=>this.props.onActivate?.(e));},!1);};#i=e=>{const t=this.styleElement;e.defaultPrevented||!this.#s||e.target!==t||e.repeat||e.key!=="Enter"&&e.key!==" "||d(()=>this.props.disabled===!0)||p(e,t,()=>{!this.#n&&this.styleElement===t&&d(()=>this.props.disabled!==!0)&&d(()=>this.props.onActivate?.(e));},!this.#e.option);};applyComponentProps(){const e=super.readProps(["disabled","leadingType","lines","overline","supportingContent","supportingText","tabIndex","value"]),t=this.styleElement;if(e.leadingTypeChanged&&super.setClass("leadingType",e.leadingType===void 0?void 0:I(e.leadingType)),e.linesChanged||e.overlineChanged||e.supportingContentChanged||e.supportingTextChanged){const n=C(e);super.setClass("lines",`_cw-ListItem-lines-${n}`),super.setAttribute("data-cw-list-lines",n.toString()),t?.querySelector(":scope .cw-ListItem-overline")?.toggleAttribute("hidden",e.overline===void 0),t?.querySelector(":scope .cw-ListItem-supporting")?.toggleAttribute("hidden",e.supportingContent===void 0&&e.supportingText===void 0);}e.valueChanged&&super.setAttribute("data-cw-list-value",e.value),(e.disabledChanged||e.tabIndexChanged)&&this.#r();}onStyleElementChanged(e){const t=super.styleElement;t!==null&&(u.delete(t),t.removeEventListener("click",this.#t),t.removeEventListener("keydown",this.#i)),super.onStyleElementChanged(e),this.#l=e?.querySelector(".cw-ListItem-action")??null,e!==null&&(u.set(e,this.#d),e.addEventListener("click",this.#t),e.addEventListener("keydown",this.#i));}render(e){const t=this.props;return d(()=>T({children:e},{...("selected"in t?{selected:t.selected}:{}),defaultSelected:t.defaultSelected,disabled:t.disabled,get headline(){return t.headline;},get leading(){return t.leading;},get leadingContent(){return t.leadingContent;},leadingType:t.leadingType,lines:t.lines,onActivate:t.onActivate,get overline(){return t.overline;},get supportingContent(){return t.supportingContent;},get supportingText(){return t.supportingText;},tabIndex:t.tabIndex,get trailing(){return t.trailing;},get trailingContent(){return t.trailingContent;},value:t.value}));}}const q=/* @__PURE__ */E(()=>T,()=>U),ie=s=>q(B(s,["children","headline","leading","leadingContent","overline","supportingContent","supportingText","trailing","trailingContent"]));export{se as List,_ as ListController,ie as ListItem,U as ListItemController};