@instructure/ui-checkbox 11.7.10 → 11.7.11-pr-snapshot-1793741604126

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 (80) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es/Checkbox/v1/CheckboxFacade/index.js +71 -91
  3. package/es/Checkbox/v1/CheckboxFacade/props.js +9 -26
  4. package/es/Checkbox/v1/CheckboxFacade/styles.js +100 -141
  5. package/es/Checkbox/v1/CheckboxFacade/theme.js +47 -82
  6. package/es/Checkbox/v1/ToggleFacade/index.js +75 -100
  7. package/es/Checkbox/v1/ToggleFacade/props.js +10 -26
  8. package/es/Checkbox/v1/ToggleFacade/styles.js +151 -192
  9. package/es/Checkbox/v1/ToggleFacade/theme.js +46 -83
  10. package/es/Checkbox/v1/index.js +202 -256
  11. package/es/Checkbox/v1/props.js +24 -26
  12. package/es/Checkbox/v1/styles.js +52 -90
  13. package/es/Checkbox/v1/theme.js +11 -44
  14. package/es/Checkbox/v2/CheckboxFacade/index.js +76 -99
  15. package/es/Checkbox/v2/CheckboxFacade/props.js +12 -26
  16. package/es/Checkbox/v2/CheckboxFacade/styles.js +125 -173
  17. package/es/Checkbox/v2/ToggleFacade/index.js +88 -112
  18. package/es/Checkbox/v2/ToggleFacade/props.js +12 -26
  19. package/es/Checkbox/v2/ToggleFacade/styles.js +179 -227
  20. package/es/Checkbox/v2/index.js +225 -293
  21. package/es/Checkbox/v2/props.js +25 -26
  22. package/es/Checkbox/v2/styles.js +64 -109
  23. package/es/CheckboxGroup/v1/index.js +93 -118
  24. package/es/CheckboxGroup/v1/props.js +14 -26
  25. package/es/CheckboxGroup/v2/index.js +85 -111
  26. package/es/CheckboxGroup/v2/props.js +15 -26
  27. package/es/exports/a.js +1 -24
  28. package/es/exports/b.js +1 -24
  29. package/package.json +18 -24
  30. package/src/Checkbox/v1/CheckboxFacade/index.tsx +7 -2
  31. package/src/Checkbox/v1/ToggleFacade/index.tsx +7 -2
  32. package/src/Checkbox/v1/index.tsx +7 -4
  33. package/src/Checkbox/v2/CheckboxFacade/index.tsx +7 -2
  34. package/src/Checkbox/v2/ToggleFacade/index.tsx +4 -2
  35. package/src/Checkbox/v2/index.tsx +6 -3
  36. package/src/CheckboxGroup/v1/index.tsx +7 -2
  37. package/tsconfig.build.json +0 -1
  38. package/tsconfig.build.tsbuildinfo +1 -1
  39. package/types/Checkbox/v1/CheckboxFacade/index.d.ts +3 -1
  40. package/types/Checkbox/v1/CheckboxFacade/index.d.ts.map +1 -1
  41. package/types/Checkbox/v1/ToggleFacade/index.d.ts +3 -1
  42. package/types/Checkbox/v1/ToggleFacade/index.d.ts.map +1 -1
  43. package/types/Checkbox/v1/index.d.ts +3 -1
  44. package/types/Checkbox/v1/index.d.ts.map +1 -1
  45. package/types/Checkbox/v2/CheckboxFacade/index.d.ts +3 -1
  46. package/types/Checkbox/v2/CheckboxFacade/index.d.ts.map +1 -1
  47. package/types/Checkbox/v2/ToggleFacade/index.d.ts +3 -1
  48. package/types/Checkbox/v2/ToggleFacade/index.d.ts.map +1 -1
  49. package/types/Checkbox/v2/index.d.ts +3 -1
  50. package/types/Checkbox/v2/index.d.ts.map +1 -1
  51. package/types/CheckboxGroup/v1/index.d.ts +3 -1
  52. package/types/CheckboxGroup/v1/index.d.ts.map +1 -1
  53. package/lib/Checkbox/v1/CheckboxFacade/index.js +0 -105
  54. package/lib/Checkbox/v1/CheckboxFacade/props.js +0 -31
  55. package/lib/Checkbox/v1/CheckboxFacade/styles.js +0 -148
  56. package/lib/Checkbox/v1/CheckboxFacade/theme.js +0 -89
  57. package/lib/Checkbox/v1/ToggleFacade/index.js +0 -113
  58. package/lib/Checkbox/v1/ToggleFacade/props.js +0 -31
  59. package/lib/Checkbox/v1/ToggleFacade/styles.js +0 -200
  60. package/lib/Checkbox/v1/ToggleFacade/theme.js +0 -90
  61. package/lib/Checkbox/v1/index.js +0 -298
  62. package/lib/Checkbox/v1/props.js +0 -31
  63. package/lib/Checkbox/v1/styles.js +0 -97
  64. package/lib/Checkbox/v1/theme.js +0 -51
  65. package/lib/Checkbox/v2/CheckboxFacade/index.js +0 -111
  66. package/lib/Checkbox/v2/CheckboxFacade/props.js +0 -31
  67. package/lib/Checkbox/v2/CheckboxFacade/styles.js +0 -184
  68. package/lib/Checkbox/v2/ToggleFacade/index.js +0 -124
  69. package/lib/Checkbox/v2/ToggleFacade/props.js +0 -31
  70. package/lib/Checkbox/v2/ToggleFacade/styles.js +0 -239
  71. package/lib/Checkbox/v2/index.js +0 -334
  72. package/lib/Checkbox/v2/props.js +0 -31
  73. package/lib/Checkbox/v2/styles.js +0 -116
  74. package/lib/CheckboxGroup/v1/index.js +0 -134
  75. package/lib/CheckboxGroup/v1/props.js +0 -31
  76. package/lib/CheckboxGroup/v2/index.js +0 -131
  77. package/lib/CheckboxGroup/v2/props.js +0 -31
  78. package/lib/exports/a.js +0 -31
  79. package/lib/exports/b.js +0 -31
  80. package/lib/package.json +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [11.7.11-pr-snapshot-1793741604126](https://github.com/instructure/instructure-ui/compare/v11.7.10...v11.7.11-pr-snapshot-1793741604126) (2026-11-03)
7
+
8
+ ### Build System
9
+
10
+ * **many:** replace babel with swc ([6f90a9e](https://github.com/instructure/instructure-ui/commit/6f90a9e594feaf0eff2602696d22cfafdeb549bc))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * **many:** `@instructure/ui-babel-preset` and
15
+ `@instructure/browserslist-config-instui` are removed and will no longer be
16
+ published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
17
+
18
+
6
19
  ## [11.7.10](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.10) (2026-10-14)
7
20
 
8
21
  ### Bug Fixes
@@ -1,28 +1,4 @@
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 { SVGIcon } from '@instructure/ui-svg-images';
28
4
  import { IconCheckMarkSolid } from '@instructure/ui-icons';
@@ -30,71 +6,75 @@ import { withStyle } from '@instructure/emotion';
30
6
  import generateStyle from './styles.js';
31
7
  import generateComponentTheme from './theme.js';
32
8
  import { allowedProps } from './props.js';
33
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
34
- /**
35
- ---
36
- parent: Checkbox
37
- ---
38
- **/
39
- let CheckboxFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class CheckboxFacade extends Component {
40
- static displayName = 'CheckboxFacade';
41
- static componentId = 'CheckboxFacade';
42
- static allowedProps = allowedProps;
43
- static defaultProps = {
44
- checked: false,
45
- focused: false,
46
- hovered: false,
47
- size: 'medium',
48
- indeterminate: false
49
- };
50
- ref = null;
51
- handleRef = el => {
52
- this.ref = el;
53
- };
54
- componentDidMount() {
55
- this.props.makeStyles?.();
56
- }
57
- componentDidUpdate() {
58
- this.props.makeStyles?.();
59
- }
60
- renderIcon() {
61
- if (this.props.indeterminate) {
62
- return _jsx(SVGIcon, {
63
- viewBox: "0 0 1920 1920",
64
- inline: false,
65
- children: _jsx("rect", {
66
- x: "140",
67
- y: "820",
68
- width: "1640",
69
- height: "280"
70
- })
71
- });
72
- } else if (this.props.checked) {
73
- return _jsx(IconCheckMarkSolid, {
74
- inline: false
75
- });
76
- } else {
77
- return null;
9
+ export class CheckboxFacadeBase extends Component {
10
+ static{
11
+ this.displayName = 'CheckboxFacade';
12
+ }
13
+ static{
14
+ this.componentId = 'CheckboxFacade';
15
+ }
16
+ static{
17
+ this.allowedProps = allowedProps;
18
+ }
19
+ static{
20
+ this.defaultProps = {
21
+ checked: false,
22
+ focused: false,
23
+ hovered: false,
24
+ size: 'medium',
25
+ indeterminate: false
26
+ };
27
+ }
28
+ componentDidMount() {
29
+ this.props.makeStyles?.();
30
+ }
31
+ componentDidUpdate() {
32
+ this.props.makeStyles?.();
33
+ }
34
+ renderIcon() {
35
+ if (this.props.indeterminate) {
36
+ return /*#__PURE__*/ _jsx(SVGIcon, {
37
+ viewBox: "0 0 1920 1920",
38
+ inline: false,
39
+ children: /*#__PURE__*/ _jsx("rect", {
40
+ x: "140",
41
+ y: "820",
42
+ width: "1640",
43
+ height: "280"
44
+ })
45
+ });
46
+ } else if (this.props.checked) {
47
+ return /*#__PURE__*/ _jsx(IconCheckMarkSolid, {
48
+ inline: false
49
+ });
50
+ } else {
51
+ return null;
52
+ }
53
+ }
54
+ render() {
55
+ const { children, styles } = this.props;
56
+ return /*#__PURE__*/ _jsxs("span", {
57
+ css: styles?.checkboxFacade,
58
+ ref: this.handleRef,
59
+ children: [
60
+ /*#__PURE__*/ _jsx("span", {
61
+ css: styles?.facade,
62
+ "aria-hidden": "true",
63
+ children: this.renderIcon()
64
+ }),
65
+ /*#__PURE__*/ _jsx("span", {
66
+ css: styles?.label,
67
+ children: children
68
+ })
69
+ ]
70
+ });
71
+ }
72
+ constructor(...args){
73
+ super(...args), this.ref = null, this.handleRef = (el)=>{
74
+ this.ref = el;
75
+ };
78
76
  }
79
- }
80
- render() {
81
- const {
82
- children,
83
- styles
84
- } = this.props;
85
- return _jsxs("span", {
86
- css: styles?.checkboxFacade,
87
- ref: this.handleRef,
88
- children: [_jsx("span", {
89
- css: styles?.facade,
90
- "aria-hidden": "true",
91
- children: this.renderIcon()
92
- }), _jsx("span", {
93
- css: styles?.label,
94
- children: children
95
- })]
96
- });
97
- }
98
- }) || _class);
77
+ }
78
+ const CheckboxFacade = withStyle(generateStyle, generateComponentTheme)(CheckboxFacadeBase);
99
79
  export default CheckboxFacade;
100
- export { CheckboxFacade };
80
+ export { CheckboxFacade };
@@ -1,26 +1,9 @@
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 = ['children', 'checked', 'focused', 'hovered', 'size', 'indeterminate'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'children',
3
+ 'checked',
4
+ 'focused',
5
+ 'hovered',
6
+ 'size',
7
+ 'indeterminate'
8
+ ];
9
+ export { allowedProps };
@@ -1,142 +1,101 @@
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
- * ---
27
- * private: true
28
- * ---
29
- * Generates the style object from the theme and provided additional information
30
- * @param {Object} componentTheme The theme variable object.
31
- * @param {Object} props the props of the component, the style is applied to
32
- * @param {Object} state the state of the component, the style is applied to
33
- * @return {Object} The final style object, which will be used in the component
34
- */
35
- const generateStyle = (componentTheme, props) => {
36
- const {
37
- size,
38
- checked,
39
- focused,
40
- hovered,
41
- indeterminate,
42
- invalid
43
- } = props;
44
- const isChecked = checked || indeterminate;
45
- const sizeVariants = {
46
- small: {
47
- label: {
48
- fontSize: componentTheme.labelFontSizeSmall
49
- },
50
- facade: {
51
- fontSize: componentTheme.iconSizeSmall,
52
- width: componentTheme.facadeSizeSmall,
53
- height: componentTheme.facadeSizeSmall
54
- }
55
- },
56
- medium: {
57
- label: {
58
- fontSize: componentTheme.labelFontSizeMedium
59
- },
60
- facade: {
61
- fontSize: componentTheme.iconSizeMedium,
62
- width: componentTheme.facadeSizeMedium,
63
- height: componentTheme.facadeSizeMedium
64
- }
65
- },
66
- large: {
67
- label: {
68
- fontSize: componentTheme.labelFontSizeLarge
69
- },
70
- facade: {
71
- fontSize: componentTheme.iconSizeLarge,
72
- width: componentTheme.facadeSizeLarge,
73
- height: componentTheme.facadeSizeLarge
74
- }
75
- }
76
- };
77
- return {
78
- checkboxFacade: {
79
- label: 'checkboxFacade',
80
- display: 'flex',
81
- alignItems: 'flex-start'
82
- },
83
- facade: {
84
- label: 'checkboxFacade__facade',
85
- color: componentTheme.color,
86
- background: componentTheme.background,
87
- position: 'relative',
88
- display: 'flex',
89
- alignItems: 'center',
90
- justifyContent: 'center',
91
- boxSizing: 'border-box',
92
- flexShrink: 0,
93
- transition: 'all 0.2s',
94
- border: `${componentTheme.borderWidth} solid ${invalid ? componentTheme.errorBorderColor : componentTheme.borderColor}`,
95
- borderRadius: componentTheme.borderRadius,
96
- marginInlineEnd: componentTheme.marginRight,
97
- marginInlineStart: '0',
98
- padding: componentTheme.padding,
99
- ...sizeVariants[size].facade,
100
- '&::before': {
101
- content: '""',
102
- position: 'absolute',
103
- top: '-0.3125rem',
104
- bottom: '-0.3125rem',
105
- left: '-0.3125rem',
106
- right: '-0.3125rem',
107
- boxSizing: 'border-box',
108
- borderRadius: `calc(${componentTheme.borderRadius} * 1.5)`,
109
- border: `${componentTheme.focusBorderWidth} ${componentTheme.focusBorderStyle} ${componentTheme.focusBorderColor}`,
110
- transition: 'all 0.2s',
111
- transform: 'scale(0.75)',
112
- opacity: 0,
113
- pointerEvents: 'none',
114
- ...(focused && {
115
- transform: 'scale(1)',
116
- opacity: 1
117
- })
118
- },
119
- ...(isChecked && {
120
- background: componentTheme.checkedBackground,
121
- borderColor: componentTheme.checkedBorderColor
122
- }),
123
- ...(hovered && {
124
- borderColor: componentTheme.hoverBorderColor
125
- })
126
- },
127
- label: {
128
- label: 'checkboxFacade__label',
129
- flex: '1 1 auto',
130
- minWidth: '0.0625rem',
131
- color: componentTheme.labelColor,
132
- fontFamily: componentTheme.labelFontFamily,
133
- fontWeight: componentTheme.labelFontWeight,
134
- lineHeight: componentTheme.labelLineHeight,
135
- ...sizeVariants[size].label,
136
- ...(isChecked && {
137
- color: componentTheme.checkedLabelColor
138
- })
139
- }
140
- };
1
+ const generateStyle = (componentTheme, props)=>{
2
+ const { size, checked, focused, hovered, indeterminate, invalid } = props;
3
+ const isChecked = checked || indeterminate;
4
+ const sizeVariants = {
5
+ small: {
6
+ label: {
7
+ fontSize: componentTheme.labelFontSizeSmall
8
+ },
9
+ facade: {
10
+ fontSize: componentTheme.iconSizeSmall,
11
+ width: componentTheme.facadeSizeSmall,
12
+ height: componentTheme.facadeSizeSmall
13
+ }
14
+ },
15
+ medium: {
16
+ label: {
17
+ fontSize: componentTheme.labelFontSizeMedium
18
+ },
19
+ facade: {
20
+ fontSize: componentTheme.iconSizeMedium,
21
+ width: componentTheme.facadeSizeMedium,
22
+ height: componentTheme.facadeSizeMedium
23
+ }
24
+ },
25
+ large: {
26
+ label: {
27
+ fontSize: componentTheme.labelFontSizeLarge
28
+ },
29
+ facade: {
30
+ fontSize: componentTheme.iconSizeLarge,
31
+ width: componentTheme.facadeSizeLarge,
32
+ height: componentTheme.facadeSizeLarge
33
+ }
34
+ }
35
+ };
36
+ return {
37
+ checkboxFacade: {
38
+ label: 'checkboxFacade',
39
+ display: 'flex',
40
+ alignItems: 'flex-start'
41
+ },
42
+ facade: {
43
+ label: 'checkboxFacade__facade',
44
+ color: componentTheme.color,
45
+ background: componentTheme.background,
46
+ position: 'relative',
47
+ display: 'flex',
48
+ alignItems: 'center',
49
+ justifyContent: 'center',
50
+ boxSizing: 'border-box',
51
+ flexShrink: 0,
52
+ transition: 'all 0.2s',
53
+ border: `${componentTheme.borderWidth} solid ${invalid ? componentTheme.errorBorderColor : componentTheme.borderColor}`,
54
+ borderRadius: componentTheme.borderRadius,
55
+ marginInlineEnd: componentTheme.marginRight,
56
+ marginInlineStart: '0',
57
+ padding: componentTheme.padding,
58
+ ...sizeVariants[size].facade,
59
+ '&::before': {
60
+ content: '""',
61
+ position: 'absolute',
62
+ top: '-0.3125rem',
63
+ bottom: '-0.3125rem',
64
+ left: '-0.3125rem',
65
+ right: '-0.3125rem',
66
+ boxSizing: 'border-box',
67
+ borderRadius: `calc(${componentTheme.borderRadius} * 1.5)`,
68
+ border: `${componentTheme.focusBorderWidth} ${componentTheme.focusBorderStyle} ${componentTheme.focusBorderColor}`,
69
+ transition: 'all 0.2s',
70
+ transform: 'scale(0.75)',
71
+ opacity: 0,
72
+ pointerEvents: 'none',
73
+ ...focused && {
74
+ transform: 'scale(1)',
75
+ opacity: 1
76
+ }
77
+ },
78
+ ...isChecked && {
79
+ background: componentTheme.checkedBackground,
80
+ borderColor: componentTheme.checkedBorderColor
81
+ },
82
+ ...hovered && {
83
+ borderColor: componentTheme.hoverBorderColor
84
+ }
85
+ },
86
+ label: {
87
+ label: 'checkboxFacade__label',
88
+ flex: '1 1 auto',
89
+ minWidth: '0.0625rem',
90
+ color: componentTheme.labelColor,
91
+ fontFamily: componentTheme.labelFontFamily,
92
+ fontWeight: componentTheme.labelFontWeight,
93
+ lineHeight: componentTheme.labelLineHeight,
94
+ ...sizeVariants[size].label,
95
+ ...isChecked && {
96
+ color: componentTheme.checkedLabelColor
97
+ }
98
+ }
99
+ };
141
100
  };
142
- export default generateStyle;
101
+ export default generateStyle;
@@ -1,83 +1,48 @@
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
- colors,
33
- borders,
34
- spacing,
35
- typography,
36
- key: themeName
37
- } = theme;
38
- const themeSpecificStyle = {
39
- canvas: {
40
- focusBorderColor: theme['ic-brand-primary'],
41
- labelColor: theme['ic-brand-font-color-dark'],
42
- checkedLabelColor: theme['ic-brand-font-color-dark'],
43
- checkedBackground: theme['ic-brand-font-color-dark'],
44
- checkedBorderColor: theme['ic-brand-font-color-dark'],
45
- hoverBorderColor: theme['ic-brand-font-color-dark']
46
- }
47
- };
48
- const componentVariables = {
49
- color: colors?.contrasts?.white1010,
50
- borderWidth: borders?.widthSmall,
51
- borderColor: colors?.contrasts?.grey3045,
52
- errorBorderColor: colors?.contrasts?.red5782,
53
- borderRadius: borders?.radiusMedium,
54
- background: colors?.contrasts?.white1010,
55
- marginRight: spacing?.xSmall,
56
- padding: spacing?.xxxSmall,
57
- checkedBackground: colors?.contrasts?.grey125125,
58
- checkedBorderColor: colors?.contrasts?.grey125125,
59
- hoverBorderColor: colors?.contrasts?.grey125125,
60
- focusBorderColor: colors?.contrasts?.blue4570,
61
- focusBorderWidth: borders?.widthMedium,
62
- focusBorderStyle: borders?.style,
63
- labelColor: colors?.contrasts?.grey125125,
64
- checkedLabelColor: colors?.contrasts?.grey125125,
65
- labelFontFamily: typography?.fontFamily,
66
- labelFontWeight: typography?.fontWeightNormal,
67
- labelLineHeight: typography?.lineHeightCondensed,
68
- facadeSizeSmall: '1rem',
69
- facadeSizeMedium: '1.25rem',
70
- facadeSizeLarge: '1.75rem',
71
- labelFontSizeSmall: typography?.fontSizeSmall,
72
- labelFontSizeMedium: typography?.fontSizeMedium,
73
- labelFontSizeLarge: typography?.fontSizeLarge,
74
- iconSizeSmall: '0.625rem',
75
- iconSizeMedium: '0.75rem',
76
- iconSizeLarge: '1rem'
77
- };
78
- return {
79
- ...componentVariables,
80
- ...themeSpecificStyle[themeName]
81
- };
1
+ const generateComponentTheme = (theme)=>{
2
+ const { colors, borders, spacing, typography, key: themeName } = theme;
3
+ const themeSpecificStyle = {
4
+ canvas: {
5
+ focusBorderColor: theme['ic-brand-primary'],
6
+ labelColor: theme['ic-brand-font-color-dark'],
7
+ checkedLabelColor: theme['ic-brand-font-color-dark'],
8
+ checkedBackground: theme['ic-brand-font-color-dark'],
9
+ checkedBorderColor: theme['ic-brand-font-color-dark'],
10
+ hoverBorderColor: theme['ic-brand-font-color-dark']
11
+ }
12
+ };
13
+ const componentVariables = {
14
+ color: colors?.contrasts?.white1010,
15
+ borderWidth: borders?.widthSmall,
16
+ borderColor: colors?.contrasts?.grey3045,
17
+ errorBorderColor: colors?.contrasts?.red5782,
18
+ borderRadius: borders?.radiusMedium,
19
+ background: colors?.contrasts?.white1010,
20
+ marginRight: spacing?.xSmall,
21
+ padding: spacing?.xxxSmall,
22
+ checkedBackground: colors?.contrasts?.grey125125,
23
+ checkedBorderColor: colors?.contrasts?.grey125125,
24
+ hoverBorderColor: colors?.contrasts?.grey125125,
25
+ focusBorderColor: colors?.contrasts?.blue4570,
26
+ focusBorderWidth: borders?.widthMedium,
27
+ focusBorderStyle: borders?.style,
28
+ labelColor: colors?.contrasts?.grey125125,
29
+ checkedLabelColor: colors?.contrasts?.grey125125,
30
+ labelFontFamily: typography?.fontFamily,
31
+ labelFontWeight: typography?.fontWeightNormal,
32
+ labelLineHeight: typography?.lineHeightCondensed,
33
+ facadeSizeSmall: '1rem',
34
+ facadeSizeMedium: '1.25rem',
35
+ facadeSizeLarge: '1.75rem',
36
+ labelFontSizeSmall: typography?.fontSizeSmall,
37
+ labelFontSizeMedium: typography?.fontSizeMedium,
38
+ labelFontSizeLarge: typography?.fontSizeLarge,
39
+ iconSizeSmall: '0.625rem',
40
+ iconSizeMedium: '0.75rem',
41
+ iconSizeLarge: '1rem'
42
+ };
43
+ return {
44
+ ...componentVariables,
45
+ ...themeSpecificStyle[themeName]
46
+ };
82
47
  };
83
- export default generateComponentTheme;
48
+ export default generateComponentTheme;