Skip to content

Commit

Permalink
feat(cdk/private): create cdk-visually-hidden style loader (#29757)
Browse files Browse the repository at this point in the history
* feat(cdk/private): create cdk-visually-hidden style loader

* fixup! feat(cdk/private): create cdk-visually-hidden style loader

* fixup! feat(cdk/private): create cdk-visually-hidden style loader

* fixup! feat(cdk/private): create cdk-visually-hidden style loader

* fixup! feat(cdk/private): create cdk-visually-hidden style loader

* fixup! feat(cdk/private): create cdk-visually-hidden style loader

* fixup! feat(cdk/private): create cdk-visually-hidden style loader

* fixup! feat(cdk/private): create cdk-visually-hidden style loader
  • Loading branch information
wagnermaciel authored Sep 20, 2024
1 parent d206225 commit 9b4085c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cdk/private/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"])

Expand All @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions src/cdk/private/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*/

export * from './style-loader';
export * from './visually-hidden/visually-hidden';
3 changes: 3 additions & 0 deletions src/cdk/private/visually-hidden/visually-hidden.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@use '../../a11y';

@include a11y.a11y-visually-hidden();
23 changes: 23 additions & 0 deletions src/cdk/private/visually-hidden/visually-hidden.ts
Original file line number Diff line number Diff line change
@@ -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 {}
8 changes: 8 additions & 0 deletions tools/public_api_guard/cdk/private.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

```

0 comments on commit 9b4085c

Please sign in to comment.