@instructure/ui-list 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/InlineList/v1/InlineListItem/index.js +61 -89
  3. package/es/InlineList/v1/InlineListItem/props.js +10 -28
  4. package/es/InlineList/v1/InlineListItem/styles.js +106 -146
  5. package/es/InlineList/v1/InlineListItem/theme.js +35 -69
  6. package/es/InlineList/v1/index.js +55 -82
  7. package/es/InlineList/v1/props.js +10 -26
  8. package/es/InlineList/v2/InlineListItem/index.js +61 -89
  9. package/es/InlineList/v2/InlineListItem/props.js +10 -28
  10. package/es/InlineList/v2/InlineListItem/styles.js +106 -143
  11. package/es/InlineList/v2/index.js +55 -82
  12. package/es/InlineList/v2/props.js +10 -26
  13. package/es/List/v1/ListItem/index.js +53 -83
  14. package/es/List/v1/ListItem/props.js +10 -28
  15. package/es/List/v1/ListItem/styles.js +86 -126
  16. package/es/List/v1/ListItem/theme.js +31 -66
  17. package/es/List/v1/index.js +67 -92
  18. package/es/List/v1/props.js +11 -26
  19. package/es/List/v1/styles.js +27 -66
  20. package/es/List/v1/theme.js +11 -43
  21. package/es/List/v2/ListItem/index.js +53 -83
  22. package/es/List/v2/ListItem/props.js +10 -28
  23. package/es/List/v2/ListItem/styles.js +86 -123
  24. package/es/List/v2/index.js +67 -92
  25. package/es/List/v2/props.js +11 -26
  26. package/es/List/v2/styles.js +27 -66
  27. package/es/exports/a.js +1 -25
  28. package/es/exports/b.js +1 -25
  29. package/package.json +12 -18
  30. package/tsconfig.build.json +0 -1
  31. package/tsconfig.build.tsbuildinfo +1 -1
  32. package/lib/InlineList/v1/InlineListItem/index.js +0 -103
  33. package/lib/InlineList/v1/InlineListItem/props.js +0 -33
  34. package/lib/InlineList/v1/InlineListItem/styles.js +0 -154
  35. package/lib/InlineList/v1/InlineListItem/theme.js +0 -76
  36. package/lib/InlineList/v1/index.js +0 -99
  37. package/lib/InlineList/v1/props.js +0 -31
  38. package/lib/InlineList/v2/InlineListItem/index.js +0 -102
  39. package/lib/InlineList/v2/InlineListItem/props.js +0 -33
  40. package/lib/InlineList/v2/InlineListItem/styles.js +0 -151
  41. package/lib/InlineList/v2/index.js +0 -99
  42. package/lib/InlineList/v2/props.js +0 -31
  43. package/lib/List/v1/ListItem/index.js +0 -97
  44. package/lib/List/v1/ListItem/props.js +0 -33
  45. package/lib/List/v1/ListItem/styles.js +0 -134
  46. package/lib/List/v1/ListItem/theme.js +0 -73
  47. package/lib/List/v1/index.js +0 -115
  48. package/lib/List/v1/props.js +0 -31
  49. package/lib/List/v1/styles.js +0 -74
  50. package/lib/List/v1/theme.js +0 -50
  51. package/lib/List/v2/ListItem/index.js +0 -96
  52. package/lib/List/v2/ListItem/props.js +0 -33
  53. package/lib/List/v2/ListItem/styles.js +0 -139
  54. package/lib/List/v2/index.js +0 -114
  55. package/lib/List/v2/props.js +0 -31
  56. package/lib/List/v2/styles.js +0 -74
  57. package/lib/exports/a.js +0 -32
  58. package/lib/exports/b.js +0 -32
  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
  **Note:** Version bump only for package @instructure/ui-list
@@ -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 { View } from '@instructure/ui-view/v11_6';
28
5
  import { passthroughProps } from '@instructure/ui-react-utils';
