@kodaris/krubble-components 1.0.9 → 1.0.11
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/custom-elements.json +1199 -477
- package/dist/button/button.d.ts +15 -0
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +139 -4
- package/dist/button/button.js.map +1 -1
- package/dist/form/text-field/text-field.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/krubble.bundled.js +1413 -57
- package/dist/krubble.bundled.js.map +1 -1
- package/dist/krubble.bundled.min.js +771 -77
- package/dist/krubble.bundled.min.js.map +1 -1
- package/dist/krubble.umd.js +1412 -56
- package/dist/krubble.umd.js.map +1 -1
- package/dist/krubble.umd.min.js +764 -70
- package/dist/krubble.umd.min.js.map +1 -1
- package/dist/table/table.d.ts +260 -0
- package/dist/table/table.d.ts.map +1 -0
- package/dist/table/table.js +1230 -0
- package/dist/table/table.js.map +1 -0
- package/dist/tabs/tabs.d.ts.map +1 -1
- package/dist/tabs/tabs.js +2 -0
- package/dist/tabs/tabs.js.map +1 -1
- package/package.json +5 -1
package/custom-elements.json
CHANGED
|
@@ -95,6 +95,14 @@
|
|
|
95
95
|
"module": "./tabs/tab.js"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
+
{
|
|
99
|
+
"kind": "js",
|
|
100
|
+
"name": "KRTable",
|
|
101
|
+
"declaration": {
|
|
102
|
+
"name": "KRTable",
|
|
103
|
+
"module": "./table/table.js"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
98
106
|
{
|
|
99
107
|
"kind": "js",
|
|
100
108
|
"name": "KRTextField",
|
|
@@ -154,7 +162,7 @@
|
|
|
154
162
|
{
|
|
155
163
|
"kind": "variable",
|
|
156
164
|
"name": "KRButton",
|
|
157
|
-
"default": "class KRButton extends i$2 { constructor() { super(...arguments); /** * The button variant (shape) */ this.variant = 'flat'; /** * The button color */ this.color = 'primary'; /** * The button size */ this.size = 'medium'; /** * Whether the button is disabled */ this.disabled = false; this._state = 'idle'; this._stateText = ''; this._handleKeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); this.click(); } }; } connectedCallback() { super.connectedCallback(); this.setAttribute('role', 'button'); this.setAttribute('tabindex', '0'); this.addEventListener('keydown', this._handleKeydown); } disconnectedCallback() { super.disconnectedCallback(); this.removeEventListener('keydown', this._handleKeydown); } /** * Shows a loading spinner and disables the button. */ showLoading() { this._clearStateTimeout(); this._state = 'loading'; this._stateText = ''; } /** * Shows a success state with optional custom text. * @param text - Text to display (default: \"Saved\") * @param duration - Duration in ms before auto-reset (default: 2000) */ showSuccess(text = 'Success', duration = 2000) { this._clearStateTimeout(); this._state = 'success'; this._stateText = text; this._stateTimeout = window.setTimeout(() => this.reset(), duration); } /** * Shows an error state with optional custom text. * @param text - Text to display (default: \"Error\") * @param duration - Duration in ms before auto-reset (default: 2000) */ showError(text = 'Error', duration = 2000) { this._clearStateTimeout(); this._state = 'error'; this._stateText = text; this._stateTimeout = window.setTimeout(() => this.reset(), duration); } /** * Resets the button to its idle state. */ reset() { this._clearStateTimeout(); this._state = 'idle'; this._stateText = ''; } _clearStateTimeout() { if (this._stateTimeout) { clearTimeout(this._stateTimeout); this._stateTimeout = undefined; } } updated(changedProperties) { // Reflect state classes to host this.classList.toggle('kr-button--loading', this._state === 'loading'); this.classList.toggle('kr-button--success', this._state === 'success'); this.classList.toggle('kr-button--error', this._state === 'error'); this.classList.toggle(`kr-button--${this.variant}`, true); this.classList.toggle(`kr-button--${this.color}`, true); this.classList.toggle('kr-button--small', this.size === 'small'); this.classList.toggle('kr-button--large', this.size === 'large'); } render() { return b ` <slot></slot> ${this._state !== 'idle' ? b `<span class=\"state-overlay\"> ${this._state === 'loading' ? b `<span class=\"spinner\"></span>` : this._stateText} </span>` : ''} `; } }",
|
|
165
|
+
"default": "class KRButton extends i$2 { constructor() { super(...arguments); /** * The button variant (shape) */ this.variant = 'flat'; /** * The button color */ this.color = 'primary'; /** * The button size */ this.size = 'medium'; /** * Whether the button is disabled */ this.disabled = false; /** * Dropdown options - when provided, button becomes a dropdown */ this.options = []; this._state = 'idle'; this._stateText = ''; this._dropdownOpened = false; this._dropdownAlignRight = false; this._handleHostClick = (e) => { if (this.options.length) { e.stopPropagation(); this._toggleDropdown(); } }; this._handleKeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); if (this.options.length) { this._toggleDropdown(); } else { this.click(); } } if (e.key === 'Escape' && this._dropdownOpened) { this._dropdownOpened = false; } }; this._handleClickOutside = (e) => { if (this._dropdownOpened && !this.contains(e.target)) { this._dropdownOpened = false; } }; } connectedCallback() { super.connectedCallback(); this.setAttribute('role', 'button'); this.setAttribute('tabindex', '0'); this.addEventListener('keydown', this._handleKeydown); this.addEventListener('click', this._handleHostClick); document.addEventListener('click', this._handleClickOutside); } disconnectedCallback() { super.disconnectedCallback(); this.removeEventListener('keydown', this._handleKeydown); this.removeEventListener('click', this._handleHostClick); document.removeEventListener('click', this._handleClickOutside); } _toggleDropdown() { this._dropdownOpened = !this._dropdownOpened; if (this._dropdownOpened) { // Check if dropdown would overflow viewport after render requestAnimationFrame(() => { const dropdown = this.shadowRoot?.querySelector('.dropdown'); if (dropdown) { const rect = dropdown.getBoundingClientRect(); this._dropdownAlignRight = rect.right > window.innerWidth; } }); } } _handleOptionClick(option, e) { e.stopPropagation(); this._dropdownOpened = false; this.dispatchEvent(new CustomEvent('option-select', { detail: { id: option.id, label: option.label }, bubbles: true, composed: true })); } /** * Shows a loading spinner and disables the button. */ showLoading() { this._clearStateTimeout(); this._state = 'loading'; this._stateText = ''; } /** * Shows a success state with optional custom text. * @param text - Text to display (default: \"Saved\") * @param duration - Duration in ms before auto-reset (default: 2000) */ showSuccess(text = 'Success', duration = 2000) { this._clearStateTimeout(); this._state = 'success'; this._stateText = text; this._stateTimeout = window.setTimeout(() => this.reset(), duration); } /** * Shows an error state with optional custom text. * @param text - Text to display (default: \"Error\") * @param duration - Duration in ms before auto-reset (default: 2000) */ showError(text = 'Error', duration = 2000) { this._clearStateTimeout(); this._state = 'error'; this._stateText = text; this._stateTimeout = window.setTimeout(() => this.reset(), duration); } /** * Resets the button to its idle state. */ reset() { this._clearStateTimeout(); this._state = 'idle'; this._stateText = ''; } _clearStateTimeout() { if (this._stateTimeout) { clearTimeout(this._stateTimeout); this._stateTimeout = undefined; } } updated(changedProperties) { // Reflect state classes to host this.classList.toggle('kr-button--loading', this._state === 'loading'); this.classList.toggle('kr-button--success', this._state === 'success'); this.classList.toggle('kr-button--error', this._state === 'error'); this.classList.toggle(`kr-button--${this.variant}`, true); this.classList.toggle(`kr-button--${this.color}`, true); this.classList.toggle('kr-button--small', this.size === 'small'); this.classList.toggle('kr-button--large', this.size === 'large'); } render() { return b ` <slot></slot> ${this.options.length ? b `<svg class=\"caret\" xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z\"/></svg>` : A} ${this._state !== 'idle' ? b `<span class=\"state-overlay\"> ${this._state === 'loading' ? b `<span class=\"spinner\"></span>` : this._stateText} </span>` : A} ${this.options.length ? b ` <div class=\"dropdown ${this._dropdownOpened ? 'dropdown--opened' : ''} ${this._dropdownAlignRight ? 'dropdown--align-right' : ''}\"> ${this.options.map(option => b ` <button class=\"dropdown-item\" @click=${(e) => this._handleOptionClick(option, e)} >${option.label}</button> `)} </div> ` : A} `; } }",
|
|
158
166
|
"description": "A customizable button component."
|
|
159
167
|
},
|
|
160
168
|
{
|
|
@@ -245,6 +253,11 @@
|
|
|
245
253
|
"default": "class KRTab extends i$2 { constructor() { super(...arguments); /** * Unique identifier for the tab */ this.id = ''; /** * Display title for the tab */ this.title = ''; /** * Badge text displayed next to title (e.g. notification count) */ this.badge = ''; /** * Badge background color */ this.badgeBackground = ''; /** * Badge text color */ this.badgeColor = ''; /** * Whether the tab is disabled */ this.disabled = false; /** * Whether the tab can be dismissed/closed */ this.dismissible = false; /** * Whether this tab is currently active (set by parent) */ this.active = false; } /** * Gets the icon element from the icon slot (if any) */ getIconElement() { return this.querySelector('[slot=\"icon\"]'); } render() { return b `<slot></slot>`; } }",
|
|
246
254
|
"description": "A tab for the kr-tab-group component."
|
|
247
255
|
},
|
|
256
|
+
{
|
|
257
|
+
"kind": "variable",
|
|
258
|
+
"name": "KRTable",
|
|
259
|
+
"default": "class KRTable extends i$2 { constructor() { super(...arguments); /** * Internal flag to switch between scroll edge modes: * - 'overlay': Fixed padding with overlay elements that hide content at edges (scrollbar at viewport edge) * - 'edge': Padding scrolls with content, allowing table to reach edges when scrolling */ this._scrollStyle = 'overlay'; this._data = []; this._dataState = 'idle'; this._page = 1; this._pageSize = 50; this._totalItems = 0; this._totalPages = 0; this._searchQuery = ''; this._canScrollLeft = false; this._canScrollRight = false; this._canScrollHorizontal = false; this._columnPickerOpen = false; this._displayedColumns = []; this._widthsLocked = false; this._resizing = null; this._resizeObserver = null; this._searchPositionLocked = false; this._def = { columns: [] }; this.def = { columns: [] }; this._handleClickOutsideColumnPicker = (e) => { if (!this._columnPickerOpen) return; const path = e.composedPath(); const picker = this.shadowRoot?.querySelector('.column-picker-wrapper'); if (picker && !path.includes(picker)) { this._columnPickerOpen = false; } }; this._handleResizeMove = (e) => { if (!this._resizing) return; const col = this._def.columns.find(c => c.id === this._resizing.columnId); if (col) { const newWidth = this._resizing.startWidth + (e.clientX - this._resizing.startX); col.width = `${Math.min(900, Math.max(50, newWidth))}px`; this.requestUpdate(); } }; this._handleResizeEnd = () => { this._resizing = null; document.removeEventListener('mousemove', this._handleResizeMove); document.removeEventListener('mouseup', this._handleResizeEnd); }; } connectedCallback() { super.connectedCallback(); this.classList.toggle('kr-table--scroll-overlay', this._scrollStyle === 'overlay'); this.classList.toggle('kr-table--scroll-edge', this._scrollStyle === 'edge'); this._fetch(); this._initRefresh(); document.addEventListener('click', this._handleClickOutsideColumnPicker); this._resizeObserver = new ResizeObserver(() => { // Unlock and recalculate on resize since layout changes this._searchPositionLocked = false; this._updateSearchPosition(); }); this._resizeObserver.observe(this); } disconnectedCallback() { super.disconnectedCallback(); clearInterval(this._refreshTimer); document.removeEventListener('click', this._handleClickOutsideColumnPicker); this._resizeObserver?.disconnect(); } willUpdate(changedProperties) { if (changedProperties.has('def')) { // Copy user's def and normalize action columns this._def = { ...this.def, columns: this.def.columns.map(col => { if (col.type === 'actions') { return { ...col, sticky: 'right', resizable: false }; } return { ...col }; }) }; this._displayedColumns = this._def.displayedColumns || this._def.columns.map(c => c.id); this._widthsLocked = false; this.classList.remove('kr-table--widths-locked'); this._fetch(); this._initRefresh(); } } updated(changedProperties) { this._updateScrollFlags(); } // ---------------------------------------------------------------------------- // Public Interface // ---------------------------------------------------------------------------- refresh() { this._fetch(); } goToPrevPage() { if (this._page > 1) { this._page--; this._fetch(); } } goToNextPage() { if (this._page < this._totalPages) { this._page++; this._fetch(); } } goToPage(page) { if (page >= 1 && page <= this._totalPages) { this._page = page; this._fetch(); } } // ---------------------------------------------------------------------------- // Data Fetching // ---------------------------------------------------------------------------- /** * Fetches data from the API and updates the table. * Shows a loading spinner while fetching, then displays rows on success * or an error snackbar on failure. * Request/response format depends on dataSource.mode (solr, opensearch, db). */ _fetch() { if (!this._def.dataSource) return; this._dataState = 'loading'; // Build request based on mode let request; switch (this._def.dataSource.mode) { case 'opensearch': throw Error('Opensearch not supported yet'); case 'db': throw Error('DB not supported yet'); default: // solr request = { page: this._page - 1, size: this._pageSize, sorts: [], filterFields: [], queryFields: [], facetFields: [] }; if (this._searchQuery?.trim().length) { request.queryFields.push({ name: '_text_', operation: 'IS', value: escapeSolrQuery(this._searchQuery) }); } } this._def.dataSource.fetch(request) .then(response => { // Parse response based on mode switch (this._def.dataSource?.mode) { case 'opensearch': { throw Error('Opensearch not supported yet'); } case 'db': { throw Error('DB not supported yet'); } default: { // solr const res = response; this._data = res.data.content; this._totalItems = res.data.totalElements; this._totalPages = res.data.totalPages; this._pageSize = res.data.size; } } this._dataState = 'success'; this._updateSearchPosition(); if (!this._widthsLocked) this._lockColumnWidths(); }) .catch(err => { this._dataState = 'error'; KRSnackbar.show({ message: err instanceof Error ? err.message : 'Failed to load data', type: 'error' }); }); } /** * Sets up auto-refresh so the table automatically fetches fresh data * at a regular interval (useful for dashboards, monitoring views). * Configured via def.refreshInterval in milliseconds. */ _initRefresh() { clearInterval(this._refreshTimer); if (this._def.refreshInterval && this._def.refreshInterval > 0) { this._refreshTimer = window.setInterval(() => { this._fetch(); }, this._def.refreshInterval); } } _handleSearch(e) { const input = e.target; this._searchQuery = input.value; this._page = 1; this._fetch(); } _measureTextWidth(text, font) { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); ctx.font = font; return ctx.measureText(text).width; } _lockColumnWidths() { this.updateComplete.then(() => { requestAnimationFrame(() => { const headerCell = this.shadowRoot?.querySelector('.header-cell'); const dataCell = this.shadowRoot?.querySelector('.cell'); if (!headerCell) return; const headerStyle = getComputedStyle(headerCell); const headerFont = `${headerStyle.fontWeight} ${headerStyle.fontSize} ${headerStyle.fontFamily}`; const headerPadding = parseFloat(headerStyle.paddingLeft) + parseFloat(headerStyle.paddingRight); const dataStyle = dataCell ? getComputedStyle(dataCell) : headerStyle; const dataFont = `${dataStyle.fontWeight} ${dataStyle.fontSize} ${dataStyle.fontFamily}`; const dataPadding = dataCell ? parseFloat(dataStyle.paddingLeft) + parseFloat(dataStyle.paddingRight) : headerPadding; this.getDisplayedColumns().forEach(col => { if (!col.width) { let width; // For columns with custom render functions, measure the actual DOM element if (col.render) { const cell = this.shadowRoot?.querySelector(`.cell[data-column-id=\"${col.id}\"]`); width = cell ? cell.scrollWidth : 150; } else { const headerText = col.label ?? col.id; const headerWidth = this._measureTextWidth(headerText, headerFont) + headerPadding; let maxDataWidth = 0; for (const row of this._data) { const value = row[col.id]; if (value != null) { const dataWidth = this._measureTextWidth(String(value), dataFont) + dataPadding; if (dataWidth > maxDataWidth) maxDataWidth = dataWidth; } } width = Math.ceil(Math.max(headerWidth, maxDataWidth)); } col.width = `${Math.max(width, 150)}px`; } }); this._widthsLocked = true; this.classList.add('kr-table--widths-locked'); this.requestUpdate(); }); }); } /** * Updates search position to be centered with equal gaps from title and tools. * On first call: resets to flex centering, measures position, then locks with fixed margin. * Subsequent calls are ignored unless _searchPositionLocked is reset (e.g., on resize). */ _updateSearchPosition() { // Skip if already locked (prevents shifts on pagination changes) if (this._searchPositionLocked) return; const search = this.shadowRoot?.querySelector('.search'); const searchField = search?.querySelector('.search-field'); if (!search || !searchField) return; // Reset to flex centering search.style.justifyContent = 'center'; searchField.style.marginLeft = ''; requestAnimationFrame(() => { const searchRect = search.getBoundingClientRect(); const fieldRect = searchField.getBoundingClientRect(); // Calculate how far from the left of search container the field currently is const currentOffset = fieldRect.left - searchRect.left; // Lock position: switch to flex-start and use fixed margin search.style.justifyContent = 'flex-start'; searchField.style.marginLeft = `${currentOffset}px`; // Mark as locked so pagination changes don't shift the search this._searchPositionLocked = true; }); } // ---------------------------------------------------------------------------- // Columns // ---------------------------------------------------------------------------- _toggleColumnPicker() { this._columnPickerOpen = !this._columnPickerOpen; } _toggleColumn(columnId) { if (this._displayedColumns.includes(columnId)) { this._displayedColumns = this._displayedColumns.filter(id => id !== columnId); } else { this._displayedColumns = [...this._displayedColumns, columnId]; } } // When a user toggles a column on via the column picker, it gets appended // to _displayedColumns. By mapping over _displayedColumns (not def.columns), // the new column appears at the right edge of the table instead of jumping // back to its original position in the column definition. // Actions columns are always moved to the end. getDisplayedColumns() { return this._displayedColumns .map(id => this._def.columns.find(col => col.id === id)) .sort((a, b) => { if (a.type === 'actions' && b.type !== 'actions') return 1; if (a.type !== 'actions' && b.type === 'actions') return -1; return 0; }); } // ---------------------------------------------------------------------------- // Scrolling // ---------------------------------------------------------------------------- /** * Scroll event handler that updates scroll flags in real-time as user scrolls. * Updates shadow indicators to show if more content exists left/right. */ _handleScroll(e) { const container = e.target; this._canScrollLeft = container.scrollLeft > 0; this._canScrollRight = container.scrollLeft < container.scrollWidth - container.clientWidth - 1; } /** * Updates scroll state flags for the table content container. * - _canScrollLeft: true if scrolled right (can scroll back left) * - _canScrollRight: true if more content exists to the right * - _canScrollHorizontal: true if content is wider than container * These flags control scroll shadow indicators and CSS classes. */ _updateScrollFlags() { const container = this.shadowRoot?.querySelector('.content'); if (container) { this._canScrollLeft = container.scrollLeft > 0; this._canScrollRight = container.scrollWidth > container.clientWidth && container.scrollLeft < container.scrollWidth - container.clientWidth - 1; this._canScrollHorizontal = container.scrollWidth > container.clientWidth; } this.classList.toggle('kr-table--scroll-left-available', this._canScrollLeft); this.classList.toggle('kr-table--scroll-right-available', this._canScrollRight); this.classList.toggle('kr-table--scroll-horizontal-available', this._canScrollHorizontal); this.classList.toggle('kr-table--sticky-left', this.getDisplayedColumns().some(c => c.sticky === 'left')); this.classList.toggle('kr-table--sticky-right', this.getDisplayedColumns().some(c => c.sticky === 'right')); } // ---------------------------------------------------------------------------- // Column Resizing // ---------------------------------------------------------------------------- _handleResizeStart(e, columnId) { e.preventDefault(); const headerCell = this.shadowRoot?.querySelector(`.header-cell[data-column-id=\"${columnId}\"]`); this._resizing = { columnId, startX: e.clientX, startWidth: headerCell?.offsetWidth || 200 }; document.addEventListener('mousemove', this._handleResizeMove); document.addEventListener('mouseup', this._handleResizeEnd); } // ---------------------------------------------------------------------------- // Header // ---------------------------------------------------------------------------- _handleAction(action) { this.dispatchEvent(new CustomEvent('action', { detail: { action: action.id }, bubbles: true, composed: true })); } // ---------------------------------------------------------------------------- // Rendering // ---------------------------------------------------------------------------- _renderCellContent(column, row) { const value = row[column.id]; if (column.render) { const result = column.render(row); // If render returns a string, treat it as HTML return typeof result === 'string' ? o$2(result) : result; } if (value === null || value === undefined) { return ''; } switch (column.type) { case 'number': return typeof value === 'number' ? value.toLocaleString() : String(value); case 'currency': return typeof value === 'number' ? value.toLocaleString('en-US', { style: 'currency', currency: 'USD' }) : String(value); case 'date': return value instanceof Date ? value.toLocaleDateString() : new Date(value).toLocaleDateString(); case 'boolean': if (value === true) return 'Yes'; if (value === false) return 'No'; return ''; default: return String(value); } } /** * Returns CSS classes for a header cell based on column config. */ _getHeaderCellClasses(column, index) { return { 'header-cell': true, 'header-cell--align-center': column.align === 'center', 'header-cell--align-right': column.align === 'right', 'header-cell--sticky-left': column.sticky === 'left', 'header-cell--sticky-left-last': column.sticky === 'left' && !this.getDisplayedColumns().slice(index + 1).some(c => c.sticky === 'left'), 'header-cell--sticky-right': column.sticky === 'right', 'header-cell--sticky-right-first': column.sticky === 'right' && !this.getDisplayedColumns().slice(0, index).some(c => c.sticky === 'right') }; } /** * Returns CSS classes for a table cell based on column config: * - Alignment (center, right) * - Sticky positioning (left, right) * - Border classes for the last left-sticky or first right-sticky column */ _getCellClasses(column, index) { return { 'cell': true, 'cell--align-center': column.align === 'center', 'cell--align-right': column.align === 'right', 'cell--sticky-left': column.sticky === 'left', 'cell--sticky-left-last': column.sticky === 'left' && !this.getDisplayedColumns().slice(index + 1).some(c => c.sticky === 'left'), 'cell--sticky-right': column.sticky === 'right', 'cell--sticky-right-first': column.sticky === 'right' && !this.getDisplayedColumns().slice(0, index).some(c => c.sticky === 'right') }; } /** * Returns inline styles for a table cell: * - Width (from column config or default 150px) * - Min-width (if specified) * - Left/right offset for sticky columns (calculated from widths of preceding sticky columns) */ _getCellStyle(column, index) { const styles = {}; if (column.sticky === 'left') { let leftOffset = 0; for (let i = 0; i < index; i++) { const col = this.getDisplayedColumns()[i]; if (col.sticky === 'left') { leftOffset += parseInt(col.width || '0', 10); } } styles.left = `${leftOffset}px`; } if (column.sticky === 'right') { let rightOffset = 0; for (let i = index + 1; i < this.getDisplayedColumns().length; i++) { const col = this.getDisplayedColumns()[i]; if (col.sticky === 'right') { rightOffset += parseInt(col.width || '0', 10); } } styles.right = `${rightOffset}px`; } return styles; } /** * Renders the pagination controls: * - Previous page arrow (disabled on first page) * - Range text showing \"1-50 of 150\" format * - Next page arrow (disabled on last page) * * Hidden when there's no data or all data fits on one page. */ _renderPagination() { const start = (this._page - 1) * this._pageSize + 1; const end = Math.min(this._page * this._pageSize, this._totalItems); return b ` <div class=\"pagination\"> <span class=\"pagination-icon ${this._page === 1 ? 'pagination-icon--disabled' : ''}\" @click=${this.goToPrevPage} > <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"/></svg> </span> <span class=\"pagination-info\">${start}-${end} of ${this._totalItems}</span> <span class=\"pagination-icon ${this._page === this._totalPages ? 'pagination-icon--disabled' : ''}\" @click=${this.goToNextPage} > <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"/></svg> </span> </div> `; } /** * Renders the header toolbar containing: * - Title (left) * - Search bar with view selector dropdown (center) * - Tools (right): page navigation, refresh button, column visibility picker, actions dropdown * * Hidden when there's no title, no actions, and data fits on one page. */ _renderHeader() { if (!this._def.title && !this._def.actions?.length && this._totalPages <= 1) { return A; } return b ` <div class=\"header\"> <div class=\"title\">${this._def.title ?? ''}</div> <div class=\"search\"> <!-- TODO: Saved views dropdown <div class=\"views\"> <span>Default View</span> <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z\"/></svg> </div> --> <div class=\"search-field\"> <svg class=\"search-icon\" viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z\"/></svg> <input type=\"text\" class=\"search-input\" placeholder=\"Search...\" .value=${this._searchQuery} @input=${this._handleSearch} /> </div> </div> <div class=\"tools\"> ${this._renderPagination()} <span class=\"refresh\" title=\"Refresh\" @click=${() => this.refresh()}> <svg viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z\"/></svg> </span> <div class=\"column-picker-wrapper\"> <span class=\"header-icon\" title=\"Columns\" @click=${this._toggleColumnPicker}> <svg viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z\"/></svg> </span> <div class=\"column-picker ${this._columnPickerOpen ? 'open' : ''}\"> ${[...this._def.columns].filter(col => col.type !== 'actions').sort((a, b) => (a.label ?? a.id).localeCompare(b.label ?? b.id)).map(col => b ` <div class=\"column-picker-item\" @click=${() => this._toggleColumn(col.id)}> <div class=\"column-picker-checkbox ${this._displayedColumns.includes(col.id) ? 'checked' : ''}\"> <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z\"/></svg> </div> <span class=\"column-picker-label\">${col.label ?? col.id}</span> </div> `)} </div> </div> ${this._def.actions?.length === 1 ? b ` <kr-button class=\"actions\" @click=${() => this._handleAction(this._def.actions[0])} > ${this._def.actions[0].label} </kr-button> ` : this._def.actions?.length ? b ` <kr-button class=\"actions\" .options=${this._def.actions.map(a => ({ id: a.id, label: a.label }))} @option-select=${(e) => this._handleAction({ id: e.detail.id, label: e.detail.label })} > Actions </kr-button> ` : A} </div> </div> `; } /** Renders status message (loading, error, empty) */ _renderStatus() { if (this._dataState === 'loading' && this._data.length === 0) { return b `<div class=\"status\">Loading...</div>`; } if (this._dataState === 'error' && this._data.length === 0) { return b `<div class=\"status status--error\">Error loading data</div>`; } if (this._data.length === 0) { return b `<div class=\"status\">No data available</div>`; } return A; } _getGridTemplateColumns() { const cols = this.getDisplayedColumns(); const lastNonStickyIndex = cols.map((c, i) => c.sticky ? -1 : i).filter(i => i >= 0).pop(); return cols.map((col, i) => { if (i === lastNonStickyIndex && this._widthsLocked) { return `minmax(${col.width || 'auto'}, 1fr)`; } return col.width || 'auto'; }).join(' '); } /** Renders the scrollable data grid with column headers and rows. */ _renderTable() { return b ` <div class=\"wrapper\"> <div class=\"overlay-left\"></div> <div class=\"overlay-right\"></div> ${this._renderStatus()} <div class=\"content\" @scroll=${this._handleScroll}> <div class=\"table\" style=\"grid-template-columns: ${this._getGridTemplateColumns()}\"> <div class=\"header-row\"> ${this.getDisplayedColumns().map((col, i) => b ` <div class=${e$1(this._getHeaderCellClasses(col, i))} style=${o$1(this._getCellStyle(col, i))} data-column-id=${col.id} >${col.label ?? col.id}${col.resizable !== false ? b `<div class=\"header-cell__resize\" @mousedown=${(e) => this._handleResizeStart(e, col.id)} ></div>` : A}</div> `)} </div> ${this._data.map(row => b ` <div class=\"row\"> ${this.getDisplayedColumns().map((col, i) => b ` <div class=${e$1(this._getCellClasses(col, i))} style=${o$1(this._getCellStyle(col, i))} data-column-id=${col.id} > ${this._renderCellContent(col, row)} </div> `)} </div> `)} </div> </div> </div> `; } /** * Renders a data table with: * - Header bar with title, search input with view selector, and tools (pagination, refresh, column visibility, actions dropdown) * - Scrollable grid with sticky header row and optional sticky left/right columns * - Loading, error message, or empty state when no data */ render() { if (!this._def.columns.length) { return b `<slot></slot>`; } return b ` ${this._renderHeader()} ${this._renderTable()} `; } }"
|
|
260
|
+
},
|
|
248
261
|
{
|
|
249
262
|
"kind": "variable",
|
|
250
263
|
"name": "KRTextField",
|
|
@@ -377,6 +390,14 @@
|
|
|
377
390
|
"module": "dist/krubble.bundled.js"
|
|
378
391
|
}
|
|
379
392
|
},
|
|
393
|
+
{
|
|
394
|
+
"kind": "js",
|
|
395
|
+
"name": "KRTable",
|
|
396
|
+
"declaration": {
|
|
397
|
+
"name": "KRTable",
|
|
398
|
+
"module": "dist/krubble.bundled.js"
|
|
399
|
+
}
|
|
400
|
+
},
|
|
380
401
|
{
|
|
381
402
|
"kind": "js",
|
|
382
403
|
"name": "KRTextField",
|
|
@@ -410,38 +431,38 @@
|
|
|
410
431
|
},
|
|
411
432
|
{
|
|
412
433
|
"kind": "variable",
|
|
413
|
-
"name": "
|
|
434
|
+
"name": "ae",
|
|
414
435
|
"default": "r` :host, *, *::before, *::after { box-sizing: border-box; } :host { /* Primary */ --kr-primary: rgb(22, 48, 82); --kr-primary-hover: rgb(16, 36, 62); --kr-primary-text: #ffffff; /* Accent */ --kr-accent: #BEEA4E; --kr-accent-hover: #a8d43a; --kr-accent-text: #000000; /* Text */ --kr-text: #000000; --kr-text-muted: #4b5563; --kr-text-disabled: #9ca3af; /* Borders */ --kr-border: #e5e7eb; } `"
|
|
415
436
|
},
|
|
416
437
|
{
|
|
417
438
|
"kind": "variable",
|
|
418
|
-
"name": "
|
|
419
|
-
"default": "class extends ne{constructor(){super(...arguments),this.header=\"\",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return
|
|
439
|
+
"name": "be",
|
|
440
|
+
"default": "class extends ne{constructor(){super(...arguments),this.header=\"\",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return U` <div class=\"header\" @click=${this.toggle}> <span class=\"header__title\">${this.header}</span> <svg class=\"header__icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"> <path d=\"M6 9l6 6 6-6\"/> </svg> </div> <div class=\"content\"> <div class=\"content__inner\"> <div class=\"content__body\"> <slot></slot> </div> </div> </div> `}}"
|
|
420
441
|
},
|
|
421
442
|
{
|
|
422
443
|
"kind": "variable",
|
|
423
|
-
"name": "
|
|
424
|
-
"default": "class extends ne{constructor(){super(...arguments),this.type=\"info\",this.dismissible=!1,this.visible=!0}_handleDismiss(){this.visible=!1,this.dispatchEvent(new CustomEvent(\"dismiss\",{bubbles:!0,composed:!0}))}render(){const e={info:
|
|
444
|
+
"name": "Ce",
|
|
445
|
+
"default": "class extends ne{constructor(){super(...arguments),this.type=\"info\",this.dismissible=!1,this.visible=!0}_handleDismiss(){this.visible=!1,this.dispatchEvent(new CustomEvent(\"dismiss\",{bubbles:!0,composed:!0}))}render(){const e={info:U`<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\" clip-rule=\"evenodd\"/></svg>`,success:U`<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clip-rule=\"evenodd\"/></svg>`,warning:U`<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clip-rule=\"evenodd\"/></svg>`,error:U`<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clip-rule=\"evenodd\"/></svg>`};return U` <div class=${we({alert:!0,[\"alert--\"+this.type]:!0,\"alert--hidden\":!this.visible})} role=\"alert\" > ${e[this.type]} <div class=\"content\"> ${this.header?U`<h4 class=\"header\">${this.header}</h4>`:V} <div class=\"message\"> <slot></slot> </div> </div> ${this.dismissible?U` <button class=\"dismiss\" type=\"button\" aria-label=\"Dismiss alert\" @click=${this._handleDismiss} > <svg viewBox=\"0 0 20 20\" fill=\"currentColor\" width=\"16\" height=\"16\"> <path fill-rule=\"evenodd\" d=\"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z\" clip-rule=\"evenodd\"/> </svg> </button> `:V} </div> `}}"
|
|
425
446
|
},
|
|
426
447
|
{
|
|
427
448
|
"kind": "variable",
|
|
428
|
-
"name": "
|
|
429
|
-
"default": "class extends ne{constructor(){super(...arguments),this.variant=\"flat\",this.color=\"primary\",this.size=\"medium\",this.disabled=!1,this._state=\"idle\",this._stateText=\"\",this._handleKeydown=e=>{\"Enter\"!==e.key&&\" \"!==e.key||(e.preventDefault(),this.click())}}connectedCallback(){super.connectedCallback(),this.setAttribute(\"role\",\"button\"),this.setAttribute(\"tabindex\",\"0\"),this.addEventListener(\"keydown\",this._handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(\"keydown\",this._handleKeydown)}showLoading(){this._clearStateTimeout(),this._state=\"loading\",this._stateText=\"\"}showSuccess(e=\"Success\",t=2e3){this._clearStateTimeout(),this._state=\"success\",this._stateText=e,this._stateTimeout=window.setTimeout(()=>this.reset(),t)}showError(e=\"Error\",t=2e3){this._clearStateTimeout(),this._state=\"error\",this._stateText=e,this._stateTimeout=window.setTimeout(()=>this.reset(),t)}reset(){this._clearStateTimeout(),this._state=\"idle\",this._stateText=\"\"}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}updated(e){this.classList.toggle(\"kr-button--loading\",\"loading\"===this._state),this.classList.toggle(\"kr-button--success\",\"success\"===this._state),this.classList.toggle(\"kr-button--error\",\"error\"===this._state),this.classList.toggle(`kr-button--${this.variant}`,!0),this.classList.toggle(`kr-button--${this.color}`,!0),this.classList.toggle(\"kr-button--small\",\"small\"===this.size),this.classList.toggle(\"kr-button--large\",\"large\"===this.size)}render(){return
|
|
449
|
+
"name": "Ee",
|
|
450
|
+
"default": "class extends ne{constructor(){super(...arguments),this.variant=\"flat\",this.color=\"primary\",this.size=\"medium\",this.disabled=!1,this.options=[],this._state=\"idle\",this._stateText=\"\",this._dropdownOpened=!1,this._dropdownAlignRight=!1,this._handleHostClick=e=>{this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{\"Enter\"!==e.key&&\" \"!==e.key||(e.preventDefault(),this.options.length?this._toggleDropdown():this.click()),\"Escape\"===e.key&&this._dropdownOpened&&(this._dropdownOpened=!1)},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.setAttribute(\"role\",\"button\"),this.setAttribute(\"tabindex\",\"0\"),this.addEventListener(\"keydown\",this._handleKeydown),this.addEventListener(\"click\",this._handleHostClick),document.addEventListener(\"click\",this._handleClickOutside)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(\"keydown\",this._handleKeydown),this.removeEventListener(\"click\",this._handleHostClick),document.removeEventListener(\"click\",this._handleClickOutside)}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(\".dropdown\");if(e){const t=e.getBoundingClientRect();this._dropdownAlignRight=t.right>window.innerWidth}})}_handleOptionClick(e,t){t.stopPropagation(),this._dropdownOpened=!1,this.dispatchEvent(new CustomEvent(\"option-select\",{detail:{id:e.id,label:e.label},bubbles:!0,composed:!0}))}showLoading(){this._clearStateTimeout(),this._state=\"loading\",this._stateText=\"\"}showSuccess(e=\"Success\",t=2e3){this._clearStateTimeout(),this._state=\"success\",this._stateText=e,this._stateTimeout=window.setTimeout(()=>this.reset(),t)}showError(e=\"Error\",t=2e3){this._clearStateTimeout(),this._state=\"error\",this._stateText=e,this._stateTimeout=window.setTimeout(()=>this.reset(),t)}reset(){this._clearStateTimeout(),this._state=\"idle\",this._stateText=\"\"}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}updated(e){this.classList.toggle(\"kr-button--loading\",\"loading\"===this._state),this.classList.toggle(\"kr-button--success\",\"success\"===this._state),this.classList.toggle(\"kr-button--error\",\"error\"===this._state),this.classList.toggle(`kr-button--${this.variant}`,!0),this.classList.toggle(`kr-button--${this.color}`,!0),this.classList.toggle(\"kr-button--small\",\"small\"===this.size),this.classList.toggle(\"kr-button--large\",\"large\"===this.size)}render(){return U` <slot></slot> ${this.options.length?U`<svg class=\"caret\" xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z\"/></svg>`:V} ${\"idle\"!==this._state?U`<span class=\"state-overlay\"> ${\"loading\"===this._state?U`<span class=\"spinner\"></span>`:this._stateText} </span>`:V} ${this.options.length?U` <div class=\"dropdown ${this._dropdownOpened?\"dropdown--opened\":\"\"} ${this._dropdownAlignRight?\"dropdown--align-right\":\"\"}\"> ${this.options.map(e=>U` <button class=\"dropdown-item\" @click=${t=>this._handleOptionClick(e,t)} >${e.label}</button> `)} </div> `:V} `}}"
|
|
430
451
|
},
|
|
431
452
|
{
|
|
432
453
|
"kind": "variable",
|
|
433
|
-
"name": "
|
|
434
|
-
"default": "class extends ne{constructor(){super(...arguments),this.language=\"html\",this.code=\"\",this.activeTab=\"preview\",this.copied=!1}setTab(e){this.activeTab=e}getHighlightedCode(){return this.code?window.Prism&&window.Prism.languages[this.language]?window.Prism.highlight(this.code,window.Prism.languages[this.language],this.language):this.escapeHtml(this.code):\"\"}escapeHtml(e){const t=document.createElement(\"div\");return t.textContent=e,t.innerHTML}async copyCode(){if(this.code)try{await navigator.clipboard.writeText(this.code),this.copied=!0,setTimeout(()=>{this.copied=!1},2e3)}catch(e){console.error(\"Failed to copy code:\",e)}}render(){return
|
|
454
|
+
"name": "ze",
|
|
455
|
+
"default": "class extends ne{constructor(){super(...arguments),this.language=\"html\",this.code=\"\",this.activeTab=\"preview\",this.copied=!1}setTab(e){this.activeTab=e}getHighlightedCode(){return this.code?window.Prism&&window.Prism.languages[this.language]?window.Prism.highlight(this.code,window.Prism.languages[this.language],this.language):this.escapeHtml(this.code):\"\"}escapeHtml(e){const t=document.createElement(\"div\");return t.textContent=e,t.innerHTML}async copyCode(){if(this.code)try{await navigator.clipboard.writeText(this.code),this.copied=!0,setTimeout(()=>{this.copied=!1},2e3)}catch(e){console.error(\"Failed to copy code:\",e)}}render(){return U` <div class=\"tabs\"> <button class=${we({tab:!0,\"tab--active\":\"preview\"===this.activeTab})} @click=${()=>this.setTab(\"preview\")} > Preview </button> <button class=${we({tab:!0,\"tab--active\":\"code\"===this.activeTab})} @click=${()=>this.setTab(\"code\")} > Code </button> </div> <div class=${we({panel:!0,\"panel--active\":\"preview\"===this.activeTab,preview:!0})}> <slot name=\"preview\"></slot> </div> <div class=${we({panel:!0,\"panel--active\":\"code\"===this.activeTab,\"code-container\":!0})}> <button class=${we({\"copy-btn\":!0,\"copy-btn--copied\":this.copied})} @click=${this.copyCode} > ${this.copied?\"Copied!\":\"Copy\"} </button> <pre class=\"code\"><code>${Oe(this.getHighlightedCode())}</code></pre> </div> `}}"
|
|
435
456
|
},
|
|
436
457
|
{
|
|
437
458
|
"kind": "variable",
|
|
438
|
-
"name": "
|
|
439
|
-
"default": "class extends ne{constructor(){super(...arguments),this.items=[],this.resolvePromise=null,this.boundHandleOutsideClick=this.handleOutsideClick.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static async open(e){const t=document.querySelector(\"kr-context-menu\");t&&t.remove();const i=document.createElement(\"kr-context-menu\");return document.body.appendChild(i),i.show(e)}async show(e){this.items=e.items,this.style.left=`${e.x}px`,this.style.top=`${e.y}px`,await this.updateComplete;const t=this.getBoundingClientRect();return t.right>window.innerWidth&&(this.style.left=e.x-t.width+\"px\"),t.bottom>window.innerHeight&&(this.style.top=e.y-t.height+\"px\"),requestAnimationFrame(()=>{document.addEventListener(\"click\",this.boundHandleOutsideClick),document.addEventListener(\"contextmenu\",this.boundHandleOutsideClick),document.addEventListener(\"keydown\",this.boundHandleKeyDown)}),new Promise(e=>{this.resolvePromise=e})}handleOutsideClick(e){this.contains(e.target)||this.close(null)}handleKeyDown(e){\"Escape\"===e.key&&this.close(null)}handleItemClick(e){e.disabled||e.divider||this.close(e)}close(e){document.removeEventListener(\"click\",this.boundHandleOutsideClick),document.removeEventListener(\"contextmenu\",this.boundHandleOutsideClick),document.removeEventListener(\"keydown\",this.boundHandleKeyDown),this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=null),this.remove()}render(){return
|
|
459
|
+
"name": "Le",
|
|
460
|
+
"default": "class extends ne{constructor(){super(...arguments),this.items=[],this.resolvePromise=null,this.boundHandleOutsideClick=this.handleOutsideClick.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static async open(e){const t=document.querySelector(\"kr-context-menu\");t&&t.remove();const i=document.createElement(\"kr-context-menu\");return document.body.appendChild(i),i.show(e)}async show(e){this.items=e.items,this.style.left=`${e.x}px`,this.style.top=`${e.y}px`,await this.updateComplete;const t=this.getBoundingClientRect();return t.right>window.innerWidth&&(this.style.left=e.x-t.width+\"px\"),t.bottom>window.innerHeight&&(this.style.top=e.y-t.height+\"px\"),requestAnimationFrame(()=>{document.addEventListener(\"click\",this.boundHandleOutsideClick),document.addEventListener(\"contextmenu\",this.boundHandleOutsideClick),document.addEventListener(\"keydown\",this.boundHandleKeyDown)}),new Promise(e=>{this.resolvePromise=e})}handleOutsideClick(e){this.contains(e.target)||this.close(null)}handleKeyDown(e){\"Escape\"===e.key&&this.close(null)}handleItemClick(e){e.disabled||e.divider||this.close(e)}close(e){document.removeEventListener(\"click\",this.boundHandleOutsideClick),document.removeEventListener(\"contextmenu\",this.boundHandleOutsideClick),document.removeEventListener(\"keydown\",this.boundHandleKeyDown),this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=null),this.remove()}render(){return U` <div class=\"menu\"> ${this.items.map(e=>e.divider?U`<div class=\"menu__divider\"></div>`:U` <button class=\"menu__item\" ?disabled=${e.disabled} @click=${()=>this.handleItemClick(e)} > ${e.icon?U`<span class=\"menu__item-icon\">${e.icon}</span>`:null} ${e.label} </button> `)} </div> `}}"
|
|
440
461
|
},
|
|
441
462
|
{
|
|
442
463
|
"kind": "class",
|
|
443
464
|
"description": "",
|
|
444
|
-
"name": "
|
|
465
|
+
"name": "Me",
|
|
445
466
|
"members": [
|
|
446
467
|
{
|
|
447
468
|
"kind": "method",
|
|
@@ -490,37 +511,42 @@
|
|
|
490
511
|
},
|
|
491
512
|
{
|
|
492
513
|
"kind": "variable",
|
|
493
|
-
"name": "
|
|
494
|
-
"default": "class extends ne{constructor(){super(...arguments),this.contentElement=null,this.dialogRef=null,this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static open(e,t){const i=document.querySelector(\"kr-dialog\");i&&i.remove();const o=new
|
|
514
|
+
"name": "De",
|
|
515
|
+
"default": "class extends ne{constructor(){super(...arguments),this.contentElement=null,this.dialogRef=null,this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static open(e,t){const i=document.querySelector(\"kr-dialog\");i&&i.remove();const o=new Me,s=document.createElement(\"kr-dialog\");o.setDialogElement(s),s.dialogRef=o;const r=new e;return r.dialogRef=o,t?.data&&(r.data=t.data),s.contentElement=r,document.body.appendChild(s),document.addEventListener(\"keydown\",s.boundHandleKeyDown),o}handleKeyDown(e){\"Escape\"===e.key&&this.dialogRef?.close(void 0)}handleBackdropClick(e){e.target.classList.contains(\"backdrop\")&&this.dialogRef?.close(void 0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(\"keydown\",this.boundHandleKeyDown)}render(){return U` <div class=\"backdrop\" @click=${this.handleBackdropClick}></div> <div class=\"dialog\"> ${this.contentElement} </div> `}}"
|
|
495
516
|
},
|
|
496
517
|
{
|
|
497
518
|
"kind": "variable",
|
|
498
|
-
"name": "
|
|
519
|
+
"name": "Ie"
|
|
499
520
|
},
|
|
500
521
|
{
|
|
501
522
|
"kind": "variable",
|
|
502
|
-
"name": "
|
|
503
|
-
"default": "class extends ne{constructor(){super(...arguments),this.justified=!1,this.size=\"medium\"}updated(e){e.has(\"activeTabId\")&&this._updateActiveTab()}firstUpdated(){this._updateActiveTab()}_getTabs(){return Array.from(this.querySelectorAll(\"kr-tab\"))}_updateActiveTab(){const e=this._getTabs();0!==e.length&&(this.activeTabId||(this.activeTabId=e[0]?.id),e.forEach(e=>{e.active=e.id===this.activeTabId}),this.requestUpdate())}_handleTabClick(e){e.disabled||(this.activeTabId=e.id,this.dispatchEvent(new CustomEvent(\"tab-change\",{detail:{activeTabId:e.id},bubbles:!0,composed:!0})))}_handleTabDismiss(e,t){t.stopPropagation(),this.dispatchEvent(new CustomEvent(\"tab-dismiss\",{detail:{tabId:e.id},bubbles:!0,composed:!0}))}_handleKeyDown(e){const t=this._getTabs().filter(e=>!e.disabled),i=t.findIndex(e=>e.id===this.activeTabId);let o=-1;switch(e.key){case\"ArrowLeft\":o=i>0?i-1:t.length-1;break;case\"ArrowRight\":o=i<t.length-1?i+1:0;break;case\"Home\":o=0;break;case\"End\":o=t.length-1}if(o>=0){e.preventDefault();const i=t[o];this.activeTabId=i.id,this.dispatchEvent(new CustomEvent(\"tab-change\",{detail:{activeTabId:i.id},bubbles:!0,composed:!0}));const s=this.shadowRoot?.querySelectorAll(\".label\"),r=Array.from(s||[]).find(e=>e.getAttribute(\"data-tab-id\")===i.id);r?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return
|
|
523
|
+
"name": "Ve",
|
|
524
|
+
"default": "class extends ne{constructor(){super(...arguments),this.justified=!1,this.size=\"medium\"}updated(e){e.has(\"activeTabId\")&&this._updateActiveTab()}firstUpdated(){this._updateActiveTab()}_getTabs(){return Array.from(this.querySelectorAll(\"kr-tab\"))}_updateActiveTab(){const e=this._getTabs();0!==e.length&&(this.activeTabId||(this.activeTabId=e[0]?.id),e.forEach(e=>{e.active=e.id===this.activeTabId}),this.requestUpdate())}_handleTabClick(e){e.disabled||(this.activeTabId=e.id,this.dispatchEvent(new CustomEvent(\"tab-change\",{detail:{activeTabId:e.id},bubbles:!0,composed:!0})))}_handleTabDismiss(e,t){t.stopPropagation(),this.dispatchEvent(new CustomEvent(\"tab-dismiss\",{detail:{tabId:e.id},bubbles:!0,composed:!0}))}_handleKeyDown(e){const t=this._getTabs().filter(e=>!e.disabled),i=t.findIndex(e=>e.id===this.activeTabId);let o=-1;switch(e.key){case\"ArrowLeft\":o=i>0?i-1:t.length-1;break;case\"ArrowRight\":o=i<t.length-1?i+1:0;break;case\"Home\":o=0;break;case\"End\":o=t.length-1}if(o>=0){e.preventDefault();const i=t[o];this.activeTabId=i.id,this.dispatchEvent(new CustomEvent(\"tab-change\",{detail:{activeTabId:i.id},bubbles:!0,composed:!0}));const s=this.shadowRoot?.querySelectorAll(\".label\"),r=Array.from(s||[]).find(e=>e.getAttribute(\"data-tab-id\")===i.id);r?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return V;const i=t.cloneNode(!0);return i.removeAttribute(\"slot\"),U`<span class=\"label-icon\">${i}</span>`}render(){return U` <div class=\"header\" role=\"tablist\" @keydown=${this._handleKeyDown}> ${this._getTabs().map(e=>U` <button class=${we({label:!0,\"label--active\":e.id===this.activeTabId,\"label--justified\":this.justified})} role=\"tab\" data-tab-id=${e.id} aria-selected=${e.id===this.activeTabId} aria-controls=${`panel-${e.id}`} tabindex=${e.id===this.activeTabId?0:-1} ?disabled=${e.disabled} @click=${()=>this._handleTabClick(e)} > ${this._renderTabIcon(e)} <span>${e.title}</span> ${e.badge?U`<span class=\"label-badge\" style=${Ue({backgroundColor:e.badgeBackground,color:e.badgeColor})}>${e.badge}</span>`:V} ${e.dismissible?U` <button class=\"label-dismiss\" type=\"button\" aria-label=\"Close tab\" @click=${t=>this._handleTabDismiss(e,t)} > <svg viewBox=\"0 0 20 20\" fill=\"currentColor\" width=\"12\" height=\"12\"><path fill-rule=\"evenodd\" d=\"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z\" clip-rule=\"evenodd\"/></svg> </button> `:V} </button> `)} </div> <div class=\"content\" role=\"tabpanel\" aria-labelledby=${this.activeTabId||\"\"}> <slot @slotchange=${this._updateActiveTab}></slot> </div> `}}"
|
|
504
525
|
},
|
|
505
526
|
{
|
|
506
527
|
"kind": "variable",
|
|
507
|
-
"name": "
|
|
508
|
-
"default": "class extends ne{constructor(){super(...arguments),this.id=\"\",this.title=\"\",this.badge=\"\",this.badgeBackground=\"\",this.badgeColor=\"\",this.disabled=!1,this.dismissible=!1,this.active=!1}getIconElement(){return this.querySelector('[slot=\"icon\"]')}render(){return
|
|
528
|
+
"name": "We",
|
|
529
|
+
"default": "class extends ne{constructor(){super(...arguments),this.id=\"\",this.title=\"\",this.badge=\"\",this.badgeBackground=\"\",this.badgeColor=\"\",this.disabled=!1,this.dismissible=!1,this.active=!1}getIconElement(){return this.querySelector('[slot=\"icon\"]')}render(){return U`<slot></slot>`}}"
|
|
509
530
|
},
|
|
510
531
|
{
|
|
511
532
|
"kind": "variable",
|
|
512
|
-
"name": "
|
|
513
|
-
"default": "class extends ne{constructor(){super(),this.label=\"\",this.name=\"\",this.value=\"\",this.placeholder=\"\",this.type=\"text\",this.required=!1,this.disabled=!1,this.readonly=!1,this.autocomplete=\"\",this.hint=\"\",this._touched=!1,this._dirty=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value=\"\",this._touched=!1,this._dirty=!1,this._internals.setFormValue(\"\"),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),this.addEventListener(\"invalid\",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(\"invalid\",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has(\"required\")||e.has(\"value\"))&&this._updateValidity()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleInput(e){this.value=e.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage)}render(){let e=\"\";return this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage),V` <div class=\"wrapper\"> ${this.label?V` <label for=\"input\"> ${this.label} ${this.required?V`<span class=\"required\" aria-hidden=\"true\">*</span>`:\"\"} </label> `:\"\"} <input id=\"input\" class=${$e({\"input--invalid\":this._touched&&this._input&&!this._input.validity.valid})} type=${this.type} name=${this.name} .value=${Ze(this.value)} placeholder=${this.placeholder} ?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly} minlength=${We(this.minlength)} maxlength=${We(this.maxlength)} pattern=${We(this.pattern)} autocomplete=${We(this.autocomplete||void 0)} @input=${this._handleInput} @change=${this._handleChange} @blur=${this._handleBlur} /> ${e?V`<div class=\"validation-message\">${e}</div>`:this.hint?V`<div class=\"hint\">${this.hint}</div>`:\"\"} </div> `}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}}"
|
|
533
|
+
"name": "Ye",
|
|
534
|
+
"default": "class extends ne{constructor(){super(...arguments),this._scrollStyle=\"overlay\",this._data=[],this._dataState=\"idle\",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery=\"\",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._displayedColumns=[],this._widthsLocked=!1,this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._def={columns:[]},this.def={columns:[]},this._handleClickOutsideColumnPicker=e=>{if(!this._columnPickerOpen)return;const t=e.composedPath(),i=this.shadowRoot?.querySelector(\".column-picker-wrapper\");i&&!t.includes(i)&&(this._columnPickerOpen=!1)},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._def.columns.find(e=>e.id===this._resizing.columnId);if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener(\"mousemove\",this._handleResizeMove),document.removeEventListener(\"mouseup\",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle(\"kr-table--scroll-overlay\",\"overlay\"===this._scrollStyle),this.classList.toggle(\"kr-table--scroll-edge\",\"edge\"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener(\"click\",this._handleClickOutsideColumnPicker),this._resizeObserver=new ResizeObserver(()=>{this._searchPositionLocked=!1,this._updateSearchPosition()}),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener(\"click\",this._handleClickOutsideColumnPicker),this._resizeObserver?.disconnect()}willUpdate(e){e.has(\"def\")&&(this._def={...this.def,columns:this.def.columns.map(e=>\"actions\"===e.type?{...e,sticky:\"right\",resizable:!1}:{...e})},this._displayedColumns=this._def.displayedColumns||this._def.columns.map(e=>e.id),this._widthsLocked=!1,this.classList.remove(\"kr-table--widths-locked\"),this._fetch(),this._initRefresh())}updated(e){this._updateScrollFlags()}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_fetch(){if(!this._def.dataSource)return;let e;switch(this._dataState=\"loading\",this._def.dataSource.mode){case\"opensearch\":throw Error(\"Opensearch not supported yet\");case\"db\":throw Error(\"DB not supported yet\");default:e={page:this._page-1,size:this._pageSize,sorts:[],filterFields:[],queryFields:[],facetFields:[]},this._searchQuery?.trim().length&&e.queryFields.push({name:\"_text_\",operation:\"IS\",value:Qe(this._searchQuery)})}this._def.dataSource.fetch(e).then(e=>{switch(this._def.dataSource?.mode){case\"opensearch\":throw Error(\"Opensearch not supported yet\");case\"db\":throw Error(\"DB not supported yet\");default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size}}this._dataState=\"success\",this._updateSearchPosition(),this._widthsLocked||this._lockColumnWidths()}).catch(e=>{this._dataState=\"error\",Ie.show({message:e instanceof Error?e.message:\"Failed to load data\",type:\"error\"})})}_initRefresh(){clearInterval(this._refreshTimer),this._def.refreshInterval&&this._def.refreshInterval>0&&(this._refreshTimer=window.setInterval(()=>{this._fetch()},this._def.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_measureTextWidth(e,t){const i=document.createElement(\"canvas\").getContext(\"2d\");return i.font=t,i.measureText(e).width}_lockColumnWidths(){this.updateComplete.then(()=>{requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(\".header-cell\"),t=this.shadowRoot?.querySelector(\".cell\");if(!e)return;const i=getComputedStyle(e),o=`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`,s=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),r=t?getComputedStyle(t):i,n=`${r.fontWeight} ${r.fontSize} ${r.fontFamily}`,l=t?parseFloat(r.paddingLeft)+parseFloat(r.paddingRight):s;this.getDisplayedColumns().forEach(e=>{if(!e.width){let t;if(e.render){const i=this.shadowRoot?.querySelector(`.cell[data-column-id=\"${e.id}\"]`);t=i?i.scrollWidth:150}else{const i=e.label??e.id,r=this._measureTextWidth(i,o)+s;let a=0;for(const t of this._data){const i=t[e.id];if(null!=i){const e=this._measureTextWidth(String(i),n)+l;e>a&&(a=e)}}t=Math.ceil(Math.max(r,a))}e.width=`${Math.max(t,150)}px`}}),this._widthsLocked=!0,this.classList.add(\"kr-table--widths-locked\"),this.requestUpdate()})})}_updateSearchPosition(){if(this._searchPositionLocked)return;const e=this.shadowRoot?.querySelector(\".search\"),t=e?.querySelector(\".search-field\");e&&t&&(e.style.justifyContent=\"center\",t.style.marginLeft=\"\",requestAnimationFrame(()=>{const i=e.getBoundingClientRect(),o=t.getBoundingClientRect().left-i.left;e.style.justifyContent=\"flex-start\",t.style.marginLeft=`${o}px`,this._searchPositionLocked=!0}))}_toggleColumnPicker(){this._columnPickerOpen=!this._columnPickerOpen}_toggleColumn(e){this._displayedColumns.includes(e)?this._displayedColumns=this._displayedColumns.filter(t=>t!==e):this._displayedColumns=[...this._displayedColumns,e]}getDisplayedColumns(){return this._displayedColumns.map(e=>this._def.columns.find(t=>t.id===e)).sort((e,t)=>\"actions\"===e.type&&\"actions\"!==t.type?1:\"actions\"!==e.type&&\"actions\"===t.type?-1:0)}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(\".content\");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle(\"kr-table--scroll-left-available\",this._canScrollLeft),this.classList.toggle(\"kr-table--scroll-right-available\",this._canScrollRight),this.classList.toggle(\"kr-table--scroll-horizontal-available\",this._canScrollHorizontal),this.classList.toggle(\"kr-table--sticky-left\",this.getDisplayedColumns().some(e=>\"left\"===e.sticky)),this.classList.toggle(\"kr-table--sticky-right\",this.getDisplayedColumns().some(e=>\"right\"===e.sticky))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id=\"${t}\"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener(\"mousemove\",this._handleResizeMove),document.addEventListener(\"mouseup\",this._handleResizeEnd)}_handleAction(e){this.dispatchEvent(new CustomEvent(\"action\",{detail:{action:e.id},bubbles:!0,composed:!0}))}_renderCellContent(e,t){const i=t[e.id];if(e.render){const i=e.render(t);return\"string\"==typeof i?Oe(i):i}if(null==i)return\"\";switch(e.type){case\"number\":return\"number\"==typeof i?i.toLocaleString():String(i);case\"currency\":return\"number\"==typeof i?i.toLocaleString(\"en-US\",{style:\"currency\",currency:\"USD\"}):String(i);case\"date\":return i instanceof Date?i.toLocaleDateString():new Date(i).toLocaleDateString();case\"boolean\":return!0===i?\"Yes\":!1===i?\"No\":\"\";default:return String(i)}}_getHeaderCellClasses(e,t){return{\"header-cell\":!0,\"header-cell--align-center\":\"center\"===e.align,\"header-cell--align-right\":\"right\"===e.align,\"header-cell--sticky-left\":\"left\"===e.sticky,\"header-cell--sticky-left-last\":\"left\"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some(e=>\"left\"===e.sticky),\"header-cell--sticky-right\":\"right\"===e.sticky,\"header-cell--sticky-right-first\":\"right\"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some(e=>\"right\"===e.sticky)}}_getCellClasses(e,t){return{cell:!0,\"cell--align-center\":\"center\"===e.align,\"cell--align-right\":\"right\"===e.align,\"cell--sticky-left\":\"left\"===e.sticky,\"cell--sticky-left-last\":\"left\"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some(e=>\"left\"===e.sticky),\"cell--sticky-right\":\"right\"===e.sticky,\"cell--sticky-right-first\":\"right\"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some(e=>\"right\"===e.sticky)}}_getCellStyle(e,t){const i={};if(\"left\"===e.sticky){let e=0;for(let i=0;i<t;i++){const t=this.getDisplayedColumns()[i];\"left\"===t.sticky&&(e+=parseInt(t.width||\"0\",10))}i.left=`${e}px`}if(\"right\"===e.sticky){let e=0;for(let i=t+1;i<this.getDisplayedColumns().length;i++){const t=this.getDisplayedColumns()[i];\"right\"===t.sticky&&(e+=parseInt(t.width||\"0\",10))}i.right=`${e}px`}return i}_renderPagination(){const e=(this._page-1)*this._pageSize+1,t=Math.min(this._page*this._pageSize,this._totalItems);return U` <div class=\"pagination\"> <span class=\"pagination-icon ${1===this._page?\"pagination-icon--disabled\":\"\"}\" @click=${this.goToPrevPage} > <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"/></svg> </span> <span class=\"pagination-info\">${e}-${t} of ${this._totalItems}</span> <span class=\"pagination-icon ${this._page===this._totalPages?\"pagination-icon--disabled\":\"\"}\" @click=${this.goToNextPage} > <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"/></svg> </span> </div> `}_renderHeader(){return!this._def.title&&!this._def.actions?.length&&this._totalPages<=1?V:U` <div class=\"header\"> <div class=\"title\">${this._def.title??\"\"}</div> <div class=\"search\"> <!-- TODO: Saved views dropdown <div class=\"views\"> <span>Default View</span> <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z\"/></svg> </div> --> <div class=\"search-field\"> <svg class=\"search-icon\" viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z\"/></svg> <input type=\"text\" class=\"search-input\" placeholder=\"Search...\" .value=${this._searchQuery} @input=${this._handleSearch} /> </div> </div> <div class=\"tools\"> ${this._renderPagination()} <span class=\"refresh\" title=\"Refresh\" @click=${()=>this.refresh()}> <svg viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z\"/></svg> </span> <div class=\"column-picker-wrapper\"> <span class=\"header-icon\" title=\"Columns\" @click=${this._toggleColumnPicker}> <svg viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z\"/></svg> </span> <div class=\"column-picker ${this._columnPickerOpen?\"open\":\"\"}\"> ${[...this._def.columns].filter(e=>\"actions\"!==e.type).sort((e,t)=>(e.label??e.id).localeCompare(t.label??t.id)).map(e=>U` <div class=\"column-picker-item\" @click=${()=>this._toggleColumn(e.id)}> <div class=\"column-picker-checkbox ${this._displayedColumns.includes(e.id)?\"checked\":\"\"}\"> <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z\"/></svg> </div> <span class=\"column-picker-label\">${e.label??e.id}</span> </div> `)} </div> </div> ${1===this._def.actions?.length?U` <kr-button class=\"actions\" @click=${()=>this._handleAction(this._def.actions[0])} > ${this._def.actions[0].label} </kr-button> `:this._def.actions?.length?U` <kr-button class=\"actions\" .options=${this._def.actions.map(e=>({id:e.id,label:e.label}))} @option-select=${e=>this._handleAction({id:e.detail.id,label:e.detail.label})} > Actions </kr-button> `:V} </div> </div> `}_renderStatus(){return\"loading\"===this._dataState&&0===this._data.length?U`<div class=\"status\">Loading...</div>`:\"error\"===this._dataState&&0===this._data.length?U`<div class=\"status status--error\">Error loading data</div>`:0===this._data.length?U`<div class=\"status\">No data available</div>`:V}_getGridTemplateColumns(){const e=this.getDisplayedColumns(),t=e.map((e,t)=>e.sticky?-1:t).filter(e=>e>=0).pop();return e.map((e,i)=>i===t&&this._widthsLocked?`minmax(${e.width||\"auto\"}, 1fr)`:e.width||\"auto\").join(\" \")}_renderTable(){return U` <div class=\"wrapper\"> <div class=\"overlay-left\"></div> <div class=\"overlay-right\"></div> ${this._renderStatus()} <div class=\"content\" @scroll=${this._handleScroll}> <div class=\"table\" style=\"grid-template-columns: ${this._getGridTemplateColumns()}\"> <div class=\"header-row\"> ${this.getDisplayedColumns().map((e,t)=>U` <div class=${we(this._getHeaderCellClasses(e,t))} style=${Ue(this._getCellStyle(e,t))} data-column-id=${e.id} >${e.label??e.id}${!1!==e.resizable?U`<div class=\"header-cell__resize\" @mousedown=${t=>this._handleResizeStart(t,e.id)} ></div>`:V}</div> `)} </div> ${this._data.map(e=>U` <div class=\"row\"> ${this.getDisplayedColumns().map((t,i)=>U` <div class=${we(this._getCellClasses(t,i))} style=${Ue(this._getCellStyle(t,i))} data-column-id=${t.id} > ${this._renderCellContent(t,e)} </div> `)} </div> `)} </div> </div> </div> `}render(){return this._def.columns.length?U` ${this._renderHeader()} ${this._renderTable()} `:U`<slot></slot>`}}"
|
|
514
535
|
},
|
|
515
536
|
{
|
|
516
537
|
"kind": "variable",
|
|
517
|
-
"name": "
|
|
518
|
-
"default": "class extends ne{constructor(){super(),this.label=\"\",this.name=\"\",this.value=\"\",this.placeholder=\"
|
|
538
|
+
"name": "it",
|
|
539
|
+
"default": "class extends ne{constructor(){super(),this.label=\"\",this.name=\"\",this.value=\"\",this.placeholder=\"\",this.type=\"text\",this.required=!1,this.disabled=!1,this.readonly=!1,this.autocomplete=\"\",this.hint=\"\",this._touched=!1,this._dirty=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value=\"\",this._touched=!1,this._dirty=!1,this._internals.setFormValue(\"\"),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),this.addEventListener(\"invalid\",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(\"invalid\",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has(\"required\")||e.has(\"value\"))&&this._updateValidity()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleInput(e){this.value=e.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage)}render(){let e=\"\";return this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage),U` <div class=\"wrapper\"> ${this.label?U` <label for=\"input\"> ${this.label} ${this.required?U`<span class=\"required\" aria-hidden=\"true\">*</span>`:\"\"} </label> `:\"\"} <input id=\"input\" class=${we({\"input--invalid\":this._touched&&this._input&&!this._input.validity.valid})} type=${this.type} name=${this.name} .value=${et(this.value)} placeholder=${this.placeholder} ?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly} minlength=${Ge(this.minlength)} maxlength=${Ge(this.maxlength)} pattern=${Ge(this.pattern)} autocomplete=${Ge(this.autocomplete||void 0)} @input=${this._handleInput} @change=${this._handleChange} @blur=${this._handleBlur} /> ${e?U`<div class=\"validation-message\">${e}</div>`:this.hint?U`<div class=\"hint\">${this.hint}</div>`:\"\"} </div> `}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}}"
|
|
519
540
|
},
|
|
520
541
|
{
|
|
521
542
|
"kind": "variable",
|
|
522
|
-
"name": "
|
|
523
|
-
"default": "class extends ne{constructor(){super(
|
|
543
|
+
"name": "st",
|
|
544
|
+
"default": "class extends ne{constructor(){super(),this.label=\"\",this.name=\"\",this.value=\"\",this.placeholder=\"Select an option\",this.disabled=!1,this.required=!1,this.readonly=!1,this.hint=\"\",this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._handleOutsideClick=e=>{this.contains(e.target)||this._close()},this._handleKeyDown=e=>{if(!this._isOpen)return;const t=Array.from(this.querySelectorAll(\"kr-select-option\"));switch(e.key){case\"Escape\":this._close(),this._triggerElement?.focus();break;case\"ArrowDown\":if(e.preventDefault(),t.some(e=>!e.disabled)){let e=this._highlightedIndex+1;for(;e<t.length&&t[e]?.disabled;)e++;e<t.length&&(this._highlightedIndex=e)}break;case\"ArrowUp\":e.preventDefault();{let e=this._highlightedIndex-1;for(;e>=0&&t[e]?.disabled;)e--;e>=0&&(this._highlightedIndex=e)}break;case\"Enter\":e.preventDefault(),this._highlightedIndex>=0&&this._highlightedIndex<t.length&&this._selectOption(t[this._highlightedIndex])}},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value=\"\",this._touched=!1,this._internals.setFormValue(\"\"),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),document.addEventListener(\"click\",this._handleOutsideClick),document.addEventListener(\"keydown\",this._handleKeyDown),this.addEventListener(\"invalid\",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has(\"required\")||e.has(\"value\"))&&this._updateValidity()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(\"click\",this._handleOutsideClick),document.removeEventListener(\"keydown\",this._handleKeyDown),this.removeEventListener(\"invalid\",this._handleInvalid)}_toggle(){if(!this.disabled&&!this.readonly)if(this._isOpen)this._close();else{this._isOpen=!0;const e=Array.from(this.querySelectorAll(\"kr-select-option\"));this._highlightedIndex=e.findIndex(e=>e.value===this.value)}}_close(){this._isOpen=!1,this._highlightedIndex=-1}_selectOption(e){e.disabled||(this.value=e.value,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event(\"change\",{bubbles:!0,composed:!0})),this._close(),this._triggerElement?.focus())}_handleBlur(){this._touched=!0,this._updateValidity()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},\"Please select an option\",this._triggerElement):this._internals.setValidity({})}render(){const e=Array.from(this.querySelectorAll(\"kr-select-option\")),t=e.find(e=>e.value===this.value)?.label;return U` <div class=\"wrapper\"> ${this.label?U` <label> ${this.label} ${this.required?U`<span class=\"required\" aria-hidden=\"true\">*</span>`:\"\"} </label> `:V} <div class=\"select-wrapper\"> <button class=${we({\"select-trigger\":!0,\"select-trigger--open\":this._isOpen,\"select-trigger--invalid\":this._touched&&this.required&&!this.value})} type=\"button\" ?disabled=${this.disabled} aria-haspopup=\"listbox\" aria-expanded=${this._isOpen} @click=${this._toggle} @blur=${this._handleBlur} > <span class=${we({\"select-value\":!0,\"select-placeholder\":!t})}> ${t||this.placeholder} </span> <svg class=${we({\"chevron-icon\":!0,\"select-icon\":!0,\"select-icon--open\":this._isOpen})} viewBox=\"0 0 20 20\" fill=\"currentColor\" > <path fill-rule=\"evenodd\" d=\"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z\" clip-rule=\"evenodd\" /> </svg> </button> <div class=${we({\"select-dropdown\":!0,hidden:!this._isOpen})} role=\"listbox\"> <div class=\"select-options\"> ${0===e.length?U`<div class=\"select-empty\">No options available</div>`:e.map((e,t)=>{const i=e.value===this.value;return U` <div class=${we({\"select-option\":!0,\"select-option--selected\":i,\"select-option--disabled\":e.disabled,\"select-option--highlighted\":t===this._highlightedIndex})} role=\"option\" aria-selected=${i} @click=${()=>this._selectOption(e)} @mouseenter=${()=>this._highlightedIndex=t} > ${e.label} ${i?U`<svg class=\"chevron-icon select-check\" viewBox=\"0 0 20 20\" fill=\"currentColor\"> <path fill-rule=\"evenodd\" d=\"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z\" clip-rule=\"evenodd\" /> </svg>`:V} </div> `})} </div> </div> </div> ${this._touched&&this.required&&!this.value?U`<div class=\"validation-message\">Please select an option</div>`:this.hint?U`<div class=\"hint\">${this.hint}</div>`:\"\"} </div> <div class=\"options-slot\"> <slot @slotchange=${()=>this.requestUpdate()}></slot> </div> `}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}}"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"kind": "variable",
|
|
548
|
+
"name": "nt",
|
|
549
|
+
"default": "class extends ne{constructor(){super(...arguments),this.value=\"\",this.disabled=!1}get label(){return this.textContent?.trim()||\"\"}render(){return U`<slot></slot>`}}"
|
|
524
550
|
}
|
|
525
551
|
],
|
|
526
552
|
"exports": [
|
|
@@ -544,7 +570,7 @@
|
|
|
544
570
|
"kind": "js",
|
|
545
571
|
"name": "DialogRef",
|
|
546
572
|
"declaration": {
|
|
547
|
-
"name": "
|
|
573
|
+
"name": "Me",
|
|
548
574
|
"module": "dist/krubble.bundled.min.js"
|
|
549
575
|
}
|
|
550
576
|
},
|
|
@@ -552,7 +578,7 @@
|
|
|
552
578
|
"kind": "js",
|
|
553
579
|
"name": "KRAccordion",
|
|
554
580
|
"declaration": {
|
|
555
|
-
"name": "
|
|
581
|
+
"name": "be",
|
|
556
582
|
"module": "dist/krubble.bundled.min.js"
|
|
557
583
|
}
|
|
558
584
|
},
|
|
@@ -560,7 +586,7 @@
|
|
|
560
586
|
"kind": "js",
|
|
561
587
|
"name": "KRAlert",
|
|
562
588
|
"declaration": {
|
|
563
|
-
"name": "
|
|
589
|
+
"name": "Ce",
|
|
564
590
|
"module": "dist/krubble.bundled.min.js"
|
|
565
591
|
}
|
|
566
592
|
},
|
|
@@ -568,7 +594,7 @@
|
|
|
568
594
|
"kind": "js",
|
|
569
595
|
"name": "KRButton",
|
|
570
596
|
"declaration": {
|
|
571
|
-
"name": "
|
|
597
|
+
"name": "Ee",
|
|
572
598
|
"module": "dist/krubble.bundled.min.js"
|
|
573
599
|
}
|
|
574
600
|
},
|
|
@@ -576,7 +602,7 @@
|
|
|
576
602
|
"kind": "js",
|
|
577
603
|
"name": "KRCodeDemo",
|
|
578
604
|
"declaration": {
|
|
579
|
-
"name": "
|
|
605
|
+
"name": "ze",
|
|
580
606
|
"module": "dist/krubble.bundled.min.js"
|
|
581
607
|
}
|
|
582
608
|
},
|
|
@@ -584,7 +610,7 @@
|
|
|
584
610
|
"kind": "js",
|
|
585
611
|
"name": "KRContextMenu",
|
|
586
612
|
"declaration": {
|
|
587
|
-
"name": "
|
|
613
|
+
"name": "Le",
|
|
588
614
|
"module": "dist/krubble.bundled.min.js"
|
|
589
615
|
}
|
|
590
616
|
},
|
|
@@ -592,7 +618,7 @@
|
|
|
592
618
|
"kind": "js",
|
|
593
619
|
"name": "KRDialog",
|
|
594
620
|
"declaration": {
|
|
595
|
-
"name": "
|
|
621
|
+
"name": "De",
|
|
596
622
|
"module": "dist/krubble.bundled.min.js"
|
|
597
623
|
}
|
|
598
624
|
},
|
|
@@ -600,7 +626,7 @@
|
|
|
600
626
|
"kind": "js",
|
|
601
627
|
"name": "KRSelect",
|
|
602
628
|
"declaration": {
|
|
603
|
-
"name": "
|
|
629
|
+
"name": "st",
|
|
604
630
|
"module": "dist/krubble.bundled.min.js"
|
|
605
631
|
}
|
|
606
632
|
},
|
|
@@ -608,7 +634,7 @@
|
|
|
608
634
|
"kind": "js",
|
|
609
635
|
"name": "KRSelectOption",
|
|
610
636
|
"declaration": {
|
|
611
|
-
"name": "
|
|
637
|
+
"name": "nt",
|
|
612
638
|
"module": "dist/krubble.bundled.min.js"
|
|
613
639
|
}
|
|
614
640
|
},
|
|
@@ -616,7 +642,7 @@
|
|
|
616
642
|
"kind": "js",
|
|
617
643
|
"name": "KRSnackbar",
|
|
618
644
|
"declaration": {
|
|
619
|
-
"name": "
|
|
645
|
+
"name": "Ie",
|
|
620
646
|
"module": "dist/krubble.bundled.min.js"
|
|
621
647
|
}
|
|
622
648
|
},
|
|
@@ -624,7 +650,7 @@
|
|
|
624
650
|
"kind": "js",
|
|
625
651
|
"name": "KRTab",
|
|
626
652
|
"declaration": {
|
|
627
|
-
"name": "
|
|
653
|
+
"name": "We",
|
|
628
654
|
"module": "dist/krubble.bundled.min.js"
|
|
629
655
|
}
|
|
630
656
|
},
|
|
@@ -632,7 +658,15 @@
|
|
|
632
658
|
"kind": "js",
|
|
633
659
|
"name": "KRTabGroup",
|
|
634
660
|
"declaration": {
|
|
635
|
-
"name": "
|
|
661
|
+
"name": "Ve",
|
|
662
|
+
"module": "dist/krubble.bundled.min.js"
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"kind": "js",
|
|
667
|
+
"name": "KRTable",
|
|
668
|
+
"declaration": {
|
|
669
|
+
"name": "Ye",
|
|
636
670
|
"module": "dist/krubble.bundled.min.js"
|
|
637
671
|
}
|
|
638
672
|
},
|
|
@@ -640,7 +674,7 @@
|
|
|
640
674
|
"kind": "js",
|
|
641
675
|
"name": "KRTextField",
|
|
642
676
|
"declaration": {
|
|
643
|
-
"name": "
|
|
677
|
+
"name": "it",
|
|
644
678
|
"module": "dist/krubble.bundled.min.js"
|
|
645
679
|
}
|
|
646
680
|
},
|
|
@@ -648,7 +682,7 @@
|
|
|
648
682
|
"kind": "js",
|
|
649
683
|
"name": "krBaseCSS",
|
|
650
684
|
"declaration": {
|
|
651
|
-
"name": "
|
|
685
|
+
"name": "ae",
|
|
652
686
|
"module": "dist/krubble.bundled.min.js"
|
|
653
687
|
}
|
|
654
688
|
}
|
|
@@ -768,6 +802,14 @@
|
|
|
768
802
|
"module": "./button/button.js"
|
|
769
803
|
}
|
|
770
804
|
},
|
|
805
|
+
{
|
|
806
|
+
"kind": "js",
|
|
807
|
+
"name": "KRButtonOption",
|
|
808
|
+
"declaration": {
|
|
809
|
+
"name": "KRButtonOption",
|
|
810
|
+
"module": "./button/button.js"
|
|
811
|
+
}
|
|
812
|
+
},
|
|
771
813
|
{
|
|
772
814
|
"kind": "js",
|
|
773
815
|
"name": "KRCodeDemo",
|
|
@@ -824,6 +866,46 @@
|
|
|
824
866
|
"module": "./tabs/tab.js"
|
|
825
867
|
}
|
|
826
868
|
},
|
|
869
|
+
{
|
|
870
|
+
"kind": "js",
|
|
871
|
+
"name": "KRTable",
|
|
872
|
+
"declaration": {
|
|
873
|
+
"name": "KRTable",
|
|
874
|
+
"module": "./table/table.js"
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
"kind": "js",
|
|
879
|
+
"name": "KRTableDef",
|
|
880
|
+
"declaration": {
|
|
881
|
+
"name": "KRTableDef",
|
|
882
|
+
"module": "./table/table.js"
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
"kind": "js",
|
|
887
|
+
"name": "KRTableColumn",
|
|
888
|
+
"declaration": {
|
|
889
|
+
"name": "KRTableColumn",
|
|
890
|
+
"module": "./table/table.js"
|
|
891
|
+
}
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
"kind": "js",
|
|
895
|
+
"name": "KRTableAction",
|
|
896
|
+
"declaration": {
|
|
897
|
+
"name": "KRTableAction",
|
|
898
|
+
"module": "./table/table.js"
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
"kind": "js",
|
|
903
|
+
"name": "KRTableDataSource",
|
|
904
|
+
"declaration": {
|
|
905
|
+
"name": "KRTableDataSource",
|
|
906
|
+
"module": "./table/table.js"
|
|
907
|
+
}
|
|
908
|
+
},
|
|
827
909
|
{
|
|
828
910
|
"kind": "js",
|
|
829
911
|
"name": "KRTextField",
|
|
@@ -906,88 +988,66 @@
|
|
|
906
988
|
},
|
|
907
989
|
{
|
|
908
990
|
"kind": "javascript-module",
|
|
909
|
-
"path": "dist/
|
|
910
|
-
"declarations": [
|
|
911
|
-
{
|
|
912
|
-
"kind": "variable",
|
|
913
|
-
"name": "KRAlert",
|
|
914
|
-
"default": "class KRAlert extends LitElement { constructor() { super(...arguments); /** * The alert type/severity */ this.type = 'info'; /** * Whether the alert can be dismissed */ this.dismissible = false; /** * Whether the alert is visible */ this.visible = true; } /** Handles dismiss button click */ _handleDismiss() { this.visible = false; this.dispatchEvent(new CustomEvent('dismiss', { bubbles: true, composed: true })); } render() { const icons = { info: html `<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\" clip-rule=\"evenodd\"/></svg>`, success: html `<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clip-rule=\"evenodd\"/></svg>`, warning: html `<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clip-rule=\"evenodd\"/></svg>`, error: html `<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clip-rule=\"evenodd\"/></svg>`, }; return html ` <div class=${classMap({ 'alert': true, ['alert--' + this.type]: true, 'alert--hidden': !this.visible })} role=\"alert\" > ${icons[this.type]} <div class=\"content\"> ${this.header ? html `<h4 class=\"header\">${this.header}</h4>` : nothing} <div class=\"message\"> <slot></slot> </div> </div> ${this.dismissible ? html ` <button class=\"dismiss\" type=\"button\" aria-label=\"Dismiss alert\" @click=${this._handleDismiss} > <svg viewBox=\"0 0 20 20\" fill=\"currentColor\" width=\"16\" height=\"16\"> <path fill-rule=\"evenodd\" d=\"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z\" clip-rule=\"evenodd\"/> </svg> </button> ` : nothing} </div> `; } }",
|
|
915
|
-
"description": "A customizable alert component for displaying important information to users."
|
|
916
|
-
}
|
|
917
|
-
],
|
|
918
|
-
"exports": [
|
|
919
|
-
{
|
|
920
|
-
"kind": "js",
|
|
921
|
-
"name": "KRAlert",
|
|
922
|
-
"declaration": {
|
|
923
|
-
"name": "KRAlert",
|
|
924
|
-
"module": "dist/alert/alert.js"
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
]
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
"kind": "javascript-module",
|
|
931
|
-
"path": "dist/code-demo/code-demo.js",
|
|
991
|
+
"path": "dist/button/button.js",
|
|
932
992
|
"declarations": [
|
|
933
993
|
{
|
|
934
994
|
"kind": "variable",
|
|
935
|
-
"name": "
|
|
936
|
-
"default": "class
|
|
937
|
-
"description": "
|
|
995
|
+
"name": "KRButton",
|
|
996
|
+
"default": "class KRButton extends LitElement { constructor() { super(...arguments); /** * The button variant (shape) */ this.variant = 'flat'; /** * The button color */ this.color = 'primary'; /** * The button size */ this.size = 'medium'; /** * Whether the button is disabled */ this.disabled = false; /** * Dropdown options - when provided, button becomes a dropdown */ this.options = []; this._state = 'idle'; this._stateText = ''; this._dropdownOpened = false; this._dropdownAlignRight = false; this._handleHostClick = (e) => { if (this.options.length) { e.stopPropagation(); this._toggleDropdown(); } }; this._handleKeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); if (this.options.length) { this._toggleDropdown(); } else { this.click(); } } if (e.key === 'Escape' && this._dropdownOpened) { this._dropdownOpened = false; } }; this._handleClickOutside = (e) => { if (this._dropdownOpened && !this.contains(e.target)) { this._dropdownOpened = false; } }; } connectedCallback() { super.connectedCallback(); this.setAttribute('role', 'button'); this.setAttribute('tabindex', '0'); this.addEventListener('keydown', this._handleKeydown); this.addEventListener('click', this._handleHostClick); document.addEventListener('click', this._handleClickOutside); } disconnectedCallback() { super.disconnectedCallback(); this.removeEventListener('keydown', this._handleKeydown); this.removeEventListener('click', this._handleHostClick); document.removeEventListener('click', this._handleClickOutside); } _toggleDropdown() { this._dropdownOpened = !this._dropdownOpened; if (this._dropdownOpened) { // Check if dropdown would overflow viewport after render requestAnimationFrame(() => { const dropdown = this.shadowRoot?.querySelector('.dropdown'); if (dropdown) { const rect = dropdown.getBoundingClientRect(); this._dropdownAlignRight = rect.right > window.innerWidth; } }); } } _handleOptionClick(option, e) { e.stopPropagation(); this._dropdownOpened = false; this.dispatchEvent(new CustomEvent('option-select', { detail: { id: option.id, label: option.label }, bubbles: true, composed: true })); } /** * Shows a loading spinner and disables the button. */ showLoading() { this._clearStateTimeout(); this._state = 'loading'; this._stateText = ''; } /** * Shows a success state with optional custom text. * @param text - Text to display (default: \"Saved\") * @param duration - Duration in ms before auto-reset (default: 2000) */ showSuccess(text = 'Success', duration = 2000) { this._clearStateTimeout(); this._state = 'success'; this._stateText = text; this._stateTimeout = window.setTimeout(() => this.reset(), duration); } /** * Shows an error state with optional custom text. * @param text - Text to display (default: \"Error\") * @param duration - Duration in ms before auto-reset (default: 2000) */ showError(text = 'Error', duration = 2000) { this._clearStateTimeout(); this._state = 'error'; this._stateText = text; this._stateTimeout = window.setTimeout(() => this.reset(), duration); } /** * Resets the button to its idle state. */ reset() { this._clearStateTimeout(); this._state = 'idle'; this._stateText = ''; } _clearStateTimeout() { if (this._stateTimeout) { clearTimeout(this._stateTimeout); this._stateTimeout = undefined; } } updated(changedProperties) { // Reflect state classes to host this.classList.toggle('kr-button--loading', this._state === 'loading'); this.classList.toggle('kr-button--success', this._state === 'success'); this.classList.toggle('kr-button--error', this._state === 'error'); this.classList.toggle(`kr-button--${this.variant}`, true); this.classList.toggle(`kr-button--${this.color}`, true); this.classList.toggle('kr-button--small', this.size === 'small'); this.classList.toggle('kr-button--large', this.size === 'large'); } render() { return html ` <slot></slot> ${this.options.length ? html `<svg class=\"caret\" xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z\"/></svg>` : nothing} ${this._state !== 'idle' ? html `<span class=\"state-overlay\"> ${this._state === 'loading' ? html `<span class=\"spinner\"></span>` : this._stateText} </span>` : nothing} ${this.options.length ? html ` <div class=\"dropdown ${this._dropdownOpened ? 'dropdown--opened' : ''} ${this._dropdownAlignRight ? 'dropdown--align-right' : ''}\"> ${this.options.map(option => html ` <button class=\"dropdown-item\" @click=${(e) => this._handleOptionClick(option, e)} >${option.label}</button> `)} </div> ` : nothing} `; } }",
|
|
997
|
+
"description": "A customizable button component."
|
|
938
998
|
}
|
|
939
999
|
],
|
|
940
1000
|
"exports": [
|
|
941
1001
|
{
|
|
942
1002
|
"kind": "js",
|
|
943
|
-
"name": "
|
|
1003
|
+
"name": "KRButton",
|
|
944
1004
|
"declaration": {
|
|
945
|
-
"name": "
|
|
946
|
-
"module": "dist/
|
|
1005
|
+
"name": "KRButton",
|
|
1006
|
+
"module": "dist/button/button.js"
|
|
947
1007
|
}
|
|
948
1008
|
}
|
|
949
1009
|
]
|
|
950
1010
|
},
|
|
951
1011
|
{
|
|
952
1012
|
"kind": "javascript-module",
|
|
953
|
-
"path": "dist/
|
|
1013
|
+
"path": "dist/alert/alert.js",
|
|
954
1014
|
"declarations": [
|
|
955
1015
|
{
|
|
956
1016
|
"kind": "variable",
|
|
957
|
-
"name": "
|
|
958
|
-
"default": "class
|
|
959
|
-
"description": "A customizable
|
|
1017
|
+
"name": "KRAlert",
|
|
1018
|
+
"default": "class KRAlert extends LitElement { constructor() { super(...arguments); /** * The alert type/severity */ this.type = 'info'; /** * Whether the alert can be dismissed */ this.dismissible = false; /** * Whether the alert is visible */ this.visible = true; } /** Handles dismiss button click */ _handleDismiss() { this.visible = false; this.dispatchEvent(new CustomEvent('dismiss', { bubbles: true, composed: true })); } render() { const icons = { info: html `<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\" clip-rule=\"evenodd\"/></svg>`, success: html `<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clip-rule=\"evenodd\"/></svg>`, warning: html `<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clip-rule=\"evenodd\"/></svg>`, error: html `<svg class=\"icon\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clip-rule=\"evenodd\"/></svg>`, }; return html ` <div class=${classMap({ 'alert': true, ['alert--' + this.type]: true, 'alert--hidden': !this.visible })} role=\"alert\" > ${icons[this.type]} <div class=\"content\"> ${this.header ? html `<h4 class=\"header\">${this.header}</h4>` : nothing} <div class=\"message\"> <slot></slot> </div> </div> ${this.dismissible ? html ` <button class=\"dismiss\" type=\"button\" aria-label=\"Dismiss alert\" @click=${this._handleDismiss} > <svg viewBox=\"0 0 20 20\" fill=\"currentColor\" width=\"16\" height=\"16\"> <path fill-rule=\"evenodd\" d=\"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z\" clip-rule=\"evenodd\"/> </svg> </button> ` : nothing} </div> `; } }",
|
|
1019
|
+
"description": "A customizable alert component for displaying important information to users."
|
|
960
1020
|
}
|
|
961
1021
|
],
|
|
962
1022
|
"exports": [
|
|
963
1023
|
{
|
|
964
1024
|
"kind": "js",
|
|
965
|
-
"name": "
|
|
1025
|
+
"name": "KRAlert",
|
|
966
1026
|
"declaration": {
|
|
967
|
-
"name": "
|
|
968
|
-
"module": "dist/
|
|
1027
|
+
"name": "KRAlert",
|
|
1028
|
+
"module": "dist/alert/alert.js"
|
|
969
1029
|
}
|
|
970
1030
|
}
|
|
971
1031
|
]
|
|
972
1032
|
},
|
|
973
1033
|
{
|
|
974
1034
|
"kind": "javascript-module",
|
|
975
|
-
"path": "dist/
|
|
1035
|
+
"path": "dist/code-demo/code-demo.js",
|
|
976
1036
|
"declarations": [
|
|
977
1037
|
{
|
|
978
1038
|
"kind": "variable",
|
|
979
|
-
"name": "
|
|
980
|
-
"default": "class
|
|
981
|
-
"description": "
|
|
1039
|
+
"name": "KRCodeDemo",
|
|
1040
|
+
"default": "class KRCodeDemo extends LitElement { constructor() { super(...arguments); this.language = 'html'; this.code = ''; this.activeTab = 'preview'; this.copied = false; } setTab(tab) { this.activeTab = tab; } getHighlightedCode() { if (!this.code) return ''; if (window.Prism && window.Prism.languages[this.language]) { return window.Prism.highlight(this.code, window.Prism.languages[this.language], this.language); } // Fallback: escape HTML and return plain text return this.escapeHtml(this.code); } escapeHtml(text) { const div = document.createElement('div'); div.textContent = text; return div.innerHTML; } async copyCode() { if (!this.code) return; try { await navigator.clipboard.writeText(this.code); this.copied = true; setTimeout(() => { this.copied = false; }, 2000); } catch (err) { console.error('Failed to copy code:', err); } } render() { return html ` <div class=\"tabs\"> <button class=${classMap({ tab: true, 'tab--active': this.activeTab === 'preview' })} @click=${() => this.setTab('preview')} > Preview </button> <button class=${classMap({ tab: true, 'tab--active': this.activeTab === 'code' })} @click=${() => this.setTab('code')} > Code </button> </div> <div class=${classMap({ panel: true, 'panel--active': this.activeTab === 'preview', preview: true })}> <slot name=\"preview\"></slot> </div> <div class=${classMap({ panel: true, 'panel--active': this.activeTab === 'code', 'code-container': true })}> <button class=${classMap({ 'copy-btn': true, 'copy-btn--copied': this.copied })} @click=${this.copyCode} > ${this.copied ? 'Copied!' : 'Copy'} </button> <pre class=\"code\"><code>${unsafeHTML(this.getHighlightedCode())}</code></pre> </div> `; } }",
|
|
1041
|
+
"description": "Code demo component with Preview/Code tabs and syntax highlighting.\n\nUsage:\n```html\n<kr-code-demo language=\"html\">\n <div slot=\"preview\">\n <kr-button>Click me</kr-button>\n </div>\n <script slot=\"code\" type=\"text/plain\">\n <kr-button>Click me</kr-button>\n </script>\n</kr-code-demo>\n```\n\nRequires Prism.js to be loaded globally for syntax highlighting."
|
|
982
1042
|
}
|
|
983
1043
|
],
|
|
984
1044
|
"exports": [
|
|
985
1045
|
{
|
|
986
1046
|
"kind": "js",
|
|
987
|
-
"name": "
|
|
1047
|
+
"name": "KRCodeDemo",
|
|
988
1048
|
"declaration": {
|
|
989
|
-
"name": "
|
|
990
|
-
"module": "dist/
|
|
1049
|
+
"name": "KRCodeDemo",
|
|
1050
|
+
"module": "dist/code-demo/code-demo.js"
|
|
991
1051
|
}
|
|
992
1052
|
}
|
|
993
1053
|
]
|
|
@@ -1063,6 +1123,28 @@
|
|
|
1063
1123
|
}
|
|
1064
1124
|
]
|
|
1065
1125
|
},
|
|
1126
|
+
{
|
|
1127
|
+
"kind": "javascript-module",
|
|
1128
|
+
"path": "dist/context-menu/context-menu.js",
|
|
1129
|
+
"declarations": [
|
|
1130
|
+
{
|
|
1131
|
+
"kind": "variable",
|
|
1132
|
+
"name": "KRContextMenu",
|
|
1133
|
+
"default": "class KRContextMenu extends LitElement { constructor() { super(...arguments); this.items = []; this.resolvePromise = null; this.boundHandleOutsideClick = this.handleOutsideClick.bind(this); this.boundHandleKeyDown = this.handleKeyDown.bind(this); } static async open(options) { // Remove any existing context menu const existing = document.querySelector('kr-context-menu'); if (existing) { existing.remove(); } // Create and position the menu const menu = document.createElement('kr-context-menu'); document.body.appendChild(menu); return menu.show(options); } async show(options) { this.items = options.items; this.style.left = `${options.x}px`; this.style.top = `${options.y}px`; // Adjust position if menu would go off screen await this.updateComplete; const rect = this.getBoundingClientRect(); if (rect.right > window.innerWidth) { this.style.left = `${options.x - rect.width}px`; } if (rect.bottom > window.innerHeight) { this.style.top = `${options.y - rect.height}px`; } // Add event listeners after a microtask to avoid the current event triggering close requestAnimationFrame(() => { document.addEventListener('click', this.boundHandleOutsideClick); document.addEventListener('contextmenu', this.boundHandleOutsideClick); document.addEventListener('keydown', this.boundHandleKeyDown); }); return new Promise((resolve) => { this.resolvePromise = resolve; }); } handleOutsideClick(e) { if (!this.contains(e.target)) { this.close(null); } } handleKeyDown(e) { if (e.key === 'Escape') { this.close(null); } } handleItemClick(item) { if (!item.disabled && !item.divider) { this.close(item); } } close(result) { document.removeEventListener('click', this.boundHandleOutsideClick); document.removeEventListener('contextmenu', this.boundHandleOutsideClick); document.removeEventListener('keydown', this.boundHandleKeyDown); if (this.resolvePromise) { this.resolvePromise(result); this.resolvePromise = null; } this.remove(); } render() { return html ` <div class=\"menu\"> ${this.items.map(item => item.divider ? html `<div class=\"menu__divider\"></div>` : html ` <button class=\"menu__item\" ?disabled=${item.disabled} @click=${() => this.handleItemClick(item)} > ${item.icon ? html `<span class=\"menu__item-icon\">${item.icon}</span>` : null} ${item.label} </button> `)} </div> `; } }",
|
|
1134
|
+
"description": "Context menu component that can be opened programmatically.\n\nUsage:\n```ts\nconst result = await ContextMenu.open({\n x: event.clientX,\n y: event.clientY,\n items: [\n { id: 'edit', label: 'Edit Item' },\n { id: 'divider', label: '', divider: true },\n { id: 'add-above', label: 'Add Item Above' },\n { id: 'add-below', label: 'Add Item Below' },\n ]\n});\n\nif (result) {\n console.log('Selected:', result.id);\n}\n```"
|
|
1135
|
+
}
|
|
1136
|
+
],
|
|
1137
|
+
"exports": [
|
|
1138
|
+
{
|
|
1139
|
+
"kind": "js",
|
|
1140
|
+
"name": "KRContextMenu",
|
|
1141
|
+
"declaration": {
|
|
1142
|
+
"name": "KRContextMenu",
|
|
1143
|
+
"module": "dist/context-menu/context-menu.js"
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
]
|
|
1147
|
+
},
|
|
1066
1148
|
{
|
|
1067
1149
|
"kind": "javascript-module",
|
|
1068
1150
|
"path": "dist/form/index.js",
|
|
@@ -1137,6 +1219,27 @@
|
|
|
1137
1219
|
}
|
|
1138
1220
|
]
|
|
1139
1221
|
},
|
|
1222
|
+
{
|
|
1223
|
+
"kind": "javascript-module",
|
|
1224
|
+
"path": "dist/table/table.js",
|
|
1225
|
+
"declarations": [
|
|
1226
|
+
{
|
|
1227
|
+
"kind": "variable",
|
|
1228
|
+
"name": "KRTable",
|
|
1229
|
+
"default": "class KRTable extends LitElement { constructor() { super(...arguments); /** * Internal flag to switch between scroll edge modes: * - 'overlay': Fixed padding with overlay elements that hide content at edges (scrollbar at viewport edge) * - 'edge': Padding scrolls with content, allowing table to reach edges when scrolling */ this._scrollStyle = 'overlay'; this._data = []; this._dataState = 'idle'; this._page = 1; this._pageSize = 50; this._totalItems = 0; this._totalPages = 0; this._searchQuery = ''; this._canScrollLeft = false; this._canScrollRight = false; this._canScrollHorizontal = false; this._columnPickerOpen = false; this._displayedColumns = []; this._widthsLocked = false; this._resizing = null; this._resizeObserver = null; this._searchPositionLocked = false; this._def = { columns: [] }; this.def = { columns: [] }; this._handleClickOutsideColumnPicker = (e) => { if (!this._columnPickerOpen) return; const path = e.composedPath(); const picker = this.shadowRoot?.querySelector('.column-picker-wrapper'); if (picker && !path.includes(picker)) { this._columnPickerOpen = false; } }; this._handleResizeMove = (e) => { if (!this._resizing) return; const col = this._def.columns.find(c => c.id === this._resizing.columnId); if (col) { const newWidth = this._resizing.startWidth + (e.clientX - this._resizing.startX); col.width = `${Math.min(900, Math.max(50, newWidth))}px`; this.requestUpdate(); } }; this._handleResizeEnd = () => { this._resizing = null; document.removeEventListener('mousemove', this._handleResizeMove); document.removeEventListener('mouseup', this._handleResizeEnd); }; } connectedCallback() { super.connectedCallback(); this.classList.toggle('kr-table--scroll-overlay', this._scrollStyle === 'overlay'); this.classList.toggle('kr-table--scroll-edge', this._scrollStyle === 'edge'); this._fetch(); this._initRefresh(); document.addEventListener('click', this._handleClickOutsideColumnPicker); this._resizeObserver = new ResizeObserver(() => { // Unlock and recalculate on resize since layout changes this._searchPositionLocked = false; this._updateSearchPosition(); }); this._resizeObserver.observe(this); } disconnectedCallback() { super.disconnectedCallback(); clearInterval(this._refreshTimer); document.removeEventListener('click', this._handleClickOutsideColumnPicker); this._resizeObserver?.disconnect(); } willUpdate(changedProperties) { if (changedProperties.has('def')) { // Copy user's def and normalize action columns this._def = { ...this.def, columns: this.def.columns.map(col => { if (col.type === 'actions') { return { ...col, sticky: 'right', resizable: false }; } return { ...col }; }) }; this._displayedColumns = this._def.displayedColumns || this._def.columns.map(c => c.id); this._widthsLocked = false; this.classList.remove('kr-table--widths-locked'); this._fetch(); this._initRefresh(); } } updated(changedProperties) { this._updateScrollFlags(); } // ---------------------------------------------------------------------------- // Public Interface // ---------------------------------------------------------------------------- refresh() { this._fetch(); } goToPrevPage() { if (this._page > 1) { this._page--; this._fetch(); } } goToNextPage() { if (this._page < this._totalPages) { this._page++; this._fetch(); } } goToPage(page) { if (page >= 1 && page <= this._totalPages) { this._page = page; this._fetch(); } } // ---------------------------------------------------------------------------- // Data Fetching // ---------------------------------------------------------------------------- /** * Fetches data from the API and updates the table. * Shows a loading spinner while fetching, then displays rows on success * or an error snackbar on failure. * Request/response format depends on dataSource.mode (solr, opensearch, db). */ _fetch() { if (!this._def.dataSource) return; this._dataState = 'loading'; // Build request based on mode let request; switch (this._def.dataSource.mode) { case 'opensearch': throw Error('Opensearch not supported yet'); case 'db': throw Error('DB not supported yet'); default: // solr request = { page: this._page - 1, size: this._pageSize, sorts: [], filterFields: [], queryFields: [], facetFields: [] }; if (this._searchQuery?.trim().length) { request.queryFields.push({ name: '_text_', operation: 'IS', value: escapeSolrQuery(this._searchQuery) }); } } this._def.dataSource.fetch(request) .then(response => { // Parse response based on mode switch (this._def.dataSource?.mode) { case 'opensearch': { throw Error('Opensearch not supported yet'); break; } case 'db': { throw Error('DB not supported yet'); break; } default: { // solr const res = response; this._data = res.data.content; this._totalItems = res.data.totalElements; this._totalPages = res.data.totalPages; this._pageSize = res.data.size; } } this._dataState = 'success'; this._updateSearchPosition(); if (!this._widthsLocked) this._lockColumnWidths(); }) .catch(err => { this._dataState = 'error'; KRSnackbar.show({ message: err instanceof Error ? err.message : 'Failed to load data', type: 'error' }); }); } /** * Sets up auto-refresh so the table automatically fetches fresh data * at a regular interval (useful for dashboards, monitoring views). * Configured via def.refreshInterval in milliseconds. */ _initRefresh() { clearInterval(this._refreshTimer); if (this._def.refreshInterval && this._def.refreshInterval > 0) { this._refreshTimer = window.setInterval(() => { this._fetch(); }, this._def.refreshInterval); } } _handleSearch(e) { const input = e.target; this._searchQuery = input.value; this._page = 1; this._fetch(); } _measureTextWidth(text, font) { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); ctx.font = font; return ctx.measureText(text).width; } _lockColumnWidths() { this.updateComplete.then(() => { requestAnimationFrame(() => { const headerCell = this.shadowRoot?.querySelector('.header-cell'); const dataCell = this.shadowRoot?.querySelector('.cell'); if (!headerCell) return; const headerStyle = getComputedStyle(headerCell); const headerFont = `${headerStyle.fontWeight} ${headerStyle.fontSize} ${headerStyle.fontFamily}`; const headerPadding = parseFloat(headerStyle.paddingLeft) + parseFloat(headerStyle.paddingRight); const dataStyle = dataCell ? getComputedStyle(dataCell) : headerStyle; const dataFont = `${dataStyle.fontWeight} ${dataStyle.fontSize} ${dataStyle.fontFamily}`; const dataPadding = dataCell ? parseFloat(dataStyle.paddingLeft) + parseFloat(dataStyle.paddingRight) : headerPadding; this.getDisplayedColumns().forEach(col => { if (!col.width) { let width; // For columns with custom render functions, measure the actual DOM element if (col.render) { const cell = this.shadowRoot?.querySelector(`.cell[data-column-id=\"${col.id}\"]`); width = cell ? cell.scrollWidth : 150; } else { const headerText = col.label ?? col.id; const headerWidth = this._measureTextWidth(headerText, headerFont) + headerPadding; let maxDataWidth = 0; for (const row of this._data) { const value = row[col.id]; if (value != null) { const dataWidth = this._measureTextWidth(String(value), dataFont) + dataPadding; if (dataWidth > maxDataWidth) maxDataWidth = dataWidth; } } width = Math.ceil(Math.max(headerWidth, maxDataWidth)); } col.width = `${Math.max(width, 150)}px`; } }); this._widthsLocked = true; this.classList.add('kr-table--widths-locked'); this.requestUpdate(); }); }); } /** * Updates search position to be centered with equal gaps from title and tools. * On first call: resets to flex centering, measures position, then locks with fixed margin. * Subsequent calls are ignored unless _searchPositionLocked is reset (e.g., on resize). */ _updateSearchPosition() { // Skip if already locked (prevents shifts on pagination changes) if (this._searchPositionLocked) return; const search = this.shadowRoot?.querySelector('.search'); const searchField = search?.querySelector('.search-field'); if (!search || !searchField) return; // Reset to flex centering search.style.justifyContent = 'center'; searchField.style.marginLeft = ''; requestAnimationFrame(() => { const searchRect = search.getBoundingClientRect(); const fieldRect = searchField.getBoundingClientRect(); // Calculate how far from the left of search container the field currently is const currentOffset = fieldRect.left - searchRect.left; // Lock position: switch to flex-start and use fixed margin search.style.justifyContent = 'flex-start'; searchField.style.marginLeft = `${currentOffset}px`; // Mark as locked so pagination changes don't shift the search this._searchPositionLocked = true; }); } // ---------------------------------------------------------------------------- // Columns // ---------------------------------------------------------------------------- _toggleColumnPicker() { this._columnPickerOpen = !this._columnPickerOpen; } _toggleColumn(columnId) { if (this._displayedColumns.includes(columnId)) { this._displayedColumns = this._displayedColumns.filter(id => id !== columnId); } else { this._displayedColumns = [...this._displayedColumns, columnId]; } } // When a user toggles a column on via the column picker, it gets appended // to _displayedColumns. By mapping over _displayedColumns (not def.columns), // the new column appears at the right edge of the table instead of jumping // back to its original position in the column definition. // Actions columns are always moved to the end. getDisplayedColumns() { return this._displayedColumns .map(id => this._def.columns.find(col => col.id === id)) .sort((a, b) => { if (a.type === 'actions' && b.type !== 'actions') return 1; if (a.type !== 'actions' && b.type === 'actions') return -1; return 0; }); } // ---------------------------------------------------------------------------- // Scrolling // ---------------------------------------------------------------------------- /** * Scroll event handler that updates scroll flags in real-time as user scrolls. * Updates shadow indicators to show if more content exists left/right. */ _handleScroll(e) { const container = e.target; this._canScrollLeft = container.scrollLeft > 0; this._canScrollRight = container.scrollLeft < container.scrollWidth - container.clientWidth - 1; } /** * Updates scroll state flags for the table content container. * - _canScrollLeft: true if scrolled right (can scroll back left) * - _canScrollRight: true if more content exists to the right * - _canScrollHorizontal: true if content is wider than container * These flags control scroll shadow indicators and CSS classes. */ _updateScrollFlags() { const container = this.shadowRoot?.querySelector('.content'); if (container) { this._canScrollLeft = container.scrollLeft > 0; this._canScrollRight = container.scrollWidth > container.clientWidth && container.scrollLeft < container.scrollWidth - container.clientWidth - 1; this._canScrollHorizontal = container.scrollWidth > container.clientWidth; } this.classList.toggle('kr-table--scroll-left-available', this._canScrollLeft); this.classList.toggle('kr-table--scroll-right-available', this._canScrollRight); this.classList.toggle('kr-table--scroll-horizontal-available', this._canScrollHorizontal); this.classList.toggle('kr-table--sticky-left', this.getDisplayedColumns().some(c => c.sticky === 'left')); this.classList.toggle('kr-table--sticky-right', this.getDisplayedColumns().some(c => c.sticky === 'right')); } // ---------------------------------------------------------------------------- // Column Resizing // ---------------------------------------------------------------------------- _handleResizeStart(e, columnId) { e.preventDefault(); const headerCell = this.shadowRoot?.querySelector(`.header-cell[data-column-id=\"${columnId}\"]`); this._resizing = { columnId, startX: e.clientX, startWidth: headerCell?.offsetWidth || 200 }; document.addEventListener('mousemove', this._handleResizeMove); document.addEventListener('mouseup', this._handleResizeEnd); } // ---------------------------------------------------------------------------- // Header // ---------------------------------------------------------------------------- _handleAction(action) { this.dispatchEvent(new CustomEvent('action', { detail: { action: action.id }, bubbles: true, composed: true })); } // ---------------------------------------------------------------------------- // Rendering // ---------------------------------------------------------------------------- _renderCellContent(column, row) { const value = row[column.id]; if (column.render) { const result = column.render(row); // If render returns a string, treat it as HTML return typeof result === 'string' ? unsafeHTML(result) : result; } if (value === null || value === undefined) { return ''; } switch (column.type) { case 'number': return typeof value === 'number' ? value.toLocaleString() : String(value); case 'currency': return typeof value === 'number' ? value.toLocaleString('en-US', { style: 'currency', currency: 'USD' }) : String(value); case 'date': return value instanceof Date ? value.toLocaleDateString() : new Date(value).toLocaleDateString(); case 'boolean': if (value === true) return 'Yes'; if (value === false) return 'No'; return ''; default: return String(value); } } /** * Returns CSS classes for a header cell based on column config. */ _getHeaderCellClasses(column, index) { return { 'header-cell': true, 'header-cell--align-center': column.align === 'center', 'header-cell--align-right': column.align === 'right', 'header-cell--sticky-left': column.sticky === 'left', 'header-cell--sticky-left-last': column.sticky === 'left' && !this.getDisplayedColumns().slice(index + 1).some(c => c.sticky === 'left'), 'header-cell--sticky-right': column.sticky === 'right', 'header-cell--sticky-right-first': column.sticky === 'right' && !this.getDisplayedColumns().slice(0, index).some(c => c.sticky === 'right') }; } /** * Returns CSS classes for a table cell based on column config: * - Alignment (center, right) * - Sticky positioning (left, right) * - Border classes for the last left-sticky or first right-sticky column */ _getCellClasses(column, index) { return { 'cell': true, 'cell--align-center': column.align === 'center', 'cell--align-right': column.align === 'right', 'cell--sticky-left': column.sticky === 'left', 'cell--sticky-left-last': column.sticky === 'left' && !this.getDisplayedColumns().slice(index + 1).some(c => c.sticky === 'left'), 'cell--sticky-right': column.sticky === 'right', 'cell--sticky-right-first': column.sticky === 'right' && !this.getDisplayedColumns().slice(0, index).some(c => c.sticky === 'right') }; } /** * Returns inline styles for a table cell: * - Width (from column config or default 150px) * - Min-width (if specified) * - Left/right offset for sticky columns (calculated from widths of preceding sticky columns) */ _getCellStyle(column, index) { const styles = {}; if (column.sticky === 'left') { let leftOffset = 0; for (let i = 0; i < index; i++) { const col = this.getDisplayedColumns()[i]; if (col.sticky === 'left') { leftOffset += parseInt(col.width || '0', 10); } } styles.left = `${leftOffset}px`; } if (column.sticky === 'right') { let rightOffset = 0; for (let i = index + 1; i < this.getDisplayedColumns().length; i++) { const col = this.getDisplayedColumns()[i]; if (col.sticky === 'right') { rightOffset += parseInt(col.width || '0', 10); } } styles.right = `${rightOffset}px`; } return styles; } /** * Renders the pagination controls: * - Previous page arrow (disabled on first page) * - Range text showing \"1-50 of 150\" format * - Next page arrow (disabled on last page) * * Hidden when there's no data or all data fits on one page. */ _renderPagination() { const start = (this._page - 1) * this._pageSize + 1; const end = Math.min(this._page * this._pageSize, this._totalItems); return html ` <div class=\"pagination\"> <span class=\"pagination-icon ${this._page === 1 ? 'pagination-icon--disabled' : ''}\" @click=${this.goToPrevPage} > <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"/></svg> </span> <span class=\"pagination-info\">${start}-${end} of ${this._totalItems}</span> <span class=\"pagination-icon ${this._page === this._totalPages ? 'pagination-icon--disabled' : ''}\" @click=${this.goToNextPage} > <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"/></svg> </span> </div> `; } /** * Renders the header toolbar containing: * - Title (left) * - Search bar with view selector dropdown (center) * - Tools (right): page navigation, refresh button, column visibility picker, actions dropdown * * Hidden when there's no title, no actions, and data fits on one page. */ _renderHeader() { if (!this._def.title && !this._def.actions?.length && this._totalPages <= 1) { return nothing; } return html ` <div class=\"header\"> <div class=\"title\">${this._def.title ?? ''}</div> <div class=\"search\"> <!-- TODO: Saved views dropdown <div class=\"views\"> <span>Default View</span> <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z\"/></svg> </div> --> <div class=\"search-field\"> <svg class=\"search-icon\" viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z\"/></svg> <input type=\"text\" class=\"search-input\" placeholder=\"Search...\" .value=${this._searchQuery} @input=${this._handleSearch} /> </div> </div> <div class=\"tools\"> ${this._renderPagination()} <span class=\"refresh\" title=\"Refresh\" @click=${() => this.refresh()}> <svg viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z\"/></svg> </span> <div class=\"column-picker-wrapper\"> <span class=\"header-icon\" title=\"Columns\" @click=${this._toggleColumnPicker}> <svg viewBox=\"0 -960 960 960\" fill=\"currentColor\"><path d=\"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z\"/></svg> </span> <div class=\"column-picker ${this._columnPickerOpen ? 'open' : ''}\"> ${[...this._def.columns].filter(col => col.type !== 'actions').sort((a, b) => (a.label ?? a.id).localeCompare(b.label ?? b.id)).map(col => html ` <div class=\"column-picker-item\" @click=${() => this._toggleColumn(col.id)}> <div class=\"column-picker-checkbox ${this._displayedColumns.includes(col.id) ? 'checked' : ''}\"> <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z\"/></svg> </div> <span class=\"column-picker-label\">${col.label ?? col.id}</span> </div> `)} </div> </div> ${this._def.actions?.length === 1 ? html ` <kr-button class=\"actions\" @click=${() => this._handleAction(this._def.actions[0])} > ${this._def.actions[0].label} </kr-button> ` : this._def.actions?.length ? html ` <kr-button class=\"actions\" .options=${this._def.actions.map(a => ({ id: a.id, label: a.label }))} @option-select=${(e) => this._handleAction({ id: e.detail.id, label: e.detail.label })} > Actions </kr-button> ` : nothing} </div> </div> `; } /** Renders status message (loading, error, empty) */ _renderStatus() { if (this._dataState === 'loading' && this._data.length === 0) { return html `<div class=\"status\">Loading...</div>`; } if (this._dataState === 'error' && this._data.length === 0) { return html `<div class=\"status status--error\">Error loading data</div>`; } if (this._data.length === 0) { return html `<div class=\"status\">No data available</div>`; } return nothing; } _getGridTemplateColumns() { const cols = this.getDisplayedColumns(); const lastNonStickyIndex = cols.map((c, i) => c.sticky ? -1 : i).filter(i => i >= 0).pop(); return cols.map((col, i) => { if (i === lastNonStickyIndex && this._widthsLocked) { return `minmax(${col.width || 'auto'}, 1fr)`; } return col.width || 'auto'; }).join(' '); } /** Renders the scrollable data grid with column headers and rows. */ _renderTable() { return html ` <div class=\"wrapper\"> <div class=\"overlay-left\"></div> <div class=\"overlay-right\"></div> ${this._renderStatus()} <div class=\"content\" @scroll=${this._handleScroll}> <div class=\"table\" style=\"grid-template-columns: ${this._getGridTemplateColumns()}\"> <div class=\"header-row\"> ${this.getDisplayedColumns().map((col, i) => html ` <div class=${classMap(this._getHeaderCellClasses(col, i))} style=${styleMap(this._getCellStyle(col, i))} data-column-id=${col.id} >${col.label ?? col.id}${col.resizable !== false ? html `<div class=\"header-cell__resize\" @mousedown=${(e) => this._handleResizeStart(e, col.id)} ></div>` : nothing}</div> `)} </div> ${this._data.map(row => html ` <div class=\"row\"> ${this.getDisplayedColumns().map((col, i) => html ` <div class=${classMap(this._getCellClasses(col, i))} style=${styleMap(this._getCellStyle(col, i))} data-column-id=${col.id} > ${this._renderCellContent(col, row)} </div> `)} </div> `)} </div> </div> </div> `; } /** * Renders a data table with: * - Header bar with title, search input with view selector, and tools (pagination, refresh, column visibility, actions dropdown) * - Scrollable grid with sticky header row and optional sticky left/right columns * - Loading, error message, or empty state when no data */ render() { if (!this._def.columns.length) { return html `<slot></slot>`; } return html ` ${this._renderHeader()} ${this._renderTable()} `; } }"
|
|
1230
|
+
}
|
|
1231
|
+
],
|
|
1232
|
+
"exports": [
|
|
1233
|
+
{
|
|
1234
|
+
"kind": "js",
|
|
1235
|
+
"name": "KRTable",
|
|
1236
|
+
"declaration": {
|
|
1237
|
+
"name": "KRTable",
|
|
1238
|
+
"module": "dist/table/table.js"
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
]
|
|
1242
|
+
},
|
|
1140
1243
|
{
|
|
1141
1244
|
"kind": "javascript-module",
|
|
1142
1245
|
"path": "dist/tabs/tab.js",
|
|
@@ -1463,6 +1566,16 @@
|
|
|
1463
1566
|
"attribute": "disabled",
|
|
1464
1567
|
"reflects": true
|
|
1465
1568
|
},
|
|
1569
|
+
{
|
|
1570
|
+
"kind": "field",
|
|
1571
|
+
"name": "options",
|
|
1572
|
+
"type": {
|
|
1573
|
+
"text": "KRButtonOption[]"
|
|
1574
|
+
},
|
|
1575
|
+
"default": "[]",
|
|
1576
|
+
"description": "Dropdown options - when provided, button becomes a dropdown",
|
|
1577
|
+
"attribute": "options"
|
|
1578
|
+
},
|
|
1466
1579
|
{
|
|
1467
1580
|
"kind": "field",
|
|
1468
1581
|
"name": "_state",
|
|
@@ -1481,6 +1594,24 @@
|
|
|
1481
1594
|
"privacy": "private",
|
|
1482
1595
|
"default": "''"
|
|
1483
1596
|
},
|
|
1597
|
+
{
|
|
1598
|
+
"kind": "field",
|
|
1599
|
+
"name": "_dropdownOpened",
|
|
1600
|
+
"type": {
|
|
1601
|
+
"text": "boolean"
|
|
1602
|
+
},
|
|
1603
|
+
"privacy": "private",
|
|
1604
|
+
"default": "false"
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
"kind": "field",
|
|
1608
|
+
"name": "_dropdownAlignRight",
|
|
1609
|
+
"type": {
|
|
1610
|
+
"text": "boolean"
|
|
1611
|
+
},
|
|
1612
|
+
"privacy": "private",
|
|
1613
|
+
"default": "false"
|
|
1614
|
+
},
|
|
1484
1615
|
{
|
|
1485
1616
|
"kind": "field",
|
|
1486
1617
|
"name": "_stateTimeout",
|
|
@@ -1489,11 +1620,45 @@
|
|
|
1489
1620
|
},
|
|
1490
1621
|
"privacy": "private"
|
|
1491
1622
|
},
|
|
1623
|
+
{
|
|
1624
|
+
"kind": "field",
|
|
1625
|
+
"name": "_handleHostClick",
|
|
1626
|
+
"privacy": "private"
|
|
1627
|
+
},
|
|
1492
1628
|
{
|
|
1493
1629
|
"kind": "field",
|
|
1494
1630
|
"name": "_handleKeydown",
|
|
1495
1631
|
"privacy": "private"
|
|
1496
1632
|
},
|
|
1633
|
+
{
|
|
1634
|
+
"kind": "field",
|
|
1635
|
+
"name": "_handleClickOutside",
|
|
1636
|
+
"privacy": "private"
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
"kind": "method",
|
|
1640
|
+
"name": "_toggleDropdown",
|
|
1641
|
+
"privacy": "private"
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
"kind": "method",
|
|
1645
|
+
"name": "_handleOptionClick",
|
|
1646
|
+
"privacy": "private",
|
|
1647
|
+
"parameters": [
|
|
1648
|
+
{
|
|
1649
|
+
"name": "option",
|
|
1650
|
+
"type": {
|
|
1651
|
+
"text": "KRButtonOption"
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
"name": "e",
|
|
1656
|
+
"type": {
|
|
1657
|
+
"text": "MouseEvent"
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
]
|
|
1661
|
+
},
|
|
1497
1662
|
{
|
|
1498
1663
|
"kind": "method",
|
|
1499
1664
|
"name": "showLoading",
|
|
@@ -1545,6 +1710,13 @@
|
|
|
1545
1710
|
}
|
|
1546
1711
|
],
|
|
1547
1712
|
"events": [
|
|
1713
|
+
{
|
|
1714
|
+
"name": "option-select",
|
|
1715
|
+
"type": {
|
|
1716
|
+
"text": "CustomEvent"
|
|
1717
|
+
},
|
|
1718
|
+
"description": "Fired when a dropdown option is selected"
|
|
1719
|
+
},
|
|
1548
1720
|
{
|
|
1549
1721
|
"description": "Fired when the button is clicked",
|
|
1550
1722
|
"name": "click"
|
|
@@ -1586,6 +1758,15 @@
|
|
|
1586
1758
|
"default": "false",
|
|
1587
1759
|
"description": "Whether the button is disabled",
|
|
1588
1760
|
"fieldName": "disabled"
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
"name": "options",
|
|
1764
|
+
"type": {
|
|
1765
|
+
"text": "KRButtonOption[]"
|
|
1766
|
+
},
|
|
1767
|
+
"default": "[]",
|
|
1768
|
+
"description": "Dropdown options - when provided, button becomes a dropdown",
|
|
1769
|
+
"fieldName": "options"
|
|
1589
1770
|
}
|
|
1590
1771
|
],
|
|
1591
1772
|
"superclass": {
|
|
@@ -2286,39 +2467,580 @@
|
|
|
2286
2467
|
},
|
|
2287
2468
|
{
|
|
2288
2469
|
"kind": "javascript-module",
|
|
2289
|
-
"path": "src/
|
|
2290
|
-
"declarations": [
|
|
2291
|
-
{
|
|
2292
|
-
"kind": "variable",
|
|
2293
|
-
"name": "krBaseCSS",
|
|
2294
|
-
"default": "css` :host, *, *::before, *::after { box-sizing: border-box; } :host { /* Primary */ --kr-primary: rgb(22, 48, 82); --kr-primary-hover: rgb(16, 36, 62); --kr-primary-text: #ffffff; /* Accent */ --kr-accent: #BEEA4E; --kr-accent-hover: #a8d43a; --kr-accent-text: #000000; /* Text */ --kr-text: #000000; --kr-text-muted: #4b5563; --kr-text-disabled: #9ca3af; /* Borders */ --kr-border: #e5e7eb; } `",
|
|
2295
|
-
"description": "Base theme styles with CSS custom properties.\nImport into components: static styles = [krBaseCSS, css`...`]"
|
|
2296
|
-
}
|
|
2297
|
-
],
|
|
2298
|
-
"exports": [
|
|
2299
|
-
{
|
|
2300
|
-
"kind": "js",
|
|
2301
|
-
"name": "krBaseCSS",
|
|
2302
|
-
"declaration": {
|
|
2303
|
-
"name": "krBaseCSS",
|
|
2304
|
-
"module": "src/style/base.ts"
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
]
|
|
2308
|
-
},
|
|
2309
|
-
{
|
|
2310
|
-
"kind": "javascript-module",
|
|
2311
|
-
"path": "src/tabs/tab.ts",
|
|
2470
|
+
"path": "src/table/table.ts",
|
|
2312
2471
|
"declarations": [
|
|
2313
2472
|
{
|
|
2314
2473
|
"kind": "class",
|
|
2315
|
-
"description": "
|
|
2316
|
-
"name": "
|
|
2317
|
-
"
|
|
2474
|
+
"description": "",
|
|
2475
|
+
"name": "KRTable",
|
|
2476
|
+
"members": [
|
|
2318
2477
|
{
|
|
2319
|
-
"
|
|
2320
|
-
"name": ""
|
|
2321
|
-
|
|
2478
|
+
"kind": "field",
|
|
2479
|
+
"name": "_scrollStyle",
|
|
2480
|
+
"type": {
|
|
2481
|
+
"text": "'overlay' | 'edge'"
|
|
2482
|
+
},
|
|
2483
|
+
"privacy": "private",
|
|
2484
|
+
"default": "'overlay'",
|
|
2485
|
+
"description": "Internal flag to switch between scroll edge modes:\n- 'overlay': Fixed padding with overlay elements that hide content at edges (scrollbar at viewport edge)\n- 'edge': Padding scrolls with content, allowing table to reach edges when scrolling"
|
|
2486
|
+
},
|
|
2487
|
+
{
|
|
2488
|
+
"kind": "field",
|
|
2489
|
+
"name": "_refreshTimer",
|
|
2490
|
+
"type": {
|
|
2491
|
+
"text": "number | undefined"
|
|
2492
|
+
},
|
|
2493
|
+
"privacy": "private"
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
"kind": "field",
|
|
2497
|
+
"name": "_data",
|
|
2498
|
+
"type": {
|
|
2499
|
+
"text": "Record<string, any>[]"
|
|
2500
|
+
},
|
|
2501
|
+
"privacy": "private",
|
|
2502
|
+
"default": "[]"
|
|
2503
|
+
},
|
|
2504
|
+
{
|
|
2505
|
+
"kind": "field",
|
|
2506
|
+
"name": "_dataState",
|
|
2507
|
+
"type": {
|
|
2508
|
+
"text": "'idle' | 'loading' | 'success' | 'error'"
|
|
2509
|
+
},
|
|
2510
|
+
"privacy": "private",
|
|
2511
|
+
"default": "'idle'"
|
|
2512
|
+
},
|
|
2513
|
+
{
|
|
2514
|
+
"kind": "field",
|
|
2515
|
+
"name": "_page",
|
|
2516
|
+
"type": {
|
|
2517
|
+
"text": "number"
|
|
2518
|
+
},
|
|
2519
|
+
"privacy": "private",
|
|
2520
|
+
"default": "1"
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
"kind": "field",
|
|
2524
|
+
"name": "_pageSize",
|
|
2525
|
+
"type": {
|
|
2526
|
+
"text": "number"
|
|
2527
|
+
},
|
|
2528
|
+
"privacy": "private",
|
|
2529
|
+
"default": "50"
|
|
2530
|
+
},
|
|
2531
|
+
{
|
|
2532
|
+
"kind": "field",
|
|
2533
|
+
"name": "_totalItems",
|
|
2534
|
+
"type": {
|
|
2535
|
+
"text": "number"
|
|
2536
|
+
},
|
|
2537
|
+
"privacy": "private",
|
|
2538
|
+
"default": "0"
|
|
2539
|
+
},
|
|
2540
|
+
{
|
|
2541
|
+
"kind": "field",
|
|
2542
|
+
"name": "_totalPages",
|
|
2543
|
+
"type": {
|
|
2544
|
+
"text": "number"
|
|
2545
|
+
},
|
|
2546
|
+
"privacy": "private",
|
|
2547
|
+
"default": "0"
|
|
2548
|
+
},
|
|
2549
|
+
{
|
|
2550
|
+
"kind": "field",
|
|
2551
|
+
"name": "_searchQuery",
|
|
2552
|
+
"type": {
|
|
2553
|
+
"text": "string"
|
|
2554
|
+
},
|
|
2555
|
+
"privacy": "private",
|
|
2556
|
+
"default": "''"
|
|
2557
|
+
},
|
|
2558
|
+
{
|
|
2559
|
+
"kind": "field",
|
|
2560
|
+
"name": "_canScrollLeft",
|
|
2561
|
+
"type": {
|
|
2562
|
+
"text": "boolean"
|
|
2563
|
+
},
|
|
2564
|
+
"privacy": "private",
|
|
2565
|
+
"default": "false"
|
|
2566
|
+
},
|
|
2567
|
+
{
|
|
2568
|
+
"kind": "field",
|
|
2569
|
+
"name": "_canScrollRight",
|
|
2570
|
+
"type": {
|
|
2571
|
+
"text": "boolean"
|
|
2572
|
+
},
|
|
2573
|
+
"privacy": "private",
|
|
2574
|
+
"default": "false"
|
|
2575
|
+
},
|
|
2576
|
+
{
|
|
2577
|
+
"kind": "field",
|
|
2578
|
+
"name": "_canScrollHorizontal",
|
|
2579
|
+
"type": {
|
|
2580
|
+
"text": "boolean"
|
|
2581
|
+
},
|
|
2582
|
+
"privacy": "private",
|
|
2583
|
+
"default": "false"
|
|
2584
|
+
},
|
|
2585
|
+
{
|
|
2586
|
+
"kind": "field",
|
|
2587
|
+
"name": "_columnPickerOpen",
|
|
2588
|
+
"type": {
|
|
2589
|
+
"text": "boolean"
|
|
2590
|
+
},
|
|
2591
|
+
"privacy": "private",
|
|
2592
|
+
"default": "false"
|
|
2593
|
+
},
|
|
2594
|
+
{
|
|
2595
|
+
"kind": "field",
|
|
2596
|
+
"name": "_displayedColumns",
|
|
2597
|
+
"type": {
|
|
2598
|
+
"text": "string[]"
|
|
2599
|
+
},
|
|
2600
|
+
"privacy": "private",
|
|
2601
|
+
"default": "[]"
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
"kind": "field",
|
|
2605
|
+
"name": "_widthsLocked",
|
|
2606
|
+
"type": {
|
|
2607
|
+
"text": "boolean"
|
|
2608
|
+
},
|
|
2609
|
+
"privacy": "private",
|
|
2610
|
+
"default": "false"
|
|
2611
|
+
},
|
|
2612
|
+
{
|
|
2613
|
+
"kind": "field",
|
|
2614
|
+
"name": "_resizing",
|
|
2615
|
+
"type": {
|
|
2616
|
+
"text": "{ columnId: string; startX: number; startWidth: number } | null"
|
|
2617
|
+
},
|
|
2618
|
+
"privacy": "private",
|
|
2619
|
+
"default": "null"
|
|
2620
|
+
},
|
|
2621
|
+
{
|
|
2622
|
+
"kind": "field",
|
|
2623
|
+
"name": "_resizeObserver",
|
|
2624
|
+
"type": {
|
|
2625
|
+
"text": "ResizeObserver | null"
|
|
2626
|
+
},
|
|
2627
|
+
"privacy": "private",
|
|
2628
|
+
"default": "null"
|
|
2629
|
+
},
|
|
2630
|
+
{
|
|
2631
|
+
"kind": "field",
|
|
2632
|
+
"name": "_searchPositionLocked",
|
|
2633
|
+
"type": {
|
|
2634
|
+
"text": "boolean"
|
|
2635
|
+
},
|
|
2636
|
+
"privacy": "private",
|
|
2637
|
+
"default": "false"
|
|
2638
|
+
},
|
|
2639
|
+
{
|
|
2640
|
+
"kind": "field",
|
|
2641
|
+
"name": "_def",
|
|
2642
|
+
"type": {
|
|
2643
|
+
"text": "KRTableDef"
|
|
2644
|
+
},
|
|
2645
|
+
"privacy": "private",
|
|
2646
|
+
"default": "{ columns: [] }"
|
|
2647
|
+
},
|
|
2648
|
+
{
|
|
2649
|
+
"kind": "field",
|
|
2650
|
+
"name": "def",
|
|
2651
|
+
"type": {
|
|
2652
|
+
"text": "KRTableDef"
|
|
2653
|
+
},
|
|
2654
|
+
"default": "{ columns: [] }",
|
|
2655
|
+
"attribute": "def"
|
|
2656
|
+
},
|
|
2657
|
+
{
|
|
2658
|
+
"kind": "method",
|
|
2659
|
+
"name": "refresh"
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
"kind": "method",
|
|
2663
|
+
"name": "goToPrevPage"
|
|
2664
|
+
},
|
|
2665
|
+
{
|
|
2666
|
+
"kind": "method",
|
|
2667
|
+
"name": "goToNextPage"
|
|
2668
|
+
},
|
|
2669
|
+
{
|
|
2670
|
+
"kind": "method",
|
|
2671
|
+
"name": "goToPage",
|
|
2672
|
+
"parameters": [
|
|
2673
|
+
{
|
|
2674
|
+
"name": "page",
|
|
2675
|
+
"type": {
|
|
2676
|
+
"text": "number"
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
]
|
|
2680
|
+
},
|
|
2681
|
+
{
|
|
2682
|
+
"kind": "method",
|
|
2683
|
+
"name": "_fetch",
|
|
2684
|
+
"privacy": "private",
|
|
2685
|
+
"description": "Fetches data from the API and updates the table.\nShows a loading spinner while fetching, then displays rows on success\nor an error snackbar on failure.\nRequest/response format depends on dataSource.mode (solr, opensearch, db)."
|
|
2686
|
+
},
|
|
2687
|
+
{
|
|
2688
|
+
"kind": "method",
|
|
2689
|
+
"name": "_initRefresh",
|
|
2690
|
+
"privacy": "private",
|
|
2691
|
+
"description": "Sets up auto-refresh so the table automatically fetches fresh data\nat a regular interval (useful for dashboards, monitoring views).\nConfigured via def.refreshInterval in milliseconds."
|
|
2692
|
+
},
|
|
2693
|
+
{
|
|
2694
|
+
"kind": "method",
|
|
2695
|
+
"name": "_handleSearch",
|
|
2696
|
+
"privacy": "private",
|
|
2697
|
+
"parameters": [
|
|
2698
|
+
{
|
|
2699
|
+
"name": "e",
|
|
2700
|
+
"type": {
|
|
2701
|
+
"text": "Event"
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
]
|
|
2705
|
+
},
|
|
2706
|
+
{
|
|
2707
|
+
"kind": "method",
|
|
2708
|
+
"name": "_measureTextWidth",
|
|
2709
|
+
"privacy": "private",
|
|
2710
|
+
"return": {
|
|
2711
|
+
"type": {
|
|
2712
|
+
"text": "number"
|
|
2713
|
+
}
|
|
2714
|
+
},
|
|
2715
|
+
"parameters": [
|
|
2716
|
+
{
|
|
2717
|
+
"name": "text",
|
|
2718
|
+
"type": {
|
|
2719
|
+
"text": "string"
|
|
2720
|
+
}
|
|
2721
|
+
},
|
|
2722
|
+
{
|
|
2723
|
+
"name": "font",
|
|
2724
|
+
"type": {
|
|
2725
|
+
"text": "string"
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
]
|
|
2729
|
+
},
|
|
2730
|
+
{
|
|
2731
|
+
"kind": "method",
|
|
2732
|
+
"name": "_lockColumnWidths",
|
|
2733
|
+
"privacy": "private"
|
|
2734
|
+
},
|
|
2735
|
+
{
|
|
2736
|
+
"kind": "method",
|
|
2737
|
+
"name": "_updateSearchPosition",
|
|
2738
|
+
"privacy": "private",
|
|
2739
|
+
"description": "Updates search position to be centered with equal gaps from title and tools.\nOn first call: resets to flex centering, measures position, then locks with fixed margin.\nSubsequent calls are ignored unless _searchPositionLocked is reset (e.g., on resize)."
|
|
2740
|
+
},
|
|
2741
|
+
{
|
|
2742
|
+
"kind": "method",
|
|
2743
|
+
"name": "_toggleColumnPicker",
|
|
2744
|
+
"privacy": "private"
|
|
2745
|
+
},
|
|
2746
|
+
{
|
|
2747
|
+
"kind": "method",
|
|
2748
|
+
"name": "_toggleColumn",
|
|
2749
|
+
"privacy": "private",
|
|
2750
|
+
"parameters": [
|
|
2751
|
+
{
|
|
2752
|
+
"name": "columnId",
|
|
2753
|
+
"type": {
|
|
2754
|
+
"text": "string"
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
]
|
|
2758
|
+
},
|
|
2759
|
+
{
|
|
2760
|
+
"kind": "field",
|
|
2761
|
+
"name": "_handleClickOutsideColumnPicker",
|
|
2762
|
+
"privacy": "private"
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
"kind": "method",
|
|
2766
|
+
"name": "getDisplayedColumns",
|
|
2767
|
+
"return": {
|
|
2768
|
+
"type": {
|
|
2769
|
+
"text": "KRTableColumn[]"
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
},
|
|
2773
|
+
{
|
|
2774
|
+
"kind": "method",
|
|
2775
|
+
"name": "_handleScroll",
|
|
2776
|
+
"privacy": "private",
|
|
2777
|
+
"parameters": [
|
|
2778
|
+
{
|
|
2779
|
+
"name": "e",
|
|
2780
|
+
"type": {
|
|
2781
|
+
"text": "Event"
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
],
|
|
2785
|
+
"description": "Scroll event handler that updates scroll flags in real-time as user scrolls.\nUpdates shadow indicators to show if more content exists left/right."
|
|
2786
|
+
},
|
|
2787
|
+
{
|
|
2788
|
+
"kind": "method",
|
|
2789
|
+
"name": "_updateScrollFlags",
|
|
2790
|
+
"privacy": "private",
|
|
2791
|
+
"description": "Updates scroll state flags for the table content container.\n- _canScrollLeft: true if scrolled right (can scroll back left)\n- _canScrollRight: true if more content exists to the right\n- _canScrollHorizontal: true if content is wider than container\nThese flags control scroll shadow indicators and CSS classes."
|
|
2792
|
+
},
|
|
2793
|
+
{
|
|
2794
|
+
"kind": "method",
|
|
2795
|
+
"name": "_handleResizeStart",
|
|
2796
|
+
"privacy": "private",
|
|
2797
|
+
"parameters": [
|
|
2798
|
+
{
|
|
2799
|
+
"name": "e",
|
|
2800
|
+
"type": {
|
|
2801
|
+
"text": "MouseEvent"
|
|
2802
|
+
}
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
"name": "columnId",
|
|
2806
|
+
"type": {
|
|
2807
|
+
"text": "string"
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
]
|
|
2811
|
+
},
|
|
2812
|
+
{
|
|
2813
|
+
"kind": "field",
|
|
2814
|
+
"name": "_handleResizeMove",
|
|
2815
|
+
"privacy": "private"
|
|
2816
|
+
},
|
|
2817
|
+
{
|
|
2818
|
+
"kind": "field",
|
|
2819
|
+
"name": "_handleResizeEnd",
|
|
2820
|
+
"privacy": "private"
|
|
2821
|
+
},
|
|
2822
|
+
{
|
|
2823
|
+
"kind": "method",
|
|
2824
|
+
"name": "_handleAction",
|
|
2825
|
+
"privacy": "private",
|
|
2826
|
+
"parameters": [
|
|
2827
|
+
{
|
|
2828
|
+
"name": "action",
|
|
2829
|
+
"type": {
|
|
2830
|
+
"text": "KRTableAction"
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
]
|
|
2834
|
+
},
|
|
2835
|
+
{
|
|
2836
|
+
"kind": "method",
|
|
2837
|
+
"name": "_renderCellContent",
|
|
2838
|
+
"privacy": "private",
|
|
2839
|
+
"parameters": [
|
|
2840
|
+
{
|
|
2841
|
+
"name": "column",
|
|
2842
|
+
"type": {
|
|
2843
|
+
"text": "KRTableColumn"
|
|
2844
|
+
}
|
|
2845
|
+
},
|
|
2846
|
+
{
|
|
2847
|
+
"name": "row",
|
|
2848
|
+
"type": {
|
|
2849
|
+
"text": "Record<string, any>"
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
]
|
|
2853
|
+
},
|
|
2854
|
+
{
|
|
2855
|
+
"kind": "method",
|
|
2856
|
+
"name": "_getHeaderCellClasses",
|
|
2857
|
+
"privacy": "private",
|
|
2858
|
+
"return": {
|
|
2859
|
+
"type": {
|
|
2860
|
+
"text": "Record<string, boolean>"
|
|
2861
|
+
}
|
|
2862
|
+
},
|
|
2863
|
+
"parameters": [
|
|
2864
|
+
{
|
|
2865
|
+
"name": "column",
|
|
2866
|
+
"type": {
|
|
2867
|
+
"text": "KRTableColumn"
|
|
2868
|
+
}
|
|
2869
|
+
},
|
|
2870
|
+
{
|
|
2871
|
+
"name": "index",
|
|
2872
|
+
"type": {
|
|
2873
|
+
"text": "number"
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
],
|
|
2877
|
+
"description": "Returns CSS classes for a header cell based on column config."
|
|
2878
|
+
},
|
|
2879
|
+
{
|
|
2880
|
+
"kind": "method",
|
|
2881
|
+
"name": "_getCellClasses",
|
|
2882
|
+
"privacy": "private",
|
|
2883
|
+
"return": {
|
|
2884
|
+
"type": {
|
|
2885
|
+
"text": "Record<string, boolean>"
|
|
2886
|
+
}
|
|
2887
|
+
},
|
|
2888
|
+
"parameters": [
|
|
2889
|
+
{
|
|
2890
|
+
"name": "column",
|
|
2891
|
+
"type": {
|
|
2892
|
+
"text": "KRTableColumn"
|
|
2893
|
+
}
|
|
2894
|
+
},
|
|
2895
|
+
{
|
|
2896
|
+
"name": "index",
|
|
2897
|
+
"type": {
|
|
2898
|
+
"text": "number"
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
],
|
|
2902
|
+
"description": "Returns CSS classes for a table cell based on column config:\n- Alignment (center, right)\n- Sticky positioning (left, right)\n- Border classes for the last left-sticky or first right-sticky column"
|
|
2903
|
+
},
|
|
2904
|
+
{
|
|
2905
|
+
"kind": "method",
|
|
2906
|
+
"name": "_getCellStyle",
|
|
2907
|
+
"privacy": "private",
|
|
2908
|
+
"return": {
|
|
2909
|
+
"type": {
|
|
2910
|
+
"text": "Record<string, string>"
|
|
2911
|
+
}
|
|
2912
|
+
},
|
|
2913
|
+
"parameters": [
|
|
2914
|
+
{
|
|
2915
|
+
"name": "column",
|
|
2916
|
+
"type": {
|
|
2917
|
+
"text": "KRTableColumn"
|
|
2918
|
+
}
|
|
2919
|
+
},
|
|
2920
|
+
{
|
|
2921
|
+
"name": "index",
|
|
2922
|
+
"type": {
|
|
2923
|
+
"text": "number"
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
],
|
|
2927
|
+
"description": "Returns inline styles for a table cell:\n- Width (from column config or default 150px)\n- Min-width (if specified)\n- Left/right offset for sticky columns (calculated from widths of preceding sticky columns)"
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
"kind": "method",
|
|
2931
|
+
"name": "_renderPagination",
|
|
2932
|
+
"privacy": "private",
|
|
2933
|
+
"description": "Renders the pagination controls:\n- Previous page arrow (disabled on first page)\n- Range text showing \"1-50 of 150\" format\n- Next page arrow (disabled on last page)\n\nHidden when there's no data or all data fits on one page."
|
|
2934
|
+
},
|
|
2935
|
+
{
|
|
2936
|
+
"kind": "method",
|
|
2937
|
+
"name": "_renderHeader",
|
|
2938
|
+
"privacy": "private",
|
|
2939
|
+
"description": "Renders the header toolbar containing:\n- Title (left)\n- Search bar with view selector dropdown (center)\n- Tools (right): page navigation, refresh button, column visibility picker, actions dropdown\n\nHidden when there's no title, no actions, and data fits on one page."
|
|
2940
|
+
},
|
|
2941
|
+
{
|
|
2942
|
+
"kind": "method",
|
|
2943
|
+
"name": "_renderStatus",
|
|
2944
|
+
"privacy": "private",
|
|
2945
|
+
"description": "Renders status message (loading, error, empty)"
|
|
2946
|
+
},
|
|
2947
|
+
{
|
|
2948
|
+
"kind": "method",
|
|
2949
|
+
"name": "_getGridTemplateColumns",
|
|
2950
|
+
"privacy": "private",
|
|
2951
|
+
"return": {
|
|
2952
|
+
"type": {
|
|
2953
|
+
"text": "string"
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2956
|
+
},
|
|
2957
|
+
{
|
|
2958
|
+
"kind": "method",
|
|
2959
|
+
"name": "_renderTable",
|
|
2960
|
+
"privacy": "private",
|
|
2961
|
+
"description": "Renders the scrollable data grid with column headers and rows."
|
|
2962
|
+
}
|
|
2963
|
+
],
|
|
2964
|
+
"events": [
|
|
2965
|
+
{
|
|
2966
|
+
"name": "action",
|
|
2967
|
+
"type": {
|
|
2968
|
+
"text": "CustomEvent"
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
],
|
|
2972
|
+
"attributes": [
|
|
2973
|
+
{
|
|
2974
|
+
"name": "def",
|
|
2975
|
+
"type": {
|
|
2976
|
+
"text": "KRTableDef"
|
|
2977
|
+
},
|
|
2978
|
+
"default": "{ columns: [] }",
|
|
2979
|
+
"fieldName": "def"
|
|
2980
|
+
}
|
|
2981
|
+
],
|
|
2982
|
+
"superclass": {
|
|
2983
|
+
"name": "LitElement",
|
|
2984
|
+
"package": "lit"
|
|
2985
|
+
},
|
|
2986
|
+
"tagName": "kr-table",
|
|
2987
|
+
"customElement": true
|
|
2988
|
+
}
|
|
2989
|
+
],
|
|
2990
|
+
"exports": [
|
|
2991
|
+
{
|
|
2992
|
+
"kind": "js",
|
|
2993
|
+
"name": "KRTable",
|
|
2994
|
+
"declaration": {
|
|
2995
|
+
"name": "KRTable",
|
|
2996
|
+
"module": "src/table/table.ts"
|
|
2997
|
+
}
|
|
2998
|
+
},
|
|
2999
|
+
{
|
|
3000
|
+
"kind": "custom-element-definition",
|
|
3001
|
+
"name": "kr-table",
|
|
3002
|
+
"declaration": {
|
|
3003
|
+
"name": "KRTable",
|
|
3004
|
+
"module": "src/table/table.ts"
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
]
|
|
3008
|
+
},
|
|
3009
|
+
{
|
|
3010
|
+
"kind": "javascript-module",
|
|
3011
|
+
"path": "src/style/base.ts",
|
|
3012
|
+
"declarations": [
|
|
3013
|
+
{
|
|
3014
|
+
"kind": "variable",
|
|
3015
|
+
"name": "krBaseCSS",
|
|
3016
|
+
"default": "css` :host, *, *::before, *::after { box-sizing: border-box; } :host { /* Primary */ --kr-primary: rgb(22, 48, 82); --kr-primary-hover: rgb(16, 36, 62); --kr-primary-text: #ffffff; /* Accent */ --kr-accent: #BEEA4E; --kr-accent-hover: #a8d43a; --kr-accent-text: #000000; /* Text */ --kr-text: #000000; --kr-text-muted: #4b5563; --kr-text-disabled: #9ca3af; /* Borders */ --kr-border: #e5e7eb; } `",
|
|
3017
|
+
"description": "Base theme styles with CSS custom properties.\nImport into components: static styles = [krBaseCSS, css`...`]"
|
|
3018
|
+
}
|
|
3019
|
+
],
|
|
3020
|
+
"exports": [
|
|
3021
|
+
{
|
|
3022
|
+
"kind": "js",
|
|
3023
|
+
"name": "krBaseCSS",
|
|
3024
|
+
"declaration": {
|
|
3025
|
+
"name": "krBaseCSS",
|
|
3026
|
+
"module": "src/style/base.ts"
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
]
|
|
3030
|
+
},
|
|
3031
|
+
{
|
|
3032
|
+
"kind": "javascript-module",
|
|
3033
|
+
"path": "src/tabs/tab.ts",
|
|
3034
|
+
"declarations": [
|
|
3035
|
+
{
|
|
3036
|
+
"kind": "class",
|
|
3037
|
+
"description": "A tab for the kr-tab-group component.",
|
|
3038
|
+
"name": "KRTab",
|
|
3039
|
+
"slots": [
|
|
3040
|
+
{
|
|
3041
|
+
"description": "The tab panel content",
|
|
3042
|
+
"name": ""
|
|
3043
|
+
},
|
|
2322
3044
|
{
|
|
2323
3045
|
"description": "Optional icon to display in the tab header",
|
|
2324
3046
|
"name": "icon"
|
|
@@ -2714,50 +3436,6 @@
|
|
|
2714
3436
|
}
|
|
2715
3437
|
]
|
|
2716
3438
|
},
|
|
2717
|
-
{
|
|
2718
|
-
"kind": "javascript-module",
|
|
2719
|
-
"path": "dist/form/select/select-option.js",
|
|
2720
|
-
"declarations": [
|
|
2721
|
-
{
|
|
2722
|
-
"kind": "variable",
|
|
2723
|
-
"name": "KRSelectOption",
|
|
2724
|
-
"default": "class KRSelectOption extends LitElement { constructor() { super(...arguments); /** * The option value */ this.value = ''; /** * Whether the option is disabled */ this.disabled = false; } /** Gets the label text from the slot */ get label() { return this.textContent?.trim() || ''; } render() { return html `<slot></slot>`; } }",
|
|
2725
|
-
"description": "An option for the kr-select component."
|
|
2726
|
-
}
|
|
2727
|
-
],
|
|
2728
|
-
"exports": [
|
|
2729
|
-
{
|
|
2730
|
-
"kind": "js",
|
|
2731
|
-
"name": "KRSelectOption",
|
|
2732
|
-
"declaration": {
|
|
2733
|
-
"name": "KRSelectOption",
|
|
2734
|
-
"module": "dist/form/select/select-option.js"
|
|
2735
|
-
}
|
|
2736
|
-
}
|
|
2737
|
-
]
|
|
2738
|
-
},
|
|
2739
|
-
{
|
|
2740
|
-
"kind": "javascript-module",
|
|
2741
|
-
"path": "dist/form/select/select.js",
|
|
2742
|
-
"declarations": [
|
|
2743
|
-
{
|
|
2744
|
-
"kind": "variable",
|
|
2745
|
-
"name": "KRSelect",
|
|
2746
|
-
"default": "class KRSelect extends LitElement { constructor() { super(); /** * The select label text */ this.label = ''; /** * The input name for form submission */ this.name = ''; /** * The currently selected value */ this.value = ''; /** * Placeholder text when no option is selected */ this.placeholder = 'Select an option'; /** * Whether the select is disabled */ this.disabled = false; /** * Whether the field is required */ this.required = false; /** * Whether the field is readonly */ this.readonly = false; /** * Helper text shown below the select */ this.hint = ''; this._isOpen = false; this._highlightedIndex = -1; this._touched = false; this._handleInvalid = (e) => { e.preventDefault(); this._touched = true; }; this._handleOutsideClick = (e) => { if (!this.contains(e.target)) { this._close(); } }; this._handleKeyDown = (e) => { if (!this._isOpen) return; const options = Array.from(this.querySelectorAll('kr-select-option')); switch (e.key) { case 'Escape': this._close(); this._triggerElement?.focus(); break; case 'ArrowDown': e.preventDefault(); if (options.some(o => !o.disabled)) { let newIndex = this._highlightedIndex + 1; while (newIndex < options.length && options[newIndex]?.disabled) newIndex++; if (newIndex < options.length) this._highlightedIndex = newIndex; } break; case 'ArrowUp': e.preventDefault(); { let newIndex = this._highlightedIndex - 1; while (newIndex >= 0 && options[newIndex]?.disabled) newIndex--; if (newIndex >= 0) this._highlightedIndex = newIndex; } break; case 'Enter': e.preventDefault(); if (this._highlightedIndex >= 0 && this._highlightedIndex < options.length) { this._selectOption(options[this._highlightedIndex]); } break; } }; this._internals = this.attachInternals(); } // Form-associated custom element callbacks get form() { return this._internals.form; } get validity() { return this._internals.validity; } get validationMessage() { return this._internals.validationMessage; } get willValidate() { return this._internals.willValidate; } checkValidity() { return this._internals.checkValidity(); } reportValidity() { return this._internals.reportValidity(); } formResetCallback() { this.value = ''; this._touched = false; this._internals.setFormValue(''); this._internals.setValidity({}); } formStateRestoreCallback(state) { this.value = state; } connectedCallback() { super.connectedCallback(); document.addEventListener('click', this._handleOutsideClick); document.addEventListener('keydown', this._handleKeyDown); this.addEventListener('invalid', this._handleInvalid); } firstUpdated() { this._updateValidity(); } updated(changedProperties) { if (changedProperties.has('required') || changedProperties.has('value')) { this._updateValidity(); } } disconnectedCallback() { super.disconnectedCallback(); document.removeEventListener('click', this._handleOutsideClick); document.removeEventListener('keydown', this._handleKeyDown); this.removeEventListener('invalid', this._handleInvalid); } _toggle() { if (this.disabled || this.readonly) return; if (this._isOpen) { this._close(); } else { this._isOpen = true; const options = Array.from(this.querySelectorAll('kr-select-option')); this._highlightedIndex = options.findIndex(o => o.value === this.value); } } _close() { this._isOpen = false; this._highlightedIndex = -1; } _selectOption(option) { if (option.disabled) return; this.value = option.value; this._internals.setFormValue(this.value); this._updateValidity(); this.dispatchEvent(new Event('change', { bubbles: true, composed: true })); this._close(); this._triggerElement?.focus(); } _handleBlur() { this._touched = true; this._updateValidity(); } _updateValidity() { if (this.required && !this.value) { this._internals.setValidity({ valueMissing: true }, 'Please select an option', this._triggerElement); } else { this._internals.setValidity({}); } } render() { const options = Array.from(this.querySelectorAll('kr-select-option')); const selectedLabel = options.find(o => o.value === this.value)?.label; return html ` <div class=\"wrapper\"> ${this.label ? html ` <label> ${this.label} ${this.required ? html `<span class=\"required\" aria-hidden=\"true\">*</span>` : ''} </label> ` : nothing} <div class=\"select-wrapper\"> <button class=${classMap({ 'select-trigger': true, 'select-trigger--open': this._isOpen, 'select-trigger--invalid': this._touched && this.required && !this.value, })} type=\"button\" ?disabled=${this.disabled} aria-haspopup=\"listbox\" aria-expanded=${this._isOpen} @click=${this._toggle} @blur=${this._handleBlur} > <span class=${classMap({ 'select-value': true, 'select-placeholder': !selectedLabel })}> ${selectedLabel || this.placeholder} </span> <svg class=${classMap({ 'chevron-icon': true, 'select-icon': true, 'select-icon--open': this._isOpen })} viewBox=\"0 0 20 20\" fill=\"currentColor\" > <path fill-rule=\"evenodd\" d=\"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z\" clip-rule=\"evenodd\" /> </svg> </button> <div class=${classMap({ 'select-dropdown': true, 'hidden': !this._isOpen })} role=\"listbox\"> <div class=\"select-options\"> ${options.length === 0 ? html `<div class=\"select-empty\">No options available</div>` : options.map((option, idx) => { const isSelected = option.value === this.value; return html ` <div class=${classMap({ 'select-option': true, 'select-option--selected': isSelected, 'select-option--disabled': option.disabled, 'select-option--highlighted': idx === this._highlightedIndex, })} role=\"option\" aria-selected=${isSelected} @click=${() => this._selectOption(option)} @mouseenter=${() => (this._highlightedIndex = idx)} > ${option.label} ${isSelected ? html `<svg class=\"chevron-icon select-check\" viewBox=\"0 0 20 20\" fill=\"currentColor\"> <path fill-rule=\"evenodd\" d=\"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z\" clip-rule=\"evenodd\" /> </svg>` : nothing} </div> `; })} </div> </div> </div> ${this._touched && this.required && !this.value ? html `<div class=\"validation-message\">Please select an option</div>` : this.hint ? html `<div class=\"hint\">${this.hint}</div>` : ''} </div> <div class=\"options-slot\"> <slot @slotchange=${() => this.requestUpdate()}></slot> </div> `; } // Public methods for programmatic control focus() { this._triggerElement?.focus(); } blur() { this._triggerElement?.blur(); } }",
|
|
2747
|
-
"description": "A select dropdown component that works with native browser forms.\n\nUses ElementInternals for form association, allowing the component\nto participate in form submission, validation, and reset."
|
|
2748
|
-
}
|
|
2749
|
-
],
|
|
2750
|
-
"exports": [
|
|
2751
|
-
{
|
|
2752
|
-
"kind": "js",
|
|
2753
|
-
"name": "KRSelect",
|
|
2754
|
-
"declaration": {
|
|
2755
|
-
"name": "KRSelect",
|
|
2756
|
-
"module": "dist/form/select/select.js"
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
]
|
|
2760
|
-
},
|
|
2761
3439
|
{
|
|
2762
3440
|
"kind": "javascript-module",
|
|
2763
3441
|
"path": "dist/form/text-field/text-field.js",
|
|
@@ -2782,110 +3460,12 @@
|
|
|
2782
3460
|
},
|
|
2783
3461
|
{
|
|
2784
3462
|
"kind": "javascript-module",
|
|
2785
|
-
"path": "src/form/
|
|
2786
|
-
"declarations": [
|
|
2787
|
-
{
|
|
2788
|
-
"kind": "class",
|
|
2789
|
-
"description": "An option for the kr-select component.",
|
|
2790
|
-
"name": "KRSelectOption",
|
|
2791
|
-
"slots": [
|
|
2792
|
-
{
|
|
2793
|
-
"description": "The option label content",
|
|
2794
|
-
"name": ""
|
|
2795
|
-
}
|
|
2796
|
-
],
|
|
2797
|
-
"members": [
|
|
2798
|
-
{
|
|
2799
|
-
"kind": "field",
|
|
2800
|
-
"name": "value",
|
|
2801
|
-
"type": {
|
|
2802
|
-
"text": "string"
|
|
2803
|
-
},
|
|
2804
|
-
"default": "''",
|
|
2805
|
-
"description": "The option value",
|
|
2806
|
-
"attribute": "value"
|
|
2807
|
-
},
|
|
2808
|
-
{
|
|
2809
|
-
"kind": "field",
|
|
2810
|
-
"name": "disabled",
|
|
2811
|
-
"type": {
|
|
2812
|
-
"text": "boolean"
|
|
2813
|
-
},
|
|
2814
|
-
"default": "false",
|
|
2815
|
-
"description": "Whether the option is disabled",
|
|
2816
|
-
"attribute": "disabled"
|
|
2817
|
-
},
|
|
2818
|
-
{
|
|
2819
|
-
"kind": "field",
|
|
2820
|
-
"name": "label",
|
|
2821
|
-
"type": {
|
|
2822
|
-
"text": "string"
|
|
2823
|
-
},
|
|
2824
|
-
"description": "Gets the label text from the slot",
|
|
2825
|
-
"readonly": true
|
|
2826
|
-
}
|
|
2827
|
-
],
|
|
2828
|
-
"attributes": [
|
|
2829
|
-
{
|
|
2830
|
-
"name": "value",
|
|
2831
|
-
"type": {
|
|
2832
|
-
"text": "string"
|
|
2833
|
-
},
|
|
2834
|
-
"default": "''",
|
|
2835
|
-
"description": "The option value",
|
|
2836
|
-
"fieldName": "value"
|
|
2837
|
-
},
|
|
2838
|
-
{
|
|
2839
|
-
"name": "disabled",
|
|
2840
|
-
"type": {
|
|
2841
|
-
"text": "boolean"
|
|
2842
|
-
},
|
|
2843
|
-
"default": "false",
|
|
2844
|
-
"description": "Whether the option is disabled",
|
|
2845
|
-
"fieldName": "disabled"
|
|
2846
|
-
}
|
|
2847
|
-
],
|
|
2848
|
-
"superclass": {
|
|
2849
|
-
"name": "LitElement",
|
|
2850
|
-
"package": "lit"
|
|
2851
|
-
},
|
|
2852
|
-
"tagName": "kr-select-option",
|
|
2853
|
-
"customElement": true
|
|
2854
|
-
}
|
|
2855
|
-
],
|
|
2856
|
-
"exports": [
|
|
2857
|
-
{
|
|
2858
|
-
"kind": "js",
|
|
2859
|
-
"name": "KRSelectOption",
|
|
2860
|
-
"declaration": {
|
|
2861
|
-
"name": "KRSelectOption",
|
|
2862
|
-
"module": "src/form/select/select-option.ts"
|
|
2863
|
-
}
|
|
2864
|
-
},
|
|
2865
|
-
{
|
|
2866
|
-
"kind": "custom-element-definition",
|
|
2867
|
-
"name": "kr-select-option",
|
|
2868
|
-
"declaration": {
|
|
2869
|
-
"name": "KRSelectOption",
|
|
2870
|
-
"module": "src/form/select/select-option.ts"
|
|
2871
|
-
}
|
|
2872
|
-
}
|
|
2873
|
-
]
|
|
2874
|
-
},
|
|
2875
|
-
{
|
|
2876
|
-
"kind": "javascript-module",
|
|
2877
|
-
"path": "src/form/select/select.ts",
|
|
3463
|
+
"path": "src/form/text-field/text-field.ts",
|
|
2878
3464
|
"declarations": [
|
|
2879
3465
|
{
|
|
2880
3466
|
"kind": "class",
|
|
2881
|
-
"description": "A
|
|
2882
|
-
"name": "
|
|
2883
|
-
"slots": [
|
|
2884
|
-
{
|
|
2885
|
-
"description": "The kr-select-option elements",
|
|
2886
|
-
"name": ""
|
|
2887
|
-
}
|
|
2888
|
-
],
|
|
3467
|
+
"description": "A text field component that works with native browser forms.\n\nUses ElementInternals for form association, allowing the component\nto participate in form submission, validation, and reset.\n\nNative input and change events bubble up from the inner input element.",
|
|
3468
|
+
"name": "KRTextField",
|
|
2889
3469
|
"members": [
|
|
2890
3470
|
{
|
|
2891
3471
|
"kind": "field",
|
|
@@ -2911,7 +3491,7 @@
|
|
|
2911
3491
|
"text": "string"
|
|
2912
3492
|
},
|
|
2913
3493
|
"default": "''",
|
|
2914
|
-
"description": "The
|
|
3494
|
+
"description": "The input label text",
|
|
2915
3495
|
"attribute": "label"
|
|
2916
3496
|
},
|
|
2917
3497
|
{
|
|
@@ -2931,7 +3511,7 @@
|
|
|
2931
3511
|
"text": "string"
|
|
2932
3512
|
},
|
|
2933
3513
|
"default": "''",
|
|
2934
|
-
"description": "The
|
|
3514
|
+
"description": "The current value",
|
|
2935
3515
|
"attribute": "value"
|
|
2936
3516
|
},
|
|
2937
3517
|
{
|
|
@@ -2940,19 +3520,19 @@
|
|
|
2940
3520
|
"type": {
|
|
2941
3521
|
"text": "string"
|
|
2942
3522
|
},
|
|
2943
|
-
"default": "'
|
|
2944
|
-
"description": "Placeholder text
|
|
3523
|
+
"default": "''",
|
|
3524
|
+
"description": "Placeholder text",
|
|
2945
3525
|
"attribute": "placeholder"
|
|
2946
3526
|
},
|
|
2947
3527
|
{
|
|
2948
3528
|
"kind": "field",
|
|
2949
|
-
"name": "
|
|
3529
|
+
"name": "type",
|
|
2950
3530
|
"type": {
|
|
2951
|
-
"text": "
|
|
3531
|
+
"text": "'text' | 'email' | 'password' | 'tel' | 'url' | 'search'"
|
|
2952
3532
|
},
|
|
2953
|
-
"default": "
|
|
2954
|
-
"description": "
|
|
2955
|
-
"attribute": "
|
|
3533
|
+
"default": "'text'",
|
|
3534
|
+
"description": "Input type (text, email, password, tel, url, search)",
|
|
3535
|
+
"attribute": "type"
|
|
2956
3536
|
},
|
|
2957
3537
|
{
|
|
2958
3538
|
"kind": "field",
|
|
@@ -2964,6 +3544,16 @@
|
|
|
2964
3544
|
"description": "Whether the field is required",
|
|
2965
3545
|
"attribute": "required"
|
|
2966
3546
|
},
|
|
3547
|
+
{
|
|
3548
|
+
"kind": "field",
|
|
3549
|
+
"name": "disabled",
|
|
3550
|
+
"type": {
|
|
3551
|
+
"text": "boolean"
|
|
3552
|
+
},
|
|
3553
|
+
"default": "false",
|
|
3554
|
+
"description": "Whether the field is disabled",
|
|
3555
|
+
"attribute": "disabled"
|
|
3556
|
+
},
|
|
2967
3557
|
{
|
|
2968
3558
|
"kind": "field",
|
|
2969
3559
|
"name": "readonly",
|
|
@@ -2976,31 +3566,58 @@
|
|
|
2976
3566
|
},
|
|
2977
3567
|
{
|
|
2978
3568
|
"kind": "field",
|
|
2979
|
-
"name": "
|
|
3569
|
+
"name": "minlength",
|
|
3570
|
+
"type": {
|
|
3571
|
+
"text": "number | undefined"
|
|
3572
|
+
},
|
|
3573
|
+
"description": "Minimum length for the value",
|
|
3574
|
+
"attribute": "minlength"
|
|
3575
|
+
},
|
|
3576
|
+
{
|
|
3577
|
+
"kind": "field",
|
|
3578
|
+
"name": "maxlength",
|
|
3579
|
+
"type": {
|
|
3580
|
+
"text": "number | undefined"
|
|
3581
|
+
},
|
|
3582
|
+
"description": "Maximum length for the value",
|
|
3583
|
+
"attribute": "maxlength"
|
|
3584
|
+
},
|
|
3585
|
+
{
|
|
3586
|
+
"kind": "field",
|
|
3587
|
+
"name": "pattern",
|
|
3588
|
+
"type": {
|
|
3589
|
+
"text": "string | undefined"
|
|
3590
|
+
},
|
|
3591
|
+
"description": "Pattern for validation (regex)",
|
|
3592
|
+
"attribute": "pattern"
|
|
3593
|
+
},
|
|
3594
|
+
{
|
|
3595
|
+
"kind": "field",
|
|
3596
|
+
"name": "autocomplete",
|
|
2980
3597
|
"type": {
|
|
2981
3598
|
"text": "string"
|
|
2982
3599
|
},
|
|
2983
3600
|
"default": "''",
|
|
2984
|
-
"description": "
|
|
2985
|
-
"attribute": "
|
|
3601
|
+
"description": "Autocomplete attribute value",
|
|
3602
|
+
"attribute": "autocomplete"
|
|
2986
3603
|
},
|
|
2987
3604
|
{
|
|
2988
3605
|
"kind": "field",
|
|
2989
|
-
"name": "
|
|
3606
|
+
"name": "hint",
|
|
2990
3607
|
"type": {
|
|
2991
|
-
"text": "
|
|
3608
|
+
"text": "string"
|
|
2992
3609
|
},
|
|
2993
|
-
"
|
|
2994
|
-
"
|
|
3610
|
+
"default": "''",
|
|
3611
|
+
"description": "Helper text shown below the input",
|
|
3612
|
+
"attribute": "hint"
|
|
2995
3613
|
},
|
|
2996
3614
|
{
|
|
2997
3615
|
"kind": "field",
|
|
2998
|
-
"name": "
|
|
3616
|
+
"name": "_input",
|
|
2999
3617
|
"type": {
|
|
3000
|
-
"text": "
|
|
3618
|
+
"text": "HTMLInputElement"
|
|
3001
3619
|
},
|
|
3002
|
-
"privacy": "private"
|
|
3003
|
-
"default": "-1"
|
|
3620
|
+
"privacy": "private"
|
|
3004
3621
|
},
|
|
3005
3622
|
{
|
|
3006
3623
|
"kind": "field",
|
|
@@ -3013,11 +3630,12 @@
|
|
|
3013
3630
|
},
|
|
3014
3631
|
{
|
|
3015
3632
|
"kind": "field",
|
|
3016
|
-
"name": "
|
|
3633
|
+
"name": "_dirty",
|
|
3017
3634
|
"type": {
|
|
3018
|
-
"text": "
|
|
3635
|
+
"text": "boolean"
|
|
3019
3636
|
},
|
|
3020
|
-
"privacy": "private"
|
|
3637
|
+
"privacy": "private",
|
|
3638
|
+
"default": "false"
|
|
3021
3639
|
},
|
|
3022
3640
|
{
|
|
3023
3641
|
"kind": "field",
|
|
@@ -3068,35 +3686,33 @@
|
|
|
3068
3686
|
"name": "_handleInvalid",
|
|
3069
3687
|
"privacy": "private"
|
|
3070
3688
|
},
|
|
3071
|
-
{
|
|
3072
|
-
"kind": "field",
|
|
3073
|
-
"name": "_handleOutsideClick",
|
|
3074
|
-
"privacy": "private"
|
|
3075
|
-
},
|
|
3076
|
-
{
|
|
3077
|
-
"kind": "field",
|
|
3078
|
-
"name": "_handleKeyDown",
|
|
3079
|
-
"privacy": "private"
|
|
3080
|
-
},
|
|
3081
3689
|
{
|
|
3082
3690
|
"kind": "method",
|
|
3083
|
-
"name": "
|
|
3691
|
+
"name": "_updateValidity",
|
|
3084
3692
|
"privacy": "private"
|
|
3085
3693
|
},
|
|
3086
3694
|
{
|
|
3087
3695
|
"kind": "method",
|
|
3088
|
-
"name": "
|
|
3089
|
-
"privacy": "private"
|
|
3696
|
+
"name": "_handleInput",
|
|
3697
|
+
"privacy": "private",
|
|
3698
|
+
"parameters": [
|
|
3699
|
+
{
|
|
3700
|
+
"name": "e",
|
|
3701
|
+
"type": {
|
|
3702
|
+
"text": "Event"
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
]
|
|
3090
3706
|
},
|
|
3091
3707
|
{
|
|
3092
3708
|
"kind": "method",
|
|
3093
|
-
"name": "
|
|
3709
|
+
"name": "_handleChange",
|
|
3094
3710
|
"privacy": "private",
|
|
3095
3711
|
"parameters": [
|
|
3096
3712
|
{
|
|
3097
|
-
"name": "
|
|
3713
|
+
"name": "e",
|
|
3098
3714
|
"type": {
|
|
3099
|
-
"text": "
|
|
3715
|
+
"text": "Event"
|
|
3100
3716
|
}
|
|
3101
3717
|
}
|
|
3102
3718
|
]
|
|
@@ -3106,11 +3722,6 @@
|
|
|
3106
3722
|
"name": "_handleBlur",
|
|
3107
3723
|
"privacy": "private"
|
|
3108
3724
|
},
|
|
3109
|
-
{
|
|
3110
|
-
"kind": "method",
|
|
3111
|
-
"name": "_updateValidity",
|
|
3112
|
-
"privacy": "private"
|
|
3113
|
-
},
|
|
3114
3725
|
{
|
|
3115
3726
|
"kind": "method",
|
|
3116
3727
|
"name": "focus"
|
|
@@ -3118,14 +3729,10 @@
|
|
|
3118
3729
|
{
|
|
3119
3730
|
"kind": "method",
|
|
3120
3731
|
"name": "blur"
|
|
3121
|
-
}
|
|
3122
|
-
],
|
|
3123
|
-
"events": [
|
|
3732
|
+
},
|
|
3124
3733
|
{
|
|
3125
|
-
"
|
|
3126
|
-
"
|
|
3127
|
-
"text": "Event"
|
|
3128
|
-
}
|
|
3734
|
+
"kind": "method",
|
|
3735
|
+
"name": "select"
|
|
3129
3736
|
}
|
|
3130
3737
|
],
|
|
3131
3738
|
"attributes": [
|
|
@@ -3135,7 +3742,7 @@
|
|
|
3135
3742
|
"text": "string"
|
|
3136
3743
|
},
|
|
3137
3744
|
"default": "''",
|
|
3138
|
-
"description": "The
|
|
3745
|
+
"description": "The input label text",
|
|
3139
3746
|
"fieldName": "label"
|
|
3140
3747
|
},
|
|
3141
3748
|
{
|
|
@@ -3153,7 +3760,7 @@
|
|
|
3153
3760
|
"text": "string"
|
|
3154
3761
|
},
|
|
3155
3762
|
"default": "''",
|
|
3156
|
-
"description": "The
|
|
3763
|
+
"description": "The current value",
|
|
3157
3764
|
"fieldName": "value"
|
|
3158
3765
|
},
|
|
3159
3766
|
{
|
|
@@ -3161,82 +3768,266 @@
|
|
|
3161
3768
|
"type": {
|
|
3162
3769
|
"text": "string"
|
|
3163
3770
|
},
|
|
3164
|
-
"default": "'
|
|
3165
|
-
"description": "Placeholder text
|
|
3771
|
+
"default": "''",
|
|
3772
|
+
"description": "Placeholder text",
|
|
3166
3773
|
"fieldName": "placeholder"
|
|
3167
3774
|
},
|
|
3775
|
+
{
|
|
3776
|
+
"name": "type",
|
|
3777
|
+
"type": {
|
|
3778
|
+
"text": "'text' | 'email' | 'password' | 'tel' | 'url' | 'search'"
|
|
3779
|
+
},
|
|
3780
|
+
"default": "'text'",
|
|
3781
|
+
"description": "Input type (text, email, password, tel, url, search)",
|
|
3782
|
+
"fieldName": "type"
|
|
3783
|
+
},
|
|
3784
|
+
{
|
|
3785
|
+
"name": "required",
|
|
3786
|
+
"type": {
|
|
3787
|
+
"text": "boolean"
|
|
3788
|
+
},
|
|
3789
|
+
"default": "false",
|
|
3790
|
+
"description": "Whether the field is required",
|
|
3791
|
+
"fieldName": "required"
|
|
3792
|
+
},
|
|
3168
3793
|
{
|
|
3169
3794
|
"name": "disabled",
|
|
3170
3795
|
"type": {
|
|
3171
3796
|
"text": "boolean"
|
|
3172
3797
|
},
|
|
3173
3798
|
"default": "false",
|
|
3174
|
-
"description": "Whether the
|
|
3799
|
+
"description": "Whether the field is disabled",
|
|
3175
3800
|
"fieldName": "disabled"
|
|
3176
3801
|
},
|
|
3177
3802
|
{
|
|
3178
|
-
"name": "
|
|
3803
|
+
"name": "readonly",
|
|
3804
|
+
"type": {
|
|
3805
|
+
"text": "boolean"
|
|
3806
|
+
},
|
|
3807
|
+
"default": "false",
|
|
3808
|
+
"description": "Whether the field is readonly",
|
|
3809
|
+
"fieldName": "readonly"
|
|
3810
|
+
},
|
|
3811
|
+
{
|
|
3812
|
+
"name": "minlength",
|
|
3813
|
+
"type": {
|
|
3814
|
+
"text": "number | undefined"
|
|
3815
|
+
},
|
|
3816
|
+
"description": "Minimum length for the value",
|
|
3817
|
+
"fieldName": "minlength"
|
|
3818
|
+
},
|
|
3819
|
+
{
|
|
3820
|
+
"name": "maxlength",
|
|
3821
|
+
"type": {
|
|
3822
|
+
"text": "number | undefined"
|
|
3823
|
+
},
|
|
3824
|
+
"description": "Maximum length for the value",
|
|
3825
|
+
"fieldName": "maxlength"
|
|
3826
|
+
},
|
|
3827
|
+
{
|
|
3828
|
+
"name": "pattern",
|
|
3829
|
+
"type": {
|
|
3830
|
+
"text": "string | undefined"
|
|
3831
|
+
},
|
|
3832
|
+
"description": "Pattern for validation (regex)",
|
|
3833
|
+
"fieldName": "pattern"
|
|
3834
|
+
},
|
|
3835
|
+
{
|
|
3836
|
+
"name": "autocomplete",
|
|
3837
|
+
"type": {
|
|
3838
|
+
"text": "string"
|
|
3839
|
+
},
|
|
3840
|
+
"default": "''",
|
|
3841
|
+
"description": "Autocomplete attribute value",
|
|
3842
|
+
"fieldName": "autocomplete"
|
|
3843
|
+
},
|
|
3844
|
+
{
|
|
3845
|
+
"name": "hint",
|
|
3846
|
+
"type": {
|
|
3847
|
+
"text": "string"
|
|
3848
|
+
},
|
|
3849
|
+
"default": "''",
|
|
3850
|
+
"description": "Helper text shown below the input",
|
|
3851
|
+
"fieldName": "hint"
|
|
3852
|
+
}
|
|
3853
|
+
],
|
|
3854
|
+
"superclass": {
|
|
3855
|
+
"name": "LitElement",
|
|
3856
|
+
"package": "lit"
|
|
3857
|
+
},
|
|
3858
|
+
"tagName": "kr-text-field",
|
|
3859
|
+
"customElement": true
|
|
3860
|
+
}
|
|
3861
|
+
],
|
|
3862
|
+
"exports": [
|
|
3863
|
+
{
|
|
3864
|
+
"kind": "js",
|
|
3865
|
+
"name": "KRTextField",
|
|
3866
|
+
"declaration": {
|
|
3867
|
+
"name": "KRTextField",
|
|
3868
|
+
"module": "src/form/text-field/text-field.ts"
|
|
3869
|
+
}
|
|
3870
|
+
},
|
|
3871
|
+
{
|
|
3872
|
+
"kind": "custom-element-definition",
|
|
3873
|
+
"name": "kr-text-field",
|
|
3874
|
+
"declaration": {
|
|
3875
|
+
"name": "KRTextField",
|
|
3876
|
+
"module": "src/form/text-field/text-field.ts"
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
]
|
|
3880
|
+
},
|
|
3881
|
+
{
|
|
3882
|
+
"kind": "javascript-module",
|
|
3883
|
+
"path": "dist/form/select/select-option.js",
|
|
3884
|
+
"declarations": [
|
|
3885
|
+
{
|
|
3886
|
+
"kind": "variable",
|
|
3887
|
+
"name": "KRSelectOption",
|
|
3888
|
+
"default": "class KRSelectOption extends LitElement { constructor() { super(...arguments); /** * The option value */ this.value = ''; /** * Whether the option is disabled */ this.disabled = false; } /** Gets the label text from the slot */ get label() { return this.textContent?.trim() || ''; } render() { return html `<slot></slot>`; } }",
|
|
3889
|
+
"description": "An option for the kr-select component."
|
|
3890
|
+
}
|
|
3891
|
+
],
|
|
3892
|
+
"exports": [
|
|
3893
|
+
{
|
|
3894
|
+
"kind": "js",
|
|
3895
|
+
"name": "KRSelectOption",
|
|
3896
|
+
"declaration": {
|
|
3897
|
+
"name": "KRSelectOption",
|
|
3898
|
+
"module": "dist/form/select/select-option.js"
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
]
|
|
3902
|
+
},
|
|
3903
|
+
{
|
|
3904
|
+
"kind": "javascript-module",
|
|
3905
|
+
"path": "dist/form/select/select.js",
|
|
3906
|
+
"declarations": [
|
|
3907
|
+
{
|
|
3908
|
+
"kind": "variable",
|
|
3909
|
+
"name": "KRSelect",
|
|
3910
|
+
"default": "class KRSelect extends LitElement { constructor() { super(); /** * The select label text */ this.label = ''; /** * The input name for form submission */ this.name = ''; /** * The currently selected value */ this.value = ''; /** * Placeholder text when no option is selected */ this.placeholder = 'Select an option'; /** * Whether the select is disabled */ this.disabled = false; /** * Whether the field is required */ this.required = false; /** * Whether the field is readonly */ this.readonly = false; /** * Helper text shown below the select */ this.hint = ''; this._isOpen = false; this._highlightedIndex = -1; this._touched = false; this._handleInvalid = (e) => { e.preventDefault(); this._touched = true; }; this._handleOutsideClick = (e) => { if (!this.contains(e.target)) { this._close(); } }; this._handleKeyDown = (e) => { if (!this._isOpen) return; const options = Array.from(this.querySelectorAll('kr-select-option')); switch (e.key) { case 'Escape': this._close(); this._triggerElement?.focus(); break; case 'ArrowDown': e.preventDefault(); if (options.some(o => !o.disabled)) { let newIndex = this._highlightedIndex + 1; while (newIndex < options.length && options[newIndex]?.disabled) newIndex++; if (newIndex < options.length) this._highlightedIndex = newIndex; } break; case 'ArrowUp': e.preventDefault(); { let newIndex = this._highlightedIndex - 1; while (newIndex >= 0 && options[newIndex]?.disabled) newIndex--; if (newIndex >= 0) this._highlightedIndex = newIndex; } break; case 'Enter': e.preventDefault(); if (this._highlightedIndex >= 0 && this._highlightedIndex < options.length) { this._selectOption(options[this._highlightedIndex]); } break; } }; this._internals = this.attachInternals(); } // Form-associated custom element callbacks get form() { return this._internals.form; } get validity() { return this._internals.validity; } get validationMessage() { return this._internals.validationMessage; } get willValidate() { return this._internals.willValidate; } checkValidity() { return this._internals.checkValidity(); } reportValidity() { return this._internals.reportValidity(); } formResetCallback() { this.value = ''; this._touched = false; this._internals.setFormValue(''); this._internals.setValidity({}); } formStateRestoreCallback(state) { this.value = state; } connectedCallback() { super.connectedCallback(); document.addEventListener('click', this._handleOutsideClick); document.addEventListener('keydown', this._handleKeyDown); this.addEventListener('invalid', this._handleInvalid); } firstUpdated() { this._updateValidity(); } updated(changedProperties) { if (changedProperties.has('required') || changedProperties.has('value')) { this._updateValidity(); } } disconnectedCallback() { super.disconnectedCallback(); document.removeEventListener('click', this._handleOutsideClick); document.removeEventListener('keydown', this._handleKeyDown); this.removeEventListener('invalid', this._handleInvalid); } _toggle() { if (this.disabled || this.readonly) return; if (this._isOpen) { this._close(); } else { this._isOpen = true; const options = Array.from(this.querySelectorAll('kr-select-option')); this._highlightedIndex = options.findIndex(o => o.value === this.value); } } _close() { this._isOpen = false; this._highlightedIndex = -1; } _selectOption(option) { if (option.disabled) return; this.value = option.value; this._internals.setFormValue(this.value); this._updateValidity(); this.dispatchEvent(new Event('change', { bubbles: true, composed: true })); this._close(); this._triggerElement?.focus(); } _handleBlur() { this._touched = true; this._updateValidity(); } _updateValidity() { if (this.required && !this.value) { this._internals.setValidity({ valueMissing: true }, 'Please select an option', this._triggerElement); } else { this._internals.setValidity({}); } } render() { const options = Array.from(this.querySelectorAll('kr-select-option')); const selectedLabel = options.find(o => o.value === this.value)?.label; return html ` <div class=\"wrapper\"> ${this.label ? html ` <label> ${this.label} ${this.required ? html `<span class=\"required\" aria-hidden=\"true\">*</span>` : ''} </label> ` : nothing} <div class=\"select-wrapper\"> <button class=${classMap({ 'select-trigger': true, 'select-trigger--open': this._isOpen, 'select-trigger--invalid': this._touched && this.required && !this.value, })} type=\"button\" ?disabled=${this.disabled} aria-haspopup=\"listbox\" aria-expanded=${this._isOpen} @click=${this._toggle} @blur=${this._handleBlur} > <span class=${classMap({ 'select-value': true, 'select-placeholder': !selectedLabel })}> ${selectedLabel || this.placeholder} </span> <svg class=${classMap({ 'chevron-icon': true, 'select-icon': true, 'select-icon--open': this._isOpen })} viewBox=\"0 0 20 20\" fill=\"currentColor\" > <path fill-rule=\"evenodd\" d=\"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z\" clip-rule=\"evenodd\" /> </svg> </button> <div class=${classMap({ 'select-dropdown': true, 'hidden': !this._isOpen })} role=\"listbox\"> <div class=\"select-options\"> ${options.length === 0 ? html `<div class=\"select-empty\">No options available</div>` : options.map((option, idx) => { const isSelected = option.value === this.value; return html ` <div class=${classMap({ 'select-option': true, 'select-option--selected': isSelected, 'select-option--disabled': option.disabled, 'select-option--highlighted': idx === this._highlightedIndex, })} role=\"option\" aria-selected=${isSelected} @click=${() => this._selectOption(option)} @mouseenter=${() => (this._highlightedIndex = idx)} > ${option.label} ${isSelected ? html `<svg class=\"chevron-icon select-check\" viewBox=\"0 0 20 20\" fill=\"currentColor\"> <path fill-rule=\"evenodd\" d=\"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z\" clip-rule=\"evenodd\" /> </svg>` : nothing} </div> `; })} </div> </div> </div> ${this._touched && this.required && !this.value ? html `<div class=\"validation-message\">Please select an option</div>` : this.hint ? html `<div class=\"hint\">${this.hint}</div>` : ''} </div> <div class=\"options-slot\"> <slot @slotchange=${() => this.requestUpdate()}></slot> </div> `; } // Public methods for programmatic control focus() { this._triggerElement?.focus(); } blur() { this._triggerElement?.blur(); } }",
|
|
3911
|
+
"description": "A select dropdown component that works with native browser forms.\n\nUses ElementInternals for form association, allowing the component\nto participate in form submission, validation, and reset."
|
|
3912
|
+
}
|
|
3913
|
+
],
|
|
3914
|
+
"exports": [
|
|
3915
|
+
{
|
|
3916
|
+
"kind": "js",
|
|
3917
|
+
"name": "KRSelect",
|
|
3918
|
+
"declaration": {
|
|
3919
|
+
"name": "KRSelect",
|
|
3920
|
+
"module": "dist/form/select/select.js"
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
]
|
|
3924
|
+
},
|
|
3925
|
+
{
|
|
3926
|
+
"kind": "javascript-module",
|
|
3927
|
+
"path": "src/form/select/select-option.ts",
|
|
3928
|
+
"declarations": [
|
|
3929
|
+
{
|
|
3930
|
+
"kind": "class",
|
|
3931
|
+
"description": "An option for the kr-select component.",
|
|
3932
|
+
"name": "KRSelectOption",
|
|
3933
|
+
"slots": [
|
|
3934
|
+
{
|
|
3935
|
+
"description": "The option label content",
|
|
3936
|
+
"name": ""
|
|
3937
|
+
}
|
|
3938
|
+
],
|
|
3939
|
+
"members": [
|
|
3940
|
+
{
|
|
3941
|
+
"kind": "field",
|
|
3942
|
+
"name": "value",
|
|
3943
|
+
"type": {
|
|
3944
|
+
"text": "string"
|
|
3945
|
+
},
|
|
3946
|
+
"default": "''",
|
|
3947
|
+
"description": "The option value",
|
|
3948
|
+
"attribute": "value"
|
|
3949
|
+
},
|
|
3950
|
+
{
|
|
3951
|
+
"kind": "field",
|
|
3952
|
+
"name": "disabled",
|
|
3953
|
+
"type": {
|
|
3954
|
+
"text": "boolean"
|
|
3955
|
+
},
|
|
3956
|
+
"default": "false",
|
|
3957
|
+
"description": "Whether the option is disabled",
|
|
3958
|
+
"attribute": "disabled"
|
|
3959
|
+
},
|
|
3960
|
+
{
|
|
3961
|
+
"kind": "field",
|
|
3962
|
+
"name": "label",
|
|
3963
|
+
"type": {
|
|
3964
|
+
"text": "string"
|
|
3965
|
+
},
|
|
3966
|
+
"description": "Gets the label text from the slot",
|
|
3967
|
+
"readonly": true
|
|
3968
|
+
}
|
|
3969
|
+
],
|
|
3970
|
+
"attributes": [
|
|
3971
|
+
{
|
|
3972
|
+
"name": "value",
|
|
3179
3973
|
"type": {
|
|
3180
|
-
"text": "
|
|
3974
|
+
"text": "string"
|
|
3181
3975
|
},
|
|
3182
|
-
"default": "
|
|
3183
|
-
"description": "
|
|
3184
|
-
"fieldName": "
|
|
3976
|
+
"default": "''",
|
|
3977
|
+
"description": "The option value",
|
|
3978
|
+
"fieldName": "value"
|
|
3185
3979
|
},
|
|
3186
3980
|
{
|
|
3187
|
-
"name": "
|
|
3981
|
+
"name": "disabled",
|
|
3188
3982
|
"type": {
|
|
3189
3983
|
"text": "boolean"
|
|
3190
3984
|
},
|
|
3191
3985
|
"default": "false",
|
|
3192
|
-
"description": "Whether the
|
|
3193
|
-
"fieldName": "
|
|
3194
|
-
},
|
|
3195
|
-
{
|
|
3196
|
-
"name": "hint",
|
|
3197
|
-
"type": {
|
|
3198
|
-
"text": "string"
|
|
3199
|
-
},
|
|
3200
|
-
"default": "''",
|
|
3201
|
-
"description": "Helper text shown below the select",
|
|
3202
|
-
"fieldName": "hint"
|
|
3986
|
+
"description": "Whether the option is disabled",
|
|
3987
|
+
"fieldName": "disabled"
|
|
3203
3988
|
}
|
|
3204
3989
|
],
|
|
3205
3990
|
"superclass": {
|
|
3206
3991
|
"name": "LitElement",
|
|
3207
3992
|
"package": "lit"
|
|
3208
3993
|
},
|
|
3209
|
-
"tagName": "kr-select",
|
|
3994
|
+
"tagName": "kr-select-option",
|
|
3210
3995
|
"customElement": true
|
|
3211
3996
|
}
|
|
3212
3997
|
],
|
|
3213
3998
|
"exports": [
|
|
3214
3999
|
{
|
|
3215
4000
|
"kind": "js",
|
|
3216
|
-
"name": "
|
|
4001
|
+
"name": "KRSelectOption",
|
|
3217
4002
|
"declaration": {
|
|
3218
|
-
"name": "
|
|
3219
|
-
"module": "src/form/select/select.ts"
|
|
4003
|
+
"name": "KRSelectOption",
|
|
4004
|
+
"module": "src/form/select/select-option.ts"
|
|
3220
4005
|
}
|
|
3221
4006
|
},
|
|
3222
4007
|
{
|
|
3223
4008
|
"kind": "custom-element-definition",
|
|
3224
|
-
"name": "kr-select",
|
|
4009
|
+
"name": "kr-select-option",
|
|
3225
4010
|
"declaration": {
|
|
3226
|
-
"name": "
|
|
3227
|
-
"module": "src/form/select/select.ts"
|
|
4011
|
+
"name": "KRSelectOption",
|
|
4012
|
+
"module": "src/form/select/select-option.ts"
|
|
3228
4013
|
}
|
|
3229
4014
|
}
|
|
3230
4015
|
]
|
|
3231
4016
|
},
|
|
3232
4017
|
{
|
|
3233
4018
|
"kind": "javascript-module",
|
|
3234
|
-
"path": "src/form/
|
|
4019
|
+
"path": "src/form/select/select.ts",
|
|
3235
4020
|
"declarations": [
|
|
3236
4021
|
{
|
|
3237
4022
|
"kind": "class",
|
|
3238
|
-
"description": "A
|
|
3239
|
-
"name": "
|
|
4023
|
+
"description": "A select dropdown component that works with native browser forms.\n\nUses ElementInternals for form association, allowing the component\nto participate in form submission, validation, and reset.",
|
|
4024
|
+
"name": "KRSelect",
|
|
4025
|
+
"slots": [
|
|
4026
|
+
{
|
|
4027
|
+
"description": "The kr-select-option elements",
|
|
4028
|
+
"name": ""
|
|
4029
|
+
}
|
|
4030
|
+
],
|
|
3240
4031
|
"members": [
|
|
3241
4032
|
{
|
|
3242
4033
|
"kind": "field",
|
|
@@ -3262,7 +4053,7 @@
|
|
|
3262
4053
|
"text": "string"
|
|
3263
4054
|
},
|
|
3264
4055
|
"default": "''",
|
|
3265
|
-
"description": "The
|
|
4056
|
+
"description": "The select label text",
|
|
3266
4057
|
"attribute": "label"
|
|
3267
4058
|
},
|
|
3268
4059
|
{
|
|
@@ -3282,7 +4073,7 @@
|
|
|
3282
4073
|
"text": "string"
|
|
3283
4074
|
},
|
|
3284
4075
|
"default": "''",
|
|
3285
|
-
"description": "The
|
|
4076
|
+
"description": "The currently selected value",
|
|
3286
4077
|
"attribute": "value"
|
|
3287
4078
|
},
|
|
3288
4079
|
{
|
|
@@ -3291,19 +4082,19 @@
|
|
|
3291
4082
|
"type": {
|
|
3292
4083
|
"text": "string"
|
|
3293
4084
|
},
|
|
3294
|
-
"default": "''",
|
|
3295
|
-
"description": "Placeholder text",
|
|
4085
|
+
"default": "'Select an option'",
|
|
4086
|
+
"description": "Placeholder text when no option is selected",
|
|
3296
4087
|
"attribute": "placeholder"
|
|
3297
4088
|
},
|
|
3298
4089
|
{
|
|
3299
4090
|
"kind": "field",
|
|
3300
|
-
"name": "
|
|
4091
|
+
"name": "disabled",
|
|
3301
4092
|
"type": {
|
|
3302
|
-
"text": "
|
|
4093
|
+
"text": "boolean"
|
|
3303
4094
|
},
|
|
3304
|
-
"default": "
|
|
3305
|
-
"description": "
|
|
3306
|
-
"attribute": "
|
|
4095
|
+
"default": "false",
|
|
4096
|
+
"description": "Whether the select is disabled",
|
|
4097
|
+
"attribute": "disabled"
|
|
3307
4098
|
},
|
|
3308
4099
|
{
|
|
3309
4100
|
"kind": "field",
|
|
@@ -3315,16 +4106,6 @@
|
|
|
3315
4106
|
"description": "Whether the field is required",
|
|
3316
4107
|
"attribute": "required"
|
|
3317
4108
|
},
|
|
3318
|
-
{
|
|
3319
|
-
"kind": "field",
|
|
3320
|
-
"name": "disabled",
|
|
3321
|
-
"type": {
|
|
3322
|
-
"text": "boolean"
|
|
3323
|
-
},
|
|
3324
|
-
"default": "false",
|
|
3325
|
-
"description": "Whether the field is disabled",
|
|
3326
|
-
"attribute": "disabled"
|
|
3327
|
-
},
|
|
3328
4109
|
{
|
|
3329
4110
|
"kind": "field",
|
|
3330
4111
|
"name": "readonly",
|
|
@@ -3337,58 +4118,31 @@
|
|
|
3337
4118
|
},
|
|
3338
4119
|
{
|
|
3339
4120
|
"kind": "field",
|
|
3340
|
-
"name": "
|
|
3341
|
-
"type": {
|
|
3342
|
-
"text": "number | undefined"
|
|
3343
|
-
},
|
|
3344
|
-
"description": "Minimum length for the value",
|
|
3345
|
-
"attribute": "minlength"
|
|
3346
|
-
},
|
|
3347
|
-
{
|
|
3348
|
-
"kind": "field",
|
|
3349
|
-
"name": "maxlength",
|
|
3350
|
-
"type": {
|
|
3351
|
-
"text": "number | undefined"
|
|
3352
|
-
},
|
|
3353
|
-
"description": "Maximum length for the value",
|
|
3354
|
-
"attribute": "maxlength"
|
|
3355
|
-
},
|
|
3356
|
-
{
|
|
3357
|
-
"kind": "field",
|
|
3358
|
-
"name": "pattern",
|
|
3359
|
-
"type": {
|
|
3360
|
-
"text": "string | undefined"
|
|
3361
|
-
},
|
|
3362
|
-
"description": "Pattern for validation (regex)",
|
|
3363
|
-
"attribute": "pattern"
|
|
3364
|
-
},
|
|
3365
|
-
{
|
|
3366
|
-
"kind": "field",
|
|
3367
|
-
"name": "autocomplete",
|
|
4121
|
+
"name": "hint",
|
|
3368
4122
|
"type": {
|
|
3369
4123
|
"text": "string"
|
|
3370
4124
|
},
|
|
3371
4125
|
"default": "''",
|
|
3372
|
-
"description": "
|
|
3373
|
-
"attribute": "
|
|
4126
|
+
"description": "Helper text shown below the select",
|
|
4127
|
+
"attribute": "hint"
|
|
3374
4128
|
},
|
|
3375
4129
|
{
|
|
3376
4130
|
"kind": "field",
|
|
3377
|
-
"name": "
|
|
4131
|
+
"name": "_isOpen",
|
|
3378
4132
|
"type": {
|
|
3379
|
-
"text": "
|
|
4133
|
+
"text": "boolean"
|
|
3380
4134
|
},
|
|
3381
|
-
"
|
|
3382
|
-
"
|
|
3383
|
-
"attribute": "hint"
|
|
4135
|
+
"privacy": "private",
|
|
4136
|
+
"default": "false"
|
|
3384
4137
|
},
|
|
3385
4138
|
{
|
|
3386
4139
|
"kind": "field",
|
|
3387
|
-
"name": "
|
|
4140
|
+
"name": "_highlightedIndex",
|
|
3388
4141
|
"type": {
|
|
3389
|
-
"text": "
|
|
4142
|
+
"text": "number"
|
|
3390
4143
|
},
|
|
3391
|
-
"privacy": "private"
|
|
4144
|
+
"privacy": "private",
|
|
4145
|
+
"default": "-1"
|
|
3392
4146
|
},
|
|
3393
4147
|
{
|
|
3394
4148
|
"kind": "field",
|
|
@@ -3401,12 +4155,11 @@
|
|
|
3401
4155
|
},
|
|
3402
4156
|
{
|
|
3403
4157
|
"kind": "field",
|
|
3404
|
-
"name": "
|
|
4158
|
+
"name": "_triggerElement",
|
|
3405
4159
|
"type": {
|
|
3406
|
-
"text": "
|
|
4160
|
+
"text": "HTMLButtonElement"
|
|
3407
4161
|
},
|
|
3408
|
-
"privacy": "private"
|
|
3409
|
-
"default": "false"
|
|
4162
|
+
"privacy": "private"
|
|
3410
4163
|
},
|
|
3411
4164
|
{
|
|
3412
4165
|
"kind": "field",
|
|
@@ -3457,33 +4210,35 @@
|
|
|
3457
4210
|
"name": "_handleInvalid",
|
|
3458
4211
|
"privacy": "private"
|
|
3459
4212
|
},
|
|
4213
|
+
{
|
|
4214
|
+
"kind": "field",
|
|
4215
|
+
"name": "_handleOutsideClick",
|
|
4216
|
+
"privacy": "private"
|
|
4217
|
+
},
|
|
4218
|
+
{
|
|
4219
|
+
"kind": "field",
|
|
4220
|
+
"name": "_handleKeyDown",
|
|
4221
|
+
"privacy": "private"
|
|
4222
|
+
},
|
|
3460
4223
|
{
|
|
3461
4224
|
"kind": "method",
|
|
3462
|
-
"name": "
|
|
4225
|
+
"name": "_toggle",
|
|
3463
4226
|
"privacy": "private"
|
|
3464
4227
|
},
|
|
3465
4228
|
{
|
|
3466
4229
|
"kind": "method",
|
|
3467
|
-
"name": "
|
|
3468
|
-
"privacy": "private"
|
|
3469
|
-
"parameters": [
|
|
3470
|
-
{
|
|
3471
|
-
"name": "e",
|
|
3472
|
-
"type": {
|
|
3473
|
-
"text": "Event"
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
|
-
]
|
|
4230
|
+
"name": "_close",
|
|
4231
|
+
"privacy": "private"
|
|
3477
4232
|
},
|
|
3478
4233
|
{
|
|
3479
4234
|
"kind": "method",
|
|
3480
|
-
"name": "
|
|
4235
|
+
"name": "_selectOption",
|
|
3481
4236
|
"privacy": "private",
|
|
3482
4237
|
"parameters": [
|
|
3483
4238
|
{
|
|
3484
|
-
"name": "
|
|
4239
|
+
"name": "option",
|
|
3485
4240
|
"type": {
|
|
3486
|
-
"text": "
|
|
4241
|
+
"text": "KRSelectOption"
|
|
3487
4242
|
}
|
|
3488
4243
|
}
|
|
3489
4244
|
]
|
|
@@ -3495,15 +4250,24 @@
|
|
|
3495
4250
|
},
|
|
3496
4251
|
{
|
|
3497
4252
|
"kind": "method",
|
|
3498
|
-
"name": "
|
|
4253
|
+
"name": "_updateValidity",
|
|
4254
|
+
"privacy": "private"
|
|
3499
4255
|
},
|
|
3500
4256
|
{
|
|
3501
4257
|
"kind": "method",
|
|
3502
|
-
"name": "
|
|
4258
|
+
"name": "focus"
|
|
3503
4259
|
},
|
|
3504
4260
|
{
|
|
3505
4261
|
"kind": "method",
|
|
3506
|
-
"name": "
|
|
4262
|
+
"name": "blur"
|
|
4263
|
+
}
|
|
4264
|
+
],
|
|
4265
|
+
"events": [
|
|
4266
|
+
{
|
|
4267
|
+
"name": "change",
|
|
4268
|
+
"type": {
|
|
4269
|
+
"text": "Event"
|
|
4270
|
+
}
|
|
3507
4271
|
}
|
|
3508
4272
|
],
|
|
3509
4273
|
"attributes": [
|
|
@@ -3513,7 +4277,7 @@
|
|
|
3513
4277
|
"text": "string"
|
|
3514
4278
|
},
|
|
3515
4279
|
"default": "''",
|
|
3516
|
-
"description": "The
|
|
4280
|
+
"description": "The select label text",
|
|
3517
4281
|
"fieldName": "label"
|
|
3518
4282
|
},
|
|
3519
4283
|
{
|
|
@@ -3531,7 +4295,7 @@
|
|
|
3531
4295
|
"text": "string"
|
|
3532
4296
|
},
|
|
3533
4297
|
"default": "''",
|
|
3534
|
-
"description": "The
|
|
4298
|
+
"description": "The currently selected value",
|
|
3535
4299
|
"fieldName": "value"
|
|
3536
4300
|
},
|
|
3537
4301
|
{
|
|
@@ -3539,18 +4303,18 @@
|
|
|
3539
4303
|
"type": {
|
|
3540
4304
|
"text": "string"
|
|
3541
4305
|
},
|
|
3542
|
-
"default": "''",
|
|
3543
|
-
"description": "Placeholder text",
|
|
4306
|
+
"default": "'Select an option'",
|
|
4307
|
+
"description": "Placeholder text when no option is selected",
|
|
3544
4308
|
"fieldName": "placeholder"
|
|
3545
4309
|
},
|
|
3546
4310
|
{
|
|
3547
|
-
"name": "
|
|
4311
|
+
"name": "disabled",
|
|
3548
4312
|
"type": {
|
|
3549
|
-
"text": "
|
|
4313
|
+
"text": "boolean"
|
|
3550
4314
|
},
|
|
3551
|
-
"default": "
|
|
3552
|
-
"description": "
|
|
3553
|
-
"fieldName": "
|
|
4315
|
+
"default": "false",
|
|
4316
|
+
"description": "Whether the select is disabled",
|
|
4317
|
+
"fieldName": "disabled"
|
|
3554
4318
|
},
|
|
3555
4319
|
{
|
|
3556
4320
|
"name": "required",
|
|
@@ -3561,15 +4325,6 @@
|
|
|
3561
4325
|
"description": "Whether the field is required",
|
|
3562
4326
|
"fieldName": "required"
|
|
3563
4327
|
},
|
|
3564
|
-
{
|
|
3565
|
-
"name": "disabled",
|
|
3566
|
-
"type": {
|
|
3567
|
-
"text": "boolean"
|
|
3568
|
-
},
|
|
3569
|
-
"default": "false",
|
|
3570
|
-
"description": "Whether the field is disabled",
|
|
3571
|
-
"fieldName": "disabled"
|
|
3572
|
-
},
|
|
3573
4328
|
{
|
|
3574
4329
|
"name": "readonly",
|
|
3575
4330
|
"type": {
|
|
@@ -3579,46 +4334,13 @@
|
|
|
3579
4334
|
"description": "Whether the field is readonly",
|
|
3580
4335
|
"fieldName": "readonly"
|
|
3581
4336
|
},
|
|
3582
|
-
{
|
|
3583
|
-
"name": "minlength",
|
|
3584
|
-
"type": {
|
|
3585
|
-
"text": "number | undefined"
|
|
3586
|
-
},
|
|
3587
|
-
"description": "Minimum length for the value",
|
|
3588
|
-
"fieldName": "minlength"
|
|
3589
|
-
},
|
|
3590
|
-
{
|
|
3591
|
-
"name": "maxlength",
|
|
3592
|
-
"type": {
|
|
3593
|
-
"text": "number | undefined"
|
|
3594
|
-
},
|
|
3595
|
-
"description": "Maximum length for the value",
|
|
3596
|
-
"fieldName": "maxlength"
|
|
3597
|
-
},
|
|
3598
|
-
{
|
|
3599
|
-
"name": "pattern",
|
|
3600
|
-
"type": {
|
|
3601
|
-
"text": "string | undefined"
|
|
3602
|
-
},
|
|
3603
|
-
"description": "Pattern for validation (regex)",
|
|
3604
|
-
"fieldName": "pattern"
|
|
3605
|
-
},
|
|
3606
|
-
{
|
|
3607
|
-
"name": "autocomplete",
|
|
3608
|
-
"type": {
|
|
3609
|
-
"text": "string"
|
|
3610
|
-
},
|
|
3611
|
-
"default": "''",
|
|
3612
|
-
"description": "Autocomplete attribute value",
|
|
3613
|
-
"fieldName": "autocomplete"
|
|
3614
|
-
},
|
|
3615
4337
|
{
|
|
3616
4338
|
"name": "hint",
|
|
3617
4339
|
"type": {
|
|
3618
4340
|
"text": "string"
|
|
3619
4341
|
},
|
|
3620
4342
|
"default": "''",
|
|
3621
|
-
"description": "Helper text shown below the
|
|
4343
|
+
"description": "Helper text shown below the select",
|
|
3622
4344
|
"fieldName": "hint"
|
|
3623
4345
|
}
|
|
3624
4346
|
],
|
|
@@ -3626,25 +4348,25 @@
|
|
|
3626
4348
|
"name": "LitElement",
|
|
3627
4349
|
"package": "lit"
|
|
3628
4350
|
},
|
|
3629
|
-
"tagName": "kr-
|
|
4351
|
+
"tagName": "kr-select",
|
|
3630
4352
|
"customElement": true
|
|
3631
4353
|
}
|
|
3632
4354
|
],
|
|
3633
4355
|
"exports": [
|
|
3634
4356
|
{
|
|
3635
4357
|
"kind": "js",
|
|
3636
|
-
"name": "
|
|
4358
|
+
"name": "KRSelect",
|
|
3637
4359
|
"declaration": {
|
|
3638
|
-
"name": "
|
|
3639
|
-
"module": "src/form/
|
|
4360
|
+
"name": "KRSelect",
|
|
4361
|
+
"module": "src/form/select/select.ts"
|
|
3640
4362
|
}
|
|
3641
4363
|
},
|
|
3642
4364
|
{
|
|
3643
4365
|
"kind": "custom-element-definition",
|
|
3644
|
-
"name": "kr-
|
|
4366
|
+
"name": "kr-select",
|
|
3645
4367
|
"declaration": {
|
|
3646
|
-
"name": "
|
|
3647
|
-
"module": "src/form/
|
|
4368
|
+
"name": "KRSelect",
|
|
4369
|
+
"module": "src/form/select/select.ts"
|
|
3648
4370
|
}
|
|
3649
4371
|
}
|
|
3650
4372
|
]
|