@instructure/ui-breadcrumb 11.6.0 → 11.6.1-snapshot-129

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 (78) hide show
  1. package/CHANGELOG.md +38 -287
  2. package/es/Breadcrumb/{BreadcrumbLink → v1/BreadcrumbLink}/index.js +3 -3
  3. package/es/Breadcrumb/{index.js → v1/index.js} +2 -2
  4. package/es/Breadcrumb/v2/BreadcrumbLink/index.js +118 -0
  5. package/{src/index.ts → es/Breadcrumb/v2/BreadcrumbLink/props.js} +2 -3
  6. package/es/Breadcrumb/v2/index.js +130 -0
  7. package/es/Breadcrumb/v2/props.js +26 -0
  8. package/es/Breadcrumb/v2/styles.js +75 -0
  9. package/es/{index.js → exports/a.js} +1 -1
  10. package/es/exports/b.js +24 -0
  11. package/lib/Breadcrumb/{BreadcrumbLink → v1/BreadcrumbLink}/index.js +6 -6
  12. package/lib/Breadcrumb/{index.js → v1/index.js} +4 -4
  13. package/lib/Breadcrumb/v2/BreadcrumbLink/index.js +124 -0
  14. package/lib/Breadcrumb/v2/BreadcrumbLink/props.js +31 -0
  15. package/lib/Breadcrumb/v2/index.js +142 -0
  16. package/lib/Breadcrumb/v2/props.js +31 -0
  17. package/lib/Breadcrumb/v2/styles.js +81 -0
  18. package/lib/{index.js → exports/a.js} +3 -3
  19. package/lib/exports/b.js +18 -0
  20. package/package.json +43 -21
  21. package/src/Breadcrumb/{BreadcrumbLink → v1/BreadcrumbLink}/index.tsx +3 -3
  22. package/src/Breadcrumb/{BreadcrumbLink → v1/BreadcrumbLink}/props.ts +2 -2
  23. package/src/Breadcrumb/{index.tsx → v1/index.tsx} +2 -2
  24. package/src/Breadcrumb/v2/BreadcrumbLink/index.tsx +122 -0
  25. package/src/Breadcrumb/v2/BreadcrumbLink/props.ts +101 -0
  26. package/src/Breadcrumb/v2/README.md +141 -0
  27. package/src/Breadcrumb/v2/index.tsx +156 -0
  28. package/src/Breadcrumb/v2/props.ts +64 -0
  29. package/src/Breadcrumb/v2/styles.ts +86 -0
  30. package/src/exports/a.ts +27 -0
  31. package/src/exports/b.ts +27 -0
  32. package/tsconfig.build.tsbuildinfo +1 -1
  33. package/types/Breadcrumb/{BreadcrumbLink → v1/BreadcrumbLink}/index.d.ts +2 -2
  34. package/types/Breadcrumb/v1/BreadcrumbLink/index.d.ts.map +1 -0
  35. package/types/Breadcrumb/{BreadcrumbLink → v1/BreadcrumbLink}/props.d.ts +2 -2
  36. package/types/Breadcrumb/v1/BreadcrumbLink/props.d.ts.map +1 -0
  37. package/types/Breadcrumb/v1/index.d.ts.map +1 -0
  38. package/types/Breadcrumb/v1/props.d.ts.map +1 -0
  39. package/types/Breadcrumb/v1/styles.d.ts.map +1 -0
  40. package/types/Breadcrumb/v1/theme.d.ts.map +1 -0
  41. package/types/Breadcrumb/v2/BreadcrumbLink/index.d.ts +30 -0
  42. package/types/Breadcrumb/v2/BreadcrumbLink/index.d.ts.map +1 -0
  43. package/types/Breadcrumb/v2/BreadcrumbLink/props.d.ts +49 -0
  44. package/types/Breadcrumb/v2/BreadcrumbLink/props.d.ts.map +1 -0
  45. package/types/Breadcrumb/v2/index.d.ts +34 -0
  46. package/types/Breadcrumb/v2/index.d.ts.map +1 -0
  47. package/types/Breadcrumb/v2/props.d.ts +30 -0
  48. package/types/Breadcrumb/v2/props.d.ts.map +1 -0
  49. package/types/Breadcrumb/v2/styles.d.ts +14 -0
  50. package/types/Breadcrumb/v2/styles.d.ts.map +1 -0
  51. package/types/exports/a.d.ts +4 -0
  52. package/types/exports/a.d.ts.map +1 -0
  53. package/types/exports/b.d.ts +4 -0
  54. package/types/exports/b.d.ts.map +1 -0
  55. package/types/Breadcrumb/BreadcrumbLink/index.d.ts.map +0 -1
  56. package/types/Breadcrumb/BreadcrumbLink/props.d.ts.map +0 -1
  57. package/types/Breadcrumb/index.d.ts.map +0 -1
  58. package/types/Breadcrumb/props.d.ts.map +0 -1
  59. package/types/Breadcrumb/styles.d.ts.map +0 -1
  60. package/types/Breadcrumb/theme.d.ts.map +0 -1
  61. package/types/index.d.ts +0 -4
  62. package/types/index.d.ts.map +0 -1
  63. /package/es/Breadcrumb/{BreadcrumbLink → v1/BreadcrumbLink}/props.js +0 -0
  64. /package/es/Breadcrumb/{props.js → v1/props.js} +0 -0
  65. /package/es/Breadcrumb/{styles.js → v1/styles.js} +0 -0
  66. /package/es/Breadcrumb/{theme.js → v1/theme.js} +0 -0
  67. /package/lib/Breadcrumb/{BreadcrumbLink → v1/BreadcrumbLink}/props.js +0 -0
  68. /package/lib/Breadcrumb/{props.js → v1/props.js} +0 -0
  69. /package/lib/Breadcrumb/{styles.js → v1/styles.js} +0 -0
  70. /package/lib/Breadcrumb/{theme.js → v1/theme.js} +0 -0
  71. /package/src/Breadcrumb/{README.md → v1/README.md} +0 -0
  72. /package/src/Breadcrumb/{props.ts → v1/props.ts} +0 -0
  73. /package/src/Breadcrumb/{styles.ts → v1/styles.ts} +0 -0
  74. /package/src/Breadcrumb/{theme.ts → v1/theme.ts} +0 -0
  75. /package/types/Breadcrumb/{index.d.ts → v1/index.d.ts} +0 -0
  76. /package/types/Breadcrumb/{props.d.ts → v1/props.d.ts} +0 -0
  77. /package/types/Breadcrumb/{styles.d.ts → v1/styles.d.ts} +0 -0
  78. /package/types/Breadcrumb/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,142 @@
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 _BreadcrumbLink.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 _BreadcrumbLink = require("./BreadcrumbLink");
21
+ var _styles = _interopRequireDefault(require("./styles"));
22
+ var _props = require("./props");
23
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
24
+ var _dec, _class, _Breadcrumb;
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), _dec(_class = (_Breadcrumb = class Breadcrumb extends _react.Component {
54
+ constructor(...args) {
55
+ super(...args);
56
+ this.ref = null;
57
+ this.handleRef = el => {
58
+ this.ref = el;
59
+ };
60
+ this.addAriaCurrent = child => {
61
+ const updatedChild = (0, _safeCloneElement.safeCloneElement)(child, {
62
+ 'aria-current': 'page'
63
+ });
64
+ return updatedChild;
65
+ };
66
+ }
67
+ componentDidMount() {
68
+ var _this$props$makeStyle, _this$props;
69
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
70
+ }
71
+ componentDidUpdate() {
72
+ var _this$props$makeStyle2, _this$props2;
73
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
74
+ }
75
+ renderChildren() {
76
+ const _this$props3 = this.props,
77
+ styles = _this$props3.styles,
78
+ children = _this$props3.children,
79
+ size = _this$props3.size;
80
+ const numChildren = _react.Children.count(children);
81
+ const inlineStyle = {
82
+ maxWidth: `${Math.floor(100 / numChildren)}%`
83
+ };
84
+ let isAriaCurrentSet = false;
85
+ return _react.Children.map(children, (child, index) => {
86
+ const isLastElement = index === numChildren - 1;
87
+ if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
88
+ const isCurrentPage = child.props.isCurrentPage || false;
89
+ if (isAriaCurrentSet && isCurrentPage) {}
90
+ if (isCurrentPage) {
91
+ isAriaCurrentSet = true;
92
+ }
93
+ }
94
+
95
+ // Clone child (BreadcrumbLink) and pass size prop
96
+ const childWithSize = /*#__PURE__*/(0, _react.isValidElement)(child) ? (0, _safeCloneElement.safeCloneElement)(child, {
97
+ size
98
+ }) : child;
99
+
100
+ // Map Breadcrumb sizes to icon size tokens
101
+ const breadcrumbSizeToIconSize = {
102
+ small: 'sm',
103
+ medium: 'md',
104
+ large: 'lg'
105
+ };
106
+ const iconSize = breadcrumbSizeToIconSize[size || 'small'];
107
+ return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
108
+ children: [(0, _jsxRuntime.jsx)("li", {
109
+ css: styles === null || styles === void 0 ? void 0 : styles.crumb,
110
+ style: inlineStyle,
111
+ children: !isAriaCurrentSet && isLastElement && child.props.isCurrentPage !== false ? this.addAriaCurrent(childWithSize) : childWithSize
112
+ }), index < numChildren - 1 && (0, _jsxRuntime.jsx)("li", {
113
+ "aria-hidden": "true",
114
+ css: styles === null || styles === void 0 ? void 0 : styles.separator,
115
+ children: (0, _jsxRuntime.jsx)(_uiIcons.ChevronRightInstUIIcon, {
116
+ size: iconSize,
117
+ color: 'mutedColor'
118
+ })
119
+ })]
120
+ });
121
+ });
122
+ }
123
+ render() {
124
+ const styles = this.props.styles;
125
+ return (0, _jsxRuntime.jsx)(_latest.View, {
126
+ role: "navigation",
127
+ as: "div",
128
+ margin: this.props.margin,
129
+ "aria-label": this.props.label,
130
+ elementRef: this.handleRef,
131
+ "data-cid": "Breadcrumb",
132
+ children: (0, _jsxRuntime.jsx)("ol", {
133
+ css: styles === null || styles === void 0 ? void 0 : styles.breadcrumb,
134
+ children: this.renderChildren()
135
+ })
136
+ });
137
+ }
138
+ }, _Breadcrumb.displayName = "Breadcrumb", _Breadcrumb.componentId = 'Breadcrumb', _Breadcrumb.allowedProps = _props.allowedProps, _Breadcrumb.defaultProps = {
139
+ size: 'medium',
140
+ children: null
141
+ }, _Breadcrumb.Link = _BreadcrumbLink.BreadcrumbLink, _Breadcrumb)) || _class);
142
+ 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,81 @@
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 size = props.size;
42
+ const gapSizeVariants = {
43
+ small: componentTheme.gapSm,
44
+ medium: componentTheme.gapMd,
45
+ large: componentTheme.gapLg
46
+ };
47
+ return {
48
+ breadcrumb: {
49
+ label: 'breadcrumb',
50
+ margin: 0,
51
+ padding: 0,
52
+ listStyleType: 'none',
53
+ overflow: 'visible',
54
+ display: 'flex',
55
+ alignItems: 'center',
56
+ gap: gapSizeVariants[size]
57
+ },
58
+ crumb: {
59
+ label: 'breadcrumb__crumb',
60
+ boxSizing: 'border-box',
61
+ display: 'flex',
62
+ alignItems: 'center',
63
+ // prevent text clipping
64
+ '[data-cid~="TruncateText"]': {
65
+ overflow: 'visible',
66
+ // prevent extra spacing after the '...'
67
+ '& [class*="truncateText__spacer"]': {
68
+ display: 'inline'
69
+ }
70
+ }
71
+ },
72
+ separator: {
73
+ label: 'breadcrumb__separator',
74
+ boxSizing: 'border-box',
75
+ display: 'inline-flex',
76
+ alignItems: 'center',
77
+ flexShrink: 0
78
+ }
79
+ };
80
+ };
81
+ var _default = exports.default = generateStyle;
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Breadcrumb", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Breadcrumb.Breadcrumb;
9
+ return _v.Breadcrumb;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "BreadcrumbLink", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _Breadcrumb.BreadcrumbLink;
15
+ return _v.BreadcrumbLink;
16
16
  }
