@ksojecki/purpose-ui-docs 0.0.0-stage → 0.4.0-next.20261201210225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/Karla_wght_-Cc-z3u01.ttf +0 -0
- package/dist/client/assets/cally-Cs0zwns0.js +1 -0
- package/dist/client/assets/index-BTS5Qh-X.js +2678 -0
- package/dist/client/assets/index-CbRdAulD.css +2 -0
- package/dist/client/components/alert/index.html +45 -0
- package/dist/client/components/avatar/index.html +68 -0
- package/dist/client/components/badge/index.html +43 -0
- package/dist/client/components/bottom-sheet/index.html +28 -0
- package/dist/client/components/button/index.html +124 -0
- package/dist/client/components/button-group/index.html +29 -0
- package/dist/client/components/card/index.html +33 -0
- package/dist/client/components/checkbox/index.html +28 -0
- package/dist/client/components/color-input/index.html +34 -0
- package/dist/client/components/confirm-delete-panel/index.html +33 -0
- package/dist/client/components/consent-banner/index.html +47 -0
- package/dist/client/components/consent-settings/index.html +57 -0
- package/dist/client/components/data-table/index.html +69 -0
- package/dist/client/components/date-picker/index.html +40 -0
- package/dist/client/components/disclosure/index.html +33 -0
- package/dist/client/components/divider/index.html +32 -0
- package/dist/client/components/dropdown/index.html +46 -0
- package/dist/client/components/empty-state/index.html +28 -0
- package/dist/client/components/field/index.html +42 -0
- package/dist/client/components/file-input/index.html +52 -0
- package/dist/client/components/filter-bar/index.html +31 -0
- package/dist/client/components/filter-row/index.html +30 -0
- package/dist/client/components/form-actions/index.html +40 -0
- package/dist/client/components/form-field/index.html +36 -0
- package/dist/client/components/heading/index.html +35 -0
- package/dist/client/components/icon-action-buttons/index.html +31 -0
- package/dist/client/components/icon-button/index.html +44 -0
- package/dist/client/components/index.html +17 -0
- package/dist/client/components/input/index.html +41 -0
- package/dist/client/components/link/index.html +36 -0
- package/dist/client/components/menu/index.html +53 -0
- package/dist/client/components/metric/index.html +34 -0
- package/dist/client/components/modal-window/index.html +70 -0
- package/dist/client/components/nav-menu/index.html +52 -0
- package/dist/client/components/page/index.html +31 -0
- package/dist/client/components/page-container/index.html +30 -0
- package/dist/client/components/page-header/index.html +38 -0
- package/dist/client/components/paragraph/index.html +27 -0
- package/dist/client/components/progress/index.html +34 -0
- package/dist/client/components/prose/index.html +34 -0
- package/dist/client/components/public-layout/index.html +65 -0
- package/dist/client/components/radio/index.html +64 -0
- package/dist/client/components/range/index.html +44 -0
- package/dist/client/components/section/index.html +39 -0
- package/dist/client/components/segmented-control/index.html +37 -0
- package/dist/client/components/select/index.html +33 -0
- package/dist/client/components/skeleton/index.html +29 -0
- package/dist/client/components/spinner/index.html +30 -0
- package/dist/client/components/switch/index.html +28 -0
- package/dist/client/components/table/index.html +42 -0
- package/dist/client/components/textarea/index.html +31 -0
- package/dist/client/components/time-picker/index.html +38 -0
- package/dist/client/components/toast/index.html +40 -0
- package/dist/client/components/tooltip/index.html +34 -0
- package/dist/client/contributing/index.html +69 -0
- package/dist/client/getting-started/index.html +44 -0
- package/dist/client/icons/index.html +50 -0
- package/dist/client/index.html +46 -0
- package/dist/client/purposes/index.html +52 -0
- package/dist/client/theme-config.schema.json +124 -0
- package/dist/client/theme-init.js +15 -0
- package/dist/client/theming/index.html +42 -0
- package/dist/client/version.json +1 -0
- package/package.json +17 -4
- package/README.md +0 -3
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{#e;#t=new Set;constructor(e){this.#e=e}get current(){return this.#e}set current(e){this.#e!=e&&(this.#e=e,this.#t.forEach(t=>t(e)))}on(e){return this.#t.add(e),()=>this.#t.delete(e)}},t=t=>new e(t),n=Symbol.for(`atomico.hooks`);globalThis[n]=globalThis[n]||{};var r=globalThis[n],i=Symbol.for(`Atomico.suspense`),a=Symbol.for(`Atomico.effect`),o=Symbol.for(`Atomico.layoutEffect`),s=Symbol.for(`Atomico.insertionEffect`),c=(e,t,n)=>{let{i,hooks:a}=r.c,o=a[i]=a[i]||{};return o.value=e(o.value),o.effect=t,o.tag=n,r.c.i++,a[i].value},l=e=>c((n=t(e))=>n),u=()=>c((e=t(r.c.host))=>e),d=()=>r.c.update,f=(e,t,n=0)=>{let c={},l=!1,u=()=>l,d=(e,t)=>{for(let n in c){let r=c[n];r.effect&&r.tag===e&&(r.value=r.effect(r.value,t))}};return{load:a=>{r.c={host:t,hooks:c,update:e,i:0,id:n};let o;try{l=!1,o=a()}catch(e){if(e!==i)throw e;l=!0}finally{r.c=null}return o},cleanEffects:e=>(d(s,e),()=>(d(o,e),()=>{d(a,e)})),isSuspense:u}},p=Symbol.for;function m(e,t){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}var h=e=>typeof e==`function`,g=e=>typeof e==`object`,{isArray:_}=Array,v=(e,t)=>(!t||e instanceof HTMLStyleElement)&&`hydrate`in(e?.dataset||{});function ee(e,t){let n,r=e=>{let{length:i}=e;for(let a=0;a<i;a++){let i=e[a];if(i&&Array.isArray(i))r(i);else{let e=typeof i;if(i==null||e===`function`||e===`boolean`)continue;e===`string`||e===`number`?(n??=``,n+=i):(n!=null&&(t(n),n=null),t(i))}}};r(e),n!=null&&t(n)}var y=(e,t,n)=>(e.addEventListener(t,n),()=>e.removeEventListener(t,n)),b=class{constructor(e,t,n){this.message=t,this.target=e,this.value=n}},x=class extends b{},te=class extends b{},S=`Custom`,ne=null,re={true:1,"":1,1:1};function ie(e,t,n,r,i){let{type:a,reflect:o,event:s,value:c,attr:l=oe(t)}=n?.name!=S&&g(n)&&n!=ne?n:{type:n},u=a?.name===S&&a.map,d=c==null?null:a==Function||!h(c)?()=>c:c;Object.defineProperty(e,t,{configurable:!0,set(e){let n=this[t];d&&a!=Boolean&&e==null&&(e=d());let{error:r,value:i}=(u?le:ue)(a,e);if(r&&i!=null)throw new x(this,`The value defined for prop '${t}' must be of type '${a.name}'`,i);n!=i&&(this._props[t]=i??void 0,this.update(),s&&ae(this,s),this.updated.then(()=>{o&&(this._ignoreAttr=l,se(this,a,l,this[t]),this._ignoreAttr=null)}))},get(){return this._props[t]}}),d&&(i[t]=d()),r[l]={prop:t,type:a}}var ae=(e,{type:t,base:n=CustomEvent,...r})=>e.dispatchEvent(new n(t,r)),oe=e=>e.replace(/([A-Z])/g,`-$1`).toLowerCase(),se=(e,t,n,r)=>r==null||t==Boolean&&!r?e.removeAttribute(n):e.setAttribute(n,t?.name===S&&t?.serialize?t?.serialize(r):g(r)?JSON.stringify(r):t==Boolean?``:r),ce=(e,t)=>e==Boolean?!!re[t]:e==Number?Number(t):e==String?t:e==Array||e==Object?JSON.parse(t):e.name==S?t:new e(t),le=({map:e},t)=>{try{return{value:e(t),error:!1}}catch{return{value:t,error:!0}}},ue=(e,t)=>e==null||t==null?{value:t,error:!1}:e!=String&&t===``?{value:void 0,error:!1}:e==Object||e==Array||e==Symbol?{value:t,error:{}.toString.call(t)!==`[object ${e.name}]`}:t instanceof e?{value:t,error:e==Number&&Number.isNaN(t.valueOf())}:e==String||e==Number||e==Boolean?{value:t,error:e==Number?typeof t!=`number`||Number.isNaN(t):e==String?typeof t!=`string`:typeof t!=`boolean`}:{value:t,error:!0},de=0,fe=e=>(e?.dataset||{})?.hydrate||`c`+de++,C=(e,t=HTMLElement)=>{let n={},r={},i=`prototype`in t&&t.prototype instanceof Element,a=i?t:`base`in t?t.base:HTMLElement,{props:o,styles:s}=i?e:t;class c extends a{constructor(){super(),this._setup(),this._render=()=>e({...this._props});for(let e in r)this[e]=r[e]}static get styles(){return[super.styles,s]}async _setup(){if(this._props)return;this._props={};let e,t;this.mounted=new Promise(n=>this.mount=()=>{n(),e!=this.parentNode&&(t==e?this.update():this.unmounted.then(this.update)),e=this.parentNode}),this.unmounted=new Promise(r=>this.unmount=()=>{r(),e==this.parentNode&&this.isConnected||(n.cleanEffects(!0)()(),t=this.parentNode,e=null)}),this.symbolId=this.symbolId||Symbol(),this.symbolIdParent=Symbol();let n=f(()=>this.update(),this,fe(this)),r,i=!0,a=v(this);this.update=()=>(r||(r=!0,this.updated=(this.updated||this.mounted).then(()=>{try{let e=n.load(this._render),t=n.cleanEffects();return e&&e.render(this,this.symbolId,a),r=!1,i&&!n.isSuspense()&&(i=!1,!a&&pe(this)),t()}finally{r=!1}}).then(e=>{e&&e()})),this.updated),this.update()}connectedCallback(){this.mount(),super.connectedCallback&&super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),this.unmount()}attributeChangedCallback(e,t,r){if(n[e]){if(e===this._ignoreAttr||t===r)return;let{prop:i,type:a}=n[e];try{this[i]=ce(a,r)}catch{throw new te(this,`The value defined as attr '${e}' cannot be parsed by type '${a.name}'`,r)}}else super.attributeChangedCallback(e,t,r)}static get props(){return{...super.props,...o}}static get observedAttributes(){let e=super.observedAttributes||[];for(let e in o)ie(this.prototype,e,o[e],n,r);return Object.keys(n).concat(e)}}return c};function pe(e){let{styles:t}=e.constructor,{shadowRoot:n}=e;if(n&&t.length){let e=[];ee(t,t=>{t&&(t instanceof Element?n.appendChild(t.cloneNode(!0)):e.push(t))}),e.length&&(n.adoptedStyleSheets=e)}}var me=e=>(t,n)=>{c(([e,t]=[])=>((t||!t)&&(t&&m(t,n)?e||=!0:(h(e)&&e(),e=null)),[e,n]),([e,n],r)=>r?(h(e)&&e(),[]):[e||t(),n],e)},w=me(a),he=me(s),ge=class extends Array{constructor(e,t){let n=!0,r=e=>{try{t(e,this,n)}finally{n=!1}};super(void 0,r,t),r(e)}},T=e=>{let t=d();return c((n=new ge(e,(e,n,r)=>{e=h(e)?e(n[0]):e,e!==n[0]&&(n[0]=e,r||t())}))=>n)},E=(e,t)=>{let[n]=c(([n,r,i=0]=[])=>((!r||r&&!m(r,t))&&(n=e()),[n,t,i]));return n},D=e=>{let{current:t}=u();if(!(e in t))throw new x(t,`For useProp("${e}"), the prop does not exist on the host.`,e);return c((n=new ge(t[e],(n,r)=>{n=h(n)?n(t[e]):n,t[e]=n}))=>(n[0]=t[e],n))},O=(e,t={})=>{let n=u();return n[e]||(n[e]=(r=t.detail)=>ae(n.current,{type:e,...t,detail:r})),n[e]},k=p(`atomico/options`);globalThis[k]=globalThis[k]||{sheet:!!document.adoptedStyleSheets};var A=globalThis[k],_e=new Promise(e=>{A.ssr||(document.readyState===`loading`?y(document,`DOMContentLoaded`,e):e())}),ve={checked:1,value:1,selected:1},ye={list:1,type:1,size:1,form:1,width:1,height:1,src:1,href:1,slot:1},be={shadowDom:1,staticNode:1,cloneNode:1,children:1,key:1},j={},M=[],N=class extends Text{},xe=p(`atomico/id`),P=p(`atomico/type`),F=p(`atomico/ref`),Se=p(`atomico/vnode`),Ce=()=>{};function we(e,t,n){return Ee(this,e,t,n)}var Te=(e,t,...n)=>{let r=t||j,{children:i}=r;if(i??=n.length?n:M,e===Ce)return i;let a=e?e instanceof Node?1:e.prototype instanceof HTMLElement&&2:0;if(a===!1&&e instanceof Function)return e(i==M?r:{children:i,...r});let o=A.render||we;return{[P]:Se,type:e,props:r,children:i,key:r.key,shadow:r.shadowDom,static:r.staticNode,raw:a,is:r.is,clone:r.cloneNode,render:o}};function Ee(e,t,n=xe,r,i){let a;if(t&&t[n]&&t[n].vnode==e||e[P]!=Se)return t;(e||!t)&&(i||=e.type==`svg`,a=e.type!=`host`&&(e.raw==1?(t&&e.clone?t[F]:t)!=e.type:e.raw==2?!(t instanceof e.type):t?t[F]||t.localName!=e.type:!t),a&&e.type!=null&&(e.raw==1&&e.clone?(r=!0,t=e.type.cloneNode(!0),t[F]=e.type):t=e.raw==1?e.type:e.raw==2?new e.type:i?document.createElementNS(`http://www.w3.org/2000/svg`,e.type):document.createElement(e.type,e.is?{is:e.is}:void 0)));let o=t[n]?t[n]:j,{vnode:s=j,cycle:c=0}=o,{fragment:l,handlers:u}=o,{children:d=M,props:f=j}=s;if(u=a?{}:u||{},e.static&&!a)return t;if(e.shadow&&!t.shadowRoot&&t.attachShadow({mode:`open`,...e.shadow}),e.props!=f&&ke(t,f,e.props,u,i),e.children!==d){let a=e.shadow?t.shadowRoot:t;l=Oe(e.children,l,a,n,!c&&r,i&&e.type==`foreignObject`?!1:i)}return t[n]={vnode:e,handlers:u,fragment:l,cycle:c+1},t}function De(e,t){let n=new N(``),r=new N(``),i;if(e[t?`prepend`:`append`](n),t){let{lastElementChild:t}=e;for(;t;){let{previousElementSibling:e}=t;if(v(t,!0)&&!v(e,!0)){i=t;break}t=e}}return i?i.before(r):e.append(r),{markStart:n,markEnd:r}}function Oe(e,t,n,r,i,a){e=e==null?null:_(e)?e:[e];let o=t||De(n,i),{markStart:s,markEnd:c,keyes:l}=o,u,d=l&&new Set,f=s;if(e&&ee(e,e=>{if(typeof e==`object`&&!e[P])return;let t=e[P]&&e.key,o=l&&t!=null&&l.get(t);f!=c&&f===o?d.delete(f):f=f==c?c:f.nextSibling;let s=l?o:f,p=s;if(e[P])p=Ee(e,s,r,i,a);else{let t=e+``;!(p instanceof Text)||p instanceof N?p=new Text(t):p.data!=t&&(p.data=t)}p!=f&&(l&&d.delete(p),!s||l?(n.insertBefore(p,f),l&&f!=c&&d.add(f)):s==c?n.insertBefore(p,c):(n.replaceChild(p,s),f=p)),t!=null&&(u||=new Map,u.set(t,p))}),f=f==c?c:f.nextSibling,t&&f!=c)for(;f!=c;){let e=f;f=f.nextSibling,e.remove()}return d&&d.forEach(e=>e.remove()),o.keyes=u,o}function ke(e,t,n,r,i){for(let a in t)!(a in n)&&Ae(e,a,t[a],null,i,r);for(let a in n)Ae(e,a,t[a],n[a],i,r)}function Ae(e,t,n,r,i,a){if(t=t==`class`&&!i?`className`:t,n??=null,r??=null,t in e&&ve[t]&&(n=e[t]),!(r===n||be[t]||t[0]==`_`)){if(e.localName===`slot`&&t===`assignNode`&&`assign`in e)e.assign(r);else if(t[0]==`o`&&t[1]==`n`&&(h(r)||h(n)))je(e,t.slice(2),r,a);else if(t==`ref`)r&&(h(r)?r(e):r.current=e);else if(t==`style`){let{style:t}=e;n||=``,r||=``;let i=g(n),a=g(r);if(i)for(let e in n)if(a)!(e in r)&&Me(t,e,null);else break;if(a)for(let e in r){let a=r[e];i&&n[e]===a||Me(t,e,a)}else t.cssText=r}else{let a=t[0]==`$`?t.slice(1):t;a===t&&(!i&&!ye[t]&&t in e||h(r)||h(n))?e[t]=r??``:r==null?e.removeAttribute(a):e.setAttribute(a,g(r)?JSON.stringify(r):r)}}}function je(e,t,n,r){if(r.handleEvent||=t=>r[t.type].call(e,t),n){if(!r[t]){let i=n.capture||n.once||n.passive?Object.assign({},n):null;e.addEventListener(t,r,i)}r[t]=n}else r[t]&&(e.removeEventListener(t,r),delete r[t])}function Me(e,t,n){let r=`setProperty`;n??=(r=`removeProperty`,null),~t.indexOf(`-`)?e[r](t,n):e[t]=n}var Ne=Te(`host`,{style:`display: contents`}),Pe=`value`,Fe=(e,t)=>{let n=u(),r=l();he(()=>y(n.current,`ConnectContext`,t=>{t.composedPath().at(0)!==t.currentTarget&&e===t.detail.id&&(t.stopPropagation(),t.detail.connect(r))}),[e]),r.current=t},I=e=>{let t=O(`ConnectContext`,{bubbles:!0,composed:!0}),[n,r]=T(()=>{if(A.ssr)return;let n;return t({id:e,connect(e){n=e}}),n}),i=d();return w(()=>{_e.then(()=>t({id:e,connect:r}))},[e]),w(()=>{if(n)return n.on(i)},[n]),n?.current||e[Pe]},Ie=e=>{let t=C(({value:e})=>(Fe(t,e),Ne),{props:{value:{type:Object,value:()=>e}}});return t[Pe]=e,t};Ie({dispatch(e,t){}});var Le={};function L(e,...t){let n=(e.raw||e).reduce((e,n,r)=>e+n+(t[r]||``),``);return Le[n]=Le[n]||Re(n)}function Re(e){if(A.sheet){let t=new CSSStyleSheet;return t.replaceSync(e),t}{let t=document.createElement(`style`);return t.textContent=e,t}}var R=(e,t,n)=>(t==null?t={key:n}:t.key=n,Te(e,t)),z=R,B=L`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`,V=L`.vh{position:absolute;transform:scale(0)}`;function H(){let e=new Date;return new q(e.getFullYear(),e.getMonth()+1,e.getDate())}var ze=864e5;function Be(e){let t=G(e);t.setUTCDate(t.getUTCDate()+3-(t.getUTCDay()+6)%7);let n=new Date(Date.UTC(t.getUTCFullYear(),0,4));return 1+Math.round(((t.getTime()-n.getTime())/ze-3+(n.getUTCDay()+6)%7)/7)}function U(e,t=0){let n=G(e),r=n.getUTCDay(),i=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-i),q.from(n)}function Ve(e,t=0){return U(e,t).add({days:6})}function He(e){return q.from(new Date(Date.UTC(e.year,e.month,0)))}function W(e,t,n){return t&&q.compare(e,t)<0?t:n&&q.compare(e,n)>0?n:e}var Ue={days:1};function We(e,t=0){let n=U(e.toPlainDate(),t),r=Ve(He(e),t),i=[];for(;q.compare(n,r)<0;){let e=[];for(let t=0;t<7;t++)e.push(n),n=n.add(Ue);i.push(e)}return i}function G(e){return new Date(Date.UTC(e.year,e.month-1,e.day??1))}var Ge=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/,K=(e,t)=>e.toString().padStart(t,`0`),q=class e{constructor(e,t,n){this.year=e,this.month=t,this.day=n}add(t){let n=G(this);if(`days`in t)return n.setUTCDate(this.day+t.days),e.from(n);let{year:r,month:i}=this;`months`in t?(i=this.month+t.months,n.setUTCMonth(i-1)):(r=this.year+t.years,n.setUTCFullYear(r));let a=e.from(G({year:r,month:i,day:1}));return W(e.from(n),a,He(a))}toString(){return`${K(this.year,4)}-${K(this.month,2)}-${K(this.day,2)}`}toPlainYearMonth(){return new J(this.year,this.month)}equals(t){return e.compare(this,t)===0}static compare(e,t){return e.year<t.year?-1:e.year>t.year?1:e.month<t.month?-1:e.month>t.month?1:e.day<t.day?-1:+(e.day>t.day)}static from(t){if(typeof t==`string`){let n=t.match(Ge);if(!n)throw TypeError(t);let[,r,i,a]=n;return new e(parseInt(r,10),parseInt(i,10),parseInt(a,10))}return new e(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate())}},J=class e{constructor(e,t){this.year=e,this.month=t}add(t){let n=G(this),r=(t.months??0)+(t.years??0)*12;return n.setUTCMonth(n.getUTCMonth()+r),new e(n.getUTCFullYear(),n.getUTCMonth()+1)}equals(e){return this.year===e.year&&this.month===e.month}toPlainDate(){return new q(this.year,this.month,1)}static compare(e,t){return e.year<t.year?-1:e.year>t.year?1:e.month<t.month?-1:+(e.month>t.month)}};function Y(e,t){if(t)try{return e.from(t)}catch{}}function X(e){let[t,n]=D(e);return[E(()=>Y(q,t),[t]),e=>n(e?.toString())]}function Ke(e){let[t=``,n]=D(e);return[E(()=>{let[e,n]=t.split(`/`),r=Y(q,e),i=Y(q,n);return r&&i?[r,i]:[]},[t]),e=>n(`${e[0]}/${e[1]}`)]}function qe(e){let[t=``,n]=D(e);return[E(()=>{let e=[];for(let n of t.trim().split(/\s+/)){let t=Y(q,n);t&&e.push(t)}return e},[t]),e=>n(e.join(` `))]}function Z(e,t){return E(()=>new Intl.DateTimeFormat(t,{timeZone:`UTC`,...e}),[t,e])}function Je(e,t,n){let r=Z(e,n);return E(()=>{let e=[],n=new Date;for(var i=0;i<7;i++){let i=(n.getUTCDay()-t+7)%7;e[i]=r.format(n),n.setUTCDate(n.getUTCDate()+1)}return e},[t,r])}var Ye=(e,t,n)=>W(e,t,n)===e,Xe=e=>e.target.matches(`:dir(ltr)`),Ze={month:`long`,day:`numeric`},Qe={month:`long`},$e={weekday:`long`},Q={bubbles:!0};function et({props:e,context:t}){let{offset:n}=e,{firstDayOfWeek:r,isDateDisallowed:i,min:a,max:o,today:s,page:c,locale:l,focusedDate:u,formatWeekday:d}=t,f=s??H(),p=Je($e,r,l),m=Je(E(()=>({weekday:d}),[d]),r,l),h=Z(Ze,l),g=Z(Qe,l),_=E(()=>c.start.add({months:n}),[c,n]),v=E(()=>We(_,r),[_,r]),ee=O(`focusday`,Q),y=O(`selectday`,Q),b=O(`hoverday`,Q);function x(e){ee(W(e,a,o))}function te(e){let t;switch(e.key){case`ArrowRight`:t=u.add({days:Xe(e)?1:-1});break;case`ArrowLeft`:t=u.add({days:Xe(e)?-1:1});break;case`ArrowDown`:t=u.add({days:7});break;case`ArrowUp`:t=u.add({days:-7});break;case`PageUp`:t=u.add(e.shiftKey?{years:-1}:{months:-1});break;case`PageDown`:t=u.add(e.shiftKey?{years:1}:{months:1});break;case`Home`:t=U(u,r);break;case`End`:t=Ve(u,r);break;default:return}x(t),e.preventDefault()}function S(e){let n=_.equals(e);if(!t.showOutsideDays&&!n)return;let r=e.equals(u),s=e.equals(f),c=G(e),l=i?.(c),d=!Ye(e,a,o),p=``,m;if(t.type===`range`){let[n,r]=t.value,i=n?.equals(e),a=r?.equals(e);m=n&&r&&Ye(e,n,r),p=`${i?`range-start`:``} ${a?`range-end`:``} ${m&&!i&&!a?`range-inner`:``}`}else m=t.type===`multi`?t.value.some(t=>t.equals(e)):t.value?.equals(e);return{part:`${`button day day-${c.getUTCDay()} ${n?m?`selected`:``:`outside`} ${l?`disallowed`:``} ${s?`today`:``} ${t.getDayParts?.(c)??``}`} ${p}`,tabindex:n&&r?0:-1,disabled:d,"aria-disabled":l?`true`:void 0,"aria-pressed":n&&m,"aria-current":s?`date`:void 0,"aria-label":h.format(c),onkeydown:te,onclick(){l||y(e),x(e)},onmouseover(){!l&&!d&&b(e)}}}return{weeks:v,yearMonth:_,daysLong:p,daysVisible:m,formatter:g,getDayProps:S}}var tt=H(),$=Ie({type:`date`,firstDayOfWeek:1,focusedDate:tt,page:{start:tt.toPlainYearMonth(),end:tt.toPlainYearMonth()}});customElements.define(`calendar-ctx`,$);var nt=(e,t)=>(t+e)%7,rt=C(e=>{let t=I($),n=l(),r=et({props:e,context:t});function i(){n.current.querySelector(`button[tabindex='0']`)?.focus()}return z(`host`,{shadowDom:!0,focus:i,children:[R(`div`,{id:`h`,part:`heading`,children:r.formatter.format(G(r.yearMonth))}),z(`table`,{ref:n,"aria-labelledby":`h`,part:`table`,children:[z(`colgroup`,{children:[t.showWeekNumbers&&R(`col`,{part:`col-weeknumber`}),R(`col`,{part:`col-1`}),R(`col`,{part:`col-2`}),R(`col`,{part:`col-3`}),R(`col`,{part:`col-4`}),R(`col`,{part:`col-5`}),R(`col`,{part:`col-6`}),R(`col`,{part:`col-7`})]}),R(`thead`,{children:z(`tr`,{part:`tr head`,children:[t.showWeekNumbers&&R(`th`,{part:`th weeknumber`,children:z(`slot`,{name:`weeknumber`,children:[R(`span`,{class:`vh`,children:`Week`}),R(`span`,{"aria-hidden":`true`,children:`#`})]})}),r.daysLong.map((e,n)=>z(`th`,{part:`th day day-${nt(t.firstDayOfWeek,n)}`,scope:`col`,children:[R(`span`,{class:`vh`,children:e}),R(`span`,{"aria-hidden":`true`,children:r.daysVisible[n]})]}))]})}),R(`tbody`,{children:r.weeks.map((e,n)=>z(`tr`,{part:`tr week`,children:[t.showWeekNumbers&&R(`th`,{class:`num`,part:`th weeknumber`,scope:`row`,children:Be(e[0])}),e.map((e,t)=>{let n=r.getDayProps(e);return R(`td`,{part:`td`,children:n&&R(`button`,{class:`num`,...n,children:e.day})},t)})]},n))})]})]})},{props:{offset:{type:Number,value:0}},styles:[B,V,L`:host{--color-accent: black;--color-text-on-accent: white;display:flex;flex-direction:column;gap:.25rem;text-align:center;inline-size:fit-content}table{border-collapse:collapse;font-size:.875rem}th{inline-size:2.25rem;block-size:2.25rem}td{padding-inline:0}.num{font-variant-numeric:tabular-nums}button{color:inherit;font-size:inherit;background:transparent;border:0;block-size:2.25rem;inline-size:2.25rem}button:hover:where(:not(:disabled,[aria-disabled])){background:#0000000d}button:is([aria-pressed=true],:focus-visible){background:var(--color-accent);color:var(--color-text-on-accent)}button:focus-visible{outline:1px solid var(--color-text-on-accent);outline-offset:-2px}button:disabled,:host::part(outside),:host::part(disallowed){cursor:default;opacity:.5}`]});customElements.define(`calendar-month`,rt);function it(e){return R(`button`,{part:`button ${e.name} ${e.onclick?``:`disabled`}`,onclick:e.onclick,"aria-disabled":e.onclick?null:`true`,children:R(`slot`,{name:e.name,children:e.children})})}function at(e){let t=G(e.page.start),n=G(e.page.end);return R($,{value:e,onselectday:e.onSelect,onfocusday:e.onFocus,onhoverday:e.onHover,children:z(`div`,{role:`group`,"aria-labelledby":`h`,part:`container`,children:[R(`div`,{id:`h`,class:`vh`,"aria-live":`polite`,"aria-atomic":`true`,children:e.formatVerbose.formatRange(t,n)}),z(`div`,{part:`header`,children:[R(it,{name:`previous`,onclick:e.previous,children:`Previous`}),R(`slot`,{part:`heading`,name:`heading`,children:R(`div`,{"aria-hidden":`true`,children:e.format.formatRange(t,n)})}),R(it,{name:`next`,onclick:e.next,children:`Next`})]}),R(`slot`,{part:`months`})]})})}var ot={value:{type:String,value:``},min:{type:String,value:``},max:{type:String,value:``},today:{type:String,value:``},isDateDisallowed:{type:Function,value:e=>!1},formatWeekday:{type:String,value:()=>`narrow`},getDayParts:{type:Function,value:e=>``},firstDayOfWeek:{type:Number,value:()=>1},showOutsideDays:{type:Boolean,value:!1},locale:{type:String,value:()=>{}},months:{type:Number,value:1},focusedDate:{type:String,value:()=>{}},pageBy:{type:String,value:()=>`months`},showWeekNumbers:{type:Boolean,value:!1}},st=[B,V,L`:host{display:block;inline-size:fit-content}:host::part(container){display:flex;flex-direction:column;gap:1em}:host::part(header){display:flex;align-items:center;justify-content:space-between}:host::part(heading){font-weight:700;font-size:1.25em}:host::part(button){display:flex;align-items:center;justify-content:center}:host::part(button disabled){cursor:default;opacity:.5}`],ct={year:`numeric`},lt={year:`numeric`,month:`long`};function ut(e,t){return(t.year-e.year)*12+t.month-e.month}var dt=(e,t)=>(e=t===12?new J(e.year,1):e,{start:e,end:e.add({months:t-1})});function ft({pageBy:e,focusedDate:t,months:n,max:r,min:i,goto:a}){let o=e===`single`?1:n,[s,c]=T(()=>dt(t.toPlainYearMonth(),n)),l=e=>c(dt(s.start.add({months:e}),n)),u=e=>{let t=ut(s.start,e.toPlainYearMonth());return t>=0&&t<n};return w(()=>{if(u(t))return;let e=ut(t.toPlainYearMonth(),s.start);a(t.add({months:e}))},[s.start]),w(()=>{if(u(t))return;let e=ut(s.start,t.toPlainYearMonth());l(e===-1?-o:e===n?o:Math.floor(e/n)*n)},[t,o,n]),{page:s,previous:!i||!u(i)?()=>l(-o):void 0,next:!r||!u(r)?()=>l(o):void 0}}function pt({months:e,pageBy:t,locale:n,focusedDate:r,setFocusedDate:i}){let[a]=X(`min`),[o]=X(`max`),[s]=X(`today`),c=O(`focusday`),l=O(`change`),d=E(()=>W(r??s??H(),a,o),[r,s,a,o]);function f(e){i(e),c(G(e))}let{next:p,previous:m,page:h}=ft({pageBy:t,focusedDate:d,months:e,min:a,max:o,goto:f}),g=u();function _(e){let t=e?.target??`day`;t===`day`?g.current.querySelectorAll(`calendar-month`).forEach(t=>t.focus(e)):g.current.shadowRoot.querySelector(`[part~='${t}']`).focus(e)}return{format:Z(ct,n),formatVerbose:Z(lt,n),page:h,focusedDate:d,dispatch:l,onFocus(e){e.stopPropagation(),f(e.detail),setTimeout(_)},min:a,max:o,today:s,next:p,previous:m,focus:_}}var mt=C(e=>{let[t,n]=X(`value`),[r=t,i]=X(`focusedDate`),a=pt({...e,focusedDate:r,setFocusedDate:i});function o(e){n(e.detail),a.dispatch()}return R(`host`,{shadowDom:!0,focus:a.focus,children:R(at,{...e,...a,type:`date`,value:t,onSelect:o})})},{props:ot,styles:st});customElements.define(`calendar-date`,mt);function ht(e){return z(Ce,{children:[R(`label`,{part:`label`,for:`s`,children:R(`slot`,{name:`label`,children:e.label})}),R(`select`,{id:`s`,part:`select`,onchange:e.onChange,children:e.options.map(e=>R(`option`,{part:`option`,...e}))})]})}var gt=[B,V];function _t(e,t){return Array.from({length:e},(e,n)=>t(n))}function vt(e){let{min:t,max:n,focusedDate:r}=I($),i=O(`focusday`,{bubbles:!0}),a=r.toPlainYearMonth(),o=a.year,s=Math.floor(e.maxYears/2),c=o-s,l=o+(e.maxYears-s-1),u=Math.max(c,t?.year??-1/0),d=_t(Math.min(l,n?.year??1/0)-u+1,e=>{let t=u+e;return{label:`${t}`,value:`${t}`,selected:t===a.year}});function f(e){let t=parseInt(e.currentTarget.value)-a.year;i(r.add({years:t}))}return{options:d,onChange:f}}var yt=C(e=>R(`host`,{shadowDom:!0,children:R(ht,{label:`Year`,...vt(e)})}),{props:{maxYears:{type:Number,value:20}},styles:gt});customElements.define(`calendar-select-year`,yt);function bt(e){let{min:t,max:n,focusedDate:r,locale:i}=I($),a=O(`focusday`,{bubbles:!0}),o=Z(E(()=>({month:e.formatMonth}),[e.formatMonth]),i),s=E(()=>{let e=[],t=new Date;t.setUTCDate(1);for(var n=0;n<12;n++){let n=(t.getUTCMonth()+12)%12;e[n]=o.format(t),t.setUTCMonth(t.getUTCMonth()+1)}return e},[o]),c=r.toPlainYearMonth(),l=s.map((e,r)=>{let i=r+1,a=c.add({months:i-c.month}),o=t!=null&&J.compare(a,t)<0||n!=null&&J.compare(a,n)>0;return{label:e,value:`${i}`,disabled:o,selected:i===c.month}});function u(e){let t=parseInt(e.currentTarget.value)-c.month;a(r.add({months:t}))}return{options:l,onChange:u}}var xt=C(e=>R(`host`,{shadowDom:!0,children:R(ht,{label:`Month`,...bt(e)})}),{props:{formatMonth:{type:String,value:()=>`long`}},styles:gt});customElements.define(`calendar-select-month`,xt);var St=(e,t)=>q.compare(e,t)<0?[e,t]:[t,e],Ct=C(e=>{let[t,n]=Ke(`value`),[r=t[0],i]=X(`focusedDate`),a=pt({...e,focusedDate:r,setFocusedDate:i}),o=O(`rangestart`),s=O(`rangeend`),[c,l]=X(`tentative`),[u,d]=T();w(()=>d(void 0),[c]);function f(e){a.onFocus(e),p(e)}function p(e){e.stopPropagation(),c&&d(e.detail)}function m(e){let t=e.detail;e.stopPropagation(),c?(n(St(c,t)),l(void 0),s(G(t)),a.dispatch()):(l(t),o(G(t)))}let h=c?St(c,u??c):t;return R(`host`,{shadowDom:!0,focus:a.focus,children:R(at,{...e,...a,type:`range`,value:h,onFocus:f,onHover:p,onSelect:m})})},{props:{...ot,tentative:{type:String,value:``}},styles:st});customElements.define(`calendar-range`,Ct);var wt=C(e=>{let[t,n]=qe(`value`),[r=t[0],i]=X(`focusedDate`),a=pt({...e,focusedDate:r,setFocusedDate:i});function o(e){let r=[...t],i=t.findIndex(t=>t.equals(e.detail));i<0?r.push(e.detail):r.splice(i,1),n(r),a.dispatch()}return R(`host`,{shadowDom:!0,focus:a.focus,children:R(at,{...e,...a,type:`multi`,value:t,onSelect:o})})},{props:ot,styles:st});customElements.define(`calendar-multi`,wt);export{mt as CalendarDate,rt as CalendarMonth,wt as CalendarMulti,Ct as CalendarRange,xt as CalendarSelectMonth,yt as CalendarSelectYear};
|