@aceshooting/lyra-ui 14.1.1 → 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.
Files changed (78) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/custom-elements.json +1 -1
  3. package/design-tokens.json +1 -1
  4. package/dist/cli/migration-contract.json +1 -1
  5. package/dist/components/charts/chart/chart-legend-visibility.d.ts +8 -0
  6. package/dist/components/charts/chart/chart.class.d.ts +64 -15
  7. package/dist/components/charts/chart/chart.class.js +10 -10
  8. package/dist/components/data/heatmap/heatmap.class.d.ts +44 -6
  9. package/dist/components/data/heatmap/heatmap.class.js +8 -2
  10. package/dist/components/data/heatmap/heatmap.styles.js +1 -1
  11. package/dist/components/data/table/table.class.d.ts +9 -1
  12. package/dist/components/data/table/table.class.js +4 -3
  13. package/dist/components/data/table/table.styles.js +1 -1
  14. package/dist/components/forms/button/button.class.d.ts +8 -2
  15. package/dist/components/forms/button/button.class.js +6 -2
  16. package/dist/components/forms/checkbox/checkbox.styles.js +1 -1
  17. package/dist/components/forms/date-picker/date-input.class.d.ts +7 -8
  18. package/dist/components/forms/date-picker/date-input.styles.js +1 -1
  19. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +12 -2
  20. package/dist/components/forms/locale-picker/locale-picker.class.js +7 -6
  21. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
  22. package/dist/components/forms/slider/slider.class.d.ts +21 -5
  23. package/dist/components/forms/slider/slider.class.js +6 -5
  24. package/dist/components/forms/slider/slider.styles.js +1 -1
  25. package/dist/components/media/map/map-loader.d.ts +3 -1
  26. package/dist/components/media/map/map.class.d.ts +86 -6
  27. package/dist/components/media/map/map.class.js +1 -1
  28. package/dist/components/media/map/map.styles.js +1 -1
  29. package/dist/custom-elements-jsx.d.ts +1 -1
  30. package/dist/events.d.ts +21 -5
  31. package/dist/internal/default-strings.generated.d.ts +1 -1
  32. package/dist/internal/default-strings.generated.js +1 -1
  33. package/dist/internal/icons.d.ts +2 -0
  34. package/dist/internal/icons.js +2 -2
  35. package/dist/internal/localization-types.d.ts +1 -1
  36. package/dist/internal/localization.js +1 -1
  37. package/dist/internal/package-metadata.d.ts +1 -1
  38. package/dist/internal/package-metadata.js +1 -1
  39. package/dist/lyra.d.ts +1 -1
  40. package/dist/svelte.d.ts +1 -1
  41. package/dist/translations/ar.js +1 -1
  42. package/dist/translations/de.js +1 -1
  43. package/dist/translations/es.js +1 -1
  44. package/dist/translations/fa.js +1 -1
  45. package/dist/translations/fr.js +1 -1
  46. package/dist/translations/he.js +1 -1
  47. package/dist/translations/ja.js +1 -1
  48. package/dist/translations/pt-BR.js +1 -1
  49. package/dist/translations/ru.js +1 -1
  50. package/dist/translations/zh-CN.js +1 -1
  51. package/dist/vue.d.ts +1 -1
  52. package/llms/components/lr-accordion-item.md +36 -0
  53. package/llms/components/lr-accordion.md +36 -0
  54. package/llms/components/lr-bar-chart.md +5 -2
  55. package/llms/components/lr-bubble-chart.md +5 -2
  56. package/llms/components/lr-button.md +5 -0
  57. package/llms/components/lr-chart.md +67 -3
  58. package/llms/components/lr-checkbox.md +3 -1
  59. package/llms/components/lr-date-input.md +19 -33
  60. package/llms/components/lr-date-picker.md +19 -33
  61. package/llms/components/lr-details.md +36 -0
  62. package/llms/components/lr-doughnut-chart.md +5 -2
  63. package/llms/components/lr-heatmap.md +63 -4
  64. package/llms/components/lr-histogram.md +7 -3
  65. package/llms/components/lr-line-chart.md +5 -2
  66. package/llms/components/lr-locale-picker.md +16 -2
  67. package/llms/components/lr-map.md +131 -4
  68. package/llms/components/lr-pie-chart.md +5 -2
  69. package/llms/components/lr-polar-area-chart.md +5 -2
  70. package/llms/components/lr-radar-chart.md +5 -2
  71. package/llms/components/lr-scatter-chart.md +5 -2
  72. package/llms/components/lr-slider.md +20 -4
  73. package/llms/components/lr-table.md +10 -4
  74. package/llms-full.txt +439 -56
  75. package/package.json +3 -3
  76. package/vscode-css-data.json +1 -1
  77. package/vscode-html-data.json +1 -1
  78. 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="sort-icon" data-dir=${this.sortDir} aria-hidden="true">${chevronIcon()}</span>`:nothing}
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. When host `aria-controls` names elements in the host's own root, the controls
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};
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{--_lr-checkbox-box-size:min(var(--lr-icon-button-size), calc(var(--lr-form-control-height) * .7));--_lr-checkbox-label-indent:calc(var(--lr-checkbox-box-size,var(--_lr-checkbox-box-size)) + var(--lr-space-s));display:inline-block}.checkbox-layout{cursor:pointer;-webkit-tap-highlight-color:transparent;align-items:center;gap:0;display:inline-flex}.checkbox-owner{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);justify-content:center;align-items:center;display:inline-flex}.checkbox-owner:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}:host(:disabled) .checkbox-layout{cursor:not-allowed;opacity:var(--lr-opacity-disabled)}[part~=box]{box-sizing:border-box;min-inline-size:var(--lr-checkbox-box-size,var(--_lr-checkbox-box-size));min-block-size:var(--lr-checkbox-box-size,var(--_lr-checkbox-box-size));font-size:var(--lr-form-control-font-size);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:calc(var(--lr-form-control-radius) * .6);background:var(--lr-color-surface);color:var(--lr-color-on-brand);transition:background-color var(--lr-transition-fast), border-color var(--lr-transition-fast);flex:none;justify-content:center;align-items:center;display:inline-flex}:host(:not(:disabled)) .checkbox-layout:hover [part~=box]{border-color:var(--lr-checkbox-hover-border,var(--lr-color-brand))}:host(:not(:disabled)) .checkbox-layout:active [part~=box]{border-color:var(--lr-checkbox-active-border,var(--lr-color-brand));box-shadow:0 0 0 var(--lr-border-width-medium) var(--lr-checkbox-active-ring,var(--lr-color-brand-quiet))}[part~=checked],[part~=indeterminate]{background:var(--lr-checkbox-checked-bg,var(--lr-color-brand));border-color:var(--lr-checkbox-checked-border,var(--lr-color-brand))}:host([data-invalid]) [part~=box]{border-color:var(--lr-checkbox-invalid-border,var(--lr-color-danger))}[part~=checkmark]{color:var(--checked-icon-color,currentColor);transform:scale(var(--checked-icon-scale,1));display:block}[part=label]{font-size:var(--lr-font-size-md-sm);color:var(--lr-color-text);margin-inline-start:calc(var(--lr-checkbox-label-indent,var(--_lr-checkbox-label-indent)) - max(var(--lr-icon-button-size), var(--lr-checkbox-box-size,var(--_lr-checkbox-box-size))))}[part~=hint]{color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm);margin-block-start:var(--lr-space-xs);margin-inline-start:var(--lr-checkbox-label-indent,var(--_lr-checkbox-label-indent))}[part~=hint][hidden]{display:none}[part=error]{color:var(--lr-color-danger);font-size:var(--lr-font-size-sm);margin-block-start:var(--lr-space-xs);margin-inline-start:var(--lr-checkbox-label-indent,var(--_lr-checkbox-label-indent))}[part=error][hidden]{display:none}[part=form-control],[part=label],[part~=hint],[part=error]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%}@media (prefers-reduced-motion:reduce){[part~=box]{transition:none!important}}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{--_lr-checkbox-box-size:min(var(--lr-icon-button-size), calc(var(--lr-form-control-height) * .7));--_lr-checkbox-label-indent:calc(var(--lr-checkbox-box-size,var(--_lr-checkbox-box-size)) + var(--lr-space-s));display:inline-block}.checkbox-layout{cursor:pointer;-webkit-tap-highlight-color:transparent;align-items:center;gap:0;display:inline-flex}.checkbox-owner{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);justify-content:flex-start;align-items:center;display:inline-flex}.checkbox-owner:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}:host(:disabled) .checkbox-layout{cursor:not-allowed;opacity:var(--lr-opacity-disabled)}[part~=box]{box-sizing:border-box;min-inline-size:var(--lr-checkbox-box-size,var(--_lr-checkbox-box-size));min-block-size:var(--lr-checkbox-box-size,var(--_lr-checkbox-box-size));font-size:var(--lr-form-control-font-size);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:calc(var(--lr-form-control-radius) * .6);background:var(--lr-color-surface);color:var(--lr-color-on-brand);transition:background-color var(--lr-transition-fast), border-color var(--lr-transition-fast);flex:none;justify-content:center;align-items:center;display:inline-flex}:host(:not(:disabled)) .checkbox-layout:hover [part~=box]{border-color:var(--lr-checkbox-hover-border,var(--lr-color-brand))}:host(:not(:disabled)) .checkbox-layout:active [part~=box]{border-color:var(--lr-checkbox-active-border,var(--lr-color-brand));box-shadow:0 0 0 var(--lr-border-width-medium) var(--lr-checkbox-active-ring,var(--lr-color-brand-quiet))}[part~=checked],[part~=indeterminate]{background:var(--lr-checkbox-checked-bg,var(--lr-color-brand));border-color:var(--lr-checkbox-checked-border,var(--lr-color-brand))}:host([data-invalid]) [part~=box]{border-color:var(--lr-checkbox-invalid-border,var(--lr-color-danger))}[part~=checkmark]{color:var(--checked-icon-color,currentColor);transform:scale(var(--checked-icon-scale,1));display:block}[part=label]{font-size:var(--lr-font-size-md-sm);color:var(--lr-color-text);margin-inline-start:calc(var(--lr-checkbox-label-indent,var(--_lr-checkbox-label-indent)) - max(var(--lr-icon-button-size), var(--lr-checkbox-box-size,var(--_lr-checkbox-box-size))))}[part~=hint]{color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm);margin-block-start:var(--lr-space-xs);margin-inline-start:var(--lr-checkbox-label-indent,var(--_lr-checkbox-label-indent))}[part~=hint][hidden]{display:none}[part=error]{color:var(--lr-color-danger);font-size:var(--lr-font-size-sm);margin-block-start:var(--lr-space-xs);margin-inline-start:var(--lr-checkbox-label-indent,var(--_lr-checkbox-label-indent))}[part=error][hidden]{display:none}[part=form-control],[part=label],[part~=hint],[part=error]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%}@media (prefers-reduced-motion:reduce){[part~=box]{transition:none!important}}`;export{styles};
@@ -28,8 +28,8 @@ observedAttributes?:string[];checkValidity:(input:never)=>LyraDateInputObjectVal
28
28
  * pointer/keyboard toggle rather than carrying the only popup relationship.
