@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,14 +1,14 @@
|
|
|
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 { SELECT_CONTEXT } from './select-context';
|
|
14
14
|
|
|
@@ -22,9 +22,7 @@ import { SELECT_CONTEXT } from './select-context';
|
|
|
22
22
|
@Component({
|
|
23
23
|
selector: 'SelectItem',
|
|
24
24
|
template: `
|
|
25
|
-
<span
|
|
26
|
-
class="absolute left-2 flex size-3.5 items-center justify-center"
|
|
27
|
-
>
|
|
25
|
+
<span class="absolute left-2 flex size-3.5 items-center justify-center">
|
|
28
26
|
@if (isSelected()) {
|
|
29
27
|
<svg
|
|
30
28
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -48,7 +46,7 @@ import { SELECT_CONTEXT } from './select-context';
|
|
|
48
46
|
`,
|
|
49
47
|
host: {
|
|
50
48
|
'[class]': 'computedClass()',
|
|
51
|
-
|
|
49
|
+
role: 'option',
|
|
52
50
|
'[attr.aria-selected]': 'isSelected()',
|
|
53
51
|
'[attr.data-state]': 'isSelected() ? "checked" : "unchecked"',
|
|
54
52
|
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
@@ -62,8 +60,6 @@ import { SELECT_CONTEXT } from './select-context';
|
|
|
62
60
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
63
61
|
})
|
|
64
62
|
export class SelectItem implements OnInit, OnDestroy {
|
|
65
|
-
private readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
66
|
-
|
|
67
63
|
private readonly textContent = viewChild<ElementRef>('textContent');
|
|
68
64
|
|
|
69
65
|
/** The value of this option */
|
|
@@ -71,52 +67,49 @@ export class SelectItem implements OnInit, OnDestroy {
|
|
|
71
67
|
|
|
72
68
|
/** Whether this option is disabled */
|
|
73
69
|
readonly disabled = input<boolean>(false);
|
|
74
|
-
|
|
75
70
|
/** Additional CSS classes to apply */
|
|
76
71
|
readonly class = input<string>('');
|
|
77
72
|
|
|
73
|
+
private readonly _context = inject(SELECT_CONTEXT, { optional: true });
|
|
74
|
+
|
|
78
75
|
/** Whether this item is selected */
|
|
79
76
|
protected readonly isSelected = computed(() => {
|
|
80
|
-
return this.
|
|
77
|
+
return this._context?.value() === this.value();
|
|
81
78
|
});
|
|
82
|
-
|
|
79
|
+
/** Computed class combining base styles and custom classes */
|
|
80
|
+
protected readonly computedClass = computed(() =>
|
|
81
|
+
cn(
|
|
82
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
83
|
+
'hover:bg-accent hover:text-accent-foreground cursor-pointer',
|
|
84
|
+
this.disabled() && 'pointer-events-none opacity-50',
|
|
85
|
+
this.class(),
|
|
86
|
+
),
|
|
87
|
+
);
|
|
83
88
|
/** Whether this item is focused */
|
|
84
89
|
protected readonly isFocused = computed(() => {
|
|
85
|
-
if (!this.
|
|
86
|
-
const values = this.
|
|
87
|
-
const focusedIndex = this.
|
|
90
|
+
if (!this._context) return false;
|
|
91
|
+
const values = this._context.itemValues();
|
|
92
|
+
const focusedIndex = this._context.focusedIndex();
|
|
88
93
|
return values[focusedIndex] === this.value();
|
|
89
94
|
});
|
|
90
95
|
|
|
91
96
|
ngOnInit(): void {
|
|
92
97
|
// Register this item
|
|
93
|
-
this.
|
|
98
|
+
this._context?.itemValues.update((values) => {
|
|
94
99
|
if (!values.includes(this.value())) {
|
|
95
100
|
return [...values, this.value()];
|
|
96
101
|
}
|
|
97
102
|
return values;
|
|
98
103
|
});
|
|
99
104
|
}
|
|
100
|
-
|
|
101
105
|
ngOnDestroy(): void {
|
|
102
106
|
// Unregister this item
|
|
103
|
-
this.
|
|
104
|
-
values.filter(v => v !== this.value())
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** Select this option */
|
|
109
|
-
select() {
|
|
110
|
-
if (!this.disabled()) {
|
|
111
|
-
const textEl = this.textContent()?.nativeElement;
|
|
112
|
-
const label = textEl?.textContent?.trim() || this.value();
|
|
113
|
-
this.context?.setValue(this.value(), label);
|
|
114
|
-
}
|
|
107
|
+
this._context?.itemValues.update((values) => values.filter((v) => v !== this.value()));
|
|
115
108
|
}
|
|
116
109
|
|
|
117
110
|
/** Handle keyboard navigation */
|
|
118
111
|
onKeyDown(event: KeyboardEvent): void {
|
|
119
|
-
if (!this.
|
|
112
|
+
if (!this._context || this.disabled()) return;
|
|
120
113
|
|
|
121
114
|
switch (event.key) {
|
|
122
115
|
case ' ':
|
|
@@ -126,38 +119,36 @@ export class SelectItem implements OnInit, OnDestroy {
|
|
|
126
119
|
break;
|
|
127
120
|
case 'ArrowDown':
|
|
128
121
|
event.preventDefault();
|
|
129
|
-
const currentIndex = this.
|
|
130
|
-
const itemCount = this.
|
|
131
|
-
this.
|
|
122
|
+
const currentIndex = this._context.focusedIndex();
|
|
123
|
+
const itemCount = this._context.itemValues().length;
|
|
124
|
+
this._context.focusItem(Math.min(currentIndex + 1, itemCount - 1));
|
|
132
125
|
break;
|
|
133
126
|
case 'ArrowUp':
|
|
134
127
|
event.preventDefault();
|
|
135
|
-
const idx = this.
|
|
136
|
-
this.
|
|
128
|
+
const idx = this._context.focusedIndex();
|
|
129
|
+
this._context.focusItem(Math.max(idx - 1, 0));
|
|
137
130
|
break;
|
|
138
131
|
case 'Home':
|
|
139
132
|
event.preventDefault();
|
|
140
|
-
this.
|
|
133
|
+
this._context.focusItem(0);
|
|
141
134
|
break;
|
|
142
135
|
case 'End':
|
|
143
136
|
event.preventDefault();
|
|
144
|
-
const lastIndex = this.
|
|
145
|
-
this.
|
|
137
|
+
const lastIndex = this._context.itemValues().length - 1;
|
|
138
|
+
this._context.focusItem(lastIndex);
|
|
146
139
|
break;
|
|
147
140
|
case 'Escape':
|
|
148
141
|
event.preventDefault();
|
|
149
|
-
this.
|
|
142
|
+
this._context.setOpen(false);
|
|
150
143
|
break;
|
|
151
144
|
}
|
|
152
145
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
)
|
|
162
|
-
);
|
|
146
|
+
/** Select this option */
|
|
147
|
+
select(): void {
|
|
148
|
+
if (!this.disabled()) {
|
|
149
|
+
const textEl = this.textContent()?.nativeElement;
|
|
150
|
+
const label = textEl?.textContent?.trim() || this.value();
|
|
151
|
+
this._context?.setValue(this.value(), label);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
163
154
|
}
|
|
@@ -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
|
* SelectLabel component - label for a select group.
|
|
@@ -27,6 +22,6 @@ export class SelectLabel {
|
|
|
27
22
|
|
|
28
23
|
/** Computed class combining base styles and custom classes */
|
|
29
24
|
protected readonly computedClass = computed(() =>
|
|
30
|
-
cn('text-muted-foreground px-2 py-1.5 text-xs', this.class())
|
|
25
|
+
cn('text-muted-foreground px-2 py-1.5 text-xs', this.class()),
|
|
31
26
|
);
|
|
32
27
|
}
|
|
@@ -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
|
* SelectSeparator component - visual separator between select items.
|
|
@@ -17,7 +12,7 @@ import {
|
|
|
17
12
|
template: ``,
|
|
18
13
|
host: {
|
|
19
14
|
'[class]': 'computedClass()',
|
|
20
|
-
|
|
15
|
+
role: 'separator',
|
|
21
16
|
'aria-orientation': 'horizontal',
|
|
22
17
|
'data-slot': 'select-separator',
|
|
23
18
|
},
|
|
@@ -29,6 +24,6 @@ export class SelectSeparator {
|
|
|
29
24
|
|
|
30
25
|
/** Computed class combining base styles and custom classes */
|
|
31
26
|
protected readonly computedClass = computed(() =>
|
|
32
|
-
cn('bg-muted pointer-events-none -mx-1 my-1 h-px', this.class())
|
|
27
|
+
cn('bg-muted pointer-events-none -mx-1 my-1 h-px', this.class()),
|
|
33
28
|
);
|
|
34
29
|
}
|
|
@@ -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 { SELECT_CONTEXT } from './select-context';
|
|
12
12
|
|
|
@@ -34,7 +34,7 @@ import { SELECT_CONTEXT } from './select-context';
|
|
|
34
34
|
[attr.data-disabled]="context?.disabled() ? '' : null"
|
|
35
35
|
[attr.data-placeholder]="!context?.value() ? '' : null"
|
|
36
36
|
[disabled]="context?.disabled()"
|
|
37
|
-
(click)="
|
|
37
|
+
(click)="onTriggerClick($event)"
|
|
38
38
|
(keydown)="onKeyDown($event)"
|
|
39
39
|
>
|
|
40
40
|
<ng-content />
|
|
@@ -56,20 +56,29 @@ import { SELECT_CONTEXT } from './select-context';
|
|
|
56
56
|
</button>
|
|
57
57
|
`,
|
|
58
58
|
host: {
|
|
59
|
-
|
|
59
|
+
class: 'contents',
|
|
60
60
|
'data-slot': 'select-trigger',
|
|
61
61
|
},
|
|
62
62
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
63
63
|
})
|
|
64
64
|
export class SelectTrigger {
|
|
65
|
-
protected readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
66
65
|
private readonly triggerButton = viewChild<ElementRef<HTMLButtonElement>>('triggerButton');
|
|
67
66
|
|
|
68
67
|
/** Additional CSS classes to apply */
|
|
69
68
|
readonly class = input<string>('');
|
|
70
69
|
|
|
70
|
+
protected readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
71
|
+
|
|
72
|
+
/** Computed class combining base styles and custom classes */
|
|
73
|
+
protected readonly computedClass = computed(() =>
|
|
74
|
+
cn(
|
|
75
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex h-9 w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2",
|
|
76
|
+
this.class(),
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
|
|
71
80
|
/** Toggle the select open state */
|
|
72
|
-
toggleOpen() {
|
|
81
|
+
toggleOpen(): void {
|
|
73
82
|
if (!this.context?.disabled()) {
|
|
74
83
|
// Save trigger element for focus restoration
|
|
75
84
|
const button = this.triggerButton()?.nativeElement;
|
|
@@ -77,19 +86,21 @@ export class SelectTrigger {
|
|
|
77
86
|
this.context?.triggerElement.set(button);
|
|
78
87
|
}
|
|
79
88
|
const newState = !this.context?.open();
|
|
80
|
-
this.context?.
|
|
89
|
+
this.context?.setOpen(newState);
|
|
81
90
|
if (newState) {
|
|
82
91
|
// Focus first item when opening
|
|
83
92
|
setTimeout(() => this.context?.focusItem(0));
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
95
|
}
|
|
87
|
-
|
|
96
|
+
onTriggerClick(event: MouseEvent): void {
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
this.toggleOpen();
|
|
99
|
+
}
|
|
88
100
|
/** Close the select */
|
|
89
|
-
close() {
|
|
101
|
+
close(): void {
|
|
90
102
|
this.context?.open.set(false);
|
|
91
103
|
}
|
|
92
|
-
|
|
93
104
|
/** Handle keyboard navigation */
|
|
94
105
|
onKeyDown(event: KeyboardEvent): void {
|
|
95
106
|
if (!this.context || this.context.disabled()) return;
|
|
@@ -108,7 +119,7 @@ export class SelectTrigger {
|
|
|
108
119
|
if (button) {
|
|
109
120
|
this.context.triggerElement.set(button);
|
|
110
121
|
}
|
|
111
|
-
this.context.
|
|
122
|
+
this.context.setOpen(true);
|
|
112
123
|
setTimeout(() => this.context?.focusItem(0));
|
|
113
124
|
} else {
|
|
114
125
|
// Move to next item
|
|
@@ -125,7 +136,7 @@ export class SelectTrigger {
|
|
|
125
136
|
if (button) {
|
|
126
137
|
this.context.triggerElement.set(button);
|
|
127
138
|
}
|
|
128
|
-
this.context.
|
|
139
|
+
this.context.setOpen(true);
|
|
129
140
|
const lastIndex = this.context.itemValues().length - 1;
|
|
130
141
|
setTimeout(() => this.context?.focusItem(lastIndex));
|
|
131
142
|
} else {
|
|
@@ -153,12 +164,4 @@ export class SelectTrigger {
|
|
|
153
164
|
break;
|
|
154
165
|
}
|
|
155
166
|
}
|
|
156
|
-
|
|
157
|
-
/** Computed class combining base styles and custom classes */
|
|
158
|
-
protected readonly computedClass = computed(() =>
|
|
159
|
-
cn(
|
|
160
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex h-9 w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2",
|
|
161
|
-
this.class()
|
|
162
|
-
)
|
|
163
|
-
);
|
|
164
167
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
computed,
|
|
5
|
-
effect,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, effect, inject, input } from '@angular/core';
|
|
9
2
|
import { SELECT_CONTEXT } from './select-context';
|
|
10
3
|
|
|
11
4
|
/**
|
|
@@ -20,15 +13,11 @@ import { SELECT_CONTEXT } from './select-context';
|
|
|
20
13
|
host: {
|
|
21
14
|
'[attr.data-placeholder]': '!context?.value() ? "" : null',
|
|
22
15
|
'data-slot': 'select-value',
|
|
16
|
+
class: 'flex-1 truncate text-left',
|
|
23
17
|
},
|
|
24
18
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
19
|
})
|
|
26
20
|
export class SelectValue {
|
|
27
|
-
protected readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
28
|
-
|
|
29
|
-
/** Placeholder text when no value is selected */
|
|
30
|
-
readonly placeholder = input<string>('');
|
|
31
|
-
|
|
32
21
|
constructor() {
|
|
33
22
|
// Update context placeholder on init and changes
|
|
34
23
|
effect(() => {
|
|
@@ -38,6 +27,11 @@ export class SelectValue {
|
|
|
38
27
|
});
|
|
39
28
|
}
|
|
40
29
|
|
|
30
|
+
/** Placeholder text when no value is selected */
|
|
31
|
+
readonly placeholder = input<string>('');
|
|
32
|
+
|
|
33
|
+
protected readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
34
|
+
|
|
41
35
|
/** Computed display value */
|
|
42
36
|
protected readonly displayValue = computed(() => {
|
|
43
37
|
const label = this.context?.selectedLabel();
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import { AriaIdService } from '@/lib/utils/accessibility';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
Component,
|
|
6
|
+
computed,
|
|
7
|
+
effect,
|
|
8
|
+
ElementRef,
|
|
9
|
+
forwardRef,
|
|
10
|
+
inject,
|
|
11
|
+
input,
|
|
12
|
+
model,
|
|
13
|
+
output,
|
|
14
|
+
signal,
|
|
15
15
|
} from '@angular/core';
|
|
16
16
|
import { SELECT_CONTEXT, type SelectContext } from './select-context';
|
|
17
17
|
|
|
18
|
-
// ============================================================================
|
|
19
|
-
// Types
|
|
20
|
-
// ============================================================================
|
|
21
|
-
|
|
22
18
|
export type SelectState = 'open' | 'closed';
|
|
23
19
|
|
|
24
20
|
/**
|
|
@@ -46,10 +42,6 @@ export interface SelectProps {
|
|
|
46
42
|
class?: string;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
// ============================================================================
|
|
50
|
-
// Component
|
|
51
|
-
// ============================================================================
|
|
52
|
-
|
|
53
45
|
/**
|
|
54
46
|
* @component Select
|
|
55
47
|
*
|
|
@@ -159,44 +151,64 @@ export interface SelectProps {
|
|
|
159
151
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
160
152
|
})
|
|
161
153
|
export class Select {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
154
|
+
constructor() {
|
|
155
|
+
// Sync value input to internal signal
|
|
156
|
+
effect(() => {
|
|
157
|
+
this._value.set(this.value());
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// Sync open input to internal signal
|
|
161
|
+
effect(() => {
|
|
162
|
+
this._isOpen.set(this.open());
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// Sync disabled input to internal signal
|
|
166
|
+
effect(() => {
|
|
167
|
+
this._isDisabled.set(this.disabled());
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Event handler called when the value changes */
|
|
172
|
+
readonly valueChange = output<string>();
|
|
173
|
+
/** Event handler called when the open state changes */
|
|
174
|
+
readonly openChange = output<boolean>();
|
|
165
175
|
|
|
166
176
|
/** The controlled value of the select */
|
|
167
177
|
readonly value = model<string>('');
|
|
168
|
-
|
|
169
178
|
/** The controlled open state of the select */
|
|
170
179
|
readonly open = model<boolean>(false);
|
|
171
180
|
|
|
172
181
|
/** When true, prevents the user from interacting with select */
|
|
173
182
|
readonly disabled = input<boolean>(false);
|
|
174
|
-
|
|
175
183
|
/** The name of the select for form submission */
|
|
176
184
|
readonly name = input<string>('');
|
|
177
|
-
|
|
178
185
|
/** When true, indicates that the user must select a value */
|
|
179
186
|
readonly required = input<boolean>(false);
|
|
180
|
-
|
|
181
187
|
/** Additional CSS classes */
|
|
182
188
|
readonly class = input<string>('');
|
|
183
189
|
|
|
184
|
-
|
|
185
|
-
readonly
|
|
190
|
+
private readonly _elementRef = inject(ElementRef<HTMLElement>);
|
|
191
|
+
private readonly _ariaIdService = inject(AriaIdService);
|
|
186
192
|
|
|
187
|
-
/**
|
|
188
|
-
readonly
|
|
193
|
+
/** Computed class combining base styles and custom classes */
|
|
194
|
+
protected readonly computedClass = computed(() => cn('relative block w-full', this.class()));
|
|
189
195
|
|
|
190
196
|
/** Internal signals for context */
|
|
191
197
|
private readonly _value = signal<string>('');
|
|
192
|
-
private readonly
|
|
193
|
-
private readonly
|
|
198
|
+
private readonly _isOpen = signal<boolean>(false);
|
|
199
|
+
private readonly _isDisabled = signal<boolean>(false);
|
|
194
200
|
|
|
201
|
+
private readonly ariaIds = this._ariaIdService.generateMenuIds('select');
|
|
195
202
|
/** Context for child components */
|
|
196
203
|
readonly context: SelectContext = {
|
|
197
204
|
value: this._value,
|
|
198
|
-
open: this.
|
|
199
|
-
|
|
205
|
+
open: this._isOpen,
|
|
206
|
+
setOpen: (open: boolean) => {
|
|
207
|
+
this._isOpen.set(open);
|
|
208
|
+
this.open.set(open);
|
|
209
|
+
this.openChange.emit(open);
|
|
210
|
+
},
|
|
211
|
+
disabled: this._isDisabled,
|
|
200
212
|
placeholder: signal(''),
|
|
201
213
|
selectedLabel: signal(''),
|
|
202
214
|
contentId: this.ariaIds.contentId,
|
|
@@ -212,9 +224,7 @@ export class Select {
|
|
|
212
224
|
if (label) {
|
|
213
225
|
this.context.selectedLabel.set(label);
|
|
214
226
|
}
|
|
215
|
-
this.
|
|
216
|
-
this.open.set(false);
|
|
217
|
-
this.openChange.emit(false);
|
|
227
|
+
this.context.setOpen(false);
|
|
218
228
|
// Restore focus to trigger
|
|
219
229
|
const trigger = this.context.triggerElement();
|
|
220
230
|
if (trigger) {
|
|
@@ -224,40 +234,18 @@ export class Select {
|
|
|
224
234
|
focusItem: (index: number) => this.focusItemByIndex(index),
|
|
225
235
|
};
|
|
226
236
|
|
|
227
|
-
/** Computed class combining base styles and custom classes */
|
|
228
|
-
protected readonly computedClass = computed(() =>
|
|
229
|
-
cn('relative inline-block', this.class())
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
constructor() {
|
|
233
|
-
// Sync value input to internal signal
|
|
234
|
-
effect(() => {
|
|
235
|
-
this._value.set(this.value());
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
// Sync open input to internal signal
|
|
239
|
-
effect(() => {
|
|
240
|
-
this._open.set(this.open());
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
// Sync disabled input to internal signal
|
|
244
|
-
effect(() => {
|
|
245
|
-
this._disabled.set(this.disabled());
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
237
|
/** Focus an item by index */
|
|
250
238
|
private focusItemByIndex(index: number): void {
|
|
251
239
|
const values = this.context.itemValues();
|
|
252
240
|
if (index < 0 || index >= values.length) return;
|
|
253
241
|
|
|
254
242
|
this.context.focusedIndex.set(index);
|
|
255
|
-
const
|
|
256
|
-
const
|
|
257
|
-
`[data-slot="select-item"][data-value="${
|
|
243
|
+
const targetValue = values[index];
|
|
244
|
+
const selectItem = this._elementRef.nativeElement.querySelector(
|
|
245
|
+
`[data-slot="select-item"][data-value="${targetValue}"]`,
|
|
258
246
|
) as HTMLElement;
|
|
259
|
-
if (
|
|
260
|
-
|
|
247
|
+
if (selectItem) {
|
|
248
|
+
selectItem.focus();
|
|
261
249
|
}
|
|
262
250
|
}
|
|
263
251
|
}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
input,
|
|
7
|
-
} from '@angular/core';
|
|
8
|
-
|
|
9
|
-
// ============================================================================
|
|
10
|
-
// Types
|
|
11
|
-
// ============================================================================
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
12
3
|
|
|
13
4
|
export type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
14
5
|
|
|
@@ -25,10 +16,6 @@ export type SeparatorProps = {
|
|
|
25
16
|
class?: string;
|
|
26
17
|
};
|
|
27
18
|
|
|
28
|
-
// ============================================================================
|
|
29
|
-
// Separator Component
|
|
30
|
-
// ============================================================================
|
|
31
|
-
|
|
32
19
|
/**
|
|
33
20
|
* Separator component creates a visual divider between content.
|
|
34
21
|
* Based on Radix UI Separator primitive with shadcn/ui styling.
|
|
@@ -99,9 +86,7 @@ export class Separator {
|
|
|
99
86
|
readonly class = input<string>('');
|
|
100
87
|
|
|
101
88
|
/** Computed role - none for decorative, separator otherwise */
|
|
102
|
-
protected readonly role = computed(() =>
|
|
103
|
-
this.decorative() ? 'none' : 'separator'
|
|
104
|
-
);
|
|
89
|
+
protected readonly role = computed(() => (this.decorative() ? 'none' : 'separator'));
|
|
105
90
|
|
|
106
91
|
/**
|
|
107
92
|
* aria-orientation is only needed for non-decorative separators.
|
|
@@ -122,7 +107,7 @@ export class Separator {
|
|
|
122
107
|
// Orientation-specific styles
|
|
123
108
|
this.orientation() === 'horizontal' ? 'h-px w-full' : 'h-full w-px',
|
|
124
109
|
// Custom classes
|
|
125
|
-
this.class()
|
|
126
|
-
)
|
|
110
|
+
this.class(),
|
|
111
|
+
),
|
|
127
112
|
);
|
|
128
113
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
inject,
|
|
5
|
-
input,
|
|
6
|
-
} from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';
|
|
7
2
|
import { SHEET_CONTEXT } from './sheet-context';
|
|
8
3
|
|
|
9
4
|
/**
|
|
@@ -14,17 +9,18 @@ import { SHEET_CONTEXT } from './sheet-context';
|
|
|
14
9
|
selector: 'SheetClose',
|
|
15
10
|
template: `<ng-content />`,
|
|
16
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"sheet-close"',
|
|
17
13
|
class: 'contents',
|
|
18
14
|
'(click)': 'onClick($event)',
|
|
19
15
|
},
|
|
20
16
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
17
|
})
|
|
22
18
|
export class SheetClose {
|
|
23
|
-
protected readonly context = inject(SHEET_CONTEXT);
|
|
24
|
-
|
|
25
19
|
/** Render as child */
|
|
26
20
|
readonly asChild = input<boolean>(false);
|
|
27
21
|
|
|
22
|
+
protected readonly context = inject(SHEET_CONTEXT);
|
|
23
|
+
|
|
28
24
|
onClick(event: Event): void {
|
|
29
25
|
event.stopPropagation();
|
|
30
26
|
this.context.setOpen(false);
|