Skip to content

Commit f7678a3

Browse files
authored
feat(progress): update linear progres props and add variants for circular (#15385)
1 parent 6d264e5 commit f7678a3

File tree

14 files changed

+188
-50
lines changed

14 files changed

+188
-50
lines changed

package-lock.json

Lines changed: 4 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
@@ -74,7 +74,7 @@
7474
"@types/source-map": "0.5.2",
7575
"express": "^4.21.1",
7676
"fflate": "^0.8.1",
77-
"igniteui-theming": "^15.1.1",
77+
"igniteui-theming": "^16.0.0",
7878
"igniteui-trial-watermark": "^3.0.2",
7979
"lodash-es": "^4.17.21",
8080
"rxjs": "^7.8.0",

projects/igniteui-angular/migrations/migration-collection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@
211211
"version": "19.1.0",
212212
"description": "Updates Ignite UI for Angular from v18.2.3 to v19.1.0",
213213
"factory": "./update-19_1_0"
214+
},
215+
"migration-43": {
216+
"version": "19.1.1",
217+
"description": "Updates Ignite UI for Angular from v19.1.0 to v19.1.1",
218+
"factory": "./update-19_1_1"
214219
}
215220
}
216221
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "../../common/schema/theme-changes.schema.json",
3+
"changes": [
4+
{
5+
"name": "$progress-circle-color",
6+
"replaceWith": "$fill-color-default",
7+
"owner": "circular-theme",
8+
"type": "property"
9+
}
10+
]
11+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import * as path from 'path';
2+
3+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
4+
import { setupTestTree } from '../common/setup.spec';
5+
6+
const version = '19.1.1';
7+
const themes = [
8+
'circular-theme'
9+
];
10+
const testFilePath = '/testSrc/appPrefix/component/${theme}.component.scss';
11+
12+
describe(`Update to ${version}`, () => {
13+
let appTree: UnitTestTree;
14+
const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
15+
16+
beforeEach(() => {
17+
appTree = setupTestTree();
18+
});
19+
20+
const migrationName = 'migration-43';
21+
22+
themes.forEach(theme => {
23+
it('should rename the progress circle color property of the circular progress', async () => {
24+
appTree.create(
25+
testFilePath,
26+
`$custom-${theme}: ${theme}($progress-circle-color: red);`
27+
);
28+
29+
const tree = await schematicRunner.runSchematic(migrationName, {}, appTree);
30+
31+
expect(tree.readContent(testFilePath)).toEqual(
32+
`$custom-${theme}: ${theme}($fill-color-default: red);`
33+
);
34+
});
35+
});
36+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type {
2+
Rule,
3+
SchematicContext,
4+
Tree
5+
} from '@angular-devkit/schematics';
6+
import { UpdateChanges } from '../common/UpdateChanges';
7+
8+
const version = '19.1.1';
9+
10+
export default (): Rule => async (host: Tree, context: SchematicContext) => {
11+
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
12+
const update = new UpdateChanges(__dirname, host, context);
13+
update.applyChanges();
14+
};

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"tslib": "^2.3.0",
7474
"igniteui-trial-watermark": "^3.0.2",
7575
"lodash-es": "^4.17.21",
76-
"igniteui-theming": "^15.1.1",
76+
"igniteui-theming": "^16.0.0",
7777
"@igniteui/material-icons-extended": "^3.1.0"
7878
},
7979
"peerDependencies": {

projects/igniteui-angular/src/lib/core/styles/components/progress/circular/_circular-component.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
}
5050
}
5151

