@pega/cosmos-react-core 4.0.0-dev.10.0 → 4.0.0-dev.10.1
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/AppShell.styles.d.ts +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +19 -13
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +6 -6
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +18 -11
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,9 +8,9 @@ export declare const StyledAppInfo: import("styled-components").StyledComponent<
|
|
|
8
8
|
export declare const StyledScrollWrap: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
9
9
|
export declare const StyledCountIcon: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
10
10
|
export declare const StyledSingleSelectIconBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
11
|
-
export declare const StyledNavItemIconBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
12
11
|
export declare const StyledNavListItemExpandCollapse: import("styled-components").StyledComponent<"svg", import("styled-components").DefaultTheme, {}, never>;
|
|
13
12
|
export declare const StyledUtilIconCount: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
13
|
+
export declare const StyledNavItemIconBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
14
14
|
export declare const StyledAppNav: import("styled-components").StyledComponent<"nav", import("styled-components").DefaultTheme, {
|
|
15
15
|
appHeader: boolean;
|
|
16
16
|
showEnv: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,QAAQ,SAAS,CAAC;AAC/B,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,YAAY,SAAS,CAAC;AAInC,eAAO,MAAM,oBAAoB;WAAyB,MAAM;SAmC/D,CAAC;AAIF,eAAO,MAAM,aAAa,uGA0CxB,CAAC;AAIH,eAAO,MAAM,gBAAgB,yGAM3B,CAAC;AAIH,eAAO,MAAM,eAAe,0GAa3B,CAAC;AAIF,eAAO,MAAM,yBAAyB,yGAMpC,CAAC;AAIH,eAAO,MAAM
|
|
1
|
+
{"version":3,"file":"AppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,QAAQ,SAAS,CAAC;AAC/B,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,YAAY,SAAS,CAAC;AAInC,eAAO,MAAM,oBAAoB;WAAyB,MAAM;SAmC/D,CAAC;AAIF,eAAO,MAAM,aAAa,uGA0CxB,CAAC;AAIH,eAAO,MAAM,gBAAgB,yGAM3B,CAAC;AAIH,eAAO,MAAM,eAAe,0GAa3B,CAAC;AAIF,eAAO,MAAM,yBAAyB,yGAMpC,CAAC;AAIH,eAAO,MAAM,+BAA+B,yGAAe,CAAC;AAE5D,eAAO,MAAM,mBAAmB,0GAE/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,yGAa/B,CAAC;AAIH,eAAO,MAAM,YAAY;eAA2B,OAAO;aAAW,OAAO;SA8E5E,CAAC;AAIF,eAAO,MAAM,eAAe,4GAAkB,CAAC;AAE/C,eAAO,MAAM,iBAAiB;yBACP,OAAO;kBACd,OAAO;SAmHrB,CAAC;AAIH,eAAO,MAAM,aAAa,wGAAc,CAAC;AAEzC,eAAO,MAAM,kBAAkB,yGAQ7B,CAAC;AAIH,eAAO,MAAM,mBAAmB,wGAY9B,CAAC;AAIH,eAAO,MAAM,eAAe,yGA2B1B,CAAC;AAIH,eAAO,MAAM,WAAW,yGAatB,CAAC;AAMH,eAAO,MAAM,eAAe,4GAmB1B,CAAC;AAIH,eAAO,MAAM,aAAa,yGAEzB,CAAC;AAIF,eAAO,MAAM,aAAa;eACb,OAAO;eACP,OAAO;aACT,OAAO;;SA8ChB,CAAC;AAIH,eAAO,MAAM,kBAAkB,yGAI7B,CAAC;AAIH,eAAO,MAAM,qBAAqB,yGAkBhC,CAAC;AAIH,eAAO,MAAM,0BAA0B;UAA0B,OAAO;SAsBtE,CAAC"}
|
|
@@ -102,11 +102,25 @@ export const StyledSingleSelectIconBox = styled.div(({ theme }) => {
|
|
|
102
102
|
`;
|
|
103
103
|
});
|
|
104
104
|
StyledSingleSelectIconBox.defaultProps = defaultThemeProp;
|
|
105
|
-
export const StyledNavItemIconBox = styled.div ``;
|
|
106
105
|
export const StyledNavListItemExpandCollapse = styled.svg ``;
|
|
107
106
|
export const StyledUtilIconCount = styled.span `
|
|
108
107
|
flex-shrink: 0;
|
|
109
108
|
`;
|
|
109
|
+
export const StyledNavItemIconBox = styled.div(({ theme }) => {
|
|
110
|
+
return css `
|
|
111
|
+
> ${StyledIcon}, ${StyledUtilIconCount} > ${StyledIcon} {
|
|
112
|
+
flex-shrink: 0;
|
|
113
|
+
margin-inline: calc((${navWidth} - 1.125rem) / 2);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
${StyledAvatar} {
|
|
117
|
+
flex-shrink: 0;
|
|
118
|
+
margin-inline: calc((${navWidth} - ${theme.base['hit-area']['mouse-min']}) / 2);
|
|
119
|
+
font-weight: ${theme.base['font-weight'].normal};
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
});
|
|
123
|
+
StyledNavItemIconBox.defaultProps = defaultThemeProp;
|
|
110
124
|
export const StyledAppNav = styled.nav(({ appHeader, showEnv, theme }) => {
|
|
111
125
|
const { navOpen } = useContext(AppShellContext);
|
|
112
126
|
return css `
|
|
@@ -278,15 +292,12 @@ export const StyledNavListItem = styled.li(({ theme, nestedListCollapsed, single
|
|
|
278
292
|
`}
|
|
279
293
|
}
|
|
280
294
|
|
|
281
|
-
${
|
|
282
|
-
flex-shrink: 0;
|
|
283
|
-
margin-inline: calc((${navWidth} - 1.125rem) / 2);
|
|
284
|
-
|
|
285
|
-
${singleSelect &&
|
|
295
|
+
${singleSelect &&
|
|
286
296
|
css `
|
|
297
|
+
${StyledNavItemIconBox} > ${StyledIcon} {
|
|
287
298
|
margin-inline: ${theme.base.spacing};
|
|
288
|
-
|
|
289
|
-
}
|
|
299
|
+
}
|
|
300
|
+
`}
|
|
290
301
|
|
|
291
302
|
${StyledSingleSelectIconBox} + span {
|
|
292
303
|
margin-inline-start: ${theme.base.spacing};
|
|
@@ -348,11 +359,6 @@ export const StyledUtils = styled.div(({ theme }) => {
|
|
|
348
359
|
const borderColor = tryCatch(() => lighten(0.1, theme.components['app-shell'].nav['background-color']));
|
|
349
360
|
return css `
|
|
350
361
|
border-top: 0.0625rem solid ${borderColor};
|
|
351
|
-
li ${StyledAvatar} {
|
|
352
|
-
flex-shrink: 0;
|
|
353
|
-
margin: 0 calc((${navWidth} - ${theme.base['hit-area']['mouse-min']}) / 2);
|
|
354
|
-
font-weight: ${theme.base['font-weight'].normal};
|
|
355
|
-
}
|
|
356
362
|
|
|
357
363
|
${StyledBareButton} > ${StyledIcon}:first-child, ${StyledBareButton} > ${StyledUtilIconCount} {
|
|
358
364
|
flex-shrink: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE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;;;;;;;oBAQI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAExC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, readableColor, rgba } from 'polished';\nimport { useContext } from 'react';\n\nimport { StyledAvatar } from '../Avatar';\nimport { StyledIcon } from '../Icon';\nimport { StyledImage } from '../Image/Image';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport { readableHue, calculateFontSize } from '../../styles';\nimport { StyledMenuItem } from '../Menu/Menu.styles';\nimport { useDirection } from '../../hooks';\nimport { StyledBareButton } from '../Button/BareButton';\nimport Button from '../Button';\nimport { StyledTooltip } from '../Tooltip';\nimport { StyledProgressBackdrop } from '../Progress';\n\nimport AppShellContext from './AppShellContext';\n\nexport const navWidth = '4rem';\nexport const navOpenWidth = '18.75rem';\nexport const headerHeight = '3rem';\n\n/* AppShell styles */\n\nexport const StyledAppEnvironment = styled(Flex)<{ color: string }>(\n ({\n color,\n theme: {\n base: {\n spacing,\n 'font-weight': { bold }\n },\n components: {\n 'app-shell': {\n nav: { 'background-color': navColor }\n }\n }\n }\n }) => {\n const foreground = tryCatch(\n () => readableHue(color, color),\n () => readableHue(navColor, navColor)\n );\n\n const shadow = tryCatch(() => rgba(foreground, 0.1));\n\n return css`\n background-color: ${color};\n color: ${foreground};\n box-shadow: inset 0 0 0 0.0625rem ${shadow};\n height: calc(${spacing} * 2.5);\n padding: 0 ${spacing};\n text-align: center;\n text-transform: uppercase;\n font-weight: ${bold};\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n }\n);\n\nStyledAppEnvironment.defaultProps = defaultThemeProp;\n\nexport const StyledAppInfo = styled.a(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const hoverColor = tryCatch(() =>\n lighten(0.05, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n padding: ${theme.base.spacing} calc(${navWidth} / 4);\n grid-template-columns: calc(${navWidth} / 2) auto;\n column-gap: calc(${navWidth} / 4);\n\n a&:hover,\n button&:hover {\n background-color: ${hoverColor};\n text-decoration: none;\n }\n\n &:focus:not([disabled]) {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledImage} {\n display: inline-block;\n width: calc(${navWidth} / 2);\n }\n\n span {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n span:last-of-type {\n font-size: ${fontSize.xs};\n color: rgba(255, 255, 255, 0.7);\n }\n\n span:first-of-type {\n font-size: ${fontSize.s};\n color: ${theme.base.colors.white};\n }\n `;\n});\n\nStyledAppInfo.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrap = styled.div(() => {\n return css`\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n `;\n});\n\nStyledScrollWrap.defaultProps = defaultThemeProp;\n\nexport const StyledCountIcon = styled.span(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n position: absolute;\n inset-inline-start: calc(4 * ${spacing});\n top: calc(0.5 * ${spacing});\n padding: 0 calc(0.5 * ${spacing});\n `;\n }\n);\n\nStyledCountIcon.defaultProps = defaultThemeProp;\n\nexport const StyledSingleSelectIconBox = styled.div(({ theme }) => {\n return css`\n height: ${theme.base['hit-area']['mouse-min']};\n width: ${theme.base['hit-area']['mouse-min']};\n margin-inline-start: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledSingleSelectIconBox.defaultProps = defaultThemeProp;\n\nexport const StyledNavItemIconBox = styled.div``;\n\nexport const StyledNavListItemExpandCollapse = styled.svg``;\n\nexport const StyledUtilIconCount = styled.span`\n flex-shrink: 0;\n`;\n\nexport const StyledAppNav = styled.nav<{ appHeader: boolean; showEnv: boolean }>(\n ({ appHeader, showEnv, theme }) => {\n const { navOpen } = useContext(AppShellContext);\n\n return css`\n position: fixed;\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n background: ${theme.components['app-shell'].nav['background-color']};\n max-width: calc(100vw - ${theme.base['hit-area']['mouse-min']});\n width: ${navOpen ? navOpenWidth : navWidth};\n height: calc(100vh - ${appHeader ? headerHeight : '0rem'});\n overflow: hidden;\n white-space: nowrap;\n transition: width ${`${theme.base.animation.speed} ${theme.base.animation.timing.ease}`};\n padding-block-end: ${theme.base.spacing};\n\n ${!showEnv &&\n css`\n padding-block-start: ${theme.base.spacing};\n `}\n\n @media (pointer: coarse) {\n max-width: calc(100vw - ${theme.base['hit-area']['finger-min']});\n }\n\n ${theme.base['custom-scrollbar'] &&\n css`\n * {\n scrollbar-color: rgba(255, 255, 255, 0.6) rgba(0, 0, 0, 0.2);\n scrollbar-width: thin;\n }\n\n @supports not ((scrollbar-width: thin) or (scrollbar-color: black white)) {\n /* stylelint-disable unit-allowed-list */\n\n *::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n *::-webkit-scrollbar-track {\n background-color: rgba(0, 0, 0, 0.2);\n }\n\n *::-webkit-scrollbar-corner {\n background-color: rgba(0, 0, 0, 0.2);\n border-bottom-right-radius: inherit;\n }\n\n *::-webkit-scrollbar-thumb {\n background-color: transparent;\n border: 3px solid transparent;\n border-radius: calc(1.125 * ${theme.base['border-radius']});\n box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.6);\n }\n\n *::-webkit-scrollbar-thumb:hover {\n box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.7);\n }\n\n *::-webkit-scrollbar-track:horizontal {\n border-bottom-left-radius: inherit;\n }\n\n *::-webkit-scrollbar-track:vertical {\n border-top-right-radius: inherit;\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-no-unknown */\n *::-webkit-scrollbar-track:not(:corner-present) {\n border-bottom-right-radius: inherit;\n }\n\n /* stylelint-enable unit-allowed-list */\n }\n `}\n `;\n }\n);\n\nStyledAppNav.defaultProps = defaultThemeProp;\n\nexport const StyledCaseClose = styled.button``;\n\nexport const StyledNavListItem = styled.li<{\n nestedListCollapsed: boolean;\n singleSelect: boolean;\n}>(({ theme, nestedListCollapsed, singleSelect }) => {\n const { navOpen } = useContext(AppShellContext);\n const activeBackground = tryCatch(() =>\n rgba('#000000', theme.base.transparency['transparent-4'])\n );\n\n const { rtl } = useDirection();\n\n return css`\n display: block;\n position: relative;\n\n ${StyledIcon} {\n font-size: 1.25rem;\n }\n\n ${StyledCaseClose} {\n display: flex;\n position: absolute;\n left: ${navOpen ? 'auto' : '100%'};\n opacity: 0;\n &:hover,\n &:focus {\n ${navOpen &&\n css`\n opacity: 1;\n `}\n }\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n `}\n top: 50%;\n bottom: 50%;\n margin: auto 0;\n color: rgba(255, 255, 255, 0.7);\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n }\n\n > :first-child {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n padding: calc(1.25 * ${theme.base.spacing}) 0;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.7);\n cursor: pointer;\n font-weight: ${theme.base['font-weight']['semi-bold']};\n text-decoration: none;\n\n span:not(${StyledCountIcon}) {\n overflow: hidden;\n text-overflow: ellipsis;\n color: inherit;\n white-space: nowrap;\n }\n\n &:hover,\n &:focus {\n color: #ffffff;\n background: rgba(255, 255, 255, 0.05);\n }\n\n &:hover + ${StyledCaseClose}, &:focus + ${StyledCaseClose} {\n ${navOpen &&\n css`\n opacity: 1;\n `}\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledNavListItemExpandCollapse} {\n position: absolute;\n left: ${navOpen ? 'auto' : '100%'};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n `}\n margin: 0;\n opacity: ${navOpen ? '1' : '0'};\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${!nestedListCollapsed &&\n css`\n transform: rotateZ(${rtl ? '-90deg' : '90deg'});\n `}\n }\n\n ${StyledNavItemIconBox}:not(:has(${StyledAvatar})) {\n flex-shrink: 0;\n margin-inline: calc((${navWidth} - 1.125rem) / 2);\n\n ${singleSelect &&\n css`\n margin-inline: ${theme.base.spacing};\n `}\n }\n\n ${StyledSingleSelectIconBox} + span {\n margin-inline-start: ${theme.base.spacing};\n }\n }\n\n &[aria-current='page'] > :first-child {\n color: ${theme.base.colors.blue.light};\n background-color: ${activeBackground};\n }\n `;\n});\n\nStyledNavListItem.defaultProps = defaultThemeProp;\n\nexport const StyledNavList = styled.ul``;\n\nexport const StyledNavCasesList = styled.div(({ theme }) => {\n return css`\n ${StyledNavListItem} {\n > :first-child {\n padding: ${theme.base.spacing} 0;\n }\n }\n `;\n});\n\nStyledNavCasesList.defaultProps = defaultThemeProp;\n\nexport const StyledNestedNavList = styled(StyledNavList)(({ theme }) => {\n const background = tryCatch(() => rgba('#000000', theme.base.transparency['transparent-4']));\n return css`\n background: ${background};\n\n ${StyledNavListItem} {\n > :first-child {\n padding-inline-start: ${navWidth};\n font-weight: ${theme.base['font-weight'].normal};\n }\n }\n `;\n});\n\nStyledNestedNavList.defaultProps = defaultThemeProp;\n\nexport const StyledCaseTypes = styled.div(props => {\n const {\n theme: {\n base: {\n animation: {\n speed,\n timing: { ease: acceleration }\n }\n }\n }\n } = props;\n\n return css`\n button {\n ${StyledNavItemIconBox} {\n transition: transform ${speed} ${acceleration};\n }\n\n &[aria-expanded='false'] ${StyledNavItemIconBox} {\n transform: none;\n }\n\n &[aria-expanded='true'] ${StyledNavItemIconBox} {\n transform: rotateZ(45deg);\n }\n }\n `;\n});\n\nStyledCaseTypes.defaultProps = defaultThemeProp;\n\nexport const StyledUtils = styled.div(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n return css`\n border-top: 0.0625rem solid ${borderColor};\n li ${StyledAvatar} {\n flex-shrink: 0;\n margin: 0 calc((${navWidth} - ${theme.base['hit-area']['mouse-min']}) / 2);\n font-weight: ${theme.base['font-weight'].normal};\n }\n\n ${StyledBareButton} > ${StyledIcon}:first-child, ${StyledBareButton} > ${StyledUtilIconCount} {\n flex-shrink: 0;\n margin: 0 calc((${navWidth} - 1.125rem) / 2);\n }\n `;\n});\n\nStyledUtils.defaultProps = defaultThemeProp;\n\n/* Mobile AppShell styles */\n\nexport const StyledMobileNav = styled.header(({ theme }) => {\n const mobileNavColor = theme.base.palette['brand-primary'];\n\n const contrastColor = tryCatch(() => readableColor(mobileNavColor));\n\n return css`\n min-width: 100%;\n min-height: ${headerHeight};\n z-index: ${theme.base['z-index'].drawer};\n background-color: ${mobileNavColor};\n color: ${contrastColor};\n position: sticky;\n top: 0;\n padding-inline-start: ${theme.base.spacing};\n\n @media (pointer: coarse) {\n padding-inline-start: 0;\n }\n `;\n});\n\nStyledMobileNav.defaultProps = defaultThemeProp;\n\nexport const StyledLoading = styled.div`\n font-size: 2rem;\n`;\n\n/* Main content region styles */\n\nexport const StyledAppMain = styled.main<{\n appHeader: boolean;\n mobileNav: boolean;\n navOpen: boolean;\n headerOffset?: number;\n}>(({ appHeader, mobileNav, navOpen, headerOffset = 0, theme }) => {\n const heightOffset = appHeader || mobileNav ? headerHeight : '0rem';\n\n return css`\n --appshell-offset: ${headerOffset}px;\n\n /* stylelint-disable-next-line length-zero-no-unit */\n --appshell-horizontal-offset: 0rem;\n\n @media (min-width: ${theme.base.breakpoints.sm}) {\n --appshell-horizontal-offset: ${navOpen ? navOpenWidth : navWidth};\n }\n position: relative;\n margin-inline-start: ${mobileNav ? 0 : navWidth};\n min-height: calc(100vh - ${heightOffset});\n background-color: ${theme.base.palette['app-background']};\n\n :focus {\n outline: none;\n }\n\n ${navOpen &&\n !mobileNav &&\n css`\n margin-inline-start: ${navOpenWidth};\n `}\n\n ${!mobileNav &&\n css`\n transition: margin-inline-start\n ${`${theme.base.animation.speed} ${theme.base.animation.timing.ease}`};\n `}\n\n & > ${StyledProgressBackdrop} {\n max-height: calc(100vh - ${heightOffset});\n max-width: calc(100vw - ${navOpen ? navOpenWidth : navWidth});\n inset-block-start: ${heightOffset};\n inset-inline-start: ${navOpen ? navOpenWidth : navWidth};\n position: fixed;\n transition-property: opacity, max-height, max-width, inset-block-start, inset-inline-start;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n }\n `;\n});\n\nStyledAppMain.defaultProps = defaultThemeProp;\n\nexport const StyledBannerRegion = styled.div(({ theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledBannerRegion.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellTooltip = styled(StyledTooltip)(({ theme }) => {\n return css`\n background-color: ${theme.components.tooltip['background-color']};\n padding: 0;\n header {\n border-bottom: none;\n }\n ${StyledMenuItem} {\n background-color: ${theme.components.tooltip['background-color']};\n color: ${theme.base.palette.light};\n\n &:hover,\n &:focus {\n background-color: ${theme.components.tooltip['background-color']};\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledAppShellTooltip.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellToggleButton = styled(Button)<{ open: boolean }>(({ theme, open }) => {\n return css`\n background-color: ${theme.base.palette.dark};\n color: ${theme.base.palette.light};\n border: none;\n margin-top: calc(1 * ${theme.base.spacing});\n ${open &&\n css`\n padding-inline: 1rem;\n `}\n\n ${StyledIcon} {\n width: 1.25rem;\n height: 1.25rem;\n font-weight: bold;\n }\n\n &:enabled:focus,\n :not([disabled]):focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledAppShellToggleButton.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"AppShell.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OA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,EAAE;IAC9F,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI;aAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK;;2BAEV,KAAK,CAAC,IAAI,CAAC,OAAO;MACvC,IAAI;QACN,GAAG,CAAA;;KAEF;;MAEC,UAAU;;;;;;;;oBAQI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAExC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, readableColor, rgba } from 'polished';\nimport { useContext } from 'react';\n\nimport { StyledAvatar } from '../Avatar';\nimport { StyledIcon } from '../Icon';\nimport { StyledImage } from '../Image/Image';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport { readableHue, calculateFontSize } from '../../styles';\nimport { StyledMenuItem } from '../Menu/Menu.styles';\nimport { useDirection } from '../../hooks';\nimport { StyledBareButton } from '../Button/BareButton';\nimport Button from '../Button';\nimport { StyledTooltip } from '../Tooltip';\nimport { StyledProgressBackdrop } from '../Progress';\n\nimport AppShellContext from './AppShellContext';\n\nexport const navWidth = '4rem';\nexport const navOpenWidth = '18.75rem';\nexport const headerHeight = '3rem';\n\n/* AppShell styles */\n\nexport const StyledAppEnvironment = styled(Flex)<{ color: string }>(\n ({\n color,\n theme: {\n base: {\n spacing,\n 'font-weight': { bold }\n },\n components: {\n 'app-shell': {\n nav: { 'background-color': navColor }\n }\n }\n }\n }) => {\n const foreground = tryCatch(\n () => readableHue(color, color),\n () => readableHue(navColor, navColor)\n );\n\n const shadow = tryCatch(() => rgba(foreground, 0.1));\n\n return css`\n background-color: ${color};\n color: ${foreground};\n box-shadow: inset 0 0 0 0.0625rem ${shadow};\n height: calc(${spacing} * 2.5);\n padding: 0 ${spacing};\n text-align: center;\n text-transform: uppercase;\n font-weight: ${bold};\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n }\n);\n\nStyledAppEnvironment.defaultProps = defaultThemeProp;\n\nexport const StyledAppInfo = styled.a(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const hoverColor = tryCatch(() =>\n lighten(0.05, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n padding: ${theme.base.spacing} calc(${navWidth} / 4);\n grid-template-columns: calc(${navWidth} / 2) auto;\n column-gap: calc(${navWidth} / 4);\n\n a&:hover,\n button&:hover {\n background-color: ${hoverColor};\n text-decoration: none;\n }\n\n &:focus:not([disabled]) {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledImage} {\n display: inline-block;\n width: calc(${navWidth} / 2);\n }\n\n span {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n span:last-of-type {\n font-size: ${fontSize.xs};\n color: rgba(255, 255, 255, 0.7);\n }\n\n span:first-of-type {\n font-size: ${fontSize.s};\n color: ${theme.base.colors.white};\n }\n `;\n});\n\nStyledAppInfo.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrap = styled.div(() => {\n return css`\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n `;\n});\n\nStyledScrollWrap.defaultProps = defaultThemeProp;\n\nexport const StyledCountIcon = styled.span(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n position: absolute;\n inset-inline-start: calc(4 * ${spacing});\n top: calc(0.5 * ${spacing});\n padding: 0 calc(0.5 * ${spacing});\n `;\n }\n);\n\nStyledCountIcon.defaultProps = defaultThemeProp;\n\nexport const StyledSingleSelectIconBox = styled.div(({ theme }) => {\n return css`\n height: ${theme.base['hit-area']['mouse-min']};\n width: ${theme.base['hit-area']['mouse-min']};\n margin-inline-start: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledSingleSelectIconBox.defaultProps = defaultThemeProp;\n\nexport const StyledNavListItemExpandCollapse = styled.svg``;\n\nexport const StyledUtilIconCount = styled.span`\n flex-shrink: 0;\n`;\n\nexport const StyledNavItemIconBox = styled.div(({ theme }) => {\n return css`\n > ${StyledIcon}, ${StyledUtilIconCount} > ${StyledIcon} {\n flex-shrink: 0;\n margin-inline: calc((${navWidth} - 1.125rem) / 2);\n }\n\n ${StyledAvatar} {\n flex-shrink: 0;\n margin-inline: calc((${navWidth} - ${theme.base['hit-area']['mouse-min']}) / 2);\n font-weight: ${theme.base['font-weight'].normal};\n }\n `;\n});\n\nStyledNavItemIconBox.defaultProps = defaultThemeProp;\n\nexport const StyledAppNav = styled.nav<{ appHeader: boolean; showEnv: boolean }>(\n ({ appHeader, showEnv, theme }) => {\n const { navOpen } = useContext(AppShellContext);\n\n return css`\n position: fixed;\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n background: ${theme.components['app-shell'].nav['background-color']};\n max-width: calc(100vw - ${theme.base['hit-area']['mouse-min']});\n width: ${navOpen ? navOpenWidth : navWidth};\n height: calc(100vh - ${appHeader ? headerHeight : '0rem'});\n overflow: hidden;\n white-space: nowrap;\n transition: width ${`${theme.base.animation.speed} ${theme.base.animation.timing.ease}`};\n padding-block-end: ${theme.base.spacing};\n\n ${!showEnv &&\n css`\n padding-block-start: ${theme.base.spacing};\n `}\n\n @media (pointer: coarse) {\n max-width: calc(100vw - ${theme.base['hit-area']['finger-min']});\n }\n\n ${theme.base['custom-scrollbar'] &&\n css`\n * {\n scrollbar-color: rgba(255, 255, 255, 0.6) rgba(0, 0, 0, 0.2);\n scrollbar-width: thin;\n }\n\n @supports not ((scrollbar-width: thin) or (scrollbar-color: black white)) {\n /* stylelint-disable unit-allowed-list */\n\n *::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n *::-webkit-scrollbar-track {\n background-color: rgba(0, 0, 0, 0.2);\n }\n\n *::-webkit-scrollbar-corner {\n background-color: rgba(0, 0, 0, 0.2);\n border-bottom-right-radius: inherit;\n }\n\n *::-webkit-scrollbar-thumb {\n background-color: transparent;\n border: 3px solid transparent;\n border-radius: calc(1.125 * ${theme.base['border-radius']});\n box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.6);\n }\n\n *::-webkit-scrollbar-thumb:hover {\n box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.7);\n }\n\n *::-webkit-scrollbar-track:horizontal {\n border-bottom-left-radius: inherit;\n }\n\n *::-webkit-scrollbar-track:vertical {\n border-top-right-radius: inherit;\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-no-unknown */\n *::-webkit-scrollbar-track:not(:corner-present) {\n border-bottom-right-radius: inherit;\n }\n\n /* stylelint-enable unit-allowed-list */\n }\n `}\n `;\n }\n);\n\nStyledAppNav.defaultProps = defaultThemeProp;\n\nexport const StyledCaseClose = styled.button``;\n\nexport const StyledNavListItem = styled.li<{\n nestedListCollapsed: boolean;\n singleSelect: boolean;\n}>(({ theme, nestedListCollapsed, singleSelect }) => {\n const { navOpen } = useContext(AppShellContext);\n const activeBackground = tryCatch(() =>\n rgba('#000000', theme.base.transparency['transparent-4'])\n );\n\n const { rtl } = useDirection();\n\n return css`\n display: block;\n position: relative;\n\n ${StyledIcon} {\n font-size: 1.25rem;\n }\n\n ${StyledCaseClose} {\n display: flex;\n position: absolute;\n left: ${navOpen ? 'auto' : '100%'};\n opacity: 0;\n &:hover,\n &:focus {\n ${navOpen &&\n css`\n opacity: 1;\n `}\n }\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n `}\n top: 50%;\n bottom: 50%;\n margin: auto 0;\n color: rgba(255, 255, 255, 0.7);\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n }\n\n > :first-child {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n padding: calc(1.25 * ${theme.base.spacing}) 0;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.7);\n cursor: pointer;\n font-weight: ${theme.base['font-weight']['semi-bold']};\n text-decoration: none;\n\n span:not(${StyledCountIcon}) {\n overflow: hidden;\n text-overflow: ellipsis;\n color: inherit;\n white-space: nowrap;\n }\n\n &:hover,\n &:focus {\n color: #ffffff;\n background: rgba(255, 255, 255, 0.05);\n }\n\n &:hover + ${StyledCaseClose}, &:focus + ${StyledCaseClose} {\n ${navOpen &&\n css`\n opacity: 1;\n `}\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledNavListItemExpandCollapse} {\n position: absolute;\n left: ${navOpen ? 'auto' : '100%'};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n `}\n margin: 0;\n opacity: ${navOpen ? '1' : '0'};\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${!nestedListCollapsed &&\n css`\n transform: rotateZ(${rtl ? '-90deg' : '90deg'});\n `}\n }\n\n ${singleSelect &&\n css`\n ${StyledNavItemIconBox} > ${StyledIcon} {\n margin-inline: ${theme.base.spacing};\n }\n `}\n\n ${StyledSingleSelectIconBox} + span {\n margin-inline-start: ${theme.base.spacing};\n }\n }\n\n &[aria-current='page'] > :first-child {\n color: ${theme.base.colors.blue.light};\n background-color: ${activeBackground};\n }\n `;\n});\n\nStyledNavListItem.defaultProps = defaultThemeProp;\n\nexport const StyledNavList = styled.ul``;\n\nexport const StyledNavCasesList = styled.div(({ theme }) => {\n return css`\n ${StyledNavListItem} {\n > :first-child {\n padding: ${theme.base.spacing} 0;\n }\n }\n `;\n});\n\nStyledNavCasesList.defaultProps = defaultThemeProp;\n\nexport const StyledNestedNavList = styled(StyledNavList)(({ theme }) => {\n const background = tryCatch(() => rgba('#000000', theme.base.transparency['transparent-4']));\n return css`\n background: ${background};\n\n ${StyledNavListItem} {\n > :first-child {\n padding-inline-start: ${navWidth};\n font-weight: ${theme.base['font-weight'].normal};\n }\n }\n `;\n});\n\nStyledNestedNavList.defaultProps = defaultThemeProp;\n\nexport const StyledCaseTypes = styled.div(props => {\n const {\n theme: {\n base: {\n animation: {\n speed,\n timing: { ease: acceleration }\n }\n }\n }\n } = props;\n\n return css`\n button {\n ${StyledNavItemIconBox} {\n transition: transform ${speed} ${acceleration};\n }\n\n &[aria-expanded='false'] ${StyledNavItemIconBox} {\n transform: none;\n }\n\n &[aria-expanded='true'] ${StyledNavItemIconBox} {\n transform: rotateZ(45deg);\n }\n }\n `;\n});\n\nStyledCaseTypes.defaultProps = defaultThemeProp;\n\nexport const StyledUtils = styled.div(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n border-top: 0.0625rem solid ${borderColor};\n\n ${StyledBareButton} > ${StyledIcon}:first-child, ${StyledBareButton} > ${StyledUtilIconCount} {\n flex-shrink: 0;\n margin: 0 calc((${navWidth} - 1.125rem) / 2);\n }\n `;\n});\n\nStyledUtils.defaultProps = defaultThemeProp;\n\n/* Mobile AppShell styles */\n\nexport const StyledMobileNav = styled.header(({ theme }) => {\n const mobileNavColor = theme.base.palette['brand-primary'];\n\n const contrastColor = tryCatch(() => readableColor(mobileNavColor));\n\n return css`\n min-width: 100%;\n min-height: ${headerHeight};\n z-index: ${theme.base['z-index'].drawer};\n background-color: ${mobileNavColor};\n color: ${contrastColor};\n position: sticky;\n top: 0;\n padding-inline-start: ${theme.base.spacing};\n\n @media (pointer: coarse) {\n padding-inline-start: 0;\n }\n `;\n});\n\nStyledMobileNav.defaultProps = defaultThemeProp;\n\nexport const StyledLoading = styled.div`\n font-size: 2rem;\n`;\n\n/* Main content region styles */\n\nexport const StyledAppMain = styled.main<{\n appHeader: boolean;\n mobileNav: boolean;\n navOpen: boolean;\n headerOffset?: number;\n}>(({ appHeader, mobileNav, navOpen, headerOffset = 0, theme }) => {\n const heightOffset = appHeader || mobileNav ? headerHeight : '0rem';\n\n return css`\n --appshell-offset: ${headerOffset}px;\n\n /* stylelint-disable-next-line length-zero-no-unit */\n --appshell-horizontal-offset: 0rem;\n\n @media (min-width: ${theme.base.breakpoints.sm}) {\n --appshell-horizontal-offset: ${navOpen ? navOpenWidth : navWidth};\n }\n position: relative;\n margin-inline-start: ${mobileNav ? 0 : navWidth};\n min-height: calc(100vh - ${heightOffset});\n background-color: ${theme.base.palette['app-background']};\n\n :focus {\n outline: none;\n }\n\n ${navOpen &&\n !mobileNav &&\n css`\n margin-inline-start: ${navOpenWidth};\n `}\n\n ${!mobileNav &&\n css`\n transition: margin-inline-start\n ${`${theme.base.animation.speed} ${theme.base.animation.timing.ease}`};\n `}\n\n & > ${StyledProgressBackdrop} {\n max-height: calc(100vh - ${heightOffset});\n max-width: calc(100vw - ${navOpen ? navOpenWidth : navWidth});\n inset-block-start: ${heightOffset};\n inset-inline-start: ${navOpen ? navOpenWidth : navWidth};\n position: fixed;\n transition-property: opacity, max-height, max-width, inset-block-start, inset-inline-start;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n }\n `;\n});\n\nStyledAppMain.defaultProps = defaultThemeProp;\n\nexport const StyledBannerRegion = styled.div(({ theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledBannerRegion.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellTooltip = styled(StyledTooltip)(({ theme }) => {\n return css`\n background-color: ${theme.components.tooltip['background-color']};\n padding: 0;\n header {\n border-bottom: none;\n }\n ${StyledMenuItem} {\n background-color: ${theme.components.tooltip['background-color']};\n color: ${theme.base.palette.light};\n\n &:hover,\n &:focus {\n background-color: ${theme.components.tooltip['background-color']};\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledAppShellTooltip.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellToggleButton = styled(Button)<{ open: boolean }>(({ theme, open }) => {\n return css`\n background-color: ${theme.base.palette.dark};\n color: ${theme.base.palette.light};\n border: none;\n margin-top: calc(1 * ${theme.base.spacing});\n ${open &&\n css`\n padding-inline: 1rem;\n `}\n\n ${StyledIcon} {\n width: 1.25rem;\n height: 1.25rem;\n font-weight: bold;\n }\n\n &:enabled:focus,\n :not([disabled]):focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledAppShellToggleButton.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EASlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAU,YAAY,EAAE,MAAM,aAAa,CAAC;AAgCnD,OAAO,EACL,gBAAgB,EAIjB,MAAM,qBAAqB,CAAC;AAkC7B,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"ListToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EASlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAU,YAAY,EAAE,MAAM,aAAa,CAAC;AAgCnD,OAAO,EACL,gBAAgB,EAIjB,MAAM,qBAAqB,CAAC;AAkC7B,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CA0UnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -176,15 +176,15 @@ const ListToolbar = forwardRef(({ name, viewSelector, formControlProps, createNe
|
|
|
176
176
|
}
|
|
177
177
|
return basicActions.length ? basicActions : undefined;
|
|
178
178
|
}, [actions, filter, sort, group, getQueryOptionAction]);
|
|
179
|
+
const selectedViewName = viewSelector
|
|
180
|
+
? viewSelector.views.find(view => view.selected)?.text ?? viewSelector.views[0].text
|
|
181
|
+
: null;
|
|
182
|
+
const labelText = viewSelector ? selectedViewName : name;
|
|
179
183
|
return (_jsxs(Flex, { as: StyledListToolbar, container: { direction: 'column', gap: 0.5 }, item: { grow: 1 }, ref: toolbarRef, role: 'toolbar', children: [_jsxs(Flex, { container: { alignItems: 'start', justify: 'between', gap: 2 }, children: [_jsxs(StyledContainer, { container: {
|
|
180
184
|
alignItems: 'center',
|
|
181
|
-
gap:
|
|
185
|
+
gap: 1,
|
|
182
186
|
wrap: 'wrap'
|
|
183
|
-
}, children: [_jsx(StyledHeadingText, { variant: 'h3', required: viewSelector?.views?.length && formControlProps?.required, "aria-label": `${name}${viewSelector
|
|
184
|
-
? `: ${viewSelector.views.find(view => view.selected)?.text ??
|
|
185
|
-
viewSelector.views[0].text}`
|
|
186
|
-
: ''}`, children: !viewSelector || viewSelector.views.length <= 1 ? (`${viewSelector && viewSelector.views.length === 1 ? viewSelector.views[0].text : ''}`) : (_jsx(StyledViewSelector, { variant: 'text', text: viewSelector.views.find(view => view.selected)?.text ??
|
|
187
|
-
viewSelector.views[0].text, menu: {
|
|
187
|
+
}, children: [_jsx(StyledHeadingText, { variant: 'h3', required: viewSelector?.views?.length && formControlProps?.required, "aria-label": selectedViewName ? `${name} - ${selectedViewName}` : name, children: !viewSelector || viewSelector.views.length <= 1 ? (labelText) : (_jsx(StyledViewSelector, { variant: 'text', text: labelText, menu: {
|
|
188
188
|
mode: 'single-select',
|
|
189
189
|
items: viewSelector.views.map(view => ({
|
|
190
190
|
...view,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListToolbar.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EAET,MAAM,OAAO,CAAC;AAEf,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,aAAa,CAAC;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OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAC7C,IACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n KeyboardEvent,\n PropsWithoutRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n MouseEvent\n} from 'react';\n\nimport Actions from '../Actions';\nimport Button from '../Button';\nimport { Action, ForwardProps } from '../../types';\nimport {\n useArrows,\n useBreakpoint,\n useConfiguration,\n useConsolidatedRef,\n useEscape,\n useFocusTrap,\n useFocusWithin,\n useI18n\n} from '../../hooks';\nimport Flex from '../Flex';\nimport SearchInput from '../SearchInput';\nimport Icon, { registerIcon } from '../Icon';\nimport * as filterIcon from '../Icon/icons/filter.icon';\nimport * as arrowUpDownIcon from '../Icon/icons/arrow-up-down.icon';\nimport * as rowIcon from '../Icon/icons/row.icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport * as moreIcon from '../Icon/icons/more.icon';\nimport { hasProp } from '../../utils';\nimport FormDialog from '../Dialog/FormDialog';\nimport { formatNumber } from '../Number';\n\nimport PresetMenuPopover, { PresetMenuPopoverProps } from './PresetMenuPopover';\nimport {\n StyledViewSelector,\n StyledSearchForm,\n StyledListToolbar,\n StyledHeadingText,\n StyledCountMeta,\n StyledContainer\n} from './ListToolbar.styles';\nimport {\n ListToolbarProps,\n PresetMenuProps,\n QueryOptionDialogProps,\n QueryOptionId\n} from './ListToolbar.types';\n\nregisterIcon(filterIcon, arrowUpDownIcon, rowIcon, plusIcon, moreIcon);\n\nconst CountMeta = ({ count }: { count: NonNullable<ListToolbarProps['count']> }) => {\n const { locale } = useConfiguration();\n const t = useI18n();\n const totalFormattedValue = formatNumber(count.total ?? 0, {\n locale,\n options: {\n useGrouping: true\n }\n });\n return (\n <StyledCountMeta variant='secondary'>\n {count.total !== undefined &&\n count.selected === undefined &&\n t('results_count', [count.totalHasMore ? `${totalFormattedValue}+` : totalFormattedValue], {\n count: count.total\n })}\n {count.total !== undefined &&\n count.selected !== undefined &&\n t(\n 'selected_count',\n [\n formatNumber(count.selected, { locale, options: { useGrouping: true } }),\n count.totalHasMore ? `${totalFormattedValue}+` : totalFormattedValue\n ],\n { count: count.selected }\n )}\n </StyledCountMeta>\n );\n};\n\nconst ListToolbar: FunctionComponent<ListToolbarProps & ForwardProps> = forwardRef(\n (\n {\n name,\n viewSelector,\n formControlProps,\n createNew,\n search,\n count,\n additionalActions,\n filter,\n sort,\n group,\n actions,\n actionsButtonRef\n }: PropsWithoutRef<ListToolbarProps>,\n ref: ListToolbarProps['ref']\n ) => {\n const t = useI18n();\n\n const isSmallOrAbove = useBreakpoint('sm');\n const consolidatedActionsButtonRef = useConsolidatedRef(actionsButtonRef);\n const toolbarRef = useConsolidatedRef(ref);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const searchWrapperRef = useRef<HTMLDivElement>(null);\n const searchButtonRef = useRef<HTMLButtonElement>(null);\n const [isSearchOpen, setIsSearchOpen] = useState(!!search?.value);\n\n const onSearchEscape = useCallback(() => {\n if (!search?.value) {\n setIsSearchOpen(false);\n }\n setTimeout(() => searchButtonRef.current?.focus());\n }, [search?.value]);\n\n useEffect(() => {\n if (search?.value) {\n setIsSearchOpen(true);\n }\n }, [search?.value]);\n\n const hasFocus = useFocusWithin([searchWrapperRef]);\n useArrows(hasFocus ? { current: null } : toolbarRef, {\n dir: 'left-right',\n selector: \"button:enabled:first-child, :not(input) + button:enabled, div[role='button']\"\n });\n\n useEffect(() => {\n if (searchWrapperRef.current) {\n const focusables = searchWrapperRef.current.querySelectorAll<HTMLElement>(\n \"button:enabled, input[type='search']:enabled\"\n );\n if (!hasFocus) {\n focusables.forEach(item => {\n item.tabIndex = -1;\n });\n if (\n searchButtonRef.current !== document.activeElement &&\n isSearchOpen &&\n !search?.value\n ) {\n setIsSearchOpen(false);\n }\n } else {\n focusables.forEach(item => {\n item.tabIndex = 0;\n });\n }\n }\n }, [hasFocus]);\n\n const [currentQueryOptionId, setCurrentQueryOptionId] = useState<QueryOptionId | null>(null);\n const queryOptionPopoverTarget = useRef<HTMLButtonElement>();\n\n const [actionsQueryOptionPreset, setActionsQueryOptionPreset] =\n useState<Pick<PresetMenuPopoverProps, 'heading' | 'menu'>>();\n const [optionPresetMenuOpen, setOptionPresetMenuOpen] = useState(false);\n\n const createNewButton = useMemo(() => {\n if (!createNew?.onClick) return null;\n const text = createNew.label ?? t('create_new');\n\n return (\n <Button variant='simple' icon label={text} aria-label={text} onClick={createNew.onClick}>\n <Icon name='plus' />\n </Button>\n );\n }, [t, createNew, isSmallOrAbove]);\n\n useFocusTrap(searchWrapperRef);\n useEscape(onSearchEscape, searchButtonRef);\n const searchInputWrapper = useMemo(\n () => (\n <div role='dialog' ref={searchWrapperRef}>\n <SearchInput\n {...search}\n onSearchSubmit={(value: string) => {\n search?.onSearchSubmit?.(value);\n onSearchEscape();\n }}\n onClick={(e: MouseEvent<HTMLInputElement>) => {\n e.preventDefault();\n }}\n ref={searchInputRef}\n tabIndex='-1'\n />\n </div>\n ),\n [search, onSearchEscape]\n );\n\n const searchLabel = t('search');\n const searchButton = useMemo(() => {\n return (\n <Button\n as='div'\n role='button'\n variant='simple'\n icon\n label={!isSearchOpen ? searchLabel : undefined}\n aria-label={searchLabel}\n onClick={() => {\n setIsSearchOpen(true);\n setTimeout(() => searchInputRef.current?.focus());\n }}\n onKeyDown={(e: KeyboardEvent<HTMLElement>) => {\n if (e.target !== searchInputRef.current && e.key === 'Enter') {\n setIsSearchOpen(true);\n setTimeout(() => {\n searchInputRef.current?.focus();\n searchInputRef.current?.select();\n });\n }\n }}\n tabIndex='-1'\n ref={searchButtonRef}\n >\n {isSearchOpen ? searchInputWrapper : <Icon name='search' />}\n </Button>\n );\n }, [searchLabel, setIsSearchOpen, isSearchOpen, searchInputWrapper]);\n\n let queryOptionPopover = null;\n if (currentQueryOptionId) {\n const queryOptionProps = { filter, sort, group }[currentQueryOptionId];\n if (\n queryOptionProps &&\n hasProp(queryOptionProps, 'renderer') &&\n queryOptionPopoverTarget.current\n ) {\n queryOptionPopover = (\n <FormDialog\n target={queryOptionPopoverTarget.current}\n heading={t(`${currentQueryOptionId}_by`)}\n onCancel={() => {\n if (queryOptionProps.onCancel() === false) return;\n setCurrentQueryOptionId(null);\n }}\n onSubmit={() => {\n if (queryOptionProps.onSubmit() === false) return;\n setCurrentQueryOptionId(null);\n }}\n >\n <queryOptionProps.renderer />\n </FormDialog>\n );\n }\n }\n\n const getQueryOptionAction = useCallback(\n (\n id: 'sort' | 'group' | 'filter',\n icon: string,\n queryOptionProps: QueryOptionDialogProps | PresetMenuProps\n ) => {\n return {\n text: t(id),\n id,\n icon,\n count: queryOptionProps.count,\n onClick: () => {\n if (hasProp(queryOptionProps, 'renderer')) {\n setCurrentQueryOptionId(id);\n queryOptionPopoverTarget.current = consolidatedActionsButtonRef.current ?? undefined;\n }\n if (hasProp(queryOptionProps, 'items')) {\n setActionsQueryOptionPreset({\n heading: t(`${id}_by`),\n menu: {\n mode: queryOptionProps.mode,\n items: queryOptionProps.items.map(item => ({ ...item, primary: item.text })),\n onItemClick: queryOptionProps.onItemClick\n }\n });\n setOptionPresetMenuOpen(true);\n }\n }\n };\n },\n []\n );\n\n const basicModeActions = useMemo(() => {\n let basicActions: Action[] = [];\n if (filter) {\n const filterAction: Action = getQueryOptionAction('filter', 'filter', filter);\n basicActions.push(filterAction);\n }\n if (sort) {\n const sortAction: Action = getQueryOptionAction('sort', 'arrow-up-down', sort);\n basicActions.push(sortAction);\n }\n if (group) {\n const groupAction: Action = getQueryOptionAction('group', 'row', group);\n basicActions.push(groupAction);\n }\n if (actions) {\n basicActions = basicActions.concat(actions);\n }\n\n return basicActions.length ? basicActions : undefined;\n }, [actions, filter, sort, group, getQueryOptionAction]);\n\n return (\n <Flex\n as={StyledListToolbar}\n container={{ direction: 'column', gap: 0.5 }}\n item={{ grow: 1 }}\n ref={toolbarRef}\n role='toolbar'\n >\n <Flex container={{ alignItems: 'start', justify: 'between', gap: 2 }}>\n <StyledContainer\n container={{\n alignItems: 'center',\n gap: viewSelector?.views?.length && 0.5,\n wrap: 'wrap'\n }}\n >\n <StyledHeadingText\n variant='h3'\n required={viewSelector?.views?.length && formControlProps?.required}\n aria-label={`${name}${\n viewSelector\n ? `: ${\n viewSelector.views.find(view => view.selected)?.text ??\n viewSelector.views[0].text\n }`\n : ''\n }`}\n >\n {!viewSelector || viewSelector.views.length <= 1 ? (\n `${\n viewSelector && viewSelector.views.length === 1 ? viewSelector.views[0].text : ''\n }`\n ) : (\n <StyledViewSelector\n variant='text'\n text={\n viewSelector.views.find(view => view.selected)?.text ??\n viewSelector.views[0].text\n }\n menu={{\n mode: 'single-select',\n items: viewSelector.views.map(view => ({\n ...view,\n primary: `${view.text}${\n view.id === viewSelector.defaultId ? ` (${t('default')})` : ''\n }${view.id === viewSelector.appDefaultId ? ` (${t('app_default')})` : ''}`\n })),\n onItemClick: viewSelector.onViewSelect\n }}\n />\n )}\n </StyledHeadingText>\n {isSmallOrAbove && count && <CountMeta count={count} />}\n </StyledContainer>\n <Flex container={{ alignItems: 'center', gap: 1 }} item={{ shrink: 0 }}>\n {isSmallOrAbove && additionalActions}\n {search && isSmallOrAbove && searchButton}\n {isSmallOrAbove && createNewButton}\n {isSmallOrAbove && basicModeActions && (\n <span>\n <Actions\n items={basicModeActions.map(({ icon, ...restProps }) => ({\n visual: icon ? <Icon name={icon} /> : undefined,\n ...restProps\n }))}\n menuAt={1}\n ref={consolidatedActionsButtonRef}\n />\n </span>\n )}\n {!isSmallOrAbove && count && <CountMeta count={count} />}\n </Flex>\n </Flex>\n {!isSmallOrAbove && (\n <>\n <Flex container={{ alignItems: 'start', justify: 'between', gap: 1 }}>\n {additionalActions}\n <Flex\n as={StyledSearchForm}\n container={{ alignItems: 'center', wrap: 'wrap', gap: 1 }}\n item={{ grow: 1 }}\n >\n {search && searchInputWrapper}\n </Flex>\n {createNewButton}\n {basicModeActions && (\n <span>\n <Actions\n items={basicModeActions.map(({ icon, ...restProps }) => ({\n visual: icon ? <Icon name={icon} /> : undefined,\n ...restProps\n }))}\n menuAt={1}\n ref={consolidatedActionsButtonRef}\n />\n </span>\n )}\n </Flex>\n </>\n )}\n\n {queryOptionPopover}\n\n <PresetMenuPopover\n buttonRef={consolidatedActionsButtonRef}\n heading={actionsQueryOptionPreset?.heading}\n menu={actionsQueryOptionPreset?.menu}\n isOpen={optionPresetMenuOpen}\n onClose={() => setOptionPresetMenuOpen(false)}\n />\n </Flex>\n );\n }\n);\n\nexport default ListToolbar;\n"]}
|
|
1
|
+
{"version":3,"file":"ListToolbar.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EAET,MAAM,OAAO,CAAC;AAEf,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,aAAa,CAAC;AACrB,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,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AAE,YAEhB,MAAM,IAAI,kBAAkB,GACxB,EACN,eAAe,EACf,gBAAgB,IAAI,CACnB,yBACE,KAAC,OAAO,IACN,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;oCACvD,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAC,CAAC,SAAS;oCAC/C,GAAG,SAAS;iCACb,CAAC,CAAC,EACH,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,4BAA4B,GACjC,GACG,CACR,IACI,GACN,CACJ,EAEA,kBAAkB,EAEnB,KAAC,iBAAiB,IAChB,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAC1C,IAAI,EAAE,wBAAwB,EAAE,IAAI,EACpC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAC7C,IACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n KeyboardEvent,\n PropsWithoutRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n MouseEvent\n} from 'react';\n\nimport Actions from '../Actions';\nimport Button from '../Button';\nimport { Action, ForwardProps } from '../../types';\nimport {\n useArrows,\n useBreakpoint,\n useConfiguration,\n useConsolidatedRef,\n useEscape,\n useFocusTrap,\n useFocusWithin,\n useI18n\n} from '../../hooks';\nimport Flex from '../Flex';\nimport SearchInput from '../SearchInput';\nimport Icon, { registerIcon } from '../Icon';\nimport * as filterIcon from '../Icon/icons/filter.icon';\nimport * as arrowUpDownIcon from '../Icon/icons/arrow-up-down.icon';\nimport * as rowIcon from '../Icon/icons/row.icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport * as moreIcon from '../Icon/icons/more.icon';\nimport { hasProp } from '../../utils';\nimport FormDialog from '../Dialog/FormDialog';\nimport { formatNumber } from '../Number';\n\nimport PresetMenuPopover, { PresetMenuPopoverProps } from './PresetMenuPopover';\nimport {\n StyledViewSelector,\n StyledSearchForm,\n StyledListToolbar,\n StyledHeadingText,\n StyledCountMeta,\n StyledContainer\n} from './ListToolbar.styles';\nimport {\n ListToolbarProps,\n PresetMenuProps,\n QueryOptionDialogProps,\n QueryOptionId\n} from './ListToolbar.types';\n\nregisterIcon(filterIcon, arrowUpDownIcon, rowIcon, plusIcon, moreIcon);\n\nconst CountMeta = ({ count }: { count: NonNullable<ListToolbarProps['count']> }) => {\n const { locale } = useConfiguration();\n const t = useI18n();\n const totalFormattedValue = formatNumber(count.total ?? 0, {\n locale,\n options: {\n useGrouping: true\n }\n });\n return (\n <StyledCountMeta variant='secondary'>\n {count.total !== undefined &&\n count.selected === undefined &&\n t('results_count', [count.totalHasMore ? `${totalFormattedValue}+` : totalFormattedValue], {\n count: count.total\n })}\n {count.total !== undefined &&\n count.selected !== undefined &&\n t(\n 'selected_count',\n [\n formatNumber(count.selected, { locale, options: { useGrouping: true } }),\n count.totalHasMore ? `${totalFormattedValue}+` : totalFormattedValue\n ],\n { count: count.selected }\n )}\n </StyledCountMeta>\n );\n};\n\nconst ListToolbar: FunctionComponent<ListToolbarProps & ForwardProps> = forwardRef(\n (\n {\n name,\n viewSelector,\n formControlProps,\n createNew,\n search,\n count,\n additionalActions,\n filter,\n sort,\n group,\n actions,\n actionsButtonRef\n }: PropsWithoutRef<ListToolbarProps>,\n ref: ListToolbarProps['ref']\n ) => {\n const t = useI18n();\n\n const isSmallOrAbove = useBreakpoint('sm');\n const consolidatedActionsButtonRef = useConsolidatedRef(actionsButtonRef);\n const toolbarRef = useConsolidatedRef(ref);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const searchWrapperRef = useRef<HTMLDivElement>(null);\n const searchButtonRef = useRef<HTMLButtonElement>(null);\n const [isSearchOpen, setIsSearchOpen] = useState(!!search?.value);\n\n const onSearchEscape = useCallback(() => {\n if (!search?.value) {\n setIsSearchOpen(false);\n }\n setTimeout(() => searchButtonRef.current?.focus());\n }, [search?.value]);\n\n useEffect(() => {\n if (search?.value) {\n setIsSearchOpen(true);\n }\n }, [search?.value]);\n\n const hasFocus = useFocusWithin([searchWrapperRef]);\n useArrows(hasFocus ? { current: null } : toolbarRef, {\n dir: 'left-right',\n selector: \"button:enabled:first-child, :not(input) + button:enabled, div[role='button']\"\n });\n\n useEffect(() => {\n if (searchWrapperRef.current) {\n const focusables = searchWrapperRef.current.querySelectorAll<HTMLElement>(\n \"button:enabled, input[type='search']:enabled\"\n );\n if (!hasFocus) {\n focusables.forEach(item => {\n item.tabIndex = -1;\n });\n if (\n searchButtonRef.current !== document.activeElement &&\n isSearchOpen &&\n !search?.value\n ) {\n setIsSearchOpen(false);\n }\n } else {\n focusables.forEach(item => {\n item.tabIndex = 0;\n });\n }\n }\n }, [hasFocus]);\n\n const [currentQueryOptionId, setCurrentQueryOptionId] = useState<QueryOptionId | null>(null);\n const queryOptionPopoverTarget = useRef<HTMLButtonElement>();\n\n const [actionsQueryOptionPreset, setActionsQueryOptionPreset] =\n useState<Pick<PresetMenuPopoverProps, 'heading' | 'menu'>>();\n const [optionPresetMenuOpen, setOptionPresetMenuOpen] = useState(false);\n\n const createNewButton = useMemo(() => {\n if (!createNew?.onClick) return null;\n const text = createNew.label ?? t('create_new');\n\n return (\n <Button variant='simple' icon label={text} aria-label={text} onClick={createNew.onClick}>\n <Icon name='plus' />\n </Button>\n );\n }, [t, createNew, isSmallOrAbove]);\n\n useFocusTrap(searchWrapperRef);\n useEscape(onSearchEscape, searchButtonRef);\n const searchInputWrapper = useMemo(\n () => (\n <div role='dialog' ref={searchWrapperRef}>\n <SearchInput\n {...search}\n onSearchSubmit={(value: string) => {\n search?.onSearchSubmit?.(value);\n onSearchEscape();\n }}\n onClick={(e: MouseEvent<HTMLInputElement>) => {\n e.preventDefault();\n }}\n ref={searchInputRef}\n tabIndex='-1'\n />\n </div>\n ),\n [search, onSearchEscape]\n );\n\n const searchLabel = t('search');\n const searchButton = useMemo(() => {\n return (\n <Button\n as='div'\n role='button'\n variant='simple'\n icon\n label={!isSearchOpen ? searchLabel : undefined}\n aria-label={searchLabel}\n onClick={() => {\n setIsSearchOpen(true);\n setTimeout(() => searchInputRef.current?.focus());\n }}\n onKeyDown={(e: KeyboardEvent<HTMLElement>) => {\n if (e.target !== searchInputRef.current && e.key === 'Enter') {\n setIsSearchOpen(true);\n setTimeout(() => {\n searchInputRef.current?.focus();\n searchInputRef.current?.select();\n });\n }\n }}\n tabIndex='-1'\n ref={searchButtonRef}\n >\n {isSearchOpen ? searchInputWrapper : <Icon name='search' />}\n </Button>\n );\n }, [searchLabel, setIsSearchOpen, isSearchOpen, searchInputWrapper]);\n\n let queryOptionPopover = null;\n if (currentQueryOptionId) {\n const queryOptionProps = { filter, sort, group }[currentQueryOptionId];\n if (\n queryOptionProps &&\n hasProp(queryOptionProps, 'renderer') &&\n queryOptionPopoverTarget.current\n ) {\n queryOptionPopover = (\n <FormDialog\n target={queryOptionPopoverTarget.current}\n heading={t(`${currentQueryOptionId}_by`)}\n onCancel={() => {\n if (queryOptionProps.onCancel() === false) return;\n setCurrentQueryOptionId(null);\n }}\n onSubmit={() => {\n if (queryOptionProps.onSubmit() === false) return;\n setCurrentQueryOptionId(null);\n }}\n >\n <queryOptionProps.renderer />\n </FormDialog>\n );\n }\n }\n\n const getQueryOptionAction = useCallback(\n (\n id: 'sort' | 'group' | 'filter',\n icon: string,\n queryOptionProps: QueryOptionDialogProps | PresetMenuProps\n ) => {\n return {\n text: t(id),\n id,\n icon,\n count: queryOptionProps.count,\n onClick: () => {\n if (hasProp(queryOptionProps, 'renderer')) {\n setCurrentQueryOptionId(id);\n queryOptionPopoverTarget.current = consolidatedActionsButtonRef.current ?? undefined;\n }\n if (hasProp(queryOptionProps, 'items')) {\n setActionsQueryOptionPreset({\n heading: t(`${id}_by`),\n menu: {\n mode: queryOptionProps.mode,\n items: queryOptionProps.items.map(item => ({ ...item, primary: item.text })),\n onItemClick: queryOptionProps.onItemClick\n }\n });\n setOptionPresetMenuOpen(true);\n }\n }\n };\n },\n []\n );\n\n const basicModeActions = useMemo(() => {\n let basicActions: Action[] = [];\n if (filter) {\n const filterAction: Action = getQueryOptionAction('filter', 'filter', filter);\n basicActions.push(filterAction);\n }\n if (sort) {\n const sortAction: Action = getQueryOptionAction('sort', 'arrow-up-down', sort);\n basicActions.push(sortAction);\n }\n if (group) {\n const groupAction: Action = getQueryOptionAction('group', 'row', group);\n basicActions.push(groupAction);\n }\n if (actions) {\n basicActions = basicActions.concat(actions);\n }\n\n return basicActions.length ? basicActions : undefined;\n }, [actions, filter, sort, group, getQueryOptionAction]);\n\n const selectedViewName = viewSelector\n ? viewSelector.views.find(view => view.selected)?.text ?? viewSelector.views[0].text\n : null;\n\n const labelText = viewSelector ? selectedViewName : name;\n\n return (\n <Flex\n as={StyledListToolbar}\n container={{ direction: 'column', gap: 0.5 }}\n item={{ grow: 1 }}\n ref={toolbarRef}\n role='toolbar'\n >\n <Flex container={{ alignItems: 'start', justify: 'between', gap: 2 }}>\n <StyledContainer\n container={{\n alignItems: 'center',\n gap: 1,\n wrap: 'wrap'\n }}\n >\n <StyledHeadingText\n variant='h3'\n required={viewSelector?.views?.length && formControlProps?.required}\n aria-label={selectedViewName ? `${name} - ${selectedViewName}` : name}\n >\n {!viewSelector || viewSelector.views.length <= 1 ? (\n labelText\n ) : (\n <StyledViewSelector\n variant='text'\n text={labelText}\n menu={{\n mode: 'single-select',\n items: viewSelector.views.map(view => ({\n ...view,\n primary: `${view.text}${\n view.id === viewSelector.defaultId ? ` (${t('default')})` : ''\n }${view.id === viewSelector.appDefaultId ? ` (${t('app_default')})` : ''}`\n })),\n onItemClick: viewSelector.onViewSelect\n }}\n />\n )}\n </StyledHeadingText>\n {isSmallOrAbove && count && <CountMeta count={count} />}\n </StyledContainer>\n <Flex container={{ alignItems: 'center', gap: 1 }} item={{ shrink: 0 }}>\n {isSmallOrAbove && additionalActions}\n {search && isSmallOrAbove && searchButton}\n {isSmallOrAbove && createNewButton}\n {isSmallOrAbove && basicModeActions && (\n <span>\n <Actions\n items={basicModeActions.map(({ icon, ...restProps }) => ({\n visual: icon ? <Icon name={icon} /> : undefined,\n ...restProps\n }))}\n menuAt={1}\n ref={consolidatedActionsButtonRef}\n />\n </span>\n )}\n {!isSmallOrAbove && count && <CountMeta count={count} />}\n </Flex>\n </Flex>\n {!isSmallOrAbove && (\n <>\n <Flex container={{ alignItems: 'start', justify: 'between', gap: 1 }}>\n {additionalActions}\n <Flex\n as={StyledSearchForm}\n container={{ alignItems: 'center', wrap: 'wrap', gap: 1 }}\n item={{ grow: 1 }}\n >\n {search && searchInputWrapper}\n </Flex>\n {createNewButton}\n {basicModeActions && (\n <span>\n <Actions\n items={basicModeActions.map(({ icon, ...restProps }) => ({\n visual: icon ? <Icon name={icon} /> : undefined,\n ...restProps\n }))}\n menuAt={1}\n ref={consolidatedActionsButtonRef}\n />\n </span>\n )}\n </Flex>\n </>\n )}\n\n {queryOptionPopover}\n\n <PresetMenuPopover\n buttonRef={consolidatedActionsButtonRef}\n heading={actionsQueryOptionPreset?.heading}\n menu={actionsQueryOptionPreset?.menu}\n isOpen={optionPresetMenuOpen}\n onClose={() => setOptionPresetMenuOpen(false)}\n />\n </Flex>\n );\n }\n);\n\nexport default ListToolbar;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuButton.d.ts","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,iBAAiB,EAKjB,oBAAoB,EACrB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGlF,OAAe,EAAE,WAAW,EAAgB,MAA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AW,CAAC;AAC9D,OAAgB,EAAE,YAAY,EAAiB,MAAM,YAAY,CAAC;AAQlE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,WAAW,eAAgB,SAAQ,SAAS,EAAE,cAAc;IAChE,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,qEAAqE;IACrE,KAAK,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAC/B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,0BAA0B;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC,CAAC;IACnE,qCAAqC;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,GAAG,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACzB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AA+CD,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,YAAY,GAAG,eAAe,CA2GjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { useConsolidatedRef, useUID, useFocusWithin, useDirection } from '../../
|
|
|
6
6
|
import Button, { StyledButton } from '../Button';
|
|
7
7
|
import Popover, { StyledPopover } from '../Popover';
|
|
8
8
|
import Menu from '../Menu';
|
|
9
|
-
import Icon, { registerIcon } from '../Icon';
|
|
9
|
+
import Icon, { registerIcon, StyledIcon } from '../Icon';
|
|
10
10
|
import * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';
|
|
11
11
|
import Text, { StyledText } from '../Text';
|
|
12
12
|
import Flex from '../Flex';
|
|
@@ -25,18 +25,25 @@ const StyledMenuButton = styled.button(({ theme: { base: { spacing } } }) => {
|
|
|
25
25
|
`;
|
|
26
26
|
});
|
|
27
27
|
StyledMenuButton.defaultProps = defaultThemeProp;
|
|
28
|
-
const StyledMenuButtonChildren = styled.div
|
|
29
|
-
|
|
28
|
+
const StyledMenuButtonChildren = styled.div(({ theme }) => {
|
|
29
|
+
return css `
|
|
30
|
+
max-width: 100%;
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
${StyledText} {
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
:not(${StyledText}) {
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${StyledIcon}:last-child:not(:first-child) {
|
|
42
|
+
/* Offsets the flex gap to make the down arrow appear to trail the text. */
|
|
43
|
+
margin-inline-start: -${theme.base.spacing};
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
});
|
|
40
47
|
const StyledMenuButtonPopover = styled(Popover) `
|
|
41
48
|
min-width: 20ch;
|
|
42
49
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAOR,WAAW,EAEZ,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB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AK,CAAC,CAAC;yBAClB;wBACD,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAChC,CAAC,EACD,cAAc,EAAE,SAAS,CAAC,OAAO,IAAI,SAAS,GAC9C,CACH,GACuB,IACzB,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n KeyboardEvent,\n MouseEventHandler,\n MouseEvent,\n UIEvent,\n PropsWithoutRef,\n useCallback,\n KeyboardEventHandler\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp, OmitStrict } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useConsolidatedRef, useUID, useFocusWithin, useDirection } from '../../hooks';\nimport Button, { ButtonProps, StyledButton } from '../Button';\nimport Popover, { PopoverProps, StyledPopover } from '../Popover';\nimport Menu from '../Menu';\nimport { AcceptedMouseEventElement } from '../Menu/Menu.types';\nimport Icon, { registerIcon } from '../Icon';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport Text, { StyledText } from '../Text';\nimport Flex from '../Flex';\nimport { Count } from '../Badges';\nimport type { MenuProps } from '../Menu/Menu.types';\nimport type { CountProps } from '../Badges/Count';\n\nregisterIcon(arrowMicroDownIcon);\n\nexport interface MenuButtonProps extends BaseProps, NoChildrenProp {\n /** The text for the MenuButton also used to set the aria-label. */\n text: string;\n /**\n * Determines the Button variant for the MenuButton.\n * @default \"secondary\"\n */\n variant?: ButtonProps['variant'];\n /** The name of the icon for the MenuButton. */\n icon?: string;\n /** Only display the icon. The text prop will be forwarded to a tooltip. */\n iconOnly?: ButtonProps['icon'];\n /** The total count representing the list data which was selected. */\n count?: CountProps['children'];\n /** The click handler for the MenuButton. */\n onClick?: MouseEventHandler;\n /** Menu related props. */\n menu?: MenuProps;\n /** Popover related props. */\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n /** DOM id for the button element. */\n id?: string;\n /** Ref for the button element. */\n ref?: ButtonProps['ref'];\n /** The keydown handler for the MenuButton. */\n onKeyDown?: KeyboardEventHandler;\n}\n\nconst StyledMenuButton = styled.button(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n gap: ${spacing};\n flex-shrink: 0;\n white-space: nowrap;\n max-width: 100%;\n\n & + ${StyledPopover} + ${StyledButton} {\n margin-inline-start: ${spacing};\n }\n `;\n }\n);\n\nStyledMenuButton.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonChildren = styled.div`\n max-width: 100%;\n\n ${StyledText} {\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n :not(${StyledText}) {\n flex-shrink: 0;\n }\n`;\n\nconst StyledMenuButtonPopover = styled(Popover)`\n min-width: 20ch;\n`;\n\nconst MenuButton: FunctionComponent<ForwardProps & MenuButtonProps> = forwardRef(\n (props: PropsWithoutRef<MenuButtonProps>, ref: MenuButtonProps['ref']) => {\n const uid = useUID();\n const {\n id = uid,\n text,\n menu,\n popover,\n onClick,\n onKeyDown,\n icon,\n count,\n iconOnly = false,\n ...restProps\n } = props;\n\n const [isOpen, setIsOpen] = useState(false);\n\n const buttonRef = useConsolidatedRef(ref);\n const popoverRef = useConsolidatedRef<HTMLDivElement>(popover?.ref);\n const menuRef = useConsolidatedRef<HTMLDivElement>(menu?.ref);\n\n // FIXME: Type assertion required for issue in useFocusWithin generic\n useFocusWithin<HTMLElement>(\n [popoverRef, buttonRef],\n useCallback(isFocused => {\n if (!isFocused) setIsOpen(false);\n }, [])\n );\n\n const { rtl } = useDirection();\n\n return (\n <>\n <Button\n as={StyledMenuButton}\n {...restProps}\n id={id}\n ref={buttonRef}\n aria-expanded={isOpen}\n aria-haspopup='menu'\n aria-controls={`${id}-popover`}\n aria-label={text}\n label={iconOnly && !isOpen ? text : undefined}\n onClick={(e: MouseEvent<HTMLButtonElement> & UIEvent<HTMLButtonElement>) => {\n // clickCount is 0 when triggered by keyboard.\n const clickCount = e.detail;\n\n // Close the menu if it is open and either:\n // It is a *mouse* click on the button.\n // Or, the menu mode is not multiselect.\n if (isOpen && (clickCount > 0 || menu?.mode !== 'multi-select')) {\n setIsOpen(false);\n } else {\n setIsOpen(true);\n }\n\n onClick?.(e);\n }}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Escape') setIsOpen(false);\n onKeyDown?.(e);\n }}\n icon={iconOnly}\n >\n <Flex as={StyledMenuButtonChildren} container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {!iconOnly && (\n <>\n {text && <Text>{text}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n {text && <Icon name='arrow-micro-down' />}\n </>\n )}\n </Flex>\n </Button>\n <StyledMenuButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n id={`${id}-popover`}\n {...popover}\n hideOnTargetHidden\n show={!!menu && isOpen}\n target={buttonRef.current}\n ref={popoverRef}\n >\n {menu && (\n <Menu\n {...menu}\n ref={menuRef}\n items={menu.items}\n onItemClick={(itemId, e) => {\n if (\n menu.mode !== 'multi-select' &&\n (e as MouseEvent<AcceptedMouseEventElement> & UIEvent<AcceptedMouseEventElement>)\n .detail > 0\n ) {\n setIsOpen(false);\n }\n menu.onItemClick?.(itemId, e);\n }}\n focusControlEl={buttonRef.current || undefined}\n />\n )}\n </StyledMenuButtonPopover>\n </>\n );\n }\n);\n\nexport default MenuButton;\n"]}
|
|
1
|
+
{"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAOR,WAAW,EAEZ,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE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AK,cAAc;4BAC3B,CAAgF;iCAC9E,MAAM,GAAG,CAAC,EACb;4BACA,SAAS,CAAC,KAAK,CAAC,CAAC;yBAClB;wBACD,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAChC,CAAC,EACD,cAAc,EAAE,SAAS,CAAC,OAAO,IAAI,SAAS,GAC9C,CACH,GACuB,IACzB,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n KeyboardEvent,\n MouseEventHandler,\n MouseEvent,\n UIEvent,\n PropsWithoutRef,\n useCallback,\n KeyboardEventHandler\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp, OmitStrict } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useConsolidatedRef, useUID, useFocusWithin, useDirection } from '../../hooks';\nimport Button, { ButtonProps, StyledButton } from '../Button';\nimport Popover, { PopoverProps, StyledPopover } from '../Popover';\nimport Menu from '../Menu';\nimport { AcceptedMouseEventElement } from '../Menu/Menu.types';\nimport Icon, { registerIcon, StyledIcon } from '../Icon';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport Text, { StyledText } from '../Text';\nimport Flex from '../Flex';\nimport { Count } from '../Badges';\nimport type { MenuProps } from '../Menu/Menu.types';\nimport type { CountProps } from '../Badges/Count';\n\nregisterIcon(arrowMicroDownIcon);\n\nexport interface MenuButtonProps extends BaseProps, NoChildrenProp {\n /** The text for the MenuButton also used to set the aria-label. */\n text: string;\n /**\n * Determines the Button variant for the MenuButton.\n * @default \"secondary\"\n */\n variant?: ButtonProps['variant'];\n /** The name of the icon for the MenuButton. */\n icon?: string;\n /** Only display the icon. The text prop will be forwarded to a tooltip. */\n iconOnly?: ButtonProps['icon'];\n /** The total count representing the list data which was selected. */\n count?: CountProps['children'];\n /** The click handler for the MenuButton. */\n onClick?: MouseEventHandler;\n /** Menu related props. */\n menu?: MenuProps;\n /** Popover related props. */\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n /** DOM id for the button element. */\n id?: string;\n /** Ref for the button element. */\n ref?: ButtonProps['ref'];\n /** The keydown handler for the MenuButton. */\n onKeyDown?: KeyboardEventHandler;\n}\n\nconst StyledMenuButton = styled.button(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n gap: ${spacing};\n flex-shrink: 0;\n white-space: nowrap;\n max-width: 100%;\n\n & + ${StyledPopover} + ${StyledButton} {\n margin-inline-start: ${spacing};\n }\n `;\n }\n);\n\nStyledMenuButton.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonChildren = styled.div(({ theme }) => {\n return css`\n max-width: 100%;\n\n ${StyledText} {\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n :not(${StyledText}) {\n flex-shrink: 0;\n }\n\n ${StyledIcon}:last-child:not(:first-child) {\n /* Offsets the flex gap to make the down arrow appear to trail the text. */\n margin-inline-start: -${theme.base.spacing};\n }\n `;\n});\n\nconst StyledMenuButtonPopover = styled(Popover)`\n min-width: 20ch;\n`;\n\nconst MenuButton: FunctionComponent<ForwardProps & MenuButtonProps> = forwardRef(\n (props: PropsWithoutRef<MenuButtonProps>, ref: MenuButtonProps['ref']) => {\n const uid = useUID();\n const {\n id = uid,\n text,\n menu,\n popover,\n onClick,\n onKeyDown,\n icon,\n count,\n iconOnly = false,\n ...restProps\n } = props;\n\n const [isOpen, setIsOpen] = useState(false);\n\n const buttonRef = useConsolidatedRef(ref);\n const popoverRef = useConsolidatedRef<HTMLDivElement>(popover?.ref);\n const menuRef = useConsolidatedRef<HTMLDivElement>(menu?.ref);\n\n // FIXME: Type assertion required for issue in useFocusWithin generic\n useFocusWithin<HTMLElement>(\n [popoverRef, buttonRef],\n useCallback(isFocused => {\n if (!isFocused) setIsOpen(false);\n }, [])\n );\n\n const { rtl } = useDirection();\n\n return (\n <>\n <Button\n as={StyledMenuButton}\n {...restProps}\n id={id}\n ref={buttonRef}\n aria-expanded={isOpen}\n aria-haspopup='menu'\n aria-controls={`${id}-popover`}\n aria-label={text}\n label={iconOnly && !isOpen ? text : undefined}\n onClick={(e: MouseEvent<HTMLButtonElement> & UIEvent<HTMLButtonElement>) => {\n // clickCount is 0 when triggered by keyboard.\n const clickCount = e.detail;\n\n // Close the menu if it is open and either:\n // It is a *mouse* click on the button.\n // Or, the menu mode is not multiselect.\n if (isOpen && (clickCount > 0 || menu?.mode !== 'multi-select')) {\n setIsOpen(false);\n } else {\n setIsOpen(true);\n }\n\n onClick?.(e);\n }}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Escape') setIsOpen(false);\n onKeyDown?.(e);\n }}\n icon={iconOnly}\n >\n <Flex as={StyledMenuButtonChildren} container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {!iconOnly && (\n <>\n {text && <Text>{text}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n {text && <Icon name='arrow-micro-down' />}\n </>\n )}\n </Flex>\n </Button>\n <StyledMenuButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n id={`${id}-popover`}\n {...popover}\n hideOnTargetHidden\n show={!!menu && isOpen}\n target={buttonRef.current}\n ref={popoverRef}\n >\n {menu && (\n <Menu\n {...menu}\n ref={menuRef}\n items={menu.items}\n onItemClick={(itemId, e) => {\n if (\n menu.mode !== 'multi-select' &&\n (e as MouseEvent<AcceptedMouseEventElement> & UIEvent<AcceptedMouseEventElement>)\n .detail > 0\n ) {\n setIsOpen(false);\n }\n menu.onItemClick?.(itemId, e);\n }}\n focusControlEl={buttonRef.current || undefined}\n />\n )}\n </StyledMenuButtonPopover>\n </>\n );\n }\n);\n\nexport default MenuButton;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-core",
|
|
3
|
-
"version": "4.0.0-dev.10.
|
|
3
|
+
"version": "4.0.0-dev.10.1",
|
|
4
4
|
"description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|