@instructure/ui-progress 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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/CHANGELOG.md +13 -0
- package/es/ProgressBar/v1/index.js +90 -123
- package/es/ProgressBar/v1/props.js +15 -26
- package/es/ProgressBar/v1/styles.js +167 -209
- package/es/ProgressBar/v1/theme.js +55 -93
- package/es/ProgressBar/v2/index.js +90 -123
- package/es/ProgressBar/v2/props.js +15 -26
- package/es/ProgressBar/v2/styles.js +188 -235
- package/es/ProgressCircle/v1/index.js +128 -165
- package/es/ProgressCircle/v1/props.js +16 -26
- package/es/ProgressCircle/v1/styles.js +291 -348
- package/es/ProgressCircle/v1/theme.js +88 -128
- package/es/ProgressCircle/v2/index.js +128 -165
- package/es/ProgressCircle/v2/props.js +16 -26
- package/es/ProgressCircle/v2/styles.js +291 -348
- package/es/exports/a.js +1 -25
- package/es/exports/b.js +1 -25
- package/package.json +13 -19
- package/tsconfig.build.json +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/ProgressBar/v1/index.js +0 -137
- package/lib/ProgressBar/v1/props.js +0 -31
- package/lib/ProgressBar/v1/styles.js +0 -216
- package/lib/ProgressBar/v1/theme.js +0 -100
- package/lib/ProgressBar/v2/index.js +0 -136
- package/lib/ProgressBar/v2/props.js +0 -31
- package/lib/ProgressBar/v2/styles.js +0 -242
- package/lib/ProgressCircle/v1/index.js +0 -182
- package/lib/ProgressCircle/v1/props.js +0 -31
- package/lib/ProgressCircle/v1/styles.js +0 -357
- package/lib/ProgressCircle/v1/theme.js +0 -146
- package/lib/ProgressCircle/v2/index.js +0 -181
- package/lib/ProgressCircle/v2/props.js +0 -31
- package/lib/ProgressCircle/v2/styles.js +0 -357
- package/lib/exports/a.js +0 -19
- package/lib/exports/b.js +0 -19
- package/lib/package.json +0 -1
|
@@ -1,236 +1,189 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
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|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
background: 'transparent',
|
|
189
|
-
// Inner border-radius must be smaller than outer to avoid geometric gaps with nested rounded borders
|
|
190
|
-
// Formula: inner radius = outer radius - border width
|
|
191
|
-
borderRadius: `calc(${componentTheme.borderRadius} - ${componentTheme.trackBottomBorderWidth})`,
|
|
192
|
-
// Negative margin pulls track down so trackLayout's full border overlaps and hides track's bottom border.
|
|
193
|
-
// When trackLayout border is visible (light/dark themes), it creates a clean full border appearance.
|
|
194
|
-
// When trackLayout border is transparent (legacy Canvas), track's bottom border remains visible.
|
|
195
|
-
marginBottom: `calc(-1 * ${componentTheme.trackBottomBorderWidth})`,
|
|
196
|
-
...sizeVariants[size].track,
|
|
197
|
-
...colorVariants[color].trackBorder
|
|
198
|
-
},
|
|
199
|
-
trackValue: {
|
|
200
|
-
label: 'progressBar__trackValue',
|
|
201
|
-
display: 'block',
|
|
202
|
-
boxSizing: 'border-box',
|
|
203
|
-
height: '100%',
|
|
204
|
-
width: currentValuePercent,
|
|
205
|
-
maxWidth: '100%',
|
|
206
|
-
borderRadius: 'inherit',
|
|
207
|
-
...(shouldAnimate && {
|
|
208
|
-
transition: 'all 0.5s'
|
|
209
|
-
}),
|
|
210
|
-
...(meterColorClassName && trackBackgroundVariants[color][meterColorClassName])
|
|
211
|
-
},
|
|
212
|
-
value: {
|
|
213
|
-
label: 'progressBar__value',
|
|
214
|
-
lineHeight: 1,
|
|
215
|
-
boxSizing: 'border-box',
|
|
216
|
-
paddingInlineStart: componentTheme.valuePadding,
|
|
217
|
-
flex: '0 0 5.625rem',
|
|
218
|
-
...sizeVariants[size].value,
|
|
219
|
-
...colorVariants[color].value
|
|
220
|
-
},
|
|
221
|
-
htmlProgress: {
|
|
222
|
-
label: 'progressBar__htmlProgress',
|
|
223
|
-
display: 'block',
|
|
224
|
-
position: 'absolute',
|
|
225
|
-
top: '0',
|
|
226
|
-
left: '0',
|
|
227
|
-
width: '100%',
|
|
228
|
-
height: '100%',
|
|
229
|
-
boxSizing: 'border-box',
|
|
230
|
-
zIndex: -1,
|
|
231
|
-
opacity: 0,
|
|
232
|
-
...colorVariants[color].htmlProgress
|
|
233
|
-
}
|
|
234
|
-
};
|
|
1
|
+
const generateStyle = (componentTheme, props, _sharedTokens)=>{
|
|
2
|
+
const { valueNow = 0, valueMax = 100, size, color, meterColor, shouldAnimate } = props;
|
|
3
|
+
const meterColorClassName = typeof meterColor === 'function' ? meterColor({
|
|
4
|
+
valueNow,
|
|
5
|
+
valueMax
|
|
6
|
+
}) : meterColor;
|
|
7
|
+
const currentValue = valueNow > valueMax ? valueMax : valueNow < 0 ? 0 : valueNow;
|
|
8
|
+
const currentValuePercent = `${currentValue / valueMax * 100}%`;
|
|
9
|
+
const sizeVariants = {
|
|
10
|
+
'x-small': {
|
|
11
|
+
track: {
|
|
12
|
+
height: componentTheme.xSmallHeight
|
|
13
|
+
},
|
|
14
|
+
value: {
|
|
15
|
+
fontSize: componentTheme.xSmallValueFontSize
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
small: {
|
|
19
|
+
track: {
|
|
20
|
+
height: componentTheme.smallHeight
|
|
21
|
+
},
|
|
22
|
+
value: {
|
|
23
|
+
fontSize: componentTheme.smallValueFontSize
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
medium: {
|
|
27
|
+
track: {
|
|
28
|
+
height: componentTheme.mediumHeight
|
|
29
|
+
},
|
|
30
|
+
value: {
|
|
31
|
+
fontSize: componentTheme.mediumValueFontSize
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
large: {
|
|
35
|
+
track: {
|
|
36
|
+
height: componentTheme.largeHeight
|
|
37
|
+
},
|
|
38
|
+
value: {
|
|
39
|
+
fontSize: componentTheme.largeValueFontSize
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const colorVariants = {
|
|
44
|
+
primary: {
|
|
45
|
+
trackLayout: {
|
|
46
|
+
background: componentTheme.trackColor,
|
|
47
|
+
borderWidth: componentTheme.trackBottomBorderWidth,
|
|
48
|
+
borderStyle: 'solid',
|
|
49
|
+
borderColor: componentTheme.borderColor
|
|
50
|
+
},
|
|
51
|
+
trackBorder: {
|
|
52
|
+
borderBottomColor: componentTheme.trackBottomBorderColor
|
|
53
|
+
},
|
|
54
|
+
value: {
|
|
55
|
+
color: componentTheme.textColor
|
|
56
|
+
},
|
|
57
|
+
htmlProgress: {
|
|
58
|
+
borderColor: componentTheme.borderColor
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
'primary-inverse': {
|
|
62
|
+
trackLayout: {
|
|
63
|
+
background: componentTheme.trackColorInverse,
|
|
64
|
+
borderWidth: componentTheme.trackBottomBorderWidth,
|
|
65
|
+
borderStyle: 'solid',
|
|
66
|
+
borderColor: componentTheme.borderColorInverse
|
|
67
|
+
},
|
|
68
|
+
trackBorder: {
|
|
69
|
+
borderBottomColor: componentTheme.trackBottomBorderColorInverse
|
|
70
|
+
},
|
|
71
|
+
value: {
|
|
72
|
+
color: componentTheme.textColorInverse
|
|
73
|
+
},
|
|
74
|
+
htmlProgress: {
|
|
75
|
+
borderColor: componentTheme.borderColorInverse
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const trackBackgroundVariants = {
|
|
80
|
+
primary: {
|
|
81
|
+
brand: {
|
|
82
|
+
background: componentTheme.meterColorBrand
|
|
83
|
+
},
|
|
84
|
+
info: {
|
|
85
|
+
background: componentTheme.meterColorInfo
|
|
86
|
+
},
|
|
87
|
+
success: {
|
|
88
|
+
background: componentTheme.meterColorSuccess
|
|
89
|
+
},
|
|
90
|
+
danger: {
|
|
91
|
+
background: componentTheme.meterColorDanger
|
|
92
|
+
},
|
|
93
|
+
warning: {
|
|
94
|
+
background: componentTheme.meterColorWarning
|
|
95
|
+
},
|
|
96
|
+
alert: {
|
|
97
|
+
background: componentTheme.meterColorAlert
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
'primary-inverse': {
|
|
101
|
+
brand: {
|
|
102
|
+
background: componentTheme.meterColorBrandInverse
|
|
103
|
+
},
|
|
104
|
+
info: {
|
|
105
|
+
background: componentTheme.meterColorInfoInverse
|
|
106
|
+
},
|
|
107
|
+
success: {
|
|
108
|
+
background: componentTheme.meterColorSuccessInverse
|
|
109
|
+
},
|
|
110
|
+
danger: {
|
|
111
|
+
background: componentTheme.meterColorDangerInverse
|
|
112
|
+
},
|
|
113
|
+
warning: {
|
|
114
|
+
background: componentTheme.meterColorWarningInverse
|
|
115
|
+
},
|
|
116
|
+
alert: {
|
|
117
|
+
background: componentTheme.meterColorAlertInverse
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
progressBar: {
|
|
123
|
+
label: 'progressBar',
|
|
124
|
+
display: 'flex',
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
fontFamily: componentTheme.fontFamily,
|
|
127
|
+
fontWeight: componentTheme.fontWeight,
|
|
128
|
+
lineHeight: componentTheme.lineHeight,
|
|
129
|
+
fontSize: componentTheme.fontSize,
|
|
130
|
+
borderRadius: componentTheme.borderRadius
|
|
131
|
+
},
|
|
132
|
+
trackLayout: {
|
|
133
|
+
label: 'progressBar__trackLayout',
|
|
134
|
+
position: 'relative',
|
|
135
|
+
flex: 1,
|
|
136
|
+
borderRadius: 'inherit',
|
|
137
|
+
...colorVariants[color].trackLayout
|
|
138
|
+
},
|
|
139
|
+
track: {
|
|
140
|
+
label: 'progressBar__track',
|
|
141
|
+
display: 'block',
|
|
142
|
+
boxSizing: 'border-box',
|
|
143
|
+
width: '100%',
|
|
144
|
+
borderBottomWidth: componentTheme.trackBottomBorderWidth,
|
|
145
|
+
borderBottomStyle: 'solid',
|
|
146
|
+
background: 'transparent',
|
|
147
|
+
borderRadius: `calc(${componentTheme.borderRadius} - ${componentTheme.trackBottomBorderWidth})`,
|
|
148
|
+
marginBottom: `calc(-1 * ${componentTheme.trackBottomBorderWidth})`,
|
|
149
|
+
...sizeVariants[size].track,
|
|
150
|
+
...colorVariants[color].trackBorder
|
|
151
|
+
},
|
|
152
|
+
trackValue: {
|
|
153
|
+
label: 'progressBar__trackValue',
|
|
154
|
+
display: 'block',
|
|
155
|
+
boxSizing: 'border-box',
|
|
156
|
+
height: '100%',
|
|
157
|
+
width: currentValuePercent,
|
|
158
|
+
maxWidth: '100%',
|
|
159
|
+
borderRadius: 'inherit',
|
|
160
|
+
...shouldAnimate && {
|
|
161
|
+
transition: 'all 0.5s'
|
|
162
|
+
},
|
|
163
|
+
...meterColorClassName && trackBackgroundVariants[color][meterColorClassName]
|
|
164
|
+
},
|
|
165
|
+
value: {
|
|
166
|
+
label: 'progressBar__value',
|
|
167
|
+
lineHeight: 1,
|
|
168
|
+
boxSizing: 'border-box',
|
|
169
|
+
paddingInlineStart: componentTheme.valuePadding,
|
|
170
|
+
flex: '0 0 5.625rem',
|
|
171
|
+
...sizeVariants[size].value,
|
|
172
|
+
...colorVariants[color].value
|
|
173
|
+
},
|
|
174
|
+
htmlProgress: {
|
|
175
|
+
label: 'progressBar__htmlProgress',
|
|
176
|
+
display: 'block',
|
|
177
|
+
position: 'absolute',
|
|
178
|
+
top: '0',
|
|
179
|
+
left: '0',
|
|
180
|
+
width: '100%',
|
|
181
|
+
height: '100%',
|
|
182
|
+
boxSizing: 'border-box',
|
|
183
|
+
zIndex: -1,
|
|
184
|
+
opacity: 0,
|
|
185
|
+
...colorVariants[color].htmlProgress
|
|
186
|
+
}
|
|
187
|
+
};
|
|
235
188
|
};
|
|
236
|
-
export default generateStyle;
|
|
189
|
+
export default generateStyle;
|