Skip to content

Commit d0c617f

Browse files
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.
1 parent 0231054 commit d0c617f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+320
-248
lines changed

button/_elevated-button.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
@forward './internal/elevated-button' show theme;
6+
@forward '../components/button/elevated-button';

button/_filled-button.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
@forward './internal/filled-button' show theme;
6+
@forward '../components/button/filled-button';

button/_filled-tonal-button.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
@forward './internal/filled-tonal-button' show theme;
6+
@forward '../components/button/filled-tonal-button';

button/_outlined-button.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
@forward './internal/outlined-button' show theme;
6+
@forward '../components/button/outlined-button';

button/_text-button.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
@forward './internal/text-button' show theme;
6+
@forward '../components/button/text-button';

button/elevated-button.ts

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,4 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import {CSSResultOrNative} from 'lit';
8-
import {customElement} from 'lit/decorators.js';
9-
10-
import {ElevatedButton} from './internal/elevated-button.js';
11-
import {styles as elevatedStyles} from './internal/elevated-styles.js';
12-
import {styles as sharedElevationStyles} from './internal/shared-elevation-styles.js';
13-
import {styles as sharedStyles} from './internal/shared-styles.js';
14-
15-
declare global {
16-
interface HTMLElementTagNameMap {
17-
'md-elevated-button': MdElevatedButton;
18-
}
19-
}
20-
21-
/**
22-
* @summary Buttons help people take action, such as sending an email, sharing a
23-
* document, or liking a comment.
24-
*
25-
* @description
26-
* __Emphasis:__ Medium emphasis – For important actions that don’t distract
27-
* from other onscreen elements.
28-
*
29-
* __Rationale:__ Elevated buttons are essentially filled buttons with a lighter
30-
* background color and a shadow. To prevent shadow creep, only use them when
31-
* absolutely necessary, such as when the button requires visual separation from
32-
* a patterned background.
33-
*
34-
* __Example usages:__
35-
* - Reply
36-
* - View all
37-
* - Add to cart
38-
* - Take out of trash
39-
*
40-
* @final
41-
* @suppress {visibility}
42-
*/
43-
@customElement('md-elevated-button')
44-
export class MdElevatedButton extends ElevatedButton {
45-
static override styles: CSSResultOrNative[] = [
46-
sharedStyles,
47-
sharedElevationStyles,
48-
elevatedStyles,
49-
];
50-
}
7+
export * from '../components/button/elevated-button.js';

button/filled-button.ts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,4 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import {CSSResultOrNative} from 'lit';
8-
import {customElement} from 'lit/decorators.js';
9-
10-
import {FilledButton} from './internal/filled-button.js';
11-
import {styles as filledStyles} from './internal/filled-styles.js';
12-
import {styles as sharedElevationStyles} from './internal/shared-elevation-styles.js';
13-
import {styles as sharedStyles} from './internal/shared-styles.js';
14-
15-
declare global {
16-
interface HTMLElementTagNameMap {
17-
'md-filled-button': MdFilledButton;
18-
}
19-
}
20-
21-
/**
22-
* @summary Buttons help people take action, such as sending an email, sharing a
23-
* document, or liking a comment.
24-
*
25-
* @description
26-
* __Emphasis:__ High emphasis – For the primary, most important, or most common
27-
* action on a screen
28-
*
29-
* __Rationale:__ The filled button’s contrasting surface color makes it the
30-
* most prominent button after the FAB. It’s used for final or unblocking
31-
* actions in a flow.
32-
*
33-
* __Example usages:__
34-
* - Save
35-
* - Confirm
36-
* - Done
37-
*
38-
* @final
39-
* @suppress {visibility}
40-
*/
41-
@customElement('md-filled-button')
42-
export class MdFilledButton extends FilledButton {
43-
static override styles: CSSResultOrNative[] = [
44-
sharedStyles,
45-
sharedElevationStyles,
46-
filledStyles,
47-
];
48-
}
7+
export * from '../components/button/filled-button.js';

