@ng-cn/core 1.0.10 → 1.0.12
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/package.json +3 -2
- package/src/app/lib/components/ui/accordion/accordion-content.component.ts +53 -0
- package/src/app/lib/components/ui/accordion/accordion-context.ts +33 -0
- package/src/app/lib/components/ui/accordion/accordion-item.component.ts +86 -0
- package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +73 -0
- package/src/app/lib/components/ui/accordion/accordion.component.ts +197 -0
- package/src/app/lib/components/ui/accordion/index.ts +15 -0
- package/src/app/lib/components/ui/alert/alert-description.component.ts +33 -0
- package/src/app/lib/components/ui/alert/alert-title.component.ts +30 -0
- package/src/app/lib/components/ui/alert/alert-variants.ts +23 -0
- package/src/app/lib/components/ui/alert/alert.component.ts +50 -0
- package/src/app/lib/components/ui/alert/index.ts +5 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +44 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +45 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +146 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-context.ts +14 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +37 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +35 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +35 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +37 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +44 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +91 -0
- package/src/app/lib/components/ui/alert-dialog/index.ts +11 -0
- package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +63 -0
- package/src/app/lib/components/ui/aspect-ratio/index.ts +1 -0
- package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +34 -0
- package/src/app/lib/components/ui/avatar/avatar-image.component.ts +31 -0
- package/src/app/lib/components/ui/avatar/avatar.component.ts +37 -0
- package/src/app/lib/components/ui/avatar/index.ts +5 -0
- package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +52 -0
- package/src/app/lib/components/ui/badge/badge-variants.ts +28 -0
- package/src/app/lib/components/ui/badge/badge.component.ts +50 -0
- package/src/app/lib/components/ui/badge/index.ts +3 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +48 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +28 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +32 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +31 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +31 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +47 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +43 -0
- package/src/app/lib/components/ui/breadcrumb/index.ts +8 -0
- package/src/app/lib/components/ui/button/button-variants.ts +38 -0
- package/src/app/lib/components/ui/button/button.component.ts +103 -0
- package/src/app/lib/components/ui/button/index.ts +3 -0
- package/src/app/lib/components/ui/button-group/button-group-variants.ts +24 -0
- package/src/app/lib/components/ui/button-group/button-group.component.ts +57 -0
- package/src/app/lib/components/ui/button-group/index.ts +6 -0
- package/src/app/lib/components/ui/calendar/calendar.component.ts +368 -0
- package/src/app/lib/components/ui/calendar/index.ts +1 -0
- package/src/app/lib/components/ui/card/card-action.component.ts +39 -0
- package/src/app/lib/components/ui/card/card-content.component.ts +31 -0
- package/src/app/lib/components/ui/card/card-description.component.ts +31 -0
- package/src/app/lib/components/ui/card/card-footer.component.ts +34 -0
- package/src/app/lib/components/ui/card/card-header.component.ts +37 -0
- package/src/app/lib/components/ui/card/card-title.component.ts +31 -0
- package/src/app/lib/components/ui/card/card.component.ts +41 -0
- package/src/app/lib/components/ui/card/index.ts +8 -0
- package/src/app/lib/components/ui/carousel/carousel-content.component.ts +38 -0
- package/src/app/lib/components/ui/carousel/carousel-context.ts +18 -0
- package/src/app/lib/components/ui/carousel/carousel-item.component.ts +32 -0
- package/src/app/lib/components/ui/carousel/carousel-next.component.ts +54 -0
- package/src/app/lib/components/ui/carousel/carousel-previous.component.ts +54 -0
- package/src/app/lib/components/ui/carousel/carousel.component.ts +125 -0
- package/src/app/lib/components/ui/carousel/index.ts +7 -0
- package/src/app/lib/components/ui/chart/chart-container.component.ts +81 -0
- package/src/app/lib/components/ui/chart/chart-context.ts +38 -0
- package/src/app/lib/components/ui/chart/chart-legend-content.component.ts +51 -0
- package/src/app/lib/components/ui/chart/chart-legend.component.ts +28 -0
- package/src/app/lib/components/ui/chart/chart-tooltip-content.component.ts +37 -0
- package/src/app/lib/components/ui/chart/chart-tooltip.component.ts +28 -0
- package/src/app/lib/components/ui/chart/chart.component.ts +308 -0
- package/src/app/lib/components/ui/chart/index.ts +16 -0
- package/src/app/lib/components/ui/checkbox/checkbox.component.ts +203 -0
- package/src/app/lib/components/ui/checkbox/index.ts +1 -0
- package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +58 -0
- package/src/app/lib/components/ui/collapsible/collapsible-context.ts +17 -0
- package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +56 -0
- package/src/app/lib/components/ui/collapsible/collapsible.component.ts +102 -0
- package/src/app/lib/components/ui/collapsible/index.ts +5 -0
- package/src/app/lib/components/ui/combobox/combobox-content.component.ts +59 -0
- package/src/app/lib/components/ui/combobox/combobox-context.ts +49 -0
- package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +35 -0
- package/src/app/lib/components/ui/combobox/combobox-group.component.ts +32 -0
- package/src/app/lib/components/ui/combobox/combobox-input.component.ts +89 -0
- package/src/app/lib/components/ui/combobox/combobox-item.component.ts +129 -0
- package/src/app/lib/components/ui/combobox/combobox-list.component.ts +40 -0
- package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +53 -0
- package/src/app/lib/components/ui/combobox/combobox-value.component.ts +47 -0
- package/src/app/lib/components/ui/combobox/combobox.component.ts +290 -0
- package/src/app/lib/components/ui/combobox/index.ts +15 -0
- package/src/app/lib/components/ui/command/command-context.ts +24 -0
- package/src/app/lib/components/ui/command/command-dialog.component.ts +69 -0
- package/src/app/lib/components/ui/command/command-empty.component.ts +23 -0
- package/src/app/lib/components/ui/command/command-group.component.ts +66 -0
- package/src/app/lib/components/ui/command/command-input.component.ts +137 -0
- package/src/app/lib/components/ui/command/command-item.component.ts +148 -0
- package/src/app/lib/components/ui/command/command-list.component.ts +30 -0
- package/src/app/lib/components/ui/command/command-separator.component.ts +23 -0
- package/src/app/lib/components/ui/command/command-shortcut.component.ts +23 -0
- package/src/app/lib/components/ui/command/command.component.ts +105 -0
- package/src/app/lib/components/ui/command/index.ts +11 -0
- package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +68 -0
- package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +213 -0
- package/src/app/lib/components/ui/context-menu/context-menu-context.ts +17 -0
- package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +63 -0
- package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +30 -0
- package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +36 -0
- package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +71 -0
- package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +24 -0
- package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +23 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +51 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +50 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +31 -0
- package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +51 -0
- package/src/app/lib/components/ui/context-menu/context-menu.component.ts +27 -0
- package/src/app/lib/components/ui/context-menu/index.ts +15 -0
- package/src/app/lib/components/ui/data-table/data-table-content.component.ts +226 -0
- package/src/app/lib/components/ui/data-table/data-table-context.ts +49 -0
- package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +138 -0
- package/src/app/lib/components/ui/data-table/data-table-search.component.ts +52 -0
- package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +27 -0
- package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +92 -0
- package/src/app/lib/components/ui/data-table/data-table.component.ts +131 -0
- package/src/app/lib/components/ui/data-table/index.ts +16 -0
- package/src/app/lib/components/ui/date-picker/date-picker.component.ts +94 -0
- package/src/app/lib/components/ui/date-picker/index.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-close.component.ts +31 -0
- package/src/app/lib/components/ui/dialog/dialog-content.component.ts +177 -0
- package/src/app/lib/components/ui/dialog/dialog-context.ts +15 -0
- package/src/app/lib/components/ui/dialog/dialog-description.component.ts +34 -0
- package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +28 -0
- package/src/app/lib/components/ui/dialog/dialog-header.component.ts +28 -0
- package/src/app/lib/components/ui/dialog/dialog-title.component.ts +34 -0
- package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +38 -0
- package/src/app/lib/components/ui/dialog/dialog.component.ts +87 -0
- package/src/app/lib/components/ui/dialog/index.ts +10 -0
- package/src/app/lib/components/ui/drawer/drawer-close.component.ts +31 -0
- package/src/app/lib/components/ui/drawer/drawer-content.component.ts +143 -0
- package/src/app/lib/components/ui/drawer/drawer-context.ts +17 -0
- package/src/app/lib/components/ui/drawer/drawer-description.component.ts +33 -0
- package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +28 -0
- package/src/app/lib/components/ui/drawer/drawer-header.component.ts +28 -0
- package/src/app/lib/components/ui/drawer/drawer-title.component.ts +33 -0
- package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +38 -0
- package/src/app/lib/components/ui/drawer/drawer.component.ts +93 -0
- package/src/app/lib/components/ui/drawer/index.ts +10 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +68 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +234 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-context.ts +15 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-group.component.ts +15 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-item.component.ts +56 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +30 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +42 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +71 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +24 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +23 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +51 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +53 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +31 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +45 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +32 -0
- package/src/app/lib/components/ui/dropdown-menu/index.ts +16 -0
- package/src/app/lib/components/ui/empty/empty-action.component.ts +28 -0
- package/src/app/lib/components/ui/empty/empty-description.component.ts +31 -0
- package/src/app/lib/components/ui/empty/empty-icon.component.ts +31 -0
- package/src/app/lib/components/ui/empty/empty-title.component.ts +28 -0
- package/src/app/lib/components/ui/empty/empty.component.ts +53 -0
- package/src/app/lib/components/ui/empty/index.ts +6 -0
- package/src/app/lib/components/ui/form/form-context.ts +34 -0
- package/src/app/lib/components/ui/form/form-control.component.ts +137 -0
- package/src/app/lib/components/ui/form/form-description.component.ts +37 -0
- package/src/app/lib/components/ui/form/form-field.component.ts +84 -0
- package/src/app/lib/components/ui/form/form-item.component.ts +42 -0
- package/src/app/lib/components/ui/form/form-label.component.ts +58 -0
- package/src/app/lib/components/ui/form/form-message.component.ts +107 -0
- package/src/app/lib/components/ui/form/form.component.ts +123 -0
- package/src/app/lib/components/ui/form/index.ts +17 -0
- package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +203 -0
- package/src/app/lib/components/ui/hover-card/hover-card-context.ts +25 -0
- package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +160 -0
- package/src/app/lib/components/ui/hover-card/hover-card.component.ts +147 -0
- package/src/app/lib/components/ui/hover-card/index.ts +13 -0
- package/src/app/lib/components/ui/index.ts +551 -0
- package/src/app/lib/components/ui/input/index.ts +1 -0
- package/src/app/lib/components/ui/input/input.component.ts +165 -0
- package/src/app/lib/components/ui/input-group/index.ts +4 -0
- package/src/app/lib/components/ui/input-group/input-group-addon.component.ts +43 -0
- package/src/app/lib/components/ui/input-group/input-group-input.component.ts +33 -0
- package/src/app/lib/components/ui/input-group/input-group.component.ts +53 -0
- package/src/app/lib/components/ui/input-otp/index.ts +14 -0
- package/src/app/lib/components/ui/input-otp/input-otp-context.ts +31 -0
- package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +23 -0
- package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +31 -0
- package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +67 -0
- package/src/app/lib/components/ui/input-otp/input-otp.component.ts +240 -0
- package/src/app/lib/components/ui/kbd/index.ts +3 -0
- package/src/app/lib/components/ui/kbd/kbd-variants.ts +23 -0
- package/src/app/lib/components/ui/kbd/kbd.component.ts +50 -0
- package/src/app/lib/components/ui/label/index.ts +1 -0
- package/src/app/lib/components/ui/label/label.component.ts +139 -0
- package/src/app/lib/components/ui/menubar/index.ts +26 -0
- package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +66 -0
- package/src/app/lib/components/ui/menubar/menubar-content.component.ts +236 -0
- package/src/app/lib/components/ui/menubar/menubar-context.ts +63 -0
- package/src/app/lib/components/ui/menubar/menubar-item.component.ts +60 -0
- package/src/app/lib/components/ui/menubar/menubar-label.component.ts +30 -0
- package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +40 -0
- package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +36 -0
- package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +66 -0
- package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +24 -0
- package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +23 -0
- package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +51 -0
- package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +50 -0
- package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +29 -0
- package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +132 -0
- package/src/app/lib/components/ui/menubar/menubar.component.ts +158 -0
- package/src/app/lib/components/ui/native-select/index.ts +6 -0
- package/src/app/lib/components/ui/native-select/native-select-variants.ts +23 -0
- package/src/app/lib/components/ui/native-select/native-select.component.ts +74 -0
- package/src/app/lib/components/ui/navigation-menu/index.ts +21 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +66 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-context.ts +55 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +28 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +29 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +43 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +26 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger-style.ts +7 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +58 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +26 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +149 -0
- package/src/app/lib/components/ui/pagination/index.ts +8 -0
- package/src/app/lib/components/ui/pagination/pagination-content.component.ts +28 -0
- package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +47 -0
- package/src/app/lib/components/ui/pagination/pagination-item.component.ts +28 -0
- package/src/app/lib/components/ui/pagination/pagination-link.component.ts +46 -0
- package/src/app/lib/components/ui/pagination/pagination-next.component.ts +54 -0
- package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +54 -0
- package/src/app/lib/components/ui/pagination/pagination.component.ts +48 -0
- package/src/app/lib/components/ui/popover/index.ts +14 -0
- package/src/app/lib/components/ui/popover/popover-anchor.component.ts +64 -0
- package/src/app/lib/components/ui/popover/popover-content.component.ts +231 -0
- package/src/app/lib/components/ui/popover/popover-context.ts +29 -0
- package/src/app/lib/components/ui/popover/popover-trigger.component.ts +100 -0
- package/src/app/lib/components/ui/popover/popover.component.ts +163 -0
- package/src/app/lib/components/ui/progress/index.ts +6 -0
- package/src/app/lib/components/ui/progress/progress.component.ts +212 -0
- package/src/app/lib/components/ui/radio-group/index.ts +10 -0
- package/src/app/lib/components/ui/radio-group/radio-group-context.ts +38 -0
- package/src/app/lib/components/ui/radio-group/radio-group-item.component.ts +298 -0
- package/src/app/lib/components/ui/radio-group/radio-group.component.ts +275 -0
- package/src/app/lib/components/ui/resizable/index.ts +5 -0
- package/src/app/lib/components/ui/resizable/resizable-context.ts +14 -0
- package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +232 -0
- package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +140 -0
- package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +77 -0
- package/src/app/lib/components/ui/scroll-area/index.ts +8 -0
- package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +126 -0
- package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +93 -0
- package/src/app/lib/components/ui/segmented/index.ts +13 -0
- package/src/app/lib/components/ui/segmented/segmented-context.ts +11 -0
- package/src/app/lib/components/ui/segmented/segmented-item.component.ts +72 -0
- package/src/app/lib/components/ui/segmented/segmented-variants.ts +40 -0
- package/src/app/lib/components/ui/segmented/segmented.component.ts +99 -0
- package/src/app/lib/components/ui/select/index.ts +19 -0
- package/src/app/lib/components/ui/select/select-content.component.ts +97 -0
- package/src/app/lib/components/ui/select/select-context.ts +53 -0
- package/src/app/lib/components/ui/select/select-group.component.ts +56 -0
- package/src/app/lib/components/ui/select/select-item.component.ts +163 -0
- package/src/app/lib/components/ui/select/select-label.component.ts +32 -0
- package/src/app/lib/components/ui/select/select-separator.component.ts +34 -0
- package/src/app/lib/components/ui/select/select-trigger.component.ts +164 -0
- package/src/app/lib/components/ui/select/select-value.component.ts +49 -0
- package/src/app/lib/components/ui/select/select.component.ts +263 -0
- package/src/app/lib/components/ui/separator/index.ts +6 -0
- package/src/app/lib/components/ui/separator/separator.component.ts +128 -0
- package/src/app/lib/components/ui/sheet/index.ts +11 -0
- package/src/app/lib/components/ui/sheet/sheet-close.component.ts +32 -0
- package/src/app/lib/components/ui/sheet/sheet-content.component.ts +157 -0
- package/src/app/lib/components/ui/sheet/sheet-context.ts +15 -0
- package/src/app/lib/components/ui/sheet/sheet-description.component.ts +34 -0
- package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +28 -0
- package/src/app/lib/components/ui/sheet/sheet-header.component.ts +28 -0
- package/src/app/lib/components/ui/sheet/sheet-title.component.ts +34 -0
- package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +38 -0
- package/src/app/lib/components/ui/sheet/sheet-variants.ts +22 -0
- package/src/app/lib/components/ui/sheet/sheet.component.ts +97 -0
- package/src/app/lib/components/ui/sidebar/index.ts +41 -0
- package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +31 -0
- package/src/app/lib/components/ui/sidebar/sidebar-context.ts +33 -0
- package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +33 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +32 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +31 -0
- package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +31 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +56 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +42 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +64 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +32 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +39 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +59 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +25 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +32 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +31 -0
- package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +141 -0
- package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +47 -0
- package/src/app/lib/components/ui/sidebar/sidebar-route-active.service.ts +124 -0
- package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +57 -0
- package/src/app/lib/components/ui/sidebar/sidebar.component.ts +130 -0
- package/src/app/lib/components/ui/skeleton/index.ts +1 -0
- package/src/app/lib/components/ui/skeleton/skeleton.component.ts +52 -0
- package/src/app/lib/components/ui/slider/index.ts +6 -0
- package/src/app/lib/components/ui/slider/slider.component.ts +477 -0
- package/src/app/lib/components/ui/spinner/index.ts +3 -0
- package/src/app/lib/components/ui/spinner/spinner-variants.ts +32 -0
- package/src/app/lib/components/ui/spinner/spinner.component.ts +77 -0
- package/src/app/lib/components/ui/switch/index.ts +6 -0
- package/src/app/lib/components/ui/switch/switch.component.ts +282 -0
- package/src/app/lib/components/ui/table/index.ts +9 -0
- package/src/app/lib/components/ui/table/table-body.component.ts +28 -0
- package/src/app/lib/components/ui/table/table-caption.component.ts +28 -0
- package/src/app/lib/components/ui/table/table-cell.component.ts +31 -0
- package/src/app/lib/components/ui/table/table-footer.component.ts +28 -0
- package/src/app/lib/components/ui/table/table-head.component.ts +36 -0
- package/src/app/lib/components/ui/table/table-header.component.ts +28 -0
- package/src/app/lib/components/ui/table/table-row.component.ts +34 -0
- package/src/app/lib/components/ui/table/table.component.ts +52 -0
- package/src/app/lib/components/ui/tabs/index.ts +14 -0
- package/src/app/lib/components/ui/tabs/tabs-content.component.ts +132 -0
- package/src/app/lib/components/ui/tabs/tabs-context.ts +33 -0
- package/src/app/lib/components/ui/tabs/tabs-list.component.ts +228 -0
- package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +167 -0
- package/src/app/lib/components/ui/tabs/tabs.component.ts +203 -0
- package/src/app/lib/components/ui/textarea/index.ts +1 -0
- package/src/app/lib/components/ui/textarea/textarea.component.ts +44 -0
- package/src/app/lib/components/ui/toast/index.ts +16 -0
- package/src/app/lib/components/ui/toast/toast-action.component.ts +77 -0
- package/src/app/lib/components/ui/toast/toast-description.component.ts +52 -0
- package/src/app/lib/components/ui/toast/toast-title.component.ts +52 -0
- package/src/app/lib/components/ui/toast/toast-variants.ts +24 -0
- package/src/app/lib/components/ui/toast/toast.component.ts +177 -0
- package/src/app/lib/components/ui/toast/toast.service.ts +202 -0
- package/src/app/lib/components/ui/toast/toaster.component.ts +128 -0
- package/src/app/lib/components/ui/toggle/index.ts +6 -0
- package/src/app/lib/components/ui/toggle/toggle-variants.ts +30 -0
- package/src/app/lib/components/ui/toggle/toggle.component.ts +199 -0
- package/src/app/lib/components/ui/toggle-group/index.ts +11 -0
- package/src/app/lib/components/ui/toggle-group/toggle-group-context.ts +48 -0
- package/src/app/lib/components/ui/toggle-group/toggle-group-item.component.ts +241 -0
- package/src/app/lib/components/ui/toggle-group/toggle-group.component.ts +288 -0
- package/src/app/lib/components/ui/tooltip/index.ts +14 -0
- package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +154 -0
- package/src/app/lib/components/ui/tooltip/tooltip-context.ts +29 -0
- package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +95 -0
- package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +138 -0
- package/src/app/lib/components/ui/tooltip/tooltip.component.ts +159 -0
- package/src/app/lib/components/ui/typography/index.ts +13 -0
- package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +31 -0
- package/src/app/lib/components/ui/typography/typography-h1.component.ts +32 -0
- package/src/app/lib/components/ui/typography/typography-h2.component.ts +32 -0
- package/src/app/lib/components/ui/typography/typography-h3.component.ts +29 -0
- package/src/app/lib/components/ui/typography/typography-h4.component.ts +29 -0
- package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +31 -0
- package/src/app/lib/components/ui/typography/typography-large.component.ts +28 -0
- package/src/app/lib/components/ui/typography/typography-lead.component.ts +31 -0
- package/src/app/lib/components/ui/typography/typography-list.component.ts +31 -0
- package/src/app/lib/components/ui/typography/typography-muted.component.ts +28 -0
- package/src/app/lib/components/ui/typography/typography-p.component.ts +29 -0
- package/src/app/lib/components/ui/typography/typography-small.component.ts +28 -0
- package/src/app/lib/index.ts +7 -0
- package/src/app/lib/utils/accessibility/aria-id.service.ts +118 -0
- package/src/app/lib/utils/accessibility/click-outside.directive.ts +85 -0
- package/src/app/lib/utils/accessibility/focus-management.service.ts +231 -0
- package/src/app/lib/utils/accessibility/focus-trap.directive.ts +203 -0
- package/src/app/lib/utils/accessibility/index.ts +23 -0
- package/src/app/lib/utils/accessibility/keyboard-navigation.directive.ts +440 -0
- package/src/app/lib/utils/accessibility/live-region.directive.ts +260 -0
- package/src/app/lib/utils/accessibility/touch-target.directive.ts +81 -0
- package/src/app/lib/utils/accessibility/visually-hidden.component.ts +79 -0
- package/src/app/lib/utils/animation/animated.directive.ts +191 -0
- package/src/app/lib/utils/animation/animation-tokens.service.ts +88 -0
- package/src/app/lib/utils/animation/animation.types.ts +55 -0
- package/src/app/lib/utils/animation/animation.utils.ts +158 -0
- package/src/app/lib/utils/animation/index.ts +17 -0
- package/src/app/lib/utils/animation/presence.component.ts +168 -0
- package/src/app/lib/utils/animation/presence.directive.ts +169 -0
- package/src/app/lib/utils/cn.ts +15 -0
- package/src/app/lib/utils/index.ts +11 -0
- package/src/app/lib/utils/positioning/index.ts +218 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { InjectionToken, WritableSignal } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Types
|
|
5
|
+
// ============================================================================
|
|
6
|
+
|
|
7
|
+
export type SelectPosition = 'popper' | 'item-aligned';
|
|
8
|
+
|
|
9
|
+
export interface SelectContext {
|
|
10
|
+
/** Current selected value */
|
|
11
|
+
value: WritableSignal<string>;
|
|
12
|
+
/** Whether the select is open */
|
|
13
|
+
open: WritableSignal<boolean>;
|
|
14
|
+
/** Whether the select is disabled */
|
|
15
|
+
disabled: WritableSignal<boolean>;
|
|
16
|
+
/** Placeholder text when no value is selected */
|
|
17
|
+
placeholder: WritableSignal<string>;
|
|
18
|
+
/** Set the selected value and optionally the label */
|
|
19
|
+
setValue: (value: string, label?: string) => void;
|
|
20
|
+
/** The label of the currently selected item */
|
|
21
|
+
selectedLabel: WritableSignal<string>;
|
|
22
|
+
/** ARIA ID for the listbox */
|
|
23
|
+
contentId: string;
|
|
24
|
+
/** Reference to the trigger element for focus restoration */
|
|
25
|
+
triggerElement: WritableSignal<HTMLElement | null>;
|
|
26
|
+
/** Registry of all item values for keyboard navigation */
|
|
27
|
+
itemValues: WritableSignal<string[]>;
|
|
28
|
+
/** Currently focused item index */
|
|
29
|
+
focusedIndex: WritableSignal<number>;
|
|
30
|
+
/** Focus a specific item by index */
|
|
31
|
+
focusItem: (index: number) => void;
|
|
32
|
+
/** Whether the select is required */
|
|
33
|
+
required?: () => boolean;
|
|
34
|
+
/** Name for form submission */
|
|
35
|
+
name?: () => string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SelectGroupContext {
|
|
39
|
+
/** The label for this group */
|
|
40
|
+
label: WritableSignal<string>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ============================================================================
|
|
44
|
+
// Injection Tokens
|
|
45
|
+
// ============================================================================
|
|
46
|
+
|
|
47
|
+
export const SELECT_CONTEXT = new InjectionToken<SelectContext>(
|
|
48
|
+
'SelectContext'
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const SELECT_GROUP_CONTEXT = new InjectionToken<SelectGroupContext>(
|
|
52
|
+
'SelectGroupContext'
|
|
53
|
+
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
forwardRef,
|
|
7
|
+
input,
|
|
8
|
+
signal,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import { SELECT_GROUP_CONTEXT, type SelectGroupContext } from './select-context';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SelectGroup component - groups related select items.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <SelectGroup>
|
|
17
|
+
* <SelectLabel>Fruits</SelectLabel>
|
|
18
|
+
* <SelectItem value="apple">Apple</SelectItem>
|
|
19
|
+
* <SelectItem value="banana">Banana</SelectItem>
|
|
20
|
+
* </SelectGroup>
|
|
21
|
+
*/
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'SelectGroup',
|
|
24
|
+
template: `<ng-content />`,
|
|
25
|
+
host: {
|
|
26
|
+
'[class]': 'computedClass()',
|
|
27
|
+
'role': 'group',
|
|
28
|
+
'[attr.aria-labelledby]': 'labelId()',
|
|
29
|
+
'data-slot': 'select-group',
|
|
30
|
+
},
|
|
31
|
+
providers: [
|
|
32
|
+
{
|
|
33
|
+
provide: SELECT_GROUP_CONTEXT,
|
|
34
|
+
useFactory: (component: SelectGroup) => component.context,
|
|
35
|
+
deps: [forwardRef(() => SelectGroup)],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
39
|
+
})
|
|
40
|
+
export class SelectGroup {
|
|
41
|
+
/** Additional CSS classes to apply */
|
|
42
|
+
readonly class = input<string>('');
|
|
43
|
+
|
|
44
|
+
/** Label ID for accessibility */
|
|
45
|
+
readonly labelId = input<string>();
|
|
46
|
+
|
|
47
|
+
/** Context for child components */
|
|
48
|
+
readonly context: SelectGroupContext = {
|
|
49
|
+
label: signal(''),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Computed class combining base styles and custom classes */
|
|
53
|
+
protected readonly computedClass = computed(() =>
|
|
54
|
+
cn('overflow-hidden p-1 text-foreground', this.class())
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
ElementRef,
|
|
7
|
+
inject,
|
|
8
|
+
input,
|
|
9
|
+
OnDestroy,
|
|
10
|
+
OnInit,
|
|
11
|
+
viewChild,
|
|
12
|
+
} from '@angular/core';
|
|
13
|
+
import { SELECT_CONTEXT } from './select-context';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* SelectItem component - individual selectable option.
|
|
17
|
+
* Implements proper ARIA option pattern with keyboard navigation.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <SelectItem value="apple">Apple</SelectItem>
|
|
21
|
+
*/
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'SelectItem',
|
|
24
|
+
template: `
|
|
25
|
+
<span
|
|
26
|
+
class="absolute left-2 flex size-3.5 items-center justify-center"
|
|
27
|
+
>
|
|
28
|
+
@if (isSelected()) {
|
|
29
|
+
<svg
|
|
30
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
31
|
+
width="24"
|
|
32
|
+
height="24"
|
|
33
|
+
viewBox="0 0 24 24"
|
|
34
|
+
fill="none"
|
|
35
|
+
stroke="currentColor"
|
|
36
|
+
stroke-width="2"
|
|
37
|
+
stroke-linecap="round"
|
|
38
|
+
stroke-linejoin="round"
|
|
39
|
+
class="size-4"
|
|
40
|
+
>
|
|
41
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
|
42
|
+
</svg>
|
|
43
|
+
}
|
|
44
|
+
</span>
|
|
45
|
+
<span #textContent data-slot="select-item-text">
|
|
46
|
+
<ng-content />
|
|
47
|
+
</span>
|
|
48
|
+
`,
|
|
49
|
+
host: {
|
|
50
|
+
'[class]': 'computedClass()',
|
|
51
|
+
'role': 'option',
|
|
52
|
+
'[attr.aria-selected]': 'isSelected()',
|
|
53
|
+
'[attr.data-state]': 'isSelected() ? "checked" : "unchecked"',
|
|
54
|
+
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
55
|
+
'[attr.data-value]': 'value()',
|
|
56
|
+
'[attr.data-highlighted]': 'isFocused() ? "" : null',
|
|
57
|
+
'[attr.tabindex]': 'disabled() ? -1 : 0',
|
|
58
|
+
'(click)': 'select()',
|
|
59
|
+
'(keydown)': 'onKeyDown($event)',
|
|
60
|
+
'data-slot': 'select-item',
|
|
61
|
+
},
|
|
62
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
63
|
+
})
|
|
64
|
+
export class SelectItem implements OnInit, OnDestroy {
|
|
65
|
+
private readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
66
|
+
|
|
67
|
+
private readonly textContent = viewChild<ElementRef>('textContent');
|
|
68
|
+
|
|
69
|
+
/** The value of this option */
|
|
70
|
+
readonly value = input.required<string>();
|
|
71
|
+
|
|
72
|
+
/** Whether this option is disabled */
|
|
73
|
+
readonly disabled = input<boolean>(false);
|
|
74
|
+
|
|
75
|
+
/** Additional CSS classes to apply */
|
|
76
|
+
readonly class = input<string>('');
|
|
77
|
+
|
|
78
|
+
/** Whether this item is selected */
|
|
79
|
+
protected readonly isSelected = computed(() => {
|
|
80
|
+
return this.context?.value() === this.value();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/** Whether this item is focused */
|
|
84
|
+
protected readonly isFocused = computed(() => {
|
|
85
|
+
if (!this.context) return false;
|
|
86
|
+
const values = this.context.itemValues();
|
|
87
|
+
const focusedIndex = this.context.focusedIndex();
|
|
88
|
+
return values[focusedIndex] === this.value();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
ngOnInit(): void {
|
|
92
|
+
// Register this item
|
|
93
|
+
this.context?.itemValues.update(values => {
|
|
94
|
+
if (!values.includes(this.value())) {
|
|
95
|
+
return [...values, this.value()];
|
|
96
|
+
}
|
|
97
|
+
return values;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
ngOnDestroy(): void {
|
|
102
|
+
// Unregister this item
|
|
103
|
+
this.context?.itemValues.update(values =>
|
|
104
|
+
values.filter(v => v !== this.value())
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Select this option */
|
|
109
|
+
select() {
|
|
110
|
+
if (!this.disabled()) {
|
|
111
|
+
const textEl = this.textContent()?.nativeElement;
|
|
112
|
+
const label = textEl?.textContent?.trim() || this.value();
|
|
113
|
+
this.context?.setValue(this.value(), label);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Handle keyboard navigation */
|
|
118
|
+
onKeyDown(event: KeyboardEvent): void {
|
|
119
|
+
if (!this.context || this.disabled()) return;
|
|
120
|
+
|
|
121
|
+
switch (event.key) {
|
|
122
|
+
case ' ':
|
|
123
|
+
case 'Enter':
|
|
124
|
+
event.preventDefault();
|
|
125
|
+
this.select();
|
|
126
|
+
break;
|
|
127
|
+
case 'ArrowDown':
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
const currentIndex = this.context.focusedIndex();
|
|
130
|
+
const itemCount = this.context.itemValues().length;
|
|
131
|
+
this.context.focusItem(Math.min(currentIndex + 1, itemCount - 1));
|
|
132
|
+
break;
|
|
133
|
+
case 'ArrowUp':
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
const idx = this.context.focusedIndex();
|
|
136
|
+
this.context.focusItem(Math.max(idx - 1, 0));
|
|
137
|
+
break;
|
|
138
|
+
case 'Home':
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
this.context.focusItem(0);
|
|
141
|
+
break;
|
|
142
|
+
case 'End':
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
const lastIndex = this.context.itemValues().length - 1;
|
|
145
|
+
this.context.focusItem(lastIndex);
|
|
146
|
+
break;
|
|
147
|
+
case 'Escape':
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
this.context.open.set(false);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Computed class combining base styles and custom classes */
|
|
155
|
+
protected readonly computedClass = computed(() =>
|
|
156
|
+
cn(
|
|
157
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
158
|
+
'hover:bg-accent hover:text-accent-foreground cursor-pointer',
|
|
159
|
+
this.disabled() && 'pointer-events-none opacity-50',
|
|
160
|
+
this.class()
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
input,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* SelectLabel component - label for a select group.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <SelectLabel>Fruits</SelectLabel>
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'SelectLabel',
|
|
17
|
+
template: `<ng-content />`,
|
|
18
|
+
host: {
|
|
19
|
+
'[class]': 'computedClass()',
|
|
20
|
+
'data-slot': 'select-label',
|
|
21
|
+
},
|
|
22
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
23
|
+
})
|
|
24
|
+
export class SelectLabel {
|
|
25
|
+
/** Additional CSS classes to apply */
|
|
26
|
+
readonly class = input<string>('');
|
|
27
|
+
|
|
28
|
+
/** Computed class combining base styles and custom classes */
|
|
29
|
+
protected readonly computedClass = computed(() =>
|
|
30
|
+
cn('text-muted-foreground px-2 py-1.5 text-xs', this.class())
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
input,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* SelectSeparator component - visual separator between select items.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <SelectSeparator />
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'SelectSeparator',
|
|
17
|
+
template: ``,
|
|
18
|
+
host: {
|
|
19
|
+
'[class]': 'computedClass()',
|
|
20
|
+
'role': 'separator',
|
|
21
|
+
'aria-orientation': 'horizontal',
|
|
22
|
+
'data-slot': 'select-separator',
|
|
23
|
+
},
|
|
24
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
|
+
})
|
|
26
|
+
export class SelectSeparator {
|
|
27
|
+
/** Additional CSS classes to apply */
|
|
28
|
+
readonly class = input<string>('');
|
|
29
|
+
|
|
30
|
+
/** Computed class combining base styles and custom classes */
|
|
31
|
+
protected readonly computedClass = computed(() =>
|
|
32
|
+
cn('bg-muted pointer-events-none -mx-1 my-1 h-px', this.class())
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
ElementRef,
|
|
7
|
+
inject,
|
|
8
|
+
input,
|
|
9
|
+
viewChild,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import { SELECT_CONTEXT } from './select-context';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* SelectTrigger component - the button that opens the select dropdown.
|
|
15
|
+
* Implements proper ARIA combobox trigger pattern with keyboard navigation.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <SelectTrigger class="w-[180px]">
|
|
19
|
+
* <SelectValue placeholder="Select an option" />
|
|
20
|
+
* </SelectTrigger>
|
|
21
|
+
*/
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'SelectTrigger',
|
|
24
|
+
template: `
|
|
25
|
+
<button
|
|
26
|
+
#triggerButton
|
|
27
|
+
type="button"
|
|
28
|
+
role="combobox"
|
|
29
|
+
[class]="computedClass()"
|
|
30
|
+
[attr.aria-expanded]="context?.open()"
|
|
31
|
+
aria-haspopup="listbox"
|
|
32
|
+
[attr.aria-controls]="context?.contentId"
|
|
33
|
+
[attr.data-state]="context?.open() ? 'open' : 'closed'"
|
|
34
|
+
[attr.data-disabled]="context?.disabled() ? '' : null"
|
|
35
|
+
[attr.data-placeholder]="!context?.value() ? '' : null"
|
|
36
|
+
[disabled]="context?.disabled()"
|
|
37
|
+
(click)="toggleOpen()"
|
|
38
|
+
(keydown)="onKeyDown($event)"
|
|
39
|
+
>
|
|
40
|
+
<ng-content />
|
|
41
|
+
<svg
|
|
42
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
43
|
+
width="24"
|
|
44
|
+
height="24"
|
|
45
|
+
viewBox="0 0 24 24"
|
|
46
|
+
fill="none"
|
|
47
|
+
stroke="currentColor"
|
|
48
|
+
stroke-width="2"
|
|
49
|
+
stroke-linecap="round"
|
|
50
|
+
stroke-linejoin="round"
|
|
51
|
+
class="size-4 opacity-50 shrink-0"
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
>
|
|
54
|
+
<path d="m6 9 6 6 6-6"></path>
|
|
55
|
+
</svg>
|
|
56
|
+
</button>
|
|
57
|
+
`,
|
|
58
|
+
host: {
|
|
59
|
+
'class': 'contents',
|
|
60
|
+
'data-slot': 'select-trigger',
|
|
61
|
+
},
|
|
62
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
63
|
+
})
|
|
64
|
+
export class SelectTrigger {
|
|
65
|
+
protected readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
66
|
+
private readonly triggerButton = viewChild<ElementRef<HTMLButtonElement>>('triggerButton');
|
|
67
|
+
|
|
68
|
+
/** Additional CSS classes to apply */
|
|
69
|
+
readonly class = input<string>('');
|
|
70
|
+
|
|
71
|
+
/** Toggle the select open state */
|
|
72
|
+
toggleOpen() {
|
|
73
|
+
if (!this.context?.disabled()) {
|
|
74
|
+
// Save trigger element for focus restoration
|
|
75
|
+
const button = this.triggerButton()?.nativeElement;
|
|
76
|
+
if (button) {
|
|
77
|
+
this.context?.triggerElement.set(button);
|
|
78
|
+
}
|
|
79
|
+
const newState = !this.context?.open();
|
|
80
|
+
this.context?.open.set(newState);
|
|
81
|
+
if (newState) {
|
|
82
|
+
// Focus first item when opening
|
|
83
|
+
setTimeout(() => this.context?.focusItem(0));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Close the select */
|
|
89
|
+
close() {
|
|
90
|
+
this.context?.open.set(false);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Handle keyboard navigation */
|
|
94
|
+
onKeyDown(event: KeyboardEvent): void {
|
|
95
|
+
if (!this.context || this.context.disabled()) return;
|
|
96
|
+
|
|
97
|
+
switch (event.key) {
|
|
98
|
+
case ' ':
|
|
99
|
+
case 'Enter':
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
this.toggleOpen();
|
|
102
|
+
break;
|
|
103
|
+
case 'ArrowDown':
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
if (!this.context.open()) {
|
|
106
|
+
// Save trigger element
|
|
107
|
+
const button = this.triggerButton()?.nativeElement;
|
|
108
|
+
if (button) {
|
|
109
|
+
this.context.triggerElement.set(button);
|
|
110
|
+
}
|
|
111
|
+
this.context.open.set(true);
|
|
112
|
+
setTimeout(() => this.context?.focusItem(0));
|
|
113
|
+
} else {
|
|
114
|
+
// Move to next item
|
|
115
|
+
const currentIndex = this.context.focusedIndex();
|
|
116
|
+
const itemCount = this.context.itemValues().length;
|
|
117
|
+
this.context.focusItem(Math.min(currentIndex + 1, itemCount - 1));
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
case 'ArrowUp':
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
if (!this.context.open()) {
|
|
123
|
+
// Save trigger element
|
|
124
|
+
const button = this.triggerButton()?.nativeElement;
|
|
125
|
+
if (button) {
|
|
126
|
+
this.context.triggerElement.set(button);
|
|
127
|
+
}
|
|
128
|
+
this.context.open.set(true);
|
|
129
|
+
const lastIndex = this.context.itemValues().length - 1;
|
|
130
|
+
setTimeout(() => this.context?.focusItem(lastIndex));
|
|
131
|
+
} else {
|
|
132
|
+
// Move to previous item
|
|
133
|
+
const currentIndex = this.context.focusedIndex();
|
|
134
|
+
this.context.focusItem(Math.max(currentIndex - 1, 0));
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
case 'Escape':
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
this.close();
|
|
140
|
+
break;
|
|
141
|
+
case 'Home':
|
|
142
|
+
if (this.context.open()) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
this.context.focusItem(0);
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
case 'End':
|
|
148
|
+
if (this.context.open()) {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
const lastIndex = this.context.itemValues().length - 1;
|
|
151
|
+
this.context.focusItem(lastIndex);
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Computed class combining base styles and custom classes */
|
|
158
|
+
protected readonly computedClass = computed(() =>
|
|
159
|
+
cn(
|
|
160
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex h-9 w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2",
|
|
161
|
+
this.class()
|
|
162
|
+
)
|
|
163
|
+
);
|
|
164
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
computed,
|
|
5
|
+
effect,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { SELECT_CONTEXT } from './select-context';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* SelectValue component - displays the selected value or placeholder.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <SelectValue placeholder="Select an option" />
|
|
16
|
+
*/
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'SelectValue',
|
|
19
|
+
template: `{{ displayValue() }}`,
|
|
20
|
+
host: {
|
|
21
|
+
'[attr.data-placeholder]': '!context?.value() ? "" : null',
|
|
22
|
+
'data-slot': 'select-value',
|
|
23
|
+
},
|
|
24
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
|
+
})
|
|
26
|
+
export class SelectValue {
|
|
27
|
+
protected readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
28
|
+
|
|
29
|
+
/** Placeholder text when no value is selected */
|
|
30
|
+
readonly placeholder = input<string>('');
|
|
31
|
+
|
|
32
|
+
constructor() {
|
|
33
|
+
// Update context placeholder on init and changes
|
|
34
|
+
effect(() => {
|
|
35
|
+
if (this.context) {
|
|
36
|
+
this.context.placeholder.set(this.placeholder());
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Computed display value */
|
|
42
|
+
protected readonly displayValue = computed(() => {
|
|
43
|
+
const label = this.context?.selectedLabel();
|
|
44
|
+
const value = this.context?.value();
|
|
45
|
+
if (label) return label;
|
|
46
|
+
if (value) return value;
|
|
47
|
+
return this.placeholder();
|
|
48
|
+
});
|
|
49
|
+
}
|