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

[BD-46] refactor: refactoring tokens of the Paragon documentation site #1736

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scss/core/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
--pgn-reduced-dropdown-height-max: 60vh;
--pgn-pagination-focus-border-width: .125rem;
--pgn-pagination-focus-box-outline: 0;
--pgn-pagination-secondary-height-sm: 2.75rem;
--pgn-pagination-secondary-height-sm: 2.25rem;
--pgn-pagination-secondary-height-base: 2.75rem;
--pgn-pagination-toggle-border-sm: .25rem;
--pgn-pagination-toggle-border-base: .3125rem;
Expand Down Expand Up @@ -760,7 +760,7 @@
--pgn-btn-border-radius-base: var(--pgn-border-radius-base);
--pgn-btn-line-height-sm: var(--pgn-input-btn-line-height-sm);
--pgn-btn-line-height-base: var(--pgn-input-btn-line-height-base);
--pgn-btn-font-width: var(--pgn-font-weight-normal);
--pgn-btn-font-weight: var(--pgn-font-weight-normal);
--pgn-btn-font-size-lg: var(--pgn-input-btn-font-size-lg);
--pgn-btn-font-size-sm: var(--pgn-input-btn-font-size-sm);
--pgn-btn-font-size-base: var(--pgn-input-btn-font-size-base);
Expand Down
56 changes: 42 additions & 14 deletions src/Form/_bootstrap-custom-forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
&:checked ~ .custom-control-label::before {
color: $custom-control-indicator-checked-color;
border-color: $custom-control-indicator-checked-border-color;

@include gradient-bg($custom-control-indicator-checked-bg);
@include box-shadow($custom-control-indicator-checked-box-shadow);
}
Expand All @@ -40,7 +41,9 @@
// the mixin is not used here to make sure there is feedback
@if $enable-shadows {
box-shadow: $input-box-shadow, $custom-control-indicator-focus-box-shadow;
} @else {
}

@else {
box-shadow: $custom-control-indicator-focus-box-shadow;
}
}
Expand All @@ -53,6 +56,7 @@
color: $custom-control-indicator-active-color;
background-color: $custom-control-indicator-active-bg;
border-color: $custom-control-indicator-active-border-color;

@include box-shadow($custom-control-indicator-active-box-shadow);
}

Expand Down Expand Up @@ -92,6 +96,7 @@
content: "";
background-color: $custom-control-indicator-bg;
border: $custom-control-indicator-border-width solid $custom-control-indicator-border-color;

@include box-shadow($custom-control-indicator-box-shadow);
}

Expand Down Expand Up @@ -127,9 +132,11 @@
.custom-control-input:indeterminate ~ .custom-control-label {
&::before {
border-color: $custom-checkbox-indicator-indeterminate-border-color;

@include gradient-bg($custom-checkbox-indicator-indeterminate-bg);
@include box-shadow($custom-checkbox-indicator-indeterminate-box-shadow);
}

&::after {
background-image: escape-svg($custom-checkbox-indicator-icon-indeterminate);
}
Expand All @@ -139,6 +146,7 @@
&:checked ~ .custom-control-label::before {
@include gradient-bg($custom-control-indicator-checked-disabled-bg);
}

&:indeterminate ~ .custom-control-label::before {
@include gradient-bg($custom-control-indicator-checked-disabled-bg);
}
Expand Down Expand Up @@ -186,13 +194,16 @@
}

