@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.
Files changed (37) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es/ProgressBar/v1/index.js +90 -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 +90 -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 +128 -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 +128 -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/tsconfig.build.json +0 -1
  20. package/tsconfig.build.tsbuildinfo +1 -1
  21. package/lib/ProgressBar/v1/index.js +0 -137
  22. package/lib/ProgressBar/v1/props.js +0 -31
  23. package/lib/ProgressBar/v1/styles.js +0 -216
  24. package/lib/ProgressBar/v1/theme.js +0 -100
  25. package/lib/ProgressBar/v2/index.js +0 -136
  26. package/lib/ProgressBar/v2/props.js +0 -31
  27. package/lib/ProgressBar/v2/styles.js +0 -242
  28. package/lib/ProgressCircle/v1/index.js +0 -182
  29. package/lib/ProgressCircle/v1/props.js +0 -31
  30. package/lib/ProgressCircle/v1/styles.js +0 -357
  31. package/lib/ProgressCircle/v1/theme.js +0 -146
  32. package/lib/ProgressCircle/v2/index.js +0 -181
  33. package/lib/ProgressCircle/v2/props.js +0 -31
  34. package/lib/ProgressCircle/v2/styles.js +0 -357
  35. package/lib/exports/a.js +0 -19
  36. package/lib/exports/b.js +0 -19
  37. 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,98 @@
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 { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
26
3
  import { Component } from 'react';
27
4
  import { View } from '@instructure/ui-view/latest';
28
5
  import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils';
29
6
  import { withStyleNew } from '@instructure/emotion';
30
7
  import generateStyle from './styles.js';
31
8
  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);
9
+ class ProgressBar extends Component {
10
+ static{
11
+ this.displayName = 'ProgressBar';
12
+ }
13
+ static{
14
+ this.componentId = 'ProgressBar';
15
+ }
16
+ static{
17
+ this.allowedProps = allowedProps;
18
+ }
19
+ static{
20
+ this.defaultProps = {
21
+ formatScreenReaderValue: ({ valueNow, valueMax })=>`${valueNow} / ${valueMax}`,
22
+ size: 'medium',
23
+ valueMax: 100,
24
+ valueNow: 0,
25
+ as: 'div',
26
+ color: 'primary',
27
+ shouldAnimate: false,
28
+ meterColor: ({ valueNow, valueMax })=>valueNow / valueMax >= 1 ? 'success' : 'brand'
29
+ };
30
+ }
31
+ componentDidMount() {
32
+ this.props.makeStyles?.();
33
+ }
34
+ componentDidUpdate() {
35
+ this.props.makeStyles?.();
36
+ }
37
+ render() {
38
+ const { renderValue, formatScreenReaderValue, valueNow, valueMax, screenReaderLabel, size, color, meterColor, renderValueInside, styles, ...props } = this.props;
39
+ const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
40
+ valueNow: valueNow,
41
+ valueMax: valueMax
42
+ }) : undefined;
43
+ const value = callRenderProp(renderValue, {
44
+ valueNow: valueNow,
45
+ valueMax: valueMax
46
+ });
47
+ return /*#__PURE__*/ _jsxs(View, {
48
+ ...passthroughProps(props),
49
+ as: this.props.as,
50
+ css: styles?.progressBar,
51
+ margin: this.props.margin,
52
+ elementRef: this.handleRef,
53
+ "data-cid": "ProgressBar",
54
+ children: [
55
+ /*#__PURE__*/ _jsxs("span", {
56
+ css: styles?.trackLayout,
57
+ children: [
58
+ /*#__PURE__*/ _jsx("progress", {
59
+ css: styles?.htmlProgress,
60
+ max: valueMax,
61
+ value: valueNow,
62
+ "aria-valuetext": valueText,
63
+ "aria-label": screenReaderLabel
64
+ }),
65
+ /*#__PURE__*/ _jsx("span", {
66
+ css: styles?.track,
67
+ role: "presentation",
68
+ "aria-hidden": "true",
69
+ children: /*#__PURE__*/ _jsx("span", {
70
+ css: styles?.trackValue,
71
+ children: renderValueInside && value
72
+ })
73
+ })
74
+ ]
75
+ }),
76
+ value && !renderValueInside && /*#__PURE__*/ _jsx("span", {
77
+ css: styles?.value,
78
+ "aria-hidden": "true",
79
+ children: value
80
+ })
81
+ ]
82
+ });
83
+ }
84
+ constructor(...args){
85
+ super(...args), this.ref = null, this.handleRef = (el)=>{
86
+ const { elementRef } = this.props;
87
+ this.ref = el;
88
+ if (typeof elementRef === 'function') {
89
+ elementRef(el);
90
+ }
91
+ };
74
92
  }
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);
93
+ }
94
+ ProgressBar = _ts_decorate([
95
+ withStyleNew(generateStyle)
96
+ ], ProgressBar);
130
97
  export default ProgressBar;
131
- export { ProgressBar };
98
+ 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 };