Skip to content

Commit fe79ed5

Browse files
authored
refactor(circular-progress): remove typography (#14602)
1 parent 51a7e29 commit fe79ed5

File tree

8 files changed

+37
-58
lines changed

8 files changed

+37
-58
lines changed

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"@types/source-map": "0.5.2",
8181
"express": "^4.19.2",
8282
"fflate": "^0.8.1",
83-
"igniteui-theming": "^10.0.0",
83+
"igniteui-theming": "^10.1.0",
8484
"igniteui-trial-watermark": "^3.0.2",
8585
"lodash-es": "^4.17.21",
8686
"rxjs": "^7.8.0",

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"igniteui-trial-watermark": "^3.0.2",
7575
"lodash-es": "^4.17.21",
7676
"uuid": "^9.0.0",
77-
"igniteui-theming": "^10.0.0",
77+
"igniteui-theming": "^10.1.0",
7878
"@igniteui/material-icons-extended": "^3.0.0"
7979
},
8080
"peerDependencies": {

projects/igniteui-angular/src/lib/core/styles/components/progress/_progress-theme.scss

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use 'sass:map';
2+
@use 'sass:math';
23
@use 'sass:meta';
34
@use 'sass:list';
45
@use '../../base' as *;
@@ -398,6 +399,7 @@
398399
/// @param {Color} $base-circle-color [null] - The base circle fill color.
399400
/// @param {Color | List<Color>} $progress-circle-color [null] - The progress circle fill color.
400401
/// @param {Color} $text-color [null] - The value text color.
402+
/// @param {Number} $diameter [null] - The progress circle diameter.
401403
///
402404
/// @requires $light-material-schema
403405
///
@@ -412,8 +414,8 @@
412414
413415
$base-circle-color: null,
414416
$progress-circle-color: null,
415-
416-
$text-color: null
417+
$text-color: null,
418+
$diameter: null
417419
) {
418420
$name: 'igx-circular-bar';
419421
$circular-bar-schema: ();
@@ -446,6 +448,7 @@
446448
progress-circle-color-start: $progress-circle-color-start,
447449
progress-circle-color-end: $progress-circle-color-end,
448450
text-color: $text-color,
451+
diameter: $diameter,
449452
_meta: map.merge(if($meta, $meta, ()), (
450453
variant: map.get($schema, '_meta', 'theme')
451454
)),
@@ -463,25 +466,14 @@
463466

464467
$variant: map.get($theme, '_meta', 'variant');
465468

466-
$circular-size: map.get((
467-
material: rem(32px),
468-
fluent: rem(32px),
469-
bootstrap: rem(54px),
470-
indigo-design: rem(48px),
471-
), $variant);
472-
473-
$stroke-width: map.get((
474-
material: rem(4px),
475-
fluent: rem(4px),
476-
bootstrap: rem(4px),
477-
indigo-design: rem(4px),
478-
), $variant);
469+
$stroke-width: rem(4px);
470+
$diameter: var-get($theme, 'diameter');
479471

480472
%circular-display {
481473
display: inline-flex;
482474
flex: 1 1 auto;
483-
width: $circular-size;
484-
height: $circular-size;
475+
width: $diameter;
476+
height: $diameter;
485477
position: relative;
486478

487479
svg {
@@ -533,12 +525,32 @@
533525
}
534526

535527
%circular-text {
528+
$scale-factor: 2.28571;
529+
530+
@if $variant == 'indigo-design' {
531+
$scale-factor: 3;
532+
}
533+
534+
@if $variant == 'bootstrap' {
535+
$scale-factor: 2.7;
536+
}
537+
538+
--stroke-scale: calc(#{$diameter} / #{unitless(map.get($theme, 'diameter'))});
539+
$font-size: round(calc($diameter / $scale-factor - #{unitless($stroke-width)} * var(--stroke-scale)), 1px);
540+
536541
position: absolute;
537542
inset-block-start: 50%;
538543
inset-inline-start: 50%;
539544
transform: translate(-50%, -50%);
540-
text-align: center;
541545
color: var-get($theme, 'text-color');
546+
font-size: #{$font-size};
547+
line-height: normal;
548+
text-align: center;
549+
font-weight: 600;
550+
551+
@if $variant == 'bootstrap' or $variant == 'fluent' {
552+
font-weight: 700;
553+
}
542554
}
543555

544556
%circular-text--hidden {
@@ -564,27 +576,3 @@
564576
}
565577
}
566578
}
567-
568-
// Adds typography styles for the igx-circular-bar component.
569-
/// Uses custom typography
570-
/// @group typography
571-
/// @param {Map} $categories [(text: 'h6')] - The categories from the typographic scale used for type styles.
572-
@mixin circular-bar-typography($categories: (text: 'h6')) {
573-
$text: map.get($categories, 'text');
574-
575-
@if $text {
576-
%circular-text {
577-
@include type-style($text) {
578-
font-size: rem(12px);
579-
line-height: rem(16px);
580-
margin: 0;
581-
}
582-
}
583-
} @else {
584-
%circular-text {
585-
font-size: rem(12px);
586-
font-weight: 700;
587-
line-height: rem(16px);
588-
}
589-
}
590-
}

projects/igniteui-angular/src/lib/core/styles/typography/_bootstrap.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@
5555
label: 'body-1',
5656
));
5757
@include chip-typography();
58-
@include circular-bar-typography($categories: (
59-
text: 'subtitle-1'
60-
));
6158
@include column-actions-typography();
6259
@include date-range-typography();
6360
@include dialog-typography($categories: (

projects/igniteui-angular/src/lib/core/styles/typography/_fluent.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
@include chip-typography($categories: (
5959
text: 'subtitle-2'
6060
));
61-
@include circular-bar-typography($categories: (
62-
text: null
63-
));
6461
@include column-actions-typography();
6562
@include date-range-typography();
6663
@include dialog-typography();

projects/igniteui-angular/src/lib/core/styles/typography/_indigo.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@
5757
label: 'body-2',
5858
));
5959
@include chip-typography();
60-
@include circular-bar-typography($categories: (
61-
text: 'subtitle-2'
62-
));
6360
@include column-actions-typography();
6461
@include date-range-typography();
6562
@include dialog-typography($categories: (

projects/igniteui-angular/src/lib/core/styles/typography/_material.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
@include card-typography();
4242
@include checkbox-typography();
4343
@include chip-typography();
44-
@include circular-bar-typography();
4544
@include column-actions-typography();
4645
@include date-range-typography();
4746
@include dialog-typography();

0 commit comments

Comments
 (0)