@devschile/chucao 2.8.0 → 2.9.0
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/chucao/chucao.esm.js +1 -1
- package/dist/chucao/{p-5093c486.entry.js → p-03acf096.entry.js} +2 -2
- package/dist/chucao/{p-f0c288db.entry.js → p-0ce2b15d.entry.js} +2 -2
- package/dist/chucao/{p-af088ffd.entry.js → p-10e37157.entry.js} +2 -2
- package/dist/chucao/{p-46dae34b.entry.js → p-12043dc1.entry.js} +2 -2
- package/dist/chucao/p-1dca55d6.entry.js +2 -0
- package/dist/chucao/{p-0831c6f2.entry.js.map → p-1dca55d6.entry.js.map} +1 -1
- package/dist/chucao/{p-c4d68ab7.entry.js → p-244d8e96.entry.js} +2 -2
- package/dist/chucao/{p-ba589c2f.entry.js → p-29841714.entry.js} +2 -2
- package/dist/chucao/{p-5577e0a0.entry.js → p-302ec527.entry.js} +2 -2
- package/dist/chucao/{p-25f4f815.entry.js → p-5a62951e.entry.js} +2 -2
- package/dist/chucao/{p-3e0d7585.entry.js → p-5d0ac17a.entry.js} +2 -2
- package/dist/chucao/{p-b42ec9bf.entry.js → p-5e0e1012.entry.js} +2 -2
- package/dist/chucao/{p-56e41372.entry.js → p-61a94a4e.entry.js} +2 -2
- package/dist/chucao/p-649c2cef.entry.js +2 -0
- package/dist/chucao/p-649c2cef.entry.js.map +1 -0
- package/dist/chucao/{p-eb39b9c2.entry.js → p-674c0f61.entry.js} +2 -2
- package/dist/chucao/{p-d868bdbc.entry.js → p-67f0fc77.entry.js} +2 -2
- package/dist/chucao/{p-d630f662.entry.js → p-68e4a129.entry.js} +2 -2
- package/dist/chucao/{p-b80c39c3.entry.js → p-6e345b3f.entry.js} +2 -2
- package/dist/chucao/{p-6e93c392.entry.js → p-72d4dacf.entry.js} +2 -2
- package/dist/chucao/{p-ca3179ae.entry.js → p-74d9b7e5.entry.js} +2 -2
- package/dist/chucao/{p-8b09ad3c.entry.js → p-791ce537.entry.js} +2 -2
- package/dist/chucao/{p-ad41da02.entry.js → p-79e8c10b.entry.js} +2 -2
- package/dist/chucao/{p-c98e2a50.entry.js → p-7e13f725.entry.js} +2 -2
- package/dist/chucao/{p-6c2e5931.entry.js → p-8b23d072.entry.js} +2 -2
- package/dist/chucao/{p-920d5727.entry.js → p-a5430e95.entry.js} +2 -2
- package/dist/chucao/{p-e6b7b2da.entry.js → p-a7c66879.entry.js} +2 -2
- package/dist/chucao/p-b452d6cb.entry.js +2 -0
- package/dist/chucao/{p-0d7fc720.entry.js → p-b7332faf.entry.js} +2 -2
- package/dist/chucao/{p-19d90f87.entry.js → p-f3d03388.entry.js} +2 -2
- package/dist/chucao/{p-8fcf6d36.entry.js → p-f925d45c.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ch-alert_8.cjs.entry.js +7 -7
- package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ch-cluster.cjs.entry.js +2 -2
- package/dist/cjs/ch-combobox.cjs.entry.js +304 -0
- package/dist/cjs/ch-combobox.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-confirm-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ch-description-list.cjs.entry.js +1 -1
- package/dist/cjs/ch-divider.cjs.entry.js +1 -1
- package/dist/cjs/ch-drawer.cjs.entry.js +1 -1
- package/dist/cjs/ch-emoji.cjs.entry.js +1 -1
- package/dist/cjs/ch-empty-state.cjs.entry.js +1 -1
- package/dist/cjs/ch-grid.cjs.entry.js +1 -1
- package/dist/cjs/ch-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/ch-icon.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +1 -1
- package/dist/cjs/ch-number-input.cjs.entry.js +2 -2
- package/dist/cjs/ch-otp-input.cjs.entry.js +2 -2
- package/dist/cjs/ch-page-header.cjs.entry.js +1 -1
- package/dist/cjs/ch-pagination.cjs.entry.js +1 -1
- package/dist/cjs/ch-radio.cjs.entry.js +1 -1
- package/dist/cjs/ch-segmented-control.cjs.entry.js +1 -1
- package/dist/cjs/ch-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/ch-stack.cjs.entry.js +1 -1
- package/dist/cjs/ch-stat.cjs.entry.js +2 -2
- package/dist/cjs/ch-table.cjs.entry.js +1 -1
- package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ch-textarea.cjs.entry.js +1 -1
- package/dist/cjs/ch-timeline.cjs.entry.js +1 -1
- package/dist/cjs/ch-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/chucao.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ch-accordion/ch-accordion.js +1 -1
- package/dist/collection/components/ch-alert/ch-alert.js +1 -1
- package/dist/collection/components/ch-badge/ch-badge.js +1 -1
- package/dist/collection/components/ch-card/ch-card.js +1 -1
- package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
- package/dist/collection/components/ch-cluster/ch-cluster.js +2 -2
- package/dist/collection/components/ch-combobox/ch-combobox.css +153 -0
- package/dist/collection/components/ch-combobox/ch-combobox.js +577 -0
- package/dist/collection/components/ch-combobox/ch-combobox.js.map +1 -0
- package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.js +1 -1
- package/dist/collection/components/ch-description-list/ch-description-list.js +1 -1
- package/dist/collection/components/ch-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-drawer/ch-drawer.js +1 -1
- package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
- package/dist/collection/components/ch-empty-state/ch-empty-state.js +1 -1
- package/dist/collection/components/ch-grid/ch-grid.js +1 -1
- package/dist/collection/components/ch-icon/ch-icon.js +1 -1
- package/dist/collection/components/ch-icon-button/ch-icon-button.js +1 -1
- package/dist/collection/components/ch-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.js +1 -1
- package/dist/collection/components/ch-number-input/ch-number-input.js +2 -2
- package/dist/collection/components/ch-otp-input/ch-otp-input.js +2 -2
- package/dist/collection/components/ch-page-header/ch-page-header.js +1 -1
- package/dist/collection/components/ch-pagination/ch-pagination.js +1 -1
- package/dist/collection/components/ch-radio/ch-radio.js +1 -1
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +1 -1
- package/dist/collection/components/ch-select/ch-select.js +1 -1
- package/dist/collection/components/ch-skeleton/ch-skeleton.js +1 -1
- package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
- package/dist/collection/components/ch-stack/ch-stack.js +1 -1
- package/dist/collection/components/ch-stat/ch-stat.js +2 -2
- package/dist/collection/components/ch-switch/ch-switch.js +1 -1
- package/dist/collection/components/ch-table/ch-table.js +1 -1
- package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
- package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
- package/dist/collection/components/ch-timeline/ch-timeline.js +1 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +2 -2
- package/dist/components/ch-accordion.js +1 -1
- package/dist/components/ch-alert.js +1 -1
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-cluster.js +1 -1
- package/dist/components/ch-combobox.d.ts +11 -0
- package/dist/components/ch-combobox.js +2 -0
- package/dist/components/ch-combobox.js.map +1 -0
- package/dist/components/ch-confirm-dialog.js +1 -1
- package/dist/components/ch-description-list.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.js +1 -1
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-empty-state.js +1 -1
- package/dist/components/ch-grid.js +1 -1
- package/dist/components/ch-icon-button.js +1 -1
- package/dist/components/ch-icon.js +1 -1
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-number-input.js +1 -1
- package/dist/components/ch-otp-input.js +1 -1
- package/dist/components/ch-page-header.js +1 -1
- package/dist/components/ch-pagination.js +1 -1
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-segmented-control.js +1 -1
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-skeleton.js +1 -1
- package/dist/components/ch-spinner.js +1 -1
- package/dist/components/ch-stack.js +1 -1
- package/dist/components/ch-stat.js +1 -1
- package/dist/components/ch-switch.js +1 -1
- package/dist/components/ch-table.js +1 -1
- package/dist/components/ch-tabs.js +1 -1
- package/dist/components/ch-textarea.js +1 -1
- package/dist/components/ch-timeline.js +1 -1
- package/dist/components/ch-tooltip.js +1 -1
- package/dist/components/{p-CF1yV0aa.js → p-CuSstsTP.js} +2 -2
- package/dist/components/{p-CmMN-UuJ.js → p-MBLhKofG.js} +2 -2
- package/dist/esm/ch-accordion.entry.js +1 -1
- package/dist/esm/ch-alert_8.entry.js +7 -7
- package/dist/esm/ch-checkbox.entry.js +1 -1
- package/dist/esm/ch-cluster.entry.js +2 -2
- package/dist/esm/ch-combobox.entry.js +302 -0
- package/dist/esm/ch-combobox.entry.js.map +1 -0
- package/dist/esm/ch-confirm-dialog.entry.js +1 -1
- package/dist/esm/ch-description-list.entry.js +1 -1
- package/dist/esm/ch-divider.entry.js +1 -1
- package/dist/esm/ch-drawer.entry.js +1 -1
- package/dist/esm/ch-emoji.entry.js +1 -1
- package/dist/esm/ch-empty-state.entry.js +1 -1
- package/dist/esm/ch-grid.entry.js +1 -1
- package/dist/esm/ch-icon-button.entry.js +1 -1
- package/dist/esm/ch-icon.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +1 -1
- package/dist/esm/ch-number-input.entry.js +2 -2
- package/dist/esm/ch-otp-input.entry.js +2 -2
- package/dist/esm/ch-page-header.entry.js +1 -1
- package/dist/esm/ch-pagination.entry.js +1 -1
- package/dist/esm/ch-radio.entry.js +1 -1
- package/dist/esm/ch-segmented-control.entry.js +1 -1
- package/dist/esm/ch-skeleton.entry.js +1 -1
- package/dist/esm/ch-stack.entry.js +1 -1
- package/dist/esm/ch-stat.entry.js +2 -2
- package/dist/esm/ch-table.entry.js +1 -1
- package/dist/esm/ch-tabs.entry.js +1 -1
- package/dist/esm/ch-textarea.entry.js +1 -1
- package/dist/esm/ch-timeline.entry.js +1 -1
- package/dist/esm/ch-tooltip.entry.js +2 -2
- package/dist/esm/chucao.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ch-combobox/ch-combobox.d.ts +98 -0
- package/dist/types/components.d.ts +209 -0
- package/dist-react/components.d.ts +7 -1
- package/dist-react/components.js +12 -0
- package/dist-react/components.ts +19 -1
- package/dist-vue/index.d.ts +1 -0
- package/dist-vue/index.js +19 -0
- package/dist-vue/index.ts +21 -0
- package/hydrate/index.js +376 -39
- package/hydrate/index.mjs +376 -39
- package/package.json +5 -1
- package/dist/chucao/p-0831c6f2.entry.js +0 -2
- package/dist/chucao/p-7f99ae48.entry.js +0 -2
- /package/dist/chucao/{p-5093c486.entry.js.map → p-03acf096.entry.js.map} +0 -0
- /package/dist/chucao/{p-f0c288db.entry.js.map → p-0ce2b15d.entry.js.map} +0 -0
- /package/dist/chucao/{p-af088ffd.entry.js.map → p-10e37157.entry.js.map} +0 -0
- /package/dist/chucao/{p-46dae34b.entry.js.map → p-12043dc1.entry.js.map} +0 -0
- /package/dist/chucao/{p-c4d68ab7.entry.js.map → p-244d8e96.entry.js.map} +0 -0
- /package/dist/chucao/{p-ba589c2f.entry.js.map → p-29841714.entry.js.map} +0 -0
- /package/dist/chucao/{p-5577e0a0.entry.js.map → p-302ec527.entry.js.map} +0 -0
- /package/dist/chucao/{p-25f4f815.entry.js.map → p-5a62951e.entry.js.map} +0 -0
- /package/dist/chucao/{p-3e0d7585.entry.js.map → p-5d0ac17a.entry.js.map} +0 -0
- /package/dist/chucao/{p-b42ec9bf.entry.js.map → p-5e0e1012.entry.js.map} +0 -0
- /package/dist/chucao/{p-56e41372.entry.js.map → p-61a94a4e.entry.js.map} +0 -0
- /package/dist/chucao/{p-eb39b9c2.entry.js.map → p-674c0f61.entry.js.map} +0 -0
- /package/dist/chucao/{p-d868bdbc.entry.js.map → p-67f0fc77.entry.js.map} +0 -0
- /package/dist/chucao/{p-d630f662.entry.js.map → p-68e4a129.entry.js.map} +0 -0
- /package/dist/chucao/{p-b80c39c3.entry.js.map → p-6e345b3f.entry.js.map} +0 -0
- /package/dist/chucao/{p-6e93c392.entry.js.map → p-72d4dacf.entry.js.map} +0 -0
- /package/dist/chucao/{p-ca3179ae.entry.js.map → p-74d9b7e5.entry.js.map} +0 -0
- /package/dist/chucao/{p-8b09ad3c.entry.js.map → p-791ce537.entry.js.map} +0 -0
- /package/dist/chucao/{p-ad41da02.entry.js.map → p-79e8c10b.entry.js.map} +0 -0
- /package/dist/chucao/{p-c98e2a50.entry.js.map → p-7e13f725.entry.js.map} +0 -0
- /package/dist/chucao/{p-6c2e5931.entry.js.map → p-8b23d072.entry.js.map} +0 -0
- /package/dist/chucao/{p-920d5727.entry.js.map → p-a5430e95.entry.js.map} +0 -0
- /package/dist/chucao/{p-e6b7b2da.entry.js.map → p-a7c66879.entry.js.map} +0 -0
- /package/dist/chucao/{p-7f99ae48.entry.js.map → p-b452d6cb.entry.js.map} +0 -0
- /package/dist/chucao/{p-0d7fc720.entry.js.map → p-b7332faf.entry.js.map} +0 -0
- /package/dist/chucao/{p-19d90f87.entry.js.map → p-f3d03388.entry.js.map} +0 -0
- /package/dist/chucao/{p-8fcf6d36.entry.js.map → p-f925d45c.entry.js.map} +0 -0
- /package/dist/components/{p-CF1yV0aa.js.map → p-CuSstsTP.js.map} +0 -0
- /package/dist/components/{p-CmMN-UuJ.js.map → p-MBLhKofG.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as t,c as r,h as s,d as a,t as o}from"./p-qP_9qshx.js";const i=()=>`:host{display:block;font-family:var(--typography-body);color:var(--color-text-primary)}:host([hidden]){display:none}.table__scroll{overflow-x:auto;min-width:0;border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-md);background:var(--color-surface-default)}.table__scroll:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:2px}.table{width:100%;border-collapse:collapse;font-size:var(--typography-size-sm)}.cell{min-width:8rem}.caption{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.cell{padding:var(--spacing-md) var(--spacing-lg);text-align:left;vertical-align:top;border-bottom:var(--border-width) solid var(--color-border-default)}.cell--header{font-weight:var(--typography-weight-semibold);color:var(--color-text-secondary);white-space:nowrap;background:var(--color-surface-hover)}tbody tr:last-child td{border-bottom:0}.sort{all:unset;display:inline-flex;align-items:center;gap:var(--spacing-xs);cursor:pointer;border-radius:var(--radius-sm)}.sort:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:2px}.sort__cue{font-size:var(--typography-size-xs);color:var(--color-text-secondary)}.table__empty{padding:var(--spacing-2xl) var(--spacing-lg);text-align:center}.table__empty-message{margin:0;font-size:var(--typography-size-sm);color:var(--color-text-secondary)}`;let
|
|
1
|
+
import{p as e,H as t,c as r,h as s,d as a,t as o}from"./p-qP_9qshx.js";const i=()=>`:host{display:block;font-family:var(--typography-body);color:var(--color-text-primary)}:host([hidden]){display:none}.table__scroll{overflow-x:auto;min-width:0;border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-md);background:var(--color-surface-default)}.table__scroll:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:2px}.table{width:100%;border-collapse:collapse;font-size:var(--typography-size-sm)}.cell{min-width:8rem}.caption{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.cell{padding:var(--spacing-md) var(--spacing-lg);text-align:left;vertical-align:top;border-bottom:var(--border-width) solid var(--color-border-default)}.cell--header{font-weight:var(--typography-weight-semibold);color:var(--color-text-secondary);white-space:nowrap;background:var(--color-surface-hover)}tbody tr:last-child td{border-bottom:0}.sort{all:unset;display:inline-flex;align-items:center;gap:var(--spacing-xs);cursor:pointer;border-radius:var(--radius-sm)}.sort:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:2px}.sort__cue{font-size:var(--typography-size-xs);color:var(--color-text-secondary)}.table__empty{padding:var(--spacing-2xl) var(--spacing-lg);text-align:center}.table__empty-message{margin:0;font-size:var(--typography-size-sm);color:var(--color-text-secondary)}`;let d=0;const n=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chSort=r(this,"chSort")}captionId=`ch-table-${++d}-caption`;emptyId=`${this.captionId}-empty`;get host(){return this}columns=[];sortable=false;sortKey;sortDirection="ascending";label;empty="unmeasured";filtered=false;chSort;onFiltered(){this.measure()}rerenderHeaders(){this.rerender=!this.rerender}rerender=false;observer;componentDidLoad(){this.measure();if(typeof MutationObserver==="function"){this.observer=new MutationObserver(this.measure);this.observer.observe(this.host,{childList:true})}}disconnectedCallback(){this.observer?.disconnect();this.observer=undefined}measure=()=>{const e=Array.from(this.host.children).filter((e=>e.tagName==="TR"));this.empty=e.length===0?"true":"none"};get emptyState(){if(this.filtered){return"filtered"}return this.empty}sortCue(e){if(!e){return"⇅"}return this.sortDirection==="ascending"?"▲":"▼"}emptyMessage(e){return e==="filtered"?"No results for these filters.":"Nothing here yet."}nextDirection(e){if(this.sortKey!==e){return"ascending"}return this.sortDirection==="ascending"?"descending":"ascending"}handleSort=e=>{this.chSort.emit({key:e,direction:this.nextDirection(e)})};handleHeaderKeydown=(e,t)=>{if(e.key!=="Enter"&&e.key!==" "){return}e.preventDefault();this.handleSort(t)};renderHeaderCell(e){const t=this.sortable&&e.sortable!==false;if(!t){return s("th",{scope:"col",class:"cell cell--header"},e.label)}const r=this.sortKey===e.key;const a=r?this.sortDirection:"none";return s("th",{scope:"col",class:"cell cell--header","aria-sort":a},s("button",{type:"button",class:"sort",onClick:()=>this.handleSort(e.key),onKeyDown:t=>this.handleHeaderKeydown(t,e.key)},s("span",null,e.label),s("span",{class:"sort__cue","aria-hidden":"true"},this.sortCue(r))))}render(){const e=this.emptyState;return s(a,{key:"bb91f61f579bc99b632bdd5b3a746c6c7319dd70",class:{table:true,"table--empty":e==="true"||e==="filtered"}},s("div",{key:"ddd75bdab98d1784863697dc784d2cec869bd5f5",class:"table__scroll",tabIndex:0,role:"group","aria-labelledby":this.captionId},s("table",{key:"cf02a54dd6b14a1604b417adab84cde9d0f4d814"},s("caption",{key:"fc6f525350e2a51e5325f383edd361c270c25fc0",id:this.captionId,class:"caption"},this.label),s("thead",{key:"2d03b39883847a2ab0f1807fcf767fc4edea8ad9"},s("tr",{key:"739e4f34d5a2338db3fabf2f3c9fa265d6d9f976"},this.columns.map((e=>this.renderHeaderCell(e))))),s("tbody",{key:"7584a38498f3c9521640f1f472d841350605a15f"},s("slot",{key:"81ea6c4992fa3de24916f16db27663646409e8d5"})))),(e==="true"||e==="filtered")&&s("div",{key:"6b745d95d7f9ebf56d73be6723f9b6aba1854709",class:"table__empty",id:this.emptyId},s("slot",{key:"2d3cfd14af06b26e2ea6837cc756b555fbeeb5cf",name:"empty"},s("p",{key:"53a2d940717ae12c04862b544d6eb60c6ed932a5",class:"table__empty-message"},this.emptyMessage(e)))))}static get watchers(){return{filtered:[{onFiltered:0}],sortKey:[{rerenderHeaders:0}],sortDirection:[{rerenderHeaders:0}],sortable:[{rerenderHeaders:0}]}}static get style(){return i()}},[769,"ch-table",{columns:[16],sortable:[516],sortKey:[1,"sort-key"],sortDirection:[1,"sort-direction"],label:[1],filtered:[516],empty:[32],rerender:[32]},undefined,{filtered:[{onFiltered:0}],sortKey:[{rerenderHeaders:0}],sortDirection:[{rerenderHeaders:0}],sortable:[{rerenderHeaders:0}]}]);function l(){if(typeof customElements==="undefined"){return}const e=["ch-table"];e.forEach((e=>{switch(e){case"ch-table":if(!customElements.get(o(e))){customElements.define(o(e),n)}break}}))}l();const c=n;const f=l;export{c as ChTable,f as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=ch-table.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as t,H as a,c as e,h as r,d as i,t as s}from"./p-qP_9qshx.js";const o=()=>`:host{display:block}.tablist{display:flex;gap:var(--spacing-2xl);border-bottom:var(--border-width) solid var(--border)}.tab{appearance:none;position:relative;background:transparent;border:none;padding:var(--spacing-md) 0 var(--spacing-xl);margin-bottom:calc(-1 * var(--border-width));color:var(--text-muted);font-family:inherit;font-size:inherit;font-weight:var(--typography-weight-semibold);cursor:pointer;transition:color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default)}.tab::after{content:'';position:absolute;left:0;right:0;bottom:0;height:var(--border-accent-bar);background:var(--accent);opacity:0;transition:opacity var(--duration-normal) var(--easing-default)}.tab:hover{color:var(--text)}.tab:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.tab--active{color:var(--text)}.tab--active::after{opacity:1}.tab--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.tabpanel{padding-top:var(--spacing-2xl);color:var(--text)}.tabpanel[hidden]{display:none}`;const n=0;const l=-1;const c=1;const d=-1;let b=0;const h=t(class t extends a{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.chChange=e(this,"chChange")}baseId=`ch-tabs-${++b}`;tablistEl;tabs=[];value;label;chChange;tabId(t){return`${this.baseId}-${t}`}panelId(t){return`${this.baseId}-${t}-panel`}get activeValue(){if(this.value&&this.tabs.some((t=>!t.disabled&&t.value===this.value))){return this.value}return this.tabs.find((t=>!t.disabled))?.value}select=t=>{this.value=t;this.chChange.emit(this.value)};focusTab(t){this.tablistEl?.querySelectorAll('[role="tab"]').forEach((a=>{if(a.dataset.value===t){a.focus()}}))}handleKeyDown=t=>{const a=this.tabs.filter((t=>!t.disabled));if(!a.length){return}const e=this.targetFor(t.key,a);if(!e){return}t.preventDefault();this.select(e);this.focusTab(e)};targetFor(t,a){const e=a.findIndex((t=>t.value===this.activeValue));if(t==="ArrowRight"){return a[(e+c)%a.length]?.value}if(t==="ArrowLeft"){return a[(e+d+a.length)%a.length]?.value}if(t==="Home"){return a[n]?.value}if(t==="End"){return a[a.length+l]?.value}return undefined}render(){const t=this.activeValue;return r(i,{key:"
|
|
1
|
+
import{p as t,H as a,c as e,h as r,d as i,t as s}from"./p-qP_9qshx.js";const o=()=>`:host{display:block}.tablist{display:flex;gap:var(--spacing-2xl);border-bottom:var(--border-width) solid var(--border)}.tab{appearance:none;position:relative;background:transparent;border:none;padding:var(--spacing-md) 0 var(--spacing-xl);margin-bottom:calc(-1 * var(--border-width));color:var(--text-muted);font-family:inherit;font-size:inherit;font-weight:var(--typography-weight-semibold);cursor:pointer;transition:color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default)}.tab::after{content:'';position:absolute;left:0;right:0;bottom:0;height:var(--border-accent-bar);background:var(--accent);opacity:0;transition:opacity var(--duration-normal) var(--easing-default)}.tab:hover{color:var(--text)}.tab:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.tab--active{color:var(--text)}.tab--active::after{opacity:1}.tab--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.tabpanel{padding-top:var(--spacing-2xl);color:var(--text)}.tabpanel[hidden]{display:none}`;const n=0;const l=-1;const c=1;const d=-1;let b=0;const h=t(class t extends a{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.chChange=e(this,"chChange")}baseId=`ch-tabs-${++b}`;tablistEl;tabs=[];value;label;chChange;tabId(t){return`${this.baseId}-${t}`}panelId(t){return`${this.baseId}-${t}-panel`}get activeValue(){if(this.value&&this.tabs.some((t=>!t.disabled&&t.value===this.value))){return this.value}return this.tabs.find((t=>!t.disabled))?.value}select=t=>{this.value=t;this.chChange.emit(this.value)};focusTab(t){this.tablistEl?.querySelectorAll('[role="tab"]').forEach((a=>{if(a.dataset.value===t){a.focus()}}))}handleKeyDown=t=>{const a=this.tabs.filter((t=>!t.disabled));if(!a.length){return}const e=this.targetFor(t.key,a);if(!e){return}t.preventDefault();this.select(e);this.focusTab(e)};targetFor(t,a){const e=a.findIndex((t=>t.value===this.activeValue));if(t==="ArrowRight"){return a[(e+c)%a.length]?.value}if(t==="ArrowLeft"){return a[(e+d+a.length)%a.length]?.value}if(t==="Home"){return a[n]?.value}if(t==="End"){return a[a.length+l]?.value}return undefined}render(){const t=this.activeValue;return r(i,{key:"2f6a0ba1be82d292dcb11f772f8764dcce7201bc"},r("div",{key:"914cb32e1467aaac43178866fbcc9b45d32ec495",class:"tablist",role:"tablist","aria-label":this.label,onKeyDown:this.handleKeyDown,ref:t=>this.tablistEl=t},this.tabs.map((a=>{const e=a.value===t;return r("button",{key:a.value,type:"button",class:{tab:true,"tab--active":e,"tab--disabled":Boolean(a.disabled)},role:"tab",id:this.tabId(a.value),"data-value":a.value,"aria-selected":e?"true":"false","aria-controls":this.panelId(a.value),tabIndex:e?n:l,disabled:a.disabled,onClick:()=>this.select(a.value)},a.label)}))),this.tabs.map((a=>r("div",{key:`${a.value}-panel`,class:"tabpanel",id:this.panelId(a.value),role:"tabpanel","aria-labelledby":this.tabId(a.value),tabIndex:n,hidden:a.value!==t},r("slot",{name:`panel-${a.value}`})))))}static get style(){return o()}},[769,"ch-tabs",{tabs:[16],value:[1025],label:[1]}]);function u(){if(typeof customElements==="undefined"){return}const t=["ch-tabs"];t.forEach((t=>{switch(t){case"ch-tabs":if(!customElements.get(s(t))){customElements.define(s(t),h)}break}}))}u();const f=h;const p=u;export{f as ChTabs,p as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=ch-tabs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import{p as t,H as e,c as r,h as a,d as s,t as i}from"./p-qP_9qshx.js";import{r as o}from"./p-BXzZsX2r.js";const n=()=>`:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.textarea{box-sizing:border-box;width:100%;min-height:var(--spacing-6xl);padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;line-height:var(--spacing-5xl);resize:vertical;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.textarea::placeholder{color:var(--text-muted)}.textarea:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.textarea--invalid{border-color:var(--color-status-warning)}.textarea--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .textarea,:host(:user-invalid) .textarea{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .textarea:focus,:host(:user-invalid) .textarea:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.textarea:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;let d=0;const h=4;const l=t(class t extends e{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.chInput=r(this,"chInput");this.chChange=r(this,"chChange");this.internals=this.attachInternals()}textareaId=`ch-textarea-${++d}`;hintId=`${this.textareaId}-hint`;errorId=`${this.textareaId}-error`;initialValue="";internals;formDisabled=false;get host(){return this}label;value="";placeholder;rows=h;name;disabled=false;required=false;hint;errorMessage;invalid=false;chInput;chChange;handleInput=t=>{this.value=t.target.value;this.chInput.emit(this.value)};handleChange=t=>{this.value=t.target.value;this.chChange.emit(this.value)};syncForm(){const t=this.internals;if(typeof t?.setFormValue!=="function"){return}t.setFormValue(this.value);const{flags:e,message:r}=o({required:this.required,empty:this.value==="",invalid:this.invalid,errorMessage:this.errorMessage});t.setValidity(e,r)}componentDidLoad(){this.initialValue=this.value;this.syncForm();this.host.addEventListener("change",this.markTouched);this.host.addEventListener("focusout",this.markTouched);this.host.addEventListener("invalid",this.markTouched)}markTouched=()=>{this.host.setAttribute("data-touched","")};formResetCallback(){this.value=this.initialValue}formDisabledCallback(t){this.formDisabled=t}get describedBy(){if(this.invalid&&this.errorMessage){return this.errorId}if(this.hint){return this.hintId}return undefined}render(){return a(s,{key:"2e8db2290d6a221b844ef2b510d9d1db4d9aac18"},this.label&&a("label",{key:"b1687f64d9474706dfcbe7042444e2bfe74a5e49",class:"label",htmlFor:this.textareaId},this.label),a("textarea",{key:"3e45a32bcfb609fb072bcf84cba46e7d0d5806a8",id:this.label?this.textareaId:undefined,class:{textarea:true,"textarea--invalid":this.invalid},rows:this.rows,name:this.name,placeholder:this.placeholder,disabled:this.disabled||this.formDisabled,required:this.required,value:this.value,"aria-invalid":this.invalid?"true":undefined,"aria-describedby":this.describedBy,onInput:this.handleInput,onChange:this.handleChange}),this.hint&&!(this.invalid&&this.errorMessage)&&a("p",{key:"8c013880c709dd0b35d6122765bf2cf8d456f08b",class:"hint",id:this.hintId},this.hint),this.invalid&&this.errorMessage&&a("p",{key:"88d45fbc82deb9131364b5e2f502daf104c72d56",class:"error",id:this.errorId,role:"alert"},this.errorMessage))}static get formAssociated(){return true}static get watchers(){return{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}}static get style(){return n()}},[577,"ch-textarea",{label:[1],value:[1025],placeholder:[1],rows:[2],name:[513],disabled:[516],required:[516],hint:[1],errorMessage:[1,"error-message"],invalid:[4],formDisabled:[32]},undefined,{value:[{syncForm:0}],required:[{syncForm:0}],invalid:[{syncForm:0}],errorMessage:[{syncForm:0}]}]);function c(){if(typeof customElements==="undefined"){return}const t=["ch-textarea"];t.forEach((t=>{switch(t){case"ch-textarea":if(!customElements.get(i(t))){customElements.define(i(t),l)}break}}))}c();const u=l;const b=c;export{u as ChTextarea,b as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=ch-textarea.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as t,H as e,h as
|
|
1
|
+
import{p as t,H as e,h as a,d as s,t as o}from"./p-qP_9qshx.js";const i=()=>`:host{display:block;font-family:var(--typography-body);color:var(--color-text-secondary)}:host([hidden]){display:none}.list{margin:0;padding:0;display:grid;gap:var(--spacing-md);list-style:none}::slotted(li){position:relative;padding-left:var(--spacing-2xl);min-width:0}::slotted(li)::before{content:'';position:absolute;left:0;top:0.35em;width:var(--spacing-sm);height:var(--spacing-sm);border-radius:50%;background:var(--color-border-default)}::slotted(li:not(:last-of-type))::after{content:'';position:absolute;left:calc(var(--spacing-sm) / 2 - var(--border-width));top:calc(0.35em + var(--spacing-sm));bottom:calc(0px - var(--spacing-md));width:var(--border-width);background:var(--color-border-default)}::slotted(time){font-variant-numeric:tabular-nums}`;const r=t(class t extends e{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow()}render(){return a(s,{key:"8f9e53b6f2f9c2f9d60a421c1c1c59240e469099",class:"timeline"},a("ol",{key:"535a06f4b150fc1a67a6baae2f406b76f08cf293",class:"list"},a("slot",{key:"584198aa85286147b49f2bd4e3897b0faa529309"})))}static get style(){return i()}},[257,"ch-timeline"]);function n(){if(typeof customElements==="undefined"){return}const t=["ch-timeline"];t.forEach((t=>{switch(t){case"ch-timeline":if(!customElements.get(o(t))){customElements.define(o(t),r)}break}}))}n();const c=r;const l=n;export{c as ChTimeline,l as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=ch-timeline.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as t,H as e,f as o,h as i,d as s,t as n}from"./p-qP_9qshx.js";const r={top:"bottom",bottom:"top",left:"right",right:"left"};const
|
|
1
|
+
import{p as t,H as e,f as o,h as i,d as s,t as n}from"./p-qP_9qshx.js";const r={top:"bottom",bottom:"top",left:"right",right:"left"};const l={top:"vertical",bottom:"vertical",left:"horizontal",right:"horizontal"};function a(t,e){return{top:e.top-t.top,left:e.left-t.left,bottom:t.top+t.height-(e.top+e.height),right:t.left+t.width-(e.left+e.width)}}function c(t,e,o,i){switch(t){case"top":return{top:e.top-o.height-i,left:e.left+(e.width-o.width)/2};case"bottom":return{top:e.top+e.height+i,left:e.left+(e.width-o.width)/2};case"left":return{top:e.top+(e.height-o.height)/2,left:e.left-o.width-i};case"right":return{top:e.top+(e.height-o.height)/2,left:e.left+e.width+i}}}function b({anchor:t,surface:e,viewport:o,preferred:i,gap:s}){const n=[i,r[i]];let b=i;let d=Number.POSITIVE_INFINITY;for(const i of n){const{top:n,left:r}=c(i,t,e,s);const h={top:n,left:r,width:e.width,height:e.height};const p=a(h,o);const u=l[i]==="vertical"?f(p.top)+f(p.bottom):f(p.left)+f(p.right);if(u<d){d=u;b=i}}const{top:p,left:u}=c(b,t,e,s);const m={top:p,left:u,width:e.width,height:e.height};const g=a(m,o);const v=l[b]==="vertical"?{top:p,left:u+h(g.left,g.right)}:{top:p+h(g.top,g.bottom),left:u};return{placement:b,top:v.top,left:v.left}}function f(t){return t>0?t:0}function h(t,e){if(t>0){return t}if(e>0){return-e}return 0}const d=()=>`:host{display:inline-block}.anchor{position:relative;display:inline-flex}.probe{position:fixed;top:0;left:0;width:1px;height:1px;visibility:hidden;pointer-events:none}.bubble{position:absolute;z-index:var(--z-index-dropdown);width:max-content;max-width:min(16rem, calc(100vw - 2 * var(--spacing-2xl)));padding:var(--spacing-md) var(--spacing-2xl);border:var(--border-width) solid var(--border);border-radius:var(--radius-sm);background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-sm);line-height:1.4;opacity:0;visibility:hidden;transition:opacity var(--duration-fast) var(--easing-default), visibility var(--duration-fast) var(--easing-default)}.bubble--visible{opacity:1;visibility:visible}.bubble::before{content:'';position:absolute}.bubble--positioned{position:fixed;top:var(--ch-tooltip-offset-top);left:var(--ch-tooltip-offset-left);transform:none;margin:0}.bubble--top{bottom:100%;left:50%;transform:translateX(-50%);margin-bottom:var(--spacing-md)}.bubble.bubble--positioned.bubble--top,.bubble.bubble--positioned.bubble--bottom,.bubble.bubble--positioned.bubble--left,.bubble.bubble--positioned.bubble--right{inset:auto;top:var(--ch-tooltip-offset-top);left:var(--ch-tooltip-offset-left);right:auto;bottom:auto;transform:none;margin:0}.bubble--top::before{top:100%;left:0;right:0;height:var(--spacing-md)}.bubble--bottom{top:100%;left:50%;transform:translateX(-50%);margin-top:var(--spacing-md)}.bubble--bottom::before{bottom:100%;left:0;right:0;height:var(--spacing-md)}.bubble--left{right:100%;top:50%;transform:translateY(-50%);margin-right:var(--spacing-md)}.bubble--left::before{left:100%;top:0;bottom:0;width:var(--spacing-md)}.bubble--right{left:100%;top:50%;transform:translateY(-50%);margin-left:var(--spacing-md)}.bubble--right::before{right:100%;top:0;bottom:0;width:var(--spacing-md)}@media (prefers-reduced-motion: reduce){.bubble{transition:none}}`;let p=0;const u=8;const m=t(class t extends e{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow()}get el(){return this}fallbackId=`ch-tooltip-${++p}`;bubbleEl;probeEl;cleanup;placement="top";hovered=false;focused=false;dismissed=false;resolvedPlacement;offset;get visible(){return(this.hovered||this.focused)&&!this.dismissed}componentDidLoad(){this.associate()}connectedCallback(){this.watchViewport()}disconnectedCallback(){this.cleanup?.()}handleMouseEnter(){this.hovered=true;this.dismissed=false;this.position()}handleMouseLeave(){this.hovered=false}handleFocusIn(){this.focused=true;this.dismissed=false;this.position()}handleFocusOut(){this.focused=false}handleKeyDown(t){if(t.key==="Escape"&&this.visible&&!t.defaultPrevented){t.preventDefault();this.dismissed=true}}handleScroll(){if(this.visible&&this.offset){this.position()}}handleResize(){this.position()}watchViewport(){if(typeof window==="undefined"){return}const t=window.visualViewport;if(!t||this.cleanup){return}const e=()=>this.position();t.addEventListener("resize",e);t.addEventListener("scroll",e);this.cleanup=()=>{t.removeEventListener("resize",e);t.removeEventListener("scroll",e)}}slotted(t){return Array.from(this.el.children).find((e=>e.getAttribute("slot")===t))}position(){if(typeof window==="undefined"){return}const t=this.bubbleEl??(this.bubbleEl=this.el.shadowRoot?.querySelector(".bubble")??undefined);const e=this.probeEl??(this.probeEl=this.el.shadowRoot?.querySelector(".probe")??undefined);if(!t||!e||t.offsetWidth===0){return}const i=this.slotted("trigger")?.getBoundingClientRect?.();if(!i){return}const s=e.getBoundingClientRect();const n=s.width||1;const r=s.height||1;const l=t=>({top:(t.top-s.top)/r,left:(t.left-s.left)/n,width:t.width/n,height:t.height/r});const a={width:t.offsetWidth+g(t),height:t.offsetHeight};const c=window.visualViewport;const{placement:f,top:h,left:d}=b({anchor:l(i),surface:a,viewport:l(c?{top:c.offsetTop,left:c.offsetLeft,width:c.width,height:c.height}:{top:0,left:0,width:window.innerWidth,height:window.innerHeight}),preferred:this.placement,gap:u});const p=this.offset;const m=p?.top===h&&p?.left===d&&this.resolvedPlacement===f;this.resolvedPlacement=f;this.offset={top:h,left:d};if(!m){o(this)}}associate=()=>{const t=this.slotted("trigger");const e=this.slotted("content");if(!t||!e){return}if(!e.id){e.id=this.fallbackId}e.setAttribute("role","tooltip");t.setAttribute("aria-describedby",e.id)};render(){const{offset:t}=this;return i(s,{key:"24f3c1522fdde642c50e0358d32a8b7ea8e0d327"},i("span",{key:"2e09507788b944ab599667bd1bd1d9327e9fc510",class:"anchor"},i("span",{key:"87b00e6c802396181a808823ef7e08a7f2d18bf8",class:"probe","aria-hidden":"true",ref:t=>this.probeEl=t}),i("slot",{key:"9620f1447fa376df84a56348759bac1933f96214",name:"trigger",onSlotchange:this.associate}),i("span",{key:"d8a517178b2035dc9254a48cff8c59cda4025965",ref:t=>this.bubbleEl=t,style:{"--ch-tooltip-offset-top":t?`${t.top}px`:null,"--ch-tooltip-offset-left":t?`${t.left}px`:null},class:{bubble:true,"bubble--positioned":Boolean(this.offset),[`bubble--${this.resolvedPlacement??this.placement}`]:true,"bubble--visible":this.visible}},i("slot",{key:"5f72e3c398fbe6c14ccea1cdd3f20c40beb9f950",name:"content",onSlotchange:this.associate}))))}static get style(){return d()}},[769,"ch-tooltip",{placement:[1],hovered:[32],focused:[32],dismissed:[32],resolvedPlacement:[32]},[[1,"mouseenter","handleMouseEnter"],[1,"mouseleave","handleMouseLeave"],[0,"focusin","handleFocusIn"],[0,"focusout","handleFocusOut"],[4,"keydown","handleKeyDown"],[11,"scroll","handleScroll"],[9,"resize","handleResize"]]]);function g(t){const e=getComputedStyle(t);return(parseFloat(e.marginLeft)||0)+(parseFloat(e.marginRight)||0)}function v(){if(typeof customElements==="undefined"){return}const t=["ch-tooltip"];t.forEach((t=>{switch(t){case"ch-tooltip":if(!customElements.get(n(t))){customElements.define(n(t),m)}break}}))}v();const w=m;const y=v;export{w as ChTooltip,y as defineCustomElement};
|
|
2
2
|
//# sourceMappingURL=ch-tooltip.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as n,h as r,d as s,t as i}from"./p-qP_9qshx.js";const t=()=>`:host{display:inline-block;vertical-align:middle}.spinner{display:block;box-sizing:border-box;width:1em;height:1em;border:0.125em solid currentColor;border-top-color:transparent;border-radius:50%;animation:ch-spinner-rotate var(--duration-spin) var(--easing-linear) infinite}.spinner--sm{font-size:var(--typography-size-sm)}.spinner--md{font-size:var(--typography-size-lg)}.spinner--lg{font-size:var(--typography-size-xl)}@keyframes ch-spinner-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spinner{animation-duration:calc(var(--duration-spin) * 4)}}`;const a=e(class e extends n{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}size="md";label;render(){const e=Boolean(this.label);return r(s,{key:"
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as n,h as r,d as s,t as i}from"./p-qP_9qshx.js";const t=()=>`:host{display:inline-block;vertical-align:middle}.spinner{display:block;box-sizing:border-box;width:1em;height:1em;border:0.125em solid currentColor;border-top-color:transparent;border-radius:50%;animation:ch-spinner-rotate var(--duration-spin) var(--easing-linear) infinite}.spinner--sm{font-size:var(--typography-size-sm)}.spinner--md{font-size:var(--typography-size-lg)}.spinner--lg{font-size:var(--typography-size-xl)}@keyframes ch-spinner-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spinner{animation-duration:calc(var(--duration-spin) * 4)}}`;const a=e(class e extends n{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}size="md";label;render(){const e=Boolean(this.label);return r(s,{key:"03ab408176f59ecdd51a493d795ccc86acfa563c"},r("span",{key:"db54c4d2001a01caeea33426d4042c7ee5546b75",class:{spinner:true,[`spinner--${this.size}`]:true},role:e?"status":undefined,"aria-label":e?this.label:undefined,"aria-hidden":e?undefined:"true"}))}static get style(){return t()}},[513,"ch-spinner",{size:[1],label:[1]}]);function o(){if(typeof customElements==="undefined"){return}const e=["ch-spinner"];e.forEach((e=>{switch(e){case"ch-spinner":if(!customElements.get(i(e))){customElements.define(i(e),a)}break}}))}o();export{a as C,o as d};
|
|
2
|
+
//# sourceMappingURL=p-CuSstsTP.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as a,c as t,h as i,d as s,t as o}from"./p-qP_9qshx.js";import{l,u as r}from"./p-d8DfpzMR.js";const
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as a,c as t,h as i,d as s,t as o}from"./p-qP_9qshx.js";import{l,u as r}from"./p-d8DfpzMR.js";const d=()=>`.modal{box-sizing:border-box;max-height:calc(100vh - var(--spacing-6xl));padding:var(--spacing-5xl);border:var(--border-width) solid var(--border);border-radius:var(--radius);background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-md)}.modal--sm{max-width:min(var(--ch-modal-width, 24rem), calc(100vw - var(--spacing-6xl)))}.modal--md{max-width:min(var(--ch-modal-width, 32rem), calc(100vw - var(--spacing-6xl)))}.modal--lg{max-width:min(var(--ch-modal-width, 48rem), calc(100vw - var(--spacing-6xl)))}.modal::backdrop{background:var(--color-scrim-default);backdrop-filter:blur(var(--effect-blur))}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);margin-bottom:var(--spacing-2xl)}.modal-body{overflow-y:auto}.modal-close{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--spacing-2xs) var(--spacing-md);border:0;border-radius:var(--radius);background:none;color:var(--text-muted);cursor:pointer;font-family:var(--font-heading);font-size:var(--typography-size-lg);line-height:1;transition:background-color var(--duration-normal) var(--easing-default)}.modal-close:hover{background:var(--surface-hover);color:var(--text)}.modal-close:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}@media (pointer: coarse){.modal-close{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.modal-close{transition:none}}`;const c=e(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chOpen=t(this,"chOpen");this.chClose=t(this,"chClose")}get el(){return this}open=false;label;closeLabel;size="md";chOpen;chClose;dialog;scrollLocked=false;pointerDownedOutside=false;componentDidLoad(){this.dialog?.addEventListener("close",this.handleNativeClose);this.dialog?.addEventListener("pointerdown",this.handlePointerDown);this.dialog?.addEventListener("click",this.handleClick);if(this.open){this.showDialog()}}disconnectedCallback(){this.dialog?.removeEventListener("close",this.handleNativeClose);this.dialog?.removeEventListener("pointerdown",this.handlePointerDown);this.dialog?.removeEventListener("click",this.handleClick);this.unlockScroll()}handleOpenChange(e){if(e){this.showDialog()}else{this.closeDialog()}}showDialog(){if(typeof this.dialog?.showModal!=="function"){return}this.lockScroll();this.dialog.showModal();this.chOpen.emit()}closeDialog(){if(typeof this.dialog?.close==="function"&&this.dialog.open){this.dialog.close()}}lockScroll(){if(this.scrollLocked){return}this.scrollLocked=true;l()}unlockScroll(){if(!this.scrollLocked){return}this.scrollLocked=false;r()}isOnBackdrop(e){if(!this.dialog||e.target!==this.dialog){return false}const a=this.dialog.getBoundingClientRect();return e.clientX<a.left||e.clientX>a.right||e.clientY<a.top||e.clientY>a.bottom}handlePointerDown=e=>{this.pointerDownedOutside=this.isOnBackdrop(e)};handleClick=e=>{const a=this.pointerDownedOutside&&this.isOnBackdrop(e);this.pointerDownedOutside=false;if(a){this.closeDialog()}};handleNativeClose=()=>{this.unlockScroll();if(this.open){this.open=false}this.chClose.emit()};handleCloseClick=()=>{if(typeof this.dialog?.close==="function"&&this.dialog.open){this.dialog.close();return}this.open=false;this.chClose.emit()};render(){return i(s,{key:"36395dc0b52676493b93d02c04d1c810d98c8028"},i("dialog",{key:"99d446c5d0ecd9e16f8d36fc2903f1ab06c274f2",class:{modal:true,[`modal--${this.size}`]:true},"aria-label":this.label,ref:e=>this.dialog=e},i("div",{key:"9dd7043302df7ffa89fdb44f54ed5c93a48fff7e",class:"modal-head"},i("slot",{key:"473041c868d2234c66276936cde0d020b8ed74ce",name:"heading"}),this.closeLabel&&i("button",{key:"e3f65a8c91283b8f3a27975afe44e47e65fbf03f",class:"modal-close",type:"button","aria-label":this.closeLabel,onClick:this.handleCloseClick},i("span",{key:"dbacf11f6b06ed4183e6d277fc807d63867fdf1d","aria-hidden":"true"},"×"))),i("div",{key:"1d9e1567fe0046078f1d26f5dea25c3c06c7e6ed",class:"modal-body"},i("slot",{key:"cc0a63c64b512a6c40c59d8395ced225a961adfc"}))))}static get watchers(){return{open:[{handleOpenChange:0}]}}static get style(){return d()}},[769,"ch-modal",{open:[1028],label:[1],closeLabel:[1,"close-label"],size:[1]},undefined,{open:[{handleOpenChange:0}]}]);function n(){if(typeof customElements==="undefined"){return}const e=["ch-modal"];e.forEach((e=>{switch(e){case"ch-modal":if(!customElements.get(o(e))){customElements.define(o(e),c)}break}}))}n();export{c as C,n as d};
|
|
2
|
+
//# sourceMappingURL=p-MBLhKofG.js.map
|
|
@@ -32,7 +32,7 @@ const ChAccordion = class {
|
|
|
32
32
|
this.chChange.emit(this.value);
|
|
33
33
|
};
|
|
34
34
|
render() {
|
|
35
|
-
return (h(Host, { key: '
|
|
35
|
+
return (h(Host, { key: '75d95349674170ef9e9f6e74b4b3c4369e7f1e21' }, this.items.map(item => {
|
|
36
36
|
const open = this.value === item.value;
|
|
37
37
|
return (h("div", { key: item.value, class: { 'item': true, 'item--open': open } }, h("h3", { class: "item-head" }, h("button", { type: "button", class: "item-toggle", id: this.headerId(item.value), "data-value": item.value, "aria-expanded": open ? 'true' : 'false', "aria-controls": this.panelId(item.value), disabled: item.disabled, onClick: () => this.toggle(item.value) }, item.title)), h("div", { class: "item-panel", id: this.panelId(item.value), role: "region", "aria-labelledby": this.headerId(item.value), hidden: !open }, h("slot", { name: `panel-${item.value}` }))));
|
|
38
38
|
})));
|
|
@@ -50,7 +50,7 @@ const ChAlert = class {
|
|
|
50
50
|
render() {
|
|
51
51
|
const role = this.variant === 'warning' ? 'alert' : 'status';
|
|
52
52
|
const shapes = this.statusCue ? chIcons[VARIANT_ICON[this.variant]] : undefined;
|
|
53
|
-
return (h(Host, { key: '
|
|
53
|
+
return (h(Host, { key: '55c2c37d0a730000b644c583a99eae37d6f75784' }, h("div", { key: role, class: { alert: true, [`alert--${this.variant}`]: true }, role: role }, shapes && (h("svg", { key: '8fb807cd1f894c0960c55a3e417a418078c79d63', class: "alert-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", focusable: "false" }, shapes.map(shape => h(shape.tag, shape.attrs)))), h("div", { key: '43784df5b3ede4eb01521439dd90d85fccf6fe43', class: "alert-content" }, h("slot", { key: 'f4643113dfe9e3beb6f5e1ae9794b28c19ea3341' })), this.dismissLabel && (h("button", { key: 'a1b3afee8907514f9448810b8f22d288a2f50057', class: "alert-dismiss", type: "button", "aria-label": this.dismissLabel, onClick: this.handleDismiss }, h("span", { key: '50371733d2358e002f7bdd1d5f8cb61d020c1cb9', "aria-hidden": "true" }, "\u00D7"))))));
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
ChAlert.style = chAlertCss();
|
|
@@ -72,7 +72,7 @@ const ChBadge = class {
|
|
|
72
72
|
*/
|
|
73
73
|
statusCue = true;
|
|
74
74
|
render() {
|
|
75
|
-
return (h(Host, { key: '
|
|
75
|
+
return (h(Host, { key: '104554450ef32f24bb88afc77ad0b3d79811de6c' }, h("span", { key: '10531c508c51141fe433f794877d38ac8f9d7859', class: { badge: true, [`badge--${this.variant}`]: true } }, this.statusCue && h("span", { key: 'f6bb6f7c23e7d7f4051a6022f76a15f640e35650', class: "badge-dot", "aria-hidden": "true" }), h("slot", { key: '6c4d8c9c981be16facbcf95c3c0abce6f164ed16' }))));
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
ChBadge.style = chBadgeCss();
|
|
@@ -176,7 +176,7 @@ const ChCard = class {
|
|
|
176
176
|
registerInstance(this, hostRef);
|
|
177
177
|
}
|
|
178
178
|
render() {
|
|
179
|
-
return (h(Host, { key: '
|
|
179
|
+
return (h(Host, { key: 'f3a0efc8ed91ac81cf39d599acdf1944d72b56c1' }, h("div", { key: '5524237836d327c8c988903393b5adc09078b121', class: "card" }, h("slot", { key: '7c5a80c115399f591e40705abafd8288ff575d0f' }))));
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
182
|
ChCard.style = chCardCss();
|
|
@@ -302,7 +302,7 @@ const ChInput = class {
|
|
|
302
302
|
return undefined;
|
|
303
303
|
}
|
|
304
304
|
render() {
|
|
305
|
-
return (h(Host, { key: '
|
|
305
|
+
return (h(Host, { key: '80dd56c8fa40d4c8c4eec2b62d1fea2aaa574dcc' }, this.label && (h("label", { key: 'd1d4c26e7a49f176f5d986af107395fd32abbd11', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: '9220c4f98593dce4af626a2d068e654cf360199b', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.invalid }, type: this.type, name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '802ec36ef19bebd3371ff9535fba4052268f3db6', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '489b9634ce6577f71c5875a45cfc5b8a5eeb6cf1', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
306
306
|
}
|
|
307
307
|
static get formAssociated() { return true; }
|
|
308
308
|
static get watchers() { return {
|
|
@@ -434,7 +434,7 @@ const ChSelect = class {
|
|
|
434
434
|
return undefined;
|
|
435
435
|
}
|
|
436
436
|
render() {
|
|
437
|
-
return (h(Host, { key: '
|
|
437
|
+
return (h(Host, { key: 'bb342289b7725eaf8269ceb86589ebeb61f4c63b' }, this.label && (h("label", { key: '766492635c7eac71f719d52d07f71b9895037410', class: "label", htmlFor: this.selectId }, this.label)), h("select", { key: 'f086a020b93254d04b635677290e6e5ae9b1b35c', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (h("option", { key: '3c22ffe91a28b7e9e3a302c31a3c8945335bd2df', value: "", disabled: true, hidden: true, selected: !this.value }, this.placeholder)), this.options.map(option => (h("option", { value: option.value, disabled: option.disabled, selected: option.value === this.value }, option.label)))), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '495b45c73e98b0b61ccde9e16972d0ff80665edf', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '62f08ed1c7bce8a3fbc357bcf0928dd23c897a7b', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
438
438
|
}
|
|
439
439
|
static get formAssociated() { return true; }
|
|
440
440
|
static get watchers() { return {
|
|
@@ -475,7 +475,7 @@ const ChSpinner = class {
|
|
|
475
475
|
label;
|
|
476
476
|
render() {
|
|
477
477
|
const labelled = Boolean(this.label);
|
|
478
|
-
return (h(Host, { key: '
|
|
478
|
+
return (h(Host, { key: '03ab408176f59ecdd51a493d795ccc86acfa563c' }, h("span", { key: 'db54c4d2001a01caeea33426d4042c7ee5546b75', class: { spinner: true, [`spinner--${this.size}`]: true }, role: labelled ? 'status' : undefined, "aria-label": labelled ? this.label : undefined, "aria-hidden": labelled ? undefined : 'true' })));
|
|
479
479
|
}
|
|
480
480
|
};
|
|
481
481
|
ChSpinner.style = chSpinnerCss();
|
|
@@ -588,7 +588,7 @@ const ChSwitch = class {
|
|
|
588
588
|
return undefined;
|
|
589
589
|
}
|
|
590
590
|
render() {
|
|
591
|
-
return (h(Host, { key: '
|
|
591
|
+
return (h(Host, { key: 'bae45755c2467bf088ab67b71c6a21289e33f8f2' }, h("label", { key: '5d68a33bb80334a7f5f326bd6f2dfc2f4c3e01df', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.switchId }, h("input", { key: 'e48330e2c0b23077d34392960dd3d53052b8b21c', id: this.switchId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-checked": this.checked ? 'true' : 'false', "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), h("span", { key: '8f7d8fc472bb03a907e007eaf0c4e81d4f2b1a34', class: "track" }, h("span", { key: '574549aed9d109225c15d2a8b94893dea3799fbf', class: "thumb" })), this.label && h("span", { key: '3da40cbd701270e368f8280fb0475d4372ae65c9', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '39fbb18961f849f241c19bfcd1895285b948b8da', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'a29a1a5dc06732a17e745634bf2874a4f28ff574', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
592
592
|
}
|
|
593
593
|
static get formAssociated() { return true; }
|
|
594
594
|
static get watchers() { return {
|
|
@@ -109,7 +109,7 @@ const ChCheckbox = class {
|
|
|
109
109
|
return undefined;
|
|
110
110
|
}
|
|
111
111
|
render() {
|
|
112
|
-
return (h(Host, { key: '
|
|
112
|
+
return (h(Host, { key: 'cf170be4d00e1ccb5511b0b72f6d42faa35b6371' }, h("label", { key: '3af65f435365b1ffdaf2d4149d87c8c4f7630998', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.checkboxId }, h("input", { key: '3073840bef40f15e7688920209df189e831d4139', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && h("span", { key: 'a2630c7bf760b5adcd5b22e423d20e1bf7bb5107', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '4c51711fe4a623c2b9a77dc66b2e2668c905fc19', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '053569a86c7c3cd01b2278d3dcde7c649142a7c3', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
113
113
|
}
|
|
114
114
|
static get formAssociated() { return true; }
|
|
115
115
|
static get watchers() { return {
|
|
@@ -28,13 +28,13 @@ const ChCluster = class {
|
|
|
28
28
|
return GAPS.has(this.gap) ? this.gap : 'md';
|
|
29
29
|
}
|
|
30
30
|
render() {
|
|
31
|
-
return (h(Host, { key: '
|
|
31
|
+
return (h(Host, { key: '82b4133e903fd75e71314ae814d7c76d1844bcdc', class: {
|
|
32
32
|
'cluster': true,
|
|
33
33
|
[`cluster--gap-${this.gapStep}`]: true,
|
|
34
34
|
[`cluster--align-${this.align}`]: true,
|
|
35
35
|
[`cluster--justify-${this.justify}`]: true,
|
|
36
36
|
'cluster--nowrap': !this.wrap,
|
|
37
|
-
} }, h("slot", { key: '
|
|
37
|
+
} }, h("slot", { key: 'a53161dbf0dbfeb52e5dae80de4764d9c708c3c6' })));
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
ChCluster.style = chClusterCss();
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-8l_6qAY9.js';
|
|
2
|
+
import { r as resolveValidity } from './validation-message-BXzZsX2r.js';
|
|
3
|
+
|
|
4
|
+
const chComboboxCss = () => `:host{display:block;width:100%;font-family:var(--typography-body)}:host([hidden]){display:none}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--color-text-primary)}.chips{display:flex;flex-wrap:wrap;gap:var(--spacing-xs);margin:0 0 var(--spacing-sm);padding:0;list-style:none}.chip{display:inline-flex;align-items:center;gap:var(--spacing-xs);max-width:100%;padding:var(--spacing-2xs) var(--spacing-sm);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-hover);font-size:var(--typography-size-sm)}.chip__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chip__remove{all:unset;cursor:pointer;padding:0 var(--spacing-2xs);border-radius:var(--radius-sm);color:var(--color-text-secondary);line-height:1}.chip__remove:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:1px}.field{position:relative}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-default);color:var(--color-text-primary);font-family:inherit;font-size:var(--typography-size-md);transition:border-color var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--color-text-secondary)}.input:focus{border-color:var(--color-accent-default);outline:2px solid var(--color-accent-default);outline-offset:1px}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input--invalid{border-color:var(--color-status-warning)}.listbox{position:absolute;z-index:var(--z-index-dropdown);top:calc(100% + var(--spacing-2xs));left:0;right:0;max-height:16rem;margin:0;padding:var(--spacing-2xs);overflow-y:auto;list-style:none;border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-default);box-shadow:var(--shadow-elevate)}.listbox[hidden]{display:none}.listbox__option{padding:var(--spacing-sm) var(--spacing-md);border-radius:var(--radius-sm);font-size:var(--typography-size-sm);cursor:pointer}.listbox__option--active{background:var(--color-surface-hover);font-weight:var(--typography-weight-semibold);box-shadow:inset 2px 0 0 var(--color-accent-default)}.listbox__option--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.listbox__empty{padding:var(--spacing-sm) var(--spacing-md);font-size:var(--typography-size-sm);color:var(--color-text-secondary)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--color-text-secondary)}.error{color:var(--color-status-warning)}`;
|
|
5
|
+
|
|
6
|
+
let comboboxIds = 0;
|
|
7
|
+
const ChCombobox = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
registerInstance(this, hostRef);
|
|
10
|
+
this.chChange = createEvent(this, "chChange");
|
|
11
|
+
this.chFilter = createEvent(this, "chFilter");
|
|
12
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
13
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
17
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
inputId = `ch-combobox-${++comboboxIds}`;
|
|
21
|
+
listId = `${this.inputId}-list`;
|
|
22
|
+
hintId = `${this.inputId}-hint`;
|
|
23
|
+
errorId = `${this.inputId}-error`;
|
|
24
|
+
initialValue = [];
|
|
25
|
+
internals;
|
|
26
|
+
formDisabled = false;
|
|
27
|
+
get host() { return getElement(this); }
|
|
28
|
+
/** Visible label, associated with the input via `for`/`id`. */
|
|
29
|
+
label;
|
|
30
|
+
/** The options to filter and choose from. */
|
|
31
|
+
options = [];
|
|
32
|
+
/** The committed value. An array when `multiple`. */
|
|
33
|
+
value;
|
|
34
|
+
/** Whether the user can pick more than one option. */
|
|
35
|
+
multiple = false;
|
|
36
|
+
/** Placeholder shown while the field is empty. */
|
|
37
|
+
placeholder;
|
|
38
|
+
/** Name submitted with the form. Repeated once per value when `multiple`. */
|
|
39
|
+
name;
|
|
40
|
+
/** Whether the field is disabled. */
|
|
41
|
+
disabled = false;
|
|
42
|
+
/** Whether at least one value is required. */
|
|
43
|
+
required = false;
|
|
44
|
+
/** Helper text, replaced by `errorMessage` when invalid. */
|
|
45
|
+
hint;
|
|
46
|
+
/** Custom error message; wins over the built-in messages. */
|
|
47
|
+
errorMessage;
|
|
48
|
+
/** Whether the field is marked invalid by the consumer. */
|
|
49
|
+
invalid = false;
|
|
50
|
+
/** Text the user has typed to filter with. */
|
|
51
|
+
query = '';
|
|
52
|
+
/** Whether the list is rendered. */
|
|
53
|
+
expanded = false;
|
|
54
|
+
/** Index into `visibleOptions` of the option under the keyboard cursor. */
|
|
55
|
+
activeIndex = -1;
|
|
56
|
+
/** Emitted whenever the committed value changes. */
|
|
57
|
+
chChange;
|
|
58
|
+
/** Emitted as the user types, with the raw query, so a consumer can filter remotely. */
|
|
59
|
+
chFilter;
|
|
60
|
+
/** The committed values as an array, whatever the mode. */
|
|
61
|
+
get selected() {
|
|
62
|
+
if (Array.isArray(this.value)) {
|
|
63
|
+
return this.value;
|
|
64
|
+
}
|
|
65
|
+
return this.value === undefined || this.value === '' ? [] : [this.value];
|
|
66
|
+
}
|
|
67
|
+
/** Options that match the current query. */
|
|
68
|
+
get visibleOptions() {
|
|
69
|
+
const query = this.query.trim().toLowerCase();
|
|
70
|
+
if (query === '') {
|
|
71
|
+
return this.options;
|
|
72
|
+
}
|
|
73
|
+
return this.options.filter(option => option.label.toLowerCase().includes(query));
|
|
74
|
+
}
|
|
75
|
+
/** Options that are still choosable: already-picked ones drop out in multiple mode. */
|
|
76
|
+
get choosable() {
|
|
77
|
+
if (!this.multiple) {
|
|
78
|
+
return this.visibleOptions;
|
|
79
|
+
}
|
|
80
|
+
const chosen = new Set(this.selected);
|
|
81
|
+
return this.visibleOptions.filter(option => !chosen.has(option.value));
|
|
82
|
+
}
|
|
83
|
+
labelFor(value) {
|
|
84
|
+
return this.options.find(option => option.value === value)?.label ?? value;
|
|
85
|
+
}
|
|
86
|
+
componentDidLoad() {
|
|
87
|
+
this.initialValue = this.selected;
|
|
88
|
+
this.syncForm();
|
|
89
|
+
this.host.addEventListener('focusout', this.handleFocusOut);
|
|
90
|
+
this.host.addEventListener('invalid', this.markTouched);
|
|
91
|
+
}
|
|
92
|
+
disconnectedCallback() {
|
|
93
|
+
this.host.removeEventListener('focusout', this.handleFocusOut);
|
|
94
|
+
}
|
|
95
|
+
markTouched = () => {
|
|
96
|
+
this.host.setAttribute('data-touched', '');
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Closing on blur is deferred: clicking an option also blurs the input, and
|
|
100
|
+
* the click must be allowed to land first.
|
|
101
|
+
*/
|
|
102
|
+
handleFocusOut = () => {
|
|
103
|
+
this.markTouched();
|
|
104
|
+
window.setTimeout(() => {
|
|
105
|
+
if (!this.host.contains(document.activeElement) && this.host.shadowRoot?.activeElement == null) {
|
|
106
|
+
this.expanded = false;
|
|
107
|
+
this.syncForm();
|
|
108
|
+
}
|
|
109
|
+
}, 0);
|
|
110
|
+
};
|
|
111
|
+
syncForm() {
|
|
112
|
+
const internals = this.internals;
|
|
113
|
+
if (typeof internals?.setFormValue !== 'function') {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const values = this.selected;
|
|
117
|
+
// Multiple entries are submitted once per value, the way a multi-select does.
|
|
118
|
+
if (this.multiple) {
|
|
119
|
+
const data = new FormData();
|
|
120
|
+
for (const entry of values) {
|
|
121
|
+
data.append(this.name ?? '', entry);
|
|
122
|
+
}
|
|
123
|
+
internals.setFormValue(values.length === 0 ? null : data);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
internals.setFormValue(values[0] ?? '');
|
|
127
|
+
}
|
|
128
|
+
const { flags, message } = resolveValidity({
|
|
129
|
+
required: this.required,
|
|
130
|
+
empty: values.length === 0,
|
|
131
|
+
invalid: this.invalid,
|
|
132
|
+
errorMessage: this.errorMessage,
|
|
133
|
+
});
|
|
134
|
+
internals.setValidity(flags, message);
|
|
135
|
+
}
|
|
136
|
+
formResetCallback() {
|
|
137
|
+
this.value = this.multiple ? [...this.initialValue] : (this.initialValue[0] ?? '');
|
|
138
|
+
this.query = '';
|
|
139
|
+
this.syncForm();
|
|
140
|
+
const input = this.host.shadowRoot?.querySelector('.input');
|
|
141
|
+
if (input) {
|
|
142
|
+
input.value = '';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
formDisabledCallback(isDisabled) {
|
|
146
|
+
this.formDisabled = isDisabled;
|
|
147
|
+
}
|
|
148
|
+
commit(value) {
|
|
149
|
+
if (this.multiple) {
|
|
150
|
+
const next = this.selected.includes(value) ? this.selected : [...this.selected, value];
|
|
151
|
+
this.value = next;
|
|
152
|
+
this.query = '';
|
|
153
|
+
const input = this.host.shadowRoot?.querySelector('.input');
|
|
154
|
+
if (input) {
|
|
155
|
+
input.value = '';
|
|
156
|
+
}
|
|
157
|
+
// Keep the list open: choosing again is the common case here.
|
|
158
|
+
this.activeIndex = -1;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
this.value = value;
|
|
162
|
+
this.query = this.labelFor(value);
|
|
163
|
+
this.expanded = false;
|
|
164
|
+
this.activeIndex = -1;
|
|
165
|
+
}
|
|
166
|
+
this.chChange.emit(this.value);
|
|
167
|
+
this.syncForm();
|
|
168
|
+
}
|
|
169
|
+
remove(value) {
|
|
170
|
+
const next = this.selected.filter(entry => entry !== value);
|
|
171
|
+
this.value = this.multiple ? next : '';
|
|
172
|
+
this.chChange.emit(this.value);
|
|
173
|
+
this.syncForm();
|
|
174
|
+
}
|
|
175
|
+
open() {
|
|
176
|
+
if (this.disabled || this.formDisabled) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
this.expanded = true;
|
|
180
|
+
}
|
|
181
|
+
moveActive(delta) {
|
|
182
|
+
const count = this.choosable.length;
|
|
183
|
+
if (count === 0) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const next = this.activeIndex + delta;
|
|
187
|
+
this.activeIndex = next < 0 ? count - 1 : next >= count ? 0 : next;
|
|
188
|
+
}
|
|
189
|
+
handleInput = (event) => {
|
|
190
|
+
const input = event.target;
|
|
191
|
+
this.query = input.value;
|
|
192
|
+
this.expanded = true;
|
|
193
|
+
this.activeIndex = this.choosable.length > 0 ? 0 : -1;
|
|
194
|
+
// Single mode shows a typed-but-uncommitted value as no value at all.
|
|
195
|
+
if (!this.multiple && this.value !== undefined && this.value !== this.labelFor(this.selected[0] ?? '')) {
|
|
196
|
+
this.value = '';
|
|
197
|
+
}
|
|
198
|
+
this.chFilter.emit(this.query);
|
|
199
|
+
};
|
|
200
|
+
handleKeyDown = (event) => {
|
|
201
|
+
if (event.key === 'ArrowDown') {
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
this.open();
|
|
204
|
+
this.moveActive(1);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (event.key === 'ArrowUp') {
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
this.open();
|
|
210
|
+
this.moveActive(-1);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (event.key === 'Enter') {
|
|
214
|
+
const option = this.choosable[this.activeIndex];
|
|
215
|
+
if (this.expanded && option && !option.disabled) {
|
|
216
|
+
event.preventDefault();
|
|
217
|
+
this.commit(option.value);
|
|
218
|
+
}
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (event.key === 'Escape' && this.expanded) {
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
this.expanded = false;
|
|
224
|
+
this.activeIndex = -1;
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
// Backspace in an empty multiple field removes the last chip.
|
|
228
|
+
if (event.key === 'Backspace' && this.multiple && this.query === '') {
|
|
229
|
+
const last = this.selected[this.selected.length - 1];
|
|
230
|
+
if (last !== undefined) {
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
this.remove(last);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
handleFocus = () => {
|
|
237
|
+
this.open();
|
|
238
|
+
};
|
|
239
|
+
handleBlur = () => {
|
|
240
|
+
// A single-mode field shows the chosen label, not what was typed.
|
|
241
|
+
const input = this.host.shadowRoot?.querySelector('.input');
|
|
242
|
+
if (input && !this.multiple) {
|
|
243
|
+
this.query = '';
|
|
244
|
+
input.value = this.selected.length > 0 ? this.labelFor(this.selected[0]) : '';
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
get isInvalid() {
|
|
248
|
+
return this.invalid || (this.host.hasAttribute('data-touched') && this.selected.length === 0 && this.required);
|
|
249
|
+
}
|
|
250
|
+
get describedBy() {
|
|
251
|
+
if (this.isInvalid && this.errorMessage) {
|
|
252
|
+
return this.errorId;
|
|
253
|
+
}
|
|
254
|
+
return this.hint ? this.hintId : undefined;
|
|
255
|
+
}
|
|
256
|
+
/** The option id for `aria-activedescendant`. */
|
|
257
|
+
optionId(index) {
|
|
258
|
+
return `${this.inputId}-option-${index}`;
|
|
259
|
+
}
|
|
260
|
+
render() {
|
|
261
|
+
const options = this.choosable;
|
|
262
|
+
const active = this.activeIndex >= 0 && this.activeIndex < options.length ? options[this.activeIndex] : undefined;
|
|
263
|
+
const chosen = this.selected;
|
|
264
|
+
const showError = this.isInvalid && this.errorMessage;
|
|
265
|
+
return (h(Host, { key: '783df95d2970b0db5c6f839fb0acbaa7582301f0' }, this.label && (h("label", { key: '232933c04601d543b391d15603f1dcfafa2f6e73', class: "label", htmlFor: this.inputId }, this.label)), this.multiple && chosen.length > 0 && (h("ul", { key: 'e7e92805f42a9a97d0587463f0b68fa79368cc6b', class: "chips", "aria-label": "Selected values" }, chosen.map(entry => (h("li", { class: "chip", key: entry }, h("span", { class: "chip__label" }, this.labelFor(entry)), h("button", { type: "button", class: "chip__remove", "aria-label": `Remove ${this.labelFor(entry)}`, onClick: () => this.remove(entry) }, h("span", { "aria-hidden": "true" }, "\u00D7"))))))), h("div", { key: '076bd78c0c43327c298baf37e9411d68e6b03734', class: "field" }, h("input", { key: '0e2caa28567ea21d8b5a98a8b1ed949e07731e09', id: this.label && !this.multiple ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid }, type: "text", role: "combobox", autocomplete: "off", "aria-expanded": this.expanded ? 'true' : 'false', "aria-controls": this.listId, "aria-autocomplete": "list", "aria-activedescendant": active ? this.optionId(this.activeIndex) : undefined, "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, name: this.name, disabled: this.disabled || this.formDisabled, required: this.required, placeholder: chosen.length === 0 ? this.placeholder : undefined, value: this.multiple ? this.query : this.query || (chosen[0] !== undefined ? this.labelFor(chosen[0]) : ''), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }), h("ul", { key: '5f843aef03c09ff9dd1e02c3da90f6e9dbcca858', class: "listbox", id: this.listId, role: "listbox", "aria-multiselectable": this.multiple ? 'true' : undefined, hidden: !this.expanded }, options.length === 0 && (h("li", { key: '1bb282438f1889da96af7d27b504e31ab19088e5', class: "listbox__empty", role: "presentation" }, "No results")), options.map((option, index) => (h("li", { class: {
|
|
266
|
+
'listbox__option': true,
|
|
267
|
+
'listbox__option--active': index === this.activeIndex,
|
|
268
|
+
'listbox__option--disabled': option.disabled === true,
|
|
269
|
+
}, id: this.optionId(index), key: option.value, role: "option", "aria-selected": this.multiple ? 'false' : chosen[0] === option.value ? 'true' : 'false', "aria-disabled": option.disabled ? 'true' : undefined,
|
|
270
|
+
// Pointer-down commits before the input's blur closes the list.
|
|
271
|
+
onMouseDown: event => {
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
if (!option.disabled) {
|
|
274
|
+
this.commit(option.value);
|
|
275
|
+
}
|
|
276
|
+
} }, option.label))))), this.hint && !showError && (h("p", { key: 'dc7f8a5d26e55d2d7836bf72a5359a6c0fbe0220', class: "hint", id: this.hintId }, this.hint)), showError && (h("p", { key: 'd3d9beaa0eb9d830b2c9f3082ea0bf0490efe3ee', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
277
|
+
}
|
|
278
|
+
static get formAssociated() { return true; }
|
|
279
|
+
static get watchers() { return {
|
|
280
|
+
"value": [{
|
|
281
|
+
"syncForm": 0
|
|
282
|
+
}],
|
|
283
|
+
"required": [{
|
|
284
|
+
"syncForm": 0
|
|
285
|
+
}],
|
|
286
|
+
"invalid": [{
|
|
287
|
+
"syncForm": 0
|
|
288
|
+
}],
|
|
289
|
+
"errorMessage": [{
|
|
290
|
+
"syncForm": 0
|
|
291
|
+
}],
|
|
292
|
+
"multiple": [{
|
|
293
|
+
"syncForm": 0
|
|
294
|
+
}]
|
|
295
|
+
}; }
|
|
296
|
+
};
|
|
297
|
+
ChCombobox.style = chComboboxCss();
|
|
298
|
+
|
|
299
|
+
export { ChCombobox as ch_combobox };
|
|
300
|
+
//# sourceMappingURL=ch-combobox.entry.js.map
|
|
301
|
+
|
|
302
|
+
//# sourceMappingURL=ch-combobox.entry.js.map
|