@instructure/ui-progress 8.13.0 → 8.13.1-snapshot.10

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.
Files changed (40) hide show
  1. package/LICENSE.md +27 -0
  2. package/es/ProgressBar/__examples__/ProgressBar.examples.js +3 -5
  3. package/es/ProgressBar/index.js +5 -5
  4. package/es/ProgressBar/props.js +0 -47
  5. package/es/ProgressBar/styles.js +4 -2
  6. package/es/ProgressCircle/__examples__/ProgressCircle.examples.js +3 -5
  7. package/es/ProgressCircle/index.js +6 -5
  8. package/es/ProgressCircle/props.js +1 -48
  9. package/es/ProgressCircle/styles.js +4 -2
  10. package/lib/ProgressBar/__examples__/ProgressBar.examples.js +3 -5
  11. package/lib/ProgressBar/index.js +5 -5
  12. package/lib/ProgressBar/props.js +0 -47
  13. package/lib/ProgressBar/styles.js +4 -2
  14. package/lib/ProgressCircle/__examples__/ProgressCircle.examples.js +3 -5
  15. package/lib/ProgressCircle/index.js +6 -5
  16. package/lib/ProgressCircle/props.js +1 -48
  17. package/lib/ProgressCircle/styles.js +4 -2
  18. package/package.json +15 -14
  19. package/src/ProgressBar/__examples__/ProgressBar.examples.tsx +6 -11
  20. package/src/ProgressBar/index.tsx +7 -8
  21. package/src/ProgressBar/props.ts +43 -41
  22. package/src/ProgressBar/styles.ts +1 -1
  23. package/src/ProgressCircle/__examples__/ProgressCircle.examples.tsx +6 -11
  24. package/src/ProgressCircle/index.tsx +13 -22
  25. package/src/ProgressCircle/props.ts +46 -48
  26. package/src/ProgressCircle/styles.ts +2 -2
  27. package/src/ProgressCircle/theme.ts +2 -5
  28. package/types/ProgressBar/__examples__/ProgressBar.examples.d.ts +4 -7
  29. package/types/ProgressBar/__examples__/ProgressBar.examples.d.ts.map +1 -1
  30. package/types/ProgressBar/index.d.ts +10 -15
  31. package/types/ProgressBar/index.d.ts.map +1 -1
  32. package/types/ProgressBar/props.d.ts +46 -5
  33. package/types/ProgressBar/props.d.ts.map +1 -1
  34. package/types/ProgressCircle/__examples__/ProgressCircle.examples.d.ts +4 -7
  35. package/types/ProgressCircle/__examples__/ProgressCircle.examples.d.ts.map +1 -1
  36. package/types/ProgressCircle/index.d.ts +12 -17
  37. package/types/ProgressCircle/index.d.ts.map +1 -1
  38. package/types/ProgressCircle/props.d.ts +52 -6
  39. package/types/ProgressCircle/props.d.ts.map +1 -1
  40. package/types/ProgressCircle/theme.d.ts.map +1 -1
@@ -32,13 +32,14 @@ import { withStyle, jsx } from '@instructure/emotion'
32
32
 
33
33
  import generateStyle from './styles'
34
34
  import generateComponentTheme from './theme'
35
- import type { ProgressBarProps } from './props'
35
+ import type { ProgressBarProps, Values } from './props'
36
36
  import { allowedProps, propTypes } from './props'
37
37
 
38
38
  /**
39
39
  ---
40
40
  category: components
41
41
  ---
42
+ @tsProps
42
43
  **/
43
44
  @withStyle(generateStyle, generateComponentTheme)
44
45
  @testable()
