@ng-cn/core 1.0.11 → 1.0.12
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 +2 -1
- package/schematics/ng-add/index.js +2 -2
- package/schematics/ng-add/index.ts +2 -2
- package/src/app/lib/components/ui/accordion/accordion-content.component.ts +53 -0
- package/src/app/lib/components/ui/accordion/accordion-context.ts +33 -0
- package/src/app/lib/components/ui/accordion/accordion-item.component.ts +86 -0
- package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +73 -0
- package/src/app/lib/components/ui/accordion/accordion.component.ts +197 -0
- package/src/app/lib/components/ui/accordion/index.ts +15 -0
- package/src/app/lib/components/ui/alert/alert-description.component.ts +33 -0
- package/src/app/lib/components/ui/alert/alert-title.component.ts +30 -0
- package/src/app/lib/components/ui/alert/alert-variants.ts +23 -0
- package/src/app/lib/components/ui/alert/alert.component.ts +50 -0
- package/src/app/lib/components/ui/alert/index.ts +5 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +44 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +45 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +146 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-context.ts +14 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +37 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +35 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +35 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +37 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +44 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +91 -0
- package/src/app/lib/components/ui/alert-dialog/index.ts +11 -0
- package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +63 -0
- package/src/app/lib/components/ui/aspect-ratio/index.ts +1 -0
- package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +34 -0
- package/src/app/lib/components/ui/avatar/avatar-image.component.ts +31 -0
- package/src/app/lib/components/ui/avatar/avatar.component.ts +37 -0
- package/src/app/lib/components/ui/avatar/index.ts +5 -0
- package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +52 -0
- package/src/app/lib/components/ui/badge/badge-variants.ts +28 -0
- package/src/app/lib/components/ui/badge/badge.component.ts +50 -0
- package/src/app/lib/components/ui/badge/index.ts +3 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +48 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +28 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +32 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +31 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +31 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +47 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +43 -0
- package/src/app/lib/components/ui/breadcrumb/index.ts +8 -0
- package/src/app/lib/components/ui/button/button-variants.ts +38 -0
- package/src/app/lib/components/ui/button/button.component.ts +103 -0
- package/src/app/lib/components/ui/button/index.ts +3 -0
- package/src/app/lib/components/ui/button-group/button-group-variants.ts +24 -0
- package/src/app/lib/components/ui/button-group/button-group.component.ts +57 -0
- package/src/app/lib/components/ui/button-group/index.ts +6 -0
- package/src/app/lib/components/ui/calendar/calendar.component.ts +368 -0
- package/src/app/lib/components/ui/calendar/index.ts +1 -0
- package/src/app/lib/components/ui/card/card-action.component.ts +39 -0
- package/src/app/lib/components/ui/card/card-content.component.ts +31 -0
- package/src/app/lib/components/ui/card/card-description.component.ts +31 -0
- package/src/app/lib/components/ui/card/card-footer.component.ts +34 -0
- package/src/app/lib/components/ui/card/card-header.component.ts +37 -0
- package/src/app/lib/components/ui/card/card-title.component.ts +31 -0
- package/src/app/lib/components/ui/card/card.component.ts +41 -0
- package/src/app/lib/components/ui/card/index.ts +8 -0
- package/src/app/lib/components/ui/carousel/carousel-content.component.ts +38 -0
- package/src/app/lib/components/ui/carousel/carousel-context.ts +18 -0
- package/src/app/lib/components/ui/carousel/carousel-item.component.ts +32 -0
- package/src/app/lib/components/ui/carousel/carousel-next.component.ts +54 -0
- package/src/app/lib/components/ui/carousel/carousel-previous.component.ts +54 -0
- package/src/app/lib/components/ui/carousel/carousel.component.ts +125 -0
- package/src/app/lib/components/ui/carousel/index.ts +7 -0
- package/src/app/lib/components/ui/chart/chart-container.component.ts +81 -0
- package/src/app/lib/components/ui/chart/chart-context.ts +38 -0
- package/src/app/lib/components/ui/chart/chart-legend-content.component.ts +51 -0
- package/src/app/lib/components/ui/chart/chart-legend.component.ts +28 -0
- package/src/app/lib/components/ui/chart/chart-tooltip-content.component.ts +37 -0
- package/src/app/lib/components/ui/chart/chart-tooltip.component.ts +28 -0
- package/src/app/lib/components/ui/chart/chart.component.ts +308 -0
- package/src/app/lib/components/ui/chart/index.ts +16 -0
- package/src/app/lib/components/ui/checkbox/checkbox.component.ts +203 -0
- package/src/app/lib/components/ui/checkbox/index.ts +1 -0
- package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +58 -0
- package/src/app/lib/components/ui/collapsible/collapsible-context.ts +17 -0
- package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +56 -0
- package/src/app/lib/components/ui/collapsible/collapsible.component.ts +102 -0
- package/src/app/lib/components/ui/collapsible/index.ts +5 -0
- package/src/app/lib/components/ui/combobox/combobox-content.component.ts +59 -0
- package/src/app/lib/components/ui/combobox/combobox-context.ts +49 -0
- package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +35 -0
- package/src/app/lib/components/ui/combobox/combobox-group.component.ts +32 -0
- package/src/app/lib/components/ui/combobox/combobox-input.component.ts +89 -0
- package/src/app/lib/components/ui/combobox/combobox-item.component.ts +129 -0
- package/src/app/lib/components/ui/combobox/combobox-list.component.ts +40 -0
- package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +53 -0
- package/src/app/lib/components/ui/combobox/combobox-value.component.ts +47 -0
- package/src/app/lib/components/ui/combobox/combobox.component.ts +290 -0
- package/src/app/lib/components/ui/combobox/index.ts +15 -0
- package/src/app/lib/components/ui/command/command-context.ts +24 -0
- package/src/app/lib/components/ui/command/command-dialog.component.ts +69 -0
- package/src/app/lib/components/ui/command/command-empty.component.ts +23 -0
- package/src/app/lib/components/ui/command/command-group.component.ts +66 -0
- package/src/app/lib/components/ui/command/command-input.component.ts +137 -0
- package/src/app/lib/components/ui/command/command-item.component.ts +148 -0
- package/src/app/lib/components/ui/command/command-list.component.ts +30 -0
- package/src/app/lib/components/ui/command/command-separator.component.ts +23 -0
- package/src/app/lib/components/ui/command/command-shortcut.component.ts +23 -0
- package/src/app/lib/components/ui/command/command.component.ts +105 -0
- package/src/app/lib/components/ui/command/index.ts +11 -0
- package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +68 -0
- package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +213 -0
- package/src/app/lib/components/ui/context-menu/context-menu-context.ts +17 -0
- package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +63 -0
- package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +30 -0
- package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +36 -0
- package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +71 -0
- package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +24 -0
- package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +23 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +51 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +50 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +31 -0
- package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +51 -0
- package/src/app/lib/components/ui/context-menu/context-menu.component.ts +27 -0
- package/src/app/lib/components/ui/context-menu/index.ts +15 -0
- package/src/app/lib/components/ui/data-table/data-table-content.component.ts +226 -0
- package/src/app/lib/components/ui/data-table/data-table-context.ts +49 -0
- package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +138 -0
- package/src/app/lib/components/ui/data-table/data-table-search.component.ts +52 -0
- package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +27 -0
- package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +92 -0
- package/src/app/lib/components/ui/data-table/data-table.component.ts +131 -0
- package/src/app/lib/components/ui/data-table/index.ts +16 -0
- package/src/app/lib/components/ui/date-picker/date-picker.component.ts +94 -0
- package/src/app/lib/components/ui/date-picker/index.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-close.component.ts +31 -0
- package/src/app/lib/components/ui/dialog/dialog-content.component.ts +177 -0
- package/src/app/lib/components/ui/dialog/dialog-context.ts +15 -0
- package/src/app/lib/components/ui/dialog/dialog-description.component.ts +34 -0
- package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +28 -0
- package/src/app/lib/components/ui/dialog/dialog-header.component.ts +28 -0
- package/src/app/lib/components/ui/dialog/dialog-title.component.ts +34 -0
- package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +38 -0
- package/src/app/lib/components/ui/dialog/dialog.component.ts +87 -0
- package/src/app/lib/components/ui/dialog/index.ts +10 -0
- package/src/app/lib/components/ui/drawer/drawer-close.component.ts +31 -0
- package/src/app/lib/components/ui/drawer/drawer-content.component.ts +143 -0
- package/src/app/lib/components/ui/drawer/drawer-context.ts +17 -0
- package/src/app/lib/components/ui/drawer/drawer-description.component.ts +33 -0
- package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +28 -0
- package/src/app/lib/components/ui/drawer/drawer-header.component.ts +28 -0
- package/src/app/lib/components/ui/drawer/drawer-title.component.ts +33 -0
- package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +38 -0
- package/src/app/lib/components/ui/drawer/drawer.component.ts +93 -0
- package/src/app/lib/components/ui/drawer/index.ts +10 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +68 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +234 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-context.ts +15 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-group.component.ts +15 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-item.component.ts +56 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +30 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +42 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +71 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +24 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +23 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +51 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +53 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +31 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +45 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +32 -0
- package/src/app/lib/components/ui/dropdown-menu/index.ts +16 -0
- package/src/app/lib/components/ui/empty/empty-action.component.ts +28 -0
- package/src/app/lib/components/ui/empty/empty-description.component.ts +31 -0
- package/src/app/lib/components/ui/empty/empty-icon.component.ts +31 -0
- package/src/app/lib/components/ui/empty/empty-title.component.ts +28 -0
- package/src/app/lib/components/ui/empty/empty.component.ts +53 -0
- package/src/app/lib/components/ui/empty/index.ts +6 -0
- package/src/app/lib/components/ui/form/form-context.ts +34 -0
- package/src/app/lib/components/ui/form/form-control.component.ts +137 -0
- package/src/app/lib/components/ui/form/form-description.component.ts +37 -0
- package/src/app/lib/components/ui/form/form-field.component.ts +84 -0
- package/src/app/lib/components/ui/form/form-item.component.ts +42 -0
- package/src/app/lib/components/ui/form/form-label.component.ts +58 -0
- package/src/app/lib/components/ui/form/form-message.component.ts +107 -0
- package/src/app/lib/components/ui/form/form.component.ts +123 -0
- package/src/app/lib/components/ui/form/index.ts +17 -0
- package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +203 -0
- package/src/app/lib/components/ui/hover-card/hover-card-context.ts +25 -0
- package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +160 -0
- package/src/app/lib/components/ui/hover-card/hover-card.component.ts +147 -0
- package/src/app/lib/components/ui/hover-card/index.ts +13 -0
- package/src/app/lib/components/ui/index.ts +551 -0
- package/src/app/lib/components/ui/input/index.ts +1 -0
- package/src/app/lib/components/ui/input/input.component.ts +165 -0
- package/src/app/lib/components/ui/input-group/index.ts +4 -0
- package/src/app/lib/components/ui/input-group/input-group-addon.component.ts +43 -0
- package/src/app/lib/components/ui/input-group/input-group-input.component.ts +33 -0
- package/src/app/lib/components/ui/input-group/input-group.component.ts +53 -0
- package/src/app/lib/components/ui/input-otp/index.ts +14 -0
- package/src/app/lib/components/ui/input-otp/input-otp-context.ts +31 -0
- package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +23 -0
- package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +31 -0
- package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +67 -0
- package/src/app/lib/components/ui/input-otp/input-otp.component.ts +240 -0
- package/src/app/lib/components/ui/kbd/index.ts +3 -0
- package/src/app/lib/components/ui/kbd/kbd-variants.ts +23 -0
- package/src/app/lib/components/ui/kbd/kbd.component.ts +50 -0
- package/src/app/lib/components/ui/label/index.ts +1 -0
- package/src/app/lib/components/ui/label/label.component.ts +139 -0
- package/src/app/lib/components/ui/menubar/index.ts +26 -0
- package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +66 -0
- package/src/app/lib/components/ui/menubar/menubar-content.component.ts +236 -0
- package/src/app/lib/components/ui/menubar/menubar-context.ts +63 -0
- package/src/app/lib/components/ui/menubar/menubar-item.component.ts +60 -0
- package/src/app/lib/components/ui/menubar/menubar-label.component.ts +30 -0
- package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +40 -0
- package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +36 -0
- package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +66 -0
- package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +24 -0
- package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +23 -0
- package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +51 -0
- package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +50 -0
- package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +29 -0
- package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +132 -0
- package/src/app/lib/components/ui/menubar/menubar.component.ts +158 -0
- package/src/app/lib/components/ui/native-select/index.ts +6 -0
- package/src/app/lib/components/ui/native-select/native-select-variants.ts +23 -0
- package/src/app/lib/components/ui/native-select/native-select.component.ts +74 -0
- package/src/app/lib/components/ui/navigation-menu/index.ts +21 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +66 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-context.ts +55 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +28 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +29 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +43 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +26 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger-style.ts +7 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +58 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +26 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +149 -0
- package/src/app/lib/components/ui/pagination/index.ts +8 -0
- package/src/app/lib/components/ui/pagination/pagination-content.component.ts +28 -0
- package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +47 -0
- package/src/app/lib/components/ui/pagination/pagination-item.component.ts +28 -0
- package/src/app/lib/components/ui/pagination/pagination-link.component.ts +46 -0
- package/src/app/lib/components/ui/pagination/pagination-next.component.ts +54 -0
- package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +54 -0
- package/src/app/lib/components/ui/pagination/pagination.component.ts +48 -0
- package/src/app/lib/components/ui/popover/index.ts +14 -0
- package/src/app/lib/components/ui/popover/popover-anchor.component.ts +64 -0
- package/src/app/lib/components/ui/popover/popover-content.component.ts +231 -0
- package/src/app/lib/components/ui/popover/popover-context.ts +29 -0
- package/src/app/lib/components/ui/popover/popover-trigger.component.ts +100 -0
- package/src/app/lib/components/ui/popover/popover.component.ts +163 -0
- package/src/app/lib/components/ui/progress/index.ts +6 -0
- package/src/app/lib/components/ui/progress/progress.component.ts +212 -0
- package/src/app/lib/components/ui/radio-group/index.ts +10 -0
- package/src/app/lib/components/ui/radio-group/radio-group-context.ts +38 -0
- package/src/app/lib/components/ui/radio-group/radio-group-item.component.ts +298 -0
- package/src/app/lib/components/ui/radio-group/radio-group.component.ts +275 -0
- package/src/app/lib/components/ui/resizable/index.ts +5 -0
- package/src/app/lib/components/ui/resizable/resizable-context.ts +14 -0
- package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +232 -0
- package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +140 -0
- package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +77 -0
- package/src/app/lib/components/ui/scroll-area/index.ts +8 -0
- package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +126 -0
- package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +93 -0
- package/src/app/lib/components/ui/segmented/index.ts +13 -0
- package/src/app/lib/components/ui/segmented/segmented-context.ts +11 -0
- package/src/app/lib/components/ui/segmented/segmented-item.component.ts +72 -0
- package/src/app/lib/components/ui/segmented/segmented-variants.ts +40 -0
- package/src/app/lib/components/ui/segmented/segmented.component.ts +99 -0
- package/src/app/lib/components/ui/select/index.ts +19 -0
- package/src/app/lib/components/ui/select/select-content.component.ts +97 -0
- package/src/app/lib/components/ui/select/select-context.ts +53 -0
- package/src/app/lib/components/ui/select/select-group.component.ts +56 -0
- package/src/app/lib/components/ui/select/select-item.component.ts +163 -0
- package/src/app/lib/components/ui/select/select-label.component.ts +32 -0
- package/src/app/lib/components/ui/select/select-separator.component.ts +34 -0
- package/src/app/lib/components/ui/select/select-trigger.component.ts +164 -0
- package/src/app/lib/components/ui/select/select-value.component.ts +49 -0
- package/src/app/lib/components/ui/select/select.component.ts +263 -0
- package/src/app/lib/components/ui/separator/index.ts +6 -0
- package/src/app/lib/components/ui/separator/separator.component.ts +128 -0
- package/src/app/lib/components/ui/sheet/index.ts +11 -0
- package/src/app/lib/components/ui/sheet/sheet-close.component.ts +32 -0
- package/src/app/lib/components/ui/sheet/sheet-content.component.ts +157 -0
- package/src/app/lib/components/ui/sheet/sheet-context.ts +15 -0
- package/src/app/lib/components/ui/sheet/sheet-description.component.ts +34 -0
- package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +28 -0
- package/src/app/lib/components/ui/sheet/sheet-header.component.ts +28 -0
- package/src/app/lib/components/ui/sheet/sheet-title.component.ts +34 -0
- package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +38 -0
- package/src/app/lib/components/ui/sheet/sheet-variants.ts +22 -0
- package/src/app/lib/components/ui/sheet/sheet.component.ts +97 -0
- package/src/app/lib/components/ui/sidebar/index.ts +41 -0
- package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +31 -0
- package/src/app/lib/components/ui/sidebar/sidebar-context.ts +33 -0
- package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +33 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +32 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +31 -0
- package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +31 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +56 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +42 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +64 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +32 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +39 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +59 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +25 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +32 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +31 -0
- package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +141 -0
- package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +47 -0
- package/src/app/lib/components/ui/sidebar/sidebar-route-active.service.ts +124 -0
- package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +28 -0
- package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +57 -0
- package/src/app/lib/components/ui/sidebar/sidebar.component.ts +130 -0
- package/src/app/lib/components/ui/skeleton/index.ts +1 -0
- package/src/app/lib/components/ui/skeleton/skeleton.component.ts +52 -0
- package/src/app/lib/components/ui/slider/index.ts +6 -0
- package/src/app/lib/components/ui/slider/slider.component.ts +477 -0
- package/src/app/lib/components/ui/spinner/index.ts +3 -0
- package/src/app/lib/components/ui/spinner/spinner-variants.ts +32 -0
- package/src/app/lib/components/ui/spinner/spinner.component.ts +77 -0
- package/src/app/lib/components/ui/switch/index.ts +6 -0
- package/src/app/lib/components/ui/switch/switch.component.ts +282 -0
- package/src/app/lib/components/ui/table/index.ts +9 -0
- package/src/app/lib/components/ui/table/table-body.component.ts +28 -0
- package/src/app/lib/components/ui/table/table-caption.component.ts +28 -0
- package/src/app/lib/components/ui/table/table-cell.component.ts +31 -0
- package/src/app/lib/components/ui/table/table-footer.component.ts +28 -0
- package/src/app/lib/components/ui/table/table-head.component.ts +36 -0
- package/src/app/lib/components/ui/table/table-header.component.ts +28 -0
- package/src/app/lib/components/ui/table/table-row.component.ts +34 -0
- package/src/app/lib/components/ui/table/table.component.ts +52 -0
- package/src/app/lib/components/ui/tabs/index.ts +14 -0
- package/src/app/lib/components/ui/tabs/tabs-content.component.ts +132 -0
- package/src/app/lib/components/ui/tabs/tabs-context.ts +33 -0
- package/src/app/lib/components/ui/tabs/tabs-list.component.ts +228 -0
- package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +167 -0
- package/src/app/lib/components/ui/tabs/tabs.component.ts +203 -0
- package/src/app/lib/components/ui/textarea/index.ts +1 -0
- package/src/app/lib/components/ui/textarea/textarea.component.ts +44 -0
- package/src/app/lib/components/ui/toast/index.ts +16 -0
- package/src/app/lib/components/ui/toast/toast-action.component.ts +77 -0
- package/src/app/lib/components/ui/toast/toast-description.component.ts +52 -0
- package/src/app/lib/components/ui/toast/toast-title.component.ts +52 -0
- package/src/app/lib/components/ui/toast/toast-variants.ts +24 -0
- package/src/app/lib/components/ui/toast/toast.component.ts +177 -0
- package/src/app/lib/components/ui/toast/toast.service.ts +202 -0
- package/src/app/lib/components/ui/toast/toaster.component.ts +128 -0
- package/src/app/lib/components/ui/toggle/index.ts +6 -0
- package/src/app/lib/components/ui/toggle/toggle-variants.ts +30 -0
- package/src/app/lib/components/ui/toggle/toggle.component.ts +199 -0
- package/src/app/lib/components/ui/toggle-group/index.ts +11 -0
- package/src/app/lib/components/ui/toggle-group/toggle-group-context.ts +48 -0
- package/src/app/lib/components/ui/toggle-group/toggle-group-item.component.ts +241 -0
- package/src/app/lib/components/ui/toggle-group/toggle-group.component.ts +288 -0
- package/src/app/lib/components/ui/tooltip/index.ts +14 -0
- package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +154 -0
- package/src/app/lib/components/ui/tooltip/tooltip-context.ts +29 -0
- package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +95 -0
- package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +138 -0
- package/src/app/lib/components/ui/tooltip/tooltip.component.ts +159 -0
- package/src/app/lib/components/ui/typography/index.ts +13 -0
- package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +31 -0
- package/src/app/lib/components/ui/typography/typography-h1.component.ts +32 -0
- package/src/app/lib/components/ui/typography/typography-h2.component.ts +32 -0
- package/src/app/lib/components/ui/typography/typography-h3.component.ts +29 -0
- package/src/app/lib/components/ui/typography/typography-h4.component.ts +29 -0
- package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +31 -0
- package/src/app/lib/components/ui/typography/typography-large.component.ts +28 -0
- package/src/app/lib/components/ui/typography/typography-lead.component.ts +31 -0
- package/src/app/lib/components/ui/typography/typography-list.component.ts +31 -0
- package/src/app/lib/components/ui/typography/typography-muted.component.ts +28 -0
- package/src/app/lib/components/ui/typography/typography-p.component.ts +29 -0
- package/src/app/lib/components/ui/typography/typography-small.component.ts +28 -0
- package/src/app/lib/index.ts +7 -0
- package/src/app/lib/utils/accessibility/aria-id.service.ts +118 -0
- package/src/app/lib/utils/accessibility/click-outside.directive.ts +85 -0
- package/src/app/lib/utils/accessibility/focus-management.service.ts +231 -0
- package/src/app/lib/utils/accessibility/focus-trap.directive.ts +203 -0
- package/src/app/lib/utils/accessibility/index.ts +23 -0
- package/src/app/lib/utils/accessibility/keyboard-navigation.directive.ts +440 -0
- package/src/app/lib/utils/accessibility/live-region.directive.ts +260 -0
- package/src/app/lib/utils/accessibility/touch-target.directive.ts +81 -0
- package/src/app/lib/utils/accessibility/visually-hidden.component.ts +79 -0
- package/src/app/lib/utils/animation/animated.directive.ts +191 -0
- package/src/app/lib/utils/animation/animation-tokens.service.ts +88 -0
- package/src/app/lib/utils/animation/animation.types.ts +55 -0
- package/src/app/lib/utils/animation/animation.utils.ts +158 -0
- package/src/app/lib/utils/animation/index.ts +17 -0
- package/src/app/lib/utils/animation/presence.component.ts +168 -0
- package/src/app/lib/utils/animation/presence.directive.ts +169 -0
- package/src/app/lib/utils/cn.ts +15 -0
- package/src/app/lib/utils/index.ts +11 -0
- package/src/app/lib/utils/positioning/index.ts +218 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
effect,
|
|
7
|
+
forwardRef,
|
|
8
|
+
input,
|
|
9
|
+
output,
|
|
10
|
+
signal,
|
|
11
|
+
} from '@angular/core';
|
|
12
|
+
import {
|
|
13
|
+
ColumnVisibilityState,
|
|
14
|
+
DATA_TABLE_CONTEXT,
|
|
15
|
+
DataTableContext,
|
|
16
|
+
RowSelectionState,
|
|
17
|
+
SortingState,
|
|
18
|
+
type ColumnDef,
|
|
19
|
+
} from './data-table-context';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* DataTable component - sortable, filterable, selectable data table.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <DataTable [data]="users" [columns]="columns">
|
|
26
|
+
* <DataTableToolbar>
|
|
27
|
+
* <DataTableSearch placeholder="Search users..." />
|
|
28
|
+
* <DataTableViewOptions />
|
|
29
|
+
* </DataTableToolbar>
|
|
30
|
+
* <DataTableContent />
|
|
31
|
+
* <DataTablePagination />
|
|
32
|
+
* </DataTable>
|
|
33
|
+
*/
|
|
34
|
+
@Component({
|
|
35
|
+
selector: 'DataTable',
|
|
36
|
+
template: `<ng-content />`,
|
|
37
|
+
host: {
|
|
38
|
+
'[class]': 'computedClass()',
|
|
39
|
+
'data-slot': 'data-table',
|
|
40
|
+
'ngSkipHydration': 'true',
|
|
41
|
+
},
|
|
42
|
+
providers: [
|
|
43
|
+
{
|
|
44
|
+
provide: DATA_TABLE_CONTEXT,
|
|
45
|
+
useFactory: <T>(component: DataTable<T>) => component.context,
|
|
46
|
+
deps: [forwardRef(() => DataTable)],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
50
|
+
})
|
|
51
|
+
export class DataTable<T = unknown> {
|
|
52
|
+
/** The data to display */
|
|
53
|
+
readonly data = input.required<T[]>();
|
|
54
|
+
|
|
55
|
+
/** Column definitions */
|
|
56
|
+
readonly columns = input.required<ColumnDef<T>[]>();
|
|
57
|
+
|
|
58
|
+
/** Page size options */
|
|
59
|
+
readonly pageSizeOptions = input<number[]>([10, 20, 30, 40, 50]);
|
|
60
|
+
|
|
61
|
+
/** Initial page size */
|
|
62
|
+
readonly initialPageSize = input<number>(10);
|
|
63
|
+
|
|
64
|
+
/** Enable row selection */
|
|
65
|
+
readonly enableRowSelection = input<boolean>(false);
|
|
66
|
+
|
|
67
|
+
/** Enable multi-row selection */
|
|
68
|
+
readonly enableMultiRowSelection = input<boolean>(true);
|
|
69
|
+
|
|
70
|
+
/** Sorting change event */
|
|
71
|
+
readonly sortingChange = output<SortingState[]>();
|
|
72
|
+
|
|
73
|
+
/** Row selection change event */
|
|
74
|
+
readonly rowSelectionChange = output<RowSelectionState>();
|
|
75
|
+
|
|
76
|
+
/** Additional CSS classes */
|
|
77
|
+
readonly class = input<string>('');
|
|
78
|
+
|
|
79
|
+
/** Context for child components */
|
|
80
|
+
readonly context: DataTableContext<T> = {
|
|
81
|
+
data: signal<T[]>([]),
|
|
82
|
+
columns: signal<ColumnDef<T>[]>([]),
|
|
83
|
+
sorting: signal<SortingState[]>([]),
|
|
84
|
+
columnVisibility: signal<ColumnVisibilityState>({}),
|
|
85
|
+
rowSelection: signal<RowSelectionState>({}),
|
|
86
|
+
globalFilter: signal<string>(''),
|
|
87
|
+
pageIndex: signal<number>(0),
|
|
88
|
+
pageSize: signal<number>(this.initialPageSize()),
|
|
89
|
+
onSortingChange: (sorting: SortingState[]) => {
|
|
90
|
+
this.context.sorting.set(sorting);
|
|
91
|
+
this.sortingChange.emit(sorting);
|
|
92
|
+
},
|
|
93
|
+
onColumnVisibilityChange: (visibility: ColumnVisibilityState) => {
|
|
94
|
+
this.context.columnVisibility.set(visibility);
|
|
95
|
+
},
|
|
96
|
+
onRowSelectionChange: (selection: RowSelectionState) => {
|
|
97
|
+
this.context.rowSelection.set(selection);
|
|
98
|
+
this.rowSelectionChange.emit(selection);
|
|
99
|
+
},
|
|
100
|
+
onGlobalFilterChange: (filter: string) => {
|
|
101
|
+
this.context.globalFilter.set(filter);
|
|
102
|
+
this.context.pageIndex.set(0); // Reset to first page on filter
|
|
103
|
+
},
|
|
104
|
+
onPaginationChange: (pageIndex: number, pageSize: number) => {
|
|
105
|
+
this.context.pageIndex.set(pageIndex);
|
|
106
|
+
this.context.pageSize.set(pageSize);
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
constructor() {
|
|
111
|
+
// Sync data
|
|
112
|
+
effect(() => {
|
|
113
|
+
this.context.data.set(this.data());
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// Sync columns
|
|
117
|
+
effect(() => {
|
|
118
|
+
this.context.columns.set(this.columns());
|
|
119
|
+
// Initialize column visibility
|
|
120
|
+
const visibility: ColumnVisibilityState = {};
|
|
121
|
+
this.columns().forEach((col) => {
|
|
122
|
+
visibility[col.id] = true;
|
|
123
|
+
});
|
|
124
|
+
this.context.columnVisibility.set(visibility);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
protected readonly computedClass = computed(() =>
|
|
129
|
+
cn('w-full space-y-4', this.class())
|
|
130
|
+
);
|
|
131
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { DataTableContent } from './data-table-content.component';
|
|
2
|
+
export {
|
|
3
|
+
DATA_TABLE_CONTEXT,
|
|
4
|
+
type ColumnDef,
|
|
5
|
+
type ColumnVisibilityState,
|
|
6
|
+
type DataTableContext,
|
|
7
|
+
type RowSelectionState,
|
|
8
|
+
type SortDirection,
|
|
9
|
+
type SortingState
|
|
10
|
+
} from './data-table-context';
|
|
11
|
+
export { DataTablePagination } from './data-table-pagination.component';
|
|
12
|
+
export { DataTableSearch } from './data-table-search.component';
|
|
13
|
+
export { DataTableToolbar } from './data-table-toolbar.component';
|
|
14
|
+
export { DataTableViewOptions } from './data-table-view-options.component';
|
|
15
|
+
export { DataTable } from './data-table.component';
|
|
16
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
input,
|
|
7
|
+
model,
|
|
8
|
+
output
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import { CalendarIcon, LucideAngularModule } from 'lucide-angular';
|
|
11
|
+
import { buttonVariants } from '../button';
|
|
12
|
+
import { Calendar } from '../calendar';
|
|
13
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../popover';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* DatePicker component - date selection with calendar popover.
|
|
17
|
+
* Matches shadcn/ui React DatePicker exactly.
|
|
18
|
+
*/
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'DatePicker',
|
|
21
|
+
imports: [LucideAngularModule, Popover, PopoverTrigger, PopoverContent, Calendar],
|
|
22
|
+
template: `
|
|
23
|
+
<Popover>
|
|
24
|
+
<PopoverTrigger>
|
|
25
|
+
<button
|
|
26
|
+
type="button"
|
|
27
|
+
[class]="computedButtonClass()"
|
|
28
|
+
>
|
|
29
|
+
<lucide-icon [img]="CalendarIconRef" class="mr-2 h-4 w-4" />
|
|
30
|
+
@if (date()) {
|
|
31
|
+
{{ formatDate(date()!) }}
|
|
32
|
+
} @else {
|
|
33
|
+
<span>{{ placeholder() }}</span>
|
|
34
|
+
}
|
|
35
|
+
</button>
|
|
36
|
+
</PopoverTrigger>
|
|
37
|
+
<PopoverContent class="w-auto p-0" align="start">
|
|
38
|
+
<Calendar
|
|
39
|
+
[mode]="'single'"
|
|
40
|
+
[selected]="date()"
|
|
41
|
+
(onSelect)="onDateSelect($event)"
|
|
42
|
+
[disabled]="disabledDates()"
|
|
43
|
+
/>
|
|
44
|
+
</PopoverContent>
|
|
45
|
+
</Popover>
|
|
46
|
+
`,
|
|
47
|
+
host: {
|
|
48
|
+
class: 'contents',
|
|
49
|
+
},
|
|
50
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
51
|
+
})
|
|
52
|
+
export class DatePicker {
|
|
53
|
+
protected readonly CalendarIconRef = CalendarIcon;
|
|
54
|
+
|
|
55
|
+
/** Selected date */
|
|
56
|
+
readonly date = model<Date | undefined>(undefined);
|
|
57
|
+
|
|
58
|
+
/** Placeholder text */
|
|
59
|
+
readonly placeholder = input<string>('Pick a date');
|
|
60
|
+
|
|
61
|
+
/** Date format */
|
|
62
|
+
readonly dateFormat = input<string>('PPP');
|
|
63
|
+
|
|
64
|
+
/** Disabled dates function */
|
|
65
|
+
readonly disabledDates = input<((date: Date) => boolean) | undefined>(undefined);
|
|
66
|
+
|
|
67
|
+
/** Additional CSS classes */
|
|
68
|
+
readonly class = input<string>('');
|
|
69
|
+
|
|
70
|
+
/** Date select event */
|
|
71
|
+
readonly onSelect = output<Date | undefined>();
|
|
72
|
+
|
|
73
|
+
protected readonly computedButtonClass = computed(() =>
|
|
74
|
+
cn(
|
|
75
|
+
buttonVariants({ variant: 'outline' }),
|
|
76
|
+
'w-[280px] justify-start text-left font-normal',
|
|
77
|
+
!this.date() && 'text-muted-foreground',
|
|
78
|
+
this.class()
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
protected formatDate(date: Date): string {
|
|
83
|
+
return date.toLocaleDateString('en-US', {
|
|
84
|
+
year: 'numeric',
|
|
85
|
+
month: 'long',
|
|
86
|
+
day: 'numeric',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
protected onDateSelect(date: Date | undefined): void {
|
|
91
|
+
this.date.set(date);
|
|
92
|
+
this.onSelect.emit(date);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DatePicker } from './date-picker.component';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
inject,
|
|
5
|
+
input,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { DIALOG_CONTEXT } from './dialog-context';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* DialogClose component - button that closes the dialog.
|
|
11
|
+
* Matches shadcn/ui React DialogClose exactly.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'DialogClose',
|
|
15
|
+
template: `<ng-content />`,
|
|
16
|
+
host: {
|
|
17
|
+
'(click)': 'onClick($event)',
|
|
18
|
+
},
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
|
+
})
|
|
21
|
+
export class DialogClose {
|
|
22
|
+
protected readonly context = inject(DIALOG_CONTEXT);
|
|
23
|
+
|
|
24
|
+
/** Render as child */
|
|
25
|
+
readonly asChild = input<boolean>(false);
|
|
26
|
+
|
|
27
|
+
onClick(event: Event): void {
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
this.context.setOpen(false);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { cn, Presence } from '@/lib/utils';
|
|
2
|
+
import { FocusTrapDirective } from '@/lib/utils/accessibility';
|
|
3
|
+
import {
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
Component,
|
|
6
|
+
computed,
|
|
7
|
+
effect,
|
|
8
|
+
ElementRef,
|
|
9
|
+
HostListener,
|
|
10
|
+
inject,
|
|
11
|
+
input,
|
|
12
|
+
OnDestroy,
|
|
13
|
+
viewChild,
|
|
14
|
+
} from '@angular/core';
|
|
15
|
+
import { DIALOG_CONTEXT } from './dialog-context';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* DialogContent component - the content of the dialog.
|
|
19
|
+
* Matches shadcn/ui React DialogContent exactly.
|
|
20
|
+
* Includes focus trapping, focus restoration, proper ARIA relationships,
|
|
21
|
+
* and Radix-compatible exit animations via Presence component.
|
|
22
|
+
*/
|
|
23
|
+
@Component({
|
|
24
|
+
selector: 'DialogContent',
|
|
25
|
+
imports: [FocusTrapDirective, Presence],
|
|
26
|
+
template: `
|
|
27
|
+
<Presence [present]="context.isOpen()">
|
|
28
|
+
<!-- Overlay -->
|
|
29
|
+
<div
|
|
30
|
+
class="fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
31
|
+
[attr.data-state]="context.isOpen() ? 'open' : 'closed'"
|
|
32
|
+
(click)="onOverlayClick($event)"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
></div>
|
|
35
|
+
<!-- Content -->
|
|
36
|
+
<div
|
|
37
|
+
#dialogContent
|
|
38
|
+
hlmFocusTrap
|
|
39
|
+
[trapFocus]="context.isOpen()"
|
|
40
|
+
[autoFocus]="true"
|
|
41
|
+
[restoreFocus]="false"
|
|
42
|
+
[initialFocus]="initialFocus()"
|
|
43
|
+
[class]="computedClass()"
|
|
44
|
+
[attr.data-state]="context.isOpen() ? 'open' : 'closed'"
|
|
45
|
+
[attr.id]="context.contentId"
|
|
46
|
+
[attr.aria-labelledby]="context.titleId"
|
|
47
|
+
[attr.aria-describedby]="context.descriptionId"
|
|
48
|
+
role="dialog"
|
|
49
|
+
aria-modal="true"
|
|
50
|
+
>
|
|
51
|
+
<ng-content />
|
|
52
|
+
<!-- Close button -->
|
|
53
|
+
@if (showClose()) {
|
|
54
|
+
<button
|
|
55
|
+
type="button"
|
|
56
|
+
class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
|
|
57
|
+
(click)="onClose()"
|
|
58
|
+
aria-label="Close dialog"
|
|
59
|
+
>
|
|
60
|
+
<svg
|
|
61
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
62
|
+
width="24"
|
|
63
|
+
height="24"
|
|
64
|
+
viewBox="0 0 24 24"
|
|
65
|
+
fill="none"
|
|
66
|
+
stroke="currentColor"
|
|
67
|
+
stroke-width="2"
|
|
68
|
+
stroke-linecap="round"
|
|
69
|
+
stroke-linejoin="round"
|
|
70
|
+
class="h-4 w-4"
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
>
|
|
73
|
+
<path d="M18 6 6 18" />
|
|
74
|
+
<path d="m6 6 12 12" />
|
|
75
|
+
</svg>
|
|
76
|
+
<span class="sr-only">Close</span>
|
|
77
|
+
</button>
|
|
78
|
+
}
|
|
79
|
+
</div>
|
|
80
|
+
</Presence>
|
|
81
|
+
`,
|
|
82
|
+
host: {
|
|
83
|
+
class: 'contents',
|
|
84
|
+
},
|
|
85
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
86
|
+
})
|
|
87
|
+
export class DialogContent implements OnDestroy {
|
|
88
|
+
readonly context = inject(DIALOG_CONTEXT);
|
|
89
|
+
private readonly dialogContent = viewChild<ElementRef<HTMLElement>>('dialogContent');
|
|
90
|
+
|
|
91
|
+
/** Additional CSS classes */
|
|
92
|
+
readonly class = input<string>('');
|
|
93
|
+
|
|
94
|
+
/** Whether to show close button */
|
|
95
|
+
readonly showClose = input<boolean>(true);
|
|
96
|
+
|
|
97
|
+
/** Selector for initial focus element */
|
|
98
|
+
readonly initialFocus = input<string | undefined>(undefined);
|
|
99
|
+
|
|
100
|
+
/** Previous body overflow for restoration */
|
|
101
|
+
private previousBodyOverflow = '';
|
|
102
|
+
|
|
103
|
+
protected readonly computedClass = computed(() =>
|
|
104
|
+
cn(
|
|
105
|
+
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background text-foreground p-6 shadow-lg duration-200',
|
|
106
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out',
|
|
107
|
+
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
108
|
+
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
|
109
|
+
'data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]',
|
|
110
|
+
'data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]',
|
|
111
|
+
'sm:rounded-lg',
|
|
112
|
+
this.class()
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
constructor() {
|
|
117
|
+
// Handle body scroll lock based on open state
|
|
118
|
+
effect(() => {
|
|
119
|
+
const isOpen = this.context.isOpen();
|
|
120
|
+
if (isOpen) {
|
|
121
|
+
this.lockBodyScroll();
|
|
122
|
+
} else {
|
|
123
|
+
this.unlockBodyScroll();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private lockBodyScroll(): void {
|
|
129
|
+
if (typeof document !== 'undefined') {
|
|
130
|
+
this.previousBodyOverflow = document.body.style.overflow;
|
|
131
|
+
document.body.style.overflow = 'hidden';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
private unlockBodyScroll(): void {
|
|
136
|
+
if (typeof document !== 'undefined') {
|
|
137
|
+
document.body.style.overflow = this.previousBodyOverflow;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
ngOnDestroy(): void {
|
|
142
|
+
// Restore body scroll
|
|
143
|
+
this.unlockBodyScroll();
|
|
144
|
+
// Restore focus to trigger element
|
|
145
|
+
this.restoreFocus();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@HostListener('document:keydown.escape')
|
|
149
|
+
onEscapeKey(): void {
|
|
150
|
+
if (this.context.isOpen()) {
|
|
151
|
+
this.close();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
onOverlayClick(event: Event): void {
|
|
156
|
+
event.stopPropagation();
|
|
157
|
+
this.close();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
onClose(): void {
|
|
161
|
+
this.close();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private close(): void {
|
|
165
|
+
this.restoreFocus();
|
|
166
|
+
this.context.setOpen(false);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private restoreFocus(): void {
|
|
170
|
+
const triggerEl = this.context.triggerElement();
|
|
171
|
+
if (triggerEl) {
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
triggerEl.focus();
|
|
174
|
+
}, 0);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InjectionToken, Signal, WritableSignal } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
export interface DialogContextValue {
|
|
4
|
+
open: WritableSignal<boolean>;
|
|
5
|
+
setOpen: (open: boolean) => void;
|
|
6
|
+
isOpen: Signal<boolean>;
|
|
7
|
+
/** Unique IDs for ARIA relationships */
|
|
8
|
+
titleId: string;
|
|
9
|
+
descriptionId: string;
|
|
10
|
+
contentId: string;
|
|
11
|
+
/** Trigger element reference for focus restoration */
|
|
12
|
+
triggerElement: WritableSignal<HTMLElement | null>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const DIALOG_CONTEXT = new InjectionToken<DialogContextValue>('DIALOG_CONTEXT');
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { DIALOG_CONTEXT } from './dialog-context';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* DialogDescription component - description text of the dialog.
|
|
13
|
+
* Matches shadcn/ui React DialogDescription exactly.
|
|
14
|
+
* Automatically links to dialog via aria-describedby.
|
|
15
|
+
*/
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'DialogDescription',
|
|
18
|
+
template: `<ng-content />`,
|
|
19
|
+
host: {
|
|
20
|
+
'[class]': 'computedClass()',
|
|
21
|
+
'[attr.id]': 'context.descriptionId',
|
|
22
|
+
},
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
})
|
|
25
|
+
export class DialogDescription {
|
|
26
|
+
protected readonly context = inject(DIALOG_CONTEXT);
|
|
27
|
+
|
|
28
|
+
/** Additional CSS classes */
|
|
29
|
+
readonly class = input<string>('');
|
|
30
|
+
|
|
31
|
+
protected readonly computedClass = computed(() =>
|
|
32
|
+
cn('text-sm text-muted-foreground', this.class())
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
input,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* DialogFooter component - footer area of the dialog.
|
|
11
|
+
* Matches shadcn/ui React DialogFooter exactly.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'DialogFooter',
|
|
15
|
+
template: `<ng-content />`,
|
|
16
|
+
host: {
|
|
17
|
+
'[class]': 'computedClass()',
|
|
18
|
+
},
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
|
+
})
|
|
21
|
+
export class DialogFooter {
|
|
22
|
+
/** Additional CSS classes */
|
|
23
|
+
readonly class = input<string>('');
|
|
24
|
+
|
|
25
|
+
protected readonly computedClass = computed(() =>
|
|
26
|
+
cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', this.class())
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
input,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* DialogHeader component - header area of the dialog.
|
|
11
|
+
* Matches shadcn/ui React DialogHeader exactly.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'DialogHeader',
|
|
15
|
+
template: `<ng-content />`,
|
|
16
|
+
host: {
|
|
17
|
+
'[class]': 'computedClass()',
|
|
18
|
+
},
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
|
+
})
|
|
21
|
+
export class DialogHeader {
|
|
22
|
+
/** Additional CSS classes */
|
|
23
|
+
readonly class = input<string>('');
|
|
24
|
+
|
|
25
|
+
protected readonly computedClass = computed(() =>
|
|
26
|
+
cn('flex flex-col space-y-1.5 text-center sm:text-left', this.class())
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { DIALOG_CONTEXT } from './dialog-context';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* DialogTitle component - title text of the dialog.
|
|
13
|
+
* Matches shadcn/ui React DialogTitle exactly.
|
|
14
|
+
* Automatically links to dialog via aria-labelledby.
|
|
15
|
+
*/
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'DialogTitle',
|
|
18
|
+
template: `<ng-content />`,
|
|
19
|
+
host: {
|
|
20
|
+
'[class]': 'computedClass()',
|
|
21
|
+
'[attr.id]': 'context.titleId',
|
|
22
|
+
},
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
})
|
|
25
|
+
export class DialogTitle {
|
|
26
|
+
protected readonly context = inject(DIALOG_CONTEXT);
|
|
27
|
+
|
|
28
|
+
/** Additional CSS classes */
|
|
29
|
+
readonly class = input<string>('');
|
|
30
|
+
|
|
31
|
+
protected readonly computedClass = computed(() =>
|
|
32
|
+
cn('text-lg font-semibold leading-none tracking-tight', this.class())
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
ElementRef,
|
|
5
|
+
inject,
|
|
6
|
+
input,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import { DIALOG_CONTEXT } from './dialog-context';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* DialogTrigger component - element that opens the dialog.
|
|
12
|
+
* Matches shadcn/ui React DialogTrigger exactly.
|
|
13
|
+
*/
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'DialogTrigger',
|
|
16
|
+
template: `<ng-content />`,
|
|
17
|
+
host: {
|
|
18
|
+
'(click)': 'onClick($event)',
|
|
19
|
+
'[attr.aria-haspopup]': '"dialog"',
|
|
20
|
+
'[attr.aria-expanded]': 'context.isOpen()',
|
|
21
|
+
'[attr.aria-controls]': 'context.contentId',
|
|
22
|
+
},
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
})
|
|
25
|
+
export class DialogTrigger {
|
|
26
|
+
protected readonly context = inject(DIALOG_CONTEXT);
|
|
27
|
+
private readonly elementRef = inject(ElementRef<HTMLElement>);
|
|
28
|
+
|
|
29
|
+
/** Render as child */
|
|
30
|
+
readonly asChild = input<boolean>(false);
|
|
31
|
+
|
|
32
|
+
onClick(event: Event): void {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
// Save trigger element for focus restoration
|
|
35
|
+
this.context.triggerElement.set(this.elementRef.nativeElement);
|
|
36
|
+
this.context.setOpen(true);
|
|
37
|
+
}
|
|
38
|
+
}
|