Skip to content

Commit

Permalink
feat(components/phone-field): tokenize phone field styles (#2918)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-TrevorBurch authored Nov 21, 2024
1 parent 05a7993 commit d029b55
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ describe('phone-field-storybook', () => {
);
});
});
});
}, true);
});
9 changes: 6 additions & 3 deletions apps/e2e/phone-field-storybook/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"styles": [
"apps/e2e/phone-field-storybook/src/styles.scss",
"libs/components/theme/src/lib/styles/sky.scss",
"libs/components/theme/src/lib/styles/themes/modern/styles.scss"
"libs/components/theme/src/lib/styles/themes/modern/styles.scss",
"node_modules/@blackbaud/skyux-design-tokens/scss/blackbaud.css"
],
"scripts": []
},
Expand Down Expand Up @@ -88,7 +89,8 @@
"compodoc": false,
"styles": [
"libs/components/theme/src/lib/styles/sky.scss",
"libs/components/theme/src/lib/styles/themes/modern/styles.scss"
"libs/components/theme/src/lib/styles/themes/modern/styles.scss",
"node_modules/@blackbaud/skyux-design-tokens/scss/blackbaud.css"
]
},
"configurations": {
Expand All @@ -108,7 +110,8 @@
"compodoc": false,
"styles": [
"libs/components/theme/src/lib/styles/sky.scss",
"libs/components/theme/src/lib/styles/themes/modern/styles.scss"
"libs/components/theme/src/lib/styles/themes/modern/styles.scss",
"node_modules/@blackbaud/skyux-design-tokens/scss/blackbaud.css"
]
},
"configurations": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ sky-input-box {
.sky-input-group-btn.sky-input-box-btn-inset {
.sky-btn {
background-color: transparent;
border-radius: var(--sky-border-radius-s);
border-top-right-radius: var(--sky-border-radius-s);
border-bottom-right-radius: var(--sky-border-radius-s);
transition-property: none;

&:not(:active):not(:focus):not(:hover) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
@use 'libs/components/theme/src/lib/styles/mixins' as mixins;
@use 'libs/components/theme/src/lib/styles/variables' as *;
@use 'libs/components/theme/src/lib/styles/compat-tokens-mixins' as compatMixins;
@import 'node_modules/intl-tel-input/build/css/intlTelInput.css';

.sky-phone-field-country-btn + .sky-form-control {
border-left: none;
@include compatMixins.sky-default-overrides('.sky-phone-field-country-btn') {
--sky-override-phone-field-flag-transform: scaleX(1.25) translateX(2px);
--sky-override-phone-field-flag-min-width: 20px;
--sky-override-phone-field-flag-display: block;
--sky-override-phone-field-input-box-country-button-padding: 6px 12px;
}

@include compatMixins.sky-default-overrides('.sky-phone-field') {
.sky-phone-field-search-btn-dismiss {
border-color: transparent;
}
}

@include compatMixins.sky-modern-overrides(
'.sky-phone-field-country-btn',
false
) {
--sky-override-phone-field-flag-transform: scaleX(1.25) translateX(2px);
--sky-override-phone-field-flag-min-width: var(--modern-size-20);
--sky-override-phone-field-flag-display: block;
--sky-override-phone-field-input-box-country-button-padding: 0 17px 0 18px;
}

.sky-phone-field-country-btn {
.sky-btn {
// NOTE: This rule is set for non-input box phone fields. Remove when support for this is fully removed.
border-radius: 0;
}
}
Expand All @@ -21,47 +42,27 @@
flex-grow: 1;
}

.sky-phone-field-search-btn-dismiss {
border-color: transparent;
}

.sky-phone-field-country-selected,
.sky-phone-field-country-default {
@include mixins.sky-border(light, bottom);
}

.sky-phone-field-search-result {
.sky-phone-field-flag {
display: inline-block;
margin-right: $sky-margin-half;
}
}

// Default only style for the dismiss icon in input boxes
.sky-input-box {
.sky-phone-field-search-btn-dismiss .fa-lg {
vertical-align: -10%;
}
}

.sky-theme-modern {
.sky-input-box {
.sky-phone-field-country-search .sky-country-field-input {
background-color: transparent;
}

.sky-phone-field-country-btn.sky-input-group-btn .sky-btn {
padding: 0 17px 0 18px;
}
.sky-input-box {
.sky-phone-field-country-btn.sky-input-group-btn .sky-btn {
padding: var(--sky-override-phone-field-input-box-country-button-padding);
}
}

.sky-phone-field-country-btn {
.sky-phone-field-flag {
min-width: 20px;
min-width: var(--sky-override-phone-field-flag-min-width);
display: var(--sky-override-phone-field-flag-display, inline-block);
}

.iti__flag {
background-image: url(https://sky.blackbaudcdn.net/static/skyux-public-assets/1.0.0-beta.4/assets/images/intl-tel-input/[email protected]) !important;
transform: scaleX(1.25) translateX(2px);
transform: var(--sky-override-phone-field-flag-transform, none);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

// Placeholder text
::placeholder {
color: var(--sky-text-color-deemphasized);
font-style: $sky-theme-modern-font-deemphasized-style;
color: var(--sky-color-text-deemphasized);
font-style: var(--sky-font-style-deemphasized-style);
opacity: 1;
}

Expand Down

0 comments on commit d029b55

Please sign in to comment.