@instructure/ui-breadcrumb 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.
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,119 +1,81 @@
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
-
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
25
2
  import { Component } from 'react';
26
3
  import { TruncateText } from '@instructure/ui-truncate-text/v11_6';
27
4
  import { Link } from '@instructure/ui-link/v11_6';
28
5
  import { omitProps } from '@instructure/ui-react-utils';
29
6
  import { Tooltip } from '@instructure/ui-tooltip/v11_6';
30
7
  import { allowedProps } from './props.js';
31
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
32
- /**
33
- ---
34
- parent: Breadcrumb
35
- id: Breadcrumb.Link
36
- ---
37
- **/
38
-
39
8
  class BreadcrumbLink extends Component {
40
- static displayName = 'BreadcrumbLink';
41
- static componentId = 'Breadcrumb.Link';
42
- static allowedProps = allowedProps;
43
- static defaultProps = {};
44
- ref = null;
45
- handleRef = el => {
46
- this.ref = el;
47
- };
48
- constructor(props) {
49
- super(props);
50
- this.state = {
51
- isTruncated: false
52
- };
53
- }
54
- handleTruncation(isTruncated) {
55
- if (isTruncated !== this.state.isTruncated) {
56
- this.setState({
57
- isTruncated
58
- });
9
+ static{
10
+ this.displayName = 'BreadcrumbLink';
11
+ }
12
+ static{
13
+ this.componentId = 'Breadcrumb.Link';
14
+ }
15
+ static{
16
+ this.allowedProps = allowedProps;
17
+ }
18
+ static{
19
+ this.defaultProps = {};
20
+ }
21
+ constructor(props){
22
+ super(props), this.ref = null, this.handleRef = (el)=>{
23
+ this.ref = el;
24
+ };
25
+ this.state = {
26
+ isTruncated: false
27
+ };
28
+ }
29
+ handleTruncation(isTruncated) {
30
+ if (isTruncated !== this.state.isTruncated) {
31
+ this.setState({
32
+ isTruncated
33
+ });
34
+ }
35
+ }
36
+ render() {
37
+ const { children, href, renderIcon, iconPlacement, onClick, onMouseEnter, isCurrentPage } = this.props;
38
+ const { isTruncated } = this.state;
39
+ const props = omitProps(this.props, BreadcrumbLink.allowedProps);
40
+ const isInteractive = onClick || href;
41
+ return /*#__PURE__*/ _jsx(Tooltip, {
42
+ renderTip: children,
43
+ preventTooltip: !isTruncated,
44
+ ...isInteractive && {
45
+ as: 'span'
46
+ },
47
+ children: /*#__PURE__*/ _jsx(Link, {
48
+ ...props,
49
+ href: href,
50
+ renderIcon: renderIcon,
51
+ iconPlacement: iconPlacement,
52
+ onClick: onClick,
53
+ onMouseEnter: onMouseEnter,
54
+ isWithinText: false,
55
+ elementRef: this.handleRef,
56
+ forceButtonRole: false,
57
+ ...isCurrentPage && {
58
+ 'aria-current': 'page'
59
+ },
60
+ ...isTruncated && {
61
+ ...typeof children === 'string' && {
62
+ 'aria-label': children
63
+ },
64
+ ...!isInteractive && {
65
+ role: 'text'
66
+ }
67
+ },
68
+ "data-cid": "BreadcrumbLink",
69
+ children: /*#__PURE__*/ _jsx(TruncateText, {
70
+ onUpdate: (isTruncated)=>this.handleTruncation(isTruncated),
71
+ children: /*#__PURE__*/ _jsx("span", {
72
+ "aria-hidden": isTruncated,
73
+ children: children
74
+ })
75
+ })
76
+ })
77
+ });
59
78
  }
60
- }
61
- render() {
62
- const {
63
- children,
64
- href,
65
- renderIcon,
66
- iconPlacement,
67
- onClick,
68
- onMouseEnter,
69
- isCurrentPage
70
- } = this.props;
71
- const {
72
- isTruncated
73
- } = this.state;
74
- const props = omitProps(this.props, BreadcrumbLink.allowedProps);
75
- const isInteractive = onClick || href;
76
- return _jsx(Tooltip, {
77
- renderTip: children,
78
- preventTooltip: !isTruncated
79
- // this wraps the achor/button tag in a span and puts the aria-describedby on that instead of the anchor/button tag
80
- // to avoid SRs reading the text twice when there is already an aria-label
81
- ,
82
- ...(isInteractive && {
83
- as: 'span'
84
- }),
85
- children: _jsx(Link, {
86
- ...props,
87
- href: href,
88
- renderIcon: renderIcon,
89
- iconPlacement: iconPlacement,
90
- onClick: onClick,
91
- onMouseEnter: onMouseEnter,
92
- isWithinText: false,
93
- elementRef: this.handleRef,
94
- forceButtonRole: false,
95
- ...(isCurrentPage && {
96
- 'aria-current': 'page'
97
- }),
98
- ...(isTruncated && {
99
- ...(typeof children === 'string' && {
100
- 'aria-label': children
101
- }),
102
- ...(!isInteractive && {
103
- role: 'text'
104
- })
105
- }),
106
- "data-cid": "BreadcrumbLink",
107
- children: _jsx(TruncateText, {
108
- onUpdate: isTruncated => this.handleTruncation(isTruncated),
109
- children: _jsx("span", {
110
- "aria-hidden": isTruncated,
111
- children: children
112
- })
113
- })
114
- })
115
- });
116
- }
117
79
  }
118
80
  export default BreadcrumbLink;
119
- export { BreadcrumbLink };
81
+ export { BreadcrumbLink };
@@ -1,26 +1,11 @@
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', 'href', 'iconPlacement', 'onClick', 'onMouseEnter', 'renderIcon', 'size', 'isCurrentPage'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'children',
3
+ 'href',
4
+ 'iconPlacement',
5
+ 'onClick',
6
+ 'onMouseEnter',
7
+ 'renderIcon',
8
+ 'size',
9
+ 'isCurrentPage'
10
+ ];
11
+ export { allowedProps };
@@ -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 { isValidElement, cloneElement, Children, Component } from 'react';
27
4
  import { View } from '@instructure/ui-view/v11_6';