29
29
  *
30
30
  * `size` uses the same `2xs`–`xl` scale as `lr-input`/`lr-select`/`lr-combobox`'s own `size`,
31
- * default `m`. The calendar-toggle and clear buttons keep a constant touch-target size at every
32
- * tier (mirroring `lr-input`'s own password-toggle button), so only the field's density scales.
31
+ * default `m`. The calendar-toggle and clear buttons fit within the selected control height
32
+ * while retaining a 24px target. The smallest tiers can grow to accommodate that minimum.
33
33
  * In a constrained row the editable input shrinks first, while each public `start`/`end`
34
34
  * adornment is capped at 40% so unbroken consumer content cannot widen the field.
35
35
  *
@@ -74,9 +74,9 @@ observedAttributes?:string[];checkValidity:(input:never)=>LyraDateInputObjectVal
74
74
  * @csspart preset-button - One quick-range button, forwarded from `<lr-date-picker>`.
75
75
  * @csspart hint - The hint message.
76
76
  * @csspart error - The validation message.
77
- * @cssprop [--lr-date-input-padding-block=var(--lr-space-xs)] - Block padding of the input row, scaled by `size`.
78
- * @cssprop [--lr-date-input-padding-inline=var(--lr-space-s)] - Inline padding of the input row, scaled by `size`.
79
- * @cssprop [--lr-date-input-font-size=inherit] - Font size of the text input, scaled by `size`.
77
+ * @cssprop [--lr-date-input-padding-block=var(--lr-form-control-padding-block)] - Text input block padding, scaled by `size`.
78
+ * @cssprop [--lr-date-input-padding-inline=var(--lr-form-control-padding-inline)] - Inline padding of the input row, scaled by `size`.
79
+ * @cssprop [--lr-date-input-font-size=var(--lr-form-control-font-size)] - Font size of the text input, scaled by `size`.
80
80
  * @cssprop [--lr-date-input-placeholder-color=var(--lr-color-text-quiet)] - Placeholder text color.
81
81
  * @cssprop [--lr-date-input-gap=var(--lr-space-xs)] - Gap between input-row children.
82
82
  * @cssprop [--lr-date-input-radius=var(--lr-radius)] - Input-row corner radius. `pill` changes its
@@ -90,9 +90,8 @@ observedAttributes?:string[];checkValidity:(input:never)=>LyraDateInputObjectVal
90
90
  * @cssprop [--lr-date-input-action-active-radius=var(--lr-date-input-radius)] - Clear/calendar action corner radius while pressed.
91
91
  * @cssprop [--lr-date-input-control-min-height=var(--lr-form-control-height)] - Minimum block size
92
92
  * of the input row, read from the shared form-control height ladder so retuning
93
- * `--lr-theme-form-control-height-*` moves this control and every sibling field together. Each
94
- * default sits below the row's transitively-pinned height, so it is dead until a consumer raises
95
- * it -- the unset render is unchanged.
93
+ * `--lr-theme-form-control-height-*` moves this control and every sibling field together.
94
+ * The smallest tiers can grow to fit the action buttons' 24px minimum and row borders.
96
95
  * @cssprop --lr-date-input-control-height - Exact block size of the input row. Undeclared by
97
96
  * default, so the row grows to fit its content (floored by `--lr-date-input-control-min-height`).
98
97
  * Set it to pin a fixed height; the calendar toggle keeps its own 24x24 touch target even when
@@ -1 +1 @@
1
- import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; --_lr-date-input-padding-block: var(--lr-space-xs); --_lr-date-input-padding-inline: var(--lr-space-s); --_lr-date-input-font-size: inherit; --_lr-date-input-gap: var(--lr-space-xs); --_lr-date-input-radius: var(--lr-form-control-radius); --_lr-date-input-fill: var(--lr-color-surface); --_lr-date-input-border-color: var(--lr-color-border); --_lr-date-input-control-min-height: var(--lr-form-control-height); } :host([pill]) { --_lr-date-input-radius: var(--lr-radius-pill); } [part="date-input"], [part="base"] { display: block; min-inline-size: 0; max-inline-size: 100%; } :host([appearance="filled"]) { --_lr-date-input-border-color: transparent; --_lr-date-input-fill: var(--lr-color-surface-raised); } :host([appearance="filled-outlined"]) { --_lr-date-input-fill: var(--lr-color-surface-raised); } :host([size="2xs"]) { --_lr-date-input-padding-block: var(--lr-size-0-0625rem); --_lr-date-input-padding-inline: var(--lr-space-2xs); --_lr-date-input-font-size: var(--lr-font-size-2xs); } :host([size="xs"]) { --_lr-date-input-padding-block: var(--lr-size-0-125rem); --_lr-date-input-padding-inline: var(--lr-space-xs); --_lr-date-input-font-size: var(--lr-font-size-xs); } :host([size="s"]), :host([size="small"]) { --_lr-date-input-padding-block: var(--lr-space-xs); --_lr-date-input-padding-inline: var(--lr-space-xs); --_lr-date-input-font-size: var(--lr-font-size-sm); } :host([size="l"]), :host([size="large"]) { --_lr-date-input-padding-block: var(--lr-space-m); --_lr-date-input-padding-inline: var(--lr-space-m); --_lr-date-input-font-size: var(--lr-font-size-lg); } :host([size="xl"]) { --_lr-date-input-padding-block: var(--lr-space-l); --_lr-date-input-padding-inline: var(--lr-space-l); --_lr-date-input-font-size: var(--lr-font-size-xl); } [part="form-control-label"] { display: block; margin-block-end: var(--lr-space-xs); font-size: var(--lr-font-size-md-sm); font-weight: var(--lr-font-weight-semibold); } [part="form-control-label"][hidden] { display: none; } ${formControlRequiredMarker} [part='input-wrapper'] { display: flex; align-items: center; gap: var(--lr-date-input-gap, var(--_lr-date-input-gap)); inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box; min-block-size: var( --lr-date-input-control-height, var( --lr-date-input-control-min-height, var(--_lr-date-input-control-min-height) ) ); block-size: var(--lr-date-input-control-height, auto); padding: var( --lr-date-input-padding-block, var(--_lr-date-input-padding-block) ) var(--lr-date-input-padding-inline, var(--_lr-date-input-padding-inline)); border: var(--lr-border-width-thin) solid var(--_lr-date-input-border-color); border-radius: var(--lr-date-input-radius, var(--_lr-date-input-radius)); background: var(--_lr-date-input-fill); } [part="input-wrapper"]:focus-within { border-color: var( --lr-date-input-focus-border-color, var(--lr-color-brand) ); } :host(:disabled) [part="input-wrapper"] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part="input"] { flex: 1 1 auto; min-inline-size: 0; border: none; outline: none; background: transparent; color: inherit; font: inherit; font-size: var(--lr-date-input-font-size, var(--_lr-date-input-font-size)); } [part="form-control-input"], [part="segment"] { display: contents; } [part="input"]::placeholder { color: var(--lr-date-input-placeholder-color, var(--lr-color-text-quiet)); } [part="start"], [part="end"] { flex: 0 1 40%; display: inline-flex; min-inline-size: 0; max-inline-size: 40%; align-items: center; color: var(--lr-color-text-quiet); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part="start"][hidden], [part="end"][hidden] { display: none; } [part="clear-button"], [part="expand-button"] { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; cursor: pointer; color: var(--lr-color-text-quiet); padding: var(--lr-space-xs); min-inline-size: var(--lr-icon-button-size); min-block-size: var(--lr-icon-button-size); line-height: var(--lr-line-height-none); font-size: var(--lr-font-size-m); } [part="clear-button"]:hover:not(:disabled), [part="expand-button"]:hover:not(:disabled) { color: var(--lr-date-input-action-hover-color, var(--lr-color-text)); background: var(--lr-date-input-action-hover-bg, transparent); border-radius: var( --lr-date-input-action-hover-radius, var(--lr-date-input-radius, var(--_lr-date-input-radius)) ); } [part="clear-button"]:active:not(:disabled), [part="expand-button"]:active:not(:disabled) { color: var( --lr-date-input-action-active-color, var(--lr-date-input-action-hover-color, var(--lr-color-text)) ); background: var( --lr-date-input-action-active-bg, color-mix( in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); border-radius: var( --lr-date-input-action-active-radius, var(--lr-date-input-radius, var(--_lr-date-input-radius)) ); } [part="clear-button"]:focus-visible, [part="expand-button"]:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: var(--lr-focus-ring-offset); } [part="popup"] { position: fixed; z-index: var(--lr-overlay-stack-index, var(--lr-layer-dropdown)); max-inline-size: min( var(--lr-popover-viewport-clamp), var(--lr-size-28rem) ); visibility: hidden; opacity: 0; transform: translateY(var(--lr-size-neg-0-25rem)); transition-property: opacity, transform, visibility; transition-duration: var(--hide-duration, var(--lr-transition-fast)); } :host([open]) [part="popup"] { visibility: visible; opacity: 1; transform: translateY(0); transition-duration: var(--show-duration, var(--lr-transition-fast)); } @media (prefers-reduced-motion: reduce) { [part="popup"] { transition: none !important; } } [part="hint"] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); color: var(--lr-color-text-quiet); } [part="hint"][hidden] { display: none; } [part="error"] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); color: var(--lr-color-danger); } [part="error"][hidden] { display: none; } [part="form-control"], [part="form-control-label"], [part="hint"], [part="error"] { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } `;export{styles};
1
+ import{css}from"lit";import{formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; --_lr-date-input-padding-block: var(--lr-form-control-padding-block); --_lr-date-input-padding-inline: var(--lr-form-control-padding-inline); --_lr-date-input-font-size: var(--lr-form-control-font-size); --_lr-date-input-gap: var(--lr-space-xs); --_lr-date-input-radius: var(--lr-form-control-radius); --_lr-date-input-fill: var(--lr-color-surface); --_lr-date-input-border-color: var(--lr-color-border); --_lr-date-input-control-min-height: var(--lr-form-control-height); } :host([pill]) { --_lr-date-input-radius: var(--lr-radius-pill); } [part="date-input"], [part="base"] { display: block; min-inline-size: 0; max-inline-size: 100%; } :host([appearance="filled"]) { --_lr-date-input-border-color: transparent; --_lr-date-input-fill: var(--lr-color-surface-raised); } :host([appearance="filled-outlined"]) { --_lr-date-input-fill: var(--lr-color-surface-raised); } [part="form-control-label"] { display: block; margin-block-end: var(--lr-space-xs); font-size: var(--lr-font-size-md-sm); font-weight: var(--lr-font-weight-semibold); } [part="form-control-label"][hidden] { display: none; } ${formControlRequiredMarker} [part='input-wrapper'] { display: flex; align-items: center; gap: var(--lr-date-input-gap, var(--_lr-date-input-gap)); inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box; min-block-size: var( --lr-date-input-control-height, var( --lr-date-input-control-min-height, var(--_lr-date-input-control-min-height) ) ); block-size: var(--lr-date-input-control-height, auto); padding-inline: var(--lr-date-input-padding-inline, var(--_lr-date-input-padding-inline)); border: var(--lr-border-width-thin) solid var(--_lr-date-input-border-color); border-radius: var(--lr-date-input-radius, var(--_lr-date-input-radius)); background: var(--_lr-date-input-fill); } [part="input-wrapper"]:focus-within { border-color: var( --lr-date-input-focus-border-color, var(--lr-color-brand) ); } :host(:disabled) [part="input-wrapper"] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part="input"] { flex: 1 1 auto; min-inline-size: 0; padding-block: var(--lr-date-input-padding-block, var(--_lr-date-input-padding-block)); border: none; outline: none; background: transparent; color: inherit; font: inherit; font-size: var(--lr-date-input-font-size, var(--_lr-date-input-font-size)); } [part="form-control-input"], [part="segment"] { display: contents; } [part="input"]::placeholder { color: var(--lr-date-input-placeholder-color, var(--lr-color-text-quiet)); } [part="start"], [part="end"] { flex: 0 1 40%; display: inline-flex; min-inline-size: 0; max-inline-size: 40%; align-items: center; color: var(--lr-color-text-quiet); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part="start"][hidden], [part="end"][hidden] { display: none; } [part="clear-button"], [part="expand-button"] { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; cursor: pointer; color: var(--lr-color-text-quiet); padding: var(--lr-space-xs); min-inline-size: max(var(--lr-size-24px), min(var(--lr-icon-button-size), calc(var(--lr-form-control-height) - 2 * var(--lr-border-width-thin)))); min-block-size: max(var(--lr-size-24px), min(var(--lr-icon-button-size), calc(var(--lr-form-control-height) - 2 * var(--lr-border-width-thin)))); line-height: var(--lr-line-height-none); font-size: var(--lr-font-size-m); } [part='expand-icon'], [part='clear-button'] > span { display: inline-flex; align-items: center; } [part="clear-button"]:hover:not(:disabled), [part="expand-button"]:hover:not(:disabled) { color: var(--lr-date-input-action-hover-color, var(--lr-color-text)); background: var(--lr-date-input-action-hover-bg, transparent); border-radius: var( --lr-date-input-action-hover-radius, var(--lr-date-input-radius, var(--_lr-date-input-radius)) ); } [part="clear-button"]:active:not(:disabled), [part="expand-button"]:active:not(:disabled) { color: var( --lr-date-input-action-active-color, var(--lr-date-input-action-hover-color, var(--lr-color-text)) ); background: var( --lr-date-input-action-active-bg, color-mix( in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); border-radius: var( --lr-date-input-action-active-radius, var(--lr-date-input-radius, var(--_lr-date-input-radius)) ); } [part="clear-button"]:focus-visible, [part="expand-button"]:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: var(--lr-focus-ring-offset); } [part="popup"] { position: fixed; z-index: var(--lr-overlay-stack-index, var(--lr-layer-dropdown)); max-inline-size: min( var(--lr-popover-viewport-clamp), var(--lr-size-28rem) ); visibility: hidden; opacity: 0; transform: translateY(var(--lr-size-neg-0-25rem)); transition-property: opacity, transform, visibility; transition-duration: var(--hide-duration, var(--lr-transition-fast)); } :host([open]) [part="popup"] { visibility: visible; opacity: 1; transform: translateY(0); transition-duration: var(--show-duration, var(--lr-transition-fast)); } @media (prefers-reduced-motion: reduce) { [part="popup"] { transition: none !important; } } [part="hint"] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); color: var(--lr-color-text-quiet); } [part="hint"][hidden] { display: none; } [part="error"] { margin-block-start: var(--lr-space-xs); font-size: var(--lr-font-size-sm); color: var(--lr-color-danger); } [part="error"][hidden] { display: none; } [part="form-control"], [part="form-control-label"], [part="hint"], [part="error"] { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } `;export{styles};
@@ -24,6 +24,8 @@ readonly country?:string;}
24
24
  * no per-row flag override available) or `{ tag, label, country }` rows for custom
