@instructure/ui-progress 11.6.0 → 11.6.1-snapshot-129
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 +37 -294
- package/es/ProgressBar/{index.js → v1/index.js} +2 -2
- package/es/ProgressBar/v2/index.js +130 -0
- package/{src/index.ts → es/ProgressBar/v2/props.js} +2 -5
- package/es/ProgressBar/v2/styles.js +237 -0
- package/es/ProgressCircle/{index.js → v1/index.js} +2 -2
- package/es/ProgressCircle/v2/index.js +173 -0
- package/es/ProgressCircle/v2/props.js +26 -0
- package/es/ProgressCircle/v2/styles.js +349 -0
- package/es/{index.js → exports/a.js} +2 -2
- package/es/exports/b.js +25 -0
- package/lib/ProgressBar/{index.js → v1/index.js} +3 -3
- package/lib/ProgressBar/v2/index.js +136 -0
- package/lib/ProgressBar/v2/props.js +31 -0
- package/lib/ProgressBar/v2/styles.js +243 -0
- package/lib/ProgressCircle/{index.js → v1/index.js} +3 -3
- package/lib/ProgressCircle/v2/index.js +179 -0
- package/lib/ProgressCircle/v2/props.js +31 -0
- package/lib/ProgressCircle/v2/styles.js +355 -0
- package/lib/{index.js → exports/a.js} +4 -4
- package/lib/exports/b.js +19 -0
- package/package.json +40 -18
- package/src/ProgressBar/{index.tsx → v1/index.tsx} +2 -2
- package/src/ProgressBar/v2/README.md +384 -0
- package/src/ProgressBar/v2/index.tsx +142 -0
- package/src/ProgressBar/v2/props.ts +155 -0
- package/src/ProgressBar/v2/styles.ts +221 -0
- package/src/ProgressCircle/{index.tsx → v1/index.tsx} +2 -2
- package/src/ProgressCircle/v2/README.md +219 -0
- package/src/ProgressCircle/v2/index.tsx +196 -0
- package/src/ProgressCircle/v2/props.ts +141 -0
- package/src/ProgressCircle/v2/styles.ts +343 -0
- package/src/exports/a.ts +29 -0
- package/src/exports/b.ts +29 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ProgressBar/v1/index.d.ts.map +1 -0
- package/types/ProgressBar/v1/props.d.ts.map +1 -0
- package/types/ProgressBar/v1/styles.d.ts.map +1 -0
- package/types/ProgressBar/v1/theme.d.ts.map +1 -0
- package/types/ProgressBar/v2/index.d.ts +43 -0
- package/types/ProgressBar/v2/index.d.ts.map +1 -0
- package/types/ProgressBar/v2/props.d.ts +77 -0
- package/types/ProgressBar/v2/props.d.ts.map +1 -0
- package/types/ProgressBar/v2/styles.d.ts +15 -0
- package/types/ProgressBar/v2/styles.d.ts.map +1 -0
- package/types/ProgressCircle/v1/index.d.ts.map +1 -0
- package/types/ProgressCircle/v1/props.d.ts.map +1 -0
- package/types/ProgressCircle/v1/styles.d.ts.map +1 -0
- package/types/ProgressCircle/v1/theme.d.ts.map +1 -0
- package/types/ProgressCircle/v2/index.d.ts +49 -0
- package/types/ProgressCircle/v2/index.d.ts.map +1 -0
- package/types/ProgressCircle/v2/props.d.ts +75 -0
- package/types/ProgressCircle/v2/props.d.ts.map +1 -0
- package/types/ProgressCircle/v2/styles.d.ts +15 -0
- package/types/ProgressCircle/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +5 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +5 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/ProgressBar/index.d.ts.map +0 -1
- package/types/ProgressBar/props.d.ts.map +0 -1
- package/types/ProgressBar/styles.d.ts.map +0 -1
- package/types/ProgressBar/theme.d.ts.map +0 -1
- package/types/ProgressCircle/index.d.ts.map +0 -1
- package/types/ProgressCircle/props.d.ts.map +0 -1
- package/types/ProgressCircle/styles.d.ts.map +0 -1
- package/types/ProgressCircle/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -5
- package/types/index.d.ts.map +0 -1
- /package/es/ProgressBar/{props.js → v1/props.js} +0 -0
- /package/es/ProgressBar/{styles.js → v1/styles.js} +0 -0
- /package/es/ProgressBar/{theme.js → v1/theme.js} +0 -0
- /package/es/ProgressCircle/{props.js → v1/props.js} +0 -0
- /package/es/ProgressCircle/{styles.js → v1/styles.js} +0 -0
- /package/es/ProgressCircle/{theme.js → v1/theme.js} +0 -0
- /package/lib/ProgressBar/{props.js → v1/props.js} +0 -0
- /package/lib/ProgressBar/{styles.js → v1/styles.js} +0 -0
- /package/lib/ProgressBar/{theme.js → v1/theme.js} +0 -0
- /package/lib/ProgressCircle/{props.js → v1/props.js} +0 -0
- /package/lib/ProgressCircle/{styles.js → v1/styles.js} +0 -0
- /package/lib/ProgressCircle/{theme.js → v1/theme.js} +0 -0
- /package/src/ProgressBar/{README.md → v1/README.md} +0 -0
- /package/src/ProgressBar/{props.ts → v1/props.ts} +0 -0
- /package/src/ProgressBar/{styles.ts → v1/styles.ts} +0 -0
- /package/src/ProgressBar/{theme.ts → v1/theme.ts} +0 -0
- /package/src/ProgressCircle/{README.md → v1/README.md} +0 -0
- /package/src/ProgressCircle/{props.ts → v1/props.ts} +0 -0
- /package/src/ProgressCircle/{styles.ts → v1/styles.ts} +0 -0
- /package/src/ProgressCircle/{theme.ts → v1/theme.ts} +0 -0
- /package/types/ProgressBar/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/ProgressBar/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/ProgressBar/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/ProgressBar/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/ProgressCircle/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/ProgressCircle/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/ProgressCircle/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/ProgressCircle/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type {
|
|
26
|
+
Spacing,
|
|
27
|
+
WithStyleProps,
|
|
28
|
+
ComponentStyle
|
|
29
|
+
} from '@instructure/emotion'
|
|
30
|
+
import type {
|
|
31
|
+
AsElementType,
|
|
32
|
+
ProgressCircleTheme,
|
|
33
|
+
OtherHTMLAttributes,
|
|
34
|
+
Renderable
|
|
35
|
+
} from '@instructure/shared-types'
|
|
36
|
+
|
|
37
|
+
export type ProgressCircleMeterColor =
|
|
38
|
+
| 'info'
|
|
39
|
+
| 'warning'
|
|
40
|
+
| 'danger'
|
|
41
|
+
| 'alert'
|
|
42
|
+
| 'success'
|
|
43
|
+
| 'brand'
|
|
44
|
+
|
|
45
|
+
export type Values = { valueNow: number; valueMax: number }
|
|
46
|
+
|
|
47
|
+
type ProgressCircleOwnProps = {
|
|
48
|
+
/**
|
|
49
|
+
* A label is required for accessibility
|
|
50
|
+
*/
|
|
51
|
+
screenReaderLabel: string
|
|
52
|
+
/**
|
|
53
|
+
* Control the size of the progress circle
|
|
54
|
+
*/
|
|
55
|
+
size?: 'x-small' | 'small' | 'medium' | 'large'
|
|
56
|
+
/**
|
|
57
|
+
* Maximum value (defaults to 100)
|
|
58
|
+
*/
|
|
59
|
+
valueMax?: Values['valueMax']
|
|
60
|
+
/**
|
|
61
|
+
* Receives the progress of the event
|
|
62
|
+
*/
|
|
63
|
+
valueNow?: Values['valueNow']
|
|
64
|
+
/**
|
|
65
|
+
* A function for formatting the text provided to screen readers via `aria-valuenow`
|
|
66
|
+
*/
|
|
67
|
+
formatScreenReaderValue?: (values: Values) => string
|
|
68
|
+
/**
|
|
69
|
+
* A function to format the displayed value. If null the value will not display.
|
|
70
|
+
* Takes `valueNow` and `valueMax` as parameters.
|
|
71
|
+
*/
|
|
72
|
+
renderValue?: Renderable<Values>
|
|
73
|
+
/**
|
|
74
|
+
* Controls the overall color scheme of the component
|
|
75
|
+
*/
|
|
76
|
+
color?: 'primary' | 'primary-inverse'
|
|
77
|
+
/**
|
|
78
|
+
* Control the color of the progress meter. Defaults to showing theme success
|
|
79
|
+
* color on completion, based on `valueNow` and `valueMax`.
|
|
80
|
+
*/
|
|
81
|
+
meterColor?:
|
|
82
|
+
| ((values: Values) => ProgressCircleMeterColor)
|
|
83
|
+
| ProgressCircleMeterColor
|
|
84
|
+
/**
|
|
85
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
86
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
87
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
88
|
+
*/
|
|
89
|
+
margin?: Spacing
|
|
90
|
+
/**
|
|
91
|
+
* Provides a reference to the component's root HTML element
|
|
92
|
+
*/
|
|
93
|
+
elementRef?: (element: Element | null) => void
|
|
94
|
+
/**
|
|
95
|
+
* Set the element type of the component's root
|
|
96
|
+
*/
|
|
97
|
+
as?: AsElementType
|
|
98
|
+
shouldAnimateOnMount?: boolean
|
|
99
|
+
animationDelay?: number
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type ProgressCircleState = {
|
|
103
|
+
shouldAnimateOnMount: boolean
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
type PropKeys = keyof ProgressCircleOwnProps
|
|
107
|
+
|
|
108
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
109
|
+
|
|
110
|
+
type ProgressCircleProps = ProgressCircleOwnProps &
|
|
111
|
+
WithStyleProps<ProgressCircleTheme, ProgressCircleStyle> &
|
|
112
|
+
OtherHTMLAttributes<ProgressCircleOwnProps>
|
|
113
|
+
|
|
114
|
+
type ProgressCircleStyle = ComponentStyle<
|
|
115
|
+
| 'progressCircle'
|
|
116
|
+
| 'center'
|
|
117
|
+
| 'value'
|
|
118
|
+
| 'circle'
|
|
119
|
+
| 'track'
|
|
120
|
+
| 'border'
|
|
121
|
+
| 'meter'
|
|
122
|
+
| 'dashOffset'
|
|
123
|
+
> & { radii: { radius: string; borderOffsetRadius: string } }
|
|
124
|
+
const allowedProps: AllowedPropKeys = [
|
|
125
|
+
'screenReaderLabel',
|
|
126
|
+
'size',
|
|
127
|
+
'valueMax',
|
|
128
|
+
'valueNow',
|
|
129
|
+
'formatScreenReaderValue',
|
|
130
|
+
'renderValue',
|
|
131
|
+
'color',
|
|
132
|
+
'meterColor',
|
|
133
|
+
'margin',
|
|
134
|
+
'elementRef',
|
|
135
|
+
'as',
|
|
136
|
+
'shouldAnimateOnMount',
|
|
137
|
+
'animationDelay'
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
export type { ProgressCircleProps, ProgressCircleStyle }
|
|
141
|
+
export { allowedProps }
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
|
|
26
|
+
import type {
|
|
27
|
+
ProgressCircleProps,
|
|
28
|
+
ProgressCircleState,
|
|
29
|
+
ProgressCircleStyle
|
|
30
|
+
} from './props'
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* ---
|
|
34
|
+
* private: true
|
|
35
|
+
* ---
|
|
36
|
+
* Generates the style object from the theme and provided additional information
|
|
37
|
+
* @param {Object} componentTheme The theme variable object.
|
|
38
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
39
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
40
|
+
* @return {Object} The final style object, which will be used in the component
|
|
41
|
+
*/
|
|
42
|
+
const generateStyle = (
|
|
43
|
+
componentTheme: NewComponentTypes['ProgressCircle'],
|
|
44
|
+
props: ProgressCircleProps,
|
|
45
|
+
_sharedTokens: SharedTokens,
|
|
46
|
+
state: ProgressCircleState
|
|
47
|
+
): ProgressCircleStyle => {
|
|
48
|
+
const { size, color, meterColor, valueNow = 0, valueMax = 100 } = props
|
|
49
|
+
const { shouldAnimateOnMount } = state
|
|
50
|
+
|
|
51
|
+
const getMeterColorClassName =
|
|
52
|
+
typeof meterColor === 'function'
|
|
53
|
+
? meterColor({ valueNow, valueMax })
|
|
54
|
+
: meterColor
|
|
55
|
+
|
|
56
|
+
const getCircumference = () => {
|
|
57
|
+
const camelSize = size === 'x-small' ? 'xSmall' : size!
|
|
58
|
+
// get the circumference of the meter circle
|
|
59
|
+
return parseFloat(componentTheme[`${camelSize}Circumference` as const])
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const getRadii = (): { radius: string; borderOffsetRadius: string } => {
|
|
63
|
+
const camelSize = size === 'x-small' ? 'xSmall' : size!
|
|
64
|
+
return {
|
|
65
|
+
radius: componentTheme[`${camelSize}Radius` as const],
|
|
66
|
+
borderOffsetRadius: componentTheme[`${camelSize}BorderOffset` as const]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const getDashOffset = () => {
|
|
71
|
+
// send the stroke-dashoffset to the meter circle, checking
|
|
72
|
+
// to make sure current value doesn't exceed max value
|
|
73
|
+
if (valueNow! < valueMax!) {
|
|
74
|
+
const circumference = getCircumference()
|
|
75
|
+
// figure out how much offset to give the stroke to show the % complete
|
|
76
|
+
return circumference - (valueNow! / valueMax!) * circumference
|
|
77
|
+
} else {
|
|
78
|
+
return 0
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
Using !important on the meter shouldAnimateOnMount versions
|
|
84
|
+
to guarantee that the bars will start showing 0 if the
|
|
85
|
+
animateOnMount prop is set
|
|
86
|
+
*/
|
|
87
|
+
const sizeVariants = {
|
|
88
|
+
'x-small': {
|
|
89
|
+
progressCircle: {
|
|
90
|
+
width: componentTheme.xSmallSize,
|
|
91
|
+
height: componentTheme.xSmallSize
|
|
92
|
+
},
|
|
93
|
+
circle: {
|
|
94
|
+
width: componentTheme.xSmallSize,
|
|
95
|
+
height: componentTheme.xSmallSize
|
|
96
|
+
},
|
|
97
|
+
value: {
|
|
98
|
+
padding: '0.5rem'
|
|
99
|
+
},
|
|
100
|
+
border: {
|
|
101
|
+
transformOrigin: `${componentTheme.xSmallTransform} ${componentTheme.xSmallTransform}`
|
|
102
|
+
},
|
|
103
|
+
track: {
|
|
104
|
+
transformOrigin: `${componentTheme.xSmallTransform} ${componentTheme.xSmallTransform}`,
|
|
105
|
+
strokeWidth: componentTheme.xSmallStrokeWidth
|
|
106
|
+
},
|
|
107
|
+
meter: {
|
|
108
|
+
strokeWidth: componentTheme.xSmallStrokeWidth,
|
|
109
|
+
strokeDasharray: componentTheme.xSmallCircumference,
|
|
110
|
+
...(shouldAnimateOnMount && {
|
|
111
|
+
strokeDashoffset: `${componentTheme.xSmallCircumference} !important`
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
small: {
|
|
116
|
+
progressCircle: {
|
|
117
|
+
width: componentTheme.smallSize,
|
|
118
|
+
height: componentTheme.smallSize
|
|
119
|
+
},
|
|
120
|
+
circle: {
|
|
121
|
+
width: componentTheme.smallSize,
|
|
122
|
+
height: componentTheme.smallSize
|
|
123
|
+
},
|
|
124
|
+
value: {},
|
|
125
|
+
border: {
|
|
126
|
+
transformOrigin: `${componentTheme.smallTransform} ${componentTheme.smallTransform}`
|
|
127
|
+
},
|
|
128
|
+
track: {
|
|
129
|
+
transformOrigin: `${componentTheme.smallTransform} ${componentTheme.smallTransform}`,
|
|
130
|
+
strokeWidth: componentTheme.smallStrokeWidth
|
|
131
|
+
},
|
|
132
|
+
meter: {
|
|
133
|
+
strokeWidth: componentTheme.smallStrokeWidth,
|
|
134
|
+
strokeDasharray: componentTheme.smallCircumference,
|
|
135
|
+
...(shouldAnimateOnMount && {
|
|
136
|
+
strokeDashoffset: `${componentTheme.smallCircumference} !important`
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
medium: {
|
|
141
|
+
progressCircle: {
|
|
142
|
+
width: componentTheme.mediumSize,
|
|
143
|
+
height: componentTheme.mediumSize
|
|
144
|
+
},
|
|
145
|
+
circle: {
|
|
146
|
+
width: componentTheme.mediumSize,
|
|
147
|
+
height: componentTheme.mediumSize
|
|
148
|
+
},
|
|
149
|
+
value: {},
|
|
150
|
+
border: {
|
|
151
|
+
transformOrigin: `${componentTheme.mediumTransform} ${componentTheme.mediumTransform}`
|
|
152
|
+
},
|
|
153
|
+
track: {
|
|
154
|
+
transformOrigin: `${componentTheme.mediumTransform} ${componentTheme.mediumTransform}`,
|
|
155
|
+
strokeWidth: componentTheme.mediumStrokeWidth
|
|
156
|
+
},
|
|
157
|
+
meter: {
|
|
158
|
+
strokeWidth: componentTheme.mediumStrokeWidth,
|
|
159
|
+
strokeDasharray: componentTheme.mediumCircumference,
|
|
160
|
+
...(shouldAnimateOnMount && {
|
|
161
|
+
strokeDashoffset: `${componentTheme.mediumCircumference} !important`
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
large: {
|
|
166
|
+
progressCircle: {
|
|
167
|
+
width: componentTheme.largeSize,
|
|
168
|
+
height: componentTheme.largeSize
|
|
169
|
+
},
|
|
170
|
+
circle: {
|
|
171
|
+
width: componentTheme.largeSize,
|
|
172
|
+
height: componentTheme.largeSize
|
|
173
|
+
},
|
|
174
|
+
value: {},
|
|
175
|
+
border: {
|
|
176
|
+
transformOrigin: `${componentTheme.largeTransform} ${componentTheme.largeTransform}`
|
|
177
|
+
},
|
|
178
|
+
track: {
|
|
179
|
+
transformOrigin: `${componentTheme.largeTransform} ${componentTheme.largeTransform}`,
|
|
180
|
+
strokeWidth: componentTheme.largeStrokeWidth
|
|
181
|
+
},
|
|
182
|
+
meter: {
|
|
183
|
+
strokeWidth: componentTheme.largeStrokeWidth,
|
|
184
|
+
strokeDasharray: componentTheme.largeCircumference,
|
|
185
|
+
...(shouldAnimateOnMount && {
|
|
186
|
+
strokeDashoffset: `${componentTheme.largeCircumference} !important`
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const colorVariants = {
|
|
193
|
+
primary: {
|
|
194
|
+
track: { stroke: componentTheme.trackColor },
|
|
195
|
+
value: { color: componentTheme.color },
|
|
196
|
+
border: { stroke: componentTheme.trackBorderColor }
|
|
197
|
+
},
|
|
198
|
+
'primary-inverse': {
|
|
199
|
+
track: { stroke: componentTheme.trackColorInverse },
|
|
200
|
+
value: { color: componentTheme.colorInverse },
|
|
201
|
+
border: { stroke: componentTheme.trackBorderColorInverse }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const meterColorVariants = {
|
|
206
|
+
primary: {
|
|
207
|
+
brand: { stroke: componentTheme.meterColorBrand },
|
|
208
|
+
info: { stroke: componentTheme.meterColorInfo },
|
|
209
|
+
warning: { stroke: componentTheme.meterColorWarning },
|
|
210
|
+
danger: { stroke: componentTheme.meterColorDanger },
|
|
211
|
+
alert: { stroke: componentTheme.meterColorAlert },
|
|
212
|
+
success: { stroke: componentTheme.meterColorSuccess }
|
|
213
|
+
},
|
|
214
|
+
'primary-inverse': {
|
|
215
|
+
brand: { stroke: componentTheme.meterColorBrandInverse },
|
|
216
|
+
info: { stroke: componentTheme.meterColorInfoInverse },
|
|
217
|
+
warning: { stroke: componentTheme.meterColorWarningInverse },
|
|
218
|
+
danger: { stroke: componentTheme.meterColorDangerInverse },
|
|
219
|
+
alert: { stroke: componentTheme.meterColorAlertInverse },
|
|
220
|
+
success: { stroke: componentTheme.meterColorSuccessInverse }
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
progressCircle: {
|
|
226
|
+
label: 'progressCircle',
|
|
227
|
+
display: 'inline-block',
|
|
228
|
+
verticalAlign: 'middle',
|
|
229
|
+
position: 'relative',
|
|
230
|
+
overflow: 'hidden',
|
|
231
|
+
|
|
232
|
+
/*
|
|
233
|
+
Seems like a good idea to reset font-size because
|
|
234
|
+
the SVG uses ems and might inherit a container's
|
|
235
|
+
font-size
|
|
236
|
+
*/
|
|
237
|
+
fontSize: '1rem',
|
|
238
|
+
fontFamily: componentTheme.fontFamily,
|
|
239
|
+
fontWeight: componentTheme.fontWeight,
|
|
240
|
+
lineHeight: componentTheme.lineHeight,
|
|
241
|
+
|
|
242
|
+
...sizeVariants[size!].progressCircle
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
center: {
|
|
246
|
+
label: 'progressCircle__center',
|
|
247
|
+
transition: 'all 0.5s',
|
|
248
|
+
transitionDelay: '1s',
|
|
249
|
+
display: 'block',
|
|
250
|
+
position: 'absolute',
|
|
251
|
+
transform: 'translate3d(0, 0, 0)',
|
|
252
|
+
top: 0,
|
|
253
|
+
left: 0,
|
|
254
|
+
height: '100%',
|
|
255
|
+
width: '100%',
|
|
256
|
+
borderRadius: '50%',
|
|
257
|
+
|
|
258
|
+
...(shouldAnimateOnMount && {
|
|
259
|
+
opacity: 0,
|
|
260
|
+
transform: 'translate3d(0, 10%, 0)'
|
|
261
|
+
})
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
value: {
|
|
265
|
+
label: 'progressCircle__value',
|
|
266
|
+
boxSizing: 'border-box',
|
|
267
|
+
wordWrap: 'break-word',
|
|
268
|
+
textAlign: 'center',
|
|
269
|
+
borderRadius: '50%',
|
|
270
|
+
display: 'flex',
|
|
271
|
+
alignItems: 'center',
|
|
272
|
+
justifyContent: 'center',
|
|
273
|
+
padding: '1.5rem',
|
|
274
|
+
width: '100%',
|
|
275
|
+
height: '100%',
|
|
276
|
+
lineHeight: 1,
|
|
277
|
+
|
|
278
|
+
...sizeVariants[size!].value,
|
|
279
|
+
...colorVariants[color!].value
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
circle: {
|
|
283
|
+
label: 'progressCircle__circle',
|
|
284
|
+
transform: 'rotate(-90deg)',
|
|
285
|
+
display: 'block',
|
|
286
|
+
position: 'absolute',
|
|
287
|
+
top: 0,
|
|
288
|
+
left: 0,
|
|
289
|
+
|
|
290
|
+
...sizeVariants[size!].circle
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
track: {
|
|
294
|
+
label: 'progressCircle__track',
|
|
295
|
+
fill: 'none',
|
|
296
|
+
opacity: 1,
|
|
297
|
+
transition: 'all 0.5s',
|
|
298
|
+
transitionDelay: '0.2s',
|
|
299
|
+
transform: 'translate3d(0, 0, 0)',
|
|
300
|
+
|
|
301
|
+
...sizeVariants[size!].track,
|
|
302
|
+
...colorVariants[color!].track,
|
|
303
|
+
...(shouldAnimateOnMount && {
|
|
304
|
+
opacity: 0,
|
|
305
|
+
transform: 'translate3d(0, 0, 0)'
|
|
306
|
+
})
|
|
307
|
+
},
|
|
308
|
+
|
|
309
|
+
border: {
|
|
310
|
+
label: 'progressCircle__border',
|
|
311
|
+
fill: 'none',
|
|
312
|
+
opacity: 1,
|
|
313
|
+
transition: 'all 0.5s',
|
|
314
|
+
transform: 'translate3d(0, 0, 0) scale(1)',
|
|
315
|
+
|
|
316
|
+
...sizeVariants[size!].border,
|
|
317
|
+
...colorVariants[color!].border,
|
|
318
|
+
...(shouldAnimateOnMount && {
|
|
319
|
+
opacity: 0,
|
|
320
|
+
transform: 'translate3d(0, 0, 0) scale(0.75)'
|
|
321
|
+
})
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
meter: {
|
|
325
|
+
label: 'progressCircle__meter',
|
|
326
|
+
fill: 'none',
|
|
327
|
+
transition: 'stroke-dashoffset 1s',
|
|
328
|
+
transform: 'translate3d(0, 0, 0)',
|
|
329
|
+
|
|
330
|
+
...sizeVariants[size!].meter,
|
|
331
|
+
...(getMeterColorClassName &&
|
|
332
|
+
meterColorVariants[color!][getMeterColorClassName]),
|
|
333
|
+
...(shouldAnimateOnMount && {
|
|
334
|
+
opacity: 0
|
|
335
|
+
})
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
radii: getRadii(),
|
|
339
|
+
dashOffset: getDashOffset()
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export default generateStyle
|
package/src/exports/a.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export { ProgressBar } from '../ProgressBar/v1'
|
|
26
|
+
export { ProgressCircle } from '../ProgressCircle/v1'
|
|
27
|
+
|
|
28
|
+
export type { ProgressBarProps } from '../ProgressBar/v1/props'
|
|
29
|
+
export type { ProgressCircleProps } from '../ProgressCircle/v1/props'
|
package/src/exports/b.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export { ProgressBar } from '../ProgressBar/v2'
|
|
26
|
+
export { ProgressCircle } from '../ProgressCircle/v2'
|
|
27
|
+
|
|
28
|
+
export type { ProgressBarProps } from '../ProgressBar/v2/props'
|
|
29
|
+
export type { ProgressCircleProps } from '../ProgressCircle/v2/props'
|