@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,5 +1,13 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
model,
|
|
9
|
+
output,
|
|
10
|
+
} from '@angular/core';
|
|
3
11
|
import { Check, LucideAngularModule } from 'lucide-angular';
|
|
4
12
|
import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
5
13
|
|
|
@@ -19,6 +27,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
19
27
|
<ng-content />
|
|
20
28
|
`,
|
|
21
29
|
host: {
|
|
30
|
+
'attr.data-slot': '"dropdown-menu-checkbox-item"',
|
|
22
31
|
'[class]': 'computedClass()',
|
|
23
32
|
'[attr.role]': '"menuitemcheckbox"',
|
|
24
33
|
'[attr.aria-checked]': 'checked()',
|
|
@@ -33,29 +42,29 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
33
42
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
34
43
|
})
|
|
35
44
|
export class DropdownMenuCheckboxItem {
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
/** Select event emitted when item is clicked */
|
|
46
|
+
readonly onCheckedChange = output<boolean>();
|
|
38
47
|
|
|
39
48
|
/** Whether the checkbox is checked */
|
|
40
49
|
readonly checked = model<boolean>(false);
|
|
41
50
|
|
|
42
|
-
/** Whether the item is disabled */
|
|
43
|
-
readonly disabled = input<boolean>(false);
|
|
44
|
-
|
|
45
51
|
/** Additional CSS classes */
|
|
46
52
|
readonly class = input<string>('');
|
|
53
|
+
/** Whether the item is disabled */
|
|
54
|
+
readonly disabled = input<boolean>(false);
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
readonly onCheckedChange = output<boolean>();
|
|
56
|
+
private readonly _context = inject(DROPDOWN_MENU_CONTEXT);
|
|
50
57
|
|
|
51
58
|
protected readonly computedClass = computed(() =>
|
|
52
59
|
cn(
|
|
53
|
-
|
|
60
|
+
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
54
61
|
!this.disabled() && 'cursor-pointer hover:bg-accent hover:text-accent-foreground',
|
|
55
|
-
this.class()
|
|
56
|
-
)
|
|
62
|
+
this.class(),
|
|
63
|
+
),
|
|
57
64
|
);
|
|
58
65
|
|
|
66
|
+
protected readonly CheckIcon = Check;
|
|
67
|
+
|
|
59
68
|
protected handleClick(event: Event): void {
|
|
60
69
|
if (this.disabled()) {
|
|
61
70
|
event.preventDefault();
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { cn, Presence } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
afterNextRender,
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
Component,
|
|
6
|
+
computed,
|
|
7
|
+
effect,
|
|
8
|
+
ElementRef,
|
|
9
|
+
inject,
|
|
10
|
+
input,
|
|
11
|
+
OnDestroy,
|
|
12
|
+
signal,
|
|
12
13
|
} from '@angular/core';
|
|
13
14
|
import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
14
15
|
|
|
@@ -25,6 +26,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
25
26
|
<Presence [present]="context.open()">
|
|
26
27
|
<div
|
|
27
28
|
[class]="computedClass()"
|
|
29
|
+
[style]="fixedStyle()"
|
|
28
30
|
[attr.id]="context.contentId"
|
|
29
31
|
[attr.aria-labelledby]="null"
|
|
30
32
|
[attr.data-state]="context.open() ? 'open' : 'closed'"
|
|
@@ -40,6 +42,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
40
42
|
</Presence>
|
|
41
43
|
`,
|
|
42
44
|
host: {
|
|
45
|
+
'attr.data-slot': '"dropdown-menu-content"',
|
|
43
46
|
class: 'contents',
|
|
44
47
|
'(document:click)': 'onDocumentClick($event)',
|
|
45
48
|
'(document:keydown.escape)': 'onEscapeKey()',
|
|
@@ -47,26 +50,81 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
47
50
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
48
51
|
})
|
|
49
52
|
export class DropdownMenuContent implements OnDestroy {
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
constructor() {
|
|
54
|
+
// Focus first item when menu opens; compute fixed position if needed
|
|
55
|
+
effect(() => {
|
|
56
|
+
if (this.context.open()) {
|
|
57
|
+
if (this.strategy() === 'fixed') {
|
|
58
|
+
const trigger = this.context.triggerElement();
|
|
59
|
+
if (trigger) {
|
|
60
|
+
const rect = trigger.getBoundingClientRect();
|
|
61
|
+
const side = this.side();
|
|
62
|
+
const offset = this.sideOffset();
|
|
63
|
+
let top = rect.top;
|
|
64
|
+
let left = rect.left;
|
|
65
|
+
|
|
66
|
+
if (side === 'bottom') {
|
|
67
|
+
top = rect.bottom + offset;
|
|
68
|
+
left = rect.left;
|
|
69
|
+
} else if (side === 'top') {
|
|
70
|
+
top = rect.top - offset;
|
|
71
|
+
left = rect.left;
|
|
72
|
+
} else if (side === 'right') {
|
|
73
|
+
top = rect.top;
|
|
74
|
+
left = rect.right + offset;
|
|
75
|
+
} else if (side === 'left') {
|
|
76
|
+
top = rect.top;
|
|
77
|
+
left = rect.left - offset;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.fixedPos.set({ top, left });
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
this.fixedPos.set(null);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
this.updateMenuItems();
|
|
88
|
+
const focusedIdx = this.context.focusedIndex();
|
|
89
|
+
if (focusedIdx >= 0 && this.menuItems[focusedIdx]) {
|
|
90
|
+
this.menuItems[focusedIdx].focus();
|
|
91
|
+
} else if (this.menuItems.length > 0) {
|
|
92
|
+
this.menuItems[0].focus();
|
|
93
|
+
this.context.focusedIndex.set(0);
|
|
94
|
+
}
|
|
95
|
+
}, 0);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Initial menu items update (browser-only)
|
|
100
|
+
afterNextRender(() => {
|
|
101
|
+
this.updateMenuItems();
|
|
102
|
+
});
|
|
103
|
+
}
|
|
52
104
|
|
|
53
105
|
/** Side of the trigger to place content */
|
|
54
106
|
readonly side = input<'top' | 'right' | 'bottom' | 'left'>('bottom');
|
|
55
|
-
|
|
56
107
|
/** Alignment of the content */
|
|
57
108
|
readonly align = input<'start' | 'center' | 'end'>('start');
|
|
58
|
-
|
|
59
109
|
/** Side offset */
|
|
60
110
|
readonly sideOffset = input<number>(4);
|
|
61
|
-
|
|
62
111
|
/** Additional CSS classes */
|
|
63
112
|
readonly class = input<string>('');
|
|
113
|
+
/** Positioning strategy: 'absolute' stays within parent, 'fixed' escapes overflow containers */
|
|
114
|
+
readonly strategy = input<'absolute' | 'fixed'>('absolute');
|
|
64
115
|
|
|
65
|
-
private
|
|
66
|
-
private typeaheadBuffer = '';
|
|
67
|
-
private typeaheadTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
116
|
+
private readonly _elementRef = inject(ElementRef);
|
|
68
117
|
|
|
118
|
+
protected readonly context = inject(DROPDOWN_MENU_CONTEXT);
|
|
119
|
+
|
|
120
|
+
protected readonly fixedStyle = computed(() => {
|
|
121
|
+
const pos = this.fixedPos();
|
|
122
|
+
if (this.strategy() !== 'fixed' || !pos) return '';
|
|
123
|
+
return `top: ${pos.top}px; left: ${pos.left}px;`;
|
|
124
|
+
});
|
|
69
125
|
protected readonly computedClass = computed(() => {
|
|
126
|
+
const isFixed = this.strategy() === 'fixed';
|
|
127
|
+
|
|
70
128
|
const sideClasses = {
|
|
71
129
|
top: 'bottom-full mb-1',
|
|
72
130
|
bottom: 'top-full mt-1',
|
|
@@ -81,36 +139,20 @@ export class DropdownMenuContent implements OnDestroy {
|
|
|
81
139
|
};
|
|
82
140
|
|
|
83
141
|
return cn(
|
|
84
|
-
|
|
142
|
+
isFixed ? 'fixed' : 'absolute',
|
|
143
|
+
'z-50 min-w-[12rem] overflow-hidden rounded-xl border bg-popover p-2 text-popover-foreground shadow-lg',
|
|
85
144
|
'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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
86
|
-
sideClasses[this.side()],
|
|
87
|
-
alignClasses[this.align()],
|
|
88
|
-
this.class()
|
|
145
|
+
!isFixed && sideClasses[this.side()],
|
|
146
|
+
!isFixed && alignClasses[this.align()],
|
|
147
|
+
this.class(),
|
|
89
148
|
);
|
|
90
149
|
});
|
|
91
150
|
|
|
92
|
-
|
|
93
|
-
// Focus first item when menu opens
|
|
94
|
-
effect(() => {
|
|
95
|
-
if (this.context.open()) {
|
|
96
|
-
setTimeout(() => {
|
|
97
|
-
this.updateMenuItems();
|
|
98
|
-
const focusedIdx = this.context.focusedIndex();
|
|
99
|
-
if (focusedIdx >= 0 && this.menuItems[focusedIdx]) {
|
|
100
|
-
this.menuItems[focusedIdx].focus();
|
|
101
|
-
} else if (this.menuItems.length > 0) {
|
|
102
|
-
this.menuItems[0].focus();
|
|
103
|
-
this.context.focusedIndex.set(0);
|
|
104
|
-
}
|
|
105
|
-
}, 0);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
151
|
+
protected readonly fixedPos = signal<{ top: number; left: number } | null>(null);
|
|
108
152
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
}
|
|
153
|
+
private menuItems: HTMLElement[] = [];
|
|
154
|
+
private typeaheadBuffer = '';
|
|
155
|
+
private typeaheadTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
114
156
|
|
|
115
157
|
ngOnDestroy(): void {
|
|
116
158
|
if (this.typeaheadTimeout) {
|
|
@@ -118,15 +160,6 @@ export class DropdownMenuContent implements OnDestroy {
|
|
|
118
160
|
}
|
|
119
161
|
}
|
|
120
162
|
|
|
121
|
-
private updateMenuItems(): void {
|
|
122
|
-
const content = this.elementRef.nativeElement.querySelector('[role="menu"]');
|
|
123
|
-
if (content) {
|
|
124
|
-
this.menuItems = Array.from(
|
|
125
|
-
content.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled])')
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
163
|
onKeydown(event: KeyboardEvent): void {
|
|
131
164
|
this.updateMenuItems();
|
|
132
165
|
|
|
@@ -160,33 +193,38 @@ export class DropdownMenuContent implements OnDestroy {
|
|
|
160
193
|
}
|
|
161
194
|
}
|
|
162
195
|
|
|
196
|
+
private updateMenuItems(): void {
|
|
197
|
+
const content = this._elementRef.nativeElement.querySelector('[role="menu"]');
|
|
198
|
+
if (content) {
|
|
199
|
+
this.menuItems = Array.from(
|
|
200
|
+
content.querySelectorAll(
|
|
201
|
+
'[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled])',
|
|
202
|
+
),
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
163
206
|
private focusNext(): void {
|
|
164
207
|
const currentIndex = this.context.focusedIndex();
|
|
165
208
|
const nextIndex = currentIndex < this.menuItems.length - 1 ? currentIndex + 1 : 0;
|
|
166
209
|
this.focusItem(nextIndex);
|
|
167
210
|
}
|
|
168
|
-
|
|
169
211
|
private focusPrevious(): void {
|
|
170
212
|
const currentIndex = this.context.focusedIndex();
|
|
171
213
|
const prevIndex = currentIndex > 0 ? currentIndex - 1 : this.menuItems.length - 1;
|
|
172
214
|
this.focusItem(prevIndex);
|
|
173
215
|
}
|
|
174
|
-
|
|
175
216
|
private focusFirst(): void {
|
|
176
217
|
this.focusItem(0);
|
|
177
218
|
}
|
|
178
|
-
|
|
179
219
|
private focusLast(): void {
|
|
180
220
|
this.focusItem(this.menuItems.length - 1);
|
|
181
221
|
}
|
|
182
|
-
|
|
183
222
|
private focusItem(index: number): void {
|
|
184
223
|
if (index >= 0 && index < this.menuItems.length) {
|
|
185
224
|
this.menuItems[index].focus();
|
|
186
225
|
this.context.focusedIndex.set(index);
|
|
187
226
|
}
|
|
188
227
|
}
|
|
189
|
-
|
|
190
228
|
private handleTypeahead(key: string): void {
|
|
191
229
|
this.typeaheadBuffer += key.toLowerCase();
|
|
192
230
|
|
|
@@ -200,28 +238,25 @@ export class DropdownMenuContent implements OnDestroy {
|
|
|
200
238
|
|
|
201
239
|
// Find first matching item
|
|
202
240
|
const matchIndex = this.menuItems.findIndex((item) =>
|
|
203
|
-
item.textContent?.toLowerCase().trim().startsWith(this.typeaheadBuffer)
|
|
241
|
+
item.textContent?.toLowerCase().trim().startsWith(this.typeaheadBuffer),
|
|
204
242
|
);
|
|
205
243
|
|
|
206
244
|
if (matchIndex >= 0) {
|
|
207
245
|
this.focusItem(matchIndex);
|
|
208
246
|
}
|
|
209
247
|
}
|
|
210
|
-
|
|
211
248
|
protected onDocumentClick(event: MouseEvent): void {
|
|
212
249
|
const target = event.target as HTMLElement;
|
|
213
|
-
const hostElement = this.
|
|
250
|
+
const hostElement = this._elementRef.nativeElement;
|
|
214
251
|
const parent = hostElement.closest('DropdownMenu');
|
|
215
252
|
|
|
216
253
|
if (parent && !parent.contains(target)) {
|
|
217
254
|
this.close();
|
|
218
255
|
}
|
|
219
256
|
}
|
|
220
|
-
|
|
221
257
|
protected onEscapeKey(): void {
|
|
222
258
|
this.close();
|
|
223
259
|
}
|
|
224
|
-
|
|
225
260
|
private close(): void {
|
|
226
261
|
this.context.open.set(false);
|
|
227
262
|
this.context.focusedIndex.set(-1);
|
|
@@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
|
8
8
|
selector: 'DropdownMenuGroup',
|
|
9
9
|
template: `<ng-content />`,
|
|
10
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"dropdown-menu-group"',
|
|
11
12
|
'[attr.role]': '"group"',
|
|
12
13
|
},
|
|
13
14
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -10,6 +10,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
10
10
|
selector: 'DropdownMenuItem',
|
|
11
11
|
template: `<ng-content />`,
|
|
12
12
|
host: {
|
|
13
|
+
'attr.data-slot': '"dropdown-menu-item"',
|
|
13
14
|
'[class]': 'computedClass()',
|
|
14
15
|
'[attr.role]': '"menuitem"',
|
|
15
16
|
'[attr.tabindex]': 'disabled() ? -1 : 0',
|
|
@@ -22,27 +23,25 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
22
23
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
23
24
|
})
|
|
24
25
|
export class DropdownMenuItem {
|
|
25
|
-
|
|
26
|
+
/** Select event emitted when item is clicked */
|
|
27
|
+
readonly onSelect = output<void>();
|
|
26
28
|
|
|
29
|
+
/** Additional CSS classes */
|
|
30
|
+
readonly class = input<string>('');
|
|
27
31
|
/** Whether the item is disabled */
|
|
28
32
|
readonly disabled = input<boolean>(false);
|
|
29
|
-
|
|
30
33
|
/** Whether the item is inset (extra padding) */
|
|
31
34
|
readonly inset = input<boolean>(false);
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
readonly class = input<string>('');
|
|
35
|
-
|
|
36
|
-
/** Select event emitted when item is clicked */
|
|
37
|
-
readonly onSelect = output<void>();
|
|
36
|
+
private readonly _context = inject(DROPDOWN_MENU_CONTEXT);
|
|
38
37
|
|
|
39
38
|
protected readonly computedClass = computed(() =>
|
|
40
39
|
cn(
|
|
41
|
-
|
|
40
|
+
'relative flex cursor-default select-none items-center gap-3 rounded-md px-3 py-2.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0 [&>lucide-icon]:size-4 [&>lucide-icon]:shrink-0 [&>lucide-icon]:text-muted-foreground',
|
|
42
41
|
this.inset() && 'pl-8',
|
|
43
42
|
!this.disabled() && 'cursor-pointer hover:bg-accent hover:text-accent-foreground',
|
|
44
|
-
this.class()
|
|
45
|
-
)
|
|
43
|
+
this.class(),
|
|
44
|
+
),
|
|
46
45
|
);
|
|
47
46
|
|
|
48
47
|
protected handleClick(event: Event): void {
|
|
@@ -51,6 +50,6 @@ export class DropdownMenuItem {
|
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
52
|
this.onSelect.emit();
|
|
54
|
-
this.
|
|
53
|
+
this._context.open.set(false);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DropdownMenuLabel',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dropdown-menu-label"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -21,10 +22,6 @@ export class DropdownMenuLabel {
|
|
|
21
22
|
readonly class = input<string>('');
|
|
22
23
|
|
|
23
24
|
protected readonly computedClass = computed(() =>
|
|
24
|
-
cn(
|
|
25
|
-
'px-3 py-2 text-sm font-semibold',
|
|
26
|
-
this.inset() && 'pl-8',
|
|
27
|
-
this.class()
|
|
28
|
-
)
|
|
25
|
+
cn('px-3 py-2 text-sm font-semibold', this.inset() && 'pl-8', this.class()),
|
|
29
26
|
);
|
|
30
27
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
InjectionToken,
|
|
5
|
+
model,
|
|
6
|
+
output,
|
|
7
|
+
signal,
|
|
8
|
+
type WritableSignal,
|
|
9
|
+
} from '@angular/core';
|
|
2
10
|
|
|
3
11
|
export interface DropdownMenuRadioGroupContext {
|
|
4
12
|
value: WritableSignal<string>;
|
|
@@ -6,7 +14,7 @@ export interface DropdownMenuRadioGroupContext {
|
|
|
6
14
|
}
|
|
7
15
|
|
|
8
16
|
export const DROPDOWN_MENU_RADIO_GROUP_CONTEXT = new InjectionToken<DropdownMenuRadioGroupContext>(
|
|
9
|
-
'DROPDOWN_MENU_RADIO_GROUP_CONTEXT'
|
|
17
|
+
'DROPDOWN_MENU_RADIO_GROUP_CONTEXT',
|
|
10
18
|
);
|
|
11
19
|
|
|
12
20
|
/**
|
|
@@ -29,14 +37,15 @@ export const DROPDOWN_MENU_RADIO_GROUP_CONTEXT = new InjectionToken<DropdownMenu
|
|
|
29
37
|
},
|
|
30
38
|
],
|
|
31
39
|
host: {
|
|
40
|
+
'attr.data-slot': '"dropdown-menu-radio-group"',
|
|
32
41
|
'[attr.role]': '"group"',
|
|
33
42
|
},
|
|
34
43
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
44
|
})
|
|
36
45
|
export class DropdownMenuRadioGroup {
|
|
37
|
-
/** The current value */
|
|
38
|
-
readonly value = model<string>('');
|
|
39
|
-
|
|
40
46
|
/** Value change event */
|
|
41
47
|
readonly onValueChange = output<string>();
|
|
48
|
+
|
|
49
|
+
/** The current value */
|
|
50
|
+
readonly value = model<string>('');
|
|
42
51
|
}
|
|
@@ -20,6 +20,7 @@ import { DROPDOWN_MENU_RADIO_GROUP_CONTEXT } from './dropdown-menu-radio-group.c
|
|
|
20
20
|
<ng-content />
|
|
21
21
|
`,
|
|
22
22
|
host: {
|
|
23
|
+
'attr.data-slot': '"dropdown-menu-radio-item"',
|
|
23
24
|
'[class]': 'computedClass()',
|
|
24
25
|
'[attr.role]': '"menuitemradio"',
|
|
25
26
|
'[attr.aria-checked]': 'isSelected()',
|
|
@@ -34,38 +35,37 @@ import { DROPDOWN_MENU_RADIO_GROUP_CONTEXT } from './dropdown-menu-radio-group.c
|
|
|
34
35
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
36
|
})
|
|
36
37
|
export class DropdownMenuRadioItem {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
protected readonly CircleIcon = Circle;
|
|
38
|
+
/** Select event emitted when item is clicked */
|
|
39
|
+
readonly onSelect = output<void>();
|
|
40
40
|
|
|
41
41
|
/** The value of this radio item */
|
|
42
42
|
readonly value = input.required<string>();
|
|
43
43
|
|
|
44
|
-
/** Whether the item is disabled */
|
|
45
|
-
readonly disabled = input<boolean>(false);
|
|
46
|
-
|
|
47
44
|
/** Additional CSS classes */
|
|
48
45
|
readonly class = input<string>('');
|
|
46
|
+
/** Whether the item is disabled */
|
|
47
|
+
readonly disabled = input<boolean>(false);
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
readonly
|
|
52
|
-
|
|
53
|
-
protected readonly isSelected = computed(() => this.radioGroupContext.value() === this.value());
|
|
49
|
+
private readonly _context = inject(DROPDOWN_MENU_CONTEXT);
|
|
50
|
+
private readonly _radioGroupContext = inject(DROPDOWN_MENU_RADIO_GROUP_CONTEXT);
|
|
54
51
|
|
|
52
|
+
protected readonly isSelected = computed(() => this._radioGroupContext.value() === this.value());
|
|
55
53
|
protected readonly computedClass = computed(() =>
|
|
56
54
|
cn(
|
|
57
|
-
|
|
55
|
+
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
58
56
|
!this.disabled() && 'cursor-pointer hover:bg-accent hover:text-accent-foreground',
|
|
59
|
-
this.class()
|
|
60
|
-
)
|
|
57
|
+
this.class(),
|
|
58
|
+
),
|
|
61
59
|
);
|
|
62
60
|
|
|
61
|
+
protected readonly CircleIcon = Circle;
|
|
62
|
+
|
|
63
63
|
protected handleClick(event: Event): void {
|
|
64
64
|
if (this.disabled()) {
|
|
65
65
|
event.preventDefault();
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
this.
|
|
68
|
+
this._radioGroupContext.setValue(this.value());
|
|
69
69
|
this.onSelect.emit();
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DropdownMenuSeparator',
|
|
10
10
|
template: ``,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dropdown-menu-separator"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
'[attr.role]': '"separator"',
|
|
14
15
|
},
|
|
@@ -18,7 +19,5 @@ export class DropdownMenuSeparator {
|
|
|
18
19
|
/** Additional CSS classes */
|
|
19
20
|
readonly class = input<string>('');
|
|
20
21
|
|
|
21
|
-
protected readonly computedClass = computed(() =>
|
|
22
|
-
cn('-mx-2 my-2 h-px bg-border', this.class())
|
|
23
|
-
);
|
|
22
|
+
protected readonly computedClass = computed(() => cn('-mx-2 my-2 h-px bg-border', this.class()));
|
|
24
23
|
}
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DropdownMenuShortcut',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dropdown-menu-shortcut"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -18,6 +19,6 @@ export class DropdownMenuShortcut {
|
|
|
18
19
|
readonly class = input<string>('');
|
|
19
20
|
|
|
20
21
|
protected readonly computedClass = computed(() =>
|
|
21
|
-
cn('ml-auto text-xs tracking-widest opacity-60', this.class())
|
|
22
|
+
cn('ml-auto text-xs tracking-widest opacity-60', this.class()),
|
|
22
23
|
);
|
|
23
24
|
}
|
|
@@ -21,6 +21,7 @@ import { DROPDOWN_MENU_SUB_CONTEXT } from './dropdown-menu-sub.component';
|
|
|
21
21
|
</Presence>
|
|
22
22
|
`,
|
|
23
23
|
host: {
|
|
24
|
+
'attr.data-slot': '"dropdown-menu-sub-content"',
|
|
24
25
|
class: 'contents',
|
|
25
26
|
'(mouseenter)': 'onMouseEnter()',
|
|
26
27
|
'(mouseleave)': 'onMouseLeave()',
|
|
@@ -28,23 +29,22 @@ import { DROPDOWN_MENU_SUB_CONTEXT } from './dropdown-menu-sub.component';
|
|
|
28
29
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
30
|
})
|
|
30
31
|
export class DropdownMenuSubContent {
|
|
31
|
-
protected readonly subContext = inject(DROPDOWN_MENU_SUB_CONTEXT);
|
|
32
|
-
|
|
33
32
|
/** Additional CSS classes */
|
|
34
33
|
readonly class = input<string>('');
|
|
35
34
|
|
|
35
|
+
protected readonly subContext = inject(DROPDOWN_MENU_SUB_CONTEXT);
|
|
36
|
+
|
|
36
37
|
protected readonly computedClass = computed(() =>
|
|
37
38
|
cn(
|
|
38
39
|
'absolute left-full top-0 z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg',
|
|
39
40
|
'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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
40
|
-
this.class()
|
|
41
|
-
)
|
|
41
|
+
this.class(),
|
|
42
|
+
),
|
|
42
43
|
);
|
|
43
44
|
|
|
44
45
|
protected onMouseEnter(): void {
|
|
45
46
|
this.subContext.open.set(true);
|
|
46
47
|
}
|
|
47
|
-
|
|
48
48
|
protected onMouseLeave(): void {
|
|
49
49
|
this.subContext.open.set(false);
|
|
50
50
|
}
|
|
@@ -15,6 +15,7 @@ import { DROPDOWN_MENU_SUB_CONTEXT } from './dropdown-menu-sub.component';
|
|
|
15
15
|
<lucide-icon [img]="ChevronRightIcon" class="ml-auto h-4 w-4" />
|
|
16
16
|
`,
|
|
17
17
|
host: {
|
|
18
|
+
'attr.data-slot': '"dropdown-menu-sub-trigger"',
|
|
18
19
|
'[class]': 'computedClass()',
|
|
19
20
|
'(mouseenter)': 'onMouseEnter()',
|
|
20
21
|
'(mouseleave)': 'onMouseLeave()',
|
|
@@ -23,27 +24,27 @@ import { DROPDOWN_MENU_SUB_CONTEXT } from './dropdown-menu-sub.component';
|
|
|
23
24
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
25
|
})
|
|
25
26
|
export class DropdownMenuSubTrigger {
|
|
26
|
-
protected readonly subContext = inject(DROPDOWN_MENU_SUB_CONTEXT);
|
|
27
|
-
protected readonly ChevronRightIcon = ChevronRight;
|
|
28
|
-
|
|
29
27
|
/** Whether the trigger is inset (extra padding) */
|
|
30
28
|
readonly inset = input<boolean>(false);
|
|
31
29
|
|
|
32
30
|
/** Additional CSS classes */
|
|
33
31
|
readonly class = input<string>('');
|
|
34
32
|
|
|
33
|
+
protected readonly subContext = inject(DROPDOWN_MENU_SUB_CONTEXT);
|
|
34
|
+
|
|
35
35
|
protected readonly computedClass = computed(() =>
|
|
36
36
|
cn(
|
|
37
|
-
'flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&>svg]:size-4 [&>svg]:shrink-0',
|
|
37
|
+
'flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&>svg]:size-4 [&>svg]:shrink-0 [&>lucide-icon]:size-4 [&>lucide-icon]:shrink-0',
|
|
38
38
|
this.inset() && 'pl-8',
|
|
39
|
-
this.class()
|
|
40
|
-
)
|
|
39
|
+
this.class(),
|
|
40
|
+
),
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
+
protected readonly ChevronRightIcon = ChevronRight;
|
|
44
|
+
|
|
43
45
|
protected onMouseEnter(): void {
|
|
44
46
|
this.subContext.open.set(true);
|
|
45
47
|
}
|
|
46
|
-
|
|
47
48
|
protected onMouseLeave(): void {
|
|
48
49
|
// Delay closing to allow mouse to move to sub-content
|
|
49
50
|
setTimeout(() => {
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
InjectionToken,
|
|
5
|
+
signal,
|
|
6
|
+
type WritableSignal,
|
|
7
|
+
} from '@angular/core';
|
|
2
8
|
|
|
3
9
|
export interface DropdownMenuSubContext {
|
|
4
10
|
open: WritableSignal<boolean>;
|
|
5
11
|
}
|
|
6
12
|
|
|
7
13
|
export const DROPDOWN_MENU_SUB_CONTEXT = new InjectionToken<DropdownMenuSubContext>(
|
|
8
|
-
'DROPDOWN_MENU_SUB_CONTEXT'
|
|
14
|
+
'DROPDOWN_MENU_SUB_CONTEXT',
|
|
9
15
|
);
|
|
10
16
|
|
|
11
17
|
/**
|
|
@@ -24,6 +30,7 @@ export const DROPDOWN_MENU_SUB_CONTEXT = new InjectionToken<DropdownMenuSubConte
|
|
|
24
30
|
},
|
|
25
31
|
],
|
|
26
32
|
host: {
|
|
33
|
+
'attr.data-slot': '"dropdown-menu-sub"',
|
|
27
34
|
class: 'relative',
|
|
28
35
|
},
|
|
29
36
|
changeDetection: ChangeDetectionStrategy.OnPush,
|