@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
|
* Pagination component - root container.
|
|
@@ -32,6 +27,7 @@ import {
|
|
|
32
27
|
selector: 'Pagination',
|
|
33
28
|
template: `<ng-content />`,
|
|
34
29
|
host: {
|
|
30
|
+
'attr.data-slot': '"pagination"',
|
|
35
31
|
role: 'navigation',
|
|
36
32
|
'[attr.aria-label]': '"pagination"',
|
|
37
33
|
'[class]': 'computedClass()',
|
|
@@ -43,6 +39,6 @@ export class Pagination {
|
|
|
43
39
|
readonly class = input<string>('');
|
|
44
40
|
|
|
45
41
|
protected readonly computedClass = computed(() =>
|
|
46
|
-
cn('mx-auto flex w-full justify-center', this.class())
|
|
42
|
+
cn('mx-auto flex w-full justify-center', this.class()),
|
|
47
43
|
);
|
|
48
44
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
// Context and types
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
POPOVER_CONTEXT,
|
|
4
|
+
type PopoverAlign,
|
|
5
|
+
type PopoverContextValue,
|
|
6
|
+
type PopoverSide,
|
|
7
7
|
} from './popover-context';
|
|
8
8
|
|
|
9
9
|
// Components and their types
|
|
10
10
|
export { PopoverAnchor, type PopoverAnchorProps } from './popover-anchor.component';
|
|
11
|
-
export {
|
|
11
|
+
export {
|
|
12
|
+
PopoverContent,
|
|
13
|
+
type PopoverContentProps,
|
|
14
|
+
type PopoverContentState,
|
|
15
|
+
} from './popover-content.component';
|
|
12
16
|
export { PopoverTrigger, type PopoverTriggerProps } from './popover-trigger.component';
|
|
13
17
|
export { Popover, type PopoverProps, type PopoverState } from './popover.component';
|
|
14
|
-
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
input,
|
|
5
|
-
} from '@angular/core';
|
|
6
|
-
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// Types
|
|
9
|
-
// ============================================================================
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
10
2
|
|
|
11
3
|
/**
|
|
12
4
|
* Props for the PopoverAnchor component
|
|
@@ -17,10 +9,6 @@ export interface PopoverAnchorProps {
|
|
|
17
9
|
asChild?: boolean;
|
|
18
10
|
}
|
|
19
11
|
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// Component
|
|
22
|
-
// ============================================================================
|
|
23
|
-
|
|
24
12
|
/**
|
|
25
13
|
* @component PopoverAnchor
|
|
26
14
|
*
|
|
@@ -54,6 +42,7 @@ export interface PopoverAnchorProps {
|
|
|
54
42
|
selector: 'PopoverAnchor',
|
|
55
43
|
template: `<ng-content />`,
|
|
56
44
|
host: {
|
|
45
|
+
'attr.data-slot': '"popover-anchor"',
|
|
57
46
|
class: 'inline-block',
|
|
58
47
|
},
|
|
59
48
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { Align, cn, computePosition, getTransformOrigin, Presence, Side } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
afterNextRender,
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
Component,
|
|
6
|
+
computed,
|
|
7
|
+
effect,
|
|
8
|
+
ElementRef,
|
|
9
|
+
inject,
|
|
10
|
+
Injector,
|
|
11
|
+
input,
|
|
12
|
+
signal,
|
|
13
13
|
} from '@angular/core';
|
|
14
14
|
import { POPOVER_CONTEXT, PopoverAlign, PopoverSide } from './popover-context';
|
|
15
15
|
|
|
16
|
-
// ============================================================================
|
|
17
|
-
// Types
|
|
18
|
-
// ============================================================================
|
|
19
|
-
|
|
20
16
|
export type PopoverContentState = 'open' | 'closed';
|
|
21
17
|
|
|
22
18
|
/**
|
|
@@ -43,12 +39,10 @@ export interface PopoverContentProps {
|
|
|
43
39
|
collisionPadding?: number;
|
|
44
40
|
/** Additional CSS classes */
|
|
45
41
|
class?: string;
|
|
42
|
+
/** Whether the content should match the trigger width. */
|
|
43
|
+
matchTriggerWidth?: boolean;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
// ============================================================================
|
|
49
|
-
// Component
|
|
50
|
-
// ============================================================================
|
|
51
|
-
|
|
52
46
|
/**
|
|
53
47
|
* @component PopoverContent
|
|
54
48
|
*
|
|
@@ -104,7 +98,7 @@ export interface PopoverContentProps {
|
|
|
104
98
|
[attr.data-state]="state()"
|
|
105
99
|
[attr.data-side]="computedSide()"
|
|
106
100
|
[attr.data-align]="computedAlign()"
|
|
107
|
-
[style]="
|
|
101
|
+
[style]="mergedStyles()"
|
|
108
102
|
role="dialog"
|
|
109
103
|
[attr.aria-modal]="context.modal() || null"
|
|
110
104
|
>
|
|
@@ -113,6 +107,7 @@ export interface PopoverContentProps {
|
|
|
113
107
|
</Presence>
|
|
114
108
|
`,
|
|
115
109
|
host: {
|
|
110
|
+
'attr.data-slot': '"popover-content"',
|
|
116
111
|
class: 'contents',
|
|
117
112
|
'(document:click)': 'onDocumentClick($event)',
|
|
118
113
|
'(document:keydown.escape)': 'onEscapeKey()',
|
|
@@ -120,65 +115,146 @@ export interface PopoverContentProps {
|
|
|
120
115
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
121
116
|
})
|
|
122
117
|
export class PopoverContent {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
constructor() {
|
|
119
|
+
// Recalculate position when open state changes (browser-only via afterNextRender)
|
|
120
|
+
effect(() => {
|
|
121
|
+
const isOpen = this.context.open();
|
|
122
|
+
if (isOpen) {
|
|
123
|
+
this.isPositioned.set(false);
|
|
124
|
+
afterNextRender(
|
|
125
|
+
() => {
|
|
126
|
+
this.schedulePositionUpdate();
|
|
127
|
+
},
|
|
128
|
+
{ injector: this._injector },
|
|
129
|
+
);
|
|
130
|
+
} else {
|
|
131
|
+
this.cancelScheduledPositionUpdate();
|
|
132
|
+
this.isPositioned.set(false);
|
|
133
|
+
this.positionStyles.set({
|
|
134
|
+
position: 'fixed',
|
|
135
|
+
top: '-9999px',
|
|
136
|
+
left: '-9999px',
|
|
137
|
+
});
|
|
138
|
+
this.matchedWidth.set(null);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
126
142
|
|
|
127
143
|
/** The preferred side of the anchor to render against */
|
|
128
144
|
readonly side = input<Side>('bottom');
|
|
129
|
-
|
|
130
145
|
/** The distance in pixels from the anchor */
|
|
131
146
|
readonly sideOffset = input<number>(4);
|
|
132
|
-
|
|
133
147
|
/** The preferred alignment against the anchor */
|
|
134
148
|
readonly align = input<Align>('center');
|
|
135
|
-
|
|
136
149
|
/** An offset in pixels from the alignment options */
|
|
137
150
|
readonly alignOffset = input<number>(0);
|
|
138
|
-
|
|
139
151
|
/** Whether to avoid collisions with viewport boundaries */
|
|
140
152
|
readonly avoidCollisions = input<boolean>(true);
|
|
141
|
-
|
|
142
153
|
/** The padding in pixels between the boundary edges and content */
|
|
143
154
|
readonly collisionPadding = input<number>(8);
|
|
144
|
-
|
|
145
155
|
/** Additional CSS classes */
|
|
146
156
|
readonly class = input<string>('');
|
|
157
|
+
/** Whether the content should match the trigger width */
|
|
158
|
+
readonly matchTriggerWidth = input<boolean>(false);
|
|
147
159
|
|
|
160
|
+
private readonly _elementRef = inject(ElementRef);
|
|
161
|
+
private readonly _injector = inject(Injector);
|
|
162
|
+
|
|
163
|
+
protected readonly context = inject(POPOVER_CONTEXT);
|
|
164
|
+
|
|
165
|
+
protected readonly computedClass = computed(() =>
|
|
166
|
+
cn(
|
|
167
|
+
'z-50 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none',
|
|
168
|
+
this.matchTriggerWidth() ? 'w-full' : 'w-72',
|
|
169
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out',
|
|
170
|
+
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
171
|
+
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
|
172
|
+
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2',
|
|
173
|
+
'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
174
|
+
!this.isPositioned() && 'pointer-events-none opacity-0',
|
|
175
|
+
this.class(),
|
|
176
|
+
),
|
|
177
|
+
);
|
|
178
|
+
protected readonly mergedStyles = computed<Record<string, string>>(() => ({
|
|
179
|
+
...this.positionStyles(),
|
|
180
|
+
...(this.matchedWidth() !== null
|
|
181
|
+
? {
|
|
182
|
+
width: `${this.matchedWidth()}px`,
|
|
183
|
+
minWidth: `${this.matchedWidth()}px`,
|
|
184
|
+
maxWidth: `${this.matchedWidth()}px`,
|
|
185
|
+
}
|
|
186
|
+
: {}),
|
|
187
|
+
}));
|
|
148
188
|
/** Current state: open or closed */
|
|
149
189
|
protected readonly state = computed<PopoverContentState>(() =>
|
|
150
|
-
this.context.open() ? 'open' : 'closed'
|
|
190
|
+
this.context.open() ? 'open' : 'closed',
|
|
151
191
|
);
|
|
152
192
|
|
|
193
|
+
protected readonly isPositioned = signal(false);
|
|
153
194
|
/** Computed position after collision detection */
|
|
154
195
|
protected readonly computedSide = signal<Side>('bottom');
|
|
155
196
|
protected readonly computedAlign = signal<Align>('center');
|
|
156
|
-
protected readonly
|
|
197
|
+
protected readonly matchedWidth = signal<number | null>(null);
|
|
198
|
+
protected readonly positionStyles = signal<Record<string, string>>({
|
|
199
|
+
position: 'fixed',
|
|
200
|
+
top: '-9999px',
|
|
201
|
+
left: '-9999px',
|
|
202
|
+
});
|
|
157
203
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
204
|
+
private positionFrameId: number | null = null;
|
|
205
|
+
|
|
206
|
+
onDocumentClick(event: Event): void {
|
|
207
|
+
const target = event.target as HTMLElement;
|
|
208
|
+
if (!this._elementRef.nativeElement.contains(target)) {
|
|
209
|
+
// Check if click is outside the popover
|
|
210
|
+
const popoverContent = this._elementRef.nativeElement.querySelector('[role="dialog"]');
|
|
211
|
+
if (popoverContent && !popoverContent.contains(target)) {
|
|
212
|
+
this.context.setOpen(false);
|
|
166
213
|
}
|
|
167
|
-
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
onEscapeKey(): void {
|
|
217
|
+
this.context.setOpen(false);
|
|
168
218
|
}
|
|
169
219
|
|
|
220
|
+
private schedulePositionUpdate(): void {
|
|
221
|
+
this.cancelScheduledPositionUpdate();
|
|
222
|
+
|
|
223
|
+
this.positionFrameId = requestAnimationFrame(() => {
|
|
224
|
+
this.updatePosition();
|
|
225
|
+
|
|
226
|
+
this.positionFrameId = requestAnimationFrame(() => {
|
|
227
|
+
this.updatePosition();
|
|
228
|
+
this.positionFrameId = null;
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
private cancelScheduledPositionUpdate(): void {
|
|
233
|
+
if (this.positionFrameId !== null) {
|
|
234
|
+
cancelAnimationFrame(this.positionFrameId);
|
|
235
|
+
this.positionFrameId = null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
170
238
|
private updatePosition(): void {
|
|
171
239
|
const triggerElement = this.context.triggerRef?.();
|
|
172
|
-
const contentElement = this.
|
|
240
|
+
const contentElement = this._elementRef.nativeElement.querySelector(
|
|
241
|
+
'[role="dialog"]',
|
|
242
|
+
) as HTMLElement;
|
|
173
243
|
|
|
174
244
|
if (!triggerElement || !contentElement) return;
|
|
175
245
|
|
|
176
246
|
const triggerRect = triggerElement.getBoundingClientRect();
|
|
177
247
|
const contentRect = contentElement.getBoundingClientRect();
|
|
248
|
+
const overlayWidth = this.matchTriggerWidth()
|
|
249
|
+
? Math.round(triggerRect.width)
|
|
250
|
+
: Math.round(contentRect.width || 288);
|
|
251
|
+
const overlayHeight = Math.round(contentRect.height || 100);
|
|
252
|
+
|
|
253
|
+
this.matchedWidth.set(this.matchTriggerWidth() ? overlayWidth : null);
|
|
178
254
|
|
|
179
255
|
const result = computePosition(
|
|
180
256
|
triggerRect,
|
|
181
|
-
{ width:
|
|
257
|
+
{ width: overlayWidth, height: overlayHeight },
|
|
182
258
|
{
|
|
183
259
|
side: this.side(),
|
|
184
260
|
align: this.align(),
|
|
@@ -186,7 +262,7 @@ export class PopoverContent {
|
|
|
186
262
|
alignOffset: this.alignOffset(),
|
|
187
263
|
avoidCollisions: this.avoidCollisions(),
|
|
188
264
|
collisionPadding: this.collisionPadding(),
|
|
189
|
-
}
|
|
265
|
+
},
|
|
190
266
|
);
|
|
191
267
|
|
|
192
268
|
this.computedSide.set(result.side);
|
|
@@ -200,32 +276,6 @@ export class PopoverContent {
|
|
|
200
276
|
left: result.styles.left || '',
|
|
201
277
|
'--radix-popover-content-transform-origin': transformOrigin,
|
|
202
278
|
});
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
protected readonly computedClass = computed(() =>
|
|
206
|
-
cn(
|
|
207
|
-
'z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none',
|
|
208
|
-
'data-[state=open]:animate-in data-[state=closed]:animate-out',
|
|
209
|
-
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
210
|
-
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
|
211
|
-
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2',
|
|
212
|
-
'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
213
|
-
this.class()
|
|
214
|
-
)
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
onDocumentClick(event: Event): void {
|
|
218
|
-
const target = event.target as HTMLElement;
|
|
219
|
-
if (!this.elementRef.nativeElement.contains(target)) {
|
|
220
|
-
// Check if click is outside the popover
|
|
221
|
-
const popoverContent = this.elementRef.nativeElement.querySelector('[role="dialog"]');
|
|
222
|
-
if (popoverContent && !popoverContent.contains(target)) {
|
|
223
|
-
this.context.setOpen(false);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
onEscapeKey(): void {
|
|
229
|
-
this.context.setOpen(false);
|
|
279
|
+
this.isPositioned.set(true);
|
|
230
280
|
}
|
|
231
281
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { InjectionToken, Signal, WritableSignal } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// Types
|
|
5
|
-
// ============================================================================
|
|
6
|
-
|
|
7
3
|
export type PopoverSide = 'top' | 'right' | 'bottom' | 'left';
|
|
8
4
|
export type PopoverAlign = 'start' | 'center' | 'end';
|
|
9
5
|
|
|
@@ -22,8 +18,4 @@ export interface PopoverContextValue {
|
|
|
22
18
|
setTriggerRef?: (element: HTMLElement | null) => void;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
// ============================================================================
|
|
26
|
-
// Injection Tokens
|
|
27
|
-
// ============================================================================
|
|
28
|
-
|
|
29
21
|
export const POPOVER_CONTEXT = new InjectionToken<PopoverContextValue>('POPOVER_CONTEXT');
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
afterNextRender,
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
ElementRef,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
OnDestroy,
|
|
9
9
|
} from '@angular/core';
|
|
10
10
|
import { POPOVER_CONTEXT } from './popover-context';
|
|
11
11
|
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// Types
|
|
14
|
-
// ============================================================================
|
|
15
|
-
|
|
16
12
|
/**
|
|
17
13
|
* Props for the PopoverTrigger component
|
|
18
14
|
*/
|
|
@@ -22,10 +18,6 @@ export interface PopoverTriggerProps {
|
|
|
22
18
|
asChild?: boolean;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
// ============================================================================
|
|
26
|
-
// Component
|
|
27
|
-
// ============================================================================
|
|
28
|
-
|
|
29
21
|
/**
|
|
30
22
|
* @component PopoverTrigger
|
|
31
23
|
*
|
|
@@ -67,6 +59,7 @@ export interface PopoverTriggerProps {
|
|
|
67
59
|
selector: 'PopoverTrigger',
|
|
68
60
|
template: `<ng-content />`,
|
|
69
61
|
host: {
|
|
62
|
+
'attr.data-slot': '"popover-trigger"',
|
|
70
63
|
'(click)': 'onClick($event)',
|
|
71
64
|
'[attr.aria-expanded]': 'context.open()',
|
|
72
65
|
'[attr.aria-haspopup]': '"dialog"',
|
|
@@ -75,19 +68,26 @@ export interface PopoverTriggerProps {
|
|
|
75
68
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
76
69
|
})
|
|
77
70
|
export class PopoverTrigger implements OnDestroy {
|
|
78
|
-
protected readonly context = inject(POPOVER_CONTEXT);
|
|
79
|
-
private readonly elementRef = inject(ElementRef);
|
|
80
|
-
|
|
81
|
-
/** Change the default rendered element for the one passed as a child */
|
|
82
|
-
readonly asChild = input<boolean>(false);
|
|
83
|
-
|
|
84
71
|
constructor() {
|
|
85
72
|
// Register this element as the trigger reference (browser-only)
|
|
86
73
|
afterNextRender(() => {
|
|
87
|
-
this.
|
|
74
|
+
const hostElement = this._elementRef.nativeElement as HTMLElement;
|
|
75
|
+
const triggerElement =
|
|
76
|
+
hostElement.firstElementChild instanceof HTMLElement
|
|
77
|
+
? hostElement.firstElementChild
|
|
78
|
+
: hostElement;
|
|
79
|
+
|
|
80
|
+
this.context.setTriggerRef?.(triggerElement);
|
|
88
81
|
});
|
|
89
82
|
}
|
|
90
83
|
|
|
84
|
+
/** Change the default rendered element for the one passed as a child */
|
|
85
|
+
readonly asChild = input<boolean>(false);
|
|
86
|
+
|
|
87
|
+
private readonly _elementRef = inject(ElementRef);
|
|
88
|
+
|
|
89
|
+
protected readonly context = inject(POPOVER_CONTEXT);
|
|
90
|
+
|
|
91
91
|
ngOnDestroy(): void {
|
|
92
92
|
// Clean up trigger reference
|
|
93
93
|
this.context.setTriggerRef?.(null);
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
forwardRef,
|
|
5
|
+
input,
|
|
6
|
+
output,
|
|
7
|
+
signal,
|
|
8
8
|
} from '@angular/core';
|
|
9
9
|
import { POPOVER_CONTEXT, type PopoverContextValue } from './popover-context';
|
|
10
10
|
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// Types
|
|
13
|
-
// ============================================================================
|
|
14
|
-
|
|
15
11
|
export type PopoverState = 'open' | 'closed';
|
|
16
12
|
|
|
17
13
|
/**
|
|
@@ -31,10 +27,6 @@ export interface PopoverProps {
|
|
|
31
27
|
modal?: boolean;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
// ============================================================================
|
|
35
|
-
// Component
|
|
36
|
-
// ============================================================================
|
|
37
|
-
|
|
38
30
|
/**
|
|
39
31
|
* @component Popover
|
|
40
32
|
*
|
|
@@ -106,7 +98,8 @@ export interface PopoverProps {
|
|
|
106
98
|
selector: 'Popover',
|
|
107
99
|
template: `<ng-content />`,
|
|
108
100
|
host: {
|
|
109
|
-
|
|
101
|
+
'attr.data-slot': '"popover"',
|
|
102
|
+
class: 'relative',
|
|
110
103
|
},
|
|
111
104
|
providers: [
|
|
112
105
|
{
|
|
@@ -117,46 +110,40 @@ export interface PopoverProps {
|
|
|
117
110
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
118
111
|
})
|
|
119
112
|
export class Popover implements PopoverContextValue {
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
constructor() {
|
|
114
|
+
// Initialize from defaultOpen
|
|
115
|
+
if (this.defaultOpen()) {
|
|
116
|
+
this.open.set(true);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
122
119
|
|
|
123
|
-
/**
|
|
124
|
-
readonly
|
|
120
|
+
/** Event handler called when the open state changes */
|
|
121
|
+
readonly openChange = output<boolean>();
|
|
125
122
|
|
|
126
123
|
/** The modality of the popover */
|
|
127
124
|
readonly modal = input<boolean>(false);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
/** The open state of the popover when initially rendered */
|
|
126
|
+
readonly defaultOpen = input<boolean>(false);
|
|
127
|
+
/** The controlled open state of the popover */
|
|
128
|
+
readonly controlledOpen = input<boolean | undefined>(undefined, { alias: 'open' });
|
|
131
129
|
|
|
132
130
|
readonly open = signal(false);
|
|
133
|
-
|
|
134
131
|
/** Reference to the trigger element for positioning */
|
|
135
132
|
readonly triggerRef = signal<HTMLElement | null>(null);
|
|
136
133
|
|
|
137
|
-
constructor() {
|
|
138
|
-
// Initialize from defaultOpen
|
|
139
|
-
if (this.defaultOpen()) {
|
|
140
|
-
this.open.set(true);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
134
|
setOpen(open: boolean): void {
|
|
145
135
|
if (this.controlledOpen() === undefined) {
|
|
146
136
|
this.open.set(open);
|
|
147
137
|
}
|
|
148
138
|
this.openChange.emit(open);
|
|
149
139
|
}
|
|
150
|
-
|
|
151
140
|
toggle(): void {
|
|
152
141
|
this.setOpen(!this.open());
|
|
153
142
|
}
|
|
154
|
-
|
|
155
143
|
/** Set the trigger element reference */
|
|
156
144
|
setTriggerRef(element: HTMLElement | null): void {
|
|
157
145
|
this.triggerRef.set(element);
|
|
158
146
|
}
|
|
159
|
-
|
|
160
147
|
isOpen(): boolean {
|
|
161
148
|
return this.controlledOpen() !== undefined ? this.controlledOpen()! : this.open();
|
|
162
149
|
}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
8
|
-
|
|
9
|
-
// ============================================================================
|
|
10
|
-
// Types
|
|
11
|
-
// ============================================================================
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
12
3
|
|
|
13
4
|
export type ProgressState = 'indeterminate' | 'loading' | 'complete';
|
|
14
5
|
|
|
@@ -32,10 +23,6 @@ export type ProgressProps = {
|
|
|
32
23
|
getValueLabel?: (value: number, max: number) => string;
|
|
33
24
|
};
|
|
34
25
|
|
|
35
|
-
// ============================================================================
|
|
36
|
-
// Progress Component
|
|
37
|
-
// ============================================================================
|
|
38
|
-
|
|
39
26
|
/**
|
|
40
27
|
* Progress component displays progress feedback for tasks and operations.
|
|
41
28
|
* Based on Radix UI Progress primitive with shadcn/ui styling.
|
|
@@ -142,9 +129,7 @@ export class Progress {
|
|
|
142
129
|
* Function to get value label for accessibility.
|
|
143
130
|
* Receives current value and returns descriptive text.
|
|
144
131
|
*/
|
|
145
|
-
readonly getValueLabel = input<
|
|
146
|
-
((value: number, max: number) => string) | undefined
|
|
147
|
-
>(undefined);
|
|
132
|
+
readonly getValueLabel = input<((value: number, max: number) => string) | undefined>(undefined);
|
|
148
133
|
|
|
149
134
|
/** Additional CSS classes to apply to the root */
|
|
150
135
|
readonly class = input<string>('');
|
|
@@ -154,17 +139,17 @@ export class Progress {
|
|
|
154
139
|
|
|
155
140
|
/** Calculate percentage (0-100) */
|
|
156
141
|
protected readonly percentage = computed(() => {
|
|
157
|
-
const
|
|
142
|
+
const currentValue = this.value();
|
|
158
143
|
const maxVal = this.max();
|
|
159
|
-
if (
|
|
160
|
-
return Math.min(100, Math.max(0, (
|
|
144
|
+
if (currentValue === null || maxVal === 0) return 0;
|
|
145
|
+
return Math.min(100, Math.max(0, (currentValue / maxVal) * 100));
|
|
161
146
|
});
|
|
162
147
|
|
|
163
148
|
/** Calculate state for data attribute */
|
|
164
149
|
protected readonly state = computed((): ProgressState => {
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
return
|
|
150
|
+
const currentValue = this.value();
|
|
151
|
+
if (currentValue === null) return 'indeterminate';
|
|
152
|
+
return currentValue >= this.max() ? 'complete' : 'loading';
|
|
168
153
|
});
|
|
169
154
|
|
|
170
155
|
/** Compute aria-valuetext */
|
|
@@ -172,12 +157,12 @@ export class Progress {
|
|
|
172
157
|
const customText = this.ariaValueText();
|
|
173
158
|
if (customText) return customText;
|
|
174
159
|
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
160
|
+
const currentValue = this.value();
|
|
161
|
+
if (currentValue === null) return 'Loading';
|
|
177
162
|
|
|
178
163
|
const getLabel = this.getValueLabel();
|
|
179
164
|
if (getLabel) {
|
|
180
|
-
return getLabel(
|
|
165
|
+
return getLabel(currentValue, this.max());
|
|
181
166
|
}
|
|
182
167
|
|
|
183
168
|
return `${this.percentage().toFixed(0)}% complete`;
|
|
@@ -194,8 +179,8 @@ export class Progress {
|
|
|
194
179
|
// Base styles
|
|
195
180
|
'bg-primary/20 relative h-2 w-full overflow-hidden rounded-full',
|
|
196
181
|
// Custom classes
|
|
197
|
-
this.class()
|
|
198
|
-
)
|
|
182
|
+
this.class(),
|
|
183
|
+
),
|
|
199
184
|
);
|
|
200
185
|
|
|
201
186
|
/** Computed indicator class */
|
|
@@ -206,7 +191,7 @@ export class Progress {
|
|
|
206
191
|
// Indeterminate animation
|
|
207
192
|
this.state() === 'indeterminate' && 'animate-pulse',
|
|
208
193
|
// Custom classes
|
|
209
|
-
this.indicatorClass()
|
|
210
|
-
)
|
|
194
|
+
this.indicatorClass(),
|
|
195
|
+
),
|
|
211
196
|
);
|
|
212
197
|
}
|
|
@@ -3,8 +3,5 @@ export {
|
|
|
3
3
|
type RadioGroupContext,
|
|
4
4
|
type RadioGroupOrientation,
|
|
5
5
|
} from './radio-group-context';
|
|
6
|
-
export {
|
|
7
|
-
RadioGroupItem,
|
|
8
|
-
type RadioGroupItemProps,
|
|
9
|
-
} from './radio-group-item.component';
|
|
6
|
+
export { RadioGroupItem, type RadioGroupItemProps } from './radio-group-item.component';
|
|
10
7
|
export { RadioGroup, type RadioGroupProps } from './radio-group.component';
|