@instructure/ui-top-nav-bar 10.26.1 → 11.0.1-snapshot-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 +30 -1
- package/es/TopNavBar/TopNavBarActionItems/index.js +5 -5
- package/es/TopNavBar/TopNavBarActionItems/props.js +1 -12
- package/es/TopNavBar/TopNavBarBrand/index.js +5 -5
- package/es/TopNavBar/TopNavBarBrand/props.js +1 -11
- package/es/TopNavBar/TopNavBarBreadcrumb/index.js +6 -5
- package/es/TopNavBar/TopNavBarBreadcrumb/props.js +1 -9
- package/es/TopNavBar/TopNavBarItem/index.js +6 -6
- package/es/TopNavBar/TopNavBarItem/props.js +1 -44
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +5 -5
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +2 -7
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +5 -5
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +2 -7
- package/es/TopNavBar/TopNavBarLayout/index.js +5 -6
- package/es/TopNavBar/TopNavBarLayout/props.js +1 -45
- package/es/TopNavBar/TopNavBarMenuItems/index.js +8 -7
- package/es/TopNavBar/TopNavBarMenuItems/props.js +1 -11
- package/es/TopNavBar/TopNavBarUser/index.js +5 -5
- package/es/TopNavBar/TopNavBarUser/props.js +1 -8
- package/es/TopNavBar/index.js +18 -6
- package/es/TopNavBar/props.js +1 -9
- package/es/TopNavBar/utils/mapItemsForDrilldown.js +2 -1
- package/lib/TopNavBar/TopNavBarActionItems/index.js +4 -4
- package/lib/TopNavBar/TopNavBarActionItems/props.js +1 -13
- package/lib/TopNavBar/TopNavBarBrand/index.js +4 -4
- package/lib/TopNavBar/TopNavBarBrand/props.js +1 -12
- package/lib/TopNavBar/TopNavBarBreadcrumb/index.js +5 -4
- package/lib/TopNavBar/TopNavBarBreadcrumb/props.js +1 -10
- package/lib/TopNavBar/TopNavBarItem/index.js +5 -5
- package/lib/TopNavBar/TopNavBarItem/props.js +1 -45
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +4 -4
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +1 -6
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +4 -4
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +1 -6
- package/lib/TopNavBar/TopNavBarLayout/index.js +4 -5
- package/lib/TopNavBar/TopNavBarLayout/props.js +1 -47
- package/lib/TopNavBar/TopNavBarMenuItems/index.js +7 -6
- package/lib/TopNavBar/TopNavBarMenuItems/props.js +1 -12
- package/lib/TopNavBar/TopNavBarUser/index.js +4 -4
- package/lib/TopNavBar/TopNavBarUser/props.js +1 -9
- package/lib/TopNavBar/index.js +19 -5
- package/lib/TopNavBar/props.js +1 -10
- package/lib/TopNavBar/utils/mapItemsForDrilldown.js +2 -1
- package/package.json +28 -31
- package/src/TopNavBar/TopNavBarActionItems/index.tsx +2 -8
- package/src/TopNavBar/TopNavBarActionItems/props.ts +1 -22
- package/src/TopNavBar/TopNavBarBrand/index.tsx +6 -5
- package/src/TopNavBar/TopNavBarBrand/props.ts +1 -16
- package/src/TopNavBar/TopNavBarBreadcrumb/index.tsx +13 -9
- package/src/TopNavBar/TopNavBarBreadcrumb/props.ts +3 -15
- package/src/TopNavBar/TopNavBarItem/index.tsx +6 -5
- package/src/TopNavBar/TopNavBarItem/props.ts +1 -51
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/index.tsx +2 -4
- package/src/TopNavBar/TopNavBarLayout/DesktopLayout/props.ts +3 -19
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.tsx +2 -4
- package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.ts +3 -18
- package/src/TopNavBar/TopNavBarLayout/index.tsx +1 -5
- package/src/TopNavBar/TopNavBarLayout/props.ts +1 -60
- package/src/TopNavBar/TopNavBarMenuItems/index.tsx +10 -5
- package/src/TopNavBar/TopNavBarMenuItems/props.ts +1 -19
- package/src/TopNavBar/TopNavBarUser/index.tsx +2 -4
- package/src/TopNavBar/TopNavBarUser/props.ts +1 -14
- package/src/TopNavBar/index.tsx +2 -4
- package/src/TopNavBar/props.ts +2 -17
- package/src/TopNavBar/utils/mapItemsForDrilldown.tsx +1 -1
- package/tsconfig.build.json +1 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/TopNavBar/TopNavBarActionItems/index.d.ts +0 -1
- package/types/TopNavBar/TopNavBarActionItems/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarActionItems/props.d.ts +2 -3
- package/types/TopNavBar/TopNavBarActionItems/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarBrand/index.d.ts +0 -1
- package/types/TopNavBar/TopNavBarBrand/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarBrand/props.d.ts +2 -3
- package/types/TopNavBar/TopNavBarBrand/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarBreadcrumb/index.d.ts +0 -5
- package/types/TopNavBar/TopNavBarBreadcrumb/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarBreadcrumb/props.d.ts +2 -3
- package/types/TopNavBar/TopNavBarBreadcrumb/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarItem/index.d.ts +0 -1
- package/types/TopNavBar/TopNavBarItem/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarItem/props.d.ts +2 -13
- package/types/TopNavBar/TopNavBarItem/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts +0 -1
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/props.d.ts +2 -3
- package/types/TopNavBar/TopNavBarLayout/DesktopLayout/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts +0 -1
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.d.ts +2 -3
- package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/index.d.ts +0 -1
- package/types/TopNavBar/TopNavBarLayout/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarLayout/props.d.ts +2 -6
- package/types/TopNavBar/TopNavBarLayout/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarMenuItems/index.d.ts +0 -1
- package/types/TopNavBar/TopNavBarMenuItems/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarMenuItems/props.d.ts +2 -3
- package/types/TopNavBar/TopNavBarMenuItems/props.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarUser/index.d.ts +0 -1
- package/types/TopNavBar/TopNavBarUser/index.d.ts.map +1 -1
- package/types/TopNavBar/TopNavBarUser/props.d.ts +2 -3
- package/types/TopNavBar/TopNavBarUser/props.d.ts.map +1 -1
- package/types/TopNavBar/index.d.ts +0 -1
- package/types/TopNavBar/index.d.ts.map +1 -1
- package/types/TopNavBar/props.d.ts +2 -3
- package/types/TopNavBar/props.d.ts.map +1 -1
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
withDeterministicId
|
|
34
34
|
} from '@instructure/ui-react-utils'
|
|
35
35
|
import { createChainedFunction } from '@instructure/ui-utils'
|
|
36
|
-
import { testable } from '@instructure/ui-testable'
|
|
37
36
|
import { warn, error } from '@instructure/console'
|
|
38
37
|
|
|
39
38
|
import { withStyle, InstUISettingsProvider } from '@instructure/emotion'
|
|
@@ -58,7 +57,7 @@ import { TopNavBarContext } from '../TopNavBarContext'
|
|
|
58
57
|
import generateStyle from './styles'
|
|
59
58
|
import generateComponentTheme from './theme'
|
|
60
59
|
|
|
61
|
-
import {
|
|
60
|
+
import { allowedProps } from './props'
|
|
62
61
|
import type {
|
|
63
62
|
TopNavBarItemProps,
|
|
64
63
|
TopNavBarItemState,
|
|
@@ -80,11 +79,9 @@ id: TopNavBar.Item
|
|
|
80
79
|
**/
|
|
81
80
|
@withDeterministicId()
|
|
82
81
|
@withStyle(generateStyle, generateComponentTheme)
|
|
83
|
-
@testable()
|
|
84
82
|
class TopNavBarItem extends Component<TopNavBarItemProps, TopNavBarItemState> {
|
|
85
83
|
static readonly componentId = 'TopNavBar.Item'
|
|
86
84
|
|
|
87
|
-
static propTypes = propTypes
|
|
88
85
|
static allowedProps = allowedProps
|
|
89
86
|
static defaultProps = {
|
|
90
87
|
status: 'default',
|
|
@@ -744,7 +741,11 @@ class TopNavBarItem extends Component<TopNavBarItemProps, TopNavBarItemState> {
|
|
|
744
741
|
}
|
|
745
742
|
|
|
746
743
|
return (
|
|
747
|
-
<div
|
|
744
|
+
<div
|
|
745
|
+
ref={this.handleRef}
|
|
746
|
+
css={styles?.topNavBarItem}
|
|
747
|
+
data-cid="TopNavBarItem"
|
|
748
|
+
>
|
|
748
749
|
{content}
|
|
749
750
|
</div>
|
|
750
751
|
)
|
|
@@ -23,16 +23,12 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
29
26
|
|
|
30
27
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
31
28
|
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
32
29
|
import type {
|
|
33
30
|
TopNavBarItemTheme,
|
|
34
31
|
OtherHTMLAttributes,
|
|
35
|
-
PropValidators,
|
|
36
32
|
Renderable,
|
|
37
33
|
AsElementType
|
|
38
34
|
} from '@instructure/shared-types'
|
|
@@ -63,19 +59,6 @@ type TopNavBarItemTooltipType =
|
|
|
63
59
|
onHideContent?: TooltipProps['onHideContent']
|
|
64
60
|
}
|
|
65
61
|
|
|
66
|
-
const topNavBarItemTooltipPropType = PropTypes.oneOfType([
|
|
67
|
-
PropTypes.string,
|
|
68
|
-
PropTypes.shape({
|
|
69
|
-
renderTip: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
70
|
-
color: PropTypes.oneOf(['primary', 'primary-inverse']),
|
|
71
|
-
placement: PropTypes.string,
|
|
72
|
-
offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
73
|
-
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
74
|
-
onShowContent: PropTypes.func,
|
|
75
|
-
onHideContent: PropTypes.func
|
|
76
|
-
})
|
|
77
|
-
])
|
|
78
|
-
|
|
79
62
|
type TopNavBarItemOwnProps = {
|
|
80
63
|
/**
|
|
81
64
|
* the element type to render as (will default to `<a>` if href is provided)
|
|
@@ -296,39 +279,6 @@ type TopNavBarItemStyleProps = {
|
|
|
296
279
|
layout: TopNavBarContextType['layout']
|
|
297
280
|
inverseColor: TopNavBarContextType['inverseColor']
|
|
298
281
|
}
|
|
299
|
-
|
|
300
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
301
|
-
id: PropTypes.string.isRequired,
|
|
302
|
-
as: PropTypes.elementType,
|
|
303
|
-
children: PropTypes.node.isRequired,
|
|
304
|
-
variant: PropTypes.oneOf(['default', 'button', 'icon', 'avatar']),
|
|
305
|
-
status: PropTypes.oneOf(['default', 'active', 'disabled']),
|
|
306
|
-
renderSubmenu: ChildrenPropTypes.oneOf([Drilldown]),
|
|
307
|
-
showSubmenuChevron: PropTypes.bool,
|
|
308
|
-
customPopoverConfig: PropTypes.object,
|
|
309
|
-
tooltip: topNavBarItemTooltipPropType,
|
|
310
|
-
renderAvatar: PropTypes.shape({
|
|
311
|
-
avatarName: PropTypes.string.isRequired,
|
|
312
|
-
avatarSrc: PropTypes.string,
|
|
313
|
-
avatarAlt: PropTypes.string
|
|
314
|
-
}),
|
|
315
|
-
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
316
|
-
href: PropTypes.string,
|
|
317
|
-
onClick: PropTypes.func,
|
|
318
|
-
onHiddenClick: PropTypes.func,
|
|
319
|
-
onSubmenuToggle: PropTypes.func,
|
|
320
|
-
onMouseOver: PropTypes.func,
|
|
321
|
-
onMouseOut: PropTypes.func,
|
|
322
|
-
onFocus: PropTypes.func,
|
|
323
|
-
onBlur: PropTypes.func,
|
|
324
|
-
onKeyDown: PropTypes.func,
|
|
325
|
-
onKeyUp: PropTypes.func,
|
|
326
|
-
elementRef: PropTypes.func,
|
|
327
|
-
itemRef: PropTypes.func,
|
|
328
|
-
shouldCloseOnClick: PropTypes.oneOf(['auto', 'always', 'never']),
|
|
329
|
-
withFocusOutline: PropTypes.bool
|
|
330
|
-
}
|
|
331
|
-
|
|
332
282
|
const allowedProps: AllowedPropKeys = [
|
|
333
283
|
'id',
|
|
334
284
|
'as',
|
|
@@ -367,4 +317,4 @@ export type {
|
|
|
367
317
|
DrilldownSubmenu,
|
|
368
318
|
TopNavBarItemTooltipType
|
|
369
319
|
}
|
|
370
|
-
export {
|
|
320
|
+
export { allowedProps }
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import { Children, Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
28
|
-
import { testable } from '@instructure/ui-testable'
|
|
29
28
|
|
|
30
29
|
import { withStyle } from '@instructure/emotion'
|
|
31
30
|
|
|
@@ -34,7 +33,7 @@ import { TopNavBarContext } from '../../TopNavBarContext'
|
|
|
34
33
|
import generateStyle from './styles'
|
|
35
34
|
import generateComponentTheme from './theme'
|
|
36
35
|
|
|
37
|
-
import {
|
|
36
|
+
import { allowedProps } from './props'
|
|
38
37
|
import type {
|
|
39
38
|
TopNavBarDesktopLayoutProps,
|
|
40
39
|
TopNavBarDesktopLayoutStyleProps
|
|
@@ -46,11 +45,9 @@ private: true
|
|
|
46
45
|
---
|
|
47
46
|
**/
|
|
48
47
|
@withStyle(generateStyle, generateComponentTheme)
|
|
49
|
-
@testable()
|
|
50
48
|
class TopNavBarDesktopLayout extends Component<TopNavBarDesktopLayoutProps> {
|
|
51
49
|
static readonly componentId = 'TopNavBar.DesktopLayout'
|
|
52
50
|
|
|
53
|
-
static propTypes = propTypes
|
|
54
51
|
static allowedProps = allowedProps
|
|
55
52
|
static defaultProps = {}
|
|
56
53
|
|
|
@@ -139,6 +136,7 @@ class TopNavBarDesktopLayout extends Component<TopNavBarDesktopLayoutProps> {
|
|
|
139
136
|
ref={this.handleRef}
|
|
140
137
|
css={styles?.topNavBarDesktopLayout}
|
|
141
138
|
aria-label={navLabel}
|
|
139
|
+
data-cid="TopNavBarDesktopLayout"
|
|
142
140
|
>
|
|
143
141
|
{this.hasBrandBlock && (
|
|
144
142
|
<div css={styles?.brandContainer}>{renderBrand}</div>
|
|
@@ -23,22 +23,13 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
|
|
27
26
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
28
27
|
import type {
|
|
29
28
|
TopNavBarLayoutDesktopTheme,
|
|
30
|
-
OtherHTMLAttributes
|
|
31
|
-
PropValidators
|
|
29
|
+
OtherHTMLAttributes
|
|
32
30
|
} from '@instructure/shared-types'
|
|
33
|
-
|
|
34
31
|
import type { TopNavBarContextType } from '../../TopNavBarContext'
|
|
35
|
-
|
|
36
|
-
import {
|
|
37
|
-
commonPropTypes,
|
|
38
|
-
commonAllowedProps,
|
|
39
|
-
desktopPropTypes,
|
|
40
|
-
desktopAllowedProps
|
|
41
|
-
} from '../props'
|
|
32
|
+
import { commonAllowedProps, desktopAllowedProps } from '../props'
|
|
42
33
|
import type { CommonTopNavBarLayoutProps } from '../props'
|
|
43
34
|
|
|
44
35
|
import { TopNavBarDesktopLayout } from './index'
|
|
@@ -82,13 +73,6 @@ type TopNavBarDesktopLayoutStyleProps = {
|
|
|
82
73
|
hasActionItemsBlock: boolean
|
|
83
74
|
hasUserBlock: boolean
|
|
84
75
|
}
|
|
85
|
-
|
|
86
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
87
|
-
// Edit PropTypes in TopNabBarLayout/props.ts
|
|
88
|
-
...commonPropTypes,
|
|
89
|
-
...desktopPropTypes
|
|
90
|
-
}
|
|
91
|
-
|
|
92
76
|
const allowedProps: AllowedPropKeys = [
|
|
93
77
|
// Edit allowed props in TopNabBarLayout/props.ts
|
|
94
78
|
...commonAllowedProps,
|
|
@@ -103,4 +87,4 @@ export type {
|
|
|
103
87
|
TopNavBarDesktopLayoutStyle,
|
|
104
88
|
TopNavBarDesktopLayoutStyleProps
|
|
105
89
|
}
|
|
106
|
-
export {
|
|
90
|
+
export { allowedProps }
|
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
} from '@instructure/ui-react-utils'
|
|
32
32
|
import { px } from '@instructure/ui-utils'
|
|
33
33
|
import { warn } from '@instructure/console'
|
|
34
|
-
import { testable } from '@instructure/ui-testable'
|
|
35
34
|
import {
|
|
36
35
|
getBoundingClientRect,
|
|
37
36
|
requestAnimationFrame
|
|
@@ -66,7 +65,7 @@ import { TopNavBarContext } from '../../TopNavBarContext'
|
|
|
66
65
|
import generateStyle from './styles'
|
|
67
66
|
import generateComponentTheme from './theme'
|
|
68
67
|
|
|
69
|
-
import {
|
|
68
|
+
import { allowedProps } from './props'
|
|
70
69
|
import type {
|
|
71
70
|
TopNavBarSmallViewportLayoutProps,
|
|
72
71
|
TopNavBarSmallViewportLayoutState,
|
|
@@ -80,14 +79,12 @@ private: true
|
|
|
80
79
|
**/
|
|
81
80
|
@withDeterministicId()
|
|
82
81
|
@withStyle(generateStyle, generateComponentTheme)
|
|
83
|
-
@testable()
|
|
84
82
|
class TopNavBarSmallViewportLayout extends Component<
|
|
85
83
|
TopNavBarSmallViewportLayoutProps,
|
|
86
84
|
TopNavBarSmallViewportLayoutState
|
|
87
85
|
> {
|
|
88
86
|
static readonly componentId = 'TopNavBar.SmallViewportLayout'
|
|
89
87
|
|
|
90
|
-
static propTypes = propTypes
|
|
91
88
|
static allowedProps = allowedProps
|
|
92
89
|
static defaultProps = {}
|
|
93
90
|
|
|
@@ -628,6 +625,7 @@ class TopNavBarSmallViewportLayout extends Component<
|
|
|
628
625
|
{...omitProps(this.props, allowedProps)}
|
|
629
626
|
ref={this.handleRef}
|
|
630
627
|
aria-label={navLabel}
|
|
628
|
+
data-cid="TopNavBarSmallViewportLayout"
|
|
631
629
|
>
|
|
632
630
|
<Global styles={styles?.globalStyles} />
|
|
633
631
|
|
|
@@ -23,26 +23,18 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
|
|
27
26
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
28
27
|
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
29
28
|
import type {
|
|
30
29
|
TopNavBarLayoutSmallViewportTheme,
|
|
31
|
-
OtherHTMLAttributes
|
|
32
|
-
PropValidators
|
|
30
|
+
OtherHTMLAttributes
|
|
33
31
|
} from '@instructure/shared-types'
|
|
34
32
|
|
|
35
33
|
import type { DrilldownProps } from '@instructure/ui-drilldown'
|
|
36
|
-
|
|
37
34
|
import type { TopNavBarItemTooltipType } from '../../TopNavBarItem/props'
|
|
38
35
|
import type { TopNavBarContextType } from '../../TopNavBarContext'
|
|
39
36
|
|
|
40
|
-
import {
|
|
41
|
-
commonAllowedProps,
|
|
42
|
-
commonPropTypes,
|
|
43
|
-
smallViewportPropTypes,
|
|
44
|
-
smallViewportAllowedProps
|
|
45
|
-
} from '../props'
|
|
37
|
+
import { commonAllowedProps, smallViewportAllowedProps } from '../props'
|
|
46
38
|
import type { CommonTopNavBarLayoutProps } from '../props'
|
|
47
39
|
|
|
48
40
|
import { TopNavBarSmallViewportLayout } from './index'
|
|
@@ -167,13 +159,6 @@ type TopNavBarSmallViewportLayoutStyleProps = {
|
|
|
167
159
|
menuBottomPosition: number
|
|
168
160
|
inverseColor: TopNavBarContextType['inverseColor']
|
|
169
161
|
}
|
|
170
|
-
|
|
171
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
172
|
-
// Edit PropTypes in TopNavBarLayout/props.ts
|
|
173
|
-
...commonPropTypes,
|
|
174
|
-
...smallViewportPropTypes
|
|
175
|
-
}
|
|
176
|
-
|
|
177
162
|
const allowedProps: AllowedPropKeys = [
|
|
178
163
|
// Edit allowed props in TopNavBarLayout/props.ts
|
|
179
164
|
...commonAllowedProps,
|
|
@@ -189,4 +174,4 @@ export type {
|
|
|
189
174
|
TopNavBarSmallViewportLayoutState,
|
|
190
175
|
TopNavBarSmallViewportLayoutStyleProps
|
|
191
176
|
}
|
|
192
|
-
export {
|
|
177
|
+
export { allowedProps }
|
|
@@ -24,8 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
|
-
import { testable } from '@instructure/ui-testable'
|
|
28
|
-
|
|
29
27
|
import { withStyle } from '@instructure/emotion'
|
|
30
28
|
|
|
31
29
|
import type {
|
|
@@ -42,7 +40,7 @@ import type { TopNavBarSmallViewportLayoutProps } from './SmallViewportLayout/pr
|
|
|
42
40
|
import { TopNavBarDesktopLayout } from './DesktopLayout'
|
|
43
41
|
import type { TopNavBarDesktopLayoutProps } from './DesktopLayout/props'
|
|
44
42
|
|
|
45
|
-
import {
|
|
43
|
+
import { allowedProps } from './props'
|
|
46
44
|
import type { TopNavBarLayoutProps } from './props'
|
|
47
45
|
|
|
48
46
|
/**
|
|
@@ -53,11 +51,9 @@ id: TopNavBar.Layout
|
|
|
53
51
|
@module TopNavBarLayout
|
|
54
52
|
**/
|
|
55
53
|
@withStyle(null, generateComponentTheme)
|
|
56
|
-
@testable()
|
|
57
54
|
class TopNavBarLayout extends Component<TopNavBarLayoutProps> {
|
|
58
55
|
static readonly componentId = 'TopNavBar.Layout'
|
|
59
56
|
|
|
60
|
-
static propTypes = propTypes
|
|
61
57
|
static allowedProps = allowedProps
|
|
62
58
|
static defaultProps = {
|
|
63
59
|
smallViewportConfig: {}
|
|
@@ -23,37 +23,22 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
|
-
import {
|
|
29
|
-
Children as ChildrenPropTypes,
|
|
30
|
-
element
|
|
31
|
-
} from '@instructure/ui-prop-types'
|
|
32
26
|
|
|
33
27
|
import type { WithStyleProps } from '@instructure/emotion'
|
|
34
28
|
import type {
|
|
35
29
|
TopNavBarLayoutTheme,
|
|
36
|
-
OtherHTMLAttributes
|
|
37
|
-
PropValidators
|
|
30
|
+
OtherHTMLAttributes
|
|
38
31
|
} from '@instructure/shared-types'
|
|
39
32
|
|
|
40
|
-
import { TopNavBarActionItems } from '../TopNavBarActionItems'
|
|
41
|
-
import { TopNavBarBrand } from '../TopNavBarBrand'
|
|
42
|
-
import { TopNavBarMenuItems } from '../TopNavBarMenuItems'
|
|
43
|
-
import { TopNavBarUser } from '../TopNavBarUser'
|
|
44
|
-
|
|
45
33
|
import type { ActionItemsChild } from '../TopNavBarActionItems/props'
|
|
46
34
|
import type { BrandChild } from '../TopNavBarBrand/props'
|
|
47
35
|
import type { MenuItemsChild } from '../TopNavBarMenuItems/props'
|
|
48
36
|
import type { UserChild } from '../TopNavBarUser/props'
|
|
49
37
|
import type { BreadcrumbChild } from '../TopNavBarBreadcrumb/props'
|
|
50
38
|
|
|
51
|
-
import { topNavBarItemTooltipPropType } from '../TopNavBarItem/props'
|
|
52
|
-
|
|
53
39
|
import { TopNavBarLayout } from './index'
|
|
54
40
|
import type { DesktopLayoutOwnProps } from './DesktopLayout/props'
|
|
55
41
|
import type { SmallViewportLayoutOwnProps } from './SmallViewportLayout/props'
|
|
56
|
-
import { TopNavBarBreadcrumb } from '../TopNavBarBreadcrumb'
|
|
57
42
|
|
|
58
43
|
type LayoutChild = React.ComponentElement<TopNavBarLayoutProps, TopNavBarLayout>
|
|
59
44
|
|
|
@@ -136,46 +121,6 @@ type TopNavBarLayoutProps = TopNavBarLayoutOwnProps &
|
|
|
136
121
|
WithStyleProps<TopNavBarLayoutTheme, null> &
|
|
137
122
|
OtherHTMLAttributes<TopNavBarLayoutOwnProps>
|
|
138
123
|
|
|
139
|
-
const commonPropTypes: PropValidators<CommonPropKeys> = {
|
|
140
|
-
renderBrand: ChildrenPropTypes.oneOf([TopNavBarBrand]),
|
|
141
|
-
renderMenuItems: ChildrenPropTypes.oneOf([TopNavBarMenuItems]),
|
|
142
|
-
renderActionItems: ChildrenPropTypes.oneOf([TopNavBarActionItems]),
|
|
143
|
-
renderUser: ChildrenPropTypes.oneOf([TopNavBarUser]),
|
|
144
|
-
renderBreadcrumb: ChildrenPropTypes.oneOf([TopNavBarBreadcrumb]),
|
|
145
|
-
navLabel: PropTypes.string,
|
|
146
|
-
elementRef: PropTypes.func
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const desktopPropTypes: PropValidators<DesktopPropKeys> = {
|
|
150
|
-
hideActionsUserSeparator: PropTypes.bool
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const smallViewportPropTypes: PropValidators<SmallViewportPropKeys> = {
|
|
154
|
-
dropdownMenuToggleButtonLabel: PropTypes.string.isRequired,
|
|
155
|
-
dropdownMenuToggleButtonTooltip: topNavBarItemTooltipPropType,
|
|
156
|
-
dropdownMenuLabel: PropTypes.string,
|
|
157
|
-
alternativeTitle: PropTypes.node,
|
|
158
|
-
renderInPlaceDialogConfig: PropTypes.shape({
|
|
159
|
-
open: PropTypes.bool.isRequired,
|
|
160
|
-
onClose: PropTypes.func.isRequired,
|
|
161
|
-
closeButtonLabel: PropTypes.string.isRequired,
|
|
162
|
-
content: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
163
|
-
returnFocusElement: PropTypes.func,
|
|
164
|
-
shouldContainFocus: PropTypes.bool,
|
|
165
|
-
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
166
|
-
shouldCloseOnEscape: PropTypes.bool
|
|
167
|
-
}),
|
|
168
|
-
trayMountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
169
|
-
onDropdownMenuToggle: PropTypes.func,
|
|
170
|
-
onDropdownMenuSelect: PropTypes.func,
|
|
171
|
-
renderNavbarStartDangerousHack: PropTypes.node
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
175
|
-
...commonPropTypes,
|
|
176
|
-
smallViewportConfig: PropTypes.shape(smallViewportPropTypes).isRequired
|
|
177
|
-
}
|
|
178
|
-
|
|
179
124
|
const commonAllowedProps: CommonAllowedPropKeys = [
|
|
180
125
|
'renderBrand',
|
|
181
126
|
'renderMenuItems',
|
|
@@ -206,12 +151,8 @@ const allowedProps: AllowedPropKeys = [
|
|
|
206
151
|
|
|
207
152
|
export type { LayoutChild, CommonTopNavBarLayoutProps, TopNavBarLayoutProps }
|
|
208
153
|
export {
|
|
209
|
-
propTypes,
|
|
210
154
|
allowedProps,
|
|
211
|
-
commonPropTypes,
|
|
212
155
|
commonAllowedProps,
|
|
213
|
-
desktopPropTypes,
|
|
214
|
-
smallViewportPropTypes,
|
|
215
156
|
desktopAllowedProps,
|
|
216
157
|
smallViewportAllowedProps
|
|
217
158
|
}
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
withDeterministicId
|
|
31
31
|
} from '@instructure/ui-react-utils'
|
|
32
32
|
import { warn, error } from '@instructure/console'
|
|
33
|
-
import { testable } from '@instructure/ui-testable'
|
|
34
33
|
|
|
35
34
|
import { withStyle } from '@instructure/emotion'
|
|
36
35
|
|
|
@@ -51,7 +50,7 @@ import type { RenderOptionContent } from '../utils/mapItemsForDrilldown'
|
|
|
51
50
|
import generateStyle from './styles'
|
|
52
51
|
import generateComponentTheme from './theme'
|
|
53
52
|
|
|
54
|
-
import {
|
|
53
|
+
import { allowedProps } from './props'
|
|
55
54
|
import type { TopNavBarMenuItemsProps, TopNavBarMenuItemsState } from './props'
|
|
56
55
|
|
|
57
56
|
/**
|
|
@@ -63,14 +62,12 @@ id: TopNavBar.MenuItems
|
|
|
63
62
|
**/
|
|
64
63
|
@withDeterministicId()
|
|
65
64
|
@withStyle(generateStyle, generateComponentTheme)
|
|
66
|
-
@testable()
|
|
67
65
|
class TopNavBarMenuItems extends Component<
|
|
68
66
|
TopNavBarMenuItemsProps,
|
|
69
67
|
TopNavBarMenuItemsState
|
|
70
68
|
> {
|
|
71
69
|
static readonly componentId = 'TopNavBar.MenuItems'
|
|
72
70
|
|
|
73
|
-
static propTypes = propTypes
|
|
74
71
|
static allowedProps = allowedProps
|
|
75
72
|
static defaultProps = {}
|
|
76
73
|
|
|
@@ -192,7 +189,14 @@ class TopNavBarMenuItems extends Component<
|
|
|
192
189
|
return
|
|
193
190
|
}
|
|
194
191
|
|
|
195
|
-
const {
|
|
192
|
+
const {
|
|
193
|
+
id,
|
|
194
|
+
status,
|
|
195
|
+
variant = 'default', // workaround because after react 19 defaultProps are not working as expected
|
|
196
|
+
renderSubmenu,
|
|
197
|
+
renderAvatar
|
|
198
|
+
} = child.props
|
|
199
|
+
|
|
196
200
|
const isCurrentPage = currentPageId === id
|
|
197
201
|
|
|
198
202
|
if (renderAvatar) {
|
|
@@ -263,6 +267,7 @@ class TopNavBarMenuItems extends Component<
|
|
|
263
267
|
itemSpacing: styles.itemSpacing
|
|
264
268
|
})}
|
|
265
269
|
aria-label={listLabel}
|
|
270
|
+
data-cid="TopNavBarMenuItems"
|
|
266
271
|
>
|
|
267
272
|
{this.renderChildren()}
|
|
268
273
|
</TruncateList>
|
|
@@ -23,20 +23,14 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
29
26
|
|
|
30
27
|
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
31
28
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
32
29
|
import type {
|
|
33
30
|
TopNavBarMenuItemsTheme,
|
|
34
31
|
OtherHTMLAttributes,
|
|
35
|
-
PropValidators,
|
|
36
32
|
ChildrenOfType
|
|
37
33
|
} from '@instructure/shared-types'
|
|
38
|
-
|
|
39
|
-
import { TopNavBarItem } from '../TopNavBarItem'
|
|
40
34
|
import type { ItemChild } from '../TopNavBarItem/props'
|
|
41
35
|
|
|
42
36
|
import { TopNavBarMenuItems } from './index'
|
|
@@ -103,18 +97,6 @@ type TopNavBarMenuItemsState = {
|
|
|
103
97
|
key: number
|
|
104
98
|
visibleItemsCount?: number
|
|
105
99
|
}
|
|
106
|
-
|
|
107
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
108
|
-
children: ChildrenPropTypes.oneOf([TopNavBarItem]),
|
|
109
|
-
currentPageId: PropTypes.string,
|
|
110
|
-
renderHiddenItemsMenuTriggerLabel: PropTypes.oneOfType([
|
|
111
|
-
PropTypes.func,
|
|
112
|
-
PropTypes.string
|
|
113
|
-
]).isRequired,
|
|
114
|
-
listLabel: PropTypes.string,
|
|
115
|
-
elementRef: PropTypes.func
|
|
116
|
-
}
|
|
117
|
-
|
|
118
100
|
const allowedProps: AllowedPropKeys = [
|
|
119
101
|
'children',
|
|
120
102
|
'currentPageId',
|
|
@@ -130,4 +112,4 @@ export type {
|
|
|
130
112
|
TopNavBarMenuItemsStyle,
|
|
131
113
|
TopNavBarMenuItemsState
|
|
132
114
|
}
|
|
133
|
-
export {
|
|
115
|
+
export { allowedProps }
|
|
@@ -26,7 +26,6 @@ import { Component, Children } from 'react'
|
|
|
26
26
|
|
|
27
27
|
import { error } from '@instructure/console'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
-
import { testable } from '@instructure/ui-testable'
|
|
30
29
|
|
|
31
30
|
import { withStyle } from '@instructure/emotion'
|
|
32
31
|
|
|
@@ -35,7 +34,7 @@ import type { ItemChild, TopNavBarItemProps } from '../TopNavBarItem/props'
|
|
|
35
34
|
|
|
36
35
|
import generateStyle from './styles'
|
|
37
36
|
|
|
38
|
-
import {
|
|
37
|
+
import { allowedProps } from './props'
|
|
39
38
|
import type { TopNavBarUserProps } from './props'
|
|
40
39
|
|
|
41
40
|
/**
|
|
@@ -46,11 +45,9 @@ id: TopNavBar.User
|
|
|
46
45
|
@module TopNavBarUser
|
|
47
46
|
**/
|
|
48
47
|
@withStyle(generateStyle, null)
|
|
49
|
-
@testable()
|
|
50
48
|
class TopNavBarUser extends Component<TopNavBarUserProps> {
|
|
51
49
|
static readonly componentId = 'TopNavBar.User'
|
|
52
50
|
|
|
53
|
-
static propTypes = propTypes
|
|
54
51
|
static allowedProps = allowedProps
|
|
55
52
|
static defaultProps = {}
|
|
56
53
|
|
|
@@ -120,6 +117,7 @@ class TopNavBarUser extends Component<TopNavBarUserProps> {
|
|
|
120
117
|
{...omitProps(this.props, allowedProps)}
|
|
121
118
|
ref={this.handleRef}
|
|
122
119
|
css={styles?.topNavBarUser}
|
|
120
|
+
data-cid="TopNavBarUser"
|
|
123
121
|
>
|
|
124
122
|
{this.content}
|
|
125
123
|
</div>
|
|
@@ -23,18 +23,11 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
29
|
-
|
|
30
26
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
31
27
|
import type {
|
|
32
28
|
OtherHTMLAttributes,
|
|
33
|
-
PropValidators,
|
|
34
29
|
ChildrenOfType
|
|
35
30
|
} from '@instructure/shared-types'
|
|
36
|
-
|
|
37
|
-
import { TopNavBarItem } from '../TopNavBarItem'
|
|
38
31
|
import type { ItemChild } from '../TopNavBarItem/props'
|
|
39
32
|
|
|
40
33
|
import { TopNavBarUser } from './index'
|
|
@@ -66,12 +59,6 @@ type TopNavBarUserProps = TopNavBarUserOwnProps &
|
|
|
66
59
|
OtherHTMLAttributes<TopNavBarUserOwnProps>
|
|
67
60
|
|
|
68
61
|
type TopNavBarUserStyle = ComponentStyle<'topNavBarUser'>
|
|
69
|
-
|
|
70
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
71
|
-
children: ChildrenPropTypes.oneOf([TopNavBarItem]).isRequired,
|
|
72
|
-
elementRef: PropTypes.func
|
|
73
|
-
}
|
|
74
|
-
|
|
75
62
|
const allowedProps: AllowedPropKeys = ['children', 'elementRef']
|
|
76
63
|
|
|
77
64
|
export type {
|
|
@@ -80,4 +67,4 @@ export type {
|
|
|
80
67
|
TopNavBarUserOwnProps,
|
|
81
68
|
TopNavBarUserStyle
|
|
82
69
|
}
|
|
83
|
-
export {
|
|
70
|
+
export { allowedProps }
|
package/src/TopNavBar/index.tsx
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { error } from '@instructure/console'
|
|
28
|
-
import { testable } from '@instructure/ui-testable'
|
|
29
28
|
import { px } from '@instructure/ui-utils'
|
|
30
29
|
import { matchComponentTypes } from '@instructure/ui-react-utils'
|
|
31
30
|
|
|
@@ -42,7 +41,7 @@ import { TopNavBarBreadcrumb } from './TopNavBarBreadcrumb'
|
|
|
42
41
|
import { TopNavBarContext } from './TopNavBarContext'
|
|
43
42
|
import type { TopNavBarLayouts } from './TopNavBarContext'
|
|
44
43
|
|
|
45
|
-
import {
|
|
44
|
+
import { allowedProps } from './props'
|
|
46
45
|
import type { TopNavBarProps } from './props'
|
|
47
46
|
|
|
48
47
|
/**
|
|
@@ -50,7 +49,6 @@ import type { TopNavBarProps } from './props'
|
|
|
50
49
|
category: components
|
|
51
50
|
---
|
|
52
51
|
**/
|
|
53
|
-
@testable()
|
|
54
52
|
class TopNavBar extends Component<TopNavBarProps> {
|
|
55
53
|
static readonly componentId = 'TopNavBar'
|
|
56
54
|
|
|
@@ -65,7 +63,6 @@ class TopNavBar extends Component<TopNavBarProps> {
|
|
|
65
63
|
|
|
66
64
|
static contextType = TopNavBarContext
|
|
67
65
|
|
|
68
|
-
static propTypes = propTypes
|
|
69
66
|
static allowedProps = allowedProps
|
|
70
67
|
static defaultProps = {
|
|
71
68
|
breakpoint: 1024,
|
|
@@ -94,6 +91,7 @@ class TopNavBar extends Component<TopNavBarProps> {
|
|
|
94
91
|
|
|
95
92
|
return (
|
|
96
93
|
<Responsive
|
|
94
|
+
data-cid="TopNavBar"
|
|
97
95
|
elementRef={this.handleRef}
|
|
98
96
|
match={mediaQueryMatch}
|
|
99
97
|
query={{
|
package/src/TopNavBar/props.ts
CHANGED
|
@@ -22,12 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
import type {
|
|
28
|
-
OtherHTMLAttributes,
|
|
29
|
-
PropValidators
|
|
30
|
-
} from '@instructure/shared-types'
|
|
25
|
+
import type { OtherHTMLAttributes } from '@instructure/shared-types'
|
|
31
26
|
|
|
32
27
|
import type { ActionItemsChild } from './TopNavBarActionItems/props'
|
|
33
28
|
import type { BrandChild } from './TopNavBarBrand/props'
|
|
@@ -35,7 +30,6 @@ import type { ItemChild } from './TopNavBarItem/props'
|
|
|
35
30
|
import type { LayoutChild } from './TopNavBarLayout/props'
|
|
36
31
|
import type { MenuItemsChild } from './TopNavBarMenuItems/props'
|
|
37
32
|
import type { UserChild } from './TopNavBarUser/props'
|
|
38
|
-
|
|
39
33
|
import type { TopNavBarContextType } from './TopNavBarContext'
|
|
40
34
|
|
|
41
35
|
type TopNavBarOwnProps = {
|
|
@@ -77,15 +71,6 @@ type PropKeys = keyof TopNavBarOwnProps
|
|
|
77
71
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
78
72
|
|
|
79
73
|
type TopNavBarProps = TopNavBarOwnProps & OtherHTMLAttributes<TopNavBarOwnProps>
|
|
80
|
-
|
|
81
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
82
|
-
children: PropTypes.func,
|
|
83
|
-
breakpoint: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
84
|
-
mediaQueryMatch: PropTypes.oneOf(['element', 'media']),
|
|
85
|
-
inverseColor: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
|
|
86
|
-
elementRef: PropTypes.func
|
|
87
|
-
}
|
|
88
|
-
|
|
89
74
|
const allowedProps: AllowedPropKeys = [
|
|
90
75
|
'children',
|
|
91
76
|
'breakpoint',
|
|
@@ -105,4 +90,4 @@ export type {
|
|
|
105
90
|
MenuItemsChild,
|
|
106
91
|
UserChild
|
|
107
92
|
}
|
|
108
|
-
export {
|
|
93
|
+
export { allowedProps }
|