@ojiepermana/angular 22.1.11 → 22.1.13
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 +374 -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
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
Displays a callout for user attention.
|
|
4
|
+
|
|
5
|
+
Use Alert for inline status callouts, destructive warnings, upgrade prompts, and other situations where the message should stay anchored in the current page flow.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
AlertActionComponent,
|
|
12
|
+
AlertComponent,
|
|
13
|
+
AlertDescriptionComponent,
|
|
14
|
+
AlertTitleComponent,
|
|
15
|
+
} from '@ojiepermana/angular/component/alert';
|
|
16
|
+
import { ButtonComponent } from '@ojiepermana/angular/component/button';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Composition
|
|
20
|
+
|
|
21
|
+
The Angular structure mirrors the shadcn composition while leaving icon choice to the consuming app.
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
Alert
|
|
25
|
+
├── svg (optional icon)
|
|
26
|
+
├── AlertTitle
|
|
27
|
+
├── AlertDescription
|
|
28
|
+
└── AlertAction (optional)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<Alert class="max-w-md">
|
|
35
|
+
<svg aria-hidden="true" class="size-4"><!-- icon --></svg>
|
|
36
|
+
<AlertTitle>Heads up!</AlertTitle>
|
|
37
|
+
<AlertDescription>
|
|
38
|
+
You can add components and dependencies to your app using the CLI.
|
|
39
|
+
</AlertDescription>
|
|
40
|
+
</Alert>
|
|
41
|
+
|
|
42
|
+
<Alert class="max-w-md">
|
|
43
|
+
<AlertTitle>Dark mode is now available</AlertTitle>
|
|
44
|
+
<AlertDescription> Enable it under your profile settings to get started. </AlertDescription>
|
|
45
|
+
<AlertAction>
|
|
46
|
+
<button Button variant="outline" size="sm">Enable</button>
|
|
47
|
+
</AlertAction>
|
|
48
|
+
</Alert>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Common patterns
|
|
52
|
+
|
|
53
|
+
### Basic
|
|
54
|
+
|
|
55
|
+
Use an optional icon plus title and description for successful or informative states.
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<Alert class="max-w-md">
|
|
59
|
+
<svg aria-hidden="true" class="size-4"><!-- success icon --></svg>
|
|
60
|
+
<AlertTitle>Account updated successfully</AlertTitle>
|
|
61
|
+
<AlertDescription>
|
|
62
|
+
Your profile information has been saved. Changes will be reflected immediately.
|
|
63
|
+
</AlertDescription>
|
|
64
|
+
</Alert>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Destructive
|
|
68
|
+
|
|
69
|
+
Apply `variant="destructive"` for failures, expired sessions, and other high-priority issues.
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<Alert variant="destructive" class="max-w-md">
|
|
73
|
+
<svg aria-hidden="true" class="size-4"><!-- warning icon --></svg>
|
|
74
|
+
<AlertTitle>Payment failed</AlertTitle>
|
|
75
|
+
<AlertDescription>
|
|
76
|
+
Your payment could not be processed. Please check your payment method and try again.
|
|
77
|
+
</AlertDescription>
|
|
78
|
+
</Alert>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Action
|
|
82
|
+
|
|
83
|
+
Wrap a trailing control in `AlertAction`. The wrapper aligns the control at the end of the message and anchors it to the top-right on wider layouts.
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<Alert class="max-w-md">
|
|
87
|
+
<AlertTitle>Dark mode is now available</AlertTitle>
|
|
88
|
+
<AlertDescription> Enable it under your profile settings to get started. </AlertDescription>
|
|
89
|
+
<AlertAction>
|
|
90
|
+
<button Button variant="default" size="sm">Enable</button>
|
|
91
|
+
</AlertAction>
|
|
92
|
+
</Alert>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Custom colors
|
|
96
|
+
|
|
97
|
+
Pass custom classes to the root when the alert should adopt a contextual palette.
|
|
98
|
+
|
|
99
|
+
```html
|
|
100
|
+
<Alert class="max-w-md border-amber-300 bg-amber-50 text-amber-950 [&>svg]:text-amber-700">
|
|
101
|
+
<svg aria-hidden="true" class="size-4"><!-- warning icon --></svg>
|
|
102
|
+
<AlertTitle>Your subscription will expire in 3 days.</AlertTitle>
|
|
103
|
+
<AlertDescription>
|
|
104
|
+
Renew now to avoid service interruption or upgrade to a paid plan to continue using the service.
|
|
105
|
+
</AlertDescription>
|
|
106
|
+
</Alert>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### RTL
|
|
110
|
+
|
|
111
|
+
For right-to-left interfaces, place the alert inside a container with `dir="rtl"` or manage direction globally in the app shell.
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<section dir="rtl" lang="ar" class="max-w-md text-right">
|
|
115
|
+
<Alert>
|
|
116
|
+
<svg aria-hidden="true" class="size-4"><!-- icon --></svg>
|
|
117
|
+
<AlertTitle>تم الدفع بنجاح</AlertTitle>
|
|
118
|
+
<AlertDescription>
|
|
119
|
+
تمت معالجة دفعتك البالغة 29.99 دولارًا. تم إرسال إيصال إلى عنوان بريدك الإلكتروني.
|
|
120
|
+
</AlertDescription>
|
|
121
|
+
</Alert>
|
|
122
|
+
</section>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## API reference
|
|
126
|
+
|
|
127
|
+
### `AlertComponent`
|
|
128
|
+
|
|
129
|
+
| Input | Type | Default |
|
|
130
|
+
| --------- | ---------------------------- | ----------- |
|
|
131
|
+
| `variant` | `'default' \| 'destructive'` | `'default'` |
|
|
132
|
+
| `class` | `string` | `''` |
|
|
133
|
+
|
|
134
|
+
### `AlertTitleComponent`
|
|
135
|
+
|
|
136
|
+
| Input | Type | Default |
|
|
137
|
+
| ------- | -------- | ------- |
|
|
138
|
+
| `class` | `string` | `''` |
|
|
139
|
+
|
|
140
|
+
### `AlertDescriptionComponent`
|
|
141
|
+
|
|
142
|
+
| Input | Type | Default |
|
|
143
|
+
| ------- | -------- | ------- |
|
|
144
|
+
| `class` | `string` | `''` |
|
|
145
|
+
|
|
146
|
+
### `AlertActionComponent`
|
|
147
|
+
|
|
148
|
+
| Input | Type | Default |
|
|
149
|
+
| ------- | -------- | ------- |
|
|
150
|
+
| `class` | `string` | `''` |
|
|
151
|
+
|
|
152
|
+
### Parts
|
|
153
|
+
|
|
154
|
+
- `AlertTitle` renders the heading of the callout.
|
|
155
|
+
- `AlertDescription` renders the supporting copy.
|
|
156
|
+
- `AlertAction` is an optional layout wrapper for a trailing button or link.
|
|
157
|
+
|
|
158
|
+
Re-export: `alertVariants` and `AlertVariant`.
|
|
159
|
+
|
|
160
|
+
## Styling and theming
|
|
161
|
+
|
|
162
|
+
Tokens consumed: `--border`, `--background`, `--foreground`, `--destructive`.
|
|
163
|
+
Leading SVG children are auto-positioned via descendant selectors so an icon slots in cleanly without extra wrapper markup.
|
|
164
|
+
|
|
165
|
+
Pass `class` to the root when you need wider layouts, custom color treatments, or embedded card styling. Pass `class` to the title, description, or action parts when a specific example needs spacing or typography overrides.
|
|
166
|
+
|
|
167
|
+
## Accessibility
|
|
168
|
+
|
|
169
|
+
The root has `role="alert"` so assistive technologies announce the message when
|
|
170
|
+
it appears. For polite, non-interrupting messages, prefer a toast or another live-region pattern instead.
|
|
171
|
+
|
|
172
|
+
When you include a call-to-action, keep the control a native `<button Button>` or `<a Button>` so standard keyboard and assistive-technology behavior remains intact.
|
|
173
|
+
|
|
174
|
+
## Keyboard interactions
|
|
175
|
+
|
|
176
|
+
The alert itself does not handle keyboard input. Any nested actions inherit native keyboard behavior from the projected button or link.
|
|
177
|
+
|
|
178
|
+
## Angular notes
|
|
179
|
+
|
|
180
|
+
The Angular version keeps the same shadcn parts while translating them to standalone imports, `input()` bindings, and utility-first host classes. Icons are application-level concerns, so bring your own icon component or inline SVG instead of expecting an icon export from the alert primitive.
|
|
181
|
+
|
|
182
|
+
## Source parity
|
|
183
|
+
|
|
184
|
+
This implementation follows the shadcn Alert structure and examples while adapting the API to Angular selectors, standalone imports, and the local button primitive for action content.
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Alert Dialog
|
|
2
|
+
|
|
3
|
+
Displays a modal confirmation surface for important or destructive actions where the user is expected to respond before continuing.
|
|
4
|
+
|
|
5
|
+
Use Alert Dialog for delete confirmations, permission prompts, and share or access decisions that should not dismiss accidentally on backdrop click.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
AlertDialogActionComponent,
|
|
12
|
+
AlertDialogCancelComponent,
|
|
13
|
+
AlertDialogComponent,
|
|
14
|
+
AlertDialogContentComponent,
|
|
15
|
+
AlertDialogDescriptionComponent,
|
|
16
|
+
AlertDialogFooterComponent,
|
|
17
|
+
AlertDialogHeaderComponent,
|
|
18
|
+
AlertDialogMediaComponent,
|
|
19
|
+
AlertDialogTitleComponent,
|
|
20
|
+
} from '@ojiepermana/angular/component/alert-dialog';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Composition
|
|
24
|
+
|
|
25
|
+
The Angular composition keeps the shadcn structure for content and actions, with one intentional mapping difference: shadcn `AlertDialogTrigger` becomes any external control that toggles the `open` signal.
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
button[Button] (external trigger; sets the open signal)
|
|
29
|
+
AlertDialog
|
|
30
|
+
└── AlertDialogContent
|
|
31
|
+
├── AlertDialogHeader
|
|
32
|
+
│ ├── AlertDialogMedia (optional)
|
|
33
|
+
│ ├── AlertDialogTitle
|
|
34
|
+
│ └── AlertDialogDescription
|
|
35
|
+
└── AlertDialogFooter
|
|
36
|
+
├── button[AlertDialogCancel]
|
|
37
|
+
└── button[AlertDialogAction]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Basic usage
|
|
41
|
+
|
|
42
|
+
Use an external trigger to set the `open` model, then declare the alert content inside `AlertDialog`.
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<button type="button" Button variant="outline" (click)="confirmOpen.set(true)">Show Dialog</button>
|
|
46
|
+
|
|
47
|
+
<AlertDialog
|
|
48
|
+
[(open)]="confirmOpen"
|
|
49
|
+
aria-labelledby="alert-title"
|
|
50
|
+
aria-describedby="alert-description"
|
|
51
|
+
>
|
|
52
|
+
<AlertDialogContent>
|
|
53
|
+
<AlertDialogHeader>
|
|
54
|
+
<AlertDialogTitle id="alert-title">Are you absolutely sure?</AlertDialogTitle>
|
|
55
|
+
<AlertDialogDescription id="alert-description">
|
|
56
|
+
This action cannot be undone. This will permanently delete your account from our servers.
|
|
57
|
+
</AlertDialogDescription>
|
|
58
|
+
</AlertDialogHeader>
|
|
59
|
+
|
|
60
|
+
<AlertDialogFooter>
|
|
61
|
+
<button type="button" AlertDialogCancel>Cancel</button>
|
|
62
|
+
<button type="button" AlertDialogAction>Continue</button>
|
|
63
|
+
</AlertDialogFooter>
|
|
64
|
+
</AlertDialogContent>
|
|
65
|
+
</AlertDialog>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Common patterns
|
|
69
|
+
|
|
70
|
+
### Small confirmation
|
|
71
|
+
|
|
72
|
+
Set `size="sm"` on `AlertDialogContent` for shorter mobile-friendly confirmations.
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<AlertDialog [(open)]="smallOpen">
|
|
76
|
+
<AlertDialogContent size="sm">
|
|
77
|
+
<AlertDialogHeader>
|
|
78
|
+
<AlertDialogTitle>Allow accessory to connect?</AlertDialogTitle>
|
|
79
|
+
<AlertDialogDescription>
|
|
80
|
+
Do you want to allow the USB accessory to connect to this device?
|
|
81
|
+
</AlertDialogDescription>
|
|
82
|
+
</AlertDialogHeader>
|
|
83
|
+
|
|
84
|
+
<AlertDialogFooter>
|
|
85
|
+
<button type="button" AlertDialogCancel>Don't allow</button>
|
|
86
|
+
<button type="button" AlertDialogAction>Allow</button>
|
|
87
|
+
</AlertDialogFooter>
|
|
88
|
+
</AlertDialogContent>
|
|
89
|
+
</AlertDialog>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Media
|
|
93
|
+
|
|
94
|
+
Use `AlertDialogMedia` to add an icon or other leading visual treatment above the title on mobile and beside it on larger screens.
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<AlertDialog [(open)]="shareOpen">
|
|
98
|
+
<AlertDialogContent>
|
|
99
|
+
<AlertDialogHeader>
|
|
100
|
+
<AlertDialogMedia>
|
|
101
|
+
<svg
|
|
102
|
+
viewBox="0 0 24 24"
|
|
103
|
+
fill="none"
|
|
104
|
+
stroke="currentColor"
|
|
105
|
+
stroke-width="1.75"
|
|
106
|
+
aria-hidden="true"
|
|
107
|
+
>
|
|
108
|
+
<path d="M12 5v14" />
|
|
109
|
+
<path d="M5 12h14" />
|
|
110
|
+
<circle cx="12" cy="12" r="8" />
|
|
111
|
+
</svg>
|
|
112
|
+
</AlertDialogMedia>
|
|
113
|
+
<AlertDialogTitle>Share this project?</AlertDialogTitle>
|
|
114
|
+
<AlertDialogDescription>
|
|
115
|
+
Anyone with the link will be able to view and edit this project.
|
|
116
|
+
</AlertDialogDescription>
|
|
117
|
+
</AlertDialogHeader>
|
|
118
|
+
|
|
119
|
+
<AlertDialogFooter>
|
|
120
|
+
<button type="button" AlertDialogCancel>Cancel</button>
|
|
121
|
+
<button type="button" AlertDialogAction>Share</button>
|
|
122
|
+
</AlertDialogFooter>
|
|
123
|
+
</AlertDialogContent>
|
|
124
|
+
</AlertDialog>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Destructive action
|
|
128
|
+
|
|
129
|
+
Pass `variant="destructive"` to `AlertDialogAction` when the primary action is destructive.
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<AlertDialog [(open)]="deleteOpen">
|
|
133
|
+
<AlertDialogContent size="sm">
|
|
134
|
+
<AlertDialogHeader>
|
|
135
|
+
<AlertDialogMedia class="border-destructive/20 bg-destructive/10 text-destructive">
|
|
136
|
+
<svg
|
|
137
|
+
viewBox="0 0 24 24"
|
|
138
|
+
fill="none"
|
|
139
|
+
stroke="currentColor"
|
|
140
|
+
stroke-width="1.75"
|
|
141
|
+
aria-hidden="true"
|
|
142
|
+
>
|
|
143
|
+
<path d="M3 6h18" />
|
|
144
|
+
<path d="M8 6V4h8v2" />
|
|
145
|
+
<path d="M8 10v6" />
|
|
146
|
+
<path d="M12 10v6" />
|
|
147
|
+
<path d="M16 10v6" />
|
|
148
|
+
<path d="M5 6l1 13h12l1-13" />
|
|
149
|
+
</svg>
|
|
150
|
+
</AlertDialogMedia>
|
|
151
|
+
<AlertDialogTitle>Delete chat?</AlertDialogTitle>
|
|
152
|
+
<AlertDialogDescription>
|
|
153
|
+
This permanently deletes the conversation and removes saved memories linked to it.
|
|
154
|
+
</AlertDialogDescription>
|
|
155
|
+
</AlertDialogHeader>
|
|
156
|
+
|
|
157
|
+
<AlertDialogFooter>
|
|
158
|
+
<button type="button" AlertDialogCancel>Cancel</button>
|
|
159
|
+
<button type="button" AlertDialogAction variant="destructive">Delete</button>
|
|
160
|
+
</AlertDialogFooter>
|
|
161
|
+
</AlertDialogContent>
|
|
162
|
+
</AlertDialog>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### RTL
|
|
166
|
+
|
|
167
|
+
Wrap the trigger and dialog in a `dir="rtl"` container or manage direction globally in the app shell.
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<div dir="rtl" lang="ar" class="text-right">
|
|
171
|
+
<button type="button" Button variant="outline" (click)="rtlOpen.set(true)">إظهار الحوار</button>
|
|
172
|
+
|
|
173
|
+
<AlertDialog [(open)]="rtlOpen" aria-labelledby="rtl-title" aria-describedby="rtl-description">
|
|
174
|
+
<AlertDialogContent size="sm">
|
|
175
|
+
<AlertDialogHeader>
|
|
176
|
+
<AlertDialogTitle id="rtl-title">هل أنت متأكد تمامًا؟</AlertDialogTitle>
|
|
177
|
+
<AlertDialogDescription id="rtl-description">
|
|
178
|
+
لا يمكن التراجع عن هذا الإجراء. سيؤدي هذا إلى حذف حسابك نهائيًا من خوادمنا.
|
|
179
|
+
</AlertDialogDescription>
|
|
180
|
+
</AlertDialogHeader>
|
|
181
|
+
<AlertDialogFooter>
|
|
182
|
+
<button type="button" AlertDialogCancel>إلغاء</button>
|
|
183
|
+
<button type="button" AlertDialogAction>متابعة</button>
|
|
184
|
+
</AlertDialogFooter>
|
|
185
|
+
</AlertDialogContent>
|
|
186
|
+
</AlertDialog>
|
|
187
|
+
</div>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## API reference
|
|
191
|
+
|
|
192
|
+
### `AlertDialogComponent`
|
|
193
|
+
|
|
194
|
+
| Input | Type | Default |
|
|
195
|
+
| ---------------------- | ---------------- | --------- |
|
|
196
|
+
| `open` (model) | `boolean` | `false` |
|
|
197
|
+
| `closeOnEscape` | `boolean` | `true` |
|
|
198
|
+
| `closeOnBackdropClick` | `boolean` | `false` |
|
|
199
|
+
| `showCloseButton` | `boolean` | `false` |
|
|
200
|
+
| `closeButtonLabel` | `string` | `'Close'` |
|
|
201
|
+
| `aria-labelledby` | `string \| null` | `null` |
|
|
202
|
+
| `aria-describedby` | `string \| null` | `null` |
|
|
203
|
+
| `class` | `string` | `''` |
|
|
204
|
+
|
|
205
|
+
Output: `openedChange: boolean`. Method: `close()`.
|
|
206
|
+
|
|
207
|
+
### `AlertDialogContentComponent`
|
|
208
|
+
|
|
209
|
+
| Input | Type | Default |
|
|
210
|
+
| ------- | ------------------- | ----------- |
|
|
211
|
+
| `size` | `'default' \| 'sm'` | `'default'` |
|
|
212
|
+
| `class` | `string` | `''` |
|
|
213
|
+
|
|
214
|
+
### Parts
|
|
215
|
+
|
|
216
|
+
| Part | Purpose |
|
|
217
|
+
| --------------------------- | ------------------------------------------------------------------ |
|
|
218
|
+
| `AlertDialogHeader` | Title, optional media, and supporting copy wrapper |
|
|
219
|
+
| `AlertDialogTitle` | Primary label announced when the dialog opens |
|
|
220
|
+
| `AlertDialogDescription` | Supporting copy announced after the title |
|
|
221
|
+
| `AlertDialogMedia` | Optional icon or visual cue for the decision |
|
|
222
|
+
| `AlertDialogFooter` | Action row |
|
|
223
|
+
| `button[AlertDialogCancel]` | Secondary action with outline styling that closes the dialog |
|
|
224
|
+
| `button[AlertDialogAction]` | Primary action that closes the dialog and supports button variants |
|
|
225
|
+
|
|
226
|
+
Lower-level behavior is based on the Radix Alert Dialog pattern: <https://www.radix-ui.com/primitives/docs/components/alert-dialog#api-reference>.
|
|
227
|
+
|
|
228
|
+
## Styling and theming
|
|
229
|
+
|
|
230
|
+
The surface reuses the shared dialog overlay and theme tokens, while the action parts reuse the same `buttonVariants` definitions as `Button`.
|
|
231
|
+
|
|
232
|
+
Pass `class` to `AlertDialog` when you need custom max width or spacing, `size="sm"` to `AlertDialogContent` for compact confirmations, and `class` to `AlertDialogMedia` when a specific tone such as destructive emphasis is needed.
|
|
233
|
+
|
|
234
|
+
## Accessibility
|
|
235
|
+
|
|
236
|
+
- The surface renders with `role="dialog"` and `aria-modal="true"`.
|
|
237
|
+
- Focus is trapped while the alert dialog is open and restored to the previously active element when it closes.
|
|
238
|
+
- Backdrop click is disabled by default so confirmations do not dismiss accidentally.
|
|
239
|
+
- Keep `AlertDialogTitle` and `AlertDialogDescription` short and descriptive so assistive technologies announce useful context immediately.
|
|
240
|
+
|
|
241
|
+
## Keyboard interactions
|
|
242
|
+
|
|
243
|
+
- `Tab` and `Shift+Tab` stay inside the modal while it is open.
|
|
244
|
+
- `Escape` closes the alert dialog unless `closeOnEscape` is disabled.
|
|
245
|
+
- Native button activation handles `Enter` and `Space` for cancel and action buttons.
|
|
246
|
+
|
|
247
|
+
## Angular notes
|
|
248
|
+
|
|
249
|
+
- This implementation intentionally maps shadcn `AlertDialogTrigger` to any external trigger that owns the `open` signal.
|
|
250
|
+
- `button[AlertDialogCancel]` and `button[AlertDialogAction]` close the nearest ancestor alert dialog automatically by default.
|
|
251
|
+
- Use `(click)` on the action button for side effects such as deleting or sharing, and keep `closeOnClick` enabled unless the flow needs to wait for an async result.
|
|
252
|
+
|
|
253
|
+
## Source parity
|
|
254
|
+
|
|
255
|
+
This Angular implementation keeps the shadcn information architecture, examples, and `size="sm"` content behavior while translating trigger ownership to Angular signals and dedicated attribute components for the footer actions.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Aspect Ratio
|
|
2
|
+
|
|
3
|
+
Displays content within a fixed width-to-height ratio.
|
|
4
|
+
|
|
5
|
+
Use Aspect Ratio for image frames, media placeholders, thumbnail cards, and any layout where the container height should derive from the available width.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { AspectRatioComponent } from '@ojiepermana/angular/component/aspect-ratio';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Bind a numeric ratio with `[ratio]`. The host renders as a block-level container with `position: relative`, so projected children can fill the box with `h-full w-full` or positioned overlays.
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<div class="w-full max-w-sm">
|
|
19
|
+
<AspectRatio [ratio]="16 / 9" class="overflow-hidden rounded-lg border border-border bg-muted/30">
|
|
20
|
+
<img
|
|
21
|
+
src="https://avatar.vercel.sh/shadcn1"
|
|
22
|
+
alt="Demo media"
|
|
23
|
+
class="h-full w-full object-cover"
|
|
24
|
+
/>
|
|
25
|
+
</AspectRatio>
|
|
26
|
+
</div>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Common patterns
|
|
30
|
+
|
|
31
|
+
### Landscape media
|
|
32
|
+
|
|
33
|
+
Use `16 / 9` for hero images, video posters, and card thumbnails.
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<div class="max-w-sm">
|
|
37
|
+
<AspectRatio [ratio]="16 / 9" class="overflow-hidden rounded-lg bg-muted">
|
|
38
|
+
<img src="..." alt="Landscape" class="h-full w-full object-cover" />
|
|
39
|
+
</AspectRatio>
|
|
40
|
+
</div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Square avatars or gallery tiles
|
|
44
|
+
|
|
45
|
+
Use `1` for square media slots.
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<div class="max-w-48">
|
|
49
|
+
<AspectRatio [ratio]="1" class="overflow-hidden rounded-xl bg-muted">
|
|
50
|
+
<img src="..." alt="Square tile" class="h-full w-full object-cover" />
|
|
51
|
+
</AspectRatio>
|
|
52
|
+
</div>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Portrait cards
|
|
56
|
+
|
|
57
|
+
Use `9 / 16` when the design calls for tall image treatments.
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<div class="max-w-40">
|
|
61
|
+
<AspectRatio [ratio]="9 / 16" class="overflow-hidden rounded-xl bg-muted">
|
|
62
|
+
<img src="..." alt="Portrait tile" class="h-full w-full object-cover" />
|
|
63
|
+
</AspectRatio>
|
|
64
|
+
</div>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Figure with caption
|
|
68
|
+
|
|
69
|
+
Keep captions outside the ratio box so the media height stays stable while text can grow naturally.
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<figure class="max-w-sm">
|
|
73
|
+
<AspectRatio [ratio]="16 / 9" class="overflow-hidden rounded-lg border border-border bg-muted/30">
|
|
74
|
+
<img src="..." alt="Beautiful landscape" class="h-full w-full object-cover" />
|
|
75
|
+
</AspectRatio>
|
|
76
|
+
<figcaption class="mt-2 text-sm text-muted-foreground">Beautiful landscape</figcaption>
|
|
77
|
+
</figure>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## API reference
|
|
81
|
+
|
|
82
|
+
### `AspectRatioComponent`
|
|
83
|
+
|
|
84
|
+
| Input | Type | Default | Description |
|
|
85
|
+
| ------- | -------- | -------- | ------------------------------------------------------------------------------------------- |
|
|
86
|
+
| `ratio` | `number` | required | The desired width-to-height ratio. Use Angular expressions like `16 / 9`, `1`, or `9 / 16`. |
|
|
87
|
+
| `class` | `string` | `''` | Additional utility classes for the host container. |
|
|
88
|
+
|
|
89
|
+
## Styling and theming
|
|
90
|
+
|
|
91
|
+
Base host classes: `relative block w-full`.
|
|
92
|
+
|
|
93
|
+
Pass utility classes for rounded corners, borders, backgrounds, shadows, and max width. Add `overflow-hidden` when the projected media should be clipped to the container radius. The projected child should usually use `h-full w-full object-cover` for image-like content.
|
|
94
|
+
|
|
95
|
+
## Accessibility
|
|
96
|
+
|
|
97
|
+
Aspect Ratio has no built-in semantics beyond its host element. Accessibility comes from the projected content.
|
|
98
|
+
|
|
99
|
+
- Provide meaningful `alt` text for images.
|
|
100
|
+
- Prefer `<figure>` and `<figcaption>` when media needs visible labeling.
|
|
101
|
+
- Do not place essential text only inside a background image.
|
|
102
|
+
|
|
103
|
+
## Keyboard interactions
|
|
104
|
+
|
|
105
|
+
Aspect Ratio has no keyboard interaction. It should not receive focus unless the projected content contains an interactive control.
|
|
106
|
+
|
|
107
|
+
## Angular notes
|
|
108
|
+
|
|
109
|
+
- Import `AspectRatioComponent` directly into the standalone component that owns the media layout.
|
|
110
|
+
- Use `[ratio]` with a numeric Angular expression instead of a React prop like `ratio={16 / 9}`.
|
|
111
|
+
- The component uses a block-level custom element so width utilities such as `w-full` and `max-w-sm` behave predictably.
|
|
112
|
+
- The projected content is wrapped in an absolute fill container so overlays and full-height media stay aligned with the ratio box.
|
|
113
|
+
|
|
114
|
+
## Source parity
|
|
115
|
+
|
|
116
|
+
This Angular implementation follows the shadcn Aspect Ratio examples for landscape, square, portrait, and RTL-friendly media layouts while translating React props and fill behavior to Angular bindings and projected content.
|