@@ -30,69 +7,64 @@ 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: InlineList
37
- id: InlineList.Item
38
- ---
39
- **/
40
- let InlineListItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class InlineListItem extends Component {
41
- static displayName = 'InlineListItem';
42
- static componentId = 'InlineList.Item';
43
- static allowedProps = allowedProps;
44
- static defaultProps = {
45
- padding: 'none',
46
- spacing: 'none',
47
- delimiter: 'none',
48
- size: 'medium',
49
- lastPlaceholder: false
50
- };
51
- ref = null;
52
- handleRef = el => {
53
- const {
54
- elementRef
55
- } = this.props;
56
- this.ref = el;
57
- if (typeof elementRef === 'function') {
58
- elementRef(el);
10
+ class InlineListItem extends Component {
11
+ static{
12
+ this.displayName = 'InlineListItem';
13
+ }
14
+ static{
15
+ this.componentId = 'InlineList.Item';
16
+ }
17
+ static{
18
+ this.allowedProps = allowedProps;
19
+ }
20
+ static{
21
+ this.defaultProps = {
22
+ padding: 'none',
23
+ spacing: 'none',
24
+ delimiter: 'none',
25
+ size: 'medium',
26
+ lastPlaceholder: false
27
+ };
28
+ }
29
+ componentDidMount() {
30
+ this.props.makeStyles?.();
31
+ }
32
+ componentDidUpdate() {
33
+ this.props.makeStyles?.();
34
+ }
35
+ render() {
36
+ const { delimiter, size, margin, padding, elementRef, children, spacing, styles, lastPlaceholder, ...rest } = this.props;
37
+ return /*#__PURE__*/ _jsxs(View, {
38
+ ...passthroughProps(rest),
39
+ css: styles?.inlineListItem,
40
+ as: "li",
41
+ margin: margin,
42
+ padding: padding,
43
+ display: "inline-block",
44
+ maxWidth: "100%",
45
+ elementRef: this.handleRef,
46
+ "data-cid": "InlineListItem",
47
+ children: [
48
+ children,
49
+ !lastPlaceholder && /*#__PURE__*/ _jsx("span", {
50
+ css: styles?.delimiter,
51
+ "aria-hidden": "true"
52
+ })
53
+ ]
54
+ });
55
+ }
56
+ constructor(...args){
57
+ super(...args), this.ref = null, this.handleRef = (el)=>{
58
+ const { elementRef } = this.props;
59
+ this.ref = el;
60
+ if (typeof elementRef === 'function') {
61
+ elementRef(el);
62
+ }
63
+ };
59
64
  }
60
- };
61
- componentDidMount() {
62
- this.props.makeStyles?.();
63
- }
64
- componentDidUpdate() {
65
- this.props.makeStyles?.();
66
- }
67
- render() {
68
- const {
69
- delimiter,
70
- size,
71
- margin,
72
- padding,
73
- elementRef,
74
- children,
75
- spacing,
76
- styles,
77
- lastPlaceholder,
78
- ...rest
79
- } = this.props;
80
- return _jsxs(View, {
81
- ...passthroughProps(rest),
82
- css: styles?.inlineListItem,
83
- as: "li",
84
- margin: margin,
85
- padding: padding,
86
- display: "inline-block",
87
- maxWidth: "100%",
88
- elementRef: this.handleRef,
89
- "data-cid": "InlineListItem",
90
- children: [children, !lastPlaceholder && _jsx("span", {
91
- css: styles?.delimiter,
92
- "aria-hidden": "true"
93
- })]
94
- });
95
- }
96
- }) || _class);
65
+ }
66
+ InlineListItem = _ts_decorate([
67
+ withStyle(generateStyle, generateComponentTheme)
68
+ ], InlineListItem);
97
69
  export default InlineListItem;
98
- export { InlineListItem };
70
+ export { InlineListItem };
@@ -1,28 +1,10 @@
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
- // <unknown> is needed for React 17 compatibility
26
-
27
- const allowedProps = ['children', 'delimiter', 'size', 'margin', 'padding', 'spacing', 'elementRef'];
28
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'children',
3
+ 'delimiter',
4
+ 'size',
5
+ 'margin',
6
+ 'padding',
7
+ 'spacing',
8
+ 'elementRef'
9
+ ];
10
+ export { allowedProps };
@@ -1,148 +1,108 @@
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
1
  import { logError as error } from '@instructure/console';
