@pg-labs-incubator/cobweb 0.0.5 → 0.0.7

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 (137) hide show
  1. package/package.json +7 -4
  2. package/src/action/button.yaml +9 -0
  3. package/target/esbuild/action/action.css +1 -1
  4. package/target/esbuild/action/base.jsx +1 -1
  5. package/target/esbuild/action/button.jsx +6 -4
  6. package/target/esbuild/action/fab-menu-context.jsx +1 -1
  7. package/target/esbuild/action/fab-menu.jsx +3 -3
  8. package/target/esbuild/action/fab.jsx +3 -3
  9. package/target/esbuild/action/group.jsx +7 -7
  10. package/target/esbuild/action/icon-button.jsx +3 -3
  11. package/target/esbuild/action/index.jsx +1 -1
  12. package/target/esbuild/action/progress-button.css +1 -0
  13. package/target/esbuild/action/progress-button.jsx +4 -0
  14. package/target/esbuild/action/split-button.jsx +4 -4
  15. package/target/esbuild/color/contrast.jsx +1 -1
  16. package/target/esbuild/color/dynamic.jsx +1 -1
  17. package/target/esbuild/color/hct.jsx +1 -1
  18. package/target/esbuild/color/index.jsx +1 -1
  19. package/target/esbuild/color/palette.jsx +1 -1
  20. package/target/esbuild/color/scheme.jsx +1 -1
  21. package/target/esbuild/color/temperature.jsx +1 -1
  22. package/target/esbuild/container/card.jsx +1 -1
  23. package/target/esbuild/container/elevation-shadow.jsx +1 -1
  24. package/target/esbuild/container/index.jsx +1 -1
  25. package/target/esbuild/dom/client.jsx +1 -1
  26. package/target/esbuild/dom/index.jsx +1 -1
  27. package/target/esbuild/dom/server.jsx +1 -1
  28. package/target/esbuild/dom/types.jsx +1 -1
  29. package/target/esbuild/feedback/badge.jsx +6 -6
  30. package/target/esbuild/feedback/focus.jsx +1 -1
  31. package/target/esbuild/feedback/index.jsx +1 -1
  32. package/target/esbuild/feedback/loading.jsx +3 -3
  33. package/target/esbuild/feedback/observe.jsx +1 -1
  34. package/target/esbuild/feedback/progress.jsx +9 -9
  35. package/target/esbuild/feedback/snackbar.jsx +6 -6
  36. package/target/esbuild/feedback/tooltip.jsx +6 -6
  37. package/target/esbuild/icon/icon.jsx +1 -1
  38. package/target/esbuild/icon/index.jsx +1 -1
  39. package/target/esbuild/index.jsx +1 -1
  40. package/target/esbuild/input/autocomplete.jsx +2 -2
  41. package/target/esbuild/input/base.jsx +2 -2
  42. package/target/esbuild/input/date-picker.jsx +19 -19
  43. package/target/esbuild/input/date-time.jsx +3 -3
  44. package/target/esbuild/input/index.jsx +1 -1
  45. package/target/esbuild/input/paired-input.jsx +1 -1
  46. package/target/esbuild/input/picker-dialog.jsx +3 -3
  47. package/target/esbuild/input/select.jsx +4 -4
  48. package/target/esbuild/input/slider.jsx +7 -7
  49. package/target/esbuild/input/text-field.jsx +4 -4
  50. package/target/esbuild/input/time-picker.jsx +5 -5
  51. package/target/esbuild/motion/follow-height.jsx +1 -0
  52. package/target/esbuild/motion/frame.jsx +1 -1
  53. package/target/esbuild/motion/index.jsx +1 -1
  54. package/target/esbuild/motion/material.jsx +1 -1
  55. package/target/esbuild/motion/motion.jsx +1 -1
  56. package/target/esbuild/motion/spring.jsx +1 -1
  57. package/target/esbuild/motion/transition.jsx +1 -1
  58. package/target/esbuild/motion/velocity.jsx +1 -1
  59. package/target/esbuild/navigation/app-bar.jsx +8 -8
  60. package/target/esbuild/navigation/base.jsx +1 -1
  61. package/target/esbuild/navigation/drawer.jsx +7 -7
  62. package/target/esbuild/navigation/index.jsx +1 -1
  63. package/target/esbuild/navigation/navigation.jsx +12 -12
  64. package/target/esbuild/navigation/scroll.jsx +1 -1
  65. package/target/esbuild/navigation/search.jsx +4 -4
  66. package/target/esbuild/navigation/tabs.jsx +3 -3
  67. package/target/esbuild/navigation/toolbar.jsx +3 -3
  68. package/target/esbuild/selection/base.jsx +1 -1
  69. package/target/esbuild/selection/checkbox.jsx +4 -4
  70. package/target/esbuild/selection/chip.jsx +5 -5
  71. package/target/esbuild/selection/index.jsx +1 -1
  72. package/target/esbuild/selection/radio.jsx +3 -3
  73. package/target/esbuild/selection/segmented.jsx +4 -4
  74. package/target/esbuild/selection/switch.jsx +3 -3
  75. package/target/esbuild/shape/corner-rounding.jsx +1 -1
  76. package/target/esbuild/shape/cubic.jsx +1 -1
  77. package/target/esbuild/shape/index.jsx +1 -1
  78. package/target/esbuild/shape/material-shapes.jsx +1 -1
  79. package/target/esbuild/shape/morph.jsx +1 -1
  80. package/target/esbuild/shape/path.jsx +1 -1
  81. package/target/esbuild/shape/point.jsx +1 -1
  82. package/target/esbuild/shape/rounded-polygon.jsx +1 -1
  83. package/target/esbuild/shape/shapes.jsx +1 -1
  84. package/target/esbuild/spacing/index.jsx +1 -1
  85. package/target/esbuild/state/component.jsx +1 -1
  86. package/target/esbuild/state/controller.jsx +1 -1
  87. package/target/esbuild/state/index.jsx +1 -1
  88. package/target/esbuild/state/ripple.jsx +1 -1
  89. package/target/esbuild/state/state.jsx +1 -1
  90. package/target/esbuild/state/style.jsx +1 -1
  91. package/target/esbuild/surface/carousel-layout.jsx +1 -1
  92. package/target/esbuild/surface/carousel.jsx +2 -2
  93. package/target/esbuild/surface/dialog.jsx +5 -5
  94. package/target/esbuild/surface/divider.jsx +1 -1
  95. package/target/esbuild/surface/drag.jsx +1 -1
  96. package/target/esbuild/surface/gestures.jsx +3 -3
  97. package/target/esbuild/surface/index.jsx +1 -1
  98. package/target/esbuild/surface/interactive.jsx +1 -1
  99. package/target/esbuild/surface/list-patterns.jsx +3 -3
  100. package/target/esbuild/surface/list.jsx +2 -2
  101. package/target/esbuild/surface/menu.jsx +3 -3
  102. package/target/esbuild/surface/scaffold.jsx +7 -7
  103. package/target/esbuild/surface/sheet.jsx +5 -5
  104. package/target/esbuild/surface/side-sheet.jsx +2 -2
  105. package/target/esbuild/surface/slots.jsx +1 -1
  106. package/target/esbuild/surface/surface.jsx +1 -1
  107. package/target/esbuild/text/index.jsx +1 -1
  108. package/target/esbuild/text/text.jsx +2 -2
  109. package/target/esbuild/text/typography.jsx +1 -1
  110. package/target/esbuild/text/visually-hidden.css +1 -0
  111. package/target/esbuild/text/visually-hidden.jsx +1 -0
  112. package/target/esbuild/util/box-side.jsx +1 -1
  113. package/target/esbuild/util/debug.jsx +1 -1
  114. package/target/esbuild/util/dom.jsx +1 -1
  115. package/target/esbuild/util/environment.jsx +1 -0
  116. package/target/esbuild/util/event.jsx +1 -1
  117. package/target/esbuild/util/index.jsx +1 -1
  118. package/target/esbuild/util/preconditions.jsx +1 -1
  119. package/target/esbuild/util/reactive.jsx +1 -1
  120. package/target/node/color.js +1 -0
  121. package/target/node/shape.js +1 -0
  122. package/target/tsc/action/base.d.ts +27 -8
  123. package/target/tsc/action/index.d.ts +3 -1
  124. package/target/tsc/action/progress-button.css.d.ts +3 -0
  125. package/target/tsc/action/progress-button.d.ts +46 -0
  126. package/target/tsc/motion/follow-height.d.ts +51 -0
  127. package/target/tsc/motion/index.d.ts +7 -3
  128. package/target/tsc/motion/spring.d.ts +3 -3
  129. package/target/tsc/shape/index.d.ts +1 -1
  130. package/target/tsc/shape/material-shapes.d.ts +56 -0
  131. package/target/tsc/shape/path.d.ts +16 -0
  132. package/target/tsc/text/index.d.ts +5 -2
  133. package/target/tsc/text/visually-hidden.css.d.ts +3 -0
  134. package/target/tsc/text/visually-hidden.d.ts +33 -0
  135. package/target/tsc/util/environment.d.ts +14 -0
  136. package/target/tsc/util/index.d.ts +2 -1
  137. package/target/tsc/util/preconditions.d.ts +0 -14