@@ -49,8 +50,7 @@ class ProgressBar extends Component<ProgressBarProps> {
49
50
  static propTypes = propTypes
50
51
 
51
52
  static defaultProps = {
52
- // @ts-expect-error ts-migrate(7031) FIXME: Binding element 'valueNow' implicitly has an 'any'... Remove this comment to see the full error message
53
- formatScreenReaderValue: ({ valueNow, valueMax }) =>
53
+ formatScreenReaderValue: ({ valueNow, valueMax }: Values) =>
54
54
  `${valueNow} / ${valueMax}`,
55
55
  size: 'medium',
56
56
  valueMax: 100,
@@ -59,8 +59,7 @@ class ProgressBar extends Component<ProgressBarProps> {
59
59
  color: 'primary',
60
60
 
61
61
  // default to showing `success` color on completion
62
- // @ts-expect-error ts-migrate(7031) FIXME: Binding element 'valueNow' implicitly has an 'any'... Remove this comment to see the full error message
63
- meterColor: ({ valueNow, valueMax }) =>
62
+ meterColor: ({ valueNow, valueMax }: Values) =>
64
63
  valueNow / valueMax >= 1 ? 'success' : 'brand'
65
64
  }
66
65
 
@@ -99,8 +98,9 @@ class ProgressBar extends Component<ProgressBarProps> {
99
98
  } = this.props
100
99
 
101
100
  const valueText =
102
- typeof formatScreenReaderValue === 'function' &&
103
- formatScreenReaderValue({ valueNow, valueMax })
101
+ typeof formatScreenReaderValue === 'function'
102
+ ? formatScreenReaderValue({ valueNow: valueNow!, valueMax: valueMax! })
103
+ : undefined
104
104
  // consolidating the label and aria-valuetext to put in aria-label because
105
105
  // NVDA does not read aria-valuetext: https://github.com/nvaccess/nvda/issues/913
106
106
  // But leaving aria-valuetext because JAWS ignores aria-label
@@ -140,7 +140,6 @@ class ProgressBar extends Component<ProgressBarProps> {
140
140
  )}
141
141
  </View>
142
142
  )
143
- /* eslint-enable jsx-a11y/no-redundant-roles, jsx-a11y/no-noninteractive-element-to-interactive-role */
144
143
  }
145
144
  }
146
145
 
@@ -45,85 +45,87 @@ export type ProgressBarMeterColor =
45
45
  | 'success'
46
46
  | 'brand'
47
47
 
48
- type ProgressBarOwnProps = {
49
- screenReaderLabel: string
50
- size?: 'x-small' | 'small' | 'medium' | 'large'
51
- valueMax?: number
52
- valueNow?: number
53
- formatScreenReaderValue?: (...args: any[]) => any
54
- renderValue?: ((...args: any[]) => any) | React.ReactNode
55
- color?: 'primary' | 'primary-inverse'
56
- meterColor?:
57
- | ((...args: any[]) => ProgressBarMeterColor)
58
- | ProgressBarMeterColor
59
- margin?: Spacing
60
- elementRef?: (element: Element | null) => void
61
- as?: AsElementType
62
- }
48
+ export type Values = { valueNow: number; valueMax: number }
63
49
 
