@pega/cosmos-react-core 9.0.0-build.26.0 → 9.0.0-build.26.2
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/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +2 -2
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppNavigationPanel.d.ts.map +1 -1
- package/lib/components/AppShell/AppNavigationPanel.js +21 -7
- package/lib/components/AppShell/AppNavigationPanel.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +42 -8
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +4 -0
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +102 -51
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +9 -3
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts +4 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +3 -1
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppTopNav.d.ts +4 -0
- package/lib/components/AppShell/AppTopNav.d.ts.map +1 -0
- package/lib/components/AppShell/AppTopNav.js +183 -0
- package/lib/components/AppShell/AppTopNav.js.map +1 -0
- package/lib/components/AppShell/AppTopNav.styles.d.ts +946 -0
- package/lib/components/AppShell/AppTopNav.styles.d.ts.map +1 -0
- package/lib/components/AppShell/AppTopNav.styles.js +184 -0
- package/lib/components/AppShell/AppTopNav.styles.js.map +1 -0
- package/lib/components/AppShell/AppTopNav.types.d.ts +16 -0
- package/lib/components/AppShell/AppTopNav.types.d.ts.map +1 -0
- package/lib/components/AppShell/AppTopNav.types.js +2 -0
- package/lib/components/AppShell/AppTopNav.types.js.map +1 -0
- package/lib/components/AppShell/Drawer.d.ts +3 -1
- package/lib/components/AppShell/Drawer.d.ts.map +1 -1
- package/lib/components/AppShell/Drawer.js +13 -12
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Drawer.styles.d.ts +8 -0
- package/lib/components/AppShell/Drawer.styles.d.ts.map +1 -1
- package/lib/components/AppShell/Drawer.styles.js +15 -0
- package/lib/components/AppShell/Drawer.styles.js.map +1 -1
- package/lib/components/AppShell/TopNavMoreMenu.d.ts +9 -0
- package/lib/components/AppShell/TopNavMoreMenu.d.ts.map +1 -0
- package/lib/components/AppShell/TopNavMoreMenu.js +73 -0
- package/lib/components/AppShell/TopNavMoreMenu.js.map +1 -0
- package/lib/components/AppShell/index.d.ts +1 -1
- package/lib/components/AppShell/index.d.ts.map +1 -1
- package/lib/components/AppShell/index.js.map +1 -1
- package/lib/components/AppShell/useTopNavOverflow.d.ts +17 -0
- package/lib/components/AppShell/useTopNavOverflow.d.ts.map +1 -0
- package/lib/components/AppShell/useTopNavOverflow.js +73 -0
- package/lib/components/AppShell/useTopNavOverflow.js.map +1 -0
- package/lib/components/ComboBox/ComboBox.styles.js +1 -1
- package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
- package/lib/i18n/default.js +1 -1
- package/lib/i18n/default.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppTopNav.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppTopNav.styles.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,YAAY,uNAkBvB,CAAC;AAIH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oMAOlC,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;cAlJ4B,OAAO;mBAsJrE,CAAC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { transparentize } from 'polished';
|
|
3
|
+
import { defaultThemeProp } from '../../theme';
|
|
4
|
+
import { calculateFontSize } from '../../styles';
|
|
5
|
+
import BareButton, { StyledBareButton } from '../Button/BareButton';
|
|
6
|
+
import Flex from '../Flex';
|
|
7
|
+
import { StyledNavList, StyledNavListItem, StyledNavItemIconBox, StyledCaseTypes, headerHeight, topNavHeight } from './AppShell.styles';
|
|
8
|
+
import { navContrastColors } from './style-utils';
|
|
9
|
+
export const StyledTopNav = styled.nav(({ theme }) => {
|
|
10
|
+
const { backgroundColor, foreground, border } = navContrastColors(theme);
|
|
11
|
+
const zBackdrop = theme.base['z-index'].backdrop;
|
|
12
|
+
return css `
|
|
13
|
+
position: sticky;
|
|
14
|
+
inset-block-start: ${headerHeight};
|
|
15
|
+
inset-inline-start: 0;
|
|
16
|
+
inset-inline-end: 0;
|
|
17
|
+
height: ${topNavHeight};
|
|
18
|
+
z-index: calc(${zBackdrop} - 3);
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: ${theme.base.spacing};
|
|
22
|
+
padding-inline: calc(${theme.base.spacing} * 2);
|
|
23
|
+
background: ${backgroundColor};
|
|
24
|
+
color: ${foreground};
|
|
25
|
+
border-block-end: 0.0625rem solid ${border ?? transparentize(0.8, foreground)};
|
|
26
|
+
`;
|
|
27
|
+
});
|
|
28
|
+
StyledTopNav.defaultProps = defaultThemeProp;
|
|
29
|
+
export const StyledTopNavSection = styled(Flex) `
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
`;
|
|
32
|
+
StyledTopNavSection.defaultProps = defaultThemeProp;
|
|
33
|
+
export const StyledTopNavList = styled(Flex) `
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
position: relative;
|
|
36
|
+
`;
|
|
37
|
+
StyledTopNavList.defaultProps = defaultThemeProp;
|
|
38
|
+
export const StyledTopNavUtilBar = styled(Flex) `
|
|
39
|
+
margin-inline-start: auto;
|
|
40
|
+
`;
|
|
41
|
+
StyledTopNavUtilBar.defaultProps = defaultThemeProp;
|
|
42
|
+
export const StyledTopNavItem = styled(BareButton)(({ theme, $active }) => {
|
|
43
|
+
const { foreground } = navContrastColors(theme);
|
|
44
|
+
const hoverBg = transparentize(0.9, foreground);
|
|
45
|
+
const activeBg = transparentize(0.85, foreground);
|
|
46
|
+
return css `
|
|
47
|
+
background: ${$active ? activeBg : 'transparent'};
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
min-height: ${theme.base['hit-area'].mouse};
|
|
51
|
+
gap: ${theme.base.spacing};
|
|
52
|
+
padding: 0 calc(${theme.base.spacing} * 1.5);
|
|
53
|
+
border-radius: ${theme.components['app-shell'].nav['item-border-radius']};
|
|
54
|
+
font: inherit;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
text-decoration: none;
|
|
57
|
+
|
|
58
|
+
& + & {
|
|
59
|
+
margin-inline-start: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
background: ${hoverBg};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:focus-visible {
|
|
67
|
+
background: ${hoverBg};
|
|
68
|
+
box-shadow: ${theme.base.shadow['focus-inset']};
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
});
|
|
72
|
+
StyledTopNavItem.defaultProps = defaultThemeProp;
|
|
73
|
+
export const StyledTopNavUtilButton = styled(BareButton)(({ theme }) => {
|
|
74
|
+
const { foreground } = navContrastColors(theme);
|
|
75
|
+
const hoverBg = transparentize(0.9, foreground);
|
|
76
|
+
return css `
|
|
77
|
+
position: relative;
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
width: ${theme.base['hit-area'].mouse};
|
|
82
|
+
height: ${theme.base['hit-area'].mouse};
|
|
83
|
+
border-radius: ${theme.base['border-radius']};
|
|
84
|
+
|
|
85
|
+
& + & {
|
|
86
|
+
margin-inline-start: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:hover {
|
|
90
|
+
background: ${hoverBg};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:focus-visible {
|
|
94
|
+
background: ${hoverBg};
|
|
95
|
+
box-shadow: ${theme.base.shadow['focus-inset']};
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
});
|
|
99
|
+
StyledTopNavUtilButton.defaultProps = defaultThemeProp;
|
|
100
|
+
export const StyledTopNavCountBadge = styled.span(({ theme }) => {
|
|
101
|
+
const { urgent } = navContrastColors(theme);
|
|
102
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
103
|
+
return css `
|
|
104
|
+
position: absolute;
|
|
105
|
+
inset-block-start: 0.125rem;
|
|
106
|
+
inset-inline-end: 0.125rem;
|
|
107
|
+
background: ${urgent};
|
|
108
|
+
color: ${theme.base.palette['primary-background']};
|
|
109
|
+
border-radius: calc(9999 * ${theme.base['border-radius']});
|
|
110
|
+
min-width: 1rem;
|
|
111
|
+
height: 1rem;
|
|
112
|
+
padding-inline: calc(${theme.base.spacing} / 2);
|
|
113
|
+
font-size: ${fontSize.xxs};
|
|
114
|
+
line-height: 1rem;
|
|
115
|
+
text-align: center;
|
|
116
|
+
`;
|
|
117
|
+
});
|
|
118
|
+
StyledTopNavCountBadge.defaultProps = defaultThemeProp;
|
|
119
|
+
/**
|
|
120
|
+
* Hosts the side-rail `CaseTypes` component inline in the top bar.
|
|
121
|
+
* - Strips side-rail width/margin constraints so the button sits inline.
|
|
122
|
+
* - Hides the "Create" text label visually (kept in aria-label for a11y).
|
|
123
|
+
* - Makes the button square so it aligns with the nav item hit area.
|
|
124
|
+
*/
|
|
125
|
+
export const StyledTopNavCreateArea = styled(Flex)(({ theme }) => {
|
|
126
|
+
const hitArea = theme.base['hit-area'].mouse;
|
|
127
|
+
const borderRadius = theme.base['border-radius'];
|
|
128
|
+
return css `
|
|
129
|
+
${StyledNavList} {
|
|
130
|
+
min-width: unset;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
${StyledNavListItem} {
|
|
134
|
+
padding-block-end: 0 !important;
|
|
135
|
+
|
|
136
|
+
&:not(:last-child),
|
|
137
|
+
&:only-child {
|
|
138
|
+
margin-block-end: 0 !important;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Make the top-level create button square and icon-only */
|
|
143
|
+
${StyledCaseTypes} > ${StyledNavList} > ${StyledNavListItem} > ${StyledBareButton} {
|
|
144
|
+
width: ${hitArea};
|
|
145
|
+
height: ${hitArea};
|
|
146
|
+
min-height: ${hitArea};
|
|
147
|
+
padding: 0;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
border-radius: ${borderRadius};
|
|
150
|
+
|
|
151
|
+
/* Hide the "Create" text label visually; aria-label on the button covers a11y.
|
|
152
|
+
Target all spans except the icon box so SVG icon remains visible. */
|
|
153
|
+
span:not(${StyledNavItemIconBox}) {
|
|
154
|
+
display: none;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
});
|
|
159
|
+
StyledTopNavCreateArea.defaultProps = defaultThemeProp;
|
|
160
|
+
/**
|
|
161
|
+
* Invisible container used as the hidden measurement row in AppTopNav.
|
|
162
|
+
* Always rendered at absolute position so useTopNavOverflow can measure all
|
|
163
|
+
* link widths at full size before deciding which ones are visible.
|
|
164
|
+
*/
|
|
165
|
+
export const StyledTopNavMeasureRow = styled(Flex) `
|
|
166
|
+
position: absolute;
|
|
167
|
+
visibility: hidden;
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
white-space: nowrap;
|
|
170
|
+
inset-block-start: 0;
|
|
171
|
+
inset-inline-start: 0;
|
|
172
|
+
`;
|
|
173
|
+
StyledTopNavMeasureRow.defaultProps = defaultThemeProp;
|
|
174
|
+
/**
|
|
175
|
+
* Always rendered at absolute position so the hook can measure the More button
|
|
176
|
+
* width before deciding how many links fit.
|
|
177
|
+
*/
|
|
178
|
+
export const StyledTopNavItemHidden = styled(StyledTopNavItem) `
|
|
179
|
+
position: absolute;
|
|
180
|
+
visibility: hidden;
|
|
181
|
+
pointer-events: none;
|
|
182
|
+
`;
|
|
183
|
+
StyledTopNavItemHidden.defaultProps = defaultThemeProp;
|
|
184
|
+
//# sourceMappingURL=AppTopNav.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppTopNav.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppTopNav.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,UAAU,EAAE,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACnD,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,KAA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AG,CAAA;;;;kBAIM,MAAM;aACX,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;iCACpB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;;2BAGjC,KAAK,CAAC,IAAI,CAAC,OAAO;iBAC5B,QAAQ,CAAC,GAAG;;;GAG1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/D,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;IAC7C,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACjD,OAAO,GAAG,CAAA;MACN,aAAa;;;;MAIb,iBAAiB;;;;;;;;;;MAUjB,eAAe,MAAM,aAAa,MAAM,iBAAiB,MAAM,gBAAgB;eACtE,OAAO;gBACN,OAAO;oBACH,OAAO;;;uBAGJ,YAAY;;;;iBAIlB,oBAAoB;;;;GAIlC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;;;CAOjD,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;;;;CAI7D,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\nimport BareButton, { StyledBareButton } from '../Button/BareButton';\nimport Flex from '../Flex';\n\nimport {\n StyledNavList,\n StyledNavListItem,\n StyledNavItemIconBox,\n StyledCaseTypes,\n headerHeight,\n topNavHeight\n} from './AppShell.styles';\nimport { navContrastColors } from './style-utils';\n\nexport const StyledTopNav = styled.nav(({ theme }) => {\n const { backgroundColor, foreground, border } = navContrastColors(theme);\n const zBackdrop = theme.base['z-index'].backdrop;\n return css`\n position: sticky;\n inset-block-start: ${headerHeight};\n inset-inline-start: 0;\n inset-inline-end: 0;\n height: ${topNavHeight};\n z-index: calc(${zBackdrop} - 3);\n display: flex;\n align-items: center;\n gap: ${theme.base.spacing};\n padding-inline: calc(${theme.base.spacing} * 2);\n background: ${backgroundColor};\n color: ${foreground};\n border-block-end: 0.0625rem solid ${border ?? transparentize(0.8, foreground)};\n `;\n});\n\nStyledTopNav.defaultProps = defaultThemeProp;\n\nexport const StyledTopNavSection = styled(Flex)`\n overflow: hidden;\n`;\n\nStyledTopNavSection.defaultProps = defaultThemeProp;\n\nexport const StyledTopNavList = styled(Flex)`\n overflow: hidden;\n position: relative;\n`;\n\nStyledTopNavList.defaultProps = defaultThemeProp;\n\nexport const StyledTopNavUtilBar = styled(Flex)`\n margin-inline-start: auto;\n`;\n\nStyledTopNavUtilBar.defaultProps = defaultThemeProp;\n\nexport const StyledTopNavItem = styled(BareButton)<{ $active?: boolean }>(({ theme, $active }) => {\n const { foreground } = navContrastColors(theme);\n const hoverBg = transparentize(0.9, foreground);\n const activeBg = transparentize(0.85, foreground);\n return css`\n background: ${$active ? activeBg : 'transparent'};\n display: inline-flex;\n align-items: center;\n min-height: ${theme.base['hit-area'].mouse};\n gap: ${theme.base.spacing};\n padding: 0 calc(${theme.base.spacing} * 1.5);\n border-radius: ${theme.components['app-shell'].nav['item-border-radius']};\n font: inherit;\n white-space: nowrap;\n text-decoration: none;\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:hover {\n background: ${hoverBg};\n }\n\n &:focus-visible {\n background: ${hoverBg};\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledTopNavItem.defaultProps = defaultThemeProp;\n\nexport const StyledTopNavUtilButton = styled(BareButton)(({ theme }) => {\n const { foreground } = navContrastColors(theme);\n const hoverBg = transparentize(0.9, foreground);\n return css`\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ${theme.base['hit-area'].mouse};\n height: ${theme.base['hit-area'].mouse};\n border-radius: ${theme.base['border-radius']};\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:hover {\n background: ${hoverBg};\n }\n\n &:focus-visible {\n background: ${hoverBg};\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledTopNavUtilButton.defaultProps = defaultThemeProp;\n\nexport const StyledTopNavCountBadge = styled.span(({ theme }) => {\n const { urgent } = navContrastColors(theme);\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n position: absolute;\n inset-block-start: 0.125rem;\n inset-inline-end: 0.125rem;\n background: ${urgent};\n color: ${theme.base.palette['primary-background']};\n border-radius: calc(9999 * ${theme.base['border-radius']});\n min-width: 1rem;\n height: 1rem;\n padding-inline: calc(${theme.base.spacing} / 2);\n font-size: ${fontSize.xxs};\n line-height: 1rem;\n text-align: center;\n `;\n});\n\nStyledTopNavCountBadge.defaultProps = defaultThemeProp;\n\n/**\n * Hosts the side-rail `CaseTypes` component inline in the top bar.\n * - Strips side-rail width/margin constraints so the button sits inline.\n * - Hides the \"Create\" text label visually (kept in aria-label for a11y).\n * - Makes the button square so it aligns with the nav item hit area.\n */\nexport const StyledTopNavCreateArea = styled(Flex)(({ theme }) => {\n const hitArea = theme.base['hit-area'].mouse;\n const borderRadius = theme.base['border-radius'];\n return css`\n ${StyledNavList} {\n min-width: unset;\n }\n\n ${StyledNavListItem} {\n padding-block-end: 0 !important;\n\n &:not(:last-child),\n &:only-child {\n margin-block-end: 0 !important;\n }\n }\n\n /* Make the top-level create button square and icon-only */\n ${StyledCaseTypes} > ${StyledNavList} > ${StyledNavListItem} > ${StyledBareButton} {\n width: ${hitArea};\n height: ${hitArea};\n min-height: ${hitArea};\n padding: 0;\n justify-content: center;\n border-radius: ${borderRadius};\n\n /* Hide the \"Create\" text label visually; aria-label on the button covers a11y.\n Target all spans except the icon box so SVG icon remains visible. */\n span:not(${StyledNavItemIconBox}) {\n display: none;\n }\n }\n `;\n});\n\nStyledTopNavCreateArea.defaultProps = defaultThemeProp;\n\n/**\n * Invisible container used as the hidden measurement row in AppTopNav.\n * Always rendered at absolute position so useTopNavOverflow can measure all\n * link widths at full size before deciding which ones are visible.\n */\nexport const StyledTopNavMeasureRow = styled(Flex)`\n position: absolute;\n visibility: hidden;\n pointer-events: none;\n white-space: nowrap;\n inset-block-start: 0;\n inset-inline-start: 0;\n`;\n\nStyledTopNavMeasureRow.defaultProps = defaultThemeProp;\n\n/**\n * Always rendered at absolute position so the hook can measure the More button\n * width before deciding how many links fit.\n */\nexport const StyledTopNavItemHidden = styled(StyledTopNavItem)`\n position: absolute;\n visibility: hidden;\n pointer-events: none;\n`;\n\nStyledTopNavItemHidden.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AppShellProps, UtilItemProps } from './AppShell.types';
|
|
2
|
+
export interface AppTopNavProps {
|
|
3
|
+
/** Not currently used by top-bar rendering; reserved for future nav theming. */
|
|
4
|
+
appInfo?: AppShellProps['appInfo'];
|
|
5
|
+
links?: AppShellProps['links'];
|
|
6
|
+
caseTypes?: AppShellProps['caseTypes'];
|
|
7
|
+
cases?: AppShellProps['cases'];
|
|
8
|
+
agent?: AppShellProps['agent'];
|
|
9
|
+
utils?: AppShellProps['utils'];
|
|
10
|
+
searchInput?: AppShellProps['searchInput'];
|
|
11
|
+
searchPage?: AppShellProps['searchPage'];
|
|
12
|
+
searchLabel?: string;
|
|
13
|
+
/** Called when a utility item with a drawerView is activated. */
|
|
14
|
+
onUtilItemClick?: (item: UtilItemProps) => void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=AppTopNav.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppTopNav.types.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppTopNav.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,WAAW,cAAc;IAC7B,gFAAgF;IAChF,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppTopNav.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppTopNav.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AppShellProps, UtilItemProps } from './AppShell.types';\n\nexport interface AppTopNavProps {\n /** Not currently used by top-bar rendering; reserved for future nav theming. */\n appInfo?: AppShellProps['appInfo'];\n links?: AppShellProps['links'];\n caseTypes?: AppShellProps['caseTypes'];\n cases?: AppShellProps['cases'];\n agent?: AppShellProps['agent'];\n utils?: AppShellProps['utils'];\n searchInput?: AppShellProps['searchInput'];\n searchPage?: AppShellProps['searchPage'];\n searchLabel?: string;\n /** Called when a utility item with a drawerView is activated. */\n onUtilItemClick?: (item: UtilItemProps) => void;\n}\n"]}
|
|
@@ -6,7 +6,9 @@ interface DrawerViewProps {
|
|
|
6
6
|
onDrawerClose?: () => void;
|
|
7
7
|
drawerOpen: boolean;
|
|
8
8
|
setDrawerOpen: (open: boolean) => void;
|
|
9
|
+
/** When provided, the drawer is offset below the chrome (header + top nav). */
|
|
10
|
+
topOffset?: string;
|
|
9
11
|
}
|
|
10
|
-
declare const _default: ({ content, header, onDrawerOpen, onDrawerClose, drawerOpen, setDrawerOpen }: DrawerViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const _default: ({ content, header, onDrawerOpen, onDrawerClose, drawerOpen, setDrawerOpen, topOffset }: DrawerViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export default _default;
|
|
12
14
|
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAkCvC,UAAU,eAAe;IACvB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;yBAEe,wFAQb,eAAe;AARlB,wBAsGE"}
|
|
@@ -11,10 +11,10 @@ import Configuration from '../Configuration/Configuration';
|
|
|
11
11
|
import { getActiveElement } from '../../utils';
|
|
12
12
|
import { isSolidColor } from '../../styles';
|
|
13
13
|
import AppShellContext from './AppShellContext';
|
|
14
|
-
import { StyledDrawerWrapper, StyledDrawerBackButton, StyledDrawerHeading, StyledDrawerListContainer } from './Drawer.styles';
|
|
14
|
+
import { StyledDrawerWrapper, StyledTopNavDrawerOffset, StyledDrawerBackButton, StyledDrawerHeading, StyledDrawerListContainer } from './Drawer.styles';
|
|
15
15
|
import { navContrastColors } from './style-utils';
|
|
16
16
|
registerIcon(arrowLeftIcon);
|
|
17
|
-
export default ({ content, header, onDrawerOpen, onDrawerClose, drawerOpen, setDrawerOpen }) => {
|
|
17
|
+
export default ({ content, header, onDrawerOpen, onDrawerClose, drawerOpen, setDrawerOpen, topOffset }) => {
|
|
18
18
|
const t = useI18n();
|
|
19
19
|
const theme = useTheme();
|
|
20
20
|
const { focusedImperatively } = useContext(AppShellContext);
|
|
@@ -44,15 +44,16 @@ export default ({ content, header, onDrawerOpen, onDrawerClose, drawerOpen, setD
|
|
|
44
44
|
useLayoutEffect(() => {
|
|
45
45
|
returnFocusRef.current = getActiveElement() ?? undefined;
|
|
46
46
|
}, []);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
const drawerContent = (_jsxs(Drawer, { role: 'dialog', "aria-labelledby": headerId, as: StyledDrawerWrapper, position: topOffset ? 'absolute' : 'fixed', placement: start, open: drawerOpen, nullWhenClosed: true, onAfterOpen: () => {
|
|
48
|
+
if (backButtonRef.current && !drawerRef.current?.contains(getActiveElement())) {
|
|
49
|
+
focusedImperatively.current = true;
|
|
50
|
+
backButtonRef.current.focus();
|
|
51
|
+
}
|
|
52
|
+
onDrawerOpen?.();
|
|
53
|
+
}, onAfterClose: () => {
|
|
54
|
+
onDrawerClose?.();
|
|
55
|
+
returnFocusRef.current?.focus();
|
|
56
|
+
}, onOuterClick: () => setDrawerOpen(false), ref: drawerRef, children: [_jsxs(Flex, { as: StyledDrawerHeading, role: 'none', container: { alignItems: 'center' }, children: [_jsx(BareButton, { as: StyledDrawerBackButton, ref: backButtonRef, onClick: () => setDrawerOpen(false), "aria-label": t('close_noun', [header]), children: _jsx(Icon, { name: `arrow-${start}` }) }), _jsx(Text, { variant: 'h2', id: headerId, children: header })] }), _jsx(Flex, { as: StyledDrawerListContainer, container: { direction: 'column' }, "aria-labelledby": headerId, children: content })] }));
|
|
57
|
+
return (_jsx(Configuration, { theme: navTheme, portalTarget: drawerEl ?? undefined, children: topOffset ? (_jsx(StyledTopNavDrawerOffset, { "$topOffset": topOffset, children: drawerContent })) : (drawerContent) }));
|
|
57
58
|
};
|
|
58
59
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG5D,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE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EAAE,QAAQ,YAC5B,MAAM,GACF,IACF,EACP,KAAC,IAAI,IACH,EAAE,EAAE,yBAAyB,EAC7B,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,qBACjB,QAAQ,YAExB,OAAO,GACH,IACA,CACV,CAAC;IAEF,OAAO,CACL,KAAC,aAAa,IAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,IAAI,SAAS,YAChE,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,wBAAwB,kBAAa,SAAS,YAAG,aAAa,GAA4B,CAC5F,CAAC,CAAC,CAAC,CACF,aAAa,CACd,GACa,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useContext, useLayoutEffect, useRef } from 'react';\nimport type { ReactNode } from 'react';\n\nimport BareButton from '../Button/BareButton';\nimport Drawer from '../Drawer';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport * as arrowLeftIcon from '../Icon/icons/arrow-left.icon';\nimport Text from '../Text';\nimport {\n useConsolidatedRef,\n useDirection,\n useElement,\n useEscape,\n useFocusTrap,\n useI18n,\n useTheme,\n useUID\n} from '../../hooks';\nimport Configuration from '../Configuration/Configuration';\nimport { getActiveElement } from '../../utils';\nimport { isSolidColor } from '../../styles';\n\nimport AppShellContext from './AppShellContext';\nimport {\n StyledDrawerWrapper,\n StyledTopNavDrawerOffset,\n StyledDrawerBackButton,\n StyledDrawerHeading,\n StyledDrawerListContainer\n} from './Drawer.styles';\nimport { navContrastColors } from './style-utils';\n\nregisterIcon(arrowLeftIcon);\n\ninterface DrawerViewProps {\n content: ReactNode;\n header: string;\n onDrawerOpen?: () => void;\n onDrawerClose?: () => void;\n drawerOpen: boolean;\n setDrawerOpen: (open: boolean) => void;\n /** When provided, the drawer is offset below the chrome (header + top nav). */\n topOffset?: string;\n}\n\nexport default ({\n content,\n header,\n onDrawerOpen,\n onDrawerClose,\n drawerOpen,\n setDrawerOpen,\n topOffset\n}: DrawerViewProps) => {\n const t = useI18n();\n const theme = useTheme();\n const { focusedImperatively } = useContext(AppShellContext);\n const { start } = useDirection();\n const returnFocusRef = useRef<HTMLElement>();\n const [drawerEl, setDrawerEl] = useElement<HTMLDivElement>();\n const drawerRef = useConsolidatedRef(setDrawerEl);\n const backButtonRef = useRef<HTMLButtonElement>(null);\n const headerId = useUID();\n\n useEscape(\n () => {\n setDrawerOpen(false);\n },\n drawerEl,\n [drawerEl]\n );\n\n useFocusTrap(drawerRef);\n\n const { foreground, interactive, urgent } = navContrastColors(theme);\n const navBg = theme.components['app-shell'].nav.background;\n const navTheme = {\n base: {\n palette: {\n 'primary-background': isSolidColor(navBg) ? navBg : 'transparent',\n 'foreground-color': foreground,\n interactive,\n urgent\n }\n }\n };\n\n // Using layout effect to capture the focused element prior to drawer elements taking focus.\n useLayoutEffect(() => {\n returnFocusRef.current = (getActiveElement() as HTMLElement) ?? undefined;\n }, []);\n\n const drawerContent = (\n <Drawer\n role='dialog'\n aria-labelledby={headerId}\n as={StyledDrawerWrapper}\n position={topOffset ? 'absolute' : 'fixed'}\n placement={start}\n open={drawerOpen}\n nullWhenClosed\n onAfterOpen={() => {\n if (backButtonRef.current && !drawerRef.current?.contains(getActiveElement())) {\n focusedImperatively.current = true;\n backButtonRef.current.focus();\n }\n onDrawerOpen?.();\n }}\n onAfterClose={() => {\n onDrawerClose?.();\n returnFocusRef.current?.focus();\n }}\n onOuterClick={() => setDrawerOpen(false)}\n ref={drawerRef}\n >\n <Flex as={StyledDrawerHeading} role='none' container={{ alignItems: 'center' }}>\n <BareButton\n as={StyledDrawerBackButton}\n ref={backButtonRef}\n onClick={() => setDrawerOpen(false)}\n aria-label={t('close_noun', [header])}\n >\n <Icon name={`arrow-${start}`} />\n </BareButton>\n <Text variant='h2' id={headerId}>\n {header}\n </Text>\n </Flex>\n <Flex\n as={StyledDrawerListContainer}\n container={{ direction: 'column' }}\n aria-labelledby={headerId}\n >\n {content}\n </Flex>\n </Drawer>\n );\n\n return (\n <Configuration theme={navTheme} portalTarget={drawerEl ?? undefined}>\n {topOffset ? (\n <StyledTopNavDrawerOffset $topOffset={topOffset}>{drawerContent}</StyledTopNavDrawerOffset>\n ) : (\n drawerContent\n )}\n </Configuration>\n );\n};\n"]}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { DrawerProps } from '../Drawer';
|
|
2
2
|
export declare const StyledDrawerWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, DrawerProps>> & string;
|
|
3
|
+
/**
|
|
4
|
+
* Fixed-position container that offsets the drawer below the top chrome
|
|
5
|
+
* (AppShell header + top nav bar) so the drawer doesn't overlap the navigation.
|
|
6
|
+
* The inner Drawer uses position='absolute' relative to this container.
|
|
7
|
+
*/
|
|
8
|
+
export declare const StyledTopNavDrawerOffset: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
9
|
+
$topOffset: string;
|
|
10
|
+
}>> & string;
|
|
3
11
|
export declare const StyledDrawerHeading: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
4
12
|
export declare const StyledDrawerBackButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
5
13
|
export declare const StyledDrawerList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.styles.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQ7C,eAAO,MAAM,mBAAmB,gPAwB9B,CAAC;AAIH,eAAO,MAAM,mBAAmB,uNAsB9B,CAAC;AAIH,eAAO,MAAM,sBAAsB,yOAqBjC,CAAC;AAIH,eAAO,MAAM,gBAAgB;iBAA4B,OAAO;YAE9D,CAAC;AAIH,eAAO,MAAM,oBAAoB,iOAIhC,CAAC;AAEF,eAAO,MAAM,iBAAiB,6NAK5B,CAAC;AAIH,eAAO,MAAM,uBAAuB,qOAWlC,CAAC;AAIH,eAAO,MAAM,mBAAmB,yOAiB9B,CAAC;AAIH,eAAO,MAAM,uBAAuB,6NAQlC,CAAC;AAIH,eAAO,MAAM,yBAAyB,6NAOpC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Drawer.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.styles.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQ7C,eAAO,MAAM,mBAAmB,gPAwB9B,CAAC;AAIH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;gBAA4B,MAAM;YAUtE,CAAC;AAIF,eAAO,MAAM,mBAAmB,uNAsB9B,CAAC;AAIH,eAAO,MAAM,sBAAsB,yOAqBjC,CAAC;AAIH,eAAO,MAAM,gBAAgB;iBAA4B,OAAO;YAE9D,CAAC;AAIH,eAAO,MAAM,oBAAoB,iOAIhC,CAAC;AAEF,eAAO,MAAM,iBAAiB,6NAK5B,CAAC;AAIH,eAAO,MAAM,uBAAuB,qOAWlC,CAAC;AAIH,eAAO,MAAM,mBAAmB,yOAiB9B,CAAC;AAIH,eAAO,MAAM,uBAAuB,6NAQlC,CAAC;AAIH,eAAO,MAAM,yBAAyB,6NAOpC,CAAC"}
|
|
@@ -26,6 +26,21 @@ export const StyledDrawerWrapper = styled.div(({ theme, open }) => {
|
|
|
26
26
|
`;
|
|
27
27
|
});
|
|
28
28
|
StyledDrawerWrapper.defaultProps = defaultThemeProp;
|
|
29
|
+
/**
|
|
30
|
+
* Fixed-position container that offsets the drawer below the top chrome
|
|
31
|
+
* (AppShell header + top nav bar) so the drawer doesn't overlap the navigation.
|
|
32
|
+
* The inner Drawer uses position='absolute' relative to this container.
|
|
33
|
+
*/
|
|
34
|
+
export const StyledTopNavDrawerOffset = styled.div(({ $topOffset, theme }) => css `
|
|
35
|
+
position: fixed;
|
|
36
|
+
inset-block-start: ${$topOffset};
|
|
37
|
+
inset-inline-start: 0;
|
|
38
|
+
/* stylelint-disable-next-line unit-allowed-list */
|
|
39
|
+
height: calc(100dvh - ${$topOffset});
|
|
40
|
+
width: ${navOpenWidth};
|
|
41
|
+
z-index: ${theme.base['z-index'].drawer};
|
|
42
|
+
`);
|
|
43
|
+
StyledTopNavDrawerOffset.defaultProps = defaultThemeProp;
|
|
29
44
|
export const StyledDrawerHeading = styled.header(({ theme }) => {
|
|
30
45
|
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
31
46
|
const { foreground } = navContrastColors(theme);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,mB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Q,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;8BACkB,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,QAAQ,CAAC,GAAG;;GAE/D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { rem } from 'polished';\n\nimport { calculateFontSize } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport type { DrawerProps } from '../Drawer';\nimport { StyledMetaListItem } from '../MetaList/MetaList';\nimport { StyledLabel } from '../Label';\nimport { StyledForm } from '../MultiStepForm/MultiStepForm';\n\nimport { navOpenWidth } from './AppShell.styles';\nimport { navContrastColors } from './style-utils';\n\nexport const StyledDrawerWrapper = styled.div<DrawerProps>(({ theme, open }) => {\n const {\n components: {\n 'app-shell': {\n nav: { background: navBg }\n }\n }\n } = theme;\n const { foreground, border: borderColor } = navContrastColors(theme);\n\n return css`\n background: ${navBg};\n width: ${navOpenWidth};\n height: 100%;\n color: ${foreground};\n opacity: ${open ? 1 : 0};\n border-inline-end: ${rem(1)} solid ${borderColor};\n\n ${StyledForm},\n ${StyledLabel},\n ${StyledMetaListItem} {\n color: ${foreground};\n }\n `;\n});\n\nStyledDrawerWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerHeading = styled.header(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { foreground } = navContrastColors(theme);\n\n return css`\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n line-height: 1;\n\n h2 {\n font-size: ${fontSize.s};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n margin: 0 auto;\n position: relative;\n left: -0.7rem;\n }\n\n svg {\n font-size: ${fontSize.xxl};\n cursor: pointer;\n color: ${foreground};\n }\n `;\n});\n\nStyledDrawerHeading.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerBackButton = styled.button(({ theme }) => {\n const { hoverBg, foreground } = navContrastColors(theme);\n\n return css`\n height: ${theme.base['hit-area']['mouse-min']};\n width: ${theme.base['hit-area']['mouse-min']};\n border-radius: calc(\n ${`${theme.base['border-radius']} * ${theme.components.button['border-radius']}`}\n );\n\n &:hover,\n &:focus {\n color: ${foreground};\n background-color: ${hoverBg};\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledDrawerBackButton.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerList = styled.ul<{ displayPins: boolean }>(() => {\n return css``;\n});\n\nStyledDrawerList.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerMetaList = styled.ul`\n li {\n color: inherit;\n }\n`;\n\nexport const EmptyDrawerVisual = styled.div(({ theme }) => {\n return css`\n width: calc(4 * ${theme.base.spacing});\n height: calc(4 * ${theme.base.spacing});\n `;\n});\n\nEmptyDrawerVisual.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListHeading = styled.h3(({ theme }) => {\n const { hoverBg, foreground } = navContrastColors(theme);\n\n return css`\n position: sticky;\n top: 0;\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n background-color: ${hoverBg};\n color: ${foreground};\n z-index: 1;\n `;\n});\n\nStyledDrawerListHeading.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerViewAll = styled.a(({ theme }) => {\n const { foreground, nestedListHeader } = navContrastColors(theme);\n\n return css`\n position: sticky;\n bottom: 0;\n padding: ${theme.base.spacing} 0;\n color: ${foreground};\n background: ${nestedListHeader};\n text-align: center;\n margin-top: 0.0625rem;\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledDrawerViewAll.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListSection = styled.div(({ theme }) => {\n const { border: borderColor } = navContrastColors(theme);\n\n return css`\n border-top: 0.0625rem solid ${borderColor};\n min-height: max(20%, 8rem);\n overflow-y: auto;\n `;\n});\n\nStyledDrawerListSection.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListContainer = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n height: calc(100% - 4 * ${theme.base.spacing} - ${fontSize.xxl});\n overflow: auto;\n `;\n});\n\nStyledDrawerListContainer.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Drawer.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/Drawer.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;IAC7E,MAAM,EACJ,UAAU,EAAE,EACV,WAAW,EAAE,EACX,GAAG,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,EAC3B,EACF,EACF,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAErE,OAAO,GAAG,CAAA;kB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tF,OAAO,GAAG,CAAA;8BACkB,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,QAAQ,CAAC,GAAG;;GAE/D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { rem } from 'polished';\n\nimport { calculateFontSize } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport type { DrawerProps } from '../Drawer';\nimport { StyledMetaListItem } from '../MetaList/MetaList';\nimport { StyledLabel } from '../Label';\nimport { StyledForm } from '../MultiStepForm/MultiStepForm';\n\nimport { navOpenWidth } from './AppShell.styles';\nimport { navContrastColors } from './style-utils';\n\nexport const StyledDrawerWrapper = styled.div<DrawerProps>(({ theme, open }) => {\n const {\n components: {\n 'app-shell': {\n nav: { background: navBg }\n }\n }\n } = theme;\n const { foreground, border: borderColor } = navContrastColors(theme);\n\n return css`\n background: ${navBg};\n width: ${navOpenWidth};\n height: 100%;\n color: ${foreground};\n opacity: ${open ? 1 : 0};\n border-inline-end: ${rem(1)} solid ${borderColor};\n\n ${StyledForm},\n ${StyledLabel},\n ${StyledMetaListItem} {\n color: ${foreground};\n }\n `;\n});\n\nStyledDrawerWrapper.defaultProps = defaultThemeProp;\n\n/**\n * Fixed-position container that offsets the drawer below the top chrome\n * (AppShell header + top nav bar) so the drawer doesn't overlap the navigation.\n * The inner Drawer uses position='absolute' relative to this container.\n */\nexport const StyledTopNavDrawerOffset = styled.div<{ $topOffset: string }>(\n ({ $topOffset, theme }) => css`\n position: fixed;\n inset-block-start: ${$topOffset};\n inset-inline-start: 0;\n /* stylelint-disable-next-line unit-allowed-list */\n height: calc(100dvh - ${$topOffset});\n width: ${navOpenWidth};\n z-index: ${theme.base['z-index'].drawer};\n `\n);\n\nStyledTopNavDrawerOffset.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerHeading = styled.header(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { foreground } = navContrastColors(theme);\n\n return css`\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n line-height: 1;\n\n h2 {\n font-size: ${fontSize.s};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n margin: 0 auto;\n position: relative;\n left: -0.7rem;\n }\n\n svg {\n font-size: ${fontSize.xxl};\n cursor: pointer;\n color: ${foreground};\n }\n `;\n});\n\nStyledDrawerHeading.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerBackButton = styled.button(({ theme }) => {\n const { hoverBg, foreground } = navContrastColors(theme);\n\n return css`\n height: ${theme.base['hit-area']['mouse-min']};\n width: ${theme.base['hit-area']['mouse-min']};\n border-radius: calc(\n ${`${theme.base['border-radius']} * ${theme.components.button['border-radius']}`}\n );\n\n &:hover,\n &:focus {\n color: ${foreground};\n background-color: ${hoverBg};\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledDrawerBackButton.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerList = styled.ul<{ displayPins: boolean }>(() => {\n return css``;\n});\n\nStyledDrawerList.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerMetaList = styled.ul`\n li {\n color: inherit;\n }\n`;\n\nexport const EmptyDrawerVisual = styled.div(({ theme }) => {\n return css`\n width: calc(4 * ${theme.base.spacing});\n height: calc(4 * ${theme.base.spacing});\n `;\n});\n\nEmptyDrawerVisual.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListHeading = styled.h3(({ theme }) => {\n const { hoverBg, foreground } = navContrastColors(theme);\n\n return css`\n position: sticky;\n top: 0;\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n background-color: ${hoverBg};\n color: ${foreground};\n z-index: 1;\n `;\n});\n\nStyledDrawerListHeading.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerViewAll = styled.a(({ theme }) => {\n const { foreground, nestedListHeader } = navContrastColors(theme);\n\n return css`\n position: sticky;\n bottom: 0;\n padding: ${theme.base.spacing} 0;\n color: ${foreground};\n background: ${nestedListHeader};\n text-align: center;\n margin-top: 0.0625rem;\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledDrawerViewAll.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListSection = styled.div(({ theme }) => {\n const { border: borderColor } = navContrastColors(theme);\n\n return css`\n border-top: 0.0625rem solid ${borderColor};\n min-height: max(20%, 8rem);\n overflow-y: auto;\n `;\n});\n\nStyledDrawerListSection.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListContainer = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n height: calc(100% - 4 * ${theme.base.spacing} - ${fontSize.xxl});\n overflow: auto;\n `;\n});\n\nStyledDrawerListContainer.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LinkProps } from './AppShell.types';
|
|
2
|
+
export interface TopNavMoreMenuProps {
|
|
3
|
+
items: LinkProps[];
|
|
4
|
+
label?: string;
|
|
5
|
+
active?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const TopNavMoreMenu: ({ items, label, active }: TopNavMoreMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default TopNavMoreMenu;
|
|
9
|
+
//# sourceMappingURL=TopNavMoreMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopNavMoreMenu.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/TopNavMoreMenu.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AA+BlD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,cAAc,GAAI,0BAA0B,mBAAmB,4CA6EpE,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useRef, useMemo, useState } from 'react';
|
|
3
|
+
import Icon, { registerIcon } from '../Icon';
|
|
4
|
+
import * as barsIcon from '../Icon/icons/bars.icon';
|
|
5
|
+
import Popover from '../Popover';
|
|
6
|
+
import Menu from '../Menu';
|
|
7
|
+
import { useEscape, useFocusWithin, useI18n } from '../../hooks';
|
|
8
|
+
import { createStringMatcher } from '../../utils';
|
|
9
|
+
import { StyledTopNavItem } from './AppTopNav.styles';
|
|
10
|
+
registerIcon(barsIcon);
|
|
11
|
+
const FILTER_THRESHOLD = 5;
|
|
12
|
+
const linkToMenuItem = (link) => {
|
|
13
|
+
const userOnClick = link.onClick;
|
|
14
|
+
const children = link.links?.map(linkToMenuItem);
|
|
15
|
+
const hasChildren = children && children.length > 0;
|
|
16
|
+
return {
|
|
17
|
+
id: link.id || link.name,
|
|
18
|
+
primary: link.name,
|
|
19
|
+
visual: link.icon ? _jsx(Icon, { name: link.icon }) : undefined,
|
|
20
|
+
href: hasChildren ? undefined : link.href,
|
|
21
|
+
// MenuItem uses `typeof selected !== 'boolean'` to decide expand vs click.
|
|
22
|
+
selected: hasChildren ? undefined : link.active || undefined,
|
|
23
|
+
onClick: userOnClick
|
|
24
|
+
? (_id, e) => {
|
|
25
|
+
userOnClick(e);
|
|
26
|
+
}
|
|
27
|
+
: undefined,
|
|
28
|
+
items: hasChildren ? children : undefined
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const TopNavMoreMenu = ({ items, label, active }) => {
|
|
32
|
+
const t = useI18n();
|
|
33
|
+
const triggerRef = useRef(null);
|
|
34
|
+
const popoverRef = useRef(null);
|
|
35
|
+
const [open, setOpen] = useState(false);
|
|
36
|
+
const [filterValue, setFilterValue] = useState('');
|
|
37
|
+
const close = useCallback(() => setOpen(false), []);
|
|
38
|
+
useFocusWithin([triggerRef, popoverRef], useCallback((isFocused) => {
|
|
39
|
+
if (!isFocused)
|
|
40
|
+
setOpen(false);
|
|
41
|
+
}, []));
|
|
42
|
+
useEscape(useCallback((e) => {
|
|
43
|
+
if (open) {
|
|
44
|
+
setOpen(false);
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
triggerRef.current?.focus();
|
|
47
|
+
}
|
|
48
|
+
}, [open])
|
|
49
|
+
// No target: attach to document so Escape works when focus is inside the
|
|
50
|
+
// Popover portal (events from portal content don't bubble to the trigger element).
|
|
51
|
+
);
|
|
52
|
+
const allItems = useMemo(() => items.map(linkToMenuItem), [items]);
|
|
53
|
+
const showFilter = items.length >= FILTER_THRESHOLD;
|
|
54
|
+
const filterRegex = createStringMatcher(filterValue, 'contains');
|
|
55
|
+
const menuItems = showFilter
|
|
56
|
+
? allItems.filter(it => filterRegex.test(String(it.primary ?? '')))
|
|
57
|
+
: allItems;
|
|
58
|
+
const handleTriggerClick = () => {
|
|
59
|
+
if (!open)
|
|
60
|
+
setFilterValue('');
|
|
61
|
+
setOpen(v => !v);
|
|
62
|
+
};
|
|
63
|
+
return (_jsxs(_Fragment, { children: [_jsxs(StyledTopNavItem, { ref: triggerRef, "$active": active || open, "aria-haspopup": 'menu', "aria-expanded": open, onClick: handleTriggerClick, children: [_jsx(Icon, { name: 'bars' }), _jsx("span", { children: label ?? t('app_shell_more') })] }), open && (_jsx(Popover, { ref: popoverRef, target: triggerRef.current, placement: 'bottom-end', children: _jsx(Menu, { mode: 'action', variant: 'flyout', "aria-label": label ?? t('app_shell_more'), items: menuItems, onItemClick: close, focusControlEl: triggerRef.current ?? undefined, ...(showFilter
|
|
64
|
+
? {
|
|
65
|
+
filterInputProps: {
|
|
66
|
+
value: filterValue,
|
|
67
|
+
onChange: (e) => setFilterValue(e.target.value)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
: {}) }) }))] }));
|
|
71
|
+
};
|
|
72
|
+
export default TopNavMoreMenu;
|
|
73
|
+
//# sourceMappingURL=TopNavMoreMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopNavMoreMenu.js","sourceRoot":"","sources":["../../../src/components/AppShell/TopNavMoreMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAM3B,MAAM,cAAc,GAAG,CAAC,IAAe,EAAkB,EAAE;IACzD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACpD,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,IAAI;QACxB,OAAO,EAAE,IAAI,CAAC,IAAI;QAClB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CAAC,CAAC,CA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AC,YAAY,YAC1E,KAAC,IAAI,IACH,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,QAAQ,gBACJ,KAAK,IAAI,CAAC,CAAC,gBAAgB,CAAC,EACxC,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,KAAK,EAClB,cAAc,EAAE,UAAU,CAAC,OAAO,IAAI,SAAS,KAC3C,CAAC,UAAU;wBACb,CAAC,CAAC;4BACE,gBAAgB,EAAE;gCAChB,KAAK,EAAE,WAAW;gCAClB,QAAQ,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;6BAC/E;yBACF;wBACH,CAAC,CAAC,EAAE,CAAC,GACP,GACM,CACX,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useCallback, useRef, useMemo, useState } from 'react';\nimport type { ChangeEvent } from 'react';\n\nimport Icon, { registerIcon } from '../Icon';\nimport * as barsIcon from '../Icon/icons/bars.icon';\nimport Popover from '../Popover';\nimport Menu from '../Menu';\nimport type { MenuItemProps } from '../Menu';\nimport { useEscape, useFocusWithin, useI18n } from '../../hooks';\nimport { createStringMatcher } from '../../utils';\n\nimport type { LinkProps } from './AppShell.types';\nimport { StyledTopNavItem } from './AppTopNav.styles';\n\nregisterIcon(barsIcon);\n\nconst FILTER_THRESHOLD = 5;\n\ninterface TopNavMenuItem extends MenuItemProps {\n items?: TopNavMenuItem[];\n}\n\nconst linkToMenuItem = (link: LinkProps): TopNavMenuItem => {\n const userOnClick = link.onClick;\n const children = link.links?.map(linkToMenuItem);\n const hasChildren = children && children.length > 0;\n return {\n id: link.id || link.name,\n primary: link.name,\n visual: link.icon ? <Icon name={link.icon} /> : undefined,\n href: hasChildren ? undefined : link.href,\n // MenuItem uses `typeof selected !== 'boolean'` to decide expand vs click.\n selected: hasChildren ? undefined : link.active || undefined,\n onClick: userOnClick\n ? (_id, e) => {\n userOnClick(e);\n }\n : undefined,\n items: hasChildren ? children : undefined\n };\n};\n\nexport interface TopNavMoreMenuProps {\n items: LinkProps[];\n label?: string;\n active?: boolean;\n}\n\nconst TopNavMoreMenu = ({ items, label, active }: TopNavMoreMenuProps) => {\n const t = useI18n();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(false);\n const [filterValue, setFilterValue] = useState('');\n\n const close = useCallback(() => setOpen(false), []);\n\n useFocusWithin<HTMLElement>(\n [triggerRef, popoverRef],\n useCallback((isFocused: boolean) => {\n if (!isFocused) setOpen(false);\n }, [])\n );\n\n useEscape(\n useCallback(\n (e: KeyboardEvent) => {\n if (open) {\n setOpen(false);\n e.stopPropagation();\n triggerRef.current?.focus();\n }\n },\n [open]\n )\n // No target: attach to document so Escape works when focus is inside the\n // Popover portal (events from portal content don't bubble to the trigger element).\n );\n\n const allItems = useMemo(() => items.map(linkToMenuItem), [items]);\n const showFilter = items.length >= FILTER_THRESHOLD;\n const filterRegex = createStringMatcher(filterValue, 'contains');\n const menuItems = showFilter\n ? allItems.filter(it => filterRegex.test(String(it.primary ?? '')))\n : allItems;\n\n const handleTriggerClick = () => {\n if (!open) setFilterValue('');\n setOpen(v => !v);\n };\n\n return (\n <>\n <StyledTopNavItem\n ref={triggerRef}\n $active={active || open}\n aria-haspopup='menu'\n aria-expanded={open}\n onClick={handleTriggerClick}\n >\n <Icon name='bars' />\n <span>{label ?? t('app_shell_more')}</span>\n </StyledTopNavItem>\n {open && (\n <Popover ref={popoverRef} target={triggerRef.current} placement='bottom-end'>\n <Menu\n mode='action'\n variant='flyout'\n aria-label={label ?? t('app_shell_more')}\n items={menuItems}\n onItemClick={close}\n focusControlEl={triggerRef.current ?? undefined}\n {...(showFilter\n ? {\n filterInputProps: {\n value: filterValue,\n onChange: (e: ChangeEvent<HTMLInputElement>) => setFilterValue(e.target.value)\n }\n }\n : {})}\n />\n </Popover>\n )}\n </>\n );\n};\n\nexport default TopNavMoreMenu;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default } from './AppShell';
|
|
2
2
|
export { default as AppShellList } from './AppShellList';
|
|
3
3
|
export type { AppShellListProps } from './AppShellList';
|
|
4
|
-
export type { AppHeaderProps, AppShellProps, ContextSwitcherProps, DrawerItemProps, DrawerListProps, ShareAppConfig } from './AppShell.types';
|
|
4
|
+
export type { AppHeaderProps, AppShellProps, ContextSwitcherProps, DrawerItemProps, DrawerListProps, NavOrientation, ShareAppConfig } from './AppShell.types';
|
|
5
5
|
export { default as AppShellContext, AppShellDrawerContext } from './AppShellContext';
|
|
6
6
|
export { default as ContextSwitcher } from './ContextSwitcher';
|
|
7
7
|
export { default as ThemeSwitcher } from './ThemeSwitcher';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAWzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { default } from './AppShell';\nexport { default as AppShellList } from './AppShellList';\nexport type { AppShellListProps } from './AppShellList';\nexport type {\n AppHeaderProps,\n AppShellProps,\n ContextSwitcherProps,\n DrawerItemProps,\n DrawerListProps,\n NavOrientation,\n ShareAppConfig\n} from './AppShell.types';\nexport { default as AppShellContext, AppShellDrawerContext } from './AppShellContext';\nexport { default as ContextSwitcher } from './ContextSwitcher';\nexport { default as ThemeSwitcher } from './ThemeSwitcher';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { LinkProps } from './AppShell.types';
|
|
3
|
+
export interface OverflowResult {
|
|
4
|
+
visibleCount: number;
|
|
5
|
+
}
|
|
6
|
+
interface UseTopNavOverflowOptions {
|
|
7
|
+
moreButtonRef?: RefObject<HTMLElement | null>;
|
|
8
|
+
epsilon?: number;
|
|
9
|
+
}
|
|
10
|
+
interface UseTopNavOverflowReturn {
|
|
11
|
+
containerRef: RefObject<HTMLDivElement>;
|
|
12
|
+
measureRef: RefObject<HTMLDivElement>;
|
|
13
|
+
result: OverflowResult;
|
|
14
|
+
}
|
|
15
|
+
export declare function useTopNavOverflow(items: LinkProps[], opts: UseTopNavOverflowOptions): UseTopNavOverflowReturn;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useTopNavOverflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTopNavOverflow.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/useTopNavOverflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,wBAAwB;IAChC,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,uBAAuB;IAC/B,YAAY,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACtC,MAAM,EAAE,cAAc,CAAC;CACxB;AAcD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,EAAE,EAClB,IAAI,EAAE,wBAAwB,GAC7B,uBAAuB,CAsEzB"}
|