@ng-cn/core 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +34 -33
- package/schematics/component/index.js +454 -95
- package/schematics/component/index.ts +459 -98
- package/schematics/ng-add/index.js +539 -55
- package/schematics/ng-add/index.ts +555 -62
- package/schematics/ng-add/schema.json +8 -2
- package/schematics/test-schematic.js +1 -2
- package/src/app/lib/components/ui/.gitkeep +0 -0
- package/src/app/lib/components/ui/accordion/accordion-content.component.ts +16 -24
- package/src/app/lib/components/ui/accordion/accordion-context.ts +4 -9
- package/src/app/lib/components/ui/accordion/accordion-item.component.ts +33 -29
- package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +11 -14
- package/src/app/lib/components/ui/accordion/accordion.component.ts +60 -49
- package/src/app/lib/components/ui/accordion/index.ts +5 -6
- package/src/app/lib/components/ui/alert/alert-description.component.ts +3 -8
- package/src/app/lib/components/ui/alert/alert-title.component.ts +2 -7
- package/src/app/lib/components/ui/alert/alert-variants.ts +19 -5
- package/src/app/lib/components/ui/alert/alert.component.ts +2 -10
- package/src/app/lib/components/ui/alert/index.ts +0 -1
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +5 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +5 -11
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +63 -66
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-context.ts +10 -5
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +5 -10
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +3 -7
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +3 -7
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +5 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +8 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +28 -34
- package/src/app/lib/components/ui/alert-dialog/index.ts +0 -1
- package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +3 -9
- package/src/app/lib/components/ui/avatar/avatar-context.ts +9 -0
- package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +7 -18
- package/src/app/lib/components/ui/avatar/avatar-image.component.ts +39 -17
- package/src/app/lib/components/ui/avatar/avatar.component.ts +17 -20
- package/src/app/lib/components/ui/avatar/index.ts +1 -1
- package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +9 -30
- package/src/app/lib/components/ui/badge/badge-variants.ts +5 -5
- package/src/app/lib/components/ui/badge/badge.component.ts +4 -8
- package/src/app/lib/components/ui/badge/index.ts +0 -1
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +5 -14
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +6 -18
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +6 -15
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +22 -31
- package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +3 -9
- package/src/app/lib/components/ui/breadcrumb/index.ts +0 -1
- package/src/app/lib/components/ui/button/button-variants.ts +6 -8
- package/src/app/lib/components/ui/button/button.component.ts +4 -8
- package/src/app/lib/components/ui/button/index.ts +0 -1
- package/src/app/lib/components/ui/button-group/button-group-variants.ts +12 -15
- package/src/app/lib/components/ui/button-group/button-group.component.ts +6 -14
- package/src/app/lib/components/ui/button-group/index.ts +1 -5
- package/src/app/lib/components/ui/calendar/calendar.component.ts +103 -115
- package/src/app/lib/components/ui/card/card-action.component.ts +2 -10
- package/src/app/lib/components/ui/card/card-content.component.ts +1 -6
- package/src/app/lib/components/ui/card/card-description.component.ts +2 -7
- package/src/app/lib/components/ui/card/card-footer.component.ts +2 -7
- package/src/app/lib/components/ui/card/card-header.component.ts +3 -8
- package/src/app/lib/components/ui/card/card-title.component.ts +2 -9
- package/src/app/lib/components/ui/card/card.component.ts +3 -8
- package/src/app/lib/components/ui/card/index.ts +0 -1
- package/src/app/lib/components/ui/carousel/carousel-content.component.ts +3 -9
- package/src/app/lib/components/ui/carousel/carousel-item.component.ts +5 -5
- package/src/app/lib/components/ui/carousel/carousel-next.component.ts +9 -8
- package/src/app/lib/components/ui/carousel/carousel-previous.component.ts +9 -8
- package/src/app/lib/components/ui/carousel/carousel.component.ts +14 -25
- package/src/app/lib/components/ui/carousel/index.ts +5 -2
- package/src/app/lib/components/ui/chart/chart-container.component.ts +20 -26
- package/src/app/lib/components/ui/chart/chart-legend-content.component.ts +6 -16
- package/src/app/lib/components/ui/chart/chart-legend.component.ts +2 -7
- package/src/app/lib/components/ui/chart/chart-tooltip-content.component.ts +2 -9
- package/src/app/lib/components/ui/chart/chart-tooltip.component.ts +2 -7
- package/src/app/lib/components/ui/chart/chart.component.ts +12 -32
- package/src/app/lib/components/ui/chart/index.ts +7 -8
- package/src/app/lib/components/ui/checkbox/checkbox.component.ts +55 -74
- package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +16 -25
- package/src/app/lib/components/ui/collapsible/collapsible-context.ts +0 -8
- package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +6 -16
- package/src/app/lib/components/ui/collapsible/collapsible.component.ts +29 -33
- package/src/app/lib/components/ui/collapsible/index.ts +0 -1
- package/src/app/lib/components/ui/combobox/combobox-content.component.ts +8 -15
- package/src/app/lib/components/ui/combobox/combobox-context.ts +5 -4
- package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +5 -12
- package/src/app/lib/components/ui/combobox/combobox-group.component.ts +3 -7
- package/src/app/lib/components/ui/combobox/combobox-input.component.ts +25 -25
- package/src/app/lib/components/ui/combobox/combobox-item.component.ts +45 -44
- package/src/app/lib/components/ui/combobox/combobox-list.component.ts +14 -12
- package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +24 -14
- package/src/app/lib/components/ui/combobox/combobox-value.component.ts +27 -22
- package/src/app/lib/components/ui/combobox/combobox.component.ts +74 -54
- package/src/app/lib/components/ui/combobox/index.ts +1 -6
- package/src/app/lib/components/ui/command/command-context.ts +1 -5
- package/src/app/lib/components/ui/command/command-dialog.component.ts +12 -14
- package/src/app/lib/components/ui/command/command-empty.component.ts +2 -3
- package/src/app/lib/components/ui/command/command-group.component.ts +32 -25
- package/src/app/lib/components/ui/command/command-input.component.ts +29 -28
- package/src/app/lib/components/ui/command/command-item.component.ts +46 -58
- package/src/app/lib/components/ui/command/command-list.component.ts +5 -4
- package/src/app/lib/components/ui/command/command-separator.component.ts +2 -3
- package/src/app/lib/components/ui/command/command-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/command/command.component.ts +33 -22
- package/src/app/lib/components/ui/command/index.ts +0 -1
- package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +20 -11
- package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +36 -43
- package/src/app/lib/components/ui/context-menu/context-menu-context.ts +1 -1
- package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +12 -13
- package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +2 -5
- package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +9 -2
- package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +14 -14
- package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +2 -3
- package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +9 -2
- package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/context-menu/context-menu.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/index.ts +15 -4
- package/src/app/lib/components/ui/data-table/data-table-content.component.ts +22 -28
- package/src/app/lib/components/ui/data-table/data-table-context.ts +1 -3
- package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +17 -27
- package/src/app/lib/components/ui/data-table/data-table-search.component.ts +6 -14
- package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +3 -7
- package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +11 -20
- package/src/app/lib/components/ui/data-table/data-table.component.ts +41 -49
- package/src/app/lib/components/ui/data-table/index.ts +7 -8
- package/src/app/lib/components/ui/date-picker/date-picker.component.ts +24 -24
- package/src/app/lib/components/ui/dialog/dialog-close.component.ts +4 -8
- package/src/app/lib/components/ui/dialog/dialog-content.component.ts +72 -73
- package/src/app/lib/components/ui/dialog/dialog-context.ts +7 -5
- package/src/app/lib/components/ui/dialog/dialog-description.component.ts +5 -10
- package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +3 -7
- package/src/app/lib/components/ui/dialog/dialog-header.component.ts +3 -7
- package/src/app/lib/components/ui/dialog/dialog-title.component.ts +5 -10
- package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/dialog/dialog.component.ts +29 -34
- package/src/app/lib/components/ui/dialog/index.ts +0 -1
- package/src/app/lib/components/ui/drawer/drawer-close.component.ts +4 -8
- package/src/app/lib/components/ui/drawer/drawer-content.component.ts +39 -35
- package/src/app/lib/components/ui/drawer/drawer-description.component.ts +5 -10
- package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +3 -7
- package/src/app/lib/components/ui/drawer/drawer-header.component.ts +3 -7
- package/src/app/lib/components/ui/drawer/drawer-title.component.ts +5 -10
- package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/drawer/drawer.component.ts +25 -26
- package/src/app/lib/components/ui/drawer/index.ts +0 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +20 -11
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +96 -61
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-context.ts +1 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-group.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-item.component.ts +10 -11
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +2 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +14 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +14 -14
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +2 -3
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +9 -2
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +6 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/index.ts +10 -3
- package/src/app/lib/components/ui/empty/empty-action.component.ts +2 -9
- package/src/app/lib/components/ui/empty/empty-description.component.ts +2 -10
- package/src/app/lib/components/ui/empty/empty-icon.component.ts +3 -8
- package/src/app/lib/components/ui/empty/empty-title.component.ts +2 -9
- package/src/app/lib/components/ui/empty/empty.component.ts +3 -8
- package/src/app/lib/components/ui/empty/index.ts +0 -1
- package/src/app/lib/components/ui/form/form-context.ts +1 -11
- package/src/app/lib/components/ui/form/form-control.component.ts +22 -22
- package/src/app/lib/components/ui/form/form-description.component.ts +4 -10
- package/src/app/lib/components/ui/form/form-field.component.ts +7 -10
- package/src/app/lib/components/ui/form/form-item.component.ts +2 -12
- package/src/app/lib/components/ui/form/form-label.component.ts +15 -15
- package/src/app/lib/components/ui/form/form-message.component.ts +7 -15
- package/src/app/lib/components/ui/form/form.component.ts +9 -20
- package/src/app/lib/components/ui/form/index.ts +4 -5
- package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +21 -33
- package/src/app/lib/components/ui/hover-card/hover-card-context.ts +0 -8
- package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +17 -26
- package/src/app/lib/components/ui/hover-card/hover-card.component.ts +18 -28
- package/src/app/lib/components/ui/hover-card/index.ts +9 -6
- package/src/app/lib/components/ui/input/input.component.ts +57 -75
- package/src/app/lib/components/ui/input-group/index.ts +0 -1
- package/src/app/lib/components/ui/input-group/input-group-addon.component.ts +4 -11
- package/src/app/lib/components/ui/input-group/input-group-input.component.ts +3 -8
- package/src/app/lib/components/ui/input-group/input-group.component.ts +4 -9
- package/src/app/lib/components/ui/input-otp/index.ts +4 -5
- package/src/app/lib/components/ui/input-otp/input-otp-context.ts +0 -8
- package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +2 -3
- package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +4 -3
- package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +8 -10
- package/src/app/lib/components/ui/input-otp/input-otp.component.ts +27 -45
- package/src/app/lib/components/ui/kbd/index.ts +0 -1
- package/src/app/lib/components/ui/kbd/kbd-variants.ts +1 -1
- package/src/app/lib/components/ui/kbd/kbd.component.ts +4 -8
- package/src/app/lib/components/ui/label/label.component.ts +15 -28
- package/src/app/lib/components/ui/menubar/index.ts +11 -8
- package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +21 -12
- package/src/app/lib/components/ui/menubar/menubar-content.component.ts +46 -53
- package/src/app/lib/components/ui/menubar/menubar-context.ts +3 -9
- package/src/app/lib/components/ui/menubar/menubar-item.component.ts +13 -14
- package/src/app/lib/components/ui/menubar/menubar-label.component.ts +2 -5
- package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +14 -2
- package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +9 -2
- package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +13 -13
- package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +2 -3
- package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +7 -6
- package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +8 -1
- package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +26 -21
- package/src/app/lib/components/ui/menubar/menubar.component.ts +6 -13
- package/src/app/lib/components/ui/native-select/index.ts +1 -5
- package/src/app/lib/components/ui/native-select/native-select-variants.ts +1 -1
- package/src/app/lib/components/ui/native-select/native-select.component.ts +14 -15
- package/src/app/lib/components/ui/navigation-menu/index.ts +10 -8
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +18 -13
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-context.ts +2 -10
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +3 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +6 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +3 -8
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +2 -4
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger-style.ts +1 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +3 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +8 -15
- package/src/app/lib/components/ui/pagination/index.ts +0 -1
- package/src/app/lib/components/ui/pagination/pagination-content.component.ts +3 -7
- package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +3 -7
- package/src/app/lib/components/ui/pagination/pagination-item.component.ts +3 -9
- package/src/app/lib/components/ui/pagination/pagination-link.component.ts +4 -8
- package/src/app/lib/components/ui/pagination/pagination-next.component.ts +3 -11
- package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +3 -11
- package/src/app/lib/components/ui/pagination/pagination.component.ts +3 -7
- package/src/app/lib/components/ui/popover/index.ts +9 -6
- package/src/app/lib/components/ui/popover/popover-anchor.component.ts +2 -13
- package/src/app/lib/components/ui/popover/popover-content.component.ts +119 -69
- package/src/app/lib/components/ui/popover/popover-context.ts +0 -8
- package/src/app/lib/components/ui/popover/popover-trigger.component.ts +22 -22
- package/src/app/lib/components/ui/popover/popover.component.ts +20 -33
- package/src/app/lib/components/ui/progress/index.ts +1 -6
- package/src/app/lib/components/ui/progress/progress.component.ts +15 -30
- package/src/app/lib/components/ui/radio-group/index.ts +1 -4
- package/src/app/lib/components/ui/radio-group/radio-group-context.ts +1 -7
- package/src/app/lib/components/ui/radio-group/radio-group-item.component.ts +36 -69
- package/src/app/lib/components/ui/radio-group/radio-group.component.ts +38 -67
- package/src/app/lib/components/ui/resizable/index.ts +0 -1
- package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +25 -39
- package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +15 -18
- package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +12 -31
- package/src/app/lib/components/ui/scroll-area/index.ts +4 -5
- package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +5 -19
- package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +8 -27
- package/src/app/lib/components/ui/segmented/index.ts +5 -9
- package/src/app/lib/components/ui/segmented/segmented-context.ts +1 -3
- package/src/app/lib/components/ui/segmented/segmented-item.component.ts +21 -29
- package/src/app/lib/components/ui/segmented/segmented-variants.ts +2 -2
- package/src/app/lib/components/ui/segmented/segmented.component.ts +24 -32
- package/src/app/lib/components/ui/select/index.ts +5 -6
- package/src/app/lib/components/ui/select/select-content.component.ts +34 -62
- package/src/app/lib/components/ui/select/select-context.ts +4 -14
- package/src/app/lib/components/ui/select/select-group.component.ts +6 -7
- package/src/app/lib/components/ui/select/select-item.component.ts +46 -55
- package/src/app/lib/components/ui/select/select-label.component.ts +2 -7
- package/src/app/lib/components/ui/select/select-separator.component.ts +3 -8
- package/src/app/lib/components/ui/select/select-trigger.component.ts +28 -25
- package/src/app/lib/components/ui/select/select-value.component.ts +7 -13
- package/src/app/lib/components/ui/select/select.component.ts +52 -64
- package/src/app/lib/components/ui/separator/index.ts +1 -6
- package/src/app/lib/components/ui/separator/separator.component.ts +4 -19
- package/src/app/lib/components/ui/sheet/index.ts +0 -1
- package/src/app/lib/components/ui/sheet/sheet-close.component.ts +4 -8
- package/src/app/lib/components/ui/sheet/sheet-content.component.ts +31 -36
- package/src/app/lib/components/ui/sheet/sheet-description.component.ts +5 -10
- package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +3 -7
- package/src/app/lib/components/ui/sheet/sheet-header.component.ts +3 -7
- package/src/app/lib/components/ui/sheet/sheet-title.component.ts +5 -10
- package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/sheet/sheet-variants.ts +1 -1
- package/src/app/lib/components/ui/sheet/sheet.component.ts +36 -36
- package/src/app/lib/components/ui/sidebar/index.ts +14 -15
- package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-context.ts +1 -3
- package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +4 -9
- package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +2 -6
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +46 -52
- package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar-route-active.service.ts +17 -17
- package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar.component.ts +20 -31
- package/src/app/lib/components/ui/skeleton/skeleton.component.ts +3 -8
- package/src/app/lib/components/ui/slider/index.ts +1 -6
- package/src/app/lib/components/ui/slider/slider.component.ts +73 -138
- package/src/app/lib/components/ui/spinner/index.ts +0 -1
- package/src/app/lib/components/ui/spinner/spinner-variants.ts +19 -22
- package/src/app/lib/components/ui/spinner/spinner.component.ts +4 -8
- package/src/app/lib/components/ui/switch/index.ts +1 -6
- package/src/app/lib/components/ui/switch/switch.component.ts +83 -108
- package/src/app/lib/components/ui/table/index.ts +0 -1
- package/src/app/lib/components/ui/table/table-body.component.ts +6 -10
- package/src/app/lib/components/ui/table/table-caption.component.ts +6 -8
- package/src/app/lib/components/ui/table/table-cell.component.ts +4 -8
- package/src/app/lib/components/ui/table/table-footer.component.ts +6 -8
- package/src/app/lib/components/ui/table/table-head.component.ts +4 -8
- package/src/app/lib/components/ui/table/table-header.component.ts +6 -10
- package/src/app/lib/components/ui/table/table-row.component.ts +6 -11
- package/src/app/lib/components/ui/table/table.component.ts +4 -8
- package/src/app/lib/components/ui/tabs/index.ts +14 -7
- package/src/app/lib/components/ui/tabs/tabs-content.component.ts +11 -36
- package/src/app/lib/components/ui/tabs/tabs-context.ts +0 -8
- package/src/app/lib/components/ui/tabs/tabs-list.component.ts +54 -60
- package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +20 -35
- package/src/app/lib/components/ui/tabs/tabs.component.ts +32 -49
- package/src/app/lib/components/ui/textarea/textarea.component.ts +3 -8
- package/src/app/lib/components/ui/toast/index.ts +6 -7
- package/src/app/lib/components/ui/toast/toast-action.component.ts +7 -18
- package/src/app/lib/components/ui/toast/toast-description.component.ts +2 -11
- package/src/app/lib/components/ui/toast/toast-title.component.ts +2 -9
- package/src/app/lib/components/ui/toast/toast-variants.ts +1 -1
- package/src/app/lib/components/ui/toast/toast.component.ts +18 -24
- package/src/app/lib/components/ui/toast/toast.service.ts +22 -37
- package/src/app/lib/components/ui/toast/toaster.component.ts +6 -16
- package/src/app/lib/components/ui/toggle/index.ts +1 -5
- package/src/app/lib/components/ui/toggle/toggle-variants.ts +2 -2
- package/src/app/lib/components/ui/toggle/toggle.component.ts +32 -51
- package/src/app/lib/components/ui/toggle-group/index.ts +1 -4
- package/src/app/lib/components/ui/toggle-group/toggle-group-context.ts +1 -7
- package/src/app/lib/components/ui/toggle-group/toggle-group-item.component.ts +38 -59
- package/src/app/lib/components/ui/toggle-group/toggle-group.component.ts +33 -51
- package/src/app/lib/components/ui/tooltip/index.ts +9 -6
- package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +6 -24
- package/src/app/lib/components/ui/tooltip/tooltip-context.ts +0 -8
- package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +12 -24
- package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +4 -21
- package/src/app/lib/components/ui/tooltip/tooltip.component.ts +21 -33
- package/src/app/lib/components/ui/typography/index.ts +0 -1
- package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-h1.component.ts +3 -10
- package/src/app/lib/components/ui/typography/typography-h2.component.ts +3 -10
- package/src/app/lib/components/ui/typography/typography-h3.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-h4.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +4 -8
- package/src/app/lib/components/ui/typography/typography-large.component.ts +3 -9
- package/src/app/lib/components/ui/typography/typography-lead.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-list.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-muted.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-p.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-small.component.ts +3 -7
- package/src/app/lib/utils/accessibility/click-outside.directive.ts +1 -8
- package/src/app/lib/utils/accessibility/focus-management.service.ts +4 -15
- package/src/app/lib/utils/accessibility/focus-trap.directive.ts +32 -106
- package/src/app/lib/utils/accessibility/index.ts +16 -5
- package/src/app/lib/utils/accessibility/keyboard-navigation.directive.ts +5 -8
- package/src/app/lib/utils/accessibility/live-region.directive.ts +10 -13
- package/src/app/lib/utils/accessibility/touch-target.directive.ts +1 -8
- package/src/app/lib/utils/animation/animation.utils.ts +4 -7
- package/src/app/lib/utils/animation/index.ts +15 -5
- package/src/app/lib/utils/animation/presence.component.ts +1 -1
- package/src/app/lib/utils/animation/presence.directive.ts +2 -2
- package/src/app/lib/utils/positioning/index.ts +40 -18
- package/src/app/lib/components/ui/index.ts +0 -551
- package/src/app/lib/index.ts +0 -7
|
@@ -9,6 +9,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
9
9
|
selector: 'DropdownMenuTrigger',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dropdown-menu-trigger"',
|
|
12
13
|
class: 'cursor-pointer',
|
|
13
14
|
'(click)': 'toggle()',
|
|
14
15
|
'(keydown)': 'onKeyDown($event)',
|
|
@@ -19,19 +20,19 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
19
20
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
21
|
})
|
|
21
22
|
export class DropdownMenuTrigger {
|
|
23
|
+
private readonly _elementRef = inject(ElementRef<HTMLElement>);
|
|
24
|
+
|
|
22
25
|
protected readonly context = inject(DROPDOWN_MENU_CONTEXT);
|
|
23
|
-
private readonly elementRef = inject(ElementRef<HTMLElement>);
|
|
24
26
|
|
|
25
27
|
toggle(): void {
|
|
26
|
-
this.context.triggerElement.set(this.
|
|
27
|
-
this.context.open.update(v => !v);
|
|
28
|
+
this.context.triggerElement.set(this._elementRef.nativeElement);
|
|
29
|
+
this.context.open.update((v) => !v);
|
|
28
30
|
}
|
|
29
|
-
|
|
30
31
|
onKeyDown(event: KeyboardEvent): void {
|
|
31
32
|
switch (event.key) {
|
|
32
33
|
case 'ArrowDown':
|
|
33
34
|
event.preventDefault();
|
|
34
|
-
this.context.triggerElement.set(this.
|
|
35
|
+
this.context.triggerElement.set(this._elementRef.nativeElement);
|
|
35
36
|
this.context.open.set(true);
|
|
36
37
|
this.context.focusedIndex.set(0);
|
|
37
38
|
break;
|
|
@@ -4,13 +4,20 @@ export { DROPDOWN_MENU_CONTEXT, type DropdownMenuContextValue } from './dropdown
|
|
|
4
4
|
export { DropdownMenuGroup } from './dropdown-menu-group.component';
|
|
5
5
|
export { DropdownMenuItem } from './dropdown-menu-item.component';
|
|
6
6
|
export { DropdownMenuLabel } from './dropdown-menu-label.component';
|
|
7
|
-
export {
|
|
7
|
+
export {
|
|
8
|
+
DROPDOWN_MENU_RADIO_GROUP_CONTEXT,
|
|
9
|
+
DropdownMenuRadioGroup,
|
|
10
|
+
type DropdownMenuRadioGroupContext,
|
|
11
|
+
} from './dropdown-menu-radio-group.component';
|
|
8
12
|
export { DropdownMenuRadioItem } from './dropdown-menu-radio-item.component';
|
|
9
13
|
export { DropdownMenuSeparator } from './dropdown-menu-separator.component';
|
|
10
14
|
export { DropdownMenuShortcut } from './dropdown-menu-shortcut.component';
|
|
11
15
|
export { DropdownMenuSubContent } from './dropdown-menu-sub-content.component';
|
|
12
16
|
export { DropdownMenuSubTrigger } from './dropdown-menu-sub-trigger.component';
|
|
13
|
-
export {
|
|
17
|
+
export {
|
|
18
|
+
DROPDOWN_MENU_SUB_CONTEXT,
|
|
19
|
+
DropdownMenuSub,
|
|
20
|
+
type DropdownMenuSubContext,
|
|
21
|
+
} from './dropdown-menu-sub.component';
|
|
14
22
|
export { DropdownMenuTrigger } from './dropdown-menu-trigger.component';
|
|
15
23
|
export { DropdownMenu } from './dropdown-menu.component';
|
|
16
|
-
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* EmptyAction component - container for action buttons in empty state.
|
|
@@ -22,7 +17,5 @@ export class EmptyAction {
|
|
|
22
17
|
readonly class = input<string>('');
|
|
23
18
|
|
|
24
19
|
/** Computed class combining base styles and custom classes */
|
|
25
|
-
protected readonly computedClass = computed(() =>
|
|
26
|
-
cn('mt-2', this.class())
|
|
27
|
-
);
|
|
20
|
+
protected readonly computedClass = computed(() => cn('mt-2', this.class()));
|
|
28
21
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* EmptyDescription component - description for the empty state.
|
|
@@ -23,9 +18,6 @@ export class EmptyDescription {
|
|
|
23
18
|
|
|
24
19
|
/** Computed class combining base styles and custom classes */
|
|
25
20
|
protected readonly computedClass = computed(() =>
|
|
26
|
-
cn(
|
|
27
|
-
'mb-4 mt-2 text-sm text-muted-foreground max-w-sm mx-auto',
|
|
28
|
-
this.class()
|
|
29
|
-
)
|
|
21
|
+
cn('mb-4 mt-2 text-sm text-muted-foreground max-w-sm mx-auto', this.class()),
|
|
30
22
|
);
|
|
31
23
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* EmptyIcon component - container for the empty state icon.
|
|
@@ -25,7 +20,7 @@ export class EmptyIcon {
|
|
|
25
20
|
protected readonly computedClass = computed(() =>
|
|
26
21
|
cn(
|
|
27
22
|
'mx-auto flex size-12 items-center justify-center rounded-full bg-muted text-muted-foreground [&>svg]:size-6',
|
|
28
|
-
this.class()
|
|
29
|
-
)
|
|
23
|
+
this.class(),
|
|
24
|
+
),
|
|
30
25
|
);
|
|
31
26
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* EmptyTitle component - title for the empty state.
|
|
@@ -22,7 +17,5 @@ export class EmptyTitle {
|
|
|
22
17
|
readonly class = input<string>('');
|
|
23
18
|
|
|
24
19
|
/** Computed class combining base styles and custom classes */
|
|
25
|
-
protected readonly computedClass = computed(() =>
|
|
26
|
-
cn('mt-4 text-lg font-semibold', this.class())
|
|
27
|
-
);
|
|
20
|
+
protected readonly computedClass = computed(() => cn('mt-4 text-lg font-semibold', this.class()));
|
|
28
21
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* Empty component - empty state placeholder for when there's no content.
|
|
@@ -47,7 +42,7 @@ export class Empty {
|
|
|
47
42
|
protected readonly computedClass = computed(() =>
|
|
48
43
|
cn(
|
|
49
44
|
'flex min-h-[400px] flex-col items-center justify-center rounded-md border border-dashed p-8 text-center animate-in fade-in-50',
|
|
50
|
-
this.class()
|
|
51
|
-
)
|
|
45
|
+
this.class(),
|
|
46
|
+
),
|
|
52
47
|
);
|
|
53
48
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { InjectionToken, WritableSignal } from '@angular/core';
|
|
2
2
|
import { AbstractControl, FormGroup } from '@angular/forms';
|
|
3
3
|
|
|
4
|
-
// ============================================================================
|
|
5
|
-
// Types
|
|
6
|
-
// ============================================================================
|
|
7
|
-
|
|
8
4
|
export interface FormFieldContext {
|
|
9
5
|
/** The name of the form field */
|
|
10
6
|
name: WritableSignal<string>;
|
|
@@ -23,12 +19,6 @@ export interface FormContext {
|
|
|
23
19
|
form: WritableSignal<FormGroup | null>;
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
// Injection Tokens
|
|
28
|
-
// ============================================================================
|
|
29
|
-
|
|
30
|
-
export const FORM_FIELD_CONTEXT = new InjectionToken<FormFieldContext>(
|
|
31
|
-
'FormFieldContext'
|
|
32
|
-
);
|
|
22
|
+
export const FORM_FIELD_CONTEXT = new InjectionToken<FormFieldContext>('FormFieldContext');
|
|
33
23
|
|
|
34
24
|
export const FORM_CONTEXT = new InjectionToken<FormContext>('FormContext');
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
AfterContentInit,
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
Component,
|
|
6
|
+
computed,
|
|
7
|
+
contentChild,
|
|
8
|
+
DestroyRef,
|
|
9
|
+
Directive,
|
|
10
|
+
ElementRef,
|
|
11
|
+
inject,
|
|
12
|
+
input,
|
|
13
13
|
} from '@angular/core';
|
|
14
14
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
15
15
|
import { FORM_FIELD_CONTEXT } from './form-context';
|
|
@@ -44,14 +44,14 @@ export class FormControlInput {
|
|
|
44
44
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
45
45
|
})
|
|
46
46
|
export class FormControl implements AfterContentInit {
|
|
47
|
-
|
|
48
|
-
private readonly destroyRef = inject(DestroyRef);
|
|
49
|
-
|
|
50
|
-
@ContentChild(FormControlInput, { static: false }) inputDirective?: FormControlInput;
|
|
47
|
+
readonly inputDirective = contentChild(FormControlInput);
|
|
51
48
|
|
|
52
49
|
/** Additional CSS classes to apply */
|
|
53
50
|
readonly class = input<string>('');
|
|
54
51
|
|
|
52
|
+
private readonly _destroyRef = inject(DestroyRef);
|
|
53
|
+
protected readonly fieldContext = inject(FORM_FIELD_CONTEXT, { optional: true });
|
|
54
|
+
|
|
55
55
|
/** Check if field has error */
|
|
56
56
|
protected readonly hasError = computed(() => {
|
|
57
57
|
const control = this.fieldContext?.control();
|
|
@@ -74,18 +74,17 @@ export class FormControl implements AfterContentInit {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
/** Computed class combining base styles and custom classes */
|
|
77
|
-
protected readonly computedClass = computed(() =>
|
|
78
|
-
cn('relative', this.class())
|
|
79
|
-
);
|
|
77
|
+
protected readonly computedClass = computed(() => cn('relative', this.class()));
|
|
80
78
|
|
|
81
79
|
ngAfterContentInit(): void {
|
|
82
80
|
this.applyAccessibilityAttributes();
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
private applyAccessibilityAttributes(): void {
|
|
86
|
-
|
|
84
|
+
const inputDirective = this.inputDirective();
|
|
85
|
+
if (!inputDirective || !this.fieldContext) return;
|
|
87
86
|
|
|
88
|
-
const element =
|
|
87
|
+
const element = inputDirective.elementRef.nativeElement;
|
|
89
88
|
|
|
90
89
|
// Set the id to match the label's 'for' attribute
|
|
91
90
|
const id = this.fieldContext.id();
|
|
@@ -107,15 +106,16 @@ export class FormControl implements AfterContentInit {
|
|
|
107
106
|
// Update attributes when control state changes
|
|
108
107
|
const control = this.fieldContext.control();
|
|
109
108
|
if (control?.statusChanges) {
|
|
110
|
-
control.statusChanges.pipe(takeUntilDestroyed(this.
|
|
109
|
+
control.statusChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
|
|
111
110
|
this.updateAriaInvalid();
|
|
112
111
|
});
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
private updateAriaInvalid(): void {
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const inputDirective = this.inputDirective();
|
|
117
|
+
if (!inputDirective) return;
|
|
118
|
+
const element = inputDirective.elementRef.nativeElement;
|
|
119
119
|
|
|
120
120
|
if (this.hasError()) {
|
|
121
121
|
element.setAttribute('aria-invalid', 'true');
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
9
3
|
import { FORM_FIELD_CONTEXT } from './form-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -25,13 +19,13 @@ import { FORM_FIELD_CONTEXT } from './form-context';
|
|
|
25
19
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
20
|
})
|
|
27
21
|
export class FormDescription {
|
|
28
|
-
protected readonly fieldContext = inject(FORM_FIELD_CONTEXT, { optional: true });
|
|
29
|
-
|
|
30
22
|
/** Additional CSS classes to apply */
|
|
31
23
|
readonly class = input<string>('');
|
|
32
24
|
|
|
25
|
+
protected readonly fieldContext = inject(FORM_FIELD_CONTEXT, { optional: true });
|
|
26
|
+
|
|
33
27
|
/** Computed class combining base styles and custom classes */
|
|
34
28
|
protected readonly computedClass = computed(() =>
|
|
35
|
-
cn('text-muted-foreground text-[0.8rem]', this.class())
|
|
29
|
+
cn('text-muted-foreground text-[0.8rem]', this.class()),
|
|
36
30
|
);
|
|
37
31
|
}
|
|
@@ -41,14 +41,17 @@ import { FORM_CONTEXT, FORM_FIELD_CONTEXT, type FormFieldContext } from './form-
|
|
|
41
41
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
42
42
|
})
|
|
43
43
|
export class FormField {
|
|
44
|
-
private readonly formContext = inject(FORM_CONTEXT, { optional: true });
|
|
45
|
-
|
|
46
44
|
/** The name of the form control */
|
|
47
45
|
readonly name = input.required<string>();
|
|
48
46
|
|
|
49
47
|
/** Additional CSS classes to apply */
|
|
50
48
|
readonly class = input<string>('');
|
|
51
49
|
|
|
50
|
+
private readonly _formContext = inject(FORM_CONTEXT, { optional: true });
|
|
51
|
+
|
|
52
|
+
/** Computed class combining base styles and custom classes */
|
|
53
|
+
protected readonly computedClass = computed(() => cn('space-y-2', this.class()));
|
|
54
|
+
|
|
52
55
|
/** Generate unique IDs */
|
|
53
56
|
private readonly uniqueId = `form-field-${Math.random().toString(36).substring(7)}`;
|
|
54
57
|
|
|
@@ -61,22 +64,16 @@ export class FormField {
|
|
|
61
64
|
formMessageId: signal(`${this.uniqueId}-message`),
|
|
62
65
|
};
|
|
63
66
|
|
|
64
|
-
/** Computed class combining base styles and custom classes */
|
|
65
|
-
protected readonly computedClass = computed(() =>
|
|
66
|
-
cn('space-y-2', this.class())
|
|
67
|
-
);
|
|
68
|
-
|
|
69
67
|
ngOnInit() {
|
|
70
68
|
this.fieldContext.name.set(this.name());
|
|
71
|
-
const form = this.
|
|
69
|
+
const form = this._formContext?.form();
|
|
72
70
|
if (form) {
|
|
73
71
|
this.fieldContext.control.set(form.get(this.name()));
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
|
-
|
|
77
74
|
ngOnChanges() {
|
|
78
75
|
this.fieldContext.name.set(this.name());
|
|
79
|
-
const form = this.
|
|
76
|
+
const form = this._formContext?.form();
|
|
80
77
|
if (form) {
|
|
81
78
|
this.fieldContext.control.set(form.get(this.name()));
|
|
82
79
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* FormItem component - container for form field elements.
|
|
@@ -33,10 +28,5 @@ export class FormItem {
|
|
|
33
28
|
readonly class = input<string>('');
|
|
34
29
|
|
|
35
30
|
/** Computed class combining base styles and custom classes */
|
|
36
|
-
protected readonly computedClass = computed(() =>
|
|
37
|
-
cn(
|
|
38
|
-
'flex flex-col gap-2',
|
|
39
|
-
this.class()
|
|
40
|
-
)
|
|
41
|
-
);
|
|
31
|
+
protected readonly computedClass = computed(() => cn('flex flex-col gap-2', this.class()));
|
|
42
32
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
ElementRef,
|
|
7
|
+
inject,
|
|
8
|
+
input,
|
|
9
|
+
viewChild,
|
|
10
10
|
} from '@angular/core';
|
|
11
11
|
import { FORM_FIELD_CONTEXT } from './form-context';
|
|
12
12
|
|
|
@@ -19,40 +19,40 @@ import { FORM_FIELD_CONTEXT } from './form-context';
|
|
|
19
19
|
*/
|
|
20
20
|
@Component({
|
|
21
21
|
selector: 'FormLabel',
|
|
22
|
-
template: `<label #labelElement [attr.for]="fieldContext?.id()" [class]="computedClass()"
|
|
22
|
+
template: `<label #labelElement [attr.for]="fieldContext?.id()" [class]="computedClass()"
|
|
23
|
+
><ng-content
|
|
24
|
+
/></label>`,
|
|
23
25
|
host: {
|
|
24
26
|
'[attr.data-error]': 'hasError() ? "" : null',
|
|
25
27
|
'[attr.data-disabled]': 'isDisabled() ? "" : null',
|
|
26
28
|
'data-slot': 'form-label',
|
|
27
|
-
|
|
29
|
+
class: 'contents',
|
|
28
30
|
},
|
|
29
31
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30
32
|
})
|
|
31
33
|
export class FormLabel {
|
|
32
|
-
protected readonly fieldContext = inject(FORM_FIELD_CONTEXT, { optional: true });
|
|
33
|
-
|
|
34
34
|
private readonly labelElement = viewChild<ElementRef<HTMLLabelElement>>('labelElement');
|
|
35
35
|
|
|
36
36
|
/** Additional CSS classes to apply */
|
|
37
37
|
readonly class = input<string>('');
|
|
38
38
|
|
|
39
|
+
protected readonly fieldContext = inject(FORM_FIELD_CONTEXT, { optional: true });
|
|
40
|
+
|
|
39
41
|
/** Check if field has error */
|
|
40
42
|
protected readonly hasError = computed(() => {
|
|
41
43
|
const control = this.fieldContext?.control();
|
|
42
44
|
return control?.invalid && (control?.dirty || control?.touched);
|
|
43
45
|
});
|
|
44
|
-
|
|
45
46
|
/** Check if field is disabled */
|
|
46
47
|
protected readonly isDisabled = computed(() => {
|
|
47
48
|
return this.fieldContext?.control()?.disabled;
|
|
48
49
|
});
|
|
49
|
-
|
|
50
50
|
/** Computed class combining base styles and custom classes */
|
|
51
51
|
protected readonly computedClass = computed(() =>
|
|
52
52
|
cn(
|
|
53
53
|
'flex items-center gap-2 text-sm font-medium leading-none select-none cursor-pointer group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
|
54
54
|
this.hasError() && 'text-destructive',
|
|
55
|
-
this.class()
|
|
56
|
-
)
|
|
55
|
+
this.class(),
|
|
56
|
+
),
|
|
57
57
|
);
|
|
58
58
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
9
3
|
import { FORM_FIELD_CONTEXT } from './form-context';
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -36,20 +30,16 @@ import { FORM_FIELD_CONTEXT } from './form-context';
|
|
|
36
30
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
37
31
|
})
|
|
38
32
|
export class FormMessage {
|
|
39
|
-
protected readonly fieldContext = inject(FORM_FIELD_CONTEXT, { optional: true });
|
|
40
|
-
|
|
41
33
|
/** Additional CSS classes to apply */
|
|
42
34
|
readonly class = input<string>('');
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
hasContent = false;
|
|
36
|
+
protected readonly fieldContext = inject(FORM_FIELD_CONTEXT, { optional: true });
|
|
46
37
|
|
|
47
38
|
/** Check if field has error */
|
|
48
39
|
protected readonly hasError = computed(() => {
|
|
49
40
|
const control = this.fieldContext?.control();
|
|
50
41
|
return control?.invalid && (control?.dirty || control?.touched);
|
|
51
42
|
});
|
|
52
|
-
|
|
53
43
|
/** Get first error message */
|
|
54
44
|
protected readonly errorMessage = computed(() => {
|
|
55
45
|
const control = this.fieldContext?.control();
|
|
@@ -90,16 +80,18 @@ export class FormMessage {
|
|
|
90
80
|
return 'Invalid value';
|
|
91
81
|
}
|
|
92
82
|
});
|
|
93
|
-
|
|
94
83
|
/** Computed class combining base styles and custom classes */
|
|
95
84
|
protected readonly computedClass = computed(() =>
|
|
96
85
|
cn(
|
|
97
86
|
'text-destructive text-[0.8rem] font-medium',
|
|
98
87
|
!this.hasError() && !this.hasContent && 'hidden',
|
|
99
|
-
this.class()
|
|
100
|
-
)
|
|
88
|
+
this.class(),
|
|
89
|
+
),
|
|
101
90
|
);
|
|
102
91
|
|
|
92
|
+
/** Whether component has projected content */
|
|
93
|
+
hasContent = false;
|
|
94
|
+
|
|
103
95
|
ngAfterContentInit() {
|
|
104
96
|
// Check if there's projected content
|
|
105
97
|
// This is a simplified check - in production you might want to use ContentChild
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
forwardRef,
|
|
7
|
+
input,
|
|
8
|
+
signal,
|
|
9
9
|
} from '@angular/core';
|
|
10
10
|
import { FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
11
11
|
import { FORM_CONTEXT, type FormContext } from './form-context';
|
|
12
12
|
|
|
13
|
-
// ============================================================================
|
|
14
|
-
// Types
|
|
15
|
-
// ============================================================================
|
|
16
|
-
|
|
17
13
|
/**
|
|
18
14
|
* Props for the Form component
|
|
19
15
|
*/
|
|
@@ -24,10 +20,6 @@ export interface FormProps {
|
|
|
24
20
|
class?: string;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
// ============================================================================
|
|
28
|
-
// Component
|
|
29
|
-
// ============================================================================
|
|
30
|
-
|
|
31
23
|
/**
|
|
32
24
|
* @component Form
|
|
33
25
|
*
|
|
@@ -103,20 +95,17 @@ export interface FormProps {
|
|
|
103
95
|
export class Form {
|
|
104
96
|
/** The reactive form group */
|
|
105
97
|
readonly formGroup = input<FormGroup | null>(null);
|
|
106
|
-
|
|
107
98
|
/** Additional CSS classes */
|
|
108
99
|
readonly class = input<string>('');
|
|
109
100
|
|
|
101
|
+
/** Computed class combining base styles and custom classes */
|
|
102
|
+
protected readonly computedClass = computed(() => cn('space-y-6', this.class()));
|
|
103
|
+
|
|
110
104
|
/** Context for child components */
|
|
111
105
|
readonly context: FormContext = {
|
|
112
106
|
form: signal(this.formGroup()),
|
|
113
107
|
};
|
|
114
108
|
|
|
115
|
-
/** Computed class combining base styles and custom classes */
|
|
116
|
-
protected readonly computedClass = computed(() =>
|
|
117
|
-
cn('space-y-6', this.class())
|
|
118
|
-
);
|
|
119
|
-
|
|
120
109
|
ngOnChanges() {
|
|
121
110
|
this.context.form.set(this.formGroup());
|
|
122
111
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Context and types
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
FORM_CONTEXT,
|
|
4
|
+
FORM_FIELD_CONTEXT,
|
|
5
|
+
type FormContext,
|
|
6
|
+
type FormFieldContext,
|
|
7
7
|
} from './form-context';
|
|
8
8
|
|
|
9
9
|
// Components and their types
|
|
@@ -14,4 +14,3 @@ export { FormItem } from './form-item.component';
|
|
|
14
14
|
export { FormLabel } from './form-label.component';
|
|
15
15
|
export { FormMessage } from './form-message.component';
|
|
16
16
|
export { Form, type FormProps } from './form.component';
|
|
17
|
-
|