Skip to content

Commit

Permalink
chore: internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 464164877
  • Loading branch information
material-web-copybara authored and copybara-github committed Jul 29, 2022
1 parent 2a0d563 commit 1ddcbba
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
25 changes: 25 additions & 0 deletions segmented_button/lib/_outlined-segmented-button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ $dark-theme: tokens.md-comp-outlined-segmented-button-values(
$theme,
$require-all: false
);
$theme: _extend-theme($theme);
$theme: segmented-button-theme.resolve-theme($theme, $resolvers);
$theme: theme.create-theme-vars($theme, 'segmented-button');

@include segmented-button-theme.container-start-padding(
map.get($theme, 'spacing-leading')
);
@include segmented-button-theme.container-end-padding(
map.get($theme, 'spacing-trailing')
);

@include segmented-button-theme.unselected-ripple(
(
'hover-state-layer-color':
Expand Down Expand Up @@ -140,3 +148,20 @@ $dark-theme: tokens.md-comp-outlined-segmented-button-values(
)
);
}

///
/// Applies missing tokens to the given theme. This is a temporary function
/// that will be deleted once the corresponding tokens are added to the design
/// system information.
///
@function _extend-theme($theme) {
// TODO(b/198759625): Remove spacing tokens once provided.
$theme: map.merge(
$theme,
(
'spacing-leading': 12px,
'spacing-trailing': 12px,
)
);
@return $theme;
}
18 changes: 18 additions & 0 deletions segmented_button/lib/_segmented-button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,24 @@
}
}

///
/// Container start padding sets the given padding as the starting padding for
/// the container. It uses CSS logical properties.
/// @param {Number} $padding - the padding to use.
///
@mixin container-start-padding($padding) {
padding-inline-start: $padding;
}

///
/// Container end padding sets the given padding as the ending padding for
/// the container. It uses CSS logical properties.
/// @param {Number} $padding - the padding to use.
///
@mixin container-end-padding($padding) {
padding-inline-end: $padding;
}

///
/// Icon label color sets the color of the icon.
/// @param {Color} $color - the color of the icon.
Expand Down
1 change: 0 additions & 1 deletion segmented_button/lib/_segmented-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
flex: 1;
justify-content: center;
outline: none;
padding: 0;
position: relative;
vertical-align: middle;
}
Expand Down
2 changes: 0 additions & 2 deletions segmented_button/lib/segmented-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export class SegmentedButton extends ActionElement {

/** @soyTemplate */
override render(): TemplateResult {
// TODO(b/219531586): Remove clickmod handler once resolved.
return html`
<button
tabindex="${this.disabled ? '-1' : '0'}"
Expand All @@ -123,7 +122,6 @@ export class SegmentedButton extends ActionElement {
@pointerleave="${this.handlePointerLeave}"
@pointerenter="${this.handlePointerEnter}"
@click="${this.handleClick}"
@clickmod="${this.handleClick}"
@contextmenu="${this.handleContextMenu}"
class="md3-segmented-button ${classMap(this.getRenderClasses())}">
${this.renderFocusRing()}
Expand Down

0 comments on commit 1ddcbba

Please sign in to comment.