shirkasoft-ui-components 1.3.14 → 1.4.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/README.md +447 -67
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +7 -7
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +11 -11
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +6 -6
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +914 -0
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +8 -8
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +901 -753
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +5 -5
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +16 -9
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +646 -0
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-knob.mjs +44 -17
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +16 -16
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +42 -31
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +8 -8
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +79 -29
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +7 -7
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +50 -23
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +6 -6
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +4 -4
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +165 -111
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +21 -23
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +9 -9
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +63 -30
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +280 -0
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-theme.mjs +180 -0
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +10 -22
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +60 -53
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +29 -11
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +22 -11
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +9 -10
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/package.json +33 -3
- package/src/baseline.css +2472 -0
- package/src/theme.css +15 -543
- package/src/themes/ocean.css +56 -0
- package/src/themes/sunset.css +55 -0
- package/src/themes/violet.css +25 -0
- package/src/tokens.css +612 -0
- package/types/shirkasoft-ui-components-button.d.ts +1 -1
- package/types/shirkasoft-ui-components-config.d.ts +368 -0
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +2 -1
- package/types/shirkasoft-ui-components-date-picker.d.ts +276 -224
- package/types/shirkasoft-ui-components-fieldset.d.ts +2 -1
- package/types/shirkasoft-ui-components-file-upload.d.ts +11 -5
- package/types/shirkasoft-ui-components-icons.d.ts +1422 -0
- package/types/shirkasoft-ui-components-knob.d.ts +28 -7
- package/types/shirkasoft-ui-components-modal.d.ts +11 -7
- package/types/shirkasoft-ui-components-notification.d.ts +2 -1
- package/types/shirkasoft-ui-components-price-input.d.ts +37 -9
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +3 -3
- package/types/shirkasoft-ui-components-select.d.ts +24 -8
- package/types/shirkasoft-ui-components-sidebar.d.ts +2 -1
- package/types/shirkasoft-ui-components-table.d.ts +91 -77
- package/types/shirkasoft-ui-components-tag.d.ts +1 -1
- package/types/shirkasoft-ui-components-text-field.d.ts +29 -13
- package/types/shirkasoft-ui-components-theme-picker.d.ts +83 -0
- package/types/shirkasoft-ui-components-theme.d.ts +88 -0
- package/types/shirkasoft-ui-components-timeline.d.ts +5 -4
- package/types/shirkasoft-ui-components-toggle.d.ts +20 -13
- package/types/shirkasoft-ui-components-tooltip.d.ts +6 -0
- package/types/shirkasoft-ui-components-utils.d.ts +16 -6
- package/types/shirkasoft-ui-components-wizard.d.ts +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shirkasoft-ui-components-rail-sidebar.mjs","sources":["../../../projects/ui-components/rail-sidebar/rail-sidebar.component.ts","../../../projects/ui-components/rail-sidebar/rail-sidebar.component.html","../../../projects/ui-components/rail-sidebar/shirkasoft-ui-components-rail-sidebar.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n HostListener,\n Injector,\n PLATFORM_ID,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { CommonModule, isPlatformBrowser } from '@angular/common';\nimport { LucideDynamicIcon, LucideMenu, LucideX } from '@lucide/angular';\nimport { getIcon as getIconFromCentral } from 'shirkasoft-ui-components/utils';\nimport { TooltipComponent } from 'shirkasoft-ui-components/tooltip';\n\nexport interface RailSidebarItem {\n id: string;\n label: string;\n icon?: string | any;\n routerLink?: string;\n children?: RailSidebarItem[];\n roles?: string[];\n badge?: string | number;\n disabled?: boolean;\n separator?: boolean;\n}\n\nexport interface RailSidebarSection {\n key: string;\n label: string;\n icon?: string | any;\n routerLink?: string;\n matchPrefixes?: string[];\n items?: RailSidebarItem[];\n}\n\nexport interface RailSidebarSectionEvent {\n key: string;\n routerLink?: string;\n}\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/** Counter used to generate unique element ids per instance. */\nlet nextRailId = 0;\n\n/**\n * Narrow \"rail\" sidebar that expands into sections. Supports sections, roles,\n * language switching, collapse/expand and responsive tooltips. Below\n * `mobileBreakpoint` it turns into an off-canvas drawer opened from a\n * hamburger button, so it doesn't take any width from the page.\n */\n@Component({\n selector: 'shk-rail-sidebar',\n standalone: true,\n imports: [CommonModule, LucideDynamicIcon, TooltipComponent],\n templateUrl: './rail-sidebar.component.html',\n styleUrls: ['./rail-sidebar.component.css'],\n host: {\n '[class.rail-is-mobile]': 'isMobile()',\n },\n})\nexport class RailSidebarComponent {\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly injector = inject(Injector);\n /** Unique id of the drawer (for aria-controls). */\n protected readonly uid = `shk-rail-${nextRailId++}`;\n\n /** Sections presented as expandable areas of the rail. */\n sections = input<RailSidebarSection[]>([]);\n /** Current location url used to detect the active section/item. */\n activeUrl = input<string>('');\n /** Key of the active section, bindable with [(activeSectionKey)]. */\n activeSectionKey = model<string>('');\n /** Collapsed (rail only) state, bindable with [(collapsed)]. */\n collapsed = model<boolean>(false);\n /** Active language code. */\n activeLang = input<string>('es');\n /** Languages available in the language switcher. */\n langs = input<string[]>(['es', 'en']);\n /** Brand logo image/url. */\n logo = input<string>('');\n /** Application name shown when expanded. */\n appName = input<string>('');\n /** Role used to filter items that declare `roles`. */\n userRole = input<string>('');\n /** Optional transform applied to item labels (e.g. i18n). */\n labelPipe = input<(label: string) => string>((label: string) => label);\n /** Width of the collapsed rail. */\n railWidth = input<string>('4.5rem');\n /** Width when a section is expanded. */\n expandedWidth = input<string>('16.5rem');\n /** Tooltip for the workspace/home action. */\n workspaceTooltip = input<string>('Inicio');\n /** Tooltip for the logout action. */\n logoutTooltip = input<string>('Cerrar sesión');\n /** Tooltip for collapsing the sidebar. */\n collapseTooltip = input<string>('Colapsar');\n /** Tooltip for expanding the sidebar. */\n expandTooltip = input<string>('Expandir');\n\n /** Turns the sidebar into a hamburger + drawer below `mobileBreakpoint`. */\n responsive = input<boolean>(true);\n /** Viewport width (px) under which the mobile drawer is used. */\n mobileBreakpoint = input<number>(1024);\n /**\n * Renders the built-in hamburger button on mobile. Set it to false when the\n * app has its own top bar and toggles `[(mobileOpen)]` itself.\n */\n showMobileToggle = input<boolean>(true);\n /** Mobile drawer open state, bindable with [(mobileOpen)]. */\n mobileOpen = model<boolean>(false);\n /** Accessible label of the hamburger button. */\n openMenuLabel = input<string>('Abrir menú');\n /** Accessible label of the drawer close button. */\n closeMenuLabel = input<string>('Cerrar menú');\n\n /** Emitted when a section is selected, with its key and optional route. */\n sectionSelected = output<RailSidebarSectionEvent>();\n /** Emitted when a navigation item is clicked. */\n itemClick = output<RailSidebarItem>();\n /** Emitted with the next language code when the user switches language. */\n setLang = output<string>();\n /** Emitted when the user requests to log out. */\n logoutRequested = output<void>();\n /** Emitted with the new collapsed state after toggling. */\n toggleSidebar = output<boolean>();\n /** Emitted when the workspace/home entry is clicked. */\n workspaceClick = output<void>();\n\n protected getIcon = (name: any) => getIconFromCentral(name, LucideMenu);\n protected readonly closeIcon = LucideX;\n\n /** Current viewport width (updated on resize). */\n private viewportWidth = signal(this.isBrowser ? window.innerWidth : Number.MAX_SAFE_INTEGER);\n /** Whether the mobile drawer mode is active. */\n protected isMobile = computed(\n () => this.responsive() && this.viewportWidth() < this.mobileBreakpoint(),\n );\n /** Whether the section panel is shown (always in the mobile drawer). */\n protected expanded = computed(() => this.isMobile() || !this.collapsed());\n\n private hamburgerBtn = viewChild<ElementRef<HTMLButtonElement>>('hamburger');\n private closeBtn = viewChild<ElementRef<HTMLButtonElement>>('closeBtn');\n /** Set of group ids currently expanded. */\n protected expandedGroups = signal<Set<string>>(new Set());\n\n constructor() {\n // Leaving mobile mode closes the drawer.\n effect(() => {\n if (!this.isMobile() && untracked(this.mobileOpen)) this.mobileOpen.set(false);\n });\n\n // Lock the page scroll while the drawer is open.\n effect((onCleanup) => {\n if (!this.isBrowser || !(this.isMobile() && this.mobileOpen())) return;\n const body = document.body;\n const previous = body.style.overflow;\n body.style.overflow = 'hidden';\n onCleanup(() => (body.style.overflow = previous));\n });\n\n effect(() => {\n const url = this.activeUrl();\n if (!url) return;\n const section = this.sections().find((s) => {\n if (s.matchPrefixes?.length) {\n return s.matchPrefixes.some((prefix) => url.startsWith(prefix));\n }\n return s.routerLink ? url.startsWith(s.routerLink) : false;\n });\n if (section) {\n this.activeSectionKey.set(section.key);\n }\n });\n }\n\n /** Current sidebar width depending on the collapsed state. */\n protected width = computed(() =>\n this.expanded() ? this.expandedWidth() : this.railWidth(),\n );\n\n @HostListener('window:resize')\n protected onResize(): void {\n if (this.isBrowser) this.viewportWidth.set(window.innerWidth);\n }\n\n @HostListener('document:keydown.escape')\n protected onEscape(): void {\n if (this.isMobile() && this.mobileOpen()) this.closeMobile();\n }\n\n /** Opens the mobile drawer and moves the focus into it. */\n openMobile(): void {\n this.mobileOpen.set(true);\n afterNextRender(() => this.closeBtn()?.nativeElement.focus(), { injector: this.injector });\n }\n\n /** Closes the mobile drawer and gives the focus back to the hamburger. */\n closeMobile(): void {\n if (!this.mobileOpen()) return;\n this.mobileOpen.set(false);\n afterNextRender(() => this.hamburgerBtn()?.nativeElement.focus(), { injector: this.injector });\n }\n\n /** The section currently selected. */\n protected activeSection = computed<RailSidebarSection | null>(\n () =>\n this.sections().find((s) => s.key === this.activeSectionKey()) ?? null,\n );\n\n /** Items of the active section, filtered by role. */\n protected navItems = computed<RailSidebarItem[]>(() => {\n const role = this.userRole();\n const items = this.activeSection()?.items ?? [];\n return items.filter((item) => {\n if (!item.roles || item.roles.length === 0) return true;\n return role ? item.roles.includes(role) : false;\n });\n });\n\n /** Applies the `labelPipe` transform to a label. */\n protected label(label: string): string {\n return this.labelPipe()(label);\n }\n\n /** Whether the section matches the active key. */\n protected isSectionActive(section: RailSidebarSection): boolean {\n return section.key === this.activeSectionKey();\n }\n\n /** Whether the item is the best route match for the active url. */\n protected isItemActive(item: RailSidebarItem): boolean {\n if (!item.routerLink) return false;\n return this.bestMatchItem() === item;\n }\n\n /** Whether one of the item's children matches the active url. */\n protected isGroupActive(item: RailSidebarItem): boolean {\n return (\n item.children?.some(\n (c) => c.routerLink && this.matchesUrl(c.routerLink, this.activeUrl()),\n ) ?? false\n );\n }\n\n /** Exact or prefix match between a router link and the active url. */\n private matchesUrl(routerLink: string, url: string): boolean {\n return url === routerLink || url.startsWith(routerLink + '/');\n }\n\n /** Longest (most specific) item whose route matches the active url. */\n private bestMatchItem(): RailSidebarItem | null {\n const url = this.activeUrl();\n let best: RailSidebarItem | null = null;\n for (const item of this.navItems()) {\n if (item.routerLink && this.matchesUrl(item.routerLink, url)) {\n if (!best || item.routerLink.length > best.routerLink!.length) {\n best = item;\n }\n }\n for (const child of item.children ?? []) {\n if (!child.routerLink || !this.matchesUrl(child.routerLink, url)) continue;\n if (!best || child.routerLink.length > best.routerLink!.length) {\n best = child;\n }\n }\n }\n return best;\n }\n\n /** Whether a group is expanded. */\n protected isGroupExpanded(item: RailSidebarItem): boolean {\n return this.expandedGroups().has(item.id);\n }\n\n /** Toggles the expanded state of a group. */\n protected toggleGroup(item: RailSidebarItem): void {\n this.expandedGroups.update((set) => {\n const next = new Set(set);\n if (next.has(item.id)) {\n next.delete(item.id);\n } else {\n next.add(item.id);\n }\n return next;\n });\n }\n\n /** Selects a section, emits `sectionSelected` and expands the rail when collapsed. */\n protected onSectionClick(section: RailSidebarSection): void {\n this.activeSectionKey.set(section.key);\n this.sectionSelected.emit({ key: section.key, routerLink: section.routerLink });\n if (!this.isMobile() && this.collapsed()) {\n this.collapsed.set(false);\n this.toggleSidebar.emit(false);\n }\n }\n\n /** Emits `itemClick` for a navigation item (skipping disabled items). */\n protected onItemClick(item: RailSidebarItem): void {\n if (item.disabled) return;\n this.itemClick.emit(item);\n if (this.isMobile()) this.closeMobile();\n }\n\n /** Emits `workspaceClick` and expands the sidebar if it was collapsed. */\n protected onWorkspace(): void {\n this.workspaceClick.emit();\n if (!this.isMobile() && this.collapsed()) {\n this.collapsed.set(false);\n this.toggleSidebar.emit(false);\n }\n }\n\n /** Emits `logoutRequested` (closing the mobile drawer). */\n protected onLogout(): void {\n this.logoutRequested.emit();\n if (this.isMobile()) this.closeMobile();\n }\n\n /** Cycles to the next language and emits `setLang`. */\n protected onToggleLang(): void {\n const langs = this.langs();\n if (langs.length === 0) return;\n const idx = langs.indexOf(this.activeLang());\n const next = langs[(idx + 1) % langs.length] ?? langs[0];\n this.setLang.emit(next);\n }\n\n /** Toggles collapse and emits `toggleSidebar`. */\n protected onToggleSidebar(): void {\n if (this.isMobile()) {\n this.closeMobile();\n return;\n }\n this.collapsed.update((v) => !v);\n this.toggleSidebar.emit(this.collapsed());\n }\n}\n","@if (isMobile()) {\n <!-- Mobile: hamburger button + backdrop (the aside becomes a drawer) -->\n @if (showMobileToggle() && !mobileOpen()) {\n <button\n #hamburger\n type=\"button\"\n class=\"rail-hamburger _shk-bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n [attr.aria-label]=\"openMenuLabel()\"\n aria-expanded=\"false\"\n [attr.aria-controls]=\"uid\"\n (click)=\"openMobile()\"\n >\n <svg [lucideIcon]=\"getIcon('menu')\" class=\"w-5 h-5\"></svg>\n </button>\n }\n <div class=\"rail-backdrop\" [class.is-open]=\"mobileOpen()\" (click)=\"closeMobile()\"></div>\n}\n\n<aside\n [id]=\"uid\"\n class=\"h-full flex overflow-hidden shrink-0 _shk-bg-white dark:[background-color:var(--shk-surface-50)] border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [class.rail-drawer]=\"isMobile()\"\n [class.is-open]=\"isMobile() && mobileOpen()\"\n [attr.role]=\"isMobile() ? 'dialog' : null\"\n [attr.aria-modal]=\"isMobile() && mobileOpen() ? 'true' : null\"\n [attr.aria-label]=\"isMobile() ? appName() || openMenuLabel() : null\"\n [attr.inert]=\"isMobile() && !mobileOpen() ? '' : null\"\n [style.width]=\"width()\"\n>\n <!-- Rail: vertical icon column -->\n <div\n class=\"h-full flex flex-col items-center shrink-0 px-[0.3rem] py-2 gap-1 border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [style.width]=\"railWidth()\"\n >\n <!-- Workspace / logo -->\n <div class=\"flex items-center justify-center w-full\">\n <button\n type=\"button\"\n (click)=\"onWorkspace()\"\n [class.is-collapsed]=\"!expanded()\"\n class=\"rail-workspace w-[3.2rem] h-[3.2rem] rounded-xl _shk-bg-surface-100 dark:[background-color:var(--shk-surface-200)] border-none grid place-items-center p-0 relative transition-all\"\n [title]=\"workspaceTooltip()\"\n >\n @if (logo()) {\n <img [src]=\"logo()\" alt=\"Logo\" class=\"rail-app-icon w-8 h-8 object-contain\" />\n } @else {\n <svg [lucideIcon]=\"getIcon('menu')\" class=\"rail-app-icon w-6 h-6 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n @if (!expanded()) {\n <svg [lucideIcon]=\"getIcon('panel-right')\" class=\"rail-toggle-icon w-5 h-5 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n </button>\n </div>\n\n <!-- Section actions -->\n <div class=\"rail-actions flex-1 flex flex-col items-center gap-1 pt-1\">\n @for (section of sections(); track section.key) {\n <shk-tooltip [text]=\"label(section.label)\" position=\"right\" mode=\"fixed\">\n <button\n type=\"button\"\n (click)=\"onSectionClick(section)\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [class.is-active]=\"isSectionActive(section)\"\n [attr.aria-label]=\"label(section.label)\"\n >\n <svg [lucideIcon]=\"getIcon(section.icon)\" class=\"w-5 h-5\"></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n\n <!-- Bottom: language + logout -->\n <div class=\"rail-bottom mt-auto flex flex-col items-center gap-1\">\n <button\n type=\"button\"\n (click)=\"onToggleLang()\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"activeLang()\"\n >\n <div class=\"flex flex-col items-center gap-[0.15rem]\">\n <svg [lucideIcon]=\"getIcon('languages')\" class=\"w-5 h-5\"></svg>\n <span class=\"rail-lang-code text-[0.5rem] font-bold tracking-[0.05em] leading-none\">{{ activeLang() | uppercase }}</span>\n </div>\n </button>\n\n <button\n type=\"button\"\n (click)=\"onLogout()\"\n class=\"rail-icon rail-logout w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"logoutTooltip()\"\n >\n <svg [lucideIcon]=\"getIcon('log-out')\" class=\"w-5 h-5\"></svg>\n </button>\n </div>\n </div>\n\n <!-- Nav: section panel (hidden when collapsed) -->\n @if (expanded()) {\n <div class=\"flex-1 min-w-0 flex flex-col _shk-bg-white dark:[background-color:var(--shk-surface-50)]\">\n <!-- Brand header -->\n <div class=\"flex items-center justify-between gap-2 px-3 py-4 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <span class=\"nav-app text-base font-bold whitespace-nowrap overflow-hidden text-ellipsis _shk-text-surface-800 dark:[color:var(--shk-surface-800)]\">\n {{ appName() }}\n </span>\n <button\n #closeBtn\n type=\"button\"\n (click)=\"onToggleSidebar()\"\n class=\"nav-toggle w-[1.8rem] h-[1.8rem] rounded-lg border-none bg-transparent grid place-items-center cursor-pointer shrink-0 transition-colors _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [title]=\"isMobile() ? closeMenuLabel() : collapseTooltip()\"\n [attr.aria-label]=\"isMobile() ? closeMenuLabel() : collapseTooltip()\"\n >\n <svg [lucideIcon]=\"isMobile() ? closeIcon : getIcon('panel-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n\n <!-- Menu -->\n <nav class=\"flex-1 overflow-y-auto _shk-scrollbar px-2 py-3\">\n @if (activeSection()) {\n <div class=\"px-2 pb-3\">\n <span class=\"nav-section-label text-xs font-bold tracking-[0.08em] uppercase _shk-text-surface-400 dark:[color:var(--shk-surface-500)] block whitespace-nowrap overflow-hidden text-ellipsis\">\n {{ label(activeSection()!.label) }}\n </span>\n </div>\n }\n\n <ul class=\"space-y-1\">\n @for (item of navItems(); track item.id) {\n @if (item.separator) {\n <li class=\"my-2 border-t _shk-border dark:[border-color:var(--shk-surface-200)]\"></li>\n }\n\n @if (item.children?.length) {\n <!-- Expandable group -->\n <li>\n <button\n type=\"button\"\n (click)=\"toggleGroup(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isGroupActive(item)\"\n [class._shk-text-white]=\"isGroupActive(item)\"\n [class.shadow-md]=\"isGroupActive(item)\"\n [class._shk-text-surface-700]=\"!isGroupActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isGroupActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isGroupActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isGroupActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n <svg\n [lucideIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 transition-transform duration-200 shrink-0\"\n [class.rotate-180]=\"isGroupExpanded(item)\"\n ></svg>\n </button>\n\n @if (isGroupExpanded(item)) {\n <ul class=\"ml-3 mt-1 space-y-1 border-l-2 _shk-border dark:[border-color:var(--shk-surface-200)] pl-2\">\n @for (child of item.children; track child.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(child)\"\n class=\"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary-soft]=\"isItemActive(child)\"\n [class._shk-bg-primary-soft-dark]=\"isItemActive(child)\"\n [class._shk-text-primary-700]=\"isItemActive(child)\"\n [class.dark:[color:var(--shk-primary-300)]]=\"isItemActive(child)\"\n [class._shk-text-surface-600]=\"!isItemActive(child)\"\n [class.dark:[color:var(--shk-surface-400)]]=\"!isItemActive(child)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(child)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(child)\"\n [class.hover:[color:var(--shk-surface-900)]]=\"!isItemActive(child)\"\n [class.dark:hover:[color:var(--shk-surface-700)]]=\"!isItemActive(child)\"\n >\n @if (child.icon) {\n <svg [lucideIcon]=\"getIcon(child.icon)\" class=\"w-4 h-4 shrink-0\"></svg>\n }\n <span class=\"whitespace-nowrap overflow-hidden\">{{ label(child.label) }}</span>\n @if (isItemActive(child)) {\n <span class=\"w-1.5 h-1.5 rounded-full _shk-bg-primary shrink-0 ml-auto\"></span>\n }\n </button>\n </li>\n }\n </ul>\n }\n </li>\n } @else {\n <!-- Standalone item -->\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isItemActive(item)\"\n [class._shk-text-white]=\"isItemActive(item)\"\n [class.shadow-md]=\"isItemActive(item)\"\n [class._shk-text-surface-700]=\"!isItemActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isItemActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n @if (item.badge !== undefined) {\n <span class=\"text-xs font-bold px-2 py-0.5 rounded-full _shk-bg-primary _shk-text-white shrink-0\">\n {{ item.badge }}\n </span>\n }\n </button>\n </li>\n }\n }\n </ul>\n </nav>\n </div>\n }\n</aside>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["getIconFromCentral"],"mappings":";;;;;;;;AAgDA;;;;AAIG;AAEH;AACA,IAAI,UAAU,GAAG,CAAC;AAElB;;;;;AAKG;MAWU,oBAAoB,CAAA;AAqF/B,IAAA,WAAA,GAAA;QApFiB,IAAA,CAAA,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAClD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAEzB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A,EAAA,KAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,WAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,eAAA,CAAA,EAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,WAAW,kEACf,UAAU,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA;sBAuCrE,YAAY;uBAAC,eAAe;;sBAK5B,YAAY;uBAAC,yBAAyB;;;AEtMzC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"shirkasoft-ui-components-rail-sidebar.mjs","sources":["../../../projects/ui-components/rail-sidebar/rail-sidebar.component.ts","../../../projects/ui-components/rail-sidebar/rail-sidebar.component.html","../../../projects/ui-components/rail-sidebar/shirkasoft-ui-components-rail-sidebar.ts"],"sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n ElementRef,\n HostListener,\n Injector,\n PLATFORM_ID,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { CommonModule, isPlatformBrowser } from '@angular/common';\nimport { ShkIconDirective, LucideMenu, LucideX } from 'shirkasoft-ui-components/icons';\nimport { getIcon as getIconFromCentral } from 'shirkasoft-ui-components/utils';\nimport { TooltipComponent } from 'shirkasoft-ui-components/tooltip';\n\nexport interface RailSidebarItem {\n id: string;\n label: string;\n icon?: string | any;\n routerLink?: string;\n children?: RailSidebarItem[];\n roles?: string[];\n badge?: string | number;\n disabled?: boolean;\n separator?: boolean;\n}\n\nexport interface RailSidebarSection {\n key: string;\n label: string;\n icon?: string | any;\n routerLink?: string;\n matchPrefixes?: string[];\n items?: RailSidebarItem[];\n}\n\nexport interface RailSidebarSectionEvent {\n key: string;\n routerLink?: string;\n}\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/** Counter used to generate unique element ids per instance. */\nlet nextRailId = 0;\n\n/**\n * Narrow \"rail\" sidebar that expands into sections. Supports sections, roles,\n * language switching, collapse/expand and responsive tooltips. Below\n * `mobileBreakpoint` it turns into an off-canvas drawer opened from a\n * hamburger button, so it doesn't take any width from the page.\n */\n@Component({\n selector: 'shk-rail-sidebar',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, ShkIconDirective, TooltipComponent],\n templateUrl: './rail-sidebar.component.html',\n styleUrls: ['./rail-sidebar.component.css'],\n host: {\n '[class.rail-is-mobile]': 'isMobile()',\n },\n})\nexport class RailSidebarComponent {\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly injector = inject(Injector);\n /** Unique id of the drawer (for aria-controls). */\n protected readonly uid = `shk-rail-${nextRailId++}`;\n\n /** Sections presented as expandable areas of the rail. */\n sections = input<RailSidebarSection[]>([]);\n /** Current location url used to detect the active section/item. */\n activeUrl = input<string>('');\n /** Key of the active section, bindable with [(activeSectionKey)]. */\n activeSectionKey = model<string>('');\n /** Collapsed (rail only) state, bindable with [(collapsed)]. */\n collapsed = model<boolean>(false);\n /** Active language code. */\n activeLang = input<string>('es');\n /** Languages available in the language switcher. */\n langs = input<string[]>(['es', 'en']);\n /** Brand logo image/url. */\n logo = input<string>('');\n /** Application name shown when expanded. */\n appName = input<string>('');\n /** Role used to filter items that declare `roles`. */\n userRole = input<string>('');\n /** Optional transform applied to item labels (e.g. i18n). */\n labelPipe = input<(label: string) => string>((label: string) => label);\n /** Width of the collapsed rail. */\n railWidth = input<string>('4.5rem');\n /** Width when a section is expanded. */\n expandedWidth = input<string>('16.5rem');\n /** Tooltip for the workspace/home action. */\n workspaceTooltip = input<string>('Inicio');\n /** Tooltip for the logout action. */\n logoutTooltip = input<string>('Cerrar sesión');\n /** Tooltip for collapsing the sidebar. */\n collapseTooltip = input<string>('Colapsar');\n /** Tooltip for expanding the sidebar. */\n expandTooltip = input<string>('Expandir');\n\n /** Turns the sidebar into a hamburger + drawer below `mobileBreakpoint`. */\n responsive = input<boolean>(true);\n /** Viewport width (px) under which the mobile drawer is used. */\n mobileBreakpoint = input<number>(1024);\n /**\n * Renders the built-in hamburger button on mobile. Set it to false when the\n * app has its own top bar and toggles `[(mobileOpen)]` itself.\n */\n showMobileToggle = input<boolean>(true);\n /** Mobile drawer open state, bindable with [(mobileOpen)]. */\n mobileOpen = model<boolean>(false);\n /** Accessible label of the hamburger button. */\n openMenuLabel = input<string>('Abrir menú');\n /** Accessible label of the drawer close button. */\n closeMenuLabel = input<string>('Cerrar menú');\n\n /** Emitted when a section is selected, with its key and optional route. */\n sectionSelected = output<RailSidebarSectionEvent>();\n /** Emitted when a navigation item is clicked. */\n itemClick = output<RailSidebarItem>();\n /** Emitted with the next language code when the user switches language. */\n setLang = output<string>();\n /** Emitted when the user requests to log out. */\n logoutRequested = output<void>();\n /** Emitted with the new collapsed state after toggling. */\n toggleSidebar = output<boolean>();\n /** Emitted when the workspace/home entry is clicked. */\n workspaceClick = output<void>();\n\n protected getIcon = (name: any) => getIconFromCentral(name, LucideMenu);\n protected readonly closeIcon = LucideX;\n\n /** Current viewport width (updated on resize). */\n private viewportWidth = signal(this.isBrowser ? window.innerWidth : Number.MAX_SAFE_INTEGER);\n /** Whether the mobile drawer mode is active. */\n protected isMobile = computed(\n () => this.responsive() && this.viewportWidth() < this.mobileBreakpoint(),\n );\n /** Whether the section panel is shown (always in the mobile drawer). */\n protected expanded = computed(() => this.isMobile() || !this.collapsed());\n\n private hamburgerBtn = viewChild<ElementRef<HTMLButtonElement>>('hamburger');\n private closeBtn = viewChild<ElementRef<HTMLButtonElement>>('closeBtn');\n /** Set of group ids currently expanded. */\n protected expandedGroups = signal<Set<string>>(new Set());\n\n constructor() {\n // Leaving mobile mode closes the drawer.\n effect(() => {\n if (!this.isMobile() && untracked(this.mobileOpen)) this.mobileOpen.set(false);\n });\n\n // Lock the page scroll while the drawer is open.\n effect((onCleanup) => {\n if (!this.isBrowser || !(this.isMobile() && this.mobileOpen())) return;\n const body = document.body;\n const previous = body.style.overflow;\n body.style.overflow = 'hidden';\n onCleanup(() => (body.style.overflow = previous));\n });\n\n effect(() => {\n const url = this.activeUrl();\n if (!url) return;\n const section = this.sections().find((s) => {\n if (s.matchPrefixes?.length) {\n return s.matchPrefixes.some((prefix) => url.startsWith(prefix));\n }\n return s.routerLink ? url.startsWith(s.routerLink) : false;\n });\n if (section) {\n this.activeSectionKey.set(section.key);\n }\n });\n }\n\n /** Current sidebar width depending on the collapsed state. */\n protected width = computed(() =>\n this.expanded() ? this.expandedWidth() : this.railWidth(),\n );\n\n @HostListener('window:resize')\n protected onResize(): void {\n if (this.isBrowser) this.viewportWidth.set(window.innerWidth);\n }\n\n @HostListener('document:keydown.escape')\n protected onEscape(): void {\n if (this.isMobile() && this.mobileOpen()) this.closeMobile();\n }\n\n /** Opens the mobile drawer and moves the focus into it. */\n openMobile(): void {\n this.mobileOpen.set(true);\n afterNextRender(() => this.closeBtn()?.nativeElement.focus(), { injector: this.injector });\n }\n\n /** Closes the mobile drawer and gives the focus back to the hamburger. */\n closeMobile(): void {\n if (!this.mobileOpen()) return;\n this.mobileOpen.set(false);\n afterNextRender(() => this.hamburgerBtn()?.nativeElement.focus(), { injector: this.injector });\n }\n\n /** The section currently selected. */\n protected activeSection = computed<RailSidebarSection | null>(\n () =>\n this.sections().find((s) => s.key === this.activeSectionKey()) ?? null,\n );\n\n /** Items of the active section, filtered by role. */\n protected navItems = computed<RailSidebarItem[]>(() => {\n const role = this.userRole();\n const items = this.activeSection()?.items ?? [];\n return items.filter((item) => {\n if (!item.roles || item.roles.length === 0) return true;\n return role ? item.roles.includes(role) : false;\n });\n });\n\n /** Applies the `labelPipe` transform to a label. */\n protected label(label: string): string {\n return this.labelPipe()(label);\n }\n\n /** Whether the section matches the active key. */\n protected isSectionActive(section: RailSidebarSection): boolean {\n return section.key === this.activeSectionKey();\n }\n\n /** Whether the item is the best route match for the active url. */\n protected isItemActive(item: RailSidebarItem): boolean {\n if (!item.routerLink) return false;\n return this.bestMatchItem() === item;\n }\n\n /** Whether one of the item's children matches the active url. */\n protected isGroupActive(item: RailSidebarItem): boolean {\n return (\n item.children?.some(\n (c) => c.routerLink && this.matchesUrl(c.routerLink, this.activeUrl()),\n ) ?? false\n );\n }\n\n /** Exact or prefix match between a router link and the active url. */\n private matchesUrl(routerLink: string, url: string): boolean {\n return url === routerLink || url.startsWith(routerLink + '/');\n }\n\n /** Longest (most specific) item whose route matches the active url. */\n private bestMatchItem(): RailSidebarItem | null {\n const url = this.activeUrl();\n let best: RailSidebarItem | null = null;\n for (const item of this.navItems()) {\n if (item.routerLink && this.matchesUrl(item.routerLink, url)) {\n if (!best || item.routerLink.length > best.routerLink!.length) {\n best = item;\n }\n }\n for (const child of item.children ?? []) {\n if (!child.routerLink || !this.matchesUrl(child.routerLink, url)) continue;\n if (!best || child.routerLink.length > best.routerLink!.length) {\n best = child;\n }\n }\n }\n return best;\n }\n\n /** Whether a group is expanded. */\n protected isGroupExpanded(item: RailSidebarItem): boolean {\n return this.expandedGroups().has(item.id);\n }\n\n /** Toggles the expanded state of a group. */\n protected toggleGroup(item: RailSidebarItem): void {\n this.expandedGroups.update((set) => {\n const next = new Set(set);\n if (next.has(item.id)) {\n next.delete(item.id);\n } else {\n next.add(item.id);\n }\n return next;\n });\n }\n\n /** Selects a section, emits `sectionSelected` and expands the rail when collapsed. */\n protected onSectionClick(section: RailSidebarSection): void {\n this.activeSectionKey.set(section.key);\n this.sectionSelected.emit({ key: section.key, routerLink: section.routerLink });\n if (!this.isMobile() && this.collapsed()) {\n this.collapsed.set(false);\n this.toggleSidebar.emit(false);\n }\n }\n\n /** Emits `itemClick` for a navigation item (skipping disabled items). */\n protected onItemClick(item: RailSidebarItem): void {\n if (item.disabled) return;\n this.itemClick.emit(item);\n if (this.isMobile()) this.closeMobile();\n }\n\n /** Emits `workspaceClick` and expands the sidebar if it was collapsed. */\n protected onWorkspace(): void {\n this.workspaceClick.emit();\n if (!this.isMobile() && this.collapsed()) {\n this.collapsed.set(false);\n this.toggleSidebar.emit(false);\n }\n }\n\n /** Emits `logoutRequested` (closing the mobile drawer). */\n protected onLogout(): void {\n this.logoutRequested.emit();\n if (this.isMobile()) this.closeMobile();\n }\n\n /** Cycles to the next language and emits `setLang`. */\n protected onToggleLang(): void {\n const langs = this.langs();\n if (langs.length === 0) return;\n const idx = langs.indexOf(this.activeLang());\n const next = langs[(idx + 1) % langs.length] ?? langs[0];\n this.setLang.emit(next);\n }\n\n /** Toggles collapse and emits `toggleSidebar`. */\n protected onToggleSidebar(): void {\n if (this.isMobile()) {\n this.closeMobile();\n return;\n }\n this.collapsed.update((v) => !v);\n this.toggleSidebar.emit(this.collapsed());\n }\n}\n","@if (isMobile()) {\n <!-- Mobile: hamburger button + backdrop (the aside becomes a drawer) -->\n @if (showMobileToggle() && !mobileOpen()) {\n <button\n #hamburger\n type=\"button\"\n class=\"rail-hamburger _shk-bg-panel-raised border _shk-border _shk-text-surface-700\"\n [attr.aria-label]=\"openMenuLabel()\"\n aria-expanded=\"false\"\n [attr.aria-controls]=\"uid\"\n (click)=\"openMobile()\"\n >\n <svg [shkIcon]=\"getIcon('menu')\" class=\"w-5 h-5\"></svg>\n </button>\n }\n <div class=\"rail-backdrop\" [class.is-open]=\"mobileOpen()\" (click)=\"closeMobile()\"></div>\n}\n\n<aside\n [id]=\"uid\"\n class=\"h-full flex overflow-hidden shrink-0 _shk-bg-panel border-r _shk-border\"\n [class.rail-drawer]=\"isMobile()\"\n [class.is-open]=\"isMobile() && mobileOpen()\"\n [attr.role]=\"isMobile() ? 'dialog' : null\"\n [attr.aria-modal]=\"isMobile() && mobileOpen() ? 'true' : null\"\n [attr.aria-label]=\"isMobile() ? appName() || openMenuLabel() : null\"\n [attr.inert]=\"isMobile() && !mobileOpen() ? '' : null\"\n [style.width]=\"width()\"\n>\n <!-- Rail: vertical icon column -->\n <div\n class=\"h-full flex flex-col items-center shrink-0 px-[0.3rem] py-2 gap-1 border-r _shk-border\"\n [style.width]=\"railWidth()\"\n >\n <!-- Workspace / logo -->\n <div class=\"flex items-center justify-center w-full\">\n <button\n type=\"button\"\n (click)=\"onWorkspace()\"\n [class.is-collapsed]=\"!expanded()\"\n class=\"rail-workspace w-[3.2rem] h-[3.2rem] rounded-xl _shk-bg-surface-100 border-none grid place-items-center p-0 relative transition-all\"\n [title]=\"workspaceTooltip()\"\n >\n @if (logo()) {\n <img [src]=\"logo()\" alt=\"Logo\" class=\"rail-app-icon w-8 h-8 object-contain\" />\n } @else {\n <svg [shkIcon]=\"getIcon('menu')\" class=\"rail-app-icon w-6 h-6 _shk-text-surface-700\"></svg>\n }\n @if (!expanded()) {\n <svg [shkIcon]=\"getIcon('panel-right')\" class=\"rail-toggle-icon w-5 h-5 _shk-text-surface-700\"></svg>\n }\n </button>\n </div>\n\n <!-- Section actions -->\n <div class=\"rail-actions flex-1 flex flex-col items-center gap-1 pt-1\">\n @for (section of sections(); track section.key) {\n <shk-tooltip [text]=\"label(section.label)\" position=\"right\" mode=\"fixed\">\n <button\n type=\"button\"\n (click)=\"onSectionClick(section)\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [class.is-active]=\"isSectionActive(section)\"\n [attr.aria-label]=\"label(section.label)\"\n >\n <svg [shkIcon]=\"getIcon(section.icon)\" class=\"w-5 h-5\"></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n\n <!-- Bottom: language + logout -->\n <div class=\"rail-bottom mt-auto flex flex-col items-center gap-1\">\n <button\n type=\"button\"\n (click)=\"onToggleLang()\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"activeLang()\"\n >\n <div class=\"flex flex-col items-center gap-[0.15rem]\">\n <svg [shkIcon]=\"getIcon('languages')\" class=\"w-5 h-5\"></svg>\n <span class=\"rail-lang-code text-[0.5rem] font-bold tracking-[0.05em] leading-none\">{{ activeLang() | uppercase }}</span>\n </div>\n </button>\n\n <button\n type=\"button\"\n (click)=\"onLogout()\"\n class=\"rail-icon rail-logout w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"logoutTooltip()\"\n >\n <svg [shkIcon]=\"getIcon('log-out')\" class=\"w-5 h-5\"></svg>\n </button>\n </div>\n </div>\n\n <!-- Nav: section panel (hidden when collapsed) -->\n @if (expanded()) {\n <div class=\"flex-1 min-w-0 flex flex-col _shk-bg-panel\">\n <!-- Brand header -->\n <div class=\"flex items-center justify-between gap-2 px-3 py-4 border-b _shk-border\">\n <span class=\"nav-app text-base font-bold whitespace-nowrap overflow-hidden text-ellipsis _shk-text-surface-800\">\n {{ appName() }}\n </span>\n <button\n #closeBtn\n type=\"button\"\n (click)=\"onToggleSidebar()\"\n class=\"nav-toggle w-[1.8rem] h-[1.8rem] rounded-lg border-none bg-transparent grid place-items-center cursor-pointer shrink-0 transition-colors _shk-text-surface-700 hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [title]=\"isMobile() ? closeMenuLabel() : collapseTooltip()\"\n [attr.aria-label]=\"isMobile() ? closeMenuLabel() : collapseTooltip()\"\n >\n <svg [shkIcon]=\"isMobile() ? closeIcon : getIcon('panel-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n\n <!-- Menu -->\n <nav class=\"flex-1 overflow-y-auto _shk-scrollbar px-2 py-3\">\n @if (activeSection()) {\n <div class=\"px-2 pb-3\">\n <span class=\"nav-section-label text-xs font-bold tracking-[0.08em] uppercase _shk-text-surface-400 block whitespace-nowrap overflow-hidden text-ellipsis\">\n {{ label(activeSection()!.label) }}\n </span>\n </div>\n }\n\n <ul class=\"space-y-1\">\n @for (item of navItems(); track item.id) {\n @if (item.separator) {\n <li class=\"my-2 border-t _shk-border\"></li>\n }\n\n @if (item.children?.length) {\n <!-- Expandable group -->\n <li>\n <button\n type=\"button\"\n (click)=\"toggleGroup(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isGroupActive(item)\"\n [class._shk-text-white]=\"isGroupActive(item)\"\n [class.shadow-md]=\"isGroupActive(item)\"\n [class._shk-text-surface-700]=\"!isGroupActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isGroupActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isGroupActive(item)\"\n >\n @if (item.icon) {\n <svg [shkIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n <svg\n [shkIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 transition-transform duration-200 shrink-0\"\n [class.rotate-180]=\"isGroupExpanded(item)\"\n ></svg>\n </button>\n\n @if (isGroupExpanded(item)) {\n <ul class=\"ml-3 mt-1 space-y-1 border-l-2 _shk-border pl-2\">\n @for (child of item.children; track child.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(child)\"\n class=\"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary-soft]=\"isItemActive(child)\"\n [class._shk-bg-primary-soft-dark]=\"isItemActive(child)\"\n [class._shk-text-primary-700]=\"isItemActive(child)\"\n [class.dark:[color:var(--shk-primary-300)]]=\"isItemActive(child)\"\n [class._shk-text-surface-600]=\"!isItemActive(child)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(child)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(child)\"\n [class.hover:[color:var(--shk-surface-900)]]=\"!isItemActive(child)\"\n [class.dark:hover:[color:var(--shk-surface-700)]]=\"!isItemActive(child)\"\n >\n @if (child.icon) {\n <svg [shkIcon]=\"getIcon(child.icon)\" class=\"w-4 h-4 shrink-0\"></svg>\n }\n <span class=\"whitespace-nowrap overflow-hidden\">{{ label(child.label) }}</span>\n @if (isItemActive(child)) {\n <span class=\"w-1.5 h-1.5 rounded-full _shk-bg-primary shrink-0 ml-auto\"></span>\n }\n </button>\n </li>\n }\n </ul>\n }\n </li>\n } @else {\n <!-- Standalone item -->\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isItemActive(item)\"\n [class._shk-text-white]=\"isItemActive(item)\"\n [class.shadow-md]=\"isItemActive(item)\"\n [class._shk-text-surface-700]=\"!isItemActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(item)\"\n >\n @if (item.icon) {\n <svg [shkIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n @if (item.badge !== undefined) {\n <span class=\"text-xs font-bold px-2 py-0.5 rounded-full _shk-bg-primary _shk-text-white shrink-0\">\n {{ item.badge }}\n </span>\n }\n </button>\n </li>\n }\n }\n </ul>\n </nav>\n </div>\n }\n</aside>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["getIconFromCentral"],"mappings":";;;;;;;;AAiDA;;;;AAIG;AAEH;AACA,IAAI,UAAU,GAAG,CAAC;AAElB;;;;;AAKG;MAWU,oBAAoB,CAAA;AAqF/B,IAAA,WAAA,GAAA;QApFiB,IAAA,CAAA,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAClD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAEzB,QAAA,IAAA,CAAA,GAAG,GAAG,CAAA,SAAA,EAAY,UAAU,EAAE,EAAE;;AAGnD,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAuB,EAAE,+EAAC;;AAE1C,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAS,EAAE,gFAAC;;AAE7B,QAAA,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAS,EAAE,uFAAC;;AAEpC,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAU,KAAK,gFAAC;;AAEjC,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAS,IAAI,iFAAC;;QAEhC,IAAA,CAAA,KAAK,GAAG,KAAK,CAAW,CAAC,IAAI,EAAE,IAAI,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;;AAErC,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;;AAExB,QAAA,IAAA,CAAA,OA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AAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,eAAA,CAAA,EAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,WAAW,kEACf,UAAU,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA;sBAuCrE,YAAY;uBAAC,eAAe;;sBAK5B,YAAY;uBAAC,yBAAyB;;;AEvMzC;;AAEG;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, output, viewChild, signal, computed, inject, DestroyRef, effect, forwardRef, HostListener, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { input, output, viewChild, model, signal, computed, inject, DestroyRef, effect, forwardRef, HostListener, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { ReactiveFormsModule, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import * as i1 from '@jsverse/transloco';
|
|
7
7
|
import { TranslocoService, TranslocoModule } from '@jsverse/transloco';
|
|
8
|
-
import { LucideChevronDown,
|
|
8
|
+
import { LucideChevronDown, ShkIconDirective } from 'shirkasoft-ui-components/icons';
|
|
9
9
|
import { getIcon, PortalDirective } from 'shirkasoft-ui-components/utils';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -19,36 +19,57 @@ import { getIcon, PortalDirective } from 'shirkasoft-ui-components/utils';
|
|
|
19
19
|
* reactive-form integration.
|
|
20
20
|
*/
|
|
21
21
|
class SelectComponent {
|
|
22
|
+
/** Internal alias kept for the existing implementation. */
|
|
23
|
+
get _value() {
|
|
24
|
+
return this.value;
|
|
25
|
+
}
|
|
26
|
+
/** Computes the fixed position of the dropdown so it's not clipped by overflow. */
|
|
27
|
+
/** Max height of the dropdown panel (matches `max-h-[240px]` in the template). */
|
|
28
|
+
static { this.DROPDOWN_MAX_HEIGHT = 240; }
|
|
29
|
+
/** Approximate height of one option row (`py-2` + `text-sm`), used before the panel is rendered. */
|
|
30
|
+
static { this.OPTION_HEIGHT = 40; }
|
|
31
|
+
/**
|
|
32
|
+
* Height the panel will take: the rendered height when the panel already
|
|
33
|
+
* exists, otherwise an estimate from the number of rows. Before this the
|
|
34
|
+
* position always assumed 240px, so a 3-option select near the bottom of the
|
|
35
|
+
* viewport opened upward even though it fitted below.
|
|
36
|
+
*/
|
|
37
|
+
dropdownHeight() {
|
|
38
|
+
const max = SelectComponent.DROPDOWN_MAX_HEIGHT;
|
|
39
|
+
const panel = this.dropdownContainer()?.nativeElement;
|
|
40
|
+
if (panel && panel.offsetHeight > 0)
|
|
41
|
+
return Math.min(panel.offsetHeight, max);
|
|
42
|
+
const rows = this.regularOptions().length + (this.showCustomOption() ? 1 : 0);
|
|
43
|
+
// Empty / loading states still render one row.
|
|
44
|
+
return Math.min(Math.max(rows, 1) * SelectComponent.OPTION_HEIGHT + 2, max);
|
|
45
|
+
}
|
|
22
46
|
/** Computes the fixed position of the dropdown so it's not clipped by overflow. */
|
|
23
47
|
computeDropdownPosition() {
|
|
24
48
|
const trigger = this.selectTrigger()?.nativeElement;
|
|
25
49
|
if (!trigger)
|
|
26
50
|
return;
|
|
27
51
|
const rect = trigger.getBoundingClientRect();
|
|
28
|
-
const
|
|
29
|
-
const spaceBelow = window.innerHeight - rect.bottom;
|
|
30
|
-
const spaceAbove = rect.top;
|
|
52
|
+
const height = this.dropdownHeight();
|
|
31
53
|
const opensUpward = this.dropdownUpward();
|
|
32
54
|
const inModal = !!trigger.closest('shk-modal');
|
|
33
55
|
let top;
|
|
34
56
|
if (opensUpward) {
|
|
35
|
-
top = rect.top -
|
|
57
|
+
top = rect.top - height - 4;
|
|
36
58
|
if (top < 8)
|
|
37
59
|
top = 8;
|
|
38
60
|
}
|
|
39
61
|
else {
|
|
40
62
|
top = rect.bottom + 4;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
top = 8;
|
|
63
|
+
// Flip only when the real panel does not fit below and does fit above.
|
|
64
|
+
if (!inModal && top + height > window.innerHeight - 8 && rect.top - height - 4 >= 8) {
|
|
65
|
+
top = rect.top - height - 4;
|
|
45
66
|
}
|
|
46
67
|
}
|
|
47
68
|
this.dropdownPosition.set({ top, left: rect.left, width: rect.width });
|
|
48
69
|
}
|
|
49
70
|
constructor(elementRef) {
|
|
50
71
|
this.elementRef = elementRef;
|
|
51
|
-
/** Resolves icon names to
|
|
72
|
+
/** Resolves icon names to SVG data, falling back to a chevron. */
|
|
52
73
|
this.getIcon = (name) => getIcon(name, LucideChevronDown);
|
|
53
74
|
/** Available options. */
|
|
54
75
|
this.options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
@@ -92,6 +113,8 @@ class SelectComponent {
|
|
|
92
113
|
this.showEmptyOption = input(true, ...(ngDevMode ? [{ debugName: "showEmptyOption" }] : /* istanbul ignore next */ []));
|
|
93
114
|
/** Emits when the selection changes (new value or array in multiple mode). */
|
|
94
115
|
this.selectionChange = output();
|
|
116
|
+
/** Emitted on blur/close so Signal Forms can mark the field as touched. */
|
|
117
|
+
this.touch = output();
|
|
95
118
|
/** Emits the debounced search term while typing. */
|
|
96
119
|
this.search = output();
|
|
97
120
|
/** Reference to the filter input inside the dropdown (when searchable). */
|
|
@@ -102,8 +125,8 @@ class SelectComponent {
|
|
|
102
125
|
this.selectTrigger = viewChild('selectTrigger', ...(ngDevMode ? [{ debugName: "selectTrigger" }] : /* istanbul ignore next */ []));
|
|
103
126
|
/** Reference to the dropdown list container. */
|
|
104
127
|
this.dropdownContainer = viewChild('dropdownContainer', ...(ngDevMode ? [{ debugName: "dropdownContainer" }] : /* istanbul ignore next */ []));
|
|
105
|
-
/**
|
|
106
|
-
this.
|
|
128
|
+
/** Selection value. Two-way bindable and used by Signal Forms `[formField]`. */
|
|
129
|
+
this.value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
107
130
|
/** Whether the dropdown is open. */
|
|
108
131
|
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
109
132
|
/** Index of the currently focused option for keyboard navigation. */
|
|
@@ -125,8 +148,6 @@ class SelectComponent {
|
|
|
125
148
|
/** Whether control status/value subscriptions have been attached. */
|
|
126
149
|
this.subscribed = signal(false, ...(ngDevMode ? [{ debugName: "subscribed" }] : /* istanbul ignore next */ []));
|
|
127
150
|
this.valueSubscribed = signal(false, ...(ngDevMode ? [{ debugName: "valueSubscribed" }] : /* istanbul ignore next */ []));
|
|
128
|
-
/** Current selection value. */
|
|
129
|
-
this.value = computed(() => this._value(), ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
130
151
|
/** True when the select is disabled via input or by the reactive form. */
|
|
131
152
|
this.isDisabled = computed(() => this.disabled() || this._isDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
132
153
|
/** Resolves the form control from `control` or from `formGroup`+`label`. */
|
|
@@ -386,6 +407,7 @@ class SelectComponent {
|
|
|
386
407
|
}
|
|
387
408
|
/** Marks the control as touched and updates validity and error state. */
|
|
388
409
|
markAsTouchedAndUpdate() {
|
|
410
|
+
this.touch.emit();
|
|
389
411
|
const ctrl = this.actualControl();
|
|
390
412
|
if (ctrl) {
|
|
391
413
|
ctrl.markAsTouched();
|
|
@@ -728,6 +750,11 @@ class SelectComponent {
|
|
|
728
750
|
}
|
|
729
751
|
if (this.isOpen()) {
|
|
730
752
|
this.computeDropdownPosition();
|
|
753
|
+
// Second pass with the rendered panel height (the first one is an estimate).
|
|
754
|
+
requestAnimationFrame(() => {
|
|
755
|
+
if (this.isOpen())
|
|
756
|
+
this.computeDropdownPosition();
|
|
757
|
+
});
|
|
731
758
|
}
|
|
732
759
|
this.onTouched();
|
|
733
760
|
}
|
|
@@ -755,32 +782,32 @@ class SelectComponent {
|
|
|
755
782
|
registerOnTouched(fn) {
|
|
756
783
|
this.onTouched = fn;
|
|
757
784
|
}
|
|
758
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
759
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
785
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: SelectComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
786
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.27", type: SelectComponent, isStandalone: true, selector: "shk-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, validCombinations: { classPropertyName: "validCombinations", publicName: "validCombinations", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isAllDataLoaded: { classPropertyName: "isAllDataLoaded", publicName: "isAllDataLoaded", isSignal: true, isRequired: false, transformFunction: null }, allowCustomEntries: { classPropertyName: "allowCustomEntries", publicName: "allowCustomEntries", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: false, transformFunction: null }, isSearchable: { classPropertyName: "isSearchable", publicName: "isSearchable", isSignal: true, isRequired: false, transformFunction: null }, itemsPerPage: { classPropertyName: "itemsPerPage", publicName: "itemsPerPage", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, usePagination: { classPropertyName: "usePagination", publicName: "usePagination", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: true, isRequired: false, transformFunction: null }, preserveSearchOnLoad: { classPropertyName: "preserveSearchOnLoad", publicName: "preserveSearchOnLoad", isSignal: true, isRequired: false, transformFunction: null }, emptyMessageKey: { classPropertyName: "emptyMessageKey", publicName: "emptyMessageKey", isSignal: true, isRequired: false, transformFunction: null }, dropdownUpward: { classPropertyName: "dropdownUpward", publicName: "dropdownUpward", isSignal: true, isRequired: false, transformFunction: null }, showEmptyOption: { classPropertyName: "showEmptyOption", publicName: "showEmptyOption", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange", touch: "touch", search: "search", value: "valueChange" }, host: { listeners: { "document:mousedown": "onClickOutside($event)" } }, providers: [
|
|
760
787
|
{
|
|
761
788
|
provide: NG_VALUE_ACCESSOR,
|
|
762
789
|
useExisting: forwardRef(() => SelectComponent),
|
|
763
790
|
multi: true,
|
|
764
791
|
},
|
|
765
|
-
], viewQueries: [{ propertyName: "filterInput", first: true, predicate: ["filterInput"], descendants: true, isSignal: true }, { propertyName: "selectContainer", first: true, predicate: ["selectContainer"], descendants: true, isSignal: true }, { propertyName: "selectTrigger", first: true, predicate: ["selectTrigger"], descendants: true, isSignal: true }, { propertyName: "dropdownContainer", first: true, predicate: ["dropdownContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n #selectContainer\n class=\"relative w-full font-sans outline-none\"\n>\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-600)] mb-1\">\n {{ label() }}\n </div>\n }\n\n <div\n #selectTrigger\n class=\"shk-control flex justify-between items-center w-full px-3 py-2 border _shk-border rounded-lg _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] transition-colors duration-150 cursor-pointer min-h-[2.5rem] _shk-text-surface-700 dark:[color:var(--shk-surface-700)] focus-within:outline-none focus-within:[background-color:var(--shk-surface-50)] dark:focus-within:[background-color:var(--shk-surface-100)] focus-within:ring-1 focus-within:[--tw-ring-color:var(--shk-primary-500)] focus-within:[border-color:var(--shk-primary-500)] focus:outline-none focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)] focus:[border-color:var(--shk-primary-500)] sm:text-sm\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n (keydown)=\"onKeydown($event)\"\n (click)=\"toggleDropdown()\"\n [class.open]=\"isOpen()\"\n [class.disabled-select]=\"isDisabled()\"\n [class.shk-control-disabled]=\"isDisabled()\"\n [attr.aria-invalid]=\"shouldShowError() || null\"\n [class._shk-border-red]=\"shouldShowError()\"\n >\n <div class=\"selected-value truncate\">\n @if (isSearchable() && isOpen()) {\n <input\n #filterInput\n type=\"text\"\n class=\"w-full bg-transparent border-0 outline-none p-0 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n placeholder=\"Buscar...\"\n [value]=\"searchTerm()\"\n (input)=\"onInputChange($event)\"\n (keydown)=\"handleKeyDown($event)\"\n (click)=\"$event.stopPropagation()\"\n />\n } @else {\n <span\n [class._shk-text-surface-400]=\"!hasSelectedValues()\"\n [class._shk-text-surface-800]=\"hasSelectedValues()\"\n >\n {{ displayValue() }}\n </span>\n }\n </div>\n <div\n class=\"text-xs transition-transform duration-200 shrink-0 ml-2\"\n [class.rotate-180]=\"isOpen()\"\n >\n <svg\n [lucideIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 _shk-text-surface-400 dark:[color:var(--shk-surface-400)]\"\n ></svg>\n </div>\n </div>\n\n @if (isOpen()) {\n <div\n #dropdownContainer\n shkPortal\n (keydown)=\"onKeydown($event)\"\n class=\"shk-select-panel fixed _shk-bg-surface-50 dark:[background-color:var(--shk-surface-100)] border _shk-border rounded-lg max-h-[240px] overflow-y-auto z-[9999] shadow-lg _shk-scrollbar\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n [style.width]=\"dropdownPosition().width + 'px'\"\n >\n @if (showCustomOption()) {\n <div\n class=\"shk-select-option flex items-center gap-2 px-3 py-2 cursor-pointer hover:[background-color:var(--shk-surface-50)] dark:hover:[background-color:var(--shk-surface-200)] text-sm\"\n (click)=\"onCustomOptionClick()\"\n >\n <span class=\"font-semibold _shk-text-primary\">Crear nuevo:</span>\n <span class=\"_shk-text-surface-700 dark:[color:var(--shk-surface-700)] ml-1\">{{ searchTerm() }}</span>\n </div>\n }\n\n @for (option of regularOptions(); track trackByFn($index, option); let i = $index) {\n <div\n class=\"shk-select-option flex items-center gap-2 px-3 py-2 cursor-pointer hover:[background-color:var(--shk-surface-50)] dark:hover:[background-color:var(--shk-surface-200)] text-sm _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n [class.shk-select-option-disabled]=\"isOptionDisabled(option)\"\n [class.shk-select-option-selected]=\"!multiple() && option.value !== null && isSelected(option)\"\n [class.opacity-50]=\"isOptionDisabled(option)\"\n [class.select-option-active]=\"focusedIndex() === i\"\n [class._shk-text-surface-400]=\"option.value === null\"\n (click)=\"!isOptionDisabled(option) && onOptionClick(option)\"\n >\n @if (multiple()) {\n <input\n type=\"checkbox\"\n [checked]=\"isSelected(option)\"\n [disabled]=\"isOptionDisabled(option)\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"!isOptionDisabled(option) && toggleOption(option)\"\n class=\"flex-shrink-0 [accent-color:var(--shk-primary-600)]\"\n />\n {{ option.label }}\n } @else {\n <span class=\"shk-select-option-label flex-1 min-w-0\">{{ option.label }}</span>\n @if (option.value !== null && isSelected(option)) {\n <svg [lucideIcon]=\"getIcon('check')\" class=\"shk-select-check w-4 h-4 shrink-0\"></svg>\n }\n }\n </div>\n }\n\n <div class=\"px-3 py-2 text-center\">\n @if (isLoading() && regularOptions().length === 0) {\n <div class=\"flex items-center justify-center gap-2 text-sm _shk-text-surface-500\">\n <svg class=\"spinner\" viewBox=\"0 0 50 50\">\n <circle\n class=\"path\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n ></circle>\n </svg>\n Cargando m\u00E1s resultados...\n </div>\n }\n\n @if (!isLoading() && isAllDataLoaded() && regularOptions().length === 0) {\n <div class=\"text-sm _shk-text-surface-400 italic\">\n No se encontraron coincidencias\n </div>\n }\n\n @if (options().length === 0) {\n <div class=\"text-sm _shk-text-surface-400 italic\">\n {{ emptyMessageKey() | transloco }}\n </div>\n }\n </div>\n\n @if (usePagination() && totalPages() > 1) {\n <div class=\"flex justify-between items-center px-3 py-2 border-t _shk-border\">\n <button\n class=\"bg-transparent border-0 cursor-pointer px-2 py-1 rounded hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-50 disabled:cursor-not-allowed _shk-text-surface-600 dark:[color:var(--shk-surface-600)]\"\n [disabled]=\"currentPage() === 1\"\n (click)=\"$event.stopPropagation(); previousPage()\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span class=\"text-sm _shk-text-surface-600 dark:[color:var(--shk-surface-600)]\">\n {{ currentPage() }} de {{ totalPages() }}\n </span>\n <button\n class=\"bg-transparent border-0 cursor-pointer px-2 py-1 rounded hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-50 disabled:cursor-not-allowed _shk-text-surface-600 dark:[color:var(--shk-surface-600)]\"\n [disabled]=\"currentPage() === totalPages()\"\n (click)=\"$event.stopPropagation(); nextPage()\"\n >\n <svg [lucideIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n }\n </div>\n }\n\n @if (shouldShowError()) {\n <div class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\" tabindex=\"-1\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>", styles: [".shk-select-panel{padding:.25rem;border-radius:.625rem;box-shadow:0 10px 24px -6px #0000001f,0 4px 8px -4px #0000000f;animation:shk-select-in .12s ease-out}@keyframes shk-select-in{0%{opacity:0;transform:translateY(-4px) scale(.98)}}.shk-select-option{border-radius:.375rem;transition:background-color .1s ease}.shk-select-option:hover:not(.shk-select-option-disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-select-option:hover:not(.shk-select-option-disabled),.dark .shk-select-option:hover:not(.shk-select-option-disabled){background-color:var(--shk-surface-200)}.shk-select-option-label{overflow-wrap:anywhere}.shk-select-option-disabled{cursor:not-allowed}.shk-select-option-selected{color:var(--shk-primary-700);font-weight:500}:host-context(.dark) .shk-select-option-selected,.dark .shk-select-option-selected{color:var(--shk-primary-400)}.shk-select-check{color:var(--shk-primary-600)}:host-context(.dark) .shk-select-check,.dark .shk-select-check{color:var(--shk-primary-400)}.select-option-active{background-color:var(--shk-primary-50);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--shk-primary-500) 35%,transparent);color:var(--shk-primary-700)}:host-context(.dark) .select-option-active,.dark .select-option-active{background-color:color-mix(in srgb,var(--shk-primary-900) 40%,transparent);color:var(--shk-primary-300)}\n"], dependencies: [{ kind: "directive", type: PortalDirective, selector: "[shkPortal]" }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TranslocoModule }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "pipe", type: i1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
792
|
+
], viewQueries: [{ propertyName: "filterInput", first: true, predicate: ["filterInput"], descendants: true, isSignal: true }, { propertyName: "selectContainer", first: true, predicate: ["selectContainer"], descendants: true, isSignal: true }, { propertyName: "selectTrigger", first: true, predicate: ["selectTrigger"], descendants: true, isSignal: true }, { propertyName: "dropdownContainer", first: true, predicate: ["dropdownContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n #selectContainer\n class=\"relative w-full font-sans outline-none\"\n>\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 mb-1\">\n {{ label() }}\n </div>\n }\n\n <div\n #selectTrigger\n class=\"shk-control flex justify-between items-center w-full px-3 py-2 border _shk-border rounded-lg _shk-bg-surface-50 transition-colors duration-150 cursor-pointer min-h-[2.5rem] _shk-text-surface-700 focus-within:outline-none focus-within:[background-color:var(--shk-surface-50)] dark:focus-within:[background-color:var(--shk-surface-100)] focus-within:ring-1 focus-within:[--tw-ring-color:var(--shk-primary-500)] focus-within:[border-color:var(--shk-primary-500)] focus:outline-none focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)] focus:[border-color:var(--shk-primary-500)] sm:text-sm\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n (keydown)=\"onKeydown($event)\"\n (click)=\"toggleDropdown()\"\n [class.open]=\"isOpen()\"\n [class.disabled-select]=\"isDisabled()\"\n [class.shk-control-disabled]=\"isDisabled()\"\n [attr.aria-invalid]=\"shouldShowError() || null\"\n [class._shk-border-red]=\"shouldShowError()\"\n >\n <div class=\"selected-value truncate\">\n @if (isSearchable() && isOpen()) {\n <input\n #filterInput\n type=\"text\"\n class=\"w-full bg-transparent border-0 outline-none p-0 _shk-text-surface-700\"\n placeholder=\"Buscar...\"\n [value]=\"searchTerm()\"\n (input)=\"onInputChange($event)\"\n (keydown)=\"handleKeyDown($event)\"\n (click)=\"$event.stopPropagation()\"\n />\n } @else {\n <span\n [class._shk-text-surface-400]=\"!hasSelectedValues()\"\n [class._shk-text-surface-800]=\"hasSelectedValues()\"\n >\n {{ displayValue() }}\n </span>\n }\n </div>\n <div\n class=\"text-xs transition-transform duration-200 shrink-0 ml-2\"\n [class.rotate-180]=\"isOpen()\"\n >\n <svg\n [shkIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 _shk-text-surface-400\"\n ></svg>\n </div>\n </div>\n\n @if (isOpen()) {\n <div\n #dropdownContainer\n shkPortal\n (keydown)=\"onKeydown($event)\"\n class=\"shk-select-panel fixed _shk-bg-surface-50 border _shk-border rounded-lg max-h-[240px] overflow-y-auto z-[9999] shadow-lg _shk-scrollbar\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n [style.width]=\"dropdownPosition().width + 'px'\"\n >\n @if (showCustomOption()) {\n <div\n class=\"shk-select-option flex items-center gap-2 px-3 py-2 cursor-pointer hover:[background-color:var(--shk-surface-50)] dark:hover:[background-color:var(--shk-surface-200)] text-sm\"\n (click)=\"onCustomOptionClick()\"\n >\n <span class=\"font-semibold _shk-text-primary\">Crear nuevo:</span>\n <span class=\"_shk-text-surface-700 ml-1\">{{ searchTerm() }}</span>\n </div>\n }\n\n @for (option of regularOptions(); track trackByFn($index, option); let i = $index) {\n <div\n class=\"shk-select-option flex items-center gap-2 px-3 py-2 cursor-pointer hover:[background-color:var(--shk-surface-50)] dark:hover:[background-color:var(--shk-surface-200)] text-sm _shk-text-surface-700\"\n [class.shk-select-option-disabled]=\"isOptionDisabled(option)\"\n [class.shk-select-option-selected]=\"!multiple() && option.value !== null && isSelected(option)\"\n [class.opacity-50]=\"isOptionDisabled(option)\"\n [class.select-option-active]=\"focusedIndex() === i\"\n [class._shk-text-surface-400]=\"option.value === null\"\n (click)=\"!isOptionDisabled(option) && onOptionClick(option)\"\n >\n @if (multiple()) {\n <input\n type=\"checkbox\"\n [checked]=\"isSelected(option)\"\n [disabled]=\"isOptionDisabled(option)\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"!isOptionDisabled(option) && toggleOption(option)\"\n class=\"flex-shrink-0 [accent-color:var(--shk-primary-600)]\"\n />\n {{ option.label }}\n } @else {\n <span class=\"shk-select-option-label flex-1 min-w-0\">{{ option.label }}</span>\n @if (option.value !== null && isSelected(option)) {\n <svg [shkIcon]=\"getIcon('check')\" class=\"shk-select-check w-4 h-4 shrink-0\"></svg>\n }\n }\n </div>\n }\n\n <div class=\"px-3 py-2 text-center\">\n @if (isLoading() && regularOptions().length === 0) {\n <div class=\"flex items-center justify-center gap-2 text-sm _shk-text-surface-500\">\n <svg class=\"spinner\" viewBox=\"0 0 50 50\">\n <circle\n class=\"path\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n ></circle>\n </svg>\n Cargando m\u00E1s resultados...\n </div>\n }\n\n @if (!isLoading() && isAllDataLoaded() && regularOptions().length === 0) {\n <div class=\"text-sm _shk-text-surface-400 italic\">\n No se encontraron coincidencias\n </div>\n }\n\n @if (options().length === 0) {\n <div class=\"text-sm _shk-text-surface-400 italic\">\n {{ emptyMessageKey() | transloco }}\n </div>\n }\n </div>\n\n @if (usePagination() && totalPages() > 1) {\n <div class=\"flex justify-between items-center px-3 py-2 border-t _shk-border\">\n <button\n class=\"bg-transparent border-0 cursor-pointer px-2 py-1 rounded hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-50 disabled:cursor-not-allowed _shk-text-surface-600\"\n [disabled]=\"currentPage() === 1\"\n (click)=\"$event.stopPropagation(); previousPage()\"\n >\n <svg [shkIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span class=\"text-sm _shk-text-surface-600\">\n {{ currentPage() }} de {{ totalPages() }}\n </span>\n <button\n class=\"bg-transparent border-0 cursor-pointer px-2 py-1 rounded hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-50 disabled:cursor-not-allowed _shk-text-surface-600\"\n [disabled]=\"currentPage() === totalPages()\"\n (click)=\"$event.stopPropagation(); nextPage()\"\n >\n <svg [shkIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n }\n </div>\n }\n\n @if (shouldShowError()) {\n <div class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\" tabindex=\"-1\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>", styles: [".shk-select-panel{padding:.25rem;border-radius:.625rem;box-shadow:0 10px 24px -6px #0000001f,0 4px 8px -4px #0000000f;animation:shk-select-in .12s ease-out}@keyframes shk-select-in{0%{opacity:0;transform:translateY(-4px) scale(.98)}}@keyframes shk-spin{to{transform:rotate(360deg)}}.shk-select-option{border-radius:.375rem;transition:background-color .1s ease}.shk-select-option:hover:not(.shk-select-option-disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-select-option:hover:not(.shk-select-option-disabled),.dark .shk-select-option:hover:not(.shk-select-option-disabled){background-color:var(--shk-surface-200)}.shk-select-option-label{overflow-wrap:anywhere}.spinner{width:1rem;height:1rem;animation:shk-spin .9s linear infinite;transform-origin:center}.spinner .path{stroke:var(--shk-surface-400);stroke-linecap:round;stroke-dasharray:90,150;stroke-dashoffset:0}.shk-select-option-disabled{cursor:not-allowed}.shk-select-option-selected{color:var(--shk-primary-700);font-weight:500}:host-context(.dark) .shk-select-option-selected,.dark .shk-select-option-selected{color:var(--shk-primary-400)}.shk-select-check{color:var(--shk-primary-600)}:host-context(.dark) .shk-select-check,.dark .shk-select-check{color:var(--shk-primary-400)}.select-option-active{background-color:var(--shk-primary-50);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--shk-primary-500) 35%,transparent);color:var(--shk-primary-700)}:host-context(.dark) .select-option-active,.dark .select-option-active{background-color:color-mix(in srgb,var(--shk-primary-900) 40%,transparent);color:var(--shk-primary-300)}\n"], dependencies: [{ kind: "directive", type: PortalDirective, selector: "[shkPortal]" }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: ShkIconDirective, selector: "svg[shkIcon]", inputs: ["shkIcon", "size", "strokeWidth", "color"] }, { kind: "pipe", type: i1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
766
793
|
}
|
|
767
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
794
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: SelectComponent, decorators: [{
|
|
768
795
|
type: Component,
|
|
769
|
-
args: [{ selector: 'shk-select',
|
|
796
|
+
args: [{ selector: 'shk-select', imports: [
|
|
770
797
|
PortalDirective,
|
|
771
798
|
CommonModule,
|
|
772
799
|
ReactiveFormsModule,
|
|
773
800
|
FormsModule,
|
|
774
801
|
TranslocoModule,
|
|
775
|
-
|
|
802
|
+
ShkIconDirective,
|
|
776
803
|
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
777
804
|
{
|
|
778
805
|
provide: NG_VALUE_ACCESSOR,
|
|
779
806
|
useExisting: forwardRef(() => SelectComponent),
|
|
780
807
|
multi: true,
|
|
781
808
|
},
|
|
782
|
-
], template: "<div\n #selectContainer\n class=\"relative w-full font-sans outline-none\"\n>\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700
|
|
783
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], validCombinations: [{ type: i0.Input, args: [{ isSignal: true, alias: "validCombinations", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], isAllDataLoaded: [{ type: i0.Input, args: [{ isSignal: true, alias: "isAllDataLoaded", required: false }] }], allowCustomEntries: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCustomEntries", required: false }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: false }] }], isSearchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "isSearchable", required: false }] }], itemsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemsPerPage", required: false }] }], control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], usePagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "usePagination", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], errorMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessages", required: false }] }], preserveSearchOnLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "preserveSearchOnLoad", required: false }] }], emptyMessageKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessageKey", required: false }] }], dropdownUpward: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownUpward", required: false }] }], showEmptyOption: [{ type: i0.Input, args: [{ isSignal: true, alias: "showEmptyOption", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], search: [{ type: i0.Output, args: ["search"] }], filterInput: [{ type: i0.ViewChild, args: ['filterInput', { isSignal: true }] }], selectContainer: [{ type: i0.ViewChild, args: ['selectContainer', { isSignal: true }] }], selectTrigger: [{ type: i0.ViewChild, args: ['selectTrigger', { isSignal: true }] }], dropdownContainer: [{ type: i0.ViewChild, args: ['dropdownContainer', { isSignal: true }] }], onClickOutside: [{
|
|
809
|
+
], template: "<div\n #selectContainer\n class=\"relative w-full font-sans outline-none\"\n>\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 mb-1\">\n {{ label() }}\n </div>\n }\n\n <div\n #selectTrigger\n class=\"shk-control flex justify-between items-center w-full px-3 py-2 border _shk-border rounded-lg _shk-bg-surface-50 transition-colors duration-150 cursor-pointer min-h-[2.5rem] _shk-text-surface-700 focus-within:outline-none focus-within:[background-color:var(--shk-surface-50)] dark:focus-within:[background-color:var(--shk-surface-100)] focus-within:ring-1 focus-within:[--tw-ring-color:var(--shk-primary-500)] focus-within:[border-color:var(--shk-primary-500)] focus:outline-none focus:ring-1 focus:[--tw-ring-color:var(--shk-primary-500)] focus:[border-color:var(--shk-primary-500)] sm:text-sm\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n (keydown)=\"onKeydown($event)\"\n (click)=\"toggleDropdown()\"\n [class.open]=\"isOpen()\"\n [class.disabled-select]=\"isDisabled()\"\n [class.shk-control-disabled]=\"isDisabled()\"\n [attr.aria-invalid]=\"shouldShowError() || null\"\n [class._shk-border-red]=\"shouldShowError()\"\n >\n <div class=\"selected-value truncate\">\n @if (isSearchable() && isOpen()) {\n <input\n #filterInput\n type=\"text\"\n class=\"w-full bg-transparent border-0 outline-none p-0 _shk-text-surface-700\"\n placeholder=\"Buscar...\"\n [value]=\"searchTerm()\"\n (input)=\"onInputChange($event)\"\n (keydown)=\"handleKeyDown($event)\"\n (click)=\"$event.stopPropagation()\"\n />\n } @else {\n <span\n [class._shk-text-surface-400]=\"!hasSelectedValues()\"\n [class._shk-text-surface-800]=\"hasSelectedValues()\"\n >\n {{ displayValue() }}\n </span>\n }\n </div>\n <div\n class=\"text-xs transition-transform duration-200 shrink-0 ml-2\"\n [class.rotate-180]=\"isOpen()\"\n >\n <svg\n [shkIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 _shk-text-surface-400\"\n ></svg>\n </div>\n </div>\n\n @if (isOpen()) {\n <div\n #dropdownContainer\n shkPortal\n (keydown)=\"onKeydown($event)\"\n class=\"shk-select-panel fixed _shk-bg-surface-50 border _shk-border rounded-lg max-h-[240px] overflow-y-auto z-[9999] shadow-lg _shk-scrollbar\"\n [style.top]=\"dropdownPosition().top + 'px'\"\n [style.left]=\"dropdownPosition().left + 'px'\"\n [style.width]=\"dropdownPosition().width + 'px'\"\n >\n @if (showCustomOption()) {\n <div\n class=\"shk-select-option flex items-center gap-2 px-3 py-2 cursor-pointer hover:[background-color:var(--shk-surface-50)] dark:hover:[background-color:var(--shk-surface-200)] text-sm\"\n (click)=\"onCustomOptionClick()\"\n >\n <span class=\"font-semibold _shk-text-primary\">Crear nuevo:</span>\n <span class=\"_shk-text-surface-700 ml-1\">{{ searchTerm() }}</span>\n </div>\n }\n\n @for (option of regularOptions(); track trackByFn($index, option); let i = $index) {\n <div\n class=\"shk-select-option flex items-center gap-2 px-3 py-2 cursor-pointer hover:[background-color:var(--shk-surface-50)] dark:hover:[background-color:var(--shk-surface-200)] text-sm _shk-text-surface-700\"\n [class.shk-select-option-disabled]=\"isOptionDisabled(option)\"\n [class.shk-select-option-selected]=\"!multiple() && option.value !== null && isSelected(option)\"\n [class.opacity-50]=\"isOptionDisabled(option)\"\n [class.select-option-active]=\"focusedIndex() === i\"\n [class._shk-text-surface-400]=\"option.value === null\"\n (click)=\"!isOptionDisabled(option) && onOptionClick(option)\"\n >\n @if (multiple()) {\n <input\n type=\"checkbox\"\n [checked]=\"isSelected(option)\"\n [disabled]=\"isOptionDisabled(option)\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"!isOptionDisabled(option) && toggleOption(option)\"\n class=\"flex-shrink-0 [accent-color:var(--shk-primary-600)]\"\n />\n {{ option.label }}\n } @else {\n <span class=\"shk-select-option-label flex-1 min-w-0\">{{ option.label }}</span>\n @if (option.value !== null && isSelected(option)) {\n <svg [shkIcon]=\"getIcon('check')\" class=\"shk-select-check w-4 h-4 shrink-0\"></svg>\n }\n }\n </div>\n }\n\n <div class=\"px-3 py-2 text-center\">\n @if (isLoading() && regularOptions().length === 0) {\n <div class=\"flex items-center justify-center gap-2 text-sm _shk-text-surface-500\">\n <svg class=\"spinner\" viewBox=\"0 0 50 50\">\n <circle\n class=\"path\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n ></circle>\n </svg>\n Cargando m\u00E1s resultados...\n </div>\n }\n\n @if (!isLoading() && isAllDataLoaded() && regularOptions().length === 0) {\n <div class=\"text-sm _shk-text-surface-400 italic\">\n No se encontraron coincidencias\n </div>\n }\n\n @if (options().length === 0) {\n <div class=\"text-sm _shk-text-surface-400 italic\">\n {{ emptyMessageKey() | transloco }}\n </div>\n }\n </div>\n\n @if (usePagination() && totalPages() > 1) {\n <div class=\"flex justify-between items-center px-3 py-2 border-t _shk-border\">\n <button\n class=\"bg-transparent border-0 cursor-pointer px-2 py-1 rounded hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-50 disabled:cursor-not-allowed _shk-text-surface-600\"\n [disabled]=\"currentPage() === 1\"\n (click)=\"$event.stopPropagation(); previousPage()\"\n >\n <svg [shkIcon]=\"getIcon('chevron-left')\" class=\"w-4 h-4\"></svg>\n </button>\n <span class=\"text-sm _shk-text-surface-600\">\n {{ currentPage() }} de {{ totalPages() }}\n </span>\n <button\n class=\"bg-transparent border-0 cursor-pointer px-2 py-1 rounded hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] disabled:opacity-50 disabled:cursor-not-allowed _shk-text-surface-600\"\n [disabled]=\"currentPage() === totalPages()\"\n (click)=\"$event.stopPropagation(); nextPage()\"\n >\n <svg [shkIcon]=\"getIcon('chevron-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n }\n </div>\n }\n\n @if (shouldShowError()) {\n <div class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\" tabindex=\"-1\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>", styles: [".shk-select-panel{padding:.25rem;border-radius:.625rem;box-shadow:0 10px 24px -6px #0000001f,0 4px 8px -4px #0000000f;animation:shk-select-in .12s ease-out}@keyframes shk-select-in{0%{opacity:0;transform:translateY(-4px) scale(.98)}}@keyframes shk-spin{to{transform:rotate(360deg)}}.shk-select-option{border-radius:.375rem;transition:background-color .1s ease}.shk-select-option:hover:not(.shk-select-option-disabled){background-color:var(--shk-surface-100)}:host-context(.dark) .shk-select-option:hover:not(.shk-select-option-disabled),.dark .shk-select-option:hover:not(.shk-select-option-disabled){background-color:var(--shk-surface-200)}.shk-select-option-label{overflow-wrap:anywhere}.spinner{width:1rem;height:1rem;animation:shk-spin .9s linear infinite;transform-origin:center}.spinner .path{stroke:var(--shk-surface-400);stroke-linecap:round;stroke-dasharray:90,150;stroke-dashoffset:0}.shk-select-option-disabled{cursor:not-allowed}.shk-select-option-selected{color:var(--shk-primary-700);font-weight:500}:host-context(.dark) .shk-select-option-selected,.dark .shk-select-option-selected{color:var(--shk-primary-400)}.shk-select-check{color:var(--shk-primary-600)}:host-context(.dark) .shk-select-check,.dark .shk-select-check{color:var(--shk-primary-400)}.select-option-active{background-color:var(--shk-primary-50);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--shk-primary-500) 35%,transparent);color:var(--shk-primary-700)}:host-context(.dark) .select-option-active,.dark .select-option-active{background-color:color-mix(in srgb,var(--shk-primary-900) 40%,transparent);color:var(--shk-primary-300)}\n"] }]
|
|
810
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], validCombinations: [{ type: i0.Input, args: [{ isSignal: true, alias: "validCombinations", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], isAllDataLoaded: [{ type: i0.Input, args: [{ isSignal: true, alias: "isAllDataLoaded", required: false }] }], allowCustomEntries: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCustomEntries", required: false }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: false }] }], isSearchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "isSearchable", required: false }] }], itemsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemsPerPage", required: false }] }], control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], usePagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "usePagination", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], errorMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessages", required: false }] }], preserveSearchOnLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "preserveSearchOnLoad", required: false }] }], emptyMessageKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessageKey", required: false }] }], dropdownUpward: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownUpward", required: false }] }], showEmptyOption: [{ type: i0.Input, args: [{ isSignal: true, alias: "showEmptyOption", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], touch: [{ type: i0.Output, args: ["touch"] }], search: [{ type: i0.Output, args: ["search"] }], filterInput: [{ type: i0.ViewChild, args: ['filterInput', { isSignal: true }] }], selectContainer: [{ type: i0.ViewChild, args: ['selectContainer', { isSignal: true }] }], selectTrigger: [{ type: i0.ViewChild, args: ['selectTrigger', { isSignal: true }] }], dropdownContainer: [{ type: i0.ViewChild, args: ['dropdownContainer', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], onClickOutside: [{
|
|
784
811
|
type: HostListener,
|
|
785
812
|
args: ['document:mousedown', ['$event']]
|
|
786
813
|
}] } });
|