-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@next][badge] refactor to use design tokens (#463)
- Loading branch information
Showing
22 changed files
with
445 additions
and
432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import '$src/shared'; | ||
import '@tylertech/forge/badge'; | ||
import '@tylertech/forge/icon-button'; | ||
import { tylIconNotifications } from '@tylertech/tyler-icons/standard'; | ||
import { IconRegistry } from '@tylertech/forge/icon'; | ||
import { tylIconHeart } from '@tylertech/tyler-icons/extended'; | ||
|
||
IconRegistry.define([tylIconHeart, tylIconNotifications]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@use './token-utils' as *; | ||
@use '../core/styles/typography'; | ||
|
||
@forward './token-utils'; | ||
|
||
@mixin host { | ||
display: flex; | ||
box-sizing: border-box; | ||
} | ||
|
||
@mixin base { | ||
@include typography.style(label); | ||
|
||
background: #{token(background)}; | ||
color: #{token(color)}; | ||
|
||
height: #{token(height)}; | ||
min-width: #{token(min-width)}; | ||
max-width: #{token(max-width)}; | ||
|
||
border-width: #{token(border-width)}; | ||
border-style: #{token(border-style)}; | ||
border-color: #{token(border-color)}; | ||
|
||
display: inline-flex; | ||
align-items: center; | ||
gap: #{token(gap)}; | ||
border-radius: #{token(shape)}; | ||
padding-inline: #{token(padding-inline)}; | ||
padding-block: #{token(padding-block)}; | ||
overflow: hidden; | ||
box-sizing: border-box; | ||
|
||
pointer-events: none; | ||
|
||
transition: transform #{token(transition-duration)} #{token(transition-easing)}; | ||
|
||
font-weight: #{token(font-weight)}; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
@mixin dot { | ||
@include override(height, dot-height); | ||
@include override(min-width, auto, value); | ||
|
||
padding: #{token(dot-padding)}; | ||
width: #{token(dot-width)}; | ||
} | ||
|
||
@mixin hide { | ||
transform: scale(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@use '../core/styles/tokens/badge/tokens'; | ||
@use '../core/styles/tokens/token-utils'; | ||
|
||
$_module: badge; | ||
$_tokens: tokens.$tokens; | ||
|
||
@mixin provide-theme($theme) { | ||
@include token-utils.provide-theme($_module, $_tokens, $theme); | ||
} | ||
|
||
@function token($name, $type: token) { | ||
@return token-utils.token($_module, $_tokens, $name, $type); | ||
} | ||
|
||
@function declare($token) { | ||
@return token-utils.declare($_module, $token); | ||
} | ||
|
||
@mixin override($token, $token-or-value, $type: token) { | ||
@include token-utils.override($_module, $_tokens, $token, $token-or-value, $type); | ||
} | ||
|
||
@mixin tokens($includes: null, $excludes: null) { | ||
@include token-utils.tokens($_module, $_tokens, $includes, $excludes); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
import { COMPONENT_NAME_PREFIX } from '../constants'; | ||
import { COMPONENT_NAME_PREFIX, Theme } from '../constants'; | ||
|
||
const elementName: keyof HTMLElementTagNameMap = `${COMPONENT_NAME_PREFIX}badge`; | ||
|
||
const attributes = { | ||
DOT: 'dot', | ||
OPEN: 'open', | ||
HIDE: 'hide', | ||
THEME: 'theme', | ||
STRONG: 'strong' | ||
}; | ||
|
||
const classes = { | ||
DOT: 'forge-badge--dot', | ||
OPEN: 'forge-badge--open' | ||
OPEN: 'open' | ||
}; | ||
|
||
const selectors = { | ||
ROOT: '.forge-badge' | ||
}; | ||
|
||
const defaults = { | ||
THEME: 'default' as BadgeTheme | ||
}; | ||
|
||
export const BADGE_CONSTANTS = { | ||
elementName, | ||
attributes, | ||
selectors, | ||
classes, | ||
selectors | ||
defaults | ||
}; | ||
|
||
export type BadgeTheme = Theme | 'default' | 'info-primary' | 'info-secondary' | 'danger'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<template> | ||
<div class="forge-badge forge-badge--open" part="root"> | ||
<slot name="leading"></slot> | ||
<div class="forge-badge" part="root"> | ||
<slot name="start"></slot> | ||
<slot></slot> | ||
<slot name="trailing"></slot> | ||
<slot name="end"></slot> | ||
</div> | ||
</template> |
Oops, something went wrong.