@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,12 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
effect,
|
|
7
|
-
inject,
|
|
8
|
-
input
|
|
9
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, effect, inject, input } from '@angular/core';
|
|
10
3
|
import { RESIZABLE_CONTEXT } from './resizable-context';
|
|
11
4
|
|
|
12
5
|
let panelIdCounter = 0;
|
|
@@ -24,6 +17,7 @@ let panelIdCounter = 0;
|
|
|
24
17
|
selector: 'ResizablePanel',
|
|
25
18
|
template: `<ng-content />`,
|
|
26
19
|
host: {
|
|
20
|
+
'attr.data-slot': '"resizable-panel"',
|
|
27
21
|
'[class]': 'computedClass()',
|
|
28
22
|
'[style.flex-basis.%]': 'currentSize()',
|
|
29
23
|
'[attr.data-panel]': 'true',
|
|
@@ -32,46 +26,33 @@ let panelIdCounter = 0;
|
|
|
32
26
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
33
27
|
})
|
|
34
28
|
export class ResizablePanel {
|
|
35
|
-
|
|
29
|
+
constructor() {
|
|
30
|
+
effect(() => {
|
|
31
|
+
this._context.registerPanel(this.panelId, this.minSize(), this.maxSize(), this.defaultSize());
|
|
32
|
+
});
|
|
33
|
+
}
|
|
36
34
|
|
|
37
35
|
/** Default size as percentage */
|
|
38
36
|
readonly defaultSize = input<number>(50);
|
|
39
|
-
|
|
40
37
|
/** Minimum size as percentage */
|
|
41
38
|
readonly minSize = input<number>(0);
|
|
42
|
-
|
|
43
39
|
/** Maximum size as percentage */
|
|
44
40
|
readonly maxSize = input<number>(100);
|
|
45
|
-
|
|
46
41
|
/** Collapsible */
|
|
47
42
|
readonly collapsible = input<boolean>(false);
|
|
48
|
-
|
|
49
43
|
/** Collapsed size when collapsible */
|
|
50
44
|
readonly collapsedSize = input<number>(0);
|
|
51
|
-
|
|
52
45
|
/** Additional CSS classes */
|
|
53
46
|
readonly class = input<string>('');
|
|
54
47
|
|
|
55
|
-
|
|
56
|
-
readonly panelId = `panel-${panelIdCounter++}`;
|
|
48
|
+
private readonly _context = inject(RESIZABLE_CONTEXT);
|
|
57
49
|
|
|
58
50
|
/** Current panel size */
|
|
59
51
|
readonly currentSize = computed(() => {
|
|
60
|
-
return this.
|
|
52
|
+
return this._context.getPanelSize(this.panelId);
|
|
61
53
|
});
|
|
54
|
+
protected readonly computedClass = computed(() => cn('flex-shrink-0 flex-grow-0', this.class()));
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.context.registerPanel(
|
|
66
|
-
this.panelId,
|
|
67
|
-
this.minSize(),
|
|
68
|
-
this.maxSize(),
|
|
69
|
-
this.defaultSize()
|
|
70
|
-
);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
protected readonly computedClass = computed(() =>
|
|
75
|
-
cn('flex-shrink-0 flex-grow-0', this.class())
|
|
76
|
-
);
|
|
56
|
+
/** Unique panel ID */
|
|
57
|
+
readonly panelId = `panel-${panelIdCounter++}`;
|
|
77
58
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
ScrollArea,
|
|
3
|
+
type ScrollAreaProps,
|
|
4
|
+
type ScrollAreaScrollbarVisibility,
|
|
5
|
+
type ScrollAreaType,
|
|
6
6
|
} from './scroll-area.component';
|
|
7
7
|
export { ScrollBar, type ScrollBarOrientation, type ScrollBarProps } from './scroll-bar.component';
|
|
8
|
-
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
import { CdkScrollable } from '@angular/cdk/scrolling';
|
|
3
|
-
import {
|
|
4
|
-
ChangeDetectionStrategy,
|
|
5
|
-
Component,
|
|
6
|
-
computed,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// Types
|
|
12
|
-
// ============================================================================
|
|
3
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
13
4
|
|
|
14
5
|
export type ScrollAreaType = 'auto' | 'always' | 'scroll' | 'hover';
|
|
15
6
|
export type ScrollAreaScrollbarVisibility = 'always' | 'scroll' | 'auto' | 'hover';
|
|
@@ -29,10 +20,6 @@ export interface ScrollAreaProps {
|
|
|
29
20
|
class?: string;
|
|
30
21
|
}
|
|
31
22
|
|
|
32
|
-
// ============================================================================
|
|
33
|
-
// Component
|
|
34
|
-
// ============================================================================
|
|
35
|
-
|
|
36
23
|
/**
|
|
37
24
|
* @component ScrollArea
|
|
38
25
|
*
|
|
@@ -97,6 +84,7 @@ export interface ScrollAreaProps {
|
|
|
97
84
|
<ng-content select="ScrollBar" />
|
|
98
85
|
`,
|
|
99
86
|
host: {
|
|
87
|
+
'attr.data-slot': '"scroll-area"',
|
|
100
88
|
'[class]': 'computedClass()',
|
|
101
89
|
},
|
|
102
90
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -108,9 +96,7 @@ export class ScrollArea {
|
|
|
108
96
|
/** Describes the nature of scrollbar visibility */
|
|
109
97
|
readonly type = input<ScrollAreaType>('hover');
|
|
110
98
|
|
|
111
|
-
protected readonly computedClass = computed(() =>
|
|
112
|
-
cn('relative overflow-hidden', this.class())
|
|
113
|
-
);
|
|
99
|
+
protected readonly computedClass = computed(() => cn('relative overflow-hidden', this.class()));
|
|
114
100
|
|
|
115
101
|
protected readonly viewportClass = computed(() =>
|
|
116
102
|
cn(
|
|
@@ -120,7 +106,7 @@ export class ScrollArea {
|
|
|
120
106
|
'[&::-webkit-scrollbar]:hidden',
|
|
121
107
|
'[-ms-overflow-style:none]',
|
|
122
108
|
'[scrollbar-width:none]',
|
|
123
|
-
'overflow-auto'
|
|
124
|
-
)
|
|
109
|
+
'overflow-auto',
|
|
110
|
+
),
|
|
125
111
|
);
|
|
126
112
|
}
|
|
@@ -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 ScrollBarOrientation = 'vertical' | 'horizontal';
|
|
14
5
|
|
|
@@ -23,10 +14,6 @@ export interface ScrollBarProps {
|
|
|
23
14
|
class?: string;
|
|
24
15
|
}
|
|
25
16
|
|
|
26
|
-
// ============================================================================
|
|
27
|
-
// Component
|
|
28
|
-
// ============================================================================
|
|
29
|
-
|
|
30
17
|
/**
|
|
31
18
|
* @component ScrollBar
|
|
32
19
|
*
|
|
@@ -57,10 +44,9 @@ export interface ScrollBarProps {
|
|
|
57
44
|
*/
|
|
58
45
|
@Component({
|
|
59
46
|
selector: 'ScrollBar',
|
|
60
|
-
template: `
|
|
61
|
-
<div [class]="thumbClass()"></div>
|
|
62
|
-
`,
|
|
47
|
+
template: ` <div [class]="thumbClass()"></div> `,
|
|
63
48
|
host: {
|
|
49
|
+
'attr.data-slot': '"scroll-bar"',
|
|
64
50
|
'[class]': 'computedClass()',
|
|
65
51
|
'[attr.data-orientation]': 'orientation()',
|
|
66
52
|
},
|
|
@@ -76,18 +62,13 @@ export class ScrollBar {
|
|
|
76
62
|
protected readonly computedClass = computed(() =>
|
|
77
63
|
cn(
|
|
78
64
|
'flex touch-none select-none transition-colors',
|
|
79
|
-
this.orientation() === 'vertical' &&
|
|
80
|
-
|
|
81
|
-
this.
|
|
82
|
-
|
|
83
|
-
this.class()
|
|
84
|
-
)
|
|
65
|
+
this.orientation() === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-[1px]',
|
|
66
|
+
this.orientation() === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-[1px]',
|
|
67
|
+
this.class(),
|
|
68
|
+
),
|
|
85
69
|
);
|
|
86
70
|
|
|
87
71
|
protected readonly thumbClass = computed(() =>
|
|
88
|
-
cn(
|
|
89
|
-
'relative rounded-full bg-border',
|
|
90
|
-
this.orientation() === 'vertical' && 'flex-1'
|
|
91
|
-
)
|
|
72
|
+
cn('relative rounded-full bg-border', this.orientation() === 'vertical' && 'flex-1'),
|
|
92
73
|
);
|
|
93
74
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
SEGMENTED_CONTEXT,
|
|
3
|
-
type SegmentedContext
|
|
4
|
-
} from './segmented-context';
|
|
1
|
+
export { SEGMENTED_CONTEXT, type SegmentedContext } from './segmented-context';
|
|
5
2
|
export { SegmentedItem } from './segmented-item.component';
|
|
6
3
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
segmentedItemVariants,
|
|
5
|
+
segmentedVariants,
|
|
6
|
+
type SegmentedItemVariants,
|
|
7
|
+
type SegmentedVariants,
|
|
11
8
|
} from './segmented-variants';
|
|
12
9
|
export { Segmented } from './segmented.component';
|
|
13
|
-
|
|
@@ -6,6 +6,4 @@ export interface SegmentedContext {
|
|
|
6
6
|
onValueChange: (value: string) => void;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const SEGMENTED_CONTEXT = new InjectionToken<SegmentedContext>(
|
|
10
|
-
'SegmentedContext'
|
|
11
|
-
);
|
|
9
|
+
export const SEGMENTED_CONTEXT = new InjectionToken<SegmentedContext>('SegmentedContext');
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
9
3
|
import { SEGMENTED_CONTEXT } from './segmented-context';
|
|
10
4
|
import { segmentedItemVariants } from './segmented-variants';
|
|
11
5
|
|
|
@@ -20,8 +14,9 @@ import { segmentedItemVariants } from './segmented-variants';
|
|
|
20
14
|
template: `<ng-content />`,
|
|
21
15
|
host: {
|
|
22
16
|
'[class]': 'computedClass()',
|
|
23
|
-
role: '
|
|
24
|
-
'[attr.aria-selected]': 'isSelected()',
|
|
17
|
+
'[attr.role]': 'itemRole()',
|
|
18
|
+
'[attr.aria-selected]': 'itemRole() === "tab" ? isSelected() : null',
|
|
19
|
+
'[attr.aria-pressed]': 'itemRole() === "button" ? isSelected() : null',
|
|
25
20
|
'[attr.data-state]': 'isSelected() ? "active" : "inactive"',
|
|
26
21
|
'[attr.disabled]': 'isDisabled() || null',
|
|
27
22
|
'[tabindex]': 'isDisabled() ? -1 : 0',
|
|
@@ -32,41 +27,38 @@ import { segmentedItemVariants } from './segmented-variants';
|
|
|
32
27
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
33
28
|
})
|
|
34
29
|
export class SegmentedItem {
|
|
35
|
-
private readonly context = inject(SEGMENTED_CONTEXT, { optional: true });
|
|
36
|
-
|
|
37
30
|
/** The value of this item */
|
|
38
31
|
readonly value = input.required<string>();
|
|
39
32
|
|
|
40
33
|
/** Whether this item is disabled */
|
|
41
34
|
readonly disabled = input<boolean>(false);
|
|
42
|
-
|
|
35
|
+
/** ARIA role to apply on the segmented item */
|
|
36
|
+
readonly role = input<'tab' | 'button'>('tab');
|
|
43
37
|
/** Additional CSS classes to apply */
|
|
44
38
|
readonly class = input<string>('');
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
protected readonly isSelected = computed(
|
|
48
|
-
() => this.context?.value() === this.value()
|
|
49
|
-
);
|
|
40
|
+
private readonly _context = inject(SEGMENTED_CONTEXT, { optional: true });
|
|
50
41
|
|
|
42
|
+
/** Whether this item is selected */
|
|
43
|
+
protected readonly isSelected = computed(() => this._context?.value() === this.value());
|
|
44
|
+
/** Effective ARIA role for this item */
|
|
45
|
+
protected readonly itemRole = computed(() => this.role());
|
|
51
46
|
/** Whether this item is disabled */
|
|
52
|
-
protected readonly isDisabled = computed(
|
|
53
|
-
() => this.disabled() || this.context?.disabled()
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
/** Handle click */
|
|
57
|
-
protected onClick(): void {
|
|
58
|
-
if (!this.isDisabled()) {
|
|
59
|
-
this.context?.onValueChange(this.value());
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
47
|
+
protected readonly isDisabled = computed(() => this.disabled() || this._context?.disabled());
|
|
63
48
|
/** Computed class combining variants and custom classes */
|
|
64
49
|
protected readonly computedClass = computed(() =>
|
|
65
50
|
cn(
|
|
66
51
|
segmentedItemVariants({
|
|
67
52
|
size: 'default',
|
|
68
53
|
}),
|
|
69
|
-
this.class()
|
|
70
|
-
)
|
|
54
|
+
this.class(),
|
|
55
|
+
),
|
|
71
56
|
);
|
|
57
|
+
|
|
58
|
+
/** Handle click */
|
|
59
|
+
protected onClick(): void {
|
|
60
|
+
if (!this.isDisabled()) {
|
|
61
|
+
this._context?.onValueChange(this.value());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
72
64
|
}
|
|
@@ -17,7 +17,7 @@ export const segmentedVariants = cva(
|
|
|
17
17
|
defaultVariants: {
|
|
18
18
|
size: 'default',
|
|
19
19
|
},
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
export const segmentedItemVariants = cva(
|
|
@@ -33,7 +33,7 @@ export const segmentedItemVariants = cva(
|
|
|
33
33
|
defaultVariants: {
|
|
34
34
|
size: 'default',
|
|
35
35
|
},
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
export type SegmentedVariants = VariantProps<typeof segmentedVariants>;
|
|
@@ -9,14 +9,8 @@ import {
|
|
|
9
9
|
model,
|
|
10
10
|
signal,
|
|
11
11
|
} from '@angular/core';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
type SegmentedContext,
|
|
15
|
-
} from './segmented-context';
|
|
16
|
-
import {
|
|
17
|
-
segmentedVariants,
|
|
18
|
-
type SegmentedVariants,
|
|
19
|
-
} from './segmented-variants';
|
|
12
|
+
import { SEGMENTED_CONTEXT, type SegmentedContext } from './segmented-context';
|
|
13
|
+
import { segmentedVariants, type SegmentedVariants } from './segmented-variants';
|
|
20
14
|
|
|
21
15
|
/**
|
|
22
16
|
* Segmented component - iOS-style segmented control buttons.
|
|
@@ -53,28 +47,6 @@ import {
|
|
|
53
47
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
54
48
|
})
|
|
55
49
|
export class Segmented {
|
|
56
|
-
/** The current selected value */
|
|
57
|
-
readonly value = model<string>('');
|
|
58
|
-
|
|
59
|
-
/** The size of the segmented control */
|
|
60
|
-
readonly size = input<SegmentedVariants['size']>('default');
|
|
61
|
-
|
|
62
|
-
/** Whether the segmented control is disabled */
|
|
63
|
-
readonly disabled = input<boolean>(false);
|
|
64
|
-
|
|
65
|
-
/** Additional CSS classes to apply */
|
|
66
|
-
readonly class = input<string>('');
|
|
67
|
-
|
|
68
|
-
/** Context for child SegmentedItem components */
|
|
69
|
-
readonly context: SegmentedContext = {
|
|
70
|
-
value: signal(this.value()),
|
|
71
|
-
disabled: signal(this.disabled()),
|
|
72
|
-
onValueChange: (newValue: string) => {
|
|
73
|
-
this.value.set(newValue);
|
|
74
|
-
this.context.value.set(newValue);
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
50
|
constructor() {
|
|
79
51
|
// Sync value changes to context
|
|
80
52
|
effect(() => {
|
|
@@ -87,13 +59,33 @@ export class Segmented {
|
|
|
87
59
|
});
|
|
88
60
|
}
|
|
89
61
|
|
|
62
|
+
/** The current selected value */
|
|
63
|
+
readonly value = model<string>('');
|
|
64
|
+
|
|
65
|
+
/** The size of the segmented control */
|
|
66
|
+
readonly size = input<SegmentedVariants['size']>('default');
|
|
67
|
+
/** Whether the segmented control is disabled */
|
|
68
|
+
readonly disabled = input<boolean>(false);
|
|
69
|
+
/** Additional CSS classes to apply */
|
|
70
|
+
readonly class = input<string>('');
|
|
71
|
+
|
|
90
72
|
/** Computed class combining variants and custom classes */
|
|
91
73
|
protected readonly computedClass = computed(() =>
|
|
92
74
|
cn(
|
|
93
75
|
segmentedVariants({
|
|
94
76
|
size: this.size(),
|
|
95
77
|
}),
|
|
96
|
-
this.class()
|
|
97
|
-
)
|
|
78
|
+
this.class(),
|
|
79
|
+
),
|
|
98
80
|
);
|
|
81
|
+
|
|
82
|
+
/** Context for child SegmentedItem components */
|
|
83
|
+
readonly context: SegmentedContext = {
|
|
84
|
+
value: signal(this.value()),
|
|
85
|
+
disabled: signal(this.disabled()),
|
|
86
|
+
onValueChange: (newValue: string) => {
|
|
87
|
+
this.value.set(newValue);
|
|
88
|
+
this.context.value.set(newValue);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
99
91
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Context and types
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
SELECT_CONTEXT,
|
|
4
|
+
SELECT_GROUP_CONTEXT,
|
|
5
|
+
type SelectContext,
|
|
6
|
+
type SelectGroupContext,
|
|
7
|
+
type SelectPosition,
|
|
8
8
|
} from './select-context';
|
|
9
9
|
|
|
10
10
|
// Components and their types
|
|
@@ -16,4 +16,3 @@ export { SelectSeparator } from './select-separator.component';
|
|
|
16
16
|
export { SelectTrigger } from './select-trigger.component';
|
|
17
17
|
export { SelectValue } from './select-value.component';
|
|
18
18
|
export { Select, type SelectProps, type SelectState } from './select.component';
|
|
19
|
-
|
|
@@ -1,97 +1,69 @@
|
|
|
1
|
-
import { cn
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
ChangeDetectionStrategy,
|
|
5
|
-
Component,
|
|
6
|
-
computed,
|
|
7
|
-
inject,
|
|
8
|
-
input,
|
|
9
|
-
} from '@angular/core';
|
|
1
|
+
import { cn } from '@/lib/utils';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
10
3
|
import { SELECT_CONTEXT } from './select-context';
|
|
11
4
|
|
|
12
5
|
/**
|
|
13
6
|
* SelectContent component - the dropdown content container.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* <SelectContent>
|
|
18
|
-
* <SelectItem value="option1">Option 1</SelectItem>
|
|
19
|
-
* <SelectItem value="option2">Option 2</SelectItem>
|
|
20
|
-
* </SelectContent>
|
|
7
|
+
* Uses simple absolute positioning inside the Select root for reliable
|
|
8
|
+
* full-width dropdown rendering in forms.
|
|
21
9
|
*/
|
|
22
10
|
@Component({
|
|
23
11
|
selector: 'SelectContent',
|
|
24
|
-
imports: [ClickOutsideDirective, Presence],
|
|
25
12
|
template: `
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<div [class]="viewportClass()">
|
|
39
|
-
<ng-content />
|
|
40
|
-
</div>
|
|
13
|
+
<div
|
|
14
|
+
[class]="dropdownClass()"
|
|
15
|
+
[attr.id]="context?.contentId"
|
|
16
|
+
[attr.data-state]="context?.open() ? 'open' : 'closed'"
|
|
17
|
+
[attr.data-side]="side()"
|
|
18
|
+
[attr.data-align]="align()"
|
|
19
|
+
role="listbox"
|
|
20
|
+
aria-label="Options"
|
|
21
|
+
(keydown.escape)="onEscape()"
|
|
22
|
+
>
|
|
23
|
+
<div [class]="viewportClass()">
|
|
24
|
+
<ng-content />
|
|
41
25
|
</div>
|
|
42
|
-
</
|
|
26
|
+
</div>
|
|
43
27
|
`,
|
|
44
28
|
host: {
|
|
45
|
-
|
|
29
|
+
class: 'contents',
|
|
46
30
|
'data-slot': 'select-content',
|
|
47
31
|
},
|
|
48
32
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
49
33
|
})
|
|
50
34
|
export class SelectContent {
|
|
51
|
-
protected readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
52
|
-
|
|
53
35
|
/** The side of the trigger to show the content */
|
|
54
36
|
readonly side = input<'top' | 'bottom'>('bottom');
|
|
55
37
|
|
|
56
38
|
/** The alignment of the content */
|
|
57
39
|
readonly align = input<'start' | 'center' | 'end'>('start');
|
|
58
|
-
|
|
59
40
|
/** Position strategy */
|
|
60
41
|
readonly position = input<'popper' | 'item-aligned'>('popper');
|
|
61
42
|
|
|
62
43
|
/** Additional CSS classes to apply */
|
|
63
44
|
readonly class = input<string>('');
|
|
64
45
|
|
|
65
|
-
protected
|
|
66
|
-
this.context?.open.set(false);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
protected onEscape(): void {
|
|
70
|
-
this.context?.open.set(false);
|
|
71
|
-
// Restore focus to trigger
|
|
72
|
-
const trigger = this.context?.triggerElement();
|
|
73
|
-
if (trigger) {
|
|
74
|
-
setTimeout(() => trigger.focus());
|
|
75
|
-
}
|
|
76
|
-
}
|
|
46
|
+
protected readonly context = inject(SELECT_CONTEXT, { optional: true });
|
|
77
47
|
|
|
78
48
|
/** Computed class combining base styles and custom classes */
|
|
79
49
|
protected readonly dropdownClass = computed(() =>
|
|
80
50
|
cn(
|
|
81
|
-
'bg-popover text-popover-foreground absolute z-50 mt-1
|
|
82
|
-
'data-[state=open]:animate-in data-[state=
|
|
83
|
-
'data-[
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
)
|
|
51
|
+
'bg-popover text-popover-foreground absolute left-0 top-full z-50 mt-1 w-full overflow-hidden rounded-md border shadow-md',
|
|
52
|
+
'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
|
|
53
|
+
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
|
|
54
|
+
'data-[state=closed]:pointer-events-none',
|
|
55
|
+
this.class(),
|
|
56
|
+
),
|
|
88
57
|
);
|
|
89
58
|
|
|
90
59
|
/** Viewport class */
|
|
91
|
-
protected readonly viewportClass = computed(() =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
)
|
|
96
|
-
|
|
60
|
+
protected readonly viewportClass = computed(() => cn('max-h-60 overflow-y-auto p-1'));
|
|
61
|
+
|
|
62
|
+
protected onEscape(): void {
|
|
63
|
+
this.context?.setOpen(false);
|
|
64
|
+
const trigger = this.context?.triggerElement();
|
|
65
|
+
if (trigger) {
|
|
66
|
+
setTimeout(() => trigger.focus());
|
|
67
|
+
}
|
|
68
|
+
}
|
|
97
69
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { InjectionToken, WritableSignal } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// Types
|
|
5
|
-
// ============================================================================
|
|
6
|
-
|
|
7
3
|
export type SelectPosition = 'popper' | 'item-aligned';
|
|
8
4
|
|
|
9
5
|
export interface SelectContext {
|
|
@@ -11,6 +7,8 @@ export interface SelectContext {
|
|
|
11
7
|
value: WritableSignal<string>;
|
|
12
8
|
/** Whether the select is open */
|
|
13
9
|
open: WritableSignal<boolean>;
|
|
10
|
+
/** Set the open state and emit related events */
|
|
11
|
+
setOpen: (open: boolean) => void;
|
|
14
12
|
/** Whether the select is disabled */
|
|
15
13
|
disabled: WritableSignal<boolean>;
|
|
16
14
|
/** Placeholder text when no value is selected */
|
|
@@ -40,14 +38,6 @@ export interface SelectGroupContext {
|
|
|
40
38
|
label: WritableSignal<string>;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
// Injection Tokens
|
|
45
|
-
// ============================================================================
|
|
46
|
-
|
|
47
|
-
export const SELECT_CONTEXT = new InjectionToken<SelectContext>(
|
|
48
|
-
'SelectContext'
|
|
49
|
-
);
|
|
41
|
+
export const SELECT_CONTEXT = new InjectionToken<SelectContext>('SelectContext');
|
|
50
42
|
|
|
51
|
-
export const SELECT_GROUP_CONTEXT = new InjectionToken<SelectGroupContext>(
|
|
52
|
-
'SelectGroupContext'
|
|
53
|
-
);
|
|
43
|
+
export const SELECT_GROUP_CONTEXT = new InjectionToken<SelectGroupContext>('SelectGroupContext');
|
|
@@ -24,7 +24,7 @@ import { SELECT_GROUP_CONTEXT, type SelectGroupContext } from './select-context'
|
|
|
24
24
|
template: `<ng-content />`,
|
|
25
25
|
host: {
|
|
26
26
|
'[class]': 'computedClass()',
|
|
27
|
-
|
|
27
|
+
role: 'group',
|
|
28
28
|
'[attr.aria-labelledby]': 'labelId()',
|
|
29
29
|
'data-slot': 'select-group',
|
|
30
30
|
},
|
|
@@ -40,17 +40,16 @@ import { SELECT_GROUP_CONTEXT, type SelectGroupContext } from './select-context'
|
|
|
40
40
|
export class SelectGroup {
|
|
41
41
|
/** Additional CSS classes to apply */
|
|
42
42
|
readonly class = input<string>('');
|
|
43
|
-
|
|
44
43
|
/** Label ID for accessibility */
|
|
45
44
|
readonly labelId = input<string>();
|
|
46
45
|
|
|
46
|
+
/** Computed class combining base styles and custom classes */
|
|
47
|
+
protected readonly computedClass = computed(() =>
|
|
48
|
+
cn('overflow-hidden p-1 text-foreground', this.class()),
|
|
49
|
+
);
|
|
50
|
+
|
|
47
51
|
/** Context for child components */
|
|
48
52
|
readonly context: SelectGroupContext = {
|
|
49
53
|
label: signal(''),
|
|
50
54
|
};
|
|
51
|
-
|
|
52
|
-
/** Computed class combining base styles and custom classes */
|
|
53
|
-
protected readonly computedClass = computed(() =>
|
|
54
|
-
cn('overflow-hidden p-1 text-foreground', this.class())
|
|
55
|
-
);
|
|
56
55
|
}
|