17
17
  });
18
- var _Breadcrumb = require("./Breadcrumb");
18
+ var _v = require("../Breadcrumb/v1");
@@ -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 _v.Breadcrumb;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "BreadcrumbLink", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _v.BreadcrumbLink;
16
+ }
17
+ });
18
+ var _v = require("../Breadcrumb/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-breadcrumb",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "A breadcrumb component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,24 +15,24 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/shared-types": "11.6.0",
19
- "@instructure/ui-icons": "11.6.0",
20
- "@instructure/emotion": "11.6.0",
21
- "@instructure/ui-link": "11.6.0",
22
- "@instructure/ui-react-utils": "11.6.0",
23
- "@instructure/ui-tooltip": "11.6.0",
24
- "@instructure/ui-utils": "11.6.0",
25
- "@instructure/ui-truncate-text": "11.6.0",
26
- "@instructure/ui-view": "11.6.0"
18
+ "@instructure/emotion": "11.6.1-snapshot-129",
19
+ "@instructure/shared-types": "11.6.1-snapshot-129",
20
+ "@instructure/ui-icons": "11.6.1-snapshot-129",
21
+ "@instructure/ui-link": "11.6.1-snapshot-129",
22
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
23
+ "@instructure/ui-tooltip": "11.6.1-snapshot-129",
24
+ "@instructure/ui-truncate-text": "11.6.1-snapshot-129",
25
+ "@instructure/ui-utils": "11.6.1-snapshot-129",
26
+ "@instructure/ui-view": "11.6.1-snapshot-129"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@testing-library/jest-dom": "^6.6.3",
30
30
  "@testing-library/react": "15.0.7",
31
31
  "vitest": "^3.2.2",
32
- "@instructure/ui-babel-preset": "11.6.0",
33
- "@instructure/ui-axe-check": "11.6.0",
34
- "@instructure/ui-scripts": "11.6.0",
35
- "@instructure/ui-themes": "11.6.0"
32
+ "@instructure/ui-axe-check": "11.6.1-snapshot-129",
33
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
34
+ "@instructure/ui-scripts": "11.6.1-snapshot-129",
35
+ "@instructure/ui-themes": "11.6.1-snapshot-129"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": ">=18 <=19"
@@ -42,17 +42,39 @@
42
42
  },