28
5
  import { withStyle } from '@instructure/emotion';
@@ -31,83 +8,90 @@ import { BreadcrumbLink } from './BreadcrumbLink/index.js';
31
8
  import generateStyle from './styles.js';
32
9
  import generateComponentTheme from './theme.js';
33
10
  import { allowedProps } from './props.js';
34
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
35
- /**
36
- ---
37
- category: components
38
- ---
39
- **/
40
- let Breadcrumb = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Breadcrumb extends Component {
41
- static displayName = 'Breadcrumb';
42
- static componentId = 'Breadcrumb';
43
- static allowedProps = allowedProps;
44
- static defaultProps = {
45
- size: 'medium',
46
- children: null
47
- };
48
- ref = null;
49
- handleRef = el => {
50
- this.ref = el;
51
- };
52
- addAriaCurrent = child => {
53
- const updatedChild = /*#__PURE__*/cloneElement(child, {
54
- 'aria-current': 'page'
55
- });
56
- return updatedChild;
57
- };
58
- componentDidMount() {
59
- this.props.makeStyles?.();
60
- }
61
- componentDidUpdate() {
62
- this.props.makeStyles?.();
63
- }
64
- static Link = BreadcrumbLink;
65
- renderChildren() {
66
- const {
67
- styles,
68
- children
69
- } = this.props;
70
- const numChildren = Children.count(children);
71
- const inlineStyle = {
72
- maxWidth: `${Math.floor(100 / numChildren)}%`
73
- };
74
- let isAriaCurrentSet = false;
75
- return Children.map(children, (child, index) => {
76
- const isLastElement = index === numChildren - 1;
77
- if (/*#__PURE__*/isValidElement(child)) {
78
- const isCurrentPage = child.props.isCurrentPage || false;
79
- if (isAriaCurrentSet && isCurrentPage) {}
80
- if (isCurrentPage) {
81
- isAriaCurrentSet = true;
82
- }
83
- }
84
- return _jsxs("li", {
85
- css: styles?.crumb,
86
- style: inlineStyle,
87
- children: [!isAriaCurrentSet && isLastElement && child.props.isCurrentPage !== false ? this.addAriaCurrent(child) : child, index < numChildren - 1 && _jsx(IconArrowOpenEndSolid, {
88
- color: "auto",
89
- css: styles?.separator
90
- })]
91
- });
92
- });
93
- }
94
- render() {
95
- const {
96
- styles
97
- } = this.props;
98
- return _jsx(View, {
99
- role: "navigation",
100
- as: "div",
101
- margin: this.props.margin,
102
- "aria-label": this.props.label,
103
- elementRef: this.handleRef,
104
- "data-cid": "Breadcrumb",
105
- children: _jsx("ol", {
106
- css: styles?.breadcrumb,
107
- children: this.renderChildren()
108
- })
109
- });
110
- }
111
- }) || _class);
11
+ class Breadcrumb extends Component {
12
+ static{
13
+ this.displayName = 'Breadcrumb';
14
+ }
15
+ static{
16
+ this.componentId = 'Breadcrumb';
17
+ }
18
+ static{
19
+ this.allowedProps = allowedProps;
20
+ }
21
+ static{
22
+ this.defaultProps = {
23
+ size: 'medium',
24
+ children: null
25
+ };
26
+ }
27
+ componentDidMount() {
28
+ this.props.makeStyles?.();
29
+ }
30
+ componentDidUpdate() {
31
+ this.props.makeStyles?.();
32
+ }
33
+ static{
34
+ this.Link = BreadcrumbLink;
35
+ }
36
+ renderChildren() {
37
+ const { styles, children } = this.props;
38
+ const numChildren = Children.count(children);
39
+ const inlineStyle = {
40
+ maxWidth: `${Math.floor(100 / numChildren)}%`
41
+ };
42
+ let isAriaCurrentSet = false;
43
+ return Children.map(children, (child, index)=>{
44
+ const isLastElement = index === numChildren - 1;
45
+ if (/*#__PURE__*/ isValidElement(child)) {
46
+ const isCurrentPage = child.props.isCurrentPage || false;
47
+ if (isAriaCurrentSet && isCurrentPage) {
48
+ void 0;
49
+ }
50
+ if (isCurrentPage) {
51
+ isAriaCurrentSet = true;
52
+ }
53
+ }
54
+ return /*#__PURE__*/ _jsxs("li", {
55
+ css: styles?.crumb,
56
+ style: inlineStyle,
57
+ children: [
58
+ !isAriaCurrentSet && isLastElement && child.props.isCurrentPage !== false ? this.addAriaCurrent(child) : child,
59
+ index < numChildren - 1 && /*#__PURE__*/ _jsx(IconArrowOpenEndSolid, {
60
+ color: "auto",
61
+ css: styles?.separator
62
+ })
63
+ ]
64
+ });
65
+ });
66
+ }
67
+ render() {
68
+ const { styles } = this.props;
69
+ return /*#__PURE__*/ _jsx(View, {
70
+ role: "navigation",
71
+ as: "div",
72
+ margin: this.props.margin,
73
+ "aria-label": this.props.label,
74
+ elementRef: this.handleRef,
75
+ "data-cid": "Breadcrumb",
76
+ children: /*#__PURE__*/ _jsx("ol", {
77
+ css: styles?.breadcrumb,
78
+ children: this.renderChildren()
79
+ })
80
+ });
81
+ }
82
+ constructor(...args){
83
+ super(...args), this.ref = null, this.handleRef = (el)=>{
84
+ this.ref = el;
85
+ }, this.addAriaCurrent = (child)=>{
86
+ const updatedChild = /*#__PURE__*/ cloneElement(child, {
87
+ 'aria-current': 'page'
88
+ });
89
+ return updatedChild;
90
+ };
91
+ }
92
+ }
93
+ Breadcrumb = _ts_decorate([
94
+ withStyle(generateStyle, generateComponentTheme)
95
+ ], Breadcrumb);
112
96
  export default Breadcrumb;
