@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,308 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import {
|
|
10
|
+
CHART_COLORS,
|
|
11
|
+
CHART_CONTEXT,
|
|
12
|
+
type ChartDataPoint,
|
|
13
|
+
type ChartSeries,
|
|
14
|
+
type ChartType,
|
|
15
|
+
} from './chart-context';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Chart component - renders the actual chart visualization.
|
|
19
|
+
* This is a simplified SVG-based chart implementation.
|
|
20
|
+
* For production use, integrate with a charting library like ng2-charts or ngx-charts.
|
|
21
|
+
*/
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'Chart',
|
|
24
|
+
template: `
|
|
25
|
+
<svg [attr.viewBox]="viewBox()" class="w-full h-full">
|
|
26
|
+
@switch (type()) {
|
|
27
|
+
@case ('bar') {
|
|
28
|
+
@for (bar of barData(); track $index) {
|
|
29
|
+
<rect
|
|
30
|
+
[attr.x]="bar.x"
|
|
31
|
+
[attr.y]="bar.y"
|
|
32
|
+
[attr.width]="bar.width"
|
|
33
|
+
[attr.height]="bar.height"
|
|
34
|
+
[attr.fill]="bar.color"
|
|
35
|
+
class="transition-all duration-300 hover:opacity-80"
|
|
36
|
+
rx="4"
|
|
37
|
+
/>
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
@case ('line') {
|
|
41
|
+
<path
|
|
42
|
+
[attr.d]="linePath()"
|
|
43
|
+
fill="none"
|
|
44
|
+
[attr.stroke]="primaryColor()"
|
|
45
|
+
stroke-width="2"
|
|
46
|
+
class="transition-all duration-300"
|
|
47
|
+
/>
|
|
48
|
+
@for (point of linePoints(); track $index) {
|
|
49
|
+
<circle
|
|
50
|
+
[attr.cx]="point.x"
|
|
51
|
+
[attr.cy]="point.y"
|
|
52
|
+
r="4"
|
|
53
|
+
[attr.fill]="primaryColor()"
|
|
54
|
+
class="transition-all duration-300 hover:r-6"
|
|
55
|
+
/>
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
@case ('area') {
|
|
59
|
+
<path
|
|
60
|
+
[attr.d]="areaPath()"
|
|
61
|
+
[attr.fill]="primaryColor()"
|
|
62
|
+
fill-opacity="0.2"
|
|
63
|
+
class="transition-all duration-300"
|
|
64
|
+
/>
|
|
65
|
+
<path
|
|
66
|
+
[attr.d]="linePath()"
|
|
67
|
+
fill="none"
|
|
68
|
+
[attr.stroke]="primaryColor()"
|
|
69
|
+
stroke-width="2"
|
|
70
|
+
class="transition-all duration-300"
|
|
71
|
+
/>
|
|
72
|
+
}
|
|
73
|
+
@case ('pie') {
|
|
74
|
+
@for (slice of pieSlices(); track $index) {
|
|
75
|
+
<path
|
|
76
|
+
[attr.d]="slice.path"
|
|
77
|
+
[attr.fill]="slice.color"
|
|
78
|
+
class="transition-all duration-300 hover:opacity-80"
|
|
79
|
+
/>
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
@case ('donut') {
|
|
83
|
+
@for (slice of donutSlices(); track $index) {
|
|
84
|
+
<path
|
|
85
|
+
[attr.d]="slice.path"
|
|
86
|
+
[attr.fill]="slice.color"
|
|
87
|
+
class="transition-all duration-300 hover:opacity-80"
|
|
88
|
+
/>
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
<!-- X-axis labels -->
|
|
94
|
+
@if (showXAxis()) {
|
|
95
|
+
@for (label of xAxisLabels(); track $index) {
|
|
96
|
+
<text
|
|
97
|
+
[attr.x]="label.x"
|
|
98
|
+
[attr.y]="height() - 5"
|
|
99
|
+
text-anchor="middle"
|
|
100
|
+
class="fill-muted-foreground text-[10px]"
|
|
101
|
+
>
|
|
102
|
+
{{ label.text }}
|
|
103
|
+
</text>
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
<!-- Y-axis labels -->
|
|
108
|
+
@if (showYAxis()) {
|
|
109
|
+
@for (label of yAxisLabels(); track $index) {
|
|
110
|
+
<text
|
|
111
|
+
[attr.x]="5"
|
|
112
|
+
[attr.y]="label.y"
|
|
113
|
+
text-anchor="start"
|
|
114
|
+
class="fill-muted-foreground text-[10px]"
|
|
115
|
+
>
|
|
116
|
+
{{ label.text }}
|
|
117
|
+
</text>
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
</svg>
|
|
121
|
+
`,
|
|
122
|
+
host: {
|
|
123
|
+
'[class]': 'computedClass()',
|
|
124
|
+
},
|
|
125
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
126
|
+
})
|
|
127
|
+
export class Chart {
|
|
128
|
+
private readonly context = inject(CHART_CONTEXT, { optional: true });
|
|
129
|
+
|
|
130
|
+
/** Chart type */
|
|
131
|
+
readonly type = input<ChartType>('bar');
|
|
132
|
+
|
|
133
|
+
/** Data points for the chart */
|
|
134
|
+
readonly data = input<ChartDataPoint[]>([]);
|
|
135
|
+
|
|
136
|
+
/** Series data for multi-series charts */
|
|
137
|
+
readonly series = input<ChartSeries[]>([]);
|
|
138
|
+
|
|
139
|
+
/** Chart width */
|
|
140
|
+
readonly width = input<number>(400);
|
|
141
|
+
|
|
142
|
+
/** Chart height */
|
|
143
|
+
readonly height = input<number>(300);
|
|
144
|
+
|
|
145
|
+
/** Show X axis */
|
|
146
|
+
readonly showXAxis = input<boolean>(true);
|
|
147
|
+
|
|
148
|
+
/** Show Y axis */
|
|
149
|
+
readonly showYAxis = input<boolean>(true);
|
|
150
|
+
|
|
151
|
+
/** Additional CSS classes */
|
|
152
|
+
readonly class = input<string>('');
|
|
153
|
+
|
|
154
|
+
protected readonly viewBox = computed(
|
|
155
|
+
() => `0 0 ${this.width()} ${this.height()}`
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
protected readonly primaryColor = computed(() => {
|
|
159
|
+
const config = this.context?.config() || {};
|
|
160
|
+
const firstKey = Object.keys(config)[0];
|
|
161
|
+
return config[firstKey]?.color || CHART_COLORS.chart1;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
protected readonly barData = computed(() => {
|
|
165
|
+
const data = this.data();
|
|
166
|
+
const config = this.context?.config() || {};
|
|
167
|
+
const w = this.width();
|
|
168
|
+
const h = this.height();
|
|
169
|
+
const padding = 40;
|
|
170
|
+
const maxValue = Math.max(...data.map((d) => d.value), 1);
|
|
171
|
+
const barWidth = (w - padding * 2) / data.length - 10;
|
|
172
|
+
|
|
173
|
+
return data.map((d, i) => ({
|
|
174
|
+
x: padding + i * (barWidth + 10) + 5,
|
|
175
|
+
y: padding + (h - padding * 2) * (1 - d.value / maxValue),
|
|
176
|
+
width: barWidth,
|
|
177
|
+
height: (h - padding * 2) * (d.value / maxValue),
|
|
178
|
+
color: d.color || config[d.label]?.color || CHART_COLORS.chart1,
|
|
179
|
+
}));
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
protected readonly linePoints = computed(() => {
|
|
183
|
+
const data = this.data();
|
|
184
|
+
const w = this.width();
|
|
185
|
+
const h = this.height();
|
|
186
|
+
const padding = 40;
|
|
187
|
+
const maxValue = Math.max(...data.map((d) => d.value), 1);
|
|
188
|
+
|
|
189
|
+
return data.map((d, i) => ({
|
|
190
|
+
x: padding + (i / Math.max(data.length - 1, 1)) * (w - padding * 2),
|
|
191
|
+
y: padding + (h - padding * 2) * (1 - d.value / maxValue),
|
|
192
|
+
}));
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
protected readonly linePath = computed(() => {
|
|
196
|
+
const points = this.linePoints();
|
|
197
|
+
if (points.length === 0) return '';
|
|
198
|
+
return (
|
|
199
|
+
`M ${points[0].x} ${points[0].y}` +
|
|
200
|
+
points.slice(1).map((p) => ` L ${p.x} ${p.y}`).join('')
|
|
201
|
+
);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
protected readonly areaPath = computed(() => {
|
|
205
|
+
const points = this.linePoints();
|
|
206
|
+
const h = this.height();
|
|
207
|
+
const padding = 40;
|
|
208
|
+
if (points.length === 0) return '';
|
|
209
|
+
|
|
210
|
+
const linePath = this.linePath();
|
|
211
|
+
const lastX = points[points.length - 1].x;
|
|
212
|
+
const firstX = points[0].x;
|
|
213
|
+
const bottomY = h - padding;
|
|
214
|
+
|
|
215
|
+
return `${linePath} L ${lastX} ${bottomY} L ${firstX} ${bottomY} Z`;
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
protected readonly pieSlices = computed(() => {
|
|
219
|
+
const data = this.data();
|
|
220
|
+
const config = this.context?.config() || {};
|
|
221
|
+
const total = data.reduce((sum, d) => sum + d.value, 0);
|
|
222
|
+
const cx = this.width() / 2;
|
|
223
|
+
const cy = this.height() / 2;
|
|
224
|
+
const radius = Math.min(cx, cy) - 20;
|
|
225
|
+
const colors = Object.values(CHART_COLORS);
|
|
226
|
+
|
|
227
|
+
let currentAngle = -Math.PI / 2;
|
|
228
|
+
return data.map((d, i) => {
|
|
229
|
+
const angle = (d.value / total) * Math.PI * 2;
|
|
230
|
+
const startAngle = currentAngle;
|
|
231
|
+
const endAngle = currentAngle + angle;
|
|
232
|
+
currentAngle = endAngle;
|
|
233
|
+
|
|
234
|
+
const x1 = cx + radius * Math.cos(startAngle);
|
|
235
|
+
const y1 = cy + radius * Math.sin(startAngle);
|
|
236
|
+
const x2 = cx + radius * Math.cos(endAngle);
|
|
237
|
+
const y2 = cy + radius * Math.sin(endAngle);
|
|
238
|
+
const largeArc = angle > Math.PI ? 1 : 0;
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
path: `M ${cx} ${cy} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} Z`,
|
|
242
|
+
color: d.color || config[d.label]?.color || colors[i % colors.length],
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
protected readonly donutSlices = computed(() => {
|
|
248
|
+
const data = this.data();
|
|
249
|
+
const config = this.context?.config() || {};
|
|
250
|
+
const total = data.reduce((sum, d) => sum + d.value, 0);
|
|
251
|
+
const cx = this.width() / 2;
|
|
252
|
+
const cy = this.height() / 2;
|
|
253
|
+
const outerRadius = Math.min(cx, cy) - 20;
|
|
254
|
+
const innerRadius = outerRadius * 0.6;
|
|
255
|
+
const colors = Object.values(CHART_COLORS);
|
|
256
|
+
|
|
257
|
+
let currentAngle = -Math.PI / 2;
|
|
258
|
+
return data.map((d, i) => {
|
|
259
|
+
const angle = (d.value / total) * Math.PI * 2;
|
|
260
|
+
const startAngle = currentAngle;
|
|
261
|
+
const endAngle = currentAngle + angle;
|
|
262
|
+
currentAngle = endAngle;
|
|
263
|
+
|
|
264
|
+
const x1 = cx + outerRadius * Math.cos(startAngle);
|
|
265
|
+
const y1 = cy + outerRadius * Math.sin(startAngle);
|
|
266
|
+
const x2 = cx + outerRadius * Math.cos(endAngle);
|
|
267
|
+
const y2 = cy + outerRadius * Math.sin(endAngle);
|
|
268
|
+
const x3 = cx + innerRadius * Math.cos(endAngle);
|
|
269
|
+
const y3 = cy + innerRadius * Math.sin(endAngle);
|
|
270
|
+
const x4 = cx + innerRadius * Math.cos(startAngle);
|
|
271
|
+
const y4 = cy + innerRadius * Math.sin(startAngle);
|
|
272
|
+
const largeArc = angle > Math.PI ? 1 : 0;
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
path: `M ${x1} ${y1} A ${outerRadius} ${outerRadius} 0 ${largeArc} 1 ${x2} ${y2} L ${x3} ${y3} A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${x4} ${y4} Z`,
|
|
276
|
+
color: d.color || config[d.label]?.color || colors[i % colors.length],
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
protected readonly xAxisLabels = computed(() => {
|
|
282
|
+
const data = this.data();
|
|
283
|
+
const w = this.width();
|
|
284
|
+
const padding = 40;
|
|
285
|
+
|
|
286
|
+
return data.map((d, i) => ({
|
|
287
|
+
x: padding + (i / Math.max(data.length - 1, 1)) * (w - padding * 2),
|
|
288
|
+
text: d.label,
|
|
289
|
+
}));
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
protected readonly yAxisLabels = computed(() => {
|
|
293
|
+
const data = this.data();
|
|
294
|
+
const h = this.height();
|
|
295
|
+
const padding = 40;
|
|
296
|
+
const maxValue = Math.max(...data.map((d) => d.value), 1);
|
|
297
|
+
const steps = 5;
|
|
298
|
+
|
|
299
|
+
return Array.from({ length: steps + 1 }, (_, i) => ({
|
|
300
|
+
y: padding + ((h - padding * 2) * i) / steps,
|
|
301
|
+
text: String(Math.round(maxValue * (1 - i / steps))),
|
|
302
|
+
}));
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
protected readonly computedClass = computed(() =>
|
|
306
|
+
cn('w-full h-full', this.class())
|
|
307
|
+
);
|
|
308
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { ChartContainer } from './chart-container.component';
|
|
2
|
+
export {
|
|
3
|
+
CHART_COLORS,
|
|
4
|
+
CHART_CONTEXT,
|
|
5
|
+
type ChartConfig,
|
|
6
|
+
type ChartContext,
|
|
7
|
+
type ChartDataPoint,
|
|
8
|
+
type ChartSeries,
|
|
9
|
+
type ChartType
|
|
10
|
+
} from './chart-context';
|
|
11
|
+
export { ChartLegendContent } from './chart-legend-content.component';
|
|
12
|
+
export { ChartLegend } from './chart-legend.component';
|
|
13
|
+
export { ChartTooltipContent } from './chart-tooltip-content.component';
|
|
14
|
+
export { ChartTooltip } from './chart-tooltip.component';
|
|
15
|
+
export { Chart } from './chart.component';
|
|
16
|
+
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
ElementRef,
|
|
7
|
+
forwardRef,
|
|
8
|
+
input,
|
|
9
|
+
model,
|
|
10
|
+
signal,
|
|
11
|
+
viewChild,
|
|
12
|
+
} from '@angular/core';
|
|
13
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Checkbox component for boolean selection.
|
|
17
|
+
* Implements ControlValueAccessor for Angular Forms integration.
|
|
18
|
+
* Supports checked, unchecked, and indeterminate states (Radix UI compatible).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <!-- Basic checkbox -->
|
|
22
|
+
* <Checkbox id="terms" />
|
|
23
|
+
*
|
|
24
|
+
* <!-- Controlled checkbox -->
|
|
25
|
+
* <Checkbox [(checked)]="isChecked" />
|
|
26
|
+
*
|
|
27
|
+
* <!-- Indeterminate state -->
|
|
28
|
+
* <Checkbox [checked]="'indeterminate'" />
|
|
29
|
+
*
|
|
30
|
+
* <!-- With reactive forms -->
|
|
31
|
+
* <Checkbox formControlName="agree" />
|
|
32
|
+
*
|
|
33
|
+
* <!-- Disabled checkbox -->
|
|
34
|
+
* <Checkbox [disabled]="true" />
|
|
35
|
+
*
|
|
36
|
+
* <!-- With label -->
|
|
37
|
+
* <div class="flex items-center gap-2">
|
|
38
|
+
* <Checkbox id="terms" />
|
|
39
|
+
* <Label for="terms">Accept terms</Label>
|
|
40
|
+
* </div>
|
|
41
|
+
*/
|
|
42
|
+
@Component({
|
|
43
|
+
selector: 'Checkbox',
|
|
44
|
+
template: `
|
|
45
|
+
<input
|
|
46
|
+
#inputElement
|
|
47
|
+
type="checkbox"
|
|
48
|
+
[attr.id]="id()"
|
|
49
|
+
[checked]="checked() === true"
|
|
50
|
+
[indeterminate]="checked() === 'indeterminate'"
|
|
51
|
+
[disabled]="isDisabled()"
|
|
52
|
+
(change)="toggle()"
|
|
53
|
+
class="sr-only peer"
|
|
54
|
+
/>
|
|
55
|
+
<div
|
|
56
|
+
[class]="boxClass()"
|
|
57
|
+
[attr.data-state]="getDataState()"
|
|
58
|
+
[attr.data-disabled]="isDisabled() ? '' : null"
|
|
59
|
+
aria-hidden="true"
|
|
60
|
+
>
|
|
61
|
+
<span
|
|
62
|
+
data-slot="checkbox-indicator"
|
|
63
|
+
class="flex items-center justify-center text-current"
|
|
64
|
+
>
|
|
65
|
+
@if (checked() === true) {
|
|
66
|
+
<svg
|
|
67
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
68
|
+
width="16"
|
|
69
|
+
height="16"
|
|
70
|
+
viewBox="0 0 24 24"
|
|
71
|
+
fill="none"
|
|
72
|
+
stroke="currentColor"
|
|
73
|
+
stroke-width="3"
|
|
74
|
+
stroke-linecap="round"
|
|
75
|
+
stroke-linejoin="round"
|
|
76
|
+
[class]="checkIconClass()"
|
|
77
|
+
>
|
|
78
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
|
79
|
+
</svg>
|
|
80
|
+
}
|
|
81
|
+
@if (checked() === 'indeterminate') {
|
|
82
|
+
<svg
|
|
83
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
84
|
+
width="16"
|
|
85
|
+
height="16"
|
|
86
|
+
viewBox="0 0 24 24"
|
|
87
|
+
fill="none"
|
|
88
|
+
stroke="currentColor"
|
|
89
|
+
stroke-width="3"
|
|
90
|
+
stroke-linecap="round"
|
|
91
|
+
stroke-linejoin="round"
|
|
92
|
+
[class]="checkIconClass()"
|
|
93
|
+
>
|
|
94
|
+
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
95
|
+
</svg>
|
|
96
|
+
}
|
|
97
|
+
</span>
|
|
98
|
+
</div>
|
|
99
|
+
`,
|
|
100
|
+
host: {
|
|
101
|
+
'[class]': 'computedClass()',
|
|
102
|
+
'data-slot': 'checkbox',
|
|
103
|
+
},
|
|
104
|
+
providers: [
|
|
105
|
+
{
|
|
106
|
+
provide: NG_VALUE_ACCESSOR,
|
|
107
|
+
useExisting: forwardRef(() => Checkbox),
|
|
108
|
+
multi: true,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
112
|
+
})
|
|
113
|
+
export class Checkbox implements ControlValueAccessor {
|
|
114
|
+
private readonly inputElement = viewChild<ElementRef<HTMLInputElement>>('inputElement');
|
|
115
|
+
|
|
116
|
+
/** The id for the checkbox input - used for label association */
|
|
117
|
+
readonly id = input<string>();
|
|
118
|
+
|
|
119
|
+
/** Whether the checkbox is checked (boolean) or indeterminate ('indeterminate') */
|
|
120
|
+
readonly checked = model<boolean | 'indeterminate'>(false);
|
|
121
|
+
|
|
122
|
+
/** Whether the checkbox is disabled via input */
|
|
123
|
+
readonly disabled = input<boolean>(false);
|
|
124
|
+
|
|
125
|
+
/** Whether the checkbox is disabled via forms */
|
|
126
|
+
private readonly formsDisabled = signal<boolean>(false);
|
|
127
|
+
|
|
128
|
+
/** Whether the checkbox is disabled (either via input or forms) */
|
|
129
|
+
readonly isDisabled = computed(() => this.disabled() || this.formsDisabled());
|
|
130
|
+
|
|
131
|
+
/** Additional CSS classes to apply */
|
|
132
|
+
readonly class = input<string>('');
|
|
133
|
+
|
|
134
|
+
/** ControlValueAccessor callbacks */
|
|
135
|
+
private onChange: (value: boolean | 'indeterminate') => void = () => {};
|
|
136
|
+
private onTouched: () => void = () => {};
|
|
137
|
+
|
|
138
|
+
/** Get the data-state attribute value */
|
|
139
|
+
getDataState(): string {
|
|
140
|
+
const state = this.checked();
|
|
141
|
+
if (state === true) return 'checked';
|
|
142
|
+
if (state === 'indeterminate') return 'indeterminate';
|
|
143
|
+
return 'unchecked';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Toggle the checkbox state */
|
|
147
|
+
toggle() {
|
|
148
|
+
if (!this.isDisabled()) {
|
|
149
|
+
const current = this.checked();
|
|
150
|
+
// Cycle through: unchecked -> checked -> unchecked
|
|
151
|
+
const next = current === true ? false : true;
|
|
152
|
+
this.checked.set(next);
|
|
153
|
+
this.onChange(next);
|
|
154
|
+
this.onTouched();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ControlValueAccessor implementation
|
|
159
|
+
writeValue(value: boolean | 'indeterminate'): void {
|
|
160
|
+
this.checked.set(value ?? false);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
registerOnChange(fn: (value: boolean | 'indeterminate') => void): void {
|
|
164
|
+
this.onChange = fn;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
registerOnTouched(fn: () => void): void {
|
|
168
|
+
this.onTouched = fn;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
setDisabledState(isDisabled: boolean): void {
|
|
172
|
+
this.formsDisabled.set(isDisabled);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Computed class for the check icon with animation */
|
|
176
|
+
protected readonly checkIconClass = computed(() =>
|
|
177
|
+
cn(
|
|
178
|
+
'size-3.5 transition-all duration-200 ease-in-out',
|
|
179
|
+
this.checked()
|
|
180
|
+
? 'opacity-100 scale-100'
|
|
181
|
+
: 'opacity-0 scale-0'
|
|
182
|
+
)
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
/** Computed class for the visual checkbox box */
|
|
186
|
+
protected readonly boxClass = computed(() =>
|
|
187
|
+
cn(
|
|
188
|
+
'peer-focus-visible:border-ring peer-focus-visible:ring-ring/50 peer-focus-visible:ring-[3px]',
|
|
189
|
+
'border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary',
|
|
190
|
+
'size-4 shrink-0 rounded-[4px] border shadow-xs transition-all duration-200 outline-none',
|
|
191
|
+
'inline-flex items-center justify-center cursor-pointer',
|
|
192
|
+
this.isDisabled() && 'cursor-not-allowed opacity-50'
|
|
193
|
+
)
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
/** Computed class combining base styles and custom classes */
|
|
197
|
+
protected readonly computedClass = computed(() =>
|
|
198
|
+
cn(
|
|
199
|
+
'relative inline-flex',
|
|
200
|
+
this.class()
|
|
201
|
+
)
|
|
202
|
+
);
|
|
203
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox } from './checkbox.component';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { COLLAPSIBLE_CONTEXT } from './collapsible-context';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* CollapsibleContent component - content that is shown/hidden.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <CollapsibleContent>
|
|
16
|
+
* <p>Content that can be collapsed</p>
|
|
17
|
+
* </CollapsibleContent>
|
|
18
|
+
*/
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'CollapsibleContent',
|
|
21
|
+
template: `
|
|
22
|
+
<div [class]="innerClass()">
|
|
23
|
+
<ng-content />
|
|
24
|
+
</div>
|
|
25
|
+
`,
|
|
26
|
+
host: {
|
|
27
|
+
'[class]': 'computedClass()',
|
|
28
|
+
'[attr.data-state]': 'collapsible.isOpen() ? "open" : "closed"',
|
|
29
|
+
'[attr.data-disabled]': 'collapsible.disabled() ? "" : null',
|
|
30
|
+
'[attr.aria-hidden]': '!collapsible.isOpen()',
|
|
31
|
+
},
|
|
32
|
+
styles: [`
|
|
33
|
+
:host {
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-rows: 0fr;
|
|
36
|
+
transition: grid-template-rows 200ms ease-out;
|
|
37
|
+
}
|
|
38
|
+
:host[data-state="open"] {
|
|
39
|
+
grid-template-rows: 1fr;
|
|
40
|
+
}
|
|
41
|
+
`],
|
|
42
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
43
|
+
})
|
|
44
|
+
export class CollapsibleContent {
|
|
45
|
+
protected readonly collapsible = inject(COLLAPSIBLE_CONTEXT);
|
|
46
|
+
|
|
47
|
+
/** Additional CSS classes */
|
|
48
|
+
readonly class = input<string>('');
|
|
49
|
+
|
|
50
|
+
protected readonly computedClass = computed(() =>
|
|
51
|
+
cn(
|
|
52
|
+
'overflow-hidden',
|
|
53
|
+
this.class()
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
protected readonly innerClass = computed(() => 'min-h-0');
|
|
58
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Types
|
|
5
|
+
// ============================================================================
|
|
6
|
+
|
|
7
|
+
export interface CollapsibleContext {
|
|
8
|
+
isOpen: () => boolean;
|
|
9
|
+
toggle: () => void;
|
|
10
|
+
disabled: () => boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Injection Tokens
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
export const COLLAPSIBLE_CONTEXT = new InjectionToken<CollapsibleContext>('CollapsibleContext');
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
inject,
|
|
7
|
+
input,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { COLLAPSIBLE_CONTEXT } from './collapsible-context';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* CollapsibleTrigger component - clickable element that toggles content.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <CollapsibleTrigger>Click to toggle</CollapsibleTrigger>
|
|
16
|
+
*/
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'CollapsibleTrigger',
|
|
19
|
+
template: `<ng-content />`,
|
|
20
|
+
host: {
|
|
21
|
+
'[class]': 'computedClass()',
|
|
22
|
+
'[attr.data-state]': 'collapsible.isOpen() ? "open" : "closed"',
|
|
23
|
+
'[attr.data-disabled]': 'collapsible.disabled() ? "" : null',
|
|
24
|
+
'[attr.aria-expanded]': 'collapsible.isOpen()',
|
|
25
|
+
'[attr.disabled]': 'collapsible.disabled() ? true : null',
|
|
26
|
+
'(click)': 'onClick()',
|
|
27
|
+
'(keydown.enter)': 'onClick()',
|
|
28
|
+
'(keydown.space)': 'onSpace($event)',
|
|
29
|
+
'[attr.tabindex]': 'collapsible.disabled() ? -1 : 0',
|
|
30
|
+
'role': 'button',
|
|
31
|
+
},
|
|
32
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
33
|
+
})
|
|
34
|
+
export class CollapsibleTrigger {
|
|
35
|
+
protected readonly collapsible = inject(COLLAPSIBLE_CONTEXT);
|
|
36
|
+
|
|
37
|
+
/** Additional CSS classes */
|
|
38
|
+
readonly class = input<string>('');
|
|
39
|
+
|
|
40
|
+
protected readonly computedClass = computed(() =>
|
|
41
|
+
cn(
|
|
42
|
+
'cursor-pointer',
|
|
43
|
+
'disabled:pointer-events-none disabled:opacity-50',
|
|
44
|
+
this.class()
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
protected onClick(): void {
|
|
49
|
+
this.collapsible.toggle();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
protected onSpace(event: Event): void {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
this.onClick();
|
|
55
|
+
}
|
|
56
|
+
}
|