@instructure/ui-global-nav 0.0.0-stage → 11.7.10
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 +0 -0
- package/LICENSE.md +28 -0
- package/README.md +25 -2
- package/es/GlobalNav/v1/CollapseButton/index.js +80 -0
- package/es/GlobalNav/v1/CollapseButton/props.js +1 -0
- package/es/GlobalNav/v1/CollapseButton/styles.js +64 -0
- package/es/GlobalNav/v1/CollapsedSubNav/index.js +59 -0
- package/es/GlobalNav/v1/CollapsedSubNav/props.js +1 -0
- package/es/GlobalNav/v1/CollapsedSubNav/styles.js +82 -0
- package/es/GlobalNav/v1/InstitutionLogo/index.js +93 -0
- package/es/GlobalNav/v1/InstitutionLogo/props.js +1 -0
- package/es/GlobalNav/v1/InstitutionLogo/styles.js +69 -0
- package/es/GlobalNav/v1/MainNavItem/index.js +129 -0
- package/es/GlobalNav/v1/MainNavItem/props.js +1 -0
- package/es/GlobalNav/v1/MainNavItem/styles.js +117 -0
- package/es/GlobalNav/v1/SubNav/index.js +121 -0
- package/es/GlobalNav/v1/SubNav/props.js +1 -0
- package/es/GlobalNav/v1/SubNav/styles.js +52 -0
- package/es/GlobalNav/v1/SubNavItem/index.js +78 -0
- package/es/GlobalNav/v1/SubNavItem/props.js +1 -0
- package/es/GlobalNav/v1/SubNavItem/styles.js +94 -0
- package/es/GlobalNav/v1/SubNavLevel/index.js +160 -0
- package/es/GlobalNav/v1/SubNavLevel/props.js +1 -0
- package/es/GlobalNav/v1/SubNavLevel/styles.js +94 -0
- package/es/GlobalNav/v1/index.js +222 -0
- package/es/GlobalNav/v1/props.js +28 -0
- package/es/GlobalNav/v1/styles.js +110 -0
- package/es/GlobalNav/v1/utils/getItemElementProps.js +64 -0
- package/es/exports/a.js +24 -0
- package/lib/GlobalNav/v1/CollapseButton/index.js +85 -0
- package/lib/GlobalNav/v1/CollapseButton/props.js +5 -0
- package/lib/GlobalNav/v1/CollapseButton/styles.js +70 -0
- package/lib/GlobalNav/v1/CollapsedSubNav/index.js +64 -0
- package/lib/GlobalNav/v1/CollapsedSubNav/props.js +5 -0
- package/lib/GlobalNav/v1/CollapsedSubNav/styles.js +88 -0
- package/lib/GlobalNav/v1/InstitutionLogo/index.js +98 -0
- package/lib/GlobalNav/v1/InstitutionLogo/props.js +5 -0
- package/lib/GlobalNav/v1/InstitutionLogo/styles.js +75 -0
- package/lib/GlobalNav/v1/MainNavItem/index.js +134 -0
- package/lib/GlobalNav/v1/MainNavItem/props.js +5 -0
- package/lib/GlobalNav/v1/MainNavItem/styles.js +123 -0
- package/lib/GlobalNav/v1/SubNav/index.js +128 -0
- package/lib/GlobalNav/v1/SubNav/props.js +5 -0
- package/lib/GlobalNav/v1/SubNav/styles.js +58 -0
- package/lib/GlobalNav/v1/SubNavItem/index.js +83 -0
- package/lib/GlobalNav/v1/SubNavItem/props.js +5 -0
- package/lib/GlobalNav/v1/SubNavItem/styles.js +100 -0
- package/lib/GlobalNav/v1/SubNavLevel/index.js +165 -0
- package/lib/GlobalNav/v1/SubNavLevel/props.js +5 -0
- package/lib/GlobalNav/v1/SubNavLevel/styles.js +100 -0
- package/lib/GlobalNav/v1/index.js +228 -0
- package/lib/GlobalNav/v1/props.js +33 -0
- package/lib/GlobalNav/v1/styles.js +116 -0
- package/lib/GlobalNav/v1/utils/getItemElementProps.js +70 -0
- package/lib/exports/a.js +12 -0
- package/lib/package.json +1 -0
- package/package.json +77 -3
- package/src/GlobalNav/v1/CollapseButton/index.tsx +87 -0
- package/src/GlobalNav/v1/CollapseButton/props.ts +64 -0
- package/src/GlobalNav/v1/CollapseButton/styles.ts +76 -0
- package/src/GlobalNav/v1/CollapsedSubNav/index.tsx +60 -0
- package/src/GlobalNav/v1/CollapsedSubNav/props.ts +42 -0
- package/src/GlobalNav/v1/CollapsedSubNav/styles.ts +92 -0
- package/src/GlobalNav/v1/InstitutionLogo/index.tsx +86 -0
- package/src/GlobalNav/v1/InstitutionLogo/props.ts +42 -0
- package/src/GlobalNav/v1/InstitutionLogo/styles.ts +82 -0
- package/src/GlobalNav/v1/MainNavItem/index.tsx +132 -0
- package/src/GlobalNav/v1/MainNavItem/props.ts +65 -0
- package/src/GlobalNav/v1/MainNavItem/styles.ts +137 -0
- package/src/GlobalNav/v1/README.md +234 -0
- package/src/GlobalNav/v1/SubNav/index.tsx +132 -0
- package/src/GlobalNav/v1/SubNav/props.ts +81 -0
- package/src/GlobalNav/v1/SubNav/styles.ts +58 -0
- package/src/GlobalNav/v1/SubNavItem/index.tsx +79 -0
- package/src/GlobalNav/v1/SubNavItem/props.ts +48 -0
- package/src/GlobalNav/v1/SubNavItem/styles.ts +110 -0
- package/src/GlobalNav/v1/SubNavLevel/index.tsx +193 -0
- package/src/GlobalNav/v1/SubNavLevel/props.ts +75 -0
- package/src/GlobalNav/v1/SubNavLevel/styles.ts +103 -0
- package/src/GlobalNav/v1/index.tsx +256 -0
- package/src/GlobalNav/v1/props.ts +328 -0
- package/src/GlobalNav/v1/styles.ts +132 -0
- package/src/GlobalNav/v1/utils/getItemElementProps.ts +80 -0
- package/src/exports/a.ts +35 -0
- package/tsconfig.build.json +53 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +4 -0
- package/types/GlobalNav/v1/CollapseButton/index.d.ts +11 -0
- package/types/GlobalNav/v1/CollapseButton/index.d.ts.map +1 -0
- package/types/GlobalNav/v1/CollapseButton/props.d.ts +31 -0
- package/types/GlobalNav/v1/CollapseButton/props.d.ts.map +1 -0
- package/types/GlobalNav/v1/CollapseButton/styles.d.ts +22 -0
- package/types/GlobalNav/v1/CollapseButton/styles.d.ts.map +1 -0
- package/types/GlobalNav/v1/CollapsedSubNav/index.d.ts +11 -0
- package/types/GlobalNav/v1/CollapsedSubNav/index.d.ts.map +1 -0
- package/types/GlobalNav/v1/CollapsedSubNav/props.d.ts +15 -0
- package/types/GlobalNav/v1/CollapsedSubNav/props.d.ts.map +1 -0
- package/types/GlobalNav/v1/CollapsedSubNav/styles.d.ts +14 -0
- package/types/GlobalNav/v1/CollapsedSubNav/styles.d.ts.map +1 -0
- package/types/GlobalNav/v1/InstitutionLogo/index.d.ts +11 -0
- package/types/GlobalNav/v1/InstitutionLogo/index.d.ts.map +1 -0
- package/types/GlobalNav/v1/InstitutionLogo/props.d.ts +15 -0
- package/types/GlobalNav/v1/InstitutionLogo/props.d.ts.map +1 -0
- package/types/GlobalNav/v1/InstitutionLogo/styles.d.ts +20 -0
- package/types/GlobalNav/v1/InstitutionLogo/styles.d.ts.map +1 -0
- package/types/GlobalNav/v1/MainNavItem/index.d.ts +11 -0
- package/types/GlobalNav/v1/MainNavItem/index.d.ts.map +1 -0
- package/types/GlobalNav/v1/MainNavItem/props.d.ts +32 -0
- package/types/GlobalNav/v1/MainNavItem/props.d.ts.map +1 -0
- package/types/GlobalNav/v1/MainNavItem/styles.d.ts +19 -0
- package/types/GlobalNav/v1/MainNavItem/styles.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNav/index.d.ts +11 -0
- package/types/GlobalNav/v1/SubNav/index.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNav/props.d.ts +52 -0
- package/types/GlobalNav/v1/SubNav/props.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNav/styles.d.ts +13 -0
- package/types/GlobalNav/v1/SubNav/styles.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNavItem/index.d.ts +11 -0
- package/types/GlobalNav/v1/SubNavItem/index.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNavItem/props.d.ts +20 -0
- package/types/GlobalNav/v1/SubNavItem/props.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNavItem/styles.d.ts +18 -0
- package/types/GlobalNav/v1/SubNavItem/styles.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNavLevel/index.d.ts +11 -0
- package/types/GlobalNav/v1/SubNavLevel/index.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNavLevel/props.d.ts +45 -0
- package/types/GlobalNav/v1/SubNavLevel/props.d.ts.map +1 -0
- package/types/GlobalNav/v1/SubNavLevel/styles.d.ts +14 -0
- package/types/GlobalNav/v1/SubNavLevel/styles.d.ts.map +1 -0
- package/types/GlobalNav/v1/index.d.ts +59 -0
- package/types/GlobalNav/v1/index.d.ts.map +1 -0
- package/types/GlobalNav/v1/props.d.ts +247 -0
- package/types/GlobalNav/v1/props.d.ts.map +1 -0
- package/types/GlobalNav/v1/styles.d.ts +23 -0
- package/types/GlobalNav/v1/styles.d.ts.map +1 -0
- package/types/GlobalNav/v1/utils/getItemElementProps.d.ts +37 -0
- package/types/GlobalNav/v1/utils/getItemElementProps.d.ts.map +1 -0
- package/types/exports/a.d.ts +3 -0
- package/types/exports/a.d.ts.map +1 -0
|
@@ -0,0 +1,94 @@
|
|
|
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 componentTheme The theme variable object.
|
|
31
|
+
* @param sharedTokens Shared token object that stores common values for the theme.
|
|
32
|
+
* @return The final style object, which will be used in the component
|
|
33
|
+
*/
|
|
34
|
+
const generateStyle = (componentTheme, _params, sharedTokens) => {
|
|
35
|
+
const focusRingSize = `calc(${sharedTokens.focusOutline.width} + ${sharedTokens.focusOutline.offset})`;
|
|
36
|
+
return {
|
|
37
|
+
level: {
|
|
38
|
+
label: 'subNavLevel',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
flex: 1,
|
|
42
|
+
minHeight: 0,
|
|
43
|
+
boxSizing: 'border-box',
|
|
44
|
+
gap: componentTheme.gap,
|
|
45
|
+
padding: componentTheme.padding,
|
|
46
|
+
// GlobalNav sets the variable, so the close handle lines up with the rail's collapse button
|
|
47
|
+
paddingTop: `var(--globalNav-collapseButtonTop, ${componentTheme.padding})`
|
|
48
|
+
},
|
|
49
|
+
header: {
|
|
50
|
+
label: 'subNavLevel__header',
|
|
51
|
+
display: 'flex',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
justifyContent: 'flex-end'
|
|
54
|
+
},
|
|
55
|
+
back: {
|
|
56
|
+
label: 'subNavLevel__back',
|
|
57
|
+
// pushes the close handle to the end, and lets a long parent title shrink
|
|
58
|
+
marginInlineEnd: 'auto',
|
|
59
|
+
minWidth: 0
|
|
60
|
+
},
|
|
61
|
+
title: {
|
|
62
|
+
label: 'subNavLevel__title',
|
|
63
|
+
margin: 0,
|
|
64
|
+
fontFamily: componentTheme.titleFontFamily,
|
|
65
|
+
fontSize: componentTheme.titleFontSize,
|
|
66
|
+
fontWeight: componentTheme.titleFontWeight,
|
|
67
|
+
lineHeight: componentTheme.titleLineHeight
|
|
68
|
+
},
|
|
69
|
+
divider: {
|
|
70
|
+
label: 'subNavLevel__divider',
|
|
71
|
+
// SubNav has no divider width token
|
|
72
|
+
borderTop: `0.0625rem solid ${componentTheme.strokeColor}`
|
|
73
|
+
},
|
|
74
|
+
body: {
|
|
75
|
+
label: 'subNavLevel__body',
|
|
76
|
+
flex: 1,
|
|
77
|
+
minHeight: 0,
|
|
78
|
+
overflowY: 'auto',
|
|
79
|
+
// the scroll container clips focus rings that reach past its edges
|
|
80
|
+
padding: focusRingSize,
|
|
81
|
+
margin: `calc(-1 * ${focusRingSize})`
|
|
82
|
+
},
|
|
83
|
+
items: {
|
|
84
|
+
label: 'subNavLevel__items',
|
|
85
|
+
display: 'flex',
|
|
86
|
+
flexDirection: 'column',
|
|
87
|
+
gap: componentTheme.navItemsGap,
|
|
88
|
+
listStyle: 'none',
|
|
89
|
+
margin: 0,
|
|
90
|
+
padding: 0
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export default generateStyle;
|
|
@@ -0,0 +1,222 @@
|
|
|
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 { forwardRef, useEffect, useLayoutEffect, useRef } from 'react';
|
|
26
|
+
import { useStyleNew } from '@instructure/emotion';
|
|
27
|
+
import { omitProps, useDeterministicId } from '@instructure/ui-react-utils';
|
|
28
|
+
import { allowedProps } from './props.js';
|
|
29
|
+
import generateStyle, { generateMainNavStyle } from './styles.js';
|
|
30
|
+
import { CollapseButton } from './CollapseButton/index.js';
|
|
31
|
+
import { CollapsedSubNav } from './CollapsedSubNav/index.js';
|
|
32
|
+
import { InstitutionLogo } from './InstitutionLogo/index.js';
|
|
33
|
+
import { MainNavItem } from './MainNavItem/index.js';
|
|
34
|
+
import { SubNav } from './SubNav/index.js';
|
|
35
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
36
|
+
// React 18 warns about useLayoutEffect on the server, where there is no layout to measure
|
|
37
|
+
const useClientLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
---
|
|
41
|
+
category: components
|
|
42
|
+
isWIP: true
|
|
43
|
+
---
|
|
44
|
+
**/
|
|
45
|
+
const GlobalNav = /*#__PURE__*/forwardRef((props, ref) => {
|
|
46
|
+
const {
|
|
47
|
+
label,
|
|
48
|
+
collapsed,
|
|
49
|
+
onCollapse,
|
|
50
|
+
collapseLabel,
|
|
51
|
+
expandLabel,
|
|
52
|
+
backLabel,
|
|
53
|
+
closeSubNavLabel,
|
|
54
|
+
collapseSubNavLabel,
|
|
55
|
+
expandSubNavLabel,
|
|
56
|
+
openSubNav,
|
|
57
|
+
onSubNavChange,
|
|
58
|
+
items,
|
|
59
|
+
logo,
|
|
60
|
+
themeOverride
|
|
61
|
+
} = props;
|
|
62
|
+
const openItem = items.find(item => item.itemID === openSubNav && item.subNav);
|
|
63
|
+
const styles = useStyleNew({
|
|
64
|
+
generateStyle,
|
|
65
|
+
themeOverride,
|
|
66
|
+
params: {
|
|
67
|
+
collapsed,
|
|
68
|
+
subNavOpen: !!openItem
|
|
69
|
+
},
|
|
70
|
+
componentId: 'GlobalNav',
|
|
71
|
+
displayName: 'GlobalNav'
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// MainNav is a separate token set, and useStyleNew reads one set per call
|
|
75
|
+
const mainNavStyles = useStyleNew({
|
|
76
|
+
generateStyle: generateMainNavStyle,
|
|
77
|
+
params: {
|
|
78
|
+
collapsed
|
|
79
|
+
},
|
|
80
|
+
componentId: 'MainNav'
|
|
81
|
+
});
|
|
82
|
+
const getId = useDeterministicId('GlobalNav');
|
|
83
|
+
const subNavId = getId('GlobalNav-subNav');
|
|
84
|
+
const titleId = getId('GlobalNav-subNavTitle');
|
|
85
|
+
const focusIntentRef = useRef();
|
|
86
|
+
const triggerRefs = useRef(new Map());
|
|
87
|
+
const renderedSubNavRef = useRef();
|
|
88
|
+
const railRef = useRef(null);
|
|
89
|
+
const headerRef = useRef(null);
|
|
90
|
+
const collapseButtonRef = useRef(null);
|
|
91
|
+
|
|
92
|
+
// the SubNav buttons line up with the rail's collapse button, whose position depends on the logo
|
|
93
|
+
const updateCollapseButtonTop = () => {
|
|
94
|
+
const rail = railRef.current;
|
|
95
|
+
const button = collapseButtonRef.current;
|
|
96
|
+
if (!rail || !button) return;
|
|
97
|
+
const buttonRect = button.getBoundingClientRect();
|
|
98
|
+
const top = buttonRect.top - rail.getBoundingClientRect().top - rail.clientTop;
|
|
99
|
+
rail.style.setProperty('--globalNav-collapseButtonTop', `${top}px`);
|
|
100
|
+
rail.style.setProperty('--globalNav-collapseButtonHeight', `${buttonRect.height}px`);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// after every render, because the theme and the collapsed state move the button,
|
|
104
|
+
// and before paint, so a SubNav that is open on page load doesn't jump
|
|
105
|
+
useClientLayoutEffect(updateCollapseButtonTop);
|
|
106
|
+
|
|
107
|
+
// the header also resizes without a render, for example when the logo image loads
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const header = headerRef.current;
|
|
110
|
+
if (!header || typeof ResizeObserver === 'undefined') return;
|
|
111
|
+
const observer = new ResizeObserver(updateCollapseButtonTop);
|
|
112
|
+
observer.observe(header);
|
|
113
|
+
return () => observer.disconnect();
|
|
114
|
+
}, []);
|
|
115
|
+
|
|
116
|
+
// the SubNav of the current page collapses to a strip, other SubNavs close completely
|
|
117
|
+
const currentSectionItem = items.find(item => item.current && item.subNav);
|
|
118
|
+
const collapsible = !!openItem && openItem.itemID === currentSectionItem?.itemID;
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const intent = focusIntentRef.current;
|
|
121
|
+
// an intent lives for one commit, so a change that the app ignores doesn't move focus later
|
|
122
|
+
focusIntentRef.current = undefined;
|
|
123
|
+
const closedID = renderedSubNavRef.current;
|
|
124
|
+
renderedSubNavRef.current = openItem?.itemID;
|
|
125
|
+
if (!openItem && closedID !== undefined && (intent?.target === 'trigger' || intent?.target === 'rescue')) {
|
|
126
|
+
triggerRefs.current.get(closedID)?.focus();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const handleItemActivate = (event, item) => {
|
|
130
|
+
if (item.subNav) {
|
|
131
|
+
const next = openSubNav === item.itemID ? undefined : item.itemID;
|
|
132
|
+
focusIntentRef.current = next ? {
|
|
133
|
+
target: 'first'
|
|
134
|
+
} : {
|
|
135
|
+
target: 'trigger'
|
|
136
|
+
};
|
|
137
|
+
onSubNavChange?.(event, next);
|
|
138
|
+
} else if (openItem &&
|
|
139
|
+
// a link opened in a new tab or window keeps the SubNav open
|
|
140
|
+
!(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) {
|
|
141
|
+
focusIntentRef.current = {
|
|
142
|
+
target: 'none'
|
|
143
|
+
};
|
|
144
|
+
onSubNavChange?.(event, undefined);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const handleSubNavClose = event => {
|
|
148
|
+
focusIntentRef.current = {
|
|
149
|
+
target: 'trigger'
|
|
150
|
+
};
|
|
151
|
+
onSubNavChange?.(event, undefined);
|
|
152
|
+
};
|
|
153
|
+
const handleSubNavExpand = event => {
|
|
154
|
+
if (!currentSectionItem) return;
|
|
155
|
+
focusIntentRef.current = {
|
|
156
|
+
target: 'first'
|
|
157
|
+
};
|
|
158
|
+
onSubNavChange?.(event, currentSectionItem.itemID);
|
|
159
|
+
};
|
|
160
|
+
return _jsx("nav", {
|
|
161
|
+
...omitProps(props, allowedProps),
|
|
162
|
+
ref: ref,
|
|
163
|
+
"aria-label": label,
|
|
164
|
+
css: styles?.globalNav,
|
|
165
|
+
children: _jsxs("div", {
|
|
166
|
+
ref: railRef,
|
|
167
|
+
css: styles?.rail,
|
|
168
|
+
children: [_jsxs("div", {
|
|
169
|
+
css: mainNavStyles?.mainNav,
|
|
170
|
+
children: [_jsxs("div", {
|
|
171
|
+
ref: headerRef,
|
|
172
|
+
css: mainNavStyles?.header,
|
|
173
|
+
children: [_jsx(InstitutionLogo, {
|
|
174
|
+
logo: logo,
|
|
175
|
+
collapsed: collapsed
|
|
176
|
+
}), _jsx(CollapseButton, {
|
|
177
|
+
collapsed: collapsed,
|
|
178
|
+
collapseLabel: collapseLabel,
|
|
179
|
+
expandLabel: expandLabel,
|
|
180
|
+
onCollapse: onCollapse,
|
|
181
|
+
elementRef: element => {
|
|
182
|
+
collapseButtonRef.current = element;
|
|
183
|
+
}
|
|
184
|
+
})]
|
|
185
|
+
}), !collapsed && _jsx("div", {
|
|
186
|
+
css: mainNavStyles?.divider
|
|
187
|
+
}), _jsx("ul", {
|
|
188
|
+
css: mainNavStyles?.items,
|
|
189
|
+
children: items.map(item => _jsx(MainNavItem, {
|
|
190
|
+
item: item,
|
|
191
|
+
collapsed: collapsed,
|
|
192
|
+
open: openSubNav === item.itemID,
|
|
193
|
+
subNavId: openItem?.itemID === item.itemID ? subNavId : undefined,
|
|
194
|
+
onActivate: handleItemActivate,
|
|
195
|
+
elementRef: element => {
|
|
196
|
+
if (element) {
|
|
197
|
+
triggerRefs.current.set(item.itemID, element);
|
|
198
|
+
} else {
|
|
199
|
+
triggerRefs.current.delete(item.itemID);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}, item.itemID))
|
|
203
|
+
})]
|
|
204
|
+
}), openItem?.subNav ? _jsx(SubNav, {
|
|
205
|
+
subNav: openItem.subNav,
|
|
206
|
+
subNavId: subNavId,
|
|
207
|
+
titleId: titleId,
|
|
208
|
+
collapsible: collapsible,
|
|
209
|
+
closeSubNavLabel: collapsible ? collapseSubNavLabel ?? closeSubNavLabel : closeSubNavLabel,
|
|
210
|
+
backLabel: backLabel,
|
|
211
|
+
onClose: handleSubNavClose,
|
|
212
|
+
focusIntentRef: focusIntentRef
|
|
213
|
+
}, openItem.itemID) : currentSectionItem && _jsx(CollapsedSubNav, {
|
|
214
|
+
label: expandSubNavLabel,
|
|
215
|
+
onExpand: handleSubNavExpand
|
|
216
|
+
})]
|
|
217
|
+
})
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
GlobalNav.displayName = 'GlobalNav';
|
|
221
|
+
export default GlobalNav;
|
|
222
|
+
export { GlobalNav };
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
// a SubNav shows either items or custom content, never both
|
|
26
|
+
|
|
27
|
+
const allowedProps = ['label', 'collapsed', 'onCollapse', 'collapseLabel', 'expandLabel', 'backLabel', 'closeSubNavLabel', 'collapseSubNavLabel', 'expandSubNavLabel', 'openSubNav', 'onSubNavChange', 'items', 'logo', 'account'];
|
|
28
|
+
export { allowedProps };
|
|
@@ -0,0 +1,110 @@
|
|
|
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 { boxShadowObjectsToCSSString } from '@instructure/ui-themes';
|
|
26
|
+
/**
|
|
27
|
+
* ---
|
|
28
|
+
* private: true
|
|
29
|
+
* ---
|
|
30
|
+
* Generates the style object from the theme and provided additional information
|
|
31
|
+
* @param componentTheme The theme variable object.
|
|
32
|
+
* @param params Additional parameters to customize the style.
|
|
33
|
+
* @return The final style object, which will be used in the component
|
|
34
|
+
*/
|
|
35
|
+
const generateStyle = (componentTheme, params) => {
|
|
36
|
+
const {
|
|
37
|
+
collapsed,
|
|
38
|
+
subNavOpen
|
|
39
|
+
} = params;
|
|
40
|
+
return {
|
|
41
|
+
globalNav: {
|
|
42
|
+
label: 'globalNav',
|
|
43
|
+
display: 'flex',
|
|
44
|
+
// fixed while no SubNav is open, so showing the strip doesn't move the page
|
|
45
|
+
width: subNavOpen ? 'fit-content' : collapsed ? componentTheme.minimizedminWidth : componentTheme.minWidth,
|
|
46
|
+
flexShrink: 0,
|
|
47
|
+
height: '100%',
|
|
48
|
+
boxSizing: 'border-box',
|
|
49
|
+
// the width tokens include the outer gap, which is this padding
|
|
50
|
+
padding: collapsed ? componentTheme.minimizedMargin : componentTheme.margin
|
|
51
|
+
},
|
|
52
|
+
rail: {
|
|
53
|
+
label: 'globalNav__rail',
|
|
54
|
+
display: 'flex',
|
|
55
|
+
// the rail can be wider than the width tokens, so it overflows into the padding instead of shrinking
|
|
56
|
+
flexShrink: 0,
|
|
57
|
+
boxSizing: 'border-box',
|
|
58
|
+
backgroundColor: componentTheme.backgroundColor,
|
|
59
|
+
border: `${componentTheme.borderWidth} solid ${componentTheme.borderColor}`,
|
|
60
|
+
borderRadius: collapsed ? componentTheme.minimizedBorderRadius : componentTheme.borderRadius,
|
|
61
|
+
boxShadow: boxShadowObjectsToCSSString(componentTheme.boxShadow)
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Generates the style object of the main column from the `MainNav` tokens
|
|
68
|
+
*/
|
|
69
|
+
const generateMainNavStyle = (componentTheme, params) => {
|
|
70
|
+
const {
|
|
71
|
+
collapsed
|
|
72
|
+
} = params;
|
|
73
|
+
return {
|
|
74
|
+
mainNav: {
|
|
75
|
+
label: 'mainNav',
|
|
76
|
+
width: collapsed ? componentTheme.minimizedWidth : componentTheme.width,
|
|
77
|
+
flexShrink: 0,
|
|
78
|
+
boxSizing: 'border-box',
|
|
79
|
+
display: 'flex',
|
|
80
|
+
flexDirection: 'column',
|
|
81
|
+
gap: collapsed ? componentTheme.minimizedGap : componentTheme.gap,
|
|
82
|
+
padding: collapsed ? `${componentTheme.minimizedGap} ${componentTheme.minimizedMargin}` : componentTheme.margin
|
|
83
|
+
},
|
|
84
|
+
header: {
|
|
85
|
+
label: 'mainNav__header',
|
|
86
|
+
display: 'flex',
|
|
87
|
+
flexDirection: collapsed ? 'column' : 'row',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
justifyContent: collapsed ? 'center' : 'flex-end',
|
|
90
|
+
gap: collapsed ? componentTheme.minimizedGap : componentTheme.gap
|
|
91
|
+
},
|
|
92
|
+
items: {
|
|
93
|
+
label: 'mainNav__items',
|
|
94
|
+
display: 'flex',
|
|
95
|
+
flexDirection: 'column',
|
|
96
|
+
alignItems: collapsed ? 'center' : 'stretch',
|
|
97
|
+
gap: componentTheme.navItemsGap,
|
|
98
|
+
listStyle: 'none',
|
|
99
|
+
margin: 0,
|
|
100
|
+
padding: 0
|
|
101
|
+
},
|
|
102
|
+
divider: {
|
|
103
|
+
label: 'mainNav__divider',
|
|
104
|
+
// MainNav has no divider width token
|
|
105
|
+
borderTop: `0.0625rem solid ${componentTheme.strokeColor}`
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export default generateStyle;
|
|
110
|
+
export { generateMainNavStyle };
|
|
@@ -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
|
+
|
|
25
|
+
import { safeLinkProps } from '@instructure/ui-utils';
|
|
26
|
+
/**
|
|
27
|
+
* ---
|
|
28
|
+
* private: true
|
|
29
|
+
* ---
|
|
30
|
+
* Returns the props of the item's `<a>` or `<button>`, and `isLink` to tell which one to render
|
|
31
|
+
*/
|
|
32
|
+
const getItemElementProps = (item, onActivate, disclosureProps) => {
|
|
33
|
+
const isLink = !!item.href && !item.subNav;
|
|
34
|
+
const handleClick = event => {
|
|
35
|
+
item.onClick?.(event);
|
|
36
|
+
onActivate?.(event);
|
|
37
|
+
};
|
|
38
|
+
const ownProps = isLink ? {
|
|
39
|
+
// drops unsafe hrefs, for example javascript: URLs that would run code on click
|
|
40
|
+
...safeLinkProps({
|
|
41
|
+
href: item.href,
|
|
42
|
+
tag: 'a',
|
|
43
|
+
attr: 'href',
|
|
44
|
+
target: item.elementProps?.target,
|
|
45
|
+
rel: item.elementProps?.rel
|
|
46
|
+
}),
|
|
47
|
+
onClick: handleClick
|
|
48
|
+
} : {
|
|
49
|
+
type: 'button',
|
|
50
|
+
onClick: handleClick,
|
|
51
|
+
...disclosureProps
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
isLink,
|
|
55
|
+
// InstUI's own props come last, so the app can't override them
|
|
56
|
+
props: {
|
|
57
|
+
...item.elementProps,
|
|
58
|
+
...ownProps,
|
|
59
|
+
'aria-current': item.current ? 'page' : undefined
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export default getItemElementProps;
|
|
64
|
+
export { getItemElementProps };
|
package/es/exports/a.js
ADDED
|
@@ -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 { GlobalNav } from '../GlobalNav/v1/index.js';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.CollapseButton = void 0;
|
|
8
|
+
var _emotion = require("@instructure/emotion");
|
|
9
|
+
var _latest = require("@instructure/ui-buttons/latest");
|
|
10
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
11
|
+
var _styles = _interopRequireWildcard(require("./styles.js"));
|
|
12
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
13
|
+
/*
|
|
14
|
+
* The MIT License (MIT)
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
17
|
+
*
|
|
18
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
20
|
+
* in the Software without restriction, including without limitation the rights
|
|
21
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
22
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
23
|
+
* furnished to do so, subject to the following conditions:
|
|
24
|
+
*
|
|
25
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
26
|
+
* copies or substantial portions of the Software.
|
|
27
|
+
*
|
|
28
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
33
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
34
|
+
* SOFTWARE.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
---
|
|
39
|
+
private: true
|
|
40
|
+
id: GlobalNav.CollapseButton
|
|
41
|
+
---
|
|
42
|
+
**/const CollapseButton = props => {
|
|
43
|
+
const {
|
|
44
|
+
collapsed,
|
|
45
|
+
collapseLabel,
|
|
46
|
+
expandLabel,
|
|
47
|
+
onCollapse,
|
|
48
|
+
elementRef
|
|
49
|
+
} = props;
|
|
50
|
+
const styles = (0, _emotion.useStyleNew)({
|
|
51
|
+
generateStyle: _styles.default,
|
|
52
|
+
params: {
|
|
53
|
+
collapsed
|
|
54
|
+
},
|
|
55
|
+
componentId: 'CollapseButton'
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// MainNavItem is a separate token set, and useStyleNew reads one set per call
|
|
59
|
+
const iconStyles = (0, _emotion.useStyleNew)({
|
|
60
|
+
generateStyle: _styles.generateIconStyle,
|
|
61
|
+
componentId: 'CollapseButton',
|
|
62
|
+
useTokensFrom: 'MainNavItem'
|
|
63
|
+
});
|
|
64
|
+
const label = collapsed ? expandLabel : collapseLabel;
|
|
65
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
66
|
+
css: styles?.collapseButton,
|
|
67
|
+
children: (0, _jsxRuntime.jsx)(_latest.IconButton, {
|
|
68
|
+
screenReaderLabel: label,
|
|
69
|
+
renderIcon: collapsed ? _uiIcons.PanelRightCloseInstUIIcon : _uiIcons.PanelRightOpenInstUIIcon,
|
|
70
|
+
withBackground: false,
|
|
71
|
+
withBorder: false,
|
|
72
|
+
size: "small",
|
|
73
|
+
elementRef: elementRef
|
|
74
|
+
// the cast is safe: the click event is typed for ViewProps, but React passes the DOM button's event
|
|
75
|
+
,
|
|
76
|
+
onClick: event => onCollapse(event, !collapsed),
|
|
77
|
+
themeOverride: {
|
|
78
|
+
...styles?.iconButtonThemeOverride,
|
|
79
|
+
...iconStyles?.iconButtonThemeOverride
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
exports.CollapseButton = CollapseButton;
|
|
85
|
+
var _default = exports.default = CollapseButton;
|