@ng-cn/core 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +34 -33
- package/schematics/component/index.js +454 -95
- package/schematics/component/index.ts +459 -98
- package/schematics/ng-add/index.js +539 -55
- package/schematics/ng-add/index.ts +555 -62
- package/schematics/ng-add/schema.json +8 -2
- package/schematics/test-schematic.js +1 -2
- package/src/app/lib/components/ui/.gitkeep +0 -0
- package/src/app/lib/components/ui/accordion/accordion-content.component.ts +16 -24
- package/src/app/lib/components/ui/accordion/accordion-context.ts +4 -9
- package/src/app/lib/components/ui/accordion/accordion-item.component.ts +33 -29
- package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +11 -14
- package/src/app/lib/components/ui/accordion/accordion.component.ts +60 -49
- package/src/app/lib/components/ui/accordion/index.ts +5 -6
- package/src/app/lib/components/ui/alert/alert-description.component.ts +3 -8
- package/src/app/lib/components/ui/alert/alert-title.component.ts +2 -7
- package/src/app/lib/components/ui/alert/alert-variants.ts +19 -5
- package/src/app/lib/components/ui/alert/alert.component.ts +2 -10
- package/src/app/lib/components/ui/alert/index.ts +0 -1
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +5 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +5 -11
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +63 -66
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-context.ts +10 -5
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +5 -10
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +3 -7
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +3 -7
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +5 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +8 -12
- package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +28 -34
- package/src/app/lib/components/ui/alert-dialog/index.ts +0 -1
- package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +3 -9
- package/src/app/lib/components/ui/avatar/avatar-context.ts +9 -0
- package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +7 -18
- package/src/app/lib/components/ui/avatar/avatar-image.component.ts +39 -17
- package/src/app/lib/components/ui/avatar/avatar.component.ts +17 -20
- package/src/app/lib/components/ui/avatar/index.ts +1 -1
- package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +9 -30
- package/src/app/lib/components/ui/badge/badge-variants.ts +5 -5
- package/src/app/lib/components/ui/badge/badge.component.ts +4 -8
- package/src/app/lib/components/ui/badge/index.ts +0 -1
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +5 -14
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +6 -18
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +6 -15
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +22 -31
- package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +3 -9
- package/src/app/lib/components/ui/breadcrumb/index.ts +0 -1
- package/src/app/lib/components/ui/button/button-variants.ts +6 -8
- package/src/app/lib/components/ui/button/button.component.ts +4 -8
- package/src/app/lib/components/ui/button/index.ts +0 -1
- package/src/app/lib/components/ui/button-group/button-group-variants.ts +12 -15
- package/src/app/lib/components/ui/button-group/button-group.component.ts +6 -14
- package/src/app/lib/components/ui/button-group/index.ts +1 -5
- package/src/app/lib/components/ui/calendar/calendar.component.ts +103 -115
- package/src/app/lib/components/ui/card/card-action.component.ts +2 -10
- package/src/app/lib/components/ui/card/card-content.component.ts +1 -6
- package/src/app/lib/components/ui/card/card-description.component.ts +2 -7
- package/src/app/lib/components/ui/card/card-footer.component.ts +2 -7
- package/src/app/lib/components/ui/card/card-header.component.ts +3 -8
- package/src/app/lib/components/ui/card/card-title.component.ts +2 -9
- package/src/app/lib/components/ui/card/card.component.ts +3 -8
- package/src/app/lib/components/ui/card/index.ts +0 -1
- package/src/app/lib/components/ui/carousel/carousel-content.component.ts +3 -9
- package/src/app/lib/components/ui/carousel/carousel-item.component.ts +5 -5
- package/src/app/lib/components/ui/carousel/carousel-next.component.ts +9 -8
- package/src/app/lib/components/ui/carousel/carousel-previous.component.ts +9 -8
- package/src/app/lib/components/ui/carousel/carousel.component.ts +14 -25
- package/src/app/lib/components/ui/carousel/index.ts +5 -2
- package/src/app/lib/components/ui/chart/chart-container.component.ts +20 -26
- package/src/app/lib/components/ui/chart/chart-legend-content.component.ts +6 -16
- package/src/app/lib/components/ui/chart/chart-legend.component.ts +2 -7
- package/src/app/lib/components/ui/chart/chart-tooltip-content.component.ts +2 -9
- package/src/app/lib/components/ui/chart/chart-tooltip.component.ts +2 -7
- package/src/app/lib/components/ui/chart/chart.component.ts +12 -32
- package/src/app/lib/components/ui/chart/index.ts +7 -8
- package/src/app/lib/components/ui/checkbox/checkbox.component.ts +55 -74
- package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +16 -25
- package/src/app/lib/components/ui/collapsible/collapsible-context.ts +0 -8
- package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +6 -16
- package/src/app/lib/components/ui/collapsible/collapsible.component.ts +29 -33
- package/src/app/lib/components/ui/collapsible/index.ts +0 -1
- package/src/app/lib/components/ui/combobox/combobox-content.component.ts +8 -15
- package/src/app/lib/components/ui/combobox/combobox-context.ts +5 -4
- package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +5 -12
- package/src/app/lib/components/ui/combobox/combobox-group.component.ts +3 -7
- package/src/app/lib/components/ui/combobox/combobox-input.component.ts +25 -25
- package/src/app/lib/components/ui/combobox/combobox-item.component.ts +45 -44
- package/src/app/lib/components/ui/combobox/combobox-list.component.ts +14 -12
- package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +24 -14
- package/src/app/lib/components/ui/combobox/combobox-value.component.ts +27 -22
- package/src/app/lib/components/ui/combobox/combobox.component.ts +74 -54
- package/src/app/lib/components/ui/combobox/index.ts +1 -6
- package/src/app/lib/components/ui/command/command-context.ts +1 -5
- package/src/app/lib/components/ui/command/command-dialog.component.ts +12 -14
- package/src/app/lib/components/ui/command/command-empty.component.ts +2 -3
- package/src/app/lib/components/ui/command/command-group.component.ts +32 -25
- package/src/app/lib/components/ui/command/command-input.component.ts +29 -28
- package/src/app/lib/components/ui/command/command-item.component.ts +46 -58
- package/src/app/lib/components/ui/command/command-list.component.ts +5 -4
- package/src/app/lib/components/ui/command/command-separator.component.ts +2 -3
- package/src/app/lib/components/ui/command/command-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/command/command.component.ts +33 -22
- package/src/app/lib/components/ui/command/index.ts +0 -1
- package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +20 -11
- package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +36 -43
- package/src/app/lib/components/ui/context-menu/context-menu-context.ts +1 -1
- package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +12 -13
- package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +2 -5
- package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +9 -2
- package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +14 -14
- package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +2 -3
- package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +9 -2
- package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/context-menu/context-menu.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/index.ts +15 -4
- package/src/app/lib/components/ui/data-table/data-table-content.component.ts +22 -28
- package/src/app/lib/components/ui/data-table/data-table-context.ts +1 -3
- package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +17 -27
- package/src/app/lib/components/ui/data-table/data-table-search.component.ts +6 -14
- package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +3 -7
- package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +11 -20
- package/src/app/lib/components/ui/data-table/data-table.component.ts +41 -49
- package/src/app/lib/components/ui/data-table/index.ts +7 -8
- package/src/app/lib/components/ui/date-picker/date-picker.component.ts +24 -24
- package/src/app/lib/components/ui/dialog/dialog-close.component.ts +4 -8
- package/src/app/lib/components/ui/dialog/dialog-content.component.ts +72 -73
- package/src/app/lib/components/ui/dialog/dialog-context.ts +7 -5
- package/src/app/lib/components/ui/dialog/dialog-description.component.ts +5 -10
- package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +3 -7
- package/src/app/lib/components/ui/dialog/dialog-header.component.ts +3 -7
- package/src/app/lib/components/ui/dialog/dialog-title.component.ts +5 -10
- package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/dialog/dialog.component.ts +29 -34
- package/src/app/lib/components/ui/dialog/index.ts +0 -1
- package/src/app/lib/components/ui/drawer/drawer-close.component.ts +4 -8
- package/src/app/lib/components/ui/drawer/drawer-content.component.ts +39 -35
- package/src/app/lib/components/ui/drawer/drawer-description.component.ts +5 -10
- package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +3 -7
- package/src/app/lib/components/ui/drawer/drawer-header.component.ts +3 -7
- package/src/app/lib/components/ui/drawer/drawer-title.component.ts +5 -10
- package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/drawer/drawer.component.ts +25 -26
- package/src/app/lib/components/ui/drawer/index.ts +0 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +20 -11
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +96 -61
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-context.ts +1 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-group.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-item.component.ts +10 -11
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +2 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +14 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +14 -14
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +2 -3
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +9 -2
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +6 -5
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/index.ts +10 -3
- package/src/app/lib/components/ui/empty/empty-action.component.ts +2 -9
- package/src/app/lib/components/ui/empty/empty-description.component.ts +2 -10
- package/src/app/lib/components/ui/empty/empty-icon.component.ts +3 -8
- package/src/app/lib/components/ui/empty/empty-title.component.ts +2 -9
- package/src/app/lib/components/ui/empty/empty.component.ts +3 -8
- package/src/app/lib/components/ui/empty/index.ts +0 -1
- package/src/app/lib/components/ui/form/form-context.ts +1 -11
- package/src/app/lib/components/ui/form/form-control.component.ts +22 -22
- package/src/app/lib/components/ui/form/form-description.component.ts +4 -10
- package/src/app/lib/components/ui/form/form-field.component.ts +7 -10
- package/src/app/lib/components/ui/form/form-item.component.ts +2 -12
- package/src/app/lib/components/ui/form/form-label.component.ts +15 -15
- package/src/app/lib/components/ui/form/form-message.component.ts +7 -15
- package/src/app/lib/components/ui/form/form.component.ts +9 -20
- package/src/app/lib/components/ui/form/index.ts +4 -5
- package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +21 -33
- package/src/app/lib/components/ui/hover-card/hover-card-context.ts +0 -8
- package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +17 -26
- package/src/app/lib/components/ui/hover-card/hover-card.component.ts +18 -28
- package/src/app/lib/components/ui/hover-card/index.ts +9 -6
- package/src/app/lib/components/ui/input/input.component.ts +57 -75
- package/src/app/lib/components/ui/input-group/index.ts +0 -1
- package/src/app/lib/components/ui/input-group/input-group-addon.component.ts +4 -11
- package/src/app/lib/components/ui/input-group/input-group-input.component.ts +3 -8
- package/src/app/lib/components/ui/input-group/input-group.component.ts +4 -9
- package/src/app/lib/components/ui/input-otp/index.ts +4 -5
- package/src/app/lib/components/ui/input-otp/input-otp-context.ts +0 -8
- package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +2 -3
- package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +4 -3
- package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +8 -10
- package/src/app/lib/components/ui/input-otp/input-otp.component.ts +27 -45
- package/src/app/lib/components/ui/kbd/index.ts +0 -1
- package/src/app/lib/components/ui/kbd/kbd-variants.ts +1 -1
- package/src/app/lib/components/ui/kbd/kbd.component.ts +4 -8
- package/src/app/lib/components/ui/label/label.component.ts +15 -28
- package/src/app/lib/components/ui/menubar/index.ts +11 -8
- package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +21 -12
- package/src/app/lib/components/ui/menubar/menubar-content.component.ts +46 -53
- package/src/app/lib/components/ui/menubar/menubar-context.ts +3 -9
- package/src/app/lib/components/ui/menubar/menubar-item.component.ts +13 -14
- package/src/app/lib/components/ui/menubar/menubar-label.component.ts +2 -5
- package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +14 -2
- package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +9 -2
- package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +13 -13
- package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +2 -3
- package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +2 -1
- package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +5 -5
- package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +7 -6
- package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +8 -1
- package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +26 -21
- package/src/app/lib/components/ui/menubar/menubar.component.ts +6 -13
- package/src/app/lib/components/ui/native-select/index.ts +1 -5
- package/src/app/lib/components/ui/native-select/native-select-variants.ts +1 -1
- package/src/app/lib/components/ui/native-select/native-select.component.ts +14 -15
- package/src/app/lib/components/ui/navigation-menu/index.ts +10 -8
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +18 -13
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-context.ts +2 -10
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +3 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +6 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +3 -8
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +2 -4
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger-style.ts +1 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +8 -7
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +3 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +8 -15
- package/src/app/lib/components/ui/pagination/index.ts +0 -1
- package/src/app/lib/components/ui/pagination/pagination-content.component.ts +3 -7
- package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +3 -7
- package/src/app/lib/components/ui/pagination/pagination-item.component.ts +3 -9
- package/src/app/lib/components/ui/pagination/pagination-link.component.ts +4 -8
- package/src/app/lib/components/ui/pagination/pagination-next.component.ts +3 -11
- package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +3 -11
- package/src/app/lib/components/ui/pagination/pagination.component.ts +3 -7
- package/src/app/lib/components/ui/popover/index.ts +9 -6
- package/src/app/lib/components/ui/popover/popover-anchor.component.ts +2 -13
- package/src/app/lib/components/ui/popover/popover-content.component.ts +119 -69
- package/src/app/lib/components/ui/popover/popover-context.ts +0 -8
- package/src/app/lib/components/ui/popover/popover-trigger.component.ts +22 -22
- package/src/app/lib/components/ui/popover/popover.component.ts +20 -33
- package/src/app/lib/components/ui/progress/index.ts +1 -6
- package/src/app/lib/components/ui/progress/progress.component.ts +15 -30
- package/src/app/lib/components/ui/radio-group/index.ts +1 -4
- package/src/app/lib/components/ui/radio-group/radio-group-context.ts +1 -7
- package/src/app/lib/components/ui/radio-group/radio-group-item.component.ts +36 -69
- package/src/app/lib/components/ui/radio-group/radio-group.component.ts +38 -67
- package/src/app/lib/components/ui/resizable/index.ts +0 -1
- package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +25 -39
- package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +15 -18
- package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +12 -31
- package/src/app/lib/components/ui/scroll-area/index.ts +4 -5
- package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +5 -19
- package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +8 -27
- package/src/app/lib/components/ui/segmented/index.ts +5 -9
- package/src/app/lib/components/ui/segmented/segmented-context.ts +1 -3
- package/src/app/lib/components/ui/segmented/segmented-item.component.ts +21 -29
- package/src/app/lib/components/ui/segmented/segmented-variants.ts +2 -2
- package/src/app/lib/components/ui/segmented/segmented.component.ts +24 -32
- package/src/app/lib/components/ui/select/index.ts +5 -6
- package/src/app/lib/components/ui/select/select-content.component.ts +34 -62
- package/src/app/lib/components/ui/select/select-context.ts +4 -14
- package/src/app/lib/components/ui/select/select-group.component.ts +6 -7
- package/src/app/lib/components/ui/select/select-item.component.ts +46 -55
- package/src/app/lib/components/ui/select/select-label.component.ts +2 -7
- package/src/app/lib/components/ui/select/select-separator.component.ts +3 -8
- package/src/app/lib/components/ui/select/select-trigger.component.ts +28 -25
- package/src/app/lib/components/ui/select/select-value.component.ts +7 -13
- package/src/app/lib/components/ui/select/select.component.ts +52 -64
- package/src/app/lib/components/ui/separator/index.ts +1 -6
- package/src/app/lib/components/ui/separator/separator.component.ts +4 -19
- package/src/app/lib/components/ui/sheet/index.ts +0 -1
- package/src/app/lib/components/ui/sheet/sheet-close.component.ts +4 -8
- package/src/app/lib/components/ui/sheet/sheet-content.component.ts +31 -36
- package/src/app/lib/components/ui/sheet/sheet-description.component.ts +5 -10
- package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +3 -7
- package/src/app/lib/components/ui/sheet/sheet-header.component.ts +3 -7
- package/src/app/lib/components/ui/sheet/sheet-title.component.ts +5 -10
- package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +7 -11
- package/src/app/lib/components/ui/sheet/sheet-variants.ts +1 -1
- package/src/app/lib/components/ui/sheet/sheet.component.ts +36 -36
- package/src/app/lib/components/ui/sidebar/index.ts +14 -15
- package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-context.ts +1 -3
- package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +4 -9
- package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +3 -9
- package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +2 -6
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +4 -8
- package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +46 -52
- package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar-route-active.service.ts +17 -17
- package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +3 -7
- package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +6 -11
- package/src/app/lib/components/ui/sidebar/sidebar.component.ts +20 -31
- package/src/app/lib/components/ui/skeleton/skeleton.component.ts +3 -8
- package/src/app/lib/components/ui/slider/index.ts +1 -6
- package/src/app/lib/components/ui/slider/slider.component.ts +73 -138
- package/src/app/lib/components/ui/spinner/index.ts +0 -1
- package/src/app/lib/components/ui/spinner/spinner-variants.ts +19 -22
- package/src/app/lib/components/ui/spinner/spinner.component.ts +4 -8
- package/src/app/lib/components/ui/switch/index.ts +1 -6
- package/src/app/lib/components/ui/switch/switch.component.ts +83 -108
- package/src/app/lib/components/ui/table/index.ts +0 -1
- package/src/app/lib/components/ui/table/table-body.component.ts +6 -10
- package/src/app/lib/components/ui/table/table-caption.component.ts +6 -8
- package/src/app/lib/components/ui/table/table-cell.component.ts +4 -8
- package/src/app/lib/components/ui/table/table-footer.component.ts +6 -8
- package/src/app/lib/components/ui/table/table-head.component.ts +4 -8
- package/src/app/lib/components/ui/table/table-header.component.ts +6 -10
- package/src/app/lib/components/ui/table/table-row.component.ts +6 -11
- package/src/app/lib/components/ui/table/table.component.ts +4 -8
- package/src/app/lib/components/ui/tabs/index.ts +14 -7
- package/src/app/lib/components/ui/tabs/tabs-content.component.ts +11 -36
- package/src/app/lib/components/ui/tabs/tabs-context.ts +0 -8
- package/src/app/lib/components/ui/tabs/tabs-list.component.ts +54 -60
- package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +20 -35
- package/src/app/lib/components/ui/tabs/tabs.component.ts +32 -49
- package/src/app/lib/components/ui/textarea/textarea.component.ts +3 -8
- package/src/app/lib/components/ui/toast/index.ts +6 -7
- package/src/app/lib/components/ui/toast/toast-action.component.ts +7 -18
- package/src/app/lib/components/ui/toast/toast-description.component.ts +2 -11
- package/src/app/lib/components/ui/toast/toast-title.component.ts +2 -9
- package/src/app/lib/components/ui/toast/toast-variants.ts +1 -1
- package/src/app/lib/components/ui/toast/toast.component.ts +18 -24
- package/src/app/lib/components/ui/toast/toast.service.ts +22 -37
- package/src/app/lib/components/ui/toast/toaster.component.ts +6 -16
- package/src/app/lib/components/ui/toggle/index.ts +1 -5
- package/src/app/lib/components/ui/toggle/toggle-variants.ts +2 -2
- package/src/app/lib/components/ui/toggle/toggle.component.ts +32 -51
- package/src/app/lib/components/ui/toggle-group/index.ts +1 -4
- package/src/app/lib/components/ui/toggle-group/toggle-group-context.ts +1 -7
- package/src/app/lib/components/ui/toggle-group/toggle-group-item.component.ts +38 -59
- package/src/app/lib/components/ui/toggle-group/toggle-group.component.ts +33 -51
- package/src/app/lib/components/ui/tooltip/index.ts +9 -6
- package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +6 -24
- package/src/app/lib/components/ui/tooltip/tooltip-context.ts +0 -8
- package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +12 -24
- package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +4 -21
- package/src/app/lib/components/ui/tooltip/tooltip.component.ts +21 -33
- package/src/app/lib/components/ui/typography/index.ts +0 -1
- package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-h1.component.ts +3 -10
- package/src/app/lib/components/ui/typography/typography-h2.component.ts +3 -10
- package/src/app/lib/components/ui/typography/typography-h3.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-h4.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +4 -8
- package/src/app/lib/components/ui/typography/typography-large.component.ts +3 -9
- package/src/app/lib/components/ui/typography/typography-lead.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-list.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-muted.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-p.component.ts +3 -7
- package/src/app/lib/components/ui/typography/typography-small.component.ts +3 -7
- package/src/app/lib/utils/accessibility/click-outside.directive.ts +1 -8
- package/src/app/lib/utils/accessibility/focus-management.service.ts +4 -15
- package/src/app/lib/utils/accessibility/focus-trap.directive.ts +32 -106
- package/src/app/lib/utils/accessibility/index.ts +16 -5
- package/src/app/lib/utils/accessibility/keyboard-navigation.directive.ts +5 -8
- package/src/app/lib/utils/accessibility/live-region.directive.ts +10 -13
- package/src/app/lib/utils/accessibility/touch-target.directive.ts +1 -8
- package/src/app/lib/utils/animation/animation.utils.ts +4 -7
- package/src/app/lib/utils/animation/index.ts +15 -5
- package/src/app/lib/utils/animation/presence.component.ts +1 -1
- package/src/app/lib/utils/animation/presence.directive.ts +2 -2
- package/src/app/lib/utils/positioning/index.ts +40 -18
- package/src/app/lib/components/ui/index.ts +0 -551
- package/src/app/lib/index.ts +0 -7
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { InjectionToken, WritableSignal } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// Types
|
|
5
|
-
// ============================================================================
|
|
6
|
-
|
|
7
3
|
export type RadioGroupOrientation = 'horizontal' | 'vertical';
|
|
8
4
|
|
|
9
5
|
export interface RadioGroupContext {
|
|
@@ -33,6 +29,4 @@ export interface RadioGroupContext {
|
|
|
33
29
|
focusLast: () => void;
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
export const RADIO_GROUP_CONTEXT = new InjectionToken<RadioGroupContext>(
|
|
37
|
-
'RadioGroupContext'
|
|
38
|
-
);
|
|
32
|
+
export const RADIO_GROUP_CONTEXT = new InjectionToken<RadioGroupContext>('RadioGroupContext');
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
ElementRef,
|
|
7
|
+
inject,
|
|
8
|
+
input,
|
|
9
|
+
OnDestroy,
|
|
10
|
+
OnInit,
|
|
11
|
+
viewChild,
|
|
12
12
|
} from '@angular/core';
|
|
13
13
|
import { RADIO_GROUP_CONTEXT } from './radio-group-context';
|
|
14
14
|
|
|
15
|
-
// ============================================================================
|
|
16
|
-
// Types
|
|
17
|
-
// ============================================================================
|
|
18
|
-
|
|
19
15
|
export type RadioGroupItemProps = {
|
|
20
16
|
/** The unique value for this radio item */
|
|
21
17
|
value: string;
|
|
@@ -29,10 +25,6 @@ export type RadioGroupItemProps = {
|
|
|
29
25
|
class?: string;
|
|
30
26
|
};
|
|
31
27
|
|
|
32
|
-
// ============================================================================
|
|
33
|
-
// RadioGroupItem Component
|
|
34
|
-
// ============================================================================
|
|
35
|
-
|
|
36
28
|
/**
|
|
37
29
|
* RadioGroupItem component - individual radio option within a group.
|
|
38
30
|
* Based on Radix UI RadioGroup.Item with shadcn/ui styling.
|
|
@@ -91,10 +83,7 @@ export type RadioGroupItemProps = {
|
|
|
91
83
|
(keydown)="onKeyDown($event)"
|
|
92
84
|
>
|
|
93
85
|
@if (isChecked()) {
|
|
94
|
-
<span
|
|
95
|
-
data-slot="radio-group-indicator"
|
|
96
|
-
class="flex items-center justify-center"
|
|
97
|
-
>
|
|
86
|
+
<span data-slot="radio-group-indicator" class="flex items-center justify-center">
|
|
98
87
|
<svg
|
|
99
88
|
xmlns="http://www.w3.org/2000/svg"
|
|
100
89
|
width="24"
|
|
@@ -130,47 +119,38 @@ export type RadioGroupItemProps = {
|
|
|
130
119
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
131
120
|
})
|
|
132
121
|
export class RadioGroupItem implements OnInit, OnDestroy {
|
|
133
|
-
|
|
134
|
-
private readonly buttonElement =
|
|
135
|
-
viewChild<ElementRef<HTMLButtonElement>>('buttonElement');
|
|
136
|
-
|
|
137
|
-
/** The id for the radio button - used for label association */
|
|
138
|
-
readonly id = input<string>();
|
|
122
|
+
private readonly buttonElement = viewChild<ElementRef<HTMLButtonElement>>('buttonElement');
|
|
139
123
|
|
|
140
124
|
/** The value of this radio option */
|
|
141
125
|
readonly value = input.required<string>();
|
|
142
126
|
|
|
127
|
+
/** The id for the radio button - used for label association */
|
|
128
|
+
readonly id = input<string>();
|
|
143
129
|
/** Whether this radio is disabled */
|
|
144
130
|
readonly disabled = input<boolean>(false);
|
|
145
|
-
|
|
146
131
|
/** Whether this radio is required (inherited from group if not set) */
|
|
147
132
|
readonly required = input<boolean | undefined>(undefined);
|
|
148
|
-
|
|
149
133
|
/** Additional CSS classes to apply */
|
|
150
134
|
readonly class = input<string>('');
|
|
151
135
|
|
|
136
|
+
protected readonly context = inject(RADIO_GROUP_CONTEXT, { optional: true });
|
|
137
|
+
|
|
152
138
|
/** Whether this item is checked */
|
|
153
139
|
protected readonly isChecked = computed(() => {
|
|
154
140
|
return this.context?.value() === this.value();
|
|
155
141
|
});
|
|
156
|
-
|
|
157
142
|
/** State for data attribute */
|
|
158
|
-
protected readonly state = computed(() =>
|
|
159
|
-
this.isChecked() ? 'checked' : 'unchecked'
|
|
160
|
-
);
|
|
161
|
-
|
|
143
|
+
protected readonly state = computed(() => (this.isChecked() ? 'checked' : 'unchecked'));
|
|
162
144
|
/** Whether this item is disabled */
|
|
163
145
|
protected readonly isDisabled = computed(() => {
|
|
164
146
|
return this.disabled() || this.context?.disabled() || false;
|
|
165
147
|
});
|
|
166
|
-
|
|
167
148
|
/** Whether this item is required */
|
|
168
149
|
protected readonly isRequired = computed(() => {
|
|
169
150
|
const explicitRequired = this.required();
|
|
170
151
|
if (explicitRequired !== undefined) return explicitRequired;
|
|
171
152
|
return this.context?.required() || false;
|
|
172
153
|
});
|
|
173
|
-
|
|
174
154
|
/**
|
|
175
155
|
* Roving tabindex: only the checked item (or first item if none checked) is tabbable.
|
|
176
156
|
*/
|
|
@@ -185,16 +165,30 @@ export class RadioGroupItem implements OnInit, OnDestroy {
|
|
|
185
165
|
if (currentValue === this.value()) return 0;
|
|
186
166
|
|
|
187
167
|
// If no item is checked and this is the first item, it's tabbable
|
|
188
|
-
if (
|
|
189
|
-
!currentValue &&
|
|
190
|
-
itemValues.length > 0 &&
|
|
191
|
-
itemValues[0] === this.value()
|
|
192
|
-
) {
|
|
168
|
+
if (!currentValue && itemValues.length > 0 && itemValues[0] === this.value()) {
|
|
193
169
|
return 0;
|
|
194
170
|
}
|
|
195
171
|
|
|
196
172
|
return -1;
|
|
197
173
|
});
|
|
174
|
+
/** Computed class for wrapper */
|
|
175
|
+
protected readonly computedClass = computed(() => cn('relative inline-flex', this.class()));
|
|
176
|
+
/** Computed radio visual class */
|
|
177
|
+
protected readonly radioClass = computed(() =>
|
|
178
|
+
cn(
|
|
179
|
+
// Base styles
|
|
180
|
+
'aspect-square size-4 shrink-0 rounded-full border shadow-xs',
|
|
181
|
+
'inline-flex items-center justify-center cursor-pointer',
|
|
182
|
+
'transition-[color,box-shadow] outline-none',
|
|
183
|
+
// Focus styles
|
|
184
|
+
'focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:border-ring',
|
|
185
|
+
// State styles
|
|
186
|
+
'border-input text-primary',
|
|
187
|
+
'data-[state=checked]:border-primary',
|
|
188
|
+
// Disabled styles
|
|
189
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
190
|
+
),
|
|
191
|
+
);
|
|
198
192
|
|
|
199
193
|
ngOnInit(): void {
|
|
200
194
|
// Register this item with the group
|
|
@@ -205,12 +199,9 @@ export class RadioGroupItem implements OnInit, OnDestroy {
|
|
|
205
199
|
return values;
|
|
206
200
|
});
|
|
207
201
|
}
|
|
208
|
-
|
|
209
202
|
ngOnDestroy(): void {
|
|
210
203
|
// Unregister this item from the group
|
|
211
|
-
this.context?.itemValues.update((values) =>
|
|
212
|
-
values.filter((v) => v !== this.value())
|
|
213
|
-
);
|
|
204
|
+
this.context?.itemValues.update((values) => values.filter((v) => v !== this.value()));
|
|
214
205
|
}
|
|
215
206
|
|
|
216
207
|
/** Select this radio option */
|
|
@@ -219,12 +210,10 @@ export class RadioGroupItem implements OnInit, OnDestroy {
|
|
|
219
210
|
this.context?.setValue(this.value());
|
|
220
211
|
}
|
|
221
212
|
}
|
|
222
|
-
|
|
223
213
|
/** Focus the button element */
|
|
224
214
|
focus(): void {
|
|
225
215
|
this.buttonElement()?.nativeElement.focus();
|
|
226
216
|
}
|
|
227
|
-
|
|
228
217
|
/** Handle keyboard navigation */
|
|
229
218
|
onKeyDown(event: KeyboardEvent): void {
|
|
230
219
|
if (this.isDisabled() || !this.context) return;
|
|
@@ -273,26 +262,4 @@ export class RadioGroupItem implements OnInit, OnDestroy {
|
|
|
273
262
|
break;
|
|
274
263
|
}
|
|
275
264
|
}
|
|
276
|
-
|
|
277
|
-
/** Computed class for wrapper */
|
|
278
|
-
protected readonly computedClass = computed(() =>
|
|
279
|
-
cn('relative inline-flex', this.class())
|
|
280
|
-
);
|
|
281
|
-
|
|
282
|
-
/** Computed radio visual class */
|
|
283
|
-
protected readonly radioClass = computed(() =>
|
|
284
|
-
cn(
|
|
285
|
-
// Base styles
|
|
286
|
-
'aspect-square size-4 shrink-0 rounded-full border shadow-xs',
|
|
287
|
-
'inline-flex items-center justify-center cursor-pointer',
|
|
288
|
-
'transition-[color,box-shadow] outline-none',
|
|
289
|
-
// Focus styles
|
|
290
|
-
'focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:border-ring',
|
|
291
|
-
// State styles
|
|
292
|
-
'border-input text-primary',
|
|
293
|
-
'data-[state=checked]:border-primary',
|
|
294
|
-
// Disabled styles
|
|
295
|
-
'disabled:cursor-not-allowed disabled:opacity-50'
|
|
296
|
-
)
|
|
297
|
-
);
|
|
298
265
|
}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
computed,
|
|
6
|
+
ElementRef,
|
|
7
|
+
forwardRef,
|
|
8
|
+
inject,
|
|
9
|
+
input,
|
|
10
|
+
model,
|
|
11
|
+
output,
|
|
12
|
+
signal,
|
|
13
13
|
} from '@angular/core';
|
|
14
14
|
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
RADIO_GROUP_CONTEXT,
|
|
17
|
+
type RadioGroupContext,
|
|
18
|
+
type RadioGroupOrientation,
|
|
19
19
|
} from './radio-group-context';
|
|
20
20
|
|
|
21
|
-
// ============================================================================
|
|
22
|
-
// Types
|
|
23
|
-
// ============================================================================
|
|
24
|
-
|
|
25
21
|
export type RadioGroupProps = {
|
|
26
22
|
/** Current selected value */
|
|
27
23
|
value?: string;
|
|
@@ -41,10 +37,6 @@ export type RadioGroupProps = {
|
|
|
41
37
|
class?: string;
|
|
42
38
|
};
|
|
43
39
|
|
|
44
|
-
// ============================================================================
|
|
45
|
-
// RadioGroup Component
|
|
46
|
-
// ============================================================================
|
|
47
|
-
|
|
48
40
|
/**
|
|
49
41
|
* RadioGroup component for single selection from multiple options.
|
|
50
42
|
* Based on Radix UI RadioGroup primitive with shadcn/ui styling.
|
|
@@ -129,48 +121,38 @@ export type RadioGroupProps = {
|
|
|
129
121
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
130
122
|
})
|
|
131
123
|
export class RadioGroup implements ControlValueAccessor {
|
|
132
|
-
|
|
124
|
+
/** Emitted when value changes */
|
|
125
|
+
readonly valueChange = output<string>();
|
|
133
126
|
|
|
134
127
|
/** The current selected value */
|
|
135
128
|
readonly value = model<string>('');
|
|
136
129
|
|
|
137
130
|
/** Default value for uncontrolled mode */
|
|
138
131
|
readonly defaultValue = input<string>('');
|
|
139
|
-
|
|
140
132
|
/** Whether the radio group is disabled via input */
|
|
141
133
|
readonly disabled = input<boolean>(false);
|
|
142
|
-
|
|
143
134
|
/** Whether the radio group is required */
|
|
144
135
|
readonly required = input<boolean>(false);
|
|
145
|
-
|
|
146
136
|
/** The orientation of the radio group */
|
|
147
137
|
readonly orientation = input<RadioGroupOrientation>('vertical');
|
|
148
|
-
|
|
149
138
|
/** Whether to loop focus at boundaries */
|
|
150
139
|
readonly loop = input<boolean>(true);
|
|
151
|
-
|
|
152
140
|
/** The name attribute for the radio inputs */
|
|
153
|
-
readonly name = input<string>(
|
|
154
|
-
`radio-group-${Math.random().toString(36).substring(7)}`
|
|
155
|
-
);
|
|
156
|
-
|
|
141
|
+
readonly name = input<string>(`radio-group-${Math.random().toString(36).substring(7)}`);
|
|
157
142
|
/** Additional CSS classes to apply */
|
|
158
143
|
readonly class = input<string>('');
|
|
159
144
|
|
|
160
|
-
|
|
161
|
-
readonly valueChange = output<string>();
|
|
162
|
-
|
|
163
|
-
/** Whether disabled via forms */
|
|
164
|
-
private readonly formsDisabled = signal<boolean>(false);
|
|
145
|
+
private readonly _elementRef = inject(ElementRef<HTMLElement>);
|
|
165
146
|
|
|
166
|
-
/**
|
|
167
|
-
readonly
|
|
168
|
-
(
|
|
147
|
+
/** Computed class combining base styles and custom classes */
|
|
148
|
+
protected readonly computedClass = computed(() =>
|
|
149
|
+
cn('grid gap-3', this.orientation() === 'horizontal' && 'flex flex-row', this.class()),
|
|
169
150
|
);
|
|
151
|
+
/** Whether the group is disabled */
|
|
152
|
+
readonly isDisabled = computed(() => this.disabled() || this.isFormsDisabled());
|
|
170
153
|
|
|
171
|
-
/**
|
|
172
|
-
private
|
|
173
|
-
private onTouched: () => void = () => {};
|
|
154
|
+
/** Whether disabled via forms */
|
|
155
|
+
private readonly isFormsDisabled = signal<boolean>(false);
|
|
174
156
|
|
|
175
157
|
/** Context for child RadioGroupItem components */
|
|
176
158
|
readonly context: RadioGroupContext = {
|
|
@@ -193,18 +175,11 @@ export class RadioGroup implements ControlValueAccessor {
|
|
|
193
175
|
focusNext: (currentValue: string) => this.focusItem(currentValue, 1),
|
|
194
176
|
focusPrevious: (currentValue: string) => this.focusItem(currentValue, -1),
|
|
195
177
|
focusFirst: () => this.focusItemByIndex(0),
|
|
196
|
-
focusLast: () =>
|
|
197
|
-
this.focusItemByIndex(this.context.itemValues().length - 1),
|
|
178
|
+
focusLast: () => this.focusItemByIndex(this.context.itemValues().length - 1),
|
|
198
179
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
cn(
|
|
203
|
-
'grid gap-3',
|
|
204
|
-
this.orientation() === 'horizontal' && 'flex flex-row',
|
|
205
|
-
this.class()
|
|
206
|
-
)
|
|
207
|
-
);
|
|
180
|
+
/** ControlValueAccessor callbacks */
|
|
181
|
+
private onChange: (value: string) => void = () => {};
|
|
182
|
+
private onTouched: () => void = () => {};
|
|
208
183
|
|
|
209
184
|
ngOnChanges(): void {
|
|
210
185
|
this.context.value.set(this.value());
|
|
@@ -217,21 +192,18 @@ export class RadioGroup implements ControlValueAccessor {
|
|
|
217
192
|
|
|
218
193
|
// ControlValueAccessor implementation
|
|
219
194
|
writeValue(value: string): void {
|
|
220
|
-
const
|
|
221
|
-
this.value.set(
|
|
222
|
-
this.context.value.set(
|
|
195
|
+
const resolvedValue = value ?? this.defaultValue();
|
|
196
|
+
this.value.set(resolvedValue);
|
|
197
|
+
this.context.value.set(resolvedValue);
|
|
223
198
|
}
|
|
224
|
-
|
|
225
199
|
registerOnChange(fn: (value: string) => void): void {
|
|
226
200
|
this.onChange = fn;
|
|
227
201
|
}
|
|
228
|
-
|
|
229
202
|
registerOnTouched(fn: () => void): void {
|
|
230
203
|
this.onTouched = fn;
|
|
231
204
|
}
|
|
232
|
-
|
|
233
205
|
setDisabledState(isDisabled: boolean): void {
|
|
234
|
-
this.
|
|
206
|
+
this.isFormsDisabled.set(isDisabled);
|
|
235
207
|
this.context.disabled.set(this.isDisabled());
|
|
236
208
|
}
|
|
237
209
|
|
|
@@ -255,21 +227,20 @@ export class RadioGroup implements ControlValueAccessor {
|
|
|
255
227
|
|
|
256
228
|
this.focusItemByIndex(nextIndex);
|
|
257
229
|
}
|
|
258
|
-
|
|
259
230
|
/** Focus a radio item by index and select it */
|
|
260
231
|
private focusItemByIndex(index: number): void {
|
|
261
232
|
const values = this.context.itemValues();
|
|
262
233
|
if (index < 0 || index >= values.length) return;
|
|
263
234
|
|
|
264
|
-
const
|
|
265
|
-
const
|
|
266
|
-
`[data-slot="radio-group-item"][data-value="${
|
|
235
|
+
const targetValue = values[index];
|
|
236
|
+
const radioElement = this._elementRef.nativeElement.querySelector(
|
|
237
|
+
`[data-slot="radio-group-item"][data-value="${targetValue}"]`,
|
|
267
238
|
) as HTMLElement;
|
|
268
239
|
|
|
269
|
-
if (
|
|
270
|
-
|
|
240
|
+
if (radioElement) {
|
|
241
|
+
radioElement.focus();
|
|
271
242
|
// Also select the item on focus (per ARIA spec for radio groups)
|
|
272
|
-
this.context.setValue(
|
|
243
|
+
this.context.setValue(targetValue);
|
|
273
244
|
}
|
|
274
245
|
}
|
|
275
246
|
}
|
|
@@ -2,4 +2,3 @@ export { RESIZABLE_CONTEXT, type ResizableContextValue } from './resizable-conte
|
|
|
2
2
|
export { ResizableHandle } from './resizable-handle.component';
|
|
3
3
|
export { ResizablePanelGroup } from './resizable-panel-group.component';
|
|
4
4
|
export { ResizablePanel } from './resizable-panel.component';
|
|
5
|
-
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
signal,
|
|
9
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';
|
|
10
3
|
import { RESIZABLE_CONTEXT } from './resizable-context';
|
|
11
4
|
|
|
12
5
|
let handleIdCounter = 0;
|
|
@@ -50,6 +43,7 @@ let handleIdCounter = 0;
|
|
|
50
43
|
}
|
|
51
44
|
`,
|
|
52
45
|
host: {
|
|
46
|
+
'attr.data-slot': '"resizable-handle"',
|
|
53
47
|
'[class]': 'computedClass()',
|
|
54
48
|
'[attr.data-panel-resize-handle]': 'true',
|
|
55
49
|
'[attr.data-panel-resize-handle-id]': 'handleId',
|
|
@@ -69,31 +63,14 @@ let handleIdCounter = 0;
|
|
|
69
63
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
70
64
|
})
|
|
71
65
|
export class ResizableHandle {
|
|
72
|
-
protected readonly context = inject(RESIZABLE_CONTEXT);
|
|
73
|
-
|
|
74
66
|
/** Show a visible handle grip */
|
|
75
67
|
readonly withHandle = input<boolean>(false);
|
|
76
|
-
|
|
77
68
|
/** Whether the handle is disabled */
|
|
78
69
|
readonly disabled = input<boolean>(false);
|
|
79
|
-
|
|
80
70
|
/** Additional CSS classes */
|
|
81
71
|
readonly class = input<string>('');
|
|
82
72
|
|
|
83
|
-
|
|
84
|
-
readonly handleId = `handle-${handleIdCounter++}`;
|
|
85
|
-
|
|
86
|
-
/** Whether dragging */
|
|
87
|
-
private isDragging = signal(false);
|
|
88
|
-
|
|
89
|
-
/** Whether focused for keyboard interaction */
|
|
90
|
-
private isFocused = signal(false);
|
|
91
|
-
|
|
92
|
-
/** Starting position */
|
|
93
|
-
private startPosition = 0;
|
|
94
|
-
|
|
95
|
-
/** ARIA value (approximate percentage) */
|
|
96
|
-
protected readonly ariaValueNow = signal(50);
|
|
73
|
+
protected readonly context = inject(RESIZABLE_CONTEXT);
|
|
97
74
|
|
|
98
75
|
protected readonly computedClass = computed(() =>
|
|
99
76
|
cn(
|
|
@@ -102,18 +79,28 @@ export class ResizableHandle {
|
|
|
102
79
|
'h-px w-full after:left-0 after:h-1 after:w-full after:-translate-y-1/2 after:translate-x-0',
|
|
103
80
|
'[&[data-panel-group-direction=vertical]>div]:rotate-90',
|
|
104
81
|
this.isFocused() && 'ring-2 ring-ring',
|
|
105
|
-
this.class()
|
|
106
|
-
)
|
|
82
|
+
this.class(),
|
|
83
|
+
),
|
|
107
84
|
);
|
|
108
85
|
|
|
86
|
+
/** Whether dragging */
|
|
87
|
+
private isDragging = signal(false);
|
|
88
|
+
/** Whether focused for keyboard interaction */
|
|
89
|
+
private isFocused = signal(false);
|
|
90
|
+
/** ARIA value (approximate percentage) */
|
|
91
|
+
protected readonly ariaValueNow = signal(50);
|
|
92
|
+
|
|
93
|
+
/** Starting position */
|
|
94
|
+
private startPosition = 0;
|
|
95
|
+
/** Unique handle ID */
|
|
96
|
+
readonly handleId = `handle-${handleIdCounter++}`;
|
|
97
|
+
|
|
109
98
|
onFocus(): void {
|
|
110
99
|
this.isFocused.set(true);
|
|
111
100
|
}
|
|
112
|
-
|
|
113
101
|
onBlur(): void {
|
|
114
102
|
this.isFocused.set(false);
|
|
115
103
|
}
|
|
116
|
-
|
|
117
104
|
onKeyDown(event: KeyboardEvent): void {
|
|
118
105
|
if (this.disabled()) return;
|
|
119
106
|
|
|
@@ -166,13 +153,6 @@ export class ResizableHandle {
|
|
|
166
153
|
this.updateAriaValue(delta);
|
|
167
154
|
}
|
|
168
155
|
}
|
|
169
|
-
|
|
170
|
-
private updateAriaValue(delta: number): void {
|
|
171
|
-
const current = this.ariaValueNow();
|
|
172
|
-
const newValue = Math.max(0, Math.min(100, current + delta));
|
|
173
|
-
this.ariaValueNow.set(newValue);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
156
|
onMouseDown(event: MouseEvent): void {
|
|
177
157
|
if (this.disabled()) return;
|
|
178
158
|
|
|
@@ -200,7 +180,6 @@ export class ResizableHandle {
|
|
|
200
180
|
document.addEventListener('mousemove', onMouseMove);
|
|
201
181
|
document.addEventListener('mouseup', onMouseUp);
|
|
202
182
|
}
|
|
203
|
-
|
|
204
183
|
onTouchStart(event: TouchEvent): void {
|
|
205
184
|
if (this.disabled()) return;
|
|
206
185
|
|
|
@@ -213,7 +192,8 @@ export class ResizableHandle {
|
|
|
213
192
|
if (!this.isDragging()) return;
|
|
214
193
|
|
|
215
194
|
const currentTouch = e.touches[0];
|
|
216
|
-
const currentPosition =
|
|
195
|
+
const currentPosition =
|
|
196
|
+
this.context.direction() === 'horizontal' ? currentTouch.clientX : currentTouch.clientY;
|
|
217
197
|
const delta = ((currentPosition - this.startPosition) / window.innerWidth) * 100;
|
|
218
198
|
this.context.onResize(delta);
|
|
219
199
|
this.startPosition = currentPosition;
|
|
@@ -229,4 +209,10 @@ export class ResizableHandle {
|
|
|
229
209
|
document.addEventListener('touchmove', onTouchMove);
|
|
230
210
|
document.addEventListener('touchend', onTouchEnd);
|
|
231
211
|
}
|
|
212
|
+
|
|
213
|
+
private updateAriaValue(delta: number): void {
|
|
214
|
+
const current = this.ariaValueNow();
|
|
215
|
+
const newValue = Math.max(0, Math.min(100, current + delta));
|
|
216
|
+
this.ariaValueNow.set(newValue);
|
|
217
|
+
}
|
|
232
218
|
}
|
|
@@ -28,6 +28,7 @@ import { RESIZABLE_CONTEXT, type ResizableContextValue } from './resizable-conte
|
|
|
28
28
|
selector: 'ResizablePanelGroup',
|
|
29
29
|
template: `<ng-content />`,
|
|
30
30
|
host: {
|
|
31
|
+
'attr.data-slot': '"resizable-panel-group"',
|
|
31
32
|
'[class]': 'computedClass()',
|
|
32
33
|
'[attr.data-panel-group]': 'true',
|
|
33
34
|
'[attr.data-panel-group-direction]': 'direction()',
|
|
@@ -46,63 +47,54 @@ export class ResizablePanelGroup implements ResizableContextValue {
|
|
|
46
47
|
|
|
47
48
|
/** Additional CSS classes */
|
|
48
49
|
readonly class = input<string>('');
|
|
49
|
-
|
|
50
50
|
/** Whether keyboard resize is disabled */
|
|
51
51
|
readonly keyboardResizeBy = input<number>(10);
|
|
52
52
|
|
|
53
53
|
/** Auto-save ID for persisting layout */
|
|
54
54
|
readonly autoSaveId = input<string | null>(null);
|
|
55
55
|
|
|
56
|
+
protected readonly computedClass = computed(() =>
|
|
57
|
+
cn('flex h-full w-full data-[panel-group-direction=vertical]:flex-col', this.class()),
|
|
58
|
+
);
|
|
59
|
+
|
|
56
60
|
/** Panel sizes state */
|
|
57
61
|
readonly panelSizes = signal<Map<string, number>>(new Map());
|
|
58
62
|
|
|
59
63
|
/** Currently active resize handle */
|
|
60
64
|
private activeHandleId: string | null = null;
|
|
61
|
-
|
|
62
65
|
/** Panels metadata */
|
|
63
66
|
private panels = new Map<string, { minSize: number; maxSize: number; order: number }>();
|
|
64
67
|
|
|
65
68
|
/** Panel order counter */
|
|
66
69
|
private panelOrderCounter = 0;
|
|
67
70
|
|
|
68
|
-
protected readonly computedClass = computed(() =>
|
|
69
|
-
cn(
|
|
70
|
-
'flex h-full w-full data-[panel-group-direction=vertical]:flex-col',
|
|
71
|
-
this.class()
|
|
72
|
-
)
|
|
73
|
-
);
|
|
74
|
-
|
|
75
71
|
registerPanel(id: string, minSize = 0, maxSize = 100, defaultSize?: number): void {
|
|
76
72
|
this.panels.set(id, { minSize, maxSize, order: this.panelOrderCounter++ });
|
|
77
73
|
if (defaultSize !== undefined) {
|
|
78
|
-
this.panelSizes.update(sizes => {
|
|
74
|
+
this.panelSizes.update((sizes) => {
|
|
79
75
|
const newSizes = new Map(sizes);
|
|
80
76
|
newSizes.set(id, defaultSize);
|
|
81
77
|
return newSizes;
|
|
82
78
|
});
|
|
83
79
|
}
|
|
84
80
|
}
|
|
85
|
-
|
|
86
81
|
getPanelSize(id: string): number {
|
|
87
82
|
return this.panelSizes().get(id) ?? 50;
|
|
88
83
|
}
|
|
89
|
-
|
|
90
84
|
setPanelSize(id: string, size: number): void {
|
|
91
85
|
const panel = this.panels.get(id);
|
|
92
86
|
if (panel) {
|
|
93
87
|
const clampedSize = Math.max(panel.minSize, Math.min(panel.maxSize, size));
|
|
94
|
-
this.panelSizes.update(sizes => {
|
|
88
|
+
this.panelSizes.update((sizes) => {
|
|
95
89
|
const newSizes = new Map(sizes);
|
|
96
90
|
newSizes.set(id, clampedSize);
|
|
97
91
|
return newSizes;
|
|
98
92
|
});
|
|
99
93
|
}
|
|
100
94
|
}
|
|
101
|
-
|
|
102
95
|
startResize(handleId: string): void {
|
|
103
96
|
this.activeHandleId = handleId;
|
|
104
97
|
}
|
|
105
|
-
|
|
106
98
|
onResize(delta: number): void {
|
|
107
99
|
if (!this.activeHandleId) return;
|
|
108
100
|
|
|
@@ -123,8 +115,14 @@ export class ResizablePanelGroup implements ResizableContextValue {
|
|
|
123
115
|
const leftPanel = this.panels.get(leftPanelId)!;
|
|
124
116
|
const rightPanel = this.panels.get(rightPanelId)!;
|
|
125
117
|
|
|
126
|
-
const newLeftSize = Math.max(
|
|
127
|
-
|
|
118
|
+
const newLeftSize = Math.max(
|
|
119
|
+
leftPanel.minSize,
|
|
120
|
+
Math.min(leftPanel.maxSize, leftSize + delta),
|
|
121
|
+
);
|
|
122
|
+
const newRightSize = Math.max(
|
|
123
|
+
rightPanel.minSize,
|
|
124
|
+
Math.min(rightPanel.maxSize, rightSize - delta),
|
|
125
|
+
);
|
|
128
126
|
|
|
129
127
|
// Only update if both constraints are satisfied
|
|
130
128
|
if (newLeftSize + newRightSize === leftSize + rightSize) {
|
|
@@ -133,7 +131,6 @@ export class ResizablePanelGroup implements ResizableContextValue {
|
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
133
|
}
|
|
136
|
-
|
|
137
134
|
endResize(): void {
|
|
138
135
|
this.activeHandleId = null;
|
|
139
136
|
}
|