@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,133 @@
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
+
26
+ import { isValidElement, Children, Component } from 'react';
27
+ import { View } from '@instructure/ui-view/latest';
28
+ import { safeCloneElement } from '@instructure/ui-react-utils';
29
+ import { withStyleNew } from '@instructure/emotion';
30
+ import { ChevronRightInstUIIcon } from '@instructure/ui-icons';
31
+ import { BreadcrumbLink } from './BreadcrumbLink/index.js';
32
+ import generateStyle from './styles.js';
33
+ import { allowedProps } from './props.js';
34
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
35
+ /**
36
+ ---
37
+ category: components
38
+ ---
39
+ **/
40
+ let Breadcrumb = (_dec = withStyleNew(generateStyle), _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 = safeCloneElement(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
+ size
70
+ } = this.props;
71
+ const numChildren = Children.count(children);
72
+ const inlineStyle = {
73
+ maxWidth: `${Math.floor(100 / numChildren)}%`
74
+ };
75
+ let isAriaCurrentSet = false;
76
+ return Children.map(children, (child, index) => {
77
+ const isLastElement = index === numChildren - 1;
78
+ if (/*#__PURE__*/isValidElement(child)) {
79
+ const isCurrentPage = child.props.isCurrentPage || false;
80
+ if (isAriaCurrentSet && isCurrentPage) {}
81
+ if (isCurrentPage) {
82
+ isAriaCurrentSet = true;
83
+ }
84
+ }
85
+
86
+ // Clone child (BreadcrumbLink) and pass size prop
87
+ const childWithSize = /*#__PURE__*/isValidElement(child) ? safeCloneElement(child, {
88
+ size
89
+ }) : child;
90
+
91
+ // Map Breadcrumb sizes to icon size tokens
92
+ const breadcrumbSizeToIconSize = {
93
+ small: 'sm',
94
+ medium: 'md',
95
+ large: 'lg'
96
+ };
97
+ const iconSize = breadcrumbSizeToIconSize[size || 'small'];
98
+ return _jsxs(_Fragment, {
99
+ children: [_jsx("li", {
100
+ css: styles?.crumb,
101
+ style: inlineStyle,
102
+ children: !isAriaCurrentSet && isLastElement && child.props.isCurrentPage !== false ? this.addAriaCurrent(childWithSize) : childWithSize
103
+ }), index < numChildren - 1 && _jsx("li", {
104
+ "aria-hidden": "true",
105
+ css: styles?.separator,
106
+ children: _jsx(ChevronRightInstUIIcon, {
107
+ size: iconSize,
108
+ color: 'mutedColor'
109
+ })
110
+ })]
111
+ });
112
+ });
113
+ }
114
+ render() {
115
+ const {
116
+ styles
117
+ } = this.props;
118
+ return _jsx(View, {
119
+ role: "navigation",
120
+ as: "div",
121
+ margin: this.props.margin,
122
+ "aria-label": this.props.label,
123
+ elementRef: this.handleRef,
124
+ "data-cid": "Breadcrumb",
125
+ children: _jsx("ol", {
126
+ css: styles?.breadcrumb,
127
+ children: this.renderChildren()
128
+ })
129
+ });
130
+ }
131
+ }) || _class);
132
+ export default Breadcrumb;
133
+ export { Breadcrumb, BreadcrumbLink };
@@ -0,0 +1,26 @@
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 };
@@ -0,0 +1,77 @@
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
+ * @return {Object} The final style object, which will be used in the component
33
+ */
34
+ const generateStyle = (componentTheme, props) => {
35
+ const {
36
+ size
37
+ } = props;
38
+ const gapSizeVariants = {
39
+ small: componentTheme.gapSm,
40
+ medium: componentTheme.gapMd,
41
+ large: componentTheme.gapLg
42
+ };
43
+ return {
44
+ breadcrumb: {
45
+ label: 'breadcrumb',
46
+ margin: 0,
47
+ padding: 0,
48
+ listStyleType: 'none',
49
+ overflow: 'visible',
50
+ display: 'flex',
51
+ alignItems: 'center',
52
+ gap: gapSizeVariants[size]
53
+ },
54
+ crumb: {
55
+ label: 'breadcrumb__crumb',
56
+ boxSizing: 'border-box',
57
+ display: 'flex',
58
+ alignItems: 'center',
59
+ // prevent text clipping
60
+ '[data-cid~="TruncateText"]': {
61
+ overflow: 'visible',
62
+ // prevent extra spacing after the '...'
63
+ '& [class*="truncateText__spacer"]': {
64
+ display: 'inline'
65
+ }
66
+ }
67
+ },
68
+ separator: {
69
+ label: 'breadcrumb__separator',
70
+ boxSizing: 'border-box',
71
+ display: 'inline-flex',
72
+ alignItems: 'center',
73
+ flexShrink: 0
74
+ }
75
+ };
76
+ };
77
+ export default generateStyle;
@@ -0,0 +1,24 @@
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
+ export { Breadcrumb, BreadcrumbLink } from '../Breadcrumb/v1/index.js';
@@ -0,0 +1,24 @@
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
+ export { Breadcrumb, BreadcrumbLink } from '../Breadcrumb/v2/index.js';
@@ -0,0 +1,125 @@
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 _v11_ = require("@instructure/ui-truncate-text/v11_6");
9
+ var _v11_2 = require("@instructure/ui-link/v11_6");
10
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
+ var _v11_3 = require("@instructure/ui-tooltip/v11_6");
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
+ } = this.props;
77
+ const {
78
+ isTruncated
79
+ } = this.state;
80
+ const props = (0, _omitProps.omitProps)(this.props, BreadcrumbLink.allowedProps);
81
+ const isInteractive = onClick || href;
82
+ return (0, _jsxRuntime.jsx)(_v11_3.Tooltip, {
83
+ renderTip: children,
84
+ preventTooltip: !isTruncated
85
+ // this wraps the achor/button tag in a span and puts the aria-describedby on that instead of the anchor/button tag
86
+ // to avoid SRs reading the text twice when there is already an aria-label
87
+ ,
88
+ ...(isInteractive && {
89
+ as: 'span'
90
+ }),
91
+ children: (0, _jsxRuntime.jsx)(_v11_2.Link, {
92
+ ...props,
93
+ href: href,
94
+ renderIcon: renderIcon,
95
+ iconPlacement: iconPlacement,
96
+ onClick: onClick,
97
+ onMouseEnter: onMouseEnter,
98
+ isWithinText: false,
99
+ elementRef: this.handleRef,
100
+ forceButtonRole: false,
101
+ ...(isCurrentPage && {
102
+ 'aria-current': 'page'
103
+ }),
104
+ ...(isTruncated && {
105
+ ...(typeof children === 'string' && {
106
+ 'aria-label': children
107
+ }),
108
+ ...(!isInteractive && {
109
+ role: 'text'
110
+ })
111
+ }),
112
+ "data-cid": "BreadcrumbLink",
113
+ children: (0, _jsxRuntime.jsx)(_v11_.TruncateText, {
114
+ onUpdate: isTruncated => this.handleTruncation(isTruncated),
115
+ children: (0, _jsxRuntime.jsx)("span", {
116
+ "aria-hidden": isTruncated,
117
+ children: children
118
+ })
119
+ })
120
+ })
121
+ });
122
+ }
123
+ }
124
+ exports.BreadcrumbLink = BreadcrumbLink;
125
+ 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,125 @@
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 _v11_ = require("@instructure/ui-view/v11_6");
17
+ var _emotion = require("@instructure/emotion");
18
+ var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenEndSolid.js");
19
+ var _index = require("./BreadcrumbLink/index.js");
20
+ var _styles = _interopRequireDefault(require("./styles.js"));
21
+ var _theme = _interopRequireDefault(require("./theme.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.withStyle)(_styles.default, _theme.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 = /*#__PURE__*/(0, _react.cloneElement)(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
+ } = this.props;
83
+ const numChildren = _react.Children.count(children);
84
+ const inlineStyle = {
85
+ maxWidth: `${Math.floor(100 / numChildren)}%`
86
+ };
87
+ let isAriaCurrentSet = false;
88
+ return _react.Children.map(children, (child, index) => {
89
+ const isLastElement = index === numChildren - 1;
90
+ if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
91
+ const isCurrentPage = child.props.isCurrentPage || false;
92
+ if (isAriaCurrentSet && isCurrentPage) {}
93
+ if (isCurrentPage) {
94
+ isAriaCurrentSet = true;
95
+ }
96
+ }
97
+ return (0, _jsxRuntime.jsxs)("li", {
98
+ css: styles?.crumb,
99
+ style: inlineStyle,
100
+ children: [!isAriaCurrentSet && isLastElement && child.props.isCurrentPage !== false ? this.addAriaCurrent(child) : child, index < numChildren - 1 && (0, _jsxRuntime.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {
101
+ color: "auto",
102
+ css: styles?.separator
103
+ })]
104
+ });
105
+ });
106
+ }
107
+ render() {
108
+ const {
109
+ styles
110
+ } = this.props;
111
+ return (0, _jsxRuntime.jsx)(_v11_.View, {
112
+ role: "navigation",
113
+ as: "div",
114
+ margin: this.props.margin,
115
+ "aria-label": this.props.label,
116
+ elementRef: this.handleRef,
117
+ "data-cid": "Breadcrumb",
118
+ children: (0, _jsxRuntime.jsx)("ol", {
119
+ css: styles?.breadcrumb,
120
+ children: this.renderChildren()
121
+ })
122
+ });
123
+ }
124
+ }) || _class);
125
+ 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'];