@liwe3/webcomponents 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AITextEditor.d.ts +173 -0
- package/dist/AITextEditor.d.ts.map +1 -0
- package/dist/ChunkUploader.d.ts +103 -0
- package/dist/ChunkUploader.d.ts.map +1 -0
- package/dist/ChunkUploader.js +614 -0
- package/dist/ChunkUploader.js.map +1 -0
- package/dist/ContainerBox.d.ts +112 -0
- package/dist/ContainerBox.d.ts.map +1 -0
- package/dist/ContainerBox.js +359 -0
- package/dist/ContainerBox.js.map +1 -0
- package/dist/DateSelector.d.ts +103 -0
- package/dist/DateSelector.d.ts.map +1 -0
- package/dist/DateSelector.js +372 -0
- package/dist/DateSelector.js.map +1 -0
- package/dist/Drawer.d.ts +63 -0
- package/dist/Drawer.d.ts.map +1 -0
- package/dist/Drawer.js +340 -0
- package/dist/Drawer.js.map +1 -0
- package/dist/ImageView.d.ts +42 -0
- package/dist/ImageView.d.ts.map +1 -0
- package/dist/ImageView.js +209 -0
- package/dist/ImageView.js.map +1 -0
- package/dist/PopoverMenu.d.ts +103 -0
- package/dist/PopoverMenu.d.ts.map +1 -0
- package/dist/PopoverMenu.js +312 -0
- package/dist/PopoverMenu.js.map +1 -0
- package/dist/SmartSelect.d.ts +99 -0
- package/dist/SmartSelect.d.ts.map +1 -0
- package/dist/SmartSelect.js.map +1 -1
- package/dist/Toast.d.ts +127 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +507 -0
- package/dist/Toast.js.map +1 -0
- package/dist/TreeView.d.ts +84 -0
- package/dist/TreeView.d.ts.map +1 -0
- package/dist/TreeView.js +478 -0
- package/dist/TreeView.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -6
- package/dist/index.js.map +1 -1
- package/package.json +43 -3
- package/src/ChunkUploader.ts +921 -0
- package/src/ContainerBox.ts +570 -0
- package/src/DateSelector.ts +550 -0
- package/src/Drawer.ts +435 -0
- package/src/ImageView.ts +265 -0
- package/src/PopoverMenu.ts +595 -0
- package/src/SmartSelect.ts +231 -231
- package/src/Toast.ts +834 -0
- package/src/TreeView.ts +673 -0
- package/src/index.ts +70 -3
package/dist/SmartSelect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartSelect.js","sources":["../src/SmartSelect.ts"],"sourcesContent":["/**\n * SmartSelect Web Component\n * A customizable select dropdown with search, multi-select, and keyboard navigation\n */\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\nexport class SmartSelectElement extends HTMLElement {\n declare shadowRoot: ShadowRoot;\n private isOpen: boolean = false;\n private selectedOptions: SelectOption[] = [];\n private filteredOptions: SelectOption[] = [];\n private focusedIndex: number = -1;\n private searchValue: string = '';\n private keyboardNavigating: boolean = false;\n private keyboardTimer?: number;\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n\n // Make component focusable\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n\n this.render();\n this.bindEvents();\n }\n\n static get observedAttributes(): string[] {\n return ['multiple', 'searchable', 'placeholder', 'disabled', 'value', 'options'];\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue !== newValue) {\n if (name === 'options') {\n this.filteredOptions = [...this.options];\n }\n this.render();\n }\n }\n\n get multiple(): boolean {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value: boolean) {\n if (value) {\n this.setAttribute('multiple', '');\n } else {\n this.removeAttribute('multiple');\n }\n }\n\n get searchable(): boolean {\n return this.hasAttribute('searchable');\n }\n\n set searchable(value: boolean) {\n if (value) {\n this.setAttribute('searchable', '');\n } else {\n this.removeAttribute('searchable');\n }\n }\n\n get placeholder(): string {\n return this.getAttribute('placeholder') || 'Select an option';\n }\n\n set placeholder(value: string) {\n this.setAttribute('placeholder', value);\n }\n\n get disabled(): boolean {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value: boolean) {\n if (value) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n get value(): string | string[] {\n if (this.multiple) {\n return this.selectedOptions.map(opt => opt.value);\n }\n return this.selectedOptions.length > 0 ? this.selectedOptions[0].value : '';\n }\n\n set value(val: string | string[]) {\n if (this.multiple && Array.isArray(val)) {\n this.selectedOptions = this.options.filter(opt => val.includes(opt.value));\n } else {\n const option = this.options.find(opt => opt.value === val);\n this.selectedOptions = option ? [option] : [];\n }\n this.render();\n }\n\n get options(): SelectOption[] {\n const optionsAttr = this.getAttribute('options');\n if (optionsAttr) {\n try {\n return JSON.parse(optionsAttr);\n } catch (e) {\n console.error('Invalid options format:', e);\n return [];\n }\n }\n return [];\n }\n\n set options(opts: SelectOption[]) {\n this.setAttribute('options', JSON.stringify(opts));\n }\n\n /**\n * Opens the dropdown\n */\n open(): void {\n if (this.disabled) return;\n this.isOpen = true;\n this.focusedIndex = -1;\n if (this.options.length > 0) {\n this.filteredOptions = [...this.options];\n }\n this.render();\n\n // Update dropdown position based on viewport\n this._updateDropdownPosition();\n\n // Focus search input if searchable\n if (this.searchable) {\n requestAnimationFrame(() => {\n const searchInput = this.shadowRoot.querySelector('.search-input') as HTMLInputElement;\n if (searchInput) {\n searchInput.focus();\n }\n });\n }\n\n this.dispatchEvent(new CustomEvent('open'));\n }\n\n /**\n * Closes the dropdown\n */\n close(): void {\n this.isOpen = false;\n this.focusedIndex = -1;\n this.searchValue = '';\n\n // Reset filtered options when closing\n if (this.searchable && this.options.length > 0) {\n this.filteredOptions = [...this.options];\n }\n\n // Clear any inline positioning styles\n const dropdown = this.shadowRoot.querySelector('.dropdown') as HTMLElement;\n if (dropdown) {\n dropdown.style.top = '';\n dropdown.style.left = '';\n dropdown.style.width = '';\n dropdown.style.maxHeight = '';\n }\n\n this.render();\n this.dispatchEvent(new CustomEvent('close'));\n }\n\n /**\n * Toggles the dropdown open/closed state\n */\n toggle(): void {\n if (this.isOpen) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /**\n * Selects an option by its value\n */\n selectOption(value: string): void {\n const option = this.options.find(opt => opt.value === value);\n if (!option) return;\n\n if (this.multiple) {\n if (!this.selectedOptions.find(opt => opt.value === value)) {\n this.selectedOptions.push(option);\n }\n } else {\n this.selectedOptions = [option];\n this.close();\n }\n\n this.render();\n this.dispatchEvent(new CustomEvent('change', { detail: { value: this.value } }));\n }\n\n /**\n * Deselects an option by its value\n */\n deselectOption(value: string): void {\n this.selectedOptions = this.selectedOptions.filter(opt => opt.value !== value);\n this.render();\n this.dispatchEvent(new CustomEvent('change', { detail: { value: this.value } }));\n }\n\n /**\n * Returns an array of currently selected options\n */\n getSelectedOptions(): SelectOption[] {\n return [...this.selectedOptions];\n }\n\n /**\n * Sets the options for the select component\n */\n setOptions(options: SelectOption[]): void {\n this.options = options;\n this.filteredOptions = [...options];\n this.selectedOptions = [];\n this.render();\n }\n\n /**\n * Handles search functionality\n */\n private handleSearch(query: string): void {\n this.searchValue = query;\n this.filteredOptions = this.options.filter(option =>\n option.label.toLowerCase().includes(query.toLowerCase())\n );\n this.focusedIndex = -1;\n this.render();\n this.dispatchEvent(new CustomEvent('search', { detail: { query } }));\n }\n\n /**\n * Updates the visual focus state without full re-render\n */\n private updateFocusedOption(): void {\n const options = this.shadowRoot.querySelectorAll('.option');\n\n // Remove focused class from all options\n options.forEach(option => option.classList.remove('focused'));\n\n // Add focused class to current option\n if (this.focusedIndex >= 0 && this.focusedIndex < options.length) {\n options[this.focusedIndex].classList.add('focused');\n }\n\n this.scrollToFocusedOption();\n }\n\n /**\n * Scrolls the focused option into view\n */\n private scrollToFocusedOption(): void {\n if (this.focusedIndex < 0) return;\n\n requestAnimationFrame(() => {\n const dropdown = this.shadowRoot.querySelector('.dropdown') as HTMLElement;\n const focusedOption = this.shadowRoot.querySelector('.option.focused') as HTMLElement;\n\n if (dropdown && focusedOption) {\n const dropdownRect = dropdown.getBoundingClientRect();\n const optionRect = focusedOption.getBoundingClientRect();\n\n // Check if option is above visible area\n if (optionRect.top < dropdownRect.top) {\n dropdown.scrollTop -= (dropdownRect.top - optionRect.top);\n }\n // Check if option is below visible area\n else if (optionRect.bottom > dropdownRect.bottom) {\n dropdown.scrollTop += (optionRect.bottom - dropdownRect.bottom);\n }\n }\n });\n }\n\n /**\n * Calculates the optimal dropdown position based on viewport constraints\n */\n private _calculateDropdownPosition(): { top: number; left: number; width: number; maxHeight: number } | null {\n const trigger = this.shadowRoot.querySelector('.select-trigger') as HTMLElement;\n if (!trigger) return null;\n\n const triggerRect = trigger.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const viewportWidth = window.innerWidth;\n const dropdownMaxHeight = 200;\n const dropdownPadding = 10;\n const margin = 2;\n\n // Calculate available space\n const spaceBelow = viewportHeight - triggerRect.bottom;\n const spaceAbove = triggerRect.top;\n\n // Determine if dropdown should open upward\n const shouldOpenUpward = spaceBelow < dropdownMaxHeight + dropdownPadding && spaceAbove > spaceBelow;\n\n // Calculate dimensions\n const width = triggerRect.width;\n const left = Math.max(0, Math.min(triggerRect.left, viewportWidth - width));\n\n let top: number;\n let maxHeight: number;\n\n if (shouldOpenUpward) {\n // Position above the trigger\n maxHeight = Math.min(dropdownMaxHeight, spaceAbove - dropdownPadding);\n top = triggerRect.top - maxHeight - margin;\n } else {\n // Position below the trigger\n maxHeight = Math.min(dropdownMaxHeight, spaceBelow - dropdownPadding);\n top = triggerRect.bottom + margin;\n }\n\n return {\n top: Math.max(0, top),\n left,\n width,\n maxHeight: Math.max(100, maxHeight) // Ensure minimum height\n };\n }\n\n /**\n * Updates dropdown position using fixed positioning relative to viewport\n */\n private _updateDropdownPosition(): void {\n requestAnimationFrame(() => {\n const dropdown = this.shadowRoot.querySelector('.dropdown') as HTMLElement;\n if (!dropdown) return;\n\n const position = this._calculateDropdownPosition();\n if (!position) return;\n\n // Apply calculated position as inline styles\n dropdown.style.top = `${position.top}px`;\n dropdown.style.left = `${position.left}px`;\n dropdown.style.width = `${position.width}px`;\n dropdown.style.maxHeight = `${position.maxHeight}px`;\n });\n }\n\n /**\n * Handles keyboard navigation\n */\n private handleKeydown(event: KeyboardEvent): void {\n if (this.disabled) return;\n\n // Prevent double execution if event has already been handled\n if ((event as any)._smartSelectHandled) return;\n (event as any)._smartSelectHandled = true;\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this.keyboardNavigating = true;\n clearTimeout(this.keyboardTimer);\n this.keyboardTimer = window.setTimeout(() => { this.keyboardNavigating = false; }, 100);\n\n if (!this.isOpen) {\n this.open();\n } else {\n // If searchable and search input is focused, move to first option\n const searchInput = this.shadowRoot.querySelector('.search-input') as HTMLInputElement;\n const isSearchFocused = this.searchable && searchInput === this.shadowRoot.activeElement;\n\n if (isSearchFocused) {\n this.focusedIndex = 0;\n searchInput.blur(); // Blur search input to allow normal navigation\n // Focus the component to ensure it receives keyboard events\n this.focus();\n this.updateFocusedOption();\n return;\n }\n // Navigate through options\n const newIndex = Math.min(this.focusedIndex + 1, this.filteredOptions.length - 1);\n this.focusedIndex = newIndex;\n this.updateFocusedOption();\n }\n break;\n\n case 'ArrowUp':\n event.preventDefault();\n this.keyboardNavigating = true;\n clearTimeout(this.keyboardTimer);\n this.keyboardTimer = window.setTimeout(() => { this.keyboardNavigating = false; }, 100);\n\n if (this.isOpen) {\n // If at first option and searchable, focus search input\n if (this.focusedIndex === 0 && this.searchable) {\n this.focusedIndex = -1;\n this.updateFocusedOption();\n requestAnimationFrame(() => {\n const searchInput = this.shadowRoot.querySelector('.search-input') as HTMLInputElement;\n if (searchInput) {\n searchInput.focus();\n searchInput.setSelectionRange(searchInput.value.length, searchInput.value.length);\n }\n });\n return;\n }\n // If searchable and search input is focused, do nothing\n const searchInput = this.shadowRoot.querySelector('.search-input') as HTMLInputElement;\n const isSearchFocused = this.searchable && searchInput === this.shadowRoot.activeElement;\n\n if (isSearchFocused) {\n return;\n }\n // Navigate through options\n const newIndex = Math.max(this.focusedIndex - 1, -1);\n this.focusedIndex = newIndex;\n this.updateFocusedOption();\n }\n break;\n\n case 'Enter':\n event.preventDefault();\n if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex < this.filteredOptions.length) {\n this.selectOption(this.filteredOptions[this.focusedIndex].value);\n } else if (!this.isOpen) {\n this.open();\n }\n break;\n\n case 'Escape':\n event.preventDefault();\n this.close();\n break;\n\n case 'Tab':\n this.close();\n break;\n }\n }\n\n /**\n * Binds all event listeners\n */\n private bindEvents(): void {\n // Listen for keydown events on both the component and shadow root\n const keydownHandler = this.handleKeydown.bind(this);\n this.addEventListener('keydown', keydownHandler);\n this.shadowRoot.addEventListener('keydown', keydownHandler as EventListener);\n\n // Use event delegation on the shadow root\n this.shadowRoot.addEventListener('click', (e) => {\n e.stopPropagation();\n const target = e.target as HTMLElement;\n\n if (target.closest('.remove-tag')) {\n const value = (target.closest('.remove-tag') as HTMLElement).dataset.value;\n if (value) this.deselectOption(value);\n } else if (target.closest('.option')) {\n const value = (target.closest('.option') as HTMLElement).dataset.value;\n if (value) this.selectOption(value);\n } else if (target.closest('.select-trigger')) {\n this.toggle();\n }\n });\n\n // Handle mouse hover on options to update focused index\n this.shadowRoot.addEventListener('mouseover', (e) => {\n // Don't interfere with keyboard navigation\n if (this.keyboardNavigating) return;\n\n const target = e.target as HTMLElement;\n if (target.closest('.option')) {\n const option = target.closest('.option') as HTMLElement;\n const options = Array.from(this.shadowRoot.querySelectorAll('.option'));\n const newFocusedIndex = options.indexOf(option);\n\n // Only update if the focused index actually changed\n if (this.focusedIndex !== newFocusedIndex) {\n // Remove focused class from current option\n const currentFocused = this.shadowRoot.querySelector('.option.focused');\n if (currentFocused) {\n currentFocused.classList.remove('focused');\n }\n\n // Add focused class to new option\n option.classList.add('focused');\n this.focusedIndex = newFocusedIndex;\n }\n }\n });\n\n // Handle mouse leaving dropdown to clear focus\n this.shadowRoot.addEventListener('mouseleave', (e) => {\n // Don't interfere with keyboard navigation\n if (this.keyboardNavigating) return;\n\n const target = e.target as HTMLElement;\n if (target.closest('.dropdown')) {\n const currentFocused = this.shadowRoot.querySelector('.option.focused');\n if (currentFocused) {\n currentFocused.classList.remove('focused');\n }\n this.focusedIndex = -1;\n }\n });\n\n // Handle search input\n this.shadowRoot.addEventListener('input', (e) => {\n const target = e.target as HTMLInputElement;\n if (target.classList.contains('search-input')) {\n this.handleSearch(target.value);\n }\n });\n\n // Close dropdown when clicking outside\n document.addEventListener('click', (e) => {\n if (!this.contains(e.target as Node)) {\n this.close();\n }\n });\n\n // Update dropdown position on window resize or scroll\n window.addEventListener('resize', () => {\n if (this.isOpen) {\n this._updateDropdownPosition();\n }\n });\n\n window.addEventListener('scroll', () => {\n if (this.isOpen) {\n this._updateDropdownPosition();\n }\n }, true); // Use capture to catch all scroll events\n }\n\n /**\n * Renders the component\n */\n private render(): void {\n // Initialize filteredOptions if not set\n if (this.filteredOptions.length === 0 && this.options.length > 0) {\n this.filteredOptions = [...this.options];\n }\n\n // Remember if search input was focused before render\n const wasSearchFocused = this.shadowRoot.querySelector('.search-input') === this.shadowRoot.activeElement;\n\n const displayText = this.selectedOptions.length > 0\n ? (this.multiple\n ? `${this.selectedOptions.length} selected`\n : this.selectedOptions[0].label)\n : this.placeholder;\n\n this.shadowRoot.innerHTML = `\n <style>\n :host {\n display: inline-block;\n position: relative;\n min-width: 200px;\n font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);\n font-size: var(--font-size, 14px);\n outline: none;\n }\n\n :host(:focus) .select-trigger {\n border-color: var(--focus-color, #007bff);\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);\n }\n\n :host([disabled]) {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .select-container {\n position: relative;\n }\n\n .select-trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--padding, 8px 12px);\n border: var(--border, 1px solid #ccc);\n border-radius: var(--border-radius, 4px);\n background: var(--background, white);\n cursor: pointer;\n min-height: 36px;\n box-sizing: border-box;\n color: #333;\n user-select: none;\n }\n\n .select-trigger:focus {\n outline: none;\n border-color: var(--focus-color, #007bff);\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);\n }\n\n .select-trigger[disabled] {\n cursor: not-allowed;\n }\n\n .selected-content {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-wrap: wrap;\n flex: 1;\n }\n\n .tag {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n background: var(--tag-background, #e9ecef);\n border-radius: var(--tag-border-radius, 12px);\n font-size: 12px;\n color: var(--tag-color, #495057);\n user-select: none;\n }\n\n .remove-tag {\n cursor: pointer;\n color: var(--remove-color, #6c757d);\n font-weight: bold;\n font-size: 14px;\n }\n\n .remove-tag:hover {\n color: var(--remove-hover-color, #dc3545);\n }\n\n .arrow {\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid var(--arrow-color, #666);\n transition: transform 0.2s;\n }\n\n .arrow.open {\n transform: rotate(180deg);\n }\n\n .dropdown {\n position: fixed;\n z-index: 99999;\n background: var(--dropdown-background, white);\n border: var(--dropdown-border, 1px solid #ccc);\n border-radius: var(--dropdown-border-radius, 4px);\n box-shadow: var(--dropdown-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));\n max-height: 200px;\n overflow-y: auto;\n scroll-behavior: smooth;\n color: #333;\n }\n\n .search-input {\n width: 100%;\n padding: 8px 12px;\n border: none;\n border-bottom: 1px solid #eee;\n font-size: 14px;\n outline: none;\n box-sizing: border-box;\n }\n\n .option {\n padding: 8px 12px;\n cursor: pointer;\n color: var(--option-color, #333);\n transition: background-color 0.2s;\n user-select: none;\n }\n\n .option:hover {\n background-color: var(--option-hover-background, #f8f9fa);\n }\n\n .option.focused {\n background-color: var(--option-focused-background, #007bff);\n color: var(--option-focused-color, white);\n }\n\n .option.selected {\n background-color: var(--option-selected-background, #e3f2fd);\n color: var(--option-selected-color, #1976d2);\n }\n\n .no-options {\n padding: 8px 12px;\n color: var(--no-options-color, #6c757d);\n font-style: italic;\n }\n </style>\n\n <div class=\"select-container\">\n <div class=\"select-trigger\" tabindex=\"-1\">\n <div class=\"selected-content\">\n ${this.multiple && this.selectedOptions.length > 0\n ? this.selectedOptions.map(option => `\n <span class=\"tag\">\n ${option.label}\n <span class=\"remove-tag\" data-value=\"${option.value}\">×</span>\n </span>\n `).join('')\n : `<span>${displayText}</span>`\n }\n </div>\n <div class=\"arrow ${this.isOpen ? 'open' : ''}\"></div>\n </div>\n\n ${this.isOpen ? `\n <div class=\"dropdown\">\n ${this.searchable ? `\n <input\n type=\"text\"\n class=\"search-input\"\n placeholder=\"Search options...\"\n value=\"${this.searchValue}\"\n >\n ` : ''}\n\n ${this.filteredOptions.length > 0\n ? this.filteredOptions.map((option, index) => `\n <div\n class=\"option ${this.selectedOptions.find(selected => selected.value === option.value) ? 'selected' : ''} ${index === this.focusedIndex ? 'focused' : ''}\"\n data-value=\"${option.value}\"\n >\n ${option.label}\n </div>\n `).join('')\n : '<div class=\"no-options\">No options available</div>'\n }\n </div>\n ` : ''}\n </div>\n `;\n\n // Re-focus search input if it was previously focused\n if (wasSearchFocused && this.searchable && this.isOpen) {\n requestAnimationFrame(() => {\n const searchInput = this.shadowRoot.querySelector('.search-input') as HTMLInputElement;\n if (searchInput) {\n searchInput.focus();\n // Restore cursor position to the end\n searchInput.setSelectionRange(searchInput.value.length, searchInput.value.length);\n }\n });\n }\n }\n}\n\n/**\n * Conditionally defines the custom element if in a browser environment.\n */\nconst defineSmartSelect = (tagName: string = 'liwe3-select'): void => {\n if (typeof window !== 'undefined' && !window.customElements.get(tagName)) {\n customElements.define(tagName, SmartSelectElement);\n }\n};\n\n// Auto-register with default tag name\ndefineSmartSelect();\n\nexport { defineSmartSelect };\n"],"names":["SmartSelectElement","name","oldValue","newValue","value","opt","val","option","optionsAttr","e","opts","searchInput","dropdown","options","query","focusedOption","dropdownRect","optionRect","trigger","triggerRect","viewportHeight","viewportWidth","dropdownMaxHeight","dropdownPadding","margin","spaceBelow","spaceAbove","shouldOpenUpward","width","left","top","maxHeight","position","event","newIndex","keydownHandler","target","newFocusedIndex","currentFocused","wasSearchFocused","displayText","index","selected","defineSmartSelect","tagName"],"mappings":"AAUO,MAAMA,UAA2B,YAAY;AAAA,EAUlD,cAAc;AACZ,UAAA,GATF,KAAQ,SAAkB,IAC1B,KAAQ,kBAAkC,CAAA,GAC1C,KAAQ,kBAAkC,CAAA,GAC1C,KAAQ,eAAuB,IAC/B,KAAQ,cAAsB,IAC9B,KAAQ,qBAA8B,IAKpC,KAAK,aAAa,EAAE,MAAM,OAAA,CAAQ,GAG7B,KAAK,aAAa,UAAU,KAC/B,KAAK,aAAa,YAAY,GAAG,GAGnC,KAAK,OAAA,GACL,KAAK,WAAA;AAAA,EACP;AAAA,EAEA,WAAW,qBAA+B;AACxC,WAAO,CAAC,YAAY,cAAc,eAAe,YAAY,SAAS,SAAS;AAAA,EACjF;AAAA,EAEA,yBAAyBC,GAAcC,GAAyBC,GAA+B;AAC7F,IAAID,MAAaC,MACXF,MAAS,cACX,KAAK,kBAAkB,CAAC,GAAG,KAAK,OAAO,IAEzC,KAAK,OAAA;AAAA,EAET;AAAA,EAEA,IAAI,WAAoB;AACtB,WAAO,KAAK,aAAa,UAAU;AAAA,EACrC;AAAA,EAEA,IAAI,SAASG,GAAgB;AAC3B,IAAIA,IACF,KAAK,aAAa,YAAY,EAAE,IAEhC,KAAK,gBAAgB,UAAU;AAAA,EAEnC;AAAA,EAEA,IAAI,aAAsB;AACxB,WAAO,KAAK,aAAa,YAAY;AAAA,EACvC;AAAA,EAEA,IAAI,WAAWA,GAAgB;AAC7B,IAAIA,IACF,KAAK,aAAa,cAAc,EAAE,IAElC,KAAK,gBAAgB,YAAY;AAAA,EAErC;AAAA,EAEA,IAAI,cAAsB;AACxB,WAAO,KAAK,aAAa,aAAa,KAAK;AAAA,EAC7C;AAAA,EAEA,IAAI,YAAYA,GAAe;AAC7B,SAAK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AC7C,KAAK,gBAAgB,IAAI,CAAAjC,MAAU;AAAA;AAAA,sBAE7BA,EAAO,KAAK;AAAA,2DACyBA,EAAO,KAAK;AAAA;AAAA,iBAEtD,EAAE,KAAK,EAAE,IACV,SAASiC,CAAW,SACxB;AAAA;AAAA,8BAEkB,KAAK,SAAS,SAAS,EAAE;AAAA;AAAA;AAAA,UAG7C,KAAK,SAAS;AAAA;AAAA,cAEV,KAAK,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,yBAKP,KAAK,WAAW;AAAA;AAAA,gBAEzB,EAAE;AAAA;AAAA,cAEJ,KAAK,gBAAgB,SAAS,IAC5B,KAAK,gBAAgB,IAAI,CAACjC,GAAQkC,MAAU;AAAA;AAAA,oCAExB,KAAK,gBAAgB,KAAK,CAAAC,MAAYA,EAAS,UAAUnC,EAAO,KAAK,IAAI,aAAa,EAAE,IAAIkC,MAAU,KAAK,eAAe,YAAY,EAAE;AAAA,kCAC1IlC,EAAO,KAAK;AAAA;AAAA,sBAExBA,EAAO,KAAK;AAAA;AAAA,iBAEjB,EAAE,KAAK,EAAE,IACV,oDACJ;AAAA;AAAA,YAEA,EAAE;AAAA;AAAA,OAKNgC,KAAoB,KAAK,cAAc,KAAK,UAC9C,sBAAsB,MAAM;AAC1B,YAAM5B,IAAc,KAAK,WAAW,cAAc,eAAe;AACjE,MAAIA,MACFA,EAAY,MAAA,GAEZA,EAAY,kBAAkBA,EAAY,MAAM,QAAQA,EAAY,MAAM,MAAM;AAAA,IAEpF,CAAC;AAAA,EAEL;AACF;AAKA,MAAMgC,IAAoB,CAACC,IAAkB,mBAAyB;AACpE,EAAI,OAAO,SAAW,OAAe,CAAC,OAAO,eAAe,IAAIA,CAAO,KACrE,eAAe,OAAOA,GAAS5C,CAAkB;AAErD;AAGA2C,EAAA;"}
|
|
1
|
+
{"version":3,"file":"SmartSelect.js","sources":["../src/SmartSelect.ts"],"sourcesContent":["/**\n * SmartSelect Web Component\n * A customizable select dropdown with search, multi-select, and keyboard navigation\n */\n\nexport type SelectOption = {\n value: string;\n label: string;\n};\n\nexport class SmartSelectElement extends HTMLElement {\n declare shadowRoot: ShadowRoot;\n private isOpen: boolean = false;\n private selectedOptions: SelectOption[] = [];\n private filteredOptions: SelectOption[] = [];\n private focusedIndex: number = -1;\n private searchValue: string = '';\n private keyboardNavigating: boolean = false;\n private keyboardTimer?: number;\n\n constructor () {\n super();\n this.attachShadow( { mode: 'open' } );\n\n // Make component focusable\n if ( !this.hasAttribute( 'tabindex' ) ) {\n this.setAttribute( 'tabindex', '0' );\n }\n\n this.render();\n this.bindEvents();\n }\n\n static get observedAttributes (): string[] {\n return [ 'multiple', 'searchable', 'placeholder', 'disabled', 'value', 'options' ];\n }\n\n attributeChangedCallback ( name: string, oldValue: string | null, newValue: string | null ): void {\n if ( oldValue !== newValue ) {\n if ( name === 'options' ) {\n this.filteredOptions = [ ...this.options ];\n }\n this.render();\n }\n }\n\n get multiple (): boolean {\n return this.hasAttribute( 'multiple' );\n }\n\n set multiple ( value: boolean ) {\n if ( value ) {\n this.setAttribute( 'multiple', '' );\n } else {\n this.removeAttribute( 'multiple' );\n }\n }\n\n get searchable (): boolean {\n return this.hasAttribute( 'searchable' );\n }\n\n set searchable ( value: boolean ) {\n if ( value ) {\n this.setAttribute( 'searchable', '' );\n } else {\n this.removeAttribute( 'searchable' );\n }\n }\n\n get placeholder (): string {\n return this.getAttribute( 'placeholder' ) || 'Select an option';\n }\n\n set placeholder ( value: string ) {\n this.setAttribute( 'placeholder', value );\n }\n\n get disabled (): boolean {\n return this.hasAttribute( 'disabled' );\n }\n\n set disabled ( value: boolean ) {\n if ( value ) {\n this.setAttribute( 'disabled', '' );\n } else {\n this.removeAttribute( 'disabled' );\n }\n }\n\n get value (): string | string[] {\n if ( this.multiple ) {\n return this.selectedOptions.map( opt => opt.value );\n }\n return this.selectedOptions.length > 0 ? this.selectedOptions[ 0 ].value : '';\n }\n\n set value ( val: string | string[] ) {\n if ( this.multiple && Array.isArray( val ) ) {\n this.selectedOptions = this.options.filter( opt => val.includes( opt.value ) );\n } else {\n const option = this.options.find( opt => opt.value === val );\n this.selectedOptions = option ? [ option ] : [];\n }\n this.render();\n }\n\n get options (): SelectOption[] {\n const optionsAttr = this.getAttribute( 'options' );\n if ( optionsAttr ) {\n try {\n return JSON.parse( optionsAttr );\n } catch ( e ) {\n console.error( 'Invalid options format:', e );\n return [];\n }\n }\n return [];\n }\n\n set options ( opts: SelectOption[] ) {\n this.setAttribute( 'options', JSON.stringify( opts ) );\n }\n\n /**\n * Opens the dropdown\n */\n open (): void {\n if ( this.disabled ) return;\n this.isOpen = true;\n this.focusedIndex = -1;\n if ( this.options.length > 0 ) {\n this.filteredOptions = [ ...this.options ];\n }\n this.render();\n\n // Update dropdown position based on viewport\n this._updateDropdownPosition();\n\n // Focus search input if searchable\n if ( this.searchable ) {\n requestAnimationFrame( () => {\n const searchInput = this.shadowRoot.querySelector( '.search-input' ) as HTMLInputElement;\n if ( searchInput ) {\n searchInput.focus();\n }\n } );\n }\n\n this.dispatchEvent( new CustomEvent( 'open' ) );\n }\n\n /**\n * Closes the dropdown\n */\n close (): void {\n this.isOpen = false;\n this.focusedIndex = -1;\n this.searchValue = '';\n\n // Reset filtered options when closing\n if ( this.searchable && this.options.length > 0 ) {\n this.filteredOptions = [ ...this.options ];\n }\n\n // Clear any inline positioning styles\n const dropdown = this.shadowRoot.querySelector( '.dropdown' ) as HTMLElement;\n if ( dropdown ) {\n dropdown.style.top = '';\n dropdown.style.left = '';\n dropdown.style.width = '';\n dropdown.style.maxHeight = '';\n }\n\n this.render();\n this.dispatchEvent( new CustomEvent( 'close' ) );\n }\n\n /**\n * Toggles the dropdown open/closed state\n */\n toggle (): void {\n if ( this.isOpen ) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /**\n * Selects an option by its value\n */\n selectOption ( value: string ): void {\n const option = this.options.find( opt => opt.value === value );\n if ( !option ) return;\n\n if ( this.multiple ) {\n if ( !this.selectedOptions.find( opt => opt.value === value ) ) {\n this.selectedOptions.push( option );\n }\n } else {\n this.selectedOptions = [ option ];\n this.close();\n }\n\n this.render();\n this.dispatchEvent( new CustomEvent( 'change', { detail: { value: this.value } } ) );\n }\n\n /**\n * Deselects an option by its value\n */\n deselectOption ( value: string ): void {\n this.selectedOptions = this.selectedOptions.filter( opt => opt.value !== value );\n this.render();\n this.dispatchEvent( new CustomEvent( 'change', { detail: { value: this.value } } ) );\n }\n\n /**\n * Returns an array of currently selected options\n */\n getSelectedOptions (): SelectOption[] {\n return [ ...this.selectedOptions ];\n }\n\n /**\n * Sets the options for the select component\n */\n setOptions ( options: SelectOption[] ): void {\n this.options = options;\n this.filteredOptions = [ ...options ];\n this.selectedOptions = [];\n this.render();\n }\n\n /**\n * Handles search functionality\n */\n private handleSearch ( query: string ): void {\n this.searchValue = query;\n this.filteredOptions = this.options.filter( option =>\n option.label.toLowerCase().includes( query.toLowerCase() )\n );\n this.focusedIndex = -1;\n this.render();\n this.dispatchEvent( new CustomEvent( 'search', { detail: { query } } ) );\n }\n\n /**\n * Updates the visual focus state without full re-render\n */\n private updateFocusedOption (): void {\n const options = this.shadowRoot.querySelectorAll( '.option' );\n\n // Remove focused class from all options\n options.forEach( option => option.classList.remove( 'focused' ) );\n\n // Add focused class to current option\n if ( this.focusedIndex >= 0 && this.focusedIndex < options.length ) {\n options[ this.focusedIndex ].classList.add( 'focused' );\n }\n\n this.scrollToFocusedOption();\n }\n\n /**\n * Scrolls the focused option into view\n */\n private scrollToFocusedOption (): void {\n if ( this.focusedIndex < 0 ) return;\n\n requestAnimationFrame( () => {\n const dropdown = this.shadowRoot.querySelector( '.dropdown' ) as HTMLElement;\n const focusedOption = this.shadowRoot.querySelector( '.option.focused' ) as HTMLElement;\n\n if ( dropdown && focusedOption ) {\n const dropdownRect = dropdown.getBoundingClientRect();\n const optionRect = focusedOption.getBoundingClientRect();\n\n // Check if option is above visible area\n if ( optionRect.top < dropdownRect.top ) {\n dropdown.scrollTop -= ( dropdownRect.top - optionRect.top );\n }\n // Check if option is below visible area\n else if ( optionRect.bottom > dropdownRect.bottom ) {\n dropdown.scrollTop += ( optionRect.bottom - dropdownRect.bottom );\n }\n }\n } );\n }\n\n /**\n * Calculates the optimal dropdown position based on viewport constraints\n */\n private _calculateDropdownPosition (): { top: number; left: number; width: number; maxHeight: number; } | null {\n const trigger = this.shadowRoot.querySelector( '.select-trigger' ) as HTMLElement;\n if ( !trigger ) return null;\n\n const triggerRect = trigger.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const viewportWidth = window.innerWidth;\n const dropdownMaxHeight = 200;\n const dropdownPadding = 10;\n const margin = 2;\n\n // Calculate available space\n const spaceBelow = viewportHeight - triggerRect.bottom;\n const spaceAbove = triggerRect.top;\n\n // Determine if dropdown should open upward\n const shouldOpenUpward = spaceBelow < dropdownMaxHeight + dropdownPadding && spaceAbove > spaceBelow;\n\n // Calculate dimensions\n const width = triggerRect.width;\n const left = Math.max( 0, Math.min( triggerRect.left, viewportWidth - width ) );\n\n let top: number;\n let maxHeight: number;\n\n if ( shouldOpenUpward ) {\n // Position above the trigger\n maxHeight = Math.min( dropdownMaxHeight, spaceAbove - dropdownPadding );\n top = triggerRect.top - maxHeight - margin;\n } else {\n // Position below the trigger\n maxHeight = Math.min( dropdownMaxHeight, spaceBelow - dropdownPadding );\n top = triggerRect.bottom + margin;\n }\n\n return {\n top: Math.max( 0, top ),\n left,\n width,\n maxHeight: Math.max( 100, maxHeight ) // Ensure minimum height\n };\n }\n\n /**\n * Updates dropdown position using fixed positioning relative to viewport\n */\n private _updateDropdownPosition (): void {\n requestAnimationFrame( () => {\n const dropdown = this.shadowRoot.querySelector( '.dropdown' ) as HTMLElement;\n if ( !dropdown ) return;\n\n const position = this._calculateDropdownPosition();\n if ( !position ) return;\n\n // Apply calculated position as inline styles\n dropdown.style.top = `${ position.top }px`;\n dropdown.style.left = `${ position.left }px`;\n dropdown.style.width = `${ position.width }px`;\n dropdown.style.maxHeight = `${ position.maxHeight }px`;\n } );\n }\n\n /**\n * Handles keyboard navigation\n */\n private handleKeydown ( event: KeyboardEvent ): void {\n if ( this.disabled ) return;\n\n // Prevent double execution if event has already been handled\n if ( ( event as any )._smartSelectHandled ) return;\n ( event as any )._smartSelectHandled = true;\n\n switch ( event.key ) {\n case 'ArrowDown':\n event.preventDefault();\n this.keyboardNavigating = true;\n clearTimeout( this.keyboardTimer );\n this.keyboardTimer = window.setTimeout( () => { this.keyboardNavigating = false; }, 100 );\n\n if ( !this.isOpen ) {\n this.open();\n } else {\n // If searchable and search input is focused, move to first option\n const searchInput = this.shadowRoot.querySelector( '.search-input' ) as HTMLInputElement;\n const isSearchFocused = this.searchable && searchInput === this.shadowRoot.activeElement;\n\n if ( isSearchFocused ) {\n this.focusedIndex = 0;\n searchInput.blur(); // Blur search input to allow normal navigation\n // Focus the component to ensure it receives keyboard events\n this.focus();\n this.updateFocusedOption();\n return;\n }\n // Navigate through options\n const newIndex = Math.min( this.focusedIndex + 1, this.filteredOptions.length - 1 );\n this.focusedIndex = newIndex;\n this.updateFocusedOption();\n }\n break;\n\n case 'ArrowUp':\n event.preventDefault();\n this.keyboardNavigating = true;\n clearTimeout( this.keyboardTimer );\n this.keyboardTimer = window.setTimeout( () => { this.keyboardNavigating = false; }, 100 );\n\n if ( this.isOpen ) {\n // If at first option and searchable, focus search input\n if ( this.focusedIndex === 0 && this.searchable ) {\n this.focusedIndex = -1;\n this.updateFocusedOption();\n requestAnimationFrame( () => {\n const searchInput = this.shadowRoot.querySelector( '.search-input' ) as HTMLInputElement;\n if ( searchInput ) {\n searchInput.focus();\n searchInput.setSelectionRange( searchInput.value.length, searchInput.value.length );\n }\n } );\n return;\n }\n // If searchable and search input is focused, do nothing\n const searchInput = this.shadowRoot.querySelector( '.search-input' ) as HTMLInputElement;\n const isSearchFocused = this.searchable && searchInput === this.shadowRoot.activeElement;\n\n if ( isSearchFocused ) {\n return;\n }\n // Navigate through options\n const newIndex = Math.max( this.focusedIndex - 1, -1 );\n this.focusedIndex = newIndex;\n this.updateFocusedOption();\n }\n break;\n\n case 'Enter':\n event.preventDefault();\n if ( this.isOpen && this.focusedIndex >= 0 && this.focusedIndex < this.filteredOptions.length ) {\n this.selectOption( this.filteredOptions[ this.focusedIndex ].value );\n } else if ( !this.isOpen ) {\n this.open();\n }\n break;\n\n case 'Escape':\n event.preventDefault();\n this.close();\n break;\n\n case 'Tab':\n this.close();\n break;\n }\n }\n\n /**\n * Binds all event listeners\n */\n private bindEvents (): void {\n // Listen for keydown events on both the component and shadow root\n const keydownHandler = this.handleKeydown.bind( this );\n this.addEventListener( 'keydown', keydownHandler );\n this.shadowRoot.addEventListener( 'keydown', keydownHandler as EventListener );\n\n // Use event delegation on the shadow root\n this.shadowRoot.addEventListener( 'click', ( e ) => {\n e.stopPropagation();\n const target = e.target as HTMLElement;\n\n if ( target.closest( '.remove-tag' ) ) {\n const value = ( target.closest( '.remove-tag' ) as HTMLElement ).dataset.value;\n if ( value ) this.deselectOption( value );\n } else if ( target.closest( '.option' ) ) {\n const value = ( target.closest( '.option' ) as HTMLElement ).dataset.value;\n if ( value ) this.selectOption( value );\n } else if ( target.closest( '.select-trigger' ) ) {\n this.toggle();\n }\n } );\n\n // Handle mouse hover on options to update focused index\n this.shadowRoot.addEventListener( 'mouseover', ( e ) => {\n // Don't interfere with keyboard navigation\n if ( this.keyboardNavigating ) return;\n\n const target = e.target as HTMLElement;\n if ( target.closest( '.option' ) ) {\n const option = target.closest( '.option' ) as HTMLElement;\n const options = Array.from( this.shadowRoot.querySelectorAll( '.option' ) );\n const newFocusedIndex = options.indexOf( option );\n\n // Only update if the focused index actually changed\n if ( this.focusedIndex !== newFocusedIndex ) {\n // Remove focused class from current option\n const currentFocused = this.shadowRoot.querySelector( '.option.focused' );\n if ( currentFocused ) {\n currentFocused.classList.remove( 'focused' );\n }\n\n // Add focused class to new option\n option.classList.add( 'focused' );\n this.focusedIndex = newFocusedIndex;\n }\n }\n } );\n\n // Handle mouse leaving dropdown to clear focus\n this.shadowRoot.addEventListener( 'mouseleave', ( e ) => {\n // Don't interfere with keyboard navigation\n if ( this.keyboardNavigating ) return;\n\n const target = e.target as HTMLElement;\n if ( target.closest( '.dropdown' ) ) {\n const currentFocused = this.shadowRoot.querySelector( '.option.focused' );\n if ( currentFocused ) {\n currentFocused.classList.remove( 'focused' );\n }\n this.focusedIndex = -1;\n }\n } );\n\n // Handle search input\n this.shadowRoot.addEventListener( 'input', ( e ) => {\n const target = e.target as HTMLInputElement;\n if ( target.classList.contains( 'search-input' ) ) {\n this.handleSearch( target.value );\n }\n } );\n\n // Close dropdown when clicking outside\n document.addEventListener( 'click', ( e ) => {\n if ( !this.contains( e.target as Node ) ) {\n this.close();\n }\n } );\n\n // Update dropdown position on window resize or scroll\n window.addEventListener( 'resize', () => {\n if ( this.isOpen ) {\n this._updateDropdownPosition();\n }\n } );\n\n window.addEventListener( 'scroll', () => {\n if ( this.isOpen ) {\n this._updateDropdownPosition();\n }\n }, true ); // Use capture to catch all scroll events\n }\n\n /**\n * Renders the component\n */\n private render (): void {\n // Initialize filteredOptions if not set\n if ( this.filteredOptions.length === 0 && this.options.length > 0 ) {\n this.filteredOptions = [ ...this.options ];\n }\n\n // Remember if search input was focused before render\n const wasSearchFocused = this.shadowRoot.querySelector( '.search-input' ) === this.shadowRoot.activeElement;\n\n const displayText = this.selectedOptions.length > 0\n ? ( this.multiple\n ? `${ this.selectedOptions.length } selected`\n : this.selectedOptions[ 0 ].label )\n : this.placeholder;\n\n this.shadowRoot.innerHTML = `\n <style>\n :host {\n display: inline-block;\n position: relative;\n min-width: 200px;\n font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);\n font-size: var(--font-size, 14px);\n outline: none;\n }\n\n :host(:focus) .select-trigger {\n border-color: var(--focus-color, #007bff);\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);\n }\n\n :host([disabled]) {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .select-container {\n position: relative;\n }\n\n .select-trigger {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--padding, 8px 12px);\n border: var(--border, 1px solid #ccc);\n border-radius: var(--border-radius, 4px);\n background: var(--background, white);\n cursor: pointer;\n min-height: 36px;\n box-sizing: border-box;\n color: #333;\n user-select: none;\n }\n\n .select-trigger:focus {\n outline: none;\n border-color: var(--focus-color, #007bff);\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);\n }\n\n .select-trigger[disabled] {\n cursor: not-allowed;\n }\n\n .selected-content {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-wrap: wrap;\n flex: 1;\n }\n\n .tag {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n background: var(--tag-background, #e9ecef);\n border-radius: var(--tag-border-radius, 12px);\n font-size: 12px;\n color: var(--tag-color, #495057);\n user-select: none;\n }\n\n .remove-tag {\n cursor: pointer;\n color: var(--remove-color, #6c757d);\n font-weight: bold;\n font-size: 14px;\n }\n\n .remove-tag:hover {\n color: var(--remove-hover-color, #dc3545);\n }\n\n .arrow {\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid var(--arrow-color, #666);\n transition: transform 0.2s;\n }\n\n .arrow.open {\n transform: rotate(180deg);\n }\n\n .dropdown {\n position: fixed;\n z-index: 99999;\n background: var(--dropdown-background, white);\n border: var(--dropdown-border, 1px solid #ccc);\n border-radius: var(--dropdown-border-radius, 4px);\n box-shadow: var(--dropdown-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));\n max-height: 200px;\n overflow-y: auto;\n scroll-behavior: smooth;\n color: #333;\n }\n\n .search-input {\n width: 100%;\n padding: 8px 12px;\n border: none;\n border-bottom: 1px solid #eee;\n font-size: 14px;\n outline: none;\n box-sizing: border-box;\n }\n\n .option {\n padding: 8px 12px;\n cursor: pointer;\n color: var(--option-color, #333);\n transition: background-color 0.2s;\n user-select: none;\n }\n\n .option:hover {\n background-color: var(--option-hover-background, #f8f9fa);\n }\n\n .option.focused {\n background-color: var(--option-focused-background, #007bff);\n color: var(--option-focused-color, white);\n }\n\n .option.selected {\n background-color: var(--option-selected-background, #e3f2fd);\n color: var(--option-selected-color, #1976d2);\n }\n\n .no-options {\n padding: 8px 12px;\n color: var(--no-options-color, #6c757d);\n font-style: italic;\n }\n </style>\n\n <div class=\"select-container\">\n <div class=\"select-trigger\" tabindex=\"-1\">\n <div class=\"selected-content\">\n ${ this.multiple && this.selectedOptions.length > 0\n ? this.selectedOptions.map( option => `\n <span class=\"tag\">\n ${ option.label }\n <span class=\"remove-tag\" data-value=\"${ option.value }\">×</span>\n </span>\n `).join( '' )\n : `<span>${ displayText }</span>`\n }\n </div>\n <div class=\"arrow ${ this.isOpen ? 'open' : '' }\"></div>\n </div>\n\n ${ this.isOpen ? `\n <div class=\"dropdown\">\n ${ this.searchable ? `\n <input\n type=\"text\"\n class=\"search-input\"\n placeholder=\"Search options...\"\n value=\"${ this.searchValue }\"\n >\n ` : '' }\n\n ${ this.filteredOptions.length > 0\n ? this.filteredOptions.map( ( option, index ) => `\n <div\n class=\"option ${ this.selectedOptions.find( selected => selected.value === option.value ) ? 'selected' : '' } ${ index === this.focusedIndex ? 'focused' : '' }\"\n data-value=\"${ option.value }\"\n >\n ${ option.label }\n </div>\n `).join( '' )\n : '<div class=\"no-options\">No options available</div>'\n }\n </div>\n ` : '' }\n </div>\n `;\n\n // Re-focus search input if it was previously focused\n if ( wasSearchFocused && this.searchable && this.isOpen ) {\n requestAnimationFrame( () => {\n const searchInput = this.shadowRoot.querySelector( '.search-input' ) as HTMLInputElement;\n if ( searchInput ) {\n searchInput.focus();\n // Restore cursor position to the end\n searchInput.setSelectionRange( searchInput.value.length, searchInput.value.length );\n }\n } );\n }\n }\n}\n\n/**\n * Conditionally defines the custom element if in a browser environment.\n */\nconst defineSmartSelect = ( tagName: string = 'liwe3-select' ): void => {\n if ( typeof window !== 'undefined' && !window.customElements.get( tagName ) ) {\n customElements.define( tagName, SmartSelectElement );\n }\n};\n\n// Auto-register with default tag name\ndefineSmartSelect();\n\nexport { defineSmartSelect };\n"],"names":["SmartSelectElement","name","oldValue","newValue","value","opt","val","option","optionsAttr","e","opts","searchInput","dropdown","options","query","focusedOption","dropdownRect","optionRect","trigger","triggerRect","viewportHeight","viewportWidth","dropdownMaxHeight","dropdownPadding","margin","spaceBelow","spaceAbove","shouldOpenUpward","width","left","top","maxHeight","position","event","newIndex","keydownHandler","target","newFocusedIndex","currentFocused","wasSearchFocused","displayText","index","selected","defineSmartSelect","tagName"],"mappings":"AAUO,MAAMA,UAA2B,YAAY;AAAA,EAUlD,cAAe;AACb,UAAA,GATF,KAAQ,SAAkB,IAC1B,KAAQ,kBAAkC,CAAA,GAC1C,KAAQ,kBAAkC,CAAA,GAC1C,KAAQ,eAAuB,IAC/B,KAAQ,cAAsB,IAC9B,KAAQ,qBAA8B,IAKpC,KAAK,aAAc,EAAE,MAAM,OAAA,CAAS,GAG9B,KAAK,aAAc,UAAW,KAClC,KAAK,aAAc,YAAY,GAAI,GAGrC,KAAK,OAAA,GACL,KAAK,WAAA;AAAA,EACP;AAAA,EAEA,WAAW,qBAAgC;AACzC,WAAO,CAAE,YAAY,cAAc,eAAe,YAAY,SAAS,SAAU;AAAA,EACnF;AAAA,EAEA,yBAA2BC,GAAcC,GAAyBC,GAAgC;AAChG,IAAKD,MAAaC,MACXF,MAAS,cACZ,KAAK,kBAAkB,CAAE,GAAG,KAAK,OAAQ,IAE3C,KAAK,OAAA;AAAA,EAET;AAAA,EAEA,IAAI,WAAqB;AACvB,WAAO,KAAK,aAAc,UAAW;AAAA,EACvC;AAAA,EAEA,IAAI,SAAWG,GAAiB;AAC9B,IAAKA,IACH,KAAK,aAAc,YAAY,EAAG,IAElC,KAAK,gBAAiB,UAAW;AAAA,EAErC;AAAA,EAEA,IAAI,aAAuB;AACzB,WAAO,KAAK,aAAc,YAAa;AAAA,EACzC;AAAA,EAEA,IAAI,WAAaA,GAAiB;AAChC,IAAK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AAK,OAAO,SAAW,OAAe,CAAC,OAAO,eAAe,IAAKA,CAAQ,KACxE,eAAe,OAAQA,GAAS5C,CAAmB;AAEvD;AAGA2C,EAAA;"}
|
package/dist/Toast.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast Web Component
|
|
3
|
+
* A customizable toast notification system with multiple types, icons, buttons, and auto-dismiss
|
|
4
|
+
*/
|
|
5
|
+
export type ToastType = 'info' | 'warning' | 'error' | 'success';
|
|
6
|
+
export type ToastPosition = 'TL' | 'T' | 'TR' | 'BL' | 'B' | 'BR';
|
|
7
|
+
export type ToastButton = {
|
|
8
|
+
label: string;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
};
|
|
11
|
+
export type ToastConfig = {
|
|
12
|
+
title: string;
|
|
13
|
+
text: string;
|
|
14
|
+
type?: ToastType;
|
|
15
|
+
icon?: string;
|
|
16
|
+
buttons?: ToastButton[];
|
|
17
|
+
closable?: boolean;
|
|
18
|
+
duration?: number;
|
|
19
|
+
position?: ToastPosition;
|
|
20
|
+
onClose?: () => void;
|
|
21
|
+
};
|
|
22
|
+
export declare class ToastElement extends HTMLElement {
|
|
23
|
+
shadowRoot: ShadowRoot;
|
|
24
|
+
private config;
|
|
25
|
+
private autoCloseTimer?;
|
|
26
|
+
private remainingTime;
|
|
27
|
+
private pauseTime;
|
|
28
|
+
private progressBar?;
|
|
29
|
+
constructor();
|
|
30
|
+
static get observedAttributes(): string[];
|
|
31
|
+
attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
|
|
32
|
+
connectedCallback(): void;
|
|
33
|
+
disconnectedCallback(): void;
|
|
34
|
+
get title(): string;
|
|
35
|
+
set title(value: string);
|
|
36
|
+
get text(): string;
|
|
37
|
+
set text(value: string);
|
|
38
|
+
get type(): ToastType;
|
|
39
|
+
set type(value: ToastType);
|
|
40
|
+
get icon(): string | undefined;
|
|
41
|
+
set icon(value: string | undefined);
|
|
42
|
+
get closable(): boolean;
|
|
43
|
+
set closable(value: boolean);
|
|
44
|
+
get duration(): number;
|
|
45
|
+
set duration(value: number);
|
|
46
|
+
get buttons(): ToastButton[];
|
|
47
|
+
set buttons(value: ToastButton[]);
|
|
48
|
+
/**
|
|
49
|
+
* Shows the toast with the given configuration
|
|
50
|
+
*/
|
|
51
|
+
show(config: ToastConfig): void;
|
|
52
|
+
/**
|
|
53
|
+
* Closes the toast
|
|
54
|
+
*/
|
|
55
|
+
close(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Starts the auto-close timer if duration is set
|
|
58
|
+
*/
|
|
59
|
+
private startAutoCloseTimer;
|
|
60
|
+
/**
|
|
61
|
+
* Pauses the auto-close timer
|
|
62
|
+
*/
|
|
63
|
+
private pauseAutoCloseTimer;
|
|
64
|
+
/**
|
|
65
|
+
* Resumes the auto-close timer
|
|
66
|
+
*/
|
|
67
|
+
private resumeAutoCloseTimer;
|
|
68
|
+
/**
|
|
69
|
+
* Clears the auto-close timer
|
|
70
|
+
*/
|
|
71
|
+
private clearAutoCloseTimer;
|
|
72
|
+
/**
|
|
73
|
+
* Starts the progress bar animation
|
|
74
|
+
*/
|
|
75
|
+
private startProgressBarAnimation;
|
|
76
|
+
/**
|
|
77
|
+
* Pauses the progress bar animation
|
|
78
|
+
*/
|
|
79
|
+
private pauseProgressBarAnimation;
|
|
80
|
+
/**
|
|
81
|
+
* Resumes the progress bar animation
|
|
82
|
+
*/
|
|
83
|
+
private resumeProgressBarAnimation;
|
|
84
|
+
/**
|
|
85
|
+
* Gets the color scheme for the toast type
|
|
86
|
+
*/
|
|
87
|
+
private getTypeColors;
|
|
88
|
+
/**
|
|
89
|
+
* Gets the default icon for the toast type
|
|
90
|
+
*/
|
|
91
|
+
private getDefaultIcon;
|
|
92
|
+
/**
|
|
93
|
+
* Binds all event listeners
|
|
94
|
+
*/
|
|
95
|
+
private bindEvents;
|
|
96
|
+
/**
|
|
97
|
+
* Renders the component
|
|
98
|
+
*/
|
|
99
|
+
private render;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Conditionally defines the custom element if in a browser environment.
|
|
103
|
+
*/
|
|
104
|
+
declare const defineToast: (tagName?: string) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Shows a toast notification with the given configuration.
|
|
107
|
+
* This is the recommended way to display toasts.
|
|
108
|
+
*
|
|
109
|
+
* @param config - The toast configuration
|
|
110
|
+
* @returns The toast element instance
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* import { toastAdd } from '@liwe3/webcomponents';
|
|
115
|
+
*
|
|
116
|
+
* toastAdd({
|
|
117
|
+
* title: 'Success!',
|
|
118
|
+
* text: 'Your changes have been saved.',
|
|
119
|
+
* type: 'success',
|
|
120
|
+
* duration: 5000,
|
|
121
|
+
* position: 'TR' // Optional: top-right (default)
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
declare const toastAdd: (config: ToastConfig) => ToastElement;
|
|
126
|
+
export { defineToast, toastAdd };
|
|
127
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../src/Toast.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEjE,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAA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