113
- export { Breadcrumb, BreadcrumbLink };
97
+ export { Breadcrumb, BreadcrumbLink };
@@ -1,26 +1,7 @@
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', 'label', 'margin', 'size'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'children',
3
+ 'label',
4
+ 'margin',
5
+ 'size'
6
+ ];
7
+ export { allowedProps };
@@ -1,106 +1,70 @@
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
- } = props;
39
- const crumbSizeVariants = {
40
- small: {
41
- fontSize: componentTheme.smallFontSize,
42
- paddingInlineEnd: `calc(${componentTheme.smallSeparatorFontSize} * 2)`,
43
- paddingInlineStart: 0
44
- },
45
- medium: {
46
- fontSize: componentTheme.mediumFontSize,
47
- paddingInlineEnd: `calc(${componentTheme.mediumSeparatorFontSize} * 2)`,
48
- paddingInlineStart: 0
49
- },
50
- large: {
51
- fontSize: componentTheme.largeFontSize,
52
- paddingInlineEnd: `calc(${componentTheme.largeSeparatorFontSize} * 2)`,
53
- paddingInlineStart: 0
54
- }
55
- };
56
- const separatorSizeVariants = {
57
- small: {
58
- fontSize: componentTheme.smallSeparatorFontSize,
59
- insetInlineEnd: `calc(${componentTheme.smallSeparatorFontSize} / 2)`,
60
- insetInlineStart: 'auto',
61
- marginTop: `calc(-1 * (${componentTheme.smallSeparatorFontSize} / 2))`
62
- },
63
- medium: {
64
- fontSize: componentTheme.mediumSeparatorFontSize,
65
- insetInlineEnd: `calc(${componentTheme.mediumSeparatorFontSize} / 2)`,
66
- insetInlineStart: 'auto',
67
- marginTop: `calc(-1 * (${componentTheme.mediumSeparatorFontSize} / 2))`
68
- },
69
- large: {
70
- fontSize: componentTheme.largeSeparatorFontSize,
71
- insetInlineEnd: `calc(${componentTheme.largeSeparatorFontSize} / 2)`,
72
- insetInlineStart: 'auto',
73
- marginTop: `calc(-1 * (${componentTheme.largeSeparatorFontSize} / 2))`
74
- }
75
- };
76
- return {
77
- breadcrumb: {
78
- label: 'breadcrumb',
79
- fontFamily: componentTheme.fontFamily,
80
- margin: 0,
81
- padding: 0,
82
- listStyleType: 'none',
83
- overflow: 'visible',
84
- display: 'flex',
85
- alignItems: 'center'
86
- },
87
- crumb: {
88
- label: 'breadcrumb__crumb',
89
- boxSizing: 'border-box',
90
- position: 'relative',
91
- ...crumbSizeVariants[size],
92
- '&:last-child': {
93
- paddingInlineEnd: 0
94
- }
95
- },
96
- separator: {
97
- label: 'breadcrumb__separator',
98
- boxSizing: 'border-box',
99
- position: 'absolute',
100
- top: '50%',
101
- color: componentTheme.separatorColor,
102
- ...separatorSizeVariants[size]
103
- }
104
- };
1
+ const generateStyle = (componentTheme, props)=>{
2
+ const { size } = props;
3
+ const crumbSizeVariants = {
4
+ small: {
5
+ fontSize: componentTheme.smallFontSize,
6
+ paddingInlineEnd: `calc(${componentTheme.smallSeparatorFontSize} * 2)`,
7
+ paddingInlineStart: 0
8
+ },
9
+ medium: {
10
+ fontSize: componentTheme.mediumFontSize,
11
+ paddingInlineEnd: `calc(${componentTheme.mediumSeparatorFontSize} * 2)`,
12
+ paddingInlineStart: 0
13
+ },
14
+ large: {
15
+ fontSize: componentTheme.largeFontSize,
16
+ paddingInlineEnd: `calc(${componentTheme.largeSeparatorFontSize} * 2)`,
17
+ paddingInlineStart: 0
18
+ }
19
+ };
20
+ const separatorSizeVariants = {
21
+ small: {
22
+ fontSize: componentTheme.smallSeparatorFontSize,
23
+ insetInlineEnd: `calc(${componentTheme.smallSeparatorFontSize} / 2)`,
24
+ insetInlineStart: 'auto',
25
+ marginTop: `calc(-1 * (${componentTheme.smallSeparatorFontSize} / 2))`
26
+ },
27
+ medium: {
28
+ fontSize: componentTheme.mediumSeparatorFontSize,
29
+ insetInlineEnd: `calc(${componentTheme.mediumSeparatorFontSize} / 2)`,
30
+ insetInlineStart: 'auto',
31
+ marginTop: `calc(-1 * (${componentTheme.mediumSeparatorFontSize} / 2))`
32
+ },
33
+ large: {
34
+ fontSize: componentTheme.largeSeparatorFontSize,
35
+ insetInlineEnd: `calc(${componentTheme.largeSeparatorFontSize} / 2)`,
36
+ insetInlineStart: 'auto',
37
+ marginTop: `calc(-1 * (${componentTheme.largeSeparatorFontSize} / 2))`
38
+ }
39
+ };
40
+ return {
41
+ breadcrumb: {
42
+ label: 'breadcrumb',
43
+ fontFamily: componentTheme.fontFamily,
44
+ margin: 0,
45
+ padding: 0,
46
+ listStyleType: 'none',
47
+ overflow: 'visible',
48
+ display: 'flex',
49
+ alignItems: 'center'
50
+ },
51
+ crumb: {
52
+ label: 'breadcrumb__crumb',
53
+ boxSizing: 'border-box',
54
+ position: 'relative',
55
+ ...crumbSizeVariants[size],
56
+ '&:last-child': {
57
+ paddingInlineEnd: 0
58
+ }
59
+ },
60
+ separator: {
61
+ label: 'breadcrumb__separator',
62
+ boxSizing: 'border-box',
63
+ position: 'absolute',
64
+ top: '50%',
65
+ color: componentTheme.separatorColor,
66
+ ...separatorSizeVariants[size]
67
+ }
68
+ };
105
69
  };
106
- export default generateStyle;
70
+ export default generateStyle;