43
43
  "sideEffects": false,
44
44
  "exports": {
45
- ".": {
46
- "types": "./types/index.d.ts",
47
- "import": "./es/index.js",
48
- "require": "./lib/index.js",
49
- "default": "./es/index.js"
50
- },
51
45
  "./lib/*": "./lib/*",
52
46
  "./es/*": "./es/*",
53
47
  "./types/*": "./types/*",
54
48
  "./package.json": "./package.json",
55
- "./src/*": "./src/*"
49
+ "./src/*": "./src/*",
50
+ ".": {
51
+ "src": "./src/exports/a.ts",
52
+ "types": "./types/exports/a.d.ts",
53
+ "import": "./es/exports/a.js",
54
+ "require": "./lib/exports/a.js",
55
+ "default": "./es/exports/a.js"
56
+ },
57
+ "./v11_6": {
58
+ "src": "./src/exports/a.ts",
59
+ "types": "./types/exports/a.d.ts",
60
+ "import": "./es/exports/a.js",
61
+ "require": "./lib/exports/a.js",
62
+ "default": "./es/exports/a.js"
63
+ },
64
+ "./v11_7": {
65
+ "src": "./src/exports/b.ts",
66
+ "types": "./types/exports/b.d.ts",
67
+ "import": "./es/exports/b.js",
68
+ "require": "./lib/exports/b.js",
69
+ "default": "./es/exports/b.js"
70
+ },
71
+ "./latest": {
72
+ "src": "./src/exports/b.ts",
73
+ "types": "./types/exports/b.d.ts",
74
+ "import": "./es/exports/b.js",
75
+ "require": "./lib/exports/b.js",
76
+ "default": "./es/exports/b.js"
77
+ }
56
78
  },
