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

chore: remove deprecated d-svg class from component styles #39

Merged
merged 4 commits into from
Dec 11, 2023
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
braddialpad marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -531,20 +531,10 @@ a.header-anchor {
width: var(--dt-size-650);
height: var(--dt-size-650);
margin-bottom: var(--dt-space-300);

svg {
width: 100%;
height: auto;
}
}

.dialtone-icon-card__icon--autosize {
margin-bottom: var(--dt-space-300);

svg {
width: 100%;
height: auto;
}
}

.dialtone-icon-card__title {
Expand Down
126 changes: 0 additions & 126 deletions packages/dialtone/gulpfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -247,129 +247,6 @@ const moveStyleTagsToEOF = function (file, enc, cb) {
// @@ COMPILE SVGS
// Lint and optimize SVG files
// ================================================================================
// TODO: Remove this scripts once old icon set is deprecated
const buildSystemSVGs = function (done) {
// Make sure this feature is activated before running
if (!settings.svgs) return done();

// Compile system icons
return src(paths.svgs.sysInput)
.pipe(cache('buildSystemSVGs'))
.pipe(replace(' fill="none"', ''))
.pipe(replace(' fill="#000"', ''))
.pipe(replace(' fill="#000000"', ''))
.pipe(replace(' fill="#0D0C0F"', ''))
.pipe(replace(' fill="black"', ''))
.pipe(replace(' fill="#141721"', ''))
.pipe(replace('<svg width="24" height="24"', '<svg '))
.pipe(replace('<svg', function (match) {
const name = path.parse(this.file.path).name;
const converted = name.toLowerCase().replace(/-(.)/g, function (match, group1) {
return group1.toUpperCase();
});
const title = name
.replace(/\b\S/g, t => t.toUpperCase())
.replace(/[-]+/g, ' ');

return `${match}
aria-hidden="true"
focusable="false"
aria-label="${title}"
class="d-svg d-svg--system d-svg__${converted}"`;
}))
.pipe(svgmin())
.pipe(dest(paths.svgs.sysOutputLib))
.pipe(replace('<svg', '<template>\n <svg'))
.pipe(replace('</svg>', '</svg>\n</template>'))
// move any style tags within the svg into style tags of the vue component
.pipe(through2.obj(moveStyleTagsToEOF))
.pipe(replace('<style>', '<style scoped>'))
.pipe(rename(function (file) {
const converted = file.basename.replace(/\b\S/g, t => t.toUpperCase()).replace(/[-]+/g, '');

file.basename = 'Icon' + converted;
file.extname = '.vue';
}))
.pipe(dest(paths.svgs.outputVue));
};

const buildBrandSVGs = function (done) {
// Make sure this feature is activated before running
if (!settings.svgs) return done();
// Compile brand icons
return src(paths.svgs.brandInput)
.pipe(cache('buildBrandSVGs'))
.pipe(replace('<svg width="24" height="24"', '<svg '))
.pipe(replace('<svg', function (match) {
const name = path.parse(this.file.path).name;
const converted = name.toLowerCase().replace(/-(.)/g, function (match, group1) {
return group1.toUpperCase();
});
const title = name
.replace(/\b\S/g, t => t.toUpperCase())
.replace(/[-]+/g, ' ');

return `${match}
aria-hidden="true"
focusable="false"
aria-label="${title}"
class="d-svg d-svg--native d-svg__${converted}"`;
}))
.pipe(svgmin())
.pipe(dest(paths.svgs.brandOutputLib))
.pipe(replace('<svg', '<template>\n <svg'))
.pipe(replace('</svg>', '</svg>\n</template>'))
// move any style tags within the svg into style tags of the vue component
.pipe(through2.obj(moveStyleTagsToEOF))
.pipe(replace('<style>', '<style scoped>'))
.pipe(rename(function (file) {
const converted = file.basename.replace(/\b\S/g, t => t.toUpperCase()).replace(/[-]+/g, '');
file.basename = 'Icon' + converted;
file.extname = '.vue';
}))
.pipe(dest(paths.svgs.outputVue));
};

const buildPatternSVGs = function (done) {
// Make sure this feature is activated before running
if (!settings.patterns) return done();

// Compile system icons
return src(paths.patterns.input)
.pipe(cache('buildPatternSVGs'))
.pipe(replace('<svg', function (match) {
const name = path.parse(this.file.path).name;
const converted = name.toLowerCase().replace(/-(.)/g, function (match, group1) {
return group1.toUpperCase();
});
const title = name
.replace(/\b\S/g, t => t.toUpperCase())
.replace(/[-]+/g, ' ');

return `${match}
aria-hidden="true"
focusable="false"
aria-label="${title}"
class="d-svg d-svg--pattern d-svg__${converted}"
xmlns="http://www.w3.org/2000/svg"`;
}))
.pipe(svgmin())
.pipe(dest(paths.patterns.outputLib))
.pipe(replace('<svg', '<template>\n <svg'))
.pipe(replace('</svg>', '</svg>\n</template>'))
// move any style tags within the svg into style tags of the vue component
.pipe(through2.obj(moveStyleTagsToEOF))
.pipe(replace('<style>', '<style scoped>'))
.pipe(rename(function (file) {
const converted = file.basename
.replace(/\b\S/g, t => t.toUpperCase())
.replace(/[-]+/g, '');

file.basename = 'Pattern' + converted;
file.extname = '.vue';
}))
.pipe(dest(paths.patterns.outputVue));
};

const buildSpotIllustrationSVGs = function (done) {
// Make sure this feature is activated before running
Expand Down Expand Up @@ -515,9 +392,6 @@ exports.clean = series(
);

exports.svg = series(
buildSystemSVGs,
buildBrandSVGs,
buildPatternSVGs,
buildSpotIllustrationSVGs,
buildNewSVGIcons,
);
Expand Down
25 changes: 0 additions & 25 deletions packages/dialtone/lib/build/less/components/button.less
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@
cursor: not-allowed;
transition: none;
}

.d-btn__icon .d-svg {
width: var(--dt-size-500);
height: var(--dt-size-500);
}
}

// ============================================================================
Expand All @@ -120,11 +115,6 @@
--button-font-size: var(--dt-font-size-100);
--button-line-height: var(--button-line-height-xs);
--button-border-radius: var(--dt-size-300);

.d-btn__icon .d-svg {
width: var(--dt-icon-size-100);
height: var(--dt-icon-size-100);
}
}

