-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(chip): add recipe and variables #30873
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
Draft
thetaPC
wants to merge
12
commits into
ionic-modular
Choose a base branch
from
FW-6833
base: ionic-modular
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,461
−92
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e729dea
feat(chip): add recipe and variables
thetaPC 0d6bd9d
Update core/src/components/chip/chip.tsx
thetaPC ade5c05
Update core/src/utils/theme.ts
thetaPC 0349ff7
Update core/src/utils/theme.ts
thetaPC ee81a8a
fix(theme): remove extra curly bracket
thetaPC c6dfb10
refactor(theme): remove root
thetaPC e795c61
chore(components): run build
thetaPC 39bfce5
chore(many): run lint
thetaPC b67f4f5
test(theme): add more generateComponentsThemeCSS tests
thetaPC 9ecb103
Update core/src/themes/mixins.scss
thetaPC 7040091
refactor(theme): seperate objects
thetaPC 098cba4
feat(chip): adding ionic theme
thetaPC 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 hidden or 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 hidden or 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,232 @@ | ||
| @use "../../themes/mixins" as mixins; | ||
| @use "../../themes/functions.color" as colors; | ||
| @use "./chip.base.vars.scss" as vars; | ||
| @use "sass:meta"; | ||
|
|
||
| // Chip: Common Styles | ||
| // -------------------------------------------------- | ||
|
|
||
| :host { | ||
| /** | ||
| * @prop --background: Background of the chip | ||
| * @prop --border-radius: Border radius of the chip | ||
| * @prop --color: Color of the chip | ||
| * @prop --focus-ring-color: Color of the focus ring | ||
| * @prop --focus-ring-width: Width of the focus ring | ||
| */ | ||
| --focus-ring-color: #{vars.$chip-focus-ring-color}; | ||
| --focus-ring-width: #{vars.$chip-focus-ring-width}; | ||
|
|
||
| @include mixins.font-smoothing(); | ||
| @include mixins.border-radius(var(--border-radius)); | ||
| @include mixins.margin(vars.$chip-margin); | ||
| @include mixins.padding(vars.$chip-padding-vertical, vars.$chip-padding-horizontal); | ||
| @include mixins.typography(vars.$chip-typography); | ||
|
|
||
| display: inline-flex; | ||
| position: relative; | ||
|
|
||
| align-items: center; | ||
| justify-content: center; | ||
|
|
||
| background: var(--background); | ||
| color: var(--color); | ||
|
|
||
| line-height: vars.$chip-line-height; | ||
|
|
||
| cursor: pointer; | ||
| overflow: hidden; | ||
| vertical-align: middle; | ||
| box-sizing: border-box; | ||
|
|
||
| gap: vars.$chip-gap; | ||
| } | ||
|
|
||
| // Chip Sizes | ||
| // --------------------------------------------- | ||
|
|
||
| :host(.chip-small) { | ||
| min-height: vars.$chip-size-small-height; | ||
|
|
||
| font-size: vars.$chip-size-small-font-size; | ||
| } | ||
|
|
||
| :host(.chip-large) { | ||
| min-height: vars.$chip-size-large-height; | ||
|
|
||
| font-size: vars.$chip-size-large-font-size; | ||
| } | ||
|
|
||
| // Chip Shapes | ||
| // --------------------------------------------- | ||
|
|
||
| :host(.chip-soft) { | ||
| --border-radius: #{vars.$chip-border-radius-soft}; | ||
| } | ||
|
|
||
| :host(.chip-round) { | ||
| --border-radius: #{vars.$chip-border-radius-round}; | ||
| } | ||
|
|
||
| :host(.chip-rectangular) { | ||
| --border-radius: #{vars.$chip-border-radius-rectangular}; | ||
| } | ||
|
|
||
| // Chip Hues | ||
| // --------------------------------------------- | ||
|
|
||
| // Bold | ||
| :host(.chip-bold) { | ||
| --background: #{vars.$chip-hue-bold-bg}; | ||
| --color: #{vars.$chip-hue-bold-color}; | ||
| } | ||
|
|
||
| :host(.chip-bold.chip-outline) { | ||
| border-color: #{vars.$chip-hue-bold-outline-border-color}; | ||
| } | ||
|
|
||
| // Subtle | ||
| :host(.chip-subtle) { | ||
| --background: #{vars.$chip-hue-subtle-bg}; | ||
| --color: #{vars.$chip-hue-subtle-color}; | ||
| } | ||
|
|
||
| :host(.chip-subtle.chip-outline) { | ||
| border-color: #{vars.$chip-hue-subtle-outline-border-color}; | ||
| } | ||
|
|
||
| // Chip Colors | ||
| // --------------------------------------------- | ||
|
|
||
| // Bold | ||
| :host(.ion-color.chip-bold) { | ||
| background: colors.current-color(base, vars.$chip-hue-bold-semantic-bg-alpha); | ||
| color: vars.$chip-hue-bold-semantic-color; | ||
| } | ||
|
|
||
| :host(.ion-color.chip-bold.chip-outline) { | ||
| border-color: vars.$chip-hue-bold-semantic-outline-border-color; | ||
|
|
||
| background: vars.$chip-outline-bold-semantic-bg; //native would be transparent, else it would be whatevers in ion-color.chip-bold | ||
| } | ||
|
|
||
| // Subtle | ||
| :host(.ion-color.chip-subtle) { | ||
| background: colors.current-color(base, $subtle: true); | ||
| color: colors.current-color(contrast, $subtle: true); | ||
| } | ||
|
|
||
| :host(.ion-color.chip-subtle.chip-outline) { | ||
| border-color: colors.current-color(shade, $subtle: true); | ||
|
|
||
| background: vars.$chip-outline-subtle-semantic-bg; | ||
| } | ||
|
|
||
| // Outline Chip | ||
| // --------------------------------------------- | ||
|
|
||
| :host(.chip-outline) { | ||
| border-width: vars.$chip-outline-border-width; | ||
| border-style: solid; | ||
| } | ||
|
|
||
| // Chip States | ||
| // --------------------------------------------- | ||
|
|
||
| // Disabled | ||
| :host(.chip-disabled) { | ||
| cursor: default; | ||
| opacity: vars.$chip-state-disabled-opacity; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| // Focus | ||
| :host(.ion-focused) { | ||
| --background: #{vars.$chip-focus-bg}; | ||
|
|
||
| @include mixins.focused-state(var(--focus-ring-width), $color: var(--focus-ring-color)); | ||
| } | ||
|
|
||
| :host(.ion-focused.ion-color) { | ||
| background: vars.$chip-focus-semantic-bg; | ||
| } | ||
|
|
||
| :host(.ion-focused.chip-outline:not(.ion-color)) { | ||
| background: vars.$chip-outline-focus-bg; | ||
| } | ||
|
|
||
| // Activated | ||
| :host(.ion-activated) { | ||
| --background: #{vars.$chip-activated-bg}; | ||
| } | ||
|
|
||
| :host(.ion-activated.ion-color) { | ||
| background: vars.$chip-activated-semantic-bg; | ||
| } | ||
|
|
||
| // Hover | ||
| @media (any-hover: hover) { | ||
| :host(:hover) { | ||
| --background: #{vars.$chip-hover-bg}; | ||
| } | ||
|
|
||
| :host(.ion-color:hover) { | ||
| background: vars.$chip-hover-semantic-bg; | ||
| } | ||
|
|
||
| :host(.chip-outline:not(.ion-color):hover) { | ||
| background: vars.$chip-outline-hover-bg; | ||
| } | ||
| } | ||
|
|
||
| // Chip Slotted Elements | ||
| // --------------------------------------------- | ||
|
|
||
| // Icon | ||
| ::slotted(ion-icon) { | ||
| font-size: vars.$chip-icon-size; | ||
| } | ||
|
|
||
| :host(:not(.ion-color)) ::slotted(ion-icon) { | ||
| color: vars.$chip-icon-color; | ||
| } | ||
|
|
||
| ::slotted(ion-icon:first-child) { | ||
| @include mixins.margin( | ||
| vars.$chip-icon-first-child-margin, | ||
| vars.$chip-icon-first-child-margin-end, | ||
| $start: vars.$chip-icon-first-child-margin | ||
| ); | ||
| } | ||
|
|
||
| ::slotted(ion-icon:last-child) { | ||
| @include mixins.margin(vars.$chip-icon-last-child-margin, $start: vars.$chip-icon-last-child-margin-start); | ||
| } | ||
|
|
||
| // Avatar | ||
| ::slotted(ion-avatar) { | ||
| // width: vars.$chip-avatar-size; | ||
| // height: vars.$chip-avatar-size; | ||
| // @error vars.$chip-avatar-size; | ||
| @if vars.$chip-avatar-size != "unset" { | ||
| width: vars.$chip-avatar-size; | ||
| height: vars.$chip-avatar-size; | ||
| } | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| ::slotted(ion-avatar:first-child) { | ||
| @include mixins.margin( | ||
| vars.$chip-avatar-first-child-margin-vertical, | ||
| $end: vars.$chip-avatar-first-child-margin-end, | ||
| $start: vars.$chip-avatar-first-child-margin-start | ||
| ); | ||
| } | ||
|
|
||
| ::slotted(ion-avatar:last-child) { | ||
| @include mixins.margin( | ||
| vars.$chip-avatar-last-child-margin-vertical, | ||
| $end: vars.$chip-avatar-last-child-margin-end, | ||
| $start: vars.$chip-avatar-last-child-margin-start | ||
| ); | ||
| } | ||
Oops, something went wrong.
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.
The font family for chip on
ionic-modularand this branch do not match when it comes to theionictheme. Theionictheme usesion-body-sm-mediumto set the typography for chip. This variable includes font family with the value of-apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol". This is exactly what is being rendered on this branch. However, theionic-modularrenders it with a value ofvar(--ion-font-family, inherit). Based on my investigation,ionic-modularandnextare not loading the correct font family. This branch fixes it.