@aceshooting/lyra-ui 14.2.0 → 14.3.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/CHANGELOG.md +24 -0
- package/custom-elements.json +1 -1
- package/dist/cli/migration-contract.json +1 -1
- package/dist/components/charts/chart/chart-legend-visibility.d.ts +8 -0
- package/dist/components/charts/chart/chart.class.d.ts +48 -12
- package/dist/components/charts/chart/chart.class.js +10 -10
- package/dist/components/data/table/table.class.d.ts +9 -1
- package/dist/components/data/table/table.class.js +4 -3
- package/dist/components/data/table/table.styles.js +1 -1
- package/dist/components/forms/button/button.class.d.ts +8 -2
- package/dist/components/forms/button/button.class.js +6 -2
- package/dist/components/media/map/map.class.d.ts +34 -6
- package/dist/components/media/map/map.class.js +1 -1
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/custom-elements-jsx.d.ts +1 -1
- package/dist/events.d.ts +17 -1
- package/dist/internal/icons.d.ts +2 -0
- package/dist/internal/icons.js +2 -2
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/vue.d.ts +1 -1
- package/llms/components/lr-accordion-item.md +36 -0
- package/llms/components/lr-accordion.md +36 -0
- package/llms/components/lr-bar-chart.md +4 -1
- package/llms/components/lr-bubble-chart.md +4 -1
- package/llms/components/lr-button.md +5 -0
- package/llms/components/lr-chart.md +40 -2
- package/llms/components/lr-details.md +36 -0
- package/llms/components/lr-doughnut-chart.md +4 -1
- package/llms/components/lr-histogram.md +6 -2
- package/llms/components/lr-line-chart.md +4 -1
- package/llms/components/lr-map.md +45 -7
- package/llms/components/lr-pie-chart.md +4 -1
- package/llms/components/lr-polar-area-chart.md +4 -1
- package/llms/components/lr-radar-chart.md +4 -1
- package/llms/components/lr-scatter-chart.md +4 -1
- package/llms/components/lr-table.md +10 -4
- package/llms-full.txt +171 -16
- package/package.json +1 -1
- package/vscode-html-data.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isRtl}from"../../../internal/rtl.js";import{srOnly,nextId}from"../../../internal/a11y.js";import{finiteCount,finiteInteger,finiteRatio}from"../../../internal/numbers.js";import{resolveCssLength}from"../../../internal/css-length.js";import{getCollator,getNumberFormat}from"../../../internal/intl-cache.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{styles}from"./table.styles.js";import{chevronIcon}from"../../../internal/icons.js";import{minMax}from"../heatmap/heatmap-scale.js";import"../../overlays/empty/empty.class.js";import{literalSetConverter,trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{activeElementIn}from"../../../internal/active-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_expand,LYRA_DEFAULT_loadMore,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noColumns,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_resizeColumn,LYRA_DEFAULT_resizeValuePixels,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_showAllColumns,LYRA_DEFAULT_showFewerColumns,LYRA_DEFAULT_tableEditCell,LYRA_DEFAULT_tableFilterLabel,LYRA_DEFAULT_tableFilterPlaceholder,LYRA_DEFAULT_tableLoading}from"../../../internal/default-strings.generated.js";const DEFAULT_SKELETON_ROWS=3,MAX_SKELETON_ROWS=20,DEFAULT_PAGE_SIZE=100,MAX_PAGE_SIZE=500,LOW_PRIORITY_MAX_INLINE_SIZE=899.98,MEDIUM_PRIORITY_MAX_INLINE_SIZE=639.98,MAX_TABLE_COLLECTION_ENTRIES=1e4,TABLE_SCROLL_OVERFLOW_TOLERANCE_PX=1,DEFAULT_RESIZE_MIN_WIDTH_PX=48,UNBOUNDED_RESIZE_ARIA_MAX=Number.MAX_SAFE_INTEGER,MISSING_CELL_RENDERER_WARNING="lyra-table-missing-cell-renderer",MISSING_ACCESSIBLE_NAME_WARNING="lyra-table-missing-accessible-name";function frozenArray(values){const snapshot=[];try{for(const value of values)if(snapshot.push(value),snapshot.length>=MAX_TABLE_COLLECTION_ENTRIES)break}catch{}return Object.freeze(snapshot)}function keySet(values){const snapshot=new Set;try{for(const value of values){if(typeof value=="string"){if(value.trim().length===0)continue}else if(typeof value!="number")continue;if(snapshot.add(value),snapshot.size>=MAX_TABLE_COLLECTION_ENTRIES)break}}catch{}return snapshot}function readonlyKeySet(values){const snapshot=keySet(values);let facade;return facade={get size(){return snapshot.size},has:value=>snapshot.has(value),entries:()=>snapshot.entries(),keys:()=>snapshot.keys(),values:()=>snapshot.values(),[Symbol.iterator]:()=>snapshot[Symbol.iterator](),forEach(callback,thisArg){snapshot.forEach(value=>callback.call(thisArg,value,value,facade))}},Object.freeze(facade)}const UNSAFE_CSS_STRUCTURE=/[;{}]/,URL_FUNCTION=/url\s*\(/i,SAFE_STYLE_PROPERTY=/^-?[_a-zA-Z][\w-]*$|^--[a-zA-Z0-9_-]+$/,optionalBooleanConverter={fromAttribute(value){if(value!==null)return value!=="false"},toAttribute(value){return value===void 0?null:value?"":"false"}},TABLE_LAYOUT=literalSetConverter(["auto","fixed"],"auto"),INTERACTIVE_SELECTOR='button, a[href], input, select, textarea, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"]), [role="button"], [role="checkbox"], [role="combobox"], [role="listbox"], [role="menu"], [role="menuitem"], [role="option"], [role="radio"], [role="separator"], [role="slider"], [role="spinbutton"], [role="switch"], [role="tab"], [role="textbox"]';function stickyDirection(sticky){if(sticky==="start"||sticky==="end")return sticky}function sanitizeCellStyle(cellStyle){if(cellStyle===void 0)return{};const safe={};for(const[rawProperty,rawValue]of Object.entries(cellStyle)){const property2=sanitizeCellStyleProperty(rawProperty),value=sanitizeCellStyleValue(rawValue);if(property2===void 0||value===void 0)continue;const normalizedProperty=normalizeStyleProperty(property2);(normalizedProperty.startsWith("--")||cssSupports(normalizedProperty,value))&&(safe[normalizedProperty]=value)}return safe}function sanitizeCellStyleProperty(property2){const normalized=property2.trim();if(!(!normalized||!SAFE_STYLE_PROPERTY.test(normalized)))return normalized}function normalizeStyleProperty(property2){return property2.startsWith("--")?property2:property2.replace(/[A-Z]/g,"-$&").toLowerCase()}function sanitizeCellStyleValue(value){if(typeof value!="string")return;const normalized=value.trim();if(!(!normalized||UNSAFE_CSS_STRUCTURE.test(normalized)||URL_FUNCTION.test(normalized)))return normalized}function cssSupports(property2,value){return typeof CSS>"u"||typeof CSS.supports!="function"?!0:CSS.supports(property2,value)}function normalizedEditTrigger(editTrigger){if(editTrigger==="always"||editTrigger==="double-click")return editTrigger}function encodeKey(key){return`${typeof key}:${key}`}function safeStringifyForFilter(row){const seen=new WeakSet;try{return JSON.stringify(row,(_key,value)=>{if(typeof value=="bigint")return value.toString();if(typeof value=="object"&&value!==null){if(seen.has(value))return"[Circular]";seen.add(value)}return value})??""}catch{return""}}function asElement(value){return typeof value!="object"||!("nodeType"in value)||value.nodeType!==1||!("matches"in value)?null:value}function eventInteractiveTarget(event,boundary){for(const value of event.composedPath()){if(value===boundary)break;const element=asElement(value);if(element!==null&&(element.matches("[data-table-interactive]")||element.matches(INTERACTIVE_SELECTOR)&&!element.matches("[data-row-key], th[data-col-key]")))return element}return null}class LyraTable extends LyraElement{constructor(){super(...arguments),this._columns=Object.freeze([]),this._rows=Object.freeze([]),this._layout="auto",this.sortKey="",this.sortDir="asc",this.sortMode="client",this.defaultSortDir="asc",this.caption="",this.captionId=nextId("lr-table-caption"),this.selectionMode="none",this.scrollMode="self",this._selectedKeys=new Set,this.filterable=!1,this.filterText="",this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.loading=!1,this.loadingAppearance="spinner",this.skeletonRows=0,this.pageSize=DEFAULT_PAGE_SIZE,this.page=1,this.totalItems=-1,this.paginationMode="client",this._expandedKeys=new Set,this.hasMore=!1,this.emptyDescription="",this.noColumnsDescription="",this.hasHiddenPriorityColumns=!1,this.priorityColumnsToggleAvailable=!1,this.priorityColumnsVisible=!1,this.persistReady=!1,this.loadingAnnouncementsReady=!1,this.activeColKey=null,this.activeRowKey=null,this.editingCell=null,this.focusedEditorCell=null,this.editorHadFocusBeforeUpdate=!1,this.rovingFocusSnapshot=null,this.resizedColumnWidths=new Map,this.rowsByKey=new Map,this.columnsByKey=new Map,this.layoutFrame=null,this.observedHeaders=new Set,this.onResizePointerDown=event=>{const handle=event.currentTarget,key=handle.dataset.colKey,column=key?this.columnsByKey.get(key):void 0,header=handle.closest("th[data-col-key]"),resizeEventWindow=this.ownerDocument.defaultView;if(!key||!column||!header||!resizeEventWindow)return;const replacedStartWidth=this.resizeState?.key===key?this.resizeState.startWidth:void 0;this.cancelResizeGesture();const minWidth=this.minimumResizeWidth(column);this.resizeState={key,pointerId:event.pointerId,startX:event.clientX,startWidth:replacedStartWidth??header.getBoundingClientRect().width,minWidth,maxWidth:this.maximumResizeWidth(column,minWidth),handle,previousWidth:this.resizedColumnWidths.get(key)},handle.toggleAttribute("data-resizing",!0),event.preventDefault(),event.stopPropagation(),handle.setPointerCapture?.(event.pointerId),this.resizeEventWindow=resizeEventWindow,resizeEventWindow.addEventListener("pointermove",this.onResizePointerMove),resizeEventWindow.addEventListener("pointerup",this.onResizePointerEnd),resizeEventWindow.addEventListener("pointercancel",this.onResizePointerEnd),resizeEventWindow.addEventListener("lostpointercapture",this.onResizePointerEnd)},this.onResizePointerMove=event=>{const state2=this.resizeState;if(!state2||event.pointerId!==state2.pointerId)return;const delta=isRtl(this)?state2.startX-event.clientX:event.clientX-state2.startX,width=Math.min(state2.maxWidth,Math.max(state2.minWidth,state2.startWidth+delta));this.resizedColumnWidths.get(state2.key)!==width&&(this.resizedColumnWidths=new Map(this.resizedColumnWidths).set(state2.key,width),this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width})))},this.onResizeKeyDown=event=>{const handle=event.currentTarget,key=handle.dataset.colKey,column=key?this.columnsByKey.get(key):void 0;if(!column)return;const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),currentWidth=this.currentResizeWidth(column,handle),step=event.shiftKey?50:10;let requestedWidth;event.key==="Home"?requestedWidth=minWidth:event.key==="End"&&Number.isFinite(maxWidth)?requestedWidth=maxWidth:event.key==="ArrowLeft"?requestedWidth=currentWidth+(isRtl(this)?step:-step):event.key==="ArrowRight"&&(requestedWidth=currentWidth+(isRtl(this)?-step:step)),requestedWidth!==void 0&&(event.preventDefault(),event.stopPropagation(),this.resizeColumnTo(column,requestedWidth))},this.onResizePointerEnd=event=>{const state2=this.resizeState;if(!state2||event.pointerId!==state2.pointerId)return;if(state2.handle.removeAttribute("data-resizing"),event.type==="pointerup")try{state2.handle.releasePointerCapture?.(event.pointerId)}catch{}if(this.resizeState=void 0,this.detachResizePointerListeners(),event.type!=="pointerup"){const reverted2=new Map(this.resizedColumnWidths);state2.previousWidth===void 0?reverted2.delete(state2.key):reverted2.set(state2.key,state2.previousWidth),this.resizedColumnWidths=reverted2;return}const committedWidth=this.resizedColumnWidths.get(state2.key);if(committedWidth===void 0||committedWidth===state2.previousWidth||!this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width:committedWidth}),{cancelable:!0}).defaultPrevented)return;const reverted=new Map(this.resizedColumnWidths);state2.previousWidth===void 0?reverted.delete(state2.key):reverted.set(state2.key,state2.previousWidth),this.resizedColumnWidths=reverted},this.scheduleLayoutSync=()=>{if(this.layoutFrame)return;const owner=this.ownerDocument.defaultView;if(!owner)return;const frame={owner,handle:0};frame.handle=owner.requestAnimationFrame(()=>{this.layoutFrame===frame&&(this.layoutFrame=null,!(!this.isConnected||this.ownerDocument.defaultView!==owner)&&(this.syncAutoScrollMode(),this.recomputeHiddenPriorityColumns(),this.applyStickyOffsets(),this.syncResizeHandleValues()))}),this.layoutFrame=frame},this.cachedCanonicalRowEntries=null,this.canonicalRowEntriesInputs=null,this.cachedMatchingEntries=null,this.matchingEntriesInputs=null,this.cachedSortedEntries=null,this.sortedEntriesInputs=null,this.onFilterInput=event=>{event.stopPropagation();const input=event.currentTarget;this.filterText=input.value,this.emit("lr-filter-change",Object.freeze({text:this.filterText}))},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onNativeFocus=event=>{event.stopPropagation(),this.emit("focus")},this.onNativeBlur=event=>{event.stopPropagation(),this.emit("blur")},this.onPaginationChange=event=>{event.stopPropagation();const{page}=event.detail;this.paginationMode==="client"&&(this.page=page),this.emit("lr-page-change",Object.freeze({page}))},this.onTableFocusIn=event=>{const target=event.target,cell=target?.closest?.("td[data-col-key]"),row=target?.closest?.("[data-row-key]"),columnKey=cell?.dataset.colKey,rowKey=row?.dataset.rowKey;this.focusedEditorCell=target?.getAttribute("part")==="cell-editor"&&columnKey!==void 0&&rowKey!==void 0&&normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="always"?{rowKey,columnKey}:null},this.onEditorKeyDown=(event,rowKey,columnKey)=>{event.stopPropagation();const alwaysOn=normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="always";event.key==="Enter"?(event.preventDefault(),this.commitEdit(event,rowKey,columnKey)):event.key==="Escape"&&!alwaysOn&&(event.preventDefault(),this.editingCell=null)},this.onTableDoubleClick=event=>{const target=event.target,table=event.currentTarget;if(eventInteractiveTarget(event,table))return;const cell=target.closest('[part="cell"][data-col-key]'),row=target.closest("[data-row-key]");cell&&row?.dataset.rowKey&&cell.dataset.colKey&&this.startEditing(row.dataset.rowKey,cell.dataset.colKey)},this.toggleColumns=()=>{this.priorityColumnsVisible=!this.priorityColumnsVisible,this.emit("lr-priority-columns-visibility-change",Object.freeze({visible:this.priorityColumnsVisible}))},this.onTableClick=e=>{const target=e.target,table=e.currentTarget;if(eventInteractiveTarget(e,table))return;const th=target.closest("th[data-col-key]");if(th)return this.activateColumn(th.dataset.colKey);const tr=target.closest("[data-row-key]");tr&&this.activateRow(tr.dataset.rowKey)},this.onTableKeyDown=e=>{const target=e.target,table=e.currentTarget;if(eventInteractiveTarget(e,table))return;const th=target.closest("th[data-col-key]");if(th)return this.onHeaderKeyDown(e,th);const tr=target.closest("[data-row-key]");tr&&this.onRowKeyDown(e,tr)}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,expand:LYRA_DEFAULT_expand,loadMore:LYRA_DEFAULT_loadMore,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noColumns:LYRA_DEFAULT_noColumns,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,resizeColumn:LYRA_DEFAULT_resizeColumn,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,showAllColumns:LYRA_DEFAULT_showAllColumns,showFewerColumns:LYRA_DEFAULT_showFewerColumns,tableEditCell:LYRA_DEFAULT_tableEditCell,tableFilterLabel:LYRA_DEFAULT_tableFilterLabel,tableFilterPlaceholder:LYRA_DEFAULT_tableFilterPlaceholder,tableLoading:LYRA_DEFAULT_tableLoading}}static{this.styles=[LyraElement.styles,styles,srOnly]}get columns(){return this._columns}set columns(value){const previous=this._columns,columns=[],seen=new Set;let length=0;try{if(Array.isArray(value)){const descriptor=Object.getOwnPropertyDescriptor(value,"length"),sourceLength=descriptor&&"value"in descriptor?descriptor.value:0;typeof sourceLength=="number"&&Number.isSafeInteger(sourceLength)&&sourceLength>=0&&(length=Math.min(sourceLength,MAX_TABLE_COLLECTION_ENTRIES))}}catch{length=0}for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}if(!descriptor||!("value"in descriptor))continue;const column=descriptor.value;try{const key=column?.key;if(typeof key!="string"||key.trim().length===0||seen.has(key))continue;seen.add(key),columns.push(column)}catch{}}this._columns=frozenArray(columns),this.requestUpdate("columns",previous)}get rows(){return this._rows}set rows(value){const previous=this._rows;this._rows=frozenArray(Array.isArray(value)?value:[]),this.requestUpdate("rows",previous)}get layout(){return this._layout}set layout(next){const normalized=TABLE_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}get selectedRowKeys(){return readonlyKeySet(this._selectedKeys)}set selectedRowKeys(value){const previous=this._selectedKeys;this._selectedKeys=keySet(value??[]),this.requestUpdate("selectedRowKeys",previous)}get expandedRowKeys(){return readonlyKeySet(this._expandedKeys)}set expandedRowKeys(value){const previous=this._expandedKeys;this._expandedKeys=keySet(value??[]),this.requestUpdate("expandedRowKeys",previous)}get storageFullKey(){return this.storageKey?`lr-table:${this.storageKey}`:void 0}parsePixelLength(value){if(!value)return;const trimmed=value.trim();if(!trimmed.endsWith("px"))return;const parsed=Number.parseFloat(trimmed);return Number.isFinite(parsed)?parsed:void 0}minimumResizeWidth(column){const explicit=this.parsePixelLength(column.minWidth);if(explicit!==void 0)return Math.max(0,explicit);const hostStyle=this.ownerDocument.defaultView?.getComputedStyle(this),themed=hostStyle?.getPropertyValue("--lr-table-resize-min-width").trim()||hostStyle?.getPropertyValue("--_lr-table-resize-min-width-default").trim()||"",resolved=resolveCssLength(themed,{host:this});return resolved===void 0?DEFAULT_RESIZE_MIN_WIDTH_PX:Math.max(0,resolved)}maximumResizeWidth(column,minWidth){const explicit=this.parsePixelLength(column.maxWidth);return explicit===void 0?Number.POSITIVE_INFINITY:Math.max(minWidth,explicit)}currentResizeWidth(column,handle){const resized=this.resizedColumnWidths.get(column.key);if(resized!==void 0)return resized;const explicit=this.parsePixelLength(column.width);if(explicit!==void 0)return explicit;const rendered=handle?.closest("th[data-col-key]")?.getBoundingClientRect().width;return rendered&&rendered>0?rendered:this.minimumResizeWidth(column)}resizeValueText(width){return this.localize("resizeValuePixels",void 0,{value:getNumberFormat(this.effectiveLocale).format(Math.round(width))})}resizeColumnTo(column,requestedWidth){const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),width=Math.min(maxWidth,Math.max(minWidth,requestedWidth)),previousWidth=this.resizedColumnWidths.get(column.key);if(previousWidth===width||(this.resizedColumnWidths=new Map(this.resizedColumnWidths).set(column.key,width),!this.emit("lr-column-resize",Object.freeze({columnKey:column.key,width}),{cancelable:!0}).defaultPrevented))return;const reverted=new Map(this.resizedColumnWidths);previousWidth===void 0?reverted.delete(column.key):reverted.set(column.key,previousWidth),this.resizedColumnWidths=reverted}renderedColumnWidth(column){const resized=this.resizedColumnWidths.get(column.key);return resized===void 0?sanitizeCssLength(column.width,"height"):`${resized}px`}renderResizeHandle(column){if(!column.resizable)return nothing;const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),width=this.currentResizeWidth(column);return html`<span
|
|
1
|
+
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isRtl}from"../../../internal/rtl.js";import{srOnly,nextId}from"../../../internal/a11y.js";import{finiteCount,finiteInteger,finiteRatio}from"../../../internal/numbers.js";import{resolveCssLength}from"../../../internal/css-length.js";import{getCollator,getNumberFormat}from"../../../internal/intl-cache.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{styles}from"./table.styles.js";import{chevronIcon,sortIcon}from"../../../internal/icons.js";import{minMax}from"../heatmap/heatmap-scale.js";import"../../overlays/empty/empty.class.js";import{literalSetConverter,trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{activeElementIn}from"../../../internal/active-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_expand,LYRA_DEFAULT_loadMore,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noColumns,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_resizeColumn,LYRA_DEFAULT_resizeValuePixels,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_showAllColumns,LYRA_DEFAULT_showFewerColumns,LYRA_DEFAULT_tableEditCell,LYRA_DEFAULT_tableFilterLabel,LYRA_DEFAULT_tableFilterPlaceholder,LYRA_DEFAULT_tableLoading}from"../../../internal/default-strings.generated.js";const DEFAULT_SKELETON_ROWS=3,MAX_SKELETON_ROWS=20,DEFAULT_PAGE_SIZE=100,MAX_PAGE_SIZE=500,LOW_PRIORITY_MAX_INLINE_SIZE=899.98,MEDIUM_PRIORITY_MAX_INLINE_SIZE=639.98,MAX_TABLE_COLLECTION_ENTRIES=1e4,TABLE_SCROLL_OVERFLOW_TOLERANCE_PX=1,DEFAULT_RESIZE_MIN_WIDTH_PX=48,UNBOUNDED_RESIZE_ARIA_MAX=Number.MAX_SAFE_INTEGER,MISSING_CELL_RENDERER_WARNING="lyra-table-missing-cell-renderer",MISSING_ACCESSIBLE_NAME_WARNING="lyra-table-missing-accessible-name";function frozenArray(values){const snapshot=[];try{for(const value of values)if(snapshot.push(value),snapshot.length>=MAX_TABLE_COLLECTION_ENTRIES)break}catch{}return Object.freeze(snapshot)}function keySet(values){const snapshot=new Set;try{for(const value of values){if(typeof value=="string"){if(value.trim().length===0)continue}else if(typeof value!="number")continue;if(snapshot.add(value),snapshot.size>=MAX_TABLE_COLLECTION_ENTRIES)break}}catch{}return snapshot}function readonlyKeySet(values){const snapshot=keySet(values);let facade;return facade={get size(){return snapshot.size},has:value=>snapshot.has(value),entries:()=>snapshot.entries(),keys:()=>snapshot.keys(),values:()=>snapshot.values(),[Symbol.iterator]:()=>snapshot[Symbol.iterator](),forEach(callback,thisArg){snapshot.forEach(value=>callback.call(thisArg,value,value,facade))}},Object.freeze(facade)}const UNSAFE_CSS_STRUCTURE=/[;{}]/,URL_FUNCTION=/url\s*\(/i,SAFE_STYLE_PROPERTY=/^-?[_a-zA-Z][\w-]*$|^--[a-zA-Z0-9_-]+$/,optionalBooleanConverter={fromAttribute(value){if(value!==null)return value!=="false"},toAttribute(value){return value===void 0?null:value?"":"false"}},TABLE_LAYOUT=literalSetConverter(["auto","fixed"],"auto"),INTERACTIVE_SELECTOR='button, a[href], input, select, textarea, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"]), [role="button"], [role="checkbox"], [role="combobox"], [role="listbox"], [role="menu"], [role="menuitem"], [role="option"], [role="radio"], [role="separator"], [role="slider"], [role="spinbutton"], [role="switch"], [role="tab"], [role="textbox"]';function stickyDirection(sticky){if(sticky==="start"||sticky==="end")return sticky}function sanitizeCellStyle(cellStyle){if(cellStyle===void 0)return{};const safe={};for(const[rawProperty,rawValue]of Object.entries(cellStyle)){const property2=sanitizeCellStyleProperty(rawProperty),value=sanitizeCellStyleValue(rawValue);if(property2===void 0||value===void 0)continue;const normalizedProperty=normalizeStyleProperty(property2);(normalizedProperty.startsWith("--")||cssSupports(normalizedProperty,value))&&(safe[normalizedProperty]=value)}return safe}function sanitizeCellStyleProperty(property2){const normalized=property2.trim();if(!(!normalized||!SAFE_STYLE_PROPERTY.test(normalized)))return normalized}function normalizeStyleProperty(property2){return property2.startsWith("--")?property2:property2.replace(/[A-Z]/g,"-$&").toLowerCase()}function sanitizeCellStyleValue(value){if(typeof value!="string")return;const normalized=value.trim();if(!(!normalized||UNSAFE_CSS_STRUCTURE.test(normalized)||URL_FUNCTION.test(normalized)))return normalized}function cssSupports(property2,value){return typeof CSS>"u"||typeof CSS.supports!="function"?!0:CSS.supports(property2,value)}function normalizedEditTrigger(editTrigger){if(editTrigger==="always"||editTrigger==="double-click")return editTrigger}function encodeKey(key){return`${typeof key}:${key}`}function safeStringifyForFilter(row){const seen=new WeakSet;try{return JSON.stringify(row,(_key,value)=>{if(typeof value=="bigint")return value.toString();if(typeof value=="object"&&value!==null){if(seen.has(value))return"[Circular]";seen.add(value)}return value})??""}catch{return""}}function asElement(value){return typeof value!="object"||!("nodeType"in value)||value.nodeType!==1||!("matches"in value)?null:value}function eventInteractiveTarget(event,boundary){for(const value of event.composedPath()){if(value===boundary)break;const element=asElement(value);if(element!==null&&(element.matches("[data-table-interactive]")||element.matches(INTERACTIVE_SELECTOR)&&!element.matches("[data-row-key], th[data-col-key]")))return element}return null}class LyraTable extends LyraElement{constructor(){super(...arguments),this._columns=Object.freeze([]),this._rows=Object.freeze([]),this._layout="auto",this.sortKey="",this.sortDir="asc",this.sortIndicators="active",this.sortMode="client",this.defaultSortDir="asc",this.caption="",this.captionId=nextId("lr-table-caption"),this.selectionMode="none",this.scrollMode="self",this._selectedKeys=new Set,this.filterable=!1,this.filterText="",this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.loading=!1,this.loadingAppearance="spinner",this.skeletonRows=0,this.pageSize=DEFAULT_PAGE_SIZE,this.page=1,this.totalItems=-1,this.paginationMode="client",this._expandedKeys=new Set,this.hasMore=!1,this.emptyDescription="",this.noColumnsDescription="",this.hasHiddenPriorityColumns=!1,this.priorityColumnsToggleAvailable=!1,this.priorityColumnsVisible=!1,this.persistReady=!1,this.loadingAnnouncementsReady=!1,this.activeColKey=null,this.activeRowKey=null,this.editingCell=null,this.focusedEditorCell=null,this.editorHadFocusBeforeUpdate=!1,this.rovingFocusSnapshot=null,this.resizedColumnWidths=new Map,this.rowsByKey=new Map,this.columnsByKey=new Map,this.layoutFrame=null,this.observedHeaders=new Set,this.onResizePointerDown=event=>{const handle=event.currentTarget,key=handle.dataset.colKey,column=key?this.columnsByKey.get(key):void 0,header=handle.closest("th[data-col-key]"),resizeEventWindow=this.ownerDocument.defaultView;if(!key||!column||!header||!resizeEventWindow)return;const replacedStartWidth=this.resizeState?.key===key?this.resizeState.startWidth:void 0;this.cancelResizeGesture();const minWidth=this.minimumResizeWidth(column);this.resizeState={key,pointerId:event.pointerId,startX:event.clientX,startWidth:replacedStartWidth??header.getBoundingClientRect().width,minWidth,maxWidth:this.maximumResizeWidth(column,minWidth),handle,previousWidth:this.resizedColumnWidths.get(key)},handle.toggleAttribute("data-resizing",!0),event.preventDefault(),event.stopPropagation(),handle.setPointerCapture?.(event.pointerId),this.resizeEventWindow=resizeEventWindow,resizeEventWindow.addEventListener("pointermove",this.onResizePointerMove),resizeEventWindow.addEventListener("pointerup",this.onResizePointerEnd),resizeEventWindow.addEventListener("pointercancel",this.onResizePointerEnd),resizeEventWindow.addEventListener("lostpointercapture",this.onResizePointerEnd)},this.onResizePointerMove=event=>{const state2=this.resizeState;if(!state2||event.pointerId!==state2.pointerId)return;const delta=isRtl(this)?state2.startX-event.clientX:event.clientX-state2.startX,width=Math.min(state2.maxWidth,Math.max(state2.minWidth,state2.startWidth+delta));this.resizedColumnWidths.get(state2.key)!==width&&(this.resizedColumnWidths=new Map(this.resizedColumnWidths).set(state2.key,width),this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width})))},this.onResizeKeyDown=event=>{const handle=event.currentTarget,key=handle.dataset.colKey,column=key?this.columnsByKey.get(key):void 0;if(!column)return;const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),currentWidth=this.currentResizeWidth(column,handle),step=event.shiftKey?50:10;let requestedWidth;event.key==="Home"?requestedWidth=minWidth:event.key==="End"&&Number.isFinite(maxWidth)?requestedWidth=maxWidth:event.key==="ArrowLeft"?requestedWidth=currentWidth+(isRtl(this)?step:-step):event.key==="ArrowRight"&&(requestedWidth=currentWidth+(isRtl(this)?-step:step)),requestedWidth!==void 0&&(event.preventDefault(),event.stopPropagation(),this.resizeColumnTo(column,requestedWidth))},this.onResizePointerEnd=event=>{const state2=this.resizeState;if(!state2||event.pointerId!==state2.pointerId)return;if(state2.handle.removeAttribute("data-resizing"),event.type==="pointerup")try{state2.handle.releasePointerCapture?.(event.pointerId)}catch{}if(this.resizeState=void 0,this.detachResizePointerListeners(),event.type!=="pointerup"){const reverted2=new Map(this.resizedColumnWidths);state2.previousWidth===void 0?reverted2.delete(state2.key):reverted2.set(state2.key,state2.previousWidth),this.resizedColumnWidths=reverted2;return}const committedWidth=this.resizedColumnWidths.get(state2.key);if(committedWidth===void 0||committedWidth===state2.previousWidth||!this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width:committedWidth}),{cancelable:!0}).defaultPrevented)return;const reverted=new Map(this.resizedColumnWidths);state2.previousWidth===void 0?reverted.delete(state2.key):reverted.set(state2.key,state2.previousWidth),this.resizedColumnWidths=reverted},this.scheduleLayoutSync=()=>{if(this.layoutFrame)return;const owner=this.ownerDocument.defaultView;if(!owner)return;const frame={owner,handle:0};frame.handle=owner.requestAnimationFrame(()=>{this.layoutFrame===frame&&(this.layoutFrame=null,!(!this.isConnected||this.ownerDocument.defaultView!==owner)&&(this.syncAutoScrollMode(),this.recomputeHiddenPriorityColumns(),this.applyStickyOffsets(),this.syncResizeHandleValues()))}),this.layoutFrame=frame},this.cachedCanonicalRowEntries=null,this.canonicalRowEntriesInputs=null,this.cachedMatchingEntries=null,this.matchingEntriesInputs=null,this.cachedSortedEntries=null,this.sortedEntriesInputs=null,this.onFilterInput=event=>{event.stopPropagation();const input=event.currentTarget;this.filterText=input.value,this.emit("lr-filter-change",Object.freeze({text:this.filterText}))},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onNativeFocus=event=>{event.stopPropagation(),this.emit("focus")},this.onNativeBlur=event=>{event.stopPropagation(),this.emit("blur")},this.onPaginationChange=event=>{event.stopPropagation();const{page}=event.detail;this.paginationMode==="client"&&(this.page=page),this.emit("lr-page-change",Object.freeze({page}))},this.onTableFocusIn=event=>{const target=event.target,cell=target?.closest?.("td[data-col-key]"),row=target?.closest?.("[data-row-key]"),columnKey=cell?.dataset.colKey,rowKey=row?.dataset.rowKey;this.focusedEditorCell=target?.getAttribute("part")==="cell-editor"&&columnKey!==void 0&&rowKey!==void 0&&normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="always"?{rowKey,columnKey}:null},this.onEditorKeyDown=(event,rowKey,columnKey)=>{event.stopPropagation();const alwaysOn=normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="always";event.key==="Enter"?(event.preventDefault(),this.commitEdit(event,rowKey,columnKey)):event.key==="Escape"&&!alwaysOn&&(event.preventDefault(),this.editingCell=null)},this.onTableDoubleClick=event=>{const target=event.target,table=event.currentTarget;if(eventInteractiveTarget(event,table))return;const cell=target.closest('[part="cell"][data-col-key]'),row=target.closest("[data-row-key]");cell&&row?.dataset.rowKey&&cell.dataset.colKey&&this.startEditing(row.dataset.rowKey,cell.dataset.colKey)},this.toggleColumns=()=>{this.priorityColumnsVisible=!this.priorityColumnsVisible,this.emit("lr-priority-columns-visibility-change",Object.freeze({visible:this.priorityColumnsVisible}))},this.onTableClick=e=>{const target=e.target,table=e.currentTarget;if(eventInteractiveTarget(e,table))return;const th=target.closest("th[data-col-key]");if(th)return this.activateColumn(th.dataset.colKey);const tr=target.closest("[data-row-key]");tr&&this.activateRow(tr.dataset.rowKey)},this.onTableKeyDown=e=>{const target=e.target,table=e.currentTarget;if(eventInteractiveTarget(e,table))return;const th=target.closest("th[data-col-key]");if(th)return this.onHeaderKeyDown(e,th);const tr=target.closest("[data-row-key]");tr&&this.onRowKeyDown(e,tr)}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,expand:LYRA_DEFAULT_expand,loadMore:LYRA_DEFAULT_loadMore,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noColumns:LYRA_DEFAULT_noColumns,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,resizeColumn:LYRA_DEFAULT_resizeColumn,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,showAllColumns:LYRA_DEFAULT_showAllColumns,showFewerColumns:LYRA_DEFAULT_showFewerColumns,tableEditCell:LYRA_DEFAULT_tableEditCell,tableFilterLabel:LYRA_DEFAULT_tableFilterLabel,tableFilterPlaceholder:LYRA_DEFAULT_tableFilterPlaceholder,tableLoading:LYRA_DEFAULT_tableLoading}}static{this.styles=[LyraElement.styles,styles,srOnly]}get columns(){return this._columns}set columns(value){const previous=this._columns,columns=[],seen=new Set;let length=0;try{if(Array.isArray(value)){const descriptor=Object.getOwnPropertyDescriptor(value,"length"),sourceLength=descriptor&&"value"in descriptor?descriptor.value:0;typeof sourceLength=="number"&&Number.isSafeInteger(sourceLength)&&sourceLength>=0&&(length=Math.min(sourceLength,MAX_TABLE_COLLECTION_ENTRIES))}}catch{length=0}for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}if(!descriptor||!("value"in descriptor))continue;const column=descriptor.value;try{const key=column?.key;if(typeof key!="string"||key.trim().length===0||seen.has(key))continue;seen.add(key),columns.push(column)}catch{}}this._columns=frozenArray(columns),this.requestUpdate("columns",previous)}get rows(){return this._rows}set rows(value){const previous=this._rows;this._rows=frozenArray(Array.isArray(value)?value:[]),this.requestUpdate("rows",previous)}get layout(){return this._layout}set layout(next){const normalized=TABLE_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}get selectedRowKeys(){return readonlyKeySet(this._selectedKeys)}set selectedRowKeys(value){const previous=this._selectedKeys;this._selectedKeys=keySet(value??[]),this.requestUpdate("selectedRowKeys",previous)}get expandedRowKeys(){return readonlyKeySet(this._expandedKeys)}set expandedRowKeys(value){const previous=this._expandedKeys;this._expandedKeys=keySet(value??[]),this.requestUpdate("expandedRowKeys",previous)}get storageFullKey(){return this.storageKey?`lr-table:${this.storageKey}`:void 0}parsePixelLength(value){if(!value)return;const trimmed=value.trim();if(!trimmed.endsWith("px"))return;const parsed=Number.parseFloat(trimmed);return Number.isFinite(parsed)?parsed:void 0}minimumResizeWidth(column){const explicit=this.parsePixelLength(column.minWidth);if(explicit!==void 0)return Math.max(0,explicit);const hostStyle=this.ownerDocument.defaultView?.getComputedStyle(this),themed=hostStyle?.getPropertyValue("--lr-table-resize-min-width").trim()||hostStyle?.getPropertyValue("--_lr-table-resize-min-width-default").trim()||"",resolved=resolveCssLength(themed,{host:this});return resolved===void 0?DEFAULT_RESIZE_MIN_WIDTH_PX:Math.max(0,resolved)}maximumResizeWidth(column,minWidth){const explicit=this.parsePixelLength(column.maxWidth);return explicit===void 0?Number.POSITIVE_INFINITY:Math.max(minWidth,explicit)}currentResizeWidth(column,handle){const resized=this.resizedColumnWidths.get(column.key);if(resized!==void 0)return resized;const explicit=this.parsePixelLength(column.width);if(explicit!==void 0)return explicit;const rendered=handle?.closest("th[data-col-key]")?.getBoundingClientRect().width;return rendered&&rendered>0?rendered:this.minimumResizeWidth(column)}resizeValueText(width){return this.localize("resizeValuePixels",void 0,{value:getNumberFormat(this.effectiveLocale).format(Math.round(width))})}resizeColumnTo(column,requestedWidth){const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),width=Math.min(maxWidth,Math.max(minWidth,requestedWidth)),previousWidth=this.resizedColumnWidths.get(column.key);if(previousWidth===width||(this.resizedColumnWidths=new Map(this.resizedColumnWidths).set(column.key,width),!this.emit("lr-column-resize",Object.freeze({columnKey:column.key,width}),{cancelable:!0}).defaultPrevented))return;const reverted=new Map(this.resizedColumnWidths);previousWidth===void 0?reverted.delete(column.key):reverted.set(column.key,previousWidth),this.resizedColumnWidths=reverted}renderedColumnWidth(column){const resized=this.resizedColumnWidths.get(column.key);return resized===void 0?sanitizeCssLength(column.width,"height"):`${resized}px`}renderResizeHandle(column){if(!column.resizable)return nothing;const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),width=this.currentResizeWidth(column);return html`<span
|
|
2
2
|
part="resize-handle"
|
|
3
3
|
data-col-key=${column.key}
|
|
4
4
|
role="separator"
|
|
@@ -116,7 +116,8 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
116
116
|
tabindex=${col.key===focusedCol?"0":"-1"}
|
|
117
117
|
>
|
|
118
118
|
${typeof col.headerCell=="function"?col.headerCell(col):col.label} ${this.renderResizeHandle(col)}
|
|
119
|
-
${active?html`<span part
|
|
119
|
+
${active||col.sortable&&this.sortIndicators==="all"?html`<span part=${active?"sort-icon sort-icon-active":"sort-icon sort-icon-inactive"}
|
|
120
|
+
data-dir=${active?this.sortDir:nothing} aria-hidden="true">${active?chevronIcon():sortIcon()}</span>`:nothing}
|
|
120
121
|
</th>`})}
|
|
121
122
|
${hasRowTotal?html`<th part="header-cell" data-row-total aria-hidden="true"></th>`:nothing}
|
|
122
123
|
</tr>
|
|
@@ -218,4 +219,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
218
219
|
@lr-page-change=${this.onPaginationChange}
|
|
219
220
|
></lr-pagination>`:nothing}
|
|
220
221
|
</div>
|
|
221
|
-
`}}__decorate([property({attribute:!1})],LyraTable.prototype,"columns",null),__decorate([property({attribute:!1})],LyraTable.prototype,"rows",null),__decorate([property({reflect:!0,converter:TABLE_LAYOUT})],LyraTable.prototype,"layout",null),__decorate([property({attribute:"sort-key"})],LyraTable.prototype,"sortKey",void 0),__decorate([property({attribute:"sort-dir"})],LyraTable.prototype,"sortDir",void 0),__decorate([property({reflect:!0,attribute:"sort-mode"})],LyraTable.prototype,"sortMode",void 0),__decorate([property({attribute:"default-sort-dir"})],LyraTable.prototype,"defaultSortDir",void 0),__decorate([property({attribute:"accessible-label"})],LyraTable.prototype,"accessibleLabel",void 0),__decorate([property()],LyraTable.prototype,"caption",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"rowKey",void 0),__decorate([property({reflect:!0,attribute:"selection-mode"})],LyraTable.prototype,"selectionMode",void 0),__decorate([property({reflect:!0,attribute:"scroll-mode"})],LyraTable.prototype,"scrollMode",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"selectedRowKeys",null),__decorate([property({type:Boolean,reflect:!0})],LyraTable.prototype,"filterable",void 0),__decorate([property({attribute:"filter-text"})],LyraTable.prototype,"filterText",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"filter",void 0),__decorate([property({attribute:"filter-label"})],LyraTable.prototype,"filterLabel",void 0),__decorate([property({attribute:"filter-placeholder"})],LyraTable.prototype,"filterPlaceholder",void 0),__decorate([property({converter:spellcheckConverter})],LyraTable.prototype,"spellcheck",void 0),__decorate([property()],LyraTable.prototype,"autocapitalize",void 0),__decorate([property({attribute:"autocorrect"})],LyraTable.prototype,"autoCorrect",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTable.prototype,"loading",void 0),__decorate([property({attribute:"loading-label"})],LyraTable.prototype,"loadingLabel",void 0),__decorate([property({reflect:!0,attribute:"loading-appearance"})],LyraTable.prototype,"loadingAppearance",void 0),__decorate([property({type:Number,attribute:"skeleton-rows"})],LyraTable.prototype,"skeletonRows",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"groupBy",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"groupLabel",void 0),__decorate([property({type:Number,attribute:"page-size"})],LyraTable.prototype,"pageSize",void 0),__decorate([property({type:Number,reflect:!0})],LyraTable.prototype,"page",void 0),__decorate([property({type:Number,attribute:"total-items"})],LyraTable.prototype,"totalItems",void 0),__decorate([property({reflect:!0,attribute:"pagination-mode"})],LyraTable.prototype,"paginationMode",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"expandedContent",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"canExpand",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"expandedRowKeys",null),__decorate([property({attribute:!1})],LyraTable.prototype,"heatTintScale",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"rowTotal",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"grandTotal",void 0),__decorate([property({type:Boolean,attribute:"has-more",reflect:!0})],LyraTable.prototype,"hasMore",void 0),__decorate([property({attribute:"more-label"})],LyraTable.prototype,"moreLabel",void 0),__decorate([property({attribute:"empty-heading"})],LyraTable.prototype,"emptyHeading",void 0),__decorate([property({attribute:"empty-description"})],LyraTable.prototype,"emptyDescription",void 0),__decorate([property({attribute:"empty-compact",converter:optionalBooleanConverter})],LyraTable.prototype,"emptyCompact",void 0),__decorate([property({attribute:"no-columns-heading"})],LyraTable.prototype,"noColumnsHeading",void 0),__decorate([property({attribute:"no-columns-description"})],LyraTable.prototype,"noColumnsDescription",void 0),__decorate([property({attribute:"reveal-columns-label"})],LyraTable.prototype,"revealColumnsLabel",void 0),__decorate([property({attribute:"hide-columns-label"})],LyraTable.prototype,"hideColumnsLabel",void 0),__decorate([property({type:Boolean,attribute:"has-hidden-priority-columns",reflect:!0})],LyraTable.prototype,"hasHiddenPriorityColumns",void 0),__decorate([state()],LyraTable.prototype,"priorityColumnsToggleAvailable",void 0),__decorate([property({type:Boolean,attribute:"priority-columns-visible",reflect:!0})],LyraTable.prototype,"priorityColumnsVisible",void 0),__decorate([property({attribute:"storage-key"})],LyraTable.prototype,"storageKey",void 0),__decorate([state()],LyraTable.prototype,"activeColKey",void 0),__decorate([state()],LyraTable.prototype,"activeRowKey",void 0),__decorate([state()],LyraTable.prototype,"editingCell",void 0),__decorate([state()],LyraTable.prototype,"resizedColumnWidths",void 0);export{LyraTable};
|
|
222
|
+
`}}__decorate([property({attribute:!1})],LyraTable.prototype,"columns",null),__decorate([property({attribute:!1})],LyraTable.prototype,"rows",null),__decorate([property({reflect:!0,converter:TABLE_LAYOUT})],LyraTable.prototype,"layout",null),__decorate([property({attribute:"sort-key"})],LyraTable.prototype,"sortKey",void 0),__decorate([property({attribute:"sort-dir"})],LyraTable.prototype,"sortDir",void 0),__decorate([property({attribute:"sort-indicators",converter:literalSetConverter(["active","all"],"active")})],LyraTable.prototype,"sortIndicators",void 0),__decorate([property({reflect:!0,attribute:"sort-mode"})],LyraTable.prototype,"sortMode",void 0),__decorate([property({attribute:"default-sort-dir"})],LyraTable.prototype,"defaultSortDir",void 0),__decorate([property({attribute:"accessible-label"})],LyraTable.prototype,"accessibleLabel",void 0),__decorate([property()],LyraTable.prototype,"caption",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"rowKey",void 0),__decorate([property({reflect:!0,attribute:"selection-mode"})],LyraTable.prototype,"selectionMode",void 0),__decorate([property({reflect:!0,attribute:"scroll-mode"})],LyraTable.prototype,"scrollMode",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"selectedRowKeys",null),__decorate([property({type:Boolean,reflect:!0})],LyraTable.prototype,"filterable",void 0),__decorate([property({attribute:"filter-text"})],LyraTable.prototype,"filterText",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"filter",void 0),__decorate([property({attribute:"filter-label"})],LyraTable.prototype,"filterLabel",void 0),__decorate([property({attribute:"filter-placeholder"})],LyraTable.prototype,"filterPlaceholder",void 0),__decorate([property({converter:spellcheckConverter})],LyraTable.prototype,"spellcheck",void 0),__decorate([property()],LyraTable.prototype,"autocapitalize",void 0),__decorate([property({attribute:"autocorrect"})],LyraTable.prototype,"autoCorrect",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTable.prototype,"loading",void 0),__decorate([property({attribute:"loading-label"})],LyraTable.prototype,"loadingLabel",void 0),__decorate([property({reflect:!0,attribute:"loading-appearance"})],LyraTable.prototype,"loadingAppearance",void 0),__decorate([property({type:Number,attribute:"skeleton-rows"})],LyraTable.prototype,"skeletonRows",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"groupBy",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"groupLabel",void 0),__decorate([property({type:Number,attribute:"page-size"})],LyraTable.prototype,"pageSize",void 0),__decorate([property({type:Number,reflect:!0})],LyraTable.prototype,"page",void 0),__decorate([property({type:Number,attribute:"total-items"})],LyraTable.prototype,"totalItems",void 0),__decorate([property({reflect:!0,attribute:"pagination-mode"})],LyraTable.prototype,"paginationMode",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"expandedContent",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"canExpand",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"expandedRowKeys",null),__decorate([property({attribute:!1})],LyraTable.prototype,"heatTintScale",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"rowTotal",void 0),__decorate([property({attribute:!1})],LyraTable.prototype,"grandTotal",void 0),__decorate([property({type:Boolean,attribute:"has-more",reflect:!0})],LyraTable.prototype,"hasMore",void 0),__decorate([property({attribute:"more-label"})],LyraTable.prototype,"moreLabel",void 0),__decorate([property({attribute:"empty-heading"})],LyraTable.prototype,"emptyHeading",void 0),__decorate([property({attribute:"empty-description"})],LyraTable.prototype,"emptyDescription",void 0),__decorate([property({attribute:"empty-compact",converter:optionalBooleanConverter})],LyraTable.prototype,"emptyCompact",void 0),__decorate([property({attribute:"no-columns-heading"})],LyraTable.prototype,"noColumnsHeading",void 0),__decorate([property({attribute:"no-columns-description"})],LyraTable.prototype,"noColumnsDescription",void 0),__decorate([property({attribute:"reveal-columns-label"})],LyraTable.prototype,"revealColumnsLabel",void 0),__decorate([property({attribute:"hide-columns-label"})],LyraTable.prototype,"hideColumnsLabel",void 0),__decorate([property({type:Boolean,attribute:"has-hidden-priority-columns",reflect:!0})],LyraTable.prototype,"hasHiddenPriorityColumns",void 0),__decorate([state()],LyraTable.prototype,"priorityColumnsToggleAvailable",void 0),__decorate([property({type:Boolean,attribute:"priority-columns-visible",reflect:!0})],LyraTable.prototype,"priorityColumnsVisible",void 0),__decorate([property({attribute:"storage-key"})],LyraTable.prototype,"storageKey",void 0),__decorate([state()],LyraTable.prototype,"activeColKey",void 0),__decorate([state()],LyraTable.prototype,"activeRowKey",void 0),__decorate([state()],LyraTable.prototype,"editingCell",void 0),__decorate([state()],LyraTable.prototype,"resizedColumnWidths",void 0);export{LyraTable};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from"lit";const styles=css`:host{--_lr-table-heat-tint-lo-default:var(--lr-color-brand-quiet);--_lr-table-heat-tint-hi-default:var(--lr-color-brand);--_lr-table-resize-min-width-default:var(--lr-size-3rem);--_lr-table-resize-handle-opacity-default:.12;inline-size:100%;display:block}[part=base]{max-block-size:var(--lr-table-max-height,none);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);contain-intrinsic-inline-size:var(--lr-size-20rem);overflow:auto;container-type:inline-size}:host([scroll-mode=page]) [part=base],:host([scroll-mode=auto]) [part=base]:not([data-scroll-overflow]){max-block-size:none;overflow:visible}[part=filter-label]{align-items:center;gap:var(--lr-space-s);padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-md-sm);display:flex}[part=filter]{min-inline-size:0;padding:var(--lr-space-xs) var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius-xs);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit;flex:1}[part=filter]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}:where([part=filter]):hover{background:var(--lr-color-brand-quiet)}:where([part=filter]):active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=filter]::placeholder{color:var(--lr-color-text-quiet);opacity:1}[part=filter][type=search]::-webkit-search-cancel-button,[part=filter][type=search]::-webkit-search-decoration{appearance:none}[part=loading]:not(.sr-only){min-block-size:var(--lr-size-8rem);padding:var(--lr-space-l);place-items:center;display:grid}[part=pagination]{border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border);display:block}@container (inline-size<=899.98px){[part=base]:not([data-force-visible]) [data-priority=low]{display:none}}@container (inline-size<=639.98px){[part=base]:not([data-force-visible]) [data-priority=medium]{display:none}}[part=table]{border-collapse:collapse;inline-size:100%;font:inherit}[part=table][data-layout=fixed]{table-layout:fixed}[part=header-cell]{background:var(--lr-color-surface);text-align:start;font-weight:var(--lr-font-weight-semibold);padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);cursor:default;white-space:nowrap;position:sticky;inset-block-start:0}[part=header-cell][data-resizable]{padding-inline-end:calc(var(--lr-space-s) + var(--lr-size-0-5rem))}[part=resize-handle]{inline-size:var(--lr-size-0-5rem);min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);cursor:col-resize;touch-action:none;position:absolute;inset-block:0;inset-inline-end:0}[part=resize-handle]:hover,[part=resize-handle]:focus-visible{background:var(--lr-table-resize-handle-hover-bg,var(--lr-color-brand));opacity:var(--lr-table-resize-handle-hover-opacity,var(--lr-table-resize-handle-opacity,var(--_lr-table-resize-handle-opacity-default)))}[part=resize-handle]:active,[part=resize-handle][data-resizing]{background:var(--lr-table-resize-handle-active-bg,var(--lr-table-resize-handle-hover-bg,var(--lr-color-brand)));opacity:var(--lr-table-resize-handle-active-opacity,calc(var(--lr-table-resize-handle-hover-opacity,var(--lr-table-resize-handle-opacity,var(--_lr-table-resize-handle-opacity-default))) * 2))}[part=resize-handle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}:where([part=header-cell][aria-sort]:not([aria-sort=none])),:where([part=header-cell][data-sortable]){cursor:pointer}[part=header-cell]:where([aria-sort]:not([aria-sort=none])){background:var(--lr-table-header-sorted-bg,var(--lr-color-surface));color:var(--lr-table-header-sorted-color,inherit)}[part=header-cell][data-sortable]:hover{background:var(--lr-color-brand-quiet)}[part=header-cell][data-sortable]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=header-cell]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=header-cell][data-align=end]{text-align:end}[part=sort-icon]{vertical-align:middle;transition:transform var(--lr-transition-fast);margin-inline-start:var(--lr-space-xs);display:inline-block}[part=sort-icon] svg{display:block}[part=sort-icon][data-dir=asc]{transform:rotate(-90deg)}[part=sort-icon][data-dir=desc]{transform:rotate(90deg)}@media (prefers-reduced-motion:reduce){[part=sort-icon]{transition:none!important}}[part=row][data-stripe]{background:var(--lr-table-row-stripe-bg,transparent)}[part=row][aria-selected=true]{background:var(--lr-table-row-selected-bg,var(--lr-color-brand-quiet))}[part=row]:hover{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-hover))}[part=row]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}@media (forced-colors:active){:where([part~=row][aria-selected=true]){outline:var(--lr-border-width-medium) solid Highlight;outline-offset:calc(-1 * var(--lr-border-width-medium))}:where([part~=row]:hover:not([aria-selected=true])){outline:var(--lr-border-width-thin) dashed Highlight;outline-offset:calc(-1 * var(--lr-border-width-thin))}}[part=group-cell]{padding:var(--lr-space-xs) var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface-raised);color:var(--lr-color-text-quiet);font-weight:var(--lr-font-weight-semibold);text-align:start}[part=row]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=cell]{padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);color:var(--lr-table-cell-color,inherit)}[part=cell] a:where(:any-link){color:var(--lr-table-cell-link-color,var(--lr-color-brand))}[part=cell] a:where(:any-link):hover,[part=cell] a:where(:any-link):focus-visible,[part=cell] a:where(:any-link):active{color:var(--lr-table-cell-link-hover-color,var(--lr-table-cell-link-color,var(--lr-color-brand)));text-decoration-thickness:var(--lr-border-width-medium)}[part=cell-editor]{box-sizing:border-box;inline-size:100%;min-inline-size:0;padding:var(--lr-space-xs) var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-brand);border-radius:var(--lr-radius-xs);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit}[part=cell-editor]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}:where([part=cell-editor]):hover{background:var(--lr-color-brand-quiet)}:where([part=cell-editor]):active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=cell-editor][type=number]{appearance:textfield}[part=cell-editor][type=number]::-webkit-inner-spin-button,[part=cell-editor][type=number]::-webkit-outer-spin-button{appearance:none;margin:0}[part=cell][data-align=end]{text-align:end}[part=row-total-cell]{padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);font-weight:var(--lr-font-weight-semibold);text-align:end}[part=cell][data-heat]{background:color-mix(in srgb, var(--lr-table-heat-tint-hi,var(--_lr-table-heat-tint-hi-default)) var(--lr-table-heat-t), var(--lr-table-heat-tint-lo,var(--_lr-table-heat-tint-lo-default)))}[part=expand-toggle-cell]{padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);text-align:center}[part=row-expand-toggle]{font:inherit;padding:var(--lr-space-xs);cursor:pointer;color:inherit;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);background:0 0;border:none;justify-content:center;align-items:center;display:inline-flex}[part=row-expand-toggle]:hover{background:var(--lr-color-brand-quiet)}[part=row-expand-toggle]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=row-expand-toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=row-expand-icon]{transition:transform var(--lr-transition-fast);display:inline-block}[part=row-expand-icon] svg{display:block}[part=row-expand-toggle][aria-expanded=true] [part=row-expand-icon]{transform:rotate(90deg)}:host(:dir(rtl)) [part=row-expand-icon]{transform:rotate(180deg)}:host(:dir(rtl)) [part=row-expand-toggle][aria-expanded=true] [part=row-expand-icon]{transform:rotate(90deg)}@media (prefers-reduced-motion:reduce){[part=row-expand-icon]{transition:none!important}}[part=expanded-row] [part=expanded-cell]{padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface)}[part=header-cell][data-sticky],[part=cell][data-sticky]{z-index:var(--lr-layer-content);background:var(--lr-color-surface);box-shadow:var(--lr-size-1px) 0 0 0 var(--lr-color-border);position:sticky;inset-inline-start:var(--lr-table-sticky-offset,0)}[part=header-cell][data-sticky=end],[part=cell][data-sticky=end]{box-shadow:calc(-1 * var(--lr-size-1px)) 0 0 0 var(--lr-color-border);inset-inline-start:auto;inset-inline-end:var(--lr-table-sticky-offset,0)}:host(:dir(rtl)) [part=header-cell][data-sticky],:host(:dir(rtl)) [part=cell][data-sticky]{box-shadow:calc(-1 * var(--lr-size-1px)) 0 0 0 var(--lr-color-border)}:host(:dir(rtl)) [part=header-cell][data-sticky=end],:host(:dir(rtl)) [part=cell][data-sticky=end]{box-shadow:var(--lr-size-1px) 0 0 0 var(--lr-color-border)}[part=foot]{background:var(--lr-color-surface);position:sticky;inset-block-end:0}[part=footer-cell]{padding:var(--lr-space-xs) var(--lr-space-s);border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border);font-weight:var(--lr-font-weight-semibold);text-align:start}[part=footer-cell][data-align=end]{text-align:end}[part=more-button],[part=reveal-columns-button]{inline-size:100%;padding:var(--lr-space-s);color:var(--lr-color-brand);font:inherit;cursor:pointer;border:none;border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border);background:0 0;display:block}[part=more-button]:hover,[part=reveal-columns-button]:hover{background:var(--lr-color-brand-quiet)}[part=more-button]:active,[part=reveal-columns-button]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=more-button]:focus-visible,[part=reveal-columns-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}`;export{styles};
|
|
1
|
+
import{css}from"lit";const styles=css`:host{--_lr-table-heat-tint-lo-default:var(--lr-color-brand-quiet);--_lr-table-heat-tint-hi-default:var(--lr-color-brand);--_lr-table-resize-min-width-default:var(--lr-size-3rem);--_lr-table-resize-handle-opacity-default:.12;inline-size:100%;display:block}[part=base]{max-block-size:var(--lr-table-max-height,none);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);contain-intrinsic-inline-size:var(--lr-size-20rem);overflow:auto;container-type:inline-size}:host([scroll-mode=page]) [part=base],:host([scroll-mode=auto]) [part=base]:not([data-scroll-overflow]){max-block-size:none;overflow:visible}[part=filter-label]{align-items:center;gap:var(--lr-space-s);padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-md-sm);display:flex}[part=filter]{min-inline-size:0;padding:var(--lr-space-xs) var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius-xs);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit;flex:1}[part=filter]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}:where([part=filter]):hover{background:var(--lr-color-brand-quiet)}:where([part=filter]):active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=filter]::placeholder{color:var(--lr-color-text-quiet);opacity:1}[part=filter][type=search]::-webkit-search-cancel-button,[part=filter][type=search]::-webkit-search-decoration{appearance:none}[part=loading]:not(.sr-only){min-block-size:var(--lr-size-8rem);padding:var(--lr-space-l);place-items:center;display:grid}[part=pagination]{border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border);display:block}@container (inline-size<=899.98px){[part=base]:not([data-force-visible]) [data-priority=low]{display:none}}@container (inline-size<=639.98px){[part=base]:not([data-force-visible]) [data-priority=medium]{display:none}}[part=table]{border-collapse:collapse;inline-size:100%;font:inherit}[part=table][data-layout=fixed]{table-layout:fixed}[part=header-cell]{background:var(--lr-color-surface);text-align:start;font-weight:var(--lr-font-weight-semibold);padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);cursor:default;white-space:nowrap;position:sticky;inset-block-start:0}[part=header-cell][data-resizable]{padding-inline-end:calc(var(--lr-space-s) + var(--lr-size-0-5rem))}[part=resize-handle]{inline-size:var(--lr-size-0-5rem);min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);cursor:col-resize;touch-action:none;position:absolute;inset-block:0;inset-inline-end:0}[part=resize-handle]:hover,[part=resize-handle]:focus-visible{background:var(--lr-table-resize-handle-hover-bg,var(--lr-color-brand));opacity:var(--lr-table-resize-handle-hover-opacity,var(--lr-table-resize-handle-opacity,var(--_lr-table-resize-handle-opacity-default)))}[part=resize-handle]:active,[part=resize-handle][data-resizing]{background:var(--lr-table-resize-handle-active-bg,var(--lr-table-resize-handle-hover-bg,var(--lr-color-brand)));opacity:var(--lr-table-resize-handle-active-opacity,calc(var(--lr-table-resize-handle-hover-opacity,var(--lr-table-resize-handle-opacity,var(--_lr-table-resize-handle-opacity-default))) * 2))}[part=resize-handle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}:where([part=header-cell][aria-sort]:not([aria-sort=none])),:where([part=header-cell][data-sortable]){cursor:pointer}[part=header-cell]:where([aria-sort]:not([aria-sort=none])){background:var(--lr-table-header-sorted-bg,var(--lr-color-surface));color:var(--lr-table-header-sorted-color,inherit)}[part=header-cell][data-sortable]:hover{background:var(--lr-color-brand-quiet)}[part=header-cell][data-sortable]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=header-cell]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=header-cell][data-align=end]{text-align:end}[part~=sort-icon]{vertical-align:middle;transition:transform var(--lr-transition-fast);margin-inline-start:var(--lr-space-xs);display:inline-block}[part~=sort-icon-inactive]{color:var(--lr-color-text-quiet)}@media (forced-colors:active){[part~=sort-icon-inactive]{color:canvastext!important}}[part~=sort-icon] svg{display:block}[part~=sort-icon][data-dir=asc]{transform:rotate(-90deg)}[part~=sort-icon][data-dir=desc]{transform:rotate(90deg)}@media (prefers-reduced-motion:reduce){[part~=sort-icon]{transition:none!important}}[part=row][data-stripe]{background:var(--lr-table-row-stripe-bg,transparent)}[part=row][aria-selected=true]{background:var(--lr-table-row-selected-bg,var(--lr-color-brand-quiet))}[part=row]:hover{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-hover))}[part=row]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}@media (forced-colors:active){:where([part~=row][aria-selected=true]){outline:var(--lr-border-width-medium) solid Highlight;outline-offset:calc(-1 * var(--lr-border-width-medium))}:where([part~=row]:hover:not([aria-selected=true])){outline:var(--lr-border-width-thin) dashed Highlight;outline-offset:calc(-1 * var(--lr-border-width-thin))}}[part=group-cell]{padding:var(--lr-space-xs) var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface-raised);color:var(--lr-color-text-quiet);font-weight:var(--lr-font-weight-semibold);text-align:start}[part=row]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=cell]{padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);color:var(--lr-table-cell-color,inherit)}[part=cell] a:where(:any-link){color:var(--lr-table-cell-link-color,var(--lr-color-brand))}[part=cell] a:where(:any-link):hover,[part=cell] a:where(:any-link):focus-visible,[part=cell] a:where(:any-link):active{color:var(--lr-table-cell-link-hover-color,var(--lr-table-cell-link-color,var(--lr-color-brand)));text-decoration-thickness:var(--lr-border-width-medium)}[part=cell-editor]{box-sizing:border-box;inline-size:100%;min-inline-size:0;padding:var(--lr-space-xs) var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-brand);border-radius:var(--lr-radius-xs);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit}[part=cell-editor]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}:where([part=cell-editor]):hover{background:var(--lr-color-brand-quiet)}:where([part=cell-editor]):active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=cell-editor][type=number]{appearance:textfield}[part=cell-editor][type=number]::-webkit-inner-spin-button,[part=cell-editor][type=number]::-webkit-outer-spin-button{appearance:none;margin:0}[part=cell][data-align=end]{text-align:end}[part=row-total-cell]{padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);font-weight:var(--lr-font-weight-semibold);text-align:end}[part=cell][data-heat]{background:color-mix(in srgb, var(--lr-table-heat-tint-hi,var(--_lr-table-heat-tint-hi-default)) var(--lr-table-heat-t), var(--lr-table-heat-tint-lo,var(--_lr-table-heat-tint-lo-default)))}[part=expand-toggle-cell]{padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);text-align:center}[part=row-expand-toggle]{font:inherit;padding:var(--lr-space-xs);cursor:pointer;color:inherit;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);background:0 0;border:none;justify-content:center;align-items:center;display:inline-flex}[part=row-expand-toggle]:hover{background:var(--lr-color-brand-quiet)}[part=row-expand-toggle]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=row-expand-toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=row-expand-icon]{transition:transform var(--lr-transition-fast);display:inline-block}[part=row-expand-icon] svg{display:block}[part=row-expand-toggle][aria-expanded=true] [part=row-expand-icon]{transform:rotate(90deg)}:host(:dir(rtl)) [part=row-expand-icon]{transform:rotate(180deg)}:host(:dir(rtl)) [part=row-expand-toggle][aria-expanded=true] [part=row-expand-icon]{transform:rotate(90deg)}@media (prefers-reduced-motion:reduce){[part=row-expand-icon]{transition:none!important}}[part=expanded-row] [part=expanded-cell]{padding:var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface)}[part=header-cell][data-sticky],[part=cell][data-sticky]{z-index:var(--lr-layer-content);background:var(--lr-color-surface);box-shadow:var(--lr-size-1px) 0 0 0 var(--lr-color-border);position:sticky;inset-inline-start:var(--lr-table-sticky-offset,0)}[part=header-cell][data-sticky=end],[part=cell][data-sticky=end]{box-shadow:calc(-1 * var(--lr-size-1px)) 0 0 0 var(--lr-color-border);inset-inline-start:auto;inset-inline-end:var(--lr-table-sticky-offset,0)}:host(:dir(rtl)) [part=header-cell][data-sticky],:host(:dir(rtl)) [part=cell][data-sticky]{box-shadow:calc(-1 * var(--lr-size-1px)) 0 0 0 var(--lr-color-border)}:host(:dir(rtl)) [part=header-cell][data-sticky=end],:host(:dir(rtl)) [part=cell][data-sticky=end]{box-shadow:var(--lr-size-1px) 0 0 0 var(--lr-color-border)}[part=foot]{background:var(--lr-color-surface);position:sticky;inset-block-end:0}[part=footer-cell]{padding:var(--lr-space-xs) var(--lr-space-s);border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border);font-weight:var(--lr-font-weight-semibold);text-align:start}[part=footer-cell][data-align=end]{text-align:end}[part=more-button],[part=reveal-columns-button]{inline-size:100%;padding:var(--lr-space-s);color:var(--lr-color-brand);font:inherit;cursor:pointer;border:none;border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border);background:0 0;display:block}[part=more-button]:hover,[part=reveal-columns-button]:hover{background:var(--lr-color-brand-quiet)}[part=more-button]:active,[part=reveal-columns-button]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=more-button]:focus-visible,[part=reveal-columns-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}`;export{styles};
|
|
@@ -51,7 +51,11 @@ export type ButtonFormMethod='get'|'post'|'dialog';export interface LyraButtonEv
|
|
|
51
51
|
* Description targets follow same-ID replacement, removal, reinsertion, reconnection and document
|
|
52
52
|
* adoption, including transitions between the native button and anchor.
|
|
53
53
|
* Host `aria-haspopup` and `aria-expanded` values are likewise forwarded to the internal semantic
|
|
54
|
-
* control.
|
|
54
|
+
* control. `aria-pressed` (`true`, `false`, `mixed`) supports button toggles; `aria-current`
|
|
55
|
+
* (`page`, `step`, `location`, `date`, `time`, `true`, `false`) supports current navigation.
|
|
56
|
+
* These states follow attribute changes, removal and button/link replacement without changing
|
|
57
|
+
* the native role. Empty or unsupported state tokens are omitted from the internal control.
|
|
58
|
+
* When host `aria-controls` names elements in the host's own root, the controls
|
|
55
59
|
* relationship is resolved onto the internal control through the reflected element-reference API
|
|
56
60
|
* so it remains valid across this component's shadow boundary. Assigning that relationship
|
|
57
61
|
* intentionally clears the serialized `aria-controls` value; read `ariaControlsElements` in a
|
|
@@ -74,6 +78,8 @@ export type ButtonFormMethod='get'|'post'|'dialog';export interface LyraButtonEv
|
|
|
74
78
|
* @slot end - Trailing icon/content, rendered after the label.
|
|
75
79
|
* @slot suffix - Shoelace alias for `end`, rendered through the same wrapper.
|
|
76
80
|
* @attr form - ID of an external form owner. The `form` property still reads as the resolved form.
|
|
81
|
+
* @attr aria-pressed - Toggle state forwarded reactively to the internal control: true, false or mixed.
|
|
82
|
+
* @attr aria-current - Current-item state forwarded reactively to the internal control: page, step, location, date, time, true or false.
|
|
77
83
|
* @attr rel - Independently settable author relationship tokens (no default). `opener` is always
|
|
78
84
|
* stripped, and any `target` force-adds the non-removable `noopener noreferrer` guard.
|
|
79
85
|
* @csspart base - Compatibility name for the internal control; use `button`.
|
|
@@ -207,7 +213,7 @@ get form():HTMLFormElement|null;set form(owner:FormOwnerValue);getForm():HTMLFor
|
|
|
207
213
|
/** Accessible name forwarded to the internal native button or anchor. Bound to the host's
|
|
208
214
|
* `aria-label` content attribute so changing or removing that attribute after mount keeps the
|
|
209
215
|
* actual focused control synchronized. */
|
|
210
|
-
accessibleLabel:string|null;private triggerHasPopup;private triggerExpanded;private triggerControls;private triggerDescribedBy;
|
|
216
|
+
accessibleLabel:string|null;private triggerHasPopup;private triggerExpanded;private triggerPressed;private triggerCurrent;private triggerControls;private triggerDescribedBy;
|
|
211
217
|
/** Semantic tone, from the library's one `variant` vocabulary — the same five values every other
|
|
212
218
|
* `variant` in the library takes. Selects which row of the semantic colour grid every fill,
|
|
213
219
|
* border and foreground token below resolves against. Shoelace's `default`/`primary` spellings
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},_a;import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{FORM_CONTROL_LABEL_FACTORY,LyraElement}from"../../../internal/lyra-element.js";import{installFormControlInternalsCapture}from"../../../internal/form-control-labels.js";import{chevronIcon,spinnerIcon}from"../../../internal/icons.js";import{safeDownloadHref,safeLinkHref}from"../../../internal/safe-url.js";import{syncAriaControlsElements}from"../../../internal/aria-reflection.js";import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{sizes}from"../../../internal/sizes.styles.js";import{variants}from"../../../internal/variants.styles.js";import{styles}from"./button.styles.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{getFormOwner,installCustomErrorProperty,setFormOwner}from"../../../internal/direct-form-associated.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState}from"../../../internal/custom-states.js";import{omittedEmptyStringConverter}from"../../../internal/converters.js";import{currentValidityValidator}from"../form-validator.js";import{createButtonExternalLabelController}from"./button-external-label.js";import{LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings.generated.js";installFormControlInternalsCapture();class LyraButton extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired}}static get validators(){return[currentValidityValidator("required","disabled","loading","href","value")]}static{this.styles=[LyraElement.styles,sizes,variants,styles]}static{this.formAssociated=!0}static{this[_a]=createButtonExternalLabelController}static{this.properties={disabled:{type:Boolean,reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},customError:{attribute:"custom-error",reflect:!0,noAccessor:!0}}}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.requestUpdate("disabled",old),this.updateValidity()}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get effectiveDisabled(){return this._disabled||this._fieldsetDisabled}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}constructor(){super(),this._fieldsetDisabled=!1,this._disabled=!1,this._name="",this._value="",this._required=!1,this._variant="neutral",this.localDescriptionIds="",this.customValidityMessage="",this.reflectingCustomError=!1,this.accessibleLabel=null,this.triggerHasPopup=null,this.triggerExpanded=null,this.triggerControls=null,this.triggerDescribedBy=null,this.appearance="accent",this.size="m",this.pill=!1,this.circle=!1,this.outline=!1,this.withCaret=!1,this.withStart=!1,this.withEnd=!1,this.type="button",this.formNoValidate=!1,this.loading=!1,this.hasStartSlot=!1,this.hasEndSlot=!1,this.isIconButton=!1,this.onClick=event=>{if(this.type!=="submit"&&this.type!=="reset")return;const ownerWindow=this.ownerDocument.defaultView;let settled=!1;const finish=()=>{settled||(settled=!0,ownerWindow?.removeEventListener("click",finishAtWindow),!(event.defaultPrevented||this.effectiveDisabled||this.loading)&&this.runClickDefaultAction())},finishAtWindow=candidate=>{candidate===event&&finish()};ownerWindow?.addEventListener("click",finishAtWindow),queueMicrotask(finish)},this.onFocus=event=>{relayNativeEvent(this,event)},this.onBlur=event=>{relayNativeEvent(this,event)},this.onStartSlotChange=()=>{this.syncAdornmentSlots()},this.onEndSlotChange=()=>{this.syncAdornmentSlots()},this.onDefaultSlotChange=()=>{this.isIconButton=this.hasIconOnlyDefaultContent(),this.syncButtonStates()},installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.customValidityMessage),this.updateValidity(),this.syncButtonStates()}get variant(){return this._variant}set variant(next){next==="primary"?this._variant="brand":next==="default"||next==="text"?this._variant="neutral":this._variant=next,next==="text"&&(this.appearance="plain")}get caret(){return this.withCaret}set caret(next){this.withCaret=!!next}get value(){return this._value}set value(next){this._value=next??"",this.updateValidity()}get required(){return this._required}set required(next){this._required=!!next,this.updateValidity()}get resolvedRel(){const authored=(this.rel??"").split(/\s+/).filter(token=>token!==""&&token.toLowerCase()!=="opener"),tokens=new Set(authored);return this.target&&(tokens.add("noopener"),tokens.add("noreferrer")),tokens.size>0?[...tokens].join(" "):void 0}click(){this.effectiveDisabled||this.loading||this.baseEl?.click()}focus(options){!this.effectiveDisabled&&!this.loading&&this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}[(_a=FORM_CONTROL_LABEL_FACTORY,VALIDITY_ANCHOR)](){return this.baseEl??null}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}setCustomValidity(message){const old=this.customValidityMessage||null,next=message??"";if(this.customValidityMessage=next,this.validityController.setCustomValidity(this.isValidationBarred?"":next),!this.reflectingCustomError){this.reflectingCustomError=!0;try{next?this.setAttribute("custom-error",next):this.removeAttribute("custom-error")}finally{this.reflectingCustomError=!1}}this.requestUpdate("customError",old)}resetValidity(){this.customValidityMessage="",this.validityController.setCustomValidity(""),this.updateValidity()}formStateRestoreCallback(state2,reason){this.value=typeof state2=="string"?state2:""}runClickDefaultAction(){if(this.type==="submit"){const form=this.getForm();if(!form)return;this.hasSubmitterOverrides?this.submitAsNamedSubmitter(form):form.requestSubmit()}else this.type==="reset"&&this.getForm()?.reset()}get hasSubmitterOverrides(){return!!(this.name||this.value||this.formNoValidate)||this.formAction!==void 0||this.formEnctype!==void 0||this.formMethod!==void 0||this.formTarget!==void 0}submitAsNamedSubmitter(form){const submitter=this.ownerDocument.createElement("button");submitter.type="submit",submitter.hidden=!0,submitter.tabIndex=-1,this.name&&(submitter.name=this.name,submitter.value=this.value),this.formAction!==void 0&&submitter.setAttribute("formaction",this.formAction),this.formEnctype!==void 0&&submitter.setAttribute("formenctype",this.formEnctype),this.formMethod!==void 0&&submitter.setAttribute("formmethod",this.formMethod),this.formNoValidate&&(submitter.formNoValidate=!0),this.formTarget!==void 0&&submitter.setAttribute("formtarget",this.formTarget),this.parentElement&&this.closest("form")===form?this.insertAdjacentElement("afterend",submitter):form.append(submitter);try{form.requestSubmit(submitter)}finally{submitter.remove()}}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.updateValidity(),this.syncButtonStates(),this.requestUpdate()}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncDescribedByElements(),this.updateValidity(),this.syncButtonStates()}disconnectedCallback(){this.releaseExternalDescription(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.isConnected&&this.hasUpdated&&this.syncDescribedByElements()}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.syncAdornmentSlots(),this.isIconButton=this.hasIconOnlyDefaultContent())}syncAdornmentSlots(){const collection=this.children,children=collection?Array.from(collection):[];this.hasStartSlot=children.some(element=>{const slot=element.getAttribute("slot");return slot==="start"||slot==="prefix"}),this.hasEndSlot=children.some(element=>{const slot=element.getAttribute("slot");return slot==="end"||slot==="suffix"})}hasIconOnlyDefaultContent(){const childElements=this.children,elements=(childElements?Array.from(childElements):[]).filter(element=>!element.getAttribute("slot"));if(elements.length!==1)return!1;const childNodes=this.childNodes;return(childNodes?Array.from(childNodes):[]).filter(node=>node.nodeType===3).map(node=>node.textContent??"").join("").trim()===""&&(elements[0]?.textContent??"").trim()===""}updated(changed){super.updated(changed),syncAriaControlsElements(this,this.baseEl,this.triggerControls),this.syncDescribedByElements(),this.updateValidity(),this.syncButtonStates()}updateValidity(){if(this.validityController){if(this.isValidationBarred){this.validityController.setCustomValidity(""),this.validityController.setValidity({});return}this.required&&!this.value?this.validityController.setValidity({valueMissing:!0},this.localize("fieldRequired")):this.validityController.setValidity({}),this.validityController.setCustomValidity(this.customValidityMessage)}}get isValidationBarred(){return this.effectiveDisabled||this.loading||this.baseEl?.localName==="a"}syncButtonStates(){this.internals&&(setCustomState(this.internals,"disabled",this.effectiveDisabled||this.loading),setCustomState(this.internals,"icon-button",this.isIconButton),setCustomState(this.internals,"link",this.baseEl?.localName==="a"),setCustomState(this.internals,"loading",this.loading))}syncDescribedByElements(){const target=this.isConnected?this.baseEl:void 0;if(!target){this.releaseExternalDescription();return}this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds)}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}render(){const content=html`
|
|
1
|
+
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},_a;import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{FORM_CONTROL_LABEL_FACTORY,LyraElement}from"../../../internal/lyra-element.js";import{installFormControlInternalsCapture}from"../../../internal/form-control-labels.js";import{chevronIcon,spinnerIcon}from"../../../internal/icons.js";import{safeDownloadHref,safeLinkHref}from"../../../internal/safe-url.js";import{syncAriaControlsElements}from"../../../internal/aria-reflection.js";import{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{sizes}from"../../../internal/sizes.styles.js";import{variants}from"../../../internal/variants.styles.js";import{styles}from"./button.styles.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{getFormOwner,installCustomErrorProperty,setFormOwner}from"../../../internal/direct-form-associated.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState}from"../../../internal/custom-states.js";import{omittedEmptyStringConverter}from"../../../internal/converters.js";import{currentValidityValidator}from"../form-validator.js";import{createButtonExternalLabelController}from"./button-external-label.js";import{LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings.generated.js";installFormControlInternalsCapture();class LyraButton extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired}}static get validators(){return[currentValidityValidator("required","disabled","loading","href","value")]}static{this.styles=[LyraElement.styles,sizes,variants,styles]}static{this.formAssociated=!0}static{this[_a]=createButtonExternalLabelController}static{this.properties={disabled:{type:Boolean,reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},customError:{attribute:"custom-error",reflect:!0,noAccessor:!0}}}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.requestUpdate("disabled",old),this.updateValidity()}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get effectiveDisabled(){return this._disabled||this._fieldsetDisabled}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}constructor(){super(),this._fieldsetDisabled=!1,this._disabled=!1,this._name="",this._value="",this._required=!1,this._variant="neutral",this.localDescriptionIds="",this.customValidityMessage="",this.reflectingCustomError=!1,this.accessibleLabel=null,this.triggerHasPopup=null,this.triggerExpanded=null,this.triggerPressed=null,this.triggerCurrent=null,this.triggerControls=null,this.triggerDescribedBy=null,this.appearance="accent",this.size="m",this.pill=!1,this.circle=!1,this.outline=!1,this.withCaret=!1,this.withStart=!1,this.withEnd=!1,this.type="button",this.formNoValidate=!1,this.loading=!1,this.hasStartSlot=!1,this.hasEndSlot=!1,this.isIconButton=!1,this.onClick=event=>{if(this.type!=="submit"&&this.type!=="reset")return;const ownerWindow=this.ownerDocument.defaultView;let settled=!1;const finish=()=>{settled||(settled=!0,ownerWindow?.removeEventListener("click",finishAtWindow),!(event.defaultPrevented||this.effectiveDisabled||this.loading)&&this.runClickDefaultAction())},finishAtWindow=candidate=>{candidate===event&&finish()};ownerWindow?.addEventListener("click",finishAtWindow),queueMicrotask(finish)},this.onFocus=event=>{relayNativeEvent(this,event)},this.onBlur=event=>{relayNativeEvent(this,event)},this.onStartSlotChange=()=>{this.syncAdornmentSlots()},this.onEndSlotChange=()=>{this.syncAdornmentSlots()},this.onDefaultSlotChange=()=>{this.isIconButton=this.hasIconOnlyDefaultContent(),this.syncButtonStates()},installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.customValidityMessage),this.updateValidity(),this.syncButtonStates()}get variant(){return this._variant}set variant(next){next==="primary"?this._variant="brand":next==="default"||next==="text"?this._variant="neutral":this._variant=next,next==="text"&&(this.appearance="plain")}get caret(){return this.withCaret}set caret(next){this.withCaret=!!next}get value(){return this._value}set value(next){this._value=next??"",this.updateValidity()}get required(){return this._required}set required(next){this._required=!!next,this.updateValidity()}get resolvedRel(){const authored=(this.rel??"").split(/\s+/).filter(token=>token!==""&&token.toLowerCase()!=="opener"),tokens=new Set(authored);return this.target&&(tokens.add("noopener"),tokens.add("noreferrer")),tokens.size>0?[...tokens].join(" "):void 0}click(){this.effectiveDisabled||this.loading||this.baseEl?.click()}focus(options){!this.effectiveDisabled&&!this.loading&&this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}[(_a=FORM_CONTROL_LABEL_FACTORY,VALIDITY_ANCHOR)](){return this.baseEl??null}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}setCustomValidity(message){const old=this.customValidityMessage||null,next=message??"";if(this.customValidityMessage=next,this.validityController.setCustomValidity(this.isValidationBarred?"":next),!this.reflectingCustomError){this.reflectingCustomError=!0;try{next?this.setAttribute("custom-error",next):this.removeAttribute("custom-error")}finally{this.reflectingCustomError=!1}}this.requestUpdate("customError",old)}resetValidity(){this.customValidityMessage="",this.validityController.setCustomValidity(""),this.updateValidity()}formStateRestoreCallback(state2,reason){this.value=typeof state2=="string"?state2:""}runClickDefaultAction(){if(this.type==="submit"){const form=this.getForm();if(!form)return;this.hasSubmitterOverrides?this.submitAsNamedSubmitter(form):form.requestSubmit()}else this.type==="reset"&&this.getForm()?.reset()}get hasSubmitterOverrides(){return!!(this.name||this.value||this.formNoValidate)||this.formAction!==void 0||this.formEnctype!==void 0||this.formMethod!==void 0||this.formTarget!==void 0}submitAsNamedSubmitter(form){const submitter=this.ownerDocument.createElement("button");submitter.type="submit",submitter.hidden=!0,submitter.tabIndex=-1,this.name&&(submitter.name=this.name,submitter.value=this.value),this.formAction!==void 0&&submitter.setAttribute("formaction",this.formAction),this.formEnctype!==void 0&&submitter.setAttribute("formenctype",this.formEnctype),this.formMethod!==void 0&&submitter.setAttribute("formmethod",this.formMethod),this.formNoValidate&&(submitter.formNoValidate=!0),this.formTarget!==void 0&&submitter.setAttribute("formtarget",this.formTarget),this.parentElement&&this.closest("form")===form?this.insertAdjacentElement("afterend",submitter):form.append(submitter);try{form.requestSubmit(submitter)}finally{submitter.remove()}}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,this.updateValidity(),this.syncButtonStates(),this.requestUpdate()}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncDescribedByElements(),this.updateValidity(),this.syncButtonStates()}disconnectedCallback(){this.releaseExternalDescription(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.isConnected&&this.hasUpdated&&this.syncDescribedByElements()}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.syncAdornmentSlots(),this.isIconButton=this.hasIconOnlyDefaultContent())}syncAdornmentSlots(){const collection=this.children,children=collection?Array.from(collection):[];this.hasStartSlot=children.some(element=>{const slot=element.getAttribute("slot");return slot==="start"||slot==="prefix"}),this.hasEndSlot=children.some(element=>{const slot=element.getAttribute("slot");return slot==="end"||slot==="suffix"})}hasIconOnlyDefaultContent(){const childElements=this.children,elements=(childElements?Array.from(childElements):[]).filter(element=>!element.getAttribute("slot"));if(elements.length!==1)return!1;const childNodes=this.childNodes;return(childNodes?Array.from(childNodes):[]).filter(node=>node.nodeType===3).map(node=>node.textContent??"").join("").trim()===""&&(elements[0]?.textContent??"").trim()===""}updated(changed){super.updated(changed),syncAriaControlsElements(this,this.baseEl,this.triggerControls),this.syncDescribedByElements(),this.updateValidity(),this.syncButtonStates()}updateValidity(){if(this.validityController){if(this.isValidationBarred){this.validityController.setCustomValidity(""),this.validityController.setValidity({});return}this.required&&!this.value?this.validityController.setValidity({valueMissing:!0},this.localize("fieldRequired")):this.validityController.setValidity({}),this.validityController.setCustomValidity(this.customValidityMessage)}}get isValidationBarred(){return this.effectiveDisabled||this.loading||this.baseEl?.localName==="a"}syncButtonStates(){this.internals&&(setCustomState(this.internals,"disabled",this.effectiveDisabled||this.loading),setCustomState(this.internals,"icon-button",this.isIconButton),setCustomState(this.internals,"link",this.baseEl?.localName==="a"),setCustomState(this.internals,"loading",this.loading))}syncDescribedByElements(){const target=this.isConnected?this.baseEl:void 0;if(!target){this.releaseExternalDescription();return}this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds)}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}render(){const pressed=["true","false","mixed"].includes(this.triggerPressed??"")?this.triggerPressed:nothing,current=["page","step","location","date","time","true","false"].includes(this.triggerCurrent??"")?this.triggerCurrent:nothing,content=html`
|
|
2
2
|
<span
|
|
3
3
|
part="start prefix"
|
|
4
4
|
?hidden=${!(this.hasStartSlot||this.withStart)}
|
|
@@ -25,6 +25,8 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
25
25
|
aria-label=${this.accessibleLabel??nothing}
|
|
26
26
|
aria-haspopup=${this.triggerHasPopup??nothing}
|
|
27
27
|
aria-expanded=${this.triggerExpanded??nothing}
|
|
28
|
+
aria-pressed=${pressed}
|
|
29
|
+
aria-current=${current}
|
|
28
30
|
aria-controls=${this.triggerControls||nothing}
|
|
29
31
|
aria-describedby=${this.triggerDescribedBy||nothing}
|
|
30
32
|
aria-disabled=${disabled?"true":"false"}
|
|
@@ -41,6 +43,8 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
41
43
|
aria-label=${this.accessibleLabel??nothing}
|
|
42
44
|
aria-haspopup=${this.triggerHasPopup??nothing}
|
|
43
45
|
aria-expanded=${this.triggerExpanded??nothing}
|
|
46
|
+
aria-pressed=${pressed}
|
|
47
|
+
aria-current=${current}
|
|
44
48
|
aria-controls=${this.triggerControls||nothing}
|
|
45
49
|
aria-describedby=${this.triggerDescribedBy||nothing}
|
|
46
50
|
aria-busy=${this.loading?"true":"false"}
|
|
@@ -51,4 +55,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
51
55
|
>
|
|
52
56
|
${content}
|
|
53
57
|
</button>
|
|
54
|
-
`}}__decorate([property({attribute:"form"})],LyraButton.prototype,"form",null),__decorate([property({attribute:"aria-label"})],LyraButton.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"aria-haspopup"})],LyraButton.prototype,"triggerHasPopup",void 0),__decorate([property({attribute:"aria-expanded"})],LyraButton.prototype,"triggerExpanded",void 0),__decorate([property({attribute:"aria-controls"})],LyraButton.prototype,"triggerControls",void 0),__decorate([property({attribute:"aria-describedby"})],LyraButton.prototype,"triggerDescribedBy",void 0),__decorate([property({reflect:!0})],LyraButton.prototype,"variant",null),__decorate([property({reflect:!0})],LyraButton.prototype,"appearance",void 0),__decorate([property({reflect:!0})],LyraButton.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"pill",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"circle",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"outline",void 0),__decorate([property({attribute:"with-caret",type:Boolean,reflect:!0})],LyraButton.prototype,"withCaret",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"caret",null),__decorate([property({attribute:"with-start",type:Boolean})],LyraButton.prototype,"withStart",void 0),__decorate([property({attribute:"with-end",type:Boolean})],LyraButton.prototype,"withEnd",void 0),__decorate([property()],LyraButton.prototype,"type",void 0),__decorate([property({reflect:!0})],LyraButton.prototype,"value",null),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"required",null),__decorate([property({attribute:"formaction"})],LyraButton.prototype,"formAction",void 0),__decorate([property({attribute:"formenctype"})],LyraButton.prototype,"formEnctype",void 0),__decorate([property({attribute:"formmethod"})],LyraButton.prototype,"formMethod",void 0),__decorate([property({attribute:"formnovalidate",type:Boolean})],LyraButton.prototype,"formNoValidate",void 0),__decorate([property({attribute:"formtarget"})],LyraButton.prototype,"formTarget",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"loading",void 0),__decorate([property({reflect:!0})],LyraButton.prototype,"href",void 0),__decorate([property()],LyraButton.prototype,"target",void 0),__decorate([property()],LyraButton.prototype,"rel",void 0),__decorate([property()],LyraButton.prototype,"download",void 0),__decorate([state()],LyraButton.prototype,"hasStartSlot",void 0),__decorate([state()],LyraButton.prototype,"hasEndSlot",void 0),__decorate([state()],LyraButton.prototype,"isIconButton",void 0),__decorate([query('[part~="base"]')],LyraButton.prototype,"baseEl",void 0);export{LyraButton};
|
|
58
|
+
`}}__decorate([property({attribute:"form"})],LyraButton.prototype,"form",null),__decorate([property({attribute:"aria-label"})],LyraButton.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"aria-haspopup"})],LyraButton.prototype,"triggerHasPopup",void 0),__decorate([property({attribute:"aria-expanded"})],LyraButton.prototype,"triggerExpanded",void 0),__decorate([property({attribute:"aria-pressed"})],LyraButton.prototype,"triggerPressed",void 0),__decorate([property({attribute:"aria-current"})],LyraButton.prototype,"triggerCurrent",void 0),__decorate([property({attribute:"aria-controls"})],LyraButton.prototype,"triggerControls",void 0),__decorate([property({attribute:"aria-describedby"})],LyraButton.prototype,"triggerDescribedBy",void 0),__decorate([property({reflect:!0})],LyraButton.prototype,"variant",null),__decorate([property({reflect:!0})],LyraButton.prototype,"appearance",void 0),__decorate([property({reflect:!0})],LyraButton.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"pill",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"circle",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"outline",void 0),__decorate([property({attribute:"with-caret",type:Boolean,reflect:!0})],LyraButton.prototype,"withCaret",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"caret",null),__decorate([property({attribute:"with-start",type:Boolean})],LyraButton.prototype,"withStart",void 0),__decorate([property({attribute:"with-end",type:Boolean})],LyraButton.prototype,"withEnd",void 0),__decorate([property()],LyraButton.prototype,"type",void 0),__decorate([property({reflect:!0})],LyraButton.prototype,"value",null),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"required",null),__decorate([property({attribute:"formaction"})],LyraButton.prototype,"formAction",void 0),__decorate([property({attribute:"formenctype"})],LyraButton.prototype,"formEnctype",void 0),__decorate([property({attribute:"formmethod"})],LyraButton.prototype,"formMethod",void 0),__decorate([property({attribute:"formnovalidate",type:Boolean})],LyraButton.prototype,"formNoValidate",void 0),__decorate([property({attribute:"formtarget"})],LyraButton.prototype,"formTarget",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraButton.prototype,"loading",void 0),__decorate([property({reflect:!0})],LyraButton.prototype,"href",void 0),__decorate([property()],LyraButton.prototype,"target",void 0),__decorate([property()],LyraButton.prototype,"rel",void 0),__decorate([property()],LyraButton.prototype,"download",void 0),__decorate([state()],LyraButton.prototype,"hasStartSlot",void 0),__decorate([state()],LyraButton.prototype,"hasEndSlot",void 0),__decorate([state()],LyraButton.prototype,"isIconButton",void 0),__decorate([query('[part~="base"]')],LyraButton.prototype,"baseEl",void 0);export{LyraButton};
|
|
@@ -150,22 +150,50 @@ readonly stops?:readonly(readonly[number,string])[];
|
|
|
150
150
|
readonly width?:number;
|
|
151
151
|
/** Whole-line opacity, clamped to [0, 1]. Unset/non-finite restores 1. */
|
|
152
152
|
readonly opacity?:number;}
|
|
153
|
-
/**
|
|
153
|
+
/** Numeric radius interpolation: inclusive threshold bands or a continuous linear ramp. */
|
|
154
|
+
export type LyraMapPointRadiusInterpolation='step'|'linear';
|
|
155
|
+
/** A numeric feature field mapped to an individual point's radius, independently of clustering. */
|
|
156
|
+
export interface LyraMapPointRadiusOptions{
|
|
157
|
+
/** Numeric feature property. Missing, non-numeric and non-finite values use fallback. */
|
|
158
|
+
readonly field:string;
|
|
159
|
+
/** First 32 pairs are inspected; finite [value, radius] pairs are sorted and deduplicated first-wins. Radii clamp
|
|
160
|
+
* to [0, 200] CSS pixels. One usable stop is constant; no usable stops use fallback. */
|
|
161
|
+
readonly stops:readonly(readonly[number,number])[];
|
|
162
|
+
/** Defaults to step. Step uses the first radius below the first threshold; linear clamps
|
|
163
|
+
* outside the domain. An unrepresentable linear domain uses fallback. */
|
|
164
|
+
readonly interpolation?:LyraMapPointRadiusInterpolation;
|
|
165
|
+
/** Radius for invalid feature values or unusable scales. Defaults to 5; clamped to [0, 200]. */
|
|
166
|
+
readonly fallback?:number;}
|
|
167
|
+
/** How a point icon's path is painted. The existing filled-path behavior remains the default. */
|
|
168
|
+
export type LyraMapPointIconMode='fill'|'stroke'|'fill-stroke';
|
|
169
|
+
/** Shape of an open point-icon stroke's endpoints. */
|
|
170
|
+
export type LyraMapPointIconLineCap='butt'|'round'|'square';
|
|
171
|
+
/** Shape where point-icon stroke segments meet. */
|
|
172
|
+
export type LyraMapPointIconLineJoin='miter'|'round'|'bevel';
|
|
173
|
+
/** A category's SVG path, rasterized locally without parsing markup or fetching resources. */
|
|
154
174
|
export interface LyraMapPointIcon{
|
|
155
175
|
/** Exact string category matched against point.iconField, or point.field when omitted. */
|
|
156
176
|
readonly value:string;
|
|
157
177
|
/** SVG path data only, at most 8192 characters. Markup, URLs and non-path commands are rejected. */
|
|
158
178
|
readonly path:string;
|
|
159
179
|
/** SVG [minX, minY, width, height]. Defaults to [0, 0, 24, 24]; dimensions must be positive. */
|
|
160
|
-
readonly viewBox?:readonly[number,number,number,number];
|
|
180
|
+
readonly viewBox?:readonly[number,number,number,number];
|
|
181
|
+
/** Fill, stroke, or both using point.iconColor. Defaults to fill. */
|
|
182
|
+
readonly mode?:LyraMapPointIconMode;
|
|
183
|
+
/** Stroke width in viewBox units, clamped to [0, 200]. Defaults to 2. Zero paints no stroke. */
|
|
184
|
+
readonly strokeWidth?:number;
|
|
185
|
+
/** Open-path endpoint shape. Defaults to round. */
|
|
186
|
+
readonly lineCap?:LyraMapPointIconLineCap;
|
|
187
|
+
/** Segment join shape. Defaults to round; miter joins retain the canvas miter limit of 10. */
|
|
188
|
+
readonly lineJoin?:LyraMapPointIconLineJoin;}
|
|
161
189
|
/** Category colors and optional symbols for points, including unclustered points in a cluster source. */
|
|
162
190
|
export interface LyraMapPointOptions{
|
|
163
191
|
/** String feature property to match. Unknown, missing and non-string values use the flat layer color. */
|
|
164
192
|
readonly field?:string;
|
|
165
193
|
/** [category, CSS color] pairs; first 32 inspected, duplicate categories first-wins. */
|
|
166
194
|
readonly colors?:readonly(readonly[string,string])[];
|
|
167
|
-
/** Point radius in CSS pixels, clamped to [0, 200]. Defaults to 5. */
|
|
168
|
-
readonly radius?:number;
|
|
195
|
+
/** Point radius in CSS pixels, clamped to [0, 200], or a numeric feature-field scale. Defaults to 5. */
|
|
196
|
+
readonly radius?:number|LyraMapPointRadiusOptions;
|
|
169
197
|
/** Point outline width in CSS pixels, clamped to [0, 200]. Defaults to 0. */
|
|
170
198
|
readonly strokeWidth?:number;
|
|
171
199
|
/** Outline color; defaults to the layer's strokeColor/color/tone. CSS variables resolve on the host. */
|
|
@@ -174,7 +202,7 @@ readonly strokeColor?:string;
|
|
|
174
202
|
readonly iconField?:string;
|
|
175
203
|
/** First 32 icons inspected, duplicate values first-wins. Unknown categories keep their circle. */
|
|
176
204
|
readonly icons?:readonly LyraMapPointIcon[];
|
|
177
|
-
/**
|
|
205
|
+
/** Icon fill/stroke ink; defaults to the layer tone's contrasting foreground. CSS variables supported. */
|
|
178
206
|
readonly iconColor?:string;
|
|
179
207
|
/** Icon bounding square in CSS pixels, clamped to [1, 200]. Defaults to 16. */
|
|
180
208
|
readonly iconSize?:number;}
|
|
@@ -346,7 +374,7 @@ readonly sourceId:string|undefined;}>;}
|
|
|
346
374
|
* @csspart popup-content - The content container inside a MapLibre-generated marker popup.
|
|
347
375
|
* @csspart popup-close-button - The MapLibre-generated button that closes an open marker popup.
|
|
348
376
|
* @csspart attribution - MapLibre-generated map attribution.
|
|
349
|
-
* @csspart attribution-toggle - MapLibre's compact-attribution disclosure control.
|
|
377
|
+
* @csspart attribution-toggle - MapLibre's compact-attribution disclosure control with a decorative information glyph.
|
|
350
378
|
* @csspart navigation - Standard peer NavigationControl group, when added through the map getter.
|
|
351
379
|
* @csspart zoom-in - Peer zoom-in button with a localized accessible name and tokenized target.
|
|
352
380
|
* @csspart zoom-out - Peer zoom-out button.
|