@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,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
|
* DialogFooter component - footer area of the dialog.
|
|
@@ -14,6 +9,7 @@ import {
|
|
|
14
9
|
selector: 'DialogFooter',
|
|
15
10
|
template: `<ng-content />`,
|
|
16
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dialog-footer"',
|
|
17
13
|
'[class]': 'computedClass()',
|
|
18
14
|
},
|
|
19
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -23,6 +19,6 @@ export class DialogFooter {
|
|
|
23
19
|
readonly class = input<string>('');
|
|
24
20
|
|
|
25
21
|
protected readonly computedClass = computed(() =>
|
|
26
|
-
cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', this.class())
|
|
22
|
+
cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', this.class()),
|
|
27
23
|
);
|
|
28
24
|
}
|
|
@@ -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
|
* DialogHeader component - header area of the dialog.
|
|
@@ -14,6 +9,7 @@ import {
|
|
|
14
9
|
selector: 'DialogHeader',
|
|
15
10
|
template: `<ng-content />`,
|
|
16
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dialog-header"',
|
|
17
13
|
'[class]': 'computedClass()',
|
|
18
14
|
},
|
|
19
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -23,6 +19,6 @@ export class DialogHeader {
|
|
|
23
19
|
readonly class = input<string>('');
|
|
24
20
|
|
|
25
21
|
protected readonly computedClass = computed(() =>
|
|
26
|
-
cn('flex flex-col space-y-1.5 text-center sm:text-left', this.class())
|
|
22
|
+
cn('flex flex-col space-y-1.5 text-center sm:text-left', this.class()),
|
|
27
23
|
);
|
|
28
24
|
}
|
|
@@ -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 { DIALOG_CONTEXT } from './dialog-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -17,18 +11,19 @@ import { DIALOG_CONTEXT } from './dialog-context';
|
|
|
17
11
|
selector: 'DialogTitle',
|
|
18
12
|
template: `<ng-content />`,
|
|
19
13
|
host: {
|
|
14
|
+
'attr.data-slot': '"dialog-title"',
|
|
20
15
|
'[class]': 'computedClass()',
|
|
21
16
|
'[attr.id]': 'context.titleId',
|
|
22
17
|
},
|
|
23
18
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
19
|
})
|
|
25
20
|
export class DialogTitle {
|
|
26
|
-
protected readonly context = inject(DIALOG_CONTEXT);
|
|
27
|
-
|
|
28
21
|
/** Additional CSS classes */
|
|
29
22
|
readonly class = input<string>('');
|
|
30
23
|
|
|
24
|
+
protected readonly context = inject(DIALOG_CONTEXT);
|
|
25
|
+
|
|
31
26
|
protected readonly computedClass = computed(() =>
|
|
32
|
-
cn('text-lg font-semibold leading-none tracking-tight', this.class())
|
|
27
|
+
cn('text-lg font-semibold leading-none tracking-tight', this.class()),
|
|
33
28
|
);
|
|
34
29
|
}
|
|
@@ -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 { DIALOG_CONTEXT } from './dialog-context';
|
|
9
3
|
|
|
10
4
|
/**
|
|
@@ -15,6 +9,7 @@ import { DIALOG_CONTEXT } from './dialog-context';
|
|
|
15
9
|
selector: 'DialogTrigger',
|
|
16
10
|
template: `<ng-content />`,
|
|
17
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dialog-trigger"',
|
|
18
13
|
'(click)': 'onClick($event)',
|
|
19
14
|
'[attr.aria-haspopup]': '"dialog"',
|
|
20
15
|
'[attr.aria-expanded]': 'context.isOpen()',
|
|
@@ -23,16 +18,17 @@ import { DIALOG_CONTEXT } from './dialog-context';
|
|
|
23
18
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
19
|
})
|
|
25
20
|
export class DialogTrigger {
|
|
26
|
-
protected readonly context = inject(DIALOG_CONTEXT);
|
|
27
|
-
private readonly elementRef = inject(ElementRef<HTMLElement>);
|
|
28
|
-
|
|
29
21
|
/** Render as child */
|
|
30
22
|
readonly asChild = input<boolean>(false);
|
|
31
23
|
|
|
24
|
+
private readonly _elementRef = inject(ElementRef<HTMLElement>);
|
|
25
|
+
|
|
26
|
+
protected readonly context = inject(DIALOG_CONTEXT);
|
|
27
|
+
|
|
32
28
|
onClick(event: Event): void {
|
|
33
29
|
event.stopPropagation();
|
|
34
30
|
// Save trigger element for focus restoration
|
|
35
|
-
this.context.
|
|
31
|
+
this.context.setTriggerElement(this._elementRef.nativeElement);
|
|
36
32
|
this.context.setOpen(true);
|
|
37
33
|
}
|
|
38
34
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { AriaIdService } from '@/lib/utils/accessibility';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
output,
|
|
10
|
-
signal,
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
forwardRef,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
model,
|
|
11
9
|
} from '@angular/core';
|
|
12
10
|
import { DIALOG_CONTEXT, type DialogContextValue } from './dialog-context';
|
|
13
11
|
|
|
@@ -16,7 +14,7 @@ import { DIALOG_CONTEXT, type DialogContextValue } from './dialog-context';
|
|
|
16
14
|
* Matches shadcn/ui React Dialog exactly.
|
|
17
15
|
*
|
|
18
16
|
* @example
|
|
19
|
-
* <Dialog>
|
|
17
|
+
* <Dialog [(open)]="isOpen">
|
|
20
18
|
* <DialogTrigger>
|
|
21
19
|
* <Button variant="outline">Open Dialog</Button>
|
|
22
20
|
* </DialogTrigger>
|
|
@@ -40,48 +38,45 @@ import { DIALOG_CONTEXT, type DialogContextValue } from './dialog-context';
|
|
|
40
38
|
useExisting: forwardRef(() => Dialog),
|
|
41
39
|
},
|
|
42
40
|
],
|
|
41
|
+
host: {
|
|
42
|
+
'attr.data-slot': '"dialog"',
|
|
43
|
+
style: 'display: contents',
|
|
44
|
+
},
|
|
43
45
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
44
46
|
})
|
|
45
47
|
export class Dialog implements DialogContextValue {
|
|
46
|
-
|
|
48
|
+
/** Controlled open state - uses model for proper two-way binding */
|
|
49
|
+
readonly open = model<boolean>(false);
|
|
47
50
|
|
|
48
51
|
/** Default open state */
|
|
49
52
|
readonly defaultOpen = input<boolean>(false);
|
|
50
|
-
|
|
51
|
-
/** Controlled open state */
|
|
52
|
-
readonly controlledOpen = input<boolean | undefined>(undefined, { alias: 'open' });
|
|
53
|
-
|
|
54
53
|
/** Modal mode - prevents interaction with outside elements */
|
|
55
54
|
readonly modal = input<boolean>(true);
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
readonly openChange = output<boolean>();
|
|
59
|
-
|
|
60
|
-
readonly open = signal(false);
|
|
56
|
+
private readonly _ariaIdService = inject(AriaIdService);
|
|
61
57
|
|
|
62
58
|
/** ARIA IDs for accessibility relationships */
|
|
63
|
-
private readonly ariaIds = this.
|
|
59
|
+
private readonly ariaIds = this._ariaIdService.generateDialogIds('dialog');
|
|
64
60
|
readonly titleId = this.ariaIds.titleId;
|
|
65
61
|
readonly descriptionId = this.ariaIds.descriptionId;
|
|
66
62
|
readonly contentId = this.ariaIds.contentId;
|
|
67
|
-
|
|
68
63
|
/** Reference to trigger element for focus restoration */
|
|
69
|
-
|
|
64
|
+
private triggerEl: HTMLElement | null = null;
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
66
|
+
/** Check if dialog is open - directly reads from model */
|
|
67
|
+
isOpen(): boolean {
|
|
68
|
+
return this.open();
|
|
75
69
|
}
|
|
76
|
-
|
|
70
|
+
/** Set the open state */
|
|
77
71
|
setOpen(open: boolean): void {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
this.open.set(open);
|
|
73
|
+
}
|
|
74
|
+
/** Set trigger element for focus restoration */
|
|
75
|
+
setTriggerElement(element: HTMLElement | null): void {
|
|
76
|
+
this.triggerEl = element;
|
|
77
|
+
}
|
|
78
|
+
/** Get trigger element for focus restoration */
|
|
79
|
+
getTriggerElement(): HTMLElement | null {
|
|
80
|
+
return this.triggerEl;
|
|
82
81
|
}
|
|
83
|
-
|
|
84
|
-
readonly isOpen = computed(() =>
|
|
85
|
-
this.controlledOpen() !== undefined ? this.controlledOpen()! : this.open()
|
|
86
|
-
);
|
|
87
82
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
inject,
|
|
5
|
-
input,
|
|
6
|
-
} from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';
|
|
7
2
|
import { DRAWER_CONTEXT } from './drawer-context';
|
|
8
3
|
|
|
9
4
|
/**
|
|
@@ -14,16 +9,17 @@ import { DRAWER_CONTEXT } from './drawer-context';
|
|
|
14
9
|
selector: 'DrawerClose',
|
|
15
10
|
template: `<ng-content />`,
|
|
16
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"drawer-close"',
|
|
17
13
|
'(click)': 'onClick($event)',
|
|
18
14
|
},
|
|
19
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
16
|
})
|
|
21
17
|
export class DrawerClose {
|
|
22
|
-
protected readonly context = inject(DRAWER_CONTEXT);
|
|
23
|
-
|
|
24
18
|
/** Render as child */
|
|
25
19
|
readonly asChild = input<boolean>(false);
|
|
26
20
|
|
|
21
|
+
protected readonly context = inject(DRAWER_CONTEXT);
|
|
22
|
+
|
|
27
23
|
onClick(event: Event): void {
|
|
28
24
|
event.stopPropagation();
|
|
29
25
|
this.context.setOpen(false);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { cn, Presence } from '@/lib/utils';
|
|
2
2
|
import { FocusTrapDirective } from '@/lib/utils/accessibility';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
afterNextRender,
|
|
5
|
+
ChangeDetectionStrategy,
|
|
6
|
+
Component,
|
|
7
|
+
computed,
|
|
8
|
+
effect,
|
|
9
|
+
ElementRef,
|
|
10
|
+
inject,
|
|
11
|
+
Injector,
|
|
12
|
+
input,
|
|
13
|
+
OnDestroy,
|
|
14
|
+
viewChild,
|
|
15
15
|
} from '@angular/core';
|
|
16
16
|
import { DRAWER_CONTEXT } from './drawer-context';
|
|
17
17
|
|
|
@@ -52,30 +52,24 @@ import { DRAWER_CONTEXT } from './drawer-context';
|
|
|
52
52
|
</Presence>
|
|
53
53
|
`,
|
|
54
54
|
host: {
|
|
55
|
+
'attr.data-slot': '"drawer-content"',
|
|
55
56
|
class: 'contents',
|
|
56
57
|
},
|
|
57
58
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
58
59
|
})
|
|
59
60
|
export class DrawerContent implements OnDestroy {
|
|
60
|
-
protected readonly context = inject(DRAWER_CONTEXT);
|
|
61
|
-
private readonly contentEl = viewChild<ElementRef<HTMLElement>>('contentEl');
|
|
62
|
-
private readonly injector = inject(Injector);
|
|
63
|
-
|
|
64
|
-
/** Additional CSS classes */
|
|
65
|
-
readonly class = input<string>('');
|
|
66
|
-
|
|
67
|
-
/** Previous body overflow style for restoration */
|
|
68
|
-
private previousBodyOverflow = '';
|
|
69
|
-
|
|
70
61
|
constructor() {
|
|
71
62
|
// Handle body scroll lock and focus restoration
|
|
72
63
|
effect(() => {
|
|
73
64
|
if (this.context.open()) {
|
|
74
65
|
this.lockBodyScroll();
|
|
75
66
|
// Focus first element when opened (browser-only, deferred)
|
|
76
|
-
afterNextRender(
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
afterNextRender(
|
|
68
|
+
() => {
|
|
69
|
+
this.focusFirstElement();
|
|
70
|
+
},
|
|
71
|
+
{ injector: this._injector },
|
|
72
|
+
);
|
|
79
73
|
} else {
|
|
80
74
|
this.unlockBodyScroll();
|
|
81
75
|
this.restoreFocus();
|
|
@@ -83,16 +77,23 @@ export class DrawerContent implements OnDestroy {
|
|
|
83
77
|
});
|
|
84
78
|
}
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
private readonly contentEl = viewChild<ElementRef<HTMLElement>>('contentEl');
|
|
81
|
+
|
|
82
|
+
/** Additional CSS classes */
|
|
83
|
+
readonly class = input<string>('');
|
|
84
|
+
|
|
85
|
+
private readonly _injector = inject(Injector);
|
|
86
|
+
|
|
87
|
+
protected readonly context = inject(DRAWER_CONTEXT);
|
|
89
88
|
|
|
90
89
|
protected readonly computedClass = computed(() => {
|
|
91
90
|
const directionClasses = {
|
|
92
91
|
top: 'inset-x-0 top-0 mb-24 rounded-b-[10px] border-b data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top',
|
|
93
|
-
bottom:
|
|
92
|
+
bottom:
|
|
93
|
+
'inset-x-0 bottom-0 mt-24 rounded-t-[10px] border-t data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom',
|
|
94
94
|
left: 'inset-y-0 left-0 mr-24 w-auto rounded-r-[10px] border-r data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left',
|
|
95
|
-
right:
|
|
95
|
+
right:
|
|
96
|
+
'inset-y-0 right-0 ml-24 w-auto rounded-l-[10px] border-l data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right',
|
|
96
97
|
};
|
|
97
98
|
|
|
98
99
|
return cn(
|
|
@@ -100,15 +101,21 @@ export class DrawerContent implements OnDestroy {
|
|
|
100
101
|
'data-[state=open]:animate-in data-[state=closed]:animate-out',
|
|
101
102
|
'data-[state=open]:duration-500 data-[state=closed]:duration-300',
|
|
102
103
|
directionClasses[this.context.direction],
|
|
103
|
-
this.class()
|
|
104
|
+
this.class(),
|
|
104
105
|
);
|
|
105
106
|
});
|
|
106
107
|
|
|
108
|
+
/** Previous body overflow style for restoration */
|
|
109
|
+
private previousBodyOverflow = '';
|
|
110
|
+
|
|
111
|
+
ngOnDestroy(): void {
|
|
112
|
+
this.unlockBodyScroll();
|
|
113
|
+
}
|
|
114
|
+
|
|
107
115
|
onOverlayClick(event: Event): void {
|
|
108
116
|
event.stopPropagation();
|
|
109
117
|
this.context.setOpen(false);
|
|
110
118
|
}
|
|
111
|
-
|
|
112
119
|
onEscapeKey(): void {
|
|
113
120
|
this.context.setOpen(false);
|
|
114
121
|
}
|
|
@@ -118,25 +125,22 @@ export class DrawerContent implements OnDestroy {
|
|
|
118
125
|
const content = this.contentEl()?.nativeElement;
|
|
119
126
|
if (content) {
|
|
120
127
|
const focusable = content.querySelector(
|
|
121
|
-
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
128
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',
|
|
122
129
|
) as HTMLElement;
|
|
123
130
|
focusable?.focus();
|
|
124
131
|
}
|
|
125
132
|
});
|
|
126
133
|
}
|
|
127
|
-
|
|
128
134
|
private restoreFocus(): void {
|
|
129
135
|
const trigger = this.context.triggerElement();
|
|
130
136
|
if (trigger) {
|
|
131
137
|
setTimeout(() => trigger.focus());
|
|
132
138
|
}
|
|
133
139
|
}
|
|
134
|
-
|
|
135
140
|
private lockBodyScroll(): void {
|
|
136
141
|
this.previousBodyOverflow = document.body.style.overflow;
|
|
137
142
|
document.body.style.overflow = 'hidden';
|
|
138
143
|
}
|
|
139
|
-
|
|
140
144
|
private unlockBodyScroll(): void {
|
|
141
145
|
document.body.style.overflow = this.previousBodyOverflow;
|
|
142
146
|
}
|
|
@@ -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 { DRAWER_CONTEXT } from './drawer-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -16,18 +10,19 @@ import { DRAWER_CONTEXT } from './drawer-context';
|
|
|
16
10
|
selector: 'DrawerDescription',
|
|
17
11
|
template: `<ng-content />`,
|
|
18
12
|
host: {
|
|
13
|
+
'attr.data-slot': '"drawer-description"',
|
|
19
14
|
'[class]': 'computedClass()',
|
|
20
15
|
'[attr.id]': 'context.descriptionId',
|
|
21
16
|
},
|
|
22
17
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
23
18
|
})
|
|
24
19
|
export class DrawerDescription {
|
|
25
|
-
protected readonly context = inject(DRAWER_CONTEXT);
|
|
26
|
-
|
|
27
20
|
/** Additional CSS classes */
|
|
28
21
|
readonly class = input<string>('');
|
|
29
22
|
|
|
23
|
+
protected readonly context = inject(DRAWER_CONTEXT);
|
|
24
|
+
|
|
30
25
|
protected readonly computedClass = computed(() =>
|
|
31
|
-
cn('text-sm text-muted-foreground', this.class())
|
|
26
|
+
cn('text-sm text-muted-foreground', this.class()),
|
|
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
|
* DrawerFooter component - footer area of the drawer.
|
|
@@ -14,6 +9,7 @@ import {
|
|
|
14
9
|
selector: 'DrawerFooter',
|
|
15
10
|
template: `<ng-content />`,
|
|
16
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"drawer-footer"',
|
|
17
13
|
'[class]': 'computedClass()',
|
|
18
14
|
},
|
|
19
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -23,6 +19,6 @@ export class DrawerFooter {
|
|
|
23
19
|
readonly class = input<string>('');
|
|
24
20
|
|
|
25
21
|
protected readonly computedClass = computed(() =>
|
|
26
|
-
cn('mt-auto flex flex-col gap-2 p-4', this.class())
|
|
22
|
+
cn('mt-auto flex flex-col gap-2 p-4', this.class()),
|
|
27
23
|
);
|
|
28
24
|
}
|
|
@@ -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
|
* DrawerHeader component - header area of the drawer.
|
|
@@ -14,6 +9,7 @@ import {
|
|
|
14
9
|
selector: 'DrawerHeader',
|
|
15
10
|
template: `<ng-content />`,
|
|
16
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"drawer-header"',
|
|
17
13
|
'[class]': 'computedClass()',
|
|
18
14
|
},
|
|
19
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -23,6 +19,6 @@ export class DrawerHeader {
|
|
|
23
19
|
readonly class = input<string>('');
|
|
24
20
|
|
|
25
21
|
protected readonly computedClass = computed(() =>
|
|
26
|
-
cn('grid gap-1.5 p-4 text-center sm:text-left', this.class())
|
|
22
|
+
cn('grid gap-1.5 p-4 text-center sm:text-left', this.class()),
|
|
27
23
|
);
|
|
28
24
|
}
|
|
@@ -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 { DRAWER_CONTEXT } from './drawer-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -16,18 +10,19 @@ import { DRAWER_CONTEXT } from './drawer-context';
|
|
|
16
10
|
selector: 'DrawerTitle',
|
|
17
11
|
template: `<ng-content />`,
|
|
18
12
|
host: {
|
|
13
|
+
'attr.data-slot': '"drawer-title"',
|
|
19
14
|
'[class]': 'computedClass()',
|
|
20
15
|
'[attr.id]': 'context.titleId',
|
|
21
16
|
},
|
|
22
17
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
23
18
|
})
|
|
24
19
|
export class DrawerTitle {
|
|
25
|
-
protected readonly context = inject(DRAWER_CONTEXT);
|
|
26
|
-
|
|
27
20
|
/** Additional CSS classes */
|
|
28
21
|
readonly class = input<string>('');
|
|
29
22
|
|
|
23
|
+
protected readonly context = inject(DRAWER_CONTEXT);
|
|
24
|
+
|
|
30
25
|
protected readonly computedClass = computed(() =>
|
|
31
|
-
cn('text-lg font-semibold leading-none tracking-tight', this.class())
|
|
26
|
+
cn('text-lg font-semibold leading-none tracking-tight', this.class()),
|
|
32
27
|
);
|
|
33
28
|
}
|
|
@@ -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 { DRAWER_CONTEXT } from './drawer-context';
|
|
9
3
|
|
|
10
4
|
/**
|
|
@@ -15,6 +9,7 @@ import { DRAWER_CONTEXT } from './drawer-context';
|
|
|
15
9
|
selector: 'DrawerTrigger',
|
|
16
10
|
template: `<ng-content />`,
|
|
17
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"drawer-trigger"',
|
|
18
13
|
'(click)': 'onClick($event)',
|
|
19
14
|
'[attr.aria-controls]': 'context.contentId',
|
|
20
15
|
'[attr.aria-expanded]': 'context.open()',
|
|
@@ -23,16 +18,17 @@ import { DRAWER_CONTEXT } from './drawer-context';
|
|
|
23
18
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
19
|
})
|
|
25
20
|
export class DrawerTrigger {
|
|
26
|
-
protected readonly context = inject(DRAWER_CONTEXT);
|
|
27
|
-
private readonly elementRef = inject(ElementRef<HTMLElement>);
|
|
28
|
-
|
|
29
21
|
/** Render as child */
|
|
30
22
|
readonly asChild = input<boolean>(false);
|
|
31
23
|
|
|
24
|
+
private readonly _elementRef = inject(ElementRef<HTMLElement>);
|
|
25
|
+
|
|
26
|
+
protected readonly context = inject(DRAWER_CONTEXT);
|
|
27
|
+
|
|
32
28
|
onClick(event: Event): void {
|
|
33
29
|
event.stopPropagation();
|
|
34
30
|
// Save trigger element for focus restoration
|
|
35
|
-
this.context.triggerElement.set(this.
|
|
31
|
+
this.context.triggerElement.set(this._elementRef.nativeElement);
|
|
36
32
|
this.context.setOpen(true);
|
|
37
33
|
}
|
|
38
34
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AriaIdService } from '@/lib/utils/accessibility';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
forwardRef,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
output,
|
|
9
|
+
signal,
|
|
10
10
|
} from '@angular/core';
|
|
11
11
|
import { DRAWER_CONTEXT, type DrawerContextValue } from './drawer-context';
|
|
12
12
|
|
|
@@ -37,6 +37,10 @@ import { DRAWER_CONTEXT, type DrawerContextValue } from './drawer-context';
|
|
|
37
37
|
@Component({
|
|
38
38
|
selector: 'Drawer',
|
|
39
39
|
template: `<ng-content />`,
|
|
40
|
+
host: {
|
|
41
|
+
'attr.data-slot': '"drawer"',
|
|
42
|
+
style: 'display: contents',
|
|
43
|
+
},
|
|
40
44
|
providers: [
|
|
41
45
|
{
|
|
42
46
|
provide: DRAWER_CONTEXT,
|
|
@@ -46,47 +50,42 @@ import { DRAWER_CONTEXT, type DrawerContextValue } from './drawer-context';
|
|
|
46
50
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
47
51
|
})
|
|
48
52
|
export class Drawer implements DrawerContextValue {
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
constructor() {
|
|
54
|
+
if (this.defaultOpen()) {
|
|
55
|
+
this.open.set(true);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Open change event */
|
|
60
|
+
readonly openChange = output<boolean>();
|
|
51
61
|
|
|
52
62
|
/** Default open state */
|
|
53
63
|
readonly defaultOpen = input<boolean>(false);
|
|
54
|
-
|
|
55
64
|
/** Controlled open state */
|
|
56
65
|
readonly controlledOpen = input<boolean | undefined>(undefined, { alias: 'open' });
|
|
57
|
-
|
|
58
|
-
/** Direction the drawer appears from */
|
|
59
|
-
readonly direction: 'top' | 'right' | 'bottom' | 'left' = 'bottom';
|
|
60
|
-
|
|
61
66
|
/** Whether to show the handle bar */
|
|
62
67
|
readonly shouldScaleBackground = input<boolean>(true);
|
|
63
68
|
|
|
64
|
-
|
|
65
|
-
readonly openChange = output<boolean>();
|
|
69
|
+
private readonly _ariaIdService = inject(AriaIdService);
|
|
66
70
|
|
|
67
71
|
readonly open = signal(false);
|
|
72
|
+
/** Reference to the trigger element for focus restoration */
|
|
73
|
+
readonly triggerElement = signal<HTMLElement | null>(null);
|
|
68
74
|
|
|
75
|
+
private readonly ariaIds = this._ariaIdService.generateDialogIds('drawer');
|
|
76
|
+
/** Direction the drawer appears from */
|
|
77
|
+
readonly direction: 'top' | 'right' | 'bottom' | 'left' = 'bottom';
|
|
69
78
|
/** ARIA IDs for accessibility */
|
|
70
79
|
readonly titleId = this.ariaIds.titleId;
|
|
71
80
|
readonly descriptionId = this.ariaIds.descriptionId;
|
|
72
81
|
readonly contentId = this.ariaIds.contentId;
|
|
73
82
|
|
|
74
|
-
/** Reference to the trigger element for focus restoration */
|
|
75
|
-
readonly triggerElement = signal<HTMLElement | null>(null);
|
|
76
|
-
|
|
77
|
-
constructor() {
|
|
78
|
-
if (this.defaultOpen()) {
|
|
79
|
-
this.open.set(true);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
83
|
setOpen(open: boolean): void {
|
|
84
84
|
if (this.controlledOpen() === undefined) {
|
|
85
85
|
this.open.set(open);
|
|
86
86
|
}
|
|
87
87
|
this.openChange.emit(open);
|
|
88
88
|
}
|
|
89
|
-
|
|
90
89
|
isOpen(): boolean {
|
|
91
90
|
return this.controlledOpen() !== undefined ? this.controlledOpen()! : this.open();
|
|
92
91
|
}
|