@ojiepermana/angular 22.1.11 → 22.1.12
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/README.md +32 -26
- package/chart/README.md +272 -0
- package/component/README.md +89 -0
- package/component/accordion/README.md +195 -0
- package/component/alert/README.md +184 -0
- package/component/alert-dialog/README.md +255 -0
- package/component/aspect-ratio/README.md +116 -0
- package/component/avatar/README.md +182 -0
- package/component/badge/README.md +143 -0
- package/component/breadcrumb/README.md +223 -0
- package/component/button/README.md +141 -0
- package/component/button-group/README.md +214 -0
- package/component/calendar/README.md +137 -0
- package/component/card/README.md +232 -0
- package/component/carousel/README.md +276 -0
- package/component/checkbox/README.md +153 -0
- package/component/collapsible/README.md +216 -0
- package/component/combobox/README.md +202 -0
- package/component/command/README.md +287 -0
- package/component/composer/README.md +241 -0
- package/component/context-menu/README.md +268 -0
- package/component/date-picker/README.md +202 -0
- package/component/dialog/README.md +276 -0
- package/component/drawer/README.md +147 -0
- package/component/dropdown-menu/README.md +336 -0
- package/component/editor/README.md +152 -0
- package/component/empty/README.md +193 -0
- package/component/form/README.md +216 -0
- package/component/hover-card/README.md +150 -0
- package/component/icon/README.md +25 -0
- package/component/input/README.md +160 -0
- package/component/input-group/README.md +245 -0
- package/component/input-otp/README.md +331 -0
- package/component/item/README.md +254 -0
- package/component/kanban/README.md +81 -0
- package/component/kbd/README.md +141 -0
- package/component/label/README.md +137 -0
- package/component/menubar/README.md +270 -0
- package/component/native-select/README.md +176 -0
- package/component/navigation-menu/README.md +165 -0
- package/component/pagination/README.md +151 -0
- package/component/pillbox/README.md +68 -0
- package/component/popover/README.md +54 -0
- package/component/progress/README.md +160 -0
- package/component/radio/README.md +212 -0
- package/component/resizable/README.md +178 -0
- package/component/scroll-area/README.md +150 -0
- package/component/select/README.md +228 -0
- package/component/separator/README.md +175 -0
- package/component/sheet/README.md +190 -0
- package/component/skeleton/README.md +158 -0
- package/component/slider/README.md +207 -0
- package/component/spinner/README.md +160 -0
- package/component/switch/README.md +170 -0
- package/component/table/README.md +292 -0
- package/component/tabs/README.md +220 -0
- package/component/textarea/README.md +169 -0
- package/component/timeline/README.md +94 -0
- package/component/toast/README.md +173 -0
- package/component/toggle/README.md +133 -0
- package/component/toggle-group/README.md +234 -0
- package/component/tooltip/README.md +230 -0
- package/fesm2022/ojiepermana-angular-chart-area.mjs +289 -3
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +722 -3
- package/fesm2022/ojiepermana-angular-chart-core.mjs +1482 -3
- package/fesm2022/ojiepermana-angular-chart-line.mjs +294 -3
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +291 -3
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1301 -3
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +421 -3
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +295 -3
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +306 -3
- package/fesm2022/ojiepermana-angular-chart.mjs +12 -3
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +267 -3
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-alert.mjs +101 -3
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-badge.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +192 -3
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +95 -3
- package/fesm2022/ojiepermana-angular-component-button.mjs +73 -3
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +718 -3
- package/fesm2022/ojiepermana-angular-component-card.mjs +167 -3
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +326 -3
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +190 -3
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +117 -3
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-command.mjs +351 -3
- package/fesm2022/ojiepermana-angular-component-composer.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +158 -3
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +482 -3
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +400 -3
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +1 -3
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +689 -3
- package/fesm2022/ojiepermana-angular-component-editor.mjs +511 -3
- package/fesm2022/ojiepermana-angular-component-empty.mjs +134 -3
- package/fesm2022/ojiepermana-angular-component-form.mjs +438 -3
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +273 -3
- package/fesm2022/ojiepermana-angular-component-icon.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +176 -3
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +550 -3
- package/fesm2022/ojiepermana-angular-component-input.mjs +52 -3
- package/fesm2022/ojiepermana-angular-component-item.mjs +264 -3
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +48 -3
- package/fesm2022/ojiepermana-angular-component-label.mjs +27 -3
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +378 -3
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +238 -3
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +999 -3
- package/fesm2022/ojiepermana-angular-component-popover.mjs +201 -3
- package/fesm2022/ojiepermana-angular-component-progress.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-radio.mjs +180 -3
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +493 -3
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +51 -3
- package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +227 -3
- package/fesm2022/ojiepermana-angular-component-select.mjs +609 -3
- package/fesm2022/ojiepermana-angular-component-separator.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +407 -3
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +25 -3
- package/fesm2022/ojiepermana-angular-component-slider.mjs +456 -3
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +56 -3
- package/fesm2022/ojiepermana-angular-component-switch.mjs +145 -3
- package/fesm2022/ojiepermana-angular-component-table.mjs +155 -3
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +315 -3
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +46 -3
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -3
- package/fesm2022/ojiepermana-angular-component-toast.mjs +241 -3
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +290 -3
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +76 -3
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +519 -3
- package/fesm2022/ojiepermana-angular-component-utils-core.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +34 -3
- package/fesm2022/ojiepermana-angular-component-utils.mjs +3 -2
- package/fesm2022/ojiepermana-angular-component.mjs +4 -4
- package/fesm2022/ojiepermana-angular-navigation-core.mjs +21 -3
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs +20 -3
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-CDBxQ8rk.mjs +91 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DBQHdvGa.mjs +512 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-entry-grid.component-Cd-jh6tg.mjs +623 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BCGvhoYj.mjs +404 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-Dk_03e-6.mjs +466 -0
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-DNKU6viC.mjs +2642 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +725 -3
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +65 -4
- package/fesm2022/ojiepermana-angular-navigation.mjs +4 -10
- package/fesm2022/ojiepermana-angular-sdk.mjs +204 -4
- package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1387 -3
- package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +331 -3
- package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +45 -4
- package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1044 -3
- package/fesm2022/ojiepermana-angular-theme-layout.mjs +729 -3
- package/fesm2022/ojiepermana-angular-theme-page-core.mjs +381 -3
- package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +267 -3
- package/fesm2022/ojiepermana-angular-theme-page-root.mjs +361 -3
- package/fesm2022/ojiepermana-angular-theme-page-side.mjs +198 -3
- package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +110 -3
- package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -2
- package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +338 -3
- package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +160 -4
- package/fesm2022/ojiepermana-angular-theme-shell.mjs +811 -3
- package/fesm2022/ojiepermana-angular-theme-styles.mjs +783 -3
- package/fesm2022/ojiepermana-angular-theme.mjs +4 -4
- package/fesm2022/ojiepermana-angular.mjs +6 -11
- package/navigation/README.md +374 -0
- package/package.json +81 -20
- package/sdk/README.md +212 -0
- package/sdk/schematics/collection.json +20 -0
- package/sdk/schematics/init/index.js +83 -0
- package/sdk/schematics/init/schema.json +19 -0
- package/sdk/schematics/ng-add/index.js +147 -0
- package/sdk/schematics/ng-add/schema.json +14 -0
- package/sdk/schematics/package.json +3 -0
- package/sdk/schematics/sdk/index.js +175 -0
- package/sdk/schematics/sdk/schema.json +19 -0
- package/sdk/sdk.config.example.json +24 -0
- package/sdk/src/config/loader.js +43 -0
- package/sdk/src/config/schema.js +59 -0
- package/sdk/src/emit/client.js +251 -0
- package/sdk/src/emit/metadata.js +310 -0
- package/sdk/src/emit/models.js +104 -0
- package/sdk/src/emit/navigation.js +56 -0
- package/sdk/src/emit/operations.js +118 -0
- package/sdk/src/emit/public-api.js +54 -0
- package/sdk/src/emit/services.js +110 -0
- package/sdk/src/engine.js +67 -0
- package/sdk/src/layout/per-domain.js +360 -0
- package/sdk/src/package.json +3 -0
- package/sdk/src/parser/bundle.js +25 -0
- package/sdk/src/parser/ir.js +429 -0
- package/sdk/src/parser/types.js +7 -0
- package/sdk/src/render/template.js +152 -0
- package/sdk/src/writer/index.js +286 -0
- package/theme/README.md +126 -0
- package/theme/component/settings/README.md +135 -0
- package/theme/layout/README.md +539 -0
- package/theme/page/README.md +453 -0
- package/theme/shell/README.md +340 -0
- package/theme/styles/README.md +178 -0
- package/theme/styles/css/base/components.css +553 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/package.css +9 -0
- package/theme/styles/css/base/prefers-dark.css +86 -0
- package/theme/styles/css/base/print.css +62 -0
- package/theme/styles/css/base/status.css +38 -0
- package/theme/styles/css/base/tailwind.css +165 -0
- package/theme/styles/css/base/theme.css +373 -0
- package/theme/styles/css/base/tokens.css +361 -0
- package/theme/styles/css/color/amber.css +72 -0
- package/theme/styles/css/color/blue.css +72 -0
- package/theme/styles/css/color/brand.css +38 -0
- package/theme/styles/css/color/cyan.css +72 -0
- package/theme/styles/css/color/emerald.css +72 -0
- package/theme/styles/css/color/fuchsia.css +72 -0
- package/theme/styles/css/color/green.css +72 -0
- package/theme/styles/css/color/index.css +19 -0
- package/theme/styles/css/color/indigo.css +72 -0
- package/theme/styles/css/color/lime.css +72 -0
- package/theme/styles/css/color/orange.css +72 -0
- package/theme/styles/css/color/pink.css +72 -0
- package/theme/styles/css/color/purple.css +72 -0
- package/theme/styles/css/color/red.css +72 -0
- package/theme/styles/css/color/rose.css +72 -0
- package/theme/styles/css/color/sky.css +72 -0
- package/theme/styles/css/color/teal.css +72 -0
- package/theme/styles/css/color/violet.css +72 -0
- package/theme/styles/css/color/yellow.css +72 -0
- package/theme/styles/css/index.css +18 -0
- package/theme/styles/css/neutral/gray.css +63 -0
- package/theme/styles/css/neutral/index.css +11 -0
- package/theme/styles/css/neutral/mauve.css +63 -0
- package/theme/styles/css/neutral/mist.css +63 -0
- package/theme/styles/css/neutral/neutral.css +63 -0
- package/theme/styles/css/neutral/olive.css +63 -0
- package/theme/styles/css/neutral/slate.css +63 -0
- package/theme/styles/css/neutral/stone.css +63 -0
- package/theme/styles/css/neutral/taupe.css +63 -0
- package/theme/styles/css/neutral/zinc.css +63 -0
- package/theme/styles/css/radius/index.css +30 -0
- package/theme/styles/css/space/index.css +20 -0
- package/types/ojiepermana-angular-chart-area.d.ts +76 -1
- package/types/ojiepermana-angular-chart-bar.d.ts +201 -1
- package/types/ojiepermana-angular-chart-core.d.ts +811 -1
- package/types/ojiepermana-angular-chart-line.d.ts +75 -1
- package/types/ojiepermana-angular-chart-pie.d.ts +131 -1
- package/types/ojiepermana-angular-chart-primitives.d.ts +291 -1
- package/types/ojiepermana-angular-chart-radar.d.ts +116 -1
- package/types/ojiepermana-angular-chart-radial.d.ts +116 -1
- package/types/ojiepermana-angular-chart-scatter.d.ts +125 -1
- package/types/ojiepermana-angular-chart.d.ts +2 -1
- package/types/ojiepermana-angular-component-accordion.d.ts +85 -1
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +140 -1
- package/types/ojiepermana-angular-component-alert.d.ts +42 -1
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +12 -1
- package/types/ojiepermana-angular-component-avatar.d.ts +56 -1
- package/types/ojiepermana-angular-component-badge.d.ts +24 -1
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +46 -1
- package/types/ojiepermana-angular-component-button-group.d.ts +26 -1
- package/types/ojiepermana-angular-component-button.d.ts +27 -1
- package/types/ojiepermana-angular-component-calendar.d.ts +111 -1
- package/types/ojiepermana-angular-component-card.d.ts +69 -1
- package/types/ojiepermana-angular-component-carousel.d.ts +86 -1
- package/types/ojiepermana-angular-component-checkbox.d.ts +42 -1
- package/types/ojiepermana-angular-component-collapsible.d.ts +42 -1
- package/types/ojiepermana-angular-component-combobox.d.ts +60 -1
- package/types/ojiepermana-angular-component-command.d.ts +130 -1
- package/types/ojiepermana-angular-component-composer.d.ts +90 -1
- package/types/ojiepermana-angular-component-context-menu.d.ts +54 -1
- package/types/ojiepermana-angular-component-date-picker.d.ts +109 -1
- package/types/ojiepermana-angular-component-dialog.d.ts +136 -1
- package/types/ojiepermana-angular-component-drawer.d.ts +1 -1
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +248 -1
- package/types/ojiepermana-angular-component-editor.d.ts +135 -1
- package/types/ojiepermana-angular-component-empty.d.ts +50 -1
- package/types/ojiepermana-angular-component-form.d.ts +159 -1
- package/types/ojiepermana-angular-component-hover-card.d.ts +75 -1
- package/types/ojiepermana-angular-component-icon.d.ts +89 -1
- package/types/ojiepermana-angular-component-input-group.d.ts +51 -1
- package/types/ojiepermana-angular-component-input-otp.d.ts +155 -1
- package/types/ojiepermana-angular-component-input.d.ts +21 -1
- package/types/ojiepermana-angular-component-item.d.ts +93 -1
- package/types/ojiepermana-angular-component-kanban.d.ts +70 -1
- package/types/ojiepermana-angular-component-kbd.d.ts +16 -1
- package/types/ojiepermana-angular-component-label.d.ts +11 -1
- package/types/ojiepermana-angular-component-menubar.d.ts +93 -1
- package/types/ojiepermana-angular-component-native-select.d.ts +26 -1
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +104 -1
- package/types/ojiepermana-angular-component-pagination.d.ts +33 -1
- package/types/ojiepermana-angular-component-pillbox.d.ts +222 -1
- package/types/ojiepermana-angular-component-popover.d.ts +66 -1
- package/types/ojiepermana-angular-component-progress.d.ts +17 -1
- package/types/ojiepermana-angular-component-radio.d.ts +60 -1
- package/types/ojiepermana-angular-component-resizable.d.ts +117 -1
- package/types/ojiepermana-angular-component-scroll-area.d.ts +19 -1
- package/types/ojiepermana-angular-component-segmented-control.d.ts +58 -1
- package/types/ojiepermana-angular-component-select.d.ts +122 -1
- package/types/ojiepermana-angular-component-separator.d.ts +14 -1
- package/types/ojiepermana-angular-component-sheet.d.ts +130 -1
- package/types/ojiepermana-angular-component-skeleton.d.ts +10 -1
- package/types/ojiepermana-angular-component-slider.d.ts +83 -1
- package/types/ojiepermana-angular-component-spinner.d.ts +13 -1
- package/types/ojiepermana-angular-component-switch.d.ts +44 -1
- package/types/ojiepermana-angular-component-table.d.ts +57 -1
- package/types/ojiepermana-angular-component-tabs.d.ts +124 -1
- package/types/ojiepermana-angular-component-textarea.d.ts +17 -1
- package/types/ojiepermana-angular-component-timeline.d.ts +64 -1
- package/types/ojiepermana-angular-component-toast.d.ts +64 -1
- package/types/ojiepermana-angular-component-toggle-group.d.ts +90 -1
- package/types/ojiepermana-angular-component-toggle.d.ts +25 -1
- package/types/ojiepermana-angular-component-tooltip.d.ts +143 -1
- package/types/ojiepermana-angular-component-utils-core.d.ts +184 -1
- package/types/ojiepermana-angular-component-utils-overlay.d.ts +21 -1
- package/types/ojiepermana-angular-component-utils-scale.d.ts +19 -1
- package/types/ojiepermana-angular-component-utils.d.ts +2 -1
- package/types/ojiepermana-angular-component.d.ts +2 -1
- package/types/ojiepermana-angular-navigation-core.d.ts +59 -1
- package/types/ojiepermana-angular-navigation-icon.d.ts +12 -1
- package/types/ojiepermana-angular-navigation-service.d.ts +116 -1
- package/types/ojiepermana-angular-navigation-types.d.ts +144 -1
- package/types/ojiepermana-angular-navigation.d.ts +507 -1
- package/types/ojiepermana-angular-sdk.d.ts +89 -1
- package/types/ojiepermana-angular-theme-component-settings.d.ts +154 -1
- package/types/ojiepermana-angular-theme-layout-services.d.ts +147 -1
- package/types/ojiepermana-angular-theme-layout-types.d.ts +40 -1
- package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +299 -1
- package/types/ojiepermana-angular-theme-layout.d.ts +129 -1
- package/types/ojiepermana-angular-theme-page-core.d.ts +157 -1
- package/types/ojiepermana-angular-theme-page-filter.d.ts +77 -1
- package/types/ojiepermana-angular-theme-page-root.d.ts +88 -1
- package/types/ojiepermana-angular-theme-page-side.d.ts +50 -1
- package/types/ojiepermana-angular-theme-page-slots.d.ts +40 -1
- package/types/ojiepermana-angular-theme-page.d.ts +5 -1
- package/types/ojiepermana-angular-theme-shell-services.d.ts +193 -1
- package/types/ojiepermana-angular-theme-shell-types.d.ts +105 -1
- package/types/ojiepermana-angular-theme-shell.d.ts +100 -1
- package/types/ojiepermana-angular-theme-styles.d.ts +319 -1
- package/types/ojiepermana-angular-theme.d.ts +2 -1
- package/types/ojiepermana-angular.d.ts +5 -5
|
@@ -1,7 +1,382 @@
|
|
|
1
|
-
|
|
1
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
2
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, ElementRef, input, Directive, contentChildren, forwardRef, computed, Component, TemplateRef, output, signal, ViewContainerRef, DestroyRef } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { RovingRow, cn, injectUniqueId } from '@ojiepermana/angular/component/utils/core';
|
|
7
|
+
import { connectedPositionFor } from '@ojiepermana/angular/component/utils/overlay';
|
|
8
|
+
import { merge } from 'rxjs';
|
|
9
|
+
import { filter } from 'rxjs/operators';
|
|
2
10
|
|
|
3
|
-
|
|
11
|
+
function position(align, side) {
|
|
12
|
+
return connectedPositionFor(side, align, 8);
|
|
13
|
+
}
|
|
14
|
+
class NavigationMenuRootItem {
|
|
15
|
+
elementRef = inject(ElementRef);
|
|
16
|
+
disabled = input(false, /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
18
|
+
isWithin(container) {
|
|
19
|
+
return container.contains(this.elementRef.nativeElement);
|
|
20
|
+
}
|
|
21
|
+
focus() {
|
|
22
|
+
this.elementRef.nativeElement.focus();
|
|
23
|
+
}
|
|
24
|
+
containsTarget(target) {
|
|
25
|
+
return target instanceof Node && this.elementRef.nativeElement.contains(target);
|
|
26
|
+
}
|
|
27
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuRootItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
28
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: NavigationMenuRootItem, isStandalone: true, inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
29
|
+
}
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuRootItem, decorators: [{
|
|
31
|
+
type: Directive
|
|
32
|
+
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
33
|
+
class NavigationMenuComponent {
|
|
34
|
+
class = input('', /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
36
|
+
ariaLabel = input('Main navigation', /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
38
|
+
loop = input(true, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "loop" }] : /* istanbul ignore next */ []));
|
|
40
|
+
items = contentChildren(forwardRef(() => NavigationMenuRootItem), { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: true });
|
|
41
|
+
host = inject(ElementRef);
|
|
42
|
+
row = new RovingRow({
|
|
43
|
+
// Only the items of THIS navigation menu: `descendants` also collects the
|
|
44
|
+
// root items a nested navigation menu contributes.
|
|
45
|
+
items: () => this.items().filter((item) => item.isWithin(this.host.nativeElement)),
|
|
46
|
+
host: () => this.host.nativeElement,
|
|
47
|
+
loop: () => this.loop(),
|
|
48
|
+
enter: (item) => this.enter(item),
|
|
49
|
+
});
|
|
50
|
+
classes = computed(() => cn('relative z-10 flex max-w-max flex-1 items-center justify-center', this.class()), /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
52
|
+
setActiveItem(item) {
|
|
53
|
+
this.row.setActive(item);
|
|
54
|
+
}
|
|
55
|
+
tabIndexFor(item) {
|
|
56
|
+
return this.row.tabIndexFor(item);
|
|
57
|
+
}
|
|
58
|
+
hasOpenTrigger(except) {
|
|
59
|
+
return this.row.hasOpenTrigger(except);
|
|
60
|
+
}
|
|
61
|
+
notifyOpen(trigger) {
|
|
62
|
+
this.row.notifyOpen(trigger);
|
|
63
|
+
}
|
|
64
|
+
notifyClosed(trigger) {
|
|
65
|
+
this.row.notifyClosed(trigger);
|
|
66
|
+
}
|
|
67
|
+
onKeydown(event) {
|
|
68
|
+
// A disabled item answers for nothing here: keys that reach one are dropped
|
|
69
|
+
// rather than recovered from.
|
|
70
|
+
const currentItem = this.row.itemFrom(event.target, 'enabled');
|
|
71
|
+
if (!currentItem) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (event.key === 'ArrowDown' && currentItem instanceof NavigationMenuTriggerDirective) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
currentItem.open({ focusFirstItem: true });
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.row.handleNavigationKey(currentItem, event);
|
|
80
|
+
}
|
|
81
|
+
enter(nextItem) {
|
|
82
|
+
const currentOpenTrigger = this.row.openTrigger();
|
|
83
|
+
if (!currentOpenTrigger) {
|
|
84
|
+
nextItem.focus();
|
|
85
|
+
this.row.setActive(nextItem);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (nextItem instanceof NavigationMenuTriggerDirective) {
|
|
89
|
+
// Arrows walk the ROOT items, so focus lands on the next trigger itself.
|
|
90
|
+
// Its panel opens because one was already open, and `notifyOpen` closes
|
|
91
|
+
// the previous one -- but diving straight into that panel's first link
|
|
92
|
+
// would skip the trigger the user was steering towards.
|
|
93
|
+
nextItem.open();
|
|
94
|
+
this.row.setActive(nextItem);
|
|
95
|
+
nextItem.focus();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
currentOpenTrigger.close({ restoreFocus: false });
|
|
99
|
+
this.row.setActive(nextItem);
|
|
100
|
+
queueMicrotask(() => nextItem.focus());
|
|
101
|
+
}
|
|
102
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
103
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.4", type: NavigationMenuComponent, isStandalone: true, selector: "NavigationMenu", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, loop: { classPropertyName: "loop", publicName: "loop", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($any($event))" }, properties: { "class": "classes()", "attr.role": "\"navigation\"", "attr.aria-label": "ariaLabel() || null" } }, queries: [{ propertyName: "items", predicate: i0.forwardRef(() => NavigationMenuRootItem), descendants: true, isSignal: true }], ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
104
|
+
}
|
|
105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuComponent, decorators: [{
|
|
106
|
+
type: Component,
|
|
107
|
+
args: [{
|
|
108
|
+
selector: 'NavigationMenu',
|
|
109
|
+
host: {
|
|
110
|
+
'[class]': 'classes()',
|
|
111
|
+
'[attr.role]': '"navigation"',
|
|
112
|
+
'[attr.aria-label]': 'ariaLabel() || null',
|
|
113
|
+
'(keydown)': 'onKeydown($any($event))',
|
|
114
|
+
},
|
|
115
|
+
template: `<ng-content />`,
|
|
116
|
+
}]
|
|
117
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], loop: [{ type: i0.Input, args: [{ isSignal: true, alias: "loop", required: false }] }], items: [{ type: i0.ContentChildren, args: [forwardRef(() => NavigationMenuRootItem), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
118
|
+
class NavigationMenuListComponent {
|
|
119
|
+
class = input('', /* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
121
|
+
classes = computed(() => cn('group flex flex-1 list-none items-center justify-center gap-1', this.class()), /* @ts-ignore */
|
|
122
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
123
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
124
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: NavigationMenuListComponent, isStandalone: true, selector: "NavigationMenuList", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
125
|
+
}
|
|
126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuListComponent, decorators: [{
|
|
127
|
+
type: Component,
|
|
128
|
+
args: [{
|
|
129
|
+
selector: 'NavigationMenuList',
|
|
130
|
+
host: {
|
|
131
|
+
'[class]': 'classes()',
|
|
132
|
+
},
|
|
133
|
+
template: `<ng-content />`,
|
|
134
|
+
}]
|
|
135
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
136
|
+
class NavigationMenuItemComponent {
|
|
137
|
+
class = input('', /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
139
|
+
classes = computed(() => cn('relative', this.class()), /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
141
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
142
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: NavigationMenuItemComponent, isStandalone: true, selector: "NavigationMenuItem", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
143
|
+
}
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuItemComponent, decorators: [{
|
|
145
|
+
type: Component,
|
|
146
|
+
args: [{
|
|
147
|
+
selector: 'NavigationMenuItem',
|
|
148
|
+
host: {
|
|
149
|
+
'[class]': 'classes()',
|
|
150
|
+
},
|
|
151
|
+
template: `<ng-content />`,
|
|
152
|
+
}]
|
|
153
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
154
|
+
class NavigationMenuContentDirective {
|
|
155
|
+
template = inject(TemplateRef);
|
|
156
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
157
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: NavigationMenuContentDirective, isStandalone: true, selector: "ng-template[NavigationMenuContent]", exportAs: ["NavigationMenuContent"], ngImport: i0 });
|
|
158
|
+
}
|
|
159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuContentDirective, decorators: [{
|
|
160
|
+
type: Directive,
|
|
161
|
+
args: [{
|
|
162
|
+
selector: 'ng-template[NavigationMenuContent]',
|
|
163
|
+
exportAs: 'NavigationMenuContent',
|
|
164
|
+
}]
|
|
165
|
+
}] });
|
|
166
|
+
class NavigationMenuTriggerDirective extends NavigationMenuRootItem {
|
|
167
|
+
NavigationMenuTrigger = input.required(/* @ts-ignore */
|
|
168
|
+
...(ngDevMode ? [{ debugName: "NavigationMenuTrigger" }] : /* istanbul ignore next */ []));
|
|
169
|
+
align = input('start', /* @ts-ignore */
|
|
170
|
+
...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
171
|
+
class = input('', /* @ts-ignore */
|
|
172
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
173
|
+
/** Ties `aria-controls` here to the overlay this trigger discloses. */
|
|
174
|
+
panelId = injectUniqueId('NavigationMenuPanel');
|
|
175
|
+
openedChange = output();
|
|
176
|
+
isOpen = signal(false, /* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
178
|
+
overlay = inject(Overlay);
|
|
179
|
+
vcr = inject(ViewContainerRef);
|
|
180
|
+
navigationMenu = inject(NavigationMenuComponent, { optional: true });
|
|
181
|
+
destroyRef = inject(DestroyRef);
|
|
182
|
+
overlayRef = null;
|
|
183
|
+
constructor() {
|
|
184
|
+
super();
|
|
185
|
+
this.destroyRef.onDestroy(() => this.close({ restoreFocus: false, emitOpenedChange: false }));
|
|
186
|
+
}
|
|
187
|
+
classes = computed(() => cn('group inline-flex h-control-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors', 'after:mb-0.5 after:ml-2 after:inline-block after:h-2 after:w-2 after:shrink-0 after:rotate-45 after:border-b after:border-r after:border-current after:transition-transform after:content-[""]', 'hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[state=open]:bg-accent/50 data-[state=open]:text-accent-foreground data-[state=open]:after:-rotate-135', this.class()), /* @ts-ignore */
|
|
188
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
189
|
+
toggle() {
|
|
190
|
+
if (this.disabled()) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (this.isOpen()) {
|
|
194
|
+
this.close();
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
this.open();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
open(options = {}) {
|
|
201
|
+
if (this.isOpen() || this.disabled()) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.navigationMenu?.notifyOpen(this);
|
|
205
|
+
const overlayRef = this.overlay.create({
|
|
206
|
+
positionStrategy: this.overlay
|
|
207
|
+
.position()
|
|
208
|
+
.flexibleConnectedTo(this.elementRef)
|
|
209
|
+
.withFlexibleDimensions(false)
|
|
210
|
+
.withPush(false)
|
|
211
|
+
.withPositions([position(this.align(), 'bottom'), position(this.align(), 'top')]),
|
|
212
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
213
|
+
hasBackdrop: false,
|
|
214
|
+
panelClass: 'navigation-menu-panel',
|
|
215
|
+
});
|
|
216
|
+
const portal = new TemplatePortal(this.NavigationMenuTrigger().template, this.vcr);
|
|
217
|
+
overlayRef.attach(portal);
|
|
218
|
+
overlayRef.overlayElement.id = this.panelId;
|
|
219
|
+
this.overlayRef = overlayRef;
|
|
220
|
+
merge(overlayRef
|
|
221
|
+
.outsidePointerEvents()
|
|
222
|
+
.pipe(filter((event) => !this.elementRef.nativeElement.contains(event.target))), overlayRef.keydownEvents().pipe(filter((event) => event.key === 'Escape')), overlayRef.detachments())
|
|
223
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
224
|
+
.subscribe(() => this.close());
|
|
225
|
+
this.isOpen.set(true);
|
|
226
|
+
this.openedChange.emit(true);
|
|
227
|
+
if (options.focusFirstItem) {
|
|
228
|
+
queueMicrotask(() => this.focusFirstItem());
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
close(options = {}) {
|
|
232
|
+
const { restoreFocus = true, emitOpenedChange = true } = options;
|
|
233
|
+
if (!this.isOpen()) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const overlayRef = this.overlayRef;
|
|
237
|
+
this.overlayRef = null;
|
|
238
|
+
this.isOpen.set(false);
|
|
239
|
+
if (emitOpenedChange) {
|
|
240
|
+
this.openedChange.emit(false);
|
|
241
|
+
}
|
|
242
|
+
this.navigationMenu?.notifyClosed(this);
|
|
243
|
+
overlayRef?.dispose();
|
|
244
|
+
if (restoreFocus) {
|
|
245
|
+
this.elementRef.nativeElement.focus();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
tabIndex() {
|
|
249
|
+
return this.navigationMenu?.tabIndexFor(this) ?? (this.disabled() ? -1 : 0);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* A disabled trigger normally carries the native `disabled` attribute, which
|
|
253
|
+
* takes it out of the tab order for free. The one exception is the trigger
|
|
254
|
+
* holding the menu's only tab stop, which happens when every sibling is
|
|
255
|
+
* disabled too: there the native attribute would undo the tab stop, so the
|
|
256
|
+
* state travels as `aria-disabled` alone. Every action here already refuses
|
|
257
|
+
* on `disabled()`, so nothing becomes operable by dropping the attribute.
|
|
258
|
+
*/
|
|
259
|
+
nativeDisabled() {
|
|
260
|
+
return this.disabled() && this.tabIndex() < 0;
|
|
261
|
+
}
|
|
262
|
+
openFromKeyboard(event, focusFirstItem) {
|
|
263
|
+
if (this.disabled()) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
this.open({ focusFirstItem });
|
|
268
|
+
}
|
|
269
|
+
syncActiveState() {
|
|
270
|
+
this.navigationMenu?.setActiveItem(this);
|
|
271
|
+
}
|
|
272
|
+
openFromHover() {
|
|
273
|
+
if (this.disabled() || !this.navigationMenu?.hasOpenTrigger(this)) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
this.open();
|
|
277
|
+
}
|
|
278
|
+
focusFirstItem() {
|
|
279
|
+
const overlayElement = this.overlayRef?.overlayElement;
|
|
280
|
+
if (!overlayElement) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const firstItem = overlayElement.querySelector('a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])');
|
|
284
|
+
firstItem?.focus();
|
|
285
|
+
}
|
|
286
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
287
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: NavigationMenuTriggerDirective, isStandalone: true, selector: "[NavigationMenuTrigger]", inputs: { NavigationMenuTrigger: { classPropertyName: "NavigationMenuTrigger", publicName: "NavigationMenuTrigger", isSignal: true, isRequired: true, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openedChange: "openedChange" }, host: { listeners: { "click": "toggle()", "keydown.enter": "openFromKeyboard($any($event), false)", "keydown.space": "openFromKeyboard($any($event), false)", "keydown.arrowDown": "openFromKeyboard($any($event), true)", "focus": "syncActiveState()", "mouseenter": "openFromHover()" }, properties: { "class": "classes()", "attr.aria-expanded": "isOpen()", "attr.aria-controls": "isOpen() ? panelId : null", "attr.data-state": "isOpen() ? \"open\" : \"closed\"", "attr.tabindex": "tabIndex()", "attr.disabled": "nativeDisabled() ? \"\" : null", "attr.aria-disabled": "disabled() ? \"true\" : null" } }, providers: [
|
|
288
|
+
{
|
|
289
|
+
provide: NavigationMenuRootItem,
|
|
290
|
+
useExisting: forwardRef(() => NavigationMenuTriggerDirective),
|
|
291
|
+
},
|
|
292
|
+
], exportAs: ["NavigationMenuTrigger"], usesInheritance: true, ngImport: i0 });
|
|
293
|
+
}
|
|
294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuTriggerDirective, decorators: [{
|
|
295
|
+
type: Directive,
|
|
296
|
+
args: [{
|
|
297
|
+
selector: '[NavigationMenuTrigger]',
|
|
298
|
+
exportAs: 'NavigationMenuTrigger',
|
|
299
|
+
providers: [
|
|
300
|
+
{
|
|
301
|
+
provide: NavigationMenuRootItem,
|
|
302
|
+
useExisting: forwardRef(() => NavigationMenuTriggerDirective),
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
host: {
|
|
306
|
+
'[class]': 'classes()',
|
|
307
|
+
'[attr.aria-expanded]': 'isOpen()',
|
|
308
|
+
'[attr.aria-controls]': 'isOpen() ? panelId : null',
|
|
309
|
+
'[attr.data-state]': 'isOpen() ? "open" : "closed"',
|
|
310
|
+
'[attr.tabindex]': 'tabIndex()',
|
|
311
|
+
'[attr.disabled]': 'nativeDisabled() ? "" : null',
|
|
312
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
313
|
+
'(click)': 'toggle()',
|
|
314
|
+
'(keydown.enter)': 'openFromKeyboard($any($event), false)',
|
|
315
|
+
'(keydown.space)': 'openFromKeyboard($any($event), false)',
|
|
316
|
+
'(keydown.arrowDown)': 'openFromKeyboard($any($event), true)',
|
|
317
|
+
'(focus)': 'syncActiveState()',
|
|
318
|
+
'(mouseenter)': 'openFromHover()',
|
|
319
|
+
},
|
|
320
|
+
}]
|
|
321
|
+
}], ctorParameters: () => [], propDecorators: { NavigationMenuTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "NavigationMenuTrigger", required: true }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], openedChange: [{ type: i0.Output, args: ["openedChange"] }] } });
|
|
322
|
+
class NavigationMenuLinkDirective extends NavigationMenuRootItem {
|
|
323
|
+
class = input('', /* @ts-ignore */
|
|
324
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
325
|
+
variant = input('content', /* @ts-ignore */
|
|
326
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
327
|
+
navigationMenu = inject(NavigationMenuComponent, { optional: true });
|
|
328
|
+
classes = computed(() => this.variant() === 'trigger'
|
|
329
|
+
? cn('inline-flex h-control-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors', 'hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'aria-disabled:pointer-events-none aria-disabled:opacity-50', this.class())
|
|
330
|
+
: cn('block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors', 'hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring', 'aria-disabled:pointer-events-none aria-disabled:opacity-50', this.class()), /* @ts-ignore */
|
|
331
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
332
|
+
tabIndex() {
|
|
333
|
+
if (this.variant() !== 'trigger') {
|
|
334
|
+
return this.disabled() ? -1 : 0;
|
|
335
|
+
}
|
|
336
|
+
return this.navigationMenu?.tabIndexFor(this) ?? (this.disabled() ? -1 : 0);
|
|
337
|
+
}
|
|
338
|
+
focus() {
|
|
339
|
+
if (this.variant() === 'trigger' && this.elementRef.nativeElement.tabIndex < 0) {
|
|
340
|
+
this.elementRef.nativeElement.tabIndex = 0;
|
|
341
|
+
}
|
|
342
|
+
super.focus();
|
|
343
|
+
}
|
|
344
|
+
syncActiveState() {
|
|
345
|
+
if (this.variant() === 'trigger') {
|
|
346
|
+
this.navigationMenu?.setActiveItem(this);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
preventDisabled(event) {
|
|
350
|
+
if (this.disabled()) {
|
|
351
|
+
event.preventDefault();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuLinkDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
355
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: NavigationMenuLinkDirective, isStandalone: true, selector: "a[NavigationMenuLink], button[NavigationMenuLink]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "focus": "syncActiveState()", "click": "preventDisabled($any($event))" }, properties: { "class": "classes()", "attr.tabindex": "tabIndex()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.data-variant": "variant()" } }, providers: [
|
|
356
|
+
{ provide: NavigationMenuRootItem, useExisting: forwardRef(() => NavigationMenuLinkDirective) },
|
|
357
|
+
], exportAs: ["NavigationMenuLink"], usesInheritance: true, ngImport: i0 });
|
|
358
|
+
}
|
|
359
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NavigationMenuLinkDirective, decorators: [{
|
|
360
|
+
type: Directive,
|
|
361
|
+
args: [{
|
|
362
|
+
selector: 'a[NavigationMenuLink], button[NavigationMenuLink]',
|
|
363
|
+
exportAs: 'NavigationMenuLink',
|
|
364
|
+
providers: [
|
|
365
|
+
{ provide: NavigationMenuRootItem, useExisting: forwardRef(() => NavigationMenuLinkDirective) },
|
|
366
|
+
],
|
|
367
|
+
host: {
|
|
368
|
+
'[class]': 'classes()',
|
|
369
|
+
'[attr.tabindex]': 'tabIndex()',
|
|
370
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
371
|
+
'[attr.data-variant]': 'variant()',
|
|
372
|
+
'(focus)': 'syncActiveState()',
|
|
373
|
+
'(click)': 'preventDisabled($any($event))',
|
|
374
|
+
},
|
|
375
|
+
}]
|
|
376
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }] } });
|
|
4
377
|
|
|
5
378
|
/**
|
|
6
379
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
export { NavigationMenuComponent, NavigationMenuContentDirective, NavigationMenuItemComponent, NavigationMenuLinkDirective, NavigationMenuListComponent, NavigationMenuRootItem, NavigationMenuTriggerDirective };
|
|
@@ -1,7 +1,242 @@
|
|
|
1
|
-
|
|
1
|
+
import { buttonVariants } from '@ojiepermana/angular/component/button';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { model, input, computed, Component } from '@angular/core';
|
|
4
|
+
import { cn } from '@ojiepermana/angular/component/utils/core';
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Simple pagination. Emits the desired page via `(pageChange)` and reflects
|
|
8
|
+
* the current page through the `page` model input while allowing lightweight
|
|
9
|
+
* label and visibility tweaks for localized and icon-only demos.
|
|
10
|
+
*/
|
|
11
|
+
class PaginationComponent {
|
|
12
|
+
page = model(1, /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "page" }] : /* istanbul ignore next */ []));
|
|
14
|
+
total = input(1, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []));
|
|
16
|
+
/** Number of sibling pages on each side of current. */
|
|
17
|
+
siblingCount = input(1, /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "siblingCount" }] : /* istanbul ignore next */ []));
|
|
19
|
+
showPageNumbers = input(true, /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "showPageNumbers" }] : /* istanbul ignore next */ []));
|
|
21
|
+
previousText = input('Previous', /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "previousText" }] : /* istanbul ignore next */ []));
|
|
23
|
+
nextText = input('Next', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "nextText" }] : /* istanbul ignore next */ []));
|
|
25
|
+
previousAriaLabel = input('Go to previous page', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "previousAriaLabel" }] : /* istanbul ignore next */ []));
|
|
27
|
+
nextAriaLabel = input('Go to next page', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "nextAriaLabel" }] : /* istanbul ignore next */ []));
|
|
29
|
+
formatPageLabel = input((page) => page.toString(), /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "formatPageLabel" }] : /* istanbul ignore next */ []));
|
|
31
|
+
class = input('', /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
33
|
+
classes = computed(() => cn('mx-auto flex w-full justify-center', this.class()), /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
35
|
+
pages = computed(() => {
|
|
36
|
+
if (!this.showPageNumbers()) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
const total = Math.max(1, this.total());
|
|
40
|
+
const current = Math.min(Math.max(1, this.page()), total);
|
|
41
|
+
const siblings = Math.max(0, this.siblingCount());
|
|
42
|
+
const range = [];
|
|
43
|
+
const start = Math.max(2, current - siblings);
|
|
44
|
+
const end = Math.min(total - 1, current + siblings);
|
|
45
|
+
range.push({ key: 'p-1', kind: 'page', value: 1 });
|
|
46
|
+
if (start > 2)
|
|
47
|
+
range.push({ key: 'e-start', kind: 'ellipsis', value: -1 });
|
|
48
|
+
for (let i = start; i <= end; i++)
|
|
49
|
+
range.push({ key: `p-${i}`, kind: 'page', value: i });
|
|
50
|
+
if (end < total - 1)
|
|
51
|
+
range.push({ key: 'e-end', kind: 'ellipsis', value: -1 });
|
|
52
|
+
if (total > 1)
|
|
53
|
+
range.push({ key: `p-${total}`, kind: 'page', value: total });
|
|
54
|
+
return range;
|
|
55
|
+
}, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
|
|
57
|
+
navClasses(hasText) {
|
|
58
|
+
return hasText
|
|
59
|
+
? cn(buttonVariants({ variant: 'ghost', size: 'default' }), 'gap-1 pl-2.5 pr-2.5')
|
|
60
|
+
: cn(buttonVariants({ variant: 'ghost', size: 'icon' }), 'h-control-md w-control-md');
|
|
61
|
+
}
|
|
62
|
+
pageClasses(active) {
|
|
63
|
+
return cn(buttonVariants({ variant: active ? 'outline' : 'ghost', size: 'icon' }), 'h-control-md w-control-md');
|
|
64
|
+
}
|
|
65
|
+
go(target) {
|
|
66
|
+
const total = Math.max(1, this.total());
|
|
67
|
+
const next = Math.min(Math.max(1, target), total);
|
|
68
|
+
if (next === this.page())
|
|
69
|
+
return;
|
|
70
|
+
this.page.set(next);
|
|
71
|
+
}
|
|
72
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
73
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: PaginationComponent, isStandalone: true, selector: "Pagination, nav[Pagination]", inputs: { page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, siblingCount: { classPropertyName: "siblingCount", publicName: "siblingCount", isSignal: true, isRequired: false, transformFunction: null }, showPageNumbers: { classPropertyName: "showPageNumbers", publicName: "showPageNumbers", isSignal: true, isRequired: false, transformFunction: null }, previousText: { classPropertyName: "previousText", publicName: "previousText", isSignal: true, isRequired: false, transformFunction: null }, nextText: { classPropertyName: "nextText", publicName: "nextText", isSignal: true, isRequired: false, transformFunction: null }, previousAriaLabel: { classPropertyName: "previousAriaLabel", publicName: "previousAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, nextAriaLabel: { classPropertyName: "nextAriaLabel", publicName: "nextAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, formatPageLabel: { classPropertyName: "formatPageLabel", publicName: "formatPageLabel", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { page: "pageChange" }, host: { attributes: { "role": "navigation", "aria-label": "pagination" }, properties: { "class": "classes()" } }, ngImport: i0, template: `
|
|
74
|
+
<ul class="flex flex-row items-center gap-1">
|
|
75
|
+
<li>
|
|
76
|
+
<button
|
|
77
|
+
type="button"
|
|
78
|
+
[disabled]="page() <= 1 || null"
|
|
79
|
+
[attr.aria-label]="previousAriaLabel()"
|
|
80
|
+
[class]="navClasses(previousText().length > 0)"
|
|
81
|
+
(click)="go(page() - 1)"
|
|
82
|
+
>
|
|
83
|
+
<svg
|
|
84
|
+
aria-hidden="true"
|
|
85
|
+
class="h-4 w-4"
|
|
86
|
+
viewBox="0 0 24 24"
|
|
87
|
+
fill="none"
|
|
88
|
+
stroke="currentColor"
|
|
89
|
+
stroke-width="2"
|
|
90
|
+
stroke-linecap="round"
|
|
91
|
+
stroke-linejoin="round"
|
|
92
|
+
>
|
|
93
|
+
<polyline points="15 18 9 12 15 6" />
|
|
94
|
+
</svg>
|
|
95
|
+
@if (previousText()) {
|
|
96
|
+
<span>{{ previousText() }}</span>
|
|
97
|
+
}
|
|
98
|
+
</button>
|
|
99
|
+
</li>
|
|
100
|
+
|
|
101
|
+
@for (p of pages(); track p.key) {
|
|
102
|
+
<li>
|
|
103
|
+
@if (p.kind === 'page') {
|
|
104
|
+
<button
|
|
105
|
+
type="button"
|
|
106
|
+
[attr.aria-current]="p.value === page() ? 'page' : null"
|
|
107
|
+
[class]="pageClasses(p.value === page())"
|
|
108
|
+
(click)="go(p.value)"
|
|
109
|
+
>
|
|
110
|
+
{{ formatPageLabel()(p.value) }}
|
|
111
|
+
</button>
|
|
112
|
+
} @else {
|
|
113
|
+
<span
|
|
114
|
+
class="flex h-control-md w-control-md items-center justify-center"
|
|
115
|
+
aria-hidden="true"
|
|
116
|
+
>…</span
|
|
117
|
+
>
|
|
118
|
+
}
|
|
119
|
+
</li>
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
<li>
|
|
123
|
+
<button
|
|
124
|
+
type="button"
|
|
125
|
+
[disabled]="page() >= total() || null"
|
|
126
|
+
[attr.aria-label]="nextAriaLabel()"
|
|
127
|
+
[class]="navClasses(nextText().length > 0)"
|
|
128
|
+
(click)="go(page() + 1)"
|
|
129
|
+
>
|
|
130
|
+
@if (nextText()) {
|
|
131
|
+
<span>{{ nextText() }}</span>
|
|
132
|
+
}
|
|
133
|
+
<svg
|
|
134
|
+
aria-hidden="true"
|
|
135
|
+
class="h-4 w-4"
|
|
136
|
+
viewBox="0 0 24 24"
|
|
137
|
+
fill="none"
|
|
138
|
+
stroke="currentColor"
|
|
139
|
+
stroke-width="2"
|
|
140
|
+
stroke-linecap="round"
|
|
141
|
+
stroke-linejoin="round"
|
|
142
|
+
>
|
|
143
|
+
<polyline points="9 18 15 12 9 6" />
|
|
144
|
+
</svg>
|
|
145
|
+
</button>
|
|
146
|
+
</li>
|
|
147
|
+
</ul>
|
|
148
|
+
`, isInline: true });
|
|
149
|
+
}
|
|
150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PaginationComponent, decorators: [{
|
|
151
|
+
type: Component,
|
|
152
|
+
args: [{
|
|
153
|
+
selector: 'Pagination, nav[Pagination]',
|
|
154
|
+
host: {
|
|
155
|
+
role: 'navigation',
|
|
156
|
+
'aria-label': 'pagination',
|
|
157
|
+
'[class]': 'classes()',
|
|
158
|
+
},
|
|
159
|
+
template: `
|
|
160
|
+
<ul class="flex flex-row items-center gap-1">
|
|
161
|
+
<li>
|
|
162
|
+
<button
|
|
163
|
+
type="button"
|
|
164
|
+
[disabled]="page() <= 1 || null"
|
|
165
|
+
[attr.aria-label]="previousAriaLabel()"
|
|
166
|
+
[class]="navClasses(previousText().length > 0)"
|
|
167
|
+
(click)="go(page() - 1)"
|
|
168
|
+
>
|
|
169
|
+
<svg
|
|
170
|
+
aria-hidden="true"
|
|
171
|
+
class="h-4 w-4"
|
|
172
|
+
viewBox="0 0 24 24"
|
|
173
|
+
fill="none"
|
|
174
|
+
stroke="currentColor"
|
|
175
|
+
stroke-width="2"
|
|
176
|
+
stroke-linecap="round"
|
|
177
|
+
stroke-linejoin="round"
|
|
178
|
+
>
|
|
179
|
+
<polyline points="15 18 9 12 15 6" />
|
|
180
|
+
</svg>
|
|
181
|
+
@if (previousText()) {
|
|
182
|
+
<span>{{ previousText() }}</span>
|
|
183
|
+
}
|
|
184
|
+
</button>
|
|
185
|
+
</li>
|
|
186
|
+
|
|
187
|
+
@for (p of pages(); track p.key) {
|
|
188
|
+
<li>
|
|
189
|
+
@if (p.kind === 'page') {
|
|
190
|
+
<button
|
|
191
|
+
type="button"
|
|
192
|
+
[attr.aria-current]="p.value === page() ? 'page' : null"
|
|
193
|
+
[class]="pageClasses(p.value === page())"
|
|
194
|
+
(click)="go(p.value)"
|
|
195
|
+
>
|
|
196
|
+
{{ formatPageLabel()(p.value) }}
|
|
197
|
+
</button>
|
|
198
|
+
} @else {
|
|
199
|
+
<span
|
|
200
|
+
class="flex h-control-md w-control-md items-center justify-center"
|
|
201
|
+
aria-hidden="true"
|
|
202
|
+
>…</span
|
|
203
|
+
>
|
|
204
|
+
}
|
|
205
|
+
</li>
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
<li>
|
|
209
|
+
<button
|
|
210
|
+
type="button"
|
|
211
|
+
[disabled]="page() >= total() || null"
|
|
212
|
+
[attr.aria-label]="nextAriaLabel()"
|
|
213
|
+
[class]="navClasses(nextText().length > 0)"
|
|
214
|
+
(click)="go(page() + 1)"
|
|
215
|
+
>
|
|
216
|
+
@if (nextText()) {
|
|
217
|
+
<span>{{ nextText() }}</span>
|
|
218
|
+
}
|
|
219
|
+
<svg
|
|
220
|
+
aria-hidden="true"
|
|
221
|
+
class="h-4 w-4"
|
|
222
|
+
viewBox="0 0 24 24"
|
|
223
|
+
fill="none"
|
|
224
|
+
stroke="currentColor"
|
|
225
|
+
stroke-width="2"
|
|
226
|
+
stroke-linecap="round"
|
|
227
|
+
stroke-linejoin="round"
|
|
228
|
+
>
|
|
229
|
+
<polyline points="9 18 15 12 9 6" />
|
|
230
|
+
</svg>
|
|
231
|
+
</button>
|
|
232
|
+
</li>
|
|
233
|
+
</ul>
|
|
234
|
+
`,
|
|
235
|
+
}]
|
|
236
|
+
}], propDecorators: { page: [{ type: i0.Input, args: [{ isSignal: true, alias: "page", required: false }] }, { type: i0.Output, args: ["pageChange"] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], siblingCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "siblingCount", required: false }] }], showPageNumbers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageNumbers", required: false }] }], previousText: [{ type: i0.Input, args: [{ isSignal: true, alias: "previousText", required: false }] }], nextText: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextText", required: false }] }], previousAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "previousAriaLabel", required: false }] }], nextAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextAriaLabel", required: false }] }], formatPageLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatPageLabel", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4
237
|
|
|
5
238
|
/**
|
|
6
239
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
export { PaginationComponent };
|