mithril-materialized 3.8.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/circular-progress.d.ts +43 -0
- package/dist/index.css +475 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +177 -1
- package/dist/index.js +178 -0
- package/dist/index.min.css +1 -1
- package/dist/index.umd.js +178 -0
- package/dist/linear-progress.d.ts +40 -0
- package/package.json +1 -1
- package/sass/components/_circular-progress.scss +220 -0
- package/sass/components/_linear-progress.scss +183 -0
- package/sass/materialize.scss +2 -0
package/dist/index.umd.js
CHANGED
|
@@ -10835,6 +10835,182 @@
|
|
|
10835
10835
|
};
|
|
10836
10836
|
};
|
|
10837
10837
|
|
|
10838
|
+
/** Size dimensions in pixels */
|
|
10839
|
+
const SIZE_MAP = {
|
|
10840
|
+
small: 36,
|
|
10841
|
+
medium: 50,
|
|
10842
|
+
large: 64,
|
|
10843
|
+
};
|
|
10844
|
+
/** Stroke width in pixels */
|
|
10845
|
+
const STROKE_WIDTH = 3;
|
|
10846
|
+
/** Create a CircularProgress component */
|
|
10847
|
+
const CircularProgress = () => {
|
|
10848
|
+
const state = {
|
|
10849
|
+
id: uniqueId(),
|
|
10850
|
+
};
|
|
10851
|
+
/**
|
|
10852
|
+
* Calculate SVG stroke properties for determinate progress
|
|
10853
|
+
*/
|
|
10854
|
+
const calculateStrokeProperties = (size, value, max) => {
|
|
10855
|
+
const radius = (size - STROKE_WIDTH) / 2;
|
|
10856
|
+
const circumference = 2 * Math.PI * radius;
|
|
10857
|
+
const percentage = Math.min(100, Math.max(0, (value / max) * 100));
|
|
10858
|
+
const strokeDashoffset = circumference - (percentage / 100) * circumference;
|
|
10859
|
+
return {
|
|
10860
|
+
radius,
|
|
10861
|
+
circumference,
|
|
10862
|
+
strokeDashoffset,
|
|
10863
|
+
percentage,
|
|
10864
|
+
};
|
|
10865
|
+
};
|
|
10866
|
+
/**
|
|
10867
|
+
* Get size class name
|
|
10868
|
+
*/
|
|
10869
|
+
const getSizeClass = (size = 'medium') => {
|
|
10870
|
+
return `circular-progress--${size}`;
|
|
10871
|
+
};
|
|
10872
|
+
/**
|
|
10873
|
+
* Get color class name
|
|
10874
|
+
*/
|
|
10875
|
+
const getColorClass = (color, intensity) => {
|
|
10876
|
+
if (!color)
|
|
10877
|
+
return '';
|
|
10878
|
+
return intensity ? `circular-progress--${color} circular-progress--${intensity}` : `circular-progress--${color}`;
|
|
10879
|
+
};
|
|
10880
|
+
return {
|
|
10881
|
+
view: ({ attrs }) => {
|
|
10882
|
+
const { mode = 'indeterminate', value = 0, max = 100, size = 'medium', color = 'teal', colorIntensity, label, showPercentage = false, className = '', style = {}, id = state.id, 'aria-label': ariaLabel, 'aria-valuemin': ariaValueMin = 0, 'aria-valuemax': ariaValueMax = max, 'aria-valuenow': ariaValueNow, 'aria-valuetext': ariaValueText } = attrs, params = __rest(attrs, ["mode", "value", "max", "size", "color", "colorIntensity", "label", "showPercentage", "className", "style", "id", 'aria-label', 'aria-valuemin', 'aria-valuemax', 'aria-valuenow', 'aria-valuetext']);
|
|
10883
|
+
const isDeterminate = mode === 'determinate';
|
|
10884
|
+
const sizePixels = SIZE_MAP[size];
|
|
10885
|
+
const { radius, circumference, strokeDashoffset, percentage } = isDeterminate
|
|
10886
|
+
? calculateStrokeProperties(sizePixels, value, max)
|
|
10887
|
+
: { radius: 0, circumference: 0, strokeDashoffset: 0, percentage: 0 };
|
|
10888
|
+
// Determine label content
|
|
10889
|
+
const labelContent = label !== undefined ? label : showPercentage && isDeterminate ? `${Math.round(percentage)}%` : '';
|
|
10890
|
+
// Build class names
|
|
10891
|
+
const classNames = [
|
|
10892
|
+
'circular-progress',
|
|
10893
|
+
getSizeClass(size),
|
|
10894
|
+
getColorClass(color, colorIntensity),
|
|
10895
|
+
`circular-progress--${mode}`,
|
|
10896
|
+
className,
|
|
10897
|
+
]
|
|
10898
|
+
.filter(Boolean)
|
|
10899
|
+
.join(' ');
|
|
10900
|
+
// ARIA attributes
|
|
10901
|
+
const ariaAttrs = isDeterminate
|
|
10902
|
+
? {
|
|
10903
|
+
'aria-valuenow': ariaValueNow !== undefined ? ariaValueNow : value,
|
|
10904
|
+
'aria-valuemin': ariaValueMin,
|
|
10905
|
+
'aria-valuemax': ariaValueMax,
|
|
10906
|
+
'aria-valuetext': ariaValueText || `${Math.round(percentage)}%`,
|
|
10907
|
+
}
|
|
10908
|
+
: {
|
|
10909
|
+
'aria-valuetext': ariaValueText || label || 'Loading',
|
|
10910
|
+
};
|
|
10911
|
+
return m('.circular-progress', Object.assign(Object.assign(Object.assign({}, params), { className: classNames, style: Object.assign({ width: `${sizePixels}px`, height: `${sizePixels}px` }, style), id, role: 'progressbar', 'aria-label': ariaLabel || (isDeterminate ? `Progress: ${Math.round(percentage)}%` : 'Loading') }), ariaAttrs), [
|
|
10912
|
+
// SVG circle
|
|
10913
|
+
m('svg.circular-progress__svg', {
|
|
10914
|
+
viewBox: `0 0 ${sizePixels} ${sizePixels}`,
|
|
10915
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
10916
|
+
}, [
|
|
10917
|
+
// Background track circle
|
|
10918
|
+
m('circle.circular-progress__circle.circular-progress__circle--track', {
|
|
10919
|
+
cx: sizePixels / 2,
|
|
10920
|
+
cy: sizePixels / 2,
|
|
10921
|
+
r: radius || (sizePixels - STROKE_WIDTH) / 2,
|
|
10922
|
+
fill: 'none',
|
|
10923
|
+
stroke: 'currentColor',
|
|
10924
|
+
'stroke-width': STROKE_WIDTH,
|
|
10925
|
+
}),
|
|
10926
|
+
// Progress indicator circle
|
|
10927
|
+
m('circle.circular-progress__circle.circular-progress__circle--indicator', {
|
|
10928
|
+
cx: sizePixels / 2,
|
|
10929
|
+
cy: sizePixels / 2,
|
|
10930
|
+
r: radius || (sizePixels - STROKE_WIDTH) / 2,
|
|
10931
|
+
fill: 'none',
|
|
10932
|
+
stroke: 'currentColor',
|
|
10933
|
+
'stroke-width': STROKE_WIDTH,
|
|
10934
|
+
'stroke-dasharray': isDeterminate ? circumference : undefined,
|
|
10935
|
+
'stroke-dashoffset': isDeterminate ? strokeDashoffset : undefined,
|
|
10936
|
+
'stroke-linecap': 'round',
|
|
10937
|
+
}),
|
|
10938
|
+
]),
|
|
10939
|
+
// Label inside circle
|
|
10940
|
+
labelContent &&
|
|
10941
|
+
m('.circular-progress__label', {
|
|
10942
|
+
'aria-hidden': 'true',
|
|
10943
|
+
}, labelContent),
|
|
10944
|
+
]);
|
|
10945
|
+
},
|
|
10946
|
+
};
|
|
10947
|
+
};
|
|
10948
|
+
|
|
10949
|
+
/** Create a LinearProgress component */
|
|
10950
|
+
const LinearProgress = () => {
|
|
10951
|
+
const state = {
|
|
10952
|
+
id: uniqueId(),
|
|
10953
|
+
};
|
|
10954
|
+
/**
|
|
10955
|
+
* Get size class name
|
|
10956
|
+
*/
|
|
10957
|
+
const getSizeClass = (size = 'medium') => {
|
|
10958
|
+
return `linear-progress__track--${size}`;
|
|
10959
|
+
};
|
|
10960
|
+
/**
|
|
10961
|
+
* Get color class name
|
|
10962
|
+
*/
|
|
10963
|
+
const getColorClass = (color, intensity) => {
|
|
10964
|
+
if (!color)
|
|
10965
|
+
return '';
|
|
10966
|
+
return intensity ? `linear-progress--${color} linear-progress--${intensity}` : `linear-progress--${color}`;
|
|
10967
|
+
};
|
|
10968
|
+
return {
|
|
10969
|
+
view: ({ attrs }) => {
|
|
10970
|
+
const { mode = 'indeterminate', value = 0, max = 100, size = 'medium', color = 'teal', colorIntensity, label, showPercentage = false, className = '', style = {}, id = state.id, 'aria-label': ariaLabel, 'aria-valuemin': ariaValueMin = 0, 'aria-valuemax': ariaValueMax = max, 'aria-valuenow': ariaValueNow, 'aria-valuetext': ariaValueText } = attrs, params = __rest(attrs, ["mode", "value", "max", "size", "color", "colorIntensity", "label", "showPercentage", "className", "style", "id", 'aria-label', 'aria-valuemin', 'aria-valuemax', 'aria-valuenow', 'aria-valuetext']);
|
|
10971
|
+
const isDeterminate = mode === 'determinate';
|
|
10972
|
+
const percentage = Math.min(100, Math.max(0, (value / max) * 100));
|
|
10973
|
+
// Determine label content
|
|
10974
|
+
const labelContent = label !== undefined ? label : showPercentage && isDeterminate ? `${Math.round(percentage)}%` : '';
|
|
10975
|
+
// Build class names
|
|
10976
|
+
const classNames = [
|
|
10977
|
+
'linear-progress',
|
|
10978
|
+
getColorClass(color, colorIntensity),
|
|
10979
|
+
className,
|
|
10980
|
+
]
|
|
10981
|
+
.filter(Boolean)
|
|
10982
|
+
.join(' ');
|
|
10983
|
+
// ARIA attributes
|
|
10984
|
+
const ariaAttrs = isDeterminate
|
|
10985
|
+
? {
|
|
10986
|
+
'aria-valuenow': ariaValueNow !== undefined ? ariaValueNow : value,
|
|
10987
|
+
'aria-valuemin': ariaValueMin,
|
|
10988
|
+
'aria-valuemax': ariaValueMax,
|
|
10989
|
+
'aria-valuetext': ariaValueText || `${Math.round(percentage)}%`,
|
|
10990
|
+
}
|
|
10991
|
+
: {
|
|
10992
|
+
'aria-valuetext': ariaValueText || label || 'Loading',
|
|
10993
|
+
};
|
|
10994
|
+
return m('.linear-progress', Object.assign(Object.assign({}, params), { className: classNames, style,
|
|
10995
|
+
id }), [
|
|
10996
|
+
// Progress track container
|
|
10997
|
+
m('.linear-progress__track', Object.assign({ className: `linear-progress__track ${getSizeClass(size)}`, role: 'progressbar', 'aria-label': ariaLabel || (isDeterminate ? `Progress: ${Math.round(percentage)}%` : 'Loading') }, ariaAttrs), [
|
|
10998
|
+
// Progress bar
|
|
10999
|
+
m('.linear-progress__bar', {
|
|
11000
|
+
className: `linear-progress__bar ${isDeterminate ? '' : 'linear-progress__bar--indeterminate'}`,
|
|
11001
|
+
style: isDeterminate ? { width: `${percentage}%` } : undefined,
|
|
11002
|
+
}),
|
|
11003
|
+
]),
|
|
11004
|
+
// Label at the end (right side)
|
|
11005
|
+
labelContent &&
|
|
11006
|
+
m('.linear-progress__label', {
|
|
11007
|
+
'aria-hidden': 'true',
|
|
11008
|
+
}, labelContent),
|
|
11009
|
+
]);
|
|
11010
|
+
},
|
|
11011
|
+
};
|
|
11012
|
+
};
|
|
11013
|
+
|
|
10838
11014
|
/**
|
|
10839
11015
|
* @fileoverview Core TypeScript utility types for mithril-materialized library
|
|
10840
11016
|
* These types improve type safety and developer experience across all components
|
|
@@ -10866,6 +11042,7 @@
|
|
|
10866
11042
|
exports.Carousel = Carousel;
|
|
10867
11043
|
exports.CharacterCounter = CharacterCounter;
|
|
10868
11044
|
exports.Chips = Chips;
|
|
11045
|
+
exports.CircularProgress = CircularProgress;
|
|
10869
11046
|
exports.CodeBlock = CodeBlock;
|
|
10870
11047
|
exports.Collapsible = Collapsible;
|
|
10871
11048
|
exports.CollapsibleItem = CollapsibleItem;
|
|
@@ -10888,6 +11065,7 @@
|
|
|
10888
11065
|
exports.InputCheckbox = InputCheckbox;
|
|
10889
11066
|
exports.Label = Label;
|
|
10890
11067
|
exports.LargeButton = LargeButton;
|
|
11068
|
+
exports.LinearProgress = LinearProgress;
|
|
10891
11069
|
exports.ListItem = ListItem;
|
|
10892
11070
|
exports.Mandatory = Mandatory;
|
|
10893
11071
|
exports.Masonry = Masonry;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { FactoryComponent, Attributes } from 'mithril';
|
|
2
|
+
import { MaterialColor, ColorIntensity } from './types';
|
|
3
|
+
import { ProgressMode, ProgressSize } from './circular-progress';
|
|
4
|
+
/** LinearProgress component attributes */
|
|
5
|
+
export interface LinearProgressAttrs extends Attributes {
|
|
6
|
+
/** Progress mode (default: 'indeterminate') */
|
|
7
|
+
mode?: ProgressMode;
|
|
8
|
+
/** Current progress value (0-100) for determinate mode */
|
|
9
|
+
value?: number;
|
|
10
|
+
/** Maximum progress value (default: 100) */
|
|
11
|
+
max?: number;
|
|
12
|
+
/** Size variant (default: 'medium') */
|
|
13
|
+
size?: ProgressSize;
|
|
14
|
+
/** Materialize color (default: 'teal') */
|
|
15
|
+
color?: MaterialColor;
|
|
16
|
+
/** Color intensity modifier */
|
|
17
|
+
colorIntensity?: ColorIntensity;
|
|
18
|
+
/** Label to display at the end (right side) */
|
|
19
|
+
label?: string | number;
|
|
20
|
+
/** Auto-show percentage at the end for determinate mode (default: false) */
|
|
21
|
+
showPercentage?: boolean;
|
|
22
|
+
/** Additional CSS class names */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Additional CSS styles */
|
|
25
|
+
style?: any;
|
|
26
|
+
/** HTML ID for the component */
|
|
27
|
+
id?: string;
|
|
28
|
+
/** ARIA label for accessibility */
|
|
29
|
+
'aria-label'?: string;
|
|
30
|
+
/** ARIA valuemin (default: 0) */
|
|
31
|
+
'aria-valuemin'?: number;
|
|
32
|
+
/** ARIA valuemax (default: 100) */
|
|
33
|
+
'aria-valuemax'?: number;
|
|
34
|
+
/** ARIA valuenow (current value) */
|
|
35
|
+
'aria-valuenow'?: number;
|
|
36
|
+
/** ARIA valuetext (custom text description) */
|
|
37
|
+
'aria-valuetext'?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Create a LinearProgress component */
|
|
40
|
+
export declare const LinearProgress: FactoryComponent<LinearProgressAttrs>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
2
|
+
@use "variables";
|
|
3
|
+
@use "color-variables";
|
|
4
|
+
|
|
5
|
+
/* CircularProgress Component
|
|
6
|
+
========================================================================== */
|
|
7
|
+
|
|
8
|
+
// CircularProgress component variables
|
|
9
|
+
$circular-progress-size-small: 36px !default;
|
|
10
|
+
$circular-progress-size-medium: 50px !default;
|
|
11
|
+
$circular-progress-size-large: 64px !default;
|
|
12
|
+
$circular-progress-stroke-width: 3px !default;
|
|
13
|
+
$circular-progress-default-color: var(--mm-primary-color, variables.$primary-color) !default;
|
|
14
|
+
$circular-progress-track-opacity: 0.2 !default;
|
|
15
|
+
|
|
16
|
+
// Label font sizes
|
|
17
|
+
$circular-progress-label-small: 10px !default;
|
|
18
|
+
$circular-progress-label-medium: 12px !default;
|
|
19
|
+
$circular-progress-label-large: 14px !default;
|
|
20
|
+
|
|
21
|
+
.circular-progress {
|
|
22
|
+
position: relative;
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
color: $circular-progress-default-color;
|
|
27
|
+
|
|
28
|
+
// Size variants
|
|
29
|
+
&--small {
|
|
30
|
+
width: $circular-progress-size-small;
|
|
31
|
+
height: $circular-progress-size-small;
|
|
32
|
+
|
|
33
|
+
.circular-progress__label {
|
|
34
|
+
font-size: $circular-progress-label-small;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&--medium {
|
|
39
|
+
width: $circular-progress-size-medium;
|
|
40
|
+
height: $circular-progress-size-medium;
|
|
41
|
+
|
|
42
|
+
.circular-progress__label {
|
|
43
|
+
font-size: $circular-progress-label-medium;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&--large {
|
|
48
|
+
width: $circular-progress-size-large;
|
|
49
|
+
height: $circular-progress-size-large;
|
|
50
|
+
|
|
51
|
+
.circular-progress__label {
|
|
52
|
+
font-size: $circular-progress-label-large;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.circular-progress__svg {
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
transform: rotate(-90deg);
|
|
61
|
+
transform-origin: center;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.circular-progress__circle {
|
|
65
|
+
transition: stroke-dashoffset 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
66
|
+
|
|
67
|
+
&--track {
|
|
68
|
+
opacity: $circular-progress-track-opacity;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&--indicator {
|
|
72
|
+
opacity: 1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.circular-progress__label {
|
|
77
|
+
position: absolute;
|
|
78
|
+
top: 50%;
|
|
79
|
+
left: 50%;
|
|
80
|
+
transform: translate(-50%, -50%);
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
text-align: center;
|
|
83
|
+
line-height: 1;
|
|
84
|
+
color: currentColor;
|
|
85
|
+
user-select: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Indeterminate mode animation
|
|
89
|
+
.circular-progress--indeterminate {
|
|
90
|
+
.circular-progress__svg {
|
|
91
|
+
animation: circular-rotate 2s linear infinite;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.circular-progress__circle--indicator {
|
|
95
|
+
stroke-dasharray: 80, 200;
|
|
96
|
+
stroke-dashoffset: 0;
|
|
97
|
+
animation: circular-dash 1.5s ease-in-out infinite;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Determinate mode
|
|
102
|
+
.circular-progress--determinate {
|
|
103
|
+
.circular-progress__circle--indicator {
|
|
104
|
+
transition: stroke-dashoffset 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Color variants using Materialize colors
|
|
109
|
+
.circular-progress--red { color: color-variables.color("red", "base"); }
|
|
110
|
+
.circular-progress--pink { color: color-variables.color("pink", "base"); }
|
|
111
|
+
.circular-progress--purple { color: color-variables.color("purple", "base"); }
|
|
112
|
+
.circular-progress--deep-purple { color: color-variables.color("deep-purple", "base"); }
|
|
113
|
+
.circular-progress--indigo { color: color-variables.color("indigo", "base"); }
|
|
114
|
+
.circular-progress--blue { color: color-variables.color("blue", "base"); }
|
|
115
|
+
.circular-progress--light-blue { color: color-variables.color("light-blue", "base"); }
|
|
116
|
+
.circular-progress--cyan { color: color-variables.color("cyan", "base"); }
|
|
117
|
+
.circular-progress--teal { color: color-variables.color("teal", "base"); }
|
|
118
|
+
.circular-progress--green { color: color-variables.color("green", "base"); }
|
|
119
|
+
.circular-progress--light-green { color: color-variables.color("light-green", "base"); }
|
|
120
|
+
.circular-progress--lime { color: color-variables.color("lime", "base"); }
|
|
121
|
+
.circular-progress--yellow { color: color-variables.color("yellow", "base"); }
|
|
122
|
+
.circular-progress--amber { color: color-variables.color("amber", "base"); }
|
|
123
|
+
.circular-progress--orange { color: color-variables.color("orange", "base"); }
|
|
124
|
+
.circular-progress--deep-orange { color: color-variables.color("deep-orange", "base"); }
|
|
125
|
+
.circular-progress--brown { color: color-variables.color("brown", "base"); }
|
|
126
|
+
.circular-progress--grey { color: color-variables.color("grey", "base"); }
|
|
127
|
+
.circular-progress--blue-grey { color: color-variables.color("blue-grey", "base"); }
|
|
128
|
+
|
|
129
|
+
// Color intensity modifiers
|
|
130
|
+
.circular-progress--lighten-5 { filter: brightness(1.4); }
|
|
131
|
+
.circular-progress--lighten-4 { filter: brightness(1.3); }
|
|
132
|
+
.circular-progress--lighten-3 { filter: brightness(1.2); }
|
|
133
|
+
.circular-progress--lighten-2 { filter: brightness(1.1); }
|
|
134
|
+
.circular-progress--lighten-1 { filter: brightness(1.05); }
|
|
135
|
+
.circular-progress--darken-1 { filter: brightness(0.95); }
|
|
136
|
+
.circular-progress--darken-2 { filter: brightness(0.9); }
|
|
137
|
+
.circular-progress--darken-3 { filter: brightness(0.8); }
|
|
138
|
+
.circular-progress--darken-4 { filter: brightness(0.7); }
|
|
139
|
+
|
|
140
|
+
// Animations
|
|
141
|
+
@keyframes circular-rotate {
|
|
142
|
+
0% {
|
|
143
|
+
transform: rotate(-90deg);
|
|
144
|
+
}
|
|
145
|
+
100% {
|
|
146
|
+
transform: rotate(270deg);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@keyframes circular-dash {
|
|
151
|
+
0% {
|
|
152
|
+
stroke-dasharray: 1, 200;
|
|
153
|
+
stroke-dashoffset: 0;
|
|
154
|
+
}
|
|
155
|
+
50% {
|
|
156
|
+
stroke-dasharray: 100, 200;
|
|
157
|
+
stroke-dashoffset: -15;
|
|
158
|
+
}
|
|
159
|
+
100% {
|
|
160
|
+
stroke-dasharray: 100, 200;
|
|
161
|
+
stroke-dashoffset: -125;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Dark theme support
|
|
166
|
+
[data-theme="dark"] {
|
|
167
|
+
.circular-progress {
|
|
168
|
+
.circular-progress__circle--track {
|
|
169
|
+
opacity: 0.15;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// RTL support
|
|
175
|
+
[dir="rtl"] {
|
|
176
|
+
.circular-progress__svg {
|
|
177
|
+
transform: rotate(90deg);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.circular-progress--indeterminate .circular-progress__svg {
|
|
181
|
+
animation: circular-rotate-rtl 2s linear infinite;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@keyframes circular-rotate-rtl {
|
|
185
|
+
0% {
|
|
186
|
+
transform: rotate(90deg);
|
|
187
|
+
}
|
|
188
|
+
100% {
|
|
189
|
+
transform: rotate(-270deg);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Reduced motion support
|
|
195
|
+
@media (prefers-reduced-motion: reduce) {
|
|
196
|
+
.circular-progress__circle,
|
|
197
|
+
.circular-progress__svg {
|
|
198
|
+
transition: none !important;
|
|
199
|
+
animation: none !important;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.circular-progress--indeterminate {
|
|
203
|
+
.circular-progress__svg {
|
|
204
|
+
animation: none;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.circular-progress__circle--indicator {
|
|
208
|
+
animation: none;
|
|
209
|
+
stroke-dasharray: 100, 200;
|
|
210
|
+
stroke-dashoffset: -50;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// High contrast mode support
|
|
216
|
+
@media (prefers-contrast: high) {
|
|
217
|
+
.circular-progress__circle--track {
|
|
218
|
+
opacity: 0.4;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
2
|
+
@use "variables";
|
|
3
|
+
@use "color-variables";
|
|
4
|
+
|
|
5
|
+
/* LinearProgress Component
|
|
6
|
+
========================================================================== */
|
|
7
|
+
|
|
8
|
+
// LinearProgress component variables
|
|
9
|
+
$linear-progress-height-small: 4px !default;
|
|
10
|
+
$linear-progress-height-medium: 8px !default;
|
|
11
|
+
$linear-progress-height-large: 12px !default;
|
|
12
|
+
$linear-progress-default-color: var(--mm-primary-color, variables.$primary-color) !default;
|
|
13
|
+
$linear-progress-track-bg: rgba(0, 0, 0, 0.1) !default;
|
|
14
|
+
$linear-progress-track-bg-dark: rgba(255, 255, 255, 0.15) !default;
|
|
15
|
+
$linear-progress-border-radius: 2px !default;
|
|
16
|
+
$linear-progress-gap: 12px !default;
|
|
17
|
+
|
|
18
|
+
// Label font size
|
|
19
|
+
$linear-progress-label-font-size: 0.875rem !default;
|
|
20
|
+
|
|
21
|
+
.linear-progress {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: $linear-progress-gap;
|
|
25
|
+
width: 100%;
|
|
26
|
+
color: $linear-progress-default-color;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.linear-progress__track {
|
|
30
|
+
position: relative;
|
|
31
|
+
flex: 1;
|
|
32
|
+
background-color: $linear-progress-track-bg;
|
|
33
|
+
border-radius: $linear-progress-border-radius;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
|
|
36
|
+
// Size variants
|
|
37
|
+
&--small {
|
|
38
|
+
height: $linear-progress-height-small;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--medium {
|
|
42
|
+
height: $linear-progress-height-medium;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&--large {
|
|
46
|
+
height: $linear-progress-height-large;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.linear-progress__bar {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
bottom: 0;
|
|
55
|
+
background-color: currentColor;
|
|
56
|
+
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
57
|
+
border-radius: $linear-progress-border-radius;
|
|
58
|
+
|
|
59
|
+
// Indeterminate mode animation
|
|
60
|
+
&--indeterminate {
|
|
61
|
+
width: 30%;
|
|
62
|
+
animation: linear-indeterminate 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.linear-progress__label {
|
|
67
|
+
flex-shrink: 0;
|
|
68
|
+
font-size: $linear-progress-label-font-size;
|
|
69
|
+
font-weight: 500;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
color: currentColor;
|
|
72
|
+
user-select: none;
|
|
73
|
+
min-width: 40px;
|
|
74
|
+
text-align: right;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Color variants using Materialize colors
|
|
78
|
+
.linear-progress--red { color: color-variables.color("red", "base"); }
|
|
79
|
+
.linear-progress--pink { color: color-variables.color("pink", "base"); }
|
|
80
|
+
.linear-progress--purple { color: color-variables.color("purple", "base"); }
|
|
81
|
+
.linear-progress--deep-purple { color: color-variables.color("deep-purple", "base"); }
|
|
82
|
+
.linear-progress--indigo { color: color-variables.color("indigo", "base"); }
|
|
83
|
+
.linear-progress--blue { color: color-variables.color("blue", "base"); }
|
|
84
|
+
.linear-progress--light-blue { color: color-variables.color("light-blue", "base"); }
|
|
85
|
+
.linear-progress--cyan { color: color-variables.color("cyan", "base"); }
|
|
86
|
+
.linear-progress--teal { color: color-variables.color("teal", "base"); }
|
|
87
|
+
.linear-progress--green { color: color-variables.color("green", "base"); }
|
|
88
|
+
.linear-progress--light-green { color: color-variables.color("light-green", "base"); }
|
|
89
|
+
.linear-progress--lime { color: color-variables.color("lime", "base"); }
|
|
90
|
+
.linear-progress--yellow { color: color-variables.color("yellow", "base"); }
|
|
91
|
+
.linear-progress--amber { color: color-variables.color("amber", "base"); }
|
|
92
|
+
.linear-progress--orange { color: color-variables.color("orange", "base"); }
|
|
93
|
+
.linear-progress--deep-orange { color: color-variables.color("deep-orange", "base"); }
|
|
94
|
+
.linear-progress--brown { color: color-variables.color("brown", "base"); }
|
|
95
|
+
.linear-progress--grey { color: color-variables.color("grey", "base"); }
|
|
96
|
+
.linear-progress--blue-grey { color: color-variables.color("blue-grey", "base"); }
|
|
97
|
+
|
|
98
|
+
// Color intensity modifiers
|
|
99
|
+
.linear-progress--lighten-5 { filter: brightness(1.4); }
|
|
100
|
+
.linear-progress--lighten-4 { filter: brightness(1.3); }
|
|
101
|
+
.linear-progress--lighten-3 { filter: brightness(1.2); }
|
|
102
|
+
.linear-progress--lighten-2 { filter: brightness(1.1); }
|
|
103
|
+
.linear-progress--lighten-1 { filter: brightness(1.05); }
|
|
104
|
+
.linear-progress--darken-1 { filter: brightness(0.95); }
|
|
105
|
+
.linear-progress--darken-2 { filter: brightness(0.9); }
|
|
106
|
+
.linear-progress--darken-3 { filter: brightness(0.8); }
|
|
107
|
+
.linear-progress--darken-4 { filter: brightness(0.7); }
|
|
108
|
+
|
|
109
|
+
// Indeterminate animation
|
|
110
|
+
@keyframes linear-indeterminate {
|
|
111
|
+
0% {
|
|
112
|
+
left: -35%;
|
|
113
|
+
right: 100%;
|
|
114
|
+
}
|
|
115
|
+
60% {
|
|
116
|
+
left: 100%;
|
|
117
|
+
right: -90%;
|
|
118
|
+
}
|
|
119
|
+
100% {
|
|
120
|
+
left: 100%;
|
|
121
|
+
right: -90%;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Dark theme support
|
|
126
|
+
[data-theme="dark"] {
|
|
127
|
+
.linear-progress__track {
|
|
128
|
+
background-color: $linear-progress-track-bg-dark;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// RTL support
|
|
133
|
+
[dir="rtl"] {
|
|
134
|
+
.linear-progress__label {
|
|
135
|
+
text-align: left;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.linear-progress__bar--indeterminate {
|
|
139
|
+
animation: linear-indeterminate-rtl 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@keyframes linear-indeterminate-rtl {
|
|
143
|
+
0% {
|
|
144
|
+
right: -35%;
|
|
145
|
+
left: 100%;
|
|
146
|
+
}
|
|
147
|
+
60% {
|
|
148
|
+
right: 100%;
|
|
149
|
+
left: -90%;
|
|
150
|
+
}
|
|
151
|
+
100% {
|
|
152
|
+
right: 100%;
|
|
153
|
+
left: -90%;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Reduced motion support
|
|
159
|
+
@media (prefers-reduced-motion: reduce) {
|
|
160
|
+
.linear-progress__bar {
|
|
161
|
+
transition: none !important;
|
|
162
|
+
animation: none !important;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.linear-progress__bar--indeterminate {
|
|
166
|
+
animation: none;
|
|
167
|
+
width: 100%;
|
|
168
|
+
left: 0;
|
|
169
|
+
opacity: 0.5;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// High contrast mode support
|
|
174
|
+
@media (prefers-contrast: high) {
|
|
175
|
+
.linear-progress__track {
|
|
176
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
177
|
+
border: 1px solid currentColor;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
[data-theme="dark"] .linear-progress__track {
|
|
181
|
+
background-color: rgba(255, 255, 255, 0.3);
|
|
182
|
+
}
|
|
183
|
+
}
|