Skip to content

Commit

Permalink
feat(chips): add suggestion chips
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 516878268
  • Loading branch information
asyncLiz authored and copybara-github committed Mar 15, 2023
1 parent 06bdb86 commit f3fe55e
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chips/_suggestion-chip.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//
// Copyright 2023 Google LLC
// SPDX-License-Identifier: Apache-2.0
//

@forward './lib/suggestion-chip' show theme;
35 changes: 35 additions & 0 deletions chips/lib/_suggestion-chip.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright 2023 Google LLC
// SPDX-License-Identifier: Apache-2.0
//

// go/keep-sorted start
@use '../../sass/shape';
@use '../../sass/theme';
@use '../../tokens';
@use './shared';
// go/keep-sorted end

@mixin theme($tokens) {
$tokens: theme.validate-theme(
shared.resolve-tokens(tokens.md-comp-suggestion-chip-values()),
shared.resolve-tokens($tokens)
);
$tokens: theme.create-theme-vars($tokens, 'suggestion-chip');
$tokens: shape.resolve-tokens($tokens, 'container-shape');

@include theme.emit-theme-vars($tokens);
}

@mixin styles() {
$tokens: tokens.md-comp-suggestion-chip-values();
$tokens: shared.resolve-tokens($tokens);
$tokens: theme.create-theme-vars($tokens, 'suggestion-chip');
$tokens: shape.resolve-tokens($tokens, 'container-shape');

:host {
@each $token, $value in $tokens {
--_#{$token}: #{$value};
}
}
}
12 changes: 12 additions & 0 deletions chips/lib/suggestion-chip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import {Chip} from './chip.js';

/**
* A suggestion chip component.
*/
export class SuggestionChip extends Chip {}
10 changes: 10 additions & 0 deletions chips/lib/suggestion-styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Copyright 2023 Google LLC
// SPDX-License-Identifier: Apache-2.0
//

// go/keep-sorted start
@use './suggestion-chip';
// go/keep-sorted end

@include suggestion-chip.styles;
28 changes: 28 additions & 0 deletions chips/suggestion-chip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import {customElement} from 'lit/decorators.js';

import {styles as sharedStyles} from './lib/shared-styles.css.js';
import {SuggestionChip} from './lib/suggestion-chip.js';
import {styles} from './lib/suggestion-styles.css.js';

declare global {
interface HTMLElementTagNameMap {
'md-suggestion-chip': MdSuggestionChip;
}
}

/**
* TODO(b/243982145): add docs
*
* @final
* @suppress {visibility}
*/
@customElement('md-suggestion-chip')
export class MdSuggestionChip extends SuggestionChip {
static override styles = [sharedStyles, styles];
}

0 comments on commit f3fe55e

Please sign in to comment.