@instructure/ui-checkbox 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 (59) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es/Checkbox/v1/CheckboxFacade/index.js +74 -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 +78 -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 +206 -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 +79 -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 +91 -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 +229 -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 +96 -118
  24. package/es/CheckboxGroup/v1/props.js +14 -26
  25. package/es/CheckboxGroup/v2/index.js +96 -118
  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/tsconfig.build.json +0 -1
  31. package/tsconfig.build.tsbuildinfo +1 -1
  32. package/lib/Checkbox/v1/CheckboxFacade/index.js +0 -105
  33. package/lib/Checkbox/v1/CheckboxFacade/props.js +0 -31
  34. package/lib/Checkbox/v1/CheckboxFacade/styles.js +0 -148
  35. package/lib/Checkbox/v1/CheckboxFacade/theme.js +0 -89
  36. package/lib/Checkbox/v1/ToggleFacade/index.js +0 -114
  37. package/lib/Checkbox/v1/ToggleFacade/props.js +0 -31
  38. package/lib/Checkbox/v1/ToggleFacade/styles.js +0 -200
  39. package/lib/Checkbox/v1/ToggleFacade/theme.js +0 -90
  40. package/lib/Checkbox/v1/index.js +0 -299
  41. package/lib/Checkbox/v1/props.js +0 -31
  42. package/lib/Checkbox/v1/styles.js +0 -97
  43. package/lib/Checkbox/v1/theme.js +0 -51
  44. package/lib/Checkbox/v2/CheckboxFacade/index.js +0 -111
  45. package/lib/Checkbox/v2/CheckboxFacade/props.js +0 -31
  46. package/lib/Checkbox/v2/CheckboxFacade/styles.js +0 -184
  47. package/lib/Checkbox/v2/ToggleFacade/index.js +0 -124
  48. package/lib/Checkbox/v2/ToggleFacade/props.js +0 -31
  49. package/lib/Checkbox/v2/ToggleFacade/styles.js +0 -239
  50. package/lib/Checkbox/v2/index.js +0 -335
  51. package/lib/Checkbox/v2/props.js +0 -31
  52. package/lib/Checkbox/v2/styles.js +0 -116
  53. package/lib/CheckboxGroup/v1/index.js +0 -138
  54. package/lib/CheckboxGroup/v1/props.js +0 -31
  55. package/lib/CheckboxGroup/v2/index.js +0 -138
  56. package/lib/CheckboxGroup/v2/props.js +0 -31
  57. package/lib/exports/a.js +0 -31
  58. package/lib/exports/b.js +0 -31
  59. 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.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
7
+
8
+ ### Build System
9
+
10
+ * **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
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.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
7
20
 
8
21
  ### Bug Fixes
@@ -1,28 +1,5 @@
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 { SVGIcon } from '@instructure/ui-svg-images';
28
5
  import { IconCheckMarkSolid } from '@instructure/ui-icons';
@@ -30,71 +7,77 @@ import { withStyle } from '@instructure/emotion';
30
7
  import generateStyle from './styles.js';
31
8
  import generateComponentTheme from './theme.js';
32
9
  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;
10
+ class CheckboxFacade extends Component {
11
+ static{
12
+ this.displayName = 'CheckboxFacade';
13
+ }
14
+ static{
15
+ this.componentId = 'CheckboxFacade';
16
+ }
17
+ static{
18
+ this.allowedProps = allowedProps;
19
+ }
20
+ static{
21
+ this.defaultProps = {
22
+ checked: false,
23
+ focused: false,
24
+ hovered: false,
25
+ size: 'medium',
26
+ indeterminate: false
27
+ };
28
+ }
29
+ componentDidMount() {
30
+ this.props.makeStyles?.();
31
+ }
32
+ componentDidUpdate() {
33
+ this.props.makeStyles?.();
34
+ }
35
+ renderIcon() {
36
+ if (this.props.indeterminate) {
37
+ return /*#__PURE__*/ _jsx(SVGIcon, {
38
+ viewBox: "0 0 1920 1920",
39
+ inline: false,
40
+ children: /*#__PURE__*/ _jsx("rect", {
41
+ x: "140",
42
+ y: "820",
43
+ width: "1640",
44
+ height: "280"
45
+ })
46
+ });
47
+ } else if (this.props.checked) {
48
+ return /*#__PURE__*/ _jsx(IconCheckMarkSolid, {
49
+ inline: false
50
+ });
51
+ } else {
52
+ return null;
53
+ }
54
+ }
55
+ render() {
56
+ const { children, styles } = this.props;
57
+ return /*#__PURE__*/ _jsxs("span", {
58
+ css: styles?.checkboxFacade,
59
+ ref: this.handleRef,
60
+ children: [
61
+ /*#__PURE__*/ _jsx("span", {
62
+ css: styles?.facade,
63
+ "aria-hidden": "true",
64
+ children: this.renderIcon()
65
+ }),
66
+ /*#__PURE__*/ _jsx("span", {
67
+ css: styles?.label,
68
+ children: children
69
+ })
70
+ ]
71
+ });
72
+ }
73
+ constructor(...args){
74
+ super(...args), this.ref = null, this.handleRef = (el)=>{
75
+ this.ref = el;
76
+ };
78
77
  }
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);
78
+ }
79
+ CheckboxFacade = _ts_decorate([
80
+ withStyle(generateStyle, generateComponentTheme)
81
+ ], CheckboxFacade);
99
82
  export default CheckboxFacade;
100
- export { CheckboxFacade };
83
+ 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;