25
25
  * labels/ordering/subsets/flag overrides. */
26
26
  export type LyraLocaleCatalog=readonly string[]|readonly LyraLocaleEntry[];
27
+ /** Visible content of the locale picker's trigger; option labels are always retained. */
28
+ export type LyraLocaleTriggerDisplay='flag'|'label'|'flag-label';
27
29
  /** `lr-change`'s detail. `direction` is the picked locale's writing direction, resolved through
28
30
  * `getLyraLocaleDirection()` — the component never applies it (see the class doc), it just hands
29
31
  * the host the one fact it would otherwise need its own locale table to know. */
@@ -91,7 +93,9 @@ export interface LyraLocaleChangeDetail{value:string;previousValue:string;direct
91
93
  * the accessible name — once `label` is non-empty).
92
94
  * @csspart trigger - The trigger button (positioning anchor).
93
95
  * @csspart trigger-flag - The trigger's leading `<lr-flag>` for the current value (present only
94
- * while `showFlags` is on).
96
+ * while `showFlags` is on and `triggerDisplay` is not `label`).
97
+ * @csspart trigger-label - The current locale's label. Visually hidden in flag-only mode but
98
+ * retained as the trigger's accessible current-value description.
95
99
  * @csspart listbox - The options popover.
96
100
  * @csspart option - An option row.