64
- type PropKeys = keyof ProgressBarOwnProps
65
-
66
- type AllowedPropKeys = Readonly<Array<PropKeys>>
67
-
68
- type ProgressBarProps = ProgressBarOwnProps &
69
- WithStyleProps<ProgressBarTheme, ProgressBarStyle> &
70
- OtherHTMLAttributes<ProgressBarOwnProps>
71
-
72
- type ProgressBarStyle = ComponentStyle<
73
- 'progressBar' | 'trackLayout' | 'trackBorder' | 'track' | 'value'
74
- >
75
-
76
- const propTypes: PropValidators<PropKeys> = {
50
+ type ProgressBarOwnProps = {
77
51
  /**
78
52
  * A label is required for accessibility
79
53
  */
80
- screenReaderLabel: PropTypes.string.isRequired,
54
+ screenReaderLabel: string
81
55
  /**
82
56
  * Control the height of the progress bar
83
57
  */
84
- size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
58
+ size?: 'x-small' | 'small' | 'medium' | 'large'
85
59
  /**
86
60
  * Maximum value (defaults to 100)
87
61
  */
88
- valueMax: PropTypes.number,
62
+ valueMax?: Values['valueMax']
89
63
  /**
90
64
  * Receives the progress of the event
91
65
  */
92
- valueNow: PropTypes.number,
66
+ valueNow?: Values['valueNow']
93
67
  /**
94
68
  * A function for formatting the text provided to screen readers via `aria-valuenow`
95
69
  */
96
- formatScreenReaderValue: PropTypes.func,
70
+ formatScreenReaderValue?: (values: Values) => string
97
71
  /**
98
72
  * A function to format the displayed value. If null the value will not display.
99
73
  * Takes `valueNow` and `valueMax` as parameters.
100
74
  */
101
- renderValue: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
75
+ renderValue?: ((values: Values) => React.ReactNode) | React.ReactNode
102
76
  /**
103
77
  * Controls the overall color scheme of the component
104
78
  */
105
- color: PropTypes.oneOf(['primary', 'primary-inverse']),
79
+ color?: 'primary' | 'primary-inverse'
106
80
  /**
107
81
  * Control the color of the progress meter. Defaults to showing theme success
108
82
  * color on completion, based on `valueNow` and `valueMax`.
109
83
  */
110
- meterColor: PropTypes.oneOfType([
111
- PropTypes.func,
112
- PropTypes.oneOf(['info', 'warning', 'danger', 'alert', 'success', 'brand'])
113
- ]),
84
+ meterColor?:
85
+ | ((values: Values) => ProgressBarMeterColor)
86
+ | ProgressBarMeterColor
114
87
  /**
115
88
  * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
116
89
  * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
117
90
  * familiar CSS-like shorthand. For example: `margin="small auto large"`.
118
91
  */
119
- margin: ThemeablePropTypes.spacing,
92
+ margin?: Spacing
120
93
  /**
121
94
  * Provides a reference to the component's root HTML element
122
95
  */
123
- elementRef: PropTypes.func,
96
+ elementRef?: (element: Element | null) => void
124
97
  /**
125
98
  * Set the element type of the component's root
126
99
  */
100
+ as?: AsElementType
101
+ }
102
+
103
+ type PropKeys = keyof ProgressBarOwnProps
104
+
105
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
106
+
107
+ type ProgressBarProps = ProgressBarOwnProps &
108
+ WithStyleProps<ProgressBarTheme, ProgressBarStyle> &
109
+ OtherHTMLAttributes<ProgressBarOwnProps>
110
+
111
+ type ProgressBarStyle = ComponentStyle<
112
+ 'progressBar' | 'trackLayout' | 'trackBorder' | 'track' | 'value'
113
+ >
114
+
115
+ const propTypes: PropValidators<PropKeys> = {
116
+ screenReaderLabel: PropTypes.string.isRequired,
117
+ size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
118
+ valueMax: PropTypes.number,
119
+ valueNow: PropTypes.number,
120
+ formatScreenReaderValue: PropTypes.func,
121
+ renderValue: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
122
+ color: PropTypes.oneOf(['primary', 'primary-inverse']),
123
+ meterColor: PropTypes.oneOfType([
124
+ PropTypes.func,
125
+ PropTypes.oneOf(['info', 'warning', 'danger', 'alert', 'success', 'brand'])
126
+ ]),
127
+ margin: ThemeablePropTypes.spacing,
128
+ elementRef: PropTypes.func,
127
129
  as: PropTypes.elementType
128
130
  }
129
131
 
@@ -39,7 +39,7 @@ const generateStyle = (
39
39
  componentTheme: ProgressBarTheme,
40
40
  props: ProgressBarProps
41
41
  ): ProgressBarStyle => {
42
- const { valueNow, valueMax, size, color, meterColor } = props
42
+ const { valueNow = 0, valueMax = 100, size, color, meterColor } = props
43
43
 
44
44
  const meterColorClassName =
45
45
  typeof meterColor === 'function'
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  import React from 'react'
25
+ import type { ProgressCircleProps, Values } from '../props'
25
26
 
26
27
  const valueMax = 100
27
28
 
@@ -31,28 +32,22 @@ export default {
31
32
  valueNow: [0, 40, 80, 100],
32
33
  renderValue: [
33
34
  null,
34
- // @ts-expect-error ts-migrate(7031) FIXME: Binding element 'valueNow' implicitly has an 'any'... Remove this comment to see the full error message
35
- // eslint-disable-next-line react/display-name
36
- ({ valueNow, valueMax }) => (
35
+ ({ valueNow, valueMax }: Values) => (
37
36
  <span>{Math.round((valueNow / valueMax) * 100)}</span>
38
37
  )
39
38
  ]
40
39
  },
41
- // @ts-expect-error ts-migrate(6133) FIXME: 'props' is declared but its value is never read.
42
- getComponentProps: (props) => {
40
+ getComponentProps: () => {
43
41
  return {
44
42
  screenReaderLabel: 'Passing students',
45
43
  valueMax
46
44
  }
47
45
  },
48
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
49
- getExampleProps: (props) => {
46
+ getExampleProps: (props: ProgressCircleProps) => {
50
47
  return {
51
- background: props.color.includes('inverse')
48
+ background: props.color!.includes('inverse')
52
49
  ? 'primary-inverse'
53
50
  : 'primary'
54
51
  }
55
- },
56
- // @ts-expect-error ts-migrate(6133) FIXME: 'props' is declared but its value is never read.
57
- filter: (props) => {}
52
+ }
58
53
  }
@@ -34,13 +34,14 @@ import { withStyle, jsx } from '@instructure/emotion'
34
34
 
35
35
  import generateStyle from './styles'
36
36
  import generateComponentTheme from './theme'
37
- import type { ProgressCircleProps, ProgressCircleState } from './props'
37
+ import type { ProgressCircleProps, ProgressCircleState, Values } from './props'
38
38
  import { allowedProps, propTypes } from './props'
39
39
 
40
40
  /**
41
41
  ---
42
42
  category: components
43
43
  ---
44
+ @tsProps
44
45
  **/
45
46
  @withStyle(generateStyle, generateComponentTheme)
46
47
  @testable()
@@ -54,8 +55,7 @@ class ProgressCircle extends Component<
54
55
  static propTypes = propTypes
55
56
 
56
57
  static defaultProps = {
57
- // @ts-expect-error ts-migrate(7031) FIXME: Binding element 'valueNow' implicitly has an 'any'... Remove this comment to see the full error message
58
- formatScreenReaderValue: ({ valueNow, valueMax }) =>
58
+ formatScreenReaderValue: ({ valueNow, valueMax }: Values) =>
59
59
  `${valueNow} / ${valueMax}`,
60
60
  size: 'medium',
61
61
  valueMax: 100,
@@ -65,20 +65,18 @@ class ProgressCircle extends Component<
65
65
  shouldAnimateOnMount: false,
66
66
 
67
67
  // default to showing `success` color on completion
68
- // @ts-expect-error ts-migrate(7031) FIXME: Binding element 'valueNow' implicitly has an 'any'... Remove this comment to see the full error message
69
- meterColor: ({ valueNow, valueMax }) =>
68
+ meterColor: ({ valueNow, valueMax }: Values) =>
70
69
  valueNow / valueMax >= 1 ? 'success' : 'brand'
71
70
  }
72
71
 
73
- _timeouts = []
72
+ _timeouts: Array<ReturnType<typeof setTimeout>> = []
74
73
  ref: Element | null = null
75
74
 
76
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
77
- constructor(props) {
75
+ constructor(props: ProgressCircleProps) {
78
76
  super(props)
79
77
 
80
78
  this.state = {
81
- shouldAnimateOnMount: props.shouldAnimateOnMount
79
+ shouldAnimateOnMount: props.shouldAnimateOnMount!
82
80
  }
83
81
  }
84
82
 
@@ -99,7 +97,6 @@ class ProgressCircle extends Component<
99
97
  componentDidMount() {
100
98
  if (this.state.shouldAnimateOnMount) {
101
99
  this._timeouts.push(
102
- // @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Timeout' is not assignable to pa... Remove this comment to see the full error message
103
100
  setTimeout(() => {
104
101
  this.setState({
105
102
  shouldAnimateOnMount: false
@@ -134,8 +131,9 @@ class ProgressCircle extends Component<
134
131
  } = this.props
135
132
 
136
133
  const valueText =
137
- typeof formatScreenReaderValue === 'function' &&
138
- formatScreenReaderValue({ valueNow, valueMax })
134
+ typeof formatScreenReaderValue === 'function'
135
+ ? formatScreenReaderValue({ valueNow: valueNow!, valueMax: valueMax! })
136
+ : undefined
139
137
  // consolidating the label and aria-valuetext to put in aria-label because
140
138
  // NVDA does not read aria-valuetext: https://github.com/nvaccess/nvda/issues/913
141
139
  // But leaving aria-valuetext because JAWS ignores aria-label
@@ -143,12 +141,9 @@ class ProgressCircle extends Component<
143
141
 
144
142
  const value = callRenderProp(renderValue, { valueNow, valueMax })
145
143
 
146
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'animateOnMount' does not exist on type '... Remove this comment to see the full error message
147
- const style = this.state.animateOnMount
148
- ? null
149
- : {
150
- strokeDashoffset: `${styles?.dashOffset}em`
151
- }
144
+ const style = {
145
+ strokeDashoffset: `${styles?.dashOffset}em`
146
+ }
152
147
 
153
148
  return (
154
149
  <View
@@ -179,7 +174,6 @@ class ProgressCircle extends Component<
179
174
  role="presentation"
180
175
  cx="50%"
181
176
  cy="50%"
182
- //@ts-expect-error TODO:
183
177
  r={styles?.radii?.radius}
184
178
  />
185
179
  <circle
@@ -187,17 +181,14 @@ class ProgressCircle extends Component<
187
181
  role="presentation"
188
182
  cx="50%"
189
183
  cy="50%"
190
- //@ts-expect-error TODO:
191
184
  r={styles?.radii?.borderOffsetRadius}
192
185
  />
193
186
  <circle
194
187
  css={styles?.meter}
195
188
  role="presentation"
196
- // @ts-expect-error ts-migrate(2322) FIXME: Type '{ strokeDashoffset: string; } | null' is not... Remove this comment to see the full error message
197
189
  style={style}
198
190
  cx="50%"
199
191
  cy="50%"
200
- //@ts-expect-error TODO:
201
192
  r={styles?.radii?.radius}
202
193
  />
203
194
  </svg>
@@ -44,19 +44,58 @@ export type ProgressCircleMeterColor =
44
44
  | 'success'
45
45
  | 'brand'
46
46
 
47
+ export type Values = { valueNow: number; valueMax: number }
48
+
47
49
  type ProgressCircleOwnProps = {
50
+ /**
51
+ * A label is required for accessibility
52
+ */
48
53
  screenReaderLabel: string
54
+ /**
55
+ * Control the size of the progress circle
56
+ */
49
57
  size?: 'x-small' | 'small' | 'medium' | 'large'
50
- valueMax?: number
51
- valueNow?: number
52
- formatScreenReaderValue?: ((...args: any[]) => any) | React.ReactNode
53
- renderValue?: ((...args: any[]) => any) | React.ReactNode
58
+ /**
59
+ * Maximum value (defaults to 100)
60
+ */
61
+ valueMax?: Values['valueMax']
62
+ /**
63
+ * Receives the progress of the event
64
+ */
65
+ valueNow?: Values['valueNow']
66
+ /**
67
+ * A function for formatting the text provided to screen readers via `aria-valuenow`
68
+ */
69
+ formatScreenReaderValue?: (values: Values) => string
70
+ /**
71
+ * A function to format the displayed value. If null the value will not display.
72
+ * Takes `valueNow` and `valueMax` as parameters.
73
+ */
74
+ renderValue?: ((values: Values) => React.ReactNode) | React.ReactNode
75
+ /**
76
+ * Controls the overall color scheme of the component
77
+ */
54
78
  color?: 'primary' | 'primary-inverse'
79
+ /**
80
+ * Control the color of the progress meter. Defaults to showing theme success
81
+ * color on completion, based on `valueNow` and `valueMax`.
82
+ */
55
83
  meterColor?:
56
- | ((...args: any[]) => ProgressCircleMeterColor)
84
+ | ((values: Values) => ProgressCircleMeterColor)
57
85
  | ProgressCircleMeterColor
86
+ /**
87
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
88
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
89
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
90
+ */
58
91
  margin?: Spacing
92
+ /**
93
+ * Provides a reference to the component's root HTML element
94
+ */
59
95
  elementRef?: (element: Element | null) => void
96
+ /**
97
+ * Set the element type of the component's root
98
+ */
60
99
  as?: AsElementType
61
100
  shouldAnimateOnMount?: boolean
62
101
  animationDelay?: number
@@ -82,64 +121,23 @@ type ProgressCircleStyle = ComponentStyle<
82
121
  | 'track'
83
122
  | 'border'
84
123
  | 'meter'
85
- | 'radii'
86
124
  | 'dashOffset'
87
- >
125
+ > & { radii: { radius: string; borderOffsetRadius: string } }
88
126
 
89
127
  const propTypes: PropValidators<PropKeys> = {
90
- /**
91
- * A label is required for accessibility
92
- */
93
128
  screenReaderLabel: PropTypes.string.isRequired,
94
- /**
95
- * Control the size of the progress circle
96
- */
97
129
  size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
98
- /**
99
- * Maximum value (defaults to 100)
100
- */
101
130
  valueMax: PropTypes.number,
102
- /**
103
- * Receives the progress of the event
104
- */
105
131
  valueNow: PropTypes.number,
106
- /**
107
- * A function for formatting the text provided to screen readers via `aria-valuenow`
108
- */
109
- formatScreenReaderValue: PropTypes.oneOfType([
110
- PropTypes.func,
111
- PropTypes.node
112
- ]),
113
- /**
114
- * A function to format the displayed value. If null the value will not display.
115
- * Takes `valueNow` and `valueMax` as parameters.
116
- */
132
+ formatScreenReaderValue: PropTypes.func,
117
133
  renderValue: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
118
- /**
119
- * Controls the overall color scheme of the component
120
- */
121
134
  color: PropTypes.oneOf(['primary', 'primary-inverse']),
122
- /**
123
- * Control the color of the progress meter. Defaults to showing theme success
124
- * color on completion, based on `valueNow` and `valueMax`.
125
- */
126
135
  meterColor: PropTypes.oneOfType([
127
136
  PropTypes.func,
128
137
  PropTypes.oneOf(['info', 'warning', 'danger', 'alert', 'success', 'brand'])
129
138
  ]),
130
- /**
131
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
132
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
133
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
134
- */
135
139
  margin: ThemeablePropTypes.spacing,
136
- /**
137
- * Provides a reference to the component's root HTML element
138
- */
139
140
  elementRef: PropTypes.func,
140
- /**
141
- * Set the element type of the component's root
142
- */
143
141
  as: PropTypes.elementType,
144
142
  shouldAnimateOnMount: PropTypes.bool,
145
143
  animationDelay: PropTypes.number
@@ -44,7 +44,7 @@ const generateStyle = (
44
44
  props: ProgressCircleProps,
45
45
  state: ProgressCircleState
46
46
  ): ProgressCircleStyle => {
47
- const { size, color, meterColor, valueNow, valueMax } = props
47
+ const { size, color, meterColor, valueNow = 0, valueMax = 100 } = props
48
48
  const { shouldAnimateOnMount } = state
49
49
 
50
50
  const getMeterColorClassName =
@@ -58,7 +58,7 @@ const generateStyle = (
58
58
  return parseFloat(componentTheme[`${camelSize}Circumference` as const])
59
59
  }
60
60
 
61
- const getRadii = () => {
61
+ const getRadii = (): { radius: string; borderOffsetRadius: string } => {
62
62
  const camelSize = size === 'x-small' ? 'xSmall' : size!
63
63
  return {
64
64
  radius: componentTheme[`${camelSize}Radius` as const],
@@ -57,13 +57,10 @@ const borderOffsetRadius = {
57
57
  large: radius.large - strokeWidth.large / 2 + borderWidth
58
58
  }
59
59
 
60
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'r' implicitly has an 'any' type.
61
- const circumference = function (r) {
60
+ const circumference = function (r: number) {
62
61
  return (2 * Math.PI * r).toFixed(3)
63
62
  }
64
-
65
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 's' implicitly has an 'any' type.
66
- const transform = function (s) {
63
+ const transform = function (s: number) {
67
64
  return s / 2
68
65
  }
69
66
 
@@ -1,21 +1,18 @@
1
1
  /// <reference types="react" />
2
+ import type { ProgressBarProps, Values } from '../props';
2
3
  declare const _default: {
3
4
  sectionProp: string;
4
5
  propValues: {
5
6
  valueNow: number[];
6
- renderValue: ((({ valueNow, valueMax }: {
7
- valueNow: any;
8
- valueMax: any;
9
- }) => JSX.Element) | null)[];
7
+ renderValue: ((({ valueNow, valueMax }: Values) => JSX.Element) | null)[];
10
8
  };
11
- getComponentProps: (props: any) => {
9
+ getComponentProps: () => {
12
10
  screenReaderLabel: string;
13
11
  valueMax: number;
14
12
  };
15
- getExampleProps: (props: any) => {
13
+ getExampleProps: (props: ProgressBarProps) => {
16
14
  background: string;
17
15
  };
18
- filter: (props: any) => void;
19
16
  };
20
17
  export default _default;
21
18
  //# sourceMappingURL=ProgressBar.examples.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.examples.d.ts","sourceRoot":"","sources":["../../../src/ProgressBar/__examples__/ProgressBar.examples.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,wBA8BC"}
1
+ {"version":3,"file":"ProgressBar.examples.d.ts","sourceRoot":"","sources":["../../../src/ProgressBar/__examples__/ProgressBar.examples.tsx"],"names":[],"mappings":";AAwBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;;;;;gDAUzB,MAAM;;;;;;6BAWV,gBAAgB;;;;AAjB3C,wBAwBC"}
@@ -1,11 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
3
  import { jsx } from '@instructure/emotion';
4
- import type { ProgressBarProps } from './props';
4
+ import type { ProgressBarProps, Values } from './props';
5
5
  /**
6
6
  ---
7
7
  category: components
8
8
  ---
9
+ @tsProps
9
10
  **/
10
11
  declare class ProgressBar extends Component<ProgressBarProps> {
11
12
  static readonly componentId = "ProgressBar";
@@ -14,10 +15,10 @@ declare class ProgressBar extends Component<ProgressBarProps> {
14
15
  size?: "x-small" | "small" | "medium" | "large" | undefined;
15
16
  valueMax?: number | undefined;
16
17
  valueNow?: number | undefined;
17
- formatScreenReaderValue?: ((...args: any[]) => any) | undefined;
18
- renderValue?: import("react").ReactNode | ((...args: any[]) => any);
18
+ formatScreenReaderValue?: ((values: Values) => string) | undefined;
19
+ renderValue?: import("react").ReactNode | ((values: Values) => import("react").ReactNode);
19
20
  color?: "primary" | "primary-inverse" | undefined;
20
- meterColor?: import("./props").ProgressBarMeterColor | ((...args: any[]) => import("./props").ProgressBarMeterColor) | undefined;
21
+ meterColor?: import("./props").ProgressBarMeterColor | ((values: Values) => import("./props").ProgressBarMeterColor) | undefined;
21
22
  margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
22
23
  elementRef?: ((element: Element | null) => void) | undefined;
23
24
  as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
@@ -27,28 +28,22 @@ declare class ProgressBar extends Component<ProgressBarProps> {
27
28
  size?: "x-small" | "small" | "medium" | "large" | undefined;
28
29
  valueMax?: number | undefined;
29
30
  valueNow?: number | undefined;
30
- formatScreenReaderValue?: ((...args: any[]) => any) | undefined;
31
- renderValue?: import("react").ReactNode | ((...args: any[]) => any);
31
+ formatScreenReaderValue?: ((values: Values) => string) | undefined;
32
+ renderValue?: import("react").ReactNode | ((values: Values) => import("react").ReactNode);
32
33
  color?: "primary" | "primary-inverse" | undefined;
33
- meterColor?: import("./props").ProgressBarMeterColor | ((...args: any[]) => import("./props").ProgressBarMeterColor) | undefined;
34
+ meterColor?: import("./props").ProgressBarMeterColor | ((values: Values) => import("./props").ProgressBarMeterColor) | undefined;
34
35
  margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
35
36
  elementRef?: ((element: Element | null) => void) | undefined;
36
37
  as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
37
38
  }>;
38
39
  static defaultProps: {
39
- formatScreenReaderValue: ({ valueNow, valueMax }: {
40
- valueNow: any;
41
- valueMax: any;
42
- }) => string;
40
+ formatScreenReaderValue: ({ valueNow, valueMax }: Values) => string;
43
41
  size: string;
44
42
  valueMax: number;
45
43
  valueNow: number;
46
44
  as: string;
47
45
  color: string;
48
- meterColor: ({ valueNow, valueMax }: {
49
- valueNow: any;
50
- valueMax: any;
51
- }) => "success" | "brand";
46
+ meterColor: ({ valueNow, valueMax }: Values) => "success" | "brand";
52
47
  };
53
48
  ref: Element | null;
54
49
  componentDidMount(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProgressBar/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C;;;;GAIG;AACH,cAEM,WAAY,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IACnD,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAgB;IAE3C,MAAM,CAAC,YAAY;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;MAclB;IAED,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,iBAAiB;IAIjB,kBAAkB;IAIlB,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IAED,MAAM;CA0DP;AAED,eAAe,WAAW,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProgressBar/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGvD;;;;;GAKG;AACH,cAEM,WAAY,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IACnD,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAgB;IAE3C,MAAM,CAAC,YAAY;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;0DACiC,MAAM;;;;;;6CASnB,MAAM;MAE5C;IAED,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,iBAAiB;IAIjB,kBAAkB;IAIlB,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IAED,MAAM;CA0DP;AAED,eAAe,WAAW,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,CAAA"}