52+
@each $modifier in ('danger', 'warning', 'info', 'success') {
53+
@include m($modifier) {
54+
@extend %display-circular--#{$modifier} !optional;
55+
}
56+
}
57+
5258
@include m(animation-none) {
5359
@extend %animation-none !optional;
5460
}

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

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,30 @@
99
/// @param {Map} $schema [$light-material-schema] - The schema used as basis for styling the component.
1010
///
1111
/// @param {Color} $base-circle-color [null] - The base circle fill color.
12-
/// @param {Color | List<Color>} $progress-circle-color [null] - The progress circle fill color.
12+
/// @param {Color | List<Color>} $fill-color-default [null] - The progress circle fill color.
13+
/// @param {Color} $fill-color-danger [null] - The track danger fill color.
14+
/// @param {Color} $fill-color-warning [null] - The track warning fill color.
15+
/// @param {Color} $fill-color-info [null] - The track info fill color.
16+
/// @param {Color} $fill-color-success [null] - The track success fill color.
1317
/// @param {Color} $text-color [null] - The value text color.
1418
/// @param {Number} $diameter [null] - The progress circle diameter.
1519
///
1620
/// @requires $light-material-schema
1721
///
1822
/// @example scss Change the circle progress color
1923
/// $my-progress-circular-theme: progress-circular-theme(
20-
/// $progress-circle-color: purple
24+
/// $fill-color-default: purple
2125
/// );
2226
/// // Pass the theme to the igx-progress-circular component mixin
2327
/// @include igx-progress-circular($my-progress-circle-theme);
2428
@function progress-circular-theme(
2529
$schema: $light-material-schema,
2630
$base-circle-color: null,
27-
$progress-circle-color: null,
31+
$fill-color-default: null,
32+
$fill-color-danger: null,
33+
$fill-color-warning: null,
34+
$fill-color-info: null,
35+
$fill-color-success: null,
2836
$text-color: null,
2937
$diameter: null
3038
) {
@@ -40,24 +48,28 @@
4048
$theme: digest-schema($circular-bar-schema);
4149
$meta: map.get($theme, '_meta');
4250

43-
$progress-circle-color-start: map.get($theme, 'progress-circle-color');
44-
$progress-circle-color-end: map.get($theme, 'progress-circle-color');
51+
$fill-color-default-start: map.get($theme, 'fill-color-default');
52+
$fill-color-default-end: map.get($theme, 'fill-color-default');
4553

46-
@if meta.type-of($progress-circle-color) == 'color' {
47-
$progress-circle-color-start: $progress-circle-color;
48-
$progress-circle-color-end: $progress-circle-color;
54+
@if meta.type-of($fill-color-default) == 'color' {
55+
$fill-color-default-start: $fill-color-default;
56+
$fill-color-default-end: $fill-color-default;
4957
}
5058

51-
@if list.length($progress-circle-color) == 2 {
52-
$progress-circle-color-start: list.nth($progress-circle-color, 1);
53-
$progress-circle-color-end: list.nth($progress-circle-color, 2);
59+
@if list.length($fill-color-default) == 2 {
60+
$fill-color-default-start: list.nth($fill-color-default, 1);
61+
$fill-color-default-end: list.nth($fill-color-default, 2);
5462
}
5563

5664
@return extend($theme, (
5765
name: $name,
5866
base-circle-color: $base-circle-color,
59-
progress-circle-color-start: $progress-circle-color-start,
60-
progress-circle-color-end: $progress-circle-color-end,
67+
fill-color-default-start: $fill-color-default-start,
68+
fill-color-default-end: $fill-color-default-end,
69+
fill-color-danger: $fill-color-danger,
70+
fill-color-warning: $fill-color-warning,
71+
fill-color-info: $fill-color-info,
72+
fill-color-success: $fill-color-success,
6173
text-color: $text-color,
6274
diameter: $diameter,
6375
theme: map.get($schema, '_meta', 'theme'),
@@ -238,6 +250,14 @@
238250
}
239251
}
240252

253+
@each $mod in ('success','info','warning','danger') {
254+
%display-circular--#{$mod} {
255+
svg %outer {
256+
stroke: var-get($theme, 'fill-color-#{$mod}');
257+
}
258+
}
259+
}
260+
241261
%outer--indeterminate {
242262
stroke-dasharray: 289;
243263
@include animation(igx-indeterminate-accordion var(--_transition-duration) cubic-bezier(0, .085, .68, .53) normal infinite);
@@ -292,11 +312,11 @@
292312
}
293313

294314
%gradient-start {
295-
stop-color: var-get($theme, 'progress-circle-color-start');
315+
stop-color: var-get($theme, 'fill-color-default-start');
296316
}
297317

298318
%gradient-end {
299-
stop-color: var-get($theme, 'progress-circle-color-end');
319+
stop-color: var-get($theme, 'fill-color-default-end');
300320
}
301321

302322
@keyframes igx-indeterminate-accordion {

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

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
/// @param {Color} $stripes-color [null] - The track stripes color.
2424
/// @param {Color} $text-color [null] - The track value text color.
2525
/// @param {List} $track-border-radius [null] - The border radius fraction, between 0 - 8 to be used fot the progress bar track
26+
/// @param {Number} $track-height [null] - The linear progress track height.
27+
/// @param {Number} $strip-size [null] - The linear progress bar strip width.
2628
/// @requires $light-material-schema
2729
/// @example scss Change the stripes color
2830
/// $my-progress-linear-theme: progress-linear-theme(
@@ -41,6 +43,8 @@
4143
$stripes-color: null,
4244
$text-color: null,
4345
$track-border-radius: null,
46+
$track-height: null,
47+
$strip-size: null
4448
) {
4549
$name: 'igx-linear-bar';
4650
$linear-bar-schema: ();
@@ -65,6 +69,8 @@
6569
stripes-color: $stripes-color,
6670
text-color: $text-color,
6771
track-border-radius: $track-border-radius,
72+
track-height: $track-height,
73+
strip-size: $strip-size,
6874
theme: map.get($schema, '_meta', 'theme'),
6975
_meta: map.merge(if($meta, $meta, ()), (
7076
variant: map.get($schema, '_meta', 'theme')
@@ -123,21 +129,6 @@ $easing-curves: (
123129

124130
$variant: map.get($theme, '_meta', 'variant');
125131

126-
// TODO all of these should be listed as design tokens in the component schema. [$bar-height, $strip-size]
127-
$bar-height: map.get((
128-
'material': rem(4px),
129-
'fluent': rem(2px),
130-
'bootstrap': rem(16px),
131-
'indigo': rem(4px),
132-
), $variant);
133-
134-
$strip-size: map.get((
135-
'material': rem(16px),
136-
'fluent': rem(16px),
137-
'bootstrap': rem(5px),
138-
'indigo': rem(16px),
139-
), $variant);
140-
141132
%display-linear {
142133
position: relative;
143134
display: flex;
@@ -169,14 +160,14 @@ $easing-curves: (
169160
}
170161

171162
%base {
172-
--stripe-size: #{$strip-size};
163+
--stripe-size: #{var-get($theme, 'strip-size')};
173164
--linear-animation-duration: 2000ms;
174165

175166
display: flex;
176167
flex-direction: column;
177168
position: relative;
178169
width: inherit;
179-
height: $bar-height;
170+
height: var-get($theme, 'track-height');
180171
background: var-get($theme, 'track-color');
181172
overflow: hidden;
182173
border-radius: var-get($theme, 'track-border-radius');

0 commit comments

Comments
 (0)