@aceshooting/lyra-ui 21.0.0 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +6 -3
- package/custom-elements.json +1 -1
- package/dist/ai/runtime.js +1 -1
- package/dist/ai/types.d.ts +13 -5
- package/dist/cli/lyra-rename-ledger.mjs +1 -0
- package/dist/cli/migrate-wa.mjs +33 -13
- package/dist/cli/migration-contract.json +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +5 -3
- package/dist/components/agent-tools/agent-trace/agent-trace.class.js +3 -2
- package/dist/components/agent-tools/tool-call-block/tool-call-block.class.d.ts +15 -3
- package/dist/components/agent-tools/tool-call-block/tool-call-block.class.js +3 -3
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +24 -8
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +3 -3
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +4 -0
- package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.d.ts +9 -5
- package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +2 -2
- package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.styles.js +1 -1
- package/dist/components/agent-tools/tool-status.js +2 -2
- package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +8 -0
- package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +3 -2
- package/dist/components/agent-tools/tool-timeline/tool-timeline.styles.js +1 -1
- package/dist/components/agent-tools/trace-tree/span.d.ts +2 -2
- package/dist/components/charts/chart/box-plot.class.d.ts +3 -1
- package/dist/components/charts/chart/box-plot.class.js +9 -9
- package/dist/components/charts/chart/chart-bidi.d.ts +109 -0
- package/dist/components/charts/chart/chart-bidi.js +1 -0
- package/dist/components/charts/chart/chart.class.d.ts +17 -2
- package/dist/components/charts/chart/chart.class.js +10 -8
- package/dist/components/charts/chart/histogram.class.js +1 -1
- package/dist/components/charts/chart/lite-chart.class.d.ts +24 -5
- package/dist/components/charts/chart/lite-chart.class.js +9 -9
- package/dist/components/charts/chart/lite-chart.styles.js +1 -1
- package/dist/components/conversation/code-block/shiki-dark-theme.d.ts +2 -2
- package/dist/components/conversation/code-block/shiki-dark-theme.js +1 -1
- package/dist/components/conversation/conversation-item/conversation-item.class.d.ts +18 -2
- package/dist/components/conversation/conversation-item/conversation-item.class.js +3 -3
- package/dist/components/conversation/conversation-item/conversation-item.styles.js +1 -1
- package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-core.class.d.ts +3 -1
- package/dist/components/conversation/markdown/markdown.class.d.ts +3 -1
- package/dist/components/conversation/message-actions/message-actions.class.d.ts +7 -2
- package/dist/components/conversation/message-actions/message-actions.class.js +2 -2
- package/dist/components/conversation/message-parts/message-parts.class.d.ts +6 -2
- package/dist/components/conversation/message-parts/message-parts.class.js +5 -3
- package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +3 -2
- package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
- package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +1 -5
- package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
- package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +7 -1
- package/dist/components/conversation/streaming-text/streaming-text-core.class.js +3 -4
- package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +7 -1
- package/dist/components/conversation/streaming-text/streaming-text.class.js +3 -4
- package/dist/components/conversation/thread-list/thread-list.class.d.ts +13 -2
- package/dist/components/conversation/thread-list/thread-list.class.js +3 -3
- package/dist/components/data/data-grid/data-grid.class.js +1 -1
- package/dist/components/data/document-library/document-library.class.js +2 -0
- package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -1
- package/dist/components/data/flow-minimap/flow-minimap.class.js +1 -1
- package/dist/components/data/flow-node/flow-node.class.d.ts +6 -2
- package/dist/components/data/flow-node/flow-node.class.js +6 -2
- package/dist/components/data/flow-node/flow-node.styles.js +1 -1
- package/dist/components/data/gauge/gauge.styles.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +3 -0
- package/dist/components/data/heatmap/heatmap.class.js +2 -2
- package/dist/components/data/heatmap/heatmap.styles.js +1 -1
- package/dist/components/data/sparkline/sparkline.class.d.ts +5 -3
- package/dist/components/data/stat/stat.class.d.ts +4 -3
- package/dist/components/data/table/table.class.d.ts +32 -5
- package/dist/components/data/table/table.class.js +3 -2
- package/dist/components/forms/button/button.class.d.ts +7 -1
- package/dist/components/forms/button/button.styles.js +1 -1
- package/dist/components/forms/date-picker/date-input.styles.js +1 -1
- package/dist/components/forms/input/input.styles.js +1 -1
- package/dist/components/forms/rubric-form/rubric-form.class.js +1 -0
- package/dist/components/layout/app-rail/app-rail.class.d.ts +50 -11
- package/dist/components/layout/app-rail/app-rail.class.js +2 -2
- package/dist/components/layout/command-palette/command-palette.class.js +1 -1
- package/dist/components/layout/menu/menu.class.d.ts +6 -5
- package/dist/components/layout/split-panel/split-panel.class.d.ts +2 -1
- package/dist/components/media/flag/language-map.d.ts +8 -0
- package/dist/components/media/flag/language-map.js +1 -1
- package/dist/components/media/map/map-loader.d.ts +7 -1
- package/dist/components/media/map/map.class.d.ts +111 -5
- package/dist/components/media/map/map.class.js +3 -3
- package/dist/components/media/media-card/media-card.class.d.ts +18 -5
- package/dist/components/media/media-card/media-card.class.js +1 -1
- package/dist/components/overlays/overlay/popover.class.d.ts +20 -0
- package/dist/components/overlays/overlay/popover.class.js +2 -2
- package/dist/components/retrieval/graph/graph.class.d.ts +3 -3
- package/dist/components/retrieval/graph/graph.class.js +1 -1
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +5 -3
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +3 -2
- package/dist/components/retrieval/mind-map/mind-map.class.d.ts +3 -3
- package/dist/components/retrieval/mind-map/mind-map.class.js +1 -1
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +4 -1
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +5 -1
- package/dist/components/retrieval/source-picker/source-picker.class.d.ts +4 -1
- package/dist/components/retrieval/source-picker/source-picker.class.js +5 -1
- package/dist/components/utility/icon/icon.class.d.ts +9 -3
- package/dist/components/utility/icon/icon.class.js +1 -1
- package/dist/components/utility/mutation-observer/mutation-observer.class.d.ts +14 -8
- package/dist/components/utility/mutation-observer/mutation-observer.class.js +1 -1
- package/dist/components/viewers/document-viewer/document-viewer.class.d.ts +6 -1
- package/dist/components/viewers/document-viewer/document-viewer.class.js +7 -1
- package/dist/components/viewers/document-viewer/registry.d.ts +12 -3
- package/dist/components/viewers/geojson-view/geojson-view.class.d.ts +13 -5
- package/dist/components/viewers/geojson-view/geojson-view.class.js +1 -1
- package/dist/components/viewers/geojson-view/geojson-viewer.class.d.ts +3 -2
- package/dist/custom-elements-jsx.d.ts +1 -1
- package/dist/events.d.ts +644 -1242
- package/dist/internal/anchored-overlay-runtime.d.ts +2 -2
- package/dist/internal/cell-range.d.ts +0 -6
- package/dist/internal/cell-range.js +1 -1
- package/dist/internal/css-token-length.d.ts +7 -0
- package/dist/internal/css-token-length.js +1 -0
- package/dist/internal/default-strings.generated.d.ts +1 -1
- package/dist/internal/default-strings.generated.js +1 -1
- package/dist/internal/deferred-focus-return.d.ts +7 -4
- package/dist/internal/deferred-focus-return.js +1 -1
- package/dist/internal/dev-mode-attribute-warning.d.ts +35 -0
- package/dist/internal/dev-mode-attribute-warning.js +1 -1
- package/dist/internal/localization-runtime.js +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +2 -2
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/papaparse-loader.d.ts +1 -1
- package/dist/internal/papaparse-loader.js +1 -1
- package/dist/internal/positioner.d.ts +10 -0
- package/dist/internal/positioner.js +1 -1
- package/dist/internal/shared-unions.d.ts +2 -1
- package/dist/internal/slotted-overlay-controller.d.ts +20 -0
- package/dist/internal/slotted-overlay-controller.js +1 -0
- package/dist/internal/text-quote.d.ts +1 -1
- package/dist/internal/text-quote.js +1 -1
- package/dist/internal/theme-observation.d.ts +4 -0
- package/dist/internal/theme-observation.js +1 -0
- package/dist/internal/theme-watcher.js +1 -1
- package/dist/localization.d.ts +6 -1
- package/dist/localization.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/lyra.js +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/testing/lyra-tag-event-map.js +1 -1
- package/dist/translations/ar/agent-tools.js +1 -1
- package/dist/translations/cs/agent-tools.js +1 -1
- package/dist/translations/da/agent-tools.js +1 -1
- package/dist/translations/de/agent-tools.js +1 -1
- package/dist/translations/de-CH/agent-tools.js +1 -1
- package/dist/translations/es/agent-tools.js +1 -1
- package/dist/translations/fa/agent-tools.js +1 -1
- package/dist/translations/fi/agent-tools.js +1 -1
- package/dist/translations/fr/agent-tools.js +1 -1
- package/dist/translations/he/agent-tools.js +1 -1
- package/dist/translations/hi/agent-tools.js +1 -1
- package/dist/translations/hr/agent-tools.js +1 -1
- package/dist/translations/hu/agent-tools.js +1 -1
- package/dist/translations/id/agent-tools.js +1 -1
- package/dist/translations/it/agent-tools.js +1 -1
- package/dist/translations/ja/agent-tools.js +1 -1
- package/dist/translations/kk/agent-tools.js +1 -1
- package/dist/translations/ko/agent-tools.js +1 -1
- package/dist/translations/nb/agent-tools.js +1 -1
- package/dist/translations/nl/agent-tools.js +1 -1
- package/dist/translations/nn/agent-tools.js +1 -1
- package/dist/translations/pl/agent-tools.js +1 -1
- package/dist/translations/pt-BR/agent-tools.js +1 -1
- package/dist/translations/pt-PT/agent-tools.js +1 -1
- package/dist/translations/pt-PT/charts.js +1 -1
- package/dist/translations/pt-PT/conversation.js +1 -1
- package/dist/translations/pt-PT/data.js +1 -1
- package/dist/translations/pt-PT/forms.js +1 -1
- package/dist/translations/pt-PT/layout.js +1 -1
- package/dist/translations/pt-PT/media.js +1 -1
- package/dist/translations/pt-PT/retrieval.js +1 -1
- package/dist/translations/pt-PT/shared.js +1 -1
- package/dist/translations/pt-PT/utility.js +1 -1
- package/dist/translations/pt-PT/viewers.js +2 -2
- package/dist/translations/ro/agent-tools.js +1 -1
- package/dist/translations/ru/agent-tools.js +1 -1
- package/dist/translations/sl/agent-tools.js +1 -1
- package/dist/translations/sv/agent-tools.js +1 -1
- package/dist/translations/tr/agent-tools.js +1 -1
- package/dist/translations/uk/agent-tools.js +1 -1
- package/dist/translations/zh-CN/agent-tools.js +1 -1
- package/dist/translations/zh-TW/agent-tools.js +1 -1
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/utilities/localization.d.ts +28 -10
- package/dist/vue.d.ts +1 -1
- package/llms/components/lr-accordion-item.md +2 -344
- package/llms/components/lr-accordion.md +2 -344
- package/llms/components/lr-app-rail-group.md +2 -721
- package/llms/components/lr-app-rail-item.md +2 -721
- package/llms/components/lr-app-rail.md +29 -4
- package/llms/components/lr-bar-chart.md +2 -87
- package/llms/components/lr-box-plot.md +1 -1
- package/llms/components/lr-breadcrumb-item.md +2 -67
- package/llms/components/lr-bubble-chart.md +2 -87
- package/llms/components/lr-button.md +7 -0
- package/llms/components/lr-chart.md +4 -5
- package/llms/components/lr-chip-group.md +2 -272
- package/llms/components/lr-conversation-item.md +20 -2
- package/llms/components/lr-date-input.md +2 -457
- package/llms/components/lr-date-picker.md +6 -2
- package/llms/components/lr-document-library.md +3 -3
- package/llms/components/lr-document-viewer.md +14 -5
- package/llms/components/lr-doughnut-chart.md +2 -87
- package/llms/components/lr-dropdown-item.md +2 -306
- package/llms/components/lr-dropdown.md +6 -0
- package/llms/components/lr-flag.md +9 -1
- package/llms/components/lr-flow-node.md +4 -1
- package/llms/components/lr-geojson-view.md +3 -90
- package/llms/components/lr-geojson-viewer.md +13 -5
- package/llms/components/lr-icon-button.md +4 -1
- package/llms/components/lr-icon.md +14 -6
- package/llms/components/lr-input.md +9 -2
- package/llms/components/lr-lite-chart.md +17 -9
- package/llms/components/lr-map.md +87 -2
- package/llms/components/lr-markdown-core.md +5 -4
- package/llms/components/lr-markdown.md +4 -2
- package/llms/components/lr-media-card.md +10 -5
- package/llms/components/lr-menu-item.md +2 -306
- package/llms/components/lr-menu.md +9 -6
- package/llms/components/lr-menubar-item.md +2 -125
- package/llms/components/lr-message-actions.md +4 -1
- package/llms/components/lr-message-parts.md +14 -5
- package/llms/components/lr-mutation-observer.md +12 -6
- package/llms/components/lr-navigation-menu-item.md +2 -237
- package/llms/components/lr-number-input.md +4 -0
- package/llms/components/lr-option.md +2 -712
- package/llms/components/lr-pie-chart.md +2 -87
- package/llms/components/lr-polar-area-chart.md +2 -87
- package/llms/components/lr-popover.md +10 -0
- package/llms/components/lr-prompt-input.md +5 -1
- package/llms/components/lr-radar-chart.md +2 -87
- package/llms/components/lr-reorder-item.md +2 -157
- package/llms/components/lr-result-field.md +2 -117
- package/llms/components/lr-retrieval-results.md +3 -1
- package/llms/components/lr-rubric-form.md +3 -2
- package/llms/components/lr-scatter-chart.md +2 -87
- package/llms/components/lr-selection-toolbar.md +4 -2
- package/llms/components/lr-source-card.md +2 -186
- package/llms/components/lr-source-picker.md +3 -1
- package/llms/components/lr-sparkline.md +9 -4
- package/llms/components/lr-split-panel.md +5 -3
- package/llms/components/lr-stat.md +4 -3
- package/llms/components/lr-streaming-text-core.md +7 -5
- package/llms/components/lr-streaming-text.md +9 -6
- package/llms/components/lr-swatch-picker.md +130 -0
- package/llms/components/lr-tag.md +2 -177
- package/llms/components/lr-thread-list.md +27 -4
- package/llms/components/lr-timeline-item.md +2 -120
- package/llms/components/lr-toast-item.md +2 -223
- package/llms/components/lr-tool-call-block.md +12 -3
- package/llms/components/lr-tool-call-chip.md +12 -6
- package/llms/components/lr-tool-param-form.md +3 -2
- package/llms/components/lr-tool-result-dialog.md +7 -3
- package/llms/components/lr-tool-result-view.md +4 -3
- package/llms/components/lr-tool-timeline.md +12 -5
- package/llms/components/lr-tree-item.md +2 -354
- package/llms/index.md +22 -4
- package/llms/migration.md +75 -1
- package/llms/peers.md +1 -1
- package/llms/shared.md +86 -39
- package/llms-full.txt +739 -163
- package/package.json +6 -6
- package/registrations.json +1 -1
- package/vscode-css-data.json +1 -1
- package/vscode-html-data.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isRtl}from"../../../internal/rtl.js";import{srOnly,nextId}from"../../../internal/a11y.js";import{finiteCount,finiteInteger,finiteRatio}from"../../../internal/numbers.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.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{definePersistedProperty,isPersistedPropertyExplicitlySet}from"../../../internal/persisted-restore.js";import{styles}from"./table.styles.js";import{chevronIcon,closeIcon,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{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{renderDataState}from"../../../internal/data-state-renderer.js";import{LYRA_DEFAULT_clear,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_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_showAllColumns,LYRA_DEFAULT_showFewerColumns,LYRA_DEFAULT_tableEditCell,LYRA_DEFAULT_tableFilterLabel,LYRA_DEFAULT_tableFilterPlaceholder,LYRA_DEFAULT_tableLoadFailed,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,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",INERT_PRIORITY_COLUMN_CONFIG_WARNING="lyra-table-inert-priority-column-config";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.expansionMode="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.unknownTotal=!1,this.hasNext=!0,this._expandedKeys=new Set,this.hasMore=!1,this.error=!1,this.errorDescription="",this.announce=!1,this.emptyDescription="",this.noColumnsDescription="",this.hasHiddenPriorityColumns=!1,this.priorityToggleAvailable=!1,this.persistReady=!1,this.firstUpdateAnnouncementsReady=!1,this.activeColKey=null,this.activeRowKey=null,this.editingCell=null,this.focusedEditorCell=null,this.editorHadFocusBeforeUpdate=!1,this.rovingFocusSnapshot=null,this._resizedColumnWidths=new Map,this.resizeWriteGuard=new VetoWriteGuard,this.rowsByKey=new Map,this.columnsByKey=new Map,this.layoutFrame=null,this.observedHeaders=new Set,this.priorityTierNaturalWidth=new Map,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.resizeWriteGuard.open(),!this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width:committedWidth}),{cancelable:!0}).defaultPrevented||this.resizeWriteGuard.touched))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.onClearFilter=()=>{this.filterText!==""&&(this.filterText="",this.emit("lr-filter-change",Object.freeze({text:""})),this.renderRoot.querySelector('[part="filter"]')?.focus())},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,clear:LYRA_DEFAULT_clear,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,retry:LYRA_DEFAULT_retry,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,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,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)}asKeySet(keys){return keys}asKeyList(keys){return keys}get priorityColumnsToggleAvailable(){return this.priorityToggleAvailable}static{definePersistedProperty(this.prototype,"priorityColumnsVisible",{initial:!1,attribute:"priority-columns-visible",type:Boolean,reflect:!0})}get storageFullKey(){return this.storageKey?`lr-table:${this.storageKey}`:void 0}get resizedColumnWidths(){return this._resizedColumnWidths}set resizedColumnWidths(value){const previous=this._resizedColumnWidths;this._resizedColumnWidths=value,markVetoGuardWrite(this.resizeWriteGuard),this.requestUpdate("resizedColumnWidths",previous)}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)return;if(this.resizedColumnWidths=new Map(this.resizedColumnWidths).set(column.key,width),this.resizeWriteGuard.open(),this.emit("lr-column-resize",Object.freeze({columnKey:column.key,width}),{cancelable:!0}).defaultPrevented&&!this.resizeWriteGuard.touched){const reverted=new Map(this.resizedColumnWidths);previousWidth===void 0?reverted.delete(column.key):reverted.set(column.key,previousWidth),this.resizedColumnWidths=reverted}markVetoGuardWrite(this.resizeWriteGuard)}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{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{resolveCssTokenLength}from"../../../internal/css-token-length.js";import{getCollator,getNumberFormat}from"../../../internal/intl-cache.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{definePersistedProperty,isPersistedPropertyExplicitlySet}from"../../../internal/persisted-restore.js";import{styles}from"./table.styles.js";import{chevronIcon,closeIcon,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{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{renderDataState}from"../../../internal/data-state-renderer.js";import{LYRA_DEFAULT_clear,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_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_showAllColumns,LYRA_DEFAULT_showFewerColumns,LYRA_DEFAULT_tableEditCell,LYRA_DEFAULT_tableFilterLabel,LYRA_DEFAULT_tableFilterPlaceholder,LYRA_DEFAULT_tableLoadFailed,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,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",INERT_PRIORITY_COLUMN_CONFIG_WARNING="lyra-table-inert-priority-column-config";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.expansionMode="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.unknownTotal=!1,this.hasNext=!0,this._expandedKeys=new Set,this.hasMore=!1,this.error=!1,this.errorDescription="",this.announce=!1,this.emptyDescription="",this.noColumnsDescription="",this.hasHiddenPriorityColumns=!1,this.priorityToggleAvailable=!1,this.persistReady=!1,this.firstUpdateAnnouncementsReady=!1,this.activeColKey=null,this.activeRowKey=null,this.editingCell=null,this.focusedEditorCell=null,this.editorHadFocusBeforeUpdate=!1,this.rovingFocusSnapshot=null,this._resizedColumnWidths=new Map,this.resizeWriteGuard=new VetoWriteGuard,this.rowsByKey=new Map,this.columnsByKey=new Map,this.layoutFrame=null,this.observedHeaders=new Set,this.priorityTierNaturalWidth=new Map,this.priorityTierHiddenAllocation=new Map,this.priorityTierRevealAllocation=new Map,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.resizeWriteGuard.open(),!this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width:committedWidth}),{cancelable:!0}).defaultPrevented||this.resizeWriteGuard.touched))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.onClearFilter=()=>{this.filterText!==""&&(this.filterText="",this.emit("lr-filter-change",Object.freeze({text:""})),this.renderRoot.querySelector('[part="filter"]')?.focus())},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,clear:LYRA_DEFAULT_clear,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,retry:LYRA_DEFAULT_retry,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,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,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)}asKeySet(keys){return keys}asKeyList(keys){return keys}get priorityColumnsToggleAvailable(){return this.priorityToggleAvailable}static{definePersistedProperty(this.prototype,"priorityColumnsVisible",{initial:!1,attribute:"priority-columns-visible",type:Boolean,reflect:!0})}get storageFullKey(){return this.storageKey?`lr-table:${this.storageKey}`:void 0}get resizedColumnWidths(){return this._resizedColumnWidths}set resizedColumnWidths(value){const previous=this._resizedColumnWidths;this._resizedColumnWidths=value,markVetoGuardWrite(this.resizeWriteGuard),this.requestUpdate("resizedColumnWidths",previous)}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=resolveCssTokenLength(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)return;if(this.resizedColumnWidths=new Map(this.resizedColumnWidths).set(column.key,width),this.resizeWriteGuard.open(),this.emit("lr-column-resize",Object.freeze({columnKey:column.key,width}),{cancelable:!0}).defaultPrevented&&!this.resizeWriteGuard.touched){const reverted=new Map(this.resizedColumnWidths);previousWidth===void 0?reverted.delete(column.key):reverted.set(column.key,previousWidth),this.resizedColumnWidths=reverted}markVetoGuardWrite(this.resizeWriteGuard)}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"
|
|
@@ -11,7 +11,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
11
11
|
aria-valuemax=${Number.isFinite(maxWidth)?Math.round(maxWidth):UNBOUNDED_RESIZE_ARIA_MAX}
|
|
12
12
|
@pointerdown=${this.onResizePointerDown}
|
|
13
13
|
@keydown=${this.onResizeKeyDown}
|
|
14
|
-
></span>`}syncResizeHandleValues(){for(const handle of this.renderRoot.querySelectorAll('[part="resize-handle"]')){const key=handle.dataset.colKey;if(!key)continue;const column=this.columnsByKey.get(key);if(!column||this.resizedColumnWidths.has(key)||this.parsePixelLength(column.width)!==void 0)continue;const rendered=handle.closest("th[data-col-key]")?.getBoundingClientRect().width;if(rendered&&rendered>0){const width=Math.round(rendered);handle.setAttribute("aria-valuenow",String(width)),handle.setAttribute("aria-valuetext",this.resizeValueText(width))}}}detachResizePointerListeners(){const resizeEventWindow=this.resizeEventWindow;resizeEventWindow&&(resizeEventWindow.removeEventListener("pointermove",this.onResizePointerMove),resizeEventWindow.removeEventListener("pointerup",this.onResizePointerEnd),resizeEventWindow.removeEventListener("pointercancel",this.onResizePointerEnd),resizeEventWindow.removeEventListener("lostpointercapture",this.onResizePointerEnd),this.resizeEventWindow=void 0)}rollbackResizePreview(state2){const reverted=new Map(this.resizedColumnWidths);state2.previousWidth===void 0?reverted.delete(state2.key):reverted.set(state2.key,state2.previousWidth),this.resizedColumnWidths=reverted}cancelResizeGesture(){const state2=this.resizeState;if(this.resizeState=void 0,this.detachResizePointerListeners(),!!state2){state2.handle.removeAttribute("data-resizing");try{state2.handle.releasePointerCapture?.(state2.pointerId)}catch{}this.rollbackResizePreview(state2)}}firstUpdated(changed){super.firstUpdated(changed),!this.accessibleLabel&&!this.hasAttribute("aria-label")&&!this.caption&&devWarnOnce(MISSING_ACCESSIBLE_NAME_WARNING,"<lr-table> has no accessible name: set `accessibleLabel`, a host `aria-label`, or `caption` so assistive technology can identify the grid.")}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink();const owner=this.ownerDocument.defaultView,ResizeObserverCtor=owner?.ResizeObserver;let observer;ResizeObserverCtor&&(observer=new ResizeObserverCtor(()=>{!this.isConnected||this.ownerDocument.defaultView!==owner||this.resizeObserver!==observer||this.scheduleLayoutSync()})),this.resizeObserver=observer;const base=this.renderRoot?.querySelector('[part="base"]');base&&(this.observeBase(base),this.observeTable(this.renderRoot.querySelector('[part="table"]')??void 0),this.observeHeaders())}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink(),this.cancelResizeGesture(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0;const frame=this.layoutFrame;frame&&frame.owner.cancelAnimationFrame(frame.handle),this.layoutFrame=null,this.observedBase=void 0,this.observedTable=void 0,this.observedHeaders.clear()}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0,this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.errorAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}))}localizedOverride(key,override){return override??this.localize(key)}loadingText(){return this.localizedOverride("tableLoading",this.loadingLabel)}observeBase(base){this.observedBase!==base&&(this.observedBase&&this.resizeObserver?.unobserve(this.observedBase),this.resizeObserver?.observe(base),this.observedBase=base)}observeTable(table){this.observedTable!==table&&(this.observedTable&&this.resizeObserver?.unobserve(this.observedTable),table&&this.resizeObserver?.observe(table),this.observedTable=table)}syncAutoScrollMode(){const base=this.renderRoot.querySelector('[part="base"]');if(!base)return;const overflows=this.scrollMode==="auto"&&base.scrollWidth-base.clientWidth>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX;base.toggleAttribute("data-scroll-overflow",overflows)}observeHeaders(){const headers=new Set(this.columns.some(column=>column.sticky||column.resizable)?this.renderRoot.querySelectorAll("th[data-col-key]"):[]);for(const header of this.observedHeaders)headers.has(header)||(this.resizeObserver?.unobserve(header),this.observedHeaders.delete(header));for(const header of headers)this.observedHeaders.has(header)||(this.observedHeaders.add(header),this.resizeObserver?.observe(header))}priorityTierHeaders(tier){return[...this.renderRoot.querySelectorAll(`th[data-priority="${tier}"]`)]}recomputeHiddenPriorityColumns(){const hasLowColumn=this.columns.some(col=>col.priority==="low"),hasMediumColumn=this.columns.some(col=>col.priority==="medium"),base=this.renderRoot.querySelector('[part="base"]');if(!hasLowColumn&&!hasMediumColumn){this.priorityTierNaturalWidth.clear(),this.alwaysVisibleNaturalWidth=void 0,base?.removeAttribute("data-hide-priority-low"),base?.removeAttribute("data-hide-priority-medium"),this.rehomeFocusedColumn(),this.priorityToggleAvailable&&(this.priorityToggleAvailable=!1),this.hasHiddenPriorityColumns&&(this.hasHiddenPriorityColumns=!1);return}if(!base||base.clientWidth<=0){this.rehomeFocusedColumn();return}const genuineOverflow=base.scrollWidth-base.clientWidth>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,lowHeaders=hasLowColumn?this.priorityTierHeaders("low"):[],mediumHeaders=hasMediumColumn?this.priorityTierHeaders("medium"):[],refreshNaturalWidth=(tier,headers)=>{if(headers.length===0)return!1;const currentlyHidden=headers.every(header=>header.offsetParent===null);if(!currentlyHidden&&genuineOverflow){const width=headers.reduce((sum,header)=>sum+header.getBoundingClientRect().width,0);width>0&&this.priorityTierNaturalWidth.set(tier,width)}return currentlyHidden},lowActuallyHidden=refreshNaturalWidth("low",lowHeaders),mediumActuallyHidden=refreshNaturalWidth("medium",mediumHeaders);if(genuineOverflow){const alwaysWidth=[...this.renderRoot.querySelectorAll('[part="head"] > tr > th')].filter(header=>!header.hasAttribute("data-priority")).reduce((sum,header)=>sum+header.getBoundingClientRect().width,0);alwaysWidth>0&&(this.alwaysVisibleNaturalWidth=alwaysWidth)}const lowNaturalWidth=this.priorityTierNaturalWidth.get("low")??0,mediumNaturalWidth=this.priorityTierNaturalWidth.get("medium")??0,overflowAtFull=(lowActuallyHidden||mediumActuallyHidden?(this.alwaysVisibleNaturalWidth??0)+lowNaturalWidth+mediumNaturalWidth:base.scrollWidth)-base.clientWidth,needsLow=hasLowColumn&&overflowAtFull>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,overflowAfterLow=needsLow?overflowAtFull-lowNaturalWidth:overflowAtFull,needsMedium=hasMediumColumn&&overflowAfterLow>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX;base.toggleAttribute("data-hide-priority-low",needsLow),base.toggleAttribute("data-hide-priority-medium",needsMedium),this.rehomeFocusedColumn();const toggleAvailable=needsLow||needsMedium,anyPriorityHidden=toggleAvailable&&!this.priorityColumnsVisible;this.priorityToggleAvailable!==toggleAvailable&&(this.priorityToggleAvailable=toggleAvailable),this.hasHiddenPriorityColumns!==anyPriorityHidden&&(this.hasHiddenPriorityColumns=anyPriorityHidden)}rehomeFocusedColumn(){const visible=this.visibleHeaders();visible.length===0||this.activeColKey===null||visible.some(header=>header.dataset.colKey===this.activeColKey)||(this.activeColKey=visible[0].dataset.colKey??null)}keyOf(row,index){try{const key=this.rowKey?this.rowKey(row):index;return typeof key=="string"?key.trim().length===0?void 0:key:typeof key=="number"?key:void 0}catch{return}}canonicalRowEntries(){const inputs=this.canonicalRowEntriesInputs;if(this.cachedCanonicalRowEntries!==null&&inputs?.rows===this.rows&&inputs.rowKey===this.rowKey)return this.cachedCanonicalRowEntries;const entries=[],seen=new Set;return this.rows.forEach((row,index)=>{const key=this.keyOf(row,index);if(key===void 0)return;const encoded=encodeKey(key);seen.has(encoded)||(seen.add(encoded),entries.push({row,index,key}))}),this.canonicalRowEntriesInputs={rows:this.rows,rowKey:this.rowKey},this.cachedCanonicalRowEntries=entries,entries}matchingEntries(){const text=(this.filterText??"").trim(),locale=text===""?"":this.effectiveLocale,canonicalEntries=this.canonicalRowEntries(),inputs=this.matchingEntriesInputs;if(this.cachedMatchingEntries!==null&&inputs!==null&&inputs.entries===canonicalEntries&&inputs.filter===this.filter&&inputs.text===text&&inputs.locale===locale)return this.cachedMatchingEntries;let entries;if(text==="")entries=canonicalEntries;else{const intlLocale=this.effectiveLocale,normalized=text.toLocaleLowerCase(intlLocale);entries=canonicalEntries.filter(({row})=>this.filter?this.filter(row,text):safeStringifyForFilter(row).toLocaleLowerCase(intlLocale).includes(normalized))}return this.matchingEntriesInputs={entries:canonicalEntries,filter:this.filter,text,locale},this.cachedMatchingEntries=entries,entries}get normalizedPageSize(){return finiteInteger(this.pageSize,DEFAULT_PAGE_SIZE,1,MAX_PAGE_SIZE)}get effectiveSkeletonRows(){const explicit=finiteCount(this.skeletonRows,0,MAX_SKELETON_ROWS);if(explicit>0)return explicit;const pageSize=this.normalizedPageSize;return pageSize===DEFAULT_PAGE_SIZE?DEFAULT_SKELETON_ROWS:Math.min(pageSize,MAX_SKELETON_ROWS)}get matchingTotalItems(){const totalItems=finiteInteger(this.totalItems,-1);return totalItems>=0?totalItems:this.matchingEntries().length}get serverUnknownTotal(){return this.paginationMode==="server"&&this.unknownTotal}get pageCount(){const pageSize=this.normalizedPageSize;return pageSize>0?Math.ceil(this.matchingTotalItems/pageSize):0}get appliedPage(){return this.pageCount===0?1:finiteInteger(this.page,1,1,this.pageCount)}sortedEntries(){const entries=this.matchingEntries();if(this.sortMode!=="client"||this.sortKey==="")return entries;const col=this.columnsByKey.get(this.sortKey);if(!col?.sortable)return entries;const locale=this.effectiveLocale,inputs=this.sortedEntriesInputs;if(this.cachedSortedEntries!==null&&inputs!==null&&inputs.entries===entries&&inputs.columns===this.columns&&inputs.mode===this.sortMode&&inputs.key===this.sortKey&&inputs.dir===this.sortDir&&inputs.locale===locale&&inputs.groupBy===this.groupBy)return this.cachedSortedEntries;const collator=getCollator(locale,{numeric:!0}),dir=this.sortDir==="desc"?-1:1,decorated=entries.map(entry=>{const raw=typeof col.sortValue=="function"?col.sortValue(entry.row):typeof col.cell=="function"?String(col.cell(entry.row)??""):"";return{entry,value:typeof raw=="number"&&!Number.isFinite(raw)?null:raw}}),compare=(a,b)=>{const av=a.value,bv=b.value;return av==null&&bv==null?0:av==null?1:bv==null?-1:typeof av=="number"&&typeof bv=="number"?(av-bv)*dir:collator.compare(String(av),String(bv))*dir};let sorted;const groupBy=this.groupBy;if(groupBy===void 0)decorated.sort(compare),sorted=decorated.map(decoration=>decoration.entry);else{const buckets=new Map;for(const decoration of decorated){const groupKey=groupBy(decoration.entry.row),bucket=buckets.get(groupKey);bucket===void 0?buckets.set(groupKey,[decoration]):bucket.push(decoration)}const ordered=[...buckets.values()],constantWithinEveryGroup=ordered.every(bucket=>bucket.every(decoration=>compare(decoration,bucket[0])===0));constantWithinEveryGroup&&ordered.sort((a,b)=>compare(a[0],b[0])),sorted=[];for(const bucket of ordered){constantWithinEveryGroup||bucket.sort(compare);for(const decoration of bucket)sorted.push(decoration.entry)}}return this.sortedEntriesInputs={entries,columns:this.columns,mode:this.sortMode,key:this.sortKey,dir:this.sortDir,locale,groupBy},this.cachedSortedEntries=sorted,sorted}renderedEntries(){const entries=this.sortedEntries();if(this.paginationMode==="server")return entries.slice(0,this.normalizedPageSize);const start=(this.appliedPage-1)*this.normalizedPageSize;return entries.slice(start,start+this.normalizedPageSize)}get viewRows(){return Object.freeze(this.sortedEntries().map(entry=>entry.row))}get pageRows(){return Object.freeze(this.renderedEntries().map(entry=>entry.row))}focusedColKey(){const visible=this.visibleHeaders(),visibleKeys=new Set(visible.map(el=>el.dataset.colKey).filter(key=>key!==void 0&&this.columnsByKey.has(key)));return this.activeColKey!==null&&this.columnsByKey.has(this.activeColKey)&&(visibleKeys.size===0||visibleKeys.has(this.activeColKey))?this.activeColKey:visible.find(el=>el.dataset.colKey!==void 0&&this.columnsByKey.has(el.dataset.colKey))?.dataset.colKey??this.columns[0]?.key??null}focusedRowKey(){if(this.activeRowKey!==null&&this.rowsByKey.has(this.activeRowKey))return this.activeRowKey;const selectedKey=this._selectedKeys.values().next().value;if(selectedKey!==void 0){const selected=encodeKey(selectedKey);if(this.rowsByKey.has(selected))return selected}const first=this.renderedEntries()[0];return first?encodeKey(first.key):null}rowsAffectingRovingFocusChanged(changed){return changed.has("rows")||changed.has("rowKey")||changed.has("filterText")||changed.has("filter")||changed.has("page")||changed.has("pageSize")||changed.has("paginationMode")||changed.has("totalItems")||changed.has("columns")||changed.has("sortKey")||changed.has("sortDir")||changed.has("sortMode")||changed.has("groupBy")||this.rowsLocale!==this.effectiveLocale}captureRovingFocus(changed){this.rovingFocusSnapshot=null;const active=activeElementIn(this.shadowRoot),HTMLElementCtor=this.ownerDocument?.defaultView?.HTMLElement;if(!(!HTMLElementCtor||!(active instanceof HTMLElementCtor))){if(changed.has("columns")&&active.matches("th[data-col-key]")){const headers=this.visibleHeaders(),key=active.dataset.colKey,index=headers.indexOf(active);key!==void 0&&index>=0&&(this.rovingFocusSnapshot={kind:"header",key,index,targetKey:null,element:active});return}if(this.rowsAffectingRovingFocusChanged(changed)&&active.matches("tr[data-row-key]")){const renderedRows=[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")],key=active.dataset.rowKey,index=renderedRows.indexOf(active);key!==void 0&&index>=0&&(this.rovingFocusSnapshot={kind:"row",key,index,targetKey:null,element:active})}}}resolveRovingFocusTarget(){const snapshot=this.rovingFocusSnapshot;if(snapshot===null)return;const keys=snapshot.kind==="header"?this.columns.map(column=>column.key):[...this.rowsByKey.keys()];snapshot.targetKey=keys.includes(snapshot.key)?snapshot.key:keys[Math.min(snapshot.index,keys.length-1)]??null,snapshot.kind==="header"?this.activeColKey=snapshot.targetKey:this.activeRowKey=snapshot.targetKey}willUpdate(changed){if(super.willUpdate(changed),this.captureRovingFocus(changed),this.selectionMode==="single"&&this._selectedKeys.size>1&&(changed.has("selectionMode")||changed.has("selectedRowKeys"))){const first=this._selectedKeys.values().next().value;if(this.selectedRowKeys=this.asKeySet(first===void 0?new Set:new Set([first])),this.hasUpdated){const rowKeys=this.asKeyList(Object.freeze(first===void 0?[]:[first]));this.emit("lr-selection-change",Object.freeze({rowKeys}))}}if(this.expansionMode==="single"&&this._expandedKeys.size>1&&(changed.has("expansionMode")||changed.has("expandedRowKeys"))){const first=this._expandedKeys.values().next().value;this.expandedRowKeys=this.asKeySet(first===void 0?new Set:new Set([first]))}if(!this.hasUpdated){const parsed=readPersistedState(this.storageFullKey,v=>typeof v=="object"&&v!==null);parsed&&typeof parsed.priorityColumnsVisible=="boolean"&&!isPersistedPropertyExplicitlySet(this,"priorityColumnsVisible")&&(this.priorityColumnsVisible=parsed.priorityColumnsVisible)}if(changed.has("columns")&&(this.columnsByKey=new Map(this.columns.map(c=>[c.key,c]))),this.rowsAffectingRovingFocusChanged(changed)&&(this.rowsByKey=new Map(this.renderedEntries().map(entry=>[encodeKey(entry.key),entry])),this.rowsLocale=this.effectiveLocale),this.resolveRovingFocusTarget(),this.editingCell!==null){const column=this.columnsByKey.get(this.editingCell.columnKey);(!this.rowsByKey.has(this.editingCell.rowKey)||normalizedEditTrigger(column?.editTrigger)!=="double-click")&&(this.editingCell=null)}this.editorHadFocusBeforeUpdate=this.focusedEditorCell!==null&&activeElementIn(this.shadowRoot)===this.editorElementFor(this.focusedEditorCell.rowKey,this.focusedEditorCell.columnKey)}stickyOffsets(){const offsets=new Map,headerWidths=new Map;for(const el of this.renderRoot.querySelectorAll("th[data-col-key]")){const key=el.dataset.colKey;key!==void 0&&!headerWidths.has(key)&&headerWidths.set(key,el.offsetWidth)}const headerWidth=key=>headerWidths.get(key)??0;let runningStart=0;for(const col of this.columns)stickyDirection(col.sticky)==="start"&&(offsets.set(col.key,runningStart),runningStart+=headerWidth(col.key));let runningEnd=0;for(let i=this.columns.length-1;i>=0;i--){const col=this.columns[i];col&&stickyDirection(col.sticky)==="end"&&(offsets.set(col.key,runningEnd),runningEnd+=headerWidth(col.key))}return offsets}computeHeatDomain(hasHeatTint){if(!hasHeatTint)return null;const values=[];for(const entry of this.matchingEntries())for(const col of this.columns){const v=col.heatValue?.(entry.row);v!=null&&Number.isFinite(v)&&values.push(v)}const auto=minMax(values),lo=this.heatTintScale?.min??auto?.[0],hi=this.heatTintScale?.max??auto?.[1];return lo===void 0||hi===void 0?null:[lo,hi]}heatShare(col,row,domain){if(!col.heatValue||!domain)return null;const v=col.heatValue(row);if(v==null||!Number.isFinite(v))return null;const[lo,hi]=domain;return`${(finiteRatio(v,lo,hi)*100).toFixed(2)}%`}applyStickyOffsets(){if(!this.columns.some(c=>c.sticky))return;const offsets=this.stickyOffsets();this.renderRoot.querySelectorAll("[data-col-key]").forEach(el=>{const key=el.dataset.colKey;key!==void 0&&offsets.has(key)&&el.style.setProperty("--lr-table-sticky-offset",`${offsets.get(key)}px`)})}updated(changed){super.updated(changed),this.firstUpdateAnnouncementsReady&&changed.has("loading")&&this.loading&&this.announcementSink?.announce(this.loadingText());const announcesErrorTransition=this.firstUpdateAnnouncementsReady&&changed.has("error")&&this.error,announcesMountedError=!this.firstUpdateAnnouncementsReady&&this.announce&&this.error;if((announcesErrorTransition||announcesMountedError)&&this.errorAnnouncementSink?.announce(this.localizedOverride("tableLoadFailed",this.errorHeading)),this.firstUpdateAnnouncementsReady=!0,this.persistReady&&changed.has("priorityColumnsVisible")&&writePersistedState(this.storageFullKey,{priorityColumnsVisible:this.priorityColumnsVisible}),this.persistReady=!0,changed.has("columns")||changed.has("revealColumnsLabel")||changed.has("hideColumnsLabel")||changed.has("priorityColumnsVisible")||changed.has("storageKey")){const inertMembers=[],labelsInert=this.revealColumnsLabel!==void 0||this.hideColumnsLabel!==void 0;labelsInert&&inertMembers.push("`revealColumnsLabel`/`hideColumnsLabel`"),isPersistedPropertyExplicitlySet(this,"priorityColumnsVisible")&&inertMembers.push("`priorityColumnsVisible`"),this.storageKey&&inertMembers.push("`storageKey`"),inertMembers.length>0&&this.columns.length>0&&!this.columns.some(col=>col.priority)&&devWarnOnce(INERT_PRIORITY_COLUMN_CONFIG_WARNING,`<lr-table>: ${inertMembers.join(", ")} `+(inertMembers.length>1||labelsInert?"have":"has")+" no effect unless at least one column declares `priority`.")}(changed.has("columns")||changed.has("rows")||changed.has("rowKey"))&&this.applyStickyOffsets(),this.syncResizeHandleValues();const base=this.renderRoot.querySelector('[part="base"]');if(base&&this.observeBase(base),this.observeTable(this.renderRoot.querySelector('[part="table"]')??void 0),this.syncAutoScrollMode(),this.observeHeaders(),this.restoreRovingFocus(),this.hasAlwaysOnEditors&&this.restoreAlwaysOnEditorFocus(),changed.has("editingCell"))if(this.editingCell){const{rowKey,columnKey}=this.editingCell;queueMicrotask(()=>this.editorElementFor(rowKey,columnKey)?.focus())}else{const previous=changed.get("editingCell");if(previous){const{rowKey,columnKey}=previous;queueMicrotask(()=>this.cellElementForToken(rowKey,columnKey)?.focus())}}queueMicrotask(()=>this.recomputeHiddenPriorityColumns())}restoreRovingFocus(){const snapshot=this.rovingFocusSnapshot;if(this.rovingFocusSnapshot=null,snapshot===null)return;const internalActive=activeElementIn(this.shadowRoot);if(internalActive!==null&&internalActive!==snapshot.element)return;const documentActive=activeElementIn(this.ownerDocument);if(documentActive!==null&&documentActive!==this&&documentActive!==this.ownerDocument.body)return;const candidates=snapshot.kind==="header"?this.visibleHeaders():[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")],target=candidates.find(candidate=>snapshot.kind==="header"?candidate.dataset.colKey===snapshot.targetKey:candidate.dataset.rowKey===snapshot.targetKey)??candidates[Math.min(snapshot.index,candidates.length-1)]??null;snapshot.kind==="header"?this.focusHeader(target):this.focusRow(target)}activateColumn(key){this.activeColKey=key;const col=this.columnsByKey.get(key);if(!col?.sortable)return;const sortDir=this.sortKey===key?this.sortDir==="asc"?"desc":"asc":col.defaultSortDir??this.defaultSortDir,request=Object.freeze({phase:"request",sortKey:col.key,sortDir});this.emit("lr-sort-request",request,{cancelable:!0}).defaultPrevented||(this.sortMode==="client"&&(this.sortKey=col.key,this.sortDir=sortDir),this.emit("lr-sort",Object.freeze({phase:"commit",sortKey:col.key,sortDir})))}activateRow(key){this.activeRowKey=key;const entry=this.rowsByKey.get(key);if(entry===void 0)return;const{row,key:selectedKey}=entry;if(this.emit("lr-row-click",Object.freeze({row})),this.selectionMode==="single"){this.selectedRowKeys=this.asKeySet(new Set([selectedKey]));const rowKeys=this.asKeyList(Object.freeze([selectedKey]));this.emit("lr-selection-change",Object.freeze({rowKeys}))}else if(this.selectionMode==="multiple"){const rawKey=selectedKey,next=new Set(this._selectedKeys);next.has(rawKey)?next.delete(rawKey):next.add(rawKey),this.selectedRowKeys=this.asKeySet(next);const rowKeys=this.asKeyList(Object.freeze([...next]));this.emit("lr-selection-change",Object.freeze({rowKeys}))}}get hasAlwaysOnEditors(){return this.columns.some(col=>normalizedEditTrigger(col.editTrigger)==="always")}editorValue(row,column){const value=column.editValue?.(row)??row[column.key]??"";return String(value)}startEditing(rowKey,columnKey){const column=this.columnsByKey.get(columnKey);normalizedEditTrigger(column?.editTrigger)!=="double-click"||!this.rowsByKey.has(rowKey)||(this.editingCell={rowKey,columnKey})}commitEdit(event,rowKey,columnKey){event.stopPropagation();const field=event.currentTarget,entry=this.rowsByKey.get(rowKey),column=this.columnsByKey.get(columnKey),isTransient=this.editingCell?.rowKey===rowKey&&this.editingCell.columnKey===columnKey;if(!entry||!column||normalizedEditTrigger(column.editTrigger)===void 0){isTransient&&(this.editingCell=null);return}const value=column.editType==="number"&&field.value!==""?Number(field.value):field.value;this.emit("lr-cell-edit",Object.freeze({row:entry.row,columnKey,value})),isTransient&&(this.editingCell=null)}editorElementFor(rowKey,columnKey){return this.cellElementForToken(rowKey,columnKey)?.querySelector('[part="cell-editor"]')??null}restoreAlwaysOnEditorFocus(){const cell=this.focusedEditorCell;if(cell===null)return;const editor=this.editorElementFor(cell.rowKey,cell.columnKey);editor===null?this.focusedEditorCell=null:this.editorHadFocusBeforeUpdate&&activeElementIn(this.shadowRoot)!==editor&&editor.focus(),this.editorHadFocusBeforeUpdate=!1}activateExpandToggle(key){const entry=this.rowsByKey.get(encodeKey(key));if(entry===void 0)return;const expanded=!this._expandedKeys.has(key),detail=Object.freeze({row:entry.row,rowKey:key,expanded});if(this.expansionMode!=="single"&&this.expansionMode!=="multiple"){this.emit("lr-row-expand-toggle",detail);return}requestThenCommit({requestDetail:detail,emitRequest:(requestDetail,init)=>this.emit("lr-row-expand-request",requestDetail,init),commit:()=>{const next=this.expansionMode==="single"?new Set:new Set(this._expandedKeys);expanded?next.add(key):next.delete(key);const displaced=[...this._expandedKeys].filter(other=>other!==key&&!next.has(other));this.expandedRowKeys=this.asKeySet(next);for(const other of displaced){const displacedEntry=this.rowsByKey.get(encodeKey(other));displacedEntry!==void 0&&this.emit("lr-row-expand-toggle",Object.freeze({row:displacedEntry.row,rowKey:other,expanded:!1}))}this.emit("lr-row-expand-toggle",detail)}})}rowElement(rowKey){return this.rowElementForToken(encodeKey(rowKey))}cellElement(rowKey,columnKey){return this.cellElementForToken(encodeKey(rowKey),columnKey)}editCell(rowKey,columnKey){const token=encodeKey(rowKey),trigger=normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger);if(!(trigger===void 0||!this.rowsByKey.has(token))){if(trigger==="always"){this.editorElementFor(token,columnKey)?.focus();return}this.startEditing(token,columnKey)}}expandedContentElement(rowKey){const token=encodeKey(rowKey);return[...this.renderRoot.querySelectorAll("tbody tr[data-expanded-row-key]")].find(el=>el.dataset.expandedRowKey===token)?.querySelector('[part="expanded-cell"]')??null}rowElementForToken(token){return[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")].find(el=>el.dataset.rowKey===token)??null}cellElementForToken(token,columnKey){return[...this.rowElementForToken(token)?.querySelectorAll("td[data-col-key]")??[]].find(el=>el.dataset.colKey===columnKey)??null}visibleHeaders(){return[...this.renderRoot?.querySelectorAll("th[data-col-key]")??[]].filter(el=>el.offsetParent!==null)}focusHeader(el){el?.dataset.colKey&&(this.activeColKey=el.dataset.colKey,el.focus())}focusRow(el){el?.dataset.rowKey&&(this.activeRowKey=el.dataset.rowKey,el.focus())}onHeaderKeyDown(e,th){if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.activateColumn(th.dataset.colKey);return}const headers=this.visibleHeaders(),index=headers.indexOf(th);if(index<0)return;const rtl=isRtl(this);switch(e.key){case"ArrowLeft":e.preventDefault(),this.focusHeader(headers[rtl?Math.min(headers.length-1,index+1):Math.max(0,index-1)]??null);return;case"ArrowRight":e.preventDefault(),this.focusHeader(headers[rtl?Math.max(0,index-1):Math.min(headers.length-1,index+1)]??null);return;case"Home":e.preventDefault(),this.focusHeader(headers[0]??null);return;case"End":e.preventDefault(),this.focusHeader(headers[headers.length-1]??null);return;case"ArrowDown":{e.preventDefault();const rows=[...this.renderRoot.querySelectorAll("[data-row-key]")],key=this.focusedRowKey();this.focusRow(rows.find(r=>r.dataset.rowKey===key)??rows[0]??null);return}default:return}}editableCellFor(target){const columnKey=target.dataset.colKey;return target.tagName!=="TD"||columnKey===void 0?null:normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="double-click"?{element:target,columnKey}:null}editableCellsInRow(tr){return[...tr.querySelectorAll("td[data-editable]")].filter(td=>td.offsetParent!==null&&!td.inert&&!td.closest("[inert]"))}onRowKeyDown(e,tr){const cell=this.editableCellFor(e.target);if((e.key==="Enter"||e.key==="F2")&&cell){e.preventDefault(),this.startEditing(tr.dataset.rowKey,cell.columnKey);return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.activateRow(tr.dataset.rowKey);return}if(e.key==="ArrowLeft"||e.key==="ArrowRight"){this.onRowLateralKeyDown(e,tr,cell);return}const bodyRows=[...this.renderRoot.querySelectorAll("[data-row-key]")],index=bodyRows.indexOf(tr);if(!(index<0))switch(e.key){case"ArrowDown":e.preventDefault(),this.focusRow(bodyRows[Math.min(bodyRows.length-1,index+1)]??null);return;case"ArrowUp":if(e.preventDefault(),index===0){const headers=this.visibleHeaders(),key=this.focusedColKey();this.focusHeader(headers.find(h=>h.dataset.colKey===key)??headers[0]??null)}else this.focusRow(bodyRows[index-1]??null);return;case"Home":e.preventDefault(),this.focusRow(bodyRows[0]??null);return;case"End":e.preventDefault(),this.focusRow(bodyRows[bodyRows.length-1]??null);return;default:return}}onRowLateralKeyDown(e,tr,cell){const cells=this.editableCellsInRow(tr);if(cells.length===0)return;e.preventDefault();const forward=e.key===(isRtl(this)?"ArrowLeft":"ArrowRight");if(cell===null){(forward?cells[0]:cells[cells.length-1])?.focus();return}const index=cells.indexOf(cell.element);forward?cells[index+1]?.focus():index<=0?this.focusRow(tr):cells[index-1]?.focus()}renderCellValue(col,row){return typeof col.cell=="function"?col.cell(row):(devWarnOnce(MISSING_CELL_RENDERER_WARNING,"<lr-table>: a column has no required `cell` renderer, so its cells render empty. Supply a `cell` callback for every column."),nothing)}renderCellEditor(row,col,rowKey,alwaysOn){const type=col.editType??"text",value=this.editorValue(row,col),label=col.editLabel?.(row)??this.localize("tableEditCell",void 0,{column:col.label}),onChange=event=>this.commitEdit(event,rowKey,col.key),onKeyDown=event=>this.onEditorKeyDown(event,rowKey,col.key);if(type==="select"){const options=col.editOptions??[];return html`<select
|
|
14
|
+
></span>`}syncResizeHandleValues(){for(const handle of this.renderRoot.querySelectorAll('[part="resize-handle"]')){const key=handle.dataset.colKey;if(!key)continue;const column=this.columnsByKey.get(key);if(!column||this.resizedColumnWidths.has(key)||this.parsePixelLength(column.width)!==void 0)continue;const rendered=handle.closest("th[data-col-key]")?.getBoundingClientRect().width;if(rendered&&rendered>0){const width=Math.round(rendered);handle.setAttribute("aria-valuenow",String(width)),handle.setAttribute("aria-valuetext",this.resizeValueText(width))}}}detachResizePointerListeners(){const resizeEventWindow=this.resizeEventWindow;resizeEventWindow&&(resizeEventWindow.removeEventListener("pointermove",this.onResizePointerMove),resizeEventWindow.removeEventListener("pointerup",this.onResizePointerEnd),resizeEventWindow.removeEventListener("pointercancel",this.onResizePointerEnd),resizeEventWindow.removeEventListener("lostpointercapture",this.onResizePointerEnd),this.resizeEventWindow=void 0)}rollbackResizePreview(state2){const reverted=new Map(this.resizedColumnWidths);state2.previousWidth===void 0?reverted.delete(state2.key):reverted.set(state2.key,state2.previousWidth),this.resizedColumnWidths=reverted}cancelResizeGesture(){const state2=this.resizeState;if(this.resizeState=void 0,this.detachResizePointerListeners(),!!state2){state2.handle.removeAttribute("data-resizing");try{state2.handle.releasePointerCapture?.(state2.pointerId)}catch{}this.rollbackResizePreview(state2)}}firstUpdated(changed){super.firstUpdated(changed),!this.accessibleLabel&&!this.hasAttribute("aria-label")&&!this.caption&&devWarnOnce(MISSING_ACCESSIBLE_NAME_WARNING,"<lr-table> has no accessible name: set `accessibleLabel`, a host `aria-label`, or `caption` so assistive technology can identify the grid.")}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink();const owner=this.ownerDocument.defaultView,ResizeObserverCtor=owner?.ResizeObserver;let observer;ResizeObserverCtor&&(observer=new ResizeObserverCtor(()=>{!this.isConnected||this.ownerDocument.defaultView!==owner||this.resizeObserver!==observer||this.scheduleLayoutSync()})),this.resizeObserver=observer;const base=this.renderRoot?.querySelector('[part="base"]');base&&(this.observeBase(base),this.observeTable(this.renderRoot.querySelector('[part="table"]')??void 0),this.observeHeaders())}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink(),this.cancelResizeGesture(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0;const frame=this.layoutFrame;frame&&frame.owner.cancelAnimationFrame(frame.handle),this.layoutFrame=null,this.observedBase=void 0,this.observedTable=void 0,this.observedHeaders.clear()}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0,this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.errorAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}))}localizedOverride(key,override){return override??this.localize(key)}loadingText(){return this.localizedOverride("tableLoading",this.loadingLabel)}observeBase(base){this.observedBase!==base&&(this.observedBase&&this.resizeObserver?.unobserve(this.observedBase),this.resizeObserver?.observe(base),this.observedBase=base)}observeTable(table){this.observedTable!==table&&(this.observedTable&&this.resizeObserver?.unobserve(this.observedTable),table&&this.resizeObserver?.observe(table),this.observedTable=table)}syncAutoScrollMode(){const base=this.renderRoot.querySelector('[part="base"]');if(!base)return;const overflows=this.scrollMode==="auto"&&base.scrollWidth-base.clientWidth>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX;base.toggleAttribute("data-scroll-overflow",overflows)}observeHeaders(){const headers=new Set(this.columns.some(column=>column.sticky||column.resizable)?this.renderRoot.querySelectorAll("th[data-col-key]"):[]);for(const header of this.observedHeaders)headers.has(header)||(this.resizeObserver?.unobserve(header),this.observedHeaders.delete(header));for(const header of headers)this.observedHeaders.has(header)||(this.observedHeaders.add(header),this.resizeObserver?.observe(header))}priorityTierHeaders(tier){return[...this.renderRoot.querySelectorAll(`th[data-priority="${tier}"]`)]}recomputeHiddenPriorityColumns(){const hasLowColumn=this.columns.some(col=>col.priority==="low"),hasMediumColumn=this.columns.some(col=>col.priority==="medium"),base=this.renderRoot.querySelector('[part="base"]');if(!hasLowColumn&&!hasMediumColumn){this.priorityTierNaturalWidth.clear(),this.alwaysVisibleNaturalWidth=void 0,this.priorityTierHiddenAllocation.clear(),this.priorityTierRevealAllocation.clear(),base?.removeAttribute("data-hide-priority-low"),base?.removeAttribute("data-hide-priority-medium"),this.rehomeFocusedColumn(),this.priorityToggleAvailable&&(this.priorityToggleAvailable=!1),this.hasHiddenPriorityColumns&&(this.hasHiddenPriorityColumns=!1);return}if(!base||base.clientWidth<=0){this.rehomeFocusedColumn();return}const genuineOverflow=base.scrollWidth-base.clientWidth>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,lowHeaders=hasLowColumn?this.priorityTierHeaders("low"):[],mediumHeaders=hasMediumColumn?this.priorityTierHeaders("medium"):[],refreshNaturalWidth=(tier,headers)=>{if(headers.length===0)return!1;const currentlyHidden=headers.every(header=>header.offsetParent===null);if(!currentlyHidden&&genuineOverflow){const width=headers.reduce((sum,header)=>sum+header.getBoundingClientRect().width,0);width>0&&this.priorityTierNaturalWidth.set(tier,width)}return currentlyHidden},lowActuallyHidden=refreshNaturalWidth("low",lowHeaders),mediumActuallyHidden=refreshNaturalWidth("medium",mediumHeaders);if(genuineOverflow){const alwaysWidth=[...this.renderRoot.querySelectorAll('[part="head"] > tr > th')].filter(header=>!header.hasAttribute("data-priority")).reduce((sum,header)=>sum+header.getBoundingClientRect().width,0);alwaysWidth>0&&(this.alwaysVisibleNaturalWidth=alwaysWidth)}const lowNaturalWidth=this.priorityTierNaturalWidth.get("low")??0,mediumNaturalWidth=this.priorityTierNaturalWidth.get("medium")??0,overflowAtFull=(lowActuallyHidden||mediumActuallyHidden?(this.alwaysVisibleNaturalWidth??0)+lowNaturalWidth+mediumNaturalWidth:base.scrollWidth)-base.clientWidth,measuredLow=hasLowColumn&&overflowAtFull>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,overflowAfterLow=measuredLow?overflowAtFull-lowNaturalWidth:overflowAtFull,measuredMedium=hasMediumColumn&&overflowAfterLow>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,allocation=base.offsetWidth,needsMedium=this.settlePriorityTier(base,"medium",measuredMedium,mediumActuallyHidden,allocation),needsLow=this.settlePriorityTier(base,"low",hasLowColumn&&(measuredLow||needsMedium),lowActuallyHidden,allocation);this.rehomeFocusedColumn();const toggleAvailable=needsLow||needsMedium,anyPriorityHidden=toggleAvailable&&!this.priorityColumnsVisible;this.priorityToggleAvailable!==toggleAvailable&&(this.priorityToggleAvailable=toggleAvailable),this.hasHiddenPriorityColumns!==anyPriorityHidden&&(this.hasHiddenPriorityColumns=anyPriorityHidden)}settlePriorityTier(base,tier,measured,actuallyHidden,allocation){const attribute=tier==="low"?"data-hide-priority-low":"data-hide-priority-medium",wasMarked=base.hasAttribute(attribute),revealedAt=this.priorityTierRevealAllocation.get(tier);this.priorityTierRevealAllocation.delete(tier);const hiddenAt=this.priorityTierHiddenAllocation.get(tier),held=actuallyHidden&&hiddenAt!==void 0&&allocation<=hiddenAt+TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,hide=measured||held;return hide?(!wasMarked||hiddenAt===void 0)&&this.priorityTierHiddenAllocation.set(tier,Math.max(allocation,revealedAt??allocation)):(this.priorityTierHiddenAllocation.delete(tier),wasMarked&&actuallyHidden&&this.priorityTierRevealAllocation.set(tier,allocation)),base.toggleAttribute(attribute,hide),hide}rehomeFocusedColumn(){const visible=this.visibleHeaders();visible.length===0||this.activeColKey===null||visible.some(header=>header.dataset.colKey===this.activeColKey)||(this.activeColKey=visible[0].dataset.colKey??null)}keyOf(row,index){try{const key=this.rowKey?this.rowKey(row):index;return typeof key=="string"?key.trim().length===0?void 0:key:typeof key=="number"?key:void 0}catch{return}}canonicalRowEntries(){const inputs=this.canonicalRowEntriesInputs;if(this.cachedCanonicalRowEntries!==null&&inputs?.rows===this.rows&&inputs.rowKey===this.rowKey)return this.cachedCanonicalRowEntries;const entries=[],seen=new Set;return this.rows.forEach((row,index)=>{const key=this.keyOf(row,index);if(key===void 0)return;const encoded=encodeKey(key);seen.has(encoded)||(seen.add(encoded),entries.push({row,index,key}))}),this.canonicalRowEntriesInputs={rows:this.rows,rowKey:this.rowKey},this.cachedCanonicalRowEntries=entries,entries}matchingEntries(){const text=(this.filterText??"").trim(),locale=text===""?"":this.effectiveLocale,canonicalEntries=this.canonicalRowEntries(),inputs=this.matchingEntriesInputs;if(this.cachedMatchingEntries!==null&&inputs!==null&&inputs.entries===canonicalEntries&&inputs.filter===this.filter&&inputs.text===text&&inputs.locale===locale)return this.cachedMatchingEntries;let entries;if(text==="")entries=canonicalEntries;else{const intlLocale=this.effectiveLocale,normalized=text.toLocaleLowerCase(intlLocale);entries=canonicalEntries.filter(({row})=>this.filter?this.filter(row,text):safeStringifyForFilter(row).toLocaleLowerCase(intlLocale).includes(normalized))}return this.matchingEntriesInputs={entries:canonicalEntries,filter:this.filter,text,locale},this.cachedMatchingEntries=entries,entries}get normalizedPageSize(){return finiteInteger(this.pageSize,DEFAULT_PAGE_SIZE,1,MAX_PAGE_SIZE)}get effectiveSkeletonRows(){const explicit=finiteCount(this.skeletonRows,0,MAX_SKELETON_ROWS);if(explicit>0)return explicit;const pageSize=this.normalizedPageSize;return pageSize===DEFAULT_PAGE_SIZE?DEFAULT_SKELETON_ROWS:Math.min(pageSize,MAX_SKELETON_ROWS)}get matchingTotalItems(){const totalItems=finiteInteger(this.totalItems,-1);return totalItems>=0?totalItems:this.matchingEntries().length}get serverUnknownTotal(){return this.paginationMode==="server"&&this.unknownTotal}get pageCount(){const pageSize=this.normalizedPageSize;return pageSize>0?Math.ceil(this.matchingTotalItems/pageSize):0}get appliedPage(){return this.pageCount===0?1:finiteInteger(this.page,1,1,this.pageCount)}sortedEntries(){const entries=this.matchingEntries();if(this.sortMode!=="client"||this.sortKey==="")return entries;const col=this.columnsByKey.get(this.sortKey);if(!col?.sortable)return entries;const locale=this.effectiveLocale,inputs=this.sortedEntriesInputs;if(this.cachedSortedEntries!==null&&inputs!==null&&inputs.entries===entries&&inputs.columns===this.columns&&inputs.mode===this.sortMode&&inputs.key===this.sortKey&&inputs.dir===this.sortDir&&inputs.locale===locale&&inputs.groupBy===this.groupBy)return this.cachedSortedEntries;const collator=getCollator(locale,{numeric:!0}),dir=this.sortDir==="desc"?-1:1,decorated=entries.map(entry=>{const raw=typeof col.sortValue=="function"?col.sortValue(entry.row):typeof col.cell=="function"?String(col.cell(entry.row)??""):"";return{entry,value:typeof raw=="number"&&!Number.isFinite(raw)?null:raw}}),compare=(a,b)=>{const av=a.value,bv=b.value;return av==null&&bv==null?0:av==null?1:bv==null?-1:typeof av=="number"&&typeof bv=="number"?(av-bv)*dir:collator.compare(String(av),String(bv))*dir};let sorted;const groupBy=this.groupBy;if(groupBy===void 0)decorated.sort(compare),sorted=decorated.map(decoration=>decoration.entry);else{const buckets=new Map;for(const decoration of decorated){const groupKey=groupBy(decoration.entry.row),bucket=buckets.get(groupKey);bucket===void 0?buckets.set(groupKey,[decoration]):bucket.push(decoration)}const ordered=[...buckets.values()],constantWithinEveryGroup=ordered.every(bucket=>bucket.every(decoration=>compare(decoration,bucket[0])===0));constantWithinEveryGroup&&ordered.sort((a,b)=>compare(a[0],b[0])),sorted=[];for(const bucket of ordered){constantWithinEveryGroup||bucket.sort(compare);for(const decoration of bucket)sorted.push(decoration.entry)}}return this.sortedEntriesInputs={entries,columns:this.columns,mode:this.sortMode,key:this.sortKey,dir:this.sortDir,locale,groupBy},this.cachedSortedEntries=sorted,sorted}renderedEntries(){const entries=this.sortedEntries();if(this.paginationMode==="server")return entries.slice(0,this.normalizedPageSize);const start=(this.appliedPage-1)*this.normalizedPageSize;return entries.slice(start,start+this.normalizedPageSize)}get viewRows(){return Object.freeze(this.sortedEntries().map(entry=>entry.row))}get pageRows(){return Object.freeze(this.renderedEntries().map(entry=>entry.row))}focusedColKey(){const visible=this.visibleHeaders(),visibleKeys=new Set(visible.map(el=>el.dataset.colKey).filter(key=>key!==void 0&&this.columnsByKey.has(key)));return this.activeColKey!==null&&this.columnsByKey.has(this.activeColKey)&&(visibleKeys.size===0||visibleKeys.has(this.activeColKey))?this.activeColKey:visible.find(el=>el.dataset.colKey!==void 0&&this.columnsByKey.has(el.dataset.colKey))?.dataset.colKey??this.columns[0]?.key??null}focusedRowKey(){if(this.activeRowKey!==null&&this.rowsByKey.has(this.activeRowKey))return this.activeRowKey;const selectedKey=this._selectedKeys.values().next().value;if(selectedKey!==void 0){const selected=encodeKey(selectedKey);if(this.rowsByKey.has(selected))return selected}const first=this.renderedEntries()[0];return first?encodeKey(first.key):null}rowsAffectingRovingFocusChanged(changed){return changed.has("rows")||changed.has("rowKey")||changed.has("filterText")||changed.has("filter")||changed.has("page")||changed.has("pageSize")||changed.has("paginationMode")||changed.has("totalItems")||changed.has("columns")||changed.has("sortKey")||changed.has("sortDir")||changed.has("sortMode")||changed.has("groupBy")||this.rowsLocale!==this.effectiveLocale}captureRovingFocus(changed){this.rovingFocusSnapshot=null;const active=activeElementIn(this.shadowRoot),HTMLElementCtor=this.ownerDocument?.defaultView?.HTMLElement;if(!(!HTMLElementCtor||!(active instanceof HTMLElementCtor))){if(changed.has("columns")&&active.matches("th[data-col-key]")){const headers=this.visibleHeaders(),key=active.dataset.colKey,index=headers.indexOf(active);key!==void 0&&index>=0&&(this.rovingFocusSnapshot={kind:"header",key,index,targetKey:null,element:active});return}if(this.rowsAffectingRovingFocusChanged(changed)&&active.matches("tr[data-row-key]")){const renderedRows=[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")],key=active.dataset.rowKey,index=renderedRows.indexOf(active);key!==void 0&&index>=0&&(this.rovingFocusSnapshot={kind:"row",key,index,targetKey:null,element:active})}}}resolveRovingFocusTarget(){const snapshot=this.rovingFocusSnapshot;if(snapshot===null)return;const keys=snapshot.kind==="header"?this.columns.map(column=>column.key):[...this.rowsByKey.keys()];snapshot.targetKey=keys.includes(snapshot.key)?snapshot.key:keys[Math.min(snapshot.index,keys.length-1)]??null,snapshot.kind==="header"?this.activeColKey=snapshot.targetKey:this.activeRowKey=snapshot.targetKey}willUpdate(changed){if(super.willUpdate(changed),this.captureRovingFocus(changed),this.selectionMode==="single"&&this._selectedKeys.size>1&&(changed.has("selectionMode")||changed.has("selectedRowKeys"))){const first=this._selectedKeys.values().next().value;if(this.selectedRowKeys=this.asKeySet(first===void 0?new Set:new Set([first])),this.hasUpdated){const rowKeys=this.asKeyList(Object.freeze(first===void 0?[]:[first]));this.emit("lr-selection-change",Object.freeze({rowKeys}))}}if(this.expansionMode==="single"&&this._expandedKeys.size>1&&(changed.has("expansionMode")||changed.has("expandedRowKeys"))){const first=this._expandedKeys.values().next().value;this.expandedRowKeys=this.asKeySet(first===void 0?new Set:new Set([first]))}if(!this.hasUpdated){const parsed=readPersistedState(this.storageFullKey,v=>typeof v=="object"&&v!==null);parsed&&typeof parsed.priorityColumnsVisible=="boolean"&&!isPersistedPropertyExplicitlySet(this,"priorityColumnsVisible")&&(this.priorityColumnsVisible=parsed.priorityColumnsVisible)}if(changed.has("columns")&&(this.columnsByKey=new Map(this.columns.map(c=>[c.key,c]))),this.rowsAffectingRovingFocusChanged(changed)&&(this.rowsByKey=new Map(this.renderedEntries().map(entry=>[encodeKey(entry.key),entry])),this.rowsLocale=this.effectiveLocale),this.resolveRovingFocusTarget(),this.editingCell!==null){const column=this.columnsByKey.get(this.editingCell.columnKey);(!this.rowsByKey.has(this.editingCell.rowKey)||normalizedEditTrigger(column?.editTrigger)!=="double-click")&&(this.editingCell=null)}this.editorHadFocusBeforeUpdate=this.focusedEditorCell!==null&&activeElementIn(this.shadowRoot)===this.editorElementFor(this.focusedEditorCell.rowKey,this.focusedEditorCell.columnKey)}stickyOffsets(){const offsets=new Map,headerWidths=new Map;for(const el of this.renderRoot.querySelectorAll("th[data-col-key]")){const key=el.dataset.colKey;key!==void 0&&!headerWidths.has(key)&&headerWidths.set(key,el.offsetWidth)}const headerWidth=key=>headerWidths.get(key)??0;let runningStart=0;for(const col of this.columns)stickyDirection(col.sticky)==="start"&&(offsets.set(col.key,runningStart),runningStart+=headerWidth(col.key));let runningEnd=0;for(let i=this.columns.length-1;i>=0;i--){const col=this.columns[i];col&&stickyDirection(col.sticky)==="end"&&(offsets.set(col.key,runningEnd),runningEnd+=headerWidth(col.key))}return offsets}computeHeatDomain(hasHeatTint){if(!hasHeatTint)return null;const values=[];for(const entry of this.matchingEntries())for(const col of this.columns){const v=col.heatValue?.(entry.row);v!=null&&Number.isFinite(v)&&values.push(v)}const auto=minMax(values),lo=this.heatTintScale?.min??auto?.[0],hi=this.heatTintScale?.max??auto?.[1];return lo===void 0||hi===void 0?null:[lo,hi]}heatShare(col,row,domain){if(!col.heatValue||!domain)return null;const v=col.heatValue(row);if(v==null||!Number.isFinite(v))return null;const[lo,hi]=domain;return`${(finiteRatio(v,lo,hi)*100).toFixed(2)}%`}applyStickyOffsets(){if(!this.columns.some(c=>c.sticky))return;const offsets=this.stickyOffsets();this.renderRoot.querySelectorAll("[data-col-key]").forEach(el=>{const key=el.dataset.colKey;key!==void 0&&offsets.has(key)&&el.style.setProperty("--lr-table-sticky-offset",`${offsets.get(key)}px`)})}updated(changed){super.updated(changed),this.firstUpdateAnnouncementsReady&&changed.has("loading")&&this.loading&&this.announcementSink?.announce(this.loadingText());const announcesErrorTransition=this.firstUpdateAnnouncementsReady&&changed.has("error")&&this.error,announcesMountedError=!this.firstUpdateAnnouncementsReady&&this.announce&&this.error;if((announcesErrorTransition||announcesMountedError)&&this.errorAnnouncementSink?.announce(this.localizedOverride("tableLoadFailed",this.errorHeading)),this.firstUpdateAnnouncementsReady=!0,this.persistReady&&changed.has("priorityColumnsVisible")&&writePersistedState(this.storageFullKey,{priorityColumnsVisible:this.priorityColumnsVisible}),this.persistReady=!0,changed.has("columns")||changed.has("revealColumnsLabel")||changed.has("hideColumnsLabel")||changed.has("priorityColumnsVisible")||changed.has("storageKey")){const inertMembers=[],labelsInert=this.revealColumnsLabel!==void 0||this.hideColumnsLabel!==void 0;labelsInert&&inertMembers.push("`revealColumnsLabel`/`hideColumnsLabel`"),isPersistedPropertyExplicitlySet(this,"priorityColumnsVisible")&&inertMembers.push("`priorityColumnsVisible`"),this.storageKey&&inertMembers.push("`storageKey`"),inertMembers.length>0&&this.columns.length>0&&!this.columns.some(col=>col.priority)&&devWarnOnce(INERT_PRIORITY_COLUMN_CONFIG_WARNING,`<lr-table>: ${inertMembers.join(", ")} `+(inertMembers.length>1||labelsInert?"have":"has")+" no effect unless at least one column declares `priority`.")}(changed.has("columns")||changed.has("rows")||changed.has("rowKey"))&&this.applyStickyOffsets(),this.syncResizeHandleValues();const base=this.renderRoot.querySelector('[part="base"]');if(base&&this.observeBase(base),this.observeTable(this.renderRoot.querySelector('[part="table"]')??void 0),this.syncAutoScrollMode(),this.observeHeaders(),this.restoreRovingFocus(),this.hasAlwaysOnEditors&&this.restoreAlwaysOnEditorFocus(),changed.has("editingCell"))if(this.editingCell){const{rowKey,columnKey}=this.editingCell;queueMicrotask(()=>this.editorElementFor(rowKey,columnKey)?.focus())}else{const previous=changed.get("editingCell");if(previous){const{rowKey,columnKey}=previous;queueMicrotask(()=>this.cellElementForToken(rowKey,columnKey)?.focus())}}queueMicrotask(()=>this.recomputeHiddenPriorityColumns())}restoreRovingFocus(){const snapshot=this.rovingFocusSnapshot;if(this.rovingFocusSnapshot=null,snapshot===null)return;const internalActive=activeElementIn(this.shadowRoot);if(internalActive!==null&&internalActive!==snapshot.element)return;const documentActive=activeElementIn(this.ownerDocument);if(documentActive!==null&&documentActive!==this&&documentActive!==this.ownerDocument.body)return;const candidates=snapshot.kind==="header"?this.visibleHeaders():[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")],target=candidates.find(candidate=>snapshot.kind==="header"?candidate.dataset.colKey===snapshot.targetKey:candidate.dataset.rowKey===snapshot.targetKey)??candidates[Math.min(snapshot.index,candidates.length-1)]??null;snapshot.kind==="header"?this.focusHeader(target):this.focusRow(target)}activateColumn(key){this.activeColKey=key;const col=this.columnsByKey.get(key);if(!col?.sortable)return;const sortDir=this.sortKey===key?this.sortDir==="asc"?"desc":"asc":col.defaultSortDir??this.defaultSortDir,request=Object.freeze({phase:"request",sortKey:col.key,sortDir});this.emit("lr-sort-request",request,{cancelable:!0}).defaultPrevented||(this.sortMode==="client"&&(this.sortKey=col.key,this.sortDir=sortDir),this.emit("lr-sort",Object.freeze({phase:"commit",sortKey:col.key,sortDir})))}activateRow(key){this.activeRowKey=key;const entry=this.rowsByKey.get(key);if(entry===void 0)return;const{row,key:selectedKey}=entry;if(this.emit("lr-row-click",Object.freeze({row})),this.selectionMode==="single"){this.selectedRowKeys=this.asKeySet(new Set([selectedKey]));const rowKeys=this.asKeyList(Object.freeze([selectedKey]));this.emit("lr-selection-change",Object.freeze({rowKeys}))}else if(this.selectionMode==="multiple"){const rawKey=selectedKey,next=new Set(this._selectedKeys);next.has(rawKey)?next.delete(rawKey):next.add(rawKey),this.selectedRowKeys=this.asKeySet(next);const rowKeys=this.asKeyList(Object.freeze([...next]));this.emit("lr-selection-change",Object.freeze({rowKeys}))}}get hasAlwaysOnEditors(){return this.columns.some(col=>normalizedEditTrigger(col.editTrigger)==="always")}editorValue(row,column){const value=column.editValue?.(row)??row[column.key]??"";return String(value)}startEditing(rowKey,columnKey){const column=this.columnsByKey.get(columnKey);normalizedEditTrigger(column?.editTrigger)!=="double-click"||!this.rowsByKey.has(rowKey)||(this.editingCell={rowKey,columnKey})}commitEdit(event,rowKey,columnKey){event.stopPropagation();const field=event.currentTarget,entry=this.rowsByKey.get(rowKey),column=this.columnsByKey.get(columnKey),isTransient=this.editingCell?.rowKey===rowKey&&this.editingCell.columnKey===columnKey;if(!entry||!column||normalizedEditTrigger(column.editTrigger)===void 0){isTransient&&(this.editingCell=null);return}const value=column.editType==="number"&&field.value!==""?Number(field.value):field.value;this.emit("lr-cell-edit",Object.freeze({row:entry.row,columnKey,value})),isTransient&&(this.editingCell=null)}editorElementFor(rowKey,columnKey){return this.cellElementForToken(rowKey,columnKey)?.querySelector('[part="cell-editor"]')??null}restoreAlwaysOnEditorFocus(){const cell=this.focusedEditorCell;if(cell===null)return;const editor=this.editorElementFor(cell.rowKey,cell.columnKey);editor===null?this.focusedEditorCell=null:this.editorHadFocusBeforeUpdate&&activeElementIn(this.shadowRoot)!==editor&&editor.focus(),this.editorHadFocusBeforeUpdate=!1}activateExpandToggle(key){const entry=this.rowsByKey.get(encodeKey(key));if(entry===void 0)return;const expanded=!this._expandedKeys.has(key),detail=Object.freeze({row:entry.row,rowKey:key,expanded});if(this.expansionMode!=="single"&&this.expansionMode!=="multiple"){this.emit("lr-row-expand-toggle",detail);return}requestThenCommit({requestDetail:detail,emitRequest:(requestDetail,init)=>this.emit("lr-row-expand-request",requestDetail,init),commit:()=>{const next=this.expansionMode==="single"?new Set:new Set(this._expandedKeys);expanded?next.add(key):next.delete(key);const displaced=[...this._expandedKeys].filter(other=>other!==key&&!next.has(other));this.expandedRowKeys=this.asKeySet(next);for(const other of displaced){const displacedEntry=this.rowsByKey.get(encodeKey(other));displacedEntry!==void 0&&this.emit("lr-row-expand-toggle",Object.freeze({row:displacedEntry.row,rowKey:other,expanded:!1}))}this.emit("lr-row-expand-toggle",detail)}})}rowElement(rowKey){return this.rowElementForToken(encodeKey(rowKey))}cellElement(rowKey,columnKey){return this.cellElementForToken(encodeKey(rowKey),columnKey)}editCell(rowKey,columnKey){const token=encodeKey(rowKey),trigger=normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger);if(!(trigger===void 0||!this.rowsByKey.has(token))){if(trigger==="always"){this.editorElementFor(token,columnKey)?.focus();return}this.startEditing(token,columnKey)}}expandedContentElement(rowKey){const token=encodeKey(rowKey);return[...this.renderRoot.querySelectorAll("tbody tr[data-expanded-row-key]")].find(el=>el.dataset.expandedRowKey===token)?.querySelector('[part="expanded-cell"]')??null}rowElementForToken(token){return[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")].find(el=>el.dataset.rowKey===token)??null}cellElementForToken(token,columnKey){return[...this.rowElementForToken(token)?.querySelectorAll("td[data-col-key]")??[]].find(el=>el.dataset.colKey===columnKey)??null}visibleHeaders(){return[...this.renderRoot?.querySelectorAll("th[data-col-key]")??[]].filter(el=>el.offsetParent!==null)}focusHeader(el){el?.dataset.colKey&&(this.activeColKey=el.dataset.colKey,el.focus())}focusRow(el){el?.dataset.rowKey&&(this.activeRowKey=el.dataset.rowKey,el.focus())}onHeaderKeyDown(e,th){if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.activateColumn(th.dataset.colKey);return}const headers=this.visibleHeaders(),index=headers.indexOf(th);if(index<0)return;const rtl=isRtl(this);switch(e.key){case"ArrowLeft":e.preventDefault(),this.focusHeader(headers[rtl?Math.min(headers.length-1,index+1):Math.max(0,index-1)]??null);return;case"ArrowRight":e.preventDefault(),this.focusHeader(headers[rtl?Math.max(0,index-1):Math.min(headers.length-1,index+1)]??null);return;case"Home":e.preventDefault(),this.focusHeader(headers[0]??null);return;case"End":e.preventDefault(),this.focusHeader(headers[headers.length-1]??null);return;case"ArrowDown":{e.preventDefault();const rows=[...this.renderRoot.querySelectorAll("[data-row-key]")],key=this.focusedRowKey();this.focusRow(rows.find(r=>r.dataset.rowKey===key)??rows[0]??null);return}default:return}}editableCellFor(target){const columnKey=target.dataset.colKey;return target.tagName!=="TD"||columnKey===void 0?null:normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="double-click"?{element:target,columnKey}:null}editableCellsInRow(tr){return[...tr.querySelectorAll("td[data-editable]")].filter(td=>td.offsetParent!==null&&!td.inert&&!td.closest("[inert]"))}onRowKeyDown(e,tr){const cell=this.editableCellFor(e.target);if((e.key==="Enter"||e.key==="F2")&&cell){e.preventDefault(),this.startEditing(tr.dataset.rowKey,cell.columnKey);return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.activateRow(tr.dataset.rowKey);return}if(e.key==="ArrowLeft"||e.key==="ArrowRight"){this.onRowLateralKeyDown(e,tr,cell);return}const bodyRows=[...this.renderRoot.querySelectorAll("[data-row-key]")],index=bodyRows.indexOf(tr);if(!(index<0))switch(e.key){case"ArrowDown":e.preventDefault(),this.focusRow(bodyRows[Math.min(bodyRows.length-1,index+1)]??null);return;case"ArrowUp":if(e.preventDefault(),index===0){const headers=this.visibleHeaders(),key=this.focusedColKey();this.focusHeader(headers.find(h=>h.dataset.colKey===key)??headers[0]??null)}else this.focusRow(bodyRows[index-1]??null);return;case"Home":e.preventDefault(),this.focusRow(bodyRows[0]??null);return;case"End":e.preventDefault(),this.focusRow(bodyRows[bodyRows.length-1]??null);return;default:return}}onRowLateralKeyDown(e,tr,cell){const cells=this.editableCellsInRow(tr);if(cells.length===0)return;e.preventDefault();const forward=e.key===(isRtl(this)?"ArrowLeft":"ArrowRight");if(cell===null){(forward?cells[0]:cells[cells.length-1])?.focus();return}const index=cells.indexOf(cell.element);forward?cells[index+1]?.focus():index<=0?this.focusRow(tr):cells[index-1]?.focus()}renderCellValue(col,row){return typeof col.cell=="function"?col.cell(row):(devWarnOnce(MISSING_CELL_RENDERER_WARNING,"<lr-table>: a column has no required `cell` renderer, so its cells render empty. Supply a `cell` callback for every column."),nothing)}renderCellEditor(row,col,rowKey,alwaysOn){const type=col.editType??"text",value=this.editorValue(row,col),label=col.editLabel?.(row)??this.localize("tableEditCell",void 0,{column:col.label}),onChange=event=>this.commitEdit(event,rowKey,col.key),onKeyDown=event=>this.onEditorKeyDown(event,rowKey,col.key);if(type==="select"){const options=col.editOptions??[];return html`<select
|
|
15
15
|
part="cell-editor"
|
|
16
16
|
aria-label=${label}
|
|
17
17
|
.value=${value}
|
|
@@ -240,6 +240,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
240
240
|
.total=${this.serverUnknownTotal?-1:this.matchingTotalItems}
|
|
241
241
|
.hasNext=${this.hasNext}
|
|
242
242
|
.strings=${this.strings}
|
|
243
|
+
@lr-before-page-change=${this.stopOwnedEvent}
|
|
243
244
|
@lr-activate=${this.stopOwnedEvent}
|
|
244
245
|
@lr-page-change=${this.onPaginationChange}
|
|
245
246
|
></lr-pagination>`:nothing}
|
|
@@ -67,6 +67,11 @@ export type ButtonFormMethod='get'|'post'|'dialog';export interface LyraButtonEv
|
|
|
67
67
|
* In a constrained row the default-slot label ellipsizes (set `wrap` for a multi-line label
|
|
68
68
|
* instead), while each `start`/`end` adornment is capped at 40% of the control so unbroken
|
|
69
69
|
* consumer content cannot force the button wider.
|
|
70
|
+
* A detected icon-only label has no text to ellipsize, so it does not clip paint: a glow drawn
|
|
71
|
+
* around the glyph (such as `gemstoneSelectedGlyphStyles`' drop-shadow halo on a
|
|
72
|
+
* `data-lr-gemstone-selected` wrapper) reaches past the label box instead of being cut to a
|
|
73
|
+
* square. A text label, including one beside a glowing glyph, keeps the truncation clip, and the
|
|
74
|
+
* `start`/`end` wrappers always clip, so slot a glowing glyph into the default slot on its own.
|
|
70
75
|
* The label does **not** grow to fill a stretched button: icon and label centre together under
|
|
71
76
|
* `--lr-button-justify`. A `with-caret` button, and one with an `end`/`suffix` adornment, keep the
|
|
72
77
|
* old growing label so that trailing affordance stays pinned to the trailing content edge;
|
|
@@ -90,7 +95,8 @@ export type ButtonFormMethod='get'|'post'|'dialog';export interface LyraButtonEv
|
|
|
90
95
|
* @csspart base - Compatibility name for the internal control; use `button`.
|
|
91
96
|
* @csspart button - The internal native `<button>` (or an `<a>` for a safe link). It is the same
|
|
92
97
|
* node as `base`. Circle and icon-only states retain the shared minimum icon-button target.
|
|
93
|
-
* @csspart label - The default-slot label wrapper.
|
|
98
|
+
* @csspart label - The default-slot label wrapper. It clips and ellipsizes a text label; in the
|
|
99
|
+
* detected icon-only state it leaves paint overflow visible so a glyph's glow is not cut off.
|
|
94
100
|
* @csspart start - The `start` slot wrapper.
|
|
95
101
|
* @csspart prefix - Shoelace alias for `start`; both names are on the same wrapper.
|
|
96
102
|
* @csspart end - The `end` slot wrapper.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from"lit";const styles=css`:host{--_lr-button-width:100%;--_lr-button-size-2xs:var(--lr-form-control-height-2xs);--_lr-button-size-xs:var(--lr-form-control-height-xs);--_lr-button-size-s:var(--lr-form-control-height-s);--_lr-button-size-m:var(--lr-form-control-height-m);--_lr-button-size-l:var(--lr-form-control-height-l);--_lr-button-size-xl:var(--lr-form-control-height-xl);--_lr-button-padding-block:var(--lr-form-control-padding-block);--_lr-button-padding-inline:var(--lr-form-control-padding-inline);--_lr-button-font-size:var(--lr-form-control-font-size);--_lr-button-min-height:var(--lr-button-size-m,var(--_lr-button-size-m));--_lr-button-gap:var(--lr-form-control-gap);--_lr-button-radius:var(--lr-form-control-radius);--_lr-button-caret-size:var(--lr-size-0-75em);--_lr-button-accent:var(--lr-color-fill-loud);--_lr-button-fill:var(--lr-color-fill-quiet);--_lr-button-on-fill:var(--lr-color-on-quiet);--_lr-button-border:var(--lr-color-border-normal);--_lr-button-outlined-border:var(--lr-color-border-strong);--_lr-button-outlined-fill:transparent;--_lr-button-quiet-border:var(--lr-color-border);--_lr-button-quiet-text:var(--lr-color-text-quiet);--_lr-button-accent-fill:var(--lr-color-fill-loud);--_lr-button-accent-on-fill:var(--lr-color-on-loud);--_lr-button-resolved-color:var(--lr-button-on-fill,var(--_lr-button-on-fill));--_lr-button-resolved-border:var(--lr-button-border,var(--_lr-button-border));--_lr-button-hover-base:var(--lr-color-surface);--_lr-button-hover-background:color-mix(in oklab, var(--lr-button-hover-base,var(--_lr-button-hover-base)), var(--lr-color-mix-partner) var(--lr-color-mix-hover));--_lr-button-active-background:color-mix(in oklab, var(--lr-button-hover-base,var(--_lr-button-hover-base)), var(--lr-color-mix-partner) var(--lr-color-mix-active));min-inline-size:0;max-inline-size:100%;display:inline-block}:host([appearance=filled]),:host([appearance=filled-outlined]){--_lr-button-hover-base:var(--lr-button-fill,var(--_lr-button-fill))}:host([appearance=accent]){--_lr-button-hover-base:var(--lr-button-accent-fill,var(--_lr-button-accent-fill));--_lr-button-resolved-color:var(--lr-button-accent-on-fill,var(--_lr-button-accent-on-fill));--_lr-button-resolved-border:var(--lr-button-accent-fill,var(--_lr-button-accent-fill))}:host([outline]){--_lr-button-hover-base:var(--lr-color-surface)}:host([appearance=outlined]),:host([outline]){--_lr-button-resolved-color:var(--lr-button-accent,var(--_lr-button-accent));--_lr-button-resolved-border:var(--lr-button-outlined-border,var(--_lr-button-outlined-border))}:host([appearance=filled-outlined]){--_lr-button-resolved-border:var(--lr-button-outlined-border,var(--_lr-button-outlined-border))}:host([appearance=plain]){--_lr-button-resolved-color:var(--lr-button-accent,var(--_lr-button-accent));--_lr-button-resolved-border:transparent}:host([appearance=quiet]){--_lr-button-resolved-color:var(--lr-button-quiet-text,var(--_lr-button-quiet-text));--_lr-button-resolved-border:var(--lr-button-quiet-border,var(--_lr-button-quiet-border))}:host(:not([variant])),:host([variant=neutral]){--_lr-button-accent:var(--lr-color-text)}:host([pill]),:host([circle]){--_lr-button-radius:var(--lr-radius-pill)}[part~=base]{box-sizing:border-box;inline-size:var(--lr-button-width,var(--_lr-button-width));min-inline-size:0;max-inline-size:100%;min-block-size:var(--lr-button-height,var(--lr-button-min-height,var(--_lr-button-min-height)));block-size:var(--lr-button-height,auto);align-items:center;justify-content:var(--lr-button-justify,center);gap:var(--lr-button-gap,var(--_lr-button-gap));padding-inline:var(--lr-button-padding-inline,var(--_lr-button-padding-inline));padding-block:var(--lr-button-padding-block,var(--_lr-button-padding-block));border-radius:var(--lr-button-radius,var(--_lr-button-radius));border:var(--lr-border-width-thin) solid var(--lr-button-border,var(--_lr-button-border));font:inherit;font-weight:var(--lr-font-weight-semibold);font-size:var(--lr-button-font-size,var(--_lr-button-font-size));cursor:pointer;box-shadow:var(--lr-button-shadow,none);text-decoration:none;display:inline-flex;position:relative}:host([appearance=filled]) [part~=base]{background:var(--lr-button-fill,var(--_lr-button-fill));color:var(--lr-button-on-fill,var(--_lr-button-on-fill))}:host([appearance=accent]) [part~=base]{background:var(--lr-button-accent-fill,var(--_lr-button-accent-fill));color:var(--lr-button-accent-on-fill,var(--_lr-button-accent-on-fill));border-color:var(--lr-button-accent-fill,var(--_lr-button-accent-fill))}:host([appearance=outlined]) [part~=base],:host([outline]) [part~=base]{background:var(--lr-button-outlined-fill,var(--_lr-button-outlined-fill));color:var(--lr-button-accent,var(--_lr-button-accent));border-color:var(--lr-button-outlined-border,var(--_lr-button-outlined-border))}:host([appearance=filled-outlined]) [part~=base]{background:var(--lr-button-fill,var(--_lr-button-fill));color:var(--lr-button-on-fill,var(--_lr-button-on-fill));border-color:var(--lr-button-outlined-border,var(--_lr-button-outlined-border))}:host([appearance=plain]) [part~=base]{color:var(--lr-button-accent,var(--_lr-button-accent));background:0 0;border-color:#0000}:host([appearance=quiet]) [part~=base]{color:var(--lr-button-quiet-text,var(--_lr-button-quiet-text));border-color:var(--lr-button-quiet-border,var(--_lr-button-quiet-border));background:0 0}[part~=base]:disabled,[part~=base][aria-disabled=true]{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part~=base]:not(:disabled,[aria-disabled=true]){transition:background-color var(--lr-transition-fast), color var(--lr-transition-fast), transform var(--lr-transition-fast)}[part~=base]:not(:disabled,[aria-disabled=true]):hover{background:var(--lr-button-hover-background,var(--_lr-button-hover-background));color:var(--lr-button-hover-color,var(--_lr-button-resolved-color));border-color:var(--lr-button-hover-border,var(--_lr-button-resolved-border))}[part~=base]:not(:disabled,[aria-disabled=true]):active{background:var(--lr-button-active-background,var(--_lr-button-active-background));transform:scale(var(--lr-button-active-scale,.9875))}@media (prefers-reduced-motion:reduce){[part~=base]:not(:disabled,[aria-disabled=true]):active{transform:none}}[part~=base]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part~=start],[part~=end]{text-overflow:ellipsis;white-space:nowrap;flex:none;align-items:center;min-inline-size:0;max-inline-size:40%;display:inline-flex;overflow:hidden}[part~=start] ::slotted(*),[part~=end] ::slotted(*){text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;max-inline-size:100%;overflow:hidden}[part=label]{flex:var(--lr-button-label-grow,0) 1 auto;text-align:start;text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}[part~=base][data-grow-label] [part=label]{flex-grow:var(--lr-button-label-grow,1)}:host([wrap]) [part=label]{text-overflow:clip;white-space:normal;overflow-wrap:anywhere;overflow:visible}[part~=start][hidden],[part~=end][hidden]{display:none}:host([circle]) [part~=base],[part~=base][data-icon-button]{inline-size:var(--lr-button-height,var(--lr-button-min-height,var(--_lr-button-min-height)));min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);aspect-ratio:1;padding-inline:var(--lr-button-padding-block,var(--_lr-button-padding-block))}[part=caret]{font-size:var(--lr-button-caret-size,var(--_lr-button-caret-size));flex:none;align-items:center;display:inline-flex}[part=caret] svg{transform:rotate(90deg)}:host([size="2xs"]){--_lr-button-min-height:var(--lr-button-size-2xs,var(--_lr-button-size-2xs))}:host([size=xs]){--_lr-button-min-height:var(--lr-button-size-xs,var(--_lr-button-size-xs))}:host([size=s]),:host([size=small]){--_lr-button-min-height:var(--lr-button-size-s,var(--_lr-button-size-s))}:host([size=l]),:host([size=large]){--_lr-button-min-height:var(--lr-button-size-l,var(--_lr-button-size-l))}:host([size=xl]){--_lr-button-min-height:var(--lr-button-size-xl,var(--_lr-button-size-xl))}:host([appearance=link]) [part~=base]{block-size:auto;min-block-size:0;inline-size:auto;color:var(--lr-button-accent,var(--_lr-button-accent));font:inherit;text-underline-offset:var(--lr-size-0-15rem);box-shadow:none;background:0 0;border:0;border-radius:0;padding:0;text-decoration:underline}:host([appearance=link]) [part~=base]:not(:disabled,[aria-disabled=true]):hover{color:color-mix(in oklab, var(--lr-button-accent,var(--_lr-button-accent)), var(--lr-color-mix-partner) var(--lr-color-mix-hover));background:0 0}:host([appearance=link]) [part~=base]:not(:disabled,[aria-disabled=true]):active{color:color-mix(in oklab, var(--lr-button-accent,var(--_lr-button-accent)), var(--lr-color-mix-partner) var(--lr-color-mix-active));background:0 0}[part=spinner]{animation:lr-button-spin var(--lr-button-spinner-duration,var(--lr-transition-ambient)) infinite;justify-content:center;align-items:center;display:inline-flex;position:absolute;inset:0}:host([loading]) [part~=start],:host([loading]) [part=label],:host([loading]) [part~=end],:host([loading]) [part=caret]{opacity:0}@keyframes lr-button-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part=spinner]{animation-duration:.001ms;animation-iteration-count:1}}`;export{styles};
|
|
1
|
+
import{css}from"lit";const styles=css`:host{--_lr-button-width:100%;--_lr-button-size-2xs:var(--lr-form-control-height-2xs);--_lr-button-size-xs:var(--lr-form-control-height-xs);--_lr-button-size-s:var(--lr-form-control-height-s);--_lr-button-size-m:var(--lr-form-control-height-m);--_lr-button-size-l:var(--lr-form-control-height-l);--_lr-button-size-xl:var(--lr-form-control-height-xl);--_lr-button-padding-block:var(--lr-form-control-padding-block);--_lr-button-padding-inline:var(--lr-form-control-padding-inline);--_lr-button-font-size:var(--lr-form-control-font-size);--_lr-button-min-height:var(--lr-button-size-m,var(--_lr-button-size-m));--_lr-button-gap:var(--lr-form-control-gap);--_lr-button-radius:var(--lr-form-control-radius);--_lr-button-caret-size:var(--lr-size-0-75em);--_lr-button-accent:var(--lr-color-fill-loud);--_lr-button-fill:var(--lr-color-fill-quiet);--_lr-button-on-fill:var(--lr-color-on-quiet);--_lr-button-border:var(--lr-color-border-normal);--_lr-button-outlined-border:var(--lr-color-border-strong);--_lr-button-outlined-fill:transparent;--_lr-button-quiet-border:var(--lr-color-border);--_lr-button-quiet-text:var(--lr-color-text-quiet);--_lr-button-accent-fill:var(--lr-color-fill-loud);--_lr-button-accent-on-fill:var(--lr-color-on-loud);--_lr-button-resolved-color:var(--lr-button-on-fill,var(--_lr-button-on-fill));--_lr-button-resolved-border:var(--lr-button-border,var(--_lr-button-border));--_lr-button-hover-base:var(--lr-color-surface);--_lr-button-hover-background:color-mix(in oklab, var(--lr-button-hover-base,var(--_lr-button-hover-base)), var(--lr-color-mix-partner) var(--lr-color-mix-hover));--_lr-button-active-background:color-mix(in oklab, var(--lr-button-hover-base,var(--_lr-button-hover-base)), var(--lr-color-mix-partner) var(--lr-color-mix-active));min-inline-size:0;max-inline-size:100%;display:inline-block}:host([appearance=filled]),:host([appearance=filled-outlined]){--_lr-button-hover-base:var(--lr-button-fill,var(--_lr-button-fill))}:host([appearance=accent]){--_lr-button-hover-base:var(--lr-button-accent-fill,var(--_lr-button-accent-fill));--_lr-button-resolved-color:var(--lr-button-accent-on-fill,var(--_lr-button-accent-on-fill));--_lr-button-resolved-border:var(--lr-button-accent-fill,var(--_lr-button-accent-fill))}:host([outline]){--_lr-button-hover-base:var(--lr-color-surface)}:host([appearance=outlined]),:host([outline]){--_lr-button-resolved-color:var(--lr-button-accent,var(--_lr-button-accent));--_lr-button-resolved-border:var(--lr-button-outlined-border,var(--_lr-button-outlined-border))}:host([appearance=filled-outlined]){--_lr-button-resolved-border:var(--lr-button-outlined-border,var(--_lr-button-outlined-border))}:host([appearance=plain]){--_lr-button-resolved-color:var(--lr-button-accent,var(--_lr-button-accent));--_lr-button-resolved-border:transparent}:host([appearance=quiet]){--_lr-button-resolved-color:var(--lr-button-quiet-text,var(--_lr-button-quiet-text));--_lr-button-resolved-border:var(--lr-button-quiet-border,var(--_lr-button-quiet-border))}:host(:not([variant])),:host([variant=neutral]){--_lr-button-accent:var(--lr-color-text)}:host([pill]),:host([circle]){--_lr-button-radius:var(--lr-radius-pill)}[part~=base]{box-sizing:border-box;inline-size:var(--lr-button-width,var(--_lr-button-width));min-inline-size:0;max-inline-size:100%;min-block-size:var(--lr-button-height,var(--lr-button-min-height,var(--_lr-button-min-height)));block-size:var(--lr-button-height,auto);align-items:center;justify-content:var(--lr-button-justify,center);gap:var(--lr-button-gap,var(--_lr-button-gap));padding-inline:var(--lr-button-padding-inline,var(--_lr-button-padding-inline));padding-block:var(--lr-button-padding-block,var(--_lr-button-padding-block));border-radius:var(--lr-button-radius,var(--_lr-button-radius));border:var(--lr-border-width-thin) solid var(--lr-button-border,var(--_lr-button-border));font:inherit;font-weight:var(--lr-font-weight-semibold);font-size:var(--lr-button-font-size,var(--_lr-button-font-size));cursor:pointer;box-shadow:var(--lr-button-shadow,none);text-decoration:none;display:inline-flex;position:relative}:host([appearance=filled]) [part~=base]{background:var(--lr-button-fill,var(--_lr-button-fill));color:var(--lr-button-on-fill,var(--_lr-button-on-fill))}:host([appearance=accent]) [part~=base]{background:var(--lr-button-accent-fill,var(--_lr-button-accent-fill));color:var(--lr-button-accent-on-fill,var(--_lr-button-accent-on-fill));border-color:var(--lr-button-accent-fill,var(--_lr-button-accent-fill))}:host([appearance=outlined]) [part~=base],:host([outline]) [part~=base]{background:var(--lr-button-outlined-fill,var(--_lr-button-outlined-fill));color:var(--lr-button-accent,var(--_lr-button-accent));border-color:var(--lr-button-outlined-border,var(--_lr-button-outlined-border))}:host([appearance=filled-outlined]) [part~=base]{background:var(--lr-button-fill,var(--_lr-button-fill));color:var(--lr-button-on-fill,var(--_lr-button-on-fill));border-color:var(--lr-button-outlined-border,var(--_lr-button-outlined-border))}:host([appearance=plain]) [part~=base]{color:var(--lr-button-accent,var(--_lr-button-accent));background:0 0;border-color:#0000}:host([appearance=quiet]) [part~=base]{color:var(--lr-button-quiet-text,var(--_lr-button-quiet-text));border-color:var(--lr-button-quiet-border,var(--_lr-button-quiet-border));background:0 0}[part~=base]:disabled,[part~=base][aria-disabled=true]{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part~=base]:not(:disabled,[aria-disabled=true]){transition:background-color var(--lr-transition-fast), color var(--lr-transition-fast), transform var(--lr-transition-fast)}[part~=base]:not(:disabled,[aria-disabled=true]):hover{background:var(--lr-button-hover-background,var(--_lr-button-hover-background));color:var(--lr-button-hover-color,var(--_lr-button-resolved-color));border-color:var(--lr-button-hover-border,var(--_lr-button-resolved-border))}[part~=base]:not(:disabled,[aria-disabled=true]):active{background:var(--lr-button-active-background,var(--_lr-button-active-background));transform:scale(var(--lr-button-active-scale,.9875))}@media (prefers-reduced-motion:reduce){[part~=base]:not(:disabled,[aria-disabled=true]):active{transform:none}}[part~=base]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part~=start],[part~=end]{text-overflow:ellipsis;white-space:nowrap;flex:none;align-items:center;min-inline-size:0;max-inline-size:40%;display:inline-flex;overflow:hidden}[part~=start] ::slotted(*),[part~=end] ::slotted(*){text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;max-inline-size:100%;overflow:hidden}[part=label]{flex:var(--lr-button-label-grow,0) 1 auto;text-align:start;text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}[part~=base][data-grow-label] [part=label]{flex-grow:var(--lr-button-label-grow,1)}:host([wrap]) [part=label]{text-overflow:clip;white-space:normal;overflow-wrap:anywhere;overflow:visible}[part~=start][hidden],[part~=end][hidden]{display:none}:host([circle]) [part~=base],[part~=base][data-icon-button]{inline-size:var(--lr-button-height,var(--lr-button-min-height,var(--_lr-button-min-height)));min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);aspect-ratio:1;padding-inline:var(--lr-button-padding-block,var(--_lr-button-padding-block))}[part~=base][data-icon-button] [part=label]{overflow:visible}[part=caret]{font-size:var(--lr-button-caret-size,var(--_lr-button-caret-size));flex:none;align-items:center;display:inline-flex}[part=caret] svg{transform:rotate(90deg)}:host([size="2xs"]){--_lr-button-min-height:var(--lr-button-size-2xs,var(--_lr-button-size-2xs))}:host([size=xs]){--_lr-button-min-height:var(--lr-button-size-xs,var(--_lr-button-size-xs))}:host([size=s]),:host([size=small]){--_lr-button-min-height:var(--lr-button-size-s,var(--_lr-button-size-s))}:host([size=l]),:host([size=large]){--_lr-button-min-height:var(--lr-button-size-l,var(--_lr-button-size-l))}:host([size=xl]){--_lr-button-min-height:var(--lr-button-size-xl,var(--_lr-button-size-xl))}:host([appearance=link]) [part~=base]{block-size:auto;min-block-size:0;inline-size:auto;color:var(--lr-button-accent,var(--_lr-button-accent));font:inherit;text-underline-offset:var(--lr-size-0-15rem);box-shadow:none;background:0 0;border:0;border-radius:0;padding:0;text-decoration:underline}:host([appearance=link]) [part~=base]:not(:disabled,[aria-disabled=true]):hover{color:color-mix(in oklab, var(--lr-button-accent,var(--_lr-button-accent)), var(--lr-color-mix-partner) var(--lr-color-mix-hover));background:0 0}:host([appearance=link]) [part~=base]:not(:disabled,[aria-disabled=true]):active{color:color-mix(in oklab, var(--lr-button-accent,var(--_lr-button-accent)), var(--lr-color-mix-partner) var(--lr-color-mix-active));background:0 0}[part=spinner]{animation:lr-button-spin var(--lr-button-spinner-duration,var(--lr-transition-ambient)) infinite;justify-content:center;align-items:center;display:inline-flex;position:absolute;inset:0}:host([loading]) [part~=start],:host([loading]) [part=label],:host([loading]) [part~=end],:host([loading]) [part=caret]{opacity:0}@keyframes lr-button-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part=spinner]{animation-duration:.001ms;animation-iteration-count:1}}`;export{styles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from"lit";import{formControlFocusHalo,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-text-color: inherit; --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); --_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([appearance="plain"]) { --_lr-date-input-border-color: transparent; --_lr-date-input-fill: transparent; } :host([appearance="accent"]) { --_lr-date-input-border-color: transparent; --_lr-date-input-fill: var(--lr-color-brand); --_lr-date-input-text-color: var(--lr-color-on-brand); } :host([appearance="accent"]) [part="start"], :host([appearance="accent"]) [part="end"], :host([appearance="accent"]) [part="clear-button"], :host([appearance="accent"]) [part="expand-button"], :host([appearance="accent"]) [part="input"]::placeholder { color: inherit; } [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, var(--_lr-date-input-border-color)); border-radius: var(--lr-date-input-radius, var(--_lr-date-input-radius)); background: var(--lr-date-input-fill, var(--_lr-date-input-fill)); color: var(--lr-date-input-text-color, var(--_lr-date-input-text-color)); } [part="input-wrapper"]:focus-within { border-color: var( --lr-date-input-focus-border-color, var(--lr-color-brand) ); ${formControlFocusHalo} } :host(:disabled) [part="input-wrapper"] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part="input"] { flex: 1 1
|
|
1
|
+
import{css}from"lit";import{formControlFocusHalo,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-text-color: inherit; --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); --_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([appearance="plain"]) { --_lr-date-input-border-color: transparent; --_lr-date-input-fill: transparent; } :host([appearance="accent"]) { --_lr-date-input-border-color: transparent; --_lr-date-input-fill: var(--lr-color-brand); --_lr-date-input-text-color: var(--lr-color-on-brand); } :host([appearance="accent"]) [part="start"], :host([appearance="accent"]) [part="end"], :host([appearance="accent"]) [part="clear-button"], :host([appearance="accent"]) [part="expand-button"], :host([appearance="accent"]) [part="input"]::placeholder { color: inherit; } [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, var(--_lr-date-input-border-color)); border-radius: var(--lr-date-input-radius, var(--_lr-date-input-radius)); background: var(--lr-date-input-fill, var(--_lr-date-input-fill)); color: var(--lr-date-input-text-color, var(--_lr-date-input-text-color)); } [part="input-wrapper"]:focus-within { border-color: var( --lr-date-input-focus-border-color, var(--lr-color-brand) ); ${formControlFocusHalo} } :host(:disabled) [part="input-wrapper"] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part="input"] { flex: 1 1 var(--lr-size-4ch); 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)); } :where([part="input-wrapper"]:has(> [part="start"]:not([hidden]), > [part="end"]:not([hidden]))) [part="input"] { min-inline-size: min(var(--lr-size-4ch), 100%); } [part="start"], [part="end"] { flex: 0 1 auto; 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"] ::slotted(*), [part="end"] ::slotted(*) { min-inline-size: 0; max-inline-size: 100%; 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"][hidden] { display: none; } [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"][data-positioned] { 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 +1 @@
|
|
|
1
|
-
import{css}from"lit";import{formControlFocusHalo,formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; --_lr-input-padding-block-default: var(--lr-form-control-padding-block); --_lr-input-padding-inline-default: var(--lr-form-control-padding-inline); --_lr-input-font-size-default: var(--lr-form-control-font-size); --_lr-input-control-min-height-default: var(--lr-form-control-height); --_lr-input-gap-default: var(--lr-space-xs); --_lr-input-radius-default: var(--lr-form-control-radius); --_lr-input-fill-default: transparent; --_lr-input-border-color-default: var(--lr-color-border); --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); } :host([appearance='filled-outlined']) { --_lr-input-fill-default: var(--lr-color-surface); --_lr-input-border-color-default: var(--lr-color-border); } :host([appearance='outlined']) { --_lr-input-fill-default: transparent; --_lr-input-border-color-default: var(--lr-color-border); } :host([appearance='filled']) { --_lr-input-fill-default: var(--lr-color-surface-raised); --_lr-input-border-color-default: transparent; } :host([filled]) { --_lr-input-fill-default: var(--lr-color-surface-raised); --_lr-input-border-color-default: transparent; } :host([appearance='plain']) { --_lr-input-fill-default: transparent; --_lr-input-border-color-default: transparent; } :host([appearance='accent']) { --_lr-input-fill-default: var(--lr-color-brand-quiet); --_lr-input-border-color-default: var(--lr-color-brand); } :host([pill]) { --_lr-input-radius-default: var(--lr-radius-pill); } [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-input-gap, var(--_lr-input-gap-default)); inline-size: 100%; box-sizing: border-box; min-block-size: var(--lr-input-control-height, var(--lr-input-control-min-height, var(--_lr-input-control-min-height-default))); block-size: var(--lr-input-control-height, auto); padding-inline: var(--lr-input-padding-inline, var(--_lr-input-padding-inline-default)); border: var(--lr-border-width-thin) solid var(--lr-input-border-color, var(--_lr-input-border-color-default)); border-radius: var(--lr-input-radius, var(--_lr-input-radius-default)); background: var(--lr-input-fill, var(--_lr-input-fill-default)); } [part~='input-wrapper']:focus-within { border-color: var(--lr-input-focus-border-color, var(--lr-color-brand)); ${formControlFocusHalo} } :host(:disabled) [part~='input-wrapper'] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part='input'] { flex: 1 1
|
|
1
|
+
import{css}from"lit";import{formControlFocusHalo,formControlRequiredMarker}from"../../../internal/form-control.styles.js";const styles=css` :host { display: block; --_lr-input-padding-block-default: var(--lr-form-control-padding-block); --_lr-input-padding-inline-default: var(--lr-form-control-padding-inline); --_lr-input-font-size-default: var(--lr-form-control-font-size); --_lr-input-control-min-height-default: var(--lr-form-control-height); --_lr-input-gap-default: var(--lr-space-xs); --_lr-input-radius-default: var(--lr-form-control-radius); --_lr-input-fill-default: transparent; --_lr-input-border-color-default: var(--lr-color-border); --_lr-form-control-focus-shadow: var(--lr-form-control-focus-shadow, none); } :host([appearance='filled-outlined']) { --_lr-input-fill-default: var(--lr-color-surface); --_lr-input-border-color-default: var(--lr-color-border); } :host([appearance='outlined']) { --_lr-input-fill-default: transparent; --_lr-input-border-color-default: var(--lr-color-border); } :host([appearance='filled']) { --_lr-input-fill-default: var(--lr-color-surface-raised); --_lr-input-border-color-default: transparent; } :host([filled]) { --_lr-input-fill-default: var(--lr-color-surface-raised); --_lr-input-border-color-default: transparent; } :host([appearance='plain']) { --_lr-input-fill-default: transparent; --_lr-input-border-color-default: transparent; } :host([appearance='accent']) { --_lr-input-fill-default: var(--lr-color-brand-quiet); --_lr-input-border-color-default: var(--lr-color-brand); } :host([pill]) { --_lr-input-radius-default: var(--lr-radius-pill); } [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-input-gap, var(--_lr-input-gap-default)); inline-size: 100%; box-sizing: border-box; min-block-size: var(--lr-input-control-height, var(--lr-input-control-min-height, var(--_lr-input-control-min-height-default))); block-size: var(--lr-input-control-height, auto); padding-inline: var(--lr-input-padding-inline, var(--_lr-input-padding-inline-default)); border: var(--lr-border-width-thin) solid var(--lr-input-border-color, var(--_lr-input-border-color-default)); border-radius: var(--lr-input-radius, var(--_lr-input-radius-default)); background: var(--lr-input-fill, var(--_lr-input-fill-default)); } [part~='input-wrapper']:focus-within { border-color: var(--lr-input-focus-border-color, var(--lr-color-brand)); ${formControlFocusHalo} } :host(:disabled) [part~='input-wrapper'] { opacity: var(--lr-opacity-disabled); cursor: not-allowed; } [part='input'] { flex: 1 1 var(--lr-size-4ch); min-inline-size: 0; box-sizing: border-box; padding-block: var(--lr-input-padding-block, var(--_lr-input-padding-block-default)); border: none; outline: none; background: transparent; color: var(--lr-color-text); font: inherit; font-size: var(--lr-input-font-size, var(--_lr-input-font-size-default)); } [part='input']::placeholder { color: var(--lr-input-action-color, var(--lr-color-text-quiet)); } :where([part~='input-wrapper']:has(> [part='start']:not([hidden]), > [part='end']:not([hidden]))) > [part='input'] { min-inline-size: min(var(--lr-size-4ch), 100%); } [part='input'][type='search']::-webkit-search-cancel-button, [part='input'][type='search']::-webkit-search-decoration { appearance: none; } [part='input'][type='number'][data-without-spin-buttons] { appearance: textfield; } [part='input'][type='number'][data-without-spin-buttons]::-webkit-outer-spin-button, [part='input'][type='number'][data-without-spin-buttons]::-webkit-inner-spin-button { appearance: none; margin: 0; } [part='input'][type='time']::-webkit-calendar-picker-indicator { cursor: pointer; border-radius: var(--lr-radius-xs); background-color: transparent; outline: var(--lr-focus-ring-width) solid transparent; outline-offset: var(--lr-focus-ring-offset); transition: background-color var(--lr-transition-fast); } [part='input'][type='time']:not(:disabled):hover::-webkit-calendar-picker-indicator { background-color: var(--lr-input-time-picker-hover-bg, var(--lr-color-brand-quiet)); } [part='input'][type='time']:not(:disabled):active::-webkit-calendar-picker-indicator { background-color: var(--lr-input-time-picker-active-bg, var(--lr-color-brand)); } [part='input'][type='time']:not(:disabled):focus-visible::-webkit-calendar-picker-indicator { background-color: var(--lr-input-time-picker-focus-bg, var(--lr-color-brand-quiet)); outline-color: var(--lr-input-time-picker-focus-ring, var(--lr-focus-ring-color)); } [part='start'], [part='end'] { flex: 0 1 auto; display: inline-flex; align-items: center; min-inline-size: 0; max-inline-size: 50%; overflow: hidden; color: var(--lr-color-text-quiet); } [part='start'] slot, [part='end'] slot, [part='start'] slot::slotted(*), [part='end'] slot::slotted(*) { min-inline-size: 0; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part='start'][hidden], [part='end'][hidden] { display: none; } [part='password-toggle'], [part='clear-button'] { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: var(--lr-radius); background: none; cursor: pointer; color: var(--lr-input-action-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), var(--lr-form-control-height))); min-block-size: max(var(--lr-size-24px), min(var(--lr-icon-button-size), var(--lr-form-control-height))); line-height: var(--lr-line-height-none); font-size: var(--lr-font-size-m); transition: background-color var(--lr-transition-fast), color var(--lr-transition-fast); } [part='password-toggle']:not(:disabled):hover { color: var(--lr-input-action-hover-color, var(--lr-color-text)); } [part='clear-button']:not(:disabled):hover { color: var(--lr-input-action-hover-color, var(--lr-color-text)); } [part='password-toggle']:not(:disabled):active, [part='clear-button']:not(:disabled):active { color: var(--lr-input-action-active-color, var(--lr-input-action-hover-color, var(--lr-color-text))); background: var( --lr-input-action-active-bg, color-mix(in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active)) ); } [part='password-toggle']:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: var(--lr-focus-ring-offset); } [part='clear-button']:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: var(--lr-focus-ring-offset); } [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};
|
|
@@ -30,6 +30,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
30
30
|
part="scale"
|
|
31
31
|
?disabled=${disabled}
|
|
32
32
|
?required=${!!k.required}
|
|
33
|
+
@lr-checkbox-group-toggle-request=${this.stopChildEvent}
|
|
33
34
|
@input=${this.stopChildEvent}
|
|
34
35
|
@change=${this.stopChildEvent}
|
|
35
36
|
@lr-input=${this.stopChildEvent}
|
|
@@ -346,10 +346,11 @@ collapsible:boolean;
|
|
|
346
346
|
* close's update has completed and one animation frame has passed. That second pass only acts
|
|
347
347
|
* while focus is still inside the rail or has fallen to `<body>` -- focus moved elsewhere in the
|
|
348
348
|
* meantime is never taken back -- and focuses the first candidate that can hold focus: this
|
|
349
|
-
* trigger, then the element that held focus when the overlay opened
|
|
350
|
-
* `[part="toggle"]` (unavailable under `hideToggle`), then this
|
|
351
|
-
*
|
|
352
|
-
*
|
|
349
|
+
* trigger, then the element that held focus when the overlay opened (none when focus was on
|
|
350
|
+
* `<body>`), then the built-in `[part="toggle"]` (unavailable under `hideToggle`), then this
|
|
351
|
+
* rail's host, then `focusFallback` when set; when none of them can take focus (the host hidden,
|
|
352
|
+
* or inert -- under an inert ancestor or behind a stacked modal), focus is left where it is. The
|
|
353
|
+
* host receives a temporary `tabindex="-1"` only when it has no
|
|
353
354
|
* authored tabindex; that attribute is removed once focus moves off the host (a blur caused only
|
|
354
355
|
* by the window or tab losing system focus leaves it in place) or the rail disconnects, and an
|
|
355
356
|
* authored tabindex is never changed. An external trigger needs this explicit association
|
|
@@ -362,7 +363,8 @@ collapsible:boolean;
|
|
|
362
363
|
* (the default, `null`), no external element is a return candidate: a close still returns focus
|
|
363
364
|
* to the built-in toggle when its own click opened the overlay, otherwise to the element that
|
|
364
365
|
* held focus at open, and the second pass above still runs over its remaining candidates,
|
|
365
|
-
* ending at this rail's host -- only the trigger candidate depends on this
|
|
366
|
+
* ending at this rail's host and `focusFallback` -- only the trigger candidate depends on this
|
|
367
|
+
* association. With
|
|
366
368
|
* trigger-collapses, the same association manages desktop disclosure state and shortcuts; wire
|
|
367
369
|
* the trigger to toggle(). */
|
|
368
370
|
trigger:HTMLElement|null;
|
|
@@ -371,6 +373,34 @@ trigger:HTMLElement|null;
|
|
|
371
373
|
* against this element's own root (shadow root or document) when the overlay opens and again
|
|
372
374
|
* when it closes. Ignored once `trigger` is itself set. */
|
|
373
375
|
for:string;
|
|
376
|
+
/** Opt-in last-resort focus target for closing the mobile overlay, used only when every built-in
|
|
377
|
+
* return target is unavailable: the external `trigger`/`for` association, the element that held
|
|
378
|
+
* focus when the overlay opened, the built-in `[part="toggle"]`, and this rail's host itself
|
|
379
|
+
* (hidden, or inert -- under an inert ancestor or behind a stacked modal). Typically the
|
|
380
|
+
* application's main region, for a host that takes the navigation, or the region around it, out
|
|
381
|
+
* of the layout as the overlay closes.
|
|
382
|
+
*
|
|
383
|
+
* Accepts an element reference or an id, the same element-or-id shape as
|
|
384
|
+
* `<lr-intersection-observer>`'s `root`. An id -- the `focus-fallback` attribute always holds one,
|
|
385
|
+
* never a selector -- is resolved like `for`, against this element's own root (shadow root or
|
|
386
|
+
* document); an empty string means unset. It is resolved only when the return needs it, so
|
|
387
|
+
* reassigning it after the overlay opened, or re-creating the element under the same id before
|
|
388
|
+
* the return runs, is honored. Property and attribute writes set the same value and the last
|
|
389
|
+
* write wins: a later attribute write or removal replaces an element assigned to the property.
|
|
390
|
+
*
|
|
391
|
+
* Tried only by the second, deferred pass described under `trigger`, after this rail's host and
|
|
392
|
+
* under that pass's own conditions (focus still inside the rail or fallen to `<body>`; focus
|
|
393
|
+
* moved elsewhere is never taken back). It never outranks a target that can take focus, so it
|
|
394
|
+
* changes no close that already lands. It is not used by the synchronous attempt, by a close
|
|
395
|
+
* caused by leaving `'mobile'` (a breakpoint or `forceMode` change), or by the full/icon-only
|
|
396
|
+
* presentations.
|
|
397
|
+
*
|
|
398
|
+
* A target that is missing, disconnected, in another document, hidden, inert or under an inert
|
|
399
|
+
* ancestor, `aria-hidden`, disabled, or not focusable leaves focus where it is, and so does
|
|
400
|
+
* anything inside this rail (unavailable whenever the rail host is). Give a landmark
|
|
401
|
+
* `tabindex="-1"`: unlike the host, it never receives a temporary tabindex. Unset (the default,
|
|
402
|
+
* `null`) reproduces the existing behavior exactly. */
|
|
403
|
+
focusFallback:HTMLElement|string|null;
|
|
374
404
|
/** Opts a continuously draggable width in for the `'full'` state — exposes a `[part="resizer"]`
|
|
375
405
|
* handle (pointer-drag and `ArrowLeft`/`ArrowRight` keyboard stepping, RTL-aware) clamped to
|
|
376
406
|
* `[minRailWidthPx, maxRailWidthPx]`. Set `storageKey` to persist the fields selected by
|
|
@@ -483,7 +513,11 @@ private loadPersisted;private persistState;protected willUpdate(changed:Property
|
|
|
483
513
|
* element, in which case `activateMobileOverlay()`'s own fallback (whatever held focus when
|
|
484
514
|
* the overlay opened -- e.g. the built-in toggle after its own click) continues to apply
|
|
485
515
|
* exactly as before either property existed. */
|
|
486
|
-
private resolveExternalTrigger;
|
|
516
|
+
private resolveExternalTrigger;
|
|
517
|
+
/** Resolves `focusFallback` when the deferred return reaches it: the element itself, or the one
|
|
518
|
+
* its id names in this element's own root. `null` when unset or when it does not name an
|
|
519
|
+
* element of this rail's own document. */
|
|
520
|
+
private resolveFocusFallback;private activateMobileOverlay;private deactivateMobileOverlay;
|
|
487
521
|
/** Finishes the close's focus return once the close has been published and the host has had a
|
|
488
522
|
* chance to react to it. A host commonly hides its own menu button while the overlay is open and
|
|
489
523
|
* re-shows it from its own render in response to `lr-toggle`; the synchronous return inside this
|
|
@@ -496,13 +530,18 @@ private resolveExternalTrigger;private activateMobileOverlay;private deactivateM
|
|
|
496
530
|
* `<body>`: focus the user or host deliberately moved elsewhere in the meantime is never taken
|
|
497
531
|
* back. It then focuses the first candidate that can actually hold focus -- the return target
|
|
498
532
|
* (built-in toggle click, external `trigger`/`for`, or the element focused when the overlay
|
|
499
|
-
* opened), then the element focused when the overlay opened
|
|
500
|
-
* (unavailable under `hideToggle`), then the rail host
|
|
501
|
-
*
|
|
502
|
-
*
|
|
533
|
+
* opened), then the element focused when the overlay opened (none when focus was on `<body>`),
|
|
534
|
+
* then the built-in `[part="toggle"]` (unavailable under `hideToggle`), then the rail host, then
|
|
535
|
+
* `focusFallback` when set; when none of them can take focus (the host hidden, or inert -- under
|
|
536
|
+
* an inert ancestor or behind a stacked modal), focus is left where it is. The pass runs whether
|
|
537
|
+
* or not `trigger`/`for` is set -- only the trigger candidate
|
|
503
538
|
* depends on that association. A reopen, another close, or a disconnect before the frame
|
|
504
539
|
* arrives abandons the pass. */
|
|
505
|
-
private scheduleDeferredFocusReturn;
|
|
540
|
+
private scheduleDeferredFocusReturn;
|
|
541
|
+
/** Focuses this rail's host as the deferred return's last built-in target, giving it a temporary
|
|
542
|
+
* `tabindex="-1"` when it has no authored one. Returns whether focus landed on the host; when it
|
|
543
|
+
* did not, that temporary tabindex is handed back immediately. */
|
|
544
|
+
private focusHostFallback;
|
|
506
545
|
/** Reparents the (never destroyed/recreated) toggle button between its two valid DOM positions:
|
|
507
546
|
* the first child of `[part="panel"]` while the mobile overlay is open, so the shared focus
|
|
508
547
|
* trap and `aria-modal` subtree (both scoped to the panel alone) actually reach it, or a
|