@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
|
@@ -20,8 +20,14 @@
|
|
|
20
20
|
"message": "Which theme variant would you like to use?",
|
|
21
21
|
"type": "list",
|
|
22
22
|
"items": [
|
|
23
|
-
{
|
|
24
|
-
|
|
23
|
+
{
|
|
24
|
+
"value": "shadcn",
|
|
25
|
+
"label": "shadcn - The default clean, minimal, and professional theme"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"value": "github",
|
|
29
|
+
"label": "GitHub - Inspired by GitHub's clean developer-focused design"
|
|
30
|
+
},
|
|
25
31
|
{ "value": "vercel", "label": "Vercel - Bold black and white design aesthetic" },
|
|
26
32
|
{ "value": "apple", "label": "Apple - Elegant, sophisticated design language" },
|
|
27
33
|
{ "value": "openai", "label": "OpenAI - Modern, tech-forward aesthetic" },
|
|
@@ -82,7 +82,7 @@ async function runTests() {
|
|
|
82
82
|
'/src/app/lib/utils/cn.ts',
|
|
83
83
|
'/src/app/lib/utils/index.ts',
|
|
84
84
|
'/src/app/lib/components/ui/.gitkeep',
|
|
85
|
-
'/src/ng-cn.scss'
|
|
85
|
+
'/src/ng-cn.scss',
|
|
86
86
|
];
|
|
87
87
|
|
|
88
88
|
console.log('📄 Checking created files:');
|
|
@@ -132,7 +132,6 @@ async function runTests() {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
console.log('\n✨ All tests passed!\n');
|
|
135
|
-
|
|
136
135
|
} catch (error) {
|
|
137
136
|
console.error('\n❌ Schematic failed with error:');
|
|
138
137
|
console.error(error);
|
|
File without changes
|
|
@@ -1,16 +1,11 @@
|
|
|
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 { ACCORDION_ITEM_CONTEXT } from './accordion-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
6
|
* AccordionContent component - expandable content area.
|
|
13
|
-
* Uses
|
|
7
|
+
* Uses CSS grid animation (grid-template-rows: 0fr → 1fr) for smooth open/close.
|
|
8
|
+
* Content is always in the DOM; visibility is controlled by the grid row height.
|
|
14
9
|
*
|
|
15
10
|
* @example
|
|
16
11
|
* <AccordionContent>
|
|
@@ -20,34 +15,31 @@ import { ACCORDION_ITEM_CONTEXT } from './accordion-context';
|
|
|
20
15
|
@Component({
|
|
21
16
|
selector: 'AccordionContent',
|
|
22
17
|
template: `
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
</div>
|
|
27
|
-
}
|
|
18
|
+
<div [class]="innerClass()">
|
|
19
|
+
<ng-content />
|
|
20
|
+
</div>
|
|
28
21
|
`,
|
|
29
22
|
host: {
|
|
30
|
-
'
|
|
23
|
+
'attr.data-slot': '"accordion-content"',
|
|
24
|
+
role: 'region',
|
|
31
25
|
'[class]': 'computedClass()',
|
|
32
26
|
'[attr.id]': 'item.contentId',
|
|
33
27
|
'[attr.data-state]': 'item.isOpen() ? "open" : "closed"',
|
|
34
28
|
'[attr.aria-labelledby]': 'item.triggerId',
|
|
35
|
-
'[attr.aria-hidden]': '!item.isOpen()',
|
|
36
29
|
},
|
|
37
30
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
38
31
|
})
|
|
39
32
|
export class AccordionContent {
|
|
40
|
-
protected readonly item = inject(ACCORDION_ITEM_CONTEXT);
|
|
41
|
-
|
|
42
33
|
/** Additional CSS classes */
|
|
43
34
|
readonly class = input<string>('');
|
|
44
35
|
|
|
45
|
-
protected readonly
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
);
|
|
36
|
+
protected readonly item = inject(ACCORDION_ITEM_CONTEXT);
|
|
37
|
+
|
|
38
|
+
// No overflow-hidden on the host — grid-template-rows handles expansion.
|
|
39
|
+
// Global CSS ([data-slot='accordion-content'] > div { overflow: hidden }) clips the inner div.
|
|
40
|
+
protected readonly computedClass = computed(() => cn('text-sm', this.class()));
|
|
51
41
|
|
|
52
|
-
protected readonly innerClass = computed(() =>
|
|
42
|
+
protected readonly innerClass = computed(() =>
|
|
43
|
+
cn('pb-4 pt-2 px-1 text-muted-foreground leading-relaxed'),
|
|
44
|
+
);
|
|
53
45
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { InjectionToken, WritableSignal } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// Types
|
|
5
|
-
// ============================================================================
|
|
6
|
-
|
|
7
3
|
export type AccordionType = 'single' | 'multiple';
|
|
8
4
|
|
|
9
5
|
export interface AccordionContext {
|
|
@@ -20,14 +16,13 @@ export interface AccordionItemContext {
|
|
|
20
16
|
value: () => string;
|
|
21
17
|
isOpen: () => boolean;
|
|
22
18
|
toggle: () => void;
|
|
19
|
+
disabled: () => boolean;
|
|
23
20
|
/** Unique IDs for ARIA relationships */
|
|
24
21
|
triggerId: string;
|
|
25
22
|
contentId: string;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
// ============================================================================
|
|
29
|
-
// Injection Tokens
|
|
30
|
-
// ============================================================================
|
|
31
|
-
|
|
32
25
|
export const ACCORDION_CONTEXT = new InjectionToken<AccordionContext>('AccordionContext');
|
|
33
|
-
export const ACCORDION_ITEM_CONTEXT = new InjectionToken<AccordionItemContext>(
|
|
26
|
+
export const ACCORDION_ITEM_CONTEXT = new InjectionToken<AccordionItemContext>(
|
|
27
|
+
'AccordionItemContext',
|
|
28
|
+
);
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import { AriaIdService } from '@/lib/utils/accessibility';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
booleanAttribute,
|
|
5
|
+
ChangeDetectionStrategy,
|
|
6
|
+
Component,
|
|
7
|
+
computed,
|
|
8
|
+
forwardRef,
|
|
9
|
+
inject,
|
|
10
|
+
input,
|
|
11
|
+
OnDestroy,
|
|
12
|
+
OnInit,
|
|
12
13
|
} from '@angular/core';
|
|
13
14
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
ACCORDION_CONTEXT,
|
|
16
|
+
ACCORDION_ITEM_CONTEXT,
|
|
17
|
+
AccordionItemContext,
|
|
17
18
|
} from './accordion-context';
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -30,9 +31,12 @@ import {
|
|
|
30
31
|
selector: 'AccordionItem',
|
|
31
32
|
template: `<ng-content />`,
|
|
32
33
|
host: {
|
|
34
|
+
'attr.data-slot': '"accordion-item"',
|
|
33
35
|
'[class]': 'computedClass()',
|
|
34
36
|
'[attr.data-state]': 'isOpen() ? "open" : "closed"',
|
|
35
37
|
'[attr.data-value]': 'value()',
|
|
38
|
+
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
39
|
+
'[attr.aria-disabled]': 'disabled() || null',
|
|
36
40
|
},
|
|
37
41
|
providers: [
|
|
38
42
|
{
|
|
@@ -43,44 +47,44 @@ import {
|
|
|
43
47
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
44
48
|
})
|
|
45
49
|
export class AccordionItem implements AccordionItemContext, OnInit, OnDestroy {
|
|
46
|
-
private readonly accordion = inject(ACCORDION_CONTEXT);
|
|
47
|
-
private readonly ariaIdService = inject(AriaIdService);
|
|
48
|
-
private readonly ariaIds = this.ariaIdService.generateAccordionIds('accordion');
|
|
49
|
-
|
|
50
50
|
/** Unique value for this accordion item */
|
|
51
51
|
readonly value = input.required<string>();
|
|
52
52
|
|
|
53
|
+
/** Whether this item is disabled */
|
|
54
|
+
readonly disabled = input<boolean, unknown>(false, { transform: booleanAttribute });
|
|
55
|
+
|
|
53
56
|
/** Additional CSS classes */
|
|
54
57
|
readonly class = input<string>('');
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
readonly
|
|
58
|
-
readonly contentId = this.ariaIds.generateContentId(0);
|
|
59
|
+
private readonly _accordion = inject(ACCORDION_CONTEXT);
|
|
60
|
+
private readonly _ariaIdService = inject(AriaIdService);
|
|
59
61
|
|
|
60
62
|
/** Whether this item is currently open */
|
|
61
|
-
readonly isOpen = computed(() => this.
|
|
63
|
+
readonly isOpen = computed(() => this._accordion.isItemOpen(this.value()));
|
|
64
|
+
protected readonly computedClass = computed(() => cn('border-b w-full', this.class()));
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
private readonly ariaIds = this._ariaIdService.generateAccordionIds('accordion');
|
|
67
|
+
/** ARIA IDs for relationships */
|
|
68
|
+
readonly triggerId = this.ariaIds.generateTriggerId();
|
|
69
|
+
readonly contentId = this.ariaIds.generateContentId(0);
|
|
67
70
|
|
|
68
71
|
ngOnInit(): void {
|
|
69
72
|
// Register this item's value for keyboard navigation
|
|
70
|
-
this.
|
|
73
|
+
this._accordion.itemValues.update((values) => {
|
|
71
74
|
if (!values.includes(this.value())) {
|
|
72
75
|
return [...values, this.value()];
|
|
73
76
|
}
|
|
74
77
|
return values;
|
|
75
78
|
});
|
|
76
79
|
}
|
|
77
|
-
|
|
78
80
|
ngOnDestroy(): void {
|
|
79
81
|
// Unregister this item's value
|
|
80
|
-
this.
|
|
81
|
-
values.filter(v => v !== this.value())
|
|
82
|
-
);
|
|
82
|
+
this._accordion.itemValues.update((values) => values.filter((v) => v !== this.value()));
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
/** Toggle this item's open state */
|
|
86
|
+
toggle(): void {
|
|
87
|
+
if (this.disabled()) return;
|
|
88
|
+
this._accordion.onValueChange(this.value());
|
|
89
|
+
}
|
|
86
90
|
}
|
|
@@ -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 { ACCORDION_ITEM_CONTEXT } from './accordion-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -21,7 +15,6 @@ import { ACCORDION_ITEM_CONTEXT } from './accordion-context';
|
|
|
21
15
|
<span class="me-2"><ng-content /></span>
|
|
22
16
|
<svg
|
|
23
17
|
class="size-4 shrink-0 ms-auto text-muted-foreground transition-transform duration-200"
|
|
24
|
-
[class.rotate-180]="item.isOpen()"
|
|
25
18
|
xmlns="http://www.w3.org/2000/svg"
|
|
26
19
|
width="24"
|
|
27
20
|
height="24"
|
|
@@ -36,38 +29,42 @@ import { ACCORDION_ITEM_CONTEXT } from './accordion-context';
|
|
|
36
29
|
</svg>
|
|
37
30
|
`,
|
|
38
31
|
host: {
|
|
32
|
+
'attr.data-slot': '"accordion-trigger"',
|
|
39
33
|
'[class]': 'computedClass()',
|
|
40
34
|
'[attr.id]': 'item.triggerId',
|
|
41
35
|
'[attr.data-state]': 'item.isOpen() ? "open" : "closed"',
|
|
42
36
|
'[attr.aria-expanded]': 'item.isOpen()',
|
|
43
37
|
'[attr.aria-controls]': 'item.contentId',
|
|
38
|
+
'[attr.aria-disabled]': 'item.disabled() || null',
|
|
44
39
|
'(click)': 'onClick()',
|
|
45
40
|
'(keydown.enter)': 'onClick()',
|
|
46
41
|
'(keydown.space)': 'onSpace($event)',
|
|
47
42
|
'[attr.tabindex]': '0',
|
|
48
|
-
|
|
43
|
+
role: 'button',
|
|
49
44
|
},
|
|
50
45
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
51
46
|
})
|
|
52
47
|
export class AccordionTrigger {
|
|
53
|
-
protected readonly item = inject(ACCORDION_ITEM_CONTEXT);
|
|
54
|
-
|
|
55
48
|
/** Additional CSS classes */
|
|
56
49
|
readonly class = input<string>('');
|
|
57
50
|
|
|
51
|
+
protected readonly item = inject(ACCORDION_ITEM_CONTEXT);
|
|
52
|
+
|
|
58
53
|
protected readonly computedClass = computed(() =>
|
|
59
54
|
cn(
|
|
60
55
|
'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180 cursor-pointer w-full',
|
|
61
|
-
this.
|
|
62
|
-
|
|
56
|
+
this.item.disabled() && 'cursor-not-allowed opacity-50 hover:no-underline',
|
|
57
|
+
this.class(),
|
|
58
|
+
),
|
|
63
59
|
);
|
|
64
60
|
|
|
65
61
|
protected onClick(): void {
|
|
62
|
+
if (this.item.disabled()) return;
|
|
66
63
|
this.item.toggle();
|
|
67
64
|
}
|
|
68
|
-
|
|
69
65
|
protected onSpace(event: Event): void {
|
|
70
66
|
event.preventDefault();
|
|
67
|
+
if (this.item.disabled()) return;
|
|
71
68
|
this.item.toggle();
|
|
72
69
|
}
|
|
73
70
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
booleanAttribute,
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
Component,
|
|
6
|
+
computed,
|
|
7
|
+
effect,
|
|
8
|
+
forwardRef,
|
|
9
|
+
input,
|
|
10
|
+
output,
|
|
11
|
+
signal,
|
|
11
12
|
} from '@angular/core';
|
|
12
|
-
import {
|
|
13
|
-
ACCORDION_CONTEXT,
|
|
14
|
-
AccordionContext,
|
|
15
|
-
AccordionType,
|
|
16
|
-
} from './accordion-context';
|
|
13
|
+
import { ACCORDION_CONTEXT, AccordionContext, AccordionType } from './accordion-context';
|
|
17
14
|
|
|
18
15
|
/**
|
|
19
16
|
* Accordion component - root container for accordion items.
|
|
@@ -32,6 +29,7 @@ import {
|
|
|
32
29
|
selector: 'Accordion',
|
|
33
30
|
template: `<ng-content />`,
|
|
34
31
|
host: {
|
|
32
|
+
'attr.data-slot': '"accordion"',
|
|
35
33
|
'[class]': 'computedClass()',
|
|
36
34
|
'[attr.data-orientation]': '"vertical"',
|
|
37
35
|
'(keydown)': 'onKeydown($event)',
|
|
@@ -45,30 +43,6 @@ import {
|
|
|
45
43
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
46
44
|
})
|
|
47
45
|
export class Accordion implements AccordionContext {
|
|
48
|
-
/** Type of accordion: 'single' allows one item open, 'multiple' allows many */
|
|
49
|
-
readonly type = input<AccordionType>('single');
|
|
50
|
-
|
|
51
|
-
/** Whether the accordion can be fully collapsed (only for single type) */
|
|
52
|
-
readonly collapsible = input<boolean, unknown>(false, { transform: booleanAttribute });
|
|
53
|
-
|
|
54
|
-
/** Default value(s) to be open initially */
|
|
55
|
-
readonly defaultValue = input<string | string[] | undefined>(undefined);
|
|
56
|
-
|
|
57
|
-
/** Controlled value - external control of open state */
|
|
58
|
-
readonly controlledValue = input<string | string[] | undefined>(undefined, { alias: 'value' });
|
|
59
|
-
|
|
60
|
-
/** Additional CSS classes */
|
|
61
|
-
readonly class = input<string>('');
|
|
62
|
-
|
|
63
|
-
/** Internal state for open items */
|
|
64
|
-
private readonly openItems = signal<Set<string>>(new Set());
|
|
65
|
-
|
|
66
|
-
/** Registry of item values for keyboard navigation */
|
|
67
|
-
readonly itemValues = signal<string[]>([]);
|
|
68
|
-
|
|
69
|
-
/** Flag to track if initialized */
|
|
70
|
-
private initialized = false;
|
|
71
|
-
|
|
72
46
|
constructor() {
|
|
73
47
|
// Initialize with default value
|
|
74
48
|
effect(() => {
|
|
@@ -86,6 +60,21 @@ export class Accordion implements AccordionContext {
|
|
|
86
60
|
});
|
|
87
61
|
}
|
|
88
62
|
|
|
63
|
+
/** Type of accordion: 'single' allows one item open, 'multiple' allows many */
|
|
64
|
+
readonly type = input<AccordionType>('single');
|
|
65
|
+
/** Whether the accordion can be fully collapsed (only for single type) */
|
|
66
|
+
readonly collapsible = input<boolean, unknown>(false, { transform: booleanAttribute });
|
|
67
|
+
/** Default value(s) to be open initially */
|
|
68
|
+
readonly defaultValue = input<string | string[] | undefined>(undefined);
|
|
69
|
+
/** Controlled value - external control of open state */
|
|
70
|
+
readonly controlledValue = input<string | string[] | undefined>(undefined, { alias: 'value' });
|
|
71
|
+
/** Additional CSS classes */
|
|
72
|
+
readonly class = input<string>('');
|
|
73
|
+
|
|
74
|
+
/** Emits the new value whenever the open state changes */
|
|
75
|
+
readonly valueChange = output<string | string[] | undefined>();
|
|
76
|
+
|
|
77
|
+
protected readonly computedClass = computed(() => cn('w-full', this.class()));
|
|
89
78
|
/** Get current value(s) */
|
|
90
79
|
readonly value = computed(() => {
|
|
91
80
|
const controlled = this.controlledValue();
|
|
@@ -99,6 +88,14 @@ export class Accordion implements AccordionContext {
|
|
|
99
88
|
return Array.from(items);
|
|
100
89
|
});
|
|
101
90
|
|
|
91
|
+
/** Internal state for open items */
|
|
92
|
+
private readonly openItems = signal<Set<string>>(new Set());
|
|
93
|
+
/** Registry of item values for keyboard navigation */
|
|
94
|
+
readonly itemValues = signal<string[]>([]);
|
|
95
|
+
|
|
96
|
+
/** Flag to track if initialized */
|
|
97
|
+
private initialized = false;
|
|
98
|
+
|
|
102
99
|
/** Handle value change from accordion items */
|
|
103
100
|
onValueChange(itemValue: string): void {
|
|
104
101
|
const currentType = this.type();
|
|
@@ -127,8 +124,8 @@ export class Accordion implements AccordionContext {
|
|
|
127
124
|
|
|
128
125
|
return newSet;
|
|
129
126
|
});
|
|
127
|
+
this.valueChange.emit(this.value());
|
|
130
128
|
}
|
|
131
|
-
|
|
132
129
|
/** Check if an item is open */
|
|
133
130
|
isItemOpen(itemValue: string): boolean {
|
|
134
131
|
const controlled = this.controlledValue();
|
|
@@ -140,7 +137,6 @@ export class Accordion implements AccordionContext {
|
|
|
140
137
|
}
|
|
141
138
|
return this.openItems().has(itemValue);
|
|
142
139
|
}
|
|
143
|
-
|
|
144
140
|
/** Handle keyboard navigation */
|
|
145
141
|
onKeydown(event: KeyboardEvent): void {
|
|
146
142
|
const values = this.itemValues();
|
|
@@ -153,8 +149,13 @@ export class Accordion implements AccordionContext {
|
|
|
153
149
|
|
|
154
150
|
// Find current index by looking at the accordion item
|
|
155
151
|
const accordionItem = currentTrigger.closest('AccordionItem');
|
|
156
|
-
const itemValue =
|
|
157
|
-
|
|
152
|
+
const itemValue =
|
|
153
|
+
accordionItem?.getAttribute('data-value') ||
|
|
154
|
+
values.find((v) =>
|
|
155
|
+
document
|
|
156
|
+
.querySelector(`AccordionItem[data-state][data-value="${v}"]`)
|
|
157
|
+
?.contains(currentTrigger),
|
|
158
|
+
);
|
|
158
159
|
|
|
159
160
|
if (!itemValue) return;
|
|
160
161
|
const currentIndex = values.indexOf(itemValue);
|
|
@@ -184,14 +185,24 @@ export class Accordion implements AccordionContext {
|
|
|
184
185
|
|
|
185
186
|
if (handled) {
|
|
186
187
|
event.preventDefault();
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
const direction =
|
|
189
|
+
event.key === 'ArrowDown' || event.key === 'End' ? 1 : -1;
|
|
190
|
+
let attempts = 0;
|
|
191
|
+
while (attempts < values.length) {
|
|
192
|
+
const candidateValue = values[newIndex];
|
|
193
|
+
const candidateItem = document.querySelector(
|
|
194
|
+
`AccordionItem[data-value="${candidateValue}"]`,
|
|
195
|
+
);
|
|
196
|
+
if (!candidateItem?.hasAttribute('data-disabled')) {
|
|
197
|
+
const trigger = document.querySelector(
|
|
198
|
+
`AccordionItem[data-value="${candidateValue}"] AccordionTrigger`,
|
|
199
|
+
) as HTMLElement;
|
|
200
|
+
trigger?.focus();
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
newIndex = (newIndex + direction + values.length) % values.length;
|
|
204
|
+
attempts++;
|
|
205
|
+
}
|
|
193
206
|
}
|
|
194
207
|
}
|
|
195
|
-
|
|
196
|
-
protected readonly computedClass = computed(() => cn('w-full', this.class()));
|
|
197
208
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Context and types
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
ACCORDION_CONTEXT,
|
|
4
|
+
ACCORDION_ITEM_CONTEXT,
|
|
5
|
+
type AccordionContext,
|
|
6
|
+
type AccordionItemContext,
|
|
7
|
+
type AccordionType,
|
|
8
8
|
} from './accordion-context';
|
|
9
9
|
|
|
10
10
|
// Components
|
|
@@ -12,4 +12,3 @@ export { AccordionContent } from './accordion-content.component';
|
|
|
12
12
|
export { AccordionItem } from './accordion-item.component';
|
|
13
13
|
export { AccordionTrigger } from './accordion-trigger.component';
|
|
14
14
|
export { Accordion } from './accordion.component';
|
|
15
|
-
|
|
@@ -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
|
* Alert description component.
|
|
@@ -27,7 +22,7 @@ export class AlertDescription {
|
|
|
27
22
|
protected readonly computedClass = computed(() =>
|
|
28
23
|
cn(
|
|
29
24
|
'text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed',
|
|
30
|
-
this.class()
|
|
31
|
-
)
|
|
25
|
+
this.class(),
|
|
26
|
+
),
|
|
32
27
|
);
|
|
33
28
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* Alert title component.
|
|
@@ -25,6 +20,6 @@ export class AlertTitle {
|
|
|
25
20
|
readonly class = input<string>('');
|
|
26
21
|
|
|
27
22
|
protected readonly computedClass = computed(() =>
|
|
28
|
-
cn('col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight', this.class())
|
|
23
|
+
cn('col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight', this.class()),
|
|
29
24
|
);
|
|
30
25
|
}
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Alert variants using class-variance-authority
|
|
5
|
-
*
|
|
4
|
+
* Alert variants using class-variance-authority.
|
|
5
|
+
* Selectors cover both native <svg> and lucide-angular's <lucide-icon> element.
|
|
6
6
|
*/
|
|
7
7
|
export const alertVariants = cva(
|
|
8
|
-
|
|
8
|
+
[
|
|
9
|
+
'relative w-full rounded-lg border px-4 py-3 text-sm',
|
|
10
|
+
// Grid base — 1-col by default, switches to 2-col when icon is present
|
|
11
|
+
'grid grid-cols-[0_1fr]',
|
|
12
|
+
'has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr]',
|
|
13
|
+
'has-[>lucide-icon]:grid-cols-[calc(var(--spacing)*4)_1fr]',
|
|
14
|
+
// Column gap when icon present
|
|
15
|
+
'has-[>svg]:gap-x-3',
|
|
16
|
+
'has-[>lucide-icon]:gap-x-3',
|
|
17
|
+
'gap-y-0.5 items-start',
|
|
18
|
+
// Icon sizing and alignment — native SVG
|
|
19
|
+
'[&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',
|
|
20
|
+
// Icon sizing and alignment — lucide-angular
|
|
21
|
+
'[&>lucide-icon]:size-4 [&>lucide-icon]:translate-y-0.5 [&>lucide-icon]:text-current',
|
|
22
|
+
].join(' '),
|
|
9
23
|
{
|
|
10
24
|
variants: {
|
|
11
25
|
variant: {
|
|
12
26
|
default: 'bg-card text-card-foreground border-border',
|
|
13
27
|
destructive:
|
|
14
|
-
'bg-destructive/10 text-destructive border-destructive/30 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90',
|
|
28
|
+
'bg-destructive/10 text-destructive border-destructive/30 [&>svg]:text-current [&>lucide-icon]:text-current *:data-[slot=alert-description]:text-destructive/90',
|
|
15
29
|
},
|
|
16
30
|
},
|
|
17
31
|
defaultVariants: {
|
|
18
32
|
variant: 'default',
|
|
19
33
|
},
|
|
20
|
-
}
|
|
34
|
+
},
|
|
21
35
|
);
|
|
22
36
|
|
|
23
37
|
export type AlertVariants = VariantProps<typeof alertVariants>;
|
|
@@ -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
|
import { alertVariants, type AlertVariants } from './alert-variants';
|
|
9
4
|
|
|
10
5
|
/**
|
|
@@ -42,9 +37,6 @@ export class Alert {
|
|
|
42
37
|
readonly class = input<string>('');
|
|
43
38
|
|
|
44
39
|
protected readonly computedClass = computed(() =>
|
|
45
|
-
cn(
|
|
46
|
-
alertVariants({ variant: this.variant() }),
|
|
47
|
-
this.class()
|
|
48
|
-
)
|
|
40
|
+
cn(alertVariants({ variant: this.variant() }), this.class()),
|
|
49
41
|
);
|
|
50
42
|
}
|
|
@@ -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 { buttonVariants } from '../button/button-variants';
|
|
10
4
|
import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
11
5
|
|
|
@@ -21,20 +15,19 @@ import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
|
21
15
|
selector: 'AlertDialogAction',
|
|
22
16
|
template: `<ng-content />`,
|
|
23
17
|
host: {
|
|
18
|
+
'attr.data-slot': '"alert-dialog-action"',
|
|
24
19
|
'[class]': 'computedClass()',
|
|
25
20
|
'(click)': 'onClick($event)',
|
|
26
21
|
},
|
|
27
22
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
23
|
})
|
|
29
24
|
export class AlertDialogAction {
|
|
30
|
-
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
31
|
-
|
|
32
25
|
/** Additional CSS classes to apply */
|
|
33
26
|
readonly class = input<string>('');
|
|
34
27
|
|
|
35
|
-
protected readonly
|
|
36
|
-
|
|
37
|
-
);
|
|
28
|
+
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
29
|
+
|
|
30
|
+
protected readonly computedClass = computed(() => cn(buttonVariants(), this.class()));
|
|
38
31
|
|
|
39
32
|
onClick(event: Event): void {
|
|
40
33
|
// Allow the click to propagate for custom handlers
|