From d0c617fdd7ce775739e0bb161fdbd303a446a45a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 19:25:30 +0000 Subject: [PATCH] chore: migrate button component to components/button Moves the `button` component to `components/button` and creates re-exports in the original `button` directory for backward compatibility. This change also updates internal imports and includes copyright headers in the re-export files. --- button/_elevated-button.scss | 2 +- button/_filled-button.scss | 2 +- button/_filled-tonal-button.scss | 2 +- button/_outlined-button.scss | 2 +- button/_text-button.scss | 2 +- button/elevated-button.ts | 45 +---------------- button/filled-button.ts | 43 +--------------- button/filled-tonal-button.ts | 44 +--------------- button/harness.ts | 14 +----- button/outlined-button.ts | 40 +-------------- button/text-button.ts | 38 +------------- components/button/_elevated-button.scss | 6 +++ components/button/_filled-button.scss | 6 +++ components/button/_filled-tonal-button.scss | 6 +++ components/button/_outlined-button.scss | 6 +++ components/button/_text-button.scss | 6 +++ {button => components/button}/demo/demo.ts | 0 .../button}/demo/project.json | 0 {button => components/button}/demo/stories.ts | 0 components/button/elevated-button.ts | 50 +++++++++++++++++++ .../button}/elevated-button_test.ts | 2 +- components/button/filled-button.ts | 48 ++++++++++++++++++ .../button}/filled-button_test.ts | 2 +- components/button/filled-tonal-button.ts | 49 ++++++++++++++++++ .../button}/filled-tonal-button_test.ts | 2 +- components/button/harness.ts | 19 +++++++ .../button}/internal/_elevated-button.scss | 2 +- .../button}/internal/_elevation.scss | 4 +- .../button}/internal/_filled-button.scss | 2 +- .../internal/_filled-tonal-button.scss | 2 +- .../button}/internal/_icon.scss | 0 .../button}/internal/_outlined-button.scss | 2 +- .../button}/internal/_shared.scss | 4 +- .../button}/internal/_text-button.scss | 2 +- .../button}/internal/_touch-target.scss | 0 .../button}/internal/button.ts | 14 +++--- .../button}/internal/button_test.ts | 2 +- .../button}/internal/elevated-button.ts | 2 +- .../button}/internal/elevated-styles.scss | 0 .../button}/internal/filled-button.ts | 2 +- .../button}/internal/filled-styles.scss | 0 .../button}/internal/filled-tonal-button.ts | 2 +- .../button}/internal/filled-tonal-styles.scss | 0 .../button}/internal/outlined-button.ts | 0 .../button}/internal/outlined-styles.scss | 0 .../internal/shared-elevation-styles.scss | 0 .../button}/internal/shared-styles.scss | 0 .../button}/internal/text-button.ts | 0 .../button}/internal/text-styles.scss | 0 components/button/outlined-button.ts | 45 +++++++++++++++++ .../button}/outlined-button_test.ts | 2 +- components/button/text-button.ts | 43 ++++++++++++++++ .../button}/text-button_test.ts | 2 +- 53 files changed, 320 insertions(+), 248 deletions(-) create mode 100644 components/button/_elevated-button.scss create mode 100644 components/button/_filled-button.scss create mode 100644 components/button/_filled-tonal-button.scss create mode 100644 components/button/_outlined-button.scss create mode 100644 components/button/_text-button.scss rename {button => components/button}/demo/demo.ts (100%) rename {button => components/button}/demo/project.json (100%) rename {button => components/button}/demo/stories.ts (100%) create mode 100644 components/button/elevated-button.ts rename {button => components/button}/elevated-button_test.ts (84%) create mode 100644 components/button/filled-button.ts rename {button => components/button}/filled-button_test.ts (83%) create mode 100644 components/button/filled-tonal-button.ts rename {button => components/button}/filled-tonal-button_test.ts (84%) create mode 100644 components/button/harness.ts rename {button => components/button}/internal/_elevated-button.scss (97%) rename {button => components/button}/internal/_elevation.scss (95%) rename {button => components/button}/internal/_filled-button.scss (97%) rename {button => components/button}/internal/_filled-tonal-button.scss (97%) rename {button => components/button}/internal/_icon.scss (100%) rename {button => components/button}/internal/_outlined-button.scss (98%) rename {button => components/button}/internal/_shared.scss (98%) rename {button => components/button}/internal/_text-button.scss (97%) rename {button => components/button}/internal/_touch-target.scss (100%) rename {button => components/button}/internal/button.ts (94%) rename {button => components/button}/internal/button_test.ts (97%) rename {button => components/button}/internal/elevated-button.ts (89%) rename {button => components/button}/internal/elevated-styles.scss (100%) rename {button => components/button}/internal/filled-button.ts (89%) rename {button => components/button}/internal/filled-styles.scss (100%) rename {button => components/button}/internal/filled-tonal-button.ts (89%) rename {button => components/button}/internal/filled-tonal-styles.scss (100%) rename {button => components/button}/internal/outlined-button.ts (100%) rename {button => components/button}/internal/outlined-styles.scss (100%) rename {button => components/button}/internal/shared-elevation-styles.scss (100%) rename {button => components/button}/internal/shared-styles.scss (100%) rename {button => components/button}/internal/text-button.ts (100%) rename {button => components/button}/internal/text-styles.scss (100%) create mode 100644 components/button/outlined-button.ts rename {button => components/button}/outlined-button_test.ts (84%) create mode 100644 components/button/text-button.ts rename {button => components/button}/text-button_test.ts (83%) diff --git a/button/_elevated-button.scss b/button/_elevated-button.scss index 355e9140b0..7a6a1c011f 100644 --- a/button/_elevated-button.scss +++ b/button/_elevated-button.scss @@ -3,4 +3,4 @@ // SPDX-License-Identifier: Apache-2.0 // -@forward './internal/elevated-button' show theme; +@forward '../components/button/elevated-button'; diff --git a/button/_filled-button.scss b/button/_filled-button.scss index 30a41885fa..1c68cfdb33 100644 --- a/button/_filled-button.scss +++ b/button/_filled-button.scss @@ -3,4 +3,4 @@ // SPDX-License-Identifier: Apache-2.0 // -@forward './internal/filled-button' show theme; +@forward '../components/button/filled-button'; diff --git a/button/_filled-tonal-button.scss b/button/_filled-tonal-button.scss index e3a7100982..d1f8505364 100644 --- a/button/_filled-tonal-button.scss +++ b/button/_filled-tonal-button.scss @@ -3,4 +3,4 @@ // SPDX-License-Identifier: Apache-2.0 // -@forward './internal/filled-tonal-button' show theme; +@forward '../components/button/filled-tonal-button'; diff --git a/button/_outlined-button.scss b/button/_outlined-button.scss index c88dd6f35c..0524be27c3 100644 --- a/button/_outlined-button.scss +++ b/button/_outlined-button.scss @@ -3,4 +3,4 @@ // SPDX-License-Identifier: Apache-2.0 // -@forward './internal/outlined-button' show theme; +@forward '../components/button/outlined-button'; diff --git a/button/_text-button.scss b/button/_text-button.scss index 52947c3f6c..941c65448c 100644 --- a/button/_text-button.scss +++ b/button/_text-button.scss @@ -3,4 +3,4 @@ // SPDX-License-Identifier: Apache-2.0 // -@forward './internal/text-button' show theme; +@forward '../components/button/text-button'; diff --git a/button/elevated-button.ts b/button/elevated-button.ts index bde0945696..3300393a1a 100644 --- a/button/elevated-button.ts +++ b/button/elevated-button.ts @@ -4,47 +4,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {CSSResultOrNative} from 'lit'; -import {customElement} from 'lit/decorators.js'; - -import {ElevatedButton} from './internal/elevated-button.js'; -import {styles as elevatedStyles} from './internal/elevated-styles.js'; -import {styles as sharedElevationStyles} from './internal/shared-elevation-styles.js'; -import {styles as sharedStyles} from './internal/shared-styles.js'; - -declare global { - interface HTMLElementTagNameMap { - 'md-elevated-button': MdElevatedButton; - } -} - -/** - * @summary Buttons help people take action, such as sending an email, sharing a - * document, or liking a comment. - * - * @description - * __Emphasis:__ Medium emphasis – For important actions that don’t distract - * from other onscreen elements. - * - * __Rationale:__ Elevated buttons are essentially filled buttons with a lighter - * background color and a shadow. To prevent shadow creep, only use them when - * absolutely necessary, such as when the button requires visual separation from - * a patterned background. - * - * __Example usages:__ - * - Reply - * - View all - * - Add to cart - * - Take out of trash - * - * @final - * @suppress {visibility} - */ -@customElement('md-elevated-button') -export class MdElevatedButton extends ElevatedButton { - static override styles: CSSResultOrNative[] = [ - sharedStyles, - sharedElevationStyles, - elevatedStyles, - ]; -} +export * from '../components/button/elevated-button.js'; diff --git a/button/filled-button.ts b/button/filled-button.ts index 6bc04686e8..b19eaf6014 100644 --- a/button/filled-button.ts +++ b/button/filled-button.ts @@ -4,45 +4,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {CSSResultOrNative} from 'lit'; -import {customElement} from 'lit/decorators.js'; - -import {FilledButton} from './internal/filled-button.js'; -import {styles as filledStyles} from './internal/filled-styles.js'; -import {styles as sharedElevationStyles} from './internal/shared-elevation-styles.js'; -import {styles as sharedStyles} from './internal/shared-styles.js'; - -declare global { - interface HTMLElementTagNameMap { - 'md-filled-button': MdFilledButton; - } -} - -/** - * @summary Buttons help people take action, such as sending an email, sharing a - * document, or liking a comment. - * - * @description - * __Emphasis:__ High emphasis – For the primary, most important, or most common - * action on a screen - * - * __Rationale:__ The filled button’s contrasting surface color makes it the - * most prominent button after the FAB. It’s used for final or unblocking - * actions in a flow. - * - * __Example usages:__ - * - Save - * - Confirm - * - Done - * - * @final - * @suppress {visibility} - */ -@customElement('md-filled-button') -export class MdFilledButton extends FilledButton { - static override styles: CSSResultOrNative[] = [ - sharedStyles, - sharedElevationStyles, - filledStyles, - ]; -} +export * from '../components/button/filled-button.js'; diff --git a/button/filled-tonal-button.ts b/button/filled-tonal-button.ts index fe71e14fb9..933495c2fa 100644 --- a/button/filled-tonal-button.ts +++ b/button/filled-tonal-button.ts @@ -4,46 +4,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {CSSResultOrNative} from 'lit'; -import {customElement} from 'lit/decorators.js'; - -import {FilledTonalButton} from './internal/filled-tonal-button.js'; -import {styles as tonalStyles} from './internal/filled-tonal-styles.js'; -import {styles as sharedElevationStyles} from './internal/shared-elevation-styles.js'; -import {styles as sharedStyles} from './internal/shared-styles.js'; - -declare global { - interface HTMLElementTagNameMap { - 'md-filled-tonal-button': MdFilledTonalButton; - } -} - -/** - * @summary Buttons help people take action, such as sending an email, sharing a - * document, or liking a comment. - * - * @description - * __Emphasis:__ Medium emphasis – For important actions that don’t distract - * from other onscreen elements. - * - * __Rationale:__ Filled tonal buttons have a lighter background color and - * darker label color, making them less visually prominent than a regular, - * filled button. They’re still used for final or unblocking actions in a flow, - * but do so with less emphasis. - * - * __Example usages:__ - * - Save - * - Confirm - * - Done - * - * @final - * @suppress {visibility} - */ -@customElement('md-filled-tonal-button') -export class MdFilledTonalButton extends FilledTonalButton { - static override styles: CSSResultOrNative[] = [ - sharedStyles, - sharedElevationStyles, - tonalStyles, - ]; -} +export * from '../components/button/filled-tonal-button.js'; diff --git a/button/harness.ts b/button/harness.ts index d7268aeb16..64fca792c8 100644 --- a/button/harness.ts +++ b/button/harness.ts @@ -4,16 +4,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {Harness} from '../testing/harness.js'; - -import {Button} from './internal/button.js'; - -/** - * Test harness for buttons. - */ -export class ButtonHarness extends Harness