97
101
  * @csspart option-flag - The row's leading `<lr-flag>` (present only while `showFlags` is on).
@@ -149,7 +153,13 @@ private _locales?;get locales():LyraLocaleCatalog|undefined;set locales(next:Lyr
149
153
  /** Each row's leading `<lr-flag>`. The composition recipe this component supersedes
150
154
  * (`lr-popover` + `lr-flag`) already pairs a locale switcher with flags by convention --
151
155
  * defaulting to `true` keeps that continuity; set `false` for text-only rows. */
152
- showFlags:boolean;label:string;hint:string;errorText:string;
156
+ showFlags:boolean;
157
+ /** Trigger content. The default flag-label preserves the label, optional flag and chevron.
158
+ * Flag mode centers the flag in a square based on the trigger height, with a 24px minimum,
159
+ * and keeps the current language accessible while hiding the visible label and chevron.
160
+ * Label mode omits only the trigger flag. showFlags=false always keeps the visible label.
161
+ * Option labels/endonyms and selection behavior are unchanged. */
162
+ triggerDisplay:LyraLocaleTriggerDisplay;label:string;hint:string;errorText:string;
153
163
  /** Whether the option popup is open. Disabled controls reject direct reopen attempts, including
154
164
  * the synchronous fieldset cascade before `formDisabledCallback()` runs. */
155
165
  get open():boolean;set open(next:boolean);
@@ -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{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{getLyraLocaleDirection,getRegisteredLyraLocales,subscribeLyraLocaleRegistry,setLyraLocale}from"../../../internal/localization-runtime.js";import{localeNativeName}from"../../media/flag/language-map.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./locale-picker.styles.js";import{declaredDefaultConverter,trueDefaultBooleanFromAttributeConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_localePickerLabel,LYRA_DEFAULT_localePickerRequired}from"../../../internal/default-strings.generated.js";const MAX_LOCALE_ENTRIES=512;function snapshotLocaleCatalog(source){if(!Array.isArray(source))return Object.freeze([]);const rows=[];for(let index=0;index<Math.min(source.length,MAX_LOCALE_ENTRIES);index+=1)try{const raw=source[index];if(typeof raw=="string"){raw.length>0&&rows.push(raw);continue}if(raw===null||typeof raw!="object")continue;const candidate=raw,tag=candidate.tag,label=candidate.label,country=candidate.country;if(typeof tag!="string"||tag.length===0||label!==void 0&&typeof label!="string"||country!==void 0&&typeof country!="string")continue;rows.push(Object.freeze({tag,...label===void 0?{}:{label},...country===void 0?{}:{country}}))}catch{}return Object.freeze(rows)}class LyraLocalePicker extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,localePickerLabel:LYRA_DEFAULT_localePickerLabel,localePickerRequired:LYRA_DEFAULT_localePickerRequired}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0}}}get locales(){return this._locales}set locales(next){const previous=this._locales;this._locales=next===void 0?void 0:snapshotLocaleCatalog(next),this.requestUpdate("locales",previous)}get open(){return this._open}set open(next){const old=this._open,liveDisabled=this.effectiveDisabled||typeof this.matches=="function"&&this.matches(":disabled");if(this._open=!!next&&!liveDisabled,this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this._open||(this.activeIndex=-1),this.requestUpdate("open",old)}constructor(){super(),this.showFlags=!0,this.label="",this.hint="",this.errorText="",this.size="m",this.activeIndex=-1,this.touched=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.hasLabelSlot=!1,this.registryTick=0,this.listId=nextId("locale-picker-list"),this.controlId=nextId("locale-picker-control"),this._value="",this._open=!1,this._fieldsetDisabled=!1,this._name="",this._disabled=!1,this._required=!1,this._defaultValue="",this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this.typeAheadBuffer="",this.typeAheadTimerGeneration=0,this.activeScrollGeneration=0,this.localizedValidityLocale="",this.localizedIntrinsicMessage="",this.localDescriptionIds="",this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.hide()}},this.onTriggerClick=()=>{this.liveDisabled||(this.open?this.hide():this.show())},this.onTriggerBlur=event=>{this.liveDisabled||(this.touched=!0),this.syncCustomStates(),this.hide(),relayNativeEvent(this,event)},this.onTriggerFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onLabelSlotChange=e=>{this.hasLabelSlot=e.target.assignedElements({flatten:!0}).length>0},this.onHintSlotChange=e=>{this.hasHintSlot=e.target.assignedElements({flatten:!0}).length>0},this.onErrorSlotChange=e=>{this.hasErrorSlot=e.target.assignedElements({flatten:!0}).length>0},this.onKeyDown=e=>{if(this.liveDisabled)return;const rows=this.normalizedEntries;switch(e.key){case"ArrowDown":if(e.preventDefault(),!this.open)return this.show();this.setActiveIndex(Math.min(rows.length-1,this.activeIndex+1));break;case"ArrowUp":if(e.preventDefault(),!this.open)return this.show();this.setActiveIndex(Math.max(0,this.activeIndex-1));break;case"Enter":case" ":if(this.open){e.preventDefault();const activeRow=rows[this.activeIndex];this.activeIndex>=0&&activeRow?this.commit(activeRow.tag):this.hide()}break;case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.dismissFromEscape());break;case"Home":this.open&&(e.preventDefault(),this.setActiveIndex(0));break;case"End":this.open&&(e.preventDefault(),this.setActiveIndex(rows.length-1));break;default:e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&this.typeAhead(e.key);break}},this.onListboxMouseDown=e=>{e.target.closest('[part="option"]')&&e.preventDefault()},this.onListboxClick=e=>{if(this.liveDisabled)return;const tag=e.target.closest('[part="option"]')?.dataset.value;tag!==void 0&&this.commit(tag)},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.internals.setFormValue("")}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}focus(options){this.liveDisabled||this.triggerElement?.focus(options)}blur(){this.triggerElement?.blur()}click(){this.liveDisabled||this.triggerElement?.click()}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}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part="trigger"]')??null}syncExternalDescription(){if(!this.isConnected)return;const target=this.triggerElement??null;target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds))}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.syncLocaleAttributeForLocalization(),this.updateValidity(),this.stopRegistrySubscription=subscribeLyraLocaleRegistry(()=>{this.registryTick+=1}),this.hasUpdated&&this.open&&queueMicrotask(()=>this.syncPopup())}disconnectedCallback(){this.releaseExternalDescription(),super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.deactivatePopupOverlay(!1),this.stopRegistrySubscription?.(),this.stopRegistrySubscription=void 0,this.clearTypeAheadTimer(),this.activeScrollGeneration+=1,this.typeAheadBuffer="",this.open=!1}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.cleanup?.(),this.cleanup=void 0,this.unbindDocumentPointer(),this.overlayHandle?.suspend(),this.clearTypeAheadTimer(),this.open&&queueMicrotask(()=>this.syncPopup())}willUpdate(changed){super.willUpdate(changed),changed.has("locale")&&this.syncLocaleAttributeForLocalization(),this.hasUpdated&&this.refreshLocalizedIntrinsicValidity(changed),this.open&&(changed.has("locales")||changed.has("registryTick"))&&this.activeIndex>=0&&(this.activeIndex=Math.min(this.activeIndex,this.normalizedEntries.length-1),this.queueActiveScroll()),this.hasUpdated||(this.hasHintSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="hint"),this.hasErrorSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="error"),this.hasLabelSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="label"))}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0),this._value=next??"",this.internals.setFormValue(this._value),this.updateValidity(),this.requestUpdate("value",old)}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=next??"",this.reflectingDefaultValue=!0;try{this._defaultValue?this.setAttribute("value",this._defaultValue):this.removeAttribute("value")}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}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 disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._disabled&&this.hide(),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}updateValidity(){this.localizedValidityLocale=this.effectiveMessageLocale;const valueMissing=this.hasMissingRequiredValue(),message=valueMissing?this.localize("localePickerRequired"):"";this.localizedIntrinsicMessage=message,valueMissing?this.validityController.setValidity({valueMissing:!0},message):this.validityController.setValidity({}),this.syncCustomStates()}refreshLocalizedIntrinsicValidity(changed){const locale=this.effectiveMessageLocale,message=this.hasMissingRequiredValue()?this.localize("localePickerRequired"):"";(changed.has("strings")||locale!==this.localizedValidityLocale||message!==this.localizedIntrinsicMessage)&&this.updateValidity()}hasMissingRequiredValue(){return!this.isBarred()&&this.required&&!this._value}syncLocaleAttributeForLocalization(){this.locale?this.getAttribute("locale")!==this.locale&&this.setAttribute("locale",this.locale):this.hasAttribute("locale")&&this.removeAttribute("locale")}isBarred(){return isBarredFromValidation(this,this.internals)}syncCustomStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred:this.isBarred()})}formResetCallback(){this.touched=!1,this.restoreLiveValueFromDefault()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=this._defaultValue}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state2,_mode){this.value=typeof state2=="string"?state2:""}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,disabled&&this.hide(),this.updateValidity(),this.requestUpdate()}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.touched=!0,this.syncCustomStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates(),this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),this.requestUpdate()}get normalizedEntries(){const raw=this.locales;return raw!==void 0?raw.map(entry=>typeof entry=="string"?{tag:entry,label:localeNativeName(entry)}:{tag:entry.tag,label:entry.label??localeNativeName(entry.tag),country:entry.country}):getRegisteredLyraLocales().map(tag=>({tag,label:localeNativeName(tag)}))}get previewTag(){return this._value||this.effectiveLocale}entryFor(tag){return this.normalizedEntries.find(e=>e.tag===tag)}labelFor(tag){return this.entryFor(tag)?.label??localeNativeName(tag)}show(){this.open||this.liveDisabled||(this.open=!0)}hide(){this.open&&(this.open=!1,this.setActiveIndex(-1))}dismissFromEscape(){this.open&&(this.deactivatePopupOverlay(!0),this.hide())}bindDocumentPointer(){if(!this.isConnected)return;const ownerDocument=this.ownerDocument;if(this.pointerListenerDocument===ownerDocument&&this.pointerListener)return;this.unbindDocumentPointer();const listener=event=>{this.pointerListener!==listener||this.pointerListenerDocument!==ownerDocument||!this.isConnected||this.ownerDocument!==ownerDocument||this.onDocPointer(event)};this.pointerListenerDocument=ownerDocument,this.pointerListener=listener,ownerDocument.addEventListener("pointerdown",listener)}unbindDocumentPointer(){this.pointerListenerDocument&&this.pointerListener&&this.pointerListenerDocument.removeEventListener("pointerdown",this.pointerListener),this.pointerListenerDocument=void 0,this.pointerListener=void 0}activatePopupOverlay(){if(this.overlayHandle?.isActive()){this.overlayHandle.resume();return}this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>this.dismissFromEscape(),onBackdrop:()=>this.hide(),restoreFocusTo:()=>this.renderRoot.querySelector('[part="trigger"]')})}deactivatePopupOverlay(restoreFocus){const overlay=this.overlayHandle;this.overlayHandle=void 0,overlay?.deactivate({restoreFocus}),this.unbindDocumentPointer()}syncPopup(){if(this.cleanup?.(),this.cleanup=void 0,!this.open||!this.isConnected){this.deactivatePopupOverlay(!1);return}this.activatePopupOverlay(),this.bindDocumentPointer();const anchor=this.renderRoot.querySelector('[part="trigger"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');anchor&&listbox&&(this.cleanup=place(anchor,listbox))}updated(changed){super.updated(changed),this.syncExternalDescription(),(changed.has("open")||this.open&&(changed.has("locales")||changed.has("registryTick")||changed.has("locale")))&&this.syncPopup(),(changed.has("touched")||changed.has("required")||changed.has("value"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid)}commit(tag){const previousValue=this._value;this.value=tag,this.hide(),this.emit("lr-change",{value:tag,previousValue,direction:getLyraLocaleDirection(tag)},{cancelable:!0}).defaultPrevented||setLyraLocale(tag)}typeAhead(char){this.clearTypeAheadTimer(),this.typeAheadBuffer+=char.toLocaleLowerCase(this.effectiveLocale);const ownerWindow=this.ownerDocument.defaultView;if(this.isConnected&&ownerWindow){const generation=this.typeAheadTimerGeneration;this.typeAheadTimerWindow=ownerWindow,this.typeAheadTimer=ownerWindow.setTimeout(()=>{this.typeAheadTimerGeneration!==generation||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow||(this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0,this.typeAheadBuffer="")},500)}const rows=this.normalizedEntries;if(!rows.length)return;const currentTag=this.open?rows[this.activeIndex]?.tag:this.previewTag,currentIndex=rows.findIndex(r=>r.tag===currentTag),n=rows.length;for(let step=1;step<=n;step++){const idx=(currentIndex+step+n)%n,row=rows[idx];if(row&&row.label.toLocaleLowerCase(this.effectiveLocale).startsWith(this.typeAheadBuffer)){this.open?this.setActiveIndex(idx):this.commit(row.tag);return}}}clearTypeAheadTimer(){this.typeAheadTimerGeneration+=1,this.typeAheadTimer!==void 0&&this.typeAheadTimerWindow?.clearTimeout(this.typeAheadTimer),this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0}setActiveIndex(index){const last=this.normalizedEntries.length-1,next=last<0||index<0?-1:Math.min(last,index);this.activeIndex=next,this.queueActiveScroll()}queueActiveScroll(){const generation=++this.activeScrollGeneration,index=this.activeIndex;index<0||!this.open||this.updateComplete.then(()=>{generation!==this.activeScrollGeneration||!this.isConnected||!this.open||this.activeIndex!==index||this.shadowRoot?.getElementById(`${this.listId}-opt-${index}`)?.scrollIntoView({block:"nearest"})})}renderRows(rows,activeId){return rows.map((entry,i)=>{const id=`${this.listId}-opt-${i}`,selected=entry.tag===this._value;return html`<div
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{acquireNativeControlDescription}from"../../../internal/native-control-description.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{hostAriaLabel,nextId,srOnly}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{activateNonmodalOverlay}from"../../../internal/nonmodal-overlay-manager.js";import{getLyraLocaleDirection,getRegisteredLyraLocales,subscribeLyraLocaleRegistry,setLyraLocale}from"../../../internal/localization-runtime.js";import{localeNativeName}from"../../media/flag/language-map.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./locale-picker.styles.js";import{declaredDefaultConverter,trueDefaultBooleanFromAttributeConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_localePickerLabel,LYRA_DEFAULT_localePickerRequired}from"../../../internal/default-strings.generated.js";const MAX_LOCALE_ENTRIES=512;function snapshotLocaleCatalog(source){if(!Array.isArray(source))return Object.freeze([]);const rows=[];for(let index=0;index<Math.min(source.length,MAX_LOCALE_ENTRIES);index+=1)try{const raw=source[index];if(typeof raw=="string"){raw.length>0&&rows.push(raw);continue}if(raw===null||typeof raw!="object")continue;const candidate=raw,tag=candidate.tag,label=candidate.label,country=candidate.country;if(typeof tag!="string"||tag.length===0||label!==void 0&&typeof label!="string"||country!==void 0&&typeof country!="string")continue;rows.push(Object.freeze({tag,...label===void 0?{}:{label},...country===void 0?{}:{country}}))}catch{}return Object.freeze(rows)}class LyraLocalePicker extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,localePickerLabel:LYRA_DEFAULT_localePickerLabel,localePickerRequired:LYRA_DEFAULT_localePickerRequired}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,srOnly,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0}}}get locales(){return this._locales}set locales(next){const previous=this._locales;this._locales=next===void 0?void 0:snapshotLocaleCatalog(next),this.requestUpdate("locales",previous)}get open(){return this._open}set open(next){const old=this._open,liveDisabled=this.effectiveDisabled||typeof this.matches=="function"&&this.matches(":disabled");if(this._open=!!next&&!liveDisabled,this._open===old){next&&!this._open&&this.hasAttribute("open")&&this.removeAttribute("open");return}this._open||(this.activeIndex=-1),this.requestUpdate("open",old)}constructor(){super(),this.showFlags=!0,this.triggerDisplay="flag-label",this.label="",this.hint="",this.errorText="",this.size="m",this.activeIndex=-1,this.touched=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.hasLabelSlot=!1,this.registryTick=0,this.listId=nextId("locale-picker-list"),this.controlId=nextId("locale-picker-control"),this._value="",this._open=!1,this._fieldsetDisabled=!1,this._name="",this._disabled=!1,this._required=!1,this._defaultValue="",this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this.typeAheadBuffer="",this.typeAheadTimerGeneration=0,this.activeScrollGeneration=0,this.localizedValidityLocale="",this.localizedIntrinsicMessage="",this.localDescriptionIds="",this.onDocPointer=e=>{if(!e.composedPath().includes(this)){if(this.overlayHandle?.isActive()){this.overlayHandle.dismissBackdrop();return}this.hide()}},this.onTriggerClick=()=>{this.liveDisabled||(this.open?this.hide():this.show())},this.onTriggerBlur=event=>{this.liveDisabled||(this.touched=!0),this.syncCustomStates(),this.hide(),relayNativeEvent(this,event)},this.onTriggerFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onLabelSlotChange=e=>{this.hasLabelSlot=e.target.assignedElements({flatten:!0}).length>0},this.onHintSlotChange=e=>{this.hasHintSlot=e.target.assignedElements({flatten:!0}).length>0},this.onErrorSlotChange=e=>{this.hasErrorSlot=e.target.assignedElements({flatten:!0}).length>0},this.onKeyDown=e=>{if(this.liveDisabled)return;const rows=this.normalizedEntries;switch(e.key){case"ArrowDown":if(e.preventDefault(),!this.open)return this.show();this.setActiveIndex(Math.min(rows.length-1,this.activeIndex+1));break;case"ArrowUp":if(e.preventDefault(),!this.open)return this.show();this.setActiveIndex(Math.max(0,this.activeIndex-1));break;case"Enter":case" ":if(this.open){e.preventDefault();const activeRow=rows[this.activeIndex];this.activeIndex>=0&&activeRow?this.commit(activeRow.tag):this.hide()}break;case"Escape":this.open&&(!this.overlayHandle?.isActive()||this.overlayHandle.isTopmost())&&(e.preventDefault(),this.dismissFromEscape());break;case"Home":this.open&&(e.preventDefault(),this.setActiveIndex(0));break;case"End":this.open&&(e.preventDefault(),this.setActiveIndex(rows.length-1));break;default:e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&this.typeAhead(e.key);break}},this.onListboxMouseDown=e=>{e.target.closest('[part="option"]')&&e.preventDefault()},this.onListboxClick=e=>{if(this.liveDisabled)return;const tag=e.target.closest('[part="option"]')?.dataset.value;tag!==void 0&&this.commit(tag)},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.internals.setFormValue("")}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}focus(options){this.liveDisabled||this.triggerElement?.focus(options)}blur(){this.triggerElement?.blur()}click(){this.liveDisabled||this.triggerElement?.click()}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}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part="trigger"]')??null}syncExternalDescription(){if(!this.isConnected)return;const target=this.triggerElement??null;target&&(this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireNativeControlDescription(this,target,()=>this.localDescriptionIds))}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.syncLocaleAttributeForLocalization(),this.updateValidity(),this.stopRegistrySubscription=subscribeLyraLocaleRegistry(()=>{this.registryTick+=1}),this.hasUpdated&&this.open&&queueMicrotask(()=>this.syncPopup())}disconnectedCallback(){this.releaseExternalDescription(),super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.deactivatePopupOverlay(!1),this.stopRegistrySubscription?.(),this.stopRegistrySubscription=void 0,this.clearTypeAheadTimer(),this.activeScrollGeneration+=1,this.typeAheadBuffer="",this.open=!1}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.hasUpdated&&this.syncExternalDescription(),this.cleanup?.(),this.cleanup=void 0,this.unbindDocumentPointer(),this.overlayHandle?.suspend(),this.clearTypeAheadTimer(),this.open&&queueMicrotask(()=>this.syncPopup())}willUpdate(changed){super.willUpdate(changed),changed.has("locale")&&this.syncLocaleAttributeForLocalization(),this.hasUpdated&&this.refreshLocalizedIntrinsicValidity(changed),this.open&&(changed.has("locales")||changed.has("registryTick"))&&this.activeIndex>=0&&(this.activeIndex=Math.min(this.activeIndex,this.normalizedEntries.length-1),this.queueActiveScroll()),this.hasUpdated||(this.hasHintSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="hint"),this.hasErrorSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="error"),this.hasLabelSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="label"))}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0),this._value=next??"",this.internals.setFormValue(this._value),this.updateValidity(),this.requestUpdate("value",old)}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=next??"",this.reflectingDefaultValue=!0;try{this._defaultValue?this.setAttribute("value",this._defaultValue):this.removeAttribute("value")}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}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 disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._disabled&&this.hide(),this.updateValidity(),this.requestUpdate("disabled",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}updateValidity(){this.localizedValidityLocale=this.effectiveMessageLocale;const valueMissing=this.hasMissingRequiredValue(),message=valueMissing?this.localize("localePickerRequired"):"";this.localizedIntrinsicMessage=message,valueMissing?this.validityController.setValidity({valueMissing:!0},message):this.validityController.setValidity({}),this.syncCustomStates()}refreshLocalizedIntrinsicValidity(changed){const locale=this.effectiveMessageLocale,message=this.hasMissingRequiredValue()?this.localize("localePickerRequired"):"";(changed.has("strings")||locale!==this.localizedValidityLocale||message!==this.localizedIntrinsicMessage)&&this.updateValidity()}hasMissingRequiredValue(){return!this.isBarred()&&this.required&&!this._value}syncLocaleAttributeForLocalization(){this.locale?this.getAttribute("locale")!==this.locale&&this.setAttribute("locale",this.locale):this.hasAttribute("locale")&&this.removeAttribute("locale")}isBarred(){return isBarredFromValidation(this,this.internals)}syncCustomStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred:this.isBarred()})}formResetCallback(){this.touched=!1,this.restoreLiveValueFromDefault()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=this._defaultValue}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state2,_mode){this.value=typeof state2=="string"?state2:""}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,disabled&&this.hide(),this.updateValidity(),this.requestUpdate()}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.touched=!0,this.syncCustomStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncCustomStates(),this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid),this.requestUpdate()}get normalizedEntries(){const raw=this.locales;return raw!==void 0?raw.map(entry=>typeof entry=="string"?{tag:entry,label:localeNativeName(entry)}:{tag:entry.tag,label:entry.label??localeNativeName(entry.tag),country:entry.country}):getRegisteredLyraLocales().map(tag=>({tag,label:localeNativeName(tag)}))}get previewTag(){return this._value||this.effectiveLocale}entryFor(tag){return this.normalizedEntries.find(e=>e.tag===tag)}labelFor(tag){return this.entryFor(tag)?.label??localeNativeName(tag)}show(){this.open||this.liveDisabled||(this.open=!0)}hide(){this.open&&(this.open=!1,this.setActiveIndex(-1))}dismissFromEscape(){this.open&&(this.deactivatePopupOverlay(!0),this.hide())}bindDocumentPointer(){if(!this.isConnected)return;const ownerDocument=this.ownerDocument;if(this.pointerListenerDocument===ownerDocument&&this.pointerListener)return;this.unbindDocumentPointer();const listener=event=>{this.pointerListener!==listener||this.pointerListenerDocument!==ownerDocument||!this.isConnected||this.ownerDocument!==ownerDocument||this.onDocPointer(event)};this.pointerListenerDocument=ownerDocument,this.pointerListener=listener,ownerDocument.addEventListener("pointerdown",listener)}unbindDocumentPointer(){this.pointerListenerDocument&&this.pointerListener&&this.pointerListenerDocument.removeEventListener("pointerdown",this.pointerListener),this.pointerListenerDocument=void 0,this.pointerListener=void 0}activatePopupOverlay(){if(this.overlayHandle?.isActive()){this.overlayHandle.resume();return}this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part="listbox"]'),onEscape:()=>this.dismissFromEscape(),onBackdrop:()=>this.hide(),restoreFocusTo:()=>this.renderRoot.querySelector('[part="trigger"]')})}deactivatePopupOverlay(restoreFocus){const overlay=this.overlayHandle;this.overlayHandle=void 0,overlay?.deactivate({restoreFocus}),this.unbindDocumentPointer()}syncPopup(){if(this.cleanup?.(),this.cleanup=void 0,!this.open||!this.isConnected){this.deactivatePopupOverlay(!1);return}this.activatePopupOverlay(),this.bindDocumentPointer();const anchor=this.renderRoot.querySelector('[part="trigger"]'),listbox=this.renderRoot.querySelector('[part="listbox"]');anchor&&listbox&&(this.cleanup=place(anchor,listbox))}updated(changed){super.updated(changed),this.syncExternalDescription(),(changed.has("open")||this.open&&(changed.has("locales")||changed.has("registryTick")||changed.has("locale")))&&this.syncPopup(),(changed.has("touched")||changed.has("required")||changed.has("value"))&&this.toggleAttribute("data-invalid",this.touched&&!this.internals.validity.valid)}commit(tag){const previousValue=this._value;this.value=tag,this.hide(),this.emit("lr-change",{value:tag,previousValue,direction:getLyraLocaleDirection(tag)},{cancelable:!0}).defaultPrevented||setLyraLocale(tag)}typeAhead(char){this.clearTypeAheadTimer(),this.typeAheadBuffer+=char.toLocaleLowerCase(this.effectiveLocale);const ownerWindow=this.ownerDocument.defaultView;if(this.isConnected&&ownerWindow){const generation=this.typeAheadTimerGeneration;this.typeAheadTimerWindow=ownerWindow,this.typeAheadTimer=ownerWindow.setTimeout(()=>{this.typeAheadTimerGeneration!==generation||!this.isConnected||this.ownerDocument.defaultView!==ownerWindow||(this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0,this.typeAheadBuffer="")},500)}const rows=this.normalizedEntries;if(!rows.length)return;const currentTag=this.open?rows[this.activeIndex]?.tag:this.previewTag,currentIndex=rows.findIndex(r=>r.tag===currentTag),n=rows.length;for(let step=1;step<=n;step++){const idx=(currentIndex+step+n)%n,row=rows[idx];if(row&&row.label.toLocaleLowerCase(this.effectiveLocale).startsWith(this.typeAheadBuffer)){this.open?this.setActiveIndex(idx):this.commit(row.tag);return}}}clearTypeAheadTimer(){this.typeAheadTimerGeneration+=1,this.typeAheadTimer!==void 0&&this.typeAheadTimerWindow?.clearTimeout(this.typeAheadTimer),this.typeAheadTimer=void 0,this.typeAheadTimerWindow=void 0}setActiveIndex(index){const last=this.normalizedEntries.length-1,next=last<0||index<0?-1:Math.min(last,index);this.activeIndex=next,this.queueActiveScroll()}queueActiveScroll(){const generation=++this.activeScrollGeneration,index=this.activeIndex;index<0||!this.open||this.updateComplete.then(()=>{generation!==this.activeScrollGeneration||!this.isConnected||!this.open||this.activeIndex!==index||this.shadowRoot?.getElementById(`${this.listId}-opt-${index}`)?.scrollIntoView({block:"nearest"})})}renderRows(rows,activeId){return rows.map((entry,i)=>{const id=`${this.listId}-opt-${i}`,selected=entry.tag===this._value;return html`<div
2
2
  part="option"
3
3
  id=${id}
4
4
  role="option"
@@ -11,7 +11,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
11
11
  <span>${entry.label}</span>
12
12
  <span part="option-tag">${entry.tag}</span>
13
13
  </span>
14
- </div>`})}render(){const rows=this.normalizedEntries,activeId=this.activeIndex>=0&&rows[this.activeIndex]?`${this.listId}-opt-${this.activeIndex}`:"",previewTag=this.previewTag,previewEntry=this.entryFor(previewTag),hasLabel=this.hasLabelSlot||(this.label??"").length>0,hasHint=this.hasHintSlot||(this.hint??"").length>0,hasError=this.hasErrorSlot||(this.errorText??"").length>0,describedBy=this.localDescriptionIds=[hasError?"locale-picker-error":"",hasHint?"locale-picker-hint":""].filter(Boolean).join(" ");return html`
14
+ </div>`})}render(){const rows=this.normalizedEntries,activeId=this.activeIndex>=0&&rows[this.activeIndex]?`${this.listId}-opt-${this.activeIndex}`:"",previewTag=this.previewTag,previewEntry=this.entryFor(previewTag),flagOnly=this.triggerDisplay==="flag"&&this.showFlags,hasLabel=this.hasLabelSlot||(this.label??"").length>0,hasHint=this.hasHintSlot||(this.hint??"").length>0,hasError=this.hasErrorSlot||(this.errorText??"").length>0,describedBy=this.localDescriptionIds=[flagOnly?"locale-picker-value":"",hasError?"locale-picker-error":"",hasHint?"locale-picker-hint":""].filter(Boolean).join(" ");return html`
15
15
  <div part="form-control">
16
16
  <label part="form-control-label" for=${this.controlId} ?hidden=${!hasLabel}>
17
17
  ${this.label}<slot name="label" @slotchange=${this.onLabelSlotChange}></slot>
@@ -19,6 +19,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
19
19
  <button
20
20
  id=${this.controlId}
21
21
  part="trigger"
22
+ class=${flagOnly?"flag-only":nothing}
22
23
  type="button"
23
24
  role="combobox"
24
25
  aria-haspopup="listbox"
@@ -35,9 +36,9 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
35
36
  @focus=${this.onTriggerFocus}
36
37
  @blur=${this.onTriggerBlur}
37
38
  >
38
- ${this.showFlags?previewEntry?.country?html`<lr-flag part="trigger-flag" country=${previewEntry.country} fidelity="compact" aria-hidden="true" inert></lr-flag>`:html`<lr-flag part="trigger-flag" language=${previewTag} fidelity="compact" aria-hidden="true" inert></lr-flag>`:""}
39
- <span class="trigger-label">${this.labelFor(previewTag)}</span>
40
- <span part="expand-icon" aria-hidden="true" inert>${chevronIcon()}</span>
39
+ ${this.showFlags&&this.triggerDisplay!=="label"?previewEntry?.country?html`<lr-flag part="trigger-flag" country=${previewEntry.country} fidelity="compact" aria-hidden="true" inert></lr-flag>`:html`<lr-flag part="trigger-flag" language=${previewTag} fidelity="compact" aria-hidden="true" inert></lr-flag>`:""}
40
+ <span id="locale-picker-value" part="trigger-label" class=${flagOnly?"trigger-label sr-only":"trigger-label"}>${this.labelFor(previewTag)}</span>
41
+ ${flagOnly?nothing:html`<span part="expand-icon" aria-hidden="true" inert>${chevronIcon()}</span>`}
41
42
  </button>
42
43
  <div
43
44
  part="listbox"
@@ -55,4 +56,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
55
56
  ${this.hint}<slot name="hint" @slotchange=${this.onHintSlotChange}></slot>
56
57
  </div>
57
58
  </div>
58
- `}}__decorate([property({attribute:!1})],LyraLocalePicker.prototype,"locales",null),__decorate([property({attribute:"show-flags",type:Boolean,converter:trueDefaultBooleanConverter})],LyraLocalePicker.prototype,"showFlags",void 0),__decorate([property()],LyraLocalePicker.prototype,"label",void 0),__decorate([property()],LyraLocalePicker.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraLocalePicker.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraLocalePicker.prototype,"open",null),__decorate([property({reflect:!0,converter:declaredDefaultConverter("m")})],LyraLocalePicker.prototype,"size",void 0),__decorate([state()],LyraLocalePicker.prototype,"activeIndex",void 0),__decorate([state()],LyraLocalePicker.prototype,"touched",void 0),__decorate([state()],LyraLocalePicker.prototype,"hasHintSlot",void 0),__decorate([state()],LyraLocalePicker.prototype,"hasErrorSlot",void 0),__decorate([state()],LyraLocalePicker.prototype,"hasLabelSlot",void 0),__decorate([state()],LyraLocalePicker.prototype,"registryTick",void 0),__decorate([query('[part="trigger"]')],LyraLocalePicker.prototype,"triggerElement",void 0);export{LyraLocalePicker};
59
+ `}}__decorate([property({attribute:!1})],LyraLocalePicker.prototype,"locales",null),__decorate([property({attribute:"show-flags",type:Boolean,converter:trueDefaultBooleanConverter})],LyraLocalePicker.prototype,"showFlags",void 0),__decorate([property({attribute:"trigger-display",converter:declaredDefaultConverter("flag-label")})],LyraLocalePicker.prototype,"triggerDisplay",void 0),__decorate([property()],LyraLocalePicker.prototype,"label",void 0),__decorate([property()],LyraLocalePicker.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraLocalePicker.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraLocalePicker.prototype,"open",null),__decorate([property({reflect:!0,converter:declaredDefaultConverter("m")})],LyraLocalePicker.prototype,"size",void 0),__decorate([state()],LyraLocalePicker.prototype,"activeIndex",void 0),__decorate([state()],LyraLocalePicker.prototype,"touched",void 0),__decorate([state()],LyraLocalePicker.prototype,"hasHintSlot",void 0),__decorate([state()],LyraLocalePicker.prototype,"hasErrorSlot",void 0),__decorate([state()],LyraLocalePicker.prototype,"hasLabelSlot",void 0),__decorate([state()],LyraLocalePicker.prototype,"registryTick",void 0),__decorate([query('[part="trigger"]')],LyraLocalePicker.prototype,"triggerElement",void 0);export{LyraLocalePicker};