@ng-cn/core 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +34 -33
- package/schematics/component/index.js +454 -95
- package/schematics/component/index.ts +459 -98
- package/schematics/ng-add/index.js +539 -55
- package/schematics/ng-add/index.ts +555 -62
- package/schematics/ng-add/schema.json +8 -2
- package/schematics/test-schematic.js +1 -2
- package/src/app/lib/components/ui/.gitkeep +0 -0
- package/src/app/lib/components/ui/accordion/accordion-content.component.ts +16 -24
- package/src/app/lib/components/ui/accordion/accordion-context.ts +4 -9
- package/src/app/lib/components/ui/accordion/accordion-item.component.ts +33 -29
- package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +11 -14
- package/src/app/lib/components/ui/accordion/accordion.component.ts +60 -49
- package/src/app/lib/components/ui/accordion/index.ts +5 -6
- package/src/app/lib/components/ui/alert/alert-description.component.ts +3 -8
- package/src/app/lib/components/ui/alert/alert-title.component.ts +2 -7
- package/src/app/lib/components/ui/alert/alert-variants.ts +19 -5
- package/src/app/lib/components/ui/alert/alert.component.ts +2 -10
- package/src/app/lib/components/ui/alert/index.ts +0 -1
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +5 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +5 -11
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +63 -66
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-context.ts +10 -5
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +5 -10
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +3 -7
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +3 -7
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +5 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +8 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +28 -34
- package/src/app/lib/components/ui/alert-dialog/index.ts +0 -1
- package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +3 -9
- package/src/app/lib/components/ui/avatar/avatar-context.ts +9 -0
- package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +7 -18
- package/src/app/lib/components/ui/avatar/avatar-image.component.ts +39 -17
- package/src/app/lib/components/ui/avatar/avatar.component.ts +17 -20
- package/src/app/lib/components/ui/avatar/index.ts +1 -1
- package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +9 -30
- package/src/app/lib/components/ui/badge/badge-variants.ts +5 -5
- package/src/app/lib/components/ui/badge/badge.component.ts +4 -8
- package/src/app/lib/components/ui/badge/index.ts +0 -1
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +5 -14
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +6 -18
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +6 -15
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +22 -31
- package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +3 -9
- package/src/app/lib/components/ui/breadcrumb/index.ts +0 -1
- package/src/app/lib/components/ui/button/button-variants.ts +6 -8
- package/src/app/lib/components/ui/button/button.component.ts +4 -8
- package/src/app/lib/components/ui/button/index.ts +0 -1
- package/src/app/lib/components/ui/button-group/button-group-variants.ts +12 -15
- package/src/app/lib/components/ui/button-group/button-group.component.ts +6 -14
- package/src/app/lib/components/ui/button-group/index.ts +1 -5
- package/src/app/lib/components/ui/calendar/calendar.component.ts +103 -115
- package/src/app/lib/components/ui/card/card-action.component.ts +2 -10
- package/src/app/lib/components/ui/card/card-content.component.ts +1 -6
- package/src/app/lib/components/ui/card/card-description.component.ts +2 -7
- package/src/app/lib/components/ui/card/card-footer.component.ts +2 -7
- package/src/app/lib/components/ui/card/card-header.component.ts +3 -8
- package/src/app/lib/components/ui/card/card-title.component.ts +2 -9
- package/src/app/lib/components/ui/card/card.component.ts +3 -8
- package/src/app/lib/components/ui/card/index.ts +0 -1
- package/src/app/lib/components/ui/carousel/carousel-content.component.ts +3 -9
- package/src/app/lib/components/ui/carousel/carousel-item.component.ts +5 -5
- package/src/app/lib/components/ui/carousel/carousel-next.component.ts +9 -8
- package/src/app/lib/components/ui/carousel/carousel-previous.component.ts +9 -8
- package/src/app/lib/components/ui/carousel/carousel.component.ts +14 -25
- package/src/app/lib/components/ui/carousel/index.ts +5 -2
- package/src/app/lib/components/ui/chart/chart-container.component.ts +20 -26
- package/src/app/lib/components/ui/chart/chart-legend-content.component.ts +6 -16
- package/src/app/lib/components/ui/chart/chart-legend.component.ts +2 -7
- package/src/app/lib/components/ui/chart/chart-tooltip-content.component.ts +2 -9
- package/src/app/lib/components/ui/chart/chart-tooltip.component.ts +2 -7
- package/src/app/lib/components/ui/chart/chart.component.ts +12 -32
- package/src/app/lib/components/ui/chart/index.ts +7 -8
- package/src/app/lib/components/ui/checkbox/checkbox.component.ts +55 -74
- package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +16 -25
- package/src/app/lib/components/ui/collapsible/collapsible-context.ts +0 -8
- package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +6 -16
- package/src/app/lib/components/ui/collapsible/collapsible.component.ts +29 -33
- package/src/app/lib/components/ui/collapsible/index.ts +0 -1
- package/src/app/lib/components/ui/combobox/combobox-content.component.ts +8 -15
- package/src/app/lib/components/ui/combobox/combobox-context.ts +5 -4
- package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +5 -12
- package/src/app/lib/components/ui/combobox/combobox-group.component.ts +3 -7
- package/src/app/lib/components/ui/combobox/combobox-input.component.ts +25 -25
- package/src/app/lib/components/ui/combobox/combobox-item.component.ts +45 -44
- package/src/app/lib/components/ui/combobox/combobox-list.component.ts +14 -12
- package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +24 -14
- package/src/app/lib/components/ui/combobox/combobox-value.component.ts +27 -22
- package/src/app/lib/components/ui/combobox/combobox.component.ts +74 -54
- package/src/app/lib/components/ui/combobox/index.ts +1 -6
- package/src/app/lib/components/ui/command/command-context.ts +1 -5
- package/src/app/lib/components/ui/command/command-dialog.component.ts +12 -14
- package/src/app/lib/components/ui/command/command-empty.component.ts +2 -3
- package/src/app/lib/components/ui/command/command-group.component.ts +32 -25
- package/src/app/lib/components/ui/command/command-input.component.ts +29 -28
- package/src/app/lib/components/ui/command/command-item.component.ts +46 -58
- package/src/app/lib/components/ui/command/command-list.component.ts +5 -4
- package/src/app/lib/components/ui/command/command-separator.component.ts +2 -3
- package/src/app/lib/components/ui/command/command-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/command/command.component.ts +33 -22
- package/src/app/lib/components/ui/command/index.ts +0 -1
- package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +20 -11
- package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +36 -43
- package/src/app/lib/components/ui/context-menu/context-menu-context.ts +1 -1
- package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +12 -13
- package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +2 -5
- package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +9 -2
- package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +14 -14
- package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +2 -3
- package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +9 -2
- package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/context-menu/context-menu.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/index.ts +15 -4
- package/src/app/lib/components/ui/data-table/data-table-content.component.ts +22 -28
- package/src/app/lib/components/ui/data-table/data-table-context.ts +1 -3
- package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +17 -27
- package/src/app/lib/components/ui/data-table/data-table-search.component.ts +6 -14
- package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +3 -7
- package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +11 -20
- package/src/app/lib/components/ui/data-table/data-table.component.ts +41 -49
- package/src/app/lib/components/ui/data-table/index.ts +7 -8
- package/src/app/lib/components/ui/date-picker/date-picker.component.ts +24 -24
- package/src/app/lib/components/ui/dialog/dialog-close.component.ts +4 -8
- package/src/app/lib/components/ui/dialog/dialog-content.component.ts +72 -73
- package/src/app/lib/components/ui/dialog/dialog-context.ts +7 -5
- package/src/app/lib/components/ui/dialog/dialog-description.component.ts +5 -10
- package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +3 -7
- package/src/app/lib/components/ui/dialog/dialog-header.component.ts +3 -7
- package/src/app/lib/components/ui/dialog/dialog-title.component.ts +5 -10
- package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/dialog/dialog.component.ts +29 -34
- package/src/app/lib/components/ui/dialog/index.ts +0 -1
- package/src/app/lib/components/ui/drawer/drawer-close.component.ts +4 -8
- package/src/app/lib/components/ui/drawer/drawer-content.component.ts +39 -35
- package/src/app/lib/components/ui/drawer/drawer-description.component.ts +5 -10
- package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +3 -7
- package/src/app/lib/components/ui/drawer/drawer-header.component.ts +3 -7
- package/src/app/lib/components/ui/drawer/drawer-title.component.ts +5 -10
- package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/drawer/drawer.component.ts +25 -26
- package/src/app/lib/components/ui/drawer/index.ts +0 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +20 -11
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +96 -61
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-context.ts +1 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-group.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-item.component.ts +10 -11
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +2 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +14 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +14 -14
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +2 -3
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +9 -2
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +6 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/index.ts +10 -3
- package/src/app/lib/components/ui/empty/empty-action.component.ts +2 -9
- package/src/app/lib/components/ui/empty/empty-description.component.ts +2 -10
- package/src/app/lib/components/ui/empty/empty-icon.component.ts +3 -8
- package/src/app/lib/components/ui/empty/empty-title.component.ts +2 -9
- package/src/app/lib/components/ui/empty/empty.component.ts +3 -8
- package/src/app/lib/components/ui/empty/index.ts +0 -1
- package/src/app/lib/components/ui/form/form-context.ts +1 -11
- package/src/app/lib/components/ui/form/form-control.component.ts +22 -22
- package/src/app/lib/components/ui/form/form-description.component.ts +4 -10
- package/src/app/lib/components/ui/form/form-field.component.ts +7 -10
- package/src/app/lib/components/ui/form/form-item.component.ts +2 -12
- package/src/app/lib/components/ui/form/form-label.component.ts +15 -15
- package/src/app/lib/components/ui/form/form-message.component.ts +7 -15
- package/src/app/lib/components/ui/form/form.component.ts +9 -20
- package/src/app/lib/components/ui/form/index.ts +4 -5
- package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +21 -33
- package/src/app/lib/components/ui/hover-card/hover-card-context.ts +0 -8
- package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +17 -26
- package/src/app/lib/components/ui/hover-card/hover-card.component.ts +18 -28
- package/src/app/lib/components/ui/hover-card/index.ts +9 -6
- package/src/app/lib/components/ui/input/input.component.ts +57 -75
- package/src/app/lib/components/ui/input-group/index.ts +0 -1
- package/src/app/lib/components/ui/input-group/input-group-addon.component.ts +4 -11
- package/src/app/lib/components/ui/input-group/input-group-input.component.ts +3 -8
- package/src/app/lib/components/ui/input-group/input-group.component.ts +4 -9
- package/src/app/lib/components/ui/input-otp/index.ts +4 -5
- package/src/app/lib/components/ui/input-otp/input-otp-context.ts +0 -8
- package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +2 -3
- package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +4 -3
- package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +8 -10
- package/src/app/lib/components/ui/input-otp/input-otp.component.ts +27 -45
- package/src/app/lib/components/ui/kbd/index.ts +0 -1
- package/src/app/lib/components/ui/kbd/kbd-variants.ts +1 -1
- package/src/app/lib/components/ui/kbd/kbd.component.ts +4 -8
- package/src/app/lib/components/ui/label/label.component.ts +15 -28
- package/src/app/lib/components/ui/menubar/index.ts +11 -8
- package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +21 -12
- package/src/app/lib/components/ui/menubar/menubar-content.component.ts +46 -53
- package/src/app/lib/components/ui/menubar/menubar-context.ts +3 -9
- package/src/app/lib/components/ui/menubar/menubar-item.component.ts +13 -14
- package/src/app/lib/components/ui/menubar/menubar-label.component.ts +2 -5
- package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +14 -2
- package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +9 -2
- package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +13 -13
- package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +2 -3
- package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +7 -6
- package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +8 -1
- package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +26 -21
- package/src/app/lib/components/ui/menubar/menubar.component.ts +6 -13
- package/src/app/lib/components/ui/native-select/index.ts +1 -5
- package/src/app/lib/components/ui/native-select/native-select-variants.ts +1 -1
- package/src/app/lib/components/ui/native-select/native-select.component.ts +14 -15
- package/src/app/lib/components/ui/navigation-menu/index.ts +10 -8
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +18 -13
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-context.ts +2 -10
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +3 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +6 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +3 -8
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +2 -4
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger-style.ts +1 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +3 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +8 -15
- package/src/app/lib/components/ui/pagination/index.ts +0 -1
- package/src/app/lib/components/ui/pagination/pagination-content.component.ts +3 -7
- package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +3 -7
- package/src/app/lib/components/ui/pagination/pagination-item.component.ts +3 -9
- package/src/app/lib/components/ui/pagination/pagination-link.component.ts +4 -8
- package/src/app/lib/components/ui/pagination/pagination-next.component.ts +3 -11
- package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +3 -11
- package/src/app/lib/components/ui/pagination/pagination.component.ts +3 -7
- package/src/app/lib/components/ui/popover/index.ts +9 -6
- package/src/app/lib/components/ui/popover/popover-anchor.component.ts +2 -13
- package/src/app/lib/components/ui/popover/popover-content.component.ts +119 -69
- package/src/app/lib/components/ui/popover/popover-context.ts +0 -8
- package/src/app/lib/components/ui/popover/popover-trigger.component.ts +22 -22
- package/src/app/lib/components/ui/popover/popover.component.ts +20 -33
- package/src/app/lib/components/ui/progress/index.ts +1 -6
- package/src/app/lib/components/ui/progress/progress.component.ts +15 -30
- package/src/app/lib/components/ui/radio-group/index.ts +1 -4
- package/src/app/lib/components/ui/radio-group/radio-group-context.ts +1 -7
- package/src/app/lib/components/ui/radio-group/radio-group-item.component.ts +36 -69
- package/src/app/lib/components/ui/radio-group/radio-group.component.ts +38 -67
- package/src/app/lib/components/ui/resizable/index.ts +0 -1
- package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +25 -39
- package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +15 -18
- package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +12 -31
- package/src/app/lib/components/ui/scroll-area/index.ts +4 -5
- package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +5 -19
- package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +8 -27
- package/src/app/lib/components/ui/segmented/index.ts +5 -9
- package/src/app/lib/components/ui/segmented/segmented-context.ts +1 -3
- package/src/app/lib/components/ui/segmented/segmented-item.component.ts +21 -29
- package/src/app/lib/components/ui/segmented/segmented-variants.ts +2 -2
- package/src/app/lib/components/ui/segmented/segmented.component.ts +24 -32
- package/src/app/lib/components/ui/select/index.ts +5 -6
- package/src/app/lib/components/ui/select/select-content.component.ts +34 -62
- package/src/app/lib/components/ui/select/select-context.ts +4 -14
- package/src/app/lib/components/ui/select/select-group.component.ts +6 -7
- package/src/app/lib/components/ui/select/select-item.component.ts +46 -55
- package/src/app/lib/components/ui/select/select-label.component.ts +2 -7
- package/src/app/lib/components/ui/select/select-separator.component.ts +3 -8
- package/src/app/lib/components/ui/select/select-trigger.component.ts +28 -25
- package/src/app/lib/components/ui/select/select-value.component.ts +7 -13
- package/src/app/lib/components/ui/select/select.component.ts +52 -64
- package/src/app/lib/components/ui/separator/index.ts +1 -6
- package/src/app/lib/components/ui/separator/separator.component.ts +4 -19
- package/src/app/lib/components/ui/sheet/index.ts +0 -1
- package/src/app/lib/components/ui/sheet/sheet-close.component.ts +4 -8
- package/src/app/lib/components/ui/sheet/sheet-content.component.ts +31 -36
- package/src/app/lib/components/ui/sheet/sheet-description.component.ts +5 -10
- package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +3 -7
- package/src/app/lib/components/ui/sheet/sheet-header.component.ts +3 -7
- package/src/app/lib/components/ui/sheet/sheet-title.component.ts +5 -10
- package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/sheet/sheet-variants.ts +1 -1
- package/src/app/lib/components/ui/sheet/sheet.component.ts +36 -36
- package/src/app/lib/components/ui/sidebar/index.ts +14 -15
- package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-context.ts +1 -3
- package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +4 -9
- package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +2 -6
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +46 -52
- package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar-route-active.service.ts +17 -17
- package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar.component.ts +20 -31
- package/src/app/lib/components/ui/skeleton/skeleton.component.ts +3 -8
- package/src/app/lib/components/ui/slider/index.ts +1 -6
- package/src/app/lib/components/ui/slider/slider.component.ts +73 -138
- package/src/app/lib/components/ui/spinner/index.ts +0 -1
- package/src/app/lib/components/ui/spinner/spinner-variants.ts +19 -22
- package/src/app/lib/components/ui/spinner/spinner.component.ts +4 -8
- package/src/app/lib/components/ui/switch/index.ts +1 -6
- package/src/app/lib/components/ui/switch/switch.component.ts +83 -108
- package/src/app/lib/components/ui/table/index.ts +0 -1
- package/src/app/lib/components/ui/table/table-body.component.ts +6 -10
- package/src/app/lib/components/ui/table/table-caption.component.ts +6 -8
- package/src/app/lib/components/ui/table/table-cell.component.ts +4 -8
- package/src/app/lib/components/ui/table/table-footer.component.ts +6 -8
- package/src/app/lib/components/ui/table/table-head.component.ts +4 -8
- package/src/app/lib/components/ui/table/table-header.component.ts +6 -10
- package/src/app/lib/components/ui/table/table-row.component.ts +6 -11
- package/src/app/lib/components/ui/table/table.component.ts +4 -8
- package/src/app/lib/components/ui/tabs/index.ts +14 -7
- package/src/app/lib/components/ui/tabs/tabs-content.component.ts +11 -36
- package/src/app/lib/components/ui/tabs/tabs-context.ts +0 -8
- package/src/app/lib/components/ui/tabs/tabs-list.component.ts +54 -60
- package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +20 -35
- package/src/app/lib/components/ui/tabs/tabs.component.ts +32 -49
- package/src/app/lib/components/ui/textarea/textarea.component.ts +3 -8
- package/src/app/lib/components/ui/toast/index.ts +6 -7
- package/src/app/lib/components/ui/toast/toast-action.component.ts +7 -18
- package/src/app/lib/components/ui/toast/toast-description.component.ts +2 -11
- package/src/app/lib/components/ui/toast/toast-title.component.ts +2 -9
- package/src/app/lib/components/ui/toast/toast-variants.ts +1 -1
- package/src/app/lib/components/ui/toast/toast.component.ts +18 -24
- package/src/app/lib/components/ui/toast/toast.service.ts +22 -37
- package/src/app/lib/components/ui/toast/toaster.component.ts +6 -16
- package/src/app/lib/components/ui/toggle/index.ts +1 -5
- package/src/app/lib/components/ui/toggle/toggle-variants.ts +2 -2
- package/src/app/lib/components/ui/toggle/toggle.component.ts +32 -51
- package/src/app/lib/components/ui/toggle-group/index.ts +1 -4
- package/src/app/lib/components/ui/toggle-group/toggle-group-context.ts +1 -7
- package/src/app/lib/components/ui/toggle-group/toggle-group-item.component.ts +38 -59
- package/src/app/lib/components/ui/toggle-group/toggle-group.component.ts +33 -51
- package/src/app/lib/components/ui/tooltip/index.ts +9 -6
- package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +6 -24
- package/src/app/lib/components/ui/tooltip/tooltip-context.ts +0 -8
- package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +12 -24
- package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +4 -21
- package/src/app/lib/components/ui/tooltip/tooltip.component.ts +21 -33
- package/src/app/lib/components/ui/typography/index.ts +0 -1
- package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-h1.component.ts +3 -10
- package/src/app/lib/components/ui/typography/typography-h2.component.ts +3 -10
- package/src/app/lib/components/ui/typography/typography-h3.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-h4.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +4 -8
- package/src/app/lib/components/ui/typography/typography-large.component.ts +3 -9
- package/src/app/lib/components/ui/typography/typography-lead.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-list.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-muted.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-p.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-small.component.ts +3 -7
- package/src/app/lib/utils/accessibility/click-outside.directive.ts +1 -8
- package/src/app/lib/utils/accessibility/focus-management.service.ts +4 -15
- package/src/app/lib/utils/accessibility/focus-trap.directive.ts +32 -106
- package/src/app/lib/utils/accessibility/index.ts +16 -5
- package/src/app/lib/utils/accessibility/keyboard-navigation.directive.ts +5 -8
- package/src/app/lib/utils/accessibility/live-region.directive.ts +10 -13
- package/src/app/lib/utils/accessibility/touch-target.directive.ts +1 -8
- package/src/app/lib/utils/animation/animation.utils.ts +4 -7
- package/src/app/lib/utils/animation/index.ts +15 -5
- package/src/app/lib/utils/animation/presence.component.ts +1 -1
- package/src/app/lib/utils/animation/presence.directive.ts +2 -2
- package/src/app/lib/utils/positioning/index.ts +40 -18
- package/src/app/lib/components/ui/index.ts +0 -551
- package/src/app/lib/index.ts +0 -7
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
9
3
|
import { buttonVariants } from '../button/button-variants';
|
|
10
4
|
import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
11
5
|
|
|
@@ -24,18 +18,18 @@ import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
|
24
18
|
host: {
|
|
25
19
|
'[class]': 'computedClass()',
|
|
26
20
|
'(click)': 'onClick($event)',
|
|
27
|
-
'data-slot': 'alert-dialog-cancel',
|
|
21
|
+
'attr.data-slot': '"alert-dialog-cancel"',
|
|
28
22
|
},
|
|
29
23
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30
24
|
})
|
|
31
25
|
export class AlertDialogCancel {
|
|
32
|
-
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
33
|
-
|
|
34
26
|
/** Additional CSS classes to apply */
|
|
35
27
|
readonly class = input<string>('');
|
|
36
28
|
|
|
29
|
+
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
30
|
+
|
|
37
31
|
protected readonly computedClass = computed(() =>
|
|
38
|
-
cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', this.class())
|
|
32
|
+
cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', this.class()),
|
|
39
33
|
);
|
|
40
34
|
|
|
41
35
|
onClick(event: Event): void {
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { cn
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
2
|
import { FocusTrapDirective } from '@/lib/utils/accessibility';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
ChangeDetectorRef,
|
|
6
|
+
Component,
|
|
7
|
+
computed,
|
|
8
|
+
DestroyRef,
|
|
9
|
+
effect,
|
|
10
|
+
HostListener,
|
|
11
|
+
inject,
|
|
12
|
+
input,
|
|
13
|
+
signal,
|
|
12
14
|
} from '@angular/core';
|
|
13
15
|
import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
14
16
|
|
|
17
|
+
/** Animation duration in ms — must match Tailwind's duration-200 */
|
|
18
|
+
const EXIT_ANIMATION_MS = 200;
|
|
19
|
+
|
|
15
20
|
/**
|
|
16
21
|
* AlertDialogContent component - the modal content of the alert dialog.
|
|
17
22
|
* Matches shadcn/ui React AlertDialogContent exactly.
|
|
@@ -21,39 +26,27 @@ import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
|
21
26
|
* - Overlay/backdrop click does NOT close the dialog
|
|
22
27
|
* - Focus is trapped within the dialog
|
|
23
28
|
* - User must explicitly click Cancel or Action to close
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* <AlertDialogContent>
|
|
27
|
-
* <AlertDialogHeader>
|
|
28
|
-
* <AlertDialogTitle>Delete Account</AlertDialogTitle>
|
|
29
|
-
* <AlertDialogDescription>Are you sure?</AlertDialogDescription>
|
|
30
|
-
* </AlertDialogHeader>
|
|
31
|
-
* <AlertDialogFooter>
|
|
32
|
-
* <AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
33
|
-
* <AlertDialogAction>Delete</AlertDialogAction>
|
|
34
|
-
* </AlertDialogFooter>
|
|
35
|
-
* </AlertDialogContent>
|
|
36
29
|
*/
|
|
37
30
|
@Component({
|
|
38
31
|
selector: 'AlertDialogContent',
|
|
39
|
-
imports: [FocusTrapDirective
|
|
32
|
+
imports: [FocusTrapDirective],
|
|
40
33
|
template: `
|
|
41
|
-
|
|
34
|
+
@if (shouldRender()) {
|
|
42
35
|
<!-- Overlay - does NOT close on click -->
|
|
43
36
|
<div
|
|
44
|
-
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
45
|
-
[attr.data-state]="context.
|
|
37
|
+
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-200"
|
|
38
|
+
[attr.data-state]="context.isOpen() ? 'open' : 'closed'"
|
|
46
39
|
aria-hidden="true"
|
|
47
40
|
></div>
|
|
48
41
|
<!-- Content Dialog -->
|
|
49
42
|
<div
|
|
50
43
|
hlmFocusTrap
|
|
51
|
-
[trapFocus]="context.
|
|
44
|
+
[trapFocus]="context.isOpen()"
|
|
52
45
|
[autoFocus]="true"
|
|
53
46
|
[restoreFocus]="false"
|
|
54
47
|
[initialFocus]="'[data-slot=alert-dialog-cancel]'"
|
|
55
48
|
[class]="computedClass()"
|
|
56
|
-
[attr.data-state]="context.
|
|
49
|
+
[attr.data-state]="context.isOpen() ? 'open' : 'closed'"
|
|
57
50
|
[attr.id]="context.contentId"
|
|
58
51
|
[attr.aria-labelledby]="context.titleId"
|
|
59
52
|
[attr.aria-describedby]="context.descriptionId"
|
|
@@ -62,21 +55,47 @@ import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
|
62
55
|
>
|
|
63
56
|
<ng-content />
|
|
64
57
|
</div>
|
|
65
|
-
|
|
58
|
+
}
|
|
66
59
|
`,
|
|
67
60
|
host: {
|
|
61
|
+
'attr.data-slot': '"alert-dialog-content"',
|
|
68
62
|
class: 'contents',
|
|
69
63
|
},
|
|
70
64
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
71
65
|
})
|
|
72
|
-
export class AlertDialogContent
|
|
73
|
-
|
|
66
|
+
export class AlertDialogContent {
|
|
67
|
+
constructor() {
|
|
68
|
+
effect(() => {
|
|
69
|
+
const isOpen = this.context.isOpen();
|
|
70
|
+
this._cdr.markForCheck();
|
|
71
|
+
|
|
72
|
+
if (isOpen) {
|
|
73
|
+
this.shouldRender.set(true);
|
|
74
|
+
this.lockBodyScroll();
|
|
75
|
+
} else {
|
|
76
|
+
this.unlockBodyScroll();
|
|
77
|
+
if (this.shouldRender()) {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
this.shouldRender.set(false);
|
|
80
|
+
this._cdr.markForCheck();
|
|
81
|
+
}, EXIT_ANIMATION_MS);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
this._destroyRef.onDestroy(() => {
|
|
87
|
+
this.unlockBodyScroll();
|
|
88
|
+
this.restoreFocus();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
74
91
|
|
|
75
|
-
/** Additional CSS classes */
|
|
76
92
|
readonly class = input<string>('');
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
private
|
|
94
|
+
private readonly _destroyRef = inject(DestroyRef);
|
|
95
|
+
private readonly _cdr = inject(ChangeDetectorRef);
|
|
96
|
+
|
|
97
|
+
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
98
|
+
protected readonly shouldRender = signal(false);
|
|
80
99
|
|
|
81
100
|
protected readonly computedClass = computed(() =>
|
|
82
101
|
cn(
|
|
@@ -87,20 +106,17 @@ export class AlertDialogContent implements OnDestroy {
|
|
|
87
106
|
'data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]',
|
|
88
107
|
'data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]',
|
|
89
108
|
'sm:rounded-lg',
|
|
90
|
-
this.class()
|
|
91
|
-
)
|
|
109
|
+
this.class(),
|
|
110
|
+
),
|
|
92
111
|
);
|
|
93
112
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.unlockBodyScroll();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
113
|
+
private previousBodyOverflow = '';
|
|
114
|
+
|
|
115
|
+
@HostListener('document:keydown.escape')
|
|
116
|
+
onEscapeKey(): void {
|
|
117
|
+
if (this.context.isOpen()) {
|
|
118
|
+
this.close();
|
|
119
|
+
}
|
|
104
120
|
}
|
|
105
121
|
|
|
106
122
|
private lockBodyScroll(): void {
|
|
@@ -109,38 +125,19 @@ export class AlertDialogContent implements OnDestroy {
|
|
|
109
125
|
document.body.style.overflow = 'hidden';
|
|
110
126
|
}
|
|
111
127
|
}
|
|
112
|
-
|
|
113
128
|
private unlockBodyScroll(): void {
|
|
114
129
|
if (typeof document !== 'undefined') {
|
|
115
130
|
document.body.style.overflow = this.previousBodyOverflow;
|
|
116
131
|
}
|
|
117
132
|
}
|
|
118
|
-
|
|
119
|
-
ngOnDestroy(): void {
|
|
120
|
-
// Restore body scroll
|
|
121
|
-
this.unlockBodyScroll();
|
|
122
|
-
// Restore focus to trigger element
|
|
123
|
-
this.restoreFocus();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@HostListener('document:keydown.escape')
|
|
127
|
-
onEscapeKey(): void {
|
|
128
|
-
if (this.context.open()) {
|
|
129
|
-
this.close();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
133
|
private close(): void {
|
|
134
134
|
this.restoreFocus();
|
|
135
135
|
this.context.setOpen(false);
|
|
136
136
|
}
|
|
137
|
-
|
|
138
137
|
private restoreFocus(): void {
|
|
139
|
-
const triggerEl = this.context.
|
|
138
|
+
const triggerEl = this.context.getTriggerElement();
|
|
140
139
|
if (triggerEl) {
|
|
141
|
-
setTimeout(() =>
|
|
142
|
-
triggerEl.focus();
|
|
143
|
-
}, 0);
|
|
140
|
+
setTimeout(() => triggerEl.focus(), 0);
|
|
144
141
|
}
|
|
145
142
|
}
|
|
146
143
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { InjectionToken
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
export interface AlertDialogContextValue {
|
|
4
|
-
open
|
|
5
|
-
|
|
4
|
+
/** Get the current open state */
|
|
5
|
+
isOpen(): boolean;
|
|
6
|
+
/** Set the open state */
|
|
7
|
+
setOpen(open: boolean): void;
|
|
6
8
|
/** Unique IDs for ARIA relationships */
|
|
7
9
|
titleId: string;
|
|
8
10
|
descriptionId: string;
|
|
9
11
|
contentId: string;
|
|
10
12
|
/** Trigger element reference for focus restoration */
|
|
11
|
-
|
|
13
|
+
setTriggerElement(element: HTMLElement | null): void;
|
|
14
|
+
getTriggerElement(): HTMLElement | null;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
export const ALERT_DIALOG_CONTEXT = new InjectionToken<AlertDialogContextValue>(
|
|
17
|
+
export const ALERT_DIALOG_CONTEXT = new InjectionToken<AlertDialogContextValue>(
|
|
18
|
+
'ALERT_DIALOG_CONTEXT',
|
|
19
|
+
);
|
|
@@ -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 { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -20,18 +14,19 @@ import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
|
20
14
|
selector: 'AlertDialogDescription',
|
|
21
15
|
template: `<ng-content />`,
|
|
22
16
|
host: {
|
|
17
|
+
'attr.data-slot': '"alert-dialog-description"',
|
|
23
18
|
'[class]': 'computedClass()',
|
|
24
19
|
'[attr.id]': 'context.descriptionId',
|
|
25
20
|
},
|
|
26
21
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
27
22
|
})
|
|
28
23
|
export class AlertDialogDescription {
|
|
29
|
-
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
30
|
-
|
|
31
24
|
/** Additional CSS classes to apply */
|
|
32
25
|
readonly class = input<string>('');
|
|
33
26
|
|
|
27
|
+
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
28
|
+
|
|
34
29
|
protected readonly computedClass = computed(() =>
|
|
35
|
-
cn('text-sm text-muted-foreground', this.class())
|
|
30
|
+
cn('text-sm text-muted-foreground', this.class()),
|
|
36
31
|
);
|
|
37
32
|
}
|
|
@@ -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
|
* AlertDialogFooter component - footer area of the alert dialog.
|
|
@@ -21,6 +16,7 @@ import {
|
|
|
21
16
|
selector: 'AlertDialogFooter',
|
|
22
17
|
template: `<ng-content />`,
|
|
23
18
|
host: {
|
|
19
|
+
'attr.data-slot': '"alert-dialog-footer"',
|
|
24
20
|
'[class]': 'computedClass()',
|
|
25
21
|
},
|
|
26
22
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -30,6 +26,6 @@ export class AlertDialogFooter {
|
|
|
30
26
|
readonly class = input<string>('');
|
|
31
27
|
|
|
32
28
|
protected readonly computedClass = computed(() =>
|
|
33
|
-
cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', this.class())
|
|
29
|
+
cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', this.class()),
|
|
34
30
|
);
|
|
35
31
|
}
|
|
@@ -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
|
* AlertDialogHeader component - header area of the alert dialog.
|
|
@@ -21,6 +16,7 @@ import {
|
|
|
21
16
|
selector: 'AlertDialogHeader',
|
|
22
17
|
template: `<ng-content />`,
|
|
23
18
|
host: {
|
|
19
|
+
'attr.data-slot': '"alert-dialog-header"',
|
|
24
20
|
'[class]': 'computedClass()',
|
|
25
21
|
},
|
|
26
22
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -30,6 +26,6 @@ export class AlertDialogHeader {
|
|
|
30
26
|
readonly class = input<string>('');
|
|
31
27
|
|
|
32
28
|
protected readonly computedClass = computed(() =>
|
|
33
|
-
cn('flex flex-col space-y-2 text-center sm:text-left', this.class())
|
|
29
|
+
cn('flex flex-col space-y-2 text-center sm:text-left', this.class()),
|
|
34
30
|
);
|
|
35
31
|
}
|
|
@@ -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 { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -20,18 +14,17 @@ import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
|
20
14
|
selector: 'AlertDialogTitle',
|
|
21
15
|
template: `<ng-content />`,
|
|
22
16
|
host: {
|
|
17
|
+
'attr.data-slot': '"alert-dialog-title"',
|
|
23
18
|
'[class]': 'computedClass()',
|
|
24
19
|
'[attr.id]': 'context.titleId',
|
|
25
20
|
},
|
|
26
21
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
27
22
|
})
|
|
28
23
|
export class AlertDialogTitle {
|
|
29
|
-
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
30
|
-
|
|
31
24
|
/** Additional CSS classes to apply */
|
|
32
25
|
readonly class = input<string>('');
|
|
33
26
|
|
|
34
|
-
protected readonly
|
|
35
|
-
|
|
36
|
-
);
|
|
27
|
+
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
28
|
+
|
|
29
|
+
protected readonly computedClass = computed(() => cn('text-lg font-semibold', this.class()));
|
|
37
30
|
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
inject,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, ElementRef, inject, input } from '@angular/core';
|
|
8
2
|
import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
9
3
|
|
|
10
4
|
/**
|
|
@@ -21,24 +15,26 @@ import { ALERT_DIALOG_CONTEXT } from './alert-dialog-context';
|
|
|
21
15
|
selector: 'AlertDialogTrigger',
|
|
22
16
|
template: `<ng-content />`,
|
|
23
17
|
host: {
|
|
18
|
+
'attr.data-slot': '"alert-dialog-trigger"',
|
|
24
19
|
'(click)': 'onClick($event)',
|
|
25
20
|
'[attr.aria-haspopup]': '"dialog"',
|
|
26
|
-
'[attr.aria-expanded]': 'context.
|
|
21
|
+
'[attr.aria-expanded]': 'context.isOpen()',
|
|
27
22
|
'[attr.aria-controls]': 'context.contentId',
|
|
28
23
|
},
|
|
29
24
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30
25
|
})
|
|
31
26
|
export class AlertDialogTrigger {
|
|
32
|
-
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
33
|
-
private readonly elementRef = inject(ElementRef<HTMLElement>);
|
|
34
|
-
|
|
35
27
|
/** Render as child (for custom trigger elements) */
|
|
36
28
|
readonly asChild = input<boolean>(false);
|
|
37
29
|
|
|
30
|
+
private readonly _elementRef = inject(ElementRef<HTMLElement>);
|
|
31
|
+
|
|
32
|
+
protected readonly context = inject(ALERT_DIALOG_CONTEXT);
|
|
33
|
+
|
|
38
34
|
onClick(event: Event): void {
|
|
39
35
|
event.stopPropagation();
|
|
40
36
|
// Save trigger element for focus restoration when dialog closes
|
|
41
|
-
this.context.
|
|
37
|
+
this.context.setTriggerElement(this._elementRef.nativeElement);
|
|
42
38
|
this.context.setOpen(true);
|
|
43
39
|
}
|
|
44
40
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { AriaIdService } from '@/lib/utils/accessibility';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
signal,
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
forwardRef,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
model,
|
|
10
9
|
} from '@angular/core';
|
|
11
10
|
import { ALERT_DIALOG_CONTEXT, type AlertDialogContextValue } from './alert-dialog-context';
|
|
12
11
|
|
|
@@ -19,7 +18,7 @@ import { ALERT_DIALOG_CONTEXT, type AlertDialogContextValue } from './alert-dial
|
|
|
19
18
|
* - User can explicitly click Cancel or Action to close
|
|
20
19
|
*
|
|
21
20
|
* @example
|
|
22
|
-
* <AlertDialog>
|
|
21
|
+
* <AlertDialog [(open)]="isOpen">
|
|
23
22
|
* <AlertDialogTrigger>
|
|
24
23
|
* <Button variant="destructive">Delete Account</Button>
|
|
25
24
|
* </AlertDialogTrigger>
|
|
@@ -44,48 +43,43 @@ import { ALERT_DIALOG_CONTEXT, type AlertDialogContextValue } from './alert-dial
|
|
|
44
43
|
useExisting: forwardRef(() => AlertDialog),
|
|
45
44
|
},
|
|
46
45
|
],
|
|
46
|
+
host: {
|
|
47
|
+
'attr.data-slot': '"alert-dialog"',
|
|
48
|
+
style: 'display: contents',
|
|
49
|
+
},
|
|
47
50
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
48
51
|
})
|
|
49
52
|
export class AlertDialog implements AlertDialogContextValue {
|
|
50
|
-
|
|
53
|
+
/** Controlled open state - uses model for proper two-way binding */
|
|
54
|
+
readonly open = model<boolean>(false);
|
|
51
55
|
|
|
52
56
|
/** Default open state */
|
|
53
57
|
readonly defaultOpen = input<boolean>(false);
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
readonly controlledOpen = input<boolean | undefined>(undefined, { alias: 'open' });
|
|
57
|
-
|
|
58
|
-
/** Open change event emitted when dialog state changes */
|
|
59
|
-
readonly openChange = output<boolean>();
|
|
60
|
-
|
|
61
|
-
/** Internal open state signal */
|
|
62
|
-
readonly open = signal(false);
|
|
59
|
+
private readonly _ariaIdService = inject(AriaIdService);
|
|
63
60
|
|
|
64
61
|
/** ARIA IDs for accessibility relationships */
|
|
65
|
-
private readonly ariaIds = this.
|
|
62
|
+
private readonly ariaIds = this._ariaIdService.generateDialogIds('alertdialog');
|
|
66
63
|
readonly titleId = this.ariaIds.titleId;
|
|
67
64
|
readonly descriptionId = this.ariaIds.descriptionId;
|
|
68
65
|
readonly contentId = this.ariaIds.contentId;
|
|
69
|
-
|
|
70
66
|
/** Reference to trigger element for focus restoration */
|
|
71
|
-
|
|
67
|
+
private triggerEl: HTMLElement | null = null;
|
|
72
68
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
69
|
+
/** Check if dialog is open - directly reads from model */
|
|
70
|
+
isOpen(): boolean {
|
|
71
|
+
return this.open();
|
|
77
72
|
}
|
|
78
|
-
|
|
79
|
-
/** Set the open state and emit change event */
|
|
73
|
+
/** Set the open state */
|
|
80
74
|
setOpen(open: boolean): void {
|
|
81
|
-
|
|
82
|
-
this.open.set(open);
|
|
83
|
-
}
|
|
84
|
-
this.openChange.emit(open);
|
|
75
|
+
this.open.set(open);
|
|
85
76
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
/** Set trigger element for focus restoration */
|
|
78
|
+
setTriggerElement(element: HTMLElement | null): void {
|
|
79
|
+
this.triggerEl = element;
|
|
80
|
+
}
|
|
81
|
+
/** Get trigger element for focus restoration */
|
|
82
|
+
getTriggerElement(): HTMLElement | null {
|
|
83
|
+
return this.triggerEl;
|
|
90
84
|
}
|
|
91
85
|
}
|
|
@@ -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
|
* AspectRatio component that maintains a fixed aspect ratio for its content.
|
|
@@ -35,6 +30,7 @@ import {
|
|
|
35
30
|
</div>
|
|
36
31
|
`,
|
|
37
32
|
host: {
|
|
33
|
+
'attr.data-slot': '"aspect-ratio"',
|
|
38
34
|
'[class]': 'computedClass()',
|
|
39
35
|
'[style.padding-bottom]': 'paddingBottom()',
|
|
40
36
|
'[style.position]': '"relative"',
|
|
@@ -57,7 +53,5 @@ export class AspectRatio {
|
|
|
57
53
|
});
|
|
58
54
|
|
|
59
55
|
/** Computed class combining base styles and custom classes */
|
|
60
|
-
protected readonly computedClass = computed(() =>
|
|
61
|
-
cn('relative block w-full', this.class())
|
|
62
|
-
);
|
|
56
|
+
protected readonly computedClass = computed(() => cn('relative block w-full', this.class()));
|
|
63
57
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InjectionToken, WritableSignal } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
export type AvatarImageStatus = 'idle' | 'loaded' | 'error';
|
|
4
|
+
|
|
5
|
+
export interface AvatarContext {
|
|
6
|
+
imageStatus: WritableSignal<AvatarImageStatus>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const AVATAR_CONTEXT = new InjectionToken<AvatarContext>('AvatarContext');
|
|
@@ -1,34 +1,23 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
3
|
+
import { AVATAR_CONTEXT } from './avatar-context';
|
|
8
4
|
|
|
9
|
-
/**
|
|
10
|
-
* Avatar fallback component.
|
|
11
|
-
* Shown when the image fails to load or is not provided.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* <AvatarFallback>JD</AvatarFallback>
|
|
15
|
-
*/
|
|
16
5
|
@Component({
|
|
17
6
|
selector: 'AvatarFallback',
|
|
18
7
|
template: `<ng-content />`,
|
|
19
8
|
host: {
|
|
9
|
+
'attr.data-slot': '"avatar-fallback"',
|
|
20
10
|
'[class]': 'computedClass()',
|
|
21
|
-
|
|
11
|
+
// Hidden via display:none when image has loaded; always in DOM for layout stability
|
|
12
|
+
'[style.display]': 'context.imageStatus() === "loaded" ? "none" : null',
|
|
22
13
|
},
|
|
23
14
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
15
|
})
|
|
25
16
|
export class AvatarFallback {
|
|
26
17
|
readonly class = input<string>('');
|
|
18
|
+
protected readonly context = inject(AVATAR_CONTEXT);
|
|
27
19
|
|
|
28
20
|
protected readonly computedClass = computed(() =>
|
|
29
|
-
cn(
|
|
30
|
-
'bg-muted flex size-full items-center justify-center rounded-full text-xs',
|
|
31
|
-
this.class()
|
|
32
|
-
)
|
|
21
|
+
cn('bg-muted flex size-full items-center justify-center rounded-full text-xs', this.class()),
|
|
33
22
|
);
|
|
34
23
|
}
|