-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(rating): add component tokens #11150
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0b6dfad
feat(rating): add component tokens
aPreciado88 f92268f
feat(rating): update token descriptions
aPreciado88 291ca3e
feat(rating): update token descriptions
aPreciado88 940ef9a
feat(rating): update token descriptions
aPreciado88 8d55d3a
feat(rating): update css token names
aPreciado88 556d50d
feat(rating): add css token e2e tests
aPreciado88 ef207ca
feat(rating): fix merge conflicts
aPreciado88 6cc7075
test(rating): add test for spacing tokens
alisonailea d3f03ee
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 fe053ff
Merge branch 'dev' of github.com:Esri/calcite-design-system into aPre…
aPreciado88 419ca27
feat(rating): update e2e token tests
aPreciado88 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -3,7 +3,13 @@ | |
* | ||
* These properties can be overridden using the component's tag as selector. | ||
* | ||
* @prop --calcite-rating-spacing-unit: The amount of left and right margin spacing between each rating star. | ||
* @prop --calcite-rating-spacing-unit: [Deprecated] Use `--calcite-rating-spacing`. Specifies the amount of left and right margin spacing between each item. | ||
* @prop --calcite-rating-spacing: Specifies the amount of left and right margin spacing between each item. | ||
* @prop --calcite-rating-color-hover: Specifies the component's item color when hovered or selected. | ||
* @prop --calcite-rating-color: Specifies the component's item color. | ||
* @prop --calcite-rating-average-color: Specifies the component's item color when average is set. | ||
* @prop --calcite-rating-average-text-color: Specifies the component's average text color. | ||
* @prop --calcite-rating-count-text-color: Specifies the component's count text color. | ||
*/ | ||
|
||
:host { | ||
|
@@ -15,17 +21,17 @@ | |
|
||
:host([scale="s"]) { | ||
@apply h-6; | ||
--calcite-rating-spacing-unit: theme("spacing.1"); | ||
--calcite-internal-rating-spacing: theme("spacing.1"); | ||
} | ||
|
||
:host([scale="m"]) { | ||
@apply h-8; | ||
--calcite-rating-spacing-unit: theme("spacing.2"); | ||
--calcite-internal-rating-spacing: theme("spacing.2"); | ||
} | ||
|
||
:host([scale="l"]) { | ||
@apply h-11; | ||
--calcite-rating-spacing-unit: theme("spacing.3"); | ||
--calcite-internal-rating-spacing: theme("spacing.3"); | ||
} | ||
|
||
:host([read-only]) { | ||
|
@@ -38,7 +44,7 @@ | |
border-width: 0; | ||
padding: 0; | ||
align-items: center; | ||
gap: var(--calcite-rating-spacing-unit); | ||
gap: var(--calcite-rating-spacing, var(--calcite-internal-rating-spacing)); | ||
} | ||
|
||
.wrapper { | ||
|
@@ -51,20 +57,20 @@ | |
display: flex; | ||
flex-direction: column; | ||
cursor: pointer; | ||
color: theme("borderColor.color.input"); | ||
color: var(--calcite-rating-color, theme("borderColor.color.input")); | ||
&:focus { | ||
@apply focus-outset; | ||
} | ||
} | ||
|
||
.average, | ||
.fraction { | ||
color: theme("colors.warning"); | ||
color: var(--calcite-rating-average-color, theme("colors.warning")); | ||
} | ||
|
||
.hovered, | ||
.selected { | ||
color: theme("colors.brand"); | ||
color: var(--calcite-rating-color-hover, theme("colors.brand")); | ||
} | ||
|
||
.fraction { | ||
|
@@ -84,13 +90,14 @@ calcite-chip { | |
|
||
.number--average { | ||
font-weight: bold; | ||
color: var(--calcite-rating-average-text-color); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the purpose of this token? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
.number--count { | ||
color: var(--calcite-color-text-2); | ||
color: var(--calcite-rating-count-text-color, var(--calcite-color-text-2)); | ||
font-style: italic; | ||
&:not(:first-child) { | ||
margin-inline-start: var(--calcite-rating-spacing-unit); | ||
margin-inline-start: var(--calcite-rating-spacing, var(--calcite-internal-rating-spacing)); | ||
} | ||
} | ||
|
||
|
11 changes: 11 additions & 0 deletions
11
packages/calcite-components/src/components/rating/resources.ts
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,14 @@ | ||
export const CSS = { | ||
fieldSet: "fieldset", | ||
star: "star", | ||
hovered: "hovered", | ||
selected: "selected", | ||
average: "average", | ||
fraction: "fraction", | ||
numberAverage: "number--average", | ||
numberCount: "number--count", | ||
}; | ||
|
||
export const IDS = { | ||
validationMessage: "validationMessage", | ||
}; |
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,12 @@ | ||
import { html } from "../../support/formatting"; | ||
|
||
export const ratingTokens = { | ||
calciteRatingSpacing: "", | ||
calciteRatingColorHover: "", | ||
calciteRatingColor: "", | ||
calciteRatingAverageColor: "", | ||
calciteRatingAverageTextColor: "", | ||
calciteRatingCountTextColor: "", | ||
}; | ||
|
||
export const rating = html`<calcite-rating></calcite-rating>`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add tests for the other vars?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added tests for the other tokens. I'm having issues testing
--calcite-rating-spacing
, could you please take a look?cc @driskull @alisonailea