@instructure/ui-progress 11.7.10 → 11.7.11-pr-snapshot-1794841957152

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 (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es/ProgressBar/v1/index.js +87 -123
  3. package/es/ProgressBar/v1/props.js +15 -26
  4. package/es/ProgressBar/v1/styles.js +167 -209
  5. package/es/ProgressBar/v1/theme.js +55 -93
  6. package/es/ProgressBar/v2/index.js +87 -123
  7. package/es/ProgressBar/v2/props.js +15 -26
  8. package/es/ProgressBar/v2/styles.js +188 -235
  9. package/es/ProgressCircle/v1/index.js +125 -165
  10. package/es/ProgressCircle/v1/props.js +16 -26
  11. package/es/ProgressCircle/v1/styles.js +291 -348
  12. package/es/ProgressCircle/v1/theme.js +88 -128
  13. package/es/ProgressCircle/v2/index.js +125 -165
  14. package/es/ProgressCircle/v2/props.js +16 -26
  15. package/es/ProgressCircle/v2/styles.js +291 -348
  16. package/es/exports/a.js +1 -25
  17. package/es/exports/b.js +1 -25
  18. package/package.json +13 -19
  19. package/src/ProgressBar/v1/index.tsx +7 -2
  20. package/src/ProgressBar/v2/index.tsx +4 -2
  21. package/src/ProgressCircle/v1/index.tsx +7 -2
  22. package/src/ProgressCircle/v2/index.tsx +4 -2
  23. package/tsconfig.build.json +0 -1
  24. package/tsconfig.build.tsbuildinfo +1 -1
  25. package/types/ProgressBar/v1/index.d.ts +3 -1
  26. package/types/ProgressBar/v1/index.d.ts.map +1 -1
  27. package/types/ProgressBar/v2/index.d.ts +3 -1
  28. package/types/ProgressBar/v2/index.d.ts.map +1 -1
  29. package/types/ProgressCircle/v1/index.d.ts +3 -1
  30. package/types/ProgressCircle/v1/index.d.ts.map +1 -1
  31. package/types/ProgressCircle/v2/index.d.ts +3 -1
  32. package/types/ProgressCircle/v2/index.d.ts.map +1 -1
  33. package/lib/ProgressBar/v1/index.js +0 -136
  34. package/lib/ProgressBar/v1/props.js +0 -31
  35. package/lib/ProgressBar/v1/styles.js +0 -216
  36. package/lib/ProgressBar/v1/theme.js +0 -100
  37. package/lib/ProgressBar/v2/index.js +0 -135
  38. package/lib/ProgressBar/v2/props.js +0 -31
  39. package/lib/ProgressBar/v2/styles.js +0 -242
  40. package/lib/ProgressCircle/v1/index.js +0 -181
  41. package/lib/ProgressCircle/v1/props.js +0 -31
  42. package/lib/ProgressCircle/v1/styles.js +0 -357
  43. package/lib/ProgressCircle/v1/theme.js +0 -146
  44. package/lib/ProgressCircle/v2/index.js +0 -180
  45. package/lib/ProgressCircle/v2/props.js +0 -31
  46. package/lib/ProgressCircle/v2/styles.js +0 -357
  47. package/lib/exports/a.js +0 -19
  48. package/lib/exports/b.js +0 -19
  49. package/lib/package.json +0 -1
@@ -1,94 +1,56 @@
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
- /**
26
- * Generates the theme object for the component from the theme and provided additional information
27
- * @param {Object} theme The actual theme object.
28
- * @return {Object} The final theme object with the overrides and component variables
29
- */
30
- const generateComponentTheme = theme => {
31
- const {
32
- borders,
33
- colors,
34
- spacing,
35
- typography,
36
- key: themeName
37
- } = theme;
38
- const themeSpecificStyle = {
39
- canvas: {
40
- meterColorBrand: theme['ic-brand-primary']
41
- },
42
- 'canvas-high-contrast': {
43
- meterColorBrandInverse: colors?.contrasts?.white1010,
44
- meterColorSuccessInverse: colors?.contrasts?.white1010,
45
- meterColorInfoInverse: colors?.contrasts?.white1010,
46
- meterColorAlertInverse: colors?.contrasts?.white1010,
47
- meterColorWarningInverse: colors?.contrasts?.white1010,
48
- meterColorDangerInverse: colors?.contrasts?.white1010
49
- }
50
- };
51
- const componentVariables = {
52
- fontFamily: typography?.fontFamily,
53
- fontWeight: typography?.fontWeightNormal,
54
- lineHeight: typography?.lineHeightCondensed,
55
- fontSize: typography?.fontSizeMedium,
56
- xSmallHeight: spacing?.xSmall,
57
- xSmallValueFontSize: typography?.fontSizeXSmall,
58
- smallHeight: '1.125rem',
59
- // product design wants = 18px
60
- smallValueFontSize: typography?.fontSizeXSmall,
61
- mediumHeight: spacing?.medium,
62
- mediumValueFontSize: typography?.fontSizeSmall,
63
- largeHeight: spacing?.large,
64
- largeValueFontSize: typography?.fontSizeMedium,
65
- valuePadding: `${spacing?.xxSmall}`,
66
- // variables are split out for inverse to allow
67
- // color value changes for inverse-high-constrast
68
- meterColorBrand: colors?.contrasts?.blue4570,
69
- meterColorBrandInverse: colors?.contrasts?.blue4570,
70
- meterColorInfo: colors?.contrasts?.blue4570,
71
- meterColorInfoInverse: colors?.contrasts?.blue4570,
72
- meterColorSuccess: colors?.contrasts?.green4570,
73
- meterColorSuccessInverse: colors?.contrasts?.green4570,
74
- meterColorDanger: colors?.contrasts?.red4570,
75
- meterColorDangerInverse: colors?.contrasts?.red4570,
76
- meterColorAlert: colors?.contrasts?.blue4570,
77
- meterColorAlertInverse: colors?.contrasts?.blue4570,
78
- meterColorWarning: colors?.contrasts?.orange4570,
79
- meterColorWarningInverse: colors?.contrasts?.orange4570,
80
- meterBorderWidthInverse: borders?.widthSmall,
81
- meterBorderColorInverse: 'transparent',
82
- trackColor: colors?.contrasts?.white1010,
83
- trackColorInverse: 'transparent',
84
- trackBottomBorderWidth: borders?.widthSmall,
85
- trackBottomBorderColor: colors?.contrasts?.grey3045,
86
- trackBottomBorderColorInverse: colors?.contrasts?.white1010,
87
- borderRadius: '0px'
88
- };
89
- return {
90
- ...componentVariables,
91
- ...themeSpecificStyle[themeName]
92
- };
1
+ const generateComponentTheme = (theme)=>{
2
+ const { borders, colors, spacing, typography, key: themeName } = theme;
3
+ const themeSpecificStyle = {
4
+ canvas: {
5
+ meterColorBrand: theme['ic-brand-primary']
6
+ },
7
+ 'canvas-high-contrast': {
8
+ meterColorBrandInverse: colors?.contrasts?.white1010,
9
+ meterColorSuccessInverse: colors?.contrasts?.white1010,
10
+ meterColorInfoInverse: colors?.contrasts?.white1010,
11
+ meterColorAlertInverse: colors?.contrasts?.white1010,
12
+ meterColorWarningInverse: colors?.contrasts?.white1010,
13
+ meterColorDangerInverse: colors?.contrasts?.white1010
14
+ }
15
+ };
16
+ const componentVariables = {
17
+ fontFamily: typography?.fontFamily,
18
+ fontWeight: typography?.fontWeightNormal,
19
+ lineHeight: typography?.lineHeightCondensed,
20
+ fontSize: typography?.fontSizeMedium,
21
+ xSmallHeight: spacing?.xSmall,
22
+ xSmallValueFontSize: typography?.fontSizeXSmall,
23
+ smallHeight: '1.125rem',
24
+ smallValueFontSize: typography?.fontSizeXSmall,
25
+ mediumHeight: spacing?.medium,
26
+ mediumValueFontSize: typography?.fontSizeSmall,
27
+ largeHeight: spacing?.large,
28
+ largeValueFontSize: typography?.fontSizeMedium,
29
+ valuePadding: `${spacing?.xxSmall}`,
30
+ meterColorBrand: colors?.contrasts?.blue4570,
31
+ meterColorBrandInverse: colors?.contrasts?.blue4570,
32
+ meterColorInfo: colors?.contrasts?.blue4570,
33
+ meterColorInfoInverse: colors?.contrasts?.blue4570,
34
+ meterColorSuccess: colors?.contrasts?.green4570,
35
+ meterColorSuccessInverse: colors?.contrasts?.green4570,
36
+ meterColorDanger: colors?.contrasts?.red4570,
37
+ meterColorDangerInverse: colors?.contrasts?.red4570,
38
+ meterColorAlert: colors?.contrasts?.blue4570,
39
+ meterColorAlertInverse: colors?.contrasts?.blue4570,
40
+ meterColorWarning: colors?.contrasts?.orange4570,
41
+ meterColorWarningInverse: colors?.contrasts?.orange4570,
42
+ meterBorderWidthInverse: borders?.widthSmall,
43
+ meterBorderColorInverse: 'transparent',
44
+ trackColor: colors?.contrasts?.white1010,
45
+ trackColorInverse: 'transparent',
46
+ trackBottomBorderWidth: borders?.widthSmall,
47
+ trackBottomBorderColor: colors?.contrasts?.grey3045,
48
+ trackBottomBorderColorInverse: colors?.contrasts?.white1010,
49
+ borderRadius: '0px'
50
+ };
51
+ return {
52
+ ...componentVariables,
53
+ ...themeSpecificStyle[themeName]
54
+ };
93
55
  };
94
- export default generateComponentTheme;
56
+ export default generateComponentTheme;
@@ -1,131 +1,95 @@
1
- var _dec, _class;
2
- /*
3
- * The MIT License (MIT)
4
- *
5
- * Copyright (c) 2015 - present Instructure, Inc.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- */
25
-
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
26
2
  import { Component } from 'react';
27
3
  import { View } from '@instructure/ui-view/latest';
28
4
  import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils';
29
5
  import { withStyleNew } from '@instructure/emotion';
30
6
  import generateStyle from './styles.js';
31
7
  import { allowedProps } from './props.js';
32
-
33
- /**
34
- ---
35
- category: components
36
- ---
37
- **/
38
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
39
- let ProgressBar = (_dec = withStyleNew(generateStyle), _dec(_class = class ProgressBar extends Component {
40
- static displayName = 'ProgressBar';
41
- static componentId = 'ProgressBar';
42
- static allowedProps = allowedProps;
43
- static defaultProps = {
44
- formatScreenReaderValue: ({
45
- valueNow,
46
- valueMax
47
- }) => `${valueNow} / ${valueMax}`,
48
- size: 'medium',
49
- valueMax: 100,
50
- valueNow: 0,
51
- as: 'div',
52
- color: 'primary',
53
- shouldAnimate: false,
54
- // default to showing `success` color on completion
55
- meterColor: ({
56
- valueNow,
57
- valueMax
58
- }) => valueNow / valueMax >= 1 ? 'success' : 'brand'
59
- };
60
- ref = null;
61
- componentDidMount() {
62
- this.props.makeStyles?.();
63
- }
64
- componentDidUpdate() {
65
- this.props.makeStyles?.();
66
- }
67
- handleRef = el => {
68
- const {
69
- elementRef
70
- } = this.props;
71
- this.ref = el;
72
- if (typeof elementRef === 'function') {
73
- elementRef(el);
8
+ export class ProgressBarBase extends Component {
9
+ static{
10
+ this.displayName = 'ProgressBar';
11
+ }
12
+ static{
13
+ this.componentId = 'ProgressBar';
14
+ }
15
+ static{
16
+ this.allowedProps = allowedProps;
17
+ }
18
+ static{
19
+ this.defaultProps = {
20
+ formatScreenReaderValue: ({ valueNow, valueMax })=>`${valueNow} / ${valueMax}`,
21
+ size: 'medium',
22
+ valueMax: 100,
23
+ valueNow: 0,
24
+ as: 'div',
25
+ color: 'primary',
26
+ shouldAnimate: false,
27
+ meterColor: ({ valueNow, valueMax })=>valueNow / valueMax >= 1 ? 'success' : 'brand'
28
+ };
29
+ }
30
+ componentDidMount() {
31
+ this.props.makeStyles?.();
32
+ }
33
+ componentDidUpdate() {
34
+ this.props.makeStyles?.();
35
+ }
36
+ render() {
37
+ const { renderValue, formatScreenReaderValue, valueNow, valueMax, screenReaderLabel, size, color, meterColor, renderValueInside, styles, ...props } = this.props;
38
+ const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
39
+ valueNow: valueNow,
40
+ valueMax: valueMax
41
+ }) : undefined;
42
+ const value = callRenderProp(renderValue, {
43
+ valueNow: valueNow,
44
+ valueMax: valueMax
45
+ });
46
+ return /*#__PURE__*/ _jsxs(View, {
47
+ ...passthroughProps(props),
48
+ as: this.props.as,
49
+ css: styles?.progressBar,
50
+ margin: this.props.margin,
51
+ elementRef: this.handleRef,
52
+ "data-cid": "ProgressBar",
53
+ children: [
54
+ /*#__PURE__*/ _jsxs("span", {
55
+ css: styles?.trackLayout,
56
+ children: [
57
+ /*#__PURE__*/ _jsx("progress", {
58
+ css: styles?.htmlProgress,
59
+ max: valueMax,
60
+ value: valueNow,
61
+ "aria-valuetext": valueText,
62
+ "aria-label": screenReaderLabel
63
+ }),
64
+ /*#__PURE__*/ _jsx("span", {
65
+ css: styles?.track,
66
+ role: "presentation",
67
+ "aria-hidden": "true",
68
+ children: /*#__PURE__*/ _jsx("span", {
69
+ css: styles?.trackValue,
70
+ children: renderValueInside && value
71
+ })
72
+ })
73
+ ]
74
+ }),
75
+ value && !renderValueInside && /*#__PURE__*/ _jsx("span", {
76
+ css: styles?.value,
77
+ "aria-hidden": "true",
78
+ children: value
79
+ })
80
+ ]
81
+ });
82
+ }
83
+ constructor(...args){
84
+ super(...args), this.ref = null, this.handleRef = (el)=>{
85
+ const { elementRef } = this.props;
86
+ this.ref = el;
87
+ if (typeof elementRef === 'function') {
88
+ elementRef(el);
89
+ }
90
+ };
74
91
  }
75
- };
76
- render() {
77
- const {
78
- renderValue,
79
- formatScreenReaderValue,
80
- valueNow,
81
- valueMax,
82
- screenReaderLabel,
83
- size,
84
- color,
85
- meterColor,
86
- renderValueInside,
87
- styles,
88
- ...props
89
- } = this.props;
90
- const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
91
- valueNow: valueNow,
92
- valueMax: valueMax
93
- }) : undefined;
94
- const value = callRenderProp(renderValue, {
95
- valueNow: valueNow,
96
- valueMax: valueMax
97
- });
98
- return _jsxs(View, {
99
- ...passthroughProps(props),
100
- as: this.props.as,
101
- css: styles?.progressBar,
102
- margin: this.props.margin,
103
- elementRef: this.handleRef,
104
- "data-cid": "ProgressBar",
105
- children: [_jsxs("span", {
106
- css: styles?.trackLayout,
107
- children: [_jsx("progress", {
108
- css: styles?.htmlProgress,
109
- max: valueMax,
110
- value: valueNow,
111
- "aria-valuetext": valueText,
112
- "aria-label": screenReaderLabel
113
- }), _jsx("span", {
114
- css: styles?.track,
115
- role: "presentation",
116
- "aria-hidden": "true",
117
- children: _jsx("span", {
118
- css: styles?.trackValue,
119
- children: renderValueInside && value
120
- })
121
- })]
122
- }), value && !renderValueInside && _jsx("span", {
123
- css: styles?.value,
124
- "aria-hidden": "true",
125
- children: value
126
- })]
127
- });
128
- }
129
- }) || _class);
92
+ }
93
+ const ProgressBar = withStyleNew(generateStyle)(ProgressBarBase);
130
94
  export default ProgressBar;
131
- export { ProgressBar };
95
+ export { ProgressBar };
@@ -1,26 +1,15 @@
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
- const allowedProps = ['screenReaderLabel', 'size', 'valueMax', 'valueNow', 'formatScreenReaderValue', 'renderValue', 'color', 'meterColor', 'shouldAnimate', 'margin', 'elementRef', 'as'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'screenReaderLabel',
3
+ 'size',
4
+ 'valueMax',
5
+ 'valueNow',
6
+ 'formatScreenReaderValue',
7
+ 'renderValue',
8
+ 'color',
9
+ 'meterColor',
10
+ 'shouldAnimate',
11
+ 'margin',
12
+ 'elementRef',
13
+ 'as'
14
+ ];
15
+ export { allowedProps };