// $$ SMALL
Expand All @@ -134,11 +124,6 @@
--button-padding-x: var(--button-padding-x-sm);
--button-font-size: var(--dt-font-size-100);
--button-line-height: var(--button-line-height-sm);

.d-btn__icon .d-svg {
width: var(--dt-icon-size-200);
height: var(--dt-icon-size-200);
}
}

// $$ MEDIUM
Expand All @@ -155,11 +140,6 @@
--button-font-size: var(--dt-font-size-300);
--button-line-height: var(--button-line-height-lg);
--button-border-radius: var(--dt-size-450);

.d-btn__icon .d-svg {
width: var(--dt-icon-size-400);
height: var(--dt-icon-size-400);
}
}

// $$ EXTRA LARGE
Expand All @@ -171,11 +151,6 @@
--button-font-weight: var(--dt-font-weight-normal);
--button-line-height: var(--button-line-height-xl);
--button-border-radius: var(--dt-size-500);

.d-btn__icon .d-svg {
width: var(--dt-icon-size-500);
height: var(--dt-icon-size-500);
}
}

// ============================================================================
Expand Down
30 changes: 0 additions & 30 deletions packages/dialtone/lib/build/less/components/chip.less
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@

margin: var(--dt-space-200-negative) var(--dt-space-300) var(--dt-space-200-negative) var(--dt-space-350-negative);
}

.d-svg {
width: var(--dt-icon-size-300);
height: var(--dt-icon-size-300);
}
}

.d-chip__close {
Expand Down Expand Up @@ -112,11 +107,6 @@
&.d-btn--active:active:not([disabled]) {
--button-color-background: hsla(var(--dt-color-black-800-hsl) ~' / ' 25%);
}

.d-btn__icon .d-svg {
width: var(--dt-icon-size-300);
height: var(--dt-icon-size-300);
}
}

.d-chip__icon {
Expand All @@ -143,11 +133,6 @@
padding: var(--dt-space-200) var(--dt-space-350);
font-size: var(--dt-font-size-100);

.d-svg {
width: var(--dt-icon-size-200);
height: var(--dt-icon-size-200);
}

// reserves space within the chip for the close button, since the close button is
// not nested within the chip.
&:not(:only-child)::after {
Expand All @@ -173,11 +158,6 @@
width: var(--dt-size-550);
height: var(--dt-size-550);
}

.d-btn__icon .d-svg {
width: var(--dt-icon-size-200);
height: var(--dt-icon-size-200);
}
}

// $$ SMALL
Expand All @@ -186,11 +166,6 @@
padding: var(--dt-space-200) var(--dt-space-400);
font-size: var(--dt-font-size-200);

.d-svg {
width: var(--dt-size-500);
height: var(--dt-size-500);
}

// reserves space within the chip for the close button, since the close button is
// not nested within the chip.
&:not(:only-child)::after {
Expand All @@ -214,9 +189,4 @@
width: var(--dt-size-550);
height: var(--dt-size-550);
}

.d-btn__icon .d-svg {
width: var(--dt-size-500);
height: var(--dt-size-500);
}
}
6 changes: 0 additions & 6 deletions packages/dialtone/lib/build/less/components/input.less
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,6 @@
align-items: center;
height: var(--input-icon-container-height);
margin: 0;

svg {
// Backwards-compatible to DT6 icons
width: var(--input-icon-size);
height: var(--input-icon-size);
}
}


Expand Down
15 changes: 0 additions & 15 deletions packages/dialtone/lib/build/less/dialtone-globals.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,6 @@ body {
-webkit-text-size-adjust: 100%;
}


// ============================================================================
// @ UNIVERSAL SVG STYLES
// ----------------------------------------------------------------------------
.d-svg {
// By default, most icons are ~24px.
width: 1.5em;
height: 1.5em;

// All system SVGs should inherit the current text color
&.d-svg--system {
fill: currentColor;
}
}

// ============================================================================
// @ FOCUS VISIBLE
// ----------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion packages/dialtone/lib/build/less/dialtone.less
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
@import 'utilities/layout';
@import 'utilities/sizing';
@import 'utilities/spacing';
@import 'utilities/svg';
@import 'utilities/typography';

// -- THEMES & GLOBAL SETTINGS
Expand Down
58 changes: 0 additions & 58 deletions packages/dialtone/lib/build/less/utilities/svg.less

This file was deleted.

Loading