26
- /**
27
- * ---
28
- * private: true
29
- * ---
30
- * Generates the style object from the theme and provided additional information
31
- * @param {Object} componentTheme The theme variable object.
32
- * @param {Object} props the props of the component, the style is applied to
33
- * @param {String} props.delimiter
34
- * @param {String} props.spacing
35
- * @param {Object} state the state of the component, the style is applied to
36
- * @return {Object} The final style object, which will be used in the component
37
- */
38
- const generateStyle = (componentTheme, props) => {
39
- const {
40
- size,
41
- delimiter,
42
- spacing
43
- } = props;
44
- const withDelimiter = delimiter !== 'none';
45
- const withSpacing = spacing !== 'none';
46
- error(!(withDelimiter && withSpacing), `[InlineList] \`itemSpacing\` has no effect inside Lists with the \`delimiter\` prop set to anything other than \`none\`.`);
47
- const sizeVariants = {
48
- small: {
49
- fontSize: componentTheme.fontSizeSmall
50
- },
51
- medium: {
52
- fontSize: componentTheme.fontSizeMedium
53
- },
54
- large: {
55
- fontSize: componentTheme.fontSizeLarge
56
- }
57
- };
58
- const spacingVariants = {
59
- 'xxx-small': {
60
- marginInlineStart: componentTheme.spacingXXXSmall,
61
- marginInlineEnd: componentTheme.spacingXXXSmall
62
- },
63
- 'xx-small': {
64
- marginInlineStart: componentTheme.spacingXXSmall,
65
- marginInlineEnd: componentTheme.spacingXXSmall
66
- },
67
- 'x-small': {
68
- marginInlineStart: componentTheme.spacingXSmall,
69
- marginInlineEnd: componentTheme.spacingXSmall
70
- },
71
- small: {
72
- marginInlineStart: componentTheme.spacingSmall,
73
- marginInlineEnd: componentTheme.spacingSmall
74
- },
75
- medium: {
76
- marginInlineStart: componentTheme.spacingMedium,
77
- marginInlineEnd: componentTheme.spacingMedium
78
- },
79
- large: {
80
- marginInlineStart: componentTheme.spacingLarge,
81
- marginInlineEnd: componentTheme.spacingLarge
82
- },
83
- 'x-large': {
84
- marginInlineStart: componentTheme.spacingXLarge,
85
- marginInlineEnd: componentTheme.spacingXLarge
86
- },
87
- 'xx-large': {
88
- marginInlineStart: componentTheme.spacingXXLarge,
89
- marginInlineEnd: componentTheme.spacingXXLarge
90
- },
91
- none: {}
92
- };
93
- const delimiterVariants = {
94
- none: {
95
- marginInlineStart: componentTheme.noneSpacing,
96
- marginInlineEnd: componentTheme.noneSpacing
97
- },
98
- pipe: {
99
- marginInlineStart: componentTheme.pipeSpacing,
100
- marginInlineEnd: componentTheme.pipeSpacing,
101
- '&::after': {
102
- content: '"\\007C"'
103
- }
104
- },
105
- slash: {
106
- marginInlineStart: componentTheme.slashSpacing,
107
- marginInlineEnd: componentTheme.slashSpacing,
108
- '&::after': {
109
- content: '"\\002F"'
110
- }
111
- },
112
- arrow: {
113
- marginInlineStart: componentTheme.arrowSpacing,
114
- marginInlineEnd: componentTheme.arrowSpacing,
115
- '&::after': {
116
- content: '"\\003E"'
117
- }
118
- }
119
- };
120
- return {
121
- inlineListItem: {
122
- label: 'inlineListItem',
123
- fontWeight: componentTheme.fontWeight,
124
- fontFamily: componentTheme.fontFamily,
125
- verticalAlign: 'middle',
126
- boxSizing: 'border-box',
127
- lineHeight: componentTheme.lineHeight,
128
- color: componentTheme.color,
129
- ...(withSpacing && !withDelimiter && spacingVariants[spacing]),
130
- ...sizeVariants[size],
131
- '&:first-of-type': {
132
- marginInlineStart: 0
133
- },
134
- '&:last-of-type': {
135
- marginInlineEnd: 0
136
- }
137
- },
138
- delimiter: {
139
- label: 'inlineListItem__delimiter',
140
- ...delimiterVariants[delimiter],
141
- '[class$=-inlineListItem]:last-of-type > &:last-child::after': {
142
- content: 'none'
143
- },
144
- color: componentTheme.delimiterColor
145
- }
146
- };
2
+ const generateStyle = (componentTheme, props)=>{
3
+ const { size, delimiter, spacing } = props;
4
+ const withDelimiter = delimiter !== 'none';
5
+ const withSpacing = spacing !== 'none';
6
+ error(!(withDelimiter && withSpacing), `[InlineList] \`itemSpacing\` has no effect inside Lists with the \`delimiter\` prop set to anything other than \`none\`.`);
7
+ const sizeVariants = {
8
+ small: {
9
+ fontSize: componentTheme.fontSizeSmall
10
+ },
11
+ medium: {
12
+ fontSize: componentTheme.fontSizeMedium
13
+ },
14
+ large: {
15
+ fontSize: componentTheme.fontSizeLarge
16
+ }
17
+ };
18
+ const spacingVariants = {
19
+ 'xxx-small': {
20
+ marginInlineStart: componentTheme.spacingXXXSmall,
21
+ marginInlineEnd: componentTheme.spacingXXXSmall
22
+ },
23
+ 'xx-small': {
24
+ marginInlineStart: componentTheme.spacingXXSmall,
25
+ marginInlineEnd: componentTheme.spacingXXSmall
26
+ },
27
+ 'x-small': {
28
+ marginInlineStart: componentTheme.spacingXSmall,
29
+ marginInlineEnd: componentTheme.spacingXSmall
30
+ },
31
+ small: {
32
+ marginInlineStart: componentTheme.spacingSmall,
33
+ marginInlineEnd: componentTheme.spacingSmall
34
+ },
35
+ medium: {
36
+ marginInlineStart: componentTheme.spacingMedium,
37
+ marginInlineEnd: componentTheme.spacingMedium
38
+ },
39
+ large: {
40
+ marginInlineStart: componentTheme.spacingLarge,
41
+ marginInlineEnd: componentTheme.spacingLarge
42
+ },
43
+ 'x-large': {
44
+ marginInlineStart: componentTheme.spacingXLarge,
45
+ marginInlineEnd: componentTheme.spacingXLarge
46
+ },
47
+ 'xx-large': {
48
+ marginInlineStart: componentTheme.spacingXXLarge,
49
+ marginInlineEnd: componentTheme.spacingXXLarge
50
+ },
51
+ none: {}
52
+ };
53
+ const delimiterVariants = {
54
+ none: {
55
+ marginInlineStart: componentTheme.noneSpacing,
56
+ marginInlineEnd: componentTheme.noneSpacing
57
+ },
58
+ pipe: {
59
+ marginInlineStart: componentTheme.pipeSpacing,
60
+ marginInlineEnd: componentTheme.pipeSpacing,
61
+ '&::after': {
62
+ content: '"\\007C"'
63
+ }
64
+ },
65
+ slash: {
66
+ marginInlineStart: componentTheme.slashSpacing,
67
+ marginInlineEnd: componentTheme.slashSpacing,
68
+ '&::after': {
69
+ content: '"\\002F"'
70
+ }
71
+ },
72
+ arrow: {
73
+ marginInlineStart: componentTheme.arrowSpacing,
74
+ marginInlineEnd: componentTheme.arrowSpacing,
75
+ '&::after': {
76
+ content: '"\\003E"'
77
+ }
78
+ }
79
+ };
80
+ return {
81
+ inlineListItem: {
82
+ label: 'inlineListItem',
83
+ fontWeight: componentTheme.fontWeight,
84
+ fontFamily: componentTheme.fontFamily,
85
+ verticalAlign: 'middle',
86
+ boxSizing: 'border-box',
87
+ lineHeight: componentTheme.lineHeight,
88
+ color: componentTheme.color,
89
+ ...withSpacing && !withDelimiter && spacingVariants[spacing],
90
+ ...sizeVariants[size],
91
+ '&:first-of-type': {
92
+ marginInlineStart: 0
93
+ },
94
+ '&:last-of-type': {
95
+ marginInlineEnd: 0
96
+ }
97
+ },
98
+ delimiter: {
99
+ label: 'inlineListItem__delimiter',
100
+ ...delimiterVariants[delimiter],
101
+ '[class$=-inlineListItem]:last-of-type > &:last-child::after': {
102
+ content: 'none'
103
+ },
104
+ color: componentTheme.delimiterColor
105
+ }
106
+ };
147
107
  };
148
- export default generateStyle;
108
+ export default generateStyle;
@@ -1,70 +1,36 @@
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
- spacing,
34
- typography,
35
- key: themeName
36
- } = theme;
37
- const themeSpecificStyle = {
38
- canvas: {
39
- color: theme['ic-brand-font-color-dark']
40
- }
41
- };
42
- const componentVariables = {
43
- fontFamily: typography?.fontFamily,
44
- fontWeight: typography?.fontWeightNormal,
45
- fontSizeSmall: typography?.fontSizeSmall,
46
- fontSizeMedium: typography?.fontSizeMedium,
47
- fontSizeLarge: typography?.fontSizeLarge,
48
- color: colors?.contrasts?.grey4570,
49
- delimiterColor: colors?.contrasts?.grey125125,
50
- lineHeight: typography?.lineHeightCondensed,
51
- noneSpacing: spacing?.xSmall,
52
- pipeSpacing: spacing?.xSmall,
53
- slashSpacing: spacing?.xSmall,
54
- arrowSpacing: spacing?.xSmall,
55
- marginBottomDefault: spacing?.xxxSmall,
56
- spacingXXXSmall: spacing?.xxxSmall,
57
- spacingXXSmall: spacing?.xxSmall,
58
- spacingXSmall: spacing?.xSmall,
59
- spacingSmall: spacing?.small,
60
- spacingMedium: spacing?.medium,
61
- spacingLarge: spacing?.large,
62
- spacingXLarge: spacing?.xLarge,
63
- spacingXXLarge: spacing?.xxLarge
64
- };
65
- return {
66
- ...componentVariables,
67
- ...themeSpecificStyle[themeName]
68
- };
1
+ const generateComponentTheme = (theme)=>{
2
+ const { colors, spacing, typography, key: themeName } = theme;
3
+ const themeSpecificStyle = {
4
+ canvas: {
5
+ color: theme['ic-brand-font-color-dark']
6
+ }
7
+ };
8
+ const componentVariables = {
9
+ fontFamily: typography?.fontFamily,
10
+ fontWeight: typography?.fontWeightNormal,
11
+ fontSizeSmall: typography?.fontSizeSmall,
12
+ fontSizeMedium: typography?.fontSizeMedium,
13
+ fontSizeLarge: typography?.fontSizeLarge,
14
+ color: colors?.contrasts?.grey4570,
15
+ delimiterColor: colors?.contrasts?.grey125125,
16
+ lineHeight: typography?.lineHeightCondensed,
17
+ noneSpacing: spacing?.xSmall,
18
+ pipeSpacing: spacing?.xSmall,
19
+ slashSpacing: spacing?.xSmall,
20
+ arrowSpacing: spacing?.xSmall,
21
+ marginBottomDefault: spacing?.xxxSmall,
22
+ spacingXXXSmall: spacing?.xxxSmall,
23
+ spacingXXSmall: spacing?.xxSmall,
24
+ spacingXSmall: spacing?.xSmall,
25
+ spacingSmall: spacing?.small,
26
+ spacingMedium: spacing?.medium,
27
+ spacingLarge: spacing?.large,
28
+ spacingXLarge: spacing?.xLarge,
29
+ spacingXXLarge: spacing?.xxLarge
30
+ };
31
+ return {
32
+ ...componentVariables,
33
+ ...themeSpecificStyle[themeName]
34
+ };
69
35
  };
70
- export default generateComponentTheme;
36
+ export default generateComponentTheme;