Skip to content
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: Add border tokens and use rems for widths #1147

Merged
merged 11 commits into from
Mar 29, 2024
Prev Previous commit
Next Next commit
Implement border width tokens
  • Loading branch information
alimpens committed Mar 27, 2024
commit a37b8973e1961fb05536d4c2513278f0f91663a3
2 changes: 1 addition & 1 deletion packages/css/src/components/button/button.scss
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@

@mixin ams-button-forced-color-mode {
@media screen and (-ms-high-contrast: active), screen and (forced-colors: active) {
border: 2px solid ButtonBorder; // add border because forced colors changes box-shadow to none
border: var(--ams-button-forced-color-mode-border); // add border because forced colors changes box-shadow to none
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
}
}

8 changes: 4 additions & 4 deletions packages/css/src/components/checkbox/checkbox.scss
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
background-size: 1rem;
border-color: var(--ams-checkbox-checkmark-border-color);
border-style: solid;
border-width: 0.125rem;
border-width: var(--ams-checkbox-checkmark-border-width);
box-sizing: border-box;
content: "";
height: 1.5rem;
@@ -47,12 +47,12 @@
&:hover {
color: var(--ams-checkbox-hover-color);
text-decoration-line: underline;
text-decoration-thickness: 0.125rem;
text-decoration-thickness: var(--ams-checkbox-hover-text-decoration-thickness);
text-underline-offset: 0.375rem;

.ams-checkbox__checkmark::after {
border-color: var(--ams-checkbox-checkmark-hover-border-color);
border-width: 0.1875rem;
border-width: var(--ams-checkbox-checkmark-hover-border-width);
}
}

@@ -96,7 +96,7 @@