&::after {
// stylelint-disable-next-line max-line-length
top: add(calc((#{$font-size-base} * #{$line-height-base} - #{$custom-control-indicator-size}) * .5), calc(#{$custom-control-indicator-border-width} * 2));
// stylelint-disable-next-line max-line-length
left: add(calc(-1 * (#{$custom-switch-width} + #{$custom-control-gutter})), calc(#{$custom-control-indicator-border-width} * 2));
width: $custom-switch-indicator-size;
height: $custom-switch-indicator-size;
background-color: $custom-control-indicator-border-color;
// stylelint-disable-next-line property-disallowed-list
border-radius: $custom-switch-indicator-border-radius;

@include transition(transform .15s ease-in-out, $custom-forms-transition);
}
}
Expand Down Expand Up @@ -222,25 +233,30 @@
display: inline-block;
width: 100%;
height: $custom-select-height;
// stylelint-disable-next-line max-line-length
padding: $custom-select-padding-y ($custom-select-padding-x + $custom-select-indicator-padding) $custom-select-padding-y $custom-select-padding-x;
font-family: $custom-select-font-family;
@include font-size($custom-select-font-size);
font-weight: $custom-select-font-weight;
line-height: $custom-select-line-height;
color: $custom-select-color;
vertical-align: middle;
background: $custom-select-bg $custom-select-background;
border: $custom-select-border-width solid $custom-select-border-color;
@include border-radius($custom-select-border-radius, 0);
@include box-shadow($custom-select-box-shadow);
appearance: none;

@include font-size($custom-select-font-size);
@include border-radius($custom-select-border-radius,0);
@include box-shadow($custom-select-box-shadow);

&:focus {
border-color: $custom-select-focus-border-color;
outline: 0;

@if $enable-shadows {
@include box-shadow($custom-select-box-shadow, $custom-select-focus-box-shadow);
} @else {
}

@else {
// Avoid using mixin so we can pass custom focus shadow properly
box-shadow: $custom-select-focus-box-shadow;
}
Expand Down Expand Up @@ -285,6 +301,7 @@
padding-top: $custom-select-padding-y-sm;
padding-bottom: $custom-select-padding-y-sm;
padding-left: $custom-select-padding-x-sm;

@include font-size($custom-select-font-size-sm);
}

Expand All @@ -293,6 +310,7 @@
padding-top: $custom-select-padding-y-lg;
padding-bottom: $custom-select-padding-y-lg;
padding-left: $custom-select-padding-x-lg;

@include font-size($custom-select-font-size-lg);
}

Expand Down Expand Up @@ -355,6 +373,7 @@
color: $custom-file-color;
background-color: $custom-file-bg;
border: $custom-file-border-width solid $custom-file-border-color;

@include border-radius($custom-file-border-radius);
@include box-shadow($custom-file-box-shadow);

Expand All @@ -370,8 +389,9 @@
line-height: $custom-file-line-height;
color: $custom-file-button-color;
content: "Browse";
@include gradient-bg($custom-file-button-bg);
border-left: inherit;

@include gradient-bg($custom-file-button-bg);
@include border-radius(0 $custom-file-border-radius $custom-file-border-radius 0);
}
}
Expand All @@ -395,8 +415,8 @@
// Pseudo-elements must be split across multiple rulesets to have an effect.
// No box-shadow() mixin for focus accessibility.
&::-webkit-slider-thumb { box-shadow: $custom-range-thumb-focus-box-shadow; }
&::-moz-range-thumb { box-shadow: $custom-range-thumb-focus-box-shadow; }
&::-ms-thumb { box-shadow: $custom-range-thumb-focus-box-shadow; }
&::-moz-range-thumb { box-shadow: $custom-range-thumb-focus-box-shadow; }
&::-ms-thumb { box-shadow: $custom-range-thumb-focus-box-shadow; }
}

&::-moz-focus-outer {
Expand All @@ -407,12 +427,13 @@
width: $custom-range-thumb-width;
height: $custom-range-thumb-height;
margin-top: calc((#{$custom-range-track-height} - #{$custom-range-thumb-height}) * .5); // Webkit specific
@include gradient-bg($custom-range-thumb-bg);
border: $custom-range-thumb-border;
appearance: none;

@include gradient-bg($custom-range-thumb-bg);
@include border-radius($custom-range-thumb-border-radius);
@include box-shadow($custom-range-thumb-box-shadow);
@include transition($custom-forms-transition);
appearance: none;

&:active {
@include gradient-bg($custom-range-thumb-active-bg);
Expand All @@ -426,19 +447,21 @@
cursor: $custom-range-track-cursor;
background-color: $custom-range-track-bg;
border-color: transparent;

@include border-radius($custom-range-track-border-radius);
@include box-shadow($custom-range-track-box-shadow);
}

&::-moz-range-thumb {
width: $custom-range-thumb-width;
height: $custom-range-thumb-height;
@include gradient-bg($custom-range-thumb-bg);
border: $custom-range-thumb-border;
appearance: none;

@include gradient-bg($custom-range-thumb-bg);
@include border-radius($custom-range-thumb-border-radius);
@include box-shadow($custom-range-thumb-box-shadow);
@include transition($custom-forms-transition);
appearance: none;

&:active {
@include gradient-bg($custom-range-thumb-active-bg);
Expand All @@ -452,6 +475,7 @@
cursor: $custom-range-track-cursor;
background-color: $custom-range-track-bg;
border-color: transparent; // Firefox specific?

@include border-radius($custom-range-track-border-radius);
@include box-shadow($custom-range-track-box-shadow);
}
Expand All @@ -462,12 +486,13 @@
margin-top: 0; // Edge specific
margin-right: $custom-range-thumb-focus-box-shadow-width; // Workaround that overflowed box-shadow is hidden.
margin-left: $custom-range-thumb-focus-box-shadow-width; // Workaround that overflowed box-shadow is hidden.
@include gradient-bg($custom-range-thumb-bg);
border: $custom-range-thumb-border;
appearance: none;

@include gradient-bg($custom-range-thumb-bg);
@include border-radius($custom-range-thumb-border-radius);
@include box-shadow($custom-range-thumb-box-shadow);
@include transition($custom-forms-transition);
appearance: none;

&:active {
@include gradient-bg($custom-range-thumb-active-bg);
Expand All @@ -482,17 +507,20 @@
background-color: transparent;
border-color: transparent;
border-width: calc(#{$custom-range-thumb-height} * .5);

@include box-shadow($custom-range-track-box-shadow);
}

&::-ms-fill-lower {
background-color: $custom-range-track-bg;

@include border-radius($custom-range-track-border-radius);
}

&::-ms-fill-upper {
margin-right: 15px; // arbitrary?
background-color: $custom-range-track-bg;

@include border-radius($custom-range-track-border-radius);
}

Expand Down
5 changes: 5 additions & 0 deletions src/Form/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ $custom-control-label-disabled-color: var(--pgn-form-custom-control-label-color-
$custom-control-indicator-checked-color: #0A3055 !default;
$custom-control-indicator-checked-bg: #0A3055 !default;
$custom-control-indicator-checked-disabled-bg: var(--pgn-form-custom-control-indicator-checked-bg-disabled) !default;
// stylelint-disable-next-line max-line-length
$custom-control-indicator-checked-box-shadow: var(--pgn-form-custom-control-indicator-checked-box-shadow-base) !default;
// stylelint-disable-next-line max-line-length
$custom-control-indicator-checked-border-color: var(--pgn-form-custom-control-indicator-checked-border-color-base) !default;

$custom-control-indicator-focus-box-shadow: var(--pgn-form-custom-control-indicator-checked-box-shadow-focus) !default;
// stylelint-disable-next-line max-line-length
$custom-control-indicator-focus-border-color: var(--pgn-form-custom-control-indicator-checked-border-color-focus) !default;

// TODO switch to css variable
Expand All @@ -108,7 +111,9 @@ $custom-checkbox-indicator-icon-checked: str-replace(url("data:image/svg+
$custom-checkbox-indicator-indeterminate-bg: var(--pgn-form-custom-checkbox-indicator-indeterminate-bg) !default;
$custom-checkbox-indicator-indeterminate-color: $custom-control-indicator-checked-color !default;
$custom-checkbox-indicator-icon-indeterminate: str-replace(url("data:image/svg+xml,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M21 3H3V21H21V3ZM17 13H7V11H17V13Z' fill='#{$custom-checkbox-indicator-indeterminate-color}'/></svg>"), "#", "%23") !default;
// stylelint-disable-next-line max-line-length
$custom-checkbox-indicator-indeterminate-box-shadow: var(--pgn-form-custom-checkbox-indicator-indeterminate-box-shadow) !default;
// stylelint-disable-next-line max-line-length
$custom-checkbox-indicator-indeterminate-border-color: var(--pgn-form-custom-checkbox-indicator-indeterminate-border-color) !default;

$custom-radio-indicator-border-radius: var(--pgn-form-custom-radio-indicator-border-radius) !default;
Expand Down
3 changes: 2 additions & 1 deletion src/Popover/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ $popover-arrow-width: var(--pgn-popover-arrow-width) !default;
$popover-arrow-height: var(--pgn-popover-arrow-height) !default;
$popover-arrow-color: var(--pgn-popover-arrow-color) !default;

// TODO can't use css variable due to conflict with SCSS functions, should use var(--pgn-popover-border-color) instead of #000000
// TODO can't use css variable due to conflict with SCSS functions,
// should use var(--pgn-popover-border-color) instead of #000000.
$popover-arrow-outer-color: fade-in($popover-border-color, .05) !default;

$popover-success-bg: var(--pgn-popover-success-bg) !default;
Expand Down
4 changes: 2 additions & 2 deletions tokens/build/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ $pgn-reduced-dropdown-width-min: 6rem !default;
$pgn-reduced-dropdown-height-max: 60vh !default;
$pgn-pagination-focus-border-width: .125rem !default;
$pgn-pagination-focus-box-outline: 0 !default;
$pgn-pagination-secondary-height-sm: 2.75rem !default;
$pgn-pagination-secondary-height-sm: 2.25rem !default;
$pgn-pagination-secondary-height-base: 2.75rem !default;
$pgn-pagination-toggle-border-sm: .25rem !default;
$pgn-pagination-toggle-border-base: .3125rem !default;
Expand Down Expand Up @@ -759,7 +759,7 @@ $pgn-btn-border-radius-lg: $pgn-border-radius-lg !default;
$pgn-btn-border-radius-base: $pgn-border-radius-base !default;
$pgn-btn-line-height-sm: $pgn-input-btn-line-height-sm !default;
$pgn-btn-line-height-base: $pgn-input-btn-line-height-base !default;
$pgn-btn-font-width: $pgn-font-weight-normal !default;
$pgn-btn-font-weight: $pgn-font-weight-normal !default;
$pgn-btn-font-size-lg: $pgn-input-btn-font-size-lg !default;
$pgn-btn-font-size-sm: $pgn-input-btn-font-size-sm !default;
$pgn-btn-font-size-base: $pgn-input-btn-font-size-base !default;
Expand Down
2 changes: 1 addition & 1 deletion tokens/build/css-to-scss.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tokens/build/scss-to-css.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tokens/build/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
--pgn-reduced-dropdown-height-max: 60vh;
--pgn-pagination-focus-border-width: .125rem;
--pgn-pagination-focus-box-outline: 0;
--pgn-pagination-secondary-height-sm: 2.75rem;
--pgn-pagination-secondary-height-sm: 2.25rem;
--pgn-pagination-secondary-height-base: 2.75rem;
--pgn-pagination-toggle-border-sm: .25rem;
--pgn-pagination-toggle-border-base: .3125rem;
Expand Down Expand Up @@ -760,7 +760,7 @@
--pgn-btn-border-radius-base: var(--pgn-border-radius-base);
--pgn-btn-line-height-sm: var(--pgn-input-btn-line-height-sm);
--pgn-btn-line-height-base: var(--pgn-input-btn-line-height-base);
--pgn-btn-font-width: var(--pgn-font-weight-normal);
--pgn-btn-font-weight: var(--pgn-font-weight-normal);
--pgn-btn-font-size-lg: var(--pgn-input-btn-font-size-lg);
--pgn-btn-font-size-sm: var(--pgn-input-btn-font-size-sm);
--pgn-btn-font-size-base: var(--pgn-input-btn-font-size-base);
Expand Down
2 changes: 1 addition & 1 deletion tokens/source/components/Button.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"sm": { "value": "{input.btn.font.size.sm.value}", "themeable": true, "source": "$btn-font-size-sm" },
"lg": { "value": "{input.btn.font.size.lg.value}", "themeable": true, "source": "$btn-font-size-lg" }
},
"width": { "value": "{font.weight.normal.value}", "themeable": true, "source": "$btn-font-weight" }
"weight": { "value": "{font.weight.normal.value}", "themeable": true, "source": "$btn-font-weight" }
},
"line": {
"height": {
Expand Down
2 changes: 1 addition & 1 deletion tokens/source/components/Pagination.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"secondary": {
"height": {
"base": { "value": "2.75rem", "themeable": true, "source": "$pagination-secondary-height" },
"sm": { "value": "2.75rem", "themeable": true, "source": "$pagination-secondary-height-sm" }
"sm": { "value": "2.25rem", "themeable": true, "source": "$pagination-secondary-height-sm" }
}
},
"color": {
Expand Down
1 change: 1 addition & 0 deletions tokens/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async function replaceVariablesUsage(filePath, variablesMap, direction = 'scss-t
crlfDelay: Infinity,
});

// eslint-disable-next-line no-restricted-syntax
for await (const line of rl) {
let parsedLine = line;
const variables = [...parsedLine.matchAll(variableRegex)];
Expand Down