@ohos-ports/instructure-ui-breadcrumb 11.7.5-beta.0

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 (76) hide show
  1. package/CHANGELOG.md +1330 -0
  2. package/LICENSE.md +28 -0
  3. package/README.md +46 -0
  4. package/es/Breadcrumb/v1/BreadcrumbLink/index.js +119 -0
  5. package/es/Breadcrumb/v1/BreadcrumbLink/props.js +26 -0
  6. package/es/Breadcrumb/v1/index.js +113 -0
  7. package/es/Breadcrumb/v1/props.js +26 -0
  8. package/es/Breadcrumb/v1/styles.js +106 -0
  9. package/es/Breadcrumb/v1/theme.js +49 -0
  10. package/es/Breadcrumb/v2/BreadcrumbLink/index.js +121 -0
  11. package/es/Breadcrumb/v2/BreadcrumbLink/props.js +26 -0
  12. package/es/Breadcrumb/v2/index.js +133 -0
  13. package/es/Breadcrumb/v2/props.js +26 -0
  14. package/es/Breadcrumb/v2/styles.js +77 -0
  15. package/es/exports/a.js +24 -0
  16. package/es/exports/b.js +24 -0
  17. package/lib/Breadcrumb/v1/BreadcrumbLink/index.js +125 -0
  18. package/lib/Breadcrumb/v1/BreadcrumbLink/props.js +31 -0
  19. package/lib/Breadcrumb/v1/index.js +125 -0
  20. package/lib/Breadcrumb/v1/props.js +31 -0
  21. package/lib/Breadcrumb/v1/styles.js +112 -0
  22. package/lib/Breadcrumb/v1/theme.js +55 -0
  23. package/lib/Breadcrumb/v2/BreadcrumbLink/index.js +127 -0
  24. package/lib/Breadcrumb/v2/BreadcrumbLink/props.js +31 -0
  25. package/lib/Breadcrumb/v2/index.js +145 -0
  26. package/lib/Breadcrumb/v2/props.js +31 -0
  27. package/lib/Breadcrumb/v2/styles.js +83 -0
  28. package/lib/exports/a.js +18 -0
  29. package/lib/exports/b.js +18 -0
  30. package/lib/package.json +1 -0
  31. package/package.json +90 -0
  32. package/scripts/fix-instructure-exports.js +137 -0
  33. package/src/Breadcrumb/v1/BreadcrumbLink/index.tsx +122 -0
  34. package/src/Breadcrumb/v1/BreadcrumbLink/props.ts +102 -0
  35. package/src/Breadcrumb/v1/README.md +141 -0
  36. package/src/Breadcrumb/v1/index.tsx +143 -0
  37. package/src/Breadcrumb/v1/props.ts +63 -0
  38. package/src/Breadcrumb/v1/styles.ts +116 -0
  39. package/src/Breadcrumb/v1/theme.ts +55 -0
  40. package/src/Breadcrumb/v2/BreadcrumbLink/index.tsx +123 -0
  41. package/src/Breadcrumb/v2/BreadcrumbLink/props.ts +101 -0
  42. package/src/Breadcrumb/v2/README.md +141 -0
  43. package/src/Breadcrumb/v2/index.tsx +157 -0
  44. package/src/Breadcrumb/v2/props.ts +64 -0
  45. package/src/Breadcrumb/v2/styles.ts +86 -0
  46. package/src/exports/a.ts +27 -0
  47. package/src/exports/b.ts +27 -0
  48. package/tsconfig.build.json +24 -0
  49. package/tsconfig.build.tsbuildinfo +1 -0
  50. package/tsconfig.json +4 -0
  51. package/types/Breadcrumb/v1/BreadcrumbLink/index.d.ts +31 -0
  52. package/types/Breadcrumb/v1/BreadcrumbLink/index.d.ts.map +1 -0
  53. package/types/Breadcrumb/v1/BreadcrumbLink/props.d.ts +49 -0
  54. package/types/Breadcrumb/v1/BreadcrumbLink/props.d.ts.map +1 -0
  55. package/types/Breadcrumb/v1/index.d.ts +35 -0
  56. package/types/Breadcrumb/v1/index.d.ts.map +1 -0
  57. package/types/Breadcrumb/v1/props.d.ts +30 -0
  58. package/types/Breadcrumb/v1/props.d.ts.map +1 -0
  59. package/types/Breadcrumb/v1/styles.d.ts +15 -0
  60. package/types/Breadcrumb/v1/styles.d.ts.map +1 -0
  61. package/types/Breadcrumb/v1/theme.d.ts +10 -0
  62. package/types/Breadcrumb/v1/theme.d.ts.map +1 -0
  63. package/types/Breadcrumb/v2/BreadcrumbLink/index.d.ts +31 -0
  64. package/types/Breadcrumb/v2/BreadcrumbLink/index.d.ts.map +1 -0
  65. package/types/Breadcrumb/v2/BreadcrumbLink/props.d.ts +49 -0
  66. package/types/Breadcrumb/v2/BreadcrumbLink/props.d.ts.map +1 -0
  67. package/types/Breadcrumb/v2/index.d.ts +35 -0
  68. package/types/Breadcrumb/v2/index.d.ts.map +1 -0
  69. package/types/Breadcrumb/v2/props.d.ts +30 -0
  70. package/types/Breadcrumb/v2/props.d.ts.map +1 -0
  71. package/types/Breadcrumb/v2/styles.d.ts +14 -0
  72. package/types/Breadcrumb/v2/styles.d.ts.map +1 -0
  73. package/types/exports/a.d.ts +4 -0
  74. package/types/exports/a.d.ts.map +1 -0
  75. package/types/exports/b.d.ts +4 -0
  76. package/types/exports/b.d.ts.map +1 -0
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} props the props of the component, the style is applied to
38
+ * @param {Object} state the state of the component, the style is applied to
39
+ * @return {Object} The final style object, which will be used in the component
40
+ */
41
+ const generateStyle = (componentTheme, props) => {
42
+ const {
43
+ size
44
+ } = props;
45
+ const crumbSizeVariants = {
46
+ small: {
47
+ fontSize: componentTheme.smallFontSize,
48
+ paddingInlineEnd: `calc(${componentTheme.smallSeparatorFontSize} * 2)`,
49
+ paddingInlineStart: 0
50
+ },
51
+ medium: {
52
+ fontSize: componentTheme.mediumFontSize,
53
+ paddingInlineEnd: `calc(${componentTheme.mediumSeparatorFontSize} * 2)`,
54
+ paddingInlineStart: 0
55
+ },
56
+ large: {
57
+ fontSize: componentTheme.largeFontSize,
58
+ paddingInlineEnd: `calc(${componentTheme.largeSeparatorFontSize} * 2)`,
59
+ paddingInlineStart: 0
60
+ }
61
+ };
62
+ const separatorSizeVariants = {
63
+ small: {
64
+ fontSize: componentTheme.smallSeparatorFontSize,
65
+ insetInlineEnd: `calc(${componentTheme.smallSeparatorFontSize} / 2)`,
66
+ insetInlineStart: 'auto',
67
+ marginTop: `calc(-1 * (${componentTheme.smallSeparatorFontSize} / 2))`
68
+ },
69
+ medium: {
70
+ fontSize: componentTheme.mediumSeparatorFontSize,
71
+ insetInlineEnd: `calc(${componentTheme.mediumSeparatorFontSize} / 2)`,
72
+ insetInlineStart: 'auto',
73
+ marginTop: `calc(-1 * (${componentTheme.mediumSeparatorFontSize} / 2))`
74
+ },
75
+ large: {
76
+ fontSize: componentTheme.largeSeparatorFontSize,
77
+ insetInlineEnd: `calc(${componentTheme.largeSeparatorFontSize} / 2)`,
78
+ insetInlineStart: 'auto',
79
+ marginTop: `calc(-1 * (${componentTheme.largeSeparatorFontSize} / 2))`
80
+ }
81
+ };
82
+ return {
83
+ breadcrumb: {
84
+ label: 'breadcrumb',
85
+ fontFamily: componentTheme.fontFamily,
86
+ margin: 0,
87
+ padding: 0,
88
+ listStyleType: 'none',
89
+ overflow: 'visible',
90
+ display: 'flex',
91
+ alignItems: 'center'
92
+ },
93
+ crumb: {
94
+ label: 'breadcrumb__crumb',
95
+ boxSizing: 'border-box',
96
+ position: 'relative',
97
+ ...crumbSizeVariants[size],
98
+ '&:last-child': {
99
+ paddingInlineEnd: 0
100
+ }
101
+ },
102
+ separator: {
103
+ label: 'breadcrumb__separator',
104
+ boxSizing: 'border-box',
105
+ position: 'absolute',
106
+ top: '50%',
107
+ color: componentTheme.separatorColor,
108
+ ...separatorSizeVariants[size]
109
+ }
110
+ };
111
+ };
112
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * Generates the theme object for the component from the theme and provided additional information
33
+ * @param {Object} theme The actual theme object.
34
+ * @return {Object} The final theme object with the overrides and component variables
35
+ */
36
+ const generateComponentTheme = theme => {
37
+ const {
38
+ colors,
39
+ typography
40
+ } = theme;
41
+ const componentVariables = {
42
+ fontFamily: typography?.fontFamily,
43
+ separatorColor: colors?.contrasts?.grey4570,
44
+ smallSeparatorFontSize: '0.5rem',
45
+ smallFontSize: typography?.fontSizeSmall,
46
+ mediumSeparatorFontSize: '0.75rem',
47
+ mediumFontSize: typography?.fontSizeMedium,
48
+ largeSeparatorFontSize: '1rem',
49
+ largeFontSize: typography?.fontSizeLarge
50
+ };
51
+ return {
52
+ ...componentVariables
53
+ };
54
+ };
55
+ var _default = exports.default = generateComponentTheme;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.BreadcrumbLink = void 0;
7
+ var _react = require("react");
8
+ var _latest = require("@instructure/ui-truncate-text/latest");
9
+ var _latest2 = require("@instructure/ui-link/latest");
10
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
+ var _latest3 = require("@instructure/ui-tooltip/latest");
12
+ var _props = require("./props.js");
13
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
14
+ /*
15
+ * The MIT License (MIT)
16
+ *
17
+ * Copyright (c) 2015 - present Instructure, Inc.
18
+ *
19
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ * of this software and associated documentation files (the "Software"), to deal
21
+ * in the Software without restriction, including without limitation the rights
22
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ * copies of the Software, and to permit persons to whom the Software is
24
+ * furnished to do so, subject to the following conditions:
25
+ *
26
+ * The above copyright notice and this permission notice shall be included in all
27
+ * copies or substantial portions of the Software.
28
+ *
29
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ * SOFTWARE.
36
+ */
37
+
38
+ /**
39
+ ---
40
+ parent: Breadcrumb
41
+ id: Breadcrumb.Link
42
+ ---
43
+ **/
44
+
45
+ class BreadcrumbLink extends _react.Component {
46
+ static displayName = 'BreadcrumbLink';
47
+ static componentId = 'Breadcrumb.Link';
48
+ static allowedProps = _props.allowedProps;
49
+ static defaultProps = {};
50
+ ref = null;
51
+ handleRef = el => {
52
+ this.ref = el;
53
+ };
54
+ constructor(props) {
55
+ super(props);
56
+ this.state = {
57
+ isTruncated: false
58
+ };
59
+ }
60
+ handleTruncation(isTruncated) {
61
+ if (isTruncated !== this.state.isTruncated) {
62
+ this.setState({
63
+ isTruncated
64
+ });
65
+ }
66
+ }
67
+ render() {
68
+ const {
69
+ children,
70
+ href,
71
+ renderIcon,
72
+ iconPlacement,
73
+ onClick,
74
+ onMouseEnter,
75
+ isCurrentPage,
76
+ size
77
+ } = this.props;
78
+ const {
79
+ isTruncated
80
+ } = this.state;
81
+ const props = (0, _omitProps.omitProps)(this.props, BreadcrumbLink.allowedProps);
82
+ const isInteractive = onClick || href;
83
+ return (0, _jsxRuntime.jsx)(_latest3.Tooltip, {
84
+ renderTip: children,
85
+ preventTooltip: !isTruncated
86
+ // this wraps the achor/button tag in a span and puts the aria-describedby on that instead of the anchor/button tag
87
+ // to avoid SRs reading the text twice when there is already an aria-label
88
+ ,
89
+ ...(isInteractive && {
90
+ as: 'span'
91
+ }),
92
+ children: (0, _jsxRuntime.jsx)(_latest2.Link, {
93
+ ...props,
94
+ href: href,
95
+ renderIcon: renderIcon,
96
+ iconPlacement: iconPlacement,
97
+ onClick: onClick,
98
+ onMouseEnter: onMouseEnter,
99
+ variant: "standalone",
100
+ elementRef: this.handleRef,
101
+ forceButtonRole: false,
102
+ size: size,
103
+ ...(isCurrentPage && {
104
+ 'aria-current': 'page'
105
+ }),
106
+ ...(isTruncated && {
107
+ ...(typeof children === 'string' && {
108
+ 'aria-label': children
109
+ }),
110
+ ...(!isInteractive && {
111
+ role: 'text'
112
+ })
113
+ }),
114
+ "data-cid": "BreadcrumbLink",
115
+ children: (0, _jsxRuntime.jsx)(_latest.TruncateText, {
116
+ onUpdate: isTruncated => this.handleTruncation(isTruncated),
117
+ children: (0, _jsxRuntime.jsx)("span", {
118
+ "aria-hidden": isTruncated,
119
+ children: children
120
+ })
121
+ })
122
+ })
123
+ });
124
+ }
125
+ }
126
+ exports.BreadcrumbLink = BreadcrumbLink;
127
+ var _default = exports.default = BreadcrumbLink;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['children', 'href', 'iconPlacement', 'onClick', 'onMouseEnter', 'renderIcon', 'size', 'isCurrentPage'];
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.Breadcrumb = void 0;
8
+ Object.defineProperty(exports, "BreadcrumbLink", {
9
+ enumerable: true,
10
+ get: function () {
11
+ return _index.BreadcrumbLink;
12
+ }
13
+ });
14
+ exports.default = void 0;
15
+ var _react = require("react");
16
+ var _latest = require("@instructure/ui-view/latest");
17
+ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
18
+ var _emotion = require("@instructure/emotion");
19
+ var _uiIcons = require("@instructure/ui-icons");
20
+ var _index = require("./BreadcrumbLink/index.js");
21
+ var _styles = _interopRequireDefault(require("./styles.js"));
22
+ var _props = require("./props.js");
23
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
24
+ var _dec, _class;
25
+ /*
26
+ * The MIT License (MIT)
27
+ *
28
+ * Copyright (c) 2015 - present Instructure, Inc.
29
+ *
30
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
31
+ * of this software and associated documentation files (the "Software"), to deal
32
+ * in the Software without restriction, including without limitation the rights
33
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34
+ * copies of the Software, and to permit persons to whom the Software is
35
+ * furnished to do so, subject to the following conditions:
36
+ *
37
+ * The above copyright notice and this permission notice shall be included in all
38
+ * copies or substantial portions of the Software.
39
+ *
40
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46
+ * SOFTWARE.
47
+ */
48
+ /**
49
+ ---
50
+ category: components
51
+ ---
52
+ **/
53
+ let Breadcrumb = exports.Breadcrumb = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = class Breadcrumb extends _react.Component {
54
+ static displayName = 'Breadcrumb';
55
+ static componentId = 'Breadcrumb';
56
+ static allowedProps = _props.allowedProps;
57
+ static defaultProps = {
58
+ size: 'medium',
59
+ children: null
60
+ };
61
+ ref = null;
62
+ handleRef = el => {
63
+ this.ref = el;
64
+ };
65
+ addAriaCurrent = child => {
66
+ const updatedChild = (0, _safeCloneElement.safeCloneElement)(child, {
67
+ 'aria-current': 'page'
68
+ });
69
+ return updatedChild;
70
+ };
71
+ componentDidMount() {
72
+ this.props.makeStyles?.();
73
+ }
74
+ componentDidUpdate() {
75
+ this.props.makeStyles?.();
76
+ }
77
+ static Link = _index.BreadcrumbLink;
78
+ renderChildren() {
79
+ const {
80
+ styles,
81
+ children,
82
+ size
83
+ } = this.props;
84
+ const numChildren = _react.Children.count(children);
85
+ const inlineStyle = {
86
+ maxWidth: `${Math.floor(100 / numChildren)}%`
87
+ };
88
+ let isAriaCurrentSet = false;
89
+ return _react.Children.map(children, (child, index) => {
90
+ const isLastElement = index === numChildren - 1;
91
+ if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
92
+ const isCurrentPage = child.props.isCurrentPage || false;
93
+ if (isAriaCurrentSet && isCurrentPage) {}
94
+ if (isCurrentPage) {
95
+ isAriaCurrentSet = true;
96
+ }
97
+ }
98
+
99
+ // Clone child (BreadcrumbLink) and pass size prop
100
+ const childWithSize = /*#__PURE__*/(0, _react.isValidElement)(child) ? (0, _safeCloneElement.safeCloneElement)(child, {
101
+ size
102
+ }) : child;
103
+
104
+ // Map Breadcrumb sizes to icon size tokens
105
+ const breadcrumbSizeToIconSize = {
106
+ small: 'sm',
107
+ medium: 'md',
108
+ large: 'lg'
109
+ };
110
+ const iconSize = breadcrumbSizeToIconSize[size || 'small'];
111
+ return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
112
+ children: [(0, _jsxRuntime.jsx)("li", {
113
+ css: styles?.crumb,
114
+ style: inlineStyle,
115
+ children: !isAriaCurrentSet && isLastElement && child.props.isCurrentPage !== false ? this.addAriaCurrent(childWithSize) : childWithSize
116
+ }), index < numChildren - 1 && (0, _jsxRuntime.jsx)("li", {
117
+ "aria-hidden": "true",
118
+ css: styles?.separator,
119
+ children: (0, _jsxRuntime.jsx)(_uiIcons.ChevronRightInstUIIcon, {
120
+ size: iconSize,
121
+ color: 'mutedColor'
122
+ })
123
+ })]
124
+ });
125
+ });
126
+ }
127
+ render() {
128
+ const {
129
+ styles
130
+ } = this.props;
131
+ return (0, _jsxRuntime.jsx)(_latest.View, {
132
+ role: "navigation",
133
+ as: "div",
134
+ margin: this.props.margin,
135
+ "aria-label": this.props.label,
136
+ elementRef: this.handleRef,
137
+ "data-cid": "Breadcrumb",
138
+ children: (0, _jsxRuntime.jsx)("ol", {
139
+ css: styles?.breadcrumb,
140
+ children: this.renderChildren()
141
+ })
142
+ });
143
+ }
144
+ }) || _class);
145
+ var _default = exports.default = Breadcrumb;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['children', 'label', 'margin', 'size'];
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} props the props of the component, the style is applied to
38
+ * @return {Object} The final style object, which will be used in the component
39
+ */
40
+ const generateStyle = (componentTheme, props) => {
41
+ const {
42
+ size
43
+ } = props;
44
+ const gapSizeVariants = {
45
+ small: componentTheme.gapSm,
46
+ medium: componentTheme.gapMd,
47
+ large: componentTheme.gapLg
48
+ };
49
+ return {
50
+ breadcrumb: {
51
+ label: 'breadcrumb',
52
+ margin: 0,
53
+ padding: 0,
54
+ listStyleType: 'none',
55
+ overflow: 'visible',
56
+ display: 'flex',
57
+ alignItems: 'center',
58
+ gap: gapSizeVariants[size]
59
+ },
60
+ crumb: {
61
+ label: 'breadcrumb__crumb',
62
+ boxSizing: 'border-box',
63
+ display: 'flex',
64
+ alignItems: 'center',
65
+ // prevent text clipping
66
+ '[data-cid~="TruncateText"]': {
67
+ overflow: 'visible',
68
+ // prevent extra spacing after the '...'
69
+ '& [class*="truncateText__spacer"]': {
70
+ display: 'inline'
71
+ }
72
+ }
73
+ },
74
+ separator: {
75
+ label: 'breadcrumb__separator',
76
+ boxSizing: 'border-box',
77
+ display: 'inline-flex',
78
+ alignItems: 'center',
79
+ flexShrink: 0
80
+ }
81
+ };
82
+ };
83
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Breadcrumb", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _index.Breadcrumb;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "BreadcrumbLink", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _index.BreadcrumbLink;
16
+ }
17
+ });
18
+ var _index = require("../Breadcrumb/v1/index.js");
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Breadcrumb", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _index.Breadcrumb;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "BreadcrumbLink", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _index.BreadcrumbLink;
16
+ }
17
+ });
18
+ var _index = require("../Breadcrumb/v2/index.js");
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}