.ams-checkbox__checkmark::after {
border-color: var(--ams-checkbox-checkmark-disabled-border-color);
border-width: 0.125rem;
border-width: var(--ams-checkbox-checkmark-disabled-border-width);
}
}
}
6 changes: 3 additions & 3 deletions packages/css/src/components/radio/radio.scss
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
border-color: var(--ams-radio-circle-border-color);
border-radius: 100%;
border-style: solid;
border-width: 0.125rem;
border-width: var(--ams-radio-circle-border-width);
box-sizing: border-box;
content: "";
height: 1.5rem;
@@ -48,7 +48,7 @@
&:hover {
color: var(--ams-radio-hover-color);
text-decoration-line: underline;
text-decoration-thickness: 0.125rem;
text-decoration-thickness: var(--ams-radio-hover-text-decoration-thickness);
text-underline-offset: 0.375rem;

.ams-radio__circle::after {
@@ -81,7 +81,7 @@

.ams-radio__circle::after {
border-color: var(--ams-radio-circle-disabled-border-color);
border-width: 0.125rem;
border-width: var(--ams-radio-circle-disabled-border-width);
}
}
}
4 changes: 2 additions & 2 deletions proprietary/tokens/src/common/ams/link-appearance.tokens.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"ams": {
"link-appearance": {
"color": { "value": "{ams.color.primary-blue}" },
"text-decoration-thickness": { "value": "0.125rem" },
"text-decoration-thickness": { "value": "{ams.border-width.md}" },
"text-underline-offset": { "value": "0.375rem" },
"hover": {
"color": { "value": "{ams.color.dark-blue}" }
@@ -16,7 +16,7 @@
"regular": {
"text-decoration-line": { "value": "underline" },
"hover": {
"text-decoration-thickness": { "value": "0.1875rem" },
"text-decoration-thickness": { "value": "{ams.border-width.lg}" },
"text-underline-offset": { "value": "0.3125rem" }
}
},
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"outline-offset": { "value": "{ams.focus.outline-offset}" }
},
"hover": {
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.neutral-grey3}" }
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.neutral-grey3}" }
}
},
"panel": {
2 changes: 1 addition & 1 deletion proprietary/tokens/src/components/ams/alert.tokens.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ams": {
"alert": {
"border-width": { "value": "4px" },
"border-width": { "value": "{ams.border-width.xl}" },
"border-style": { "value": "solid" },
"gap": { "value": "1rem" },
"padding-block": { "value": "{ams.space.inside.md}" },
19 changes: 11 additions & 8 deletions proprietary/tokens/src/components/ams/button.tokens.json
Original file line number Diff line number Diff line change
@@ -12,41 +12,44 @@
"disabled": {
"cursor": { "value": "{ams.action.disabled.cursor}" }
},
"forced-color-mode": {
"border": { "value": "{ams.border-width.md} solid ButtonBorder" }
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
},
"primary": {
"background-color": { "value": "{ams.color.primary-blue}" },
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.primary-blue}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.primary-blue}" },
"color": { "value": "{ams.color.primary-white}" },
"disabled": {
"background-color": { "value": "{ams.color.neutral-grey2}" },
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.neutral-grey2}" }
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.neutral-grey2}" }
},
"hover": {
"background-color": { "value": "{ams.color.dark-blue}" },
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.dark-blue}" }
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.dark-blue}" }
}
},
"secondary": {
"background-color": { "value": "{ams.color.primary-white}" },
"color": { "value": "{ams.color.primary-blue}" },
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.primary-blue}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.primary-blue}" },
"hover": {
"box-shadow": { "value": "inset 0 0 0 3px {ams.color.dark-blue}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.lg} {ams.color.dark-blue}" },
"color": { "value": "{ams.color.dark-blue}" }
},
"disabled": {
"background-color": { "value": "{ams.color.primary-white}" },
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.neutral-grey2}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.neutral-grey2}" },
"color": { "value": "{ams.color.neutral-grey2}" }
},
"focus": {
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.primary-blue}" }
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.primary-blue}" }
}
},
"tertiary": {
"background-color": { "value": "transparent" },
"color": { "value": "{ams.color.primary-blue}" },
"hover": {
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.dark-blue}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.dark-blue}" },
"color": { "value": "{ams.color.dark-blue}" }
},
"disabled": {
8 changes: 6 additions & 2 deletions proprietary/tokens/src/components/ams/checkbox.tokens.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
"outline-offset": { "value": "{ams.focus.outline-offset}" },
"checkmark": {
"border-color": { "value": "{ams.color.primary-blue}" },
"border-width": { "value": "{ams.border-width.md}" },
"checked": {
"background-color": { "value": "{ams.color.primary-blue}" },
"background-image": {
@@ -20,6 +21,7 @@
},
"disabled": {
"border-color": { "value": "{ams.color.neutral-grey3}" },
"border-width": { "value": "{ams.border-width.md}" },
"checked": {
"background-color": { "value": "{ams.color.neutral-grey3}" },
"hover": {
@@ -34,7 +36,8 @@
}
},
"hover": {
"border-color": { "value": "{ams.color.dark-blue}" }
"border-color": { "value": "{ams.color.dark-blue}" },
"border-width": { "value": "{ams.border-width.lg}" }
},
"invalid": {
"border-color": { "value": "{ams.color.primary-red}" },
@@ -68,7 +71,8 @@
"color": { "value": "{ams.color.neutral-grey3}" }
},
"hover": {
"color": { "value": "{ams.color.dark-blue}" }
"color": { "value": "{ams.color.dark-blue}" },
"text-decoration-thickness": { "value": "{ams.border-width.md}" }
}
}
}
5 changes: 4 additions & 1 deletion proprietary/tokens/src/components/ams/radio.tokens.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
"outline-offset": { "value": "{ams.focus.outline-offset}" },
"circle": {
"border-color": { "value": "{ams.color.primary-blue}" },
"border-width": { "value": "{ams.border-width.md}" },
"checked": {
"background-image": {
"value": "url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg' fill='%23004699'%3E%3Ccircle cx='16' cy='16' r='16' /%3E%3C/svg%3E\")"
@@ -21,6 +22,7 @@
},
"disabled": {
"border-color": { "value": "{ams.color.neutral-grey3}" },
"border-width": { "value": "{ams.border-width.md}" },
"checked": {
"background-image": {
"value": "url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg' fill='%23767676'%3E%3Ccircle cx='16' cy='16' r='16' /%3E%3C/svg%3E\")"
@@ -56,7 +58,8 @@
"color": { "value": "{ams.color.neutral-grey3}" }
},
"hover": {
"color": { "value": "{ams.color.dark-blue}" }
"color": { "value": "{ams.color.dark-blue}" },
"text-decoration-thickness": { "value": "{ams.border-width.md}" }
}
}
}
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
},
"hover": {
"box-shadow": {
"value": "inset 0 0 0 2px {ams.color.primary-black}"
"value": "inset 0 0 0 {ams.border-width.md} {ams.color.primary-black}"
}
},
"placeholder": {
2 changes: 1 addition & 1 deletion proprietary/tokens/src/components/ams/table.tokens.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"font-weight": { "value": "{ams.text.font-weight.bold}" }
},
"cell": {
"border-bottom": { "value": "1px solid {ams.color.neutral-grey1}" },
"border-bottom": { "value": "{ams.border-width.sm} solid {ams.color.neutral-grey1}" },
"padding-block": { "value": "{ams.space.inside.md}" },
"padding-inline": { "value": "{ams.space.inside.md}" }
},
2 changes: 1 addition & 1 deletion proprietary/tokens/src/components/ams/tabs.tokens.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"ams": {
"tabs": {
"list": {
"border-bottom": { "value": ".125rem solid {ams.color.primary-blue}" }
"border-bottom": { "value": "{ams.border-width.md} solid {ams.color.primary-blue}" }
},
"button": {
"background-color": { "value": "transparent" },
10 changes: 5 additions & 5 deletions proprietary/tokens/src/components/ams/text-area.tokens.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ams": {
"text-area": {
"box-shadow": { "value": "inset 0 0 0 1px {ams.color.primary-black}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.sm} {ams.color.primary-black}" },
"color": { "value": "{ams.color.primary-black}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.6.font-size}" },
@@ -15,17 +15,17 @@
"padding-inline": { "value": "1rem" },
"disabled": {
"background-color": { "value": "{ams.color.primary-white}" },
"box-shadow": { "value": "inset 0 0 0 1px {ams.color.neutral-grey2}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.sm} {ams.color.neutral-grey2}" },
"color": { "value": "{ams.color.neutral-grey2}" },
"cursor": { "value": "{ams.action.disabled.cursor}" }
},
"hover": {
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.primary-black}" }
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.primary-black}" }
},
"invalid": {
"box-shadow": { "value": "inset 0 0 0 1px {ams.color.primary-red}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.sm} {ams.color.primary-red}" },
"hover": {
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.primary-red}" }
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.primary-red}" }
}
},
"placeholder": {
10 changes: 5 additions & 5 deletions proprietary/tokens/src/components/ams/text-input.tokens.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ams": {
"text-input": {
"box-shadow": { "value": "inset 0 0 0 1px {ams.color.primary-black}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.sm} {ams.color.primary-black}" },
"color": { "value": "{ams.color.primary-black}" },
"font-family": { "value": "{ams.text.font-family}" },
"font-size": { "value": "{ams.text.level.6.font-size}" },
@@ -12,16 +12,16 @@
"padding-inline": { "value": "{ams.space.inside.md}" },
"disabled": {
"background-color": { "value": "{ams.color.primary-white}" },
"box-shadow": { "value": "inset 0 0 0 1px {ams.color.neutral-grey2}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.sm} {ams.color.neutral-grey2}" },
"color": { "value": "{ams.color.neutral-grey2}" }
},
"hover": {
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.primary-black}" }
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.primary-black}" }
},
"invalid": {
"box-shadow": { "value": "inset 0 0 0 1px {ams.color.primary-red}" },
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.sm} {ams.color.primary-red}" },
"hover": {
"box-shadow": { "value": "inset 0 0 0 2px {ams.color.primary-red}" }
"box-shadow": { "value": "inset 0 0 0 {ams.border-width.md} {ams.color.primary-red}" }
}
},
"placeholder": {