button/filled-tonal-button.ts

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,4 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import {CSSResultOrNative} from 'lit';
8-
import {customElement} from 'lit/decorators.js';
9-
10-
import {FilledTonalButton} from './internal/filled-tonal-button.js';
11-
import {styles as tonalStyles} from './internal/filled-tonal-styles.js';
12-
import {styles as sharedElevationStyles} from './internal/shared-elevation-styles.js';
13-
import {styles as sharedStyles} from './internal/shared-styles.js';
14-
15-
declare global {
16-
interface HTMLElementTagNameMap {
17-
'md-filled-tonal-button': MdFilledTonalButton;
18-
}
19-
}
20-
21-
/**
22-
* @summary Buttons help people take action, such as sending an email, sharing a
23-
* document, or liking a comment.
24-
*
25-
* @description
26-
* __Emphasis:__ Medium emphasis – For important actions that don’t distract
27-
* from other onscreen elements.
28-
*
29-
* __Rationale:__ Filled tonal buttons have a lighter background color and
30-
* darker label color, making them less visually prominent than a regular,
31-
* filled button. They’re still used for final or unblocking actions in a flow,
32-
* but do so with less emphasis.
33-
*
34-
* __Example usages:__
35-
* - Save
36-
* - Confirm
37-
* - Done
38-
*
39-
* @final
40-
* @suppress {visibility}
41-
*/
42-
@customElement('md-filled-tonal-button')
43-
export class MdFilledTonalButton extends FilledTonalButton {
44-
static override styles: CSSResultOrNative[] = [
45-
sharedStyles,
46-
sharedElevationStyles,
47-
tonalStyles,
48-
];
49-
}
7+
export * from '../components/button/filled-tonal-button.js';

button/harness.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,4 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import {Harness} from '../testing/harness.js';
8-
9-
import {Button} from './internal/button.js';
10-
11-
/**
12-
* Test harness for buttons.
13-
*/
14-
export class ButtonHarness extends Harness<Button> {
15-
protected override async getInteractiveElement() {
16-
await this.element.updateComplete;
17-
return this.element.renderRoot.querySelector('.button') as HTMLElement;
18-
}
19-
}
7+
export * from '../components/button/harness.js';

button/outlined-button.ts

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,4 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import {CSSResultOrNative} from 'lit';
8-
import {customElement} from 'lit/decorators.js';
9-
10-
import {OutlinedButton} from './internal/outlined-button.js';
11-
import {styles as outlinedStyles} from './internal/outlined-styles.js';
12-
import {styles as sharedStyles} from './internal/shared-styles.js';
13-
14-
declare global {
15-
interface HTMLElementTagNameMap {
16-
'md-outlined-button': MdOutlinedButton;
17-
}
18-
}
19-
20-
/**
21-
* @summary Buttons help people take action, such as sending an email, sharing a
22-
* document, or liking a comment.
23-
*
24-
* @description
25-
* __Emphasis:__ Medium emphasis – For important actions that don’t distract
26-
* from other onscreen elements.
27-
*
28-
* __Rationale:__ Use an outlined button for actions that need attention but
29-
* aren’t the primary action, such as “See all” or “Add to cart.” This is also
30-
* the button to use for giving someone the opportunity to change their mind or
31-
* escape a flow.
32-
*
33-
* __Example usages:__
34-
* - Reply
35-
* - View all
36-
* - Add to cart
37-
* - Take out of trash
38-
*
39-
* @final
40-
* @suppress {visibility}
41-
*/
42-
@customElement('md-outlined-button')
43-
export class MdOutlinedButton extends OutlinedButton {
44-
static override styles: CSSResultOrNative[] = [sharedStyles, outlinedStyles];
45-
}
7+
export * from '../components/button/outlined-button.js';

0 commit comments

Comments
 (0)