57
79
  "scripts": {
58
80
  "lint": "ui-scripts lint",
@@ -24,10 +24,10 @@
24
24
 
25
25
  import { Component } from 'react'
26
26
 
27
- import { TruncateText } from '@instructure/ui-truncate-text'
28
- import { Link } from '@instructure/ui-link'
27
+ import { TruncateText } from '@instructure/ui-truncate-text/v11_6'
28
+ import { Link } from '@instructure/ui-link/v11_6'
29
29
  import { omitProps } from '@instructure/ui-react-utils'
30
- import { Tooltip } from '@instructure/ui-tooltip'
30
+ import { Tooltip } from '@instructure/ui-tooltip/v11_6'
31
31
 
32
32
  import { allowedProps } from './props'
33
33
  import type { BreadcrumbLinkProps, BreadcrumbLinkState } from './props'
@@ -28,8 +28,8 @@ import type {
28
28
  OtherHTMLAttributes,
29
29
  Renderable
30
30
  } from '@instructure/shared-types'
31
- import type { ViewOwnProps } from '@instructure/ui-view'
32
- import type { LinkProps } from '@instructure/ui-link'
31
+ import type { ViewOwnProps } from '@instructure/ui-view/v11_6'
32
+ import type { LinkProps } from '@instructure/ui-link/v11_6'
33
33
 
34
34
  type BreadcrumbLinkOwnProps = {
35
35
  /**
@@ -30,9 +30,9 @@ import {
30
30
  ReactElement
31
31
  } from 'react'
32
32
 
33
- import { View } from '@instructure/ui-view'
33
+ import { View } from '@instructure/ui-view/v11_6'
34
34
 
35
- import { withStyle } from '@instructure/emotion'
35
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
36
36
  import { IconArrowOpenEndSolid } from '@instructure/ui-icons'
37
37
  import { BreadcrumbLink } from './BreadcrumbLink'
38
38
 
@@ -0,0 +1,122 @@
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
+ import { Component } from 'react'
26
+
27
+ import { TruncateText } from '@instructure/ui-truncate-text/latest'
28
+ import { Link } from '@instructure/ui-link/latest'
29
+ import { omitProps } from '@instructure/ui-react-utils'
30
+ import { Tooltip } from '@instructure/ui-tooltip/latest'
31
+
32
+ import { allowedProps } from './props'
33
+ import type { BreadcrumbLinkProps, BreadcrumbLinkState } from './props'
34
+
35
+ /**
36
+ ---
37
+ parent: Breadcrumb
38
+ id: Breadcrumb.Link
39
+ ---
40
+ **/
41
+
42
+ class BreadcrumbLink extends Component<
43
+ BreadcrumbLinkProps,
44
+ BreadcrumbLinkState
45
+ > {
46
+ static readonly componentId = 'Breadcrumb.Link'
47
+
48
+ static allowedProps = allowedProps
49
+ static defaultProps = {}
50
+
51
+ ref: Element | null = null
52
+
53
+ handleRef = (el: Element | null) => {
54
+ this.ref = el
55
+ }
56
+ constructor(props: BreadcrumbLinkProps) {
57
+ super(props)
58
+
59
+ this.state = {
60
+ isTruncated: false
61
+ }
62
+ }
63
+ handleTruncation(isTruncated: boolean) {
64
+ if (isTruncated !== this.state.isTruncated) {
65
+ this.setState({ isTruncated })
66
+ }
67
+ }
68
+
69
+ render() {
70
+ const {
71
+ children,
72
+ href,
73
+ renderIcon,
74
+ iconPlacement,
75
+ onClick,
76
+ onMouseEnter,
77
+ isCurrentPage,
78
+ size
79
+ } = this.props
80
+ const { isTruncated } = this.state
81
+ const props = omitProps(this.props, BreadcrumbLink.allowedProps)
82
+
83
+ const isInteractive = onClick || href
84
+ return (
85
+ <Tooltip
86
+ renderTip={children}
87
+ preventTooltip={!isTruncated}
88
+ // this wraps the achor/button tag in a span and puts the aria-describedby on that instead of the anchor/button tag
89
+ // to avoid SRs reading the text twice when there is already an aria-label
90
+ {...(isInteractive && { as: 'span' })}
91
+ >
92
+ <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 && { 'aria-current': 'page' })}
104
+ {...(isTruncated && {
105
+ ...(typeof children === 'string' && { 'aria-label': children }),
106
+ ...(!isInteractive && { role: 'text' })
107
+ })}
108
+ data-cid="BreadcrumbLink"
109
+ >
110
+ <TruncateText
111
+ onUpdate={(isTruncated) => this.handleTruncation(isTruncated)}
112
+ >
113
+ <span aria-hidden={isTruncated}>{children}</span>
114
+ </TruncateText>
115
+ </Link>
116
+ </Tooltip>
117
+ )
118
+ }
119
+ }
120
+
121
+ export default BreadcrumbLink
122
+ export { BreadcrumbLink }
@@ -0,0 +1,101 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React from 'react'
26
+ import type {
27
+ PickPropsWithExceptions,
28
+ OtherHTMLAttributes,
29
+ Renderable
30
+ } from '@instructure/shared-types'
31
+ import type { ViewOwnProps } from '@instructure/ui-view/latest'
32
+ import type { LinkProps } from '@instructure/ui-link/latest'
33
+
34
+ type BreadcrumbLinkOwnProps = {
35
+ /**
36
+ * Content to render as the crumb, generally should be text.
37
+ */
38
+ children: React.ReactNode
39
+ /**
40
+ * Link the crumb should direct to; if an href is provided, the crumb will render as a link
41
+ */
42
+ href?: string
43
+ /**
44
+ * If the Breadcrumb.Link has an onClick prop (and no href), it will render as a button
45
+ */
46
+ onClick?: (event: React.MouseEvent<ViewOwnProps, MouseEvent>) => void
47
+ /**
48
+ * Fires when the Link is hovered
49
+ */
50
+ onMouseEnter?: (event: React.MouseEvent<ViewOwnProps, MouseEvent>) => void
51
+ /**
52
+ * Sets the font-size of the breadcrumb text
53
+ */
54
+ size?: 'small' | 'medium' | 'large'
55
+ /**
56
+ * Add an icon to the Breadcrumb.Link
57
+ */
58
+ renderIcon?: Renderable
59
+ /**
60
+ * Place the icon before or after the text in the Breadcrumb.Link
61
+ */
62
+ iconPlacement?: 'start' | 'end'
63
+ /**
64
+ * Whether the page this breadcrumb points to is the current one. If true, it sets aria-current="page".
65
+ * If this prop is not set to true on any breadcrumb element, the one recieving the aria-current="page" will always be the last element, unless the last element's isCurrentPage prop is explicity set to false.
66
+ */
67
+ isCurrentPage?: boolean
68
+ }
69
+
70
+ type PropKeys = keyof BreadcrumbLinkOwnProps
71
+
72
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
73
+
74
+ type BreadcrumbLinkProps = PickPropsWithExceptions<
75
+ LinkProps,
76
+ | 'children'
77
+ | 'href'
78
+ | 'onClick'
79
+ | 'renderIcon'
80
+ | 'iconPlacement'
81
+ | 'elementRef'
82
+ > &
83
+ BreadcrumbLinkOwnProps &
84
+ OtherHTMLAttributes<BreadcrumbLinkOwnProps & LinkProps>
85
+ const allowedProps: AllowedPropKeys = [
86
+ 'children',
87
+ 'href',
88
+ 'iconPlacement',
89
+ 'onClick',
90
+ 'onMouseEnter',
91
+ 'renderIcon',
92
+ 'size',
93
+ 'isCurrentPage'
94
+ ]
95
+
96
+ type BreadcrumbLinkState = {
97
+ isTruncated: boolean
98
+ }
99
+
100
+ export type { BreadcrumbLinkProps, BreadcrumbLinkState }
101
+ export { allowedProps }