@ng-cn/core 1.0.15 → 1.0.17
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 +34 -33
- package/schematics/component/index.js +454 -95
- package/schematics/component/index.ts +459 -98
- package/schematics/ng-add/index.js +539 -55
- package/schematics/ng-add/index.ts +555 -62
- package/schematics/ng-add/schema.json +8 -2
- package/schematics/test-schematic.js +1 -2
- package/src/app/lib/components/ui/.gitkeep +0 -0
- package/src/app/lib/components/ui/accordion/accordion-content.component.ts +16 -24
- package/src/app/lib/components/ui/accordion/accordion-context.ts +4 -9
- package/src/app/lib/components/ui/accordion/accordion-item.component.ts +33 -29
- package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +11 -14
- package/src/app/lib/components/ui/accordion/accordion.component.ts +60 -49
- package/src/app/lib/components/ui/accordion/index.ts +5 -6
- package/src/app/lib/components/ui/alert/alert-description.component.ts +3 -8
- package/src/app/lib/components/ui/alert/alert-title.component.ts +2 -7
- package/src/app/lib/components/ui/alert/alert-variants.ts +19 -5
- package/src/app/lib/components/ui/alert/alert.component.ts +2 -10
- package/src/app/lib/components/ui/alert/index.ts +0 -1
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +5 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +5 -11
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +63 -66
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-context.ts +10 -5
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +5 -10
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +3 -7
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +3 -7
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +5 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +8 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +28 -34
- package/src/app/lib/components/ui/alert-dialog/index.ts +0 -1
- package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +3 -9
- package/src/app/lib/components/ui/avatar/avatar-context.ts +9 -0
- package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +7 -18
- package/src/app/lib/components/ui/avatar/avatar-image.component.ts +39 -17
- package/src/app/lib/components/ui/avatar/avatar.component.ts +17 -20
- package/src/app/lib/components/ui/avatar/index.ts +1 -1
- package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +9 -30
- package/src/app/lib/components/ui/badge/badge-variants.ts +5 -5
- package/src/app/lib/components/ui/badge/badge.component.ts +4 -8
- package/src/app/lib/components/ui/badge/index.ts +0 -1
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +5 -14
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +6 -18
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +6 -15
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +22 -31
- package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +3 -9
- package/src/app/lib/components/ui/breadcrumb/index.ts +0 -1
- package/src/app/lib/components/ui/button/button-variants.ts +6 -8
- package/src/app/lib/components/ui/button/button.component.ts +4 -8
- package/src/app/lib/components/ui/button/index.ts +0 -1
- package/src/app/lib/components/ui/button-group/button-group-variants.ts +12 -15
- package/src/app/lib/components/ui/button-group/button-group.component.ts +6 -14
- package/src/app/lib/components/ui/button-group/index.ts +1 -5
- package/src/app/lib/components/ui/calendar/calendar.component.ts +103 -115
- package/src/app/lib/components/ui/card/card-action.component.ts +2 -10
- package/src/app/lib/components/ui/card/card-content.component.ts +1 -6
- package/src/app/lib/components/ui/card/card-description.component.ts +2 -7
- package/src/app/lib/components/ui/card/card-footer.component.ts +2 -7
- package/src/app/lib/components/ui/card/card-header.component.ts +3 -8
- package/src/app/lib/components/ui/card/card-title.component.ts +2 -9
- package/src/app/lib/components/ui/card/card.component.ts +3 -8
- package/src/app/lib/components/ui/card/index.ts +0 -1
- package/src/app/lib/components/ui/carousel/carousel-content.component.ts +3 -9
- package/src/app/lib/components/ui/carousel/carousel-item.component.ts +5 -5
- package/src/app/lib/components/ui/carousel/carousel-next.component.ts +9 -8
- package/src/app/lib/components/ui/carousel/carousel-previous.component.ts +9 -8
- package/src/app/lib/components/ui/carousel/carousel.component.ts +14 -25
- package/src/app/lib/components/ui/carousel/index.ts +5 -2
- package/src/app/lib/components/ui/chart/chart-container.component.ts +20 -26
- package/src/app/lib/components/ui/chart/chart-legend-content.component.ts +6 -16
- package/src/app/lib/components/ui/chart/chart-legend.component.ts +2 -7
- package/src/app/lib/components/ui/chart/chart-tooltip-content.component.ts +2 -9
- package/src/app/lib/components/ui/chart/chart-tooltip.component.ts +2 -7
- package/src/app/lib/components/ui/chart/chart.component.ts +12 -32
- package/src/app/lib/components/ui/chart/index.ts +7 -8
- package/src/app/lib/components/ui/checkbox/checkbox.component.ts +55 -74
- package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +16 -25
- package/src/app/lib/components/ui/collapsible/collapsible-context.ts +0 -8
- package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +6 -16
- package/src/app/lib/components/ui/collapsible/collapsible.component.ts +29 -33
- package/src/app/lib/components/ui/collapsible/index.ts +0 -1
- package/src/app/lib/components/ui/combobox/combobox-content.component.ts +8 -15
- package/src/app/lib/components/ui/combobox/combobox-context.ts +5 -4
- package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +5 -12
- package/src/app/lib/components/ui/combobox/combobox-group.component.ts +3 -7
- package/src/app/lib/components/ui/combobox/combobox-input.component.ts +25 -25
- package/src/app/lib/components/ui/combobox/combobox-item.component.ts +45 -44
- package/src/app/lib/components/ui/combobox/combobox-list.component.ts +14 -12
- package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +24 -14
- package/src/app/lib/components/ui/combobox/combobox-value.component.ts +27 -22
- package/src/app/lib/components/ui/combobox/combobox.component.ts +74 -54
- package/src/app/lib/components/ui/combobox/index.ts +1 -6
- package/src/app/lib/components/ui/command/command-context.ts +1 -5
- package/src/app/lib/components/ui/command/command-dialog.component.ts +12 -14
- package/src/app/lib/components/ui/command/command-empty.component.ts +2 -3
- package/src/app/lib/components/ui/command/command-group.component.ts +32 -25
- package/src/app/lib/components/ui/command/command-input.component.ts +29 -28
- package/src/app/lib/components/ui/command/command-item.component.ts +46 -58
- package/src/app/lib/components/ui/command/command-list.component.ts +5 -4
- package/src/app/lib/components/ui/command/command-separator.component.ts +2 -3
- package/src/app/lib/components/ui/command/command-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/command/command.component.ts +33 -22
- package/src/app/lib/components/ui/command/index.ts +0 -1
- package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +20 -11
- package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +36 -43
- package/src/app/lib/components/ui/context-menu/context-menu-context.ts +1 -1
- package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +12 -13
- package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +2 -5
- package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +9 -2
- package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +14 -14
- package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +2 -3
- package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +9 -2
- package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/context-menu/context-menu.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/index.ts +15 -4
- package/src/app/lib/components/ui/data-table/data-table-content.component.ts +22 -28
- package/src/app/lib/components/ui/data-table/data-table-context.ts +1 -3
- package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +17 -27
- package/src/app/lib/components/ui/data-table/data-table-search.component.ts +6 -14
- package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +3 -7
- package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +11 -20
- package/src/app/lib/components/ui/data-table/data-table.component.ts +41 -49
- package/src/app/lib/components/ui/data-table/index.ts +7 -8
- package/src/app/lib/components/ui/date-picker/date-picker.component.ts +24 -24
- package/src/app/lib/components/ui/dialog/dialog-close.component.ts +4 -8
- package/src/app/lib/components/ui/dialog/dialog-content.component.ts +72 -73
- package/src/app/lib/components/ui/dialog/dialog-context.ts +7 -5
- package/src/app/lib/components/ui/dialog/dialog-description.component.ts +5 -10
- package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +3 -7
- package/src/app/lib/components/ui/dialog/dialog-header.component.ts +3 -7
- package/src/app/lib/components/ui/dialog/dialog-title.component.ts +5 -10
- package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/dialog/dialog.component.ts +29 -34
- package/src/app/lib/components/ui/dialog/index.ts +0 -1
- package/src/app/lib/components/ui/drawer/drawer-close.component.ts +4 -8
- package/src/app/lib/components/ui/drawer/drawer-content.component.ts +39 -35
- package/src/app/lib/components/ui/drawer/drawer-description.component.ts +5 -10
- package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +3 -7
- package/src/app/lib/components/ui/drawer/drawer-header.component.ts +3 -7
- package/src/app/lib/components/ui/drawer/drawer-title.component.ts +5 -10
- package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/drawer/drawer.component.ts +25 -26
- package/src/app/lib/components/ui/drawer/index.ts +0 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +20 -11
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +96 -61
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-context.ts +1 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-group.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-item.component.ts +10 -11
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +2 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +14 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +14 -14
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +2 -3
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +9 -2
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +6 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/index.ts +10 -3
- package/src/app/lib/components/ui/empty/empty-action.component.ts +2 -9
- package/src/app/lib/components/ui/empty/empty-description.component.ts +2 -10
- package/src/app/lib/components/ui/empty/empty-icon.component.ts +3 -8
- package/src/app/lib/components/ui/empty/empty-title.component.ts +2 -9
- package/src/app/lib/components/ui/empty/empty.component.ts +3 -8
- package/src/app/lib/components/ui/empty/index.ts +0 -1
- package/src/app/lib/components/ui/form/form-context.ts +1 -11
- package/src/app/lib/components/ui/form/form-control.component.ts +22 -22
- package/src/app/lib/components/ui/form/form-description.component.ts +4 -10
- package/src/app/lib/components/ui/form/form-field.component.ts +7 -10
- package/src/app/lib/components/ui/form/form-item.component.ts +2 -12
- package/src/app/lib/components/ui/form/form-label.component.ts +15 -15
- package/src/app/lib/components/ui/form/form-message.component.ts +7 -15
- package/src/app/lib/components/ui/form/form.component.ts +9 -20
- package/src/app/lib/components/ui/form/index.ts +4 -5
- package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +21 -33
- package/src/app/lib/components/ui/hover-card/hover-card-context.ts +0 -8
- package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +17 -26
- package/src/app/lib/components/ui/hover-card/hover-card.component.ts +18 -28
- package/src/app/lib/components/ui/hover-card/index.ts +9 -6
- package/src/app/lib/components/ui/input/input.component.ts +57 -75
- package/src/app/lib/components/ui/input-group/index.ts +0 -1
- package/src/app/lib/components/ui/input-group/input-group-addon.component.ts +4 -11
- package/src/app/lib/components/ui/input-group/input-group-input.component.ts +3 -8
- package/src/app/lib/components/ui/input-group/input-group.component.ts +4 -9
- package/src/app/lib/components/ui/input-otp/index.ts +4 -5
- package/src/app/lib/components/ui/input-otp/input-otp-context.ts +0 -8
- package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +2 -3
- package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +4 -3
- package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +8 -10
- package/src/app/lib/components/ui/input-otp/input-otp.component.ts +27 -45
- package/src/app/lib/components/ui/kbd/index.ts +0 -1
- package/src/app/lib/components/ui/kbd/kbd-variants.ts +1 -1
- package/src/app/lib/components/ui/kbd/kbd.component.ts +4 -8
- package/src/app/lib/components/ui/label/label.component.ts +15 -28
- package/src/app/lib/components/ui/menubar/index.ts +11 -8
- package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +21 -12
- package/src/app/lib/components/ui/menubar/menubar-content.component.ts +46 -53
- package/src/app/lib/components/ui/menubar/menubar-context.ts +3 -9
- package/src/app/lib/components/ui/menubar/menubar-item.component.ts +13 -14
- package/src/app/lib/components/ui/menubar/menubar-label.component.ts +2 -5
- package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +14 -2
- package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +9 -2
- package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +13 -13
- package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +2 -3
- package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +7 -6
- package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +8 -1
- package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +26 -21
- package/src/app/lib/components/ui/menubar/menubar.component.ts +6 -13
- package/src/app/lib/components/ui/native-select/index.ts +1 -5
- package/src/app/lib/components/ui/native-select/native-select-variants.ts +1 -1
- package/src/app/lib/components/ui/native-select/native-select.component.ts +14 -15
- package/src/app/lib/components/ui/navigation-menu/index.ts +10 -8
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +18 -13
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-context.ts +2 -10
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +3 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +6 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +3 -8
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +2 -4
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger-style.ts +1 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +3 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +8 -15
- package/src/app/lib/components/ui/pagination/index.ts +0 -1
- package/src/app/lib/components/ui/pagination/pagination-content.component.ts +3 -7
- package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +3 -7
- package/src/app/lib/components/ui/pagination/pagination-item.component.ts +3 -9
- package/src/app/lib/components/ui/pagination/pagination-link.component.ts +4 -8
- package/src/app/lib/components/ui/pagination/pagination-next.component.ts +3 -11
- package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +3 -11
- package/src/app/lib/components/ui/pagination/pagination.component.ts +3 -7
- package/src/app/lib/components/ui/popover/index.ts +9 -6
- package/src/app/lib/components/ui/popover/popover-anchor.component.ts +2 -13
- package/src/app/lib/components/ui/popover/popover-content.component.ts +119 -69
- package/src/app/lib/components/ui/popover/popover-context.ts +0 -8
- package/src/app/lib/components/ui/popover/popover-trigger.component.ts +22 -22
- package/src/app/lib/components/ui/popover/popover.component.ts +20 -33
- package/src/app/lib/components/ui/progress/index.ts +1 -6
- package/src/app/lib/components/ui/progress/progress.component.ts +15 -30
- package/src/app/lib/components/ui/radio-group/index.ts +1 -4
- package/src/app/lib/components/ui/radio-group/radio-group-context.ts +1 -7
- package/src/app/lib/components/ui/radio-group/radio-group-item.component.ts +36 -69
- package/src/app/lib/components/ui/radio-group/radio-group.component.ts +38 -67
- package/src/app/lib/components/ui/resizable/index.ts +0 -1
- package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +25 -39
- package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +15 -18
- package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +12 -31
- package/src/app/lib/components/ui/scroll-area/index.ts +4 -5
- package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +5 -19
- package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +8 -27
- package/src/app/lib/components/ui/segmented/index.ts +5 -9
- package/src/app/lib/components/ui/segmented/segmented-context.ts +1 -3
- package/src/app/lib/components/ui/segmented/segmented-item.component.ts +21 -29
- package/src/app/lib/components/ui/segmented/segmented-variants.ts +2 -2
- package/src/app/lib/components/ui/segmented/segmented.component.ts +24 -32
- package/src/app/lib/components/ui/select/index.ts +5 -6
- package/src/app/lib/components/ui/select/select-content.component.ts +34 -62
- package/src/app/lib/components/ui/select/select-context.ts +4 -14
- package/src/app/lib/components/ui/select/select-group.component.ts +6 -7
- package/src/app/lib/components/ui/select/select-item.component.ts +46 -55
- package/src/app/lib/components/ui/select/select-label.component.ts +2 -7
- package/src/app/lib/components/ui/select/select-separator.component.ts +3 -8
- package/src/app/lib/components/ui/select/select-trigger.component.ts +28 -25
- package/src/app/lib/components/ui/select/select-value.component.ts +7 -13
- package/src/app/lib/components/ui/select/select.component.ts +52 -64
- package/src/app/lib/components/ui/separator/index.ts +1 -6
- package/src/app/lib/components/ui/separator/separator.component.ts +4 -19
- package/src/app/lib/components/ui/sheet/index.ts +0 -1
- package/src/app/lib/components/ui/sheet/sheet-close.component.ts +4 -8
- package/src/app/lib/components/ui/sheet/sheet-content.component.ts +31 -36
- package/src/app/lib/components/ui/sheet/sheet-description.component.ts +5 -10
- package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +3 -7
- package/src/app/lib/components/ui/sheet/sheet-header.component.ts +3 -7
- package/src/app/lib/components/ui/sheet/sheet-title.component.ts +5 -10
- package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/sheet/sheet-variants.ts +1 -1
- package/src/app/lib/components/ui/sheet/sheet.component.ts +36 -36
- package/src/app/lib/components/ui/sidebar/index.ts +14 -15
- package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-context.ts +1 -3
- package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +4 -9
- package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +2 -6
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +46 -52
- package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar-route-active.service.ts +17 -17
- package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar.component.ts +20 -31
- package/src/app/lib/components/ui/skeleton/skeleton.component.ts +3 -8
- package/src/app/lib/components/ui/slider/index.ts +1 -6
- package/src/app/lib/components/ui/slider/slider.component.ts +73 -138
- package/src/app/lib/components/ui/spinner/index.ts +0 -1
- package/src/app/lib/components/ui/spinner/spinner-variants.ts +19 -22
- package/src/app/lib/components/ui/spinner/spinner.component.ts +4 -8
- package/src/app/lib/components/ui/switch/index.ts +1 -6
- package/src/app/lib/components/ui/switch/switch.component.ts +83 -108
- package/src/app/lib/components/ui/table/index.ts +0 -1
- package/src/app/lib/components/ui/table/table-body.component.ts +6 -10
- package/src/app/lib/components/ui/table/table-caption.component.ts +6 -8
- package/src/app/lib/components/ui/table/table-cell.component.ts +4 -8
- package/src/app/lib/components/ui/table/table-footer.component.ts +6 -8
- package/src/app/lib/components/ui/table/table-head.component.ts +4 -8
- package/src/app/lib/components/ui/table/table-header.component.ts +6 -10
- package/src/app/lib/components/ui/table/table-row.component.ts +6 -11
- package/src/app/lib/components/ui/table/table.component.ts +4 -8
- package/src/app/lib/components/ui/tabs/index.ts +14 -7
- package/src/app/lib/components/ui/tabs/tabs-content.component.ts +11 -36
- package/src/app/lib/components/ui/tabs/tabs-context.ts +0 -8
- package/src/app/lib/components/ui/tabs/tabs-list.component.ts +54 -60
- package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +20 -35
- package/src/app/lib/components/ui/tabs/tabs.component.ts +32 -49
- package/src/app/lib/components/ui/textarea/textarea.component.ts +3 -8
- package/src/app/lib/components/ui/toast/index.ts +6 -7
- package/src/app/lib/components/ui/toast/toast-action.component.ts +7 -18
- package/src/app/lib/components/ui/toast/toast-description.component.ts +2 -11
- package/src/app/lib/components/ui/toast/toast-title.component.ts +2 -9
- package/src/app/lib/components/ui/toast/toast-variants.ts +1 -1
- package/src/app/lib/components/ui/toast/toast.component.ts +18 -24
- package/src/app/lib/components/ui/toast/toast.service.ts +22 -37
- package/src/app/lib/components/ui/toast/toaster.component.ts +6 -16
- package/src/app/lib/components/ui/toggle/index.ts +1 -5
- package/src/app/lib/components/ui/toggle/toggle-variants.ts +2 -2
- package/src/app/lib/components/ui/toggle/toggle.component.ts +32 -51
- package/src/app/lib/components/ui/toggle-group/index.ts +1 -4
- package/src/app/lib/components/ui/toggle-group/toggle-group-context.ts +1 -7
- package/src/app/lib/components/ui/toggle-group/toggle-group-item.component.ts +38 -59
- package/src/app/lib/components/ui/toggle-group/toggle-group.component.ts +33 -51
- package/src/app/lib/components/ui/tooltip/index.ts +9 -6
- package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +6 -24
- package/src/app/lib/components/ui/tooltip/tooltip-context.ts +0 -8
- package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +12 -24
- package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +4 -21
- package/src/app/lib/components/ui/tooltip/tooltip.component.ts +21 -33
- package/src/app/lib/components/ui/typography/index.ts +0 -1
- package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-h1.component.ts +3 -10
- package/src/app/lib/components/ui/typography/typography-h2.component.ts +3 -10
- package/src/app/lib/components/ui/typography/typography-h3.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-h4.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +4 -8
- package/src/app/lib/components/ui/typography/typography-large.component.ts +3 -9
- package/src/app/lib/components/ui/typography/typography-lead.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-list.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-muted.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-p.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-small.component.ts +3 -7
- package/src/app/lib/utils/accessibility/click-outside.directive.ts +1 -8
- package/src/app/lib/utils/accessibility/focus-management.service.ts +4 -15
- package/src/app/lib/utils/accessibility/focus-trap.directive.ts +32 -106
- package/src/app/lib/utils/accessibility/index.ts +16 -5
- package/src/app/lib/utils/accessibility/keyboard-navigation.directive.ts +5 -8
- package/src/app/lib/utils/accessibility/live-region.directive.ts +10 -13
- package/src/app/lib/utils/accessibility/touch-target.directive.ts +1 -8
- package/src/app/lib/utils/animation/animation.utils.ts +4 -7
- package/src/app/lib/utils/animation/index.ts +15 -5
- package/src/app/lib/utils/animation/presence.component.ts +1 -1
- package/src/app/lib/utils/animation/presence.directive.ts +2 -2
- package/src/app/lib/utils/positioning/index.ts +40 -18
- package/src/app/lib/components/ui/index.ts +0 -551
- package/src/app/lib/index.ts +0 -7
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
9
3
|
import { COLLAPSIBLE_CONTEXT } from './collapsible-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -24,35 +18,32 @@ import { COLLAPSIBLE_CONTEXT } from './collapsible-context';
|
|
|
24
18
|
</div>
|
|
25
19
|
`,
|
|
26
20
|
host: {
|
|
21
|
+
'attr.data-slot': '"collapsible-content"',
|
|
27
22
|
'[class]': 'computedClass()',
|
|
28
23
|
'[attr.data-state]': 'collapsible.isOpen() ? "open" : "closed"',
|
|
29
24
|
'[attr.data-disabled]': 'collapsible.disabled() ? "" : null',
|
|
30
25
|
'[attr.aria-hidden]': '!collapsible.isOpen()',
|
|
31
26
|
},
|
|
32
|
-
styles: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
styles: [
|
|
28
|
+
`
|
|
29
|
+
:host {
|
|
30
|
+
display: grid;
|
|
31
|
+
grid-template-rows: 0fr;
|
|
32
|
+
transition: grid-template-rows 200ms ease-out;
|
|
33
|
+
}
|
|
34
|
+
:host[data-state='open'] {
|
|
35
|
+
grid-template-rows: 1fr;
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
],
|
|
42
39
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
43
40
|
})
|
|
44
41
|
export class CollapsibleContent {
|
|
45
|
-
protected readonly collapsible = inject(COLLAPSIBLE_CONTEXT);
|
|
46
|
-
|
|
47
42
|
/** Additional CSS classes */
|
|
48
43
|
readonly class = input<string>('');
|
|
49
44
|
|
|
50
|
-
protected readonly
|
|
51
|
-
cn(
|
|
52
|
-
'overflow-hidden',
|
|
53
|
-
this.class()
|
|
54
|
-
)
|
|
55
|
-
);
|
|
45
|
+
protected readonly collapsible = inject(COLLAPSIBLE_CONTEXT);
|
|
56
46
|
|
|
47
|
+
protected readonly computedClass = computed(() => cn('overflow-hidden', this.class()));
|
|
57
48
|
protected readonly innerClass = computed(() => 'min-h-0');
|
|
58
49
|
}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// Types
|
|
5
|
-
// ============================================================================
|
|
6
|
-
|
|
7
3
|
export interface CollapsibleContext {
|
|
8
4
|
isOpen: () => boolean;
|
|
9
5
|
toggle: () => void;
|
|
10
6
|
disabled: () => boolean;
|
|
11
7
|
}
|
|
12
8
|
|
|
13
|
-
// ============================================================================
|
|
14
|
-
// Injection Tokens
|
|
15
|
-
// ============================================================================
|
|
16
|
-
|
|
17
9
|
export const COLLAPSIBLE_CONTEXT = new InjectionToken<CollapsibleContext>('CollapsibleContext');
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
9
3
|
import { COLLAPSIBLE_CONTEXT } from './collapsible-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -18,6 +12,7 @@ import { COLLAPSIBLE_CONTEXT } from './collapsible-context';
|
|
|
18
12
|
selector: 'CollapsibleTrigger',
|
|
19
13
|
template: `<ng-content />`,
|
|
20
14
|
host: {
|
|
15
|
+
'attr.data-slot': '"collapsible-trigger"',
|
|
21
16
|
'[class]': 'computedClass()',
|
|
22
17
|
'[attr.data-state]': 'collapsible.isOpen() ? "open" : "closed"',
|
|
23
18
|
'[attr.data-disabled]': 'collapsible.disabled() ? "" : null',
|
|
@@ -27,28 +22,23 @@ import { COLLAPSIBLE_CONTEXT } from './collapsible-context';
|
|
|
27
22
|
'(keydown.enter)': 'onClick()',
|
|
28
23
|
'(keydown.space)': 'onSpace($event)',
|
|
29
24
|
'[attr.tabindex]': 'collapsible.disabled() ? -1 : 0',
|
|
30
|
-
|
|
25
|
+
role: 'button',
|
|
31
26
|
},
|
|
32
27
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
33
28
|
})
|
|
34
29
|
export class CollapsibleTrigger {
|
|
35
|
-
protected readonly collapsible = inject(COLLAPSIBLE_CONTEXT);
|
|
36
|
-
|
|
37
30
|
/** Additional CSS classes */
|
|
38
31
|
readonly class = input<string>('');
|
|
39
32
|
|
|
33
|
+
protected readonly collapsible = inject(COLLAPSIBLE_CONTEXT);
|
|
34
|
+
|
|
40
35
|
protected readonly computedClass = computed(() =>
|
|
41
|
-
cn(
|
|
42
|
-
'cursor-pointer',
|
|
43
|
-
'disabled:pointer-events-none disabled:opacity-50',
|
|
44
|
-
this.class()
|
|
45
|
-
)
|
|
36
|
+
cn('cursor-pointer', 'disabled:pointer-events-none disabled:opacity-50', this.class()),
|
|
46
37
|
);
|
|
47
38
|
|
|
48
39
|
protected onClick(): void {
|
|
49
40
|
this.collapsible.toggle();
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
protected onSpace(event: Event): void {
|
|
53
43
|
event.preventDefault();
|
|
54
44
|
this.onClick();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
booleanAttribute,
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
Component,
|
|
6
|
+
computed,
|
|
7
|
+
effect,
|
|
8
|
+
forwardRef,
|
|
9
|
+
input,
|
|
10
|
+
model,
|
|
11
|
+
output,
|
|
12
|
+
signal,
|
|
13
13
|
} from '@angular/core';
|
|
14
14
|
import { COLLAPSIBLE_CONTEXT, CollapsibleContext } from './collapsible-context';
|
|
15
15
|
|
|
@@ -34,6 +34,7 @@ import { COLLAPSIBLE_CONTEXT, CollapsibleContext } from './collapsible-context';
|
|
|
34
34
|
selector: 'Collapsible',
|
|
35
35
|
template: `<ng-content />`,
|
|
36
36
|
host: {
|
|
37
|
+
'attr.data-slot': '"collapsible"',
|
|
37
38
|
'[class]': 'computedClass()',
|
|
38
39
|
'[attr.data-state]': 'isOpen() ? "open" : "closed"',
|
|
39
40
|
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
@@ -47,24 +48,6 @@ import { COLLAPSIBLE_CONTEXT, CollapsibleContext } from './collapsible-context';
|
|
|
47
48
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
48
49
|
})
|
|
49
50
|
export class Collapsible implements CollapsibleContext {
|
|
50
|
-
/** Whether the collapsible is open by default */
|
|
51
|
-
readonly defaultOpen = input<boolean, unknown>(false, { transform: booleanAttribute });
|
|
52
|
-
|
|
53
|
-
/** Controlled open state - two-way binding supported */
|
|
54
|
-
readonly open = model<boolean | undefined>(undefined);
|
|
55
|
-
|
|
56
|
-
/** Whether the collapsible is disabled */
|
|
57
|
-
readonly disabled = input<boolean, unknown>(false, { transform: booleanAttribute });
|
|
58
|
-
|
|
59
|
-
/** Additional CSS classes */
|
|
60
|
-
readonly class = input<string>('');
|
|
61
|
-
|
|
62
|
-
/** Event emitted when open state changes */
|
|
63
|
-
readonly openChange = output<boolean>();
|
|
64
|
-
|
|
65
|
-
/** Internal state for open/closed */
|
|
66
|
-
private readonly _isOpen = signal<boolean>(false);
|
|
67
|
-
|
|
68
51
|
constructor() {
|
|
69
52
|
// Initialize with defaultOpen
|
|
70
53
|
effect(() => {
|
|
@@ -79,9 +62,26 @@ export class Collapsible implements CollapsibleContext {
|
|
|
79
62
|
});
|
|
80
63
|
}
|
|
81
64
|
|
|
65
|
+
/** Event emitted when open state changes */
|
|
66
|
+
readonly openChange = output<boolean>();
|
|
67
|
+
|
|
68
|
+
/** Controlled open state - two-way binding supported */
|
|
69
|
+
readonly open = model<boolean | undefined>(undefined);
|
|
70
|
+
|
|
71
|
+
/** Whether the collapsible is open by default */
|
|
72
|
+
readonly defaultOpen = input<boolean, unknown>(false, { transform: booleanAttribute });
|
|
73
|
+
/** Whether the collapsible is disabled */
|
|
74
|
+
readonly disabled = input<boolean, unknown>(false, { transform: booleanAttribute });
|
|
75
|
+
/** Additional CSS classes */
|
|
76
|
+
readonly class = input<string>('');
|
|
77
|
+
|
|
78
|
+
protected readonly computedClass = computed(() => cn('', this.class()));
|
|
79
|
+
|
|
80
|
+
/** Internal state for open/closed */
|
|
81
|
+
private readonly _isOpen = signal<boolean>(false);
|
|
82
|
+
|
|
82
83
|
/** Get the current open state */
|
|
83
84
|
isOpen = () => this.open() ?? this._isOpen();
|
|
84
|
-
|
|
85
85
|
/** Toggle the open state */
|
|
86
86
|
toggle = () => {
|
|
87
87
|
if (this.disabled()) return;
|
|
@@ -95,8 +95,4 @@ export class Collapsible implements CollapsibleContext {
|
|
|
95
95
|
this.open.set(newState);
|
|
96
96
|
this.openChange.emit(newState);
|
|
97
97
|
};
|
|
98
|
-
|
|
99
|
-
protected readonly computedClass = computed(() =>
|
|
100
|
-
cn('', this.class())
|
|
101
|
-
);
|
|
102
98
|
}
|
|
@@ -2,4 +2,3 @@ export { CollapsibleContent } from './collapsible-content.component';
|
|
|
2
2
|
export { COLLAPSIBLE_CONTEXT, type CollapsibleContext } from './collapsible-context';
|
|
3
3
|
export { CollapsibleTrigger } from './collapsible-trigger.component';
|
|
4
4
|
export { Collapsible } from './collapsible.component';
|
|
5
|
-
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { cn, Presence } from '@/lib/utils';
|
|
2
2
|
import { ClickOutsideDirective } from '@/lib/utils/accessibility';
|
|
3
|
-
import {
|
|
4
|
-
ChangeDetectionStrategy,
|
|
5
|
-
Component,
|
|
6
|
-
computed,
|
|
7
|
-
inject,
|
|
8
|
-
input,
|
|
9
|
-
} from '@angular/core';
|
|
3
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
10
4
|
import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
11
5
|
|
|
12
6
|
/**
|
|
@@ -31,26 +25,25 @@ import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
|
31
25
|
</Presence>
|
|
32
26
|
`,
|
|
33
27
|
host: {
|
|
28
|
+
'attr.data-slot': '"combobox-content"',
|
|
34
29
|
'[class]': 'computedClass()',
|
|
35
30
|
'[attr.data-state]': 'context.open() ? "open" : "closed"',
|
|
36
31
|
},
|
|
37
32
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
38
33
|
})
|
|
39
34
|
export class ComboboxContent {
|
|
40
|
-
protected readonly context = inject(COMBOBOX_CONTEXT);
|
|
41
|
-
|
|
42
35
|
/** Additional CSS classes */
|
|
43
36
|
readonly class = input<string>('');
|
|
44
37
|
|
|
45
|
-
protected readonly
|
|
46
|
-
cn('contents', this.class())
|
|
47
|
-
);
|
|
38
|
+
protected readonly context = inject(COMBOBOX_CONTEXT);
|
|
48
39
|
|
|
40
|
+
protected readonly computedClass = computed(() => cn('contents'));
|
|
49
41
|
protected readonly dropdownClass = computed(() =>
|
|
50
42
|
cn(
|
|
51
|
-
'absolute z-50 mt-1 max-h-
|
|
52
|
-
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95'
|
|
53
|
-
|
|
43
|
+
'absolute z-50 mt-1 max-h-72 w-full min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md',
|
|
44
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
|
45
|
+
this.class(),
|
|
46
|
+
),
|
|
54
47
|
);
|
|
55
48
|
|
|
56
49
|
protected onClickOutside(): void {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { InjectionToken, Signal, WritableSignal } from '@angular/core';
|
|
2
|
+
import { LucideIconData } from 'lucide-angular';
|
|
2
3
|
|
|
3
4
|
export interface ComboboxOption {
|
|
4
5
|
value: string;
|
|
5
6
|
label: string;
|
|
6
7
|
disabled?: boolean;
|
|
8
|
+
icon?: LucideIconData;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export interface ComboboxContext {
|
|
@@ -25,6 +27,8 @@ export interface ComboboxContext {
|
|
|
25
27
|
listboxId: string;
|
|
26
28
|
/** ID of the currently highlighted option */
|
|
27
29
|
activeDescendantId: Signal<string | null>;
|
|
30
|
+
/** Optional icon position for items with icons */
|
|
31
|
+
iconPosition: Signal<'left' | 'right'>;
|
|
28
32
|
/** Select an option */
|
|
29
33
|
onSelect: (value: string) => void;
|
|
30
34
|
/** Toggle or set open state */
|
|
@@ -43,7 +47,4 @@ export interface ComboboxContext {
|
|
|
43
47
|
getOptionId: (index: number) => string;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
export const COMBOBOX_CONTEXT = new InjectionToken<ComboboxContext>(
|
|
47
|
-
'ComboboxContext'
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
+
export const COMBOBOX_CONTEXT = new InjectionToken<ComboboxContext>('ComboboxContext');
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
9
3
|
import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -19,17 +13,16 @@ import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
|
19
13
|
}
|
|
20
14
|
`,
|
|
21
15
|
host: {
|
|
16
|
+
'attr.data-slot': '"combobox-empty"',
|
|
22
17
|
'[class]': 'computedClass()',
|
|
23
18
|
},
|
|
24
19
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
20
|
})
|
|
26
21
|
export class ComboboxEmpty {
|
|
27
|
-
protected readonly context = inject(COMBOBOX_CONTEXT);
|
|
28
|
-
|
|
29
22
|
/** Additional CSS classes */
|
|
30
23
|
readonly class = input<string>('');
|
|
31
24
|
|
|
32
|
-
protected readonly
|
|
33
|
-
|
|
34
|
-
);
|
|
25
|
+
protected readonly context = inject(COMBOBOX_CONTEXT);
|
|
26
|
+
|
|
27
|
+
protected readonly computedClass = computed(() => cn('py-6 text-center text-sm', this.class()));
|
|
35
28
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* ComboboxGroup component - groups combobox items with proper accessibility.
|
|
@@ -13,6 +8,7 @@ import {
|
|
|
13
8
|
selector: 'ComboboxGroup',
|
|
14
9
|
template: `<ng-content />`,
|
|
15
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"combobox-group"',
|
|
16
12
|
'[class]': 'computedClass()',
|
|
17
13
|
role: 'group',
|
|
18
14
|
'[attr.aria-label]': 'label()',
|
|
@@ -27,6 +23,6 @@ export class ComboboxGroup {
|
|
|
27
23
|
readonly class = input<string>('');
|
|
28
24
|
|
|
29
25
|
protected readonly computedClass = computed(() =>
|
|
30
|
-
cn('overflow-hidden p-1 overflow-y-auto', this.class())
|
|
26
|
+
cn('overflow-hidden p-1 overflow-y-auto', this.class()),
|
|
31
27
|
);
|
|
32
28
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
effect,
|
|
7
|
+
ElementRef,
|
|
8
|
+
inject,
|
|
9
|
+
input,
|
|
10
|
+
viewChild,
|
|
11
11
|
} from '@angular/core';
|
|
12
12
|
import { LucideAngularModule, Search } from 'lucide-angular';
|
|
13
13
|
import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
@@ -40,13 +40,22 @@ import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
|
40
40
|
/>
|
|
41
41
|
`,
|
|
42
42
|
host: {
|
|
43
|
+
'attr.data-slot': '"combobox-input"',
|
|
43
44
|
'[class]': 'computedClass()',
|
|
44
45
|
},
|
|
45
46
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
46
47
|
})
|
|
47
48
|
export class ComboboxInput {
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
constructor() {
|
|
50
|
+
// Auto-focus input when combobox opens
|
|
51
|
+
effect(() => {
|
|
52
|
+
if (this.context.open()) {
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
this.searchInput()?.nativeElement?.focus();
|
|
55
|
+
}, 0);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
50
59
|
|
|
51
60
|
private readonly searchInput = viewChild<ElementRef<HTMLInputElement>>('searchInput');
|
|
52
61
|
|
|
@@ -56,32 +65,23 @@ export class ComboboxInput {
|
|
|
56
65
|
/** Additional CSS classes */
|
|
57
66
|
readonly class = input<string>('');
|
|
58
67
|
|
|
68
|
+
protected readonly context = inject(COMBOBOX_CONTEXT);
|
|
69
|
+
|
|
59
70
|
protected readonly computedClass = computed(() =>
|
|
60
|
-
cn('flex items-center border-b px-3', this.class())
|
|
71
|
+
cn('flex items-center border-b px-3', this.class()),
|
|
61
72
|
);
|
|
62
|
-
|
|
63
73
|
protected readonly inputClass = computed(() =>
|
|
64
74
|
cn(
|
|
65
|
-
'flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50'
|
|
66
|
-
)
|
|
75
|
+
'flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
|
|
76
|
+
),
|
|
67
77
|
);
|
|
68
78
|
|
|
69
|
-
|
|
70
|
-
// Auto-focus input when combobox opens
|
|
71
|
-
effect(() => {
|
|
72
|
-
if (this.context.open()) {
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
this.searchInput()?.nativeElement?.focus();
|
|
75
|
-
}, 0);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
+
protected readonly SearchIcon = Search;
|
|
79
80
|
|
|
80
81
|
protected onInput(event: Event): void {
|
|
81
82
|
const target = event.target as HTMLInputElement;
|
|
82
83
|
this.context.onSearch(target.value);
|
|
83
84
|
}
|
|
84
|
-
|
|
85
85
|
protected onKeyDown(event: KeyboardEvent): void {
|
|
86
86
|
// Pass keyboard events to the main handler for navigation
|
|
87
87
|
this.context.onKeyDown(event);
|
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
effect,
|
|
7
|
+
ElementRef,
|
|
8
|
+
inject,
|
|
9
|
+
input,
|
|
10
|
+
viewChild,
|
|
11
11
|
} from '@angular/core';
|
|
12
12
|
import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
13
13
|
|
|
14
|
+
import { LucideAngularModule } from 'lucide-angular';
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* ComboboxItem component - individual option in the combobox.
|
|
16
18
|
* Implements WAI-ARIA option pattern with keyboard navigation support.
|
|
17
19
|
*/
|
|
18
20
|
@Component({
|
|
19
21
|
selector: 'ComboboxItem',
|
|
22
|
+
imports: [LucideAngularModule],
|
|
20
23
|
template: `
|
|
21
24
|
<div #itemElement [class]="innerClass()">
|
|
25
|
+
@if (option()?.icon && iconPosition() === 'left') {
|
|
26
|
+
<lucide-icon [img]="option()?.icon" class="h-4 w-4 shrink" />
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
<ng-content />
|
|
30
|
+
|
|
22
31
|
<svg
|
|
23
32
|
[class]="checkClass()"
|
|
24
33
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -34,10 +43,14 @@ import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
|
34
43
|
>
|
|
35
44
|
<path d="M20 6 9 17l-5-5" />
|
|
36
45
|
</svg>
|
|
37
|
-
|
|
46
|
+
|
|
47
|
+
@if (option()?.icon && iconPosition() === 'right') {
|
|
48
|
+
<lucide-icon [img]="option()?.icon" class="h-4 w-4 shrink ms-auto" />
|
|
49
|
+
}
|
|
38
50
|
</div>
|
|
39
51
|
`,
|
|
40
52
|
host: {
|
|
53
|
+
'attr.data-slot': '"combobox-item"',
|
|
41
54
|
'[class]': 'computedClass()',
|
|
42
55
|
'[id]': 'optionId()',
|
|
43
56
|
role: 'option',
|
|
@@ -52,7 +65,16 @@ import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
|
52
65
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
53
66
|
})
|
|
54
67
|
export class ComboboxItem {
|
|
55
|
-
|
|
68
|
+
constructor() {
|
|
69
|
+
effect(() => {
|
|
70
|
+
if (this.isHighlighted()) {
|
|
71
|
+
this.itemElement()?.nativeElement?.scrollIntoView({
|
|
72
|
+
block: 'nearest',
|
|
73
|
+
behavior: 'smooth',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
56
78
|
|
|
57
79
|
private readonly itemElement = viewChild<ElementRef<HTMLDivElement>>('itemElement');
|
|
58
80
|
|
|
@@ -61,66 +83,45 @@ export class ComboboxItem {
|
|
|
61
83
|
|
|
62
84
|
/** Index of this item in the filtered list */
|
|
63
85
|
readonly index = input<number>(0);
|
|
64
|
-
|
|
65
86
|
/** Whether this item is disabled */
|
|
66
87
|
readonly disabled = input<boolean>(false);
|
|
67
88
|
|
|
68
89
|
/** Additional CSS classes */
|
|
69
90
|
readonly class = input<string>('');
|
|
70
91
|
|
|
71
|
-
protected readonly
|
|
72
|
-
this.context.getOptionId(this.index())
|
|
73
|
-
);
|
|
92
|
+
protected readonly context = inject(COMBOBOX_CONTEXT);
|
|
74
93
|
|
|
75
|
-
|
|
76
|
-
|
|
94
|
+
readonly iconPosition = computed(() => this.context.iconPosition());
|
|
95
|
+
protected readonly option = computed(() =>
|
|
96
|
+
this.context.options().find((o) => o.value === this.value()),
|
|
77
97
|
);
|
|
78
|
-
|
|
98
|
+
protected readonly optionId = computed(() => this.context.getOptionId(this.index()));
|
|
99
|
+
protected readonly isSelected = computed(() => this.context.value() === this.value());
|
|
79
100
|
protected readonly isHighlighted = computed(
|
|
80
|
-
() => this.context.highlightedIndex() === this.index()
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
protected readonly computedClass = computed(() =>
|
|
84
|
-
cn('contents', this.class())
|
|
101
|
+
() => this.context.highlightedIndex() === this.index(),
|
|
85
102
|
);
|
|
86
|
-
|
|
103
|
+
protected readonly computedClass = computed(() => cn('contents', this.class()));
|
|
87
104
|
protected readonly innerClass = computed(() =>
|
|
88
105
|
cn(
|
|
89
|
-
'relative flex w-full cursor-default select-none items-center rounded-sm py-
|
|
106
|
+
'relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2.5 pr-8 text-sm outline-none',
|
|
90
107
|
'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
91
108
|
'data-[selected]:bg-accent data-[selected]:text-accent-foreground',
|
|
92
109
|
'data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground',
|
|
93
110
|
'hover:bg-accent hover:text-accent-foreground',
|
|
94
111
|
this.isSelected() && 'bg-accent text-accent-foreground',
|
|
95
|
-
this.isHighlighted() && 'bg-accent text-accent-foreground'
|
|
96
|
-
)
|
|
112
|
+
this.isHighlighted() && 'bg-accent text-accent-foreground',
|
|
113
|
+
),
|
|
97
114
|
);
|
|
98
|
-
|
|
99
115
|
protected readonly checkClass = computed(() =>
|
|
100
|
-
cn(
|
|
101
|
-
'absolute right-2 h-4 w-4',
|
|
102
|
-
this.isSelected() ? 'opacity-100' : 'opacity-0'
|
|
103
|
-
)
|
|
116
|
+
cn('absolute right-2 h-4 w-4', this.isSelected() ? 'opacity-100' : 'opacity-0'),
|
|
104
117
|
);
|
|
105
118
|
|
|
106
|
-
constructor() {
|
|
107
|
-
// Scroll into view when highlighted
|
|
108
|
-
effect(() => {
|
|
109
|
-
if (this.isHighlighted()) {
|
|
110
|
-
this.itemElement()?.nativeElement?.scrollIntoView({
|
|
111
|
-
block: 'nearest',
|
|
112
|
-
behavior: 'smooth',
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
119
|
protected onSelect(): void {
|
|
120
|
+
// console.log('Selecting value:', this.value());
|
|
119
121
|
if (!this.disabled()) {
|
|
120
122
|
this.context.onSelect(this.value());
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
|
-
|
|
124
125
|
protected onMouseEnter(): void {
|
|
125
126
|
if (!this.disabled()) {
|
|
126
127
|
this.context.highlightedIndex.set(this.index());
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
inject
|
|
5
|
-
} from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
|
6
2
|
import { COMBOBOX_CONTEXT } from './combobox-context';
|
|
7
3
|
import { ComboboxItem } from './combobox-item.component';
|
|
8
4
|
|
|
@@ -23,15 +19,21 @@ import { ComboboxItem } from './combobox-item.component';
|
|
|
23
19
|
selector: 'ComboboxList',
|
|
24
20
|
imports: [ComboboxItem],
|
|
25
21
|
template: `
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
<div class="max-h-60 flex flex-col scroll-py-2 overflow-y-auto px-1 py-1">
|
|
23
|
+
@if (context.filteredOptions().length === 0) {
|
|
24
|
+
<ng-content />
|
|
25
|
+
} @else {
|
|
26
|
+
@for (option of context.filteredOptions(); track option.value; let i = $index) {
|
|
27
|
+
<ComboboxItem [value]="option.value" [index]="i" [disabled]="option.disabled ?? false">
|
|
28
|
+
{{ option.label }}
|
|
29
|
+
</ComboboxItem>
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</div>
|
|
31
33
|
`,
|
|
32
34
|
host: {
|
|
33
|
-
|
|
34
|
-
'data-slot': 'combobox-list',
|
|
35
|
+
class: 'contents',
|
|
36
|
+
'attr.data-slot': '"combobox-list"',
|
|
35
37
|
},
|
|
36
38
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
37
39
|
})
|