@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,4 +1,10 @@
|
|
|
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 ContextMenuRadioGroupContext {
|
|
4
10
|
value: WritableSignal<string>;
|
|
@@ -6,7 +12,7 @@ export interface ContextMenuRadioGroupContext {
|
|
|
6
12
|
}
|
|
7
13
|
|
|
8
14
|
export const CONTEXT_MENU_RADIO_GROUP_CONTEXT = new InjectionToken<ContextMenuRadioGroupContext>(
|
|
9
|
-
'CONTEXT_MENU_RADIO_GROUP_CONTEXT'
|
|
15
|
+
'CONTEXT_MENU_RADIO_GROUP_CONTEXT',
|
|
10
16
|
);
|
|
11
17
|
|
|
12
18
|
/**
|
|
@@ -29,6 +35,7 @@ export const CONTEXT_MENU_RADIO_GROUP_CONTEXT = new InjectionToken<ContextMenuRa
|
|
|
29
35
|
},
|
|
30
36
|
],
|
|
31
37
|
host: {
|
|
38
|
+
'attr.data-slot': '"context-menu-radio-group"',
|
|
32
39
|
'[attr.role]': '"group"',
|
|
33
40
|
},
|
|
34
41
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -20,6 +20,7 @@ import { CONTEXT_MENU_RADIO_GROUP_CONTEXT } from './context-menu-radio-group.com
|
|
|
20
20
|
<ng-content />
|
|
21
21
|
`,
|
|
22
22
|
host: {
|
|
23
|
+
'attr.data-slot': '"context-menu-radio-item"',
|
|
23
24
|
'[class]': 'computedClass()',
|
|
24
25
|
'[attr.role]': '"menuitemradio"',
|
|
25
26
|
'[attr.aria-checked]': 'isSelected()',
|
|
@@ -34,38 +35,37 @@ import { CONTEXT_MENU_RADIO_GROUP_CONTEXT } from './context-menu-radio-group.com
|
|
|
34
35
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
36
|
})
|
|
36
37
|
export class ContextMenuRadioItem {
|
|
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(CONTEXT_MENU_CONTEXT);
|
|
50
|
+
private readonly _radioGroupContext = inject(CONTEXT_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 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: 'ContextMenuSeparator',
|
|
10
10
|
template: ``,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"context-menu-separator"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
'[attr.role]': '"separator"',
|
|
14
15
|
},
|
|
@@ -18,7 +19,5 @@ export class ContextMenuSeparator {
|
|
|
18
19
|
/** Additional CSS classes */
|
|
19
20
|
readonly class = input<string>('');
|
|
20
21
|
|
|
21
|
-
protected readonly computedClass = computed(() =>
|
|
22
|
-
cn('-mx-1 my-1 h-px bg-border', this.class())
|
|
23
|
-
);
|
|
22
|
+
protected readonly computedClass = computed(() => cn('-mx-1 my-1 h-px bg-border', this.class()));
|
|
24
23
|
}
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'ContextMenuShortcut',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"context-menu-shortcut"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -18,6 +19,6 @@ export class ContextMenuShortcut {
|
|
|
18
19
|
readonly class = input<string>('');
|
|
19
20
|
|
|
20
21
|
protected readonly computedClass = computed(() =>
|
|
21
|
-
cn('ml-auto text-xs tracking-widest text-muted-foreground', this.class())
|
|
22
|
+
cn('ml-auto text-xs tracking-widest text-muted-foreground', this.class()),
|
|
22
23
|
);
|
|
23
24
|
}
|
|
@@ -21,6 +21,7 @@ import { CONTEXT_MENU_SUB_CONTEXT } from './context-menu-sub.component';
|
|
|
21
21
|
</Presence>
|
|
22
22
|
`,
|
|
23
23
|
host: {
|
|
24
|
+
'attr.data-slot': '"context-menu-sub-content"',
|
|
24
25
|
class: 'contents',
|
|
25
26
|
'(mouseenter)': 'onMouseEnter()',
|
|
26
27
|
'(mouseleave)': 'onMouseLeave()',
|
|
@@ -28,23 +29,22 @@ import { CONTEXT_MENU_SUB_CONTEXT } from './context-menu-sub.component';
|
|
|
28
29
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
30
|
})
|
|
30
31
|
export class ContextMenuSubContent {
|
|
31
|
-
protected readonly subContext = inject(CONTEXT_MENU_SUB_CONTEXT);
|
|
32
|
-
|
|
33
32
|
/** Additional CSS classes */
|
|
34
33
|
readonly class = input<string>('');
|
|
35
34
|
|
|
35
|
+
protected readonly subContext = inject(CONTEXT_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',
|
|
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 { CONTEXT_MENU_SUB_CONTEXT } from './context-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': '"context-menu-sub-trigger"',
|
|
18
19
|
'[class]': 'computedClass()',
|
|
19
20
|
'(mouseenter)': 'onMouseEnter()',
|
|
20
21
|
'(mouseleave)': 'onMouseLeave()',
|
|
@@ -23,27 +24,27 @@ import { CONTEXT_MENU_SUB_CONTEXT } from './context-menu-sub.component';
|
|
|
23
24
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
25
|
})
|
|
25
26
|
export class ContextMenuSubTrigger {
|
|
26
|
-
protected readonly subContext = inject(CONTEXT_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(CONTEXT_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 focus:text-accent-foreground 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 focus:text-accent-foreground 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
|
// Keep open to allow mouse movement to subcontent
|
|
49
50
|
}
|
|
@@ -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 ContextMenuSubContext {
|
|
4
10
|
open: WritableSignal<boolean>;
|
|
5
11
|
}
|
|
6
12
|
|
|
7
13
|
export const CONTEXT_MENU_SUB_CONTEXT = new InjectionToken<ContextMenuSubContext>(
|
|
8
|
-
'CONTEXT_MENU_SUB_CONTEXT'
|
|
14
|
+
'CONTEXT_MENU_SUB_CONTEXT',
|
|
9
15
|
);
|
|
10
16
|
|
|
11
17
|
/**
|
|
@@ -24,6 +30,7 @@ export const CONTEXT_MENU_SUB_CONTEXT = new InjectionToken<ContextMenuSubContext
|
|
|
24
30
|
},
|
|
25
31
|
],
|
|
26
32
|
host: {
|
|
33
|
+
'attr.data-slot': '"context-menu-sub"',
|
|
27
34
|
class: 'relative',
|
|
28
35
|
},
|
|
29
36
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -10,6 +10,7 @@ import { CONTEXT_MENU_CONTEXT } from './context-menu-context';
|
|
|
10
10
|
selector: 'ContextMenuTrigger',
|
|
11
11
|
template: `<ng-content />`,
|
|
12
12
|
host: {
|
|
13
|
+
'attr.data-slot': '"context-menu-trigger"',
|
|
13
14
|
'[attr.tabindex]': '0',
|
|
14
15
|
'(contextmenu)': 'onContextMenu($event)',
|
|
15
16
|
'(keydown)': 'onKeydown($event)',
|
|
@@ -17,33 +18,33 @@ import { CONTEXT_MENU_CONTEXT } from './context-menu-context';
|
|
|
17
18
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
19
|
})
|
|
19
20
|
export class ContextMenuTrigger {
|
|
21
|
+
private readonly _elementRef = inject(ElementRef);
|
|
22
|
+
|
|
20
23
|
protected readonly context = inject(CONTEXT_MENU_CONTEXT);
|
|
21
|
-
private readonly elementRef = inject(ElementRef);
|
|
22
24
|
|
|
23
25
|
protected onContextMenu(event: MouseEvent): void {
|
|
24
26
|
event.preventDefault();
|
|
25
27
|
this.context.position.set({ x: event.clientX, y: event.clientY });
|
|
26
|
-
this.context.triggerElement.set(this.
|
|
28
|
+
this.context.triggerElement.set(this._elementRef.nativeElement);
|
|
27
29
|
this.context.focusedIndex.set(-1);
|
|
28
30
|
this.context.open.set(true);
|
|
29
31
|
}
|
|
30
|
-
|
|
31
32
|
protected onKeydown(event: KeyboardEvent): void {
|
|
32
33
|
// Shift+F10 opens context menu (Windows convention)
|
|
33
34
|
if (event.key === 'F10' && event.shiftKey) {
|
|
34
35
|
event.preventDefault();
|
|
35
|
-
const rect = this.
|
|
36
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
36
37
|
this.context.position.set({ x: rect.left, y: rect.bottom });
|
|
37
|
-
this.context.triggerElement.set(this.
|
|
38
|
+
this.context.triggerElement.set(this._elementRef.nativeElement);
|
|
38
39
|
this.context.focusedIndex.set(-1);
|
|
39
40
|
this.context.open.set(true);
|
|
40
41
|
}
|
|
41
42
|
// Also support ContextMenu key
|
|
42
43
|
if (event.key === 'ContextMenu') {
|
|
43
44
|
event.preventDefault();
|
|
44
|
-
const rect = this.
|
|
45
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
45
46
|
this.context.position.set({ x: rect.left, y: rect.bottom });
|
|
46
|
-
this.context.triggerElement.set(this.
|
|
47
|
+
this.context.triggerElement.set(this._elementRef.nativeElement);
|
|
47
48
|
this.context.focusedIndex.set(-1);
|
|
48
49
|
this.context.open.set(true);
|
|
49
50
|
}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
export { ContextMenuCheckboxItem } from './context-menu-checkbox-item.component';
|
|
2
2
|
export { ContextMenuContent } from './context-menu-content.component';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
CONTEXT_MENU_CONTEXT,
|
|
5
|
+
type ContextMenuContextValue,
|
|
6
|
+
type ContextMenuPosition,
|
|
7
|
+
} from './context-menu-context';
|
|
4
8
|
export { ContextMenuItem } from './context-menu-item.component';
|
|
5
9
|
export { ContextMenuLabel } from './context-menu-label.component';
|
|
6
|
-
export {
|
|
10
|
+
export {
|
|
11
|
+
CONTEXT_MENU_RADIO_GROUP_CONTEXT,
|
|
12
|
+
ContextMenuRadioGroup,
|
|
13
|
+
type ContextMenuRadioGroupContext,
|
|
14
|
+
} from './context-menu-radio-group.component';
|
|
7
15
|
export { ContextMenuRadioItem } from './context-menu-radio-item.component';
|
|
8
16
|
export { ContextMenuSeparator } from './context-menu-separator.component';
|
|
9
17
|
export { ContextMenuShortcut } from './context-menu-shortcut.component';
|
|
10
18
|
export { ContextMenuSubContent } from './context-menu-sub-content.component';
|
|
11
19
|
export { ContextMenuSubTrigger } from './context-menu-sub-trigger.component';
|
|
12
|
-
export {
|
|
20
|
+
export {
|
|
21
|
+
CONTEXT_MENU_SUB_CONTEXT,
|
|
22
|
+
ContextMenuSub,
|
|
23
|
+
type ContextMenuSubContext,
|
|
24
|
+
} from './context-menu-sub.component';
|
|
13
25
|
export { ContextMenuTrigger } from './context-menu-trigger.component';
|
|
14
26
|
export { ContextMenu } from './context-menu.component';
|
|
15
|
-
|
|
@@ -1,18 +1,12 @@
|
|
|
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 { ArrowDown, ArrowUp, ArrowUpDown, LucideAngularModule } from 'lucide-angular';
|
|
10
4
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
DATA_TABLE_CONTEXT,
|
|
6
|
+
DataTableContext,
|
|
7
|
+
SortDirection,
|
|
8
|
+
SortingState,
|
|
9
|
+
type ColumnDef,
|
|
16
10
|
} from './data-table-context';
|
|
17
11
|
|
|
18
12
|
/**
|
|
@@ -31,7 +25,10 @@ import {
|
|
|
31
25
|
<div class="rounded-md border">
|
|
32
26
|
<table class="w-full caption-bottom text-sm" role="grid" aria-label="Data table">
|
|
33
27
|
<thead class="[&_tr]:border-b">
|
|
34
|
-
<tr
|
|
28
|
+
<tr
|
|
29
|
+
class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
|
30
|
+
role="row"
|
|
31
|
+
>
|
|
35
32
|
@for (column of visibleColumns(); track column.id) {
|
|
36
33
|
<th
|
|
37
34
|
scope="col"
|
|
@@ -52,7 +49,11 @@ import {
|
|
|
52
49
|
} @else if (getSortDirection(column.id) === 'desc') {
|
|
53
50
|
<lucide-icon [img]="icons.ArrowDown" class="size-4" aria-hidden="true" />
|
|
54
51
|
} @else {
|
|
55
|
-
<lucide-icon
|
|
52
|
+
<lucide-icon
|
|
53
|
+
[img]="icons.ArrowUpDown"
|
|
54
|
+
class="size-4 opacity-50"
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
/>
|
|
56
57
|
}
|
|
57
58
|
</button>
|
|
58
59
|
} @else {
|
|
@@ -95,25 +96,24 @@ import {
|
|
|
95
96
|
</div>
|
|
96
97
|
`,
|
|
97
98
|
host: {
|
|
99
|
+
'attr.data-slot': '"data-table-content"',
|
|
98
100
|
'[class]': 'computedClass()',
|
|
99
|
-
|
|
101
|
+
ngSkipHydration: 'true',
|
|
100
102
|
},
|
|
101
103
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
102
104
|
})
|
|
103
105
|
export class DataTableContent<T = unknown> {
|
|
104
|
-
protected readonly context = inject(DATA_TABLE_CONTEXT) as DataTableContext<T>;
|
|
105
|
-
protected readonly icons = { ArrowUp, ArrowDown, ArrowUpDown };
|
|
106
|
-
|
|
107
106
|
/** Additional CSS classes */
|
|
108
107
|
readonly class = input<string>('');
|
|
109
108
|
|
|
109
|
+
protected readonly context = inject(DATA_TABLE_CONTEXT) as DataTableContext<T>;
|
|
110
|
+
|
|
110
111
|
/** Visible columns based on visibility state */
|
|
111
112
|
protected readonly visibleColumns = computed(() => {
|
|
112
113
|
const columns = this.context.columns();
|
|
113
114
|
const visibility = this.context.columnVisibility();
|
|
114
115
|
return columns.filter((col) => visibility[col.id] !== false);
|
|
115
116
|
});
|
|
116
|
-
|
|
117
117
|
/** Filtered data based on global filter */
|
|
118
118
|
protected readonly filteredData = computed(() => {
|
|
119
119
|
const data = this.context.data();
|
|
@@ -126,10 +126,9 @@ export class DataTableContent<T = unknown> {
|
|
|
126
126
|
columns.some((col) => {
|
|
127
127
|
const value = this.getCellValue(row, col);
|
|
128
128
|
return String(value).toLowerCase().includes(filter);
|
|
129
|
-
})
|
|
129
|
+
}),
|
|
130
130
|
);
|
|
131
131
|
});
|
|
132
|
-
|
|
133
132
|
/** Sorted data */
|
|
134
133
|
protected readonly sortedData = computed(() => {
|
|
135
134
|
const data = [...this.filteredData()];
|
|
@@ -153,7 +152,6 @@ export class DataTableContent<T = unknown> {
|
|
|
153
152
|
return 0;
|
|
154
153
|
});
|
|
155
154
|
});
|
|
156
|
-
|
|
157
155
|
/** Paginated data */
|
|
158
156
|
protected readonly paginatedData = computed(() => {
|
|
159
157
|
const data = this.sortedData();
|
|
@@ -162,9 +160,10 @@ export class DataTableContent<T = unknown> {
|
|
|
162
160
|
const start = pageIndex * pageSize;
|
|
163
161
|
return data.slice(start, start + pageSize);
|
|
164
162
|
});
|
|
165
|
-
|
|
166
163
|
protected readonly computedClass = computed(() => cn(this.class()));
|
|
167
164
|
|
|
165
|
+
protected readonly icons = { ArrowUp, ArrowDown, ArrowUpDown };
|
|
166
|
+
|
|
168
167
|
protected getCellValue(row: T, column: ColumnDef<T>): unknown {
|
|
169
168
|
if (column.accessorFn) {
|
|
170
169
|
return column.accessorFn(row);
|
|
@@ -174,14 +173,12 @@ export class DataTableContent<T = unknown> {
|
|
|
174
173
|
}
|
|
175
174
|
return '';
|
|
176
175
|
}
|
|
177
|
-
|
|
178
176
|
protected getSortDirection(columnId: string): SortDirection {
|
|
179
177
|
const sorting = this.context.sorting();
|
|
180
178
|
const sort = sorting.find((s) => s.id === columnId);
|
|
181
179
|
if (!sort) return null;
|
|
182
180
|
return sort.desc ? 'desc' : 'asc';
|
|
183
181
|
}
|
|
184
|
-
|
|
185
182
|
/** Get ARIA sort value for accessibility */
|
|
186
183
|
protected getAriaSortValue(columnId: string): 'ascending' | 'descending' | 'none' | null {
|
|
187
184
|
const direction = this.getSortDirection(columnId);
|
|
@@ -189,7 +186,6 @@ export class DataTableContent<T = unknown> {
|
|
|
189
186
|
if (direction === 'desc') return 'descending';
|
|
190
187
|
return 'none';
|
|
191
188
|
}
|
|
192
|
-
|
|
193
189
|
/** Get accessible label for sort button */
|
|
194
190
|
protected getSortButtonLabel(column: ColumnDef<T>): string {
|
|
195
191
|
const direction = this.getSortDirection(column.id);
|
|
@@ -202,7 +198,6 @@ export class DataTableContent<T = unknown> {
|
|
|
202
198
|
}
|
|
203
199
|
return `${header}. Click to sort ascending.`;
|
|
204
200
|
}
|
|
205
|
-
|
|
206
201
|
protected toggleSort(columnId: string): void {
|
|
207
202
|
const sorting = this.context.sorting();
|
|
208
203
|
const existingSort = sorting.find((s) => s.id === columnId);
|
|
@@ -218,7 +213,6 @@ export class DataTableContent<T = unknown> {
|
|
|
218
213
|
|
|
219
214
|
this.context.onSortingChange(newSorting);
|
|
220
215
|
}
|
|
221
|
-
|
|
222
216
|
protected isRowSelected(index: number): boolean {
|
|
223
217
|
const selection = this.context.rowSelection();
|
|
224
218
|
return selection[String(index)] === true;
|
|
@@ -44,6 +44,4 @@ export interface DataTableContext<T = unknown> {
|
|
|
44
44
|
onPaginationChange: (pageIndex: number, pageSize: number) => void;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export const DATA_TABLE_CONTEXT = new InjectionToken<DataTableContext>(
|
|
48
|
-
'DataTableContext'
|
|
49
|
-
);
|
|
47
|
+
export const DATA_TABLE_CONTEXT = new InjectionToken<DataTableContext>('DataTableContext');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '
|
|
9
|
-
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, LucideAngularModule } from 'lucide-angular';
|
|
4
|
+
ChevronLeft,
|
|
5
|
+
ChevronRight,
|
|
6
|
+
ChevronsLeft,
|
|
7
|
+
ChevronsRight,
|
|
8
|
+
LucideAngularModule,
|
|
9
|
+
} from 'lucide-angular';
|
|
10
10
|
import { DATA_TABLE_CONTEXT } from './data-table-context';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -74,64 +74,54 @@ import { DATA_TABLE_CONTEXT } from './data-table-context';
|
|
|
74
74
|
</div>
|
|
75
75
|
`,
|
|
76
76
|
host: {
|
|
77
|
+
'attr.data-slot': '"data-table-pagination"',
|
|
77
78
|
'[class]': 'computedClass()',
|
|
78
79
|
},
|
|
79
80
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
80
81
|
})
|
|
81
82
|
export class DataTablePagination {
|
|
82
|
-
protected readonly context = inject(DATA_TABLE_CONTEXT);
|
|
83
|
-
protected readonly icons = { ChevronsLeft, ChevronsRight, ChevronLeft, ChevronRight };
|
|
84
|
-
|
|
85
83
|
/** Page size options */
|
|
86
84
|
readonly pageSizeOptions = input<number[]>([10, 20, 30, 40, 50]);
|
|
87
85
|
|
|
88
86
|
/** Additional CSS classes */
|
|
89
87
|
readonly class = input<string>('');
|
|
90
88
|
|
|
91
|
-
protected readonly
|
|
89
|
+
protected readonly context = inject(DATA_TABLE_CONTEXT);
|
|
92
90
|
|
|
91
|
+
protected readonly totalCount = computed(() => this.context.data().length);
|
|
93
92
|
protected readonly selectedCount = computed(
|
|
94
|
-
() =>
|
|
93
|
+
() =>
|
|
94
|
+
Object.keys(this.context.rowSelection()).filter((k) => this.context.rowSelection()[k]).length,
|
|
95
95
|
);
|
|
96
|
-
|
|
97
96
|
protected readonly pageCount = computed(() => {
|
|
98
97
|
const total = this.totalCount();
|
|
99
98
|
const pageSize = this.context.pageSize();
|
|
100
99
|
return Math.ceil(total / pageSize);
|
|
101
100
|
});
|
|
102
|
-
|
|
103
|
-
protected readonly
|
|
104
|
-
() => this.context.pageIndex() > 0
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
protected readonly canNextPage = computed(
|
|
108
|
-
() => this.context.pageIndex() < this.pageCount() - 1
|
|
109
|
-
);
|
|
110
|
-
|
|
101
|
+
protected readonly canPreviousPage = computed(() => this.context.pageIndex() > 0);
|
|
102
|
+
protected readonly canNextPage = computed(() => this.context.pageIndex() < this.pageCount() - 1);
|
|
111
103
|
protected readonly computedClass = computed(() =>
|
|
112
|
-
cn('flex items-center justify-end space-x-2 py-4', this.class())
|
|
104
|
+
cn('flex items-center justify-end space-x-2 py-4', this.class()),
|
|
113
105
|
);
|
|
114
106
|
|
|
107
|
+
protected readonly icons = { ChevronsLeft, ChevronsRight, ChevronLeft, ChevronRight };
|
|
108
|
+
|
|
115
109
|
protected onPageSizeChange(event: Event): void {
|
|
116
110
|
const target = event.target as HTMLSelectElement;
|
|
117
111
|
const pageSize = parseInt(target.value, 10);
|
|
118
112
|
this.context.onPaginationChange(0, pageSize);
|
|
119
113
|
}
|
|
120
|
-
|
|
121
114
|
protected firstPage(): void {
|
|
122
115
|
this.context.onPaginationChange(0, this.context.pageSize());
|
|
123
116
|
}
|
|
124
|
-
|
|
125
117
|
protected previousPage(): void {
|
|
126
118
|
const newIndex = Math.max(0, this.context.pageIndex() - 1);
|
|
127
119
|
this.context.onPaginationChange(newIndex, this.context.pageSize());
|
|
128
120
|
}
|
|
129
|
-
|
|
130
121
|
protected nextPage(): void {
|
|
131
122
|
const newIndex = Math.min(this.pageCount() - 1, this.context.pageIndex() + 1);
|
|
132
123
|
this.context.onPaginationChange(newIndex, this.context.pageSize());
|
|
133
124
|
}
|
|
134
|
-
|
|
135
125
|
protected lastPage(): void {
|
|
136
126
|
this.context.onPaginationChange(this.pageCount() - 1, this.context.pageSize());
|
|
137
127
|
}
|
|
@@ -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 { DATA_TABLE_CONTEXT } from './data-table-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -22,27 +16,25 @@ import { DATA_TABLE_CONTEXT } from './data-table-context';
|
|
|
22
16
|
/>
|
|
23
17
|
`,
|
|
24
18
|
host: {
|
|
19
|
+
'attr.data-slot': '"data-table-search"',
|
|
25
20
|
'[class]': 'computedClass()',
|
|
26
21
|
},
|
|
27
22
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
23
|
})
|
|
29
24
|
export class DataTableSearch {
|
|
30
|
-
protected readonly context = inject(DATA_TABLE_CONTEXT);
|
|
31
|
-
|
|
32
25
|
/** Placeholder text */
|
|
33
26
|
readonly placeholder = input<string>('Search...');
|
|
34
27
|
|
|
35
28
|
/** Additional CSS classes */
|
|
36
29
|
readonly class = input<string>('');
|
|
37
30
|
|
|
38
|
-
protected readonly
|
|
39
|
-
cn('flex items-center', this.class())
|
|
40
|
-
);
|
|
31
|
+
protected readonly context = inject(DATA_TABLE_CONTEXT);
|
|
41
32
|
|
|
33
|
+
protected readonly computedClass = computed(() => cn('flex items-center', this.class()));
|
|
42
34
|
protected readonly inputClass = computed(() =>
|
|
43
35
|
cn(
|
|
44
|
-
'flex h-9 w-full max-w-sm rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50'
|
|
45
|
-
)
|
|
36
|
+
'flex h-9 w-full max-w-sm rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
|
|
37
|
+
),
|
|
46
38
|
);
|
|
47
39
|
|
|
48
40
|
protected onInput(event: Event): void {
|
|
@@ -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
|
* DataTableToolbar component - toolbar with search and options.
|
|
@@ -13,6 +8,7 @@ import {
|
|
|
13
8
|
selector: 'DataTableToolbar',
|
|
14
9
|
template: `<ng-content />`,
|
|
15
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"data-table-toolbar"',
|
|
16
12
|
'[class]': 'computedClass()',
|
|
17
13
|
},
|
|
18
14
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -22,6 +18,6 @@ export class DataTableToolbar {
|
|
|
22
18
|
readonly class = input<string>('');
|
|
23
19
|
|
|
24
20
|
protected readonly computedClass = computed(() =>
|
|
25
|
-
cn('flex items-center justify-between', this.class())
|
|
21
|
+
cn('flex items-center justify-between', this.class()),
|
|
26
22
|
);
|
|
27
23
|
}
|