@@ -1 +1 @@
1
- import{insert as s}from"solid-js/web";import{defineDomComponent as a}from"..";import"./icon.css";const n="_cw-Icon-autoMirror",d=a(()=>(o,e)=>("name"in e&&(o.children=e.name),<i aria-hidden="true"role="img"{...o}classList={{...o.classList,[n]:e.autoMirror,"cw-Icon":!0}}/>),o=>class extends o{#e;constructor(e){super(e,{styleElementIsFunction:!0}),this.#e="name"in e}applyComponentProps(){const[e,r]=super.readProp("autoMirror");if(r&&super.setClass(n,e??!1),!this.#e)return;const[t,i]=super.readProp("name");i&&(super.styleElement.textContent=t??"")}render(e){const r=<i aria-hidden="true"class="cw-Icon"role="img"/>;return this.#e||s(r,e),r}});export{d as Icon};
1
+ import{insert as s}from"solid-js/web";import{defineDomComponent as a}from"..";import"./icon.css";const n="_cw-Icon-autoMirror",d=/* @__PURE__ */a(()=>(o,e)=>("name"in e&&(o.children=e.name),<i aria-hidden="true"role="img"{...o}classList={{...o.classList,[n]:e.autoMirror,"cw-Icon":!0}}/>),o=>class extends o{#e;constructor(e){super(e,{styleElementIsFunction:!0}),this.#e="name"in e;}applyComponentProps(){const[e,r]=super.readProp("autoMirror");if(r&&super.setClass(n,e??!1),!this.#e)return;const[t,i]=super.readProp("name");i&&(super.styleElement.textContent=t??"");}render(e){const r=<i aria-hidden="true"class="cw-Icon"role="img"/>;return this.#e||s(r,e),r;}});export{d as Icon};
@@ -1 +1 @@
1
- import{Icon as p}from"./icon";export{p as Icon};
1
+ import{Icon as p}from"./icon";export{p as Icon};
@@ -1 +1 @@
1
- import{defineDomComponent as m}from"./dom";export{m as defineDomComponent};
1
+ import{defineDomComponent as m}from"./dom";export{m as defineDomComponent};
@@ -1,5 +1,5 @@
1
1
  import{For as E,createUniqueId as w,onCleanup as A,untrack as P}from"solid-js";import{defineDomComponent as C}from"..";import{TextFieldController as D,renderTextField as L}from"./text-field";import"../container/elevation-shadow.css";const x="cw-Autocomplete",y="cw-Autocomplete-menu",r="cw-Autocomplete-option",a=8;function M(l,e){return L(l,e,()=>{const t=w();return{className:x,labelId:`${t}-label`,controlAttributes:{"aria-autocomplete":"list","aria-controls":t,"aria-expanded":"false",autocomplete:e.autocomplete??"off",role:"combobox"},content:()=><div aria-labelledby={`${t}-label`}class={`${y} cw-elevationShadow`}id={t}popover="manual"role="listbox">
2
2
  <E each={e.options}>{o=><div aria-selected="false"class={r}role="option">{o}</div>}</E>
3
- </div>}})}class S extends D{#i;#e;#n;#r;#c;#s;constructor(e){super(e),this.#i=w(),this.#e=null,this.#n=!1,this.#r=null,this.#c=0,this.#s=void 0,A(()=>{this.#t(!1),this.#s!==void 0&&this.#e?.ownerDocument.defaultView?.cancelAnimationFrame(this.#s)})}#l(){return this.#e===null?[]:Array.from(this.#e.children)}#p(){return this.#r===null?-1:this.#l().indexOf(this.#r)}#a(){const e=this.functionElement;return e!==null&&!e.readOnly&&!e.matches(":disabled")}#t(e){this.#n=e&&this.#a(),this.#n||this.#o(-1),this.#d()}#o(e){const t=this.#l(),o=t[e]??null;for(const n of t)n.setAttribute("aria-selected",n===o?"true":"false");if(this.#r=o,o===null){super.setAttribute("aria-activedescendant",void 0);return}o.id===""&&(o.id=`${this.#i}-${this.#c++}`),super.setAttribute("aria-activedescendant",o.id),o.scrollIntoView({block:"nearest"})}#d(){const e=this.#e,t=this.#l().length,o=this.#n&&t>0;if(this.#r!==null&&this.#p()<0&&this.#o(-1),super.setAttribute("aria-expanded",o?"true":"false"),!(e===null||!e.isConnected)){if(e.matches(":popover-open")===o){o&&this.#u();return}o?(e.showPopover(),this.#m(),e.ownerDocument.defaultView?.addEventListener("resize",this.#u),e.ownerDocument.addEventListener("scroll",this.#u,!0)):(e.hidePopover(),e.ownerDocument.defaultView?.removeEventListener("resize",this.#u),e.ownerDocument.removeEventListener("scroll",this.#u,!0))}}#m(){const e=this.#e,t=this.styleElement?.querySelector(".cw-TextField-control")??null,o=e?.ownerDocument.defaultView??null;if(e===null||t===null||o===null)return;const n=t.getBoundingClientRect(),s=o.innerHeight-n.bottom-a,u=n.top-a,i=s<e.scrollHeight&&u>s;e.style.setProperty("inline-size",`${n.width}px`),e.style.setProperty("left",`${n.left}px`),e.style.setProperty("top",i?"auto":`${n.bottom}px`),e.style.setProperty("bottom",i?`${o.innerHeight-n.top}px`:"auto"),e.style.setProperty("max-block-size",`${Math.max(0,i?u:s)}px`),e.style.setProperty("transform-origin",i?"bottom center":"top center")}#u=()=>{const e=this.#e?.ownerDocument.defaultView??null;e===null||this.#s!==void 0||(this.#s=e.requestAnimationFrame(()=>{this.#s=void 0,this.#e?.matches(":popover-open")===!0&&this.#m()}))};#h(e,t){const o=P(()=>this.props.options)[e];this.#t(!1),o!==void 0&&this.#a()&&this.commitValue(o,t)}#f=()=>{this.#o(-1),this.#t(!0)};#v=e=>{const t=this.#l().length,o=this.#n&&t>0,n=this.#p();if(!(e.defaultPrevented||e.isComposing))switch(e.key){case"ArrowDown":case"ArrowUp":{const s=e.key==="ArrowDown";if(t===0||!this.#a())return;e.preventDefault(),o?s?this.#o(n<t-1?n+1:0):this.#o(n>0?n-1:t-1):(this.#t(!0),e.altKey||this.#o(s?0:t-1));return}case"Home":case"End":if(!o||n<0)return;e.preventDefault(),this.#o(e.key==="Home"?0:t-1);return;case"Enter":if(!o||n<0)return;e.preventDefault(),this.#h(n,e);return;case"Escape":if(!o)return;e.preventDefault(),this.#t(!1);return}};#b=e=>{const t=e.relatedTarget;(t===null||!(this.styleElement?.contains(t)??!1))&&this.#t(!1)};#E=e=>{e.preventDefault()};#w=e=>{const t=e.target.closest(`.${r}`),o=t===null?-1:this.#l().indexOf(t);o>=0&&this.#h(o,e)};applyComponentProps(){const[e]=super.readProp("autocomplete"),[,t]=super.readProp("options");super.applyComponentProps(),super.setClass(x,!0),super.setAttribute("autocomplete",e??"off"),this.labelElement?.setAttribute("id",`${this.#i}-label`),this.#n&&!this.#a()&&this.#t(!1),t&&queueMicrotask(()=>this.#d())}onFunctionElementChanged(e){const t=e;super.onFunctionElementChanged(e),t!==null&&(super.setAttribute("aria-autocomplete","list"),super.setAttribute("aria-controls",this.#i),super.setAttribute("aria-expanded","false"),super.setAttribute("role","combobox"),t.addEventListener("focusout",this.#b),t.addEventListener("input",this.#f),t.addEventListener("keydown",this.#v))}renderExtension(){const e=this.#i;return<div aria-labelledby={`${e}-label`}class={`${y} cw-elevationShadow`}id={e}on:click={this.#w}on:mousedown={this.#E}popover="manual"ref={t=>this.#e=t}role="listbox">
3
+ </div>};});}class S extends D{#i;#e;#n;#r;#c;#s;constructor(e){super(e),this.#i=w(),this.#e=null,this.#n=!1,this.#r=null,this.#c=0,this.#s=void 0,A(()=>{this.#t(!1),this.#s!==void 0&&this.#e?.ownerDocument.defaultView?.cancelAnimationFrame(this.#s);});}#l(){return this.#e===null?[]:Array.from(this.#e.children);}#p(){return this.#r===null?-1:this.#l().indexOf(this.#r);}#a(){const e=this.functionElement;return e!==null&&!e.readOnly&&!e.matches(":disabled");}#t(e){this.#n=e&&this.#a(),this.#n||this.#o(-1),this.#d();}#o(e){const t=this.#l(),o=t[e]??null;for(const n of t)n.setAttribute("aria-selected",n===o?"true":"false");if(this.#r=o,o===null){super.setAttribute("aria-activedescendant",void 0);return;}o.id===""&&(o.id=`${this.#i}-${this.#c++}`),super.setAttribute("aria-activedescendant",o.id),o.scrollIntoView({block:"nearest"});}#d(){const e=this.#e,t=this.#l().length,o=this.#n&&t>0;if(this.#r!==null&&this.#p()<0&&this.#o(-1),super.setAttribute("aria-expanded",o?"true":"false"),!(e===null||!e.isConnected)){if(e.matches(":popover-open")===o){o&&this.#u();return;}o?(e.showPopover(),this.#m(),e.ownerDocument.defaultView?.addEventListener("resize",this.#u),e.ownerDocument.addEventListener("scroll",this.#u,!0)):(e.hidePopover(),e.ownerDocument.defaultView?.removeEventListener("resize",this.#u),e.ownerDocument.removeEventListener("scroll",this.#u,!0));}}#m(){const e=this.#e,t=this.styleElement?.querySelector(".cw-TextField-control")??null,o=e?.ownerDocument.defaultView??null;if(e===null||t===null||o===null)return;const n=t.getBoundingClientRect(),s=o.innerHeight-n.bottom-a,u=n.top-a,i=s<e.scrollHeight&&u>s;e.style.setProperty("inline-size",`${n.width}px`),e.style.setProperty("left",`${n.left}px`),e.style.setProperty("top",i?"auto":`${n.bottom}px`),e.style.setProperty("bottom",i?`${o.innerHeight-n.top}px`:"auto"),e.style.setProperty("max-block-size",`${Math.max(0,i?u:s)}px`),e.style.setProperty("transform-origin",i?"bottom center":"top center");}#u=()=>{const e=this.#e?.ownerDocument.defaultView??null;e===null||this.#s!==void 0||(this.#s=e.requestAnimationFrame(()=>{this.#s=void 0,this.#e?.matches(":popover-open")===!0&&this.#m();}));};#h(e,t){const o=P(()=>this.props.options)[e];this.#t(!1),o!==void 0&&this.#a()&&this.commitValue(o,t);}#f=()=>{this.#o(-1),this.#t(!0);};#v=e=>{const t=this.#l().length,o=this.#n&&t>0,n=this.#p();if(!(e.defaultPrevented||e.isComposing))switch(e.key){case"ArrowDown":case"ArrowUp":{const s=e.key==="ArrowDown";if(t===0||!this.#a())return;e.preventDefault(),o?s?this.#o(n<t-1?n+1:0):this.#o(n>0?n-1:t-1):(this.#t(!0),e.altKey||this.#o(s?0:t-1));return;}case"Home":case"End":if(!o||n<0)return;e.preventDefault(),this.#o(e.key==="Home"?0:t-1);return;case"Enter":if(!o||n<0)return;e.preventDefault(),this.#h(n,e);return;case"Escape":if(!o)return;e.preventDefault(),this.#t(!1);return;}};#b=e=>{const t=e.relatedTarget;(t===null||!(this.styleElement?.contains(t)??!1))&&this.#t(!1);};#E=e=>{e.preventDefault();};#w=e=>{const t=e.target.closest(`.${r}`),o=t===null?-1:this.#l().indexOf(t);o>=0&&this.#h(o,e);};applyComponentProps(){const[e]=super.readProp("autocomplete"),[,t]=super.readProp("options");super.applyComponentProps(),super.setClass(x,!0),super.setAttribute("autocomplete",e??"off"),this.labelElement?.setAttribute("id",`${this.#i}-label`),this.#n&&!this.#a()&&this.#t(!1),t&&queueMicrotask(()=>this.#d());}onFunctionElementChanged(e){const t=e;super.onFunctionElementChanged(e),t!==null&&(super.setAttribute("aria-autocomplete","list"),super.setAttribute("aria-controls",this.#i),super.setAttribute("aria-expanded","false"),super.setAttribute("role","combobox"),t.addEventListener("focusout",this.#b),t.addEventListener("input",this.#f),t.addEventListener("keydown",this.#v));}renderExtension(){const e=this.#i;return<div aria-labelledby={`${e}-label`}class={`${y} cw-elevationShadow`}id={e}on:click={this.#w}on:mousedown={this.#E}popover="manual"ref={t=>this.#e=t}role="listbox">
4
4
  <E each={this.props.options}>{t=><div aria-selected="false"class={r}role="option">{t}</div>}</E>
5
- </div>}}const $=C(()=>M,()=>S);export{$ as Autocomplete,S as AutocompleteController};
5
+ </div>;}}const $=/* @__PURE__ */C(()=>M,()=>S);export{$ as Autocomplete,S as AutocompleteController};
@@ -1,4 +1,4 @@
1
- import{createEffect as b,createMemo as x,createSignal as m,onCleanup as O}from"solid-js";import{isServer as L}from"solid-js/web";const M=new Set(["class","classList","style"]),l=new WeakMap;function S(e){const t=e.getRootNode();return t.nodeType===Node.DOCUMENT_NODE||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t:e.ownerDocument}function E(e){const{form:t}=e;return t===void 0?e.closest("form"):t}function a(e,t){let n=l.get(t);n===void 0&&(n=new Set,l.set(t,n),t.addEventListener("reset",F,!0)),n.add(e)}function p(e,t){const n=l.get(t);n===void 0||!n.delete(e)||n.size!==0||(l.delete(t),t.removeEventListener("reset",F,!0))}function I(e){const t=S(e.element),n=E(e.element);e.root=t,a(e,t),n!==null&&!n.isConnected&&(e.detachedForm=n,a(e,n))}function R(e){e.root!==null&&p(e,e.root),e.detachedForm!==null&&p(e,e.detachedForm),e.root=null,e.detachedForm=null}function w(e,t){let n=!0;const r=()=>{!n||e.root===null||t.eventPhase!==Event.NONE||(n=!1,t.defaultPrevented||e.callback())};e.lastEvent=t,queueMicrotask(r),setTimeout(r,0)}function F(e){const t=l.get(e.currentTarget);if(t!==void 0)for(const n of Array.from(t))n.root===null||n.lastEvent===e||(n.root!==S(n.element)&&(R(n),I(n),n.onRootChanged?.()),E(n.element)===e.target&&w(n,e))}function D(e){const t=e,n={},r={};for(const o of Object.keys(t).filter(u=>u!=="children")){const u=M.has(o)?n:r;Object.defineProperty(u,o,{enumerable:!0,get:()=>t[o]})}return{containerProps:n,elementProps:r,get children(){return t.children}}}function s(e){return e!=null&&typeof e!="boolean"&&e!==""}function T(...e){return e.find(s)}function h(...e){for(const t of e){const n=t();if(s(n))return n}}function H(e){const t=e.errorText;if(s(t))return t;const n=e.error;return n===!0||s(n)?n:void 0}function J(e,t){return t!==void 0&&t!==!0?t:h(()=>e.supportingText,()=>e.helperText)}function X(...e){const t=e.filter(n=>n!==void 0&&n!=="");return t.length===0?void 0:t.join(" ")}function z(e){return T(e.errorText,e.error,e.supportingText,e.helperText)}function j(e){const{error:t,errorText:n}=e;return t===!0||T(n,t)!==void 0}const N=["restingMotion","floatingMotion","restingLabel"],P="--_cw-field-label-inline-size",k={attributes:!0,characterData:!0,childList:!0,subtree:!0};function c(e){return typeof e=="function"?c(e()):Array.isArray(e)?e.flatMap(c):s(e)?[typeof e.nodeType=="number"?e:String(e)]:[]}function g(e,t){return N.map(n=><span aria-hidden="true"class={`${e}-${n}`}inert>
1
+ import{createEffect as b,createMemo as x,createSignal as m,onCleanup as O}from"solid-js";import{isServer as L}from"solid-js/web";const M=/* @__PURE__ */new Set(["class","classList","style"]),l=/* @__PURE__ */new WeakMap();function S(e){const t=e.getRootNode();return t.nodeType===Node.DOCUMENT_NODE||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t:e.ownerDocument;}function E(e){const{form:t}=e;return t===void 0?e.closest("form"):t;}function a(e,t){let n=l.get(t);n===void 0&&(n=/* @__PURE__ */new Set(),l.set(t,n),t.addEventListener("reset",F,!0)),n.add(e);}function p(e,t){const n=l.get(t);n===void 0||!n.delete(e)||n.size!==0||(l.delete(t),t.removeEventListener("reset",F,!0));}function I(e){const t=S(e.element),n=E(e.element);e.root=t,a(e,t),n!==null&&!n.isConnected&&(e.detachedForm=n,a(e,n));}function R(e){e.root!==null&&p(e,e.root),e.detachedForm!==null&&p(e,e.detachedForm),e.root=null,e.detachedForm=null;}function w(e,t){let n=!0;const r=()=>{!n||e.root===null||t.eventPhase!==Event.NONE||(n=!1,t.defaultPrevented||e.callback());};e.lastEvent=t,queueMicrotask(r),setTimeout(r,0);}function F(e){const t=l.get(e.currentTarget);if(t!==void 0)for(const n of Array.from(t))n.root===null||n.lastEvent===e||(n.root!==S(n.element)&&(R(n),I(n),n.onRootChanged?.()),E(n.element)===e.target&&w(n,e));}function D(e){const t=e,n={},r={};for(const o of Object.keys(t).filter(u=>u!=="children")){const u=M.has(o)?n:r;Object.defineProperty(u,o,{enumerable:!0,get:()=>t[o]});}return{containerProps:n,elementProps:r,get children(){return t.children;}};}function s(e){return e!=null&&typeof e!="boolean"&&e!=="";}function T(...e){return e.find(s);}function h(...e){for(const t of e){const n=t();if(s(n))return n;}}function H(e){const t=e.errorText;if(s(t))return t;const n=e.error;return n===!0||s(n)?n:void 0;}function J(e,t){return t!==void 0&&t!==!0?t:h(()=>e.supportingText,()=>e.helperText);}function X(...e){const t=e.filter(n=>n!==void 0&&n!=="");return t.length===0?void 0:t.join(" ");}function z(e){return T(e.errorText,e.error,e.supportingText,e.helperText);}function j(e){const{error:t,errorText:n}=e;return t===!0||T(n,t)!==void 0;}const N=["restingMotion","floatingMotion","restingLabel"],P="--_cw-field-label-inline-size",k={attributes:!0,characterData:!0,childList:!0,subtree:!0};function c(e){return typeof e=="function"?c(e()):Array.isArray(e)?e.flatMap(c):s(e)?[typeof e.nodeType=="number"?e:String(e)]:[];}function g(e,t){return N.map(n=><span aria-hidden="true"class={`${e}-${n}`}inert>
2
2
  {t()}
3
3
  <span class={`${e}-asterisk`}>*</span>
4
- </span>)}function A(e,t,n){const r=x(()=>c(t())),[o,u]=m(void 0,{equals:!1});let d;return b(()=>{if(d!==void 0||r().every(f=>typeof f=="string"))return;const i=n();if(i===null)return;const v=i.ownerDocument.defaultView?.MutationObserver??MutationObserver;d=new v(f=>{f.some(y=>y.target!==i)&&u()}),d.observe(i,k)}),O(()=>d?.disconnect()),g(e,()=>(o(),r().map(i=>typeof i=="string"?i:i.cloneNode(!0))))}function $(e){if(L){let r;return{content(o){return r=o,o},copies(){return g(e,()=>r)}}}const[t,n]=m();return{content(r){return n(()=>r),r},copies(r){return A(e,t,r??(()=>null))}}}function B(e,t){const n=e.styleElement?.querySelector(`.${t}-floatingMotion`)??null,r=n?.ownerDocument.defaultView?.ResizeObserver;if(n===null||r===void 0)return()=>{};const o=new r(([u])=>e.setStyle(P,`${u.borderBoxSize[0].inlineSize}px`));return o.observe(n),()=>o.disconnect()}function V(e,t,n){const r={element:e,callback:t,onRootChanged:n,root:null,detachedForm:null,lastEvent:null};return I(r),()=>R(r)}export{$ as createFieldLabel,T as firstInputSlot,h as firstInputSlotOf,j as hasInputError,X as idReferencesOf,H as inputErrorOf,V as observeFormReset,B as observeLabelInlineSize,D as splitInputElementProps,z as supportingSlot,J as supportingSlotOf};
4
+ </span>);}function A(e,t,n){const r=x(()=>c(t())),[o,u]=m(void 0,{equals:!1});let d;return b(()=>{if(d!==void 0||r().every(f=>typeof f=="string"))return;const i=n();if(i===null)return;const v=i.ownerDocument.defaultView?.MutationObserver??MutationObserver;d=new v(f=>{f.some(y=>y.target!==i)&&u();}),d.observe(i,k);}),O(()=>d?.disconnect()),g(e,()=>(o(),r().map(i=>typeof i=="string"?i:i.cloneNode(!0))));}function $(e){if(L){let r;return{content(o){return r=o,o;},copies(){return g(e,()=>r);}};}const[t,n]=m();return{content(r){return n(()=>r),r;},copies(r){return A(e,t,r??(()=>null));}};}function B(e,t){const n=e.styleElement?.querySelector(`.${t}-floatingMotion`)??null,r=n?.ownerDocument.defaultView?.ResizeObserver;if(n===null||r===void 0)return()=>{};const o=new r(([u])=>e.setStyle(P,`${u.borderBoxSize[0].inlineSize}px`));return o.observe(n),()=>o.disconnect();}function V(e,t,n){const r={element:e,callback:t,onRootChanged:n,root:null,detachedForm:null,lastEvent:null};return I(r),()=>R(r);}export{$ as createFieldLabel,T as firstInputSlot,h as firstInputSlotOf,j as hasInputError,X as idReferencesOf,H as inputErrorOf,V as observeFormReset,B as observeLabelInlineSize,D as splitInputElementProps,z as supportingSlot,J as supportingSlotOf};
@@ -1,13 +1,13 @@
1
- import{For as P,Show as M,batch as v,createMemo as y,createRenderEffect as x,createSelector as G,createSignal as w,createUniqueId as q,on as Y,onCleanup as xe,onMount as Ye,untrack as u}from"solid-js";import{defineDomComponent as ne}from"..";import{DomController as _e}from"../dom/client";import{Icon as E}from"../icon";import{applyMotion as W}from"../motion";import{observeFormReset as Ne}from"./base";import{TextField as He}from"./text-field";import"./date-picker.css";const $e={selectDate:"Select date",selectRange:"Select dates",enterDate:"Enter date",enterRange:"Enter dates",selectedDate:"Selected date",enteredDate:"Entered date",date:"Date",startDate:"Start date",endDate:"End date",previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",month:"Month",year:"Year",yearSelection:"Switch to selecting a year",daySelection:"Switch to selecting a day",switchToInput:"Switch to date input",switchToCalendar:"Switch to calendar",invalidPattern:"Date does not match expected pattern: {pattern}",invalidYearRange:"Date out of expected year range {start} - {end}",notAllowed:"Date not allowed: {date}",invalidRange:"Invalid date range input"},Z="en-US",Ve="1900-01-01",Ue="2100-12-31",p=7,re=6,T=3,_=201,j=5,N=4800,Ke=366,$={year:4,month:2,day:2},Je={year:"YYYY",month:"MM",day:"DD"},ae=8,Be="/",se=/^[\s\u061c\u200e\u200f]$/u,Xe=/^[0-9]$/u,U="2023-01-01",Ge=new Set(["AG","AS","BD","BR","BS","BT","BW","BZ","CA","CN","CO","DM","DO","ET","GT","GU","HK","HN","ID","IL","IN","JM","JP","KE","KH","KR","LA","MH","MM","MO","MT","MX","MZ","NI","NP","PA","PE","PH","PK","PR","PT","PY","SA","SG","SV","TH","TT","TW","UM","US","VE","VI","WS","YE","ZA","ZW"]),qe=new Set(["AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY"]),z={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function D(r){if(r===void 0||!/^\d{4}-\d{2}-\d{2}$/u.test(r)||r.startsWith("0000"))return;const e=new Date(`${r}T00:00:00.000Z`);return Number.isFinite(e.getTime())&&oe(e)===r?e:void 0}function oe(r){return r.toISOString().slice(0,10)}function A(r,e,t=0){const n=D(r);if(t!==0){const a=n.getUTCDate();n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t+1,0),n.setUTCDate(Math.min(a,n.getUTCDate()))}return n.setUTCDate(n.getUTCDate()+e),oe(n)}function g(r){return Number(r.slice(0,4))*12+Number(r.slice(5,7))-1}function V(r){return`${String(Math.floor(r/12)).padStart(4,"0")}-${String(r%12+1).padStart(2,"0")}`}function k(r,e,t){return Math.min(t,Math.max(e,r))}function F(r,e){return D(r)===void 0?e:r}function We(){const r=new Date,e=String(r.getFullYear()).padStart(4,"0"),t=String(r.getMonth()+1).padStart(2,"0");return`${e}-${t}-${String(r.getDate()).padStart(2,"0")}`}function Ze(r){const e=/-u(?:-[a-z0-9]{2,8})*?-fw-([a-z]{3})(?:-|$)/u.exec(r.toLowerCase());let t;if(e!==null&&e[1]in z)return z[e[1]];try{t=new Intl.Locale(r).maximize().region}catch{t=void 0}return t===void 0?1:Ge.has(t)?0:qe.has(t)?6:t==="MV"?5:1}function H(r,e){return r.replace(/\{(\w+)\}/gu,(t,n)=>e[n]??t)}function je(r){const e=t=>new Intl.DateTimeFormat(r,{...t,calendar:"gregory",timeZone:"UTC"});return{monthYear:e({month:"long",year:"numeric"}),monthShort:e({month:"short"}),monthLong:e({month:"long"}),year:e({year:"numeric"}),date:e({dateStyle:"full"}),headline:e({day:"numeric",month:"short",year:"numeric"}),day:e({day:"numeric"}),weekday:e({weekday:"narrow"}),weekdayLong:e({weekday:"long"}),entry:ze(r)}}function ze(r){const e=new Intl.DateTimeFormat(r,{calendar:"gregory",day:"2-digit",month:"2-digit",timeZone:"UTC",year:"numeric"}),t=e.formatToParts(D(U)),n=t.map(o=>o.type).filter(o=>o==="year"||o==="month"||o==="day"),a=t.filter(o=>o.type==="literal").flatMap(o=>Array.from(o.value)).find(o=>!se.test(o))??Be,s=new Intl.NumberFormat(r,{numberingSystem:e.resolvedOptions().numberingSystem});return{fields:n,delimiter:a,pattern:n.map(o=>Je[o]).join(a),digits:Array.from({length:10},(o,i)=>s.format(i))}}function C(r,e){const t={year:r.slice(0,4),month:r.slice(5,7),day:r.slice(8,10)};return D(r)===void 0?"":e.fields.map(n=>t[n]).join("")}function K(r,e){const t=e.digits.indexOf(r);return t>=0?String(t):Xe.test(r)?r:void 0}function Qe(r,e){let t="";for(const n of r){const a=K(n,e);if(a!==void 0)t+=a;else if(n!==e.delimiter&&!se.test(n))return}return t}function Q(r,e){return Array.from(r).filter(t=>K(t,e)!==void 0).length}function et(r,e){let t="",n=0;for(const a of e.fields){const s=n+$[a];for(const o of r.slice(n,s))t+=e.digits[Number(o)];r.length>s&&(t+=e.delimiter),n=s}return t}function ee(r,e){const t={year:"",month:"",day:""};let n=0;for(const a of e.fields)t[a]=r.slice(n,n+$[a]),n+=$[a];return F(`${t.year}-${t.month}-${t.day}`,"")}function tt(r,e,t){let n=0,a=0;for(const s of r){if(n===e)return a;K(s,t)!==void 0&&n++,a+=s.length}return a}function m(r,e){return r.format(D(e.length===7?`${e}-01`:e))}class nt{range;today;props;selection;minimum;maximum;format;firstDay;month;focused;inputMode;overlay;yearsShown;focusedYear;drafts;errors;listStart;windowStart;#a;#u;#h;#m;#s;#t;#n;#o;#i;#c;#e;#d;#D;#f;constructor(e,t,n,a,s,o){const[i,c]=w(n),l=y(()=>F(e.min,Ve)),d=y(()=>F(e.max,Ue)),h=u(()=>F(e.today,We())),f=u(()=>D(n[0])===void 0?h:n[0]),S=u(()=>this.#g(f,l(),d())),R=u(()=>{const b=`${e.defaultMonth}-01`;return D(b)===void 0?S.slice(0,7):this.#g(b,l(),d()).slice(0,7)}),[I,ye]=w(R),[pe,De]=w(S),[be,we]=w(u(()=>e.defaultDisplayMode==="input")),[ve,Pe]=w("none"),[Se,ke]=w(!1),[Ee,Me]=w(Number(R.slice(0,4))),O=y(()=>je(e.locale??Z)),B=u(O).entry,[Te,Re]=w([C(n[0],B),C(n[1],B)]),[Ce,Ae]=w([void 0,void 0]),[Le,Ie]=w(g(R)),[Fe,Oe]=w(g(R));this.range=s,this.today=h,this.props=e,this.selection=y(()=>a?t():i(),n,{equals:(b,X)=>b[0]===X[0]&&b[1]===X[1]}),this.minimum=l,this.maximum=d,this.format=O,this.firstDay=y(()=>e.firstDayOfWeek??Ze(e.locale??Z)),this.month=I,this.focused=pe,this.inputMode=be,this.overlay=ve,this.yearsShown=Se,this.focusedYear=Ee,this.drafts=Te,this.errors=Ce,this.listStart=Le,this.windowStart=Fe,this.#a=a,this.#u=n,this.#h=o,this.#m=c,this.#s=ye,this.#t=De,this.#n=we,this.#o=Pe,this.#i=ke,this.#c=Me,this.#e=Re,this.#d=Ae,this.#D=Ie,this.#f=Oe,x(Y(()=>this.selection()[0],b=>{D(b)!==void 0&&(this.#t(b),this.continuous()||this.#s(b.slice(0,7)))},{defer:!0})),x(Y(this.selection,b=>this.#b(b),{defer:!0})),x(Y(O,()=>this.#r(this.selection()),{defer:!0}))}#g(e,t,n){return e<t?t:e>n?n:e}label(e){return this.props.labels?.[e]??$e[e]}docked(){return this.props.presentation==="docked"}continuous(){return this.range&&!this.docked()&&this.props.rangeLayout!=="paged"}minimumMonth(){return g(this.minimum())}maximumMonth(){return g(this.maximum())}listEnd(){return Math.min(this.maximumMonth(),this.listStart()+N-1)}windowMonths(){const e=this.windowStart(),t=Math.max(0,Math.min(j,this.listEnd()-e+1));return Array.from({length:t},(n,a)=>V(e+a))}isSelectable(e){return D(e)!==void 0&&e>=this.minimum()&&e<=this.maximum()&&this.props.disabled!==!0&&this.props.isDateDisabled?.(e)!==!0}flagsOf(e,t,n){const[a,s]=this.selection(),o=this.range&&a!==""&&s!=="";return e===""?0:(e===a||e===s?1:0)|(o&&e===a?2:0)|(o&&e===s?4:0)|(o&&e>=a&&e<=s?8:0)|(e===this.today?16:0)|(t?0:32)|(e.slice(0,7)===n?0:64)}daysOf(e){const t=`${e}-01`,n=(D(t).getUTCDay()-this.firstDay()+p)%p,a=this.docked();return Array.from({length:re*p},(s,o)=>{const i=A(t,o-n);return a||i.slice(0,7)===e?i:""})}#y(e,t){this.props.disabled===!0||this.props.readOnly===!0||(this.#a||this.#m(e),this.#h(e,t))}select(e,t){const[n,a]=this.selection();this.isSelectable(e)&&this.#y(this.range&&n!==""&&a===""&&e>=n?[n,e]:[e,""],t)}showMonth(e){const t=this.#g(`${e}-01`,this.minimum(),this.maximum());v(()=>{this.#s(t.slice(0,7)),this.#t(t)})}focus(e){v(()=>{this.#t(e),this.continuous()||this.#s(e.slice(0,7))})}trackFocus(e){this.#t(e)}scrollTo(e){const t=V(k(e,this.minimumMonth(),this.maximumMonth()));t!==u(this.month)&&this.#s(t)}centerList(e){const t=k(e-N/2,this.minimumMonth(),Math.max(this.minimumMonth(),this.maximumMonth()-N+1));this.#D(t)}renderFrom(e){const t=k(e,this.listStart(),Math.max(this.listStart(),this.listEnd()-j+1));t!==u(this.windowStart)&&this.#f(t)}setInputMode(e){v(()=>{this.#o("none"),this.#r(this.selection()),this.#n(e)})}setOverlay(e){v(()=>{e==="years"&&(this.#c(Number(this.month().slice(0,4))),this.#i(!0)),this.#o(e)})}years(){return[Number(this.minimum().slice(0,4)),Number(this.maximum().slice(0,4))]}yearPage(){const[e,t]=this.years(),n=this.focusedYear()-(_-1)/2,a=k(n,e,Math.max(e,t-_+1));return[a,Math.min(t,a+_-1)]}focusYear(e){const[t,n]=this.years();this.#c(k(e,t,n))}edit(e,t,n){const a=this.selection(),s=e===0?[t,this.drafts()[1]]:[this.drafts()[0],t],o=[this.#p(s[0]),this.#p(s[1])],i=[this.#l(s[0],o[0]),this.#l(s[1],o[1])];this.range&&i[0]!==""&&i[1]!==""&&i[0]>i[1]&&(o[e]=this.label("invalidRange"),i[e]=""),v(()=>{this.#e(s),this.#d(o)}),(i[0]!==a[0]||i[1]!==a[1])&&this.#y(i,n)}#p(e){const t=this.format(),n=ee(e,t.entry),a=n.slice(0,4);if(!(e.length<ae))return n===""?H(this.label("invalidPattern"),{pattern:t.entry.pattern}):a<this.minimum().slice(0,4)||a>this.maximum().slice(0,4)?H(this.label("invalidYearRange"),{start:m(t.year,this.minimum()),end:m(t.year,this.maximum())}):this.isSelectable(n)?void 0:H(this.label("notAllowed"),{date:m(t.headline,n)})}#l(e,t){return t===void 0?ee(e,this.format().entry):""}#r(e){const t=this.format().entry,[n,a]=e;v(()=>{this.#e([C(n,t),C(a,t)]),this.#d([void 0,void 0])})}#b(e){const t=this.format().entry,n=this.drafts(),a=this.errors(),s=o=>this.#l(n[o],a[o])===e[o];s(0)&&s(1)||v(()=>{this.#e([s(0)?n[0]:C(e[0],t),s(1)?n[1]:C(e[1],t)]),this.#d([s(0)?a[0]:void 0,s(1)?a[1]:void 0])})}reset(){v(()=>{this.#a||this.#m(this.#u),this.#r(this.#a?this.selection():this.#u)})}}const rt=Array.from({length:re},(r,e)=>e),J=Array.from({length:p},(r,e)=>e),at=Array.from({length:12},(r,e)=>e);function ie(r){const e=y(()=>{const a=r.focused(),s=r.continuous()?r.windowMonths():[r.month()];if(s.includes(a.slice(0,7))&&r.isSelectable(a))return a;for(const o of s)for(let i=`${o}-01`;i.startsWith(o);i=A(i,1))if(r.isSelectable(i))return i;return a}),t=G(e),n=G(r.focusedYear);return{model:r,isTabStop:t,isYearStop:n,descriptionId:q(),yearDescriptionId:q()}}function L(r){return<button aria-label={r.label}class={r.class}data-cw-action={r.action}disabled={r.disabled}type="button">{r.children}</button>}function st(r){const e=r.model,t=()=>e.label(e.inputMode()?e.range?"enterRange":"enterDate":e.range?"selectRange":"selectDate"),n=()=>{const a=e.format().headline,[s,o]=e.selection(),i=(d,h)=>D(d)===void 0?h:m(a,d),c=e.inputMode()?"enteredDate":"selectedDate",l=i(s,e.label(e.range?"startDate":c));return e.range?`${l} \u2013 ${i(o,e.label("endDate"))}`:l};return<>
1
+ import{For as P,Show as M,batch as v,createMemo as y,createRenderEffect as x,createSelector as G,createSignal as w,createUniqueId as q,on as Y,onCleanup as xe,onMount as Ye,untrack as u}from"solid-js";import{defineDomComponent as ne}from"..";import{DomController as _e}from"../dom/client";import{Icon as E}from"../icon";import{applyMotion as W}from"../motion";import{observeFormReset as Ne}from"./base";import{TextField as He}from"./text-field";import"./date-picker.css";const $e={selectDate:"Select date",selectRange:"Select dates",enterDate:"Enter date",enterRange:"Enter dates",selectedDate:"Selected date",enteredDate:"Entered date",date:"Date",startDate:"Start date",endDate:"End date",previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",month:"Month",year:"Year",yearSelection:"Switch to selecting a year",daySelection:"Switch to selecting a day",switchToInput:"Switch to date input",switchToCalendar:"Switch to calendar",invalidPattern:"Date does not match expected pattern: {pattern}",invalidYearRange:"Date out of expected year range {start} - {end}",notAllowed:"Date not allowed: {date}",invalidRange:"Invalid date range input"},Z="en-US",Ve="1900-01-01",Ue="2100-12-31",p=7,re=6,T=3,_=201,j=5,N=4800,Ke=366,$={year:4,month:2,day:2},Je={year:"YYYY",month:"MM",day:"DD"},ae=8,Be="/",se=/^[\s\u061c\u200e\u200f]$/u,Xe=/^[0-9]$/u,U="2023-01-01",Ge=/* @__PURE__ */new Set(["AG","AS","BD","BR","BS","BT","BW","BZ","CA","CN","CO","DM","DO","ET","GT","GU","HK","HN","ID","IL","IN","JM","JP","KE","KH","KR","LA","MH","MM","MO","MT","MX","MZ","NI","NP","PA","PE","PH","PK","PR","PT","PY","SA","SG","SV","TH","TT","TW","UM","US","VE","VI","WS","YE","ZA","ZW"]),qe=/* @__PURE__ */new Set(["AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY"]),z={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function D(r){if(r===void 0||!/^\d{4}-\d{2}-\d{2}$/u.test(r)||r.startsWith("0000"))return;const e=/* @__PURE__ */new Date(`${r}T00:00:00.000Z`);return Number.isFinite(e.getTime())&&oe(e)===r?e:void 0;}function oe(r){return r.toISOString().slice(0,10);}function A(r,e,t=0){const n=D(r);if(t!==0){const a=n.getUTCDate();n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t+1,0),n.setUTCDate(Math.min(a,n.getUTCDate()));}return n.setUTCDate(n.getUTCDate()+e),oe(n);}function g(r){return Number(r.slice(0,4))*12+Number(r.slice(5,7))-1;}function V(r){return`${String(Math.floor(r/12)).padStart(4,"0")}-${String(r%12+1).padStart(2,"0")}`;}function k(r,e,t){return Math.min(t,Math.max(e,r));}function F(r,e){return D(r)===void 0?e:r;}function We(){const r=/* @__PURE__ */new Date(),e=String(r.getFullYear()).padStart(4,"0"),t=String(r.getMonth()+1).padStart(2,"0");return`${e}-${t}-${String(r.getDate()).padStart(2,"0")}`;}function Ze(r){const e=/-u(?:-[a-z0-9]{2,8})*?-fw-([a-z]{3})(?:-|$)/u.exec(r.toLowerCase());let t;if(e!==null&&e[1]in z)return z[e[1]];try{t=new Intl.Locale(r).maximize().region;}catch{t=void 0;}return t===void 0?1:Ge.has(t)?0:qe.has(t)?6:t==="MV"?5:1;}function H(r,e){return r.replace(/\{(\w+)\}/gu,(t,n)=>e[n]??t);}function je(r){const e=t=>new Intl.DateTimeFormat(r,{...t,calendar:"gregory",timeZone:"UTC"});return{monthYear:e({month:"long",year:"numeric"}),monthShort:e({month:"short"}),monthLong:e({month:"long"}),year:e({year:"numeric"}),date:e({dateStyle:"full"}),headline:e({day:"numeric",month:"short",year:"numeric"}),day:e({day:"numeric"}),weekday:e({weekday:"narrow"}),weekdayLong:e({weekday:"long"}),entry:ze(r)};}function ze(r){const e=new Intl.DateTimeFormat(r,{calendar:"gregory",day:"2-digit",month:"2-digit",timeZone:"UTC",year:"numeric"}),t=e.formatToParts(D(U)),n=t.map(o=>o.type).filter(o=>o==="year"||o==="month"||o==="day"),a=t.filter(o=>o.type==="literal").flatMap(o=>Array.from(o.value)).find(o=>!se.test(o))??Be,s=new Intl.NumberFormat(r,{numberingSystem:e.resolvedOptions().numberingSystem});return{fields:n,delimiter:a,pattern:n.map(o=>Je[o]).join(a),digits:Array.from({length:10},(o,i)=>s.format(i))};}function C(r,e){const t={year:r.slice(0,4),month:r.slice(5,7),day:r.slice(8,10)};return D(r)===void 0?"":e.fields.map(n=>t[n]).join("");}function K(r,e){const t=e.digits.indexOf(r);return t>=0?String(t):Xe.test(r)?r:void 0;}function Qe(r,e){let t="";for(const n of r){const a=K(n,e);if(a!==void 0)t+=a;else if(n!==e.delimiter&&!se.test(n))return;}return t;}function Q(r,e){return Array.from(r).filter(t=>K(t,e)!==void 0).length;}function et(r,e){let t="",n=0;for(const a of e.fields){const s=n+$[a];for(const o of r.slice(n,s))t+=e.digits[Number(o)];r.length>s&&(t+=e.delimiter),n=s;}return t;}function ee(r,e){const t={year:"",month:"",day:""};let n=0;for(const a of e.fields)t[a]=r.slice(n,n+$[a]),n+=$[a];return F(`${t.year}-${t.month}-${t.day}`,"");}function tt(r,e,t){let n=0,a=0;for(const s of r){if(n===e)return a;K(s,t)!==void 0&&n++,a+=s.length;}return a;}function m(r,e){return r.format(D(e.length===7?`${e}-01`:e));}class nt{range;today;props;selection;minimum;maximum;format;firstDay;month;focused;inputMode;overlay;yearsShown;focusedYear;drafts;errors;listStart;windowStart;#a;#u;#h;#m;#s;#t;#n;#o;#i;#c;#e;#d;#D;#f;constructor(e,t,n,a,s,o){const[i,c]=w(n),l=y(()=>F(e.min,Ve)),d=y(()=>F(e.max,Ue)),h=u(()=>F(e.today,We())),f=u(()=>D(n[0])===void 0?h:n[0]),S=u(()=>this.#g(f,l(),d())),R=u(()=>{const b=`${e.defaultMonth}-01`;return D(b)===void 0?S.slice(0,7):this.#g(b,l(),d()).slice(0,7);}),[I,ye]=w(R),[pe,De]=w(S),[be,we]=w(u(()=>e.defaultDisplayMode==="input")),[ve,Pe]=w("none"),[Se,ke]=w(!1),[Ee,Me]=w(Number(R.slice(0,4))),O=y(()=>je(e.locale??Z)),B=u(O).entry,[Te,Re]=w([C(n[0],B),C(n[1],B)]),[Ce,Ae]=w([void 0,void 0]),[Le,Ie]=w(g(R)),[Fe,Oe]=w(g(R));this.range=s,this.today=h,this.props=e,this.selection=y(()=>a?t():i(),n,{equals:(b,X)=>b[0]===X[0]&&b[1]===X[1]}),this.minimum=l,this.maximum=d,this.format=O,this.firstDay=y(()=>e.firstDayOfWeek??Ze(e.locale??Z)),this.month=I,this.focused=pe,this.inputMode=be,this.overlay=ve,this.yearsShown=Se,this.focusedYear=Ee,this.drafts=Te,this.errors=Ce,this.listStart=Le,this.windowStart=Fe,this.#a=a,this.#u=n,this.#h=o,this.#m=c,this.#s=ye,this.#t=De,this.#n=we,this.#o=Pe,this.#i=ke,this.#c=Me,this.#e=Re,this.#d=Ae,this.#D=Ie,this.#f=Oe,x(Y(()=>this.selection()[0],b=>{D(b)!==void 0&&(this.#t(b),this.continuous()||this.#s(b.slice(0,7)));},{defer:!0})),x(Y(this.selection,b=>this.#b(b),{defer:!0})),x(Y(O,()=>this.#r(this.selection()),{defer:!0}));}#g(e,t,n){return e<t?t:e>n?n:e;}label(e){return this.props.labels?.[e]??$e[e];}docked(){return this.props.presentation==="docked";}continuous(){return this.range&&!this.docked()&&this.props.rangeLayout!=="paged";}minimumMonth(){return g(this.minimum());}maximumMonth(){return g(this.maximum());}listEnd(){return Math.min(this.maximumMonth(),this.listStart()+N-1);}windowMonths(){const e=this.windowStart(),t=Math.max(0,Math.min(j,this.listEnd()-e+1));return Array.from({length:t},(n,a)=>V(e+a));}isSelectable(e){return D(e)!==void 0&&e>=this.minimum()&&e<=this.maximum()&&this.props.disabled!==!0&&this.props.isDateDisabled?.(e)!==!0;}flagsOf(e,t,n){const[a,s]=this.selection(),o=this.range&&a!==""&&s!=="";return e===""?0:(e===a||e===s?1:0)|(o&&e===a?2:0)|(o&&e===s?4:0)|(o&&e>=a&&e<=s?8:0)|(e===this.today?16:0)|(t?0:32)|(e.slice(0,7)===n?0:64);}daysOf(e){const t=`${e}-01`,n=(D(t).getUTCDay()-this.firstDay()+p)%p,a=this.docked();return Array.from({length:re*p},(s,o)=>{const i=A(t,o-n);return a||i.slice(0,7)===e?i:"";});}#y(e,t){this.props.disabled===!0||this.props.readOnly===!0||(this.#a||this.#m(e),this.#h(e,t));}select(e,t){const[n,a]=this.selection();this.isSelectable(e)&&this.#y(this.range&&n!==""&&a===""&&e>=n?[n,e]:[e,""],t);}showMonth(e){const t=this.#g(`${e}-01`,this.minimum(),this.maximum());v(()=>{this.#s(t.slice(0,7)),this.#t(t);});}focus(e){v(()=>{this.#t(e),this.continuous()||this.#s(e.slice(0,7));});}trackFocus(e){this.#t(e);}scrollTo(e){const t=V(k(e,this.minimumMonth(),this.maximumMonth()));t!==u(this.month)&&this.#s(t);}centerList(e){const t=k(e-N/2,this.minimumMonth(),Math.max(this.minimumMonth(),this.maximumMonth()-N+1));this.#D(t);}renderFrom(e){const t=k(e,this.listStart(),Math.max(this.listStart(),this.listEnd()-j+1));t!==u(this.windowStart)&&this.#f(t);}setInputMode(e){v(()=>{this.#o("none"),this.#r(this.selection()),this.#n(e);});}setOverlay(e){v(()=>{e==="years"&&(this.#c(Number(this.month().slice(0,4))),this.#i(!0)),this.#o(e);});}years(){return[Number(this.minimum().slice(0,4)),Number(this.maximum().slice(0,4))];}yearPage(){const[e,t]=this.years(),n=this.focusedYear()-(_-1)/2,a=k(n,e,Math.max(e,t-_+1));return[a,Math.min(t,a+_-1)];}focusYear(e){const[t,n]=this.years();this.#c(k(e,t,n));}edit(e,t,n){const a=this.selection(),s=e===0?[t,this.drafts()[1]]:[this.drafts()[0],t],o=[this.#p(s[0]),this.#p(s[1])],i=[this.#l(s[0],o[0]),this.#l(s[1],o[1])];this.range&&i[0]!==""&&i[1]!==""&&i[0]>i[1]&&(o[e]=this.label("invalidRange"),i[e]=""),v(()=>{this.#e(s),this.#d(o);}),(i[0]!==a[0]||i[1]!==a[1])&&this.#y(i,n);}#p(e){const t=this.format(),n=ee(e,t.entry),a=n.slice(0,4);if(!(e.length<ae))return n===""?H(this.label("invalidPattern"),{pattern:t.entry.pattern}):a<this.minimum().slice(0,4)||a>this.maximum().slice(0,4)?H(this.label("invalidYearRange"),{start:m(t.year,this.minimum()),end:m(t.year,this.maximum())}):this.isSelectable(n)?void 0:H(this.label("notAllowed"),{date:m(t.headline,n)});}#l(e,t){return t===void 0?ee(e,this.format().entry):"";}#r(e){const t=this.format().entry,[n,a]=e;v(()=>{this.#e([C(n,t),C(a,t)]),this.#d([void 0,void 0]);});}#b(e){const t=this.format().entry,n=this.drafts(),a=this.errors(),s=o=>this.#l(n[o],a[o])===e[o];s(0)&&s(1)||v(()=>{this.#e([s(0)?n[0]:C(e[0],t),s(1)?n[1]:C(e[1],t)]),this.#d([s(0)?a[0]:void 0,s(1)?a[1]:void 0]);});}reset(){v(()=>{this.#a||this.#m(this.#u),this.#r(this.#a?this.selection():this.#u);});}}const rt=Array.from({length:re},(r,e)=>e),J=Array.from({length:p},(r,e)=>e),at=Array.from({length:12},(r,e)=>e);function ie(r){const e=y(()=>{const a=r.focused(),s=r.continuous()?r.windowMonths():[r.month()];if(s.includes(a.slice(0,7))&&r.isSelectable(a))return a;for(const o of s)for(let i=`${o}-01`;i.startsWith(o);i=A(i,1))if(r.isSelectable(i))return i;return a;}),t=G(e),n=G(r.focusedYear);return{model:r,isTabStop:t,isYearStop:n,descriptionId:q(),yearDescriptionId:q()};}function L(r){return<button aria-label={r.label}class={r.class}data-cw-action={r.action}disabled={r.disabled}type="button">{r.children}</button>;}function st(r){const e=r.model,t=()=>e.label(e.inputMode()?e.range?"enterRange":"enterDate":e.range?"selectRange":"selectDate"),n=()=>{const a=e.format().headline,[s,o]=e.selection(),i=(d,h)=>D(d)===void 0?h:m(a,d),c=e.inputMode()?"enteredDate":"selectedDate",l=i(s,e.label(e.range?"startDate":c));return e.range?`${l} \u2013 ${i(o,e.label("endDate"))}`:l;};return<>
2
2
  <div class="cw-DatePicker-header">
3
3
  <span class="cw-DatePicker-title">{t()}</span>
4
4
  <div class="cw-DatePicker-headlineRow">
5
5
  <span class="cw-DatePicker-headline"aria-live="polite">{n()}</span>
6
- {L({action:"mode",class:"cw-DatePicker-iconButton cw-DatePicker-mode",get label(){const a=e.inputMode()?"switchToCalendar":"switchToInput";return e.label(a)},get disabled(){return e.props.disabled},get children(){return<E name={e.inputMode()?"calendar_today":"edit"}/>}})}
6
+ {L({action:"mode",class:"cw-DatePicker-iconButton cw-DatePicker-mode",get label(){const a=e.inputMode()?"switchToCalendar":"switchToInput";return e.label(a);},get disabled(){return e.props.disabled;},get children(){return<E name={e.inputMode()?"calendar_today":"edit"}/>;}})}
7
7
  </div>
8
8
  </div>
9
9
  <div class="cw-DatePicker-divider"aria-hidden="true"/>
10
- </>}function ot(r){const e=r.model,t=()=>e.overlay()==="years",n=()=>g(e.month());return<div class="cw-DatePicker-navigation">
10
+ </>;}function ot(r){const e=r.model,t=()=>e.overlay()==="years",n=()=>g(e.month());return<div class="cw-DatePicker-navigation">
11
11
  <button aria-describedby={r.descriptionId}aria-expanded={t()?"true":"false"}class="cw-DatePicker-yearToggle"data-cw-action="years"disabled={e.props.disabled}type="button">
12
12
  <span>{m(e.format().monthYear,e.month())}</span>
13
13
  <E name={t()?"arrow_drop_up":"arrow_drop_down"}/>
@@ -16,12 +16,12 @@ import{For as P,Show as M,batch as v,createMemo as y,createRenderEffect as x,cre
16
16
  {e.label(t()?"daySelection":"yearSelection")}
17
17
  </span>
18
18
  <span class="cw-DatePicker-arrows"hidden={t()}>
19
- {L({action:"previousMonth",class:"cw-DatePicker-iconButton",get label(){return e.label("previousMonth")},get disabled(){return e.props.disabled===!0||n()<=e.minimumMonth()},children:<E autoMirror name="chevron_left"/>})}
20
- {L({action:"nextMonth",class:"cw-DatePicker-iconButton",get label(){return e.label("nextMonth")},get disabled(){return e.props.disabled===!0||n()>=e.maximumMonth()},children:<E autoMirror name="chevron_right"/>})}
19
+ {L({action:"previousMonth",class:"cw-DatePicker-iconButton",get label(){return e.label("previousMonth");},get disabled(){return e.props.disabled===!0||n()<=e.minimumMonth();},children:<E autoMirror name="chevron_left"/>})}
20
+ {L({action:"nextMonth",class:"cw-DatePicker-iconButton",get label(){return e.label("nextMonth");},get disabled(){return e.props.disabled===!0||n()>=e.maximumMonth();},children:<E autoMirror name="chevron_right"/>})}
21
21
  </span>
22
- </div>}function it(r){const e=r.model,t=()=>g(e.month()),n=()=>e.overlay()!=="none",a=(s,o,i,c)=>{const l=s==="Month"?"months":"years",d=h=>e.props.disabled===!0||h<e.minimumMonth()||h>e.maximumMonth();return<span class="cw-DatePicker-menuGroup">
22
+ </div>;}function it(r){const e=r.model,t=()=>g(e.month()),n=()=>e.overlay()!=="none",a=(s,o,i,c)=>{const l=s==="Month"?"months":"years",d=h=>e.props.disabled===!0||h<e.minimumMonth()||h>e.maximumMonth();return<span class="cw-DatePicker-menuGroup">
23
23
  <span class="cw-DatePicker-arrows"hidden={n()}>
24
- {L({action:`previous${s}`,class:"cw-DatePicker-iconButton",get label(){return e.label(s==="Month"?"previousMonth":"previousYear")},get disabled(){return d(t()-o)},children:<E autoMirror name="chevron_left"/>})}
24
+ {L({action:`previous${s}`,class:"cw-DatePicker-iconButton",get label(){return e.label(s==="Month"?"previousMonth":"previousYear");},get disabled(){return d(t()-o);},children:<E autoMirror name="chevron_left"/>})}
25
25
  </span>
26
26
  <button aria-describedby={i}aria-expanded={e.overlay()===l?"true":"false"}aria-haspopup="listbox"class="cw-DatePicker-menuButton"data-cw-action={l}disabled={e.props.disabled===!0||n()&&e.overlay()!==l}type="button">
27
27
  <span>{c()}</span>
@@ -29,27 +29,27 @@ import{For as P,Show as M,batch as v,createMemo as y,createRenderEffect as x,cre
29
29
  </button>
30
30
  <span id={i}hidden>{e.label(s==="Month"?"month":"year")}</span>
31
31
  <span class="cw-DatePicker-arrows"hidden={n()}>
32
- {L({action:`next${s}`,class:"cw-DatePicker-iconButton",get label(){return e.label(s==="Month"?"nextMonth":"nextYear")},get disabled(){return d(t()+o)},children:<E autoMirror name="chevron_right"/>})}
32
+ {L({action:`next${s}`,class:"cw-DatePicker-iconButton",get label(){return e.label(s==="Month"?"nextMonth":"nextYear");},get disabled(){return d(t()+o);},children:<E autoMirror name="chevron_right"/>})}
33
33
  </span>
34
- </span>};return<div class="cw-DatePicker-navigation">
34
+ </span>;};return<div class="cw-DatePicker-navigation">
35
35
  {a("Month",1,r.descriptionId,()=>m(e.format().monthShort,e.month()))}
36
36
  {a("Year",12,r.yearDescriptionId,()=>m(e.format().year,e.month()))}
37
- </div>}function ct(r){const e=t=>A(U,(r.firstDay()+t)%p);return<thead>
37
+ </div>;}function ct(r){const e=t=>A(U,(r.firstDay()+t)%p);return<thead>
38
38
  <tr>
39
39
  <P each={J}>{t=><th aria-label={m(r.format().weekdayLong,e(t))}scope="col">{m(r.format().weekday,e(t))}</th>}</P>
40
40
  </tr>
41
- </thead>}function dt(r,e,t,n){const a=r.model,s=y(()=>e()[t]),o=y(()=>a.isSelectable(s())),i=y(()=>a.flagsOf(s(),o(),n())),c=d=>(i()&d)!==0,l=()=>s()==="";return<td aria-current={c(16)?"date":void 0}aria-disabled={!l()&&c(32)?"true":void 0}aria-label={l()?void 0:m(a.format().date,s())}aria-selected={l()?void 0:c(1)||c(8)}class="cw-DatePicker-date"classList={{"cw-DatePicker-selected":c(1),"cw-DatePicker-inRange":c(8),"cw-DatePicker-rangeStart":c(2),"cw-DatePicker-rangeEnd":c(4),"cw-DatePicker-today":c(16),"cw-DatePicker-outside":c(64)}}data-cw-date={l()?void 0:s()}data-cw-initial-focus={!l()&&r.isTabStop(s())?"":void 0}role="gridcell"tabIndex={l()?void 0:r.isTabStop(s())?0:-1}>
41
+ </thead>;}function dt(r,e,t,n){const a=r.model,s=y(()=>e()[t]),o=y(()=>a.isSelectable(s())),i=y(()=>a.flagsOf(s(),o(),n())),c=d=>(i()&d)!==0,l=()=>s()==="";return<td aria-current={c(16)?"date":void 0}aria-disabled={!l()&&c(32)?"true":void 0}aria-label={l()?void 0:m(a.format().date,s())}aria-selected={l()?void 0:c(1)||c(8)}class="cw-DatePicker-date"classList={{"cw-DatePicker-selected":c(1),"cw-DatePicker-inRange":c(8),"cw-DatePicker-rangeStart":c(2),"cw-DatePicker-rangeEnd":c(4),"cw-DatePicker-today":c(16),"cw-DatePicker-outside":c(64)}}data-cw-date={l()?void 0:s()}data-cw-initial-focus={!l()&&r.isTabStop(s())?"":void 0}role="gridcell"tabIndex={l()?void 0:r.isTabStop(s())?0:-1}>
42
42
  <span class="cw-DatePicker-day">
43
43
  {l()?"":m(a.format().day,s())}
44
44
  </span>
45
- </td>}function ce(r,e){const t=r.model,n=y(()=>t.daysOf(e()));return<table aria-label={m(t.format().monthYear,e())}aria-multiselectable={t.range?"true":void 0}aria-readonly={t.props.readOnly===!0?"true":void 0}class="cw-DatePicker-grid"role="grid">
45
+ </td>;}function ce(r,e){const t=r.model,n=y(()=>t.daysOf(e()));return<table aria-label={m(t.format().monthYear,e())}aria-multiselectable={t.range?"true":void 0}aria-readonly={t.props.readOnly===!0?"true":void 0}class="cw-DatePicker-grid"role="grid">
46
46
  {ct(t)}
47
47
  <tbody>
48
48
  <P each={rt}>{a=><tr>
49
49
  <P each={J}>{s=>dt(r,n,a*p+s,e)}</P>
50
50
  </tr>}</P>
51
51
  </tbody>
52
- </table>}function lt(r){const e=r.model,t=()=>e.listEnd()-e.windowStart()-e.windowMonths().length+1;return<>
52
+ </table>;}function lt(r){const e=r.model,t=()=>e.listEnd()-e.windowStart()-e.windowMonths().length+1;return<>
53
53
  <div class="cw-DatePicker-weekdays"aria-hidden="true">
54
54
  <P each={J}>{n=><span>
55
55
  {m(e.format().weekday,A(U,(e.firstDay()+n)%p))}
@@ -63,7 +63,7 @@ import{For as P,Show as M,batch as v,createMemo as y,createRenderEffect as x,cre
63
63
  </section>}</P>
64
64
  <div class="cw-DatePicker-spacer"style={{"--cw-datepicker-months":t()}}/>
65
65
  </div>
66
- </>}function ut(r){const e=r.model,t=y(()=>{const[a,s]=e.yearPage(),o=s-a+1;return Array.from({length:Math.ceil(o/T)},(i,c)=>Array.from({length:Math.min(T,o-c*T)},(l,d)=>a+c*T+d))}),n=()=>Number(e.month().slice(0,4));return<table aria-label={e.label("year")}class="cw-DatePicker-yearGrid"role="grid">
66
+ </>;}function ut(r){const e=r.model,t=y(()=>{const[a,s]=e.yearPage(),o=s-a+1;return Array.from({length:Math.ceil(o/T)},(i,c)=>Array.from({length:Math.min(T,o-c*T)},(l,d)=>a+c*T+d));}),n=()=>Number(e.month().slice(0,4));return<table aria-label={e.label("year")}class="cw-DatePicker-yearGrid"role="grid">
67
67
  <tbody>
68
68
  <P each={t()}>{a=><tr>
69
69
  <P each={a}>{s=><td aria-selected={s===n()}class="cw-DatePicker-year"classList={{"cw-DatePicker-selected":s===n(),"cw-DatePicker-current":s===Number(e.today.slice(0,4))}}data-cw-year={s}role="gridcell"tabIndex={r.isYearStop(s)?0:-1}>
@@ -73,14 +73,14 @@ import{For as P,Show as M,batch as v,createMemo as y,createRenderEffect as x,cre
73
73
  </td>}</P>
74
74
  </tr>}</P>
75
75
  </tbody>
76
- </table>}function te(r,e){const t=r.model,n=y(()=>{const[o,i]=t.yearPage();return e==="months"?at:Array.from({length:i-o+1},(c,l)=>o+l)}),a=o=>e==="months"?Number(t.month().slice(5,7))-1===o:Number(t.month().slice(0,4))===o,s=o=>{const i=`2023-${String(o+1).padStart(2,"0")}`,c=`${String(o).padStart(4,"0")}-01`;return e==="months"?m(t.format().monthLong,i):m(t.format().year,c)};return<ul aria-label={t.label(e==="months"?"month":"year")}class="cw-DatePicker-menu"role="listbox">
76
+ </table>;}function te(r,e){const t=r.model,n=y(()=>{const[o,i]=t.yearPage();return e==="months"?at:Array.from({length:i-o+1},(c,l)=>o+l);}),a=o=>e==="months"?Number(t.month().slice(5,7))-1===o:Number(t.month().slice(0,4))===o,s=o=>{const i=`2023-${String(o+1).padStart(2,"0")}`,c=`${String(o).padStart(4,"0")}-01`;return e==="months"?m(t.format().monthLong,i):m(t.format().year,c);};return<ul aria-label={t.label(e==="months"?"month":"year")}class="cw-DatePicker-menu"role="listbox">
77
77
  <P each={n()}>{o=><li aria-selected={a(o)}class="cw-DatePicker-menuItem"data-cw-option={e==="months"?`month-${o}`:`year-${o}`}role="option"tabIndex={(e==="months"?a(o):r.isYearStop(o))?0:-1}>
78
78
  <span class="cw-DatePicker-menuCheck">
79
79
  <M when={a(o)}><E name="check"/></M>
80
80
  </span>
81
81
  <span>{s(o)}</span>
82
82
  </li>}</P>
83
- </ul>}function mt(r){const e=r.model,t=<M when={e.docked()}fallback={ot(r)}>
83
+ </ul>;}function mt(r){const e=r.model,t=<M when={e.docked()}fallback={ot(r)}>
84
84
  {it(r)}
85
85
  </M>,n=<div class="cw-DatePicker-days"inert={e.overlay()!=="none"||void 0}>
86
86
  <M when={e.continuous()}fallback={ce(r,e.month)}>
@@ -97,8 +97,8 @@ import{For as P,Show as M,batch as v,createMemo as y,createRenderEffect as x,cre
97
97
  </div>;return<div class="cw-DatePicker-picker"hidden={e.inputMode()}>
98
98
  {t}
99
99
  <div class="cw-DatePicker-body">{n}{a}{s}</div>
100
- </div>}function ht(r,e,t,n){const a=n.target,s=r.format().entry,o=r.drafts()[e],i=Qe(t,s),c=i===void 0||i.length>ae,l=Q(t,s)-o.length,d=Q(t.slice(0,a.selectionStart??t.length),s),h=n.inputType,f=i!==o?-1:h==="deleteContentBackward"?d-1:h==="deleteContentForward"?d:-1,S=c?o:f>=0?o.slice(0,f)+o.slice(f+1):i,R=c?d-Math.max(0,l):f>=0?f:d;S!==o&&r.edit(e,S,n),queueMicrotask(()=>{const I=tt(a.value,R,s);a.ownerDocument.activeElement===a&&a.setSelectionRange(I,I)})}function ft(r){const e=r.model,t=n=>e.label(e.range?n===0?"startDate":"endDate":"date");return<div class="cw-DatePicker-inputs"hidden={!e.inputMode()}>
100
+ </div>;}function ht(r,e,t,n){const a=n.target,s=r.format().entry,o=r.drafts()[e],i=Qe(t,s),c=i===void 0||i.length>ae,l=Q(t,s)-o.length,d=Q(t.slice(0,a.selectionStart??t.length),s),h=n.inputType,f=i!==o?-1:h==="deleteContentBackward"?d-1:h==="deleteContentForward"?d:-1,S=c?o:f>=0?o.slice(0,f)+o.slice(f+1):i,R=c?d-Math.max(0,l):f>=0?f:d;S!==o&&r.edit(e,S,n),queueMicrotask(()=>{const I=tt(a.value,R,s);a.ownerDocument.activeElement===a&&a.setSelectionRange(I,I);});}function ft(r){const e=r.model,t=n=>e.label(e.range?n===0?"startDate":"endDate":"date");return<div class="cw-DatePicker-inputs"hidden={!e.inputMode()}>
101
101
  <P each={e.range?[0,1]:[0]}>{n=><He autocomplete="off"disabled={e.props.disabled}errorText={e.errors()[n]}inputMode="numeric"label={t(n)}onValueChange={(a,s)=>ht(e,n,a,s)}placeholder={e.format().entry.pattern}readOnly={e.props.readOnly}spellCheck={!1}value={et(e.drafts()[n],e.format().entry)}variant="outlined"/>}</P>
102
- </div>}function gt(r){return<P each={r.range?[0,1]:[0]}>{e=><input disabled={r.props.disabled===!0||r.props.name===void 0}form={r.props.form}name={r.props.name}type="hidden"value={r.selection()[e]}/>}</P>}function de(r){const e=r.model,t=<M when={!e.docked()}>{st(r)}</M>,n=mt(r),a=ft(r),s=gt(e),o=<div class="cw-DatePicker-panes">{n}{a}</div>;return<>{t}{o}{s}</>}function le(r){return{"cw-DatePicker":!0,"cw-DateRangePicker":r.range,"cw-DatePicker-docked":r.docked(),"cw-DatePicker-disabled":r.props.disabled===!0,"_cw-DatePicker-continuous":r.continuous()}}const ue={range:!1,valueOf:(r,e)=>[(e?r.defaultValue:r.value)??"",""],notify:(r,e,t)=>r.onChange?.(e[0],t)},me={range:!0,valueOf:(r,e)=>(e?r.defaultValue:r.value)??["",""],notify:(r,e,t)=>r.onChange?.(e,t)};function he(r,e){const t="value"in r;return new nt(r,()=>e.valueOf(r,!1),u(()=>e.valueOf(r,!t)),t,e.range,(n,a)=>e.notify(r,n,a))}function fe(r){return(e,t)=>{const n=he(t,r),a=de(ie(n)),s=e,o=Object.fromEntries(Object.keys(s).filter(i=>i!=="children").map(i=>[i,s[i]]));return<div{...o}classList={{...o.classList,...le(n)}}data-cw-calendar="">{a}{e.children}</div>}}class ge extends _e{#a;#u;#h;#m;#s;#t;#n;#o;#i;#c;constructor(e,t){super(e,{styleElementIsFunction:!0}),this.#a=ie(he(e,t)),this.#u=n=>this.#C(n),this.#h=n=>this.#L(n),this.#m=n=>this.#A(n),this.#s=n=>{n.target.classList?.contains("cw-DatePicker-months")===!0&&this.#b(n.target)},this.#t=void 0,this.#n=!1,this.#o=void 0,this.#i=!1,this.#c=()=>{},Ye(()=>this.#D()),xe(()=>this.#c())}get#e(){return this.#a.model}#d(){return this.functionElement?.querySelector(".cw-DatePicker-inputs input")?.matches(":disabled")===!0}#D(){const e=this.functionElement,t=e?.ownerDocument.defaultView,n=e?.querySelector(":scope > input[type=hidden]"),a=t?.ResizeObserver,s=n==null?()=>{}:Ne(n,()=>this.#e.reset()),o=a===void 0?void 0:new a(i=>this.#g(i));this.#o=o,this.#c=()=>{s(),o?.disconnect()},this.#f(),this.#e.continuous()&&this.#r(g(u(this.#e.month)),"top")}#f(){const e=this.functionElement,t=this.#y(),n=this.#o;if(!(e===null||n===void 0)&&(n.disconnect(),n.observe(e),t!==null)){n.observe(t);for(const a of Array.from(t.querySelectorAll(":scope > .cw-DatePicker-spacer")))n.observe(a)}}#g(e){const t=e.every(n=>n.target.classList.contains("cw-DatePicker-spacer"));(this.#n||!t)&&this.#l()}#y(){return this.functionElement?.querySelector(".cw-DatePicker-months")??null}#p(e){return e.querySelector(".cw-DatePicker-month")?.offsetHeight??0}#l(){const e=this.#e,t=this.#y(),n=this.#t;if(t===null||n===void 0)return;const a=this.#p(t),s=t.firstElementChild?.style.getPropertyValue("--cw-datepicker-months");this.#n=a===0||s!==String(e.windowStart()-e.listStart()),this.#n||(t.scrollTop=(n-e.listStart())*a)}#r(e,t){const n=this.#e;v(()=>{(!this.#i||e<n.listStart()||e>n.listEnd())&&n.centerList(e),n.renderFrom(t==="top"?e:e-1),t==="top"&&n.scrollTo(e)}),this.#i=!0,t==="top"&&(this.#t=k(e,n.listStart(),n.listEnd()),this.#l(),this.#n&&queueMicrotask(()=>this.#l()))}#b(e){const t=this.#e,n=this.#p(e),a=e.ownerDocument.activeElement;if(n===0||this.#n)return;const s=t.listStart()+e.scrollTop/n,o=Math.floor(s);this.#t=s,v(()=>{t.scrollTo(o),t.renderFrom(o)}),a!==null&&!a.isConnected&&e.focus({preventScroll:!0})}#S(e){return this.functionElement?.querySelector(`.cw-DatePicker-days [data-cw-date="${e}"]`)??null}#w(){this.functionElement?.querySelector(".cw-DatePicker-days [data-cw-date][tabindex='0']")?.focus()}#k(e,t){const n=this.functionElement,a=n?.querySelector(".cw-DatePicker-days > .cw-DatePicker-grid");if(n==null||a===null||a===void 0||!n.isConnected){t();return}const s=a.cloneNode(!0),i=(n.ownerDocument.defaultView?.getComputedStyle(n).direction==="rtl"?-e:e)*100,c={duration:"--cw-datepicker-page-duration",easing:"--cw-datepicker-page-easing"};s.removeAttribute("role"),s.setAttribute("aria-hidden","true"),s.classList.add("_cw-DatePicker-ghost"),s.inert=!0;for(const l of Array.from(s.querySelectorAll("[data-cw-date]")))for(const d of["data-cw-date","data-cw-initial-focus","role","tabindex"])l.removeAttribute(d);a.after(s),t(),W(a,[{translate:`${i}% 0`},{translate:"0 0"}],c),W(s,[{translate:"0 0"},{translate:`${-i}% 0`}],c).finished.then(()=>s.remove(),()=>s.remove())}#M(e){const t=this.#e,n=u(t.month);t.continuous()?(this.#r(g(e),"top"),t.focus(`${e}-01`)):e!==n&&this.#k(e>n?1:-1,()=>t.showMonth(e))}#T(e){const t=this.#e,n=e.slice(0,7),a=u(t.month);t.continuous()?(t.focus(e),this.#S(e)===null&&this.#r(g(n),"nearest")):n!==a?this.#k(n>a?1:-1,()=>t.focus(e)):t.focus(e);const s=this.#S(e);s?.focus({preventScroll:!0}),s?.scrollIntoView({block:"nearest",inline:"nearest"})}#v(e){const t=this.#e,n=this.functionElement;if(t.setOverlay(e),e==="none"){this.#w();return}const a=n?.querySelector(`.cw-DatePicker-${e==="years"?"years":"monthMenu"} [tabindex='0']`);a?.focus({preventScroll:!0}),a?.scrollIntoView({block:"center",inline:"nearest"})}#P(e){const t=this.#e;if(t.continuous()){t.setOverlay("none"),this.#r(g(e),"top"),t.focus(`${e}-01`),this.#w();return}t.showMonth(e),this.#v("none")}#R(e){const t=this.#e,n=u(t.month),a=this.functionElement,s={previousMonth:-1,nextMonth:1,previousYear:-12,nextYear:12};e in s?this.#M(V(g(n)+s[e])):e==="years"||e==="months"?this.#v(u(t.overlay)===e?"none":e):e==="mode"&&(t.setInputMode(!u(t.inputMode)),u(t.inputMode)?a?.querySelector(".cw-DatePicker-inputs input")?.focus():this.#w())}#C(e){const n=e.target.closest("[data-cw-date], [data-cw-year], [data-cw-option], [data-cw-action]")?.dataset,a=u(this.#e.month);n===void 0||e.defaultPrevented||this.#d()||(n.cwDate!==void 0?this.#e.select(n.cwDate,e):n.cwYear!==void 0?this.#P(`${n.cwYear.padStart(4,"0")}${a.slice(4)}`):n.cwOption!==void 0?this.#E(n.cwOption):n.cwAction!==void 0&&this.#R(n.cwAction))}#E(e){const t=u(this.#e.month),[n,a]=e.split("-");this.#P(n==="month"?`${t.slice(0,5)}${String(Number(a)+1).padStart(2,"0")}`:`${a.padStart(4,"0")}${t.slice(4)}`)}#A(e){const t=e.target.dataset;t?.cwDate!==void 0?this.#e.trackFocus(t.cwDate):t?.cwYear!==void 0&&this.#e.focusYear(Number(t.cwYear))}#L(e){const t=e.target,n=t.dataset;if(!(e.defaultPrevented||this.#d()))if(e.key==="Escape"&&u(this.#e.overlay)!=="none"){const a=this.functionElement?.querySelector(`[data-cw-action="${u(this.#e.overlay)}"]`);e.preventDefault(),this.#v("none"),this.#e.docked()&&a?.focus()}else n.cwDate!==void 0?this.#I(e,t,n.cwDate):n.cwYear!==void 0?this.#F(e,t,Number(n.cwYear)):n.cwOption!==void 0&&this.#O(e,t)}#I(e,t,n){const a=this.#e,o=t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl"?-1:1,i=(D(n).getUTCDay()-a.firstDay()+p)%p,c=e.shiftKey?12:1,d={ArrowRight:[o,0],ArrowLeft:[-o,0],ArrowDown:[p,0],ArrowUp:[-p,0],Home:[-i,0],End:[p-1-i,0],PageDown:[0,c],PageUp:[0,-c]}[e.key];if(e.key==="Enter"||e.key===" "){e.preventDefault(),a.select(n,e);return}if(d===void 0)return;e.preventDefault();const h=d[0]<0||d[1]<0?-1:1;for(let f=A(n,d[0],d[1]),S=0;S<Ke&&f>=a.minimum()&&f<=a.maximum();f=A(f,h),S++)if(a.isSelectable(f)){this.#T(f);return}}#F(e,t,n){const a=this.#e,s=t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl",[o,i]=a.years(),c=T*4,d={ArrowRight:n+(s?-1:1),ArrowLeft:n+(s?1:-1),ArrowDown:n+T,ArrowUp:n-T,Home:o,End:i,PageDown:n+c,PageUp:n-c}[e.key];if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.#P(`${String(n).padStart(4,"0")}${u(a.month).slice(4)}`);return}if(d===void 0)return;e.preventDefault(),a.focusYear(d);const h=this.functionElement?.querySelector(`.cw-DatePicker-years [data-cw-year="${k(d,o,i)}"]`);h?.focus({preventScroll:!0}),h?.scrollIntoView({block:"nearest",inline:"nearest"})}#O(e,t){const n=Array.from(t.parentElement?.querySelectorAll("[data-cw-option]")??[]),a=n.indexOf(t),o={ArrowDown:a+1,ArrowUp:a-1,Home:0,End:n.length-1}[e.key];if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.#E(t.dataset.cwOption);return}if(o===void 0)return;e.preventDefault();const i=n[k(o,0,n.length-1)];for(const c of n)c.tabIndex=c===i?0:-1;i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"})}applyComponentProps(){const e=super.readProps(["disabled","presentation","rangeLayout"]),t=this.#e,n=e.presentationChanged||e.rangeLayoutChanged;if(e.disabledChanged||n)for(const[a,s]of Object.entries(le(t)))this.setClass(a,s);n&&this.functionElement?.isConnected===!0&&(this.#i=!1,queueMicrotask(()=>{this.#f(),t.continuous()&&this.#r(g(u(t.month)),"top")}))}render(e){const t=de(this.#a),n=<div class="cw-DatePicker"data-cw-calendar="">
102
+ </div>;}function gt(r){return<P each={r.range?[0,1]:[0]}>{e=><input disabled={r.props.disabled===!0||r.props.name===void 0}form={r.props.form}name={r.props.name}type="hidden"value={r.selection()[e]}/>}</P>;}function de(r){const e=r.model,t=<M when={!e.docked()}>{st(r)}</M>,n=mt(r),a=ft(r),s=gt(e),o=<div class="cw-DatePicker-panes">{n}{a}</div>;return<>{t}{o}{s}</>;}function le(r){return{"cw-DatePicker":!0,"cw-DateRangePicker":r.range,"cw-DatePicker-docked":r.docked(),"cw-DatePicker-disabled":r.props.disabled===!0,"_cw-DatePicker-continuous":r.continuous()};}const ue={range:!1,valueOf:(r,e)=>[(e?r.defaultValue:r.value)??"",""],notify:(r,e,t)=>r.onChange?.(e[0],t)},me={range:!0,valueOf:(r,e)=>(e?r.defaultValue:r.value)??["",""],notify:(r,e,t)=>r.onChange?.(e,t)};function he(r,e){const t="value"in r;return new nt(r,()=>e.valueOf(r,!1),u(()=>e.valueOf(r,!t)),t,e.range,(n,a)=>e.notify(r,n,a));}function fe(r){return(e,t)=>{const n=he(t,r),a=de(ie(n)),s=e,o=Object.fromEntries(Object.keys(s).filter(i=>i!=="children").map(i=>[i,s[i]]));return<div{...o}classList={{...o.classList,...le(n)}}data-cw-calendar="">{a}{e.children}</div>;};}class ge extends _e{#a;#u;#h;#m;#s;#t;#n;#o;#i;#c;constructor(e,t){super(e,{styleElementIsFunction:!0}),this.#a=ie(he(e,t)),this.#u=n=>this.#C(n),this.#h=n=>this.#L(n),this.#m=n=>this.#A(n),this.#s=n=>{n.target.classList?.contains("cw-DatePicker-months")===!0&&this.#b(n.target);},this.#t=void 0,this.#n=!1,this.#o=void 0,this.#i=!1,this.#c=()=>{},Ye(()=>this.#D()),xe(()=>this.#c());}get#e(){return this.#a.model;}#d(){return this.functionElement?.querySelector(".cw-DatePicker-inputs input")?.matches(":disabled")===!0;}#D(){const e=this.functionElement,t=e?.ownerDocument.defaultView,n=e?.querySelector(":scope > input[type=hidden]"),a=t?.ResizeObserver,s=n==null?()=>{}:Ne(n,()=>this.#e.reset()),o=a===void 0?void 0:new a(i=>this.#g(i));this.#o=o,this.#c=()=>{s(),o?.disconnect();},this.#f(),this.#e.continuous()&&this.#r(g(u(this.#e.month)),"top");}#f(){const e=this.functionElement,t=this.#y(),n=this.#o;if(!(e===null||n===void 0)&&(n.disconnect(),n.observe(e),t!==null)){n.observe(t);for(const a of Array.from(t.querySelectorAll(":scope > .cw-DatePicker-spacer")))n.observe(a);}}#g(e){const t=e.every(n=>n.target.classList.contains("cw-DatePicker-spacer"));(this.#n||!t)&&this.#l();}#y(){return this.functionElement?.querySelector(".cw-DatePicker-months")??null;}#p(e){return e.querySelector(".cw-DatePicker-month")?.offsetHeight??0;}#l(){const e=this.#e,t=this.#y(),n=this.#t;if(t===null||n===void 0)return;const a=this.#p(t),s=t.firstElementChild?.style.getPropertyValue("--cw-datepicker-months");this.#n=a===0||s!==String(e.windowStart()-e.listStart()),this.#n||(t.scrollTop=(n-e.listStart())*a);}#r(e,t){const n=this.#e;v(()=>{(!this.#i||e<n.listStart()||e>n.listEnd())&&n.centerList(e),n.renderFrom(t==="top"?e:e-1),t==="top"&&n.scrollTo(e);}),this.#i=!0,t==="top"&&(this.#t=k(e,n.listStart(),n.listEnd()),this.#l(),this.#n&&queueMicrotask(()=>this.#l()));}#b(e){const t=this.#e,n=this.#p(e),a=e.ownerDocument.activeElement;if(n===0||this.#n)return;const s=t.listStart()+e.scrollTop/n,o=Math.floor(s);this.#t=s,v(()=>{t.scrollTo(o),t.renderFrom(o);}),a!==null&&!a.isConnected&&e.focus({preventScroll:!0});}#S(e){return this.functionElement?.querySelector(`.cw-DatePicker-days [data-cw-date="${e}"]`)??null;}#w(){this.functionElement?.querySelector(".cw-DatePicker-days [data-cw-date][tabindex='0']")?.focus();}#k(e,t){const n=this.functionElement,a=n?.querySelector(".cw-DatePicker-days > .cw-DatePicker-grid");if(n==null||a===null||a===void 0||!n.isConnected){t();return;}const s=a.cloneNode(!0),i=(n.ownerDocument.defaultView?.getComputedStyle(n).direction==="rtl"?-e:e)*100,c={duration:"--cw-datepicker-page-duration",easing:"--cw-datepicker-page-easing"};s.removeAttribute("role"),s.setAttribute("aria-hidden","true"),s.classList.add("_cw-DatePicker-ghost"),s.inert=!0;for(const l of Array.from(s.querySelectorAll("[data-cw-date]")))for(const d of["data-cw-date","data-cw-initial-focus","role","tabindex"])l.removeAttribute(d);a.after(s),t(),W(a,[{translate:`${i}% 0`},{translate:"0 0"}],c),W(s,[{translate:"0 0"},{translate:`${-i}% 0`}],c).finished.then(()=>s.remove(),()=>s.remove());}#M(e){const t=this.#e,n=u(t.month);t.continuous()?(this.#r(g(e),"top"),t.focus(`${e}-01`)):e!==n&&this.#k(e>n?1:-1,()=>t.showMonth(e));}#T(e){const t=this.#e,n=e.slice(0,7),a=u(t.month);t.continuous()?(t.focus(e),this.#S(e)===null&&this.#r(g(n),"nearest")):n!==a?this.#k(n>a?1:-1,()=>t.focus(e)):t.focus(e);const s=this.#S(e);s?.focus({preventScroll:!0}),s?.scrollIntoView({block:"nearest",inline:"nearest"});}#v(e){const t=this.#e,n=this.functionElement;if(t.setOverlay(e),e==="none"){this.#w();return;}const a=n?.querySelector(`.cw-DatePicker-${e==="years"?"years":"monthMenu"} [tabindex='0']`);a?.focus({preventScroll:!0}),a?.scrollIntoView({block:"center",inline:"nearest"});}#P(e){const t=this.#e;if(t.continuous()){t.setOverlay("none"),this.#r(g(e),"top"),t.focus(`${e}-01`),this.#w();return;}t.showMonth(e),this.#v("none");}#R(e){const t=this.#e,n=u(t.month),a=this.functionElement,s={previousMonth:-1,nextMonth:1,previousYear:-12,nextYear:12};e in s?this.#M(V(g(n)+s[e])):e==="years"||e==="months"?this.#v(u(t.overlay)===e?"none":e):e==="mode"&&(t.setInputMode(!u(t.inputMode)),u(t.inputMode)?a?.querySelector(".cw-DatePicker-inputs input")?.focus():this.#w());}#C(e){const n=e.target.closest("[data-cw-date], [data-cw-year], [data-cw-option], [data-cw-action]")?.dataset,a=u(this.#e.month);n===void 0||e.defaultPrevented||this.#d()||(n.cwDate!==void 0?this.#e.select(n.cwDate,e):n.cwYear!==void 0?this.#P(`${n.cwYear.padStart(4,"0")}${a.slice(4)}`):n.cwOption!==void 0?this.#E(n.cwOption):n.cwAction!==void 0&&this.#R(n.cwAction));}#E(e){const t=u(this.#e.month),[n,a]=e.split("-");this.#P(n==="month"?`${t.slice(0,5)}${String(Number(a)+1).padStart(2,"0")}`:`${a.padStart(4,"0")}${t.slice(4)}`);}#A(e){const t=e.target.dataset;t?.cwDate!==void 0?this.#e.trackFocus(t.cwDate):t?.cwYear!==void 0&&this.#e.focusYear(Number(t.cwYear));}#L(e){const t=e.target,n=t.dataset;if(!(e.defaultPrevented||this.#d()))if(e.key==="Escape"&&u(this.#e.overlay)!=="none"){const a=this.functionElement?.querySelector(`[data-cw-action="${u(this.#e.overlay)}"]`);e.preventDefault(),this.#v("none"),this.#e.docked()&&a?.focus();}else n.cwDate!==void 0?this.#I(e,t,n.cwDate):n.cwYear!==void 0?this.#F(e,t,Number(n.cwYear)):n.cwOption!==void 0&&this.#O(e,t);}#I(e,t,n){const a=this.#e,o=t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl"?-1:1,i=(D(n).getUTCDay()-a.firstDay()+p)%p,c=e.shiftKey?12:1,d={ArrowRight:[o,0],ArrowLeft:[-o,0],ArrowDown:[p,0],ArrowUp:[-p,0],Home:[-i,0],End:[p-1-i,0],PageDown:[0,c],PageUp:[0,-c]}[e.key];if(e.key==="Enter"||e.key===" "){e.preventDefault(),a.select(n,e);return;}if(d===void 0)return;e.preventDefault();const h=d[0]<0||d[1]<0?-1:1;for(let f=A(n,d[0],d[1]),S=0;S<Ke&&f>=a.minimum()&&f<=a.maximum();f=A(f,h),S++)if(a.isSelectable(f)){this.#T(f);return;}}#F(e,t,n){const a=this.#e,s=t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl",[o,i]=a.years(),c=T*4,d={ArrowRight:n+(s?-1:1),ArrowLeft:n+(s?1:-1),ArrowDown:n+T,ArrowUp:n-T,Home:o,End:i,PageDown:n+c,PageUp:n-c}[e.key];if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.#P(`${String(n).padStart(4,"0")}${u(a.month).slice(4)}`);return;}if(d===void 0)return;e.preventDefault(),a.focusYear(d);const h=this.functionElement?.querySelector(`.cw-DatePicker-years [data-cw-year="${k(d,o,i)}"]`);h?.focus({preventScroll:!0}),h?.scrollIntoView({block:"nearest",inline:"nearest"});}#O(e,t){const n=Array.from(t.parentElement?.querySelectorAll("[data-cw-option]")??[]),a=n.indexOf(t),o={ArrowDown:a+1,ArrowUp:a-1,Home:0,End:n.length-1}[e.key];if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.#E(t.dataset.cwOption);return;}if(o===void 0)return;e.preventDefault();const i=n[k(o,0,n.length-1)];for(const c of n)c.tabIndex=c===i?0:-1;i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"});}applyComponentProps(){const e=super.readProps(["disabled","presentation","rangeLayout"]),t=this.#e,n=e.presentationChanged||e.rangeLayoutChanged;if(e.disabledChanged||n)for(const[a,s]of Object.entries(le(t)))this.setClass(a,s);n&&this.functionElement?.isConnected===!0&&(this.#i=!1,queueMicrotask(()=>{this.#f(),t.continuous()&&this.#r(g(u(t.month)),"top");}));}render(e){const t=de(this.#a),n=<div class="cw-DatePicker"data-cw-calendar="">
103
103
  {t}{e}
104
- </div>;return n.addEventListener("click",this.#u),n.addEventListener("keydown",this.#h),n.addEventListener("focusin",this.#m),n.addEventListener("scroll",this.#s,!0),n}}class yt extends ge{constructor(e){super(e,ue)}}class pt extends ge{constructor(e){super(e,me)}}const Mt=ne(()=>fe(ue),()=>yt),Tt=ne(()=>fe(me),()=>pt);export{Mt as DatePicker,Tt as DateRangePicker};
104
+ </div>;return n.addEventListener("click",this.#u),n.addEventListener("keydown",this.#h),n.addEventListener("focusin",this.#m),n.addEventListener("scroll",this.#s,!0),n;}}class yt extends ge{constructor(e){super(e,ue);}}class pt extends ge{constructor(e){super(e,me);}}const Mt=/* @__PURE__ */ne(()=>fe(ue),()=>yt),Tt=/* @__PURE__ */ne(()=>fe(me),()=>pt);export{Mt as DatePicker,Tt as DateRangePicker};
@@ -1,4 +1,4 @@
1
- import{createUniqueId as w,mergeProps as b}from"solid-js";import{insert as i}from"solid-js/web";import{defineDomComponent as A}from"..";import{firstInputSlot as p,hasInputError as H,supportingSlot as M}from"./base";import{PairedInputController as O,pairedInputAttributes as _,resolveInputPair as F,splitFieldProps as J}from"./paired-input";import{TextField as X}from"./text-field";import"./date-range-input.css";const s="cw-DateRangeInput",D="cw-DateRangeInput-input",x=["Start date","End date"],h={start:["startValue"],end:["endValue"]};function E(n,e){return X(b({type:e},n))}function K(n){return E(n,"date")}function Q(n){return E(n,"time")}function y(n,e,a){return n===""?n:e!==void 0&&n<e?e:a!==void 0&&n>a?a:n}function P(n,e){return n===""||e===""?void 0:n<e?-1:n>e?1:0}function $(n,e){return{[s]:!0,[`_${s}-${n.variant??"filled"}`]:!0,[`${s}-disabled`]:n.disabled===!0,[`${s}-error`]:e,[`${s}-readOnly`]:n.readOnly===!0}}function k(n,e){const a=w(),t=J(n),[r,o]=F(e,h,!0,["",""],L=>y(L??"",e.min,e.max),P),d=<legend class="cw-DateRangeInput-label">
1
+ import{createUniqueId as w,mergeProps as b}from"solid-js";import{insert as i}from"solid-js/web";import{defineDomComponent as A}from"..";import{firstInputSlot as p,hasInputError as H,supportingSlot as M}from"./base";import{PairedInputController as O,pairedInputAttributes as _,resolveInputPair as F,splitFieldProps as J}from"./paired-input";import{TextField as X}from"./text-field";import"./date-range-input.css";const s="cw-DateRangeInput",D="cw-DateRangeInput-input",x=["Start date","End date"],h={start:["startValue"],end:["endValue"]};function E(n,e){return X(b({type:e},n));}function K(n){return E(n,"date");}function Q(n){return E(n,"time");}function y(n,e,a){return n===""?n:e!==void 0&&n<e?e:a!==void 0&&n>a?a:n;}function P(n,e){return n===""||e===""?void 0:n<e?-1:n>e?1:0;}function $(n,e){return{[s]:!0,[`_${s}-${n.variant??"filled"}`]:!0,[`${s}-disabled`]:n.disabled===!0,[`${s}-error`]:e,[`${s}-readOnly`]:n.readOnly===!0};}function k(n,e){const a=w(),t=J(n),[r,o]=F(e,h,!0,["",""],L=>y(L??"",e.min,e.max),P),d=<legend class="cw-DateRangeInput-label">
2
2
  {p(e.label)??n.children}
3
3
  </legend>,u=<span class="cw-DateRangeInput-leading">
4
4
  {p(e.leading,e.leadingIcon)}
@@ -12,10 +12,10 @@ import{createUniqueId as w,mergeProps as b}from"solid-js";import{insert as i}fro
12
12
  {d}
13
13
  {S}
14
14
  {f}
15
- </fieldset>}class N extends O{constructor(e){super(e,s,x,h,{parse:a=>a.value,compare:P},["",""])}normalize(e){return y(e??"",this.props.min,this.props.max)}applyConstraints(e,a){const t=super.readProps(["max","min"]);if(!t.minChanged&&!t.maxChanged)return!1;for(const r of[e,a])t.min===void 0?r.removeAttribute("min"):r.min=t.min,t.max===void 0?r.removeAttribute("max"):r.max=t.max;return!0}applyReadOnly(e,a,t){e.readOnly=t,a.readOnly=t}changeCallbacks(){return[this.props.onValueChange,this.props.onDateRangeChange,this.props.onChange]}applyComponentProps(){super.applyComponentProps();const e=super.readProps(["variant"]);e.variantChanged&&this.setClass("variant",`_${s}-${e.variant??"filled"}`)}render(e,a){const t=<legend class="cw-DateRangeInput-label"/>;i(t,()=>p(this.props.label)??e);const r=<span class="cw-DateRangeInput-leading"/>;i(r,()=>p(this.props.leading,this.props.leadingIcon));const o=<span class="cw-DateRangeInput-prefix"/>;i(o,()=>this.props.prefix);const d=<span class="cw-DateRangeInput-suffix"/>;i(d,()=>this.props.suffix);const u=<span class="cw-DateRangeInput-trailing"/>;i(u,()=>p(this.props.trailing,this.props.trailingIcon));const l=<span class="cw-DateRangeInput-supporting"aria-live="polite"id={this.supportingId}/>;this.insertSupporting(l);const g=<input class={D}ref={a}type="date"/>,m=<input class={D}ref={c=>this.setEndInput(c)}type="date"/>,f=<span class="cw-DateRangeInput-separator"aria-hidden="true">–</span>,I=<span class="cw-DateRangeInput-control">
15
+ </fieldset>;}class N extends O{constructor(e){super(e,s,x,h,{parse:a=>a.value,compare:P},["",""]);}normalize(e){return y(e??"",this.props.min,this.props.max);}applyConstraints(e,a){const t=super.readProps(["max","min"]);if(!t.minChanged&&!t.maxChanged)return!1;for(const r of[e,a])t.min===void 0?r.removeAttribute("min"):r.min=t.min,t.max===void 0?r.removeAttribute("max"):r.max=t.max;return!0;}applyReadOnly(e,a,t){e.readOnly=t,a.readOnly=t;}changeCallbacks(){return[this.props.onValueChange,this.props.onDateRangeChange,this.props.onChange];}applyComponentProps(){super.applyComponentProps();const e=super.readProps(["variant"]);e.variantChanged&&this.setClass("variant",`_${s}-${e.variant??"filled"}`);}render(e,a){const t=<legend class="cw-DateRangeInput-label"/>;i(t,()=>p(this.props.label)??e);const r=<span class="cw-DateRangeInput-leading"/>;i(r,()=>p(this.props.leading,this.props.leadingIcon));const o=<span class="cw-DateRangeInput-prefix"/>;i(o,()=>this.props.prefix);const d=<span class="cw-DateRangeInput-suffix"/>;i(d,()=>this.props.suffix);const u=<span class="cw-DateRangeInput-trailing"/>;i(u,()=>p(this.props.trailing,this.props.trailingIcon));const l=<span class="cw-DateRangeInput-supporting"aria-live="polite"id={this.supportingId}/>;this.insertSupporting(l);const g=<input class={D}ref={a}type="date"/>,m=<input class={D}ref={c=>this.setEndInput(c)}type="date"/>,f=<span class="cw-DateRangeInput-separator"aria-hidden="true">–</span>,I=<span class="cw-DateRangeInput-control">
16
16
  {r}{o}{g}{f}{m}{d}{u}
17
17
  </span>;return<fieldset class={s}>
18
18
  {t}
19
19
  {I}
20
20
  {l}
21
- </fieldset>}}const W=A(()=>k,()=>N);export{K as DateInput,W as DateRangeInput,N as DateRangeInputController,Q as TimeInput};
21
+ </fieldset>;}}const W=/* @__PURE__ */A(()=>k,()=>N);export{K as DateInput,W as DateRangeInput,N as DateRangeInputController,Q as TimeInput};
@@ -1 +1 @@
1
- import{Autocomplete as t,AutocompleteController as o}from"./autocomplete";import{DatePicker as p,DateRangePicker as a}from"./date-picker";import{DateInput as n,DateRangeInput as d,DateRangeInputController as m,TimeInput as c}from"./date-time";import{PickerDialog as P}from"./picker-dialog";import{ExposedDropdownMenu as u,Select as S,SelectController as g}from"./select";import{RangeSlider as D,RangeSliderController as k,Slider as T,SliderController as C}from"./slider";import{FilledTextField as I,OutlinedTextField as R,PasswordField as y,SecureField as h,TextField as H,TextFieldController as O}from"./text-field";import{TimePicker as b}from"./time-picker";export{t as Autocomplete,o as AutocompleteController,n as DateInput,p as DatePicker,d as DateRangeInput,m as DateRangeInputController,a as DateRangePicker,u as ExposedDropdownMenu,I as FilledTextField,R as OutlinedTextField,y as PasswordField,P as PickerDialog,D as RangeSlider,k as RangeSliderController,h as SecureField,S as Select,g as SelectController,T as Slider,C as SliderController,H as TextField,O as TextFieldController,c as TimeInput,b as TimePicker};
1
+ import{Autocomplete as t,AutocompleteController as o}from"./autocomplete";import{DatePicker as p,DateRangePicker as a}from"./date-picker";import{DateInput as n,DateRangeInput as d,DateRangeInputController as m,TimeInput as c}from"./date-time";import{PickerDialog as P}from"./picker-dialog";import{ExposedDropdownMenu as u,Select as S,SelectController as g}from"./select";import{RangeSlider as D,RangeSliderController as k,Slider as T,SliderController as C}from"./slider";import{FilledTextField as I,OutlinedTextField as R,PasswordField as y,SecureField as h,TextField as H,TextFieldController as O}from"./text-field";import{TimePicker as b}from"./time-picker";export{t as Autocomplete,o as AutocompleteController,n as DateInput,p as DatePicker,d as DateRangeInput,m as DateRangeInputController,a as DateRangePicker,u as ExposedDropdownMenu,I as FilledTextField,R as OutlinedTextField,y as PasswordField,P as PickerDialog,D as RangeSlider,k as RangeSliderController,h as SecureField,S as Select,g as SelectController,T as Slider,C as SliderController,H as TextField,O as TextFieldController,c as TimeInput,b as TimePicker};
@@ -1 +1 @@
1
- import{createMemo as g,createUniqueId as y,onCleanup as I,onMount as v}from"solid-js";import{insert as T}from"solid-js/web";import{DomController as P}from"../dom/client";import{dedupeCallbacks as C}from"../navigation/base";import{firstInputSlot as c,hasInputError as E,observeFormReset as b,supportingSlot as A}from"./base";const m={error:!1,content:void 0};function o(a,e){return e in a}function L(a){return g(()=>{const t=a.errorText,n=a.error,r=a.supportingText,s=a.helperText,d=c(t,n);return{error:n===!0||d!==void 0,content:d??c(r,s)}},m,{equals:(t,n)=>t.error===n.error&&t.content===n.content})}function S(a,e,t,n){const r=a?.content===void 0!=(e.content===void 0);return{error:n||a?.error!==e.error?t||e.error:void 0,described:a===void 0||r?e.content!==void 0:void 0}}function M(a){const e=a,t={},n={};for(const r of Object.keys(e))r!=="children"&&(r==="class"||r==="classList"||r==="style"?t[r]=e[r]:n[r]=e[r]);return{container:t,input:n}}function k(a,e,t,n,r,s){const d=[!1,!1],i=[0,1].map(u=>{const p=(u===0?e.start:e.end).find(h=>o(a,h));return d[u]=o(a,"value")||p!==void 0,r(o(a,"value")?a.value?.[u]:p!==void 0?a[p]:t?a.defaultValue?.[u]??(u===0?a.defaultStartValue:a.defaultEndValue):n[u],u)}),l=s(i[0],i[1]);return l===void 0||l<=0?i:d[0]&&!d[1]?[i[0],i[0]]:d[1]&&!d[0]?[i[1],i[1]]:[i[1],i[0]]}function N(a,e,t,n){const r=e.invalid===!0||E(e),s=A(e)===void 0?void 0:n,d=(l,u)=>o(a,l)?a[l]:u,i={"aria-describedby":s,"aria-invalid":r?"true":void 0,"aria-readonly":e.readOnly===!0?"true":void 0,disabled:e.disabled===!0||void 0,required:e.required===!0||void 0};return{start:{...a,...i,"aria-describedby":d("aria-describedby",i["aria-describedby"]),"aria-invalid":d("aria-invalid",i["aria-invalid"]),"aria-label":d("aria-label",e.startLabel??t[0]),"aria-readonly":d("aria-readonly",i["aria-readonly"]),id:e.startId??e.id??a.id,name:e.startName??e.name},end:{...i,"aria-label":e.endLabel??t[1],form:a.form,id:e.endId,name:e.endName??e.name}}}class x extends P{#a;#l;#i;#t;#d;#s;#m;#g;#y;#I;#v;#p;#o;#u;#h;#f;#c;#b;#e;#r;#n;constructor(e,t,n,r,s,d){super(e),this.#a=t,this.#l=n,this.#i=r,this.#t=s,this.#d=o(e,"value")||r.start.some(i=>o(e,i)),this.#s=o(e,"value")||r.end.some(i=>o(e,i)),this.#m=o(e,"attr:aria-label"),this.#g=o(e,"attr:aria-describedby"),this.#y=o(e,"attr:aria-invalid"),this.#I=o(e,"attr:aria-readonly"),this.#v=o(e,"attr:form"),this.#p=y(),this.#o=i=>this.#E(0,i),this.#u=i=>this.#E(1,i),this.#h=()=>this.#C(),this.#f=()=>m,this.#c=void 0,this.#b=!1,this.#e=null,this.#r=d,this.#n=()=>{},v(()=>{const i=this.functionElement;i!==null&&(this.#n(),this.#n=b(i,this.#h))}),I(()=>{this.#n(),this.functionElement?.removeEventListener("input",this.#o),this.#e?.removeEventListener("input",this.#u),this.#e=null})}get values(){const e=this.functionElement,t=this.#e;return e===null||t===null?this.#r:[this.#t.parse(e),this.#t.parse(t)]}get supportingId(){return this.#p}get endInput(){return this.#e}setEndInput(e){this.#e?.removeEventListener("input",this.#u),this.#e=e,e.addEventListener("input",this.#u),this.#A(),this.#L()}insertSupporting(e){const t=L(this.props);this.#f=t,T(e,()=>t().content)}onPairApplied(e){}applyReadOnly(e,t,n){}applyPair(e){const t=this.functionElement,n=this.#e;t===null||n===null||(t.value=String(e[0]),n.value=String(e[1]),this.#r=[this.#t.parse(t),this.#t.parse(n)],this.onPairApplied(this.#r))}#T(e,t){return k(this.props,this.#i,e,t,(n,r)=>this.normalize(n,r),this.#t.compare)}#P(){const e=this.values;this.applyPair(this.#T(!1,[this.#d?void 0:e[0],this.#s?void 0:e[1]]))}#C(){if(this.#d||this.#s){this.#P();return}const[e,t]=this.values,n=[this.normalize(e,0),this.normalize(t,1)],r=this.#t.compare(n[0],n[1]);this.applyPair(r===void 0||r<=0?n:[n[1],n[0]])}#E(e,t){const n=this.functionElement,r=this.#e;if(n===null||r===null||n.disabled)return;if(this.props.readOnly===!0){this.applyPair(this.#r);return}const s=e===0?1:0,d=this.normalize(this.#t.parse(e===0?n:r),e),i=this.normalize(this.#t.parse(e===0?r:n),s),[l,u]=e===0?[d,i]:[i,d],f=this.#t.compare(l,u),p=f!==void 0&&f>0?i:d,h=e===0?[p,i]:[i,p];this.applyPair(h),C(this.changeCallbacks(),h,t),(this.#d||this.#s)&&this.#P()}#A(){const e=this.functionElement,t=this.#m?this.props["attr:aria-label"]:this.props.startLabel??this.#l[0];e!==null&&(t===void 0?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t)),this.#e?.setAttribute("aria-label",this.props.endLabel??this.#l[1])}#L(){const e=this.#e,t=this.props["attr:form"];!this.#v||e===null||(t===void 0?e.removeAttribute("form"):e.setAttribute("form",t))}#S(e,t){const n=this.#f(),r=S(this.#c,n,this.props.invalid===!0,t);if(this.#c=n,r.error!==void 0&&(this.setClass(`${this.#a}-error`,r.error),this.#y||this.setAttribute("aria-invalid",r.error?"true":void 0),r.error?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid")),r.described!==void 0){const s=r.described?this.#p:void 0;this.#g||this.setAttribute("aria-describedby",s),s===void 0?e.removeAttribute("aria-describedby"):e.setAttribute("aria-describedby",s)}}applyComponentProps(){const e=super.readProps(["attr:id","attr:form","defaultEndValue","defaultStartValue","defaultValue","disabled","endId","endLabel","endName","id","invalid","name","readOnly","required","startId","startLabel","startName","value",...this.#i.start,...this.#i.end]),t=this.functionElement,n=this.#e;if(t===null||n===null)return;const r=this.applyConstraints(t,n),s=[...this.#i.start,...this.#i.end].some(i=>e[`${i}Changed`]===!0),d=e.startId??e.id??e["attr:id"];if(!this.#b){const i=this.#T(!0,[void 0,void 0]);this.#b=!0,t.defaultValue=String(i[0]),n.defaultValue=String(i[1]),this.applyPair(i)}if((e.valueChanged===!0||s||r)&&this.#C(),e.disabledChanged===!0&&(t.disabled=e.disabled===!0,n.disabled=e.disabled===!0,this.setClass(`${this.#a}-disabled`,e.disabled===!0)),e.readOnlyChanged===!0){const i=e.readOnly===!0?"true":void 0;this.setClass(`${this.#a}-readOnly`,i!==void 0),this.#I||this.setAttribute("aria-readonly",i),i===void 0?n.removeAttribute("aria-readonly"):n.setAttribute("aria-readonly",i),this.applyReadOnly(t,n,i!==void 0)}if(e.requiredChanged===!0&&(t.required=e.required===!0,n.required=e.required===!0),e.nameChanged===!0||e.startNameChanged===!0){const i=e.startName??e.name;this.setAttribute("name",i===""?void 0:i)}if(e.nameChanged===!0||e.endNameChanged===!0){const i=e.endName??e.name;i===void 0||i===""?n.removeAttribute("name"):n.name=i}(o(this.props,"startId")||o(this.props,"id"))&&t.getAttribute("id")!==(d??null)&&this.setAttribute("id",d),e.endIdChanged===!0&&(e.endId===void 0||e.endId===""?n.removeAttribute("id"):n.id=e.endId),(e.startLabelChanged===!0||e.endLabelChanged===!0)&&this.#A(),t.getAttribute("form")!==n.getAttribute("form")&&this.#L(),this.#S(n,e.invalidChanged===!0)}onFunctionElementChanged(e){const t=this.functionElement;this.#n(),super.onFunctionElementChanged(e),t?.removeEventListener("input",this.#o),e?.addEventListener("input",this.#o),this.#n=()=>{},e!==null&&(this.#n=b(e,this.#h))}}export{m as NO_SUPPORTING_CONTENT,x as PairedInputController,L as createSupportingContent,N as pairedInputAttributes,k as resolveInputPair,M as splitFieldProps,S as supportingChangesOf};
1
+ import{createMemo as g,createUniqueId as y,onCleanup as I,onMount as v}from"solid-js";import{insert as T}from"solid-js/web";import{DomController as P}from"../dom/client";import{dedupeCallbacks as C}from"../navigation/base";import{firstInputSlot as c,hasInputError as E,observeFormReset as b,supportingSlot as A}from"./base";const m={error:!1,content:void 0};function o(a,e){return e in a;}function L(a){return g(()=>{const t=a.errorText,n=a.error,r=a.supportingText,s=a.helperText,d=c(t,n);return{error:n===!0||d!==void 0,content:d??c(r,s)};},m,{equals:(t,n)=>t.error===n.error&&t.content===n.content});}function S(a,e,t,n){const r=a?.content===void 0!=(e.content===void 0);return{error:n||a?.error!==e.error?t||e.error:void 0,described:a===void 0||r?e.content!==void 0:void 0};}function M(a){const e=a,t={},n={};for(const r of Object.keys(e))r!=="children"&&(r==="class"||r==="classList"||r==="style"?t[r]=e[r]:n[r]=e[r]);return{container:t,input:n};}function k(a,e,t,n,r,s){const d=[!1,!1],i=[0,1].map(u=>{const p=(u===0?e.start:e.end).find(h=>o(a,h));return d[u]=o(a,"value")||p!==void 0,r(o(a,"value")?a.value?.[u]:p!==void 0?a[p]:t?a.defaultValue?.[u]??(u===0?a.defaultStartValue:a.defaultEndValue):n[u],u);}),l=s(i[0],i[1]);return l===void 0||l<=0?i:d[0]&&!d[1]?[i[0],i[0]]:d[1]&&!d[0]?[i[1],i[1]]:[i[1],i[0]];}function N(a,e,t,n){const r=e.invalid===!0||E(e),s=A(e)===void 0?void 0:n,d=(l,u)=>o(a,l)?a[l]:u,i={"aria-describedby":s,"aria-invalid":r?"true":void 0,"aria-readonly":e.readOnly===!0?"true":void 0,disabled:e.disabled===!0||void 0,required:e.required===!0||void 0};return{start:{...a,...i,"aria-describedby":d("aria-describedby",i["aria-describedby"]),"aria-invalid":d("aria-invalid",i["aria-invalid"]),"aria-label":d("aria-label",e.startLabel??t[0]),"aria-readonly":d("aria-readonly",i["aria-readonly"]),id:e.startId??e.id??a.id,name:e.startName??e.name},end:{...i,"aria-label":e.endLabel??t[1],form:a.form,id:e.endId,name:e.endName??e.name}};}class x extends P{#a;#l;#i;#t;#d;#s;#m;#g;#y;#I;#v;#p;#o;#u;#h;#f;#c;#b;#e;#r;#n;constructor(e,t,n,r,s,d){super(e),this.#a=t,this.#l=n,this.#i=r,this.#t=s,this.#d=o(e,"value")||r.start.some(i=>o(e,i)),this.#s=o(e,"value")||r.end.some(i=>o(e,i)),this.#m=o(e,"attr:aria-label"),this.#g=o(e,"attr:aria-describedby"),this.#y=o(e,"attr:aria-invalid"),this.#I=o(e,"attr:aria-readonly"),this.#v=o(e,"attr:form"),this.#p=y(),this.#o=i=>this.#E(0,i),this.#u=i=>this.#E(1,i),this.#h=()=>this.#C(),this.#f=()=>m,this.#c=void 0,this.#b=!1,this.#e=null,this.#r=d,this.#n=()=>{},v(()=>{const i=this.functionElement;i!==null&&(this.#n(),this.#n=b(i,this.#h));}),I(()=>{this.#n(),this.functionElement?.removeEventListener("input",this.#o),this.#e?.removeEventListener("input",this.#u),this.#e=null;});}get values(){const e=this.functionElement,t=this.#e;return e===null||t===null?this.#r:[this.#t.parse(e),this.#t.parse(t)];}get supportingId(){return this.#p;}get endInput(){return this.#e;}setEndInput(e){this.#e?.removeEventListener("input",this.#u),this.#e=e,e.addEventListener("input",this.#u),this.#A(),this.#L();}insertSupporting(e){const t=L(this.props);this.#f=t,T(e,()=>t().content);}onPairApplied(e){}applyReadOnly(e,t,n){}applyPair(e){const t=this.functionElement,n=this.#e;t===null||n===null||(t.value=String(e[0]),n.value=String(e[1]),this.#r=[this.#t.parse(t),this.#t.parse(n)],this.onPairApplied(this.#r));}#T(e,t){return k(this.props,this.#i,e,t,(n,r)=>this.normalize(n,r),this.#t.compare);}#P(){const e=this.values;this.applyPair(this.#T(!1,[this.#d?void 0:e[0],this.#s?void 0:e[1]]));}#C(){if(this.#d||this.#s){this.#P();return;}const[e,t]=this.values,n=[this.normalize(e,0),this.normalize(t,1)],r=this.#t.compare(n[0],n[1]);this.applyPair(r===void 0||r<=0?n:[n[1],n[0]]);}#E(e,t){const n=this.functionElement,r=this.#e;if(n===null||r===null||n.disabled)return;if(this.props.readOnly===!0){this.applyPair(this.#r);return;}const s=e===0?1:0,d=this.normalize(this.#t.parse(e===0?n:r),e),i=this.normalize(this.#t.parse(e===0?r:n),s),[l,u]=e===0?[d,i]:[i,d],f=this.#t.compare(l,u),p=f!==void 0&&f>0?i:d,h=e===0?[p,i]:[i,p];this.applyPair(h),C(this.changeCallbacks(),h,t),(this.#d||this.#s)&&this.#P();}#A(){const e=this.functionElement,t=this.#m?this.props["attr:aria-label"]:this.props.startLabel??this.#l[0];e!==null&&(t===void 0?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t)),this.#e?.setAttribute("aria-label",this.props.endLabel??this.#l[1]);}#L(){const e=this.#e,t=this.props["attr:form"];!this.#v||e===null||(t===void 0?e.removeAttribute("form"):e.setAttribute("form",t));}#S(e,t){const n=this.#f(),r=S(this.#c,n,this.props.invalid===!0,t);if(this.#c=n,r.error!==void 0&&(this.setClass(`${this.#a}-error`,r.error),this.#y||this.setAttribute("aria-invalid",r.error?"true":void 0),r.error?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid")),r.described!==void 0){const s=r.described?this.#p:void 0;this.#g||this.setAttribute("aria-describedby",s),s===void 0?e.removeAttribute("aria-describedby"):e.setAttribute("aria-describedby",s);}}applyComponentProps(){const e=super.readProps(["attr:id","attr:form","defaultEndValue","defaultStartValue","defaultValue","disabled","endId","endLabel","endName","id","invalid","name","readOnly","required","startId","startLabel","startName","value",...this.#i.start,...this.#i.end]),t=this.functionElement,n=this.#e;if(t===null||n===null)return;const r=this.applyConstraints(t,n),s=[...this.#i.start,...this.#i.end].some(i=>e[`${i}Changed`]===!0),d=e.startId??e.id??e["attr:id"];if(!this.#b){const i=this.#T(!0,[void 0,void 0]);this.#b=!0,t.defaultValue=String(i[0]),n.defaultValue=String(i[1]),this.applyPair(i);}if((e.valueChanged===!0||s||r)&&this.#C(),e.disabledChanged===!0&&(t.disabled=e.disabled===!0,n.disabled=e.disabled===!0,this.setClass(`${this.#a}-disabled`,e.disabled===!0)),e.readOnlyChanged===!0){const i=e.readOnly===!0?"true":void 0;this.setClass(`${this.#a}-readOnly`,i!==void 0),this.#I||this.setAttribute("aria-readonly",i),i===void 0?n.removeAttribute("aria-readonly"):n.setAttribute("aria-readonly",i),this.applyReadOnly(t,n,i!==void 0);}if(e.requiredChanged===!0&&(t.required=e.required===!0,n.required=e.required===!0),e.nameChanged===!0||e.startNameChanged===!0){const i=e.startName??e.name;this.setAttribute("name",i===""?void 0:i);}if(e.nameChanged===!0||e.endNameChanged===!0){const i=e.endName??e.name;i===void 0||i===""?n.removeAttribute("name"):n.name=i;}(o(this.props,"startId")||o(this.props,"id"))&&t.getAttribute("id")!==(d??null)&&this.setAttribute("id",d),e.endIdChanged===!0&&(e.endId===void 0||e.endId===""?n.removeAttribute("id"):n.id=e.endId),(e.startLabelChanged===!0||e.endLabelChanged===!0)&&this.#A(),t.getAttribute("form")!==n.getAttribute("form")&&this.#L(),this.#S(n,e.invalidChanged===!0);}onFunctionElementChanged(e){const t=this.functionElement;this.#n(),super.onFunctionElementChanged(e),t?.removeEventListener("input",this.#o),e?.addEventListener("input",this.#o),this.#n=()=>{},e!==null&&(this.#n=b(e,this.#h));}}export{m as NO_SUPPORTING_CONTENT,x as PairedInputController,L as createSupportingContent,N as pairedInputAttributes,k as resolveInputPair,M as splitFieldProps,S as supportingChangesOf};
@@ -1,9 +1,9 @@
1
- import{Show as R,onCleanup as M,splitProps as O,untrack as A}from"solid-js";import{defineDomComponent as H}from"..";import{Button as E}from"../action/button";import{DomController as T}from"../dom/client";import{Dialog as F}from"../surface/dialog";import"../container/elevation-shadow.css";import"./picker-dialog.css";const w="[data-cw-initial-focus]",D=4,a=8;function P(i,e,t){return Math.max(e,Math.min(i,t))}function I(i,e){const t=i,o=Object.fromEntries(Object.keys(t).filter(n=>n!=="children").map(n=>[n,t[n]]));return<div{...o}aria-label={"aria-label"in o?o["aria-label"]:e.label}classList={{...o.classList,"cw-PickerDialog":!0,"cw-PickerDialog-docked":!0,"cw-elevationShadow":!0}}popover="manual"role={e.role??"dialog"}tabIndex={-1}>{i.children}</div>}class J extends T{#a;#o;#c;#n;#e;#r;#l;#t;#i;constructor(e){super(e,{styleElementIsFunction:!0}),this.#a="open"in e,this.#o=t=>this.#v(t),this.#c=t=>this.#b(t),this.#n=()=>this.#d(),this.#e=!1,this.#r=null,this.#l=!0,this.#t=void 0,this.#i=()=>{},M(()=>this.#i())}isOpen(){return this.#e}open(){this.#s(!0,"programmatic")}close(e="programmatic",t){this.#s(!1,e,t)}toggle(){this.#s(!this.#e,"programmatic")}#s(e,t,o){e!==this.#e&&(this.#l=t!=="backdrop",this.#a||this.#u(e,this.#l),this.props.onOpenChange?.(e,o,e?void 0:t))}#u(e,t){const o=this.functionElement;e===this.#e||o===null||!o.isConnected||(this.#e=e,e?this.#m(o):this.#f(o,t))}#m(e){const t=e.ownerDocument,o=t.defaultView,n=o?.ResizeObserver,r=n===void 0?void 0:new n(()=>this.#d());this.#r=t.activeElement,e.showPopover(),this.#h(),r?.observe(e),t.addEventListener("pointerdown",this.#o,!0),t.addEventListener("focusin",this.#o,!0),t.addEventListener("scroll",this.#n,!0),o?.addEventListener("resize",this.#n),this.#i=()=>{t.removeEventListener("pointerdown",this.#o,!0),t.removeEventListener("focusin",this.#o,!0),t.removeEventListener("scroll",this.#n,!0),o?.removeEventListener("resize",this.#n),r?.disconnect(),this.#t!==void 0&&o?.cancelAnimationFrame(this.#t),this.#t=void 0,this.#i=()=>{}},e.addEventListener("keydown",this.#c),this.#p(e)}#f(e,t){const o=this.#r??this.props.anchor??null,n=e.contains(e.ownerDocument.activeElement);this.#i(),e.removeEventListener("keydown",this.#c),e.hidePopover(),t&&n&&this.props.returnFocus!==!1&&o?.isConnected===!0&&o.focus(),this.#r=null,this.props.onClose?.(new Event("close"))}#p(e){const t=this.props.initialFocus;(t instanceof HTMLElement?t:e.querySelector(t??w)??e.querySelector("button:not(:disabled), [tabindex]:not([tabindex='-1']), input:not(:disabled)")??e).focus({preventScroll:!0})}#d(){const e=this.functionElement?.ownerDocument.defaultView;this.#t!==void 0||e===null||e===void 0||(this.#t=e.requestAnimationFrame(()=>{this.#t=void 0,this.#h()}))}#h(){const e=this.functionElement,t=this.props.anchor,o=e?.ownerDocument.defaultView;if(!this.#e||e===null||t===void 0||o===null||o===void 0)return;const n=t.getBoundingClientRect(),r=e.offsetWidth,l=e.offsetHeight,s=o.getComputedStyle(t).direction==="rtl",c=n.bottom+D,d=n.top-D-l,C=c+l<=o.innerHeight-a||d<a?c:d,L=s?n.right-r:n.left,S=o.innerWidth-r-a,y=o.innerHeight-l-a;this.setStyle("left",`${P(L,a,S)}px`),this.setStyle("top",`${P(C,a,y)}px`)}#v(e){const t=this.functionElement,o=e.composedPath(),n=this.props.anchor;t===null||o.includes(t)||n!==void 0&&o.includes(n)||this.#s(!1,"backdrop",e)}#b(e){e.key!=="Escape"||e.defaultPrevented||(this.props.onCancel?.(e),!e.defaultPrevented&&(e.preventDefault(),this.#s(!1,"cancel",e)))}applyComponentProps(){const e=super.readProps(["anchor","defaultOpen","label","open","role"]);if(e.labelChanged&&!("attr:aria-label"in this.props)&&this.setAttribute("aria-label",e.label),e.roleChanged&&this.setAttribute("role",e.role??"dialog"),e.openChanged||e.defaultOpenChanged){const t=this.#a?e.open===!0:A(()=>this.#e||e.defaultOpen===!0);queueMicrotask(()=>this.#u(t,this.#l))}e.anchorChanged&&this.#d()}render(e){return<div class="cw-PickerDialog cw-PickerDialog-docked cw-elevationShadow"popover="manual"tabIndex={-1}>{e}</div>}}const X=H(()=>I,()=>J);function k(i,e){const t=n=>{i.onDismiss?.(n),n.defaultPrevented||e("dismiss",n)},o=n=>{i.onConfirm?.(n),n.defaultPrevented||e("confirm",n)};return<div class="cw-PickerDialog-actions"hidden={i.showActions===!1||i.showActions===void 0&&i.presentation==="docked"}>
1
+ import{Show as R,onCleanup as M,splitProps as O,untrack as A}from"solid-js";import{defineDomComponent as H}from"..";import{Button as E}from"../action/button";import{DomController as T}from"../dom/client";import{Dialog as F}from"../surface/dialog";import"../container/elevation-shadow.css";import"./picker-dialog.css";const w="[data-cw-initial-focus]",D=4,a=8;function P(i,e,t){return Math.max(e,Math.min(i,t));}function I(i,e){const t=i,o=Object.fromEntries(Object.keys(t).filter(n=>n!=="children").map(n=>[n,t[n]]));return<div{...o}aria-label={"aria-label"in o?o["aria-label"]:e.label}classList={{...o.classList,"cw-PickerDialog":!0,"cw-PickerDialog-docked":!0,"cw-elevationShadow":!0}}popover="manual"role={e.role??"dialog"}tabIndex={-1}>{i.children}</div>;}class J extends T{#a;#o;#c;#n;#e;#r;#l;#t;#i;constructor(e){super(e,{styleElementIsFunction:!0}),this.#a="open"in e,this.#o=t=>this.#v(t),this.#c=t=>this.#b(t),this.#n=()=>this.#d(),this.#e=!1,this.#r=null,this.#l=!0,this.#t=void 0,this.#i=()=>{},M(()=>this.#i());}isOpen(){return this.#e;}open(){this.#s(!0,"programmatic");}close(e="programmatic",t){this.#s(!1,e,t);}toggle(){this.#s(!this.#e,"programmatic");}#s(e,t,o){e!==this.#e&&(this.#l=t!=="backdrop",this.#a||this.#u(e,this.#l),this.props.onOpenChange?.(e,o,e?void 0:t));}#u(e,t){const o=this.functionElement;e===this.#e||o===null||!o.isConnected||(this.#e=e,e?this.#m(o):this.#f(o,t));}#m(e){const t=e.ownerDocument,o=t.defaultView,n=o?.ResizeObserver,r=n===void 0?void 0:new n(()=>this.#d());this.#r=t.activeElement,e.showPopover(),this.#h(),r?.observe(e),t.addEventListener("pointerdown",this.#o,!0),t.addEventListener("focusin",this.#o,!0),t.addEventListener("scroll",this.#n,!0),o?.addEventListener("resize",this.#n),this.#i=()=>{t.removeEventListener("pointerdown",this.#o,!0),t.removeEventListener("focusin",this.#o,!0),t.removeEventListener("scroll",this.#n,!0),o?.removeEventListener("resize",this.#n),r?.disconnect(),this.#t!==void 0&&o?.cancelAnimationFrame(this.#t),this.#t=void 0,this.#i=()=>{};},e.addEventListener("keydown",this.#c),this.#p(e);}#f(e,t){const o=this.#r??this.props.anchor??null,n=e.contains(e.ownerDocument.activeElement);this.#i(),e.removeEventListener("keydown",this.#c),e.hidePopover(),t&&n&&this.props.returnFocus!==!1&&o?.isConnected===!0&&o.focus(),this.#r=null,this.props.onClose?.(new Event("close"));}#p(e){const t=this.props.initialFocus;(t instanceof HTMLElement?t:e.querySelector(t??w)??e.querySelector("button:not(:disabled), [tabindex]:not([tabindex='-1']), input:not(:disabled)")??e).focus({preventScroll:!0});}#d(){const e=this.functionElement?.ownerDocument.defaultView;this.#t!==void 0||e===null||e===void 0||(this.#t=e.requestAnimationFrame(()=>{this.#t=void 0,this.#h();}));}#h(){const e=this.functionElement,t=this.props.anchor,o=e?.ownerDocument.defaultView;if(!this.#e||e===null||t===void 0||o===null||o===void 0)return;const n=t.getBoundingClientRect(),r=e.offsetWidth,l=e.offsetHeight,s=o.getComputedStyle(t).direction==="rtl",c=n.bottom+D,d=n.top-D-l,C=c+l<=o.innerHeight-a||d<a?c:d,L=s?n.right-r:n.left,S=o.innerWidth-r-a,y=o.innerHeight-l-a;this.setStyle("left",`${P(L,a,S)}px`),this.setStyle("top",`${P(C,a,y)}px`);}#v(e){const t=this.functionElement,o=e.composedPath(),n=this.props.anchor;t===null||o.includes(t)||n!==void 0&&o.includes(n)||this.#s(!1,"backdrop",e);}#b(e){e.key!=="Escape"||e.defaultPrevented||(this.props.onCancel?.(e),!e.defaultPrevented&&(e.preventDefault(),this.#s(!1,"cancel",e)));}applyComponentProps(){const e=super.readProps(["anchor","defaultOpen","label","open","role"]);if(e.labelChanged&&!("attr:aria-label"in this.props)&&this.setAttribute("aria-label",e.label),e.roleChanged&&this.setAttribute("role",e.role??"dialog"),e.openChanged||e.defaultOpenChanged){const t=this.#a?e.open===!0:A(()=>this.#e||e.defaultOpen===!0);queueMicrotask(()=>this.#u(t,this.#l));}e.anchorChanged&&this.#d();}render(e){return<div class="cw-PickerDialog cw-PickerDialog-docked cw-elevationShadow"popover="manual"tabIndex={-1}>{e}</div>;}}const X=/* @__PURE__ */H(()=>I,()=>J);function k(i,e){const t=n=>{i.onDismiss?.(n),n.defaultPrevented||e("dismiss",n);},o=n=>{i.onConfirm?.(n),n.defaultPrevented||e("confirm",n);};return<div class="cw-PickerDialog-actions"hidden={i.showActions===!1||i.showActions===void 0&&i.presentation==="docked"}>
2
2
  <E variant="text"size="sm"onClick={t}>{i.dismissLabel??"Cancel"}</E>
3
3
  <E variant="text"size="sm"disabled={i.confirmDisabled}onClick={o}>
4
4
  {i.confirmLabel??"OK"}
5
5
  </E>
6
- </div>}const W=i=>{const[e,t]=O(i,["anchor","children","confirmDisabled","confirmLabel","controllerRef","dismissLabel","onConfirm","onDismiss","presentation","showActions"]);let o;const n=(s,c)=>o?.close(s,c),r=s=>{o=s,e.controllerRef?.(s)},l=()=>{const s=e.children;return typeof s=="function"?s():s};return<R when={e.presentation==="docked"}fallback={<F{...t}classList={{...t.classList,"cw-PickerDialog":!0}}controllerRef={r}initialFocus={t.initialFocus??w}modal>
6
+ </div>;}const W=i=>{const[e,t]=O(i,["anchor","children","confirmDisabled","confirmLabel","controllerRef","dismissLabel","onConfirm","onDismiss","presentation","showActions"]);let o;const n=(s,c)=>o?.close(s,c),r=s=>{o=s,e.controllerRef?.(s);},l=()=>{const s=e.children;return typeof s=="function"?s():s;};return<R when={e.presentation==="docked"}fallback={<F{...t}classList={{...t.classList,"cw-PickerDialog":!0}}controllerRef={r}initialFocus={t.initialFocus??w}modal>
7
7
  {l()}
8
8
  {k(i,n)}
9
9
  </F>}>
@@ -11,4 +11,4 @@ import{Show as R,onCleanup as M,splitProps as O,untrack as A}from"solid-js";impo
11
11
  {l()}
12
12
  {k(i,n)}
13
13
  </X>
14
- </R>};export{W as PickerDialog};
14
+ </R>;};export{W as PickerDialog};
@@ -1,6 +1,6 @@
1
- import{For as E,createMemo as S,createUniqueId as f,onCleanup as L,onMount as V,untrack as p}from"solid-js";import{defineDomComponent as J}from"..";import{DomController as X}from"../dom/client";import{createFieldLabel as O,firstInputSlotOf as h,idReferencesOf as w,inputErrorOf as A,observeFormReset as q,observeLabelInlineSize as K,splitInputElementProps as G,supportingSlotOf as I}from"./base";import"./text-field.css";import"./select.css";const o="cw-Select",H="cw-Select-disabled",T="cw-Select-error",M="cw-Select-readOnly",D="_cw-Select-noAsterisk",k="cw-Select-select",b="cw-Select-placeholder",P=new Set([" ","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","F4","Home","PageDown","PageUp"]);function _(d){return`_cw-Select-${d??"filled"}`}function N(d){return"options"in d}function x(d,e){return<E each={d()}>{t=>{if(!N(t))return e(t);const{disabled:i,label:n}=t;return<optgroup disabled={i===!0}label={n}>
1
+ import{For as E,createMemo as S,createUniqueId as f,onCleanup as L,onMount as V,untrack as p}from"solid-js";import{defineDomComponent as J}from"..";import{DomController as X}from"../dom/client";import{createFieldLabel as O,firstInputSlotOf as h,idReferencesOf as w,inputErrorOf as A,observeFormReset as q,observeLabelInlineSize as K,splitInputElementProps as G,supportingSlotOf as I}from"./base";import"./text-field.css";import"./select.css";const o="cw-Select",H="cw-Select-disabled",T="cw-Select-error",M="cw-Select-readOnly",D="_cw-Select-noAsterisk",k="cw-Select-select",b="cw-Select-placeholder",P=/* @__PURE__ */new Set([" ","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","F4","Home","PageDown","PageUp"]);function _(d){return`_cw-Select-${d??"filled"}`;}function N(d){return"options"in d;}function x(d,e){return<E each={d()}>{t=>{if(!N(t))return e(t);const{disabled:i,label:n}=t;return<optgroup disabled={i===!0}label={n}>
2
2
  <E each={t.options}>{e}</E>
3
- </optgroup>}}</E>}function U(d,e){const t=f(),i=f(),n=A(e),s=I(e,n),a=G(d),{containerProps:l,elementProps:r}=a,v=e.invalid===!0||n!==void 0,m=e.disabled===!0,g=e.readOnly===!0,u="value"in e?e.value??"":e.defaultValue,y=e.id??r.id??t,R={...r,"aria-describedby":w(r["aria-describedby"],s===void 0?void 0:i),"aria-invalid":"aria-invalid"in r?r["aria-invalid"]:v?"true":void 0,"aria-readonly":"aria-readonly"in r?r["aria-readonly"]:g?"true":void 0,class:k,disabled:m,id:y,name:e.name,required:e.required===!0},F=c=><option disabled={c.disabled===!0}selected={u!==void 0&&c.value===u}value={c.value}>{c.label}</option>,C=O(o);return<div{...l}classList={{...l.classList,[_(e.variant)]:!0,[H]:m,[T]:v,[D]:e.noAsterisk===!0,[M]:g,[o]:!0}}>
3
+ </optgroup>;}}</E>;}function U(d,e){const t=f(),i=f(),n=A(e),s=I(e,n),a=G(d),{containerProps:l,elementProps:r}=a,v=e.invalid===!0||n!==void 0,m=e.disabled===!0,g=e.readOnly===!0,u="value"in e?e.value??"":e.defaultValue,y=e.id??r.id??t,R={...r,"aria-describedby":w(r["aria-describedby"],s===void 0?void 0:i),"aria-invalid":"aria-invalid"in r?r["aria-invalid"]:v?"true":void 0,"aria-readonly":"aria-readonly"in r?r["aria-readonly"]:g?"true":void 0,class:k,disabled:m,id:y,name:e.name,required:e.required===!0},F=c=><option disabled={c.disabled===!0}selected={u!==void 0&&c.value===u}value={c.value}>{c.label}</option>,C=O(o);return<div{...l}classList={{...l.classList,[_(e.variant)]:!0,[H]:m,[T]:v,[D]:e.noAsterisk===!0,[M]:g,[o]:!0}}>
4
4
  <div class="cw-Select-control">
5
5
  <span class="cw-Select-leading">
6
6
  {h(()=>e.leading,()=>e.leadingIcon)}
@@ -29,7 +29,7 @@ import{For as E,createMemo as S,createUniqueId as f,onCleanup as L,onMount as V,
29
29
  {s}
30
30
  </span>
31
31
  </div>
32
- </div>}class z extends X{#s;#c;#d;#o;#u;#t;#e;#n;#l;constructor(e){super(e,{functionElementIsStatic:!0}),this.#s="value"in e,this.#c=f(),this.#d=f(),this.#o=S(()=>A(e)),this.#u=S(()=>I(e,this.#o())),this.#t=null,this.#e=void 0,this.#n=null,this.#l=()=>{},V(()=>{const t=this.#r();t!==null&&this.#p(t),L(K(this,o))}),L(()=>{this.#n?.disconnect(),this.#l()})}#r(){return this.functionElement}#a(e){const t=`attr:${e}`;return t in this.props?[super.readProp(t)[0],!0]:[void 0,!1]}#h(){const[e]=this.#a("id");return this.props.id??e??this.#c}#p(e){this.#l(),this.#l=q(e,this.#v)}#i(e,t){(e.value!==t||e.selectedIndex<0)&&(e.value=t);const i=e.selectedIndex<0?null:e.options[e.selectedIndex];for(const n of Array.from(e.options))n.defaultSelected!==(n===i)&&(n.defaultSelected=n===i);this.#n?.takeRecords(),this.#e=t}#S(e){const t=Array.from(e.options),i=t.find(a=>a.defaultSelected),n=e.selectedIndex<0?void 0:t[e.selectedIndex],s=p(()=>this.props.defaultValue);if(i!==void 0&&n!==void 0&&n!==i){this.#e=n.value;return}s!==void 0?this.#i(e,s):i===void 0&&t[0]?.classList.contains(b)?this.#i(e,""):this.#e=e.value}#b=()=>{const e=this.#r();e!==null&&(this.#s?this.#i(e,p(()=>this.props.value)??""):this.#e!==void 0&&e.value!==this.#e&&(e.value=this.#e))};#v=()=>{const e=this.#r();e!==null&&(this.#e=e.value)};#m=e=>{const t=e.currentTarget,{onChange:i,onSelectedChange:n,onValueChange:s,readOnly:a}=this.props,l=t.value;if(a===!0){this.#e!==void 0&&(t.value=this.#e);return}this.#e=l,s?.(l,e),n!==s&&n?.(l,e),i!==s&&i!==n&&i?.(l,e),this.#s&&this.#i(t,p(()=>this.props.value)??"")};#f=e=>{this.props.readOnly===!0&&e.preventDefault()};#g=e=>{const t=e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey;this.props.readOnly===!0&&(t||P.has(e.key))&&e.preventDefault()};applyComponentProps(){const e=super.readProps(["disabled","id","invalid","name","noAsterisk","readOnly","required","value","variant"]),t=this.#r(),[i]=this.#a("aria-describedby"),[,n]=this.#a("aria-invalid"),[,s]=this.#a("aria-readonly"),a=e.invalid===!0||this.#o()!==void 0,l=this.#h();e.variantChanged&&super.setClass("variant",_(e.variant)),e.disabledChanged&&(super.setClass(H,e.disabled===!0),super.setAttribute("disabled",e.disabled===!0)),e.readOnlyChanged&&(super.setClass(M,e.readOnly===!0),s||super.setAttribute("aria-readonly",e.readOnly===!0?"true":void 0)),super.setClass(T,a),n||super.setAttribute("aria-invalid",a?"true":void 0),super.setAttribute("aria-describedby",w(i,this.#u()===void 0?void 0:this.#d)),super.setAttribute("id",l),this.#t!==null&&(this.#t.htmlFor=l),e.requiredChanged&&super.setAttribute("required",e.required===!0),e.noAsteriskChanged&&super.setClass(D,e.noAsterisk===!0),e.nameChanged&&super.setAttribute("name",e.name),t!==null&&(this.#s?e.valueChanged&&this.#i(t,e.value??""):this.#e===void 0&&this.#S(t))}onFunctionElementChanged(e){super.onFunctionElementChanged(e),e!==null&&(e.addEventListener("change",this.#m),e.addEventListener("click",this.#f),e.addEventListener("keydown",this.#g),e.addEventListener("mousedown",this.#f),this.#n=new MutationObserver(this.#b),this.#n.observe(e,{attributeFilter:["selected","value"],childList:!0,subtree:!0}),this.#p(e))}render(e,t){const i="placeholder"in this.props,n=S(()=>this.props.options!==void 0),s=this.#d,a=r=><option disabled={r.disabled===!0}value={r.value}>{r.label}</option>,l=O(o);return<div class={o}>
32
+ </div>;}class z extends X{#s;#c;#d;#o;#u;#t;#e;#n;#l;constructor(e){super(e,{functionElementIsStatic:!0}),this.#s="value"in e,this.#c=f(),this.#d=f(),this.#o=S(()=>A(e)),this.#u=S(()=>I(e,this.#o())),this.#t=null,this.#e=void 0,this.#n=null,this.#l=()=>{},V(()=>{const t=this.#r();t!==null&&this.#p(t),L(K(this,o));}),L(()=>{this.#n?.disconnect(),this.#l();});}#r(){return this.functionElement;}#a(e){const t=`attr:${e}`;return t in this.props?[super.readProp(t)[0],!0]:[void 0,!1];}#h(){const[e]=this.#a("id");return this.props.id??e??this.#c;}#p(e){this.#l(),this.#l=q(e,this.#v);}#i(e,t){(e.value!==t||e.selectedIndex<0)&&(e.value=t);const i=e.selectedIndex<0?null:e.options[e.selectedIndex];for(const n of Array.from(e.options))n.defaultSelected!==(n===i)&&(n.defaultSelected=n===i);this.#n?.takeRecords(),this.#e=t;}#S(e){const t=Array.from(e.options),i=t.find(a=>a.defaultSelected),n=e.selectedIndex<0?void 0:t[e.selectedIndex],s=p(()=>this.props.defaultValue);if(i!==void 0&&n!==void 0&&n!==i){this.#e=n.value;return;}s!==void 0?this.#i(e,s):i===void 0&&t[0]?.classList.contains(b)?this.#i(e,""):this.#e=e.value;}#b=()=>{const e=this.#r();e!==null&&(this.#s?this.#i(e,p(()=>this.props.value)??""):this.#e!==void 0&&e.value!==this.#e&&(e.value=this.#e));};#v=()=>{const e=this.#r();e!==null&&(this.#e=e.value);};#m=e=>{const t=e.currentTarget,{onChange:i,onSelectedChange:n,onValueChange:s,readOnly:a}=this.props,l=t.value;if(a===!0){this.#e!==void 0&&(t.value=this.#e);return;}this.#e=l,s?.(l,e),n!==s&&n?.(l,e),i!==s&&i!==n&&i?.(l,e),this.#s&&this.#i(t,p(()=>this.props.value)??"");};#f=e=>{this.props.readOnly===!0&&e.preventDefault();};#g=e=>{const t=e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey;this.props.readOnly===!0&&(t||P.has(e.key))&&e.preventDefault();};applyComponentProps(){const e=super.readProps(["disabled","id","invalid","name","noAsterisk","readOnly","required","value","variant"]),t=this.#r(),[i]=this.#a("aria-describedby"),[,n]=this.#a("aria-invalid"),[,s]=this.#a("aria-readonly"),a=e.invalid===!0||this.#o()!==void 0,l=this.#h();e.variantChanged&&super.setClass("variant",_(e.variant)),e.disabledChanged&&(super.setClass(H,e.disabled===!0),super.setAttribute("disabled",e.disabled===!0)),e.readOnlyChanged&&(super.setClass(M,e.readOnly===!0),s||super.setAttribute("aria-readonly",e.readOnly===!0?"true":void 0)),super.setClass(T,a),n||super.setAttribute("aria-invalid",a?"true":void 0),super.setAttribute("aria-describedby",w(i,this.#u()===void 0?void 0:this.#d)),super.setAttribute("id",l),this.#t!==null&&(this.#t.htmlFor=l),e.requiredChanged&&super.setAttribute("required",e.required===!0),e.noAsteriskChanged&&super.setClass(D,e.noAsterisk===!0),e.nameChanged&&super.setAttribute("name",e.name),t!==null&&(this.#s?e.valueChanged&&this.#i(t,e.value??""):this.#e===void 0&&this.#S(t));}onFunctionElementChanged(e){super.onFunctionElementChanged(e),e!==null&&(e.addEventListener("change",this.#m),e.addEventListener("click",this.#f),e.addEventListener("keydown",this.#g),e.addEventListener("mousedown",this.#f),this.#n=new MutationObserver(this.#b),this.#n.observe(e,{attributeFilter:["selected","value"],childList:!0,subtree:!0}),this.#p(e));}render(e,t){const i="placeholder"in this.props,n=S(()=>this.props.options!==void 0),s=this.#d,a=r=><option disabled={r.disabled===!0}value={r.value}>{r.label}</option>,l=O(o);return<div class={o}>
33
33
  <div class="cw-Select-control">
34
34
  <span class="cw-Select-leading">
35
35
  {h(()=>this.props.leading,()=>this.props.leadingIcon)}
@@ -60,4 +60,4 @@ import{For as E,createMemo as S,createUniqueId as f,onCleanup as L,onMount as V,
60
60
  {this.#u()}
61
61
  </span>
62
62
  </div>
63
- </div>}}const B=J(()=>U,()=>z),ee=B;export{ee as ExposedDropdownMenu,B as Select,z as SelectController};
63
+ </div>;}}const B=/* @__PURE__ */J(()=>U,()=>z),ee=B;export{ee as ExposedDropdownMenu,B as Select,z as SelectController};