diff --git a/src/cdk/private/BUILD.bazel b/src/cdk/private/BUILD.bazel index 38f01837d965..eb6b535b4e9c 100644 --- a/src/cdk/private/BUILD.bazel +++ b/src/cdk/private/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "markdown_to_html", "ng_module") +load("//tools:defaults.bzl", "markdown_to_html", "ng_module", "sass_binary") package(default_visibility = ["//visibility:public"]) @@ -8,11 +8,18 @@ ng_module( ["**/*.ts"], exclude = ["**/*.spec.ts"], ), + assets = [":visually-hidden-styles"], deps = [ "@npm//@angular/core", ], ) +sass_binary( + name = "visually-hidden-styles", + src = ":visually-hidden/visually-hidden.scss", + deps = ["//src/cdk/a11y:a11y_scss_lib"], +) + markdown_to_html( name = "overview", srcs = [":private.md"], diff --git a/src/cdk/private/public-api.ts b/src/cdk/private/public-api.ts index 927bf9b787bb..daa7b818d389 100644 --- a/src/cdk/private/public-api.ts +++ b/src/cdk/private/public-api.ts @@ -7,3 +7,4 @@ */ export * from './style-loader'; +export * from './visually-hidden/visually-hidden'; diff --git a/src/cdk/private/visually-hidden/visually-hidden.scss b/src/cdk/private/visually-hidden/visually-hidden.scss new file mode 100644 index 000000000000..b987a303a0d6 --- /dev/null +++ b/src/cdk/private/visually-hidden/visually-hidden.scss @@ -0,0 +1,3 @@ +@use '../../a11y'; + +@include a11y.a11y-visually-hidden(); diff --git a/src/cdk/private/visually-hidden/visually-hidden.ts b/src/cdk/private/visually-hidden/visually-hidden.ts new file mode 100644 index 000000000000..ee66313df900 --- /dev/null +++ b/src/cdk/private/visually-hidden/visually-hidden.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.dev/license + */ + +import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; + +/** + * Component used to load the .cdk-visually-hidden styles. + * @docs-private + */ +@Component({ + standalone: true, + styleUrl: 'visually-hidden.css', + exportAs: 'cdkVisuallyHidden', + encapsulation: ViewEncapsulation.None, + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class _VisuallyHiddenLoader {} diff --git a/tools/public_api_guard/cdk/private.md b/tools/public_api_guard/cdk/private.md index ea81817331a0..5c224e0c338d 100644 --- a/tools/public_api_guard/cdk/private.md +++ b/tools/public_api_guard/cdk/private.md @@ -16,6 +16,14 @@ export class _CdkPrivateStyleLoader { static ɵprov: i0.ɵɵInjectableDeclaration<_CdkPrivateStyleLoader>; } +// @public +export class _VisuallyHiddenLoader { + // (undocumented) + static ɵcmp: i0.ɵɵComponentDeclaration<_VisuallyHiddenLoader, "ng-component", ["cdkVisuallyHidden"], {}, {}, never, never, true, never>; + // (undocumented) + static ɵfac: i0.ɵɵFactoryDeclaration<_VisuallyHiddenLoader, never>; +} + // (No @packageDocumentation comment for this package) ```