@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.
- package/CHANGELOG.md +1330 -0
- package/LICENSE.md +28 -0
- package/README.md +46 -0
- package/es/Breadcrumb/v1/BreadcrumbLink/index.js +119 -0
- package/es/Breadcrumb/v1/BreadcrumbLink/props.js +26 -0
- package/es/Breadcrumb/v1/index.js +113 -0
- package/es/Breadcrumb/v1/props.js +26 -0
- package/es/Breadcrumb/v1/styles.js +106 -0
- package/es/Breadcrumb/v1/theme.js +49 -0
- package/es/Breadcrumb/v2/BreadcrumbLink/index.js +121 -0
- package/es/Breadcrumb/v2/BreadcrumbLink/props.js +26 -0
- package/es/Breadcrumb/v2/index.js +133 -0
- package/es/Breadcrumb/v2/props.js +26 -0
- package/es/Breadcrumb/v2/styles.js +77 -0
- package/es/exports/a.js +24 -0
- package/es/exports/b.js +24 -0
- package/lib/Breadcrumb/v1/BreadcrumbLink/index.js +125 -0
- package/lib/Breadcrumb/v1/BreadcrumbLink/props.js +31 -0
- package/lib/Breadcrumb/v1/index.js +125 -0
- package/lib/Breadcrumb/v1/props.js +31 -0
- package/lib/Breadcrumb/v1/styles.js +112 -0
- package/lib/Breadcrumb/v1/theme.js +55 -0
- package/lib/Breadcrumb/v2/BreadcrumbLink/index.js +127 -0
- package/lib/Breadcrumb/v2/BreadcrumbLink/props.js +31 -0
- package/lib/Breadcrumb/v2/index.js +145 -0
- package/lib/Breadcrumb/v2/props.js +31 -0
- package/lib/Breadcrumb/v2/styles.js +83 -0
- package/lib/exports/a.js +18 -0
- package/lib/exports/b.js +18 -0
- package/lib/package.json +1 -0
- package/package.json +90 -0
- package/scripts/fix-instructure-exports.js +137 -0
- package/src/Breadcrumb/v1/BreadcrumbLink/index.tsx +122 -0
- package/src/Breadcrumb/v1/BreadcrumbLink/props.ts +102 -0
- package/src/Breadcrumb/v1/README.md +141 -0
- package/src/Breadcrumb/v1/index.tsx +143 -0
- package/src/Breadcrumb/v1/props.ts +63 -0
- package/src/Breadcrumb/v1/styles.ts +116 -0
- package/src/Breadcrumb/v1/theme.ts +55 -0
- package/src/Breadcrumb/v2/BreadcrumbLink/index.tsx +123 -0
- package/src/Breadcrumb/v2/BreadcrumbLink/props.ts +101 -0
- package/src/Breadcrumb/v2/README.md +141 -0
- package/src/Breadcrumb/v2/index.tsx +157 -0
- package/src/Breadcrumb/v2/props.ts +64 -0
- package/src/Breadcrumb/v2/styles.ts +86 -0
- package/src/exports/a.ts +27 -0
- package/src/exports/b.ts +27 -0
- package/tsconfig.build.json +24 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +4 -0
- package/types/Breadcrumb/v1/BreadcrumbLink/index.d.ts +31 -0
- package/types/Breadcrumb/v1/BreadcrumbLink/index.d.ts.map +1 -0
- package/types/Breadcrumb/v1/BreadcrumbLink/props.d.ts +49 -0
- package/types/Breadcrumb/v1/BreadcrumbLink/props.d.ts.map +1 -0
- package/types/Breadcrumb/v1/index.d.ts +35 -0
- package/types/Breadcrumb/v1/index.d.ts.map +1 -0
- package/types/Breadcrumb/v1/props.d.ts +30 -0
- package/types/Breadcrumb/v1/props.d.ts.map +1 -0
- package/types/Breadcrumb/v1/styles.d.ts +15 -0
- package/types/Breadcrumb/v1/styles.d.ts.map +1 -0
- package/types/Breadcrumb/v1/theme.d.ts +10 -0
- package/types/Breadcrumb/v1/theme.d.ts.map +1 -0
- package/types/Breadcrumb/v2/BreadcrumbLink/index.d.ts +31 -0
- package/types/Breadcrumb/v2/BreadcrumbLink/index.d.ts.map +1 -0
- package/types/Breadcrumb/v2/BreadcrumbLink/props.d.ts +49 -0
- package/types/Breadcrumb/v2/BreadcrumbLink/props.d.ts.map +1 -0
- package/types/Breadcrumb/v2/index.d.ts +35 -0
- package/types/Breadcrumb/v2/index.d.ts.map +1 -0
- package/types/Breadcrumb/v2/props.d.ts +30 -0
- package/types/Breadcrumb/v2/props.d.ts.map +1 -0
- package/types/Breadcrumb/v2/styles.d.ts +14 -0
- package/types/Breadcrumb/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +4 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +4 -0
- package/types/exports/b.d.ts.map +1 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
describes: Breadcrumb
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Breadcrumbs enable users to quickly see their location within a path of navigation.
|
|
6
|
+
Long breadcrumb text will be automatically truncated, ensuring the list always
|
|
7
|
+
remains on a single line.
|
|
8
|
+
|
|
9
|
+
**Breadcrumbs are best suited for tablet-sized (~768px) screens and larger.**
|
|
10
|
+
For smaller screens, use a [Link](Link) that returns the user to the previous page or view.
|
|
11
|
+
The example below is implemented with [Responsive](Responsive). Resize the browser window to see
|
|
12
|
+
Breadcrumb become a Link at under 768px.
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
---
|
|
16
|
+
type: example
|
|
17
|
+
---
|
|
18
|
+
<Responsive
|
|
19
|
+
query={{
|
|
20
|
+
tablet: { minWidth: 768 }
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
{(props, matches) => {
|
|
24
|
+
if (matches.includes('tablet')) {
|
|
25
|
+
return (
|
|
26
|
+
<Breadcrumb label="breadcrumb">
|
|
27
|
+
<Breadcrumb.Link href="#">Student Forecast</Breadcrumb.Link>
|
|
28
|
+
<Breadcrumb.Link href="#">University of Utah</Breadcrumb.Link>
|
|
29
|
+
<Breadcrumb.Link href="#">University of Utah Colleges</Breadcrumb.Link>
|
|
30
|
+
<Breadcrumb.Link>College of Life Sciences</Breadcrumb.Link>
|
|
31
|
+
</Breadcrumb>
|
|
32
|
+
)
|
|
33
|
+
} else {
|
|
34
|
+
return (
|
|
35
|
+
<Link
|
|
36
|
+
href="#"
|
|
37
|
+
variant="standalone"
|
|
38
|
+
renderIcon={ChevronLeftInstUIIcon}
|
|
39
|
+
>
|
|
40
|
+
<TruncateText>University of Utah Colleges</TruncateText>
|
|
41
|
+
</Link>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
</Responsive>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Change the `size` prop to control the font-size of the breadcrumbs (default is `medium`).
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
---
|
|
52
|
+
type: example
|
|
53
|
+
---
|
|
54
|
+
<div>
|
|
55
|
+
<Breadcrumb size="small" label="breadcrumb" margin="none none general.spaceXl">
|
|
56
|
+
<Breadcrumb.Link href="https://instructure.github.io/instructure-ui/">English 204</Breadcrumb.Link>
|
|
57
|
+
<Breadcrumb.Link
|
|
58
|
+
onClick={function () {
|
|
59
|
+
console.log("This Breadcrumb.Link was clicked!")
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
Exploring John Updike
|
|
63
|
+
</Breadcrumb.Link>
|
|
64
|
+
<Breadcrumb.Link href="https://instructure.github.io/instructure-ui/">The Rabbit Novels</Breadcrumb.Link>
|
|
65
|
+
<Breadcrumb.Link>Rabbit Is Rich</Breadcrumb.Link>
|
|
66
|
+
</Breadcrumb>
|
|
67
|
+
<View as="div" width="40rem">
|
|
68
|
+
<Breadcrumb label="breadcrumb" margin="none none general.spaceXl">
|
|
69
|
+
<Breadcrumb.Link href="https://instructure.github.io/instructure-ui/">English 204</Breadcrumb.Link>
|
|
70
|
+
<Breadcrumb.Link
|
|
71
|
+
onClick={function () {
|
|
72
|
+
console.log("This Breadcrumb.Link was clicked!")
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
Exploring John Updike
|
|
76
|
+
</Breadcrumb.Link>
|
|
77
|
+
<Breadcrumb.Link href="https://instructure.github.io/instructure-ui/">The Rabbit Novels</Breadcrumb.Link>
|
|
78
|
+
<Breadcrumb.Link>Rabbit Is Rich</Breadcrumb.Link>
|
|
79
|
+
</Breadcrumb>
|
|
80
|
+
</View>
|
|
81
|
+
<Breadcrumb size="large" label="breadcrumb">
|
|
82
|
+
<Breadcrumb.Link href="https://instructure.github.io/instructure-ui/">English 204</Breadcrumb.Link>
|
|
83
|
+
<Breadcrumb.Link
|
|
84
|
+
onClick={function () {
|
|
85
|
+
console.log("This Breadcrumb.Link was clicked!")
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
Exploring John Updike
|
|
89
|
+
</Breadcrumb.Link>
|
|
90
|
+
<Breadcrumb.Link href="https://instructure.github.io/instructure-ui/">The Rabbit Novels</Breadcrumb.Link>
|
|
91
|
+
<Breadcrumb.Link>Rabbit Is Rich</Breadcrumb.Link>
|
|
92
|
+
</Breadcrumb>
|
|
93
|
+
</div>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Icons
|
|
97
|
+
|
|
98
|
+
You can include icons in `Breadcrumb.Link`:
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
---
|
|
102
|
+
type: example
|
|
103
|
+
---
|
|
104
|
+
<Breadcrumb label="Breadcrumb with icons">
|
|
105
|
+
<Breadcrumb.Link renderIcon={<FolderOpenInstUIIcon />} href="#Breadcrumb">Item Bank</Breadcrumb.Link>
|
|
106
|
+
<Breadcrumb.Link renderIcon={<Clock4InstUIIcon />} onClick={() => {}}>History</Breadcrumb.Link>
|
|
107
|
+
<Breadcrumb.Link renderIcon={<PlusInstUIIcon />} iconPlacement="end">New Question</Breadcrumb.Link>
|
|
108
|
+
</Breadcrumb>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Guidelines
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
---
|
|
115
|
+
type: embed
|
|
116
|
+
---
|
|
117
|
+
<Guidelines>
|
|
118
|
+
<Figure recommendation="yes" title="Do">
|
|
119
|
+
<Figure.Item>Place Breadcrumb near the top of the page</Figure.Item>
|
|
120
|
+
<Figure.Item>Show hierarchy, not history</Figure.Item>
|
|
121
|
+
<Figure.Item>Keep Breadcrumb titles short but descriptive</Figure.Item>
|
|
122
|
+
</Figure>
|
|
123
|
+
<Figure recommendation="no" title="Don't">
|
|
124
|
+
<Figure.Item>Use Breadcrumb if you are taking users through a multi-step process</Figure.Item>
|
|
125
|
+
<Figure.Item>Use Breadcrumb in mobile layouts: use a Link to the previous page/view instead</Figure.Item>
|
|
126
|
+
</Figure>
|
|
127
|
+
</Guidelines>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
---
|
|
132
|
+
type: embed
|
|
133
|
+
---
|
|
134
|
+
<Guidelines>
|
|
135
|
+
<Figure recommendation="a11y" title="Accessibility">
|
|
136
|
+
<Figure.Item>
|
|
137
|
+
To indicate the current element within a breadcrumb, the <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current">aria-current</a> attribute is used. In this component, aria-current="page" will automatically be applied to the last element, and we recommend that the current page always be the last element in the breadcrumb. If the last element is not the current page, the isCurrentPage property should be applied to the relevant Breadcrumb.Link to ensure compatibility with screen readers.
|
|
138
|
+
</Figure.Item>
|
|
139
|
+
</Figure>
|
|
140
|
+
</Guidelines>
|
|
141
|
+
```
|
|
@@ -0,0 +1,157 @@
|
|
|
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 { isValidElement, Children, Component, ReactElement } from 'react'
|
|
26
|
+
|
|
27
|
+
import { View } from '@instructure/ui-view/latest'
|
|
28
|
+
import { safeCloneElement } from '@instructure/ui-react-utils'
|
|
29
|
+
|
|
30
|
+
import { withStyleNew } from '@instructure/emotion'
|
|
31
|
+
import { ChevronRightInstUIIcon } from '@instructure/ui-icons'
|
|
32
|
+
import { BreadcrumbLink } from './BreadcrumbLink/index.js'
|
|
33
|
+
|
|
34
|
+
import generateStyle from './styles.js'
|
|
35
|
+
|
|
36
|
+
import { allowedProps } from './props.js'
|
|
37
|
+
import type { BreadcrumbProps } from './props'
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
---
|
|
41
|
+
category: components
|
|
42
|
+
---
|
|
43
|
+
**/
|
|
44
|
+
|
|
45
|
+
@withStyleNew(generateStyle)
|
|
46
|
+
class Breadcrumb extends Component<BreadcrumbProps> {
|
|
47
|
+
static displayName = 'Breadcrumb'
|
|
48
|
+
static readonly componentId = 'Breadcrumb'
|
|
49
|
+
|
|
50
|
+
static allowedProps = allowedProps
|
|
51
|
+
static defaultProps = {
|
|
52
|
+
size: 'medium',
|
|
53
|
+
children: null
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ref: Element | null = null
|
|
57
|
+
|
|
58
|
+
handleRef = (el: Element | null) => {
|
|
59
|
+
this.ref = el
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
addAriaCurrent = (child: React.ReactNode) => {
|
|
63
|
+
const updatedChild = safeCloneElement(
|
|
64
|
+
child as React.ReactElement<{ 'aria-current'?: string }>,
|
|
65
|
+
{
|
|
66
|
+
'aria-current': 'page'
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
return updatedChild
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
componentDidMount() {
|
|
73
|
+
this.props.makeStyles?.()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
componentDidUpdate() {
|
|
77
|
+
this.props.makeStyles?.()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static Link = BreadcrumbLink
|
|
81
|
+
|
|
82
|
+
renderChildren() {
|
|
83
|
+
const { styles, children, size } = this.props
|
|
84
|
+
const numChildren = Children.count(children)
|
|
85
|
+
const inlineStyle = {
|
|
86
|
+
maxWidth: `${Math.floor(100 / numChildren)}%`
|
|
87
|
+
}
|
|
88
|
+
let isAriaCurrentSet = false
|
|
89
|
+
|
|
90
|
+
return Children.map(children, (child, index) => {
|
|
91
|
+
const isLastElement = index === numChildren - 1
|
|
92
|
+
if (isValidElement(child)) {
|
|
93
|
+
const isCurrentPage =
|
|
94
|
+
(child as ReactElement<any>).props.isCurrentPage || false
|
|
95
|
+
if (isAriaCurrentSet && isCurrentPage) {
|
|
96
|
+
console.warn(
|
|
97
|
+
`Warning: Multiple elements with isCurrentPage=true found. Only one element should be set to current.`
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
if (isCurrentPage) {
|
|
101
|
+
isAriaCurrentSet = true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Clone child (BreadcrumbLink) and pass size prop
|
|
106
|
+
const childWithSize = isValidElement(child)
|
|
107
|
+
? safeCloneElement(child as ReactElement<any>, { size })
|
|
108
|
+
: child
|
|
109
|
+
|
|
110
|
+
// Map Breadcrumb sizes to icon size tokens
|
|
111
|
+
const breadcrumbSizeToIconSize = {
|
|
112
|
+
small: 'sm',
|
|
113
|
+
medium: 'md',
|
|
114
|
+
large: 'lg'
|
|
115
|
+
} as const
|
|
116
|
+
|
|
117
|
+
const iconSize = breadcrumbSizeToIconSize[size || 'small']
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<>
|
|
121
|
+
<li css={styles?.crumb} style={inlineStyle}>
|
|
122
|
+
{!isAriaCurrentSet &&
|
|
123
|
+
isLastElement &&
|
|
124
|
+
(child as React.ReactElement<any>).props.isCurrentPage !== false
|
|
125
|
+
? this.addAriaCurrent(childWithSize)
|
|
126
|
+
: childWithSize}
|
|
127
|
+
</li>
|
|
128
|
+
{index < numChildren - 1 && (
|
|
129
|
+
<li aria-hidden="true" css={styles?.separator}>
|
|
130
|
+
<ChevronRightInstUIIcon size={iconSize} color={'mutedColor'} />
|
|
131
|
+
</li>
|
|
132
|
+
)}
|
|
133
|
+
</>
|
|
134
|
+
)
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
render() {
|
|
139
|
+
const { styles } = this.props
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<View
|
|
143
|
+
role="navigation"
|
|
144
|
+
as="div"
|
|
145
|
+
margin={this.props.margin}
|
|
146
|
+
aria-label={this.props.label}
|
|
147
|
+
elementRef={this.handleRef}
|
|
148
|
+
data-cid="Breadcrumb"
|
|
149
|
+
>
|
|
150
|
+
<ol css={styles?.breadcrumb}>{this.renderChildren()}</ol>
|
|
151
|
+
</View>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export default Breadcrumb
|
|
157
|
+
export { Breadcrumb, BreadcrumbLink }
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
import type {
|
|
25
|
+
Spacing,
|
|
26
|
+
WithStyleProps,
|
|
27
|
+
ComponentStyle
|
|
28
|
+
} from '@instructure/emotion'
|
|
29
|
+
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
30
|
+
|
|
31
|
+
type BreadcrumbOwnProps = {
|
|
32
|
+
/**
|
|
33
|
+
* children of type Breadcrumb.Link
|
|
34
|
+
*/
|
|
35
|
+
children?: React.ReactNode // TODO: oneOf([BreadcrumbLink])
|
|
36
|
+
/**
|
|
37
|
+
* An accessible label for the navigation
|
|
38
|
+
*/
|
|
39
|
+
label: string
|
|
40
|
+
/**
|
|
41
|
+
* Sets the font-size of the breadcrumb text
|
|
42
|
+
*/
|
|
43
|
+
size?: 'small' | 'medium' | 'large'
|
|
44
|
+
/**
|
|
45
|
+
* Valid values are `0`, `none`, `auto`, and Spacing token values,
|
|
46
|
+
* see https://instructure.design/layout-spacing. Apply these values via
|
|
47
|
+
* familiar CSS-like shorthand. For example, `margin="general.spaceMd auto"`.
|
|
48
|
+
*/
|
|
49
|
+
margin?: Spacing
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type PropKeys = keyof BreadcrumbOwnProps
|
|
53
|
+
|
|
54
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
55
|
+
|
|
56
|
+
type BreadcrumbProps = BreadcrumbOwnProps &
|
|
57
|
+
WithStyleProps<ReturnType<NewComponentTypes['Breadcrumb']>, BreadcrumbStyle>
|
|
58
|
+
|
|
59
|
+
type BreadcrumbStyle = ComponentStyle<'breadcrumb' | 'crumb' | 'separator'>
|
|
60
|
+
|
|
61
|
+
const allowedProps: AllowedPropKeys = ['children', 'label', 'margin', 'size']
|
|
62
|
+
|
|
63
|
+
export type { BreadcrumbProps, BreadcrumbStyle }
|
|
64
|
+
export { allowedProps }
|
|
@@ -0,0 +1,86 @@
|
|
|
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 type { NewComponentTypes } from '@instructure/ui-themes'
|
|
26
|
+
import type { BreadcrumbProps, BreadcrumbStyle } from './props'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* ---
|
|
30
|
+
* private: true
|
|
31
|
+
* ---
|
|
32
|
+
* Generates the style object from the theme and provided additional information
|
|
33
|
+
* @param {Object} componentTheme The theme variable object.
|
|
34
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
35
|
+
* @return {Object} The final style object, which will be used in the component
|
|
36
|
+
*/
|
|
37
|
+
const generateStyle = (
|
|
38
|
+
componentTheme: ReturnType<NewComponentTypes['Breadcrumb']>,
|
|
39
|
+
props: BreadcrumbProps
|
|
40
|
+
): BreadcrumbStyle => {
|
|
41
|
+
const { size } = props
|
|
42
|
+
|
|
43
|
+
const gapSizeVariants = {
|
|
44
|
+
small: componentTheme.gapSm,
|
|
45
|
+
medium: componentTheme.gapMd,
|
|
46
|
+
large: componentTheme.gapLg
|
|
47
|
+
}
|
|
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
|
+
|
|
66
|
+
// prevent text clipping
|
|
67
|
+
'[data-cid~="TruncateText"]': {
|
|
68
|
+
overflow: 'visible',
|
|
69
|
+
|
|
70
|
+
// prevent extra spacing after the '...'
|
|
71
|
+
'& [class*="truncateText__spacer"]': {
|
|
72
|
+
display: 'inline'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
separator: {
|
|
77
|
+
label: 'breadcrumb__separator',
|
|
78
|
+
boxSizing: 'border-box',
|
|
79
|
+
display: 'inline-flex',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
flexShrink: 0
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default generateStyle
|
package/src/exports/a.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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'
|
|
25
|
+
|
|
26
|
+
export type { BreadcrumbProps } from '../Breadcrumb/v1/props'
|
|
27
|
+
export type { BreadcrumbLinkProps } from '../Breadcrumb/v1/BreadcrumbLink/props'
|
package/src/exports/b.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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'
|
|
25
|
+
|
|
26
|
+
export type { BreadcrumbProps } from '../Breadcrumb/v2/props'
|
|
27
|
+
export type { BreadcrumbLinkProps } from '../Breadcrumb/v2/BreadcrumbLink/props'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.build.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./types",
|
|
5
|
+
"composite": true,
|
|
6
|
+
"rootDir": "./src"
|
|
7
|
+
},
|
|
8
|
+
"include": ["src"],
|
|
9
|
+
"references": [
|
|
10
|
+
{ "path": "../ui-babel-preset/tsconfig.build.json" },
|
|
11
|
+
{ "path": "../ui-themes/tsconfig.build.json" },
|
|
12
|
+
{ "path": "../emotion/tsconfig.build.json" },
|
|
13
|
+
{ "path": "../shared-types/tsconfig.build.json" },
|
|
14
|
+
{ "path": "../ui-icons/tsconfig.build.json" },
|
|
15
|
+
{ "path": "../ui-link/tsconfig.build.json" },
|
|
16
|
+
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
17
|
+
{ "path": "../ui-truncate-text/tsconfig.build.json" },
|
|
18
|
+
{ "path": "../ui-tooltip/tsconfig.build.json" },
|
|
19
|
+
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
20
|
+
{ "path": "../ui-view/tsconfig.build.json" },
|
|
21
|
+
{ "path": "../ui-axe-check/tsconfig.build.json" },
|
|
22
|
+
{ "path": "../ui-scripts/tsconfig.build.json" }
|
|
23
|
+
]
|
|
24
|
+
}
|