@ng-cn/core 1.0.16 → 1.0.18
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 +6 -5
- package/src/app/lib/components/ui/accordion/accordion-content.component.ts +11 -14
- package/src/app/lib/components/ui/accordion/accordion-context.ts +1 -0
- package/src/app/lib/components/ui/accordion/accordion-item.component.ts +8 -0
- package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +5 -1
- package/src/app/lib/components/ui/accordion/accordion.component.ts +24 -6
- package/src/app/lib/components/ui/alert/alert-variants.ts +18 -4
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +1 -1
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +34 -17
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +4 -0
- package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +1 -0
- package/src/app/lib/components/ui/avatar/avatar-context.ts +9 -0
- package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +6 -9
- package/src/app/lib/components/ui/avatar/avatar-image.component.ts +40 -11
- package/src/app/lib/components/ui/avatar/avatar.component.ts +18 -13
- package/src/app/lib/components/ui/avatar/index.ts +1 -0
- package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +13 -20
- package/src/app/lib/components/ui/badge/badge-variants.ts +1 -1
- package/src/app/lib/components/ui/badge/badge.component.ts +1 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +1 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +4 -11
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +1 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +20 -24
- package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +1 -0
- package/src/app/lib/components/ui/button/button-variants.ts +3 -3
- package/src/app/lib/components/ui/button/button.component.ts +1 -0
- package/src/app/lib/components/ui/button-group/button-group.component.ts +1 -0
- package/src/app/lib/components/ui/calendar/calendar.component.ts +5 -1
- package/src/app/lib/components/ui/carousel/carousel-content.component.ts +1 -0
- package/src/app/lib/components/ui/carousel/carousel-item.component.ts +1 -0
- package/src/app/lib/components/ui/carousel/carousel-next.component.ts +1 -0
- package/src/app/lib/components/ui/carousel/carousel-previous.component.ts +1 -0
- package/src/app/lib/components/ui/carousel/carousel.component.ts +1 -0
- package/src/app/lib/components/ui/chart/chart-container.component.ts +1 -0
- package/src/app/lib/components/ui/chart/chart-legend-content.component.ts +1 -0
- package/src/app/lib/components/ui/chart/chart-legend.component.ts +5 -5
- package/src/app/lib/components/ui/chart/chart-tooltip-content.component.ts +5 -5
- package/src/app/lib/components/ui/chart/chart-tooltip.component.ts +5 -5
- package/src/app/lib/components/ui/chart/chart.component.ts +1 -0
- package/src/app/lib/components/ui/checkbox/checkbox.component.ts +1 -1
- package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +3 -1
- package/src/app/lib/components/ui/collapsible/collapsible-context.ts +1 -0
- package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +2 -0
- package/src/app/lib/components/ui/collapsible/collapsible.component.ts +4 -0
- package/src/app/lib/components/ui/combobox/combobox-content.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-group.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-input.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-item.component.ts +1 -4
- package/src/app/lib/components/ui/combobox/combobox-list.component.ts +1 -1
- package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-value.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox.component.ts +1 -1
- package/src/app/lib/components/ui/command/command-dialog.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-empty.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-group.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-input.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-item.component.ts +2 -1
- package/src/app/lib/components/ui/command/command-list.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-separator.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-shortcut.component.ts +1 -0
- package/src/app/lib/components/ui/command/command.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +49 -17
- package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +2 -1
- package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +3 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +32 -2
- package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +4 -0
- package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-content.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-search.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table.component.ts +1 -1
- package/src/app/lib/components/ui/date-picker/date-picker.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-close.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-content.component.ts +32 -21
- package/src/app/lib/components/ui/dialog/dialog-description.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-header.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-title.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog.component.ts +1 -0
- package/src/app/lib/components/ui/direction/direction-context.ts +9 -0
- package/src/app/lib/components/ui/direction/direction.component.ts +48 -0
- package/src/app/lib/components/ui/direction/index.ts +2 -0
- package/src/app/lib/components/ui/drawer/drawer-close.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-content.component.ts +45 -0
- package/src/app/lib/components/ui/drawer/drawer-description.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-header.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-title.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer.component.ts +4 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +3 -2
- 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 +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +2 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +3 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +30 -3
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +4 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +26 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +1 -0
- package/src/app/lib/components/ui/empty/empty-action.component.ts +1 -0
- package/src/app/lib/components/ui/empty/empty-description.component.ts +1 -0
- package/src/app/lib/components/ui/empty/empty-icon.component.ts +2 -1
- package/src/app/lib/components/ui/empty/empty-title.component.ts +1 -0
- package/src/app/lib/components/ui/empty/empty.component.ts +1 -0
- package/src/app/lib/components/ui/form/form-description.component.ts +2 -2
- package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +109 -60
- package/src/app/lib/components/ui/hover-card/hover-card-context.ts +4 -2
- package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +6 -3
- package/src/app/lib/components/ui/hover-card/hover-card.component.ts +9 -3
- package/src/app/lib/components/ui/input-group/input-group-addon.component.ts +1 -0
- package/src/app/lib/components/ui/input-group/input-group-input.component.ts +1 -0
- package/src/app/lib/components/ui/input-group/input-group.component.ts +1 -0
- package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +1 -0
- package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +1 -0
- package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +1 -0
- package/src/app/lib/components/ui/input-otp/input-otp.component.ts +1 -0
- package/src/app/lib/components/ui/kbd/kbd.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-content.component.ts +2 -1
- package/src/app/lib/components/ui/menubar/menubar-item.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-label.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar.component.ts +1 -0
- package/src/app/lib/components/ui/native-select/native-select.component.ts +1 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +8 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-context.ts +14 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +10 -4
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +70 -2
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +36 -4
- package/src/app/lib/components/ui/pagination/pagination-content.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-item.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-link.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-next.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination.component.ts +4 -1
- package/src/app/lib/components/ui/popover/popover-anchor.component.ts +1 -0
- package/src/app/lib/components/ui/popover/popover-content.component.ts +12 -0
- package/src/app/lib/components/ui/popover/popover-context.ts +2 -0
- package/src/app/lib/components/ui/popover/popover-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/popover/popover.component.ts +5 -0
- package/src/app/lib/components/ui/progress/progress.component.ts +1 -2
- package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +1 -0
- package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +1 -0
- package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +1 -0
- package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +8 -6
- package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +1 -0
- package/src/app/lib/components/ui/segmented/segmented-item.component.ts +1 -0
- package/src/app/lib/components/ui/segmented/segmented.component.ts +1 -0
- package/src/app/lib/components/ui/select/select-content.component.ts +38 -17
- package/src/app/lib/components/ui/select/select-context.ts +10 -0
- package/src/app/lib/components/ui/select/select-item.component.ts +25 -7
- package/src/app/lib/components/ui/select/select-trigger.component.ts +6 -13
- package/src/app/lib/components/ui/select/select.component.ts +46 -0
- package/src/app/lib/components/ui/sheet/sheet-close.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-content.component.ts +23 -5
- package/src/app/lib/components/ui/sheet/sheet-description.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-header.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-title.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet.component.ts +4 -0
- package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar.component.ts +1 -0
- package/src/app/lib/components/ui/slider/slider.component.ts +2 -2
- package/src/app/lib/components/ui/sonner/index.ts +2 -0
- package/src/app/lib/components/ui/sonner/sonner.component.ts +70 -0
- package/src/app/lib/components/ui/spinner/spinner.component.ts +1 -0
- package/src/app/lib/components/ui/switch/switch.component.ts +1 -14
- package/src/app/lib/components/ui/table/table-body.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-caption.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-cell.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-footer.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-head.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-header.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-row.component.ts +1 -0
- package/src/app/lib/components/ui/table/table.component.ts +1 -0
- package/src/app/lib/components/ui/tabs/tabs-content.component.ts +3 -6
- package/src/app/lib/components/ui/tabs/tabs-list.component.ts +19 -0
- package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +1 -1
- package/src/app/lib/components/ui/tabs/tabs.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toast-action.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toast-description.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toast-title.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toast.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toaster.component.ts +1 -0
- package/src/app/lib/components/ui/toggle/toggle-variants.ts +1 -1
- package/src/app/lib/components/ui/toggle/toggle.component.ts +12 -6
- package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +142 -17
- package/src/app/lib/components/ui/tooltip/tooltip-context.ts +3 -1
- package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +5 -1
- package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +6 -2
- package/src/app/lib/components/ui/tooltip/tooltip.component.ts +4 -1
- package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-h1.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-h2.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-h3.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-h4.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-large.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-lead.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-list.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-muted.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-p.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-small.component.ts +1 -0
|
@@ -57,7 +57,7 @@ import { SELECT_CONTEXT } from './select-context';
|
|
|
57
57
|
`,
|
|
58
58
|
host: {
|
|
59
59
|
class: 'contents',
|
|
60
|
-
'data-slot': 'select-trigger',
|
|
60
|
+
'attr.data-slot': '"select-trigger"',
|
|
61
61
|
},
|
|
62
62
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
63
63
|
})
|
|
@@ -114,35 +114,28 @@ export class SelectTrigger {
|
|
|
114
114
|
case 'ArrowDown':
|
|
115
115
|
event.preventDefault();
|
|
116
116
|
if (!this.context.open()) {
|
|
117
|
-
// Save trigger element
|
|
118
117
|
const button = this.triggerButton()?.nativeElement;
|
|
119
|
-
if (button)
|
|
120
|
-
this.context.triggerElement.set(button);
|
|
121
|
-
}
|
|
118
|
+
if (button) this.context.triggerElement.set(button);
|
|
122
119
|
this.context.setOpen(true);
|
|
123
120
|
setTimeout(() => this.context?.focusItem(0));
|
|
124
121
|
} else {
|
|
125
|
-
// Move to next item
|
|
126
122
|
const currentIndex = this.context.focusedIndex();
|
|
127
123
|
const itemCount = this.context.itemValues().length;
|
|
128
|
-
this.context.focusItem(
|
|
124
|
+
this.context.focusItem((currentIndex + 1) % itemCount);
|
|
129
125
|
}
|
|
130
126
|
break;
|
|
131
127
|
case 'ArrowUp':
|
|
132
128
|
event.preventDefault();
|
|
133
129
|
if (!this.context.open()) {
|
|
134
|
-
// Save trigger element
|
|
135
130
|
const button = this.triggerButton()?.nativeElement;
|
|
136
|
-
if (button)
|
|
137
|
-
this.context.triggerElement.set(button);
|
|
138
|
-
}
|
|
131
|
+
if (button) this.context.triggerElement.set(button);
|
|
139
132
|
this.context.setOpen(true);
|
|
140
133
|
const lastIndex = this.context.itemValues().length - 1;
|
|
141
134
|
setTimeout(() => this.context?.focusItem(lastIndex));
|
|
142
135
|
} else {
|
|
143
|
-
// Move to previous item
|
|
144
136
|
const currentIndex = this.context.focusedIndex();
|
|
145
|
-
this.context.
|
|
137
|
+
const itemCount = this.context.itemValues().length;
|
|
138
|
+
this.context.focusItem(currentIndex > 0 ? currentIndex - 1 : itemCount - 1);
|
|
146
139
|
}
|
|
147
140
|
break;
|
|
148
141
|
case 'Escape':
|
|
@@ -199,6 +199,11 @@ export class Select {
|
|
|
199
199
|
private readonly _isDisabled = signal<boolean>(false);
|
|
200
200
|
|
|
201
201
|
private readonly ariaIds = this._ariaIdService.generateMenuIds('select');
|
|
202
|
+
/** Internal typeahead signals */
|
|
203
|
+
private readonly _itemLabels = signal<Map<string, string>>(new Map());
|
|
204
|
+
private readonly _typeaheadBuffer = signal<string>('');
|
|
205
|
+
private readonly _typeaheadTimeout = signal<ReturnType<typeof setTimeout> | null>(null);
|
|
206
|
+
|
|
202
207
|
/** Context for child components */
|
|
203
208
|
readonly context: SelectContext = {
|
|
204
209
|
value: this._value,
|
|
@@ -232,6 +237,11 @@ export class Select {
|
|
|
232
237
|
}
|
|
233
238
|
},
|
|
234
239
|
focusItem: (index: number) => this.focusItemByIndex(index),
|
|
240
|
+
itemLabels: this._itemLabels,
|
|
241
|
+
typeaheadBuffer: this._typeaheadBuffer,
|
|
242
|
+
typeaheadTimeout: this._typeaheadTimeout,
|
|
243
|
+
handleTypeahead: (char: string) => this.handleTypeahead(char),
|
|
244
|
+
focusMatchingItem: (query: string) => this.focusMatchingItem(query),
|
|
235
245
|
};
|
|
236
246
|
|
|
237
247
|
/** Focus an item by index */
|
|
@@ -248,4 +258,40 @@ export class Select {
|
|
|
248
258
|
selectItem.focus();
|
|
249
259
|
}
|
|
250
260
|
}
|
|
261
|
+
|
|
262
|
+
/** Handle typeahead: accumulate char, clear after 500 ms, then focus matching item */
|
|
263
|
+
private handleTypeahead(char: string): void {
|
|
264
|
+
// Clear existing timeout
|
|
265
|
+
const existingTimeout = this._typeaheadTimeout();
|
|
266
|
+
if (existingTimeout !== null) {
|
|
267
|
+
clearTimeout(existingTimeout);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const newBuffer = this._typeaheadBuffer() + char;
|
|
271
|
+
this._typeaheadBuffer.set(newBuffer);
|
|
272
|
+
|
|
273
|
+
const timeout = setTimeout(() => {
|
|
274
|
+
this._typeaheadBuffer.set('');
|
|
275
|
+
this._typeaheadTimeout.set(null);
|
|
276
|
+
}, 500);
|
|
277
|
+
this._typeaheadTimeout.set(timeout);
|
|
278
|
+
|
|
279
|
+
this.focusMatchingItem(newBuffer);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** Focus the first item whose label starts with query (case-insensitive) */
|
|
283
|
+
private focusMatchingItem(query: string): void {
|
|
284
|
+
const values = this.context.itemValues();
|
|
285
|
+
const labels = this._itemLabels();
|
|
286
|
+
const lowerQuery = query.toLowerCase();
|
|
287
|
+
|
|
288
|
+
const matchIndex = values.findIndex((v) => {
|
|
289
|
+
const label = labels.get(v) ?? v;
|
|
290
|
+
return label.toLowerCase().startsWith(lowerQuery);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
if (matchIndex !== -1) {
|
|
294
|
+
this.focusItemByIndex(matchIndex);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
251
297
|
}
|
|
@@ -76,19 +76,28 @@ import { sheetVariants, type SheetVariants } from './sheet-variants';
|
|
|
76
76
|
</Presence>
|
|
77
77
|
`,
|
|
78
78
|
host: {
|
|
79
|
+
'attr.data-slot': '"sheet-content"',
|
|
79
80
|
class: 'contents',
|
|
80
81
|
},
|
|
81
82
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
82
83
|
})
|
|
83
84
|
export class SheetContent implements OnDestroy {
|
|
84
85
|
constructor() {
|
|
85
|
-
|
|
86
|
+
let wasOpen = false;
|
|
87
|
+
|
|
88
|
+
// Handle body scroll lock and focus restoration based on open state
|
|
86
89
|
effect(() => {
|
|
87
90
|
const isOpen = this.context.open();
|
|
88
91
|
if (isOpen) {
|
|
92
|
+
wasOpen = true;
|
|
89
93
|
this.lockBodyScroll();
|
|
90
94
|
} else {
|
|
91
95
|
this.unlockBodyScroll();
|
|
96
|
+
// Restore focus whenever sheet closes (covers close button, overlay, Escape, programmatic)
|
|
97
|
+
if (wasOpen) {
|
|
98
|
+
this.restoreFocus();
|
|
99
|
+
}
|
|
100
|
+
wasOpen = false;
|
|
92
101
|
}
|
|
93
102
|
});
|
|
94
103
|
}
|
|
@@ -104,13 +113,14 @@ export class SheetContent implements OnDestroy {
|
|
|
104
113
|
cn(sheetVariants({ side: this.side() }), this.class()),
|
|
105
114
|
);
|
|
106
115
|
|
|
107
|
-
/** Previous body overflow for restoration */
|
|
116
|
+
/** Previous body overflow/padding for restoration */
|
|
108
117
|
private previousBodyOverflow = '';
|
|
118
|
+
private previousBodyPaddingRight = '';
|
|
109
119
|
|
|
110
120
|
ngOnDestroy(): void {
|
|
111
121
|
// Restore body scroll
|
|
112
122
|
this.unlockBodyScroll();
|
|
113
|
-
// Restore focus to trigger element
|
|
123
|
+
// Restore focus to trigger element (fallback if not already called via effect)
|
|
114
124
|
this.restoreFocus();
|
|
115
125
|
}
|
|
116
126
|
|
|
@@ -119,7 +129,10 @@ export class SheetContent implements OnDestroy {
|
|
|
119
129
|
this.close();
|
|
120
130
|
}
|
|
121
131
|
onEscapeKey(): void {
|
|
122
|
-
|
|
132
|
+
// Guard: only close when the sheet is actually open (not during exit animation)
|
|
133
|
+
if (this.context.open()) {
|
|
134
|
+
this.close();
|
|
135
|
+
}
|
|
123
136
|
}
|
|
124
137
|
onClose(): void {
|
|
125
138
|
this.close();
|
|
@@ -127,17 +140,22 @@ export class SheetContent implements OnDestroy {
|
|
|
127
140
|
|
|
128
141
|
private lockBodyScroll(): void {
|
|
129
142
|
if (typeof document !== 'undefined') {
|
|
143
|
+
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
130
144
|
this.previousBodyOverflow = document.body.style.overflow;
|
|
145
|
+
this.previousBodyPaddingRight = document.body.style.paddingRight;
|
|
131
146
|
document.body.style.overflow = 'hidden';
|
|
147
|
+
if (scrollbarWidth > 0) {
|
|
148
|
+
document.body.style.paddingRight = scrollbarWidth + 'px';
|
|
149
|
+
}
|
|
132
150
|
}
|
|
133
151
|
}
|
|
134
152
|
private unlockBodyScroll(): void {
|
|
135
153
|
if (typeof document !== 'undefined') {
|
|
136
154
|
document.body.style.overflow = this.previousBodyOverflow;
|
|
155
|
+
document.body.style.paddingRight = this.previousBodyPaddingRight;
|
|
137
156
|
}
|
|
138
157
|
}
|
|
139
158
|
private close(): void {
|
|
140
|
-
this.restoreFocus();
|
|
141
159
|
this.context.setOpen(false);
|
|
142
160
|
}
|
|
143
161
|
private restoreFocus(): void {
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'SheetFooter',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"sheet-footer"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'SheetHeader',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"sheet-header"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -9,6 +9,7 @@ import { SHEET_CONTEXT } from './sheet-context';
|
|
|
9
9
|
selector: 'SheetTrigger',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"sheet-trigger"',
|
|
12
13
|
'(click)': 'onClick($event)',
|
|
13
14
|
'[attr.aria-haspopup]': '"dialog"',
|
|
14
15
|
'[attr.aria-expanded]': 'context.open()',
|
|
@@ -33,6 +33,10 @@ import { SHEET_CONTEXT, type SheetContextValue } from './sheet-context';
|
|
|
33
33
|
@Component({
|
|
34
34
|
selector: 'Sheet',
|
|
35
35
|
template: `<ng-content />`,
|
|
36
|
+
host: {
|
|
37
|
+
'attr.data-slot': '"sheet"',
|
|
38
|
+
style: 'display: contents',
|
|
39
|
+
},
|
|
36
40
|
providers: [
|
|
37
41
|
{
|
|
38
42
|
provide: SHEET_CONTEXT,
|
|
@@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
8
8
|
selector: 'SidebarGroupAction',
|
|
9
9
|
template: `<ng-content />`,
|
|
10
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"sidebar-group-action"',
|
|
11
12
|
'[class]': 'computedClass()',
|
|
12
13
|
'data-sidebar': 'group-action',
|
|
13
14
|
},
|
|
@@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
8
8
|
selector: 'SidebarGroupContent',
|
|
9
9
|
template: `<ng-content />`,
|
|
10
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"sidebar-group-content"',
|
|
11
12
|
'[class]': 'computedClass()',
|
|
12
13
|
'data-sidebar': 'group-content',
|
|
13
14
|
},
|
|
@@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
8
8
|
selector: 'SidebarGroupLabel',
|
|
9
9
|
template: `<ng-content />`,
|
|
10
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"sidebar-group-label"',
|
|
11
12
|
'[class]': 'computedClass()',
|
|
12
13
|
'data-sidebar': 'group-label',
|
|
13
14
|
},
|
|
@@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
8
8
|
selector: 'SidebarInset',
|
|
9
9
|
template: `<ng-content />`,
|
|
10
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"sidebar-inset"',
|
|
11
12
|
'[class]': 'computedClass()',
|
|
12
13
|
},
|
|
13
14
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -11,6 +11,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
11
11
|
selector: 'SidebarMenuAction',
|
|
12
12
|
template: `<ng-content />`,
|
|
13
13
|
host: {
|
|
14
|
+
'attr.data-slot': '"sidebar-menu-action"',
|
|
14
15
|
'[class]': 'computedClass()',
|
|
15
16
|
'data-sidebar': 'menu-action',
|
|
16
17
|
'[attr.role]': '"button"',
|
|
@@ -11,6 +11,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
11
11
|
selector: 'SidebarMenuBadge',
|
|
12
12
|
template: `<ng-content />`,
|
|
13
13
|
host: {
|
|
14
|
+
'attr.data-slot': '"sidebar-menu-badge"',
|
|
14
15
|
'[class]': 'computedClass()',
|
|
15
16
|
'data-sidebar': 'menu-badge',
|
|
16
17
|
},
|
|
@@ -12,6 +12,7 @@ import type { AriaCurrentValue } from './sidebar-context';
|
|
|
12
12
|
selector: 'SidebarMenuButton',
|
|
13
13
|
template: `<ng-content />`,
|
|
14
14
|
host: {
|
|
15
|
+
'attr.data-slot': '"sidebar-menu-button"',
|
|
15
16
|
'[class]': 'computedClass()',
|
|
16
17
|
'data-sidebar': 'menu-button',
|
|
17
18
|
'[attr.data-size]': 'size()',
|
|
@@ -11,6 +11,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
11
11
|
selector: 'SidebarMenuItem',
|
|
12
12
|
template: `<ng-content />`,
|
|
13
13
|
host: {
|
|
14
|
+
'attr.data-slot': '"sidebar-menu-item"',
|
|
14
15
|
'[class]': 'computedClass()',
|
|
15
16
|
'data-sidebar': 'menu-item',
|
|
16
17
|
'[attr.role]': '"presentation"',
|
|
@@ -12,6 +12,7 @@ import type { AriaCurrentValue } from './sidebar-context';
|
|
|
12
12
|
selector: 'SidebarMenuSubButton',
|
|
13
13
|
template: `<ng-content />`,
|
|
14
14
|
host: {
|
|
15
|
+
'attr.data-slot': '"sidebar-menu-sub-button"',
|
|
15
16
|
'[class]': 'computedClass()',
|
|
16
17
|
'data-sidebar': 'menu-sub-button',
|
|
17
18
|
'[attr.data-size]': 'size()',
|
|
@@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
8
8
|
selector: 'SidebarMenuSubItem',
|
|
9
9
|
template: `<ng-content />`,
|
|
10
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"sidebar-menu-sub-item"',
|
|
11
12
|
'[class]': 'computedClass()',
|
|
12
13
|
},
|
|
13
14
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -10,6 +10,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
10
10
|
selector: 'SidebarMenu',
|
|
11
11
|
template: `<ng-content />`,
|
|
12
12
|
host: {
|
|
13
|
+
'attr.data-slot': '"sidebar-menu"',
|
|
13
14
|
'[class]': 'computedClass()',
|
|
14
15
|
'data-sidebar': 'menu',
|
|
15
16
|
'[attr.role]': '"menu"',
|
|
@@ -346,10 +346,10 @@ export class Slider implements ControlValueAccessor {
|
|
|
346
346
|
newValue -= stepValue * increment;
|
|
347
347
|
break;
|
|
348
348
|
case 'ArrowUp':
|
|
349
|
-
newValue += stepValue;
|
|
349
|
+
newValue += stepValue * (this.inverted() ? -1 : 1);
|
|
350
350
|
break;
|
|
351
351
|
case 'ArrowDown':
|
|
352
|
-
newValue -= stepValue;
|
|
352
|
+
newValue -= stepValue * (this.inverted() ? -1 : 1);
|
|
353
353
|
break;
|
|
354
354
|
case 'PageUp':
|
|
355
355
|
newValue += largeStep;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
+
import { NgxSonnerToaster } from 'ngx-sonner';
|
|
3
|
+
|
|
4
|
+
export { toast } from 'ngx-sonner';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sonner component - toast notification toaster.
|
|
8
|
+
* Wraps ngx-sonner's Toaster with shadcn/ui default styling.
|
|
9
|
+
* Place once near the root of your app.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <!-- In app root template -->
|
|
13
|
+
* <Sonner />
|
|
14
|
+
*
|
|
15
|
+
* <!-- With custom position -->
|
|
16
|
+
* <Sonner position="top-right" />
|
|
17
|
+
*
|
|
18
|
+
* <!-- Then trigger toasts anywhere -->
|
|
19
|
+
* import { toast } from '@/lib/components/ui/sonner';
|
|
20
|
+
* toast('Hello world');
|
|
21
|
+
* toast.success('Saved!');
|
|
22
|
+
* toast.error('Something went wrong');
|
|
23
|
+
*/
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'Sonner',
|
|
26
|
+
imports: [NgxSonnerToaster],
|
|
27
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
|
+
host: {
|
|
29
|
+
'attr.data-slot': '"sonner"',
|
|
30
|
+
style: 'display: contents',
|
|
31
|
+
},
|
|
32
|
+
template: `
|
|
33
|
+
<ngx-sonner-toaster
|
|
34
|
+
[theme]="theme()"
|
|
35
|
+
[position]="position()"
|
|
36
|
+
[richColors]="richColors()"
|
|
37
|
+
[expand]="expand()"
|
|
38
|
+
[duration]="duration()"
|
|
39
|
+
[visibleToasts]="visibleToasts()"
|
|
40
|
+
[closeButton]="closeButton()"
|
|
41
|
+
[offset]="offset()"
|
|
42
|
+
[dir]="dir()"
|
|
43
|
+
[class]="toasterClass()"
|
|
44
|
+
/>
|
|
45
|
+
`,
|
|
46
|
+
})
|
|
47
|
+
export class Sonner {
|
|
48
|
+
/** Visual theme */
|
|
49
|
+
readonly theme = input<'light' | 'dark' | 'system'>('system');
|
|
50
|
+
/** Position of the toaster */
|
|
51
|
+
readonly position = input<
|
|
52
|
+
'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
|
|
53
|
+
>('bottom-right');
|
|
54
|
+
/** Use rich colors for success/error/warning/info */
|
|
55
|
+
readonly richColors = input<boolean>(false);
|
|
56
|
+
/** Expand toasts by default */
|
|
57
|
+
readonly expand = input<boolean>(false);
|
|
58
|
+
/** Default duration in ms */
|
|
59
|
+
readonly duration = input<number>(4000);
|
|
60
|
+
/** Max visible toasts */
|
|
61
|
+
readonly visibleToasts = input<number>(3);
|
|
62
|
+
/** Show close button on each toast */
|
|
63
|
+
readonly closeButton = input<boolean>(false);
|
|
64
|
+
/** Offset from edge */
|
|
65
|
+
readonly offset = input<string | number | null>(null);
|
|
66
|
+
/** Text direction */
|
|
67
|
+
readonly dir = input<'ltr' | 'rtl' | 'auto'>('auto');
|
|
68
|
+
/** Additional CSS classes passed to the toaster */
|
|
69
|
+
readonly toasterClass = input<string>('toaster group');
|
|
70
|
+
}
|
|
@@ -103,9 +103,7 @@ export type SwitchProps = {
|
|
|
103
103
|
[attr.data-disabled]="isDisabled() ? '' : null"
|
|
104
104
|
[disabled]="isDisabled()"
|
|
105
105
|
[class]="trackClass()"
|
|
106
|
-
[style.backgroundColor]="checked() ? checkedBgColor() : 'var(--color-input)'"
|
|
107
106
|
(click)="toggle()"
|
|
108
|
-
(keydown)="onKeyDown($event)"
|
|
109
107
|
>
|
|
110
108
|
<span data-slot="switch-thumb" [class]="thumbClass()" [attr.data-state]="state()"></span>
|
|
111
109
|
</button>
|
|
@@ -125,7 +123,7 @@ export type SwitchProps = {
|
|
|
125
123
|
`,
|
|
126
124
|
host: {
|
|
127
125
|
'[class]': 'computedClass()',
|
|
128
|
-
'data-slot': 'switch',
|
|
126
|
+
'attr.data-slot': '"switch"',
|
|
129
127
|
},
|
|
130
128
|
providers: [
|
|
131
129
|
{
|
|
@@ -168,9 +166,6 @@ export class Switch implements ControlValueAccessor {
|
|
|
168
166
|
readonly class = input<string>('');
|
|
169
167
|
/** Additional CSS classes to apply to the inner track button */
|
|
170
168
|
readonly buttonClass = input<string>('');
|
|
171
|
-
/** Background color for checked state (hex, rgb, or CSS color name) */
|
|
172
|
-
readonly checkedBgColor = input<string>('rgb(59, 130, 246)');
|
|
173
|
-
|
|
174
169
|
/** Current state for data attribute */
|
|
175
170
|
protected readonly state = computed(
|
|
176
171
|
(): SwitchState => (this.checked() ? 'checked' : 'unchecked'),
|
|
@@ -246,12 +241,4 @@ export class Switch implements ControlValueAccessor {
|
|
|
246
241
|
}
|
|
247
242
|
}
|
|
248
243
|
|
|
249
|
-
/** Handle keyboard events */
|
|
250
|
-
protected onKeyDown(event: KeyboardEvent): void {
|
|
251
|
-
// Switch should only respond to Space (Enter is handled by button default)
|
|
252
|
-
if (event.key === ' ') {
|
|
253
|
-
// Let the click handler deal with it
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
244
|
}
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'TableCell',
|
|
10
10
|
template: `<td [class]="computedClass()"><ng-content /></td>`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"table-cell"',
|
|
12
13
|
class: 'contents',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|