@aurodesignsystem-dev/auro-table 0.0.0-pr142.1 → 0.0.0-pr144.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.
@@ -1,12 +0,0 @@
1
- import{css as e,LitElement as t,html as s}from"lit";import{createRef as a,ref as i}from"lit/directives/ref.js";import{classMap as l}from"lit/directives/class-map.js";class r{registerComponent(e,t){customElements.get(e)||customElements.define(e,class extends t{})}closestElement(e,t=this,s=(t,a=t&&t.closest(e))=>t&&t!==document&&t!==window?a||s(t.getRootNode().host):null){return s(t)}handleComponentTagRename(e,t){const s=t.toLowerCase();e.tagName.toLowerCase()!==s&&e.setAttribute(s,!0)}elementMatch(e,t){const s=t.toLowerCase();return e.tagName.toLowerCase()===s||e.hasAttribute(s)}}var n=e`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}.body-default{font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, .875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs{font-size:var(--wcss-body-xs-font-size, .75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:var(--wcss-body-2xs-font-size, .625rem);font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);line-height:var(--wcss-body-2xs-line-height, .875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 450);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 450);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, .05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, .05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, .05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, .05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, .05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, .1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(.875rem, 1.1666666667vw, .875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, .1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}:host,auro-table,[auro-table]{display:block;overflow:auto}:host([nowrap]),auro-table[nowrap],[auro-table][nowrap]{white-space:nowrap}:host table,auro-table table,[auro-table] table{overflow:scroll;width:100%;margin-bottom:var(--ds-size-400, 2rem);border-collapse:collapse;border-spacing:var(--ds-size-100, .5rem)}:host table thead,auro-table table thead,[auro-table] table thead{border-bottom:1px solid var(--ds-auro-table-border-color);border-collapse:collapse}:host table tr:nth-child(2n),auro-table table tr:nth-child(2n),[auro-table] table tr:nth-child(2n){background-color:var(--ds-auro-table-alt-row-container-color)}:host table th,:host table td,auro-table table th,auro-table table td,[auro-table] table th,[auro-table] table td{padding:var(--ds-size-200, 1rem)}:host table th,auro-table table th,[auro-table] table th{text-align:left}
2
- `,o=e`:host{--ds-auro-table-alt-row-container-color: var(--ds-basic-color-surface-neutral-subtle, #f7f7f7);--ds-auro-table-border-color: var(--ds-basic-color-border-subtle, #dddddd)}
3
- `;class c{#e=[];#t=[];#s=[];get current(){return this.#e}constructor({callback:e}={}){"function"==typeof e&&this.subscribe(e)}subscribe(e){if("function"!=typeof e)throw new Error("ChildItemService | subscribe: Callback must be a function");return this.#s.push(e),()=>this.unsubscribe(e)}unsubscribe(e){if("function"!=typeof e)throw new Error("ChildItemService | unsubscribe: Callback must be a function");return this.#s=this.#s.filter(t=>t!==e),!0}#a(){for(const e of this.#s)e({items:this.#e,previousItems:this.#t,addedItems:this.#e.filter(e=>!this.#t.includes(e)),removedItems:this.#t.filter(e=>!this.#e.includes(e))})}add(e){if("object"!=typeof e||null===e)throw new Error("ChildItemService | addItem: Item must be an object");this.#t=this.#i(),this.#e.push(e),this.#a()}addMany(e){if(!e||"function"!=typeof e[Symbol.iterator]||"string"==typeof e)throw new Error("ChildItemService | addMany: Items must be iterable (array, etc.)");this.#t=this.#i(),this.#e.push(...e),this.#a()}remove(e){if("object"!=typeof e||null===e)throw new Error("ChildItemService | removeItem: Item must be an object");this.#t=this.#i(),this.#e=this.#e.filter(t=>t!==e),this.#a()}clear(){this.#t=this.#i(),this.#e=[],this.#a()}getItemByIndex(e){return this.#e[e]}getItemByNumber(e){if(0===this.#e.length||"number"!=typeof e||e<0||e>this.#e.length)throw new Error("ChildItemService | getItemByNumber: Number must be a valid index within the range of items.");return this.#e[e-1]}getPreviousItem(e){if("number"!=typeof e||e<1||e>this.#e.length)throw new Error("ChildItemService | getPreviousItem: Index must be a valid number within the range of previous items.");let t=e-2;return t=t<0?this.#e.length-1:t,this.#e[t]}getNextItem(e){if("number"!=typeof e||e<1||e>this.#e.length)throw new Error("ChildItemService | getNextItem: Index must be a valid number within the range of previous items.");let t=e;return t=t>=this.#e.length?0:t,this.#e[t]}#i(){return[...this.#e]}}class m extends t{static#l=`${n.cssText} ${o.cssText}`;#r=new r;#n=null;#o=a();get#c(){return this.#o.value}#m=a();get#h(){return this.#m.value}#d=a();get#g(){return this.#d.value}#f={TABLE:["body-default"],TH:["heading-2xs"]};collectionUpdated=({addedItems:e})=>{if(e?.length){const t=e[0].tagName;if(!t)return;const s=this.#f[t];s&&e.forEach(e=>e.classList.add(...s))}};#y=["TH","TD","TR","THEAD","TBODY","TABLE"].reduce((e,t)=>(e[t]=new c({callback:this.collectionUpdated}),e),{});#p(e){const t=e?.toUpperCase();return this.#f[t]?.reduce((e,t)=>(e[t]=!0,e),{})||{}}constructor(){super(),this.nowrap=!1}static get properties(){return{columnHeaders:{type:Array,reflect:!0},componentData:{type:Array,reflect:!0},nowrap:{type:Boolean,reflect:!0}}}static get styles(){return[n,o]}static register(e="auro-table"){r.prototype.registerComponent(e,m)}updated(e){e.has("columnHeaders")&&this.#b(),e.has("componentData")&&this.#w()}firstUpdated(){this.#r.handleComponentTagRename(this,"auro-table")}disconnectedCallback(){super.disconnectedCallback(),this.#n&&this.#n.disconnect()}#b(){if(this.columnHeaders){if(!this.#h)return void console.warn("auro-table: #tableHeader is null or undefined in #extractHeaders(). This may indicate a rendering or initialization issue.");this.#h.innerHTML="";const e=document.createElement("tr");this.#h.appendChild(e),this.columnHeaders.forEach(t=>{const s=document.createElement("th");s.classList.add(...this.#f.TH),s.innerHTML=t,e.appendChild(s)})}}#w(){if(this.#g){if(this.#g.innerHTML="",this.componentData&&this.columnHeaders){const e=document.createDocumentFragment();this.componentData.forEach(t=>{const s=document.createElement("tr");this.columnHeaders.forEach(e=>{const a=document.createElement("td"),i=t[e]||"";a.innerHTML=i,s.appendChild(a)}),e.appendChild(s)}),this.#g.appendChild(e)}}else console.error("auro-table: #tableBody is missing. Unable to extract rows.")}#u(e){this.#n&&this.#n.disconnect(),this.#n=new MutationObserver(e=>{for(const t of e)t.addedNodes.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&this.#y[e.tagName]?.add(e)}),t.removedNodes.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&this.#y[e.tagName]?.remove(e)})}),this.#n.observe(e,{childList:!0,subtree:!0})}#v(e){[...e.querySelectorAll("th"),...e.querySelectorAll("td"),...e.querySelectorAll("tr"),...e.querySelectorAll("thead"),...e.querySelectorAll("tbody"),e].forEach(e=>this.#y[e.tagName]?.add(e))}#x(e){this.#v(e),this.#u(e)}#S(e){if(e.querySelector(".auro-table--injected-styles"))return;const t=document.createElement("style");t.classList.add("auro-table--injected-styles"),t.textContent=m.#l,e.prepend(t)}#I(){const e=this.shadowRoot.querySelector("slot").assignedNodes({flatten:!0}).filter(e=>e.nodeType===Node.ELEMENT_NODE).find(e=>"TABLE"===e.nodeName);e&&(this.#x(e),this.#S(e))}render(){return this.columnHeaders?.length&&this.componentData?.length?s`
4
- <table ${i(this.#o)} class=${l(this.#p("TABLE"))}>
5
- <thead ${i(this.#m)}>
6
- </thead>
7
- <tbody ${i(this.#d)}>
8
- </tbody>
9
- </table>
10
- `:s`
11
- <slot @slotchange=${this.#I}></slot>
12
- `}}export{m as A};